Skip to content

Commit

Permalink
chore: small nits
Browse files Browse the repository at this point in the history
  • Loading branch information
johnletey committed Oct 31, 2024
1 parent 3789b2c commit 432c504
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.idea
build
coverage.out
build/
debug_container.*
debug_container.*
4 changes: 2 additions & 2 deletions client/cli/tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ func GetTxCmd() *cobra.Command {
func TxUpdateGasPrices() *cobra.Command {
cmd := &cobra.Command{
Use: "update-gas-prices [gas-prices ...]",
Example: "update-gas-prices ustake ulove",
Short: "Execute the UpdateGasPrices RPC method",
Short: "Update the minimum required gas prices for non-bypassed messages",
Example: "update-gas-prices 0.1uusdc 0.09ueure",
Args: cobra.MinimumNArgs(1),
RunE: func(cmd *cobra.Command, args []string) error {
clientCtx, err := client.GetClientTxContext(cmd)
Expand Down
22 changes: 10 additions & 12 deletions e2e/globalfee_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ func TestGlobalFee(t *testing.T) {
err = bankSendWithFees(ctx, validator, sender, recipient, "1ustake", "0ustake")
// ASSERT: The transaction was successful due to no required fees.
require.NoError(t, err)

// ACT: Set required gas prices to 10ustake.
_, err = validator.ExecTx(ctx, wrapper.Authority.KeyName(), "globalfee", "update-gas-prices", gasPrice.String())
// ASSERT: The transaction was successful and updated the required gas prices.
Expand All @@ -59,23 +60,20 @@ func TestGlobalFee(t *testing.T) {
// ASSERT: The transaction failed due to insufficient fees.
require.ErrorContains(t, err, "insufficient fee")

// ACT: Add bank transfer messages to bypass fee
bankSendType := sdk.MsgTypeURL(&banktypes.MsgSend{}) // /cosmos.bank.v1beta1.MsgSend
// ACT: Set x/bank MsgSend as a bypassed message.
bankSendType := sdk.MsgTypeURL(&banktypes.MsgSend{})
_, err = validator.ExecTx(ctx, wrapper.Authority.KeyName(), "globalfee", "update-bypass-messages", bankSendType, "--fees", fee)
// ASSERT: The transaction was successful and updated the bypass messages.
require.NoError(t, err)
// ASSERT: The transaction successfully updated the bypass messages
raw, _, err := validator.ExecQuery(ctx, "globalfee", "bypass-messages")
require.NoError(t, err)
var bypassMessagesResponse types.QueryBypassMessagesResponse
err = json.Unmarshal(raw, &bypassMessagesResponse)
require.NoError(t, err)
expectedBypassMessages := types.QueryBypassMessagesResponse{
BypassMessages: []string{bankSendType},
}
require.Equal(t, expectedBypassMessages, bypassMessagesResponse)
var res types.QueryBypassMessagesResponse
require.NoError(t, json.Unmarshal(raw, &res))
require.Len(t, res.BypassMessages, 1)
require.Contains(t, res.BypassMessages, bankSendType)

// ACT: Attempt a bank send with no fees now that that message types is bypassed
// ACT: Attempt a transaction with no fees.
err = bankSendWithFees(ctx, validator, sender, recipient, "1ustake", "0ustake")
// ASSERT: The transaction was successful with no fees.
// ASSERT: The transaction was successful due to bypassed message.
require.NoError(t, err)
}
3 changes: 2 additions & 1 deletion module.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ func (AppModule) AutoCLIOptions() *autocliv1.ModuleOptions {
{
RpcMethod: "UpdateBypassMessages",
Use: "update-bypass-messages [bypass-messages ...]",
Example: "update-bypass-messages /cosmos.bank.v1beta1.MsgSend /noble.globalfee.v1.MsgUpdateGasPrices",
Short: "Update the messages that are allowed to bypass required gas prices",
Example: "update-bypass-messages /ibc.core.client.v1.MsgUpdateClient /noble.globalfee.v1.MsgUpdateGasPrices",
PositionalArgs: []*autocliv1.PositionalArgDescriptor{
{
ProtoField: "bypass_messages",
Expand Down

0 comments on commit 432c504

Please sign in to comment.