mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-18 18:02:24 +00:00
cmd/evm/internal/t8ntool: add support for EIP-7002, EIP-7251
This commit is contained in:
parent
e657c38189
commit
43c566cfe5
1 changed files with 16 additions and 3 deletions
|
|
@ -379,8 +379,10 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
execRs.CurrentExcessBlobGas = (*math.HexOrDecimal64)(&excessBlobGas)
|
execRs.CurrentExcessBlobGas = (*math.HexOrDecimal64)(&excessBlobGas)
|
||||||
execRs.CurrentBlobGasUsed = (*math.HexOrDecimal64)(&blobGasUsed)
|
execRs.CurrentBlobGasUsed = (*math.HexOrDecimal64)(&blobGasUsed)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var requests [][]byte
|
||||||
if chainConfig.IsPrague(vmContext.BlockNumber, vmContext.Time) {
|
if chainConfig.IsPrague(vmContext.BlockNumber, vmContext.Time) {
|
||||||
// Parse the requests from the logs
|
// EIP-6110 deposits
|
||||||
var allLogs []*types.Log
|
var allLogs []*types.Log
|
||||||
for _, receipt := range receipts {
|
for _, receipt := range receipts {
|
||||||
allLogs = append(allLogs, receipt.Logs...)
|
allLogs = append(allLogs, receipt.Logs...)
|
||||||
|
|
@ -389,12 +391,23 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not parse requests logs: %v", err))
|
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not parse requests logs: %v", err))
|
||||||
}
|
}
|
||||||
requests := [][]byte{depositRequests}
|
requests = append(requests, depositRequests)
|
||||||
// Calculate the requests root
|
// create EVM for system calls
|
||||||
|
vmenv := vm.NewEVM(vmContext, vm.TxContext{}, statedb, chainConfig, vm.Config{})
|
||||||
|
// EIP-7002 withdrawals
|
||||||
|
withdrawalRequests := core.ProcessWithdrawalQueue(vmenv, statedb)
|
||||||
|
requests = append(requests, withdrawalRequests)
|
||||||
|
// EIP-7251 consolidations
|
||||||
|
consolidationRequests := core.ProcessConsolidationQueue(vmenv, statedb)
|
||||||
|
requests = append(requests, consolidationRequests)
|
||||||
|
}
|
||||||
|
if requests != nil {
|
||||||
|
// Set requestsHash on block.
|
||||||
h := types.CalcRequestsHash(requests)
|
h := types.CalcRequestsHash(requests)
|
||||||
execRs.RequestsHash = &h
|
execRs.RequestsHash = &h
|
||||||
execRs.Requests = requests
|
execRs.Requests = requests
|
||||||
}
|
}
|
||||||
|
|
||||||
// Re-create statedb instance with new root upon the updated database
|
// Re-create statedb instance with new root upon the updated database
|
||||||
// for accessing latest states.
|
// for accessing latest states.
|
||||||
statedb, err = state.New(root, statedb.Database())
|
statedb, err = state.New(root, statedb.Database())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue