Skip to content

Readable delegation manager #54

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Conversation

danfinlay
Copy link
Contributor

What?

Adds a new SafeDelegationManger which receives its caveats in a human-readable form, and decodes them into the usual form for enforcement.

Why?

When considering how readable these delegations could be on a 3rd party hardware wallet that only supports ERC-712, we realized the caveat enforcers were falling short of where we'd ideally have their readability.

It seemed like a maximally security conscious user of a hardware wallet might prefer a contract account that ensured they had improved readability on the hardware wallet in exchange for gas cost.

How?

Subclasses the usual DelegationManager, and first transforms its received ReadableDelegation objects into traditional Delegations.

Is only compatible with caveat enforcers that:

  • Implement the new _convertReadableTermsToCaveats method.
  • Is registered on the SafeDelegationManager's termsToEnforcer map, creating a limited, permissioned set of caveats.

As a bonus, I made it throw an error if it receives an empty caveats array, to minimize another footgun that is lying around.

@danfinlay danfinlay requested a review from a team as a code owner March 5, 2025 05:40
@danfinlay
Copy link
Contributor Author

danfinlay commented Mar 5, 2025

Could have gas performance improved by re-implementing the redeemDelegation method, to avoid decoding twice.

@berardpb
Copy link

berardpb commented Mar 5, 2025

Missing an "a" in "manager"?

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.

2 participants