diff --git a/app/app.go b/app/app.go index 27300a47d9..a1dbdf9d08 100644 --- a/app/app.go +++ b/app/app.go @@ -382,11 +382,11 @@ func New( appCodec, keys[observertypes.StoreKey], keys[observertypes.MemStoreKey], - app.GetSubspace(observertypes.ModuleName), &stakingKeeper, app.SlashingKeeper, app.AuthorityKeeper, app.LightclientKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // register the staking hooks @@ -406,12 +406,12 @@ func New( appCodec, keys[emissionstypes.StoreKey], keys[emissionstypes.MemStoreKey], - app.GetSubspace(emissionstypes.ModuleName), authtypes.FeeCollectorName, app.BankKeeper, app.StakingKeeper, app.ObserverKeeper, app.AccountKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) // Create Ethermint keepers @@ -527,7 +527,7 @@ func New( crosschainmodule.NewAppModule(appCodec, app.CrosschainKeeper), observermodule.NewAppModule(appCodec, *app.ObserverKeeper), fungiblemodule.NewAppModule(appCodec, app.FungibleKeeper), - emissionsmodule.NewAppModule(appCodec, app.EmissionsKeeper), + emissionsmodule.NewAppModule(appCodec, app.EmissionsKeeper, app.GetSubspace(emissionstypes.ModuleName)), authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), ) @@ -821,9 +821,7 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(evmtypes.ModuleName) paramsKeeper.Subspace(feemarkettypes.ModuleName) paramsKeeper.Subspace(group.ModuleName) - paramsKeeper.Subspace(crosschaintypes.ModuleName) paramsKeeper.Subspace(observertypes.ModuleName) - paramsKeeper.Subspace(fungibletypes.ModuleName) paramsKeeper.Subspace(emissionstypes.ModuleName) return paramsKeeper } diff --git a/app/setup_handlers.go b/app/setup_handlers.go index 5501a5b6cc..a3bd0dd76d 100644 --- a/app/setup_handlers.go +++ b/app/setup_handlers.go @@ -6,20 +6,30 @@ import ( "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/upgrade/types" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" + emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types" lightclienttypes "github.com/zeta-chain/zetacore/x/lightclient/types" - observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) const releaseVersion = "v15" func SetupHandlers(app *App) { + // Set param key table for params module migration + for _, subspace := range app.ParamsKeeper.GetSubspaces() { + subspace := subspace + + switch subspace.Name() { + // TODO: add all modules when cosmos-sdk is updated + case emissionstypes.ModuleName: + subspace.WithKeyTable(emissionstypes.ParamKeyTable()) + } + } app.UpgradeKeeper.SetUpgradeHandler(releaseVersion, func(ctx sdk.Context, plan types.Plan, vm module.VersionMap) (module.VersionMap, error) { app.Logger().Info("Running upgrade handler for " + releaseVersion) // Updated version map to the latest consensus versions from each module for m, mb := range app.mm.Modules { vm[m] = mb.ConsensusVersion() } - VersionMigrator{v: vm}.TriggerMigration(observertypes.ModuleName) + VersionMigrator{v: vm}.TriggerMigration(emissionstypes.ModuleName) return app.mm.RunMigrations(ctx, app.configurator, vm) }) diff --git a/changelog.md b/changelog.md index 3c13ec7bee..1ab76e6bd7 100644 --- a/changelog.md +++ b/changelog.md @@ -1,5 +1,10 @@ # CHANGELOG +## Unreleased + +### Refactor +* [2014](https://github.com/zeta-chain/node/pull/2014) - remove params module + ## Unreleased ### Breaking Changes diff --git a/codecov.yml b/codecov.yml index bbdb628387..99fe33e09e 100644 --- a/codecov.yml +++ b/codecov.yml @@ -61,6 +61,7 @@ ignore: - "**/*.yaml" - "**/*.pb.go" - "**/*.pb.gw.go" + - "**/*_legacy.go" - "**/*.json" - ".github/**/*" - "app/**/*" diff --git a/contrib/localnet/scripts/start-zetacored.sh b/contrib/localnet/scripts/start-zetacored.sh index d28f6ae446..41c1b1920f 100755 --- a/contrib/localnet/scripts/start-zetacored.sh +++ b/contrib/localnet/scripts/start-zetacored.sh @@ -121,8 +121,6 @@ then cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][0]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][1]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json cat $HOME/.zetacored/config/genesis.json | jq '.app_state["authority"]["policies"]["items"][2]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json - cat $HOME/.zetacored/config/genesis.json | jq '.app_state["observer"]["params"]["admin_policy"][0]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json - cat $HOME/.zetacored/config/genesis.json | jq '.app_state["observer"]["params"]["admin_policy"][1]["address"]="zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk"' > $HOME/.zetacored/config/tmp_genesis.json && mv $HOME/.zetacored/config/tmp_genesis.json $HOME/.zetacored/config/genesis.json # give balance to runner accounts to deploy contracts directly on zEVM # deployer diff --git a/docs/cli/zetacored/zetacored_query_observer.md b/docs/cli/zetacored/zetacored_query_observer.md index 47e5951c7c..c6d0763b89 100644 --- a/docs/cli/zetacored/zetacored_query_observer.md +++ b/docs/cli/zetacored/zetacored_query_observer.md @@ -36,7 +36,6 @@ zetacored query observer [flags] * [zetacored query observer list-observer-set](zetacored_query_observer_list-observer-set.md) - Query observer set * [zetacored query observer list-pending-nonces](zetacored_query_observer_list-pending-nonces.md) - shows a chainNonces * [zetacored query observer list-tss-history](zetacored_query_observer_list-tss-history.md) - show historical list of TSS -* [zetacored query observer params](zetacored_query_observer_params.md) - shows the parameters of the module * [zetacored query observer show-ballot](zetacored_query_observer_show-ballot.md) - Query BallotByIdentifier * [zetacored query observer show-blame](zetacored_query_observer_show-blame.md) - Query BlameByIdentifier * [zetacored query observer show-chain-nonces](zetacored_query_observer_show-chain-nonces.md) - shows a chainNonces diff --git a/docs/cli/zetacored/zetacored_query_observer_params.md b/docs/cli/zetacored/zetacored_query_observer_params.md deleted file mode 100644 index 96f5f2eca1..0000000000 --- a/docs/cli/zetacored/zetacored_query_observer_params.md +++ /dev/null @@ -1,33 +0,0 @@ -# query observer params - -shows the parameters of the module - -``` -zetacored query observer params [flags] -``` - -### Options - -``` - --grpc-addr string the gRPC endpoint to use for this chain - --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS - --height int Use a specific height to query state at (this can error if the node is pruning state) - -h, --help help for params - --node string [host]:[port] to Tendermint RPC interface for this chain - -o, --output string Output format (text|json) -``` - -### Options inherited from parent commands - -``` - --chain-id string The network chain ID - --home string directory for config and data - --log_format string The logging format (json|plain) - --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) - --trace print out full stack trace on errors -``` - -### SEE ALSO - -* [zetacored query observer](zetacored_query_observer.md) - Querying commands for the observer module - diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index a35e40ae93..7c0a031c2a 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -27239,7 +27239,7 @@ paths: "200": description: A successful response. schema: - $ref: '#/definitions/zetacoreemissionsQueryParamsResponse' + $ref: '#/definitions/emissionsQueryParamsResponse' default: description: An unexpected error response. schema: @@ -28098,21 +28098,6 @@ paths: $ref: '#/definitions/googlerpcStatus' tags: - Query - /zeta-chain/observer/params: - get: - summary: Parameters queries the parameters of the module. - operationId: Query_Params - responses: - "200": - description: A successful response. - schema: - $ref: '#/definitions/zetacoreobserverQueryParamsResponse' - default: - description: An unexpected error response. - schema: - $ref: '#/definitions/googlerpcStatus' - tags: - - Query /zeta-chain/observer/pendingNonces: get: operationId: Query_PendingNoncesAll @@ -53995,8 +53980,35 @@ definitions: ed25519: type: string title: PubKeySet contains two pub keys , secp256k1 and ed25519 + emissionsMsgUpdateParamsResponse: + type: object emissionsMsgWithdrawEmissionResponse: type: object + emissionsParams: + type: object + properties: + max_bond_factor: + type: string + min_bond_factor: + type: string + avg_block_time: + type: string + target_bond_ratio: + type: string + validator_emission_percentage: + type: string + observer_emission_percentage: + type: string + tss_signer_emission_percentage: + type: string + duration_factor_constant: + type: string + observer_slash_amount: + type: string + ballot_maturity_blocks: + type: string + format: int64 + description: Params defines the parameters for the module. emissionsQueryGetEmissionsFactorsResponse: type: object properties: @@ -54015,6 +54027,13 @@ definitions: type: string emission_module_address: type: string + emissionsQueryParamsResponse: + type: object + properties: + params: + $ref: '#/definitions/emissionsParams' + description: params holds all the parameters of this module. + description: QueryParamsResponse is response type for the Query/Params RPC method. emissionsQueryShowAvailableEmissionsResponse: type: object properties: @@ -54228,14 +54247,6 @@ definitions: btcTypeChainEnabled: type: boolean title: VerificationFlags is a structure containing information which chain types are enabled for block header verification - observerAdmin_Policy: - type: object - properties: - policy_type: - $ref: '#/definitions/observerPolicy_Type' - address: - type: string - title: Deprecated(v14):Moved into the authority module observerBallotStatus: type: string enum: @@ -54466,18 +54477,6 @@ definitions: - TSSKeyGen - TSSKeySign default: EmptyObserverType - observerObserverParams: - type: object - properties: - chain: - $ref: '#/definitions/chainsChain' - ballot_threshold: - type: string - min_observer_delegation: - type: string - is_supported: - type: boolean - title: 'Deprecated(v13): Use ChainParamsList' observerObserverUpdateReason: type: string enum: @@ -54500,13 +54499,6 @@ definitions: tss: type: string title: store key is tss+chainid - observerPolicy_Type: - type: string - enum: - - group1 - - group2 - default: group1 - title: Deprecated(v14):Moved into the authority module observerQueryAllBlameRecordsResponse: type: object properties: @@ -54819,61 +54811,6 @@ definitions: format: int64 isAbortRefunded: type: boolean - zetacoreemissionsParams: - type: object - properties: - max_bond_factor: - type: string - min_bond_factor: - type: string - avg_block_time: - type: string - target_bond_ratio: - type: string - validator_emission_percentage: - type: string - observer_emission_percentage: - type: string - tss_signer_emission_percentage: - type: string - duration_factor_constant: - type: string - observer_slash_amount: - type: string - description: Params defines the parameters for the module. - zetacoreemissionsQueryParamsResponse: - type: object - properties: - params: - $ref: '#/definitions/zetacoreemissionsParams' - description: params holds all the parameters of this module. - description: QueryParamsResponse is response type for the Query/Params RPC method. - zetacoreobserverParams: - type: object - properties: - observer_params: - type: array - items: - type: object - $ref: '#/definitions/observerObserverParams' - title: 'Deprecated(v13): Use ChainParamsList' - admin_policy: - type: array - items: - type: object - $ref: '#/definitions/observerAdmin_Policy' - title: Deprecated(v14):Moved into the authority module - ballot_maturity_blocks: - type: string - format: int64 - description: Params defines the parameters for the module. - zetacoreobserverQueryParamsResponse: - type: object - properties: - params: - $ref: '#/definitions/zetacoreobserverParams' - description: params holds all the parameters of this module. - description: QueryParamsResponse is response type for the Query/Params RPC method. ethermint.evm.v1.ChainConfig: type: object properties: diff --git a/docs/spec/emissions/messages.md b/docs/spec/emissions/messages.md index c5fc4a4520..b3549681bd 100644 --- a/docs/spec/emissions/messages.md +++ b/docs/spec/emissions/messages.md @@ -1,5 +1,17 @@ # Messages +## MsgUpdateParams + +UpdateParams defines a governance operation for updating the x/emissions module parameters. +The authority is hard-coded to the x/gov module account. + +```proto +message MsgUpdateParams { + string authority = 1; + Params params = 2; +} +``` + ## MsgWithdrawEmission WithdrawEmission allows the user to withdraw from their withdrawable emissions. diff --git a/proto/emissions/params.proto b/proto/emissions/params.proto index a3168f859f..26f0fb5464 100644 --- a/proto/emissions/params.proto +++ b/proto/emissions/params.proto @@ -20,4 +20,5 @@ message Params { (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Int", (gogoproto.nullable) = false ]; + int64 ballot_maturity_blocks = 10; } diff --git a/proto/emissions/tx.proto b/proto/emissions/tx.proto index 7ea3bba01d..90e8acd4aa 100644 --- a/proto/emissions/tx.proto +++ b/proto/emissions/tx.proto @@ -1,12 +1,14 @@ syntax = "proto3"; package zetachain.zetacore.emissions; +import "emissions/params.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/emissions/types"; // Msg defines the Msg service. service Msg { + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); rpc WithdrawEmission(MsgWithdrawEmission) returns (MsgWithdrawEmissionResponse); } @@ -19,3 +21,10 @@ message MsgWithdrawEmission { } message MsgWithdrawEmissionResponse {} + +message MsgUpdateParams { + string authority = 1; + Params params = 2 [(gogoproto.nullable) = false]; +} + +message MsgUpdateParamsResponse {} diff --git a/proto/observer/genesis.proto b/proto/observer/genesis.proto index 2501c5120f..942a2be931 100644 --- a/proto/observer/genesis.proto +++ b/proto/observer/genesis.proto @@ -22,7 +22,6 @@ message GenesisState { ObserverSet observers = 2 [(gogoproto.nullable) = false]; repeated NodeAccount nodeAccountList = 3; CrosschainFlags crosschain_flags = 4; - Params params = 5; Keygen keygen = 6; LastObserverCount last_observer_count = 7; ChainParamsList chain_params_list = 8 [(gogoproto.nullable) = false]; diff --git a/proto/observer/params.proto b/proto/observer/params.proto index 8c26206ff6..9d8f12ac9d 100644 --- a/proto/observer/params.proto +++ b/proto/observer/params.proto @@ -47,29 +47,3 @@ message ObserverParams { ]; bool is_supported = 5; } - -// Deprecated(v14):Moved into the authority module -enum Policy_Type { - option (gogoproto.goproto_enum_stringer) = true; - group1 = 0; - group2 = 1; -} - -// Deprecated(v14):Moved into the authority module -message Admin_Policy { - Policy_Type policy_type = 1; - string address = 2; -} - -// Params defines the parameters for the module. -message Params { - option (gogoproto.goproto_stringer) = false; - - // Deprecated(v13): Use ChainParamsList - repeated ObserverParams observer_params = 1; - - // Deprecated(v14):Moved into the authority module - repeated Admin_Policy admin_policy = 2; - - int64 ballot_maturity_blocks = 3; -} diff --git a/proto/observer/query.proto b/proto/observer/query.proto index 7aafc2c799..9aceb6cdf1 100644 --- a/proto/observer/query.proto +++ b/proto/observer/query.proto @@ -21,10 +21,6 @@ option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; // Query defines the gRPC querier service. service Query { - // Parameters queries the parameters of the module. - rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { - option (google.api.http).get = "/zeta-chain/observer/params"; - } // Query if a voter has voted for a ballot rpc HasVoted(QueryHasVotedRequest) returns (QueryHasVotedResponse) { option (google.api.http).get = "/zeta-chain/observer/has_voted/{ballot_identifier}/{voter_address}"; @@ -197,14 +193,6 @@ message QueryTssHistoryResponse { cosmos.base.query.v1beta1.PageResponse pagination = 2; } -message QueryParamsRequest {} - -// QueryParamsResponse is response type for the Query/Params RPC method. -message QueryParamsResponse { - // params holds all the parameters of this module. - Params params = 1 [(gogoproto.nullable) = false]; -} - message QueryHasVotedRequest { string ballot_identifier = 1; string voter_address = 2; diff --git a/testutil/keeper/crosschain.go b/testutil/keeper/crosschain.go index 531af3c7b1..0f371c46ea 100644 --- a/testutil/keeper/crosschain.go +++ b/testutil/keeper/crosschain.go @@ -71,7 +71,6 @@ func CrosschainKeeperWithMocks( stateStore, sdkKeepers.StakingKeeper, sdkKeepers.SlashingKeeper, - sdkKeepers.ParamsKeeper, authorityKeeperTmp, lightclientKeeperTmp, ) diff --git a/testutil/keeper/emissions.go b/testutil/keeper/emissions.go index a799b94edb..5a0d190e8b 100644 --- a/testutil/keeper/emissions.go +++ b/testutil/keeper/emissions.go @@ -7,6 +7,7 @@ import ( storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/stretchr/testify/require" tmdb "github.com/tendermint/tm-db" emissionsmocks "github.com/zeta-chain/zetacore/testutil/keeper/mocks/emissions" @@ -19,7 +20,7 @@ type EmissionMockOptions struct { UseStakingMock bool UseObserverMock bool UseAccountMock bool - UseParamStoreMock bool + SkipSettingParams bool } func EmissionsKeeper(t testing.TB) (*keeper.Keeper, sdk.Context, SDKKeepers, ZetaKeepers) { @@ -50,7 +51,6 @@ func EmissionKeeperWithMockOptions( stateStore, sdkKeepers.StakingKeeper, sdkKeepers.SlashingKeeper, - sdkKeepers.ParamsKeeper, authorityKeeper, initLightclientKeeper(cdc, db, stateStore, authorityKeeper), ) @@ -91,30 +91,21 @@ func EmissionKeeperWithMockOptions( observerKeeper = emissionsmocks.NewEmissionObserverKeeper(t) } - var paramStore types.ParamStore - if mockOptions.UseParamStoreMock { - mock := emissionsmocks.NewEmissionParamStore(t) - // mock this method for the keeper constructor - mock.On("HasKeyTable").Maybe().Return(true) - paramStore = mock - } else { - paramStore = sdkKeepers.ParamsKeeper.Subspace(types.ModuleName) - } - k := keeper.NewKeeper( cdc, storeKey, memStoreKey, - paramStore, authtypes.FeeCollectorName, bankKeeper, stakingKeeper, observerKeeper, authKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - if !mockOptions.UseParamStoreMock { - k.SetParams(ctx, types.DefaultParams()) + if !mockOptions.SkipSettingParams { + err := k.SetParams(ctx, types.DefaultParams()) + require.NoError(t, err) } return k, ctx, sdkKeepers, zetaKeepers @@ -126,12 +117,6 @@ func GetEmissionsBankMock(t testing.TB, keeper *keeper.Keeper) *emissionsmocks.E return cbk } -func GetEmissionsParamStoreMock(t testing.TB, keeper *keeper.Keeper) *emissionsmocks.EmissionParamStore { - m, ok := keeper.GetParamStore().(*emissionsmocks.EmissionParamStore) - require.True(t, ok) - return m -} - func GetEmissionsStakingMock(t testing.TB, keeper *keeper.Keeper) *emissionsmocks.EmissionStakingKeeper { cbk, ok := keeper.GetStakingKeeper().(*emissionsmocks.EmissionStakingKeeper) require.True(t, ok) diff --git a/testutil/keeper/fungible.go b/testutil/keeper/fungible.go index ff5f79192a..956ad1e432 100644 --- a/testutil/keeper/fungible.go +++ b/testutil/keeper/fungible.go @@ -101,7 +101,6 @@ func FungibleKeeperWithMocks(t testing.TB, mockOptions FungibleMockOptions) (*ke stateStore, sdkKeepers.StakingKeeper, sdkKeepers.SlashingKeeper, - sdkKeepers.ParamsKeeper, authorityKeeperTmp, lightclientKeeperTmp, ) diff --git a/testutil/keeper/mocks/crosschain/account.go b/testutil/keeper/mocks/crosschain/account.go index 99b7f1cf5b..fbd7c0377b 100644 --- a/testutil/keeper/mocks/crosschain/account.go +++ b/testutil/keeper/mocks/crosschain/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/authority.go b/testutil/keeper/mocks/crosschain/authority.go index fd6ceefa47..9f08c9d673 100644 --- a/testutil/keeper/mocks/crosschain/authority.go +++ b/testutil/keeper/mocks/crosschain/authority.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/bank.go b/testutil/keeper/mocks/crosschain/bank.go index 267f2b45b4..90f4e17e29 100644 --- a/testutil/keeper/mocks/crosschain/bank.go +++ b/testutil/keeper/mocks/crosschain/bank.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index 0b7fc53c89..54b7e54a03 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/lightclient.go b/testutil/keeper/mocks/crosschain/lightclient.go index 53eaf7c398..d5ee740bc3 100644 --- a/testutil/keeper/mocks/crosschain/lightclient.go +++ b/testutil/keeper/mocks/crosschain/lightclient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/observer.go b/testutil/keeper/mocks/crosschain/observer.go index aa05e13226..6c283e45ad 100644 --- a/testutil/keeper/mocks/crosschain/observer.go +++ b/testutil/keeper/mocks/crosschain/observer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/crosschain/staking.go b/testutil/keeper/mocks/crosschain/staking.go index 64bbe0fed6..5b7d3c501f 100644 --- a/testutil/keeper/mocks/crosschain/staking.go +++ b/testutil/keeper/mocks/crosschain/staking.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/emissions/account.go b/testutil/keeper/mocks/emissions/account.go index 265c291e1b..a660d40e72 100644 --- a/testutil/keeper/mocks/emissions/account.go +++ b/testutil/keeper/mocks/emissions/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/emissions/bank.go b/testutil/keeper/mocks/emissions/bank.go index 10bc77649b..8149b5e6af 100644 --- a/testutil/keeper/mocks/emissions/bank.go +++ b/testutil/keeper/mocks/emissions/bank.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/emissions/observer.go b/testutil/keeper/mocks/emissions/observer.go index ce36c71f69..594f090907 100644 --- a/testutil/keeper/mocks/emissions/observer.go +++ b/testutil/keeper/mocks/emissions/observer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks @@ -43,24 +43,32 @@ func (_m *EmissionObserverKeeper) GetBallot(ctx types.Context, index string) (ob return r0, r1 } -// GetMaturedBallotList provides a mock function with given fields: ctx -func (_m *EmissionObserverKeeper) GetMaturedBallotList(ctx types.Context) []string { - ret := _m.Called(ctx) +// GetMaturedBallots provides a mock function with given fields: ctx, maturityBlocks +func (_m *EmissionObserverKeeper) GetMaturedBallots(ctx types.Context, maturityBlocks int64) (observertypes.BallotListForHeight, bool) { + ret := _m.Called(ctx, maturityBlocks) if len(ret) == 0 { - panic("no return value specified for GetMaturedBallotList") + panic("no return value specified for GetMaturedBallots") } - var r0 []string - if rf, ok := ret.Get(0).(func(types.Context) []string); ok { - r0 = rf(ctx) + var r0 observertypes.BallotListForHeight + var r1 bool + if rf, ok := ret.Get(0).(func(types.Context, int64) (observertypes.BallotListForHeight, bool)); ok { + return rf(ctx, maturityBlocks) + } + if rf, ok := ret.Get(0).(func(types.Context, int64) observertypes.BallotListForHeight); ok { + r0 = rf(ctx, maturityBlocks) } else { - if ret.Get(0) != nil { - r0 = ret.Get(0).([]string) - } + r0 = ret.Get(0).(observertypes.BallotListForHeight) } - return r0 + if rf, ok := ret.Get(1).(func(types.Context, int64) bool); ok { + r1 = rf(ctx, maturityBlocks) + } else { + r1 = ret.Get(1).(bool) + } + + return r0, r1 } // NewEmissionObserverKeeper creates a new instance of EmissionObserverKeeper. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. diff --git a/testutil/keeper/mocks/emissions/param_store.go b/testutil/keeper/mocks/emissions/param_store.go deleted file mode 100644 index 4b5a1751cd..0000000000 --- a/testutil/keeper/mocks/emissions/param_store.go +++ /dev/null @@ -1,76 +0,0 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. - -package mocks - -import ( - mock "github.com/stretchr/testify/mock" - - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - - types "github.com/cosmos/cosmos-sdk/types" -) - -// EmissionParamStore is an autogenerated mock type for the EmissionParamStore type -type EmissionParamStore struct { - mock.Mock -} - -// GetParamSetIfExists provides a mock function with given fields: ctx, ps -func (_m *EmissionParamStore) GetParamSetIfExists(ctx types.Context, ps paramstypes.ParamSet) { - _m.Called(ctx, ps) -} - -// HasKeyTable provides a mock function with given fields: -func (_m *EmissionParamStore) HasKeyTable() bool { - ret := _m.Called() - - if len(ret) == 0 { - panic("no return value specified for HasKeyTable") - } - - var r0 bool - if rf, ok := ret.Get(0).(func() bool); ok { - r0 = rf() - } else { - r0 = ret.Get(0).(bool) - } - - return r0 -} - -// SetParamSet provides a mock function with given fields: ctx, ps -func (_m *EmissionParamStore) SetParamSet(ctx types.Context, ps paramstypes.ParamSet) { - _m.Called(ctx, ps) -} - -// WithKeyTable provides a mock function with given fields: table -func (_m *EmissionParamStore) WithKeyTable(table paramstypes.KeyTable) paramstypes.Subspace { - ret := _m.Called(table) - - if len(ret) == 0 { - panic("no return value specified for WithKeyTable") - } - - var r0 paramstypes.Subspace - if rf, ok := ret.Get(0).(func(paramstypes.KeyTable) paramstypes.Subspace); ok { - r0 = rf(table) - } else { - r0 = ret.Get(0).(paramstypes.Subspace) - } - - return r0 -} - -// NewEmissionParamStore creates a new instance of EmissionParamStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. -// The first argument is typically a *testing.T value. -func NewEmissionParamStore(t interface { - mock.TestingT - Cleanup(func()) -}) *EmissionParamStore { - mock := &EmissionParamStore{} - mock.Mock.Test(t) - - t.Cleanup(func() { mock.AssertExpectations(t) }) - - return mock -} diff --git a/testutil/keeper/mocks/emissions/staking.go b/testutil/keeper/mocks/emissions/staking.go index bcfff21c40..7c58333bb5 100644 --- a/testutil/keeper/mocks/emissions/staking.go +++ b/testutil/keeper/mocks/emissions/staking.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/account.go b/testutil/keeper/mocks/fungible/account.go index 94b7a84d75..0522e833b4 100644 --- a/testutil/keeper/mocks/fungible/account.go +++ b/testutil/keeper/mocks/fungible/account.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/authority.go b/testutil/keeper/mocks/fungible/authority.go index b87791c784..929a99021c 100644 --- a/testutil/keeper/mocks/fungible/authority.go +++ b/testutil/keeper/mocks/fungible/authority.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/bank.go b/testutil/keeper/mocks/fungible/bank.go index 20a2590911..db14226310 100644 --- a/testutil/keeper/mocks/fungible/bank.go +++ b/testutil/keeper/mocks/fungible/bank.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/evm.go b/testutil/keeper/mocks/fungible/evm.go index f0dcd01094..28fd46e25c 100644 --- a/testutil/keeper/mocks/fungible/evm.go +++ b/testutil/keeper/mocks/fungible/evm.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/fungible/observer.go b/testutil/keeper/mocks/fungible/observer.go index 5e0aca6a0f..bbe76b1afa 100644 --- a/testutil/keeper/mocks/fungible/observer.go +++ b/testutil/keeper/mocks/fungible/observer.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/lightclient/authority.go b/testutil/keeper/mocks/lightclient/authority.go index f86b893f9c..03dd6972de 100644 --- a/testutil/keeper/mocks/lightclient/authority.go +++ b/testutil/keeper/mocks/lightclient/authority.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/mocks.go b/testutil/keeper/mocks/mocks.go index e8001ab81d..a18893ca68 100644 --- a/testutil/keeper/mocks/mocks.go +++ b/testutil/keeper/mocks/mocks.go @@ -100,11 +100,6 @@ type EmissionObserverKeeper interface { emissionstypes.ObserverKeeper } -//go:generate mockery --name EmissionParamStore --filename param_store.go --case underscore --output ./emissions -type EmissionParamStore interface { - emissionstypes.ParamStore -} - /** * Observer Mocks */ diff --git a/testutil/keeper/mocks/observer/authority.go b/testutil/keeper/mocks/observer/authority.go index 4787b99b8a..76e5e0566c 100644 --- a/testutil/keeper/mocks/observer/authority.go +++ b/testutil/keeper/mocks/observer/authority.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/observer/lightclient.go b/testutil/keeper/mocks/observer/lightclient.go index b25f440330..442d006a5f 100644 --- a/testutil/keeper/mocks/observer/lightclient.go +++ b/testutil/keeper/mocks/observer/lightclient.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/observer/slashing.go b/testutil/keeper/mocks/observer/slashing.go index d3f64ff726..a7793ef8dc 100644 --- a/testutil/keeper/mocks/observer/slashing.go +++ b/testutil/keeper/mocks/observer/slashing.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/mocks/observer/staking.go b/testutil/keeper/mocks/observer/staking.go index 72fe2be116..90007b6c35 100644 --- a/testutil/keeper/mocks/observer/staking.go +++ b/testutil/keeper/mocks/observer/staking.go @@ -1,4 +1,4 @@ -// Code generated by mockery v2.39.1. DO NOT EDIT. +// Code generated by mockery v2.38.0. DO NOT EDIT. package mocks diff --git a/testutil/keeper/observer.go b/testutil/keeper/observer.go index 423341a883..072bc9b2da 100644 --- a/testutil/keeper/observer.go +++ b/testutil/keeper/observer.go @@ -7,7 +7,8 @@ import ( "github.com/cosmos/cosmos-sdk/store" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -43,7 +44,6 @@ func initObserverKeeper( ss store.CommitMultiStore, stakingKeeper stakingkeeper.Keeper, slashingKeeper slashingkeeper.Keeper, - paramKeeper paramskeeper.Keeper, authorityKeeper types.AuthorityKeeper, lightclientKeeper types.LightclientKeeper, ) *keeper.Keeper { @@ -56,11 +56,11 @@ func initObserverKeeper( cdc, storeKey, memKey, - paramKeeper.Subspace(types.ModuleName), stakingKeeper, slashingKeeper, authorityKeeper, lightclientKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) } @@ -115,15 +115,13 @@ func ObserverKeeperWithMocks(t testing.TB, mockOptions ObserverMockOptions) (*ke cdc, storeKey, memStoreKey, - sdkKeepers.ParamsKeeper.Subspace(types.ModuleName), stakingKeeper, slashingKeeper, authorityKeeper, lightclientKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) - k.SetParams(ctx, types.DefaultParams()) - return k, ctx, sdkKeepers, ZetaKeepers{ AuthorityKeeper: &authorityKeeperTmp, } diff --git a/testutil/network/genesis_state.go b/testutil/network/genesis_state.go index dfa3364cfe..6a979e9e4e 100644 --- a/testutil/network/genesis_state.go +++ b/testutil/network/genesis_state.go @@ -132,7 +132,6 @@ func AddObserverData(t *testing.T, n int, genesisState map[string]json.RawMessag if len(ballots) > 0 { state.Ballots = ballots } - state.Params.BallotMaturityBlocks = 3 state.Keygen = &observertypes.Keygen{BlockNumber: 10, GranteePubkeys: []string{}} // set tss diff --git a/typescript/emissions/params_pb.d.ts b/typescript/emissions/params_pb.d.ts index 86bc27895e..0cb4d18691 100644 --- a/typescript/emissions/params_pb.d.ts +++ b/typescript/emissions/params_pb.d.ts @@ -57,6 +57,11 @@ export declare class Params extends Message { */ observerSlashAmount: string; + /** + * @generated from field: int64 ballot_maturity_blocks = 10; + */ + ballotMaturityBlocks: bigint; + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; diff --git a/typescript/emissions/tx_pb.d.ts b/typescript/emissions/tx_pb.d.ts index e8ed75ab15..be44d72aec 100644 --- a/typescript/emissions/tx_pb.d.ts +++ b/typescript/emissions/tx_pb.d.ts @@ -5,6 +5,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; +import type { Params } from "./params_pb.js"; /** * @generated from message zetachain.zetacore.emissions.MsgWithdrawEmission @@ -54,3 +55,51 @@ export declare class MsgWithdrawEmissionResponse extends Message | undefined, b: MsgWithdrawEmissionResponse | PlainMessage | undefined): boolean; } +/** + * @generated from message zetachain.zetacore.emissions.MsgUpdateParams + */ +export declare class MsgUpdateParams extends Message { + /** + * @generated from field: string authority = 1; + */ + authority: string; + + /** + * @generated from field: zetachain.zetacore.emissions.Params params = 2; + */ + params?: Params; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.emissions.MsgUpdateParams"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateParams; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateParams; + + static fromJsonString(jsonString: string, options?: Partial): MsgUpdateParams; + + static equals(a: MsgUpdateParams | PlainMessage | undefined, b: MsgUpdateParams | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.emissions.MsgUpdateParamsResponse + */ +export declare class MsgUpdateParamsResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.emissions.MsgUpdateParamsResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateParamsResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateParamsResponse; + + static fromJsonString(jsonString: string, options?: Partial): MsgUpdateParamsResponse; + + static equals(a: MsgUpdateParamsResponse | PlainMessage | undefined, b: MsgUpdateParamsResponse | PlainMessage | undefined): boolean; +} + diff --git a/typescript/observer/genesis_pb.d.ts b/typescript/observer/genesis_pb.d.ts index 8d0726f3cc..6bd88d4aa9 100644 --- a/typescript/observer/genesis_pb.d.ts +++ b/typescript/observer/genesis_pb.d.ts @@ -9,8 +9,8 @@ import type { Ballot } from "./ballot_pb.js"; import type { LastObserverCount, ObserverSet } from "./observer_pb.js"; import type { NodeAccount } from "./node_account_pb.js"; import type { CrosschainFlags } from "./crosschain_flags_pb.js"; -import type { ChainParamsList, Params } from "./params_pb.js"; import type { Keygen } from "./keygen_pb.js"; +import type { ChainParamsList } from "./params_pb.js"; import type { TSS } from "./tss_pb.js"; import type { TssFundMigratorInfo } from "./tss_funds_migrator_pb.js"; import type { Blame } from "./blame_pb.js"; @@ -42,11 +42,6 @@ export declare class GenesisState extends Message { */ crosschainFlags?: CrosschainFlags; - /** - * @generated from field: zetachain.zetacore.observer.Params params = 5; - */ - params?: Params; - /** * @generated from field: zetachain.zetacore.observer.Keygen keygen = 6; */ diff --git a/typescript/observer/params_pb.d.ts b/typescript/observer/params_pb.d.ts index 93f7ab74c7..fc9698224e 100644 --- a/typescript/observer/params_pb.d.ts +++ b/typescript/observer/params_pb.d.ts @@ -7,23 +7,6 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialM import { Message, proto3 } from "@bufbuild/protobuf"; import type { Chain } from "../pkg/chains/chains_pb.js"; -/** - * Deprecated(v14):Moved into the authority module - * - * @generated from enum zetachain.zetacore.observer.Policy_Type - */ -export declare enum Policy_Type { - /** - * @generated from enum value: group1 = 0; - */ - group1 = 0, - - /** - * @generated from enum value: group2 = 1; - */ - group2 = 1, -} - /** * @generated from message zetachain.zetacore.observer.ChainParamsList */ @@ -178,74 +161,3 @@ export declare class ObserverParams extends Message { static equals(a: ObserverParams | PlainMessage | undefined, b: ObserverParams | PlainMessage | undefined): boolean; } -/** - * Deprecated(v14):Moved into the authority module - * - * @generated from message zetachain.zetacore.observer.Admin_Policy - */ -export declare class Admin_Policy extends Message { - /** - * @generated from field: zetachain.zetacore.observer.Policy_Type policy_type = 1; - */ - policyType: Policy_Type; - - /** - * @generated from field: string address = 2; - */ - address: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.observer.Admin_Policy"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): Admin_Policy; - - static fromJson(jsonValue: JsonValue, options?: Partial): Admin_Policy; - - static fromJsonString(jsonString: string, options?: Partial): Admin_Policy; - - static equals(a: Admin_Policy | PlainMessage | undefined, b: Admin_Policy | PlainMessage | undefined): boolean; -} - -/** - * Params defines the parameters for the module. - * - * @generated from message zetachain.zetacore.observer.Params - */ -export declare class Params extends Message { - /** - * Deprecated(v13): Use ChainParamsList - * - * @generated from field: repeated zetachain.zetacore.observer.ObserverParams observer_params = 1; - */ - observerParams: ObserverParams[]; - - /** - * Deprecated(v14):Moved into the authority module - * - * @generated from field: repeated zetachain.zetacore.observer.Admin_Policy admin_policy = 2; - */ - adminPolicy: Admin_Policy[]; - - /** - * @generated from field: int64 ballot_maturity_blocks = 3; - */ - ballotMaturityBlocks: bigint; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.observer.Params"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): Params; - - static fromJson(jsonValue: JsonValue, options?: Partial): Params; - - static fromJsonString(jsonString: string, options?: Partial): Params; - - static equals(a: Params | PlainMessage | undefined, b: Params | PlainMessage | undefined): boolean; -} - diff --git a/typescript/observer/query_pb.d.ts b/typescript/observer/query_pb.d.ts index a5d8bef48f..d0d069eb61 100644 --- a/typescript/observer/query_pb.d.ts +++ b/typescript/observer/query_pb.d.ts @@ -9,10 +9,10 @@ import type { ChainNonces } from "./chain_nonces_pb.js"; import type { PageRequest, PageResponse } from "../cosmos/base/query/v1beta1/pagination_pb.js"; import type { PendingNonces } from "./pending_nonces_pb.js"; import type { TSS } from "./tss_pb.js"; -import type { ChainParams, ChainParamsList, Params } from "./params_pb.js"; import type { BallotStatus, VoteType } from "./ballot_pb.js"; import type { LastObserverCount, ObservationType } from "./observer_pb.js"; import type { Chain } from "../pkg/chains/chains_pb.js"; +import type { ChainParams, ChainParamsList } from "./params_pb.js"; import type { NodeAccount } from "./node_account_pb.js"; import type { CrosschainFlags } from "./crosschain_flags_pb.js"; import type { Keygen } from "./keygen_pb.js"; @@ -427,53 +427,6 @@ export declare class QueryTssHistoryResponse extends Message | undefined, b: QueryTssHistoryResponse | PlainMessage | undefined): boolean; } -/** - * @generated from message zetachain.zetacore.observer.QueryParamsRequest - */ -export declare class QueryParamsRequest extends Message { - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.observer.QueryParamsRequest"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryParamsRequest; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryParamsRequest; - - static fromJsonString(jsonString: string, options?: Partial): QueryParamsRequest; - - static equals(a: QueryParamsRequest | PlainMessage | undefined, b: QueryParamsRequest | PlainMessage | undefined): boolean; -} - -/** - * QueryParamsResponse is response type for the Query/Params RPC method. - * - * @generated from message zetachain.zetacore.observer.QueryParamsResponse - */ -export declare class QueryParamsResponse extends Message { - /** - * params holds all the parameters of this module. - * - * @generated from field: zetachain.zetacore.observer.Params params = 1; - */ - params?: Params; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.observer.QueryParamsResponse"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): QueryParamsResponse; - - static fromJson(jsonValue: JsonValue, options?: Partial): QueryParamsResponse; - - static fromJsonString(jsonString: string, options?: Partial): QueryParamsResponse; - - static equals(a: QueryParamsResponse | PlainMessage | undefined, b: QueryParamsResponse | PlainMessage | undefined): boolean; -} - /** * @generated from message zetachain.zetacore.observer.QueryHasVotedRequest */ diff --git a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go index 87ff60e729..24103fa2c3 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go @@ -88,12 +88,6 @@ func TestKeeper_VoteOnObservedInboundTx(t *testing.T) { // MsgServer for the crosschain keeper msgServer := keeper.NewMsgServerImpl(*k) - // Set the chain ids we want to use to be valid - params := observertypes.DefaultParams() - zk.ObserverKeeper.SetParams( - ctx, params, - ) - // Convert the validator address into a user address. validators := k.GetStakingKeeper().GetAllValidators(ctx) validatorAddress := validators[0].OperatorAddress diff --git a/x/emissions/abci.go b/x/emissions/abci.go index 1f6cdd627c..bd1831aa48 100644 --- a/x/emissions/abci.go +++ b/x/emissions/abci.go @@ -20,17 +20,13 @@ func BeginBlocker(ctx sdk.Context, keeper keeper.Keeper) { } // Get the distribution of rewards - params := keeper.GetParamsIfExists(ctx) - validatorRewards, observerRewards, tssSignerRewards := types.GetRewardsDistributions(params) - - // TODO : Replace hardcoded slash amount with a parameter - // https://github.com/zeta-chain/node/pull/1861 - slashAmount, ok := sdkmath.NewIntFromString(types.ObserverSlashAmount) - if !ok { - ctx.Logger().Error(fmt.Sprintf("Error while parsing observer slash amount %s", types.ObserverSlashAmount)) + params, found := keeper.GetParams(ctx) + if !found { return } + validatorRewards, observerRewards, tssSignerRewards := types.GetRewardsDistributions(params) + // Use a tmpCtx, which is a cache-wrapped context to avoid writing to the store // We commit only if all three distributions are successful, if not the funds stay in the emission pool tmpCtx, commit := ctx.CacheContext() @@ -39,7 +35,7 @@ func BeginBlocker(ctx sdk.Context, keeper keeper.Keeper) { ctx.Logger().Error(fmt.Sprintf("Error while distributing validator rewards %s", err)) return } - err = DistributeObserverRewards(tmpCtx, observerRewards, keeper, slashAmount) + err = DistributeObserverRewards(tmpCtx, observerRewards, keeper, params) if err != nil { ctx.Logger().Error(fmt.Sprintf("Error while distributing observer rewards %s", err)) return @@ -75,16 +71,22 @@ func DistributeObserverRewards( ctx sdk.Context, amount sdkmath.Int, keeper keeper.Keeper, - slashAmount sdkmath.Int, + params types.Params, ) error { - + slashAmount := params.ObserverSlashAmount rewardsDistributer := map[string]int64{} totalRewardsUnits := int64(0) err := keeper.GetBankKeeper().SendCoinsFromModuleToModule(ctx, types.ModuleName, types.UndistributedObserverRewardsPool, sdk.NewCoins(sdk.NewCoin(config.BaseDenom, amount))) if err != nil { return err } - ballotIdentifiers := keeper.GetObserverKeeper().GetMaturedBallotList(ctx) + + list, found := keeper.GetObserverKeeper().GetMaturedBallots(ctx, params.BallotMaturityBlocks) + ballotIdentifiers := []string{} + if found { + ballotIdentifiers = list.BallotsIndexList + } + // do not distribute rewards if no ballots are matured, the rewards can accumulate in the undistributed pool if len(ballotIdentifiers) == 0 { return nil diff --git a/x/emissions/abci_test.go b/x/emissions/abci_test.go index 1f60857be4..9b7362f4d8 100644 --- a/x/emissions/abci_test.go +++ b/x/emissions/abci_test.go @@ -186,10 +186,12 @@ func TestBeginBlocker(t *testing.T) { feeCollecterAddress := sk.AuthKeeper.GetModuleAccount(ctx, types.FeeCollectorName).GetAddress() emissionPool := sk.AuthKeeper.GetModuleAccount(ctx, emissionstypes.ModuleName).GetAddress() + params, found := k.GetParams(ctx) + require.True(t, found) blockRewards := emissionstypes.BlockReward - observerRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).ObserverEmissionPercentage)).TruncateInt() - validatorRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).ValidatorEmissionPercentage)).TruncateInt() - tssSignerRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).TssSignerEmissionPercentage)).TruncateInt() + observerRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(params.ObserverEmissionPercentage)).TruncateInt() + validatorRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(params.ValidatorEmissionPercentage)).TruncateInt() + tssSignerRewardsForABlock := blockRewards.Mul(sdk.MustNewDecFromStr(params.TssSignerEmissionPercentage)).TruncateInt() distributedRewards := observerRewardsForABlock.Add(validatorRewardsForABlock).Add(tssSignerRewardsForABlock) require.True(t, blockRewards.TruncateInt().GT(distributedRewards)) @@ -357,7 +359,8 @@ func TestDistributeObserverRewards(t *testing.T) { // Set the params params := emissionstypes.DefaultParams() params.ObserverSlashAmount = tc.slashAmount - k.SetParams(ctx, params) + err = k.SetParams(ctx, params) + require.NoError(t, err) // Set the ballot list ballotIdentifiers := []string{} @@ -378,7 +381,7 @@ func TestDistributeObserverRewards(t *testing.T) { ctx = ctx.WithBlockHeight(100) // Distribute the rewards and check if the rewards are distributed correctly - err = emissionsModule.DistributeObserverRewards(ctx, tc.totalRewardsForBlock, *k, tc.slashAmount) + err = emissionsModule.DistributeObserverRewards(ctx, tc.totalRewardsForBlock, *k, params) require.NoError(t, err) for i, observer := range observerSet.ObserverList { diff --git a/x/emissions/exported/exported.go b/x/emissions/exported/exported.go new file mode 100644 index 0000000000..000114e619 --- /dev/null +++ b/x/emissions/exported/exported.go @@ -0,0 +1,18 @@ +package exported + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +type ( + ParamSet = paramtypes.ParamSet + + // Subspace defines an interface that implements the legacy x/params Subspace + // type. + // + // NOTE: This is used solely for migration of x/params managed parameters. + Subspace interface { + GetParamSet(ctx sdk.Context, ps ParamSet) + } +) diff --git a/x/emissions/genesis.go b/x/emissions/genesis.go index b278330eeb..81939d55bb 100644 --- a/x/emissions/genesis.go +++ b/x/emissions/genesis.go @@ -1,6 +1,8 @@ package emissions import ( + "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/x/emissions/keeper" "github.com/zeta-chain/zetacore/x/emissions/types" @@ -9,7 +11,9 @@ import ( // InitGenesis initializes the emissions module's state from a provided genesis // state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - k.SetParams(ctx, genState.Params) + if err := k.SetParams(ctx, genState.Params); err != nil { + panic(fmt.Sprintf("invalid emissions module params: %v\n", genState.Params)) + } for _, we := range genState.WithdrawableEmissions { k.SetWithdrawableEmission(ctx, we) @@ -19,7 +23,11 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) // ExportGenesis returns the emissions module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { var genesis types.GenesisState - genesis.Params = k.GetParamsIfExists(ctx) + params, found := k.GetParams(ctx) + if !found { + params = types.Params{} + } + genesis.Params = params genesis.WithdrawableEmissions = k.GetAllWithdrawableEmission(ctx) return &genesis diff --git a/x/emissions/genesis_test.go b/x/emissions/genesis_test.go index 79edd3bf90..1b14a60315 100644 --- a/x/emissions/genesis_test.go +++ b/x/emissions/genesis_test.go @@ -3,8 +3,6 @@ package emissions_test import ( "testing" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/nullify" @@ -14,26 +12,47 @@ import ( ) func TestGenesis(t *testing.T) { - params := types.DefaultParams() - params.ObserverSlashAmount = sdk.Int{} - - genesisState := types.GenesisState{ - Params: params, - WithdrawableEmissions: []types.WithdrawableEmissions{ - sample.WithdrawableEmissions(t), - sample.WithdrawableEmissions(t), - sample.WithdrawableEmissions(t), - }, - } - - // Init and export - k, ctx, _, _ := keepertest.EmissionsKeeper(t) - emissions.InitGenesis(ctx, *k, genesisState) - got := emissions.ExportGenesis(ctx, *k) - require.NotNil(t, got) - - // Compare genesis after init and export - nullify.Fill(&genesisState) - nullify.Fill(got) - require.Equal(t, genesisState, *got) + t.Run("should init and export for valid state", func(t *testing.T) { + params := types.DefaultParams() + + genesisState := types.GenesisState{ + Params: params, + WithdrawableEmissions: []types.WithdrawableEmissions{ + sample.WithdrawableEmissions(t), + sample.WithdrawableEmissions(t), + sample.WithdrawableEmissions(t), + }, + } + + // Init and export + k, ctx, _, _ := keepertest.EmissionsKeeper(t) + emissions.InitGenesis(ctx, *k, genesisState) + got := emissions.ExportGenesis(ctx, *k) + require.NotNil(t, got) + + // Compare genesis after init and export + nullify.Fill(&genesisState) + nullify.Fill(got) + require.Equal(t, genesisState, *got) + }) + + t.Run("should error for invalid params", func(t *testing.T) { + params := types.DefaultParams() + params.MinBondFactor = "0.50" + + genesisState := types.GenesisState{ + Params: params, + WithdrawableEmissions: []types.WithdrawableEmissions{ + sample.WithdrawableEmissions(t), + sample.WithdrawableEmissions(t), + sample.WithdrawableEmissions(t), + }, + } + + // Init and export + k, ctx, _, _ := keepertest.EmissionsKeeper(t) + require.Panics(t, func() { + emissions.InitGenesis(ctx, *k, genesisState) + }) + }) } diff --git a/x/emissions/keeper/block_rewards_components.go b/x/emissions/keeper/block_rewards_components.go index fc105842aa..e9786876a7 100644 --- a/x/emissions/keeper/block_rewards_components.go +++ b/x/emissions/keeper/block_rewards_components.go @@ -7,56 +7,16 @@ import ( "github.com/zeta-chain/zetacore/x/emissions/types" ) -func (k Keeper) GetBlockRewardComponents(ctx sdk.Context) (sdk.Dec, sdk.Dec, sdk.Dec) { +func (k Keeper) GetBlockRewardComponents(ctx sdk.Context, params types.Params) (sdk.Dec, sdk.Dec, sdk.Dec) { reservesFactor := k.GetReservesFactor(ctx) if reservesFactor.LTE(sdk.ZeroDec()) { return sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec() } - bondFactor := k.GetBondFactor(ctx, k.GetStakingKeeper()) - durationFactor := k.GetDurationFactor(ctx) + bondFactor := params.GetBondFactor(k.stakingKeeper.BondedRatio(ctx)) + durationFactor := params.GetDurationFactor(ctx.BlockHeight()) return reservesFactor, bondFactor, durationFactor } -func (k Keeper) GetBondFactor(ctx sdk.Context, stakingKeeper types.StakingKeeper) sdk.Dec { - targetBondRatio := sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).TargetBondRatio) - maxBondFactor := sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).MaxBondFactor) - minBondFactor := sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).MinBondFactor) - - currentBondedRatio := stakingKeeper.BondedRatio(ctx) - // Bond factor ranges between minBondFactor (0.75) to maxBondFactor (1.25) - if currentBondedRatio.IsZero() { - return sdk.ZeroDec() - } - bondFactor := targetBondRatio.Quo(currentBondedRatio) - if bondFactor.GT(maxBondFactor) { - return maxBondFactor - } - if bondFactor.LT(minBondFactor) { - return minBondFactor - } - return bondFactor -} - -func (k Keeper) GetDurationFactor(ctx sdk.Context) sdk.Dec { - avgBlockTime := sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).AvgBlockTime) - NumberOfBlocksInAMonth := sdk.NewDec(types.SecsInMonth).Quo(avgBlockTime) - monthFactor := sdk.NewDec(ctx.BlockHeight()).Quo(NumberOfBlocksInAMonth) - logValueDec := sdk.MustNewDecFromStr(k.GetParamsIfExists(ctx).DurationFactorConstant) - // month * log(1 + 0.02 / 12) - fractionNumerator := monthFactor.Mul(logValueDec) - // (month * log(1 + 0.02 / 12) ) + 1 - fractionDenominator := fractionNumerator.Add(sdk.OneDec()) - - // (month * log(1 + 0.02 / 12)) / (month * log(1 + 0.02 / 12) ) + 1 - if fractionDenominator.IsZero() { - return sdk.OneDec() - } - if fractionNumerator.IsZero() { - return sdk.ZeroDec() - } - return fractionNumerator.Quo(fractionDenominator) -} - func (k Keeper) GetReservesFactor(ctx sdk.Context) sdk.Dec { reserveAmount := k.GetBankKeeper().GetBalance(ctx, types.EmissionsModuleAddress, config.BaseDenom) return sdk.NewDecFromInt(reserveAmount.Amount) diff --git a/x/emissions/keeper/block_rewards_components_test.go b/x/emissions/keeper/block_rewards_components_test.go index a203757a4f..6f4acf004a 100644 --- a/x/emissions/keeper/block_rewards_components_test.go +++ b/x/emissions/keeper/block_rewards_components_test.go @@ -82,7 +82,7 @@ func TestKeeper_GetBlockRewardComponent(t *testing.T) { ctx, mock.Anything, config.BaseDenom). Return(sdk.NewCoin(config.BaseDenom, math.NewInt(0)), nil).Once() - reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx) + reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx, emissionstypes.DefaultParams()) require.Equal(t, sdk.ZeroDec(), reservesFactor) require.Equal(t, sdk.ZeroDec(), bondFactor) require.Equal(t, sdk.ZeroDec(), durationFactor) @@ -98,7 +98,7 @@ func TestKeeper_GetBlockRewardComponent(t *testing.T) { ctx, mock.Anything, config.BaseDenom). Return(sdk.NewCoin(config.BaseDenom, math.NewInt(1)), nil).Once() - reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx) + reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx, emissionstypes.DefaultParams()) require.Equal(t, sdk.OneDec(), reservesFactor) // bonded ratio is 0 require.Equal(t, sdk.ZeroDec(), bondFactor) @@ -107,81 +107,3 @@ func TestKeeper_GetBlockRewardComponent(t *testing.T) { require.Positive(t, durationFactor.BigInt().Int64()) }) } - -func TestKeeper_GetBondFactor(t *testing.T) { - t.Run("should return 0 if current bond ratio is 0", func(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionsKeeper(t) - - bondFactor := k.GetBondFactor(ctx, k.GetStakingKeeper()) - require.Equal(t, sdk.ZeroDec(), bondFactor) - }) - - t.Run("should return max bond factor if bond factor exceeds max bond factor", func(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionKeeperWithMockOptions(t, keepertest.EmissionMockOptions{ - UseStakingMock: true, - }) - - params := emissionstypes.DefaultParams() - params.TargetBondRatio = "0.5" - params.MaxBondFactor = "1.1" - params.MinBondFactor = "0.9" - k.SetParams(ctx, params) - - stakingMock := keepertest.GetEmissionsStakingMock(t, k) - stakingMock.On("BondedRatio", ctx).Return(sdk.MustNewDecFromStr("0.25")) - bondFactor := k.GetBondFactor(ctx, k.GetStakingKeeper()) - require.Equal(t, sdk.MustNewDecFromStr(params.MaxBondFactor), bondFactor) - }) - - t.Run("should return min bond factor if bond factor below min bond factor", func(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionKeeperWithMockOptions(t, keepertest.EmissionMockOptions{ - UseStakingMock: true, - }) - - params := emissionstypes.DefaultParams() - params.TargetBondRatio = "0.5" - params.MaxBondFactor = "1.1" - params.MinBondFactor = "0.9" - k.SetParams(ctx, params) - - stakingMock := keepertest.GetEmissionsStakingMock(t, k) - stakingMock.On("BondedRatio", ctx).Return(sdk.MustNewDecFromStr("0.75")) - bondFactor := k.GetBondFactor(ctx, k.GetStakingKeeper()) - require.Equal(t, sdk.MustNewDecFromStr(params.MinBondFactor), bondFactor) - }) - - t.Run("should return calculated bond factor if bond factor in range", func(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionKeeperWithMockOptions(t, keepertest.EmissionMockOptions{ - UseStakingMock: true, - }) - - params := emissionstypes.DefaultParams() - params.TargetBondRatio = "0.5" - params.MaxBondFactor = "1.1" - params.MinBondFactor = "0.9" - k.SetParams(ctx, params) - - stakingMock := keepertest.GetEmissionsStakingMock(t, k) - stakingMock.On("BondedRatio", ctx).Return(sdk.MustNewDecFromStr("0.5")) - bondFactor := k.GetBondFactor(ctx, k.GetStakingKeeper()) - require.Equal(t, sdk.OneDec(), bondFactor) - }) -} - -func TestKeeper_GetDurationFactor(t *testing.T) { - t.Run("should return duration factor 0 if duration factor constant is 0", func(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionsKeeper(t) - params := emissionstypes.DefaultParams() - params.DurationFactorConstant = "0" - k.SetParams(ctx, params) - duractionFactor := k.GetDurationFactor(ctx) - require.Equal(t, sdk.ZeroDec(), duractionFactor) - }) - - t.Run("should return duration factor for default params", func(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionsKeeper(t) - duractionFactor := k.GetDurationFactor(ctx) - // hardcoding actual expected value for default params, it will change if logic changes - require.Equal(t, sdk.MustNewDecFromStr("0.000000004346937374"), duractionFactor) - }) -} diff --git a/x/emissions/keeper/grpc_query_get_emmisons_factors.go b/x/emissions/keeper/grpc_query_get_emmisons_factors.go index 032c68c176..5b265de52a 100644 --- a/x/emissions/keeper/grpc_query_get_emmisons_factors.go +++ b/x/emissions/keeper/grpc_query_get_emmisons_factors.go @@ -5,12 +5,17 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/x/emissions/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" ) func (k Keeper) GetEmissionsFactors(goCtx context.Context, _ *types.QueryGetEmissionsFactorsRequest) (*types.QueryGetEmissionsFactorsResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx) + params, found := k.GetParams(ctx) + if !found { + return nil, status.Error(codes.Internal, "params not found") + } + reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx, params) return &types.QueryGetEmissionsFactorsResponse{ ReservesFactor: reservesFactor.String(), BondFactor: bondFactor.String(), diff --git a/x/emissions/keeper/grpc_query_get_emmisons_factors_test.go b/x/emissions/keeper/grpc_query_get_emmisons_factors_test.go index f9bd288634..a2b44ebc6c 100644 --- a/x/emissions/keeper/grpc_query_get_emmisons_factors_test.go +++ b/x/emissions/keeper/grpc_query_get_emmisons_factors_test.go @@ -10,17 +10,28 @@ import ( ) func TestKeeper_GetEmissionsFactors(t *testing.T) { - k, ctx, _, _ := keepertest.EmissionsKeeper(t) - wctx := sdk.WrapSDKContext(ctx) + t.Run("should return emissions factor", func(t *testing.T) { + k, ctx, _, _ := keepertest.EmissionsKeeper(t) + wctx := sdk.WrapSDKContext(ctx) - res, err := k.GetEmissionsFactors(wctx, nil) - require.NoError(t, err) + res, err := k.GetEmissionsFactors(wctx, nil) + require.NoError(t, err) - reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx) - expectedRes := &types.QueryGetEmissionsFactorsResponse{ - ReservesFactor: reservesFactor.String(), - BondFactor: bondFactor.String(), - DurationFactor: durationFactor.String(), - } - require.Equal(t, expectedRes, res) + reservesFactor, bondFactor, durationFactor := k.GetBlockRewardComponents(ctx, types.DefaultParams()) + expectedRes := &types.QueryGetEmissionsFactorsResponse{ + ReservesFactor: reservesFactor.String(), + BondFactor: bondFactor.String(), + DurationFactor: durationFactor.String(), + } + require.Equal(t, expectedRes, res) + }) + + t.Run("should fail if params not found", func(t *testing.T) { + k, ctx, _, _ := keepertest.EmissionKeeperWithMockOptions(t, keepertest.EmissionMockOptions{SkipSettingParams: true}) + wctx := sdk.WrapSDKContext(ctx) + + res, err := k.GetEmissionsFactors(wctx, nil) + require.Nil(t, res) + require.Error(t, err) + }) } diff --git a/x/emissions/keeper/grpc_query_params.go b/x/emissions/keeper/grpc_query_params.go index acc804124d..97f4a9077f 100644 --- a/x/emissions/keeper/grpc_query_params.go +++ b/x/emissions/keeper/grpc_query_params.go @@ -14,6 +14,10 @@ func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types return nil, status.Error(codes.InvalidArgument, "invalid request") } ctx := sdk.UnwrapSDKContext(c) + params, found := k.GetParams(ctx) + if !found { + return nil, status.Error(codes.NotFound, "params not found") + } - return &types.QueryParamsResponse{Params: k.GetParamsIfExists(ctx)}, nil + return &types.QueryParamsResponse{Params: params}, nil } diff --git a/x/emissions/keeper/keeper.go b/x/emissions/keeper/keeper.go index aadabb61f7..6667fa8de5 100644 --- a/x/emissions/keeper/keeper.go +++ b/x/emissions/keeper/keeper.go @@ -16,12 +16,14 @@ type ( cdc codec.BinaryCodec storeKey storetypes.StoreKey memKey storetypes.StoreKey - paramStore types.ParamStore feeCollectorName string bankKeeper types.BankKeeper stakingKeeper types.StakingKeeper observerKeeper types.ObserverKeeper authKeeper types.AccountKeeper + // the address capable of executing a MsgUpdateParams message. Typically, this + // should be the x/gov module account. + authority string } ) @@ -29,28 +31,27 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, - ps types.ParamStore, feeCollectorName string, bankKeeper types.BankKeeper, stakingKeeper types.StakingKeeper, observerKeeper types.ObserverKeeper, authKeeper types.AccountKeeper, + authority string, ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(err) } return &Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, - paramStore: ps, feeCollectorName: feeCollectorName, bankKeeper: bankKeeper, stakingKeeper: stakingKeeper, observerKeeper: observerKeeper, authKeeper: authKeeper, + authority: authority, } } @@ -78,6 +79,6 @@ func (k Keeper) GetAuthKeeper() types.AccountKeeper { return k.authKeeper } -func (k Keeper) GetParamStore() types.ParamStore { - return k.paramStore +func (k Keeper) GetAuthority() string { + return k.authority } diff --git a/x/emissions/keeper/migrator.go b/x/emissions/keeper/migrator.go new file mode 100644 index 0000000000..bf40f54e31 --- /dev/null +++ b/x/emissions/keeper/migrator.go @@ -0,0 +1,26 @@ +package keeper + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/emissions/exported" + v3 "github.com/zeta-chain/zetacore/x/emissions/migrations/v3" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper Keeper + legacySubspace exported.Subspace +} + +// NewMigrator returns a new Migrator. +func NewMigrator(k Keeper, ss exported.Subspace) Migrator { + return Migrator{ + keeper: k, + legacySubspace: ss, + } +} + +// Migrate2to3 migrates the store from consensus version 2 to 3 +func (m Migrator) Migrate2to3(ctx sdk.Context) error { + return v3.MigrateStore(ctx, m.keeper, m.legacySubspace) +} diff --git a/x/emissions/keeper/msg_server_update_params.go b/x/emissions/keeper/msg_server_update_params.go new file mode 100644 index 0000000000..9581a1b19f --- /dev/null +++ b/x/emissions/keeper/msg_server_update_params.go @@ -0,0 +1,26 @@ +package keeper + +import ( + "context" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/zeta-chain/zetacore/x/emissions/types" +) + +// UpdateParams defines a governance operation for updating the x/emissions module parameters. +// The authority is hard-coded to the x/gov module account. +func (k msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if msg.Authority != k.authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", k.authority, msg.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + err := k.SetParams(ctx, msg.Params) + if err != nil { + return nil, errors.Wrapf(types.ErrUnableToSetParams, err.Error()) + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/emissions/keeper/msg_server_update_params_test.go b/x/emissions/keeper/msg_server_update_params_test.go new file mode 100644 index 0000000000..ecf4376742 --- /dev/null +++ b/x/emissions/keeper/msg_server_update_params_test.go @@ -0,0 +1,54 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/emissions/keeper" + "github.com/zeta-chain/zetacore/x/emissions/types" +) + +func TestMsgServer_UpdateParams(t *testing.T) { + t.Run("successfully update params", func(t *testing.T) { + k, ctx, _, _ := keepertest.EmissionsKeeper(t) + msgServer := keeper.NewMsgServerImpl(*k) + + res, err := msgServer.UpdateParams(ctx, &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: types.DefaultParams(), + }) + + require.NoError(t, err) + require.Empty(t, res) + params, found := k.GetParams(ctx) + require.True(t, found) + require.Equal(t, types.DefaultParams(), params) + }) + + t.Run("fail for wrong authority", func(t *testing.T) { + k, ctx, _, _ := keepertest.EmissionsKeeper(t) + msgServer := keeper.NewMsgServerImpl(*k) + + _, err := msgServer.UpdateParams(ctx, &types.MsgUpdateParams{ + Authority: sample.AccAddress(), + Params: types.DefaultParams(), + }) + + require.Error(t, err) + }) + + t.Run("fail for invalid params", func(t *testing.T) { + k, ctx, _, _ := keepertest.EmissionsKeeper(t) + msgServer := keeper.NewMsgServerImpl(*k) + params := types.DefaultParams() + params.ValidatorEmissionPercentage = "-1.5" + _, err := msgServer.UpdateParams(ctx, &types.MsgUpdateParams{ + Authority: k.GetAuthority(), + Params: params, + }) + + require.ErrorIs(t, err, types.ErrUnableToSetParams) + }) +} diff --git a/x/emissions/keeper/params.go b/x/emissions/keeper/params.go index 5369e0953a..2ba5a542a7 100644 --- a/x/emissions/keeper/params.go +++ b/x/emissions/keeper/params.go @@ -5,14 +5,33 @@ import ( "github.com/zeta-chain/zetacore/x/emissions/types" ) -// GetParamsIfExists get all parameters as types.Params if they exist -// non existent parameters will return zero values -func (k Keeper) GetParamsIfExists(ctx sdk.Context) (params types.Params) { - k.paramStore.GetParamSetIfExists(ctx, ¶ms) - return +// GetParams get all parameters +func (k Keeper) GetParams(ctx sdk.Context) (params types.Params, found bool) { + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.KeyPrefix(types.ParamsKey)) + if bz == nil { + return types.Params{}, false + } + err := k.cdc.Unmarshal(bz, ¶ms) + if err != nil { + return types.Params{}, false + } + + return params, true } // SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramStore.SetParamSet(ctx, ¶ms) +func (k Keeper) SetParams(ctx sdk.Context, params types.Params) error { + if err := params.Validate(); err != nil { + return err + } + + store := ctx.KVStore(k.storeKey) + bz, err := k.cdc.Marshal(¶ms) + if err != nil { + return err + } + + store.Set(types.KeyPrefix(types.ParamsKey), bz) + return nil } diff --git a/x/emissions/keeper/params_test.go b/x/emissions/keeper/params_test.go index 6b85f76444..21e8b4c2df 100644 --- a/x/emissions/keeper/params_test.go +++ b/x/emissions/keeper/params_test.go @@ -3,6 +3,7 @@ package keeper_test import ( "testing" + sdkmath "cosmossdk.io/math" "github.com/stretchr/testify/require" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types" @@ -10,9 +11,9 @@ import ( func TestKeeper_GetParams(t *testing.T) { tests := []struct { - name string - params emissionstypes.Params - isPanic string + name string + params emissionstypes.Params + constainsErr string }{ { name: "Successfully set params", @@ -25,8 +26,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "", + constainsErr: "", }, { name: "negative observer slashed amount", @@ -39,8 +41,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(-100000000000000000), }, - isPanic: "slash amount cannot be less than 0", + constainsErr: "slash amount cannot be less than 0", }, { name: "MaxBondFactor too high", @@ -53,8 +56,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "max bond factor cannot be higher that 0.25", + constainsErr: "max bond factor cannot be higher that 1.25", }, { name: "MinBondFactor too low", @@ -67,8 +71,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "min bond factor cannot be lower that 0.75", + constainsErr: "min bond factor cannot be lower that 0.75", }, { name: "invalid block time", @@ -81,8 +86,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "invalid block time", + constainsErr: "invalid block time", }, { name: "invalid block time less than 0", @@ -95,8 +101,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "block time cannot be less than or equal to 0", + constainsErr: "block time cannot be less than or equal to 0", }, { name: "bond ratio too high", @@ -109,8 +116,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "target bond ratio cannot be more than 100 percent", + constainsErr: "target bond ratio cannot be more than 100 percent", }, { name: "bond ratio too low", @@ -123,8 +131,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "target bond ratio cannot be less than 0 percent", + constainsErr: "target bond ratio cannot be less than 0 percent", }, { name: "validator emission percentage too high", @@ -137,8 +146,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "validator emission percentage cannot be more than 100 percent", + constainsErr: "validator emission percentage cannot be more than 100 percent", }, { name: "validator emission percentage too low", @@ -151,8 +161,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "validator emission percentage cannot be less than 0 percent", + constainsErr: "validator emission percentage cannot be less than 0 percent", }, { name: "observer percentage too low", @@ -165,8 +176,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "-00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "observer emission percentage cannot be less than 0 percent", + constainsErr: "observer emission percentage cannot be less than 0 percent", }, { name: "observer percentage too high", @@ -179,8 +191,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "150.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "observer emission percentage cannot be more than 100 percent", + constainsErr: "observer emission percentage cannot be more than 100 percent", }, { name: "tss signer percentage too high", @@ -193,8 +206,9 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "102.22", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "tss emission percentage cannot be more than 100 percent", + constainsErr: "tss emission percentage cannot be more than 100 percent", }, { name: "tss signer percentage too low", @@ -207,32 +221,30 @@ func TestKeeper_GetParams(t *testing.T) { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "-102.22", DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), }, - isPanic: "tss emission percentage cannot be less than 0 percent", + constainsErr: "tss emission percentage cannot be less than 0 percent", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { k, ctx, _, _ := keepertest.EmissionsKeeper(t) - assertPanic(t, func() { - k.SetParams(ctx, tt.params) - }, tt.isPanic) - - if tt.isPanic != "" { - require.Equal(t, emissionstypes.DefaultParams(), k.GetParamsIfExists(ctx)) + err := k.SetParams(ctx, tt.params) + if tt.constainsErr != "" { + require.ErrorContains(t, err, tt.constainsErr) } else { - require.Equal(t, tt.params, k.GetParamsIfExists(ctx)) + require.NoError(t, err) + params, found := k.GetParams(ctx) + require.True(t, found) + require.Equal(t, tt.params, params) } }) } } -func assertPanic(t *testing.T, f func(), errorLog string) { - defer func() { - r := recover() - if r != nil { - require.Contains(t, r, errorLog) - } - }() - f() +func TestKeeper_GetParamsIfParamsNotSet(t *testing.T) { + k, ctx, _, _ := keepertest.EmissionKeeperWithMockOptions(t, keepertest.EmissionMockOptions{SkipSettingParams: true}) + params, found := k.GetParams(ctx) + require.False(t, found) + require.Empty(t, params) } diff --git a/x/emissions/migrations/v3/migrate.go b/x/emissions/migrations/v3/migrate.go new file mode 100644 index 0000000000..4ba1da387d --- /dev/null +++ b/x/emissions/migrations/v3/migrate.go @@ -0,0 +1,62 @@ +package v3 + +import ( + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/zeta-chain/zetacore/x/emissions/exported" + "github.com/zeta-chain/zetacore/x/emissions/types" +) + +type EmissionsKeeper interface { + GetParams(ctx sdk.Context) (types.Params, bool) + SetParams(ctx sdk.Context, params types.Params) error +} + +// Migrate migrates the x/emissions module state from the consensus version 2 to +// version 3. Specifically, it takes the parameters that are currently stored +// and managed by the x/params modules and stores them directly into the x/emissions +// module state. +func MigrateStore( + ctx sdk.Context, + emissionsKeeper EmissionsKeeper, + legacySubspace exported.Subspace, +) error { + var currParams types.Params + legacySubspace.GetParamSet(ctx, &currParams) + + defaultParams := types.NewParams() + + // ensure params are set with default values if not present in legacy params + if currParams.AvgBlockTime == "" { + currParams.AvgBlockTime = defaultParams.AvgBlockTime + } + if currParams.MaxBondFactor == "" { + currParams.MaxBondFactor = defaultParams.MaxBondFactor + } + if currParams.MinBondFactor == "" { + currParams.MinBondFactor = defaultParams.MinBondFactor + } + if currParams.TargetBondRatio == "" { + currParams.TargetBondRatio = defaultParams.TargetBondRatio + } + if currParams.ValidatorEmissionPercentage == "" { + currParams.ValidatorEmissionPercentage = defaultParams.ValidatorEmissionPercentage + } + if currParams.ObserverEmissionPercentage == "" { + currParams.ObserverEmissionPercentage = defaultParams.ObserverEmissionPercentage + } + if currParams.TssSignerEmissionPercentage == "" { + currParams.TssSignerEmissionPercentage = defaultParams.TssSignerEmissionPercentage + } + if currParams.DurationFactorConstant == "" { + currParams.DurationFactorConstant = defaultParams.DurationFactorConstant + } + + currParams.ObserverSlashAmount = types.ObserverSlashAmount + currParams.BallotMaturityBlocks = int64(types.BallotMaturityBlocks) + err := currParams.Validate() + if err != nil { + return err + } + + return emissionsKeeper.SetParams(ctx, currParams) +} diff --git a/x/emissions/migrations/v3/migrate_test.go b/x/emissions/migrations/v3/migrate_test.go new file mode 100644 index 0000000000..e074928997 --- /dev/null +++ b/x/emissions/migrations/v3/migrate_test.go @@ -0,0 +1,89 @@ +package v3_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/x/emissions/exported" + v3 "github.com/zeta-chain/zetacore/x/emissions/migrations/v3" + "github.com/zeta-chain/zetacore/x/emissions/types" +) + +type mockSubspace struct { + ps types.Params +} + +func newMockSubspace(ps types.Params) mockSubspace { + return mockSubspace{ps: ps} +} + +func (ms mockSubspace) GetParamSet(ctx sdk.Context, ps exported.ParamSet) { + *ps.(*types.Params) = ms.ps +} + +func TestMigrate(t *testing.T) { + t.Run("should migrate for valid params", func(t *testing.T) { + k, ctx, _, _ := keepertest.EmissionsKeeper(t) + + legacyParams := types.Params{ + MaxBondFactor: "1", + MinBondFactor: "0.75", + AvgBlockTime: "5.00", + TargetBondRatio: "00.50", + ValidatorEmissionPercentage: "00.50", + ObserverEmissionPercentage: "00.35", + TssSignerEmissionPercentage: "00.15", + DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdk.ZeroInt(), + } + legacySubspace := newMockSubspace(legacyParams) + + require.NoError(t, v3.MigrateStore(ctx, k, legacySubspace)) + + params, found := k.GetParams(ctx) + require.True(t, found) + legacyParams.ObserverSlashAmount = sdkmath.NewInt(100000000000000000) + legacyParams.BallotMaturityBlocks = 100 + require.Equal(t, legacyParams, params) + }) + + t.Run("should migrate if legacy params missing", func(t *testing.T) { + k, ctx, _, _ := keepertest.EmissionsKeeper(t) + + legacyParams := types.Params{} + legacySubspace := newMockSubspace(legacyParams) + + require.NoError(t, v3.MigrateStore(ctx, k, legacySubspace)) + + params, found := k.GetParams(ctx) + require.True(t, found) + legacyParams = types.DefaultParams() + legacyParams.ObserverSlashAmount = sdkmath.NewInt(100000000000000000) + legacyParams.BallotMaturityBlocks = 100 + require.Equal(t, legacyParams, params) + }) + + t.Run("should fail to migrate for invalid params", func(t *testing.T) { + k, ctx, _, _ := keepertest.EmissionsKeeper(t) + + legacyParams := types.Params{ + MaxBondFactor: "1", + MinBondFactor: "0.50", + AvgBlockTime: "5.00", + TargetBondRatio: "00.50", + ValidatorEmissionPercentage: "00.50", + ObserverEmissionPercentage: "00.35", + TssSignerEmissionPercentage: "00.15", + DurationFactorConstant: "0.001877876953694702", + ObserverSlashAmount: sdk.ZeroInt(), + } + legacySubspace := newMockSubspace(legacyParams) + + err := v3.MigrateStore(ctx, k, legacySubspace) + require.ErrorContains(t, err, "min bond factor cannot be lower that 0.75") + }) +} diff --git a/x/emissions/module.go b/x/emissions/module.go index 7086c998fc..172a79052f 100644 --- a/x/emissions/module.go +++ b/x/emissions/module.go @@ -9,7 +9,8 @@ import ( "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" "github.com/zeta-chain/zetacore/x/emissions/client/cli" - emissionskeeper "github.com/zeta-chain/zetacore/x/emissions/keeper" + "github.com/zeta-chain/zetacore/x/emissions/exported" + "github.com/zeta-chain/zetacore/x/emissions/keeper" "github.com/zeta-chain/zetacore/x/emissions/types" abci "github.com/tendermint/tendermint/abci/types" @@ -101,16 +102,20 @@ func (AppModuleBasic) GetQueryCmd() *cobra.Command { type AppModule struct { AppModuleBasic - keeper emissionskeeper.Keeper + keeper keeper.Keeper + // legacySubspace is used solely for migration of x/params managed parameters + legacySubspace exported.Subspace } func NewAppModule( cdc codec.Codec, - keeper emissionskeeper.Keeper, + keeper keeper.Keeper, + ss exported.Subspace, ) AppModule { return AppModule{ AppModuleBasic: NewAppModuleBasic(cdc), keeper: keeper, + legacySubspace: ss, } } @@ -135,8 +140,12 @@ func (am AppModule) LegacyQuerierHandler(_ *codec.LegacyAmino) sdk.Querier { // RegisterServices registers a GRPC query service to respond to the // module-specific GRPC queries. func (am AppModule) RegisterServices(cfg module.Configurator) { - types.RegisterMsgServer(cfg.MsgServer(), emissionskeeper.NewMsgServerImpl(am.keeper)) + types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + m := keeper.NewMigrator(am.keeper, am.legacySubspace) + if err := cfg.RegisterMigration(types.ModuleName, 2, m.Migrate2to3); err != nil { + panic(err) + } } // RegisterInvariants registers the emissions module's invariants. @@ -165,7 +174,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } +func (AppModule) ConsensusVersion() uint64 { return 3 } // BeginBlock executes all ABCI BeginBlock logic respective to the emissions module. func (am AppModule) BeginBlock(ctx sdk.Context, _ abci.RequestBeginBlock) { diff --git a/x/emissions/types/errors.go b/x/emissions/types/errors.go index e741408d81..1ba687f3cd 100644 --- a/x/emissions/types/errors.go +++ b/x/emissions/types/errors.go @@ -8,4 +8,5 @@ var ( ErrInvalidAddress = errorsmod.Register(ModuleName, 1003, "invalid address") ErrRewardsPoolDoesNotHaveEnoughBalance = errorsmod.Register(ModuleName, 1004, "rewards pool does not have enough balance") ErrInvalidAmount = errorsmod.Register(ModuleName, 1005, "invalid amount") + ErrUnableToSetParams = errorsmod.Register(ModuleName, 1006, "unable to set params") ) diff --git a/x/emissions/types/expected_keepers.go b/x/emissions/types/expected_keepers.go index 298a0caf42..fc9c6c022d 100644 --- a/x/emissions/types/expected_keepers.go +++ b/x/emissions/types/expected_keepers.go @@ -3,7 +3,6 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/x/auth/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -14,8 +13,8 @@ type AccountKeeper interface { } type ObserverKeeper interface { - GetMaturedBallotList(ctx sdk.Context) []string GetBallot(ctx sdk.Context, index string) (val observertypes.Ballot, found bool) + GetMaturedBallots(ctx sdk.Context, maturityBlocks int64) (val observertypes.BallotListForHeight, found bool) } // BankKeeper defines the expected interface needed to retrieve account balances. @@ -29,11 +28,3 @@ type BankKeeper interface { type StakingKeeper interface { BondedRatio(ctx sdk.Context) sdk.Dec } - -// ParamStore defines the expected paramstore methods to store and load Params (noalias) -type ParamStore interface { - GetParamSetIfExists(ctx sdk.Context, ps paramstypes.ParamSet) - SetParamSet(ctx sdk.Context, ps paramstypes.ParamSet) - WithKeyTable(table paramstypes.KeyTable) paramstypes.Subspace - HasKeyTable() bool -} diff --git a/x/emissions/types/genesis_test.go b/x/emissions/types/genesis_test.go index 6e0f27b4bc..8a3ecd6795 100644 --- a/x/emissions/types/genesis_test.go +++ b/x/emissions/types/genesis_test.go @@ -18,11 +18,6 @@ func TestGenesisState_Validate(t *testing.T) { genState: types.DefaultGenesis(), valid: true, }, - { - desc: "valid genesis state", - genState: &types.GenesisState{}, - valid: true, - }, } { t.Run(tc.desc, func(t *testing.T) { err := tc.genState.Validate() diff --git a/x/emissions/types/keys.go b/x/emissions/types/keys.go index 21b07cb854..bcf602b6c8 100644 --- a/x/emissions/types/keys.go +++ b/x/emissions/types/keys.go @@ -1,6 +1,7 @@ package types import ( + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" ) @@ -30,11 +31,7 @@ const ( EmissionScheduledYears = 4 AvgBlockTime = "5.7" - // ObserverSlashAmount is the amount of tokens to be slashed from observer in case of incorrect vote - // it is set to 0.1 ZETA - // TODO: replace this with a parameter - // https://github.com/zeta-chain/node/pull/1861 - ObserverSlashAmount = "100000000000000000" + ParamsKey = "Params-value-" ) func KeyPrefix(p string) []byte { @@ -59,4 +56,11 @@ var ( UndistributedObserverRewardsPoolAddress = authtypes.NewModuleAddress(UndistributedObserverRewardsPool) UndistributedTssRewardsPoolAddress = authtypes.NewModuleAddress(UndistributedTssRewardsPool) BlockReward = sdk.MustNewDecFromStr("9620949074074074074.074070733466756687") + // ObserverSlashAmount is the amount of tokens to be slashed from observer in case of incorrect vote + // by default it is set to 0.1 ZETA + ObserverSlashAmount = sdkmath.NewInt(100000000000000000) + + // BallotMaturityBlocks is amount of blocks needed for ballot to mature + // by default is set to 100 + BallotMaturityBlocks = 100 ) diff --git a/x/emissions/types/message_update_params.go b/x/emissions/types/message_update_params.go new file mode 100644 index 0000000000..510c460831 --- /dev/null +++ b/x/emissions/types/message_update_params.go @@ -0,0 +1,40 @@ +package types + +import ( + cosmoserrors "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const MsgUpdateParamsType = "update_params" + +var _ sdk.Msg = &MsgUpdateParams{} + +func (m *MsgUpdateParams) Route() string { + return RouterKey +} + +func (m *MsgUpdateParams) Type() string { + return MsgUpdateParamsType +} + +func (m *MsgUpdateParams) GetSignBytes() []byte { + return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(m)) +} + +func (m *MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, err := sdk.AccAddressFromBech32(m.Authority) + if err != nil { + panic(err) + } + return []sdk.AccAddress{addr} +} + +func (m *MsgUpdateParams) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(m.Authority) + if err != nil { + return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid authority address (%s)", err) + } + + return m.Params.Validate() +} diff --git a/x/emissions/types/message_update_params_test.go b/x/emissions/types/message_update_params_test.go new file mode 100644 index 0000000000..de17065dea --- /dev/null +++ b/x/emissions/types/message_update_params_test.go @@ -0,0 +1,81 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/emissions/types" +) + +func TestMsgUpdateParams_ValidateBasic(t *testing.T) { + t.Run("invalid authority address", func(t *testing.T) { + msg := types.MsgUpdateParams{ + Authority: "invalid", + Params: types.NewParams(), + } + err := msg.ValidateBasic() + require.ErrorIs(t, err, sdkerrors.ErrInvalidAddress) + }) + + t.Run("valid", func(t *testing.T) { + msg := types.MsgUpdateParams{ + Authority: sample.AccAddress(), + Params: types.NewParams(), + } + err := msg.ValidateBasic() + require.NoError(t, err) + }) +} + +func TestMsgUpdateParamsGetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *types.MsgUpdateParams + panics bool + }{ + { + name: "valid signer", + msg: &types.MsgUpdateParams{signer, types.NewParams()}, + panics: false, + }, + { + name: "invalid signer", + msg: &types.MsgUpdateParams{"invalid", types.NewParams()}, + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgUpdateParamsType(t *testing.T) { + msg := types.MsgUpdateParams{"invalid", types.NewParams()} + require.Equal(t, types.MsgUpdateParamsType, msg.Type()) +} + +func TestMsgUpdateParamsRoute(t *testing.T) { + msg := types.MsgUpdateParams{"invalid", types.NewParams()} + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgUpdateParamsGetSignBytes(t *testing.T) { + msg := types.MsgUpdateParams{"invalid", types.NewParams()} + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/emissions/types/params.go b/x/emissions/types/params.go index 2a8b4e4387..1e2fb1752a 100644 --- a/x/emissions/types/params.go +++ b/x/emissions/types/params.go @@ -4,20 +4,12 @@ import ( "fmt" "strconv" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "gopkg.in/yaml.v2" ) -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for launch module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - // NewParams creates a new Params instance - func NewParams() Params { return Params{ MaxBondFactor: "1.25", @@ -28,11 +20,8 @@ func NewParams() Params { ObserverEmissionPercentage: "00.25", TssSignerEmissionPercentage: "00.25", DurationFactorConstant: "0.001877876953694702", - - // ObserverSlashAmount is currently disabled - // TODO: enable this param - // https://github.com/zeta-chain/node/issues/1862 - ObserverSlashAmount: sdk.Int{}, + ObserverSlashAmount: sdkmath.NewInt(100000000000000000), + BallotMaturityBlocks: 100, } } @@ -41,27 +30,80 @@ func DefaultParams() Params { return NewParams() } -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyPrefix(ParamMaxBondFactor), &p.MaxBondFactor, validateMaxBondFactor), - paramtypes.NewParamSetPair(KeyPrefix(ParamMinBondFactor), &p.MinBondFactor, validateMinBondFactor), - paramtypes.NewParamSetPair(KeyPrefix(ParamAvgBlockTime), &p.AvgBlockTime, validateAvgBlockTime), - paramtypes.NewParamSetPair(KeyPrefix(ParamTargetBondRatio), &p.TargetBondRatio, validateTargetBondRatio), - paramtypes.NewParamSetPair(KeyPrefix(ParamValidatorEmissionPercentage), &p.ValidatorEmissionPercentage, validateValidatorEmissionPercentage), - paramtypes.NewParamSetPair(KeyPrefix(ParamObserverEmissionPercentage), &p.ObserverEmissionPercentage, validateObserverEmissionPercentage), - paramtypes.NewParamSetPair(KeyPrefix(ParamTssSignerEmissionPercentage), &p.TssSignerEmissionPercentage, validateTssEmissionPercentage), - paramtypes.NewParamSetPair(KeyPrefix(ParamDurationFactorConstant), &p.DurationFactorConstant, validateDurationFactorConstant), +// Validate validates the set of params +func (p Params) Validate() error { + err := validateMaxBondFactor(p.MaxBondFactor) + if err != nil { + return err + } + err = validateMinBondFactor(p.MinBondFactor) + if err != nil { + return err + } + err = validateAvgBlockTime(p.AvgBlockTime) + if err != nil { + return err + } + err = validateTargetBondRatio(p.TargetBondRatio) + if err != nil { + return err + } + err = validateValidatorEmissionPercentage(p.ValidatorEmissionPercentage) + if err != nil { + return err + } + err = validateObserverEmissionPercentage(p.ObserverEmissionPercentage) + if err != nil { + return err + } + err = validateTssEmissionPercentage(p.TssSignerEmissionPercentage) + if err != nil { + return err + } + err = validateBallotMaturityBlocks(p.BallotMaturityBlocks) + if err != nil { + return err + } + return validateObserverSlashAmount(p.ObserverSlashAmount) +} + +func (p Params) GetBondFactor(currentBondedRatio sdk.Dec) sdk.Dec { + targetBondRatio := sdk.MustNewDecFromStr(p.TargetBondRatio) + maxBondFactor := sdk.MustNewDecFromStr(p.MaxBondFactor) + minBondFactor := sdk.MustNewDecFromStr(p.MinBondFactor) - // TODO: enable this param - // https://github.com/zeta-chain/node/pull/1861 - //paramtypes.NewParamSetPair(KeyPrefix(ParamObserverSlashAmount), &p.ObserverSlashAmount, validateObserverSlashAmount), + // Bond factor ranges between minBondFactor (0.75) to maxBondFactor (1.25) + if currentBondedRatio.IsZero() { + return sdk.ZeroDec() } + bondFactor := targetBondRatio.Quo(currentBondedRatio) + if bondFactor.GT(maxBondFactor) { + return maxBondFactor + } + if bondFactor.LT(minBondFactor) { + return minBondFactor + } + return bondFactor } -// Validate validates the set of params -func (p Params) Validate() error { - return nil +func (p Params) GetDurationFactor(blockHeight int64) sdk.Dec { + avgBlockTime := sdk.MustNewDecFromStr(p.AvgBlockTime) + NumberOfBlocksInAMonth := sdk.NewDec(SecsInMonth).Quo(avgBlockTime) + monthFactor := sdk.NewDec(blockHeight).Quo(NumberOfBlocksInAMonth) + logValueDec := sdk.MustNewDecFromStr(p.DurationFactorConstant) + // month * log(1 + 0.02 / 12) + fractionNumerator := monthFactor.Mul(logValueDec) + // (month * log(1 + 0.02 / 12) ) + 1 + fractionDenominator := fractionNumerator.Add(sdk.OneDec()) + + // (month * log(1 + 0.02 / 12)) / (month * log(1 + 0.02 / 12) ) + 1 + if fractionDenominator.IsZero() { + return sdk.OneDec() + } + if fractionNumerator.IsZero() { + return sdk.ZeroDec() + } + return fractionNumerator.Quo(fractionDenominator) } // String implements the Stringer interface. @@ -88,7 +130,7 @@ func validateMaxBondFactor(i interface{}) error { } decMaxBond := sdk.MustNewDecFromStr(v) if decMaxBond.GT(sdk.MustNewDecFromStr("1.25")) { - return fmt.Errorf("max bond factor cannot be higher that 0.25") + return fmt.Errorf("max bond factor cannot be higher that 1.25") } return nil } @@ -179,3 +221,27 @@ func validateTssEmissionPercentage(i interface{}) error { } return nil } + +func validateObserverSlashAmount(i interface{}) error { + v, ok := i.(sdkmath.Int) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + if v.LT(sdk.ZeroInt()) { + return fmt.Errorf("slash amount cannot be less than 0") + } + return nil +} + +func validateBallotMaturityBlocks(i interface{}) error { + v, ok := i.(int64) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v < 0 { + return fmt.Errorf("ballot maturity types must be gte 0") + } + + return nil +} diff --git a/x/emissions/types/params.pb.go b/x/emissions/types/params.pb.go index a4c6e31563..298dc79799 100644 --- a/x/emissions/types/params.pb.go +++ b/x/emissions/types/params.pb.go @@ -36,6 +36,7 @@ type Params struct { TssSignerEmissionPercentage string `protobuf:"bytes,7,opt,name=tss_signer_emission_percentage,json=tssSignerEmissionPercentage,proto3" json:"tss_signer_emission_percentage,omitempty"` DurationFactorConstant string `protobuf:"bytes,8,opt,name=duration_factor_constant,json=durationFactorConstant,proto3" json:"duration_factor_constant,omitempty"` ObserverSlashAmount github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,9,opt,name=observer_slash_amount,json=observerSlashAmount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"observer_slash_amount"` + BallotMaturityBlocks int64 `protobuf:"varint,10,opt,name=ballot_maturity_blocks,json=ballotMaturityBlocks,proto3" json:"ballot_maturity_blocks,omitempty"` } func (m *Params) Reset() { *m = Params{} } @@ -126,6 +127,13 @@ func (m *Params) GetDurationFactorConstant() string { return "" } +func (m *Params) GetBallotMaturityBlocks() int64 { + if m != nil { + return m.BallotMaturityBlocks + } + return 0 +} + func init() { proto.RegisterType((*Params)(nil), "zetachain.zetacore.emissions.Params") } @@ -133,34 +141,36 @@ func init() { func init() { proto.RegisterFile("emissions/params.proto", fileDescriptor_74b1fd2414ebb64a) } var fileDescriptor_74b1fd2414ebb64a = []byte{ - // 429 bytes of a gzipped FileDescriptorProto + // 461 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x74, 0x92, 0x41, 0x6b, 0xd4, 0x40, - 0x14, 0xc7, 0x37, 0xba, 0xae, 0x76, 0x50, 0x8b, 0x51, 0x4b, 0xa8, 0x35, 0x2b, 0x22, 0x45, 0x84, - 0x26, 0x82, 0x17, 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, 0x4d, 0x24, + 0xc6, 0xef, 0x0c, 0x8d, 0xee, 0x75, 0xb2, 0x93, 0xda, 0xf5, 0xda, 0xa9, 0x82, 0xe7, 0x6c, 0x90, + 0x89, 0xaa, 0x02, 0xe2, 0x5a, 0xd0, 0xd4, 0x2a, 0x3a, 0x6b, 0xbe, 0x11, 0x43, 0xb6, 0xe7, 0x1f, + 0x6c, 0x8c, 0xb6, 0x9b, 0xec, 0x87, 0x36, 0xe9, 0x7e, 0x13, 0x5f, 0xf6, 0xbe, 0x7d, 0x1f, 0x7a, + 0xe9, 0xfb, 0xf3, 0x45, 0xe4, 0x5f, 0x2c, 0x22, 0xff, 0xf7, 0x22, 0xf2, 0xbf, 0x2e, 0x23, 0xef, + 0x62, 0x19, 0x79, 0x3f, 0x97, 0x91, 0xf7, 0xe9, 0xe9, 0x95, 0x96, 0xea, 0x05, 0x3d, 0x74, 0xbb, + 0x9a, 0x74, 0xbb, 0x9a, 0xcc, 0x93, 0xbf, 0x8b, 0xed, 0x1a, 0xcc, 0xfa, 0x6e, 0x49, 0x9f, 0xfd, + 0x09, 0x00, 0x00, 0xff, 0xff, 0xd6, 0xb4, 0x4a, 0x45, 0xf2, 0x02, 0x00, 0x00, } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -183,6 +193,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.BallotMaturityBlocks != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.BallotMaturityBlocks)) + i-- + dAtA[i] = 0x50 + } { size := m.ObserverSlashAmount.Size() i -= size @@ -303,6 +318,9 @@ func (m *Params) Size() (n int) { } l = m.ObserverSlashAmount.Size() n += 1 + l + sovParams(uint64(l)) + if m.BallotMaturityBlocks != 0 { + n += 1 + sovParams(uint64(m.BallotMaturityBlocks)) + } return n } @@ -631,6 +649,25 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BallotMaturityBlocks", wireType) + } + m.BallotMaturityBlocks = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BallotMaturityBlocks |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/x/emissions/types/params_legacy.go b/x/emissions/types/params_legacy.go new file mode 100644 index 0000000000..e05ebb6ae9 --- /dev/null +++ b/x/emissions/types/params_legacy.go @@ -0,0 +1,28 @@ +package types + +import paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + +var _ paramtypes.ParamSet = (*Params)(nil) + +// ParamKeyTable the param key table for launch module +func ParamKeyTable() paramtypes.KeyTable { + return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) +} + +// ParamSetPairs get the params.ParamSet +func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { + return paramtypes.ParamSetPairs{ + paramtypes.NewParamSetPair(KeyPrefix(ParamMaxBondFactor), &p.MaxBondFactor, validateMaxBondFactor), + paramtypes.NewParamSetPair(KeyPrefix(ParamMinBondFactor), &p.MinBondFactor, validateMinBondFactor), + paramtypes.NewParamSetPair(KeyPrefix(ParamAvgBlockTime), &p.AvgBlockTime, validateAvgBlockTime), + paramtypes.NewParamSetPair(KeyPrefix(ParamTargetBondRatio), &p.TargetBondRatio, validateTargetBondRatio), + paramtypes.NewParamSetPair(KeyPrefix(ParamValidatorEmissionPercentage), &p.ValidatorEmissionPercentage, validateValidatorEmissionPercentage), + paramtypes.NewParamSetPair(KeyPrefix(ParamObserverEmissionPercentage), &p.ObserverEmissionPercentage, validateObserverEmissionPercentage), + paramtypes.NewParamSetPair(KeyPrefix(ParamTssSignerEmissionPercentage), &p.TssSignerEmissionPercentage, validateTssEmissionPercentage), + paramtypes.NewParamSetPair(KeyPrefix(ParamDurationFactorConstant), &p.DurationFactorConstant, validateDurationFactorConstant), + + // TODO: enable this param + // https://github.com/zeta-chain/node/pull/1861 + //paramtypes.NewParamSetPair(KeyPrefix(ParamObserverSlashAmount), &p.ObserverSlashAmount, validateObserverSlashAmount), + } +} diff --git a/x/emissions/types/params_test.go b/x/emissions/types/params_test.go index 8dcf6053a0..6c1afcc575 100644 --- a/x/emissions/types/params_test.go +++ b/x/emissions/types/params_test.go @@ -1,11 +1,10 @@ package types import ( - "reflect" "testing" + sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/stretchr/testify/require" "gopkg.in/yaml.v2" ) @@ -23,18 +22,7 @@ func TestNewParams(t *testing.T) { require.Equal(t, "00.25", params.TssSignerEmissionPercentage, "TssSignerEmissionPercentage should be set to 00.25") require.Equal(t, "0.001877876953694702", params.DurationFactorConstant, "DurationFactorConstant should be set to 0.001877876953694702") - require.Equal(t, sdk.Int{}, params.ObserverSlashAmount, "ObserverSlashAmount should be initialized but is currently disabled") -} - -func TestParamKeyTable(t *testing.T) { - kt := ParamKeyTable() - - ps := Params{} - for _, psp := range ps.ParamSetPairs() { - require.PanicsWithValue(t, "duplicate parameter key", func() { - kt.RegisterType(psp) - }) - } + require.Equal(t, sdkmath.NewInt(100000000000000000), params.ObserverSlashAmount, "ObserverSlashAmount should be set to 100000000000000000") } func TestDefaultParams(t *testing.T) { @@ -44,38 +32,6 @@ func TestDefaultParams(t *testing.T) { require.Equal(t, NewParams(), params) } -func TestParamSetPairs(t *testing.T) { - params := DefaultParams() - pairs := params.ParamSetPairs() - - require.Equal(t, 8, len(pairs), "The number of param set pairs should match the expected count") - - assertParamSetPair(t, pairs, KeyPrefix(ParamMaxBondFactor), "1.25", validateMaxBondFactor) - assertParamSetPair(t, pairs, KeyPrefix(ParamMinBondFactor), "0.75", validateMinBondFactor) - assertParamSetPair(t, pairs, KeyPrefix(ParamAvgBlockTime), "6.00", validateAvgBlockTime) - assertParamSetPair(t, pairs, KeyPrefix(ParamTargetBondRatio), "00.67", validateTargetBondRatio) - assertParamSetPair(t, pairs, KeyPrefix(ParamValidatorEmissionPercentage), "00.50", validateValidatorEmissionPercentage) - assertParamSetPair(t, pairs, KeyPrefix(ParamObserverEmissionPercentage), "00.25", validateObserverEmissionPercentage) - assertParamSetPair(t, pairs, KeyPrefix(ParamTssSignerEmissionPercentage), "00.25", validateTssEmissionPercentage) - assertParamSetPair(t, pairs, KeyPrefix(ParamDurationFactorConstant), "0.001877876953694702", validateDurationFactorConstant) -} - -func assertParamSetPair(t *testing.T, pairs paramtypes.ParamSetPairs, key []byte, expectedValue string, valFunc paramtypes.ValueValidatorFn) { - for _, pair := range pairs { - if string(pair.Key) == string(key) { - actualValue, ok := pair.Value.(*string) - require.True(t, ok, "Expected value to be of type *string for key %s", string(key)) - require.Equal(t, expectedValue, *actualValue, "Value does not match for key %s", string(key)) - - actualValFunc := pair.ValidatorFn - require.Equal(t, reflect.ValueOf(valFunc).Pointer(), reflect.ValueOf(actualValFunc).Pointer(), "Val func doesnt match for key %s", string(key)) - return - } - } - - t.Errorf("Key %s not found in ParamSetPairs", string(key)) -} - func TestValidateDurationFactorConstant(t *testing.T) { require.NoError(t, validateDurationFactorConstant("1")) require.Error(t, validateDurationFactorConstant(1)) @@ -130,9 +86,138 @@ func TestValidateTssEmissionPercentage(t *testing.T) { require.Error(t, validateTssEmissionPercentage("1.01")) // More than 100 percent should fail } +func TestValidateObserverSlashAmount(t *testing.T) { + require.Error(t, validateObserverSlashAmount(10)) + require.Error(t, validateObserverSlashAmount("10")) + require.Error(t, validateObserverSlashAmount(sdkmath.NewInt(-10))) // Less than 0 + require.NoError(t, validateObserverSlashAmount(sdkmath.NewInt(10))) +} + +func TestValidateBallotMaturityBlocks(t *testing.T) { + require.Error(t, validateBallotMaturityBlocks("10")) + require.Error(t, validateBallotMaturityBlocks(-100)) + require.NoError(t, validateBallotMaturityBlocks(int64(100))) +} + +func TestValidate(t *testing.T) { + t.Run("should validate", func(t *testing.T) { + params := NewParams() + require.NoError(t, params.Validate()) + }) + + t.Run("should error for invalid max bond factor", func(t *testing.T) { + params := NewParams() + params.MaxBondFactor = "1.30" + require.Error(t, params.Validate()) + }) + + t.Run("should error for invalid min bond factor", func(t *testing.T) { + params := NewParams() + params.MinBondFactor = "0.50" + require.Error(t, params.Validate()) + }) + + t.Run("should error for invalid avg block time", func(t *testing.T) { + params := NewParams() + params.AvgBlockTime = "-1.30" + require.Error(t, params.Validate()) + }) + + t.Run("should error for invalid target bond ratio", func(t *testing.T) { + params := NewParams() + params.TargetBondRatio = "-1.30" + require.Error(t, params.Validate()) + }) + + t.Run("should error for invalid validator emissions percentage", func(t *testing.T) { + params := NewParams() + params.ValidatorEmissionPercentage = "-1.30" + require.Error(t, params.Validate()) + }) + + t.Run("should error for invalid observer emissions percentage", func(t *testing.T) { + params := NewParams() + params.ObserverEmissionPercentage = "-1.30" + require.Error(t, params.Validate()) + }) + + t.Run("should error for invalid tss emissions percentage", func(t *testing.T) { + params := NewParams() + params.TssSignerEmissionPercentage = "-1.30" + require.Error(t, params.Validate()) + }) + + t.Run("should error for invalid observer slash amount", func(t *testing.T) { + params := NewParams() + params.ObserverSlashAmount = sdkmath.NewInt(-10) + require.Error(t, params.Validate()) + }) + + t.Run("should error for invalid ballot maturity blocks", func(t *testing.T) { + params := NewParams() + params.BallotMaturityBlocks = -100 + require.Error(t, params.Validate()) + }) +} + func TestParamsString(t *testing.T) { params := DefaultParams() out, err := yaml.Marshal(params) require.NoError(t, err) require.Equal(t, string(out), params.String()) } + +func TestParams_GetDurationFactor(t *testing.T) { + t.Run("should return duration factor 0 if duration factor constant is 0", func(t *testing.T) { + params := DefaultParams() + params.DurationFactorConstant = "0" + + duractionFactor := params.GetDurationFactor(1) + require.Equal(t, sdk.ZeroDec(), duractionFactor) + }) + + t.Run("should return duration factor for default params", func(t *testing.T) { + params := DefaultParams() + duractionFactor := params.GetDurationFactor(1) + // hardcoding actual expected value for default params, it will change if logic changes + require.Equal(t, sdk.MustNewDecFromStr("0.000000004346937374"), duractionFactor) + }) +} + +func TestParams_GetBondFactor(t *testing.T) { + t.Run("should return 0 if current bond ratio is 0", func(t *testing.T) { + params := DefaultParams() + bondFactor := params.GetBondFactor(sdk.ZeroDec()) + require.Equal(t, sdk.ZeroDec(), bondFactor) + }) + + t.Run("should return max bond factor if bond factor exceeds max bond factor", func(t *testing.T) { + params := DefaultParams() + params.TargetBondRatio = "0.5" + params.MaxBondFactor = "1.1" + params.MinBondFactor = "0.9" + + bondFactor := params.GetBondFactor(sdk.MustNewDecFromStr("0.25")) + require.Equal(t, sdk.MustNewDecFromStr(params.MaxBondFactor), bondFactor) + }) + + t.Run("should return min bond factor if bond factor below min bond factor", func(t *testing.T) { + params := DefaultParams() + params.TargetBondRatio = "0.5" + params.MaxBondFactor = "1.1" + params.MinBondFactor = "0.9" + + bondFactor := params.GetBondFactor(sdk.MustNewDecFromStr("0.75")) + require.Equal(t, sdk.MustNewDecFromStr(params.MinBondFactor), bondFactor) + }) + + t.Run("should return calculated bond factor if bond factor in range", func(t *testing.T) { + params := DefaultParams() + params.TargetBondRatio = "0.5" + params.MaxBondFactor = "1.1" + params.MinBondFactor = "0.9" + + bondFactor := params.GetBondFactor(sdk.MustNewDecFromStr("0.5")) + require.Equal(t, sdk.OneDec(), bondFactor) + }) +} diff --git a/x/emissions/types/tx.pb.go b/x/emissions/types/tx.pb.go index 7b59eb8cc2..b4a21c4664 100644 --- a/x/emissions/types/tx.pb.go +++ b/x/emissions/types/tx.pb.go @@ -111,32 +111,128 @@ func (m *MsgWithdrawEmissionResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgWithdrawEmissionResponse proto.InternalMessageInfo +type MsgUpdateParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Params Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params"` +} + +func (m *MsgUpdateParams) Reset() { *m = MsgUpdateParams{} } +func (m *MsgUpdateParams) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParams) ProtoMessage() {} +func (*MsgUpdateParams) Descriptor() ([]byte, []int) { + return fileDescriptor_618f91fd090d1520, []int{2} +} +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) +} +func (m *MsgUpdateParams) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParams proto.InternalMessageInfo + +func (m *MsgUpdateParams) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgUpdateParams) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +type MsgUpdateParamsResponse struct { +} + +func (m *MsgUpdateParamsResponse) Reset() { *m = MsgUpdateParamsResponse{} } +func (m *MsgUpdateParamsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateParamsResponse) ProtoMessage() {} +func (*MsgUpdateParamsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_618f91fd090d1520, []int{3} +} +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) +} +func (m *MsgUpdateParamsResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgWithdrawEmission)(nil), "zetachain.zetacore.emissions.MsgWithdrawEmission") proto.RegisterType((*MsgWithdrawEmissionResponse)(nil), "zetachain.zetacore.emissions.MsgWithdrawEmissionResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "zetachain.zetacore.emissions.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "zetachain.zetacore.emissions.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("emissions/tx.proto", fileDescriptor_618f91fd090d1520) } var fileDescriptor_618f91fd090d1520 = []byte{ - // 272 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4a, 0xcd, 0xcd, 0x2c, - 0x2e, 0xce, 0xcc, 0xcf, 0x2b, 0xd6, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, - 0xa9, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, - 0xe0, 0xca, 0xa4, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, 0x0a, 0xf5, 0x41, 0x2c, 0x88, 0x1e, 0xa5, - 0x72, 0x2e, 0x61, 0xdf, 0xe2, 0xf4, 0xf0, 0xcc, 0x92, 0x8c, 0x94, 0xa2, 0xc4, 0x72, 0x57, 0xa8, - 0x6a, 0x21, 0x09, 0x2e, 0xf6, 0xe4, 0xa2, 0xd4, 0xc4, 0x92, 0xfc, 0x22, 0x09, 0x46, 0x05, 0x46, - 0x0d, 0xce, 0x20, 0x18, 0x57, 0xc8, 0x8d, 0x8b, 0x2d, 0x31, 0x37, 0xbf, 0x34, 0xaf, 0x44, 0x82, - 0x09, 0x24, 0xe1, 0xa4, 0x77, 0xe2, 0x9e, 0x3c, 0xc3, 0xad, 0x7b, 0xf2, 0x6a, 0xe9, 0x99, 0x25, - 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0x50, 0x4a, - 0xb7, 0x38, 0x25, 0x5b, 0xbf, 0xa4, 0xb2, 0x20, 0xb5, 0x58, 0xcf, 0x33, 0xaf, 0x24, 0x08, 0xaa, - 0x5b, 0x49, 0x96, 0x4b, 0x1a, 0x8b, 0xc5, 0x41, 0xa9, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, 0x46, - 0x1d, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x0d, 0x8c, 0x5c, 0x02, 0x18, 0xae, 0x33, 0xd4, - 0xc3, 0xe7, 0x53, 0x3d, 0x2c, 0xe6, 0x4a, 0x59, 0x92, 0xac, 0x05, 0xe6, 0x14, 0x27, 0xaf, 0x13, - 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, - 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x40, 0xf2, 0x33, 0xc8, 0x50, 0x5d, - 0xb0, 0xf9, 0xfa, 0x30, 0xf3, 0xf5, 0x2b, 0xf4, 0x91, 0x62, 0x09, 0x14, 0x02, 0x49, 0x6c, 0xe0, - 0x50, 0x37, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0x84, 0x03, 0xec, 0xd0, 0xbf, 0x01, 0x00, 0x00, + // 365 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x52, 0x4f, 0x4b, 0xeb, 0x40, + 0x10, 0x4f, 0xde, 0x7b, 0xf4, 0xd1, 0x55, 0x50, 0x56, 0xd1, 0x1a, 0x6b, 0x2a, 0x41, 0xc4, 0x4b, + 0x77, 0xb5, 0xe2, 0xc1, 0x6b, 0x40, 0x41, 0xa1, 0x20, 0x01, 0x11, 0xbc, 0x6d, 0xd3, 0x25, 0x09, + 0x92, 0x6c, 0xd8, 0xd9, 0xd2, 0xd6, 0x93, 0x1f, 0xc1, 0x8f, 0xd5, 0x63, 0x8f, 0xe2, 0xa1, 0x48, + 0xfb, 0x3d, 0x44, 0xf2, 0xcf, 0xd6, 0x2a, 0x95, 0x9e, 0x76, 0x76, 0x76, 0x7e, 0x7f, 0x66, 0x67, + 0x10, 0xe6, 0x61, 0x00, 0x10, 0x88, 0x08, 0xa8, 0xea, 0x91, 0x58, 0x0a, 0x25, 0x70, 0xf5, 0x91, + 0x2b, 0xe6, 0xfa, 0x2c, 0x88, 0x48, 0x1a, 0x09, 0xc9, 0xc9, 0x67, 0x99, 0xb1, 0x35, 0x45, 0xc4, + 0x4c, 0xb2, 0x10, 0x32, 0x94, 0xb1, 0xe9, 0x09, 0x4f, 0xa4, 0x21, 0x4d, 0xa2, 0x2c, 0x6b, 0x75, + 0xd1, 0x46, 0x13, 0xbc, 0xbb, 0x40, 0xf9, 0x6d, 0xc9, 0xba, 0x17, 0x39, 0x14, 0x57, 0xd0, 0x7f, + 0x57, 0x72, 0xa6, 0x84, 0xac, 0xe8, 0xfb, 0xfa, 0x51, 0xd9, 0x29, 0xae, 0xf8, 0x12, 0x95, 0x58, + 0x28, 0x3a, 0x91, 0xaa, 0xfc, 0x49, 0x1e, 0x6c, 0x32, 0x18, 0xd5, 0xb4, 0xd7, 0x51, 0xed, 0xd0, + 0x0b, 0x94, 0xdf, 0x69, 0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02, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -151,6 +247,7 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) WithdrawEmission(ctx context.Context, in *MsgWithdrawEmission, opts ...grpc.CallOption) (*MsgWithdrawEmissionResponse, error) } @@ -162,6 +259,15 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.emissions.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + func (c *msgClient) WithdrawEmission(ctx context.Context, in *MsgWithdrawEmission, opts ...grpc.CallOption) (*MsgWithdrawEmissionResponse, error) { out := new(MsgWithdrawEmissionResponse) err := c.cc.Invoke(ctx, "/zetachain.zetacore.emissions.Msg/WithdrawEmission", in, out, opts...) @@ -173,6 +279,7 @@ func (c *msgClient) WithdrawEmission(ctx context.Context, in *MsgWithdrawEmissio // MsgServer is the server API for Msg service. type MsgServer interface { + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) WithdrawEmission(context.Context, *MsgWithdrawEmission) (*MsgWithdrawEmissionResponse, error) } @@ -180,6 +287,9 @@ type MsgServer interface { type UnimplementedMsgServer struct { } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func (*UnimplementedMsgServer) WithdrawEmission(ctx context.Context, req *MsgWithdrawEmission) (*MsgWithdrawEmissionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method WithdrawEmission not implemented") } @@ -188,6 +298,24 @@ func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } +func _Msg_UpdateParams_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateParams) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateParams(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.emissions.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + func _Msg_WithdrawEmission_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(MsgWithdrawEmission) if err := dec(in); err != nil { @@ -210,6 +338,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.emissions.Msg", HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, { MethodName: "WithdrawEmission", Handler: _Msg_WithdrawEmission_Handler, @@ -282,6 +414,69 @@ func (m *MsgWithdrawEmissionResponse) MarshalToSizedBuffer(dAtA []byte) (int, er return len(dAtA) - i, nil } +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Authority) > 0 { + i -= len(m.Authority) + copy(dAtA[i:], m.Authority) + i = encodeVarintTx(dAtA, i, uint64(len(m.Authority))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -317,6 +512,30 @@ func (m *MsgWithdrawEmissionResponse) Size() (n int) { return n } +func (m *MsgUpdateParams) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Authority) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.Params.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateParamsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -489,6 +708,171 @@ func (m *MsgWithdrawEmissionResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Authority = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/observer/client/cli/query.go b/x/observer/client/cli/query.go index b896dd9a71..61e82af1fa 100644 --- a/x/observer/client/cli/query.go +++ b/x/observer/client/cli/query.go @@ -25,7 +25,6 @@ func GetQueryCmd(_ string) *cobra.Command { } cmd.AddCommand( - CmdQueryParams(), CmdBallotByIdentifier(), CmdObserverSet(), CmdGetSupportedChains(), diff --git a/x/observer/client/cli/query_params.go b/x/observer/client/cli/query_params.go deleted file mode 100644 index cb2af7efdf..0000000000 --- a/x/observer/client/cli/query_params.go +++ /dev/null @@ -1,34 +0,0 @@ -package cli - -import ( - "context" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/spf13/cobra" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func CmdQueryParams() *cobra.Command { - cmd := &cobra.Command{ - Use: "params", - Short: "shows the parameters of the module", - Args: cobra.NoArgs, - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx := client.GetClientContextFromCmd(cmd) - - queryClient := types.NewQueryClient(clientCtx) - - res, err := queryClient.Params(context.Background(), &types.QueryParamsRequest{}) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - - return cmd -} diff --git a/x/observer/genesis.go b/x/observer/genesis.go index b6d85757ff..0a40d9a147 100644 --- a/x/observer/genesis.go +++ b/x/observer/genesis.go @@ -43,14 +43,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) } } - params := types.DefaultParams() - if genState.Params != nil { - params = *genState.Params - } - k.SetParams(ctx, params) - // Set if defined - crosschainFlags := types.DefaultCrosschainFlags() if genState.CrosschainFlags != nil { crosschainFlags.IsOutboundEnabled = genState.CrosschainFlags.IsOutboundEnabled @@ -141,8 +134,6 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) // ExportGenesis returns the observer module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { - params := k.GetParamsIfExists(ctx) - chainParams, found := k.GetChainParamsList(ctx) if !found { chainParams = types.ChainParamsList{} @@ -198,7 +189,6 @@ func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { Ballots: k.GetAllBallots(ctx), ChainParamsList: chainParams, Observers: os, - Params: ¶ms, NodeAccountList: nodeAccounts, CrosschainFlags: cf, Keygen: kn, diff --git a/x/observer/genesis_test.go b/x/observer/genesis_test.go index 62e442e9ba..086a5cddc4 100644 --- a/x/observer/genesis_test.go +++ b/x/observer/genesis_test.go @@ -13,10 +13,8 @@ import ( func TestGenesis(t *testing.T) { t.Run("genState fields defined", func(t *testing.T) { - params := types.DefaultParams() tss := sample.Tss() genesisState := types.GenesisState{ - Params: ¶ms, Tss: &tss, BlameList: sample.BlameRecordsList(t, 10), Ballots: []*types.Ballot{ @@ -65,7 +63,6 @@ func TestGenesis(t *testing.T) { got := observer.ExportGenesis(ctx, *k) require.NotNil(t, got) - defaultParams := types.DefaultParams() btcChainParams := types.GetDefaultBtcRegtestChainParams() btcChainParams.IsSupported = true goerliChainParams := types.GetDefaultGoerliLocalnetChainParams() @@ -80,7 +77,6 @@ func TestGenesis(t *testing.T) { }, } expectedGenesisState := types.GenesisState{ - Params: &defaultParams, CrosschainFlags: types.DefaultCrosschainFlags(), ChainParamsList: localnetChainParams, Tss: &types.TSS{}, @@ -103,7 +99,6 @@ func TestGenesis(t *testing.T) { got := observer.ExportGenesis(ctx, *k) require.NotNil(t, got) - defaultParams := types.DefaultParams() btcChainParams := types.GetDefaultBtcRegtestChainParams() btcChainParams.IsSupported = true goerliChainParams := types.GetDefaultGoerliLocalnetChainParams() @@ -121,7 +116,6 @@ func TestGenesis(t *testing.T) { require.NoError(t, err) require.NotEmpty(t, pendingNonces) expectedGenesisState := types.GenesisState{ - Params: &defaultParams, CrosschainFlags: types.DefaultCrosschainFlags(), ChainParamsList: localnetChainParams, Tss: &tss, @@ -140,9 +134,7 @@ func TestGenesis(t *testing.T) { got := observer.ExportGenesis(ctx, *k) require.NotNil(t, got) - params := k.GetParamsIfExists(ctx) expectedGenesisState := types.GenesisState{ - Params: ¶ms, CrosschainFlags: types.DefaultCrosschainFlags(), ChainParamsList: types.ChainParamsList{}, Tss: &types.TSS{}, diff --git a/x/observer/keeper/ballot.go b/x/observer/keeper/ballot.go index 4c960743ac..5a05a5e76b 100644 --- a/x/observer/keeper/ballot.go +++ b/x/observer/keeper/ballot.go @@ -39,6 +39,10 @@ func (k Keeper) GetBallotList(ctx sdk.Context, height int64) (val types.BallotLi return val, true } +func (k Keeper) GetMaturedBallots(ctx sdk.Context, maturityBlocks int64) (val types.BallotListForHeight, found bool) { + return k.GetBallotList(ctx, ctx.BlockHeight()-maturityBlocks) +} + func (k Keeper) GetAllBallots(ctx sdk.Context) (voters []*types.Ballot) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.VoterKey)) iterator := sdk.KVStorePrefixIterator(store, []byte{}) @@ -60,13 +64,3 @@ func (k Keeper) AddBallotToList(ctx sdk.Context, ballot types.Ballot) { list.BallotsIndexList = append(list.BallotsIndexList, ballot.BallotIdentifier) k.SetBallotList(ctx, &list) } - -// GetMaturedBallotList Returns a list of ballots which are matured at current height -func (k Keeper) GetMaturedBallotList(ctx sdk.Context) []string { - maturityBlocks := k.GetParamsIfExists(ctx).BallotMaturityBlocks - list, found := k.GetBallotList(ctx, ctx.BlockHeight()-maturityBlocks) - if !found { - return []string{} - } - return list.BallotsIndexList -} diff --git a/x/observer/keeper/ballot_test.go b/x/observer/keeper/ballot_test.go index 8d71aaa720..e7511a3fe4 100644 --- a/x/observer/keeper/ballot_test.go +++ b/x/observer/keeper/ballot_test.go @@ -1,7 +1,6 @@ package keeper_test import ( - "math" "testing" sdk "github.com/cosmos/cosmos-sdk/types" @@ -75,6 +74,29 @@ func TestKeeper_GetBallotList(t *testing.T) { require.Equal(t, identifier, list.BallotsIndexList[0]) } +func TestKeeper_GetMaturedBallots(t *testing.T) { + k, ctx, _, _ := keepertest.ObserverKeeper(t) + identifier := sample.ZetaIndex(t) + b := &types.Ballot{ + Index: "", + BallotIdentifier: identifier, + VoterList: nil, + ObservationType: 0, + BallotThreshold: sdk.Dec{}, + BallotStatus: 0, + BallotCreationHeight: 1, + } + ctx = ctx.WithBlockHeight(2) + _, found := k.GetMaturedBallots(ctx, 1) + require.False(t, found) + + k.AddBallotToList(ctx, *b) + list, found := k.GetMaturedBallots(ctx, 1) + require.True(t, found) + require.Equal(t, 1, len(list.BallotsIndexList)) + require.Equal(t, identifier, list.BallotsIndexList[0]) +} + func TestKeeper_GetAllBallots(t *testing.T) { k, ctx, _, _ := keepertest.ObserverKeeper(t) identifier := sample.ZetaIndex(t) @@ -95,68 +117,3 @@ func TestKeeper_GetAllBallots(t *testing.T) { require.Equal(t, 1, len(ballots)) require.Equal(t, b, ballots[0]) } - -func TestKeeper_GetMaturedBallotList(t *testing.T) { - t.Run("should return if maturity blocks less than height", func(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - identifier := sample.ZetaIndex(t) - b := &types.Ballot{ - Index: "", - BallotIdentifier: identifier, - VoterList: nil, - ObservationType: 0, - BallotThreshold: sdk.Dec{}, - BallotStatus: 0, - BallotCreationHeight: 1, - } - list := k.GetMaturedBallotList(ctx) - require.Empty(t, list) - ctx = ctx.WithBlockHeight(101) - k.AddBallotToList(ctx, *b) - list = k.GetMaturedBallotList(ctx) - require.Equal(t, 1, len(list)) - require.Equal(t, identifier, list[0]) - }) - - t.Run("should return empty for max maturity blocks", func(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - identifier := sample.ZetaIndex(t) - b := &types.Ballot{ - Index: "", - BallotIdentifier: identifier, - VoterList: nil, - ObservationType: 0, - BallotThreshold: sdk.Dec{}, - BallotStatus: 0, - BallotCreationHeight: 1, - } - k.SetParams(ctx, types.Params{ - BallotMaturityBlocks: math.MaxInt64, - }) - list := k.GetMaturedBallotList(ctx) - require.Empty(t, list) - k.AddBallotToList(ctx, *b) - list = k.GetMaturedBallotList(ctx) - require.Empty(t, list) - }) - - t.Run("should return empty if maturity blocks greater than height", func(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - identifier := sample.ZetaIndex(t) - b := &types.Ballot{ - Index: "", - BallotIdentifier: identifier, - VoterList: nil, - ObservationType: 0, - BallotThreshold: sdk.Dec{}, - BallotStatus: 0, - BallotCreationHeight: 1, - } - list := k.GetMaturedBallotList(ctx) - require.Empty(t, list) - ctx = ctx.WithBlockHeight(1) - k.AddBallotToList(ctx, *b) - list = k.GetMaturedBallotList(ctx) - require.Empty(t, list) - }) -} diff --git a/x/observer/keeper/grpc_query_params.go b/x/observer/keeper/grpc_query_params.go deleted file mode 100644 index ef095420af..0000000000 --- a/x/observer/keeper/grpc_query_params.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper - -import ( - "context" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/observer/types" - "google.golang.org/grpc/codes" - "google.golang.org/grpc/status" -) - -func (k Keeper) Params(c context.Context, req *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - ctx := sdk.UnwrapSDKContext(c) - return &types.QueryParamsResponse{ - Params: k.GetParamsIfExists(ctx)}, nil -} diff --git a/x/observer/keeper/grpc_query_params_test.go b/x/observer/keeper/grpc_query_params_test.go deleted file mode 100644 index a1de6c63b2..0000000000 --- a/x/observer/keeper/grpc_query_params_test.go +++ /dev/null @@ -1,21 +0,0 @@ -package keeper_test - -import ( - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - keepertest "github.com/zeta-chain/zetacore/testutil/keeper" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func TestParamsQuery(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - k.SetParams(ctx, params) - - response, err := k.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} diff --git a/x/observer/keeper/keeper.go b/x/observer/keeper/keeper.go index 7d72d49f06..ff693970f9 100644 --- a/x/observer/keeper/keeper.go +++ b/x/observer/keeper/keeper.go @@ -6,7 +6,6 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" "github.com/tendermint/tendermint/libs/log" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -16,11 +15,11 @@ type ( cdc codec.BinaryCodec storeKey storetypes.StoreKey memKey storetypes.StoreKey - paramstore paramtypes.Subspace stakingKeeper types.StakingKeeper slashingKeeper types.SlashingKeeper authorityKeeper types.AuthorityKeeper lightclientKeeper types.LightclientKeeper + authority string } ) @@ -28,27 +27,27 @@ func NewKeeper( cdc codec.BinaryCodec, storeKey, memKey storetypes.StoreKey, - ps paramtypes.Subspace, stakingKeeper types.StakingKeeper, slashinKeeper types.SlashingKeeper, authorityKeeper types.AuthorityKeeper, lightclientKeeper types.LightclientKeeper, + authority string, ) *Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) + if _, err := sdk.AccAddressFromBech32(authority); err != nil { + panic(err) } return &Keeper{ cdc: cdc, storeKey: storeKey, memKey: memKey, - paramstore: ps, stakingKeeper: stakingKeeper, slashingKeeper: slashinKeeper, authorityKeeper: authorityKeeper, lightclientKeeper: lightclientKeeper, + authority: authority, } + } func (k Keeper) GetSlashingKeeper() types.SlashingKeeper { @@ -78,3 +77,7 @@ func (k Keeper) StoreKey() storetypes.StoreKey { func (k Keeper) Codec() codec.BinaryCodec { return k.cdc } + +func (k Keeper) GetAuthority() string { + return k.authority +} diff --git a/x/observer/keeper/migrator.go b/x/observer/keeper/migrator.go index c4b676884c..13ce8b52a8 100644 --- a/x/observer/keeper/migrator.go +++ b/x/observer/keeper/migrator.go @@ -2,12 +2,6 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - v2 "github.com/zeta-chain/zetacore/x/observer/migrations/v2" - v3 "github.com/zeta-chain/zetacore/x/observer/migrations/v3" - v4 "github.com/zeta-chain/zetacore/x/observer/migrations/v4" - v5 "github.com/zeta-chain/zetacore/x/observer/migrations/v5" - v6 "github.com/zeta-chain/zetacore/x/observer/migrations/v6" - v7 "github.com/zeta-chain/zetacore/x/observer/migrations/v7" ) // Migrator is a struct for handling in-place store migrations. @@ -23,28 +17,28 @@ func NewMigrator(keeper Keeper) Migrator { } // Migrate1to2 migrates the store from consensus version 1 to 2 -func (m Migrator) Migrate1to2(ctx sdk.Context) error { - return v2.MigrateStore(ctx, m.observerKeeper.storeKey, m.observerKeeper.cdc) +func (m Migrator) Migrate1to2(_ sdk.Context) error { + return nil } // Migrate2to3 migrates the store from consensus version 2 to 3 -func (m Migrator) Migrate2to3(ctx sdk.Context) error { - return v3.MigrateStore(ctx, m.observerKeeper) +func (m Migrator) Migrate2to3(_ sdk.Context) error { + return nil } -func (m Migrator) Migrate3to4(ctx sdk.Context) error { - return v4.MigrateStore(ctx, m.observerKeeper) +func (m Migrator) Migrate3to4(_ sdk.Context) error { + return nil } -func (m Migrator) Migrate4to5(ctx sdk.Context) error { - return v5.MigrateStore(ctx, m.observerKeeper) +func (m Migrator) Migrate4to5(_ sdk.Context) error { + return nil } -func (m Migrator) Migrate5to6(ctx sdk.Context) error { - return v6.MigrateStore(ctx, m.observerKeeper) +func (m Migrator) Migrate5to6(_ sdk.Context) error { + return nil } // Migrate6to7 migrates the store from consensus version 6 to 7 -func (m Migrator) Migrate6to7(ctx sdk.Context) error { - return v7.MigrateStore(ctx, m.observerKeeper) +func (m Migrator) Migrate6to7(_ sdk.Context) error { + return nil } diff --git a/x/observer/keeper/params.go b/x/observer/keeper/params.go deleted file mode 100644 index f137d04a18..0000000000 --- a/x/observer/keeper/params.go +++ /dev/null @@ -1,16 +0,0 @@ -package keeper - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func (k Keeper) GetParamsIfExists(ctx sdk.Context) (params types.Params) { - k.paramstore.GetParamSetIfExists(ctx, ¶ms) - return -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/observer/keeper/params_test.go b/x/observer/keeper/params_test.go deleted file mode 100644 index 309d66df9b..0000000000 --- a/x/observer/keeper/params_test.go +++ /dev/null @@ -1,36 +0,0 @@ -package keeper_test - -import ( - "fmt" - "strconv" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/tendermint/tendermint/crypto" - - "github.com/stretchr/testify/require" - keepertest "github.com/zeta-chain/zetacore/testutil/keeper" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func TestGetParams(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParamsIfExists(ctx)) -} - -func TestGenerateAddress(t *testing.T) { - addr := sdk.AccAddress(crypto.AddressHash([]byte("Output1" + strconv.Itoa(1)))) - addrString := addr.String() - fmt.Println(addrString) - addbech32, _ := sdk.AccAddressFromBech32(addrString) - valAddress := sdk.ValAddress(addbech32) - v, _ := sdk.ValAddressFromBech32(valAddress.String()) - fmt.Println(v.String()) - accAddress := sdk.AccAddress(v) - a, _ := sdk.AccAddressFromBech32(accAddress.String()) - fmt.Println(a.String()) -} diff --git a/x/observer/migrations/v2/migrate.go b/x/observer/migrations/v2/migrate.go deleted file mode 100644 index 65027291d2..0000000000 --- a/x/observer/migrations/v2/migrate.go +++ /dev/null @@ -1,27 +0,0 @@ -package v2 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -// MigrateStore migrates the x/observer module state from the consensus version 1 to 2 -/* This migration adds a -- new permission flag to the observer module called IsOutboundEnabled -*/ -func MigrateStore( - ctx sdk.Context, - observerStoreKey storetypes.StoreKey, - cdc codec.BinaryCodec, -) error { - store := prefix.NewStore(ctx.KVStore(observerStoreKey), types.KeyPrefix(types.CrosschainFlagsKey)) - b := cdc.MustMarshal(&types.CrosschainFlags{ - IsInboundEnabled: true, - IsOutboundEnabled: true, - }) - store.Set([]byte{0}, b) - return nil -} diff --git a/x/observer/migrations/v3/migrate.go b/x/observer/migrations/v3/migrate.go deleted file mode 100644 index 8c8a82b08b..0000000000 --- a/x/observer/migrations/v3/migrate.go +++ /dev/null @@ -1,36 +0,0 @@ -package v3 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -type ObserverKeeper interface { - GetParamsIfExists(ctx sdk.Context) types.Params - SetParams(ctx sdk.Context, params types.Params) -} - -// MigrateStore migrates the x/observer module state from the consensus version 2 to 3 -// This migration update the policy group -func MigrateStore(ctx sdk.Context, k ObserverKeeper) error { - // Get first admin policy group - p := k.GetParamsIfExists(ctx) - if len(p.AdminPolicy) == 0 || p.AdminPolicy[0] == nil { - return nil - } - - admin := p.AdminPolicy[0].Address - p.AdminPolicy = []*types.Admin_Policy{ - { - Address: admin, - PolicyType: types.Policy_Type_group1, - }, - { - Address: admin, - PolicyType: types.Policy_Type_group2, - }, - } - k.SetParams(ctx, p) - - return nil -} diff --git a/x/observer/migrations/v3/migrate_test.go b/x/observer/migrations/v3/migrate_test.go deleted file mode 100644 index 2ff0b36255..0000000000 --- a/x/observer/migrations/v3/migrate_test.go +++ /dev/null @@ -1,51 +0,0 @@ -package v3_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - keepertest "github.com/zeta-chain/zetacore/testutil/keeper" - "github.com/zeta-chain/zetacore/testutil/sample" - v3 "github.com/zeta-chain/zetacore/x/observer/migrations/v3" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func TestMigrateStore(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - - // nothing if no admin policy - params := types.DefaultParams() - params.AdminPolicy = []*types.Admin_Policy{} - k.SetParams(ctx, params) - err := v3.MigrateStore(ctx, k) - require.NoError(t, err) - params = k.GetParamsIfExists(ctx) - require.Len(t, params.AdminPolicy, 0) - - // update admin policy - admin := sample.AccAddress() - params = types.DefaultParams() - params.AdminPolicy = []*types.Admin_Policy{ - { - Address: admin, - PolicyType: 0, - }, - { - Address: sample.AccAddress(), - PolicyType: 5, - }, - { - Address: admin, - PolicyType: 10, - }, - } - k.SetParams(ctx, params) - err = v3.MigrateStore(ctx, k) - require.NoError(t, err) - params = k.GetParamsIfExists(ctx) - require.Len(t, params.AdminPolicy, 2) - require.Equal(t, params.AdminPolicy[0].PolicyType, types.Policy_Type_group1) - require.Equal(t, params.AdminPolicy[1].PolicyType, types.Policy_Type_group2) - require.Equal(t, params.AdminPolicy[0].Address, admin) - require.Equal(t, params.AdminPolicy[1].Address, admin) -} diff --git a/x/observer/migrations/v4/migrate.go b/x/observer/migrations/v4/migrate.go deleted file mode 100644 index 9ca22467a2..0000000000 --- a/x/observer/migrations/v4/migrate.go +++ /dev/null @@ -1,43 +0,0 @@ -package v4 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -// observerKeeper prevents circular dependency -type observerKeeper interface { - SetParams(ctx sdk.Context, params types.Params) - GetChainParamsList(ctx sdk.Context) (params types.ChainParamsList, found bool) - SetChainParamsList(ctx sdk.Context, params types.ChainParamsList) - StoreKey() storetypes.StoreKey - Codec() codec.BinaryCodec -} - -func MigrateStore(ctx sdk.Context, observerKeeper observerKeeper) error { - return MigrateCrosschainFlags(ctx, observerKeeper.StoreKey(), observerKeeper.Codec()) -} - -func MigrateCrosschainFlags(ctx sdk.Context, observerStoreKey storetypes.StoreKey, cdc codec.BinaryCodec) error { - newCrossChainFlags := types.DefaultCrosschainFlags() - var val types.LegacyCrosschainFlags - store := prefix.NewStore(ctx.KVStore(observerStoreKey), types.KeyPrefix(types.CrosschainFlagsKey)) - b := store.Get([]byte{0}) - if b != nil { - cdc.MustUnmarshal(b, &val) - if val.GasPriceIncreaseFlags != nil { - newCrossChainFlags.GasPriceIncreaseFlags = val.GasPriceIncreaseFlags - } - newCrossChainFlags.IsOutboundEnabled = val.IsOutboundEnabled - newCrossChainFlags.IsInboundEnabled = val.IsInboundEnabled - } - b, err := cdc.Marshal(newCrossChainFlags) - if err != nil { - return err - } - store.Set([]byte{0}, b) - return nil -} diff --git a/x/observer/migrations/v4/migrate_test.go b/x/observer/migrations/v4/migrate_test.go deleted file mode 100644 index 64cbeaedef..0000000000 --- a/x/observer/migrations/v4/migrate_test.go +++ /dev/null @@ -1,31 +0,0 @@ -package v4_test - -import ( - "testing" - - "github.com/cosmos/cosmos-sdk/store/prefix" - "github.com/stretchr/testify/require" - keepertest "github.com/zeta-chain/zetacore/testutil/keeper" - v4 "github.com/zeta-chain/zetacore/x/observer/migrations/v4" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func TestMigrateCrosschainFlags(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - store := prefix.NewStore(ctx.KVStore(k.StoreKey()), types.KeyPrefix(types.CrosschainFlagsKey)) - legacyFlags := types.LegacyCrosschainFlags{ - IsInboundEnabled: false, - IsOutboundEnabled: false, - GasPriceIncreaseFlags: &types.DefaultGasPriceIncreaseFlags, - } - val := k.Codec().MustMarshal(&legacyFlags) - store.Set([]byte{0}, val) - - err := v4.MigrateCrosschainFlags(ctx, k.StoreKey(), k.Codec()) - require.NoError(t, err) - - flags, found := k.GetCrosschainFlags(ctx) - require.True(t, found) - require.True(t, flags.BlockHeaderVerificationFlags.IsBtcTypeChainEnabled) - require.True(t, flags.BlockHeaderVerificationFlags.IsEthTypeChainEnabled) -} diff --git a/x/observer/migrations/v5/migrate.go b/x/observer/migrations/v5/migrate.go deleted file mode 100644 index 2eb261a3f4..0000000000 --- a/x/observer/migrations/v5/migrate.go +++ /dev/null @@ -1,82 +0,0 @@ -package v5 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -// observerKeeper prevents circular dependency -type observerKeeper interface { - GetParamsIfExists(ctx sdk.Context) types.Params - SetParams(ctx sdk.Context, params types.Params) - GetChainParamsList(ctx sdk.Context) (params types.ChainParamsList, found bool) - SetChainParamsList(ctx sdk.Context, params types.ChainParamsList) - StoreKey() storetypes.StoreKey - Codec() codec.BinaryCodec -} - -func MigrateStore(ctx sdk.Context, observerKeeper observerKeeper) error { - if err := MigrateObserverMapper(ctx, observerKeeper.StoreKey(), observerKeeper.Codec()); err != nil { - return err - } - return MigrateObserverParams(ctx, observerKeeper) -} - -func MigrateObserverMapper(ctx sdk.Context, observerStoreKey storetypes.StoreKey, cdc codec.BinaryCodec) error { - var legacyObserverMappers []*types.ObserverMapper - legacyObserverMapperStore := prefix.NewStore(ctx.KVStore(observerStoreKey), types.KeyPrefix(types.ObserverMapperKey)) - iterator := sdk.KVStorePrefixIterator(legacyObserverMapperStore, []byte{}) - defer iterator.Close() - for ; iterator.Valid(); iterator.Next() { - var val types.ObserverMapper - cdc.MustUnmarshal(iterator.Value(), &val) - legacyObserverMappers = append(legacyObserverMappers, &val) - } - - // We can safely assume that the observer list is the same for all the observer mappers - observerList := legacyObserverMappers[0].ObserverList - - storelastBlockObserverCount := prefix.NewStore(ctx.KVStore(observerStoreKey), types.KeyPrefix(types.LastBlockObserverCountKey)) - b := cdc.MustMarshal(&types.LastObserverCount{Count: uint64(len(observerList)), LastChangeHeight: ctx.BlockHeight()}) - storelastBlockObserverCount.Set([]byte{0}, b) - - storeObserverSet := prefix.NewStore(ctx.KVStore(observerStoreKey), types.KeyPrefix(types.ObserverSetKey)) - b = cdc.MustMarshal(&types.ObserverSet{ObserverList: observerList}) - storeObserverSet.Set([]byte{0}, b) - - for _, legacyObserverMapper := range legacyObserverMappers { - legacyObserverMapperStore.Delete(types.KeyPrefix(legacyObserverMapper.Index)) - } - return nil -} - -// MigrateObserverParams migrates the observer params to the chain params -// the function assumes that each observer params entry has a corresponding chain params entry -// if the chain is not found, the observer params entry is ignored because it is considered as not supported -func MigrateObserverParams(ctx sdk.Context, observerKeeper observerKeeper) error { - chainParamsList, found := observerKeeper.GetChainParamsList(ctx) - if !found { - // no chain params found, nothing to migrate - return nil - } - - // search for the observer params with chain params entry - observerParams := observerKeeper.GetParamsIfExists(ctx).ObserverParams - for _, observerParam := range observerParams { - for i := range chainParamsList.ChainParams { - // if the chain is found, update the chain params with the observer params - if chainParamsList.ChainParams[i].ChainId == observerParam.Chain.ChainId { - chainParamsList.ChainParams[i].MinObserverDelegation = observerParam.MinObserverDelegation - chainParamsList.ChainParams[i].BallotThreshold = observerParam.BallotThreshold - chainParamsList.ChainParams[i].IsSupported = observerParam.IsSupported - break - } - } - } - - observerKeeper.SetChainParamsList(ctx, chainParamsList) - return nil -} diff --git a/x/observer/migrations/v5/migrate_test.go b/x/observer/migrations/v5/migrate_test.go deleted file mode 100644 index 40d072230d..0000000000 --- a/x/observer/migrations/v5/migrate_test.go +++ /dev/null @@ -1,115 +0,0 @@ -package v5_test - -import ( - "testing" - - "github.com/cosmos/cosmos-sdk/store/prefix" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/pkg/chains" - keepertest "github.com/zeta-chain/zetacore/testutil/keeper" - "github.com/zeta-chain/zetacore/testutil/sample" - v5 "github.com/zeta-chain/zetacore/x/observer/migrations/v5" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func TestMigrateObserverMapper(t *testing.T) { - t.Run("TestMigrateStore", func(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - legacyObserverMapperStore := prefix.NewStore(ctx.KVStore(k.StoreKey()), types.KeyPrefix(types.ObserverMapperKey)) - legacyObserverMapperList := sample.LegacyObserverMapperList(t, 12, "sample") - for _, legacyObserverMapper := range legacyObserverMapperList { - legacyObserverMapperStore.Set(types.KeyPrefix(legacyObserverMapper.Index), k.Codec().MustMarshal(legacyObserverMapper)) - } - err := v5.MigrateObserverMapper(ctx, k.StoreKey(), k.Codec()) - require.NoError(t, err) - observerSet, found := k.GetObserverSet(ctx) - require.True(t, found) - - require.Equal(t, legacyObserverMapperList[0].ObserverList, observerSet.ObserverList) - iterator := sdk.KVStorePrefixIterator(legacyObserverMapperStore, []byte{}) - defer iterator.Close() - - var observerMappers []*types.ObserverMapper - for ; iterator.Valid(); iterator.Next() { - var val types.ObserverMapper - if !iterator.Valid() { - k.Codec().MustUnmarshal(iterator.Value(), &val) - observerMappers = append(observerMappers, &val) - } - } - require.Equal(t, 0, len(observerMappers)) - }) -} - -func TestMigrateObserverParams(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - - // set chain params - previousChainParamsList := types.ChainParamsList{ - ChainParams: []*types.ChainParams{ - sample.ChainParams(1), - sample.ChainParams(2), - sample.ChainParams(3), - sample.ChainParams(4), - }, - } - k.SetChainParamsList(ctx, previousChainParamsList) - - // set observer params - dec42, err := sdk.NewDecFromStr("0.42") - require.NoError(t, err) - dec43, err := sdk.NewDecFromStr("0.43") - require.NoError(t, err) - dec1000, err := sdk.NewDecFromStr("1000.0") - require.NoError(t, err) - dec1001, err := sdk.NewDecFromStr("1001.0") - require.NoError(t, err) - params := types.Params{ - ObserverParams: []*types.ObserverParams{ - { - Chain: &chains.Chain{ChainId: 2}, - BallotThreshold: dec42, - MinObserverDelegation: dec1000, - IsSupported: true, - }, - { - Chain: &chains.Chain{ChainId: 3}, - BallotThreshold: dec43, - MinObserverDelegation: dec1001, - IsSupported: true, - }, - }, - } - k.SetParams(ctx, params) - - // perform migration - err = v5.MigrateObserverParams(ctx, *k) - require.NoError(t, err) - - // check chain params - newChainParamsList, found := k.GetChainParamsList(ctx) - require.True(t, found) - - // unchanged values - require.EqualValues(t, previousChainParamsList.ChainParams[0], newChainParamsList.ChainParams[0]) - require.EqualValues(t, previousChainParamsList.ChainParams[3], newChainParamsList.ChainParams[3]) - - // changed values - require.EqualValues(t, dec42, newChainParamsList.ChainParams[1].BallotThreshold) - require.EqualValues(t, dec1000, newChainParamsList.ChainParams[1].MinObserverDelegation) - require.EqualValues(t, dec43, newChainParamsList.ChainParams[2].BallotThreshold) - require.EqualValues(t, dec1001, newChainParamsList.ChainParams[2].MinObserverDelegation) - require.True(t, newChainParamsList.ChainParams[1].IsSupported) - require.True(t, newChainParamsList.ChainParams[2].IsSupported) - - // check remaining values are unchanged - previousChainParamsList.ChainParams[1].BallotThreshold = dec42 - previousChainParamsList.ChainParams[2].BallotThreshold = dec43 - previousChainParamsList.ChainParams[1].MinObserverDelegation = dec1000 - previousChainParamsList.ChainParams[2].MinObserverDelegation = dec1001 - previousChainParamsList.ChainParams[1].IsSupported = true - previousChainParamsList.ChainParams[2].IsSupported = true - require.EqualValues(t, previousChainParamsList.ChainParams[1], newChainParamsList.ChainParams[1]) - require.EqualValues(t, previousChainParamsList.ChainParams[2], newChainParamsList.ChainParams[2]) -} diff --git a/x/observer/migrations/v6/migrate.go b/x/observer/migrations/v6/migrate.go deleted file mode 100644 index a678c8a54d..0000000000 --- a/x/observer/migrations/v6/migrate.go +++ /dev/null @@ -1,39 +0,0 @@ -package v6 - -import ( - "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -// observerKeeper prevents circular dependency -type observerKeeper interface { - SetKeygen(ctx sdk.Context, keygen types.Keygen) - GetKeygen(ctx sdk.Context) (val types.Keygen, found bool) - GetTSS(ctx sdk.Context) (val types.TSS, found bool) - StoreKey() storetypes.StoreKey - Codec() codec.BinaryCodec -} - -func MigrateStore(ctx sdk.Context, observerKeeper observerKeeper) error { - return SetKeyGenStatus(ctx, observerKeeper) -} - -func SetKeyGenStatus(ctx sdk.Context, keeper observerKeeper) error { - keygen, found := keeper.GetKeygen(ctx) - if !found { - return types.ErrKeygenNotFound - } - if keygen.Status == types.KeygenStatus_PendingKeygen { - tss, foundTss := keeper.GetTSS(ctx) - if !foundTss { - return types.ErrTssNotFound - } - keygen.Status = types.KeygenStatus_KeyGenSuccess - keygen.BlockNumber = tss.KeyGenZetaHeight - keygen.GranteePubkeys = tss.TssParticipantList - keeper.SetKeygen(ctx, keygen) - } - return nil -} diff --git a/x/observer/migrations/v6/migrate_test.go b/x/observer/migrations/v6/migrate_test.go deleted file mode 100644 index a9159aefc4..0000000000 --- a/x/observer/migrations/v6/migrate_test.go +++ /dev/null @@ -1,87 +0,0 @@ -package v6_test - -import ( - "math" - "testing" - - "github.com/stretchr/testify/require" - keepertest "github.com/zeta-chain/zetacore/testutil/keeper" - v6 "github.com/zeta-chain/zetacore/x/observer/migrations/v6" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func TestMigrateObserverParams(t *testing.T) { - t.Run("Migrate when keygen is Pending", func(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - k.SetKeygen(ctx, types.Keygen{ - Status: types.KeygenStatus_PendingKeygen, - BlockNumber: math.MaxInt64, - }) - participantList := []string{ - "zetapub1addwnpepqglunjrgl3qg08duxq9pf28jmvrer3crwnnfzp6m0u0yh9jk9mnn5p76utc", - "zetapub1addwnpepqwwpjwwnes7cywfkr0afme7ymk8rf5jzhn8pfr6qqvfm9v342486qsrh4f5", - "zetapub1addwnpepq07xj82w5e6vr85qj3r7htmzh2mp3vkvfraapcv6ynhdwankseayk5yh80t", - "zetapub1addwnpepq0lxqx92m3fhae3usn8jffqvtx6cuzl06xh9r345c2qcqq8zyfs4cdpqcum", - "zetapub1addwnpepqvzlntzltvpm22ved5gjtn9nzqfz5fun38el4r64njc979rwanxlgq4u3p8", - "zetapub1addwnpepqg40psrhwwgy257p4xv50xp0asmtwjup66z8vk829289zxge5lyl7sycga8", - "zetapub1addwnpepqgpr5ffquqchra93r8l6d35q62cv4nsc9d4k2q7kten4sljxg5rluwx29gh", - "zetapub1addwnpepqdjf3vt8etgdddkghrvxfmmmeatky6m7hx7wjuv86udfghqpty8h5h4r78w", - "zetapub1addwnpepqtfcfmsdkzdgv03t8392gsh7kzrstp9g864w2ltz9k0xzz33q60dq6mnkex", - } - operatorList := []string{ - "zeta19jr7nl82lrktge35f52x9g5y5prmvchmk40zhg", - "zeta1cxj07f3ju484ry2cnnhxl5tryyex7gev0yzxtj", - "zeta1hjct6q7npsspsg3dgvzk3sdf89spmlpf7rqmnw", - "zeta1k6vh9y7ctn06pu5jngznv5dyy0rltl2qp0j30g", - "zeta1l07weaxkmn6z69qm55t53v4rfr43eys4cjz54h", - "zeta1p0uwsq4naus5r4l7l744upy0k8ezzj84mn40nf", - "zeta1rhj4pkp7eygw8lu9wacpepeh0fnzdxrqr27g6m", - "zeta1t0uj2z93jd2g3w94zl3jhfrn2ek6dnuk3v93j9", - "zeta1t5pgk2fucx3drkynzew9zln5z9r7s3wqqyy0pe", - } - keygenHeight := int64(1440460) - finalizedZetaHeight := int64(1440680) - k.SetTSS(ctx, types.TSS{ - KeyGenZetaHeight: keygenHeight, - TssParticipantList: participantList, - TssPubkey: "zetapub1addwnpepqtadxdyt037h86z60nl98t6zk56mw5zpnm79tsmvspln3hgt5phdc79kvfc", - OperatorAddressList: operatorList, - FinalizedZetaHeight: finalizedZetaHeight, - }) - err := v6.MigrateStore(ctx, k) - require.NoError(t, err) - keygen, found := k.GetKeygen(ctx) - require.True(t, found) - require.Equal(t, types.KeygenStatus_KeyGenSuccess, keygen.Status) - require.Equal(t, keygenHeight, keygenHeight) - require.Equal(t, participantList, participantList) - }) - t.Run("Migrate when keygen is not Pending", func(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - participantList := []string{ - "zetapub1addwnpepqglunjrgl3qg08duxq9pf28jmvrer3crwnnfzp6m0u0yh9jk9mnn5p76utc", - "zetapub1addwnpepqwwpjwwnes7cywfkr0afme7ymk8rf5jzhn8pfr6qqvfm9v342486qsrh4f5", - "zetapub1addwnpepq07xj82w5e6vr85qj3r7htmzh2mp3vkvfraapcv6ynhdwankseayk5yh80t", - "zetapub1addwnpepq0lxqx92m3fhae3usn8jffqvtx6cuzl06xh9r345c2qcqq8zyfs4cdpqcum", - "zetapub1addwnpepqvzlntzltvpm22ved5gjtn9nzqfz5fun38el4r64njc979rwanxlgq4u3p8", - "zetapub1addwnpepqg40psrhwwgy257p4xv50xp0asmtwjup66z8vk829289zxge5lyl7sycga8", - "zetapub1addwnpepqgpr5ffquqchra93r8l6d35q62cv4nsc9d4k2q7kten4sljxg5rluwx29gh", - "zetapub1addwnpepqdjf3vt8etgdddkghrvxfmmmeatky6m7hx7wjuv86udfghqpty8h5h4r78w", - "zetapub1addwnpepqtfcfmsdkzdgv03t8392gsh7kzrstp9g864w2ltz9k0xzz33q60dq6mnkex", - } - keygenHeight := int64(1440460) - k.SetKeygen(ctx, types.Keygen{ - Status: types.KeygenStatus_KeyGenSuccess, - BlockNumber: keygenHeight, - GranteePubkeys: participantList, - }) - err := v6.MigrateStore(ctx, k) - require.NoError(t, err) - keygen, found := k.GetKeygen(ctx) - require.True(t, found) - require.Equal(t, types.KeygenStatus_KeyGenSuccess, keygen.Status) - require.Equal(t, keygen.BlockNumber, keygenHeight) - require.Equal(t, keygen.GranteePubkeys, participantList) - }) - -} diff --git a/x/observer/migrations/v7/migrate.go b/x/observer/migrations/v7/migrate.go deleted file mode 100644 index 94c162b373..0000000000 --- a/x/observer/migrations/v7/migrate.go +++ /dev/null @@ -1,61 +0,0 @@ -package v7 - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -// observerKeeper prevents circular dependency -type observerKeeper interface { - GetParamsIfExists(ctx sdk.Context) (params types.Params) - GetAuthorityKeeper() types.AuthorityKeeper -} - -// MigrateStore performs in-place store migrations from v6 to v7 -func MigrateStore(ctx sdk.Context, observerKeeper observerKeeper) error { - ctx.Logger().Info("Migrating observer store from v6 to v7") - return MigratePolicies(ctx, observerKeeper) -} - -// MigratePolicies migrates policies from observer to authority -func MigratePolicies(ctx sdk.Context, observerKeeper observerKeeper) error { - params := observerKeeper.GetParamsIfExists(ctx) - authorityKeeper := observerKeeper.GetAuthorityKeeper() - - var policies authoritytypes.Policies - - // convert observer policies to authority policies - for _, adminPolicy := range params.AdminPolicy { - if adminPolicy != nil { - - if adminPolicy.PolicyType == types.Policy_Type_group1 { - // for policy group 1, we set the policy type to emergency - policies.Items = append(policies.Items, &authoritytypes.Policy{ - Address: adminPolicy.Address, - PolicyType: authoritytypes.PolicyType_groupEmergency, - }) - } else { - // for policy group 2, we set the policy type to admin and operational - // the operational address should be changed after the migration - policies.Items = append(policies.Items, &authoritytypes.Policy{ - Address: adminPolicy.Address, - PolicyType: authoritytypes.PolicyType_groupAdmin, - }) - policies.Items = append(policies.Items, &authoritytypes.Policy{ - Address: adminPolicy.Address, - PolicyType: authoritytypes.PolicyType_groupOperational, - }) - } - } - } - - // ensure policies are valid - if err := policies.Validate(); err != nil { - return err - } - - // set policies in authority - authorityKeeper.SetPolicies(ctx, policies) - return nil -} diff --git a/x/observer/migrations/v7/migrate_test.go b/x/observer/migrations/v7/migrate_test.go deleted file mode 100644 index 00d84a51e3..0000000000 --- a/x/observer/migrations/v7/migrate_test.go +++ /dev/null @@ -1,167 +0,0 @@ -package v7_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - keepertest "github.com/zeta-chain/zetacore/testutil/keeper" - "github.com/zeta-chain/zetacore/testutil/sample" - authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" - v7 "github.com/zeta-chain/zetacore/x/observer/migrations/v7" - "github.com/zeta-chain/zetacore/x/observer/types" -) - -func TestMigrateStore(t *testing.T) { - t.Run("Migrate store from v6 to v7", func(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - - addr1 := sample.AccAddress() - addr2 := sample.AccAddress() - - k.SetParams(ctx, types.Params{ - AdminPolicy: []*types.Admin_Policy{ - { - PolicyType: types.Policy_Type_group1, - Address: addr1, - }, - { - PolicyType: types.Policy_Type_group2, - Address: addr2, - }, - }, - }) - - // Migrate store - err := v7.MigrateStore(ctx, k) - - // Check if store is migrated - require.NoError(t, err) - }) -} - -func TestMigratePolicies(t *testing.T) { - t.Run("Migrate policies from observer to authority with 2 types", func(t *testing.T) { - k, ctx, _, zk := keepertest.ObserverKeeper(t) - - addr1 := sample.AccAddress() - addr2 := sample.AccAddress() - - k.SetParams(ctx, types.Params{ - AdminPolicy: []*types.Admin_Policy{ - { - PolicyType: types.Policy_Type_group1, - Address: addr1, - }, - { - PolicyType: types.Policy_Type_group2, - Address: addr2, - }, - }, - }) - - // Migrate policies - err := v7.MigratePolicies(ctx, k) - - // Check if policies are migrated - require.NoError(t, err) - policies, found := zk.AuthorityKeeper.GetPolicies(ctx) - require.True(t, found) - items := policies.Items - require.Len(t, items, 3) - require.EqualValues(t, addr1, items[0].Address) - require.EqualValues(t, addr2, items[1].Address) - require.EqualValues(t, addr2, items[2].Address) - require.EqualValues(t, authoritytypes.PolicyType_groupEmergency, items[0].PolicyType) - require.EqualValues(t, authoritytypes.PolicyType_groupAdmin, items[1].PolicyType) - require.EqualValues(t, authoritytypes.PolicyType_groupOperational, items[2].PolicyType) - }) - - t.Run("Can migrate with just emergency policy", func(t *testing.T) { - k, ctx, _, zk := keepertest.ObserverKeeper(t) - - addr := sample.AccAddress() - - k.SetParams(ctx, types.Params{ - AdminPolicy: []*types.Admin_Policy{ - { - PolicyType: types.Policy_Type_group1, - Address: addr, - }, - }, - }) - - // Migrate policies - err := v7.MigratePolicies(ctx, k) - - // Check if policies are migrated - require.NoError(t, err) - policies, found := zk.AuthorityKeeper.GetPolicies(ctx) - require.True(t, found) - items := policies.Items - require.Len(t, items, 1) - require.EqualValues(t, addr, items[0].Address) - require.EqualValues(t, authoritytypes.PolicyType_groupEmergency, items[0].PolicyType) - }) - - t.Run("Can migrate with just policy group 2, this create admin and operational policies", func(t *testing.T) { - k, ctx, _, zk := keepertest.ObserverKeeper(t) - - addr := sample.AccAddress() - - k.SetParams(ctx, types.Params{ - AdminPolicy: []*types.Admin_Policy{ - { - PolicyType: types.Policy_Type_group2, - Address: addr, - }, - }, - }) - - // Migrate policies - err := v7.MigratePolicies(ctx, k) - - // Check if policies are migrated - require.NoError(t, err) - policies, found := zk.AuthorityKeeper.GetPolicies(ctx) - require.True(t, found) - items := policies.Items - require.Len(t, items, 2) - require.EqualValues(t, addr, items[0].Address) - require.EqualValues(t, addr, items[1].Address) - require.EqualValues(t, authoritytypes.PolicyType_groupAdmin, items[0].PolicyType) - require.EqualValues(t, authoritytypes.PolicyType_groupOperational, items[1].PolicyType) - }) - - t.Run("Can migrate with no policies", func(t *testing.T) { - k, ctx, _, zk := keepertest.ObserverKeeper(t) - - k.SetParams(ctx, types.Params{}) - - // Migrate policies - err := v7.MigratePolicies(ctx, k) - - // Check if policies are migrated - require.NoError(t, err) - policies, found := zk.AuthorityKeeper.GetPolicies(ctx) - require.True(t, found) - items := policies.Items - require.Len(t, items, 0) - }) - - t.Run("Fail to migrate if invalid policy", func(t *testing.T) { - k, ctx, _, _ := keepertest.ObserverKeeper(t) - - k.SetParams(ctx, types.Params{ - AdminPolicy: []*types.Admin_Policy{ - { - PolicyType: types.Policy_Type_group1, - Address: "invalid", - }, - }, - }) - - // Migrate policies - err := v7.MigratePolicies(ctx, k) - require.Error(t, err) - }) -} diff --git a/x/observer/module_simulation.go b/x/observer/module_simulation.go index 5ebd6a9027..4c0604bae5 100644 --- a/x/observer/module_simulation.go +++ b/x/observer/module_simulation.go @@ -21,10 +21,7 @@ func (AppModule) GenerateGenesisState(simState *module.SimulationState) { for i, acc := range simState.Accounts { accs[i] = acc.Address.String() } - defaultParams := types.DefaultParams() - observerGenesis := types.GenesisState{ - Params: &defaultParams, - } + observerGenesis := types.GenesisState{} simState.GenState[types.ModuleName] = simState.Cdc.MustMarshalJSON(&observerGenesis) } diff --git a/x/observer/types/genesis.go b/x/observer/types/genesis.go index c20cd8ff04..1425eafd30 100644 --- a/x/observer/types/genesis.go +++ b/x/observer/types/genesis.go @@ -9,9 +9,7 @@ import ( // DefaultGenesis returns the default observer genesis state func DefaultGenesis() *GenesisState { - params := DefaultParams() return &GenesisState{ - Params: ¶ms, Ballots: nil, Observers: ObserverSet{}, NodeAccountList: []*NodeAccount{}, @@ -24,12 +22,6 @@ func DefaultGenesis() *GenesisState { // Validate performs basic genesis state validation returning an error upon any failure. func (gs GenesisState) Validate() error { - if gs.Params != nil { - err := gs.Params.Validate() - if err != nil { - return err - } - } // Check for duplicated index in nodeAccount nodeAccountIndexMap := make(map[string]bool) diff --git a/x/observer/types/genesis.pb.go b/x/observer/types/genesis.pb.go index 0f81d44c6f..386068b903 100644 --- a/x/observer/types/genesis.pb.go +++ b/x/observer/types/genesis.pb.go @@ -29,7 +29,6 @@ type GenesisState struct { Observers ObserverSet `protobuf:"bytes,2,opt,name=observers,proto3" json:"observers"` NodeAccountList []*NodeAccount `protobuf:"bytes,3,rep,name=nodeAccountList,proto3" json:"nodeAccountList,omitempty"` CrosschainFlags *CrosschainFlags `protobuf:"bytes,4,opt,name=crosschain_flags,json=crosschainFlags,proto3" json:"crosschain_flags,omitempty"` - Params *Params `protobuf:"bytes,5,opt,name=params,proto3" json:"params,omitempty"` Keygen *Keygen `protobuf:"bytes,6,opt,name=keygen,proto3" json:"keygen,omitempty"` LastObserverCount *LastObserverCount `protobuf:"bytes,7,opt,name=last_observer_count,json=lastObserverCount,proto3" json:"last_observer_count,omitempty"` ChainParamsList ChainParamsList `protobuf:"bytes,8,opt,name=chain_params_list,json=chainParamsList,proto3" json:"chain_params_list"` @@ -103,13 +102,6 @@ func (m *GenesisState) GetCrosschainFlags() *CrosschainFlags { return nil } -func (m *GenesisState) GetParams() *Params { - if m != nil { - return m.Params - } - return nil -} - func (m *GenesisState) GetKeygen() *Keygen { if m != nil { return m.Keygen @@ -187,47 +179,47 @@ func init() { func init() { proto.RegisterFile("observer/genesis.proto", fileDescriptor_15ea8c9d44da7399) } var fileDescriptor_15ea8c9d44da7399 = []byte{ - // 637 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x54, 0xdf, 0x4e, 0x13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c, 0x90, 0xc8, 0x6b, 0xa7, 0xc9, 0xc6, 0xa0, 0x93, 0x9b, 0xa1, 0x57, 0xbf, 0x1d, - 0x7a, 0xf5, 0x3f, 0x43, 0xaf, 0xfe, 0x63, 0xe4, 0xd5, 0x6e, 0x47, 0x5e, 0xed, 0xd7, 0xc8, 0xab, - 0x7d, 0x09, 0xe2, 0x44, 0x5e, 0xf5, 0xdb, 0x3e, 0xe1, 0xdd, 0x40, 0xc9, 0x3e, 0xd7, 0x11, 0x02, - 0x17, 0x21, 0xb8, 0x0e, 0x8a, 0x73, 0x38, 0xe8, 0x51, 0xd1, 0x5e, 0xd0, 0x27, 0xf0, 0xe5, 0xdf, - 0x00, 0x00, 0x00, 0xff, 0xff, 0xf6, 0x5e, 0x89, 0xea, 0x92, 0x06, 0x00, 0x00, + // 627 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xdf, 0x6e, 0xd3, 0x30, + 0x14, 0xc6, 0x5b, 0x36, 0xed, 0x8f, 0xbb, 0xad, 0x9b, 0x19, 0x60, 0x6d, 0x90, 0x8d, 0x71, 0x53, + 0x21, 0x48, 0x50, 0xb9, 0x44, 0x5c, 0xb0, 0x4a, 0x1b, 0x13, 0x65, 0x8c, 0x74, 0x12, 0x12, 0x17, + 0x8b, 0x5c, 0xd7, 0x4d, 0x23, 0x52, 0xbb, 0x8a, 0x5d, 0xd4, 0xf2, 0x14, 0x3c, 0xd6, 0x2e, 0x77, + 0xc9, 0x15, 0x42, 0xed, 0x13, 0xf0, 0x06, 0x28, 0x8e, 0x9d, 0x34, 0xad, 0x14, 0x7a, 0x67, 0x7d, + 0xc7, 0xdf, 0xef, 0x1c, 0x1f, 0x1f, 0x1b, 0x3c, 0xe4, 0x6d, 0x41, 0xa3, 0xef, 0x34, 0x72, 0x7c, + 0xca, 0xa8, 0x08, 0x84, 0x3d, 0x88, 0xb8, 0xe4, 0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xac, 0xf3, 0x51, 0x9b, 0x2e, 0x58, 0x97, 0x6b, 0xfe, 0xae, 0xcc, + 0x87, 0xe2, 0x72, 0x81, 0xfa, 0x4f, 0x92, 0xde, 0x6d, 0x29, 0xfa, 0x49, 0xf1, 0xe3, 0x88, 0xb7, + 0x9b, 0xa9, 0x56, 0x5e, 0x3d, 0x81, 0x3b, 0xf9, 0x27, 0x8c, 0xb6, 0x15, 0xec, 0x79, 0x21, 0xec, + 0x2a, 0xb1, 0x5c, 0x2a, 0x87, 0x86, 0x6e, 0x0f, 0x66, 0x45, 0xf8, 0x19, 0x6c, 0xcd, 0xfe, 0x6d, + 0x68, 0x67, 0x89, 0xb7, 0xa2, 0xee, 0x37, 0x07, 0xad, 0x90, 0x4c, 0x82, 0x2e, 0xd8, 0xce, 0x7d, + 0x5e, 0xa8, 0xba, 0xd4, 0xfb, 0x63, 0x84, 0x5e, 0xf3, 0x06, 0x91, 0x23, 0xc3, 0x64, 0x33, 0xd2, + 0xc5, 0xed, 0xc4, 0x2a, 0xdf, 0x4d, 0xac, 0xf2, 0x9f, 0x89, 0x55, 0xfe, 0x39, 0xb5, 0x4a, 0x77, + 0x53, 0xab, 0xf4, 0x6b, 0x6a, 0x95, 0xbe, 0x3a, 0x7e, 0x20, 0x7b, 0xc3, 0xb6, 0x4d, 0x78, 0xdf, + 0x89, 0xb1, 0x2f, 0x55, 0x06, 0xc7, 0x64, 0x70, 0x46, 0x4e, 0xf6, 0xa3, 0x8d, 0x07, 0x54, 0xb4, + 0xd7, 0xd4, 0x2f, 0xf6, 0xfa, 0x5f, 0x00, 0x00, 0x00, 0xff, 0xff, 0x62, 0x95, 0x52, 0x6b, 0x55, + 0x06, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -380,18 +372,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x32 } - if m.Params != nil { - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } if m.CrosschainFlags != nil { { size, err := m.CrosschainFlags.MarshalToSizedBuffer(dAtA[:i]) @@ -480,10 +460,6 @@ func (m *GenesisState) Size() (n int) { l = m.CrosschainFlags.Size() n += 1 + l + sovGenesis(uint64(l)) } - if m.Params != nil { - l = m.Params.Size() - n += 1 + l + sovGenesis(uint64(l)) - } if m.Keygen != nil { l = m.Keygen.Size() n += 1 + l + sovGenesis(uint64(l)) @@ -709,42 +685,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowGenesis - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Params == nil { - m.Params = &Params{} - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 6: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field Keygen", wireType) diff --git a/x/observer/types/keys.go b/x/observer/types/keys.go index 6c7b45b2c7..c6426a4351 100644 --- a/x/observer/types/keys.go +++ b/x/observer/types/keys.go @@ -78,6 +78,8 @@ const ( PendingNoncesKeyPrefix = "PendingNonces-value-" ChainNoncesKey = "ChainNonces-value-" NonceToCctxKeyPrefix = "NonceToCctx-value-" + + ParamsKey = "Params-value-" ) func GetBlameIndex(chainID int64, nonce uint64, digest string, height uint64) string { diff --git a/x/observer/types/params.go b/x/observer/types/params.go deleted file mode 100644 index ea1db66657..0000000000 --- a/x/observer/types/params.go +++ /dev/null @@ -1,111 +0,0 @@ -package types - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/zeta-chain/zetacore/pkg/chains" - "gopkg.in/yaml.v2" -) - -var _ paramtypes.ParamSet = (*Params)(nil) - -// ParamKeyTable the param key table for zetaObserver module -func ParamKeyTable() paramtypes.KeyTable { - return paramtypes.NewKeyTable().RegisterParamSet(&Params{}) -} - -func NewParams(observerParams []*ObserverParams, adminParams []*Admin_Policy, ballotMaturityBlocks int64) Params { - return Params{ - ObserverParams: observerParams, - AdminPolicy: adminParams, - BallotMaturityBlocks: ballotMaturityBlocks, - } -} - -// DefaultParams returns a default set of parameters. -// privnet chains are supported by default for testing purposes -// custom params must be provided in genesis for other networks -func DefaultParams() Params { - chains := chains.PrivnetChainList() - observerParams := make([]*ObserverParams, len(chains)) - for i, chain := range chains { - observerParams[i] = &ObserverParams{ - IsSupported: true, - Chain: chain, - BallotThreshold: sdk.MustNewDecFromStr("0.66"), - MinObserverDelegation: sdk.MustNewDecFromStr("1000000000000000000000"), // 1000 ZETA - } - } - return NewParams(observerParams, DefaultAdminPolicy(), 100) -} - -func DefaultAdminPolicy() []*Admin_Policy { - return []*Admin_Policy{ - { - PolicyType: Policy_Type_group1, - Address: GroupID1Address, - }, - { - PolicyType: Policy_Type_group2, - Address: GroupID1Address, - }, - } -} - -// ParamSetPairs get the params.ParamSet -func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs { - return paramtypes.ParamSetPairs{ - paramtypes.NewParamSetPair(KeyPrefix(ObserverParamsKey), &p.ObserverParams, validateVotingThresholds), - paramtypes.NewParamSetPair(KeyPrefix(AdminPolicyParamsKey), &p.AdminPolicy, validateAdminPolicy), - paramtypes.NewParamSetPair(KeyPrefix(BallotMaturityBlocksParamsKey), &p.BallotMaturityBlocks, validateBallotMaturityBlocks), - } -} - -// Validate validates the set of params -func (p Params) Validate() error { - return nil -} - -// String implements the Stringer interface. -func (p Params) String() string { - out, err := yaml.Marshal(p) - if err != nil { - return "" - } - return string(out) -} - -// Deprecated: observer params are now stored in core params -func validateVotingThresholds(i interface{}) error { - v, ok := i.([]*ObserverParams) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - for _, threshold := range v { - if threshold.BallotThreshold.GT(sdk.OneDec()) { - return ErrParamsThreshold - } - } - return nil -} - -func validateAdminPolicy(i interface{}) error { - _, ok := i.([]*Admin_Policy) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} - -// https://github.com/zeta-chain/node/issues/1983 -func validateBallotMaturityBlocks(i interface{}) error { - _, ok := i.(int64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - return nil -} diff --git a/x/observer/types/params.pb.go b/x/observer/types/params.pb.go index 8e223d5571..5406afe306 100644 --- a/x/observer/types/params.pb.go +++ b/x/observer/types/params.pb.go @@ -26,32 +26,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// Deprecated(v14):Moved into the authority module -type Policy_Type int32 - -const ( - Policy_Type_group1 Policy_Type = 0 - Policy_Type_group2 Policy_Type = 1 -) - -var Policy_Type_name = map[int32]string{ - 0: "group1", - 1: "group2", -} - -var Policy_Type_value = map[string]int32{ - "group1": 0, - "group2": 1, -} - -func (x Policy_Type) String() string { - return proto.EnumName(Policy_Type_name, int32(x)) -} - -func (Policy_Type) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_4542fa62877488a1, []int{0} -} - type ChainParamsList struct { ChainParams []*ChainParams `protobuf:"bytes,1,rep,name=chain_params,json=chainParams,proto3" json:"chain_params,omitempty"` } @@ -285,185 +259,57 @@ func (m *ObserverParams) GetIsSupported() bool { return false } -// Deprecated(v14):Moved into the authority module -type Admin_Policy struct { - PolicyType Policy_Type `protobuf:"varint,1,opt,name=policy_type,json=policyType,proto3,enum=zetachain.zetacore.observer.Policy_Type" json:"policy_type,omitempty"` - Address string `protobuf:"bytes,2,opt,name=address,proto3" json:"address,omitempty"` -} - -func (m *Admin_Policy) Reset() { *m = Admin_Policy{} } -func (m *Admin_Policy) String() string { return proto.CompactTextString(m) } -func (*Admin_Policy) ProtoMessage() {} -func (*Admin_Policy) Descriptor() ([]byte, []int) { - return fileDescriptor_4542fa62877488a1, []int{3} -} -func (m *Admin_Policy) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Admin_Policy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Admin_Policy.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Admin_Policy) XXX_Merge(src proto.Message) { - xxx_messageInfo_Admin_Policy.Merge(m, src) -} -func (m *Admin_Policy) XXX_Size() int { - return m.Size() -} -func (m *Admin_Policy) XXX_DiscardUnknown() { - xxx_messageInfo_Admin_Policy.DiscardUnknown(m) -} - -var xxx_messageInfo_Admin_Policy proto.InternalMessageInfo - -func (m *Admin_Policy) GetPolicyType() Policy_Type { - if m != nil { - return m.PolicyType - } - return Policy_Type_group1 -} - -func (m *Admin_Policy) GetAddress() string { - if m != nil { - return m.Address - } - return "" -} - -// Params defines the parameters for the module. -type Params struct { - // Deprecated(v13): Use ChainParamsList - ObserverParams []*ObserverParams `protobuf:"bytes,1,rep,name=observer_params,json=observerParams,proto3" json:"observer_params,omitempty"` - // Deprecated(v14):Moved into the authority module - AdminPolicy []*Admin_Policy `protobuf:"bytes,2,rep,name=admin_policy,json=adminPolicy,proto3" json:"admin_policy,omitempty"` - BallotMaturityBlocks int64 `protobuf:"varint,3,opt,name=ballot_maturity_blocks,json=ballotMaturityBlocks,proto3" json:"ballot_maturity_blocks,omitempty"` -} - -func (m *Params) Reset() { *m = Params{} } -func (*Params) ProtoMessage() {} -func (*Params) Descriptor() ([]byte, []int) { - return fileDescriptor_4542fa62877488a1, []int{4} -} -func (m *Params) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Params.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *Params) XXX_Merge(src proto.Message) { - xxx_messageInfo_Params.Merge(m, src) -} -func (m *Params) XXX_Size() int { - return m.Size() -} -func (m *Params) XXX_DiscardUnknown() { - xxx_messageInfo_Params.DiscardUnknown(m) -} - -var xxx_messageInfo_Params proto.InternalMessageInfo - -func (m *Params) GetObserverParams() []*ObserverParams { - if m != nil { - return m.ObserverParams - } - return nil -} - -func (m *Params) GetAdminPolicy() []*Admin_Policy { - if m != nil { - return m.AdminPolicy - } - return nil -} - -func (m *Params) GetBallotMaturityBlocks() int64 { - if m != nil { - return m.BallotMaturityBlocks - } - return 0 -} - func init() { - proto.RegisterEnum("zetachain.zetacore.observer.Policy_Type", Policy_Type_name, Policy_Type_value) proto.RegisterType((*ChainParamsList)(nil), "zetachain.zetacore.observer.ChainParamsList") proto.RegisterType((*ChainParams)(nil), "zetachain.zetacore.observer.ChainParams") proto.RegisterType((*ObserverParams)(nil), "zetachain.zetacore.observer.ObserverParams") - proto.RegisterType((*Admin_Policy)(nil), "zetachain.zetacore.observer.Admin_Policy") - proto.RegisterType((*Params)(nil), "zetachain.zetacore.observer.Params") } func init() { proto.RegisterFile("observer/params.proto", fileDescriptor_4542fa62877488a1) } var fileDescriptor_4542fa62877488a1 = []byte{ - // 805 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x41, 0x6f, 0xe3, 0x44, - 0x14, 0xc7, 0xe3, 0x24, 0xcd, 0x76, 0x9f, 0xd3, 0x24, 0x6b, 0xed, 0xb2, 0x26, 0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0xda, 0xa9, 0x5c, 0x5c, 0x3b, 0x95, 0x3f, 0xae, 0x9d, 0xca, 0xb7, - 0xde, 0x46, 0x23, 0x64, 0xa9, 0x1f, 0xea, 0x53, 0x78, 0xe5, 0x29, 0xbc, 0xe5, 0xfa, 0xa7, 0x94, - 0x77, 0xc5, 0xb4, 0xa1, 0x7f, 0x41, 0x1f, 0xff, 0x13, 0x00, 0x00, 0xff, 0xff, 0x70, 0xbf, 0xfa, - 0xb7, 0x00, 0x07, 0x00, 0x00, + // 643 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x94, 0x41, 0x4f, 0xdb, 0x3c, + 0x18, 0xc7, 0x1b, 0x0a, 0xbc, 0xe0, 0x14, 0x0a, 0xd1, 0x8b, 0xc8, 0x5b, 0xf4, 0x86, 0xae, 0x93, + 0xa6, 0x68, 0x12, 0xc9, 0xc4, 0xae, 0xdb, 0x01, 0xca, 0x05, 0x0d, 0x69, 0x28, 0x74, 0x87, 0xed, + 0x30, 0xcb, 0x75, 0x4c, 0x62, 0x35, 0xcd, 0x13, 0xd9, 0x0e, 0x2b, 0xfb, 0x14, 0xbb, 0xef, 0xb8, + 0x2f, 0xc3, 0x91, 0xe3, 0xb4, 0x03, 0x9a, 0xe0, 0x8b, 0x4c, 0x71, 0x92, 0xae, 0xa2, 0x68, 0x87, + 0x49, 0x9c, 0x62, 0xfb, 0xff, 0x7b, 0xfe, 0x7e, 0xf2, 0xd8, 0x8f, 0xd1, 0x16, 0x0c, 0x25, 0x13, + 0x17, 0x4c, 0xf8, 0x19, 0x11, 0x64, 0x2c, 0xbd, 0x4c, 0x80, 0x02, 0x6b, 0xe7, 0x33, 0x53, 0x84, + 0xc6, 0x84, 0xa7, 0x9e, 0x1e, 0x81, 0x60, 0x5e, 0x4d, 0x76, 0xfe, 0x8d, 0x20, 0x02, 0xcd, 0xf9, + 0xc5, 0xa8, 0x0c, 0x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 0x48, 0xaa, 0x04, 0xa1, 0x0a, 0x93, + 0x30, 0x14, 0x4c, 0x4a, 0x7b, 0xa5, 0x6b, 0xb8, 0xab, 0x81, 0x5d, 0x20, 0x83, 0x82, 0xe8, 0x57, + 0xc0, 0x41, 0xa9, 0x5b, 0xaf, 0x50, 0x87, 0x42, 0x9a, 0x32, 0xaa, 0x40, 0xcc, 0x47, 0xaf, 0x96, + 0xd1, 0x53, 0xe2, 0x7e, 0x74, 0x1f, 0x39, 0x4c, 0xd0, 0xfd, 0x17, 0x98, 0xe6, 0x52, 0x41, 0x78, + 0x39, 0xef, 0x80, 0xb4, 0xc3, 0x8e, 0xa6, 0xfa, 0x25, 0x74, 0xdf, 0xe4, 0x00, 0xfd, 0x0f, 0xb9, + 0x1a, 0x42, 0x9e, 0x86, 0x45, 0x59, 0x24, 0x8d, 0x59, 0x98, 0x27, 0x0c, 0xf3, 0x54, 0x31, 0x71, + 0x41, 0x12, 0xbb, 0xa5, 0x0f, 0xaf, 0x53, 0x43, 0x83, 0xc9, 0x59, 0x85, 0x1c, 0x57, 0x44, 0x91, + 0xc7, 0x83, 0x16, 0x09, 0xc0, 0x88, 0xc4, 0x8c, 0x84, 0xf6, 0x9a, 0xf6, 0xd8, 0x99, 0xf7, 0x38, + 0xa9, 0x11, 0xeb, 0x3d, 0xda, 0x18, 0x92, 0x24, 0x01, 0x85, 0x55, 0x2c, 0x98, 0x8c, 0x21, 0x09, + 0xed, 0xf5, 0x22, 0xfd, 0x43, 0xef, 0xea, 0x66, 0xb7, 0xf1, 0xe3, 0x66, 0xf7, 0x59, 0xc4, 0x55, + 0x9c, 0x0f, 0x3d, 0x0a, 0x63, 0x9f, 0x82, 0x1c, 0x83, 0xac, 0x3e, 0x7b, 0x32, 0x1c, 0xf9, 0xea, + 0x32, 0x63, 0xd2, 0x3b, 0x62, 0x34, 0x68, 0x97, 0x3e, 0x83, 0xda, 0xc6, 0x3a, 0x47, 0xdb, 0x63, + 0x9e, 0xe2, 0xfa, 0x0e, 0xe3, 0x90, 0x25, 0x2c, 0xd2, 0x17, 0xcc, 0x6e, 0xff, 0xd5, 0x0e, 0x5b, + 0x63, 0x9e, 0xbe, 0xad, 0xdc, 0x8e, 0xa6, 0x66, 0xd6, 0x13, 0xd4, 0xe2, 0x12, 0xcb, 0x3c, 0xcb, + 0x40, 0x28, 0x16, 0xda, 0x1b, 0x5d, 0xc3, 0x5d, 0x09, 0x4c, 0x2e, 0xcf, 0xea, 0xa5, 0xde, 0xd7, + 0x05, 0xb4, 0x5e, 0x47, 0x56, 0x8d, 0xf2, 0x14, 0x2d, 0xe9, 0xc6, 0xd0, 0x0d, 0x60, 0xee, 0xaf, + 0x79, 0x55, 0xdb, 0xea, 0x66, 0x0a, 0x4a, 0xed, 0xc1, 0xea, 0x34, 0x1f, 0xbd, 0x3a, 0x8b, 0x8f, + 0x59, 0x9d, 0xa5, 0xb9, 0xea, 0x1c, 0x1e, 0x5f, 0xdd, 0x3a, 0xc6, 0xf5, 0xad, 0x63, 0xfc, 0xbc, + 0x75, 0x8c, 0x2f, 0x77, 0x4e, 0xe3, 0xfa, 0xce, 0x69, 0x7c, 0xbf, 0x73, 0x1a, 0x1f, 0xfc, 0x99, + 0xbd, 0x8b, 0x6e, 0xda, 0xd3, 0x65, 0xf1, 0xeb, 0xf7, 0xc9, 0x9f, 0x4c, 0xdf, 0xc1, 0x32, 0x91, + 0xe1, 0xb2, 0x7e, 0xf5, 0x5e, 0xfe, 0x0a, 0x00, 0x00, 0xff, 0xff, 0x11, 0x93, 0x41, 0x3e, 0x73, + 0x05, 0x00, 0x00, } func (m *ChainParamsList) Marshal() (dAtA []byte, err error) { @@ -684,97 +530,6 @@ func (m *ObserverParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *Admin_Policy) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Admin_Policy) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Admin_Policy) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Address) > 0 { - i -= len(m.Address) - copy(dAtA[i:], m.Address) - i = encodeVarintParams(dAtA, i, uint64(len(m.Address))) - i-- - dAtA[i] = 0x12 - } - if m.PolicyType != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.PolicyType)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil -} - -func (m *Params) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *Params) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.BallotMaturityBlocks != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.BallotMaturityBlocks)) - i-- - dAtA[i] = 0x18 - } - if len(m.AdminPolicy) > 0 { - for iNdEx := len(m.AdminPolicy) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AdminPolicy[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x12 - } - } - if len(m.ObserverParams) > 0 { - for iNdEx := len(m.ObserverParams) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ObserverParams[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintParams(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - } - } - return len(dAtA) - i, nil -} - func encodeVarintParams(dAtA []byte, offset int, v uint64) int { offset -= sovParams(v) base := offset @@ -873,46 +628,6 @@ func (m *ObserverParams) Size() (n int) { return n } -func (m *Admin_Policy) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.PolicyType != 0 { - n += 1 + sovParams(uint64(m.PolicyType)) - } - l = len(m.Address) - if l > 0 { - n += 1 + l + sovParams(uint64(l)) - } - return n -} - -func (m *Params) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ObserverParams) > 0 { - for _, e := range m.ObserverParams { - l = e.Size() - n += 1 + l + sovParams(uint64(l)) - } - } - if len(m.AdminPolicy) > 0 { - for _, e := range m.AdminPolicy { - l = e.Size() - n += 1 + l + sovParams(uint64(l)) - } - } - if m.BallotMaturityBlocks != 0 { - n += 1 + sovParams(uint64(m.BallotMaturityBlocks)) - } - return n -} - func sovParams(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -1563,244 +1278,6 @@ func (m *ObserverParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *Admin_Policy) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Admin_Policy: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Admin_Policy: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field PolicyType", wireType) - } - m.PolicyType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.PolicyType |= Policy_Type(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Address", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - stringLen |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Address = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Params) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: Params: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ObserverParams", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ObserverParams = append(m.ObserverParams, &ObserverParams{}) - if err := m.ObserverParams[len(m.ObserverParams)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AdminPolicy", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.AdminPolicy = append(m.AdminPolicy, &Admin_Policy{}) - if err := m.AdminPolicy[len(m.AdminPolicy)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field BallotMaturityBlocks", wireType) - } - m.BallotMaturityBlocks = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.BallotMaturityBlocks |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipParams(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthParams - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func skipParams(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/observer/types/params_test.go b/x/observer/types/params_test.go deleted file mode 100644 index 3b7b177565..0000000000 --- a/x/observer/types/params_test.go +++ /dev/null @@ -1,74 +0,0 @@ -package types - -import ( - "reflect" - "testing" - - sdk "github.com/cosmos/cosmos-sdk/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/stretchr/testify/require" - "gopkg.in/yaml.v2" -) - -func TestParamKeyTable(t *testing.T) { - kt := ParamKeyTable() - - ps := Params{} - for _, psp := range ps.ParamSetPairs() { - require.PanicsWithValue(t, "duplicate parameter key", func() { - kt.RegisterType(psp) - }) - } -} - -func TestParamSetPairs(t *testing.T) { - params := DefaultParams() - pairs := params.ParamSetPairs() - - require.Equal(t, 3, len(pairs), "The number of param set pairs should match the expected count") - - assertParamSetPair(t, pairs, KeyPrefix(ObserverParamsKey), ¶ms.ObserverParams, validateVotingThresholds) - assertParamSetPair(t, pairs, KeyPrefix(AdminPolicyParamsKey), ¶ms.AdminPolicy, validateAdminPolicy) - assertParamSetPair(t, pairs, KeyPrefix(BallotMaturityBlocksParamsKey), ¶ms.BallotMaturityBlocks, validateBallotMaturityBlocks) -} - -func assertParamSetPair(t *testing.T, pairs paramtypes.ParamSetPairs, key []byte, expectedValue interface{}, valFunc paramtypes.ValueValidatorFn) { - for _, pair := range pairs { - if string(pair.Key) == string(key) { - require.Equal(t, expectedValue, pair.Value, "Value does not match for key %s", string(key)) - - actualValFunc := pair.ValidatorFn - require.Equal(t, reflect.ValueOf(valFunc).Pointer(), reflect.ValueOf(actualValFunc).Pointer(), "Val func doesnt match for key %s", string(key)) - return - } - } - - t.Errorf("Key %s not found in ParamSetPairs", string(key)) -} - -func TestParamsString(t *testing.T) { - params := DefaultParams() - out, err := yaml.Marshal(params) - require.NoError(t, err) - require.Equal(t, string(out), params.String()) -} - -func TestValidateVotingThresholds(t *testing.T) { - require.Error(t, validateVotingThresholds("invalid")) - - params := DefaultParams() - require.NoError(t, validateVotingThresholds(params.ObserverParams)) - - params.ObserverParams[0].BallotThreshold = sdk.MustNewDecFromStr("1.1") - require.Error(t, validateVotingThresholds(params.ObserverParams)) -} - -func TestValidateAdminPolicy(t *testing.T) { - require.Error(t, validateAdminPolicy("invalid")) - require.NoError(t, validateAdminPolicy([]*Admin_Policy{})) -} - -func TestValidateBallotMaturityBlocks(t *testing.T) { - require.Error(t, validateBallotMaturityBlocks("invalid")) - require.NoError(t, validateBallotMaturityBlocks(int64(1))) -} diff --git a/x/observer/types/query.pb.go b/x/observer/types/query.pb.go index e27bba6c4e..d75cfd9831 100644 --- a/x/observer/types/query.pb.go +++ b/x/observer/types/query.pb.go @@ -785,88 +785,6 @@ func (m *QueryTssHistoryResponse) GetPagination() *query.PageResponse { return nil } -type QueryParamsRequest struct { -} - -func (m *QueryParamsRequest) Reset() { *m = QueryParamsRequest{} } -func (m *QueryParamsRequest) String() string { return proto.CompactTextString(m) } -func (*QueryParamsRequest) ProtoMessage() {} -func (*QueryParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{16} -} -func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsRequest.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsRequest.Merge(m, src) -} -func (m *QueryParamsRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsRequest proto.InternalMessageInfo - -// QueryParamsResponse is response type for the Query/Params RPC method. -type QueryParamsResponse struct { - // params holds all the parameters of this module. - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` -} - -func (m *QueryParamsResponse) Reset() { *m = QueryParamsResponse{} } -func (m *QueryParamsResponse) String() string { return proto.CompactTextString(m) } -func (*QueryParamsResponse) ProtoMessage() {} -func (*QueryParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{17} -} -func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryParamsResponse.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalToSizedBuffer(b) - if err != nil { - return nil, err - } - return b[:n], nil - } -} -func (m *QueryParamsResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryParamsResponse.Merge(m, src) -} -func (m *QueryParamsResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryParamsResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryParamsResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryParamsResponse proto.InternalMessageInfo - -func (m *QueryParamsResponse) GetParams() Params { - if m != nil { - return m.Params - } - return Params{} -} - type QueryHasVotedRequest struct { BallotIdentifier string `protobuf:"bytes,1,opt,name=ballot_identifier,json=ballotIdentifier,proto3" json:"ballot_identifier,omitempty"` VoterAddress string `protobuf:"bytes,2,opt,name=voter_address,json=voterAddress,proto3" json:"voter_address,omitempty"` @@ -876,7 +794,7 @@ func (m *QueryHasVotedRequest) Reset() { *m = QueryHasVotedRequest{} } func (m *QueryHasVotedRequest) String() string { return proto.CompactTextString(m) } func (*QueryHasVotedRequest) ProtoMessage() {} func (*QueryHasVotedRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{18} + return fileDescriptor_dcb801e455adaee4, []int{16} } func (m *QueryHasVotedRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -927,7 +845,7 @@ func (m *QueryHasVotedResponse) Reset() { *m = QueryHasVotedResponse{} } func (m *QueryHasVotedResponse) String() string { return proto.CompactTextString(m) } func (*QueryHasVotedResponse) ProtoMessage() {} func (*QueryHasVotedResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{19} + return fileDescriptor_dcb801e455adaee4, []int{17} } func (m *QueryHasVotedResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -971,7 +889,7 @@ func (m *QueryBallotByIdentifierRequest) Reset() { *m = QueryBallotByIde func (m *QueryBallotByIdentifierRequest) String() string { return proto.CompactTextString(m) } func (*QueryBallotByIdentifierRequest) ProtoMessage() {} func (*QueryBallotByIdentifierRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{20} + return fileDescriptor_dcb801e455adaee4, []int{18} } func (m *QueryBallotByIdentifierRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1016,7 +934,7 @@ func (m *VoterList) Reset() { *m = VoterList{} } func (m *VoterList) String() string { return proto.CompactTextString(m) } func (*VoterList) ProtoMessage() {} func (*VoterList) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{21} + return fileDescriptor_dcb801e455adaee4, []int{19} } func (m *VoterList) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1070,7 +988,7 @@ func (m *QueryBallotByIdentifierResponse) Reset() { *m = QueryBallotById func (m *QueryBallotByIdentifierResponse) String() string { return proto.CompactTextString(m) } func (*QueryBallotByIdentifierResponse) ProtoMessage() {} func (*QueryBallotByIdentifierResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{22} + return fileDescriptor_dcb801e455adaee4, []int{20} } func (m *QueryBallotByIdentifierResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1134,7 +1052,7 @@ func (m *QueryObserverSet) Reset() { *m = QueryObserverSet{} } func (m *QueryObserverSet) String() string { return proto.CompactTextString(m) } func (*QueryObserverSet) ProtoMessage() {} func (*QueryObserverSet) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{23} + return fileDescriptor_dcb801e455adaee4, []int{21} } func (m *QueryObserverSet) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1171,7 +1089,7 @@ func (m *QueryObserverSetResponse) Reset() { *m = QueryObserverSetRespon func (m *QueryObserverSetResponse) String() string { return proto.CompactTextString(m) } func (*QueryObserverSetResponse) ProtoMessage() {} func (*QueryObserverSetResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{24} + return fileDescriptor_dcb801e455adaee4, []int{22} } func (m *QueryObserverSetResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1214,7 +1132,7 @@ func (m *QuerySupportedChains) Reset() { *m = QuerySupportedChains{} } func (m *QuerySupportedChains) String() string { return proto.CompactTextString(m) } func (*QuerySupportedChains) ProtoMessage() {} func (*QuerySupportedChains) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{25} + return fileDescriptor_dcb801e455adaee4, []int{23} } func (m *QuerySupportedChains) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1251,7 +1169,7 @@ func (m *QuerySupportedChainsResponse) Reset() { *m = QuerySupportedChai func (m *QuerySupportedChainsResponse) String() string { return proto.CompactTextString(m) } func (*QuerySupportedChainsResponse) ProtoMessage() {} func (*QuerySupportedChainsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{26} + return fileDescriptor_dcb801e455adaee4, []int{24} } func (m *QuerySupportedChainsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1295,7 +1213,7 @@ func (m *QueryGetChainParamsForChainRequest) Reset() { *m = QueryGetChai func (m *QueryGetChainParamsForChainRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetChainParamsForChainRequest) ProtoMessage() {} func (*QueryGetChainParamsForChainRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{27} + return fileDescriptor_dcb801e455adaee4, []int{25} } func (m *QueryGetChainParamsForChainRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1339,7 +1257,7 @@ func (m *QueryGetChainParamsForChainResponse) Reset() { *m = QueryGetCha func (m *QueryGetChainParamsForChainResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetChainParamsForChainResponse) ProtoMessage() {} func (*QueryGetChainParamsForChainResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{28} + return fileDescriptor_dcb801e455adaee4, []int{26} } func (m *QueryGetChainParamsForChainResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1382,7 +1300,7 @@ func (m *QueryGetChainParamsRequest) Reset() { *m = QueryGetChainParamsR func (m *QueryGetChainParamsRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetChainParamsRequest) ProtoMessage() {} func (*QueryGetChainParamsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{29} + return fileDescriptor_dcb801e455adaee4, []int{27} } func (m *QueryGetChainParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1419,7 +1337,7 @@ func (m *QueryGetChainParamsResponse) Reset() { *m = QueryGetChainParams func (m *QueryGetChainParamsResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetChainParamsResponse) ProtoMessage() {} func (*QueryGetChainParamsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{30} + return fileDescriptor_dcb801e455adaee4, []int{28} } func (m *QueryGetChainParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1463,7 +1381,7 @@ func (m *QueryGetNodeAccountRequest) Reset() { *m = QueryGetNodeAccountR func (m *QueryGetNodeAccountRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetNodeAccountRequest) ProtoMessage() {} func (*QueryGetNodeAccountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{31} + return fileDescriptor_dcb801e455adaee4, []int{29} } func (m *QueryGetNodeAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1507,7 +1425,7 @@ func (m *QueryGetNodeAccountResponse) Reset() { *m = QueryGetNodeAccount func (m *QueryGetNodeAccountResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetNodeAccountResponse) ProtoMessage() {} func (*QueryGetNodeAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{32} + return fileDescriptor_dcb801e455adaee4, []int{30} } func (m *QueryGetNodeAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1551,7 +1469,7 @@ func (m *QueryAllNodeAccountRequest) Reset() { *m = QueryAllNodeAccountR func (m *QueryAllNodeAccountRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllNodeAccountRequest) ProtoMessage() {} func (*QueryAllNodeAccountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{33} + return fileDescriptor_dcb801e455adaee4, []int{31} } func (m *QueryAllNodeAccountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1596,7 +1514,7 @@ func (m *QueryAllNodeAccountResponse) Reset() { *m = QueryAllNodeAccount func (m *QueryAllNodeAccountResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllNodeAccountResponse) ProtoMessage() {} func (*QueryAllNodeAccountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{34} + return fileDescriptor_dcb801e455adaee4, []int{32} } func (m *QueryAllNodeAccountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1646,7 +1564,7 @@ func (m *QueryGetCrosschainFlagsRequest) Reset() { *m = QueryGetCrosscha func (m *QueryGetCrosschainFlagsRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetCrosschainFlagsRequest) ProtoMessage() {} func (*QueryGetCrosschainFlagsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{35} + return fileDescriptor_dcb801e455adaee4, []int{33} } func (m *QueryGetCrosschainFlagsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1683,7 +1601,7 @@ func (m *QueryGetCrosschainFlagsResponse) Reset() { *m = QueryGetCrossch func (m *QueryGetCrosschainFlagsResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetCrosschainFlagsResponse) ProtoMessage() {} func (*QueryGetCrosschainFlagsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{36} + return fileDescriptor_dcb801e455adaee4, []int{34} } func (m *QueryGetCrosschainFlagsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1726,7 +1644,7 @@ func (m *QueryGetKeygenRequest) Reset() { *m = QueryGetKeygenRequest{} } func (m *QueryGetKeygenRequest) String() string { return proto.CompactTextString(m) } func (*QueryGetKeygenRequest) ProtoMessage() {} func (*QueryGetKeygenRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{37} + return fileDescriptor_dcb801e455adaee4, []int{35} } func (m *QueryGetKeygenRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1763,7 +1681,7 @@ func (m *QueryGetKeygenResponse) Reset() { *m = QueryGetKeygenResponse{} func (m *QueryGetKeygenResponse) String() string { return proto.CompactTextString(m) } func (*QueryGetKeygenResponse) ProtoMessage() {} func (*QueryGetKeygenResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{38} + return fileDescriptor_dcb801e455adaee4, []int{36} } func (m *QueryGetKeygenResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1806,7 +1724,7 @@ func (m *QueryShowObserverCountRequest) Reset() { *m = QueryShowObserver func (m *QueryShowObserverCountRequest) String() string { return proto.CompactTextString(m) } func (*QueryShowObserverCountRequest) ProtoMessage() {} func (*QueryShowObserverCountRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{39} + return fileDescriptor_dcb801e455adaee4, []int{37} } func (m *QueryShowObserverCountRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1843,7 +1761,7 @@ func (m *QueryShowObserverCountResponse) Reset() { *m = QueryShowObserve func (m *QueryShowObserverCountResponse) String() string { return proto.CompactTextString(m) } func (*QueryShowObserverCountResponse) ProtoMessage() {} func (*QueryShowObserverCountResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{40} + return fileDescriptor_dcb801e455adaee4, []int{38} } func (m *QueryShowObserverCountResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1887,7 +1805,7 @@ func (m *QueryBlameByIdentifierRequest) Reset() { *m = QueryBlameByIdent func (m *QueryBlameByIdentifierRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlameByIdentifierRequest) ProtoMessage() {} func (*QueryBlameByIdentifierRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{41} + return fileDescriptor_dcb801e455adaee4, []int{39} } func (m *QueryBlameByIdentifierRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1931,7 +1849,7 @@ func (m *QueryBlameByIdentifierResponse) Reset() { *m = QueryBlameByIden func (m *QueryBlameByIdentifierResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlameByIdentifierResponse) ProtoMessage() {} func (*QueryBlameByIdentifierResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{42} + return fileDescriptor_dcb801e455adaee4, []int{40} } func (m *QueryBlameByIdentifierResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -1975,7 +1893,7 @@ func (m *QueryAllBlameRecordsRequest) Reset() { *m = QueryAllBlameRecord func (m *QueryAllBlameRecordsRequest) String() string { return proto.CompactTextString(m) } func (*QueryAllBlameRecordsRequest) ProtoMessage() {} func (*QueryAllBlameRecordsRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{43} + return fileDescriptor_dcb801e455adaee4, []int{41} } func (m *QueryAllBlameRecordsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2020,7 +1938,7 @@ func (m *QueryAllBlameRecordsResponse) Reset() { *m = QueryAllBlameRecor func (m *QueryAllBlameRecordsResponse) String() string { return proto.CompactTextString(m) } func (*QueryAllBlameRecordsResponse) ProtoMessage() {} func (*QueryAllBlameRecordsResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{44} + return fileDescriptor_dcb801e455adaee4, []int{42} } func (m *QueryAllBlameRecordsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2072,7 +1990,7 @@ func (m *QueryBlameByChainAndNonceRequest) Reset() { *m = QueryBlameByCh func (m *QueryBlameByChainAndNonceRequest) String() string { return proto.CompactTextString(m) } func (*QueryBlameByChainAndNonceRequest) ProtoMessage() {} func (*QueryBlameByChainAndNonceRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{45} + return fileDescriptor_dcb801e455adaee4, []int{43} } func (m *QueryBlameByChainAndNonceRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2123,7 +2041,7 @@ func (m *QueryBlameByChainAndNonceResponse) Reset() { *m = QueryBlameByC func (m *QueryBlameByChainAndNonceResponse) String() string { return proto.CompactTextString(m) } func (*QueryBlameByChainAndNonceResponse) ProtoMessage() {} func (*QueryBlameByChainAndNonceResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_dcb801e455adaee4, []int{46} + return fileDescriptor_dcb801e455adaee4, []int{44} } func (m *QueryBlameByChainAndNonceResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -2176,8 +2094,6 @@ func init() { proto.RegisterType((*QueryGetTssAddressByFinalizedHeightResponse)(nil), "zetachain.zetacore.observer.QueryGetTssAddressByFinalizedHeightResponse") proto.RegisterType((*QueryTssHistoryRequest)(nil), "zetachain.zetacore.observer.QueryTssHistoryRequest") proto.RegisterType((*QueryTssHistoryResponse)(nil), "zetachain.zetacore.observer.QueryTssHistoryResponse") - proto.RegisterType((*QueryParamsRequest)(nil), "zetachain.zetacore.observer.QueryParamsRequest") - proto.RegisterType((*QueryParamsResponse)(nil), "zetachain.zetacore.observer.QueryParamsResponse") proto.RegisterType((*QueryHasVotedRequest)(nil), "zetachain.zetacore.observer.QueryHasVotedRequest") proto.RegisterType((*QueryHasVotedResponse)(nil), "zetachain.zetacore.observer.QueryHasVotedResponse") proto.RegisterType((*QueryBallotByIdentifierRequest)(nil), "zetachain.zetacore.observer.QueryBallotByIdentifierRequest") @@ -2212,142 +2128,140 @@ func init() { func init() { proto.RegisterFile("observer/query.proto", fileDescriptor_dcb801e455adaee4) } var fileDescriptor_dcb801e455adaee4 = []byte{ - // 2157 bytes of a gzipped FileDescriptorProto + // 2113 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x5a, 0xcd, 0x6f, 0x1b, 0xc7, - 0x15, 0xf7, 0x4a, 0x89, 0x22, 0x8d, 0xac, 0x0f, 0x8f, 0xe5, 0x8f, 0x50, 0x36, 0x25, 0x8f, 0xe2, - 0x58, 0x56, 0x6c, 0x6e, 0x2c, 0x27, 0xf5, 0x57, 0x1c, 0x5b, 0x74, 0x6d, 0xc9, 0x4e, 0x6a, 0x3b, - 0xa4, 0xda, 0x14, 0x46, 0x5b, 0x76, 0x49, 0x0e, 0xc9, 0x6d, 0xa8, 0x1d, 0x66, 0x67, 0xa4, 0x84, - 0x51, 0x05, 0x14, 0x3d, 0xe6, 0x14, 0xb4, 0x40, 0x7b, 0x2b, 0x7a, 0xe9, 0xb1, 0x40, 0x11, 0xa0, - 0x68, 0x81, 0xa2, 0x87, 0x9c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xfd, 0x2e, 0x40, 0x72, 0x1b, 0xcf, 0x1f, 0x08, 0x68, 0x57, 0x25, 0xed, 0x1f, - 0xe0, 0x27, 0x3a, 0xb4, 0x2b, 0x2d, 0x79, 0xb3, 0x60, 0xd7, 0xac, 0xb6, 0xb9, 0x9b, 0x7a, 0x03, - 0xb3, 0x97, 0x96, 0x99, 0x4f, 0x0d, 0x79, 0x43, 0xa5, 0x73, 0xd6, 0x89, 0x5d, 0x78, 0xe9, 0x9c, - 0x75, 0xe2, 0x77, 0x61, 0x64, 0x51, 0xd2, 0xc9, 0xe1, 0x93, 0xa9, 0x74, 0x3c, 0x10, 0xbf, 0x35, - 0x10, 0x0a, 0xef, 0x48, 0xb0, 0xc6, 0xa6, 0xd0, 0x73, 0x69, 0x93, 0x7b, 0x63, 0x38, 0x27, 0xc0, - 0x76, 0x4e, 0x62, 0x3b, 0x83, 0x17, 0x52, 0xb1, 0x89, 0x10, 0xd3, 0x1f, 0x0d, 0x34, 0x1b, 0xbb, - 0x24, 0xf4, 0x74, 0x85, 0xde, 0xa2, 0x93, 0x76, 0x2d, 0x9c, 0xbb, 0xbe, 0x1f, 0x57, 0x00, 0xbd, - 0x22, 0x41, 0xbf, 0x82, 0x49, 0xfa, 0xe1, 0x31, 0x76, 0x77, 0xfb, 0x77, 0x03, 0xcd, 0xa5, 0xdd, - 0x97, 0xea, 0xac, 0x53, 0x19, 0xd7, 0xb4, 0x3a, 0xeb, 0x54, 0xd6, 0x35, 0x2d, 0x79, 0x53, 0x72, - 0x30, 0xf1, 0xc5, 0xc1, 0x1c, 0x12, 0x32, 0x3a, 0x76, 0x8d, 0x3f, 0x84, 0x86, 0x8e, 0xe7, 0xff, - 0xea, 0xf0, 0x8e, 0x5a, 0x8a, 0xb4, 0x16, 0x7a, 0xc4, 0x14, 0x69, 0x24, 0x92, 0xbe, 0x22, 0xdd, - 0x1f, 0xee, 0xf4, 0xff, 0xa1, 0x18, 0xa0, 0x48, 0x23, 0xb8, 0x8b, 0x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cd, + 0x19, 0xd9, 0xdd, 0x91, 0xec, 0x6e, 0x92, 0x1b, 0xa9, 0xec, 0x90, 0x52, 0xad, 0x17, 0x61, 0x95, + 0x46, 0x94, 0xfc, 0x5a, 0x83, 0xa9, 0x88, 0xec, 0x22, 0x17, 0x86, 0x83, 0x8a, 0x74, 0xd7, 0xdf, + 0x1c, 0xa9, 0x7b, 0x00, 0xfe, 0x9c, 0x04, 0xbf, 0x4c, 0x4e, 0xa7, 0x82, 0x0f, 0x96, 0x45, 0x4e, + 0x05, 0xf9, 0x9d, 0x06, 0xb3, 0x09, 0x15, 0x97, 0xa7, 0x80, 0x12, 0x2e, 0xfa, 0xd5, 0x91, 0x5d, + 0x02, 0xb0, 0xe7, 0x25, 0xd8, 0x57, 0xc9, 0x2b, 0xa9, 0x60, 0x79, 0x02, 0xdb, 0x7f, 0x34, 0x38, + 0x96, 0xae, 0xf6, 0xc8, 0xcd, 0xe1, 0x18, 0x32, 0x85, 0xa6, 0x7e, 0x6b, 0xef, 0x01, 0x90, 0x4b, + 0x49, 0x72, 0x79, 0x8b, 0x5c, 0x4b, 0xe5, 0xd2, 0xa2, 0xa2, 0x1a, 0x55, 0x7f, 0xd5, 0x26, 0x73, + 0x95, 0xc1, 0xdc, 0xf1, 0x57, 0x98, 0x5d, 0xf2, 0x99, 0x06, 0x33, 0xf1, 0x61, 0xc8, 0xe5, 0x51, + 0x81, 0xf9, 0x8c, 0xae, 0x8c, 0xee, 0x88, 0x4c, 0x2e, 0x48, 0x26, 0x67, 0xc9, 0x99, 0x5c, 0x4c, + 0x3c, 0xd0, 0x31, 0x91, 0x94, 0x0f, 0x71, 0xbf, 0x22, 0xcc, 0x89, 0x38, 0x45, 0xe3, 0x19, 0xaf, + 0x4b, 0xc4, 0xab, 0x64, 0x25, 0x15, 0x71, 0x44, 0x93, 0x9a, 0x3b, 0x52, 0x06, 0xef, 0x7a, 0xb5, + 0x3f, 0x13, 0x89, 0xb4, 0xde, 0xe9, 0xe4, 0xc1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 0x32, 0x4f, 0x57, 0xe4, 0x5b, 0x74, 0xd2, 0xee, 0x44, 0xf5, 0x6b, 0x7b, + 0x71, 0x45, 0xd0, 0xab, 0x12, 0xf4, 0x2b, 0xc4, 0x48, 0x05, 0x1d, 0xbf, 0xb8, 0xfc, 0x9b, 0x06, + 0xf3, 0x69, 0x97, 0x85, 0x79, 0xd6, 0xa9, 0x8c, 0x3b, 0xca, 0x3c, 0xeb, 0x54, 0xd6, 0x1d, 0xa5, + 0xf1, 0xa6, 0xe4, 0x60, 0x92, 0x0b, 0xc3, 0x39, 0x24, 0x64, 0x74, 0xec, 0x0e, 0x7b, 0x04, 0x0d, + 0x1d, 0xcf, 0xff, 0x95, 0xd1, 0x1d, 0x73, 0x29, 0xd2, 0x7a, 0xe8, 0x11, 0x53, 0xa4, 0x91, 0x48, + 0xf9, 0x15, 0xe9, 0xde, 0x70, 0xa7, 0xff, 0x03, 0xc1, 0x10, 0x45, 0x1a, 0xc1, 0x5d, 0xba, 0xf7, + 0xc5, 0xb3, 0x82, 0xf6, 0xe5, 0xb3, 0x82, 0xf6, 0xd5, 0xb3, 0x82, 0xf6, 0xf3, 0xe7, 0x85, 0x03, + 0x5f, 0x3e, 0x2f, 0x1c, 0xf8, 0xd7, 0xf3, 0xc2, 0x81, 0xc7, 0x66, 0xcb, 0x16, 0xed, 0xed, 0x5a, + 0xb1, 0xce, 0x9e, 0xa4, 0xea, 0x98, 0x8f, 0x23, 0x73, 0xa7, 0xd7, 0xa5, 0xbc, 0x36, 0x2e, 0xff, + 0xcf, 0xe3, 0xd2, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0xaf, 0x40, 0xfd, 0x0d, 0xb0, 0x23, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -2362,8 +2276,6 @@ const _ = grpc.SupportPackageIsVersion4 // // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type QueryClient interface { - // Parameters queries the parameters of the module. - Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) // Query if a voter has voted for a ballot HasVoted(ctx context.Context, in *QueryHasVotedRequest, opts ...grpc.CallOption) (*QueryHasVotedResponse, error) // Queries a list of VoterByIdentifier items. @@ -2412,15 +2324,6 @@ func NewQueryClient(cc grpc1.ClientConn) QueryClient { return &queryClient{cc} } -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/Params", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) HasVoted(ctx context.Context, in *QueryHasVotedRequest, opts ...grpc.CallOption) (*QueryHasVotedResponse, error) { out := new(QueryHasVotedResponse) err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Query/HasVoted", in, out, opts...) @@ -2621,8 +2524,6 @@ func (c *queryClient) ChainNoncesAll(ctx context.Context, in *QueryAllChainNonce // QueryServer is the server API for Query service. type QueryServer interface { - // Parameters queries the parameters of the module. - Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) // Query if a voter has voted for a ballot HasVoted(context.Context, *QueryHasVotedRequest) (*QueryHasVotedResponse, error) // Queries a list of VoterByIdentifier items. @@ -2667,9 +2568,6 @@ type QueryServer interface { type UnimplementedQueryServer struct { } -func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") -} func (*UnimplementedQueryServer) HasVoted(ctx context.Context, req *QueryHasVotedRequest) (*QueryHasVotedResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method HasVoted not implemented") } @@ -2741,24 +2639,6 @@ func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) } -func _Query_Params_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryParamsRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).Params(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/zetachain.zetacore.observer.Query/Params", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).Params(ctx, req.(*QueryParamsRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_HasVoted_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryHasVotedRequest) if err := dec(in); err != nil { @@ -3159,10 +3039,6 @@ var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.observer.Query", HandlerType: (*QueryServer)(nil), Methods: []grpc.MethodDesc{ - { - MethodName: "Params", - Handler: _Query_Params_Handler, - }, { MethodName: "HasVoted", Handler: _Query_HasVoted_Handler, @@ -3823,62 +3699,6 @@ func (m *QueryTssHistoryResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err - } - return dAtA[:n], nil -} - -func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa - return len(dAtA) - i, nil -} - func (m *QueryHasVotedRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -5079,26 +4899,6 @@ func (m *QueryTssHistoryResponse) Size() (n int) { return n } -func (m *QueryParamsRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryParamsResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.Params.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - func (m *QueryHasVotedRequest) Size() (n int) { if m == nil { return 0 @@ -6946,139 +6746,6 @@ func (m *QueryTssHistoryResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryParamsRequest) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *QueryParamsResponse) Unmarshal(dAtA []byte) error { - l := len(dAtA) - iNdEx := 0 - for iNdEx < l { - preIndex := iNdEx - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - fieldNum := int32(wire >> 3) - wireType := int(wire & 0x7) - if wireType == 4 { - return fmt.Errorf("proto: QueryParamsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthQuery - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthQuery - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} func (m *QueryHasVotedRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 diff --git a/x/observer/types/query.pb.gw.go b/x/observer/types/query.pb.gw.go index a99816daa0..7057ad2066 100644 --- a/x/observer/types/query.pb.gw.go +++ b/x/observer/types/query.pb.gw.go @@ -33,24 +33,6 @@ var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage var _ = metadata.Join -func request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := client.Params(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryParamsRequest - var metadata runtime.ServerMetadata - - msg, err := server.Params(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_HasVoted_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryHasVotedRequest var metadata runtime.ServerMetadata @@ -969,29 +951,6 @@ func local_request_Query_ChainNoncesAll_0(ctx context.Context, marshaler runtime // Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - var stream runtime.ServerTransportStream - ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := local_request_Query_Params_0(rctx, inboundMarshaler, server, req, pathParams) - md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_HasVoted_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -1539,26 +1498,6 @@ func RegisterQueryHandler(ctx context.Context, mux *runtime.ServeMux, conn *grpc // "QueryClient" to call the correct interceptors. func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, client QueryClient) error { - mux.Handle("GET", pattern_Query_Params_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { - ctx, cancel := context.WithCancel(req.Context()) - defer cancel() - inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) - rctx, err := runtime.AnnotateContext(ctx, mux, req) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - resp, md, err := request_Query_Params_0(rctx, inboundMarshaler, client, req, pathParams) - ctx = runtime.NewServerMetadataContext(ctx, md) - if err != nil { - runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) - return - } - - forward_Query_Params_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_HasVoted_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -2003,8 +1942,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "observer", "params"}, "", runtime.AssumeColonVerbOpt(false))) - pattern_Query_HasVoted_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3, 1, 0, 4, 1, 5, 4}, []string{"zeta-chain", "observer", "has_voted", "ballot_identifier", "voter_address"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_BallotByIdentifier_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2, 1, 0, 4, 1, 5, 3}, []string{"zeta-chain", "observer", "ballot_by_identifier", "ballot_identifier"}, "", runtime.AssumeColonVerbOpt(false))) @@ -2051,8 +1988,6 @@ var ( ) var ( - forward_Query_Params_0 = runtime.ForwardResponseMessage - forward_Query_HasVoted_0 = runtime.ForwardResponseMessage forward_Query_BallotByIdentifier_0 = runtime.ForwardResponseMessage