From 7445223576d6aa7aacb017746dd0441abd177a64 Mon Sep 17 00:00:00 2001 From: "Wonyong Kim(Ryan Kim)" Date: Wed, 14 Dec 2022 15:24:17 +0900 Subject: [PATCH 1/2] perf(trie): disable preimage by default --- trie/zk_trie_database.go | 3 +-- trie/zk_trie_test.go | 3 ++- 2 files changed, 3 insertions(+), 3 deletions(-) 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 } From a6832edd664efff27f7b9d8250ef7886017f6080 Mon Sep 17 00:00:00 2001 From: "Wonyong Kim(Ryan Kim)" Date: Sat, 17 Dec 2022 22:51:22 +0900 Subject: [PATCH 2/2] refac(light): remove unneeded member variable --- light/txpool.go | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) 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] }