From 6afcae2459d8cbc3538f948c105da22ad4130d67 Mon Sep 17 00:00:00 2001 From: albertchon Date: Fri, 9 Jul 2021 01:48:20 -0400 Subject: [PATCH 1/2] increase ethBlockConfirmationDelay --- orchestrator/eth_event_watcher.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/orchestrator/eth_event_watcher.go b/orchestrator/eth_event_watcher.go index 01a6b653..41482e9f 100644 --- a/orchestrator/eth_event_watcher.go +++ b/orchestrator/eth_event_watcher.go @@ -11,10 +11,13 @@ import ( wrappers "github.com/InjectiveLabs/peggo/solidity/wrappers/Peggy.sol" ) -// Considering blocktime=3s approx on injective-chain, and oracle loop duration = 1 minute, we can broadcast only 20 events in each iteration. -// So better to search only 20 blocks to ensure all the events gets broadcasted to injective chain without missing. +// Considering blocktime of up to 3 seconds approx on the Injective Chain and an oracle loop duration = 1 minute, +// we broadcast only 20 events in each iteration. +// So better to search only 20 blocks to ensure all the events are broadcast to Injective Chain without misses. const defaultBlocksToSearch = 20 +const ethBlockConfirmationDelay = 12 + // CheckForEvents checks for events such as a deposit to the Peggy Ethereum contract or a validator set update // or a transaction batch update. It then responds to these events by performing actions on the Cosmos chain if required func (s *peggyOrchestrator) CheckForEvents( @@ -27,8 +30,8 @@ func (s *peggyOrchestrator) CheckForEvents( return 0, err } - // add delay to ensure miminum confirmations are received and block is finalised - currentBlock = latestHeader.Number.Uint64() - uint64(6) + // add delay to ensure minimum confirmations are received and block is finalised + currentBlock = latestHeader.Number.Uint64() - uint64(ethBlockConfirmationDelay) if currentBlock < startingBlock { return currentBlock, nil From e271073d8901058a0b93ed3e9dd508e259c2e141 Mon Sep 17 00:00:00 2001 From: albertchon Date: Mon, 12 Jul 2021 16:07:37 -0400 Subject: [PATCH 2/2] fix typos --- orchestrator/eth_event_watcher.go | 2 +- orchestrator/relayer/valset_relaying.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/orchestrator/eth_event_watcher.go b/orchestrator/eth_event_watcher.go index 41482e9f..db61290c 100644 --- a/orchestrator/eth_event_watcher.go +++ b/orchestrator/eth_event_watcher.go @@ -150,7 +150,7 @@ func (s *peggyOrchestrator) CheckForEvents( // the possibility that the relayer was killed after relaying only one of multiple events in a single // block, so we also need this routine so make sure we don't send in the first event in this hypothetical // multi event block again. In theory we only send all events for every block and that will pass of fail - // atomicly but lets not take that risk. + // atomically but lets not take that risk. lastClaimEvent, err := s.cosmosQueryClient.LastClaimEventByAddr(ctx, s.peggyBroadcastClient.AccFromAddress()) if err != nil { err = errors.New("failed to query last claim event from backend") diff --git a/orchestrator/relayer/valset_relaying.go b/orchestrator/relayer/valset_relaying.go index 00432ebf..d180cf61 100644 --- a/orchestrator/relayer/valset_relaying.go +++ b/orchestrator/relayer/valset_relaying.go @@ -25,7 +25,7 @@ func (s *peggyRelayer) RelayValsets(ctx context.Context) error { for _, set := range latestValsets { sigs, err := s.cosmosQueryClient.AllValsetConfirms(ctx, set.Nonce) if err != nil { - err = errors.Wrapf(err, "failed to get valset confims at nonce %d", set.Nonce) + err = errors.Wrapf(err, "failed to get valset confirms at nonce %d", set.Nonce) return err } else if len(sigs) == 0 { continue