From 88b1cff3733436203209805b25e21a42179bcc3f Mon Sep 17 00:00:00 2001 From: scorpioborn <97235353+scorpioborn@users.noreply.github.com> Date: Fri, 20 Oct 2023 09:40:03 +0300 Subject: [PATCH] lint: fix workflows and sim_test --- .github/workflows/lint.yml | 2 +- .github/workflows/test.yml | 10 +++--- app/sim_test.go | 50 +++++++++++++++++++----------- proto/Dockerfile | 2 +- proto/sgenetwork/sge/mint/tx.proto | 11 ++++--- x/bet/module_simulation.go | 2 +- x/house/module_simulation.go | 2 +- x/market/module_simulation.go | 2 +- x/mint/module_simulation.go | 2 +- x/mint/types/tx.pb.go | 38 +++++++++++------------ x/orderbook/module_simulation.go | 2 +- x/ovm/module_simulation.go | 2 +- 12 files changed, 70 insertions(+), 55 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 464480cdb..074fc97f4 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -13,7 +13,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20 - uses: technote-space/get-diff-action@v6.0.1 with: PATTERNS: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5509b466e..785db96d7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -15,7 +15,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20 - name: Display go version run: go version - name: install tparse @@ -35,7 +35,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20 - uses: technote-space/get-diff-action@v4 id: git_diff with: @@ -51,7 +51,7 @@ jobs: steps: - uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20 - uses: actions/checkout@v2 - name: Create a file with all the pkgs run: go list ./... > pkgs.txt @@ -86,7 +86,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20 - uses: technote-space/get-diff-action@v4 with: PATTERNS: | @@ -164,7 +164,7 @@ jobs: - uses: actions/checkout@v2 - uses: actions/setup-go@v3 with: - go-version: 1.19 + go-version: 1.20 - uses: technote-space/get-diff-action@v4 with: PATTERNS: | diff --git a/app/sim_test.go b/app/sim_test.go index fe522de77..5bbb725e4 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -6,7 +6,6 @@ import ( "os" "testing" - sdksimapp "cosmossdk.io/simapp" dbm "github.com/cometbft/cometbft-db" "github.com/cometbft/cometbft/libs/log" "github.com/cometbft/cometbft/libs/rand" @@ -32,7 +31,14 @@ func init() { // Profile with: // /usr/local/go/bin/go test -benchmem -run=^$ github.com/cosmos/cosmos-sdk/SgeApp -bench ^BenchmarkFullAppSimulation$ -Commit=true -cpuprofile cpu.out func BenchmarkFullAppSimulation(b *testing.B) { - config, db, dir, logger, _, err := simtestutil.SetupSimulation("goleveldb-app-sim", "Simulation") + config := simcli.NewConfigFromFlags() + db, dir, logger, _, err := simtestutil.SetupSimulation( + config, + "goleveldb-app-sim", + "Simulation", + simcli.FlagVerboseValue, + simcli.FlagEnabledValue, + ) if err != nil { b.Fatalf("simulation setup failed: %s", err.Error()) } @@ -45,7 +51,7 @@ func BenchmarkFullAppSimulation(b *testing.B) { } }() - app := app.NewSgeApp( + sApp := app.NewSgeApp( logger, db, nil, @@ -62,17 +68,21 @@ func BenchmarkFullAppSimulation(b *testing.B) { _, simParams, simErr := simulation.SimulateFromSeed( b, os.Stdout, - app.BaseApp, - simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager()), + sApp.BaseApp, + simtestutil.AppStateFn( + sApp.AppCodec(), + sApp.SimulationManager(), + app.NewDefaultGenesisState(), + ), simulation2.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 - simtestutil.SimulationOperations(app, app.AppCodec(), config), - app.ModuleAccountAddrs(), + simtestutil.SimulationOperations(sApp, sApp.AppCodec(), config), + sApp.ModuleAccountAddrs(), config, - app.AppCodec(), + sApp.AppCodec(), ) // export state and simParams before the simulation error is checked - if err = simtestutil.CheckExportSimulation(app, config, simParams); err != nil { + if err = simtestutil.CheckExportSimulation(sApp, config, simParams); err != nil { b.Fatal(err) } @@ -96,12 +106,12 @@ func TestAppStateDeterminism(t *testing.T) { t.Skip("skipping application simulation") } - config := sdksimapp.NewConfigFromFlags() + config := simcli.NewConfigFromFlags() config.InitialBlockHeight = 1 config.ExportParamsPath = "" config.OnOperation = false config.AllInvariants = false - config.ChainID = sdksimapp.SimAppChainID + config.ChainID = SimAppChainID numSeeds := 3 numTimesToRunPerSeed := 5 @@ -119,7 +129,7 @@ func TestAppStateDeterminism(t *testing.T) { } db := dbm.NewMemDB() - app := app.NewSgeApp( + sApp := app.NewSgeApp( logger, db, nil, @@ -140,13 +150,17 @@ func TestAppStateDeterminism(t *testing.T) { _, _, err := simulation.SimulateFromSeed( t, os.Stdout, - app.BaseApp, - simtestutil.AppStateFn(app.AppCodec(), app.SimulationManager()), + sApp.BaseApp, + simtestutil.AppStateFn( + sApp.AppCodec(), + sApp.SimulationManager(), + app.NewDefaultGenesisState(), + ), simulation2.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 - simtestutil.SimulationOperations(app, app.AppCodec(), config), - app.ModuleAccountAddrs(), + simtestutil.SimulationOperations(sApp, sApp.AppCodec(), config), + sApp.ModuleAccountAddrs(), config, - app.AppCodec(), + sApp.AppCodec(), ) require.NoError(t, err) @@ -154,7 +168,7 @@ func TestAppStateDeterminism(t *testing.T) { simtestutil.PrintStats(db) } - appHash := app.LastCommitID().Hash + appHash := sApp.LastCommitID().Hash appHashList[j] = appHash if j != 0 { diff --git a/proto/Dockerfile b/proto/Dockerfile index f5e6f162c..e390388b6 100644 --- a/proto/Dockerfile +++ b/proto/Dockerfile @@ -3,7 +3,7 @@ FROM bufbuild/buf:1.7.0 as BUILDER -FROM golang:1.19-alpine +FROM golang:1.20-alpine RUN apk add --no-cache \ diff --git a/proto/sgenetwork/sge/mint/tx.proto b/proto/sgenetwork/sge/mint/tx.proto index dd422c8af..1b118f076 100644 --- a/proto/sgenetwork/sge/mint/tx.proto +++ b/proto/sgenetwork/sge/mint/tx.proto @@ -7,7 +7,6 @@ import "cosmos/msg/v1/msg.proto"; import "amino/amino.proto"; import "gogoproto/gogo.proto"; import "cosmos_proto/cosmos.proto"; -import "sgenetwork/sge/mint/minter.proto"; import "sgenetwork/sge/mint/params.proto"; // Msg defines the x/mint Msg service. @@ -26,15 +25,17 @@ service Msg { // Since: cosmos-sdk 0.47 message MsgUpdateParams { option (cosmos.msg.v1.signer) = "authority"; - option (amino.name) = "sge/x/mint/MsgUpdateParams"; + option (amino.name) = "sge/x/mint/MsgUpdateParams"; - // authority is the address that controls the module (defaults to x/gov unless overwritten). - string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). + string authority = 1 [ (cosmos_proto.scalar) = "cosmos.AddressString" ]; // params defines the x/mint parameters to update. // // NOTE: All parameters must be supplied. - Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true]; + Params params = 2 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } // MsgUpdateParamsResponse defines the response structure for executing a diff --git a/x/bet/module_simulation.go b/x/bet/module_simulation.go index 5adf8f14d..ed002c1a5 100644 --- a/x/bet/module_simulation.go +++ b/x/bet/module_simulation.go @@ -37,7 +37,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } diff --git a/x/house/module_simulation.go b/x/house/module_simulation.go index 85f59c865..73abc5716 100644 --- a/x/house/module_simulation.go +++ b/x/house/module_simulation.go @@ -30,7 +30,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } diff --git a/x/market/module_simulation.go b/x/market/module_simulation.go index 360cfaa8b..ad8096178 100644 --- a/x/market/module_simulation.go +++ b/x/market/module_simulation.go @@ -44,7 +44,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } diff --git a/x/mint/module_simulation.go b/x/mint/module_simulation.go index 883b5d4c1..cf6095dda 100644 --- a/x/mint/module_simulation.go +++ b/x/mint/module_simulation.go @@ -30,7 +30,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } diff --git a/x/mint/types/tx.pb.go b/x/mint/types/tx.pb.go index eab8c9778..7e8293496 100644 --- a/x/mint/types/tx.pb.go +++ b/x/mint/types/tx.pb.go @@ -35,7 +35,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // // Since: cosmos-sdk 0.47 type MsgUpdateParams struct { - // authority is the address that controls the module (defaults to x/gov unless overwritten). + // authority is the address that controls the module (defaults to x/gov unless + // overwritten). Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` // params defines the x/mint parameters to update. // @@ -138,30 +139,29 @@ func init() { func init() { proto.RegisterFile("sgenetwork/sge/mint/tx.proto", fileDescriptor_e427455b4e24bcf3) } var fileDescriptor_e427455b4e24bcf3 = []byte{ - // 353 bytes of a gzipped FileDescriptorProto + // 347 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 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x61, 0x09, 0x12, 0x3d, 0x88, 0x25, 0x4e, 0x9c, 0x27, 0xee, 0xc9, 0x33, 0xac, 0x78, - 0xbe, 0x41, 0x8b, 0x31, 0x08, 0xaa, 0xcb, 0x4a, 0xb7, 0xe9, 0xf9, 0x06, 0x2d, 0x84, 0x79, 0x5d, - 0xcf, 0x37, 0x68, 0x49, 0x81, 0x5c, 0x5d, 0x01, 0x71, 0x37, 0x9a, 0x33, 0x95, 0x24, 0xb9, 0xc4, - 0xd1, 0x84, 0x82, 0x52, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, 0x8d, 0x0a, 0xb8, 0x98, 0x7d, 0x8b, - 0xd3, 0x85, 0x92, 0xb8, 0x78, 0x50, 0x3c, 0xa6, 0x82, 0xd5, 0x41, 0x68, 0x86, 0x48, 0xe9, 0x10, - 0xa3, 0x0a, 0x66, 0x95, 0x14, 0x6b, 0x03, 0xc8, 0x0f, 0x4e, 0x8e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, - 0x78, 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, - 0xdc, 0x78, 0x2c, 0xc7, 0x10, 0xa5, 0x9e, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, - 0x0b, 0x8a, 0x03, 0x5d, 0xe4, 0xf8, 0x80, 0xfa, 0xac, 0xa4, 0xb2, 0x20, 0xb5, 0x38, 0x89, 0x0d, - 0x1c, 0x23, 0xc6, 0x80, 0x00, 0x00, 0x00, 0xff, 0xff, 0x34, 0x84, 0xdc, 0x2c, 0x67, 0x02, 0x00, - 0x00, + 0x3c, 0x44, 0x02, 0xc2, 0x81, 0x4a, 0x29, 0x60, 0x73, 0x4f, 0x41, 0x62, 0x51, 0x62, 0x2e, 0x54, + 0x85, 0xd2, 0x0e, 0x46, 0x2e, 0x7e, 0xdf, 0xe2, 0xf4, 0xd0, 0x82, 0x94, 0xc4, 0x92, 0xd4, 0x00, + 0xb0, 0x8c, 0x90, 0x19, 0x17, 0x67, 0x62, 0x69, 0x49, 0x46, 0x7e, 0x51, 0x66, 0x49, 0xa5, 0x04, + 0xa3, 0x02, 0xa3, 0x06, 0xa7, 0x93, 0xc4, 0xa5, 0x2d, 0xba, 0x22, 0x50, 0xa3, 0x1d, 0x53, 0x52, + 0x8a, 0x52, 0x8b, 0x8b, 0x83, 0x4b, 0x8a, 0x32, 0xf3, 0xd2, 0x83, 0x10, 0x4a, 0x85, 0xec, 0xb8, + 0xd8, 0x20, 0x66, 0x4b, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, 0x49, 0xeb, 0x61, 0xf1, 0xb0, 0x1e, + 0xc4, 0x12, 0x27, 0xce, 0x13, 0xf7, 0xe4, 0x19, 0x56, 0x3c, 0xdf, 0xa0, 0xc5, 0x18, 0x04, 0xd5, + 0x65, 0xa5, 0xdb, 0xf4, 0x7c, 0x83, 0x16, 0xc2, 0xbc, 0xae, 0xe7, 0x1b, 0xb4, 0xa4, 0x40, 0xae, + 0xae, 0x80, 0xb8, 0x1b, 0xcd, 0x99, 0x4a, 0x92, 0x5c, 0xe2, 0x68, 0x42, 0x41, 0xa9, 0xc5, 0x05, + 0xf9, 0x79, 0xc5, 0xa9, 0x46, 0x05, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x49, 0x5c, 0x3c, 0x28, + 0x1e, 0x53, 0xc1, 0xea, 0x20, 0x34, 0x43, 0xa4, 0x74, 0x88, 0x51, 0x05, 0xb3, 0x4a, 0x8a, 0xb5, + 0x01, 0xe4, 0x07, 0x27, 0xc7, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, + 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x52, + 0x4f, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0x05, 0xc5, 0x81, 0x2e, 0x72, 0x7c, + 0x40, 0x7d, 0x56, 0x52, 0x59, 0x90, 0x5a, 0x9c, 0xc4, 0x06, 0x8e, 0x11, 0x63, 0x40, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xfa, 0xbf, 0x3b, 0x92, 0x45, 0x02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/x/orderbook/module_simulation.go b/x/orderbook/module_simulation.go index 46bca3102..a1e8a07bc 100644 --- a/x/orderbook/module_simulation.go +++ b/x/orderbook/module_simulation.go @@ -36,7 +36,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil } diff --git a/x/ovm/module_simulation.go b/x/ovm/module_simulation.go index cbbe56632..bade40956 100644 --- a/x/ovm/module_simulation.go +++ b/x/ovm/module_simulation.go @@ -37,7 +37,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents doesn't return any content functions for governance proposals -func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { +func (AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalMsg { return nil }