Skip to content

Commit

Permalink
fix: query against a node when fetching bond params
Browse files Browse the repository at this point in the history
fix: use the provided bond amount during registration
  • Loading branch information
artemijspavlovs committed Aug 22, 2024
1 parent e9852f2 commit 0a99eb2
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
4 changes: 2 additions & 2 deletions cmd/rollapp/run/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
14 changes: 4 additions & 10 deletions utils/sequencer/sequencer.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package sequencer

import (
"encoding/json"
"fmt"
"io"
"os"
"os/exec"
Expand All @@ -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
Expand All @@ -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",
Expand All @@ -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",
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 0a99eb2

Please sign in to comment.