Skip to content

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

Merged
danroc merged 7 commits into
mainfrom
feat/sign-authorization
Feb 5, 2025
Merged

danroc merged 7 commits into
mainfrom
feat/sign-authorization

Conversation

@jeffsmale90

@jeffsmale90 jeffsmale90 commented Jan 30, 2025 •

Copy link
Copy Markdown
Contributor

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
Comment thread packages/keyring-eth-hd/src/index.js Outdated
Comment thread packages/keyring-eth-hd/test/index.js Outdated
Comment thread packages/keyring-eth-hd/test/index.js Outdated
Comment thread packages/keyring-eth-hd/test/index.js Outdated
Comment thread packages/keyring-eth-hd/test/index.js Outdated
Comment thread packages/keyring-eth-simple/src/simple-keyring.ts Outdated
Comment thread packages/keyring-eth-simple/src/simple-keyring.ts Outdated
Comment thread packages/keyring-eth-hd/src/index.js Outdated
Comment thread packages/keyring-eth-simple/src/simple-keyring.test.ts Outdated
Comment thread packages/keyring-eth-simple/src/simple-keyring.test.ts Outdated
Comment thread packages/keyring-eth-simple/src/simple-keyring.test.ts Outdated
@danroc

danroc commented Feb 4, 2025

Copy link
Copy Markdown
Contributor

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
@danroc
danroc deleted the feat/sign-authorization branch February 5, 2025 08:53
@danroc

danroc commented Feb 5, 2025

Copy link
Copy Markdown
Contributor

@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>
jeffsmale90 added a commit to MetaMask/core that referenced this pull request Feb 17, 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` method added
to eth- simple and hd keyrings in
MetaMask/accounts#182. This is exposed via
`KeyringController.signEip7702Authorization` as well as the message
handler `KeyringController:SignEip7702Authorization`.

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

---------

Co-authored-by: Charly Chevalier <charly.chevalier@consensys.net>
pull Bot pushed a commit to Reality2byte/core that referenced this pull request Sep 10, 2026
#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>
montelaidev pushed a commit that referenced this pull request Sep 21, 2026
… Eth keyrings (#182)

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

---------

Co-authored-by: Daniel Rocha <68558152+danroc@users.noreply.github.com>
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