Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 9 additions & 5 deletions cmd/evm/internal/t8ntool/execution.go
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,8 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
return h
}
var (
statedb = MakePreState(rawdb.NewMemoryDatabase(), chainConfig, pre, chainConfig.IsVerkle(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp))
isEIP4762 = chainConfig.IsVerkle(big.NewInt(int64(pre.Env.Number)), pre.Env.Timestamp)
statedb = MakePreState(rawdb.NewMemoryDatabase(), chainConfig, pre, isEIP4762)
signer = types.MakeSigner(chainConfig, new(big.Int).SetUint64(pre.Env.Number), pre.Env.Timestamp)
gaspool = new(core.GasPool)
blockHash = common.Hash{0x13, 0x37}
Expand Down Expand Up @@ -253,7 +254,6 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
}
}
statedb.SetTxContext(tx.Hash(), txIndex)
evm.AccessEvents = state.NewAccessEvents(evm.StateDB.PointCache())
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

core.ApplyMessage does this already if needed.

var (
snapshot = statedb.Snapshot()
prevGas = gaspool.Gas()
Expand Down Expand Up @@ -318,7 +318,9 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
evm.Config.Tracer.OnTxEnd(receipt, nil)
}
}
statedb.AccessEvents().Merge(evm.AccessEvents)
if isEIP4762 {
statedb.AccessEvents().Merge(evm.AccessEvents)
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

statedb.AccessEvents() is non-nil if isVerkleDb and evm.AccessEvents is non-nil if isEIP4762

}
txIndex++
}
statedb.IntermediateRoot(chainConfig.IsEIP158(vmContext.BlockNumber))
Expand Down Expand Up @@ -352,7 +354,9 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
amount := new(big.Int).Mul(new(big.Int).SetUint64(w.Amount), big.NewInt(params.GWei))
statedb.AddBalance(w.Address, uint256.MustFromBig(amount), tracing.BalanceIncreaseWithdrawal)

statedb.AccessEvents().AddAccount(w.Address, true)
if isEIP4762 {
statedb.AccessEvents().AddAccount(w.Address, true)
}
}

// Gather the execution-layer triggered requests.
Expand Down Expand Up @@ -420,7 +424,7 @@ func (pre *Prestate) Apply(vmConfig vm.Config, chainConfig *params.ChainConfig,
}

func MakePreState(db ethdb.Database, chainConfig *params.ChainConfig, pre *Prestate, verkle bool) *state.StateDB {
tdb := triedb.NewDatabase(db, &triedb.Config{Preimages: true})
tdb := triedb.NewDatabase(db, &triedb.Config{Preimages: true, IsVerkle: verkle})
sdb := state.NewDatabase(tdb, nil)

statedb, _ := state.New(types.EmptyRootHash, sdb)
Expand Down
5 changes: 0 additions & 5 deletions cmd/evm/internal/t8ntool/transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,6 @@ func Transition(ctx *cli.Context) error {
return err
}
}
if vktStr != stdinSelector {
if err := readFile(vktStr, "VKT", &inputData.Alloc); err != nil {
return err
}
}
Comment on lines -114 to -118
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

seemed unintended to me.

prestate.Pre = inputData.Alloc
if vktStr != stdinSelector && vktStr != "" {
if err := readFile(vktStr, "VKT", &inputData.VKT); err != nil {
Expand Down