From a9c57276a2420e97dd153e5b0f7abe158c83132d Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 17:38:33 +0000 Subject: [PATCH 01/61] feat: enforce 150 max lines and import order via in golangci-lint yml file --- .golangci.yml | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 3dc12bb05..b1ef9f745 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,11 +7,29 @@ linters-settings: linters: disable-all: true enable: -# - govet -# - revive -# - errcheck -# - unused + # - govet + # - revive + # - errcheck + # - unused + - gofumpt - goimports + - lll + - gci + +linters-settings: + lll: + line-length: 150 + tab-width: 4 + gci: + sections: + - standard # std lib + - default # external + - prefix(github.com/pokt-network/poktroll) # local imports + - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled. + - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled. + - alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled. + skip-generated: true + custom-order: true issues: exclude-use-default: true @@ -27,26 +45,41 @@ issues: # empty import block containing a comment used by ignite CLI. - path: ^x/.+/genesis\.go$ linters: + - gci + - lll + - gofumpt - goimports # Exclude cosmos-sdk module module.go files as they are generated with unused # parameters and unchecked errors. - path: ^x/.+/module\.go$ linters: + - gci + - lll + - gofumpt - revive - errcheck # Exclude cosmos-sdk module tx.go files as they are generated with unused # constants. - path: ^x/.+/cli/tx\.go$ linters: + - gci + - lll + - gofumpt - unused # Exclude simulation code as it's generated with lots of unused parameters. - path: .*/simulation/.*|_simulation\.go$ linters: + - gci + - lll + - gofumpt - revive # Exclude cosmos-sdk module codec files as they are scaffolded with a unused - # paramerters and a comment used by ignite CLI. + # parameters and a comment used by ignite CLI. - path: ^x/.+/codec.go$ linters: + - gci + - lll + - gofumpt - revive - path: _test\.go$ linters: From 9b4e1c5cb7802f1fdf1c83644e5f77067b0b1992 Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 17:42:50 +0000 Subject: [PATCH 02/61] feat: add the Linter workflow file --- .github/workflows/golangci-lint.yml | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 .github/workflows/golangci-lint.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml new file mode 100644 index 000000000..a4ce39e93 --- /dev/null +++ b/.github/workflows/golangci-lint.yml @@ -0,0 +1,27 @@ +name: Linter + +on: + push: + branches: ["main"] + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true + +jobs: + golangci: + name: lint + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: "0" # Per https://github.com/ignite/cli/issues/1674#issuecomment-1144619147 + - uses: actions/setup-go@v4 + with: + go-version: "1.20.10" + cache: false + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54 From c4b82d2db3ad8fd3f8ce4a99439e60ad3c9a6380 Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 17:48:24 +0000 Subject: [PATCH 03/61] feat: exclude errors.go file for line length check --- .golangci.yml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index b1ef9f745..9452981b7 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -18,16 +18,13 @@ linters: linters-settings: lll: - line-length: 150 + line-length: 120 tab-width: 4 gci: sections: - standard # std lib - default # external - prefix(github.com/pokt-network/poktroll) # local imports - - blank # Blank section: contains all blank imports. This section is not present unless explicitly enabled. - - dot # Dot section: contains all dot imports. This section is not present unless explicitly enabled. - - alias # Alias section: contains all alias imports. This section is not present unless explicitly enabled. skip-generated: true custom-order: true @@ -84,6 +81,11 @@ issues: - path: _test\.go$ linters: - errcheck + # Exclude line length check for errors.go files as they are easier to read + # as as single line. + - path: ^.*/errors\.go$ + links: + - lll # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration #new: true, #fix: true, From 26f359896d78ab29d8ada81c4f2923b90a36f0fd Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 17:51:42 +0000 Subject: [PATCH 04/61] chore: fix linter-settings duplication --- .golangci.yml | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 9452981b7..998ef44f5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,7 +1,3 @@ -linters-settings: - govet: - check-shadowing: true - # TODO_TECHDEBT: Enable each linter listed, 1 by 1, fixing issues as they appear. # Don't forget to delete the `disable-all: true` line as well. linters: @@ -17,6 +13,8 @@ linters: - gci linters-settings: + govet: + check-shadowing: true lll: line-length: 120 tab-width: 4 @@ -85,7 +83,7 @@ issues: # as as single line. - path: ^.*/errors\.go$ links: - - lll + - lll # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration #new: true, #fix: true, From cd50b4725fb1917ffd8a19895fb5b9a454d9a4cf Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 17:54:11 +0000 Subject: [PATCH 05/61] chore: fix errors.go exclude linter --- .golangci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 998ef44f5..671485817 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -81,8 +81,8 @@ issues: - errcheck # Exclude line length check for errors.go files as they are easier to read # as as single line. - - path: ^.*/errors\.go$ - links: + - path: errors\.go$ + linters: - lll # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration #new: true, From c209ac5173786c647aefbfde198cdb2dea04868c Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 17:57:00 +0000 Subject: [PATCH 06/61] chore: increase linter workflow timeout --- .github/workflows/golangci-lint.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index a4ce39e93..812f8db83 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -25,3 +25,4 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.54 + args: --timeout=15m From fb7d589c1c4e85550e0f54f648ef8cb11ddeaee3 Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 18:13:28 +0000 Subject: [PATCH 07/61] chore: remove linter workflow and move into test workflow --- .github/workflows/golangci-lint.yml | 28 ---------------------------- .github/workflows/run-tests.yml | 5 ++++- 2 files changed, 4 insertions(+), 29 deletions(-) delete mode 100644 .github/workflows/golangci-lint.yml diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml deleted file mode 100644 index 812f8db83..000000000 --- a/.github/workflows/golangci-lint.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Linter - -on: - push: - branches: ["main"] - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} - cancel-in-progress: true - -jobs: - golangci: - name: lint - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - with: - fetch-depth: "0" # Per https://github.com/ignite/cli/issues/1674#issuecomment-1144619147 - - uses: actions/setup-go@v4 - with: - go-version: "1.20.10" - cache: false - - name: golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54 - args: --timeout=15m diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b843265b6..935166450 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -45,7 +45,10 @@ jobs: run: make go_mockgen - name: Run golangci-lint - run: make go_lint + uses: golangci/golangci-lint-action@v3 + with: + version: v1.54 + args: --timeout=15m - name: Test run: make go_test From 5830bf315fa1bfb1f7d08976353e4bdc8a8a6cf5 Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 19:01:16 +0000 Subject: [PATCH 08/61] feat: only apply linting checks to new files --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 671485817..0ce56eec6 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -85,5 +85,5 @@ issues: linters: - lll # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration - #new: true, + new: true, #fix: true, From 38dca85dbe38f442e86f145a7b4f35913cb6137d Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 20:27:12 +0000 Subject: [PATCH 09/61] chore: fix golangci_lint errors (part 1) --- .github/workflows/run-tests.yml | 2 +- .golangci.yml | 5 +- Makefile | 3 - app/app.go | 83 ++++++++---- cmd/pocketd/cmd/root.go | 4 - go.mod | 4 +- pkg/appgateserver/cmd/cmd.go | 36 +++++- pkg/client/events/replay_client.go | 8 +- pkg/observable/channel/map.go | 11 +- pkg/observable/channel/observable_test.go | 4 +- pkg/observable/channel/replay_test.go | 5 +- pkg/polylog/polyzero/logger_test.go | 13 +- pkg/relayer/cmd/cmd.go | 35 ++++- pkg/relayer/protocol/block_heights.go | 7 +- pkg/relayer/proxy/proxy_test.go | 1 - pkg/relayer/proxy/relay_verifier.go | 2 +- pkg/retry/retry_test.go | 20 ++- testutil/application/mocks/mocks.go | 14 +- testutil/gateway/mocks/mocks.go | 14 +- testutil/mockclient/mocks.go | 14 +- testutil/mockcrypto/mock.go | 14 +- testutil/mockrelayer/mocks.go | 14 +- testutil/session/mocks/mocks.go | 13 +- testutil/supplier/mocks/mocks.go | 14 +- testutil/yaml/yaml.go | 14 +- tools/scripts/goimports/filters/filters.go | 103 --------------- tools/scripts/goimports/main.go | 120 ------------------ x/application/client/cli/query.go | 6 +- .../client/cli/tx_undelegate_from_gateway.go | 4 +- .../client/cli/tx_unstake_application.go | 1 - .../config/application_configs_reader.go | 3 +- x/application/keeper/application.go | 2 - x/application/keeper/application_test.go | 1 + x/application/keeper/query_application.go | 1 - .../types/message_delegate_to_gateway_test.go | 4 +- .../types/message_stake_application.go | 1 - .../types/message_stake_application_test.go | 15 ++- .../message_undelegate_from_gateway_test.go | 4 +- x/gateway/client/cli/query.go | 6 +- x/gateway/keeper/gateway.go | 2 - x/gateway/keeper/gateway_test.go | 8 +- x/gateway/keeper/msg_server_stake_gateway.go | 37 ++++-- .../keeper/msg_server_unstake_gateway.go | 11 +- x/gateway/keeper/query_gateway.go | 13 +- x/gateway/types/expected_keepers.go | 14 +- x/gateway/types/genesis_test.go | 6 +- x/pocket/client/cli/query.go | 6 +- x/pocket/keeper/keeper.go | 1 - x/service/client/cli/query.go | 6 +- x/service/client/cli/tx_add_service.go | 4 +- x/service/keeper/msg_server_add_service.go | 1 + x/service/keeper/msg_server_test.go | 3 +- x/service/types/message_add_service_test.go | 3 +- x/session/client/cli/helpers_test.go | 3 +- x/session/client/cli/query.go | 6 +- x/session/client/cli/query_get_session.go | 7 +- x/session/keeper/keeper.go | 1 - x/session/keeper/query_get_session.go | 6 +- x/session/keeper/session_hydrator.go | 104 ++++++++++----- x/shared/helpers/service.go | 1 - x/supplier/client/cli/query_claim_test.go | 2 +- x/supplier/client/cli/tx_unstake_supplier.go | 1 - .../client/config/supplier_configs_reader.go | 3 +- .../config/supplier_configs_reader_test.go | 19 ++- x/supplier/keeper/claim_test.go | 1 + .../keeper/msg_server_stake_supplier.go | 1 - x/supplier/keeper/proof.go | 2 - x/supplier/keeper/proof_test.go | 1 + x/supplier/keeper/query_claim.go | 14 +- x/supplier/keeper/query_claim_test.go | 2 +- x/supplier/keeper/query_proof.go | 1 - x/supplier/keeper/supplier_test.go | 1 + x/supplier/types/genesis_test.go | 4 +- .../types/message_stake_supplier_test.go | 19 ++- x/tokenomics/client/cli/query.go | 6 +- x/tokenomics/genesis_test.go | 3 +- x/tokenomics/keeper/keeper.go | 1 - x/tokenomics/keeper/msg_server_test.go | 3 +- x/tokenomics/keeper/params_test.go | 3 +- x/tokenomics/keeper/query_params_test.go | 3 +- x/tokenomics/types/genesis_test.go | 3 +- x/tokenomics/types/params.go | 6 +- 82 files changed, 490 insertions(+), 477 deletions(-) delete mode 100644 tools/scripts/goimports/filters/filters.go delete mode 100644 tools/scripts/goimports/main.go diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 935166450..02cf205eb 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -48,7 +48,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: v1.54 - args: --timeout=15m + args: --timeout=15m --build-tags test - name: Test run: make go_test diff --git a/.golangci.yml b/.golangci.yml index 0ce56eec6..bf383a3c5 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -84,6 +84,9 @@ issues: - path: errors\.go$ linters: - lll + - path: ./app/app.go + linters: + - gci # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration - new: true, + #new: true, #fix: true, diff --git a/Makefile b/Makefile index 025c397e1..c6509c315 100644 --- a/Makefile +++ b/Makefile @@ -152,9 +152,6 @@ localnet_regenesis: ## Regenerate the localnet genesis file go_lint: ## Run all go linters golangci-lint run --timeout 5m --build-tags test -go_imports: check_go_version ## Run goimports on all go files - go run ./tools/scripts/goimports - ############# ### Tests ### ############# diff --git a/app/app.go b/app/app.go index 352038462..e785adddf 100644 --- a/app/app.go +++ b/app/app.go @@ -7,8 +7,6 @@ import ( "os" "path/filepath" - // this line is used by starport scaffolding # stargate/app/moduleImport - autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" dbm "github.com/cometbft/cometbft-db" @@ -255,19 +253,20 @@ type App struct { memKeys map[string]*storetypes.MemoryStoreKey // keepers - AccountKeeper authkeeper.AccountKeeper - AuthzKeeper authzkeeper.Keeper - BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper - StakingKeeper *stakingkeeper.Keeper - SlashingKeeper slashingkeeper.Keeper - MintKeeper mintkeeper.Keeper - DistrKeeper distrkeeper.Keeper - GovKeeper govkeeper.Keeper - CrisisKeeper *crisiskeeper.Keeper - UpgradeKeeper *upgradekeeper.Keeper - ParamsKeeper paramskeeper.Keeper - IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + AccountKeeper authkeeper.AccountKeeper + AuthzKeeper authzkeeper.Keeper + BankKeeper bankkeeper.Keeper + CapabilityKeeper *capabilitykeeper.Keeper + StakingKeeper *stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper govkeeper.Keeper + CrisisKeeper *crisiskeeper.Keeper + UpgradeKeeper *upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly + IBCKeeper *ibckeeper.Keeper EvidenceKeeper evidencekeeper.Keeper TransferKeeper ibctransferkeeper.Keeper ICAHostKeeper icahostkeeper.Keeper @@ -367,7 +366,11 @@ func New( ) // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[upgradetypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) + app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( + appCodec, + keys[upgradetypes.StoreKey], + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) bApp.SetParamStore(&app.ConsensusParamsKeeper) // add capability keeper and ScopeToModule for ibc module @@ -602,7 +605,9 @@ func New( app.AccountKeeper, app.GatewayKeeper, ) - applicationModule := applicationmodule.NewAppModule(appCodec, app.ApplicationKeeper, app.AccountKeeper, app.BankKeeper) + applicationModule := applicationmodule.NewAppModule( + appCodec, app.ApplicationKeeper, app.AccountKeeper, app.BankKeeper, + ) // TODO_TECHDEBT: Evaluate if this NB goes away after we upgrade to cosmos 0.5x // NB: there is a circular dependency between the supplier and session keepers. @@ -691,18 +696,33 @@ func New( app.BaseApp.DeliverTx, encodingConfig.TxConfig, ), - auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + auth.NewAppModule( + appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName), + ), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), - feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + feegrantmodule.NewAppModule( + appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry, + ), groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), + gov.NewAppModule( + appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName), + ), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), + slashing.NewAppModule( + appCodec, + app.SlashingKeeper, + app.AccountKeeper, + app.BankKeeper, + app.StakingKeeper, + app.GetSubspace(slashingtypes.ModuleName), + ), distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), - staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + staking.NewAppModule( + appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName), + ), upgrade.NewAppModule(app.UpgradeKeeper), evidence.NewAppModule(app.EvidenceKeeper), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), @@ -719,7 +739,11 @@ func New( tokenomicsModule, // this line is used by starport scaffolding # stargate/app/appModule - crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them + crisis.NewAppModule( + app.CrisisKeeper, + skipGenesisInvariants, + app.GetSubspace(crisistypes.ModuleName), + ), // always be last to make sure that it checks for all invariants and not only part of them ) // During begin block slashing happens after distr.BeginBlocker so that @@ -846,7 +870,12 @@ func New( // create the simulation manager and define the order of the modules for deterministic simulations overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + authtypes.ModuleName: auth.NewAppModule( + app.appCodec, + app.AccountKeeper, + authsims.RandomGenesisAccounts, + app.GetSubspace(authtypes.ModuleName), + ), } app.sm = module.NewSimulationManagerFromAppModules(app.mm.Modules, overrideModules) app.sm.RegisterStoreDecoders() @@ -1034,7 +1063,11 @@ func (app *App) RegisterNodeService(clientCtx client.Context) { } // initParamsKeeper init params keeper and its subspaces -func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { +func initParamsKeeper( + appCodec codec.BinaryCodec, + legacyAmino *codec.LegacyAmino, + key, tkey storetypes.StoreKey, +) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) paramsKeeper.Subspace(authtypes.ModuleName) diff --git a/cmd/pocketd/cmd/root.go b/cmd/pocketd/cmd/root.go index 55b7071fc..6708ea486 100644 --- a/cmd/pocketd/cmd/root.go +++ b/cmd/pocketd/cmd/root.go @@ -7,8 +7,6 @@ import ( "path/filepath" "strings" - // this line is used by starport scaffolding # root/moduleImport - dbm "github.com/cometbft/cometbft-db" tmcfg "github.com/cometbft/cometbft/config" tmcli "github.com/cometbft/cometbft/libs/cli" @@ -39,8 +37,6 @@ import ( "github.com/spf13/cobra" "github.com/spf13/pflag" - // this line is used by starport scaffolding # root/moduleImport - "github.com/pokt-network/poktroll/app" appparams "github.com/pokt-network/poktroll/app/params" appgateservercmd "github.com/pokt-network/poktroll/pkg/appgateserver/cmd" diff --git a/go.mod b/go.mod index 56ed2d4fc..9be97f1d6 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,6 @@ require ( github.com/athanorlabs/go-dleq v0.1.0 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/v7 v7.1.0 @@ -48,7 +47,6 @@ require ( golang.org/x/crypto v0.15.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 golang.org/x/sync v0.5.0 - google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb google.golang.org/grpc v1.59.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -92,6 +90,7 @@ require ( github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.0 // indirect @@ -286,6 +285,7 @@ require ( google.golang.org/api v0.143.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/pkg/appgateserver/cmd/cmd.go b/pkg/appgateserver/cmd/cmd.go index 9488f82dd..1f8bae022 100644 --- a/pkg/appgateserver/cmd/cmd.go +++ b/pkg/appgateserver/cmd/cmd.go @@ -71,10 +71,38 @@ provided that: // Cosmos flags // TODO_TECHDEBT(#256): Remove unneeded cosmos flags. - cmd.Flags().String(cosmosflags.FlagKeyringBackend, "", "Select keyring's backend (os|file|kwallet|pass|test)") - cmd.Flags().StringVar(&flagNodeRPCURL, cosmosflags.FlagNode, omittedDefaultFlagValue, "Register the default Cosmos node flag, which is needed to initialize the Cosmos query context correctly. It can be used to override the `QueryNodeUrl` field in the config file if specified.") - cmd.Flags().StringVar(&flagNodeGRPCURL, cosmosflags.FlagGRPC, omittedDefaultFlagValue, "Register the default Cosmos node grpc flag, which is needed to initialize the Cosmos query context with grpc correctly. It can be used to override the `QueryNodeGRPCUrl` field in the config file if specified.") - cmd.Flags().Bool(cosmosflags.FlagGRPCInsecure, true, "Used to initialize the Cosmos query context with grpc security options. It can be used to override the `QueryNodeGRPCInsecure` field in the config file if specified.") + cmd.Flags(). + String( + cosmosflags.FlagKeyringBackend, + "", + "Select keyring's backend (os|file|kwallet|pass|test)", + ) + cmd.Flags(). + StringVar( + &flagNodeRPCURL, + cosmosflags.FlagNode, + omittedDefaultFlagValue, + "Register the default Cosmos node flag, which is needed to initialize"+ + "the Cosmos query context correctly. It can be used to override the "+ + "`QueryNodeUrl` field in the config file if specified.", + ) + cmd.Flags(). + StringVar( + &flagNodeGRPCURL, + cosmosflags.FlagGRPC, + omittedDefaultFlagValue, + "Register the default Cosmos node grpc flag, which is needed to initialize "+ + "the Cosmos query context with grpc correctly. It can be used to override "+ + "the `QueryNodeGRPCUrl` field in the config file if specified.", + ) + cmd.Flags(). + Bool( + cosmosflags.FlagGRPCInsecure, + true, + "Used to initialize the Cosmos query context with grpc security options. "+ + "It can be used to override the `QueryNodeGRPCInsecure` field in the "+ + "config file if specified.", + ) return cmd } diff --git a/pkg/client/events/replay_client.go b/pkg/client/events/replay_client.go index 1836dd3ca..07f1b4116 100644 --- a/pkg/client/events/replay_client.go +++ b/pkg/client/events/replay_client.go @@ -205,7 +205,13 @@ func (rClient *replayClient[T, R]) goPublishEvents(ctx context.Context) { // Since this function runs in a goroutine, we can't return the error to the // caller. Instead, we panic. if publishError != nil { - panic(fmt.Errorf("EventsReplayClient[%T].goPublishEvents should never reach this spot: %w", *new(T), publishError)) + panic( + fmt.Errorf( + "EventsReplayClient[%T].goPublishEvents should never reach this spot: %w", + *new(T), + publishError, + ), + ) } } diff --git a/pkg/observable/channel/map.go b/pkg/observable/channel/map.go index d6053aefa..630f557b9 100644 --- a/pkg/observable/channel/map.go +++ b/pkg/observable/channel/map.go @@ -6,8 +6,14 @@ import ( "github.com/pokt-network/poktroll/pkg/observable" ) -type MapFn[S, D any] func(ctx context.Context, src S) (dst D, skip bool) -type ForEachFn[V any] func(ctx context.Context, src V) +type ( + // MapFn defines a function alias to be used as the transformation fn in Map, + // MapExpand and MapReplay. + MapFn[S, D any] func(ctx context.Context, src S) (dst D, skip bool) + // ForEachFn defines a function alias to be used as the function applied to + // each notification in ForEach. + ForEachFn[V any] func(ctx context.Context, src V) +) // Map transforms the given observable by applying the given transformFn to each // notification received from the observable. If the transformFn returns a skip @@ -121,7 +127,6 @@ func goMapTransformNotification[S, D any]( publishFn(dstNotifications) } - } // zeroValue is a generic helper which returns the zero value of the given type. diff --git a/pkg/observable/channel/observable_test.go b/pkg/observable/channel/observable_test.go index b278546fc..661454510 100644 --- a/pkg/observable/channel/observable_test.go +++ b/pkg/observable/channel/observable_test.go @@ -33,8 +33,8 @@ func TestChannelObservable_NotifyObservers(t *testing.T) { inputs := []int{123, 456, 789} // NB: see TODO_INCOMPLETE comment below - //fullBlockingPublisher := make(chan *int) - //fullBufferedPublisher := make(chan *int, 1) + // fullBlockingPublisher := make(chan *int) + // fullBufferedPublisher := make(chan *int, 1) tests := []test{ { diff --git a/pkg/observable/channel/replay_test.go b/pkg/observable/channel/replay_test.go index 6e01f123e..b95a50d60 100644 --- a/pkg/observable/channel/replay_test.go +++ b/pkg/observable/channel/replay_test.go @@ -129,10 +129,9 @@ func TestReplayObservable_Last_Full_ReplayBuffer(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - var ctx = context.Background() + ctx := context.Background() - replayObsvbl, publishCh := - channel.NewReplayObservable[int](ctx, tt.replayBufferSize) + replayObsvbl, publishCh := channel.NewReplayObservable[int](ctx, tt.replayBufferSize) for _, value := range values { publishCh <- value diff --git a/pkg/polylog/polyzero/logger_test.go b/pkg/polylog/polyzero/logger_test.go index c55668d41..3f32493ac 100644 --- a/pkg/polylog/polyzero/logger_test.go +++ b/pkg/polylog/polyzero/logger_test.go @@ -34,11 +34,14 @@ var ( // for the output expectation. expectedTimestampDayPrecisionLayout = "2006-01-02T" expectedTimeLayout = "2006-01-02T15:04:05-07:00" - expectedTimestampEventContains = fmt.Sprintf(`"time":"%s`, expectedTime.Format(expectedTimestampDayPrecisionLayout)) - expectedTimeEventContains = fmt.Sprintf(`"Time":"%s`, expectedTime.Format(expectedTimeLayout)) - expectedDuration = time.Millisecond + (250 * time.Nanosecond) // 1000250 - expectedDurationString = expectedDuration.String()[:len(expectedDuration.String())-2] // 1.00025 - expectedDurationEventContains = fmt.Sprintf(`"Dur":%s`, expectedDurationString) + expectedTimestampEventContains = fmt.Sprintf( + `"time":"%s`, + expectedTime.Format(expectedTimestampDayPrecisionLayout), + ) + expectedTimeEventContains = fmt.Sprintf(`"Time":"%s`, expectedTime.Format(expectedTimeLayout)) + expectedDuration = time.Millisecond + (250 * time.Nanosecond) // 1000250 + expectedDurationString = expectedDuration.String()[:len(expectedDuration.String())-2] // 1.00025 + expectedDurationEventContains = fmt.Sprintf(`"Dur":%s`, expectedDurationString) ) func TestZerologLogger_AllLevels_AllEventTypeMethods(t *testing.T) { diff --git a/pkg/relayer/cmd/cmd.go b/pkg/relayer/cmd/cmd.go index 3e80bbfa3..6b179ecc6 100644 --- a/pkg/relayer/cmd/cmd.go +++ b/pkg/relayer/cmd/cmd.go @@ -69,10 +69,37 @@ for such operations.`, // Cosmos flags // TODO_TECHDEBT(#256): Remove unneeded cosmos flags. - cmd.Flags().String(cosmosflags.FlagKeyringBackend, "", "Select keyring's backend (os|file|kwallet|pass|test)") - cmd.Flags().StringVar(&flagNodeRPCURL, cosmosflags.FlagNode, omittedDefaultFlagValue, "Register the default Cosmos node flag, which is needed to initialize the Cosmos query and tx contexts correctly. It can be used to override the `QueryNodeRPCURL` and `TxNodeRPCURL` fields in the config file if specified.") - cmd.Flags().StringVar(&flagNodeGRPCURL, cosmosflags.FlagGRPC, omittedDefaultFlagValue, "Register the default Cosmos node grpc flag, which is needed to initialize the Cosmos query context with grpc correctly. It can be used to override the `QueryNodeGRPCURL` field in the config file if specified.") - cmd.Flags().Bool(cosmosflags.FlagGRPCInsecure, true, "Used to initialize the Cosmos query context with grpc security options. It can be used to override the `QueryNodeGRPCInsecure` field in the config file if specified.") + cmd.Flags(). + String( + cosmosflags.FlagKeyringBackend, + "", + "Select keyring's backend (os|file|kwallet|pass|test)", + ) + cmd.Flags(). + StringVar( + &flagNodeRPCURL, + cosmosflags.FlagNode, + omittedDefaultFlagValue, + "Register the default Cosmos node flag, which is needed to initialize the "+ + "Cosmos query and tx contexts correctly. It can be used to override the "+ + "`QueryNodeRPCURL` and `TxNodeRPCURL` fields in the config file if specified.", + ) + cmd.Flags().StringVar( + &flagNodeGRPCURL, + cosmosflags.FlagGRPC, + omittedDefaultFlagValue, + "Register the default Cosmos node grpc flag, which is needed to initialize the"+ + "Cosmos query context with grpc correctly. It can be used to override the "+ + "`QueryNodeGRPCURL` field in the config file if specified.", + ) + cmd.Flags(). + Bool( + cosmosflags.FlagGRPCInsecure, + true, + "Used to initialize the Cosmos query context with grpc security options."+ + "It can be used to override the `QueryNodeGRPCInsecure` field in the "+ + "config file if specified.", + ) return cmd } diff --git a/pkg/relayer/protocol/block_heights.go b/pkg/relayer/protocol/block_heights.go index bb0676737..88b3bd1fd 100644 --- a/pkg/relayer/protocol/block_heights.go +++ b/pkg/relayer/protocol/block_heights.go @@ -32,7 +32,9 @@ func GetEarliestCreateClaimHeight(ctx context.Context, createClaimWindowStartBlo randomNumber := rand.NewSource(rngSeed).Int63() // TODO_TECHDEBT: query the on-chain governance parameter once available. - // randCreateClaimHeightOffset := randomNumber % (claimproofparams.GovCreateClaimIntervalBlocks - claimproofparams.GovCreateClaimWindowBlocks - 1) + // randCreateClaimHeightOffset := randomNumber % + // (claimproofparams.GovCreateClaimIntervalBlocks - + // claimproofparams.GovCreateClaimWindowBlocks - 1) _ = randomNumber randCreateClaimHeightOffset := int64(0) @@ -60,7 +62,8 @@ func GetEarliestSubmitProofHeight(ctx context.Context, submitProofWindowStartBlo randomNumber := rand.NewSource(rngSeed).Int63() // TODO_TECHDEBT: query the on-chain governance parameter once available. - // randSubmitProofHeightOffset := randomNumber % (claimproofparams.GovSubmitProofIntervalBlocks - claimproofparams.GovSubmitProofWindowBlocks - 1) + // randSubmitProofHeightOffset := randomNumber % + // (claimproofparams.GovSubmitProofIntervalBlocks - claimproofparams.GovSubmitProofWindowBlocks - 1) _ = randomNumber randSubmitProofHeightOffset := int64(0) diff --git a/pkg/relayer/proxy/proxy_test.go b/pkg/relayer/proxy/proxy_test.go index bb699be71..35f7e6b99 100644 --- a/pkg/relayer/proxy/proxy_test.go +++ b/pkg/relayer/proxy/proxy_test.go @@ -512,7 +512,6 @@ func sendRequestWithMissingMeta( t *testing.T, test *testproxy.TestBehavior, ) (errorCode int32, errorMessage string) { - req := &servicetypes.RelayRequest{ // RelayRequest is missing Metadata Payload: testproxy.PrepareJsonRPCRequestPayload(), diff --git a/pkg/relayer/proxy/relay_verifier.go b/pkg/relayer/proxy/relay_verifier.go index f33c59454..72f4e83bc 100644 --- a/pkg/relayer/proxy/relay_verifier.go +++ b/pkg/relayer/proxy/relay_verifier.go @@ -6,6 +6,7 @@ import ( sdkerrors "cosmossdk.io/errors" ring_secp256k1 "github.com/athanorlabs/go-dleq/secp256k1" ring "github.com/noot/ring-go" + "github.com/pokt-network/poktroll/x/service/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) @@ -99,7 +100,6 @@ func (rp *relayerProxy) VerifyRelayRequest( // https://github.com/pokt-network/poktroll/issues/275#issuecomment-1863519333 currentBlock := rp.blockClient.LastNBlocks(ctx, 1)[0] session, err := rp.sessionQuerier.GetSession(ctx, appAddress, service.Id, currentBlock.Height()) - if err != nil { return err } diff --git a/pkg/retry/retry_test.go b/pkg/retry/retry_test.go index d328bda73..cd68f3157 100644 --- a/pkg/retry/retry_test.go +++ b/pkg/retry/retry_test.go @@ -88,7 +88,12 @@ func TestOnError(t *testing.T) { time.Sleep(totalExpectedDelay + 100*time.Millisecond) // Verify that the test function was called the expected number of times. - require.Equal(t, expectedRetryLimit, int(testFnCallCount), "Test function was not called the expected number of times") + require.Equal( + t, + expectedRetryLimit, + int(testFnCallCount), + "Test function was not called the expected number of times", + ) // Verify the delay between retries of the test function. var prevCallTime time.Time @@ -186,7 +191,7 @@ func TestOnError_ExitsWhenErrChCloses(t *testing.T) { require.Equal(t, expectedRetryLimit, int(testFnCallCount)) // Assert that the retry delay between function calls matches the expected delay - var prevCallTime = new(time.Time) + prevCallTime := new(time.Time) for i := 0; i < expectedRetryLimit; i++ { select { case nextCallTime := <-testFnCallTimeCh: @@ -213,10 +218,11 @@ func TestOnError_ExitsWhenErrChCloses(t *testing.T) { // Verify the logged error messages var ( - logOutputLines = strings.Split(strings.Trim(logOutput.String(), "\n"), "\n") - errorLines = logOutputLines[:len(logOutputLines)-1] - warnLine = logOutputLines[len(logOutputLines)-1] - expectedWarnMsg = "WARN: error channel for TestOnError_ExitsWhenErrChCloses closed, will no longer retry on error" + logOutputLines = strings.Split(strings.Trim(logOutput.String(), "\n"), "\n") + errorLines = logOutputLines[:len(logOutputLines)-1] + warnLine = logOutputLines[len(logOutputLines)-1] + expectedWarnMsg = "WARN: error channel for TestOnError_ExitsWhenErrChCloses " + + "closed, will no longer retry on error" expectedErrorMsg = "ERROR: retrying TestOnError_ExitsWhenErrChCloses after error: test error" ) @@ -294,7 +300,7 @@ func TestOnError_RetryCountResetTimeout(t *testing.T) { require.Equal(t, expectedRetryLimit, int(testFnCallCount)) // Assert that the retry delay between function calls matches the expected delay - var prevCallTime = new(time.Time) + prevCallTime := new(time.Time) for i := 0; i < expectedRetryLimit; i++ { select { case nextCallTime := <-testFnCallTimeCh: diff --git a/testutil/application/mocks/mocks.go b/testutil/application/mocks/mocks.go index 595954e65..3de9016c7 100644 --- a/testutil/application/mocks/mocks.go +++ b/testutil/application/mocks/mocks.go @@ -3,9 +3,13 @@ package mocks // This file is in place to declare the package for dynamically generated structs. // // Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// For example, they commit auto-generate code to main: +// https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: +// https://docs.cosmos.network/main/build/building-modules/testing#unit-tests // -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a +// circular dependency issue with protobuf and mock generation since we are +// leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before +// generating, requiring the entire dependency tree to be valid before mock +// implementations have been generated. diff --git a/testutil/gateway/mocks/mocks.go b/testutil/gateway/mocks/mocks.go index 595954e65..3de9016c7 100644 --- a/testutil/gateway/mocks/mocks.go +++ b/testutil/gateway/mocks/mocks.go @@ -3,9 +3,13 @@ package mocks // This file is in place to declare the package for dynamically generated structs. // // Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// For example, they commit auto-generate code to main: +// https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: +// https://docs.cosmos.network/main/build/building-modules/testing#unit-tests // -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a +// circular dependency issue with protobuf and mock generation since we are +// leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before +// generating, requiring the entire dependency tree to be valid before mock +// implementations have been generated. diff --git a/testutil/mockclient/mocks.go b/testutil/mockclient/mocks.go index d89152942..edd9b4ca8 100644 --- a/testutil/mockclient/mocks.go +++ b/testutil/mockclient/mocks.go @@ -3,9 +3,13 @@ package mockclient // This file is in place to declare the package for dynamically generated structs. // // Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// For example, they commit auto-generate code to main: +// https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: +// https://docs.cosmos.network/main/build/building-modules/testing#unit-tests // -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a +// circular dependency issue with protobuf and mock generation since we are +// leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before +// generating, requiring the entire dependency tree to be valid before mock +// implementations have been generated. diff --git a/testutil/mockcrypto/mock.go b/testutil/mockcrypto/mock.go index 277adca25..d81c0e6c4 100644 --- a/testutil/mockcrypto/mock.go +++ b/testutil/mockcrypto/mock.go @@ -3,9 +3,13 @@ package mockcrypto // This file is in place to declare the package for dynamically generated structs. // // Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// For example, they commit auto-generate code to main: +// https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: +// https://docs.cosmos.network/main/build/building-modules/testing#unit-tests // -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a +// circular dependency issue with protobuf and mock generation since we are +// leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before +// generating, requiring the entire dependency tree to be valid before mock +// implementations have been generated. diff --git a/testutil/mockrelayer/mocks.go b/testutil/mockrelayer/mocks.go index 0abe65d56..43fa4e724 100644 --- a/testutil/mockrelayer/mocks.go +++ b/testutil/mockrelayer/mocks.go @@ -3,9 +3,13 @@ package mockrelayer // This file is in place to declare the package for dynamically generated structs. // // Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// For example, they commit auto-generate code to main: +// https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: +// https://docs.cosmos.network/main/build/building-modules/testing#unit-tests // -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a +// circular dependency issue with protobuf and mock generation since we are +// leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before +// generating, requiring the entire dependency tree to be valid before mock +// implementations have been generated. diff --git a/testutil/session/mocks/mocks.go b/testutil/session/mocks/mocks.go index 423f63d3e..3de9016c7 100644 --- a/testutil/session/mocks/mocks.go +++ b/testutil/session/mocks/mocks.go @@ -3,8 +3,13 @@ package mocks // This file is in place to declare the package for dynamically generated structs. // // Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// For example, they commit auto-generate code to main: +// https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: +// https://docs.cosmos.network/main/build/building-modules/testing#unit-tests // -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which requires `.go` files to compile. +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a +// circular dependency issue with protobuf and mock generation since we are +// leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before +// generating, requiring the entire dependency tree to be valid before mock +// implementations have been generated. diff --git a/testutil/supplier/mocks/mocks.go b/testutil/supplier/mocks/mocks.go index 595954e65..3de9016c7 100644 --- a/testutil/supplier/mocks/mocks.go +++ b/testutil/supplier/mocks/mocks.go @@ -3,9 +3,13 @@ package mocks // This file is in place to declare the package for dynamically generated structs. // // Note that this does not follow the Cosmos SDK pattern of committing Mocks to main. -// For example, they commit auto-generate code to main: https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go -// Documentation on how Cosmos uses mockgen can be found here: https://docs.cosmos.network/main/build/building-modules/testing#unit-tests +// For example, they commit auto-generate code to main: +// https://github.com/cosmos/cosmos-sdk/blob/main/x/gov/testutil/expected_keepers_mocks.go +// Documentation on how Cosmos uses mockgen can be found here: +// https://docs.cosmos.network/main/build/building-modules/testing#unit-tests // -// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a circular dependency issue with protobuf and mock generation -// since we are leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before generating, requiring the entire dependency tree -// to be valid before mock implementations have been generated. +// IMPORTANT: We have attempted to use `.gitkeep` files instead, but it causes a +// circular dependency issue with protobuf and mock generation since we are +// leveraging `ignite` to compile `.proto` files which runs `go mod tidy` before +// generating, requiring the entire dependency tree to be valid before mock +// implementations have been generated. diff --git a/testutil/yaml/yaml.go b/testutil/yaml/yaml.go index 56a29cc89..4d6d50fe4 100644 --- a/testutil/yaml/yaml.go +++ b/testutil/yaml/yaml.go @@ -1,11 +1,15 @@ package yaml -import "strings" - -// YAML is indentation sensitive, so we need to remove the extra indentation from the test cases and make sure -// it is space-indented instead of tab-indented, otherwise the YAML parser will fail +import ( + "strings" +) + +// NormalizeYAMLIndentation is a function that normalizes YAML indentation. YAML +// As YAML is indentation sensitive, so we need to remove the extra indentation +// from the test cases and make sure it is space-indented instead of tab-indented, +// otherwise the YAML parser will fail func NormalizeYAMLIndentation(rawContent string) string { - var processedContent = rawContent + processedContent := rawContent // Remove extra newlines processedContent = strings.TrimPrefix(processedContent, "\n") diff --git a/tools/scripts/goimports/filters/filters.go b/tools/scripts/goimports/filters/filters.go deleted file mode 100644 index 67a048a51..000000000 --- a/tools/scripts/goimports/filters/filters.go +++ /dev/null @@ -1,103 +0,0 @@ -// The filters package contains functions that can be used to filter file paths. - -package filters - -import ( - "bufio" - "bytes" - "os" - "path/filepath" - "strings" -) - -const igniteScaffoldComment = "// this line is used by starport scaffolding" - -var ( - importStart = []byte("import (") - importEnd = []byte(")") -) - -// FilterFn is a function that returns true if the given path matches the -// filter's criteria. -type FilterFn func(path string) (bool, error) - -// PathMatchesGoExtension matches go source files. -func PathMatchesGoExtension(path string) (bool, error) { - return filepath.Ext(path) == ".go", nil -} - -// PathMatchesProtobufGo matches generated protobuf go source files. -func PathMatchesProtobufGo(path string) (bool, error) { - return strings.HasSuffix(path, ".pb.go"), nil -} - -// PathMatchesProtobufGatewayGo matches generated protobuf gateway go source files. -func PathMatchesProtobufGatewayGo(path string) (bool, error) { - return strings.HasSuffix(path, ".pb.gw.go"), nil -} - -// PathMatchesMockGo matches generated mock go source files. -func PathMatchesMockGo(path string) (bool, error) { - return strings.HasSuffix(path, "_mock.go"), nil -} - -// PathMatchesTestGo matches go test files. -func PathMatchesTestGo(path string) (bool, error) { - return strings.HasSuffix(path, "_test.go"), nil -} - -// ContentMatchesEmptyImportScaffold matches files that can't be goimport'd due -// to ignite incompatibility. -func ContentMatchesEmptyImportScaffold(path string) (bool, error) { - return containsEmptyImportScaffold(path) -} - -// containsEmptyImportScaffold checks if the go file at goSrcPath contains an -// import statement like the following: -// -// import ( -// // this line is used by starport scaffolding ... -// ) -func containsEmptyImportScaffold(goSrcPath string) (isEmptyImport bool, _ error) { - file, err := os.Open(goSrcPath) - if err != nil { - return false, err - } - defer file.Close() - - scanner := bufio.NewScanner(file) - scanner.Split(importBlockSplit) - - for scanner.Scan() { - trimmedImportBlock := strings.Trim(scanner.Text(), "\n\t") - if strings.HasPrefix(trimmedImportBlock, igniteScaffoldComment) { - return true, nil - } - } - - if scanner.Err() != nil { - return false, scanner.Err() - } - - return false, nil -} - -// importBlockSplit is a split function intended to be used with bufio.Scanner -// to extract the contents of a multi-line go import block. -func importBlockSplit(data []byte, _ bool) (advance int, token []byte, err error) { - // Search for the beginning of the import block - startIdx := bytes.Index(data, importStart) - if startIdx == -1 { - return 0, nil, nil - } - - // Search for the end of the import block from the start index - endIdx := bytes.Index(data[startIdx:], importEnd) - if endIdx == -1 { - return 0, nil, nil - } - - // Return the entire import block, including "import (" and ")" - importBlock := data[startIdx+len(importStart) : startIdx-len(importEnd)+endIdx+1] - return startIdx + endIdx + 1, importBlock, nil -} diff --git a/tools/scripts/goimports/main.go b/tools/scripts/goimports/main.go deleted file mode 100644 index ca5c26648..000000000 --- a/tools/scripts/goimports/main.go +++ /dev/null @@ -1,120 +0,0 @@ -package main - -import ( - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" - - "github.com/pokt-network/poktroll/tools/scripts/goimports/filters" -) - -// defaultArgs are always passed to goimports. -// -w: write result to (source) file instead of stdout -// -local: put imports beginning with this string after 3rd-party packages (comma-separated list) -// (see: goimports -h for more info) -var ( - defaultArgs = []string{"-w", "-local", "github.com/pokt-network/poktroll"} - defaultIncludeFilters = []filters.FilterFn{ - filters.PathMatchesGoExtension, - } - defaultExcludeFilters = []filters.FilterFn{ - filters.PathMatchesProtobufGo, - filters.PathMatchesProtobufGatewayGo, - filters.PathMatchesMockGo, - filters.PathMatchesTestGo, - filters.ContentMatchesEmptyImportScaffold, - } -) - -func main() { - root := "." - var filesToProcess []string - - // Walk the file system and accumulate matching files - err := filepath.Walk(root, walkRepoRootFn( - root, - defaultIncludeFilters, - defaultExcludeFilters, - &filesToProcess, - )) - if err != nil { - fmt.Printf("Error processing files: %s\n", err) - return - } - - // Run goimports on all accumulated files - if len(filesToProcess) > 0 { - cmd := exec.Command("goimports", append(defaultArgs, filesToProcess...)...) - if err := cmd.Run(); err != nil { - fmt.Printf("Failed running goimports: %v\n", err) - } - } -} - -func walkRepoRootFn( - rootPath string, - includeFilters []filters.FilterFn, - excludeFilters []filters.FilterFn, - filesToProcess *[]string, -) filepath.WalkFunc { - return func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - // Don't process the root directory but don't skip it either; that would - // exclude everything. - if info.Name() == rootPath { - return nil - } - - // No need to process directories - if info.IsDir() { - // Skip directories that start with a period - if strings.HasPrefix(info.Name(), ".") { - return filepath.SkipDir - } - return nil - } - - // Don't process paths which don't match any include filter. - var shouldIncludePath bool - for _, includeFilter := range includeFilters { - pathMatches, err := includeFilter(path) - if err != nil { - panic(err) - } - - if pathMatches { - shouldIncludePath = true - break - } - } - if !shouldIncludePath { - return nil - } - - // Don't process paths which match any exclude filter. - var shouldExcludePath bool - for _, excludeFilter := range excludeFilters { - pathMatches, err := excludeFilter(path) - if err != nil { - panic(err) - } - - if pathMatches { - shouldExcludePath = true - break - } - } - if shouldExcludePath { - return nil - } - - *filesToProcess = append(*filesToProcess, path) - - return nil - } -} diff --git a/x/application/client/cli/query.go b/x/application/client/cli/query.go index 86cd73b25..e73bcbcc0 100644 --- a/x/application/client/cli/query.go +++ b/x/application/client/cli/query.go @@ -2,13 +2,9 @@ package cli import ( "fmt" - // "strings" - - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/application/types" ) diff --git a/x/application/client/cli/tx_undelegate_from_gateway.go b/x/application/client/cli/tx_undelegate_from_gateway.go index 50a755d8f..7a30d1b8a 100644 --- a/x/application/client/cli/tx_undelegate_from_gateway.go +++ b/x/application/client/cli/tx_undelegate_from_gateway.go @@ -3,12 +3,12 @@ package cli import ( "strconv" - "github.com/pokt-network/poktroll/x/application/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/application/types" ) var _ = strconv.Itoa(0) diff --git a/x/application/client/cli/tx_unstake_application.go b/x/application/client/cli/tx_unstake_application.go index c602def16..3dea29b5e 100644 --- a/x/application/client/cli/tx_unstake_application.go +++ b/x/application/client/cli/tx_unstake_application.go @@ -25,7 +25,6 @@ Example: $ poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/application/client/config/application_configs_reader.go b/x/application/client/config/application_configs_reader.go index 871ac8709..1f561d462 100644 --- a/x/application/client/config/application_configs_reader.go +++ b/x/application/client/config/application_configs_reader.go @@ -1,9 +1,8 @@ package config import ( - "gopkg.in/yaml.v2" - sdk "github.com/cosmos/cosmos-sdk/types" + "gopkg.in/yaml.v2" sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" diff --git a/x/application/keeper/application.go b/x/application/keeper/application.go index b95b77f9e..91c4d0a02 100644 --- a/x/application/keeper/application.go +++ b/x/application/keeper/application.go @@ -20,7 +20,6 @@ func (k Keeper) SetApplication(ctx sdk.Context, application types.Application) { func (k Keeper) GetApplication( ctx sdk.Context, appAddr string, - ) (app types.Application, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ApplicationKeyPrefix)) @@ -39,7 +38,6 @@ func (k Keeper) GetApplication( func (k Keeper) RemoveApplication( ctx sdk.Context, appAddr string, - ) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ApplicationKeyPrefix)) store.Delete(types.ApplicationKey( diff --git a/x/application/keeper/application_test.go b/x/application/keeper/application_test.go index 6af5e3d26..3189944eb 100644 --- a/x/application/keeper/application_test.go +++ b/x/application/keeper/application_test.go @@ -55,6 +55,7 @@ func TestApplicationGet(t *testing.T) { ) } } + func TestApplicationRemove(t *testing.T) { keeper, ctx := keepertest.ApplicationKeeper(t) apps := createNApplication(keeper, ctx, 10) diff --git a/x/application/keeper/query_application.go b/x/application/keeper/query_application.go index c08c3c925..9c559dd6f 100644 --- a/x/application/keeper/query_application.go +++ b/x/application/keeper/query_application.go @@ -33,7 +33,6 @@ func (k Keeper) ApplicationAll(goCtx context.Context, req *types.QueryAllApplica applications = append(applications, application) return nil }) - if err != nil { return nil, status.Error(codes.Internal, err.Error()) } diff --git a/x/application/types/message_delegate_to_gateway_test.go b/x/application/types/message_delegate_to_gateway_test.go index 0769d3e65..e5c4ee2d9 100644 --- a/x/application/types/message_delegate_to_gateway_test.go +++ b/x/application/types/message_delegate_to_gateway_test.go @@ -3,9 +3,9 @@ package types import ( "testing" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" ) func TestMsgDelegateToGateway_ValidateBasic(t *testing.T) { diff --git a/x/application/types/message_stake_application.go b/x/application/types/message_stake_application.go index 2b559d3a5..f5761b3ff 100644 --- a/x/application/types/message_stake_application.go +++ b/x/application/types/message_stake_application.go @@ -19,7 +19,6 @@ func NewMsgStakeApplication( stake types.Coin, appServiceConfigs []*sharedtypes.ApplicationServiceConfig, ) *MsgStakeApplication { - return &MsgStakeApplication{ Address: address, Stake: &stake, diff --git a/x/application/types/message_stake_application_test.go b/x/application/types/message_stake_application_test.go index 0d155f50c..906378c93 100644 --- a/x/application/types/message_stake_application_test.go +++ b/x/application/types/message_stake_application_test.go @@ -40,7 +40,8 @@ func TestMsgStakeApplication_ValidateBasic(t *testing.T) { }, }, err: ErrAppInvalidStake, - }, { + }, + { name: "valid address - valid stake", msg: MsgStakeApplication{ Address: sample.AccAddress(), @@ -49,7 +50,8 @@ func TestMsgStakeApplication_ValidateBasic(t *testing.T) { {Service: &sharedtypes.Service{Id: "svc1"}}, }, }, - }, { + }, + { name: "valid address - zero stake", msg: MsgStakeApplication{ Address: sample.AccAddress(), @@ -59,7 +61,8 @@ func TestMsgStakeApplication_ValidateBasic(t *testing.T) { }, }, err: ErrAppInvalidStake, - }, { + }, + { name: "valid address - negative stake", msg: MsgStakeApplication{ Address: sample.AccAddress(), @@ -69,7 +72,8 @@ func TestMsgStakeApplication_ValidateBasic(t *testing.T) { }, }, err: ErrAppInvalidStake, - }, { + }, + { name: "valid address - invalid stake denom", msg: MsgStakeApplication{ Address: sample.AccAddress(), @@ -79,7 +83,8 @@ func TestMsgStakeApplication_ValidateBasic(t *testing.T) { }, }, err: ErrAppInvalidStake, - }, { + }, + { name: "valid address - invalid stake missing denom", msg: MsgStakeApplication{ Address: sample.AccAddress(), diff --git a/x/application/types/message_undelegate_from_gateway_test.go b/x/application/types/message_undelegate_from_gateway_test.go index b40b520e9..87ad660c9 100644 --- a/x/application/types/message_undelegate_from_gateway_test.go +++ b/x/application/types/message_undelegate_from_gateway_test.go @@ -3,9 +3,9 @@ package types import ( "testing" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" ) func TestMsgUndelegateFromGateway_ValidateBasic(t *testing.T) { diff --git a/x/gateway/client/cli/query.go b/x/gateway/client/cli/query.go index b896f7583..fcb5c60c3 100644 --- a/x/gateway/client/cli/query.go +++ b/x/gateway/client/cli/query.go @@ -2,13 +2,9 @@ package cli import ( "fmt" - // "strings" - - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/gateway/types" ) diff --git a/x/gateway/keeper/gateway.go b/x/gateway/keeper/gateway.go index 4cb1e5092..8e39c0252 100644 --- a/x/gateway/keeper/gateway.go +++ b/x/gateway/keeper/gateway.go @@ -20,7 +20,6 @@ func (k Keeper) SetGateway(ctx sdk.Context, gateway types.Gateway) { func (k Keeper) GetGateway( ctx sdk.Context, address string, - ) (val types.Gateway, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GatewayKeyPrefix)) @@ -39,7 +38,6 @@ func (k Keeper) GetGateway( func (k Keeper) RemoveGateway( ctx sdk.Context, address string, - ) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.GatewayKeyPrefix)) store.Delete(types.GatewayKey( diff --git a/x/gateway/keeper/gateway_test.go b/x/gateway/keeper/gateway_test.go index b343591a0..d20148e8d 100644 --- a/x/gateway/keeper/gateway_test.go +++ b/x/gateway/keeper/gateway_test.go @@ -4,15 +4,15 @@ import ( "strconv" "testing" + sdk "github.com/cosmos/cosmos-sdk/types" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/cmd/pocketd/cmd" keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/x/gateway/keeper" "github.com/pokt-network/poktroll/x/gateway/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/stretchr/testify/require" ) // Prevent strconv unused error diff --git a/x/gateway/keeper/msg_server_stake_gateway.go b/x/gateway/keeper/msg_server_stake_gateway.go index f5f6e63e2..d2a883c8b 100644 --- a/x/gateway/keeper/msg_server_stake_gateway.go +++ b/x/gateway/keeper/msg_server_stake_gateway.go @@ -29,12 +29,12 @@ func (k msgServer) StakeGateway( gateway, isGatewayFound := k.GetGateway(ctx, msg.Address) if !isGatewayFound { logger.Info(fmt.Sprintf("Gateway not found. Creating new gateway for address %s", msg.Address)) - gateway = k.createGateway(ctx, msg) + gateway = k.createGateway(msg) coinsToDelegate = *msg.Stake } else { logger.Info(fmt.Sprintf("Gateway found. Updating gateway stake for address %s", msg.Address)) currGatewayStake := *gateway.Stake - if err = k.updateGateway(ctx, &gateway, msg); err != nil { + if err = k.updateGateway(&gateway, msg); err != nil { return nil, err } coinsToDelegate = (*msg.Stake).Sub(currGatewayStake) @@ -48,9 +48,22 @@ func (k msgServer) StakeGateway( } // Send the coins from the gateway to the staked gateway pool - err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, gatewayAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) + err = k.bankKeeper.DelegateCoinsFromAccountToModule( + ctx, + gatewayAddress, + types.ModuleName, + []sdk.Coin{coinsToDelegate}, + ) if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, gatewayAddress, types.ModuleName, err)) + logger.Error( + fmt.Sprintf( + "could not send %v coins from %s to %s module account due to %v", + coinsToDelegate, + gatewayAddress, + types.ModuleName, + err, + ), + ) return nil, err } @@ -62,7 +75,6 @@ func (k msgServer) StakeGateway( } func (k msgServer) createGateway( - ctx sdk.Context, msg *types.MsgStakeGateway, ) types.Gateway { return types.Gateway{ @@ -72,19 +84,28 @@ func (k msgServer) createGateway( } func (k msgServer) updateGateway( - ctx sdk.Context, gateway *types.Gateway, msg *types.MsgStakeGateway, ) error { // Checks if the the msg address is the same as the current owner if msg.Address != gateway.Address { - return sdkerrors.Wrapf(types.ErrGatewayUnauthorized, "msg Address (%s) != gateway address (%s)", msg.Address, gateway.Address) + return sdkerrors.Wrapf( + types.ErrGatewayUnauthorized, + "msg Address (%s) != gateway address (%s)", + msg.Address, + gateway.Address, + ) } if msg.Stake == nil { return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount cannot be nil") } if msg.Stake.IsLTE(*gateway.Stake) { - return sdkerrors.Wrapf(types.ErrGatewayInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, gateway.Stake) + return sdkerrors.Wrapf( + types.ErrGatewayInvalidStake, + "stake amount %v must be higher than previous stake amount %v", + msg.Stake, + gateway.Stake, + ) } gateway.Stake = msg.Stake return nil diff --git a/x/gateway/keeper/msg_server_unstake_gateway.go b/x/gateway/keeper/msg_server_unstake_gateway.go index 3521d1bac..02ba272ca 100644 --- a/x/gateway/keeper/msg_server_unstake_gateway.go +++ b/x/gateway/keeper/msg_server_unstake_gateway.go @@ -41,9 +41,16 @@ func (k msgServer) UnstakeGateway( } // Send the coins from the gateway pool back to the gateway - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, gatewayAddress, []sdk.Coin{*gateway.Stake}) + err = k.bankKeeper.UndelegateCoinsFromModuleToAccount( + ctx, types.ModuleName, gatewayAddress, []sdk.Coin{*gateway.Stake}, + ) if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", gateway.Stake, gatewayAddress, types.ModuleName, err)) + logger.Error( + fmt.Sprintf( + "could not send %v coins from %s module to %s account due to %v", + gateway.Stake, gatewayAddress, types.ModuleName, err, + ), + ) return nil, err } diff --git a/x/gateway/keeper/query_gateway.go b/x/gateway/keeper/query_gateway.go index 7e18dea34..ef5d153d3 100644 --- a/x/gateway/keeper/query_gateway.go +++ b/x/gateway/keeper/query_gateway.go @@ -13,7 +13,11 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) -func (k Keeper) GatewayAll(goCtx context.Context, req *types.QueryAllGatewayRequest) (*types.QueryAllGatewayResponse, error) { +// GatewayAll retrieves all gateway from the store handling the query request. +func (k Keeper) GatewayAll( + goCtx context.Context, + req *types.QueryAllGatewayRequest, +) (*types.QueryAllGatewayResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -33,7 +37,6 @@ func (k Keeper) GatewayAll(goCtx context.Context, req *types.QueryAllGatewayRequ gateways = append(gateways, gateway) return nil }) - if err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -41,7 +44,11 @@ func (k Keeper) GatewayAll(goCtx context.Context, req *types.QueryAllGatewayRequ return &types.QueryAllGatewayResponse{Gateway: gateways, Pagination: pageRes}, nil } -func (k Keeper) Gateway(goCtx context.Context, req *types.QueryGetGatewayRequest) (*types.QueryGetGatewayResponse, error) { +// Gateway retrieves the specified gateway from the store handling the query request. +func (k Keeper) Gateway( + goCtx context.Context, + req *types.QueryGetGatewayRequest, +) (*types.QueryGetGatewayResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/x/gateway/types/expected_keepers.go b/x/gateway/types/expected_keepers.go index 2a6f6eed1..357998837 100644 --- a/x/gateway/types/expected_keepers.go +++ b/x/gateway/types/expected_keepers.go @@ -15,6 +15,16 @@ type AccountKeeper interface { // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + DelegateCoinsFromAccountToModule( + ctx sdk.Context, + senderAddr sdk.AccAddress, + recipientModule string, + amt sdk.Coins, + ) error + UndelegateCoinsFromModuleToAccount( + ctx sdk.Context, + senderModule string, + recipientAddr sdk.AccAddress, + amt sdk.Coins, + ) error } diff --git a/x/gateway/types/genesis_test.go b/x/gateway/types/genesis_test.go index ea1e6cdf8..34fd6434a 100644 --- a/x/gateway/types/genesis_test.go +++ b/x/gateway/types/genesis_test.go @@ -3,11 +3,11 @@ package types_test import ( "testing" - "github.com/pokt-network/poktroll/testutil/sample" - "github.com/pokt-network/poktroll/x/gateway/types" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" + "github.com/pokt-network/poktroll/x/gateway/types" ) func TestGenesisState_Validate(t *testing.T) { diff --git a/x/pocket/client/cli/query.go b/x/pocket/client/cli/query.go index 7fb94d626..39b9b831f 100644 --- a/x/pocket/client/cli/query.go +++ b/x/pocket/client/cli/query.go @@ -2,13 +2,9 @@ package cli import ( "fmt" - // "strings" - - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/pocket/types" ) diff --git a/x/pocket/keeper/keeper.go b/x/pocket/keeper/keeper.go index 44114c392..be6f0ecb0 100644 --- a/x/pocket/keeper/keeper.go +++ b/x/pocket/keeper/keeper.go @@ -26,7 +26,6 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, - ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { diff --git a/x/service/client/cli/query.go b/x/service/client/cli/query.go index f52a37c7a..19acd64ee 100644 --- a/x/service/client/cli/query.go +++ b/x/service/client/cli/query.go @@ -2,13 +2,9 @@ package cli import ( "fmt" - // "strings" - - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/service/types" ) diff --git a/x/service/client/cli/tx_add_service.go b/x/service/client/cli/tx_add_service.go index ba35a0a5d..06eb6038c 100644 --- a/x/service/client/cli/tx_add_service.go +++ b/x/service/client/cli/tx_add_service.go @@ -6,8 +6,9 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" - "github.com/pokt-network/poktroll/x/service/types" "github.com/spf13/cobra" + + "github.com/pokt-network/poktroll/x/service/types" ) var _ = strconv.Itoa(0) @@ -18,7 +19,6 @@ func CmdAddService() *cobra.Command { Short: "Broadcast message add-service", Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/service/keeper/msg_server_add_service.go b/x/service/keeper/msg_server_add_service.go index f6e7dd160..0f9e26f51 100644 --- a/x/service/keeper/msg_server_add_service.go +++ b/x/service/keeper/msg_server_add_service.go @@ -4,6 +4,7 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/pokt-network/poktroll/x/service/types" ) diff --git a/x/service/keeper/msg_server_test.go b/x/service/keeper/msg_server_test.go index 0c2446853..78c80d8e6 100644 --- a/x/service/keeper/msg_server_test.go +++ b/x/service/keeper/msg_server_test.go @@ -5,10 +5,11 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/service/types" - "github.com/stretchr/testify/require" ) func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { diff --git a/x/service/types/message_add_service_test.go b/x/service/types/message_add_service_test.go index c660e7751..019d34bfe 100644 --- a/x/service/types/message_add_service_test.go +++ b/x/service/types/message_add_service_test.go @@ -4,8 +4,9 @@ import ( "testing" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/pokt-network/poktroll/testutil/sample" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/testutil/sample" ) func TestMsgAddService_ValidateBasic(t *testing.T) { diff --git a/x/session/client/cli/helpers_test.go b/x/session/client/cli/helpers_test.go index 484bca4db..1308b2164 100644 --- a/x/session/client/cli/helpers_test.go +++ b/x/session/client/cli/helpers_test.go @@ -5,12 +5,13 @@ import ( "strconv" "testing" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/cmd/pocketd/cmd" "github.com/pokt-network/poktroll/testutil/network" apptypes "github.com/pokt-network/poktroll/x/application/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" ) // Dummy variable to avoid unused import error. diff --git a/x/session/client/cli/query.go b/x/session/client/cli/query.go index cd6bf6f70..89842df01 100644 --- a/x/session/client/cli/query.go +++ b/x/session/client/cli/query.go @@ -2,13 +2,9 @@ package cli import ( "fmt" - // "strings" - - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/session/types" ) diff --git a/x/session/client/cli/query_get_session.go b/x/session/client/cli/query_get_session.go index 9659ce331..47b6d66ff 100644 --- a/x/session/client/cli/query_get_session.go +++ b/x/session/client/cli/query_get_session.go @@ -13,6 +13,7 @@ import ( var _ = strconv.Itoa(0) +// CmdGetSession creates a new get-session command. func CmdGetSession() *cobra.Command { cmd := &cobra.Command{ Use: "get-session [block_height]", @@ -24,11 +25,11 @@ func CmdGetSession() *cobra.Command { This is a query operation that will not result in a state transition but simply gives a view into the chain state. Example: -$ poktrolld --home=$(POKTROLLD_HOME) q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 svc1 42 --node $(POCKET_NODE)`, + $ poktrolld --home=$(POKTROLLD_HOME) q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 svc1 42 --node $(POCKET_NODE)`, //nolint:lll Args: cobra.RangeArgs(2, 3), RunE: func(cmd *cobra.Command, args []string) (err error) { appAddressString := args[0] - serviceIdString := args[1] + serviceIDString := args[1] blockHeightString := "0" // 0 will default to latest height if len(args) == 3 { blockHeightString = args[2] @@ -39,7 +40,7 @@ $ poktrolld --home=$(POKTROLLD_HOME) q session get-session pokt1mrqt5f7qh8uxs27c return fmt.Errorf("couldn't convert block height to int: %s; (%v)", blockHeightString, err) } - getSessionReq := types.NewQueryGetSessionRequest(appAddressString, serviceIdString, blockHeight) + getSessionReq := types.NewQueryGetSessionRequest(appAddressString, serviceIDString, blockHeight) if err := getSessionReq.ValidateBasic(); err != nil { return err } diff --git a/x/session/keeper/keeper.go b/x/session/keeper/keeper.go index 292890964..94c8559ac 100644 --- a/x/session/keeper/keeper.go +++ b/x/session/keeper/keeper.go @@ -32,7 +32,6 @@ func NewKeeper( appKeeper types.ApplicationKeeper, supplierKeeper types.SupplierKeeper, - ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { diff --git a/x/session/keeper/query_get_session.go b/x/session/keeper/query_get_session.go index e2d4681af..7238c2e28 100644 --- a/x/session/keeper/query_get_session.go +++ b/x/session/keeper/query_get_session.go @@ -10,7 +10,11 @@ import ( "github.com/pokt-network/poktroll/x/session/types" ) -func (k Keeper) GetSession(goCtx context.Context, req *types.QueryGetSessionRequest) (*types.QueryGetSessionResponse, error) { +// GetSession returns the session handling the query request. +func (k Keeper) GetSession( + goCtx context.Context, + req *types.QueryGetSessionRequest, +) (*types.QueryGetSessionResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/x/session/keeper/session_hydrator.go b/x/session/keeper/session_hydrator.go index cae92e6c9..a00a13251 100644 --- a/x/session/keeper/session_hydrator.go +++ b/x/session/keeper/session_hydrator.go @@ -9,13 +9,14 @@ import ( sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - _ "golang.org/x/crypto/sha3" + _ "golang.org/x/crypto/sha3" // blank to be able to get the size of the hash "github.com/pokt-network/poktroll/x/session/types" sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) +// SHA3HashLen is the length of the sha3_256 hash (32 bytes) var SHA3HashLen = crypto.SHA3_256.Size() // TODO(#21): Make these configurable governance param @@ -36,28 +37,30 @@ type sessionHydrator struct { blockHeight int64 // A redundant helper that maintains a hex decoded copy of `session.Id` used for session hydration - sessionIdBz []byte + sessionIDBz []byte } +// NewSessionHydrator creates a new session hydrator instance. func NewSessionHydrator( appAddress string, - serviceId string, + serviceID string, blockHeight int64, ) *sessionHydrator { sessionHeader := &types.SessionHeader{ ApplicationAddress: appAddress, - Service: &sharedtypes.Service{Id: serviceId}, + Service: &sharedtypes.Service{Id: serviceID}, } return &sessionHydrator{ sessionHeader: sessionHeader, session: &types.Session{}, blockHeight: blockHeight, - sessionIdBz: make([]byte, 0), + sessionIDBz: make([]byte, 0), } } -// GetSession implements of the exposed `UtilityModule.GetSession` function -// TECHDEBT(#519): Add custom error types depending on the type of issue that occurred and assert on them in the unit tests. +// HydrateSession implements of the exposed `UtilityModule.GetSession` function +// TECHDEBT(#519): Add custom error types depending on the type of issue that +// occurred and assert on them in the unit tests. func (k Keeper) HydrateSession(ctx sdk.Context, sh *sessionHydrator) (*types.Session, error) { logger := k.Logger(ctx).With("method", "hydrateSession") @@ -87,12 +90,19 @@ func (k Keeper) HydrateSession(ctx sdk.Context, sh *sessionHydrator) (*types.Ses return sh.session, nil } -// hydrateSessionMetadata hydrates metadata related to the session such as the height at which the session started, its number, the number of blocks per session, etc.. +// hydrateSessionMetadata hydrates metadata related to the session such as the +// height at which the session started, its number, the number of blocks per +// session, etc.. func (k Keeper) hydrateSessionMetadata(ctx sdk.Context, sh *sessionHydrator) error { // TODO_TECHDEBT: Add a test if `blockHeight` is ahead of the current chain or what this node is aware of if sh.blockHeight > ctx.BlockHeight() { - return sdkerrors.Wrapf(types.ErrSessionHydration, "block height %d is ahead of the current block height %d", sh.blockHeight, ctx.BlockHeight()) + return sdkerrors.Wrapf( + types.ErrSessionHydration, + "block height %d is ahead of the current block height %d", + sh.blockHeight, + ctx.BlockHeight(), + ) } sh.session.NumBlocksPerSession = NumBlocksPerSession @@ -105,7 +115,7 @@ func (k Keeper) hydrateSessionMetadata(ctx sdk.Context, sh *sessionHydrator) err } // hydrateSessionID use both session and on-chain data to determine a unique session ID -func (k Keeper) hydrateSessionID(ctx sdk.Context, sh *sessionHydrator) error { +func (k Keeper) hydrateSessionID(_ sdk.Context, sh *sessionHydrator) error { // TODO_BLOCKER: Need to retrieve the block hash at SessionStartBlockHeight, but this requires // a bit of work and the `ctx` only gives access to the current block/header. See this thread // for more details: https://github.com/pokt-network/poktroll/pull/78/files#r1369215667 @@ -119,7 +129,7 @@ func (k Keeper) hydrateSessionID(ctx sdk.Context, sh *sessionHydrator) error { return sdkerrors.Wrapf(types.ErrSessionHydration, "invalid service: %v", sh.sessionHeader.Service) } - sh.sessionHeader.SessionId, sh.sessionIdBz = GetSessionId( + sh.sessionHeader.SessionId, sh.sessionIDBz = GetSessionId( sh.sessionHeader.ApplicationAddress, sh.sessionHeader.Service.Id, prevHash, @@ -133,7 +143,12 @@ func (k Keeper) hydrateSessionID(ctx sdk.Context, sh *sessionHydrator) error { func (k Keeper) hydrateSessionApplication(ctx sdk.Context, sh *sessionHydrator) error { app, appIsFound := k.appKeeper.GetApplication(ctx, sh.sessionHeader.ApplicationAddress) if !appIsFound { - return sdkerrors.Wrapf(types.ErrSessionAppNotFound, "could not find app with address: %s at height %d", sh.sessionHeader.ApplicationAddress, sh.sessionHeader.SessionStartBlockHeight) + return sdkerrors.Wrapf( + types.ErrSessionAppNotFound, + "could not find app with address: %s at height %d", + sh.sessionHeader.ApplicationAddress, + sh.sessionHeader.SessionStartBlockHeight, + ) } for _, appServiceConfig := range app.ServiceConfigs { @@ -143,7 +158,12 @@ func (k Keeper) hydrateSessionApplication(ctx sdk.Context, sh *sessionHydrator) } } - return sdkerrors.Wrapf(types.ErrSessionAppNotStakedForService, "application %s not staked for service %s", sh.sessionHeader.ApplicationAddress, sh.sessionHeader.Service.Id) + return sdkerrors.Wrapf( + types.ErrSessionAppNotStakedForService, + "application %s not staked for service %s", + sh.sessionHeader.ApplicationAddress, + sh.sessionHeader.Service.Id, + ) } // hydrateSessionSuppliers finds the suppliers that are staked at the session height and populates the session with them @@ -154,7 +174,8 @@ func (k Keeper) hydrateSessionSuppliers(ctx sdk.Context, sh *sessionHydrator) er // NOT THE CURRENT ONE which is what's provided by the context. For now, for simplicity, // only retrieving the suppliers at the current block height which could create a discrepancy // if new suppliers were staked mid session. - // TODO(@bryanchriswhite): Investigate if `BlockClient` + `ReplayObservable` where `N = SessionLength` could be used here.` + // TODO(@bryanchriswhite): Investigate if `BlockClient` + `ReplayObservable` + // where `N = SessionLength` could be used here.` suppliers := k.supplierKeeper.GetAllSupplier(ctx) candidateSuppliers := make([]*sharedtypes.Supplier, 0) @@ -163,7 +184,8 @@ func (k Keeper) hydrateSessionSuppliers(ctx sdk.Context, sh *sessionHydrator) er // to a slice of pointers; otherwise, we'd be appending new pointers to // the same memory address containing the last supplier in the loop. supplier := s - // TODO_OPTIMIZE: If `supplier.Services` was a map[string]struct{}, we could eliminate `slices.Contains()`'s loop + // TODO_OPTIMIZE: If `supplier.Services` was a map[string]struct{}, + // we could eliminate `slices.Contains()`'s loop for _, supplierServiceConfig := range supplier.Services { if supplierServiceConfig.Service.Id == sh.sessionHeader.Service.Id { candidateSuppliers = append(candidateSuppliers, &supplier) @@ -174,26 +196,42 @@ func (k Keeper) hydrateSessionSuppliers(ctx sdk.Context, sh *sessionHydrator) er if len(candidateSuppliers) == 0 { logger.Error(fmt.Sprintf("[ERROR] no suppliers found for session")) - return sdkerrors.Wrapf(types.ErrSessionSuppliersNotFound, "could not find suppliers for service %s at height %d", sh.sessionHeader.Service, sh.sessionHeader.SessionStartBlockHeight) + return sdkerrors.Wrapf( + types.ErrSessionSuppliersNotFound, + "could not find suppliers for service %s at height %d", + sh.sessionHeader.Service, + sh.sessionHeader.SessionStartBlockHeight, + ) } if len(candidateSuppliers) < NumSupplierPerSession { - logger.Info(fmt.Sprintf("[WARN] number of available suppliers (%d) is less than the number of suppliers per session (%d)", len(candidateSuppliers), NumSupplierPerSession)) + logger.Info( + fmt.Sprintf( + "[WARN] number of available suppliers (%d) is less than the number of suppliers per session (%d)", + len(candidateSuppliers), + NumSupplierPerSession, + ), + ) sh.session.Suppliers = candidateSuppliers } else { - sh.session.Suppliers = pseudoRandomSelection(candidateSuppliers, NumSupplierPerSession, sh.sessionIdBz) + sh.session.Suppliers = pseudoRandomSelection(candidateSuppliers, NumSupplierPerSession, sh.sessionIDBz) } return nil } -// TODO_INVESTIGATE: We are using a `Go` native implementation for a pseudo-random number generator. In order -// for it to be language agnostic, a general purpose algorithm MUST be used. -// pseudoRandomSelection returns a random subset of the candidates. -func pseudoRandomSelection(candidates []*sharedtypes.Supplier, numTarget int, sessionIdBz []byte) []*sharedtypes.Supplier { - // Take the first 8 bytes of sessionId to use as the seed +// TODO_INVESTIGATE: We are using a `Go` native implementation for a +// pseudo-random number generator. In order for it to be language agnostic, a +// general purpose algorithm MUST be used. pseudoRandomSelection returns a +// random subset of the candidates. +func pseudoRandomSelection( + candidates []*sharedtypes.Supplier, + numTarget int, + sessionIDBz []byte, +) []*sharedtypes.Supplier { + // Take the first 8 bytes of sessionID to use as the seed // NB: There is specific reason why `BigEndian` was chosen over `LittleEndian` in this specific context. - seed := int64(binary.BigEndian.Uint64(sha3Hash(sessionIdBz)[:8])) + seed := int64(binary.BigEndian.Uint64(sha3Hash(sessionIDBz)[:8])) // Retrieve the indices for the candidates actors := make([]*sharedtypes.Supplier, 0) @@ -247,19 +285,25 @@ func sha3Hash(bz []byte) []byte { // given the application public key, service ID, block hash, and block height. func GetSessionId( appPubKey, - serviceId, + serviceID, blockHash string, blockHeight int64, -) (sessionId string, sessionIdBz []byte) { +) (sessionID string, sessionIDBz []byte) { appPubKeyBz := []byte(appPubKey) - serviceIdBz := []byte(serviceId) + serviceIDBz := []byte(serviceID) blockHashBz := []byte(blockHash) sessionHeightBz := make([]byte, 8) binary.LittleEndian.PutUint64(sessionHeightBz, uint64(blockHeight)) - sessionIdBz = concatWithDelimiter(SessionIDComponentDelimiter, blockHashBz, serviceIdBz, appPubKeyBz, sessionHeightBz) - sessionId = hex.EncodeToString(sha3Hash(sessionIdBz)) + sessionIDBz = concatWithDelimiter( + SessionIDComponentDelimiter, + blockHashBz, + serviceIDBz, + appPubKeyBz, + sessionHeightBz, + ) + sessionID = hex.EncodeToString(sha3Hash(sessionIDBz)) - return sessionId, sessionIdBz + return sessionID, sessionIDBz } diff --git a/x/shared/helpers/service.go b/x/shared/helpers/service.go index 9825f26d4..df254d89a 100644 --- a/x/shared/helpers/service.go +++ b/x/shared/helpers/service.go @@ -24,7 +24,6 @@ func init() { // Compile the regex pattern regexExprServiceId = regexp.MustCompile(regexServiceId) regexExprServiceName = regexp.MustCompile(regexServiceName) - } // IsValidService checks if the provided ServiceId struct has valid fields diff --git a/x/supplier/client/cli/query_claim_test.go b/x/supplier/client/cli/query_claim_test.go index d7bd4aabd..8795cea0c 100644 --- a/x/supplier/client/cli/query_claim_test.go +++ b/x/supplier/client/cli/query_claim_test.go @@ -33,7 +33,7 @@ func TestClaim_Show(t *testing.T) { fmt.Sprintf("--%s=json", tmcli.OutputFlag), } - var wrongSupplierAddr = sample.AccAddress() + wrongSupplierAddr := sample.AccAddress() tests := []struct { desc string sessionId string diff --git a/x/supplier/client/cli/tx_unstake_supplier.go b/x/supplier/client/cli/tx_unstake_supplier.go index 434eceb24..0ed3a03e6 100644 --- a/x/supplier/client/cli/tx_unstake_supplier.go +++ b/x/supplier/client/cli/tx_unstake_supplier.go @@ -20,7 +20,6 @@ Example: $ poktrolld --home=$(POKTROLLD_HOME) tx supplier unstake-supplier --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { - clientCtx, err := client.GetClientTxContext(cmd) if err != nil { return err diff --git a/x/supplier/client/config/supplier_configs_reader.go b/x/supplier/client/config/supplier_configs_reader.go index c5f1aeffc..de9549553 100644 --- a/x/supplier/client/config/supplier_configs_reader.go +++ b/x/supplier/client/config/supplier_configs_reader.go @@ -3,9 +3,8 @@ package config import ( "net/url" - "gopkg.in/yaml.v2" - sdk "github.com/cosmos/cosmos-sdk/types" + "gopkg.in/yaml.v2" sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" diff --git a/x/supplier/client/config/supplier_configs_reader_test.go b/x/supplier/client/config/supplier_configs_reader_test.go index 546a735c3..3dfb50cb6 100644 --- a/x/supplier/client/config/supplier_configs_reader_test.go +++ b/x/supplier/client/config/supplier_configs_reader_test.go @@ -394,11 +394,22 @@ func Test_ParseSupplierConfigs(t *testing.T) { require.Equal(t, expectedEndpoint.Url, supplierServiceConfig.Services[i].Endpoints[j].Url) require.Equal(t, expectedEndpoint.RpcType, supplierServiceConfig.Services[i].Endpoints[j].RpcType) - require.Equal(t, len(expectedEndpoint.Configs), len(supplierServiceConfig.Services[i].Endpoints[j].Configs)) + require.Equal( + t, + len(expectedEndpoint.Configs), + len(supplierServiceConfig.Services[i].Endpoints[j].Configs), + ) for k, expectedConfig := range expectedEndpoint.Configs { - - require.Equal(t, expectedConfig.Key, supplierServiceConfig.Services[i].Endpoints[j].Configs[k].Key) - require.Equal(t, expectedConfig.Value, supplierServiceConfig.Services[i].Endpoints[j].Configs[k].Value) + require.Equal( + t, + expectedConfig.Key, + supplierServiceConfig.Services[i].Endpoints[j].Configs[k].Key, + ) + require.Equal( + t, + expectedConfig.Value, + supplierServiceConfig.Services[i].Endpoints[j].Configs[k].Value, + ) } } } diff --git a/x/supplier/keeper/claim_test.go b/x/supplier/keeper/claim_test.go index 475350752..745d9d25c 100644 --- a/x/supplier/keeper/claim_test.go +++ b/x/supplier/keeper/claim_test.go @@ -48,6 +48,7 @@ func TestClaim_Get(t *testing.T) { ) } } + func TestClaim_Remove(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t, nil) claims := createNClaims(keeper, ctx, 10) diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index edd8ecee8..3e6e5ecab 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -90,7 +90,6 @@ func (k msgServer) updateSupplier( return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount cannot be nil") } if msg.Stake.IsLTE(*supplier.Stake) { - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) } supplier.Stake = msg.Stake diff --git a/x/supplier/keeper/proof.go b/x/supplier/keeper/proof.go index aec052d5b..1e9505a2b 100644 --- a/x/supplier/keeper/proof.go +++ b/x/supplier/keeper/proof.go @@ -21,7 +21,6 @@ func (k Keeper) UpsertProof(ctx sdk.Context, proof types.Proof) { func (k Keeper) GetProof( ctx sdk.Context, sessionId string, - ) (val types.Proof, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ProofKeyPrefix)) @@ -42,7 +41,6 @@ func (k Keeper) RemoveProof( ctx sdk.Context, // TODO_NEXT(@bryanchriswhite #141): Refactor proof keys to support multiple indices. index string, - ) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ProofKeyPrefix)) // TODO_NEXT(@bryanchriswhite #141): Refactor proof keys to support multiple indices. diff --git a/x/supplier/keeper/proof_test.go b/x/supplier/keeper/proof_test.go index 28d73ca7f..bcaa92e05 100644 --- a/x/supplier/keeper/proof_test.go +++ b/x/supplier/keeper/proof_test.go @@ -55,6 +55,7 @@ func TestProofGet(t *testing.T) { ) } } + func TestProofRemove(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t, nil) items := createNProofs(keeper, ctx, 10) diff --git a/x/supplier/keeper/query_claim.go b/x/supplier/keeper/query_claim.go index 4dd294adc..eeb5de26c 100644 --- a/x/supplier/keeper/query_claim.go +++ b/x/supplier/keeper/query_claim.go @@ -13,7 +13,11 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k Keeper) AllClaims(goCtx context.Context, req *types.QueryAllClaimsRequest) (*types.QueryAllClaimsResponse, error) { +// AllClaims returns all claims from the store handling the query request. +func (k Keeper) AllClaims( + goCtx context.Context, + req *types.QueryAllClaimsRequest, +) (*types.QueryAllClaimsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -69,7 +73,6 @@ func (k Keeper) AllClaims(goCtx context.Context, req *types.QueryAllClaimsReques return nil }) - if err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -77,7 +80,12 @@ func (k Keeper) AllClaims(goCtx context.Context, req *types.QueryAllClaimsReques return &types.QueryAllClaimsResponse{Claim: claims, Pagination: pageRes}, nil } -func (k Keeper) Claim(goCtx context.Context, req *types.QueryGetClaimRequest) (*types.QueryGetClaimResponse, error) { +// Claim retrieves a single claim from the store (if it still exists), +// handling the query request. +func (k Keeper) Claim( + goCtx context.Context, + req *types.QueryGetClaimRequest, +) (*types.QueryGetClaimResponse, error) { if req == nil { err := types.ErrSupplierInvalidQueryRequest.Wrapf("request cannot be nil") return nil, status.Error(codes.InvalidArgument, err.Error()) diff --git a/x/supplier/keeper/query_claim_test.go b/x/supplier/keeper/query_claim_test.go index fac734a78..96a422301 100644 --- a/x/supplier/keeper/query_claim_test.go +++ b/x/supplier/keeper/query_claim_test.go @@ -20,7 +20,7 @@ func TestClaim_QuerySingle(t *testing.T) { wctx := sdk.WrapSDKContext(ctx) claims := createNClaims(keeper, ctx, 2) - var wrongSupplierAddr = sample.AccAddress() + wrongSupplierAddr := sample.AccAddress() tests := []struct { desc string diff --git a/x/supplier/keeper/query_proof.go b/x/supplier/keeper/query_proof.go index 880d5c67b..26f18f637 100644 --- a/x/supplier/keeper/query_proof.go +++ b/x/supplier/keeper/query_proof.go @@ -32,7 +32,6 @@ func (k Keeper) AllProofs(goCtx context.Context, req *types.QueryAllProofsReques proofs = append(proofs, proof) return nil }) - if err != nil { return nil, status.Error(codes.Internal, err.Error()) } diff --git a/x/supplier/keeper/supplier_test.go b/x/supplier/keeper/supplier_test.go index 03b1e470a..29d2283d9 100644 --- a/x/supplier/keeper/supplier_test.go +++ b/x/supplier/keeper/supplier_test.go @@ -63,6 +63,7 @@ func TestSupplierGet(t *testing.T) { ) } } + func TestSupplierRemove(t *testing.T) { keeper, ctx := keepertest.SupplierKeeper(t, nil) suppliers := createNSupplier(keeper, ctx, 10) diff --git a/x/supplier/types/genesis_test.go b/x/supplier/types/genesis_test.go index 5895fd717..d5eb00a64 100644 --- a/x/supplier/types/genesis_test.go +++ b/x/supplier/types/genesis_test.go @@ -4,10 +4,11 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/testutil/sample" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" ) func TestGenesisState_Validate(t *testing.T) { @@ -56,7 +57,6 @@ func TestGenesisState_Validate(t *testing.T) { { desc: "valid genesis state", genState: &types.GenesisState{ - SupplierList: []sharedtypes.Supplier{ { Address: addr1, diff --git a/x/supplier/types/message_stake_supplier_test.go b/x/supplier/types/message_stake_supplier_test.go index 158fd8ff3..06ea2028d 100644 --- a/x/supplier/types/message_stake_supplier_test.go +++ b/x/supplier/types/message_stake_supplier_test.go @@ -14,7 +14,6 @@ import ( // It can be simplified by splitting it into smaller tests where the common // fields don't need to be explicitly specified from test to test. func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { - defaultServicesList := []*sharedtypes.SupplierServiceConfig{ { Service: &sharedtypes.Service{ @@ -27,7 +26,8 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { Configs: make([]*sharedtypes.ConfigOption, 0), }, }, - }} + }, + } tests := []struct { name string @@ -54,14 +54,16 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { Services: defaultServicesList, }, err: ErrSupplierInvalidStake, - }, { + }, + { name: "valid address - valid stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), Stake: &sdk.Coin{Denom: "upokt", Amount: sdk.NewInt(100)}, Services: defaultServicesList, }, - }, { + }, + { name: "valid address - zero stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), @@ -69,7 +71,8 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { Services: defaultServicesList, }, err: ErrSupplierInvalidStake, - }, { + }, + { name: "valid address - negative stake", msg: MsgStakeSupplier{ Address: sample.AccAddress(), @@ -77,7 +80,8 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { Services: defaultServicesList, }, err: ErrSupplierInvalidStake, - }, { + }, + { name: "valid address - invalid stake denom", msg: MsgStakeSupplier{ Address: sample.AccAddress(), @@ -85,7 +89,8 @@ func TestMsgStakeSupplier_ValidateBasic(t *testing.T) { Services: defaultServicesList, }, err: ErrSupplierInvalidStake, - }, { + }, + { name: "valid address - invalid stake missing denom", msg: MsgStakeSupplier{ Address: sample.AccAddress(), diff --git a/x/tokenomics/client/cli/query.go b/x/tokenomics/client/cli/query.go index c11674331..979ae9f5f 100644 --- a/x/tokenomics/client/cli/query.go +++ b/x/tokenomics/client/cli/query.go @@ -2,13 +2,9 @@ package cli import ( "fmt" - // "strings" - - "github.com/spf13/cobra" "github.com/cosmos/cosmos-sdk/client" - // "github.com/cosmos/cosmos-sdk/client/flags" - // sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/tokenomics/types" ) diff --git a/x/tokenomics/genesis_test.go b/x/tokenomics/genesis_test.go index cc07aef93..24faddd65 100644 --- a/x/tokenomics/genesis_test.go +++ b/x/tokenomics/genesis_test.go @@ -3,11 +3,12 @@ package tokenomics_test import ( "testing" + "github.com/stretchr/testify/require" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/testutil/nullify" "github.com/pokt-network/poktroll/x/tokenomics" "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" ) func TestGenesis(t *testing.T) { diff --git a/x/tokenomics/keeper/keeper.go b/x/tokenomics/keeper/keeper.go index 9c5a8abd3..06e5aee17 100644 --- a/x/tokenomics/keeper/keeper.go +++ b/x/tokenomics/keeper/keeper.go @@ -26,7 +26,6 @@ func NewKeeper( storeKey, memKey storetypes.StoreKey, ps paramtypes.Subspace, - ) *Keeper { // set KeyTable if it has not already been set if !ps.HasKeyTable() { diff --git a/x/tokenomics/keeper/msg_server_test.go b/x/tokenomics/keeper/msg_server_test.go index 2af3f9161..3847e8d6f 100644 --- a/x/tokenomics/keeper/msg_server_test.go +++ b/x/tokenomics/keeper/msg_server_test.go @@ -5,10 +5,11 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + keepertest "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/tokenomics/keeper" "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" ) func setupMsgServer(t testing.TB) (types.MsgServer, context.Context) { diff --git a/x/tokenomics/keeper/params_test.go b/x/tokenomics/keeper/params_test.go index 3fb77ea65..44d89dab7 100644 --- a/x/tokenomics/keeper/params_test.go +++ b/x/tokenomics/keeper/params_test.go @@ -3,9 +3,10 @@ package keeper_test import ( "testing" + "github.com/stretchr/testify/require" + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" ) func TestGetParams(t *testing.T) { diff --git a/x/tokenomics/keeper/query_params_test.go b/x/tokenomics/keeper/query_params_test.go index 86fdf619c..bc037d00c 100644 --- a/x/tokenomics/keeper/query_params_test.go +++ b/x/tokenomics/keeper/query_params_test.go @@ -4,9 +4,10 @@ import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + testkeeper "github.com/pokt-network/poktroll/testutil/keeper" "github.com/pokt-network/poktroll/x/tokenomics/types" - "github.com/stretchr/testify/require" ) func TestParamsQuery(t *testing.T) { diff --git a/x/tokenomics/types/genesis_test.go b/x/tokenomics/types/genesis_test.go index 0f9412dab..9b48cff86 100644 --- a/x/tokenomics/types/genesis_test.go +++ b/x/tokenomics/types/genesis_test.go @@ -3,8 +3,9 @@ package types_test import ( "testing" - "github.com/pokt-network/poktroll/x/tokenomics/types" "github.com/stretchr/testify/require" + + "github.com/pokt-network/poktroll/x/tokenomics/types" ) func TestGenesisState_Validate(t *testing.T) { diff --git a/x/tokenomics/types/params.go b/x/tokenomics/types/params.go index 62a18de9c..b72229398 100644 --- a/x/tokenomics/types/params.go +++ b/x/tokenomics/types/params.go @@ -39,7 +39,11 @@ func DefaultParams() Params { // ParamSetPairs get the params.ParamSet func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyComputeToTokensMultiplier, &p.ComputeToTokensMultiplier, validateComputeToTokensMultiplier), + paramtypes.NewParamSetPair( + KeyComputeToTokensMultiplier, + &p.ComputeToTokensMultiplier, + validateComputeToTokensMultiplier, + ), } } From 5ec364da360a1bc123ca20c85a67196a931422e9 Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 21:28:38 +0000 Subject: [PATCH 10/61] chore: run gci on all files and add script and makefile target --- .github/workflows/run-tests.yml | 5 +- .golangci.yml | 4 + Makefile | 18 ++- testutil/testkeyring/gen_accounts/gen.go | 3 +- tools/scripts/gci/filters/filters.go | 103 ++++++++++++++ tools/scripts/gci/main.go | 128 ++++++++++++++++++ x/application/client/cli/tx.go | 2 +- x/application/module.go | 8 +- .../simulation/delegate_to_gateway.go | 6 +- .../simulation/undelegate_from_gateway.go | 6 +- .../simulation/unstake_application.go | 1 - x/gateway/client/cli/tx.go | 2 +- x/gateway/module.go | 8 +- x/gateway/module_simulation.go | 8 +- x/pocket/client/cli/tx.go | 2 +- x/pocket/module.go | 8 +- x/service/client/cli/tx.go | 2 +- x/service/module.go | 8 +- x/service/simulation/add_service.go | 1 + x/session/client/cli/tx.go | 2 +- x/supplier/module.go | 8 +- x/supplier/module_simulation.go | 8 +- x/tokenomics/client/cli/tx.go | 2 +- x/tokenomics/module.go | 2 - 24 files changed, 284 insertions(+), 61 deletions(-) create mode 100644 tools/scripts/gci/filters/filters.go create mode 100644 tools/scripts/gci/main.go diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 02cf205eb..b843265b6 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -45,10 +45,7 @@ jobs: run: make go_mockgen - name: Run golangci-lint - uses: golangci/golangci-lint-action@v3 - with: - version: v1.54 - args: --timeout=15m --build-tags test + run: make go_lint - name: Test run: make go_test diff --git a/.golangci.yml b/.golangci.yml index bf383a3c5..6fc44eba2 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,9 +22,13 @@ linters-settings: sections: - standard # std lib - default # external + - custom # internal - prefix(github.com/pokt-network/poktroll) # local imports skip-generated: true custom-order: true + skip-files: + - "*.pb.go" + - "*/vendor/*" issues: exclude-use-default: true diff --git a/Makefile b/Makefile index c6509c315..15603b778 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ POCKET_ADDR_PREFIX = pokt install_ci_deps: ## Installs `mockgen` go install "github.com/golang/mock/mockgen@v1.6.0" && mockgen --version go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint --version - go install golang.org/x/tools/cmd/goimports@latest + go install github.com/daixiang0/gci@latest ######################## ### Makefile Helpers ### @@ -71,6 +71,16 @@ check_godoc: fi; \ } +.PHONY: check_gci +# Internal helper target - check if gci is installed +check_gci: + { \ + if ( ! ( command -v gci >/dev/null )); then \ + echo "Seems like you don't have gci installed. Make sure you install it via 'go install github.com/daixiang0/gci@latest' before continuing"; \ + exit 1; \ + fi; \ + } + .PHONY: check_npm # Internal helper target - check if npm is installed check_npm: @@ -150,7 +160,11 @@ localnet_regenesis: ## Regenerate the localnet genesis file .PHONY: go_lint go_lint: ## Run all go linters - golangci-lint run --timeout 5m --build-tags test + golangci-lint run --timeout 15m --build-tags test + +.PHONY: gci +gci: check_gci ## Run gci (import ordering) on all applicable files, this writes changes in place + go run ./tools/scripts/gci ############# ### Tests ### diff --git a/testutil/testkeyring/gen_accounts/gen.go b/testutil/testkeyring/gen_accounts/gen.go index 8b05da7d2..c0445a8cf 100644 --- a/testutil/testkeyring/gen_accounts/gen.go +++ b/testutil/testkeyring/gen_accounts/gen.go @@ -14,9 +14,8 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/types" - "github.com/pokt-network/poktroll/testutil/testkeyring" - "github.com/pokt-network/poktroll/app" + "github.com/pokt-network/poktroll/testutil/testkeyring" ) var ( diff --git a/tools/scripts/gci/filters/filters.go b/tools/scripts/gci/filters/filters.go new file mode 100644 index 000000000..67a048a51 --- /dev/null +++ b/tools/scripts/gci/filters/filters.go @@ -0,0 +1,103 @@ +// The filters package contains functions that can be used to filter file paths. + +package filters + +import ( + "bufio" + "bytes" + "os" + "path/filepath" + "strings" +) + +const igniteScaffoldComment = "// this line is used by starport scaffolding" + +var ( + importStart = []byte("import (") + importEnd = []byte(")") +) + +// FilterFn is a function that returns true if the given path matches the +// filter's criteria. +type FilterFn func(path string) (bool, error) + +// PathMatchesGoExtension matches go source files. +func PathMatchesGoExtension(path string) (bool, error) { + return filepath.Ext(path) == ".go", nil +} + +// PathMatchesProtobufGo matches generated protobuf go source files. +func PathMatchesProtobufGo(path string) (bool, error) { + return strings.HasSuffix(path, ".pb.go"), nil +} + +// PathMatchesProtobufGatewayGo matches generated protobuf gateway go source files. +func PathMatchesProtobufGatewayGo(path string) (bool, error) { + return strings.HasSuffix(path, ".pb.gw.go"), nil +} + +// PathMatchesMockGo matches generated mock go source files. +func PathMatchesMockGo(path string) (bool, error) { + return strings.HasSuffix(path, "_mock.go"), nil +} + +// PathMatchesTestGo matches go test files. +func PathMatchesTestGo(path string) (bool, error) { + return strings.HasSuffix(path, "_test.go"), nil +} + +// ContentMatchesEmptyImportScaffold matches files that can't be goimport'd due +// to ignite incompatibility. +func ContentMatchesEmptyImportScaffold(path string) (bool, error) { + return containsEmptyImportScaffold(path) +} + +// containsEmptyImportScaffold checks if the go file at goSrcPath contains an +// import statement like the following: +// +// import ( +// // this line is used by starport scaffolding ... +// ) +func containsEmptyImportScaffold(goSrcPath string) (isEmptyImport bool, _ error) { + file, err := os.Open(goSrcPath) + if err != nil { + return false, err + } + defer file.Close() + + scanner := bufio.NewScanner(file) + scanner.Split(importBlockSplit) + + for scanner.Scan() { + trimmedImportBlock := strings.Trim(scanner.Text(), "\n\t") + if strings.HasPrefix(trimmedImportBlock, igniteScaffoldComment) { + return true, nil + } + } + + if scanner.Err() != nil { + return false, scanner.Err() + } + + return false, nil +} + +// importBlockSplit is a split function intended to be used with bufio.Scanner +// to extract the contents of a multi-line go import block. +func importBlockSplit(data []byte, _ bool) (advance int, token []byte, err error) { + // Search for the beginning of the import block + startIdx := bytes.Index(data, importStart) + if startIdx == -1 { + return 0, nil, nil + } + + // Search for the end of the import block from the start index + endIdx := bytes.Index(data[startIdx:], importEnd) + if endIdx == -1 { + return 0, nil, nil + } + + // Return the entire import block, including "import (" and ")" + importBlock := data[startIdx+len(importStart) : startIdx-len(importEnd)+endIdx+1] + return startIdx + endIdx + 1, importBlock, nil +} diff --git a/tools/scripts/gci/main.go b/tools/scripts/gci/main.go new file mode 100644 index 000000000..b05265cc3 --- /dev/null +++ b/tools/scripts/gci/main.go @@ -0,0 +1,128 @@ +package main + +import ( + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/pokt-network/poktroll/tools/scripts/gci/filters" +) + +var ( + defaultArgs = []string{ + "--section=standard", + "--section=default", + "--section=prefix(github.com/pokt-network/poktroll)", + "--skip-generated", + "--skip-vendor", + } + defaultIncludeFilters = []filters.FilterFn{ + filters.PathMatchesGoExtension, + } + defaultExcludeFilters = []filters.FilterFn{ + filters.PathMatchesProtobufGo, + filters.PathMatchesProtobufGatewayGo, + filters.PathMatchesMockGo, + filters.PathMatchesTestGo, + filters.ContentMatchesEmptyImportScaffold, + } +) + +func main() { + root := "." + var filesToProcess []string + + // Walk the file system and accumulate matching files + err := filepath.Walk(root, walkRepoRootFn( + root, + defaultIncludeFilters, + defaultExcludeFilters, + &filesToProcess, + )) + if err != nil { + fmt.Printf("Error processing files: %s\n", err) + return + } + + // Run gci on all accumulated files - this writes changes in place + if len(filesToProcess) > 0 { + cmdToRun := append([]string{"gci", "write"}, defaultArgs...) + cmdToRun = append(cmdToRun, filesToProcess...) + fmt.Printf("Running: %s\n", cmdToRun) + args := defaultArgs + args = append(args, filesToProcess...) + cmd := exec.Command("gci", append([]string{"write"}, args...)...) + out, err := cmd.CombinedOutput() + if err != nil { + fmt.Printf("Output: %s\nFailed running gci: %v\n", out, err) + } + } +} + +func walkRepoRootFn( + rootPath string, + includeFilters []filters.FilterFn, + excludeFilters []filters.FilterFn, + filesToProcess *[]string, +) filepath.WalkFunc { + return func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + // Don't process the root directory but don't skip it either; that would + // exclude everything. + if info.Name() == rootPath { + return nil + } + + // No need to process directories + if info.IsDir() { + // Skip directories that start with a period + if strings.HasPrefix(info.Name(), ".") { + return filepath.SkipDir + } + return nil + } + + // Don't process paths which don't match any include filter. + var shouldIncludePath bool + for _, includeFilter := range includeFilters { + pathMatches, err := includeFilter(path) + if err != nil { + panic(err) + } + + if pathMatches { + shouldIncludePath = true + break + } + } + if !shouldIncludePath { + return nil + } + + // Don't process paths which match any exclude filter. + var shouldExcludePath bool + for _, excludeFilter := range excludeFilters { + pathMatches, err := excludeFilter(path) + if err != nil { + panic(err) + } + + if pathMatches { + shouldExcludePath = true + break + } + } + if shouldExcludePath { + return nil + } + + *filesToProcess = append(*filesToProcess, path) + + return nil + } +} diff --git a/x/application/client/cli/tx.go b/x/application/client/cli/tx.go index cb09f9b3f..3f5179054 100644 --- a/x/application/client/cli/tx.go +++ b/x/application/client/cli/tx.go @@ -4,9 +4,9 @@ import ( "fmt" "time" + "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" "github.com/pokt-network/poktroll/x/application/types" ) diff --git a/x/application/module.go b/x/application/module.go index 44ba01150..472a6b6a1 100644 --- a/x/application/module.go +++ b/x/application/module.go @@ -5,18 +5,14 @@ import ( "encoding/json" "fmt" - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/application/client/cli" "github.com/pokt-network/poktroll/x/application/keeper" diff --git a/x/application/simulation/delegate_to_gateway.go b/x/application/simulation/delegate_to_gateway.go index 37070e16e..5339bd7f4 100644 --- a/x/application/simulation/delegate_to_gateway.go +++ b/x/application/simulation/delegate_to_gateway.go @@ -3,12 +3,12 @@ package simulation import ( "math/rand" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" ) func SimulateMsgDelegateToGateway( diff --git a/x/application/simulation/undelegate_from_gateway.go b/x/application/simulation/undelegate_from_gateway.go index 9ada988fd..36e1f4776 100644 --- a/x/application/simulation/undelegate_from_gateway.go +++ b/x/application/simulation/undelegate_from_gateway.go @@ -3,12 +3,12 @@ package simulation import ( "math/rand" - "github.com/pokt-network/poktroll/x/application/keeper" - "github.com/pokt-network/poktroll/x/application/types" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + + "github.com/pokt-network/poktroll/x/application/keeper" + "github.com/pokt-network/poktroll/x/application/types" ) func SimulateMsgUndelegateFromGateway( diff --git a/x/application/simulation/unstake_application.go b/x/application/simulation/unstake_application.go index 3dcccd3b5..9c6b556ab 100644 --- a/x/application/simulation/unstake_application.go +++ b/x/application/simulation/unstake_application.go @@ -4,7 +4,6 @@ import ( "math/rand" "github.com/cosmos/cosmos-sdk/baseapp" - sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" diff --git a/x/gateway/client/cli/tx.go b/x/gateway/client/cli/tx.go index 52be2fb88..413193f8e 100644 --- a/x/gateway/client/cli/tx.go +++ b/x/gateway/client/cli/tx.go @@ -4,9 +4,9 @@ import ( "fmt" "time" + "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" "github.com/pokt-network/poktroll/x/gateway/types" ) diff --git a/x/gateway/module.go b/x/gateway/module.go index 86f16fb7c..1c19cfe4f 100644 --- a/x/gateway/module.go +++ b/x/gateway/module.go @@ -5,18 +5,14 @@ import ( "encoding/json" "fmt" - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/gateway/client/cli" "github.com/pokt-network/poktroll/x/gateway/keeper" diff --git a/x/gateway/module_simulation.go b/x/gateway/module_simulation.go index 0aab36ae9..c4b468c9d 100644 --- a/x/gateway/module_simulation.go +++ b/x/gateway/module_simulation.go @@ -3,15 +3,15 @@ package gateway import ( "math/rand" - "github.com/pokt-network/poktroll/testutil/sample" - gatewaysimulation "github.com/pokt-network/poktroll/x/gateway/simulation" - "github.com/pokt-network/poktroll/x/gateway/types" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/pokt-network/poktroll/testutil/sample" + gatewaysimulation "github.com/pokt-network/poktroll/x/gateway/simulation" + "github.com/pokt-network/poktroll/x/gateway/types" ) // avoid unused import issue diff --git a/x/pocket/client/cli/tx.go b/x/pocket/client/cli/tx.go index 70032b9b8..393059a42 100644 --- a/x/pocket/client/cli/tx.go +++ b/x/pocket/client/cli/tx.go @@ -4,9 +4,9 @@ import ( "fmt" "time" + "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" "github.com/pokt-network/poktroll/x/pocket/types" ) diff --git a/x/pocket/module.go b/x/pocket/module.go index 684ea1d95..e8569ded2 100644 --- a/x/pocket/module.go +++ b/x/pocket/module.go @@ -5,18 +5,14 @@ import ( "encoding/json" "fmt" - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/pocket/client/cli" "github.com/pokt-network/poktroll/x/pocket/keeper" diff --git a/x/service/client/cli/tx.go b/x/service/client/cli/tx.go index 38c85ed8f..10102c0f0 100644 --- a/x/service/client/cli/tx.go +++ b/x/service/client/cli/tx.go @@ -4,9 +4,9 @@ import ( "fmt" "time" + "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" "github.com/pokt-network/poktroll/x/service/types" ) diff --git a/x/service/module.go b/x/service/module.go index a7ebd35f2..d1cb2373a 100644 --- a/x/service/module.go +++ b/x/service/module.go @@ -5,18 +5,14 @@ import ( "encoding/json" "fmt" - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/service/client/cli" "github.com/pokt-network/poktroll/x/service/keeper" diff --git a/x/service/simulation/add_service.go b/x/service/simulation/add_service.go index f6ebdb485..0bf5554d3 100644 --- a/x/service/simulation/add_service.go +++ b/x/service/simulation/add_service.go @@ -6,6 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" + "github.com/pokt-network/poktroll/x/service/keeper" "github.com/pokt-network/poktroll/x/service/types" ) diff --git a/x/session/client/cli/tx.go b/x/session/client/cli/tx.go index 248ae5237..5b6778736 100644 --- a/x/session/client/cli/tx.go +++ b/x/session/client/cli/tx.go @@ -4,9 +4,9 @@ import ( "fmt" "time" + "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" "github.com/pokt-network/poktroll/x/session/types" ) diff --git a/x/supplier/module.go b/x/supplier/module.go index a39dc9303..e3a34d61d 100644 --- a/x/supplier/module.go +++ b/x/supplier/module.go @@ -5,18 +5,14 @@ import ( "encoding/json" "fmt" - // this line is used by starport scaffolding # 1 - - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" - abci "github.com/cometbft/cometbft/abci/types" - "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/supplier/client/cli" "github.com/pokt-network/poktroll/x/supplier/keeper" diff --git a/x/supplier/module_simulation.go b/x/supplier/module_simulation.go index eb30e7dd3..6ae9852e8 100644 --- a/x/supplier/module_simulation.go +++ b/x/supplier/module_simulation.go @@ -3,15 +3,15 @@ package supplier import ( "math/rand" - "github.com/pokt-network/poktroll/testutil/sample" - suppliersimulation "github.com/pokt-network/poktroll/x/supplier/simulation" - "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/cosmos/cosmos-sdk/baseapp" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" + + "github.com/pokt-network/poktroll/testutil/sample" + suppliersimulation "github.com/pokt-network/poktroll/x/supplier/simulation" + "github.com/pokt-network/poktroll/x/supplier/types" ) // avoid unused import issue diff --git a/x/tokenomics/client/cli/tx.go b/x/tokenomics/client/cli/tx.go index ca73e6c23..da7d07742 100644 --- a/x/tokenomics/client/cli/tx.go +++ b/x/tokenomics/client/cli/tx.go @@ -4,9 +4,9 @@ import ( "fmt" "time" + "github.com/cosmos/cosmos-sdk/client" "github.com/spf13/cobra" - "github.com/cosmos/cosmos-sdk/client" // "github.com/cosmos/cosmos-sdk/client/flags" "github.com/pokt-network/poktroll/x/tokenomics/types" ) diff --git a/x/tokenomics/module.go b/x/tokenomics/module.go index e88612416..e54983755 100644 --- a/x/tokenomics/module.go +++ b/x/tokenomics/module.go @@ -5,8 +5,6 @@ import ( "encoding/json" "fmt" - // this line is used by starport scaffolding # 1 - abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" From 8fd7aaf4a2f821a1f73c379aff3face6f54c4a06 Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 21:30:12 +0000 Subject: [PATCH 11/61] chore: remove cmd print in script --- tools/scripts/gci/main.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/tools/scripts/gci/main.go b/tools/scripts/gci/main.go index b05265cc3..c97eadfad 100644 --- a/tools/scripts/gci/main.go +++ b/tools/scripts/gci/main.go @@ -48,9 +48,6 @@ func main() { // Run gci on all accumulated files - this writes changes in place if len(filesToProcess) > 0 { - cmdToRun := append([]string{"gci", "write"}, defaultArgs...) - cmdToRun = append(cmdToRun, filesToProcess...) - fmt.Printf("Running: %s\n", cmdToRun) args := defaultArgs args = append(args, filesToProcess...) cmd := exec.Command("gci", append([]string{"write"}, args...)...) From 2ba6dfc74a38ffd86126b695256f06d69adc6f8d Mon Sep 17 00:00:00 2001 From: h5law Date: Fri, 12 Jan 2024 21:31:08 +0000 Subject: [PATCH 12/61] chore: remove custom linting section from gci --- .golangci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 6fc44eba2..eb3ddf432 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -22,7 +22,6 @@ linters-settings: sections: - standard # std lib - default # external - - custom # internal - prefix(github.com/pokt-network/poktroll) # local imports skip-generated: true custom-order: true From 24c1195622d29e786568d5d96978f617ad469bc9 Mon Sep 17 00:00:00 2001 From: h5law Date: Sat, 13 Jan 2024 00:57:23 +0000 Subject: [PATCH 13/61] chore: address more linter errors --- .golangci.yml | 2 - pkg/polylog/godoc.go | 3 +- pkg/relayer/session/session.go | 24 ++++++---- testutil/keeper/application.go | 16 ++++++- testutil/keeper/gateway.go | 17 ++++++- testutil/keeper/pocket.go | 1 + testutil/keeper/service.go | 1 + testutil/keeper/supplier.go | 29 ++++++++++-- testutil/keeper/tokenomics.go | 1 + testutil/network/network.go | 26 +++++++---- testutil/testpolylog/event.go | 14 +++++- .../client/cli/tx_delegate_to_gateway.go | 2 +- .../client/cli/tx_stake_application.go | 2 +- .../client/cli/tx_undelegate_from_gateway.go | 1 + .../client/cli/tx_unstake_application.go | 2 +- .../keeper/msg_server_delegate_to_gateway.go | 21 +++++++-- .../keeper/msg_server_stake_application.go | 46 ++++++++++++++----- .../keeper/msg_server_unstake_application.go | 11 ++++- x/application/keeper/query_application.go | 17 +++++-- x/application/types/expected_keepers.go | 14 +++++- x/application/types/params.go | 7 ++- x/gateway/client/cli/tx_stake_gateway.go | 2 +- x/gateway/client/cli/tx_unstake_gateway.go | 1 + x/session/types/query_get_session_request.go | 21 +++++++-- x/supplier/client/cli/query_claim.go | 10 +++- x/supplier/client/cli/tx_stake_supplier.go | 3 +- x/supplier/client/cli/tx_unstake_supplier.go | 4 +- x/supplier/types/expected_keepers.go | 20 ++++++-- x/supplier/types/key_claim.go | 30 ++++++------ x/supplier/types/message_create_claim.go | 40 +++++++++++++--- 30 files changed, 300 insertions(+), 88 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index eb3ddf432..fc4eb85ac 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -8,7 +8,6 @@ linters: # - errcheck # - unused - gofumpt - - goimports - lll - gci @@ -46,7 +45,6 @@ issues: - gci - lll - gofumpt - - goimports # Exclude cosmos-sdk module module.go files as they are generated with unused # parameters and unchecked errors. - path: ^x/.+/module\.go$ diff --git a/pkg/polylog/godoc.go b/pkg/polylog/godoc.go index e3f759007..1d454b25f 100644 --- a/pkg/polylog/godoc.go +++ b/pkg/polylog/godoc.go @@ -7,7 +7,8 @@ // of this packages consumers as well as any future ambitions to (and implications // thereof) adding support for adapting to additional logging libraries. // -// It is intended to initially support the go std `log`, `github.com/rs/zerolog` and `go.uber.org/zap` logging libraries: +// It is intended to initially support the go std `log`, `github.com/rs/zerolog` +// and `go.uber.org/zap` logging libraries: // // - https://pkg.go.dev/log@go1.21.4 // diff --git a/pkg/relayer/session/session.go b/pkg/relayer/session/session.go index 984d26648..034e3fe77 100644 --- a/pkg/relayer/session/session.go +++ b/pkg/relayer/session/session.go @@ -129,7 +129,9 @@ func (rs *relayerSessionsManager) InsertRelays(relays relayer.MinedRelaysObserva // ensureSessionTree returns the SessionTree for a given session. // If no tree for the session exists, a new SessionTree is created before returning. -func (rs *relayerSessionsManager) ensureSessionTree(sessionHeader *sessiontypes.SessionHeader) (relayer.SessionTree, error) { +func (rs *relayerSessionsManager) ensureSessionTree( + sessionHeader *sessiontypes.SessionHeader, +) (relayer.SessionTree, error) { sessionsTrees, ok := rs.sessionsTrees[sessionHeader.SessionEndBlockHeight] // If there is no map for sessions at the sessionEndHeight, create one. @@ -144,7 +146,9 @@ func (rs *relayerSessionsManager) ensureSessionTree(sessionHeader *sessiontypes. // If the sessionTree does not exist, create it. var err error if !ok { - sessionTree, err = NewSessionTree(sessionHeader, rs.storesDirectory, rs.removeFromRelayerSessions) + sessionTree, err = NewSessionTree( + sessionHeader, rs.storesDirectory, rs.removeFromRelayerSessions, + ) if err != nil { return nil, err } @@ -169,11 +173,13 @@ func (rs *relayerSessionsManager) mapBlockToSessionsToClaim( // Iterate over the sessionsTrees map to get the ones that end at a block height // lower than the current block height. for endBlockHeight, sessionsTreesEndingAtBlockHeight := range rs.sessionsTrees { - // TODO_BLOCKER(@red-0ne): We need this to be == instead of <= because we don't want to keep sending - // the same session while waiting the next step. This does not address the case - // where the block client misses the target block which should be handled by the - // retry mechanism. See the discussion in the following GitHub thread for next - // steps: https://github.com/pokt-network/poktroll/pull/177/files?show-viewed-files=true&file-filters%5B%5D=#r1391957041 + // TODO_BLOCKER(@red-0ne): We need this to be == instead of <= because + // we don't want to keep sending the same session while waiting the next + // step. This does not address the case where the block client misses + // the target block which should be handled by the retry mechanism. See + // the discussion in the following GitHub thread for next steps: + // nolint:lll + // https://github.com/pokt-network/poktroll/pull/177/files?show-viewed-files=true&file-filters%5B%5D=#r1391957041 if endBlockHeight == block.Height() { // Iterate over the sessionsTrees that end at this block height (or // less) and add them to the list of sessionTrees to be published. @@ -209,8 +215,8 @@ func (rs *relayerSessionsManager) removeFromRelayerSessions(sessionHeader *sessi // validateConfig validates the relayerSessionsManager's configuration. // TODO_TEST: Add unit tests to validate these configurations. -func (rp *relayerSessionsManager) validateConfig() error { - if rp.storesDirectory == "" { +func (rs *relayerSessionsManager) validateConfig() error { + if rs.storesDirectory == "" { return ErrSessionTreeUndefinedStoresDirectory } diff --git a/testutil/keeper/application.go b/testutil/keeper/application.go index e9248b622..f7aa3b3ed 100644 --- a/testutil/keeper/application.go +++ b/testutil/keeper/application.go @@ -44,8 +44,20 @@ func ApplicationKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { ctrl := gomock.NewController(t) mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() - mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() + mockBankKeeper.EXPECT(). + DelegateCoinsFromAccountToModule( + gomock.Any(), + gomock.Any(), + types.ModuleName, + gomock.Any()). + AnyTimes() + mockBankKeeper.EXPECT(). + UndelegateCoinsFromModuleToAccount( + gomock.Any(), + types.ModuleName, + gomock.Any(), + gomock.Any()). + AnyTimes() mockAccountKeeper := mocks.NewMockAccountKeeper(ctrl) mockAccountKeeper.EXPECT().GetAccount(gomock.Any(), gomock.Any()).AnyTimes() diff --git a/testutil/keeper/gateway.go b/testutil/keeper/gateway.go index 7a7fa84bb..28d6ad380 100644 --- a/testutil/keeper/gateway.go +++ b/testutil/keeper/gateway.go @@ -20,6 +20,7 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) +// GatewayKeeper returns a mocked gateway keeper and context for testing. func GatewayKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) @@ -35,8 +36,20 @@ func GatewayKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { ctrl := gomock.NewController(t) mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() - mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() + mockBankKeeper.EXPECT(). + DelegateCoinsFromAccountToModule( + gomock.Any(), + gomock.Any(), + types.ModuleName, + gomock.Any()). + AnyTimes() + mockBankKeeper.EXPECT(). + UndelegateCoinsFromModuleToAccount( + gomock.Any(), + types.ModuleName, + gomock.Any(), + gomock.Any()). + AnyTimes() paramsSubspace := typesparams.NewSubspace(cdc, types.Amino, diff --git a/testutil/keeper/pocket.go b/testutil/keeper/pocket.go index cebf1b0bf..927eaa5de 100644 --- a/testutil/keeper/pocket.go +++ b/testutil/keeper/pocket.go @@ -18,6 +18,7 @@ import ( "github.com/pokt-network/poktroll/x/pocket/types" ) +// PocketKeeper returns a mocked pocket keeper and context for testing. func PocketKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) diff --git a/testutil/keeper/service.go b/testutil/keeper/service.go index 3bdb9f219..3e360a2ca 100644 --- a/testutil/keeper/service.go +++ b/testutil/keeper/service.go @@ -18,6 +18,7 @@ import ( "github.com/pokt-network/poktroll/x/service/types" ) +// ServiceKeeper returns a mocked service keeper and context for testing. func ServiceKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) diff --git a/testutil/keeper/supplier.go b/testutil/keeper/supplier.go index 8bd600c27..f34ab3b16 100644 --- a/testutil/keeper/supplier.go +++ b/testutil/keeper/supplier.go @@ -22,7 +22,11 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func SupplierKeeper(t testing.TB, sessionByAppAddr supplier.SessionsByAppAddress) (*keeper.Keeper, sdk.Context) { +// SupplierKeeper returns a mocked supplier keeper and context for testing. +func SupplierKeeper( + t testing.TB, + sessionByAppAddr supplier.SessionsByAppAddress, +) (*keeper.Keeper, sdk.Context) { t.Helper() storeKey := sdk.NewKVStoreKey(types.StoreKey) @@ -39,8 +43,20 @@ func SupplierKeeper(t testing.TB, sessionByAppAddr supplier.SessionsByAppAddress ctrl := gomock.NewController(t) mockBankKeeper := mocks.NewMockBankKeeper(ctrl) - mockBankKeeper.EXPECT().DelegateCoinsFromAccountToModule(gomock.Any(), gomock.Any(), types.ModuleName, gomock.Any()).AnyTimes() - mockBankKeeper.EXPECT().UndelegateCoinsFromModuleToAccount(gomock.Any(), types.ModuleName, gomock.Any(), gomock.Any()).AnyTimes() + mockBankKeeper.EXPECT(). + DelegateCoinsFromAccountToModule( + gomock.Any(), + gomock.Any(), + types.ModuleName, + gomock.Any()). + AnyTimes() + mockBankKeeper.EXPECT(). + UndelegateCoinsFromModuleToAccount( + gomock.Any(), + types.ModuleName, + gomock.Any(), + gomock.Any()). + AnyTimes() mockSessionKeeper := mocks.NewMockSessionKeeper(ctrl) mockSessionKeeper.EXPECT(). @@ -51,7 +67,12 @@ func SupplierKeeper(t testing.TB, sessionByAppAddr supplier.SessionsByAppAddress req *sessiontypes.QueryGetSessionRequest, ) (*sessiontypes.QueryGetSessionResponse, error) { session, ok := sessionByAppAddr[req.GetApplicationAddress()] - require.Truef(t, ok, "application address not provided during mock construction: %q", req.ApplicationAddress) + require.Truef( + t, + ok, + "application address not provided during mock construction: %q", + req.ApplicationAddress, + ) return &sessiontypes.QueryGetSessionResponse{ Session: &sessiontypes.Session{ diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go index bf33cb087..3c2e72993 100644 --- a/testutil/keeper/tokenomics.go +++ b/testutil/keeper/tokenomics.go @@ -18,6 +18,7 @@ import ( "github.com/pokt-network/poktroll/x/tokenomics/types" ) +// TokenomicsKeeper returns a mocked tokenomics keeper and context for testing. func TokenomicsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) diff --git a/testutil/network/network.go b/testutil/network/network.go index 4a57a2f4e..0065c4d86 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -32,8 +32,12 @@ import ( ) type ( + // Network is a type alias for the cosmos-sdk type that represents + // and in-memory network. And is intended to be used in tests. Network = network.Network - Config = network.Config + // Config is a type alias for the cosmos-sdk type that represents + // the config of an in-memory network. + Config = network.Config ) // New creates instance with fully configured cosmos network. @@ -57,7 +61,8 @@ func New(t *testing.T, configs ...Config) *Network { } // DefaultConfig will initialize config for the network with custom application, -// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig +// genesis and single validator. All other parameters are inherited from +// cosmos-sdk/testutil/network.DefaultConfig func DefaultConfig() network.Config { var ( encoding = app.MakeEncodingConfig() @@ -104,8 +109,8 @@ func DefaultConfig() network.Config { // TODO_CLEANUP: Refactor the genesis state helpers below to consolidate usage // and reduce the code footprint. -// DefaultApplicationModuleGenesisState generates a GenesisState object with a given number of applications. -// It returns the populated GenesisState object. +// DefaultApplicationModuleGenesisState generates a GenesisState object with a +// given number of applications. It returns the populated GenesisState object. func DefaultApplicationModuleGenesisState(t *testing.T, n int) *apptypes.GenesisState { t.Helper() state := apptypes.DefaultGenesis() @@ -123,15 +128,16 @@ func DefaultApplicationModuleGenesisState(t *testing.T, n int) *apptypes.Genesis }, }, } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere + // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we + // should enforce `(gogoproto.nullable) = false` everywhere // nullify.Fill(&application) state.ApplicationList = append(state.ApplicationList, application) } return state } -// ApplicationModuleGenesisStateWithAccount generates a GenesisState object with -// a single application for each of the given addresses. +// ApplicationModuleGenesisStateWithAddresses generates a GenesisState object +// with a single application for each of the given addresses. func ApplicationModuleGenesisStateWithAddresses(t *testing.T, addresses []string) *apptypes.GenesisState { t.Helper() state := apptypes.DefaultGenesis() @@ -173,7 +179,8 @@ func DefaultSupplierModuleGenesisState(t *testing.T, n int) *suppliertypes.Genes }, }, } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere + // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we + // should enforce `(gogoproto.nullable) = false` everywhere // nullify.Fill(&supplier) state.SupplierList = append(state.SupplierList, supplier) } @@ -218,7 +225,8 @@ func DefaultGatewayModuleGenesisState(t *testing.T, n int) *gatewaytypes.Genesis Address: sample.AccAddress(), Stake: &stake, } - // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we should enforce `(gogoproto.nullable) = false` everywhere + // TODO_CONSIDERATION: Evaluate whether we need `nullify.Fill` or if we + // should enforce `(gogoproto.nullable) = false` everywhere // nullify.Fill(&gateway) state.GatewayList = append(state.GatewayList, gateway) } diff --git a/testutil/testpolylog/event.go b/testutil/testpolylog/event.go index c41708c13..7da11c0a1 100644 --- a/testutil/testpolylog/event.go +++ b/testutil/testpolylog/event.go @@ -111,8 +111,18 @@ func RunEventMethodTests( // Ensure that calls to #Msg(), #Msgf(), and #Send() are mutually exclusive. switch { case tt.Msg != "": - require.Emptyf(t, tt.MsgFmt, "Msg and MsgFmt are mutually exclusive but MsgFmt was not empty: %s", tt.MsgFmt) - require.Emptyf(t, tt.MsgFmtArgs, "Msg and MsgFmt are mutually exclusive but MsgFmtArgs was not empty: %v", tt.MsgFmtArgs) + require.Emptyf( + t, + tt.MsgFmt, + "Msg and MsgFmt are mutually exclusive but MsgFmt was not empty: %s", + tt.MsgFmt, + ) + require.Emptyf( + t, + tt.MsgFmtArgs, + "Msg and MsgFmt are mutually exclusive but MsgFmtArgs was not empty: %v", + tt.MsgFmtArgs, + ) // Set up call args for polylog.Event#Msg() if tt.msg is not empty. doneMethodName = "Msg" diff --git a/x/application/client/cli/tx_delegate_to_gateway.go b/x/application/client/cli/tx_delegate_to_gateway.go index f1363e6db..eae51917c 100644 --- a/x/application/client/cli/tx_delegate_to_gateway.go +++ b/x/application/client/cli/tx_delegate_to_gateway.go @@ -22,7 +22,7 @@ that delegates authority to the gateway specified to sign relays requests for th act on the behalf of the application during a session. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, +$ poktrolld --home=$(POKTROLLD_HOME) tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, //nolint:lll Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { gatewayAddress := args[0] diff --git a/x/application/client/cli/tx_stake_application.go b/x/application/client/cli/tx_stake_application.go index 1c8f23dda..80fbb2143 100644 --- a/x/application/client/cli/tx_stake_application.go +++ b/x/application/client/cli/tx_stake_application.go @@ -27,7 +27,7 @@ func CmdStakeApplication() *cobra.Command { will stake the tokens and serviceIds and associate them with the application specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application stake-application --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, + $ poktrolld --home=$(POKTROLLD_HOME) tx application stake-application --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, //nolint:lll Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { configContent, err := os.ReadFile(flagStakeConfig) diff --git a/x/application/client/cli/tx_undelegate_from_gateway.go b/x/application/client/cli/tx_undelegate_from_gateway.go index 7a30d1b8a..cf5308006 100644 --- a/x/application/client/cli/tx_undelegate_from_gateway.go +++ b/x/application/client/cli/tx_undelegate_from_gateway.go @@ -17,6 +17,7 @@ func CmdUndelegateFromGateway() *cobra.Command { cmd := &cobra.Command{ Use: "undelegate-from-gateway [gateway address]", Short: "Undelegate an application from a gateway", + //nolint:lll Long: `Undelegate an application from the gateway with the provided address. This is a broadcast operation that removes the authority from the gateway specified to sign relays requests for the application, disallowing the gateway act on the behalf of the application during a session. diff --git a/x/application/client/cli/tx_unstake_application.go b/x/application/client/cli/tx_unstake_application.go index 3dea29b5e..dc3aac92b 100644 --- a/x/application/client/cli/tx_unstake_application.go +++ b/x/application/client/cli/tx_unstake_application.go @@ -22,7 +22,7 @@ func CmdUnstakeApplication() *cobra.Command { the application specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, +$ poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, //nolint:lll Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/x/application/keeper/msg_server_delegate_to_gateway.go b/x/application/keeper/msg_server_delegate_to_gateway.go index 11dea867f..24a9252b3 100644 --- a/x/application/keeper/msg_server_delegate_to_gateway.go +++ b/x/application/keeper/msg_server_delegate_to_gateway.go @@ -10,7 +10,11 @@ import ( "github.com/pokt-network/poktroll/x/application/types" ) -func (k msgServer) DelegateToGateway(goCtx context.Context, msg *types.MsgDelegateToGateway) (*types.MsgDelegateToGatewayResponse, error) { +// DelegateToGateway delegates an application to a gateway handling the message. +func (k msgServer) DelegateToGateway( + goCtx context.Context, + msg *types.MsgDelegateToGateway, +) (*types.MsgDelegateToGatewayResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) logger := k.Logger(ctx).With("method", "DelegateToGateway") @@ -32,21 +36,30 @@ func (k msgServer) DelegateToGateway(goCtx context.Context, msg *types.MsgDelega // Check if the gateway is staked if _, found := k.gatewayKeeper.GetGateway(ctx, msg.GatewayAddress); !found { logger.Info(fmt.Sprintf("Gateway not found with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppGatewayNotFound, "gateway not found with address: %s", msg.GatewayAddress) + return nil, sdkerrors.Wrapf( + types.ErrAppGatewayNotFound, + "gateway not found with address: %s", msg.GatewayAddress, + ) } // Ensure the application is not already delegated to the maximum number of gateways maxDelegatedParam := k.GetParams(ctx).MaxDelegatedGateways if int64(len(app.DelegateeGatewayAddresses)) >= maxDelegatedParam { logger.Info(fmt.Sprintf("Application already delegated to maximum number of gateways: %d", maxDelegatedParam)) - return nil, sdkerrors.Wrapf(types.ErrAppMaxDelegatedGateways, "application already delegated to %d gateways", maxDelegatedParam) + return nil, sdkerrors.Wrapf( + types.ErrAppMaxDelegatedGateways, + "application already delegated to %d gateways", maxDelegatedParam, + ) } // Check if the application is already delegated to the gateway for _, gatewayAddr := range app.DelegateeGatewayAddresses { if gatewayAddr == msg.GatewayAddress { logger.Info(fmt.Sprintf("Application already delegated to gateway with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppAlreadyDelegated, "application already delegated to gateway with address: %s", msg.GatewayAddress) + return nil, sdkerrors.Wrapf( + types.ErrAppAlreadyDelegated, + "application already delegated to gateway with address: %s", msg.GatewayAddress, + ) } } diff --git a/x/application/keeper/msg_server_stake_application.go b/x/application/keeper/msg_server_stake_application.go index da22a134e..f11fdba54 100644 --- a/x/application/keeper/msg_server_stake_application.go +++ b/x/application/keeper/msg_server_stake_application.go @@ -10,6 +10,7 @@ import ( "github.com/pokt-network/poktroll/x/application/types" ) +// StakeApplication stakes an application handling the message request. func (k msgServer) StakeApplication( goCtx context.Context, msg *types.MsgStakeApplication, @@ -29,13 +30,21 @@ func (k msgServer) StakeApplication( var coinsToDelegate sdk.Coin app, isAppFound := k.GetApplication(ctx, msg.Address) if !isAppFound { - logger.Info(fmt.Sprintf("Application not found. Creating new application for address %s", msg.Address)) - app = k.createApplication(ctx, msg) + logger.Info( + fmt.Sprintf( + "Application not found. Creating new application for address %s", msg.Address, + ), + ) + app = k.createApplication(msg) coinsToDelegate = *msg.Stake } else { - logger.Info(fmt.Sprintf("Application found. Updating application for address %s", msg.Address)) + logger.Info( + fmt.Sprintf( + "Application found. Updating application for address %s", msg.Address, + ), + ) currAppStake := *app.Stake - if err = k.updateApplication(ctx, &app, msg); err != nil { + if err = k.updateApplication(&app, msg); err != nil { return nil, err } coinsToDelegate = (*msg.Stake).Sub(currAppStake) @@ -50,9 +59,16 @@ func (k msgServer) StakeApplication( // TODO_IMPROVE: Should we avoid making this call if `coinsToDelegate` = 0? // Send the coins from the application to the staked application pool - err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, appAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) + err = k.bankKeeper.DelegateCoinsFromAccountToModule( + ctx, appAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}, + ) if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, appAddress, types.ModuleName, err)) + logger.Error( + fmt.Sprintf( + "could not send %v coins from %s to %s module account due to %v", + coinsToDelegate, appAddress, types.ModuleName, err, + ), + ) return nil, err } @@ -63,8 +79,8 @@ func (k msgServer) StakeApplication( return &types.MsgStakeApplicationResponse{}, nil } +// createApplication creates and applications from the given message. func (k msgServer) createApplication( - ctx sdk.Context, msg *types.MsgStakeApplication, ) types.Application { return types.Application{ @@ -75,14 +91,17 @@ func (k msgServer) createApplication( } } +// updateApplication updates an application from the given application and message. func (k msgServer) updateApplication( - ctx sdk.Context, app *types.Application, msg *types.MsgStakeApplication, ) error { // Checks if the the msg address is the same as the current owner if msg.Address != app.Address { - return sdkerrors.Wrapf(types.ErrAppUnauthorized, "msg Address (%s) != application address (%s)", msg.Address, app.Address) + return sdkerrors.Wrapf( + types.ErrAppUnauthorized, + "msg Address (%s) != application address (%s)", msg.Address, app.Address, + ) } // Validate that the stake is not being lowered @@ -90,14 +109,19 @@ func (k msgServer) updateApplication( return sdkerrors.Wrapf(types.ErrAppInvalidStake, "stake amount cannot be nil") } if msg.Stake.IsLTE(*app.Stake) { - return sdkerrors.Wrapf(types.ErrAppInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, app.Stake) + return sdkerrors.Wrapf( + types.ErrAppInvalidStake, + "stake amount %v must be higher than previous stake amount %v", msg.Stake, app.Stake, + ) } app.Stake = msg.Stake // Validate that the service configs maintain at least one service. // Additional validation is done in `msg.ValidateBasic` above. if len(msg.Services) == 0 { - return sdkerrors.Wrapf(types.ErrAppInvalidServiceConfigs, "must have at least one service") + return sdkerrors.Wrapf( + types.ErrAppInvalidServiceConfigs, "must have at least one service", + ) } app.ServiceConfigs = msg.Services diff --git a/x/application/keeper/msg_server_unstake_application.go b/x/application/keeper/msg_server_unstake_application.go index d6f582aaa..a05510d3d 100644 --- a/x/application/keeper/msg_server_unstake_application.go +++ b/x/application/keeper/msg_server_unstake_application.go @@ -36,9 +36,16 @@ func (k msgServer) UnstakeApplication( } // Send the coins from the application pool back to the application - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, appAddress, []sdk.Coin{*app.Stake}) + err = k.bankKeeper.UndelegateCoinsFromModuleToAccount( + ctx, types.ModuleName, appAddress, []sdk.Coin{*app.Stake}, + ) if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", app.Stake, appAddress, types.ModuleName, err)) + logger.Error( + fmt.Sprintf( + "could not send %v coins from %s module to %s account due to %v", + app.Stake, appAddress, types.ModuleName, err, + ), + ) return nil, err } diff --git a/x/application/keeper/query_application.go b/x/application/keeper/query_application.go index 9c559dd6f..a2ec405ad 100644 --- a/x/application/keeper/query_application.go +++ b/x/application/keeper/query_application.go @@ -13,7 +13,11 @@ import ( "github.com/pokt-network/poktroll/x/application/types" ) -func (k Keeper) ApplicationAll(goCtx context.Context, req *types.QueryAllApplicationRequest) (*types.QueryAllApplicationResponse, error) { +// ApplicationAll returns all applications handling the query. +func (k Keeper) ApplicationAll( + goCtx context.Context, + req *types.QueryAllApplicationRequest, +) (*types.QueryAllApplicationResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -40,7 +44,11 @@ func (k Keeper) ApplicationAll(goCtx context.Context, req *types.QueryAllApplica return &types.QueryAllApplicationResponse{Application: applications, Pagination: pageRes}, nil } -func (k Keeper) Application(goCtx context.Context, req *types.QueryGetApplicationRequest) (*types.QueryGetApplicationResponse, error) { +// Application returns the desired application handling the query. +func (k Keeper) Application( + goCtx context.Context, + req *types.QueryGetApplicationRequest, +) (*types.QueryGetApplicationResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -51,7 +59,10 @@ func (k Keeper) Application(goCtx context.Context, req *types.QueryGetApplicatio req.Address, ) if !found { - return nil, status.Error(codes.NotFound, fmt.Sprintf("application not found: address %s", req.Address)) + return nil, status.Error( + codes.NotFound, + fmt.Sprintf("application not found: address %s", req.Address), + ) } return &types.QueryGetApplicationResponse{Application: val}, nil diff --git a/x/application/types/expected_keepers.go b/x/application/types/expected_keepers.go index 55ab9222a..9cbfa0be1 100644 --- a/x/application/types/expected_keepers.go +++ b/x/application/types/expected_keepers.go @@ -16,8 +16,18 @@ type AccountKeeper interface { // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + DelegateCoinsFromAccountToModule( + ctx sdk.Context, + senderAddr sdk.AccAddress, + recipientModule string, + amt sdk.Coins, + ) error + UndelegateCoinsFromModuleToAccount( + ctx sdk.Context, + senderModule string, + recipientAddr sdk.AccAddress, + amt sdk.Coins, + ) error } // GatewayKeeper defines the expected interface needed to retrieve gateway information. diff --git a/x/application/types/params.go b/x/application/types/params.go index f5ec7cd0c..ce6b15441 100644 --- a/x/application/types/params.go +++ b/x/application/types/params.go @@ -6,6 +6,8 @@ import ( "gopkg.in/yaml.v2" ) +// DefaultMaxDelegatedGateways is the default max number of delegated gateways +// an application can have. // TODO: Revisit default param values const DefaultMaxDelegatedGateways int64 = 7 @@ -34,7 +36,10 @@ func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { // Validate validates the set of params func (p Params) Validate() error { if p.MaxDelegatedGateways < 1 { - return sdkerrors.Wrapf(ErrAppInvalidMaxDelegatedGateways, "MaxDelegatedGateways param < 1: got %d", p.MaxDelegatedGateways) + return sdkerrors.Wrapf( + ErrAppInvalidMaxDelegatedGateways, + "MaxDelegatedGateways param < 1: got %d", p.MaxDelegatedGateways, + ) } return nil } diff --git a/x/gateway/client/cli/tx_stake_gateway.go b/x/gateway/client/cli/tx_stake_gateway.go index 3369f3885..7a7aa026f 100644 --- a/x/gateway/client/cli/tx_stake_gateway.go +++ b/x/gateway/client/cli/tx_stake_gateway.go @@ -25,7 +25,7 @@ func CmdStakeGateway() *cobra.Command { Long: `Stake a gateway with the provided parameters. This is a broadcast operation that will stake the tokens and associate them with the gateway specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, + $ poktrolld --home=$(POKTROLLD_HOME) tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, // nolint:lll Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { configContent, err := os.ReadFile(flagStakeConfig) diff --git a/x/gateway/client/cli/tx_unstake_gateway.go b/x/gateway/client/cli/tx_unstake_gateway.go index e97406495..3beae12aa 100644 --- a/x/gateway/client/cli/tx_unstake_gateway.go +++ b/x/gateway/client/cli/tx_unstake_gateway.go @@ -18,6 +18,7 @@ func CmdUnstakeGateway() *cobra.Command { cmd := &cobra.Command{ Use: "unstake-gateway ", Short: "Unstake a gateway", + //nolint:lll Long: `Unstake a gateway. This is a broadcast operation that will unstake the gateway specified by the 'from' address. Example: diff --git a/x/session/types/query_get_session_request.go b/x/session/types/query_get_session_request.go index 31b705f8e..b6c6418ea 100644 --- a/x/session/types/query_get_session_request.go +++ b/x/session/types/query_get_session_request.go @@ -8,33 +8,44 @@ import ( sharedtypes "github.com/pokt-network/poktroll/x/shared/types" ) +// NewQueryGetSessionRequest generates a new QueryGetSessionRequest object. // NOTE: Please note that `QueryGetSessionRequest` is not a `sdk.Msg`, and is therefore not a message/request // that will be signable or invoke a state transition. However, following a similar `ValidateBasic` pattern // allows us to localize & reuse validation logic. -func NewQueryGetSessionRequest(appAddress, serviceId string, blockHeight int64) *QueryGetSessionRequest { +func NewQueryGetSessionRequest(appAddress, serviceID string, blockHeight int64) *QueryGetSessionRequest { return &QueryGetSessionRequest{ ApplicationAddress: appAddress, Service: &sharedtypes.Service{ - Id: serviceId, + Id: serviceID, }, BlockHeight: blockHeight, } } +// ValidateBasic performs basic validation on this query request. func (query *QueryGetSessionRequest) ValidateBasic() error { // Validate the application address if _, err := sdk.AccAddressFromBech32(query.ApplicationAddress); err != nil { - return sdkerrors.Wrapf(ErrSessionInvalidAppAddress, "invalid app address for session being retrieved %s; (%v)", query.ApplicationAddress, err) + return sdkerrors.Wrapf( + ErrSessionInvalidAppAddress, + "invalid app address for session being retrieved %s; (%v)", query.ApplicationAddress, err, + ) } // Validate the Service ID if !sharedhelpers.IsValidService(query.Service) { - return sdkerrors.Wrapf(ErrSessionInvalidService, "invalid service for session being retrieved %s;", query.Service) + return sdkerrors.Wrapf( + ErrSessionInvalidService, + "invalid service for session being retrieved %s;", query.Service, + ) } // Validate the height for which a session is being retrieved if query.BlockHeight < 0 { // Note that `0` defaults to the latest height rather than genesis - return sdkerrors.Wrapf(ErrSessionInvalidBlockHeight, "invalid block height for session being retrieved %d;", query.BlockHeight) + return sdkerrors.Wrapf( + ErrSessionInvalidBlockHeight, + "invalid block height for session being retrieved %d;", query.BlockHeight, + ) } return nil } diff --git a/x/supplier/client/cli/query_claim.go b/x/supplier/client/cli/query_claim.go index 6d110c0fa..90519b52f 100644 --- a/x/supplier/client/cli/query_claim.go +++ b/x/supplier/client/cli/query_claim.go @@ -27,6 +27,7 @@ func AddClaimFilterFlags(cmd *cobra.Command) { cmd.Flags().String(FlagSupplierAddress, "", "claims submitted by suppliers matching this address will be returned") } +// CmdListClaims creates a new lits-claims command. func CmdListClaims() *cobra.Command { cmd := &cobra.Command{ Use: "list-claims", @@ -78,10 +79,12 @@ $ poktrolld --home=$(POKTROLLD_HOME) q claim list-claims --supplier-address ", Short: "shows a specific claim", + //nolint:lll Long: `List a specific claim that the node being queried has access to (if it still exists). A unique claim can be defined via a ` + "`session_id`" + ` that the given ` + "`supplier`" + ` participated in. @@ -133,7 +136,12 @@ func updateClaimsFilter(cmd *cobra.Command, req *types.QueryAllClaimsRequest) er sessionEndHeight, _ := cmd.Flags().GetUint64(FlagSessionEndHeight) // Preparing a shared error in case more than one flag was set - err := fmt.Errorf("can only specify one flag filter but got sessionId (%s), supplierAddr (%s) and sessionEngHeight (%d)", sessionId, supplierAddr, sessionEndHeight) + err := fmt.Errorf( + "can only specify one flag filter but got sessionId (%s), supplierAddr (%s) and sessionEngHeight (%d)", + sessionId, + supplierAddr, + sessionEndHeight, + ) // Use the session id as the filter if sessionId != "" { diff --git a/x/supplier/client/cli/tx_stake_supplier.go b/x/supplier/client/cli/tx_stake_supplier.go index 2c611f817..ded993359 100644 --- a/x/supplier/client/cli/tx_stake_supplier.go +++ b/x/supplier/client/cli/tx_stake_supplier.go @@ -18,6 +18,7 @@ var ( _ = strconv.Itoa(0) // Part of the default ignite imports ) +// CmdStakeSupplier creates a new stake-supplier command. func CmdStakeSupplier() *cobra.Command { // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` cmd := &cobra.Command{ @@ -27,7 +28,7 @@ func CmdStakeSupplier() *cobra.Command { will stake the tokens and associate them with the supplier specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, +$ poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, //nolint:lll Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { diff --git a/x/supplier/client/cli/tx_unstake_supplier.go b/x/supplier/client/cli/tx_unstake_supplier.go index 0ed3a03e6..f28e8dbd5 100644 --- a/x/supplier/client/cli/tx_unstake_supplier.go +++ b/x/supplier/client/cli/tx_unstake_supplier.go @@ -9,15 +9,17 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) +// CmdUnstakeSupplier creates a new unstake-supplier command. func CmdUnstakeSupplier() *cobra.Command { // fromAddress & signature is retrieved via `flags.FlagFrom` in the `clientCtx` cmd := &cobra.Command{ Use: "unstake-supplier", Short: "Unstake a supplier", + // nolint:lll Long: `Unstake an supplier with the provided parameters. This is a broadcast operation that will unstake the supplier specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx supplier unstake-supplier --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE)`, + $ poktrolld --home=$(POKTROLLD_HOME) tx supplier unstake-supplier --keyring-backend test --from $(SUPPLIER) --node $(POCKET_NODE)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/x/supplier/types/expected_keepers.go b/x/supplier/types/expected_keepers.go index f6f8b626c..a451ab743 100644 --- a/x/supplier/types/expected_keepers.go +++ b/x/supplier/types/expected_keepers.go @@ -19,10 +19,24 @@ type AccountKeeper interface { // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + DelegateCoinsFromAccountToModule( + ctx sdk.Context, + senderAddr sdk.AccAddress, + recipientModule string, + amt sdk.Coins, + ) error + UndelegateCoinsFromModuleToAccount( + ctx sdk.Context, + senderModule string, + recipientAddr sdk.AccAddress, + amt sdk.Coins, + ) error } +// SessionKeeper defines the expected session keeper needed to retrieve sessions. type SessionKeeper interface { - GetSession(context.Context, *sessiontypes.QueryGetSessionRequest) (*sessiontypes.QueryGetSessionResponse, error) + GetSession( + context.Context, + *sessiontypes.QueryGetSessionRequest, + ) (*sessiontypes.QueryGetSessionResponse, error) } diff --git a/x/supplier/types/key_claim.go b/x/supplier/types/key_claim.go index e570a2341..0dc9003fe 100644 --- a/x/supplier/types/key_claim.go +++ b/x/supplier/types/key_claim.go @@ -7,30 +7,34 @@ import ( var _ binary.ByteOrder const ( - - // ClaimPrimaryKeyPrefix is the prefix to retrieve the entire Claim object (the primary store) + // ClaimPrimaryKeyPrefix is the prefix to retrieve the entire + // Claim object (the primary store) ClaimPrimaryKeyPrefix = "Claim/value/" - - // ClaimSupplierAddressPrefix is the key to retrieve a Claim's Primary Key from the Address index + // ClaimSupplierAddressPrefix is the key to retrieve a Claim's + // Primary Key from the Address index ClaimSupplierAddressPrefix = "Claim/address/" - - // ClaimSessionEndHeightPrefix is the key to retrieve a Claim's Primary Key from the Height index + // ClaimSessionEndHeightPrefix is the key to retrieve a Claim's + // Primary Key from the Height index ClaimSessionEndHeightPrefix = "Claim/height/" ) -// ClaimPrimaryKey returns the primary store key used to retrieve a Claim by creating a composite key of the sessionId and supplierAddr. -func ClaimPrimaryKey(sessionId, supplierAddr string) []byte { - // We are guaranteed uniqueness of the primary key if it's a composite of the (sessionId, supplierAddr) - // because every supplier can only have one claim per session. - return KeyComposite([]byte(sessionId), []byte(supplierAddr)) +// ClaimPrimaryKey returns the primary store key used to retrieve a Claim by +// creating a composite key of the sessionId and supplierAddr. +func ClaimPrimaryKey(sessionID, supplierAddr string) []byte { + // We are guaranteed uniqueness of the primary key if it's a composite of + // the (sessionId, supplierAddr) because every supplier can only have one + // claim per session. + return KeyComposite([]byte(sessionID), []byte(supplierAddr)) } -// ClaimSupplierAddressKey returns the key used to iterate through claims given a supplier Address. +// ClaimSupplierAddressKey returns the key used to iterate through claims +// given a supplier Address. func ClaimSupplierAddressKey(supplierAddr string, primaryKey []byte) []byte { return KeyComposite([]byte(supplierAddr), primaryKey) } -// ClaimSupplierEndSessionHeightKey returns the key used to iterate through claims given a session end height. +// ClaimSupplierEndSessionHeightKey returns the key used to iterate through +// claims given a session end height. func ClaimSupplierEndSessionHeightKey(sessionEndHeight int64, primaryKey []byte) []byte { heightBz := make([]byte, 8) binary.BigEndian.PutUint64(heightBz, uint64(sessionEndHeight)) diff --git a/x/supplier/types/message_create_claim.go b/x/supplier/types/message_create_claim.go index 0b20c27ec..18e292669 100644 --- a/x/supplier/types/message_create_claim.go +++ b/x/supplier/types/message_create_claim.go @@ -8,10 +8,12 @@ import ( sharedhelpers "github.com/pokt-network/poktroll/x/shared/helpers" ) +// TypeMsgCreateClaim defines the type of message. const TypeMsgCreateClaim = "create_claim" var _ sdk.Msg = (*MsgCreateClaim)(nil) +// NewMsgCreateClaim creates a new MsgCreateClaim instance. func NewMsgCreateClaim( supplierAddress string, sessionHeader *sessiontypes.SessionHeader, @@ -24,14 +26,17 @@ func NewMsgCreateClaim( } } +// Route returns the message router key. func (msg *MsgCreateClaim) Route() string { return RouterKey } +// Type returns the message type. func (msg *MsgCreateClaim) Type() string { return TypeMsgCreateClaim } +// GetSigners returns the signers for MsgCreateClaim message. func (msg *MsgCreateClaim) GetSigners() []sdk.AccAddress { supplierAddress, err := sdk.AccAddressFromBech32(msg.SupplierAddress) if err != nil { @@ -40,34 +45,57 @@ func (msg *MsgCreateClaim) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{supplierAddress} } +// GetSignBytes returns the signable bytes of the MsgCreateClaim message. func (msg *MsgCreateClaim) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } +// ValidateBasic performs basic validation on the message. func (msg *MsgCreateClaim) ValidateBasic() error { // Validate the supplier address _, err := sdk.AccAddressFromBech32(msg.SupplierAddress) if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidAddress, "invalid supplierAddress address (%s)", err) + return sdkerrors.Wrapf( + ErrSupplierInvalidAddress, + "invalid supplierAddress address (%s)", + err, + ) } // Validate the session header sessionHeader := msg.SessionHeader if sessionHeader.SessionStartBlockHeight < 1 { - return sdkerrors.Wrapf(ErrSupplierInvalidSessionStartHeight, "invalid session start block height (%d)", sessionHeader.SessionStartBlockHeight) + return sdkerrors.Wrapf( + ErrSupplierInvalidSessionStartHeight, + "invalid session start block height (%d)", + sessionHeader.SessionStartBlockHeight, + ) } if len(sessionHeader.SessionId) == 0 { - return sdkerrors.Wrapf(ErrSupplierInvalidSessionId, "invalid session ID (%v)", sessionHeader.SessionId) + return sdkerrors.Wrapf( + ErrSupplierInvalidSessionId, + "invalid session ID (%v)", + sessionHeader.SessionId, + ) } if !sharedhelpers.IsValidService(sessionHeader.Service) { - return sdkerrors.Wrapf(ErrSupplierInvalidService, "invalid service (%v)", sessionHeader.Service) + return sdkerrors.Wrapf( + ErrSupplierInvalidService, + "invalid service (%v)", + sessionHeader.Service, + ) } // Validate the root hash - // TODO_IMPROVE: Only checking to make sure a non-nil hash was provided for now, but we can validate the length as well. + // TODO_IMPROVE: Only checking to make sure a non-nil hash was provided for + // now, but we can validate the length as well. if len(msg.RootHash) == 0 { - return sdkerrors.Wrapf(ErrSupplierInvalidClaimRootHash, "invalid root hash (%v)", msg.RootHash) + return sdkerrors.Wrapf( + ErrSupplierInvalidClaimRootHash, + "invalid root hash (%v)", + msg.RootHash, + ) } return nil From 4955f75f3f322ba853507fef187944f4b5f32249 Mon Sep 17 00:00:00 2001 From: h5law Date: Sat, 13 Jan 2024 00:58:22 +0000 Subject: [PATCH 14/61] feat: add a step to the test workflow where we fix imports --- .github/workflows/run-tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b843265b6..6dcaafc59 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -44,6 +44,9 @@ jobs: - name: Generate mocks run: make go_mockgen + - name: Fix imports + run: make gci + - name: Run golangci-lint run: make go_lint From 27217d4d5993d6386b8d654d97e3f82b337dd43d Mon Sep 17 00:00:00 2001 From: h5law Date: Sat, 13 Jan 2024 01:13:15 +0000 Subject: [PATCH 15/61] chore: add script, makefile target and gofumpt the repo --- Makefile | 15 ++ pkg/relayer/miner/gen/gen_fixtures.go | 2 +- testutil/testkeyring/accounts_table.go | 204 +++++++++++------------ testutil/testkeyring/gen_accounts/gen.go | 2 +- tools/scripts/gofumpt/filters/filters.go | 103 ++++++++++++ tools/scripts/gofumpt/main.go | 119 +++++++++++++ x/application/client/cli/tx.go | 4 +- x/pocket/client/cli/tx.go | 4 +- x/service/client/cli/tx.go | 4 +- x/session/client/cli/tx.go | 4 +- x/supplier/client/cli/tx.go | 4 +- x/tokenomics/client/cli/tx.go | 4 +- 12 files changed, 346 insertions(+), 123 deletions(-) create mode 100644 tools/scripts/gofumpt/filters/filters.go create mode 100644 tools/scripts/gofumpt/main.go diff --git a/Makefile b/Makefile index 15603b778..2277376d8 100644 --- a/Makefile +++ b/Makefile @@ -15,6 +15,7 @@ install_ci_deps: ## Installs `mockgen` go install "github.com/golang/mock/mockgen@v1.6.0" && mockgen --version go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint --version go install github.com/daixiang0/gci@latest + go install mvdan.cc/gofumpt@latest ######################## ### Makefile Helpers ### @@ -81,6 +82,16 @@ check_gci: fi; \ } +.PHONY: check_gofumpt +# Internal helper target - check if gofumpt is installed +check_gofumpt: + { \ + if ( ! ( command -v gci >/dev/null )); then \ + echo "Seems like you don't have gci installed. Make sure you install it via 'go install mvdan.cc/gofumpt@latest' before continuing"; \ + exit 1; \ + fi; \ + } + .PHONY: check_npm # Internal helper target - check if npm is installed check_npm: @@ -166,6 +177,10 @@ go_lint: ## Run all go linters gci: check_gci ## Run gci (import ordering) on all applicable files, this writes changes in place go run ./tools/scripts/gci +.PHONY: gofumpt +gofumpt: check_gofumpt ## Run gofumpt (stricter gofmt) on all applicable files, this writes changes in place + go run ./tools/scripts/gofumpt + ############# ### Tests ### ############# diff --git a/pkg/relayer/miner/gen/gen_fixtures.go b/pkg/relayer/miner/gen/gen_fixtures.go index 59071d9ab..e480b50fc 100644 --- a/pkg/relayer/miner/gen/gen_fixtures.go +++ b/pkg/relayer/miner/gen/gen_fixtures.go @@ -108,7 +108,7 @@ func main() { } // Write the output buffer to the file at flagOut path. - if err := os.WriteFile(flagOut, outputBuffer.Bytes(), 0644); err != nil { + if err := os.WriteFile(flagOut, outputBuffer.Bytes(), 0o644); err != nil { log.Fatal(err) } } diff --git a/testutil/testkeyring/accounts_table.go b/testutil/testkeyring/accounts_table.go index 711a25018..f5ed1ee38 100644 --- a/testutil/testkeyring/accounts_table.go +++ b/testutil/testkeyring/accounts_table.go @@ -5,107 +5,105 @@ package testkeyring -var ( - preGeneratedAccounts = NewPreGeneratedAccountIterator( - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWRwZzN5YWU5OWc4bHJ3Nzl3dzBrZzJ6YTg0MzY2ZDZ0NjNrdTdkIiwiTW5lbW9uaWMiOiJsaWtlIGhpcCBzd2FtcCBmb3VuZCBjcnlzdGFsIGZsYW1lIGRlY3JlYXNlIGNydXNoIGNvaW4gY29uZHVjdCBhZmZhaXIgdmlsbGFnZSBjcnVlbCBtb250aCBob3N0IGdsb2JlIHJlZnVzZSByaWdpZCBmZWJydWFyeSBvdmVuIGNvcmUgY3JvcCBpbnB1dCBndWlsdCJ9"), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTczYzI2dG05enp2MnVnbGNhdmFkMGd3dG02azd0cTN0MmtzN2s4IiwiTW5lbW9uaWMiOiJyb2JvdCBzdW5ueSBoaWxsIHNvY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2luZG93IHJlbnQgc3RvdmUgc2hhbGxvdyBydWcifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXN2eXQ4OGtrYXNkM213ZnhmcWFnbnk0c21oeHA5a2g0Y2FncjAwIiwiTW5lbW9uaWMiOiJyZWFkeSBsaXF1aWQgbW9ua2V5IGluZG9vciBjYWJiYWdlIHRyb3BoeSBidXJkZW4gcGxheSBhbmdsZSByZXZpZXcgdW5sb2NrIGhhaXIgcGFyZW50IGhhcmQgaGFsZiBuZWdhdGl2ZSBwZXJtaXQgcmVndWxhciB0cmFkZSBmcm9zdCBsYWR5IGZ1cnkgcmVndWxhciBzcXVhcmUifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXZocWNobTlkNnBybWU1enFsdHlzODYwZ3I3YWNka2RodGtnNnJhIiwiTW5lbW9uaWMiOiJpbnF1aXJ5IGxpYXIgaW1pdGF0ZSBzY2FuIHByZXBhcmUgc3RhdGUgZmluZSBjdXJyZW50IHZpcnVzIHBheW1lbnQgc2hvdmUgbm9ybWFsIGRvdWJsZSB2YXVsdCB0cmF5IGhlYWx0aCByZXNwb25zZSB3YXZlIHJlbmRlciByaXZlciBmbGF0IHNraXJ0IGxlY3R1cmUgdGVuYW50In0="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWxkcTVrbHhjNmw1cjl5Mnc2NXJ2OGdrbmV4YXNkbjBmZzJwemxtIiwiTW5lbW9uaWMiOiJhZGQgaG9ja2V5IGJvb3N0IGNoYXQgc2lsZW50IGVyb2RlIGZsYW1lIGJhdHRsZSBwdXp6bGUgcm91Z2ggc2VjdGlvbiBiZWVmIGxpZ2h0IGZpbmQgcm91dGUgcmFiYml0IHZvaWQgYXJtZWQgbW9yYWwgcmlvdCBjaGFtcGlvbiBkcmlsbCBoYXphcmQgYm9vc3QifQ=="), - mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWR0ZTA4a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lIHNlcmllcyBiYWNoZWxvciBwZXBwZXIgbmV4dCBhZ2FpbiBhbmdyeSBsb2dpYyJ9"), - ) +var preGeneratedAccounts = NewPreGeneratedAccountIterator( + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWRwZzN5YWU5OWc4bHJ3Nzl3dzBrZzJ6YTg0MzY2ZDZ0NjNrdTdkIiwiTW5lbW9uaWMiOiJsaWtlIGhpcCBzd2FtcCBmb3VuZCBjcnlzdGFsIGZsYW1lIGRlY3JlYXNlIGNydXNoIGNvaW4gY29uZHVjdCBhZmZhaXIgdmlsbGFnZSBjcnVlbCBtb250aCBob3N0IGdsb2JlIHJlZnVzZSByaWdpZCBmZWJydWFyeSBvdmVuIGNvcmUgY3JvcCBpbnB1dCBndWlsdCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTczYzI2dG05enp2MnVnbGNhdmFkMGd3dG02azd0cTN0MmtzN2s4IiwiTW5lbW9uaWMiOiJyb2JvdCBzdW5ueSBoaWxsIHNvY2NlciB0b2JhY2NvIHBhbmVsIGluY2x1ZGUgdGFibGUgaW52aXRlIHNoeSB3b3JsZCBwZXJzb24gZG9vciBwdW5jaCBzdGluZyBkZWNvcmF0ZSB3aW5rIHNjaXNzb3JzIG94eWdlbiB0aG91Z2h0IGxpZnQgZGVjbGluZSBtb29uIGxvYW4ifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTBzbTVlcDUzaGt5a2RnM3p0NHNwZ214amZ0YXJ6czh1ZjBkZXdqIiwiTW5lbW9uaWMiOiJzdG9uZSBwcmVzZW50IGdvbGQgYmFyZ2FpbiBsZWFmIHJlY2VpdmUgYmFyZ2FpbiByYXcgc2luY2Ugc2hvdmUgYWRqdXN0IGRlcHV0eSByb2NrZXQgZm9sbG93IGxhd3N1aXQgbWFuZ28gc3RhZ2UgcnVud2F5IGRvZyBiZWF1dHkgZ2FzIHNlbnNlIGRpYWdyYW0g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ZSBoYW5kIG5vYmxlIGpva2UgcmViZWwgcmFjY29vbiBhcm0ifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTcwbmFrYTVnd2swOG5xdzVqYXZtZ3A3c3VnMzUwMHMyM242ZzZmIiwiTW5lbW9uaWMiOiJlbGRlciByYXRlIGJ1c2luZXNzIGdvYXQgdGFuayBtYXR0ZXIgdXBncmFkZSByaW5nIHNob3ZlIGVjb25vbXkgYXJ0aXN0IGJhY2hlbG9yIGZsYXZvciBicmlzayBmYW1pbHkgdGVuIGJ1ZGR5IHJvYm90IHJlcXVpcmUgYWRhcHQgc3VjaCBzYWQgc2libGluZyBwaXN0b2wifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTlxcW5yNWE1M2R2azBodGgyNGRobjVhYXMwdm53bHpwbnZyNm1oIiwiTW5lbW9uaWMiOiJrYW5nYXJvbyBsaWNlbnNlIGdvb2Qgb3ZlciBxdWVzdGlvbiBzY3JhcCBhY3Jvc3MgZGVjb3JhdGUgZnJlc2ggaGFtbWVyIG1lcmdlIGNvbmZpcm0gZm9sZCB1bmFibGUgY3JhbSBzcXVlZXplIHN1cHBseSBiaXJ0aCBob3JzZSBkZXRhaWwgd2F2ZSBsaW1pdCBpbmNsdWRlIGhhaXIifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTJnN2Z6OWV2YWE4OGd2Nm1nNHA3dmM3Y2hzaGh3Nmg1NmRyM25lIiwiTW5lbW9uaWMiOiJ3aWRlIGJhdHRsZSBsZW9wYXJkIGxlbmQgcmFpbCBkaXZlcnQgZm9nIG9ycGhhbiBvY2VhbiBlbmZvcmNlIHRydWUgY29tcGFueSBkcmF3IGVuam95IHRoYXQgY29yYWwgYmxvdXNlIGZyb250IHNwb25zb3IgY29udHJvbCBjb2xvciB0b3JuYWRvIHBpbmsgYWRhcHQifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjo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jayBqb3VybmV5IHJvdXRlIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWQ2cWpqZTlzc3c0cTN6dzkzM3g5OXhkZTZrMzQ4bmx6cHcybThoIiwiTW5lbW9uaWMiOiJjeWNsZSBzdHVtYmxlIGRheSByZXNpc3QgYnVpbGQgY290dG9uIHZlcmIgcG93ZGVyIGFjY291bnQgdml0YWwgdmlicmFudCBzaW1pbGFyIGZhbWlseSBhZmZvcmQgc2FtZSBtdXR1YWwgcGVsaWNhbiBiYW5hbmEgYnJvdGhlciByb3VnaCBiYXJlbHkgaXNsYW5kIGF3ZXNvbWUgbHVuYXIifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMW5xcWZmd2xnZ3YyZzR3dWFzenU1M3QycWZjd3E5cHZlNHBtdTRjIiwiTW5lbW9uaWMiOiJwYXRpZW50IHNtYWxsIG11dHVhbCBhcmVuYSBmZXcgYm91bmNlIHRvbmUgYXV0aG9yIGJyb29tIGx5cmljcyBiZWdpbiByZXBhaXIgbWV0aG9kIGJyb256ZSBob3RlbCBwbGF0ZSB3aW50ZXIgZHdhcmYgaGFyYm9yIGNhZ2Ugc3Rvb2wgc25pZmYgc29hcCBleGNsdWRlIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWprMHVyaGRsYWF0enJwZjJzY3l3MmhjeHN5eGVyeHAyazV5ODlnIiwiTW5lbW9uaWMiOiJtaW5kIG1hbmRhdGUgYXNzYXVsdCB0ZXJtIGdsb29tIGJsYWRlIGNodXJuIHZlcmlmeSBicmlkZ2UgZ3JhbnQgYWhlYWQgZGljZSBqZWFucyBib3kgcGljdHVyZSBiaXJ0aCBleHBlY3QgaHVycnkgc2NhbGUgb2JzZXJ2ZSB0aHJlZSBhbG9uZSBtaXggdmVsdmV0In0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXd5d3Y5OTh5emxqcXZmNzNkMGVnc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kgY29sbGVjdCBtZWRhbCB2aXRhbCJ9"), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXNrN2N1YWhxemd2aGRqdWE5djZhcW43eHBkc2c5azVqcWw2ZGx2IiwiTW5lbW9uaWMiOiJwcmlzb24gY2VudHVyeSBwdWRkaW5nIGZyaW5nZSBwcm9maXQgYWxwaGEgZGV2aWNlIGxvY2sgZW1wdHkgYWJvdXQgY3J5IG96b25lIGZlYXR1cmUgdmlvbGluIHlvdXRoIGRlY2lkZSByYXZlbiBkaXNwbGF5IHRhbGVudCB1c2FnZSBsb25lbHkgaGludCBoYWlyIHZpbnRhZ2UifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWw4dXYydXRkZXJmNDczYW14Zno3bGw1djBlNWpnbWtqaGc5MHJyIiwiTW5lbW9uaWMiOiJ2b2lkIHNpYmxpbmcgd2FybSBmZWJydWFyeSBiaWN5Y2xlIGJlaGF2ZSBydXJhbCBjaHJvbmljIGNoZXJyeSBmYW1lIGRpc29yZGVyIHN3aXRjaCBicm93biBzYW1lIGNsaWVudCBnb29zZSBkcmlmdCB0b3NzIGFyZWEgcGVybWl0IGRlY3JlYXNlIHJpdHVhbCBpbmhhbGUgYmlydGgifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWhncXduZzM4MGdka25xdHcza2ZyOXRweXE4em5ldHVrcWdrbTBoIiwiTW5lbW9uaWMiOiJ2aWN0b3J5IHdvcnRoIHllYXIgcmVkdWNlIGxlYWRlciBleGl0IHJhcGlkIHRydWNrIHNjYW4gbWl4ZWQgbGltaXQgbWFyaW5lIGluc3BpcmUgdGVzdCB3b3J0aCByZXBhaXIgY29tbW9uIHNpbWlsYXIgZ2hvc3QgY29uZ3Jlc3Mgc2NhcmUgZmluZ2VyIGFyY3RpYyBkb3NlIn0="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMTNkcW05M2poZDI5anJ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+ mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMXQzcnVxZmN6aGp5cjRycDU5amNkdjZ4dmgwNnNhcDZuMzBjc2FhIiwiTW5lbW9uaWMiOiJsdW5jaCBib3Jyb3cgZGVmeSBwb29sIGxvY2FsIGdyYW50IHNoaXAgbXVzaHJvb20gYXdrd2FyZCBpbmNsdWRlIGtpZCBiZWx0IHBhaXIgaW50byBsZW5zIHRyYXZlbCByZWZsZWN0IHJvdXRlIG1pbmQgZW5hYmxlIG5lY2sga25lZSBzaXggd2lkdGgifQ=="), + mustParsePreGeneratedAccount("eyJBZGRyZXNzIjoiY29zbW9zMWg4MmVnOXBuN3pzM2w1bHRqdHN6ejN0MGdkNWVhejdnd3lyN2M1IiwiTW5lbW9uaWMiOiJzeXN0ZW0gdHJ5IGVhZ2VyIGNhcmQgbGVzc29uIGN1cnRhaW4gYmVjYXVzZSBmbGFtZSBpbWl0YXRlIHNpemUgc2libGluZyBsYXRlciBoaWdoIHNhbXBsZSBjbGF3IHNjYXR0ZXIgdXNlIHNlcmllcyBiYWNoZWxvciBwZXBwZXIgbmV4dCBhZ2FpbiBhbmdyeSBsb2dpYyJ9"), ) diff --git a/testutil/testkeyring/gen_accounts/gen.go b/testutil/testkeyring/gen_accounts/gen.go index c0445a8cf..dcc2bfc9f 100644 --- a/testutil/testkeyring/gen_accounts/gen.go +++ b/testutil/testkeyring/gen_accounts/gen.go @@ -72,7 +72,7 @@ func main() { log.Fatal(err) } - if err := os.WriteFile(flagOut, outputBuffer.Bytes(), 0644); err != nil { + if err := os.WriteFile(flagOut, outputBuffer.Bytes(), 0o644); err != nil { log.Fatal(err) } } diff --git a/tools/scripts/gofumpt/filters/filters.go b/tools/scripts/gofumpt/filters/filters.go new file mode 100644 index 000000000..67a048a51 --- /dev/null +++ b/tools/scripts/gofumpt/filters/filters.go @@ -0,0 +1,103 @@ +// The filters package contains functions that can be used to filter file paths. + +package filters + +import ( + "bufio" + "bytes" + "os" + "path/filepath" + "strings" +) + +const igniteScaffoldComment = "// this line is used by starport scaffolding" + +var ( + importStart = []byte("import (") + importEnd = []byte(")") +) + +// FilterFn is a function that returns true if the given path matches the +// filter's criteria. +type FilterFn func(path string) (bool, error) + +// PathMatchesGoExtension matches go source files. +func PathMatchesGoExtension(path string) (bool, error) { + return filepath.Ext(path) == ".go", nil +} + +// PathMatchesProtobufGo matches generated protobuf go source files. +func PathMatchesProtobufGo(path string) (bool, error) { + return strings.HasSuffix(path, ".pb.go"), nil +} + +// PathMatchesProtobufGatewayGo matches generated protobuf gateway go source files. +func PathMatchesProtobufGatewayGo(path string) (bool, error) { + return strings.HasSuffix(path, ".pb.gw.go"), nil +} + +// PathMatchesMockGo matches generated mock go source files. +func PathMatchesMockGo(path string) (bool, error) { + return strings.HasSuffix(path, "_mock.go"), nil +} + +// PathMatchesTestGo matches go test files. +func PathMatchesTestGo(path string) (bool, error) { + return strings.HasSuffix(path, "_test.go"), nil +} + +// ContentMatchesEmptyImportScaffold matches files that can't be goimport'd due +// to ignite incompatibility. +func ContentMatchesEmptyImportScaffold(path string) (bool, error) { + return containsEmptyImportScaffold(path) +} + +// containsEmptyImportScaffold checks if the go file at goSrcPath contains an +// import statement like the following: +// +// import ( +// // this line is used by starport scaffolding ... +// ) +func containsEmptyImportScaffold(goSrcPath string) (isEmptyImport bool, _ error) { + file, err := os.Open(goSrcPath) + if err != nil { + return false, err + } + defer file.Close() + + scanner := bufio.NewScanner(file) + scanner.Split(importBlockSplit) + + for scanner.Scan() { + trimmedImportBlock := strings.Trim(scanner.Text(), "\n\t") + if strings.HasPrefix(trimmedImportBlock, igniteScaffoldComment) { + return true, nil + } + } + + if scanner.Err() != nil { + return false, scanner.Err() + } + + return false, nil +} + +// importBlockSplit is a split function intended to be used with bufio.Scanner +// to extract the contents of a multi-line go import block. +func importBlockSplit(data []byte, _ bool) (advance int, token []byte, err error) { + // Search for the beginning of the import block + startIdx := bytes.Index(data, importStart) + if startIdx == -1 { + return 0, nil, nil + } + + // Search for the end of the import block from the start index + endIdx := bytes.Index(data[startIdx:], importEnd) + if endIdx == -1 { + return 0, nil, nil + } + + // Return the entire import block, including "import (" and ")" + importBlock := data[startIdx+len(importStart) : startIdx-len(importEnd)+endIdx+1] + return startIdx + endIdx + 1, importBlock, nil +} diff --git a/tools/scripts/gofumpt/main.go b/tools/scripts/gofumpt/main.go new file mode 100644 index 000000000..830873840 --- /dev/null +++ b/tools/scripts/gofumpt/main.go @@ -0,0 +1,119 @@ +package main + +import ( + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/pokt-network/poktroll/tools/scripts/gci/filters" +) + +var ( + defaultArgs = []string{ + "-w", + } + defaultIncludeFilters = []filters.FilterFn{ + filters.PathMatchesGoExtension, + } + defaultExcludeFilters = []filters.FilterFn{ + filters.PathMatchesProtobufGo, + filters.PathMatchesProtobufGatewayGo, + filters.PathMatchesMockGo, + filters.PathMatchesTestGo, + filters.ContentMatchesEmptyImportScaffold, + } +) + +func main() { + root := "." + var filesToProcess []string + + // Walk the file system and accumulate matching files + err := filepath.Walk(root, walkRepoRootFn( + root, + defaultIncludeFilters, + defaultExcludeFilters, + &filesToProcess, + )) + if err != nil { + fmt.Printf("Error processing files: %s\n", err) + return + } + + // Run gci on all accumulated files - this writes changes in place + if len(filesToProcess) > 0 { + cmd := exec.Command("gofumpt", append(defaultArgs, filesToProcess...)...) + out, err := cmd.CombinedOutput() + if err != nil { + fmt.Printf("Output: %s\nFailed running gci: %v\n", out, err) + } + } +} + +func walkRepoRootFn( + rootPath string, + includeFilters []filters.FilterFn, + excludeFilters []filters.FilterFn, + filesToProcess *[]string, +) filepath.WalkFunc { + return func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + // Don't process the root directory but don't skip it either; that would + // exclude everything. + if info.Name() == rootPath { + return nil + } + + // No need to process directories + if info.IsDir() { + // Skip directories that start with a period + if strings.HasPrefix(info.Name(), ".") { + return filepath.SkipDir + } + return nil + } + + // Don't process paths which don't match any include filter. + var shouldIncludePath bool + for _, includeFilter := range includeFilters { + pathMatches, err := includeFilter(path) + if err != nil { + panic(err) + } + + if pathMatches { + shouldIncludePath = true + break + } + } + if !shouldIncludePath { + return nil + } + + // Don't process paths which match any exclude filter. + var shouldExcludePath bool + for _, excludeFilter := range excludeFilters { + pathMatches, err := excludeFilter(path) + if err != nil { + panic(err) + } + + if pathMatches { + shouldExcludePath = true + break + } + } + if shouldExcludePath { + return nil + } + + *filesToProcess = append(*filesToProcess, path) + + return nil + } +} diff --git a/x/application/client/cli/tx.go b/x/application/client/cli/tx.go index 3f5179054..3a18b7a5c 100644 --- a/x/application/client/cli/tx.go +++ b/x/application/client/cli/tx.go @@ -11,9 +11,7 @@ import ( "github.com/pokt-network/poktroll/x/application/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) const ( flagPacketTimeoutTimestamp = "packet-timeout-timestamp" diff --git a/x/pocket/client/cli/tx.go b/x/pocket/client/cli/tx.go index 393059a42..d33a48c18 100644 --- a/x/pocket/client/cli/tx.go +++ b/x/pocket/client/cli/tx.go @@ -11,9 +11,7 @@ import ( "github.com/pokt-network/poktroll/x/pocket/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) const ( flagPacketTimeoutTimestamp = "packet-timeout-timestamp" diff --git a/x/service/client/cli/tx.go b/x/service/client/cli/tx.go index 10102c0f0..b891cbe75 100644 --- a/x/service/client/cli/tx.go +++ b/x/service/client/cli/tx.go @@ -11,9 +11,7 @@ import ( "github.com/pokt-network/poktroll/x/service/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) const ( flagPacketTimeoutTimestamp = "packet-timeout-timestamp" diff --git a/x/session/client/cli/tx.go b/x/session/client/cli/tx.go index 5b6778736..7ab5fecc4 100644 --- a/x/session/client/cli/tx.go +++ b/x/session/client/cli/tx.go @@ -11,9 +11,7 @@ import ( "github.com/pokt-network/poktroll/x/session/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) const ( flagPacketTimeoutTimestamp = "packet-timeout-timestamp" diff --git a/x/supplier/client/cli/tx.go b/x/supplier/client/cli/tx.go index c76c24dae..e7425df30 100644 --- a/x/supplier/client/cli/tx.go +++ b/x/supplier/client/cli/tx.go @@ -10,9 +10,7 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) const ( flagPacketTimeoutTimestamp = "packet-timeout-timestamp" diff --git a/x/tokenomics/client/cli/tx.go b/x/tokenomics/client/cli/tx.go index da7d07742..b76c0dcf0 100644 --- a/x/tokenomics/client/cli/tx.go +++ b/x/tokenomics/client/cli/tx.go @@ -11,9 +11,7 @@ import ( "github.com/pokt-network/poktroll/x/tokenomics/types" ) -var ( - DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) -) +var DefaultRelativePacketTimeoutTimestamp = uint64((time.Duration(10) * time.Minute).Nanoseconds()) const ( flagPacketTimeoutTimestamp = "packet-timeout-timestamp" From 0fa5f81b9bd66a417b26733521d7f1131e5b51b9 Mon Sep 17 00:00:00 2001 From: h5law Date: Sat, 13 Jan 2024 01:18:39 +0000 Subject: [PATCH 16/61] feat: add formatting to the test workflow --- .github/workflows/run-tests.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 6dcaafc59..f0a654adf 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -47,6 +47,9 @@ jobs: - name: Fix imports run: make gci + - name: Format the repo + run: make gofumpt + - name: Run golangci-lint run: make go_lint From b3ba99b2bcdb7d633a250690224978503b7d61a6 Mon Sep 17 00:00:00 2001 From: h5law Date: Sat, 13 Jan 2024 15:05:08 +0000 Subject: [PATCH 17/61] feat: add run customisations to config file and remove test files from filter --- .github/workflows/run-tests.yml | 2 +- .golangci.yml | 7 +++++++ Makefile | 3 +-- e2e/tests/init_test.go | 5 +++-- e2e/tests/session_steps_test.go | 3 ++- tools/scripts/gci/filters/filters.go | 5 ----- tools/scripts/gci/main.go | 1 - tools/scripts/gofumpt/filters/filters.go | 5 ----- tools/scripts/gofumpt/main.go | 1 - 9 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index f0a654adf..38a4331e0 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,4 +1,4 @@ -name: Run tests +Name: Run tests on: push: diff --git a/.golangci.yml b/.golangci.yml index fc4eb85ac..762439583 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,3 +1,10 @@ +run: + timeout: 15m + build-tags: + - e2e + - test + - integration + # TODO_TECHDEBT: Enable each linter listed, 1 by 1, fixing issues as they appear. # Don't forget to delete the `disable-all: true` line as well. linters: diff --git a/Makefile b/Makefile index 2277376d8..61fec6842 100644 --- a/Makefile +++ b/Makefile @@ -171,8 +171,7 @@ localnet_regenesis: ## Regenerate the localnet genesis file .PHONY: go_lint go_lint: ## Run all go linters - golangci-lint run --timeout 15m --build-tags test - + golangci-lint run .PHONY: gci gci: check_gci ## Run gci (import ordering) on all applicable files, this writes changes in place go run ./tools/scripts/gci diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go index c97017c2c..5afc0409f 100644 --- a/e2e/tests/init_test.go +++ b/e2e/tests/init_test.go @@ -16,14 +16,15 @@ import ( tmcli "github.com/cometbft/cometbft/libs/cli" "github.com/cosmos/cosmos-sdk/codec" + "github.com/regen-network/gocuke" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/app" "github.com/pokt-network/poktroll/testutil/testclient" apptypes "github.com/pokt-network/poktroll/x/application/types" sessiontypes "github.com/pokt-network/poktroll/x/session/types" sharedtypes "github.com/pokt-network/poktroll/x/shared/types" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/regen-network/gocuke" - "github.com/stretchr/testify/require" ) var ( diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index 96248e243..0104bd589 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -11,13 +11,14 @@ import ( "time" abci "github.com/cometbft/cometbft/abci/types" + "github.com/stretchr/testify/require" + "github.com/pokt-network/poktroll/pkg/client/events" "github.com/pokt-network/poktroll/pkg/either" "github.com/pokt-network/poktroll/pkg/observable" "github.com/pokt-network/poktroll/pkg/observable/channel" "github.com/pokt-network/poktroll/testutil/testclient" suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" - "github.com/stretchr/testify/require" ) const ( diff --git a/tools/scripts/gci/filters/filters.go b/tools/scripts/gci/filters/filters.go index 67a048a51..51c85f75d 100644 --- a/tools/scripts/gci/filters/filters.go +++ b/tools/scripts/gci/filters/filters.go @@ -41,11 +41,6 @@ func PathMatchesMockGo(path string) (bool, error) { return strings.HasSuffix(path, "_mock.go"), nil } -// PathMatchesTestGo matches go test files. -func PathMatchesTestGo(path string) (bool, error) { - return strings.HasSuffix(path, "_test.go"), nil -} - // ContentMatchesEmptyImportScaffold matches files that can't be goimport'd due // to ignite incompatibility. func ContentMatchesEmptyImportScaffold(path string) (bool, error) { diff --git a/tools/scripts/gci/main.go b/tools/scripts/gci/main.go index c97eadfad..3175ddf86 100644 --- a/tools/scripts/gci/main.go +++ b/tools/scripts/gci/main.go @@ -25,7 +25,6 @@ var ( filters.PathMatchesProtobufGo, filters.PathMatchesProtobufGatewayGo, filters.PathMatchesMockGo, - filters.PathMatchesTestGo, filters.ContentMatchesEmptyImportScaffold, } ) diff --git a/tools/scripts/gofumpt/filters/filters.go b/tools/scripts/gofumpt/filters/filters.go index 67a048a51..51c85f75d 100644 --- a/tools/scripts/gofumpt/filters/filters.go +++ b/tools/scripts/gofumpt/filters/filters.go @@ -41,11 +41,6 @@ func PathMatchesMockGo(path string) (bool, error) { return strings.HasSuffix(path, "_mock.go"), nil } -// PathMatchesTestGo matches go test files. -func PathMatchesTestGo(path string) (bool, error) { - return strings.HasSuffix(path, "_test.go"), nil -} - // ContentMatchesEmptyImportScaffold matches files that can't be goimport'd due // to ignite incompatibility. func ContentMatchesEmptyImportScaffold(path string) (bool, error) { diff --git a/tools/scripts/gofumpt/main.go b/tools/scripts/gofumpt/main.go index 830873840..48a2df5ca 100644 --- a/tools/scripts/gofumpt/main.go +++ b/tools/scripts/gofumpt/main.go @@ -21,7 +21,6 @@ var ( filters.PathMatchesProtobufGo, filters.PathMatchesProtobufGatewayGo, filters.PathMatchesMockGo, - filters.PathMatchesTestGo, filters.ContentMatchesEmptyImportScaffold, } ) From f070da6e239022354bdfe1392ce5f99ca0b13ab7 Mon Sep 17 00:00:00 2001 From: h5law Date: Mon, 15 Jan 2024 19:06:28 +0000 Subject: [PATCH 18/61] chore: catch all linting errors from `make go_lint` --- app/app.go | 16 +++++-- app/simulation_test.go | 18 +++++-- cmd/pocketd/cmd/config.go | 5 +- cmd/pocketd/cmd/genaccounts.go | 19 ++++++-- cmd/pocketd/cmd/root.go | 6 ++- e2e/tests/init_test.go | 21 ++++++-- e2e/tests/node.go | 7 ++- e2e/tests/session_steps_test.go | 10 ++-- .../supplier/client_integration_test.go | 3 +- pkg/client/tx/client_integration_test.go | 3 +- pkg/crypto/rings/cache_test.go | 6 ++- testutil/network/network.go | 24 ++++++++-- testutil/testclient/testdelegation/client.go | 1 + testutil/testproxy/relayerproxy.go | 8 +++- .../client/cli/tx_delegate_to_gateway_test.go | 10 +++- .../client/cli/tx_stake_application_test.go | 7 ++- .../cli/tx_undelegate_from_gateway_test.go | 10 +++- .../client/cli/tx_unstake_application_test.go | 7 ++- .../msg_server_undelegate_from_gateway.go | 14 ++++-- x/gateway/client/cli/tx_stake_gateway_test.go | 7 ++- .../client/cli/tx_unstake_gateway_test.go | 7 ++- x/session/client/cli/helpers_test.go | 10 ++-- .../client/cli/query_get_session_test.go | 14 ++++-- x/session/keeper/session_hydrator_test.go | 6 ++- x/supplier/client/cli/helpers_test.go | 6 ++- x/supplier/client/cli/query_claim_test.go | 5 +- x/supplier/client/cli/tx_create_claim.go | 1 + .../client/cli/tx_stake_supplier_test.go | 7 ++- .../client/cli/tx_unstake_supplier_test.go | 6 ++- x/supplier/keeper/claim.go | 48 +++++++++++++------ x/supplier/keeper/msg_server_create_claim.go | 6 ++- .../keeper/msg_server_create_claim_test.go | 6 ++- .../keeper/msg_server_stake_supplier.go | 25 ++++++++-- x/supplier/keeper/msg_server_submit_proof.go | 5 +- .../keeper/msg_server_unstake_supplier.go | 11 ++++- x/supplier/keeper/query_proof.go | 12 ++++- x/supplier/keeper/query_supplier.go | 12 ++++- x/supplier/types/message_submit_proof.go | 20 ++++++-- x/supplier/types/query_validation.go | 15 ++++-- 39 files changed, 331 insertions(+), 93 deletions(-) diff --git a/app/app.go b/app/app.go index e785adddf..2c12d0fd4 100644 --- a/app/app.go +++ b/app/app.go @@ -136,8 +136,11 @@ import ( ) const ( + // AccountAddressPrefix is the prefix generated addresses will have. AccountAddressPrefix = "pokt" - Name = "pocket" + // Name is the name of the network itself. + Name = "pocket" + // DenomuPOKT is the default denomination used in the chain. // TODO_CLEANUP: Find a way to centralize the use of `upokt` throughout the codebase DenomuPOKT = "upokt" ) @@ -719,7 +722,14 @@ func New( app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), ), - distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + distr.NewAppModule( + appCodec, + app.DistrKeeper, + app.AccountKeeper, + app.BankKeeper, + app.StakingKeeper, + app.GetSubspace(distrtypes.ModuleName), + ), staking.NewAppModule( appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName), ), @@ -1026,7 +1036,7 @@ func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { // RegisterAPIRoutes registers all application module routes with the provided // API server. -func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { +func (app *App) RegisterAPIRoutes(apiSvr *api.Server, _ config.APIConfig) { clientCtx := apiSvr.ClientCtx // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) diff --git a/app/simulation_test.go b/app/simulation_test.go index ee0ed33ad..99e5bd419 100644 --- a/app/simulation_test.go +++ b/app/simulation_test.go @@ -60,7 +60,9 @@ func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { // Running using starport command: // `starport chain simulate -v --numBlocks 200 --blockSize 50` // Running as go benchmark test: -// `go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 -BlockSize 50 -Commit=true -Verbose=true -Enabled=true` +// +// $ go test -benchmem -run=^$ -bench ^BenchmarkSimulation ./app -NumBlocks=200 \ +// -BlockSize 50 -Commit=true -Verbose=true -Enabled=true func BenchmarkSimulation(b *testing.B) { simcli.FlagSeedValue = time.Now().Unix() simcli.FlagVerboseValue = true @@ -209,7 +211,8 @@ func TestAppStateDeterminism(t *testing.T) { if j != 0 { require.Equal( t, string(appHashList[0]), string(appHashList[j]), - "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, + "non-determinism in seed %d: %d/%d, attempt: %d/%d\n", + config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, ) } } @@ -344,7 +347,8 @@ func TestAppImportExport(t *testing.T) { bApp.GetKey(stakingtypes.StoreKey), newApp.GetKey(stakingtypes.StoreKey), [][]byte{ stakingtypes.UnbondingQueueKey, stakingtypes.RedelegationQueueKey, stakingtypes.ValidatorQueueKey, - stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, + stakingtypes.HistoricalInfoKey, stakingtypes.UnbondingIDKey, stakingtypes.UnbondingIndexKey, + stakingtypes.UnbondingTypeKey, stakingtypes.ValidatorUpdatesKey, }, }, // ordering may change but it doesn't matter {bApp.GetKey(slashingtypes.StoreKey), newApp.GetKey(slashingtypes.StoreKey), [][]byte{}}, @@ -355,7 +359,9 @@ func TestAppImportExport(t *testing.T) { {bApp.GetKey(govtypes.StoreKey), newApp.GetKey(govtypes.StoreKey), [][]byte{}}, {bApp.GetKey(evidencetypes.StoreKey), newApp.GetKey(evidencetypes.StoreKey), [][]byte{}}, {bApp.GetKey(capabilitytypes.StoreKey), newApp.GetKey(capabilitytypes.StoreKey), [][]byte{}}, - {bApp.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix}}, + {bApp.GetKey(authzkeeper.StoreKey), newApp.GetKey(authzkeeper.StoreKey), [][]byte{ + authzkeeper.GrantKey, authzkeeper.GrantQueuePrefix, + }}, } for _, skp := range storeKeysPrefixes { @@ -366,7 +372,9 @@ func TestAppImportExport(t *testing.T) { require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) - require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog(skp.A.Name(), bApp.SimulationManager().StoreDecoders, failedKVAs, failedKVBs)) + require.Equal(t, 0, len(failedKVAs), simtestutil.GetSimulationLog( + skp.A.Name(), bApp.SimulationManager().StoreDecoders, failedKVAs, failedKVBs), + ) } } diff --git a/cmd/pocketd/cmd/config.go b/cmd/pocketd/cmd/config.go index 1182b1159..991b2daeb 100644 --- a/cmd/pocketd/cmd/config.go +++ b/cmd/pocketd/cmd/config.go @@ -8,8 +8,9 @@ import ( // InitSDKConfig initializes the SDK's config with the appropriate parameters // and prefixes so everything is named appropriately for Pocket Network. -// TODO_DISCUSS: Exporting publically for testing purposes only. -// Consider adding a helper per the discussion here: https://github.com/pokt-network/poktroll/pull/59#discussion_r1357816798 +// TODO_DISCUSS: Exporting publicly for testing purposes only. +// Consider adding a helper per the discussion here: +// https://github.com/pokt-network/poktroll/pull/59#discussion_r1357816798 func InitSDKConfig() { // Set prefixes accountPubKeyPrefix := app.AccountAddressPrefix + "pub" diff --git a/cmd/pocketd/cmd/genaccounts.go b/cmd/pocketd/cmd/genaccounts.go index d5ec65337..7b302cf3f 100644 --- a/cmd/pocketd/cmd/genaccounts.go +++ b/cmd/pocketd/cmd/genaccounts.go @@ -181,11 +181,20 @@ contain valid denominations. Accounts may optionally be supplied with vesting pa }, } - cmd.Flags().String(flags.FlagKeyringBackend, flags.DefaultKeyringBackend, "Select keyring's backend (os|file|kwallet|pass|test)") - cmd.Flags().String(flags.FlagHome, defaultNodeHome, "The application home directory") - cmd.Flags().String(flagVestingAmt, "", "amount of coins for vesting accounts") - cmd.Flags().Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") - cmd.Flags().Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") + cmd.Flags(). + String( + flags.FlagKeyringBackend, + flags.DefaultKeyringBackend, + "Select keyring's backend (os|file|kwallet|pass|test)", + ) + cmd.Flags(). + String(flags.FlagHome, defaultNodeHome, "The application home directory") + cmd.Flags(). + String(flagVestingAmt, "", "amount of coins for vesting accounts") + cmd.Flags(). + Int64(flagVestingStart, 0, "schedule start time (unix epoch) for vesting accounts") + cmd.Flags(). + Int64(flagVestingEnd, 0, "schedule end time (unix epoch) for vesting accounts") flags.AddQueryFlagsToCmd(cmd) return cmd diff --git a/cmd/pocketd/cmd/root.go b/cmd/pocketd/cmd/root.go index 6708ea486..897ac3f05 100644 --- a/cmd/pocketd/cmd/root.go +++ b/cmd/pocketd/cmd/root.go @@ -110,7 +110,11 @@ func initRootCmd( gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) rootCmd.AddCommand( genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), - genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, gentxModule.GenTxValidator), + genutilcli.CollectGenTxsCmd( + banktypes.GenesisBalancesIterator{}, + app.DefaultNodeHome, + gentxModule.GenTxValidator, + ), genutilcli.MigrateGenesisCmd(), genutilcli.GenTxCmd( app.ModuleBasics, diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go index 5afc0409f..1ab6c22a1 100644 --- a/e2e/tests/init_test.go +++ b/e2e/tests/init_test.go @@ -38,14 +38,20 @@ var ( flagFeaturesPath string keyRingFlag = "--keyring-backend=test" - appGateServerUrl = "http://localhost:42069" // Keeping localhost by default because that is how we run the tests on our machines locally + // Keeping localhost by default because that is how we run the tests on our machines locally + appGateServerUrl = "http://localhost:42069" ) func init() { addrRe = regexp.MustCompile(`address:\s+(\S+)\s+name:\s+(\S+)`) amountRe = regexp.MustCompile(`amount:\s+"(.+?)"\s+denom:\s+upokt`) - flag.StringVar(&flagFeaturesPath, "features-path", "*.feature", "Specifies glob paths for the runner to look up .feature files") + flag.StringVar( + &flagFeaturesPath, + "features-path", + "*.feature", + "Specifies glob paths for the runner to look up .feature files", + ) // If "APPGATE_SERVER_URL" envar is present, use it for appGateServerUrl if url := os.Getenv("APPGATE_SERVER_URL"); url != "" { @@ -256,7 +262,7 @@ func (s *suite) TheSupplierIsStakedForService(supplierName string, serviceId str s.Fatalf("supplier %s is not staked for service %s", supplierName, serviceId) } -func (s *suite) TheSessionForApplicationAndServiceContainsTheSupplier(appName string, serviceId string, supplierName string) { +func (s *suite) TheSessionForApplicationAndServiceContainsTheSupplier(appName, serviceId, supplierName string) { app, found := accNameToAppMap[appName] if !found { s.Fatalf("application %s not found", appName) @@ -288,10 +294,15 @@ func (s *suite) TheSessionForApplicationAndServiceContainsTheSupplier(appName st s.Fatalf("session for app %s and service %s does not contain supplier %s", appName, serviceId, supplierName) } -func (s *suite) TheApplicationSendsTheSupplierARequestForServiceWithData(appName, supplierName, serviceId, requestData string) { +func (s *suite) TheApplicationSendsTheSupplierARequestForServiceWithData( + appName, supplierName, serviceId, requestData string, +) { res, err := s.pocketd.RunCurl(appGateServerUrl, serviceId, requestData) if err != nil { - s.Fatalf("error sending relay request from app %s to supplier %s for service %s: %v", appName, supplierName, serviceId, err) + s.Fatalf( + "error sending relay request from app %s to supplier %s for service %s: %v", + appName, supplierName, serviceId, err, + ) } relayKey := relayReferenceKey(appName, supplierName) diff --git a/e2e/tests/node.go b/e2e/tests/node.go index 5bf187556..63bff4502 100644 --- a/e2e/tests/node.go +++ b/e2e/tests/node.go @@ -114,7 +114,12 @@ func (p *pocketdBin) runPocketCmd(args ...string) (*commandResult, error) { } // runCurlPostCmd is a helper to run a command using the local pocketd binary with the flags provided -func (p *pocketdBin) runCurlPostCmd(rpcUrl string, service string, data string, args ...string) (*commandResult, error) { +func (p *pocketdBin) runCurlPostCmd( + rpcUrl string, + service string, + data string, + args ...string, +) (*commandResult, error) { dataStr := fmt.Sprintf("%s", data) urlStr := fmt.Sprintf("%s/%s", rpcUrl, service) base := []string{ diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index 0104bd589..089bc9bf2 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -24,7 +24,7 @@ import ( const ( createClaimTimeoutDuration = 10 * time.Second eitherEventsReplayBufferSize = 100 - msgClaimSenderQueryFmt = "tm.event='Tx' AND message.sender='%s' AND message.action='/pocket.supplier.MsgCreateClaim'" + msgClaimSenderQueryFmt = "tm.event='Tx' AND message.sender='%s' AND message.action='/pocket.supplier.MsgCreateClaim'" //nolint:lll testServiceId = "anvil" eitherEventsBzReplayObsKey = "eitherEventsBzReplayObsKey" preExistingClaimsKey = "preExistingClaimsKey" @@ -83,7 +83,9 @@ func (s *suite) AfterTheSupplierCreatesAClaimForTheSessionForServiceForApplicati } } -func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersistedOnchain(supplierName, serviceId, appName string) { +func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersistedOnchain( + supplierName, serviceId, appName string, +) { ctx := context.Background() allClaimsRes, err := s.supplierQueryClient.AllClaims(ctx, &suppliertypes.QueryAllClaimsRequest{ @@ -114,7 +116,9 @@ func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersist require.Equal(s, accNameToAddrMap[supplierName], claim.SupplierAddress) } -func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication(supplierName, relayCountStr, serviceId, appName string) { +func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication( + supplierName, relayCountStr, serviceId, appName string, +) { ctx := context.Background() relayCount, err := strconv.Atoi(relayCountStr) diff --git a/pkg/client/supplier/client_integration_test.go b/pkg/client/supplier/client_integration_test.go index f7ea11f56..0db4e81b5 100644 --- a/pkg/client/supplier/client_integration_test.go +++ b/pkg/client/supplier/client_integration_test.go @@ -13,7 +13,8 @@ import ( ) func TestNewSupplierClient_Localnet(t *testing.T) { - t.Skip("TODO_TECHDEBT: this test depends on some setup which is currently not implemented in this test: staked application and servicer with matching services") + t.Skip("TODO_TECHDEBT: this test depends on some setup which is currently" + + " not implemented in this test: staked application and servicer with matching services") var ( signingKeyName = "app1" diff --git a/pkg/client/tx/client_integration_test.go b/pkg/client/tx/client_integration_test.go index 67d4b71ef..afbd354f5 100644 --- a/pkg/client/tx/client_integration_test.go +++ b/pkg/client/tx/client_integration_test.go @@ -21,7 +21,8 @@ import ( func TestTxClient_SignAndBroadcast_Integration(t *testing.T) { t.Skip( - "TODO_TECHDEBT: this test depends on some setup which is currently not implemented in this test: staked application and servicer with matching services", + "TODO_TECHDEBT: this test depends on some setup which is currently not " + + "implemented in this test: staked application and servicer with matching services", ) ctx := context.Background() diff --git a/pkg/crypto/rings/cache_test.go b/pkg/crypto/rings/cache_test.go index 8505fa3dd..bd4905307 100644 --- a/pkg/crypto/rings/cache_test.go +++ b/pkg/crypto/rings/cache_test.go @@ -296,7 +296,11 @@ func TestRingCache_CancelContext(t *testing.T) { // createRingCache creates the RingCache using mocked AccountQueryClient and // ApplicatioQueryClient instances and returns the RingCache and the delegatee // change replay observable. -func createRingCache(ctx context.Context, t *testing.T, appAddress string) (crypto.RingCache, chan<- client.Redelegation) { +func createRingCache( + ctx context.Context, + t *testing.T, + appAddress string, +) (crypto.RingCache, chan<- client.Redelegation) { t.Helper() redelegationObs, redelegationPublishCh := channel.NewReplayObservable[client.Redelegation](ctx, 1) delegationClient := testdelegation.NewAnyTimesRedelegationsSequence(ctx, t, appAddress, redelegationObs) diff --git a/testutil/network/network.go b/testutil/network/network.go index 0065c4d86..b8f20dc35 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -262,7 +262,11 @@ func InitAccount(t *testing.T, net *Network, addr sdk.AccAddress) { fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } amount := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(200))) responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, args...) @@ -293,7 +297,11 @@ func InitAccountWithSequence( fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } amount := sdk.NewCoins(sdk.NewCoin("stake", sdkmath.NewInt(200))) responseRaw, err := clitestutil.MsgSendExec(ctx, val.Address, addr, amount, args...) @@ -319,7 +327,11 @@ func DelegateAppToGateway( fmt.Sprintf("--%s=%s", flags.FlagFrom, appAddr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } responseRaw, err := clitestutil.ExecTestCLICmd(ctx, appcli.CmdDelegateToGateway(), args) require.NoError(t, err) @@ -345,7 +357,11 @@ func UndelegateAppFromGateway( fmt.Sprintf("--%s=%s", flags.FlagFrom, appAddr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } responseRaw, err := clitestutil.ExecTestCLICmd(ctx, appcli.CmdUndelegateFromGateway(), args) require.NoError(t, err) diff --git a/testutil/testclient/testdelegation/client.go b/testutil/testclient/testdelegation/client.go index 4d490e376..de5bea220 100644 --- a/testutil/testclient/testdelegation/client.go +++ b/testutil/testclient/testdelegation/client.go @@ -148,6 +148,7 @@ func NewRedelegationEventBytes( gatewayAddress string, ) []byte { t.Helper() + //nolint:lll jsonTemplate := `{"tx":"SGVsbG8sIHdvcmxkIQ==","result":{"events":[{"type":"message","attributes":[{"key":"action","value":"/pocket.application.MsgDelegateToGateway"},{"key":"sender","value":"pokt1exampleaddress"},{"key":"module","value":"application"}]},{"type":"pocket.application.EventRedelegation","attributes":[{"key":"app_address","value":"\"%s\""},{"key":"gateway_address","value":"\"%s\""}]}]}}` json := fmt.Sprintf(jsonTemplate, appAddress, gatewayAddress) return []byte(json) diff --git a/testutil/testproxy/relayerproxy.go b/testutil/testproxy/relayerproxy.go index 80cd141fd..a71714595 100644 --- a/testutil/testproxy/relayerproxy.go +++ b/testutil/testproxy/relayerproxy.go @@ -91,7 +91,13 @@ func WithRelayerProxyDependencies(keyName string) func(*TestBehavior) { redelegationObs, _ := channel.NewReplayObservable[client.Redelegation](test.ctx, 1) delegationClient := testdelegation.NewAnyTimesRedelegationsSequence(test.ctx, test.t, "", redelegationObs) - ringCache := testrings.NewRingCacheWithMockDependencies(test.ctx, test.t, accountQueryClient, applicationQueryClient, delegationClient) + ringCache := testrings.NewRingCacheWithMockDependencies( + test.ctx, + test.t, + accountQueryClient, + applicationQueryClient, + delegationClient, + ) deps := depinject.Supply( logger, diff --git a/x/application/client/cli/tx_delegate_to_gateway_test.go b/x/application/client/cli/tx_delegate_to_gateway_test.go index 22d2630b2..b13d55609 100644 --- a/x/application/client/cli/tx_delegate_to_gateway_test.go +++ b/x/application/client/cli/tx_delegate_to_gateway_test.go @@ -37,7 +37,12 @@ func TestCLI_DelegateToGateway(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins( + sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } tests := []struct { @@ -77,7 +82,8 @@ func TestCLI_DelegateToGateway(t *testing.T) { }, } - // Initialize the App and Gateway Accounts by sending it some funds from the validator account that is part of genesis + // Initialize the App and Gateway Accounts by sending it some funds from + // the validator account that is part of genesis network.InitAccountWithSequence(t, net, appAccount.Address, 1) network.InitAccountWithSequence(t, net, gatewayAccount.Address, 2) diff --git a/x/application/client/cli/tx_stake_application_test.go b/x/application/client/cli/tx_stake_application_test.go index 6f255207e..05a2af2a8 100644 --- a/x/application/client/cli/tx_stake_application_test.go +++ b/x/application/client/cli/tx_stake_application_test.go @@ -37,7 +37,12 @@ func TestCLI_StakeApplication(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins( + sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } defaultConfig := ` diff --git a/x/application/client/cli/tx_undelegate_from_gateway_test.go b/x/application/client/cli/tx_undelegate_from_gateway_test.go index a5d942268..438245672 100644 --- a/x/application/client/cli/tx_undelegate_from_gateway_test.go +++ b/x/application/client/cli/tx_undelegate_from_gateway_test.go @@ -37,7 +37,12 @@ func TestCLI_UndelegateFromGateway(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins( + sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } tests := []struct { @@ -77,7 +82,8 @@ func TestCLI_UndelegateFromGateway(t *testing.T) { }, } - // Initialize the App and Gateway Accounts by sending it some funds from the validator account that is part of genesis + // Initialize the App and Gateway Accounts by sending it some funds from + // the validator account that is part of genesis network.InitAccountWithSequence(t, net, appAccount.Address, 1) network.InitAccountWithSequence(t, net, gatewayAccount.Address, 2) diff --git a/x/application/client/cli/tx_unstake_application_test.go b/x/application/client/cli/tx_unstake_application_test.go index 2681a7d77..ebd7e1598 100644 --- a/x/application/client/cli/tx_unstake_application_test.go +++ b/x/application/client/cli/tx_unstake_application_test.go @@ -35,7 +35,12 @@ func TestCLI_UnstakeApplication(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins( + sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } tests := []struct { diff --git a/x/application/keeper/msg_server_undelegate_from_gateway.go b/x/application/keeper/msg_server_undelegate_from_gateway.go index 5c755e648..e629b49c4 100644 --- a/x/application/keeper/msg_server_undelegate_from_gateway.go +++ b/x/application/keeper/msg_server_undelegate_from_gateway.go @@ -40,12 +40,20 @@ func (k msgServer) UndelegateFromGateway( } } if foundIdx == -1 { - logger.Info(fmt.Sprintf("Application not delegated to gateway with address [%s]", msg.GatewayAddress)) - return nil, sdkerrors.Wrapf(types.ErrAppNotDelegated, "application not delegated to gateway with address: %s", msg.GatewayAddress) + logger.Info( + fmt.Sprintf( + "Application not delegated to gateway with address [%s]", msg.GatewayAddress), + ) + return nil, sdkerrors.Wrapf( + types.ErrAppNotDelegated, + "application not delegated to gateway with address: %s", msg.GatewayAddress, + ) } // Remove the gateway from the application's delegatee gateway public keys - app.DelegateeGatewayAddresses = append(app.DelegateeGatewayAddresses[:foundIdx], app.DelegateeGatewayAddresses[foundIdx+1:]...) + app.DelegateeGatewayAddresses = append( + app.DelegateeGatewayAddresses[:foundIdx], app.DelegateeGatewayAddresses[foundIdx+1:]..., + ) // Update the application store with the new delegation k.SetApplication(ctx, app) diff --git a/x/gateway/client/cli/tx_stake_gateway_test.go b/x/gateway/client/cli/tx_stake_gateway_test.go index f50549686..787a390e9 100644 --- a/x/gateway/client/cli/tx_stake_gateway_test.go +++ b/x/gateway/client/cli/tx_stake_gateway_test.go @@ -37,7 +37,12 @@ func TestCLI_StakeGateway(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins( + sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } tests := []struct { diff --git a/x/gateway/client/cli/tx_unstake_gateway_test.go b/x/gateway/client/cli/tx_unstake_gateway_test.go index b0aa9fc16..b24d2503e 100644 --- a/x/gateway/client/cli/tx_unstake_gateway_test.go +++ b/x/gateway/client/cli/tx_unstake_gateway_test.go @@ -35,7 +35,12 @@ func TestCLI_UnstakeGateway(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins( + sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } tests := []struct { diff --git a/x/session/client/cli/helpers_test.go b/x/session/client/cli/helpers_test.go index 1308b2164..3b91d328a 100644 --- a/x/session/client/cli/helpers_test.go +++ b/x/session/client/cli/helpers_test.go @@ -22,9 +22,13 @@ func init() { cmd.InitSDKConfig() } -// networkWithApplicationsAndSupplier creates a new network with a given number of supplier & application objects. -// It returns the network and a slice of the created supplier & application objects. -func networkWithApplicationsAndSupplier(t *testing.T, n int) (*network.Network, []sharedtypes.Supplier, []apptypes.Application) { +// networkWithApplicationsAndSupplier creates a new network with a given number +// of supplier & application objects. It returns the network and a slice of the +// created supplier & application objects. +func networkWithApplicationsAndSupplier( + t *testing.T, + n int, +) (*network.Network, []sharedtypes.Supplier, []apptypes.Application) { t.Helper() cfg := network.DefaultConfig() diff --git a/x/session/client/cli/query_get_session_test.go b/x/session/client/cli/query_get_session_test.go index 480bafa48..9c0a1e5a6 100644 --- a/x/session/client/cli/query_get_session_test.go +++ b/x/session/client/cli/query_get_session_test.go @@ -17,7 +17,8 @@ import ( func TestCLI_GetSession(t *testing.T) { // Prepare the network net, suppliers, applications := networkWithApplicationsAndSupplier(t, 2) - _, err := net.WaitForHeight(10) // Wait for a sufficiently high block height to ensure the staking transactions have been processed + // Wait for a sufficiently high block height to ensure the staking transactions have been processed + _, err := net.WaitForHeight(10) require.NoError(t, err) val := net.Validators[0] ctx := val.ClientCtx @@ -91,8 +92,10 @@ func TestCLI_GetSession(t *testing.T) { { desc: "invalid - app not staked for service", - appAddress: appSvc0.Address, - serviceId: "svc9001", // appSvc0 is only staked for svc0 (has supplier) and svc00 (doesn't have supplier) and is not staked for service over 9000 + appAddress: appSvc0.Address, + // appSvc0 is only staked for svc0 (has supplier) and svc00 (doesn't + // have supplier) and is not staked for service over 9000 + serviceId: "svc9001", blockHeight: 0, expectedErr: sessiontypes.ErrSessionAppNotStakedForService, @@ -100,8 +103,9 @@ func TestCLI_GetSession(t *testing.T) { { desc: "invalid - no suppliers staked for service", - appAddress: appSvc0.Address, // dynamically getting address from applications - serviceId: "svc00", // appSvc0 is only staked for svc0 (has supplier) and svc00 (doesn't have supplier) + appAddress: appSvc0.Address, // dynamically getting address from applications + // appSvc0 is only staked for svc0 (has supplier) and svc00 (doesn't have supplier) + serviceId: "svc00", blockHeight: 0, expectedErr: sessiontypes.ErrSessionSuppliersNotFound, diff --git a/x/session/keeper/session_hydrator_test.go b/x/session/keeper/session_hydrator_test.go index 5e72e1151..49767805b 100644 --- a/x/session/keeper/session_hydrator_test.go +++ b/x/session/keeper/session_hydrator_test.go @@ -221,7 +221,8 @@ func TestSession_HydrateSession_SessionId(t *testing.T) { } } -// TODO_TECHDEBT: Expand these tests to account for application joining/leaving the network at different heights as well changing the services they support +// TODO_TECHDEBT: Expand these tests to account for application joining/leaving +// the network at different heights as well changing the services they support func TestSession_HydrateSession_Application(t *testing.T) { type test struct { // Description @@ -290,7 +291,8 @@ func TestSession_HydrateSession_Application(t *testing.T) { } } -// TODO_TECHDEBT: Expand these tests to account for supplier joining/leaving the network at different heights as well changing the services they support +// TODO_TECHDEBT: Expand these tests to account for supplier joining/leaving the +// network at different heights as well changing the services they support func TestSession_HydrateSession_Suppliers(t *testing.T) { type test struct { // Description diff --git a/x/supplier/client/cli/helpers_test.go b/x/supplier/client/cli/helpers_test.go index e8a0753d0..8ea6a573f 100644 --- a/x/supplier/client/cli/helpers_test.go +++ b/x/supplier/client/cli/helpers_test.go @@ -202,7 +202,11 @@ func createClaim( fmt.Sprintf("--%s=%s", flags.FlagFrom, supplierAddr), fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdktypes.NewCoins(sdktypes.NewCoin(net.Config.BondDenom, math.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdktypes.NewCoins(sdktypes.NewCoin(net.Config.BondDenom, math.NewInt(10))).String(), + ), } responseRaw, err := testcli.ExecTestCLICmd(ctx, cli.CmdCreateClaim(), args) diff --git a/x/supplier/client/cli/query_claim_test.go b/x/supplier/client/cli/query_claim_test.go index 8795cea0c..3fd3f9e4c 100644 --- a/x/supplier/client/cli/query_claim_test.go +++ b/x/supplier/client/cli/query_claim_test.go @@ -77,8 +77,9 @@ func TestClaim_Show(t *testing.T) { // error occurs during request validation (i.e. client-side). expectedErr: types.ErrSupplierInvalidAddress.Wrapf( // TODO_CONSIDERATION: prefer using "%q" in error format strings - // to disambiguate empty string from space or no output. - "invalid supplier address for claim being retrieved %s; (decoding bech32 failed: invalid separator index -1)", + // to disambiguate empty string from space or no output."" + "invalid supplier address for claim being retrieved %s; "+ + "(decoding bech32 failed: invalid separator index -1)", "invalid_bech32_supplier_address", ), }, diff --git a/x/supplier/client/cli/tx_create_claim.go b/x/supplier/client/cli/tx_create_claim.go index 9fd509e55..292a8a6e1 100644 --- a/x/supplier/client/cli/tx_create_claim.go +++ b/x/supplier/client/cli/tx_create_claim.go @@ -19,6 +19,7 @@ import ( var _ = strconv.Itoa(0) +// CmdCreateClaim creates a new create-claim command. func CmdCreateClaim() *cobra.Command { cmd := &cobra.Command{ Use: "create-claim ", diff --git a/x/supplier/client/cli/tx_stake_supplier_test.go b/x/supplier/client/cli/tx_stake_supplier_test.go index 7400e404c..7350cf7b8 100644 --- a/x/supplier/client/cli/tx_stake_supplier_test.go +++ b/x/supplier/client/cli/tx_stake_supplier_test.go @@ -36,7 +36,12 @@ func TestCLI_StakeSupplier(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins( + sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } defaultConfig := ` diff --git a/x/supplier/client/cli/tx_unstake_supplier_test.go b/x/supplier/client/cli/tx_unstake_supplier_test.go index 179e5dce5..72a07ac36 100644 --- a/x/supplier/client/cli/tx_unstake_supplier_test.go +++ b/x/supplier/client/cli/tx_unstake_supplier_test.go @@ -35,7 +35,11 @@ func TestCLI_UnstakeSupplier(t *testing.T) { commonArgs := []string{ fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastSync), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String()), + fmt.Sprintf( + "--%s=%s", + flags.FlagFees, + sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdkmath.NewInt(10))).String(), + ), } tests := []struct { diff --git a/x/supplier/keeper/claim.go b/x/supplier/keeper/claim.go index b73cfee84..b65c7c0e1 100644 --- a/x/supplier/keeper/claim.go +++ b/x/supplier/keeper/claim.go @@ -19,8 +19,8 @@ func (k Keeper) UpsertClaim(ctx sdk.Context, claim types.Claim) { // Update the primary store: ClaimPrimaryKey -> ClaimObject primaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - sessionId := claim.GetSessionHeader().GetSessionId() - primaryKey := types.ClaimPrimaryKey(sessionId, claim.SupplierAddress) + sessionID := claim.GetSessionHeader().GetSessionId() + primaryKey := types.ClaimPrimaryKey(sessionID, claim.SupplierAddress) primaryStore.Set(primaryKey, claimBz) logger.Info(fmt.Sprintf("upserted claim for supplier %s with primaryKey %s", claim.SupplierAddress, primaryKey)) @@ -38,21 +38,31 @@ func (k Keeper) UpsertClaim(ctx sdk.Context, claim types.Claim) { heightKey := types.ClaimSupplierEndSessionHeightKey(sessionEndBlockHeight, primaryKey) sessionHeightStoreIndex.Set(heightKey, primaryKey) - logger.Info(fmt.Sprintf("indexed claim for supplier %s at session ending height %d", claim.SupplierAddress, sessionEndBlockHeight)) + logger.Info( + fmt.Sprintf( + "indexed claim for supplier %s at session ending height %d", + claim.SupplierAddress, sessionEndBlockHeight, + ), + ) } // RemoveClaim removes a claim from the store -func (k Keeper) RemoveClaim(ctx sdk.Context, sessionId, supplierAddr string) { +func (k Keeper) RemoveClaim(ctx sdk.Context, sessionID, supplierAddr string) { logger := k.Logger(ctx).With("method", "RemoveClaim") parentStore := ctx.KVStore(k.storeKey) primaryStore := prefix.NewStore(parentStore, types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) // Check if the claim exists - primaryKey := types.ClaimPrimaryKey(sessionId, supplierAddr) + primaryKey := types.ClaimPrimaryKey(sessionID, supplierAddr) claim, foundClaim := k.getClaimByPrimaryKey(ctx, primaryKey) if !foundClaim { - logger.Error(fmt.Sprintf("trying to delete non-existent claim with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) + logger.Error( + fmt.Sprintf( + "trying to delete non-existent claim with primary key %s for supplier %s and session %s", + primaryKey, supplierAddr, sessionID, + ), + ) return } @@ -69,12 +79,17 @@ func (k Keeper) RemoveClaim(ctx sdk.Context, sessionId, supplierAddr string) { addressStoreIndex.Delete(addressKey) sessionHeightStoreIndex.Delete(heightKey) - logger.Info(fmt.Sprintf("deleted claim with primary key %s for supplier %s and session %s", primaryKey, supplierAddr, sessionId)) + logger.Info( + fmt.Sprintf( + "deleted claim with primary key %s for supplier %s and session %s", + primaryKey, supplierAddr, sessionID, + ), + ) } // GetClaim returns a Claim given a SessionId & SupplierAddr -func (k Keeper) GetClaim(ctx sdk.Context, sessionId, supplierAddr string) (val types.Claim, found bool) { - primaryKey := types.ClaimPrimaryKey(sessionId, supplierAddr) +func (k Keeper) GetClaim(ctx sdk.Context, sessionID, supplierAddr string) (val types.Claim, found bool) { + primaryKey := types.ClaimPrimaryKey(sessionID, supplierAddr) return k.getClaimByPrimaryKey(ctx, primaryKey) } @@ -111,9 +126,12 @@ func (k Keeper) GetClaimsByAddress(ctx sdk.Context, address string) (claims []ty return claims } -// GetClaimsByAddress returns all claims whose session ended at the given block height +// GetClaimsByHeight returns all claims whose session ended at the given block height func (k Keeper) GetClaimsByHeight(ctx sdk.Context, height uint64) (claims []types.Claim) { - sessionHeightStoreIndex := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimSessionEndHeightPrefix)) + sessionHeightStoreIndex := prefix.NewStore( + ctx.KVStore(k.storeKey), + types.KeyPrefix(types.ClaimSessionEndHeightPrefix), + ) heightBz := make([]byte, 8) binary.BigEndian.PutUint64(heightBz, height) @@ -132,11 +150,11 @@ func (k Keeper) GetClaimsByHeight(ctx sdk.Context, height uint64) (claims []type return claims } -// GetClaimsByAddress returns all claims matching the given session id -func (k Keeper) GetClaimsBySession(ctx sdk.Context, sessionId string) (claims []types.Claim) { - sessionIdStoreIndex := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) +// GetClaimsBySession returns all claims matching the given session id +func (k Keeper) GetClaimsBySession(ctx sdk.Context, sessionID string) (claims []types.Claim) { + sessionIDStoreIndex := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.ClaimPrimaryKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(sessionIdStoreIndex, []byte(sessionId)) + iterator := sdk.KVStorePrefixIterator(sessionIDStoreIndex, []byte(sessionID)) defer iterator.Close() for ; iterator.Valid(); iterator.Next() { diff --git a/x/supplier/keeper/msg_server_create_claim.go b/x/supplier/keeper/msg_server_create_claim.go index 05e21a2e4..d33c3a8f6 100644 --- a/x/supplier/keeper/msg_server_create_claim.go +++ b/x/supplier/keeper/msg_server_create_claim.go @@ -9,7 +9,11 @@ import ( suppliertypes "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k msgServer) CreateClaim(goCtx context.Context, msg *suppliertypes.MsgCreateClaim) (*suppliertypes.MsgCreateClaimResponse, error) { +// CreateClaim creates a new claim on-chain, handlin the message it receives. +func (k msgServer) CreateClaim( + goCtx context.Context, + msg *suppliertypes.MsgCreateClaim, +) (*suppliertypes.MsgCreateClaimResponse, error) { // TODO_BLOCKER: Prevent Claim upserts after the ClaimWindow is closed. // TODO_BLOCKER: Validate the signature on the Claim message corresponds to the supplier before Upserting. diff --git a/x/supplier/keeper/msg_server_create_claim_test.go b/x/supplier/keeper/msg_server_create_claim_test.go index 93bd2b5b2..c107b4c02 100644 --- a/x/supplier/keeper/msg_server_create_claim_test.go +++ b/x/supplier/keeper/msg_server_create_claim_test.go @@ -45,7 +45,11 @@ func TestMsgServer_CreateClaim_Success(t *testing.T) { require.Lenf(t, claims, 1, "expected 1 claim, got %d", len(claims)) require.Equal(t, claimMsg.SessionHeader.SessionId, claims[0].GetSessionHeader().GetSessionId()) require.Equal(t, claimMsg.SupplierAddress, claims[0].GetSupplierAddress()) - require.Equal(t, claimMsg.SessionHeader.GetSessionEndBlockHeight(), claims[0].GetSessionHeader().GetSessionEndBlockHeight()) + require.Equal( + t, + claimMsg.SessionHeader.GetSessionEndBlockHeight(), + claims[0].GetSessionHeader().GetSessionEndBlockHeight(), + ) require.Equal(t, claimMsg.RootHash, claims[0].GetRootHash()) } diff --git a/x/supplier/keeper/msg_server_stake_supplier.go b/x/supplier/keeper/msg_server_stake_supplier.go index 3e6e5ecab..73f76f926 100644 --- a/x/supplier/keeper/msg_server_stake_supplier.go +++ b/x/supplier/keeper/msg_server_stake_supplier.go @@ -51,9 +51,16 @@ func (k msgServer) StakeSupplier( // TODO_IMPROVE: Should we avoid making this call if `coinsToDelegate` = 0? // Send the coins from the supplier to the staked supplier pool - err = k.bankKeeper.DelegateCoinsFromAccountToModule(ctx, supplierAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}) + err = k.bankKeeper.DelegateCoinsFromAccountToModule( + ctx, supplierAddress, types.ModuleName, []sdk.Coin{coinsToDelegate}, + ) if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s to %s module account due to %v", coinsToDelegate, supplierAddress, types.ModuleName, err)) + logger.Error( + fmt.Sprintf( + "could not send %v coins from %s to %s module account due to %v", + coinsToDelegate, supplierAddress, types.ModuleName, err, + ), + ) return nil, err } @@ -82,7 +89,12 @@ func (k msgServer) updateSupplier( ) error { // Checks if the the msg address is the same as the current owner if msg.Address != supplier.Address { - return sdkerrors.Wrapf(types.ErrSupplierUnauthorized, "msg Address (%s) != supplier address (%s)", msg.Address, supplier.Address) + return sdkerrors.Wrapf( + types.ErrSupplierUnauthorized, + "msg Address (%s) != supplier address (%s)", + msg.Address, + supplier.Address, + ) } // Validate that the stake is not being lowered @@ -90,7 +102,12 @@ func (k msgServer) updateSupplier( return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount cannot be nil") } if msg.Stake.IsLTE(*supplier.Stake) { - return sdkerrors.Wrapf(types.ErrSupplierInvalidStake, "stake amount %v must be higher than previous stake amount %v", msg.Stake, supplier.Stake) + return sdkerrors.Wrapf( + types.ErrSupplierInvalidStake, + "stake amount %v must be higher than previous stake amount %v", + msg.Stake, + supplier.Stake, + ) } supplier.Stake = msg.Stake diff --git a/x/supplier/keeper/msg_server_submit_proof.go b/x/supplier/keeper/msg_server_submit_proof.go index 7a764a12d..6d37c63ec 100644 --- a/x/supplier/keeper/msg_server_submit_proof.go +++ b/x/supplier/keeper/msg_server_submit_proof.go @@ -8,7 +8,10 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k msgServer) SubmitProof(goCtx context.Context, msg *types.MsgSubmitProof) (*types.MsgSubmitProofResponse, error) { +func (k msgServer) SubmitProof( + goCtx context.Context, + msg *types.MsgSubmitProof, +) (*types.MsgSubmitProofResponse, error) { // TODO_BLOCKER: Prevent Proof upserts after the tokenomics module has processes the respective session. // TODO_BLOCKER: Validate the signature on the Proof message corresponds to the supplier before Upserting. diff --git a/x/supplier/keeper/msg_server_unstake_supplier.go b/x/supplier/keeper/msg_server_unstake_supplier.go index 79f86db3f..b1f4578bf 100644 --- a/x/supplier/keeper/msg_server_unstake_supplier.go +++ b/x/supplier/keeper/msg_server_unstake_supplier.go @@ -39,9 +39,16 @@ func (k msgServer) UnstakeSupplier( } // Send the coins from the supplier pool back to the supplier - err = k.bankKeeper.UndelegateCoinsFromModuleToAccount(ctx, types.ModuleName, supplierAddress, []sdk.Coin{*supplier.Stake}) + err = k.bankKeeper.UndelegateCoinsFromModuleToAccount( + ctx, types.ModuleName, supplierAddress, []sdk.Coin{*supplier.Stake}, + ) if err != nil { - logger.Error(fmt.Sprintf("could not send %v coins from %s module to %s account due to %v", supplier.Stake, supplierAddress, types.ModuleName, err)) + logger.Error( + fmt.Sprintf( + "could not send %v coins from %s module to %s account due to %v", + supplier.Stake, supplierAddress, types.ModuleName, err, + ), + ) return nil, err } diff --git a/x/supplier/keeper/query_proof.go b/x/supplier/keeper/query_proof.go index 26f18f637..0ba1467ed 100644 --- a/x/supplier/keeper/query_proof.go +++ b/x/supplier/keeper/query_proof.go @@ -12,7 +12,11 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k Keeper) AllProofs(goCtx context.Context, req *types.QueryAllProofsRequest) (*types.QueryAllProofsResponse, error) { +// AllProofs returns all proofs stored on-chain. +func (k Keeper) AllProofs( + goCtx context.Context, + req *types.QueryAllProofsRequest, +) (*types.QueryAllProofsResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -39,7 +43,11 @@ func (k Keeper) AllProofs(goCtx context.Context, req *types.QueryAllProofsReques return &types.QueryAllProofsResponse{Proof: proofs, Pagination: pageRes}, nil } -func (k Keeper) Proof(goCtx context.Context, req *types.QueryGetProofRequest) (*types.QueryGetProofResponse, error) { +// Proof returns a singular proof according to the request. +func (k Keeper) Proof( + goCtx context.Context, + req *types.QueryGetProofRequest, +) (*types.QueryGetProofResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/x/supplier/keeper/query_supplier.go b/x/supplier/keeper/query_supplier.go index c27e8e8f6..ded75c907 100644 --- a/x/supplier/keeper/query_supplier.go +++ b/x/supplier/keeper/query_supplier.go @@ -14,7 +14,11 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -func (k Keeper) SupplierAll(goCtx context.Context, req *types.QueryAllSupplierRequest) (*types.QueryAllSupplierResponse, error) { +// SupplierAll returns all supplier handling the query request. +func (k Keeper) SupplierAll( + goCtx context.Context, + req *types.QueryAllSupplierRequest, +) (*types.QueryAllSupplierResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } @@ -41,7 +45,11 @@ func (k Keeper) SupplierAll(goCtx context.Context, req *types.QueryAllSupplierRe return &types.QueryAllSupplierResponse{Supplier: suppliers, Pagination: pageRes}, nil } -func (k Keeper) Supplier(goCtx context.Context, req *types.QueryGetSupplierRequest) (*types.QueryGetSupplierResponse, error) { +// Supplier returns a specific supplier handling the query request. +func (k Keeper) Supplier( + goCtx context.Context, + req *types.QueryGetSupplierRequest, +) (*types.QueryGetSupplierResponse, error) { if req == nil { return nil, status.Error(codes.InvalidArgument, "invalid request") } diff --git a/x/supplier/types/message_submit_proof.go b/x/supplier/types/message_submit_proof.go index ad00eb225..d53f074b1 100644 --- a/x/supplier/types/message_submit_proof.go +++ b/x/supplier/types/message_submit_proof.go @@ -1,17 +1,23 @@ package types import ( + sdkerrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" sessiontypes "github.com/pokt-network/poktroll/x/session/types" ) +// TypeMsgSubmitProof defines the type of the message. const TypeMsgSubmitProof = "submit_proof" var _ sdk.Msg = (*MsgSubmitProof)(nil) -func NewMsgSubmitProof(supplierAddress string, sessionHeader *sessiontypes.SessionHeader, proof []byte) *MsgSubmitProof { +// NewMsgSubmitProof creates a new MsgSubmitProof instance form the given parameters. +func NewMsgSubmitProof( + supplierAddress string, + sessionHeader *sessiontypes.SessionHeader, + proof []byte, +) *MsgSubmitProof { return &MsgSubmitProof{ SupplierAddress: supplierAddress, SessionHeader: sessionHeader, @@ -19,14 +25,17 @@ func NewMsgSubmitProof(supplierAddress string, sessionHeader *sessiontypes.Sessi } } +// Route returns the router key for this message type. func (msg *MsgSubmitProof) Route() string { return RouterKey } +// Type returns the type of the message. func (msg *MsgSubmitProof) Type() string { return TypeMsgSubmitProof } +// GetSigners retirns the signers of this message. func (msg *MsgSubmitProof) GetSigners() []sdk.AccAddress { supplierAddress, err := sdk.AccAddressFromBech32(msg.SupplierAddress) if err != nil { @@ -35,15 +44,20 @@ func (msg *MsgSubmitProof) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{supplierAddress} } +// GetSignBytes returns the signable btes of the message. func (msg *MsgSubmitProof) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(msg) return sdk.MustSortJSON(bz) } +// ValidateBasic performs basic validation on this message. func (msg *MsgSubmitProof) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.SupplierAddress) if err != nil { - return sdkerrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid supplierAddress address (%s)", err) + return sdkerrors.Wrapf( + ErrSupplierInvalidService, + "invalid supplierAddress address (%s)", err, + ) } return nil } diff --git a/x/supplier/types/query_validation.go b/x/supplier/types/query_validation.go index 5eb2a7bb5..13c3d467d 100644 --- a/x/supplier/types/query_validation.go +++ b/x/supplier/types/query_validation.go @@ -16,7 +16,10 @@ import ( func (query *QueryGetClaimRequest) ValidateBasic() error { // Validate the supplier address if _, err := sdk.AccAddressFromBech32(query.SupplierAddress); err != nil { - return ErrSupplierInvalidAddress.Wrapf("invalid supplier address for claim being retrieved %s; (%v)", query.SupplierAddress, err) + return ErrSupplierInvalidAddress.Wrapf( + "invalid supplier address for claim being retrieved %s; (%v)", + query.SupplierAddress, err, + ) } // TODO_TECHDEBT: Validate the session ID once we have a deterministic way to generate it @@ -34,7 +37,10 @@ func (query *QueryAllClaimsRequest) ValidateBasic() error { switch filter := query.Filter.(type) { case *QueryAllClaimsRequest_SupplierAddress: if _, err := sdk.AccAddressFromBech32(filter.SupplierAddress); err != nil { - return ErrSupplierInvalidAddress.Wrapf("invalid supplier address for claims being retrieved %s; (%v)", filter.SupplierAddress, err) + return ErrSupplierInvalidAddress.Wrapf( + "invalid supplier address for claims being retrieved %s; (%v)", + filter.SupplierAddress, err, + ) } case *QueryAllClaimsRequest_SessionId: @@ -45,7 +51,10 @@ func (query *QueryAllClaimsRequest) ValidateBasic() error { case *QueryAllClaimsRequest_SessionEndHeight: if filter.SessionEndHeight < 0 { - return ErrSupplierInvalidSessionEndHeight.Wrapf("invalid session end height for claims being retrieved %d", filter.SessionEndHeight) + return ErrSupplierInvalidSessionEndHeight.Wrapf( + "invalid session end height for claims being retrieved %d", + filter.SessionEndHeight, + ) } default: From 39734f07453b1b316234144c38ab4abe06e16660 Mon Sep 17 00:00:00 2001 From: h5law Date: Mon, 15 Jan 2024 19:13:41 +0000 Subject: [PATCH 19/61] feat: add new filter to gci to ignore files with import block scaffold comments --- tools/scripts/gci/filters/filters.go | 7 +++++++ tools/scripts/gci/main.go | 1 + 2 files changed, 8 insertions(+) diff --git a/tools/scripts/gci/filters/filters.go b/tools/scripts/gci/filters/filters.go index 51c85f75d..8113ef455 100644 --- a/tools/scripts/gci/filters/filters.go +++ b/tools/scripts/gci/filters/filters.go @@ -41,6 +41,13 @@ func PathMatchesMockGo(path string) (bool, error) { return strings.HasSuffix(path, "_mock.go"), nil } +// ImportBlockContainsScaffoldComment matches import blocks containing the +// `// this line is used by starport scaffolding` comment. +func ImportBlockContainsScaffoldComment(path string) (bool, error) { + contains := strings.Contains(path, "// this line is used by starport scaffolding") + return contains, nil +} + // ContentMatchesEmptyImportScaffold matches files that can't be goimport'd due // to ignite incompatibility. func ContentMatchesEmptyImportScaffold(path string) (bool, error) { diff --git a/tools/scripts/gci/main.go b/tools/scripts/gci/main.go index 3175ddf86..8f3eefbf0 100644 --- a/tools/scripts/gci/main.go +++ b/tools/scripts/gci/main.go @@ -26,6 +26,7 @@ var ( filters.PathMatchesProtobufGatewayGo, filters.PathMatchesMockGo, filters.ContentMatchesEmptyImportScaffold, + filters.ImportBlockContainsScaffoldComment, } ) From 019799dbf6e548317680d6dd14c0f5f8f17524c9 Mon Sep 17 00:00:00 2001 From: h5law Date: Mon, 15 Jan 2024 20:00:11 +0000 Subject: [PATCH 20/61] chore: fix filter for scaffold imports --- tools/scripts/gci/filters/filters.go | 31 ++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/tools/scripts/gci/filters/filters.go b/tools/scripts/gci/filters/filters.go index 8113ef455..c5067f763 100644 --- a/tools/scripts/gci/filters/filters.go +++ b/tools/scripts/gci/filters/filters.go @@ -44,8 +44,7 @@ func PathMatchesMockGo(path string) (bool, error) { // ImportBlockContainsScaffoldComment matches import blocks containing the // `// this line is used by starport scaffolding` comment. func ImportBlockContainsScaffoldComment(path string) (bool, error) { - contains := strings.Contains(path, "// this line is used by starport scaffolding") - return contains, nil + return containsImportScaffoldComment(path) } // ContentMatchesEmptyImportScaffold matches files that can't be goimport'd due @@ -84,6 +83,34 @@ func containsEmptyImportScaffold(goSrcPath string) (isEmptyImport bool, _ error) return false, nil } +// containsImportScaffoldComment checks if the go file at goSrcPath contains a +// comment in the import block like the following: +// +// // this line is used by starport scaffolding ... +func containsImportScaffoldComment(goSrcPath string) (containsComment bool, _ error) { + file, err := os.Open(goSrcPath) + if err != nil { + return false, err + } + defer file.Close() + + scanner := bufio.NewScanner(file) + scanner.Split(importBlockSplit) + + for scanner.Scan() { + trimmedImportBlock := strings.Trim(scanner.Text(), "\n\t") + if strings.Contains(trimmedImportBlock, igniteScaffoldComment) { + return true, nil + } + } + + if scanner.Err() != nil { + return false, scanner.Err() + } + + return false, nil +} + // importBlockSplit is a split function intended to be used with bufio.Scanner // to extract the contents of a multi-line go import block. func importBlockSplit(data []byte, _ bool) (advance int, token []byte, err error) { From 2eb47cad655e54507a7b2b6cf75cb442a291d4e8 Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 00:23:49 +0000 Subject: [PATCH 21/61] feat: add Linter workflow separating it from testing, with appropriate helpers --- .github/workflows/linter.yml | 84 ++++++++++++++ .github/workflows/run-tests.yml | 3 - .golangci.yml | 12 -- Makefile | 1 + .../scaffold_filter/filters/filters.go | 109 ++++++++++++++++++ tools/scripts/scaffold_filter/main.go | 48 ++++++++ 6 files changed, 242 insertions(+), 15 deletions(-) create mode 100644 .github/workflows/linter.yml create mode 100644 tools/scripts/scaffold_filter/filters/filters.go create mode 100644 tools/scripts/scaffold_filter/main.go diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml new file mode 100644 index 000000000..d90461122 --- /dev/null +++ b/.github/workflows/linter.yml @@ -0,0 +1,84 @@ +# The reason the linting step has been moved to its own file is due to this +# aside in the golangci-lint action repo underneath the first code block: +# Ref: https://github.com/golangci/golangci-lint-action#how-to-use +# tl;dr: "We recommend running this action in a job separate from other jobs +# (go test, etc) because different jobs run in parallel." + +Name: Linter + +on: + push: + branches: ["main"] + pull_request: + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} + cancel-in-progress: true + +# Ref: https://github.com/golangci/golangci-lint-action#comments-and-annotations +permissions: + contents: read + pull-requests: read + checks: write + +jobs: + lint: + runs-on: ubuntu-latest + steps: + # Firstly setup the repo to a point where golangci-lint is able to lint + # properly without getting typeerror's from revive everywhere. + - name: install ignite + # TODO_TECHDEBT: upgrade to the latest Ignite (the latest at the moment of creating a note is 0.28). Need to downgrade to fix CI pipelines. Might be done in scope of #240. + run: | + # curl https://get.ignite.com/cli! | bash + wget https://github.com/ignite/cli/releases/download/v0.27.2/ignite_0.27.2_linux_amd64.tar.gz + tar -xzf ignite_0.27.2_linux_amd64.tar.gz + sudo mv ignite /usr/local/bin/ignite + ignite version + + - uses: actions/checkout@v3 + with: + fetch-depth: "0" # Per https://github.com/ignite/cli/issues/1674#issuecomment-1144619147 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.20.10" + cache: false # Per https://github.com/golangci/golangci-lint-action#how-to-use + + - name: Install CI dependencies + run: make install_ci_deps + + - name: Generate protobufs + run: make proto_regen + + # Fetch a list of all modified files in this PR. + - name: Get Modified Files + run: git diff --name-only ${{ github.event.before }} ${{ github.sha }} > modified_files.txt + + # Filter the list of files modified in this PR to exclude those that have + # ignite scaffold comments in their import block, this is because gci + # (golangci-lint's import formatter) doesn't support this kind of filtering + # and removes all comments from import blocks. + - name: Filter For Lintable Files + run: go run ./tools/scripts/scaffold_filter/main.go $(cat modified_files.txt) > files_to_lint.txt + + # Run golangci-lint on the filtered files from this PR - allowing gci to + # catch any improperly formatted import blocks in this PR. + - name: Run golangci-lint (filtered for scaffold comments) + uses: golangci/golangci-lint-action@v3 + with: + version: latest + args: --timeout=15m --config=.golangci.yml $(cat files_to_lint.txt) + only-new-issues: true + + # Do a second lint pass without import checking (after filtered lint) to + # catcy any linter errors in files that were excluded in the first pass. + # This step disables gci checks, to check for all other linter errors, + # on every file in the PR, without filtering. + - name: Run golangci-lint (without import checking) + uses: golangci/golangci-lint-action@v3 + with: + version: latest + args: --timeout=15m --config=.golangci.yml --disable gci $(cat modified_files.txt) + only-new-issues: true diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 38a4331e0..84fe8ca24 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -50,8 +50,5 @@ jobs: - name: Format the repo run: make gofumpt - - name: Run golangci-lint - run: make go_lint - - name: Test run: make go_test diff --git a/.golangci.yml b/.golangci.yml index 762439583..9ea4a83fd 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -50,15 +50,10 @@ issues: - path: ^x/.+/genesis\.go$ linters: - gci - - lll - - gofumpt # Exclude cosmos-sdk module module.go files as they are generated with unused # parameters and unchecked errors. - path: ^x/.+/module\.go$ linters: - - gci - - lll - - gofumpt - revive - errcheck # Exclude cosmos-sdk module tx.go files as they are generated with unused @@ -67,22 +62,18 @@ issues: linters: - gci - lll - - gofumpt - unused # Exclude simulation code as it's generated with lots of unused parameters. - path: .*/simulation/.*|_simulation\.go$ linters: - gci - lll - - gofumpt - revive # Exclude cosmos-sdk module codec files as they are scaffolded with a unused # parameters and a comment used by ignite CLI. - path: ^x/.+/codec.go$ linters: - - gci - lll - - gofumpt - revive - path: _test\.go$ linters: @@ -92,9 +83,6 @@ issues: - path: errors\.go$ linters: - lll - - path: ./app/app.go - linters: - - gci # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration #new: true, #fix: true, diff --git a/Makefile b/Makefile index 61fec6842..fdf84aae8 100644 --- a/Makefile +++ b/Makefile @@ -172,6 +172,7 @@ localnet_regenesis: ## Regenerate the localnet genesis file .PHONY: go_lint go_lint: ## Run all go linters golangci-lint run + .PHONY: gci gci: check_gci ## Run gci (import ordering) on all applicable files, this writes changes in place go run ./tools/scripts/gci diff --git a/tools/scripts/scaffold_filter/filters/filters.go b/tools/scripts/scaffold_filter/filters/filters.go new file mode 100644 index 000000000..136d0b2ab --- /dev/null +++ b/tools/scripts/scaffold_filter/filters/filters.go @@ -0,0 +1,109 @@ +package filters + +import ( + "bufio" + "bytes" + "os" + "strings" +) + +const igniteScaffoldComment = "// this line is used by starport scaffolding" + +var ( + importStart = []byte("import (") + importEnd = []byte(")") +) + +// FilterFn is a function that returns true if the given path matches the +// filter's criteria. +type FilterFn func(path string) (bool, error) + +// ImportBlockContainsScaffoldComment matches import blocks containing the +// `// this line is used by starport scaffolding` comment. +func ImportBlockContainsScaffoldComment(path string) (bool, error) { + return containsImportScaffoldComment(path) +} + +// ContentMatchesEmptyImportScaffold matches files that can't be goimport'd due +// to ignite incompatibility. +func ContentMatchesEmptyImportScaffold(path string) (bool, error) { + return containsEmptyImportScaffold(path) +} + +// containsEmptyImportScaffold checks if the go file at goSrcPath contains an +// import statement like the following: +// +// import ( +// // this line is used by starport scaffolding ... +// ) +func containsEmptyImportScaffold(goSrcPath string) (isEmptyImport bool, _ error) { + file, err := os.Open(goSrcPath) + if err != nil { + return false, err + } + defer file.Close() + + scanner := bufio.NewScanner(file) + scanner.Split(importBlockSplit) + + for scanner.Scan() { + trimmedImportBlock := strings.Trim(scanner.Text(), "\n\t") + if strings.HasPrefix(trimmedImportBlock, igniteScaffoldComment) { + return true, nil + } + } + + if scanner.Err() != nil { + return false, scanner.Err() + } + + return false, nil +} + +// containsImportScaffoldComment checks if the go file at goSrcPath contains a +// comment in the import block like the following: +// +// // this line is used by starport scaffolding ... +func containsImportScaffoldComment(goSrcPath string) (containsComment bool, _ error) { + file, err := os.Open(goSrcPath) + if err != nil { + return false, err + } + defer file.Close() + + scanner := bufio.NewScanner(file) + scanner.Split(importBlockSplit) + + for scanner.Scan() { + trimmedImportBlock := strings.Trim(scanner.Text(), "\n\t") + if strings.Contains(trimmedImportBlock, igniteScaffoldComment) { + return true, nil + } + } + + if scanner.Err() != nil { + return false, scanner.Err() + } + + return false, nil +} + +// importBlockSplit is a split function intended to be used with bufio.Scanner +// to extract the contents of a multi-line go import block. +func importBlockSplit(data []byte, _ bool) (advance int, token []byte, err error) { + // Search for the beginning of the import block + startIdx := bytes.Index(data, importStart) + if startIdx == -1 { + return 0, nil, nil + } + + // Search for the end of the import block from the start index + endIdx := bytes.Index(data[startIdx:], importEnd) + if endIdx == -1 { + return 0, nil, nil + } + + // Return the entire import block, including "import (" and ")" + importBlock := data[startIdx+len(importStart) : startIdx-len(importEnd)+endIdx+1] + return startIdx + endIdx + 1, importBlock, nil +} diff --git a/tools/scripts/scaffold_filter/main.go b/tools/scripts/scaffold_filter/main.go new file mode 100644 index 000000000..1cdc72430 --- /dev/null +++ b/tools/scripts/scaffold_filter/main.go @@ -0,0 +1,48 @@ +package main + +import ( + "fmt" + "os" + + "github.com/pokt-network/poktroll/tools/scripts/gci/filters" +) + +var defaultExcludeFilters = []filters.FilterFn{ + filters.ContentMatchesEmptyImportScaffold, + filters.ImportBlockContainsScaffoldComment, +} + +func main() { + if len(os.Args) < 2 { + fmt.Printf("Usage: %s ...\n", os.Args[0]) + os.Exit(1) + } + + var filesToProcess []string + // For each file passed as an argument check whether to exclude it + // according to the filters, from a golangci-lint check. This is + // purely because gci (the golanci-lint linter for imports) doesn't + // support this type of filtering natively. + for _, path := range os.Args[1:] { + for _, excludeFilter := range defaultExcludeFilters { + shouldExclude, err := excludeFilter(path) + if err != nil { + fmt.Printf("Error processing file %s: %s\n", path, err) + continue + } + if !shouldExclude { + filesToProcess = append(filesToProcess, path) + } + } + } + + // Print all files to be processed by golangci-lint. + // This is so gci doesn't remove the scaffold comments in + // the import block for files scaffolded by ignite. + for _, file := range filesToProcess { + // We print the file names as this is a helper used in the + // testing workflow and the output of this file is appended + // to a file from which golangci-lint will be run on, in CI. + fmt.Println(file) + } +} From 03ff71781aa2dc2e6917e6645875657577cc965e Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 00:36:41 +0000 Subject: [PATCH 22/61] feat: replace scaffold lines with correct gci import ordering --- app/app.go | 99 ++++++++++++----------------------------- cmd/pocketd/cmd/root.go | 10 ++--- x/application/module.go | 2 + x/gateway/module.go | 2 + x/pocket/module.go | 2 + x/service/module.go | 2 + x/supplier/module.go | 2 + x/tokenomics/module.go | 2 + 8 files changed, 45 insertions(+), 76 deletions(-) diff --git a/app/app.go b/app/app.go index 2c12d0fd4..352038462 100644 --- a/app/app.go +++ b/app/app.go @@ -7,6 +7,8 @@ import ( "os" "path/filepath" + // this line is used by starport scaffolding # stargate/app/moduleImport + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" dbm "github.com/cometbft/cometbft-db" @@ -136,11 +138,8 @@ import ( ) const ( - // AccountAddressPrefix is the prefix generated addresses will have. AccountAddressPrefix = "pokt" - // Name is the name of the network itself. - Name = "pocket" - // DenomuPOKT is the default denomination used in the chain. + Name = "pocket" // TODO_CLEANUP: Find a way to centralize the use of `upokt` throughout the codebase DenomuPOKT = "upokt" ) @@ -256,20 +255,19 @@ type App struct { memKeys map[string]*storetypes.MemoryStoreKey // keepers - AccountKeeper authkeeper.AccountKeeper - AuthzKeeper authzkeeper.Keeper - BankKeeper bankkeeper.Keeper - CapabilityKeeper *capabilitykeeper.Keeper - StakingKeeper *stakingkeeper.Keeper - SlashingKeeper slashingkeeper.Keeper - MintKeeper mintkeeper.Keeper - DistrKeeper distrkeeper.Keeper - GovKeeper govkeeper.Keeper - CrisisKeeper *crisiskeeper.Keeper - UpgradeKeeper *upgradekeeper.Keeper - ParamsKeeper paramskeeper.Keeper - // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly - IBCKeeper *ibckeeper.Keeper + AccountKeeper authkeeper.AccountKeeper + AuthzKeeper authzkeeper.Keeper + BankKeeper bankkeeper.Keeper + CapabilityKeeper *capabilitykeeper.Keeper + StakingKeeper *stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper govkeeper.Keeper + CrisisKeeper *crisiskeeper.Keeper + UpgradeKeeper *upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly EvidenceKeeper evidencekeeper.Keeper TransferKeeper ibctransferkeeper.Keeper ICAHostKeeper icahostkeeper.Keeper @@ -369,11 +367,7 @@ func New( ) // set the BaseApp's parameter store - app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( - appCodec, - keys[upgradetypes.StoreKey], - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) + app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper(appCodec, keys[upgradetypes.StoreKey], authtypes.NewModuleAddress(govtypes.ModuleName).String()) bApp.SetParamStore(&app.ConsensusParamsKeeper) // add capability keeper and ScopeToModule for ibc module @@ -608,9 +602,7 @@ func New( app.AccountKeeper, app.GatewayKeeper, ) - applicationModule := applicationmodule.NewAppModule( - appCodec, app.ApplicationKeeper, app.AccountKeeper, app.BankKeeper, - ) + applicationModule := applicationmodule.NewAppModule(appCodec, app.ApplicationKeeper, app.AccountKeeper, app.BankKeeper) // TODO_TECHDEBT: Evaluate if this NB goes away after we upgrade to cosmos 0.5x // NB: there is a circular dependency between the supplier and session keepers. @@ -699,40 +691,18 @@ func New( app.BaseApp.DeliverTx, encodingConfig.TxConfig, ), - auth.NewAppModule( - appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName), - ), + auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), - feegrantmodule.NewAppModule( - appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry, - ), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), groupmodule.NewAppModule(appCodec, app.GroupKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), - gov.NewAppModule( - appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName), - ), + gov.NewAppModule(appCodec, &app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), - slashing.NewAppModule( - appCodec, - app.SlashingKeeper, - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.GetSubspace(slashingtypes.ModuleName), - ), - distr.NewAppModule( - appCodec, - app.DistrKeeper, - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.GetSubspace(distrtypes.ModuleName), - ), - staking.NewAppModule( - appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName), - ), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName)), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), upgrade.NewAppModule(app.UpgradeKeeper), evidence.NewAppModule(app.EvidenceKeeper), consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), @@ -749,11 +719,7 @@ func New( tokenomicsModule, // this line is used by starport scaffolding # stargate/app/appModule - crisis.NewAppModule( - app.CrisisKeeper, - skipGenesisInvariants, - app.GetSubspace(crisistypes.ModuleName), - ), // always be last to make sure that it checks for all invariants and not only part of them + crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), // always be last to make sure that it checks for all invariants and not only part of them ) // During begin block slashing happens after distr.BeginBlocker so that @@ -880,12 +846,7 @@ func New( // create the simulation manager and define the order of the modules for deterministic simulations overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule( - app.appCodec, - app.AccountKeeper, - authsims.RandomGenesisAccounts, - app.GetSubspace(authtypes.ModuleName), - ), + authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), } app.sm = module.NewSimulationManagerFromAppModules(app.mm.Modules, overrideModules) app.sm.RegisterStoreDecoders() @@ -1036,7 +997,7 @@ func (app *App) GetSubspace(moduleName string) paramstypes.Subspace { // RegisterAPIRoutes registers all application module routes with the provided // API server. -func (app *App) RegisterAPIRoutes(apiSvr *api.Server, _ config.APIConfig) { +func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { clientCtx := apiSvr.ClientCtx // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) @@ -1073,11 +1034,7 @@ func (app *App) RegisterNodeService(clientCtx client.Context) { } // initParamsKeeper init params keeper and its subspaces -func initParamsKeeper( - appCodec codec.BinaryCodec, - legacyAmino *codec.LegacyAmino, - key, tkey storetypes.StoreKey, -) paramskeeper.Keeper { +func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) paramsKeeper.Subspace(authtypes.ModuleName) diff --git a/cmd/pocketd/cmd/root.go b/cmd/pocketd/cmd/root.go index 897ac3f05..55b7071fc 100644 --- a/cmd/pocketd/cmd/root.go +++ b/cmd/pocketd/cmd/root.go @@ -7,6 +7,8 @@ import ( "path/filepath" "strings" + // this line is used by starport scaffolding # root/moduleImport + dbm "github.com/cometbft/cometbft-db" tmcfg "github.com/cometbft/cometbft/config" tmcli "github.com/cometbft/cometbft/libs/cli" @@ -37,6 +39,8 @@ import ( "github.com/spf13/cobra" "github.com/spf13/pflag" + // this line is used by starport scaffolding # root/moduleImport + "github.com/pokt-network/poktroll/app" appparams "github.com/pokt-network/poktroll/app/params" appgateservercmd "github.com/pokt-network/poktroll/pkg/appgateserver/cmd" @@ -110,11 +114,7 @@ func initRootCmd( gentxModule := app.ModuleBasics[genutiltypes.ModuleName].(genutil.AppModuleBasic) rootCmd.AddCommand( genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), - genutilcli.CollectGenTxsCmd( - banktypes.GenesisBalancesIterator{}, - app.DefaultNodeHome, - gentxModule.GenTxValidator, - ), + genutilcli.CollectGenTxsCmd(banktypes.GenesisBalancesIterator{}, app.DefaultNodeHome, gentxModule.GenTxValidator), genutilcli.MigrateGenesisCmd(), genutilcli.GenTxCmd( app.ModuleBasics, diff --git a/x/application/module.go b/x/application/module.go index 472a6b6a1..b7e4956ca 100644 --- a/x/application/module.go +++ b/x/application/module.go @@ -5,6 +5,8 @@ import ( "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/gateway/module.go b/x/gateway/module.go index 1c19cfe4f..7addaf6c0 100644 --- a/x/gateway/module.go +++ b/x/gateway/module.go @@ -5,6 +5,8 @@ import ( "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/pocket/module.go b/x/pocket/module.go index e8569ded2..2a0e9d026 100644 --- a/x/pocket/module.go +++ b/x/pocket/module.go @@ -5,6 +5,8 @@ import ( "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/service/module.go b/x/service/module.go index d1cb2373a..f8361e1bc 100644 --- a/x/service/module.go +++ b/x/service/module.go @@ -5,6 +5,8 @@ import ( "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/supplier/module.go b/x/supplier/module.go index e3a34d61d..1783cceca 100644 --- a/x/supplier/module.go +++ b/x/supplier/module.go @@ -5,6 +5,8 @@ import ( "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/tokenomics/module.go b/x/tokenomics/module.go index e54983755..e88612416 100644 --- a/x/tokenomics/module.go +++ b/x/tokenomics/module.go @@ -5,6 +5,8 @@ import ( "encoding/json" "fmt" + // this line is used by starport scaffolding # 1 + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" From 186631600227258f6830704ad5f3baed2a77599b Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 00:41:13 +0000 Subject: [PATCH 23/61] chore: enable custom ordering when running `make gci` --- tools/scripts/gci/main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/scripts/gci/main.go b/tools/scripts/gci/main.go index 8f3eefbf0..1d8207bdc 100644 --- a/tools/scripts/gci/main.go +++ b/tools/scripts/gci/main.go @@ -12,6 +12,7 @@ import ( var ( defaultArgs = []string{ + "--custom-order", "--section=standard", "--section=default", "--section=prefix(github.com/pokt-network/poktroll)", From 95cb78f836996dde9ed705be2024d3b2a013b082 Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 11:11:02 +0000 Subject: [PATCH 24/61] chore final lint changes --- .golangci.yml | 14 ++++++++++++++ x/application/types/genesis.go | 18 +++++++++++++++--- x/gateway/module.go | 2 +- x/gateway/types/genesis.go | 12 ++++++++++-- x/pocket/module.go | 2 +- x/supplier/module.go | 6 ++++-- x/supplier/types/genesis.go | 24 ++++++++++++++++++++---- 7 files changed, 65 insertions(+), 13 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 9ea4a83fd..961a00e32 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -54,6 +54,8 @@ issues: # parameters and unchecked errors. - path: ^x/.+/module\.go$ linters: + - lll + - gci - revive - errcheck # Exclude cosmos-sdk module tx.go files as they are generated with unused @@ -83,6 +85,18 @@ issues: - path: errors\.go$ linters: - lll + # Exclude app module code as it's generated with lots with long lines and + # improperly formatted imports. + - path: ^app + linters: + - lll + - gci + # Exclude cmd directory code as it's generated with lots with long lines and + # improperly formatted imports. + - path: ^cmd/poc + linters: + - lll + - gci # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration #new: true, #fix: true, diff --git a/x/application/types/genesis.go b/x/application/types/genesis.go index ce8046f53..cc16f8905 100644 --- a/x/application/types/genesis.go +++ b/x/application/types/genesis.go @@ -43,10 +43,18 @@ func (gs GenesisState) Validate() error { } stake, err := sdk.ParseCoinNormalized(app.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application %v; (%v)", app.Stake, stake.Validate()) + return sdkerrors.Wrapf( + ErrAppInvalidStake, + "invalid stake amount for application %v; (%v)", + app.Stake, stake.Validate(), + ) } if err != nil { - return sdkerrors.Wrapf(ErrAppInvalidStake, "cannot parse stake amount for application %v; (%v)", app.Stake, err) + return sdkerrors.Wrapf( + ErrAppInvalidStake, + "cannot parse stake amount for application %v; (%v)", + app.Stake, err, + ) } if stake.IsZero() || stake.IsNegative() { return sdkerrors.Wrapf(ErrAppInvalidStake, "invalid stake amount for application: %v <= 0", app.Stake) @@ -58,7 +66,11 @@ func (gs GenesisState) Validate() error { // Check that the application's delegated gateway addresses are valid for _, gatewayAddr := range app.DelegateeGatewayAddresses { if _, err := sdk.AccAddressFromBech32(gatewayAddr); err != nil { - return sdkerrors.Wrapf(ErrAppInvalidGatewayAddress, "invalid gateway address %s; (%v)", gatewayAddr, err) + return sdkerrors.Wrapf( + ErrAppInvalidGatewayAddress, + "invalid gateway address %s; (%v)", + gatewayAddr, err, + ) } } diff --git a/x/gateway/module.go b/x/gateway/module.go index 7addaf6c0..61513b642 100644 --- a/x/gateway/module.go +++ b/x/gateway/module.go @@ -6,7 +6,7 @@ import ( "fmt" // this line is used by starport scaffolding # 1 - + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/gateway/types/genesis.go b/x/gateway/types/genesis.go index 5cb161252..43ab09ab7 100644 --- a/x/gateway/types/genesis.go +++ b/x/gateway/types/genesis.go @@ -35,10 +35,18 @@ func (gs GenesisState) Validate() error { } stake, err := sdk.ParseCoinNormalized(gateway.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway %v; (%v)", gateway.Stake, stake.Validate()) + return sdkerrors.Wrapf( + ErrGatewayInvalidStake, + "invalid stake amount for gateway %v; (%v)", + gateway.Stake, stake.Validate(), + ) } if err != nil { - return sdkerrors.Wrapf(ErrGatewayInvalidStake, "cannot parse stake amount for gateway %v; (%v)", gateway.Stake, err) + return sdkerrors.Wrapf( + ErrGatewayInvalidStake, + "cannot parse stake amount for gateway %v; (%v)", + gateway.Stake, err, + ) } if stake.IsZero() || stake.IsNegative() { return sdkerrors.Wrapf(ErrGatewayInvalidStake, "invalid stake amount for gateway: %v <= 0", gateway.Stake) diff --git a/x/pocket/module.go b/x/pocket/module.go index 2a0e9d026..48b5c16eb 100644 --- a/x/pocket/module.go +++ b/x/pocket/module.go @@ -6,7 +6,7 @@ import ( "fmt" // this line is used by starport scaffolding # 1 - + abci "github.com/cometbft/cometbft/abci/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" diff --git a/x/supplier/module.go b/x/supplier/module.go index 1783cceca..a39dc9303 100644 --- a/x/supplier/module.go +++ b/x/supplier/module.go @@ -7,14 +7,16 @@ import ( // this line is used by starport scaffolding # 1 + "github.com/grpc-ecosystem/grpc-gateway/runtime" + "github.com/spf13/cobra" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/grpc-ecosystem/grpc-gateway/runtime" - "github.com/spf13/cobra" "github.com/pokt-network/poktroll/x/supplier/client/cli" "github.com/pokt-network/poktroll/x/supplier/keeper" diff --git a/x/supplier/types/genesis.go b/x/supplier/types/genesis.go index 9d06b42ff..2772e4007 100644 --- a/x/supplier/types/genesis.go +++ b/x/supplier/types/genesis.go @@ -44,16 +44,32 @@ func (gs GenesisState) Validate() error { } stake, err := sdk.ParseCoinNormalized(supplier.Stake.String()) if !stake.IsValid() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier %v; (%v)", supplier.Stake, stake.Validate()) + return sdkerrors.Wrapf( + ErrSupplierInvalidStake, + "invalid stake amount for supplier %v; (%v)", + supplier.Stake, stake.Validate(), + ) } if err != nil { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "cannot parse stake amount for supplier %v; (%v)", supplier.Stake, err) + return sdkerrors.Wrapf( + ErrSupplierInvalidStake, + "cannot parse stake amount for supplier %v; (%v)", + supplier.Stake, err, + ) } if stake.IsZero() || stake.IsNegative() { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount for supplier: %v <= 0", supplier.Stake) + return sdkerrors.Wrapf( + ErrSupplierInvalidStake, + "invalid stake amount for supplier: %v <= 0", + supplier.Stake, + ) } if stake.Denom != "upokt" { - return sdkerrors.Wrapf(ErrSupplierInvalidStake, "invalid stake amount denom for supplier %v", supplier.Stake) + return sdkerrors.Wrapf( + ErrSupplierInvalidStake, + "invalid stake amount denom for supplier %v", + supplier.Stake, + ) } // Validate the application service configs From b0cebf5c73a57c3636513cff197c25ad9247a4b5 Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 11:20:59 +0000 Subject: [PATCH 25/61] feat: enable new flag in golangci-lint config --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 961a00e32..5463d768a 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -98,5 +98,5 @@ issues: - lll - gci # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration - #new: true, + new: true, #fix: true, From 4e71478ff194c593a7d3510d4a3888d6a4396834 Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 21:28:50 +0000 Subject: [PATCH 26/61] chore: fix linter error --- x/supplier/types/message_submit_proof.go | 6 ++++++ x/supplier/types/message_submit_proof_test.go | 3 +-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/x/supplier/types/message_submit_proof.go b/x/supplier/types/message_submit_proof.go index d53f074b1..a118c0f0e 100644 --- a/x/supplier/types/message_submit_proof.go +++ b/x/supplier/types/message_submit_proof.go @@ -53,6 +53,12 @@ func (msg *MsgSubmitProof) GetSignBytes() []byte { // ValidateBasic performs basic validation on this message. func (msg *MsgSubmitProof) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(msg.SupplierAddress) + if err != nil { + return sdkerrors.Wrapf( + ErrSupplierInvalidAddress, + "invalid supplierAddress address (%s)", err, + ) + } if err != nil { return sdkerrors.Wrapf( ErrSupplierInvalidService, diff --git a/x/supplier/types/message_submit_proof_test.go b/x/supplier/types/message_submit_proof_test.go index 8479db05d..f5d0defb2 100644 --- a/x/supplier/types/message_submit_proof_test.go +++ b/x/supplier/types/message_submit_proof_test.go @@ -3,7 +3,6 @@ package types import ( "testing" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" "github.com/pokt-network/poktroll/testutil/sample" @@ -22,7 +21,7 @@ func TestMsgSubmitProof_ValidateBasic(t *testing.T) { msg: MsgSubmitProof{ SupplierAddress: "invalid_address", }, - err: sdkerrors.ErrInvalidAddress, + err: ErrSupplierInvalidAddress, }, { name: "valid address", msg: MsgSubmitProof{ From a6b790b2080658dc91e533358f3a5866901f9820 Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 21:41:09 +0000 Subject: [PATCH 27/61] chore: address comments --- Makefile | 4 ++-- e2e/tests/session_steps_test.go | 10 ++++++---- pkg/relayer/session/session.go | 1 + testutil/testclient/testdelegation/client.go | 2 ++ x/application/client/cli/tx_delegate_to_gateway.go | 4 +++- x/application/client/cli/tx_stake_application.go | 4 +++- x/application/client/cli/tx_undelegate_from_gateway.go | 1 + x/application/client/cli/tx_unstake_application.go | 4 +++- x/gateway/client/cli/tx_stake_gateway.go | 4 +++- x/gateway/client/cli/tx_unstake_gateway.go | 1 + x/session/client/cli/query_get_session.go | 4 +++- x/supplier/client/cli/query_claim.go | 1 + x/supplier/client/cli/tx_stake_supplier.go | 4 +++- x/supplier/client/cli/tx_unstake_supplier.go | 3 ++- 14 files changed, 34 insertions(+), 13 deletions(-) diff --git a/Makefile b/Makefile index fdf84aae8..aae1c9975 100644 --- a/Makefile +++ b/Makefile @@ -87,7 +87,7 @@ check_gci: check_gofumpt: { \ if ( ! ( command -v gci >/dev/null )); then \ - echo "Seems like you don't have gci installed. Make sure you install it via 'go install mvdan.cc/gofumpt@latest' before continuing"; \ + echo "Seems like you don't have gofumpt installed. Make sure you install it via 'go install mvdan.cc/gofumpt@latest' before continuing"; \ exit 1; \ fi; \ } @@ -171,7 +171,7 @@ localnet_regenesis: ## Regenerate the localnet genesis file .PHONY: go_lint go_lint: ## Run all go linters - golangci-lint run + golangci-lint run --timeout=15m --build-tags=e2e,test,integration .PHONY: gci gci: check_gci ## Run gci (import ordering) on all applicable files, this writes changes in place diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index 089bc9bf2..b80729b56 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -24,10 +24,12 @@ import ( const ( createClaimTimeoutDuration = 10 * time.Second eitherEventsReplayBufferSize = 100 - msgClaimSenderQueryFmt = "tm.event='Tx' AND message.sender='%s' AND message.action='/pocket.supplier.MsgCreateClaim'" //nolint:lll - testServiceId = "anvil" - eitherEventsBzReplayObsKey = "eitherEventsBzReplayObsKey" - preExistingClaimsKey = "preExistingClaimsKey" + // Not liniting as this is a long query string. + //nolint:lll + msgClaimSenderQueryFmt = "tm.event='Tx' AND message.sender='%s' AND message.action='/pocket.supplier.MsgCreateClaim'" + testServiceId = "anvil" + eitherEventsBzReplayObsKey = "eitherEventsBzReplayObsKey" + preExistingClaimsKey = "preExistingClaimsKey" ) func (s *suite) AfterTheSupplierCreatesAClaimForTheSessionForServiceForApplication(serviceId, appName string) { diff --git a/pkg/relayer/session/session.go b/pkg/relayer/session/session.go index 034e3fe77..285206a69 100644 --- a/pkg/relayer/session/session.go +++ b/pkg/relayer/session/session.go @@ -178,6 +178,7 @@ func (rs *relayerSessionsManager) mapBlockToSessionsToClaim( // step. This does not address the case where the block client misses // the target block which should be handled by the retry mechanism. See // the discussion in the following GitHub thread for next steps: + // Not linting as breaking the link wouldn't be appropriate // nolint:lll // https://github.com/pokt-network/poktroll/pull/177/files?show-viewed-files=true&file-filters%5B%5D=#r1391957041 if endBlockHeight == block.Height() { diff --git a/testutil/testclient/testdelegation/client.go b/testutil/testclient/testdelegation/client.go index de5bea220..19eb96b7f 100644 --- a/testutil/testclient/testdelegation/client.go +++ b/testutil/testclient/testdelegation/client.go @@ -148,6 +148,8 @@ func NewRedelegationEventBytes( gatewayAddress string, ) []byte { t.Helper() + // Not linting as this is a "fake" JSON string any extra whitespace may + // lead to unexpected behavior during deserialization. //nolint:lll jsonTemplate := `{"tx":"SGVsbG8sIHdvcmxkIQ==","result":{"events":[{"type":"message","attributes":[{"key":"action","value":"/pocket.application.MsgDelegateToGateway"},{"key":"sender","value":"pokt1exampleaddress"},{"key":"module","value":"application"}]},{"type":"pocket.application.EventRedelegation","attributes":[{"key":"app_address","value":"\"%s\""},{"key":"gateway_address","value":"\"%s\""}]}]}}` json := fmt.Sprintf(jsonTemplate, appAddress, gatewayAddress) diff --git a/x/application/client/cli/tx_delegate_to_gateway.go b/x/application/client/cli/tx_delegate_to_gateway.go index eae51917c..761b28cee 100644 --- a/x/application/client/cli/tx_delegate_to_gateway.go +++ b/x/application/client/cli/tx_delegate_to_gateway.go @@ -17,12 +17,14 @@ func CmdDelegateToGateway() *cobra.Command { cmd := &cobra.Command{ Use: "delegate-to-gateway ", Short: "Delegate an application to a gateway", + // Not liniting as this is the long description of the command. + //nolint:lll Long: `Delegate an application to the gateway with the provided address. This is a broadcast operation that delegates authority to the gateway specified to sign relays requests for the application, allowing the gateway act on the behalf of the application during a session. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, //nolint:lll +$ poktrolld --home=$(POKTROLLD_HOME) tx application delegate-to-gateway $(GATEWAY_ADDR) --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { gatewayAddress := args[0] diff --git a/x/application/client/cli/tx_stake_application.go b/x/application/client/cli/tx_stake_application.go index 80fbb2143..fad770a61 100644 --- a/x/application/client/cli/tx_stake_application.go +++ b/x/application/client/cli/tx_stake_application.go @@ -23,11 +23,13 @@ func CmdStakeApplication() *cobra.Command { cmd := &cobra.Command{ Use: "stake-application --config ", Short: "Stake an application", + // Not liniting as this is the long description of the command. + //nolint:lll Long: `Stake an application with the provided parameters. This is a broadcast operation that will stake the tokens and serviceIds and associate them with the application specified by the 'from' address. Example: - $ poktrolld --home=$(POKTROLLD_HOME) tx application stake-application --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, //nolint:lll + $ poktrolld --home=$(POKTROLLD_HOME) tx application stake-application --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { configContent, err := os.ReadFile(flagStakeConfig) diff --git a/x/application/client/cli/tx_undelegate_from_gateway.go b/x/application/client/cli/tx_undelegate_from_gateway.go index cf5308006..835032d0d 100644 --- a/x/application/client/cli/tx_undelegate_from_gateway.go +++ b/x/application/client/cli/tx_undelegate_from_gateway.go @@ -17,6 +17,7 @@ func CmdUndelegateFromGateway() *cobra.Command { cmd := &cobra.Command{ Use: "undelegate-from-gateway [gateway address]", Short: "Undelegate an application from a gateway", + // Not liniting as this is the long description of the command. //nolint:lll Long: `Undelegate an application from the gateway with the provided address. This is a broadcast operation that removes the authority from the gateway specified to sign relays requests for the application, disallowing the gateway diff --git a/x/application/client/cli/tx_unstake_application.go b/x/application/client/cli/tx_unstake_application.go index dc3aac92b..ceb3ca132 100644 --- a/x/application/client/cli/tx_unstake_application.go +++ b/x/application/client/cli/tx_unstake_application.go @@ -18,11 +18,13 @@ func CmdUnstakeApplication() *cobra.Command { cmd := &cobra.Command{ Use: "unstake-application", Short: "Unstake an application", + // Not liniting as this is the long description of the command. + //nolint:lll Long: `Unstake an application. This is a broadcast operation that will unstake the application specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, //nolint:lll +$ poktrolld --home=$(POKTROLLD_HOME) tx application unstake-application --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, args []string) (err error) { clientCtx, err := client.GetClientTxContext(cmd) diff --git a/x/gateway/client/cli/tx_stake_gateway.go b/x/gateway/client/cli/tx_stake_gateway.go index 7a7aa026f..15c12fa5b 100644 --- a/x/gateway/client/cli/tx_stake_gateway.go +++ b/x/gateway/client/cli/tx_stake_gateway.go @@ -22,10 +22,12 @@ func CmdStakeGateway() *cobra.Command { cmd := &cobra.Command{ Use: "stake-gateway --config ", Short: "Stake a gateway", + // Not liniting as this is the long description of the command. + //nolint:lll Long: `Stake a gateway with the provided parameters. This is a broadcast operation that will stake the tokens and associate them with the gateway specified by the 'from' address. Example: - $ poktrolld --home=$(POKTROLLD_HOME) tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, // nolint:lll + $ poktrolld --home=$(POKTROLLD_HOME) tx gateway stake-gateway --config stake_config.yaml --keyring-backend test --from $(GATEWAY) --node $(POCKET_NODE)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { configContent, err := os.ReadFile(flagStakeConfig) diff --git a/x/gateway/client/cli/tx_unstake_gateway.go b/x/gateway/client/cli/tx_unstake_gateway.go index 3beae12aa..fa09b9546 100644 --- a/x/gateway/client/cli/tx_unstake_gateway.go +++ b/x/gateway/client/cli/tx_unstake_gateway.go @@ -18,6 +18,7 @@ func CmdUnstakeGateway() *cobra.Command { cmd := &cobra.Command{ Use: "unstake-gateway ", Short: "Unstake a gateway", + // Not liniting as this is the long description of the command. //nolint:lll Long: `Unstake a gateway. This is a broadcast operation that will unstake the gateway specified by the 'from' address. diff --git a/x/session/client/cli/query_get_session.go b/x/session/client/cli/query_get_session.go index 47b6d66ff..ba5fb81b6 100644 --- a/x/session/client/cli/query_get_session.go +++ b/x/session/client/cli/query_get_session.go @@ -18,6 +18,8 @@ func CmdGetSession() *cobra.Command { cmd := &cobra.Command{ Use: "get-session [block_height]", Short: "Query get-session", + // Not liniting as this is the long description of the command. + //nolint:lll Long: `Query the session data for a specific (app, service, height) tuple. [block_height] is optional. If unspecified, or set to 0, it defaults to the latest height of the node being queried. @@ -25,7 +27,7 @@ func CmdGetSession() *cobra.Command { This is a query operation that will not result in a state transition but simply gives a view into the chain state. Example: - $ poktrolld --home=$(POKTROLLD_HOME) q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 svc1 42 --node $(POCKET_NODE)`, //nolint:lll + $ poktrolld --home=$(POKTROLLD_HOME) q session get-session pokt1mrqt5f7qh8uxs27cjm9t7v9e74a9vvdnq5jva4 svc1 42 --node $(POCKET_NODE)`, Args: cobra.RangeArgs(2, 3), RunE: func(cmd *cobra.Command, args []string) (err error) { appAddressString := args[0] diff --git a/x/supplier/client/cli/query_claim.go b/x/supplier/client/cli/query_claim.go index 90519b52f..418b091b5 100644 --- a/x/supplier/client/cli/query_claim.go +++ b/x/supplier/client/cli/query_claim.go @@ -84,6 +84,7 @@ func CmdShowClaim() *cobra.Command { cmd := &cobra.Command{ Use: "show-claim ", Short: "shows a specific claim", + // Not liniting as this is the long description of the command. //nolint:lll Long: `List a specific claim that the node being queried has access to (if it still exists). diff --git a/x/supplier/client/cli/tx_stake_supplier.go b/x/supplier/client/cli/tx_stake_supplier.go index ded993359..a7d58c55f 100644 --- a/x/supplier/client/cli/tx_stake_supplier.go +++ b/x/supplier/client/cli/tx_stake_supplier.go @@ -24,11 +24,13 @@ func CmdStakeSupplier() *cobra.Command { cmd := &cobra.Command{ Use: "stake-supplier --config ", Short: "Stake a supplier", + // Not liniting as this is the long description of the command. + //nolint:lll Long: `Stake an supplier with the provided parameters. This is a broadcast operation that will stake the tokens and associate them with the supplier specified by the 'from' address. Example: -$ poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, //nolint:lll +$ poktrolld --home=$(POKTROLLD_HOME) tx supplier stake-supplier --config stake_config.yaml --keyring-backend test --from $(APP) --node $(POCKET_NODE)`, Args: cobra.ExactArgs(0), RunE: func(cmd *cobra.Command, _ []string) (err error) { diff --git a/x/supplier/client/cli/tx_unstake_supplier.go b/x/supplier/client/cli/tx_unstake_supplier.go index f28e8dbd5..4be28f19f 100644 --- a/x/supplier/client/cli/tx_unstake_supplier.go +++ b/x/supplier/client/cli/tx_unstake_supplier.go @@ -15,7 +15,8 @@ func CmdUnstakeSupplier() *cobra.Command { cmd := &cobra.Command{ Use: "unstake-supplier", Short: "Unstake a supplier", - // nolint:lll + // Not liniting as this is the long description of the command. + //nolint:lll Long: `Unstake an supplier with the provided parameters. This is a broadcast operation that will unstake the supplier specified by the 'from' address. Example: From 34f9e8ad3dc275fb216b00ac675e9d7232717362 Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 21:42:55 +0000 Subject: [PATCH 28/61] chore: remove mocked addressing comment --- testutil/keeper/application.go | 2 +- testutil/keeper/gateway.go | 2 +- testutil/keeper/pocket.go | 2 +- testutil/keeper/service.go | 2 +- testutil/keeper/supplier.go | 2 +- testutil/keeper/tokenomics.go | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/testutil/keeper/application.go b/testutil/keeper/application.go index f7aa3b3ed..4627ab5b3 100644 --- a/testutil/keeper/application.go +++ b/testutil/keeper/application.go @@ -27,7 +27,7 @@ import ( // WARNING: Using this map may cause issues if running multiple tests in parallel var stakedGatewayMap = make(map[string]struct{}) -// ApplicationKeeper returns a mocked application keeper and context for testing +// ApplicationKeeper returns an application keeper and context for testing // it mocks the chain having staked gateways via the use of the stakedGatewayMap func ApplicationKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) diff --git a/testutil/keeper/gateway.go b/testutil/keeper/gateway.go index 28d6ad380..7290d0a01 100644 --- a/testutil/keeper/gateway.go +++ b/testutil/keeper/gateway.go @@ -20,7 +20,7 @@ import ( "github.com/pokt-network/poktroll/x/gateway/types" ) -// GatewayKeeper returns a mocked gateway keeper and context for testing. +// GatewayKeeper returns a gateway keeper and context for testing. func GatewayKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) diff --git a/testutil/keeper/pocket.go b/testutil/keeper/pocket.go index 927eaa5de..17db656a9 100644 --- a/testutil/keeper/pocket.go +++ b/testutil/keeper/pocket.go @@ -18,7 +18,7 @@ import ( "github.com/pokt-network/poktroll/x/pocket/types" ) -// PocketKeeper returns a mocked pocket keeper and context for testing. +// PocketKeeper returns a pocket keeper and context for testing. func PocketKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) diff --git a/testutil/keeper/service.go b/testutil/keeper/service.go index 3e360a2ca..d0ea45965 100644 --- a/testutil/keeper/service.go +++ b/testutil/keeper/service.go @@ -18,7 +18,7 @@ import ( "github.com/pokt-network/poktroll/x/service/types" ) -// ServiceKeeper returns a mocked service keeper and context for testing. +// ServiceKeeper returns a service keeper and context for testing. func ServiceKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) diff --git a/testutil/keeper/supplier.go b/testutil/keeper/supplier.go index f34ab3b16..3951a5ba9 100644 --- a/testutil/keeper/supplier.go +++ b/testutil/keeper/supplier.go @@ -22,7 +22,7 @@ import ( "github.com/pokt-network/poktroll/x/supplier/types" ) -// SupplierKeeper returns a mocked supplier keeper and context for testing. +// SupplierKeeper returns a supplier keeper and context for testing. func SupplierKeeper( t testing.TB, sessionByAppAddr supplier.SessionsByAppAddress, diff --git a/testutil/keeper/tokenomics.go b/testutil/keeper/tokenomics.go index 3c2e72993..53013d3c4 100644 --- a/testutil/keeper/tokenomics.go +++ b/testutil/keeper/tokenomics.go @@ -18,7 +18,7 @@ import ( "github.com/pokt-network/poktroll/x/tokenomics/types" ) -// TokenomicsKeeper returns a mocked tokenomics keeper and context for testing. +// TokenomicsKeeper returns a tokenomics keeper and context for testing. func TokenomicsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context) { storeKey := sdk.NewKVStoreKey(types.StoreKey) memStoreKey := storetypes.NewMemoryStoreKey(types.MemStoreKey) From 0574b252ef8985e0462bb170177c6dda5bdf081c Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 21:45:30 +0000 Subject: [PATCH 29/61] chore: fix golangci-lint config syntax --- .golangci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index 5463d768a..8324dba19 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -98,5 +98,5 @@ issues: - lll - gci # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration - new: true, + new: true #fix: true, From 11c1885689b062206fd5e1c0f3e38b1a837d85e2 Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 21:58:06 +0000 Subject: [PATCH 30/61] chore: add --version checks to fix CI "hopefully" --- Makefile | 4 ++-- docs/static/openapi.yml | 2 -- go.mod | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index aae1c9975..3760578e8 100644 --- a/Makefile +++ b/Makefile @@ -14,8 +14,8 @@ POCKET_ADDR_PREFIX = pokt install_ci_deps: ## Installs `mockgen` go install "github.com/golang/mock/mockgen@v1.6.0" && mockgen --version go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint --version - go install github.com/daixiang0/gci@latest - go install mvdan.cc/gofumpt@latest + go install github.com/daixiang0/gci@latest && gci --version + go install mvdan.cc/gofumpt@latest && gofumpt --version ######################## ### Makefile Helpers ### diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 83bbefe5f..af8b41430 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -79107,8 +79107,6 @@ definitions: description: params holds all the parameters of this module. type: object description: QueryParamsResponse is response type for the Query/Params RPC method. - poktroll.service.MsgAddServiceResponse: - type: object poktroll.tokenomics.Params: type: object properties: diff --git a/go.mod b/go.mod index 9be97f1d6..56ed2d4fc 100644 --- a/go.mod +++ b/go.mod @@ -24,6 +24,7 @@ require ( github.com/athanorlabs/go-dleq v0.1.0 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 + github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/v7 v7.1.0 @@ -47,6 +48,7 @@ require ( golang.org/x/crypto v0.15.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 golang.org/x/sync v0.5.0 + google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb google.golang.org/grpc v1.59.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -90,7 +92,6 @@ require ( github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.0 // indirect @@ -285,7 +286,6 @@ require ( google.golang.org/api v0.143.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect From 5f5615b0bbbf89069e1c38be9000e2a743b32bdb Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 22:07:17 +0000 Subject: [PATCH 31/61] feat: merge linting workflow back into tests workflow --- .github/workflows/linter.yml | 84 --------------------------------- .github/workflows/run-tests.yml | 38 +++++++++++++++ 2 files changed, 38 insertions(+), 84 deletions(-) delete mode 100644 .github/workflows/linter.yml diff --git a/.github/workflows/linter.yml b/.github/workflows/linter.yml deleted file mode 100644 index d90461122..000000000 --- a/.github/workflows/linter.yml +++ /dev/null @@ -1,84 +0,0 @@ -# The reason the linting step has been moved to its own file is due to this -# aside in the golangci-lint action repo underneath the first code block: -# Ref: https://github.com/golangci/golangci-lint-action#how-to-use -# tl;dr: "We recommend running this action in a job separate from other jobs -# (go test, etc) because different jobs run in parallel." - -Name: Linter - -on: - push: - branches: ["main"] - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} - cancel-in-progress: true - -# Ref: https://github.com/golangci/golangci-lint-action#comments-and-annotations -permissions: - contents: read - pull-requests: read - checks: write - -jobs: - lint: - runs-on: ubuntu-latest - steps: - # Firstly setup the repo to a point where golangci-lint is able to lint - # properly without getting typeerror's from revive everywhere. - - name: install ignite - # TODO_TECHDEBT: upgrade to the latest Ignite (the latest at the moment of creating a note is 0.28). Need to downgrade to fix CI pipelines. Might be done in scope of #240. - run: | - # curl https://get.ignite.com/cli! | bash - wget https://github.com/ignite/cli/releases/download/v0.27.2/ignite_0.27.2_linux_amd64.tar.gz - tar -xzf ignite_0.27.2_linux_amd64.tar.gz - sudo mv ignite /usr/local/bin/ignite - ignite version - - - uses: actions/checkout@v3 - with: - fetch-depth: "0" # Per https://github.com/ignite/cli/issues/1674#issuecomment-1144619147 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.20.10" - cache: false # Per https://github.com/golangci/golangci-lint-action#how-to-use - - - name: Install CI dependencies - run: make install_ci_deps - - - name: Generate protobufs - run: make proto_regen - - # Fetch a list of all modified files in this PR. - - name: Get Modified Files - run: git diff --name-only ${{ github.event.before }} ${{ github.sha }} > modified_files.txt - - # Filter the list of files modified in this PR to exclude those that have - # ignite scaffold comments in their import block, this is because gci - # (golangci-lint's import formatter) doesn't support this kind of filtering - # and removes all comments from import blocks. - - name: Filter For Lintable Files - run: go run ./tools/scripts/scaffold_filter/main.go $(cat modified_files.txt) > files_to_lint.txt - - # Run golangci-lint on the filtered files from this PR - allowing gci to - # catch any improperly formatted import blocks in this PR. - - name: Run golangci-lint (filtered for scaffold comments) - uses: golangci/golangci-lint-action@v3 - with: - version: latest - args: --timeout=15m --config=.golangci.yml $(cat files_to_lint.txt) - only-new-issues: true - - # Do a second lint pass without import checking (after filtered lint) to - # catcy any linter errors in files that were excluded in the first pass. - # This step disables gci checks, to check for all other linter errors, - # on every file in the PR, without filtering. - - name: Run golangci-lint (without import checking) - uses: golangci/golangci-lint-action@v3 - with: - version: latest - args: --timeout=15m --config=.golangci.yml --disable gci $(cat modified_files.txt) - only-new-issues: true diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 84fe8ca24..bb7a4a308 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,6 +13,11 @@ env: GKE_CLUSTER: protocol-us-central1 GKE_ZONE: us-central1 +permissions: + contents: read + pull-requests: read + checks: write + jobs: go-test: runs-on: ubuntu-latest @@ -50,5 +55,38 @@ jobs: - name: Format the repo run: make gofumpt + # Fetch a list of all modified files in this PR. + - name: Get Modified Files + run: git diff --name-only ${{ github.event.before }} ${{ github.sha }} > modified_files.txt + + # Filter the list of files modified in this PR to exclude those that have + # ignite scaffold comments in their import block, this is because gci + # (golangci-lint's import formatter) doesn't support this kind of filtering + # and removes all comments from import blocks. + - name: Filter For Lintable Files + run: go run ./tools/scripts/scaffold_filter/main.go $(cat modified_files.txt) > files_to_lint.txt + + # Run golangci-lint on the filtered files from this PR - allowing gci to + # catch any improperly formatted import blocks in this PR. + - name: Run golangci-lint (filtered for scaffold comments) + uses: golangci/golangci-lint-action@v3 + with: + version: latest + args: --timeout=15m --config=.golangci.yml $(cat files_to_lint.txt) + only-new-issues: true + skip-cache: true + + # Do a second lint pass without import checking (after filtered lint) to + # catcy any linter errors in files that were excluded in the first pass. + # This step disables gci checks, to check for all other linter errors, + # on every file in the PR, without filtering. + - name: Run golangci-lint (without import checking) + uses: golangci/golangci-lint-action@v3 + with: + version: latest + args: --timeout=15m --config=.golangci.yml --disable gci $(cat modified_files.txt) + only-new-issues: true + skip-cache: true + - name: Test run: make go_test From eed0aed24c15c2de9a8a14ea285feb43e76fe8ee Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 23:04:12 +0000 Subject: [PATCH 32/61] feat: update workflow to not double lint files --- .github/workflows/run-tests.yml | 8 +++++++- go.mod | 4 ++-- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index bb7a4a308..ee4d09c1f 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -76,6 +76,12 @@ jobs: only-new-issues: true skip-cache: true + # Generate a list of files that were excluded from linting in the last + # golangci-lint step. + - name: Generate List of Excluded Files + run: | + comm -23 <(sort modified_files.txt) <(sort files_to_lint.txt) > excluded_files.txt + # Do a second lint pass without import checking (after filtered lint) to # catcy any linter errors in files that were excluded in the first pass. # This step disables gci checks, to check for all other linter errors, @@ -84,7 +90,7 @@ jobs: uses: golangci/golangci-lint-action@v3 with: version: latest - args: --timeout=15m --config=.golangci.yml --disable gci $(cat modified_files.txt) + args: --timeout=15m --config=.golangci.yml --disable gci $(cat excluded_files.txt) only-new-issues: true skip-cache: true diff --git a/go.mod b/go.mod index 56ed2d4fc..9be97f1d6 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,6 @@ require ( github.com/athanorlabs/go-dleq v0.1.0 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/v7 v7.1.0 @@ -48,7 +47,6 @@ require ( golang.org/x/crypto v0.15.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 golang.org/x/sync v0.5.0 - google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb google.golang.org/grpc v1.59.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -92,6 +90,7 @@ require ( github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.0 // indirect @@ -286,6 +285,7 @@ require ( google.golang.org/api v0.143.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect From 3c74ca0d05940522933e53a7951a1d6083aa167b Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 23:08:20 +0000 Subject: [PATCH 33/61] chore: Name -> name in workflow --- .github/workflows/run-tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index ee4d09c1f..fd09ba0de 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -1,4 +1,4 @@ -Name: Run tests +name: Run tests on: push: From 520e07b9fc1161230ac2c77ef4b558ec068cfa6e Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 23:17:02 +0000 Subject: [PATCH 34/61] chore: address comments --- Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 3760578e8..9902de2f3 100644 --- a/Makefile +++ b/Makefile @@ -86,7 +86,7 @@ check_gci: # Internal helper target - check if gofumpt is installed check_gofumpt: { \ - if ( ! ( command -v gci >/dev/null )); then \ + if ( ! ( command -v gofumpt >/dev/null )); then \ echo "Seems like you don't have gofumpt installed. Make sure you install it via 'go install mvdan.cc/gofumpt@latest' before continuing"; \ exit 1; \ fi; \ @@ -173,11 +173,11 @@ localnet_regenesis: ## Regenerate the localnet genesis file go_lint: ## Run all go linters golangci-lint run --timeout=15m --build-tags=e2e,test,integration -.PHONY: gci +.PHONY: go_gci gci: check_gci ## Run gci (import ordering) on all applicable files, this writes changes in place go run ./tools/scripts/gci -.PHONY: gofumpt +.PHONY: go_gofumpt gofumpt: check_gofumpt ## Run gofumpt (stricter gofmt) on all applicable files, this writes changes in place go run ./tools/scripts/gofumpt From 1fb18205e09e938af6fc7d0c8fde7e2127cc0cef Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 23:17:10 +0000 Subject: [PATCH 35/61] chore: add nolint reason on same line --- e2e/tests/session_steps_test.go | 3 +-- pkg/relayer/session/session.go | 3 +-- testutil/testclient/testdelegation/client.go | 4 +--- x/application/client/cli/tx_delegate_to_gateway.go | 3 +-- x/application/client/cli/tx_stake_application.go | 3 +-- x/application/client/cli/tx_undelegate_from_gateway.go | 3 +-- x/application/client/cli/tx_unstake_application.go | 3 +-- x/gateway/client/cli/tx_stake_gateway.go | 3 +-- x/gateway/client/cli/tx_unstake_gateway.go | 3 +-- x/session/client/cli/query_get_session.go | 3 +-- x/supplier/client/cli/query_claim.go | 3 +-- x/supplier/client/cli/tx_stake_supplier.go | 3 +-- x/supplier/client/cli/tx_unstake_supplier.go | 3 +-- 13 files changed, 13 insertions(+), 27 deletions(-) diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index b80729b56..c489728ba 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -24,8 +24,7 @@ import ( const ( createClaimTimeoutDuration = 10 * time.Second eitherEventsReplayBufferSize = 100 - // Not liniting as this is a long query string. - //nolint:lll + //nolint:lll // Not liniting as this is a long query string. msgClaimSenderQueryFmt = "tm.event='Tx' AND message.sender='%s' AND message.action='/pocket.supplier.MsgCreateClaim'" testServiceId = "anvil" eitherEventsBzReplayObsKey = "eitherEventsBzReplayObsKey" diff --git a/pkg/relayer/session/session.go b/pkg/relayer/session/session.go index 285206a69..7ad0776bd 100644 --- a/pkg/relayer/session/session.go +++ b/pkg/relayer/session/session.go @@ -178,8 +178,7 @@ func (rs *relayerSessionsManager) mapBlockToSessionsToClaim( // step. This does not address the case where the block client misses // the target block which should be handled by the retry mechanism. See // the discussion in the following GitHub thread for next steps: - // Not linting as breaking the link wouldn't be appropriate - // nolint:lll + // nolint:lll // Not linting as breaking the link wouldn't be appropriate // https://github.com/pokt-network/poktroll/pull/177/files?show-viewed-files=true&file-filters%5B%5D=#r1391957041 if endBlockHeight == block.Height() { // Iterate over the sessionsTrees that end at this block height (or diff --git a/testutil/testclient/testdelegation/client.go b/testutil/testclient/testdelegation/client.go index 19eb96b7f..56dac7fd2 100644 --- a/testutil/testclient/testdelegation/client.go +++ b/testutil/testclient/testdelegation/client.go @@ -148,9 +148,7 @@ func NewRedelegationEventBytes( gatewayAddress string, ) []byte { t.Helper() - // Not linting as this is a "fake" JSON string any extra whitespace may - // lead to unexpected behavior during deserialization. - //nolint:lll + //nolint:lll // Not linting as this is a "fake" JSON string needing to be 1 line jsonTemplate := `{"tx":"SGVsbG8sIHdvcmxkIQ==","result":{"events":[{"type":"message","attributes":[{"key":"action","value":"/pocket.application.MsgDelegateToGateway"},{"key":"sender","value":"pokt1exampleaddress"},{"key":"module","value":"application"}]},{"type":"pocket.application.EventRedelegation","attributes":[{"key":"app_address","value":"\"%s\""},{"key":"gateway_address","value":"\"%s\""}]}]}}` json := fmt.Sprintf(jsonTemplate, appAddress, gatewayAddress) return []byte(json) diff --git a/x/application/client/cli/tx_delegate_to_gateway.go b/x/application/client/cli/tx_delegate_to_gateway.go index 761b28cee..f8a31c4af 100644 --- a/x/application/client/cli/tx_delegate_to_gateway.go +++ b/x/application/client/cli/tx_delegate_to_gateway.go @@ -17,8 +17,7 @@ func CmdDelegateToGateway() *cobra.Command { cmd := &cobra.Command{ Use: "delegate-to-gateway ", Short: "Delegate an application to a gateway", - // Not liniting as this is the long description of the command. - //nolint:lll + //nolint:lll // Not liniting as this is the long description of the command. Long: `Delegate an application to the gateway with the provided address. This is a broadcast operation that delegates authority to the gateway specified to sign relays requests for the application, allowing the gateway act on the behalf of the application during a session. diff --git a/x/application/client/cli/tx_stake_application.go b/x/application/client/cli/tx_stake_application.go index fad770a61..e7dbfcc47 100644 --- a/x/application/client/cli/tx_stake_application.go +++ b/x/application/client/cli/tx_stake_application.go @@ -23,8 +23,7 @@ func CmdStakeApplication() *cobra.Command { cmd := &cobra.Command{ Use: "stake-application --config ", Short: "Stake an application", - // Not liniting as this is the long description of the command. - //nolint:lll + //nolint:lll // Not liniting as this is the long description of the command. Long: `Stake an application with the provided parameters. This is a broadcast operation that will stake the tokens and serviceIds and associate them with the application specified by the 'from' address. diff --git a/x/application/client/cli/tx_undelegate_from_gateway.go b/x/application/client/cli/tx_undelegate_from_gateway.go index 835032d0d..07a887974 100644 --- a/x/application/client/cli/tx_undelegate_from_gateway.go +++ b/x/application/client/cli/tx_undelegate_from_gateway.go @@ -17,8 +17,7 @@ func CmdUndelegateFromGateway() *cobra.Command { cmd := &cobra.Command{ Use: "undelegate-from-gateway [gateway address]", Short: "Undelegate an application from a gateway", - // Not liniting as this is the long description of the command. - //nolint:lll + //nolint:lll // Not liniting as this is the long description of the command. Long: `Undelegate an application from the gateway with the provided address. This is a broadcast operation that removes the authority from the gateway specified to sign relays requests for the application, disallowing the gateway act on the behalf of the application during a session. diff --git a/x/application/client/cli/tx_unstake_application.go b/x/application/client/cli/tx_unstake_application.go index ceb3ca132..cfdbbf9ca 100644 --- a/x/application/client/cli/tx_unstake_application.go +++ b/x/application/client/cli/tx_unstake_application.go @@ -18,8 +18,7 @@ func CmdUnstakeApplication() *cobra.Command { cmd := &cobra.Command{ Use: "unstake-application", Short: "Unstake an application", - // Not liniting as this is the long description of the command. - //nolint:lll + //nolint:lll // Not liniting as this is the long description of the command. Long: `Unstake an application. This is a broadcast operation that will unstake the application specified by the 'from' address. diff --git a/x/gateway/client/cli/tx_stake_gateway.go b/x/gateway/client/cli/tx_stake_gateway.go index 15c12fa5b..7ff511b40 100644 --- a/x/gateway/client/cli/tx_stake_gateway.go +++ b/x/gateway/client/cli/tx_stake_gateway.go @@ -22,8 +22,7 @@ func CmdStakeGateway() *cobra.Command { cmd := &cobra.Command{ Use: "stake-gateway --config ", Short: "Stake a gateway", - // Not liniting as this is the long description of the command. - //nolint:lll + //nolint:lll // Not liniting as this is the long description of the command. Long: `Stake a gateway with the provided parameters. This is a broadcast operation that will stake the tokens and associate them with the gateway specified by the 'from' address. Example: diff --git a/x/gateway/client/cli/tx_unstake_gateway.go b/x/gateway/client/cli/tx_unstake_gateway.go index fa09b9546..5982b5f76 100644 --- a/x/gateway/client/cli/tx_unstake_gateway.go +++ b/x/gateway/client/cli/tx_unstake_gateway.go @@ -18,8 +18,7 @@ func CmdUnstakeGateway() *cobra.Command { cmd := &cobra.Command{ Use: "unstake-gateway ", Short: "Unstake a gateway", - // Not liniting as this is the long description of the command. - //nolint:lll + //nolint:lll // Not liniting as this is the long description of the command. Long: `Unstake a gateway. This is a broadcast operation that will unstake the gateway specified by the 'from' address. Example: diff --git a/x/session/client/cli/query_get_session.go b/x/session/client/cli/query_get_session.go index ba5fb81b6..a7ebb3213 100644 --- a/x/session/client/cli/query_get_session.go +++ b/x/session/client/cli/query_get_session.go @@ -18,8 +18,7 @@ func CmdGetSession() *cobra.Command { cmd := &cobra.Command{ Use: "get-session [block_height]", Short: "Query get-session", - // Not liniting as this is the long description of the command. - //nolint:lll + //nolint:lll // Not liniting as this is the long description of the command. Long: `Query the session data for a specific (app, service, height) tuple. [block_height] is optional. If unspecified, or set to 0, it defaults to the latest height of the node being queried. diff --git a/x/supplier/client/cli/query_claim.go b/x/supplier/client/cli/query_claim.go index 418b091b5..15d73f330 100644 --- a/x/supplier/client/cli/query_claim.go +++ b/x/supplier/client/cli/query_claim.go @@ -84,8 +84,7 @@ func CmdShowClaim() *cobra.Command { cmd := &cobra.Command{ Use: "show-claim ", Short: "shows a specific claim", - // Not liniting as this is the long description of the command. - //nolint:lll + //nolint:lll // Not liniting as this is the long description of the command. Long: `List a specific claim that the node being queried has access to (if it still exists). A unique claim can be defined via a ` + "`session_id`" + ` that the given ` + "`supplier`" + ` participated in. diff --git a/x/supplier/client/cli/tx_stake_supplier.go b/x/supplier/client/cli/tx_stake_supplier.go index a7d58c55f..ad0e67643 100644 --- a/x/supplier/client/cli/tx_stake_supplier.go +++ b/x/supplier/client/cli/tx_stake_supplier.go @@ -24,8 +24,7 @@ func CmdStakeSupplier() *cobra.Command { cmd := &cobra.Command{ Use: "stake-supplier --config ", Short: "Stake a supplier", - // Not liniting as this is the long description of the command. - //nolint:lll + //nolint:lll // Not liniting as this is the long description of the command. Long: `Stake an supplier with the provided parameters. This is a broadcast operation that will stake the tokens and associate them with the supplier specified by the 'from' address. diff --git a/x/supplier/client/cli/tx_unstake_supplier.go b/x/supplier/client/cli/tx_unstake_supplier.go index 4be28f19f..2fdec865d 100644 --- a/x/supplier/client/cli/tx_unstake_supplier.go +++ b/x/supplier/client/cli/tx_unstake_supplier.go @@ -15,8 +15,7 @@ func CmdUnstakeSupplier() *cobra.Command { cmd := &cobra.Command{ Use: "unstake-supplier", Short: "Unstake a supplier", - // Not liniting as this is the long description of the command. - //nolint:lll + //nolint:lll // Not liniting as this is the long description of the command. Long: `Unstake an supplier with the provided parameters. This is a broadcast operation that will unstake the supplier specified by the 'from' address. Example: From 6a23c057db6a12688d841c02898c80918fa46ea6 Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 23:21:28 +0000 Subject: [PATCH 36/61] chore: address comments --- .github/workflows/run-tests.yml | 4 ++-- .golangci.yml | 6 ------ pkg/client/supplier/client_integration_test.go | 4 ++-- 3 files changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index fd09ba0de..195ddb7c8 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -60,7 +60,7 @@ jobs: run: git diff --name-only ${{ github.event.before }} ${{ github.sha }} > modified_files.txt # Filter the list of files modified in this PR to exclude those that have - # ignite scaffold comments in their import block, this is because gci + # ignite scaffold comments in their import block. This is because gci # (golangci-lint's import formatter) doesn't support this kind of filtering # and removes all comments from import blocks. - name: Filter For Lintable Files @@ -83,7 +83,7 @@ jobs: comm -23 <(sort modified_files.txt) <(sort files_to_lint.txt) > excluded_files.txt # Do a second lint pass without import checking (after filtered lint) to - # catcy any linter errors in files that were excluded in the first pass. + # catch any linter errors in files that were excluded in the first pass. # This step disables gci checks, to check for all other linter errors, # on every file in the PR, without filtering. - name: Run golangci-lint (without import checking) diff --git a/.golangci.yml b/.golangci.yml index 8324dba19..a930720c3 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -5,15 +5,9 @@ run: - test - integration -# TODO_TECHDEBT: Enable each linter listed, 1 by 1, fixing issues as they appear. -# Don't forget to delete the `disable-all: true` line as well. linters: disable-all: true enable: - # - govet - # - revive - # - errcheck - # - unused - gofumpt - lll - gci diff --git a/pkg/client/supplier/client_integration_test.go b/pkg/client/supplier/client_integration_test.go index 0db4e81b5..58e7b0608 100644 --- a/pkg/client/supplier/client_integration_test.go +++ b/pkg/client/supplier/client_integration_test.go @@ -13,8 +13,8 @@ import ( ) func TestNewSupplierClient_Localnet(t *testing.T) { - t.Skip("TODO_TECHDEBT: this test depends on some setup which is currently" + - " not implemented in this test: staked application and servicer with matching services") + t.Skip(`TODO_TECHDEBT: this test depends on some setup which is currently +not implemented in this test: staked application and servicer with matching services`) var ( signingKeyName = "app1" From f4f40a2efaa03b06017e0cbf79451d93c9aacea0 Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 23:30:13 +0000 Subject: [PATCH 37/61] feat: only filter go files --- tools/scripts/scaffold_filter/filters/filters.go | 6 ++++++ tools/scripts/scaffold_filter/main.go | 8 ++++++++ 2 files changed, 14 insertions(+) diff --git a/tools/scripts/scaffold_filter/filters/filters.go b/tools/scripts/scaffold_filter/filters/filters.go index 136d0b2ab..49df1555d 100644 --- a/tools/scripts/scaffold_filter/filters/filters.go +++ b/tools/scripts/scaffold_filter/filters/filters.go @@ -4,6 +4,7 @@ import ( "bufio" "bytes" "os" + "path/filepath" "strings" ) @@ -18,6 +19,11 @@ var ( // filter's criteria. type FilterFn func(path string) (bool, error) +// PathMatchesGoExtension matches go source files. +func PathMatchesGoExtension(path string) (bool, error) { + return filepath.Ext(path) == ".go", nil +} + // ImportBlockContainsScaffoldComment matches import blocks containing the // `// this line is used by starport scaffolding` comment. func ImportBlockContainsScaffoldComment(path string) (bool, error) { diff --git a/tools/scripts/scaffold_filter/main.go b/tools/scripts/scaffold_filter/main.go index 1cdc72430..3362f8d96 100644 --- a/tools/scripts/scaffold_filter/main.go +++ b/tools/scripts/scaffold_filter/main.go @@ -24,6 +24,14 @@ func main() { // purely because gci (the golanci-lint linter for imports) doesn't // support this type of filtering natively. for _, path := range os.Args[1:] { + goFile, err := filters.PathMatchesGoExtension(path) + if err != nil { + fmt.Printf("Error processing file %s: %s\n", path, err) + continue + } + if !goFile { + continue + } for _, excludeFilter := range defaultExcludeFilters { shouldExclude, err := excludeFilter(path) if err != nil { From 321c64e4fadc0d9b5091568450304678d5d36a6a Mon Sep 17 00:00:00 2001 From: h5law Date: Tue, 16 Jan 2024 23:41:56 +0000 Subject: [PATCH 38/61] chore: remove the only new issues --- .github/workflows/run-tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 195ddb7c8..b195f92cc 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -73,7 +73,6 @@ jobs: with: version: latest args: --timeout=15m --config=.golangci.yml $(cat files_to_lint.txt) - only-new-issues: true skip-cache: true # Generate a list of files that were excluded from linting in the last @@ -91,7 +90,6 @@ jobs: with: version: latest args: --timeout=15m --config=.golangci.yml --disable gci $(cat excluded_files.txt) - only-new-issues: true skip-cache: true - name: Test From 879b3881faea4c6dacddc1a13f0082cbcd8cd031 Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 00:05:02 +0000 Subject: [PATCH 39/61] feat: add custom golangci-lint script --- .github/workflows/run-tests.yml | 42 +---- Makefile | 2 +- .../filters/filters.go | 17 ++ tools/scripts/golint/main.go | 151 ++++++++++++++++++ tools/scripts/scaffold_filter/main.go | 56 ------- 5 files changed, 173 insertions(+), 95 deletions(-) rename tools/scripts/{scaffold_filter => golint}/filters/filters.go (83%) create mode 100644 tools/scripts/golint/main.go delete mode 100644 tools/scripts/scaffold_filter/main.go diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b195f92cc..75605049c 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -50,47 +50,13 @@ jobs: run: make go_mockgen - name: Fix imports - run: make gci + run: make go_gci - name: Format the repo - run: make gofumpt + run: make go_gofumpt - # Fetch a list of all modified files in this PR. - - name: Get Modified Files - run: git diff --name-only ${{ github.event.before }} ${{ github.sha }} > modified_files.txt - - # Filter the list of files modified in this PR to exclude those that have - # ignite scaffold comments in their import block. This is because gci - # (golangci-lint's import formatter) doesn't support this kind of filtering - # and removes all comments from import blocks. - - name: Filter For Lintable Files - run: go run ./tools/scripts/scaffold_filter/main.go $(cat modified_files.txt) > files_to_lint.txt - - # Run golangci-lint on the filtered files from this PR - allowing gci to - # catch any improperly formatted import blocks in this PR. - - name: Run golangci-lint (filtered for scaffold comments) - uses: golangci/golangci-lint-action@v3 - with: - version: latest - args: --timeout=15m --config=.golangci.yml $(cat files_to_lint.txt) - skip-cache: true - - # Generate a list of files that were excluded from linting in the last - # golangci-lint step. - - name: Generate List of Excluded Files - run: | - comm -23 <(sort modified_files.txt) <(sort files_to_lint.txt) > excluded_files.txt - - # Do a second lint pass without import checking (after filtered lint) to - # catch any linter errors in files that were excluded in the first pass. - # This step disables gci checks, to check for all other linter errors, - # on every file in the PR, without filtering. - - name: Run golangci-lint (without import checking) - uses: golangci/golangci-lint-action@v3 - with: - version: latest - args: --timeout=15m --config=.golangci.yml --disable gci $(cat excluded_files.txt) - skip-cache: true + - name: golangci-lint + run: make go_lint - name: Test run: make go_test diff --git a/Makefile b/Makefile index 9902de2f3..55e371d2e 100644 --- a/Makefile +++ b/Makefile @@ -171,7 +171,7 @@ localnet_regenesis: ## Regenerate the localnet genesis file .PHONY: go_lint go_lint: ## Run all go linters - golangci-lint run --timeout=15m --build-tags=e2e,test,integration + go run ./tools/scripts/golint .PHONY: go_gci gci: check_gci ## Run gci (import ordering) on all applicable files, this writes changes in place diff --git a/tools/scripts/scaffold_filter/filters/filters.go b/tools/scripts/golint/filters/filters.go similarity index 83% rename from tools/scripts/scaffold_filter/filters/filters.go rename to tools/scripts/golint/filters/filters.go index 49df1555d..c5067f763 100644 --- a/tools/scripts/scaffold_filter/filters/filters.go +++ b/tools/scripts/golint/filters/filters.go @@ -1,3 +1,5 @@ +// The filters package contains functions that can be used to filter file paths. + package filters import ( @@ -24,6 +26,21 @@ func PathMatchesGoExtension(path string) (bool, error) { return filepath.Ext(path) == ".go", nil } +// PathMatchesProtobufGo matches generated protobuf go source files. +func PathMatchesProtobufGo(path string) (bool, error) { + return strings.HasSuffix(path, ".pb.go"), nil +} + +// PathMatchesProtobufGatewayGo matches generated protobuf gateway go source files. +func PathMatchesProtobufGatewayGo(path string) (bool, error) { + return strings.HasSuffix(path, ".pb.gw.go"), nil +} + +// PathMatchesMockGo matches generated mock go source files. +func PathMatchesMockGo(path string) (bool, error) { + return strings.HasSuffix(path, "_mock.go"), nil +} + // ImportBlockContainsScaffoldComment matches import blocks containing the // `// this line is used by starport scaffolding` comment. func ImportBlockContainsScaffoldComment(path string) (bool, error) { diff --git a/tools/scripts/golint/main.go b/tools/scripts/golint/main.go new file mode 100644 index 000000000..0696c955b --- /dev/null +++ b/tools/scripts/golint/main.go @@ -0,0 +1,151 @@ +package main + +import ( + "fmt" + "os" + "os/exec" + "path/filepath" + "strings" + + "github.com/pokt-network/poktroll/tools/scripts/gci/filters" +) + +var ( + defaultArgs = []string{ + "run", + "--timeout=15m", + "--build-tags=e2e,test,integration", + } + defaultIncludeFilters = []filters.FilterFn{ + filters.PathMatchesGoExtension, + } + defaultExcludeFilters = []filters.FilterFn{ + filters.PathMatchesProtobufGo, + filters.PathMatchesProtobufGatewayGo, + filters.PathMatchesMockGo, + filters.ContentMatchesEmptyImportScaffold, + } +) + +func main() { + root := "." + var ( + filesToProcessWithGCI []string + filesToProcessWithoutGCI []string + ) + + // Walk the file system and accumulate matching files + err := filepath.Walk(root, walkRepoRootFn( + root, + defaultIncludeFilters, + defaultExcludeFilters, + &filesToProcessWithGCI, + )) + if err != nil { + fmt.Printf("Error processing files: %s\n", err) + return + } + + // Run golangci-lint on all files that don't have a scaffold comment in + // their import block - so it can be run normally with gci + if len(filesToProcessWithGCI) > 0 { + args := append(defaultArgs, "--disable=gci") + cmd := exec.Command("golangci-lint", args...) + out, err := cmd.CombinedOutput() + if err != nil { + fmt.Printf("Output: %s\nFailed running golangci-lint with gci: %v\n", out, err) + } + } + + // Run golangci-lint on all files that don't have a scaffold comment in + // their import block - so it can be run normally with gci + if len(filesToProcessWithoutGCI) > 0 { + cmd := exec.Command("golangci-lint", append(defaultArgs..., "--disable=gci")...) + out, err := cmd.CombinedOutput() + if err != nil { + fmt.Printf("Output: %s\nFailed running golangci-lint without gci: %v\n", out, err) + } + } +} + +func walkRepoRootFn( + rootPath string, + includeFilters []filters.FilterFn, + excludeFilters []filters.FilterFn, + filesToProcessWithGCI *[]string, + filesToProcessWithoutGCI *[]string, +) filepath.WalkFunc { + return func(path string, info os.FileInfo, err error) error { + if err != nil { + return err + } + + // Don't process the root directory but don't skip it either; that would + // exclude everything. + if info.Name() == rootPath { + return nil + } + + // No need to process directories + if info.IsDir() { + // Skip directories that start with a period + if strings.HasPrefix(info.Name(), ".") { + return filepath.SkipDir + } + return nil + } + + // Don't process paths which don't match any include filter. + var shouldIncludePath bool + for _, includeFilter := range includeFilters { + pathMatches, err := includeFilter(path) + if err != nil { + panic(err) + } + + if pathMatches { + shouldIncludePath = true + break + } + } + if !shouldIncludePath { + return nil + } + + // Check if the file contains a scaffold comment in the import block, + // skip it and tell golangci-lin to disable the gci linter + containsImportScaffoldComment, err := filters.ImportBlockContainsScaffoldComment(path) + if err != nil { + panic(err) + } + if containsImportScaffoldComment { + enableGCI.CompareAndSwap(false, true) + return nil + } + + // Don't process paths which match any exclude filter. + var shouldExcludePath bool + for _, excludeFilter := range excludeFilters { + pathMatches, err := excludeFilter(path) + if err != nil { + panic(err) + } + + if pathMatches { + shouldExcludePath = true + break + } + } + if shouldExcludePath { + return nil + } + + if containsImportScaffoldComment { + *filesToProcessWithoutGCI = append(*filesToProcessWithoutGCI, path) + } + + *filesToProcessWithGCI = append(*filesToProcessWithGCI, path) + + return nil + } +} diff --git a/tools/scripts/scaffold_filter/main.go b/tools/scripts/scaffold_filter/main.go deleted file mode 100644 index 3362f8d96..000000000 --- a/tools/scripts/scaffold_filter/main.go +++ /dev/null @@ -1,56 +0,0 @@ -package main - -import ( - "fmt" - "os" - - "github.com/pokt-network/poktroll/tools/scripts/gci/filters" -) - -var defaultExcludeFilters = []filters.FilterFn{ - filters.ContentMatchesEmptyImportScaffold, - filters.ImportBlockContainsScaffoldComment, -} - -func main() { - if len(os.Args) < 2 { - fmt.Printf("Usage: %s ...\n", os.Args[0]) - os.Exit(1) - } - - var filesToProcess []string - // For each file passed as an argument check whether to exclude it - // according to the filters, from a golangci-lint check. This is - // purely because gci (the golanci-lint linter for imports) doesn't - // support this type of filtering natively. - for _, path := range os.Args[1:] { - goFile, err := filters.PathMatchesGoExtension(path) - if err != nil { - fmt.Printf("Error processing file %s: %s\n", path, err) - continue - } - if !goFile { - continue - } - for _, excludeFilter := range defaultExcludeFilters { - shouldExclude, err := excludeFilter(path) - if err != nil { - fmt.Printf("Error processing file %s: %s\n", path, err) - continue - } - if !shouldExclude { - filesToProcess = append(filesToProcess, path) - } - } - } - - // Print all files to be processed by golangci-lint. - // This is so gci doesn't remove the scaffold comments in - // the import block for files scaffolded by ignite. - for _, file := range filesToProcess { - // We print the file names as this is a helper used in the - // testing workflow and the output of this file is appended - // to a file from which golangci-lint will be run on, in CI. - fmt.Println(file) - } -} From a4838e6ac5ad1cdd6f68dc53a0f5e4c443674fc0 Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 01:17:29 +0000 Subject: [PATCH 40/61] feat: add new targets and update their names re: linting --- Makefile | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 55e371d2e..d1d1a27dc 100644 --- a/Makefile +++ b/Makefile @@ -72,6 +72,16 @@ check_godoc: fi; \ } +.PHONY: check_golanci_lint +# Internal helper target - check if golangci-lint is installed +check_golanci_lint: + { \ + if ( ! ( command -v gci >/dev/null )); then \ + echo "Seems like you don't have golanci-lint installed. Make sure you install it via 'go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest' before continuing"; \ + exit 1; \ + fi; \ + } + .PHONY: check_gci # Internal helper target - check if gci is installed check_gci: @@ -170,15 +180,15 @@ localnet_regenesis: ## Regenerate the localnet genesis file ############### .PHONY: go_lint -go_lint: ## Run all go linters +go_lint: check_golanci_lint ## Run all go linters go run ./tools/scripts/golint .PHONY: go_gci -gci: check_gci ## Run gci (import ordering) on all applicable files, this writes changes in place +go_gci: check_gci ## Run gci (import ordering) on all applicable files, this writes changes in place go run ./tools/scripts/gci .PHONY: go_gofumpt -gofumpt: check_gofumpt ## Run gofumpt (stricter gofmt) on all applicable files, this writes changes in place +go_gofumpt: check_gofumpt ## Run gofumpt (stricter gofmt) on all applicable files, this writes changes in place go run ./tools/scripts/gofumpt ############# From 577c3d752fb1338ccc896b3996caeef7ff61dba2 Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 01:18:34 +0000 Subject: [PATCH 41/61] feat: add golint tool to run golangci-lint selectively --- .golangci.yml | 7 +-- tools/scripts/golint/main.go | 85 ++++++++++++++++++++++++------------ 2 files changed, 58 insertions(+), 34 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index a930720c3..30bc6f054 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,10 +7,6 @@ run: linters: disable-all: true - enable: - - gofumpt - - lll - - gci linters-settings: govet: @@ -70,6 +66,7 @@ issues: - path: ^x/.+/codec.go$ linters: - lll + - gci - revive - path: _test\.go$ linters: @@ -91,6 +88,6 @@ issues: linters: - lll - gci - # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration new: true + # TODO_IMPROVE: see https://golangci-lint.run/usage/configuration/#issues-configuration #fix: true, diff --git a/tools/scripts/golint/main.go b/tools/scripts/golint/main.go index 0696c955b..4db0e83a4 100644 --- a/tools/scripts/golint/main.go +++ b/tools/scripts/golint/main.go @@ -7,14 +7,16 @@ import ( "path/filepath" "strings" + "golang.org/x/exp/slices" + "github.com/pokt-network/poktroll/tools/scripts/gci/filters" ) var ( defaultArgs = []string{ "run", - "--timeout=15m", - "--build-tags=e2e,test,integration", + "--config=.golangci.yml", + "--color=always", } defaultIncludeFilters = []filters.FilterFn{ filters.PathMatchesGoExtension, @@ -30,40 +32,70 @@ var ( func main() { root := "." var ( + packagesWithGCI map[string][]string + packagesWithoutGCI map[string][]string filesToProcessWithGCI []string filesToProcessWithoutGCI []string ) + // Create the maps + packagesWithGCI = make(map[string][]string) + packagesWithoutGCI = make(map[string][]string) + // Walk the file system and accumulate matching files err := filepath.Walk(root, walkRepoRootFn( root, defaultIncludeFilters, defaultExcludeFilters, &filesToProcessWithGCI, + &filesToProcessWithoutGCI, )) if err != nil { fmt.Printf("Error processing files: %s\n", err) return } - // Run golangci-lint on all files that don't have a scaffold comment in - // their import block - so it can be run normally with gci + // Organise each file found by package if len(filesToProcessWithGCI) > 0 { - args := append(defaultArgs, "--disable=gci") - cmd := exec.Command("golangci-lint", args...) - out, err := cmd.CombinedOutput() - if err != nil { - fmt.Printf("Output: %s\nFailed running golangci-lint with gci: %v\n", out, err) + for _, path := range filesToProcessWithGCI { + pkgPath := filepath.Dir(path) + packagesWithGCI[pkgPath] = append(packagesWithGCI[pkgPath], path) } } - - // Run golangci-lint on all files that don't have a scaffold comment in - // their import block - so it can be run normally with gci if len(filesToProcessWithoutGCI) > 0 { - cmd := exec.Command("golangci-lint", append(defaultArgs..., "--disable=gci")...) - out, err := cmd.CombinedOutput() - if err != nil { - fmt.Printf("Output: %s\nFailed running golangci-lint without gci: %v\n", out, err) + for _, path := range filesToProcessWithoutGCI { + pkgPath := filepath.Dir(path) + packagesWithoutGCI[pkgPath] = append(packagesWithoutGCI[pkgPath], path) + } + } + + if len(packagesWithGCI) > 0 { + fmt.Println("Linting files without scaffold comments in their import blocks...") + // Run golangci-lint on all files that don't have a scaffold comment in + // their import block - so it can be run normally with gci + for _, path := range packagesWithGCI { + args := append(defaultArgs, []string{"--enable=gci", "--enable=lll", "--enable=gofumpt"}...) + slices.Sort(path) + cmd := exec.Command("golangci-lint", append(args, path...)...) + out, err := cmd.CombinedOutput() + if err != nil { + fmt.Printf("Output: %s\nFailed running golangci-lint with gci: %v\n", out, err) + } + } + } + + if len(packagesWithoutGCI) > 0 { + fmt.Println("Linting files with scaffold comments in their import blocks...") + // Run golangci-lint on all files that do have a scaffold comment in + // their import block - so it can't be run with gci as it would remove it + for _, path := range packagesWithoutGCI { + args := append(defaultArgs, []string{"--enable=lll", "--enable=gofumpt"}...) + slices.Sort(path) + cmd := exec.Command("golangci-lint", append(args, path...)...) + out, err := cmd.CombinedOutput() + if err != nil { + fmt.Printf("Output: %s\nFailed running golangci-lint without gci: %v\n", out, err) + } } } } @@ -112,17 +144,6 @@ func walkRepoRootFn( return nil } - // Check if the file contains a scaffold comment in the import block, - // skip it and tell golangci-lin to disable the gci linter - containsImportScaffoldComment, err := filters.ImportBlockContainsScaffoldComment(path) - if err != nil { - panic(err) - } - if containsImportScaffoldComment { - enableGCI.CompareAndSwap(false, true) - return nil - } - // Don't process paths which match any exclude filter. var shouldExcludePath bool for _, excludeFilter := range excludeFilters { @@ -140,12 +161,18 @@ func walkRepoRootFn( return nil } + // Check if the file contains a scaffold comment in the import block, + // skip it and tell golangci-lin to disable the gci linter + containsImportScaffoldComment, err := filters.ImportBlockContainsScaffoldComment(path) + if err != nil { + panic(err) + } if containsImportScaffoldComment { *filesToProcessWithoutGCI = append(*filesToProcessWithoutGCI, path) + } else { + *filesToProcessWithGCI = append(*filesToProcessWithGCI, path) } - *filesToProcessWithGCI = append(*filesToProcessWithGCI, path) - return nil } } From 30214875f5ad0fe74109d643eb555c9745469036 Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 01:22:22 +0000 Subject: [PATCH 42/61] chore: remove un-needed sorting --- tools/scripts/golint/main.go | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/tools/scripts/golint/main.go b/tools/scripts/golint/main.go index 4db0e83a4..feefd7360 100644 --- a/tools/scripts/golint/main.go +++ b/tools/scripts/golint/main.go @@ -7,8 +7,6 @@ import ( "path/filepath" "strings" - "golang.org/x/exp/slices" - "github.com/pokt-network/poktroll/tools/scripts/gci/filters" ) @@ -29,6 +27,7 @@ var ( } ) +// TODO_OPTIMISATION: This could probably be optimised for speed. func main() { root := "." var ( @@ -75,7 +74,6 @@ func main() { // their import block - so it can be run normally with gci for _, path := range packagesWithGCI { args := append(defaultArgs, []string{"--enable=gci", "--enable=lll", "--enable=gofumpt"}...) - slices.Sort(path) cmd := exec.Command("golangci-lint", append(args, path...)...) out, err := cmd.CombinedOutput() if err != nil { @@ -90,7 +88,6 @@ func main() { // their import block - so it can't be run with gci as it would remove it for _, path := range packagesWithoutGCI { args := append(defaultArgs, []string{"--enable=lll", "--enable=gofumpt"}...) - slices.Sort(path) cmd := exec.Command("golangci-lint", append(args, path...)...) out, err := cmd.CombinedOutput() if err != nil { From c77c2177cfdadfd66d12b04ff64523dd08dffaff Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 01:34:52 +0000 Subject: [PATCH 43/61] chore: add default args to config and move linting to after tests --- .github/workflows/run-tests.yml | 6 +++--- .golangci.yml | 3 +++ tools/scripts/golint/main.go | 2 -- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 75605049c..b9ae9c62a 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -55,8 +55,8 @@ jobs: - name: Format the repo run: make go_gofumpt - - name: golangci-lint - run: make go_lint - - name: Test run: make go_test + + - name: golangci-lint + run: make go_lint diff --git a/.golangci.yml b/.golangci.yml index 30bc6f054..f7e35ab00 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -1,5 +1,8 @@ run: timeout: 15m + config: ./.golangci.yml + new: true + color: always build-tags: - e2e - test diff --git a/tools/scripts/golint/main.go b/tools/scripts/golint/main.go index feefd7360..affdcb0dd 100644 --- a/tools/scripts/golint/main.go +++ b/tools/scripts/golint/main.go @@ -13,8 +13,6 @@ import ( var ( defaultArgs = []string{ "run", - "--config=.golangci.yml", - "--color=always", } defaultIncludeFilters = []filters.FilterFn{ filters.PathMatchesGoExtension, From 098a1d2d2373711739f4bbe07fc8394506ccb400 Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 01:36:55 +0000 Subject: [PATCH 44/61] chore: remove un-used permissions --- .github/workflows/run-tests.yml | 5 ----- 1 file changed, 5 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index b9ae9c62a..24f042129 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -13,11 +13,6 @@ env: GKE_CLUSTER: protocol-us-central1 GKE_ZONE: us-central1 -permissions: - contents: read - pull-requests: read - checks: write - jobs: go-test: runs-on: ubuntu-latest From 041f0ebf1e090bda69f962dd22af67602cd46156 Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 01:39:42 +0000 Subject: [PATCH 45/61] feat: fail when linter errors are found --- tools/scripts/golint/main.go | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/scripts/golint/main.go b/tools/scripts/golint/main.go index affdcb0dd..d2e177a7c 100644 --- a/tools/scripts/golint/main.go +++ b/tools/scripts/golint/main.go @@ -66,6 +66,7 @@ func main() { } } + errorFound := false if len(packagesWithGCI) > 0 { fmt.Println("Linting files without scaffold comments in their import blocks...") // Run golangci-lint on all files that don't have a scaffold comment in @@ -76,6 +77,7 @@ func main() { out, err := cmd.CombinedOutput() if err != nil { fmt.Printf("Output: %s\nFailed running golangci-lint with gci: %v\n", out, err) + errorFound = true } } } @@ -90,9 +92,15 @@ func main() { out, err := cmd.CombinedOutput() if err != nil { fmt.Printf("Output: %s\nFailed running golangci-lint without gci: %v\n", out, err) + errorFound = true } } } + + // Fail if any errors were found + if errorFound { + os.Exit(1) + } } func walkRepoRootFn( From 040cec90fd7255277af336ee690fdf7e4f5ff53b Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 09:13:54 +0000 Subject: [PATCH 46/61] feat: exclude certain directories and print error on fail --- tools/scripts/golint/main.go | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/scripts/golint/main.go b/tools/scripts/golint/main.go index d2e177a7c..57e629831 100644 --- a/tools/scripts/golint/main.go +++ b/tools/scripts/golint/main.go @@ -67,6 +67,7 @@ func main() { } errorFound := false + totalOut := "" if len(packagesWithGCI) > 0 { fmt.Println("Linting files without scaffold comments in their import blocks...") // Run golangci-lint on all files that don't have a scaffold comment in @@ -79,6 +80,7 @@ func main() { fmt.Printf("Output: %s\nFailed running golangci-lint with gci: %v\n", out, err) errorFound = true } + totalOut += fmt.Sprintf("%s\n", out) } } @@ -94,11 +96,13 @@ func main() { fmt.Printf("Output: %s\nFailed running golangci-lint without gci: %v\n", out, err) errorFound = true } + totalOut += fmt.Sprintf("%s\n", out) } } // Fail if any errors were found if errorFound { + fmt.Println(totalOut) os.Exit(1) } } @@ -121,6 +125,20 @@ func walkRepoRootFn( return nil } + // Don't look in specific dirctories for files to lint + if strings.HasPrefix(path, "ts-client") { + return nil + } + if strings.HasPrefix(path, "docs") { + return nil + } + if strings.HasPrefix(path, "bin") { + return nil + } + if strings.HasPrefix(path, ".git") { + return nil + } + // No need to process directories if info.IsDir() { // Skip directories that start with a period From cb094983ab4eeebbabdcf0898d678d5b1c44b41f Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 21:44:48 +0000 Subject: [PATCH 47/61] chore: fix linter errors, add nolints where needed --- e2e/tests/init_test.go | 120 +++++++++++++++++++++----------- e2e/tests/node.go | 24 +++---- e2e/tests/session_steps_test.go | 20 +++--- 3 files changed, 103 insertions(+), 61 deletions(-) diff --git a/e2e/tests/init_test.go b/e2e/tests/init_test.go index 1ab6c22a1..575d8a7c1 100644 --- a/e2e/tests/init_test.go +++ b/e2e/tests/init_test.go @@ -5,7 +5,6 @@ package e2e import ( "flag" "fmt" - "io/ioutil" "log" "os" "regexp" @@ -39,7 +38,7 @@ var ( flagFeaturesPath string keyRingFlag = "--keyring-backend=test" // Keeping localhost by default because that is how we run the tests on our machines locally - appGateServerUrl = "http://localhost:42069" + appGateServerURL = "http://localhost:42069" ) func init() { @@ -55,7 +54,7 @@ func init() { // If "APPGATE_SERVER_URL" envar is present, use it for appGateServerUrl if url := os.Getenv("APPGATE_SERVER_URL"); url != "" { - appGateServerUrl = url + appGateServerURL = url } } @@ -107,13 +106,13 @@ func (s *suite) TheUserRunsTheCommand(cmd string) { res, err := s.pocketd.RunCommand(cmds...) s.pocketd.result = res if err != nil { - s.Fatalf("error running command %s: %s", cmd, err) + s.Fatalf("error running command %s: %s", cmd, err) //nolint:typecheck // This method does exist } } func (s *suite) TheUserShouldBeAbleToSeeStandardOutputContaining(arg1 string) { if !strings.Contains(s.pocketd.result.Stdout, arg1) { - s.Fatalf("stdout must contain %s", arg1) + s.Fatalf("stdout must contain %s", arg1) //nolint:typecheck // This method does exist } } @@ -130,7 +129,7 @@ func (s *suite) TheUserSendsUpoktFromAccountToAccount(amount int64, accName1, ac } res, err := s.pocketd.RunCommandOnHost("", args...) if err != nil { - s.Fatalf("error sending upokt: %s", err) + s.Fatalf("error sending upokt: %s", err) //nolint:typecheck // This method does exist } s.pocketd.result = res } @@ -138,7 +137,13 @@ func (s *suite) TheUserSendsUpoktFromAccountToAccount(amount int64, accName1, ac func (s *suite) TheAccountHasABalanceGreaterThanUpokt(accName string, amount int64) { bal := s.getAccBalance(accName) if int64(bal) < amount { - s.Fatalf("account %s does not have enough upokt: %d < %d", accName, bal, amount) + //nolint:typecheck // This method does exist + s.Fatalf( + "account %s does not have enough upokt: %d < %d", + accName, + bal, + amount, + ) } s.scenarioState[accName] = bal // save the balance for later } @@ -148,24 +153,37 @@ func (s *suite) AnAccountExistsFor(accName string) { s.scenarioState[accName] = bal // save the balance for later } -func (s *suite) TheAccountBalanceOfShouldBeUpoktThanBefore(accName string, amount int64, condition string) { +func (s *suite) TheAccountBalanceOfShouldBeUpoktThanBefore(accName string, _ int64, condition string) { prev, ok := s.scenarioState[accName] if !ok { - s.Fatalf("no previous balance found for %s", accName) + s.Fatalf("no previous balance found for %s", accName) //nolint:typecheck // This method does exist } bal := s.getAccBalance(accName) switch condition { case "more": if bal <= prev.(int) { - s.Fatalf("account %s expected to have more upokt but: %d <= %d", accName, bal, prev) + //nolint:typecheck // This method does exist + s.Fatalf( + "account %s expected to have more upokt but: %d <= %d", + accName, + bal, + prev, + ) } case "less": if bal >= prev.(int) { - s.Fatalf("account %s expected to have less upokt but: %d >= %d", accName, bal, prev) + //nolint:typecheck // This method does exist + s.Fatalf( + "account %s expected to have less upokt but: %d >= %d", + accName, + bal, + prev, + ) } default: - s.Fatalf("unknown condition %s", condition) + s.Fatalf("unknown condition %s", condition) //nolint:typecheck // This method does exist + } } @@ -177,12 +195,12 @@ func (s *suite) TheUserStakesAWithUpoktFromTheAccount(actorType string, amount i // Create a temporary config file configPathPattern := fmt.Sprintf("%s_stake_config_*.yaml", accName) configContent := fmt.Sprintf(`stake_amount: %d upokt`, amount) - configFile, err := ioutil.TempFile("", configPathPattern) + configFile, err := os.CreateTemp("", configPathPattern) if err != nil { - s.Fatalf("error creating config file: %q", err) + s.Fatalf("error creating config file: %q", err) //nolint:typecheck // This method does exist } if _, err = configFile.Write([]byte(configContent)); err != nil { - s.Fatalf("error writing config file: %q", err) + s.Fatalf("error writing config file: %q", err) //nolint:typecheck // This method does exist } args := []string{ @@ -201,11 +219,11 @@ func (s *suite) TheUserStakesAWithUpoktFromTheAccount(actorType string, amount i // Remove the temporary config file err = os.Remove(configFile.Name()) if err != nil { - s.Fatalf("error removing config file: %q", err) + s.Fatalf("error removing config file: %q", err) //nolint:typecheck // This method does exist } if err != nil { - s.Fatalf("error staking %s: %s", actorType, err) + s.Fatalf("error staking %s: %s", actorType, err) //nolint:typecheck // This method does exist } s.pocketd.result = res } @@ -222,7 +240,7 @@ func (s *suite) TheUserUnstakesAFromTheAccount(actorType string, accName string) } res, err := s.pocketd.RunCommandOnHost("", args...) if err != nil { - s.Fatalf("error unstaking %s: %s", actorType, err) + s.Fatalf("error unstaking %s: %s", actorType, err) //nolint:typecheck // This method does exist } s.pocketd.result = res } @@ -230,58 +248,74 @@ func (s *suite) TheUserUnstakesAFromTheAccount(actorType string, accName string) func (s *suite) TheForAccountIsNotStaked(actorType, accName string) { found, _ := s.getStakedAmount(actorType, accName) if found { - s.Fatalf("account %s should not be staked", accName) + s.Fatalf("account %s should not be staked", accName) //nolint:typecheck // This method does exist } } func (s *suite) TheForAccountIsStakedWithUpokt(actorType, accName string, amount int64) { found, stakeAmount := s.getStakedAmount(actorType, accName) if !found { - s.Fatalf("account %s should be staked", accName) + s.Fatalf("account %s should be staked", accName) //nolint:typecheck // This method does exist } if int64(stakeAmount) != amount { - s.Fatalf("account %s stake amount is not %d", accName, amount) + s.Fatalf("account %s stake amount is not %d", accName, amount) //nolint:typecheck // This method does exist } } -func (s *suite) TheApplicationIsStakedForService(appName string, serviceId string) { +func (s *suite) TheApplicationIsStakedForService(appName string, serviceID string) { for _, serviceConfig := range accNameToAppMap[appName].ServiceConfigs { - if serviceConfig.Service.Id == serviceId { + if serviceConfig.Service.Id == serviceID { return } } - s.Fatalf("application %s is not staked for service %s", appName, serviceId) + //nolint:typecheck // This method does exist + s.Fatalf( + "application %s is not staked for service %s", + appName, + serviceID, + ) } -func (s *suite) TheSupplierIsStakedForService(supplierName string, serviceId string) { +func (s *suite) TheSupplierIsStakedForService(supplierName string, serviceID string) { for _, serviceConfig := range accNameToSupplierMap[supplierName].Services { - if serviceConfig.Service.Id == serviceId { + if serviceConfig.Service.Id == serviceID { return } } - s.Fatalf("supplier %s is not staked for service %s", supplierName, serviceId) + //nolint:typecheck // This method does exist + s.Fatalf( + "supplier %s is not staked for service %s", + supplierName, + serviceID, + ) } -func (s *suite) TheSessionForApplicationAndServiceContainsTheSupplier(appName, serviceId, supplierName string) { +func (s *suite) TheSessionForApplicationAndServiceContainsTheSupplier(appName, serviceID, supplierName string) { app, found := accNameToAppMap[appName] if !found { - s.Fatalf("application %s not found", appName) + s.Fatalf("application %s not found", appName) //nolint:typecheck // This method does exist } expectedSupplier, found := accNameToSupplierMap[supplierName] if !found { - s.Fatalf("supplier %s not found", supplierName) + s.Fatalf("supplier %s not found", supplierName) //nolint:typecheck // This method does exist } argsAndFlags := []string{ "query", "session", "get-session", app.Address, - serviceId, + serviceID, fmt.Sprintf("--%s=json", tmcli.OutputFlag), } res, err := s.pocketd.RunCommandOnHost("", argsAndFlags...) if err != nil { - s.Fatalf("error getting session for app %s and service %s: %s", appName, serviceId, err) + //nolint:typecheck // This method does exist + s.Fatalf( + "error getting session for app %s and service %s: %s", + appName, + serviceID, + err, + ) } var resp sessiontypes.QueryGetSessionResponse responseBz := []byte(strings.TrimSpace(res.Stdout)) @@ -291,17 +325,25 @@ func (s *suite) TheSessionForApplicationAndServiceContainsTheSupplier(appName, s return } } - s.Fatalf("session for app %s and service %s does not contain supplier %s", appName, serviceId, supplierName) + //nolint:typecheck // This method does exist + s.Fatalf( + "session for app %s and service %s does not contain supplier %s", + appName, + serviceID, + supplierName, + ) } func (s *suite) TheApplicationSendsTheSupplierARequestForServiceWithData( - appName, supplierName, serviceId, requestData string, + appName, supplierName, serviceID, requestData string, ) { - res, err := s.pocketd.RunCurl(appGateServerUrl, serviceId, requestData) + res, err := s.pocketd.RunCurl(appGateServerURL, serviceID, requestData) if err != nil { + //nolint:typecheck // This method does exist s.Fatalf( + "error sending relay request from app %s to supplier %s for service %s: %v", - appName, supplierName, serviceId, err, + appName, supplierName, serviceID, err, ) } @@ -326,7 +368,7 @@ func (s *suite) getStakedAmount(actorType, accName string) (bool, int) { } res, err := s.pocketd.RunCommandOnHost("", args...) if err != nil { - s.Fatalf("error getting %s: %s", actorType, err) + s.Fatalf("error getting %s: %s", actorType, err) //nolint:typecheck // This method does exist } s.pocketd.result = res found := strings.Contains(res.Stdout, accNameToAddrMap[accName]) @@ -336,7 +378,7 @@ func (s *suite) getStakedAmount(actorType, accName string) (bool, int) { stakedAmountRe := regexp.MustCompile(`address: ` + escapedAddress + `\s+stake:\s+amount: "(\d+)"`) matches := stakedAmountRe.FindStringSubmatch(res.Stdout) if len(matches) < 2 { - s.Fatalf("no stake amount found for %s", accName) + s.Fatalf("no stake amount found for %s", accName) //nolint:typecheck // This method does exist } amount, err = strconv.Atoi(matches[1]) require.NoError(s, err) @@ -414,7 +456,7 @@ func (s *suite) getAccBalance(accName string) int { } res, err := s.pocketd.RunCommandOnHost("", args...) if err != nil { - s.Fatalf("error getting balance: %s", err) + s.Fatalf("error getting balance: %s", err) //nolint:typecheck // This method does exist } s.pocketd.result = res match := amountRe.FindStringSubmatch(res.Stdout) diff --git a/e2e/tests/node.go b/e2e/tests/node.go index 63bff4502..34e161ebe 100644 --- a/e2e/tests/node.go +++ b/e2e/tests/node.go @@ -47,8 +47,8 @@ type commandResult struct { // PocketClient is a single function interface for interacting with a node type PocketClient interface { RunCommand(args ...string) (*commandResult, error) - RunCommandOnHost(rpcUrl string, args ...string) (*commandResult, error) - RunCurl(rpcUrl, service, data string, args ...string) (*commandResult, error) + RunCommandOnHost(rpcURL string, args ...string) (*commandResult, error) + RunCurl(rpcURL, service, data string, args ...string) (*commandResult, error) } // Ensure that pocketdBin struct fulfills PocketClient @@ -65,20 +65,20 @@ func (p *pocketdBin) RunCommand(args ...string) (*commandResult, error) { } // RunCommandOnHost runs a command on specified host with the given args -func (p *pocketdBin) RunCommandOnHost(rpcUrl string, args ...string) (*commandResult, error) { - if rpcUrl == "" { - rpcUrl = defaultRPCURL +func (p *pocketdBin) RunCommandOnHost(rpcURL string, args ...string) (*commandResult, error) { + if rpcURL == "" { + rpcURL = defaultRPCURL } - args = append(args, "--node", rpcUrl) + args = append(args, "--node", rpcURL) return p.runPocketCmd(args...) } // RunCurl runs a curl command on the local machine -func (p *pocketdBin) RunCurl(rpcUrl, service, data string, args ...string) (*commandResult, error) { - if rpcUrl == "" { - rpcUrl = defaultAppGateServerURL +func (p *pocketdBin) RunCurl(rpcURL, service, data string, args ...string) (*commandResult, error) { + if rpcURL == "" { + rpcURL = defaultAppGateServerURL } - return p.runCurlPostCmd(rpcUrl, service, data, args...) + return p.runCurlPostCmd(rpcURL, service, data, args...) } // runPocketCmd is a helper to run a command using the local pocketd binary with the flags provided @@ -115,13 +115,13 @@ func (p *pocketdBin) runPocketCmd(args ...string) (*commandResult, error) { // runCurlPostCmd is a helper to run a command using the local pocketd binary with the flags provided func (p *pocketdBin) runCurlPostCmd( - rpcUrl string, + rpcURL string, service string, data string, args ...string, ) (*commandResult, error) { dataStr := fmt.Sprintf("%s", data) - urlStr := fmt.Sprintf("%s/%s", rpcUrl, service) + urlStr := fmt.Sprintf("%s/%s", rpcURL, service) base := []string{ "-v", // verbose output "-sS", // silent with error diff --git a/e2e/tests/session_steps_test.go b/e2e/tests/session_steps_test.go index c489728ba..e3f052c5d 100644 --- a/e2e/tests/session_steps_test.go +++ b/e2e/tests/session_steps_test.go @@ -26,12 +26,12 @@ const ( eitherEventsReplayBufferSize = 100 //nolint:lll // Not liniting as this is a long query string. msgClaimSenderQueryFmt = "tm.event='Tx' AND message.sender='%s' AND message.action='/pocket.supplier.MsgCreateClaim'" - testServiceId = "anvil" + testServiceID = "anvil" eitherEventsBzReplayObsKey = "eitherEventsBzReplayObsKey" preExistingClaimsKey = "preExistingClaimsKey" ) -func (s *suite) AfterTheSupplierCreatesAClaimForTheSessionForServiceForApplication(serviceId, appName string) { +func (s *suite) AfterTheSupplierCreatesAClaimForTheSessionForServiceForApplication(_, _ string) { ctx, done := context.WithCancel(context.Background()) // TODO_CONSIDERATION: if this test suite gets more complex, it might make @@ -85,7 +85,7 @@ func (s *suite) AfterTheSupplierCreatesAClaimForTheSessionForServiceForApplicati } func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersistedOnchain( - supplierName, serviceId, appName string, + supplierName, _, _ string, ) { ctx := context.Background() @@ -118,7 +118,7 @@ func (s *suite) TheClaimCreatedBySupplierForServiceForApplicationShouldBePersist } func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication( - supplierName, relayCountStr, serviceId, appName string, + supplierName, relayCountStr, _, appName string, ) { ctx := context.Background() @@ -146,7 +146,7 @@ func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication s.sendRelaysForSession( appName, supplierName, - testServiceId, + testServiceID, relayCount, ) } @@ -154,18 +154,18 @@ func (s *suite) TheSupplierHasServicedASessionWithRelaysForServiceForApplication func (s *suite) sendRelaysForSession( appName string, supplierName string, - serviceId string, + serviceID string, relayLimit int, ) { - s.TheApplicationIsStakedForService(appName, serviceId) - s.TheSupplierIsStakedForService(supplierName, serviceId) - s.TheSessionForApplicationAndServiceContainsTheSupplier(appName, serviceId, supplierName) + s.TheApplicationIsStakedForService(appName, serviceID) + s.TheSupplierIsStakedForService(supplierName, serviceID) + s.TheSessionForApplicationAndServiceContainsTheSupplier(appName, serviceID, supplierName) // TODO_IMPROVE/TODO_COMMUNITY: hard-code a default set of RPC calls to iterate over for coverage. data := `{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}` for i := 0; i < relayLimit; i++ { - s.TheApplicationSendsTheSupplierARequestForServiceWithData(appName, supplierName, serviceId, data) + s.TheApplicationSendsTheSupplierARequestForServiceWithData(appName, supplierName, serviceID, data) s.TheApplicationReceivesASuccessfulRelayResponseSignedBy(appName, supplierName) } } From 51cb379787394d299ae5f49bcc9a07f4007492b8 Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 21:45:48 +0000 Subject: [PATCH 48/61] chore: go mod tidy & ignite chain build --- docs/static/openapi.yml | 10 ---------- go.mod | 8 +++++--- go.sum | 36 ++++++++++++++++++++++++++++++++++++ 3 files changed, 41 insertions(+), 13 deletions(-) diff --git a/docs/static/openapi.yml b/docs/static/openapi.yml index 3b94cb82a..af8b41430 100644 --- a/docs/static/openapi.yml +++ b/docs/static/openapi.yml @@ -47279,14 +47279,12 @@ paths: - GRPC - WEBSOCKET - JSON_RPC - - REST default: UNKNOWN_RPC description: |- - UNKNOWN_RPC: Undefined RPC type - GRPC: gRPC - WEBSOCKET: WebSocket - JSON_RPC: JSON-RPC - - REST: REST configs: type: array items: @@ -77807,14 +77805,12 @@ definitions: - GRPC - WEBSOCKET - JSON_RPC - - REST default: UNKNOWN_RPC description: |- - UNKNOWN_RPC: Undefined RPC type - GRPC: gRPC - WEBSOCKET: WebSocket - JSON_RPC: JSON-RPC - - REST: REST configs: type: array items: @@ -78061,14 +78057,12 @@ definitions: - GRPC - WEBSOCKET - JSON_RPC - - REST default: UNKNOWN_RPC description: |- - UNKNOWN_RPC: Undefined RPC type - GRPC: gRPC - WEBSOCKET: WebSocket - JSON_RPC: JSON-RPC - - REST: REST configs: type: array items: @@ -78215,7 +78209,6 @@ definitions: - GRPC: gRPC - WEBSOCKET: WebSocket - JSON_RPC: JSON-RPC - - REST: REST title: Enum to define RPC types pocket.shared.Supplier: type: object @@ -78284,7 +78277,6 @@ definitions: - GRPC: gRPC - WEBSOCKET: WebSocket - JSON_RPC: JSON-RPC - - REST: REST configs: type: array items: @@ -78343,7 +78335,6 @@ definitions: - GRPC: gRPC - WEBSOCKET: WebSocket - JSON_RPC: JSON-RPC - - REST: REST configs: type: array items: @@ -78416,7 +78407,6 @@ definitions: - GRPC: gRPC - WEBSOCKET: WebSocket - JSON_RPC: JSON-RPC - - REST: REST configs: type: array items: diff --git a/go.mod b/go.mod index 9be97f1d6..79d204874 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,9 @@ // module pocket module github.com/pokt-network/poktroll -go 1.20 +go 1.21 + +toolchain go1.21.6 require ( cosmossdk.io/api v0.3.1 @@ -24,6 +26,7 @@ require ( github.com/athanorlabs/go-dleq v0.1.0 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 + github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/v7 v7.1.0 @@ -47,6 +50,7 @@ require ( golang.org/x/crypto v0.15.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 golang.org/x/sync v0.5.0 + google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb google.golang.org/grpc v1.59.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -90,7 +94,6 @@ require ( github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.0 // indirect @@ -285,7 +288,6 @@ require ( google.golang.org/api v0.143.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/go.sum b/go.sum index ec5e16d20..1120d2c2e 100644 --- a/go.sum +++ b/go.sum @@ -232,6 +232,7 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2 github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= @@ -253,6 +254,7 @@ github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuN github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= @@ -342,8 +344,10 @@ github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/i github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= +github.com/btcsuite/btcd/btcutil v1.1.2/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= +github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= @@ -357,6 +361,7 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bufbuild/buf v1.3.1/go.mod h1:CTRUb23N+zlm1U8ZIBKz0Sqluk++qQloB2i/MZNZHIs= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= +github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= @@ -442,6 +447,7 @@ github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHq github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU= +github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -510,6 +516,7 @@ github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQY github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= @@ -537,9 +544,11 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/cli v20.10.14+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRXp6zpzF6tM= +github.com/docker/cli v24.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= +github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -604,6 +613,7 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= +github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= @@ -651,6 +661,7 @@ github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8c github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= +github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= @@ -676,10 +687,13 @@ github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= +github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= +github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= +github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -789,6 +803,7 @@ github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= @@ -798,6 +813,7 @@ github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIG github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= +github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -855,6 +871,7 @@ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 github.com/gookit/color v1.5.1/go.mod h1:wZFzea4X8qN6vHOSP2apMb4/+w/orMznEzYsIHPaqKM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= +github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA= @@ -995,6 +1012,7 @@ github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= +github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -1055,6 +1073,7 @@ github.com/jhump/protocompile v0.0.0-20220216033700-d705409f108f/go.mod h1:qr2b5 github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= github.com/jhump/protoreflect v1.11.1-0.20220213155251-0c2aedc66cf4/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= +github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -1125,6 +1144,7 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -1138,6 +1158,7 @@ github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdB github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= +github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -1213,6 +1234,7 @@ github.com/libp2p/go-libp2p-testing v0.7.0/go.mod h1:OLbdn9DbgdMwv00v+tlp1l3oe2C github.com/libp2p/go-libp2p-testing v0.9.0/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= github.com/libp2p/go-libp2p-testing v0.9.2/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= +github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= github.com/libp2p/go-libp2p-tls v0.3.0/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= github.com/libp2p/go-libp2p-tls v0.4.1/go.mod h1:EKCixHEysLNDlLUoKxv+3f/Lp90O2EXNjTr0UQDnrIw= github.com/libp2p/go-libp2p-transport-upgrader v0.5.0/go.mod h1:Rc+XODlB3yce7dvFV4q/RmyJGsFcCZRkeZMu/Zdg0mo= @@ -1386,6 +1408,7 @@ github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdx github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= +github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -1524,14 +1547,17 @@ github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je4 github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= +github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= +github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= +github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= @@ -1553,6 +1579,7 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/ory/dockertest/v3 v3.9.1/go.mod h1:42Ir9hmvaAPm0Mgibk6mBPi7SFvTXxEcnztDYOJ//uM= github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= +github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= @@ -1700,6 +1727,7 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rollkit/celestia-openrpc v0.3.0 h1:jMLsdLNQ7T20yiNDlisBhlyurFOpN1gZ6vC068FPrQA= github.com/rollkit/celestia-openrpc v0.3.0/go.mod h1:2ZhU01YF2hsHIROWzxfMZOYM09Kgyy4roH5JWoNJzp0= github.com/rollkit/cosmos-sdk v0.47.3-rollkit-v0.10.6-no-fraud-proofs h1:D9O/mnXjjIAF0mOsANByeWRwSDaVH587SjO6kgWVRyM= @@ -1769,6 +1797,7 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= github.com/sivchari/nosnakecase v1.5.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.6.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= @@ -1873,8 +1902,11 @@ github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaE github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= +github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= +github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= +github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= @@ -1893,6 +1925,7 @@ github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVM github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= +github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -1951,6 +1984,7 @@ github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8/go.mod h1:ZkMZ0dpQyWwlENaeZVBiQRjhMEZvk6VTXquzl3FOFP8= gitlab.com/NebulousLabs/errors v0.0.0-20200929122200-06c536cf6975 h1:L/ENs/Ar1bFzUeKx6m3XjlmBgIUlykX9dzvp5k9NGxc= +gitlab.com/NebulousLabs/errors v0.0.0-20200929122200-06c536cf6975/go.mod h1:ZkMZ0dpQyWwlENaeZVBiQRjhMEZvk6VTXquzl3FOFP8= gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40 h1:dizWJqTWjwyD8KGcMOwgrkqu1JIkofYgKkmDeNE7oAs= gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40/go.mod h1:rOnSnoRyxMI3fe/7KIbVcsHRGxe30OONv8dEgo+vCfA= gitlab.com/bosi/decorder v0.2.2/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= @@ -1999,6 +2033,7 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= +go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= go.uber.org/fx v1.20.0 h1:ZMC/pnRvhsthOZh9MZjMq5U8Or3mA9zBSPaLnzs3ihQ= @@ -2008,6 +2043,7 @@ go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpK go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= +go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= From 1953b7e774e3be9db355ebc07fd46ea31d225101 Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 22:21:07 +0000 Subject: [PATCH 49/61] feat: replace custom linter with golangci-lint action --- .github/workflows/run-tests.yml | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index 24f042129..f97d24496 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -9,6 +9,11 @@ concurrency: group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }} cancel-in-progress: true +permissions: + contents: read + pull-requests: read + checks: write + env: GKE_CLUSTER: protocol-us-central1 GKE_ZONE: us-central1 @@ -17,15 +22,6 @@ jobs: go-test: runs-on: ubuntu-latest steps: - - name: install ignite - # TODO_TECHDEBT: upgrade to the latest Ignite (the latest at the moment of creating a note is 0.28). Need to downgrade to fix CI pipelines. Might be done in scope of #240. - run: | - # curl https://get.ignite.com/cli! | bash - wget https://github.com/ignite/cli/releases/download/v0.27.2/ignite_0.27.2_linux_amd64.tar.gz - tar -xzf ignite_0.27.2_linux_amd64.tar.gz - sudo mv ignite /usr/local/bin/ignite - ignite version - - uses: actions/checkout@v3 with: fetch-depth: "0" # Per https://github.com/ignite/cli/issues/1674#issuecomment-1144619147 @@ -35,6 +31,15 @@ jobs: with: go-version: "1.20.10" + - name: install ignite + # TODO_TECHDEBT: upgrade to the latest Ignite (the latest at the moment of creating a note is 0.28). Need to downgrade to fix CI pipelines. Might be done in scope of #240. + run: | + # curl https://get.ignite.com/cli! | bash + wget https://github.com/ignite/cli/releases/download/v0.27.2/ignite_0.27.2_linux_amd64.tar.gz + tar -xzf ignite_0.27.2_linux_amd64.tar.gz + sudo mv ignite /usr/local/bin/ignite + ignite version + - name: Install CI dependencies run: make install_ci_deps @@ -50,8 +55,12 @@ jobs: - name: Format the repo run: make go_gofumpt + - name: golangci-lint + uses: golangci/golangci-lint-action@v3 + with: + version: latest + only-new-issues: true + args: --timeout 15m --issues-exit-code=1 + - name: Test run: make go_test - - - name: golangci-lint - run: make go_lint From 0ae08d208d911985dd63de7a76173f7be1b22ede Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 22:22:00 +0000 Subject: [PATCH 50/61] feat: remove custom linter script --- tools/scripts/golint/filters/filters.go | 132 ---------------- tools/scripts/golint/main.go | 199 ------------------------ 2 files changed, 331 deletions(-) delete mode 100644 tools/scripts/golint/filters/filters.go delete mode 100644 tools/scripts/golint/main.go diff --git a/tools/scripts/golint/filters/filters.go b/tools/scripts/golint/filters/filters.go deleted file mode 100644 index c5067f763..000000000 --- a/tools/scripts/golint/filters/filters.go +++ /dev/null @@ -1,132 +0,0 @@ -// The filters package contains functions that can be used to filter file paths. - -package filters - -import ( - "bufio" - "bytes" - "os" - "path/filepath" - "strings" -) - -const igniteScaffoldComment = "// this line is used by starport scaffolding" - -var ( - importStart = []byte("import (") - importEnd = []byte(")") -) - -// FilterFn is a function that returns true if the given path matches the -// filter's criteria. -type FilterFn func(path string) (bool, error) - -// PathMatchesGoExtension matches go source files. -func PathMatchesGoExtension(path string) (bool, error) { - return filepath.Ext(path) == ".go", nil -} - -// PathMatchesProtobufGo matches generated protobuf go source files. -func PathMatchesProtobufGo(path string) (bool, error) { - return strings.HasSuffix(path, ".pb.go"), nil -} - -// PathMatchesProtobufGatewayGo matches generated protobuf gateway go source files. -func PathMatchesProtobufGatewayGo(path string) (bool, error) { - return strings.HasSuffix(path, ".pb.gw.go"), nil -} - -// PathMatchesMockGo matches generated mock go source files. -func PathMatchesMockGo(path string) (bool, error) { - return strings.HasSuffix(path, "_mock.go"), nil -} - -// ImportBlockContainsScaffoldComment matches import blocks containing the -// `// this line is used by starport scaffolding` comment. -func ImportBlockContainsScaffoldComment(path string) (bool, error) { - return containsImportScaffoldComment(path) -} - -// ContentMatchesEmptyImportScaffold matches files that can't be goimport'd due -// to ignite incompatibility. -func ContentMatchesEmptyImportScaffold(path string) (bool, error) { - return containsEmptyImportScaffold(path) -} - -// containsEmptyImportScaffold checks if the go file at goSrcPath contains an -// import statement like the following: -// -// import ( -// // this line is used by starport scaffolding ... -// ) -func containsEmptyImportScaffold(goSrcPath string) (isEmptyImport bool, _ error) { - file, err := os.Open(goSrcPath) - if err != nil { - return false, err - } - defer file.Close() - - scanner := bufio.NewScanner(file) - scanner.Split(importBlockSplit) - - for scanner.Scan() { - trimmedImportBlock := strings.Trim(scanner.Text(), "\n\t") - if strings.HasPrefix(trimmedImportBlock, igniteScaffoldComment) { - return true, nil - } - } - - if scanner.Err() != nil { - return false, scanner.Err() - } - - return false, nil -} - -// containsImportScaffoldComment checks if the go file at goSrcPath contains a -// comment in the import block like the following: -// -// // this line is used by starport scaffolding ... -func containsImportScaffoldComment(goSrcPath string) (containsComment bool, _ error) { - file, err := os.Open(goSrcPath) - if err != nil { - return false, err - } - defer file.Close() - - scanner := bufio.NewScanner(file) - scanner.Split(importBlockSplit) - - for scanner.Scan() { - trimmedImportBlock := strings.Trim(scanner.Text(), "\n\t") - if strings.Contains(trimmedImportBlock, igniteScaffoldComment) { - return true, nil - } - } - - if scanner.Err() != nil { - return false, scanner.Err() - } - - return false, nil -} - -// importBlockSplit is a split function intended to be used with bufio.Scanner -// to extract the contents of a multi-line go import block. -func importBlockSplit(data []byte, _ bool) (advance int, token []byte, err error) { - // Search for the beginning of the import block - startIdx := bytes.Index(data, importStart) - if startIdx == -1 { - return 0, nil, nil - } - - // Search for the end of the import block from the start index - endIdx := bytes.Index(data[startIdx:], importEnd) - if endIdx == -1 { - return 0, nil, nil - } - - // Return the entire import block, including "import (" and ")" - importBlock := data[startIdx+len(importStart) : startIdx-len(importEnd)+endIdx+1] - return startIdx + endIdx + 1, importBlock, nil -} diff --git a/tools/scripts/golint/main.go b/tools/scripts/golint/main.go deleted file mode 100644 index 57e629831..000000000 --- a/tools/scripts/golint/main.go +++ /dev/null @@ -1,199 +0,0 @@ -package main - -import ( - "fmt" - "os" - "os/exec" - "path/filepath" - "strings" - - "github.com/pokt-network/poktroll/tools/scripts/gci/filters" -) - -var ( - defaultArgs = []string{ - "run", - } - defaultIncludeFilters = []filters.FilterFn{ - filters.PathMatchesGoExtension, - } - defaultExcludeFilters = []filters.FilterFn{ - filters.PathMatchesProtobufGo, - filters.PathMatchesProtobufGatewayGo, - filters.PathMatchesMockGo, - filters.ContentMatchesEmptyImportScaffold, - } -) - -// TODO_OPTIMISATION: This could probably be optimised for speed. -func main() { - root := "." - var ( - packagesWithGCI map[string][]string - packagesWithoutGCI map[string][]string - filesToProcessWithGCI []string - filesToProcessWithoutGCI []string - ) - - // Create the maps - packagesWithGCI = make(map[string][]string) - packagesWithoutGCI = make(map[string][]string) - - // Walk the file system and accumulate matching files - err := filepath.Walk(root, walkRepoRootFn( - root, - defaultIncludeFilters, - defaultExcludeFilters, - &filesToProcessWithGCI, - &filesToProcessWithoutGCI, - )) - if err != nil { - fmt.Printf("Error processing files: %s\n", err) - return - } - - // Organise each file found by package - if len(filesToProcessWithGCI) > 0 { - for _, path := range filesToProcessWithGCI { - pkgPath := filepath.Dir(path) - packagesWithGCI[pkgPath] = append(packagesWithGCI[pkgPath], path) - } - } - if len(filesToProcessWithoutGCI) > 0 { - for _, path := range filesToProcessWithoutGCI { - pkgPath := filepath.Dir(path) - packagesWithoutGCI[pkgPath] = append(packagesWithoutGCI[pkgPath], path) - } - } - - errorFound := false - totalOut := "" - if len(packagesWithGCI) > 0 { - fmt.Println("Linting files without scaffold comments in their import blocks...") - // Run golangci-lint on all files that don't have a scaffold comment in - // their import block - so it can be run normally with gci - for _, path := range packagesWithGCI { - args := append(defaultArgs, []string{"--enable=gci", "--enable=lll", "--enable=gofumpt"}...) - cmd := exec.Command("golangci-lint", append(args, path...)...) - out, err := cmd.CombinedOutput() - if err != nil { - fmt.Printf("Output: %s\nFailed running golangci-lint with gci: %v\n", out, err) - errorFound = true - } - totalOut += fmt.Sprintf("%s\n", out) - } - } - - if len(packagesWithoutGCI) > 0 { - fmt.Println("Linting files with scaffold comments in their import blocks...") - // Run golangci-lint on all files that do have a scaffold comment in - // their import block - so it can't be run with gci as it would remove it - for _, path := range packagesWithoutGCI { - args := append(defaultArgs, []string{"--enable=lll", "--enable=gofumpt"}...) - cmd := exec.Command("golangci-lint", append(args, path...)...) - out, err := cmd.CombinedOutput() - if err != nil { - fmt.Printf("Output: %s\nFailed running golangci-lint without gci: %v\n", out, err) - errorFound = true - } - totalOut += fmt.Sprintf("%s\n", out) - } - } - - // Fail if any errors were found - if errorFound { - fmt.Println(totalOut) - os.Exit(1) - } -} - -func walkRepoRootFn( - rootPath string, - includeFilters []filters.FilterFn, - excludeFilters []filters.FilterFn, - filesToProcessWithGCI *[]string, - filesToProcessWithoutGCI *[]string, -) filepath.WalkFunc { - return func(path string, info os.FileInfo, err error) error { - if err != nil { - return err - } - - // Don't process the root directory but don't skip it either; that would - // exclude everything. - if info.Name() == rootPath { - return nil - } - - // Don't look in specific dirctories for files to lint - if strings.HasPrefix(path, "ts-client") { - return nil - } - if strings.HasPrefix(path, "docs") { - return nil - } - if strings.HasPrefix(path, "bin") { - return nil - } - if strings.HasPrefix(path, ".git") { - return nil - } - - // No need to process directories - if info.IsDir() { - // Skip directories that start with a period - if strings.HasPrefix(info.Name(), ".") { - return filepath.SkipDir - } - return nil - } - - // Don't process paths which don't match any include filter. - var shouldIncludePath bool - for _, includeFilter := range includeFilters { - pathMatches, err := includeFilter(path) - if err != nil { - panic(err) - } - - if pathMatches { - shouldIncludePath = true - break - } - } - if !shouldIncludePath { - return nil - } - - // Don't process paths which match any exclude filter. - var shouldExcludePath bool - for _, excludeFilter := range excludeFilters { - pathMatches, err := excludeFilter(path) - if err != nil { - panic(err) - } - - if pathMatches { - shouldExcludePath = true - break - } - } - if shouldExcludePath { - return nil - } - - // Check if the file contains a scaffold comment in the import block, - // skip it and tell golangci-lin to disable the gci linter - containsImportScaffoldComment, err := filters.ImportBlockContainsScaffoldComment(path) - if err != nil { - panic(err) - } - if containsImportScaffoldComment { - *filesToProcessWithoutGCI = append(*filesToProcessWithoutGCI, path) - } else { - *filesToProcessWithGCI = append(*filesToProcessWithGCI, path) - } - - return nil - } -} From 7f32c6999809db3378ee2183d95a70336228a68d Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 22:24:01 +0000 Subject: [PATCH 51/61] feat: add extra linters --- .golangci.yml | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/.golangci.yml b/.golangci.yml index f7e35ab00..54a4b7490 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -7,9 +7,19 @@ run: - e2e - test - integration + - tools + - ignore +# TODO_TECHDEBT: Enable each linter listed, 1 by 1, fixing issues as they appear. linters: - disable-all: true + enable: + # - govet + # - errcheck + # - unused + - revive + - gofumpt + - lll + - gci linters-settings: govet: From ecf6ef86308309a6c8928c69a957ca1023834cc5 Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 22:25:12 +0000 Subject: [PATCH 52/61] feat: replace golangci-lint install with binary installer, and make go_lint use golangci-lint natively --- Makefile | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index d1d1a27dc..f6a6bf16c 100644 --- a/Makefile +++ b/Makefile @@ -11,10 +11,11 @@ POCKET_ADDR_PREFIX = pokt # TODO: Add other dependencies (ignite, docker, k8s, etc) here .PHONY: install_ci_deps -install_ci_deps: ## Installs `mockgen` - go install "github.com/golang/mock/mockgen@v1.6.0" && mockgen --version - go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest && golangci-lint --version - go install github.com/daixiang0/gci@latest && gci --version +install_ci_deps: ## Installs `mockgen` and `golangci-lint` and other linters + @export GOPATH=$$(go env GOPATH); \ + go install "github.com/golang/mock/mockgen@v1.6.0" && mockgen --version; \ + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$$GOPATH"/bin v1.55.2 && golangci-lint --version; \ + go install github.com/daixiang0/gci@latest && gci --version; \ go install mvdan.cc/gofumpt@latest && gofumpt --version ######################## @@ -181,7 +182,7 @@ localnet_regenesis: ## Regenerate the localnet genesis file .PHONY: go_lint go_lint: check_golanci_lint ## Run all go linters - go run ./tools/scripts/golint + golangci-lint run --allow-parallel-runners -c .golangci.yml ./... .PHONY: go_gci go_gci: check_gci ## Run gci (import ordering) on all applicable files, this writes changes in place From 160e8574777b10ac7c1d23f60e86ace9e62e2151 Mon Sep 17 00:00:00 2001 From: h5law Date: Wed, 17 Jan 2024 22:38:59 +0000 Subject: [PATCH 53/61] chore: reorg steps in test job back to how they were before --- .github/workflows/run-tests.yml | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index f97d24496..f9e95b7b6 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -22,15 +22,6 @@ jobs: go-test: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - with: - fetch-depth: "0" # Per https://github.com/ignite/cli/issues/1674#issuecomment-1144619147 - - - name: Set up Go - uses: actions/setup-go@v4 - with: - go-version: "1.20.10" - - name: install ignite # TODO_TECHDEBT: upgrade to the latest Ignite (the latest at the moment of creating a note is 0.28). Need to downgrade to fix CI pipelines. Might be done in scope of #240. run: | @@ -40,6 +31,15 @@ jobs: sudo mv ignite /usr/local/bin/ignite ignite version + - uses: actions/checkout@v3 + with: + fetch-depth: "0" # Per https://github.com/ignite/cli/issues/1674#issuecomment-1144619147 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: "1.20.10" + - name: Install CI dependencies run: make install_ci_deps From 087e6f75b5155541e8ebd7a7473a70a57c5d2d43 Mon Sep 17 00:00:00 2001 From: h5law Date: Thu, 18 Jan 2024 09:38:18 +0000 Subject: [PATCH 54/61] feat: install golangci-lint with go install and correct go version --- Makefile | 3 +-- go.mod | 4 +--- go.sum | 36 ------------------------------------ 3 files changed, 2 insertions(+), 41 deletions(-) diff --git a/Makefile b/Makefile index f6a6bf16c..68aae3218 100644 --- a/Makefile +++ b/Makefile @@ -12,9 +12,8 @@ POCKET_ADDR_PREFIX = pokt # TODO: Add other dependencies (ignite, docker, k8s, etc) here .PHONY: install_ci_deps install_ci_deps: ## Installs `mockgen` and `golangci-lint` and other linters - @export GOPATH=$$(go env GOPATH); \ go install "github.com/golang/mock/mockgen@v1.6.0" && mockgen --version; \ - curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b "$$GOPATH"/bin v1.55.2 && golangci-lint --version; \ + go install github.com/golangci/golangci-lint/cmd/golangci-lint@v1.55.2 && golangci-lint --version; \ go install github.com/daixiang0/gci@latest && gci --version; \ go install mvdan.cc/gofumpt@latest && gofumpt --version diff --git a/go.mod b/go.mod index 79d204874..56ed2d4fc 100644 --- a/go.mod +++ b/go.mod @@ -14,9 +14,7 @@ // module pocket module github.com/pokt-network/poktroll -go 1.21 - -toolchain go1.21.6 +go 1.20 require ( cosmossdk.io/api v0.3.1 diff --git a/go.sum b/go.sum index 1120d2c2e..ec5e16d20 100644 --- a/go.sum +++ b/go.sum @@ -232,7 +232,6 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2 github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= -github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/BurntSushi/toml v0.4.1/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/toml v1.1.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= @@ -254,7 +253,6 @@ github.com/Masterminds/sprig v2.15.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuN github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o= github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= -github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5/go.mod h1:lmUJ/7eu/Q8D7ML55dXQrVaamCz2vxCfdQBasLZfHKk= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= @@ -344,10 +342,8 @@ github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/i github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= -github.com/btcsuite/btcd/btcutil v1.1.2/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2 h1:KdUfX2zKommPRa+PD0sWZUyXe9w277ABlgELO7H04IM= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= @@ -361,7 +357,6 @@ github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtE github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= github.com/bufbuild/buf v1.3.1/go.mod h1:CTRUb23N+zlm1U8ZIBKz0Sqluk++qQloB2i/MZNZHIs= github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s= github.com/butuzov/ireturn v0.1.1/go.mod h1:Wh6Zl3IMtTpaIKbmwzqi6olnM9ptYQxxVacMsOEFPoc= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= @@ -447,7 +442,6 @@ github.com/containerd/cgroups v1.1.0/go.mod h1:6ppBcbh/NOOUU+dMKrykgaBnK9lCIBxHq github.com/containerd/console v1.0.3/go.mod h1:7LqA/THxQ86k76b8c/EMSiaJ3h1eZkMkXar0TQ1gf3U= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/containerd/continuity v0.4.1 h1:wQnVrjIyQ8vhU2sgOiL5T07jo+ouqc2bnKsv5/EqGhU= -github.com/containerd/continuity v0.4.1/go.mod h1:F6PTNCKepoxEaXLQp3wDAjygEnImnZ/7o4JzpodfroQ= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= @@ -516,7 +510,6 @@ github.com/davidlazar/go-crypto v0.0.0-20170701192655-dcfb0a7ac018/go.mod h1:rQY github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c h1:pFUpOrbxDR6AkioZ1ySsx5yxlDQZ8stG2b88gTPxgJU= github.com/davidlazar/go-crypto v0.0.0-20200604182044-b73af7476f6c/go.mod h1:6UhI8N9EjYm1c2odKpFpAYeR8dsBeM7PtzQhRgxRr9U= github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= -github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= @@ -544,11 +537,9 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/cli v20.10.14+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v20.10.17+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/cli v24.0.2+incompatible h1:QdqR7znue1mtkXIJ+ruQMGQhpw2JzMJLRXp6zpzF6tM= -github.com/docker/cli v24.0.2+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/docker v20.10.7+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v20.10.17+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= -github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= @@ -613,7 +604,6 @@ github.com/frankban/quicktest v1.11.3/go.mod h1:wRf/ReqHper53s+kmmSZizM8NamnL3IM github.com/frankban/quicktest v1.14.2/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.14.3/go.mod h1:mgiwOwqx65TmIk1wJ6Q7wvnVMocbUorkibMOrVTHZps= github.com/frankban/quicktest v1.14.4 h1:g2rn0vABPOOXmZUj+vbmUp0lPoXEMuhTpIluN0XL9UY= -github.com/frankban/quicktest v1.14.4/go.mod h1:4ptaffx2x8+WTWXmUCuVU6aPUX1/Mz7zb5vbUoiM6w0= github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo= github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.5.1/go.mod h1:T3375wBYaZdLLcVNkcVbzGHY7f1l/uK5T5Ai1i3InKU= @@ -661,7 +651,6 @@ github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8c github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= -github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= github.com/go-playground/validator/v10 v10.2.0 h1:KgJ0snyC2R9VXYN2rneOtQcw5aHQB1Vv0sFl1UcHBOY= github.com/go-playground/validator/v10 v10.2.0/go.mod h1:uOYAAleCW8F/7oMFd6aG0GOhaH6EGOAJShg8Id5JGkI= github.com/go-redis/redis v6.15.8+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= @@ -687,13 +676,10 @@ github.com/go-zookeeper/zk v1.0.2/go.mod h1:nOB03cncLtlp4t+UAkGSV+9beXP/akpekBwL github.com/gobwas/glob v0.2.3/go.mod h1:d3Ez4x06l9bZtSvzIay5+Yzi0fmZzPgnTbPcKjJAkT8= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= -github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= -github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/gobwas/ws v1.2.1 h1:F2aeBZrm2NDsc7vbovKrWSogd4wvfAxg0FQ89/iqOTk= -github.com/gobwas/ws v1.2.1/go.mod h1:hRKAFb8wOxFROYNsT1bqfWnhX+b5MFeJM9r2ZSwg/KY= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.3/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= @@ -803,7 +789,6 @@ github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= -github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gopacket v1.1.17/go.mod h1:UdDNZ1OO62aGYVnPhxT1U6aI7ukYtA/kB8vaU0diBUM= github.com/google/gopacket v1.1.19 h1:ves8RnFZPGiFnTS0uPQStjwru6uO6h+nlr9j6fL7kF8= github.com/google/gopacket v1.1.19/go.mod h1:iJ8V8n6KS+z2U1A8pUwu8bW5SyEMkXJB8Yo/Vo+TKTo= @@ -813,7 +798,6 @@ github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIG github.com/google/martian/v3 v3.1.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= github.com/google/martian/v3 v3.2.1/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/martian/v3 v3.3.2 h1:IqNFLAmvJOgVlpdEBiQbDc2EwKW77amAycfTuWKdfvw= -github.com/google/martian/v3 v3.3.2/go.mod h1:oBOf6HBosgwRXnUGWUB05QECsc6uvmMiJ3+6W4l/CUk= github.com/google/orderedcode v0.0.1 h1:UzfcAexk9Vhv8+9pNOgRu41f16lHq725vPwnSeiG/Us= github.com/google/orderedcode v0.0.1/go.mod h1:iVyU4/qPKHY5h/wSd6rZZCDcLJNxiWO6dvsYES2Sb20= github.com/google/pprof v0.0.0-20181206194817-3ea8567a2e57/go.mod h1:zfwlbNMJ+OItoe0UupaVj+oy1omPYYDuagoSzA8v9mc= @@ -871,7 +855,6 @@ github.com/googleapis/google-cloud-go-testing v0.0.0-20200911160855-bcd43fbb19e8 github.com/gookit/color v1.5.1/go.mod h1:wZFzea4X8qN6vHOSP2apMb4/+w/orMznEzYsIHPaqKM= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk= -github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gordonklaus/ineffassign v0.0.0-20200309095847-7953dde2c7bf/go.mod h1:cuNKsD1zp2v6XfE/orVX2QE1LC+i254ceGcVeDT3pTU= github.com/gordonklaus/ineffassign v0.0.0-20210914165742-4cc7213b9bc8/go.mod h1:Qcp2HIAYhR7mNUVSIxZww3Guk4it82ghYcEXIAk+QT0= github.com/gorhill/cronexpr v0.0.0-20180427100037-88b0669f7d75/go.mod h1:g2644b03hfBX9Ov0ZBDgXXens4rxSxmqFBbhvKv2yVA= @@ -1012,7 +995,6 @@ github.com/imdario/mergo v0.3.8/go.mod h1:2EnlNZ0deacrJVfApfmtdGgDfMuh/nq6Ok1EcJ github.com/imdario/mergo v0.3.12/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA= github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= -github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -1073,7 +1055,6 @@ github.com/jhump/protocompile v0.0.0-20220216033700-d705409f108f/go.mod h1:qr2b5 github.com/jhump/protoreflect v1.6.1/go.mod h1:RZQ/lnuN+zqeRVpQigTwO6o0AJUkxbnSnpuG7toUTG4= github.com/jhump/protoreflect v1.11.1-0.20220213155251-0c2aedc66cf4/go.mod h1:U7aMIjN0NWq9swDP7xDdoMfRHb35uiuTd3Z9nFXJf5E= github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= -github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= github.com/jingyugao/rowserrcheck v1.1.1/go.mod h1:4yvlZSDb3IyDTUZJUmpZfm2Hwok+Dtp+nu2qOq+er9c= github.com/jirfag/go-printf-func-name v0.0.0-20200119135958-7558a9eaa5af/go.mod h1:HEWGJkRDzjJY2sqdDwxccsGicWEf9BQOZsq2tV+xzM0= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= @@ -1144,7 +1125,6 @@ github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfn github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.0/go.mod h1:640gp4NfQd8pI5XOwp5fnNeVWj67G7CFk/SaSQn7NBk= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= -github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/pty v1.1.3/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= @@ -1158,7 +1138,6 @@ github.com/ldez/gomoddirectives v0.2.3/go.mod h1:cpgBogWITnCfRq2qGoDkKMEVSaarhdB github.com/ldez/tagliatelle v0.3.1/go.mod h1:8s6WJQwEYHbKZDsp/LjArytKOG8qaMrKQQ3mFukHs88= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= -github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/leonklingele/grouper v1.1.0/go.mod h1:uk3I3uDfi9B6PeUjsCKi6ndcf63Uy7snXgR4yDYQVDY= github.com/letsencrypt/pkcs11key/v4 v4.0.0/go.mod h1:EFUvBDay26dErnNb70Nd0/VW3tJiIbETBPTl9ATXQag= github.com/lib/pq v0.0.0-20180327071824-d34b9ff171c2/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= @@ -1234,7 +1213,6 @@ github.com/libp2p/go-libp2p-testing v0.7.0/go.mod h1:OLbdn9DbgdMwv00v+tlp1l3oe2C github.com/libp2p/go-libp2p-testing v0.9.0/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= github.com/libp2p/go-libp2p-testing v0.9.2/go.mod h1:Td7kbdkWqYTJYQGTwzlgXwaqldraIanyjuRiAbK/XQU= github.com/libp2p/go-libp2p-testing v0.12.0 h1:EPvBb4kKMWO29qP4mZGyhVzUyR25dvfUIK5WDu6iPUA= -github.com/libp2p/go-libp2p-testing v0.12.0/go.mod h1:KcGDRXyN7sQCllucn1cOOS+Dmm7ujhfEyXQL5lvkcPg= github.com/libp2p/go-libp2p-tls v0.3.0/go.mod h1:fwF5X6PWGxm6IDRwF3V8AVCCj/hOd5oFlg+wo2FxJDY= github.com/libp2p/go-libp2p-tls v0.4.1/go.mod h1:EKCixHEysLNDlLUoKxv+3f/Lp90O2EXNjTr0UQDnrIw= github.com/libp2p/go-libp2p-transport-upgrader v0.5.0/go.mod h1:Rc+XODlB3yce7dvFV4q/RmyJGsFcCZRkeZMu/Zdg0mo= @@ -1408,7 +1386,6 @@ github.com/moby/sys/mountinfo v0.5.0/go.mod h1:3bMD3Rg+zkqx8MRYPi7Pyb0Ie97QEBmdx github.com/moby/term v0.0.0-20201216013528-df9cb8a40635/go.mod h1:FBS0z0QWA44HXygs7VXDUOGoN/1TV3RuWkLO04am3wc= github.com/moby/term v0.0.0-20210619224110-3f7ff695adc6/go.mod h1:E2VnQOmVuvZB6UYnnDB0qG5Nq/1tD9acaOpo6xmt0Kw= github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= -github.com/moby/term v0.5.0/go.mod h1:8FzsFHVUBGZdbDsJw/ot+X+d5HLUbvklYLJ9uGfcI3Y= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -1547,17 +1524,14 @@ github.com/onsi/gomega v1.13.0/go.mod h1:lRk9szgn8TxENtWd0Tp4c3wjlRfMTMH27I+3Je4 github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.27.8 h1:gegWiwZjBsf2DgiSbf5hpokZ98JVDMcWkUiigk6/KXc= -github.com/onsi/gomega v1.27.8/go.mod h1:2J8vzI/s+2shY9XHRApDkdgPo1TKT7P2u6fXeJKFnNQ= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= github.com/opencontainers/image-spec v1.0.2/go.mod h1:BtxoFyWECRxE4U/7sNtV5W15zMzWCbyJoFRP3s7yZA0= github.com/opencontainers/image-spec v1.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= -github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= github.com/opencontainers/runc v1.1.2/go.mod h1:Tj1hFw6eFWp/o33uxGf5yF2BX5yz2Z6iptFpuvbbKqc= github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJHLXuG2PsnNg= github.com/opencontainers/runc v1.1.7 h1:y2EZDS8sNng4Ksf0GUYNhKbTShZJPJg1FiXJNH/uoCk= -github.com/opencontainers/runc v1.1.7/go.mod h1:CbUumNnWCuTGFukNXahoo/RFBZvDAgRh/smNYNOhA50= github.com/opencontainers/runtime-spec v1.0.2/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417/go.mod h1:jwyrGlmzljRJv/Fgzds9SsS/C5hL+LL3ko9hs6T5lQ0= github.com/opencontainers/runtime-spec v1.1.0 h1:HHUyrt9mwHUjtasSbXSMvs4cyFxh+Bll4AjJ9odEGpg= @@ -1579,7 +1553,6 @@ github.com/ory/dockertest v3.3.5+incompatible h1:iLLK6SQwIhcbrG783Dghaaa3WPzGc+4 github.com/ory/dockertest v3.3.5+incompatible/go.mod h1:1vX4m9wsvi00u5bseYwXaSnhNrne+V0E6LAcBILJdPs= github.com/ory/dockertest/v3 v3.9.1/go.mod h1:42Ir9hmvaAPm0Mgibk6mBPi7SFvTXxEcnztDYOJ//uM= github.com/ory/dockertest/v3 v3.10.0 h1:4K3z2VMe8Woe++invjaTB7VRyQXQy5UY+loujO4aNE4= -github.com/ory/dockertest/v3 v3.10.0/go.mod h1:nr57ZbRWMqfsdGdFNLHz5jjNdDb7VVFnzAeW1n5N1Lg= github.com/otiai10/copy v1.2.0/go.mod h1:rrF5dJ5F0t/EWSYODDu4j9/vEeYHMkc8jt0zJChqQWw= github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJG+0mI8eUu6xqkFDYS2kb2saOteoSB3cE= github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= @@ -1727,7 +1700,6 @@ github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFR github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.1/go.mod h1:JeRgkft04UBgHMgCIwADu4Pn6Mtm5d4nPKWu0nJ5d+o= github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= github.com/rollkit/celestia-openrpc v0.3.0 h1:jMLsdLNQ7T20yiNDlisBhlyurFOpN1gZ6vC068FPrQA= github.com/rollkit/celestia-openrpc v0.3.0/go.mod h1:2ZhU01YF2hsHIROWzxfMZOYM09Kgyy4roH5JWoNJzp0= github.com/rollkit/cosmos-sdk v0.47.3-rollkit-v0.10.6-no-fraud-proofs h1:D9O/mnXjjIAF0mOsANByeWRwSDaVH587SjO6kgWVRyM= @@ -1797,7 +1769,6 @@ github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrf github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.8.1/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= -github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/sivchari/containedctx v1.0.2/go.mod h1:PwZOeqm4/DLoJOqMSIJs3aKqXRX4YO+uXww087KZ7Bw= github.com/sivchari/nosnakecase v1.5.0/go.mod h1:CwDzrzPea40/GB6uynrNLiorAlgFRvRbFSgJx2Gs+QY= github.com/sivchari/tenv v1.6.0/go.mod h1:64yStXKSOxDfX47NlhVwND4dHwfZDdbp2Lyl018Icvg= @@ -1902,11 +1873,8 @@ github.com/tetafro/godot v1.4.11/go.mod h1:LR3CJpxDVGlYOWn3ZZg1PgNZdTUvzsZWu8xaE github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tidwall/gjson v1.14.4 h1:uo0p8EbA09J7RQaflQ1aBRffTR7xedD2bcIVSYxLnkM= -github.com/tidwall/gjson v1.14.4/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= github.com/tidwall/pretty v1.2.1 h1:qjsOFOWWQl+N3RsoF5/ssm1pHmJJwhjlSbZ51I6wMl4= -github.com/tidwall/pretty v1.2.1/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= github.com/timakin/bodyclose v0.0.0-20210704033933-f49887972144/go.mod h1:Qimiffbc6q9tBWlVV6x0P9sat/ao1xEkREYPPj9hphk= github.com/tinylib/msgp v1.1.5/go.mod h1:eQsjooMTnV42mHu917E26IogZ2930nFyBQdofk10Udg= github.com/tj/assert v0.0.3/go.mod h1:Ne6X72Q+TB1AteidzQncjw9PabbMp4PBMZ1k+vd1Pvk= @@ -1925,7 +1893,6 @@ github.com/ugorji/go v1.1.7/go.mod h1:kZn38zHttfInRq0xu/PH0az30d+z6vm202qpg1oXVM github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= github.com/ugorji/go/codec v1.1.7/go.mod h1:Ax+UKWsSmolVDwsd+7N3ZtXu+yMGCf907BLYF3GoBXY= github.com/ugorji/go/codec v1.2.7 h1:YPXUKf7fYbp/y8xloBqZOw2qaVggbfwMlI8WM3wZUJ0= -github.com/ugorji/go/codec v1.2.7/go.mod h1:WGN1fab3R1fzQlVQTkfxVtIBhWDRqOviHU95kRgeqEY= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= @@ -1984,7 +1951,6 @@ github.com/zondax/ledger-go v0.14.1 h1:Pip65OOl4iJ84WTpA4BKChvOufMhhbxED3BaihoZN github.com/zondax/ledger-go v0.14.1/go.mod h1:fZ3Dqg6qcdXWSOJFKMG8GCTnD7slO/RL2feOQv8K320= gitlab.com/NebulousLabs/errors v0.0.0-20171229012116-7ead97ef90b8/go.mod h1:ZkMZ0dpQyWwlENaeZVBiQRjhMEZvk6VTXquzl3FOFP8= gitlab.com/NebulousLabs/errors v0.0.0-20200929122200-06c536cf6975 h1:L/ENs/Ar1bFzUeKx6m3XjlmBgIUlykX9dzvp5k9NGxc= -gitlab.com/NebulousLabs/errors v0.0.0-20200929122200-06c536cf6975/go.mod h1:ZkMZ0dpQyWwlENaeZVBiQRjhMEZvk6VTXquzl3FOFP8= gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40 h1:dizWJqTWjwyD8KGcMOwgrkqu1JIkofYgKkmDeNE7oAs= gitlab.com/NebulousLabs/fastrand v0.0.0-20181126182046-603482d69e40/go.mod h1:rOnSnoRyxMI3fe/7KIbVcsHRGxe30OONv8dEgo+vCfA= gitlab.com/bosi/decorder v0.2.2/go.mod h1:9K1RB5+VPNQYtXtTDAzd2OEftsZb1oV0IrJrzChSdGE= @@ -2033,7 +1999,6 @@ go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.9.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/atomic v1.11.0 h1:ZvwS0R+56ePWxUNi+Atn9dWONBPp/AUETXlHW0DxSjE= -go.uber.org/atomic v1.11.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= go.uber.org/dig v1.17.0 h1:5Chju+tUvcC+N7N6EV08BJz41UZuO3BmHcN4A287ZLI= go.uber.org/dig v1.17.0/go.mod h1:rTxpf7l5I0eBTlE6/9RL+lDybC7WFwY2QH55ZSjy1mU= go.uber.org/fx v1.20.0 h1:ZMC/pnRvhsthOZh9MZjMq5U8Or3mA9zBSPaLnzs3ihQ= @@ -2043,7 +2008,6 @@ go.uber.org/goleak v1.1.11-0.20210813005559-691160354723/go.mod h1:cwTWslyiVhfpK go.uber.org/goleak v1.1.11/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ= go.uber.org/goleak v1.2.0 h1:xqgm/S+aQvhWFTtR0XK3Jvg7z8kGV8P4X14IzwN3Eqk= -go.uber.org/goleak v1.2.0/go.mod h1:XJYK+MuIchqpmGmUSAzotztawfKvYLUIgg7guXrwVUo= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= From 4bec743ef0bd4b1e05ff4a745e5074ce808eb59b Mon Sep 17 00:00:00 2001 From: h5law Date: Thu, 18 Jan 2024 10:47:48 +0000 Subject: [PATCH 55/61] feat: add mise.local.toml exclusion --- .gitignore | 1 + go.mod | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 9aaa16ba7..b9ee9601a 100644 --- a/.gitignore +++ b/.gitignore @@ -40,6 +40,7 @@ localnet/*/config/*.json .vscode .env .idea/ +.mise.local.toml # Compiled protos **/*.pb.go diff --git a/go.mod b/go.mod index 56ed2d4fc..9be97f1d6 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,6 @@ require ( github.com/athanorlabs/go-dleq v0.1.0 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/v7 v7.1.0 @@ -48,7 +47,6 @@ require ( golang.org/x/crypto v0.15.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 golang.org/x/sync v0.5.0 - google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb google.golang.org/grpc v1.59.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -92,6 +90,7 @@ require ( github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.0 // indirect @@ -286,6 +285,7 @@ require ( google.golang.org/api v0.143.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect From 00da2e6bed6ca7cf3b1ce0eeb09ec3097196d01a Mon Sep 17 00:00:00 2001 From: h5law Date: Thu, 18 Jan 2024 22:03:21 +0000 Subject: [PATCH 56/61] feat: add godoc comments to the formatting tool scripts --- go.mod | 4 ++-- tools/scripts/gci/main.go | 15 ++++++++++++++- tools/scripts/gofumpt/main.go | 16 ++++++++++++++-- 3 files changed, 30 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 9be97f1d6..56ed2d4fc 100644 --- a/go.mod +++ b/go.mod @@ -24,6 +24,7 @@ require ( github.com/athanorlabs/go-dleq v0.1.0 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 + github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/v7 v7.1.0 @@ -47,6 +48,7 @@ require ( golang.org/x/crypto v0.15.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 golang.org/x/sync v0.5.0 + google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb google.golang.org/grpc v1.59.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -90,7 +92,6 @@ require ( github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect - github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.0 // indirect @@ -285,7 +286,6 @@ require ( google.golang.org/api v0.143.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect diff --git a/tools/scripts/gci/main.go b/tools/scripts/gci/main.go index 1d8207bdc..5b30b3223 100644 --- a/tools/scripts/gci/main.go +++ b/tools/scripts/gci/main.go @@ -31,6 +31,12 @@ var ( } ) +// main is the entry point for the gci tool to format all files with the gci +// tool, according to the filters defined in the filters package. +// It will walk the entire repo and collect the files it is "allowed" to run +// gci on and then executes the gci command on them, splitting the import +// block into 3 groups: standard library, third party, and local, removing +// any isolated comments (those on their own line). func main() { root := "." var filesToProcess []string @@ -54,11 +60,18 @@ func main() { cmd := exec.Command("gci", append([]string{"write"}, args...)...) out, err := cmd.CombinedOutput() if err != nil { - fmt.Printf("Output: %s\nFailed running gci: %v\n", out, err) + fmt.Printf("%s\nFailed running gci: %v\n", out, err) } } } +// walkRepoRootFn defines a walk function that is supplied to filepath.Walk +// this essentially determines whether a given path should be added to the +// list of files to be processed, based on the include and exclude filters +// provided. filepath.Walk, recursively walks down the path it is provided +// according to the filepath.WalkFunc passed to it - in this case it simply +// adds files to format to the provided filesToProcess slice according to the +// filters provided and only skips if the path's directory starts with `.`. func walkRepoRootFn( rootPath string, includeFilters []filters.FilterFn, diff --git a/tools/scripts/gofumpt/main.go b/tools/scripts/gofumpt/main.go index 48a2df5ca..13b2cb08b 100644 --- a/tools/scripts/gofumpt/main.go +++ b/tools/scripts/gofumpt/main.go @@ -25,6 +25,11 @@ var ( } ) +// main is the entry point for the gofumpt tool to format all files in the repo +// according to the filters defined in the filters package. gofumpt is a more +// strict version of gofmt and formats files according to a stricter set of +// rules - the only flag passed is `-w` which tells the gofumpt to write changes +// in place, instead of writing the diff to stdout. func main() { root := "." var filesToProcess []string @@ -41,16 +46,23 @@ func main() { return } - // Run gci on all accumulated files - this writes changes in place + // Run gofumpt on all accumulated files - this writes changes in place if len(filesToProcess) > 0 { cmd := exec.Command("gofumpt", append(defaultArgs, filesToProcess...)...) out, err := cmd.CombinedOutput() if err != nil { - fmt.Printf("Output: %s\nFailed running gci: %v\n", out, err) + fmt.Printf("%s\nFailed running gofumpt: %v\n", out, err) } } } +// walkRepoRootFn defines a walk function that is supplied to filepath.Walk +// this essentially determines whether a given path should be added to the +// list of files to be processed, based on the include and exclude filters +// provided. filepath.Walk, recursively walks down the path it is provided +// according to the filepath.WalkFunc passed to it - in this case it simply +// adds files to format to the provided filesToProcess slice according to the +// filters provided and only skips if the path's directory starts with `.`. func walkRepoRootFn( rootPath string, includeFilters []filters.FilterFn, From a9493473b16943151e1f2dccab93874e61e46351 Mon Sep 17 00:00:00 2001 From: h5law Date: Thu, 18 Jan 2024 22:07:27 +0000 Subject: [PATCH 57/61] bug: fix check golangci-lint make target --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 68aae3218..ea424b62d 100644 --- a/Makefile +++ b/Makefile @@ -76,7 +76,7 @@ check_godoc: # Internal helper target - check if golangci-lint is installed check_golanci_lint: { \ - if ( ! ( command -v gci >/dev/null )); then \ + if ( ! ( command -v golangci-lint >/dev/null )); then \ echo "Seems like you don't have golanci-lint installed. Make sure you install it via 'go install github.com/golangci/golangci-lint/cmd/golangci-lint@latest' before continuing"; \ exit 1; \ fi; \ From f9f09231012ba37307aa727eac27f459c5393f74 Mon Sep 17 00:00:00 2001 From: h5law Date: Thu, 18 Jan 2024 22:07:43 +0000 Subject: [PATCH 58/61] chore: update comments --- tools/scripts/gci/filters/filters.go | 5 ++++- tools/scripts/gofumpt/filters/filters.go | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/tools/scripts/gci/filters/filters.go b/tools/scripts/gci/filters/filters.go index c5067f763..032113029 100644 --- a/tools/scripts/gci/filters/filters.go +++ b/tools/scripts/gci/filters/filters.go @@ -1,4 +1,5 @@ -// The filters package contains functions that can be used to filter file paths. +// The filters package contains functions that can be used to filter file paths +// in limiting the scope of which files the gci linter touches. package filters @@ -10,6 +11,8 @@ import ( "strings" ) +// igniteScaffoldComment is a a comment inserted by the ignite CLI that we want +// to maintain in the source code and ignore for linting purposes. const igniteScaffoldComment = "// this line is used by starport scaffolding" var ( diff --git a/tools/scripts/gofumpt/filters/filters.go b/tools/scripts/gofumpt/filters/filters.go index 51c85f75d..2e7671f15 100644 --- a/tools/scripts/gofumpt/filters/filters.go +++ b/tools/scripts/gofumpt/filters/filters.go @@ -1,4 +1,5 @@ -// The filters package contains functions that can be used to filter file paths. +// The filters package contains functions that can be used to filter file paths +// in limiting the scope of which files the gofumpt formatter touches. package filters @@ -10,6 +11,8 @@ import ( "strings" ) +// igniteScaffoldComment is a a comment inserted by the ignite CLI that we want +// to maintain in the source code and ignore for linting purposes. const igniteScaffoldComment = "// this line is used by starport scaffolding" var ( From 943669e0beaf011493273c773ee288d22684702f Mon Sep 17 00:00:00 2001 From: h5law Date: Thu, 18 Jan 2024 22:12:12 +0000 Subject: [PATCH 59/61] bug: fix golangci-lint Cannot open: File exists error by skipping cache --- .github/workflows/run-tests.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/run-tests.yml b/.github/workflows/run-tests.yml index f9e95b7b6..cabfbe833 100644 --- a/.github/workflows/run-tests.yml +++ b/.github/workflows/run-tests.yml @@ -61,6 +61,7 @@ jobs: version: latest only-new-issues: true args: --timeout 15m --issues-exit-code=1 + skip-cache: true - name: Test run: make go_test From ed4ebf1ad003ac7589a99f4688f03433a2d8165c Mon Sep 17 00:00:00 2001 From: h5law Date: Sat, 20 Jan 2024 03:55:31 +0000 Subject: [PATCH 60/61] feat: fix make go_lint --- .golangci.yml | 4 +--- go.mod | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.golangci.yml b/.golangci.yml index 54a4b7490..44f1dcace 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -4,11 +4,9 @@ run: new: true color: always build-tags: - - e2e - - test - integration + - test - tools - - ignore # TODO_TECHDEBT: Enable each linter listed, 1 by 1, fixing issues as they appear. linters: diff --git a/go.mod b/go.mod index 56ed2d4fc..9be97f1d6 100644 --- a/go.mod +++ b/go.mod @@ -24,7 +24,6 @@ require ( github.com/athanorlabs/go-dleq v0.1.0 github.com/cometbft/cometbft v0.37.2 github.com/cometbft/cometbft-db v0.8.0 - github.com/cosmos/cosmos-proto v1.0.0-beta.2 github.com/cosmos/cosmos-sdk v0.47.3 github.com/cosmos/gogoproto v1.4.11 github.com/cosmos/ibc-go/v7 v7.1.0 @@ -48,7 +47,6 @@ require ( golang.org/x/crypto v0.15.0 golang.org/x/exp v0.0.0-20230905200255-921286631fa9 golang.org/x/sync v0.5.0 - google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb google.golang.org/grpc v1.59.0 gopkg.in/yaml.v2 v2.4.0 ) @@ -92,6 +90,7 @@ require ( github.com/containerd/cgroups v1.1.0 // indirect github.com/coreos/go-systemd/v22 v22.5.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect + github.com/cosmos/cosmos-proto v1.0.0-beta.2 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect github.com/cosmos/iavl v0.20.0 // indirect @@ -286,6 +285,7 @@ require ( google.golang.org/api v0.143.0 // indirect google.golang.org/appengine v1.6.7 // indirect google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20230913181813-007df8e322eb // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 // indirect google.golang.org/protobuf v1.31.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect From 0ddd1c4ad74e8c562cdf89a996878514c8514b09 Mon Sep 17 00:00:00 2001 From: h5law Date: Sat, 20 Jan 2024 04:00:32 +0000 Subject: [PATCH 61/61] chore: final linting --- pkg/polylog/polyzero/logger_test.go | 1 - x/supplier/keeper/query_proof.go | 1 - x/supplier/keeper/query_proof_test.go | 2 +- 3 files changed, 1 insertion(+), 3 deletions(-) diff --git a/pkg/polylog/polyzero/logger_test.go b/pkg/polylog/polyzero/logger_test.go index 3f32493ac..c1511e435 100644 --- a/pkg/polylog/polyzero/logger_test.go +++ b/pkg/polylog/polyzero/logger_test.go @@ -38,7 +38,6 @@ var ( `"time":"%s`, expectedTime.Format(expectedTimestampDayPrecisionLayout), ) - expectedTimeEventContains = fmt.Sprintf(`"Time":"%s`, expectedTime.Format(expectedTimeLayout)) expectedDuration = time.Millisecond + (250 * time.Nanosecond) // 1000250 expectedDurationString = expectedDuration.String()[:len(expectedDuration.String())-2] // 1.00025 expectedDurationEventContains = fmt.Sprintf(`"Dur":%s`, expectedDurationString) diff --git a/x/supplier/keeper/query_proof.go b/x/supplier/keeper/query_proof.go index 03fcb2017..3e548c078 100644 --- a/x/supplier/keeper/query_proof.go +++ b/x/supplier/keeper/query_proof.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "fmt" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" diff --git a/x/supplier/keeper/query_proof_test.go b/x/supplier/keeper/query_proof_test.go index 787b23d68..4f37ca744 100644 --- a/x/supplier/keeper/query_proof_test.go +++ b/x/supplier/keeper/query_proof_test.go @@ -24,7 +24,7 @@ func TestProofQuerySingle(t *testing.T) { wctx := sdk.WrapSDKContext(ctx) proofs := createNProofs(keeper, ctx, 2) - var randSupplierAddr = sample.AccAddress() + randSupplierAddr := sample.AccAddress() tests := []struct { desc string request *types.QueryGetProofRequest