Skip to content

Conversation

lean-apple
Copy link
Contributor

@lean-apple lean-apple commented Sep 12, 2025

Motivation

Closes #11603.

Solution

Add sub-command b2e-payload to convert execution payload from beacon block to rpc execution payload.

e.g.:

cargo run --bin cast -- b2e-payload block-12225729-6ceadbf2a6adbbd64cbec33fdebbc582f25171cd30ac43f641cbe76ac7313ddf.json

File downloaded from these instructions :

see https://light-mainnet.beaconcha.in/slot/0x6ceadbf2a6adbbd64cbec33fdebbc582f25171cd30ac43f641cbe76ac7313ddf ("Download" icon on the right -> Signed Beacon Block -> Download as JSON).

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@lean-apple
Copy link
Contributor Author

Have a couple of observations/questions @mattsse @shekhirin @jenpaff @zerosnacks, with this simple draft :

  • made the choice to extract and convert only the payload right now, but do we want to recover the full execution block ?
  • It would be better to export the result to a json file,
  • Right now I extract the payload from the example json given this path message.body.execution_payload, but I guess there are more beacon block json formats, depending on the api providers, do we want to support a couple ?
  • Also if we add --url to download from certain API urls, we will have the same issue with json format

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.

good start, some suggestions, ideas

Right now I extract the payload from the example json given this path message.body.execution_payload, but I guess there are more beacon block json formats, depending on the api providers, do we want to support a couple ?

yep we could introduce an untagged enum

@lean-apple lean-apple marked this pull request as ready for review September 25, 2025 08:12
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.

lgtm!

@mattsse mattsse merged commit a83dc1a into foundry-rs:master Sep 25, 2025
14 of 16 checks passed
@github-project-automation github-project-automation bot moved this to Done in Foundry Sep 25, 2025
@lean-apple lean-apple deleted the cast-convert-beacon-to-el-block branch September 25, 2025 13:28
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.

Cast command to convert beacon block to execution block

3 participants