Skip to content
This repository has been archived by the owner on Apr 15, 2024. It is now read-only.

fix: orchestrator sign up to last unbonding period #306

Merged
merged 3 commits into from
Apr 26, 2023
Merged
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
20 changes: 17 additions & 3 deletions orchestrator/orchestrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,29 @@ func (orch Orchestrator) EnqueueMissingEvents(
if err != nil {
return err
}
var startingNonce uint64
if lastUnbondingHeight == 0 {
startingNonce = 1
} else {
dc, err := orch.AppQuerier.QueryDataCommitmentForHeight(ctx, uint64(lastUnbondingHeight))
if err != nil {
return err
}
startingValset, err := orch.AppQuerier.QueryLastValsetBeforeNonce(ctx, dc.Nonce)
if err != nil {
return err
}
startingNonce = startingValset.Nonce
}

orch.Logger.Info("syncing missing nonces", "latest_nonce", latestNonce, "last_unbonding_height", lastUnbondingHeight)
orch.Logger.Info("syncing missing nonces", "latest_nonce", latestNonce, "first_nonce", startingNonce)

// To accommodate the delay that might happen between starting the two go routines above.
// Probably, it would be a good idea to further refactor the orchestrator to the relayer style
// as it is entirely synchronous. Probably, enqueuing separately old nonces and new ones, is not
// the best design.
// TODO decide on this later
for i := uint64(lastUnbondingHeight); i < latestNonce; i++ {
for i := uint64(0); i < latestNonce-startingNonce+1; i++ {
select {
case <-signalChan:
return ErrSignalChanNotif
Expand All @@ -233,7 +247,7 @@ func (orch Orchestrator) EnqueueMissingEvents(
}
}
}
orch.Logger.Info("finished syncing missing nonces", "latest_nonce", latestNonce, "last_unbonding_height", lastUnbondingHeight)
orch.Logger.Info("finished syncing missing nonces", "latest_nonce", latestNonce, "first_nonce", startingNonce)
return nil
}

Expand Down