From 0a99eb2f7f50511d0ec82a695f7e10283a954bed Mon Sep 17 00:00:00 2001 From: artemijspavlovs <19916123+artemijspavlovs@users.noreply.github.com> Date: Thu, 22 Aug 2024 16:37:26 +0400 Subject: [PATCH] fix: query against a node when fetching bond params fix: use the provided bond amount during registration --- cmd/rollapp/run/run.go | 4 ++-- utils/sequencer/sequencer.go | 14 ++++---------- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/cmd/rollapp/run/run.go b/cmd/rollapp/run/run.go index 6258ae6d..b85907e8 100644 --- a/cmd/rollapp/run/run.go +++ b/cmd/rollapp/run/run.go @@ -147,7 +147,7 @@ func Cmd() *cobra.Command { ) if !isSequencerRegistered { - minBond, _ := sequencerutils.GetMinSequencerBond() + minBond, _ := sequencerutils.GetMinSequencerBond(hd) var bondAmount cosmossdktypes.Coin bondAmount.Denom = consts.Denoms.Hub @@ -248,7 +248,7 @@ func Cmd() *cobra.Command { return } - err = sequencerutils.Register(*rollappConfig) + err = sequencerutils.Register(*rollappConfig, desiredBond.String()) if err != nil { pterm.Error.Println("failed to register sequencer: ", err) return diff --git a/utils/sequencer/sequencer.go b/utils/sequencer/sequencer.go index c7a33c47..82d898bd 100644 --- a/utils/sequencer/sequencer.go +++ b/utils/sequencer/sequencer.go @@ -2,7 +2,6 @@ package sequencer import ( "encoding/json" - "fmt" "io" "os" "os/exec" @@ -21,7 +20,7 @@ import ( "github.com/dymensionxyz/roller/utils/tx" ) -func Register(raCfg config.RollappConfig) error { +func Register(raCfg config.RollappConfig, desiredBond string) error { seqPubKey, err := utils.GetSequencerPubKey(raCfg) if err != nil { return err @@ -38,11 +37,6 @@ func Register(raCfg config.RollappConfig) error { return err } - seqMinBond, err := GetMinSequencerBond() - if err != nil { - return err - } - cmd := exec.Command( consts.Executables.Dymension, "tx", @@ -51,7 +45,7 @@ func Register(raCfg config.RollappConfig) error { seqPubKey, raCfg.RollappID, seqMetadataPath, - fmt.Sprintf("%s%s", seqMinBond.Amount.String(), seqMinBond.Denom), + desiredBond, "--from", consts.KeysIds.HubSequencer, "--keyring-backend", "test", "--fees", "1dym", @@ -96,11 +90,11 @@ func isValidSequencerMetadata(path string) (bool, error) { return true, err } -func GetMinSequencerBond() (*cosmossdktypes.Coin, error) { +func GetMinSequencerBond(hd consts.HubData) (*cosmossdktypes.Coin, error) { var qpr dymensionseqtypes.QueryParamsResponse cmd := exec.Command( consts.Executables.Dymension, - "q", "sequencer", "params", "-o", "json", + "q", "sequencer", "params", "-o", "json", "--node", hd.RPC_URL, ) out, err := bash.ExecCommandWithStdout(cmd)