Skip to content

feat(cast): add recover-authority for EIP7702 Authorization #10839

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

Merged
merged 5 commits into from
Jun 24, 2025

Conversation

jsvisa
Copy link
Contributor

@jsvisa jsvisa commented Jun 24, 2025

Motivation

cast decode-tx will parse the raw transaction, eg:

$ cast decode-tx $(cast tx 0x1ed57ddd9595c80b68b26f3b3a04e0fc5df6f1f41ef8423bd4f343a18cb18cef --raw)
{
  "signer": "0xb9df4a9ba45917e71d664d51462d46926e4798e7",
  "type": "0x4",
  "chainId": "0x1",
  "nonce": "0x75f",
  "gas": "0x493e0",
  "maxFeePerGas": "0x714d24d7",
  "maxPriorityFeePerGas": "0xf4240",
  "to": "0x17816e9a858b161c3e37016d139cf618056cacd4",
  "value": "0x0",
  "accessList": [],
  "authorizationList": [
    {
      "chainId": "0x1",
      "address": "0xb684710e6d5914ad6e64493de2a3c424cc43e970",
      "nonce": "0x3dc1",
      "yParity": "0x1",
      "r": "0x2f15ba55009fcd3682cd0f9c9645dd94e616f9a969ba3f1a5a2d871f9fe0f2b4",
      "s": "0x53c332a83312d0b17dd4c16eeb15b1ff5223398b14e0a55c70762e8f3972b7a5"
    }
  ],
  "input": "0x00000000000000000000000000000000000000000000000316580c3ab7e66cc4",
  "r": "0x2aceec9737d2a211c79aff3dbd4bf44a5cdabbdd6bbe19ff346a89d94d61914a",
  "s": "0x62e92842bfe7d2f3ff785c594c70fafafcb180fb32a774de1b92c588be8cd87b",
  "yParity": "0x0",
  "v": "0x0",
  "hash": "0x1ed57ddd9595c80b68b26f3b3a04e0fc5df6f1f41ef8423bd4f343a18cb18cef"
}

But what we got in authorizationList is the original RSV, so add a new subcommand for cast to decode the RSV into address, better for debugging, you can use it as below:

cast recover-authority '{ "chainId": "0x1", "address": "0xb684710e6d5914ad6e64493de2a3c424cc43e970", "nonce": "0x3dc1", "yParity": "0x1", "r": "0x2f15ba55009fcd3682cd0f9c9645dd94e616f9a969ba3f1a5a2d871f9fe0f2b4", "s": "0x53c332a83312d0b17dd4c16eeb15b1ff5223398b14e0a55c70762e8f3972b7a5" }'

0x17816E9A858b161c3E37016D139cf618056CaCD4

Solution

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

jsvisa added 4 commits June 24, 2025 19:17
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Signed-off-by: jsvisa <delweng@gmail.com>
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense, ty

pending @grandizzy or @zerosnacks

Copy link
Collaborator

@grandizzy grandizzy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm!

Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @jsvisa, makes sense!

@zerosnacks zerosnacks merged commit 8bd3d64 into foundry-rs:master Jun 24, 2025
22 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Jun 24, 2025
@jsvisa jsvisa deleted the cast-decode-auth branch June 24, 2025 14:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants