From c18f54aca691c09fc032a65cae20e4884d11e398 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Thu, 6 Apr 2023 10:07:49 -0400 Subject: [PATCH 1/7] chore: Rename ModStateProofNextRound to StateProofNextRound. --- ledger/apply/stateproof_test.go | 2 +- ledger/eval/cow.go | 10 +++++----- ledger/ledger_test.go | 2 +- ledger/ledgercore/statedelta.go | 8 ++++---- ledger/ledgercore/statedelta_test.go | 22 +++++++++++----------- ledger/spverificationtracker.go | 4 ++-- ledger/spverificationtracker_test.go | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ledger/apply/stateproof_test.go b/ledger/apply/stateproof_test.go index 3160b9d057..3331673fd8 100644 --- a/ledger/apply/stateproof_test.go +++ b/ledger/apply/stateproof_test.go @@ -270,6 +270,6 @@ func TestApplyStateProof(t *testing.T) { // transaction should be applied without stateproof validation (no context, blockheader or valid stateproof needed as it represents a node catching up) err = StateProof(stateProofTx, atRound, applier, false) a.NoError(err) - // make sure that the ModStateProofNextRound was updated correctly after applying + // make sure that the StateProofNextRound was updated correctly after applying a.Equal(basics.Round(512+config.Consensus[protocol.ConsensusFuture].StateProofInterval), applier.GetStateProofNextRound()) } diff --git a/ledger/eval/cow.go b/ledger/eval/cow.go index 66824ce978..3aaf58afe6 100644 --- a/ledger/eval/cow.go +++ b/ledger/eval/cow.go @@ -235,8 +235,8 @@ func (cb *roundCowState) Counter() uint64 { } func (cb *roundCowState) GetStateProofNextRound() basics.Round { - if cb.mods.ModStateProofNextRound != 0 { - return cb.mods.ModStateProofNextRound + if cb.mods.StateProofNextRound != 0 { + return cb.mods.StateProofNextRound } return cb.lookupParent.GetStateProofNextRound() } @@ -266,7 +266,7 @@ func (cb *roundCowState) addTx(txn transactions.Transaction, txid transactions.T } func (cb *roundCowState) SetStateProofNextRound(rnd basics.Round) { - cb.mods.ModStateProofNextRound = rnd + cb.mods.StateProofNextRound = rnd } func (cb *roundCowState) child(hint int) *roundCowState { @@ -274,7 +274,7 @@ func (cb *roundCowState) child(hint int) *roundCowState { ch.lookupParent = cb ch.commitParent = cb ch.proto = cb.proto - ch.mods.PopulateStateDelta(cb.mods.Hdr, cb.mods.PrevTimestamp, hint, cb.mods.ModStateProofNextRound) + ch.mods.PopulateStateDelta(cb.mods.Hdr, cb.mods.PrevTimestamp, hint, cb.mods.StateProofNextRound) if ch.sdeltas == nil { ch.sdeltas = make(map[basics.Address]map[storagePtr]*storageDelta) @@ -318,7 +318,7 @@ func (cb *roundCowState) commitToParent() { } } } - cb.commitParent.mods.ModStateProofNextRound = cb.mods.ModStateProofNextRound + cb.commitParent.mods.StateProofNextRound = cb.mods.StateProofNextRound for key, value := range cb.mods.KvMods { cb.commitParent.mods.AddKvMod(key, value) diff --git a/ledger/ledger_test.go b/ledger/ledger_test.go index 9dab45207f..ff685c3534 100644 --- a/ledger/ledger_test.go +++ b/ledger/ledger_test.go @@ -3189,7 +3189,7 @@ func TestLedgerSPVerificationTracker(t *testing.T) { // to the ledger. delta, err := eval.Eval(context.Background(), l, blk, false, l.verifiedTxnCache, nil) require.NoError(t, err) - delta.ModStateProofNextRound = stateProofReceived.StateProofNextRound + delta.StateProofNextRound = stateProofReceived.StateProofNextRound vb := ledgercore.MakeValidatedBlock(blk, delta) err = l.AddValidatedBlock(vb, agreement.Certificate{}) require.NoError(t, err) diff --git a/ledger/ledgercore/statedelta.go b/ledger/ledgercore/statedelta.go index 0c940e32cf..d238f2697b 100644 --- a/ledger/ledgercore/statedelta.go +++ b/ledger/ledgercore/statedelta.go @@ -110,10 +110,10 @@ type StateDelta struct { // new block header; read-only Hdr *bookkeeping.BlockHeader - // ModStateProofNextRound represents modification on StateProofNextRound field in the block header. If the block contains + // StateProofNextRound represents modification on StateProofNextRound field in the block header. If the block contains // a valid state proof transaction, this field will contain the next round for state proof. // otherwise it will be set to 0. - ModStateProofNextRound basics.Round + StateProofNextRound basics.Round // previous block timestamp PrevTimestamp int64 @@ -215,7 +215,7 @@ func (sd *StateDelta) PopulateStateDelta(hdr *bookkeeping.BlockHeader, prevTimes sd.initialHint = hint } sd.Hdr = hdr - sd.ModStateProofNextRound = stateProofNext + sd.StateProofNextRound = stateProofNext sd.PrevTimestamp = prevTimestamp } @@ -248,7 +248,7 @@ func (sd *StateDelta) Reset() { // these fields are going to be populated on next use but resetting them anyway for safety. // we are not resetting sd.initialHint since it should only be reset if reallocating AccountDeltas sd.Hdr = nil - sd.ModStateProofNextRound = basics.Round(0) + sd.StateProofNextRound = basics.Round(0) sd.PrevTimestamp = 0 } diff --git a/ledger/ledgercore/statedelta_test.go b/ledger/ledgercore/statedelta_test.go index 95f3bcb325..4903d65192 100644 --- a/ledger/ledgercore/statedelta_test.go +++ b/ledger/ledgercore/statedelta_test.go @@ -150,7 +150,7 @@ func TestStateDeltaReset(t *testing.T) { // StateDeltas simple fields require.Zero(t, sd.Hdr) - require.Zero(t, sd.ModStateProofNextRound) + require.Zero(t, sd.StateProofNextRound) require.Zero(t, sd.PrevTimestamp) require.Zero(t, sd.Totals) @@ -184,16 +184,16 @@ func TestStateDeltaReflect(t *testing.T) { partitiontest.PartitionTest(t) stateDeltaFieldNames := map[string]struct{}{ - "Accts": {}, - "KvMods": {}, - "Txids": {}, - "Txleases": {}, - "Creatables": {}, - "Hdr": {}, - "ModStateProofNextRound": {}, - "PrevTimestamp": {}, - "initialHint": {}, - "Totals": {}, + "Accts": {}, + "KvMods": {}, + "Txids": {}, + "Txleases": {}, + "Creatables": {}, + "Hdr": {}, + "StateProofNextRound": {}, + "PrevTimestamp": {}, + "initialHint": {}, + "Totals": {}, } sd := StateDelta{} diff --git a/ledger/spverificationtracker.go b/ledger/spverificationtracker.go index 4dda2b7057..2b8a6c7cd0 100644 --- a/ledger/spverificationtracker.go +++ b/ledger/spverificationtracker.go @@ -96,7 +96,7 @@ func (spt *spVerificationTracker) newBlock(blk bookkeeping.Block, delta ledgerco spt.appendCommitContext(&blk) } - if delta.ModStateProofNextRound != 0 { + if delta.StateProofNextRound != 0 { spt.appendDeleteContext(&blk, &delta) } } @@ -306,7 +306,7 @@ func (spt *spVerificationTracker) appendDeleteContext(blk *bookkeeping.Block, de deletionContext := verificationDeleteContext{ confirmedRound: blk.Round(), - stateProofNextRound: delta.ModStateProofNextRound, + stateProofNextRound: delta.StateProofNextRound, } spt.pendingDeleteContexts = append(spt.pendingDeleteContexts, deletionContext) diff --git a/ledger/spverificationtracker_test.go b/ledger/spverificationtracker_test.go index 53e532a067..1a6357993e 100644 --- a/ledger/spverificationtracker_test.go +++ b/ledger/spverificationtracker_test.go @@ -141,7 +141,7 @@ func feedBlocksUpToRound(spt *spVerificationTracker, prevBlock *blockEntry, targ stateProofDelta = currentStateProofNextRound } - spt.newBlock(block.block, ledgercore.StateDelta{ModStateProofNextRound: stateProofDelta}) + spt.newBlock(block.block, ledgercore.StateDelta{StateProofNextRound: stateProofDelta}) prevBlock = &block } From 17edc5ef23fab2847a2373ec9e9c141dd7b5c214 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Fri, 7 Apr 2023 08:07:28 -0400 Subject: [PATCH 2/7] Revert "chore: Rename ModStateProofNextRound to StateProofNextRound." This reverts commit c18f54aca691c09fc032a65cae20e4884d11e398. --- ledger/apply/stateproof_test.go | 2 +- ledger/eval/cow.go | 10 +++++----- ledger/ledger_test.go | 2 +- ledger/ledgercore/statedelta.go | 8 ++++---- ledger/ledgercore/statedelta_test.go | 22 +++++++++++----------- ledger/spverificationtracker.go | 4 ++-- ledger/spverificationtracker_test.go | 2 +- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/ledger/apply/stateproof_test.go b/ledger/apply/stateproof_test.go index 3331673fd8..3160b9d057 100644 --- a/ledger/apply/stateproof_test.go +++ b/ledger/apply/stateproof_test.go @@ -270,6 +270,6 @@ func TestApplyStateProof(t *testing.T) { // transaction should be applied without stateproof validation (no context, blockheader or valid stateproof needed as it represents a node catching up) err = StateProof(stateProofTx, atRound, applier, false) a.NoError(err) - // make sure that the StateProofNextRound was updated correctly after applying + // make sure that the ModStateProofNextRound was updated correctly after applying a.Equal(basics.Round(512+config.Consensus[protocol.ConsensusFuture].StateProofInterval), applier.GetStateProofNextRound()) } diff --git a/ledger/eval/cow.go b/ledger/eval/cow.go index 3aaf58afe6..66824ce978 100644 --- a/ledger/eval/cow.go +++ b/ledger/eval/cow.go @@ -235,8 +235,8 @@ func (cb *roundCowState) Counter() uint64 { } func (cb *roundCowState) GetStateProofNextRound() basics.Round { - if cb.mods.StateProofNextRound != 0 { - return cb.mods.StateProofNextRound + if cb.mods.ModStateProofNextRound != 0 { + return cb.mods.ModStateProofNextRound } return cb.lookupParent.GetStateProofNextRound() } @@ -266,7 +266,7 @@ func (cb *roundCowState) addTx(txn transactions.Transaction, txid transactions.T } func (cb *roundCowState) SetStateProofNextRound(rnd basics.Round) { - cb.mods.StateProofNextRound = rnd + cb.mods.ModStateProofNextRound = rnd } func (cb *roundCowState) child(hint int) *roundCowState { @@ -274,7 +274,7 @@ func (cb *roundCowState) child(hint int) *roundCowState { ch.lookupParent = cb ch.commitParent = cb ch.proto = cb.proto - ch.mods.PopulateStateDelta(cb.mods.Hdr, cb.mods.PrevTimestamp, hint, cb.mods.StateProofNextRound) + ch.mods.PopulateStateDelta(cb.mods.Hdr, cb.mods.PrevTimestamp, hint, cb.mods.ModStateProofNextRound) if ch.sdeltas == nil { ch.sdeltas = make(map[basics.Address]map[storagePtr]*storageDelta) @@ -318,7 +318,7 @@ func (cb *roundCowState) commitToParent() { } } } - cb.commitParent.mods.StateProofNextRound = cb.mods.StateProofNextRound + cb.commitParent.mods.ModStateProofNextRound = cb.mods.ModStateProofNextRound for key, value := range cb.mods.KvMods { cb.commitParent.mods.AddKvMod(key, value) diff --git a/ledger/ledger_test.go b/ledger/ledger_test.go index ff685c3534..9dab45207f 100644 --- a/ledger/ledger_test.go +++ b/ledger/ledger_test.go @@ -3189,7 +3189,7 @@ func TestLedgerSPVerificationTracker(t *testing.T) { // to the ledger. delta, err := eval.Eval(context.Background(), l, blk, false, l.verifiedTxnCache, nil) require.NoError(t, err) - delta.StateProofNextRound = stateProofReceived.StateProofNextRound + delta.ModStateProofNextRound = stateProofReceived.StateProofNextRound vb := ledgercore.MakeValidatedBlock(blk, delta) err = l.AddValidatedBlock(vb, agreement.Certificate{}) require.NoError(t, err) diff --git a/ledger/ledgercore/statedelta.go b/ledger/ledgercore/statedelta.go index d238f2697b..0c940e32cf 100644 --- a/ledger/ledgercore/statedelta.go +++ b/ledger/ledgercore/statedelta.go @@ -110,10 +110,10 @@ type StateDelta struct { // new block header; read-only Hdr *bookkeeping.BlockHeader - // StateProofNextRound represents modification on StateProofNextRound field in the block header. If the block contains + // ModStateProofNextRound represents modification on StateProofNextRound field in the block header. If the block contains // a valid state proof transaction, this field will contain the next round for state proof. // otherwise it will be set to 0. - StateProofNextRound basics.Round + ModStateProofNextRound basics.Round // previous block timestamp PrevTimestamp int64 @@ -215,7 +215,7 @@ func (sd *StateDelta) PopulateStateDelta(hdr *bookkeeping.BlockHeader, prevTimes sd.initialHint = hint } sd.Hdr = hdr - sd.StateProofNextRound = stateProofNext + sd.ModStateProofNextRound = stateProofNext sd.PrevTimestamp = prevTimestamp } @@ -248,7 +248,7 @@ func (sd *StateDelta) Reset() { // these fields are going to be populated on next use but resetting them anyway for safety. // we are not resetting sd.initialHint since it should only be reset if reallocating AccountDeltas sd.Hdr = nil - sd.StateProofNextRound = basics.Round(0) + sd.ModStateProofNextRound = basics.Round(0) sd.PrevTimestamp = 0 } diff --git a/ledger/ledgercore/statedelta_test.go b/ledger/ledgercore/statedelta_test.go index 4903d65192..95f3bcb325 100644 --- a/ledger/ledgercore/statedelta_test.go +++ b/ledger/ledgercore/statedelta_test.go @@ -150,7 +150,7 @@ func TestStateDeltaReset(t *testing.T) { // StateDeltas simple fields require.Zero(t, sd.Hdr) - require.Zero(t, sd.StateProofNextRound) + require.Zero(t, sd.ModStateProofNextRound) require.Zero(t, sd.PrevTimestamp) require.Zero(t, sd.Totals) @@ -184,16 +184,16 @@ func TestStateDeltaReflect(t *testing.T) { partitiontest.PartitionTest(t) stateDeltaFieldNames := map[string]struct{}{ - "Accts": {}, - "KvMods": {}, - "Txids": {}, - "Txleases": {}, - "Creatables": {}, - "Hdr": {}, - "StateProofNextRound": {}, - "PrevTimestamp": {}, - "initialHint": {}, - "Totals": {}, + "Accts": {}, + "KvMods": {}, + "Txids": {}, + "Txleases": {}, + "Creatables": {}, + "Hdr": {}, + "ModStateProofNextRound": {}, + "PrevTimestamp": {}, + "initialHint": {}, + "Totals": {}, } sd := StateDelta{} diff --git a/ledger/spverificationtracker.go b/ledger/spverificationtracker.go index 2b8a6c7cd0..4dda2b7057 100644 --- a/ledger/spverificationtracker.go +++ b/ledger/spverificationtracker.go @@ -96,7 +96,7 @@ func (spt *spVerificationTracker) newBlock(blk bookkeeping.Block, delta ledgerco spt.appendCommitContext(&blk) } - if delta.StateProofNextRound != 0 { + if delta.ModStateProofNextRound != 0 { spt.appendDeleteContext(&blk, &delta) } } @@ -306,7 +306,7 @@ func (spt *spVerificationTracker) appendDeleteContext(blk *bookkeeping.Block, de deletionContext := verificationDeleteContext{ confirmedRound: blk.Round(), - stateProofNextRound: delta.StateProofNextRound, + stateProofNextRound: delta.ModStateProofNextRound, } spt.pendingDeleteContexts = append(spt.pendingDeleteContexts, deletionContext) diff --git a/ledger/spverificationtracker_test.go b/ledger/spverificationtracker_test.go index 1a6357993e..53e532a067 100644 --- a/ledger/spverificationtracker_test.go +++ b/ledger/spverificationtracker_test.go @@ -141,7 +141,7 @@ func feedBlocksUpToRound(spt *spVerificationTracker, prevBlock *blockEntry, targ stateProofDelta = currentStateProofNextRound } - spt.newBlock(block.block, ledgercore.StateDelta{StateProofNextRound: stateProofDelta}) + spt.newBlock(block.block, ledgercore.StateDelta{ModStateProofNextRound: stateProofDelta}) prevBlock = &block } From 149392758b486fd11eb512f3e1f683df0139579e Mon Sep 17 00:00:00 2001 From: Will Winder Date: Fri, 7 Apr 2023 08:08:16 -0400 Subject: [PATCH 3/7] Add codec tag for renamed field. --- ledger/ledgercore/statedelta.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/ledgercore/statedelta.go b/ledger/ledgercore/statedelta.go index 0c940e32cf..2b81c710dd 100644 --- a/ledger/ledgercore/statedelta.go +++ b/ledger/ledgercore/statedelta.go @@ -113,7 +113,7 @@ type StateDelta struct { // ModStateProofNextRound represents modification on StateProofNextRound field in the block header. If the block contains // a valid state proof transaction, this field will contain the next round for state proof. // otherwise it will be set to 0. - ModStateProofNextRound basics.Round + ModStateProofNextRound basics.Round `codec:"StateProofNextRound,omitempty"` // previous block timestamp PrevTimestamp int64 From bc7c5931ffd0045d061e1d2625bd5f1a6d0c64f1 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Fri, 7 Apr 2023 11:50:34 -0400 Subject: [PATCH 4/7] Add msgp ignore tag. --- ledger/ledgercore/statedelta.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ledger/ledgercore/statedelta.go b/ledger/ledgercore/statedelta.go index 2b81c710dd..0e37b699ca 100644 --- a/ledger/ledgercore/statedelta.go +++ b/ledger/ledgercore/statedelta.go @@ -88,6 +88,8 @@ type KvValueDelta struct { // If adding a new field not explicitly allocated by PopulateStateDelta, make sure to reset // it in .ReuseStateDelta to avoid dirty memory errors. // If adding fields make sure to add them to the .Reset() method to avoid dirty state +// +//msgp:ignore StateDelta type StateDelta struct { // modified new accounts Accts AccountDeltas From 981824a7e320ae4141c96571f5c4877667b5a4a3 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Thu, 13 Apr 2023 16:29:53 -0400 Subject: [PATCH 5/7] Update ledger/ledgercore/statedelta.go --- ledger/ledgercore/statedelta.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ledger/ledgercore/statedelta.go b/ledger/ledgercore/statedelta.go index 0e37b699ca..d8e6b90487 100644 --- a/ledger/ledgercore/statedelta.go +++ b/ledger/ledgercore/statedelta.go @@ -115,7 +115,7 @@ type StateDelta struct { // ModStateProofNextRound represents modification on StateProofNextRound field in the block header. If the block contains // a valid state proof transaction, this field will contain the next round for state proof. // otherwise it will be set to 0. - ModStateProofNextRound basics.Round `codec:"StateProofNextRound,omitempty"` + ModStateProofNextRound basics.Round `codec:"StateProofNext,omitempty"` // previous block timestamp PrevTimestamp int64 From 31835a93261a40ee58ccac4155d2ca10ef6efb25 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Thu, 13 Apr 2023 19:30:09 -0400 Subject: [PATCH 6/7] Rename field to StateProofNext --- ledger/ledgercore/statedelta.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/ledger/ledgercore/statedelta.go b/ledger/ledgercore/statedelta.go index d8e6b90487..8a0cf3cbb7 100644 --- a/ledger/ledgercore/statedelta.go +++ b/ledger/ledgercore/statedelta.go @@ -88,8 +88,6 @@ type KvValueDelta struct { // If adding a new field not explicitly allocated by PopulateStateDelta, make sure to reset // it in .ReuseStateDelta to avoid dirty memory errors. // If adding fields make sure to add them to the .Reset() method to avoid dirty state -// -//msgp:ignore StateDelta type StateDelta struct { // modified new accounts Accts AccountDeltas @@ -112,10 +110,10 @@ type StateDelta struct { // new block header; read-only Hdr *bookkeeping.BlockHeader - // ModStateProofNextRound represents modification on StateProofNextRound field in the block header. If the block contains + // StateProofNext represents modification on StateProofNextRound field in the block header. If the block contains // a valid state proof transaction, this field will contain the next round for state proof. // otherwise it will be set to 0. - ModStateProofNextRound basics.Round `codec:"StateProofNext,omitempty"` + StateProofNext basics.Round // previous block timestamp PrevTimestamp int64 From 3d345dded5666077a7af9cbe12fba5f10255b850 Mon Sep 17 00:00:00 2001 From: Will Winder Date: Fri, 14 Apr 2023 11:18:34 -0400 Subject: [PATCH 7/7] Rename usages to StateProofNext --- ledger/apply/stateproof_test.go | 2 +- ledger/eval/cow.go | 10 +++++----- ledger/ledger_test.go | 2 +- ledger/ledgercore/statedelta.go | 4 ++-- ledger/ledgercore/statedelta_test.go | 22 +++++++++++----------- ledger/spverificationtracker.go | 4 ++-- ledger/spverificationtracker_test.go | 2 +- 7 files changed, 23 insertions(+), 23 deletions(-) diff --git a/ledger/apply/stateproof_test.go b/ledger/apply/stateproof_test.go index 3160b9d057..72c898475d 100644 --- a/ledger/apply/stateproof_test.go +++ b/ledger/apply/stateproof_test.go @@ -270,6 +270,6 @@ func TestApplyStateProof(t *testing.T) { // transaction should be applied without stateproof validation (no context, blockheader or valid stateproof needed as it represents a node catching up) err = StateProof(stateProofTx, atRound, applier, false) a.NoError(err) - // make sure that the ModStateProofNextRound was updated correctly after applying + // make sure that the StateProofNext was updated correctly after applying a.Equal(basics.Round(512+config.Consensus[protocol.ConsensusFuture].StateProofInterval), applier.GetStateProofNextRound()) } diff --git a/ledger/eval/cow.go b/ledger/eval/cow.go index 66824ce978..2a3a4c4dbf 100644 --- a/ledger/eval/cow.go +++ b/ledger/eval/cow.go @@ -235,8 +235,8 @@ func (cb *roundCowState) Counter() uint64 { } func (cb *roundCowState) GetStateProofNextRound() basics.Round { - if cb.mods.ModStateProofNextRound != 0 { - return cb.mods.ModStateProofNextRound + if cb.mods.StateProofNext != 0 { + return cb.mods.StateProofNext } return cb.lookupParent.GetStateProofNextRound() } @@ -266,7 +266,7 @@ func (cb *roundCowState) addTx(txn transactions.Transaction, txid transactions.T } func (cb *roundCowState) SetStateProofNextRound(rnd basics.Round) { - cb.mods.ModStateProofNextRound = rnd + cb.mods.StateProofNext = rnd } func (cb *roundCowState) child(hint int) *roundCowState { @@ -274,7 +274,7 @@ func (cb *roundCowState) child(hint int) *roundCowState { ch.lookupParent = cb ch.commitParent = cb ch.proto = cb.proto - ch.mods.PopulateStateDelta(cb.mods.Hdr, cb.mods.PrevTimestamp, hint, cb.mods.ModStateProofNextRound) + ch.mods.PopulateStateDelta(cb.mods.Hdr, cb.mods.PrevTimestamp, hint, cb.mods.StateProofNext) if ch.sdeltas == nil { ch.sdeltas = make(map[basics.Address]map[storagePtr]*storageDelta) @@ -318,7 +318,7 @@ func (cb *roundCowState) commitToParent() { } } } - cb.commitParent.mods.ModStateProofNextRound = cb.mods.ModStateProofNextRound + cb.commitParent.mods.StateProofNext = cb.mods.StateProofNext for key, value := range cb.mods.KvMods { cb.commitParent.mods.AddKvMod(key, value) diff --git a/ledger/ledger_test.go b/ledger/ledger_test.go index 9dab45207f..fb2531041e 100644 --- a/ledger/ledger_test.go +++ b/ledger/ledger_test.go @@ -3189,7 +3189,7 @@ func TestLedgerSPVerificationTracker(t *testing.T) { // to the ledger. delta, err := eval.Eval(context.Background(), l, blk, false, l.verifiedTxnCache, nil) require.NoError(t, err) - delta.ModStateProofNextRound = stateProofReceived.StateProofNextRound + delta.StateProofNext = stateProofReceived.StateProofNextRound vb := ledgercore.MakeValidatedBlock(blk, delta) err = l.AddValidatedBlock(vb, agreement.Certificate{}) require.NoError(t, err) diff --git a/ledger/ledgercore/statedelta.go b/ledger/ledgercore/statedelta.go index 8a0cf3cbb7..1a0f824de1 100644 --- a/ledger/ledgercore/statedelta.go +++ b/ledger/ledgercore/statedelta.go @@ -215,7 +215,7 @@ func (sd *StateDelta) PopulateStateDelta(hdr *bookkeeping.BlockHeader, prevTimes sd.initialHint = hint } sd.Hdr = hdr - sd.ModStateProofNextRound = stateProofNext + sd.StateProofNext = stateProofNext sd.PrevTimestamp = prevTimestamp } @@ -248,7 +248,7 @@ func (sd *StateDelta) Reset() { // these fields are going to be populated on next use but resetting them anyway for safety. // we are not resetting sd.initialHint since it should only be reset if reallocating AccountDeltas sd.Hdr = nil - sd.ModStateProofNextRound = basics.Round(0) + sd.StateProofNext = basics.Round(0) sd.PrevTimestamp = 0 } diff --git a/ledger/ledgercore/statedelta_test.go b/ledger/ledgercore/statedelta_test.go index 95f3bcb325..dd0f3e201d 100644 --- a/ledger/ledgercore/statedelta_test.go +++ b/ledger/ledgercore/statedelta_test.go @@ -150,7 +150,7 @@ func TestStateDeltaReset(t *testing.T) { // StateDeltas simple fields require.Zero(t, sd.Hdr) - require.Zero(t, sd.ModStateProofNextRound) + require.Zero(t, sd.StateProofNext) require.Zero(t, sd.PrevTimestamp) require.Zero(t, sd.Totals) @@ -184,16 +184,16 @@ func TestStateDeltaReflect(t *testing.T) { partitiontest.PartitionTest(t) stateDeltaFieldNames := map[string]struct{}{ - "Accts": {}, - "KvMods": {}, - "Txids": {}, - "Txleases": {}, - "Creatables": {}, - "Hdr": {}, - "ModStateProofNextRound": {}, - "PrevTimestamp": {}, - "initialHint": {}, - "Totals": {}, + "Accts": {}, + "KvMods": {}, + "Txids": {}, + "Txleases": {}, + "Creatables": {}, + "Hdr": {}, + "StateProofNext": {}, + "PrevTimestamp": {}, + "initialHint": {}, + "Totals": {}, } sd := StateDelta{} diff --git a/ledger/spverificationtracker.go b/ledger/spverificationtracker.go index 4dda2b7057..0d4597633e 100644 --- a/ledger/spverificationtracker.go +++ b/ledger/spverificationtracker.go @@ -96,7 +96,7 @@ func (spt *spVerificationTracker) newBlock(blk bookkeeping.Block, delta ledgerco spt.appendCommitContext(&blk) } - if delta.ModStateProofNextRound != 0 { + if delta.StateProofNext != 0 { spt.appendDeleteContext(&blk, &delta) } } @@ -306,7 +306,7 @@ func (spt *spVerificationTracker) appendDeleteContext(blk *bookkeeping.Block, de deletionContext := verificationDeleteContext{ confirmedRound: blk.Round(), - stateProofNextRound: delta.ModStateProofNextRound, + stateProofNextRound: delta.StateProofNext, } spt.pendingDeleteContexts = append(spt.pendingDeleteContexts, deletionContext) diff --git a/ledger/spverificationtracker_test.go b/ledger/spverificationtracker_test.go index 53e532a067..e0f073fe4d 100644 --- a/ledger/spverificationtracker_test.go +++ b/ledger/spverificationtracker_test.go @@ -141,7 +141,7 @@ func feedBlocksUpToRound(spt *spVerificationTracker, prevBlock *blockEntry, targ stateProofDelta = currentStateProofNextRound } - spt.newBlock(block.block, ledgercore.StateDelta{ModStateProofNextRound: stateProofDelta}) + spt.newBlock(block.block, ledgercore.StateDelta{StateProofNext: stateProofDelta}) prevBlock = &block }