Skip to content

Commit

Permalink
linter
Browse files Browse the repository at this point in the history
  • Loading branch information
charleenfei committed Sep 1, 2023
1 parent 68bc3c1 commit 5c1c655
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 19 deletions.
3 changes: 2 additions & 1 deletion modules/apps/27-interchain-accounts/simulation/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import (
"github.com/cosmos/cosmos-sdk/types/address"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"

"github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
)

// Simulation operation weights constants
const (
DefaultWeightMsgUpdateParams int = 100

OpWeightMsgUpdateParams = "op_weight_msg_update_params"
OpWeightMsgUpdateParams = "op_weight_msg_update_params" // #nosec
)

// ProposalMsgs defines the module weighted proposals' contents
Expand Down
19 changes: 10 additions & 9 deletions modules/apps/27-interchain-accounts/simulation/proposals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import (
"math/rand"
"testing"

cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"gotest.tools/v3/assert"
"github.com/stretchr/testify/require"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"

cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"

"github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types"
"github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/simulation"
)
Expand All @@ -24,18 +26,17 @@ func TestProposalMsgs(t *testing.T) {

// execute ProposalMsgs function
weightedProposalMsgs := simulation.ProposalMsgs()
assert.Assert(t, len(weightedProposalMsgs) == 1)

require.Equal(t, len(weightedProposalMsgs), 1)
w0 := weightedProposalMsgs[0]

// tests w0 interface:
assert.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey())
assert.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight())
require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey())
require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight())

msg := w0.MsgSimulatorFn()(r, ctx, accounts)
msgUpdateParams, ok := msg.(*types.MsgUpdateParams)
assert.Assert(t, ok)
require.True(t, ok)

assert.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority)
assert.Equal(t, msgUpdateParams.Params.HostEnabled, false)
require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority)
require.Equal(t, msgUpdateParams.Params.HostEnabled, false)
}
3 changes: 2 additions & 1 deletion modules/core/02-client/simulation/proposals.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,15 @@ import (
"github.com/cosmos/cosmos-sdk/types/address"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
"github.com/cosmos/cosmos-sdk/x/simulation"

"github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
)

// Simulation operation weights constants
const (
DefaultWeightMsgUpdateParams int = 100

OpWeightMsgUpdateParams = "op_weight_msg_update_params"
OpWeightMsgUpdateParams = "op_weight_msg_update_params" // #nosec
)

// ProposalMsgs defines the module weighted proposals' contents
Expand Down
18 changes: 10 additions & 8 deletions modules/core/02-client/simulation/proposals_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ import (
"math/rand"
"testing"

cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"
"gotest.tools/v3/assert"
"github.com/stretchr/testify/require"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/cosmos/cosmos-sdk/types/address"
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"

cmtproto "github.com/cometbft/cometbft/proto/tendermint/types"

"github.com/cosmos/ibc-go/v7/modules/core/02-client/simulation"
"github.com/cosmos/ibc-go/v7/modules/core/02-client/types"
)
Expand All @@ -24,18 +26,18 @@ func TestProposalMsgs(t *testing.T) {

// execute ProposalMsgs function
weightedProposalMsgs := simulation.ProposalMsgs()
assert.Assert(t, len(weightedProposalMsgs) == 1)
require.Equal(t, len(weightedProposalMsgs), 1)

w0 := weightedProposalMsgs[0]

// tests w0 interface:
assert.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey())
assert.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight())
require.Equal(t, simulation.OpWeightMsgUpdateParams, w0.AppParamsKey())
require.Equal(t, simulation.DefaultWeightMsgUpdateParams, w0.DefaultWeight())

msg := w0.MsgSimulatorFn()(r, ctx, accounts)
msgUpdateParams, ok := msg.(*types.MsgUpdateParams)
assert.Assert(t, ok)
require.True(t, ok)

assert.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority)
assert.DeepEqual(t, msgUpdateParams.Params.AllowedClients, []string{"06-solomachine", "07-tendermint"})
require.Equal(t, sdk.AccAddress(address.Module("gov")).String(), msgUpdateParams.Authority)
require.EqualValues(t, msgUpdateParams.Params.AllowedClients, []string{"06-solomachine", "07-tendermint"})
}

0 comments on commit 5c1c655

Please sign in to comment.