Skip to content
This repository was archived by the owner on Apr 18, 2025. It is now read-only.

Commit b7cf183

Browse files
committed
apply zktrie and storage proof
1 parent 9a5b56f commit b7cf183

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

geth-utils/l2geth/trace.go

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/scroll-tech/go-ethereum/core/types"
1414
"github.com/scroll-tech/go-ethereum/core/vm"
1515
"github.com/scroll-tech/go-ethereum/params"
16+
"github.com/scroll-tech/go-ethereum/trie"
1617
)
1718

1819
type Block struct {
@@ -199,8 +200,12 @@ func L2Trace(config TraceConfig) (*types.BlockTrace, error) {
199200
}
200201
block := types.NewBlockWithHeader(header).WithBody(txs, nil)
201202

203+
trieCfg := &trie.Config{Zktrie: true}
202204
// Setup state db with accounts from argument
203-
stateDB, _ := state.New(common.Hash{}, state.NewDatabase(rawdb.NewMemoryDatabase()), nil)
205+
stateDB, _ := state.New(
206+
common.Hash{},
207+
state.NewDatabaseWithConfig(rawdb.NewMemoryDatabase(), trieCfg),
208+
nil)
204209
for address, account := range config.Accounts {
205210
stateDB.SetNonce(address, uint64(account.Nonce))
206211
stateDB.SetCode(address, account.Code)
@@ -211,7 +216,9 @@ func L2Trace(config TraceConfig) (*types.BlockTrace, error) {
211216
stateDB.SetState(address, key, value)
212217
}
213218
}
214-
stateDB.Finalise(true)
219+
if _, err := stateDB.Commit(true); err != nil {
220+
return nil, err
221+
}
215222

216223
traceEnv := core.CreateTraceEnvDirect(
217224
&chainConfig,

0 commit comments

Comments
 (0)