Skip to content
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
8 changes: 6 additions & 2 deletions data/account/participationRegistry.go
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,11 @@ func recordActive(record ParticipationRecord, on basics.Round) bool {
return record.EffectiveLast != 0 && record.EffectiveFirst <= on && on <= record.EffectiveLast
}

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

// Disable active key if there is one
for _, record := range toUpdate {
// TODO: this should probably be "on - 1"
record.EffectiveLast = on
record.EffectiveLast = on - 1
updated[record.ParticipationID] = updatingParticipationRecord{
record.Duplicate(),
false,
Expand Down
4 changes: 2 additions & 2 deletions data/accountManager.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ func (manager *AccountManager) Keys(rnd basics.Round) (out []account.Participati
}
return out

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

// TODO: This needs to update the partkeys also, see the 'DeleteOldKeys' function above, it's part
// PKI TODO: This needs to update the partkeys also, see the 'DeleteOldKeys' function above, it's part
// is part of PersistedParticipation, but just calls 'part.Voting.DeleteBeforeFineGrained'
// Delete expired records from participation registry.
if err := manager.registry.DeleteExpired(latestHdr.Round); err != nil {
Expand Down
2 changes: 1 addition & 1 deletion node/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ func (node *AlgorandFullNode) Start() {
func (node *AlgorandFullNode) startMonitoringRoutines() {
node.monitoringRoutinesWaitGroup.Add(3)

// TODO: Remove this with #2596
// PKI TODO: Remove this with #2596
// Periodically check for new participation keys
go node.checkForParticipationKeys()

Expand Down
3 changes: 2 additions & 1 deletion util/db/initialize_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,10 @@ import (
"context"
"database/sql"
"errors"
"github.com/algorand/go-algorand/test/partitiontest"
"testing"

"github.com/algorand/go-algorand/test/partitiontest"

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
)
Expand Down