Skip to content

Commit

Permalink
lint: fix workflows and sim_test
Browse files Browse the repository at this point in the history
  • Loading branch information
scorpioborn committed Oct 20, 2023
1 parent 0710ba0 commit dc9d044
Show file tree
Hide file tree
Showing 13 changed files with 72 additions and 57 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/gosec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:
uses: actions/setup-go@v3
with:
path: /usr/local/go/bin
go-version: '1.18.10'
go-version: '1.20'
- name: Checkout Source
uses: actions/checkout@v2
- name: Set env vars
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,12 @@ 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
run: |
export GO111MODULE="on" && go install github.com/mfridman/tparse@v0.11.1
export GO111MODULE="on" && go install github.com/mfridman/tparse@v0.13.1
- uses: actions/cache@v2.1.6
with:
path: ~/go/bin
Expand All @@ -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:
Expand All @@ -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
Expand Down Expand Up @@ -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: |
Expand Down Expand Up @@ -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: |
Expand Down
50 changes: 32 additions & 18 deletions app/sim_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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())
}
Expand All @@ -45,7 +51,7 @@ func BenchmarkFullAppSimulation(b *testing.B) {
}
}()

app := app.NewSgeApp(
sApp := app.NewSgeApp(
logger,
db,
nil,
Expand All @@ -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)
}

Expand All @@ -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
Expand All @@ -119,7 +129,7 @@ func TestAppStateDeterminism(t *testing.T) {
}

db := dbm.NewMemDB()
app := app.NewSgeApp(
sApp := app.NewSgeApp(
logger,
db,
nil,
Expand All @@ -140,21 +150,25 @@ 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)

if config.Commit {
simtestutil.PrintStats(db)
}

appHash := app.LastCommitID().Hash
appHash := sApp.LastCommitID().Hash
appHashList[j] = appHash

if j != 0 {
Expand Down
2 changes: 1 addition & 1 deletion proto/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 \
Expand Down
11 changes: 6 additions & 5 deletions proto/sgenetwork/sge/mint/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion x/bet/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion x/house/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion x/market/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion x/mint/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
38 changes: 19 additions & 19 deletions x/mint/types/tx.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion x/orderbook/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion x/ovm/module_simulation.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit dc9d044

Please sign in to comment.