mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 14:46:42 +00:00
parent
b29072c21e
commit
2df763df60
4 changed files with 56 additions and 3 deletions
|
|
@ -394,7 +394,28 @@ 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)
|
||||||
}
|
}
|
||||||
|
if chainConfig.IsPrague(vmContext.BlockNumber) && chainConfig.Bor == nil {
|
||||||
|
// Parse the requests from the logs
|
||||||
|
var allLogs []*types.Log
|
||||||
|
for _, receipt := range receipts {
|
||||||
|
allLogs = append(allLogs, receipt.Logs...)
|
||||||
|
}
|
||||||
|
requests, err := core.ParseDepositLogs(allLogs, chainConfig)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, nil, NewError(ErrorEVM, fmt.Errorf("could not parse requests logs: %v", err))
|
||||||
|
}
|
||||||
|
// Calculate the requests root
|
||||||
|
h := types.DeriveSha(requests, trie.NewStackTrie(nil))
|
||||||
|
execRs.RequestsHash = &h
|
||||||
|
// Get the deposits from the requests
|
||||||
|
deposits := make(types.Deposits, 0)
|
||||||
|
for _, req := range requests {
|
||||||
|
if dep, ok := req.Inner().(*types.Deposit); ok {
|
||||||
|
deposits = append(deposits, dep)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
execRs.DepositRequests = &deposits
|
||||||
|
}
|
||||||
// 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())
|
||||||
|
|
|
||||||
|
|
@ -359,7 +359,18 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
|
||||||
gen(i, b)
|
gen(i, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
body := types.Body{Transactions: b.txs, Uncles: b.uncles, Withdrawals: b.withdrawals, Requests: nil}
|
var requests types.Requests
|
||||||
|
if config.IsPrague(b.header.Number) && config.Bor == nil {
|
||||||
|
for _, r := range b.receipts {
|
||||||
|
d, err := ParseDepositLogs(r.Logs, config)
|
||||||
|
if err != nil {
|
||||||
|
panic(fmt.Sprintf("failed to parse deposit log: %v", err))
|
||||||
|
}
|
||||||
|
requests = append(requests, d...)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
body := types.Body{Transactions: b.txs, Uncles: b.uncles, Withdrawals: b.withdrawals, Requests: requests}
|
||||||
block, err := b.engine.FinalizeAndAssemble(cm, b.header, statedb, &body, b.receipts)
|
block, err := b.engine.FinalizeAndAssemble(cm, b.header, statedb, &body, b.receipts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
|
|
||||||
|
|
@ -394,12 +394,21 @@ func (p *ParallelStateProcessor) Process(block *types.Block, statedb *state.Stat
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Read requests if Prague is enabled.
|
||||||
|
var requests types.Requests
|
||||||
|
if p.config.IsPrague(block.Number()) && p.config.Bor == nil {
|
||||||
|
requests, err = ParseDepositLogs(allLogs, p.config)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
|
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
|
||||||
p.engine.Finalize(p.bc, header, statedb, block.Body())
|
p.engine.Finalize(p.bc, header, statedb, block.Body())
|
||||||
|
|
||||||
return &ProcessResult{
|
return &ProcessResult{
|
||||||
Receipts: receipts,
|
Receipts: receipts,
|
||||||
Requests: nil,
|
Requests: requests,
|
||||||
Logs: allLogs,
|
Logs: allLogs,
|
||||||
GasUsed: *usedGas,
|
GasUsed: *usedGas,
|
||||||
}, nil
|
}, nil
|
||||||
|
|
|
||||||
|
|
@ -1403,6 +1403,18 @@ func (w *worker) generateWork(params *generateParams, witness bool) *newPayloadR
|
||||||
}
|
}
|
||||||
|
|
||||||
body := types.Body{Transactions: work.txs, Withdrawals: params.withdrawals}
|
body := types.Body{Transactions: work.txs, Withdrawals: params.withdrawals}
|
||||||
|
allLogs := make([]*types.Log, 0)
|
||||||
|
for _, r := range work.receipts {
|
||||||
|
allLogs = append(allLogs, r.Logs...)
|
||||||
|
}
|
||||||
|
// Read requests if Prague is enabled.
|
||||||
|
if w.chainConfig.IsPrague(work.header.Number) && w.chainConfig.Bor == nil {
|
||||||
|
requests, err := core.ParseDepositLogs(allLogs, w.chainConfig)
|
||||||
|
if err != nil {
|
||||||
|
return &newPayloadResult{err: err}
|
||||||
|
}
|
||||||
|
body.Requests = requests
|
||||||
|
}
|
||||||
block, err := w.engine.FinalizeAndAssemble(w.chain, work.header, work.state, &body, work.receipts)
|
block, err := w.engine.FinalizeAndAssemble(w.chain, work.header, work.state, &body, work.receipts)
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue