Skip to content

Commit 0ea1e1e

Browse files
authored
Cleanup MultiWriterAppStore (#1609)
MultiWriterAppStore was used to migrate EVM state keys from app.db to evm.db, since all clusters have now been migrated this functionality is no longer necessary, and is in fact incompatible with the changes introduced in PR #1532. This set of changes cleans out most of the obsolete code from that store: - Eliminate writes to the EvmStore from MultiWriterAppStore. - Eliminate Get/Has/Set/Delete from EvmStore. - Eliminate use of AppStore.SaveEVMStateToIAVL config setting.
1 parent db55f5e commit 0ea1e1e

15 files changed

+62
-452
lines changed

app_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ func mockMultiWriterStore(flushInterval int64) (*store.MultiWriterAppStore, erro
6161
}
6262
memDb, _ = db.LoadMemDB()
6363
evmStore := store.NewEvmStore(memDb, 100, 0)
64-
multiWriterStore, err := store.NewMultiWriterAppStore(iavlStore, evmStore, false)
64+
multiWriterStore, err := store.NewMultiWriterAppStore(iavlStore, evmStore)
6565
if err != nil {
6666
return nil, err
6767
}

cmd/loom/db/evm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ func newDumpEVMStateFromEvmDB() *cobra.Command {
5353

5454
fmt.Printf("version: %d, root: %x\n", version, root)
5555

56-
srcStateDB := gstate.NewDatabase(store.NewLoomEthDB(evmStore))
56+
srcStateDB := gstate.NewDatabase(store.NewLoomEthDB(evmDB))
5757
srcStateDBTrie, err := srcStateDB.OpenTrie(evmRoot)
5858
if err != nil {
5959
fmt.Printf("cannot open trie, %s\n", evmRoot.Hex())

cmd/loom/loom.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -646,7 +646,7 @@ func loadAppStore(
646646
if err != nil {
647647
return nil, nil, err
648648
}
649-
appStore, err = store.NewMultiWriterAppStore(iavlStore, evmStore, cfg.AppStore.SaveEVMStateToIAVL)
649+
appStore, err = store.NewMultiWriterAppStore(iavlStore, evmStore)
650650
if err != nil {
651651
return nil, nil, err
652652
}

config/config.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -747,9 +747,6 @@ AppStore:
747747
PruneInterval: {{ .AppStore.PruneInterval }}
748748
# Number of versions to prune at a time.
749749
PruneBatchSize: {{ .AppStore.PruneBatchSize }}
750-
# If true the app store will write EVM state to both IAVLStore and EvmStore
751-
# This config works with AppStore Version 3 (MultiWriterAppStore) only
752-
SaveEVMStateToIAVL: {{ .AppStore.SaveEVMStateToIAVL }}
753750
# Specifies the number of IAVL tree versions that should be kept in memory before writing a new
754751
# version to disk.
755752
# If set to zero every version will be written to disk unless overridden via the on-chain config.

e2e/chainconfig-loom.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,5 @@ ContractLogLevel: "debug"
66
LoomLogLevel: "debug"
77
AppStore:
88
Version: 3
9-
SaveEVMStateToIAVL: false
109
CachingStore:
1110
CachingEnabled: true

e2e/chainconfig-routine-loom.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ ContractLogLevel: "debug"
88
LoomLogLevel: "debug"
99
AppStore:
1010
Version: 3
11-
SaveEVMStateToIAVL: false
1211
CachingStore:
1312
CachingEnabled: true

e2e/loom-3-loom.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ ContractLogLevel: "debug"
66
LoomLogLevel: "debug"
77
AppStore:
88
Version: 3
9-
SaveEVMStateToIAVL: false
109
CachingStoreConfig:
1110
CachingEnabled: true
1211

e2e/loom-4-loom.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ ContractLogLevel: "debug"
66
LoomLogLevel: "debug"
77
AppStore:
88
Version: 3
9-
SaveEVMStateToIAVL: false
109
CachingStoreConfig:
1110
CachingEnabled: true
1211

e2e/loom-5-loom.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,5 @@ ContractLogLevel: "debug"
77
LoomLogLevel: "debug"
88
AppStore:
99
Version: 3
10-
SaveEVMStateToIAVL: false
1110
CachingStoreConfig:
1211
CachingEnabled: true

store/config.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@ type AppStoreConfig struct {
1212
PruneInterval int64
1313
// Number of versions to prune at a time.
1414
PruneBatchSize int64
15-
// If true the app store will write EVM state to both IAVLStore and EvmStore
16-
// This config works with AppStore Version 3 (MultiWriterAppStore) only
15+
// Obsolete and no longer used
1716
SaveEVMStateToIAVL bool
1817
// Specifies the number of IAVL tree versions that should be kept in memory before writing a new
1918
// version to disk.

0 commit comments

Comments
 (0)