-
Notifications
You must be signed in to change notification settings - Fork 20.6k
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
internal/ethapi: support for beacon root and withdrawals in simulate api #31304
base: master
Are you sure you want to change the base?
Conversation
@@ -267,20 +276,22 @@ func (sim *simulator) processBlock(ctx context.Context, block *simBlock, header, | |||
// EIP-7251 | |||
core.ProcessConsolidationQueue(&requests, evm) | |||
} | |||
header.Root = sim.state.IntermediateRoot(true) |
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.
Root calculation moved to the end, i.e. after withdrawals since they change state.
internal/ethapi/simulate.go
Outdated
header.GasUsed = gasUsed | ||
if sim.chainConfig.IsCancun(header.Number, header.Time) { | ||
header.BlobGasUsed = &blobGasUsed | ||
} |
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.
gas and blob setting moved up, i.e. closer to where gasUsed
and blobGasUsed
are last used
if block.BlockOverrides.Withdrawals != nil { | ||
// We assume that if the user provides Withdrawals, we're operating on Beacon consensus | ||
// which can have nil ChainHeadReader | ||
sim.b.Engine().Finalize(nil, header, sim.state, blockBody) |
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.
Is there a better way to do this? e.g. create a ChainHeadReader (seems non-trivial)
Update simulate.go Update simulate.go Update simulate.go Update consensus.go passed withdrawals - now state root mismartch working but withdrawals issue Added support
fb1dd96
to
2407255
Compare
} | ||
if requests != nil { |
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.
This was moved up, closer where requests is calculated
Hey @rezbera, we also need withdrawal support in simulateV1 for our project. I've tweaked it like so. My idea was to handle withdrawals in the same way as they are handled in the "real" engine. State root hash is adjusted when address balance changes, so there's no need to manually change it. |
Addresses #31264