Skip to content

Commit

Permalink
parlia: add state prepare for internal SC transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
MatusKysel committed Mar 12, 2024
1 parent fd914c2 commit 7779b82
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions consensus/parlia/parlia.go
Original file line number Diff line number Diff line change
Expand Up @@ -1988,16 +1988,19 @@ func applyMessage(
chainConfig *params.ChainConfig,
chainContext core.ChainContext,
) (uint64, error) {
// TODO(Nathan): state.Prepare should be called here, now accessList related EIP not affect systemtxs
// EIP1153 may cause a critical issue in the future
// Create a new context to be used in the EVM environment
context := core.NewEVMBlockContext(header, chainContext, nil)
// Create a new environment which holds all relevant information
// about the transaction and calling mechanisms.
vmenv := vm.NewEVM(context, vm.TxContext{Origin: msg.From(), GasPrice: big.NewInt(0)}, state, chainConfig, vm.Config{})
// Apply the transaction to the current state (included in the env)
if chainConfig.IsCancun(header.Number, header.Time) {
rules := vmenv.ChainConfig().Rules(vmenv.Context.BlockNumber, vmenv.Context.Random != nil, vmenv.Context.Time)
state.Prepare(rules, msg.From(), vmenv.Context.Coinbase, msg.To(), vm.ActivePrecompiles(rules), msg.AccessList)
}
// Increment the nonce for the next transaction
state.SetNonce(msg.From(), state.GetNonce(msg.From())+1)

ret, returnGas, err := vmenv.Call(
vm.AccountRef(msg.From()),
*msg.To(),
Expand Down

0 comments on commit 7779b82

Please sign in to comment.