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

Ensure caveat enforcers are capable of requiring payment #58

Open
danfinlay opened this issue Mar 25, 2023 · 3 comments
Open

Ensure caveat enforcers are capable of requiring payment #58

danfinlay opened this issue Mar 25, 2023 · 3 comments
Labels
schema-change A change that will result in changing the types of the library, & so nneeding new tooling & docs.

Comments

@danfinlay
Copy link

A user might want to charge for using a permission they have, and this should be supported.

Examples:

This may require a schema change for caveat enforcers which allow them to accept tx-contextual additional information from the caller, to provide things like additional delegations enabling withdrawing a payment, for example.

@danfinlay danfinlay added the schema-change A change that will result in changing the types of the library, & so nneeding new tooling & docs. label Mar 27, 2023
@danfinlay
Copy link
Author

Ok I'm starting to think the "paid caveats" goal is not worth optimizing for in v2. Reasons:

  • Not compatible with 4337
  • Can be approximated (with a small extra gas cost) by batching transfers to the caveat enforcer before the paid operation (probably to a method that identifies what it's for). Will incur a 5k gas cost for having written state if it cleans it up, but that's not huge.

@DaveAppleton
Copy link

DaveAppleton commented Jul 7, 2023

It could still be useful to pass these items to the caveat

intendedSender , the root signer
canGrant , the current delegator
delegation.delegate , the current delegatee

This would allow much more flexibility, for example checking that each of these has some other kind of authorisation.

Of course this would still not allow final delegate to pay everybody in the chain.

@DaveAppleton
Copy link

Final thought - certainly possible (I did it) but it needs significant code and schema changes to avoid stack too deep errors in DelegatableCore and DelegatableRelayCore

Security is an issue - I made the paid caveat enforcer only callable from the specific contract to avoid an attacker calling the enforcer and stealing funds between a user making an allowance and using it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
schema-change A change that will result in changing the types of the library, & so nneeding new tooling & docs.
Projects
None yet
Development

No branches or pull requests

2 participants