File tree Expand file tree Collapse file tree 3 files changed +69
-1
lines changed
Expand file tree Collapse file tree 3 files changed +69
-1
lines changed Original file line number Diff line number Diff line change @@ -271,7 +271,35 @@ func PrintOutput(
271271 pterm .DefaultSection .WithIndentCharacter ("💈" ).
272272 Println ("Wallet Info:" )
273273 if withBalance && rlpCfg .NodeType == "sequencer" {
274- fmt .Println ("Sequencer Balance:" , seqAddrData [0 ].Balance .String ())
274+ seqBalance := seqAddrData [0 ].Balance
275+ fmt .Printf (
276+ "Sequencer Balance: %s %s\n " ,
277+ seqBalance .Amount .String (),
278+ seqBalance .Denom ,
279+ )
280+
281+ if rlpCfg .HubData .ID != consts .MockHubID && rlpCfg .HubData .RpcUrl != "" {
282+ params , paramsErr := sequencerutils .GetSequencerParams (rlpCfg .HubData )
283+ if paramsErr != nil {
284+ pterm .Warning .Println ("failed to retrieve sequencer params:" , paramsErr )
285+ } else if params != nil {
286+ minBalance := params .Params .LivenessSlashMinAbsolute
287+ fmt .Printf (
288+ "Liveness Slash Minimum: %s %s\n " ,
289+ minBalance .Amount .String (),
290+ minBalance .Denom ,
291+ )
292+
293+ if seqBalance .Amount .LT (minBalance .Amount ) {
294+ warnMsg := fmt .Sprintf (
295+ "Sequencer balance %s is below the liveness slash minimum %s." ,
296+ seqBalance .String (),
297+ minBalance .String (),
298+ )
299+ pterm .Warning .Println (warnMsg , "Please top up to avoid slashing." )
300+ }
301+ }
302+ }
275303 }
276304
277305 if withBalance && rlpCfg .NodeType == "sequencer" && rlpCfg .HubData .ID != "mock" {
Original file line number Diff line number Diff line change @@ -31,6 +31,38 @@ func GetSequencerConfigDir(rollerHome string) string {
3131 return filepath .Join (rollerHome , consts .ConfigDirName .Rollapp , "config" )
3232}
3333
34+ func GetSequencerParams (hd consts.HubData ) (* SequencerParamsResponse , error ) {
35+ if hd .RpcUrl == "" {
36+ return nil , fmt .Errorf ("hub rpc url is empty" )
37+ }
38+
39+ cmd := exec .Command (
40+ consts .Executables .Dymension ,
41+ "q" ,
42+ "sequencer" ,
43+ "params" ,
44+ "--node" ,
45+ hd .RpcUrl ,
46+ "--chain-id" ,
47+ hd .ID ,
48+ "-o" ,
49+ "json" ,
50+ )
51+
52+ out , err := bash .ExecCommandWithStdout (cmd )
53+ if err != nil {
54+ return nil , err
55+ }
56+
57+ var resp SequencerParamsResponse
58+ err = json .Unmarshal (out .Bytes (), & resp )
59+ if err != nil {
60+ return nil , err
61+ }
62+
63+ return & resp , nil
64+ }
65+
3466func Register (raCfg roller.RollappConfig , desiredBond cosmossdktypes.Coin ) error {
3567 seqPubKey , err := keys .GetSequencerPubKey (raCfg )
3668 if err != nil {
Original file line number Diff line number Diff line change @@ -101,3 +101,11 @@ type CheckExistingSequencerResponse struct {
101101 IsSequencerKeyPresent bool
102102 IsSequencerProposer bool
103103}
104+
105+ type SequencerParamsResponse struct {
106+ Params SequencerParams `json:"params"`
107+ }
108+
109+ type SequencerParams struct {
110+ LivenessSlashMinAbsolute cosmossdktypes.Coin `json:"liveness_slash_min_absolute"`
111+ }
You can’t perform that action at this time.
0 commit comments