From 049f0d581cd2b0ca90fad996e21e2a6b8aae090e Mon Sep 17 00:00:00 2001 From: Daniel Wedul Date: Fri, 19 May 2023 11:03:33 -0600 Subject: [PATCH] Bump go to 1.20 and linter to v1.52.2 (#1550) * Update go version in docs and add a changelog entry. * Bump the go version in all the github workflows. * changelog tweak. * Update all the docker images to use 1.20-bullseye (from 1.18-bullseye). * Update go.mod to indicate go 1.20. * Add rust-rc1 and rust upgrade handlers (empty), and remove the paua and paua-rc2 upgrades. * Remove the deadcode and varcheck linters since they're giving a warning now: The owner seems to have abandoned the linter. Replaced by unused. * Bump golangci-lint to v1.52 for the lint github action. * Fix things the linter started complaining about when I bumped it. * Remove the docs/upgrade-1-8-summary.md document since it's no longer applicable. * Create some devtool make targets for installing/updating golangci-lint. * Add changelog entry about the linter. * Put quotes around the 1.20 in all the github workflows since it's getting read as just 1.2. * Put app/upgrades.go back to what it was since I'm doing the upgrade work in a different PR. --- .github/workflows/docker.yml | 2 +- .github/workflows/lint.yml | 6 +- .github/workflows/proto.yml | 2 +- .github/workflows/release.yml | 2 +- .github/workflows/rosetta.yml | 2 +- .github/workflows/sims.yml | 2 +- .github/workflows/test.yml | 2 +- CHANGELOG.md | 6 +- README.md | 2 +- app/app.go | 2 +- client/rosetta/rosetta-ci/Dockerfile | 2 +- cmd/dbmigrate/cmd/dbmigrate.go | 5 +- cmd/dbmigrate/utils/migrator.go | 5 +- cmd/provenanced/config/interceptor.go | 6 +- contrib/devtools/Makefile | 11 ++- docker/blockchain/Dockerfile | 2 +- docs/Building.md | 2 +- docs/upgrade-1-8-summary.md | 68 ------------------ go.mod | 2 +- internal/handlers/msg_fee_invoker.go | 2 +- .../handlers/staking_restrictions_hooks.go | 9 ++- internal/provwasm/simulation.go | 6 +- networks/dev/blockchain-dev/Dockerfile | 4 +- networks/ibc/blockchain-ibc/Dockerfile | 4 +- networks/ibc/blockchain-relayer/Dockerfile | 2 +- networks/local/blockchain-local/Dockerfile | 4 +- x/attribute/keeper/keeper.go | 5 +- x/attribute/keeper/query_server.go | 2 +- x/attribute/module.go | 12 ++-- x/attribute/simulation/operations.go | 2 +- x/attribute/simulation/params.go | 2 +- x/attribute/simulation/proposals.go | 2 +- x/attribute/wasm/encode.go | 2 +- x/marker/abci.go | 2 +- x/marker/keeper/marker.go | 71 ++++--------------- x/marker/keeper/query_server.go | 2 +- x/marker/module.go | 10 +-- x/marker/simulation/params.go | 2 +- x/marker/types/authz.go | 2 +- x/marker/types/marker.go | 4 +- x/marker/types/msg.go | 25 ++----- x/marker/wasm/encode.go | 2 +- x/metadata/keeper/params.go | 4 +- x/metadata/keeper/scope.go | 12 +--- x/metadata/keeper/session.go | 2 +- x/metadata/keeper/specification.go | 6 +- x/metadata/module.go | 18 ++--- x/metadata/types/scope.go | 5 +- x/metadata/wasm/encode.go | 2 +- x/msgfees/keeper/proposal_handler.go | 4 +- x/msgfees/keeper/query_server.go | 2 +- x/msgfees/module/module.go | 14 ++-- x/msgfees/simulation/params.go | 2 +- x/msgfees/wasm/encode.go | 4 +- x/name/keeper/keeper.go | 18 +---- x/name/keeper/query_server.go | 2 +- x/name/module.go | 12 ++-- x/name/simulation/params.go | 2 +- x/name/simulation/proposals.go | 2 +- x/name/types/keys.go | 5 +- x/name/wasm/encode.go | 4 +- x/reward/keeper/time_management.go | 2 +- x/reward/module/module.go | 12 ++-- x/reward/simulation/operations.go | 2 +- x/reward/types/action_builder.go | 2 +- x/reward/types/reward.go | 16 ++--- 66 files changed, 155 insertions(+), 308 deletions(-) delete mode 100644 docs/upgrade-1-8-summary.md diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a5f833e03e..535fd5f00f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -30,7 +30,7 @@ jobs: - name: Setup go uses: actions/setup-go@v4 with: - go-version: 1.18 + go-version: '1.20' - name: Go mod vendor run: | go mod vendor diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0a068ae800..e89c691c54 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -29,12 +29,12 @@ jobs: - uses: actions/setup-go@v4 if: env.GIT_DIFF with: - go-version: 1.18 + go-version: '1.20' - uses: golangci/golangci-lint-action@v3.4.0 if: env.GIT_DIFF with: - # Required: the version of golangci-lint is required and must be specified without patch version: we always use the latest patch version. - version: v1.48 + # If you change this version, be sure to also change it in contrib/devtools/Makefile. + version: v1.52.2 args: --timeout 10m --out-${NO_FUTURE}format colored-line-number github-token: ${{ secrets.github_token }} - name: No Now Usage diff --git a/.github/workflows/proto.yml b/.github/workflows/proto.yml index 57a23cbafe..560c537663 100644 --- a/.github/workflows/proto.yml +++ b/.github/workflows/proto.yml @@ -30,7 +30,7 @@ jobs: - name: Setup go uses: actions/setup-go@v4 with: - go-version: 1.18 + go-version: '1.20' - name: Setup Job id: setup run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 194218fd34..efce10103b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -55,7 +55,7 @@ jobs: version: ${{ steps.vars.outputs.version }} is_release: ${{ steps.vars.outputs.is_release }} prerelease: ${{ steps.vars.outputs.prerelease }} - go_version: 1.18 + go_version: '1.20' build_osx: runs-on: macos-latest diff --git a/.github/workflows/rosetta.yml b/.github/workflows/rosetta.yml index da6fc120a1..b688c8311f 100644 --- a/.github/workflows/rosetta.yml +++ b/.github/workflows/rosetta.yml @@ -32,7 +32,7 @@ jobs: - uses: actions/setup-go@v4 if: ${{ env.GIT_DIFF }} with: - go-version: 1.18 + go-version: '1.20' - name: Go mod vendor if: ${{ env.GIT_DIFF }} run: | diff --git a/.github/workflows/sims.yml b/.github/workflows/sims.yml index 0fef51b306..545261e5d3 100644 --- a/.github/workflows/sims.yml +++ b/.github/workflows/sims.yml @@ -48,7 +48,7 @@ jobs: echo "Setting output: go-cache-key-hash=$go_cache_key_hash" echo "go-cache-key-hash=$go_cache_key_hash" >> "$GITHUB_OUTPUT" outputs: - go-version: 1.18 + go-version: '1.20' should-run: ${{ env.GIT_DIFF }} file-prefix: ${{ steps.def-vars.outputs.file-prefix }} db-cache-key-suffix: sims-db3-${{ steps.def-vars.outputs.db-cache-key-hash }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 0b1879738b..c7caa12ce4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -70,7 +70,7 @@ jobs: path: ./pkgs.txt.part.03 outputs: should-run: ${{ env.GIT_DIFF }} - go-version: 1.18 + go-version: '1.20' file-prefix: ${{ steps.def-vars.outputs.file-prefix }} diff --git a/CHANGELOG.md b/CHANGELOG.md index 8eddc0fbb0..a81d012e9f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -44,6 +44,10 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### Improvements +* Bump go to `1.20` (from `1.18`) [#1539](https://github.com/provenance-io/provenance/issues/1539). +* Bump golangci-lint to `v1.52.2` (from `v1.48`) [#1539](https://github.com/provenance-io/provenance/issues/1539). + * New `make golangci-lint` target created for installing golangci-lint. + * New `make golangci-lint-update` target created for installing the current version even if you already have a version installed. * Add marker deposit access check for sends to marker escrow account [#1525](https://github.com/provenance-io/provenance/issues/1525). * Add support for `name` owner to execute `MsgModifyName` transaction [#1536](https://github.com/provenance-io/provenance/issues/1536). * Add usage of `AddGovPropFlagsToCmd` and `ReadGovPropFlags` cli for `GetModifyNameCmd` [#1542](https://github.com/provenance-io/provenance/issues/1542). @@ -53,7 +57,7 @@ Ref: https://keepachangelog.com/en/1.0.0/ ### API Breaking -* Add marker deposit access check for sends to marker escrow account. Will break any current address that is sending to the +* Add marker deposit access check for sends to marker escrow account. Will break any current address that is sending to the marker escrow account if it does not have deposit access. In order for it to work, deposit access needs to be added. This can be done using the `MsgAddAccessRequest` tx [#1525](https://github.com/provenance-io/provenance/issues/1525). * `MsgMultiSend` is now limited to a single `Input` [PR 1506](https://github.com/provenance-io/provenance/pull/1506). diff --git a/README.md b/README.md index f322a85ec3..db3f4360ea 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ is a useful starting point. Developers can use a local checkout and the make targets `make run` and `make localnet-start` to run a local development network. -Note: Requires [Go 1.18+](https://golang.org/dl/) +Note: Requires [Go 1.20+](https://golang.org/dl/) See Also: [Building](docs/Building.md) diff --git a/app/app.go b/app/app.go index 6fdc91c8df..7ae785311c 100644 --- a/app/app.go +++ b/app/app.go @@ -1054,7 +1054,7 @@ func (app *App) RegisterStreamingServices(appOpts servertypes.AppOptions) { } // RegisterSwaggerAPI registers swagger route with API Server -func RegisterSwaggerAPI(ctx client.Context, rtr *mux.Router) { +func RegisterSwaggerAPI(_ client.Context, rtr *mux.Router) { statikFS, err := fs.New() if err != nil { panic(err) diff --git a/client/rosetta/rosetta-ci/Dockerfile b/client/rosetta/rosetta-ci/Dockerfile index eabd6ec1d8..96d739f247 100644 --- a/client/rosetta/rosetta-ci/Dockerfile +++ b/client/rosetta/rosetta-ci/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.18-bullseye as build +FROM golang:1.20-bullseye as build ARG VERSION WORKDIR /go/src/github.com/provenance-io/provenance diff --git a/cmd/dbmigrate/cmd/dbmigrate.go b/cmd/dbmigrate/cmd/dbmigrate.go index 8fd675ad8f..ef05b38f5e 100644 --- a/cmd/dbmigrate/cmd/dbmigrate.go +++ b/cmd/dbmigrate/cmd/dbmigrate.go @@ -88,11 +88,8 @@ Migration process: if err := client.SetCmdClientContext(command, clientCtx); err != nil { return err } - if err := config.InterceptConfigsPreRunHandler(command); err != nil { - return err - } - return nil + return config.InterceptConfigsPreRunHandler(command) }, RunE: func(command *cobra.Command, args []string) error { batchSizeMB, err := command.Flags().GetUint(FlagBatchSize) diff --git a/cmd/dbmigrate/utils/migrator.go b/cmd/dbmigrate/utils/migrator.go index f0af473cba..76eda9656b 100644 --- a/cmd/dbmigrate/utils/migrator.go +++ b/cmd/dbmigrate/utils/migrator.go @@ -162,10 +162,7 @@ func (m *Migrator) Initialize() error { if err = m.ValidateBasic(); err != nil { return err } - if err = m.ReadSourceDataDir(); err != nil { - return err - } - return nil + return m.ReadSourceDataDir() } // ApplyDefaults fills in the defaults that it can, for values that aren't set yet. diff --git a/cmd/provenanced/config/interceptor.go b/cmd/provenanced/config/interceptor.go index 07e718feae..620b97c440 100644 --- a/cmd/provenanced/config/interceptor.go +++ b/cmd/provenanced/config/interceptor.go @@ -39,11 +39,7 @@ func InterceptConfigsPreRunHandler(cmd *cobra.Command) error { } // Read the configs into viper and the contexts. - if err := LoadConfigFromFiles(cmd); err != nil { - return err - } - - return nil + return LoadConfigFromFiles(cmd) } // Binds viper flags using the PIO ENV prefix. diff --git a/contrib/devtools/Makefile b/contrib/devtools/Makefile index a9179c90ab..abda36b73b 100644 --- a/contrib/devtools/Makefile +++ b/contrib/devtools/Makefile @@ -89,4 +89,13 @@ tools-clean: rm -f $(STATIK) $(GOLANGCI_LINT) $(RUNSIM) rm -f proto-tools-stamp tools-stamp -.PHONY: tools-clean statik runsim +# If you change this version, be sure to also change it in .github/workflows/lint.yml. +GOLANGCI_LINT_VERSION = v1.52.2 +golangci-lint: $(GOLANGCI_LINT) +$(GOLANGCI_LINT): + @$(MAKE) golangci-lint-update +golangci-lint-update: + @echo "Installing golangci-lint $(GOLANGCI_LINT_VERSION) ..." + curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(TOOLS_DESTDIR) $(GOLANGCI_LINT_VERSION) + +.PHONY: tools-clean statik runsim golangci-lint golangci-lint-update \ No newline at end of file diff --git a/docker/blockchain/Dockerfile b/docker/blockchain/Dockerfile index 65d232df1a..6fa632a18d 100644 --- a/docker/blockchain/Dockerfile +++ b/docker/blockchain/Dockerfile @@ -1,4 +1,4 @@ -FROM golang:1.18-bullseye as build +FROM golang:1.20-bullseye as build ARG VERSION ARG ARCH=x86_64 diff --git a/docs/Building.md b/docs/Building.md index 75b7807a0a..e031ae5ec8 100644 --- a/docs/Building.md +++ b/docs/Building.md @@ -21,7 +21,7 @@ Built executables are placed in the `build/` directory. ### Go -Building `provenanced` requires [Go 1.18+](https://golang.org/dl/) (or higher). +Building `provenanced` requires [Go 1.20+](https://golang.org/dl/) (or higher). ### CLevelDB diff --git a/docs/upgrade-1-8-summary.md b/docs/upgrade-1-8-summary.md deleted file mode 100644 index 10bc685c7b..0000000000 --- a/docs/upgrade-1-8-summary.md +++ /dev/null @@ -1,68 +0,0 @@ - -### Summary - -Provenance 1.8.0 is focused on improving the fee structures for transactions on the blockchain. While the Cosmos SDK has traditionally offered a generic fee structure focused on gas/resource utilization, the Provenance blockchain has found that certain transactions have additional long term costs and value beyond simple resources charges. This is the reason we are adding the new MsgFee module which allows governance based control of additional fee charges on certain message types. - -NOTE: The second major change in the 1.8.0 release is part of the migration process which removes many orphaned state objects that were left in 1.7.x chains. This cleanup process will require a significant amount of time to perform during the `green` upgrade handler execution. The upgrade will print status messages showing the progress of this process. - - - -# Performing the 1.8.0 Upgrade (blockheight 4808400) - -The `1.8.0` upgrade process will begin with the current 1.7.x binary halting at the assigned upgrade height (4808400). The log will print "UPGRADE NEEDED". - -1. Terminate the existing 1.7.x process after the upgrade height is reached. -2. Create a backup of your local data directory. This will allow you to quickly reset to the state prior to the upgrade changes in the event that the upgrade fails and the network needs to 'skip the upgrade' for some reason. -3. Copy the new `1.8.0` binary and lib wasm shared library into your provenance home folder. It can be helpful to name your binaries with the version associated with them (`provenanced-1.8.0` for example). - NOTE: the libwasmvm.so share object library must match the version of the provenance binary used. If you do not match these versions correctly your node will halt with an APP-HASH-MISMATCH error as soon as it receives a smart contract request. -4. Ensure your `wasm/cache` folder has been cleared out. `data/wasm/wasm/cache`. These cache files are not compatible between software versions. -5. If you are using a log level of `error` then it would be a good time to switch to `info` for this upgrade. The `--log_level=info` can be appended to your start command to temporarily change this setting. Start the 1.8.0 provenanced binary. The upgrade should begin shortly after it starts. There will be various errors printed due to peering issues during the upgrade ... this is normal and not something to worry about. -6. The upgrade may take 30 minutes or so depending on your hardware. The following set of INFO level log messages are expected. NOTE: The actual counts will vary slightly depending on the number of new database entries created in the last couple days between when this test was ran and the upgrade height. -``` -3:36PM INF Updated governance module minimum deposit from 1000000000000nhash to 50000000000000nhash -3:36PM INF Updated attribute module max length value from 10000 to 1000 -3:36PM INF NOTICE: Starting migrations. This may take a significant amount of time to complete. Do not restart node. -3:36PM INF Migrating Metadata Module from Version 2 to 3 -3:36PM INF Metadata step 1 of 7: Deleting bad indexes and getting good -3:38PM INF Prefix 17: Done. Deleted 104354 entries, found 202006 good entries. -3:38PM INF Prefix 18: Identifying good entries and deleting bad ones. -3:39PM INF Prefix 18: Done. Deleted 52808 entries, found 101714 good entries. -3:39PM INF Prefix 19: Identifying good entries and deleting bad ones. -3:39PM INF Prefix 19: Done. Deleted 4 entries, found 6 good entries. -3:39PM INF Prefix 20: Identifying good entries and deleting bad ones. -3:39PM INF Prefix 20: Done. Deleted 2607 entries, found 3173 good entries. -3:39PM INF Done identifying good indexes and deleting bad ones. -3:39PM INF Metadata step 2 of 7: Reindexing scopes -3:40PM INF Done reindexing 10449 scopes. All 112164 are now indexed. -3:40PM INF Metadata step 3 of 7: Reindexing scope specs -3:40PM INF Done reindexing 0 scope specs. All 6 are now indexed. -3:40PM INF Metadata step 4 of 7: Reindexing contract specs -3:40PM INF Done reindexing 2607 contract specs. All 5780 are now indexed. -3:40PM INF Metadata step 5 of 7: Identifying sessions to keep -3:48PM INF Done identifying a total of 237678 session ids used by 1171973 records. -3:48PM INF Metadata step 6 of 7: Finding empty sessions -3:55PM INF Done deleting 640843 empty sessions. -3:55PM INF Finished Migrating Metadata Module from Version 2 to 3 -3:55PM INF Adding a 10 hash (10,000,000,000 nhash) msg fee to MsgBindNameRequest (1/6) -3:55PM INF Adding a 100 hash (100,000,000,000 nhash) msg fee to MsgAddMarkerRequest (2/6) -3:55PM INF Adding a 10 hash (10,000,000,000 nhash) msg fee to MsgAddAttributeRequest (3/6) -3:55PM INF Adding a 10 hash (10,000,000,000 nhash) msg fee to MsgWriteScopeRequest (4/6) -3:55PM INF Adding a 10 hash (10,000,000,000 nhash) msg fee to MsgP8EMemorializeContractRequest (5/6) -3:55PM INF Adding a 100 hash (100,000,000,000 nhash) msg fee to MsgSubmitProposal (6/6) -3:55PM INF Successfully upgraded to: green with version map: map[attribute:2 auth:2 authz:1 bank:2 capability:1 crisis:1 distribution:2 evidence:1 feegrant:1 genutil:1 gov:2 ibc:2 marker:2 metadata:3 mint:1 msgfees:1 name:2 params:1 slashing:2 staking:2 transfer:1 upgrade:1 vesting:1 wasm:1] -``` -7. When the upgrade has finished your node will wait for other peers and the validators to complete the upgrade as well. The active voting power must reach the 2/3 majority threshold for the network to continue. - - -# What to do if something goes wrong - -First off, make sure you have contacted the other network participants on the Provenance discord server. https://discord.gg/HszDgS6R - -The network can proceed one of two ways, ideally the majority of nodes are able to execute the 1.8.0 migration and the network continues on 1.8.0. If your node fails to complete these steps a quicksync file could be used to skip over the upgrade process using someone else's completed data files. - -## Skipping the Upgrade -If the upgrade is broken and fails completely a decision may be made to skip the upgrade entirely. If this happens there will be a bunch of discussion and announcements on the discord channel for it. In this case you would use the backup file taken before the upgrade, the previous `1.7.x` binary/wasm vm dll along with the `--unsafe-skip-upgrades 4808400` flag. This option will only work if everyone is using this same flag... if you attempt this independently it will cause your node to compute an incorrect app hash resulting in a corrupted data directory that you must restore from backup. - -## Worst Case Recovery -And the absolute worst case scenario would be a network that proceeds few blocks post upgrade then halts due to some undiscovered issue. While we have extensively tested this release (including 10 different successful executions of the upgrade on testnet as well as isolated tests against mainnet data) it is possible that a bug exists that halts the network. If this happens the only fix will be an emergency software release with patches to address the issue which everyone will need to install and use. If this situation occurs there will be extensive coordination via the Discord channels. The network would likely be halted for a number of hours prior to being able to attempt to restart it. - diff --git a/go.mod b/go.mod index 7b2a1d29df..cb1ce105f8 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/provenance-io/provenance -go 1.18 +go 1.20 require ( cosmossdk.io/errors v1.0.0-beta.7 diff --git a/internal/handlers/msg_fee_invoker.go b/internal/handlers/msg_fee_invoker.go index 58e9c36561..778e3b0bb3 100644 --- a/internal/handlers/msg_fee_invoker.go +++ b/internal/handlers/msg_fee_invoker.go @@ -31,7 +31,7 @@ func NewMsgFeeInvoker(bankKeeper bankkeeper.Keeper, accountKeeper msgfeestypes.A } } -func (afd MsgFeeInvoker) Invoke(ctx sdk.Context, simulate bool) (sdk.Coins, sdk.Events, error) { +func (afd MsgFeeInvoker) Invoke(ctx sdk.Context, _ bool) (sdk.Coins, sdk.Events, error) { chargedFees := sdk.Coins{} eventsToReturn := sdk.Events{} diff --git a/internal/handlers/staking_restrictions_hooks.go b/internal/handlers/staking_restrictions_hooks.go index 38c3bf3462..1f6156499a 100644 --- a/internal/handlers/staking_restrictions_hooks.go +++ b/internal/handlers/staking_restrictions_hooks.go @@ -55,7 +55,7 @@ func NewStakingRestrictionHooks(k *stakingkeeper.Keeper, opts RestrictionOptions } // Verifies that the delegation would not cause the validator's voting power to exceed our staking distribution limits -func (h StakingRestrictionHooks) AfterDelegationModified(ctx sdktypes.Context, delAddr sdktypes.AccAddress, valAddr sdktypes.ValAddress) error { +func (h StakingRestrictionHooks) AfterDelegationModified(ctx sdktypes.Context, _ sdktypes.AccAddress, valAddr sdktypes.ValAddress) error { valCount := len(h.k.GetLastValidators(ctx)) // do not bother with limits on networks this small (or under simulation). @@ -82,8 +82,7 @@ func (h StakingRestrictionHooks) AfterDelegationModified(ctx sdktypes.Context, d // if the power of this validator is increasing and it is over the maximum bonded token amount then we error out this transaction. if power > oldPower && validator.GetBondedTokens().GT(maxBond) { - return sdkerrors.Wrapf( - sdkerrors.ErrInvalidRequest, + return sdkerrors.ErrInvalidRequest.Wrapf( "validator bonded tokens of %d exceeds max of %d (%.1f%%) for %d validators", currentBond.BigInt(), maxBond.BigInt(), @@ -97,7 +96,7 @@ func (h StakingRestrictionHooks) AfterDelegationModified(ctx sdktypes.Context, d } // Implements sdktypes.ValidatorHooks -func (h StakingRestrictionHooks) BeforeDelegationCreated(ctx sdktypes.Context, _ sdktypes.AccAddress, _ sdktypes.ValAddress) error { +func (h StakingRestrictionHooks) BeforeDelegationCreated(_ sdktypes.Context, _ sdktypes.AccAddress, _ sdktypes.ValAddress) error { return nil } @@ -112,7 +111,7 @@ func (h StakingRestrictionHooks) AfterValidatorRemoved(_ sdktypes.Context, _ sdk } // Implements sdktypes.ValidatorHooks -func (h StakingRestrictionHooks) AfterValidatorCreated(_ sdktypes.Context, valAddr sdktypes.ValAddress) error { +func (h StakingRestrictionHooks) AfterValidatorCreated(_ sdktypes.Context, _ sdktypes.ValAddress) error { return nil } diff --git a/internal/provwasm/simulation.go b/internal/provwasm/simulation.go index a7683b75ed..250715a028 100644 --- a/internal/provwasm/simulation.go +++ b/internal/provwasm/simulation.go @@ -86,7 +86,7 @@ func (pw Wrapper) ProposalContents(simState module.SimulationState) []simtypes.W } // RandomizedParams returns empty list as the params don't change -func (pw Wrapper) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { +func (pw Wrapper) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{} } @@ -96,7 +96,7 @@ func (pw Wrapper) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { } // WeightedOperations returns the all the provwasm operations with their respective weights. -func (pw Wrapper) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (pw Wrapper) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { count := 0 return []simtypes.WeightedOperation{ simulation.NewWeightedOperation( @@ -338,7 +338,7 @@ func SimulateMsgInstantiateContract(ak authkeeper.AccountKeeperI, bk bankkeeper. } } -func SimulateMsgExecuteContract(ak authkeeper.AccountKeeperI, bk bankkeeper.ViewKeeper, node, consumer simtypes.Account, contractAddr string) simtypes.Operation { +func SimulateMsgExecuteContract(ak authkeeper.AccountKeeperI, bk bankkeeper.ViewKeeper, _, consumer simtypes.Account, contractAddr string) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { diff --git a/networks/dev/blockchain-dev/Dockerfile b/networks/dev/blockchain-dev/Dockerfile index 3e1e9aff7b..b004efbd68 100644 --- a/networks/dev/blockchain-dev/Dockerfile +++ b/networks/dev/blockchain-dev/Dockerfile @@ -2,7 +2,7 @@ # Use `make docker-build-dev` to build or `make devnet-start` to # start the test network and `make devnet-stop` to stop it. -FROM golang:1.18-bullseye as build-x86_64 +FROM golang:1.20-bullseye as build-x86_64 WORKDIR /go/src/github.com/provenance-io/provenance ENV GOPRIVATE=github.com/provenance-io RUN apt-get update && apt-get upgrade -y @@ -48,7 +48,7 @@ CMD ["start"] ## Build provenance for ARM -FROM golang:1.18-bullseye as build-arm64 +FROM golang:1.20-bullseye as build-arm64 WORKDIR /go/src/github.com/provenance-io/provenance ENV GOPRIVATE=github.com/provenance-io RUN apt-get update && apt-get upgrade -y diff --git a/networks/ibc/blockchain-ibc/Dockerfile b/networks/ibc/blockchain-ibc/Dockerfile index 71ec92e76e..9d6d166764 100644 --- a/networks/ibc/blockchain-ibc/Dockerfile +++ b/networks/ibc/blockchain-ibc/Dockerfile @@ -3,7 +3,7 @@ # start the test network and `make localnet-stop` to stop it. ## Build provenance for x86_64 -FROM golang:1.18-bullseye as build-x86_64 +FROM golang:1.20-bullseye as build-x86_64 WORKDIR /go/src/github.com/provenance-io/provenance ENV GOPRIVATE=github.com/provenance-io RUN apt-get update && apt-get upgrade -y @@ -52,7 +52,7 @@ CMD ["start"] ## Build provenance for ARM -FROM golang:1.18-bullseye as build-arm64 +FROM golang:1.20-bullseye as build-arm64 WORKDIR /go/src/github.com/provenance-io/provenance ENV GOPRIVATE=github.com/provenance-io RUN apt-get update && apt-get upgrade -y diff --git a/networks/ibc/blockchain-relayer/Dockerfile b/networks/ibc/blockchain-relayer/Dockerfile index b7d7642967..3adc6bc278 100644 --- a/networks/ibc/blockchain-relayer/Dockerfile +++ b/networks/ibc/blockchain-relayer/Dockerfile @@ -1,5 +1,5 @@ ## Build provenance for ARM -FROM golang:1.18-bullseye as build +FROM golang:1.20-bullseye as build WORKDIR / ARG VERSION RUN apt-get update && apt-get upgrade -y && apt-get install -y git diff --git a/networks/local/blockchain-local/Dockerfile b/networks/local/blockchain-local/Dockerfile index ba4c5104f8..fa5e9cdae6 100644 --- a/networks/local/blockchain-local/Dockerfile +++ b/networks/local/blockchain-local/Dockerfile @@ -3,7 +3,7 @@ # start the test network and `make localnet-stop` to stop it. ## Build provenance for x86_64 -FROM golang:1.18-bullseye as build-x86_64 +FROM golang:1.20-bullseye as build-x86_64 WORKDIR /go/src/github.com/provenance-io/provenance ENV GOPRIVATE=github.com/provenance-io RUN apt-get update && apt-get upgrade -y @@ -52,7 +52,7 @@ CMD ["start"] ## Build provenance for ARM -FROM golang:1.18-bullseye as build-arm64 +FROM golang:1.20-bullseye as build-arm64 WORKDIR /go/src/github.com/provenance-io/provenance ENV GOPRIVATE=github.com/provenance-io RUN apt-get update && apt-get upgrade -y diff --git a/x/attribute/keeper/keeper.go b/x/attribute/keeper/keeper.go index 0e37586a7a..aec773278a 100644 --- a/x/attribute/keeper/keeper.go +++ b/x/attribute/keeper/keeper.go @@ -165,11 +165,8 @@ func (k Keeper) SetAttribute( k.IncAttrNameAddressLookup(ctx, attr.Name, attr.GetAddressBytes()) attributeAddEvent := types.NewEventAttributeAdd(attr, owner.String()) - if err := ctx.EventManager().EmitTypedEvent(attributeAddEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(attributeAddEvent) } // IncAttrNameAddressLookup increments the count of name to address lookups diff --git a/x/attribute/keeper/query_server.go b/x/attribute/keeper/query_server.go index ce1084449b..530b16fcc4 100644 --- a/x/attribute/keeper/query_server.go +++ b/x/attribute/keeper/query_server.go @@ -18,7 +18,7 @@ import ( var _ types.QueryServer = Keeper{} // Params queries params of attribute module -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) var params types.Params k.paramSpace.GetParamSet(ctx, ¶ms) diff --git a/x/attribute/module.go b/x/attribute/module.go index 172a43f84d..aa99676f0c 100644 --- a/x/attribute/module.go +++ b/x/attribute/module.go @@ -44,7 +44,7 @@ func (AppModuleBasic) Name() string { } // RegisterLegacyAminoCodec registers the attribute module's types for the given codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { } // DefaultGenesis returns the default genesis state. @@ -53,7 +53,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the attribute module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -115,7 +115,7 @@ func (AppModule) Name() string { } // RegisterInvariants does nothing. -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // Route returns the message routing key for the attribute module. func (am AppModule) Route() sdk.Route { @@ -128,7 +128,7 @@ func (am AppModule) QuerierRoute() string { } // LegacyQuerierHandler returns no sdk.Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -153,7 +153,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock returns the begin blocker for the attribute module. -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // EndBlock returns the end blocker for the attribute module. It returns no validator // updates. @@ -172,7 +172,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { // ProposalContents returns all the attribute content functions used to // simulate attribute governance proposals. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return simulation.ProposalContents(am.keeper) } diff --git a/x/attribute/simulation/operations.go b/x/attribute/simulation/operations.go index 952ec9d90d..04638afe36 100644 --- a/x/attribute/simulation/operations.go +++ b/x/attribute/simulation/operations.go @@ -90,7 +90,7 @@ func WeightedOperations( } // SimulateMsgAddAttribute will add an attribute under an account with a random type. -func SimulateMsgAddAttribute(k keeper.Keeper, ak authkeeper.AccountKeeperI, bk bankkeeper.ViewKeeper, nk namekeeper.Keeper) simtypes.Operation { +func SimulateMsgAddAttribute(_ keeper.Keeper, ak authkeeper.AccountKeeperI, bk bankkeeper.ViewKeeper, nk namekeeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { diff --git a/x/attribute/simulation/params.go b/x/attribute/simulation/params.go index 82da797316..7b2d502eb4 100644 --- a/x/attribute/simulation/params.go +++ b/x/attribute/simulation/params.go @@ -18,7 +18,7 @@ const ( // ParamChanges defines the parameters that can be modified by param change proposals // on the simulation -func ParamChanges(r *rand.Rand) []simtypes.ParamChange { +func ParamChanges(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{ simulation.NewSimParamChange(types.ModuleName, keyMaxValueLength, func(r *rand.Rand) string { diff --git a/x/attribute/simulation/proposals.go b/x/attribute/simulation/proposals.go index ec3b4386ef..e7f68ad0e7 100644 --- a/x/attribute/simulation/proposals.go +++ b/x/attribute/simulation/proposals.go @@ -7,6 +7,6 @@ import ( ) // ProposalContents defines the module weighted proposals' contents (none for attribute) -func ProposalContents(k keeper.Keeper) []simtypes.WeightedProposalContent { +func ProposalContents(_ keeper.Keeper) []simtypes.WeightedProposalContent { return []simtypes.WeightedProposalContent{} } diff --git a/x/attribute/wasm/encode.go b/x/attribute/wasm/encode.go index 57a383f47f..263dc6d650 100644 --- a/x/attribute/wasm/encode.go +++ b/x/attribute/wasm/encode.go @@ -74,7 +74,7 @@ type UpdateAttributeParams struct { } // Encoder returns a smart contract message encoder for the attribute module. -func Encoder(contract sdk.AccAddress, msg json.RawMessage, version string) ([]sdk.Msg, error) { +func Encoder(contract sdk.AccAddress, msg json.RawMessage, _ string) ([]sdk.Msg, error) { wrapper := struct { Params *AttributeMsgParams `json:"attribute"` }{} diff --git a/x/marker/abci.go b/x/marker/abci.go index 5fde3b5b31..789ab31fb7 100644 --- a/x/marker/abci.go +++ b/x/marker/abci.go @@ -15,7 +15,7 @@ import ( ) // BeginBlocker returns the begin blocker for the marker module. -func BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock, k keeper.Keeper, bk bankkeeper.Keeper) { +func BeginBlocker(ctx sdk.Context, _ abci.RequestBeginBlock, k keeper.Keeper, bk bankkeeper.Keeper) { defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyBeginBlocker) // Iterate through all marker accounts and check for supply above or below expected targets. var err error diff --git a/x/marker/keeper/marker.go b/x/marker/keeper/marker.go index 2da629819c..529da1890d 100644 --- a/x/marker/keeper/marker.go +++ b/x/marker/keeper/marker.go @@ -93,11 +93,8 @@ func (k Keeper) AddMarkerAccount(ctx sdk.Context, marker types.MarkerAccountI) e marker.GetManager().String(), marker.GetMarkerType().String(), ) - if err := ctx.EventManager().EmitTypedEvent(markerAddEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerAddEvent) } // AddAccess adds the provided AccessGrant to the marker of the caller is allowed to make changes @@ -140,11 +137,8 @@ func (k Keeper) AddAccess( } markerAddAccessEvent := types.NewEventMarkerAddAccess(grant, denom, caller.String()) - if err := ctx.EventManager().EmitTypedEvent(markerAddAccessEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerAddAccessEvent) } // RemoveAccess delete the AccessGrant for the specified user from the marker if the caller is allowed to make changes @@ -185,11 +179,8 @@ func (k Keeper) RemoveAccess(ctx sdk.Context, caller sdk.AccAddress, denom strin } markerDeleteAccessEvent := types.NewEventMarkerDeleteAccess(remove.String(), denom, caller.String()) - if err := ctx.EventManager().EmitTypedEvent(markerDeleteAccessEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerDeleteAccessEvent) } // WithdrawCoins removes the specified coins from the MarkerAccount (both marker denominated coins and coins as assets @@ -223,11 +214,8 @@ func (k Keeper) WithdrawCoins( } markerWithdrawEvent := types.NewEventMarkerWithdraw(coins.String(), denom, caller.String(), recipient.String()) - if err := ctx.EventManager().EmitTypedEvent(markerWithdrawEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerWithdrawEvent) } // MintCoin increases the Supply of a coin by interacting with the supply keeper for the adjustment, @@ -268,11 +256,8 @@ func (k Keeper) MintCoin(ctx sdk.Context, caller sdk.AccAddress, coin sdk.Coin) } markerMintEvent := types.NewEventMarkerMint(coin.Amount.String(), coin.Denom, caller.String()) - if err := ctx.EventManager().EmitTypedEvent(markerMintEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerMintEvent) } // BurnCoin removes supply from the marker by burning coins held within the marker acccount. @@ -310,11 +295,8 @@ func (k Keeper) BurnCoin(ctx sdk.Context, caller sdk.AccAddress, coin sdk.Coin) } markerBurnEvent := types.NewEventMarkerBurn(coin.Amount.String(), coin.Denom, caller.String()) - if err := ctx.EventManager().EmitTypedEvent(markerBurnEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerBurnEvent) } // Returns the current supply in network according to the bank module for the given marker @@ -477,11 +459,8 @@ func (k Keeper) FinalizeMarker(ctx sdk.Context, caller sdk.Address, denom string // record status as finalized. markerFinalizeEvent := types.NewEventMarkerFinalize(denom, caller.String()) - if err := ctx.EventManager().EmitTypedEvent(markerFinalizeEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerFinalizeEvent) } // ActivateMarker transitions a marker into the active status, enforcing permissions, supply constraints, and minting @@ -532,11 +511,8 @@ func (k Keeper) ActivateMarker(ctx sdk.Context, caller sdk.Address, denom string k.SetMarker(ctx, m) markerActivateEvent := types.NewEventMarkerActivate(denom, caller.String()) - if err := ctx.EventManager().EmitTypedEvent(markerActivateEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerActivateEvent) } // CancelMarker prepares transition to deleted state. @@ -582,11 +558,8 @@ func (k Keeper) CancelMarker(ctx sdk.Context, caller sdk.AccAddress, denom strin k.SetMarker(ctx, m) markerCancelEvent := types.NewEventMarkerCancel(denom, caller.String()) - if err := ctx.EventManager().EmitTypedEvent(markerCancelEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerCancelEvent) } // DeleteMarker burns the entire coin supply, ensure no assets are pooled, and marks the current instance of the @@ -643,11 +616,8 @@ func (k Keeper) DeleteMarker(ctx sdk.Context, caller sdk.AccAddress, denom strin k.SetMarker(ctx, m) markerDeleteEvent := types.NewEventMarkerDelete(denom, caller.String()) - if err := ctx.EventManager().EmitTypedEvent(markerDeleteEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerDeleteEvent) } // TransferCoin transfers restricted coins between to accounts when the administrator account holds the transfer @@ -687,11 +657,8 @@ func (k Keeper) TransferCoin(ctx sdk.Context, from, to, admin sdk.AccAddress, am to.String(), from.String(), ) - if err := ctx.EventManager().EmitTypedEvent(markerTransferEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerTransferEvent) } // IbcTransferCoin transfers restricted coins between two chains when the administrator account holds the transfer @@ -760,11 +727,8 @@ func (k Keeper) IbcTransferCoin( admin.String(), sender.String(), ) - if err := ctx.EventManager().EmitTypedEvent(markerIbcTransferEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerIbcTransferEvent) } func (k Keeper) authzHandler(ctx sdk.Context, admin, from, to sdk.AccAddress, amount sdk.Coin) error { @@ -818,11 +782,8 @@ func (k Keeper) SetMarkerDenomMetadata(ctx sdk.Context, metadata banktypes.Metad metadata, caller.String(), ) - if err := ctx.EventManager().EmitTypedEvent(markerSetDenomMetaEvent); err != nil { - return err - } - return nil + return ctx.EventManager().EmitTypedEvent(markerSetDenomMetaEvent) } // AddFinalizeAndActivateMarker adds marker, finalizes, and then activates it @@ -838,11 +799,7 @@ func (k Keeper) AddFinalizeAndActivateMarker(ctx sdk.Context, marker types.Marke return err } - err = k.ActivateMarker(ctx, marker.GetManager(), marker.GetDenom()) - if err != nil { - return err - } - return nil + return k.ActivateMarker(ctx, marker.GetManager(), marker.GetDenom()) } // accountControlsAllSupply return true if the caller account address possess 100% of the total supply of a marker. diff --git a/x/marker/keeper/query_server.go b/x/marker/keeper/query_server.go index 6d10f6d88f..965d480fde 100644 --- a/x/marker/keeper/query_server.go +++ b/x/marker/keeper/query_server.go @@ -18,7 +18,7 @@ import ( var _ types.QueryServer = Keeper{} // Params queries params of distribution module -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) var params types.Params k.paramSpace.GetParamSet(ctx, ¶ms) diff --git a/x/marker/module.go b/x/marker/module.go index 9990f92a3d..c688afc9cf 100644 --- a/x/marker/module.go +++ b/x/marker/module.go @@ -42,7 +42,7 @@ type AppModuleBasic struct { func (AppModuleBasic) Name() string { return types.ModuleName } // RegisterLegacyAminoCodec registers the account module's types for the given codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { } // DefaultGenesis returns the default genesis state. @@ -51,7 +51,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the marker module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -136,7 +136,7 @@ func (am AppModule) QuerierRoute() string { } // LegacyQuerierHandler returns no sdk.Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -182,7 +182,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { // ProposalContents returns all the marker content functions used to // simulate marker governance proposals. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return simulation.ProposalContents(am.keeper) } @@ -192,7 +192,7 @@ func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { } // RegisterStoreDecoder registers a decoder for marker module's types -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { // sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) } diff --git a/x/marker/simulation/params.go b/x/marker/simulation/params.go index cef1a6d207..7ce733b542 100644 --- a/x/marker/simulation/params.go +++ b/x/marker/simulation/params.go @@ -20,7 +20,7 @@ const ( // ParamChanges defines the parameters that can be modified by param change proposals // on the simulation -func ParamChanges(r *rand.Rand) []simtypes.ParamChange { +func ParamChanges(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{ simulation.NewSimParamChange(types.ModuleName, keyMaxTotalSupply, func(r *rand.Rand) string { diff --git a/x/marker/types/authz.go b/x/marker/types/authz.go index c69969ed86..17081c7365 100644 --- a/x/marker/types/authz.go +++ b/x/marker/types/authz.go @@ -25,7 +25,7 @@ func (a MarkerTransferAuthorization) MsgTypeURL() string { } // Accept implements Authorization.Accept. -func (a MarkerTransferAuthorization) Accept(ctx sdk.Context, msg sdk.Msg) (authz.AcceptResponse, error) { +func (a MarkerTransferAuthorization) Accept(_ sdk.Context, msg sdk.Msg) (authz.AcceptResponse, error) { switch msg := msg.(type) { case *MsgTransferRequest: toAddress := msg.ToAddress diff --git a/x/marker/types/marker.go b/x/marker/types/marker.go index a3852e9f05..0aea041a49 100644 --- a/x/marker/types/marker.go +++ b/x/marker/types/marker.go @@ -270,12 +270,12 @@ func (ma MarkerAccount) GetPubKey() cryptotypes.PubKey { } // SetPubKey implements authtypes.Account (but there are no public keys associated with the account for signing) -func (ma *MarkerAccount) SetPubKey(pubKey cryptotypes.PubKey) error { +func (ma *MarkerAccount) SetPubKey(_ cryptotypes.PubKey) error { return fmt.Errorf("not supported for marker accounts") } // SetSequence implements authtypes.Account (but you can't set a sequence as you can't sign tx for this account) -func (ma *MarkerAccount) SetSequence(seq uint64) error { +func (ma *MarkerAccount) SetSequence(_ uint64) error { return fmt.Errorf("not supported for marker accounts") } diff --git a/x/marker/types/msg.go b/x/marker/types/msg.go index c793cfc31b..9a52b0344a 100644 --- a/x/marker/types/msg.go +++ b/x/marker/types/msg.go @@ -121,10 +121,7 @@ func (msg MsgAddAccessRequest) ValidateBasic() error { if err := sdk.ValidateDenom(msg.Denom); err != nil { return err } - if err := ValidateGrants(msg.Access...); err != nil { - return err - } - return nil + return ValidateGrants(msg.Access...) } // GetSigners indicates that the message must have been signed by the address provided. @@ -165,10 +162,7 @@ func NewMsgFinalizeRequest(denom string, admin sdk.AccAddress) *MsgFinalizeReque // ValidateBasic runs stateless validation checks on the message. func (msg MsgFinalizeRequest) ValidateBasic() error { - if err := sdk.ValidateDenom(msg.Denom); err != nil { - return err - } - return nil + return sdk.ValidateDenom(msg.Denom) } // GetSigners indicates that the message must have been signed by the address provided. @@ -186,10 +180,7 @@ func NewMsgActivateRequest(denom string, admin sdk.AccAddress) *MsgActivateReque // ValidateBasic runs stateless validation checks on the message. func (msg MsgActivateRequest) ValidateBasic() error { - if err := sdk.ValidateDenom(msg.Denom); err != nil { - return err - } - return nil + return sdk.ValidateDenom(msg.Denom) } // GetSigners indicates that the message must have been signed by the address provided. @@ -207,10 +198,7 @@ func NewMsgCancelRequest(denom string, admin sdk.AccAddress) *MsgCancelRequest { // ValidateBasic runs stateless validation checks on the message. func (msg MsgCancelRequest) ValidateBasic() error { - if err := sdk.ValidateDenom(msg.Denom); err != nil { - return err - } - return nil + return sdk.ValidateDenom(msg.Denom) } // GetSigners indicates that the message must have been signed by the address provided. @@ -228,10 +216,7 @@ func NewMsgDeleteRequest(denom string, admin sdk.AccAddress) *MsgDeleteRequest { // ValidateBasic runs stateless validation checks on the message. func (msg MsgDeleteRequest) ValidateBasic() error { - if err := sdk.ValidateDenom(msg.Denom); err != nil { - return err - } - return nil + return sdk.ValidateDenom(msg.Denom) } // GetSigners indicates that the message must have been signed by the address provided. diff --git a/x/marker/wasm/encode.go b/x/marker/wasm/encode.go index 151a2b5bd4..32dc36fcb2 100644 --- a/x/marker/wasm/encode.go +++ b/x/marker/wasm/encode.go @@ -125,7 +125,7 @@ type TransferParams struct { } // Encoder returns a smart contract message encoder for the name module. -func Encoder(contract sdk.AccAddress, msg json.RawMessage, version string) ([]sdk.Msg, error) { +func Encoder(contract sdk.AccAddress, msg json.RawMessage, _ string) ([]sdk.Msg, error) { wrapper := struct { Params *MarkerMsgParams `json:"marker"` }{} diff --git a/x/metadata/keeper/params.go b/x/metadata/keeper/params.go index 3e09e04b5d..f0b7a22ee9 100644 --- a/x/metadata/keeper/params.go +++ b/x/metadata/keeper/params.go @@ -7,9 +7,9 @@ import ( ) // GetParams returns the total set of metadata parameters. -func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { +func (k Keeper) GetParams(_ sdk.Context) (params types.Params) { return types.Params{} // there are currently no params so no further action required here. } // SetParams sets the metadata parameters to the param space. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) {} // currently no params are supported +func (k Keeper) SetParams(_ sdk.Context, _ types.Params) {} // currently no params are supported diff --git a/x/metadata/keeper/scope.go b/x/metadata/keeper/scope.go index d574067995..d3f0e96cfd 100644 --- a/x/metadata/keeper/scope.go +++ b/x/metadata/keeper/scope.go @@ -333,11 +333,7 @@ func (k Keeper) ValidateWriteScope( return err } - if err = k.validateSmartContractSigners(ctx, usedSigners, msg); err != nil { - return err - } - - return nil + return k.validateSmartContractSigners(ctx, usedSigners, msg) } // ValidateDeleteScope checks the current scope and the proposed removal scope to determine if the proposed remove is valid @@ -386,11 +382,7 @@ func (k Keeper) ValidateDeleteScope(ctx sdk.Context, msg *types.MsgDeleteScopeRe return err } - if err = k.validateSmartContractSigners(ctx, usedSigners, msg); err != nil { - return err - } - - return nil + return k.validateSmartContractSigners(ctx, usedSigners, msg) } // ValidateAddScopeDataAccess checks the current scope and the proposed diff --git a/x/metadata/keeper/session.go b/x/metadata/keeper/session.go index f9da10b763..be7d6fc5eb 100644 --- a/x/metadata/keeper/session.go +++ b/x/metadata/keeper/session.go @@ -222,7 +222,7 @@ func (k Keeper) ValidateWriteSession(ctx sdk.Context, existing *types.Session, m // ValidateAuditUpdate ensure that a given reference to audit fields represents no changes to // existing audit field data. NOTE: A nil proposed is considered "no update" and not an attempt to unset. -func (k Keeper) ValidateAuditUpdate(ctx sdk.Context, existing, proposed *types.AuditFields) error { +func (k Keeper) ValidateAuditUpdate(_ sdk.Context, existing, proposed *types.AuditFields) error { if proposed == nil { return nil } diff --git a/x/metadata/keeper/specification.go b/x/metadata/keeper/specification.go index 6caec3ad42..f7071037ac 100644 --- a/x/metadata/keeper/specification.go +++ b/x/metadata/keeper/specification.go @@ -138,7 +138,7 @@ func (k Keeper) RemoveRecordSpecification(ctx sdk.Context, recordSpecID types.Me // ValidateWriteRecordSpecification compare the proposed contract spec with the existing to make sure the proposed // is valid. This assumes that proposed.ValidateBasic() has been run and did not return an error. -func (k Keeper) ValidateWriteRecordSpecification(ctx sdk.Context, existing *types.RecordSpecification, proposed types.RecordSpecification) error { +func (k Keeper) ValidateWriteRecordSpecification(_ sdk.Context, existing *types.RecordSpecification, proposed types.RecordSpecification) error { if existing != nil { // IDs must match if !proposed.SpecificationId.Equals(existing.SpecificationId) { @@ -155,7 +155,7 @@ func (k Keeper) ValidateWriteRecordSpecification(ctx sdk.Context, existing *type return nil } -func (k Keeper) isRecordSpecUsed(ctx sdk.Context, recordSpecID types.MetadataAddress) bool { +func (k Keeper) isRecordSpecUsed(_ sdk.Context, _ types.MetadataAddress) bool { // TODO: Check for records created from this spec. return false } @@ -358,7 +358,7 @@ func (k Keeper) isContractSpecUsed(ctx sdk.Context, contractSpecID types.Metadat // ValidateWriteContractSpecification compare the proposed contract spec with the existing to make sure the proposed // is valid. This assumes that proposed.ValidateBasic() has been run and did not return an error. -func (k Keeper) ValidateWriteContractSpecification(ctx sdk.Context, existing *types.ContractSpecification, proposed types.ContractSpecification) error { +func (k Keeper) ValidateWriteContractSpecification(_ sdk.Context, existing *types.ContractSpecification, proposed types.ContractSpecification) error { // IDS must match if there's an existing entry if existing != nil && !proposed.SpecificationId.Equals(existing.SpecificationId) { return fmt.Errorf("cannot update contract spec identifier. expected %s, got %s", diff --git a/x/metadata/module.go b/x/metadata/module.go index 0b2ac0eb24..8fbcc69439 100644 --- a/x/metadata/module.go +++ b/x/metadata/module.go @@ -49,7 +49,7 @@ type AppModuleBasic struct { func (AppModuleBasic) Name() string { return types.ModuleName } // RegisterLegacyAminoCodec registers the metadata module's types for the given codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { } // DefaultGenesis returns the default genesis state. @@ -58,7 +58,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the metadata module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config client.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ client.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -117,7 +117,7 @@ func (am AppModule) Route() sdk.Route { } // RegisterInvariants does not register any invariants for the metadata module -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) { +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) { } // QuerierRoute returns the query route for this module. @@ -126,7 +126,7 @@ func (am AppModule) QuerierRoute() string { } // LegacyQuerierHandler returns no sdk.Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -151,7 +151,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock returns the begin blocker for the metadata module. -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // EndBlock returns the end blocker for the metadata module. It returns no validator // updates. @@ -168,22 +168,22 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { // ProposalContents returns all the metadata content functions used to // simulate metadata governance proposals. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return []simtypes.WeightedProposalContent{} // simulation.ProposalContents(am.keeper) } // RandomizedParams creates randomized metadata param changes for the simulator. -func (AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { +func (AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{} // simulation.ParamChanges(r) } // RegisterStoreDecoder registers a decoder for metadata module's types -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { // sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) } // WeightedOperations returns the all the metadata module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { // return simulation.WeightedOperations( // simState.AppParams, simState.Cdc, am.keeper, simState.Contents, // ) diff --git a/x/metadata/types/scope.go b/x/metadata/types/scope.go index 51a3b19c08..b4ccb7d656 100644 --- a/x/metadata/types/scope.go +++ b/x/metadata/types/scope.go @@ -82,10 +82,7 @@ func (s Scope) ValidateOwnersBasic() error { if err := ValidatePartiesBasic(s.Owners); err != nil { return fmt.Errorf("invalid scope owners: %w", err) } - if err := ValidateOptionalParties(s.RequirePartyRollup, s.Owners); err != nil { - return err - } - return nil + return ValidateOptionalParties(s.RequirePartyRollup, s.Owners) } // String implements stringer interface diff --git a/x/metadata/wasm/encode.go b/x/metadata/wasm/encode.go index 167a0e7c4c..b600ffd52d 100644 --- a/x/metadata/wasm/encode.go +++ b/x/metadata/wasm/encode.go @@ -26,7 +26,7 @@ type WriteScope struct { } // Encoder returns a smart contract message encoder for the metadata module. -func Encoder(contract sdk.AccAddress, msg json.RawMessage, version string) ([]sdk.Msg, error) { +func Encoder(_ sdk.AccAddress, msg json.RawMessage, _ string) ([]sdk.Msg, error) { wrapper := struct { Params *MetadataMsgParams `json:"metadata"` }{} diff --git a/x/msgfees/keeper/proposal_handler.go b/x/msgfees/keeper/proposal_handler.go index e2376cbbf1..b83a71bed0 100644 --- a/x/msgfees/keeper/proposal_handler.go +++ b/x/msgfees/keeper/proposal_handler.go @@ -125,7 +125,7 @@ func HandleRemoveMsgFeeProposal(ctx sdk.Context, k Keeper, proposal *types.Remov } // HandleUpdateNhashPerUsdMilProposal handles update of nhash per usd mil governance proposal request -func HandleUpdateNhashPerUsdMilProposal(ctx sdk.Context, k Keeper, proposal *types.UpdateNhashPerUsdMilProposal, registry codectypes.InterfaceRegistry) error { +func HandleUpdateNhashPerUsdMilProposal(ctx sdk.Context, k Keeper, proposal *types.UpdateNhashPerUsdMilProposal, _ codectypes.InterfaceRegistry) error { if err := proposal.ValidateBasic(); err != nil { return err } @@ -136,7 +136,7 @@ func HandleUpdateNhashPerUsdMilProposal(ctx sdk.Context, k Keeper, proposal *typ } // HandleUpdateConversionFeeDenomProposal handles update of conversion fee denom -func HandleUpdateConversionFeeDenomProposal(ctx sdk.Context, k Keeper, proposal *types.UpdateConversionFeeDenomProposal, registry codectypes.InterfaceRegistry) error { +func HandleUpdateConversionFeeDenomProposal(ctx sdk.Context, k Keeper, proposal *types.UpdateConversionFeeDenomProposal, _ codectypes.InterfaceRegistry) error { if err := proposal.ValidateBasic(); err != nil { return err } diff --git a/x/msgfees/keeper/query_server.go b/x/msgfees/keeper/query_server.go index 26a389cac6..d94333e8f6 100644 --- a/x/msgfees/keeper/query_server.go +++ b/x/msgfees/keeper/query_server.go @@ -17,7 +17,7 @@ import ( var _ types.QueryServer = Keeper{} -func (k Keeper) Params(ctx context.Context, request *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(ctx context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { c := sdk.UnwrapSDKContext(ctx) var params types.Params k.paramSpace.GetParamSet(c, ¶ms) diff --git a/x/msgfees/module/module.go b/x/msgfees/module/module.go index 1fe64dae66..92e837f9cf 100644 --- a/x/msgfees/module/module.go +++ b/x/msgfees/module/module.go @@ -49,7 +49,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { } // RegisterLegacyAminoCodec registers the msgfee module's types for the given codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {} // RegisterInterfaces registers the msgfees module's interface types func (AppModuleBasic) RegisterInterfaces(registry cdctypes.InterfaceRegistry) { @@ -63,7 +63,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the msgfee module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ sdkclient.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return cerrs.Wrapf(err, "failed to unmarshal %q genesis state", types.ModuleName) @@ -122,7 +122,7 @@ func (am AppModule) Route() sdk.Route { func (AppModule) QuerierRoute() string { return "" } // LegacyQuerierHandler returns the msgfees module sdk.Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -145,10 +145,10 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion implements AppModule/ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return 1 } -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // EndBlock does nothing -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { +func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } @@ -163,7 +163,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { // ProposalContents returns all the msgfees content functions used to // simulate governance proposals. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return simulation.ProposalContents(am.keeper) } @@ -178,6 +178,6 @@ func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { } // WeightedOperations returns the all the gov module operations with their respective weights. -func (am AppModule) WeightedOperations(simState module.SimulationState) []simtypes.WeightedOperation { +func (am AppModule) WeightedOperations(_ module.SimulationState) []simtypes.WeightedOperation { return nil } diff --git a/x/msgfees/simulation/params.go b/x/msgfees/simulation/params.go index cfeb0077b4..0a65a137b1 100644 --- a/x/msgfees/simulation/params.go +++ b/x/msgfees/simulation/params.go @@ -19,7 +19,7 @@ const ( // ParamChanges defines the parameters that can be modified by param change proposals // on the simulation -func ParamChanges(r *rand.Rand) []simtypes.ParamChange { +func ParamChanges(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{ simulation.NewSimParamChange(types.ModuleName, keyFloorGasPrice, func(r *rand.Rand) string { diff --git a/x/msgfees/wasm/encode.go b/x/msgfees/wasm/encode.go index 184dc25aa5..d5d6306ee6 100644 --- a/x/msgfees/wasm/encode.go +++ b/x/msgfees/wasm/encode.go @@ -35,7 +35,7 @@ type AssessCustomFeeParams struct { } // Encoder returns a smart contract message encoder for the name module. -func Encoder(contract sdk.AccAddress, msg json.RawMessage, version string) ([]sdk.Msg, error) { +func Encoder(contract sdk.AccAddress, msg json.RawMessage, _ string) ([]sdk.Msg, error) { wrapper := struct { Params *MsgFeesMsgParams `json:"msgfees"` }{} @@ -55,7 +55,7 @@ func Encoder(contract sdk.AccAddress, msg json.RawMessage, version string) ([]sd } // Encode creates a MsgAssessCustomMsgFeeRequest. -func (params *AssessCustomFeeParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error) { +func (params *AssessCustomFeeParams) Encode(_ sdk.AccAddress) ([]sdk.Msg, error) { // Create message request msg := types.NewMsgAssessCustomMsgFeeRequest(params.Name, params.Amount, params.Recipient, params.From, params.RecipientBasisPoints) err := msg.ValidateBasic() diff --git a/x/name/keeper/keeper.go b/x/name/keeper/keeper.go index c2bcafe8dc..4f3c64df0a 100644 --- a/x/name/keeper/keeper.go +++ b/x/name/keeper/keeper.go @@ -99,11 +99,7 @@ func (k Keeper) SetNameRecord(ctx sdk.Context, name string, addr sdk.AccAddress, nameBoundEvent := types.NewEventNameBound(addr.String(), name, restrict) - if err := ctx.EventManager().EmitTypedEvent(nameBoundEvent); err != nil { - return err - } - - return nil + return ctx.EventManager().EmitTypedEvent(nameBoundEvent) } // UpdateNameRecord updates the owner address and restricted flag on a name. @@ -122,11 +118,7 @@ func (k Keeper) UpdateNameRecord(ctx sdk.Context, name string, addr sdk.AccAddre nameUpdateEvent := types.NewEventNameUpdate(addr.String(), name, restrict) - if err := ctx.EventManager().EmitTypedEvent(nameUpdateEvent); err != nil { - return err - } - - return nil + return ctx.EventManager().EmitTypedEvent(nameUpdateEvent) } // GetRecordByName resolves a record by name. @@ -212,11 +204,7 @@ func (k Keeper) DeleteRecord(ctx sdk.Context, name string) error { nameUnboundEvent := types.NewEventNameUnbound(record.Address, name, record.Restricted) - if err := ctx.EventManager().EmitTypedEvent(nameUnboundEvent); err != nil { - return err - } - - return nil + return ctx.EventManager().EmitTypedEvent(nameUnboundEvent) } // IterateRecords iterates over all the stored name records and passes them to a callback function. diff --git a/x/name/keeper/query_server.go b/x/name/keeper/query_server.go index f36d497f97..6c2ee72d06 100644 --- a/x/name/keeper/query_server.go +++ b/x/name/keeper/query_server.go @@ -13,7 +13,7 @@ import ( var _ types.QueryServer = Keeper{} // Params queries params of distribution module -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { +func (k Keeper) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) var params types.Params k.paramSpace.GetParamSet(ctx, ¶ms) diff --git a/x/name/module.go b/x/name/module.go index e8aebb6bd2..7ed04471f0 100644 --- a/x/name/module.go +++ b/x/name/module.go @@ -44,7 +44,7 @@ func (AppModuleBasic) Name() string { } // RegisterLegacyAminoCodec registers the name module's types for the given codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) {} +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) {} // DefaultGenesis returns the default genesis state. func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { @@ -52,7 +52,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the distribution module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ sdkclient.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return fmt.Errorf("failed to unmarshal %s genesis state: %w", types.ModuleName, err) @@ -110,7 +110,7 @@ func (AppModule) Name() string { } // RegisterInvariants registers the distribution module invariants. -func (am AppModule) RegisterInvariants(ir sdk.InvariantRegistry) {} +func (am AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} // Route returns the message routing key for the distribution module. func (am AppModule) Route() sdk.Route { @@ -123,7 +123,7 @@ func (AppModule) QuerierRoute() string { } // LegacyQuerierHandler returns the distribution module sdk.Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -150,7 +150,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // BeginBlock returns the begin blocker for the name module. -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} // EndBlock returns the end blocker for the name module. It returns no validator // updates. @@ -169,7 +169,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { // ProposalContents returns all the name content functions used to // simulate governance proposals. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { return simulation.ProposalContents(am.keeper) } diff --git a/x/name/simulation/params.go b/x/name/simulation/params.go index fbf0613fc8..6fed52321f 100644 --- a/x/name/simulation/params.go +++ b/x/name/simulation/params.go @@ -21,7 +21,7 @@ const ( // ParamChanges defines the parameters that can be modified by param change proposals // on the simulation -func ParamChanges(r *rand.Rand) []simtypes.ParamChange { +func ParamChanges(_ *rand.Rand) []simtypes.ParamChange { return []simtypes.ParamChange{ simulation.NewSimParamChange(types.ModuleName, keyMinSegmentLength, func(r *rand.Rand) string { diff --git a/x/name/simulation/proposals.go b/x/name/simulation/proposals.go index e445b2fa12..70f83a38d7 100644 --- a/x/name/simulation/proposals.go +++ b/x/name/simulation/proposals.go @@ -27,7 +27,7 @@ func ProposalContents(k keeper.Keeper) []simtypes.WeightedProposalContent { } // SimulateCreateRootNameProposalContent generates random create-root-name proposal content -func SimulateCreateRootNameProposalContent(k keeper.Keeper) simtypes.ContentSimulatorFn { +func SimulateCreateRootNameProposalContent(_ keeper.Keeper) simtypes.ContentSimulatorFn { return func(r *rand.Rand, ctx sdk.Context, accs []simtypes.Account) simtypes.Content { simAccount, _ := simtypes.RandomAcc(r, accs) diff --git a/x/name/types/keys.go b/x/name/types/keys.go index 1dfcbaef1c..b50490b1f1 100644 --- a/x/name/types/keys.go +++ b/x/name/types/keys.go @@ -71,8 +71,5 @@ func GetAddressKeyPrefix(addr sdk.AccAddress) (key []byte, err error) { } func ValidateAddress(address sdk.AccAddress) error { - if err := sdk.VerifyAddressFormat(address); err != nil { - return err - } - return nil + return sdk.VerifyAddressFormat(address) } diff --git a/x/name/wasm/encode.go b/x/name/wasm/encode.go index 4ff14ba5a6..b52e79d0d5 100644 --- a/x/name/wasm/encode.go +++ b/x/name/wasm/encode.go @@ -55,7 +55,7 @@ type ModifyNameParams struct { } // Encoder returns a smart contract message encoder for the name module. -func Encoder(contract sdk.AccAddress, msg json.RawMessage, version string) ([]sdk.Msg, error) { +func Encoder(contract sdk.AccAddress, msg json.RawMessage, _ string) ([]sdk.Msg, error) { wrapper := struct { Params *NameMsgParams `json:"name"` }{} @@ -106,7 +106,7 @@ func (params *DeleteNameParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, erro } // Encode creates a MsgModifyNameRequest. -func (params *ModifyNameParams) Encode(contract sdk.AccAddress) ([]sdk.Msg, error) { +func (params *ModifyNameParams) Encode(_ sdk.AccAddress) ([]sdk.Msg, error) { address, err := sdk.AccAddressFromBech32(params.Address) if err != nil { return nil, fmt.Errorf("wasm: invalid bind address: %w", err) diff --git a/x/reward/keeper/time_management.go b/x/reward/keeper/time_management.go index b5ade9ba8e..92058f8549 100644 --- a/x/reward/keeper/time_management.go +++ b/x/reward/keeper/time_management.go @@ -241,7 +241,7 @@ func (k Keeper) CalculateRewardClaimPeriodRewards(ctx sdk.Context, maxReward sdk } // CalculateParticipantReward for each address/participant -func (k Keeper) CalculateParticipantReward(ctx sdk.Context, shares int64, totalShares int64, claimRewardPool sdk.Coin, maxReward sdk.Coin) sdk.Coin { +func (k Keeper) CalculateParticipantReward(_ sdk.Context, shares int64, totalShares int64, claimRewardPool sdk.Coin, maxReward sdk.Coin) sdk.Coin { numerator := sdk.NewDec(shares) denom := sdk.NewDec(totalShares) diff --git a/x/reward/module/module.go b/x/reward/module/module.go index 53fbb4f721..12cfc30ba9 100644 --- a/x/reward/module/module.go +++ b/x/reward/module/module.go @@ -52,7 +52,7 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { } // RegisterLegacyAminoCodec registers the reward module's types for the given codec. -func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { +func (AppModuleBasic) RegisterLegacyAminoCodec(_ *codec.LegacyAmino) { } // RegisterInterfaces registers the reward module's interface types @@ -67,7 +67,7 @@ func (AppModuleBasic) DefaultGenesis(cdc codec.JSONCodec) json.RawMessage { } // ValidateGenesis performs genesis state validation for the reward module. -func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, config sdkclient.TxEncodingConfig, bz json.RawMessage) error { +func (AppModuleBasic) ValidateGenesis(cdc codec.JSONCodec, _ sdkclient.TxEncodingConfig, bz json.RawMessage) error { var data types.GenesisState if err := cdc.UnmarshalJSON(bz, &data); err != nil { return cerrs.Wrapf(err, "failed to unmarshal %q genesis state", types.ModuleName) @@ -121,13 +121,13 @@ func (am AppModule) GenerateGenesisState(simState *module.SimulationState) { } // ProposalContents returns content functions used to simulate governance proposals. -func (am AppModule) ProposalContents(simState module.SimulationState) []simtypes.WeightedProposalContent { +func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.WeightedProposalContent { // currently no gov proposals exist return nil } // RandomizedParams returns randomized module parameters for param change proposals. -func (am AppModule) RandomizedParams(r *rand.Rand) []simtypes.ParamChange { +func (am AppModule) RandomizedParams(_ *rand.Rand) []simtypes.ParamChange { // currently no module params exist return nil } @@ -161,7 +161,7 @@ func (am AppModule) Route() sdk.Route { func (AppModule) QuerierRoute() string { return "" } // LegacyQuerierHandler returns the reward module sdk.Querier. -func (am AppModule) LegacyQuerierHandler(legacyQuerierCdc *codec.LegacyAmino) sdk.Querier { +func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { return nil } @@ -186,7 +186,7 @@ func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock is the `BeginBlocker` function run at the beginning of each block to // process rewards module updates. -func (am AppModule) BeginBlock(ctx sdk.Context, req abci.RequestBeginBlock) { +func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { rewardModule.BeginBlocker(ctx, am.keeper) } diff --git a/x/reward/simulation/operations.go b/x/reward/simulation/operations.go index 1423abae92..a1504ba81d 100644 --- a/x/reward/simulation/operations.go +++ b/x/reward/simulation/operations.go @@ -61,7 +61,7 @@ func WeightedOperations( } // SimulateMsgCreateRewardsProgram sends of a MsgCreateRewardProgramRequest. -func SimulateMsgCreateRewardsProgram(k keeper.Keeper, ak authkeeper.AccountKeeperI, bk bankkeeper.Keeper) simtypes.Operation { +func SimulateMsgCreateRewardsProgram(_ keeper.Keeper, ak authkeeper.AccountKeeperI, bk bankkeeper.Keeper) simtypes.Operation { return func( r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { diff --git a/x/reward/types/action_builder.go b/x/reward/types/action_builder.go index 3d2557533b..1ae6a0f433 100644 --- a/x/reward/types/action_builder.go +++ b/x/reward/types/action_builder.go @@ -251,7 +251,7 @@ func getGovVoteMsgURLs() []string { return govVoteMsgURLs } -func (v *VoteActionBuilder) AddEvent(eventType string, attributes *map[string][]byte) error { +func (v *VoteActionBuilder) AddEvent(_ string, attributes *map[string][]byte) error { if _, ok := (*attributes)[sdk.AttributeKeyModule]; ok { address := (*attributes)[banktypes.AttributeKeySender] address, err := sdk.AccAddressFromBech32(string(address)) diff --git a/x/reward/types/reward.go b/x/reward/types/reward.go index 8408f30469..69c4771339 100644 --- a/x/reward/types/reward.go +++ b/x/reward/types/reward.go @@ -385,7 +385,7 @@ func (ad *ActionDelegate) getValidatorRankPercentile(ctx sdk.Context, provider K return percentile } -func (ad *ActionDelegate) Evaluate(ctx sdk.Context, provider KeeperProvider, state RewardAccountState, event EvaluationResult) bool { +func (ad *ActionDelegate) Evaluate(ctx sdk.Context, provider KeeperProvider, _ RewardAccountState, event EvaluationResult) bool { validator := event.Validator delegator := event.Delegator @@ -423,11 +423,11 @@ func (ad *ActionDelegate) GetMaximumActiveStakePercentile() sdk.Dec { return sdk.NewDec(0) } -func (ad *ActionDelegate) PreEvaluate(ctx sdk.Context, provider KeeperProvider, state RewardAccountState) bool { +func (ad *ActionDelegate) PreEvaluate(_ sdk.Context, _ KeeperProvider, _ RewardAccountState) bool { return true } -func (ad *ActionDelegate) PostEvaluate(ctx sdk.Context, provider KeeperProvider, state RewardAccountState, event EvaluationResult) (bool, EvaluationResult) { +func (ad *ActionDelegate) PostEvaluate(_ sdk.Context, _ KeeperProvider, state RewardAccountState, event EvaluationResult) (bool, EvaluationResult) { actionCounter := GetActionCount(state.ActionCounter, ad.ActionType()) hasValidActionCount := actionCounter >= ad.GetMinimumActions() && actionCounter <= ad.GetMaximumActions() return hasValidActionCount, event @@ -457,7 +457,7 @@ func (at *ActionTransfer) ActionType() string { return ActionTypeTransfer } -func (at *ActionTransfer) Evaluate(ctx sdk.Context, provider KeeperProvider, state RewardAccountState, event EvaluationResult) bool { +func (at *ActionTransfer) Evaluate(ctx sdk.Context, provider KeeperProvider, _ RewardAccountState, event EvaluationResult) bool { // get the address that is performing the send addressSender := event.Address if addressSender == nil { @@ -481,11 +481,11 @@ func (at *ActionTransfer) Evaluate(ctx sdk.Context, provider KeeperProvider, sta return true } -func (at *ActionTransfer) PreEvaluate(ctx sdk.Context, provider KeeperProvider, state RewardAccountState) bool { +func (at *ActionTransfer) PreEvaluate(_ sdk.Context, _ KeeperProvider, _ RewardAccountState) bool { return true } -func (at *ActionTransfer) PostEvaluate(ctx sdk.Context, provider KeeperProvider, state RewardAccountState, evaluationResult EvaluationResult) (bool, EvaluationResult) { +func (at *ActionTransfer) PostEvaluate(_ sdk.Context, _ KeeperProvider, state RewardAccountState, evaluationResult EvaluationResult) (bool, EvaluationResult) { actionCounter := GetActionCount(state.ActionCounter, at.ActionType()) hasValidActionCount := actionCounter >= at.GetMinimumActions() && actionCounter <= at.GetMaximumActions() return hasValidActionCount, evaluationResult @@ -515,7 +515,7 @@ func (atd *ActionVote) ActionType() string { return ActionTypeVote } -func (atd *ActionVote) Evaluate(ctx sdk.Context, provider KeeperProvider, state RewardAccountState, event EvaluationResult) bool { +func (atd *ActionVote) Evaluate(ctx sdk.Context, provider KeeperProvider, _ RewardAccountState, event EvaluationResult) bool { // get the address that voted addressVoting := event.Address if !sdk.NewCoin(pioconfig.GetProvenanceConfig().BondDenom, sdk.ZeroInt()).IsGTE(atd.MinimumDelegationAmount) { @@ -532,7 +532,7 @@ func (atd *ActionVote) Evaluate(ctx sdk.Context, provider KeeperProvider, state return true } -func (atd *ActionVote) PreEvaluate(ctx sdk.Context, provider KeeperProvider, state RewardAccountState) bool { +func (atd *ActionVote) PreEvaluate(_ sdk.Context, _ KeeperProvider, _ RewardAccountState) bool { return true }