-
-
Notifications
You must be signed in to change notification settings - Fork 268
feat: add signEip7702Authorization to KeyringController
#5301
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
Conversation
e225fe3 to
082e817
Compare
082e817 to
47935e0
Compare
|
New dependencies detected. Learn more about Socket for GitHub ↗︎
|
|
@metamaskbot publish-preview |
|
Preview builds have been published. See these instructions for more information about preview builds. Expand for full list of packages and versions. |
signEip7702Authorization to KeyringController
21e65a0
Gudahtt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the changelog for the keying controller package? Certainly the keyring version bumps would be breaking changes at least. I don't see changes documented right now in either the PR description or the changelog file - we do require them to be listed in one place or the other, so that we know how to release this.
|
|
||
| return await keyring.signEip7702Authorization(from, [ | ||
| chainId, | ||
| contractAddress as Hex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: This cast is suppressing a TypeScript error about the undefined case. We asserted just a couple lines above that this value can be undefined. Could you clarify why we're overriding that error here? Is the address expected to be undefined in some cases or not?
Edit: I think I see what happened now, suggestion on this here: https://github.com/MetaMask/core/pull/5301/files#r1958425721
| const contractAddress = ethNormalize(params.contractAddress) as | ||
| | Hex | ||
| | undefined; | ||
|
|
||
| return await keyring.signEip7702Authorization(from, [ | ||
| chainId, | ||
| contractAddress as Hex, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Perhaps this is what you meant to do:
| const contractAddress = ethNormalize(params.contractAddress) as | |
| | Hex | |
| | undefined; | |
| return await keyring.signEip7702Authorization(from, [ | |
| chainId, | |
| contractAddress as Hex, | |
| const contractAddress = ethNormalize(params.contractAddress) as Hex; | |
| return await keyring.signEip7702Authorization(from, [ | |
| chainId, | |
| contractAddress, |
Ideally we'd validate the response from ethNormalize is non-falsy as well, or use a normalization function that returns Hex rather than string | undefined. But I see we make this assumption elsewhere already, so we can leave this improvement for a future PR.
EIP-7702 defines a new struct Authorization which represents authority to set a pointer to a contract address at an EOA - effectively making the EOA perform as a smart contract.
This change integrates the new
signEip7702Authorizationmethod added to eth- simple and hd keyrings in MetaMask/accounts#182. This is exposed viaKeyringController.signEip7702Authorizationas well as the message handlerKeyringController:SignEip7702Authorization.See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7702.md for details
Changelog:
@metamask/keyring-controller:
Added
signEip7702Authorizationmethod and correspondingKeyringController:signEip7702Authorizationmessage handler. #5301Changed
@metamask/eth-hd-keyringfrom ^7.0.4 to ^10.0.0 #5301@metamask/eth-simple-keyringfrom ^6.0.5 to ^8.1.0 #5301@metamask/eth-sig-utilfrom ^8.0.0 to ^8.2.0 #5301@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/accounts-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/address-book-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/approval-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/assets-controllers:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/base-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/bridge-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/build-utils:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/ens-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/eth-json-rpc-provider:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/gas-fee-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/json-rpc-engine:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/json-rpc-middleware-stream:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/message-manager:
Changed
@metamask/eth-sig-utilfrom ^8.0.0 to ^8.2.0 #5301@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/multichain-network-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/multichain-transactions-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/multichain:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/name-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/network-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/notification-services-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/permission-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/permission-log-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/polling-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/queued-request-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/rate-limit-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/remote-feature-flag-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/selected-network-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/signature-controller:
Changed
@metamask/eth-sig-utilfrom ^8.0.0 to ^8.2.0 #5301@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/token-search-discovery-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/transaction-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/user-operation-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301@metamask/name-controller:
Changed
@metamask/utilsfrom ^11.1.0 to ^11.2.0 #5301