diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a1c15f4e..a75f6041c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,8 @@ - Use `TruncateInt` to compute `uphotonToMint` [#250](https://github.com/atomone-hub/atomone/pull/250) - Fix missing ICA controller configuration [#257](https://github.com/atomone-hub/atomone/pull/257) +- Fix wrapper converters for `x/gov` [#276](https://github.com/atomone-hub/atomone/pull/276) +- Add min-stake filtering for cosmos-sdk votes in the gov ante handler [#279](https://github.com/atomone-hub/atomone/pull/279) ### DEPENDENCIES @@ -20,11 +22,14 @@ - Migrate `x/gov` fork from Atom One to Atom One SDK [#248](https://github.com/atomone-hub/atomone/pull/248) - Add governors to `x/gov` module [#258](https://github.com/atomone-hub/atomone/pull/258) +- Prevent Oversight DAO from vetoing proposals that include a change to the Oversight DAO address [#275](https://github.com/atomone-hub/atomone/pull/275) ### STATE BREAKING ### IMPROVEMENTS +- Reorder ante handlers to verify signatures and deduct fees before doing any tx related stateful checks [#274](https://github.com/atomone-hub/atomone/pull/274) + ## v3.0.3 *Oct 20th, 2025* diff --git a/Dockerfile b/Dockerfile index 3f7425b06..9b90ad052 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ ARG IMG_TAG=latest # Compile the atomoned binary -FROM golang:1.22-alpine AS atomoned-builder +FROM golang:1.26-alpine AS atomoned-builder WORKDIR /src/app/ COPY go.mod go.sum* ./ RUN go mod download diff --git a/RELEASES.md b/RELEASES.md index 816bfa155..fe9c77cdb 100644 --- a/RELEASES.md +++ b/RELEASES.md @@ -1,3 +1,12 @@ +# v3.3.0 + +5868f67ead4585c1bb12413eb25ffe254aecdc8d3d5504697054b2762b5be6d3 atomoned-v3.3.0-darwin-amd64 +8aab3a06b6ba5ed58e433c390acac2da8977d6dc545fc59c0ff73f75272a60d0 atomoned-v3.3.0-darwin-arm64 +518ba2916da24b0fca3efba8e0e713c81ec3fb1a5fb0b845af61dd76adb1c55c atomoned-v3.3.0-linux-amd64 +eb26af28c99732ef59b28a9bfcb8910cd73a04da99866a80dcc67fc5af846441 atomoned-v3.3.0-linux-arm64 +f565d6e6cade43c5f4908584664682393473cee0e9e2e7edc8990b0cc76d6237 atomoned-v3.3.0-windows-amd64.exe +8a9fe784f0c7e7d91bc39d14c8f558c06c58d7eefd76055ec0ff267f8b4117cb atomoned-v3.3.0-windows-arm64.exe + # v3.2.0 704ac5d22395c069e4ac025da228ae9307b6b75af0780836333bcd479e4a6852 atomoned-v3.2.0-darwin-amd64 diff --git a/ante/ante.go b/ante/ante.go index 8eeb89b91..8e095dfdc 100644 --- a/ante/ante.go +++ b/ante/ante.go @@ -62,9 +62,13 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) { ante.NewExtensionOptionsDecorator(opts.ExtensionOptionChecker), ante.NewValidateBasicDecorator(), ante.NewTxTimeoutHeightDecorator(), + ante.NewSetPubKeyDecorator(opts.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators + ante.NewValidateSigCountDecorator(opts.AccountKeeper), + ante.NewSigGasConsumeDecorator(opts.AccountKeeper, sigGasConsumer), + ante.NewSigVerificationDecorator(opts.AccountKeeper, opts.SignModeHandler), + ante.NewIncrementSequenceDecorator(opts.AccountKeeper), ante.NewValidateMemoDecorator(opts.AccountKeeper), ante.NewConsumeGasForTxSizeDecorator(opts.AccountKeeper), - NewGovVoteDecorator(opts.Codec, opts.StakingKeeper), photonante.NewValidateFeeDecorator(opts.PhotonKeeper), dynamicfeeante.NewDynamicfeeCheckDecorator( opts.AccountKeeper, @@ -78,11 +82,7 @@ func NewAnteHandler(opts HandlerOptions) (sdk.AnteHandler, error) { opts.TxFeeChecker, ), ), - ante.NewSetPubKeyDecorator(opts.AccountKeeper), // SetPubKeyDecorator must be called before all signature verification decorators - ante.NewValidateSigCountDecorator(opts.AccountKeeper), - ante.NewSigGasConsumeDecorator(opts.AccountKeeper, sigGasConsumer), - ante.NewSigVerificationDecorator(opts.AccountKeeper, opts.SignModeHandler), - ante.NewIncrementSequenceDecorator(opts.AccountKeeper), + NewGovVoteDecorator(opts.Codec, opts.StakingKeeper), ibcante.NewRedundantRelayDecorator(opts.IBCkeeper), } diff --git a/ante/gov_vote_ante.go b/ante/gov_vote_ante.go index 62afbdc64..e38c4bd99 100644 --- a/ante/gov_vote_ante.go +++ b/ante/gov_vote_ante.go @@ -9,6 +9,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/authz" + sdkgovv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + sdkgovv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -84,6 +86,26 @@ func (g GovVoteDecorator) ValidateVoteMsgs(ctx sdk.Context, msgs []sdk.Msg) erro if err != nil { return err } + case *sdkgovv1beta1.MsgVote: + accAddr, err = sdk.AccAddressFromBech32(msg.Voter) + if err != nil { + return err + } + case *sdkgovv1.MsgVote: + accAddr, err = sdk.AccAddressFromBech32(msg.Voter) + if err != nil { + return err + } + case *sdkgovv1beta1.MsgVoteWeighted: + accAddr, err = sdk.AccAddressFromBech32(msg.Voter) + if err != nil { + return err + } + case *sdkgovv1.MsgVoteWeighted: + accAddr, err = sdk.AccAddressFromBech32(msg.Voter) + if err != nil { + return err + } default: // not a vote message - nothing to validate return nil diff --git a/ante/gov_vote_ante_test.go b/ante/gov_vote_ante_test.go index 72630ba25..244e72398 100644 --- a/ante/gov_vote_ante_test.go +++ b/ante/gov_vote_ante_test.go @@ -11,6 +11,8 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" sdk "github.com/cosmos/cosmos-sdk/types" + sdkgovv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" + sdkgovv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/atomone-hub/atomone/ante" @@ -139,6 +141,21 @@ func TestVoteSpamDecoratorGovV1Beta1(t *testing.T) { } else { require.Error(t, err, "expected %v to fail", tc.name) } + + // Create sdk vote message + sdkMsg := sdkgovv1beta1.NewMsgVote( + delegator, + 0, + sdkgovv1beta1.OptionYes, + ) + + // Validate sdk vote message + err = decorator.ValidateVoteMsgs(ctx, []sdk.Msg{sdkMsg}) + if tc.expectPass { + require.NoError(t, err, "expected %v to pass", tc.name) + } else { + require.Error(t, err, "expected %v to fail", tc.name) + } } } @@ -264,6 +281,22 @@ func TestVoteWeightedSpamDecoratorGovV1Beta1(t *testing.T) { } else { require.Error(t, err, "expected %v to fail", tc.name) } + + sdkWeightedVoteOptions := govv1beta1.ConvertAtomOneWeightedVoteOptionsToSDK(weightedVoteOptions) + // Create sdk vote message + sdkMsg := sdkgovv1beta1.NewMsgVoteWeighted( + delegator, + 0, + sdkWeightedVoteOptions, + ) + + // Validate sdk vote message + err = decorator.ValidateVoteMsgs(ctx, []sdk.Msg{sdkMsg}) + if tc.expectPass { + require.NoError(t, err, "expected %v to pass", tc.name) + } else { + require.Error(t, err, "expected %v to fail", tc.name) + } } } @@ -390,6 +423,22 @@ func TestVoteSpamDecoratorGovV1(t *testing.T) { } else { require.Error(t, err, "expected %v to fail", tc.name) } + + // Create sdk vote message + sdkMsg := sdkgovv1.NewMsgVote( + delegator, + 0, + sdkgovv1.VoteOption_VOTE_OPTION_YES, + "new-v1-vote-message-test", + ) + + // Validate sdk vote message + err = decorator.ValidateVoteMsgs(ctx, []sdk.Msg{sdkMsg}) + if tc.expectPass { + require.NoError(t, err, "expected %v to pass", tc.name) + } else { + require.Error(t, err, "expected %v to fail", tc.name) + } } } @@ -517,5 +566,22 @@ func TestVoteWeightedSpamDecoratorGovV1(t *testing.T) { } else { require.Error(t, err, "expected %v to fail", tc.name) } + + sdkWeightedVoteOptions := govv1.ConvertAtomOneWeightedVoteOptionsToSDK(weightedVoteOptions) + // Create sdk vote message + sdkMsg := sdkgovv1.NewMsgVoteWeighted( + delegator, + 0, + sdkWeightedVoteOptions, + "new-v1-weighted-vote-message-test", + ) + + // Validate sdk vote message + err = decorator.ValidateVoteMsgs(ctx, []sdk.Msg{sdkMsg}) + if tc.expectPass { + require.NoError(t, err, "expected %v to pass", tc.name) + } else { + require.Error(t, err, "expected %v to fail", tc.name) + } } } diff --git a/app/app.go b/app/app.go index 920f21050..7e6d9ff58 100644 --- a/app/app.go +++ b/app/app.go @@ -491,6 +491,7 @@ func (app *AtomOneApp) setupUpgradeHandlers() { upgrade.UpgradeName, upgrade.CreateUpgradeHandler( app.mm, + app.appCodec, app.configurator, &app.AppKeepers, ), @@ -531,6 +532,6 @@ func (app *AtomOneApp) GetIBCKeeper() *ibckeeper.Keeper { type EmptyAppOptions struct{} // Get implements AppOptions -func (ao EmptyAppOptions) Get(_ string) interface{} { +func (ao EmptyAppOptions) Get(_ string) any { return nil } diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go index a41e0855d..c81f6b59d 100644 --- a/app/keepers/keepers.go +++ b/app/keepers/keepers.go @@ -12,6 +12,8 @@ import ( ibctransferkeeper "github.com/cosmos/ibc-go/v10/modules/apps/transfer/keeper" ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types" transferv2 "github.com/cosmos/ibc-go/v10/modules/apps/transfer/v2" + ibcclienttypes "github.com/cosmos/ibc-go/v10/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v10/modules/core/03-connection/types" porttypes "github.com/cosmos/ibc-go/v10/modules/core/05-port/types" ibcapi "github.com/cosmos/ibc-go/v10/modules/core/api" ibcexported "github.com/cosmos/ibc-go/v10/modules/core/exported" @@ -66,6 +68,10 @@ import ( atomonegovkeeper "github.com/atomone-hub/atomone/x/gov/keeper" photonkeeper "github.com/atomone-hub/atomone/x/photon/keeper" photontypes "github.com/atomone-hub/atomone/x/photon/types" + + ibcprovider "github.com/allinbits/vaas/x/vaas/provider" + ibcproviderkeeper "github.com/allinbits/vaas/x/vaas/provider/keeper" + providertypes "github.com/allinbits/vaas/x/vaas/provider/types" ) type AppKeepers struct { @@ -97,6 +103,7 @@ type AppKeepers struct { PhotonKeeper *photonkeeper.Keeper DynamicfeeKeeper *dynamicfeekeeper.Keeper CoreDaosKeeper *coredaoskeeper.Keeper + ProviderKeeper ibcproviderkeeper.Keeper // Modules ICAModule ica.AppModule @@ -120,6 +127,7 @@ func NewAppKeeper( ) AppKeepers { authorityStr := authtypes.NewModuleAddress(govtypes.ModuleName).String() addressCodec := addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) + consAddressCodec := addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()) appKeepers := AppKeepers{} // Set keys KVStoreKey, TransientStoreKey, MemoryStoreKey @@ -266,6 +274,23 @@ func NewAppKeeper( appKeepers.GovKeeperWrapper = atomonegovkeeper.NewKeeper(appKeepers.GovKeeper) + appKeepers.ProviderKeeper = ibcproviderkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[providertypes.StoreKey]), + appKeepers.IBCKeeper.ChannelKeeper, + appKeepers.IBCKeeper.ConnectionKeeper, + appKeepers.IBCKeeper.ClientKeeper, + appKeepers.StakingKeeper, + appKeepers.SlashingKeeper, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + *appKeepers.GovKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appCodec.InterfaceRegistry().SigningContext().ValidatorAddressCodec(), + consAddressCodec, + authtypes.FeeCollectorName, + ) + appKeepers.CoreDaosKeeper = coredaoskeeper.NewKeeper( appCodec, runtime.NewKVStoreService(appKeepers.keys[coredaostypes.StoreKey]), @@ -356,14 +381,18 @@ func NewAppKeeper( icaControllerStack porttypes.IBCModule = icacontroller.NewIBCMiddleware(appKeepers.ICAControllerKeeper) ) + providerModule := ibcprovider.NewAppModule(&appKeepers.ProviderKeeper) + // Create IBC Router & seal ibcRouter := porttypes.NewRouter(). AddRoute(icahosttypes.SubModuleName, icaHostStack). AddRoute(icacontrollertypes.SubModuleName, icaControllerStack). - AddRoute(ibctransfertypes.ModuleName, transferStack) + AddRoute(ibctransfertypes.ModuleName, transferStack). + AddRoute(providertypes.ModuleName, providerModule) ibcv2Router := ibcapi.NewRouter(). - AddRoute(ibctransfertypes.PortID, transferStackV2) + AddRoute(ibctransfertypes.PortID, transferStackV2). + AddRoute(providertypes.ModuleName, ibcprovider.NewIBCModuleV2(&appKeepers.ProviderKeeper)) appKeepers.IBCKeeper.SetRouter(ibcRouter) appKeepers.IBCKeeper.SetRouterV2(ibcv2Router) @@ -404,9 +433,11 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(distrtypes.ModuleName).WithKeyTable(distrtypes.ParamKeyTable()) //nolint:staticcheck // SA1019 paramsKeeper.Subspace(slashingtypes.ModuleName).WithKeyTable(slashingtypes.ParamKeyTable()) //nolint:staticcheck // SA1019 paramsKeeper.Subspace(govtypes.ModuleName).WithKeyTable(govv1.ParamKeyTable()) //nolint:staticcheck // SA1019 - paramsKeeper.Subspace(ibctransfertypes.ModuleName) - paramsKeeper.Subspace(ibcexported.ModuleName) - paramsKeeper.Subspace(icahosttypes.SubModuleName) + paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + keyTable := ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + paramsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) paramsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable()) return paramsKeeper diff --git a/app/keepers/keys.go b/app/keepers/keys.go index 0871853a2..cfaf37d6c 100644 --- a/app/keepers/keys.go +++ b/app/keepers/keys.go @@ -1,6 +1,7 @@ package keepers import ( + providertypes "github.com/allinbits/vaas/x/vaas/provider/types" icacontrollertypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/controller/types" icahosttypes "github.com/cosmos/ibc-go/v10/modules/apps/27-interchain-accounts/host/types" ibctransfertypes "github.com/cosmos/ibc-go/v10/modules/apps/transfer/types" @@ -51,6 +52,7 @@ func (appKeepers *AppKeepers) GenerateKeys() { photontypes.StoreKey, dynamicfeetypes.StoreKey, coredaostypes.StoreKey, + providertypes.StoreKey, ) // Define transient store keys diff --git a/app/modules.go b/app/modules.go index f4ca03b48..a6343fba6 100644 --- a/app/modules.go +++ b/app/modules.go @@ -30,7 +30,6 @@ import ( consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" distr "github.com/cosmos/cosmos-sdk/x/distribution" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" @@ -40,7 +39,6 @@ import ( paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/cosmos/cosmos-sdk/x/slashing" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/atomone-hub/atomone/x/coredaos" @@ -51,6 +49,11 @@ import ( atomonegovv1 "github.com/atomone-hub/atomone/x/gov/types/v1" "github.com/atomone-hub/atomone/x/photon" photontypes "github.com/atomone-hub/atomone/x/photon/types" + + no_valupdates_genutil "github.com/allinbits/vaas/x/vaas/no_valupdates_genutil" + no_valupdates_staking "github.com/allinbits/vaas/x/vaas/no_valupdates_staking" + ibcprovider "github.com/allinbits/vaas/x/vaas/provider" + providertypes "github.com/allinbits/vaas/x/vaas/provider/types" ) var maccPerms = map[string][]string{ @@ -91,7 +94,7 @@ func appModules( )} return []module.AppModule{ - genutil.NewAppModule( + no_valupdates_genutil.NewAppModule( app.AccountKeeper, app.StakingKeeper, app.BaseApp, @@ -105,7 +108,7 @@ func appModules( 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), app.interfaceRegistry), 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)), + no_valupdates_staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), photon.NewAppModule(appCodec, *app.PhotonKeeper, app.BankKeeper, app.AccountKeeper, app.StakingKeeper), upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), evidence.NewAppModule(app.EvidenceKeeper), @@ -116,7 +119,7 @@ func appModules( consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), dynamicfee.NewAppModule(appCodec, *app.DynamicfeeKeeper), coredaos.NewAppModule(appCodec, *app.CoreDaosKeeper, app.GovKeeperWrapper, app.StakingKeeper, app.AccountKeeper, app.BankKeeper), - + ibcprovider.NewAppModule(&app.ProviderKeeper), app.TransferModule, app.ICAModule, app.TMClientModule, @@ -159,6 +162,7 @@ func orderBeginBlockers() []string { vestingtypes.ModuleName, consensusparamtypes.ModuleName, coredaostypes.ModuleName, + providertypes.ModuleName, } } @@ -193,6 +197,7 @@ func orderEndBlockers() []string { vestingtypes.ModuleName, consensusparamtypes.ModuleName, coredaostypes.ModuleName, + providertypes.ModuleName, } } @@ -226,5 +231,6 @@ func orderInitBlockers() []string { consensusparamtypes.ModuleName, dynamicfeetypes.ModuleName, coredaostypes.ModuleName, + providertypes.ModuleName, } } diff --git a/app/params/amino.go b/app/params/amino.go index 364e917b3..fee9b736a 100644 --- a/app/params/amino.go +++ b/app/params/amino.go @@ -1,5 +1,4 @@ //go:build test_amino -// +build test_amino package params diff --git a/app/sim_test.go b/app/sim_test.go index 3f734b67e..b2e3b3e7c 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -74,7 +74,7 @@ func TestAppStateDeterminism(t *testing.T) { fmt.Println("config.Seed: ", config.Seed) - for j := 0; j < numTimesToRunPerSeed; j++ { + for j := range numTimesToRunPerSeed { var logger log.Logger if simcli.FlagVerboseValue { logger = log.NewTestLogger(t) diff --git a/app/upgrades/types.go b/app/upgrades/types.go index 0dbf42e8f..2d5d7cd1b 100644 --- a/app/upgrades/types.go +++ b/app/upgrades/types.go @@ -4,6 +4,7 @@ import ( store "cosmossdk.io/store/types" upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" @@ -19,7 +20,7 @@ type Upgrade struct { UpgradeName string // CreateUpgradeHandler defines the function that creates an upgrade handler - CreateUpgradeHandler func(*module.Manager, module.Configurator, *keepers.AppKeepers) upgradetypes.UpgradeHandler + CreateUpgradeHandler func(*module.Manager, codec.Codec, module.Configurator, *keepers.AppKeepers) upgradetypes.UpgradeHandler // Store upgrades, should be used for any new modules introduced, new modules deleted, or store names renamed. StoreUpgrades store.StoreUpgrades diff --git a/app/upgrades/v2/upgrades.go b/app/upgrades/v2/upgrades.go index 0671a8cf4..45d97325c 100644 --- a/app/upgrades/v2/upgrades.go +++ b/app/upgrades/v2/upgrades.go @@ -5,6 +5,7 @@ import ( upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -19,6 +20,7 @@ import ( // - add new denom metadata for photon in the bank module store. func CreateUpgradeHandler( mm *module.Manager, + _ codec.Codec, configurator module.Configurator, keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { diff --git a/app/upgrades/v3/upgrades.go b/app/upgrades/v3/upgrades.go index ac8ebddc0..5cf41eb2c 100644 --- a/app/upgrades/v3/upgrades.go +++ b/app/upgrades/v3/upgrades.go @@ -9,6 +9,7 @@ import ( "cosmossdk.io/math" upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/codec" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" @@ -24,6 +25,7 @@ import ( // CreateUpgradeHandler returns a upgrade handler for AtomOne v3 func CreateUpgradeHandler( mm *module.Manager, + _ codec.Codec, configurator module.Configurator, keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { diff --git a/app/upgrades/v4/upgrades.go b/app/upgrades/v4/upgrades.go index fe3c35068..4565d3c93 100644 --- a/app/upgrades/v4/upgrades.go +++ b/app/upgrades/v4/upgrades.go @@ -2,11 +2,17 @@ package v4 import ( "context" + "errors" "fmt" + "cosmossdk.io/collections" + collcodec "cosmossdk.io/collections/codec" "cosmossdk.io/math" upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/runtime" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" @@ -14,12 +20,14 @@ import ( sdkgovv1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1" "github.com/atomone-hub/atomone/app/keepers" + v1 "github.com/atomone-hub/atomone/x/gov/types/v1" ) // CreateUpgradeHandler returns a upgrade handler for AtomOne v4 // This versions contains the upgrade to Cosmos SDK v0.50 and IBC v10 func CreateUpgradeHandler( mm *module.Manager, + cdc codec.Codec, configurator module.Configurator, keepers *keepers.AppKeepers, ) upgradetypes.UpgradeHandler { @@ -29,7 +37,9 @@ func CreateUpgradeHandler( return vm, err } - if err := initGovParams(ctx, keepers.GovKeeper); err != nil { + storeService := runtime.NewKVStoreService(keepers.GetKey(sdkgov.StoreKey)) + sb := collections.NewSchemaBuilder(storeService) + if err := migrateGovState(ctx, cdc, keepers.GovKeeper, sb); err != nil { return vm, err } @@ -37,19 +47,74 @@ func CreateUpgradeHandler( } } -// initGovParams initializes the missing gov modules added in AtomOne SDK v0.50. -func initGovParams(ctx context.Context, govKeeper *govkeeper.Keeper) error { - params, err := govKeeper.Params.Get(ctx) +// migrateGovState migrates all gov state from atomone.gov.v1 proto types to cosmos.gov.v1 proto types +// and initializes new params fields with default values. +func migrateGovState(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + var errs error + + if err := migrateParams(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov params: %w", err)) + } + + if err := migrateDeposits(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov deposits: %w", err)) + } + + if err := migrateVotes(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov votes: %w", err)) + } + + if err := migrateProposals(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov proposals: %w", err)) + } + + if err := migrateLastMinDeposit(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov last min deposit: %w", err)) + } + + if err := migrateLastMinInitialDeposit(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov last min initial deposit: %w", err)) + } + + if err := migrateQuorumCheckQueue(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov quorum check queue: %w", err)) + } + + if err := migrateGovernors(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov governors: %w", err)) + } + + if err := migrateGovernanceDelegations(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov governance delegations: %w", err)) + } + + if err := migrateGovernanceDelegationsByGovernor(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov governance delegations by governor: %w", err)) + } + + if err := migrateValidatorSharesByGovernor(ctx, cdc, govKeeper, sb); err != nil { + errs = errors.Join(errs, fmt.Errorf("failed to migrate gov validator shares by governor: %w", err)) + } + + return errs +} + +// migrateParams migrates Params from atomone.gov.v1 to cosmos.gov.v1 and sets new default values. +func migrateParams(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + paramsItem := collections.NewItem(sb, sdkgov.ParamsKey, "params", paramsValueCodec(cdc)) + + params, err := paramsItem.Get(ctx) if err != nil { - return err + return fmt.Errorf("failed to get params: %w", err) } + // Set new params fields to default values defaultParams := sdkgovv1.DefaultParams() params.ProposalCancelRatio = defaultParams.ProposalCancelRatio params.ProposalCancelDest = authtypes.NewModuleAddress(sdkgov.ModuleName).String() params.MinDepositRatio = defaultParams.MinDepositRatio params.GovernorStatusChangePeriod = defaultParams.GovernorStatusChangePeriod - params.MinGovernorSelfDelegation = math.NewInt(10000_000000).String() // to be elegible as governor must have 10K ATONE staked + params.MinGovernorSelfDelegation = math.NewInt(10000_000000).String() // to be eligible as governor must have 10K ATONE staked if err := govKeeper.Params.Set(ctx, params); err != nil { return fmt.Errorf("failed to set gov params: %w", err) @@ -57,3 +122,454 @@ func initGovParams(ctx context.Context, govKeeper *govkeeper.Keeper) error { return nil } + +// migrateDeposits migrates Deposits from atomone.gov.v1 to cosmos.gov.v1. +func migrateDeposits(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + depositsMap := collections.NewMap( + sb, + sdkgov.DepositsKeyPrefix, + "deposits", + collections.PairKeyCodec(collections.Uint64Key, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), //nolint: staticcheck + depositValueCodec(cdc), + ) + + iter, err := depositsMap.Iterate(ctx, nil) + if err != nil { + return fmt.Errorf("failed to iterate deposits: %w", err) + } + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + key, err := iter.Key() + if err != nil { + return fmt.Errorf("failed to get deposit key: %w", err) + } + deposit, err := iter.Value() + if err != nil { + return fmt.Errorf("failed to get deposit value: %w", err) + } + + // Write back with new SDK type + if err := govKeeper.Deposits.Set(ctx, key, deposit); err != nil { + return fmt.Errorf("failed to set deposit: %w", err) + } + } + + return nil +} + +// migrateVotes migrates Votes from atomone.gov.v1 to cosmos.gov.v1. +func migrateVotes(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + votesMap := collections.NewMap( + sb, + sdkgov.VotesKeyPrefix, + "votes", + collections.PairKeyCodec(collections.Uint64Key, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), //nolint: staticcheck + voteValueCodec(cdc), + ) + + iter, err := votesMap.Iterate(ctx, nil) + if err != nil { + return fmt.Errorf("failed to iterate votes: %w", err) + } + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + key, err := iter.Key() + if err != nil { + return fmt.Errorf("failed to get vote key: %w", err) + } + vote, err := iter.Value() + if err != nil { + return fmt.Errorf("failed to get vote value: %w", err) + } + + // Write back with new SDK type + if err := govKeeper.Votes.Set(ctx, key, vote); err != nil { + return fmt.Errorf("failed to set vote: %w", err) + } + } + + return nil +} + +// migrateProposals migrates Proposals from atomone.gov.v1 to cosmos.gov.v1. +func migrateProposals(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + proposalsMap := collections.NewMap( + sb, + sdkgov.ProposalsKeyPrefix, + "proposals", + collections.Uint64Key, + proposalValueCodec(cdc), + ) + + iter, err := proposalsMap.Iterate(ctx, nil) + if err != nil { + return fmt.Errorf("failed to iterate proposals: %w", err) + } + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + key, err := iter.Key() + if err != nil { + return fmt.Errorf("failed to get proposal key: %w", err) + } + proposal, err := iter.Value() + if err != nil { + return fmt.Errorf("failed to get proposal value: %w", err) + } + + // Write back with new SDK type + if err := govKeeper.Proposals.Set(ctx, key, proposal); err != nil { + return fmt.Errorf("failed to set proposal: %w", err) + } + } + + return nil +} + +// migrateLastMinDeposit migrates LastMinDeposit from atomone.gov.v1 to cosmos.gov.v1. +func migrateLastMinDeposit(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + lastMinDepositItem := collections.NewItem( + sb, + sdkgov.LastMinDepositKey, + "last_min_deposit", + lastMinDepositValueCodec(cdc), + ) + + lastMinDeposit, err := lastMinDepositItem.Get(ctx) + if err != nil { + // If not set, skip migration + if err.Error() == "collections: not found" { + return nil + } + return fmt.Errorf("failed to get last min deposit: %w", err) + } + + // Write back with new SDK type + if err := govKeeper.LastMinDeposit.Set(ctx, lastMinDeposit); err != nil { + return fmt.Errorf("failed to set last min deposit: %w", err) + } + + return nil +} + +// migrateLastMinInitialDeposit migrates LastMinInitialDeposit from atomone.gov.v1 to cosmos.gov.v1. +func migrateLastMinInitialDeposit(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + lastMinInitialDepositItem := collections.NewItem( + sb, + sdkgov.LastMinInitialDepositKey, + "last_min_initial_deposit", + lastMinDepositValueCodec(cdc), + ) + + lastMinInitialDeposit, err := lastMinInitialDepositItem.Get(ctx) + if err != nil { + // If not set, skip migration + if err.Error() == "collections: not found" { + return nil + } + return fmt.Errorf("failed to get last min initial deposit: %w", err) + } + + // Write back with new SDK type + if err := govKeeper.LastMinInitialDeposit.Set(ctx, lastMinInitialDeposit); err != nil { + return fmt.Errorf("failed to set last min initial deposit: %w", err) + } + + return nil +} + +// migrateQuorumCheckQueue migrates QuorumCheckQueue from atomone.gov.v1 to cosmos.gov.v1. +func migrateQuorumCheckQueue(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + quorumCheckQueueMap := collections.NewMap( + sb, + sdkgov.QuorumCheckQueuePrefix, + "quorum_check_queue", + collections.PairKeyCodec(sdk.TimeKey, collections.Uint64Key), + quorumCheckQueueEntryValueCodec(cdc), + ) + + iter, err := quorumCheckQueueMap.Iterate(ctx, nil) + if err != nil { + return fmt.Errorf("failed to iterate quorum check queue: %w", err) + } + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + key, err := iter.Key() + if err != nil { + return fmt.Errorf("failed to get quorum check queue key: %w", err) + } + entry, err := iter.Value() + if err != nil { + return fmt.Errorf("failed to get quorum check queue entry: %w", err) + } + + // Write back with new SDK type + if err := govKeeper.QuorumCheckQueue.Set(ctx, key, entry); err != nil { + return fmt.Errorf("failed to set quorum check queue entry: %w", err) + } + } + + return nil +} + +// migrateGovernors migrates Governors from atomone.gov.v1 to cosmos.gov.v1. +func migrateGovernors(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + governorsMap := collections.NewMap( + sb, + sdkgov.GovernorsKeyPrefix, + "governors", + sdkgov.GovernorAddressKey, + governorValueCodec(cdc), + ) + + iter, err := governorsMap.Iterate(ctx, nil) + if err != nil { + return fmt.Errorf("failed to iterate governors: %w", err) + } + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + key, err := iter.Key() + if err != nil { + return fmt.Errorf("failed to get governor key: %w", err) + } + governor, err := iter.Value() + if err != nil { + return fmt.Errorf("failed to get governor value: %w", err) + } + + // Write back with new SDK type + if err := govKeeper.Governors.Set(ctx, key, governor); err != nil { + return fmt.Errorf("failed to set governor: %w", err) + } + } + + return nil +} + +// migrateGovernanceDelegations migrates GovernanceDelegations from atomone.gov.v1 to cosmos.gov.v1. +func migrateGovernanceDelegations(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + governanceDelegationsMap := collections.NewMap( + sb, + sdkgov.GovernanceDelegationKeyPrefix, + "governance_delegations", + sdk.AccAddressKey, + governanceDelegationValueCodec(cdc), + ) + + iter, err := governanceDelegationsMap.Iterate(ctx, nil) + if err != nil { + return fmt.Errorf("failed to iterate governance delegations: %w", err) + } + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + key, err := iter.Key() + if err != nil { + return fmt.Errorf("failed to get governance delegation key: %w", err) + } + delegation, err := iter.Value() + if err != nil { + return fmt.Errorf("failed to get governance delegation value: %w", err) + } + + // Write back with new SDK type + if err := govKeeper.GovernanceDelegations.Set(ctx, key, delegation); err != nil { + return fmt.Errorf("failed to set governance delegation: %w", err) + } + } + + return nil +} + +// migrateGovernanceDelegationsByGovernor migrates GovernanceDelegationsByGovernor from atomone.gov.v1 to cosmos.gov.v1. +func migrateGovernanceDelegationsByGovernor(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + governanceDelegationsByGovernorMap := collections.NewMap( + sb, + sdkgov.GovernanceDelegationsByGovernorKeyPrefix, + "governance_delegations_by_governor", + collections.PairKeyCodec(sdkgov.GovernorAddressKey, sdk.AccAddressKey), + governanceDelegationValueCodec(cdc), + ) + + iter, err := governanceDelegationsByGovernorMap.Iterate(ctx, nil) + if err != nil { + return fmt.Errorf("failed to iterate governance delegations by governor: %w", err) + } + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + key, err := iter.Key() + if err != nil { + return fmt.Errorf("failed to get governance delegation by governor key: %w", err) + } + delegation, err := iter.Value() + if err != nil { + return fmt.Errorf("failed to get governance delegation by governor value: %w", err) + } + + // Write back with new SDK type + if err := govKeeper.GovernanceDelegationsByGovernor.Set(ctx, key, delegation); err != nil { + return fmt.Errorf("failed to set governance delegation by governor: %w", err) + } + } + + return nil +} + +// migrateValidatorSharesByGovernor migrates ValidatorSharesByGovernor from atomone.gov.v1 to cosmos.gov.v1. +func migrateValidatorSharesByGovernor(ctx context.Context, cdc codec.Codec, govKeeper *govkeeper.Keeper, sb *collections.SchemaBuilder) error { + validatorSharesByGovernorMap := collections.NewMap( + sb, + sdkgov.ValidatorSharesByGovernorKeyPrefix, + "validator_shares_by_governor", + collections.PairKeyCodec(sdkgov.GovernorAddressKey, sdk.ValAddressKey), + governorValSharesValueCodec(cdc), + ) + + iter, err := validatorSharesByGovernorMap.Iterate(ctx, nil) + if err != nil { + return fmt.Errorf("failed to iterate validator shares by governor: %w", err) + } + defer iter.Close() + + for ; iter.Valid(); iter.Next() { + key, err := iter.Key() + if err != nil { + return fmt.Errorf("failed to get validator shares by governor key: %w", err) + } + valShares, err := iter.Value() + if err != nil { + return fmt.Errorf("failed to get validator shares by governor value: %w", err) + } + + // Write back with new SDK type + if err := govKeeper.ValidatorSharesByGovernor.Set(ctx, key, valShares); err != nil { + return fmt.Errorf("failed to set validator shares by governor: %w", err) + } + } + + return nil +} + +// Value codecs that decode atomone.gov.v1 types and convert to cosmos.gov.v1 types + +// paramsValueCodec is a codec for encoding params in a backward compatible way +func paramsValueCodec(cdc codec.Codec) collcodec.ValueCodec[sdkgovv1.Params] { + return collcodec.NewAltValueCodec(codec.CollValue[sdkgovv1.Params](cdc), func(bytes []byte) (sdkgovv1.Params, error) { + c := new(v1.Params) + err := cdc.Unmarshal(bytes, c) + if err != nil { + return sdkgovv1.Params{}, err + } + + return *v1.ConvertAtomOneParamsToSDK(c), nil + }) +} + +// depositValueCodec is a codec for encoding deposits in a backward compatible way +func depositValueCodec(cdc codec.Codec) collcodec.ValueCodec[sdkgovv1.Deposit] { + return collcodec.NewAltValueCodec(codec.CollValue[sdkgovv1.Deposit](cdc), func(bytes []byte) (sdkgovv1.Deposit, error) { + c := new(v1.Deposit) + err := cdc.Unmarshal(bytes, c) + if err != nil { + return sdkgovv1.Deposit{}, err + } + + return *v1.ConvertAtomOneDepositToSDK(c), nil + }) +} + +// voteValueCodec is a codec for encoding votes in a backward compatible way +func voteValueCodec(cdc codec.Codec) collcodec.ValueCodec[sdkgovv1.Vote] { + return collcodec.NewAltValueCodec(codec.CollValue[sdkgovv1.Vote](cdc), func(bytes []byte) (sdkgovv1.Vote, error) { + c := new(v1.Vote) + err := cdc.Unmarshal(bytes, c) + if err != nil { + return sdkgovv1.Vote{}, err + } + + return *v1.ConvertAtomOneVoteToSDK(c), nil + }) +} + +// proposalValueCodec is a codec for encoding proposals in a backward compatible way +func proposalValueCodec(cdc codec.Codec) collcodec.ValueCodec[sdkgovv1.Proposal] { + return collcodec.NewAltValueCodec(codec.CollValue[sdkgovv1.Proposal](cdc), func(bytes []byte) (sdkgovv1.Proposal, error) { + c := new(v1.Proposal) + err := cdc.Unmarshal(bytes, c) + if err != nil { + return sdkgovv1.Proposal{}, err + } + + return *v1.ConvertAtomOneProposalToSDK(c), nil + }) +} + +// lastMinDepositValueCodec is a codec for encoding last min deposits in a backward compatible way +func lastMinDepositValueCodec(cdc codec.Codec) collcodec.ValueCodec[sdkgovv1.LastMinDeposit] { + return collcodec.NewAltValueCodec(codec.CollValue[sdkgovv1.LastMinDeposit](cdc), func(bytes []byte) (sdkgovv1.LastMinDeposit, error) { + c := new(v1.LastMinDeposit) + err := cdc.Unmarshal(bytes, c) + if err != nil { + return sdkgovv1.LastMinDeposit{}, err + } + + return *v1.ConvertAtomOneLastMinDepositToSDK(c), nil + }) +} + +// quorumCheckQueueEntryValueCodec is a codec for encoding quorum check queue entries in a backward compatible way +func quorumCheckQueueEntryValueCodec(cdc codec.Codec) collcodec.ValueCodec[sdkgovv1.QuorumCheckQueueEntry] { + return collcodec.NewAltValueCodec(codec.CollValue[sdkgovv1.QuorumCheckQueueEntry](cdc), func(bytes []byte) (sdkgovv1.QuorumCheckQueueEntry, error) { + c := new(v1.QuorumCheckQueueEntry) + err := cdc.Unmarshal(bytes, c) + if err != nil { + return sdkgovv1.QuorumCheckQueueEntry{}, err + } + + return *v1.ConvertAtomOneQuorumCheckQueueEntryToSDK(c), nil + }) +} + +// governorValueCodec is a codec for encoding governors in a backward compatible way +func governorValueCodec(cdc codec.Codec) collcodec.ValueCodec[sdkgovv1.Governor] { + return collcodec.NewAltValueCodec(codec.CollValue[sdkgovv1.Governor](cdc), func(bytes []byte) (sdkgovv1.Governor, error) { + c := new(v1.Governor) + err := cdc.Unmarshal(bytes, c) + if err != nil { + return sdkgovv1.Governor{}, err + } + + return *v1.ConvertAtomOneGovernorToSDK(c), nil + }) +} + +// governanceDelegationValueCodec is a codec for encoding governance delegations in a backward compatible way +func governanceDelegationValueCodec(cdc codec.Codec) collcodec.ValueCodec[sdkgovv1.GovernanceDelegation] { + return collcodec.NewAltValueCodec(codec.CollValue[sdkgovv1.GovernanceDelegation](cdc), func(bytes []byte) (sdkgovv1.GovernanceDelegation, error) { + c := new(v1.GovernanceDelegation) + err := cdc.Unmarshal(bytes, c) + if err != nil { + return sdkgovv1.GovernanceDelegation{}, err + } + + return *v1.ConvertAtomOneGovernanceDelegationToSDK(c), nil + }) +} + +// governorValSharesValueCodec is a codec for encoding governor val shares in a backward compatible way +func governorValSharesValueCodec(cdc codec.Codec) collcodec.ValueCodec[sdkgovv1.GovernorValShares] { + return collcodec.NewAltValueCodec(codec.CollValue[sdkgovv1.GovernorValShares](cdc), func(bytes []byte) (sdkgovv1.GovernorValShares, error) { + c := new(v1.GovernorValShares) + err := cdc.Unmarshal(bytes, c) + if err != nil { + return sdkgovv1.GovernorValShares{}, err + } + + return *v1.ConvertAtomOneGovernorValSharesToSDK(c), nil + }) +} diff --git a/cmd/atomoned/cmd/root.go b/cmd/atomoned/cmd/root.go index e80fe4c42..00eca806b 100644 --- a/cmd/atomoned/cmd/root.go +++ b/cmd/atomoned/cmd/root.go @@ -119,7 +119,7 @@ func initTendermintConfig() *tmcfg.Config { return cfg } -func initAppConfig() (string, interface{}) { +func initAppConfig() (string, any) { // Embed additional configurations type CustomAppConfig struct { serverconfig.Config diff --git a/cmd/atomoned/cmd/testnet.go b/cmd/atomoned/cmd/testnet.go index 859667f4b..6cbf61e6e 100644 --- a/cmd/atomoned/cmd/testnet.go +++ b/cmd/atomoned/cmd/testnet.go @@ -407,7 +407,7 @@ func initGenFiles( } // generate empty genesis files for each validator and save - for i := 0; i < numValidators; i++ { + for i := range numValidators { if err := genDoc.SaveAs(genFiles[i]); err != nil { return err } @@ -423,7 +423,7 @@ func collectGenFiles( var appState json.RawMessage genTime := tmtime.Now() - for i := 0; i < numValidators; i++ { + for i := range numValidators { nodeDirName := fmt.Sprintf("%s%d", nodeDirPrefix, i) nodeDir := filepath.Join(outputDir, nodeDirName, nodeDaemonHome) gentxsDir := filepath.Join(outputDir, "gentxs") @@ -476,7 +476,7 @@ func calculateIP(ip string, i int) (string, error) { return "", fmt.Errorf("%v: non ipv4 address", ip) } - for j := 0; j < i; j++ { + for range i { ipv4[3]++ } diff --git a/contrib/devdeps/go.mod b/contrib/devdeps/go.mod index 9263e141d..e8626ac6a 100644 --- a/contrib/devdeps/go.mod +++ b/contrib/devdeps/go.mod @@ -1,6 +1,6 @@ module github.com/atomone-hub/atomone/contrib/devdeps -go 1.23.0 +go 1.26.1 require ( github.com/golang/mock v1.6.0 diff --git a/contrib/localnet/proposal_upgrade.json b/contrib/localnet/proposal_upgrade.json index c1088f757..6d31145b1 100644 --- a/contrib/localnet/proposal_upgrade.json +++ b/contrib/localnet/proposal_upgrade.json @@ -1,19 +1,19 @@ { - "messages": [ - { - "@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", - "authority": "atone10d07y265gmmuvt4z0w9aw880jnsr700j5z0zqt", - "plan": { - "name": "v3", - "time": "0001-01-01T00:00:00Z", - "height": "80", - "info": "", - "upgraded_client_state": null - } - } - ], - "metadata": "ipfs://CID", - "deposit": "512000000uatone", - "title": "v3", - "summary": "v3" + "messages": [ + { + "@type": "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + "authority": "atone10d07y265gmmuvt4z0w9aw880jnsr700j5z0zqt", + "plan": { + "name": "v4", + "time": "0001-01-01T00:00:00Z", + "height": "30", + "info": "", + "upgraded_client_state": null + } + } + ], + "metadata": "ipfs://CID", + "deposit": "512000000uatone", + "title": "v4", + "summary": "v4" } diff --git a/contrib/scripts/upgrade-node.sh b/contrib/scripts/upgrade-node.sh new file mode 100755 index 000000000..a7380f355 --- /dev/null +++ b/contrib/scripts/upgrade-node.sh @@ -0,0 +1,135 @@ +#!/bin/bash + +set -e + +# Usage ATOMONED_BIN=$(which simd) ATOMONED_NEW_BIN= ./upgrade.sh + +if [[ -z $ATOMONED_BIN || -z $ATOMONED_NEW_BIN ]]; then + echo "ATOMONED_BIN and ATOMONED_NEW_BIN must be set." + exit 1 +fi + +script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +proposal_path="$script_dir/../localnet/proposal_upgrade.json" +localnet_home=~/.atomone-localnet +localnetd="$ATOMONED_BIN --home $localnet_home" +localnetd_new="$ATOMONED_NEW_BIN --home $localnet_home" + +echo "Killing any running chain processes..." +pkill -f "atomoned.*start" || true +sleep 2 + +echo "init with previous atomoned binary" +rm -rf $localnet_home prev.log new.log +$localnetd init localnet --default-denom uatone --chain-id localnet +$localnetd config chain-id localnet +$localnetd config keyring-backend test +$localnetd keys add val +$localnetd genesis add-genesis-account val 1000000000000uatone,1000000000uphoton +$localnetd keys add user +$localnetd genesis add-genesis-account user 100000000000uatone,1000000000uphoton +$localnetd genesis gentx val 1000000000uatone +$localnetd genesis collect-gentxs +# Add treasury DAO address +$localnetd genesis add-genesis-account atone1qqqqqqqqqqqqqqqqqqqqqqqqqqqqp0dqtalx52 5388766663072uatone +# Add CP funds +$localnetd genesis add-genesis-account atone1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8flcml8 5388766663072uatone +jq '.app_state.distribution.fee_pool.community_pool = [ { "denom": "uatone", "amount": "5388766663072.000000000000000000" }]' $localnet_home/config/genesis.json > /tmp/gen +mv /tmp/gen $localnet_home/config/genesis.json +# Previous add-genesis-account call added the auth module account as a BaseAccount, we need to remove it +jq 'del(.app_state.auth.accounts[] | select(.address == "atone1jv65s3grqf6v6jl3dp4t6c9t9rk99cd8flcml8"))' $localnet_home/config/genesis.json > /tmp/gen +mv /tmp/gen $localnet_home/config/genesis.json +# Set validator gas prices +sed -i.bak 's#^minimum-gas-prices = .*#minimum-gas-prices = "0.01uatone,0.01uphoton"#g' $localnet_home/config/app.toml +# enable REST API +sed -i -z 's/# Enable defines if the API server should be enabled.\nenable = false/enable = true/' $localnet_home/config/app.toml +# Decrease voting period to 1min +jq '.app_state.gov.params.voting_period = "60s"' $localnet_home/config/genesis.json > /tmp/gen +mv /tmp/gen $localnet_home/config/genesis.json +# Lower threshold to 0.01 +jq '.app_state.gov.params.threshold = "0.010000000000000000"' $localnet_home/config/genesis.json > /tmp/gen +mv /tmp/gen $localnet_home/config/genesis.json +jq --rawfile data contrib/localnet/constitution-mock.md '.app_state.gov.constitution=$data' $localnet_home/config/genesis.json > /tmp/gen +mv /tmp/gen $localnet_home/config/genesis.json +echo "Start old chain..." +$localnetd start --log_format json &> prev.log & +sleep 10 +echo "Stake tokens for user to be able to vote" +stake_tx=$($localnetd tx staking delegate $($localnetd keys show val --bech val -a) 10000000000uatone --from user --fees 10000uphoton --yes --output json) +stake_txhash=$(echo "$stake_tx" | jq -r '.txhash') +echo "Stake tx hash: $stake_txhash" +sleep 6 +echo "Querying stake transaction..." +stake_result=$($localnetd q tx "$stake_txhash" --output json) +stake_code=$(echo "$stake_result" | jq -r '.code') +if [ "$stake_code" != "0" ]; then + echo "Stake transaction failed with code $stake_code" + echo "$stake_result" | jq + exit 1 +fi +echo "Submitting Upgrade Proposal" +proposal_tx=$($localnetd tx gov submit-proposal "$proposal_path" --from user --fees 10000uphoton --yes --output json) +proposal_txhash=$(echo "$proposal_tx" | jq -r '.txhash') +echo "Proposal tx hash: $proposal_txhash" +sleep 6 +echo "Querying proposal transaction..." +proposal_result=$($localnetd q tx "$proposal_txhash" --output json) +proposal_code=$(echo "$proposal_result" | jq -r '.code') +if [ "$proposal_code" != "0" ]; then + echo "Proposal transaction failed with code $proposal_code" + echo "$proposal_result" | jq + exit 1 +fi +deposit_tx=$($localnetd tx gov deposit 1 10000000uatone --from val --fees 10000uphoton --yes --output json) +deposit_txhash=$(echo "$deposit_tx" | jq -r '.txhash') +echo "Deposit tx hash: $deposit_txhash" +sleep 6 +echo "Querying deposit transaction..." +deposit_result=$($localnetd q tx "$deposit_txhash" --output json) +deposit_code=$(echo "$deposit_result" | jq -r '.code') +if [ "$deposit_code" != "0" ]; then + echo "Deposit transaction failed with code $deposit_code" + echo "$deposit_result" | jq + exit 1 +fi +vote_tx=$($localnetd tx gov vote 1 yes --from user --fees 10000uphoton --yes --output json) +vote_txhash=$(echo "$vote_tx" | jq -r '.txhash') +echo "Vote tx hash: $vote_txhash" +sleep 6 +echo "Querying vote transaction..." +vote_result=$($localnetd q tx "$vote_txhash" --output json) +vote_code=$(echo "$vote_result" | jq -r '.code') +if [ "$vote_code" != "0" ]; then + echo "Vote transaction failed with code $vote_code" + echo "$vote_result" | jq + exit 1 +fi +# Query proposal to get upgrade height +upgrade_height=$($localnetd q gov proposal 1 --output json | jq -r '.messages[0].plan.height') +echo "Proposal should pass! Chain will halt at block height: $upgrade_height" +echo "Waiting for chain to reach upgrade height..." + +# Poll chain height until it reaches upgrade height +while true; do + current_height=$($localnetd status 2>&1 | jq -r '.SyncInfo.latest_block_height' 2>/dev/null || echo "0") + echo "Current height: $current_height / Upgrade height: $upgrade_height" + + if [ "$current_height" -ge "$upgrade_height" ]; then + echo "Upgrade height reached!" + break + fi + + sleep 2 +done + +sleep 5 + +echo "Displaying last 6 lines of previous binary logs:" +tail -n 6 prev.log + +echo "Killing old binary..." +pkill -f "$ATOMONED_BIN" || true +sleep 2 + +echo "Starting new binary..." +$localnetd_new start --log_format json diff --git a/go.mod b/go.mod index 6315574e8..28e3b2f4e 100644 --- a/go.mod +++ b/go.mod @@ -1,12 +1,15 @@ module github.com/atomone-hub/atomone -go 1.24.5 +go 1.26.0 replace ( + cosmossdk.io/x/evidence => cosmossdk.io/x/evidence v0.1.1 cosmossdk.io/x/feegrant => cosmossdk.io/x/feegrant v0.1.1 - cosmossdk.io/x/upgrade => github.com/atomone-hub/cosmos-sdk/x/upgrade v0.1.5-atomone.1.0.20251218143825-cbb67818e94a - github.com/cosmos/cosmos-sdk => github.com/atomone-hub/cosmos-sdk v0.50.14-atomone.1.0.20251218143825-cbb67818e94a - github.com/cosmos/ibc-go/v10 => github.com/cosmos/ibc-go/v10 v10.2.0 + cosmossdk.io/x/upgrade => github.com/atomone-hub/cosmos-sdk/x/upgrade v0.1.5-atomone.2 + // https://github.com/allinbits/vaas/pull/18 + github.com/allinbits/vaas => github.com/allinbits/vaas v0.0.0-20260303111645-6fb95c511621 + github.com/cosmos/cosmos-sdk => github.com/atomone-hub/cosmos-sdk v0.50.15-atomone.1 + github.com/cosmos/ibc-go/v10 => github.com/cosmos/ibc-go/v10 v10.5.0 ) require ( @@ -14,23 +17,24 @@ require ( cosmossdk.io/client/v2 v2.0.0-beta.11 cosmossdk.io/collections v1.2.1 cosmossdk.io/core v0.11.3 - cosmossdk.io/depinject v1.2.0 + cosmossdk.io/depinject v1.2.1 cosmossdk.io/errors v1.0.2 - cosmossdk.io/log v1.5.1 + cosmossdk.io/log v1.6.1 cosmossdk.io/math v1.5.3 cosmossdk.io/store v1.1.2 cosmossdk.io/tools/confix v0.1.2 - cosmossdk.io/x/evidence v0.1.1 + cosmossdk.io/x/evidence v0.2.0 cosmossdk.io/x/feegrant v0.1.1 cosmossdk.io/x/tx v0.14.0 cosmossdk.io/x/upgrade v0.2.0 + github.com/allinbits/vaas v0.0.0-00010101000000-000000000000 github.com/cometbft/cometbft v0.38.21 - github.com/cosmos/cosmos-db v1.1.1 + github.com/cosmos/cosmos-db v1.1.3 github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.53.0 + github.com/cosmos/cosmos-sdk v0.53.4 github.com/cosmos/go-bip39 v1.0.0 github.com/cosmos/gogoproto v1.7.2 - github.com/cosmos/ibc-go/v10 v10.2.0 + github.com/cosmos/ibc-go/v10 v10.5.0 github.com/cosmos/ics23/go v0.11.0 github.com/gnolang/gno v0.0.0-20260114150639-ccf1cf93844b github.com/golang/mock v1.6.0 @@ -40,8 +44,8 @@ require ( github.com/grpc-ecosystem/grpc-gateway v1.16.0 github.com/ory/dockertest/v3 v3.10.0 github.com/spf13/cast v1.9.2 - github.com/spf13/cobra v1.9.1 - github.com/spf13/pflag v1.0.6 + github.com/spf13/cobra v1.10.1 + github.com/spf13/pflag v1.0.9 github.com/spf13/viper v1.20.1 github.com/stretchr/testify v1.11.1 golang.org/x/sync v0.16.0 @@ -96,12 +100,13 @@ require ( github.com/bits-and-blooms/bitset v1.22.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.5 // indirect github.com/btcsuite/btcd/btcutil v1.1.6 // indirect - github.com/bytedance/sonic v1.14.0 // indirect - github.com/bytedance/sonic/loader v0.3.0 // indirect + github.com/bytedance/gopkg v0.1.3 // indirect + github.com/bytedance/sonic v1.15.0 // indirect + github.com/bytedance/sonic/loader v0.5.0 // indirect github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect - github.com/cloudwego/base64x v0.1.5 // indirect + github.com/cloudwego/base64x v0.1.6 // indirect github.com/cncf/xds/go v0.0.0-20250501225837-2ac532fd4443 // indirect github.com/cockroachdb/errors v1.12.0 // indirect github.com/cockroachdb/fifo v0.0.0-20240616162244-4768e80dfb9a // indirect @@ -125,14 +130,14 @@ require ( github.com/dgraph-io/ristretto v0.2.0 // indirect github.com/docker/cli v24.0.7+incompatible // indirect github.com/docker/docker v20.10.19+incompatible // indirect - github.com/docker/go-connections v0.4.0 // indirect + github.com/docker/go-connections v0.5.0 // indirect github.com/docker/go-units v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.7.0 // indirect github.com/emicklei/dot v1.6.2 // indirect github.com/envoyproxy/go-control-plane/envoy v1.32.4 // indirect github.com/envoyproxy/protoc-gen-validate v1.2.1 // indirect - github.com/ethereum/go-ethereum v1.15.10 // indirect + github.com/ethereum/go-ethereum v1.15.11 // indirect github.com/fatih/color v1.18.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -148,7 +153,7 @@ require ( github.com/gogo/googleapis v1.4.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/groupcache v0.0.0-20241129210726-2c02b8208cf8 // indirect - github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect + github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e // indirect github.com/google/btree v1.1.3 // indirect github.com/google/flatbuffers v24.3.25+incompatible // indirect github.com/google/go-cmp v0.7.0 // indirect @@ -200,7 +205,7 @@ require ( github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect github.com/oklog/run v1.1.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect - github.com/opencontainers/image-spec v1.1.0-rc2 // indirect + github.com/opencontainers/image-spec v1.1.0-rc5 // indirect github.com/opencontainers/runc v1.1.12 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/petermattis/goid v0.0.0-20240813172612-4fcff4a6cae7 // indirect @@ -246,9 +251,11 @@ require ( go.opentelemetry.io/otel/sdk v1.38.0 // indirect go.opentelemetry.io/otel/sdk/metric v1.38.0 // indirect go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.uber.org/mock v0.6.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/arch v0.15.0 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect + golang.org/x/arch v0.17.0 // indirect golang.org/x/crypto v0.41.0 // indirect golang.org/x/exp v0.0.0-20250305212735-054e65f0b394 // indirect golang.org/x/net v0.43.0 // indirect @@ -264,7 +271,7 @@ require ( gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.2 // indirect nhooyr.io/websocket v1.8.11 // indirect - sigs.k8s.io/yaml v1.4.0 // indirect + sigs.k8s.io/yaml v1.6.0 // indirect ) replace ( diff --git a/go.sum b/go.sum index b526e24a3..781c29bec 100644 --- a/go.sum +++ b/go.sum @@ -30,12 +30,12 @@ cosmossdk.io/collections v1.2.1 h1:mAlNMs5vJwkda4TA+k5q/43p24RVAQ/qyDrjANu3BXE= cosmossdk.io/collections v1.2.1/go.mod h1:PSsEJ/fqny0VPsHLFT6gXDj/2C1tBOTS9eByK0+PBFU= cosmossdk.io/core v0.11.3 h1:mei+MVDJOwIjIniaKelE3jPDqShCc/F4LkNNHh+4yfo= cosmossdk.io/core v0.11.3/go.mod h1:9rL4RE1uDt5AJ4Tg55sYyHWXA16VmpHgbe0PbJc6N2Y= -cosmossdk.io/depinject v1.2.0 h1:6NW/FSK1IkWTrX7XxUpBmX1QMBozpEI9SsWkKTBc5zw= -cosmossdk.io/depinject v1.2.0/go.mod h1:pvitjtUxZZZTQESKNS9KhGjWVslJZxtO9VooRJYyPjk= +cosmossdk.io/depinject v1.2.1 h1:eD6FxkIjlVaNZT+dXTQuwQTKZrFZ4UrfCq1RKgzyhMw= +cosmossdk.io/depinject v1.2.1/go.mod h1:lqQEycz0H2JXqvOgVwTsjEdMI0plswI7p6KX+MVqFOM= cosmossdk.io/errors v1.0.2 h1:wcYiJz08HThbWxd/L4jObeLaLySopyyuUFB5w4AGpCo= cosmossdk.io/errors v1.0.2/go.mod h1:0rjgiHkftRYPj//3DrD6y8hcm40HcPv/dR4R/4efr0k= -cosmossdk.io/log v1.5.1 h1:wLwiYXmfrort/O+j6EkjF+HvbdrRQd+4cYCPKFSm+zM= -cosmossdk.io/log v1.5.1/go.mod h1:5cXXBvfBkR2/BcXmosdCSLXllvgSjphrrDVdfVRmBGM= +cosmossdk.io/log v1.6.1 h1:YXNwAgbDwMEKwDlCdH8vPcoggma48MgZrTQXCfmMBeI= +cosmossdk.io/log v1.6.1/go.mod h1:gMwsWyyDBjpdG9u2avCFdysXqxq28WJapJvu+vF1y+E= cosmossdk.io/math v1.5.3 h1:WH6tu6Z3AUCeHbeOSHg2mt9rnoiUWVWaQ2t6Gkll96U= cosmossdk.io/math v1.5.3/go.mod h1:uqcZv7vexnhMFJF+6zh9EWdm/+Ylyln34IvPnBauPCQ= cosmossdk.io/schema v1.1.0 h1:mmpuz3dzouCoyjjcMcA/xHBEmMChN+EHh8EHxHRHhzE= @@ -90,6 +90,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= +github.com/allinbits/vaas v0.0.0-20260303111645-6fb95c511621 h1:4RKFTgmrdWYCRJtmXSvzGKkwZcq+b6PRMDVA52oAlJA= +github.com/allinbits/vaas v0.0.0-20260303111645-6fb95c511621/go.mod h1:7QAUUYJrtwGbEIIjl8eMYqpMFGixiAhUB1cuhA0SFNQ= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= @@ -98,10 +100,10 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= -github.com/atomone-hub/cosmos-sdk v0.50.14-atomone.1.0.20251218143825-cbb67818e94a h1:Q8/YS/lWw2+EGsDe1qd9ljKJbfBZ+p4w4Z9toqKUDM4= -github.com/atomone-hub/cosmos-sdk v0.50.14-atomone.1.0.20251218143825-cbb67818e94a/go.mod h1:Ga+HHYYVVJ+32dKLM7RZxPTy2PfU8WDeR/4E0g8oL1E= -github.com/atomone-hub/cosmos-sdk/x/upgrade v0.1.5-atomone.1.0.20251218143825-cbb67818e94a h1:hoLPN0l4Z3ndSDoxyAFz9eRAKYsj49px/dYz4feX0BQ= -github.com/atomone-hub/cosmos-sdk/x/upgrade v0.1.5-atomone.1.0.20251218143825-cbb67818e94a/go.mod h1:Fj4o8oq4Ek3aiuzeG5haL4ExKY3MHndz8J/F7q3PguE= +github.com/atomone-hub/cosmos-sdk v0.50.15-atomone.1 h1:ycC9V2AWNG1kyE27Ln1sGrN1pGaJjaoRqtiEpFcA/k0= +github.com/atomone-hub/cosmos-sdk v0.50.15-atomone.1/go.mod h1:3lw4iUC57NuskCeAXFYzFNa2ZUGj1mXxOXdxVBdqrhg= +github.com/atomone-hub/cosmos-sdk/x/upgrade v0.1.5-atomone.2 h1:SVPsm3c8pymdbwNjKHF5vwM0B6x4dgkVTbhbYctwBoE= +github.com/atomone-hub/cosmos-sdk/x/upgrade v0.1.5-atomone.2/go.mod h1:78DcDK3kSaNN7dObcV1FIypDDIfl5W5X1uDyrUyZmWY= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= @@ -182,11 +184,12 @@ 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/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= -github.com/bytedance/sonic v1.14.0 h1:/OfKt8HFw0kh2rj8N0F6C/qPGRESq0BbaNZgcNXXzQQ= -github.com/bytedance/sonic v1.14.0/go.mod h1:WoEbx8WTcFJfzCe0hbmyTGrfjt8PzNEBdxlNUO24NhA= -github.com/bytedance/sonic/loader v0.1.1/go.mod h1:ncP89zfokxS5LZrJxl5z0UJcsk4M4yY2JpfqGeCtNLU= -github.com/bytedance/sonic/loader v0.3.0 h1:dskwH8edlzNMctoruo8FPTJDF3vLtDT0sXZwvZJyqeA= -github.com/bytedance/sonic/loader v0.3.0/go.mod h1:N8A3vUdtUebEY2/VQC0MyhYeKUFosQU6FxH2JmUe6VI= +github.com/bytedance/gopkg v0.1.3 h1:TPBSwH8RsouGCBcMBktLt1AymVo2TVsBVCY4b6TnZ/M= +github.com/bytedance/gopkg v0.1.3/go.mod h1:576VvJ+eJgyCzdjS+c4+77QF3p7ubbtiKARP3TxducM= +github.com/bytedance/sonic v1.15.0 h1:/PXeWFaR5ElNcVE84U0dOHjiMHQOwNIx3K4ymzh/uSE= +github.com/bytedance/sonic v1.15.0/go.mod h1:tFkWrPz0/CUCLEF4ri4UkHekCIcdnkqXw9VduqpJh0k= +github.com/bytedance/sonic/loader v0.5.0 h1:gXH3KVnatgY7loH5/TkeVyXPfESoqSBSBEiDd5VjlgE= +github.com/bytedance/sonic/loader v0.5.0/go.mod h1:AR4NYCk5DdzZizZ5djGqQ92eEhCCcdf5x77udYiSJRo= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -210,9 +213,8 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudwego/base64x v0.1.5 h1:XPciSp1xaq2VCSt6lF0phncD4koWyULpl5bUxbfCyP4= -github.com/cloudwego/base64x v0.1.5/go.mod h1:0zlkT4Wn5C6NdauXdJRhSKRlJvmclQ1hhJgA0rcu/8w= -github.com/cloudwego/iasm v0.2.0/go.mod h1:8rXZaNYT2n95jn+zTI1sDr+IgcD2GVs0nlbbQPiEFhY= +github.com/cloudwego/base64x v0.1.6 h1:t11wG9AECkCDk5fMSoxmufanudBtJ+/HemLstXDLI2M= +github.com/cloudwego/base64x v0.1.6/go.mod h1:OFcloc187FXDaYHvrNIjxSe8ncn0OOM8gEHfghB2IPU= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20210930031921-04548b0d99d4/go.mod h1:6pvJx4me5XPnfI9Z40ddWsdw2W/uZgQLFXToKeRcDiI= @@ -252,8 +254,8 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= -github.com/cosmos/cosmos-db v1.1.1 h1:FezFSU37AlBC8S98NlSagL76oqBRWq/prTPvFcEJNCM= -github.com/cosmos/cosmos-db v1.1.1/go.mod h1:AghjcIPqdhSLP/2Z0yha5xPH3nLnskz81pBx3tcVSAw= +github.com/cosmos/cosmos-db v1.1.3 h1:7QNT77+vkefostcKkhrzDK9uoIEryzFrU9eoMeaQOPY= +github.com/cosmos/cosmos-db v1.1.3/go.mod h1:kN+wGsnwUJZYn8Sy5Q2O0vCYA99MJllkKASbs6Unb9U= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= @@ -265,8 +267,8 @@ github.com/cosmos/gogoproto v1.7.2 h1:5G25McIraOC0mRFv9TVO139Uh3OklV2hczr13KKVHC github.com/cosmos/gogoproto v1.7.2/go.mod h1:8S7w53P1Y1cHwND64o0BnArT6RmdgIvsBuco6uTllsk= github.com/cosmos/iavl v1.2.2 h1:qHhKW3I70w+04g5KdsdVSHRbFLgt3yY3qTMd4Xa4rC8= github.com/cosmos/iavl v1.2.2/go.mod h1:GiM43q0pB+uG53mLxLDzimxM9l/5N9UuSY3/D0huuVw= -github.com/cosmos/ibc-go/v10 v10.2.0 h1:wlk/zqz2O0WRyE6UConoR1ci2HSW02P9ywamZCh5/N4= -github.com/cosmos/ibc-go/v10 v10.2.0/go.mod h1:ijeyJ1FDvXoc5w+rlhpMntjhZ558EF02SBFjroW1hPo= +github.com/cosmos/ibc-go/v10 v10.5.0 h1:NI+cX04fXdu9JfP0V0GYeRi1ENa7PPdq0BYtVYo8Zrs= +github.com/cosmos/ibc-go/v10 v10.5.0/go.mod h1:a74pAPUSJ7NewvmvELU74hUClJhwnmm5MGbEaiTw/kE= github.com/cosmos/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= @@ -310,8 +312,8 @@ github.com/docker/cli v24.0.7+incompatible h1:wa/nIwYFW7BVTGa7SWPVyyXU9lgORqUb1x github.com/docker/cli v24.0.7+incompatible/go.mod h1:JLrzqnKDaYBop7H2jaqPtU4hHvMKP+vjCwu2uszcLI8= github.com/docker/docker v20.10.19+incompatible h1:lzEmjivyNHFHMNAFLXORMBXyGIhw/UP4DvJwvyKYq64= github.com/docker/docker v20.10.19+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-connections v0.5.0 h1:USnMq7hx7gwdVZq1L49hLXaFtUdTADjXGp+uj1Br63c= +github.com/docker/go-connections v0.5.0/go.mod h1:ov60Kzw0kKElRwhNs9UlUHAE/F9Fe6GLaXnqyDdmEXc= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -341,8 +343,8 @@ github.com/envoyproxy/go-control-plane/ratelimit v0.1.0/go.mod h1:Wk+tMFAFbCXaJP github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.2.1 h1:DEo3O99U8j4hBFwbJfrz9VtgcDfUKS7KJ7spH3d86P8= github.com/envoyproxy/protoc-gen-validate v1.2.1/go.mod h1:d/C80l/jxXLdfEIhX1W2TmLfsJ31lvEjwamM4DxlWXU= -github.com/ethereum/go-ethereum v1.15.10 h1:UxqBhpsF2TNF1f7Z/k3RUUHEuLvDGAlHuh/lQ99ZA0w= -github.com/ethereum/go-ethereum v1.15.10/go.mod h1:+S9k+jFzlyVTNcYGvqFhzN/SFhI6vA+aOY4T5tLSPL0= +github.com/ethereum/go-ethereum v1.15.11 h1:JK73WKeu0WC0O1eyX+mdQAVHUV+UR1a9VB/domDngBU= +github.com/ethereum/go-ethereum v1.15.11/go.mod h1:mf8YiHIb0GR4x4TipcvBUPxJLw1mFdmxzoDi11sDRoI= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= github.com/fatih/color v1.18.0 h1:S8gINlzdQ840/4pfAwic/ZE0djQEH3wM94VfqLTZcOM= @@ -457,8 +459,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb h1:PBC98N2aIaM3XXiurYmW7fx4GZkL8feAMVq7nEjURHk= -github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= +github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e h1:4bw4WeyTYPp0smaXiJZCNnLrvVBqirQVreixayXezGc= +github.com/golang/snappy v0.0.5-0.20231225225746-43d5d4cd4e0e/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= @@ -474,7 +476,6 @@ github.com/google/go-cmp v0.5.3/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/ github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-cmp v0.5.6/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= -github.com/google/go-cmp v0.5.9/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= @@ -619,10 +620,8 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= -github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= github.com/klauspost/cpuid/v2 v2.2.10 h1:tBs3QSyvjDyFTq3uoc/9xFpCuOsJQFNPiAhYdw2skhE= github.com/klauspost/cpuid/v2 v2.2.10/go.mod h1:hqwkgyIinND0mEev00jJYCxPNVRVXFQeu1XKlok6oO0= -github.com/knz/go-libedit v1.10.1/go.mod h1:MZTVkCWyz0oBc7JOWP3wNAzd002ZbM/5hgShxwh4x8M= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -719,19 +718,19 @@ github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= +github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= -github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= +github.com/onsi/gomega v1.34.1 h1:EUMJIKUjM8sKjYbtxQI9A4z2o+rruxnzNvpknOXie6k= +github.com/onsi/gomega v1.34.1/go.mod h1:kU1QgUvBDLXBJq618Xvm2LUX6rSAfRaFRTcdOeDLwwY= 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.1.0-rc2 h1:2zx/Stx4Wc5pIPDvIxHXvXtQFW/7XWJGmnM7r3wg034= -github.com/opencontainers/image-spec v1.1.0-rc2/go.mod h1:3OVijpioIKYWTqjiG0zfF6wvoJ4fAXGbjdZuI2NgsRQ= +github.com/opencontainers/image-spec v1.1.0-rc5 h1:Ygwkfw9bpDvs+c9E34SdgGOj41dX/cbdlwvlWt0pnFI= +github.com/opencontainers/image-spec v1.1.0-rc5/go.mod h1:X4pATf0uXsnn3g5aiGIsVnJBR4mxhKzfwmvK/B2NTm8= github.com/opencontainers/runc v1.1.12 h1:BOIssBaW1La0/qbNZHXOOa71dZfZEQOzW7dqQf3phss= github.com/opencontainers/runc v1.1.12/go.mod h1:S+lQwSfncpBha7XTy/5lBwWgm5+y5Ma/O44Ekby9FK8= github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= @@ -852,12 +851,12 @@ github.com/spf13/afero v1.14.0/go.mod h1:acJQ8t0ohCGuMN3O+Pv0V0hgMxNYDlvdk+VTfyZ github.com/spf13/cast v1.9.2 h1:SsGfm7M8QOFtEzumm7UZrZdLLquNdzFYfIbEXntcFbE= github.com/spf13/cast v1.9.2/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= -github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= -github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= +github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= +github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= -github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.20.1 h1:ZMi+z/lvLyPSCoNtFCpqjy0S4kPbirhpTMwl8BkW9X4= github.com/spf13/viper v1.20.1/go.mod h1:P9Mdzt1zoHIG8m2eZQinpiBjo6kCmZSKBClNNqjJvu4= github.com/spiffe/go-spiffe/v2 v2.5.0 h1:N2I01KCUkv1FAjZXJMwh95KK1ZIQLYbPfhaxw8WS0hE= @@ -882,6 +881,7 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8= @@ -961,8 +961,8 @@ go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= -go.uber.org/mock v0.5.2 h1:LbtPTcP8A5k9WPXj54PPPbjcI4Y6lhyOZXn+VS7wNko= -go.uber.org/mock v0.5.2/go.mod h1:wLlUxC2vVTPTaE3UD51E0BGOAElKrILxhVSDYQLld5o= +go.uber.org/mock v0.6.0 h1:hyF9dfmbgIX5EfOdasqLsWD6xqpNZlXblLB/Dbnwv3Y= +go.uber.org/mock v0.6.0/go.mod h1:KiVJ4BqZJaMj4svdfmHM0AUx4NJYO8ZNpPnZn1Z+BBU= 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.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= @@ -974,8 +974,12 @@ go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -golang.org/x/arch v0.15.0 h1:QtOrQd0bTUnhNVNndMpLHNWrDmYzZ2KDqSrEymqInZw= -golang.org/x/arch v0.15.0/go.mod h1:JmwW7aLIoRUKgaTzhkiEFxvcEiQGyOg9BMonBJUS7EE= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +go.yaml.in/yaml/v3 v3.0.3 h1:bXOww4E/J3f66rav3pX3m8w6jDE4knZjGOw8b5Y6iNE= +go.yaml.in/yaml/v3 v3.0.3/go.mod h1:tBHosrYAkRZjRAOREWbDnBXUf08JOwYq++0QNwQiWzI= +golang.org/x/arch v0.17.0 h1:4O3dfLzd+lQewptAHqjewQZQDyEdejz3VwgeYwkZneU= +golang.org/x/arch v0.17.0/go.mod h1:bdwinDaKcfZUGpH09BB7ZmOfhalA8lQdzl62l8gGWsk= golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -1248,10 +1252,9 @@ honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= -nullprogram.com/x/optparse v1.0.0/go.mod h1:KdyPE+Igbe0jQUrVfMqDMeJQIJZEuyV7pjYmp6pbG50= pgregory.net/rapid v1.2.0 h1:keKAYRcjm+e1F0oAuU5F5+YPAWcyxNNRK2wud503Gnk= pgregory.net/rapid v1.2.0/go.mod h1:PY5XlDGj0+V1FCq0o192FdRhpKHGTRIWBgqjDBTrq04= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= -sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= -sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= sourcegraph.com/sourcegraph/appdash v0.0.0-20190731080439-ebfcffb1b5c0/go.mod h1:hI742Nqp5OhwiqlzhgfbWU4mW4yO10fP+LoT9WOswdU= diff --git a/tests/e2e/chain_test.go b/tests/e2e/chain_test.go index 314768cf4..f73a1feee 100644 --- a/tests/e2e/chain_test.go +++ b/tests/e2e/chain_test.go @@ -60,7 +60,7 @@ func (c *chain) configDir() string { } func (c *chain) createAndInitValidators(count int) error { - for i := 0; i < count; i++ { + for i := range count { node := c.createValidator(i) // generate genesis files diff --git a/tests/e2e/e2e_exec_test.go b/tests/e2e/e2e_exec_test.go index 902b902cc..8f6010da2 100644 --- a/tests/e2e/e2e_exec_test.go +++ b/tests/e2e/e2e_exec_test.go @@ -44,18 +44,18 @@ const ( flagOutputDocument = "output-document" ) -type flagOption func(map[string]interface{}) +type flagOption func(map[string]any) // withKeyValue add a new flag to command -func withKeyValue(key string, value interface{}) flagOption { - return func(o map[string]interface{}) { +func withKeyValue(key string, value any) flagOption { + return func(o map[string]any) { o[key] = value } } -func applyOptions(chainID string, options []flagOption) map[string]interface{} { - opts := map[string]interface{}{ +func applyOptions(chainID string, options []flagOption) map[string]any { + opts := map[string]any{ flagKeyringBackend: "test", flagOutput: "json", flagGas: "auto", diff --git a/tests/e2e/e2e_ibc_hermes_test.go b/tests/e2e/e2e_ibc_hermes_test.go index f6f74d9cf..a5d481bce 100644 --- a/tests/e2e/e2e_ibc_hermes_test.go +++ b/tests/e2e/e2e_ibc_hermes_test.go @@ -113,7 +113,7 @@ func (s *IntegrationTestSuite) executeHermesCommand(ctx context.Context, hermesC scanner := bufio.NewScanner(&outBuf) for scanner.Scan() { stdOut = scanner.Bytes() - var out map[string]interface{} + var out map[string]any err = json.Unmarshal(stdOut, &out) s.Require().NoError(err) if err != nil { diff --git a/tests/e2e/http_util_test.go b/tests/e2e/http_util_test.go index fc2d6bdc1..6294bf2bc 100644 --- a/tests/e2e/http_util_test.go +++ b/tests/e2e/http_util_test.go @@ -92,7 +92,7 @@ func httpGet_(endpoint string, attempt int) ([]byte, error) { return body, nil } -func readJSON(resp *http.Response) (map[string]interface{}, error) { +func readJSON(resp *http.Response) (map[string]any, error) { defer resp.Body.Close() body, readErr := io.ReadAll(resp.Body) @@ -100,7 +100,7 @@ func readJSON(resp *http.Response) (map[string]interface{}, error) { return nil, fmt.Errorf("failed to read Body") } - var data map[string]interface{} + var data map[string]any err := json.Unmarshal(body, &data) if err != nil { return nil, fmt.Errorf("failed to unmarshal response body") diff --git a/tests/e2e/query_test.go b/tests/e2e/query_test.go index daefd6833..95cab9440 100644 --- a/tests/e2e/query_test.go +++ b/tests/e2e/query_test.go @@ -29,7 +29,7 @@ import ( ) func (s *IntegrationTestSuite) waitAtomOneTx(endpoint, txHash string, msgResp codec.ProtoMarshaler) (err error) { - for i := 0; i < 15; i++ { + for range 15 { time.Sleep(time.Second) _, err = s.queryAtomOneTx(endpoint, txHash, msgResp) if isErrNotFound(err) { diff --git a/tests/e2e/validator_test.go b/tests/e2e/validator_test.go index df338d2ff..67cd09145 100644 --- a/tests/e2e/validator_test.go +++ b/tests/e2e/validator_test.go @@ -186,7 +186,7 @@ func (c *chain) addAccountFromMnemonic(counts int) error { return err } - for i := 0; i < counts; i++ { + for i := range counts { name := fmt.Sprintf("acct-%d", i) mnemonic, err := createMnemonic() if err != nil { @@ -233,11 +233,11 @@ func (c *chain) addMultiSigAccountFromMnemonic(counts int, sigNumber int, theres return err } - for multiSigCount := 0; multiSigCount < counts; multiSigCount++ { + for multiSigCount := range counts { multisigName := fmt.Sprintf("multisig-%d", multiSigCount) var pubkeys []cryptotypes.PubKey var signers []account - for sigCount := 0; sigCount < sigNumber; sigCount++ { + for sigCount := range sigNumber { name := fmt.Sprintf("multisig-%d-acct-%d", multiSigCount, sigCount) mnemonic, err := createMnemonic() if err != nil { diff --git a/x/coredaos/keeper/msg_server.go b/x/coredaos/keeper/msg_server.go index 7010b7859..54215bb95 100644 --- a/x/coredaos/keeper/msg_server.go +++ b/x/coredaos/keeper/msg_server.go @@ -32,7 +32,7 @@ func (ms MsgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdatePara ctx := sdk.UnwrapSDKContext(goCtx) if ms.k.GetAuthority() != msg.Authority { - return nil, errors.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.k.GetAuthority(), msg.Authority) + return nil, types.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", ms.k.GetAuthority(), msg.Authority) } params := msg.Params @@ -48,7 +48,7 @@ func (ms MsgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdatePara } if delegatorBonded.GT(math.ZeroInt()) || delegatorUnbonded.GT(math.ZeroInt()) { - return nil, errors.Wrapf(types.ErrCannotStake, "cannot update params while Steering DAO have bonded or unbonding tokens") + return nil, types.ErrCannotStake.Wrapf("cannot update params while Steering DAO have bonded or unbonding tokens") } } if params.OversightDaoAddress != "" { @@ -62,7 +62,7 @@ func (ms MsgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdatePara } if delegatorBonded.GT(math.ZeroInt()) || delegatorUnbonded.GT(math.ZeroInt()) { - return nil, errors.Wrapf(types.ErrCannotStake, "cannot update params while Oversight DAO have bonded or unbonding tokens") + return nil, types.ErrCannotStake.Wrapf("cannot update params while Oversight DAO have bonded or unbonding tokens") } } if err := ms.k.Params.Set(ctx, params); err != nil { @@ -85,7 +85,7 @@ func (ms MsgServer) AnnotateProposal(goCtx context.Context, msg *types.MsgAnnota if params.SteeringDaoAddress == "" { logger.Info("Steering DAO address is not set, function is disabled") - return nil, errors.Wrapf(types.ErrFunctionDisabled, "Steering DAO address is not set") + return nil, types.ErrFunctionDisabled.Wrapf("Steering DAO address is not set") } if msg.Annotator != params.SteeringDaoAddress { @@ -95,7 +95,7 @@ func (ms MsgServer) AnnotateProposal(goCtx context.Context, msg *types.MsgAnnota "got", msg.Annotator, ) - return nil, errors.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", params.SteeringDaoAddress, msg.Annotator) + return nil, types.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", params.SteeringDaoAddress, msg.Annotator) } proposal, found := ms.k.govKeeper.GetProposal(ctx, msg.ProposalId) @@ -106,7 +106,7 @@ func (ms MsgServer) AnnotateProposal(goCtx context.Context, msg *types.MsgAnnota "authority", msg.Annotator, ) - return nil, errors.Wrapf(govtypes.ErrUnknownProposal, "proposal with ID %d not found", msg.ProposalId) + return nil, govtypes.ErrUnknownProposal.Wrapf("proposal with ID %d not found", msg.ProposalId) } if proposal.Status != govtypesv1.StatusVotingPeriod { logger.Error( @@ -116,7 +116,7 @@ func (ms MsgServer) AnnotateProposal(goCtx context.Context, msg *types.MsgAnnota "authority", msg.Annotator, ) - return nil, errors.Wrapf(sdkgovtypes.ErrInactiveProposal, "proposal with ID %d is not in voting period", msg.ProposalId) + return nil, sdkgovtypes.ErrInactiveProposal.Wrapf("proposal with ID %d is not in voting period", msg.ProposalId) } // Check if the proposal already has an annotation, if so, allow overwriting only if the `overwrite` flag is set to true. @@ -127,7 +127,7 @@ func (ms MsgServer) AnnotateProposal(goCtx context.Context, msg *types.MsgAnnota "authority", msg.Annotator, ) - return nil, errors.Wrapf(types.ErrAnnotationAlreadyPresent, "proposal with ID %d already has an annotation", msg.ProposalId) + return nil, types.ErrAnnotationAlreadyPresent.Wrapf("proposal with ID %d already has an annotation", msg.ProposalId) } proposal.Annotation = msg.Annotation @@ -163,7 +163,7 @@ func (ms MsgServer) EndorseProposal(goCtx context.Context, msg *types.MsgEndorse if params.SteeringDaoAddress == "" { logger.Info("Steering DAO address is not set, function is disabled") - return nil, errors.Wrapf(types.ErrFunctionDisabled, "Steering DAO address is not set") + return nil, types.ErrFunctionDisabled.Wrapf("Steering DAO address is not set") } if msg.Endorser != params.SteeringDaoAddress { @@ -173,7 +173,7 @@ func (ms MsgServer) EndorseProposal(goCtx context.Context, msg *types.MsgEndorse "got", msg.Endorser, ) - return nil, errors.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", params.SteeringDaoAddress, msg.Endorser) + return nil, types.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", params.SteeringDaoAddress, msg.Endorser) } proposal, found := ms.k.govKeeper.GetProposal(ctx, msg.ProposalId) @@ -184,7 +184,7 @@ func (ms MsgServer) EndorseProposal(goCtx context.Context, msg *types.MsgEndorse "authority", msg.Endorser, ) - return nil, errors.Wrapf(govtypes.ErrUnknownProposal, "proposal with ID %d not found", msg.ProposalId) + return nil, govtypes.ErrUnknownProposal.Wrapf("proposal with ID %d not found", msg.ProposalId) } if proposal.Status != govtypesv1.StatusVotingPeriod { logger.Error( @@ -194,7 +194,7 @@ func (ms MsgServer) EndorseProposal(goCtx context.Context, msg *types.MsgEndorse "authority", msg.Endorser, ) - return nil, errors.Wrapf(sdkgovtypes.ErrInactiveProposal, "proposal with ID %d is not in voting period", msg.ProposalId) + return nil, sdkgovtypes.ErrInactiveProposal.Wrapf("proposal with ID %d is not in voting period", msg.ProposalId) } if proposal.Endorsed { logger.Error( @@ -203,7 +203,7 @@ func (ms MsgServer) EndorseProposal(goCtx context.Context, msg *types.MsgEndorse "authority", msg.Endorser, ) - return nil, errors.Wrapf(types.ErrProposalAlreadyEndorsed, "proposal with ID %d has already been endorsed", msg.ProposalId) + return nil, types.ErrProposalAlreadyEndorsed.Wrapf("proposal with ID %d has already been endorsed", msg.ProposalId) } proposal.Endorsed = true @@ -241,7 +241,7 @@ func (ms MsgServer) ExtendVotingPeriod(goCtx context.Context, msg *types.MsgExte if params.SteeringDaoAddress == "" && params.OversightDaoAddress == "" { logger.Info("Steering DAO address and Oversight DAO address are not set, function is disabled") - return nil, errors.Wrapf(types.ErrFunctionDisabled, "Steering DAO address and Oversight DAO address are not set") + return nil, types.ErrFunctionDisabled.Wrapf("Steering DAO address and Oversight DAO address are not set") } if msg.Extender != params.SteeringDaoAddress && msg.Extender != params.OversightDaoAddress { @@ -259,7 +259,7 @@ func (ms MsgServer) ExtendVotingPeriod(goCtx context.Context, msg *types.MsgExte "got", msg.Extender, ) - return nil, errors.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", addressesString, msg.Extender) + return nil, types.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", addressesString, msg.Extender) } proposal, found := ms.k.govKeeper.GetProposal(ctx, msg.ProposalId) @@ -270,7 +270,7 @@ func (ms MsgServer) ExtendVotingPeriod(goCtx context.Context, msg *types.MsgExte "authority", msg.Extender, ) - return nil, errors.Wrapf(govtypes.ErrUnknownProposal, "proposal with ID %d not found", msg.ProposalId) + return nil, govtypes.ErrUnknownProposal.Wrapf("proposal with ID %d not found", msg.ProposalId) } if proposal.Status != govtypesv1.StatusVotingPeriod { logger.Error( @@ -280,7 +280,7 @@ func (ms MsgServer) ExtendVotingPeriod(goCtx context.Context, msg *types.MsgExte "authority", msg.Extender, ) - return nil, errors.Wrapf(sdkgovtypes.ErrInactiveProposal, "proposal with ID %d is not in voting period", msg.ProposalId) + return nil, sdkgovtypes.ErrInactiveProposal.Wrapf("proposal with ID %d is not in voting period", msg.ProposalId) } if proposal.TimesVotingPeriodExtended >= params.VotingPeriodExtensionsLimit { logger.Error( @@ -290,7 +290,7 @@ func (ms MsgServer) ExtendVotingPeriod(goCtx context.Context, msg *types.MsgExte "authority", msg.Extender, ) - return nil, errors.Wrapf(sdkgovtypes.ErrInvalidProposalContent, "proposal with ID %d has reached the maximum number of voting period extensions", msg.ProposalId) + return nil, sdkgovtypes.ErrInvalidProposalContent.Wrapf("proposal with ID %d has reached the maximum number of voting period extensions", msg.ProposalId) } newEndTime := proposal.VotingEndTime.Add(*params.VotingPeriodExtensionDuration) @@ -337,7 +337,7 @@ func (ms MsgServer) VetoProposal(goCtx context.Context, msg *types.MsgVetoPropos if params.OversightDaoAddress == "" { logger.Info("Oversight DAO address is not set, function is disabled") - return nil, errors.Wrapf(types.ErrFunctionDisabled, "Oversight DAO address is not set") + return nil, types.ErrFunctionDisabled.Wrapf("Oversight DAO address is not set") } if msg.Vetoer != params.OversightDaoAddress { @@ -347,7 +347,7 @@ func (ms MsgServer) VetoProposal(goCtx context.Context, msg *types.MsgVetoPropos "got", msg.Vetoer, ) - return nil, errors.Wrapf(types.ErrInvalidSigner, "invalid authority; expected %s, got %s", params.OversightDaoAddress, msg.Vetoer) + return nil, types.ErrInvalidSigner.Wrapf("invalid authority; expected %s, got %s", params.OversightDaoAddress, msg.Vetoer) } proposal, found := ms.k.govKeeper.GetProposal(ctx, msg.ProposalId) @@ -358,7 +358,7 @@ func (ms MsgServer) VetoProposal(goCtx context.Context, msg *types.MsgVetoPropos "authority", msg.Vetoer, ) - return nil, errors.Wrapf(govtypes.ErrUnknownProposal, "proposal with ID %d not found", msg.ProposalId) + return nil, govtypes.ErrUnknownProposal.Wrapf("proposal with ID %d not found", msg.ProposalId) } if proposal.Status != govtypesv1.StatusVotingPeriod { logger.Error( @@ -368,7 +368,34 @@ func (ms MsgServer) VetoProposal(goCtx context.Context, msg *types.MsgVetoPropos "authority", msg.Vetoer, ) - return nil, errors.Wrapf(sdkgovtypes.ErrInactiveProposal, "proposal with ID %d is not in voting period", msg.ProposalId) + return nil, sdkgovtypes.ErrInactiveProposal.Wrapf("proposal with ID %d is not in voting period", msg.ProposalId) + } + + // Check if the proposal contains a change of the oversight DAO address. + // If so, vetoing the proposal would create a scenario where the current oversight DAO can prevent its own replacement + for _, msg := range proposal.Messages { + if msg.GetTypeUrl() == sdk.MsgTypeURL(&types.MsgUpdateParams{}) { + var updateParamsMsg types.MsgUpdateParams + if err := updateParamsMsg.Unmarshal(msg.GetValue()); err != nil { + logger.Error( + "failed to unmarshal MsgUpdateParams from proposal messages", + "proposal", proposal.Id, + "error", err, + ) + + return nil, err + } + if updateParamsMsg.Params.OversightDaoAddress != "" && updateParamsMsg.Params.OversightDaoAddress != params.OversightDaoAddress { + logger.Error( + "proposal contains a change of the oversight DAO address, vetoing it would prevent the replacement of the current oversight DAO", + "proposal", proposal.Id, + "current_oversight_dao_address", params.OversightDaoAddress, + "new_oversight_dao_address", updateParamsMsg.Params.OversightDaoAddress, + ) + + return nil, types.ErrInvalidVeto.Wrapf("proposal with ID %d contains a change of the oversight DAO address, vetoing it would prevent the replacement of the current oversight DAO", proposal.Id) + } + } } // follows the same logic as in x/gov/abci.go for rejected proposals @@ -379,7 +406,7 @@ func (ms MsgServer) VetoProposal(goCtx context.Context, msg *types.MsgVetoPropos } proposal.Status = govtypesv1.StatusVetoed - // Since the proposal is veoted, we set the final tally result to an empty tally + // Since the proposal is vetoed, we set the final tally result to an empty tally // and the voting period ends immediately emptyTally := govtypesv1.EmptyTallyResult() proposal.FinalTallyResult = &emptyTally diff --git a/x/coredaos/keeper/msg_server_test.go b/x/coredaos/keeper/msg_server_test.go index 8c5e9fde3..86a109167 100644 --- a/x/coredaos/keeper/msg_server_test.go +++ b/x/coredaos/keeper/msg_server_test.go @@ -9,6 +9,7 @@ import ( simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" + sdktx "github.com/cosmos/cosmos-sdk/types/tx" "github.com/atomone-hub/atomone/x/coredaos/testutil" "github.com/atomone-hub/atomone/x/coredaos/types" @@ -668,7 +669,7 @@ func TestMsgServerExtendVotingPeriod(t *testing.T) { } func TestMsgServerVetoProposal(t *testing.T) { - testAcc := simtestutil.CreateRandomAccounts(2) + testAcc := simtestutil.CreateRandomAccounts(3) vetoerAcc := testAcc[0].String() oversightDAOAcc := testAcc[1].String() emptyTally := govtypesv1.EmptyTallyResult() @@ -694,6 +695,20 @@ func TestMsgServerVetoProposal(t *testing.T) { Id: 2, Status: govtypesv1.StatusDepositPeriod, } + proposalWithChangeOversightDAOMsgs, err := sdktx.SetMsgs([]sdk.Msg{&types.MsgUpdateParams{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Params: types.Params{ + OversightDaoAddress: testAcc[2].String(), + }, + }}) + require.NoError(t, err) + proposalWithChangeOversightDAO := govtypesv1.Proposal{ + Title: "Test Proposal", + Summary: "A proposal to change oversight DAO address", + Id: 4, + Status: govtypesv1.StatusVotingPeriod, + Messages: proposalWithChangeOversightDAOMsgs, + } tests := []struct { name string msg *types.MsgVetoProposal @@ -813,6 +828,18 @@ func TestMsgServerVetoProposal(t *testing.T) { }, setOversightDAO: true, }, + { + name: "veto proposal with change to oversight DAO address", + msg: &types.MsgVetoProposal{ + Vetoer: oversightDAOAcc, + ProposalId: 4, + }, + expectedErr: "proposal with ID 4 contains a change of the oversight DAO address, vetoing it would prevent the replacement of the current oversight DAO: oversight DAO cannot veto this proposal", + setupMocks: func(ctx sdk.Context, m *testutil.Mocks) { + m.GovKeeper.EXPECT().GetProposal(ctx, uint64(4)).Return(proposalWithChangeOversightDAO, true) + }, + setOversightDAO: true, + }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { diff --git a/x/coredaos/simulation/operations.go b/x/coredaos/simulation/operations.go index 2e86b517c..c3b3ea0e9 100644 --- a/x/coredaos/simulation/operations.go +++ b/x/coredaos/simulation/operations.go @@ -235,6 +235,18 @@ func SimulateMsgVetoProposal(gk types.GovKeeper, sk types.StakingKeeper, ak type return simtypes.NoOpMsg(types.ModuleName, TypeMsgVetoProposal, "unable to generate proposal"), nil, nil } + for _, msg := range proposal.Messages { + if msg.GetTypeUrl() == sdk.MsgTypeURL(&types.MsgUpdateParams{}) { + var updateParamsMsg types.MsgUpdateParams + if err := updateParamsMsg.Unmarshal(msg.GetValue()); err != nil { + return simtypes.NoOpMsg(types.ModuleName, TypeMsgVetoProposal, "unable check proposal msgs"), nil, nil + } + if updateParamsMsg.Params.OversightDaoAddress != "" && updateParamsMsg.Params.OversightDaoAddress != params.OversightDaoAddress { + return simtypes.NoOpMsg(types.ModuleName, TypeMsgVetoProposal, "skip invalid proposal"), nil, nil + } + } + } + var burnDeposit bool randInt := r.Intn(2) if randInt%2 == 0 { diff --git a/x/coredaos/types/errors.go b/x/coredaos/types/errors.go index 34518431d..5693c98f3 100644 --- a/x/coredaos/types/errors.go +++ b/x/coredaos/types/errors.go @@ -11,4 +11,5 @@ var ( ErrProposalAlreadyEndorsed = errorsmod.Register(ModuleName, 3, "proposal already endorsed") ErrFunctionDisabled = errorsmod.Register(ModuleName, 4, "function is disabled") ErrCannotStake = errorsmod.Register(ModuleName, 5, "core DAOs cannot stake") + ErrInvalidVeto = errorsmod.Register(ModuleName, 6, "oversight DAO cannot veto this proposal") ) diff --git a/x/dynamicfee/fuzz/aimd_eip1559_test.go b/x/dynamicfee/fuzz/aimd_eip1559_test.go index 159ab970a..b4f6561e8 100644 --- a/x/dynamicfee/fuzz/aimd_eip1559_test.go +++ b/x/dynamicfee/fuzz/aimd_eip1559_test.go @@ -34,7 +34,7 @@ func TestAIMDLearningRate(t *testing.T) { gasGen := rapid.Uint64Range(0, maxBlockGas) // Update the dynamic fee pricing. - for i := uint64(0); i < numBlocks; i++ { + for range numBlocks { blockGas := gasGen.Draw(t, "gas") prevLearningRate := state.LearningRate @@ -80,7 +80,7 @@ func TestAIMDGasPrice(t *testing.T) { gasGen := rapid.Uint64Range(0, maxBlockGas) // Update the dynamic fee pricing. - for i := uint64(0); i < numBlocks; i++ { + for range numBlocks { blockGas := gasGen.Draw(t, "gas") prevBaseGasPrice := state.BaseGasPrice diff --git a/x/gov/types/v1/deposit.go b/x/gov/types/v1/deposit.go index 03c02ba47..ec002d8b4 100644 --- a/x/gov/types/v1/deposit.go +++ b/x/gov/types/v1/deposit.go @@ -2,6 +2,7 @@ package v1 import ( "fmt" + "strings" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -36,9 +37,10 @@ func (d Deposits) String() string { if len(d) == 0 { return "[]" } - out := fmt.Sprintf("Deposits for Proposal %d:", d[0].ProposalId) + var out strings.Builder + out.WriteString(fmt.Sprintf("Deposits for Proposal %d:", d[0].ProposalId)) for _, dep := range d { - out += fmt.Sprintf("\n %s: %s", dep.Depositor, dep.Amount) + out.WriteString(fmt.Sprintf("\n %s: %s", dep.Depositor, dep.Amount)) } - return out + return out.String() } diff --git a/x/gov/types/v1/genesis_test.go b/x/gov/types/v1/genesis_test.go index 657b5c7c5..17fc5cf62 100644 --- a/x/gov/types/v1/genesis_test.go +++ b/x/gov/types/v1/genesis_test.go @@ -426,7 +426,6 @@ func TestValidateGenesis(t *testing.T) { } for _, tc := range testCases { - tc := tc t.Run(tc.name, func(t *testing.T) { err := v1.ValidateGenesis(tc.genesisState()) if tc.expErrMsg != "" { diff --git a/x/gov/types/v1/params_legacy.go b/x/gov/types/v1/params_legacy.go index d7e0a7ed2..91128901a 100644 --- a/x/gov/types/v1/params_legacy.go +++ b/x/gov/types/v1/params_legacy.go @@ -26,7 +26,7 @@ func ParamKeyTable() paramtypes.KeyTable { ) } -func validateDepositParams(i interface{}) error { +func validateDepositParams(i any) error { v, ok := i.(DepositParams) if !ok { return fmt.Errorf("invalid parameter type: %T", i) @@ -42,7 +42,7 @@ func validateDepositParams(i interface{}) error { return nil } -func validateTallyParams(i interface{}) error { +func validateTallyParams(i any) error { v, ok := i.(TallyParams) if !ok { return fmt.Errorf("invalid parameter type: %T", i) @@ -73,7 +73,7 @@ func validateTallyParams(i interface{}) error { return nil } -func validateVotingParams(i interface{}) error { +func validateVotingParams(i any) error { v, ok := i.(VotingParams) if !ok { return fmt.Errorf("invalid parameter type: %T", i) diff --git a/x/gov/types/v1/proposal.go b/x/gov/types/v1/proposal.go index fc8e631d4..c18640393 100644 --- a/x/gov/types/v1/proposal.go +++ b/x/gov/types/v1/proposal.go @@ -89,12 +89,13 @@ var _ types.UnpackInterfacesMessage = Proposals{} // String implements stringer interface func (p Proposals) String() string { - out := "ID - (Status) - Title\n" + var out strings.Builder + out.WriteString("ID - (Status) - Title\n") for _, prop := range p { - out += fmt.Sprintf("%d - (%s) - %s\n", - prop.Id, prop.Status, prop.Title) + out.WriteString(fmt.Sprintf("%d - (%s) - %s\n", + prop.Id, prop.Status, prop.Title)) } - return strings.TrimSpace(out) + return strings.TrimSpace(out.String()) } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces @@ -129,7 +130,7 @@ func (status ProposalStatus) Format(s fmt.State, verb rune) { s.Write([]byte(status.String())) //nolint:errcheck default: // TODO: Do this conversion more directly - s.Write([]byte(fmt.Sprintf("%v", byte(status)))) //nolint:errcheck + s.Write(fmt.Appendf(nil, "%v", byte(status))) //nolint:errcheck } } diff --git a/x/gov/types/v1/vote.go b/x/gov/types/v1/vote.go index 794782e47..598521613 100644 --- a/x/gov/types/v1/vote.go +++ b/x/gov/types/v1/vote.go @@ -51,11 +51,12 @@ func (v Votes) String() string { if len(v) == 0 { return "[]" } - out := fmt.Sprintf("Votes for Proposal %d:", v[0].ProposalId) + var out strings.Builder + out.WriteString(fmt.Sprintf("Votes for Proposal %d:", v[0].ProposalId)) for _, vot := range v { - out += fmt.Sprintf("\n %s: %s", vot.Voter, vot.Options) + out.WriteString(fmt.Sprintf("\n %s: %s", vot.Voter, vot.Options)) } - return out + return out.String() } func NewWeightedVoteOption(option VoteOption, weight math.LegacyDec) *WeightedVoteOption { @@ -128,7 +129,7 @@ func VoteOptionFromString(str string) (VoteOption, error) { // if the string is invalid. func WeightedVoteOptionsFromString(str string) (WeightedVoteOptions, error) { options := WeightedVoteOptions{} - for _, option := range strings.Split(str, ",") { + for option := range strings.SplitSeq(str, ",") { fields := strings.Split(option, "=") option, err := VoteOptionFromString(fields[0]) if err != nil { @@ -162,6 +163,6 @@ func (vo VoteOption) Format(s fmt.State, verb rune) { case 's': s.Write([]byte(vo.String())) //nolint:errcheck default: - s.Write([]byte(fmt.Sprintf("%v", byte(vo)))) //nolint:errcheck + s.Write(fmt.Appendf(nil, "%v", byte(vo))) //nolint:errcheck } } diff --git a/x/gov/types/v1/wrapper.go b/x/gov/types/v1/wrapper.go index 5f3917283..9b79ebcb0 100644 --- a/x/gov/types/v1/wrapper.go +++ b/x/gov/types/v1/wrapper.go @@ -154,6 +154,8 @@ func ConvertSDKParamsToAtomOne(sdkParams *sdkv1.Params) *Params { QuorumRange: ConvertSDKQuorumRangeToAtomOne(sdkParams.QuorumRange), ConstitutionAmendmentQuorumRange: ConvertSDKQuorumRangeToAtomOne(sdkParams.ConstitutionAmendmentQuorumRange), LawQuorumRange: ConvertSDKQuorumRangeToAtomOne(sdkParams.LawQuorumRange), + GovernorStatusChangePeriod: sdkParams.GovernorStatusChangePeriod, + MinGovernorSelfDelegation: sdkParams.MinGovernorSelfDelegation, } } @@ -164,11 +166,12 @@ func ConvertSDKMinDepositThrottlerToAtomOne(sdkThrottler *sdkv1.MinDepositThrott } return &MinDepositThrottler{ - FloorValue: sdkThrottler.FloorValue, - UpdatePeriod: sdkThrottler.UpdatePeriod, - TargetActiveProposals: sdkThrottler.TargetActiveProposals, - IncreaseRatio: sdkThrottler.IncreaseRatio, - DecreaseRatio: sdkThrottler.DecreaseRatio, + FloorValue: sdkThrottler.FloorValue, + UpdatePeriod: sdkThrottler.UpdatePeriod, + TargetActiveProposals: sdkThrottler.TargetActiveProposals, + IncreaseRatio: sdkThrottler.IncreaseRatio, + DecreaseRatio: sdkThrottler.DecreaseRatio, + DecreaseSensitivityTargetDistance: sdkThrottler.DecreaseSensitivityTargetDistance, } } @@ -179,11 +182,12 @@ func ConvertSDKMinInitialDepositThrottlerToAtomOne(sdkThrottler *sdkv1.MinInitia } return &MinInitialDepositThrottler{ - FloorValue: sdkThrottler.FloorValue, - UpdatePeriod: sdkThrottler.UpdatePeriod, - TargetProposals: sdkThrottler.TargetProposals, - IncreaseRatio: sdkThrottler.IncreaseRatio, - DecreaseRatio: sdkThrottler.DecreaseRatio, + FloorValue: sdkThrottler.FloorValue, + UpdatePeriod: sdkThrottler.UpdatePeriod, + TargetProposals: sdkThrottler.TargetProposals, + IncreaseRatio: sdkThrottler.IncreaseRatio, + DecreaseRatio: sdkThrottler.DecreaseRatio, + DecreaseSensitivityTargetDistance: sdkThrottler.DecreaseSensitivityTargetDistance, } } @@ -221,9 +225,10 @@ func ConvertSDKGovernorToAtomOne(sdkGovernor *sdkv1.Governor) *Governor { } return &Governor{ - GovernorAddress: sdkGovernor.GovernorAddress, - Description: *ConvertSDKGovernorDescriptionToAtomOne(&sdkGovernor.Description), - Status: GovernorStatus(sdkGovernor.Status), + GovernorAddress: sdkGovernor.GovernorAddress, + Description: *ConvertSDKGovernorDescriptionToAtomOne(&sdkGovernor.Description), + Status: GovernorStatus(sdkGovernor.Status), + LastStatusChangeTime: sdkGovernor.LastStatusChangeTime, } } @@ -442,6 +447,8 @@ func ConvertAtomOneParamsToSDK(atomoneParams *Params) *sdkv1.Params { QuorumRange: ConvertAtomOneQuorumRangeToSDK(atomoneParams.QuorumRange), ConstitutionAmendmentQuorumRange: ConvertAtomOneQuorumRangeToSDK(atomoneParams.ConstitutionAmendmentQuorumRange), LawQuorumRange: ConvertAtomOneQuorumRangeToSDK(atomoneParams.LawQuorumRange), + GovernorStatusChangePeriod: atomoneParams.GovernorStatusChangePeriod, + MinGovernorSelfDelegation: atomoneParams.MinGovernorSelfDelegation, } } @@ -452,11 +459,12 @@ func ConvertAtomOneMinDepositThrottlerToSDK(atomoneThrottler *MinDepositThrottle } return &sdkv1.MinDepositThrottler{ - FloorValue: atomoneThrottler.FloorValue, - UpdatePeriod: atomoneThrottler.UpdatePeriod, - TargetActiveProposals: atomoneThrottler.TargetActiveProposals, - IncreaseRatio: atomoneThrottler.IncreaseRatio, - DecreaseRatio: atomoneThrottler.DecreaseRatio, + FloorValue: atomoneThrottler.FloorValue, + UpdatePeriod: atomoneThrottler.UpdatePeriod, + TargetActiveProposals: atomoneThrottler.TargetActiveProposals, + IncreaseRatio: atomoneThrottler.IncreaseRatio, + DecreaseRatio: atomoneThrottler.DecreaseRatio, + DecreaseSensitivityTargetDistance: atomoneThrottler.DecreaseSensitivityTargetDistance, } } @@ -467,11 +475,12 @@ func ConvertAtomOneMinInitialDepositThrottlerToSDK(atomoneThrottler *MinInitialD } return &sdkv1.MinInitialDepositThrottler{ - FloorValue: atomoneThrottler.FloorValue, - UpdatePeriod: atomoneThrottler.UpdatePeriod, - TargetProposals: atomoneThrottler.TargetProposals, - IncreaseRatio: atomoneThrottler.IncreaseRatio, - DecreaseRatio: atomoneThrottler.DecreaseRatio, + FloorValue: atomoneThrottler.FloorValue, + UpdatePeriod: atomoneThrottler.UpdatePeriod, + TargetProposals: atomoneThrottler.TargetProposals, + IncreaseRatio: atomoneThrottler.IncreaseRatio, + DecreaseRatio: atomoneThrottler.DecreaseRatio, + DecreaseSensitivityTargetDistance: atomoneThrottler.DecreaseSensitivityTargetDistance, } } @@ -526,6 +535,31 @@ func ConvertAtomOneDepositsToSDK(atomoneDeposits []*Deposit) []*sdkv1.Deposit { return deposits } +// ConvertAtomOneLastMinDepositToSDK converts AtomOne LastMinDeposit to SDK +func ConvertAtomOneLastMinDepositToSDK(atomoneLastMinDeposit *LastMinDeposit) *sdkv1.LastMinDeposit { + if atomoneLastMinDeposit == nil { + return nil + } + + return &sdkv1.LastMinDeposit{ + Value: atomoneLastMinDeposit.Value, + Time: atomoneLastMinDeposit.Time, + } +} + +// ConvertAtomOneQuorumCheckQueueEntryToSDK converts AtomOne QuorumCheckQueueEntry to SDK +func ConvertAtomOneQuorumCheckQueueEntryToSDK(atomoneEntry *QuorumCheckQueueEntry) *sdkv1.QuorumCheckQueueEntry { + if atomoneEntry == nil { + return nil + } + + return &sdkv1.QuorumCheckQueueEntry{ + QuorumTimeoutTime: atomoneEntry.QuorumTimeoutTime, + QuorumCheckCount: atomoneEntry.QuorumCheckCount, + QuorumChecksDone: atomoneEntry.QuorumChecksDone, + } +} + // ConvertAtomoneGovernorDescriptionToSDK converts AtomOne GovernorDescription to SDK func ConvertAtomOneGovernorDescriptionToSDK(atomoneGovDesc *GovernorDescription) *sdkv1.GovernorDescription { if atomoneGovDesc == nil { @@ -548,9 +582,10 @@ func ConvertAtomOneGovernorToSDK(atomoneGovernor *Governor) *sdkv1.Governor { } return &sdkv1.Governor{ - GovernorAddress: atomoneGovernor.GovernorAddress, - Description: *ConvertAtomOneGovernorDescriptionToSDK(&atomoneGovernor.Description), - Status: sdkv1.GovernorStatus(atomoneGovernor.Status), + GovernorAddress: atomoneGovernor.GovernorAddress, + Description: *ConvertAtomOneGovernorDescriptionToSDK(&atomoneGovernor.Description), + Status: sdkv1.GovernorStatus(atomoneGovernor.Status), + LastStatusChangeTime: atomoneGovernor.LastStatusChangeTime, } } diff --git a/x/gov/types/v1beta1/deposit.go b/x/gov/types/v1beta1/deposit.go index f15752213..802bb89de 100644 --- a/x/gov/types/v1beta1/deposit.go +++ b/x/gov/types/v1beta1/deposit.go @@ -2,6 +2,7 @@ package v1beta1 import ( "fmt" + "strings" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -36,9 +37,10 @@ func (d Deposits) String() string { if len(d) == 0 { return "[]" } - out := fmt.Sprintf("Deposits for Proposal %d:", d[0].ProposalId) + var out strings.Builder + out.WriteString(fmt.Sprintf("Deposits for Proposal %d:", d[0].ProposalId)) for _, dep := range d { - out += fmt.Sprintf("\n %s: %s", dep.Depositor, dep.Amount) + out.WriteString(fmt.Sprintf("\n %s: %s", dep.Depositor, dep.Amount)) } - return out + return out.String() } diff --git a/x/gov/types/v1beta1/proposal.go b/x/gov/types/v1beta1/proposal.go index fbf9a96b7..491bb2209 100644 --- a/x/gov/types/v1beta1/proposal.go +++ b/x/gov/types/v1beta1/proposal.go @@ -107,13 +107,14 @@ func (p Proposals) Equal(other Proposals) bool { // String implements stringer interface func (p Proposals) String() string { - out := "ID - (Status) [Type] Title\n" + var out strings.Builder + out.WriteString("ID - (Status) [Type] Title\n") for _, prop := range p { - out += fmt.Sprintf("%d - (%s) [%s] %s\n", + out.WriteString(fmt.Sprintf("%d - (%s) [%s] %s\n", prop.ProposalId, prop.Status, - prop.ProposalType(), prop.GetTitle()) + prop.ProposalType(), prop.GetTitle())) } - return strings.TrimSpace(out) + return strings.TrimSpace(out.String()) } // UnpackInterfaces implements UnpackInterfacesMessage.UnpackInterfaces @@ -143,7 +144,7 @@ func (status ProposalStatus) Format(s fmt.State, verb rune) { s.Write([]byte(status.String())) //nolint:errcheck default: // TODO: Do this conversion more directly - s.Write([]byte(fmt.Sprintf("%v", byte(status)))) //nolint:errcheck + s.Write(fmt.Appendf(nil, "%v", byte(status))) //nolint:errcheck } } diff --git a/x/gov/types/v1beta1/vote.go b/x/gov/types/v1beta1/vote.go index 6d8bb242e..b62f3d865 100644 --- a/x/gov/types/v1beta1/vote.go +++ b/x/gov/types/v1beta1/vote.go @@ -39,11 +39,12 @@ func (v Votes) String() string { if len(v) == 0 { return "[]" } - out := fmt.Sprintf("Votes for Proposal %d:", v[0].ProposalId) + var out strings.Builder + out.WriteString(fmt.Sprintf("Votes for Proposal %d:", v[0].ProposalId)) for _, vot := range v { - out += fmt.Sprintf("\n %s: %s", vot.Voter, vot.Options) + out.WriteString(fmt.Sprintf("\n %s: %s", vot.Voter, vot.Options)) } - return out + return out.String() } // NewNonSplitVoteOption creates a single option vote with weight 1 @@ -84,7 +85,7 @@ func VoteOptionFromString(str string) (VoteOption, error) { // if the string is invalid. func WeightedVoteOptionsFromString(str string) (WeightedVoteOptions, error) { options := WeightedVoteOptions{} - for _, option := range strings.Split(str, ",") { + for option := range strings.SplitSeq(str, ",") { fields := strings.Split(option, "=") option, err := VoteOptionFromString(fields[0]) if err != nil { @@ -119,6 +120,6 @@ func (vo VoteOption) Format(s fmt.State, verb rune) { case 's': s.Write([]byte(vo.String())) //nolint:errcheck default: - s.Write([]byte(fmt.Sprintf("%v", byte(vo)))) //nolint:errcheck + s.Write(fmt.Appendf(nil, "%v", byte(vo))) //nolint:errcheck } } diff --git a/x/photon/ante/ante.go b/x/photon/ante/ante.go index 3b4241d83..b92b4b4cc 100644 --- a/x/photon/ante/ante.go +++ b/x/photon/ante/ante.go @@ -1,6 +1,8 @@ package ante import ( + "slices" + errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" @@ -61,11 +63,8 @@ func AllowsAnyTxFee(tx sdk.Tx, txFeeExceptions []string) bool { var anyTxFeeMsgCount int for _, msg := range tx.GetMsgs() { msgTypeURL := sdk.MsgTypeURL(msg) - for _, exception := range txFeeExceptions { - if exception == msgTypeURL { - anyTxFeeMsgCount++ - break - } + if slices.Contains(txFeeExceptions, msgTypeURL) { + anyTxFeeMsgCount++ } } return anyTxFeeMsgCount == len(tx.GetMsgs())