Skip to content

Commit

Permalink
lint fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
manojkgorle committed Sep 7, 2024
1 parent c5a1bdd commit 1e5da9a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions rpc/jsonrpc_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ func (cli *JSONRPCClient) SubmitMsgTx(ctx context.Context, chainID string, netwo
ctx,
"submitMsgTx",
&SubmitMsgTxArgs{
ChainId: chainID,
ChainID: chainID,
NetworkID: networkID,
SecondaryChainId: secondaryChainID,
SecondaryChainID: secondaryChainID,
Data: data,
},
resp,
Expand Down
17 changes: 10 additions & 7 deletions rpc/jsonrpc_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,9 @@ func (j *JSONRPCServer) Genesis(_ *http.Request, _ *struct{}, reply *GenesisRepl
}

type SubmitMsgTxArgs struct {
ChainId string `json:"chain_id"`
ChainID string `json:"chain_id"`
NetworkID uint32 `json:"network_id"`
SecondaryChainId []byte `json:"secondary_chain_id"`
SecondaryChainID []byte `json:"secondary_chain_id"`
Data [][]byte `json:"data"`
}

Expand All @@ -57,14 +57,16 @@ type SubmitMsgTxReply struct {
}

// This method submits SequencerMsg actions to the chain, without any priority fee.
// Note: This method will be removed in the future, as it is only used for testing.
func (j *JSONRPCServer) SubmitMsgTx(
req *http.Request,
args *SubmitMsgTxArgs,
reply *SubmitMsgTxReply,
) error {
ctx := context.Background()
ctx, span := j.c.Tracer().Start(req.Context(), "Server.SubmitMsgTx")
defer span.End()

chainId, err := ids.FromString(args.ChainId)
chainID, err := ids.FromString(args.ChainID)
if err != nil {
return err
}
Expand All @@ -74,7 +76,7 @@ func (j *JSONRPCServer) SubmitMsgTx(
return err
}

parser := j.ServerParser(ctx, args.NetworkID, chainId)
parser := j.ServerParser(ctx, args.NetworkID, chainID)

privBytes, err := codec.LoadHex(
"323b1d8f4eed5f0da9da93071b034f2dce9d2d22692c172f3cb252a64ddfafd01b057de320297c29ad0c1f589ea216869cf1938d88c9fbd70d6748323dbf2fa7", //nolint:lll
Expand All @@ -99,7 +101,7 @@ func (j *JSONRPCServer) SubmitMsgTx(
act := actions.SequencerMsg{
FromAddress: rsender,
Data: data,
ChainID: args.SecondaryChainId,
ChainID: args.SecondaryChainID,
RelayerID: 0,
}
acts = append(acts, &act)
Expand Down Expand Up @@ -128,14 +130,15 @@ func (j *JSONRPCServer) SubmitMsgTx(
maxFee += nsPrices[i] * feeMarketUnits[ns]
}

// Add 20% to the max fee
maxFee += (maxFee / 5)

now := time.Now().UnixMilli()
rules := parser.Rules(now)

base := &chain.Base{
Timestamp: utils.UnixRMilli(now, rules.GetValidityWindow()),
ChainID: chainId,
ChainID: chainID,
MaxFee: maxFee,
}

Expand Down

0 comments on commit 1e5da9a

Please sign in to comment.