Skip to content

Commit

Permalink
fix: override retry config, enforce large retry times, and fix min ga…
Browse files Browse the repository at this point in the history
…s amount (#12)
  • Loading branch information
SebastianElvis authored Feb 3, 2023
1 parent 868797f commit 642d835
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 8 deletions.
1 change: 1 addition & 0 deletions bbnrelayer/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ func (r *Relayer) waitUntilQuerable(
}
// in case block at srch/dsth has not been committed yet
// see https://github.com/tendermint/tendermint/issues/7641
// TODO: remove below after bumping Tendermint to versions after https://github.com/tendermint/tendermint/pull/7642
srch--
dsth--

Expand Down
7 changes: 6 additions & 1 deletion cmd/start.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"sync"
"time"

"github.com/avast/retry-go/v4"
"github.com/babylonchain/babylon-relayer/bbnrelayer"
"github.com/babylonchain/babylon-relayer/config"
relaydebug "github.com/babylonchain/babylon-relayer/debug"
Expand Down Expand Up @@ -56,10 +57,14 @@ func keepUpdatingClientsCmd() *cobra.Command {
if err != nil {
return err
}
// override retry in relayer config
numRetries, err := cmd.Flags().GetUint("retry")
if err != nil {
return err
}
relayer.RtyAttNum = numRetries
relayer.RtyAtt = retry.Attempts(relayer.RtyAttNum)
relayer.RtyDel = retry.Delay(time.Second)

// initialise prometheus registry
metrics := relaydebug.NewPrometheusMetrics()
Expand Down Expand Up @@ -96,7 +101,7 @@ func keepUpdatingClientsCmd() *cobra.Command {

cmd.Flags().String("memo", "", "a memo to include in relayed packets")
cmd.Flags().Duration("interval", time.Minute*10, "the interval between two update-client attempts")
cmd.Flags().Uint("retry", relayer.RtyAttNum, "number of retry attempts for requests")
cmd.Flags().Uint("retry", 20, "number of retry attempts for requests")
cmd.Flags().String("debug-addr", "", "address for the debug server with Prometheus metrics")

return cmd
Expand Down
7 changes: 6 additions & 1 deletion cmd/update-client.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
"time"

"github.com/avast/retry-go/v4"
"github.com/babylonchain/babylon-relayer/bbnrelayer"
relaydebug "github.com/babylonchain/babylon-relayer/debug"
"github.com/cosmos/relayer/v2/relayer"
Expand Down Expand Up @@ -86,10 +87,14 @@ corresponding update-client message to babylon_chain_name.`,
if err != nil {
return err
}
// override retry in relayer config
numRetries, err := cmd.Flags().GetUint("retry")
if err != nil {
return err
}
relayer.RtyAttNum = numRetries
relayer.RtyAtt = retry.Attempts(relayer.RtyAttNum)
relayer.RtyDel = retry.Delay(time.Second)

// initialise prometheus registry
metrics := relaydebug.NewPrometheusMetrics()
Expand All @@ -116,7 +121,7 @@ corresponding update-client message to babylon_chain_name.`,

cmd.Flags().String("memo", "", "a memo to include in relayed packets")
cmd.Flags().Duration("interval", time.Minute*10, "the interval between two update-client attempts")
cmd.Flags().Uint("retry", relayer.RtyAttNum, "number of retry attempts for requests")
cmd.Flags().Uint("retry", 20, "number of retry attempts for requests")
cmd.Flags().String("debug-addr", "", "address for the debug server with Prometheus metrics")

return cmd
Expand Down
12 changes: 6 additions & 6 deletions examples/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ chains:
keyring-backend: test
gas-adjustment: 1.5
gas-prices: 1uakt
min-gas-amount: 0
min-gas-amount: 1
debug: true
timeout: 10s
output-format: json
Expand All @@ -30,7 +30,7 @@ chains:
keyring-backend: test
gas-adjustment: 1.5
gas-prices: 0.002ubbn
min-gas-amount: 0
min-gas-amount: 1
debug: true
timeout: 10s
output-format: json
Expand All @@ -46,7 +46,7 @@ chains:
keyring-backend: test
gas-adjustment: 1.5
gas-prices: 50000000000inj
min-gas-amount: 0
min-gas-amount: 1
debug: true
timeout: 10s
output-format: json
Expand All @@ -63,7 +63,7 @@ chains:
keyring-backend: test
gas-adjustment: 1.5
gas-prices: 0.1ujunox
min-gas-amount: 0
min-gas-amount: 1
debug: true
timeout: 10s
output-format: json
Expand All @@ -79,7 +79,7 @@ chains:
keyring-backend: test
gas-adjustment: 1.5
gas-prices: 0.01uosmo
min-gas-amount: 0
min-gas-amount: 1
debug: true
timeout: 10s
output-format: json
Expand All @@ -95,7 +95,7 @@ chains:
keyring-backend: test
gas-adjustment: 1.5
gas-prices: 0.1uscrt
min-gas-amount: 0
min-gas-amount: 1
debug: true
timeout: 10s
output-format: json
Expand Down

0 comments on commit 642d835

Please sign in to comment.