Skip to content

Commit a6f70b7

Browse files
committed
PKI TODO comments + fix import order. (#3167)
1 parent f688227 commit a6f70b7

File tree

5 files changed

+12
-7
lines changed

5 files changed

+12
-7
lines changed

data/account/participationRegistry.go

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,11 @@ func recordActive(record ParticipationRecord, on basics.Round) bool {
813813
return record.EffectiveLast != 0 && record.EffectiveFirst <= on && on <= record.EffectiveLast
814814
}
815815

816+
// PKI TODO: Register needs a bit more work to make sure EffectiveFirst and
817+
// EffectiveLast are set at the right time. Specifically, the node
818+
// doesn't call Register until the key becomes active and is about
819+
// to be used, so effective first/last is updated just-in-time. It
820+
// would be better to update them when the KeyRegistration occurs.
816821
func (db *participationDB) Register(id ParticipationID, on basics.Round) error {
817822
// Lookup recordToRegister for first/last valid and account.
818823
recordToRegister := db.Get(id)
@@ -843,8 +848,7 @@ func (db *participationDB) Register(id ParticipationID, on basics.Round) error {
843848

844849
// Disable active key if there is one
845850
for _, record := range toUpdate {
846-
// TODO: this should probably be "on - 1"
847-
record.EffectiveLast = on
851+
record.EffectiveLast = on - 1
848852
updated[record.ParticipationID] = updatingParticipationRecord{
849853
record.Duplicate(),
850854
false,

data/account/participationRegistry_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,7 +211,7 @@ func TestParticipation_Register(t *testing.T) {
211211
// Register second key.
212212
err = registry.Register(p2.ID(), 2500000)
213213
a.NoError(err)
214-
verifyEffectiveRound(p.ID(), 500000, 2500000)
214+
verifyEffectiveRound(p.ID(), 500000, 2499999)
215215
verifyEffectiveRound(p2.ID(), 2500000, int(p2.LastValid))
216216
}
217217

data/accountManager.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ func (manager *AccountManager) Keys(rnd basics.Round) (out []account.Participati
6767
}
6868
return out
6969

70-
// TODO: source keys from the registry.
70+
// PKI TODO: source keys from the registry.
7171
// This kinda works, but voting keys are not updated.
7272
/*
7373
for _, record := range manager.registry.GetAll() {
@@ -209,7 +209,7 @@ func (manager *AccountManager) DeleteOldKeys(latestHdr bookkeeping.BlockHeader,
209209
}
210210
}
211211

212-
// TODO: This needs to update the partkeys also, see the 'DeleteOldKeys' function above, it's part
212+
// PKI TODO: This needs to update the partkeys also, see the 'DeleteOldKeys' function above, it's part
213213
// is part of PersistedParticipation, but just calls 'part.Voting.DeleteBeforeFineGrained'
214214
// Delete expired records from participation registry.
215215
if err := manager.registry.DeleteExpired(latestHdr.Round); err != nil {

node/node.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ func (node *AlgorandFullNode) Start() {
415415
func (node *AlgorandFullNode) startMonitoringRoutines() {
416416
node.monitoringRoutinesWaitGroup.Add(3)
417417

418-
// TODO: Remove this with #2596
418+
// PKI TODO: Remove this with #2596
419419
// Periodically check for new participation keys
420420
go node.checkForParticipationKeys()
421421

util/db/initialize_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,10 @@ import (
2020
"context"
2121
"database/sql"
2222
"errors"
23-
"github.com/algorand/go-algorand/test/partitiontest"
2423
"testing"
2524

25+
"github.com/algorand/go-algorand/test/partitiontest"
26+
2627
"github.com/stretchr/testify/assert"
2728
"github.com/stretchr/testify/require"
2829
)

0 commit comments

Comments
 (0)