Skip to content

Commit c3ef527

Browse files
committed
Update tx pointer age on skipped slots
1 parent 53dcd36 commit c3ef527

File tree

3 files changed

+30
-0
lines changed

3 files changed

+30
-0
lines changed

rolling-shutter/keyperimpl/gnosis/database/gnosiskeyper.sqlc.gen.go

Lines changed: 16 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

rolling-shutter/keyperimpl/gnosis/database/sql/queries/gnosiskeyper.sql

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,11 @@ VALUES ($1, $2, $3)
5353
ON CONFLICT (eon) DO UPDATE
5454
SET slot = $2, value = $3;
5555

56+
-- name: SetTxPointerSlot :exec
57+
UPDATE tx_pointer
58+
SET slot = $2
59+
WHERE eon = $1;
60+
5661
-- name: SetCurrentDecryptionTrigger :exec
5762
INSERT INTO current_decryption_trigger (eon, slot, tx_pointer, identities_hash)
5863
VALUES ($1, $2, $3, $4)

rolling-shutter/keyperimpl/gnosis/newslot.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,15 @@ func (kpr *Keyper) maybeTriggerDecryption(ctx context.Context, slot uint64) erro
9494
log.Debug().
9595
Uint64("slot", slot).
9696
Msg("skipping slot as proposer is not registered")
97+
// Even if we don't trigger decryption, we still need to update the tx pointer or it will
98+
// become outdated.
99+
err := gnosisKeyperDB.SetTxPointerSlot(ctx, gnosisdatabase.SetTxPointerSlotParams{
100+
Eon: keyperSet.KeyperConfigIndex,
101+
Slot: int64(slot),
102+
})
103+
if err != nil {
104+
return errors.Wrap(err, "failed to update tx pointer slot")
105+
}
97106
return nil
98107
}
99108

0 commit comments

Comments
 (0)