Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: Rename ModStateProofNextRound to StateProofNext. #5265

Merged
merged 7 commits into from
Apr 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ledger/apply/stateproof_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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())
}
10 changes: 5 additions & 5 deletions ledger/eval/cow.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -266,15 +266,15 @@ 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 {
ch := childPool.Get().(*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)
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ledger/ledger_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 4 additions & 4 deletions ledger/ledgercore/statedelta.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
// 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
StateProofNext basics.Round

// previous block timestamp
PrevTimestamp int64
Expand Down Expand Up @@ -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
}

Expand Down Expand Up @@ -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
}

Expand Down
22 changes: 11 additions & 11 deletions ledger/ledgercore/statedelta_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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{}
Expand Down
4 changes: 2 additions & 2 deletions ledger/spverificationtracker.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion ledger/spverificationtracker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down