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

Add signEIP7702Authorization and corresponding tests to hd and simple Eth keyrings #182

Merged
merged 7 commits into from
Feb 5, 2025

Conversation

jeffsmale90
Copy link
Contributor

@jeffsmale90 jeffsmale90 commented Jan 30, 2025

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 signEIP7702Authorization added to eth-sig-util in MetaMask/eth-sig-util#407 to the eth-simple and eth-hd keyrings.

See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7702.md for details

@jeffsmale90 jeffsmale90 force-pushed the feat/sign-authorization branch 3 times, most recently from fbef2bf to 1e79c7f Compare January 31, 2025 01:28
@jeffsmale90 jeffsmale90 marked this pull request as ready for review February 3, 2025 02:12
@jeffsmale90 jeffsmale90 requested a review from a team as a code owner February 3, 2025 02:12
@jeffsmale90 jeffsmale90 changed the title [Draft] Add signEIP7702Authorization and corresponding tests to hd and simple Eth keyrings Add signEIP7702Authorization and corresponding tests to hd and simple Eth keyrings Feb 3, 2025
@jeffsmale90 jeffsmale90 force-pushed the feat/sign-authorization branch from 1e79c7f to d34295d Compare February 3, 2025 22:07
@danroc
Copy link
Contributor

danroc commented Feb 4, 2025

I left a few minor comments regarding the naming of some methods.

From the perspective of this PR, it LGTM. I did raise some small concerns about eth-sig-util not performing certain checks defined in the EIP. The main risk is that the transaction could be invalid, but @matthewwalsh0 confirmed that we have other checks in place to account for this.

jeffsmale90 and others added 4 commits February 5, 2025 14:03
…ce. Improve names of a few tests.

Co-authored-by: Daniel Rocha <68558152+danroc@users.noreply.github.com>
- prefer .toStrictEqual in signEip7702Authorization test
- use type imports where possible
@jeffsmale90 jeffsmale90 requested a review from danroc February 5, 2025 03:03
@danroc danroc added this pull request to the merge queue Feb 5, 2025
Merged via the queue into main with commit 4176492 Feb 5, 2025
30 checks passed
@danroc danroc deleted the feat/sign-authorization branch February 5, 2025 08:53
@danroc
Copy link
Contributor

danroc commented Feb 5, 2025

@metamaskbot publish-previews

ccharly added a commit to MetaMask/utils that referenced this pull request Feb 11, 2025
#231)

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 adds an optional `signEip7702Authorization` method to the
`Keyring` type which is implemented on `@metamask/eth-simple-keyring`
and `@metamask/eth-hd-keyring` in
MetaMask/accounts#182.

See https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7702.md for
details

---------

Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
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