@@ -80,29 +80,28 @@ func (p *StateProcessor) Process(block *types.Block, statedb *state.StateDB, cfg
80
80
return nil , nil , accesses , 0 , fmt .Errorf ("could not apply tx %d [%v]: %w" , i , tx .Hash ().Hex (), err )
81
81
}
82
82
statedb .Prepare (tx .Hash (), i )
83
- receipt , acc , err := applyTransaction (msg , p .config , p .bc , nil , gp , statedb , blockNumber , blockHash , tx , usedGas , vmenv )
83
+ receipt , err := applyTransaction (msg , p .config , p .bc , nil , gp , statedb , blockNumber , blockHash , tx , usedGas , vmenv )
84
84
if err != nil {
85
85
return nil , nil , accesses , 0 , fmt .Errorf ("could not apply tx %d [%v]: %w" , i , tx .Hash ().Hex (), err )
86
86
}
87
87
receipts = append (receipts , receipt )
88
88
allLogs = append (allLogs , receipt .Logs ... )
89
- accesses .Merge (acc )
90
89
}
91
90
// Finalize the block, applying any consensus engine specific extras (e.g. block rewards)
92
91
p .engine .Finalize (p .bc , header , statedb , block .Transactions (), block .Uncles ())
93
92
94
93
return receipts , allLogs , accesses , * usedGas , nil
95
94
}
96
95
97
- func applyTransaction (msg types.Message , config * params.ChainConfig , bc ChainContext , author * common.Address , gp * GasPool , statedb * state.StateDB , blockNumber * big.Int , blockHash common.Hash , tx * types.Transaction , usedGas * uint64 , evm * vm.EVM ) (* types.Receipt , * types. AccessWitness , error ) {
96
+ func applyTransaction (msg types.Message , config * params.ChainConfig , bc ChainContext , author * common.Address , gp * GasPool , statedb * state.StateDB , blockNumber * big.Int , blockHash common.Hash , tx * types.Transaction , usedGas * uint64 , evm * vm.EVM ) (* types.Receipt , error ) {
98
97
// Create a new context to be used in the EVM environment.
99
98
txContext := NewEVMTxContext (msg )
100
99
evm .Reset (txContext , statedb )
101
100
102
101
// Apply the transaction to the current state (included in the env).
103
102
result , err := ApplyMessage (evm , msg , gp )
104
103
if err != nil {
105
- return nil , txContext . Accesses , err
104
+ return nil , err
106
105
}
107
106
108
107
// Update the state with pending changes.
@@ -130,23 +129,25 @@ func applyTransaction(msg types.Message, config *params.ChainConfig, bc ChainCon
130
129
receipt .ContractAddress = crypto .CreateAddress (evm .TxContext .Origin , tx .Nonce ())
131
130
}
132
131
132
+ statedb .Witness ().Merge (txContext .Accesses )
133
+
133
134
// Set the receipt logs and create the bloom filter.
134
135
receipt .Logs = statedb .GetLogs (tx .Hash (), blockHash )
135
136
receipt .Bloom = types .CreateBloom (types.Receipts {receipt })
136
137
receipt .BlockHash = blockHash
137
138
receipt .BlockNumber = blockNumber
138
139
receipt .TransactionIndex = uint (statedb .TxIndex ())
139
- return receipt , txContext . Accesses , err
140
+ return receipt , err
140
141
}
141
142
142
143
// ApplyTransaction attempts to apply a transaction to the given state database
143
144
// and uses the input parameters for its environment. It returns the receipt
144
145
// for the transaction, gas used and an error if the transaction failed,
145
146
// indicating the block was invalid.
146
- func ApplyTransaction (config * params.ChainConfig , bc ChainContext , author * common.Address , gp * GasPool , statedb * state.StateDB , header * types.Header , tx * types.Transaction , usedGas * uint64 , cfg vm.Config ) (* types.Receipt , * types. AccessWitness , error ) {
147
+ func ApplyTransaction (config * params.ChainConfig , bc ChainContext , author * common.Address , gp * GasPool , statedb * state.StateDB , header * types.Header , tx * types.Transaction , usedGas * uint64 , cfg vm.Config ) (* types.Receipt , error ) {
147
148
msg , err := tx .AsMessage (types .MakeSigner (config , header .Number ), header .BaseFee )
148
149
if err != nil {
149
- return nil , nil , err
150
+ return nil , err
150
151
}
151
152
// Create a new context to be used in the EVM environment
152
153
blockContext := NewEVMBlockContext (header , bc , author )
0 commit comments