From f3e1748ac14b0fb0336232c11ac2040e0d5aa54a Mon Sep 17 00:00:00 2001 From: "ollie.j" Date: Tue, 13 Aug 2024 14:14:07 +0900 Subject: [PATCH 1/7] reward: Tidy SupplyTestSuite --- reward/supply_manager_test.go | 60 ++++++++++++++++++----------------- 1 file changed, 31 insertions(+), 29 deletions(-) diff --git a/reward/supply_manager_test.go b/reward/supply_manager_test.go index 750ea719b..27f7bebcb 100644 --- a/reward/supply_manager_test.go +++ b/reward/supply_manager_test.go @@ -93,6 +93,7 @@ type SupplyTestSuite struct { db database.DBManager genesis *types.Block chain *blockchain.BlockChain + blocks []*types.Block sm *supplyManager } @@ -103,11 +104,11 @@ func TestSupplyManager(t *testing.T) { // ---------------------------------------------------------------------------- // Test cases -// Tests totalSupplyFromState as well as the setupHistory() itself. -// This accounts for (AccMinted - AccBurntFee - kip103Burn - kip160Burn) but not (- zeroBurn - deadBurn). +// Tests totalSupplyFromState as well as the insertBlocks() itself. +// totalSupplyFromState accounts for (AccMinted - AccBurntFee - kip103Burn - kip160Burn) but not (- zeroBurn - deadBurn). func (s *SupplyTestSuite) TestFromState() { t := s.T() - s.setupHistory() + s.insertBlocks() s.sm.Start() // start catchup testcases := s.testcases() @@ -126,7 +127,7 @@ func (s *SupplyTestSuite) TestFromState() { // Test reading canonical burn amounts from the state. func (s *SupplyTestSuite) TestCanonicalBurn() { t := s.T() - s.setupHistory() + s.insertBlocks() // Delete state at 199 root := s.db.ReadBlockByNumber(199).Root() @@ -148,7 +149,7 @@ func (s *SupplyTestSuite) TestCanonicalBurn() { // Test reading rebalance memo from the contract. func (s *SupplyTestSuite) TestRebalanceMemo() { t := s.T() - s.setupHistory() + s.insertBlocks() // rebalance not configured amount, err := s.sm.GetRebalanceBurn(199, nil, common.Address{}) @@ -177,7 +178,7 @@ func (s *SupplyTestSuite) TestRebalanceMemo() { // Tests sm.Stop() does not block. func (s *SupplyTestSuite) TestStop() { - s.setupHistory() // head block is already 400 + s.insertBlocks() // head block is already 400 s.sm.Start() // start catchup, enters big-step mode endCh := make(chan struct{}) @@ -198,7 +199,7 @@ func (s *SupplyTestSuite) TestStop() { // Tests the insertBlock -> go catchup, where the catchup enters the big-step mode. func (s *SupplyTestSuite) TestCatchupBigStep() { t := s.T() - s.setupHistory() // head block is already 400 + s.insertBlocks() // head block is already 400 s.sm.Start() // start catchup defer s.sm.Stop() s.waitCatchup() // Wait for catchup to finish @@ -217,8 +218,8 @@ func (s *SupplyTestSuite) TestCatchupEventSubscription() { t := s.T() s.sm.Start() // start catchup defer s.sm.Stop() - time.Sleep(10 * time.Millisecond) // yield to the catchup goroutine to start - s.setupHistory() // block is inserted after the catchup started + time.Sleep(100 * time.Millisecond) // yield to the catchup goroutine to start + s.insertBlocks() // block is inserted after the catchup started s.waitCatchup() testcases := s.testcases() @@ -233,7 +234,7 @@ func (s *SupplyTestSuite) TestCatchupEventSubscription() { // Tests all supply components. func (s *SupplyTestSuite) TestTotalSupply() { t := s.T() - s.setupHistory() + s.insertBlocks() s.sm.Start() defer s.sm.Stop() s.waitCatchup() @@ -259,7 +260,7 @@ func (s *SupplyTestSuite) TestTotalSupply() { // Test that when some data are missing, GetTotalSupply leaves some fields nil and returns an error. func (s *SupplyTestSuite) TestTotalSupplyPartialInfo() { t := s.T() - s.setupHistory() + s.insertBlocks() s.sm.Start() s.waitCatchup() s.sm.Stop() @@ -314,7 +315,7 @@ func (s *SupplyTestSuite) TestTotalSupplyPartialInfo() { // Test that when SupplyCheckpoint are missing, GetTotalSupply will re-accumulate from the nearest stored SupplyCheckpoint. func (s *SupplyTestSuite) TestTotalSupplyReaccumulate() { t := s.T() - s.setupHistory() + s.insertBlocks() s.sm.Start() defer s.sm.Stop() s.waitCatchup() @@ -350,14 +351,12 @@ func (s *SupplyTestSuite) TestTotalSupplyReaccumulate() { func (s *SupplyTestSuite) waitCatchup() { for i := 0; i < 1000; i++ { // wait 10 seconds until catchup complete - if s.db.ReadLastSupplyCheckpointNumber() >= 400 { - break + if s.sm.checkpointCache.Contains(uint64(400)) { + return } time.Sleep(10 * time.Millisecond) } - if s.db.ReadLastSupplyCheckpointNumber() < 400 { - s.T().Fatal("Catchup not finished in time") - } + s.T().Fatal("Catchup not finished in time") } // ---------------------------------------------------------------------------- @@ -485,12 +484,6 @@ func (s *SupplyTestSuite) SetupTest() { require.NoError(t, err) s.chain = chain - s.sm = NewSupplyManager(s.chain, s.gov, s.db, 1) // 1 interval for testing -} - -func (s *SupplyTestSuite) setupHistory() { - t := s.T() - var ( // Generate blocks with 1 tx per block. Send 1 kei from Genesis4 to Genesis3. signer = types.LatestSignerForChainID(s.config.ChainID) key = keyGenesis4 @@ -516,13 +509,22 @@ func (s *SupplyTestSuite) setupHistory() { } } ) - blocks, _ := blockchain.GenerateChain(s.config, s.genesis, s.engine, s.db, 400, genFunc) - require.NotEmpty(t, blocks) + s.blocks, _ = blockchain.GenerateChain(s.config, s.genesis, s.engine, s.db, 400, genFunc) + require.NotEmpty(t, s.blocks) - // Insert s.chain - _, err := s.chain.InsertChain(blocks) - require.NoError(t, err) - expected := blocks[len(blocks)-1] + s.sm = NewSupplyManager(s.chain, s.gov, s.db, 1) // 1 interval for testing +} + +func (s *SupplyTestSuite) insertBlocks() { + t := s.T() + + // Insert blocks to chain. Note that duplicating blocks will automatically be ignored. + // ChainHeadEvent will be published after each block insertion. + for _, block := range s.blocks { + _, err := s.chain.InsertChain([]*types.Block{block}) + require.NoError(t, err) + } + expected := s.blocks[len(s.blocks)-1] actual := s.chain.CurrentBlock() assert.Equal(t, expected.Hash(), actual.Hash()) } From 008e6c0e0e28e190354d1b988cabcb59b18afb4c Mon Sep 17 00:00:00 2001 From: "ollie.j" Date: Tue, 13 Aug 2024 14:16:09 +0900 Subject: [PATCH 2/7] reward: Add TestCatchupRewind --- reward/supply_manager_test.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/reward/supply_manager_test.go b/reward/supply_manager_test.go index 27f7bebcb..873ec0889 100644 --- a/reward/supply_manager_test.go +++ b/reward/supply_manager_test.go @@ -231,6 +231,29 @@ func (s *SupplyTestSuite) TestCatchupEventSubscription() { } } +// Tests go catchup -> insertBlock case, where the catchup follows the chain head event. +func (s *SupplyTestSuite) TestCatchupRewind() { + t := s.T() + s.sm.Start() // start catchup + defer s.sm.Stop() + time.Sleep(100 * time.Millisecond) // yield to the catchup goroutine to start + s.insertBlocks() // block is inserted after the catchup started + s.waitCatchup() // catchup to block 400 + + // Rewind to 200, and re-insert blocks. + // The catchup thread should correctly handle ChainHeadEvents less than 400. + s.chain.SetHead(200) + s.insertBlocks() + + testcases := s.testcases() + for _, tc := range testcases { + checkpoint, err := s.sm.GetCheckpoint(tc.number) + require.NoError(t, err) + bigEqual(t, tc.expectTotalSupply.TotalMinted, checkpoint.Minted, tc.number) + bigEqual(t, tc.expectTotalSupply.BurntFee, checkpoint.BurntFee, tc.number) + } +} + // Tests all supply components. func (s *SupplyTestSuite) TestTotalSupply() { t := s.T() From 5a10244a62325e5cb74067971f90554f9bb80dd3 Mon Sep 17 00:00:00 2001 From: "ollie.j" Date: Tue, 13 Aug 2024 14:16:48 +0900 Subject: [PATCH 3/7] reward: Fix SupplyManager catchup with out-of-order ChainHeadEvents --- reward/supply_manager.go | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/reward/supply_manager.go b/reward/supply_manager.go index 96f8a0624..709211202 100644 --- a/reward/supply_manager.go +++ b/reward/supply_manager.go @@ -342,16 +342,18 @@ func (sm *supplyManager) catchup() { case head := <-sm.chainHeadChan: headNum = head.Block.NumberU64() - supply, err := sm.accumulateReward(lastNum, headNum, lastCheckpoint, true) - if err != nil { - if err != errSupplyManagerQuit { - logger.Error("Total supply accumulate failed", "from", lastNum, "to", headNum, "err", err) + if lastNum < headNum { + supply, err := sm.accumulateReward(lastNum, headNum, lastCheckpoint, true) + if err != nil { + if err != errSupplyManagerQuit { + logger.Error("Total supply accumulate failed", "from", lastNum, "to", headNum, "err", err) + } + return } - return - } - lastNum = headNum - lastCheckpoint = supply + lastNum = headNum + lastCheckpoint = supply + } } } } From 2620be24c682b0f168978d63652d04fef97599c1 Mon Sep 17 00:00:00 2001 From: "ollie.j" Date: Tue, 13 Aug 2024 15:10:28 +0900 Subject: [PATCH 4/7] blockchain: SetHead deletes SupplyCheckpoints --- blockchain/blockchain.go | 6 ++++++ params/governance_params.go | 3 ++- reward/supply_manager_test.go | 9 +++++++-- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/blockchain/blockchain.go b/blockchain/blockchain.go index d96620189..58ff3b0e7 100644 --- a/blockchain/blockchain.go +++ b/blockchain/blockchain.go @@ -611,6 +611,11 @@ func (bc *BlockChain) setHeadBeyondRoot(head uint64, root common.Hash, repair bo // to low, so it's safe the update in-memory markers directly. bc.currentFastBlock.Store(newHeadFastBlock) } + + // Rewind the supply checkpoint + newLastSupplyCheckpointNumber := header.Number.Uint64() - (header.Number.Uint64() % params.SupplyCheckpointInterval) + bc.db.WriteLastSupplyCheckpointNumber(newLastSupplyCheckpointNumber) + return bc.CurrentBlock().Number().Uint64(), nil } @@ -629,6 +634,7 @@ func (bc *BlockChain) setHeadBeyondRoot(head uint64, root common.Hash, repair bo if bc.Config().Istanbul.ProposerPolicy == params.WeightedRandom && !bc.Config().IsKaiaForkEnabled(new(big.Int).SetUint64(num)) && params.IsStakingUpdateInterval(num) { bc.db.DeleteStakingInfo(num) } + bc.db.DeleteSupplyCheckpoint(num) } // If SetHead was only called as a chain reparation method, try to skip diff --git a/params/governance_params.go b/params/governance_params.go index 82b08a056..3c41776e0 100644 --- a/params/governance_params.go +++ b/params/governance_params.go @@ -38,7 +38,8 @@ const ( // The prefix for governance cache GovernanceCachePrefix = "governance" - CheckpointInterval = 1024 + CheckpointInterval = 1024 // For Istanbul snapshot + SupplyCheckpointInterval = 128 // for SupplyManager tracking native token supply ) const ( diff --git a/reward/supply_manager_test.go b/reward/supply_manager_test.go index 873ec0889..bc07810c5 100644 --- a/reward/supply_manager_test.go +++ b/reward/supply_manager_test.go @@ -240,9 +240,14 @@ func (s *SupplyTestSuite) TestCatchupRewind() { s.insertBlocks() // block is inserted after the catchup started s.waitCatchup() // catchup to block 400 - // Rewind to 200, and re-insert blocks. - // The catchup thread should correctly handle ChainHeadEvents less than 400. + // Rewind to 200; relevant data must have been deleted. s.chain.SetHead(200) + assert.Equal(t, uint64(128), s.db.ReadLastSupplyCheckpointNumber()) + assert.NotNil(t, s.db.ReadSupplyCheckpoint(128)) + assert.Nil(t, s.db.ReadSupplyCheckpoint(256)) + + // Re-insert blocks. + // The catchup thread should correctly handle ChainHeadEvents less than 400. s.insertBlocks() testcases := s.testcases() From e0774552621937d7481f54ce2808471fb23143be Mon Sep 17 00:00:00 2001 From: "ollie.j" Date: Tue, 13 Aug 2024 15:16:13 +0900 Subject: [PATCH 5/7] reward: SupplyManager checkpointInterval is constant --- node/cn/backend.go | 4 +-- reward/supply_manager.go | 38 +++++++-------------------- reward/supply_manager_test.go | 48 +++++------------------------------ 3 files changed, 17 insertions(+), 73 deletions(-) diff --git a/node/cn/backend.go b/node/cn/backend.go index 47c6b14b0..46025c5e2 100644 --- a/node/cn/backend.go +++ b/node/cn/backend.go @@ -363,9 +363,7 @@ func New(ctx *node.ServiceContext, config *Config) (*CN, error) { // NewStakingManager is called with proper non-nil parameters reward.NewStakingManager(cn.blockchain, governance, cn.chainDB) } - // Note: archive nodes might have TrieBlockInterval == 128, then SupplyManager will store checkpoints every 128 blocks. - // Still it is not a problem since SupplyManager can re-accumulate from the nearest checkpoint. - cn.supplyManager = reward.NewSupplyManager(cn.blockchain, cn.governance, cn.chainDB, config.TrieBlockInterval) + cn.supplyManager = reward.NewSupplyManager(cn.blockchain, cn.governance, cn.chainDB) // Governance states which are not yet applied to the db remains at in-memory storage // It disappears during the node restart, so restoration is needed before the sync starts diff --git a/reward/supply_manager.go b/reward/supply_manager.go index 709211202..6f04c65b0 100644 --- a/reward/supply_manager.go +++ b/reward/supply_manager.go @@ -34,13 +34,13 @@ import ( "github.com/kaiachain/kaia/common" "github.com/kaiachain/kaia/contracts/contracts/system_contracts/rebalance" "github.com/kaiachain/kaia/event" + "github.com/kaiachain/kaia/params" "github.com/kaiachain/kaia/storage/database" ) var ( supplyCacheSize = 86400 // A day; Some total supply consumers might want daily supply. supplyLogInterval = uint64(102400) // Periodic total supply log. - supplyReaccLimit = uint64(1024) // Re-accumulate from the last accumulated block. zeroBurnAddress = common.HexToAddress("0x0") deadBurnAddress = common.HexToAddress("0xdead") @@ -104,7 +104,7 @@ type supplyManager struct { // NewSupplyManager creates a new supply manager. // The TotalSupply data is stored every checkpointInterval blocks. -func NewSupplyManager(chain blockChain, gov governanceHelper, db database.DBManager, checkpointInterval uint) *supplyManager { +func NewSupplyManager(chain blockChain, gov governanceHelper, db database.DBManager) *supplyManager { checkpointCache, _ := lru.NewARC(supplyCacheSize) memoCache, _ := lru.NewARC(10) @@ -113,7 +113,7 @@ func NewSupplyManager(chain blockChain, gov governanceHelper, db database.DBMana chainHeadChan: make(chan blockchain.ChainHeadEvent, chainHeadChanSize), gov: gov, db: db, - checkpointInterval: uint64(checkpointInterval), + checkpointInterval: uint64(params.SupplyCheckpointInterval), checkpointCache: checkpointCache, memoCache: memoCache, quitCh: make(chan struct{}, 1), // make sure Stop() doesn't block if catchup() has exited before Stop() @@ -139,11 +139,6 @@ func (sm *supplyManager) GetCheckpoint(num uint64) (*database.SupplyCheckpoint, return checkpoint.(*database.SupplyCheckpoint), nil } - lastNum := sm.db.ReadLastSupplyCheckpointNumber() - if lastNum < num { // soft deleted - return nil, errNoCheckpoint - } - checkpoint, err := sm.getCheckpointUncached(num) if err != nil { return nil, err @@ -383,36 +378,21 @@ func (sm *supplyManager) totalSupplyFromState(num uint64) (*big.Int, error) { } func (sm *supplyManager) getCheckpointUncached(num uint64) (*database.SupplyCheckpoint, error) { + // Read from DB checkpoint := sm.db.ReadSupplyCheckpoint(num) if checkpoint != nil { return checkpoint, nil } - // Trace back to the last stored supply checkpoint. - var fromNum uint64 - var fromAcc *database.SupplyCheckpoint - - // Fast path using checkpointInterval - if checkpoint := sm.db.ReadSupplyCheckpoint(num - num%sm.checkpointInterval); checkpoint != nil { - fromNum = num - num%sm.checkpointInterval - fromAcc = checkpoint - } else { - // Slow path in case the checkpoint has changed or checkpoint is missing. - for i := uint64(1); i < supplyReaccLimit; i++ { - checkpoint = sm.db.ReadSupplyCheckpoint(num - i) - if checkpoint != nil { - fromNum = num - i - fromAcc = checkpoint - break - } - } - } - if fromAcc == nil { + // Re-accumulate from the the nearest checkpoint + fromNum := num - (num % sm.checkpointInterval) + fromCheckpoint := sm.db.ReadSupplyCheckpoint(fromNum) + if fromCheckpoint == nil { return nil, errNoCheckpoint } logger.Trace("on-demand reaccumulating rewards", "from", fromNum, "to", num) - return sm.accumulateReward(fromNum, num, fromAcc, false) + return sm.accumulateReward(fromNum, num, fromCheckpoint, false) } // accumulateReward calculates the total supply from the last block to the current block. diff --git a/reward/supply_manager_test.go b/reward/supply_manager_test.go index bc07810c5..797525cd6 100644 --- a/reward/supply_manager_test.go +++ b/reward/supply_manager_test.go @@ -269,6 +269,7 @@ func (s *SupplyTestSuite) TestTotalSupply() { testcases := s.testcases() for _, tc := range testcases { + s.sm.checkpointCache.Purge() // To test re-accumulate ts, err := s.sm.GetTotalSupply(tc.number) require.NoError(t, err) @@ -286,12 +287,12 @@ func (s *SupplyTestSuite) TestTotalSupply() { } // Test that when some data are missing, GetTotalSupply leaves some fields nil and returns an error. -func (s *SupplyTestSuite) TestTotalSupplyPartialInfo() { +func (s *SupplyTestSuite) TestPartialInfo() { t := s.T() s.insertBlocks() s.sm.Start() + defer s.sm.Stop() s.waitCatchup() - s.sm.Stop() var num uint64 = 200 var expected *TotalSupply @@ -333,50 +334,15 @@ func (s *SupplyTestSuite) TestTotalSupplyPartialInfo() { assert.Equal(t, expected.Kip160Burn, ts.Kip160Burn) // No SupplyCheckpoint - s.db.WriteLastSupplyCheckpointNumber(num - 1) + s.db.WriteLastSupplyCheckpointNumber(num - (num % 128)) + s.db.DeleteSupplyCheckpoint(num - (num % 128)) s.sm.checkpointCache.Purge() + ts, err = s.sm.GetTotalSupply(num) assert.ErrorIs(t, err, errNoCheckpoint) assert.Nil(t, ts) } -// Test that when SupplyCheckpoint are missing, GetTotalSupply will re-accumulate from the nearest stored SupplyCheckpoint. -func (s *SupplyTestSuite) TestTotalSupplyReaccumulate() { - t := s.T() - s.insertBlocks() - s.sm.Start() - defer s.sm.Stop() - s.waitCatchup() - - // Delete checkpoints not on the default block interval (128). - // This happens on full nodes, and archive nodes with default BlockInterval config. - // Note that archive nodes ars allowed to have BlockInterval > 1, still tries are committed every block. - for num := uint64(0); num <= 400; num++ { - if num%128 != 0 { - s.db.DeleteSupplyCheckpoint(num) - } - } - - // Still, all block data must be available. - testcases := s.testcases() - for _, tc := range testcases { - s.sm.checkpointCache.Purge() - ts, err := s.sm.GetTotalSupply(tc.number) - require.NoError(t, err) - - expected := tc.expectTotalSupply - actual := ts - bigEqual(t, expected.TotalSupply, actual.TotalSupply, tc.number) - bigEqual(t, expected.TotalMinted, actual.TotalMinted, tc.number) - bigEqual(t, expected.TotalBurnt, actual.TotalBurnt, tc.number) - bigEqual(t, expected.BurntFee, actual.BurntFee, tc.number) - bigEqual(t, expected.ZeroBurn, actual.ZeroBurn, tc.number) - bigEqual(t, expected.DeadBurn, actual.DeadBurn, tc.number) - bigEqual(t, expected.Kip103Burn, actual.Kip103Burn, tc.number) - bigEqual(t, expected.Kip160Burn, actual.Kip160Burn, tc.number) - } -} - func (s *SupplyTestSuite) waitCatchup() { for i := 0; i < 1000; i++ { // wait 10 seconds until catchup complete if s.sm.checkpointCache.Contains(uint64(400)) { @@ -540,7 +506,7 @@ func (s *SupplyTestSuite) SetupTest() { s.blocks, _ = blockchain.GenerateChain(s.config, s.genesis, s.engine, s.db, 400, genFunc) require.NotEmpty(t, s.blocks) - s.sm = NewSupplyManager(s.chain, s.gov, s.db, 1) // 1 interval for testing + s.sm = NewSupplyManager(s.chain, s.gov, s.db) } func (s *SupplyTestSuite) insertBlocks() { From 2ce37f01c0efc63073eaf6936cc227b5546aa71e Mon Sep 17 00:00:00 2001 From: "ollie.j" Date: Tue, 13 Aug 2024 15:17:53 +0900 Subject: [PATCH 6/7] node: SupplyManager restared by SetHead API call --- node/cn/api_backend.go | 2 ++ node/cn/api_backend_test.go | 13 +++++++++++++ 2 files changed, 15 insertions(+) diff --git a/node/cn/api_backend.go b/node/cn/api_backend.go index 89e7afdd4..58ba82f51 100644 --- a/node/cn/api_backend.go +++ b/node/cn/api_backend.go @@ -100,6 +100,8 @@ func (b *CNAPIBackend) SetHead(number uint64) error { b.cn.protocolManager.Downloader().Cancel() b.cn.protocolManager.SetSyncStop(true) defer b.cn.protocolManager.SetSyncStop(false) + b.cn.supplyManager.Stop() + defer b.cn.supplyManager.Start() return doSetHead(b.cn.blockchain, b.cn.engine, b.cn.governance, b.gpo, number) } diff --git a/node/cn/api_backend_test.go b/node/cn/api_backend_test.go index 6dff66337..21da8995d 100644 --- a/node/cn/api_backend_test.go +++ b/node/cn/api_backend_test.go @@ -173,6 +173,18 @@ func testGov() *governance.MixedEngine { return governance.NewMixedEngine(config, db) } +type testSupplyManager struct{} + +func (sm *testSupplyManager) Start() { +} + +func (sm *testSupplyManager) Stop() { +} + +func (sm *testSupplyManager) GetTotalSupply(num uint64) (*reward.TotalSupply, error) { + return &reward.TotalSupply{}, nil +} + func TestCNAPIBackend_SetHead(t *testing.T) { mockCtrl, mockBlockChain, _, api := newCNAPIBackend(t) defer mockCtrl.Finish() @@ -183,6 +195,7 @@ func TestCNAPIBackend_SetHead(t *testing.T) { api.cn.protocolManager = pm api.cn.engine = gxhash.NewFullFaker() api.cn.governance = testGov() + api.cn.supplyManager = &testSupplyManager{} api.gpo = gasprice.NewOracle(api, gasprice.Config{}, nil, api.cn.governance) number := uint64(123) From 22e64e2abe83e49b22162571624b5ebe7632782e Mon Sep 17 00:00:00 2001 From: "ollie.j" Date: Tue, 13 Aug 2024 16:20:11 +0900 Subject: [PATCH 7/7] database: Change schema prefix for SupplyCheckpoint Makes items created by v1.0.1 or prior obsolete. Nodes upgraded to v1.0.2 are re-accumulated from the genesis. --- storage/database/schema.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/storage/database/schema.go b/storage/database/schema.go index de326847d..0dbaecd8e 100644 --- a/storage/database/schema.go +++ b/storage/database/schema.go @@ -132,8 +132,8 @@ var ( stakingInfoPrefix = []byte("stakingInfo") - supplyCheckpointPrefix = []byte("accReward") - lastSupplyCheckpointNumberKey = []byte("lastAccRewardBlockNumber") + supplyCheckpointPrefix = []byte("supplyCheckpoint") + lastSupplyCheckpointNumberKey = []byte("lastSupplyCheckpointNumber") chaindatafetcherCheckpointKey = []byte("chaindatafetcherCheckpoint") )