From 8be6823cb17c13480a23d2cbd18113462b20f358 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 22 Apr 2022 18:23:38 +0300 Subject: [PATCH 1/2] core: fix broken stateroot storage Store stateroot by DataMPTAux prefix instead of storing it by index only. --- pkg/core/blockchain_neotest_test.go | 2 +- pkg/core/stateroot/store.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/pkg/core/blockchain_neotest_test.go b/pkg/core/blockchain_neotest_test.go index e09be9a04..80b30068b 100644 --- a/pkg/core/blockchain_neotest_test.go +++ b/pkg/core/blockchain_neotest_test.go @@ -277,7 +277,7 @@ func TestBlockchain_StartFromExistingDB(t *testing.T) { cache := storage.NewMemCachedStore(ps) // Extra wrapper to avoid good DB corruption. key := make([]byte, 5) key[0] = byte(storage.DataMPTAux) - binary.BigEndian.PutUint32(key, h) + binary.BigEndian.PutUint32(key[1:], h) cache.Delete(key) _, _, _, err := chain.NewMultiWithCustomConfigAndStoreNoCheck(t, customConfig, cache) diff --git a/pkg/core/stateroot/store.go b/pkg/core/stateroot/store.go index be6529ca4..c334115fb 100644 --- a/pkg/core/stateroot/store.go +++ b/pkg/core/stateroot/store.go @@ -51,7 +51,7 @@ func (s *Module) getStateRoot(key []byte) (*state.MPTRoot, error) { func makeStateRootKey(index uint32) []byte { key := make([]byte, 5) key[0] = byte(storage.DataMPTAux) - binary.BigEndian.PutUint32(key, index) + binary.BigEndian.PutUint32(key[1:], index) return key } From 1890e7cdc175cb743f96732ea9740f7fc81ec3a8 Mon Sep 17 00:00:00 2001 From: Anna Shaleva Date: Fri, 22 Apr 2022 18:28:56 +0300 Subject: [PATCH 2/2] core: upgrade storage version --- pkg/core/blockchain.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/core/blockchain.go b/pkg/core/blockchain.go index 6ffdba4ed..efbf57d0d 100644 --- a/pkg/core/blockchain.go +++ b/pkg/core/blockchain.go @@ -46,7 +46,7 @@ import ( // Tuning parameters. const ( headerBatchCount = 2000 - version = "0.2.5" + version = "0.2.6" defaultInitialGAS = 52000000_00000000 defaultGCPeriod = 10000