Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatically approve built-in market as operator for all minted datacap #611

Merged
merged 2 commits into from
Sep 9, 2022

Conversation

anorth
Copy link
Member

@anorth anorth commented Sep 7, 2022

Minting is not a standard token method, so adding a parameter to mint allows this to happen with the business logic of which account to approve encapsulated in the verified registry, but no additional inter-actor sends.

Closes #529.

@anorth anorth requested a review from ZenGround0 September 7, 2022 03:40
Copy link
Contributor

@ZenGround0 ZenGround0 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For now this looks ok. I'm still stuck on understanding how allowances change when funds are transferred and burned. I hope we can have the market track ups and downs in allowance as datacap is minted to and transferred out of clients but I don't see and decrease allowance calls yet. Maybe this is happening already inside the token library? If we're just recording the high water mark it would achieve the same thing and be clearer to give the market an effectively infinite allowance from the start.

operator_data: Default::default(),
token_data: Default::default(),
};
rt.expect_send(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I might be confused about this but I don't think this ExitCode::OK is a good representation of what will actually happen. The receiver hook gets called on the verified client which for the time being will be an actor that can sign things which means it will not implement the receiver hook method and will fail with INVALID_METHOD or something like that.

I think that everything still works because of your impl of Token Messaging trait and I want to see that exercised.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the verified client which for the time being will be an actor that can sign things which means it will not implement the receiver hook method

Your confusion is that the built-in account and multisig actors do implement the receiver hook (#555), which is independent of any signing/validation-related things.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

aha cool !

@ZenGround0
Copy link
Contributor

Ok this is starting to make more sense. I think the market actor is going to be calling transfer_from where the current code calls UseBytes and in this case the allowance will be used. If this is the only movement of datacap from verified clients we get the invariant Market Allowance == Verified Client Balance. Taking into account burns, transitive burns through destroy, and direct transfers which are all allowed we have the weaker but still safe Market Allowance >= Verified Client Balance.

What I don't quite see is how this works when we open up FIL+ for use with general markets. Are you imagining all FIL+ registered markets get allowance for all verified clients and it doesn't matter that we're way overcounting? Is that the purpose of the operator list rather than just hardcoding market in datacap or sending a single value?

@anorth anorth force-pushed the anorth/marketdelegate branch from 6076bcf to a884130 Compare September 8, 2022 23:06
@anorth
Copy link
Member Author

anorth commented Sep 8, 2022

Thanks for challenging. You're right that this was only effectively setting a high water mark allowance. So to simplify, I've changed it to a fixed 2bn allowance. (It's actually not fixed right now, but we can do so when the token library lets us, which I've requested).

What I don't quite see is how this works when we open up FIL+ for use with general markets. Are you imagining all FIL+ registered markets get allowance for all verified clients and it doesn't matter that we're way overcounting? Is that the purpose of the operator list rather than just hardcoding market in datacap or sending a single value?

For general markets, clients will need to explicitly approve allowance for those markets. I'd like to apply this to the built-in one some day too. Market UIs should generally make that transparent for users. The operator list is just a way to move this policy into verifreg rather than the datacap actor. It could have been a single value, but then one might want it to be optional, at which point a list just seemed like a more natural representation.

@codecov-commenter
Copy link

codecov-commenter commented Sep 8, 2022

Codecov Report

❗ No coverage uploaded for pull request base (decouple-fil+@4899922). Click here to learn what that means.
The diff coverage is n/a.

Impacted file tree graph

@@               Coverage Diff                @@
##             decouple-fil+     #611   +/-   ##
================================================
  Coverage                 ?   84.06%           
================================================
  Files                    ?       95           
  Lines                    ?    18728           
  Branches                 ?        0           
================================================
  Hits                     ?    15743           
  Misses                   ?     2985           
  Partials                 ?        0           

@anorth anorth merged commit 653b01b into decouple-fil+ Sep 9, 2022
@anorth anorth deleted the anorth/marketdelegate branch September 9, 2022 00:50
shamb0 pushed a commit to shamb0/builtin-actors that referenced this pull request Jan 31, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants