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

fix(taiko): decode basefeeSharingPctg from extradata for ontake blocks #370

Merged
merged 1 commit into from
Jan 22, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions eth/state_accessor.go
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,12 @@ func (eth *Ethereum) stateAtTransaction(ctx context.Context, block *types.Block,
}
// Assemble the transaction call message and return if the requested offset
msg, _ := core.TransactionToMessage(tx, signer, block.BaseFee())

// CHANGE(taiko): decode the basefeeSharingPctg config from the extradata, and
// add it to the Message, if its an ontake block.
if eth.blockchain.Config().IsOntake(block.Number()) {
msg.BasefeeSharingPctg = core.DecodeOntakeExtraData(block.Header().Extra)
}
txContext := core.NewEVMTxContext(msg)
context := core.NewEVMBlockContext(block.Header(), eth.blockchain, nil)
if idx == txIndex {
Expand Down
25 changes: 25 additions & 0 deletions eth/tracers/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,11 @@ func (api *API) traceChain(start, end *types.Block, config *TraceConfig, closed
}
}
msg, _ := core.TransactionToMessage(tx, signer, task.block.BaseFee())
// CHANGE(taiko): decode the basefeeSharingPctg config from the extradata, and
// add it to the Message, if its an ontake block.
if api.backend.ChainConfig().IsOntake(task.block.Number()) {
msg.BasefeeSharingPctg = core.DecodeOntakeExtraData(task.block.Header().Extra)
}
txctx := &Context{
BlockHash: task.block.Hash(),
BlockNumber: task.block.Number(),
Expand Down Expand Up @@ -565,6 +570,11 @@ func (api *API) IntermediateRoots(ctx context.Context, hash common.Hash, config
txContext = core.NewEVMTxContext(msg)
vmenv = vm.NewEVM(vmctx, txContext, statedb, chainConfig, vm.Config{})
)
// CHANGE(taiko): decode the basefeeSharingPctg config from the extradata, and
// add it to the Message, if its an ontake block.
if api.backend.ChainConfig().IsOntake(block.Number()) {
msg.BasefeeSharingPctg = core.DecodeOntakeExtraData(block.Header().Extra)
}
statedb.SetTxContext(tx.Hash(), i)
if _, err := core.ApplyMessage(vmenv, msg, new(core.GasPool).AddGas(msg.GasLimit)); err != nil {
log.Warn("Tracing intermediate roots did not complete", "txindex", i, "txhash", tx.Hash(), "err", err)
Expand Down Expand Up @@ -647,6 +657,11 @@ func (api *API) traceBlock(ctx context.Context, block *types.Block, config *Trac
}
// Generate the next state snapshot fast without tracing
msg, _ := core.TransactionToMessage(tx, signer, block.BaseFee())
// CHANGE(taiko): decode the basefeeSharingPctg config from the extradata, and
// add it to the Message, if its an ontake block.
if api.backend.ChainConfig().IsOntake(block.Number()) {
msg.BasefeeSharingPctg = core.DecodeOntakeExtraData(block.Header().Extra)
}
txctx := &Context{
BlockHash: blockHash,
BlockNumber: block.Number(),
Expand Down Expand Up @@ -694,6 +709,11 @@ func (api *API) traceBlockParallel(ctx context.Context, block *types.Block, stat
// Fetch and execute the next transaction trace tasks
for task := range jobs {
msg, _ := core.TransactionToMessage(txs[task.index], signer, block.BaseFee())
// CHANGE(taiko): decode the basefeeSharingPctg config from the extradata, and
// add it to the Message, if its an ontake block.
if api.backend.ChainConfig().IsOntake(block.Number()) {
msg.BasefeeSharingPctg = core.DecodeOntakeExtraData(block.Header().Extra)
}
txctx := &Context{
BlockHash: blockHash,
BlockNumber: block.Number(),
Expand Down Expand Up @@ -829,6 +849,11 @@ func (api *API) standardTraceBlockToFile(ctx context.Context, block *types.Block
writer *bufio.Writer
err error
)
// CHANGE(taiko): decode the basefeeSharingPctg config from the extradata, and
// add it to the Message, if its an ontake block.
if api.backend.ChainConfig().IsOntake(block.Number()) {
msg.BasefeeSharingPctg = core.DecodeOntakeExtraData(block.Header().Extra)
}
// If the transaction needs tracing, swap out the configs
if tx.Hash() == txHash || txHash == (common.Hash{}) {
// Generate a unique temporary file to dump it into
Expand Down