diff --git a/light/txpool.go b/light/txpool.go index b58219b155..286d090a2c 100644 --- a/light/txpool.go +++ b/light/txpool.go @@ -70,11 +70,6 @@ type TxPool struct { istanbul bool // Fork indicator whether we are in the istanbul stage. eip2718 bool // Fork indicator whether we are in the eip2718 stage. - - // [Scroll: START] - // NOTE(chokobole): This part is different from scroll - zktrie bool - // [Scroll: END] } // TxRelayBackend provides an interface to the mechanism that forwards transactions to the @@ -109,10 +104,6 @@ func NewTxPool(config *params.ChainConfig, chain *LightChain, relay TxRelayBacke chainDb: chain.Odr().Database(), head: chain.CurrentHeader().Hash(), clearIdx: chain.CurrentHeader().Number.Uint64(), - // [Scroll: START] - // NOTE(chokobole): This part is different from scroll - zktrie: config.Zktrie, - // [Scroll: END] } // Subscribe events from blockchain pool.chainHeadSub = pool.chain.SubscribeChainHeadEvent(pool.chainHeadCh) @@ -125,7 +116,7 @@ func NewTxPool(config *params.ChainConfig, chain *LightChain, relay TxRelayBacke func (pool *TxPool) currentState(ctx context.Context) *state.StateDB { // [Scroll: START] // NOTE(chokobole): This part is different from scroll - return NewState(ctx, pool.chain.CurrentHeader(), pool.odr, pool.zktrie) + return NewState(ctx, pool.chain.CurrentHeader(), pool.odr, pool.config.Zktrie) // [Scroll: END] } diff --git a/trie/zk_trie_database.go b/trie/zk_trie_database.go index c08ab0f9b1..16c60ebf20 100644 --- a/trie/zk_trie_database.go +++ b/trie/zk_trie_database.go @@ -19,8 +19,7 @@ type ZktrieDatabase struct { func NewZktrieDatabase(diskdb ethdb.KeyValueStore) *ZktrieDatabase { // NOTE(chokobole): This part is different from scroll - // TODO(chokobole): We need to know Preimages is required. If we don't set here, some tests are failed. - return &ZktrieDatabase{db: NewDatabaseWithConfig(diskdb, &Config{Preimages: true, Zktrie: true}), prefix: []byte{}} + return &ZktrieDatabase{db: NewDatabaseWithConfig(diskdb, &Config{Zktrie: true}), prefix: []byte{}} } // adhoc wrapper... diff --git a/trie/zk_trie_test.go b/trie/zk_trie_test.go index adf7628b2a..bf9ddb5456 100644 --- a/trie/zk_trie_test.go +++ b/trie/zk_trie_test.go @@ -33,7 +33,8 @@ import ( ) func newEmptyZkTrie() *ZkTrie { - trie, _ := NewZkTrie(common.Hash{}, NewZktrieDatabase(memorydb.New())) + triedb := NewZktrieDatabaseFromTriedb(NewDatabaseWithConfig(memorydb.New(), &Config{Preimages: true})) + trie, _ := NewZkTrie(common.Hash{}, triedb) return trie }