Introducing Caveat "Scopes"#51
Merged
Merged
Conversation
jeffsmale90
reviewed
Aug 7, 2025
Contributor
Author
|
Old PR #31 |
- Add scope-based caveat builders for common delegation patterns - Update delegation factory functions to require environment and scope configuration - Move CoreCaveatBuilder into it's own file - Move resolveCaveats into it's own file
B# modified: packages/delegator-e2e/test/caveats/exactExecutionBatch.test.ts
🚨 Bugbot Trial ExpiredYour team's Bugbot trial has expired. Please contact your team administrator to turn on the paid plan to continue using Bugbot. A team admin can activate the plan in the Cursor dashboard. |
jeffsmale90
previously approved these changes
Aug 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
📝 Description
Refactors the caveat builder architecture to support scoped configurations, and declarative Delegation configuration.
🔄 What Changed?
List the specific changes made:
createDelegationandcreateOpenDelegationto require a scope configuration (and Delegator Environment)See https://www.notion.so/metamask-consensys/Scopes-22cf86d67d68801b93bdfb50416b789e for the different scopes, and permutations
🚀 Why?
Scopes: There is a significant risk that developers will (accidentally) create delegations with insufficient restrictions. Scopes reduce this likelihood, by ensuring all delegations start with a single unit of authority, that may be restricted further.
Declarative API: By defining the
createDelegationandcreateOpenDelegationapis declaratively, it reduces the overhead for the developer to first create the caveat builder, then the delegation, they simply describe the delegation .🧪 How to Test?
Describe how to test these changes:
List any breaking changes:
createDelegationandcreateOpenDelegationnow require anenvironmentandscope, delegations without ascopemust be manually created (intentional friction to create insecure delegationsresolveCaveatsfunction signature updated to requireenvironmentandscopeparameters📋 Checklist
Check off completed items:
🔗 Related Issues