Skip to content

Commit 39549c9

Browse files
committed
Review feedback and linting
1 parent 972661e commit 39549c9

6 files changed

Lines changed: 13 additions & 12 deletions

File tree

simapp/sim_test.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,18 @@ import (
66
"encoding/binary"
77
"encoding/json"
88
"flag"
9-
"github.com/cosmos/cosmos-sdk/simsx"
109
"io"
1110
"math/rand"
1211
"strings"
1312
"sync"
1413
"testing"
1514
"time"
1615

16+
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
17+
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
18+
"github.com/stretchr/testify/assert"
19+
"github.com/stretchr/testify/require"
20+
1721
corestore "cosmossdk.io/core/store"
1822
"cosmossdk.io/log"
1923
"cosmossdk.io/store"
@@ -22,13 +26,10 @@ import (
2226
"cosmossdk.io/x/feegrant"
2327
slashingtypes "cosmossdk.io/x/slashing/types"
2428
stakingtypes "cosmossdk.io/x/staking/types"
25-
abci "github.com/cometbft/cometbft/api/cometbft/abci/v1"
26-
cmtproto "github.com/cometbft/cometbft/api/cometbft/types/v1"
27-
"github.com/stretchr/testify/assert"
28-
"github.com/stretchr/testify/require"
2929

3030
"github.com/cosmos/cosmos-sdk/baseapp"
3131
servertypes "github.com/cosmos/cosmos-sdk/server/types"
32+
"github.com/cosmos/cosmos-sdk/simsx"
3233
simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims"
3334
sdk "github.com/cosmos/cosmos-sdk/types"
3435
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"

simsx/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ func MsgSendFactory() simsx.SimMsgFactoryFn[*types.MsgSend] {
1717
}
1818
```
1919

20-
2120
#### * [Sims registry](https://github.com/cosmos/cosmos-sdk/blob/main/simsx/registry.go)
2221

2322
A new helper to register message factories with a default weight value. They can be overwritten by a parameters file as before. The registry is passed to the AppModule type. For example:
@@ -27,6 +26,7 @@ func (am AppModule) WeightedOperationsX(weights simsx.WeightSource, reg simsx.Re
2726
reg.Add(weights.Get("msg_multisend", 10), simulation.MsgMultiSendFactory())
2827
}
2928
```
29+
3030
#### * [Reporter](https://github.com/cosmos/cosmos-sdk/blob/main/simsx/reporter.go)
3131
The reporter is a flow control structure that can be used in message factories to skip execution at any point. The idea is similar to the testing.T Skip in Go stdlib. Internally, it converts skip, success and failure events to legacy sim messages.
3232
The reporter also provides some capability to print an execution summary.
@@ -36,9 +36,7 @@ Message factories may want to abort early via
3636
if reporter.IsSkipped() {
3737
return nil, nil
3838
}
39-
4039
```
4140

4241
#### * [Test data environment](https://github.com/cosmos/cosmos-sdk/blob/main/simsx/environment.go)
4342
The test data environment provides simple access to accounts and other test data used in most message factories. It also encapsulates some app internals like bank keeper or address codec.
44-

simsx/common_test.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,11 @@ import (
44
"context"
55
"math/rand"
66

7+
"github.com/cosmos/gogoproto/proto"
8+
79
coretransaction "cosmossdk.io/core/transaction"
810
"cosmossdk.io/x/tx/signing"
11+
912
"github.com/cosmos/cosmos-sdk/client"
1013
"github.com/cosmos/cosmos-sdk/codec"
1114
"github.com/cosmos/cosmos-sdk/codec/address"
@@ -16,7 +19,6 @@ import (
1619
sdk "github.com/cosmos/cosmos-sdk/types"
1720
simtypes "github.com/cosmos/cosmos-sdk/types/simulation"
1821
"github.com/cosmos/cosmos-sdk/x/auth/tx"
19-
"github.com/cosmos/gogoproto/proto"
2022
)
2123

2224
// SimAccountFixture testing only

simsx/msg_factory_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,11 @@ import (
55
"errors"
66
"testing"
77

8-
sdk "github.com/cosmos/cosmos-sdk/types"
9-
108
"github.com/stretchr/testify/assert"
119
"github.com/stretchr/testify/require"
1210

1311
"github.com/cosmos/cosmos-sdk/testutil/testdata"
12+
sdk "github.com/cosmos/cosmos-sdk/types"
1413
)
1514

1615
func TestMsgFactories(t *testing.T) {

simsx/runner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,7 @@ func prepareWeightedOps(
242242

243243
pReg := make(UniqueTypeRegistry)
244244
wProps := make([]simtypes.WeightedProposalMsg, 0, len(sm.Modules))
245-
wContent := make([]simtypes.WeightedProposalContent, 0)
245+
wContent := make([]simtypes.WeightedProposalContent, 0) //nolint:staticcheck // required for legacy type
246246

247247
// add gov proposals types
248248
for _, m := range sm.Modules {

x/gov/module.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"encoding/json"
66
"fmt"
7+
78
gwruntime "github.com/grpc-ecosystem/grpc-gateway/runtime"
89
"github.com/spf13/cobra"
910
"google.golang.org/grpc"

0 commit comments

Comments
 (0)