mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-26 22:56:43 +00:00
removing requests from bor
This commit is contained in:
parent
133b5bd7bb
commit
ccede75223
4 changed files with 3 additions and 52 deletions
|
|
@ -394,28 +394,7 @@ 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) {
|
|
||||||
// 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,18 +359,7 @@ func GenerateChain(config *params.ChainConfig, parent *types.Block, engine conse
|
||||||
gen(i, b)
|
gen(i, b)
|
||||||
}
|
}
|
||||||
|
|
||||||
var requests types.Requests
|
body := types.Body{Transactions: b.txs, Uncles: b.uncles, Withdrawals: b.withdrawals, Requests: nil}
|
||||||
if config.IsPrague(b.header.Number) {
|
|
||||||
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,21 +394,12 @@ 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()) {
|
|
||||||
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: requests,
|
Requests: nil,
|
||||||
Logs: allLogs,
|
Logs: allLogs,
|
||||||
GasUsed: *usedGas,
|
GasUsed: *usedGas,
|
||||||
}, nil
|
}, nil
|
||||||
|
|
|
||||||
|
|
@ -1407,14 +1407,6 @@ func (w *worker) generateWork(params *generateParams, witness bool) *newPayloadR
|
||||||
for _, r := range work.receipts {
|
for _, r := range work.receipts {
|
||||||
allLogs = append(allLogs, r.Logs...)
|
allLogs = append(allLogs, r.Logs...)
|
||||||
}
|
}
|
||||||
// Read requests if Prague is enabled.
|
|
||||||
if w.chainConfig.IsPrague(work.header.Number) {
|
|
||||||
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