diff --git a/.golangci.yml b/.golangci.yml index 1f0cef93..c05e64aa 100644 --- a/.golangci.yml +++ b/.golangci.yml @@ -34,10 +34,3 @@ linters: linters-settings: nolintlint: allow-leading-space: true - -issues: - exclude-rules: - - path: x/scheduler/client/cli/tx_hook - text: "SA1019: cli.FlagDescription is deprecated: only used for v1beta1 legacy proposals." - - path: x/scheduler/client/cli/tx_hook - text: "SA1019: cli.FlagProposal is deprecated: only used for v1beta1 legacy proposals." diff --git a/.tool-versions b/.tool-versions index 698a7d2a..9264d463 100644 --- a/.tool-versions +++ b/.tool-versions @@ -1 +1 @@ -golang 1.21.8 \ No newline at end of file +golang 1.21.8 diff --git a/Makefile b/Makefile index 5725af3f..3403c3e1 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,7 @@ #!/usr/bin/make -f +.PHONY: proto + VERSION := $(shell echo $(shell git describe --tags) | sed 's/^v//') COMMIT := $(shell git log -1 --format='%H') @@ -43,7 +45,7 @@ build_tags_comma_sep := $(subst $(whitespace),$(comma),$(build_tags)) # process linker flags ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=kujira \ - -X github.com/cosmos/cosmos-sdk/version.ServerName=kujirad \ + -X github.com/cosmos/cosmos-sdk/version.AppName=kujirad \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ -X "github.com/cosmos/cosmos-sdk/version.BuildTags=$(build_tags_comma_sep)" diff --git a/app/ante.go b/app/ante.go index 9dcc1d18..f446bf95 100644 --- a/app/ante.go +++ b/app/ante.go @@ -1,13 +1,13 @@ package app import ( + "cosmossdk.io/core/store" "cosmossdk.io/errors" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/x/auth/ante" - ibcante "github.com/cosmos/ibc-go/v7/modules/core/ante" - "github.com/cosmos/ibc-go/v7/modules/core/keeper" + ibcante "github.com/cosmos/ibc-go/v8/modules/core/ante" + "github.com/cosmos/ibc-go/v8/modules/core/keeper" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmTypes "github.com/CosmWasm/wasmd/x/wasm/types" @@ -18,9 +18,9 @@ import ( type HandlerOptions struct { ante.HandlerOptions - IBCKeeper *keeper.Keeper - WasmConfig *wasmTypes.WasmConfig - TXCounterStoreKey storetypes.StoreKey + IBCKeeper *keeper.Keeper + WasmConfig *wasmTypes.WasmConfig + TXCounterStoreService store.KVStoreService } func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { @@ -36,8 +36,8 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { if options.WasmConfig == nil { return nil, errors.Wrap(sdkerrors.ErrLogic, "wasm config is required for ante builder") } - if options.TXCounterStoreKey == nil { - return nil, errors.Wrap(sdkerrors.ErrLogic, "tx counter key is required for ante builder") + if options.TXCounterStoreService == nil { + return nil, errors.Wrap(sdkerrors.ErrLogic, "tx counter store service is required for ante builder") } sigGasConsumer := options.SigGasConsumer @@ -48,7 +48,7 @@ func NewAnteHandler(options HandlerOptions) (sdk.AnteHandler, error) { anteDecorators := []sdk.AnteDecorator{ ante.NewSetUpContextDecorator(), // outermost AnteDecorator. SetUpContext must be called first wasmkeeper.NewLimitSimulationGasDecorator(options.WasmConfig.SimulationGasLimit), // after setup context to enforce limits early - wasmkeeper.NewCountTXDecorator(options.TXCounterStoreKey), + wasmkeeper.NewCountTXDecorator(options.TXCounterStoreService), // ante.NewExtensionOptionsDecorator(), ante.NewValidateBasicDecorator(), ante.NewTxTimeoutHeightDecorator(), diff --git a/app/app.go b/app/app.go index c824bb31..6e226e7c 100644 --- a/app/app.go +++ b/app/app.go @@ -8,23 +8,42 @@ import ( "os" "path/filepath" + appparams "github.com/Team-Kujira/core/app/params" + + "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" + "github.com/cosmos/gogoproto/proto" + + "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/log" + "cosmossdk.io/x/evidence" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + feegrantmodule "cosmossdk.io/x/feegrant/module" + "cosmossdk.io/x/tx/signing" + kujiracryptocodec "github.com/Team-Kujira/core/crypto/codec" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" - "github.com/cosmos/cosmos-sdk/client/grpc/tmservice" "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" "github.com/cosmos/cosmos-sdk/codec/types" "github.com/cosmos/cosmos-sdk/runtime" + runtimeservices "github.com/cosmos/cosmos-sdk/runtime/services" "github.com/cosmos/cosmos-sdk/server" "github.com/cosmos/cosmos-sdk/server/api" "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/mempool" "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" "github.com/cosmos/cosmos-sdk/x/auth" "github.com/cosmos/cosmos-sdk/x/auth/ante" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" "github.com/cosmos/cosmos-sdk/x/auth/posthandler" authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" @@ -35,10 +54,9 @@ import ( "github.com/cosmos/cosmos-sdk/x/authz" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - "github.com/cosmos/cosmos-sdk/x/capability" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" "github.com/cosmos/cosmos-sdk/x/consensus" consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" @@ -48,12 +66,6 @@ import ( distr "github.com/cosmos/cosmos-sdk/x/distribution" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - "github.com/cosmos/cosmos-sdk/x/evidence" - evidencekeeper "github.com/cosmos/cosmos-sdk/x/evidence/keeper" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" - "github.com/cosmos/cosmos-sdk/x/feegrant" - feegrantkeeper "github.com/cosmos/cosmos-sdk/x/feegrant/keeper" - feegrantmodule "github.com/cosmos/cosmos-sdk/x/feegrant/module" "github.com/cosmos/cosmos-sdk/x/genutil" genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" "github.com/cosmos/cosmos-sdk/x/gov" @@ -75,63 +87,56 @@ import ( "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - "github.com/cosmos/cosmos-sdk/x/upgrade" - bank "github.com/terra-money/alliance/custom/bank" - bankkeeper "github.com/terra-money/alliance/custom/bank/keeper" - alliancemodule "github.com/terra-money/alliance/x/alliance" - alliancemoduleclient "github.com/terra-money/alliance/x/alliance/client" - alliancemodulekeeper "github.com/terra-money/alliance/x/alliance/keeper" - alliancemoduletypes "github.com/terra-money/alliance/x/alliance/types" - - upgradeclient "github.com/cosmos/cosmos-sdk/x/upgrade/client" - upgradekeeper "github.com/cosmos/cosmos-sdk/x/upgrade/keeper" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + "github.com/cosmos/ibc-go/modules/capability" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + + "cosmossdk.io/x/upgrade" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" + + ica "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" + icacontroller "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahost "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host" + icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + transfer "github.com/cosmos/ibc-go/v8/modules/apps/transfer" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcporttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ibcwasm "github.com/cosmos/ibc-go/modules/light-clients/08-wasm" ibcwasmkeeper "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/keeper" ibcwasmtypes "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/types" - ica "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts" - icacontroller "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icahost "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host" - icahostkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/keeper" - icahosttypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/host/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - ibcfee "github.com/cosmos/ibc-go/v7/modules/apps/29-fee" - ibcfeekeeper "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/keeper" - ibcfeetypes "github.com/cosmos/ibc-go/v7/modules/apps/29-fee/types" - transfer "github.com/cosmos/ibc-go/v7/modules/apps/transfer" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - ibc "github.com/cosmos/ibc-go/v7/modules/core" - ibcclient "github.com/cosmos/ibc-go/v7/modules/core/02-client" - ibcclientclient "github.com/cosmos/ibc-go/v7/modules/core/02-client/client" - ibcclienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - ibcporttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - ibctm "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" - - dbm "github.com/cometbft/cometbft-db" + abci "github.com/cometbft/cometbft/abci/types" tmjson "github.com/cometbft/cometbft/libs/json" - "github.com/cometbft/cometbft/libs/log" tmos "github.com/cometbft/cometbft/libs/os" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" "github.com/spf13/cast" "github.com/CosmWasm/wasmd/x/wasm" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - wasmvm "github.com/CosmWasm/wasmvm" + wasmvm "github.com/CosmWasm/wasmvm/v2" "github.com/Team-Kujira/core/app/openapiconsole" - appparams "github.com/Team-Kujira/core/app/params" "github.com/Team-Kujira/core/wasmbinding" "github.com/Team-Kujira/core/x/denom" denomkeeper "github.com/Team-Kujira/core/x/denom/keeper" denomtypes "github.com/Team-Kujira/core/x/denom/types" + "github.com/cosmos/cosmos-sdk/std" "github.com/Team-Kujira/core/x/batch" batchkeeper "github.com/Team-Kujira/core/x/batch/keeper" @@ -139,114 +144,45 @@ import ( "github.com/Team-Kujira/core/docs" scheduler "github.com/Team-Kujira/core/x/scheduler" - schedulerclient "github.com/Team-Kujira/core/x/scheduler/client" schedulerkeeper "github.com/Team-Kujira/core/x/scheduler/keeper" schedulertypes "github.com/Team-Kujira/core/x/scheduler/types" "github.com/Team-Kujira/core/x/oracle" + oracleabci "github.com/Team-Kujira/core/x/oracle/abci" oraclekeeper "github.com/Team-Kujira/core/x/oracle/keeper" oracletypes "github.com/Team-Kujira/core/x/oracle/types" + storetypes "cosmossdk.io/store/types" cwica "github.com/Team-Kujira/core/x/cw-ica" cwicakeeper "github.com/Team-Kujira/core/x/cw-ica/keeper" cwicatypes "github.com/Team-Kujira/core/x/cw-ica/types" - - storetypes "github.com/cosmos/cosmos-sdk/store/types" ) const ( - AccountAddressPrefix = "kujira" - Name = "kujira" - // Either the SDK or some combination of the creation of the alliance module - // in 0.8.0 means that deleting the module leaves remenants at the original store key, - // preventing a re-add at the same key. - // This puts the module storage under a new key, meaning we can bypass the faulty removal - // of the old module store - // N.B don't use the original! - AllianceStoreKey = "alliance2" + Name = "kujira" ) -func getGovProposalHandlers() []govclient.ProposalHandler { - var govProposalHandlers []govclient.ProposalHandler - - govProposalHandlers = append(govProposalHandlers, - schedulerclient.CreateHookProposalHandler, - schedulerclient.UpdateHookProposalHandler, - schedulerclient.DeleteHookProposalHandler, - paramsclient.ProposalHandler, - upgradeclient.LegacyProposalHandler, - upgradeclient.LegacyCancelProposalHandler, - ibcclientclient.UpdateClientProposalHandler, - ibcclientclient.UpgradeProposalHandler, - - alliancemoduleclient.CreateAllianceProposalHandler, - alliancemoduleclient.UpdateAllianceProposalHandler, - alliancemoduleclient.DeleteAllianceProposalHandler, - ) - - return govProposalHandlers -} - var ( // DefaultNodeHome default home directories for the application daemon DefaultNodeHome string - // ModuleBasics defines the module BasicManager is in charge of setting up basic, - // non-dependant module elements, such as codec registration - // and genesis verification. - ModuleBasics = module.NewBasicManager( - auth.AppModuleBasic{}, - genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - authzmodule.AppModuleBasic{}, - bank.AppModule{}, - capability.AppModuleBasic{}, - staking.AppModuleBasic{}, - mint.AppModuleBasic{}, - distr.AppModuleBasic{}, - gov.NewAppModuleBasic(getGovProposalHandlers()), - params.AppModuleBasic{}, - consensus.AppModuleBasic{}, - crisis.AppModuleBasic{}, - slashing.AppModuleBasic{}, - feegrantmodule.AppModuleBasic{}, - ibc.AppModuleBasic{}, - ibctm.AppModuleBasic{}, - ibcwasm.AppModuleBasic{}, - - upgrade.AppModuleBasic{}, - evidence.AppModuleBasic{}, - transfer.AppModuleBasic{}, - vesting.AppModuleBasic{}, - wasm.AppModuleBasic{}, - ica.AppModuleBasic{}, - ibcfee.AppModuleBasic{}, - denom.AppModuleBasic{}, - batch.AppModuleBasic{}, - scheduler.AppModuleBasic{}, - oracle.AppModuleBasic{}, - alliancemodule.AppModuleBasic{}, - cwica.AppModuleBasic{}, - ) - // module account permissions maccPerms = map[string][]string{ - authtypes.FeeCollectorName: nil, - distrtypes.ModuleName: nil, - minttypes.ModuleName: {authtypes.Minter}, - stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, - stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, - govtypes.ModuleName: {authtypes.Burner}, - ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - ibcfeetypes.ModuleName: nil, - icatypes.ModuleName: nil, - wasmtypes.ModuleName: {authtypes.Burner}, - denomtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - batchtypes.ModuleName: nil, - schedulertypes.ModuleName: nil, - oracletypes.ModuleName: nil, - alliancemoduletypes.ModuleName: {authtypes.Minter, authtypes.Burner}, - alliancemoduletypes.RewardsPoolName: nil, - cwicatypes.ModuleName: nil, + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibcfeetypes.ModuleName: nil, + icatypes.ModuleName: nil, + wasmtypes.ModuleName: {authtypes.Burner}, + denomtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + batchtypes.ModuleName: nil, + schedulertypes.ModuleName: nil, + oracletypes.ModuleName: nil, + cwicatypes.ModuleName: nil, } ) @@ -270,7 +206,7 @@ func init() { type App struct { *baseapp.BaseApp - cdc *codec.LegacyAmino + legacyAmino *codec.LegacyAmino appCodec codec.Codec txConfig client.TxConfig interfaceRegistry types.InterfaceRegistry @@ -307,7 +243,6 @@ type App struct { BatchKeeper batchkeeper.Keeper SchedulerKeeper schedulerkeeper.Keeper OracleKeeper oraclekeeper.Keeper - AllianceKeeper alliancemodulekeeper.Keeper CwICAKeeper cwicakeeper.Keeper WasmClientKeeper ibcwasmkeeper.Keeper @@ -321,7 +256,8 @@ type App struct { ScopedCwICAKeeper capabilitykeeper.ScopedKeeper // ModuleManager is the module manager - ModuleManager *module.Manager + ModuleManager *module.Manager + BasicModuleManager module.BasicManager // sm is the simulation manager sm *module.SimulationManager @@ -336,16 +272,32 @@ func New( db dbm.DB, traceStore io.Writer, loadLatest bool, - encodingConfig appparams.EncodingConfig, appOpts servertypes.AppOptions, wasmOpts []wasmkeeper.Option, baseAppOptions ...func(*baseapp.BaseApp), ) *App { - appCodec := encodingConfig.Codec - cdc := encodingConfig.Amino - interfaceRegistry := encodingConfig.InterfaceRegistry + baseAppOptions = append(baseAppOptions, baseapp.SetOptimisticExecution()) + + interfaceRegistry, _ := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: signing.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: appparams.Bech32Prefix, + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: appparams.Bech32PrefixValAddr, + }, + }, + }) + appCodec := codec.NewProtoCodec(interfaceRegistry) + legacyAmino := codec.NewLegacyAmino() + txConfig := authtx.NewTxConfig(appCodec, authtx.DefaultSignModes) authority := authtypes.NewModuleAddress(govtypes.ModuleName).String() - txConfig := encodingConfig.TxConfig + + std.RegisterLegacyAminoCodec(legacyAmino) + std.RegisterInterfaces(interfaceRegistry) + kujiracryptocodec.RegisterCrypto(legacyAmino) + kujiracryptocodec.RegisterInterfaces(interfaceRegistry) bApp := baseapp.NewBaseApp(Name, logger, db, txConfig.TxDecoder(), baseAppOptions...) bApp.SetCommitMultiStoreTracer(traceStore) @@ -353,7 +305,7 @@ func New( bApp.SetInterfaceRegistry(interfaceRegistry) bApp.SetTxEncoder(txConfig.TxEncoder()) - keys := sdk.NewKVStoreKeys( + keys := storetypes.NewKVStoreKeys( authtypes.StoreKey, banktypes.StoreKey, stakingtypes.StoreKey, @@ -381,16 +333,20 @@ func New( schedulertypes.StoreKey, oracletypes.StoreKey, batchtypes.StoreKey, - AllianceStoreKey, cwicatypes.StoreKey, ) - tkeys := sdk.NewTransientStoreKeys(paramstypes.TStoreKey) - memKeys := sdk.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) + // register streaming services + if err := bApp.RegisterStreamingServices(appOpts, keys); err != nil { + panic(err) + } + + tkeys := storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) + memKeys := storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) app := &App{ BaseApp: bApp, - cdc: cdc, + legacyAmino: legacyAmino, appCodec: appCodec, txConfig: txConfig, interfaceRegistry: interfaceRegistry, @@ -401,16 +357,17 @@ func New( app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) - app.ParamsKeeper = initParamsKeeper(appCodec, cdc, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) + app.ParamsKeeper = initParamsKeeper(appCodec, legacyAmino, keys[paramstypes.StoreKey], tkeys[paramstypes.TStoreKey]) // set the BaseApp's parameter store app.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( appCodec, - keys[consensusparamtypes.StoreKey], + runtime.NewKVStoreService(keys[consensusparamtypes.StoreKey]), authority, + runtime.EventService{}, ) - bApp.SetParamStore(&app.ConsensusParamsKeeper) + bApp.SetParamStore(&app.ConsensusParamsKeeper.ParamsStore) // add capability keeper and ScopeToModule for ibc module app.CapabilityKeeper = capabilitykeeper.NewKeeper( @@ -426,15 +383,16 @@ func New( // add keepers app.AccountKeeper = authkeeper.NewAccountKeeper( appCodec, - keys[authtypes.StoreKey], + runtime.NewKVStoreService(keys[authtypes.StoreKey]), authtypes.ProtoBaseAccount, maccPerms, - AccountAddressPrefix, + authcodec.NewBech32Codec(appparams.Bech32Prefix), + appparams.Bech32Prefix, authority, ) app.AuthzKeeper = authzkeeper.NewKeeper( - keys[authzkeeper.StoreKey], + runtime.NewKVStoreService(keys[authzkeeper.StoreKey]), appCodec, app.MsgServiceRouter(), app.AccountKeeper, @@ -442,23 +400,26 @@ func New( app.BankKeeper = bankkeeper.NewBaseKeeper( appCodec, - keys[banktypes.StoreKey], + runtime.NewKVStoreService(keys[banktypes.StoreKey]), app.AccountKeeper, BlockedAddresses(), authority, + logger, ) app.StakingKeeper = stakingkeeper.NewKeeper( appCodec, - keys[stakingtypes.StoreKey], + runtime.NewKVStoreService(keys[stakingtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, authority, + authcodec.NewBech32Codec(appparams.Bech32PrefixValAddr), + authcodec.NewBech32Codec(appparams.Bech32PrefixConsAddr), ) app.MintKeeper = mintkeeper.NewKeeper( appCodec, - keys[minttypes.StoreKey], + runtime.NewKVStoreService(keys[minttypes.StoreKey]), app.StakingKeeper, app.AccountKeeper, app.BankKeeper, @@ -468,7 +429,7 @@ func New( app.DistrKeeper = distrkeeper.NewKeeper( appCodec, - keys[distrtypes.StoreKey], + runtime.NewKVStoreService(keys[distrtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, @@ -476,23 +437,10 @@ func New( authority, ) - app.AllianceKeeper = alliancemodulekeeper.NewKeeper( - appCodec, - keys[AllianceStoreKey], - app.AccountKeeper, - app.BankKeeper, - app.StakingKeeper, - app.DistrKeeper, - authtypes.FeeCollectorName, - authority, - ) - - app.BankKeeper.RegisterKeepers(app.AllianceKeeper, app.StakingKeeper) - app.SlashingKeeper = slashingkeeper.NewKeeper( appCodec, - cdc, - keys[slashingtypes.StoreKey], + legacyAmino, + runtime.NewKVStoreService(keys[slashingtypes.StoreKey]), app.StakingKeeper, authority, ) @@ -500,16 +448,17 @@ func New( invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) app.CrisisKeeper = crisiskeeper.NewKeeper( appCodec, - keys[crisistypes.StoreKey], + runtime.NewKVStoreService(keys[crisistypes.StoreKey]), invCheckPeriod, app.BankKeeper, authtypes.FeeCollectorName, authority, + app.AccountKeeper.AddressCodec(), ) app.FeeGrantKeeper = feegrantkeeper.NewKeeper( appCodec, - keys[feegrant.StoreKey], + runtime.NewKVStoreService(keys[feegrant.StoreKey]), app.AccountKeeper, ) @@ -521,7 +470,7 @@ func New( homePath := cast.ToString(appOpts.Get(flags.FlagHome)) app.UpgradeKeeper = upgradekeeper.NewKeeper( skipUpgradeHeights, - keys[upgradetypes.StoreKey], + runtime.NewKVStoreService(keys[upgradetypes.StoreKey]), appCodec, homePath, app.BaseApp, @@ -530,8 +479,9 @@ func New( // register the staking hooks app.StakingKeeper.SetHooks( - stakingtypes.NewMultiStakingHooks(app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks(), - app.AllianceKeeper.StakingHooks()), + stakingtypes.NewMultiStakingHooks( + app.DistrKeeper.Hooks(), app.SlashingKeeper.Hooks(), + ), ) // ... other modules keepers @@ -544,6 +494,7 @@ func New( app.StakingKeeper, app.UpgradeKeeper, scopedIBCKeeper, + authority, ) // IBC Fee Module keeper @@ -553,7 +504,7 @@ func New( keys[ibcfeetypes.StoreKey], app.IBCKeeper.ChannelKeeper, app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, ) @@ -567,10 +518,11 @@ func New( app.GetSubspace(icahosttypes.SubModuleName), app.IBCFeeKeeper, app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, scopedICAHostKeeper, app.MsgServiceRouter(), + authority, ) app.ICAHostKeeper.WithQueryRouter(app.GRPCQueryRouter()) @@ -581,9 +533,10 @@ func New( app.GetSubspace(icacontrollertypes.SubModuleName), app.IBCFeeKeeper, app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, scopedICAControllerKeeper, app.MsgServiceRouter(), + authority, ) icaModule := ica.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper) @@ -604,10 +557,11 @@ func New( app.GetSubspace(ibctransfertypes.ModuleName), app.IBCFeeKeeper, app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, scopedTransferKeeper, + authority, ) transferModule := transfer.NewAppModule(app.TransferKeeper) @@ -615,7 +569,7 @@ func New( app.SchedulerKeeper = schedulerkeeper.NewKeeper( appCodec, keys[denomtypes.StoreKey], - app.GetSubspace(schedulertypes.ModuleName), + authority, ) app.OracleKeeper = oraclekeeper.NewKeeper( @@ -628,11 +582,25 @@ func New( app.SlashingKeeper, app.StakingKeeper, distrtypes.ModuleName, + authority, ) + voteExtHandler := oracleabci.NewVoteExtHandler( + logger, + app.OracleKeeper, + ) + + oracleConfig, err := oracleabci.ReadOracleConfig(appOpts) + if err != nil { + panic(fmt.Sprintf("error while reading oracle config: %s", err)) + } + + bApp.SetExtendVoteHandler(voteExtHandler.ExtendVoteHandler(oracleConfig)) + bApp.SetVerifyVoteExtensionHandler(voteExtHandler.VerifyVoteExtensionHandler(oracleConfig)) + denomKeeper := denomkeeper.NewKeeper( appCodec, - app.keys[denomtypes.StoreKey], + keys[denomtypes.StoreKey], app.GetSubspace(denomtypes.ModuleName), app.AccountKeeper, app.BankKeeper.WithMintCoinsRestriction(denomtypes.NewdenomDenomMintCoinsRestriction()), @@ -659,7 +627,16 @@ func New( // The last arguments can contain custom message handlers, and custom query handlers, // if we want to allow any custom callbacks - availableCapabilities := "iterator,staking,stargate,cosmwasm_1_1,cosmwasm_1_2,cosmwasm_1_3,cosmwasm_1_4" + availableCapabilities := []string{ + "iterator", + "staking", + "stargate", + "cosmwasm_1_1", + "cosmwasm_1_2", + "cosmwasm_1_3", + "cosmwasm_1_4", + "cosmwasm_2_0", + } wasmer, err := wasmvm.NewVM( filepath.Join(wasmDir, "wasm"), @@ -688,14 +665,14 @@ func New( app.WasmKeeper = wasmkeeper.NewKeeper( appCodec, - keys[wasmtypes.StoreKey], + runtime.NewKVStoreService(keys[wasmtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, distrkeeper.NewQuerier(app.DistrKeeper), app.IBCFeeKeeper, app.IBCKeeper.ChannelKeeper, - &app.IBCKeeper.PortKeeper, + app.IBCKeeper.PortKeeper, scopedWasmKeeper, app.TransferKeeper, app.MsgServiceRouter(), @@ -713,30 +690,30 @@ func New( // See: https://docs.cosmos.network/main/modules/gov#proposal-messages govRouter := govtypesv1beta1.NewRouter() govRouter.AddRoute(govtypes.RouterKey, govtypesv1beta1.ProposalHandler). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). - AddRoute(upgradetypes.RouterKey, upgrade.NewSoftwareUpgradeProposalHandler(app.UpgradeKeeper)). - AddRoute(ibcclienttypes.RouterKey, ibcclient.NewClientProposalHandler(app.IBCKeeper.ClientKeeper)). - AddRoute(schedulertypes.RouterKey, schedulerkeeper.NewSchedulerProposalHandler(app.SchedulerKeeper)). - AddRoute(alliancemoduletypes.RouterKey, alliancemodule.NewAllianceProposalHandler(app.AllianceKeeper)) + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)) // Create evidence Keeper for to register the IBC light client misbehaviour evidence route evidenceKeeper := evidencekeeper.NewKeeper( appCodec, - keys[evidencetypes.StoreKey], + runtime.NewKVStoreService(keys[evidencetypes.StoreKey]), app.StakingKeeper, app.SlashingKeeper, + app.AccountKeeper.AddressCodec(), + runtime.ProvideCometInfoService(), ) // If evidence needs to be handled for the app, set routes in router here and seal app.EvidenceKeeper = *evidenceKeeper + govConfig := govtypes.DefaultConfig() govKeeper := govkeeper.NewKeeper( appCodec, - keys[govtypes.StoreKey], + runtime.NewKVStoreService(keys[govtypes.StoreKey]), app.AccountKeeper, app.BankKeeper, app.StakingKeeper, + app.DistrKeeper, app.MsgServiceRouter(), - govtypes.DefaultConfig(), + govConfig, authority, ) @@ -750,7 +727,7 @@ func New( app.WasmClientKeeper = ibcwasmkeeper.NewKeeperWithVM( appCodec, - keys[ibcwasmtypes.StoreKey], + runtime.NewKVStoreService(keys[ibcwasmtypes.StoreKey]), app.IBCKeeper.ClientKeeper, authority, wasmer, @@ -808,8 +785,8 @@ func New( genutil.NewAppModule( app.AccountKeeper, app.StakingKeeper, - app.BaseApp.DeliverTx, - encodingConfig.TxConfig, + app, + txConfig, ), auth.NewAppModule( @@ -876,6 +853,7 @@ func New( app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), + app.interfaceRegistry, ), distr.NewAppModule( @@ -895,9 +873,10 @@ func New( app.GetSubspace(stakingtypes.ModuleName), ), - upgrade.NewAppModule(app.UpgradeKeeper), + upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), evidence.NewAppModule(app.EvidenceKeeper), ibc.NewAppModule(app.IBCKeeper), + ibctm.NewAppModule(), params.NewAppModule(app.ParamsKeeper), transferModule, @@ -946,16 +925,6 @@ func New( app.BankKeeper, ), - alliancemodule.NewAppModule( - appCodec, - app.AllianceKeeper, - app.StakingKeeper, - app.AccountKeeper, - app.BankKeeper, - app.interfaceRegistry, - app.GetSubspace(alliancemoduletypes.ModuleName), - ), - cwica.NewAppModule(appCodec, app.CwICAKeeper), crisis.NewAppModule( @@ -967,12 +936,32 @@ func New( ibcwasm.NewAppModule(app.WasmClientKeeper), ) + // BasicModuleManager defines the module BasicManager is in charge of setting up basic, + // non-dependant module elements, such as codec registration and genesis verification. + // By default it is composed of all the module from the module manager. + // Additionally, app module basics can be overwritten by passing them as argument. + app.BasicModuleManager = module.NewBasicManagerFromManager( + app.ModuleManager, + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic( + []govclient.ProposalHandler{ + paramsclient.ProposalHandler, + }, + ), + }) + app.BasicModuleManager.RegisterLegacyAminoCodec(app.LegacyAmino()) + app.BasicModuleManager.RegisterInterfaces(interfaceRegistry) + + // NOTE: upgrade module is required to be prioritized + app.ModuleManager.SetOrderPreBlockers( + upgradetypes.ModuleName, + ) // During begin block slashing happens after distr.BeginBlocker so that // there is nothing left over in the validator fee pool, so as to keep the // CanWithdrawInvariant invariant. // NOTE: staking module is required if HistoricalEntries param > 0 app.ModuleManager.SetOrderBeginBlockers( - upgradetypes.ModuleName, capabilitytypes.ModuleName, minttypes.ModuleName, distrtypes.ModuleName, @@ -999,7 +988,6 @@ func New( batchtypes.ModuleName, schedulertypes.ModuleName, oracletypes.ModuleName, - alliancemoduletypes.ModuleName, cwicatypes.ModuleName, ibcwasmtypes.ModuleName, ) @@ -1032,7 +1020,6 @@ func New( batchtypes.ModuleName, schedulertypes.ModuleName, oracletypes.ModuleName, - alliancemoduletypes.ModuleName, cwicatypes.ModuleName, ibcwasmtypes.ModuleName, ) @@ -1072,13 +1059,15 @@ func New( batchtypes.ModuleName, schedulertypes.ModuleName, oracletypes.ModuleName, - alliancemoduletypes.ModuleName, wasmtypes.ModuleName, cwicatypes.ModuleName, ) app.ModuleManager.RegisterInvariants(app.CrisisKeeper) - app.ModuleManager.RegisterServices(app.configurator) + err = app.ModuleManager.RegisterServices(app.configurator) + if err != nil { + panic(err) + } // RegisterUpgradeHandlers is used for registering any on-chain upgrades. // Make sure it's called after `app.ModuleManager` and `app.configurator` are set. @@ -1110,9 +1099,9 @@ func New( SignModeHandler: txConfig.SignModeHandler(), SigGasConsumer: SigVerificationGasConsumer, }, - IBCKeeper: app.IBCKeeper, - WasmConfig: &wasmConfig, - TXCounterStoreKey: keys[wasmtypes.StoreKey], + IBCKeeper: app.IBCKeeper, + WasmConfig: &wasmConfig, + TXCounterStoreService: runtime.NewKVStoreService(keys[wasmtypes.StoreKey]), }, ) if err != nil { @@ -1124,6 +1113,20 @@ func New( app.SetBeginBlocker(app.BeginBlocker) app.SetEndBlocker(app.EndBlocker) + nonceMempool := mempool.NewSenderNonceMempool() + propHandler := oracleabci.NewProposalHandler( + logger, + app.OracleKeeper, + app.StakingKeeper, + app.ModuleManager, + nonceMempool, + bApp, + ) + bApp.SetMempool(nonceMempool) + bApp.SetPrepareProposal(propHandler.PrepareProposal()) + bApp.SetProcessProposal(propHandler.ProcessProposal()) + bApp.SetPreBlocker(propHandler.PreBlocker) + // must be before Loading version // requires the snapshot store to be created and registered as a BaseAppOption // see cmd/wasmd/root.go: 206 - 214 approx @@ -1200,7 +1203,6 @@ func BlockedAddresses() map[string]bool { // allow the following addresses to receive funds delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) - delete(modAccAddrs, authtypes.NewModuleAddress(alliancemoduletypes.ModuleName).String()) delete(modAccAddrs, authtypes.NewModuleAddress(authtypes.FeeCollectorName).String()) return modAccAddrs @@ -1212,14 +1214,22 @@ func (app *App) Name() string { return app.BaseApp.Name() } // GetBaseApp returns the base app of the application func (app App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } +// PreBlocker application updates every pre block +func (app *App) PreBlocker( + ctx sdk.Context, + _ *abci.RequestFinalizeBlock, +) (*sdk.ResponsePreBlock, error) { + return app.ModuleManager.PreBlock(ctx) +} + // BeginBlocker application updates every begin block -func (app *App) BeginBlocker(ctx sdk.Context, req abci.RequestBeginBlock) abci.ResponseBeginBlock { - return app.ModuleManager.BeginBlock(ctx, req) +func (app *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { + return app.ModuleManager.BeginBlock(ctx) } // EndBlocker application updates every end block -func (app *App) EndBlocker(ctx sdk.Context, req abci.RequestEndBlock) abci.ResponseEndBlock { - return app.ModuleManager.EndBlock(ctx, req) +func (app *App) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { + return app.ModuleManager.EndBlock(ctx) } func (app *App) Configurator() module.Configurator { @@ -1227,12 +1237,18 @@ func (app *App) Configurator() module.Configurator { } // InitChainer application update at chain initialization -func (app *App) InitChainer(ctx sdk.Context, req abci.RequestInitChain) abci.ResponseInitChain { +func (app *App) InitChainer( + ctx sdk.Context, + req *abci.RequestInitChain, +) (*abci.ResponseInitChain, error) { var genesisState GenesisState if err := tmjson.Unmarshal(req.AppStateBytes, &genesisState); err != nil { panic(err) } - app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) + if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()); err != nil { + panic(err) + } + return app.ModuleManager.InitGenesis(ctx, app.appCodec, genesisState) } @@ -1261,9 +1277,30 @@ func (app *App) TxConfig() client.TxConfig { return app.txConfig } +// AutoCliOpts returns the autocli options for the app. +func (app *App) AutoCliOpts() autocli.AppOptions { + modules := make(map[string]appmodule.AppModule, 0) + for _, m := range app.ModuleManager.Modules { + if moduleWithName, ok := m.(module.HasName); ok { + moduleName := moduleWithName.Name() + if appModule, ok := moduleWithName.(appmodule.AppModule); ok { + modules[moduleName] = appModule + } + } + } + + return autocli.AppOptions{ + Modules: modules, + ModuleOptions: runtimeservices.ExtractAutoCLIOptions(app.ModuleManager.Modules), + AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), + } +} + // DefaultGenesis returns a default genesis from the registered AppModuleBasic's. func (app *App) DefaultGenesis() map[string]json.RawMessage { - return ModuleBasics.DefaultGenesis(app.appCodec) + return app.BasicModuleManager.DefaultGenesis(app.appCodec) } // RegisterAPIRoutes registers all application module routes with the provided @@ -1274,9 +1311,9 @@ func (app *App) RegisterAPIRoutes(apiSvr *api.Server, _ config.APIConfig) { // Register new tx routes from grpc-gateway. authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // Register new tendermint queries routes from grpc-gateway. - tmservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + cmtservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) - ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + app.BasicModuleManager.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) // register app's OpenAPI routes. apiSvr.Router.Handle("/static/openapi.yml", http.FileServer(http.FS(docs.Docs))) @@ -1290,11 +1327,11 @@ func (app *App) RegisterTxService(clientCtx client.Context) { // RegisterTendermintService implements the Application.RegisterTendermintService method. func (app *App) RegisterTendermintService(clientCtx client.Context) { - tmservice.RegisterTendermintService(clientCtx, app.BaseApp.GRPCQueryRouter(), app.interfaceRegistry, app.Query) + cmtservice.RegisterTendermintService(clientCtx, app.BaseApp.GRPCQueryRouter(), app.interfaceRegistry, app.Query) } -func (app *App) RegisterNodeService(clientCtx client.Context) { - nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter()) +func (app *App) RegisterNodeService(clientCtx client.Context, cfg config.Config) { + nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg) } // GetMaccPerms returns a copy of the module account permissions @@ -1327,7 +1364,6 @@ func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino paramsKeeper.Subspace(schedulertypes.ModuleName) paramsKeeper.Subspace(oracletypes.ModuleName) paramsKeeper.Subspace(batchtypes.ModuleName) - paramsKeeper.Subspace(alliancemoduletypes.ModuleName) return paramsKeeper } diff --git a/app/encoding.go b/app/encoding.go deleted file mode 100644 index 967a4658..00000000 --- a/app/encoding.go +++ /dev/null @@ -1,19 +0,0 @@ -package app - -import ( - "github.com/Team-Kujira/core/app/params" - kujiracryptocodec "github.com/Team-Kujira/core/crypto/codec" - "github.com/cosmos/cosmos-sdk/std" -) - -// MakeEncodingConfig creates a new EncodingConfig with all modules registered -func MakeEncodingConfig() params.EncodingConfig { - encodingConfig := params.MakeEncodingConfig() - std.RegisterLegacyAminoCodec(encodingConfig.Amino) - std.RegisterInterfaces(encodingConfig.InterfaceRegistry) - kujiracryptocodec.RegisterCrypto(encodingConfig.Amino) - kujiracryptocodec.RegisterInterfaces(encodingConfig.InterfaceRegistry) - ModuleBasics.RegisterLegacyAminoCodec(encodingConfig.Amino) - ModuleBasics.RegisterInterfaces(encodingConfig.InterfaceRegistry) - return encodingConfig -} diff --git a/app/export.go b/app/export.go index a6513819..39081a59 100644 --- a/app/export.go +++ b/app/export.go @@ -2,10 +2,12 @@ package app import ( "encoding/json" + "fmt" "log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + storetypes "cosmossdk.io/store/types" servertypes "github.com/cosmos/cosmos-sdk/server/types" sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" @@ -21,7 +23,7 @@ func (app *App) ExportAppStateAndValidators( modulesToExport []string, ) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block - ctx := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctx := app.NewContextLegacy(true, tmproto.Header{Height: app.LastBlockHeight()}) // We export at last height + 1, because that's the height at which // Tendermint will start InitChain. @@ -31,7 +33,11 @@ func (app *App) ExportAppStateAndValidators( app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + genState, err := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + if err != nil { + return servertypes.ExportedApp{}, err + } + appState, err := json.MarshalIndent(genState, "", " ") if err != nil { return servertypes.ExportedApp{}, err @@ -74,21 +80,39 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str /* Handle fee distribution state. */ // withdraw all validator commission - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - _, err := app.DistrKeeper.WithdrawValidatorCommission(ctx, val.GetOperator()) + err := app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } + + _, err = app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz) if err != nil { panic(err) } return false }) + if err != nil { + panic(err) + } // withdraw all delegator rewards - dels := app.StakingKeeper.GetAllDelegations(ctx) + dels, err := app.StakingKeeper.GetAllDelegations(ctx) + if err != nil { + panic(err) + } + for _, delegation := range dels { - _, err := app.DistrKeeper.WithdrawDelegationRewards(ctx, delegation.GetDelegatorAddr(), delegation.GetValidatorAddr()) + valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { panic(err) } + + delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + + if _, err = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr); err != nil { + panic(err) + } } // clear validator slash events @@ -102,32 +126,50 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str ctx = ctx.WithBlockHeight(0) // reinitialize all validators - app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + if err != nil { + panic(err) + } // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) - feePool := app.DistrKeeper.GetFeePool(ctx) + scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz) + if err != nil { + panic(err) + } + feePool, err := app.DistrKeeper.FeePool.Get(ctx) + if err != nil { + panic(err) + } feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) - app.DistrKeeper.SetFeePool(ctx, feePool) + if err := app.DistrKeeper.FeePool.Set(ctx, feePool); err != nil { + panic(err) + } - err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) - return err != nil + if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, valBz); err != nil { + panic(err) + } + return false }) + if err != nil { + panic(err) + } // reinitialize all delegations for _, del := range dels { - err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, - del.GetDelegatorAddr(), - del.GetValidatorAddr(), - ) + valAddr, err := sdk.ValAddressFromBech32(del.ValidatorAddress) if err != nil { panic(err) } - err = app.DistrKeeper.Hooks().AfterDelegationModified(ctx, - del.GetDelegatorAddr(), - del.GetValidatorAddr(), - ) - if err != nil { - panic(err) + delAddr := sdk.MustAccAddressFromBech32(del.DelegatorAddress) + + if err := app.DistrKeeper.Hooks().BeforeDelegationCreated(ctx, delAddr, valAddr); err != nil { + // never called as BeforeDelegationCreated always returns nil + panic(fmt.Errorf("error while incrementing period: %w", err)) + } + + if err := app.DistrKeeper.Hooks().AfterDelegationModified(ctx, delAddr, valAddr); err != nil { + // never called as AfterDelegationModified always returns nil + panic(fmt.Errorf("error while creating a new delegation period record: %w", err)) } } @@ -137,33 +179,45 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str /* Handle staking state. */ // iterate through redelegations, reset creation height - app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { + err = app.StakingKeeper.IterateRedelegations(ctx, func(_ int64, red stakingtypes.Redelegation) (stop bool) { for i := range red.Entries { red.Entries[i].CreationHeight = 0 } - app.StakingKeeper.SetRedelegation(ctx, red) + err = app.StakingKeeper.SetRedelegation(ctx, red) + if err != nil { + panic(err) + } return false }) + if err != nil { + panic(err) + } // iterate through unbonding delegations, reset creation height - app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { + err = app.StakingKeeper.IterateUnbondingDelegations(ctx, func(_ int64, ubd stakingtypes.UnbondingDelegation) (stop bool) { for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } - app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + err := app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) + if err != nil { + panic(err) + } return false }) + if err != nil { + panic(err) + } // Iterate through validators by power descending, reset bond heights, and // update bond intra-tx counters. store := ctx.KVStore(app.keys[stakingtypes.StoreKey]) - iter := sdk.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) + iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) counter := int16(0) for ; iter.Valid(); iter.Next() { addr := sdk.ValAddress(iter.Key()[1:]) - validator, found := app.StakingKeeper.GetValidator(ctx, addr) - if !found { + validator, err := app.StakingKeeper.GetValidator(ctx, addr) + if err != nil { panic("expected validator, not found") } @@ -172,7 +226,10 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str validator.Jailed = true } - app.StakingKeeper.SetValidator(ctx, validator) + err = app.StakingKeeper.SetValidator(ctx, validator) + if err != nil { + panic(err) + } counter++ } @@ -185,12 +242,18 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str /* Handle slashing state. */ // reset start height on signing infos - app.SlashingKeeper.IterateValidatorSigningInfos( + err = app.SlashingKeeper.IterateValidatorSigningInfos( ctx, func(addr sdk.ConsAddress, info slashingtypes.ValidatorSigningInfo) (stop bool) { info.StartHeight = 0 - app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + err = app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info) + if err != nil { + panic(err) + } return false }, ) + if err != nil { + panic(err) + } } diff --git a/app/genesis.go b/app/genesis.go index 5bf0c1da..69e3fb36 100644 --- a/app/genesis.go +++ b/app/genesis.go @@ -2,8 +2,6 @@ package app import ( "encoding/json" - - "github.com/cosmos/cosmos-sdk/codec" ) // The genesis state of the blockchain is represented here as a map of raw json @@ -14,8 +12,3 @@ import ( // the ModuleBasicManager which populates json from each BasicModule // object provided to it during init. type GenesisState map[string]json.RawMessage - -// NewDefaultGenesisState generates the default state for the application. -func NewDefaultGenesisState(cdc codec.JSONCodec) GenesisState { - return ModuleBasics.DefaultGenesis(cdc) -} diff --git a/app/params/proto.go b/app/params/proto.go deleted file mode 100644 index 1855c435..00000000 --- a/app/params/proto.go +++ /dev/null @@ -1,22 +0,0 @@ -package params - -import ( - "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/x/auth/tx" -) - -// MakeEncodingConfig creates an EncodingConfig for an amino based test configuration. -func MakeEncodingConfig() EncodingConfig { - amino := codec.NewLegacyAmino() - interfaceRegistry := types.NewInterfaceRegistry() - codec := codec.NewProtoCodec(interfaceRegistry) - txCfg := tx.NewTxConfig(codec, tx.DefaultSignModes) - - return EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Codec: codec, - TxConfig: txCfg, - Amino: amino, - } -} diff --git a/app/sigverify.go b/app/sigverify.go index 7a1b4149..a1de2308 100644 --- a/app/sigverify.go +++ b/app/sigverify.go @@ -4,12 +4,12 @@ import ( "fmt" errorsmod "cosmossdk.io/errors" + storetypes "cosmossdk.io/store/types" authn "github.com/Team-Kujira/core/crypto/keys/authn" "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256r1" "github.com/cosmos/cosmos-sdk/crypto/types/multisig" - sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/cosmos/cosmos-sdk/x/auth/ante" @@ -20,7 +20,7 @@ import ( // for signature verification based upon the public key type. The cost is fetched from the given params and is matched // by the concrete type. func SigVerificationGasConsumer( - meter sdk.GasMeter, sig signing.SignatureV2, params authtypes.Params, + meter storetypes.GasMeter, sig signing.SignatureV2, params authtypes.Params, ) error { pubkey := sig.PubKey switch pubkey := pubkey.(type) { diff --git a/app/simulation_test.go b/app/simulation_test.go index 6a53e236..a5968f57 100644 --- a/app/simulation_test.go +++ b/app/simulation_test.go @@ -9,25 +9,22 @@ import ( "strings" "testing" - appparams "github.com/Team-Kujira/core/app/params" - dbm "github.com/cometbft/cometbft-db" + "cosmossdk.io/log" + "cosmossdk.io/store" + storetypes "cosmossdk.io/store/types" + evidencetypes "cosmossdk.io/x/evidence/types" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - evidencetypes "github.com/cosmos/cosmos-sdk/x/evidence/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" @@ -35,6 +32,7 @@ import ( simcli "github.com/cosmos/cosmos-sdk/x/simulation/client/cli" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" "github.com/stretchr/testify/require" "github.com/CosmWasm/wasmd/x/wasm" @@ -138,7 +136,6 @@ func TestAppImportExport(t *testing.T) { newDB, nil, true, - appparams.MakeEncodingConfig(), appOptions, emptyWasmOpts, fauxMerkleModeOpt, @@ -162,8 +159,8 @@ func TestAppImportExport(t *testing.T) { } }() - ctxA := app.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) - ctxB := newApp.NewContext(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctxA := app.NewContextLegacy(true, tmproto.Header{Height: app.LastBlockHeight()}) + ctxB := newApp.NewContextLegacy(true, tmproto.Header{Height: app.LastBlockHeight()}) newApp.ModuleManager.InitGenesis(ctxB, app.AppCodec(), genesisState) newApp.StoreConsensusParams(ctxB, exported.ConsensusParams) @@ -193,7 +190,7 @@ func TestAppImportExport(t *testing.T) { storeA := ctxA.KVStore(skp.A) storeB := ctxB.KVStore(skp.B) - failedKVAs, failedKVBs := sdk.DiffKVStores(storeA, storeB, skp.Prefixes) + failedKVAs, failedKVBs := simtestutil.DiffKVStores(storeA, storeB, skp.Prefixes) require.Equal(t, len(failedKVAs), len(failedKVBs), "unequal sets of key-values to compare") fmt.Printf("compared %d different key/value pairs between %s and %s\n", len(failedKVAs), skp.A, skp.B) @@ -251,7 +248,6 @@ func TestAppSimulationAfterImport(t *testing.T) { newDB, nil, true, - appparams.MakeEncodingConfig(), appOptions, emptyWasmOpts, fauxMerkleModeOpt, @@ -260,10 +256,11 @@ func TestAppSimulationAfterImport(t *testing.T) { require.Equal(t, "App", newApp.Name()) - newApp.InitChain(abci.RequestInitChain{ + _, err = newApp.InitChain(&abci.RequestInitChain{ ChainId: SimAppChainID, AppStateBytes: exported.AppState, }) + require.NoError(t, err) _, _, err = simulation.SimulateFromSeed( t, @@ -303,7 +300,6 @@ func setupSimulationApp(t *testing.T, msg string) (simtypes.Config, dbm.DB, simt db, nil, true, - appparams.MakeEncodingConfig(), appOptions, emptyWasmOpts, fauxMerkleModeOpt, @@ -341,7 +337,7 @@ func TestAppStateDeterminism(t *testing.T) { for j := 0; j < numTimesToRunPerSeed; j++ { var logger log.Logger if simcli.FlagVerboseValue { - logger = log.TestingLogger() + logger = log.NewTestLogger(t) } else { logger = log.NewNopLogger() } @@ -352,7 +348,6 @@ func TestAppStateDeterminism(t *testing.T) { db, nil, true, - appparams.MakeEncodingConfig(), appOptions, emptyWasmOpts, interBlockCacheOpt(), diff --git a/app/test_helpers.go b/app/test_helpers.go index 4082ff8e..228c472b 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -2,27 +2,23 @@ package app import ( "encoding/json" - "fmt" "os" "testing" - "time" + "cosmossdk.io/log" "cosmossdk.io/math" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - dbm "github.com/cometbft/cometbft-db" abci "github.com/cometbft/cometbft/abci/types" - "github.com/cometbft/cometbft/libs/log" - tmtypes "github.com/cometbft/cometbft/types" - "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" - cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + cmtjson "github.com/cometbft/cometbft/libs/json" + cmttypes "github.com/cometbft/cometbft/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" "github.com/cosmos/cosmos-sdk/testutil/mock" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/stretchr/testify/require" ) @@ -31,13 +27,13 @@ func Setup(t *testing.T, isCheckTx bool) *App { db := dbm.NewMemDB() var wasmOpts []wasmkeeper.Option appOptions := make(simtestutil.AppOptionsMap, 0) + appOptions[flags.FlagHome] = "/tmp/" + t.Name() app := New( log.NewNopLogger(), db, nil, true, - MakeEncodingConfig(), appOptions, wasmOpts, ) @@ -46,36 +42,43 @@ func Setup(t *testing.T, isCheckTx bool) *App { pubKey, err := privVal.GetPubKey() require.NoError(t, err) // create validator set with single validator - validator := tmtypes.NewValidator(pubKey, 1) - valSet := tmtypes.NewValidatorSet([]*tmtypes.Validator{validator}) + validator := cmttypes.NewValidator(pubKey, 1) + valSet := cmttypes.NewValidatorSet([]*cmttypes.Validator{validator}) // generate genesis account senderPrivKey := secp256k1.GenPrivKey() acc := authtypes.NewBaseAccount(senderPrivKey.PubKey().Address().Bytes(), senderPrivKey.PubKey(), 0, 0) balance := banktypes.Balance{ Address: acc.GetAddress().String(), - Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdk.NewInt(100000000000000))), + Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, math.NewInt(100000000000000))), } if !isCheckTx { - genesisState := NewDefaultGenesisState(app.AppCodec()) - genesisState, err = GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) + genesisState := app.DefaultGenesis() + genesisState, err = simtestutil.GenesisStateWithValSet( + app.AppCodec(), + genesisState, + valSet, + []authtypes.GenesisAccount{acc}, + balance, + ) if err != nil { panic(err) } - stateBytes, err := json.MarshalIndent(genesisState, "", " ") + stateBytes, err := cmtjson.MarshalIndent(genesisState, "", " ") if err != nil { panic(err) } - app.InitChain( - abci.RequestInitChain{ + _, err = app.InitChain( + &abci.RequestInitChain{ Validators: []abci.ValidatorUpdate{}, ConsensusParams: simtestutil.DefaultConsensusParams, AppStateBytes: stateBytes, }, ) + require.NoError(t, err) } return app @@ -97,24 +100,26 @@ func SetupTestingAppWithLevelDB(isCheckTx bool) (app *App, cleanupFn func()) { db, nil, true, - MakeEncodingConfig(), appOptions, wasmOpts, ) if !isCheckTx { - genesisState := NewDefaultGenesisState(app.AppCodec()) + genesisState := app.DefaultGenesis() stateBytes, err := json.MarshalIndent(genesisState, "", " ") if err != nil { panic(err) } - app.InitChain( - abci.RequestInitChain{ + _, err = app.InitChain( + &abci.RequestInitChain{ Validators: []abci.ValidatorUpdate{}, ConsensusParams: simtestutil.DefaultConsensusParams, AppStateBytes: stateBytes, }, ) + if err != nil { + panic(err) + } } cleanupFn = func() { @@ -127,72 +132,3 @@ func SetupTestingAppWithLevelDB(isCheckTx bool) (app *App, cleanupFn func()) { return app, cleanupFn } - -// GenesisStateWithValSet returns a new genesis state with the validator set -// copied from simtestutil with delegation not added to supply -func GenesisStateWithValSet( - codec codec.Codec, - genesisState map[string]json.RawMessage, - valSet *tmtypes.ValidatorSet, - genAccs []authtypes.GenesisAccount, - balances ...banktypes.Balance, -) (map[string]json.RawMessage, error) { - // set genesis accounts - authGenesis := authtypes.NewGenesisState(authtypes.DefaultParams(), genAccs) - genesisState[authtypes.ModuleName] = codec.MustMarshalJSON(authGenesis) - - validators := make([]stakingtypes.Validator, 0, len(valSet.Validators)) - delegations := make([]stakingtypes.Delegation, 0, len(valSet.Validators)) - - bondAmt := sdk.DefaultPowerReduction - - for _, val := range valSet.Validators { - pk, err := cryptocodec.FromTmPubKeyInterface(val.PubKey) - if err != nil { - return nil, fmt.Errorf("failed to convert pubkey: %w", err) - } - - pkAny, err := codectypes.NewAnyWithValue(pk) - if err != nil { - return nil, fmt.Errorf("failed to create new any: %w", err) - } - - validator := stakingtypes.Validator{ - OperatorAddress: sdk.ValAddress(val.Address).String(), - ConsensusPubkey: pkAny, - Jailed: false, - Status: stakingtypes.Bonded, - Tokens: bondAmt, - DelegatorShares: math.LegacyOneDec(), - Description: stakingtypes.Description{}, - UnbondingHeight: int64(0), - UnbondingTime: time.Unix(0, 0).UTC(), - Commission: stakingtypes.NewCommission(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()), - MinSelfDelegation: math.ZeroInt(), - } - validators = append(validators, validator) - delegations = append(delegations, stakingtypes.NewDelegation(genAccs[0].GetAddress(), val.Address.Bytes(), math.LegacyOneDec())) - } - - // set validators and delegations - stakingGenesis := stakingtypes.NewGenesisState(stakingtypes.DefaultParams(), validators, delegations) - genesisState[stakingtypes.ModuleName] = codec.MustMarshalJSON(stakingGenesis) - - // add bonded amount to bonded pool module account - balances = append(balances, banktypes.Balance{ - Address: authtypes.NewModuleAddress(stakingtypes.BondedPoolName).String(), - Coins: sdk.Coins{sdk.NewCoin(sdk.DefaultBondDenom, bondAmt.MulRaw(int64(len(valSet.Validators))))}, - }) - - totalSupply := sdk.NewCoins() - for _, b := range balances { - // add genesis acc tokens to total supply - totalSupply = totalSupply.Add(b.Coins...) - } - - // update total supply - bankGenesis := banktypes.NewGenesisState(banktypes.DefaultGenesisState().Params, balances, totalSupply, []banktypes.Metadata{}, []banktypes.SendEnabled{}) - genesisState[banktypes.ModuleName] = codec.MustMarshalJSON(bankGenesis) - println(string(genesisState[banktypes.ModuleName])) - return genesisState, nil -} diff --git a/app/testing.go b/app/testing.go index bd515546..c99282d7 100644 --- a/app/testing.go +++ b/app/testing.go @@ -1,13 +1,13 @@ package app import ( + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - ibctestingtypes "github.com/cosmos/ibc-go/v7/testing/types" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types" ) // GetKey returns the KVStoreKey for the provided store key. @@ -61,7 +61,7 @@ func (app *App) GetTxConfig() client.TxConfig { // NOTE: This is solely to be used for testing purposes as it may be desirable // for modules to register their own custom testing types. func (app *App) LegacyAmino() *codec.LegacyAmino { - return app.cdc + return app.legacyAmino } // AppCodec returns an app codec. diff --git a/app/upgrades.go b/app/upgrades.go index 57497ba5..48b8285e 100644 --- a/app/upgrades.go +++ b/app/upgrades.go @@ -1,20 +1,86 @@ package app import ( - sdk "github.com/cosmos/cosmos-sdk/types" + "context" + + storetypes "cosmossdk.io/store/types" + upgradetypes "cosmossdk.io/x/upgrade/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" "github.com/cosmos/cosmos-sdk/types/module" - upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icahosttypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ) -const UpgradeName = "v1.1.0" +const UpgradeName = "v2.0.0" func (app App) RegisterUpgradeHandlers() { + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() + if err != nil { + panic(err) + } + + var keyTable paramstypes.KeyTable + + // Set param key table for params module migration + for _, subspace := range app.ParamsKeeper.GetSubspaces() { + subspace := subspace + + switch subspace.Name() { + case ibcexported.ModuleName: + if !subspace.HasKeyTable() { + keyTable = ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + subspace.WithKeyTable(keyTable) + } + case icahosttypes.SubModuleName: + keyTable = icahosttypes.ParamKeyTable() + case icacontrollertypes.SubModuleName: + keyTable = icacontrollertypes.ParamKeyTable() + case ibctransfertypes.ModuleName: + keyTable = ibctransfertypes.ParamKeyTable() + default: + continue + } + + if !subspace.HasKeyTable() { + subspace.WithKeyTable(keyTable) + } + } + + if upgradeInfo.Name == UpgradeName && !app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + storeUpgrades := storetypes.StoreUpgrades{ + Deleted: []string{ + "alliance", "alliance2", + }, + } + + // configure store loader that checks if version == upgradeHeight and applies store upgrades + app.SetStoreLoader(upgradetypes.UpgradeStoreLoader(upgradeInfo.Height, &storeUpgrades)) + } + app.UpgradeKeeper.SetUpgradeHandler( UpgradeName, - func(ctx sdk.Context, - _ upgradetypes.Plan, + func(ctx context.Context, + plan upgradetypes.Plan, fromVM module.VersionMap, ) (module.VersionMap, error) { + params, err := app.ConsensusParamsKeeper.ParamsStore.Get(ctx) + if err != nil { + return fromVM, err + } + params.Abci = &tmproto.ABCIParams{ + VoteExtensionsEnableHeight: plan.Height + 1, + } + err = app.ConsensusParamsKeeper.ParamsStore.Set(ctx, params) + if err != nil { + return fromVM, err + } + return app.ModuleManager.RunMigrations(ctx, app.Configurator(), fromVM) }, ) diff --git a/cmd/kujirad/cmd/root.go b/cmd/kujirad/cmd/root.go index f4b7c990..793a6d43 100644 --- a/cmd/kujirad/cmd/root.go +++ b/cmd/kujirad/cmd/root.go @@ -9,14 +9,17 @@ import ( "github.com/prometheus/client_golang/prometheus" "github.com/spf13/cast" - rosettaCmd "cosmossdk.io/tools/rosetta/cmd" + "cosmossdk.io/log" + confixcmd "cosmossdk.io/tools/confix/cmd" + + // rosettaCmd "cosmossdk.io/tools/rosetta/cmd" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/Team-Kujira/core/app" "github.com/Team-Kujira/core/app/params" - dbm "github.com/cometbft/cometbft-db" + oracleabci "github.com/Team-Kujira/core/x/oracle/abci" tmcfg "github.com/cometbft/cometbft/config" tmcli "github.com/cometbft/cometbft/libs/cli" - "github.com/cometbft/cometbft/libs/log" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/config" "github.com/cosmos/cosmos-sdk/client/debug" @@ -24,22 +27,43 @@ import ( "github.com/cosmos/cosmos-sdk/client/keys" "github.com/cosmos/cosmos-sdk/client/pruning" "github.com/cosmos/cosmos-sdk/client/rpc" + "github.com/cosmos/cosmos-sdk/client/snapshot" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keyring" "github.com/cosmos/cosmos-sdk/server" serverconfig "github.com/cosmos/cosmos-sdk/server/config" servertypes "github.com/cosmos/cosmos-sdk/server/types" + simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/version" authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/cosmos/cosmos-sdk/x/crisis" genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" - ibcwasmcli "github.com/cosmos/ibc-go/modules/light-clients/08-wasm/client/cli" + rosettaCmd "github.com/cosmos/rosetta/cmd" "github.com/spf13/cobra" ) // NewRootCmd creates a new root command for wasmd. It is called once in the // main function. -func NewRootCmd() (*cobra.Command, params.EncodingConfig) { - encodingConfig := app.MakeEncodingConfig() +func NewRootCmd() *cobra.Command { + tempApp := app.New( + log.NewNopLogger(), + dbm.NewMemDB(), + nil, + true, + simtestutil.NewAppOptionsWithFlagHome(tempDir()), + []wasmkeeper.Option{}, + ) + + encodingConfig := params.EncodingConfig{ + InterfaceRegistry: tempApp.InterfaceRegistry(), + Codec: tempApp.AppCodec(), + TxConfig: tempApp.TxConfig(), + Amino: tempApp.LegacyAmino(), + } initClientCtx := client.Context{}. WithCodec(encodingConfig.Codec). @@ -80,9 +104,20 @@ func NewRootCmd() (*cobra.Command, params.EncodingConfig) { }, } - initRootCmd(rootCmd, encodingConfig) + initRootCmd(rootCmd, encodingConfig.TxConfig, encodingConfig.InterfaceRegistry, encodingConfig.Codec, tempApp.BasicModuleManager) + rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec)) + + // add keyring to autocli opts + autoCliOpts := tempApp.AutoCliOpts() + initClientCtx, _ = config.ReadFromClientConfig(initClientCtx) + autoCliOpts.Keyring, _ = keyring.NewAutoCLIKeyring(initClientCtx.Keyring) + autoCliOpts.ClientCtx = initClientCtx - return rootCmd, encodingConfig + if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { + panic(err) + } + + return rootCmd } // initTendermintConfig helps to override default Tendermint Config values. @@ -117,7 +152,8 @@ func initAppConfig() (string, interface{}) { type CustomAppConfig struct { serverconfig.Config - WASM WASMConfig `mapstructure:"wasm"` + WASM WASMConfig `mapstructure:"wasm"` + Oracle oracleabci.OracleConfig `mapstructure:"oracle"` } // Optionally allow the chain developer to overwrite the SDK's default @@ -144,6 +180,9 @@ func initAppConfig() (string, interface{}) { LruSize: 1, QueryGasLimit: 30000000, }, + Oracle: oracleabci.OracleConfig{ + Endpoint: "http://localhost:10171/api/v1/prices", + }, } customAppTemplate := serverconfig.DefaultConfigTemplate + ` @@ -152,34 +191,46 @@ func initAppConfig() (string, interface{}) { query_gas_limit = 30000000 # This is the number of wasm vm instances we keep cached in memory for speed-up # Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally - lru_size = 0` + lru_size = 0 + +[oracle] + # Endpoint to query oracle prices for vote extension + endpoint = "http://localhost:10171/api/v1/prices"` return customAppTemplate, customAppConfig } -func initRootCmd(rootCmd *cobra.Command, encodingConfig params.EncodingConfig) { - a := appCreator{encodingConfig} +func initRootCmd( + rootCmd *cobra.Command, + txConfig client.TxConfig, + _ codectypes.InterfaceRegistry, + _ codec.Codec, + basicManager module.BasicManager, +) { + cfg := sdk.GetConfig() + cfg.Seal() rootCmd.AddCommand( - genutilcli.InitCmd(app.ModuleBasics, app.DefaultNodeHome), - genutilcli.GenesisCoreCommand(encodingConfig.TxConfig, app.ModuleBasics, app.DefaultNodeHome), + genutilcli.InitCmd(basicManager, app.DefaultNodeHome), tmcli.NewCompletionCmd(rootCmd, true), debug.Cmd(), - config.Cmd(), - pruning.PruningCmd(a.newApp), + confixcmd.ConfigCommand(), + pruning.Cmd(newApp, app.DefaultNodeHome), + snapshot.Cmd(newApp), ) - server.AddCommands(rootCmd, app.DefaultNodeHome, a.newApp, a.appExport, addModuleInitFlags) + server.AddCommands(rootCmd, app.DefaultNodeHome, newApp, appExport, addModuleInitFlags) // add keybase, auxiliary RPC, query, and tx child commands rootCmd.AddCommand( - rpc.StatusCommand(), + server.StatusCommand(), + genesisCommand(txConfig, basicManager), queryCommand(), txCommand(), - keys.Commands(app.DefaultNodeHome), + keys.Commands(), ) // add rosetta - rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec)) + // rootCmd.AddCommand(rosettaCmd.RosettaCommand(encodingConfig.InterfaceRegistry, encodingConfig.Codec)) } func addModuleInitFlags(startCmd *cobra.Command) { @@ -197,19 +248,30 @@ func queryCommand() *cobra.Command { } cmd.AddCommand( - authcmd.GetAccountCmd(), - rpc.ValidatorCommand(), - rpc.BlockCommand(), - authcmd.QueryTxsByEventsCmd(), authcmd.QueryTxCmd(), + authcmd.QueryTxsByEventsCmd(), + rpc.QueryEventForTxCmd(), + rpc.ValidatorCommand(), + server.QueryBlockCmd(), + server.QueryBlockResultsCmd(), + server.QueryBlocksCmd(), ) - app.ModuleBasics.AddQueryCommands(cmd) cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") return cmd } +// genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter +func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command { + cmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome) + + for _, subCmd := range cmds { + cmd.AddCommand(subCmd) + } + return cmd +} + func txCommand() *cobra.Command { cmd := &cobra.Command{ Use: "tx", @@ -228,22 +290,17 @@ func txCommand() *cobra.Command { authcmd.GetBroadcastCommand(), authcmd.GetEncodeCommand(), authcmd.GetDecodeCommand(), - authcmd.GetAuxToFeeCommand(), + authcmd.GetSimulateCmd(), ) - app.ModuleBasics.AddTxCommands(cmd) - cmd.AddCommand(ibcwasmcli.NewTxCmd()) + // app.ModuleBasics.AddTxCommands(cmd) cmd.PersistentFlags().String(flags.FlagChainID, "", "The network chain ID") return cmd } -type appCreator struct { - encCfg params.EncodingConfig -} - // newApp is an appCreator -func (a appCreator) newApp( +func newApp( logger log.Logger, db dbm.DB, traceStore io.Writer, @@ -264,7 +321,6 @@ func (a appCreator) newApp( db, traceStore, true, - a.encCfg, appOpts, wasmOpts, baseappOptions..., @@ -273,7 +329,7 @@ func (a appCreator) newApp( // appExport creates a new kujiraApp (optionally at a given height) // and exports state. -func (a appCreator) appExport( +func appExport( logger log.Logger, db dbm.DB, traceStore io.Writer, @@ -296,7 +352,6 @@ func (a appCreator) appExport( db, traceStore, loadLatest, - a.encCfg, appOpts, emptyWasmOpts, ) @@ -309,3 +364,13 @@ func (a appCreator) appExport( return kujiraApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) } + +var tempDir = func() string { + dir, err := os.MkdirTemp("", "kujirad") + if err != nil { + panic("failed to create temp dir: " + err.Error()) + } + defer os.RemoveAll(dir) + + return dir +} diff --git a/cmd/kujirad/cmd/root_v2.go b/cmd/kujirad/cmd/root_v2.go new file mode 100644 index 00000000..236ba38d --- /dev/null +++ b/cmd/kujirad/cmd/root_v2.go @@ -0,0 +1,371 @@ +package cmd + +// import ( +// "errors" +// "io" +// "os" + +// "cosmossdk.io/depinject" +// "cosmossdk.io/log" +// "cosmossdk.io/simapp" +// confixcmd "cosmossdk.io/tools/confix/cmd" + +// wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" +// "github.com/Team-Kujira/core/app" +// cmtcfg "github.com/cometbft/cometbft/config" +// txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" +// "github.com/prometheus/client_golang/prometheus" + +// // rosettaCmd "cosmossdk.io/tools/rosetta/cmd" +// "cosmossdk.io/client/v2/autocli" +// dbm "github.com/cosmos/cosmos-db" +// "github.com/cosmos/cosmos-sdk/client" +// "github.com/cosmos/cosmos-sdk/client/config" +// "github.com/cosmos/cosmos-sdk/client/debug" +// "github.com/cosmos/cosmos-sdk/client/flags" +// "github.com/cosmos/cosmos-sdk/client/keys" +// "github.com/cosmos/cosmos-sdk/client/pruning" +// "github.com/cosmos/cosmos-sdk/client/rpc" +// "github.com/cosmos/cosmos-sdk/client/snapshot" +// "github.com/cosmos/cosmos-sdk/codec" +// codectypes "github.com/cosmos/cosmos-sdk/codec/types" +// "github.com/cosmos/cosmos-sdk/server" +// serverconfig "github.com/cosmos/cosmos-sdk/server/config" +// servertypes "github.com/cosmos/cosmos-sdk/server/types" +// sdk "github.com/cosmos/cosmos-sdk/types" +// "github.com/cosmos/cosmos-sdk/types/module" +// "github.com/cosmos/cosmos-sdk/types/tx/signing" +// authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" +// "github.com/cosmos/cosmos-sdk/x/auth/tx" +// "github.com/cosmos/cosmos-sdk/x/auth/types" +// "github.com/cosmos/cosmos-sdk/x/crisis" +// genutilcli "github.com/cosmos/cosmos-sdk/x/genutil/client/cli" +// "github.com/spf13/cast" +// "github.com/spf13/cobra" +// "github.com/spf13/viper" +// ) + +// // NewRootCmd creates a new root command for wasmd. It is called once in the +// // main function. +// func NewRootCmd() *cobra.Command { +// var ( +// interfaceRegistry codectypes.InterfaceRegistry +// appCodec codec.Codec +// txConfig client.TxConfig +// legacyAmino *codec.LegacyAmino +// autoCliOpts autocli.AppOptions +// moduleBasicManager module.BasicManager +// ) + +// if err := depinject.Inject(depinject.Configs(simapp.AppConfig, depinject.Supply(log.NewNopLogger())), +// &interfaceRegistry, +// &appCodec, +// &txConfig, +// &legacyAmino, +// &autoCliOpts, +// &moduleBasicManager, +// ); err != nil { +// panic(err) +// } + +// initClientCtx := client.Context{}. +// WithCodec(appCodec). +// WithInterfaceRegistry(interfaceRegistry). +// WithLegacyAmino(legacyAmino). +// WithInput(os.Stdin). +// WithAccountRetriever(types.AccountRetriever{}). +// WithHomeDir(simapp.DefaultNodeHome). +// WithViper("") // In simapp, we don't use any prefix for env variables. + +// rootCmd := &cobra.Command{ +// Use: "simd", +// Short: "simulation app", +// PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { +// // set the default command outputs +// cmd.SetOut(cmd.OutOrStdout()) +// cmd.SetErr(cmd.ErrOrStderr()) + +// initClientCtx = initClientCtx.WithCmdContext(cmd.Context()) +// initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) +// if err != nil { +// return err +// } + +// initClientCtx, err = config.ReadFromClientConfig(initClientCtx) +// if err != nil { +// return err +// } + +// // This needs to go after ReadFromClientConfig, as that function +// // sets the RPC client needed for SIGN_MODE_TEXTUAL. +// enabledSignModes := append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) +// txConfigOpts := tx.ConfigOptions{ +// EnabledSignModes: enabledSignModes, +// TextualCoinMetadataQueryFn: txmodule.NewGRPCCoinMetadataQueryFn(initClientCtx), +// } +// txConfigWithTextual, err := tx.NewTxConfigWithOptions( +// codec.NewProtoCodec(interfaceRegistry), +// txConfigOpts, +// ) +// if err != nil { +// return err +// } +// initClientCtx = initClientCtx.WithTxConfig(txConfigWithTextual) +// if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { +// return err +// } + +// customAppTemplate, customAppConfig := initAppConfig() +// customCMTConfig := initCometBFTConfig() + +// return server.InterceptConfigsPreRunHandler(cmd, customAppTemplate, customAppConfig, customCMTConfig) +// }, +// } + +// initRootCmd(rootCmd, txConfig, interfaceRegistry, appCodec, moduleBasicManager) + +// if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { +// panic(err) +// } + +// return rootCmd +// } + +// // initCometBFTConfig helps to override default CometBFT Config values. +// // return cmtcfg.DefaultConfig if no custom configuration is required for the application. +// func initCometBFTConfig() *cmtcfg.Config { +// cfg := cmtcfg.DefaultConfig() + +// // these values put a higher strain on node memory +// // cfg.P2P.MaxNumInboundPeers = 100 +// // cfg.P2P.MaxNumOutboundPeers = 40 + +// return cfg +// } + +// // initAppConfig helps to override default appConfig template and configs. +// // return "", nil if no custom configuration is required for the application. +// func initAppConfig() (string, interface{}) { +// // The following code snippet is just for reference. + +// // WASMConfig defines configuration for the wasm module. +// type WASMConfig struct { +// // This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries +// QueryGasLimit uint64 `mapstructure:"query_gas_limit"` + +// // Address defines the gRPC-web server to listen on +// LruSize uint64 `mapstructure:"lru_size"` +// } + +// type CustomAppConfig struct { +// serverconfig.Config + +// WASM WASMConfig `mapstructure:"wasm"` +// } + +// // Optionally allow the chain developer to overwrite the SDK's default +// // server config. +// srvCfg := serverconfig.DefaultConfig() +// // The SDK's default minimum gas price is set to "" (empty value) inside +// // app.toml. If left empty by validators, the node will halt on startup. +// // However, the chain developer can set a default app.toml value for their +// // validators here. +// // +// // In summary: +// // - if you leave srvCfg.MinGasPrices = "", all validators MUST tweak their +// // own app.toml config, +// // - if you set srvCfg.MinGasPrices non-empty, validators CAN tweak their +// // own app.toml to override, or use this default value. +// // +// // In simapp, we set the min gas prices to 0. +// srvCfg.MinGasPrices = "0stake" +// // srvCfg.BaseConfig.IAVLDisableFastNode = true // disable fastnode by default + +// customAppConfig := CustomAppConfig{ +// Config: *srvCfg, +// WASM: WASMConfig{ +// LruSize: 1, +// QueryGasLimit: 300000, +// }, +// } + +// customAppTemplate := serverconfig.DefaultConfigTemplate + ` +// [wasm] +// # This is the maximum sdk gas (wasm and storage) that we allow for any x/wasm "smart" queries +// query_gas_limit = 300000 +// # This is the number of wasm vm instances we keep cached in memory for speed-up +// # Warning: this is currently unstable and may lead to crashes, best to keep for 0 unless testing locally +// lru_size = 0` + +// return customAppTemplate, customAppConfig +// } + +// func initRootCmd( +// rootCmd *cobra.Command, +// txConfig client.TxConfig, +// interfaceRegistry codectypes.InterfaceRegistry, +// appCodec codec.Codec, +// basicManager module.BasicManager, +// ) { +// cfg := sdk.GetConfig() +// cfg.Seal() + +// rootCmd.AddCommand( +// genutilcli.InitCmd(basicManager, simapp.DefaultNodeHome), +// debug.Cmd(), +// confixcmd.ConfigCommand(), +// pruning.Cmd(newApp, simapp.DefaultNodeHome), +// snapshot.Cmd(newApp), +// ) + +// server.AddCommands(rootCmd, simapp.DefaultNodeHome, newApp, appExport, addModuleInitFlags) + +// // add keybase, auxiliary RPC, query, genesis, and tx child commands +// rootCmd.AddCommand( +// server.StatusCommand(), +// genesisCommand(txConfig, basicManager), +// queryCommand(), +// txCommand(), +// keys.Commands(), +// ) + +// // add rosetta +// // rootCmd.AddCommand(rosettaCmd.RosettaCommand(interfaceRegistry, appCodec)) +// } + +// func addModuleInitFlags(startCmd *cobra.Command) { +// crisis.AddModuleInitFlags(startCmd) +// } + +// func queryCommand() *cobra.Command { +// cmd := &cobra.Command{ +// Use: "query", +// Aliases: []string{"q"}, +// Short: "Querying subcommands", +// DisableFlagParsing: false, +// SuggestionsMinimumDistance: 2, +// RunE: client.ValidateCmd, +// } + +// cmd.AddCommand( +// rpc.ValidatorCommand(), +// server.QueryBlockCmd(), +// authcmd.QueryTxsByEventsCmd(), +// server.QueryBlocksCmd(), +// authcmd.QueryTxCmd(), +// ) + +// return cmd +// } + +// // genesisCommand builds genesis-related `simd genesis` command. Users may provide application specific commands as a parameter +// func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command { +// cmd := genutilcli.Commands(txConfig, basicManager, simapp.DefaultNodeHome) + +// for _, subCmd := range cmds { +// cmd.AddCommand(subCmd) +// } +// return cmd +// } + +// func txCommand() *cobra.Command { +// cmd := &cobra.Command{ +// Use: "tx", +// Short: "Transactions subcommands", +// DisableFlagParsing: false, +// SuggestionsMinimumDistance: 2, +// RunE: client.ValidateCmd, +// } + +// cmd.AddCommand( +// authcmd.GetSignCommand(), +// authcmd.GetSignBatchCommand(), +// authcmd.GetMultiSignCommand(), +// authcmd.GetMultiSignBatchCmd(), +// authcmd.GetValidateSignaturesCommand(), +// authcmd.GetBroadcastCommand(), +// authcmd.GetEncodeCommand(), +// authcmd.GetDecodeCommand(), +// authcmd.GetSimulateCmd(), +// ) + +// return cmd +// } + +// // newApp is an appCreator +// func newApp( +// logger log.Logger, +// db dbm.DB, +// traceStore io.Writer, +// appOpts servertypes.AppOptions, +// ) servertypes.Application { +// var wasmOpts []wasmkeeper.Option +// if cast.ToBool(appOpts.Get("telemetry.enabled")) { +// wasmOpts = append(wasmOpts, wasmkeeper.WithVMCacheMetrics(prometheus.DefaultRegisterer)) +// } + +// skipUpgradeHeights := make(map[int64]bool) +// for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { +// skipUpgradeHeights[int64(h)] = true +// } +// baseappOptions := server.DefaultBaseappOptions(appOpts) +// return app.New( +// logger, +// db, +// traceStore, +// true, +// appOpts, +// wasmOpts, +// baseappOptions..., +// ) +// } + +// // appExport creates a new kujiraApp (optionally at a given height) +// // and exports state. +// func appExport( +// logger log.Logger, +// db dbm.DB, +// traceStore io.Writer, +// height int64, +// forZeroHeight bool, +// jailAllowedAddrs []string, +// appOpts servertypes.AppOptions, +// modulesToExport []string, +// ) (servertypes.ExportedApp, error) { +// var kujiraApp *app.App + +// // this check is necessary as we use the flag in x/upgrade. +// // we can exit more gracefully by checking the flag here. +// homePath, ok := appOpts.Get(flags.FlagHome).(string) +// if !ok || homePath == "" { +// return servertypes.ExportedApp{}, errors.New("application home not set") +// } + +// viperAppOpts, ok := appOpts.(*viper.Viper) +// if !ok { +// return servertypes.ExportedApp{}, errors.New("appOpts is not viper.Viper") +// } + +// // overwrite the FlagInvCheckPeriod +// viperAppOpts.Set(server.FlagInvCheckPeriod, 1) +// appOpts = viperAppOpts + +// loadLatest := height == -1 +// var emptyWasmOpts []wasmkeeper.Option +// kujiraApp = app.New( +// logger, +// db, +// traceStore, +// loadLatest, +// appOpts, +// emptyWasmOpts, +// ) + +// if height != -1 { +// if err := kujiraApp.LoadHeight(height); err != nil { +// return servertypes.ExportedApp{}, err +// } +// } + +// return kujiraApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) +// } diff --git a/cmd/kujirad/main.go b/cmd/kujirad/main.go index eb0b231d..adac1fa7 100644 --- a/cmd/kujirad/main.go +++ b/cmd/kujirad/main.go @@ -3,21 +3,17 @@ package main import ( "os" + "cosmossdk.io/log" "github.com/Team-Kujira/core/app" "github.com/Team-Kujira/core/cmd/kujirad/cmd" - "github.com/cosmos/cosmos-sdk/server" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" ) func main() { - rootCmd, _ := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { - switch e := err.(type) { - case server.ErrorCode: - os.Exit(e.Code) + rootCmd := cmd.NewRootCmd() - default: - os.Exit(1) - } + if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { + log.NewLogger(rootCmd.OutOrStderr()).Error("failure when running app", "err", err) + os.Exit(1) } } diff --git a/docs/proto/proto-docs.md b/docs/proto/proto-docs.md index 50b0c9dd..83c16d8f 100644 --- a/docs/proto/proto-docs.md +++ b/docs/proto/proto-docs.md @@ -1,44 +1,108 @@ + # Protobuf Documentation + + + ## Table of Contents + + - [kujira/oracle/oracle.proto](#kujira/oracle/oracle.proto) + - [Denom](#kujira.oracle.Denom) + - [ExchangeRateTuple](#kujira.oracle.ExchangeRateTuple) + - [Params](#kujira.oracle.Params) + + - [kujira/oracle/genesis.proto](#kujira/oracle/genesis.proto) + - [FeederDelegation](#kujira.oracle.FeederDelegation) + - [GenesisState](#kujira.oracle.GenesisState) + - [MissCounter](#kujira.oracle.MissCounter) + + - [kujira/oracle/query.proto](#kujira/oracle/query.proto) + - [QueryActivesRequest](#kujira.oracle.QueryActivesRequest) + - [QueryActivesResponse](#kujira.oracle.QueryActivesResponse) + - [QueryExchangeRateRequest](#kujira.oracle.QueryExchangeRateRequest) + - [QueryExchangeRateResponse](#kujira.oracle.QueryExchangeRateResponse) + - [QueryExchangeRatesRequest](#kujira.oracle.QueryExchangeRatesRequest) + - [QueryExchangeRatesResponse](#kujira.oracle.QueryExchangeRatesResponse) + - [QueryMissCounterRequest](#kujira.oracle.QueryMissCounterRequest) + - [QueryMissCounterResponse](#kujira.oracle.QueryMissCounterResponse) + - [QueryParamsRequest](#kujira.oracle.QueryParamsRequest) + - [QueryParamsResponse](#kujira.oracle.QueryParamsResponse) + - [QueryVoteTargetsRequest](#kujira.oracle.QueryVoteTargetsRequest) + - [QueryVoteTargetsResponse](#kujira.oracle.QueryVoteTargetsResponse) + + - [Query](#kujira.oracle.Query) + + - [kujira/oracle/tx.proto](#kujira/oracle/tx.proto) + - [MsgAddRequiredDenom](#kujira.oracle.MsgAddRequiredDenom) + - [MsgAddRequiredDenomResponse](#kujira.oracle.MsgAddRequiredDenomResponse) + - [MsgRemoveRequiredDenom](#kujira.oracle.MsgRemoveRequiredDenom) + - [MsgRemoveRequiredDenomResponse](#kujira.oracle.MsgRemoveRequiredDenomResponse) + - [MsgUpdateParams](#kujira.oracle.MsgUpdateParams) + - [MsgUpdateParamsResponse](#kujira.oracle.MsgUpdateParamsResponse) + + - [Msg](#kujira.oracle.Msg) + + - [Scalar Value Types](#scalar-value-types) + + + + +

Top

-# Protobuf Documentation - - - -## Table of Contents - -- [Protobuf Documentation](#protobuf-documentation) - - [Table of Contents](#table-of-contents) - - [kujira/scheduler/params.proto](#kujiraschedulerparamsproto) - - [Params](#params) - - [kujira/scheduler/hook.proto](#kujiraschedulerhookproto) - - [Hook](#hook) - - [kujira/scheduler/genesis.proto](#kujiraschedulergenesisproto) - - [GenesisState](#genesisstate) - - [kujira/scheduler/proposal.proto](#kujiraschedulerproposalproto) - - [CreateHookProposal](#createhookproposal) - - [DeleteHookProposal](#deletehookproposal) - - [UpdateHookProposal](#updatehookproposal) - - [kujira/scheduler/query.proto](#kujiraschedulerqueryproto) - - [QueryAllHookRequest](#queryallhookrequest) - - [QueryAllHookResponse](#queryallhookresponse) - - [QueryGetHookRequest](#querygethookrequest) - - [QueryGetHookResponse](#querygethookresponse) - - [QueryParamsRequest](#queryparamsrequest) - - [QueryParamsResponse](#queryparamsresponse) - - [Query](#query) - - [Scalar Value Types](#scalar-value-types) - - + ## kujira/oracle/oracle.proto + -

Top

+ + + + ### Denom + Denom - the object to hold configurations of each denom + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `name` | [string](#string) | | | + + + + + + + + + ### ExchangeRateTuple + ExchangeRateTuple - struct to store interpreted exchange rates data to store + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `denom` | [string](#string) | | | + | `exchange_rate` | [string](#string) | | | + + -## kujira/scheduler/params.proto + - + + -### Params + ### Params + Params defines the parameters for the oracle module. -Params defines the parameters for the module. + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `vote_period` | [uint64](#uint64) | | | + | `vote_threshold` | [string](#string) | | | + | `max_deviation` | [string](#string) | | | + | `required_denoms` | [string](#string) | repeated | | + | `slash_fraction` | [string](#string) | | | + | `slash_window` | [uint64](#uint64) | | | + | `min_valid_per_window` | [string](#string) | | | + | `reward_band` | [string](#string) | | Deprecated | + | `whitelist` | [Denom](#kujira.oracle.Denom) | repeated | | + + + + @@ -48,24 +112,65 @@ Params defines the parameters for the module. - - + + +

Top

-## kujira/scheduler/hook.proto + ## kujira/oracle/genesis.proto + + + + + + ### FeederDelegation + FeederDelegation is the address for where oracle feeder authority are +delegated to. By default this struct is only used at genesis to feed in +default feeder addresses. + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `feeder_address` | [string](#string) | | | + | `validator_address` | [string](#string) | | | + + + + + + + + + ### GenesisState + GenesisState defines the oracle module's genesis state. - + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `params` | [Params](#kujira.oracle.Params) | | | + | `exchange_rates` | [ExchangeRateTuple](#kujira.oracle.ExchangeRateTuple) | repeated | | + | `miss_counters` | [MissCounter](#kujira.oracle.MissCounter) | repeated | | + + -### Hook + -| Field | Type | Label | Description | -| ----------- | ----------------------------------------------------- | -------- | ----------- | -| `id` | [uint64](#uint64) | | | -| `executor` | [string](#string) | | | -| `contract` | [string](#string) | | | -| `msg` | [bytes](#bytes) | | | -| `frequency` | [int64](#int64) | | | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + + + ### MissCounter + MissCounter defines an miss counter and validator address pair used in +oracle module's genesis state + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `validator_address` | [string](#string) | | | + | `miss_counter` | [uint64](#uint64) | | | + + + + @@ -75,76 +180,178 @@ Params defines the parameters for the module. - - + + +

Top

-## kujira/scheduler/genesis.proto + ## kujira/oracle/query.proto + - + + -### GenesisState + ### QueryActivesRequest + QueryActivesRequest is the request type for the Query/Actives RPC method. -GenesisState defines the scheduler module's genesis state. + -| Field | Type | Label | Description | -| ----------- | ---------------------------------- | -------- | ----------- | -| `params` | [Params](#kujira.scheduler.Params) | | | -| `hookList` | [Hook](#kujira.scheduler.Hook) | repeated | | -| `hookCount` | [uint64](#uint64) | | | + - + + - + ### QueryActivesResponse + QueryActivesResponse is response type for the +Query/Actives RPC method. - + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `actives` | [string](#string) | repeated | actives defines a list of the denomination which oracle prices aggreed upon. | + + - + - + + -

Top

+ ### QueryExchangeRateRequest + QueryExchangeRateRequest is the request type for the Query/ExchangeRate RPC method. + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `denom` | [string](#string) | | denom defines the denomination to query for. | + + + + + + + + + ### QueryExchangeRateResponse + QueryExchangeRateResponse is response type for the +Query/ExchangeRate RPC method. + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `exchange_rate` | [string](#string) | | exchange_rate defines the exchange rate of whitelisted assets | + + + + + + + -## kujira/scheduler/proposal.proto + ### QueryExchangeRatesRequest + QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC method. - + -### CreateHookProposal + -| Field | Type | Label | Description | -| ------------- | ----------------------------------------------------- | -------- | ----------------------------------------------------- | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `executor` | [string](#string) | | The account that will execute the msg on the schedule | -| `contract` | [string](#string) | | The contract that the msg is called on | -| `msg` | [bytes](#bytes) | | | -| `frequency` | [int64](#int64) | | | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + - + ### QueryExchangeRatesResponse + QueryExchangeRatesResponse is response type for the +Query/ExchangeRates RPC method. -### DeleteHookProposal + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `exchange_rates` | [cosmos.base.v1beta1.DecCoin](#cosmos.base.v1beta1.DecCoin) | repeated | exchange_rates defines a list of the exchange rate for all whitelisted denoms. | + + -| Field | Type | Label | Description | -| ------------- | ----------------- | ----- | ------------------------------------ | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `id` | [uint64](#uint64) | | | + - + + -### UpdateHookProposal + ### QueryMissCounterRequest + QueryMissCounterRequest is the request type for the Query/MissCounter RPC method. -| Field | Type | Label | Description | -| ------------- | ----------------------------------------------------- | -------- | ------------------------------------ | -| `title` | [string](#string) | | Title is a short summary | -| `description` | [string](#string) | | Description is a human readable text | -| `id` | [uint64](#uint64) | | | -| `executor` | [string](#string) | | | -| `contract` | [string](#string) | | | -| `msg` | [bytes](#bytes) | | | -| `frequency` | [int64](#int64) | | | -| `funds` | [cosmos.base.v1beta1.Coin](#cosmos.base.v1beta1.Coin) | repeated | | + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `validator_addr` | [string](#string) | | validator defines the validator address to query for. | + + + + + + + + + ### QueryMissCounterResponse + QueryMissCounterResponse is response type for the +Query/MissCounter RPC method. + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `miss_counter` | [uint64](#uint64) | | miss_counter defines the oracle miss counter of a validator | + + + + + + + + + ### QueryParamsRequest + QueryParamsRequest is the request type for the Query/Params RPC method. + + + + + + + + + ### QueryParamsResponse + QueryParamsResponse is the response type for the Query/Params RPC method. + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `params` | [Params](#kujira.oracle.Params) | | params defines the parameters of the module. | + + + + + + + + + ### QueryVoteTargetsRequest + QueryVoteTargetsRequest is the request type for the Query/VoteTargets RPC method. + + + + + + + + + ### QueryVoteTargetsResponse + QueryVoteTargetsResponse is response type for the +Query/VoteTargets RPC method. + + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `vote_targets` | [string](#string) | repeated | vote_targets defines a list of the denomination in which everyone should vote in the current vote period. | + + + + @@ -152,62 +359,107 @@ GenesisState defines the scheduler module's genesis state. - + + - + ### Query + Query defines the gRPC querier service. + + | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | + | ----------- | ------------ | ------------- | ------------| ------- | -------- | + | `ExchangeRate` | [QueryExchangeRateRequest](#kujira.oracle.QueryExchangeRateRequest) | [QueryExchangeRateResponse](#kujira.oracle.QueryExchangeRateResponse) | ExchangeRate returns exchange rate of a denom | GET|/oracle/denoms/{denom}/exchange_rate| + | `ExchangeRates` | [QueryExchangeRatesRequest](#kujira.oracle.QueryExchangeRatesRequest) | [QueryExchangeRatesResponse](#kujira.oracle.QueryExchangeRatesResponse) | ExchangeRates returns exchange rates of all denoms | GET|/oracle/denoms/exchange_rates| + | `Actives` | [QueryActivesRequest](#kujira.oracle.QueryActivesRequest) | [QueryActivesResponse](#kujira.oracle.QueryActivesResponse) | Actives returns all active denoms | GET|/oracle/denoms/actives| + | `MissCounter` | [QueryMissCounterRequest](#kujira.oracle.QueryMissCounterRequest) | [QueryMissCounterResponse](#kujira.oracle.QueryMissCounterResponse) | MissCounter returns oracle miss counter of a validator | GET|/oracle/validators/{validator_addr}/miss| + | `Params` | [QueryParamsRequest](#kujira.oracle.QueryParamsRequest) | [QueryParamsResponse](#kujira.oracle.QueryParamsResponse) | Params queries all parameters. | GET|/oracle/params| + + + + +

Top

-## kujira/scheduler/query.proto + ## kujira/oracle/tx.proto + - + + -### QueryAllHookRequest + ### MsgAddRequiredDenom + MsgAddRequiredDenom represents a message to add a denom to the whitelist -| Field | Type | Label | Description | -| ------------ | ------------------------------------------------------------------------------- | ----- | ----------- | -| `pagination` | [cosmos.base.query.v1beta1.PageRequest](#cosmos.base.query.v1beta1.PageRequest) | | | + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `authority` | [string](#string) | | | + | `symbol` | [string](#string) | | | + + - + -### QueryAllHookResponse + + -| Field | Type | Label | Description | -| ------------ | --------------------------------------------------------------------------------- | -------- | ----------- | -| `Hook` | [Hook](#kujira.scheduler.Hook) | repeated | | -| `pagination` | [cosmos.base.query.v1beta1.PageResponse](#cosmos.base.query.v1beta1.PageResponse) | | | + ### MsgAddRequiredDenomResponse + MsgAddRequiredDenomResponse defines the Msg/AddRequiredDenom response type. - + -### QueryGetHookRequest + -| Field | Type | Label | Description | -| ----- | ----------------- | ----- | ----------- | -| `id` | [uint64](#uint64) | | | + + - + ### MsgRemoveRequiredDenom + MsgRemoveRequiredDenom represents a message to remove a denom from the whitelist -### QueryGetHookResponse + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `authority` | [string](#string) | | | + | `symbol` | [string](#string) | | | + + -| Field | Type | Label | Description | -| ------ | ------------------------------ | ----- | ----------- | -| `Hook` | [Hook](#kujira.scheduler.Hook) | | | + - + + -### QueryParamsRequest + ### MsgRemoveRequiredDenomResponse + MsgRemoveRequiredDenomResponse defines the Msg/RemoveRequiredDenom response type. -QueryParamsRequest is request type for the Query/Params RPC method. + - + -### QueryParamsResponse + + -QueryParamsResponse is response type for the Query/Params RPC method. + ### MsgUpdateParams + -| Field | Type | Label | Description | -| -------- | ---------------------------------- | ----- | ----------------------------------------------- | -| `params` | [Params](#kujira.scheduler.Params) | | params holds all the parameters of this module. | + + | Field | Type | Label | Description | + | ----- | ---- | ----- | ----------- | + | `authority` | [string](#string) | | | + | `params` | [Params](#kujira.oracle.Params) | | | + + + + + + + + + ### MsgUpdateParamsResponse + MsgUpdateParamsResponse defines the Msg/UpdateParams response type. + + + + @@ -215,36 +467,39 @@ QueryParamsResponse is response type for the Query/Params RPC method. - - -### Query - -Query defines the gRPC querier service. + + -| Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | -| ----------- | ------------------------------------------------------------ | -------------------------------------------------------------- | ------------------------------------------------ | --------- | --------------------------- | -| `Params` | [QueryParamsRequest](#kujira.scheduler.QueryParamsRequest) | [QueryParamsResponse](#kujira.scheduler.QueryParamsResponse) | Parameters queries the parameters of the module. | GET | /kujira/scheduler/params | -| `Hook` | [QueryGetHookRequest](#kujira.scheduler.QueryGetHookRequest) | [QueryGetHookResponse](#kujira.scheduler.QueryGetHookResponse) | Queries a Hook by id. | GET | /kujira/scheduler/hook/{id} | -| `HookAll` | [QueryAllHookRequest](#kujira.scheduler.QueryAllHookRequest) | [QueryAllHookResponse](#kujira.scheduler.QueryAllHookResponse) | Queries a list of Hook items. | GET | /kujira/scheduler/hook | + ### Msg + Msg defines the oracle Msg service. + | Method Name | Request Type | Response Type | Description | HTTP Verb | Endpoint | + | ----------- | ------------ | ------------- | ------------| ------- | -------- | + | `AddRequiredDenom` | [MsgAddRequiredDenom](#kujira.oracle.MsgAddRequiredDenom) | [MsgAddRequiredDenomResponse](#kujira.oracle.MsgAddRequiredDenomResponse) | AddRequiredDenom adds a new price to the required list of prices | | + | `RemoveRequiredDenom` | [MsgRemoveRequiredDenom](#kujira.oracle.MsgRemoveRequiredDenom) | [MsgRemoveRequiredDenomResponse](#kujira.oracle.MsgRemoveRequiredDenomResponse) | RemoveRequiredDenom removes a price from the required list of prices | | + | `UpdateParams` | [MsgUpdateParams](#kujira.oracle.MsgUpdateParams) | [MsgUpdateParamsResponse](#kujira.oracle.MsgUpdateParamsResponse) | UpdateParams sets new module params | | + -## Scalar Value Types - -| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | -| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------- | ------ | ---------- | ----------- | ------- | ---------- | -------------- | ------------------------------ | -| double | | double | double | float | float64 | double | float | Float | -| float | | float | float | float | float32 | float | float | Float | -| int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | -| uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | -| sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | -| fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | -| sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | -| sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | -| bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | -| string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | -| bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | + + + ## Scalar Value Types + + | .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby | + | ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- | + | double | | double | double | float | float64 | double | float | Float | + | float | | float | float | float | float32 | float | float | Float | + | int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | + | int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum | + | uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) | + | uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) | + | sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | + | sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum | + | fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) | + | fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum | + | sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) | + | sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum | + | bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass | + | string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) | + | bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) | + \ No newline at end of file diff --git a/go.mod b/go.mod index 48cea682..c92678c3 100644 --- a/go.mod +++ b/go.mod @@ -2,92 +2,107 @@ module github.com/Team-Kujira/core go 1.21 -toolchain go1.21.8 - require ( cosmossdk.io/errors v1.0.1 cosmossdk.io/math v1.3.0 - cosmossdk.io/simapp v0.0.0-20230224204036-a6adb0821462 - cosmossdk.io/tools/rosetta v0.2.1 - github.com/CosmWasm/wasmd v0.45.0 - github.com/CosmWasm/wasmvm v1.5.2 - github.com/armon/go-metrics v0.4.1 - github.com/cometbft/cometbft v0.37.5 - github.com/cometbft/cometbft-db v0.8.0 + cosmossdk.io/store v1.1.0 + github.com/CosmWasm/wasmd v0.51.0 + github.com/CosmWasm/wasmvm/v2 v2.0.1 + github.com/cometbft/cometbft v0.38.7 + github.com/cometbft/cometbft-db v0.9.1 // indirect github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.47.12 - github.com/cosmos/gogoproto v1.4.10 - github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.1.1-0.20231213092633-b306e7a706e1 - github.com/cosmos/ibc-go/v7 v7.6.0 + github.com/cosmos/cosmos-sdk v0.50.7 + github.com/cosmos/gogoproto v1.4.12 + github.com/cosmos/iavl v1.1.2 // indirect + github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.2.1-0.20240523101951-4b45d1822fb6 + github.com/cosmos/ibc-go/v8 v8.3.2 github.com/golang/protobuf v1.5.4 github.com/google/gofuzz v1.2.0 - github.com/gorilla/mux v1.8.0 + github.com/gorilla/mux v1.8.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 - github.com/pkg/errors v0.9.1 - github.com/prometheus/client_golang v1.16.0 + github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_golang v1.19.0 github.com/spf13/cast v1.6.0 github.com/spf13/cobra v1.8.0 github.com/stretchr/testify v1.9.0 - github.com/terra-money/alliance v0.3.5 - google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 - google.golang.org/grpc v1.62.1 + google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de + google.golang.org/grpc v1.63.2 gopkg.in/yaml.v2 v2.4.0 ) +require ( + cosmossdk.io/client/v2 v2.0.0-beta.1 + cosmossdk.io/core v0.11.0 + cosmossdk.io/log v1.3.1 + cosmossdk.io/tools/confix v0.1.1 + cosmossdk.io/x/evidence v0.1.0 + cosmossdk.io/x/feegrant v0.1.0 + cosmossdk.io/x/tx v0.13.3 + cosmossdk.io/x/upgrade v0.1.1 + github.com/cosmos/cosmos-db v1.0.2 + github.com/cosmos/ibc-go/modules/capability v1.0.0 + github.com/cosmos/rosetta v0.50.4 + github.com/hashicorp/go-metrics v0.5.3 +) + require ( cloud.google.com/go v0.112.0 // indirect - cloud.google.com/go/compute v1.23.3 // indirect + cloud.google.com/go/compute v1.24.0 // indirect cloud.google.com/go/compute/metadata v0.2.3 // indirect - cloud.google.com/go/iam v1.1.5 // indirect + cloud.google.com/go/iam v1.1.6 // indirect cloud.google.com/go/storage v1.36.0 // indirect - cosmossdk.io/api v0.3.1 // indirect - cosmossdk.io/core v0.6.1 // indirect + cosmossdk.io/api v0.7.5 // indirect + cosmossdk.io/collections v0.4.0 // indirect cosmossdk.io/depinject v1.0.0-alpha.4 // indirect - cosmossdk.io/log v1.3.1 // indirect filippo.io/edwards25519 v1.0.0 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.2 // indirect - github.com/ChainSafe/go-schnorrkel v1.0.0 // indirect - github.com/aws/aws-sdk-go v1.44.203 // indirect + github.com/DataDog/datadog-go v3.2.0+incompatible // indirect + github.com/DataDog/zstd v1.5.5 // indirect + github.com/aws/aws-sdk-go v1.44.224 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 // indirect + github.com/bits-and-blooms/bitset v1.8.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect - github.com/cespare/xxhash/v2 v2.2.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/chzyer/readline v1.5.1 // indirect github.com/cockroachdb/apd/v2 v2.0.2 // indirect - github.com/cockroachdb/errors v1.10.0 // indirect + github.com/cockroachdb/errors v1.11.1 // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect + github.com/cockroachdb/pebble v1.1.0 // indirect github.com/cockroachdb/redact v1.1.5 // indirect - github.com/coinbase/rosetta-sdk-go v0.7.9 // indirect - github.com/confio/ics23/go v0.9.0 // indirect + github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect + github.com/coinbase/rosetta-sdk-go/types v1.0.0 // indirect github.com/cosmos/btcutil v1.0.5 // indirect github.com/cosmos/go-bip39 v1.0.0 // indirect github.com/cosmos/gogogateway v1.2.0 // indirect - github.com/cosmos/iavl v0.20.1 // indirect github.com/cosmos/ics23/go v0.10.0 // indirect - github.com/cosmos/ledger-cosmos-go v0.12.4 // indirect + github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect github.com/cosmos/rosetta-sdk-go v0.10.0 // indirect - github.com/creachadair/taskgroup v0.4.2 // indirect + github.com/creachadair/atomicfile v0.3.1 // indirect + github.com/creachadair/tomledit v0.0.24 // indirect github.com/danieljoos/wincred v1.1.2 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect - github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect + github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 // indirect github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f // indirect github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.1 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/docker/distribution v2.8.2+incompatible // indirect + github.com/distribution/reference v0.5.0 // indirect github.com/dustin/go-humanize v1.0.1 // indirect github.com/dvsekhvalnov/jose2go v1.6.0 // indirect + github.com/emicklei/dot v1.6.1 // indirect + github.com/fatih/color v1.15.0 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.7.0 // indirect - github.com/getsentry/sentry-go v0.23.0 // indirect + github.com/getsentry/sentry-go v0.27.0 // indirect github.com/go-kit/kit v0.12.0 // indirect github.com/go-kit/log v0.2.1 // indirect github.com/go-logfmt/logfmt v0.6.0 // indirect - github.com/go-logr/logr v1.3.0 // indirect + github.com/go-logr/logr v1.4.1 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 // indirect github.com/gogo/googleapis v1.4.1 // indirect @@ -103,52 +118,53 @@ require ( github.com/google/uuid v1.6.0 // indirect github.com/googleapis/enterprise-certificate-proxy v0.3.2 // indirect github.com/googleapis/gax-go/v2 v2.12.0 // indirect - github.com/gorilla/handlers v1.5.1 // indirect + github.com/gorilla/handlers v1.5.2 // indirect github.com/gorilla/websocket v1.5.0 // indirect - github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect + github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect - github.com/gtank/merlin v0.1.1 // indirect - github.com/gtank/ristretto255 v0.1.2 // indirect github.com/hashicorp/go-cleanhttp v0.5.2 // indirect - github.com/hashicorp/go-getter v1.7.1 // indirect + github.com/hashicorp/go-getter v1.7.3 // indirect + github.com/hashicorp/go-hclog v1.5.0 // indirect github.com/hashicorp/go-immutable-radix v1.3.1 // indirect + github.com/hashicorp/go-plugin v1.5.2 // indirect github.com/hashicorp/go-safetemp v1.0.0 // indirect github.com/hashicorp/go-version v1.6.0 // indirect - github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect + github.com/hashicorp/golang-lru v1.0.2 // indirect github.com/hashicorp/hcl v1.0.0 // indirect + github.com/hashicorp/yamux v0.1.1 // indirect github.com/hdevalence/ed25519consensus v0.1.0 // indirect github.com/huandu/skiplist v1.2.0 // indirect + github.com/iancoleman/strcase v0.3.0 // indirect github.com/improbable-eng/grpc-web v0.15.0 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/jmespath/go-jmespath v0.4.0 // indirect github.com/jmhodges/levigo v1.0.0 // indirect - github.com/klauspost/compress v1.17.0 // indirect + github.com/klauspost/compress v1.17.7 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/lib/pq v1.10.7 // indirect github.com/libp2p/go-buffer-pool v0.1.0 // indirect - github.com/linxGnu/grocksdb v1.7.16 // indirect + github.com/linxGnu/grocksdb v1.8.14 // indirect github.com/magiconair/properties v1.8.7 // indirect github.com/manifoldco/promptui v0.9.0 // indirect github.com/mattn/go-colorable v0.1.13 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/matttproud/golang_protobuf_extensions v1.0.4 // indirect - github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 // indirect github.com/minio/highwayhash v1.0.2 // indirect github.com/mitchellh/go-homedir v1.1.0 // indirect github.com/mitchellh/go-testing-interface v1.14.1 // indirect github.com/mitchellh/mapstructure v1.5.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a // indirect + github.com/oklog/run v1.1.0 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 // indirect + github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_model v0.3.0 // indirect - github.com/prometheus/common v0.42.0 // indirect - github.com/prometheus/procfs v0.10.1 // indirect - github.com/rakyll/statik v0.1.7 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.52.2 // indirect + github.com/prometheus/procfs v0.13.0 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect - github.com/rogpeppe/go-internal v1.11.0 // indirect + github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/rs/cors v1.8.3 // indirect github.com/rs/zerolog v1.32.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect @@ -161,35 +177,35 @@ require ( github.com/subosito/gotenv v1.6.0 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d // indirect github.com/tendermint/go-amino v0.16.0 // indirect - github.com/tidwall/btree v1.6.0 // indirect + github.com/tidwall/btree v1.7.0 // indirect github.com/ulikunitz/xz v0.5.11 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.7 // indirect + go.etcd.io/bbolt v1.3.8 // indirect go.opencensus.io v0.24.0 // indirect - go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect - go.opentelemetry.io/otel v1.21.0 // indirect - go.opentelemetry.io/otel/metric v1.21.0 // indirect - go.opentelemetry.io/otel/trace v1.21.0 // indirect - go.uber.org/atomic v1.10.0 // indirect - go.uber.org/multierr v1.9.0 // indirect - golang.org/x/crypto v0.21.0 // indirect - golang.org/x/exp v0.0.0-20230905200255-921286631fa9 // indirect - golang.org/x/net v0.23.0 // indirect - golang.org/x/oauth2 v0.16.0 // indirect - golang.org/x/sync v0.6.0 // indirect - golang.org/x/sys v0.18.0 // indirect - golang.org/x/term v0.18.0 // indirect + go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect + go.opentelemetry.io/otel v1.22.0 // indirect + go.opentelemetry.io/otel/metric v1.22.0 // indirect + go.opentelemetry.io/otel/trace v1.22.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + golang.org/x/crypto v0.22.0 // indirect + golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect + golang.org/x/net v0.24.0 // indirect + golang.org/x/oauth2 v0.18.0 // indirect + golang.org/x/sync v0.7.0 // indirect + golang.org/x/sys v0.19.0 // indirect + golang.org/x/term v0.19.0 // indirect golang.org/x/text v0.14.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/api v0.155.0 // indirect + google.golang.org/api v0.162.0 // indirect google.golang.org/appengine v1.6.8 // indirect - google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 // indirect + google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect google.golang.org/protobuf v1.33.0 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect + gotest.tools/v3 v3.5.1 // indirect nhooyr.io/websocket v1.8.6 // indirect pgregory.net/rapid v1.1.0 // indirect sigs.k8s.io/yaml v1.4.0 // indirect @@ -199,7 +215,7 @@ replace ( // Use the cosmos-flavored keyring library github.com/99designs/keyring => github.com/cosmos/keyring v1.2.0 - github.com/cosmos/ibc-go/v7 => github.com/Team-Kujira/ibc-go/v7 v7.6.0-factory + github.com/cosmos/ibc-go/v8 => github.com/Team-Kujira/ibc-go/v8 v8.3.2-factory2 // dgrijalva/jwt-go is deprecated and doesn't receive security updates. // See: https://github.com/cosmos/cosmos-sdk/issues/13134 @@ -213,7 +229,4 @@ replace ( // Downgraded to avoid bugs in following commits which caused simulations to fail. // https://github.com/cosmos/cosmos-sdk/issues/14949 github.com/syndtr/goleveldb => github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 - - // https://github.com/cosmos/cosmos-sdk/issues/20159 - golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb ) diff --git a/go.sum b/go.sum index 10d08ee0..be5a40dd 100644 --- a/go.sum +++ b/go.sum @@ -1,13 +1,11 @@ cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.34.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= cloud.google.com/go v0.38.0/go.mod h1:990N+gfupTy94rShfmMCWGDn0LpTmnzTp2qbd1dvSRU= -cloud.google.com/go v0.43.0/go.mod h1:BOSR3VbTLkk6FDC/TcffxP4NF/FFBGA5ku+jvKOP7pg= cloud.google.com/go v0.44.1/go.mod h1:iSa0KzasP4Uvy3f1mN/7PiObzGgflwredwwASm/v6AU= cloud.google.com/go v0.44.2/go.mod h1:60680Gw3Yr4ikxnPRS/oxxkBccT6SA1yMk63TGekxKY= cloud.google.com/go v0.45.1/go.mod h1:RpBamKRgapWJb87xiFSdk4g1CME7QZg3uwTez+TSTjc= cloud.google.com/go v0.46.3/go.mod h1:a6bKKbmY7er1mI7TEI4lsAkts/mkhTSZK8w33B4RAg0= cloud.google.com/go v0.50.0/go.mod h1:r9sluTvynVuxRIOHXQEHMFffphuXHOMZMycpNR5e6To= -cloud.google.com/go v0.51.0/go.mod h1:hWtGJ6gnXH+KgDv+V0zFGDvpi07n3z8ZNj3T1RW0Gcw= cloud.google.com/go v0.52.0/go.mod h1:pXajvRH/6o3+F9jDHZWQ5PbGhn+o8w9qiu/CffaVdO4= cloud.google.com/go v0.53.0/go.mod h1:fp/UouUEsRkN6ryDKNW/Upv/JBKnv6WDthjR6+vze6M= cloud.google.com/go v0.54.0/go.mod h1:1rq2OEkV3YMf6n/9ZvGWI3GWw0VoqH/1x2nd8Is/bPc= @@ -57,7 +55,6 @@ cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUM cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc= cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ= cloud.google.com/go/bigquery v1.42.0/go.mod h1:8dRTJxhtG+vwBKzE5OseQn/hiydoQN3EedCaOdYmxRA= -cloud.google.com/go/bigtable v1.2.0/go.mod h1:JcVAOl45lrTmQfLj7T6TxyMzIN/3FGGcFm+2xVAli2o= cloud.google.com/go/billing v1.4.0/go.mod h1:g9IdKBEFlItS8bTtlrZdVLWSSdSyFUZKXNS02zKMOZY= cloud.google.com/go/billing v1.5.0/go.mod h1:mztb1tBc3QekhjSgmpf/CV4LzWXLzCArwpLmP2Gm88s= cloud.google.com/go/binaryauthorization v1.1.0/go.mod h1:xwnoWu3Y84jbuHa0zd526MJYmtnVXn0syOjaJgy4+dM= @@ -71,8 +68,8 @@ cloud.google.com/go/compute v1.6.0/go.mod h1:T29tfhtVbq1wvAPo0E3+7vhgmkOYeXjhFvz cloud.google.com/go/compute v1.6.1/go.mod h1:g85FgpzFvNULZ+S8AYq87axRKuf2Kh7deLqV/jJ3thU= cloud.google.com/go/compute v1.7.0/go.mod h1:435lt8av5oL9P3fv1OEzSbSUe+ybHXGMPQHHZWZxy9U= cloud.google.com/go/compute v1.10.0/go.mod h1:ER5CLbMxl90o2jtNbGSbtfOpQKR0t15FOtRsugnLrlU= -cloud.google.com/go/compute v1.23.3 h1:6sVlXXBmbd7jNX0Ipq0trII3e4n1/MsADLK6a+aiVlk= -cloud.google.com/go/compute v1.23.3/go.mod h1:VCgBUoMnIVIR0CscqQiPJLAG25E3ZRZMzcFZeQ+h8CI= +cloud.google.com/go/compute v1.24.0 h1:phWcR2eWzRJaL/kOiJwfFsPs4BaKq1j6vnpZrc1YlVg= +cloud.google.com/go/compute v1.24.0/go.mod h1:kw1/T+h/+tK2LJK0wiPPx1intgdAM3j/g3hFDlscY40= cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY= cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA= cloud.google.com/go/containeranalysis v0.5.1/go.mod h1:1D92jd8gRR/c0fGMlymRgxWD3Qw9C1ff6/T7mLgVL8I= @@ -112,8 +109,8 @@ cloud.google.com/go/gkehub v0.10.0/go.mod h1:UIPwxI0DsrpsVoWpLB0stwKCP+WFVG9+y97 cloud.google.com/go/grafeas v0.2.0/go.mod h1:KhxgtF2hb0P191HlY5besjYm6MqTSTj3LSI+M+ByZHc= cloud.google.com/go/iam v0.3.0/go.mod h1:XzJPvDayI+9zsASAFO68Hk07u3z+f+JrT2xXNdp4bnY= cloud.google.com/go/iam v0.5.0/go.mod h1:wPU9Vt0P4UmCux7mqtRu6jcpPAb74cP1fh50J3QpkUc= -cloud.google.com/go/iam v1.1.5 h1:1jTsCu4bcsNsE4iiqNT5SHwrDRCfRmIaaaVFhRveTJI= -cloud.google.com/go/iam v1.1.5/go.mod h1:rB6P/Ic3mykPbFio+vo7403drjlgvoWfYpJhMXEbzv8= +cloud.google.com/go/iam v1.1.6 h1:bEa06k05IO4f4uJonbB5iAgKTPpABy1ayxaIZV/GHVc= +cloud.google.com/go/iam v1.1.6/go.mod h1:O0zxdPeGBoFdWW3HWmBxJsk0pfvNM/p/qa82rWOGTwI= cloud.google.com/go/language v1.4.0/go.mod h1:F9dRpNFQmJbkaop6g0JhSBXCNlO90e1KWx5iDdxbWic= cloud.google.com/go/language v1.6.0/go.mod h1:6dJ8t3B+lUYfStgls25GusK04NLh3eDLQnWM3mdEbhI= cloud.google.com/go/lifesciences v0.5.0/go.mod h1:3oIKy8ycWGPUyZDR/8RNnTOYevhaMLqh5vLUXs9zvT8= @@ -187,11 +184,14 @@ cloud.google.com/go/webrisk v1.4.0/go.mod h1:Hn8X6Zr+ziE2aNd8SliSDWpEnSS1u4R9+xX cloud.google.com/go/webrisk v1.5.0/go.mod h1:iPG6fr52Tv7sGk0H6qUFzmL3HHZev1htXuWDEEsqMTg= cloud.google.com/go/workflows v1.6.0/go.mod h1:6t9F5h/unJz41YqfBmqSASJSXccBLtD1Vwf+KmJENM0= cloud.google.com/go/workflows v1.7.0/go.mod h1:JhSrZuVZWuiDfKEFxU0/F1PQjmpnpcoISEXH2bcHC3M= -collectd.org v0.3.0/go.mod h1:A/8DzQBkF6abtvrT2j/AU/4tiBgJWYyh0y/oB/4MlWE= -cosmossdk.io/api v0.3.1 h1:NNiOclKRR0AOlO4KIqeaG6PS6kswOMhHD0ir0SscNXE= -cosmossdk.io/api v0.3.1/go.mod h1:DfHfMkiNA2Uhy8fj0JJlOCYOBp4eWUUJ1te5zBGNyIw= -cosmossdk.io/core v0.6.1 h1:OBy7TI2W+/gyn2z40vVvruK3di+cAluinA6cybFbE7s= -cosmossdk.io/core v0.6.1/go.mod h1:g3MMBCBXtxbDWBURDVnJE7XML4BG5qENhs0gzkcpuFA= +cosmossdk.io/api v0.7.5 h1:eMPTReoNmGUm8DeiQL9DyM8sYDjEhWzL1+nLbI9DqtQ= +cosmossdk.io/api v0.7.5/go.mod h1:IcxpYS5fMemZGqyYtErK7OqvdM0C8kdW3dq8Q/XIG38= +cosmossdk.io/client/v2 v2.0.0-beta.1 h1:XkHh1lhrLYIT9zKl7cIOXUXg2hdhtjTPBUfqERNA1/Q= +cosmossdk.io/client/v2 v2.0.0-beta.1/go.mod h1:JEUSu9moNZQ4kU3ir1DKD5eU4bllmAexrGWjmb9k8qU= +cosmossdk.io/collections v0.4.0 h1:PFmwj2W8szgpD5nOd8GWH6AbYNi1f2J6akWXJ7P5t9s= +cosmossdk.io/collections v0.4.0/go.mod h1:oa5lUING2dP+gdDquow+QjlF45eL1t4TJDypgGd+tv0= +cosmossdk.io/core v0.11.0 h1:vtIafqUi+1ZNAE/oxLOQQ7Oek2n4S48SWLG8h/+wdbo= +cosmossdk.io/core v0.11.0/go.mod h1:LaTtayWBSoacF5xNzoF8tmLhehqlA9z1SWiPuNC6X1w= cosmossdk.io/depinject v1.0.0-alpha.4 h1:PLNp8ZYAMPTUKyG9IK2hsbciDWqna2z1Wsl98okJopc= cosmossdk.io/depinject v1.0.0-alpha.4/go.mod h1:HeDk7IkR5ckZ3lMGs/o91AVUc7E596vMaOmslGFM3yU= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= @@ -200,32 +200,39 @@ cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/simapp v0.0.0-20230224204036-a6adb0821462 h1:g8muUHnXL8vhld2Sjilyhb1UQObc+x9GVuDK43TYZns= -cosmossdk.io/simapp v0.0.0-20230224204036-a6adb0821462/go.mod h1:4Dd3NLoLYoN90kZ0uyHoTHzVVk9+J0v4HhZRBNTAq2c= -cosmossdk.io/tools/rosetta v0.2.1 h1:ddOMatOH+pbxWbrGJKRAawdBkPYLfKXutK9IETnjYxw= -cosmossdk.io/tools/rosetta v0.2.1/go.mod h1:Pqdc1FdvkNV3LcNIkYWt2RQY6IP1ge6YWZk8MhhO9Hw= -filippo.io/edwards25519 v1.0.0-rc.1/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= +cosmossdk.io/store v1.1.0 h1:LnKwgYMc9BInn9PhpTFEQVbL9UK475G2H911CGGnWHk= +cosmossdk.io/store v1.1.0/go.mod h1:oZfW/4Fc/zYqu3JmQcQdUJ3fqu5vnYTn3LZFFy8P8ng= +cosmossdk.io/tools/confix v0.1.1 h1:aexyRv9+y15veH3Qw16lxQwo+ki7r2I+g0yNTEFEQM8= +cosmossdk.io/tools/confix v0.1.1/go.mod h1:nQVvP1tHsGXS83PonPVWJtSbddIqyjEw99L4M3rPJyQ= +cosmossdk.io/x/circuit v0.1.0 h1:IAej8aRYeuOMritczqTlljbUVHq1E85CpBqaCTwYgXs= +cosmossdk.io/x/circuit v0.1.0/go.mod h1:YDzblVE8+E+urPYQq5kq5foRY/IzhXovSYXb4nwd39w= +cosmossdk.io/x/evidence v0.1.0 h1:J6OEyDl1rbykksdGynzPKG5R/zm6TacwW2fbLTW4nCk= +cosmossdk.io/x/evidence v0.1.0/go.mod h1:hTaiiXsoiJ3InMz1uptgF0BnGqROllAN8mwisOMMsfw= +cosmossdk.io/x/feegrant v0.1.0 h1:c7s3oAq/8/UO0EiN1H5BIjwVntujVTkYs35YPvvrdQk= +cosmossdk.io/x/feegrant v0.1.0/go.mod h1:4r+FsViJRpcZif/yhTn+E0E6OFfg4n0Lx+6cCtnZElU= +cosmossdk.io/x/nft v0.1.0 h1:VhcsFiEK33ODN27kxKLa0r/CeFd8laBfbDBwYqCyYCM= +cosmossdk.io/x/nft v0.1.0/go.mod h1:ec4j4QAO4mJZ+45jeYRnW7awLHby1JZANqe1hNZ4S3g= +cosmossdk.io/x/tx v0.13.3 h1:Ha4mNaHmxBc6RMun9aKuqul8yHiL78EKJQ8g23Zf73g= +cosmossdk.io/x/tx v0.13.3/go.mod h1:I8xaHv0rhUdIvIdptKIqzYy27+n2+zBVaxO6fscFhys= +cosmossdk.io/x/upgrade v0.1.1 h1:aoPe2gNvH+Gwt/Pgq3dOxxQVU3j5P6Xf+DaUJTDZATc= +cosmossdk.io/x/upgrade v0.1.1/go.mod h1:MNLptLPcIFK9CWt7Ra//8WUZAxweyRDNcbs5nkOcQy0= +dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU= filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek= filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns= -git.sr.ht/~sircmpwn/getopt v0.0.0-20191230200459-23622cc906b3/go.mod h1:wMEGFFFNuPos7vHmWXfszqImLppbc0wEhh6JBfJIUgw= -git.sr.ht/~sircmpwn/go-bare v0.0.0-20210406120253-ab86bc2846d9/go.mod h1:BVJwbDfVjCjoFiKrhkei6NdGcZYpkDkdyCdg1ukytRA= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 h1:/vQbFIOMbk2FiG/kXiLl8BRyzTWDw7gX/Hz7Dd5eDMs= github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4/go.mod h1:hN7oaIRCjzsZ2dE+yG5k+rsdt3qcwykqK6HVGcKwsw4= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.21.1/go.mod h1:fBF9PQNqB8scdgpZ3ufzaLntG0AG7C1WjPMsiFOmfHM= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= -github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= -github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 h1:L/gRVlceqvL25UVaW/CKtUDjefjrs0SPonmDGUVOYP0= +github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= -github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= -github.com/CosmWasm/wasmd v0.45.0 h1:9zBqrturKJwC2kVsfHvbrA++EN0PS7UTXCffCGbg6JI= -github.com/CosmWasm/wasmd v0.45.0/go.mod h1:RnSAiqbNIZu4QhO+0pd7qGZgnYAMBPGmXpzTADag944= -github.com/CosmWasm/wasmvm v1.5.2 h1:+pKB1Mz9GZVt1vadxB+EDdD1FOz3dMNjIKq/58/lrag= -github.com/CosmWasm/wasmvm v1.5.2/go.mod h1:Q0bSEtlktzh7W2hhEaifrFp1Erx11ckQZmjq8FLCyys= -github.com/DATA-DOG/go-sqlmock v1.3.3/go.mod h1:f/Ixk793poVmq4qj/V1dPUg2JEAKC73Q5eFN3EC/SaM= +github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= +github.com/CosmWasm/wasmd v0.51.0 h1:3A2o20RrdF7P1D3Xb+R7A/pHbbHWsYCDXrHLa7S0SC8= +github.com/CosmWasm/wasmd v0.51.0/go.mod h1:7TSaj5HoolghujuVWeExqmcUKgpcYWEySGLSODbnnwY= +github.com/CosmWasm/wasmvm/v2 v2.0.1 h1:0YCQ7MKGNri7NFeRp75erPJXrqyCtH4gdc9jMstyMzk= +github.com/CosmWasm/wasmvm/v2 v2.0.1/go.mod h1:su9lg5qLr7adV95eOfzjZWkGiky8WNaNIHDr7Fpu7Ck= +github.com/DataDog/datadog-go v3.2.0+incompatible h1:qSG2N4FghB1He/r2mFrWKCaL7dXCilEuNEeAn20fdD4= github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ= -github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= +github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ= +github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= @@ -235,51 +242,33 @@ github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= -github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/Team-Kujira/ibc-go/v7 v7.6.0-factory h1:4Edl+r31RnJZef3YPXnslz2Anh82khVUGCh931RIcBU= -github.com/Team-Kujira/ibc-go/v7 v7.6.0-factory/go.mod h1:LifBA7JHRHl95ujjHIaBEHmUqy2qCGyqDCXB7qmAsZk= -github.com/VictoriaMetrics/fastcache v1.6.0/go.mod h1:0qHz5QP0GMX4pfmMA/zt5RgfNuXJrTP0zS7DqpHGGTw= +github.com/Team-Kujira/ibc-go/v8 v8.3.2-factory2 h1:ryXabic11aQN86ya29KLB+qvXNFXAwtEsJElfRL92+U= +github.com/Team-Kujira/ibc-go/v8 v8.3.2-factory2/go.mod h1:WVVIsG39jGrF9Cjggjci6LzySyWGloz194sjTxiGNIE= github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE= github.com/VividCortex/gohistogram v1.0.0/go.mod h1:Pf5mBqqDxYaXu3hDrrU+w6nw50o/4+TcAqDqk/vUH7g= -github.com/Zilliqa/gozilliqa-sdk v1.2.1-0.20201201074141-dd0ecada1be6/go.mod h1:eSYp2T6f0apnuW8TzhV3f6Aff2SE8Dwio++U4ha4yEM= github.com/adlio/schema v1.3.3 h1:oBJn8I02PyTB466pZO1UZEn1TV5XLlifBSyMrmHl/1I= github.com/adlio/schema v1.3.3/go.mod h1:1EsRssiv9/Ce2CMzq5DoL7RiMshhuigQxrR4DMV9fHg= -github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5/go.mod h1:SkGFH1ia65gfNATL8TAiHDNxPzPdmEL5uirI2Uyuz6c= -github.com/ajstarks/svgo v0.0.0-20180226025133-644b8db467af/go.mod h1:K08gAheRH3/J6wwsYMMT4xOr94bZjxIelGM0+d/wbFw= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho= -github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= -github.com/andreyvit/diff v0.0.0-20170406064948-c7f18ee00883/go.mod h1:rCTlJbsFo29Kk6CurOXKm700vrz8f0KW0JNfpkRJY/8= github.com/antihax/optional v1.0.0/go.mod h1:uupD/76wgC+ih3iEmQUL+0Ugr19nfwCT1kdvxnR2qWY= -github.com/apache/arrow/go/arrow v0.0.0-20191024131854-af6fa24be0db/go.mod h1:VTxUBvSJ3s3eHAg65PNgrsn5BtqCRPdmyXh6rAfdxN0= github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ= github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o= github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmVTwzkszR9V5SSuryQ31EELlFMUz1kKyl939pY= -github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= -github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo= github.com/aws/aws-sdk-go v1.44.122/go.mod h1:y4AeaBuwd2Lk+GepC1E9v0qOiTws0MIWAX4oIKwKHZo= -github.com/aws/aws-sdk-go v1.44.203 h1:pcsP805b9acL3wUqa4JR2vg1k2wnItkDYNvfmcy6F+U= -github.com/aws/aws-sdk-go v1.44.203/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= +github.com/aws/aws-sdk-go v1.44.224 h1:09CiaaF35nRmxrzWZ2uRq5v6Ghg/d2RiPjZnSgtt+RQ= +github.com/aws/aws-sdk-go v1.44.224/go.mod h1:aVsgQcEevwlmQ7qHE9I3h+dtQgpqhFB+i8Phjh7fkwI= github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g= -github.com/aws/aws-sdk-go-v2 v1.2.0/go.mod h1:zEQs02YRBw1DjK0PoJv3ygDYOFTre1ejlJWl8FwAuQo= -github.com/aws/aws-sdk-go-v2/config v1.1.1/go.mod h1:0XsVy9lBI/BCXm+2Tuvt39YmdHwS5unDQmxZOYe8F5Y= -github.com/aws/aws-sdk-go-v2/credentials v1.1.1/go.mod h1:mM2iIjwl7LULWtS6JCACyInboHirisUUdkBPoTHMOUo= -github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.0.2/go.mod h1:3hGg3PpiEjHnrkrlasTfxFqUsZ2GCk/fMUn4CbKgSkM= -github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.0.2/go.mod h1:45MfaXZ0cNbeuT0KQ1XJylq8A6+OpVV2E5kvY/Kq+u8= -github.com/aws/aws-sdk-go-v2/service/route53 v1.1.1/go.mod h1:rLiOUrPLW/Er5kRcQ7NkwbjlijluLsrIbu/iyl35RO4= -github.com/aws/aws-sdk-go-v2/service/sso v1.1.1/go.mod h1:SuZJxklHxLAXgLTc1iFXbEWkXs7QRTQpCLGaKIprQW0= -github.com/aws/aws-sdk-go-v2/service/sts v1.1.1/go.mod h1:Wi0EBZwiz/K44YliU0EKxqTCJGUfYTWXrrBwkq736bM= -github.com/aws/smithy-go v1.1.0/go.mod h1:EzMw8dbp/YJL4A5/sbhGddag+NPT7q084agLbB9LgIw= +github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -289,40 +278,19 @@ github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d/go.mod h1:6QX/PXZ github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2gVpmOtVTJZNodLdLQLn/KsJqFvXwnd/s= github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= -github.com/bmizerany/pat v0.0.0-20170815010413-6226ea591a40/go.mod h1:8rLXio+WjiTceGBHIoTvn60HIbs7Hm7bcHjyrSqYB9c= -github.com/boltdb/bolt v1.3.1/go.mod h1:clJnj/oiGkjum5o1McbSZDSLxVThjynRyGBgiAx27Ps= -github.com/btcsuite/btcd v0.0.0-20190315201642-aa6e0f35703c/go.mod h1:DrZx5ec/dmnfpw9KyYoQyYo7d0KEvTkk/5M/vbZjAr8= -github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= -github.com/btcsuite/btcd v0.21.0-beta.0.20201114000516-e9c7a5ac6401/go.mod h1:Sv4JPQ3/M+teHz9Bo5jBpkNcP0x6r7rdihlNL/7tTAs= -github.com/btcsuite/btcd v0.22.1 h1:CnwP9LM/M9xuRrGSCGeMVs9iv09uMqwsVX7EeIpgV2c= -github.com/btcsuite/btcd v0.22.1/go.mod h1:wqgTSL29+50LRkmOVknEdmt8ZojIzhuWvgu/iptuN7Y= -github.com/btcsuite/btcd/btcec/v2 v2.1.2/go.mod h1:ctjw4H1kknNJmRN4iP1R7bTQ+v3GJkZBd6mui8ZsAZE= +github.com/bits-and-blooms/bitset v1.8.0 h1:FD+XqgOZDUxxZ8hzoBFuV9+cGWY9CslN6d5MS5JVb4c= +github.com/bits-and-blooms/bitset v1.8.0/go.mod h1:7hO7Gc7Pp1vODcmWvKMRA9BNmbv6a/7QIWpPxHddWR8= github.com/btcsuite/btcd/btcec/v2 v2.3.2 h1:5n0X6hX0Zk+6omWcihdYvdAlGf2DfasC0GMf7DClJ3U= github.com/btcsuite/btcd/btcec/v2 v2.3.2/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= -github.com/btcsuite/btcd/btcutil v1.1.2 h1:XLMbX8JQEiwMcYft2EGi8zPUkoa0abKIU6/BJSRsjzQ= -github.com/btcsuite/btcd/btcutil v1.1.2/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= -github.com/btcsuite/btcd/chaincfg/chainhash v1.0.0/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= +github.com/btcsuite/btcd/btcutil v1.1.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= +github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1 h1:q0rUy8C/TYNBQS1+CGKw68tLOFYSNEs0TFnxxnS9+4U= github.com/btcsuite/btcd/chaincfg/chainhash v1.0.1/go.mod h1:7SFka0XMvUgj3hfZtydOrQY2mwhPclbT2snogU7SQQc= -github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= -github.com/btcsuite/btcutil v0.0.0-20190207003914-4c204d697803/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil v1.0.2/go.mod h1:j9HUFwoQRsZL3V4n+qG+CUnEGHOarIxfC3Le2Yhbcts= -github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= -github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= -github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= -github.com/btcsuite/goleveldb v1.0.0/go.mod h1:QiK9vBlgftBg6rWQIj6wFzbPfRjiykIEhBH4obrXJ/I= -github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/snappy-go v1.0.0/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc= -github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY= -github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs= -github.com/bufbuild/protocompile v0.4.0 h1:LbFKd2XowZvQ/kajzguUp2DC9UEIQhIq77fZZlaQsNA= -github.com/bufbuild/protocompile v0.4.0/go.mod h1:3v93+mbWn/v3xzN+31nwkJfrEpAUwp+BagBSZWx+TP8= -github.com/bwesterb/go-ristretto v1.2.0/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/bufbuild/protocompile v0.6.0 h1:Uu7WiSQ6Yj9DbkdnOe7U4mNKp58y9WDMKDn28/ZlunY= +github.com/bufbuild/protocompile v0.6.0/go.mod h1:YNP35qEYoYGme7QMtz5SBCoN4kL4g12jTtjuzRNdjpE= github.com/bytedance/sonic v1.5.0/go.mod h1:ED5hyg4y6t3/9Ku1R6dU/4KyJ48DZ4jPhfY1O2AihPM= github.com/bytedance/sonic v1.8.0 h1:ea0Xadu+sHlu7x5O3gKhRpQ1IKiMrSiHttPF0ybECuA= github.com/bytedance/sonic v1.8.0/go.mod h1:i736AoUSYt75HyZLoJW9ERYxcy6eaN6h4BZXU064P/U= -github.com/c-bata/go-prompt v0.2.2/go.mod h1:VzqtzE2ksDBcdln8G7mk2RX9QyGjH+OVqOCSiVIqS34= github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= @@ -330,12 +298,11 @@ github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInq github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4= github.com/cenkalti/backoff/v4 v4.1.3/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw= github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU= -github.com/cespare/cp v0.1.0/go.mod h1:SOGHArjBr4JWaSDEVpWpo/hNg6RoKrls6Oh40hiwW+s= github.com/cespare/xxhash v1.1.0 h1:a6HrQnmkObjyL+Gs60czilIUGqrzKutQD6XZog3p+ko= github.com/cespare/xxhash v1.1.0/go.mod h1:XrSqR1VqqWfGrhpAt58auRo0WTKS1nRRg3ghfAqPWnc= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= -github.com/cespare/xxhash/v2 v2.2.0 h1:DC2CZ1Ep5Y4k3ZQ899DldepgrayRUGE6BBZ/cd9Cj44= -github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cheggaaa/pb v1.0.27/go.mod h1:pQciLPpbU0oxA0h+VJYYLxO+XeDQb5pZijXscXHm81s= github.com/chenzhuoyu/base64x v0.0.0-20211019084208-fb5309c8db06/go.mod h1:DH46F32mSOjUmXrMHnKwZdA8wcEefY7UVqBKYGjpdQY= github.com/chenzhuoyu/base64x v0.0.0-20221115062448-fe3a3abad311 h1:qSGYFH7+jGhDF8vLC+iwCD4WpbV1EBDSzWkJODFLams= @@ -353,7 +320,6 @@ github.com/circonus-labs/circonus-gometrics v2.3.1+incompatible/go.mod h1:nmEj6D github.com/circonus-labs/circonusllhist v0.1.3/go.mod h1:kMXHVDlOchFAehlya5ePtbp5jckzBHf4XRpQvBOLI+I= github.com/clbanning/x2j v0.0.0-20191024224557-825249438eec/go.mod h1:jMjuTZXRI4dUb/I5gc9Hdhagfvm9+RyrPryS/auMzxE= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= -github.com/cloudflare/cloudflare-go v0.14.0/go.mod h1:EnwdgGMaFOruiPZRFSgn+TsQ3hQ7C/YWzIGLeu5c304= github.com/cncf/udpa/go v0.0.0-20191209042840-269d4d468f6f/go.mod h1:M8M6+tZqaGXZJjfX53e64911xZQV5JYwmTeXPW+k8Sc= github.com/cncf/udpa/go v0.0.0-20200629203442-efcf912fb354/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= @@ -368,26 +334,25 @@ github.com/cncf/xds/go v0.0.0-20231128003011-0fa0005c9caa/go.mod h1:x/1Gn8zydmfq github.com/cockroachdb/apd/v2 v2.0.2 h1:weh8u7Cneje73dDh+2tEVLUvyBc89iwepWCD8b8034E= github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOGr0B9pvN3Gw= github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= -github.com/cockroachdb/errors v1.10.0 h1:lfxS8zZz1+OjtV4MtNWgboi/W5tyLEB6VQZBXN+0VUU= -github.com/cockroachdb/errors v1.10.0/go.mod h1:lknhIsEVQ9Ss/qKDBQS/UqFSvPQjOwNq2qyKAxtHRqE= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f h1:otljaYPt5hWxV3MUfO5dFPFiOXg9CyG5/kCfayTqsJ4= +github.com/cockroachdb/datadriven v1.0.3-0.20230413201302-be42291fc80f/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= +github.com/cockroachdb/errors v1.11.1 h1:xSEW75zKaKCWzR3OfxXUxgrk/NtT4G1MiOv5lWZazG8= +github.com/cockroachdb/errors v1.11.1/go.mod h1:8MUxA3Gi6b25tYlFEBGLf+D8aISL+M4MIpiWMSNRfxw= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b h1:r6VH0faHjZeQy818SGhaone5OnYfxFR/+AzdY3sf5aE= github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b/go.mod h1:Vz9DsVWQQhf3vs21MhPMZpMGSht7O/2vFW2xusFUVOs= +github.com/cockroachdb/pebble v1.1.0 h1:pcFh8CdCIt2kmEpK0OIatq67Ln9uGDYY3d5XnE0LJG4= +github.com/cockroachdb/pebble v1.1.0/go.mod h1:sEHm5NOXxyiAoKWhoFxT8xMgd/f3RA6qUqQ1BXKrh2E= github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwPJ30= github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= +github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= github.com/codahale/hdrhistogram v0.0.0-20161010025455-3a0bb77429bd/go.mod h1:sE/e/2PUdi/liOCUjSTXgM1o87ZssimdTWN964YiIeI= -github.com/coinbase/kryptology v1.8.0/go.mod h1:RYXOAPdzOGUe3qlSFkMGn58i3xUA8hmxYHksuq+8ciI= -github.com/coinbase/rosetta-sdk-go v0.7.9 h1:lqllBjMnazTjIqYrOGv8h8jxjg9+hJazIGZr9ZvoCcA= -github.com/coinbase/rosetta-sdk-go v0.7.9/go.mod h1:0/knutI7XGVqXmmH4OQD8OckFrbQ8yMsUZTG7FXCR2M= -github.com/cometbft/cometbft v0.37.5 h1:/U/TlgMh4NdnXNo+YU9T2NMCWyhXNDF34Mx582jlvq0= -github.com/cometbft/cometbft v0.37.5/go.mod h1:QC+mU0lBhKn8r9qvmnq53Dmf3DWBt4VtkcKw2C81wxY= -github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo= -github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0= -github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4= -github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak= -github.com/consensys/bavard v0.1.8-0.20210406032232-f3452dc9b572/go.mod h1:Bpd0/3mZuaj6Sj+PqrmIquiOKy397AKGThQPaGzNXAQ= -github.com/consensys/bavard v0.1.8-0.20210915155054-088da2f7f54a/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= -github.com/consensys/gnark-crypto v0.4.1-0.20210426202927-39ac3d4b3f1f/go.mod h1:815PAHg3wvysy0SyIqanF8gZ0Y1wjk/hrDHD/iT88+Q= -github.com/consensys/gnark-crypto v0.5.3/go.mod h1:hOdPlWQV1gDLp7faZVeg8Y0iEPFaOUnCc4XeCCk96p0= +github.com/coinbase/rosetta-sdk-go/types v1.0.0 h1:jpVIwLcPoOeCR6o1tU+Xv7r5bMONNbHU7MuEHboiFuA= +github.com/coinbase/rosetta-sdk-go/types v1.0.0/go.mod h1:eq7W2TMRH22GTW0N0beDnN931DW0/WOI1R2sdHNHG4c= +github.com/cometbft/cometbft v0.38.7 h1:ULhIOJ9+LgSy6nLekhq9ae3juX3NnQUMMPyVdhZV6Hk= +github.com/cometbft/cometbft v0.38.7/go.mod h1:HIyf811dFMI73IE0F7RrnY/Fr+d1+HuJAgtkEpQjCMY= +github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= +github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= @@ -398,80 +363,70 @@ github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSV github.com/coreos/pkg v0.0.0-20160727233714-3ac0863d7acf/go.mod h1:E3G3o1h8I7cfcXa63jLwjI0eiQQMgzzUDFVpN/nH/eA= github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk= github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis= +github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAKs= +github.com/cosmos/cosmos-db v1.0.2/go.mod h1:Z8IXcFJ9PqKK6BIsVOB3QXtkKoqUOp1vRvPT39kOXEA= github.com/cosmos/cosmos-proto v1.0.0-beta.5 h1:eNcayDLpip+zVLRLYafhzLvQlSmyab+RC5W7ZfmxJLA= github.com/cosmos/cosmos-proto v1.0.0-beta.5/go.mod h1:hQGLpiIUloJBMdQMMWb/4wRApmI9hjHH05nefC0Ojec= -github.com/cosmos/cosmos-sdk v0.47.12 h1:KOZHAVWrcilHywBN/FabBaXbDFMzoFmtdX0hqy5Ory8= -github.com/cosmos/cosmos-sdk v0.47.12/go.mod h1:ADjORYzUQqQv/FxDi0H0K5gW/rAk1CiDR3ZKsExfJV0= -github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y= +github.com/cosmos/cosmos-sdk v0.50.7 h1:LsBGKxifENR/DN4E1RZaitsyL93HU44x0p8EnMHp4V4= +github.com/cosmos/cosmos-sdk v0.50.7/go.mod h1:84xDDJEHttRT7NDGwBaUOLVOMN0JNE9x7NbsYIxXs1s= github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY= github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw= github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE= github.com/cosmos/gogogateway v1.2.0/go.mod h1:iQpLkGWxYcnCdz5iAdLcRBSw3h7NXeOkZ4GUkT+tbFI= github.com/cosmos/gogoproto v1.4.2/go.mod h1:cLxOsn1ljAHSV527CHOtaIP91kK6cCrZETRBrkzItWU= -github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI= -github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek= -github.com/cosmos/iavl v0.20.1 h1:rM1kqeG3/HBT85vsZdoSNsehciqUQPWrR4BYmqE2+zg= -github.com/cosmos/iavl v0.20.1/go.mod h1:WO7FyvaZJoH65+HFOsDir7xU9FWk2w9cHXNW1XHcl7A= -github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.1.1-0.20231213092633-b306e7a706e1 h1:fCtG9qasnNzhgxGR1jM9eBufZ5WQVpy0KdaOpKRfg8Y= -github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.1.1-0.20231213092633-b306e7a706e1/go.mod h1:h114vYKBtI5zKBeSyr8y5JZ8ZtpQJInO4TYww2IQr6o= +github.com/cosmos/gogoproto v1.4.12 h1:vB6Lbe/rtnYGjQuFxkPiPYiCybqFT8QvLipDZP8JpFE= +github.com/cosmos/gogoproto v1.4.12/go.mod h1:LnZob1bXRdUoqMMtwYlcR3wjiElmlC+FkjaZRv1/eLY= +github.com/cosmos/iavl v1.1.2 h1:zL9FK7C4L/P4IF1Dm5fIwz0WXCnn7Bp1M2FxH0ayM7Y= +github.com/cosmos/iavl v1.1.2/go.mod h1:jLeUvm6bGT1YutCaL2fIar/8vGUE8cPZvh/gXEWDaDM= +github.com/cosmos/ibc-go/modules/capability v1.0.0 h1:r/l++byFtn7jHYa09zlAdSeevo8ci1mVZNO9+V0xsLE= +github.com/cosmos/ibc-go/modules/capability v1.0.0/go.mod h1:D81ZxzjZAe0ZO5ambnvn1qedsFQ8lOwtqicG6liLBco= +github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.2.1-0.20240523101951-4b45d1822fb6 h1:cq9xPsRYXr1DJG0h1rrxlE+JKZh7s5z/jSgnG2YmR18= +github.com/cosmos/ibc-go/modules/light-clients/08-wasm v0.2.1-0.20240523101951-4b45d1822fb6/go.mod h1:ab73pB/hwAFSa98oUwtMiNF6T1NyRwo6sjLjaYrkHHI= github.com/cosmos/ics23/go v0.10.0 h1:iXqLLgp2Lp+EdpIuwXTYIQU+AiHj9mOC2X9ab++bZDM= github.com/cosmos/ics23/go v0.10.0/go.mod h1:ZfJSmng/TBNTBkFemHHHj5YY7VAU/MBU980F4VU1NG0= github.com/cosmos/keyring v1.2.0 h1:8C1lBP9xhImmIabyXW4c3vFjjLiBdGCmfLUfeZlV1Yo= github.com/cosmos/keyring v1.2.0/go.mod h1:fc+wB5KTk9wQ9sDx0kFXB3A0MaeGHM9AwRStKOQ5vOA= -github.com/cosmos/ledger-cosmos-go v0.12.4 h1:drvWt+GJP7Aiw550yeb3ON/zsrgW0jgh5saFCr7pDnw= -github.com/cosmos/ledger-cosmos-go v0.12.4/go.mod h1:fjfVWRf++Xkygt9wzCsjEBdjcf7wiiY35fv3ctT+k4M= +github.com/cosmos/ledger-cosmos-go v0.13.3 h1:7ehuBGuyIytsXbd4MP43mLeoN2LTOEnk5nvue4rK+yM= +github.com/cosmos/ledger-cosmos-go v0.13.3/go.mod h1:HENcEP+VtahZFw38HZ3+LS3Iv5XV6svsnkk9vdJtLr8= +github.com/cosmos/rosetta v0.50.4 h1:CbdzULUyHRkSbvUGDGnaL8vUxiA6vte/hZW2GF2aRWY= +github.com/cosmos/rosetta v0.50.4/go.mod h1:jsYdk/QwwxhZHGAFHhlRNaTqASK9pi6jqNs9+NClGso= github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= github.com/cosmos/rosetta-sdk-go v0.10.0/go.mod h1:SImAZkb96YbwvoRkzSMQB6noNJXFgWl/ENIznEoYQI4= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= -github.com/creachadair/taskgroup v0.4.2 h1:jsBLdAJE42asreGss2xZGZ8fJra7WtwnHWeJFxv2Li8= -github.com/creachadair/taskgroup v0.4.2/go.mod h1:qiXUOSrbwAY3u0JPGTzObbE3yf9hcXHDKBZ2ZjpCbgM= +github.com/creachadair/atomicfile v0.3.1 h1:yQORkHjSYySh/tv5th1dkKcn02NEW5JleB84sjt+W4Q= +github.com/creachadair/atomicfile v0.3.1/go.mod h1:mwfrkRxFKwpNAflYZzytbSwxvbK6fdGRRlp0KEQc0qU= +github.com/creachadair/tomledit v0.0.24 h1:5Xjr25R2esu1rKCbQEmjZYlrhFkDspoAbAKb6QKQDhQ= +github.com/creachadair/tomledit v0.0.24/go.mod h1:9qHbShRWQzSCcn617cMzg4eab1vbLCOjOshAWSzWr8U= github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/cyberdelia/templates v0.0.0-20141128023046-ca7fffd4298c/go.mod h1:GyV+0YP4qX0UQ7r2MoYZ+AvYDp12OF5yg4q8rGnyNh4= github.com/danieljoos/wincred v1.1.2 h1:QLdCxFs1/Yl4zduvBdcHB8goaYk9RARS2SgLLRuAyr0= github.com/danieljoos/wincred v1.1.2/go.mod h1:GijpziifJoIBfYh+S7BbkdUTU4LfM+QnGqR5Vl2tAx0= -github.com/dave/jennifer v1.2.0/go.mod h1:fIb+770HOpJ2fmN9EPPKOqm1vMGhB+TwXKMZhrIygKg= -github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc h1:U9qPSI2PIWSS1VwoXQT9A3Wy9MM3WgvqSxFWenqJduM= github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/deckarep/golang-set v1.8.0/go.mod h1:5nI87KwE7wgsBU1F4GKAw2Qod7p5kyS383rP6+o6qqo= -github.com/decred/dcrd/crypto/blake256 v1.0.0 h1:/8DMNYp9SGi5f0w7uCm6d6M4OU2rGFK09Y2A4Xv7EE0= -github.com/decred/dcrd/crypto/blake256 v1.0.0/go.mod h1:sQl2p6Y26YV+ZOcSTP6thNdn47hh8kt6rqSlvmrXFAc= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.0.1/go.mod h1:hyedUtir6IdtD/7lIxGeCxkaw7y45JueMRL4DIyJDKs= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 h1:HbphB4TFFXpv7MNrT52FGrrgVXF1owhMVTHFZIlnvd4= -github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0/go.mod h1:DZGJHZMqrU4JJqFAWUS2UO1+lbSKsdiOoYi9Zzey7Fc= -github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= -github.com/deepmap/oapi-codegen v1.6.0/go.mod h1:ryDa9AgbELGeB+YEXE1dR53yAjHwFvE9iAUlWl9Al3M= -github.com/deepmap/oapi-codegen v1.8.2/go.mod h1:YLgSKSDv/bZQB7N4ws6luhozi3cEdRktEqrX88CvjIw= +github.com/decred/dcrd/crypto/blake256 v1.0.1 h1:7PltbUIQB7u/FfZ39+DGa/ShuMyJ5ilcvdfma9wOH6Y= +github.com/decred/dcrd/crypto/blake256 v1.0.1/go.mod h1:2OfgNZ5wDpcsFmHmCK5gZTPcCXqlm2ArzUIkw9czNJo= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0 h1:8UrgZ3GkP4i/CLijOJx79Yu+etlyjdBU4sfcs2WYQMs= +github.com/decred/dcrd/dcrec/secp256k1/v4 v4.2.0/go.mod h1:v57UDF4pDQJcEfFUCRop3lJL149eHGSe9Jvczhzjo/0= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f h1:U5y3Y5UE0w7amNe7Z5G/twsBW0KEalRQXZzf8ufSh9I= github.com/desertbit/timer v0.0.0-20180107155436-c41aec40b27f/go.mod h1:xH/i4TFMt8koVQZ6WFms69WAsDWr2XsYL3Hkl7jkoLE= github.com/dgraph-io/badger/v2 v2.2007.4 h1:TRWBQg8UrlUhaFdco01nO2uXwzKS7zd+HVdwV/GHc4o= github.com/dgraph-io/badger/v2 v2.2007.4/go.mod h1:vSw/ax2qojzbN6eXHIx6KPKtCSHJN/Uz0X0VPruTIhk= github.com/dgraph-io/ristretto v0.0.3-0.20200630154024-f66de99634de/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= -github.com/dgraph-io/ristretto v0.0.3/go.mod h1:KPxhHT9ZxKefz+PCeOGsrHpl1qZ7i70dGTu2u+Ahh6E= github.com/dgraph-io/ristretto v0.1.1 h1:6CWw5tJNgpegArSHpNHJKldNeq03FQCwYvfMVWajOK8= github.com/dgraph-io/ristretto v0.1.1/go.mod h1:S1GPSBCYCIhmVNfcth17y2zZtQT6wzkzgwUve0VDWWA= -github.com/dgryski/go-bitstream v0.0.0-20180413035011-3522498ce2c8/go.mod h1:VMaSuZ+SZcx/wljOQKvp5srsbCiKDEb6K2wC4+PiBmQ= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 h1:fAjc9m62+UWV/WAFKLNi6ZS0675eEUC9y3AlwSbQu1Y= github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= -github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no= -github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= -github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= -github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= -github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/distribution/reference v0.5.0 h1:/FUIFXtfc/x2gpa5/VGfiGLuOIdYa1t65IKK2OFGvA0= +github.com/distribution/reference v0.5.0/go.mod h1:BbU0aIcezP1/5jX/8MP0YiH4SdvB5Y4f/wlDRiLyi3E= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= -github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= -github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/dustin/go-humanize v1.0.1 h1:GzkhY7T5VNhEkwH0PVJgjz+fX1rhBrR7pRT3mDkpeCY= @@ -481,8 +436,9 @@ github.com/dvsekhvalnov/jose2go v1.6.0/go.mod h1:QsHjhyTlD/lAVqn/NSbVZmSCGeDehTB github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1:+020luEh2TKB4/GOp8oxxtq0Daoen/Cii55CzbTV6DU= github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= -github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/emicklei/dot v1.6.1 h1:ujpDlBkkwgWUY+qPId5IwapRW/xEoligRSYjioR6DFI= +github.com/emicklei/dot v1.6.1/go.mod h1:DeV7GvQtIw4h2u73RKBkkFdvVAz0D9fzeJrgPW6gy/s= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -496,14 +452,12 @@ github.com/envoyproxy/go-control-plane v0.10.2-0.20220325020618-49ff273808a1/go. github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c= github.com/envoyproxy/protoc-gen-validate v1.0.4 h1:gVPz/FMfvh57HdSJQyvBtF00j8JU4zdyUgIUNhlgg0A= github.com/envoyproxy/protoc-gen-validate v1.0.4/go.mod h1:qys6tmnRsYrQqIhm2bvKZH4Blx/1gTIZ2UKVY1M+Yew= -github.com/ethereum/go-ethereum v1.10.17/go.mod h1:Lt5WzjM07XlXc95YzrhosmR4J9Ahd6X2wyEV2SvGhk0= github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4= github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk= -github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs= +github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw= github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= -github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5/go.mod h1:VvhXpOYNQvB+uIk2RvXzuaQtkQJzzIx6lSBe1xv7hi0= -github.com/fogleman/gg v1.2.1-0.20190220221249-0403632d5b90/go.mod h1:R/bRT+9gY/C5z7JzPU0zXsXHKM4/ayA+zqcVNZzPa1k= github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw= github.com/fortytw2/leaktest v1.3.0/go.mod h1:jDsjWgpAGjm2CA7WthBh/CdZYEPF31XHquHwclZch5g= github.com/franela/goblin v0.0.0-20200105215937-c9ffbefa60db/go.mod h1:7dvUGVsVBjqR7JHJk0brhHOZYGmfBYOrK0ZhYMEtBr4= @@ -514,26 +468,24 @@ github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMo github.com/fsnotify/fsnotify v1.4.9/go.mod h1:znqG4EE+3YCdAaPaxE2ZRY/06pZUdp0tY4IgpuI1SZQ= github.com/fsnotify/fsnotify v1.7.0 h1:8JEhPFa5W2WU7YfeZzPNqzMP6Lwt7L2715Ggo0nosvA= github.com/fsnotify/fsnotify v1.7.0/go.mod h1:40Bi/Hjc2AVfZrqy+aj+yEI+/bRxZnMJyTJwOpGvigM= -github.com/gballet/go-libpcsclite v0.0.0-20190607065134-2772fd86a8ff/go.mod h1:x7DCsMOv1taUwEWCzT4cmDeAkigA5/QCwUodaVOe8Ww= -github.com/getkin/kin-openapi v0.53.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getkin/kin-openapi v0.61.0/go.mod h1:7Yn5whZr5kJi6t+kShccXS8ae1APpYTW6yheSwk8Yi4= -github.com/getsentry/sentry-go v0.23.0 h1:dn+QRCeJv4pPt9OjVXiMcGIBIefaTJPw/h0bZWO05nE= -github.com/getsentry/sentry-go v0.23.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= +github.com/getsentry/sentry-go v0.27.0 h1:Pv98CIbtB3LkMWmXi4Joa5OOcwbmnX88sF5qbK3r3Ps= +github.com/getsentry/sentry-go v0.27.0/go.mod h1:lc76E2QywIyW8WuBnwl8Lc4bkmQH4+w1gwTf25trprY= github.com/ghodss/yaml v1.0.0/go.mod h1:4dBDuWmgqj2HViK6kFavaiC9ZROes6MMH2rRYeMEF04= github.com/gin-contrib/sse v0.1.0 h1:Y/yl/+YNO8GZSjAhjMsSuLt29uWRFHdHYUb5lYOV9qE= github.com/gin-contrib/sse v0.1.0/go.mod h1:RHrZQHXnP2xjPF+u1gW/2HnVO7nvIa9PG3Gm+fLHvGI= github.com/gin-gonic/gin v1.9.0 h1:OjyFBKICoexlu99ctXNR2gg+c5pKrKMuyjgARg9qeY8= github.com/gin-gonic/gin v1.9.0/go.mod h1:W1Me9+hsUSyj3CePGrd1/QrKJMSJ1Tu/0hFEH89961k= -github.com/glycerine/go-unsnap-stream v0.0.0-20180323001048-9f0cb55181dd/go.mod h1:/20jfyN9Y5QPEAprSgKAUr+glWDY39ZiUEAYOEv5dsE= -github.com/glycerine/goconvey v0.0.0-20190410193231-58a59202ab31/go.mod h1:Ogl1Tioa0aV7gstGFO7KhffUsb9M4ydbEbbxpcEDc24= -github.com/go-chi/chi/v5 v5.0.0/go.mod h1:BBug9lr0cqtdAhsu6R4AAdvufI0/XBzAQSsUqJpoZOs= github.com/go-errors/errors v1.4.2 h1:J6MZopCL4uSllY1OfXM374weqZFFItUbrImctkmUxIA= github.com/go-errors/errors v1.4.2/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-gl/glfw v0.0.0-20190409004039-e6da0acd62b1/go.mod h1:vR7hzQXu2zJy9AVAgeJqvqgH9Q5CA+iKCZ2gyEVpxRU= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20191125211704-12ad95a8df72/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= +github.com/go-gl/glfw/v3.3/glfw v0.0.0-20200222043503-6f7a984d4dc4/go.mod h1:tQ2UAYgL5IevRw8kRxooKSPJfGvJ9fJQFa0TUsXzTg8= github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as= github.com/go-kit/kit v0.10.0/go.mod h1:xUsJbQ/Fp4kEt7AFgCuvyX4a71u8h9jB8tj/ORgOZ7o= github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4= github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs= +github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY= github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU= github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0= github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE= @@ -542,13 +494,10 @@ github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= -github.com/go-logr/logr v1.3.0 h1:2y3SDp0ZXuc6/cjLSZ+Q3ir+QB9T/iG5yYRXqsagWSY= -github.com/go-logr/logr v1.3.0/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/logr v1.4.1 h1:pKouT5E8xu9zeFC39JXRDukb6JFQPXM5p5I91188VAQ= +github.com/go-logr/logr v1.4.1/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= -github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= -github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= -github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= github.com/go-playground/assert/v2 v2.2.0/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.14.1 h1:EWaQ/wswjilfKLTECiXz7Rh+3BjFhfDFKv/oXslEjJA= github.com/go-playground/locales v0.14.1/go.mod h1:hxrqLVvrK65+Rwrd5Fc6F2O76J/NuW9t0sjnWqG1slY= @@ -556,14 +505,14 @@ github.com/go-playground/universal-translator v0.18.1 h1:Bcnm0ZwsGyWbCzImXv+pAJn github.com/go-playground/universal-translator v0.18.1/go.mod h1:xekY+UJKNuX9WP91TpwSH2VMlDf28Uj24BCp08ZFTUY= github.com/go-playground/validator/v10 v10.11.2 h1:q3SHpufmypg+erIExEKUmsgmhDTyhcJ38oeKGACXohU= github.com/go-playground/validator/v10 v10.11.2/go.mod h1:NieE624vt4SCTJtD87arVLvdmjPAeV8BQlHtMnw9D7s= -github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-sql-driver/mysql v1.4.0/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= -github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG5ZlKdlhCg5w= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= -github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= -github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= +github.com/gobwas/httphead v0.1.0 h1:exrUm0f4YX0L7EBwZHuCF4GDp8aJfVeBrlLQrs6NqWU= +github.com/gobwas/httphead v0.1.0/go.mod h1:O/RXo79gxV8G+RqlR/otEwx4Q36zl9rqC5u12GKvMCM= github.com/gobwas/pool v0.2.0/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= +github.com/gobwas/pool v0.2.1 h1:xfeeEhW7pwmX8nuLVlqbzVc7udMDrwetjEv+TZIz1og= +github.com/gobwas/pool v0.2.1/go.mod h1:q8bcK0KcYlCgd9e7WYLm9LpyS+YeLd8JVDW6WezmKEw= github.com/gobwas/ws v1.0.2 h1:CoAavW/wd/kulfZmSIBt6p24n4j7tHgNVCjsfHVNUbo= github.com/gobwas/ws v1.0.2/go.mod h1:szmBTxLgaFppYjEmNtny/v3w89xOydFnnZMcgRRu/EM= github.com/goccy/go-json v0.10.0 h1:mXKd9Qw4NuzShiRlOXKews24ufknHO7gx30lsDyokKA= @@ -571,17 +520,13 @@ github.com/goccy/go-json v0.10.0/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MG github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0= github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2/go.mod h1:bBOAhwG1umN6/6ZUMtDFBMQR8jRg9O75tm9K00oMsK4= github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA= -github.com/gofrs/uuid v3.3.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/googleapis v1.1.0/go.mod h1:gf4bu3Q80BeJ6H1S1vYPm8/ELATdvryBaNFGgqEef3s= github.com/gogo/googleapis v1.4.1-0.20201022092350-68b0159b7869/go.mod h1:5YRNX2z1oM5gXdAkurHa942MDgEJyk02w4OecKY87+c= github.com/gogo/googleapis v1.4.1 h1:1Yx4Myt7BxzvUr5ldGSbwYiZG6t9wGBZ+8/fX3Wvtq0= github.com/gogo/googleapis v1.4.1/go.mod h1:2lpHqI5OcWCtVElxXnPt+s8oJvMpySlOyM6xDCrzib4= github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= -github.com/golang-jwt/jwt/v4 v4.3.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg= github.com/golang-jwt/jwt/v4 v4.4.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= -github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0/go.mod h1:E/TSTwGwJL78qG/PmXZO1EjYhfJinVAhrmmHX6Z8B9k= -github.com/golang/geo v0.0.0-20190916061304-5b978397cfec/go.mod h1:QZ0nwyI2jOfgRAoBvP+ab5aRr7c9x7lhGEJrKvBwjWI= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/glog v1.2.0 h1:uCdmnmatrKCgMBlM4rMuJZWOkPDqdbZPnrMXDY4gI68= github.com/golang/glog v1.2.0/go.mod h1:6AhwSGph0fcJtXVM/PEHPqZlFeoLxhs7/t5UDAwmO+w= @@ -625,12 +570,10 @@ github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8l github.com/golang/snappy v0.0.3/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.4 h1:yAGX7huGHXlcLOEtBnF4w7FQwA26wojNCwOYAEhLjQM= github.com/golang/snappy v0.0.4/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= -github.com/golangci/lint-1 v0.0.0-20181222135242-d2cdd8c08219/go.mod h1:/X8TswGSh1pIozq4ZwCfxS0WA5JGXguxk94ar/4c87Y= github.com/google/btree v0.0.0-20180813153112-4030bb1f1f0c/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ5JPQ= github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -650,7 +593,6 @@ github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= -github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= @@ -680,9 +622,7 @@ github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm4 github.com/google/s2a-go v0.1.7 h1:60BLSyTrOV4/haCDW4zb1guZItoSq8foHCXrAnjBo/o= github.com/google/s2a-go v0.1.7/go.mod h1:50CgR4k1jNlWBu4UfS4AcfhVe1r6pdZPygJ3R8F0Qdw= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= -github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -705,48 +645,46 @@ github.com/googleapis/gax-go/v2 v2.12.0/go.mod h1:y+aIqrI5eb1YGMVJfuV3185Ts/D7qK github.com/googleapis/go-type-adapters v1.0.0/go.mod h1:zHW75FOG2aur7gAO2B+MLby+cLsWGBF62rFAi7WjWO4= github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY= github.com/gorilla/context v1.1.1/go.mod h1:kBGZzfjB9CEq2AlWe17Uuf7NDRt0dE0s8S51q0aT7Yg= -github.com/gorilla/handlers v1.5.1 h1:9lRY6j8DEeeBT10CvO9hGW0gmky0BprnvDI5vfhUHH4= -github.com/gorilla/handlers v1.5.1/go.mod h1:t8XrUpc4KVXb7HGyJ4/cEnwQiaxrX/hz1Zv/4g96P1Q= +github.com/gorilla/handlers v1.5.2 h1:cLTUSsNkgcwhgRqvCNmdbRWG0A3N4F+M2nWKdScwyEE= +github.com/gorilla/handlers v1.5.2/go.mod h1:dX+xVpaxdSw+q0Qek8SSsl3dfMk3jNddUkMzo0GtH0w= github.com/gorilla/mux v1.6.2/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= github.com/gorilla/mux v1.7.3/go.mod h1:1lud6UwP+6orDFRuTfBEV8e9/aOM/c4fVVCaMa2zaAs= -github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI= -github.com/gorilla/mux v1.8.0/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So= +github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= +github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v0.0.0-20170926233335-4201258b820c/go.mod h1:E7qHFY5m1UJ88s3WnNqhKjPHQ0heANvMoAMk2YaljkQ= github.com/gorilla/websocket v1.4.1/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= -github.com/graph-gophers/graphql-go v1.3.0/go.mod h1:9CQHMSxwO4MprSdzoIEobiHpoLtHm77vfxsvsIN5Vuc= github.com/grpc-ecosystem/go-grpc-middleware v1.0.1-0.20190118093823-f849b5445de4/go.mod h1:FiyG127CGDf3tlThmgyCl78X/SZQqEOJBCDaAfeWzPs= github.com/grpc-ecosystem/go-grpc-middleware v1.2.2/go.mod h1:EaizFBKfUKtMIF5iaDEhniwNedqGo9FuLFzppDr3uwI= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw= -github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= +github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8= github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk= github.com/grpc-ecosystem/grpc-gateway v1.9.5/go.mod h1:vNeuVxBJEsws4ogUvrchl83t/GYV9WGTSLVdBhOQFDY= github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo= github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU= github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c/go.mod h1:NMPJylDgVpX0MLRlPy15sqSwOFv/U1GZ2m21JhFfek0= -github.com/gtank/merlin v0.1.1-0.20191105220539-8318aed1a79f/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/merlin v0.1.1 h1:eQ90iG7K9pOhtereWsmyRJ6RAwcP4tHTDBHXNg+u5is= -github.com/gtank/merlin v0.1.1/go.mod h1:T86dnYJhcGOh5BjZFCJWTDeTK7XW8uE+E21Cy/bIQ+s= -github.com/gtank/ristretto255 v0.1.2 h1:JEqUCPA1NvLq5DwYtuzigd7ss8fwbYay9fi4/5uMzcc= -github.com/gtank/ristretto255 v0.1.2/go.mod h1:Ph5OpO6c7xKUGROZfWVLiJf9icMDwUeIvY4OmlYW69o= github.com/hashicorp/consul/api v1.3.0/go.mod h1:MmDNSzIMUjNpY/mQ398R4bk2FnqQLoPndWW5VkKPlCE= github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= -github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80= github.com/hashicorp/go-cleanhttp v0.5.2 h1:035FKYIWjmULyFRBKPs8TBQoi0x6d9G4xc9neXJWAZQ= github.com/hashicorp/go-cleanhttp v0.5.2/go.mod h1:kO/YDlP8L1346E6Sodw+PrpBSV4/SoxCXGY6BqNFT48= -github.com/hashicorp/go-getter v1.7.1 h1:SWiSWN/42qdpR0MdhaOc/bLR48PLuP1ZQtYLRlM69uY= -github.com/hashicorp/go-getter v1.7.1/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-getter v1.7.3 h1:bN2+Fw9XPFvOCjB0UOevFIMICZ7G2XSQHzfvLUyOM5E= +github.com/hashicorp/go-getter v1.7.3/go.mod h1:W7TalhMmbPmsSMdNjD0ZskARur/9GJ17cfHTRtXV744= +github.com/hashicorp/go-hclog v1.5.0 h1:bI2ocEMgcVlz55Oj1xZNBsVi900c7II+fWDyV9o+13c= +github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVHBcfoyhpF5M= github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc= github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60= +github.com/hashicorp/go-metrics v0.5.3 h1:M5uADWMOGCTUNU1YuC4hfknOeHNaX54LDm4oYSucoNE= +github.com/hashicorp/go-metrics v0.5.3/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM= github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk= +github.com/hashicorp/go-plugin v1.5.2 h1:aWv8eimFqWlsEiMrYZdPYl+FdHaBJSN4AWwGWfT1G2Y= +github.com/hashicorp/go-plugin v1.5.2/go.mod h1:w1sAEES3g3PuV/RzUrgow20W2uErMly84hhD3um1WL4= github.com/hashicorp/go-retryablehttp v0.5.3/go.mod h1:9B5zBasrRhHXnJnui7y6sL7es7NDiJgTc6Er0maI1Xs= github.com/hashicorp/go-rootcerts v1.0.0/go.mod h1:K6zTfqpRlCUIjkwsN4Z+hiSfzSTQa6eBIzfwKfwNnHU= github.com/hashicorp/go-safetemp v1.0.0 h1:2HR189eFNrjHQyENnQMMpCiBAsRxzbTMIgBhEyExpmo= @@ -754,34 +692,35 @@ github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoD github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= github.com/hashicorp/go-version v1.6.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go.net v0.0.1/go.mod h1:hjKkEWcCURg++eb33jQU7oqQcI9XDCnUzHA0oac0k90= github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= +github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c= +github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/hashicorp/logutils v1.0.0/go.mod h1:QIAnNjmIWmVIIkWDTG1z5v++HQmx9WQRO+LraFDTW64= github.com/hashicorp/mdns v1.0.0/go.mod h1:tL+uN++7HEJ6SQLQ2/p+z2pH24WQKWjBPkE0mNTz8vQ= github.com/hashicorp/memberlist v0.1.3/go.mod h1:ajVTdAv/9Im8oMAAj5G31PhhMCZJV2pPBoIllUwCN7I= github.com/hashicorp/serf v0.8.2/go.mod h1:6hOLApaqBFA1NXqRQAsxw9QxuDEvNxSQRwA/JwenrHc= +github.com/hashicorp/yamux v0.1.1 h1:yrQxtgseBDrq9Y652vSRDvsKCJKOUD+GzTS4Y0Y8pvE= +github.com/hashicorp/yamux v0.1.1/go.mod h1:CtWFDAQgb7dxtzFs4tWbplKIe2jSi3+5vKbgIO0SLnQ= github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7HsjsjeEZ6auqU= github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo= -github.com/holiman/bloomfilter/v2 v2.0.3/go.mod h1:zpoh+gs7qcpqrHr3dB55AMiJwo0iURXE7ZOP9L9hSkA= -github.com/holiman/uint256 v1.2.0/go.mod h1:y4ga/t+u+Xwd7CpDgZESaRcWy0I7XMlTMA25ApIH5Jw= github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU= github.com/huandu/go-assert v1.1.5 h1:fjemmA7sSfYHJD7CUqs9qTwwfdNAx7/j2/ZlHXzNB3c= github.com/huandu/go-assert v1.1.5/go.mod h1:yOLvuqZwmcHIC5rIzrBhT7D3Q9c3GFnd0JrPVhn/06U= github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw= github.com/huandu/skiplist v1.2.0/go.mod h1:7v3iFjLcSAzO4fN5B8dvebvo/qsfumiLiDXMrPiHF9w= github.com/hudl/fargo v1.3.0/go.mod h1:y3CKSmjA+wD2gak7sUSXTAoopbhU08POFhmITJgmKTg= -github.com/huin/goupnp v1.0.3-0.20220313090229-ca81a64b4204/go.mod h1:ZxNlw5WqJj6wSsRK5+YfflQGXYfccj5VgQsMNixHM7Y= -github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= +github.com/iancoleman/strcase v0.3.0 h1:nTXanmYxhfFAMjZL34Ov6gkzEsSJZ5DbhxWjvSASxEI= +github.com/iancoleman/strcase v0.3.0/go.mod h1:iwCmte+B7n89clKwxIoIXy/HfoL7AsD47ZCWhYzw7ho= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= @@ -789,24 +728,9 @@ github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPt github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/influxdata/flux v0.65.1/go.mod h1:J754/zds0vvpfwuq7Gc2wRdVwEodfpCFM7mYlOw2LqY= -github.com/influxdata/influxdb v1.8.3/go.mod h1:JugdFhsvvI8gadxOI6noqNeeBHvWNTbfYGtiAn+2jhI= -github.com/influxdata/influxdb-client-go/v2 v2.4.0/go.mod h1:vLNHdxTJkIf2mSLvGrpj8TCcISApPoXkaxP8g9uRlW8= github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo= -github.com/influxdata/influxql v1.1.1-0.20200828144457-65d3ef77d385/go.mod h1:gHp9y86a/pxhjJ+zMjNXiQAA197Xk9wLxaz+fGG+kWk= -github.com/influxdata/line-protocol v0.0.0-20180522152040-32c6aa80de5e/go.mod h1:4kt73NQhadE3daL3WhR5EJ/J2ocX0PZzwxQ0gXJ7oFE= -github.com/influxdata/line-protocol v0.0.0-20200327222509-2487e7298839/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/line-protocol v0.0.0-20210311194329-9aa0e372d097/go.mod h1:xaLFMmpvUxqXtVkUJfg9QmT88cDaCJ3ZKgdZ78oO8Qo= -github.com/influxdata/promql/v2 v2.12.0/go.mod h1:fxOPu+DY0bqCTCECchSRtWfc+0X19ybifQhZoQNF5D8= -github.com/influxdata/roaring v0.4.13-0.20180809181101-fc520f41fab6/go.mod h1:bSgUQ7q5ZLSO+bKBGqJiCBGAl+9DxyW63zLTujjUlOE= -github.com/influxdata/tdigest v0.0.0-20181121200506-bf2b5ad3c0a9/go.mod h1:Js0mqiSBE6Ffsg94weZZ2c+v/ciT8QRHFOap7EKDrR0= -github.com/influxdata/usage-client v0.0.0-20160829180054-6d3895376368/go.mod h1:Wbbw6tYNvwa5dlB6304Sd+82Z3f7PmVZHVKU637d4po= -github.com/jackpal/go-nat-pmp v1.0.2/go.mod h1:QPH045xvCAeXUZOxsnwmrtiCoxIr9eob+4orBN1SBKc= -github.com/jedisct1/go-minisign v0.0.0-20190909160543-45766022959e/go.mod h1:G1CVv03EnqU1wYL2dFwXxW2An0az9JTl/ZsqXQeBlkU= -github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI= -github.com/jhump/protoreflect v1.15.1 h1:HUMERORf3I3ZdX05WaQ6MIpd/NJ434hTp5YiKgfCL6c= -github.com/jhump/protoreflect v1.15.1/go.mod h1:jD/2GMKKE6OqX8qTjhADU1e6DShO+gavG9e0Q693nKo= +github.com/jhump/protoreflect v1.15.3 h1:6SFRuqU45u9hIZPJAoZ8c28T3nK64BNdp9w6jFonzls= +github.com/jhump/protoreflect v1.15.3/go.mod h1:4ORHmSBmlCW8fh3xHmJMGyul1zNqZK4Elxc8qKP+p1k= github.com/jmespath/go-jmespath v0.0.0-20180206201540-c2b33e8439af/go.mod h1:Nht3zPeWKUH0NzdCt2Blrr5ys8VGpn0CEB0cQHVjt7k= github.com/jmespath/go-jmespath v0.4.0 h1:BEgLn5cpjn8UN1mAw4NjwDrS35OdebyEtFe+9YPoQUg= github.com/jmespath/go-jmespath v0.4.0/go.mod h1:T8mJZnbsbmF+m6zOOFylbeCJqk5+pHWvzYPziyZiYoo= @@ -816,7 +740,6 @@ github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= -github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.7/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= @@ -826,29 +749,19 @@ github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnr github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= -github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM= -github.com/jung-kurt/gofpdf v1.0.3-0.20190309125859-24315acbbda5/go.mod h1:7Id9E/uU8ce6rXgefFLlgrJj/GYY22cpxn+r32jIOes= -github.com/jwilder/encoding v0.0.0-20170811194829-b4e1701a28ef/go.mod h1:Ct9fl0F6iIOGgxJ5npU/IUOhOhqlVrGjyIZc8/MagT0= -github.com/karalabe/usb v0.0.2/go.mod h1:Od972xHfMJowv7NGVDiWVxk2zxnWgjLlJzE+F4F7AGU= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= -github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= -github.com/klauspost/compress v1.4.0/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= github.com/klauspost/compress v1.15.11/go.mod h1:QPwzmACJjUTFsnSHH934V6woptycfrDDJnH7hvFVbGM= -github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM= -github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE= -github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5 h1:2U0HzY8BJ8hVwDKIzp7y4voR9CX/nvcfymLmg2UiOio= -github.com/klauspost/cpuid v0.0.0-20170728055534-ae7887de9fa5/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= +github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= +github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/cpuid/v2 v2.0.9 h1:lgaqFMSdTdQYdZ04uHyN2d/eKdOMyi2YLSvlQIBFYa4= github.com/klauspost/cpuid/v2 v2.0.9/go.mod h1:FInQzS24/EEf25PyTYn52gqo7WaD8xa0213Md/qVLRg= -github.com/klauspost/crc32 v0.0.0-20161016154125-cb6bfca970f6/go.mod h1:+ZoRqAPRLkC4NPOvfYeR5KNOrY6TD+/sAC3HXPZgDYg= -github.com/klauspost/pgzip v1.0.2-0.20170402124221-0bf5dcad4ada/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= @@ -861,42 +774,29 @@ github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= -github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= -github.com/labstack/echo/v4 v4.2.1/go.mod h1:AA49e0DZ8kk5jTOOCKNuPR6oTnBS0dYiM4FW1e6jwpg= -github.com/labstack/gommon v0.3.0/go.mod h1:MULnywXg0yavhxWKc+lOruYdAhDwPK9wf0OL7NoOu+k= -github.com/leanovate/gopter v0.2.9/go.mod h1:U2L/78B+KVFIx2VmW6onHJQzXtFb+p5y3y2Sh+Jxxv8= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= -github.com/lib/pq v1.0.0/go.mod h1:5WUZQaWbwv1U+lTReE5YruASi9Al49XbQIvNi/34Woo= github.com/lib/pq v1.10.7 h1:p7ZhMD+KsSRozJr34udlUrhboJwWAgCg34+/ZZNvZZw= github.com/lib/pq v1.10.7/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8= github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg= github.com/lightstep/lightstep-tracer-common/golang/gogo v0.0.0-20190605223551-bc2310a04743/go.mod h1:qklhhLq1aX+mtWk9cPHPzaBjWImj5ULL6C7HFJtXQMM= github.com/lightstep/lightstep-tracer-go v0.18.1/go.mod h1:jlF1pusYV4pidLvZ+XD0UBX0ZE6WURAspgAczcDHrL4= -github.com/linxGnu/grocksdb v1.7.16 h1:Q2co1xrpdkr5Hx3Fp+f+f7fRGhQFQhvi/+226dtLmA8= -github.com/linxGnu/grocksdb v1.7.16/go.mod h1:JkS7pl5qWpGpuVb3bPqTz8nC12X3YtPZT+Xq7+QfQo4= -github.com/lucasjones/reggen v0.0.0-20180717132126-cdb49ff09d77/go.mod h1:5ELEyG+X8f+meRWHuqUOewBOhvHkl7M76pdGEansxW4= +github.com/linxGnu/grocksdb v1.8.14 h1:HTgyYalNwBSG/1qCQUIott44wU5b2Y9Kr3z7SK5OfGQ= +github.com/linxGnu/grocksdb v1.8.14/go.mod h1:QYiYypR2d4v63Wj1adOOfzglnoII0gLj3PNh4fZkcFA= github.com/lyft/protoc-gen-validate v0.0.13/go.mod h1:XbGvPuh87YZc5TdIa2/I4pLk0QoUACkjt2znoq26NVQ= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY= github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0= -github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= -github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= -github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= -github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= -github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= -github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.12/go.mod h1:u5H1YNBxpqRaxsYJYSkiCWKzEfiAb1Gb520KVy5xxl4= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= -github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= -github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU= github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27kJ6hsGG94= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= @@ -905,18 +805,9 @@ github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.3/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= github.com/mattn/go-runewidth v0.0.4/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU= -github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= -github.com/mattn/go-sqlite3 v1.11.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= -github.com/mattn/go-tty v0.0.0-20180907095812-13ff1204f104/go.mod h1:XPvLUNfbS4fJH25nqRHfWLMa1ONC8Amw+mIA639KxkE= github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0= -github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo= -github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4= github.com/miekg/dns v1.0.14/go.mod h1:W1PPwlIAgtquWBMBEV9nkV9Cazfe8ScdGz/Lj7v3Nrg= -github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94= -github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM= github.com/minio/highwayhash v1.0.2 h1:Aak5U0nElisjDCfPSG79Tgzkn2gl66NxOMspRrKnA/g= github.com/minio/highwayhash v1.0.2/go.mod h1:BQskDq+xkJ12lmlUUi7U0M5Swg3EWR+dLTk+kldvVxY= github.com/mitchellh/cli v1.0.0/go.mod h1:hNIlj7HEI86fIcpObd7a0FcrxTWetlwJDGcceTlRvqc= @@ -930,11 +821,8 @@ github.com/mitchellh/gox v0.4.0/go.mod h1:Sd9lOJ0+aimLBi73mGofS1ycjY8lL3uZM3JPS4 github.com/mitchellh/iochan v1.0.0/go.mod h1:JwYml1nuB7xOzsp52dPpHFffvOCDupsG0QubkSMEySY= github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= -github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/mapstructure v1.4.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= -github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= @@ -942,16 +830,12 @@ github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lN github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= -github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= -github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/grpc-proxy v0.0.0-20181017164139-0f1106ef9c76/go.mod h1:x5OoJHDHqxHS801UIuhqGl6QdSAEJvtausosHSdazIo= -github.com/naoina/go-stringutil v0.1.0/go.mod h1:XJ2SJL9jCtBh+P9q5btrd/Ylo8XwT/h1USek5+NqSA0= -github.com/naoina/toml v0.1.2-0.20170918210437-9fafd6967416/go.mod h1:NBIhNtsFMo3G2szEBne+bO4gS192HuIYRqfvOWb4i1E= github.com/nats-io/jwt v0.3.0/go.mod h1:fRYCDE99xlTsqUzISS1Bi75UBJ6ljOJQOAAu5VglpSg= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats-server/v2 v2.1.2/go.mod h1:Afk+wRZqkMQs/p45uXdrVLuab3gwv3Z8C4HTBu8GD/k= @@ -959,28 +843,28 @@ github.com/nats-io/nats.go v1.9.1/go.mod h1:ZjDU1L/7fJ09jvUSRVBR2e7+RnLiiIQyqyzE github.com/nats-io/nkeys v0.1.0/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nkeys v0.1.3/go.mod h1:xpnFELMwJABBLVhffcfd1MZx6VsNRFpEugbxziKVo7w= github.com/nats-io/nuid v1.0.1/go.mod h1:19wcPz3Ph3q0Jbyiqsd0kePYG7A95tJPxeL+1OSON2c= -github.com/neilotoole/errgroup v0.1.6/go.mod h1:Q2nLGf+594h0CLBs/Mbg6qOr7GtqDK7C2S41udRnToE= github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e/go.mod h1:zD1mROLANZcx1PVRCS0qkT7pwLkGfwJo4zjcN/Tysno= github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A= github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE= github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q= +github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s= github.com/oklog/oklog v0.3.2/go.mod h1:FCV+B7mhrz4o+ueLpx+KqkyXRGMWOYEvfiXtdGtbWGs= github.com/oklog/run v1.0.0/go.mod h1:dlhp/R75TPv97u0XWUtDeV/lRKWPKSdTuV0TZvrmrQA= -github.com/oklog/ulid v1.3.1/go.mod h1:CirwcVhetQ6Lv90oh/F+FBtV6XMibvdAFo93nm5qn4U= +github.com/oklog/run v1.1.0 h1:GEenZ1cK0+q0+wsJew9qUg/DyD8k3JzYsZAi5gYi2mA= +github.com/oklog/run v1.1.0/go.mod h1:sVPdnTZT1zYwAJeCMu2Th4T21pA3FPOQRfWjQlk7DVU= github.com/olekukonko/tablewriter v0.0.0-20170122224234-a0225b3f23b5/go.mod h1:vsDQFd/mU46D+Z4whnwzcISnGGzXWMclvtLoiIKAKIo= -github.com/olekukonko/tablewriter v0.0.5/go.mod h1:hPp6KlRPjbx+hW8ykQs1w3UBbZlj6HuIJcUGPhkA7kY= github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE= github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= -github.com/onsi/gomega v1.20.0/go.mod h1:DtrZpjmvpn2mPm4YWQa0/ALMDj9v4YxLgojwPeREyVo= +github.com/onsi/gomega v1.26.0 h1:03cDLK28U6hWvCAns6NeydX3zIm4SF3ci69ulidS32Q= +github.com/onsi/gomega v1.26.0/go.mod h1:r+zV744Re+DiYCIPRlYOTxn0YkOLcAnW8k1xXdMPGhM= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= @@ -991,7 +875,6 @@ github.com/opencontainers/runc v1.1.3/go.mod h1:1J5XiS+vdZ3wCyZybsuxXZWGrgSr8fFJ github.com/opentracing-contrib/go-observer v0.0.0-20170622124052-a52f23424492/go.mod h1:Ngi6UdF0k5OKD5t5wlmGhe/EDKPoUM3BXZSSfIuJbis= github.com/opentracing/basictracer-go v1.0.0/go.mod h1:QfBfYuafItcjQuMwinw9GhYKwFXS9KnPs5lxoYwgW74= github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= -github.com/opentracing/opentracing-go v1.0.3-0.20180606204148-bd9c31933947/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= github.com/openzipkin-contrib/zipkin-go-opentracing v0.4.5/go.mod h1:/wsWhb9smxSfWAKL3wpBW7V8scJMt8N8gnaMCS9E/cA= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= @@ -1003,19 +886,15 @@ github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIw github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY= github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= -github.com/paulbellamy/ratecounter v0.2.0/go.mod h1:Hfx1hDpSGoqxkVVpBi/IlYD7kChlfo5C6hzIHwPqfFE= github.com/pborman/uuid v1.2.0/go.mod h1:X/NO0urCmaxf9VXbdlT7C2Yzkj2IKimNn4k+gtPdI/k= github.com/pelletier/go-toml v1.2.0/go.mod h1:5z9KED0ma1S8pY6P1sdut58dfprrGBbd/94hg7ilaic= github.com/pelletier/go-toml/v2 v2.0.6/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek= github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= -github.com/peterh/liner v1.0.1-0.20180619022028-8c1271fcf47f/go.mod h1:xIteQHvHuaLYG9IFj6mSxM0fCKrs34IrEQUhOYuGPHc= -github.com/peterh/liner v1.1.1-0.20190123174540-a2c9a5303de7/go.mod h1:CRroGNssyjTd/qIG2FyxByd2S8JEAZXBl4qUrZf8GS0= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU= -github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= -github.com/philhofer/fwd v1.0.0/go.mod h1:gk3iGcWd9+svBvR0sR+KPcfE+RNWozjowpeBVG3ZVNU= +github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 h1:jik8PHtAIsPlCRJjJzl4udgEf7hawInF9texMeO2jrU= +github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= github.com/pierrec/lz4 v1.0.2-0.20190131084431-473cd7ce01a1/go.mod h1:3/3N9NVKO0jef7pBehbT1qWhCMrIgbYNnFAZCqQ5LRc= github.com/pierrec/lz4 v2.0.5+incompatible/go.mod h1:pdkljMzZIN41W+lC3N2tnIh5sFi+IEE17M5jbnwPHcY= github.com/pingcap/errors v0.11.4 h1:lFuQV/oaUMGcD2tqt+01ROSmJs75VG1ToEOkZIZ4nE4= @@ -1026,7 +905,6 @@ github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= github.com/pkg/profile v1.2.1/go.mod h1:hJw3o1OdXxsrSjjVksARp5W95eeEaEfptyVZyv6JUPA= -github.com/pkg/term v0.0.0-20180730021639-bffc007b7fd5/go.mod h1:eCbImbZ95eXtAUIbLAuAVnBnwf83mjf6QIVH8SHYwqQ= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U= github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= @@ -1037,50 +915,43 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn github.com/prometheus/client_golang v1.3.0/go.mod h1:hJaj2vgQTGQmVCsAACORcieXFeDPbaTKGT+JTgUa3og= github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU= github.com/prometheus/client_golang v1.7.1/go.mod h1:PY5Wy2awLA44sXw4AOSfFBetzPP4j5+D6mVACh+pe2M= -github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8= -github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc= +github.com/prometheus/client_golang v1.19.0 h1:ygXvpU1AoN1MhdzckN+PyD9QJOSD4x7kmXYlnfbA6JU= +github.com/prometheus/client_golang v1.19.0/go.mod h1:ZRM9uEAypZakd+q/x7+gmsvXdURP+DABIEIjnmDdp+k= github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190115171406-56726106282f/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo= github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.1.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA= -github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4= -github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w= -github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro= +github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E= +github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY= github.com/prometheus/common v0.2.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4= -github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc= github.com/prometheus/common v0.7.0/go.mod h1:DjGbpBbp5NYNiECxcL/VnbXCCaQpKd3tt26CguLLsqA= github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4= github.com/prometheus/common v0.10.0/go.mod h1:Tlit/dnDKsSWFlCLTWaA1cyBgKHSMdTB80sz/V91rCo= github.com/prometheus/common v0.15.0/go.mod h1:U+gB1OBLb1lF3O42bTCL+FK18tX9Oar16Clt/msog/s= -github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM= -github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc= +github.com/prometheus/common v0.52.2 h1:LW8Vk7BccEdONfrJBDffQGRtpSzi5CQaRZGtboOO2ck= +github.com/prometheus/common v0.52.2/go.mod h1:lrWtQx+iDfn2mbH5GUzlH9TSHyfZpHkSiG1W7y3sF2Q= github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.0-20190117184657-bf6a532e95b1/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk= github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA= github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.1.3/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= github.com/prometheus/procfs v0.3.0/go.mod h1:lV6e/gmhEcM9IjHGsFOCxxuZ+z1YqCvr4OA4YeYWdaU= -github.com/prometheus/procfs v0.10.1 h1:kYK1Va/YMlutzCGazswoHKo//tZVlFpKYh+PymziUAg= -github.com/prometheus/procfs v0.10.1/go.mod h1:nwNm2aOCAYw8uTR/9bWRREkZFxAUcWzPHWJq+XBB/FM= -github.com/prometheus/tsdb v0.7.1/go.mod h1:qhTCs0VvXwvX/y3TZrWD7rabWM+ijKTux40TwIPHuXU= -github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= -github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= +github.com/prometheus/procfs v0.13.0 h1:GqzLlQyfsPbaEHaQkO7tbDlriv/4o5Hudv6OXHGKX7o= +github.com/prometheus/procfs v0.13.0/go.mod h1:cd4PFCR54QLnGKPaKGA6l+cfuNXtht43ZKY6tow0Y1g= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM= github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= -github.com/retailnext/hllpp v1.0.1-0.20180308014038-101a6d2f8b52/go.mod h1:RDpi1RftBQPUCDRw6SmxeaREsAaRKnOclghuzp/WRzc= -github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRrjvIXnJho= github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= github.com/rogpeppe/go-internal v1.6.1/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc= github.com/rogpeppe/go-internal v1.8.0/go.mod h1:WmiCO8CzOY8rg0OYDC4/i/2WRWAB6poM+XZ2dLUbcbE= github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/fJaraNFVN+nFs= -github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= -github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= +github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.3 h1:O+qNyWn7Z+F9M0ILBHgMVPuB1xTOucVd5gtaYyXBpRo= github.com/rs/cors v1.8.3/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= @@ -1099,11 +970,6 @@ github.com/samuel/go-zookeeper v0.0.0-20190923202752-2cc03de413da/go.mod h1:gi+0 github.com/sasha-s/go-deadlock v0.3.1 h1:sqv7fDNShgjcaxkO0JNcOAlr8B9+cV5Ey/OB71efZx0= github.com/sasha-s/go-deadlock v0.3.1/go.mod h1:F73l+cr82YSh10GxyRI6qZiCgK64VaZjwesgfQ1/iLM= github.com/sean-/seed v0.0.0-20170313163322-e2103e2c3529/go.mod h1:DxrIzT+xaE7yg65j358z/aeFdxmN0P9QXhEzd20vsDc= -github.com/segmentio/fasthash v1.0.3/go.mod h1:waKX8l2N8yckOgmSsXJi7x1ZfdKZ4x7KRMzBtS3oedY= -github.com/segmentio/kafka-go v0.1.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/segmentio/kafka-go v0.2.0/go.mod h1:X6itGqS9L4jDletMsxZ7Dz+JFWxM6JHfPOCvTvk+EJo= -github.com/sergi/go-diff v1.0.0/go.mod h1:0CfEIISq7TuYL3j771MWULgwwjU+GofnZX9QAmXWZgo= -github.com/shirou/gopsutil v3.21.4-0.20210419000835-c7a38de76ee5+incompatible/go.mod h1:5b4v6he4MtMOwMlS0TUMTu2PcXUg8+E1lC7eC3UO/RA= github.com/shurcooL/sanitized_anchor_name v1.0.0/go.mod h1:1NzhyTcUVG4SuEtjjoZeVRXNmyL/1OwPU0+IJeTBvfc= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= @@ -1138,7 +1004,6 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.18.2 h1:LUXCnvUvSM6FXAsj6nnfc8Q2tp1dIgUfY9Kc8GsSOiQ= github.com/spf13/viper v1.18.2/go.mod h1:EKmWIqdnk5lOcmR72yw6hS+8OPYcwD0jteitLMVB+yk= -github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -1148,7 +1013,6 @@ github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSS github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= -github.com/stretchr/testify v1.2.0/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= @@ -1156,6 +1020,7 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5 github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1FQKckRals= github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= @@ -1167,43 +1032,23 @@ github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7 h1:epCh84lMvA70 github.com/syndtr/goleveldb v1.0.1-0.20210819022825-2ae1ddf74ef7/go.mod h1:q4W45IWZaF22tdD+VEXcAWRA037jwmWEB5VWYORlTpc= github.com/tendermint/go-amino v0.16.0 h1:GyhmgQKvqF82e2oZeuMSp9JTN0N09emoSZlb2lyGa2E= github.com/tendermint/go-amino v0.16.0/go.mod h1:TQU0M1i/ImAo+tYpZi73AU3V/dKeCoMC9Sphe2ZwGME= -github.com/terra-money/alliance v0.3.5 h1:7bLlw9ZUNaFFxGYiKyJKB7x2SV2+6lVvMYbmBm3OORU= -github.com/terra-money/alliance v0.3.5/go.mod h1:HDiUexeXRUkLkLRw5jLQcHuVt1Sx43HfyVl0kfwW3JM= -github.com/tidwall/btree v1.6.0 h1:LDZfKfQIBHGHWSwckhXI0RPSXzlo+KYdjK7FWSqOzzg= -github.com/tidwall/btree v1.6.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= -github.com/tidwall/gjson v1.12.1/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/gjson v1.14.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk= -github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM= -github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU= -github.com/tidwall/sjson v1.2.4/go.mod h1:098SZ494YoMWPmMO6ct4dcFnqxwj9r/gF0Etp19pSNM= -github.com/tinylib/msgp v1.0.2/go.mod h1:+d+yLhGm8mzTaHzB+wgMYrodPfmZrzkirds8fDWklFE= -github.com/tklauser/go-sysconf v0.3.5/go.mod h1:MkWzOF4RMCshBAMXuhXJs64Rte09mITnppBXY/rYEFI= -github.com/tklauser/numcpus v0.2.2/go.mod h1:x3qojaO3uyYt0i56EW/VUYs7uBvdl2fkfZFu0T9wgjM= +github.com/tidwall/btree v1.7.0 h1:L1fkJH/AuEh5zBnnBbmTwQ5Lt+bRJ5A8EWecslvo9iI= +github.com/tidwall/btree v1.7.0/go.mod h1:twD9XRA5jj9VUQGELzDO4HPQTNJsoWWfYEL+EUQ2cKY= github.com/tmc/grpc-websocket-proxy v0.0.0-20170815181823-89b8d40f7ca8/go.mod h1:ncp9v5uamzpCO7NfCPTXjqaC+bZgJeR0sMTm6dMHP7U= github.com/tv42/httpunix v0.0.0-20150427012821-b75d8614f926/go.mod h1:9ESjWnEqriFuLhtthL60Sar/7RFoluCcXsuvEwTV5KM= github.com/twitchyliquid64/golang-asm v0.15.1 h1:SU5vSMR7hnwNxj24w34ZyCi/FmDZTkS4MhqMhdFk5YI= github.com/twitchyliquid64/golang-asm v0.15.1/go.mod h1:a1lVb/DtPvCB8fslRZhAngC2+aY1QWCk3Cedj/Gdt08= -github.com/tyler-smith/go-bip39 v1.0.1-0.20181017060643-dbb3b84ba2ef/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= -github.com/tyler-smith/go-bip39 v1.0.2/go.mod h1:sJ5fKU0s6JVwZjjcUEX2zFOnvq0ASQ2K9Zr6cf67kNs= github.com/ugorji/go/codec v0.0.0-20181204163529-d75b2dcb6bc8/go.mod h1:VFNgLljTbGfSG7qAOspJ7OScBnGdDN/yBr0sguwnwf0= -github.com/ugorji/go/codec v1.2.9 h1:rmenucSohSTiyL09Y+l2OCk+FrMxGMzho2+tjr5ticU= github.com/ugorji/go/codec v1.2.9/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ugorji/go/codec v1.2.11 h1:BMaWp1Bb6fHwEtbplGBGJ498wD+LKlNSl25MjdZY4dU= +github.com/ugorji/go/codec v1.2.11/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= github.com/ulikunitz/xz v0.5.10/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli v1.20.0/go.mod h1:70zkFmudgCuE/ngEzBv17Jvp/497gISqfk5gWijbERA= github.com/urfave/cli v1.22.1/go.mod h1:Gos4lmkARVdJ6EkW0WaNv/tZAAMe9V7XWyB60NtXRu0= -github.com/urfave/cli/v2 v2.3.0/go.mod h1:LJmUH05zAU44vOAcrfzZQKsZbVcdbOG8rtL3/XcUArI= -github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc= -github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= -github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= -github.com/vmihailenco/msgpack/v5 v5.3.5/go.mod h1:7xyJ9e+0+9SaZT0Wt1RGleJXzli6Q/V5KbhBonMG9jc= -github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= -github.com/willf/bitset v1.1.3/go.mod h1:RjeCKbqT1RxIR/KWY6phxZiaY1IyutSBfGjNPySAYV4= github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= -github.com/xlab/treeprint v0.0.0-20180616005107-d6fb6747feb6/go.mod h1:ce1O1j6UtZfjr22oyGxGLbauSBp2YVXpARAosm7dHBg= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= -github.com/ybbus/jsonrpc v2.1.2+incompatible/go.mod h1:XJrh1eMSzdIYFbM08flv0wp5G35eRniyeGut1z+LSiE= github.com/yuin/goldmark v1.1.25/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= @@ -1215,8 +1060,8 @@ github.com/zondax/hid v0.9.2/go.mod h1:l5wttcP0jwtdLjqjMMWFVEE7d1zO0jvSPA9OPZxWp github.com/zondax/ledger-go v0.14.3 h1:wEpJt2CEcBJ428md/5MgSLsXLBos98sBOyxNmCjfUCw= github.com/zondax/ledger-go v0.14.3/go.mod h1:IKKaoxupuB43g4NxeQmbLXv7T9AlQyie1UpHb342ycI= go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= -go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ= -go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= +go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= go.etcd.io/etcd v0.0.0-20191023171146-3cf2f69b5738/go.mod h1:dnLIgRNXwCJa5e+c6mIZCrds/GIG4ncV9HhK5PX7jPg= go.opencensus.io v0.20.1/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= go.opencensus.io v0.20.2/go.mod h1:6WKK9ahsWS3RSO+PY9ZHZUfv2irvY6gN279GOPZjmmk= @@ -1229,62 +1074,64 @@ go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk= go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E= go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0= go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 h1:SpGay3w+nEwMpfVnbqOLH5gY52/foP8RE8UzTZ1pdSE= -go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1/go.mod h1:4UoMYEZOC0yN/sPGH76KPkkU7zgiEWYWL9vwmbnTJPE= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 h1:aFJWCqJMNjENlcleuuOkGAPH82y0yULBScfXcIEdS24= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1/go.mod h1:sEGXWArGqc3tVa+ekntsN65DmVbVeW+7lTKTjZF3/Fo= -go.opentelemetry.io/otel v1.21.0 h1:hzLeKBZEL7Okw2mGzZ0cc4k/A7Fta0uoPgaJCr8fsFc= -go.opentelemetry.io/otel v1.21.0/go.mod h1:QZzNPQPm1zLX4gZK4cMi+71eaorMSGT3A4znnUvNNEo= -go.opentelemetry.io/otel/metric v1.21.0 h1:tlYWfeo+Bocx5kLEloTjbcDwBuELRrIFxwdQ36PlJu4= -go.opentelemetry.io/otel/metric v1.21.0/go.mod h1:o1p3CA8nNHW8j5yuQLdc1eeqEaPfzug24uvsyIEJRWM= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 h1:UNQQKPfTDe1J81ViolILjTKPr9WetKW6uei2hFgJmFs= +go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0/go.mod h1:r9vWsPS/3AQItv3OSlEJ/E4mbrhUbbw18meOjArPtKQ= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 h1:sv9kVfal0MK0wBMCOGr+HeJm9v803BkJxGrk2au7j08= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0/go.mod h1:SK2UL73Zy1quvRPonmOmRDiWk1KBV3LyIeeIxcEApWw= +go.opentelemetry.io/otel v1.22.0 h1:xS7Ku+7yTFvDfDraDIJVpw7XPyuHlB9MCiqqX5mcJ6Y= +go.opentelemetry.io/otel v1.22.0/go.mod h1:eoV4iAi3Ea8LkAEI9+GFT44O6T/D0GWAVFyZVCC6pMI= +go.opentelemetry.io/otel/metric v1.22.0 h1:lypMQnGyJYeuYPhOM/bgjbFM6WE44W1/T45er4d8Hhg= +go.opentelemetry.io/otel/metric v1.22.0/go.mod h1:evJGjVpZv0mQ5QBRJoBF64yMuOf4xCWdXjK8pzFvliY= go.opentelemetry.io/otel/sdk v1.21.0 h1:FTt8qirL1EysG6sTQRZ5TokkU8d0ugCj8htOgThZXQ8= go.opentelemetry.io/otel/sdk v1.21.0/go.mod h1:Nna6Yv7PWTdgJHVRD9hIYywQBRx7pbox6nwBnZIxl/E= -go.opentelemetry.io/otel/trace v1.21.0 h1:WD9i5gzvoUPuXIXH24ZNBudiarZDKuekPqi/E8fpfLc= -go.opentelemetry.io/otel/trace v1.21.0/go.mod h1:LGbsEB0f9LGjN+OZaQQ26sohbOmiMR+BaslueVtS/qQ= +go.opentelemetry.io/otel/trace v1.22.0 h1:Hg6pPujv0XG9QaVbGOBVHunyuLcCC3jN7WEhPx83XD0= +go.opentelemetry.io/otel/trace v1.22.0/go.mod h1:RbbHXVqKES9QhzZq/fE5UnOSILqRt40a21sPw2He1xo= go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI= go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE= go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ= -go.uber.org/atomic v1.10.0 h1:9qC72Qh0+3MqyJbAn8YU5xVq1frD8bn3JtD2oXtafVQ= -go.uber.org/atomic v1.10.0/go.mod h1:LUxbIzbOniOlMKjJjyPfpl4v+PKK2cNJn91OQbhoJI0= +go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc= +go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A= go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0= go.uber.org/multierr v1.3.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4= -go.uber.org/multierr v1.9.0 h1:7fIwc/ZtS0q++VgcfqFDxSBZVv/Xo49/SYnDFupUwlI= -go.uber.org/multierr v1.9.0/go.mod h1:X2jQV1h+kxSjClGpnseKVIxpmcjrj7MNnI0bnlfKTVQ= +go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA= -go.uber.org/zap v1.9.1/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= +go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI= golang.org/x/arch v0.0.0-20210923205945-b76863e36670 h1:18EFjUmQOcUvxNYSkA6jO9VAiXCnxFY6NyDX0bHDmkU= golang.org/x/arch v0.0.0-20210923205945-b76863e36670/go.mod h1:5om86z9Hs0C8fWVUuoMHwpExlXzs5Tkyp9hOrfG7pp8= -golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= -golang.org/x/crypto v0.0.0-20190426145343-a29dc8fdc734/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20190909091759-094676da4a83/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= -golang.org/x/crypto v0.0.0-20191206172530-e9b2fee46413/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/crypto v0.0.0-20201221181555-eec23a3978ad/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= -golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= -golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.1.0/go.mod h1:RecgLatLF4+eUMCP1PoPZQb+cVrJcOPbHkTkbkB9sbw= golang.org/x/crypto v0.5.0/go.mod h1:NK/OQwhpMQP3MwtdjgLlYHnH9ebylxKWv3e0fK+mkQU= -golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= -golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb h1:xIApU0ow1zwMa2uL1VDNeQlNVFTWMQxZUZCMDy0Q4Us= -golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb/go.mod h1:FXUEEKJgO7OQYeo8N01OfiKP8RXMtf6e8aTskBGqWdc= -golang.org/x/image v0.0.0-20180708004352-c73c2afc3b81/go.mod h1:ux5Hcp/YLpHSI86hEcLt0YII63i6oz57MZXIpbrjZUs= +golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= +golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= +golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= +golang.org/x/exp v0.0.0-20190829153037-c13cbed26979/go.mod h1:86+5VVa7VpoJ4kLfm080zCjGlMRFzhUhsZKEZO7MGek= +golang.org/x/exp v0.0.0-20191030013958-a1ab85dbe136/go.mod h1:JXzH8nQsPlswgeRAPE3MuO9GYsAcnJvJ4vnMwN/5qkY= +golang.org/x/exp v0.0.0-20191129062945-2f5052295587/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20191227195350-da58074b4299/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u096TMicItID8zy7Y6sNkU49FU4= +golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EHIKF9dgMWnmCNThgcyBT1FY9mM= +golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU= +golang.org/x/exp v0.0.0-20200331195152-e8c3332aa8e5/go.mod h1:4M0jN8W1tt0AVLNr8HDosyJCDCDuyL9N9+3m7wDWgKw= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 h1:985EYyeCOxTpcgOTJpflJUwOeEz0CQOdPt73OzpE9F8= +golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0/go.mod h1:/lliqkxwWAhPjf5oSOIJup2XcqJaw8RGS6k3TGEc7GI= +golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js= +golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU= golang.org/x/lint v0.0.0-20190301231843-5614ed5bae6f/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -1297,19 +1144,20 @@ golang.org/x/lint v0.0.0-20200130185559-910be7a94367/go.mod h1:3xt1FjdF8hUf6vQPI golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20201208152925-83fdc39ff7b5/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= +golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= +golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= +golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= +golang.org/x/mod v0.1.1-0.20191107180719-034126e5016b/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.1/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= -golang.org/x/mod v0.6.0/go.mod h1:4mET923SAdbXp2ki8ey+zGs1SLqsuM2Y0uvdZR/fUNI= -golang.org/x/mod v0.11.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= -golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= -golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= +golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -1347,20 +1195,16 @@ golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81R golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200813134508-3edf25e44fcc/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= -golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201031054903-ff519b6c9102/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201110031124-69a78807bb2b/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20201209123823-ac852fbbde11/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210119194325-5f4716e94777/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= -golang.org/x/net v0.0.0-20210220033124-5f55cee0dc0d/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLdyRGr576XBO4/greRjx4P4O3yc= golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM= golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= -golang.org/x/net v0.0.0-20211015210444-4f30a5c0130f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220325170049-de3da57026de/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= @@ -1375,8 +1219,8 @@ golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfS golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= golang.org/x/net v0.5.0/go.mod h1:DivGGAXEgPSlEBzxGzZI+ZLohi+xUj054jfeKui00ws= golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= -golang.org/x/net v0.23.0 h1:7EYJ93RZ9vYSZAIb2x3lnuvqO5zneoD6IvWjuhfxjTs= -golang.org/x/net v0.23.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= +golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= @@ -1402,8 +1246,8 @@ golang.org/x/oauth2 v0.0.0-20220822191816-0ebed06d0094/go.mod h1:h4gKUeWbJ4rQPri golang.org/x/oauth2 v0.0.0-20220909003341-f21342109be1/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.0.0-20221014153046-6fdb5e3db783/go.mod h1:h4gKUeWbJ4rQPri7E0u6Gs4e9Ri2zaLxzw5DI5XGrYg= golang.org/x/oauth2 v0.1.0/go.mod h1:G9FE4dLTsbXUu90h/Pf85g4w1D+SSAgR+q46nJZ8M4A= -golang.org/x/oauth2 v0.16.0 h1:aDkGMBSYxElaoP81NpoUoz2oo2R2wHdZpGToUxfyQrQ= -golang.org/x/oauth2 v0.16.0/go.mod h1:hqZ+0LWXsiVoZpeld6jVt06P3adbS2Uu911W1SsJv2o= +golang.org/x/oauth2 v0.18.0 h1:09qnuIAgzdx1XplqJvW6CQqMCtGZykZWcXzPMPUusvI= +golang.org/x/oauth2 v0.18.0/go.mod h1:Wf7knwG0MPoWIMMBgFlEaSUDaKskp0dCfrlJRJXbBi8= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -1418,8 +1262,8 @@ golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20220601150217-0de741cfad7f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220929204114-8fcdb60fdcc0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= -golang.org/x/sync v0.6.0 h1:5BMeUDZ7vkXGfEr1x9B4bRcTH4lpkTkpdh0T/J+qjbQ= -golang.org/x/sync v0.6.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= +golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1431,7 +1275,7 @@ golang.org/x/sys v0.0.0-20181122145206-62eef0e2fa9b/go.mod h1:STP8DvDyc/dI5b8T5h golang.org/x/sys v0.0.0-20181205085412-a5c9d58dba9a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190130150945-aca44879d564/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= -golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190312061237-fead79001313/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1440,9 +1284,9 @@ golang.org/x/sys v0.0.0-20190606165138-5da285871e9c/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20190624142023-c5567b49c5d0/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190726091711-fc99dfbffb4e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1450,7 +1294,6 @@ golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20191220142924-d4481acd189f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20191228213918-04cbcbbfeed8/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200106162015-b016eb3dc98e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200107162124-548cf772de50/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200113162924-86b910548bc1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200116001909-b77594299b42/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200122134326-e047566fdf82/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= @@ -1470,22 +1313,17 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200814200057-3d37ad5750ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20200826173525-f9321e4c35a6/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201201145000-ef89a241ccb3/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210104204734-6f8348627aad/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210119212857-b64e53b001e4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210220050731-9a76102bfb43/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210305230114-8fe3ee5dd75b/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210315160823-c6e025ad8005/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210316164454-77fc1eacc6aa/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210320140829-1e4c9ba3b0c4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210324051608-47abb6519492/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= -golang.org/x/sys v0.0.0-20210420205809-ac73e9fd8988/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210514084401-e8d321eab015/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1495,11 +1333,11 @@ golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20210816183151-1e6c022a8912/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210819135213-f52c844e1c1c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210823070655-63515b42dcdf/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20210908233432-aa78b53d3365/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211124211545-fe61309f8881/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211210111614-af8b64212486/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= @@ -1525,16 +1363,15 @@ golang.org/x/sys v0.4.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= -golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= +golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.1.0/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.4.0/go.mod h1:9P2UbLfCdcvo3p/nzKvsmas4TnlujnuoV9hGgYzW1lQ= golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= -golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= -golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/term v0.19.0 h1:+ThwsDv+tYfnJFhF4L8jITxu1tdTWRTZpdsWgEgjL6Q= +golang.org/x/term v0.19.0/go.mod h1:2CuTdWZ7KHSQwUzKva0cbMg6q2DMI3Mmxp+gKJbskEk= golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= @@ -1554,17 +1391,14 @@ golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= -golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.5.0 h1:o7cqy6amK/52YcAKIPlM3a+Fpj35zvRj2TP+e1xFSfk= golang.org/x/time v0.5.0/go.mod h1:3BpzKBy/shNhVucY/MWOyx10tF3SFh9QdLuxbVysPQM= -golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20190206041539-40960b6deb8e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= +golang.org/x/tools v0.0.0-20190312151545-0bb0c0a6e846/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190312170243-e65039ee4138/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= golang.org/x/tools v0.0.0-20190425150028-36563e24a262/go.mod h1:RgjU9mgBXZiqYHBnxXauZ1Gv1EHHAz9KjViQ78xBX0Q= @@ -1573,9 +1407,12 @@ golang.org/x/tools v0.0.0-20190524140312-2c0ae7006135/go.mod h1:RgjU9mgBXZiqYHBn golang.org/x/tools v0.0.0-20190606124116-d0a3d012864b/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc= +golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= @@ -1584,11 +1421,11 @@ golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191227053925-7b8e75db28f4/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200103221440-774c71fcf114/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= -golang.org/x/tools v0.0.0-20200108203644-89082a384178/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200117161641-43d50277825c/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200122220014-bf1340f18c4a/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200204074204-1cc6d1ef6c74/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200207183749-b753a1ba74fa/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200212150539-ea181f53ac56/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200227222343-706bc42d1f0d/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= @@ -1616,9 +1453,8 @@ golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.4/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.5/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= -golang.org/x/tools v0.2.0/go.mod h1:y4OqIKeOV/fWJetJ8bXPU1sEVniLMIyDAZWeHdV+NTA= -golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= -golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/tools v0.20.0 h1:hz/CVckiOxybQvFw6h7b/q80NTr9IUQb4s1IIzW7KNY= +golang.org/x/tools v0.20.0/go.mod h1:WvitBU7JJf6A4jOdg4S1tviW9bhUxkgeCui/0JHctQg= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -1628,12 +1464,6 @@ golang.org/x/xerrors v0.0.0-20220517211312-f3a8303e98df/go.mod h1:K8+ghG5WaK9qNq golang.org/x/xerrors v0.0.0-20220609144429-65e65417b02f/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk= golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2/go.mod h1:K8+ghG5WaK9qNqU5K3HdILfMLy1f3aNYFI/wnl100a8= -gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.0.0-20181121035319-3f7ecaa7e8ca/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo= -gonum.org/v1/gonum v0.6.0/go.mod h1:9mxDZsDKxgMAuccQkewq682L+0eCu4dCN2yonUJTCLU= -gonum.org/v1/netlib v0.0.0-20181029234149-ec6d1f5cefe6/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/netlib v0.0.0-20190313105609-8cb42192e0e0/go.mod h1:wa6Ws7BG/ESfp6dHfk7C6KdzKA7wR7u/rKwOGE66zvw= -gonum.org/v1/plot v0.0.0-20190515093506-e2840ee46a6b/go.mod h1:Wt8AAjI+ypCyYX3nZBvf6cAIx93T+c/OS2HFAYskSZc= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1683,8 +1513,8 @@ google.golang.org/api v0.96.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ google.golang.org/api v0.97.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.98.0/go.mod h1:w7wJQLTM+wvQpNf5JyEcBoxK0RH7EDrh/L4qfsuJ13s= google.golang.org/api v0.100.0/go.mod h1:ZE3Z2+ZOr87Rx7dqFsdRQkRBk36kDtp/h+QpHbB7a70= -google.golang.org/api v0.155.0 h1:vBmGhCYs0djJttDNynWo44zosHlPvHmA0XiN2zP2DtA= -google.golang.org/api v0.155.0/go.mod h1:GI5qK5f40kCpHfPn6+YzGAByIKWv8ujFnmoWm7Igduk= +google.golang.org/api v0.162.0 h1:Vhs54HkaEpkMBdgGdOT2P6F0csGG/vxDS0hWHJzmmps= +google.golang.org/api v0.162.0/go.mod h1:6SulDkfoBIg4NFmCuZ39XeeAgSHCPecfSUuDyYlAHs0= google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM= google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4= @@ -1702,7 +1532,6 @@ google.golang.org/genproto v0.0.0-20190418145605-e7d98fc518a7/go.mod h1:VzzqZJRn google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190502173448-54afdca5d873/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE= google.golang.org/genproto v0.0.0-20190530194941-fb225487d101/go.mod h1:z3L6/3dTEVtUr6QSP8miRzeRqwQOioJ9I66odjN4I7s= -google.golang.org/genproto v0.0.0-20190716160619-c506a9f90610/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190801165951-fa694d86fc64/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190819201941-24fa4b261c55/go.mod h1:DMBHOl98Agz4BDEuKkezgsaosCRResVns1a3J2ZsMNc= google.golang.org/genproto v0.0.0-20190911173649-1774047e7e51/go.mod h1:IbNlFCBrqXvoKpeg0TB2l7cyZUmoaFKYIwrEpbDKLA8= @@ -1710,7 +1539,6 @@ google.golang.org/genproto v0.0.0-20191108220845-16a3f7862a1a/go.mod h1:n3cpQtvx google.golang.org/genproto v0.0.0-20191115194625-c23dd37a84c9/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191216164720-4f79533eabd1/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20191230161307-f3c370f40bfb/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= -google.golang.org/genproto v0.0.0-20200108215221-bd8f9a0ef82f/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200115191322-ca5a22157cba/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200122232147-0452cf42e150/go.mod h1:n3cpQtvxv34hfy77yVDNjmbRyujviMdxYliBSkLhpCc= google.golang.org/genproto v0.0.0-20200204135345-fa8e72b47b90/go.mod h1:GmwEX6Z4W5gMy59cAlVYjN9JhxgbQH6Gn+gFDQe2lzA= @@ -1803,12 +1631,12 @@ google.golang.org/genproto v0.0.0-20221010155953-15ba04fc1c0e/go.mod h1:3526vdqw google.golang.org/genproto v0.0.0-20221014173430-6e2ab493f96b/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221014213838-99cd37c6964a/go.mod h1:1vXfmgAz9N9Jx0QA82PqRVauvCz1SGSz739p0f183jM= google.golang.org/genproto v0.0.0-20221025140454-527a21cfbd71/go.mod h1:9qHF0xnpdSfF6knlcsnpzUu5y+rpwgbvsyGAZPBMg4s= -google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80 h1:KAeGQVN3M9nD0/bQXnr/ClcEMJ968gUXJQ9pwfSynuQ= -google.golang.org/genproto v0.0.0-20240123012728-ef4313101c80/go.mod h1:cc8bqMqtv9gMOr0zHg2Vzff5ULhhL2IXP4sbcn32Dro= -google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80 h1:Lj5rbfG876hIAYFjqiJnPHfhXbv+nzTWfm04Fg/XSVU= -google.golang.org/genproto/googleapis/api v0.0.0-20240123012728-ef4313101c80/go.mod h1:4jWUdICTdgc3Ibxmr8nAJiiLHwQBY0UI0XZcEMaFKaA= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80 h1:AjyfHzEPEFp/NpvfN5g+KDla3EMojjhRVZc1i7cj+oM= -google.golang.org/genproto/googleapis/rpc v0.0.0-20240123012728-ef4313101c80/go.mod h1:PAREbraiVEVGVdTZsVWjSbbTtSyGbAgIIvni8a8CD5s= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de h1:F6qOa9AZTYJXOUEr4jDysRDLrm4PHePlge4v4TGAlxY= +google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:VUhTRKeHn9wwcdrk73nvdC9gF178Tzhmt/qyaFcPLSo= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de h1:jFNzHPIeuzhdRwVhbZdiym9q0ory/xY3sA+v2wPg8I0= +google.golang.org/genproto/googleapis/api v0.0.0-20240227224415-6ceb2ff114de/go.mod h1:5iCWqnniDlqZHrd3neWVTOwvh/v6s3232omMecelax8= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda h1:LI5DOvAxUPMv/50agcLLoo+AdWc1irS9Rzz4vPuD1V4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda/go.mod h1:WtryC6hu0hhx87FDGxWCDptyssuo68sk10vYjF+T9fY= google.golang.org/grpc v1.17.0/go.mod h1:6QZJwpn2B+Zp71q/5VxRsJ6NXXVCE5NRUHRo+f3cWCs= google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c= google.golang.org/grpc v1.20.0/go.mod h1:chYK+tFQF0nDUGJgXMSgLCQk3phJEuONr2DCgLDdAQM= @@ -1850,8 +1678,8 @@ google.golang.org/grpc v1.48.0/go.mod h1:vN9eftEi1UMyUsIF80+uQXhHjbXYbm0uXoFCACu google.golang.org/grpc v1.49.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.0/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= google.golang.org/grpc v1.50.1/go.mod h1:ZgQEeidpAuNRZ8iRrlBKXZQP1ghovWIVhdJRyCDK+GI= -google.golang.org/grpc v1.62.1 h1:B4n+nfKzOICUXMgyrNd19h/I9oH0L1pizfk1d4zSgTk= -google.golang.org/grpc v1.62.1/go.mod h1:IWTG0VlJLCh1SkC58F7np9ka9mx/WNkjl4PGJaiq+QE= +google.golang.org/grpc v1.63.2 h1:MUeiw1B2maTVZthpU5xvASfTh3LDbxHd6IJ6QQVU+xM= +google.golang.org/grpc v1.63.2/go.mod h1:WAX/8DgncnokcFUldAxq7GeB5DXHDbMF+lLvDomNkRA= google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.1.0/go.mod h1:6Kw0yEErY5E/yWrBtf03jp27GLLJujG4z/JK95pnjjw= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= @@ -1884,12 +1712,9 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= -gopkg.in/natefinch/npipe.v2 v2.0.0-20160621034901-c1b8fa8bdcce/go.mod h1:5AcXVHNjg+BDxry382+8OKon8SEWiKktQR07RKPsv1c= -gopkg.in/olebedev/go-duktape.v3 v3.0.0-20200619000410-60c24ae608a6/go.mod h1:uAJfkITjFhyEEuUfm7bsmCZRbW5WRq8s9EY8HZ6hCns= gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ= gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw= -gopkg.in/urfave/cli.v1 v1.20.0/go.mod h1:vuBzUtMdQeixQj8LVd+/98pzhxNGQoyuPBlsXHOQNO0= gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bli9HhUf9+ttbYbLASfIpnQbh74= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -1905,8 +1730,6 @@ gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gotest.tools v2.2.0+incompatible h1:VsBPFP1AI068pPrMxtb/S8Zkgf9xEmTLJjfM+P5UIEo= -gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.5.1 h1:EENdUnS3pdur5nybKYIh2Vfgc8IUNBjxDPSjtiJcOzU= gotest.tools/v3 v3.5.1/go.mod h1:isy3WKz7GK6uNw/sbHzfKBLvlvXwUyV06n6brMxxopU= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1917,7 +1740,6 @@ honnef.co/go/tools v0.0.0-20190523083050-ea95bdfd59fc/go.mod h1:rf3lG4BRIbNafJWh honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg= honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= -honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= pgregory.net/rapid v1.1.0 h1:CMa0sjHSru3puNx+J0MIAuiiEV4N0qj8/cMWGBBCsjw= @@ -1926,7 +1748,6 @@ rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8 rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= -rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.4.0 h1:Mk1wCc2gy/F0THH0TAp1QYyJNzRm2KCLy3o5ASXVI5E= sigs.k8s.io/yaml v1.4.0/go.mod h1:Ejl7/uTz7PSA4eKMyQCUTnhZYNmLIl+5c2lQPGR2BPY= diff --git a/proto/kujira/denom/tx.proto b/proto/kujira/denom/tx.proto index a8d55c81..77eb044f 100644 --- a/proto/kujira/denom/tx.proto +++ b/proto/kujira/denom/tx.proto @@ -2,7 +2,9 @@ syntax = "proto3"; package kujira.denom; import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; import "cosmos/base/v1beta1/coin.proto"; +import "kujira/denom/params.proto"; option go_package = "github.com/Team-Kujira/core/x/denom/types"; @@ -17,6 +19,9 @@ service Msg { // cases rpc ForceTransfer(MsgForceTransfer) returns // (MsgForceTransferResponse); rpc ChangeAdmin(MsgChangeAdmin) returns (MsgChangeAdminResponse); + + // UpdateParams sets new module params + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } message MsgAddNoFeeAccounts { @@ -35,6 +40,8 @@ message MsgRemoveNoFeeAccountsResponse {} // a new denom. It requires a sender address and a unique nonce // (to allow accounts to create multiple denoms) message MsgCreateDenom { + option (cosmos.msg.v1.signer) = "sender"; + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; string nonce = 2 [ (gogoproto.moretags) = "yaml:\"nonce\"" ]; } @@ -49,6 +56,8 @@ message MsgCreateDenomResponse { // MsgMint is the sdk.Msg type for allowing an admin account to mint // more of a token. message MsgMint { + option (cosmos.msg.v1.signer) = "sender"; + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; cosmos.base.v1beta1.Coin amount = 2 [ (gogoproto.moretags) = "yaml:\"amount\"", @@ -62,6 +71,8 @@ message MsgMintResponse {} // MsgBurn is the sdk.Msg type for allowing an admin account to burn // a token. For now, we only support burning from the sender account. message MsgBurn { + option (cosmos.msg.v1.signer) = "sender"; + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; cosmos.base.v1beta1.Coin amount = 2 [ (gogoproto.moretags) = "yaml:\"amount\"", @@ -89,9 +100,21 @@ message MsgBurnResponse {} // MsgChangeAdmin is the sdk.Msg type for allowing an admin account to reassign // adminship of a denom to a new account message MsgChangeAdmin { + option (cosmos.msg.v1.signer) = "sender"; + string sender = 1 [ (gogoproto.moretags) = "yaml:\"sender\"" ]; string denom = 2 [ (gogoproto.moretags) = "yaml:\"denom\"" ]; string newAdmin = 3 [ (gogoproto.moretags) = "yaml:\"new_admin\"" ]; } -message MsgChangeAdminResponse {} \ No newline at end of file +message MsgChangeAdminResponse {} + +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; + + string authority = 1 [(gogoproto.moretags) = "yaml:\"authority\""]; + Params params = 2 [(gogoproto.moretags) = "yaml:\"params\""]; +} + +// MsgUpdateParamsResponse defines the Msg/UpdateParams response type. +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/proto/kujira/oracle/genesis.proto b/proto/kujira/oracle/genesis.proto index 1e2ee109..4687551f 100644 --- a/proto/kujira/oracle/genesis.proto +++ b/proto/kujira/oracle/genesis.proto @@ -10,12 +10,9 @@ option go_package = "github.com/Team-Kujira/core/x/oracle/types"; // GenesisState defines the oracle module's genesis state. message GenesisState { Params params = 1 [(gogoproto.nullable) = false]; - repeated FeederDelegation feeder_delegations = 2 [(gogoproto.nullable) = false]; - repeated ExchangeRateTuple exchange_rates = 3 + repeated ExchangeRateTuple exchange_rates = 2 [(gogoproto.castrepeated) = "ExchangeRateTuples", (gogoproto.nullable) = false]; - repeated MissCounter miss_counters = 4 [(gogoproto.nullable) = false]; - repeated AggregateExchangeRatePrevote aggregate_exchange_rate_prevotes = 5 [(gogoproto.nullable) = false]; - repeated AggregateExchangeRateVote aggregate_exchange_rate_votes = 6 [(gogoproto.nullable) = false]; + repeated MissCounter miss_counters = 3 [(gogoproto.nullable) = false]; } // FeederDelegation is the address for where oracle feeder authority are diff --git a/proto/kujira/oracle/oracle.proto b/proto/kujira/oracle/oracle.proto index 2230f295..3cb36af2 100644 --- a/proto/kujira/oracle/oracle.proto +++ b/proto/kujira/oracle/oracle.proto @@ -11,32 +11,30 @@ message Params { option (gogoproto.equal) = true; option (gogoproto.goproto_stringer) = false; - uint64 vote_period = 1 [(gogoproto.moretags) = "yaml:\"vote_period\""]; - string vote_threshold = 2 [ + string vote_threshold = 1 [ (gogoproto.moretags) = "yaml:\"vote_threshold\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - string reward_band = 3 [ - (gogoproto.moretags) = "yaml:\"reward_band\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + string max_deviation = 2 [ + (gogoproto.moretags) = "yaml:\"max_deviation\"", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - uint64 reward_distribution_window = 4 [(gogoproto.moretags) = "yaml:\"reward_distribution_window\""]; - repeated Denom whitelist = 5 [ - (gogoproto.moretags) = "yaml:\"whitelist\"", - (gogoproto.castrepeated) = "DenomList", - (gogoproto.nullable) = false + repeated Symbol required_symbols = 3 [ + (gogoproto.moretags) = "yaml:\"required_symbols\"", + (gogoproto.nullable) = false ]; - string slash_fraction = 6 [ + uint32 last_symbol_id = 4; + string slash_fraction = 5 [ (gogoproto.moretags) = "yaml:\"slash_fraction\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; - uint64 slash_window = 7 [(gogoproto.moretags) = "yaml:\"slash_window\""]; - string min_valid_per_window = 8 [ + uint64 slash_window = 6 [(gogoproto.moretags) = "yaml:\"slash_window\""]; + string min_valid_per_window = 7 [ (gogoproto.moretags) = "yaml:\"min_valid_per_window\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } @@ -50,32 +48,14 @@ message Denom { string name = 1 [(gogoproto.moretags) = "yaml:\"name\""]; } -// struct for aggregate prevoting on the ExchangeRateVote. -// The purpose of aggregate prevote is to hide vote exchange rates with hash -// which is formatted as hex string in SHA256("{salt}:{exchange rate}{denom},...,{exchange rate}{denom}:{voter}") -message AggregateExchangeRatePrevote { +// Symbol - the object to hold configurations of each symbol +message Symbol { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; - string hash = 1 [(gogoproto.moretags) = "yaml:\"hash\""]; - string voter = 2 [(gogoproto.moretags) = "yaml:\"voter\""]; - uint64 submit_block = 3 [(gogoproto.moretags) = "yaml:\"submit_block\""]; -} - -// MsgAggregateExchangeRateVote - struct for voting on exchange rates. -message AggregateExchangeRateVote { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - option (gogoproto.goproto_stringer) = false; - - repeated ExchangeRateTuple exchange_rate_tuples = 1 [ - (gogoproto.moretags) = "yaml:\"exchange_rate_tuples\"", - (gogoproto.castrepeated) = "ExchangeRateTuples", - (gogoproto.nullable) = false - ]; - - string voter = 2 [(gogoproto.moretags) = "yaml:\"voter\""]; + string symbol = 1; + uint32 id = 2; } // ExchangeRateTuple - struct to store interpreted exchange rates data to store @@ -84,10 +64,15 @@ message ExchangeRateTuple { option (gogoproto.goproto_getters) = false; option (gogoproto.goproto_stringer) = false; - string denom = 1 [(gogoproto.moretags) = "yaml:\"denom\""]; + string symbol = 1 [ (gogoproto.moretags) = "yaml:\"symbol\"" ]; string exchange_rate = 2 [ (gogoproto.moretags) = "yaml:\"exchange_rate\"", - (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", + (gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false ]; } + +message VoteExtension { + int64 height = 1; + map prices = 2; +} diff --git a/proto/kujira/oracle/query.proto b/proto/kujira/oracle/query.proto index 9066c6af..f1bd9fef 100644 --- a/proto/kujira/oracle/query.proto +++ b/proto/kujira/oracle/query.proto @@ -10,24 +10,19 @@ option go_package = "github.com/Team-Kujira/core/x/oracle/types"; // Query defines the gRPC querier service. service Query { - // ExchangeRate returns exchange rate of a denom + // ExchangeRate returns exchange rate of a symbol rpc ExchangeRate(QueryExchangeRateRequest) returns (QueryExchangeRateResponse) { - option (google.api.http).get = "/oracle/denoms/{denom}/exchange_rate"; + option (google.api.http).get = "/oracle/symbols/{symbol}/exchange_rate"; } - // ExchangeRates returns exchange rates of all denoms + // ExchangeRates returns exchange rates of all symbols rpc ExchangeRates(QueryExchangeRatesRequest) returns (QueryExchangeRatesResponse) { - option (google.api.http).get = "/oracle/denoms/exchange_rates"; + option (google.api.http).get = "/oracle/symbols/exchange_rates"; } - // Actives returns all active denoms + // Actives returns all active symbols rpc Actives(QueryActivesRequest) returns (QueryActivesResponse) { - option (google.api.http).get = "/oracle/denoms/actives"; - } - - // FeederDelegation returns feeder delegation of a validator - rpc FeederDelegation(QueryFeederDelegationRequest) returns (QueryFeederDelegationResponse) { - option (google.api.http).get = "/oracle/validators/{validator_addr}/feeder"; + option (google.api.http).get = "/oracle/symbols/actives"; } // MissCounter returns oracle miss counter of a validator @@ -35,26 +30,6 @@ service Query { option (google.api.http).get = "/oracle/validators/{validator_addr}/miss"; } - // AggregatePrevote returns an aggregate prevote of a validator - rpc AggregatePrevote(QueryAggregatePrevoteRequest) returns (QueryAggregatePrevoteResponse) { - option (google.api.http).get = "/oracle/validators/{validator_addr}/aggregate_prevote"; - } - - // AggregatePrevotes returns aggregate prevotes of all validators - rpc AggregatePrevotes(QueryAggregatePrevotesRequest) returns (QueryAggregatePrevotesResponse) { - option (google.api.http).get = "/oracle/validators/aggregate_prevotes"; - } - - // AggregateVote returns an aggregate vote of a validator - rpc AggregateVote(QueryAggregateVoteRequest) returns (QueryAggregateVoteResponse) { - option (google.api.http).get = "/oracle/valdiators/{validator_addr}/aggregate_vote"; - } - - // AggregateVotes returns aggregate votes of all validators - rpc AggregateVotes(QueryAggregateVotesRequest) returns (QueryAggregateVotesResponse) { - option (google.api.http).get = "/oracle/validators/aggregate_votes"; - } - // Params queries all parameters. rpc Params(QueryParamsRequest) returns (QueryParamsResponse) { option (google.api.http).get = "/oracle/params"; @@ -66,8 +41,8 @@ message QueryExchangeRateRequest { option (gogoproto.equal) = false; option (gogoproto.goproto_getters) = false; - // denom defines the denomination to query for. - string denom = 1; + // symbol defines the symbol to query for. + string symbol = 1; } // QueryExchangeRateResponse is response type for the @@ -75,7 +50,7 @@ message QueryExchangeRateRequest { message QueryExchangeRateResponse { // exchange_rate defines the exchange rate of whitelisted assets string exchange_rate = 1 - [(gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false]; + [(gogoproto.customtype) = "cosmossdk.io/math.LegacyDec", (gogoproto.nullable) = false]; } // QueryExchangeRatesRequest is the request type for the Query/ExchangeRates RPC method. @@ -84,7 +59,7 @@ message QueryExchangeRatesRequest {} // QueryExchangeRatesResponse is response type for the // Query/ExchangeRates RPC method. message QueryExchangeRatesResponse { - // exchange_rates defines a list of the exchange rate for all whitelisted denoms. + // exchange_rates defines a list of the exchange rate for all whitelisted symbols. repeated cosmos.base.v1beta1.DecCoin exchange_rates = 1 [(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.DecCoins", (gogoproto.nullable) = false]; } @@ -95,7 +70,7 @@ message QueryActivesRequest {} // QueryActivesResponse is response type for the // Query/Actives RPC method. message QueryActivesResponse { - // actives defines a list of the denomination which oracle prices aggreed upon. + // actives defines a list of the symbols which oracle prices aggreed upon. repeated string actives = 1; } @@ -105,27 +80,11 @@ message QueryVoteTargetsRequest {} // QueryVoteTargetsResponse is response type for the // Query/VoteTargets RPC method. message QueryVoteTargetsResponse { - // vote_targets defines a list of the denomination in which everyone + // vote_targets defines a list of the symbols in which everyone // should vote in the current vote period. repeated string vote_targets = 1; } -// QueryFeederDelegationRequest is the request type for the Query/FeederDelegation RPC method. -message QueryFeederDelegationRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // validator defines the validator address to query for. - string validator_addr = 1; -} - -// QueryFeederDelegationResponse is response type for the -// Query/FeederDelegation RPC method. -message QueryFeederDelegationResponse { - // feeder_addr defines the feeder delegation of a validator - string feeder_addr = 1; -} - // QueryMissCounterRequest is the request type for the Query/MissCounter RPC method. message QueryMissCounterRequest { option (gogoproto.equal) = false; @@ -142,58 +101,6 @@ message QueryMissCounterResponse { uint64 miss_counter = 1; } -// QueryAggregatePrevoteRequest is the request type for the Query/AggregatePrevote RPC method. -message QueryAggregatePrevoteRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // validator defines the validator address to query for. - string validator_addr = 1; -} - -// QueryAggregatePrevoteResponse is response type for the -// Query/AggregatePrevote RPC method. -message QueryAggregatePrevoteResponse { - // aggregate_prevote defines oracle aggregate prevote submitted by a validator in the current vote period - AggregateExchangeRatePrevote aggregate_prevote = 1 [(gogoproto.nullable) = false]; -} - -// QueryAggregatePrevotesRequest is the request type for the Query/AggregatePrevotes RPC method. -message QueryAggregatePrevotesRequest {} - -// QueryAggregatePrevotesResponse is response type for the -// Query/AggregatePrevotes RPC method. -message QueryAggregatePrevotesResponse { - // aggregate_prevotes defines all oracle aggregate prevotes submitted in the current vote period - repeated AggregateExchangeRatePrevote aggregate_prevotes = 1 [(gogoproto.nullable) = false]; -} - -// QueryAggregateVoteRequest is the request type for the Query/AggregateVote RPC method. -message QueryAggregateVoteRequest { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; - - // validator defines the validator address to query for. - string validator_addr = 1; -} - -// QueryAggregateVoteResponse is response type for the -// Query/AggregateVote RPC method. -message QueryAggregateVoteResponse { - // aggregate_vote defines oracle aggregate vote submitted by a validator in the current vote period - AggregateExchangeRateVote aggregate_vote = 1 [(gogoproto.nullable) = false]; -} - -// QueryAggregateVotesRequest is the request type for the Query/AggregateVotes RPC method. -message QueryAggregateVotesRequest {} - -// QueryAggregateVotesResponse is response type for the -// Query/AggregateVotes RPC method. -message QueryAggregateVotesResponse { - // aggregate_votes defines all oracle aggregate votes submitted in the current vote period - repeated AggregateExchangeRateVote aggregate_votes = 1 [(gogoproto.nullable) = false]; -} - // QueryParamsRequest is the request type for the Query/Params RPC method. message QueryParamsRequest {} diff --git a/proto/kujira/oracle/tx.proto b/proto/kujira/oracle/tx.proto index 87dd9d98..7b418dd6 100644 --- a/proto/kujira/oracle/tx.proto +++ b/proto/kujira/oracle/tx.proto @@ -2,61 +2,51 @@ syntax = "proto3"; package kujira.oracle; import "gogoproto/gogo.proto"; +import "cosmos/msg/v1/msg.proto"; +import "kujira/oracle/oracle.proto"; option go_package = "github.com/Team-Kujira/core/x/oracle/types"; // Msg defines the oracle Msg service. service Msg { - // AggregateExchangeRatePrevote defines a method for submitting - // aggregate exchange rate prevote - rpc AggregateExchangeRatePrevote(MsgAggregateExchangeRatePrevote) returns (MsgAggregateExchangeRatePrevoteResponse); + // AddRequiredSymbol adds a new price to the required list of prices + rpc AddRequiredSymbols(MsgAddRequiredSymbols) returns (MsgAddRequiredSymbolsResponse); - // AggregateExchangeRateVote defines a method for submitting - // aggregate exchange rate vote - rpc AggregateExchangeRateVote(MsgAggregateExchangeRateVote) returns (MsgAggregateExchangeRateVoteResponse); + // RemoveRequiredSymbol removes a price from the required list of prices + rpc RemoveRequiredSymbols(MsgRemoveRequiredSymbols) returns (MsgRemoveRequiredSymbolsResponse); - // DelegateFeedConsent defines a method for setting the feeder delegation - rpc DelegateFeedConsent(MsgDelegateFeedConsent) returns (MsgDelegateFeedConsentResponse); + // UpdateParams sets new module params + rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse); } -// MsgAggregateExchangeRatePrevote represents a message to submit -// aggregate exchange rate prevote. -message MsgAggregateExchangeRatePrevote { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; +// MsgAddRequiredSymbol represents a message to add a symbol to the whitelist +message MsgAddRequiredSymbols { + option (cosmos.msg.v1.signer) = "authority"; - string hash = 1 [(gogoproto.moretags) = "yaml:\"hash\""]; - string feeder = 2 [(gogoproto.moretags) = "yaml:\"feeder\""]; - string validator = 3 [(gogoproto.moretags) = "yaml:\"validator\""]; + string authority = 1 [(gogoproto.moretags) = "yaml:\"authority\""]; + repeated string symbols = 2 [ (gogoproto.moretags) = "yaml:\"symbols\"" ]; } -// MsgAggregateExchangeRatePrevoteResponse defines the Msg/AggregateExchangeRatePrevote response type. -message MsgAggregateExchangeRatePrevoteResponse {} +// MsgAddRequiredSymbolResponse defines the Msg/AddRequiredSymbol response type. +message MsgAddRequiredSymbolsResponse {} -// MsgAggregateExchangeRateVote represents a message to submit -// aggregate exchange rate vote. -message MsgAggregateExchangeRateVote { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; +// MsgRemoveRequiredSymbol represents a message to remove a symbol from the whitelist +message MsgRemoveRequiredSymbols { + option (cosmos.msg.v1.signer) = "authority"; - string salt = 1 [(gogoproto.moretags) = "yaml:\"salt\""]; - string exchange_rates = 2 [(gogoproto.moretags) = "yaml:\"exchange_rates\""]; - string feeder = 3 [(gogoproto.moretags) = "yaml:\"feeder\""]; - string validator = 4 [(gogoproto.moretags) = "yaml:\"validator\""]; + string authority = 1 [ (gogoproto.moretags) = "yaml:\"authority\"" ]; + repeated string symbols = 2 [ (gogoproto.moretags) = "yaml:\"symbols\"" ]; } -// MsgAggregateExchangeRateVoteResponse defines the Msg/AggregateExchangeRateVote response type. -message MsgAggregateExchangeRateVoteResponse {} +// MsgRemoveRequiredSymbolResponse defines the Msg/RemoveRequiredSymbol response type. +message MsgRemoveRequiredSymbolsResponse {} -// MsgDelegateFeedConsent represents a message to -// delegate oracle voting rights to another address. -message MsgDelegateFeedConsent { - option (gogoproto.equal) = false; - option (gogoproto.goproto_getters) = false; +message MsgUpdateParams { + option (cosmos.msg.v1.signer) = "authority"; - string operator = 1 [(gogoproto.moretags) = "yaml:\"operator\""]; - string delegate = 2 [(gogoproto.moretags) = "yaml:\"delegate\""]; + string authority = 1 [(gogoproto.moretags) = "yaml:\"authority\""]; + Params params = 2 [(gogoproto.moretags) = "yaml:\"params\""]; } -// MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response type. -message MsgDelegateFeedConsentResponse {} \ No newline at end of file +// MsgUpdateParamsResponse defines the Msg/UpdateParams response type. +message MsgUpdateParamsResponse {} \ No newline at end of file diff --git a/proto/kujira/scheduler/proposal.proto b/proto/kujira/scheduler/proposal.proto deleted file mode 100644 index 53d78ab0..00000000 --- a/proto/kujira/scheduler/proposal.proto +++ /dev/null @@ -1,59 +0,0 @@ -syntax = "proto3"; -package kujira.scheduler; - -import "gogoproto/gogo.proto"; -import "kujira/scheduler/hook.proto"; -import "cosmos/base/v1beta1/coin.proto"; - -option go_package = "github.com/Team-Kujira/core/x/scheduler/types"; -option (gogoproto.goproto_stringer_all) = false; - - -message CreateHookProposal { - // Title is a short summary - string title = 1; - // Description is a human readable text - string description = 2; - - // The account that will execute the msg on the schedule - string executor = 3; - - // The contract that the msg is called on - string contract = 4; - - bytes msg = 5 [ (gogoproto.casttype) = "github.com/CosmWasm/wasmd/x/wasm/types.RawContractMessage" ]; - int64 frequency = 6; - repeated cosmos.base.v1beta1.Coin funds = 7 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; - -} - -message UpdateHookProposal { - // Title is a short summary - string title = 1; - - // Description is a human readable text - string description = 2; - - uint64 id = 3; - string executor = 4; - string contract = 5; - bytes msg = 6 [ (gogoproto.casttype) = "github.com/CosmWasm/wasmd/x/wasm/types.RawContractMessage" ]; - int64 frequency = 7; - repeated cosmos.base.v1beta1.Coin funds = 8 [ - (gogoproto.nullable) = false, - (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" - ]; -} - -message DeleteHookProposal { - // Title is a short summary - string title = 1; - - // Description is a human readable text - string description = 2; - - uint64 id = 3; -} diff --git a/proto/kujira/scheduler/tx.proto b/proto/kujira/scheduler/tx.proto new file mode 100644 index 00000000..955616ca --- /dev/null +++ b/proto/kujira/scheduler/tx.proto @@ -0,0 +1,82 @@ +syntax = "proto3"; +package kujira.scheduler; + +import "gogoproto/gogo.proto"; +import "kujira/scheduler/hook.proto"; +import "cosmos/base/v1beta1/coin.proto"; +import "cosmos/msg/v1/msg.proto"; +import "cosmos_proto/cosmos.proto"; + +option go_package = "github.com/Team-Kujira/core/x/scheduler/types"; + +// Msg defines the scheduler Msg service. +service Msg { + // CreateHook adds a new hook to the scheduler + rpc CreateHook(MsgCreateHook) returns (MsgCreateHookResponse); + + // UpdateHook updates an existing hook + rpc UpdateHook(MsgUpdateHook) returns (MsgUpdateHookResponse); + + // DeleteHook removes a hook from the scheduler + rpc DeleteHook(MsgDeleteHook) returns (MsgDeleteHookResponse); + +} + +message MsgCreateHook { + option (cosmos.msg.v1.signer) = "authority"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // The account that will execute the msg on the schedule + string executor = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + // The contract that the msg is called on + string contract = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + + bytes msg = 4 [ + (gogoproto.casttype) = "github.com/CosmWasm/wasmd/x/wasm/types.RawContractMessage" + ]; + int64 frequency = 5 [(gogoproto.moretags) = "yaml:\"frequency\""]; + repeated cosmos.base.v1beta1.Coin funds = 6 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; + +} +message MsgCreateHookResponse {} + +message MsgUpdateHook { + option (cosmos.msg.v1.signer) = "authority"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + uint64 id = 2; + string executor = 3 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + string contract = 4 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + bytes msg = 5 [ (gogoproto.casttype) = "github.com/CosmWasm/wasmd/x/wasm/types.RawContractMessage" ]; + int64 frequency = 6; + repeated cosmos.base.v1beta1.Coin funds = 7 [ + (gogoproto.nullable) = false, + (gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins" + ]; +} + +message MsgUpdateHookResponse {} + + +message MsgDeleteHook { + option (cosmos.msg.v1.signer) = "authority"; + + option (gogoproto.equal) = false; + option (gogoproto.goproto_getters) = false; + + string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"]; + uint64 id = 2; +} + +message MsgDeleteHookResponse {} diff --git a/scripts/protocgen-wrapper.sh b/scripts/protocgen-wrapper.sh new file mode 100755 index 00000000..1d107fd2 --- /dev/null +++ b/scripts/protocgen-wrapper.sh @@ -0,0 +1,7 @@ +#!/bin/sh + +if which docker > /dev/null; then + docker run --volume "$(pwd):/workspace" --workdir /workspace ghcr.io/cosmos/proto-builder:0.14.0 sh ./scripts/protocgen.sh + elif which podman > /dev/null; then + podman run --rm -v $(pwd):/workspace --workdir /workspace -u root ghcr.io/cosmos/proto-builder:0.14.0 sh ./scripts/protocgen.sh +fi \ No newline at end of file diff --git a/wasmbinding/bindings/ibc.go b/wasmbinding/bindings/ibc.go index 5d13f6a4..610f14bb 100644 --- a/wasmbinding/bindings/ibc.go +++ b/wasmbinding/bindings/ibc.go @@ -2,15 +2,15 @@ package bindings import ( "cosmossdk.io/errors" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - "github.com/cosmos/ibc-go/v7/modules/core/03-connection/types" - commitmenttypes "github.com/cosmos/ibc-go/v7/modules/core/23-commitment/types" - "github.com/cosmos/ibc-go/v7/modules/core/exported" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" - ibctmtypes "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + commitmenttypes "github.com/cosmos/ibc-go/v8/modules/core/23-commitment/types" + "github.com/cosmos/ibc-go/v8/modules/core/exported" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" + ibctmtypes "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" ) type VerifyMembershipQuery struct { @@ -37,7 +37,7 @@ type IbcVerifyResponse struct{} // ----- moved from ibc-go/modules/core/03-connection ----- // getClientStateAndVerificationStore returns the client state and associated KVStore for the provided client identifier. // If the client type is localhost then the core IBC KVStore is returned, otherwise the client prefixed store is returned. -func getClientStateAndVerificationStore(ctx sdk.Context, keeper ibckeeper.Keeper, clientID string, ibcStoreKey *storetypes.KVStoreKey) (exported.ClientState, sdk.KVStore, error) { +func getClientStateAndVerificationStore(ctx sdk.Context, keeper ibckeeper.Keeper, clientID string, ibcStoreKey *storetypes.KVStoreKey) (exported.ClientState, storetypes.KVStore, error) { clientState, found := keeper.ClientKeeper.GetClientState(ctx, clientID) if !found { return nil, nil, errors.Wrap(clienttypes.ErrClientNotFound, clientID) diff --git a/wasmbinding/message_plugin.go b/wasmbinding/message_plugin.go index 8577a74c..542c84ba 100644 --- a/wasmbinding/message_plugin.go +++ b/wasmbinding/message_plugin.go @@ -5,12 +5,15 @@ import ( "cosmossdk.io/errors" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - bankkeeper "github.com/terra-money/alliance/custom/bank/keeper" + + // bankkeeper "github.com/terra-money/alliance/custom/bank/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" "github.com/Team-Kujira/core/wasmbinding/bindings" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" batchkeeper "github.com/Team-Kujira/core/x/batch/keeper" batch "github.com/Team-Kujira/core/x/batch/wasm" @@ -18,7 +21,7 @@ import ( cwica "github.com/Team-Kujira/core/x/cw-ica/wasm" denomkeeper "github.com/Team-Kujira/core/x/denom/keeper" denom "github.com/Team-Kujira/core/x/denom/wasm" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" ) // CustomMessageDecorator returns decorator for custom CosmWasm bindings messages @@ -61,13 +64,13 @@ func (m *CustomMessenger) DispatchMsg( contractAddr sdk.AccAddress, contractIBCPortID string, msg wasmvmtypes.CosmosMsg, -) ([]sdk.Event, [][]byte, error) { +) ([]sdk.Event, [][]byte, [][]*codectypes.Any, error) { if msg.Custom != nil { // only handle the happy path where this is really creating / minting / swapping ... // leave everything else for the wrapped version var contractMsg bindings.CosmosMsg if err := json.Unmarshal(msg.Custom, &contractMsg); err != nil { - return nil, nil, errors.Wrap(err, "kujira msg") + return nil, nil, nil, errors.Wrap(err, "kujira msg") } if contractMsg.Denom != nil { @@ -82,7 +85,7 @@ func (m *CustomMessenger) DispatchMsg( return cwica.HandleMsg(ctx, m.cwica, m.ica, m.transfer, contractAddr, contractMsg.CwIca) } - return nil, nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown Custom variant"} + return nil, nil, nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown Custom variant"} } return m.wrapped.DispatchMsg(ctx, contractAddr, contractIBCPortID, msg) } diff --git a/wasmbinding/queries.go b/wasmbinding/queries.go index 8702eb39..c68e7aff 100644 --- a/wasmbinding/queries.go +++ b/wasmbinding/queries.go @@ -1,12 +1,12 @@ package wasmbinding import ( + storetypes "cosmossdk.io/store/types" cwicakeeper "github.com/Team-Kujira/core/x/cw-ica/keeper" denomkeeper "github.com/Team-Kujira/core/x/denom/keeper" oraclekeeper "github.com/Team-Kujira/core/x/oracle/keeper" - storetypes "github.com/cosmos/cosmos-sdk/store/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" ) type QueryPlugin struct { diff --git a/wasmbinding/query_plugin.go b/wasmbinding/query_plugin.go index 3d6beb45..a3d730da 100644 --- a/wasmbinding/query_plugin.go +++ b/wasmbinding/query_plugin.go @@ -9,7 +9,7 @@ import ( oracle "github.com/Team-Kujira/core/x/oracle/wasm" "cosmossdk.io/errors" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" diff --git a/wasmbinding/test/helpers_test.go b/wasmbinding/test/helpers_test.go index 782f718a..1fa1c71b 100644 --- a/wasmbinding/test/helpers_test.go +++ b/wasmbinding/test/helpers_test.go @@ -1,10 +1,12 @@ package wasmbinding_test import ( + "context" "os" "testing" "time" + "cosmossdk.io/math" "github.com/stretchr/testify/require" "github.com/cometbft/cometbft/crypto" @@ -21,13 +23,13 @@ import ( func CreateTestInput(t *testing.T) (*app.App, sdk.Context) { app := app.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmproto.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + ctx := app.BaseApp.NewContextLegacy(false, tmproto.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) return app, ctx } -func FundAccount(t *testing.T, ctx sdk.Context, app *app.App, acct sdk.AccAddress) { - err := testutil.FundAccount(app.BankKeeper, ctx, acct, sdk.NewCoins( - sdk.NewCoin("uosmo", sdk.NewInt(10000000000)), +func FundAccount(t *testing.T, ctx context.Context, app *app.App, acct sdk.AccAddress) { + err := testutil.FundAccount(ctx, app.BankKeeper, acct, sdk.NewCoins( + sdk.NewCoin("uosmo", math.NewInt(10000000000)), )) require.NoError(t, err) } diff --git a/wasmbinding/test/messages_test.go b/wasmbinding/test/messages_test.go index 255c9ce5..728e39ec 100644 --- a/wasmbinding/test/messages_test.go +++ b/wasmbinding/test/messages_test.go @@ -5,6 +5,7 @@ import ( "testing" "time" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/Team-Kujira/core/x/denom/wasm" @@ -22,8 +23,8 @@ import ( func fundAccount(t *testing.T, ctx sdk.Context, app *app.App, addr sdk.AccAddress, coins sdk.Coins) { err := testutil.FundAccount( - app.BankKeeper, ctx, + app.BankKeeper, addr, coins, ) @@ -33,7 +34,7 @@ func fundAccount(t *testing.T, ctx sdk.Context, app *app.App, addr sdk.AccAddres func TestCreateDenom(t *testing.T) { actor := RandomAccountAddress() app := app.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + ctx := app.BaseApp.NewContextLegacy(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) // Fund actor with 100 base denom creation feesme actorAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().CreationFee[0].Denom, types.DefaultParams().CreationFee[0].Amount.MulRaw(100))) @@ -69,7 +70,7 @@ func TestCreateDenom(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { // when - gotErr := wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, actor, spec.createDenom) + _, gotErr := wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, actor, spec.createDenom) // then if spec.expErr { require.Error(t, gotErr) @@ -162,18 +163,18 @@ func TestChangeAdmin(t *testing.T) { t.Run(name, func(t *testing.T) { // Setup app := app.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + ctx := app.BaseApp.NewContextLegacy(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) // Fund actor with 100 base denom creation fees actorAmount := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().CreationFee[0].Denom, types.DefaultParams().CreationFee[0].Amount.MulRaw(100))) fundAccount(t, ctx, app, tokenCreator, actorAmount) - err := wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, tokenCreator, &wasm.Create{ + _, err := wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, tokenCreator, &wasm.Create{ Subdenom: validDenom, }) require.NoError(t, err) - err = wasm.PerformChangeAdmin(*app.DenomKeeper, ctx, spec.actor, spec.changeAdmin) + _, err = wasm.PerformChangeAdmin(*app.DenomKeeper, ctx, spec.actor, spec.changeAdmin) if len(spec.expErrMsg) > 0 { require.Error(t, err) actualErrMsg := err.Error() @@ -188,7 +189,7 @@ func TestChangeAdmin(t *testing.T) { func TestMint(t *testing.T) { creator := RandomAccountAddress() app := app.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + ctx := app.BaseApp.NewContextLegacy(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) // Fund actor with 100 base denom creation fees tokenCreationFeeAmt := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().CreationFee[0].Denom, types.DefaultParams().CreationFee[0].Amount.MulRaw(100))) @@ -198,13 +199,13 @@ func TestMint(t *testing.T) { validDenom := wasm.Create{ Subdenom: "MOON", } - err := wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, creator, &validDenom) + _, err := wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, creator, &validDenom) require.NoError(t, err) emptyDenom := wasm.Create{ Subdenom: "", } - err = wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, creator, &emptyDenom) + _, err = wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, creator, &emptyDenom) require.NoError(t, err) validDenomStr := fmt.Sprintf("factory/%s/%s", creator.String(), validDenom.Subdenom) @@ -216,7 +217,7 @@ func TestMint(t *testing.T) { balances := app.BankKeeper.GetAllBalances(ctx, lucky) require.Empty(t, balances) - amount, ok := sdk.NewIntFromString("8080") + amount, ok := math.NewIntFromString("8080") require.True(t, ok) specs := map[string]struct { @@ -257,7 +258,7 @@ func TestMint(t *testing.T) { "zero amount": { mint: &wasm.Mint{ Denom: validDenomStr, - Amount: sdk.ZeroInt(), + Amount: math.ZeroInt(), Recipient: lucky.String(), }, expErr: false, @@ -294,7 +295,7 @@ func TestMint(t *testing.T) { for name, spec := range specs { t.Run(name, func(t *testing.T) { // when - gotErr := wasm.PerformMint(*app.DenomKeeper, app.BankKeeper, ctx, creator, spec.mint) + _, gotErr := wasm.PerformMint(*app.DenomKeeper, app.BankKeeper, ctx, creator, spec.mint) // then if spec.expErr { require.Error(t, gotErr) @@ -308,7 +309,7 @@ func TestMint(t *testing.T) { func TestBurn(t *testing.T) { creator := RandomAccountAddress() app := app.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + ctx := app.BaseApp.NewContextLegacy(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) // Fund actor with 100 base denom creation fees tokenCreationFeeAmt := sdk.NewCoins(sdk.NewCoin(types.DefaultParams().CreationFee[0].Denom, types.DefaultParams().CreationFee[0].Amount.MulRaw(100))) @@ -318,13 +319,13 @@ func TestBurn(t *testing.T) { validDenom := wasm.Create{ Subdenom: "MOON", } - err := wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, creator, &validDenom) + _, err := wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, creator, &validDenom) require.NoError(t, err) emptyDenom := wasm.Create{ Subdenom: "", } - err = wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, creator, &emptyDenom) + _, err = wasm.PerformCreate(*app.DenomKeeper, app.BankKeeper, ctx, creator, &emptyDenom) require.NoError(t, err) lucky := RandomAccountAddress() @@ -335,7 +336,7 @@ func TestBurn(t *testing.T) { validDenomStr := fmt.Sprintf("factory/%s/%s", creator.String(), validDenom.Subdenom) emptyDenomStr := fmt.Sprintf("factory/%s/%s", creator.String(), emptyDenom.Subdenom) - mintAmount, ok := sdk.NewIntFromString("8080") + mintAmount, ok := math.NewIntFromString("8080") require.True(t, ok) specs := map[string]struct { @@ -388,7 +389,7 @@ func TestBurn(t *testing.T) { burn: &wasm.Burn{ Denom: validDenomStr, - Amount: sdk.ZeroInt(), + Amount: math.ZeroInt(), }, expErr: false, }, @@ -417,7 +418,7 @@ func TestBurn(t *testing.T) { Amount: mintAmount, Recipient: creator.String(), } - err := wasm.PerformMint(*app.DenomKeeper, app.BankKeeper, ctx, creator, mintBinding) + _, err := wasm.PerformMint(*app.DenomKeeper, app.BankKeeper, ctx, creator, mintBinding) require.NoError(t, err) emptyDenomMintBinding := &wasm.Mint{ @@ -425,11 +426,11 @@ func TestBurn(t *testing.T) { Amount: mintAmount, Recipient: creator.String(), } - err = wasm.PerformMint(*app.DenomKeeper, app.BankKeeper, ctx, creator, emptyDenomMintBinding) + _, err = wasm.PerformMint(*app.DenomKeeper, app.BankKeeper, ctx, creator, emptyDenomMintBinding) require.NoError(t, err) // when - gotErr := wasm.PerformBurn(*app.DenomKeeper, ctx, spec.sender, spec.burn) + _, gotErr := wasm.PerformBurn(*app.DenomKeeper, ctx, spec.sender, spec.burn) // then if spec.expErr { require.Error(t, gotErr) diff --git a/wasmbinding/test/queries_test.go b/wasmbinding/test/queries_test.go index 44a94094..9b81a7f7 100644 --- a/wasmbinding/test/queries_test.go +++ b/wasmbinding/test/queries_test.go @@ -67,7 +67,7 @@ func TestFullDenom(t *testing.T) { func TestDenomAdmin(t *testing.T) { app := app.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + ctx := app.BaseApp.NewContextLegacy(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) // set token creation fee to zero to make testing easier tfParams := app.DenomKeeper.GetParams(ctx) diff --git a/wasmbinding/test/wasm_test.go b/wasmbinding/test/wasm_test.go index ec04f8fb..04617782 100644 --- a/wasmbinding/test/wasm_test.go +++ b/wasmbinding/test/wasm_test.go @@ -5,10 +5,10 @@ import ( "testing" "time" + "cosmossdk.io/math" "github.com/stretchr/testify/require" - sdk "github.com/cosmos/cosmos-sdk/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" "github.com/Team-Kujira/core/x/oracle/types" "github.com/Team-Kujira/core/x/oracle/wasm" @@ -23,12 +23,12 @@ import ( func TestQueryExchangeRates(t *testing.T) { app := app.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + ctx := app.BaseApp.NewContextLegacy(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) - ExchangeRateC := sdk.NewDec(1700) - ExchangeRateB := sdk.NewDecWithPrec(17, 1) - ExchangeRateD := sdk.NewDecWithPrec(19, 1) - app.OracleKeeper.SetExchangeRate(ctx, types.TestDenomA, sdk.NewDec(1)) + ExchangeRateC := math.LegacyNewDec(1700) + ExchangeRateB := math.LegacyNewDecWithPrec(17, 1) + ExchangeRateD := math.LegacyNewDecWithPrec(19, 1) + app.OracleKeeper.SetExchangeRate(ctx, types.TestDenomA, math.LegacyNewDec(1)) app.OracleKeeper.SetExchangeRate(ctx, types.TestDenomC, ExchangeRateC) app.OracleKeeper.SetExchangeRate(ctx, types.TestDenomB, ExchangeRateB) app.OracleKeeper.SetExchangeRate(ctx, types.TestDenomD, ExchangeRateD) @@ -95,7 +95,7 @@ func TestQueryExchangeRates(t *testing.T) { func TestSupply(t *testing.T) { app := app.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + ctx := app.BaseApp.NewContextLegacy(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) plugin := wasmbinding.NewQueryPlugin(app.BankKeeper, app.OracleKeeper, *app.DenomKeeper, *app.IBCKeeper, app.CwICAKeeper, app.GetKey(ibcexported.StoreKey)) querier := wasmbinding.CustomQuerier(plugin) @@ -126,7 +126,8 @@ func TestSupply(t *testing.T) { func TestVerifyMembership(t *testing.T) { app := app.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + now := time.Now() + ctx := app.BaseApp.NewContext(false).WithBlockTime(now) var err error contractAddr, _ := SetupContract(t, ctx, app) @@ -151,7 +152,8 @@ func TestVerifyMembership(t *testing.T) { func TestVerifyNonMembership(t *testing.T) { app := app.Setup(t, false) - ctx := app.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + now := time.Now() + ctx := app.BaseApp.NewContext(false).WithBlockTime(now) var err error contractAddr, _ := SetupContract(t, ctx, app) diff --git a/wasmbinding/wasm.go b/wasmbinding/wasm.go index 72135136..561b703f 100644 --- a/wasmbinding/wasm.go +++ b/wasmbinding/wasm.go @@ -1,18 +1,19 @@ package wasmbinding import ( + storetypes "cosmossdk.io/store/types" batchkeeper "github.com/Team-Kujira/core/x/batch/keeper" denomkeeper "github.com/Team-Kujira/core/x/denom/keeper" oraclekeeper "github.com/Team-Kujira/core/x/oracle/keeper" - storetypes "github.com/cosmos/cosmos-sdk/store/types" - ibckeeper "github.com/cosmos/ibc-go/v7/modules/core/keeper" + ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - cwicakeeper "github.com/Team-Kujira/core/x/cw-ica/keeper" - bankkeeper "github.com/terra-money/alliance/custom/bank/keeper" + // bankkeeper "github.com/terra-money/alliance/custom/bank/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" + cwicakeeper "github.com/Team-Kujira/core/x/cw-ica/keeper" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" ) func RegisterCustomPlugins( diff --git a/x/batch/client/cli/tx.go b/x/batch/client/cli/tx.go index d62ab007..5a713f7f 100644 --- a/x/batch/client/cli/tx.go +++ b/x/batch/client/cli/tx.go @@ -96,7 +96,7 @@ $ %[1]s tx batch batch-reset-delegation kujiravaloper1uf9knclap4a0vrqn8dj726anyh amountStrs := strings.Split(args[1], ",") amounts := []math.Int{} for _, amountStr := range amountStrs { - amount, ok := sdk.NewIntFromString(amountStr) + amount, ok := math.NewIntFromString(amountStr) if !ok { return types.ErrInvalidAmount } diff --git a/x/batch/keeper/delegation.go b/x/batch/keeper/delegation.go index af3c0593..d1f8d1ea 100644 --- a/x/batch/keeper/delegation.go +++ b/x/batch/keeper/delegation.go @@ -1,93 +1,139 @@ package keeper import ( + "context" "time" + "cosmossdk.io/math" "github.com/Team-Kujira/core/x/batch/types" - "github.com/armon/go-metrics" "github.com/cosmos/cosmos-sdk/telemetry" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/hashicorp/go-metrics" ) // increment the reference count for a historical rewards value // this func was copied from // https://github.com/cosmos/cosmos-sdk/blob/main/x/distribution/keeper/validator.go -func (k Keeper) incrementReferenceCount(ctx sdk.Context, valAddr sdk.ValAddress, period uint64) { - historical := k.distrKeeper.GetValidatorHistoricalRewards(ctx, valAddr, period) +func (k Keeper) incrementReferenceCount(ctx context.Context, valAddr sdk.ValAddress, period uint64) error { + historical, err := k.distrKeeper.GetValidatorHistoricalRewards(ctx, valAddr, period) + if err != nil { + return err + } if historical.ReferenceCount > 2 { panic("reference count should never exceed 2") } historical.ReferenceCount++ - k.distrKeeper.SetValidatorHistoricalRewards(ctx, valAddr, period, historical) + return k.distrKeeper.SetValidatorHistoricalRewards(ctx, valAddr, period, historical) } // decrement the reference count for a historical rewards value, and delete if zero references remain // this func was copied from // https://github.com/cosmos/cosmos-sdk/blob/main/x/distribution/keeper/validator.go -func (k Keeper) decrementReferenceCount(ctx sdk.Context, valAddr sdk.ValAddress, period uint64) { - historical := k.distrKeeper.GetValidatorHistoricalRewards(ctx, valAddr, period) +func (k Keeper) decrementReferenceCount(ctx context.Context, valAddr sdk.ValAddress, period uint64) error { + historical, err := k.distrKeeper.GetValidatorHistoricalRewards(ctx, valAddr, period) + if err != nil { + return err + } + if historical.ReferenceCount == 0 { panic("cannot set negative reference count") } historical.ReferenceCount-- if historical.ReferenceCount == 0 { - k.distrKeeper.DeleteValidatorHistoricalReward(ctx, valAddr, period) - } else { - k.distrKeeper.SetValidatorHistoricalRewards(ctx, valAddr, period, historical) + return k.distrKeeper.DeleteValidatorHistoricalReward(ctx, valAddr, period) } + return k.distrKeeper.SetValidatorHistoricalRewards(ctx, valAddr, period, historical) } // initialize starting info for a new delegation // this func was copied from // https://github.com/cosmos/cosmos-sdk/blob/main/x/distribution/keeper/delegation.go -func (k Keeper) initializeDelegation(ctx sdk.Context, val sdk.ValAddress, del sdk.AccAddress) { +func (k Keeper) initializeDelegation(ctx context.Context, val sdk.ValAddress, del sdk.AccAddress) error { // period has already been incremented - we want to store the period ended by this delegation action - previousPeriod := k.distrKeeper.GetValidatorCurrentRewards(ctx, val).Period - 1 + valCurrentRewards, err := k.distrKeeper.GetValidatorCurrentRewards(ctx, val) + if err != nil { + return err + } + previousPeriod := valCurrentRewards.Period - 1 // increment reference count for the period we're going to track - k.incrementReferenceCount(ctx, val, previousPeriod) + err = k.incrementReferenceCount(ctx, val, previousPeriod) + if err != nil { + return err + } + + validator, err := k.stakingKeeper.Validator(ctx, val) + if err != nil { + return err + } - validator := k.stakingKeeper.Validator(ctx, val) - delegation := k.stakingKeeper.Delegation(ctx, del, val) + delegation, err := k.stakingKeeper.Delegation(ctx, del, val) + if err != nil { + return err + } // calculate delegation stake in tokens // we don't store directly, so multiply delegation shares * (tokens per share) // note: necessary to truncate so we don't allow withdrawing more rewards than owed stake := validator.TokensFromSharesTruncated(delegation.GetShares()) - k.distrKeeper.SetDelegatorStartingInfo(ctx, val, del, distrtypes.NewDelegatorStartingInfo(previousPeriod, stake, uint64(ctx.BlockHeight()))) + sdkCtx := sdk.UnwrapSDKContext(ctx) + return k.distrKeeper.SetDelegatorStartingInfo(ctx, val, del, distrtypes.NewDelegatorStartingInfo(previousPeriod, stake, uint64(sdkCtx.BlockHeight()))) } -func (k Keeper) withdrawAllDelegationRewards(ctx sdk.Context, delAddr sdk.AccAddress) (sdk.Coins, error) { +func (k Keeper) withdrawAllDelegationRewards(ctx context.Context, delAddr sdk.AccAddress) (sdk.Coins, error) { rewardsTotal := sdk.Coins{} remainderTotal := sdk.DecCoins{} // callback func was referenced from withdrawDelegationRewards func in // https://github.com/cosmos/cosmos-sdk/blob/main/x/distribution/keeper/delegation.go - k.stakingKeeper.IterateDelegations(ctx, delAddr, func(_ int64, del stakingtypes.DelegationI) (stop bool) { - valAddr := del.GetValidatorAddr() - val := k.stakingKeeper.Validator(ctx, valAddr) + err := k.stakingKeeper.IterateDelegations(ctx, delAddr, func(_ int64, del stakingtypes.DelegationI) (stop bool) { + valAddr, err := k.stakingKeeper.ValidatorAddressCodec().StringToBytes(del.GetValidatorAddr()) + if err != nil { + panic(err) + } + + val, err := k.stakingKeeper.Validator(ctx, valAddr) + if err != nil { + panic(err) + } // check existence of delegator starting info - if !k.distrKeeper.HasDelegatorStartingInfo(ctx, del.GetValidatorAddr(), del.GetDelegatorAddr()) { + hasInfo, err := k.distrKeeper.HasDelegatorStartingInfo(ctx, sdk.ValAddress(valAddr), delAddr) + if err != nil { + panic(err) + } + + if !hasInfo { return false } // end current period and calculate rewards - endingPeriod := k.distrKeeper.IncrementValidatorPeriod(ctx, val) - rewardsRaw := k.distrKeeper.CalculateDelegationRewards(ctx, val, del, endingPeriod) - outstanding := k.distrKeeper.GetValidatorOutstandingRewardsCoins(ctx, del.GetValidatorAddr()) + endingPeriod, err := k.distrKeeper.IncrementValidatorPeriod(ctx, val) + if err != nil { + panic(err) + } + + rewardsRaw, err := k.distrKeeper.CalculateDelegationRewards(ctx, val, del, endingPeriod) + if err != nil { + panic(err) + } + + outstanding, err := k.distrKeeper.GetValidatorOutstandingRewardsCoins(ctx, sdk.ValAddress(valAddr)) + if err != nil { + panic(err) + } // defensive edge case may happen on the very final digits // of the decCoins due to operation order of the distribution mechanism. rewards := rewardsRaw.Intersect(outstanding) - if !rewards.IsEqual(rewardsRaw) { + if !rewards.Equal(rewardsRaw) { logger := k.Logger(ctx) logger.Info( "rounding error withdrawing rewards from validator", - "delegator", del.GetDelegatorAddr().String(), - "validator", val.GetOperator().String(), + "delegator", del.GetDelegatorAddr(), + "validator", val.GetOperator(), "got", rewards.String(), "expected", rewardsRaw.String(), ) @@ -100,28 +146,61 @@ func (k Keeper) withdrawAllDelegationRewards(ctx sdk.Context, delAddr sdk.AccAdd // update the outstanding rewards and the community pool only if the // transaction was successful - k.distrKeeper.SetValidatorOutstandingRewards(ctx, del.GetValidatorAddr(), distrtypes.ValidatorOutstandingRewards{Rewards: outstanding.Sub(rewards)}) + err = k.distrKeeper.SetValidatorOutstandingRewards(ctx, sdk.ValAddress(valAddr), distrtypes.ValidatorOutstandingRewards{Rewards: outstanding.Sub(rewards)}) + if err != nil { + panic(err) + } // decrement reference count of starting period - startingInfo := k.distrKeeper.GetDelegatorStartingInfo(ctx, del.GetValidatorAddr(), del.GetDelegatorAddr()) + startingInfo, err := k.distrKeeper.GetDelegatorStartingInfo(ctx, sdk.ValAddress(valAddr), delAddr) + if err != nil { + panic(err) + } + startingPeriod := startingInfo.PreviousPeriod - k.decrementReferenceCount(ctx, del.GetValidatorAddr(), startingPeriod) + err = k.decrementReferenceCount(ctx, sdk.ValAddress(valAddr), startingPeriod) + if err != nil { + panic(err) + } + + // remove delegator starting info + err = k.distrKeeper.DeleteDelegatorStartingInfo(ctx, sdk.ValAddress(valAddr), delAddr) + if err != nil { + panic(err) + } // reinitialize the delegation - k.initializeDelegation(ctx, valAddr, delAddr) + err = k.initializeDelegation(ctx, valAddr, delAddr) + if err != nil { + panic(err) + } return false }) + if err != nil { + return rewardsTotal, err + } // distribute total remainder to community pool - feePool := k.distrKeeper.GetFeePool(ctx) + feePool, err := k.distrKeeper.FeePool.Get(ctx) + if err != nil { + return rewardsTotal, err + } + feePool.CommunityPool = feePool.CommunityPool.Add(remainderTotal...) - k.distrKeeper.SetFeePool(ctx, feePool) + err = k.distrKeeper.FeePool.Set(ctx, feePool) + if err != nil { + return rewardsTotal, err + } // add total reward coins to user account if !rewardsTotal.IsZero() { - withdrawAddr := k.distrKeeper.GetDelegatorWithdrawAddr(ctx, delAddr) - err := k.bankKeeper.SendCoinsFromModuleToAccount(ctx, distrtypes.ModuleName, withdrawAddr, rewardsTotal) + withdrawAddr, err := k.distrKeeper.GetDelegatorWithdrawAddr(ctx, delAddr) + if err != nil { + return nil, err + } + + err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, distrtypes.ModuleName, withdrawAddr, rewardsTotal) if err != nil { return nil, err } @@ -129,7 +208,7 @@ func (k Keeper) withdrawAllDelegationRewards(ctx sdk.Context, delAddr sdk.AccAdd rewardsTotal = sdk.Coins{} } - ctx.EventManager().EmitEvent( + sdk.UnwrapSDKContext(ctx).EventManager().EmitEvent( sdk.NewEvent( distrtypes.EventTypeWithdrawRewards, sdk.NewAttribute(sdk.AttributeKeyAmount, rewardsTotal.String()), @@ -149,7 +228,10 @@ func (k Keeper) batchResetDelegation(ctx sdk.Context, msg *types.MsgBatchResetDe return types.ErrValidatorsAndAmountsMismatch } - bondDenom := k.stakingKeeper.BondDenom(ctx) + bondDenom, err := k.stakingKeeper.BondDenom(ctx) + if err != nil { + return err + } for i, valStr := range msg.Validators { valAddr, valErr := sdk.ValAddressFromBech32(valStr) @@ -157,15 +239,15 @@ func (k Keeper) batchResetDelegation(ctx sdk.Context, msg *types.MsgBatchResetDe return sdkerrors.ErrInvalidAddress.Wrapf("invalid validator address: %s", valErr) } - validator, found := k.stakingKeeper.GetValidator(ctx, valAddr) - if !found { - return stakingtypes.ErrNoValidatorFound + validator, err := k.stakingKeeper.GetValidator(ctx, valAddr) + if err != nil { + return err } targetAmount := msg.Amounts[i] - currAmount := sdk.ZeroInt() - delegation, found := k.stakingKeeper.GetDelegation(ctx, delAddr, valAddr) - if found { + currAmount := math.ZeroInt() + delegation, err := k.stakingKeeper.GetDelegation(ctx, delAddr, valAddr) + if err == nil { currAmount = validator.TokensFromShares(delegation.Shares).RoundInt() } @@ -210,7 +292,7 @@ func (k Keeper) batchResetDelegation(ctx sdk.Context, msg *types.MsgBatchResetDe return err } - completionTime, err := k.stakingKeeper.Undelegate(ctx, delAddr, valAddr, shares) + completionTime, _, err := k.stakingKeeper.Undelegate(ctx, delAddr, valAddr, shares) if err != nil { return err } diff --git a/x/batch/keeper/delegation_test.go b/x/batch/keeper/delegation_test.go index b9e41982..787ecc72 100644 --- a/x/batch/keeper/delegation_test.go +++ b/x/batch/keeper/delegation_test.go @@ -8,7 +8,6 @@ import ( batchtypes "github.com/Team-Kujira/core/x/batch/types" "github.com/cometbft/cometbft/crypto/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" distrtestutil "github.com/cosmos/cosmos-sdk/x/distribution/testutil" distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" @@ -43,7 +42,6 @@ func (suite *KeeperTestSuite) TestWithdrawAllDelegationRewards() { delPub := secp256k1.GenPrivKey().PubKey() delAddr := sdk.AccAddress(delPub.Address()) - suite.app.AccountKeeper.SetAccount(suite.ctx, authtypes.NewBaseAccount(delAddr, nil, 0, 0)) delTokens := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction) @@ -52,14 +50,19 @@ func (suite *KeeperTestSuite) TestWithdrawAllDelegationRewards() { validator, err := distrtestutil.CreateValidator(valConsPks[i], delTokens) suite.Require().NoError(err) - validator, _ = validator.SetInitialCommission(stakingtypes.NewCommission(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), math.LegacyNewDec(0))) + validator, _ = validator.SetInitialCommission(stakingtypes.NewCommission(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0))) validator, _ = validator.AddTokensFromDel(valTokens) - suite.app.StakingKeeper.SetValidator(suite.ctx, validator) - suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) - suite.app.StakingKeeper.SetValidatorByPowerIndex(suite.ctx, validator) + err = suite.app.StakingKeeper.SetValidator(suite.ctx, validator) + suite.NoError(err) + err = suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) + suite.NoError(err) + err = suite.app.StakingKeeper.SetValidatorByPowerIndex(suite.ctx, validator) + suite.NoError(err) // Call the after-creation hook - err = suite.app.StakingKeeper.Hooks().AfterValidatorCreated(suite.ctx, validator.GetOperator()) + valAddr, err := sdk.ValAddressFromBech32(validator.GetOperator()) + suite.Require().NoError(err) + err = suite.app.StakingKeeper.Hooks().AfterValidatorCreated(suite.ctx, valAddr) suite.NoError(err) // Delegate to the validator @@ -95,12 +98,14 @@ func (suite *KeeperTestSuite) TestWithdrawAllDelegationRewards() { } for i := 0; i < totalVals; i++ { valAddr := sdk.ValAddress(valConsAddrs[i]) - suite.app.DistrKeeper.AllocateTokensToValidator(suite.ctx, suite.app.StakingKeeper.Validator(suite.ctx, valAddr), valRewardTokens) + validator, err := suite.app.StakingKeeper.Validator(suite.ctx, valAddr) + suite.Require().NoError(err) + suite.app.DistrKeeper.AllocateTokensToValidator(suite.ctx, validator, valRewardTokens) } // Withdraw all rewards using a single batch transaction gasForBatchWithdrawal := suite.ctx.GasMeter().GasConsumed() - res, err := batchMsgServer.WithdrawAllDelegatorRewards(sdk.WrapSDKContext(suite.ctx), batchtypes.NewMsgWithdrawAllDelegatorRewards(delAddr)) + res, err := batchMsgServer.WithdrawAllDelegatorRewards(suite.ctx, batchtypes.NewMsgWithdrawAllDelegatorRewards(delAddr)) gasForBatchWithdrawal = suite.ctx.GasMeter().GasConsumed() - gasForBatchWithdrawal suite.Require().NoError(err) suite.Require().False(res.Amount.IsZero()) @@ -109,10 +114,14 @@ func (suite *KeeperTestSuite) TestWithdrawAllDelegationRewards() { // check if there are no pending rewards for any validator for i := 0; i < totalVals; i++ { valAddr := sdk.ValAddress(valConsAddrs[i]) - val := suite.app.StakingKeeper.Validator(suite.ctx, valAddr) - delegation := suite.app.StakingKeeper.Delegation(suite.ctx, delAddr, valAddr) - endingPeriod := suite.app.DistrKeeper.IncrementValidatorPeriod(suite.ctx, val) - rewards := suite.app.DistrKeeper.CalculateDelegationRewards(suite.ctx, val, delegation, endingPeriod) + val, err := suite.app.StakingKeeper.Validator(suite.ctx, valAddr) + suite.Require().NoError(err) + delegation, err := suite.app.StakingKeeper.Delegation(suite.ctx, delAddr, valAddr) + suite.Require().NoError(err) + endingPeriod, err := suite.app.DistrKeeper.IncrementValidatorPeriod(suite.ctx, val) + suite.Require().NoError(err) + rewards, err := suite.app.DistrKeeper.CalculateDelegationRewards(suite.ctx, val, delegation, endingPeriod) + suite.Require().NoError(err) suite.Require().True(rewards.IsZero()) } @@ -122,7 +131,10 @@ func (suite *KeeperTestSuite) TestWithdrawAllDelegationRewards() { // Allocate rewards to validators for i := 0; i < totalVals; i++ { valAddr := sdk.ValAddress(valConsAddrs[i]) - suite.app.DistrKeeper.AllocateTokensToValidator(suite.ctx, suite.app.StakingKeeper.Validator(suite.ctx, valAddr), valRewardTokens) + validator, err := suite.app.StakingKeeper.Validator(suite.ctx, valAddr) + suite.Require().NoError(err) + suite.app.DistrKeeper.AllocateTokensToValidator(suite.ctx, validator, valRewardTokens) + suite.Require().NoError(err) } totalGasForIndividualWithdrawals := suite.ctx.GasMeter().GasConsumed() @@ -131,7 +143,7 @@ func (suite *KeeperTestSuite) TestWithdrawAllDelegationRewards() { for i := 0; i < totalVals; i++ { valAddr := sdk.ValAddress(valConsAddrs[i]) // Withdraw rewards - res, err := distrMsgServer.WithdrawDelegatorReward(sdk.WrapSDKContext(suite.ctx), distrtypes.NewMsgWithdrawDelegatorReward(delAddr, valAddr)) + res, err := distrMsgServer.WithdrawDelegatorReward(suite.ctx, distrtypes.NewMsgWithdrawDelegatorReward(delAddr.String(), valAddr.String())) suite.Require().NoError(err) suite.Require().False(res.Amount.IsZero()) // check individual rewards are accurate @@ -161,29 +173,30 @@ func (suite *KeeperTestSuite) TestBatchResetDelegation() { delPub := secp256k1.GenPrivKey().PubKey() delAddr := sdk.AccAddress(delPub.Address()) - suite.app.AccountKeeper.SetAccount(suite.ctx, authtypes.NewBaseAccount(delAddr, nil, 0, 0)) delTokens := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction) validators := []string{} - amounts := []sdk.Int{} + amounts := []math.Int{} for i := 0; i < totalVals; i++ { // Setup the validator validator, err := distrtestutil.CreateValidator(valConsPks[i], delTokens) suite.Require().NoError(err) - validator, _ = validator.SetInitialCommission(stakingtypes.NewCommission(sdk.NewDecWithPrec(5, 1), sdk.NewDecWithPrec(5, 1), math.LegacyNewDec(0))) + validator, _ = validator.SetInitialCommission(stakingtypes.NewCommission(math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDecWithPrec(5, 1), math.LegacyNewDec(0))) validator, _ = validator.AddTokensFromDel(valTokens) suite.app.StakingKeeper.SetValidator(suite.ctx, validator) suite.app.StakingKeeper.SetValidatorByConsAddr(suite.ctx, validator) suite.app.StakingKeeper.SetValidatorByPowerIndex(suite.ctx, validator) // Call the after-creation hook - err = suite.app.StakingKeeper.Hooks().AfterValidatorCreated(suite.ctx, validator.GetOperator()) + valAddr, err := sdk.ValAddressFromBech32(validator.GetOperator()) + suite.Require().NoError(err) + err = suite.app.StakingKeeper.Hooks().AfterValidatorCreated(suite.ctx, valAddr) suite.Require().NoError(err) - validators = append(validators, validator.GetOperator().String()) - amounts = append(amounts, sdk.NewInt(int64(500*(i%5)))) // 0, 500, 1000, 1500, 2000 + validators = append(validators, validator.GetOperator()) + amounts = append(amounts, math.NewInt(int64(500*(i%5)))) // 0, 500, 1000, 1500, 2000 // Mint coins for delegation delAmount := sdk.NewCoin(sdk.DefaultBondDenom, delTokens) @@ -192,7 +205,7 @@ func (suite *KeeperTestSuite) TestBatchResetDelegation() { suite.Require().NoError(err) // setup initial delegation - _, err = suite.app.StakingKeeper.Delegate(suite.ctx, delAddr, sdk.NewInt(1000), stakingtypes.Unbonded, validator, true) + _, err = suite.app.StakingKeeper.Delegate(suite.ctx, delAddr, math.NewInt(1000), stakingtypes.Unbonded, validator, true) suite.Require().NoError(err) } @@ -201,7 +214,7 @@ func (suite *KeeperTestSuite) TestBatchResetDelegation() { // Set all delegations using a single batch transaction gasForBatchDelegation := cacheCtx1.GasMeter().GasConsumed() - _, err := batchMsgServer.BatchResetDelegation(sdk.WrapSDKContext(cacheCtx1), batchtypes.NewMsgBatchResetDelegation(delAddr, validators, amounts)) + _, err := batchMsgServer.BatchResetDelegation(cacheCtx1, batchtypes.NewMsgBatchResetDelegation(delAddr, validators, amounts)) gasForBatchDelegation = cacheCtx1.GasMeter().GasConsumed() - gasForBatchDelegation suite.Require().NoError(err) @@ -212,23 +225,23 @@ func (suite *KeeperTestSuite) TestBatchResetDelegation() { // Delegate using multiple individual transactions for i := 0; i < totalVals; i++ { valAddr := sdk.ValAddress(valConsAddrs[i]) - existingDelegation := sdk.NewInt(1000) + existingDelegation := math.NewInt(1000) if amounts[i].GT(existingDelegation) { _, err := stakingMsgServer.Delegate( - sdk.WrapSDKContext(cacheCtx2), + cacheCtx2, stakingtypes.NewMsgDelegate( - delAddr, - valAddr, + delAddr.String(), + valAddr.String(), sdk.NewCoin(sdk.DefaultBondDenom, amounts[i].Sub(existingDelegation)), ), ) suite.Require().NoError(err) } else if amounts[i].LT(existingDelegation) { _, err := stakingMsgServer.Undelegate( - sdk.WrapSDKContext(cacheCtx2), + cacheCtx2, stakingtypes.NewMsgUndelegate( - delAddr, - valAddr, + delAddr.String(), + valAddr.String(), sdk.NewCoin(sdk.DefaultBondDenom, existingDelegation.Sub(amounts[i])), ), ) diff --git a/x/batch/keeper/keeper.go b/x/batch/keeper/keeper.go index 3c97b639..b8c87e86 100644 --- a/x/batch/keeper/keeper.go +++ b/x/batch/keeper/keeper.go @@ -1,14 +1,15 @@ package keeper import ( + "context" "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" "github.com/Team-Kujira/core/x/batch/types" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" @@ -42,8 +43,9 @@ func NewKeeper( } } -func (k Keeper) Logger(ctx sdk.Context) log.Logger { - return ctx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) +func (k Keeper) Logger(ctx context.Context) log.Logger { + sdkCtx := sdk.UnwrapSDKContext(ctx) + return sdkCtx.Logger().With("module", fmt.Sprintf("x/%s", types.ModuleName)) } // withdraw all delegation rewards for a delegator diff --git a/x/batch/keeper/keeper_test.go b/x/batch/keeper/keeper_test.go index 5c2d77a4..b2430ada 100644 --- a/x/batch/keeper/keeper_test.go +++ b/x/batch/keeper/keeper_test.go @@ -2,10 +2,8 @@ package keeper_test import ( "testing" - "time" "github.com/Team-Kujira/core/app" - tmtypes "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" ) @@ -20,7 +18,7 @@ type KeeperTestSuite struct { func (suite *KeeperTestSuite) SetupTest() { suite.app = app.Setup(suite.T(), false) - suite.ctx = suite.app.BaseApp.NewContext(false, tmtypes.Header{Height: 1, ChainID: "kujira-1", Time: time.Now().UTC()}) + suite.ctx = suite.app.BaseApp.NewContext(false) } func TestKeeperTestSuite(t *testing.T) { diff --git a/x/batch/keeper/msg_server.go b/x/batch/keeper/msg_server.go index 6e689a17..28317ebd 100644 --- a/x/batch/keeper/msg_server.go +++ b/x/batch/keeper/msg_server.go @@ -3,7 +3,7 @@ package keeper import ( "context" - "github.com/armon/go-metrics" + "github.com/hashicorp/go-metrics" "github.com/Team-Kujira/core/x/batch/types" "github.com/cosmos/cosmos-sdk/telemetry" diff --git a/x/batch/module.go b/x/batch/module.go index 89be7a07..7d26e715 100644 --- a/x/batch/module.go +++ b/x/batch/module.go @@ -113,6 +113,12 @@ func NewAppModule( } } +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + // Name returns the batch module's name. func (am AppModule) Name() string { return am.AppModuleBasic.Name() @@ -151,10 +157,10 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to the batch module. -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(_ sdk.Context) {} // EndBlock executes all ABCI EndBlock logic respective to the batch module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { +func (am AppModule) EndBlock(_ sdk.Context) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } diff --git a/x/batch/types/codec.go b/x/batch/types/codec.go index 70d67a15..72c99f9f 100644 --- a/x/batch/types/codec.go +++ b/x/batch/types/codec.go @@ -23,17 +23,7 @@ func RegisterInterfaces(registry codectypes.InterfaceRegistry) { msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/batch module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/staking and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) +var amino = codec.NewLegacyAmino() func init() { RegisterLegacyAminoCodec(amino) diff --git a/x/batch/types/expected_keeper.go b/x/batch/types/expected_keeper.go index cec67a67..46c3f78c 100644 --- a/x/batch/types/expected_keeper.go +++ b/x/batch/types/expected_keeper.go @@ -1,24 +1,26 @@ package types import ( + context "context" + + corestore "cosmossdk.io/core/store" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // StakingKeeper is expected keeper for staking module type SlashingKeeper interface { - Slash(sdk.Context, sdk.ConsAddress, sdk.Dec, int64, int64) // slash the validator and delegators of the validator, specifying slash fraction, offence power and offence height - Jail(sdk.Context, sdk.ConsAddress) // jail a validator + Slash(sdk.Context, sdk.ConsAddress, math.LegacyDec, int64, int64) // slash the validator and delegators of the validator, specifying slash fraction, offence power and offence height + Jail(sdk.Context, sdk.ConsAddress) // jail a validator } // StakingKeeper is expected keeper for staking module type StakingKeeper interface { Validator(ctx sdk.Context, address sdk.ValAddress) stakingtypes.ValidatorI // get validator by operator address; nil when validator not found TotalBondedTokens(sdk.Context) math.Int // total bonded tokens within the validator set - ValidatorsPowerStoreIterator(ctx sdk.Context) sdk.Iterator // an iterator for the current validator power store + ValidatorsPowerStoreIterator(ctx sdk.Context) corestore.Iterator // an iterator for the current validator power store MaxValidators(sdk.Context) uint32 // MaxValidators returns the maximum amount of bonded validators PowerReduction(ctx sdk.Context) (res math.Int) } @@ -34,18 +36,18 @@ type DistributionKeeper interface { // AccountKeeper is expected keeper for auth module type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI // only used for simulation + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI } // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error - GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) - SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToModule(ctx context.Context, senderModule string, recipientModule string, amt sdk.Coins) error + GetDenomMetaData(ctx context.Context, denom string) (banktypes.Metadata, bool) + SetDenomMetaData(ctx context.Context, denomMetaData banktypes.Metadata) // only used for simulation - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins } diff --git a/x/batch/types/msgs.go b/x/batch/types/msgs.go index 7eebd883..00701956 100644 --- a/x/batch/types/msgs.go +++ b/x/batch/types/msgs.go @@ -32,10 +32,6 @@ func (m MsgWithdrawAllDelegatorRewards) ValidateBasic() error { return nil } -func (m MsgWithdrawAllDelegatorRewards) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - func (m MsgWithdrawAllDelegatorRewards) GetSigners() []sdk.AccAddress { sender, _ := sdk.AccAddressFromBech32(m.DelegatorAddress) return []sdk.AccAddress{sender} @@ -80,10 +76,6 @@ func (m MsgBatchResetDelegation) ValidateBasic() error { return nil } -func (m MsgBatchResetDelegation) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - func (m MsgBatchResetDelegation) GetSigners() []sdk.AccAddress { sender, _ := sdk.AccAddressFromBech32(m.DelegatorAddress) return []sdk.AccAddress{sender} diff --git a/x/batch/wasm/interface_msg.go b/x/batch/wasm/interface_msg.go index 8966286d..a91da048 100644 --- a/x/batch/wasm/interface_msg.go +++ b/x/batch/wasm/interface_msg.go @@ -2,10 +2,12 @@ package wasm import ( "cosmossdk.io/errors" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" batchkeeper "github.com/Team-Kujira/core/x/batch/keeper" batchtypes "github.com/Team-Kujira/core/x/batch/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" ) type BatchMsg struct { @@ -16,38 +18,70 @@ type BatchMsg struct { type WithdrawAllDelegatorRewards struct{} // withdrawAllDelegatorRewards withdraw all delegation rewards for the delegations from the contract address -func withdrawAllDelegatorRewards(ctx sdk.Context, contractAddr sdk.AccAddress, withdrawAllDelegatorRewards *WithdrawAllDelegatorRewards, bk batchkeeper.Keeper) ([]sdk.Event, [][]byte, error) { - err := PerformWithdrawAllDelegatorRewards(bk, ctx, contractAddr, withdrawAllDelegatorRewards) +func withdrawAllDelegatorRewards( + ctx sdk.Context, + contractAddr sdk.AccAddress, + withdrawAllDelegatorRewards *WithdrawAllDelegatorRewards, + bk batchkeeper.Keeper, +) (*batchtypes.MsgWithdrawAllDelegatorRewardsResponse, error) { + res, err := PerformWithdrawAllDelegatorRewards(bk, ctx, contractAddr, withdrawAllDelegatorRewards) if err != nil { - return nil, nil, errors.Wrap(err, "perform withdrawAllDelegatorRewards") + return nil, errors.Wrap(err, "perform withdrawAllDelegatorRewards") } - return nil, nil, nil + return res, nil } // PerformWithdrawAllDelegatorRewards is used to perform delegation rewards from the contract delegations -func PerformWithdrawAllDelegatorRewards(bk batchkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, _ *WithdrawAllDelegatorRewards) error { +func PerformWithdrawAllDelegatorRewards( + bk batchkeeper.Keeper, + ctx sdk.Context, + contractAddr sdk.AccAddress, + _ *WithdrawAllDelegatorRewards, +) (*batchtypes.MsgWithdrawAllDelegatorRewardsResponse, error) { msgServer := batchkeeper.NewMsgServerImpl(bk) msgWithdrawAllDelegatorRewards := batchtypes.NewMsgWithdrawAllDelegatorRewards(contractAddr) if err := msgWithdrawAllDelegatorRewards.ValidateBasic(); err != nil { - return errors.Wrap(err, "failed validating MsgWithdrawAllDelegatorRewards") + return nil, errors.Wrap(err, "failed validating MsgWithdrawAllDelegatorRewards") } - _, err := msgServer.WithdrawAllDelegatorRewards( - sdk.WrapSDKContext(ctx), + res, err := msgServer.WithdrawAllDelegatorRewards( + ctx, msgWithdrawAllDelegatorRewards, ) if err != nil { - return errors.Wrap(err, "batch claim") + return nil, errors.Wrap(err, "batch claim") } - return nil + return res, nil } // QueryCustom implements custom msg interface -func HandleMsg(dk batchkeeper.Keeper, contractAddr sdk.AccAddress, ctx sdk.Context, q *BatchMsg) ([]sdk.Event, [][]byte, error) { +func HandleMsg( + dk batchkeeper.Keeper, + contractAddr sdk.AccAddress, + ctx sdk.Context, + q *BatchMsg, +) ([]sdk.Event, [][]byte, [][]*codectypes.Any, error) { + var res proto.Message + var err error + if q.WithdrawAllDelegatorRewards != nil { - return withdrawAllDelegatorRewards(ctx, contractAddr, q.WithdrawAllDelegatorRewards, dk) + res, err = withdrawAllDelegatorRewards(ctx, contractAddr, q.WithdrawAllDelegatorRewards, dk) + } + + if err != nil { + return nil, nil, nil, err + } + + if res == nil { + return nil, nil, nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown Custom variant"} + } + + x, err := codectypes.NewAnyWithValue(res) + if err != nil { + return nil, nil, nil, err } + msgResponses := [][]*codectypes.Any{{x}} - return nil, nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown Custom variant"} + return nil, nil, msgResponses, err } diff --git a/x/cw-ica/ibc_module.go b/x/cw-ica/ibc_module.go index a7c112a8..c294b0b6 100644 --- a/x/cw-ica/ibc_module.go +++ b/x/cw-ica/ibc_module.go @@ -5,11 +5,11 @@ import ( "github.com/Team-Kujira/core/x/cw-ica/keeper" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ) var _ porttypes.IBCModule = IBCModule{} diff --git a/x/cw-ica/keeper/callback.go b/x/cw-ica/keeper/callback.go index 6f4fc711..312affe8 100644 --- a/x/cw-ica/keeper/callback.go +++ b/x/cw-ica/keeper/callback.go @@ -1,9 +1,10 @@ package keeper import ( - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + storetypes "cosmossdk.io/store/types" "github.com/Team-Kujira/core/x/cw-ica/types" ) @@ -42,7 +43,7 @@ func (k Keeper) RemoveCallbackData( // GetAllCallbackData returns all callbackData func (k Keeper) GetAllCallbackData(ctx sdk.Context) (list []types.CallbackData) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.CallbackDataKeyPrefix)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() diff --git a/x/cw-ica/keeper/grpc_query.go b/x/cw-ica/keeper/grpc_query.go index 0eb080b1..348ec14b 100644 --- a/x/cw-ica/keeper/grpc_query.go +++ b/x/cw-ica/keeper/grpc_query.go @@ -7,7 +7,7 @@ import ( "google.golang.org/grpc/status" sdk "github.com/cosmos/cosmos-sdk/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" "github.com/Team-Kujira/core/x/cw-ica/types" ) diff --git a/x/cw-ica/keeper/ibc_handlers.go b/x/cw-ica/keeper/ibc_handlers.go index a4b48a04..1d218112 100644 --- a/x/cw-ica/keeper/ibc_handlers.go +++ b/x/cw-ica/keeper/ibc_handlers.go @@ -8,7 +8,9 @@ import ( "github.com/Team-Kujira/core/x/cw-ica/types" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + + storetypes "cosmossdk.io/store/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) const ( @@ -18,10 +20,10 @@ const ( func (k *Keeper) outOfGasRecovery( ctx sdk.Context, - gasMeter sdk.GasMeter, + gasMeter storetypes.GasMeter, ) { if r := recover(); r != nil { - _, ok := r.(sdk.ErrorOutOfGas) + _, ok := r.(storetypes.ErrorOutOfGas) if !ok || !gasMeter.IsOutOfGas() { panic(r) } @@ -32,7 +34,7 @@ func (k *Keeper) outOfGasRecovery( // createCachedContext creates a cached context for handling Sudo calls to CosmWasm smart-contracts. // If there is an error during Sudo call, we can safely revert changes made in cached context. -func (k *Keeper) createCachedContext(ctx sdk.Context) (sdk.Context, func(), sdk.GasMeter) { +func (k *Keeper) createCachedContext(ctx sdk.Context) (sdk.Context, func(), storetypes.GasMeter) { gasMeter := ctx.GasMeter() // determines type of gas meter by its prefix: // * BasicGasMeter - basic gas meter which is used for processing tx directly in block; @@ -61,9 +63,9 @@ func (k *Keeper) createCachedContext(ctx sdk.Context) (sdk.Context, func(), sdk. newLimit = gasLeft - GasReserve } - gasMeter = sdk.NewGasMeter(newLimit) + gasMeter = storetypes.NewGasMeter(newLimit) } else { - gasMeter = sdk.NewInfiniteGasMeter() + gasMeter = storetypes.NewInfiniteGasMeter() } cacheCtx = cacheCtx.WithGasMeter(gasMeter) diff --git a/x/cw-ica/keeper/keeper.go b/x/cw-ica/keeper/keeper.go index 4eae5702..25f0cb76 100644 --- a/x/cw-ica/keeper/keeper.go +++ b/x/cw-ica/keeper/keeper.go @@ -3,16 +3,16 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitykeeper "github.com/cosmos/cosmos-sdk/x/capability/keeper" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" "github.com/Team-Kujira/core/x/cw-ica/types" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" ) type Keeper struct { diff --git a/x/cw-ica/keeper/keeper_test.go b/x/cw-ica/keeper/keeper_test.go deleted file mode 100644 index 489f55d0..00000000 --- a/x/cw-ica/keeper/keeper_test.go +++ /dev/null @@ -1,136 +0,0 @@ -package keeper_test - -import ( - "encoding/json" - "testing" - - dbm "github.com/cometbft/cometbft-db" - "github.com/cometbft/cometbft/libs/log" - "github.com/stretchr/testify/suite" - - wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - "github.com/cosmos/cosmos-sdk/server" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - ibctesting "github.com/cosmos/ibc-go/v7/testing" - - icaapp "github.com/Team-Kujira/core/app" -) - -var ( - // TestOwnerAddress defines a reusable bech32 address for testing purposes - TestOwnerAddress = "cosmos17dtl0mjt3t77kpuhg2edqzjpszulwhgzuj9ljs" - - // TestAccountId defines a reusable interchainaccounts account id for testing purposes - TestAccountId = "1" - - // TestPortID defines a reusable port identifier for testing purposes - TestPortID, _ = icatypes.NewControllerPortID(TestOwnerAddress) - - // TestVersion defines a reusable interchainaccounts version string for testing purposes - TestVersion = string(icatypes.ModuleCdc.MustMarshalJSON(&icatypes.Metadata{ - Version: icatypes.Version, - ControllerConnectionId: ibctesting.FirstConnectionID, - HostConnectionId: ibctesting.FirstConnectionID, - Encoding: icatypes.EncodingProtobuf, - TxType: icatypes.TxTypeSDKMultiMsg, - })) -) - -func init() { - ibctesting.DefaultTestingAppInit = SetupICATestingApp -} - -func SetupICATestingApp() (ibctesting.TestingApp, map[string]json.RawMessage) { - db := dbm.NewMemDB() - encCdc := icaapp.MakeEncodingConfig() - - var wasmOpts []wasmkeeper.Option - baseappOptions := server.DefaultBaseappOptions(nil) - app := icaapp.New(log.NewNopLogger(), db, nil, true, encCdc, nil, wasmOpts, baseappOptions...) - return app, icaapp.NewDefaultGenesisState(encCdc.Codec) -} - -// KeeperTestSuite is a testing suite to test keeper functions -type KeeperTestSuite struct { - suite.Suite - - coordinator *ibctesting.Coordinator - - // testing chains used for convenience and readability - chainA *ibctesting.TestChain - chainB *ibctesting.TestChain -} - -// TestKeeperTestSuite runs all the tests within this package. -func TestKeeperTestSuite(t *testing.T) { - suite.Run(t, new(KeeperTestSuite)) -} - -// SetupTest creates a coordinator with 2 test chains. -func (suite *KeeperTestSuite) SetupTest() { - suite.coordinator = ibctesting.NewCoordinator(suite.T(), 2) - suite.chainA = suite.coordinator.GetChain(ibctesting.GetChainID(1)) - suite.chainB = suite.coordinator.GetChain(ibctesting.GetChainID(2)) -} - -func NewICAPath(chainA, chainB *ibctesting.TestChain) *ibctesting.Path { - path := ibctesting.NewPath(chainA, chainB) - path.EndpointA.ChannelConfig.PortID = icatypes.HostPortID - path.EndpointB.ChannelConfig.PortID = icatypes.HostPortID - path.EndpointA.ChannelConfig.Order = channeltypes.ORDERED - path.EndpointB.ChannelConfig.Order = channeltypes.ORDERED - path.EndpointA.ChannelConfig.Version = TestVersion - path.EndpointB.ChannelConfig.Version = TestVersion - - return path -} - -// SetupICAPath invokes the InterchainAccounts entrypoint and subsequent channel handshake handlers -func SetupICAPath(path *ibctesting.Path, owner string) error { - if err := RegisterInterchainAccount(path.EndpointA, owner); err != nil { - return err - } - - if err := path.EndpointB.ChanOpenTry(); err != nil { - return err - } - - if err := path.EndpointA.ChanOpenAck(); err != nil { - return err - } - - return path.EndpointB.ChanOpenConfirm() -} - -func GetICAApp(chain *ibctesting.TestChain) *icaapp.App { - app, ok := chain.App.(*icaapp.App) - if !ok { - panic("not ica app") - } - - return app -} - -// RegisterInterchainAccount is a helper function for starting the channel handshake -func RegisterInterchainAccount(endpoint *ibctesting.Endpoint, owner string) error { - portID, err := icatypes.NewControllerPortID(owner) - if err != nil { - return err - } - - channelSequence := endpoint.Chain.App.GetIBCKeeper().ChannelKeeper.GetNextChannelSequence(endpoint.Chain.GetContext()) - - if err := GetICAApp(endpoint.Chain).ICAControllerKeeper.RegisterInterchainAccount(endpoint.Chain.GetContext(), endpoint.ConnectionID, owner, TestVersion); err != nil { - return err - } - - // commit state changes for proof verification - endpoint.Chain.NextBlock() - - // update port/channel ids - endpoint.ChannelID = channeltypes.FormatChannelIdentifier(channelSequence) - endpoint.ChannelConfig.PortID = portID - - return nil -} diff --git a/x/cw-ica/keeper/sudo.go b/x/cw-ica/keeper/sudo.go index c4cd5e67..9266e91c 100644 --- a/x/cw-ica/keeper/sudo.go +++ b/x/cw-ica/keeper/sudo.go @@ -7,8 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/Team-Kujira/core/x/cw-ica/types" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) func (k Keeper) HasContractInfo(ctx sdk.Context, contractAddress sdk.AccAddress) bool { diff --git a/x/cw-ica/keeper/transfer_handlers.go b/x/cw-ica/keeper/transfer_handlers.go index b72c1b10..6f6ed8c4 100644 --- a/x/cw-ica/keeper/transfer_handlers.go +++ b/x/cw-ica/keeper/transfer_handlers.go @@ -5,8 +5,8 @@ import ( "github.com/Team-Kujira/core/x/cw-ica/types" sdk "github.com/cosmos/cosmos-sdk/types" - transfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" + transfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) // HandleAcknowledgement passes the acknowledgement data to the appropriate contract via a Sudo call. diff --git a/x/cw-ica/module.go b/x/cw-ica/module.go index d7d88d72..baeb0db1 100644 --- a/x/cw-ica/module.go +++ b/x/cw-ica/module.go @@ -99,6 +99,12 @@ func NewAppModule(cdc codec.Codec, keeper keeper.Keeper) AppModule { } } +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (am AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (am AppModule) IsAppModule() {} + // Name returns the capability module's name. func (am AppModule) Name() string { return am.AppModuleBasic.Name() @@ -134,10 +140,10 @@ func (am AppModule) ExportGenesis(_ sdk.Context, _ codec.JSONCodec) json.RawMess func (AppModule) ConsensusVersion() uint64 { return 1 } // BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +func (am AppModule) BeginBlock(_ sdk.Context) {} // EndBlock executes all ABCI EndBlock logic respective to the capability module. It // returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { +func (am AppModule) EndBlock(_ sdk.Context) []abci.ValidatorUpdate { return []abci.ValidatorUpdate{} } diff --git a/x/cw-ica/transfer_middleware.go b/x/cw-ica/transfer_middleware.go index 0f834f1f..71fe3502 100644 --- a/x/cw-ica/transfer_middleware.go +++ b/x/cw-ica/transfer_middleware.go @@ -3,11 +3,11 @@ package cwica import ( "github.com/Team-Kujira/core/x/cw-ica/keeper" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/cosmos-sdk/x/capability/types" - clienttypes "github.com/cosmos/ibc-go/v7/modules/core/02-client/types" - channeltypes "github.com/cosmos/ibc-go/v7/modules/core/04-channel/types" - porttypes "github.com/cosmos/ibc-go/v7/modules/core/05-port/types" - ibcexported "github.com/cosmos/ibc-go/v7/modules/core/exported" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" ) var _ porttypes.Middleware = &IBCMiddleware{} diff --git a/x/cw-ica/types/codec.go b/x/cw-ica/types/codec.go index e01098a1..8b8d1317 100644 --- a/x/cw-ica/types/codec.go +++ b/x/cw-ica/types/codec.go @@ -9,11 +9,6 @@ import ( "github.com/cosmos/cosmos-sdk/types/msgservice" ) -var ( - amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewAminoCodec(amino) -) - func RegisterCodec(_ *codec.LegacyAmino) { } diff --git a/x/cw-ica/types/query.pb.gw.go b/x/cw-ica/types/query.pb.gw.go index 90d41b99..00b7fa55 100644 --- a/x/cw-ica/types/query.pb.gw.go +++ b/x/cw-ica/types/query.pb.gw.go @@ -20,6 +20,7 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" + "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -30,6 +31,7 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage +var _ = metadata.Join var ( filter_Query_InterchainAccount_0 = &utilities.DoubleArray{Encoding: map[string]int{"owner": 0, "connection_id": 1}, Base: []int{1, 1, 2, 0, 0}, Check: []int{0, 1, 1, 2, 3}} @@ -128,12 +130,14 @@ func local_request_Query_InterchainAccount_0(ctx context.Context, marshaler runt // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// 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_InterchainAccount_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 { @@ -141,6 +145,7 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_InterchainAccount_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) diff --git a/x/cw-ica/types/tx_serialize.go b/x/cw-ica/types/tx_serialize.go index 2da853c8..85217088 100644 --- a/x/cw-ica/types/tx_serialize.go +++ b/x/cw-ica/types/tx_serialize.go @@ -4,7 +4,7 @@ import ( "cosmossdk.io/errors" "github.com/cosmos/cosmos-sdk/codec" cosmostypes "github.com/cosmos/cosmos-sdk/codec/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" ) func SerializeCosmosTx(cdc codec.BinaryCodec, msgs []*cosmostypes.Any) (bz []byte, err error) { diff --git a/x/cw-ica/wasm/interface_msg.go b/x/cw-ica/wasm/interface_msg.go index 4c1d4413..454351cf 100644 --- a/x/cw-ica/wasm/interface_msg.go +++ b/x/cw-ica/wasm/interface_msg.go @@ -2,17 +2,20 @@ package wasm import ( "cosmossdk.io/errors" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/gogoproto/proto" + icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" + icacontrollertypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" + wasmkeeper "github.com/CosmWasm/wasmd/x/wasm/keeper" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" cwicakeeper "github.com/Team-Kujira/core/x/cw-ica/keeper" "github.com/Team-Kujira/core/x/cw-ica/types" - cosmostypes "github.com/cosmos/cosmos-sdk/codec/types" - sdk "github.com/cosmos/cosmos-sdk/types" - icacontrollerkeeper "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/keeper" - icacontrollertypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/controller/types" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" - ibctransferkeeper "github.com/cosmos/ibc-go/v7/modules/apps/transfer/keeper" - ibctransfertypes "github.com/cosmos/ibc-go/v7/modules/apps/transfer/types" + ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" ) // ProtobufAny is a hack-struct to serialize protobuf Any message into JSON object @@ -40,10 +43,11 @@ type CwIcaMsg struct { // / The account is registered using (port, channel, sender, id) // / as the unique identifier. type Register struct { - ConnectionID string `json:"connection_id"` - AccountID string `json:"account_id"` - Version string `json:"version"` - Callback []byte `json:"callback"` + ConnectionID string `json:"connection_id"` + AccountID string `json:"account_id"` + Version string `json:"version"` + Ordering channeltypes.Order `json:"ordering"` + Callback []byte `json:"callback"` } // / Submit submits transactions to the ICA @@ -66,16 +70,28 @@ type Transfer struct { Memo string `json:"memo"` } -func register(ctx sdk.Context, contractAddr sdk.AccAddress, register *Register, cwicak cwicakeeper.Keeper, ik icacontrollerkeeper.Keeper) ([]sdk.Event, [][]byte, error) { - _, err := PerformRegisterICA(cwicak, ik, ctx, contractAddr, register) +func register( + ctx sdk.Context, + contractAddr sdk.AccAddress, + register *Register, + cwicak cwicakeeper.Keeper, + ik icacontrollerkeeper.Keeper, +) (*icacontrollertypes.MsgRegisterInterchainAccountResponse, error) { + res, err := PerformRegisterICA(cwicak, ik, ctx, contractAddr, register) if err != nil { - return nil, nil, errors.Wrap(err, "perform register ICA") + return nil, errors.Wrap(err, "perform register ICA") } - return nil, nil, nil + return res, nil } // PerformRegisterICA is used with register to validate the register message and register the ICA. -func PerformRegisterICA(cwicak cwicakeeper.Keeper, f icacontrollerkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, msg *Register) (*icacontrollertypes.MsgRegisterInterchainAccountResponse, error) { +func PerformRegisterICA( + cwicak cwicakeeper.Keeper, + f icacontrollerkeeper.Keeper, + ctx sdk.Context, + contractAddr sdk.AccAddress, + msg *Register, +) (*icacontrollertypes.MsgRegisterInterchainAccountResponse, error) { if msg == nil { return nil, wasmvmtypes.InvalidRequest{Err: "register ICA null message"} } @@ -84,14 +100,19 @@ func PerformRegisterICA(cwicak cwicakeeper.Keeper, f icacontrollerkeeper.Keeper, // format "{owner}-{id}" owner := contractAddr.String() + "-" + msg.AccountID - msgRegister := icacontrollertypes.NewMsgRegisterInterchainAccount(msg.ConnectionID, owner, msg.Version) + msgRegister := icacontrollertypes.NewMsgRegisterInterchainAccountWithOrdering( + msg.ConnectionID, + owner, + msg.Version, + msg.Ordering, + ) if err := msgRegister.ValidateBasic(); err != nil { return nil, errors.Wrap(err, "failed validating MsgRegisterInterchainAccount") } res, err := msgServer.RegisterInterchainAccount( - sdk.WrapSDKContext(ctx), + ctx, msgRegister, ) if err != nil { @@ -99,10 +120,6 @@ func PerformRegisterICA(cwicak cwicakeeper.Keeper, f icacontrollerkeeper.Keeper, } portID, err := icatypes.NewControllerPortID(owner) - if err != nil { - return nil, err - } - if err != nil { return nil, errors.Wrap(err, "registering ICA") } @@ -122,22 +139,34 @@ func PerformRegisterICA(cwicak cwicakeeper.Keeper, f icacontrollerkeeper.Keeper, return res, nil } -func submit(ctx sdk.Context, contractAddr sdk.AccAddress, submitTx *Submit, cwicak cwicakeeper.Keeper, ik icacontrollerkeeper.Keeper) ([]sdk.Event, [][]byte, error) { - _, err := PerformSubmitTxs(ik, cwicak, ctx, contractAddr, submitTx) +func submit( + ctx sdk.Context, + contractAddr sdk.AccAddress, + submitTx *Submit, + cwicak cwicakeeper.Keeper, + ik icacontrollerkeeper.Keeper, +) (*icacontrollertypes.MsgSendTxResponse, error) { + res, err := PerformSubmitTxs(ik, cwicak, ctx, contractAddr, submitTx) if err != nil { - return nil, nil, errors.Wrap(err, "perform submit txs") + return nil, errors.Wrap(err, "perform submit txs") } - return nil, nil, nil + return res, nil } // PerformSubmitTxs is used with submitTxs to validate the submitTxs message and submit the txs. -func PerformSubmitTxs(f icacontrollerkeeper.Keeper, cwicak cwicakeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, submitTx *Submit) (*icacontrollertypes.MsgSendTxResponse, error) { +func PerformSubmitTxs( + f icacontrollerkeeper.Keeper, + cwicak cwicakeeper.Keeper, + ctx sdk.Context, + contractAddr sdk.AccAddress, + submitTx *Submit, +) (*icacontrollertypes.MsgSendTxResponse, error) { if submitTx == nil { return nil, wasmvmtypes.InvalidRequest{Err: "submit txs null message"} } - msgs := []*cosmostypes.Any{} + msgs := []*codectypes.Any{} for _, msg := range submitTx.Msgs { - msgs = append(msgs, &cosmostypes.Any{ + msgs = append(msgs, &codectypes.Any{ TypeUrl: msg.TypeURL, Value: msg.Value, }) @@ -156,7 +185,7 @@ func PerformSubmitTxs(f icacontrollerkeeper.Keeper, cwicak cwicakeeper.Keeper, c msgServer := icacontrollerkeeper.NewMsgServerImpl(&f) owner := contractAddr.String() + "-" + submitTx.AccountID - res, err := msgServer.SendTx(sdk.WrapSDKContext(ctx), icacontrollertypes.NewMsgSendTx(owner, submitTx.ConnectionID, submitTx.Timeout, packetData)) + res, err := msgServer.SendTx(ctx, icacontrollertypes.NewMsgSendTx(owner, submitTx.ConnectionID, submitTx.Timeout, packetData)) if err != nil { return nil, errors.Wrap(err, "submitting txs") } @@ -183,12 +212,12 @@ func PerformSubmitTxs(f icacontrollerkeeper.Keeper, cwicak cwicakeeper.Keeper, c return res, nil } -func transfer(ctx sdk.Context, contractAddr sdk.AccAddress, transferTx *Transfer, cwicak cwicakeeper.Keeper, tk ibctransferkeeper.Keeper) ([]sdk.Event, [][]byte, error) { - _, err := PerformTransfer(tk, cwicak, ctx, contractAddr, transferTx) +func transfer(ctx sdk.Context, contractAddr sdk.AccAddress, transferTx *Transfer, cwicak cwicakeeper.Keeper, tk ibctransferkeeper.Keeper) (*ibctransfertypes.MsgTransferResponse, error) { + res, err := PerformTransfer(tk, cwicak, ctx, contractAddr, transferTx) if err != nil { - return nil, nil, errors.Wrap(err, "perform submit txs") + return nil, errors.Wrap(err, "perform submit txs") } - return nil, nil, nil + return res, nil } // PerformTransfer is used to perform ibc transfer through wasmbinding. @@ -212,7 +241,7 @@ func PerformTransfer(f ibctransferkeeper.Keeper, cwicak cwicakeeper.Keeper, ctx Memo: transferTx.Memo, } - res, err := f.Transfer(sdk.WrapSDKContext(ctx), msg) + res, err := f.Transfer(ctx, msg) if err != nil { return nil, errors.Wrap(err, "submitting transfer tx") } @@ -229,15 +258,42 @@ func PerformTransfer(f ibctransferkeeper.Keeper, cwicak cwicakeeper.Keeper, ctx return res, nil } -func HandleMsg(ctx sdk.Context, cwicak cwicakeeper.Keeper, icak icacontrollerkeeper.Keeper, transferk ibctransferkeeper.Keeper, contractAddr sdk.AccAddress, msg *CwIcaMsg) ([]sdk.Event, [][]byte, error) { +func HandleMsg( + ctx sdk.Context, + cwicak cwicakeeper.Keeper, + icak icacontrollerkeeper.Keeper, + transferk ibctransferkeeper.Keeper, + contractAddr sdk.AccAddress, + msg *CwIcaMsg, +) ([]sdk.Event, [][]byte, [][]*codectypes.Any, error) { + var res proto.Message + var err error + if msg.Register != nil { - return register(ctx, contractAddr, msg.Register, cwicak, icak) + res, err = register(ctx, contractAddr, msg.Register, cwicak, icak) } + if msg.Submit != nil { - return submit(ctx, contractAddr, msg.Submit, cwicak, icak) + res, err = submit(ctx, contractAddr, msg.Submit, cwicak, icak) } + if msg.Transfer != nil { - return transfer(ctx, contractAddr, msg.Transfer, cwicak, transferk) + res, err = transfer(ctx, contractAddr, msg.Transfer, cwicak, transferk) + } + + if err != nil { + return nil, nil, nil, err } - return nil, nil, wasmvmtypes.InvalidRequest{Err: "unknown ICA Message variant"} + + if res == nil { + return nil, nil, nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown Custom variant"} + } + + x, err := codectypes.NewAnyWithValue(res) + if err != nil { + return nil, nil, nil, err + } + msgResponses := [][]*codectypes.Any{{x}} + + return nil, nil, msgResponses, err } diff --git a/x/cw-ica/wasm/interface_query.go b/x/cw-ica/wasm/interface_query.go index 6b9e2bbc..4a5eb98f 100644 --- a/x/cw-ica/wasm/interface_query.go +++ b/x/cw-ica/wasm/interface_query.go @@ -2,11 +2,11 @@ package wasm import ( "cosmossdk.io/errors" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/Team-Kujira/core/x/cw-ica/keeper" - icatypes "github.com/cosmos/ibc-go/v7/modules/apps/27-interchain-accounts/types" + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" ) // Querier - staking query interface for wasm contract diff --git a/x/denom/genesis.go b/x/denom/genesis.go index 3d02b0d4..a113fdea 100644 --- a/x/denom/genesis.go +++ b/x/denom/genesis.go @@ -10,12 +10,15 @@ import ( // InitGenesis initializes the denom module's state from a provided genesis // state. func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) { - k.CreateModuleAccount(ctx) + // k.CreateModuleAccount(ctx) if genState.Params.CreationFee == nil { genState.Params.CreationFee = sdk.NewCoins() } - k.SetParams(ctx, genState.Params) + err := k.SetParams(ctx, genState.Params) + if err != nil { + panic(err) + } for _, genDenom := range genState.GetFactoryDenoms() { creator, nonce, err := types.DeconstructDenom(genDenom.GetDenom()) diff --git a/x/denom/keeper/creators.go b/x/denom/keeper/creators.go index c3145474..90fdc0b4 100644 --- a/x/denom/keeper/creators.go +++ b/x/denom/keeper/creators.go @@ -1,6 +1,7 @@ package keeper import ( + "cosmossdk.io/store" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -22,6 +23,6 @@ func (k Keeper) getDenomsFromCreator(ctx sdk.Context, creator string) []string { return denoms } -func (k Keeper) GetAllDenomsIterator(ctx sdk.Context) sdk.Iterator { +func (k Keeper) GetAllDenomsIterator(ctx sdk.Context) store.Iterator { return k.GetCreatorsPrefixStore(ctx).Iterator(nil, nil) } diff --git a/x/denom/keeper/keeper.go b/x/denom/keeper/keeper.go index a15683f6..c4057cef 100644 --- a/x/denom/keeper/keeper.go +++ b/x/denom/keeper/keeper.go @@ -3,24 +3,25 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" + "cosmossdk.io/log" + "cosmossdk.io/store" + "cosmossdk.io/store/prefix" "github.com/cosmos/cosmos-sdk/codec" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/Team-Kujira/core/x/denom/types" - storetypes "github.com/cosmos/cosmos-sdk/store/types" + storetypes "cosmossdk.io/store/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" ) type ( Keeper struct { cdc codec.Codec storeKey storetypes.StoreKey - paramSpace paramtypes.Subspace + paramSpace paramstypes.Subspace accountKeeper types.AccountKeeper bankKeeper types.BankKeeper @@ -34,7 +35,7 @@ type ( func NewKeeper( cdc codec.Codec, storeKey storetypes.StoreKey, - paramSpace paramtypes.Subspace, + paramSpace paramstypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, distrKeeper types.DistrKeeper, @@ -63,19 +64,19 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { } // GetDenomPrefixStore returns the substore for a specific denom -func (k Keeper) GetDenomPrefixStore(ctx sdk.Context, denom string) sdk.KVStore { +func (k Keeper) GetDenomPrefixStore(ctx sdk.Context, denom string) store.KVStore { store := ctx.KVStore(k.storeKey) return prefix.NewStore(store, types.GetDenomPrefixStore(denom)) } // GetCreatorPrefixStore returns the substore for a specific creator address -func (k Keeper) GetCreatorPrefixStore(ctx sdk.Context, creator string) sdk.KVStore { +func (k Keeper) GetCreatorPrefixStore(ctx sdk.Context, creator string) store.KVStore { store := ctx.KVStore(k.storeKey) return prefix.NewStore(store, types.GetCreatorPrefix(creator)) } // GetCreatorsPrefixStore returns the substore that contains a list of creators -func (k Keeper) GetCreatorsPrefixStore(ctx sdk.Context) sdk.KVStore { +func (k Keeper) GetCreatorsPrefixStore(ctx sdk.Context) store.KVStore { store := ctx.KVStore(k.storeKey) return prefix.NewStore(store, types.GetCreatorsPrefix()) } @@ -88,3 +89,7 @@ func (k Keeper) CreateModuleAccount(ctx sdk.Context) { moduleAcc := authtypes.NewEmptyModuleAccount(types.ModuleName, authtypes.Minter, authtypes.Burner) k.accountKeeper.SetModuleAccount(ctx, moduleAcc) } + +func (k Keeper) GetSubspace() paramstypes.Subspace { + return k.paramSpace +} diff --git a/x/denom/keeper/keeper_test.go b/x/denom/keeper/keeper_test.go index 6825d4d2..2a360f4c 100644 --- a/x/denom/keeper/keeper_test.go +++ b/x/denom/keeper/keeper_test.go @@ -4,7 +4,6 @@ import ( "testing" app "github.com/Team-Kujira/core/app" - tmproto "github.com/cometbft/cometbft/proto/tendermint/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/suite" ) @@ -23,6 +22,6 @@ func TestKeeperTestSuite(t *testing.T) { func (suite *KeeperTestSuite) SetupTest() { app := app.Setup(suite.T(), false) - suite.Ctx = app.BaseApp.NewContext(false, tmproto.Header{}) + suite.Ctx = app.BaseApp.NewContext(false) suite.App = app } diff --git a/x/denom/keeper/migrations.go b/x/denom/keeper/migrations.go index e595aa64..4a806086 100644 --- a/x/denom/keeper/migrations.go +++ b/x/denom/keeper/migrations.go @@ -1,24 +1,26 @@ package keeper import ( + "github.com/CosmWasm/wasmd/x/wasm/exported" + v1 "github.com/Team-Kujira/core/x/denom/migrations/v1" sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/Team-Kujira/core/x/denom/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" ) // Migrator is a struct for handling in-place store migrations. type Migrator struct { - keeper Keeper + keeper Keeper + legacySubspace exported.Subspace + // queryServer grpc.Server } // NewMigrator returns a new Migrator. -func NewMigrator(keeper Keeper) Migrator { - return Migrator{keeper: keeper} +func NewMigrator(keeper Keeper, subspace paramstypes.Subspace) Migrator { + return Migrator{keeper: keeper, legacySubspace: subspace} } // Migrate1to2 migrates from version 1 to 2. func (m Migrator) Migrate1to2(ctx sdk.Context) error { - params := types.DefaultParams() - m.keeper.SetParams(ctx, params) - return nil + store := ctx.KVStore(m.keeper.storeKey) + return v1.MigrateParams(ctx, store, m.keeper.paramSpace, m.keeper.cdc) } diff --git a/x/denom/keeper/msg_server.go b/x/denom/keeper/msg_server.go index 41bbfe56..58f55296 100644 --- a/x/denom/keeper/msg_server.go +++ b/x/denom/keeper/msg_server.go @@ -3,7 +3,9 @@ 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/Team-Kujira/core/x/denom/types" ) @@ -198,3 +200,16 @@ func (server msgServer) ChangeAdmin(goCtx context.Context, msg *types.MsgChangeA return &types.MsgChangeAdminResponse{}, nil } + +func (server msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if server.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", server.authority, msg.Authority) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + if err := server.SetParams(ctx, *msg.Params); err != nil { + return nil, err + } + + return &types.MsgUpdateParamsResponse{}, nil +} diff --git a/x/denom/keeper/msg_server_test.go b/x/denom/keeper/msg_server_test.go index fb1c599f..67db6c56 100644 --- a/x/denom/keeper/msg_server_test.go +++ b/x/denom/keeper/msg_server_test.go @@ -57,7 +57,7 @@ func (suite *KeeperTestSuite) TestMsgServerCreateDenom() { msgServer := keeper.NewMsgServerImpl(*suite.App.DenomKeeper) resp, err := msgServer.CreateDenom( - sdk.WrapSDKContext(suite.Ctx), + suite.Ctx, &types.MsgCreateDenom{ Sender: sender.String(), Nonce: "1", diff --git a/x/denom/keeper/no_fee_accounts.go b/x/denom/keeper/no_fee_accounts.go index 50386f9a..0b814b9e 100644 --- a/x/denom/keeper/no_fee_accounts.go +++ b/x/denom/keeper/no_fee_accounts.go @@ -1,9 +1,10 @@ package keeper import ( - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" + storetypes "cosmossdk.io/store/types" "github.com/Team-Kujira/core/x/denom/types" ) @@ -32,7 +33,7 @@ func (k Keeper) RemoveNoFeeAccount(ctx sdk.Context, address string) { // GetNoFeeAccounts returns all no fee accounts func (k Keeper) GetNoFeeAccounts(ctx sdk.Context) []string { store := ctx.KVStore(k.storeKey) - iterator := sdk.KVStorePrefixIterator(store, types.GetNoFeeAccountPrefix()) + iterator := storetypes.KVStorePrefixIterator(store, types.GetNoFeeAccountPrefix()) defer iterator.Close() accounts := []string{} diff --git a/x/denom/keeper/no_fee_accounts_test.go b/x/denom/keeper/no_fee_accounts_test.go index 7cfb13b2..01ddc6ba 100644 --- a/x/denom/keeper/no_fee_accounts_test.go +++ b/x/denom/keeper/no_fee_accounts_test.go @@ -6,8 +6,6 @@ import ( ) func (suite *KeeperTestSuite) TestNoFeeAccounts() { - suite.SetupTest() - // Set accounts addr1 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) addr2 := sdk.AccAddress(ed25519.GenPrivKey().PubKey().Address()) diff --git a/x/denom/keeper/params.go b/x/denom/keeper/params.go index 24686b2d..45ce1a16 100644 --- a/x/denom/keeper/params.go +++ b/x/denom/keeper/params.go @@ -8,11 +8,24 @@ import ( // GetParams returns the total set params. func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) return params } // SetParams sets the total set of params. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.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 := k.cdc.MustMarshal(¶ms) + store.Set(types.ParamsKey, bz) + return nil } diff --git a/x/denom/migrations/v1/migrate.go b/x/denom/migrations/v1/migrate.go new file mode 100644 index 00000000..99027a51 --- /dev/null +++ b/x/denom/migrations/v1/migrate.go @@ -0,0 +1,25 @@ +package v1 + +import ( + "cosmossdk.io/store" + denomtypes "github.com/Team-Kujira/core/x/denom/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +func MigrateParams( + ctx sdk.Context, + store store.KVStore, + subspace paramtypes.Subspace, + cdc codec.BinaryCodec, +) error { + var denomParams denomtypes.Params + + subspace.Get(ctx, denomtypes.ParamsKey, &denomParams) + + bz := cdc.MustMarshal(&denomParams) + store.Set(denomtypes.ParamsKey, bz) + + return nil +} diff --git a/x/denom/module.go b/x/denom/module.go index 64f2a59f..481de2f4 100644 --- a/x/denom/module.go +++ b/x/denom/module.go @@ -23,6 +23,8 @@ import ( "github.com/Team-Kujira/core/x/denom/types" ) +const ConsensusVersion = 2 + var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} @@ -46,6 +48,12 @@ func (AppModuleBasic) Name() string { return types.ModuleName } +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (AppModule) IsAppModule() {} + func (AppModuleBasic) RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { types.RegisterCodec(cdc) } @@ -124,10 +132,11 @@ func (AppModule) QuerierRoute() string { return types.QuerierRoute } func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) - m := keeper.NewMigrator(am.keeper) - err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2) - if err != nil { - panic(err) + + m := keeper.NewMigrator(am.keeper, am.keeper.GetSubspace()) + + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(fmt.Sprintf("failed to migrate x/%s from version 1 to 2: %v", types.ModuleName, err)) } } @@ -152,16 +161,7 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 2 } - -// BeginBlock executes all ABCI BeginBlock logic respective to the denom module. -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - -// EndBlock executes all ABCI EndBlock logic respective to the denom module. It -// returns no validator updates. -func (am AppModule) EndBlock(_ sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - return []abci.ValidatorUpdate{} -} +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // ___________________________________________________________________________ @@ -178,7 +178,7 @@ func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.Weight } // RegisterStoreDecoder registers a decoder for denom module's types -func (am AppModule) RegisterStoreDecoder(_ sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(_ simtypes.StoreDecoderRegistry) { } // WeightedOperations returns simulator module operations with their respective weights. diff --git a/x/denom/types/codec.go b/x/denom/types/codec.go index 0495d951..03bb6493 100644 --- a/x/denom/types/codec.go +++ b/x/denom/types/codec.go @@ -13,6 +13,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgBurn{}, "github.com/Team-Kujira/core/denom/burn", nil) // cdc.RegisterConcrete(&MsgForceTransfer{}, "github.com/Team-Kujira/core/denom/force-transfer", nil) cdc.RegisterConcrete(&MsgChangeAdmin{}, "github.com/Team-Kujira/core/denom/change-admin", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "github.com/Team-Kujira/core/denom/update-params", nil) cdc.RegisterConcrete(&MsgAddNoFeeAccounts{}, "github.com/Team-Kujira/core/denom/add-no-fee-accounts", nil) cdc.RegisterConcrete(&MsgRemoveNoFeeAccounts{}, "github.com/Team-Kujira/core/denom/remove-no-fee-accounts", nil) } @@ -25,13 +26,9 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgBurn{}, // &MsgForceTransfer{}, &MsgChangeAdmin{}, + &MsgUpdateParams{}, &MsgAddNoFeeAccounts{}, &MsgRemoveNoFeeAccounts{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } - -var ( - Amino = codec.NewLegacyAmino() - ModuleCdc = codec.NewProtoCodec(cdctypes.NewInterfaceRegistry()) -) diff --git a/x/denom/types/denoms.go b/x/denom/types/denoms.go index e794f817..2c6a3d4e 100644 --- a/x/denom/types/denoms.go +++ b/x/denom/types/denoms.go @@ -1,12 +1,13 @@ package types import ( + "context" fmt "fmt" "strings" "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) const ( @@ -58,8 +59,8 @@ func DeconstructDenom(denom string) (creator string, nonce string, err error) { // NewdenomDenomMintCoinsRestriction creates and returns a BankMintingRestrictionFn that only allows minting of // valid denom denoms -func NewdenomDenomMintCoinsRestriction() bankkeeper.MintingRestrictionFn { - return func(_ sdk.Context, coinsToMint sdk.Coins) error { +func NewdenomDenomMintCoinsRestriction() banktypes.MintingRestrictionFn { + return func(_ context.Context, coinsToMint sdk.Coins) error { for _, coin := range coinsToMint { _, _, err := DeconstructDenom(coin.Denom) if err != nil { diff --git a/x/denom/types/expected_keepers.go b/x/denom/types/expected_keepers.go index 62a7ad7c..bfa88625 100644 --- a/x/denom/types/expected_keepers.go +++ b/x/denom/types/expected_keepers.go @@ -1,33 +1,34 @@ package types import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" ) type BankKeeper interface { // Methods imported from bank should be defined here - GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) - SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) + GetDenomMetaData(ctx context.Context, denom string) (banktypes.Metadata, bool) + SetDenomMetaData(ctx context.Context, denomMetaData banktypes.Metadata) - SendCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - SendCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - DelegateCoinsFromAccountToModule(ctx sdk.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error - UndelegateCoinsFromModuleToAccount(ctx sdk.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error - MintCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error - BurnCoins(ctx sdk.Context, moduleName string, amt sdk.Coins) error + SendCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + SendCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + DelegateCoinsFromAccountToModule(ctx context.Context, senderAddr sdk.AccAddress, recipientModule string, amt sdk.Coins) error + UndelegateCoinsFromModuleToAccount(ctx context.Context, senderModule string, recipientAddr sdk.AccAddress, amt sdk.Coins) error + MintCoins(ctx context.Context, moduleName string, amt sdk.Coins) error + BurnCoins(ctx context.Context, moduleName string, amt sdk.Coins) error - SendCoins(ctx sdk.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error + SendCoins(ctx context.Context, fromAddr sdk.AccAddress, toAddr sdk.AccAddress, amt sdk.Coins) error } type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress - SetModuleAccount(ctx sdk.Context, macc authtypes.ModuleAccountI) - GetAccount(sdk.Context, sdk.AccAddress) authtypes.AccountI + SetModuleAccount(ctx context.Context, macc sdk.ModuleAccountI) + GetAccount(context.Context, sdk.AccAddress) sdk.AccountI } // DistrKeeper defines the contract needed to be fulfilled for distribution keeper. type DistrKeeper interface { - FundCommunityPool(ctx sdk.Context, amount sdk.Coins, sender sdk.AccAddress) error + FundCommunityPool(ctx context.Context, amount sdk.Coins, sender sdk.AccAddress) error } diff --git a/x/denom/types/keys.go b/x/denom/types/keys.go index 5adfa0eb..395ec069 100644 --- a/x/denom/types/keys.go +++ b/x/denom/types/keys.go @@ -30,6 +30,7 @@ var ( CreatorPrefixKey = "creator" AdminPrefixKey = "admin" NoFeeAccountPrefixKey = "nofeeaccount" + ParamsKey = []byte("params") ) // GetDenomPrefixStore returns the store prefix where all the data associated with a specific denom diff --git a/x/denom/types/msgs.go b/x/denom/types/msgs.go index 829411bf..e79259ab 100644 --- a/x/denom/types/msgs.go +++ b/x/denom/types/msgs.go @@ -13,11 +13,15 @@ const ( TypeMsgBurn = "burn" TypeMsgForceTransfer = "force_transfer" TypeMsgChangeAdmin = "change_admin" + TypeMsgUpdateParams = "update_params" TypeMsgAddNoFeeAccounts = "add_no_fee_accounts" TypeMsgRemoveNoFeeAccounts = "remove_no_fee_accounts" ) -var _ sdk.Msg = &MsgCreateDenom{} +var ( + _ sdk.Msg = &MsgCreateDenom{} + _ sdk.Msg = &MsgUpdateParams{} +) // NewMsgCreateDenom creates a msg to create a new denom func NewMsgCreateDenom(sender, nonce string) *MsgCreateDenom { @@ -43,10 +47,6 @@ func (m MsgCreateDenom) ValidateBasic() error { return nil } -func (m MsgCreateDenom) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - func (m MsgCreateDenom) GetSigners() []sdk.AccAddress { sender, _ := sdk.AccAddressFromBech32(m.Sender) return []sdk.AccAddress{sender} @@ -78,10 +78,6 @@ func (m MsgMint) ValidateBasic() error { return nil } -func (m MsgMint) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - func (m MsgMint) GetSigners() []sdk.AccAddress { sender, _ := sdk.AccAddressFromBech32(m.Sender) return []sdk.AccAddress{sender} @@ -112,10 +108,6 @@ func (m MsgBurn) ValidateBasic() error { return nil } -func (m MsgBurn) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - func (m MsgBurn) GetSigners() []sdk.AccAddress { sender, _ := sdk.AccAddressFromBech32(m.Sender) return []sdk.AccAddress{sender} @@ -157,10 +149,6 @@ func (m MsgBurn) GetSigners() []sdk.AccAddress { // return nil // } -// func (m MsgForceTransfer) GetSignBytes() []byte { -// return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -// } - // func (m MsgForceTransfer) GetSigners() []sdk.AccAddress { // sender, _ := sdk.AccAddressFromBech32(m.Sender) // return []sdk.AccAddress{sender} @@ -198,15 +186,44 @@ func (m MsgChangeAdmin) ValidateBasic() error { return nil } -func (m MsgChangeAdmin) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - func (m MsgChangeAdmin) GetSigners() []sdk.AccAddress { sender, _ := sdk.AccAddressFromBech32(m.Sender) return []sdk.AccAddress{sender} } +// NewMsgUpdateParams creates a MsgUpdateParams instance +func NewMsgUpdateParams(params *Params) *MsgUpdateParams { + return &MsgUpdateParams{ + Params: params, + } +} + +// Route implements sdk.Msg +func (m MsgUpdateParams) Route() string { return RouterKey } + +// Type implements sdk.Msg +func (m MsgUpdateParams) Type() string { return TypeMsgUpdateParams } + +// GetSigners implements sdk.Msg +func (m MsgUpdateParams) GetSigners() []sdk.AccAddress { + operator, err := sdk.ValAddressFromBech32(m.Authority) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{sdk.AccAddress(operator)} +} + +// ValidateBasic implements sdk.Msg +func (m MsgUpdateParams) ValidateBasic() error { + _, err := sdk.ValAddressFromBech32(m.Authority) + if err != nil { + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid authority address (%s)", err) + } + + return nil +} + var _ sdk.Msg = &MsgAddNoFeeAccounts{} // NewMsgAddNoFeeAccounts creates a message to add no fee accounts @@ -228,10 +245,6 @@ func (m MsgAddNoFeeAccounts) ValidateBasic() error { return nil } -func (m MsgAddNoFeeAccounts) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - func (m MsgAddNoFeeAccounts) GetSigners() []sdk.AccAddress { sender, _ := sdk.AccAddressFromBech32(m.Authority) return []sdk.AccAddress{sender} @@ -258,10 +271,6 @@ func (m MsgRemoveNoFeeAccounts) ValidateBasic() error { return nil } -func (m MsgRemoveNoFeeAccounts) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&m)) -} - func (m MsgRemoveNoFeeAccounts) GetSigners() []sdk.AccAddress { sender, _ := sdk.AccAddressFromBech32(m.Authority) return []sdk.AccAddress{sender} diff --git a/x/denom/types/tx.pb.go b/x/denom/types/tx.pb.go index 80fcf5cd..daf2e0a2 100644 --- a/x/denom/types/tx.pb.go +++ b/x/denom/types/tx.pb.go @@ -7,6 +7,7 @@ import ( context "context" fmt "fmt" types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -592,6 +593,95 @@ func (m *MsgChangeAdminResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgChangeAdminResponse proto.InternalMessageInfo +type MsgUpdateParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty" yaml:"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_4060456503c2ab45, []int{12} +} +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 nil +} + +// MsgUpdateParamsResponse defines the Msg/UpdateParams response type. +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_4060456503c2ab45, []int{13} +} +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((*MsgAddNoFeeAccounts)(nil), "kujira.denom.MsgAddNoFeeAccounts") proto.RegisterType((*MsgAddNoFeeAccountsResponse)(nil), "kujira.denom.MsgAddNoFeeAccountsResponse") @@ -605,51 +695,60 @@ func init() { proto.RegisterType((*MsgBurnResponse)(nil), "kujira.denom.MsgBurnResponse") proto.RegisterType((*MsgChangeAdmin)(nil), "kujira.denom.MsgChangeAdmin") proto.RegisterType((*MsgChangeAdminResponse)(nil), "kujira.denom.MsgChangeAdminResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "kujira.denom.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "kujira.denom.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("kujira/denom/tx.proto", fileDescriptor_4060456503c2ab45) } var fileDescriptor_4060456503c2ab45 = []byte{ - // 623 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0xc1, 0x6e, 0xd3, 0x40, - 0x10, 0x8d, 0x1b, 0x28, 0xcd, 0xb6, 0xa5, 0xa9, 0xdb, 0x54, 0xc1, 0xb4, 0x4e, 0x58, 0x55, 0xa8, - 0x91, 0xc0, 0xa6, 0xe1, 0x86, 0xb8, 0x24, 0x41, 0x08, 0x09, 0x19, 0x84, 0xd5, 0x13, 0x42, 0x2a, - 0x8e, 0x33, 0x72, 0x4c, 0xf1, 0x6e, 0xe4, 0xdd, 0x34, 0xcd, 0x85, 0x6f, 0xe0, 0xc2, 0x8f, 0xf0, - 0x15, 0x3d, 0xf6, 0xc8, 0x29, 0x42, 0xc9, 0x1f, 0x44, 0x7c, 0x00, 0xf2, 0xae, 0xe3, 0x18, 0xd9, - 0x02, 0x2a, 0x21, 0x71, 0x4b, 0xe6, 0xbd, 0x99, 0x37, 0xe3, 0x79, 0x63, 0xa3, 0xca, 0xd9, 0xf0, - 0x83, 0x1f, 0x3a, 0x66, 0x0f, 0x08, 0x0d, 0x4c, 0x7e, 0x61, 0x0c, 0x42, 0xca, 0xa9, 0xba, 0x21, - 0xc3, 0x86, 0x08, 0x6b, 0xbb, 0x1e, 0xf5, 0xa8, 0x00, 0xcc, 0xe8, 0x97, 0xe4, 0x68, 0xba, 0x4b, - 0x59, 0x40, 0x99, 0xd9, 0x75, 0x18, 0x98, 0xe7, 0xc7, 0x5d, 0xe0, 0xce, 0xb1, 0xe9, 0x52, 0x9f, - 0x48, 0x1c, 0xbf, 0x46, 0x3b, 0x16, 0xf3, 0x5a, 0xbd, 0xde, 0x2b, 0xfa, 0x1c, 0xa0, 0xe5, 0xba, - 0x74, 0x48, 0x38, 0x53, 0xf7, 0x51, 0xc9, 0x19, 0xf2, 0x3e, 0x0d, 0x7d, 0x3e, 0xae, 0x2a, 0x75, - 0xe5, 0xa8, 0x64, 0x2f, 0x03, 0xaa, 0x86, 0xd6, 0x9c, 0x98, 0x59, 0x5d, 0xa9, 0x17, 0x8f, 0x4a, - 0x76, 0xf2, 0x1f, 0x1f, 0xa0, 0xbb, 0x39, 0x05, 0x6d, 0x60, 0x03, 0x4a, 0x18, 0x60, 0x1b, 0xed, - 0x59, 0xcc, 0xb3, 0x21, 0xa0, 0xe7, 0xf0, 0xaf, 0x24, 0xeb, 0x48, 0xcf, 0xaf, 0x99, 0xa8, 0xba, - 0xe8, 0xb6, 0xc5, 0xbc, 0x4e, 0x08, 0x0e, 0x87, 0x67, 0xd1, 0xd3, 0x52, 0x1b, 0x68, 0x95, 0x01, - 0xe9, 0x41, 0x28, 0xa5, 0xda, 0xdb, 0xf3, 0x49, 0x6d, 0x73, 0xec, 0x04, 0x1f, 0x9f, 0x60, 0x19, - 0xc7, 0x76, 0x4c, 0x50, 0xef, 0xa3, 0x9b, 0x84, 0x12, 0x17, 0xaa, 0x2b, 0x82, 0x59, 0x9e, 0x4f, - 0x6a, 0x1b, 0x92, 0x29, 0xc2, 0xd8, 0x96, 0x30, 0x7e, 0x27, 0x46, 0x4b, 0x89, 0x2c, 0xe4, 0xd5, - 0x36, 0xda, 0x22, 0x30, 0x3a, 0xe5, 0xf4, 0x0c, 0xc8, 0xa9, 0xd8, 0x56, 0xac, 0xaa, 0xcd, 0x27, - 0xb5, 0xbd, 0xb8, 0xd6, 0xaf, 0x04, 0x6c, 0x6f, 0x12, 0x18, 0x9d, 0x44, 0x01, 0x51, 0x0b, 0x7f, - 0x55, 0xd0, 0x2d, 0x8b, 0x79, 0x96, 0x4f, 0xf8, 0x75, 0x9a, 0x7f, 0x81, 0x56, 0x9d, 0x20, 0x7a, - 0x18, 0xa2, 0xfb, 0xf5, 0xe6, 0x1d, 0x43, 0x1a, 0xc2, 0x88, 0x0c, 0x61, 0xc4, 0x86, 0x30, 0x3a, - 0xd4, 0x27, 0xed, 0xca, 0xe5, 0xa4, 0x56, 0x58, 0x56, 0x92, 0x69, 0xd8, 0x8e, 0xf3, 0xd5, 0x26, - 0x2a, 0x85, 0xe0, 0xfa, 0x03, 0x1f, 0x08, 0xaf, 0x16, 0x85, 0xee, 0xee, 0x7c, 0x52, 0x2b, 0x4b, - 0x76, 0x02, 0x61, 0x7b, 0x49, 0xc3, 0xdb, 0x68, 0x2b, 0xee, 0x39, 0x59, 0xc5, 0x27, 0x31, 0x46, - 0x7b, 0x18, 0x92, 0xff, 0x32, 0x46, 0xdc, 0x52, 0xa4, 0x9f, 0xb4, 0xf4, 0x45, 0x91, 0xf6, 0xe8, - 0x3b, 0xc4, 0x83, 0x56, 0x2f, 0xf0, 0xc9, 0x35, 0xed, 0x21, 0x57, 0x9a, 0xb1, 0x47, 0xbc, 0x48, - 0x09, 0xab, 0x8f, 0xd0, 0x1a, 0x81, 0x91, 0x28, 0x9f, 0x7d, 0x7c, 0xd1, 0xf6, 0x9d, 0x08, 0xc2, - 0x76, 0xc2, 0xc2, 0x55, 0x69, 0xa8, 0x65, 0x5b, 0x8b, 0x8e, 0x9b, 0x3f, 0x8a, 0xa8, 0x68, 0x31, - 0x4f, 0x7d, 0x8f, 0xca, 0x99, 0xd3, 0xbd, 0x67, 0xa4, 0x5f, 0x0b, 0x46, 0xce, 0x31, 0x6a, 0x8d, - 0x3f, 0x52, 0x12, 0xeb, 0xfa, 0x68, 0x27, 0xef, 0x58, 0x0f, 0x33, 0x15, 0x72, 0x58, 0xda, 0x83, - 0xbf, 0x61, 0x25, 0x52, 0x6f, 0xd0, 0x7a, 0xfa, 0x42, 0xf7, 0x33, 0xc9, 0x29, 0x54, 0x3b, 0xfc, - 0x1d, 0x9a, 0x94, 0x7c, 0x8a, 0x6e, 0x88, 0x83, 0xa9, 0x64, 0xd8, 0x51, 0x58, 0x3b, 0xc8, 0x0d, - 0xa7, 0xb3, 0x85, 0x4f, 0xb3, 0xd9, 0x51, 0x38, 0x27, 0x3b, 0xed, 0x2a, 0x31, 0x4e, 0xca, 0x51, - 0x39, 0xe3, 0x2c, 0xd1, 0xbc, 0x71, 0xb2, 0x6b, 0x6f, 0x77, 0x2e, 0xa7, 0xba, 0x72, 0x35, 0xd5, - 0x95, 0xef, 0x53, 0x5d, 0xf9, 0x3c, 0xd3, 0x0b, 0x57, 0x33, 0xbd, 0xf0, 0x6d, 0xa6, 0x17, 0xde, - 0x36, 0x3c, 0x9f, 0xf7, 0x87, 0x5d, 0xc3, 0xa5, 0x81, 0x79, 0x02, 0x4e, 0xf0, 0xf0, 0xa5, 0xfc, - 0x62, 0xb8, 0x34, 0x04, 0xf3, 0x62, 0xf1, 0xe1, 0x18, 0x0f, 0x80, 0x75, 0x57, 0xc5, 0x8b, 0xff, - 0xf1, 0xcf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x80, 0x22, 0x26, 0x15, 0x55, 0x06, 0x00, 0x00, + // 736 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x55, 0x4b, 0x6f, 0xd3, 0x4e, + 0x10, 0x8f, 0xdb, 0xfe, 0xf3, 0x6f, 0xb6, 0x6f, 0xf7, 0x95, 0x9a, 0xd6, 0x29, 0xab, 0x82, 0x5a, + 0x04, 0x36, 0x2d, 0xb7, 0x0a, 0x09, 0x35, 0x45, 0x08, 0x09, 0x85, 0x87, 0x55, 0x2e, 0x08, 0xa9, + 0x6c, 0x9c, 0x95, 0x6b, 0x8a, 0x77, 0x2d, 0xaf, 0xd3, 0xc7, 0x95, 0x2b, 0x17, 0x4e, 0x7c, 0x00, + 0x3e, 0x01, 0xdf, 0x80, 0x6b, 0xc5, 0xa9, 0x47, 0x4e, 0x11, 0x6a, 0x0f, 0xdc, 0xf3, 0x09, 0xd0, + 0x3e, 0xe2, 0xd8, 0xb5, 0x55, 0xa8, 0x84, 0xc4, 0xa9, 0xcd, 0xfc, 0x7e, 0x33, 0xf3, 0x9b, 0xd9, + 0x99, 0x31, 0x98, 0xdd, 0x6f, 0xbf, 0xf5, 0x23, 0x64, 0xb7, 0x30, 0xa1, 0x81, 0x1d, 0x1f, 0x59, + 0x61, 0x44, 0x63, 0xaa, 0x8f, 0x4a, 0xb3, 0x25, 0xcc, 0xc6, 0x8c, 0x47, 0x3d, 0x2a, 0x00, 0x9b, + 0xff, 0x27, 0x39, 0xc6, 0xbc, 0x4b, 0x59, 0x40, 0x99, 0x1d, 0x30, 0xcf, 0x3e, 0x58, 0xe7, 0x7f, + 0x14, 0x60, 0x2a, 0xa0, 0x89, 0x18, 0xb6, 0x0f, 0xd6, 0x9b, 0x38, 0x46, 0xeb, 0xb6, 0x4b, 0x7d, + 0xa2, 0xf0, 0x85, 0x4c, 0xce, 0x10, 0x45, 0x28, 0x60, 0x12, 0x82, 0xcf, 0xc0, 0x74, 0x83, 0x79, + 0x5b, 0xad, 0xd6, 0x53, 0xfa, 0x08, 0xe3, 0x2d, 0xd7, 0xa5, 0x6d, 0x12, 0x33, 0x7d, 0x11, 0x54, + 0x50, 0x3b, 0xde, 0xa3, 0x91, 0x1f, 0x1f, 0x57, 0xb5, 0x65, 0x6d, 0xb5, 0xe2, 0xf4, 0x0d, 0xba, + 0x01, 0x86, 0x91, 0x62, 0x56, 0x07, 0x96, 0x07, 0x57, 0x2b, 0x4e, 0xf2, 0x1b, 0x2e, 0x81, 0x6b, + 0x05, 0x01, 0x1d, 0xcc, 0x42, 0x4a, 0x18, 0x86, 0x0e, 0x98, 0x6b, 0x30, 0xcf, 0xc1, 0x01, 0x3d, + 0xc0, 0x7f, 0x2b, 0xe5, 0x32, 0x30, 0x8b, 0x63, 0x26, 0x59, 0x43, 0x30, 0xde, 0x60, 0xde, 0x76, + 0x84, 0x51, 0x8c, 0x1f, 0xf2, 0x26, 0xe8, 0x6b, 0xa0, 0xcc, 0x30, 0x69, 0xe1, 0x48, 0xa6, 0xaa, + 0x4f, 0x75, 0x3b, 0xb5, 0xb1, 0x63, 0x14, 0xbc, 0xdb, 0x84, 0xd2, 0x0e, 0x1d, 0x45, 0xd0, 0x6f, + 0x82, 0xff, 0x08, 0x25, 0x2e, 0xae, 0x0e, 0x08, 0xe6, 0x64, 0xb7, 0x53, 0x1b, 0x95, 0x4c, 0x61, + 0x86, 0x8e, 0x84, 0x37, 0x47, 0xde, 0xff, 0xfc, 0x72, 0x4b, 0x39, 0xc1, 0xd7, 0xa2, 0xce, 0x54, + 0xc6, 0x9e, 0x16, 0xbd, 0x0e, 0x26, 0x08, 0x3e, 0xdc, 0x8d, 0xe9, 0x3e, 0x26, 0xbb, 0xe2, 0x45, + 0x94, 0x04, 0xa3, 0xdb, 0xa9, 0xcd, 0xa9, 0xc0, 0x59, 0x02, 0x74, 0xc6, 0x08, 0x3e, 0xdc, 0xe1, + 0x06, 0x11, 0x0b, 0x7e, 0xd5, 0xc0, 0xff, 0x0d, 0xe6, 0x35, 0x7c, 0x12, 0x5f, 0xa5, 0x92, 0xc7, + 0xa0, 0x8c, 0x02, 0xde, 0x19, 0x51, 0xca, 0xc8, 0xc6, 0x82, 0x25, 0x07, 0xc7, 0xe2, 0x83, 0x63, + 0xa9, 0xc1, 0xb1, 0xb6, 0xa9, 0x4f, 0xea, 0xb3, 0x27, 0x9d, 0x5a, 0xa9, 0x1f, 0x49, 0xba, 0x41, + 0x47, 0xf9, 0xeb, 0x1b, 0xa0, 0x12, 0x61, 0xd7, 0x0f, 0x7d, 0x4c, 0xe2, 0xea, 0xa0, 0xc8, 0x3b, + 0xd3, 0xed, 0xd4, 0x26, 0x25, 0x3b, 0x81, 0xa0, 0xd3, 0xa7, 0x65, 0xfb, 0x33, 0x05, 0x26, 0x54, + 0x01, 0xc9, 0x23, 0x7d, 0x90, 0x45, 0xd5, 0xdb, 0x11, 0xf9, 0x27, 0x45, 0x15, 0x09, 0xe4, 0x62, + 0x12, 0x81, 0x9f, 0x35, 0x39, 0x46, 0x7b, 0x88, 0x78, 0x78, 0xab, 0x15, 0xf8, 0xe4, 0x8a, 0x63, + 0x24, 0x5f, 0x3b, 0x37, 0x46, 0xea, 0x8d, 0x25, 0xac, 0xdf, 0x05, 0xc3, 0x04, 0x1f, 0x8a, 0xf0, + 0xf9, 0xce, 0xf2, 0xc1, 0x40, 0x1c, 0x82, 0x4e, 0xc2, 0xca, 0xea, 0xae, 0xca, 0xc1, 0xeb, 0x6b, + 0x4c, 0xe4, 0x7f, 0xd2, 0x44, 0x49, 0x2f, 0xc3, 0x16, 0x8a, 0xf1, 0x73, 0x71, 0x04, 0xf8, 0x3b, + 0x5e, 0x58, 0xba, 0x74, 0xb6, 0x04, 0x82, 0xe9, 0x55, 0x7c, 0x00, 0xca, 0xf2, 0x84, 0xa8, 0x86, + 0xcf, 0x58, 0xe9, 0xdb, 0x65, 0xc9, 0xc8, 0xe9, 0x4e, 0x48, 0x36, 0x74, 0x94, 0xdb, 0xe6, 0x38, + 0xd7, 0xdb, 0x0f, 0x08, 0x17, 0xc0, 0xfc, 0x05, 0x5d, 0x3d, 0xcd, 0x1b, 0xdf, 0x86, 0xc0, 0x60, + 0x83, 0x79, 0xfa, 0x1b, 0x30, 0x99, 0xbb, 0x51, 0xd7, 0xb3, 0x79, 0x0b, 0xae, 0x8e, 0xb1, 0xf6, + 0x5b, 0x4a, 0xb2, 0x96, 0x3e, 0x98, 0x2e, 0xba, 0x4a, 0x2b, 0xb9, 0x08, 0x05, 0x2c, 0xe3, 0xf6, + 0x9f, 0xb0, 0x92, 0x54, 0x2f, 0xc0, 0x48, 0xfa, 0x14, 0x2d, 0xe6, 0x9c, 0x53, 0xa8, 0xb1, 0x72, + 0x19, 0x9a, 0x84, 0xbc, 0x0f, 0x86, 0xc4, 0x31, 0x98, 0xcd, 0xb1, 0xb9, 0xd9, 0x58, 0x2a, 0x34, + 0xa7, 0xbd, 0xc5, 0xd6, 0xe5, 0xbd, 0xb9, 0xb9, 0xc0, 0x3b, 0xbd, 0x16, 0xa2, 0x9c, 0xd4, 0x4a, + 0x14, 0x94, 0xd3, 0x47, 0x8b, 0xca, 0xc9, 0x8f, 0xaa, 0xbe, 0x03, 0x46, 0x33, 0x63, 0x9a, 0x57, + 0x90, 0x86, 0x8d, 0x1b, 0x97, 0xc2, 0xbd, 0xa8, 0xf5, 0xed, 0x93, 0x33, 0x53, 0x3b, 0x3d, 0x33, + 0xb5, 0x1f, 0x67, 0xa6, 0xf6, 0xf1, 0xdc, 0x2c, 0x9d, 0x9e, 0x9b, 0xa5, 0xef, 0xe7, 0x66, 0xe9, + 0xd5, 0x9a, 0xe7, 0xc7, 0x7b, 0xed, 0xa6, 0xe5, 0xd2, 0xc0, 0xde, 0xc1, 0x28, 0xb8, 0xf3, 0x44, + 0x7e, 0x30, 0x5d, 0x1a, 0x61, 0xfb, 0xa8, 0xf7, 0xad, 0x3e, 0x0e, 0x31, 0x6b, 0x96, 0xc5, 0x77, + 0xf3, 0xde, 0xaf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x8c, 0x2c, 0x49, 0xaf, 0xc8, 0x07, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -673,6 +772,8 @@ type MsgClient interface { // cases rpc ForceTransfer(MsgForceTransfer) returns // (MsgForceTransferResponse); ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts ...grpc.CallOption) (*MsgChangeAdminResponse, error) + // UpdateParams sets new module params + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -737,6 +838,15 @@ func (c *msgClient) ChangeAdmin(ctx context.Context, in *MsgChangeAdmin, opts .. return out, nil } +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/kujira.denom.Msg/UpdateParams", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { AddNoFeeAccounts(context.Context, *MsgAddNoFeeAccounts) (*MsgAddNoFeeAccountsResponse, error) @@ -748,6 +858,8 @@ type MsgServer interface { // cases rpc ForceTransfer(MsgForceTransfer) returns // (MsgForceTransferResponse); ChangeAdmin(context.Context, *MsgChangeAdmin) (*MsgChangeAdminResponse, error) + // UpdateParams sets new module params + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -772,6 +884,9 @@ func (*UnimplementedMsgServer) Burn(ctx context.Context, req *MsgBurn) (*MsgBurn func (*UnimplementedMsgServer) ChangeAdmin(ctx context.Context, req *MsgChangeAdmin) (*MsgChangeAdminResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method ChangeAdmin not implemented") } +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -885,6 +1000,24 @@ func _Msg_ChangeAdmin_Handler(srv interface{}, ctx context.Context, dec func(int return interceptor(ctx, in, info, handler) } +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: "/kujira.denom.Msg/UpdateParams", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "kujira.denom.Msg", HandlerType: (*MsgServer)(nil), @@ -913,6 +1046,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "ChangeAdmin", Handler: _Msg_ChangeAdmin_Handler, }, + { + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "kujira/denom/tx.proto", @@ -1309,6 +1446,71 @@ func (m *MsgChangeAdminResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) 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 + if m.Params != nil { + { + 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 @@ -1488,6 +1690,32 @@ func (m *MsgChangeAdminResponse) 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)) + } + if m.Params != nil { + 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 } @@ -2576,6 +2804,174 @@ func (m *MsgChangeAdminResponse) 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 m.Params == nil { + m.Params = &Params{} + } + 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/denom/wasm/interface_msg.go b/x/denom/wasm/interface_msg.go index 75bc734c..ad4820d9 100644 --- a/x/denom/wasm/interface_msg.go +++ b/x/denom/wasm/interface_msg.go @@ -3,11 +3,15 @@ package wasm import ( "cosmossdk.io/errors" "cosmossdk.io/math" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" denomkeeper "github.com/Team-Kujira/core/x/denom/keeper" denomtypes "github.com/Team-Kujira/core/x/denom/types" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" sdk "github.com/cosmos/cosmos-sdk/types" - bankkeeper "github.com/terra-money/alliance/custom/bank/keeper" + "github.com/cosmos/gogoproto/proto" + + // bankkeeper "github.com/terra-money/alliance/custom/bank/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" ) type DenomMsg struct { @@ -54,18 +58,30 @@ type Burn struct { } // create creates a new token denom -func create(ctx sdk.Context, contractAddr sdk.AccAddress, create *Create, dk denomkeeper.Keeper, bk bankkeeper.Keeper) ([]sdk.Event, [][]byte, error) { - err := PerformCreate(dk, bk, ctx, contractAddr, create) +func create( + ctx sdk.Context, + contractAddr sdk.AccAddress, + create *Create, + dk denomkeeper.Keeper, + bk bankkeeper.Keeper, +) (*denomtypes.MsgCreateDenomResponse, error) { + res, err := PerformCreate(dk, bk, ctx, contractAddr, create) if err != nil { - return nil, nil, errors.Wrap(err, "perform create denom") + return nil, errors.Wrap(err, "perform create denom") } - return nil, nil, nil + return res, nil } // PerformCreate is used with create to create a token denom; validates the msgCreate. -func PerformCreate(f denomkeeper.Keeper, _ bankkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, create *Create) error { +func PerformCreate( + f denomkeeper.Keeper, + _ bankkeeper.Keeper, + ctx sdk.Context, + contractAddr sdk.AccAddress, + create *Create, +) (*denomtypes.MsgCreateDenomResponse, error) { if create == nil { - return wasmvmtypes.InvalidRequest{Err: "create denom null create denom"} + return nil, wasmvmtypes.InvalidRequest{Err: "create denom null create denom"} } msgServer := denomkeeper.NewMsgServerImpl(f) @@ -73,130 +89,185 @@ func PerformCreate(f denomkeeper.Keeper, _ bankkeeper.Keeper, ctx sdk.Context, c msgCreate := denomtypes.NewMsgCreateDenom(contractAddr.String(), create.Subdenom) if err := msgCreate.ValidateBasic(); err != nil { - return errors.Wrap(err, "failed validating MsgCreate") + return nil, errors.Wrap(err, "failed validating MsgCreate") } // Create denom - _, err := msgServer.CreateDenom( - sdk.WrapSDKContext(ctx), + res, err := msgServer.CreateDenom( + ctx, msgCreate, ) if err != nil { - return errors.Wrap(err, "creating denom") + return nil, errors.Wrap(err, "creating denom") } - return nil + return res, nil } // mint mints tokens of a specified denom to an address. -func mint(ctx sdk.Context, contractAddr sdk.AccAddress, mint *Mint, dk denomkeeper.Keeper, bk bankkeeper.Keeper) ([]sdk.Event, [][]byte, error) { - err := PerformMint(dk, bk, ctx, contractAddr, mint) +func mint( + ctx sdk.Context, + contractAddr sdk.AccAddress, + mint *Mint, + dk denomkeeper.Keeper, + bk bankkeeper.Keeper, +) (*denomtypes.MsgMintResponse, error) { + res, err := PerformMint(dk, bk, ctx, contractAddr, mint) if err != nil { - return nil, nil, errors.Wrap(err, "perform mint") + return nil, errors.Wrap(err, "perform mint") } - return nil, nil, nil + return res, nil } // PerformMint used with mint to validate the mint message and mint through token factory. -func PerformMint(f denomkeeper.Keeper, _ bankkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, mint *Mint) error { +func PerformMint( + f denomkeeper.Keeper, + _ bankkeeper.Keeper, + ctx sdk.Context, + contractAddr sdk.AccAddress, + mint *Mint, +) (*denomtypes.MsgMintResponse, error) { if mint == nil { - return wasmvmtypes.InvalidRequest{Err: "mint token null mint"} + return nil, wasmvmtypes.InvalidRequest{Err: "mint token null mint"} } _, err := parseAddress(mint.Recipient) if err != nil { - return err + return nil, err } coin := sdk.Coin{Denom: mint.Denom, Amount: mint.Amount} sdkMsg := denomtypes.NewMsgMint(contractAddr.String(), coin, mint.Recipient) if err = sdkMsg.ValidateBasic(); err != nil { - return err + return nil, err } // Mint through token factory / message server msgServer := denomkeeper.NewMsgServerImpl(f) - _, err = msgServer.Mint(sdk.WrapSDKContext(ctx), sdkMsg) + res, err := msgServer.Mint(ctx, sdkMsg) if err != nil { - return errors.Wrap(err, "minting coins from message") + return nil, errors.Wrap(err, "minting coins from message") } - return nil + return res, nil } // changeAdmin changes the admin. -func changeAdmin(ctx sdk.Context, contractAddr sdk.AccAddress, changeAdmin *ChangeAdmin, dk denomkeeper.Keeper) ([]sdk.Event, [][]byte, error) { - err := PerformChangeAdmin(dk, ctx, contractAddr, changeAdmin) +func changeAdmin( + ctx sdk.Context, + contractAddr sdk.AccAddress, + changeAdmin *ChangeAdmin, + dk denomkeeper.Keeper, +) (*denomtypes.MsgChangeAdminResponse, error) { + res, err := PerformChangeAdmin(dk, ctx, contractAddr, changeAdmin) if err != nil { - return nil, nil, errors.Wrap(err, "failed to change admin") + return nil, errors.Wrap(err, "failed to change admin") } - return nil, nil, nil + return res, nil } // ChangeAdmin is used with changeAdmin to validate changeAdmin messages and to dispatch. -func PerformChangeAdmin(f denomkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, changeAdmin *ChangeAdmin) error { +func PerformChangeAdmin( + f denomkeeper.Keeper, + ctx sdk.Context, + contractAddr sdk.AccAddress, + changeAdmin *ChangeAdmin, +) (*denomtypes.MsgChangeAdminResponse, error) { if changeAdmin == nil { - return wasmvmtypes.InvalidRequest{Err: "changeAdmin is nil"} + return nil, wasmvmtypes.InvalidRequest{Err: "changeAdmin is nil"} } newAdminAddr, err := parseAddress(changeAdmin.Address) if err != nil { - return err + return nil, err } changeAdminMsg := denomtypes.NewMsgChangeAdmin(contractAddr.String(), changeAdmin.Denom, newAdminAddr.String()) if err := changeAdminMsg.ValidateBasic(); err != nil { - return err + return nil, err } msgServer := denomkeeper.NewMsgServerImpl(f) - _, err = msgServer.ChangeAdmin(sdk.WrapSDKContext(ctx), changeAdminMsg) + res, err := msgServer.ChangeAdmin(ctx, changeAdminMsg) if err != nil { - return errors.Wrap(err, "failed changing admin from message") + return nil, errors.Wrap(err, "failed changing admin from message") } - return nil + return res, nil } // burn burns tokens. -func burn(ctx sdk.Context, contractAddr sdk.AccAddress, burn *Burn, dk denomkeeper.Keeper) ([]sdk.Event, [][]byte, error) { - err := PerformBurn(dk, ctx, contractAddr, burn) +func burn( + ctx sdk.Context, + contractAddr sdk.AccAddress, + burn *Burn, + dk denomkeeper.Keeper, +) (*denomtypes.MsgBurnResponse, error) { + res, err := PerformBurn(dk, ctx, contractAddr, burn) if err != nil { - return nil, nil, errors.Wrap(err, "perform burn") + return nil, errors.Wrap(err, "perform burn") } - return nil, nil, nil + + return res, nil } // PerformBurn performs token burning after validating tokenBurn message. -func PerformBurn(f denomkeeper.Keeper, ctx sdk.Context, contractAddr sdk.AccAddress, burn *Burn) error { +func PerformBurn( + f denomkeeper.Keeper, + ctx sdk.Context, + contractAddr sdk.AccAddress, + burn *Burn, +) (*denomtypes.MsgBurnResponse, error) { if burn == nil { - return wasmvmtypes.InvalidRequest{Err: "burn token null mint"} + return nil, wasmvmtypes.InvalidRequest{Err: "burn token null mint"} } coin := sdk.Coin{Denom: burn.Denom, Amount: burn.Amount} sdkMsg := denomtypes.NewMsgBurn(contractAddr.String(), coin) if err := sdkMsg.ValidateBasic(); err != nil { - return err + return nil, err } // Burn through token factory / message server msgServer := denomkeeper.NewMsgServerImpl(f) - _, err := msgServer.Burn(sdk.WrapSDKContext(ctx), sdkMsg) + res, err := msgServer.Burn(ctx, sdkMsg) if err != nil { - return errors.Wrap(err, "burning coins from message") + return nil, errors.Wrap(err, "burning coins from message") } - return nil + + return res, nil } // QueryCustom implements custom query interface -func HandleMsg(dk denomkeeper.Keeper, bk bankkeeper.Keeper, contractAddr sdk.AccAddress, ctx sdk.Context, q *DenomMsg) ([]sdk.Event, [][]byte, error) { +func HandleMsg( + dk denomkeeper.Keeper, + bk bankkeeper.Keeper, + contractAddr sdk.AccAddress, + ctx sdk.Context, + q *DenomMsg, +) ([]sdk.Event, [][]byte, [][]*codectypes.Any, error) { + var res proto.Message + var err error + if q.Create != nil { - return create(ctx, contractAddr, q.Create, dk, bk) + res, err = create(ctx, contractAddr, q.Create, dk, bk) } if q.Mint != nil { - return mint(ctx, contractAddr, q.Mint, dk, bk) + res, err = mint(ctx, contractAddr, q.Mint, dk, bk) } if q.ChangeAdmin != nil { - return changeAdmin(ctx, contractAddr, q.ChangeAdmin, dk) + res, err = changeAdmin(ctx, contractAddr, q.ChangeAdmin, dk) } if q.Burn != nil { - return burn(ctx, contractAddr, q.Burn, dk) + res, err = burn(ctx, contractAddr, q.Burn, dk) + } + if err != nil { + return nil, nil, nil, err + } + if res == nil { + return nil, nil, nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown Custom variant"} + } + + x, err := codectypes.NewAnyWithValue(res) + if err != nil { + return nil, nil, nil, err } + msgResponses := [][]*codectypes.Any{{x}} - return nil, nil, wasmvmtypes.UnsupportedRequest{Kind: "unknown Custom variant"} + return nil, nil, msgResponses, err } diff --git a/x/denom/wasm/interface_query.go b/x/denom/wasm/interface_query.go index 96ab85b1..ae2c380a 100644 --- a/x/denom/wasm/interface_query.go +++ b/x/denom/wasm/interface_query.go @@ -4,7 +4,7 @@ import ( "fmt" "cosmossdk.io/errors" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/Team-Kujira/core/x/denom/keeper" diff --git a/x/oracle/abci.go b/x/oracle/abci.go deleted file mode 100644 index 233dcb04..00000000 --- a/x/oracle/abci.go +++ /dev/null @@ -1,136 +0,0 @@ -package oracle - -import ( - "time" - - "github.com/Team-Kujira/core/x/oracle/keeper" - "github.com/Team-Kujira/core/x/oracle/types" - - "github.com/cosmos/cosmos-sdk/telemetry" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// EndBlocker is called at the end of every block -func EndBlocker(ctx sdk.Context, k keeper.Keeper) error { - defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) - params := k.GetParams(ctx) - if IsPeriodLastBlock(ctx, params.VotePeriod) { - // Build claim map over all validators in active set - validatorClaimMap := make(map[string]types.Claim) - - maxValidators := k.StakingKeeper.MaxValidators(ctx) - iterator := k.StakingKeeper.ValidatorsPowerStoreIterator(ctx) - defer iterator.Close() - - powerReduction := k.StakingKeeper.PowerReduction(ctx) - - i := 0 - for ; iterator.Valid() && i < int(maxValidators); iterator.Next() { - validator := k.StakingKeeper.Validator(ctx, iterator.Value()) - - // Exclude not bonded validator - if validator.IsBonded() { - valAddr := validator.GetOperator() - validatorClaimMap[valAddr.String()] = types.NewClaim(validator.GetConsensusPower(powerReduction), 0, 0, valAddr) - i++ - } - } - - // voteTargets defines the symbol (ticker) denoms that we require votes on - var voteTargets []string - for _, v := range params.Whitelist { - voteTargets = append(voteTargets, v.Name) - } - - // Clear all exchange rates - k.IterateExchangeRates(ctx, func(denom string, _ sdk.Dec) (stop bool) { - k.DeleteExchangeRate(ctx, denom) - return false - }) - - // Organize votes to ballot by denom - voteMap := k.OrganizeBallotByDenom(ctx, validatorClaimMap) - - // Keep track, if a voter submitted a price deviating too much - missMap := map[string]sdk.ValAddress{} - - // Iterate through ballots and update exchange rates; drop if not enough votes have been achieved. - for denom, ballot := range voteMap { - totalBondedPower := sdk.TokensToConsensusPower(k.StakingKeeper.TotalBondedTokens(ctx), k.StakingKeeper.PowerReduction(ctx)) - voteThreshold := k.VoteThreshold(ctx) - thresholdVotes := voteThreshold.MulInt64(totalBondedPower).RoundInt() - ballotPower := sdk.NewInt(ballot.Power()) - - if !ballotPower.IsZero() && ballotPower.GTE(thresholdVotes) { - exchangeRate, err := Tally( - ctx, ballot, params.RewardBand, validatorClaimMap, missMap, - ) - if err != nil { - return err - } - - // Set the exchange rate, emit ABCI event - k.SetExchangeRateWithEvent(ctx, denom, exchangeRate) - } - } - - //--------------------------- - // Do miss counting & slashing - denomMap := map[string]map[string]struct{}{} - - for _, denom := range voteTargets { - denomMap[denom] = map[string]struct{}{} - } - - for denom, votes := range voteMap { - for _, vote := range votes { - // ignore denoms, not requested in voteTargets - _, ok := denomMap[denom] - if !ok { - continue - } - - denomMap[denom][vote.Voter.String()] = struct{}{} - } - } - - // Check if each validator is missing a required denom price - for _, claim := range validatorClaimMap { - for _, denom := range voteTargets { - _, ok := denomMap[denom][claim.Recipient.String()] - if !ok { - missMap[claim.Recipient.String()] = claim.Recipient - break - } - } - } - - for _, valAddr := range missMap { - k.SetMissCounter(ctx, valAddr, k.GetMissCounter(ctx, valAddr)+1) - } - - // // Distribute rewards to ballot winners - // k.RewardBallotWinners( - // ctx, - // (int64)(params.VotePeriod), - // (int64)(params.RewardDistributionWindow), - // voteTargets, - // validatorClaimMap, - // ) - - // Clear the ballot - k.ClearBallots(ctx, params.VotePeriod) - } - - // Do slash who did miss voting over threshold and - // reset miss counters of all validators at the last block of slash window - if IsPeriodLastBlock(ctx, params.SlashWindow) { - k.SlashAndResetMissCounters(ctx) - } - - return nil -} - -func IsPeriodLastBlock(ctx sdk.Context, blocksPerPeriod uint64) bool { - return (uint64(ctx.BlockHeight())+1)%blocksPerPeriod == 0 -} diff --git a/x/oracle/abci/compress.go b/x/oracle/abci/compress.go new file mode 100644 index 00000000..738b4ca9 --- /dev/null +++ b/x/oracle/abci/compress.go @@ -0,0 +1,75 @@ +package abci + +import ( + "math/big" + + "cosmossdk.io/math" + "github.com/Team-Kujira/core/x/oracle/keeper" + "github.com/Team-Kujira/core/x/oracle/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +func CompressDecimal(dec math.LegacyDec, desiredValidDigit int64) []byte { + validDigits := int64(0) + newAmount := dec + for !newAmount.IsZero() { + newAmount = newAmount.QuoInt64(10) + validDigits++ + } + cuttingDigits := validDigits - desiredValidDigit + if cuttingDigits < 0 { + cuttingDigits = 0 + } + cutAmount := dec.Quo(math.LegacyNewDec(10).Power(uint64(cuttingDigits))) + return append(cutAmount.BigInt().Bytes(), byte(cuttingDigits)) +} + +func DecompressDecimal(bz []byte) math.LegacyDec { + if len(bz) == 0 { + return math.LegacyZeroDec() + } + cuttingDigits := int(bz[len(bz)-1]) + amountInt := new(big.Int).SetBytes(bz[:len(bz)-1]) + amountDec := math.LegacyNewDecFromBigIntWithPrec(amountInt, math.LegacyPrecision) + amountDec = amountDec.Mul(math.LegacyNewDec(10).Power(uint64(cuttingDigits))) + return amountDec +} + +func ComposeVoteExtension(k keeper.Keeper, ctx sdk.Context, height int64, exchangeRates sdk.DecCoins) types.VoteExtension { + params := k.GetParams(ctx) + symbolIDs := make(map[string]uint32) + for _, symbol := range params.RequiredSymbols { + symbolIDs[symbol.Symbol] = symbol.Id + } + prices := make(map[uint32][]byte) + for _, rate := range exchangeRates { + id, ok := symbolIDs[rate.Denom] + if !ok { + continue + } + prices[id] = CompressDecimal(rate.Amount, 8) + } + return types.VoteExtension{ + Height: height, + Prices: prices, + } +} + +func ExchangeRatesFromVoteExtension(k keeper.Keeper, ctx sdk.Context, voteExt types.VoteExtension) sdk.DecCoins { + params := k.GetParams(ctx) + idToSymbol := make(map[uint32]string) + for _, symbol := range params.RequiredSymbols { + idToSymbol[symbol.Id] = symbol.Symbol + } + + exchangeRates := sdk.DecCoins{} + for id, priceBytes := range voteExt.Prices { + symbol, ok := idToSymbol[id] + if !ok { + continue + } + + exchangeRates = exchangeRates.Add(sdk.NewDecCoinFromDec(symbol, DecompressDecimal(priceBytes))) + } + return exchangeRates +} diff --git a/x/oracle/abci/compress_test.go b/x/oracle/abci/compress_test.go new file mode 100644 index 00000000..802d7662 --- /dev/null +++ b/x/oracle/abci/compress_test.go @@ -0,0 +1,62 @@ +package abci_test + +import ( + "testing" + + "cosmossdk.io/math" + "github.com/Team-Kujira/core/x/oracle/abci" + "github.com/stretchr/testify/require" +) + +func TestCompressDecimal(t *testing.T) { + // compress 0 decimal + bz := abci.CompressDecimal(math.LegacyZeroDec(), 8) + require.Len(t, bz, 1) + + // compress negative decimal - only abs value's encoded/decoded + bz = abci.CompressDecimal(math.LegacyNewDec(-1), 8) + require.Len(t, bz, 4) + + // compress low number of valid digits decimal + bz = abci.CompressDecimal(math.LegacyNewDecWithPrec(123, 18), 8) + require.Len(t, bz, 2) + + // compress high number of valid digits decimal + bz = abci.CompressDecimal(math.LegacyNewDecWithPrec(123456123456, 18), 8) + require.Len(t, bz, 4) + + // compress big number + bz = abci.CompressDecimal(math.LegacyNewDec(123456123456123456), 8) + require.Len(t, bz, 4) +} + +func TestDecompressDecimal(t *testing.T) { + // empty bytes + decoded := abci.DecompressDecimal([]byte{}) + require.Equal(t, decoded, math.LegacyZeroDec()) + + // decompress 0 decimal bytes + bz := abci.CompressDecimal(math.LegacyZeroDec(), 8) + decoded = abci.DecompressDecimal(bz) + require.Equal(t, decoded, math.LegacyZeroDec()) + + // decompress negative decimal bytes - only abs value's encoded/decoded + bz = abci.CompressDecimal(math.LegacyNewDec(-1), 8) + decoded = abci.DecompressDecimal(bz) + require.Equal(t, decoded, math.LegacyNewDec(1)) + + // decompress low number of valid digits decimal bytes + bz = abci.CompressDecimal(math.LegacyNewDecWithPrec(123, 18), 8) + decoded = abci.DecompressDecimal(bz) + require.Equal(t, decoded, math.LegacyNewDecWithPrec(123, 18)) + + // decompress high number of valid digits decimal bytes + bz = abci.CompressDecimal(math.LegacyNewDecWithPrec(123456123456, 18), 8) + decoded = abci.DecompressDecimal(bz) + require.Equal(t, decoded, math.LegacyNewDecWithPrec(123456120000, 18)) + + // decompress big number bytes + bz = abci.CompressDecimal(math.LegacyNewDec(123456123456123456), 8) + decoded = abci.DecompressDecimal(bz) + require.Equal(t, decoded, math.LegacyNewDec(123456120000000000)) +} diff --git a/x/oracle/abci/config.go b/x/oracle/abci/config.go new file mode 100644 index 00000000..0e6fa7e3 --- /dev/null +++ b/x/oracle/abci/config.go @@ -0,0 +1,27 @@ +package abci + +import ( + servertypes "github.com/cosmos/cosmos-sdk/server/types" + "github.com/spf13/cast" +) + +type OracleConfig struct { + Endpoint string `mapstructure:"endpoint"` +} + +const ( + flagOracleEndpoint = "oracle.endpoint" +) + +// ReadOracleConfig reads the wasm specifig configuration +func ReadOracleConfig(opts servertypes.AppOptions) (OracleConfig, error) { + cfg := OracleConfig{} + var err error + if v := opts.Get(flagOracleEndpoint); v != nil { + if cfg.Endpoint, err = cast.ToStringE(v); err != nil { + return cfg, err + } + } + + return cfg, nil +} diff --git a/x/oracle/abci/proposal.go b/x/oracle/abci/proposal.go new file mode 100644 index 00000000..6a43a275 --- /dev/null +++ b/x/oracle/abci/proposal.go @@ -0,0 +1,400 @@ +package abci + +import ( + "encoding/json" + "errors" + "fmt" + "sort" + + "cosmossdk.io/core/appmodule" + "cosmossdk.io/log" + "cosmossdk.io/math" + "github.com/Team-Kujira/core/x/oracle/keeper" + "github.com/Team-Kujira/core/x/oracle/types" + abci "github.com/cometbft/cometbft/abci/types" + "github.com/cosmos/cosmos-sdk/baseapp" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/mempool" + "github.com/cosmos/cosmos-sdk/types/module" +) + +// StakeWeightedPrices defines the structure a proposer should use to calculate +// and submit the stake-weighted prices for a given set of supported currency +// pairs, in addition to the vote extensions used to calculate them. This is so +// validators can verify the proposer's calculations. +type StakeWeightedPrices struct { + StakeWeightedPrices map[string]math.LegacyDec + ExtendedCommitInfo abci.ExtendedCommitInfo + MissCounter map[string]sdk.ValAddress +} + +type ProposalHandler struct { + logger log.Logger + keeper keeper.Keeper + valStore baseapp.ValidatorStore + baseapp.DefaultProposalHandler + ModuleManager *module.Manager +} + +func NewProposalHandler(logger log.Logger, keeper keeper.Keeper, valStore baseapp.ValidatorStore, ModuleManager *module.Manager, mp mempool.Mempool, txVerifier baseapp.ProposalTxVerifier) *ProposalHandler { + return &ProposalHandler{ + logger: logger, + keeper: keeper, + valStore: valStore, + ModuleManager: ModuleManager, + DefaultProposalHandler: *baseapp.NewDefaultProposalHandler(mp, txVerifier), + } +} + +// PrepareProposalHandler returns the implementation for processing an +// ABCI proposal. +// - Default PrepareProposalHandler selects regular txs +// - Appends vote extension tx at the end +func (h *ProposalHandler) PrepareProposal() sdk.PrepareProposalHandler { + return func(ctx sdk.Context, req *abci.RequestPrepareProposal) (*abci.ResponsePrepareProposal, error) { + defaultHandler := h.DefaultProposalHandler.PrepareProposalHandler() + defaultResponse, err := defaultHandler(ctx, req) + if err != nil { + return nil, err + } + + proposalTxs := defaultResponse.Txs + + // Note: Upgrade height should be equal to vote extension enable height + cp := ctx.ConsensusParams() + extsEnabled := cp.Abci != nil && req.Height > cp.Abci.VoteExtensionsEnableHeight && cp.Abci.VoteExtensionsEnableHeight != 0 + if !extsEnabled { + return &abci.ResponsePrepareProposal{ + Txs: proposalTxs, + }, nil + } + + err = baseapp.ValidateVoteExtensions(ctx, h.valStore, req.Height, ctx.ChainID(), req.LocalLastCommit) + if err != nil { + return nil, err + } + + stakeWeightedPrices, missMap, err := h.ComputeStakeWeightedPricesAndMissMap(ctx, req.LocalLastCommit) + if err != nil { + return nil, errors.New("failed to compute stake-weighted oracle prices") + } + + injectedVoteExtTx := StakeWeightedPrices{ + StakeWeightedPrices: stakeWeightedPrices, + ExtendedCommitInfo: req.LocalLastCommit, + MissCounter: missMap, + } + + // Encode vote extension to bytes + bz, err := json.Marshal(injectedVoteExtTx) + if err != nil { + h.logger.Error("failed to encode injected vote extension tx", "err", err) + return nil, errors.New("failed to encode injected vote extension tx") + } + + // Inject vote extension tx into the proposal s.t. validators can decode, verify, + // and store the canonical stake-weighted average prices. + proposalTxs = append(proposalTxs, bz) + return &abci.ResponsePrepareProposal{ + Txs: proposalTxs, + }, nil + } +} + +// ProcessProposalHandler returns the implementation for processing an +// ABCI proposal +// - Validate vote extension tx +// - Validate regular tx with default PrepareProposalHandler +func (h *ProposalHandler) ProcessProposal() sdk.ProcessProposalHandler { + return func(ctx sdk.Context, req *abci.RequestProcessProposal) (*abci.ResponseProcessProposal, error) { + reReq := *req + var injectedVoteExtTx StakeWeightedPrices + if len(req.Txs) > 0 { + lastTx := req.Txs[len(req.Txs)-1] + if err := json.Unmarshal(lastTx, &injectedVoteExtTx); err == nil { + h.logger.Debug("handling injected vote extension tx") + err := baseapp.ValidateVoteExtensions(ctx, h.valStore, req.Height, ctx.ChainID(), injectedVoteExtTx.ExtendedCommitInfo) + if err != nil { + return nil, err + } + + // Verify the proposer's stake-weighted oracle prices & miss counter by computing the same + // calculation and comparing the results. + stakeWeightedPrices, missMap, err := h.ComputeStakeWeightedPricesAndMissMap(ctx, injectedVoteExtTx.ExtendedCommitInfo) + if err != nil { + return nil, errors.New("failed to compute stake-weighted oracle prices") + } + + // compare stakeWeightedPrices + if err := CompareOraclePrices(injectedVoteExtTx.StakeWeightedPrices, stakeWeightedPrices); err != nil { + return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}, nil + } + + // compare missMap + if err := CompareMissMap(injectedVoteExtTx.MissCounter, missMap); err != nil { + return &abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_REJECT}, nil + } + + // Exclude last tx if it's vote extension tx + reReq.Txs = reReq.Txs[:len(reReq.Txs)-1] + } + } + + defaultHandler := h.DefaultProposalHandler.ProcessProposalHandler() + return defaultHandler(ctx, &reReq) + } +} + +// cosmos-sdk/types/module/module.go#L753 +// PreBlock performs begin block functionality for upgrade module. +// It takes the current context as a parameter and returns a boolean value +// indicating whether the migration was successfully executed or not. +func (h *ProposalHandler) PreBlocker(ctx sdk.Context, req *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + ctx = ctx.WithEventManager(sdk.NewEventManager()) + paramsChanged := false + for _, moduleName := range h.ModuleManager.OrderPreBlockers { + if module, ok := h.ModuleManager.Modules[moduleName].(appmodule.HasPreBlocker); ok { + rsp, err := module.PreBlock(ctx) + if err != nil { + return nil, err + } + if rsp.IsConsensusParamsChanged() { + paramsChanged = true + } + } + } + + for _, txBytes := range req.Txs { + var injectedVoteExtTx StakeWeightedPrices + if err := json.Unmarshal(txBytes, &injectedVoteExtTx); err != nil { + h.logger.Debug("Skipping regular tx, not one of our vote", "tx", string(txBytes)) + continue + } + + // Clear all exchange rates + h.keeper.IterateExchangeRates(ctx, func(denom string, _ math.LegacyDec) (stop bool) { + h.keeper.DeleteExchangeRate(ctx, denom) + return false + }) + + for _, valAddr := range injectedVoteExtTx.MissCounter { + h.keeper.SetMissCounter(ctx, valAddr, h.keeper.GetMissCounter(ctx, valAddr)+1) + } + + // set oracle prices using the passed in context, which will make these prices available in the current block + h.keeper.SetOraclePrices(ctx, injectedVoteExtTx.StakeWeightedPrices) + + // Do slash who did miss voting over threshold and + // reset miss counters of all validators at the last block of slash window + params := h.keeper.GetParams(ctx) + if IsPeriodLastBlock(ctx, params.SlashWindow) { + h.keeper.SlashAndResetMissCounters(ctx) + } + } + + return &sdk.ResponsePreBlock{ + ConsensusParamsChanged: paramsChanged, + }, nil +} + +func IsPeriodLastBlock(ctx sdk.Context, blocksPerPeriod uint64) bool { + return (uint64(ctx.BlockHeight())+1)%blocksPerPeriod == 0 +} + +func CompareOraclePrices(p1, p2 map[string]math.LegacyDec) error { + for denom, p := range p1 { + if p2[denom].IsNil() || !p.Equal(p2[denom]) { + return errors.New("oracle prices mismatch") + } + } + + for denom, p := range p2 { + if p1[denom].IsNil() || !p.Equal(p1[denom]) { + return errors.New("oracle prices mismatch") + } + } + + return nil +} + +func CompareMissMap(m1, m2 map[string]sdk.ValAddress) error { + for valAddrStr, valAddr := range m1 { + if _, ok := m2[valAddrStr]; !ok { + return errors.New("oracle missMap mismatch") + } + if valAddr.String() != valAddrStr { + return errors.New("invalid oracle missMap") + } + } + + for valAddrStr, valAddr := range m2 { + if _, ok := m1[valAddrStr]; !ok { + return errors.New("oracle missMap mismatch") + } + if valAddr.String() != valAddrStr { + return errors.New("invalid oracle missMap") + } + } + + return nil +} + +func (h *ProposalHandler) GetBallotByDenom(ctx sdk.Context, ci abci.ExtendedCommitInfo, validatorClaimMap map[string]types.Claim, validatorConsensusAddrMap map[string]sdk.ValAddress) (votes map[string]types.ExchangeRateBallot) { + votes = map[string]types.ExchangeRateBallot{} + + for _, v := range ci.Votes { + valAddr := validatorConsensusAddrMap[sdk.ConsAddress(v.Validator.Address).String()] + claim, ok := validatorClaimMap[valAddr.String()] + if ok { + power := claim.Power + + var voteExt types.VoteExtension + if err := voteExt.Decompress(v.VoteExtension); err != nil { + h.logger.Error("failed to decode vote extension", "err", err, "validator", fmt.Sprintf("%x", v.Validator.Address)) + return votes + } + + exchangeRates := ExchangeRatesFromVoteExtension(h.keeper, ctx, voteExt) + for _, tuple := range exchangeRates { + base := tuple.Denom + price := tuple.Amount + tmpPower := power + if !price.IsPositive() { + // Make the power of abstain vote zero + tmpPower = 0 + } + + votes[base] = append(votes[base], + types.NewVoteForTally( + price, + base, + valAddr, + tmpPower, + ), + ) + } + } + } + + // sort created ballot + for denom, ballot := range votes { + sort.Sort(ballot) + votes[denom] = ballot + } + + return votes +} + +func (h *ProposalHandler) ComputeStakeWeightedPricesAndMissMap(ctx sdk.Context, ci abci.ExtendedCommitInfo) (map[string]math.LegacyDec, map[string]sdk.ValAddress, error) { + params := h.keeper.GetParams(ctx) + + // Build claim map over all validators in active set + stakeWeightedPrices := make(map[string]math.LegacyDec) // base -> average stake-weighted price + validatorClaimMap := make(map[string]types.Claim) + validatorConsensusAddrMap := make(map[string]sdk.ValAddress) + + maxValidators, err := h.keeper.StakingKeeper.MaxValidators(ctx) + if err != nil { + return nil, nil, err + } + iterator, err := h.keeper.StakingKeeper.ValidatorsPowerStoreIterator(ctx) + if err != nil { + return nil, nil, err + } + + defer iterator.Close() + + powerReduction := h.keeper.StakingKeeper.PowerReduction(ctx) + + i := 0 + for ; iterator.Valid() && i < int(maxValidators); iterator.Next() { + validator, err := h.keeper.StakingKeeper.Validator(ctx, iterator.Value()) + if err != nil { + return nil, nil, err + } + + // Exclude not bonded validator + if validator.IsBonded() { + valAddrStr := validator.GetOperator() + valAddr, err := sdk.ValAddressFromBech32(valAddrStr) + if err != nil { + return nil, nil, err + } + + validatorClaimMap[valAddr.String()] = types.NewClaim(validator.GetConsensusPower(powerReduction), 0, 0, valAddr) + + consAddr, err := validator.GetConsAddr() + if err != nil { + return nil, nil, err + } + validatorConsensusAddrMap[sdk.ConsAddress(consAddr).String()] = valAddr + i++ + } + } + + voteMap := h.GetBallotByDenom(ctx, ci, validatorClaimMap, validatorConsensusAddrMap) + + // Keep track, if a voter submitted a price deviating too much + missMap := map[string]sdk.ValAddress{} + + // Iterate through ballots and update exchange rates; drop if not enough votes have been achieved. + for denom, ballot := range voteMap { + bondedTokens, err := h.keeper.StakingKeeper.TotalBondedTokens(ctx) + if err != nil { + return nil, nil, err + } + + totalBondedPower := sdk.TokensToConsensusPower(bondedTokens, h.keeper.StakingKeeper.PowerReduction(ctx)) + voteThreshold := h.keeper.VoteThreshold(ctx) + thresholdVotes := voteThreshold.MulInt64(totalBondedPower).RoundInt() + ballotPower := math.NewInt(ballot.Power()) + + if !ballotPower.IsZero() && ballotPower.GTE(thresholdVotes) { + exchangeRate, err := keeper.Tally( + ctx, ballot, params.MaxDeviation, validatorClaimMap, missMap, + ) + if err != nil { + return nil, nil, err + } + + stakeWeightedPrices[denom] = exchangeRate + } + } + + //--------------------------- + // Do miss counting & slashing + symbolMap := map[string]map[string]struct{}{} + var voteTargets []string + for _, symbol := range params.RequiredSymbols { + voteTargets = append(voteTargets, symbol.Symbol) + } + + for _, symbol := range voteTargets { + symbolMap[symbol] = map[string]struct{}{} + } + + for denom, votes := range voteMap { + for _, vote := range votes { + // ignore denoms, not requested in voteTargets + _, ok := symbolMap[denom] + if !ok { + continue + } + + symbolMap[denom][vote.Voter.String()] = struct{}{} + } + } + + // Check if each validator is missing a required denom price + for _, claim := range validatorClaimMap { + for _, symbol := range voteTargets { + _, ok := symbolMap[symbol][claim.Recipient.String()] + if !ok { + missMap[claim.Recipient.String()] = claim.Recipient + break + } + } + } + + return stakeWeightedPrices, missMap, nil +} diff --git a/x/oracle/abci/proposal_test.go b/x/oracle/abci/proposal_test.go new file mode 100644 index 00000000..1e1cfddf --- /dev/null +++ b/x/oracle/abci/proposal_test.go @@ -0,0 +1,978 @@ +package abci_test + +import ( + "bytes" + "encoding/json" + "fmt" + "sort" + "testing" + "time" + + "cosmossdk.io/core/comet" + "cosmossdk.io/core/header" + "cosmossdk.io/math" + "github.com/stretchr/testify/require" + + "github.com/Team-Kujira/core/x/oracle/types" + + "github.com/Team-Kujira/core/x/oracle/abci" + "github.com/Team-Kujira/core/x/oracle/keeper" + cometabci "github.com/cometbft/cometbft/abci/types" + cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + protoio "github.com/cosmos/gogoproto/io" + "github.com/cosmos/gogoproto/proto" +) + +var ( + ValAddrs = keeper.ValAddrs + ValPubKeys []cryptotypes.PubKey + ValPrivKeys []*ed25519.PrivKey +) + +func init() { + for i := 0; i < 5; i++ { + privKey := ed25519.GenPrivKey() + ValPrivKeys = append(ValPrivKeys, privKey) + pubKey := &ed25519.PubKey{Key: privKey.PubKey().Bytes()} + ValPubKeys = append(ValPubKeys, pubKey) + } +} + +func SetupTest(t *testing.T) (keeper.TestInput, *abci.ProposalHandler) { + input := keeper.CreateTestInput(t) + + power := int64(100) + amt := sdk.TokensFromConsensusPower(power, sdk.DefaultPowerReduction) + sh := stakingkeeper.NewMsgServerImpl(&input.StakingKeeper) + ctx := input.Ctx + mm := module.NewManager() + + // Validator created + _, err := sh.CreateValidator(ctx, keeper.NewTestMsgCreateValidator(ValAddrs[0], ValPubKeys[0], amt)) + require.NoError(t, err) + _, err = sh.CreateValidator(ctx, keeper.NewTestMsgCreateValidator(ValAddrs[1], ValPubKeys[1], amt)) + require.NoError(t, err) + _, err = sh.CreateValidator(ctx, keeper.NewTestMsgCreateValidator(ValAddrs[2], ValPubKeys[2], amt)) + require.NoError(t, err) + input.StakingKeeper.EndBlocker(ctx) + + h := abci.NewProposalHandler( + input.Ctx.Logger(), + input.OracleKeeper, + input.StakingKeeper, + mm, // module manager + nil, // mempool + nil, // bApp + ) + + params := types.DefaultParams() + params.RequiredSymbols = []types.Symbol{ + {Symbol: "BTC", Id: 1}, + {Symbol: "ETH", Id: 2}, + } + input.OracleKeeper.SetParams(ctx, params) + + return input, h +} + +func TestGetBallotByDenom(t *testing.T) { + input, h := SetupTest(t) + power := int64(100) + + // organize votes by denom + voteExt1 := types.VoteExtension{ + Height: 1, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyNewDec(25000), 8), + 2: abci.CompressDecimal(math.LegacyNewDec(2200), 8), + }, + } + voteExt2 := types.VoteExtension{ + Height: 1, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyNewDec(25030), 8), + 2: abci.CompressDecimal(math.LegacyNewDec(2180), 8), + }, + } + voteExt1Bytes, err := voteExt1.Compress() + require.NoError(t, err) + voteExt2Bytes, err := voteExt2.Compress() + require.NoError(t, err) + + consAddrMap := map[string]sdk.ValAddress{ + sdk.ConsAddress(ValPubKeys[0].Address().Bytes()).String(): ValAddrs[0], + sdk.ConsAddress(ValPubKeys[1].Address().Bytes()).String(): ValAddrs[1], + sdk.ConsAddress(ValPubKeys[2].Address().Bytes()).String(): ValAddrs[2], + } + + ballotMap := h.GetBallotByDenom(input.Ctx, cometabci.ExtendedCommitInfo{ + Votes: []cometabci.ExtendedVoteInfo{ + { + Validator: cometabci.Validator{ + Address: ValPubKeys[0].Address().Bytes(), + }, + VoteExtension: voteExt1Bytes, + }, + { + Validator: cometabci.Validator{ + Address: ValPubKeys[1].Address().Bytes(), + }, + VoteExtension: voteExt2Bytes, + }, + }, + }, map[string]types.Claim{ + ValAddrs[0].String(): { + Power: power, + WinCount: 0, + Recipient: ValAddrs[0], + }, + ValAddrs[1].String(): { + Power: power, + WinCount: 0, + Recipient: ValAddrs[1], + }, + ValAddrs[2].String(): { + Power: power, + WinCount: 0, + Recipient: ValAddrs[2], + }, + }, consAddrMap) + + ethBallot := types.ExchangeRateBallot{ + types.NewVoteForTally(math.LegacyNewDec(2200), "ETH", ValAddrs[0], power), + types.NewVoteForTally(math.LegacyNewDec(2180), "ETH", ValAddrs[1], power), + } + btcBallot := types.ExchangeRateBallot{ + types.NewVoteForTally(math.LegacyNewDec(25000), "BTC", ValAddrs[0], power), + types.NewVoteForTally(math.LegacyNewDec(25030), "BTC", ValAddrs[1], power), + } + sort.Sort(ethBallot) + sort.Sort(btcBallot) + sort.Sort(ballotMap["ETH"]) + sort.Sort(ballotMap["BTC"]) + + require.Equal(t, ethBallot, ballotMap["ETH"]) + require.Equal(t, btcBallot, ballotMap["BTC"]) +} + +func TestComputeStakeWeightedPricesAndMissMap(t *testing.T) { + input, h := SetupTest(t) + + // organize votes by denom + voteExt1 := types.VoteExtension{ + Height: 1, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyNewDec(25000), 8), + 2: abci.CompressDecimal(math.LegacyNewDec(2200), 8), + }, + } + voteExt2 := types.VoteExtension{ + Height: 1, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyNewDec(25030), 8), + 2: abci.CompressDecimal(math.LegacyNewDec(2180), 8), + }, + } + voteExt1Bytes, err := voteExt1.Compress() + require.NoError(t, err) + voteExt2Bytes, err := voteExt2.Compress() + require.NoError(t, err) + + params := types.DefaultParams() + params.RequiredSymbols = []types.Symbol{ + {Symbol: "BTC", Id: 1}, + {Symbol: "ETH", Id: 2}, + } + input.OracleKeeper.SetParams(input.Ctx, params) + + stakeWeightedPrices, missMap, err := h.ComputeStakeWeightedPricesAndMissMap(input.Ctx, cometabci.ExtendedCommitInfo{ + Votes: []cometabci.ExtendedVoteInfo{ + { + Validator: cometabci.Validator{ + Address: ValPubKeys[0].Address().Bytes(), + Power: 1, + }, + VoteExtension: voteExt1Bytes, + }, + { + Validator: cometabci.Validator{ + Address: ValPubKeys[1].Address().Bytes(), + Power: 1, + }, + VoteExtension: voteExt2Bytes, + }, + }, + }) + require.NoError(t, err) + require.Equal(t, math.LegacyNewDec(2180).String(), stakeWeightedPrices["ETH"].String()) + require.Equal(t, math.LegacyNewDec(25000).String(), stakeWeightedPrices["BTC"].String()) + require.Nil(t, missMap[ValAddrs[0].String()]) + require.Nil(t, missMap[ValAddrs[1].String()]) + require.NotNil(t, missMap[ValAddrs[2].String()]) +} + +func TestCompareOraclePrices(t *testing.T) { + testCases := []struct { + p1 map[string]math.LegacyDec + p2 map[string]math.LegacyDec + expEqual bool + }{ + { + p1: map[string]math.LegacyDec{ + "ATOM": math.LegacyNewDec(10), + "ETH": math.LegacyNewDec(2300), + }, + p2: map[string]math.LegacyDec{ + "ATOM": math.LegacyNewDec(10), + "ETH": math.LegacyNewDec(2300), + }, + expEqual: true, + }, + { + p1: map[string]math.LegacyDec{ + "ATOM": math.LegacyNewDec(10), + "ETH": math.LegacyNewDec(2300), + }, + p2: map[string]math.LegacyDec{ + "ATOM": math.LegacyNewDec(10), + "ETH": math.LegacyNewDec(2200), + }, + expEqual: false, + }, + { + p1: map[string]math.LegacyDec{ + "ATOM": math.LegacyNewDec(10), + "ETH": math.LegacyNewDec(2300), + }, + p2: map[string]math.LegacyDec{ + "ATOM": math.LegacyNewDec(10), + "ETH": math.LegacyNewDec(2300), + "BTC": math.LegacyNewDec(43000), + }, + expEqual: false, + }, + { + p1: map[string]math.LegacyDec{ + "ATOM": math.LegacyNewDec(10), + "ETH": math.LegacyNewDec(2300), + "BTC": math.LegacyNewDec(43000), + }, + p2: map[string]math.LegacyDec{ + "ATOM": math.LegacyNewDec(10), + "ETH": math.LegacyNewDec(2300), + }, + expEqual: false, + }, + { + p1: nil, + p2: map[string]math.LegacyDec{ + "ATOM": math.LegacyNewDec(10), + "ETH": math.LegacyNewDec(2300), + }, + expEqual: false, + }, + { + p1: map[string]math.LegacyDec{ + "ATOM": math.LegacyNewDec(10), + "ETH": math.LegacyNewDec(2300), + }, + p2: nil, + expEqual: false, + }, + { + p1: nil, + p2: nil, + expEqual: true, + }, + } + + for i, tc := range testCases { + t.Run(fmt.Sprintf("Case %d", i), func(t *testing.T) { + err := abci.CompareOraclePrices(tc.p1, tc.p2) + if tc.expEqual { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} + +func TestCompareMissMap(t *testing.T) { + testCases := []struct { + m1 map[string]sdk.ValAddress + m2 map[string]sdk.ValAddress + expEqual bool + }{ + { + m1: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + ValAddrs[1].String(): ValAddrs[1], + }, + m2: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + ValAddrs[1].String(): ValAddrs[1], + }, + expEqual: true, + }, + { + m1: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + ValAddrs[1].String(): ValAddrs[1], + }, + m2: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + ValAddrs[2].String(): ValAddrs[2], + }, + expEqual: false, + }, + { + m1: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + ValAddrs[1].String(): ValAddrs[1], + }, + m2: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + ValAddrs[1].String(): ValAddrs[2], + }, + expEqual: false, + }, + { + m1: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + ValAddrs[1].String(): ValAddrs[1], + }, + m2: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + ValAddrs[2].String(): ValAddrs[1], + }, + expEqual: false, + }, + { + m1: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + ValAddrs[1].String(): ValAddrs[1], + }, + m2: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + }, + expEqual: false, + }, + { + m1: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + }, + m2: map[string]sdk.ValAddress{ + ValAddrs[0].String(): ValAddrs[0], + ValAddrs[1].String(): ValAddrs[1], + }, + expEqual: false, + }, + { + m1: map[string]sdk.ValAddress{}, + m2: nil, + expEqual: true, + }, + } + + for i, tc := range testCases { + t.Run(fmt.Sprintf("Case %d", i), func(t *testing.T) { + err := abci.CompareMissMap(tc.m1, tc.m2) + if tc.expEqual { + require.NoError(t, err) + } else { + require.Error(t, err) + } + }) + } +} + +type extendedVoteInfos []cometabci.ExtendedVoteInfo + +func (v extendedVoteInfos) Len() int { + return len(v) +} + +func (v extendedVoteInfos) Less(i, j int) bool { + if v[i].Validator.Power == v[j].Validator.Power { + return bytes.Compare(v[i].Validator.Address, v[j].Validator.Address) == -1 + } + return v[i].Validator.Power > v[j].Validator.Power +} + +func (v extendedVoteInfos) Swap(i, j int) { + v[i], v[j] = v[j], v[i] +} + +func extendedCommitToLastCommit(ec cometabci.ExtendedCommitInfo) (cometabci.ExtendedCommitInfo, comet.BlockInfo) { + // sort the extended commit info + sort.Sort(extendedVoteInfos(ec.Votes)) + + // convert the extended commit info to last commit info + lastCommit := cometabci.CommitInfo{ + Round: ec.Round, + Votes: make([]cometabci.VoteInfo, len(ec.Votes)), + } + + for i, vote := range ec.Votes { + lastCommit.Votes[i] = cometabci.VoteInfo{ + Validator: cometabci.Validator{ + Address: vote.Validator.Address, + Power: vote.Validator.Power, + }, + } + } + + return ec, baseapp.NewBlockInfo( + nil, + nil, + nil, + lastCommit, + ) +} + +func TestPrepareProposal(t *testing.T) { + input, h := SetupTest(t) + + params := types.DefaultParams() + params.RequiredSymbols = []types.Symbol{ + {Symbol: "BTC", Id: 1}, + {Symbol: "ETH", Id: 2}, + } + input.OracleKeeper.SetParams(input.Ctx, params) + + handler := h.PrepareProposal() + + consParams := input.Ctx.ConsensusParams() + consParams.Abci = &cmtproto.ABCIParams{ + VoteExtensionsEnableHeight: 1, + } + input.Ctx = input.Ctx.WithConsensusParams(consParams) + _, info := extendedCommitToLastCommit(cometabci.ExtendedCommitInfo{}) + input.Ctx = input.Ctx.WithCometInfo(info) + input.Ctx = input.Ctx.WithHeaderInfo(header.Info{ + ChainID: input.Ctx.ChainID(), + Height: 1, + }) + + // Handler before vote extension enable + res, err := handler(input.Ctx, &cometabci.RequestPrepareProposal{ + Height: 1, + Txs: [][]byte{}, + LocalLastCommit: cometabci.ExtendedCommitInfo{}, + }) + require.NoError(t, err) + require.Len(t, res.Txs, 0) + + // Invalid vote extension data + invalidLocalLastCommit := cometabci.ExtendedCommitInfo{ + Votes: []cometabci.ExtendedVoteInfo{ + { + Validator: cometabci.Validator{ + Address: ValPubKeys[0].Address().Bytes(), + Power: 1, + }, + VoteExtension: []byte{}, + }, + { + Validator: cometabci.Validator{ + Address: ValPubKeys[1].Address().Bytes(), + Power: 1, + }, + VoteExtension: []byte{}, + }, + }, + } + _, err = handler(input.Ctx, &cometabci.RequestPrepareProposal{ + Height: 2, + Txs: [][]byte{}, + LocalLastCommit: invalidLocalLastCommit, + }) + require.Error(t, err) + + // Valid vote extension data + voteExt1 := types.VoteExtension{ + Height: 1, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyNewDec(25000), 8), + 2: abci.CompressDecimal(math.LegacyNewDec(2200), 8), + }, + } + voteExt2 := types.VoteExtension{ + Height: 1, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyNewDec(25030), 8), + 2: abci.CompressDecimal(math.LegacyNewDec(2180), 8), + }, + } + voteExt1Bytes, err := voteExt1.Compress() + require.NoError(t, err) + voteExt2Bytes, err := voteExt2.Compress() + require.NoError(t, err) + marshalDelimitedFn := func(msg proto.Message) ([]byte, error) { + var buf bytes.Buffer + if err := protoio.NewDelimitedWriter(&buf).WriteMsg(msg); err != nil { + return nil, err + } + + return buf.Bytes(), nil + } + + cve := cmtproto.CanonicalVoteExtension{ + Extension: voteExt1Bytes, + Height: 3 - 1, // the vote extension was signed in the previous height + Round: 1, + ChainId: input.Ctx.ChainID(), + } + + ext1SignBytes, err := marshalDelimitedFn(&cve) + require.NoError(t, err) + + signature1, err := ValPrivKeys[0].Sign(ext1SignBytes) + require.NoError(t, err) + + cve = cmtproto.CanonicalVoteExtension{ + Extension: voteExt2Bytes, + Height: 3 - 1, // the vote extension was signed in the previous height + Round: 1, + ChainId: input.Ctx.ChainID(), + } + + ext2SignBytes, err := marshalDelimitedFn(&cve) + require.NoError(t, err) + + signature2, err := ValPrivKeys[1].Sign(ext2SignBytes) + require.NoError(t, err) + + localLastCommit := cometabci.ExtendedCommitInfo{ + Round: 1, + Votes: []cometabci.ExtendedVoteInfo{ + { + BlockIdFlag: cmtproto.BlockIDFlagCommit, + Validator: cometabci.Validator{ + Address: ValPubKeys[0].Address().Bytes(), + Power: 1, + }, + VoteExtension: voteExt1Bytes, + ExtensionSignature: signature1, + }, + { + BlockIdFlag: cmtproto.BlockIDFlagCommit, + Validator: cometabci.Validator{ + Address: ValPubKeys[1].Address().Bytes(), + Power: 1, + }, + VoteExtension: voteExt2Bytes, + ExtensionSignature: signature2, + }, + }, + } + _, info = extendedCommitToLastCommit(localLastCommit) + input.Ctx = input.Ctx.WithCometInfo(info) + input.Ctx = input.Ctx.WithHeaderInfo(header.Info{ + ChainID: input.Ctx.ChainID(), + Height: 3, + }) + res, err = handler(input.Ctx, &cometabci.RequestPrepareProposal{ + Height: 3, + Txs: [][]byte{}, + LocalLastCommit: localLastCommit, + }) + require.NoError(t, err) + require.Len(t, res.Txs, 1) // Check injectedVoteExtTx + injectedVoteExtTx := abci.StakeWeightedPrices{ + StakeWeightedPrices: map[string]math.LegacyDec{ + "ETH": math.LegacyNewDec(2180), + "BTC": math.LegacyNewDec(25000), + }, + ExtendedCommitInfo: localLastCommit, + MissCounter: map[string]sdk.ValAddress{ + ValAddrs[2].String(): ValAddrs[2], + }, + } + injectedBytes, err := json.Marshal(injectedVoteExtTx) + require.NoError(t, err) + require.Equal(t, string(injectedBytes), string(res.Txs[0])) + + // Threshold check + localLastCommit = cometabci.ExtendedCommitInfo{ + Round: 1, + Votes: []cometabci.ExtendedVoteInfo{ + { + BlockIdFlag: cmtproto.BlockIDFlagCommit, + Validator: cometabci.Validator{ + Address: ValPubKeys[0].Address().Bytes(), + Power: 1, + }, + VoteExtension: voteExt1Bytes, + ExtensionSignature: signature1, + }, + { + BlockIdFlag: cmtproto.BlockIDFlagAbsent, + Validator: cometabci.Validator{ + Address: ValPubKeys[1].Address().Bytes(), + Power: 1, + }, + VoteExtension: []byte{}, + ExtensionSignature: []byte{}, + }, + }, + } + _, err = handler(input.Ctx, &cometabci.RequestPrepareProposal{ + Height: 3, + Txs: [][]byte{}, + LocalLastCommit: localLastCommit, + }) + require.Error(t, err) +} + +func TestProcessProposal(t *testing.T) { + input, h := SetupTest(t) + + handler := h.ProcessProposal() + + consParams := input.Ctx.ConsensusParams() + consParams.Abci = &cmtproto.ABCIParams{ + VoteExtensionsEnableHeight: 2, + } + input.Ctx = input.Ctx.WithConsensusParams(consParams) + _, info := extendedCommitToLastCommit(cometabci.ExtendedCommitInfo{}) + input.Ctx = input.Ctx.WithCometInfo(info) + + // Valid vote extension data + voteExt1 := types.VoteExtension{ + Height: 1, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyNewDec(25000), 8), + 2: abci.CompressDecimal(math.LegacyNewDec(2200), 8), + }, + } + voteExt2 := types.VoteExtension{ + Height: 1, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyNewDec(25030), 8), + 2: abci.CompressDecimal(math.LegacyNewDec(2180), 8), + }, + } + voteExt1Bytes, err := voteExt1.Compress() + require.NoError(t, err) + voteExt2Bytes, err := voteExt2.Compress() + require.NoError(t, err) + marshalDelimitedFn := func(msg proto.Message) ([]byte, error) { + var buf bytes.Buffer + if err := protoio.NewDelimitedWriter(&buf).WriteMsg(msg); err != nil { + return nil, err + } + + return buf.Bytes(), nil + } + + cve := cmtproto.CanonicalVoteExtension{ + Extension: voteExt1Bytes, + Height: 3 - 1, // the vote extension was signed in the previous height + Round: 1, + ChainId: input.Ctx.ChainID(), + } + + ext1SignBytes, err := marshalDelimitedFn(&cve) + require.NoError(t, err) + + signature1, err := ValPrivKeys[0].Sign(ext1SignBytes) + require.NoError(t, err) + + cve = cmtproto.CanonicalVoteExtension{ + Extension: voteExt2Bytes, + Height: 3 - 1, // the vote extension was signed in the previous height + Round: 1, + ChainId: input.Ctx.ChainID(), + } + + ext2SignBytes, err := marshalDelimitedFn(&cve) + require.NoError(t, err) + + signature2, err := ValPrivKeys[1].Sign(ext2SignBytes) + require.NoError(t, err) + + localLastCommit := cometabci.ExtendedCommitInfo{ + Round: 1, + Votes: []cometabci.ExtendedVoteInfo{ + { + BlockIdFlag: cmtproto.BlockIDFlagCommit, + Validator: cometabci.Validator{ + Address: ValPubKeys[0].Address().Bytes(), + Power: 1, + }, + VoteExtension: voteExt1Bytes, + ExtensionSignature: signature1, + }, + { + BlockIdFlag: cmtproto.BlockIDFlagCommit, + Validator: cometabci.Validator{ + Address: ValPubKeys[1].Address().Bytes(), + Power: 1, + }, + VoteExtension: voteExt2Bytes, + ExtensionSignature: signature2, + }, + }, + } + + _, info = extendedCommitToLastCommit(localLastCommit) + input.Ctx = input.Ctx.WithCometInfo(info) + input.Ctx = input.Ctx.WithHeaderInfo(header.Info{ + ChainID: input.Ctx.ChainID(), + Height: 3, + }) + + // Invalid missMap calculation + injectedVoteExtTx := abci.StakeWeightedPrices{ + StakeWeightedPrices: map[string]math.LegacyDec{ + "ETH": math.LegacyNewDec(2180), + "BTC": math.LegacyNewDec(25000), + }, + ExtendedCommitInfo: localLastCommit, + MissCounter: map[string]sdk.ValAddress{ + ValAddrs[1].String(): ValAddrs[1], + }, + } + injectedBytes, err := json.Marshal(injectedVoteExtTx) + require.NoError(t, err) + + res, err := handler(input.Ctx, &cometabci.RequestProcessProposal{ + Txs: [][]byte{injectedBytes}, + ProposedLastCommit: cometabci.CommitInfo{}, + Misbehavior: []cometabci.Misbehavior{}, + Hash: []byte{}, + Height: 3, + Time: time.Time{}, + NextValidatorsHash: []byte{}, + ProposerAddress: []byte{}, + }) + require.NoError(t, err) + require.Equal(t, res.Status, cometabci.ResponseProcessProposal_REJECT) + + // Invalid stake weighted prices calculation + injectedVoteExtTx = abci.StakeWeightedPrices{ + StakeWeightedPrices: map[string]math.LegacyDec{ + "ETH": math.LegacyNewDec(2180), + "BTC": math.LegacyNewDec(25500), + }, + ExtendedCommitInfo: localLastCommit, + MissCounter: map[string]sdk.ValAddress{ + ValAddrs[2].String(): ValAddrs[2], + }, + } + injectedBytes, err = json.Marshal(injectedVoteExtTx) + require.NoError(t, err) + + res, err = handler(input.Ctx, &cometabci.RequestProcessProposal{ + Txs: [][]byte{injectedBytes}, + ProposedLastCommit: cometabci.CommitInfo{}, + Misbehavior: []cometabci.Misbehavior{}, + Hash: []byte{}, + Height: 3, + Time: time.Time{}, + NextValidatorsHash: []byte{}, + ProposerAddress: []byte{}, + }) + require.NoError(t, err) + require.Equal(t, res.Status, cometabci.ResponseProcessProposal_REJECT) + + // Empty txs + res, err = handler(input.Ctx, &cometabci.RequestProcessProposal{ + Txs: [][]byte{}, + ProposedLastCommit: cometabci.CommitInfo{}, + Misbehavior: []cometabci.Misbehavior{}, + Hash: []byte{}, + Height: 3, + Time: time.Time{}, + NextValidatorsHash: []byte{}, + ProposerAddress: []byte{}, + }) + require.NoError(t, err) + require.Equal(t, res.Status, cometabci.ResponseProcessProposal_ACCEPT) + + // Not decode-able last tx + res, err = handler(input.Ctx, &cometabci.RequestProcessProposal{ + Txs: [][]byte{{0x0}}, + ProposedLastCommit: cometabci.CommitInfo{}, + Misbehavior: []cometabci.Misbehavior{}, + Hash: []byte{}, + Height: 3, + Time: time.Time{}, + NextValidatorsHash: []byte{}, + ProposerAddress: []byte{}, + }) + require.NoError(t, err) + require.Equal(t, res.Status, cometabci.ResponseProcessProposal_ACCEPT) + + // Accurate vote extension + injectedVoteExtTx = abci.StakeWeightedPrices{ + StakeWeightedPrices: map[string]math.LegacyDec{ + "ETH": math.LegacyNewDec(2180), + "BTC": math.LegacyNewDec(25000), + }, + ExtendedCommitInfo: localLastCommit, + MissCounter: map[string]sdk.ValAddress{ + ValAddrs[2].String(): ValAddrs[2], + }, + } + injectedBytes, err = json.Marshal(injectedVoteExtTx) + require.NoError(t, err) + + res, err = handler(input.Ctx, &cometabci.RequestProcessProposal{ + Txs: [][]byte{injectedBytes}, + ProposedLastCommit: cometabci.CommitInfo{}, + Misbehavior: []cometabci.Misbehavior{}, + Hash: []byte{}, + Height: 3, + Time: time.Time{}, + NextValidatorsHash: []byte{}, + ProposerAddress: []byte{}, + }) + require.NoError(t, err) + require.Equal(t, res.Status, cometabci.ResponseProcessProposal_ACCEPT) +} + +func TestPreBlocker(t *testing.T) { + input, h := SetupTest(t) + + input.OracleKeeper.SetOraclePrices(input.Ctx, map[string]math.LegacyDec{ + "LTC": math.LegacyNewDec(100), + }) + _, err := input.OracleKeeper.GetExchangeRate(input.Ctx, "LTC") + require.NoError(t, err) + + consParams := input.Ctx.ConsensusParams() + consParams.Abci = &cmtproto.ABCIParams{ + VoteExtensionsEnableHeight: 2, + } + input.Ctx = input.Ctx.WithConsensusParams(consParams) + + // Valid vote extension data + voteExt1 := types.VoteExtension{ + Height: 1, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyNewDec(25000), 8), + 2: abci.CompressDecimal(math.LegacyNewDec(2200), 8), + }, + } + voteExt2 := types.VoteExtension{ + Height: 1, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyNewDec(25030), 8), + 2: abci.CompressDecimal(math.LegacyNewDec(2180), 8), + }, + } + voteExt1Bytes, err := voteExt1.Compress() + require.NoError(t, err) + voteExt2Bytes, err := voteExt2.Compress() + require.NoError(t, err) + marshalDelimitedFn := func(msg proto.Message) ([]byte, error) { + var buf bytes.Buffer + if err := protoio.NewDelimitedWriter(&buf).WriteMsg(msg); err != nil { + return nil, err + } + + return buf.Bytes(), nil + } + + cve := cmtproto.CanonicalVoteExtension{ + Extension: voteExt1Bytes, + Height: 3 - 1, // the vote extension was signed in the previous height + Round: 1, + ChainId: input.Ctx.ChainID(), + } + + ext1SignBytes, err := marshalDelimitedFn(&cve) + require.NoError(t, err) + + signature1, err := ValPrivKeys[0].Sign(ext1SignBytes) + require.NoError(t, err) + + cve = cmtproto.CanonicalVoteExtension{ + Extension: voteExt2Bytes, + Height: 3 - 1, // the vote extension was signed in the previous height + Round: 1, + ChainId: input.Ctx.ChainID(), + } + + ext2SignBytes, err := marshalDelimitedFn(&cve) + require.NoError(t, err) + + signature2, err := ValPrivKeys[1].Sign(ext2SignBytes) + require.NoError(t, err) + + localLastCommit := cometabci.ExtendedCommitInfo{ + Round: 1, + Votes: []cometabci.ExtendedVoteInfo{ + { + BlockIdFlag: cmtproto.BlockIDFlagCommit, + Validator: cometabci.Validator{ + Address: ValPubKeys[0].Address().Bytes(), + Power: 1, + }, + VoteExtension: voteExt1Bytes, + ExtensionSignature: signature1, + }, + { + BlockIdFlag: cmtproto.BlockIDFlagCommit, + Validator: cometabci.Validator{ + Address: ValPubKeys[1].Address().Bytes(), + Power: 1, + }, + VoteExtension: voteExt2Bytes, + ExtensionSignature: signature2, + }, + }, + } + + // Accurate vote extension + injectedVoteExtTx := abci.StakeWeightedPrices{ + StakeWeightedPrices: map[string]math.LegacyDec{ + "ETH": math.LegacyNewDec(2180), + "BTC": math.LegacyNewDec(25000), + }, + ExtendedCommitInfo: localLastCommit, + MissCounter: map[string]sdk.ValAddress{ + ValAddrs[2].String(): ValAddrs[2], + }, + } + injectedBytes, err := json.Marshal(injectedVoteExtTx) + require.NoError(t, err) + + res, err := h.PreBlocker(input.Ctx, &cometabci.RequestFinalizeBlock{ + Txs: [][]byte{injectedBytes}, + DecidedLastCommit: cometabci.CommitInfo{}, + Misbehavior: []cometabci.Misbehavior{}, + Hash: []byte{}, + Height: 3, + Time: time.Time{}, + NextValidatorsHash: []byte{}, + ProposerAddress: []byte{}, + }) + require.NoError(t, err) + require.Equal(t, res.ConsensusParamsChanged, false) + + ethPrice, err := input.OracleKeeper.GetExchangeRate(input.Ctx, "ETH") + require.NoError(t, err) + require.Equal(t, ethPrice.String(), injectedVoteExtTx.StakeWeightedPrices["ETH"].String()) + btcPrice, err := input.OracleKeeper.GetExchangeRate(input.Ctx, "BTC") + require.NoError(t, err) + require.Equal(t, btcPrice.String(), injectedVoteExtTx.StakeWeightedPrices["BTC"].String()) + _, err = input.OracleKeeper.GetExchangeRate(input.Ctx, "LTC") + require.Error(t, err) + + val0MissCount := input.OracleKeeper.GetMissCounter(input.Ctx, ValAddrs[0]) + require.Equal(t, val0MissCount, uint64(0)) + val1MissCount := input.OracleKeeper.GetMissCounter(input.Ctx, ValAddrs[1]) + require.Equal(t, val1MissCount, uint64(0)) + val2MissCount := input.OracleKeeper.GetMissCounter(input.Ctx, ValAddrs[2]) + require.Equal(t, val2MissCount, uint64(1)) +} diff --git a/x/oracle/abci/vote_extensions.go b/x/oracle/abci/vote_extensions.go new file mode 100644 index 00000000..2c522a89 --- /dev/null +++ b/x/oracle/abci/vote_extensions.go @@ -0,0 +1,130 @@ +package abci + +import ( + "encoding/json" + "fmt" + "io" + "net/http" + "time" + + "cosmossdk.io/log" + "cosmossdk.io/math" + "github.com/Team-Kujira/core/x/oracle/keeper" + "github.com/Team-Kujira/core/x/oracle/types" + abci "github.com/cometbft/cometbft/abci/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +type VoteExtHandler struct { + logger log.Logger + currentBlock int64 // current block height + lastPriceSyncTS time.Time // last time we synced prices + + Keeper keeper.Keeper +} + +func NewVoteExtHandler( + logger log.Logger, + keeper keeper.Keeper, +) *VoteExtHandler { + return &VoteExtHandler{ + logger: logger, + Keeper: keeper, + } +} + +type PricesResponse struct { + Prices map[string]math.LegacyDec `json:"prices"` +} + +func (h *VoteExtHandler) ExtendVoteHandler(oracleConfig OracleConfig) sdk.ExtendVoteHandler { + return func(ctx sdk.Context, req *abci.RequestExtendVote) (*abci.ResponseExtendVote, error) { + h.currentBlock = req.Height + h.lastPriceSyncTS = time.Now() + + h.logger.Info("computing oracle prices for vote extension", "height", req.Height, "time", h.lastPriceSyncTS, "endpoint", oracleConfig.Endpoint) + + emptyVoteExt := types.VoteExtension{ + Height: req.Height, + Prices: make(map[uint32][]byte), + } + + // Encode vote extension to bytes + emptyVoteExtBz, err := emptyVoteExt.Compress() + if err != nil { + return nil, fmt.Errorf("failed to marshal vote extension: %w", err) + } + + res, err := http.Get(oracleConfig.Endpoint) + if err != nil { + h.logger.Error("failed to query endpoint", err) + return &abci.ResponseExtendVote{VoteExtension: emptyVoteExtBz}, nil + } + defer res.Body.Close() + + resBody, err := io.ReadAll(res.Body) + if err != nil { + h.logger.Error("failed to read response body", err) + return &abci.ResponseExtendVote{VoteExtension: emptyVoteExtBz}, nil + } + + prices := PricesResponse{} + err = json.Unmarshal(resBody, &prices) + if err != nil { + h.logger.Error("failed to unmarshal prices", err) + return &abci.ResponseExtendVote{VoteExtension: emptyVoteExtBz}, nil + } + + computedPrices := sdk.DecCoins{} + for denom, rate := range prices.Prices { + computedPrices = computedPrices.Add(sdk.NewDecCoinFromDec(denom, rate)) + } + + // produce a canonical vote extension + voteExt := ComposeVoteExtension(h.Keeper, ctx, req.Height, computedPrices) + + h.logger.Info("computed prices", "prices", computedPrices) + + // Encode vote extension to bytes + bz, err := voteExt.Compress() + if err != nil { + return nil, fmt.Errorf("failed to marshal vote extension: %w", err) + } + + return &abci.ResponseExtendVote{VoteExtension: bz}, nil + } +} + +func (h *VoteExtHandler) VerifyVoteExtensionHandler(_ OracleConfig) sdk.VerifyVoteExtensionHandler { + return func(ctx sdk.Context, req *abci.RequestVerifyVoteExtension) (*abci.ResponseVerifyVoteExtension, error) { + var voteExt types.VoteExtension + + if len(req.VoteExtension) == 0 { + return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil + } + + err := voteExt.Decompress(req.VoteExtension) + if err != nil { + // NOTE: It is safe to return an error as the Cosmos SDK will capture all + // errors, log them, and reject the proposal. + return nil, fmt.Errorf("failed to unmarshal vote extension: %w", err) + } + + if voteExt.Height != req.Height { + return nil, fmt.Errorf("vote extension height does not match request height; expected: %d, got: %d", req.Height, voteExt.Height) + } + + // Verify incoming prices from a validator are valid. Note, verification during + // VerifyVoteExtensionHandler MUST be deterministic. + prices := ExchangeRatesFromVoteExtension(h.Keeper, ctx, voteExt) + if err := h.verifyOraclePrices(ctx, prices); err != nil { + return nil, fmt.Errorf("failed to verify oracle prices from validator %X: %w", req.ValidatorAddress, err) + } + + return &abci.ResponseVerifyVoteExtension{Status: abci.ResponseVerifyVoteExtension_ACCEPT}, nil + } +} + +func (h *VoteExtHandler) verifyOraclePrices(_ sdk.Context, _ sdk.DecCoins) error { + return nil +} diff --git a/x/oracle/abci/vote_extensions_test.go b/x/oracle/abci/vote_extensions_test.go new file mode 100644 index 00000000..7840f552 --- /dev/null +++ b/x/oracle/abci/vote_extensions_test.go @@ -0,0 +1,105 @@ +package abci_test + +import ( + "encoding/json" + "net/http" + "net/http/httptest" + "testing" + "time" + + "cosmossdk.io/math" + "github.com/Team-Kujira/core/x/oracle/abci" + "github.com/Team-Kujira/core/x/oracle/keeper" + "github.com/Team-Kujira/core/x/oracle/types" + cometabci "github.com/cometbft/cometbft/abci/types" + "github.com/stretchr/testify/require" +) + +func TestDecoding(t *testing.T) { + resBody := []byte(`{"prices":{"BTC":"47375.706652541026694000","ETH":"2649.328939436595054949","USDT":"1.000661260343873178"}}`) + prices := abci.PricesResponse{} + err := json.Unmarshal(resBody, &prices) + require.NoError(t, err) +} + +func TestExtendVoteHandler(t *testing.T) { + input := keeper.CreateTestInput(t) + + testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + res.WriteHeader(http.StatusOK) + res.Write([]byte(`{"prices":{"BTC":"47375.706652541026694000","ETH":"2649.328939436595054949","USDT":"1.000661260343873178"}}`)) + })) + defer func() { testServer.Close() }() + + h := abci.NewVoteExtHandler(input.Ctx.Logger(), input.OracleKeeper) + handler := h.ExtendVoteHandler(abci.OracleConfig{ + Endpoint: testServer.URL, + }) + res, err := handler(input.Ctx, &cometabci.RequestExtendVote{ + Hash: []byte{}, + Height: 3, + Time: time.Time{}, + Txs: [][]byte{}, + ProposedLastCommit: cometabci.CommitInfo{}, + Misbehavior: []cometabci.Misbehavior{}, + NextValidatorsHash: []byte{}, + ProposerAddress: []byte{}, + }) + require.NoError(t, err) + voteExt := types.VoteExtension{} + err = voteExt.Decompress(res.VoteExtension) + require.NoError(t, err) + require.Equal(t, voteExt.Height, int64(3)) + require.Equal(t, len(voteExt.Prices), 3) + exchangeRates := make(map[uint32]string) + for id, priceBz := range voteExt.Prices { + exchangeRates[id] = abci.DecompressDecimal(priceBz).String() + } + require.Equal(t, exchangeRates[1], "47375.707000000000000000") + require.Equal(t, exchangeRates[2], "2649.328900000000000000") + require.Equal(t, exchangeRates[3], "1.000661300000000000") +} + +func TestVerifyVoteExtensionHandler(t *testing.T) { + input := keeper.CreateTestInput(t) + + testServer := httptest.NewServer(http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { + res.WriteHeader(http.StatusOK) + res.Write([]byte(`{"prices":{"BTC":"47375.706652541026694000","ETH":"2649.328939436595054949","USDT":"1.000661260343873178"}}`)) + })) + defer func() { testServer.Close() }() + + h := abci.NewVoteExtHandler(input.Ctx.Logger(), input.OracleKeeper) + handler := h.VerifyVoteExtensionHandler(abci.OracleConfig{ + Endpoint: testServer.URL, + }) + + voteExt := types.VoteExtension{ + Height: 3, + Prices: map[uint32][]byte{ + 1: abci.CompressDecimal(math.LegacyMustNewDecFromStr("47375.706652541026694000"), 8), + 2: abci.CompressDecimal(math.LegacyMustNewDecFromStr("2649.328939436595054949"), 8), + 3: abci.CompressDecimal(math.LegacyMustNewDecFromStr("1.000661260343873178"), 8), + }, + } + voteExtBz, err := voteExt.Compress() + require.NoError(t, err) + // Height's same + res, err := handler(input.Ctx, &cometabci.RequestVerifyVoteExtension{ + Hash: []byte{}, + Height: 3, + VoteExtension: voteExtBz, + ValidatorAddress: []byte{}, + }) + require.NoError(t, err) + require.Equal(t, res.Status, cometabci.ResponseVerifyVoteExtension_ACCEPT) + + // Height different case + _, err = handler(input.Ctx, &cometabci.RequestVerifyVoteExtension{ + Hash: []byte{}, + Height: 2, + VoteExtension: voteExtBz, + ValidatorAddress: []byte{}, + }) + require.Error(t, err) +} diff --git a/x/oracle/abci_test.go b/x/oracle/abci_test.go deleted file mode 100644 index 1c1c47e6..00000000 --- a/x/oracle/abci_test.go +++ /dev/null @@ -1,538 +0,0 @@ -package oracle_test - -import ( - "fmt" - "math" - "sort" - "testing" - - "github.com/cometbft/cometbft/libs/rand" - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" - - "github.com/Team-Kujira/core/x/oracle" - "github.com/Team-Kujira/core/x/oracle/keeper" - "github.com/Team-Kujira/core/x/oracle/types" -) - -func TestOracleThreshold(t *testing.T) { - input, h := setup(t) - exchangeRateStr := randomExchangeRate.String() + types.TestDenomD - - // Case 1. - // Less than the threshold signs, exchange rate consensus fails - salt := "fc5bb0bc63e54b2918d9334bf3259f5dc575e8d7a4df4e836dd80f1ad62aa89b" - hash := types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[0]) - prevoteMsg := types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[0], keeper.ValAddrs[0]) - voteMsg := types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[0], keeper.ValAddrs[0]) - - _, err1 := h.AggregateExchangeRatePrevote(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 := h.AggregateExchangeRateVote(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) - - oracle.EndBlocker(input.Ctx.WithBlockHeight(1), input.OracleKeeper) - - _, err := input.OracleKeeper.GetExchangeRate(input.Ctx.WithBlockHeight(1), types.TestDenomD) - require.Error(t, err) - - // Case 2. - // More than the threshold signs, exchange rate consensus succeeds - salt = "fc5bb0bc63e54b2918d9334bf3259f5dc575e8d7a4df4e836dd80f1ad62aa89b" - hash = types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[0]) - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[0], keeper.ValAddrs[0]) - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[0], keeper.ValAddrs[0]) - - _, err1 = h.AggregateExchangeRatePrevote(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 = h.AggregateExchangeRateVote(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) - - salt = "4c81c928f466a08b07171def7aeb2b3c266df7bb7486158a15a2291a7d55c8f9" - hash = types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[1]) - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[1], keeper.ValAddrs[1]) - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[1], keeper.ValAddrs[1]) - - _, err1 = h.AggregateExchangeRatePrevote(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 = h.AggregateExchangeRateVote(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) - - salt = "fc246cf5a18c7a650a6a226ebc589d49a9a814d6f1f586405e8726e5cf2a7d80" - hash = types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[2]) - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[2], keeper.ValAddrs[2]) - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[2], keeper.ValAddrs[2]) - - _, err1 = h.AggregateExchangeRatePrevote(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 = h.AggregateExchangeRateVote(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) - - oracle.EndBlocker(input.Ctx.WithBlockHeight(1), input.OracleKeeper) - - rate, err := input.OracleKeeper.GetExchangeRate(input.Ctx.WithBlockHeight(1), types.TestDenomD) - require.NoError(t, err) - require.Equal(t, randomExchangeRate, rate) - - // Case 3. - // Increase voting power of absent validator, exchange rate consensus fails - val, _ := input.StakingKeeper.GetValidator(input.Ctx, keeper.ValAddrs[2]) - input.StakingKeeper.Delegate(input.Ctx.WithBlockHeight(0), keeper.Addrs[2], stakingAmt.MulRaw(3), stakingtypes.Unbonded, val, false) - - salt = "fc5bb0bc63e54b2918d9334bf3259f5dc575e8d7a4df4e836dd80f1ad62aa89b" - hash = types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[0]) - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[0], keeper.ValAddrs[0]) - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[0], keeper.ValAddrs[0]) - - _, err1 = h.AggregateExchangeRatePrevote(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 = h.AggregateExchangeRateVote(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) - - salt = "4c81c928f466a08b07171def7aeb2b3c266df7bb7486158a15a2291a7d55c8f9" - hash = types.GetAggregateVoteHash(salt, exchangeRateStr, keeper.ValAddrs[1]) - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[1], keeper.ValAddrs[1]) - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, keeper.Addrs[1], keeper.ValAddrs[1]) - - _, err1 = h.AggregateExchangeRatePrevote(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 = h.AggregateExchangeRateVote(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) - - oracle.EndBlocker(input.Ctx.WithBlockHeight(1), input.OracleKeeper) - - _, err = input.OracleKeeper.GetExchangeRate(input.Ctx.WithBlockHeight(1), types.TestDenomD) - require.Error(t, err) -} - -func TestOracleDrop(t *testing.T) { - input, h := setup(t) - - input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomC, randomExchangeRate) - - // Account 1, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 0) - - // Immediately swap halt after an illiquid oracle vote - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - - _, err := input.OracleKeeper.GetExchangeRate(input.Ctx, types.TestDenomC) - require.Error(t, err) -} - -func TestOracleTally(t *testing.T) { - input, _ := setup(t) - - ballot := types.ExchangeRateBallot{} - rates, valAddrs, stakingKeeper := types.GenerateRandomTestCase() - input.OracleKeeper.StakingKeeper = stakingKeeper - h := keeper.NewMsgServerImpl(input.OracleKeeper) - for i, rate := range rates { - - decExchangeRate := sdk.NewDecWithPrec(int64(rate*math.Pow10(keeper.OracleDecPrecision)), int64(keeper.OracleDecPrecision)) - exchangeRateStr := decExchangeRate.String() + types.TestDenomD - - salt := fmt.Sprintf("%d", i) - hash := types.GetAggregateVoteHash(salt, exchangeRateStr, valAddrs[i]) - prevoteMsg := types.NewMsgAggregateExchangeRatePrevote(hash, sdk.AccAddress(valAddrs[i]), valAddrs[i]) - voteMsg := types.NewMsgAggregateExchangeRateVote(salt, exchangeRateStr, sdk.AccAddress(valAddrs[i]), valAddrs[i]) - - _, err1 := h.AggregateExchangeRatePrevote(input.Ctx.WithBlockHeight(0), prevoteMsg) - _, err2 := h.AggregateExchangeRateVote(input.Ctx.WithBlockHeight(1), voteMsg) - require.NoError(t, err1) - require.NoError(t, err2) - - power := stakingAmt.QuoRaw(types.MicroUnit).Int64() - if decExchangeRate.IsZero() { - power = int64(0) - } - - vote := types.NewVoteForTally( - decExchangeRate, types.TestDenomD, valAddrs[i], power) - ballot = append(ballot, vote) - - // change power of every three validator - if i%3 == 0 { - stakingKeeper.Validators()[i].SetConsensusPower(int64(i + 1)) - } - } - - validatorClaimMap := make(map[string]types.Claim) - for _, valAddr := range valAddrs { - validatorClaimMap[valAddr.String()] = types.Claim{ - Power: stakingKeeper.Validator(input.Ctx, valAddr).GetConsensusPower(sdk.DefaultPowerReduction), - Weight: int64(0), - WinCount: int64(0), - Recipient: valAddr, - } - } - sort.Sort(ballot) - weightedMedian, _ := ballot.WeightedMedian() - standardDeviation, _ := ballot.StandardDeviation() - maxSpread := weightedMedian.Mul(input.OracleKeeper.RewardBand(input.Ctx).QuoInt64(2)) - - if standardDeviation.GT(maxSpread) { - maxSpread = standardDeviation - } - - expectedValidatorClaimMap := make(map[string]types.Claim) - for _, valAddr := range valAddrs { - expectedValidatorClaimMap[valAddr.String()] = types.Claim{ - Power: stakingKeeper.Validator(input.Ctx, valAddr).GetConsensusPower(sdk.DefaultPowerReduction), - Weight: int64(0), - WinCount: int64(0), - Recipient: valAddr, - } - } - - for _, vote := range ballot { - if (vote.ExchangeRate.GTE(weightedMedian.Sub(maxSpread)) && - vote.ExchangeRate.LTE(weightedMedian.Add(maxSpread))) || - !vote.ExchangeRate.IsPositive() { - key := vote.Voter.String() - claim := expectedValidatorClaimMap[key] - claim.Weight += vote.Power - claim.WinCount++ - expectedValidatorClaimMap[key] = claim - } - } - - missMap := map[string]sdk.ValAddress{} - - tallyMedian, _ := oracle.Tally(input.Ctx, ballot, input.OracleKeeper.RewardBand(input.Ctx), validatorClaimMap, missMap) - - require.Equal(t, validatorClaimMap, expectedValidatorClaimMap) - require.Equal(t, tallyMedian.MulInt64(100).TruncateInt(), weightedMedian.MulInt64(100).TruncateInt()) -} - -func TestOracleTallyTiming(t *testing.T) { - input, h := setup(t) - - // all the keeper.Addrs vote for the block ... not last period block yet, so tally fails - for i := range keeper.Addrs[:2] { - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomD, Amount: randomExchangeRate}}, i) - } - - params := input.OracleKeeper.GetParams(input.Ctx) - params.VotePeriod = 10 // set vote period to 10 for now, for convenience - input.OracleKeeper.SetParams(input.Ctx, params) - require.Equal(t, 0, int(input.Ctx.BlockHeight())) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - _, err := input.OracleKeeper.GetExchangeRate(input.Ctx, types.TestDenomD) - require.Error(t, err) - - input.Ctx = input.Ctx.WithBlockHeight(int64(params.VotePeriod - 1)) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - _, err = input.OracleKeeper.GetExchangeRate(input.Ctx, types.TestDenomD) - require.NoError(t, err) -} - -func TestOracleRewardBand(t *testing.T) { - input, h := setup(t) - params := input.OracleKeeper.GetParams(input.Ctx) - params.Whitelist = types.DenomList{{Name: types.TestDenomC}} - input.OracleKeeper.SetParams(input.Ctx, params) - - rewardSpread := randomExchangeRate.Mul(input.OracleKeeper.RewardBand(input.Ctx).QuoInt64(2)) - - // no one will miss the vote - // Account 1, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate.Sub(rewardSpread)}}, 0) - - // Account 2, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 1) - - // Account 3, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate.Add(rewardSpread)}}, 2) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) - - // Account 1 will miss the vote due to raward band condition - // Account 1, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate.Sub(rewardSpread.Add(sdk.OneDec()))}}, 0) - - // Account 2, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 1) - - // Account 3, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate.Add(rewardSpread)}}, 2) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) - - // no one will miss the vote if someone submits an extra denom - // Account 1, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate.Sub(rewardSpread)}}, 0) - - // Account 2, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 1) - - // Account 3, DenomC + Denom D - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{ - {Denom: types.TestDenomC, Amount: randomExchangeRate.Add(rewardSpread)}, - {Denom: types.TestDenomE, Amount: randomExchangeRate.Add(rewardSpread)}, - }, 2) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) - - // no one will miss the vote if there is threshold of an extra denom - // Account 1, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate.Sub(rewardSpread)}}, 0) - - // Account 2, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{ - {Denom: types.TestDenomC, Amount: randomExchangeRate}, - {Denom: types.TestDenomE, Amount: randomExchangeRate.Add(rewardSpread)}, - }, 1) - - // Account 3, DenomC + Denom D - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{ - {Denom: types.TestDenomC, Amount: randomExchangeRate.Add(rewardSpread)}, - {Denom: types.TestDenomE, Amount: randomExchangeRate.Add(rewardSpread)}, - }, 2) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) -} - -func TestOracleEnsureSorted(t *testing.T) { - input, h := setup(t) - - for i := 0; i < 100; i++ { - exchangeRateA1 := sdk.NewDecWithPrec(int64(rand.Uint64()%100000000), 6).MulInt64(types.MicroUnit) - exchangeRateB1 := sdk.NewDecWithPrec(int64(rand.Uint64()%100000000), 6).MulInt64(types.MicroUnit) - - exchangeRateA2 := sdk.NewDecWithPrec(int64(rand.Uint64()%100000000), 6).MulInt64(types.MicroUnit) - exchangeRateB2 := sdk.NewDecWithPrec(int64(rand.Uint64()%100000000), 6).MulInt64(types.MicroUnit) - - exchangeRateA3 := sdk.NewDecWithPrec(int64(rand.Uint64()%100000000), 6).MulInt64(types.MicroUnit) - exchangeRateB3 := sdk.NewDecWithPrec(int64(rand.Uint64()%100000000), 6).MulInt64(types.MicroUnit) - - // Account 1, DenomB, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomB, Amount: exchangeRateB1}, {Denom: types.TestDenomC, Amount: exchangeRateA1}}, 0) - - // Account 2, DenomB, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomB, Amount: exchangeRateB2}, {Denom: types.TestDenomC, Amount: exchangeRateA2}}, 1) - - // Account 3, DenomB, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomB, Amount: exchangeRateA3}, {Denom: types.TestDenomC, Amount: exchangeRateB3}}, 2) - - require.NotPanics(t, func() { - oracle.EndBlocker(input.Ctx.WithBlockHeight(1), input.OracleKeeper) - }) - } -} - -func TestInvalidVotesSlashing(t *testing.T) { - input, h := setup(t) - params := input.OracleKeeper.GetParams(input.Ctx) - params.Whitelist = types.DenomList{{Name: types.TestDenomC}} - input.OracleKeeper.SetParams(input.Ctx, params) - - votePeriodsPerWindow := sdk.NewDec(int64(input.OracleKeeper.SlashWindow(input.Ctx))).QuoInt64(int64(input.OracleKeeper.VotePeriod(input.Ctx))).TruncateInt64() - slashFraction := input.OracleKeeper.SlashFraction(input.Ctx) - minValidPerWindow := input.OracleKeeper.MinValidPerWindow(input.Ctx) - - for i := uint64(0); i < uint64(sdk.OneDec().Sub(minValidPerWindow).MulInt64(votePeriodsPerWindow).TruncateInt64()); i++ { - input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) - - // Account 1, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 0) - - // Account 2, DenomC, miss vote - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate.Add(sdk.NewDec(100000000000000))}}, 1) - - // Account 3, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 2) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - require.Equal(t, i+1, input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - } - - validator := input.StakingKeeper.Validator(input.Ctx, keeper.ValAddrs[1]) - require.Equal(t, stakingAmt, validator.GetBondedTokens()) - - // one more miss vote will inccur keeper.ValAddrs[1] slashing - // Account 1, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 0) - - // Account 2, DenomC, miss vote - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate.Add(sdk.NewDec(100000000000000))}}, 1) - - // Account 3, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 2) - - input.Ctx = input.Ctx.WithBlockHeight(votePeriodsPerWindow - 1) - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - validator = input.StakingKeeper.Validator(input.Ctx, keeper.ValAddrs[1]) - require.Equal(t, sdk.OneDec().Sub(slashFraction).MulInt(stakingAmt).TruncateInt(), validator.GetBondedTokens()) -} - -func TestWhitelistSlashing(t *testing.T) { - input, h := setup(t) - - votePeriodsPerWindow := sdk.NewDec(int64(input.OracleKeeper.SlashWindow(input.Ctx))).QuoInt64(int64(input.OracleKeeper.VotePeriod(input.Ctx))).TruncateInt64() - slashFraction := input.OracleKeeper.SlashFraction(input.Ctx) - minValidPerWindow := input.OracleKeeper.MinValidPerWindow(input.Ctx) - - for i := uint64(0); i < uint64(sdk.OneDec().Sub(minValidPerWindow).MulInt64(votePeriodsPerWindow).TruncateInt64()); i++ { - input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) - - // Account 2, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 1) - // Account 3, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 2) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - require.Equal(t, i+1, input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - } - - validator := input.StakingKeeper.Validator(input.Ctx, keeper.ValAddrs[0]) - require.Equal(t, stakingAmt, validator.GetBondedTokens()) - - // one more miss vote will inccur Account 1 slashing - - // Account 2, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 1) - // Account 3, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 2) - - input.Ctx = input.Ctx.WithBlockHeight(votePeriodsPerWindow - 1) - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - validator = input.StakingKeeper.Validator(input.Ctx, keeper.ValAddrs[0]) - require.Equal(t, sdk.OneDec().Sub(slashFraction).MulInt(stakingAmt).TruncateInt(), validator.GetBondedTokens()) -} - -func TestNotPassedBallotSlashing(t *testing.T) { - input, h := setup(t) - params := input.OracleKeeper.GetParams(input.Ctx) - params.Whitelist = types.DenomList{{Name: types.TestDenomC}} - input.OracleKeeper.SetParams(input.Ctx, params) - - input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) - - // Account 1, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 0) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - // Not slashing accounts that have voted - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) -} - -func TestAbstainSlashing(t *testing.T) { - input, h := setup(t) - params := input.OracleKeeper.GetParams(input.Ctx) - params.Whitelist = types.DenomList{{Name: types.TestDenomC}} - input.OracleKeeper.SetParams(input.Ctx, params) - - votePeriodsPerWindow := sdk.NewDec(int64(input.OracleKeeper.SlashWindow(input.Ctx))).QuoInt64(int64(input.OracleKeeper.VotePeriod(input.Ctx))).TruncateInt64() - minValidPerWindow := input.OracleKeeper.MinValidPerWindow(input.Ctx) - - for i := uint64(0); i <= uint64(sdk.OneDec().Sub(minValidPerWindow).MulInt64(votePeriodsPerWindow).TruncateInt64()); i++ { - input.Ctx = input.Ctx.WithBlockHeight(input.Ctx.BlockHeight() + 1) - - // Account 1, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 0) - - // Account 2, DenomC, abstain vote - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: sdk.ZeroDec()}}, 1) - - // Account 3, DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 2) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - require.Equal(t, uint64(0), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - } - - validator := input.StakingKeeper.Validator(input.Ctx, keeper.ValAddrs[1]) - require.Equal(t, stakingAmt, validator.GetBondedTokens()) -} - -func TestVoteTargets(t *testing.T) { - input, h := setup(t) - params := input.OracleKeeper.GetParams(input.Ctx) - params.Whitelist = types.DenomList{{Name: types.TestDenomC}, {Name: types.TestDenomD}} - input.OracleKeeper.SetParams(input.Ctx, params) - - // DenomC - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 0) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 1) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 2) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - - // missed D - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(1), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) - - // delete DenomD - params.Whitelist = types.DenomList{{Name: types.TestDenomC}} - input.OracleKeeper.SetParams(input.Ctx, params) - - // DenomC, missing - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{}, 0) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{}, 1) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{}, 2) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - - require.Equal(t, uint64(2), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(2), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(2), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) - - // DenomC, no missing - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 0) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 1) - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: randomExchangeRate}}, 2) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - - require.Equal(t, uint64(2), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[0])) - require.Equal(t, uint64(2), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[1])) - require.Equal(t, uint64(2), input.OracleKeeper.GetMissCounter(input.Ctx, keeper.ValAddrs[2])) -} - -func TestAbstainWithSmallStakingPower(t *testing.T) { - input, h := setupWithSmallVotingPower(t) - - makeAggregatePrevoteAndVote(t, input, h, 0, sdk.DecCoins{{Denom: types.TestDenomC, Amount: sdk.ZeroDec()}}, 0) - - oracle.EndBlocker(input.Ctx, input.OracleKeeper) - _, err := input.OracleKeeper.GetExchangeRate(input.Ctx, types.TestDenomC) - require.Error(t, err) -} - -func makeAggregatePrevoteAndVote(t *testing.T, input keeper.TestInput, h types.MsgServer, height int64, rates sdk.DecCoins, idx int) { - // Account 1, DenomD - salt := "fc5bb0bc63e54b2918d9334bf3259f5dc575e8d7a4df4e836dd80f1ad62aa89b" - hash := types.GetAggregateVoteHash(salt, rates.String(), keeper.ValAddrs[idx]) - - prevoteMsg := types.NewMsgAggregateExchangeRatePrevote(hash, keeper.Addrs[idx], keeper.ValAddrs[idx]) - _, err := h.AggregateExchangeRatePrevote(input.Ctx.WithBlockHeight(height), prevoteMsg) - require.NoError(t, err) - - voteMsg := types.NewMsgAggregateExchangeRateVote(salt, rates.String(), keeper.Addrs[idx], keeper.ValAddrs[idx]) - _, err = h.AggregateExchangeRateVote(input.Ctx.WithBlockHeight(height+1), voteMsg) - require.NoError(t, err) -} diff --git a/x/oracle/client/cli/query.go b/x/oracle/client/cli/query.go index 13dae645..b4cb6fdd 100644 --- a/x/oracle/client/cli/query.go +++ b/x/oracle/client/cli/query.go @@ -27,10 +27,7 @@ func GetQueryCmd() *cobra.Command { GetCmdQueryExchangeRates(), GetCmdQueryActives(), GetCmdQueryParams(), - GetCmdQueryFeederDelegation(), GetCmdQueryMissCounter(), - GetCmdQueryAggregatePrevote(), - GetCmdQueryAggregateVote(), ) return oracleQueryCmd @@ -39,16 +36,16 @@ func GetQueryCmd() *cobra.Command { // GetCmdQueryExchangeRates implements the query rate command. func GetCmdQueryExchangeRates() *cobra.Command { cmd := &cobra.Command{ - Use: "exchange-rates [denom]", + Use: "exchange-rates [symbol]", Args: cobra.RangeArgs(0, 1), Short: "Query the current exchange rate of an asset", Long: strings.TrimSpace(` Query the current exchange rate of USD with an asset. -You can find the current list of active denoms by running +You can find the current list of active symbols by running $ kujirad query oracle exchange-rates -Or, can filter with denom +Or, can filter with symbol $ kujirad query oracle exchange-rates KUJI `), @@ -68,10 +65,9 @@ $ kujirad query oracle exchange-rates KUJI return clientCtx.PrintProto(res) } - denom := args[0] res, err := queryClient.ExchangeRate( context.Background(), - &types.QueryExchangeRateRequest{Denom: denom}, + &types.QueryExchangeRateRequest{Symbol: args[0]}, ) if err != nil { return err @@ -142,46 +138,6 @@ func GetCmdQueryParams() *cobra.Command { return cmd } -// GetCmdQueryFeederDelegation implements the query feeder delegation command -func GetCmdQueryFeederDelegation() *cobra.Command { - cmd := &cobra.Command{ - Use: "feeder [validator]", - Args: cobra.ExactArgs(1), - Short: "Query the oracle feeder delegate account", - Long: strings.TrimSpace(` -Query the account the validator's oracle voting right is delegated to. - -$ kujirad query oracle feeder kujiravaloper... -`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - valString := args[0] - validator, err := sdk.ValAddressFromBech32(valString) - if err != nil { - return err - } - - res, err := queryClient.FeederDelegation( - context.Background(), - &types.QueryFeederDelegationRequest{ValidatorAddr: validator.String()}, - ) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - // GetCmdQueryMissCounter implements the query miss counter of the validator command func GetCmdQueryMissCounter() *cobra.Command { cmd := &cobra.Command{ @@ -221,115 +177,3 @@ $ kujirad query oracle miss kujiravaloper... flags.AddQueryFlagsToCmd(cmd) return cmd } - -// GetCmdQueryAggregatePrevote implements the query aggregate prevote of the validator command -func GetCmdQueryAggregatePrevote() *cobra.Command { - cmd := &cobra.Command{ - Use: "aggregate-prevotes [validator]", - Args: cobra.RangeArgs(0, 1), - Short: "Query outstanding oracle aggregate prevotes.", - Long: strings.TrimSpace(` -Query outstanding oracle aggregate prevotes. - -$ kujirad query oracle aggregate-prevotes - -Or, can filter with voter address - -$ kujirad query oracle aggregate-prevotes kujiravaloper... -`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - if len(args) == 0 { - res, err := queryClient.AggregatePrevotes( - context.Background(), - &types.QueryAggregatePrevotesRequest{}, - ) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - } - - valString := args[0] - validator, err := sdk.ValAddressFromBech32(valString) - if err != nil { - return err - } - - res, err := queryClient.AggregatePrevote( - context.Background(), - &types.QueryAggregatePrevoteRequest{ValidatorAddr: validator.String()}, - ) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} - -// GetCmdQueryAggregateVote implements the query aggregate prevote of the validator command -func GetCmdQueryAggregateVote() *cobra.Command { - cmd := &cobra.Command{ - Use: "aggregate-votes [validator]", - Args: cobra.RangeArgs(0, 1), - Short: "Query outstanding oracle aggregate votes.", - Long: strings.TrimSpace(` -Query outstanding oracle aggregate vote. - -$ kujirad query oracle aggregate-votes - -Or, can filter with voter address - -$ kujirad query oracle aggregate-votes kujiravaloper... -`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientQueryContext(cmd) - if err != nil { - return err - } - queryClient := types.NewQueryClient(clientCtx) - - if len(args) == 0 { - res, err := queryClient.AggregateVotes( - context.Background(), - &types.QueryAggregateVotesRequest{}, - ) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - } - - valString := args[0] - validator, err := sdk.ValAddressFromBech32(valString) - if err != nil { - return err - } - - res, err := queryClient.AggregateVote( - context.Background(), - &types.QueryAggregateVoteRequest{ValidatorAddr: validator.String()}, - ) - if err != nil { - return err - } - - return clientCtx.PrintProto(res) - }, - } - - flags.AddQueryFlagsToCmd(cmd) - return cmd -} diff --git a/x/oracle/client/cli/tx.go b/x/oracle/client/cli/tx.go index 05211881..2aeac3f8 100644 --- a/x/oracle/client/cli/tx.go +++ b/x/oracle/client/cli/tx.go @@ -1,17 +1,7 @@ package cli import ( - "fmt" - "strings" - - "github.com/pkg/errors" - - "github.com/Team-Kujira/core/x/oracle/types" - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/flags" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" "github.com/spf13/cobra" ) @@ -26,186 +16,7 @@ func GetTxCmd() *cobra.Command { RunE: client.ValidateCmd, } - oracleTxCmd.AddCommand( - GetCmdDelegateFeederPermission(), - GetCmdAggregateExchangeRatePrevote(), - GetCmdAggregateExchangeRateVote(), - ) + oracleTxCmd.AddCommand() return oracleTxCmd } - -// GetCmdDelegateFeederPermission will create a feeder permission delegation tx and sign it with the given key. -func GetCmdDelegateFeederPermission() *cobra.Command { - cmd := &cobra.Command{ - Use: "set-feeder [feeder]", - Args: cobra.ExactArgs(1), - Short: "Delegate the permission to vote for the oracle to an address", - Long: strings.TrimSpace(` -Delegate the permission to submit exchange rate votes for the oracle to an address. - -Delegation can keep your validator operator key offline and use a separate replaceable key online. - -$ kujirad tx oracle set-feeder kujira1... - -where "kujira1..." is the address you want to delegate your voting rights to. -`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - // Get from address - voter := clientCtx.GetFromAddress() - - // The address the right is being delegated from - validator := sdk.ValAddress(voter) - - feederStr := args[0] - feeder, err := sdk.AccAddressFromBech32(feederStr) - if err != nil { - return err - } - - msgs := []sdk.Msg{types.NewMsgDelegateFeedConsent(validator, feeder)} - for _, msg := range msgs { - if err := msg.ValidateBasic(); err != nil { - return err - } - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msgs...) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// GetCmdAggregateExchangeRatePrevote will create a aggregateExchangeRatePrevote tx and sign it with the given key. -func GetCmdAggregateExchangeRatePrevote() *cobra.Command { - cmd := &cobra.Command{ - Use: "aggregate-prevote [salt] [exchange-rates] [validator]", - Args: cobra.RangeArgs(2, 3), - Short: "Submit an oracle aggregate prevote for the exchange rates", - Long: strings.TrimSpace(` -Submit an oracle aggregate prevote for the exchange rates of multiple denoms. -The purpose of aggregate prevote is to hide aggregate exchange rate vote with hash which is formatted -as hex string in SHA256("{salt}:{exchange_rate}{denom},...,{exchange_rate}{denom}:{voter}") - -# Aggregate Prevote -$ kujirad tx oracle aggregate-prevote 1234 0.1ATOM,1.001USDT - -where "ATOM,USDT" is the denominating currencies, and "0.1.0,1.001" is the exchange rates of USD from the voter's point of view. - -If voting from a voting delegate, set "validator" to the address of the validator to vote on behalf of: -$ kujirad tx oracle aggregate-prevote 1234 0.1ATOM,1.001USDT kujiravaloper1... -`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - salt := args[0] - exchangeRatesStr := args[1] - _, err = types.ParseExchangeRateTuples(exchangeRatesStr) - if err != nil { - return fmt.Errorf("given exchange_rates {%s} is not a valid format; exchange_rate should be formatted as DecCoins; %s", exchangeRatesStr, err.Error()) - } - - // Get from address - voter := clientCtx.GetFromAddress() - - // By default the voter is voting on behalf of itself - validator := sdk.ValAddress(voter) - - // Override validator if validator is given - if len(args) == 3 { - parsedVal, err := sdk.ValAddressFromBech32(args[2]) - if err != nil { - return errors.Wrap(err, "validator address is invalid") - } - validator = parsedVal - } - - hash := types.GetAggregateVoteHash(salt, exchangeRatesStr, validator) - msgs := []sdk.Msg{types.NewMsgAggregateExchangeRatePrevote(hash, voter, validator)} - for _, msg := range msgs { - if err := msg.ValidateBasic(); err != nil { - return err - } - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msgs...) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} - -// GetCmdAggregateExchangeRateVote will create a aggregateExchangeRateVote tx and sign it with the given key. -func GetCmdAggregateExchangeRateVote() *cobra.Command { - cmd := &cobra.Command{ - Use: "aggregate-vote [salt] [exchange-rates] [validator]", - Args: cobra.RangeArgs(2, 3), - Short: "Submit an oracle aggregate vote for the exchange_rates of Luna", - Long: strings.TrimSpace(` -Submit a aggregate vote for the exchange_rates of Luna w.r.t the input denom. Companion to a prevote submitted in the previous vote period. - -$ kujirad tx oracle aggregate-vote 1234 0.1ATOM,1.001USDT - -where "ATOM,USDT" is the denominating currencies, and "0.1.0,1.001" is the exchange rates of USD from the voter's point of view. - -"salt" should match the salt used to generate the SHA256 hex in the aggregated pre-vote. - -If voting from a voting delegate, set "validator" to the address of the validator to vote on behalf of: -$ kujirad tx oracle aggregate-vote 1234 0.1ATOM,1.001USDT kujiravaloper1.... -`), - RunE: func(cmd *cobra.Command, args []string) error { - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - salt := args[0] - exchangeRatesStr := args[1] - _, err = types.ParseExchangeRateTuples(exchangeRatesStr) - if err != nil { - return fmt.Errorf("given exchange_rate {%s} is not a valid format; exchange rate should be formatted as DecCoin; %s", exchangeRatesStr, err.Error()) - } - - // Get from address - voter := clientCtx.GetFromAddress() - - // By default the voter is voting on behalf of itself - validator := sdk.ValAddress(voter) - - // Override validator if validator is given - if len(args) == 3 { - parsedVal, err := sdk.ValAddressFromBech32(args[2]) - if err != nil { - return errors.Wrap(err, "validator address is invalid") - } - validator = parsedVal - } - - msgs := []sdk.Msg{types.NewMsgAggregateExchangeRateVote(salt, exchangeRatesStr, voter, validator)} - for _, msg := range msgs { - if err := msg.ValidateBasic(); err != nil { - return err - } - } - - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msgs...) - }, - } - - flags.AddTxFlagsToCmd(cmd) - - return cmd -} diff --git a/x/oracle/common_test.go b/x/oracle/common_test.go index b29c95ff..b9d5f31a 100644 --- a/x/oracle/common_test.go +++ b/x/oracle/common_test.go @@ -3,30 +3,28 @@ package oracle_test import ( "testing" + "cosmossdk.io/math" "github.com/stretchr/testify/require" "github.com/Team-Kujira/core/x/oracle/keeper" "github.com/Team-Kujira/core/x/oracle/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ) var ( - uSDRAmt = sdk.NewInt(1005 * types.MicroUnit) + uSDRAmt = math.NewInt(1005 * types.MicroUnit) stakingAmt = sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction) - randomExchangeRate = sdk.NewDec(1700) - anotherRandomExchangeRate = sdk.NewDecWithPrec(4882, 2) // swap rate + randomExchangeRate = math.LegacyNewDec(1700) + anotherRandomExchangeRate = math.LegacyNewDecWithPrec(4882, 2) // swap rate ) func setupWithSmallVotingPower(t *testing.T) (keeper.TestInput, types.MsgServer) { input := keeper.CreateTestInput(t) params := input.OracleKeeper.GetParams(input.Ctx) - params.VotePeriod = 1 params.SlashWindow = 100 - params.RewardDistributionWindow = 100 input.OracleKeeper.SetParams(input.Ctx, params) h := keeper.NewMsgServerImpl(input.OracleKeeper) @@ -39,7 +37,7 @@ func setupWithSmallVotingPower(t *testing.T) (keeper.TestInput, types.MsgServer) require.NoError(t, err) - staking.EndBlocker(input.Ctx, &input.StakingKeeper) + input.StakingKeeper.EndBlocker(input.Ctx) return input, h } @@ -47,15 +45,16 @@ func setupWithSmallVotingPower(t *testing.T) (keeper.TestInput, types.MsgServer) func setup(t *testing.T) (keeper.TestInput, types.MsgServer) { input := keeper.CreateTestInput(t) params := input.OracleKeeper.GetParams(input.Ctx) - params.VotePeriod = 1 params.SlashWindow = 100 - params.RewardDistributionWindow = 100 - params.Whitelist = types.DenomList{{Name: types.TestDenomA}, {Name: types.TestDenomC}, {Name: types.TestDenomD}} + params.RequiredSymbols = []types.Symbol{ + {Symbol: types.TestDenomA, Id: 1}, + {Symbol: types.TestDenomC, Id: 2}, + {Symbol: types.TestDenomD, Id: 3}, + } input.OracleKeeper.SetParams(input.Ctx, params) h := keeper.NewMsgServerImpl(input.OracleKeeper) sh := stakingkeeper.NewMsgServerImpl(&input.StakingKeeper) - // Validator created _, err := sh.CreateValidator(input.Ctx, keeper.NewTestMsgCreateValidator(keeper.ValAddrs[0], keeper.ValPubKeys[0], stakingAmt)) require.NoError(t, err) @@ -63,7 +62,7 @@ func setup(t *testing.T) (keeper.TestInput, types.MsgServer) { require.NoError(t, err) _, err = sh.CreateValidator(input.Ctx, keeper.NewTestMsgCreateValidator(keeper.ValAddrs[2], keeper.ValPubKeys[2], stakingAmt)) require.NoError(t, err) - staking.EndBlocker(input.Ctx, &input.StakingKeeper) + input.StakingKeeper.EndBlocker(input.Ctx) return input, h } @@ -71,9 +70,7 @@ func setup(t *testing.T) (keeper.TestInput, types.MsgServer) { func setupVal5(t *testing.T) (keeper.TestInput, types.MsgServer) { input := keeper.CreateTestInput(t) params := input.OracleKeeper.GetParams(input.Ctx) - params.VotePeriod = 1 params.SlashWindow = 100 - params.RewardDistributionWindow = 100 input.OracleKeeper.SetParams(input.Ctx, params) h := keeper.NewMsgServerImpl(input.OracleKeeper) @@ -90,7 +87,7 @@ func setupVal5(t *testing.T) (keeper.TestInput, types.MsgServer) { require.NoError(t, err) _, err = sh.CreateValidator(input.Ctx, keeper.NewTestMsgCreateValidator(keeper.ValAddrs[4], keeper.ValPubKeys[4], stakingAmt)) require.NoError(t, err) - staking.EndBlocker(input.Ctx, &input.StakingKeeper) + input.StakingKeeper.EndBlocker(input.Ctx) return input, h } diff --git a/x/oracle/exported/alias.go b/x/oracle/exported/alias.go deleted file mode 100644 index 42b83702..00000000 --- a/x/oracle/exported/alias.go +++ /dev/null @@ -1,11 +0,0 @@ -// DONTCOVER -// -//nolint:deadcode -package exported - -import "github.com/Team-Kujira/core/x/oracle/types" - -type ( - MsgAggregateExchangeRatePrevote = types.MsgAggregateExchangeRatePrevote - MsgAggregateExchangeRateVote = types.MsgAggregateExchangeRateVote -) diff --git a/x/oracle/genesis.go b/x/oracle/genesis.go index b8e5b40e..b0f28872 100644 --- a/x/oracle/genesis.go +++ b/x/oracle/genesis.go @@ -3,6 +3,7 @@ package oracle import ( "fmt" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/Team-Kujira/core/x/oracle/keeper" @@ -12,22 +13,8 @@ import ( // InitGenesis initialize default parameters // and the keeper's address to pubkey map func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState) { - for _, d := range data.FeederDelegations { - voter, err := sdk.ValAddressFromBech32(d.ValidatorAddress) - if err != nil { - panic(err) - } - - feeder, err := sdk.AccAddressFromBech32(d.FeederAddress) - if err != nil { - panic(err) - } - - keeper.SetFeederDelegation(ctx, voter, feeder) - } - for _, ex := range data.ExchangeRates { - keeper.SetExchangeRate(ctx, ex.Denom, ex.ExchangeRate) + keeper.SetExchangeRate(ctx, ex.Symbol, ex.ExchangeRate) } for _, mc := range data.MissCounters { @@ -39,26 +26,11 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState keeper.SetMissCounter(ctx, operator, mc.MissCounter) } - for _, ap := range data.AggregateExchangeRatePrevotes { - valAddr, err := sdk.ValAddressFromBech32(ap.Voter) - if err != nil { - panic(err) - } - - keeper.SetAggregateExchangeRatePrevote(ctx, valAddr, ap) - } - - for _, av := range data.AggregateExchangeRateVotes { - valAddr, err := sdk.ValAddressFromBech32(av.Voter) - if err != nil { - panic(err) - } - - keeper.SetAggregateExchangeRateVote(ctx, valAddr, av) + err := keeper.SetParams(ctx, data.Params) + if err != nil { + panic(err) } - keeper.SetParams(ctx, data.Params) - // check if the module account exists moduleAcc := keeper.GetOracleAccount(ctx) if moduleAcc == nil { @@ -71,18 +43,10 @@ func InitGenesis(ctx sdk.Context, keeper keeper.Keeper, data *types.GenesisState // with InitGenesis func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { params := keeper.GetParams(ctx) - feederDelegations := []types.FeederDelegation{} - keeper.IterateFeederDelegations(ctx, func(valAddr sdk.ValAddress, feederAddr sdk.AccAddress) (stop bool) { - feederDelegations = append(feederDelegations, types.FeederDelegation{ - FeederAddress: feederAddr.String(), - ValidatorAddress: valAddr.String(), - }) - return false - }) exchangeRates := []types.ExchangeRateTuple{} - keeper.IterateExchangeRates(ctx, func(denom string, rate sdk.Dec) (stop bool) { - exchangeRates = append(exchangeRates, types.ExchangeRateTuple{Denom: denom, ExchangeRate: rate}) + keeper.IterateExchangeRates(ctx, func(denom string, rate math.LegacyDec) (stop bool) { + exchangeRates = append(exchangeRates, types.ExchangeRateTuple{Symbol: denom, ExchangeRate: rate}) return false }) @@ -95,22 +59,7 @@ func ExportGenesis(ctx sdk.Context, keeper keeper.Keeper) *types.GenesisState { return false }) - aggregateExchangeRatePrevotes := []types.AggregateExchangeRatePrevote{} - keeper.IterateAggregateExchangeRatePrevotes(ctx, func(_ sdk.ValAddress, aggregatePrevote types.AggregateExchangeRatePrevote) (stop bool) { - aggregateExchangeRatePrevotes = append(aggregateExchangeRatePrevotes, aggregatePrevote) - return false - }) - - aggregateExchangeRateVotes := []types.AggregateExchangeRateVote{} - keeper.IterateAggregateExchangeRateVotes(ctx, func(_ sdk.ValAddress, aggregateVote types.AggregateExchangeRateVote) bool { - aggregateExchangeRateVotes = append(aggregateExchangeRateVotes, aggregateVote) - return false - }) - return types.NewGenesisState(params, exchangeRates, - feederDelegations, - missCounters, - aggregateExchangeRatePrevotes, - aggregateExchangeRateVotes) + missCounters) } diff --git a/x/oracle/genesis_test.go b/x/oracle/genesis_test.go index 7fdb5a58..2a411e07 100644 --- a/x/oracle/genesis_test.go +++ b/x/oracle/genesis_test.go @@ -3,22 +3,18 @@ package oracle_test import ( "testing" + "cosmossdk.io/math" "github.com/stretchr/testify/require" "github.com/Team-Kujira/core/x/oracle" "github.com/Team-Kujira/core/x/oracle/keeper" "github.com/Team-Kujira/core/x/oracle/types" - - sdk "github.com/cosmos/cosmos-sdk/types" ) func TestExportInitGenesis(t *testing.T) { input, _ := setup(t) - input.OracleKeeper.SetFeederDelegation(input.Ctx, keeper.ValAddrs[0], keeper.Addrs[1]) - input.OracleKeeper.SetExchangeRate(input.Ctx, "denom", sdk.NewDec(123)) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, keeper.ValAddrs[0], types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{123}, keeper.ValAddrs[0], uint64(2))) - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, keeper.ValAddrs[0], types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Denom: "foo", ExchangeRate: sdk.NewDec(123)}}, keeper.ValAddrs[0])) + input.OracleKeeper.SetExchangeRate(input.Ctx, "denom", math.LegacyNewDec(123)) input.OracleKeeper.SetMissCounter(input.Ctx, keeper.ValAddrs[0], 10) genesis := oracle.ExportGenesis(input.Ctx, input.OracleKeeper) @@ -36,29 +32,6 @@ func TestInitGenesis(t *testing.T) { oracle.InitGenesis(input.Ctx, input.OracleKeeper, genesis) }) - genesis.FeederDelegations = []types.FeederDelegation{{ - FeederAddress: keeper.Addrs[0].String(), - ValidatorAddress: "invalid", - }} - - require.Panics(t, func() { - oracle.InitGenesis(input.Ctx, input.OracleKeeper, genesis) - }) - - genesis.FeederDelegations = []types.FeederDelegation{{ - FeederAddress: "invalid", - ValidatorAddress: keeper.ValAddrs[0].String(), - }} - - require.Panics(t, func() { - oracle.InitGenesis(input.Ctx, input.OracleKeeper, genesis) - }) - - genesis.FeederDelegations = []types.FeederDelegation{{ - FeederAddress: keeper.Addrs[0].String(), - ValidatorAddress: keeper.ValAddrs[0].String(), - }} - genesis.MissCounters = []types.MissCounter{ { ValidatorAddress: "invalid", @@ -77,54 +50,6 @@ func TestInitGenesis(t *testing.T) { }, } - genesis.AggregateExchangeRatePrevotes = []types.AggregateExchangeRatePrevote{ - { - Hash: "hash", - Voter: "invalid", - SubmitBlock: 100, - }, - } - - require.Panics(t, func() { - oracle.InitGenesis(input.Ctx, input.OracleKeeper, genesis) - }) - - genesis.AggregateExchangeRatePrevotes = []types.AggregateExchangeRatePrevote{ - { - Hash: "hash", - Voter: keeper.ValAddrs[0].String(), - SubmitBlock: 100, - }, - } - - genesis.AggregateExchangeRateVotes = []types.AggregateExchangeRateVote{ - { - ExchangeRateTuples: []types.ExchangeRateTuple{ - { - Denom: "ukrw", - ExchangeRate: sdk.NewDec(10), - }, - }, - Voter: "invalid", - }, - } - - require.Panics(t, func() { - oracle.InitGenesis(input.Ctx, input.OracleKeeper, genesis) - }) - - genesis.AggregateExchangeRateVotes = []types.AggregateExchangeRateVote{ - { - ExchangeRateTuples: []types.ExchangeRateTuple{ - { - Denom: "ukrw", - ExchangeRate: sdk.NewDec(10), - }, - }, - Voter: keeper.ValAddrs[0].String(), - }, - } - require.NotPanics(t, func() { oracle.InitGenesis(input.Ctx, input.OracleKeeper, genesis) }) diff --git a/x/oracle/keeper/abci.go b/x/oracle/keeper/abci.go new file mode 100644 index 00000000..5e327695 --- /dev/null +++ b/x/oracle/keeper/abci.go @@ -0,0 +1,17 @@ +package keeper + +import ( + "time" + + "github.com/Team-Kujira/core/x/oracle/types" + + "github.com/cosmos/cosmos-sdk/telemetry" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// EndBlocker is called at the end of every block +func (k Keeper) EndBlocker(_ sdk.Context) error { + defer telemetry.ModuleMeasureSince(types.ModuleName, time.Now(), telemetry.MetricKeyEndBlocker) + + return nil +} diff --git a/x/oracle/keeper/alias_functions.go b/x/oracle/keeper/alias_functions.go index d18fb74e..981f48fe 100644 --- a/x/oracle/keeper/alias_functions.go +++ b/x/oracle/keeper/alias_functions.go @@ -2,13 +2,12 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/Team-Kujira/core/x/oracle/types" ) // GetOracleAccount returns oracle ModuleAccount -func (k Keeper) GetOracleAccount(ctx sdk.Context) authtypes.ModuleAccountI { +func (k Keeper) GetOracleAccount(ctx sdk.Context) sdk.ModuleAccountI { return k.accountKeeper.GetModuleAccount(ctx, types.ModuleName) } diff --git a/x/oracle/keeper/ballot.go b/x/oracle/keeper/ballot.go deleted file mode 100644 index b13f99be..00000000 --- a/x/oracle/keeper/ballot.go +++ /dev/null @@ -1,70 +0,0 @@ -package keeper - -import ( - "sort" - - "github.com/Team-Kujira/core/x/oracle/types" - - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// OrganizeBallotByDenom collects all oracle votes for the period, categorized by the votes' denom parameter -func (k Keeper) OrganizeBallotByDenom(ctx sdk.Context, validatorClaimMap map[string]types.Claim) (votes map[string]types.ExchangeRateBallot) { - votes = map[string]types.ExchangeRateBallot{} - - // Organize aggregate votes - aggregateHandler := func(voterAddr sdk.ValAddress, vote types.AggregateExchangeRateVote) (stop bool) { - // organize ballot only for the active validators - claim, ok := validatorClaimMap[vote.Voter] - - if ok { - power := claim.Power - for _, tuple := range vote.ExchangeRateTuples { - tmpPower := power - if !tuple.ExchangeRate.IsPositive() { - // Make the power of abstain vote zero - tmpPower = 0 - } - - votes[tuple.Denom] = append(votes[tuple.Denom], - types.NewVoteForTally( - tuple.ExchangeRate, - tuple.Denom, - voterAddr, - tmpPower, - ), - ) - } - } - - return false - } - - k.IterateAggregateExchangeRateVotes(ctx, aggregateHandler) - - // sort created ballot - for denom, ballot := range votes { - sort.Sort(ballot) - votes[denom] = ballot - } - - return votes -} - -// ClearBallots clears all tallied prevotes and votes from the store -func (k Keeper) ClearBallots(ctx sdk.Context, votePeriod uint64) { - // Clear all aggregate prevotes - k.IterateAggregateExchangeRatePrevotes(ctx, func(voterAddr sdk.ValAddress, aggregatePrevote types.AggregateExchangeRatePrevote) (stop bool) { - if ctx.BlockHeight() > int64(aggregatePrevote.SubmitBlock+votePeriod) { - k.DeleteAggregateExchangeRatePrevote(ctx, voterAddr) - } - - return false - }) - - // Clear all aggregate votes - k.IterateAggregateExchangeRateVotes(ctx, func(voterAddr sdk.ValAddress, _ types.AggregateExchangeRateVote) (stop bool) { - k.DeleteAggregateExchangeRateVote(ctx, voterAddr) - return false - }) -} diff --git a/x/oracle/keeper/ballot_test.go b/x/oracle/keeper/ballot_test.go deleted file mode 100644 index ec24f6d6..00000000 --- a/x/oracle/keeper/ballot_test.go +++ /dev/null @@ -1,147 +0,0 @@ -package keeper - -import ( - "sort" - "testing" - - "github.com/stretchr/testify/require" - - "github.com/Team-Kujira/core/x/oracle/types" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" -) - -func TestOrganizeAggregate(t *testing.T) { - input := CreateTestInput(t) - - power := int64(100) - amt := sdk.TokensFromConsensusPower(power, sdk.DefaultPowerReduction) - sh := stakingkeeper.NewMsgServerImpl(&input.StakingKeeper) - ctx := input.Ctx - - // Validator created - _, err := sh.CreateValidator(ctx, NewTestMsgCreateValidator(ValAddrs[0], ValPubKeys[0], amt)) - require.NoError(t, err) - _, err = sh.CreateValidator(ctx, NewTestMsgCreateValidator(ValAddrs[1], ValPubKeys[1], amt)) - require.NoError(t, err) - _, err = sh.CreateValidator(ctx, NewTestMsgCreateValidator(ValAddrs[2], ValPubKeys[2], amt)) - require.NoError(t, err) - staking.EndBlocker(ctx, &input.StakingKeeper) - - sdrBallot := types.ExchangeRateBallot{ - types.NewVoteForTally(sdk.NewDec(17), types.TestDenomD, ValAddrs[0], power), - types.NewVoteForTally(sdk.NewDec(10), types.TestDenomD, ValAddrs[1], power), - types.NewVoteForTally(sdk.NewDec(6), types.TestDenomD, ValAddrs[2], power), - } - krwBallot := types.ExchangeRateBallot{ - types.NewVoteForTally(sdk.NewDec(1000), types.TestDenomC, ValAddrs[0], power), - types.NewVoteForTally(sdk.NewDec(1300), types.TestDenomC, ValAddrs[1], power), - types.NewVoteForTally(sdk.NewDec(2000), types.TestDenomC, ValAddrs[2], power), - } - - for i := range sdrBallot { - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, ValAddrs[i], - types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{ - {Denom: sdrBallot[i].Denom, ExchangeRate: sdrBallot[i].ExchangeRate}, - {Denom: krwBallot[i].Denom, ExchangeRate: krwBallot[i].ExchangeRate}, - }, ValAddrs[i])) - } - - // organize votes by denom - ballotMap := input.OracleKeeper.OrganizeBallotByDenom(input.Ctx, map[string]types.Claim{ - ValAddrs[0].String(): { - Power: power, - WinCount: 0, - Recipient: ValAddrs[0], - }, - ValAddrs[1].String(): { - Power: power, - WinCount: 0, - Recipient: ValAddrs[1], - }, - ValAddrs[2].String(): { - Power: power, - WinCount: 0, - Recipient: ValAddrs[2], - }, - }) - - // sort each ballot for comparison - sort.Sort(sdrBallot) - sort.Sort(krwBallot) - sort.Sort(ballotMap[types.TestDenomD]) - sort.Sort(ballotMap[types.TestDenomC]) - - require.Equal(t, sdrBallot, ballotMap[types.TestDenomD]) - require.Equal(t, krwBallot, ballotMap[types.TestDenomC]) -} - -func TestClearBallots(t *testing.T) { - input := CreateTestInput(t) - - power := int64(100) - amt := sdk.TokensFromConsensusPower(power, sdk.DefaultPowerReduction) - sh := stakingkeeper.NewMsgServerImpl(&input.StakingKeeper) - ctx := input.Ctx - - // Validator created - _, err := sh.CreateValidator(ctx, NewTestMsgCreateValidator(ValAddrs[0], ValPubKeys[0], amt)) - require.NoError(t, err) - _, err = sh.CreateValidator(ctx, NewTestMsgCreateValidator(ValAddrs[1], ValPubKeys[1], amt)) - require.NoError(t, err) - _, err = sh.CreateValidator(ctx, NewTestMsgCreateValidator(ValAddrs[2], ValPubKeys[2], amt)) - require.NoError(t, err) - staking.EndBlocker(ctx, &input.StakingKeeper) - - sdrBallot := types.ExchangeRateBallot{ - types.NewVoteForTally(sdk.NewDec(17), types.TestDenomD, ValAddrs[0], power), - types.NewVoteForTally(sdk.NewDec(10), types.TestDenomD, ValAddrs[1], power), - types.NewVoteForTally(sdk.NewDec(6), types.TestDenomD, ValAddrs[2], power), - } - krwBallot := types.ExchangeRateBallot{ - types.NewVoteForTally(sdk.NewDec(1000), types.TestDenomC, ValAddrs[0], power), - types.NewVoteForTally(sdk.NewDec(1300), types.TestDenomC, ValAddrs[1], power), - types.NewVoteForTally(sdk.NewDec(2000), types.TestDenomC, ValAddrs[2], power), - } - - for i := range sdrBallot { - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[i], types.AggregateExchangeRatePrevote{ - Hash: "", - Voter: ValAddrs[i].String(), - SubmitBlock: uint64(input.Ctx.BlockHeight()), - }) - - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, ValAddrs[i], - types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{ - {Denom: sdrBallot[i].Denom, ExchangeRate: sdrBallot[i].ExchangeRate}, - {Denom: krwBallot[i].Denom, ExchangeRate: krwBallot[i].ExchangeRate}, - }, ValAddrs[i])) - } - - input.OracleKeeper.ClearBallots(input.Ctx, 5) - - prevoteCounter := 0 - voteCounter := 0 - input.OracleKeeper.IterateAggregateExchangeRatePrevotes(input.Ctx, func(_ sdk.ValAddress, _ types.AggregateExchangeRatePrevote) bool { - prevoteCounter++ - return false - }) - input.OracleKeeper.IterateAggregateExchangeRateVotes(input.Ctx, func(_ sdk.ValAddress, _ types.AggregateExchangeRateVote) bool { - voteCounter++ - return false - }) - - require.Equal(t, prevoteCounter, 3) - require.Equal(t, voteCounter, 0) - - input.OracleKeeper.ClearBallots(input.Ctx.WithBlockHeight(input.Ctx.BlockHeight()+6), 5) - - prevoteCounter = 0 - input.OracleKeeper.IterateAggregateExchangeRatePrevotes(input.Ctx, func(_ sdk.ValAddress, _ types.AggregateExchangeRatePrevote) bool { - prevoteCounter++ - return false - }) - require.Equal(t, prevoteCounter, 0) -} diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index 5ddef226..ae76b43c 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -3,17 +3,16 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" - gogotypes "github.com/cosmos/gogoproto/types" "cosmossdk.io/errors" + "cosmossdk.io/log" + "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" "github.com/Team-Kujira/core/x/oracle/types" "github.com/cosmos/cosmos-sdk/codec" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // Keeper of the oracle store @@ -30,13 +29,14 @@ type Keeper struct { distrName string rewardDenom string + authority string } // NewKeeper constructs a new keeper for oracle func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, paramspace paramstypes.Subspace, accountKeeper types.AccountKeeper, bankKeeper types.BankKeeper, distrKeeper types.DistributionKeeper, - slashingkeeper types.SlashingKeeper, stakingKeeper types.StakingKeeper, distrName string, + slashingkeeper types.SlashingKeeper, stakingKeeper types.StakingKeeper, distrName string, authority string, ) Keeper { // ensure oracle module account is set if addr := accountKeeper.GetModuleAddress(types.ModuleName); addr == nil { @@ -59,6 +59,7 @@ func NewKeeper(cdc codec.BinaryCodec, storeKey storetypes.StoreKey, StakingKeeper: stakingKeeper, distrName: distrName, rewardDenom: "ukuji", + authority: authority, } } @@ -71,11 +72,11 @@ func (k Keeper) Logger(ctx sdk.Context) log.Logger { // ExchangeRate logic // GetExchangeRate gets the consensus exchange rate of the denom asset from the store. -func (k Keeper) GetExchangeRate(ctx sdk.Context, denom string) (sdk.Dec, error) { +func (k Keeper) GetExchangeRate(ctx sdk.Context, denom string) (math.LegacyDec, error) { store := ctx.KVStore(k.storeKey) b := store.Get(types.GetExchangeRateKey(denom)) if b == nil { - return sdk.ZeroDec(), errors.Wrap(types.ErrUnknownDenom, denom) + return math.LegacyZeroDec(), errors.Wrap(types.ErrUnknownDenom, denom) } dp := sdk.DecProto{} @@ -84,14 +85,14 @@ func (k Keeper) GetExchangeRate(ctx sdk.Context, denom string) (sdk.Dec, error) } // SetExchangeRate sets the consensus exchange rate of the denom asset to the store. -func (k Keeper) SetExchangeRate(ctx sdk.Context, denom string, exchangeRate sdk.Dec) { +func (k Keeper) SetExchangeRate(ctx sdk.Context, denom string, exchangeRate math.LegacyDec) { store := ctx.KVStore(k.storeKey) bz := k.cdc.MustMarshal(&sdk.DecProto{Dec: exchangeRate}) store.Set(types.GetExchangeRateKey(denom), bz) } // SetExchangeRateWithEvent sets the consensus exchange rate of the denom asset to the store with ABCI event -func (k Keeper) SetExchangeRateWithEvent(ctx sdk.Context, denom string, exchangeRate sdk.Dec) { +func (k Keeper) SetExchangeRateWithEvent(ctx sdk.Context, denom string, exchangeRate math.LegacyDec) { k.SetExchangeRate(ctx, denom, exchangeRate) ctx.EventManager().EmitEvent( sdk.NewEvent(types.EventTypeExchangeRateUpdate, @@ -108,9 +109,9 @@ func (k Keeper) DeleteExchangeRate(ctx sdk.Context, denom string) { } // IterateExchangeRates iterates over luna rates in the store -func (k Keeper) IterateExchangeRates(ctx sdk.Context, handler func(denom string, exchangeRate sdk.Dec) (stop bool)) { +func (k Keeper) IterateExchangeRates(ctx sdk.Context, handler func(denom string, exchangeRate math.LegacyDec) (stop bool)) { store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.ExchangeRateKey) + iter := storetypes.KVStorePrefixIterator(store, types.ExchangeRateKey) defer iter.Close() for ; iter.Valid(); iter.Next() { denom := string(iter.Key()[len(types.ExchangeRateKey):]) @@ -122,44 +123,6 @@ func (k Keeper) IterateExchangeRates(ctx sdk.Context, handler func(denom string, } } -//----------------------------------- -// Oracle delegation logic - -// GetFeederDelegation gets the account address that the validator operator delegated oracle vote rights to -func (k Keeper) GetFeederDelegation(ctx sdk.Context, operator sdk.ValAddress) sdk.AccAddress { - store := ctx.KVStore(k.storeKey) - bz := store.Get(types.GetFeederDelegationKey(operator)) - if bz == nil { - // By default the right is delegated to the validator itself - return sdk.AccAddress(operator) - } - - return sdk.AccAddress(bz) -} - -// SetFeederDelegation sets the account address that the validator operator delegated oracle vote rights to -func (k Keeper) SetFeederDelegation(ctx sdk.Context, operator sdk.ValAddress, delegatedFeeder sdk.AccAddress) { - store := ctx.KVStore(k.storeKey) - store.Set(types.GetFeederDelegationKey(operator), delegatedFeeder.Bytes()) -} - -// IterateFeederDelegations iterates over the feed delegates and performs a callback function. -func (k Keeper) IterateFeederDelegations(ctx sdk.Context, - handler func(delegator sdk.ValAddress, delegate sdk.AccAddress) (stop bool), -) { - store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.FeederDelegationKey) - defer iter.Close() - for ; iter.Valid(); iter.Next() { - delegator := sdk.ValAddress(iter.Key()[2:]) - delegate := sdk.AccAddress(iter.Value()) - - if handler(delegator, delegate) { - break - } - } -} - //----------------------------------- // Miss counter logic @@ -195,7 +158,7 @@ func (k Keeper) IterateMissCounters(ctx sdk.Context, handler func(operator sdk.ValAddress, missCounter uint64) (stop bool), ) { store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.MissCounterKey) + iter := storetypes.KVStorePrefixIterator(store, types.MissCounterKey) defer iter.Close() for ; iter.Valid(); iter.Next() { operator := sdk.ValAddress(iter.Key()[2:]) @@ -209,108 +172,26 @@ func (k Keeper) IterateMissCounters(ctx sdk.Context, } } -//----------------------------------- -// AggregateExchangeRatePrevote logic - -// GetAggregateExchangeRatePrevote retrieves an oracle prevote from the store -func (k Keeper) GetAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress) (aggregatePrevote types.AggregateExchangeRatePrevote, err error) { - store := ctx.KVStore(k.storeKey) - b := store.Get(types.GetAggregateExchangeRatePrevoteKey(voter)) - if b == nil { - err = errors.Wrap(types.ErrNoAggregatePrevote, voter.String()) - return - } - k.cdc.MustUnmarshal(b, &aggregatePrevote) - return -} - -// SetAggregateExchangeRatePrevote set an oracle aggregate prevote to the store -func (k Keeper) SetAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress, prevote types.AggregateExchangeRatePrevote) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&prevote) - - store.Set(types.GetAggregateExchangeRatePrevoteKey(voter), bz) -} - -// DeleteAggregateExchangeRatePrevote deletes an oracle prevote from the store -func (k Keeper) DeleteAggregateExchangeRatePrevote(ctx sdk.Context, voter sdk.ValAddress) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.GetAggregateExchangeRatePrevoteKey(voter)) -} - -// IterateAggregateExchangeRatePrevotes iterates rate over prevotes in the store -func (k Keeper) IterateAggregateExchangeRatePrevotes(ctx sdk.Context, handler func(voterAddr sdk.ValAddress, aggregatePrevote types.AggregateExchangeRatePrevote) (stop bool)) { - store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.AggregateExchangeRatePrevoteKey) - defer iter.Close() - for ; iter.Valid(); iter.Next() { - voterAddr := sdk.ValAddress(iter.Key()[2:]) - - var aggregatePrevote types.AggregateExchangeRatePrevote - k.cdc.MustUnmarshal(iter.Value(), &aggregatePrevote) - if handler(voterAddr, aggregatePrevote) { - break - } - } -} - //----------------------------------- // AggregateExchangeRateVote logic -// GetAggregateExchangeRateVote retrieves an oracle prevote from the store -func (k Keeper) GetAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress) (aggregateVote types.AggregateExchangeRateVote, err error) { - store := ctx.KVStore(k.storeKey) - b := store.Get(types.GetAggregateExchangeRateVoteKey(voter)) - if b == nil { - err = errors.Wrap(types.ErrNoAggregateVote, voter.String()) - return - } - k.cdc.MustUnmarshal(b, &aggregateVote) - return -} - -// SetAggregateExchangeRateVote adds an oracle aggregate prevote to the store -func (k Keeper) SetAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress, vote types.AggregateExchangeRateVote) { - store := ctx.KVStore(k.storeKey) - bz := k.cdc.MustMarshal(&vote) - store.Set(types.GetAggregateExchangeRateVoteKey(voter), bz) -} - -// DeleteAggregateExchangeRateVote deletes an oracle prevote from the store -func (k Keeper) DeleteAggregateExchangeRateVote(ctx sdk.Context, voter sdk.ValAddress) { - store := ctx.KVStore(k.storeKey) - store.Delete(types.GetAggregateExchangeRateVoteKey(voter)) +func (k Keeper) GetSubspace() paramstypes.Subspace { + return k.paramSpace } -// IterateAggregateExchangeRateVotes iterates rate over prevotes in the store -func (k Keeper) IterateAggregateExchangeRateVotes(ctx sdk.Context, handler func(voterAddr sdk.ValAddress, aggregateVote types.AggregateExchangeRateVote) (stop bool)) { - store := ctx.KVStore(k.storeKey) - iter := sdk.KVStorePrefixIterator(store, types.AggregateExchangeRateVoteKey) - defer iter.Close() - for ; iter.Valid(); iter.Next() { - voterAddr := sdk.ValAddress(iter.Key()[2:]) - - var aggregateVote types.AggregateExchangeRateVote - k.cdc.MustUnmarshal(iter.Value(), &aggregateVote) - if handler(voterAddr, aggregateVote) { - break - } +func (k Keeper) SetOraclePrices(ctx sdk.Context, prices map[string]math.LegacyDec) { + for b, q := range prices { + k.SetExchangeRateWithEvent(ctx, b, q) } } -// ValidateFeeder return the given feeder is allowed to feed the message or not -func (k Keeper) ValidateFeeder(ctx sdk.Context, feederAddr sdk.AccAddress, validatorAddr sdk.ValAddress) error { - if !feederAddr.Equals(validatorAddr) { - delegate := k.GetFeederDelegation(ctx, validatorAddr) - if !delegate.Equals(feederAddr) { - return errors.Wrap(types.ErrNoVotingPermission, feederAddr.String()) - } - } - - // Check that the given validator exists - if val := k.StakingKeeper.Validator(ctx, validatorAddr); val == nil || !val.IsBonded() { - return errors.Wrapf(stakingtypes.ErrNoValidatorFound, "validator %s is not active set", validatorAddr.String()) +type ( + CurrencyPair struct { + Base string + Quote string } +) - return nil +func (cp CurrencyPair) String() string { + return cp.Base + cp.Quote } diff --git a/x/oracle/keeper/keeper_test.go b/x/oracle/keeper/keeper_test.go index 5a2aef93..c9920af3 100644 --- a/x/oracle/keeper/keeper_test.go +++ b/x/oracle/keeper/keeper_test.go @@ -1,27 +1,23 @@ package keeper import ( - "bytes" "testing" + "cosmossdk.io/math" "github.com/stretchr/testify/require" "github.com/Team-Kujira/core/x/oracle/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/address" - "github.com/cosmos/cosmos-sdk/x/staking" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) func TestExchangeRate(t *testing.T) { input := CreateTestInput(t) - exchangeRateE := sdk.NewDecWithPrec(839, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) - exchangeRateH := sdk.NewDecWithPrec(4995, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) - exchangeRateC := sdk.NewDecWithPrec(2838, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) - exchangeRateA := sdk.NewDecWithPrec(3282384, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) + exchangeRateE := math.LegacyNewDecWithPrec(839, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) + exchangeRateH := math.LegacyNewDecWithPrec(4995, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) + exchangeRateC := math.LegacyNewDecWithPrec(2838, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) + exchangeRateA := math.LegacyNewDecWithPrec(3282384, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) // Set & get rates input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomE, exchangeRateE) @@ -48,7 +44,7 @@ func TestExchangeRate(t *testing.T) { require.Error(t, err) numExchangeRates := 0 - handler := func(denom string, exchangeRate sdk.Dec) (stop bool) { + handler := func(denom string, exchangeRate math.LegacyDec) (stop bool) { numExchangeRates = numExchangeRates + 1 return false } @@ -60,10 +56,10 @@ func TestExchangeRate(t *testing.T) { func TestIterateExchangeRates(t *testing.T) { input := CreateTestInput(t) - exchangeRateE := sdk.NewDecWithPrec(839, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) - exchangeRateH := sdk.NewDecWithPrec(4995, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) - exchangeRateC := sdk.NewDecWithPrec(2838, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) - exchangeRateA := sdk.NewDecWithPrec(3282384, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) + exchangeRateE := math.LegacyNewDecWithPrec(839, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) + exchangeRateH := math.LegacyNewDecWithPrec(4995, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) + exchangeRateC := math.LegacyNewDecWithPrec(2838, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) + exchangeRateA := math.LegacyNewDecWithPrec(3282384, int64(OracleDecPrecision)).MulInt64(types.MicroUnit) // Set & get rates input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomE, exchangeRateE) @@ -71,7 +67,7 @@ func TestIterateExchangeRates(t *testing.T) { input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomC, exchangeRateC) input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomA, exchangeRateA) - input.OracleKeeper.IterateExchangeRates(input.Ctx, func(denom string, rate sdk.Dec) (stop bool) { + input.OracleKeeper.IterateExchangeRates(input.Ctx, func(denom string, rate math.LegacyDec) (stop bool) { switch denom { case types.TestDenomE: require.Equal(t, exchangeRateE, rate) @@ -89,7 +85,7 @@ func TestIterateExchangeRates(t *testing.T) { func TestRewardPool(t *testing.T) { input := CreateTestInput(t) - fees := sdk.NewCoins(sdk.NewCoin(types.TestDenomD, sdk.NewInt(1000))) + fees := sdk.NewCoins(sdk.NewCoin(types.TestDenomD, math.NewInt(1000))) acc := input.AccountKeeper.GetModuleAccount(input.Ctx, types.ModuleName) err := FundAccount(input, acc.GetAddress(), fees) if err != nil { @@ -109,71 +105,32 @@ func TestParams(t *testing.T) { require.NotNil(t, params) // Test custom params setting - votePeriod := uint64(10) - voteThreshold := sdk.NewDecWithPrec(33, 2) - oracleRewardBand := sdk.NewDecWithPrec(1, 2) - rewardDistributionWindow := uint64(10000000000000) - slashFraction := sdk.NewDecWithPrec(1, 2) + voteThreshold := math.LegacyNewDecWithPrec(70, 2) + maxDeviation := math.LegacyNewDecWithPrec(1, 1) + slashFraction := math.LegacyNewDecWithPrec(1, 2) slashWindow := uint64(1000) - minValidPerWindow := sdk.NewDecWithPrec(1, 4) - whitelist := types.DenomList{ - {Name: types.TestDenomD}, - {Name: types.TestDenomC}, + minValidPerWindow := math.LegacyNewDecWithPrec(1, 4) + requiredSymbols := []types.Symbol{ + {Symbol: types.TestDenomD, Id: 1}, + {Symbol: types.TestDenomC, Id: 2}, } // Should really test validateParams, but skipping because obvious newParams := types.Params{ - VotePeriod: votePeriod, - VoteThreshold: voteThreshold, - RewardBand: oracleRewardBand, - RewardDistributionWindow: rewardDistributionWindow, - Whitelist: whitelist, - SlashFraction: slashFraction, - SlashWindow: slashWindow, - MinValidPerWindow: minValidPerWindow, + VoteThreshold: voteThreshold, + MaxDeviation: maxDeviation, + RequiredSymbols: requiredSymbols, + SlashFraction: slashFraction, + SlashWindow: slashWindow, + MinValidPerWindow: minValidPerWindow, } - input.OracleKeeper.SetParams(input.Ctx, newParams) - + err := input.OracleKeeper.SetParams(input.Ctx, newParams) + require.NoError(t, err) storedParams := input.OracleKeeper.GetParams(input.Ctx) require.NotNil(t, storedParams) require.Equal(t, storedParams, newParams) } -func TestFeederDelegation(t *testing.T) { - input := CreateTestInput(t) - - // Test default getters and setters - delegate := input.OracleKeeper.GetFeederDelegation(input.Ctx, ValAddrs[0]) - require.Equal(t, Addrs[0], delegate) - - input.OracleKeeper.SetFeederDelegation(input.Ctx, ValAddrs[0], Addrs[1]) - delegate = input.OracleKeeper.GetFeederDelegation(input.Ctx, ValAddrs[0]) - require.Equal(t, Addrs[1], delegate) -} - -func TestIterateFeederDelegations(t *testing.T) { - input := CreateTestInput(t) - - // Test default getters and setters - delegate := input.OracleKeeper.GetFeederDelegation(input.Ctx, ValAddrs[0]) - require.Equal(t, Addrs[0], delegate) - - input.OracleKeeper.SetFeederDelegation(input.Ctx, ValAddrs[0], Addrs[1]) - - var delegators []sdk.ValAddress - var delegates []sdk.AccAddress - input.OracleKeeper.IterateFeederDelegations(input.Ctx, func(delegator sdk.ValAddress, delegate sdk.AccAddress) (stop bool) { - delegators = append(delegators, delegator) - delegates = append(delegates, delegate) - return false - }) - - require.Equal(t, 1, len(delegators)) - require.Equal(t, 1, len(delegates)) - require.Equal(t, ValAddrs[0], delegators[0]) - require.Equal(t, Addrs[1], delegates[0]) -} - func TestMissCounter(t *testing.T) { input := CreateTestInput(t) @@ -214,141 +171,3 @@ func TestIterateMissCounters(t *testing.T) { require.Equal(t, ValAddrs[1], operators[0]) require.Equal(t, missCounter, missCounters[0]) } - -func TestAggregatePrevoteAddDelete(t *testing.T) { - input := CreateTestInput(t) - - hash := types.GetAggregateVoteHash("salt", "100ukrw,1000uusd", sdk.ValAddress(Addrs[0])) - aggregatePrevote := types.NewAggregateExchangeRatePrevote(hash, sdk.ValAddress(Addrs[0]), 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[0]), aggregatePrevote) - - KPrevote, err := input.OracleKeeper.GetAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[0])) - require.NoError(t, err) - require.Equal(t, aggregatePrevote, KPrevote) - - input.OracleKeeper.DeleteAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[0])) - _, err = input.OracleKeeper.GetAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[0])) - require.Error(t, err) -} - -func TestAggregatePrevoteIterate(t *testing.T) { - input := CreateTestInput(t) - - hash := types.GetAggregateVoteHash("salt", "100ukrw,1000uusd", sdk.ValAddress(Addrs[0])) - aggregatePrevote1 := types.NewAggregateExchangeRatePrevote(hash, sdk.ValAddress(Addrs[0]), 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[0]), aggregatePrevote1) - - hash2 := types.GetAggregateVoteHash("salt", "100ukrw,1000uusd", sdk.ValAddress(Addrs[1])) - aggregatePrevote2 := types.NewAggregateExchangeRatePrevote(hash2, sdk.ValAddress(Addrs[1]), 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, sdk.ValAddress(Addrs[1]), aggregatePrevote2) - - i := 0 - bigger := bytes.Compare(Addrs[0], Addrs[1]) - input.OracleKeeper.IterateAggregateExchangeRatePrevotes(input.Ctx, func(voter sdk.ValAddress, p types.AggregateExchangeRatePrevote) (stop bool) { - if (i == 0 && bigger == -1) || (i == 1 && bigger == 1) { - require.Equal(t, aggregatePrevote1, p) - require.Equal(t, voter.String(), p.Voter) - } else { - require.Equal(t, aggregatePrevote2, p) - require.Equal(t, voter.String(), p.Voter) - } - - i++ - return false - }) -} - -func TestAggregateVoteAddDelete(t *testing.T) { - input := CreateTestInput(t) - - aggregateVote := types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{ - {Denom: "foo", ExchangeRate: sdk.NewDec(-1)}, - {Denom: "foo", ExchangeRate: sdk.NewDec(0)}, - {Denom: "foo", ExchangeRate: sdk.NewDec(1)}, - }, sdk.ValAddress(Addrs[0])) - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, sdk.ValAddress(Addrs[0]), aggregateVote) - - KVote, err := input.OracleKeeper.GetAggregateExchangeRateVote(input.Ctx, sdk.ValAddress(Addrs[0])) - require.NoError(t, err) - require.Equal(t, aggregateVote, KVote) - - input.OracleKeeper.DeleteAggregateExchangeRateVote(input.Ctx, sdk.ValAddress(Addrs[0])) - _, err = input.OracleKeeper.GetAggregateExchangeRateVote(input.Ctx, sdk.ValAddress(Addrs[0])) - require.Error(t, err) -} - -func TestAggregateVoteIterate(t *testing.T) { - input := CreateTestInput(t) - - aggregateVote1 := types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{ - {Denom: "foo", ExchangeRate: sdk.NewDec(-1)}, - {Denom: "foo", ExchangeRate: sdk.NewDec(0)}, - {Denom: "foo", ExchangeRate: sdk.NewDec(1)}, - }, sdk.ValAddress(Addrs[0])) - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, sdk.ValAddress(Addrs[0]), aggregateVote1) - - aggregateVote2 := types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{ - {Denom: "foo", ExchangeRate: sdk.NewDec(-1)}, - {Denom: "foo", ExchangeRate: sdk.NewDec(0)}, - {Denom: "foo", ExchangeRate: sdk.NewDec(1)}, - }, sdk.ValAddress(Addrs[1])) - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, sdk.ValAddress(Addrs[1]), aggregateVote2) - - i := 0 - bigger := bytes.Compare(address.MustLengthPrefix(Addrs[0]), address.MustLengthPrefix(Addrs[1])) - input.OracleKeeper.IterateAggregateExchangeRateVotes(input.Ctx, func(voter sdk.ValAddress, p types.AggregateExchangeRateVote) (stop bool) { - if (i == 0 && bigger == -1) || (i == 1 && bigger == 1) { - require.Equal(t, aggregateVote1, p) - require.Equal(t, voter.String(), p.Voter) - } else { - require.Equal(t, aggregateVote2, p) - require.Equal(t, voter.String(), p.Voter) - } - - i++ - return false - }) -} - -func TestValidateFeeder(t *testing.T) { - // initial setup - input := CreateTestInput(t) - addr, val := ValAddrs[0], ValPubKeys[0] - addr1, val1 := ValAddrs[1], ValPubKeys[1] - amt := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction) - sh := stakingkeeper.NewMsgServerImpl(&input.StakingKeeper) - ctx := input.Ctx - - // Validator created - _, err := sh.CreateValidator(ctx, NewTestMsgCreateValidator(addr, val, amt)) - require.NoError(t, err) - _, err = sh.CreateValidator(ctx, NewTestMsgCreateValidator(addr1, val1, amt)) - require.NoError(t, err) - staking.EndBlocker(ctx, &input.StakingKeeper) - - require.Equal( - t, input.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(addr)), - sdk.NewCoins(sdk.NewCoin(input.StakingKeeper.GetParams(ctx).BondDenom, InitTokens.Sub(amt))), - ) - require.Equal(t, amt, input.StakingKeeper.Validator(ctx, addr).GetBondedTokens()) - require.Equal( - t, input.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(addr1)), - sdk.NewCoins(sdk.NewCoin(input.StakingKeeper.GetParams(ctx).BondDenom, InitTokens.Sub(amt))), - ) - require.Equal(t, amt, input.StakingKeeper.Validator(ctx, addr1).GetBondedTokens()) - - require.NoError(t, input.OracleKeeper.ValidateFeeder(input.Ctx, sdk.AccAddress(addr), sdk.ValAddress(addr))) - require.NoError(t, input.OracleKeeper.ValidateFeeder(input.Ctx, sdk.AccAddress(addr1), sdk.ValAddress(addr1))) - - // delegate works - input.OracleKeeper.SetFeederDelegation(input.Ctx, sdk.ValAddress(addr), sdk.AccAddress(addr1)) - require.NoError(t, input.OracleKeeper.ValidateFeeder(input.Ctx, sdk.AccAddress(addr1), sdk.ValAddress(addr))) - require.Error(t, input.OracleKeeper.ValidateFeeder(input.Ctx, sdk.AccAddress(Addrs[2]), sdk.ValAddress(addr))) - - // only active validators can do oracle votes - validator, found := input.StakingKeeper.GetValidator(input.Ctx, sdk.ValAddress(addr)) - require.True(t, found) - validator.Status = stakingtypes.Unbonded - input.StakingKeeper.SetValidator(input.Ctx, validator) - require.Error(t, input.OracleKeeper.ValidateFeeder(input.Ctx, sdk.AccAddress(addr1), sdk.ValAddress(addr))) -} diff --git a/x/oracle/keeper/migrations.go b/x/oracle/keeper/migrations.go new file mode 100644 index 00000000..c09c7ec8 --- /dev/null +++ b/x/oracle/keeper/migrations.go @@ -0,0 +1,26 @@ +package keeper + +import ( + "github.com/CosmWasm/wasmd/x/wasm/exported" + v1 "github.com/Team-Kujira/core/x/oracle/migrations/v1" + sdk "github.com/cosmos/cosmos-sdk/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper Keeper + legacySubspace exported.Subspace + // queryServer grpc.Server +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper Keeper, subspace paramstypes.Subspace) Migrator { + return Migrator{keeper: keeper, legacySubspace: subspace} +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + store := ctx.KVStore(m.keeper.storeKey) + return v1.MigrateParams(ctx, store, m.keeper.paramSpace, m.keeper.cdc) +} diff --git a/x/oracle/keeper/msg_server.go b/x/oracle/keeper/msg_server.go index c816ffc6..adc52bee 100644 --- a/x/oracle/keeper/msg_server.go +++ b/x/oracle/keeper/msg_server.go @@ -2,11 +2,12 @@ package keeper import ( "context" + "fmt" + "reflect" "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" "github.com/Team-Kujira/core/x/oracle/types" ) @@ -21,147 +22,83 @@ func NewMsgServerImpl(keeper Keeper) types.MsgServer { return &msgServer{Keeper: keeper} } -func (ms msgServer) AggregateExchangeRatePrevote(goCtx context.Context, msg *types.MsgAggregateExchangeRatePrevote) (*types.MsgAggregateExchangeRatePrevoteResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - valAddr, err := sdk.ValAddressFromBech32(msg.Validator) - if err != nil { - return nil, err +func (ms msgServer) AddRequiredSymbols(goCtx context.Context, msg *types.MsgAddRequiredSymbols) (*types.MsgAddRequiredSymbolsResponse, error) { + if ms.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, msg.Authority) } - feederAddr, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - return nil, err - } + ctx := sdk.UnwrapSDKContext(goCtx) + params := ms.GetParams(ctx) - if err := ms.ValidateFeeder(ctx, feederAddr, valAddr); err != nil { - return nil, err + existingSymbols := make(map[string]bool) + for _, symbol := range params.RequiredSymbols { + existingSymbols[symbol.Symbol] = true } - // Convert hex string to votehash - voteHash, err := types.AggregateVoteHashFromHexString(msg.Hash) - if err != nil { - return nil, errors.Wrap(types.ErrInvalidHash, err.Error()) + for _, symbol := range msg.Symbols { + if existingSymbols[symbol] { + return nil, fmt.Errorf("symbol '%s' already set as required symbols", symbol) + } + params.RequiredSymbols = append(params.RequiredSymbols, types.Symbol{ + Symbol: symbol, + Id: params.LastSymbolId + 1, + }) + params.LastSymbolId++ } - aggregatePrevote := types.NewAggregateExchangeRatePrevote(voteHash, valAddr, uint64(ctx.BlockHeight())) - ms.SetAggregateExchangeRatePrevote(ctx, valAddr, aggregatePrevote) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeAggregatePrevote, - sdk.NewAttribute(types.AttributeKeyVoter, msg.Validator), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Feeder), - ), - }) - - return &types.MsgAggregateExchangeRatePrevoteResponse{}, nil -} - -func (ms msgServer) AggregateExchangeRateVote(goCtx context.Context, msg *types.MsgAggregateExchangeRateVote) (*types.MsgAggregateExchangeRateVoteResponse, error) { - ctx := sdk.UnwrapSDKContext(goCtx) - - valAddr, err := sdk.ValAddressFromBech32(msg.Validator) + err := ms.SetParams(ctx, params) if err != nil { - return nil, err + return nil, types.ErrSetParams } - feederAddr, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - return nil, err - } + return &types.MsgAddRequiredSymbolsResponse{}, nil +} - if err := ms.ValidateFeeder(ctx, feederAddr, valAddr); err != nil { - return nil, err +func (ms msgServer) RemoveRequiredSymbols(goCtx context.Context, msg *types.MsgRemoveRequiredSymbols) (*types.MsgRemoveRequiredSymbolsResponse, error) { + if ms.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, msg.Authority) } + ctx := sdk.UnwrapSDKContext(goCtx) params := ms.GetParams(ctx) - aggregatePrevote, err := ms.GetAggregateExchangeRatePrevote(ctx, valAddr) - if err != nil { - return nil, errors.Wrap(types.ErrNoAggregatePrevote, msg.Validator) + removingSymbols := make(map[string]bool) + for _, symbol := range msg.Symbols { + removingSymbols[symbol] = true } - // Check a msg is submitted proper period - if (uint64(ctx.BlockHeight())/params.VotePeriod)-(aggregatePrevote.SubmitBlock/params.VotePeriod) != 1 { - return nil, types.ErrRevealPeriodMissMatch + requiredDenoms := []types.Symbol{} + for _, denom := range params.RequiredSymbols { + if !removingSymbols[denom.Symbol] { + requiredDenoms = append(requiredDenoms, denom) + } } - exchangeRateTuples, err := types.ParseExchangeRateTuples(msg.ExchangeRates) + params.RequiredSymbols = requiredDenoms + err := ms.SetParams(ctx, params) if err != nil { - return nil, errors.Wrap(sdkerrors.ErrInvalidCoins, err.Error()) - } - - // // check all denoms are in the vote target - // for _, tuple := range exchangeRateTuples { - // if !ms.IsVoteTarget(ctx, tuple.Denom) { - // return nil, errors.Wrap(types.ErrUnknownDenom, tuple.Denom) - // } - // } - - // Verify a exchange rate with aggregate prevote hash - hash := types.GetAggregateVoteHash(msg.Salt, msg.ExchangeRates, valAddr) - if aggregatePrevote.Hash != hash.String() { - return nil, errors.Wrapf(types.ErrVerificationFailed, "must be given %s not %s", aggregatePrevote.Hash, hash) + return nil, types.ErrSetParams } - // Move aggregate prevote to aggregate vote with given exchange rates - ms.SetAggregateExchangeRateVote(ctx, valAddr, types.NewAggregateExchangeRateVote(exchangeRateTuples, valAddr)) - ms.DeleteAggregateExchangeRatePrevote(ctx, valAddr) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeAggregateVote, - sdk.NewAttribute(types.AttributeKeyVoter, msg.Validator), - sdk.NewAttribute(types.AttributeKeyExchangeRates, msg.ExchangeRates), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Feeder), - ), - }) - - return &types.MsgAggregateExchangeRateVoteResponse{}, nil + return &types.MsgRemoveRequiredSymbolsResponse{}, nil } -func (ms msgServer) DelegateFeedConsent(goCtx context.Context, msg *types.MsgDelegateFeedConsent) (*types.MsgDelegateFeedConsentResponse, error) { +func (ms msgServer) UpdateParams(goCtx context.Context, msg *types.MsgUpdateParams) (*types.MsgUpdateParamsResponse, error) { + if ms.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, "invalid authority; expected %s, got %s", ms.authority, msg.Authority) + } + ctx := sdk.UnwrapSDKContext(goCtx) - operatorAddr, err := sdk.ValAddressFromBech32(msg.Operator) - if err != nil { - return nil, err + // Check id and denom mapping change + params := ms.GetParams(ctx) + if !reflect.DeepEqual(params.RequiredSymbols, msg.Params.RequiredSymbols) { + return nil, types.ErrCanNotUpdateRequiredSymbols } - delegateAddr, err := sdk.AccAddressFromBech32(msg.Delegate) - if err != nil { + if err := ms.SetParams(ctx, *msg.Params); err != nil { return nil, err } - // Check the delegator is a validator - val := ms.StakingKeeper.Validator(ctx, operatorAddr) - if val == nil { - return nil, errors.Wrap(stakingtypes.ErrNoValidatorFound, msg.Operator) - } - - // Set the delegation - ms.SetFeederDelegation(ctx, operatorAddr, delegateAddr) - - ctx.EventManager().EmitEvents(sdk.Events{ - sdk.NewEvent( - types.EventTypeFeedDelegate, - sdk.NewAttribute(types.AttributeKeyFeeder, msg.Delegate), - ), - sdk.NewEvent( - sdk.EventTypeMessage, - sdk.NewAttribute(sdk.AttributeKeyModule, types.AttributeValueCategory), - sdk.NewAttribute(sdk.AttributeKeySender, msg.Operator), - ), - }) - - return &types.MsgDelegateFeedConsentResponse{}, nil + return &types.MsgUpdateParamsResponse{}, nil } diff --git a/x/oracle/keeper/msg_server_test.go b/x/oracle/keeper/msg_server_test.go index d729647a..b4765e7b 100644 --- a/x/oracle/keeper/msg_server_test.go +++ b/x/oracle/keeper/msg_server_test.go @@ -1,7 +1,6 @@ package keeper import ( - "fmt" "testing" "github.com/stretchr/testify/require" @@ -10,161 +9,146 @@ import ( "github.com/Team-Kujira/core/x/oracle/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" ) -func TestMsgServer_FeederDelegation(t *testing.T) { - input, msgServer := setup(t) - - salt := "1" - hash := types.GetAggregateVoteHash(salt, randomExchangeRate.String()+types.TestDenomD, ValAddrs[0]) - - // Case 1: empty message - delegateFeedConsentMsg := types.MsgDelegateFeedConsent{} - _, err := msgServer.DelegateFeedConsent(sdk.WrapSDKContext(input.Ctx), &delegateFeedConsentMsg) - require.Error(t, err) +var ( + stakingAmt = sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction) +) - // Case 2: Normal Prevote - without delegation - prevoteMsg := types.NewMsgAggregateExchangeRatePrevote(hash, Addrs[0], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRatePrevote(sdk.WrapSDKContext(input.Ctx), prevoteMsg) - require.NoError(t, err) +func setup(t *testing.T) (TestInput, types.MsgServer) { + input := CreateTestInput(t) + params := input.OracleKeeper.GetParams(input.Ctx) + params.SlashWindow = 100 + input.OracleKeeper.SetParams(input.Ctx, params) + msgServer := NewMsgServerImpl(input.OracleKeeper) - // Case 2.1: Normal Prevote - with delegation fails - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, Addrs[1], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRatePrevote(sdk.WrapSDKContext(input.Ctx), prevoteMsg) - require.Error(t, err) + sh := stakingkeeper.NewMsgServerImpl(&input.StakingKeeper) - // Case 2.2: Normal Vote - without delegation - voteMsg := types.NewMsgAggregateExchangeRateVote(salt, randomExchangeRate.String()+types.TestDenomD, Addrs[0], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx.WithBlockHeight(1)), voteMsg) + // Validator created + _, err := sh.CreateValidator(input.Ctx, NewTestMsgCreateValidator(ValAddrs[0], ValPubKeys[0], stakingAmt)) require.NoError(t, err) - - // Case 2.3: Normal Vote - with delegation fails - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, randomExchangeRate.String()+types.TestDenomD, Addrs[1], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx.WithBlockHeight(1)), voteMsg) - require.Error(t, err) - - // Case 3: Normal MsgDelegateFeedConsent succeeds - msg := types.NewMsgDelegateFeedConsent(ValAddrs[0], Addrs[1]) - _, err = msgServer.DelegateFeedConsent(sdk.WrapSDKContext(input.Ctx), msg) + _, err = sh.CreateValidator(input.Ctx, NewTestMsgCreateValidator(ValAddrs[1], ValPubKeys[1], stakingAmt)) require.NoError(t, err) - - // Case 4.1: Normal Prevote - without delegation fails - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, Addrs[2], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRatePrevote(sdk.WrapSDKContext(input.Ctx), prevoteMsg) - require.Error(t, err) - - // Case 4.2: Normal Prevote - with delegation succeeds - prevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, Addrs[1], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRatePrevote(sdk.WrapSDKContext(input.Ctx), prevoteMsg) + _, err = sh.CreateValidator(input.Ctx, NewTestMsgCreateValidator(ValAddrs[2], ValPubKeys[2], stakingAmt)) require.NoError(t, err) - // Case 4.3: Normal Vote - without delegation fails - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, randomExchangeRate.String()+types.TestDenomD, Addrs[2], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx.WithBlockHeight(1)), voteMsg) - require.Error(t, err) + input.StakingKeeper.EndBlocker(input.Ctx) - // Case 4.4: Normal Vote - with delegation succeeds - voteMsg = types.NewMsgAggregateExchangeRateVote(salt, randomExchangeRate.String()+types.TestDenomD, Addrs[1], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx.WithBlockHeight(1)), voteMsg) - require.NoError(t, err) + return input, msgServer } -func TestMsgServer_AggregatePrevoteVote(t *testing.T) { +func TestMsgUpdateParams(t *testing.T) { input, msgServer := setup(t) - salt := "1" - exchangeRatesStr := fmt.Sprintf("1000.23%s,0.29%s,0.27%s", types.TestDenomC, types.TestDenomB, types.TestDenomD) - otherExchangeRateStr := fmt.Sprintf("1000.12%s,0.29%s,0.27%s", types.TestDenomC, types.TestDenomB, types.TestDenomB) - unintendedExchageRateStr := fmt.Sprintf("1000.23%s,0.29%s,0.27%s", types.TestDenomC, types.TestDenomB, types.TestDenomE) - invalidExchangeRateStr := fmt.Sprintf("1000.23%s,0.29%s,0.27", types.TestDenomC, types.TestDenomB) - - hash := types.GetAggregateVoteHash(salt, exchangeRatesStr, ValAddrs[0]) - - aggregateExchangeRatePrevoteMsg := types.NewMsgAggregateExchangeRatePrevote(hash, Addrs[0], ValAddrs[0]) - _, err := msgServer.AggregateExchangeRatePrevote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRatePrevoteMsg) - require.NoError(t, err) - - // Unauthorized feeder - aggregateExchangeRatePrevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, Addrs[1], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRatePrevote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRatePrevoteMsg) - require.Error(t, err) - - // Invalid addr - aggregateExchangeRatePrevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, sdk.AccAddress{}, ValAddrs[0]) - _, err = msgServer.AggregateExchangeRatePrevote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRatePrevoteMsg) - require.Error(t, err) - - // Invalid validator addr - aggregateExchangeRatePrevoteMsg = types.NewMsgAggregateExchangeRatePrevote(hash, Addrs[0], sdk.ValAddress{}) - _, err = msgServer.AggregateExchangeRatePrevote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRatePrevoteMsg) - require.Error(t, err) - - // Invalid reveal period - aggregateExchangeRateVoteMsg := types.NewMsgAggregateExchangeRateVote(salt, exchangeRatesStr, Addrs[0], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRateVoteMsg) - require.Error(t, err) + // Test default params setting + input.OracleKeeper.SetParams(input.Ctx, types.DefaultParams()) + params := input.OracleKeeper.GetParams(input.Ctx) + require.NotNil(t, params) - // Invalid reveal period - input.Ctx = input.Ctx.WithBlockHeight(2) - aggregateExchangeRateVoteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRatesStr, Addrs[0], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRateVoteMsg) + // Test updating with invalid authority + _, err := msgServer.UpdateParams(input.Ctx, &types.MsgUpdateParams{ + Authority: "invalid_authority", + Params: ¶ms, + }) require.Error(t, err) - // Other exchange rate with valid real period - input.Ctx = input.Ctx.WithBlockHeight(1) - aggregateExchangeRateVoteMsg = types.NewMsgAggregateExchangeRateVote(salt, otherExchangeRateStr, Addrs[0], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRateVoteMsg) - require.Error(t, err) + // Test updating with correct authority + _, err = msgServer.UpdateParams(input.Ctx, &types.MsgUpdateParams{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Params: ¶ms, + }) + require.NoError(t, err) - // Invalid exchange rate with valid real period - input.Ctx = input.Ctx.WithBlockHeight(1) - aggregateExchangeRateVoteMsg = types.NewMsgAggregateExchangeRateVote(salt, invalidExchangeRateStr, Addrs[0], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRateVoteMsg) + // Test updating required denoms + params.RequiredSymbols = []types.Symbol{{Symbol: "BTC", Id: 1}} + _, err = msgServer.UpdateParams(input.Ctx, &types.MsgUpdateParams{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Params: ¶ms, + }) require.Error(t, err) +} - // Unauthorized feeder - aggregateExchangeRateVoteMsg = types.NewMsgAggregateExchangeRateVote(salt, invalidExchangeRateStr, Addrs[1], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRateVoteMsg) - require.Error(t, err) +func TestMsgAddRequiredSymbols(t *testing.T) { + input, msgServer := setup(t) - // Unintended denom vote - aggregateExchangeRateVoteMsg = types.NewMsgAggregateExchangeRateVote(salt, unintendedExchageRateStr, Addrs[0], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRateVoteMsg) + params := input.OracleKeeper.GetParams(input.Ctx) + require.Len(t, params.RequiredSymbols, 3) + require.Equal(t, params.LastSymbolId, uint32(3)) + + // Test with invalid authority + _, err := msgServer.AddRequiredSymbols(input.Ctx, &types.MsgAddRequiredSymbols{ + Authority: "invalid_authority", + Symbols: []string{"ATOM"}, + }) require.Error(t, err) - // Valid exchange rate reveal submission - input.Ctx = input.Ctx.WithBlockHeight(1) - aggregateExchangeRateVoteMsg = types.NewMsgAggregateExchangeRateVote(salt, exchangeRatesStr, Addrs[0], ValAddrs[0]) - _, err = msgServer.AggregateExchangeRateVote(sdk.WrapSDKContext(input.Ctx), aggregateExchangeRateVoteMsg) + // Adding a single denom + _, err = msgServer.AddRequiredSymbols(input.Ctx, &types.MsgAddRequiredSymbols{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Symbols: []string{"ATOM"}, + }) + require.NoError(t, err) + params = input.OracleKeeper.GetParams(input.Ctx) + require.Len(t, params.RequiredSymbols, 4) + require.Equal(t, params.LastSymbolId, uint32(4)) + + // Adding two denoms + _, err = msgServer.AddRequiredSymbols(input.Ctx, &types.MsgAddRequiredSymbols{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Symbols: []string{"AKT", "ARB"}, + }) require.NoError(t, err) + params = input.OracleKeeper.GetParams(input.Ctx) + require.Len(t, params.RequiredSymbols, 6) + require.Equal(t, params.LastSymbolId, uint32(6)) + + // Adding already existing denom + _, err = msgServer.AddRequiredSymbols(input.Ctx, &types.MsgAddRequiredSymbols{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Symbols: []string{"ATOM"}, + }) + require.Error(t, err) } -var ( - stakingAmt = sdk.TokensFromConsensusPower(10, sdk.DefaultPowerReduction) - randomExchangeRate = sdk.NewDec(1700) -) +func TestMsgRemoveRequiredSymbols(t *testing.T) { + input, msgServer := setup(t) -func setup(t *testing.T) (TestInput, types.MsgServer) { - input := CreateTestInput(t) params := input.OracleKeeper.GetParams(input.Ctx) - params.VotePeriod = 1 - params.SlashWindow = 100 - params.RewardDistributionWindow = 100 - input.OracleKeeper.SetParams(input.Ctx, params) - msgServer := NewMsgServerImpl(input.OracleKeeper) - - sh := stakingkeeper.NewMsgServerImpl(&input.StakingKeeper) + require.Len(t, params.RequiredSymbols, 3) + require.Equal(t, params.LastSymbolId, uint32(3)) + + // Test with invalid authority + _, err := msgServer.RemoveRequiredSymbols(input.Ctx, &types.MsgRemoveRequiredSymbols{ + Authority: "invalid_authority", + Symbols: []string{"BTC"}, + }) + require.Error(t, err) - // Validator created - _, err := sh.CreateValidator(input.Ctx, NewTestMsgCreateValidator(ValAddrs[0], ValPubKeys[0], stakingAmt)) + // Removing a single denom + _, err = msgServer.RemoveRequiredSymbols(input.Ctx, &types.MsgRemoveRequiredSymbols{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Symbols: []string{"BTC"}, + }) require.NoError(t, err) - _, err = sh.CreateValidator(input.Ctx, NewTestMsgCreateValidator(ValAddrs[1], ValPubKeys[1], stakingAmt)) + params = input.OracleKeeper.GetParams(input.Ctx) + require.Len(t, params.RequiredSymbols, 2) + require.Equal(t, params.LastSymbolId, uint32(3)) + + // Removing two denoms + _, err = msgServer.RemoveRequiredSymbols(input.Ctx, &types.MsgRemoveRequiredSymbols{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Symbols: []string{"ETH", "USDT"}, + }) require.NoError(t, err) - _, err = sh.CreateValidator(input.Ctx, NewTestMsgCreateValidator(ValAddrs[2], ValPubKeys[2], stakingAmt)) + params = input.OracleKeeper.GetParams(input.Ctx) + require.Len(t, params.RequiredSymbols, 0) + require.Equal(t, params.LastSymbolId, uint32(3)) + + // Removing not existing denom + _, err = msgServer.RemoveRequiredSymbols(input.Ctx, &types.MsgRemoveRequiredSymbols{ + Authority: "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn", + Symbols: []string{"BTC"}, + }) require.NoError(t, err) - staking.EndBlocker(input.Ctx, &input.StakingKeeper) - - return input, msgServer } diff --git a/x/oracle/keeper/params.go b/x/oracle/keeper/params.go index 4ac53cac..f81427ff 100644 --- a/x/oracle/keeper/params.go +++ b/x/oracle/keeper/params.go @@ -1,72 +1,73 @@ package keeper import ( + "cosmossdk.io/math" "github.com/Team-Kujira/core/x/oracle/types" sdk "github.com/cosmos/cosmos-sdk/types" ) -// VotePeriod returns the number of blocks during which voting takes place. -func (k Keeper) VotePeriod(ctx sdk.Context) (res uint64) { - k.paramSpace.Get(ctx, types.KeyVotePeriod, &res) - return -} - // VoteThreshold returns the minimum percentage of votes that must be received for a ballot to pass. -func (k Keeper) VoteThreshold(ctx sdk.Context) (res sdk.Dec) { - k.paramSpace.Get(ctx, types.KeyVoteThreshold, &res) - return +func (k Keeper) VoteThreshold(ctx sdk.Context) (res math.LegacyDec) { + return k.GetParams(ctx).VoteThreshold } -// RewardBand returns the ratio of allowable exchange rate error that a validator can be rewared -func (k Keeper) RewardBand(ctx sdk.Context) (res sdk.Dec) { - k.paramSpace.Get(ctx, types.KeyRewardBand, &res) - return +// MaxDeviation returns the ratio of allowable exchange rate error that a validator can be rewared +func (k Keeper) MaxDeviation(ctx sdk.Context) (res math.LegacyDec) { + return k.GetParams(ctx).MaxDeviation } -// RewardDistributionWindow returns the number of vote periods during which seigiornage reward comes in and then is distributed. -func (k Keeper) RewardDistributionWindow(ctx sdk.Context) (res uint64) { - k.paramSpace.Get(ctx, types.KeyRewardDistributionWindow, &res) - return +// RequiredSymbols returns the denom list that can be activated +func (k Keeper) RequiredSymbols(ctx sdk.Context) (res []types.Symbol) { + return k.GetParams(ctx).RequiredSymbols } -// Whitelist returns the denom list that can be activated -func (k Keeper) Whitelist(ctx sdk.Context) (res types.DenomList) { - k.paramSpace.Get(ctx, types.KeyWhitelist, &res) - return -} - -// SetWhitelist store new whitelist to param store -// this function is only for test purpose -func (k Keeper) SetWhitelist(ctx sdk.Context, whitelist types.DenomList) { - k.paramSpace.Set(ctx, types.KeyWhitelist, whitelist) -} +// // SetRequiredSymbols store new required denoms to param store +// // this function is only for test purpose +// func (k Keeper) SetRequiredSymbols(ctx sdk.Context, denoms []string) { +// params := k.GetParams(ctx) +// params.RequiredSymbols = denoms +// err := k.SetParams(ctx, params) +// if err != nil { +// return +// } +// } // SlashFraction returns oracle voting penalty rate -func (k Keeper) SlashFraction(ctx sdk.Context) (res sdk.Dec) { - k.paramSpace.Get(ctx, types.KeySlashFraction, &res) - return +func (k Keeper) SlashFraction(ctx sdk.Context) (res math.LegacyDec) { + return k.GetParams(ctx).SlashFraction } // SlashWindow returns # of vote period for oracle slashing func (k Keeper) SlashWindow(ctx sdk.Context) (res uint64) { - k.paramSpace.Get(ctx, types.KeySlashWindow, &res) - return + return k.GetParams(ctx).SlashWindow } // MinValidPerWindow returns oracle slashing threshold -func (k Keeper) MinValidPerWindow(ctx sdk.Context) (res sdk.Dec) { - k.paramSpace.Get(ctx, types.KeyMinValidPerWindow, &res) - return +func (k Keeper) MinValidPerWindow(ctx sdk.Context) (res math.LegacyDec) { + return k.GetParams(ctx).MinValidPerWindow } // GetParams returns the total set of oracle parameters. func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) { - k.paramSpace.GetParamSet(ctx, ¶ms) + store := ctx.KVStore(k.storeKey) + bz := store.Get(types.ParamsKey) + if bz == nil { + return params + } + + k.cdc.MustUnmarshal(bz, ¶ms) return params } // SetParams sets the total set of oracle parameters. -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramSpace.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 := k.cdc.MustMarshal(¶ms) + store.Set(types.ParamsKey, bz) + return nil } diff --git a/x/oracle/keeper/querier.go b/x/oracle/keeper/querier.go index 2fd68bbb..7e7f609e 100644 --- a/x/oracle/keeper/querier.go +++ b/x/oracle/keeper/querier.go @@ -3,6 +3,7 @@ package keeper import ( "context" + "cosmossdk.io/math" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -27,8 +28,7 @@ var _ types.QueryServer = querier{} // Params queries params of distribution module func (q querier) Params(c context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { ctx := sdk.UnwrapSDKContext(c) - var params types.Params - q.paramSpace.GetParamSet(ctx, ¶ms) + params := q.Keeper.GetParams(ctx) return &types.QueryParamsResponse{Params: params}, nil } @@ -39,12 +39,12 @@ func (q querier) ExchangeRate(c context.Context, req *types.QueryExchangeRateReq return nil, status.Error(codes.InvalidArgument, "invalid request") } - if len(req.Denom) == 0 { + if len(req.Symbol) == 0 { return nil, status.Error(codes.InvalidArgument, "empty denom") } ctx := sdk.UnwrapSDKContext(c) - exchangeRate, err := q.GetExchangeRate(ctx, req.Denom) + exchangeRate, err := q.GetExchangeRate(ctx, req.Symbol) if err != nil { return nil, err } @@ -57,7 +57,7 @@ func (q querier) ExchangeRates(c context.Context, _ *types.QueryExchangeRatesReq ctx := sdk.UnwrapSDKContext(c) var exchangeRates sdk.DecCoins - q.IterateExchangeRates(ctx, func(denom string, rate sdk.Dec) (stop bool) { + q.IterateExchangeRates(ctx, func(denom string, rate math.LegacyDec) (stop bool) { exchangeRates = append(exchangeRates, sdk.NewDecCoinFromDec(denom, rate)) return false }) @@ -70,7 +70,7 @@ func (q querier) Actives(c context.Context, _ *types.QueryActivesRequest) (*type ctx := sdk.UnwrapSDKContext(c) denoms := []string{} - q.IterateExchangeRates(ctx, func(denom string, _ sdk.Dec) (stop bool) { + q.IterateExchangeRates(ctx, func(denom string, _ math.LegacyDec) (stop bool) { denoms = append(denoms, denom) return false }) @@ -78,23 +78,6 @@ func (q querier) Actives(c context.Context, _ *types.QueryActivesRequest) (*type return &types.QueryActivesResponse{Actives: denoms}, nil } -// FeederDelegation queries the account address that the validator operator delegated oracle vote rights to -func (q querier) FeederDelegation(c context.Context, req *types.QueryFeederDelegationRequest) (*types.QueryFeederDelegationResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - valAddr, err := sdk.ValAddressFromBech32(req.ValidatorAddr) - if err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(c) - return &types.QueryFeederDelegationResponse{ - FeederAddr: q.GetFeederDelegation(ctx, valAddr).String(), - }, nil -} - // MissCounter queries oracle miss counter of a validator func (q querier) MissCounter(c context.Context, req *types.QueryMissCounterRequest) (*types.QueryMissCounterResponse, error) { if req == nil { @@ -111,77 +94,3 @@ func (q querier) MissCounter(c context.Context, req *types.QueryMissCounterReque MissCounter: q.GetMissCounter(ctx, valAddr), }, nil } - -// AggregatePrevote queries an aggregate prevote of a validator -func (q querier) AggregatePrevote(c context.Context, req *types.QueryAggregatePrevoteRequest) (*types.QueryAggregatePrevoteResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - valAddr, err := sdk.ValAddressFromBech32(req.ValidatorAddr) - if err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(c) - prevote, err := q.GetAggregateExchangeRatePrevote(ctx, valAddr) - if err != nil { - return nil, err - } - - return &types.QueryAggregatePrevoteResponse{ - AggregatePrevote: prevote, - }, nil -} - -// AggregatePrevotes queries aggregate prevotes of all validators -func (q querier) AggregatePrevotes(c context.Context, _ *types.QueryAggregatePrevotesRequest) (*types.QueryAggregatePrevotesResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - var prevotes []types.AggregateExchangeRatePrevote - q.IterateAggregateExchangeRatePrevotes(ctx, func(_ sdk.ValAddress, prevote types.AggregateExchangeRatePrevote) bool { - prevotes = append(prevotes, prevote) - return false - }) - - return &types.QueryAggregatePrevotesResponse{ - AggregatePrevotes: prevotes, - }, nil -} - -// AggregateVote queries an aggregate vote of a validator -func (q querier) AggregateVote(c context.Context, req *types.QueryAggregateVoteRequest) (*types.QueryAggregateVoteResponse, error) { - if req == nil { - return nil, status.Error(codes.InvalidArgument, "invalid request") - } - - valAddr, err := sdk.ValAddressFromBech32(req.ValidatorAddr) - if err != nil { - return nil, status.Error(codes.InvalidArgument, err.Error()) - } - - ctx := sdk.UnwrapSDKContext(c) - vote, err := q.GetAggregateExchangeRateVote(ctx, valAddr) - if err != nil { - return nil, err - } - - return &types.QueryAggregateVoteResponse{ - AggregateVote: vote, - }, nil -} - -// AggregateVotes queries aggregate votes of all validators -func (q querier) AggregateVotes(c context.Context, _ *types.QueryAggregateVotesRequest) (*types.QueryAggregateVotesResponse, error) { - ctx := sdk.UnwrapSDKContext(c) - - var votes []types.AggregateExchangeRateVote - q.IterateAggregateExchangeRateVotes(ctx, func(_ sdk.ValAddress, vote types.AggregateExchangeRateVote) bool { - votes = append(votes, vote) - return false - }) - - return &types.QueryAggregateVotesResponse{ - AggregateVotes: votes, - }, nil -} diff --git a/x/oracle/keeper/querier_test.go b/x/oracle/keeper/querier_test.go index 40a10daf..2b360e2d 100644 --- a/x/oracle/keeper/querier_test.go +++ b/x/oracle/keeper/querier_test.go @@ -1,10 +1,9 @@ package keeper import ( - "bytes" - "sort" "testing" + "cosmossdk.io/math" "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" @@ -14,10 +13,9 @@ import ( func TestQueryParams(t *testing.T) { input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) querier := NewQuerier(input.OracleKeeper) - res, err := querier.Params(ctx, &types.QueryParamsRequest{}) + res, err := querier.Params(input.Ctx, &types.QueryParamsRequest{}) require.NoError(t, err) require.Equal(t, input.OracleKeeper.GetParams(input.Ctx), res.Params) @@ -25,19 +23,18 @@ func TestQueryParams(t *testing.T) { func TestQueryExchangeRate(t *testing.T) { input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) querier := NewQuerier(input.OracleKeeper) - rate := sdk.NewDec(1700) + rate := math.LegacyNewDec(1700) input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomD, rate) // empty request - _, err := querier.ExchangeRate(ctx, nil) + _, err := querier.ExchangeRate(input.Ctx, nil) require.Error(t, err) // Query to grpc - res, err := querier.ExchangeRate(ctx, &types.QueryExchangeRateRequest{ - Denom: types.TestDenomD, + res, err := querier.ExchangeRate(input.Ctx, &types.QueryExchangeRateRequest{ + Symbol: types.TestDenomD, }) require.NoError(t, err) require.Equal(t, rate, res.ExchangeRate) @@ -45,18 +42,17 @@ func TestQueryExchangeRate(t *testing.T) { func TestQueryMissCounter(t *testing.T) { input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) querier := NewQuerier(input.OracleKeeper) missCounter := uint64(1) input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], missCounter) // empty request - _, err := querier.MissCounter(ctx, nil) + _, err := querier.MissCounter(input.Ctx, nil) require.Error(t, err) // Query to grpc - res, err := querier.MissCounter(ctx, &types.QueryMissCounterRequest{ + res, err := querier.MissCounter(input.Ctx, &types.QueryMissCounterRequest{ ValidatorAddr: ValAddrs[0].String(), }) require.NoError(t, err) @@ -65,14 +61,13 @@ func TestQueryMissCounter(t *testing.T) { func TestQueryExchangeRates(t *testing.T) { input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) querier := NewQuerier(input.OracleKeeper) - rate := sdk.NewDec(1700) + rate := math.LegacyNewDec(1700) input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomD, rate) input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomB, rate) - res, err := querier.ExchangeRates(ctx, &types.QueryExchangeRatesRequest{}) + res, err := querier.ExchangeRates(input.Ctx, &types.QueryExchangeRatesRequest{}) require.NoError(t, err) require.Equal(t, sdk.DecCoins{ @@ -83,15 +78,14 @@ func TestQueryExchangeRates(t *testing.T) { func TestQueryActives(t *testing.T) { input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) querier := NewQuerier(input.OracleKeeper) - rate := sdk.NewDec(1700) + rate := math.LegacyNewDec(1700) input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomD, rate) input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomC, rate) input.OracleKeeper.SetExchangeRate(input.Ctx, types.TestDenomB, rate) - res, err := querier.Actives(ctx, &types.QueryActivesRequest{}) + res, err := querier.Actives(input.Ctx, &types.QueryActivesRequest{}) require.NoError(t, err) targetDenoms := []string{ @@ -102,128 +96,3 @@ func TestQueryActives(t *testing.T) { require.Equal(t, targetDenoms, res.Actives) } - -func TestQueryFeederDelegation(t *testing.T) { - input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) - querier := NewQuerier(input.OracleKeeper) - - input.OracleKeeper.SetFeederDelegation(input.Ctx, ValAddrs[0], Addrs[1]) - - // empty request - _, err := querier.FeederDelegation(ctx, nil) - require.Error(t, err) - - res, err := querier.FeederDelegation(ctx, &types.QueryFeederDelegationRequest{ - ValidatorAddr: ValAddrs[0].String(), - }) - require.NoError(t, err) - - require.Equal(t, Addrs[1].String(), res.FeederAddr) -} - -func TestQueryAggregatePrevote(t *testing.T) { - input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) - querier := NewQuerier(input.OracleKeeper) - - prevote1 := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{}, ValAddrs[0], 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[0], prevote1) - prevote2 := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{}, ValAddrs[1], 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[1], prevote2) - - // validator 0 address params - res, err := querier.AggregatePrevote(ctx, &types.QueryAggregatePrevoteRequest{ - ValidatorAddr: ValAddrs[0].String(), - }) - require.NoError(t, err) - require.Equal(t, prevote1, res.AggregatePrevote) - - // empty request - _, err = querier.AggregatePrevote(ctx, nil) - require.Error(t, err) - - // validator 1 address params - res, err = querier.AggregatePrevote(ctx, &types.QueryAggregatePrevoteRequest{ - ValidatorAddr: ValAddrs[1].String(), - }) - require.NoError(t, err) - require.Equal(t, prevote2, res.AggregatePrevote) -} - -func TestQueryAggregatePrevotes(t *testing.T) { - input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) - querier := NewQuerier(input.OracleKeeper) - - prevote1 := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{}, ValAddrs[0], 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[0], prevote1) - prevote2 := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{}, ValAddrs[1], 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[1], prevote2) - prevote3 := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash{}, ValAddrs[2], 0) - input.OracleKeeper.SetAggregateExchangeRatePrevote(input.Ctx, ValAddrs[2], prevote3) - - expectedPrevotes := []types.AggregateExchangeRatePrevote{prevote1, prevote2, prevote3} - sort.SliceStable(expectedPrevotes, func(i, j int) bool { - addr1, _ := sdk.ValAddressFromBech32(expectedPrevotes[i].Voter) - addr2, _ := sdk.ValAddressFromBech32(expectedPrevotes[j].Voter) - return bytes.Compare(addr1, addr2) == -1 - }) - - res, err := querier.AggregatePrevotes(ctx, &types.QueryAggregatePrevotesRequest{}) - require.NoError(t, err) - require.Equal(t, expectedPrevotes, res.AggregatePrevotes) -} - -func TestQueryAggregateVote(t *testing.T) { - input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) - querier := NewQuerier(input.OracleKeeper) - - vote1 := types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Denom: "", ExchangeRate: sdk.OneDec()}}, ValAddrs[0]) - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, ValAddrs[0], vote1) - vote2 := types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Denom: "", ExchangeRate: sdk.OneDec()}}, ValAddrs[1]) - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, ValAddrs[1], vote2) - - // empty request - _, err := querier.AggregateVote(ctx, nil) - require.Error(t, err) - - // validator 0 address params - res, err := querier.AggregateVote(ctx, &types.QueryAggregateVoteRequest{ - ValidatorAddr: ValAddrs[0].String(), - }) - require.NoError(t, err) - require.Equal(t, vote1, res.AggregateVote) - - // validator 1 address params - res, err = querier.AggregateVote(ctx, &types.QueryAggregateVoteRequest{ - ValidatorAddr: ValAddrs[1].String(), - }) - require.NoError(t, err) - require.Equal(t, vote2, res.AggregateVote) -} - -func TestQueryAggregateVotes(t *testing.T) { - input := CreateTestInput(t) - ctx := sdk.WrapSDKContext(input.Ctx) - querier := NewQuerier(input.OracleKeeper) - - vote1 := types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Denom: "", ExchangeRate: sdk.OneDec()}}, ValAddrs[0]) - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, ValAddrs[0], vote1) - vote2 := types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Denom: "", ExchangeRate: sdk.OneDec()}}, ValAddrs[1]) - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, ValAddrs[1], vote2) - vote3 := types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{{Denom: "", ExchangeRate: sdk.OneDec()}}, ValAddrs[2]) - input.OracleKeeper.SetAggregateExchangeRateVote(input.Ctx, ValAddrs[2], vote3) - - expectedVotes := []types.AggregateExchangeRateVote{vote1, vote2, vote3} - sort.SliceStable(expectedVotes, func(i, j int) bool { - addr1, _ := sdk.ValAddressFromBech32(expectedVotes[i].Voter) - addr2, _ := sdk.ValAddressFromBech32(expectedVotes[j].Voter) - return bytes.Compare(addr1, addr2) == -1 - }) - - res, err := querier.AggregateVotes(ctx, &types.QueryAggregateVotesRequest{}) - require.NoError(t, err) - require.Equal(t, expectedVotes, res.AggregateVotes) -} diff --git a/x/oracle/keeper/reward.go b/x/oracle/keeper/reward.go deleted file mode 100644 index 380093d0..00000000 --- a/x/oracle/keeper/reward.go +++ /dev/null @@ -1,73 +0,0 @@ -package keeper - -import ( - "fmt" - - sdk "github.com/cosmos/cosmos-sdk/types" - - "github.com/Team-Kujira/core/x/oracle/types" -) - -// RewardBallotWinners implements -// at the end of every VotePeriod, give out a portion of spread fees collected in the oracle reward pool -// -// to the oracle voters that voted faithfully. -func (k Keeper) RewardBallotWinners( - ctx sdk.Context, - votePeriod int64, - rewardDistributionWindow int64, - voteTargets []string, - ballotWinners map[string]types.Claim, -) { - rewardDenoms := voteTargets - - // Sum weight of the claims - ballotPowerSum := int64(0) - for _, winner := range ballotWinners { - ballotPowerSum += winner.Weight - } - - // Exit if the ballot is empty - if ballotPowerSum == 0 { - return - } - - // The Reward distributionRatio = votePeriod/rewardDistributionWindow - distributionRatio := sdk.NewDec(votePeriod).QuoInt64(rewardDistributionWindow) - - var periodRewards sdk.DecCoins - for _, denom := range rewardDenoms { - rewardPool := k.GetRewardPool(ctx, denom) - - // return if there's no rewards to give out - if rewardPool.IsZero() { - continue - } - - periodRewards = periodRewards.Add(sdk.NewDecCoinFromDec( - denom, - sdk.NewDecFromInt(rewardPool.Amount).Mul(distributionRatio), - )) - } - - // Dole out rewards - var distributedReward sdk.Coins - for _, winner := range ballotWinners { - receiverVal := k.StakingKeeper.Validator(ctx, winner.Recipient) - - // Reflects contribution - rewardCoins, _ := periodRewards.MulDec(sdk.NewDec(winner.Weight).QuoInt64(ballotPowerSum)).TruncateDecimal() - - // In case absence of the validator, we just skip distribution - if receiverVal != nil && !rewardCoins.IsZero() { - k.distrKeeper.AllocateTokensToValidator(ctx, receiverVal, sdk.NewDecCoinsFromCoins(rewardCoins...)) - distributedReward = distributedReward.Add(rewardCoins...) - } - } - - // Move distributed reward to distribution module - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, k.distrName, distributedReward) - if err != nil { - panic(fmt.Sprintf("[oracle] Failed to send coins to distribution module %s", err.Error())) - } -} diff --git a/x/oracle/keeper/reward_test.go b/x/oracle/keeper/reward_test.go deleted file mode 100644 index 67f7a273..00000000 --- a/x/oracle/keeper/reward_test.go +++ /dev/null @@ -1,79 +0,0 @@ -package keeper - -import ( - "testing" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - - "github.com/Team-Kujira/core/x/oracle/types" -) - -// Test a reward giving mechanism -func TestRewardBallotWinners(t *testing.T) { - // initial setup - input := CreateTestInput(t) - addr, val := ValAddrs[0], ValPubKeys[0] - addr1, val1 := ValAddrs[1], ValPubKeys[1] - amt := sdk.TokensFromConsensusPower(100, sdk.DefaultPowerReduction) - sh := stakingkeeper.NewMsgServerImpl(&input.StakingKeeper) - ctx := input.Ctx - - // Validator created - _, err := sh.CreateValidator(ctx, NewTestMsgCreateValidator(addr, val, amt)) - require.NoError(t, err) - _, err = sh.CreateValidator(ctx, NewTestMsgCreateValidator(addr1, val1, amt)) - require.NoError(t, err) - staking.EndBlocker(ctx, &input.StakingKeeper) - - require.Equal( - t, input.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(addr)), - sdk.NewCoins(sdk.NewCoin(input.StakingKeeper.GetParams(ctx).BondDenom, InitTokens.Sub(amt))), - ) - require.Equal(t, amt, input.StakingKeeper.Validator(ctx, addr).GetBondedTokens()) - require.Equal( - t, input.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(addr1)), - sdk.NewCoins(sdk.NewCoin(input.StakingKeeper.GetParams(ctx).BondDenom, InitTokens.Sub(amt))), - ) - require.Equal(t, amt, input.StakingKeeper.Validator(ctx, addr1).GetBondedTokens()) - - // Add claim pools - claim := types.NewClaim(10, 10, 0, addr) - claim2 := types.NewClaim(20, 20, 0, addr1) - claims := map[string]types.Claim{ - addr.String(): claim, - addr1.String(): claim2, - } - - // Prepare reward pool - givingAmt := sdk.NewCoins(sdk.NewInt64Coin(types.TestDenomA, 30000000), sdk.NewInt64Coin(types.TestDenomB, 40000000)) - acc := input.AccountKeeper.GetModuleAccount(ctx, types.ModuleName) - err = FundAccount(input, acc.GetAddress(), givingAmt) - require.NoError(t, err) - - voteTargets := []string{ - types.TestDenomA, - types.TestDenomB, - } - - votePeriodsPerWindow := sdk.NewDec((int64)(input.OracleKeeper.RewardDistributionWindow(input.Ctx))). - QuoInt64((int64)(input.OracleKeeper.VotePeriod(input.Ctx))). - TruncateInt64() - input.OracleKeeper.RewardBallotWinners(ctx, (int64)(input.OracleKeeper.VotePeriod(input.Ctx)), (int64)(input.OracleKeeper.RewardDistributionWindow(input.Ctx)), voteTargets, claims) - outstandingRewardsDec := input.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, addr) - outstandingRewards, _ := outstandingRewardsDec.TruncateDecimal() - require.Equal(t, sdk.NewDecFromInt(givingAmt.AmountOf(types.TestDenomA)).QuoInt64(votePeriodsPerWindow).QuoInt64(3).TruncateInt(), - outstandingRewards.AmountOf(types.TestDenomA)) - require.Equal(t, sdk.NewDecFromInt(givingAmt.AmountOf(types.TestDenomB)).QuoInt64(votePeriodsPerWindow).QuoInt64(3).TruncateInt(), - outstandingRewards.AmountOf(types.TestDenomB)) - - outstandingRewardsDec1 := input.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, addr1) - outstandingRewards1, _ := outstandingRewardsDec1.TruncateDecimal() - require.Equal(t, sdk.NewDecFromInt(givingAmt.AmountOf(types.TestDenomA)).QuoInt64(votePeriodsPerWindow).QuoInt64(3).MulInt64(2).TruncateInt(), - outstandingRewards1.AmountOf(types.TestDenomA)) - require.Equal(t, sdk.NewDecFromInt(givingAmt.AmountOf(types.TestDenomB)).QuoInt64(votePeriodsPerWindow).QuoInt64(3).MulInt64(2).TruncateInt(), - outstandingRewards1.AmountOf(types.TestDenomB)) -} diff --git a/x/oracle/keeper/slash.go b/x/oracle/keeper/slash.go index 878bebf3..4a3503a4 100644 --- a/x/oracle/keeper/slash.go +++ b/x/oracle/keeper/slash.go @@ -1,6 +1,7 @@ package keeper import ( + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -9,36 +10,41 @@ func (k Keeper) SlashAndResetMissCounters(ctx sdk.Context) { height := ctx.BlockHeight() distributionHeight := height - sdk.ValidatorUpdateDelay - 1 - // slash_window / vote_period - votePeriodsPerWindow := uint64( - sdk.NewDec(int64(k.SlashWindow(ctx))). - QuoInt64(int64(k.VotePeriod(ctx))). - TruncateInt64(), - ) + slashWindow := k.SlashWindow(ctx) minValidPerWindow := k.MinValidPerWindow(ctx) slashFraction := k.SlashFraction(ctx) powerReduction := k.StakingKeeper.PowerReduction(ctx) k.IterateMissCounters(ctx, func(operator sdk.ValAddress, missCounter uint64) bool { // Calculate valid vote rate; (SlashWindow - MissCounter)/SlashWindow - validVoteRate := sdk.NewDecFromInt( - sdk.NewInt(int64(votePeriodsPerWindow - missCounter))). - QuoInt64(int64(votePeriodsPerWindow)) + validVoteRate := math.LegacyNewDecFromInt( + math.NewInt(int64(slashWindow - missCounter))). + QuoInt64(int64(slashWindow)) // Penalize the validator whose the valid vote rate is smaller than min threshold if validVoteRate.LT(minValidPerWindow) { - validator := k.StakingKeeper.Validator(ctx, operator) + validator, err := k.StakingKeeper.Validator(ctx, operator) + if err != nil { + panic(err) + } + if validator.IsBonded() && !validator.IsJailed() { consAddr, err := validator.GetConsAddr() if err != nil { panic(err) } - k.SlashingKeeper.Slash( + err = k.SlashingKeeper.Slash( ctx, consAddr, slashFraction, validator.GetConsensusPower(powerReduction), distributionHeight, ) - k.SlashingKeeper.Jail(ctx, consAddr) + if err != nil { + panic(err) + } + err = k.SlashingKeeper.Jail(ctx, consAddr) + if err != nil { + panic(err) + } } } diff --git a/x/oracle/keeper/slash_test.go b/x/oracle/keeper/slash_test.go index 86bc50fb..051eef39 100644 --- a/x/oracle/keeper/slash_test.go +++ b/x/oracle/keeper/slash_test.go @@ -6,7 +6,6 @@ import ( "github.com/stretchr/testify/require" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/staking" stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) @@ -25,38 +24,38 @@ func TestSlashAndResetMissCounters(t *testing.T) { require.NoError(t, err) _, err = sh.CreateValidator(ctx, NewTestMsgCreateValidator(addr1, val1, amt)) require.NoError(t, err) - staking.EndBlocker(ctx, &input.StakingKeeper) + input.StakingKeeper.EndBlocker(ctx) + stakingParams, _ := input.StakingKeeper.GetParams(ctx) require.Equal( t, input.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(addr)), - sdk.NewCoins(sdk.NewCoin(input.StakingKeeper.GetParams(ctx).BondDenom, InitTokens.Sub(amt))), + sdk.NewCoins(sdk.NewCoin(stakingParams.BondDenom, InitTokens.Sub(amt))), ) - require.Equal(t, amt, input.StakingKeeper.Validator(ctx, addr).GetBondedTokens()) + validatorI, _ := input.StakingKeeper.Validator(ctx, addr) + require.Equal(t, amt, validatorI.GetBondedTokens()) require.Equal( t, input.BankKeeper.GetAllBalances(ctx, sdk.AccAddress(addr1)), - sdk.NewCoins(sdk.NewCoin(input.StakingKeeper.GetParams(ctx).BondDenom, InitTokens.Sub(amt))), + sdk.NewCoins(sdk.NewCoin(stakingParams.BondDenom, InitTokens.Sub(amt))), ) - require.Equal(t, amt, input.StakingKeeper.Validator(ctx, addr1).GetBondedTokens()) - - votePeriodsPerWindow := sdk.NewDec(int64(input.OracleKeeper.SlashWindow(input.Ctx))). - QuoInt64(int64(input.OracleKeeper.VotePeriod(input.Ctx))). - TruncateInt64() + validatorI1, _ := input.StakingKeeper.Validator(ctx, addr) + require.Equal(t, amt, validatorI1.GetBondedTokens()) + slashWindow := int64(input.OracleKeeper.SlashWindow(input.Ctx)) slashFraction := input.OracleKeeper.SlashFraction(input.Ctx) - minValidVotes := input.OracleKeeper.MinValidPerWindow(input.Ctx).MulInt64(votePeriodsPerWindow).TruncateInt64() + minValidVotes := input.OracleKeeper.MinValidPerWindow(input.Ctx).MulInt64(slashWindow).TruncateInt64() // Case 1, no slash input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], - uint64(votePeriodsPerWindow-minValidVotes-1), + uint64(slashWindow-minValidVotes-1), ) input.OracleKeeper.SlashAndResetMissCounters(input.Ctx) - staking.EndBlocker(input.Ctx, &input.StakingKeeper) + input.StakingKeeper.EndBlocker(input.Ctx) validator, _ := input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) require.Equal(t, amt, validator.GetBondedTokens()) // Case 2, slash - input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes+1)) + input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], uint64(slashWindow-minValidVotes+1)) input.OracleKeeper.SlashAndResetMissCounters(input.Ctx) validator, _ = input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) require.Equal(t, amt.Sub(slashFraction.MulInt(amt).TruncateInt()), validator.GetBondedTokens()) @@ -69,7 +68,7 @@ func TestSlashAndResetMissCounters(t *testing.T) { validator.Tokens = amt input.StakingKeeper.SetValidator(input.Ctx, validator) - input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes+1)) + input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], uint64(slashWindow-minValidVotes+1)) input.OracleKeeper.SlashAndResetMissCounters(input.Ctx) validator, _ = input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) require.Equal(t, amt, validator.Tokens) @@ -82,7 +81,7 @@ func TestSlashAndResetMissCounters(t *testing.T) { validator.Tokens = amt input.StakingKeeper.SetValidator(input.Ctx, validator) - input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], uint64(votePeriodsPerWindow-minValidVotes+1)) + input.OracleKeeper.SetMissCounter(input.Ctx, ValAddrs[0], uint64(slashWindow-minValidVotes+1)) input.OracleKeeper.SlashAndResetMissCounters(input.Ctx) validator, _ = input.StakingKeeper.GetValidator(input.Ctx, ValAddrs[0]) require.Equal(t, amt, validator.Tokens) diff --git a/x/oracle/tally.go b/x/oracle/keeper/tally.go similarity index 71% rename from x/oracle/tally.go rename to x/oracle/keeper/tally.go index 2d679691..97134e1e 100644 --- a/x/oracle/tally.go +++ b/x/oracle/keeper/tally.go @@ -1,6 +1,7 @@ -package oracle +package keeper import ( + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/Team-Kujira/core/x/oracle/types" @@ -11,29 +12,29 @@ import ( // CONTRACT: pb must be sorted func Tally(_ sdk.Context, pb types.ExchangeRateBallot, - rewardBand sdk.Dec, + maxDeviation math.LegacyDec, validatorClaimMap map[string]types.Claim, missMap map[string]sdk.ValAddress, -) (sdk.Dec, error) { +) (math.LegacyDec, error) { weightedMedian, err := pb.WeightedMedian() if err != nil { - return sdk.ZeroDec(), err + return math.LegacyZeroDec(), err } standardDeviation, err := pb.StandardDeviation() if err != nil { - return sdk.ZeroDec(), err + return math.LegacyZeroDec(), err } - rewardSpread := weightedMedian.Mul(rewardBand.QuoInt64(2)) - rewardSpread = sdk.MaxDec(rewardSpread, standardDeviation) + spread := weightedMedian.Mul(maxDeviation) + spread = math.LegacyMaxDec(spread, standardDeviation) for _, vote := range pb { key := vote.Voter.String() claim := validatorClaimMap[key] // Filter ballot winners & abstain voters - if (vote.ExchangeRate.GTE(weightedMedian.Sub(rewardSpread)) && - vote.ExchangeRate.LTE(weightedMedian.Add(rewardSpread))) || + if (vote.ExchangeRate.GTE(weightedMedian.Sub(spread)) && + vote.ExchangeRate.LTE(weightedMedian.Add(spread))) || !vote.ExchangeRate.IsPositive() { claim := validatorClaimMap[key] claim.Weight += vote.Power diff --git a/x/oracle/keeper/tally_test.go b/x/oracle/keeper/tally_test.go new file mode 100644 index 00000000..8cf1735c --- /dev/null +++ b/x/oracle/keeper/tally_test.go @@ -0,0 +1,87 @@ +package keeper + +import ( + "math" + "sort" + "testing" + + sdkmath "cosmossdk.io/math" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/Team-Kujira/core/x/oracle/types" +) + +func TestOracleTally(t *testing.T) { + input, _ := setup(t) + + ballot := types.ExchangeRateBallot{} + rates, valAddrs, stakingKeeper := types.GenerateRandomTestCase() + input.OracleKeeper.StakingKeeper = stakingKeeper + for i, rate := range rates { + decExchangeRate := sdkmath.LegacyNewDecWithPrec(int64(rate*math.Pow10(OracleDecPrecision)), int64(OracleDecPrecision)) + + power := stakingAmt.QuoRaw(types.MicroUnit).Int64() + if decExchangeRate.IsZero() { + power = int64(0) + } + + vote := types.NewVoteForTally( + decExchangeRate, types.TestDenomD, valAddrs[i], power) + ballot = append(ballot, vote) + + // change power of every three validator + if i%3 == 0 { + stakingKeeper.Validators()[i].SetConsensusPower(int64(i + 1)) + } + } + + validatorClaimMap := make(map[string]types.Claim) + for _, valAddr := range valAddrs { + val, _ := stakingKeeper.Validator(input.Ctx, valAddr) + validatorClaimMap[valAddr.String()] = types.Claim{ + Power: val.GetConsensusPower(sdk.DefaultPowerReduction), + Weight: int64(0), + WinCount: int64(0), + Recipient: valAddr, + } + } + sort.Sort(ballot) + weightedMedian, _ := ballot.WeightedMedian() + standardDeviation, _ := ballot.StandardDeviation() + maxSpread := weightedMedian.Mul(input.OracleKeeper.MaxDeviation(input.Ctx)) + + if standardDeviation.GT(maxSpread) { + maxSpread = standardDeviation + } + + expectedValidatorClaimMap := make(map[string]types.Claim) + for _, valAddr := range valAddrs { + val, _ := stakingKeeper.Validator(input.Ctx, valAddr) + expectedValidatorClaimMap[valAddr.String()] = types.Claim{ + Power: val.GetConsensusPower(sdk.DefaultPowerReduction), + Weight: int64(0), + WinCount: int64(0), + Recipient: valAddr, + } + } + + for _, vote := range ballot { + if (vote.ExchangeRate.GTE(weightedMedian.Sub(maxSpread)) && + vote.ExchangeRate.LTE(weightedMedian.Add(maxSpread))) || + !vote.ExchangeRate.IsPositive() { + key := vote.Voter.String() + claim := expectedValidatorClaimMap[key] + claim.Weight += vote.Power + claim.WinCount++ + expectedValidatorClaimMap[key] = claim + } + } + + missMap := map[string]sdk.ValAddress{} + + tallyMedian, _ := Tally(input.Ctx, ballot, input.OracleKeeper.MaxDeviation(input.Ctx), validatorClaimMap, missMap) + + require.Equal(t, validatorClaimMap, expectedValidatorClaimMap) + require.Equal(t, tallyMedian.MulInt64(100).TruncateInt(), weightedMedian.MulInt64(100).TruncateInt()) +} diff --git a/x/oracle/keeper/test_utils.go b/x/oracle/keeper/test_utils.go index e0f769e9..a6b326e7 100644 --- a/x/oracle/keeper/test_utils.go +++ b/x/oracle/keeper/test_utils.go @@ -1,4 +1,4 @@ -//nolint +//nolint:all package keeper import ( @@ -7,31 +7,34 @@ import ( "github.com/Team-Kujira/core/x/oracle/types" + storemetrics "cosmossdk.io/store/metrics" + "github.com/cosmos/cosmos-sdk/runtime" + "github.com/cosmos/cosmos-sdk/std" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" auth "github.com/cosmos/cosmos-sdk/x/auth" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" bank "github.com/cosmos/cosmos-sdk/x/bank" distr "github.com/cosmos/cosmos-sdk/x/distribution" params "github.com/cosmos/cosmos-sdk/x/params" staking "github.com/cosmos/cosmos-sdk/x/staking" "github.com/stretchr/testify/require" - dbm "github.com/cometbft/cometbft-db" + "cosmossdk.io/log" "github.com/cometbft/cometbft/crypto" "github.com/cometbft/cometbft/crypto/secp256k1" - "github.com/cometbft/cometbft/libs/log" tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + + "cosmossdk.io/math" + "cosmossdk.io/store" - simparams "cosmossdk.io/simapp/params" + storetypes "cosmossdk.io/store/types" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" - "github.com/cosmos/cosmos-sdk/std" - "github.com/cosmos/cosmos-sdk/store" - storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - "github.com/cosmos/cosmos-sdk/x/auth/tx" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" @@ -57,33 +60,6 @@ var ModuleBasics = module.NewBasicManager( params.AppModuleBasic{}, ) -// MakeTestCodec nolint -func MakeTestCodec(t *testing.T) codec.Codec { - return MakeEncodingConfig(t).Codec -} - -// MakeEncodingConfig nolint -func MakeEncodingConfig(_ *testing.T) simparams.EncodingConfig { - amino := codec.NewLegacyAmino() - interfaceRegistry := codectypes.NewInterfaceRegistry() - codec := codec.NewProtoCodec(interfaceRegistry) - txCfg := tx.NewTxConfig(codec, tx.DefaultSignModes) - - std.RegisterInterfaces(interfaceRegistry) - std.RegisterLegacyAminoCodec(amino) - - ModuleBasics.RegisterLegacyAminoCodec(amino) - ModuleBasics.RegisterInterfaces(interfaceRegistry) - types.RegisterLegacyAminoCodec(amino) - types.RegisterInterfaces(interfaceRegistry) - return simparams.EncodingConfig{ - InterfaceRegistry: interfaceRegistry, - Codec: codec, - TxConfig: txCfg, - Amino: amino, - } -} - // Test addresses var ( ValPubKeys = simtestutil.CreateTestPubKeys(5) @@ -113,12 +89,13 @@ var ( } InitTokens = sdk.TokensFromConsensusPower(200, sdk.DefaultPowerReduction) - InitCoins = sdk.NewCoins(sdk.NewCoin(testdenom, InitTokens)) + InitCoins = sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, InitTokens)) OracleDecPrecision = 8 - testdenom = "testdenom" - AccountAddressPrefix = "kujira" + Bech32Prefix = "cosmos" + Bech32PrefixValAddr = Bech32Prefix + "valoper" + Bech32PrefixConsAddr = Bech32Prefix + "valcons" ) // TestInput nolint @@ -134,21 +111,27 @@ type TestInput struct { // CreateTestInput nolint func CreateTestInput(t *testing.T) TestInput { - keyAcc := sdk.NewKVStoreKey(authtypes.StoreKey) - keyBank := sdk.NewKVStoreKey(banktypes.StoreKey) - keyParams := sdk.NewKVStoreKey(paramstypes.StoreKey) - tKeyParams := sdk.NewTransientStoreKey(paramstypes.TStoreKey) - keyOracle := sdk.NewKVStoreKey(types.StoreKey) - keySlashing := sdk.NewKVStoreKey(slashingtypes.StoreKey) - keyStaking := sdk.NewKVStoreKey(stakingtypes.StoreKey) - keyDistr := sdk.NewKVStoreKey(distrtypes.StoreKey) - authority := authtypes.NewModuleAddress(govtypes.ModuleName).String() - + keyAcc := storetypes.NewKVStoreKey(authtypes.StoreKey) + keyBank := storetypes.NewKVStoreKey(banktypes.StoreKey) + keyParams := storetypes.NewKVStoreKey(paramstypes.StoreKey) + tKeyParams := storetypes.NewTransientStoreKey(paramstypes.TStoreKey) + keyOracle := storetypes.NewKVStoreKey(types.StoreKey) + keySlashing := storetypes.NewKVStoreKey(slashingtypes.StoreKey) + keyStaking := storetypes.NewKVStoreKey(stakingtypes.StoreKey) + keyDistr := storetypes.NewKVStoreKey(distrtypes.StoreKey) + logger := log.NewTestLogger(t) db := dbm.NewMemDB() - ms := store.NewCommitMultiStore(db) + ms := store.NewCommitMultiStore(db, logger, storemetrics.NewNoOpMetrics()) ctx := sdk.NewContext(ms, tmproto.Header{Time: time.Now().UTC()}, false, log.NewNopLogger()) - encodingConfig := MakeEncodingConfig(t) - appCodec, legacyAmino := encodingConfig.Codec, encodingConfig.Amino + + interfaceRegistry := codectypes.NewInterfaceRegistry() + std.RegisterInterfaces(interfaceRegistry) + authtypes.RegisterInterfaces(interfaceRegistry) + + appCodec := codec.NewProtoCodec(interfaceRegistry) + legacyAmino := codec.NewLegacyAmino() + + authority := authtypes.NewModuleAddress(govtypes.ModuleName).String() ms.MountStoreWithDB(keyAcc, storetypes.StoreTypeIAVL, db) ms.MountStoreWithDB(keyBank, storetypes.StoreTypeIAVL, db) @@ -181,46 +164,49 @@ func CreateTestInput(t *testing.T) TestInput { paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, keyParams, tKeyParams) accountKeeper := authkeeper.NewAccountKeeper( appCodec, - keyAcc, + runtime.NewKVStoreService(keyAcc), authtypes.ProtoBaseAccount, maccPerms, - AccountAddressPrefix, + authcodec.NewBech32Codec(Bech32Prefix), + Bech32Prefix, authority, ) bankKeeper := bankkeeper.NewBaseKeeper( appCodec, - keyBank, + runtime.NewKVStoreService(keyBank), accountKeeper, blackListAddrs, authority, + logger, ) - totalSupply := sdk.NewCoins(sdk.NewCoin(testdenom, InitTokens.MulRaw(int64(len(Addrs)*10)))) + totalSupply := sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, InitTokens.MulRaw(int64(len(Addrs)*10)))) bankKeeper.MintCoins(ctx, faucetAccountName, totalSupply) stakingKeeper := stakingkeeper.NewKeeper( appCodec, - keyStaking, + runtime.NewKVStoreService(keyStaking), accountKeeper, bankKeeper, authority, + authcodec.NewBech32Codec(Bech32PrefixValAddr), + authcodec.NewBech32Codec(Bech32PrefixConsAddr), ) stakingParams := stakingtypes.DefaultParams() - stakingParams.BondDenom = testdenom stakingKeeper.SetParams(ctx, stakingParams) slashingKeeper := slashingkeeper.NewKeeper( appCodec, legacyAmino, - keySlashing, + runtime.NewKVStoreService(keySlashing), stakingKeeper, authority, ) distrKeeper := distrkeeper.NewKeeper( appCodec, - keyDistr, + runtime.NewKVStoreService(keyDistr), accountKeeper, bankKeeper, stakingKeeper, @@ -228,30 +214,17 @@ func CreateTestInput(t *testing.T) TestInput { authority, ) - distrKeeper.SetFeePool(ctx, distrtypes.InitialFeePool()) + distrKeeper.FeePool.Set(ctx, distrtypes.InitialFeePool()) distrParams := distrtypes.DefaultParams() - distrParams.CommunityTax = sdk.NewDecWithPrec(2, 2) - distrParams.BaseProposerReward = sdk.NewDecWithPrec(1, 2) - distrParams.BonusProposerReward = sdk.NewDecWithPrec(4, 2) - distrKeeper.SetParams(ctx, distrParams) + distrParams.CommunityTax = math.LegacyNewDecWithPrec(2, 2) + distrParams.BaseProposerReward = math.LegacyNewDecWithPrec(1, 2) + distrParams.BonusProposerReward = math.LegacyNewDecWithPrec(4, 2) + distrKeeper.Params.Set(ctx, distrParams) stakingKeeper.SetHooks(stakingtypes.NewMultiStakingHooks(distrKeeper.Hooks())) - feeCollectorAcc := authtypes.NewEmptyModuleAccount(authtypes.FeeCollectorName) - notBondedPool := authtypes.NewEmptyModuleAccount(stakingtypes.NotBondedPoolName, authtypes.Burner, authtypes.Staking) - bondPool := authtypes.NewEmptyModuleAccount(stakingtypes.BondedPoolName, authtypes.Burner, authtypes.Staking) - distrAcc := authtypes.NewEmptyModuleAccount(distrtypes.ModuleName) - oracleAcc := authtypes.NewEmptyModuleAccount(types.ModuleName, authtypes.Minter) - - bankKeeper.SendCoinsFromModuleToModule(ctx, faucetAccountName, stakingtypes.NotBondedPoolName, sdk.NewCoins(sdk.NewCoin(testdenom, InitTokens.MulRaw(int64(len(Addrs)))))) - - accountKeeper.SetModuleAccount(ctx, feeCollectorAcc) - accountKeeper.SetModuleAccount(ctx, bondPool) - accountKeeper.SetModuleAccount(ctx, notBondedPool) - accountKeeper.SetModuleAccount(ctx, distrAcc) - accountKeeper.SetModuleAccount(ctx, oracleAcc) + bankKeeper.SendCoinsFromModuleToModule(ctx, faucetAccountName, stakingtypes.NotBondedPoolName, sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, InitTokens.MulRaw(int64(len(Addrs)))))) for _, addr := range Addrs { - accountKeeper.SetAccount(ctx, authtypes.NewBaseAccountWithAddress(addr)) err := bankKeeper.SendCoinsFromModuleToAccount(ctx, faucetAccountName, addr, InitCoins) require.NoError(t, err) } @@ -266,20 +239,27 @@ func CreateTestInput(t *testing.T) TestInput { slashingKeeper, stakingKeeper, distrtypes.ModuleName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), ) defaults := types.DefaultParams() + defaults.RequiredSymbols = []types.Symbol{ + {Symbol: "BTC", Id: 1}, + {Symbol: "ETH", Id: 2}, + {Symbol: "USDT", Id: 3}, + } + defaults.LastSymbolId = 3 keeper.SetParams(ctx, defaults) return TestInput{ctx, legacyAmino, accountKeeper, bankKeeper, keeper, *stakingKeeper, distrKeeper} } // NewTestMsgCreateValidator test msg creator -func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey cryptotypes.PubKey, amt sdk.Int) *stakingtypes.MsgCreateValidator { - commission := stakingtypes.NewCommissionRates(sdk.ZeroDec(), sdk.ZeroDec(), sdk.ZeroDec()) +func NewTestMsgCreateValidator(address sdk.ValAddress, pubKey cryptotypes.PubKey, amt math.Int) *stakingtypes.MsgCreateValidator { + commission := stakingtypes.NewCommissionRates(math.LegacyZeroDec(), math.LegacyZeroDec(), math.LegacyZeroDec()) msg, _ := stakingtypes.NewMsgCreateValidator( - address, pubKey, sdk.NewCoin(testdenom, amt), - stakingtypes.Description{}, commission, sdk.OneInt(), + address.String(), pubKey, sdk.NewCoin(sdk.DefaultBondDenom, amt), + stakingtypes.Description{Moniker: "moniker"}, commission, math.OneInt(), ) return msg diff --git a/x/oracle/migrations/v1/migrate.go b/x/oracle/migrations/v1/migrate.go new file mode 100644 index 00000000..61882888 --- /dev/null +++ b/x/oracle/migrations/v1/migrate.go @@ -0,0 +1,56 @@ +package v1 + +import ( + "cosmossdk.io/math" + "cosmossdk.io/store" + oracletypes "github.com/Team-Kujira/core/x/oracle/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" + paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" +) + +func MigrateParams( + ctx sdk.Context, + store store.KVStore, + subspace paramtypes.Subspace, + cdc codec.BinaryCodec, +) error { + var ( + voteThreshold math.LegacyDec + rewardBand math.LegacyDec + whitelist oracletypes.DenomList + slashFraction math.LegacyDec + slashWindow uint64 + minValidPerWindow math.LegacyDec + ) + + subspace.Get(ctx, []byte("VoteThreshold"), &voteThreshold) + subspace.Get(ctx, []byte("RewardBand"), &rewardBand) + subspace.Get(ctx, []byte("Whitelist"), &whitelist) + subspace.Get(ctx, []byte("SlashFraction"), &slashFraction) + subspace.Get(ctx, []byte("SlashWindow"), &slashWindow) + subspace.Get(ctx, []byte("MinValidPerWindow"), &minValidPerWindow) + + symbols := []oracletypes.Symbol{} + for id, denom := range whitelist { + symbols = append(symbols, oracletypes.Symbol{ + Id: uint32(id + 1), + Symbol: denom.Name, + }) + } + + oracleParams := oracletypes.Params{ + VoteThreshold: voteThreshold, + MaxDeviation: rewardBand, + RequiredSymbols: symbols, + LastSymbolId: uint32(len(symbols)), + SlashFraction: slashFraction, + SlashWindow: slashWindow, + MinValidPerWindow: minValidPerWindow, + } + + bz := cdc.MustMarshal(&oracleParams) + store.Set(oracletypes.ParamsKey, bz) + + return nil +} diff --git a/x/oracle/module.go b/x/oracle/module.go index c6afd951..e5a72242 100644 --- a/x/oracle/module.go +++ b/x/oracle/module.go @@ -11,6 +11,7 @@ import ( abci "github.com/cometbft/cometbft/abci/types" + "cosmossdk.io/core/appmodule" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" codectypes "github.com/cosmos/cosmos-sdk/codec/types" @@ -28,8 +29,11 @@ var ( _ module.AppModule = AppModule{} _ module.AppModuleBasic = AppModuleBasic{} _ module.AppModuleSimulation = AppModule{} + _ appmodule.HasEndBlocker = AppModule{} ) +const ConsensusVersion = 2 + // AppModuleBasic defines the basic application module used by the oracle module. type AppModuleBasic struct { cdc codec.Codec @@ -113,6 +117,12 @@ func NewAppModule( // Name returns the oracle module's name. func (AppModule) Name() string { return types.ModuleName } +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (AppModule) IsAppModule() {} + // RegisterInvariants performs a no-op. func (AppModule) RegisterInvariants(_ sdk.InvariantRegistry) {} @@ -124,6 +134,12 @@ func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) querier := keeper.NewQuerier(am.keeper) types.RegisterQueryServer(cfg.QueryServer(), querier) + + m := keeper.NewMigrator(am.keeper, am.keeper.GetSubspace()) + + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(fmt.Sprintf("failed to migrate x/%s from version 1 to 2: %v", types.ModuleName, err)) + } } // InitGenesis performs genesis initialization for the oracle module. It returns @@ -144,15 +160,13 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw } // ConsensusVersion implements AppModule/ConsensusVersion. -func (AppModule) ConsensusVersion() uint64 { return 1 } - -// BeginBlock returns the begin blocker for the oracle module. -func (AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} +func (AppModule) ConsensusVersion() uint64 { return ConsensusVersion } // EndBlock returns the end blocker for the oracle module. -func (am AppModule) EndBlock(ctx sdk.Context, _ abci.RequestEndBlock) []abci.ValidatorUpdate { - EndBlocker(ctx, am.keeper) //nolint:errcheck - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + am.keeper.EndBlocker(sdkCtx) //nolint:errcheck + return nil } //____________________________________________________________________________ @@ -171,7 +185,7 @@ func (am AppModule) ProposalContents(_ module.SimulationState) []simtypes.Weight } // RegisterStoreDecoder registers a decoder for oracle module's types -func (am AppModule) RegisterStoreDecoder(sdr sdk.StoreDecoderRegistry) { +func (am AppModule) RegisterStoreDecoder(sdr simtypes.StoreDecoderRegistry) { sdr[types.StoreKey] = simulation.NewDecodeStore(am.cdc) } diff --git a/x/oracle/simulation/decoder.go b/x/oracle/simulation/decoder.go index bf81a474..8fd0a681 100644 --- a/x/oracle/simulation/decoder.go +++ b/x/oracle/simulation/decoder.go @@ -23,23 +23,11 @@ func NewDecodeStore(cdc codec.Codec) func(kvA, kvB kv.Pair) string { cdc.MustUnmarshal(kvA.Value, &exchangeRateA) cdc.MustUnmarshal(kvB.Value, &exchangeRateB) return fmt.Sprintf("%v\n%v", exchangeRateA, exchangeRateB) - case bytes.Equal(kvA.Key[:1], types.FeederDelegationKey): - return fmt.Sprintf("%v\n%v", sdk.AccAddress(kvA.Value), sdk.AccAddress(kvB.Value)) case bytes.Equal(kvA.Key[:1], types.MissCounterKey): var counterA, counterB gogotypes.UInt64Value cdc.MustUnmarshal(kvA.Value, &counterA) cdc.MustUnmarshal(kvB.Value, &counterB) return fmt.Sprintf("%v\n%v", counterA.Value, counterB.Value) - case bytes.Equal(kvA.Key[:1], types.AggregateExchangeRatePrevoteKey): - var prevoteA, prevoteB types.AggregateExchangeRatePrevote - cdc.MustUnmarshal(kvA.Value, &prevoteA) - cdc.MustUnmarshal(kvB.Value, &prevoteB) - return fmt.Sprintf("%v\n%v", prevoteA, prevoteB) - case bytes.Equal(kvA.Key[:1], types.AggregateExchangeRateVoteKey): - var voteA, voteB types.AggregateExchangeRateVote - cdc.MustUnmarshal(kvA.Value, &voteA) - cdc.MustUnmarshal(kvB.Value, &voteB) - return fmt.Sprintf("%v\n%v", voteA, voteB) default: panic(fmt.Sprintf("invalid oracle key prefix %X", kvA.Key[:1])) } diff --git a/x/oracle/simulation/decoder_test.go b/x/oracle/simulation/decoder_test.go index 047d5a57..a7e8f040 100644 --- a/x/oracle/simulation/decoder_test.go +++ b/x/oracle/simulation/decoder_test.go @@ -4,15 +4,19 @@ import ( "fmt" "testing" + "cosmossdk.io/math" gogotypes "github.com/cosmos/gogoproto/types" "github.com/stretchr/testify/require" "github.com/cometbft/cometbft/crypto/ed25519" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/kv" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - "github.com/Team-Kujira/core/x/oracle/keeper" sim "github.com/Team-Kujira/core/x/oracle/simulation" "github.com/Team-Kujira/core/x/oracle/types" ) @@ -26,25 +30,20 @@ var ( ) func TestDecodeDistributionStore(t *testing.T) { - cdc := keeper.MakeTestCodec(t) + interfaceRegistry := codectypes.NewInterfaceRegistry() + std.RegisterInterfaces(interfaceRegistry) + authtypes.RegisterInterfaces(interfaceRegistry) + + cdc := codec.NewProtoCodec(interfaceRegistry) dec := sim.NewDecodeStore(cdc) - exchangeRate := sdk.NewDecWithPrec(1234, 1) + exchangeRate := math.LegacyNewDecWithPrec(1234, 1) missCounter := uint64(23) - aggregatePrevote := types.NewAggregateExchangeRatePrevote(types.AggregateVoteHash([]byte("12345")), valAddr, 123) - aggregateVote := types.NewAggregateExchangeRateVote(types.ExchangeRateTuples{ - {Denom: denomA, ExchangeRate: sdk.NewDecWithPrec(1234, 1)}, - {Denom: denomB, ExchangeRate: sdk.NewDecWithPrec(4321, 1)}, - }, valAddr) - kvPairs := kv.Pairs{ Pairs: []kv.Pair{ {Key: types.ExchangeRateKey, Value: cdc.MustMarshal(&sdk.DecProto{Dec: exchangeRate})}, - {Key: types.FeederDelegationKey, Value: feederAddr.Bytes()}, {Key: types.MissCounterKey, Value: cdc.MustMarshal(&gogotypes.UInt64Value{Value: missCounter})}, - {Key: types.AggregateExchangeRatePrevoteKey, Value: cdc.MustMarshal(&aggregatePrevote)}, - {Key: types.AggregateExchangeRateVoteKey, Value: cdc.MustMarshal(&aggregateVote)}, {Key: []byte{0x99}, Value: []byte{0x99}}, }, } @@ -54,10 +53,7 @@ func TestDecodeDistributionStore(t *testing.T) { expectedLog string }{ {"ExchangeRate", fmt.Sprintf("%v\n%v", exchangeRate, exchangeRate)}, - {"FeederDelegation", fmt.Sprintf("%v\n%v", feederAddr, feederAddr)}, {"MissCounter", fmt.Sprintf("%v\n%v", missCounter, missCounter)}, - {"AggregatePrevote", fmt.Sprintf("%v\n%v", aggregatePrevote, aggregatePrevote)}, - {"AggregateVote", fmt.Sprintf("%v\n%v", aggregateVote, aggregateVote)}, {"other", ""}, } diff --git a/x/oracle/simulation/genesis.go b/x/oracle/simulation/genesis.go index af36c090..75441ec7 100644 --- a/x/oracle/simulation/genesis.go +++ b/x/oracle/simulation/genesis.go @@ -7,7 +7,7 @@ import ( "fmt" "math/rand" - sdk "github.com/cosmos/cosmos-sdk/types" + "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/types/module" "github.com/Team-Kujira/core/x/oracle/types" @@ -30,13 +30,13 @@ func GenVotePeriod(r *rand.Rand) uint64 { } // GenVoteThreshold randomized VoteThreshold -func GenVoteThreshold(r *rand.Rand) sdk.Dec { - return sdk.NewDecWithPrec(333, 3).Add(sdk.NewDecWithPrec(int64(r.Intn(333)), 3)) +func GenVoteThreshold(r *rand.Rand) math.LegacyDec { + return math.LegacyNewDecWithPrec(333, 3).Add(math.LegacyNewDecWithPrec(int64(r.Intn(333)), 3)) } -// GenRewardBand randomized RewardBand -func GenRewardBand(r *rand.Rand) sdk.Dec { - return sdk.ZeroDec().Add(sdk.NewDecWithPrec(int64(r.Intn(100)), 3)) +// GenMaxDeviation randomized MaxDeviation +func GenMaxDeviation(r *rand.Rand) math.LegacyDec { + return math.LegacyZeroDec().Add(math.LegacyNewDecWithPrec(int64(r.Intn(100)), 3)) } // GenRewardDistributionWindow randomized RewardDistributionWindow @@ -45,8 +45,8 @@ func GenRewardDistributionWindow(r *rand.Rand) uint64 { } // GenSlashFraction randomized SlashFraction -func GenSlashFraction(r *rand.Rand) sdk.Dec { - return sdk.ZeroDec().Add(sdk.NewDecWithPrec(int64(r.Intn(100)), 3)) +func GenSlashFraction(r *rand.Rand) math.LegacyDec { + return math.LegacyZeroDec().Add(math.LegacyNewDecWithPrec(int64(r.Intn(100)), 3)) } // GenSlashWindow randomized SlashWindow @@ -55,70 +55,59 @@ func GenSlashWindow(r *rand.Rand) uint64 { } // GenMinValidPerWindow randomized MinValidPerWindow -func GenMinValidPerWindow(r *rand.Rand) sdk.Dec { - return sdk.ZeroDec().Add(sdk.NewDecWithPrec(int64(r.Intn(500)), 3)) +func GenMinValidPerWindow(r *rand.Rand) math.LegacyDec { + return math.LegacyZeroDec().Add(math.LegacyNewDecWithPrec(int64(r.Intn(500)), 3)) } // RandomizedGenState generates a random GenesisState for oracle func RandomizedGenState(simState *module.SimulationState) { var votePeriod uint64 simState.AppParams.GetOrGenerate( - simState.Cdc, votePeriodKey, &votePeriod, simState.Rand, + votePeriodKey, &votePeriod, simState.Rand, func(r *rand.Rand) { votePeriod = GenVotePeriod(r) }, ) - var voteThreshold sdk.Dec + var voteThreshold math.LegacyDec simState.AppParams.GetOrGenerate( - simState.Cdc, voteThresholdKey, &voteThreshold, simState.Rand, + voteThresholdKey, &voteThreshold, simState.Rand, func(r *rand.Rand) { voteThreshold = GenVoteThreshold(r) }, ) - var rewardBand sdk.Dec + var maxDeviation math.LegacyDec simState.AppParams.GetOrGenerate( - simState.Cdc, rewardBandKey, &rewardBand, simState.Rand, - func(r *rand.Rand) { rewardBand = GenRewardBand(r) }, + rewardBandKey, &maxDeviation, simState.Rand, + func(r *rand.Rand) { maxDeviation = GenMaxDeviation(r) }, ) - var rewardDistributionWindow uint64 + var slashFraction math.LegacyDec simState.AppParams.GetOrGenerate( - simState.Cdc, rewardDistributionWindowKey, &rewardDistributionWindow, simState.Rand, - func(r *rand.Rand) { rewardDistributionWindow = GenRewardDistributionWindow(r) }, - ) - - var slashFraction sdk.Dec - simState.AppParams.GetOrGenerate( - simState.Cdc, slashFractionKey, &slashFraction, simState.Rand, + slashFractionKey, &slashFraction, simState.Rand, func(r *rand.Rand) { slashFraction = GenSlashFraction(r) }, ) var slashWindow uint64 simState.AppParams.GetOrGenerate( - simState.Cdc, slashWindowKey, &slashWindow, simState.Rand, + slashWindowKey, &slashWindow, simState.Rand, func(r *rand.Rand) { slashWindow = GenSlashWindow(r) }, ) - var minValidPerWindow sdk.Dec + var minValidPerWindow math.LegacyDec simState.AppParams.GetOrGenerate( - simState.Cdc, minValidPerWindowKey, &minValidPerWindow, simState.Rand, + minValidPerWindowKey, &minValidPerWindow, simState.Rand, func(r *rand.Rand) { minValidPerWindow = GenMinValidPerWindow(r) }, ) oracleGenesis := types.NewGenesisState( types.Params{ - VotePeriod: votePeriod, - VoteThreshold: voteThreshold, - RewardBand: rewardBand, - RewardDistributionWindow: rewardDistributionWindow, - Whitelist: types.DenomList{}, - SlashFraction: slashFraction, - SlashWindow: slashWindow, - MinValidPerWindow: minValidPerWindow, + VoteThreshold: voteThreshold, + MaxDeviation: maxDeviation, + RequiredSymbols: []types.Symbol{}, + SlashFraction: slashFraction, + SlashWindow: slashWindow, + MinValidPerWindow: minValidPerWindow, }, []types.ExchangeRateTuple{}, - []types.FeederDelegation{}, []types.MissCounter{}, - []types.AggregateExchangeRatePrevote{}, - []types.AggregateExchangeRateVote{}, ) bz, err := json.MarshalIndent(&oracleGenesis.Params, "", " ") diff --git a/x/oracle/simulation/operations.go b/x/oracle/simulation/operations.go index df18df81..b5eb0224 100644 --- a/x/oracle/simulation/operations.go +++ b/x/oracle/simulation/operations.go @@ -3,268 +3,25 @@ package simulation // DONTCOVER import ( - "math/rand" - "strings" - - simappparams "cosmossdk.io/simapp/params" "github.com/Team-Kujira/core/x/oracle/keeper" "github.com/Team-Kujira/core/x/oracle/types" - "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/codec" - simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" - sdk "github.com/cosmos/cosmos-sdk/types" simtypes "github.com/cosmos/cosmos-sdk/types/simulation" "github.com/cosmos/cosmos-sdk/x/simulation" ) -// Simulation operation weights constants -// -//nolint:gosec //these aren't hard coded credentials -const ( - OpWeightMsgAggregateExchangeRatePrevote = "op_weight_msg_exchange_rate_aggregate_prevote" - OpWeightMsgAggregateExchangeRateVote = "op_weight_msg_exchange_rate_aggregate_vote" - OpWeightMsgDelegateFeedConsent = "op_weight_msg_exchange_feed_consent" - - salt = "fc5bb0bc63e54b2918d9334bf3259f5dc575e8d7a4df4e836dd80f1ad62aa89b" -) - var ( - whitelist = []string{types.TestDenomA, types.TestDenomB, types.TestDenomC} - voteHashMap = make(map[string]string) DefaultWeightMsgSend = 100 DefaultWeightMsgSetWithdrawAddress = 50 ) // WeightedOperations returns all the operations from the module with their respective weights func WeightedOperations( - appParams simtypes.AppParams, - cdc codec.JSONCodec, - ak types.AccountKeeper, - bk types.BankKeeper, - k keeper.Keeper, + _ simtypes.AppParams, + _ codec.JSONCodec, + _ types.AccountKeeper, + _ types.BankKeeper, + _ keeper.Keeper, ) simulation.WeightedOperations { - var ( - weightMsgAggregateExchangeRatePrevote int - weightMsgAggregateExchangeRateVote int - weightMsgDelegateFeedConsent int - ) - appParams.GetOrGenerate(cdc, OpWeightMsgAggregateExchangeRatePrevote, &weightMsgAggregateExchangeRatePrevote, nil, - func(_ *rand.Rand) { - weightMsgAggregateExchangeRatePrevote = DefaultWeightMsgSend * 2 - }, - ) - - appParams.GetOrGenerate(cdc, OpWeightMsgAggregateExchangeRateVote, &weightMsgAggregateExchangeRateVote, nil, - func(_ *rand.Rand) { - weightMsgAggregateExchangeRateVote = DefaultWeightMsgSend * 2 - }, - ) - - appParams.GetOrGenerate(cdc, OpWeightMsgDelegateFeedConsent, &weightMsgDelegateFeedConsent, nil, - func(_ *rand.Rand) { - weightMsgDelegateFeedConsent = DefaultWeightMsgSetWithdrawAddress - }, - ) - - return simulation.WeightedOperations{ - simulation.NewWeightedOperation( - weightMsgAggregateExchangeRatePrevote, - SimulateMsgAggregateExchangeRatePrevote(ak, bk, k), - ), - simulation.NewWeightedOperation( - weightMsgAggregateExchangeRateVote, - SimulateMsgAggregateExchangeRateVote(ak, bk, k), - ), - simulation.NewWeightedOperation( - weightMsgDelegateFeedConsent, - SimulateMsgDelegateFeedConsent(ak, bk, k), - ), - } -} - -// SimulateMsgAggregateExchangeRatePrevote generates a MsgAggregateExchangeRatePrevote with random values. -func SimulateMsgAggregateExchangeRatePrevote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { - return func( - r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - address := sdk.ValAddress(simAccount.Address) - - // ensure the validator exists - val := k.StakingKeeper.Validator(ctx, address) - if val == nil || !val.IsBonded() { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRatePrevote, "unable to find validator"), nil, nil - } - - exchangeRatesStr := "" - for _, denom := range whitelist { - price := sdk.NewDecWithPrec(int64(simtypes.RandIntBetween(r, 1, 10000)), int64(1)) - exchangeRatesStr += price.String() + denom + "," - } - - exchangeRatesStr = strings.TrimRight(exchangeRatesStr, ",") - voteHash := types.GetAggregateVoteHash(salt, exchangeRatesStr, address) - - feederAddr := k.GetFeederDelegation(ctx, address) - feederSimAccount, _ := simtypes.FindAccount(accs, feederAddr) - - feederAccount := ak.GetAccount(ctx, feederAddr) - spendable := bk.SpendableCoins(ctx, feederAccount.GetAddress()) - - fees, err := simtypes.RandomFees(r, ctx, spendable) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRatePrevote, "unable to generate fees"), nil, err - } - - msg := types.NewMsgAggregateExchangeRatePrevote(voteHash, feederAddr, address) - - txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := simtestutil.GenSignedMockTx( - r, - txGen, - []sdk.Msg{msg}, - fees, - simtestutil.DefaultGenTxGas, - chainID, - []uint64{feederAccount.GetAccountNumber()}, - []uint64{feederAccount.GetSequence()}, - feederSimAccount.PrivKey, - ) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err - } - - _, _, err = app.SimDeliver(txGen.TxEncoder(), tx) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to deliver tx"), nil, err - } - - voteHashMap[address.String()] = exchangeRatesStr - - return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil - } -} - -// SimulateMsgAggregateExchangeRateVote generates a MsgAggregateExchangeRateVote with random values. -func SimulateMsgAggregateExchangeRateVote(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { - return func( - r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - address := sdk.ValAddress(simAccount.Address) - - // ensure the validator exists - val := k.StakingKeeper.Validator(ctx, address) - if val == nil || !val.IsBonded() { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRateVote, "unable to find validator"), nil, nil - } - - // ensure vote hash exists - exchangeRatesStr, ok := voteHashMap[address.String()] - if !ok { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRateVote, "vote hash not exists"), nil, nil - } - - // get prevote - prevote, err := k.GetAggregateExchangeRatePrevote(ctx, address) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRateVote, "prevote not found"), nil, nil - } - - params := k.GetParams(ctx) - if (uint64(ctx.BlockHeight())/params.VotePeriod)-(prevote.SubmitBlock/params.VotePeriod) != 1 { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRateVote, "reveal period of submitted vote do not match with registered prevote"), nil, nil - } - - feederAddr := k.GetFeederDelegation(ctx, address) - feederSimAccount, _ := simtypes.FindAccount(accs, feederAddr) - feederAccount := ak.GetAccount(ctx, feederAddr) - spendableCoins := bk.SpendableCoins(ctx, feederAddr) - - fees, err := simtypes.RandomFees(r, ctx, spendableCoins) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRateVote, "unable to generate fees"), nil, err - } - - msg := types.NewMsgAggregateExchangeRateVote(salt, exchangeRatesStr, feederAddr, address) - - txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := simtestutil.GenSignedMockTx( - r, - txGen, - []sdk.Msg{msg}, - fees, - simtestutil.DefaultGenTxGas, - chainID, - []uint64{feederAccount.GetAccountNumber()}, - []uint64{feederAccount.GetSequence()}, - feederSimAccount.PrivKey, - ) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err - } - - _, _, err = app.SimDeliver(txGen.TxEncoder(), tx) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to deliver tx"), nil, err - } - - return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil - } -} - -// SimulateMsgDelegateFeedConsent generates a MsgDelegateFeedConsent with random values. -func SimulateMsgDelegateFeedConsent(ak types.AccountKeeper, bk types.BankKeeper, k keeper.Keeper) simtypes.Operation { - return func( - r *rand.Rand, app *baseapp.BaseApp, ctx sdk.Context, accs []simtypes.Account, chainID string, - ) (simtypes.OperationMsg, []simtypes.FutureOperation, error) { - simAccount, _ := simtypes.RandomAcc(r, accs) - delegateAccount, _ := simtypes.RandomAcc(r, accs) - valAddress := sdk.ValAddress(simAccount.Address) - delegateValAddress := sdk.ValAddress(delegateAccount.Address) - account := ak.GetAccount(ctx, simAccount.Address) - - // ensure the validator exists - val := k.StakingKeeper.Validator(ctx, valAddress) - if val == nil { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgDelegateFeedConsent, "unable to find validator"), nil, nil - } - - // ensure the target address is not a validator - val2 := k.StakingKeeper.Validator(ctx, delegateValAddress) - if val2 != nil { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgDelegateFeedConsent, "unable to delegate to validator"), nil, nil - } - - spendableCoins := bk.SpendableCoins(ctx, account.GetAddress()) - fees, err := simtypes.RandomFees(r, ctx, spendableCoins) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, types.TypeMsgAggregateExchangeRateVote, "unable to generate fees"), nil, err - } - - msg := types.NewMsgDelegateFeedConsent(valAddress, delegateAccount.Address) - - txGen := simappparams.MakeTestEncodingConfig().TxConfig - tx, err := simtestutil.GenSignedMockTx( - r, - txGen, - []sdk.Msg{msg}, - fees, - simtestutil.DefaultGenTxGas, - chainID, - []uint64{account.GetAccountNumber()}, - []uint64{account.GetSequence()}, - simAccount.PrivKey, - ) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to generate mock tx"), nil, err - } - - _, _, err = app.SimDeliver(txGen.TxEncoder(), tx) - if err != nil { - return simtypes.NoOpMsg(types.ModuleName, msg.Type(), "unable to deliver tx"), nil, err - } - - return simtypes.NewOperationMsg(msg, true, "", nil), nil, nil - } + return simulation.WeightedOperations{} } diff --git a/x/oracle/simulation/params.go b/x/oracle/simulation/params.go index d7886b75..2568e4f8 100644 --- a/x/oracle/simulation/params.go +++ b/x/oracle/simulation/params.go @@ -16,24 +16,14 @@ import ( // on the simulation func ParamChanges(_ *rand.Rand) []simtypes.LegacyParamChange { return []simtypes.LegacyParamChange{ - simulation.NewSimLegacyParamChange(types.ModuleName, string(types.KeyVotePeriod), - func(r *rand.Rand) string { - return fmt.Sprintf("\"%d\"", GenVotePeriod(r)) - }, - ), simulation.NewSimLegacyParamChange(types.ModuleName, string(types.KeyVoteThreshold), func(r *rand.Rand) string { return fmt.Sprintf("\"%s\"", GenVoteThreshold(r)) }, ), - simulation.NewSimLegacyParamChange(types.ModuleName, string(types.KeyRewardBand), - func(r *rand.Rand) string { - return fmt.Sprintf("\"%s\"", GenRewardBand(r)) - }, - ), - simulation.NewSimLegacyParamChange(types.ModuleName, string(types.KeyRewardDistributionWindow), + simulation.NewSimLegacyParamChange(types.ModuleName, string(types.KeyMaxDeviation), func(r *rand.Rand) string { - return fmt.Sprintf("\"%d\"", GenRewardDistributionWindow(r)) + return fmt.Sprintf("\"%s\"", GenMaxDeviation(r)) }, ), simulation.NewSimLegacyParamChange(types.ModuleName, string(types.KeySlashFraction), diff --git a/x/oracle/tally_fuzz_test.go b/x/oracle/tally_fuzz_test.go index 4217fde7..dda37f20 100644 --- a/x/oracle/tally_fuzz_test.go +++ b/x/oracle/tally_fuzz_test.go @@ -4,13 +4,14 @@ import ( "sort" "testing" + "cosmossdk.io/math" fuzz "github.com/google/gofuzz" "github.com/stretchr/testify/require" "github.com/cosmos/cosmos-sdk/crypto/keys/secp256k1" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/Team-Kujira/core/x/oracle" + "github.com/Team-Kujira/core/x/oracle/keeper" "github.com/Team-Kujira/core/x/oracle/types" ) @@ -18,8 +19,8 @@ func TestFuzz_Tally(t *testing.T) { validators := map[string]int64{} f := fuzz.New().NilChance(0).Funcs( - func(e *sdk.Dec, c fuzz.Continue) { - *e = sdk.NewDec(c.Int63()) + func(e *math.LegacyDec, c fuzz.Continue) { + *e = math.LegacyNewDec(c.Int63()) }, func(e *map[string]int64, c fuzz.Continue) { numValidators := c.Intn(100) + 5 @@ -40,7 +41,7 @@ func TestFuzz_Tally(t *testing.T) { for addr, power := range validators { addr, _ := sdk.ValAddressFromBech32(addr) - var rate sdk.Dec + var rate math.LegacyDec c.Fuzz(&rate) ballot = append(ballot, types.NewVoteForTally(rate, c.RandString(), addr, power)) @@ -63,12 +64,12 @@ func TestFuzz_Tally(t *testing.T) { ballot := types.ExchangeRateBallot{} f.Fuzz(&ballot) - var rewardBand sdk.Dec + var rewardBand math.LegacyDec f.Fuzz(&rewardBand) missMap := map[string]sdk.ValAddress{} require.NotPanics(t, func() { - oracle.Tally(input.Ctx, ballot, rewardBand, claimMap, missMap) + keeper.Tally(input.Ctx, ballot, rewardBand, claimMap, missMap) }) } diff --git a/x/oracle/types/ballot.go b/x/oracle/types/ballot.go index 75469d3a..c3ed20b8 100644 --- a/x/oracle/types/ballot.go +++ b/x/oracle/types/ballot.go @@ -3,6 +3,7 @@ package types import ( "sort" + "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -12,13 +13,13 @@ import ( // VoteForTally is a convenience wrapper to reduce redundant lookup cost type VoteForTally struct { Denom string - ExchangeRate sdk.Dec + ExchangeRate math.LegacyDec Voter sdk.ValAddress Power int64 } // NewVoteForTally returns a new VoteForTally instance -func NewVoteForTally(rate sdk.Dec, denom string, voter sdk.ValAddress, power int64) VoteForTally { +func NewVoteForTally(rate math.LegacyDec, denom string, voter sdk.ValAddress, power int64) VoteForTally { return VoteForTally{ ExchangeRate: rate, Denom: denom, @@ -31,8 +32,8 @@ func NewVoteForTally(rate sdk.Dec, denom string, voter sdk.ValAddress, power int type ExchangeRateBallot []VoteForTally // ToMap return organized exchange rate map by validator -func (pb ExchangeRateBallot) ToMap() map[string]sdk.Dec { - exchangeRateMap := make(map[string]sdk.Dec) +func (pb ExchangeRateBallot) ToMap() map[string]math.LegacyDec { + exchangeRateMap := make(map[string]math.LegacyDec) for _, vote := range pb { if vote.ExchangeRate.IsPositive() { exchangeRateMap[string(vote.Voter)] = vote.ExchangeRate @@ -54,9 +55,9 @@ func (pb ExchangeRateBallot) Power() int64 { // WeightedMedian returns the median weighted by the power of the ExchangeRateVote. // CONTRACT: ballot must be sorted -func (pb ExchangeRateBallot) WeightedMedian() (sdk.Dec, error) { +func (pb ExchangeRateBallot) WeightedMedian() (math.LegacyDec, error) { if !sort.IsSorted(pb) { - return sdk.ZeroDec(), ErrBallotNotSorted + return math.LegacyZeroDec(), ErrBallotNotSorted } totalPower := pb.Power() @@ -71,21 +72,21 @@ func (pb ExchangeRateBallot) WeightedMedian() (sdk.Dec, error) { } } } - return sdk.ZeroDec(), nil + return math.LegacyZeroDec(), nil } // StandardDeviation returns the standard deviation by the power of the ExchangeRateVote. -func (pb ExchangeRateBallot) StandardDeviation() (sdk.Dec, error) { +func (pb ExchangeRateBallot) StandardDeviation() (math.LegacyDec, error) { if len(pb) == 0 { - return sdk.ZeroDec(), nil + return math.LegacyZeroDec(), nil } median, err := pb.WeightedMedian() if err != nil { - return sdk.ZeroDec(), err + return math.LegacyZeroDec(), err } - sum := sdk.ZeroDec() + sum := math.LegacyZeroDec() ballotLength := int64(len(pb)) for _, v := range pb { func() { @@ -103,7 +104,7 @@ func (pb ExchangeRateBallot) StandardDeviation() (sdk.Dec, error) { standardDeviation, err := variance.ApproxSqrt() if err != nil { - return sdk.ZeroDec(), err + return math.LegacyZeroDec(), err } return standardDeviation, nil diff --git a/x/oracle/types/ballot_test.go b/x/oracle/types/ballot_test.go index 9b18939b..15134712 100644 --- a/x/oracle/types/ballot_test.go +++ b/x/oracle/types/ballot_test.go @@ -6,6 +6,7 @@ import ( "strconv" "testing" + sdkmath "cosmossdk.io/math" "github.com/stretchr/testify/require" "github.com/cometbft/cometbft/crypto/secp256k1" @@ -25,19 +26,19 @@ func TestToMap(t *testing.T) { { Voter: sdk.ValAddress(secp256k1.GenPrivKey().PubKey().Address()), Denom: types.TestDenomC, - ExchangeRate: sdk.NewDec(1600), + ExchangeRate: sdkmath.LegacyNewDec(1600), Power: 100, }, { Voter: sdk.ValAddress(secp256k1.GenPrivKey().PubKey().Address()), Denom: types.TestDenomC, - ExchangeRate: sdk.ZeroDec(), + ExchangeRate: sdkmath.LegacyZeroDec(), Power: 100, }, { Voter: sdk.ValAddress(secp256k1.GenPrivKey().PubKey().Address()), Denom: types.TestDenomC, - ExchangeRate: sdk.NewDec(1500), + ExchangeRate: sdkmath.LegacyNewDec(1500), Power: 100, }, }, @@ -58,15 +59,15 @@ func TestToMap(t *testing.T) { } func TestSqrt(t *testing.T) { - num := sdk.NewDecWithPrec(144, 4) + num := sdkmath.LegacyNewDecWithPrec(144, 4) floatNum, err := strconv.ParseFloat(num.String(), 64) require.NoError(t, err) floatNum = math.Sqrt(floatNum) - num, err = sdk.NewDecFromStr(fmt.Sprintf("%f", floatNum)) + num, err = sdkmath.LegacyNewDecFromStr(fmt.Sprintf("%f", floatNum)) require.NoError(t, err) - require.Equal(t, sdk.NewDecWithPrec(12, 2), num) + require.Equal(t, sdkmath.LegacyNewDecWithPrec(12, 2), num) } func TestPBPower(t *testing.T) { @@ -76,9 +77,10 @@ func TestPBPower(t *testing.T) { ballotPower := int64(0) for i := 0; i < len(sk.Validators()); i++ { - power := sk.Validator(ctx, valAccAddrs[i]).GetConsensusPower(sdk.DefaultPowerReduction) + val, _ := sk.Validator(ctx, valAccAddrs[i]) + power := val.GetConsensusPower(sdk.DefaultPowerReduction) vote := types.NewVoteForTally( - sdk.ZeroDec(), + sdkmath.LegacyZeroDec(), types.TestDenomD, valAccAddrs[i], power, @@ -97,7 +99,7 @@ func TestPBPower(t *testing.T) { pubKey := secp256k1.GenPrivKey().PubKey() faceValAddr := sdk.ValAddress(pubKey.Address()) fakeVote := types.NewVoteForTally( - sdk.OneDec(), + sdkmath.LegacyOneDec(), types.TestDenomD, faceValAddr, 0, @@ -112,7 +114,7 @@ func TestPBWeightedMedian(t *testing.T) { inputs []int64 weights []int64 isValidator []bool - median sdk.Dec + median sdkmath.LegacyDec panic bool }{ { @@ -120,7 +122,7 @@ func TestPBWeightedMedian(t *testing.T) { []int64{1, 2, 10, 100000}, []int64{1, 1, 100, 1}, []bool{true, true, true, true}, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), false, }, { @@ -128,7 +130,7 @@ func TestPBWeightedMedian(t *testing.T) { []int64{1, 2, 10, 100000, 10000000000}, []int64{1, 1, 100, 1, 10000}, []bool{true, true, true, true, false}, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), false, }, { @@ -136,7 +138,7 @@ func TestPBWeightedMedian(t *testing.T) { []int64{1, 2, 3, 4}, []int64{1, 100, 100, 1}, []bool{true, true, true, true}, - sdk.NewDec(2), + sdkmath.LegacyNewDec(2), false, }, { @@ -144,7 +146,7 @@ func TestPBWeightedMedian(t *testing.T) { []int64{}, []int64{}, []bool{true, true, true, true}, - sdk.NewDec(0), + sdkmath.LegacyNewDec(0), false, }, { @@ -152,7 +154,7 @@ func TestPBWeightedMedian(t *testing.T) { []int64{2, 1, 10, 100000}, []int64{1, 1, 100, 1}, []bool{true, true, true, true}, - sdk.NewDec(10), + sdkmath.LegacyNewDec(10), true, }, } @@ -168,7 +170,7 @@ func TestPBWeightedMedian(t *testing.T) { } vote := types.NewVoteForTally( - sdk.NewDec(int64(input)), + sdkmath.LegacyNewDec(int64(input)), types.TestDenomD, valAddr, power, @@ -192,35 +194,35 @@ func TestPBStandardDeviation(t *testing.T) { inputs []float64 weights []int64 isValidator []bool - standardDeviation sdk.Dec + standardDeviation sdkmath.LegacyDec }{ { // Supermajority one number []float64{1.0, 2.0, 10.0, 100000.0}, []int64{1, 1, 100, 1}, []bool{true, true, true, true}, - sdk.MustNewDecFromStr("49995.000362536252310906"), + sdkmath.LegacyMustNewDecFromStr("49995.000362536252310906"), }, { // Adding fake validator doesn't change outcome []float64{1.0, 2.0, 10.0, 100000.0, 10000000000}, []int64{1, 1, 100, 1, 10000}, []bool{true, true, true, true, false}, - sdk.MustNewDecFromStr("4472135950.751005519905537611"), + sdkmath.LegacyMustNewDecFromStr("4472135950.751005519905537611"), }, { // Tie votes []float64{1.0, 2.0, 3.0, 4.0}, []int64{1, 100, 100, 1}, []bool{true, true, true, true}, - sdk.MustNewDecFromStr("1.224744871391589049"), + sdkmath.LegacyMustNewDecFromStr("1.224744871391589049"), }, { // No votes []float64{}, []int64{}, []bool{true, true, true, true}, - sdk.NewDecWithPrec(0, 0), + sdkmath.LegacyNewDecWithPrec(0, 0), }, } @@ -236,7 +238,7 @@ func TestPBStandardDeviation(t *testing.T) { } vote := types.NewVoteForTally( - sdk.NewDecWithPrec(int64(input*base), int64(types.OracleDecPrecision)), + sdkmath.LegacyNewDecWithPrec(int64(input*base), int64(types.OracleDecPrecision)), types.TestDenomD, valAddr, power, @@ -251,11 +253,11 @@ func TestPBStandardDeviation(t *testing.T) { func TestPBStandardDeviationOverflow(t *testing.T) { valAddr := sdk.ValAddress(secp256k1.GenPrivKey().PubKey().Address()) - exchangeRate, err := sdk.NewDecFromStr("100000000000000000000000000000000000000000000000000000000.0") + exchangeRate, err := sdkmath.LegacyNewDecFromStr("100000000000000000000000000000000000000000000000000000000.0") require.NoError(t, err) pb := types.ExchangeRateBallot{types.NewVoteForTally( - sdk.ZeroDec(), + sdkmath.LegacyZeroDec(), types.TestDenomD, valAddr, 2, @@ -267,7 +269,7 @@ func TestPBStandardDeviationOverflow(t *testing.T) { )} sd, _ := pb.StandardDeviation() - require.Equal(t, sdk.ZeroDec(), sd) + require.Equal(t, sdkmath.LegacyZeroDec(), sd) } func TestNewClaim(t *testing.T) { diff --git a/x/oracle/types/codec.go b/x/oracle/types/codec.go index efe53d14..c74d26e9 100644 --- a/x/oracle/types/codec.go +++ b/x/oracle/types/codec.go @@ -11,33 +11,23 @@ import ( // RegisterLegacyAminoCodec registers the necessary x/oracle interfaces and concrete types // on the provided LegacyAmino codec. These types are used for Amino JSON serialization. func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&MsgAggregateExchangeRatePrevote{}, "oracle/MsgAggregateExchangeRatePrevote", nil) - cdc.RegisterConcrete(&MsgAggregateExchangeRateVote{}, "oracle/MsgAggregateExchangeRateVote", nil) - cdc.RegisterConcrete(&MsgDelegateFeedConsent{}, "oracle/MsgDelegateFeedConsent", nil) + cdc.RegisterConcrete(&MsgAddRequiredSymbols{}, "oracle/MsgAddRequiredSymbols", nil) + cdc.RegisterConcrete(&MsgRemoveRequiredSymbols{}, "oracle/MsgRemoveRequiredSymbols", nil) + cdc.RegisterConcrete(&MsgUpdateParams{}, "oracle/MsgUpdateParams", nil) } // RegisterInterfaces registers the x/oracle interfaces types with the interface registry func RegisterInterfaces(registry codectypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), - &MsgDelegateFeedConsent{}, - &MsgAggregateExchangeRatePrevote{}, - &MsgAggregateExchangeRateVote{}, + &MsgAddRequiredSymbols{}, + &MsgRemoveRequiredSymbols{}, + &MsgUpdateParams{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } -var ( - amino = codec.NewLegacyAmino() - - // ModuleCdc references the global x/oracle module codec. Note, the codec should - // ONLY be used in certain instances of tests and for JSON encoding as Amino is - // still used for that purpose. - // - // The actual codec used for serialization should be provided to x/staking and - // defined at the application level. - ModuleCdc = codec.NewAminoCodec(amino) -) +var amino = codec.NewLegacyAmino() func init() { RegisterLegacyAminoCodec(amino) diff --git a/x/oracle/types/denom_test.go b/x/oracle/types/denom_test.go deleted file mode 100644 index b5f33a71..00000000 --- a/x/oracle/types/denom_test.go +++ /dev/null @@ -1,30 +0,0 @@ -package types_test - -import ( - "testing" - - "github.com/Team-Kujira/core/x/oracle/types" - - "github.com/stretchr/testify/require" -) - -func Test_DenomList(t *testing.T) { - denoms := types.DenomList{ - types.Denom{ - Name: "denom1", - }, - types.Denom{ - Name: "denom2", - }, - types.Denom{ - Name: "denom3", - }, - } - - require.False(t, denoms[0].Equal(&denoms[1])) - require.True(t, denoms[0].Equal(&denoms[0])) - require.Equal(t, "name: denom1\n", denoms[0].String()) - require.Equal(t, "name: denom2\n", denoms[1].String()) - require.Equal(t, "name: denom3\n", denoms[2].String()) - require.Equal(t, "name: denom1\n\nname: denom2\n\nname: denom3", denoms.String()) -} diff --git a/x/oracle/types/errors.go b/x/oracle/types/errors.go index aa434a24..b4b6fb69 100644 --- a/x/oracle/types/errors.go +++ b/x/oracle/types/errors.go @@ -10,18 +10,20 @@ import ( // Oracle Errors var ( - ErrInvalidExchangeRate = errors.Register(ModuleName, 1, "invalid exchange rate") - ErrNoPrevote = errors.Register(ModuleName, 2, "no prevote") - ErrNoVote = errors.Register(ModuleName, 3, "no vote") - ErrNoVotingPermission = errors.Register(ModuleName, 4, "unauthorized voter") - ErrInvalidHash = errors.Register(ModuleName, 5, "invalid hash") - ErrInvalidHashLength = errors.Register(ModuleName, 6, fmt.Sprintf("invalid hash length; should equal %d", tmhash.TruncatedSize)) - ErrVerificationFailed = errors.Register(ModuleName, 7, "hash verification failed") - ErrRevealPeriodMissMatch = errors.Register(ModuleName, 8, "reveal period of submitted vote do not match with registered prevote") - ErrInvalidSaltLength = errors.Register(ModuleName, 9, "invalid salt length; must be 64") - ErrInvalidSaltFormat = errors.Register(ModuleName, 10, "invalid salt format") - ErrNoAggregatePrevote = errors.Register(ModuleName, 11, "no aggregate prevote") - ErrNoAggregateVote = errors.Register(ModuleName, 12, "no aggregate vote") - ErrUnknownDenom = errors.Register(ModuleName, 13, "unknown denom") - ErrBallotNotSorted = errors.Register(ModuleName, 14, "ballot not sorted") + ErrInvalidExchangeRate = errors.Register(ModuleName, 1, "invalid exchange rate") + ErrNoPrevote = errors.Register(ModuleName, 2, "no prevote") + ErrNoVote = errors.Register(ModuleName, 3, "no vote") + ErrNoVotingPermission = errors.Register(ModuleName, 4, "unauthorized voter") + ErrInvalidHash = errors.Register(ModuleName, 5, "invalid hash") + ErrInvalidHashLength = errors.Register(ModuleName, 6, fmt.Sprintf("invalid hash length; should equal %d", tmhash.TruncatedSize)) + ErrVerificationFailed = errors.Register(ModuleName, 7, "hash verification failed") + ErrRevealPeriodMissMatch = errors.Register(ModuleName, 8, "reveal period of submitted vote do not match with registered prevote") + ErrInvalidSaltLength = errors.Register(ModuleName, 9, "invalid salt length; must be 64") + ErrInvalidSaltFormat = errors.Register(ModuleName, 10, "invalid salt format") + ErrNoAggregatePrevote = errors.Register(ModuleName, 11, "no aggregate prevote") + ErrNoAggregateVote = errors.Register(ModuleName, 12, "no aggregate vote") + ErrUnknownDenom = errors.Register(ModuleName, 13, "unknown denom") + ErrBallotNotSorted = errors.Register(ModuleName, 14, "ballot not sorted") + ErrSetParams = errors.Register(ModuleName, 15, "could not set params") + ErrCanNotUpdateRequiredSymbols = errors.Register(ModuleName, 16, "could not update required denoms") ) diff --git a/x/oracle/types/expected_keeper.go b/x/oracle/types/expected_keeper.go index cec67a67..b7d57bbb 100644 --- a/x/oracle/types/expected_keeper.go +++ b/x/oracle/types/expected_keeper.go @@ -1,51 +1,53 @@ package types import ( + "context" + + "cosmossdk.io/core/store" "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ) // StakingKeeper is expected keeper for staking module type SlashingKeeper interface { - Slash(sdk.Context, sdk.ConsAddress, sdk.Dec, int64, int64) // slash the validator and delegators of the validator, specifying slash fraction, offence power and offence height - Jail(sdk.Context, sdk.ConsAddress) // jail a validator + Slash(context.Context, sdk.ConsAddress, math.LegacyDec, int64, int64) error // slash the validator and delegators of the validator, specifying slash fraction, offence power and offence height + Jail(context.Context, sdk.ConsAddress) error // jail a validator } // StakingKeeper is expected keeper for staking module type StakingKeeper interface { - Validator(ctx sdk.Context, address sdk.ValAddress) stakingtypes.ValidatorI // get validator by operator address; nil when validator not found - TotalBondedTokens(sdk.Context) math.Int // total bonded tokens within the validator set - ValidatorsPowerStoreIterator(ctx sdk.Context) sdk.Iterator // an iterator for the current validator power store - MaxValidators(sdk.Context) uint32 // MaxValidators returns the maximum amount of bonded validators - PowerReduction(ctx sdk.Context) (res math.Int) + Validator(ctx context.Context, address sdk.ValAddress) (stakingtypes.ValidatorI, error) // get validator by operator address; nil when validator not found + TotalBondedTokens(context.Context) (math.Int, error) // total bonded tokens within the validator set + ValidatorsPowerStoreIterator(ctx context.Context) (store.Iterator, error) // an iterator for the current validator power store + MaxValidators(context.Context) (uint32, error) // MaxValidators returns the maximum amount of bonded validators + PowerReduction(ctx context.Context) (res math.Int) } // DistributionKeeper is expected keeper for distribution module type DistributionKeeper interface { - AllocateTokensToValidator(ctx sdk.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins) + AllocateTokensToValidator(ctx context.Context, val stakingtypes.ValidatorI, tokens sdk.DecCoins) error // only used for simulation - GetValidatorOutstandingRewardsCoins(ctx sdk.Context, val sdk.ValAddress) sdk.DecCoins + GetValidatorOutstandingRewardsCoins(ctx context.Context, val sdk.ValAddress) (sdk.DecCoins, error) } // AccountKeeper is expected keeper for auth module type AccountKeeper interface { GetModuleAddress(name string) sdk.AccAddress - GetModuleAccount(ctx sdk.Context, moduleName string) authtypes.ModuleAccountI - GetAccount(ctx sdk.Context, addr sdk.AccAddress) authtypes.AccountI // only used for simulation + GetModuleAccount(ctx context.Context, moduleName string) sdk.ModuleAccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI // only used for simulation } // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - GetBalance(ctx sdk.Context, addr sdk.AccAddress, denom string) sdk.Coin - GetAllBalances(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins - SendCoinsFromModuleToModule(ctx sdk.Context, senderModule string, recipientModule string, amt sdk.Coins) error - GetDenomMetaData(ctx sdk.Context, denom string) (banktypes.Metadata, bool) - SetDenomMetaData(ctx sdk.Context, denomMetaData banktypes.Metadata) + GetBalance(ctx context.Context, addr sdk.AccAddress, denom string) sdk.Coin + GetAllBalances(ctx context.Context, addr sdk.AccAddress) sdk.Coins + SendCoinsFromModuleToModule(ctx context.Context, senderModule string, recipientModule string, amt sdk.Coins) error + GetDenomMetaData(ctx context.Context, denom string) (banktypes.Metadata, bool) + SetDenomMetaData(ctx context.Context, denomMetaData banktypes.Metadata) // only used for simulation - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins } diff --git a/x/oracle/types/genesis.go b/x/oracle/types/genesis.go index dd612238..d78500e3 100644 --- a/x/oracle/types/genesis.go +++ b/x/oracle/types/genesis.go @@ -2,24 +2,17 @@ package types import ( "encoding/json" - - "github.com/cosmos/cosmos-sdk/codec" ) // NewGenesisState creates a new GenesisState object func NewGenesisState( params Params, rates []ExchangeRateTuple, - feederDelegations []FeederDelegation, missCounters []MissCounter, - aggregateExchangeRatePrevotes []AggregateExchangeRatePrevote, - aggregateExchangeRateVotes []AggregateExchangeRateVote, + missCounters []MissCounter, ) *GenesisState { return &GenesisState{ - Params: params, - ExchangeRates: rates, - FeederDelegations: feederDelegations, - MissCounters: missCounters, - AggregateExchangeRatePrevotes: aggregateExchangeRatePrevotes, - AggregateExchangeRateVotes: aggregateExchangeRateVotes, + Params: params, + ExchangeRates: rates, + MissCounters: missCounters, } } @@ -27,10 +20,7 @@ func NewGenesisState( func DefaultGenesisState() *GenesisState { return NewGenesisState(DefaultParams(), []ExchangeRateTuple{}, - []FeederDelegation{}, - []MissCounter{}, - []AggregateExchangeRatePrevote{}, - []AggregateExchangeRateVote{}) + []MissCounter{}) } // ValidateGenesis validates the oracle genesis state @@ -40,11 +30,14 @@ func ValidateGenesis(data *GenesisState) error { // GetGenesisStateFromAppState returns x/oracle GenesisState given raw application // genesis state. -func GetGenesisStateFromAppState(cdc codec.JSONCodec, appState map[string]json.RawMessage) *GenesisState { +func GetGenesisStateFromAppState(appState map[string]json.RawMessage) *GenesisState { var genesisState GenesisState if appState[ModuleName] != nil { - cdc.MustUnmarshalJSON(appState[ModuleName], &genesisState) + err := json.Unmarshal(appState[ModuleName], &genesisState) + if err != nil { + panic(err) + } } return &genesisState diff --git a/x/oracle/types/genesis.pb.go b/x/oracle/types/genesis.pb.go index 319ab946..0057a812 100644 --- a/x/oracle/types/genesis.pb.go +++ b/x/oracle/types/genesis.pb.go @@ -26,12 +26,9 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // GenesisState defines the oracle module's genesis state. type GenesisState struct { - Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` - FeederDelegations []FeederDelegation `protobuf:"bytes,2,rep,name=feeder_delegations,json=feederDelegations,proto3" json:"feeder_delegations"` - ExchangeRates ExchangeRateTuples `protobuf:"bytes,3,rep,name=exchange_rates,json=exchangeRates,proto3,castrepeated=ExchangeRateTuples" json:"exchange_rates"` - MissCounters []MissCounter `protobuf:"bytes,4,rep,name=miss_counters,json=missCounters,proto3" json:"miss_counters"` - AggregateExchangeRatePrevotes []AggregateExchangeRatePrevote `protobuf:"bytes,5,rep,name=aggregate_exchange_rate_prevotes,json=aggregateExchangeRatePrevotes,proto3" json:"aggregate_exchange_rate_prevotes"` - AggregateExchangeRateVotes []AggregateExchangeRateVote `protobuf:"bytes,6,rep,name=aggregate_exchange_rate_votes,json=aggregateExchangeRateVotes,proto3" json:"aggregate_exchange_rate_votes"` + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + ExchangeRates ExchangeRateTuples `protobuf:"bytes,2,rep,name=exchange_rates,json=exchangeRates,proto3,castrepeated=ExchangeRateTuples" json:"exchange_rates"` + MissCounters []MissCounter `protobuf:"bytes,3,rep,name=miss_counters,json=missCounters,proto3" json:"miss_counters"` } func (m *GenesisState) Reset() { *m = GenesisState{} } @@ -74,13 +71,6 @@ func (m *GenesisState) GetParams() Params { return Params{} } -func (m *GenesisState) GetFeederDelegations() []FeederDelegation { - if m != nil { - return m.FeederDelegations - } - return nil -} - func (m *GenesisState) GetExchangeRates() ExchangeRateTuples { if m != nil { return m.ExchangeRates @@ -95,20 +85,6 @@ func (m *GenesisState) GetMissCounters() []MissCounter { return nil } -func (m *GenesisState) GetAggregateExchangeRatePrevotes() []AggregateExchangeRatePrevote { - if m != nil { - return m.AggregateExchangeRatePrevotes - } - return nil -} - -func (m *GenesisState) GetAggregateExchangeRateVotes() []AggregateExchangeRateVote { - if m != nil { - return m.AggregateExchangeRateVotes - } - return nil -} - // FeederDelegation is the address for where oracle feeder authority are // delegated to. By default this struct is only used at genesis to feed in // default feeder addresses. @@ -227,38 +203,32 @@ func init() { func init() { proto.RegisterFile("kujira/oracle/genesis.proto", fileDescriptor_fb93724cfbd1d6a0) } var fileDescriptor_fb93724cfbd1d6a0 = []byte{ - // 482 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xd1, 0x6a, 0x13, 0x41, - 0x14, 0x86, 0xb3, 0x6d, 0x2c, 0x38, 0x49, 0x4a, 0x3b, 0x28, 0x84, 0x95, 0x6e, 0x62, 0x40, 0x08, - 0x16, 0x77, 0x69, 0xfb, 0x04, 0x8d, 0xad, 0x5e, 0x88, 0x50, 0xd6, 0xe0, 0x85, 0x20, 0xcb, 0xc9, - 0xee, 0xc9, 0x76, 0x35, 0xbb, 0xb3, 0xce, 0x99, 0x84, 0xea, 0x53, 0xf8, 0x1c, 0x5e, 0xfb, 0x10, - 0xbd, 0xec, 0xa5, 0x57, 0x2a, 0xc9, 0x8b, 0x48, 0x66, 0xb6, 0xcd, 0x66, 0x6d, 0xc5, 0xab, 0x84, - 0xf3, 0x7f, 0xe7, 0xff, 0x7f, 0x76, 0x66, 0xd8, 0xa3, 0x8f, 0xd3, 0x0f, 0x89, 0x04, 0x4f, 0x48, - 0x08, 0x27, 0xe8, 0xc5, 0x98, 0x21, 0x25, 0xe4, 0xe6, 0x52, 0x28, 0xc1, 0x5b, 0x46, 0x74, 0x8d, - 0x68, 0x3f, 0x88, 0x45, 0x2c, 0xb4, 0xe2, 0x2d, 0xff, 0x19, 0xc8, 0xb6, 0xd7, 0x1d, 0xcc, 0x4f, - 0xa1, 0x39, 0xa1, 0xa0, 0x54, 0x90, 0x37, 0x02, 0x42, 0x6f, 0x76, 0x30, 0x42, 0x05, 0x07, 0x5e, - 0x28, 0x92, 0xcc, 0xe8, 0xbd, 0xef, 0x75, 0xd6, 0x7c, 0x69, 0x22, 0xdf, 0x28, 0x50, 0xc8, 0x8f, - 0xd8, 0x56, 0x0e, 0x12, 0x52, 0x6a, 0x5b, 0x5d, 0xab, 0xdf, 0x38, 0x7c, 0xe8, 0xae, 0x55, 0x70, - 0xcf, 0xb4, 0x38, 0xa8, 0x5f, 0xfe, 0xec, 0xd4, 0xfc, 0x02, 0xe5, 0x43, 0xc6, 0xc7, 0x88, 0x11, - 0xca, 0x20, 0xc2, 0x09, 0xc6, 0xa0, 0x12, 0x91, 0x51, 0x7b, 0xa3, 0xbb, 0xd9, 0x6f, 0x1c, 0x76, - 0x2a, 0x06, 0x2f, 0x34, 0x78, 0x72, 0xc3, 0x15, 0x56, 0xbb, 0xe3, 0xca, 0x9c, 0x78, 0xc8, 0xb6, - 0xf1, 0x22, 0x3c, 0x87, 0x2c, 0xc6, 0x40, 0x82, 0x42, 0x6a, 0x6f, 0x6a, 0xc7, 0x6e, 0xc5, 0xf1, - 0xb4, 0x80, 0x7c, 0x50, 0x38, 0x9c, 0xe6, 0x13, 0x1c, 0xd8, 0x4b, 0xcb, 0x6f, 0xbf, 0x3a, 0xfc, - 0x2f, 0x89, 0xfc, 0x16, 0x96, 0x66, 0xc4, 0x4f, 0x59, 0x2b, 0x4d, 0x88, 0x82, 0x50, 0x4c, 0x33, - 0x85, 0x92, 0xda, 0x75, 0x9d, 0x61, 0x57, 0x32, 0x5e, 0x27, 0x44, 0xcf, 0x0d, 0x52, 0x14, 0x6e, - 0xa6, 0xab, 0x11, 0xf1, 0x2f, 0xac, 0x0b, 0x71, 0x2c, 0x97, 0xdd, 0x31, 0x58, 0x6b, 0x1d, 0xe4, - 0x12, 0x67, 0x62, 0xd9, 0xfe, 0x9e, 0x76, 0xde, 0xaf, 0x38, 0x1f, 0x5f, 0xaf, 0x95, 0xbb, 0x9e, - 0x99, 0x9d, 0x22, 0x6a, 0x0f, 0xfe, 0xc1, 0x10, 0xff, 0xc4, 0xf6, 0xee, 0xca, 0x36, 0xc1, 0x5b, - 0x3a, 0xb8, 0xff, 0x3f, 0xc1, 0x6f, 0x57, 0xa9, 0x36, 0xdc, 0x05, 0x50, 0x6f, 0xcc, 0x76, 0xaa, - 0xe7, 0xc8, 0x9f, 0xb0, 0xed, 0xe2, 0x12, 0x40, 0x14, 0x49, 0x24, 0x73, 0x83, 0xee, 0xfb, 0x2d, - 0x33, 0x3d, 0x36, 0x43, 0xbe, 0xcf, 0x76, 0x67, 0x30, 0x49, 0x22, 0x50, 0x62, 0x45, 0x6e, 0x68, - 0x72, 0xe7, 0x46, 0x28, 0xe0, 0xde, 0x7b, 0xd6, 0x28, 0x7d, 0xf9, 0xdb, 0x77, 0xad, 0xdb, 0x77, - 0xf9, 0x63, 0xd6, 0x2c, 0x9f, 0xac, 0xce, 0xa8, 0xfb, 0x8d, 0xd2, 0xb1, 0x0d, 0x4e, 0x2e, 0xe7, - 0x8e, 0x75, 0x35, 0x77, 0xac, 0xdf, 0x73, 0xc7, 0xfa, 0xba, 0x70, 0x6a, 0x57, 0x0b, 0xa7, 0xf6, - 0x63, 0xe1, 0xd4, 0xde, 0x3d, 0x8d, 0x13, 0x75, 0x3e, 0x1d, 0xb9, 0xa1, 0x48, 0xbd, 0x21, 0x42, - 0xfa, 0xec, 0x95, 0x79, 0x63, 0xa1, 0x90, 0xe8, 0x5d, 0x5c, 0x3f, 0x35, 0xf5, 0x39, 0x47, 0x1a, - 0x6d, 0xe9, 0xa7, 0x74, 0xf4, 0x27, 0x00, 0x00, 0xff, 0xff, 0xd4, 0x13, 0xee, 0x53, 0xca, 0x03, - 0x00, 0x00, + // 396 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x92, 0xd1, 0x8a, 0xd3, 0x40, + 0x14, 0x86, 0x93, 0xdd, 0x65, 0xc1, 0x49, 0xb3, 0xac, 0x83, 0x42, 0x89, 0x90, 0xad, 0x05, 0x61, + 0x51, 0xcc, 0xb0, 0xbb, 0x4f, 0x60, 0xdd, 0xd5, 0x0b, 0x11, 0x24, 0xee, 0x95, 0x20, 0x65, 0x32, + 0x39, 0x9b, 0x8e, 0x26, 0x99, 0x30, 0x67, 0x52, 0xea, 0x5b, 0xf8, 0x1c, 0x3e, 0x49, 0x2f, 0x7b, + 0xe9, 0x95, 0x4a, 0xfb, 0x00, 0xbe, 0x82, 0x34, 0x13, 0x6d, 0x5a, 0x7b, 0x35, 0xc3, 0xff, 0xfd, + 0xe7, 0xfc, 0xe7, 0xc0, 0x21, 0x8f, 0x3e, 0xd7, 0x9f, 0xa4, 0xe6, 0x4c, 0x69, 0x2e, 0x72, 0x60, + 0x19, 0x94, 0x80, 0x12, 0xa3, 0x4a, 0x2b, 0xa3, 0xa8, 0x6f, 0x61, 0x64, 0x61, 0xf0, 0x20, 0x53, + 0x99, 0x6a, 0x08, 0x5b, 0xff, 0xac, 0x29, 0x08, 0xb6, 0x3b, 0xd8, 0xa7, 0x65, 0xa1, 0x50, 0x58, + 0x28, 0x64, 0x09, 0x47, 0x60, 0xd3, 0x8b, 0x04, 0x0c, 0xbf, 0x60, 0x42, 0xc9, 0xd2, 0xf2, 0xe1, + 0x6f, 0x97, 0xf4, 0x5e, 0xdb, 0xc8, 0xf7, 0x86, 0x1b, 0xa0, 0x57, 0xe4, 0xb8, 0xe2, 0x9a, 0x17, + 0xd8, 0x77, 0x07, 0xee, 0xb9, 0x77, 0xf9, 0x30, 0xda, 0x1a, 0x21, 0x7a, 0xd7, 0xc0, 0xd1, 0xd1, + 0xfc, 0xc7, 0x99, 0x13, 0xb7, 0x56, 0x2a, 0xc8, 0x09, 0xcc, 0xc4, 0x84, 0x97, 0x19, 0x8c, 0x35, + 0x37, 0x80, 0xfd, 0x83, 0xc1, 0xe1, 0xb9, 0x77, 0x39, 0xd8, 0x29, 0xbe, 0x69, 0x4d, 0x31, 0x37, + 0x70, 0x5b, 0x57, 0x39, 0x8c, 0x82, 0x75, 0x9f, 0x6f, 0x3f, 0xcf, 0xe8, 0x7f, 0x08, 0x63, 0x1f, + 0x3a, 0x1a, 0xd2, 0x1b, 0xe2, 0x17, 0x12, 0x71, 0x2c, 0x54, 0x5d, 0x1a, 0xd0, 0xd8, 0x3f, 0x6c, + 0x32, 0x82, 0x9d, 0x8c, 0xb7, 0x12, 0xf1, 0xa5, 0xb5, 0xb4, 0x53, 0xf6, 0x8a, 0x8d, 0x84, 0xc3, + 0x3b, 0x72, 0xfa, 0x0a, 0x20, 0x05, 0x7d, 0x0d, 0x39, 0x64, 0xdc, 0x48, 0x55, 0xd2, 0x27, 0xe4, + 0xe4, 0xae, 0xd1, 0xc6, 0x3c, 0x4d, 0x35, 0xa0, 0x5d, 0xfe, 0x5e, 0xec, 0x5b, 0xf5, 0x85, 0x15, + 0xe9, 0x33, 0x72, 0x7f, 0xca, 0x73, 0x99, 0x72, 0xa3, 0x36, 0xce, 0x83, 0xc6, 0x79, 0xfa, 0x0f, + 0xb4, 0xe6, 0xe1, 0x47, 0xe2, 0x75, 0x46, 0xd9, 0x5f, 0xeb, 0xee, 0xaf, 0xa5, 0x8f, 0x49, 0xaf, + 0xbb, 0x6a, 0x93, 0x71, 0x14, 0x7b, 0x9d, 0x3d, 0x46, 0xd7, 0xf3, 0x65, 0xe8, 0x2e, 0x96, 0xa1, + 0xfb, 0x6b, 0x19, 0xba, 0x5f, 0x57, 0xa1, 0xb3, 0x58, 0x85, 0xce, 0xf7, 0x55, 0xe8, 0x7c, 0x78, + 0x9a, 0x49, 0x33, 0xa9, 0x93, 0x48, 0xa8, 0x82, 0xdd, 0x02, 0x2f, 0x9e, 0xbf, 0xb1, 0xe7, 0x21, + 0x94, 0x06, 0x36, 0xfb, 0x7b, 0x25, 0xe6, 0x4b, 0x05, 0x98, 0x1c, 0x37, 0x57, 0x70, 0xf5, 0x27, + 0x00, 0x00, 0xff, 0xff, 0x7b, 0x19, 0x13, 0x2d, 0x85, 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -281,34 +251,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if len(m.AggregateExchangeRateVotes) > 0 { - for iNdEx := len(m.AggregateExchangeRateVotes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AggregateExchangeRateVotes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x32 - } - } - if len(m.AggregateExchangeRatePrevotes) > 0 { - for iNdEx := len(m.AggregateExchangeRatePrevotes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AggregateExchangeRatePrevotes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x2a - } - } if len(m.MissCounters) > 0 { for iNdEx := len(m.MissCounters) - 1; iNdEx >= 0; iNdEx-- { { @@ -320,7 +262,7 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x22 + dAtA[i] = 0x1a } } if len(m.ExchangeRates) > 0 { @@ -334,20 +276,6 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintGenesis(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a - } - } - if len(m.FeederDelegations) > 0 { - for iNdEx := len(m.FeederDelegations) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.FeederDelegations[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) - } - i-- dAtA[i] = 0x12 } } @@ -455,12 +383,6 @@ func (m *GenesisState) Size() (n int) { _ = l l = m.Params.Size() n += 1 + l + sovGenesis(uint64(l)) - if len(m.FeederDelegations) > 0 { - for _, e := range m.FeederDelegations { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } if len(m.ExchangeRates) > 0 { for _, e := range m.ExchangeRates { l = e.Size() @@ -473,18 +395,6 @@ func (m *GenesisState) Size() (n int) { n += 1 + l + sovGenesis(uint64(l)) } } - if len(m.AggregateExchangeRatePrevotes) > 0 { - for _, e := range m.AggregateExchangeRatePrevotes { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.AggregateExchangeRateVotes) > 0 { - for _, e := range m.AggregateExchangeRateVotes { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } return n } @@ -590,40 +500,6 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeederDelegations", 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 - } - m.FeederDelegations = append(m.FeederDelegations, FeederDelegation{}) - if err := m.FeederDelegations[len(m.FeederDelegations)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRates", wireType) } @@ -657,7 +533,7 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: + case 3: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MissCounters", wireType) } @@ -691,74 +567,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 AggregateExchangeRatePrevotes", 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 - } - m.AggregateExchangeRatePrevotes = append(m.AggregateExchangeRatePrevotes, AggregateExchangeRatePrevote{}) - if err := m.AggregateExchangeRatePrevotes[len(m.AggregateExchangeRatePrevotes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregateExchangeRateVotes", 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 - } - m.AggregateExchangeRateVotes = append(m.AggregateExchangeRateVotes, AggregateExchangeRateVote{}) - if err := m.AggregateExchangeRateVotes[len(m.AggregateExchangeRateVotes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/oracle/types/genesis_test.go b/x/oracle/types/genesis_test.go index 63c2f218..2ac99221 100644 --- a/x/oracle/types/genesis_test.go +++ b/x/oracle/types/genesis_test.go @@ -13,19 +13,17 @@ func TestGenesisValidation(t *testing.T) { genState := types.DefaultGenesisState() require.NoError(t, types.ValidateGenesis(genState)) - genState.Params.VotePeriod = 0 + genState.Params.SlashWindow = 0 require.Error(t, types.ValidateGenesis(genState)) } func TestGetGenesisStateFromAppState(t *testing.T) { - cdc := types.ModuleCdc defaultGenesisState := types.DefaultGenesisState() - bz, err := cdc.MarshalJSON(defaultGenesisState) - + bz, err := json.Marshal(defaultGenesisState) require.Nil(t, err) - require.NotNil(t, types.GetGenesisStateFromAppState(cdc, map[string]json.RawMessage{ + require.NotNil(t, types.GetGenesisStateFromAppState(map[string]json.RawMessage{ types.ModuleName: bz, })) - require.NotNil(t, types.GetGenesisStateFromAppState(cdc, map[string]json.RawMessage{})) + require.NotNil(t, types.GetGenesisStateFromAppState(map[string]json.RawMessage{})) } diff --git a/x/oracle/types/keys.go b/x/oracle/types/keys.go index 4187f8fa..3523dbd9 100644 --- a/x/oracle/types/keys.go +++ b/x/oracle/types/keys.go @@ -24,22 +24,14 @@ const ( // // - 0x01: sdk.Dec // -// - 0x02: accAddress -// // - 0x03: int64 // -// - 0x04: AggregateExchangeRatePrevote -// -// - 0x05: AggregateExchangeRateVote -// -// - 0x06: sdk.Dec +// - 0x06: Params var ( // Keys for store prefixes - ExchangeRateKey = []byte{0x01} // prefix for each key to a rate - FeederDelegationKey = []byte{0x02} // prefix for each key to a feeder delegation - MissCounterKey = []byte{0x03} // prefix for each key to a miss counter - AggregateExchangeRatePrevoteKey = []byte{0x04} // prefix for each key to a aggregate prevote - AggregateExchangeRateVoteKey = []byte{0x05} // prefix for each key to a aggregate vote + ExchangeRateKey = []byte{0x01} // prefix for each key to a rate + MissCounterKey = []byte{0x03} // prefix for each key to a miss counter + ParamsKey = []byte{0x06} ) // GetExchangeRateKey - stored by *denom* @@ -47,22 +39,7 @@ func GetExchangeRateKey(denom string) []byte { return append(ExchangeRateKey, []byte(denom)...) } -// GetFeederDelegationKey - stored by *Validator* address -func GetFeederDelegationKey(v sdk.ValAddress) []byte { - return append(FeederDelegationKey, address.MustLengthPrefix(v)...) -} - // GetMissCounterKey - stored by *Validator* address func GetMissCounterKey(v sdk.ValAddress) []byte { return append(MissCounterKey, address.MustLengthPrefix(v)...) } - -// GetAggregateExchangeRatePrevoteKey - stored by *Validator* address -func GetAggregateExchangeRatePrevoteKey(v sdk.ValAddress) []byte { - return append(AggregateExchangeRatePrevoteKey, address.MustLengthPrefix(v)...) -} - -// GetAggregateExchangeRateVoteKey - stored by *Validator* address -func GetAggregateExchangeRateVoteKey(v sdk.ValAddress) []byte { - return append(AggregateExchangeRateVoteKey, address.MustLengthPrefix(v)...) -} diff --git a/x/oracle/types/denom.go b/x/oracle/types/legacy.go similarity index 69% rename from x/oracle/types/denom.go rename to x/oracle/types/legacy.go index 57e6de64..bce81aaf 100644 --- a/x/oracle/types/denom.go +++ b/x/oracle/types/legacy.go @@ -12,11 +12,6 @@ func (d Denom) String() string { return string(out) } -// Equal implements equal interface -func (d Denom) Equal(d1 *Denom) bool { - return d.Name == d1.Name -} - // DenomList is array of Denom type DenomList []Denom @@ -27,3 +22,14 @@ func (dl DenomList) String() (out string) { } return strings.TrimSpace(out) } + +// String implements fmt.Stringer interface +func (d Symbol) String() string { + out, _ := yaml.Marshal(d) + return string(out) +} + +// Equal implements equal interface +func (d Symbol) Equal(d1 *Symbol) bool { + return d.Symbol == d1.Symbol +} diff --git a/x/oracle/types/msgs.go b/x/oracle/types/msgs.go index 0fb166eb..79b9d7f1 100644 --- a/x/oracle/types/msgs.go +++ b/x/oracle/types/msgs.go @@ -1,8 +1,6 @@ package types import ( - "github.com/cometbft/cometbft/crypto/tmhash" - "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -10,188 +8,104 @@ import ( // ensure Msg interface compliance at compile time var ( - _ sdk.Msg = &MsgDelegateFeedConsent{} - _ sdk.Msg = &MsgAggregateExchangeRatePrevote{} - _ sdk.Msg = &MsgAggregateExchangeRateVote{} + _ sdk.Msg = &MsgAddRequiredSymbols{} + _ sdk.Msg = &MsgRemoveRequiredSymbols{} + _ sdk.Msg = &MsgUpdateParams{} ) // oracle message types const ( - TypeMsgDelegateFeedConsent = "delegate_feeder" - TypeMsgAggregateExchangeRatePrevote = "aggregate_exchange_rate_prevote" - TypeMsgAggregateExchangeRateVote = "aggregate_exchange_rate_vote" + TypeMsgAddRequiredSymbol = "add_price" + TypeMsgRemoveRequiredSymbol = "remove_price" + TypeMsgUpdateParams = "update_params" ) //------------------------------------------------- //------------------------------------------------- -// NewMsgAggregateExchangeRatePrevote returns MsgAggregateExchangeRatePrevote instance -func NewMsgAggregateExchangeRatePrevote(hash AggregateVoteHash, feeder sdk.AccAddress, validator sdk.ValAddress) *MsgAggregateExchangeRatePrevote { - return &MsgAggregateExchangeRatePrevote{ - Hash: hash.String(), - Feeder: feeder.String(), - Validator: validator.String(), +// NewMsgAddRequiredSymbol creates a MsgAddRequiredSymbol instance +func NewMsgAddRequiredSymbol(symbols []string) *MsgAddRequiredSymbols { + return &MsgAddRequiredSymbols{ + Symbols: symbols, } } // Route implements sdk.Msg -func (msg MsgAggregateExchangeRatePrevote) Route() string { return RouterKey } +func (msg MsgAddRequiredSymbols) Route() string { return RouterKey } // Type implements sdk.Msg -func (msg MsgAggregateExchangeRatePrevote) Type() string { return TypeMsgAggregateExchangeRatePrevote } - -// GetSignBytes implements sdk.Msg -func (msg MsgAggregateExchangeRatePrevote) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} +func (msg MsgAddRequiredSymbols) Type() string { return TypeMsgAddRequiredSymbol } // GetSigners implements sdk.Msg -func (msg MsgAggregateExchangeRatePrevote) GetSigners() []sdk.AccAddress { - feeder, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - panic(err) - } - - return []sdk.AccAddress{feeder} +func (msg MsgAddRequiredSymbols) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} } -// ValidateBasic Implements sdk.Msg -func (msg MsgAggregateExchangeRatePrevote) ValidateBasic() error { - _, err := AggregateVoteHashFromHexString(msg.Hash) - if err != nil { - return errors.Wrapf(ErrInvalidHash, "Invalid vote hash (%s)", err) - } - - // HEX encoding doubles the hash length - if len(msg.Hash) != tmhash.TruncatedSize*2 { - return ErrInvalidHashLength - } - - _, err = sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid feeder address (%s)", err) - } - - _, err = sdk.ValAddressFromBech32(msg.Validator) +// ValidateBasic implements sdk.Msg +func (msg MsgAddRequiredSymbols) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Authority) if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid operator address (%s)", err) + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid authority address (%s)", err) } return nil } -// NewMsgAggregateExchangeRateVote returns MsgAggregateExchangeRateVote instance -func NewMsgAggregateExchangeRateVote(salt string, exchangeRates string, feeder sdk.AccAddress, validator sdk.ValAddress) *MsgAggregateExchangeRateVote { - return &MsgAggregateExchangeRateVote{ - Salt: salt, - ExchangeRates: exchangeRates, - Feeder: feeder.String(), - Validator: validator.String(), +// NewMsgRemoveRequiredSymbol creates a MsgRemoveRequiredSymbol instance +func NewMsgRemoveRequiredSymbol(symbols []string) *MsgRemoveRequiredSymbols { + return &MsgRemoveRequiredSymbols{ + Symbols: symbols, } } // Route implements sdk.Msg -func (msg MsgAggregateExchangeRateVote) Route() string { return RouterKey } +func (msg MsgRemoveRequiredSymbols) Route() string { return RouterKey } // Type implements sdk.Msg -func (msg MsgAggregateExchangeRateVote) Type() string { return TypeMsgAggregateExchangeRateVote } - -// GetSignBytes implements sdk.Msg -func (msg MsgAggregateExchangeRateVote) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} +func (msg MsgRemoveRequiredSymbols) Type() string { return TypeMsgRemoveRequiredSymbol } // GetSigners implements sdk.Msg -func (msg MsgAggregateExchangeRateVote) GetSigners() []sdk.AccAddress { - feeder, err := sdk.AccAddressFromBech32(msg.Feeder) - if err != nil { - panic(err) - } - - return []sdk.AccAddress{feeder} +func (msg MsgRemoveRequiredSymbols) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} } // ValidateBasic implements sdk.Msg -func (msg MsgAggregateExchangeRateVote) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Feeder) +func (msg MsgRemoveRequiredSymbols) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Authority) if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid feeder address (%s)", err) - } - - _, err = sdk.ValAddressFromBech32(msg.Validator) - if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid operator address (%s)", err) - } - - if l := len(msg.ExchangeRates); l == 0 { - return errors.Wrap(sdkerrors.ErrUnknownRequest, "must provide at least one oracle exchange rate") - } else if l > 4096 { - return errors.Wrap(sdkerrors.ErrInvalidRequest, "exchange rates string can not exceed 4096 characters") - } - - exchangeRates, err := ParseExchangeRateTuples(msg.ExchangeRates) - if err != nil { - return errors.Wrap(sdkerrors.ErrInvalidCoins, "failed to parse exchange rates string cause: "+err.Error()) - } - - for _, exchangeRate := range exchangeRates { - // Check overflow bit length - if exchangeRate.ExchangeRate.BigInt().BitLen() > 255+sdk.DecimalPrecisionBits { - return errors.Wrap(ErrInvalidExchangeRate, "overflow") - } - } - - if len(msg.Salt) != 64 { - return ErrInvalidSaltLength - } - _, err = AggregateVoteHashFromHexString(msg.Salt) - if err != nil { - return errors.Wrap(ErrInvalidSaltFormat, "salt must be a valid hex string") + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid authority address (%s)", err) } return nil } -// NewMsgDelegateFeedConsent creates a MsgDelegateFeedConsent instance -func NewMsgDelegateFeedConsent(operatorAddress sdk.ValAddress, feederAddress sdk.AccAddress) *MsgDelegateFeedConsent { - return &MsgDelegateFeedConsent{ - Operator: operatorAddress.String(), - Delegate: feederAddress.String(), +// NewMsgUpdateParams creates a MsgUpdateParams instance +func NewMsgUpdateParams(params *Params) *MsgUpdateParams { + return &MsgUpdateParams{ + Params: params, } } // Route implements sdk.Msg -func (msg MsgDelegateFeedConsent) Route() string { return RouterKey } +func (msg MsgUpdateParams) Route() string { return RouterKey } // Type implements sdk.Msg -func (msg MsgDelegateFeedConsent) Type() string { return TypeMsgDelegateFeedConsent } - -// GetSignBytes implements sdk.Msg -func (msg MsgDelegateFeedConsent) GetSignBytes() []byte { - return sdk.MustSortJSON(ModuleCdc.MustMarshalJSON(&msg)) -} +func (msg MsgUpdateParams) Type() string { return TypeMsgUpdateParams } // GetSigners implements sdk.Msg -func (msg MsgDelegateFeedConsent) GetSigners() []sdk.AccAddress { - operator, err := sdk.ValAddressFromBech32(msg.Operator) - if err != nil { - panic(err) - } - - return []sdk.AccAddress{sdk.AccAddress(operator)} +func (msg MsgUpdateParams) GetSigners() []sdk.AccAddress { + addr, _ := sdk.AccAddressFromBech32(msg.Authority) + return []sdk.AccAddress{addr} } // ValidateBasic implements sdk.Msg -func (msg MsgDelegateFeedConsent) ValidateBasic() error { - _, err := sdk.ValAddressFromBech32(msg.Operator) +func (msg MsgUpdateParams) ValidateBasic() error { + _, err := sdk.AccAddressFromBech32(msg.Authority) if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid operator address (%s)", err) + return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid authority address (%s)", err) } - _, err = sdk.AccAddressFromBech32(msg.Delegate) - if err != nil { - return errors.Wrapf(sdkerrors.ErrInvalidAddress, "Invalid delegate address (%s)", err) - } - - return nil + return msg.Params.Validate() } diff --git a/x/oracle/types/msgs_test.go b/x/oracle/types/msgs_test.go index 2d7e05c6..429d36cf 100644 --- a/x/oracle/types/msgs_test.go +++ b/x/oracle/types/msgs_test.go @@ -2,110 +2,8 @@ package types_test import ( "math/rand" - "testing" - - "github.com/Team-Kujira/core/x/oracle/types" - - "github.com/stretchr/testify/require" - - sdk "github.com/cosmos/cosmos-sdk/types" ) -func TestMsgFeederDelegation(t *testing.T) { - addrs := []sdk.AccAddress{ - sdk.AccAddress([]byte("addr1_______________")), - sdk.AccAddress([]byte("addr2_______________")), - } - - tests := []struct { - delegator sdk.ValAddress - delegate sdk.AccAddress - expectPass bool - }{ - {sdk.ValAddress(addrs[0]), addrs[1], true}, - {sdk.ValAddress{}, addrs[1], false}, - {sdk.ValAddress(addrs[0]), sdk.AccAddress{}, false}, - {nil, nil, false}, - } - - for i, tc := range tests { - msg := types.NewMsgDelegateFeedConsent(tc.delegator, tc.delegate) - if tc.expectPass { - require.Nil(t, msg.ValidateBasic(), "test: %v", i) - } else { - require.NotNil(t, msg.ValidateBasic(), "test: %v", i) - } - } -} - -func TestMsgAggregateExchangeRatePrevote(t *testing.T) { - addrs := []sdk.AccAddress{ - sdk.AccAddress([]byte("addr1_______________")), - } - - exchangeRates := sdk.DecCoins{sdk.NewDecCoinFromDec(types.TestDenomD, sdk.OneDec()), sdk.NewDecCoinFromDec(types.TestDenomC, sdk.NewDecWithPrec(32121, 1))} - bz := types.GetAggregateVoteHash("1", exchangeRates.String(), sdk.ValAddress(addrs[0])) - - tests := []struct { - hash types.AggregateVoteHash - exchangeRates sdk.DecCoins - voter sdk.AccAddress - expectPass bool - }{ - {bz, exchangeRates, addrs[0], true}, - {bz[1:], exchangeRates, addrs[0], false}, - {bz, exchangeRates, sdk.AccAddress{}, false}, - {types.AggregateVoteHash{}, exchangeRates, addrs[0], false}, - } - - for i, tc := range tests { - msg := types.NewMsgAggregateExchangeRatePrevote(tc.hash, tc.voter, sdk.ValAddress(tc.voter)) - if tc.expectPass { - require.NoError(t, msg.ValidateBasic(), "test: %v", i) - } else { - require.Error(t, msg.ValidateBasic(), "test: %v", i) - } - } -} - -func TestMsgAggregateExchangeRateVote(t *testing.T) { - addrs := []sdk.AccAddress{ - sdk.AccAddress([]byte("addr1_______________")), - } - - invalidExchangeRates := "a,b" - exchangeRates := "1.0foo,1232.132bar" - abstainExchangeRates := "0.0foo,1232.132bar" - overFlowExchangeRates := "1000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000.0foo,1232.132bar" - - tests := []struct { - voter sdk.AccAddress - validator sdk.ValAddress - salt string - exchangeRates string - expectPass bool - }{ - {addrs[0], sdk.ValAddress(addrs[0]), "fc246cf5a18c7a650a6a226ebc589d49a9a814d6f1f586405e8726e5cf2a7d80", exchangeRates, true}, - {addrs[0], sdk.ValAddress(addrs[0]), "fc246cf5a18c7a650a6a226ebc589d49a9a814d6f1f586405e8726e5cf2a7d80", invalidExchangeRates, false}, - {addrs[0], sdk.ValAddress(addrs[0]), "fc246cf5a18c7a650a6a226ebc589d49a9a814d6f1f586405e8726e5cf2a7d80", abstainExchangeRates, true}, - {addrs[0], sdk.ValAddress(addrs[0]), "fc246cf5a18c7a650a6a226ebc589d49a9a814d6f1f586405e8726e5cf2a7d80", overFlowExchangeRates, false}, - {sdk.AccAddress{}, sdk.ValAddress(addrs[0]), "fc246cf5a18c7a650a6a226ebc589d49a9a814d6f1f586405e8726e5cf2a7d80", exchangeRates, false}, - {addrs[0], sdk.ValAddress(addrs[0]), "fc246cf5a18c7a650a6a226ebc589d49a9a814d6f1f586405e8726e5cf2a7d80", "", false}, - {addrs[0], sdk.ValAddress(addrs[0]), "", randSeq(4097), false}, - {addrs[0], sdk.ValAddress{}, "fc246cf5a18c7a650a6a226ebc589d49a9a814d6f1f586405e8726e5cf2a7d80", abstainExchangeRates, false}, - {addrs[0], sdk.ValAddress(addrs[0]), "", abstainExchangeRates, false}, - } - - for i, tc := range tests { - msg := types.NewMsgAggregateExchangeRateVote(tc.salt, tc.exchangeRates, tc.voter, tc.validator) - if tc.expectPass { - require.Nil(t, msg.ValidateBasic(), "test: %v", i) - } else { - require.NotNil(t, msg.ValidateBasic(), "test: %v", i) - } - } -} - var letters = []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ") func randSeq(n int) string { diff --git a/x/oracle/types/oracle.go b/x/oracle/types/oracle.go new file mode 100644 index 00000000..015a685b --- /dev/null +++ b/x/oracle/types/oracle.go @@ -0,0 +1,62 @@ +package types + +import ( + "bytes" + "compress/zlib" + "crypto/sha256" + "encoding/binary" + io "io" +) + +func DenomToID(denom string) (uint64, error) { + hash := sha256.New() + if _, err := hash.Write([]byte(denom)); err != nil { + return 0, err + } + + md := hash.Sum(nil) + return binary.LittleEndian.Uint64(md), nil +} + +func (m VoteExtension) Compress() ([]byte, error) { + // Encode vote extension to bytes + bz, err := m.Marshal() + if err != nil { + return nil, err + } + + var b bytes.Buffer + + // we use the best compression level as size reduction is prioritized + w := zlib.NewWriter(&b) + defer w.Close() + + // write and flush the buffer + if _, err := w.Write(bz); err != nil { + return nil, err + } + if err := w.Close(); err != nil { + return nil, err + } + + return b.Bytes(), nil +} + +func (m *VoteExtension) Decompress(bz []byte) error { + if len(bz) == 0 { + return nil + } + r, err := zlib.NewReader(bytes.NewReader(bz)) + if err != nil { + return err + } + r.Close() + + // read bytes and return + veBz, err := io.ReadAll(r) + if err != nil { + return err + } + + return m.Unmarshal(veBz) +} diff --git a/x/oracle/types/oracle.pb.go b/x/oracle/types/oracle.pb.go index 858f964b..25ce794c 100644 --- a/x/oracle/types/oracle.pb.go +++ b/x/oracle/types/oracle.pb.go @@ -4,9 +4,9 @@ package types import ( + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" _ "github.com/cosmos/cosmos-sdk/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/cosmos/gogoproto/proto" io "io" @@ -27,14 +27,13 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // Params defines the parameters for the oracle module. type Params struct { - VotePeriod uint64 `protobuf:"varint,1,opt,name=vote_period,json=votePeriod,proto3" json:"vote_period,omitempty" yaml:"vote_period"` - VoteThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"vote_threshold" yaml:"vote_threshold"` - RewardBand github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=reward_band,json=rewardBand,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"reward_band" yaml:"reward_band"` - RewardDistributionWindow uint64 `protobuf:"varint,4,opt,name=reward_distribution_window,json=rewardDistributionWindow,proto3" json:"reward_distribution_window,omitempty" yaml:"reward_distribution_window"` - Whitelist DenomList `protobuf:"bytes,5,rep,name=whitelist,proto3,castrepeated=DenomList" json:"whitelist" yaml:"whitelist"` - SlashFraction github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,6,opt,name=slash_fraction,json=slashFraction,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"slash_fraction" yaml:"slash_fraction"` - SlashWindow uint64 `protobuf:"varint,7,opt,name=slash_window,json=slashWindow,proto3" json:"slash_window,omitempty" yaml:"slash_window"` - MinValidPerWindow github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,8,opt,name=min_valid_per_window,json=minValidPerWindow,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_valid_per_window" yaml:"min_valid_per_window"` + VoteThreshold cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=vote_threshold,json=voteThreshold,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"vote_threshold" yaml:"vote_threshold"` + MaxDeviation cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=max_deviation,json=maxDeviation,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"max_deviation" yaml:"max_deviation"` + RequiredSymbols []Symbol `protobuf:"bytes,3,rep,name=required_symbols,json=requiredSymbols,proto3" json:"required_symbols" yaml:"required_symbols"` + LastSymbolId uint32 `protobuf:"varint,4,opt,name=last_symbol_id,json=lastSymbolId,proto3" json:"last_symbol_id,omitempty"` + SlashFraction cosmossdk_io_math.LegacyDec `protobuf:"bytes,5,opt,name=slash_fraction,json=slashFraction,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"slash_fraction" yaml:"slash_fraction"` + SlashWindow uint64 `protobuf:"varint,6,opt,name=slash_window,json=slashWindow,proto3" json:"slash_window,omitempty" yaml:"slash_window"` + MinValidPerWindow cosmossdk_io_math.LegacyDec `protobuf:"bytes,7,opt,name=min_valid_per_window,json=minValidPerWindow,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_valid_per_window" yaml:"min_valid_per_window"` } func (m *Params) Reset() { *m = Params{} } @@ -69,27 +68,20 @@ func (m *Params) XXX_DiscardUnknown() { var xxx_messageInfo_Params proto.InternalMessageInfo -func (m *Params) GetVotePeriod() uint64 { +func (m *Params) GetRequiredSymbols() []Symbol { if m != nil { - return m.VotePeriod + return m.RequiredSymbols } - return 0 + return nil } -func (m *Params) GetRewardDistributionWindow() uint64 { +func (m *Params) GetLastSymbolId() uint32 { if m != nil { - return m.RewardDistributionWindow + return m.LastSymbolId } return 0 } -func (m *Params) GetWhitelist() DenomList { - if m != nil { - return m.Whitelist - } - return nil -} - func (m *Params) GetSlashWindow() uint64 { if m != nil { return m.SlashWindow @@ -134,26 +126,23 @@ func (m *Denom) XXX_DiscardUnknown() { var xxx_messageInfo_Denom proto.InternalMessageInfo -// struct for aggregate prevoting on the ExchangeRateVote. -// The purpose of aggregate prevote is to hide vote exchange rates with hash -// which is formatted as hex string in SHA256("{salt}:{exchange rate}{denom},...,{exchange rate}{denom}:{voter}") -type AggregateExchangeRatePrevote struct { - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty" yaml:"hash"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty" yaml:"voter"` - SubmitBlock uint64 `protobuf:"varint,3,opt,name=submit_block,json=submitBlock,proto3" json:"submit_block,omitempty" yaml:"submit_block"` +// Symbol - the object to hold configurations of each symbol +type Symbol struct { + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` + Id uint32 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` } -func (m *AggregateExchangeRatePrevote) Reset() { *m = AggregateExchangeRatePrevote{} } -func (*AggregateExchangeRatePrevote) ProtoMessage() {} -func (*AggregateExchangeRatePrevote) Descriptor() ([]byte, []int) { +func (m *Symbol) Reset() { *m = Symbol{} } +func (*Symbol) ProtoMessage() {} +func (*Symbol) Descriptor() ([]byte, []int) { return fileDescriptor_8fffe8fb5ee63325, []int{2} } -func (m *AggregateExchangeRatePrevote) XXX_Unmarshal(b []byte) error { +func (m *Symbol) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *AggregateExchangeRatePrevote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *Symbol) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_AggregateExchangeRatePrevote.Marshal(b, m, deterministic) + return xxx_messageInfo_Symbol.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -163,35 +152,35 @@ func (m *AggregateExchangeRatePrevote) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *AggregateExchangeRatePrevote) XXX_Merge(src proto.Message) { - xxx_messageInfo_AggregateExchangeRatePrevote.Merge(m, src) +func (m *Symbol) XXX_Merge(src proto.Message) { + xxx_messageInfo_Symbol.Merge(m, src) } -func (m *AggregateExchangeRatePrevote) XXX_Size() int { +func (m *Symbol) XXX_Size() int { return m.Size() } -func (m *AggregateExchangeRatePrevote) XXX_DiscardUnknown() { - xxx_messageInfo_AggregateExchangeRatePrevote.DiscardUnknown(m) +func (m *Symbol) XXX_DiscardUnknown() { + xxx_messageInfo_Symbol.DiscardUnknown(m) } -var xxx_messageInfo_AggregateExchangeRatePrevote proto.InternalMessageInfo +var xxx_messageInfo_Symbol proto.InternalMessageInfo -// MsgAggregateExchangeRateVote - struct for voting on exchange rates. -type AggregateExchangeRateVote struct { - ExchangeRateTuples ExchangeRateTuples `protobuf:"bytes,1,rep,name=exchange_rate_tuples,json=exchangeRateTuples,proto3,castrepeated=ExchangeRateTuples" json:"exchange_rate_tuples" yaml:"exchange_rate_tuples"` - Voter string `protobuf:"bytes,2,opt,name=voter,proto3" json:"voter,omitempty" yaml:"voter"` +// ExchangeRateTuple - struct to store interpreted exchange rates data to store +type ExchangeRateTuple struct { + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty" yaml:"symbol"` + ExchangeRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,2,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"exchange_rate" yaml:"exchange_rate"` } -func (m *AggregateExchangeRateVote) Reset() { *m = AggregateExchangeRateVote{} } -func (*AggregateExchangeRateVote) ProtoMessage() {} -func (*AggregateExchangeRateVote) Descriptor() ([]byte, []int) { +func (m *ExchangeRateTuple) Reset() { *m = ExchangeRateTuple{} } +func (*ExchangeRateTuple) ProtoMessage() {} +func (*ExchangeRateTuple) Descriptor() ([]byte, []int) { return fileDescriptor_8fffe8fb5ee63325, []int{3} } -func (m *AggregateExchangeRateVote) XXX_Unmarshal(b []byte) error { +func (m *ExchangeRateTuple) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *AggregateExchangeRateVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *ExchangeRateTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_AggregateExchangeRateVote.Marshal(b, m, deterministic) + return xxx_messageInfo_ExchangeRateTuple.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -201,35 +190,35 @@ func (m *AggregateExchangeRateVote) XXX_Marshal(b []byte, deterministic bool) ([ return b[:n], nil } } -func (m *AggregateExchangeRateVote) XXX_Merge(src proto.Message) { - xxx_messageInfo_AggregateExchangeRateVote.Merge(m, src) +func (m *ExchangeRateTuple) XXX_Merge(src proto.Message) { + xxx_messageInfo_ExchangeRateTuple.Merge(m, src) } -func (m *AggregateExchangeRateVote) XXX_Size() int { +func (m *ExchangeRateTuple) XXX_Size() int { return m.Size() } -func (m *AggregateExchangeRateVote) XXX_DiscardUnknown() { - xxx_messageInfo_AggregateExchangeRateVote.DiscardUnknown(m) +func (m *ExchangeRateTuple) XXX_DiscardUnknown() { + xxx_messageInfo_ExchangeRateTuple.DiscardUnknown(m) } -var xxx_messageInfo_AggregateExchangeRateVote proto.InternalMessageInfo +var xxx_messageInfo_ExchangeRateTuple proto.InternalMessageInfo -// ExchangeRateTuple - struct to store interpreted exchange rates data to store -type ExchangeRateTuple struct { - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty" yaml:"denom"` - ExchangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,2,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"exchange_rate" yaml:"exchange_rate"` +type VoteExtension struct { + Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + Prices map[uint32][]byte `protobuf:"bytes,2,rep,name=prices,proto3" json:"prices,omitempty" protobuf_key:"varint,1,opt,name=key,proto3" protobuf_val:"bytes,2,opt,name=value,proto3"` } -func (m *ExchangeRateTuple) Reset() { *m = ExchangeRateTuple{} } -func (*ExchangeRateTuple) ProtoMessage() {} -func (*ExchangeRateTuple) Descriptor() ([]byte, []int) { +func (m *VoteExtension) Reset() { *m = VoteExtension{} } +func (m *VoteExtension) String() string { return proto.CompactTextString(m) } +func (*VoteExtension) ProtoMessage() {} +func (*VoteExtension) Descriptor() ([]byte, []int) { return fileDescriptor_8fffe8fb5ee63325, []int{4} } -func (m *ExchangeRateTuple) XXX_Unmarshal(b []byte) error { +func (m *VoteExtension) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *ExchangeRateTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *VoteExtension) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_ExchangeRateTuple.Marshal(b, m, deterministic) + return xxx_messageInfo_VoteExtension.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -239,77 +228,88 @@ func (m *ExchangeRateTuple) XXX_Marshal(b []byte, deterministic bool) ([]byte, e return b[:n], nil } } -func (m *ExchangeRateTuple) XXX_Merge(src proto.Message) { - xxx_messageInfo_ExchangeRateTuple.Merge(m, src) +func (m *VoteExtension) XXX_Merge(src proto.Message) { + xxx_messageInfo_VoteExtension.Merge(m, src) } -func (m *ExchangeRateTuple) XXX_Size() int { +func (m *VoteExtension) XXX_Size() int { return m.Size() } -func (m *ExchangeRateTuple) XXX_DiscardUnknown() { - xxx_messageInfo_ExchangeRateTuple.DiscardUnknown(m) +func (m *VoteExtension) XXX_DiscardUnknown() { + xxx_messageInfo_VoteExtension.DiscardUnknown(m) } -var xxx_messageInfo_ExchangeRateTuple proto.InternalMessageInfo +var xxx_messageInfo_VoteExtension proto.InternalMessageInfo + +func (m *VoteExtension) GetHeight() int64 { + if m != nil { + return m.Height + } + return 0 +} + +func (m *VoteExtension) GetPrices() map[uint32][]byte { + if m != nil { + return m.Prices + } + return nil +} func init() { proto.RegisterType((*Params)(nil), "kujira.oracle.Params") proto.RegisterType((*Denom)(nil), "kujira.oracle.Denom") - proto.RegisterType((*AggregateExchangeRatePrevote)(nil), "kujira.oracle.AggregateExchangeRatePrevote") - proto.RegisterType((*AggregateExchangeRateVote)(nil), "kujira.oracle.AggregateExchangeRateVote") + proto.RegisterType((*Symbol)(nil), "kujira.oracle.Symbol") proto.RegisterType((*ExchangeRateTuple)(nil), "kujira.oracle.ExchangeRateTuple") + proto.RegisterType((*VoteExtension)(nil), "kujira.oracle.VoteExtension") + proto.RegisterMapType((map[uint32][]byte)(nil), "kujira.oracle.VoteExtension.PricesEntry") } func init() { proto.RegisterFile("kujira/oracle/oracle.proto", fileDescriptor_8fffe8fb5ee63325) } var fileDescriptor_8fffe8fb5ee63325 = []byte{ - // 737 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0x41, 0x6f, 0xd3, 0x48, - 0x14, 0x8e, 0xb7, 0x6d, 0xb6, 0x99, 0x24, 0xbb, 0xad, 0x37, 0xbb, 0xeb, 0xcd, 0xae, 0xe2, 0xec, - 0xac, 0x5a, 0x55, 0x2b, 0x35, 0x56, 0xe1, 0x80, 0xc8, 0x0d, 0x2b, 0x94, 0x03, 0x20, 0x45, 0x56, - 0x55, 0x04, 0x97, 0x68, 0x6c, 0x0f, 0xf1, 0x10, 0xdb, 0x13, 0xcd, 0x38, 0x4d, 0x7b, 0xe1, 0xcc, - 0x05, 0xc4, 0x91, 0x63, 0xcf, 0xdc, 0xe1, 0x37, 0xf4, 0xd8, 0x23, 0xe2, 0x60, 0xa0, 0xbd, 0x70, - 0xce, 0x2f, 0x40, 0x33, 0xe3, 0xb4, 0x4e, 0x93, 0x03, 0x15, 0xa7, 0xf4, 0xbd, 0xef, 0xcd, 0xf7, - 0xbd, 0xf9, 0xde, 0x9b, 0x1a, 0xd4, 0x07, 0xa3, 0x67, 0x84, 0x21, 0x8b, 0x32, 0xe4, 0x85, 0x38, - 0xfb, 0x69, 0x0d, 0x19, 0x4d, 0xa8, 0x5e, 0x55, 0x58, 0x4b, 0x25, 0xeb, 0xb5, 0x3e, 0xed, 0x53, - 0x89, 0x58, 0xe2, 0x2f, 0x55, 0x54, 0x6f, 0x78, 0x94, 0x47, 0x94, 0x5b, 0x2e, 0xe2, 0xd8, 0x3a, - 0xd8, 0x71, 0x71, 0x82, 0x76, 0x2c, 0x8f, 0x92, 0x58, 0xe1, 0xf0, 0x55, 0x11, 0x14, 0xbb, 0x88, - 0xa1, 0x88, 0xeb, 0xb7, 0x40, 0xf9, 0x80, 0x26, 0xb8, 0x37, 0xc4, 0x8c, 0x50, 0xdf, 0xd0, 0x9a, - 0xda, 0xd6, 0xb2, 0xfd, 0xc7, 0x24, 0x35, 0xf5, 0x23, 0x14, 0x85, 0x6d, 0x98, 0x03, 0xa1, 0x03, - 0x44, 0xd4, 0x95, 0x81, 0x1e, 0x83, 0x5f, 0x24, 0x96, 0x04, 0x0c, 0xf3, 0x80, 0x86, 0xbe, 0xf1, - 0x53, 0x53, 0xdb, 0x2a, 0xd9, 0xf7, 0x4e, 0x52, 0xb3, 0xf0, 0x31, 0x35, 0x37, 0xfb, 0x24, 0x09, - 0x46, 0x6e, 0xcb, 0xa3, 0x91, 0x95, 0xb5, 0xa3, 0x7e, 0xb6, 0xb9, 0x3f, 0xb0, 0x92, 0xa3, 0x21, - 0xe6, 0xad, 0x0e, 0xf6, 0x26, 0xa9, 0xf9, 0x7b, 0x4e, 0xe9, 0x82, 0x0d, 0x3a, 0x55, 0x91, 0xd8, - 0x9b, 0xc6, 0x3a, 0x06, 0x65, 0x86, 0xc7, 0x88, 0xf9, 0x3d, 0x17, 0xc5, 0xbe, 0xb1, 0x24, 0xc5, - 0x3a, 0xd7, 0x16, 0xcb, 0xae, 0x95, 0xa3, 0x82, 0x0e, 0x50, 0x91, 0x8d, 0x62, 0x5f, 0xf7, 0x40, - 0x3d, 0xc3, 0x7c, 0xc2, 0x13, 0x46, 0xdc, 0x51, 0x42, 0x68, 0xdc, 0x1b, 0x93, 0xd8, 0xa7, 0x63, - 0x63, 0x59, 0xda, 0xb3, 0x31, 0x49, 0xcd, 0x7f, 0x67, 0x78, 0x16, 0xd4, 0x42, 0xc7, 0x50, 0x60, - 0x27, 0x87, 0x3d, 0x92, 0x90, 0xfe, 0x18, 0x94, 0xc6, 0x01, 0x49, 0x70, 0x48, 0x78, 0x62, 0xac, - 0x34, 0x97, 0xb6, 0xca, 0x37, 0x6a, 0xad, 0x99, 0xc1, 0xb6, 0x3a, 0x38, 0xa6, 0x91, 0xbd, 0x21, - 0xee, 0x37, 0x49, 0xcd, 0x35, 0xa5, 0x76, 0x71, 0x08, 0xbe, 0xfd, 0x64, 0x96, 0x64, 0xc9, 0x03, - 0xc2, 0x13, 0xe7, 0x92, 0x4d, 0x8c, 0x85, 0x87, 0x88, 0x07, 0xbd, 0xa7, 0x0c, 0x79, 0x42, 0xd2, - 0x28, 0xfe, 0xd8, 0x58, 0x66, 0xd9, 0xa0, 0x53, 0x95, 0x89, 0xdd, 0x2c, 0xd6, 0xdb, 0xa0, 0xa2, - 0x2a, 0x32, 0x87, 0x7e, 0x96, 0x0e, 0xfd, 0x39, 0x49, 0xcd, 0xdf, 0xf2, 0xe7, 0xa7, 0x9e, 0x94, - 0x65, 0x98, 0xd9, 0xf0, 0x1c, 0xd4, 0x22, 0x12, 0xf7, 0x0e, 0x50, 0x48, 0x7c, 0xb1, 0x63, 0x53, - 0x8e, 0x55, 0xd9, 0xf1, 0xc3, 0x6b, 0x77, 0xfc, 0xb7, 0x52, 0x5c, 0xc4, 0x09, 0x9d, 0xf5, 0x88, - 0xc4, 0xfb, 0x22, 0xdb, 0xc5, 0x4c, 0xe9, 0xb7, 0x57, 0xdf, 0x1c, 0x9b, 0x85, 0xaf, 0xc7, 0xa6, - 0x06, 0xdb, 0x60, 0x45, 0xba, 0xa9, 0xff, 0x07, 0x96, 0x63, 0x14, 0x61, 0xf9, 0x0e, 0x4a, 0xf6, - 0xaf, 0x93, 0xd4, 0x2c, 0x2b, 0x52, 0x91, 0x85, 0x8e, 0x04, 0xdb, 0x95, 0x17, 0xc7, 0x66, 0x21, - 0x3b, 0x5b, 0x80, 0xef, 0x34, 0xf0, 0xcf, 0x9d, 0x7e, 0x9f, 0xe1, 0x3e, 0x4a, 0xf0, 0xdd, 0x43, - 0x2f, 0x40, 0x71, 0x1f, 0x3b, 0x28, 0xc1, 0x5d, 0x86, 0xc5, 0x0a, 0x0b, 0xce, 0x00, 0xf1, 0x60, - 0x9e, 0x53, 0x64, 0xa1, 0x23, 0x41, 0x7d, 0x13, 0xac, 0x88, 0x62, 0x96, 0xbd, 0xa2, 0xb5, 0x49, - 0x6a, 0x56, 0x2e, 0xdf, 0x05, 0x83, 0x8e, 0x82, 0xa5, 0xdf, 0x23, 0x37, 0x22, 0x49, 0xcf, 0x0d, - 0xa9, 0x37, 0x90, 0xef, 0x60, 0xd6, 0xef, 0x1c, 0x2a, 0xfc, 0x96, 0xa1, 0x2d, 0xa2, 0x2b, 0x7d, - 0x7f, 0xd1, 0xc0, 0x5f, 0x0b, 0xfb, 0xde, 0x17, 0x4d, 0xbf, 0xd4, 0x40, 0x0d, 0x67, 0xc9, 0x1e, - 0x43, 0xe2, 0x69, 0x8e, 0x86, 0x21, 0xe6, 0x86, 0x26, 0xd7, 0xb5, 0x79, 0x65, 0x5d, 0xf3, 0xe7, - 0xf7, 0x44, 0xa1, 0x7d, 0x3b, 0x5b, 0xdd, 0x6c, 0x28, 0x8b, 0xb8, 0xc4, 0x16, 0xeb, 0x73, 0x27, - 0xb9, 0xa3, 0xe3, 0xb9, 0xdc, 0xf7, 0xfa, 0x73, 0xe5, 0x8e, 0xef, 0x35, 0xb0, 0x3e, 0x27, 0x20, - 0xb8, 0x7c, 0x31, 0xed, 0x6c, 0x22, 0x39, 0x2e, 0x99, 0x86, 0x8e, 0x82, 0xf5, 0x01, 0xa8, 0xce, - 0xb4, 0x9d, 0x69, 0xef, 0x5e, 0x7b, 0x31, 0x6b, 0x0b, 0x3c, 0x80, 0x4e, 0x25, 0x7f, 0xcd, 0xd9, - 0xc6, 0xed, 0xce, 0xc9, 0x59, 0x43, 0x3b, 0x3d, 0x6b, 0x68, 0x9f, 0xcf, 0x1a, 0xda, 0xeb, 0xf3, - 0x46, 0xe1, 0xf4, 0xbc, 0x51, 0xf8, 0x70, 0xde, 0x28, 0x3c, 0xf9, 0x3f, 0xa7, 0xba, 0x87, 0x51, - 0xb4, 0x7d, 0x5f, 0x7d, 0x2c, 0x3c, 0xca, 0xb0, 0x75, 0x38, 0xfd, 0x66, 0x48, 0x75, 0xb7, 0x28, - 0xff, 0xdd, 0xdf, 0xfc, 0x16, 0x00, 0x00, 0xff, 0xff, 0x17, 0x91, 0xdd, 0x52, 0x51, 0x06, 0x00, - 0x00, + // 681 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xbf, 0x6f, 0xd3, 0x4c, + 0x18, 0x8e, 0x93, 0x34, 0xdf, 0xf7, 0x5d, 0xe2, 0xfe, 0xf0, 0x97, 0xb6, 0x51, 0x2a, 0xc5, 0x91, + 0x61, 0x08, 0x48, 0xd8, 0x2a, 0x2c, 0x10, 0x10, 0x42, 0x51, 0x8a, 0x84, 0x60, 0xa8, 0x8e, 0xaa, + 0x48, 0x2c, 0xee, 0xc5, 0x7e, 0x89, 0x8f, 0xda, 0xbe, 0xe0, 0xbb, 0xa4, 0xc9, 0x7f, 0xc0, 0xc8, + 0xc8, 0xd8, 0x81, 0x99, 0xbf, 0xa3, 0x63, 0x47, 0xc4, 0x10, 0xa1, 0x76, 0x61, 0xce, 0xc4, 0x88, + 0x7c, 0xe7, 0xa0, 0x26, 0x62, 0xa8, 0x3a, 0xd9, 0xcf, 0xf3, 0xbe, 0xcf, 0xf3, 0xbe, 0xf7, 0xde, + 0xab, 0x43, 0xf5, 0xe3, 0xe1, 0x7b, 0x9a, 0x10, 0x87, 0x25, 0xc4, 0x0b, 0x21, 0xfb, 0xd8, 0x83, + 0x84, 0x09, 0x66, 0xe8, 0x2a, 0x66, 0x2b, 0xb2, 0x5e, 0xed, 0xb3, 0x3e, 0x93, 0x11, 0x27, 0xfd, + 0x53, 0x49, 0xf5, 0x86, 0xc7, 0x78, 0xc4, 0xb8, 0xd3, 0x23, 0x1c, 0x9c, 0xd1, 0x6e, 0x0f, 0x04, + 0xd9, 0x75, 0x3c, 0x46, 0x63, 0x15, 0xb7, 0x7e, 0x15, 0x51, 0x69, 0x9f, 0x24, 0x24, 0xe2, 0x86, + 0x87, 0x56, 0x47, 0x4c, 0x80, 0x2b, 0x82, 0x04, 0x78, 0xc0, 0x42, 0xbf, 0xa6, 0x35, 0xb5, 0xd6, + 0x7f, 0x9d, 0x27, 0x67, 0x53, 0x33, 0xf7, 0x7d, 0x6a, 0xee, 0x28, 0x2b, 0xee, 0x1f, 0xdb, 0x94, + 0x39, 0x11, 0x11, 0x81, 0xfd, 0x0a, 0xfa, 0xc4, 0x9b, 0x74, 0xc1, 0x9b, 0x4d, 0xcd, 0xcd, 0x09, + 0x89, 0xc2, 0xb6, 0xb5, 0x68, 0x61, 0x61, 0x3d, 0x25, 0x0e, 0xe6, 0xd8, 0x38, 0x42, 0x7a, 0x44, + 0xc6, 0xae, 0x0f, 0x23, 0x4a, 0x04, 0x65, 0x71, 0x2d, 0x2f, 0x6b, 0x3c, 0xbe, 0x5e, 0x8d, 0xaa, + 0xaa, 0xb1, 0xe0, 0x60, 0xe1, 0x4a, 0x44, 0xc6, 0xdd, 0x39, 0x34, 0x08, 0x5a, 0x4f, 0xe0, 0xc3, + 0x90, 0x26, 0xe0, 0xbb, 0x7c, 0x12, 0xf5, 0x58, 0xc8, 0x6b, 0x85, 0x66, 0xa1, 0x55, 0xbe, 0xbf, + 0x69, 0x2f, 0x4c, 0xcc, 0x7e, 0x2d, 0xa3, 0x1d, 0x33, 0xad, 0x3d, 0x9b, 0x9a, 0xdb, 0xca, 0x7c, + 0x59, 0x6c, 0xe1, 0xb5, 0x39, 0xa5, 0x04, 0xdc, 0xb8, 0x8d, 0x56, 0x43, 0xc2, 0x45, 0x96, 0xe1, + 0x52, 0xbf, 0x56, 0x6c, 0x6a, 0x2d, 0x1d, 0x57, 0x52, 0x56, 0x25, 0xbd, 0xf0, 0xd3, 0x79, 0xf2, + 0x90, 0xf0, 0xc0, 0x7d, 0x97, 0x10, 0x4f, 0x9e, 0x75, 0xe5, 0x06, 0xf3, 0x5c, 0xb4, 0xb0, 0xb0, + 0x2e, 0x89, 0xe7, 0x19, 0x36, 0xda, 0xa8, 0xa2, 0x32, 0x4e, 0x68, 0xec, 0xb3, 0x93, 0x5a, 0xa9, + 0xa9, 0xb5, 0x8a, 0x9d, 0xed, 0xd9, 0xd4, 0xfc, 0xff, 0xaa, 0x5e, 0x45, 0x2d, 0x5c, 0x96, 0xf0, + 0x8d, 0x44, 0x06, 0x47, 0xd5, 0x88, 0xc6, 0xee, 0x88, 0x84, 0xd4, 0x77, 0x07, 0x90, 0xcc, 0x3d, + 0xfe, 0x91, 0x6d, 0x76, 0xae, 0xd7, 0xe6, 0x4e, 0x76, 0x25, 0x7f, 0x31, 0xb2, 0xf0, 0x46, 0x44, + 0xe3, 0xc3, 0x94, 0xdd, 0x87, 0x44, 0x15, 0x6d, 0xff, 0xfb, 0xf9, 0xd4, 0xcc, 0xfd, 0x3c, 0x35, + 0x35, 0xab, 0x8d, 0x56, 0xba, 0x10, 0xb3, 0xc8, 0xb8, 0x85, 0x8a, 0x31, 0x89, 0x20, 0x5b, 0xb7, + 0xb5, 0xd9, 0xd4, 0x2c, 0x2b, 0xd3, 0x94, 0xb5, 0xb0, 0x0c, 0xb6, 0x2b, 0x1f, 0x4f, 0xcd, 0x5c, + 0xa6, 0xcd, 0x59, 0x4f, 0x51, 0x49, 0xcd, 0xd9, 0xd8, 0x42, 0x25, 0x75, 0x0d, 0x4a, 0x8e, 0x33, + 0x64, 0xac, 0xa2, 0x3c, 0xf5, 0xe5, 0x76, 0xe9, 0x38, 0x4f, 0xfd, 0x25, 0xfd, 0x57, 0x0d, 0x6d, + 0xec, 0x8d, 0xbd, 0x80, 0xc4, 0x7d, 0xc0, 0x44, 0xc0, 0xc1, 0x70, 0x10, 0x82, 0x71, 0x67, 0xd1, + 0xab, 0xb3, 0x31, 0x9b, 0x9a, 0x7a, 0x36, 0x46, 0xc9, 0x5b, 0x7f, 0xec, 0x8f, 0x90, 0x0e, 0x99, + 0xde, 0x4d, 0x88, 0x80, 0x1b, 0xed, 0xf1, 0x82, 0x83, 0x85, 0x2b, 0x70, 0xa5, 0xa3, 0xa5, 0x86, + 0xbf, 0x68, 0x48, 0x3f, 0x64, 0x02, 0xf6, 0xc6, 0x02, 0x62, 0x9e, 0xde, 0xfc, 0x16, 0x2a, 0x05, + 0x40, 0xfb, 0x81, 0x90, 0xcd, 0x16, 0x70, 0x86, 0x8c, 0x67, 0xa8, 0x34, 0x48, 0xa8, 0x07, 0xbc, + 0x96, 0x97, 0x5b, 0xdf, 0x5a, 0xda, 0xfa, 0x05, 0x17, 0x7b, 0x5f, 0xa6, 0xee, 0xc5, 0x22, 0x99, + 0xe0, 0x4c, 0x57, 0x7f, 0x84, 0xca, 0x57, 0x68, 0x63, 0x1d, 0x15, 0x8e, 0x61, 0x22, 0xab, 0xe8, + 0x38, 0xfd, 0x35, 0xaa, 0x68, 0x65, 0x44, 0xc2, 0xa1, 0x3a, 0x74, 0x05, 0x2b, 0xd0, 0xce, 0x3f, + 0xd4, 0x3a, 0xdd, 0xb3, 0x8b, 0x86, 0x76, 0x7e, 0xd1, 0xd0, 0x7e, 0x5c, 0x34, 0xb4, 0x4f, 0x97, + 0x8d, 0xdc, 0xf9, 0x65, 0x23, 0xf7, 0xed, 0xb2, 0x91, 0x7b, 0x7b, 0xb7, 0x4f, 0x45, 0x30, 0xec, + 0xd9, 0x1e, 0x8b, 0x9c, 0x03, 0x20, 0xd1, 0xbd, 0x97, 0xea, 0x65, 0xf3, 0x58, 0x02, 0xce, 0x78, + 0xfe, 0xc0, 0x89, 0xc9, 0x00, 0x78, 0xaf, 0x24, 0xdf, 0xa6, 0x07, 0xbf, 0x03, 0x00, 0x00, 0xff, + 0xff, 0x05, 0x9f, 0x62, 0x76, 0xfe, 0x04, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -331,26 +331,23 @@ func (this *Params) Equal(that interface{}) bool { } else if this == nil { return false } - if this.VotePeriod != that1.VotePeriod { - return false - } if !this.VoteThreshold.Equal(that1.VoteThreshold) { return false } - if !this.RewardBand.Equal(that1.RewardBand) { - return false - } - if this.RewardDistributionWindow != that1.RewardDistributionWindow { + if !this.MaxDeviation.Equal(that1.MaxDeviation) { return false } - if len(this.Whitelist) != len(that1.Whitelist) { + if len(this.RequiredSymbols) != len(that1.RequiredSymbols) { return false } - for i := range this.Whitelist { - if !this.Whitelist[i].Equal(&that1.Whitelist[i]) { + for i := range this.RequiredSymbols { + if !this.RequiredSymbols[i].Equal(&that1.RequiredSymbols[i]) { return false } } + if this.LastSymbolId != that1.LastSymbolId { + return false + } if !this.SlashFraction.Equal(that1.SlashFraction) { return false } @@ -391,11 +388,11 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintOracle(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x42 + dAtA[i] = 0x3a if m.SlashWindow != 0 { i = encodeVarintOracle(dAtA, i, uint64(m.SlashWindow)) i-- - dAtA[i] = 0x38 + dAtA[i] = 0x30 } { size := m.SlashFraction.Size() @@ -406,11 +403,16 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintOracle(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x32 - if len(m.Whitelist) > 0 { - for iNdEx := len(m.Whitelist) - 1; iNdEx >= 0; iNdEx-- { + dAtA[i] = 0x2a + if m.LastSymbolId != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.LastSymbolId)) + i-- + dAtA[i] = 0x20 + } + if len(m.RequiredSymbols) > 0 { + for iNdEx := len(m.RequiredSymbols) - 1; iNdEx >= 0; iNdEx-- { { - size, err := m.Whitelist[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + size, err := m.RequiredSymbols[iNdEx].MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -418,24 +420,19 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintOracle(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x2a + dAtA[i] = 0x1a } } - if m.RewardDistributionWindow != 0 { - i = encodeVarintOracle(dAtA, i, uint64(m.RewardDistributionWindow)) - i-- - dAtA[i] = 0x20 - } { - size := m.RewardBand.Size() + size := m.MaxDeviation.Size() i -= size - if _, err := m.RewardBand.MarshalTo(dAtA[i:]); err != nil { + if _, err := m.MaxDeviation.MarshalTo(dAtA[i:]); err != nil { return 0, err } i = encodeVarintOracle(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x1a + dAtA[i] = 0x12 { size := m.VoteThreshold.Size() i -= size @@ -445,12 +442,7 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { i = encodeVarintOracle(dAtA, i, uint64(size)) } i-- - dAtA[i] = 0x12 - if m.VotePeriod != 0 { - i = encodeVarintOracle(dAtA, i, uint64(m.VotePeriod)) - i-- - dAtA[i] = 0x8 - } + dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -484,7 +476,7 @@ func (m *Denom) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *AggregateExchangeRatePrevote) Marshal() (dAtA []byte, err error) { +func (m *Symbol) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -494,39 +486,32 @@ func (m *AggregateExchangeRatePrevote) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *AggregateExchangeRatePrevote) MarshalTo(dAtA []byte) (int, error) { +func (m *Symbol) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *AggregateExchangeRatePrevote) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *Symbol) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if m.SubmitBlock != 0 { - i = encodeVarintOracle(dAtA, i, uint64(m.SubmitBlock)) - i-- - dAtA[i] = 0x18 - } - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintOracle(dAtA, i, uint64(len(m.Voter))) + if m.Id != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.Id)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x10 } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintOracle(dAtA, i, uint64(len(m.Hash))) + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Symbol))) i-- dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *AggregateExchangeRateVote) Marshal() (dAtA []byte, err error) { +func (m *ExchangeRateTuple) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -536,41 +521,37 @@ func (m *AggregateExchangeRateVote) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *AggregateExchangeRateVote) MarshalTo(dAtA []byte) (int, error) { +func (m *ExchangeRateTuple) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *AggregateExchangeRateVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *ExchangeRateTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Voter) > 0 { - i -= len(m.Voter) - copy(dAtA[i:], m.Voter) - i = encodeVarintOracle(dAtA, i, uint64(len(m.Voter))) - i-- - dAtA[i] = 0x12 - } - if len(m.ExchangeRateTuples) > 0 { - for iNdEx := len(m.ExchangeRateTuples) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.ExchangeRateTuples[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintOracle(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + { + size := m.ExchangeRate.Size() + i -= size + if _, err := m.ExchangeRate.MarshalTo(dAtA[i:]); err != nil { + return 0, err } + i = encodeVarintOracle(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintOracle(dAtA, i, uint64(len(m.Symbol))) + i-- + dAtA[i] = 0xa } return len(dAtA) - i, nil } -func (m *ExchangeRateTuple) Marshal() (dAtA []byte, err error) { +func (m *VoteExtension) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -580,32 +561,39 @@ func (m *ExchangeRateTuple) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *ExchangeRateTuple) MarshalTo(dAtA []byte) (int, error) { +func (m *VoteExtension) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *ExchangeRateTuple) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *VoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - { - size := m.ExchangeRate.Size() - i -= size - if _, err := m.ExchangeRate.MarshalTo(dAtA[i:]); err != nil { - return 0, err + if len(m.Prices) > 0 { + for k := range m.Prices { + v := m.Prices[k] + baseI := i + if len(v) > 0 { + i -= len(v) + copy(dAtA[i:], v) + i = encodeVarintOracle(dAtA, i, uint64(len(v))) + i-- + dAtA[i] = 0x12 + } + i = encodeVarintOracle(dAtA, i, uint64(k)) + i-- + dAtA[i] = 0x8 + i = encodeVarintOracle(dAtA, i, uint64(baseI-i)) + i-- + dAtA[i] = 0x12 } - i = encodeVarintOracle(dAtA, i, uint64(size)) } - i-- - dAtA[i] = 0x12 - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintOracle(dAtA, i, uint64(len(m.Denom))) + if m.Height != 0 { + i = encodeVarintOracle(dAtA, i, uint64(m.Height)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x8 } return len(dAtA) - i, nil } @@ -627,22 +615,19 @@ func (m *Params) Size() (n int) { } var l int _ = l - if m.VotePeriod != 0 { - n += 1 + sovOracle(uint64(m.VotePeriod)) - } l = m.VoteThreshold.Size() n += 1 + l + sovOracle(uint64(l)) - l = m.RewardBand.Size() + l = m.MaxDeviation.Size() n += 1 + l + sovOracle(uint64(l)) - if m.RewardDistributionWindow != 0 { - n += 1 + sovOracle(uint64(m.RewardDistributionWindow)) - } - if len(m.Whitelist) > 0 { - for _, e := range m.Whitelist { + if len(m.RequiredSymbols) > 0 { + for _, e := range m.RequiredSymbols { l = e.Size() n += 1 + l + sovOracle(uint64(l)) } } + if m.LastSymbolId != 0 { + n += 1 + sovOracle(uint64(m.LastSymbolId)) + } l = m.SlashFraction.Size() n += 1 + l + sovOracle(uint64(l)) if m.SlashWindow != 0 { @@ -666,57 +651,58 @@ func (m *Denom) Size() (n int) { return n } -func (m *AggregateExchangeRatePrevote) Size() (n int) { +func (m *Symbol) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Hash) + l = len(m.Symbol) if l > 0 { n += 1 + l + sovOracle(uint64(l)) } - l = len(m.Voter) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) - } - if m.SubmitBlock != 0 { - n += 1 + sovOracle(uint64(m.SubmitBlock)) + if m.Id != 0 { + n += 1 + sovOracle(uint64(m.Id)) } return n } -func (m *AggregateExchangeRateVote) Size() (n int) { +func (m *ExchangeRateTuple) Size() (n int) { if m == nil { return 0 } var l int _ = l - if len(m.ExchangeRateTuples) > 0 { - for _, e := range m.ExchangeRateTuples { - l = e.Size() - n += 1 + l + sovOracle(uint64(l)) - } - } - l = len(m.Voter) + l = len(m.Symbol) if l > 0 { n += 1 + l + sovOracle(uint64(l)) } + l = m.ExchangeRate.Size() + n += 1 + l + sovOracle(uint64(l)) return n } -func (m *ExchangeRateTuple) Size() (n int) { +func (m *VoteExtension) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovOracle(uint64(l)) + if m.Height != 0 { + n += 1 + sovOracle(uint64(m.Height)) + } + if len(m.Prices) > 0 { + for k, v := range m.Prices { + _ = k + _ = v + l = 0 + if len(v) > 0 { + l = 1 + len(v) + sovOracle(uint64(len(v))) + } + mapEntrySize := 1 + sovOracle(uint64(k)) + l + n += mapEntrySize + 1 + sovOracle(uint64(mapEntrySize)) + } } - l = m.ExchangeRate.Size() - n += 1 + l + sovOracle(uint64(l)) return n } @@ -756,25 +742,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { } switch fieldNum { case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field VotePeriod", wireType) - } - m.VotePeriod = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.VotePeriod |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field VoteThreshold", wireType) } @@ -808,9 +775,9 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 3: + case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RewardBand", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field MaxDeviation", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -838,32 +805,13 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.RewardBand.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + if err := m.MaxDeviation.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RewardDistributionWindow", wireType) - } - m.RewardDistributionWindow = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RewardDistributionWindow |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 5: + case 3: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Whitelist", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field RequiredSymbols", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -890,12 +838,31 @@ func (m *Params) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Whitelist = append(m.Whitelist, Denom{}) - if err := m.Whitelist[len(m.Whitelist)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.RequiredSymbols = append(m.RequiredSymbols, Symbol{}) + if err := m.RequiredSymbols[len(m.RequiredSymbols)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex - case 6: + case 4: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field LastSymbolId", wireType) + } + m.LastSymbolId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.LastSymbolId |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field SlashFraction", wireType) } @@ -929,7 +896,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 7: + case 6: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field SlashWindow", wireType) } @@ -948,7 +915,7 @@ func (m *Params) Unmarshal(dAtA []byte) error { break } } - case 8: + case 7: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field MinValidPerWindow", wireType) } @@ -1085,7 +1052,7 @@ func (m *Denom) Unmarshal(dAtA []byte) error { } return nil } -func (m *AggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { +func (m *Symbol) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1108,15 +1075,15 @@ func (m *AggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AggregateExchangeRatePrevote: wiretype end group for non-group") + return fmt.Errorf("proto: Symbol: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AggregateExchangeRatePrevote: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: Symbol: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1144,45 +1111,13 @@ func (m *AggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Hash = string(dAtA[iNdEx:postIndex]) + m.Symbol = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowOracle - } - 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 ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Voter = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SubmitBlock", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) } - m.SubmitBlock = 0 + m.Id = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowOracle @@ -1192,7 +1127,7 @@ func (m *AggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.SubmitBlock |= uint64(b&0x7F) << shift + m.Id |= uint32(b&0x7F) << shift if b < 0x80 { break } @@ -1218,7 +1153,7 @@ func (m *AggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { } return nil } -func (m *AggregateExchangeRateVote) Unmarshal(dAtA []byte) error { +func (m *ExchangeRateTuple) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1241,17 +1176,17 @@ func (m *AggregateExchangeRateVote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: AggregateExchangeRateVote: wiretype end group for non-group") + return fmt.Errorf("proto: ExchangeRateTuple: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: AggregateExchangeRateVote: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: ExchangeRateTuple: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRateTuples", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowOracle @@ -1261,29 +1196,27 @@ func (m *AggregateExchangeRateVote) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthOracle } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthOracle } if postIndex > l { return io.ErrUnexpectedEOF } - m.ExchangeRateTuples = append(m.ExchangeRateTuples, ExchangeRateTuple{}) - if err := m.ExchangeRateTuples[len(m.ExchangeRateTuples)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Symbol = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Voter", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRate", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1311,7 +1244,9 @@ func (m *AggregateExchangeRateVote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Voter = string(dAtA[iNdEx:postIndex]) + if err := m.ExchangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1334,7 +1269,7 @@ func (m *AggregateExchangeRateVote) Unmarshal(dAtA []byte) error { } return nil } -func (m *ExchangeRateTuple) Unmarshal(dAtA []byte) error { +func (m *VoteExtension) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1357,17 +1292,17 @@ func (m *ExchangeRateTuple) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: ExchangeRateTuple: wiretype end group for non-group") + return fmt.Errorf("proto: VoteExtension: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: ExchangeRateTuple: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: VoteExtension: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) } - var stringLen uint64 + m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowOracle @@ -1377,29 +1312,16 @@ func (m *ExchangeRateTuple) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + m.Height |= int64(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { - return ErrInvalidLengthOracle - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthOracle - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Prices", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowOracle @@ -1409,25 +1331,105 @@ func (m *ExchangeRateTuple) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthOracle } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthOracle } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.ExchangeRate.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err + if m.Prices == nil { + m.Prices = make(map[uint32][]byte) + } + var mapkey uint32 + mapvalue := []byte{} + for iNdEx < postIndex { + entryPreIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + if fieldNum == 1 { + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapkey |= uint32(b&0x7F) << shift + if b < 0x80 { + break + } + } + } else if fieldNum == 2 { + var mapbyteLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowOracle + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + mapbyteLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intMapbyteLen := int(mapbyteLen) + if intMapbyteLen < 0 { + return ErrInvalidLengthOracle + } + postbytesIndex := iNdEx + intMapbyteLen + if postbytesIndex < 0 { + return ErrInvalidLengthOracle + } + if postbytesIndex > l { + return io.ErrUnexpectedEOF + } + mapvalue = make([]byte, mapbyteLen) + copy(mapvalue, dAtA[iNdEx:postbytesIndex]) + iNdEx = postbytesIndex + } else { + iNdEx = entryPreIndex + skippy, err := skipOracle(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthOracle + } + if (iNdEx + skippy) > postIndex { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } } + m.Prices[mapkey] = mapvalue iNdEx = postIndex default: iNdEx = preIndex diff --git a/x/oracle/types/oracle_test.go b/x/oracle/types/oracle_test.go new file mode 100644 index 00000000..574241ec --- /dev/null +++ b/x/oracle/types/oracle_test.go @@ -0,0 +1,44 @@ +package types_test + +import ( + "encoding/json" + "testing" + + "github.com/Team-Kujira/core/x/oracle/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" +) + +func TestVoteExtensionCompress(t *testing.T) { + exchangeRatesStr := `[{"denom":"AKT","amount":"3.417096740560307550"},{"denom":"AMPKUJI","amount":"1.084075333349937652"},{"denom":"ARB","amount":"0.653568215050396212"},{"denom":"ATOM","amount":"5.790707106715531081"},{"denom":"AVAX","amount":"25.827959663657512637"},{"denom":"AXL","amount":"0.624201741733833997"},{"denom":"BAND","amount":"1.022584469058041796"},{"denom":"BNB","amount":"502.772950580502485398"},{"denom":"BTC","amount":"55783.302479024097639328"},{"denom":"CACAO","amount":"0.698803134648437975"},{"denom":"CRO","amount":"0.084405107433108864"},{"denom":"DOT","amount":"5.962045778513116897"},{"denom":"DYDX","amount":"1.269955883131320003"},{"denom":"DYM","amount":"1.335809901613850997"},{"denom":"ETH","amount":"2969.662966676288686015"},{"denom":"FET","amount":"1.139696855883139672"},{"denom":"FTM","amount":"0.428773762332588376"},{"denom":"FUZN","amount":"0.021324054049826744"},{"denom":"GLMR","amount":"0.192092486818396021"},{"denom":"HNT","amount":"3.087596429332989514"},{"denom":"INJ","amount":"19.452156583675507257"},{"denom":"JUNO","amount":"0.118688775145495572"},{"denom":"KAVA","amount":"0.374775225296475929"},{"denom":"KUJI","amount":"1.029789039653282812"},{"denom":"LINK","amount":"12.816128641011379658"},{"denom":"LUNA","amount":"0.364505753316675255"},{"denom":"LUNC","amount":"0.000068828162549657"},{"denom":"MATIC","amount":"0.491261448912043029"},{"denom":"MNTA","amount":"0.181188804107436880"},{"denom":"NSTK","amount":"0.038445180649993541"},{"denom":"NTRN","amount":"0.381527699701723989"},{"denom":"OSMO","amount":"0.471280360168268721"},{"denom":"PAXG","amount":"2335.525224879736093489"},{"denom":"QCKUJI","amount":"1.050603277885129415"},{"denom":"QCMNTA","amount":"0.194268552558550051"},{"denom":"RIO","amount":"1.059295830184573571"},{"denom":"RLB","amount":"0.078449612556799117"},{"denom":"SCRT","amount":"0.251650850228059606"},{"denom":"SHD","amount":"1.507075200077156108"},{"denom":"SOL","amount":"136.530800297842253396"},{"denom":"SOMM","amount":"0.031828093754901402"},{"denom":"STARS","amount":"0.010049914978090783"},{"denom":"STATOM","amount":"7.879848164467987846"},{"denom":"STKATOM","amount":"7.500369151595600714"},{"denom":"STOSMO","amount":"0.583630068136456088"},{"denom":"TIA","amount":"5.998201205777194726"},{"denom":"UNI","amount":"7.921914875907396220"},{"denom":"USDC","amount":"1.000020995501583086"},{"denom":"USDT","amount":"0.999735734500345704"},{"denom":"USK","amount":"0.988651090995423641"},{"denom":"WBTC","amount":"55811.491789331262939715"},{"denom":"WETH","amount":"2969.114861570696077782"},{"denom":"WHALE","amount":"0.005195497968885498"},{"denom":"WINK","amount":"0.029363420994439294"},{"denom":"WSTETH","amount":"3478.222037911750161926"}]` + exchangeRates := sdk.DecCoins{} + err := json.Unmarshal([]byte(exchangeRatesStr), &exchangeRates) + require.NoError(t, err) + + prices := make(map[uint32][]byte) + for index, rate := range exchangeRates { + id := uint32(index) + count := 0 + newAmount := rate.Amount + for !newAmount.IsZero() { + newAmount = newAmount.QuoInt64(10) + count++ + } + cuttingDecimals := count - 8 + for i := 0; i < cuttingDecimals; i++ { + rate.Amount = rate.Amount.QuoInt64(10) + } + prices[id] = append(rate.Amount.BigInt().Bytes(), byte(cuttingDecimals)) + } + voteExt := types.VoteExtension{ + Height: 1, + Prices: prices, + } + bz, err := voteExt.Marshal() + require.NoError(t, err) + _ = bz + + compressed, err := voteExt.Compress() + require.NoError(t, err) + _ = compressed +} diff --git a/x/oracle/types/params.go b/x/oracle/types/params.go index 7a53c686..6c628788 100644 --- a/x/oracle/types/params.go +++ b/x/oracle/types/params.go @@ -3,38 +3,38 @@ package types import ( "fmt" + "cosmossdk.io/math" "gopkg.in/yaml.v2" - sdk "github.com/cosmos/cosmos-sdk/types" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" ) // Parameter keys var ( - KeyVotePeriod = []byte("VotePeriod") - KeyVoteThreshold = []byte("VoteThreshold") - KeyRewardBand = []byte("RewardBand") - KeyRewardDistributionWindow = []byte("RewardDistributionWindow") - KeyWhitelist = []byte("Whitelist") - KeySlashFraction = []byte("SlashFraction") - KeySlashWindow = []byte("SlashWindow") - KeyMinValidPerWindow = []byte("MinValidPerWindow") + KeyVoteThreshold = []byte("VoteThreshold") + KeyMaxDeviation = []byte("MaxDeviation") + KeyRequiredSymbols = []byte("RequiredSymbols") + KeySlashFraction = []byte("SlashFraction") + KeySlashWindow = []byte("SlashWindow") + KeyMinValidPerWindow = []byte("MinValidPerWindow") + // Deprecated + KeyRewardBand = []byte("RewardBand") + KeyWhitelist = []byte("Whitelist") ) // Default parameter values const ( - DefaultVotePeriod = uint64(14) // 30 seconds DefaultSlashWindow = uint64(274000) // window for a week DefaultRewardDistributionWindow = uint64(14250000) // window for a year ) // Default parameter values var ( - DefaultVoteThreshold = sdk.NewDecWithPrec(50, 2) // 50% - DefaultRewardBand = sdk.NewDecWithPrec(2, 2) // 2% (-1, 1) - DefaultWhitelist = DenomList{} - DefaultSlashFraction = sdk.NewDecWithPrec(1, 4) // 0.01% - DefaultMinValidPerWindow = sdk.NewDecWithPrec(5, 2) // 5% + DefaultVoteThreshold = math.LegacyNewDecWithPrec(50, 2) // 50% + DefaultMaxDeviation = math.LegacyNewDecWithPrec(2, 1) // 2% (-1, 1) + DefaultRequiredSymbols = []Symbol{} + DefaultSlashFraction = math.LegacyNewDecWithPrec(1, 4) // 0.01% + DefaultMinValidPerWindow = math.LegacyNewDecWithPrec(5, 2) // 5% ) var _ paramstypes.ParamSet = &Params{} @@ -42,14 +42,12 @@ var _ paramstypes.ParamSet = &Params{} // DefaultParams creates default oracle module parameters func DefaultParams() Params { return Params{ - VotePeriod: DefaultVotePeriod, - VoteThreshold: DefaultVoteThreshold, - RewardBand: DefaultRewardBand, - RewardDistributionWindow: DefaultRewardDistributionWindow, - Whitelist: DefaultWhitelist, - SlashFraction: DefaultSlashFraction, - SlashWindow: DefaultSlashWindow, - MinValidPerWindow: DefaultMinValidPerWindow, + VoteThreshold: DefaultVoteThreshold, + MaxDeviation: DefaultMaxDeviation, + RequiredSymbols: DefaultRequiredSymbols, + SlashFraction: DefaultSlashFraction, + SlashWindow: DefaultSlashWindow, + MinValidPerWindow: DefaultMinValidPerWindow, } } @@ -61,15 +59,17 @@ func ParamKeyTable() paramstypes.KeyTable { // ParamSetPairs implements the ParamSet interface and returns all the key/value pairs // pairs of oracle module's parameters. func (p *Params) ParamSetPairs() paramstypes.ParamSetPairs { + rewardBand := math.LegacyDec{} + whitelist := DenomList{} return paramstypes.ParamSetPairs{ - paramstypes.NewParamSetPair(KeyVotePeriod, &p.VotePeriod, validateVotePeriod), paramstypes.NewParamSetPair(KeyVoteThreshold, &p.VoteThreshold, validateVoteThreshold), - paramstypes.NewParamSetPair(KeyRewardBand, &p.RewardBand, validateRewardBand), - paramstypes.NewParamSetPair(KeyRewardDistributionWindow, &p.RewardDistributionWindow, validateRewardDistributionWindow), - paramstypes.NewParamSetPair(KeyWhitelist, &p.Whitelist, validateWhitelist), + paramstypes.NewParamSetPair(KeyMaxDeviation, &p.MaxDeviation, validateMaxDeviation), + paramstypes.NewParamSetPair(KeyRequiredSymbols, &p.RequiredSymbols, validateRequiredSymbols), paramstypes.NewParamSetPair(KeySlashFraction, &p.SlashFraction, validateSlashFraction), paramstypes.NewParamSetPair(KeySlashWindow, &p.SlashWindow, validateSlashWindow), paramstypes.NewParamSetPair(KeyMinValidPerWindow, &p.MinValidPerWindow, validateMinValidPerWindow), + paramstypes.NewParamSetPair(KeyRewardBand, &rewardBand, validateRewardBand), + paramstypes.NewParamSetPair(KeyWhitelist, &whitelist, validateWhitelist), } } @@ -81,73 +81,52 @@ func (p Params) String() string { // Validate performs basic validation on oracle parameters. func (p Params) Validate() error { - if p.VotePeriod == 0 { - return fmt.Errorf("oracle parameter VotePeriod must be > 0, is %d", p.VotePeriod) - } - if p.VoteThreshold.LTE(sdk.NewDecWithPrec(33, 2)) { + if p.VoteThreshold.LTE(math.LegacyNewDecWithPrec(33, 2)) { return fmt.Errorf("oracle parameter VoteThreshold must be greater than 33 percent") } - if p.RewardBand.GT(sdk.OneDec()) || p.RewardBand.IsNegative() { - return fmt.Errorf("oracle parameter RewardBand must be between [0, 1]") - } - - if p.RewardDistributionWindow < p.VotePeriod { - return fmt.Errorf("oracle parameter RewardDistributionWindow must be greater than or equal with VotePeriod") + if p.MaxDeviation.GT(math.LegacyOneDec()) || p.MaxDeviation.IsNegative() { + return fmt.Errorf("oracle parameter MaxDeviation must be between [0, 1]") } - if p.SlashFraction.GT(sdk.OneDec()) || p.SlashFraction.IsNegative() { + if p.SlashFraction.GT(math.LegacyOneDec()) || p.SlashFraction.IsNegative() { return fmt.Errorf("oracle parameter SlashFraction must be between [0, 1]") } - if p.SlashWindow < p.VotePeriod { - return fmt.Errorf("oracle parameter SlashWindow must be greater than or equal with VotePeriod") + if p.SlashWindow == 0 { + return fmt.Errorf("oracle parameter SlashWindow must be positive") } - if p.MinValidPerWindow.GT(sdk.OneDec()) || p.MinValidPerWindow.IsNegative() { + if p.MinValidPerWindow.GT(math.LegacyOneDec()) || p.MinValidPerWindow.IsNegative() { return fmt.Errorf("oracle parameter MinValidPerWindow must be between [0, 1]") } - for _, denom := range p.Whitelist { - if len(denom.Name) == 0 { - return fmt.Errorf("oracle parameter Whitelist Denom must have name") - } - } - return nil -} - -func validateVotePeriod(i interface{}) error { - v, ok := i.(uint64) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v == 0 { - return fmt.Errorf("vote period must be positive: %d", v) + if err := validateRequiredSymbols(p.RequiredSymbols); err != nil { + return err } return nil } func validateVoteThreshold(i interface{}) error { - v, ok := i.(sdk.Dec) + v, ok := i.(math.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } - if v.LT(sdk.NewDecWithPrec(33, 2)) { + if v.LT(math.LegacyNewDecWithPrec(33, 2)) { return fmt.Errorf("vote threshold must be bigger than 33%%: %s", v) } - if v.GT(sdk.OneDec()) { + if v.GT(math.LegacyOneDec()) { return fmt.Errorf("vote threshold too large: %s", v) } return nil } -func validateRewardBand(i interface{}) error { - v, ok := i.(sdk.Dec) +func validateMaxDeviation(i interface{}) error { + v, ok := i.(math.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } @@ -156,43 +135,43 @@ func validateRewardBand(i interface{}) error { return fmt.Errorf("reward band must be positive: %s", v) } - if v.GT(sdk.OneDec()) { + if v.GT(math.LegacyOneDec()) { return fmt.Errorf("reward band is too large: %s", v) } return nil } -func validateRewardDistributionWindow(i interface{}) error { - v, ok := i.(uint64) +func validateRequiredSymbols(i interface{}) error { + v, ok := i.([]Symbol) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } - if v == 0 { - return fmt.Errorf("reward distribution window must be positive: %d", v) - } - - return nil -} - -func validateWhitelist(i interface{}) error { - v, ok := i.(DenomList) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) + for _, d := range v { + if len(d.Symbol) == 0 { + return fmt.Errorf("oracle parameter RequiredSymbols Denom must not be ''") + } } - for _, d := range v { - if len(d.Name) == 0 { - return fmt.Errorf("oracle parameter Whitelist Denom must have name") + registeredSymbols := make(map[string]bool) + registeredIDs := make(map[uint32]bool) + for _, denom := range v { + if registeredSymbols[denom.Symbol] { + return fmt.Errorf("oracle parameter denom should be unique") } + if registeredIDs[denom.Id] { + return fmt.Errorf("oracle parameter denom id should be unique") + } + registeredSymbols[denom.Symbol] = true + registeredIDs[denom.Id] = true } return nil } func validateSlashFraction(i interface{}) error { - v, ok := i.(sdk.Dec) + v, ok := i.(math.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } @@ -201,7 +180,7 @@ func validateSlashFraction(i interface{}) error { return fmt.Errorf("slash fraction must be positive: %s", v) } - if v.GT(sdk.OneDec()) { + if v.GT(math.LegacyOneDec()) { return fmt.Errorf("slash fraction is too large: %s", v) } @@ -222,7 +201,7 @@ func validateSlashWindow(i interface{}) error { } func validateMinValidPerWindow(i interface{}) error { - v, ok := i.(sdk.Dec) + v, ok := i.(math.LegacyDec) if !ok { return fmt.Errorf("invalid parameter type: %T", i) } @@ -231,9 +210,41 @@ func validateMinValidPerWindow(i interface{}) error { return fmt.Errorf("min valid per window must be positive: %s", v) } - if v.GT(sdk.OneDec()) { + if v.GT(math.LegacyOneDec()) { return fmt.Errorf("min valid per window is too large: %s", v) } return nil } + +func validateRewardBand(i interface{}) error { + v, ok := i.(math.LegacyDec) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + if v.IsNegative() { + return fmt.Errorf("reward band must be positive: %s", v) + } + + if v.GT(math.LegacyOneDec()) { + return fmt.Errorf("reward band is too large: %s", v) + } + + return nil +} + +func validateWhitelist(i interface{}) error { + v, ok := i.(DenomList) + if !ok { + return fmt.Errorf("invalid parameter type: %T", i) + } + + for _, d := range v { + if len(d.Name) == 0 { + return fmt.Errorf("oracle parameter Whitelist Denom must have name") + } + } + + return nil +} diff --git a/x/oracle/types/params_test.go b/x/oracle/types/params_test.go index e5a5401c..71b00aa4 100644 --- a/x/oracle/types/params_test.go +++ b/x/oracle/types/params_test.go @@ -4,11 +4,10 @@ import ( "bytes" "testing" + "cosmossdk.io/math" "github.com/stretchr/testify/require" "github.com/Team-Kujira/core/x/oracle/types" - - sdk "github.com/cosmos/cosmos-sdk/types" ) func TestParamsEqual(t *testing.T) { @@ -16,32 +15,27 @@ func TestParamsEqual(t *testing.T) { err := p1.Validate() require.NoError(t, err) - // minus vote period - p1.VotePeriod = 0 - err = p1.Validate() - require.Error(t, err) - // small vote threshold p2 := types.DefaultParams() - p2.VoteThreshold = sdk.ZeroDec() + p2.VoteThreshold = math.LegacyZeroDec() err = p2.Validate() require.Error(t, err) // negative reward band p3 := types.DefaultParams() - p3.RewardBand = sdk.NewDecWithPrec(-1, 2) + p3.MaxDeviation = math.LegacyNewDecWithPrec(-1, 1) err = p3.Validate() require.Error(t, err) // negative slash fraction p4 := types.DefaultParams() - p4.SlashFraction = sdk.NewDec(-1) + p4.SlashFraction = math.LegacyNewDec(-1) err = p4.Validate() require.Error(t, err) // negative min valid per window p5 := types.DefaultParams() - p5.MinValidPerWindow = sdk.NewDec(-1) + p5.MinValidPerWindow = math.LegacyNewDec(-1) err = p5.Validate() require.Error(t, err) @@ -51,12 +45,6 @@ func TestParamsEqual(t *testing.T) { err = p6.Validate() require.Error(t, err) - // small distribution window - p7 := types.DefaultParams() - p7.RewardDistributionWindow = 0 - err = p7.Validate() - require.Error(t, err) - p11 := types.DefaultParams() require.NotNil(t, p11.ParamSetPairs()) require.NotNil(t, p11.String()) @@ -67,30 +55,22 @@ func TestValidate(t *testing.T) { pairs := p1.ParamSetPairs() for _, pair := range pairs { switch { - case bytes.Compare(types.KeyVotePeriod, pair.Key) == 0 || - bytes.Compare(types.KeyRewardDistributionWindow, pair.Key) == 0 || - bytes.Compare(types.KeySlashWindow, pair.Key) == 0: - require.NoError(t, pair.ValidatorFn(uint64(1))) - require.Error(t, pair.ValidatorFn("invalid")) - require.Error(t, pair.ValidatorFn(uint64(0))) - case bytes.Compare(types.KeyVoteThreshold, pair.Key) == 0: - require.NoError(t, pair.ValidatorFn(sdk.NewDecWithPrec(33, 2))) + case bytes.Equal(types.KeyVoteThreshold, pair.Key): + require.NoError(t, pair.ValidatorFn(math.LegacyNewDecWithPrec(33, 2))) require.Error(t, pair.ValidatorFn("invalid")) - require.Error(t, pair.ValidatorFn(sdk.NewDecWithPrec(32, 2))) - require.Error(t, pair.ValidatorFn(sdk.NewDecWithPrec(101, 2))) - case bytes.Compare(types.KeyRewardBand, pair.Key) == 0 || - bytes.Compare(types.KeySlashFraction, pair.Key) == 0 || - bytes.Compare(types.KeyMinValidPerWindow, pair.Key) == 0: - require.NoError(t, pair.ValidatorFn(sdk.NewDecWithPrec(7, 2))) + require.Error(t, pair.ValidatorFn(math.LegacyNewDecWithPrec(32, 2))) + require.Error(t, pair.ValidatorFn(math.LegacyNewDecWithPrec(101, 2))) + case bytes.Equal(types.KeyMaxDeviation, pair.Key) || + bytes.Equal(types.KeySlashFraction, pair.Key) || + bytes.Equal(types.KeyMinValidPerWindow, pair.Key): + require.NoError(t, pair.ValidatorFn(math.LegacyNewDecWithPrec(7, 2))) require.Error(t, pair.ValidatorFn("invalid")) - require.Error(t, pair.ValidatorFn(sdk.NewDecWithPrec(-1, 2))) - require.Error(t, pair.ValidatorFn(sdk.NewDecWithPrec(101, 2))) - case bytes.Compare(types.KeyWhitelist, pair.Key) == 0: - require.NoError(t, pair.ValidatorFn(types.DenomList{})) + require.Error(t, pair.ValidatorFn(math.LegacyNewDecWithPrec(-1, 2))) + require.Error(t, pair.ValidatorFn(math.LegacyNewDecWithPrec(101, 2))) + case bytes.Equal(types.KeyRequiredSymbols, pair.Key): + require.NoError(t, pair.ValidatorFn([]types.Symbol{})) require.Error(t, pair.ValidatorFn("invalid")) - require.Error(t, pair.ValidatorFn(types.DenomList{ - {Name: ""}, - })) + require.NoError(t, pair.ValidatorFn([]types.Symbol{})) } } } diff --git a/x/oracle/types/query.pb.go b/x/oracle/types/query.pb.go index b079f608..e2d1e4c1 100644 --- a/x/oracle/types/query.pb.go +++ b/x/oracle/types/query.pb.go @@ -5,6 +5,7 @@ package types import ( context "context" + cosmossdk_io_math "cosmossdk.io/math" fmt "fmt" github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" types "github.com/cosmos/cosmos-sdk/types" @@ -33,8 +34,8 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // QueryExchangeRateRequest is the request type for the Query/ExchangeRate RPC method. type QueryExchangeRateRequest struct { - // denom defines the denomination to query for. - Denom string `protobuf:"bytes,1,opt,name=denom,proto3" json:"denom,omitempty"` + // symbol defines the symbol to query for. + Symbol string `protobuf:"bytes,1,opt,name=symbol,proto3" json:"symbol,omitempty"` } func (m *QueryExchangeRateRequest) Reset() { *m = QueryExchangeRateRequest{} } @@ -74,7 +75,7 @@ var xxx_messageInfo_QueryExchangeRateRequest proto.InternalMessageInfo // Query/ExchangeRate RPC method. type QueryExchangeRateResponse struct { // exchange_rate defines the exchange rate of whitelisted assets - ExchangeRate github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"exchange_rate"` + ExchangeRate cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=exchange_rate,json=exchangeRate,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"exchange_rate"` } func (m *QueryExchangeRateResponse) Reset() { *m = QueryExchangeRateResponse{} } @@ -150,7 +151,7 @@ var xxx_messageInfo_QueryExchangeRatesRequest proto.InternalMessageInfo // QueryExchangeRatesResponse is response type for the // Query/ExchangeRates RPC method. type QueryExchangeRatesResponse struct { - // exchange_rates defines a list of the exchange rate for all whitelisted denoms. + // exchange_rates defines a list of the exchange rate for all whitelisted symbols. ExchangeRates github_com_cosmos_cosmos_sdk_types.DecCoins `protobuf:"bytes,1,rep,name=exchange_rates,json=exchangeRates,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.DecCoins" json:"exchange_rates"` } @@ -234,7 +235,7 @@ var xxx_messageInfo_QueryActivesRequest proto.InternalMessageInfo // QueryActivesResponse is response type for the // Query/Actives RPC method. type QueryActivesResponse struct { - // actives defines a list of the denomination which oracle prices aggreed upon. + // actives defines a list of the symbols which oracle prices aggreed upon. Actives []string `protobuf:"bytes,1,rep,name=actives,proto3" json:"actives,omitempty"` } @@ -318,7 +319,7 @@ var xxx_messageInfo_QueryVoteTargetsRequest proto.InternalMessageInfo // QueryVoteTargetsResponse is response type for the // Query/VoteTargets RPC method. type QueryVoteTargetsResponse struct { - // vote_targets defines a list of the denomination in which everyone + // vote_targets defines a list of the symbols in which everyone // should vote in the current vote period. VoteTargets []string `protobuf:"bytes,1,rep,name=vote_targets,json=voteTargets,proto3" json:"vote_targets,omitempty"` } @@ -363,92 +364,6 @@ func (m *QueryVoteTargetsResponse) GetVoteTargets() []string { return nil } -// QueryFeederDelegationRequest is the request type for the Query/FeederDelegation RPC method. -type QueryFeederDelegationRequest struct { - // validator defines the validator address to query for. - ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` -} - -func (m *QueryFeederDelegationRequest) Reset() { *m = QueryFeederDelegationRequest{} } -func (m *QueryFeederDelegationRequest) String() string { return proto.CompactTextString(m) } -func (*QueryFeederDelegationRequest) ProtoMessage() {} -func (*QueryFeederDelegationRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{8} -} -func (m *QueryFeederDelegationRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFeederDelegationRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFeederDelegationRequest.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 *QueryFeederDelegationRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeederDelegationRequest.Merge(m, src) -} -func (m *QueryFeederDelegationRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryFeederDelegationRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeederDelegationRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFeederDelegationRequest proto.InternalMessageInfo - -// QueryFeederDelegationResponse is response type for the -// Query/FeederDelegation RPC method. -type QueryFeederDelegationResponse struct { - // feeder_addr defines the feeder delegation of a validator - FeederAddr string `protobuf:"bytes,1,opt,name=feeder_addr,json=feederAddr,proto3" json:"feeder_addr,omitempty"` -} - -func (m *QueryFeederDelegationResponse) Reset() { *m = QueryFeederDelegationResponse{} } -func (m *QueryFeederDelegationResponse) String() string { return proto.CompactTextString(m) } -func (*QueryFeederDelegationResponse) ProtoMessage() {} -func (*QueryFeederDelegationResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{9} -} -func (m *QueryFeederDelegationResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryFeederDelegationResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryFeederDelegationResponse.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 *QueryFeederDelegationResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryFeederDelegationResponse.Merge(m, src) -} -func (m *QueryFeederDelegationResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryFeederDelegationResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryFeederDelegationResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryFeederDelegationResponse proto.InternalMessageInfo - -func (m *QueryFeederDelegationResponse) GetFeederAddr() string { - if m != nil { - return m.FeederAddr - } - return "" -} - // QueryMissCounterRequest is the request type for the Query/MissCounter RPC method. type QueryMissCounterRequest struct { // validator defines the validator address to query for. @@ -459,7 +374,7 @@ func (m *QueryMissCounterRequest) Reset() { *m = QueryMissCounterRequest func (m *QueryMissCounterRequest) String() string { return proto.CompactTextString(m) } func (*QueryMissCounterRequest) ProtoMessage() {} func (*QueryMissCounterRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{10} + return fileDescriptor_b180a0d90a2c8cf7, []int{8} } func (m *QueryMissCounterRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -499,7 +414,7 @@ func (m *QueryMissCounterResponse) Reset() { *m = QueryMissCounterRespon func (m *QueryMissCounterResponse) String() string { return proto.CompactTextString(m) } func (*QueryMissCounterResponse) ProtoMessage() {} func (*QueryMissCounterResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{11} + return fileDescriptor_b180a0d90a2c8cf7, []int{9} } func (m *QueryMissCounterResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -535,346 +450,6 @@ func (m *QueryMissCounterResponse) GetMissCounter() uint64 { return 0 } -// QueryAggregatePrevoteRequest is the request type for the Query/AggregatePrevote RPC method. -type QueryAggregatePrevoteRequest struct { - // validator defines the validator address to query for. - ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` -} - -func (m *QueryAggregatePrevoteRequest) Reset() { *m = QueryAggregatePrevoteRequest{} } -func (m *QueryAggregatePrevoteRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAggregatePrevoteRequest) ProtoMessage() {} -func (*QueryAggregatePrevoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{12} -} -func (m *QueryAggregatePrevoteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregatePrevoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregatePrevoteRequest.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 *QueryAggregatePrevoteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregatePrevoteRequest.Merge(m, src) -} -func (m *QueryAggregatePrevoteRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregatePrevoteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregatePrevoteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregatePrevoteRequest proto.InternalMessageInfo - -// QueryAggregatePrevoteResponse is response type for the -// Query/AggregatePrevote RPC method. -type QueryAggregatePrevoteResponse struct { - // aggregate_prevote defines oracle aggregate prevote submitted by a validator in the current vote period - AggregatePrevote AggregateExchangeRatePrevote `protobuf:"bytes,1,opt,name=aggregate_prevote,json=aggregatePrevote,proto3" json:"aggregate_prevote"` -} - -func (m *QueryAggregatePrevoteResponse) Reset() { *m = QueryAggregatePrevoteResponse{} } -func (m *QueryAggregatePrevoteResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAggregatePrevoteResponse) ProtoMessage() {} -func (*QueryAggregatePrevoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{13} -} -func (m *QueryAggregatePrevoteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregatePrevoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregatePrevoteResponse.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 *QueryAggregatePrevoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregatePrevoteResponse.Merge(m, src) -} -func (m *QueryAggregatePrevoteResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregatePrevoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregatePrevoteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregatePrevoteResponse proto.InternalMessageInfo - -func (m *QueryAggregatePrevoteResponse) GetAggregatePrevote() AggregateExchangeRatePrevote { - if m != nil { - return m.AggregatePrevote - } - return AggregateExchangeRatePrevote{} -} - -// QueryAggregatePrevotesRequest is the request type for the Query/AggregatePrevotes RPC method. -type QueryAggregatePrevotesRequest struct { -} - -func (m *QueryAggregatePrevotesRequest) Reset() { *m = QueryAggregatePrevotesRequest{} } -func (m *QueryAggregatePrevotesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAggregatePrevotesRequest) ProtoMessage() {} -func (*QueryAggregatePrevotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{14} -} -func (m *QueryAggregatePrevotesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregatePrevotesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregatePrevotesRequest.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 *QueryAggregatePrevotesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregatePrevotesRequest.Merge(m, src) -} -func (m *QueryAggregatePrevotesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregatePrevotesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregatePrevotesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregatePrevotesRequest proto.InternalMessageInfo - -// QueryAggregatePrevotesResponse is response type for the -// Query/AggregatePrevotes RPC method. -type QueryAggregatePrevotesResponse struct { - // aggregate_prevotes defines all oracle aggregate prevotes submitted in the current vote period - AggregatePrevotes []AggregateExchangeRatePrevote `protobuf:"bytes,1,rep,name=aggregate_prevotes,json=aggregatePrevotes,proto3" json:"aggregate_prevotes"` -} - -func (m *QueryAggregatePrevotesResponse) Reset() { *m = QueryAggregatePrevotesResponse{} } -func (m *QueryAggregatePrevotesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAggregatePrevotesResponse) ProtoMessage() {} -func (*QueryAggregatePrevotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{15} -} -func (m *QueryAggregatePrevotesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregatePrevotesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregatePrevotesResponse.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 *QueryAggregatePrevotesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregatePrevotesResponse.Merge(m, src) -} -func (m *QueryAggregatePrevotesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregatePrevotesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregatePrevotesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregatePrevotesResponse proto.InternalMessageInfo - -func (m *QueryAggregatePrevotesResponse) GetAggregatePrevotes() []AggregateExchangeRatePrevote { - if m != nil { - return m.AggregatePrevotes - } - return nil -} - -// QueryAggregateVoteRequest is the request type for the Query/AggregateVote RPC method. -type QueryAggregateVoteRequest struct { - // validator defines the validator address to query for. - ValidatorAddr string `protobuf:"bytes,1,opt,name=validator_addr,json=validatorAddr,proto3" json:"validator_addr,omitempty"` -} - -func (m *QueryAggregateVoteRequest) Reset() { *m = QueryAggregateVoteRequest{} } -func (m *QueryAggregateVoteRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAggregateVoteRequest) ProtoMessage() {} -func (*QueryAggregateVoteRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{16} -} -func (m *QueryAggregateVoteRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregateVoteRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregateVoteRequest.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 *QueryAggregateVoteRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregateVoteRequest.Merge(m, src) -} -func (m *QueryAggregateVoteRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregateVoteRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregateVoteRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregateVoteRequest proto.InternalMessageInfo - -// QueryAggregateVoteResponse is response type for the -// Query/AggregateVote RPC method. -type QueryAggregateVoteResponse struct { - // aggregate_vote defines oracle aggregate vote submitted by a validator in the current vote period - AggregateVote AggregateExchangeRateVote `protobuf:"bytes,1,opt,name=aggregate_vote,json=aggregateVote,proto3" json:"aggregate_vote"` -} - -func (m *QueryAggregateVoteResponse) Reset() { *m = QueryAggregateVoteResponse{} } -func (m *QueryAggregateVoteResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAggregateVoteResponse) ProtoMessage() {} -func (*QueryAggregateVoteResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{17} -} -func (m *QueryAggregateVoteResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregateVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregateVoteResponse.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 *QueryAggregateVoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregateVoteResponse.Merge(m, src) -} -func (m *QueryAggregateVoteResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregateVoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregateVoteResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregateVoteResponse proto.InternalMessageInfo - -func (m *QueryAggregateVoteResponse) GetAggregateVote() AggregateExchangeRateVote { - if m != nil { - return m.AggregateVote - } - return AggregateExchangeRateVote{} -} - -// QueryAggregateVotesRequest is the request type for the Query/AggregateVotes RPC method. -type QueryAggregateVotesRequest struct { -} - -func (m *QueryAggregateVotesRequest) Reset() { *m = QueryAggregateVotesRequest{} } -func (m *QueryAggregateVotesRequest) String() string { return proto.CompactTextString(m) } -func (*QueryAggregateVotesRequest) ProtoMessage() {} -func (*QueryAggregateVotesRequest) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{18} -} -func (m *QueryAggregateVotesRequest) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregateVotesRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregateVotesRequest.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 *QueryAggregateVotesRequest) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregateVotesRequest.Merge(m, src) -} -func (m *QueryAggregateVotesRequest) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregateVotesRequest) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregateVotesRequest.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregateVotesRequest proto.InternalMessageInfo - -// QueryAggregateVotesResponse is response type for the -// Query/AggregateVotes RPC method. -type QueryAggregateVotesResponse struct { - // aggregate_votes defines all oracle aggregate votes submitted in the current vote period - AggregateVotes []AggregateExchangeRateVote `protobuf:"bytes,1,rep,name=aggregate_votes,json=aggregateVotes,proto3" json:"aggregate_votes"` -} - -func (m *QueryAggregateVotesResponse) Reset() { *m = QueryAggregateVotesResponse{} } -func (m *QueryAggregateVotesResponse) String() string { return proto.CompactTextString(m) } -func (*QueryAggregateVotesResponse) ProtoMessage() {} -func (*QueryAggregateVotesResponse) Descriptor() ([]byte, []int) { - return fileDescriptor_b180a0d90a2c8cf7, []int{19} -} -func (m *QueryAggregateVotesResponse) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *QueryAggregateVotesResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_QueryAggregateVotesResponse.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 *QueryAggregateVotesResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_QueryAggregateVotesResponse.Merge(m, src) -} -func (m *QueryAggregateVotesResponse) XXX_Size() int { - return m.Size() -} -func (m *QueryAggregateVotesResponse) XXX_DiscardUnknown() { - xxx_messageInfo_QueryAggregateVotesResponse.DiscardUnknown(m) -} - -var xxx_messageInfo_QueryAggregateVotesResponse proto.InternalMessageInfo - -func (m *QueryAggregateVotesResponse) GetAggregateVotes() []AggregateExchangeRateVote { - if m != nil { - return m.AggregateVotes - } - return nil -} - // QueryParamsRequest is the request type for the Query/Params RPC method. type QueryParamsRequest struct { } @@ -883,7 +458,7 @@ 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_b180a0d90a2c8cf7, []int{20} + return fileDescriptor_b180a0d90a2c8cf7, []int{10} } func (m *QueryParamsRequest) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -922,7 +497,7 @@ 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_b180a0d90a2c8cf7, []int{21} + return fileDescriptor_b180a0d90a2c8cf7, []int{11} } func (m *QueryParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -967,18 +542,8 @@ func init() { proto.RegisterType((*QueryActivesResponse)(nil), "kujira.oracle.QueryActivesResponse") proto.RegisterType((*QueryVoteTargetsRequest)(nil), "kujira.oracle.QueryVoteTargetsRequest") proto.RegisterType((*QueryVoteTargetsResponse)(nil), "kujira.oracle.QueryVoteTargetsResponse") - proto.RegisterType((*QueryFeederDelegationRequest)(nil), "kujira.oracle.QueryFeederDelegationRequest") - proto.RegisterType((*QueryFeederDelegationResponse)(nil), "kujira.oracle.QueryFeederDelegationResponse") proto.RegisterType((*QueryMissCounterRequest)(nil), "kujira.oracle.QueryMissCounterRequest") proto.RegisterType((*QueryMissCounterResponse)(nil), "kujira.oracle.QueryMissCounterResponse") - proto.RegisterType((*QueryAggregatePrevoteRequest)(nil), "kujira.oracle.QueryAggregatePrevoteRequest") - proto.RegisterType((*QueryAggregatePrevoteResponse)(nil), "kujira.oracle.QueryAggregatePrevoteResponse") - proto.RegisterType((*QueryAggregatePrevotesRequest)(nil), "kujira.oracle.QueryAggregatePrevotesRequest") - proto.RegisterType((*QueryAggregatePrevotesResponse)(nil), "kujira.oracle.QueryAggregatePrevotesResponse") - proto.RegisterType((*QueryAggregateVoteRequest)(nil), "kujira.oracle.QueryAggregateVoteRequest") - proto.RegisterType((*QueryAggregateVoteResponse)(nil), "kujira.oracle.QueryAggregateVoteResponse") - proto.RegisterType((*QueryAggregateVotesRequest)(nil), "kujira.oracle.QueryAggregateVotesRequest") - proto.RegisterType((*QueryAggregateVotesResponse)(nil), "kujira.oracle.QueryAggregateVotesResponse") proto.RegisterType((*QueryParamsRequest)(nil), "kujira.oracle.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "kujira.oracle.QueryParamsResponse") } @@ -986,73 +551,53 @@ func init() { func init() { proto.RegisterFile("kujira/oracle/query.proto", fileDescriptor_b180a0d90a2c8cf7) } var fileDescriptor_b180a0d90a2c8cf7 = []byte{ - // 1045 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x97, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0xbd, 0xd0, 0xa6, 0xf4, 0x39, 0x36, 0xc9, 0x90, 0x16, 0x67, 0x9b, 0xda, 0xed, 0xd0, - 0x24, 0xc6, 0x49, 0x76, 0x5b, 0x07, 0x84, 0x14, 0xa9, 0x12, 0x49, 0x03, 0x87, 0x02, 0xa2, 0x98, - 0x12, 0x24, 0x0e, 0x98, 0x89, 0x3d, 0x6c, 0x97, 0xc6, 0x1e, 0x77, 0x67, 0x6d, 0xa5, 0xaa, 0x2a, - 0xa4, 0x9e, 0x90, 0x38, 0x50, 0xa9, 0x12, 0x57, 0xc2, 0x15, 0xf1, 0x35, 0x90, 0x7a, 0xac, 0xc4, - 0x05, 0x71, 0x28, 0x28, 0xe1, 0xc0, 0xc7, 0x40, 0x3b, 0xf3, 0x76, 0xbd, 0x6b, 0xaf, 0x63, 0x93, - 0x9e, 0x36, 0x9e, 0xf7, 0xf6, 0xff, 0x7e, 0xf3, 0xcf, 0xcc, 0x7b, 0x36, 0xcc, 0xdf, 0xed, 0x7e, - 0xe3, 0x7a, 0xcc, 0x16, 0x1e, 0x6b, 0xec, 0x71, 0xfb, 0x5e, 0x97, 0x7b, 0xf7, 0xad, 0x8e, 0x27, - 0x7c, 0x41, 0x72, 0x3a, 0x64, 0xe9, 0x90, 0x39, 0xe7, 0x08, 0x47, 0xa8, 0x88, 0x1d, 0xfc, 0xa5, - 0x93, 0xcc, 0x05, 0x47, 0x08, 0x67, 0x8f, 0xdb, 0xac, 0xe3, 0xda, 0xac, 0xdd, 0x16, 0x3e, 0xf3, - 0x5d, 0xd1, 0x96, 0x18, 0x35, 0x93, 0xea, 0xfa, 0x81, 0xb1, 0x62, 0x43, 0xc8, 0x96, 0x90, 0xf6, - 0x2e, 0x93, 0xdc, 0xee, 0x5d, 0xdb, 0xe5, 0x3e, 0xbb, 0x66, 0x37, 0x84, 0xdb, 0xd6, 0x71, 0xba, - 0x01, 0x85, 0x4f, 0x02, 0x9a, 0xf7, 0xf6, 0x1b, 0x77, 0x58, 0xdb, 0xe1, 0x35, 0xe6, 0xf3, 0x1a, - 0xbf, 0xd7, 0xe5, 0xd2, 0x27, 0x73, 0x70, 0xba, 0xc9, 0xdb, 0xa2, 0x55, 0x30, 0x2e, 0x19, 0xe5, - 0xb3, 0x35, 0xfd, 0x61, 0xe3, 0x95, 0xef, 0x0e, 0x4a, 0x99, 0x7f, 0x0f, 0x4a, 0x19, 0xda, 0x81, - 0xf9, 0x94, 0x77, 0x65, 0x47, 0xb4, 0x25, 0x27, 0x9f, 0x42, 0x8e, 0xe3, 0x7a, 0xdd, 0x63, 0x3e, - 0xd7, 0x22, 0x5b, 0xd6, 0xd3, 0xe7, 0xa5, 0xcc, 0x9f, 0xcf, 0x4b, 0x4b, 0x8e, 0xeb, 0xdf, 0xe9, - 0xee, 0x5a, 0x0d, 0xd1, 0xb2, 0x11, 0x51, 0x3f, 0xd6, 0x64, 0xf3, 0xae, 0xed, 0xdf, 0xef, 0x70, - 0x69, 0x6d, 0xf3, 0x46, 0x6d, 0x9a, 0xc7, 0xc4, 0xe9, 0x85, 0x94, 0x8a, 0x12, 0x71, 0xe9, 0x8f, - 0x06, 0x98, 0x69, 0x51, 0x04, 0xda, 0x87, 0x7c, 0x02, 0x48, 0x16, 0x8c, 0x4b, 0x2f, 0x97, 0xb3, - 0xd5, 0x05, 0x4b, 0x17, 0xb6, 0x02, 0x8b, 0x2c, 0xb4, 0x28, 0xa8, 0x7d, 0x43, 0xb8, 0xed, 0xad, - 0xf5, 0x80, 0xf7, 0x97, 0xbf, 0x4a, 0x2b, 0x93, 0xf1, 0x06, 0xef, 0xc8, 0x5a, 0x2e, 0x0e, 0x2d, - 0xe9, 0x39, 0x78, 0x4d, 0x71, 0x6d, 0x36, 0x7c, 0xb7, 0xd7, 0xe7, 0xbd, 0x0a, 0x73, 0xc9, 0x65, - 0x04, 0x2d, 0xc0, 0x19, 0xa6, 0x97, 0x14, 0xe1, 0xd9, 0x5a, 0xf8, 0x91, 0xce, 0xc3, 0xeb, 0xea, - 0x8d, 0x1d, 0xe1, 0xf3, 0xdb, 0xcc, 0x73, 0xb8, 0x1f, 0x89, 0x5d, 0xc7, 0xff, 0x63, 0x22, 0x84, - 0x82, 0x97, 0x61, 0xba, 0x27, 0x7c, 0x5e, 0xf7, 0xf5, 0x3a, 0xaa, 0x66, 0x7b, 0xfd, 0x54, 0xfa, - 0x31, 0x2c, 0xa8, 0xd7, 0xdf, 0xe7, 0xbc, 0xc9, 0xbd, 0x6d, 0xbe, 0xc7, 0x1d, 0x75, 0xc4, 0xc2, - 0xa3, 0xb0, 0x08, 0xf9, 0x1e, 0xdb, 0x73, 0x9b, 0xcc, 0x17, 0x5e, 0x9d, 0x35, 0x9b, 0x1e, 0x9e, - 0x89, 0x5c, 0xb4, 0xba, 0xd9, 0x6c, 0x7a, 0xb1, 0xb3, 0xf1, 0x2e, 0x5c, 0x1c, 0x21, 0x88, 0x50, - 0x25, 0xc8, 0x7e, 0xad, 0x62, 0x71, 0x39, 0xd0, 0x4b, 0x81, 0x16, 0xbd, 0x89, 0x9b, 0xfd, 0xc8, - 0x95, 0xf2, 0x86, 0xe8, 0xb6, 0x7d, 0xee, 0x9d, 0x98, 0x26, 0x74, 0x27, 0xa1, 0xd5, 0x77, 0xa7, - 0xe5, 0x4a, 0x59, 0x6f, 0xe8, 0x75, 0x25, 0x75, 0xaa, 0x96, 0x6d, 0xf5, 0x53, 0x23, 0x77, 0x36, - 0x1d, 0xc7, 0x0b, 0xf6, 0xc1, 0x6f, 0x79, 0x3c, 0x70, 0xef, 0xc4, 0x3c, 0xdf, 0xa2, 0x3b, 0xc3, - 0x82, 0x08, 0xf5, 0x25, 0xcc, 0xb2, 0x30, 0x56, 0xef, 0xe8, 0xa0, 0x12, 0xcd, 0x56, 0x57, 0xac, - 0x44, 0xc7, 0xb0, 0x22, 0x8d, 0xf8, 0xb1, 0x47, 0xbd, 0xad, 0x53, 0xc1, 0xf1, 0xad, 0xcd, 0xb0, - 0x81, 0x3a, 0xb4, 0x34, 0x02, 0x20, 0x3a, 0x4f, 0x8f, 0x0c, 0x28, 0x8e, 0xca, 0x40, 0xc6, 0xaf, - 0x80, 0x0c, 0x31, 0x86, 0x97, 0xea, 0x04, 0x90, 0xb3, 0x83, 0x90, 0x92, 0x7e, 0x88, 0xd7, 0x3d, - 0x7a, 0x7b, 0xe7, 0x45, 0x4c, 0x97, 0xd8, 0x1e, 0x06, 0xd4, 0x70, 0x37, 0x9f, 0x41, 0xbe, 0xbf, - 0x9b, 0x98, 0xdd, 0xe5, 0x49, 0x76, 0xb2, 0xd3, 0xdf, 0x46, 0x8e, 0xc5, 0xe5, 0xe9, 0x42, 0x5a, - 0xd1, 0xc8, 0xe5, 0x1e, 0x5c, 0x48, 0x8d, 0x22, 0xd3, 0xe7, 0xf0, 0x6a, 0x92, 0x29, 0xb4, 0xf7, - 0xff, 0x42, 0xe5, 0x13, 0x50, 0x92, 0xce, 0x01, 0x51, 0x75, 0x6f, 0x31, 0x8f, 0xb5, 0x22, 0x9a, - 0x9b, 0xd8, 0xa7, 0xc2, 0x55, 0xa4, 0x58, 0x87, 0xa9, 0x8e, 0x5a, 0x41, 0x47, 0xce, 0x0d, 0x14, - 0xd7, 0xe9, 0x58, 0x09, 0x53, 0xab, 0xbf, 0x65, 0xe1, 0xb4, 0x12, 0x23, 0x3f, 0x18, 0x30, 0x1d, - 0xc7, 0x22, 0xcb, 0x03, 0xef, 0x8f, 0x9a, 0x3f, 0x66, 0x79, 0x7c, 0xa2, 0x46, 0xa4, 0xab, 0x8f, - 0x7e, 0xff, 0xe7, 0xc9, 0x4b, 0x4b, 0xe4, 0x4a, 0x38, 0x03, 0xd5, 0xa8, 0x92, 0xf6, 0x03, 0xf5, - 0x7c, 0x68, 0x27, 0x1a, 0x3f, 0xf9, 0xde, 0x80, 0x5c, 0x62, 0x46, 0x90, 0xb1, 0x95, 0x42, 0x8f, - 0xcc, 0x37, 0x27, 0xc8, 0x44, 0xa8, 0x45, 0x05, 0x55, 0x22, 0x17, 0x07, 0xa0, 0x92, 0x53, 0x88, - 0x78, 0x70, 0x06, 0x27, 0x00, 0xa1, 0x69, 0xe2, 0xc9, 0xa9, 0x61, 0xbe, 0x71, 0x6c, 0x0e, 0x96, - 0x2e, 0xaa, 0xd2, 0x05, 0x72, 0x7e, 0xa0, 0x34, 0x0e, 0x12, 0xf2, 0xb3, 0x01, 0x33, 0x83, 0x9d, - 0x99, 0xac, 0xa4, 0x29, 0x8f, 0x18, 0x08, 0xe6, 0xea, 0x64, 0xc9, 0xc8, 0x53, 0x55, 0x3c, 0xab, - 0xa4, 0x12, 0xf2, 0x44, 0x77, 0x54, 0xda, 0x0f, 0x92, 0xb7, 0xf8, 0xa1, 0xad, 0x67, 0x00, 0x79, - 0x6c, 0x40, 0x36, 0xd6, 0xaf, 0xc9, 0x52, 0x5a, 0xc5, 0xe1, 0xe1, 0x60, 0x2e, 0x8f, 0xcd, 0x43, - 0xa8, 0xab, 0x0a, 0xaa, 0x42, 0xca, 0x93, 0x40, 0x05, 0xe3, 0x80, 0xfc, 0x6a, 0xc0, 0xcc, 0x60, - 0x3f, 0x4c, 0xb7, 0x6d, 0xc4, 0xa4, 0x48, 0xb7, 0x6d, 0xd4, 0x14, 0xa0, 0xd7, 0x15, 0xe1, 0x3b, - 0xe4, 0xed, 0x49, 0x08, 0x87, 0x7a, 0x31, 0xf9, 0xc9, 0x80, 0xd9, 0xa1, 0xf6, 0x4d, 0x26, 0x42, - 0x88, 0x8e, 0xdb, 0xda, 0x84, 0xd9, 0x48, 0xbc, 0xa6, 0x88, 0x97, 0xc9, 0x62, 0x0a, 0xf1, 0xf0, - 0xb0, 0x20, 0x07, 0x06, 0xe4, 0x12, 0xbd, 0x2f, 0xfd, 0x26, 0xa6, 0xf5, 0xff, 0xf4, 0x9b, 0x98, - 0xda, 0xdb, 0xe9, 0x86, 0xa2, 0x7a, 0x8b, 0x54, 0x63, 0x54, 0x4d, 0x77, 0xac, 0x8f, 0xca, 0xc4, - 0x27, 0x06, 0xe4, 0x93, 0xed, 0x99, 0x8c, 0xaf, 0x1c, 0xd9, 0x57, 0x99, 0x24, 0x15, 0x29, 0x2b, - 0x8a, 0xf2, 0x0a, 0xa1, 0xc7, 0x7a, 0xa7, 0x8d, 0x73, 0x60, 0x4a, 0xb7, 0x5d, 0x72, 0x39, 0xad, - 0x42, 0xa2, 0xaf, 0x9b, 0xf4, 0xb8, 0x14, 0x2c, 0x7e, 0x5e, 0x15, 0x9f, 0x21, 0xf9, 0xb0, 0xb8, - 0xee, 0xe3, 0x5b, 0xdb, 0x4f, 0x0f, 0x8b, 0xc6, 0xb3, 0xc3, 0xa2, 0xf1, 0xf7, 0x61, 0xd1, 0x78, - 0x7c, 0x54, 0xcc, 0x3c, 0x3b, 0x2a, 0x66, 0xfe, 0x38, 0x2a, 0x66, 0xbe, 0xa8, 0xc4, 0xbe, 0x11, - 0xdf, 0xe6, 0xac, 0xb5, 0xf6, 0x81, 0xfe, 0x15, 0xd2, 0x10, 0x1e, 0xb7, 0xf7, 0x43, 0x19, 0xf5, - 0xcd, 0x78, 0x77, 0x4a, 0xfd, 0xd8, 0x58, 0xff, 0x2f, 0x00, 0x00, 0xff, 0xff, 0xbb, 0x7b, 0x5e, - 0xf5, 0x08, 0x0d, 0x00, 0x00, + // 729 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x94, 0xcf, 0x4f, 0x13, 0x41, + 0x14, 0xc7, 0xbb, 0x0a, 0x45, 0xa6, 0x94, 0x98, 0x91, 0x1f, 0xed, 0x42, 0xb6, 0xb0, 0x44, 0xa8, + 0x18, 0x76, 0xf8, 0x71, 0x33, 0x7a, 0xa0, 0x60, 0x62, 0x50, 0x13, 0xdd, 0x10, 0x0f, 0x5e, 0x9a, + 0xe9, 0xee, 0x64, 0x59, 0xe9, 0xee, 0x94, 0x9d, 0x69, 0x43, 0x43, 0xb8, 0x78, 0xf2, 0xe0, 0x01, + 0x63, 0xe2, 0xc5, 0x0b, 0x67, 0xff, 0x12, 0x8e, 0x24, 0x5e, 0x8c, 0x07, 0x34, 0xe0, 0xc1, 0x3f, + 0xc3, 0x74, 0x66, 0xb6, 0xed, 0xe2, 0x0a, 0x9e, 0x76, 0xf7, 0xbd, 0x37, 0xdf, 0xf7, 0xd9, 0x99, + 0xef, 0x1b, 0x50, 0xdc, 0x6d, 0xbe, 0xf1, 0x23, 0x8c, 0x68, 0x84, 0x9d, 0x3a, 0x41, 0x7b, 0x4d, + 0x12, 0xb5, 0xad, 0x46, 0x44, 0x39, 0x85, 0x79, 0x99, 0xb2, 0x64, 0x4a, 0x1f, 0xf3, 0xa8, 0x47, + 0x45, 0x06, 0x75, 0xde, 0x64, 0x91, 0x3e, 0xed, 0x51, 0xea, 0xd5, 0x09, 0xc2, 0x0d, 0x1f, 0xe1, + 0x30, 0xa4, 0x1c, 0x73, 0x9f, 0x86, 0x4c, 0x65, 0xf5, 0xa4, 0xba, 0x7c, 0xa8, 0x9c, 0xe1, 0x50, + 0x16, 0x50, 0x86, 0x6a, 0x98, 0x11, 0xd4, 0x5a, 0xa9, 0x11, 0x8e, 0x57, 0x90, 0x43, 0xfd, 0x50, + 0xe6, 0xcd, 0x87, 0xa0, 0xf0, 0xb2, 0x43, 0xf3, 0x78, 0xdf, 0xd9, 0xc1, 0xa1, 0x47, 0x6c, 0xcc, + 0x89, 0x4d, 0xf6, 0x9a, 0x84, 0x71, 0x38, 0x01, 0xb2, 0xac, 0x1d, 0xd4, 0x68, 0xbd, 0xa0, 0xcd, + 0x68, 0xe5, 0x61, 0x5b, 0x7d, 0x3d, 0xb8, 0xf5, 0xee, 0xb8, 0x94, 0xf9, 0x7d, 0x5c, 0xca, 0x98, + 0x04, 0x14, 0x53, 0x56, 0xb3, 0x06, 0x0d, 0x19, 0x81, 0x4f, 0x40, 0x9e, 0xa8, 0x78, 0x35, 0xc2, + 0x9c, 0x48, 0x95, 0xca, 0xdc, 0xc9, 0x59, 0x29, 0xf3, 0xfd, 0xac, 0x34, 0x25, 0xc9, 0x98, 0xbb, + 0x6b, 0xf9, 0x14, 0x05, 0x98, 0xef, 0x58, 0xcf, 0x88, 0x87, 0x9d, 0xf6, 0x26, 0x71, 0xec, 0x11, + 0xd2, 0xa7, 0x68, 0x4e, 0xa5, 0xb4, 0x61, 0x8a, 0xd2, 0xfc, 0xa4, 0x01, 0x3d, 0x2d, 0xab, 0x28, + 0xf6, 0xc1, 0x68, 0x82, 0x82, 0x15, 0xb4, 0x99, 0x9b, 0xe5, 0xdc, 0xea, 0xb4, 0x25, 0xfb, 0x5b, + 0x9d, 0x9d, 0xb1, 0xd4, 0xce, 0x58, 0x9b, 0xc4, 0xd9, 0xa0, 0x7e, 0x58, 0x59, 0xeb, 0x40, 0x7e, + 0xf9, 0x51, 0xba, 0xef, 0xf9, 0x7c, 0xa7, 0x59, 0xb3, 0x1c, 0x1a, 0x20, 0xb5, 0x93, 0xf2, 0xb1, + 0xc4, 0xdc, 0x5d, 0xc4, 0xdb, 0x0d, 0xc2, 0xe2, 0x35, 0xcc, 0xce, 0xf7, 0x43, 0x33, 0x73, 0x1c, + 0xdc, 0x11, 0x5c, 0xeb, 0x0e, 0xf7, 0x5b, 0x3d, 0xde, 0x65, 0x30, 0x96, 0x0c, 0x2b, 0xd0, 0x02, + 0x18, 0xc2, 0x32, 0x24, 0x08, 0x87, 0xed, 0xf8, 0xd3, 0x2c, 0x82, 0x49, 0xb1, 0xe2, 0x15, 0xe5, + 0x64, 0x1b, 0x47, 0x1e, 0xe1, 0x5d, 0xb1, 0x47, 0xea, 0xf8, 0x12, 0x29, 0x25, 0x38, 0x0b, 0x46, + 0x5a, 0x94, 0x93, 0x2a, 0x97, 0x71, 0xa5, 0x9a, 0x6b, 0xf5, 0x4a, 0xcd, 0x2d, 0xa5, 0xfc, 0xdc, + 0x67, 0x6c, 0x83, 0x36, 0x43, 0x4e, 0xa2, 0xf8, 0xf0, 0xef, 0x82, 0xd1, 0x16, 0xae, 0xfb, 0x2e, + 0xe6, 0x34, 0xaa, 0x62, 0xd7, 0x8d, 0x94, 0x09, 0xf2, 0xdd, 0xe8, 0xba, 0xeb, 0x46, 0x7d, 0x5e, + 0x88, 0x51, 0x12, 0x5a, 0x3d, 0x94, 0xc0, 0x67, 0xac, 0xea, 0xc8, 0xb8, 0x90, 0x1a, 0xb0, 0x73, + 0x41, 0xaf, 0xd4, 0x1c, 0x03, 0x50, 0x2c, 0x7f, 0x81, 0x23, 0x1c, 0x74, 0xff, 0x6f, 0x4b, 0xed, + 0x61, 0x1c, 0x55, 0x7a, 0x6b, 0x20, 0xdb, 0x10, 0x11, 0xa1, 0x94, 0x5b, 0x1d, 0xb7, 0x12, 0x53, + 0x64, 0xc9, 0xf2, 0xca, 0x40, 0xe7, 0x14, 0x6d, 0x55, 0xba, 0xfa, 0x79, 0x10, 0x0c, 0x0a, 0x31, + 0xf8, 0x41, 0x03, 0x23, 0xfd, 0x6e, 0x81, 0x0b, 0x97, 0xd6, 0xff, 0x6b, 0x24, 0xf4, 0xf2, 0xf5, + 0x85, 0x12, 0xd1, 0xb4, 0xde, 0x7e, 0xfd, 0xf5, 0xf1, 0x46, 0x19, 0xce, 0xc7, 0x63, 0x29, 0x87, + 0x87, 0xa1, 0x03, 0xf9, 0x72, 0x88, 0x12, 0xb6, 0x84, 0xef, 0x35, 0x90, 0x4f, 0x38, 0x18, 0x5e, + 0xdb, 0x2b, 0xde, 0x25, 0xfd, 0xde, 0x7f, 0x54, 0x2a, 0xac, 0x79, 0x81, 0x35, 0x03, 0x8d, 0xcb, + 0x58, 0xc9, 0x21, 0x81, 0x0c, 0x0c, 0x29, 0x83, 0x42, 0x33, 0x4d, 0x3d, 0x69, 0x6a, 0x7d, 0xee, + 0xca, 0x1a, 0xd5, 0xbb, 0x24, 0x7a, 0x17, 0xe1, 0xe4, 0xe5, 0xde, 0xca, 0xe8, 0xf0, 0x48, 0x03, + 0xb9, 0x3e, 0xfb, 0xc0, 0xf9, 0x34, 0xd5, 0xbf, 0xbd, 0xaa, 0x2f, 0x5c, 0x5b, 0xa7, 0x08, 0x96, + 0x05, 0xc1, 0x22, 0x2c, 0xc7, 0x04, 0x5d, 0x33, 0x33, 0x74, 0x90, 0xb4, 0xfb, 0x21, 0xea, 0xb8, + 0x13, 0x7a, 0x20, 0x2b, 0xcd, 0x04, 0x67, 0xd3, 0x9a, 0x24, 0xdc, 0xaa, 0x9b, 0x57, 0x95, 0x28, + 0x84, 0x09, 0x81, 0x70, 0x1b, 0x8e, 0xc6, 0x08, 0xd2, 0x9d, 0x95, 0xcd, 0x93, 0x73, 0x43, 0x3b, + 0x3d, 0x37, 0xb4, 0x9f, 0xe7, 0x86, 0x76, 0x74, 0x61, 0x64, 0x4e, 0x2f, 0x8c, 0xcc, 0xb7, 0x0b, + 0x23, 0xf3, 0x7a, 0xb1, 0xef, 0x0e, 0xda, 0x26, 0x38, 0x58, 0x7a, 0x2a, 0xaf, 0x7b, 0x87, 0x46, + 0x04, 0xed, 0xc7, 0x32, 0xe2, 0x2e, 0xaa, 0x65, 0xc5, 0xad, 0xbe, 0xf6, 0x27, 0x00, 0x00, 0xff, + 0xff, 0x87, 0x99, 0xd4, 0x45, 0x71, 0x06, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1067,24 +612,14 @@ 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 { - // ExchangeRate returns exchange rate of a denom + // ExchangeRate returns exchange rate of a symbol ExchangeRate(ctx context.Context, in *QueryExchangeRateRequest, opts ...grpc.CallOption) (*QueryExchangeRateResponse, error) - // ExchangeRates returns exchange rates of all denoms + // ExchangeRates returns exchange rates of all symbols ExchangeRates(ctx context.Context, in *QueryExchangeRatesRequest, opts ...grpc.CallOption) (*QueryExchangeRatesResponse, error) - // Actives returns all active denoms + // Actives returns all active symbols Actives(ctx context.Context, in *QueryActivesRequest, opts ...grpc.CallOption) (*QueryActivesResponse, error) - // FeederDelegation returns feeder delegation of a validator - FeederDelegation(ctx context.Context, in *QueryFeederDelegationRequest, opts ...grpc.CallOption) (*QueryFeederDelegationResponse, error) // MissCounter returns oracle miss counter of a validator MissCounter(ctx context.Context, in *QueryMissCounterRequest, opts ...grpc.CallOption) (*QueryMissCounterResponse, error) - // AggregatePrevote returns an aggregate prevote of a validator - AggregatePrevote(ctx context.Context, in *QueryAggregatePrevoteRequest, opts ...grpc.CallOption) (*QueryAggregatePrevoteResponse, error) - // AggregatePrevotes returns aggregate prevotes of all validators - AggregatePrevotes(ctx context.Context, in *QueryAggregatePrevotesRequest, opts ...grpc.CallOption) (*QueryAggregatePrevotesResponse, error) - // AggregateVote returns an aggregate vote of a validator - AggregateVote(ctx context.Context, in *QueryAggregateVoteRequest, opts ...grpc.CallOption) (*QueryAggregateVoteResponse, error) - // AggregateVotes returns aggregate votes of all validators - AggregateVotes(ctx context.Context, in *QueryAggregateVotesRequest, opts ...grpc.CallOption) (*QueryAggregateVotesResponse, error) // Params queries all parameters. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) } @@ -1124,15 +659,6 @@ func (c *queryClient) Actives(ctx context.Context, in *QueryActivesRequest, opts return out, nil } -func (c *queryClient) FeederDelegation(ctx context.Context, in *QueryFeederDelegationRequest, opts ...grpc.CallOption) (*QueryFeederDelegationResponse, error) { - out := new(QueryFeederDelegationResponse) - err := c.cc.Invoke(ctx, "/kujira.oracle.Query/FeederDelegation", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - func (c *queryClient) MissCounter(ctx context.Context, in *QueryMissCounterRequest, opts ...grpc.CallOption) (*QueryMissCounterResponse, error) { out := new(QueryMissCounterResponse) err := c.cc.Invoke(ctx, "/kujira.oracle.Query/MissCounter", in, out, opts...) @@ -1142,45 +668,9 @@ func (c *queryClient) MissCounter(ctx context.Context, in *QueryMissCounterReque return out, nil } -func (c *queryClient) AggregatePrevote(ctx context.Context, in *QueryAggregatePrevoteRequest, opts ...grpc.CallOption) (*QueryAggregatePrevoteResponse, error) { - out := new(QueryAggregatePrevoteResponse) - err := c.cc.Invoke(ctx, "/kujira.oracle.Query/AggregatePrevote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AggregatePrevotes(ctx context.Context, in *QueryAggregatePrevotesRequest, opts ...grpc.CallOption) (*QueryAggregatePrevotesResponse, error) { - out := new(QueryAggregatePrevotesResponse) - err := c.cc.Invoke(ctx, "/kujira.oracle.Query/AggregatePrevotes", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AggregateVote(ctx context.Context, in *QueryAggregateVoteRequest, opts ...grpc.CallOption) (*QueryAggregateVoteResponse, error) { - out := new(QueryAggregateVoteResponse) - err := c.cc.Invoke(ctx, "/kujira.oracle.Query/AggregateVote", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) AggregateVotes(ctx context.Context, in *QueryAggregateVotesRequest, opts ...grpc.CallOption) (*QueryAggregateVotesResponse, error) { - out := new(QueryAggregateVotesResponse) - err := c.cc.Invoke(ctx, "/kujira.oracle.Query/AggregateVotes", in, out, opts...) - if err != nil { - return nil, err - } - return out, nil -} - -func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { - out := new(QueryParamsResponse) - err := c.cc.Invoke(ctx, "/kujira.oracle.Query/Params", in, out, opts...) +func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) { + out := new(QueryParamsResponse) + err := c.cc.Invoke(ctx, "/kujira.oracle.Query/Params", in, out, opts...) if err != nil { return nil, err } @@ -1189,24 +679,14 @@ func (c *queryClient) Params(ctx context.Context, in *QueryParamsRequest, opts . // QueryServer is the server API for Query service. type QueryServer interface { - // ExchangeRate returns exchange rate of a denom + // ExchangeRate returns exchange rate of a symbol ExchangeRate(context.Context, *QueryExchangeRateRequest) (*QueryExchangeRateResponse, error) - // ExchangeRates returns exchange rates of all denoms + // ExchangeRates returns exchange rates of all symbols ExchangeRates(context.Context, *QueryExchangeRatesRequest) (*QueryExchangeRatesResponse, error) - // Actives returns all active denoms + // Actives returns all active symbols Actives(context.Context, *QueryActivesRequest) (*QueryActivesResponse, error) - // FeederDelegation returns feeder delegation of a validator - FeederDelegation(context.Context, *QueryFeederDelegationRequest) (*QueryFeederDelegationResponse, error) // MissCounter returns oracle miss counter of a validator MissCounter(context.Context, *QueryMissCounterRequest) (*QueryMissCounterResponse, error) - // AggregatePrevote returns an aggregate prevote of a validator - AggregatePrevote(context.Context, *QueryAggregatePrevoteRequest) (*QueryAggregatePrevoteResponse, error) - // AggregatePrevotes returns aggregate prevotes of all validators - AggregatePrevotes(context.Context, *QueryAggregatePrevotesRequest) (*QueryAggregatePrevotesResponse, error) - // AggregateVote returns an aggregate vote of a validator - AggregateVote(context.Context, *QueryAggregateVoteRequest) (*QueryAggregateVoteResponse, error) - // AggregateVotes returns aggregate votes of all validators - AggregateVotes(context.Context, *QueryAggregateVotesRequest) (*QueryAggregateVotesResponse, error) // Params queries all parameters. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) } @@ -1224,24 +704,9 @@ func (*UnimplementedQueryServer) ExchangeRates(ctx context.Context, req *QueryEx func (*UnimplementedQueryServer) Actives(ctx context.Context, req *QueryActivesRequest) (*QueryActivesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Actives not implemented") } -func (*UnimplementedQueryServer) FeederDelegation(ctx context.Context, req *QueryFeederDelegationRequest) (*QueryFeederDelegationResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method FeederDelegation not implemented") -} func (*UnimplementedQueryServer) MissCounter(ctx context.Context, req *QueryMissCounterRequest) (*QueryMissCounterResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method MissCounter not implemented") } -func (*UnimplementedQueryServer) AggregatePrevote(ctx context.Context, req *QueryAggregatePrevoteRequest) (*QueryAggregatePrevoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AggregatePrevote not implemented") -} -func (*UnimplementedQueryServer) AggregatePrevotes(ctx context.Context, req *QueryAggregatePrevotesRequest) (*QueryAggregatePrevotesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AggregatePrevotes not implemented") -} -func (*UnimplementedQueryServer) AggregateVote(ctx context.Context, req *QueryAggregateVoteRequest) (*QueryAggregateVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AggregateVote not implemented") -} -func (*UnimplementedQueryServer) AggregateVotes(ctx context.Context, req *QueryAggregateVotesRequest) (*QueryAggregateVotesResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AggregateVotes not implemented") -} func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsRequest) (*QueryParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Params not implemented") } @@ -1304,24 +769,6 @@ func _Query_Actives_Handler(srv interface{}, ctx context.Context, dec func(inter return interceptor(ctx, in, info, handler) } -func _Query_FeederDelegation_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryFeederDelegationRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).FeederDelegation(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/kujira.oracle.Query/FeederDelegation", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).FeederDelegation(ctx, req.(*QueryFeederDelegationRequest)) - } - return interceptor(ctx, in, info, handler) -} - func _Query_MissCounter_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { in := new(QueryMissCounterRequest) if err := dec(in); err != nil { @@ -1340,78 +787,6 @@ func _Query_MissCounter_Handler(srv interface{}, ctx context.Context, dec func(i return interceptor(ctx, in, info, handler) } -func _Query_AggregatePrevote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAggregatePrevoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AggregatePrevote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/kujira.oracle.Query/AggregatePrevote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AggregatePrevote(ctx, req.(*QueryAggregatePrevoteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AggregatePrevotes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAggregatePrevotesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AggregatePrevotes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/kujira.oracle.Query/AggregatePrevotes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AggregatePrevotes(ctx, req.(*QueryAggregatePrevotesRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AggregateVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAggregateVoteRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AggregateVote(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/kujira.oracle.Query/AggregateVote", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AggregateVote(ctx, req.(*QueryAggregateVoteRequest)) - } - return interceptor(ctx, in, info, handler) -} - -func _Query_AggregateVotes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(QueryAggregateVotesRequest) - if err := dec(in); err != nil { - return nil, err - } - if interceptor == nil { - return srv.(QueryServer).AggregateVotes(ctx, in) - } - info := &grpc.UnaryServerInfo{ - Server: srv, - FullMethod: "/kujira.oracle.Query/AggregateVotes", - } - handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(QueryServer).AggregateVotes(ctx, req.(*QueryAggregateVotesRequest)) - } - return interceptor(ctx, in, info, handler) -} - 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 { @@ -1446,30 +821,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Actives", Handler: _Query_Actives_Handler, }, - { - MethodName: "FeederDelegation", - Handler: _Query_FeederDelegation_Handler, - }, { MethodName: "MissCounter", Handler: _Query_MissCounter_Handler, }, - { - MethodName: "AggregatePrevote", - Handler: _Query_AggregatePrevote_Handler, - }, - { - MethodName: "AggregatePrevotes", - Handler: _Query_AggregatePrevotes_Handler, - }, - { - MethodName: "AggregateVote", - Handler: _Query_AggregateVote_Handler, - }, - { - MethodName: "AggregateVotes", - Handler: _Query_AggregateVotes_Handler, - }, { MethodName: "Params", Handler: _Query_Params_Handler, @@ -1499,10 +854,10 @@ func (m *QueryExchangeRateRequest) MarshalToSizedBuffer(dAtA []byte) (int, error _ = i var l int _ = l - if len(m.Denom) > 0 { - i -= len(m.Denom) - copy(dAtA[i:], m.Denom) - i = encodeVarintQuery(dAtA, i, uint64(len(m.Denom))) + if len(m.Symbol) > 0 { + i -= len(m.Symbol) + copy(dAtA[i:], m.Symbol) + i = encodeVarintQuery(dAtA, i, uint64(len(m.Symbol))) i-- dAtA[i] = 0xa } @@ -1712,66 +1067,6 @@ func (m *QueryVoteTargetsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryFeederDelegationRequest) 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 *QueryFeederDelegationRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryFeederDelegationRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryFeederDelegationResponse) 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 *QueryFeederDelegationResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryFeederDelegationResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.FeederAddr) > 0 { - i -= len(m.FeederAddr) - copy(dAtA[i:], m.FeederAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.FeederAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - func (m *QueryMissCounterRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1830,7 +1125,7 @@ func (m *QueryMissCounterResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } -func (m *QueryAggregatePrevoteRequest) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsRequest) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1840,27 +1135,20 @@ func (m *QueryAggregatePrevoteRequest) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAggregatePrevoteRequest) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAggregatePrevoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0xa - } return len(dAtA) - i, nil } -func (m *QueryAggregatePrevoteResponse) Marshal() (dAtA []byte, err error) { +func (m *QueryParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1870,18 +1158,18 @@ func (m *QueryAggregatePrevoteResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *QueryAggregatePrevoteResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *QueryAggregatePrevoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *QueryParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l { - size, err := m.AggregatePrevote.MarshalToSizedBuffer(dAtA[:i]) + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) if err != nil { return 0, err } @@ -1893,307 +1181,68 @@ func (m *QueryAggregatePrevoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, return len(dAtA) - i, nil } -func (m *QueryAggregatePrevotesRequest) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { + offset -= sovQuery(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ } - return dAtA[:n], nil -} - -func (m *QueryAggregatePrevotesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) + dAtA[offset] = uint8(v) + return base } - -func (m *QueryAggregatePrevotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryExchangeRateRequest) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - return len(dAtA) - i, nil + l = len(m.Symbol) + if l > 0 { + n += 1 + l + sovQuery(uint64(l)) + } + return n } -func (m *QueryAggregatePrevotesResponse) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err +func (m *QueryExchangeRateResponse) Size() (n int) { + if m == nil { + return 0 } - return dAtA[:n], nil + var l int + _ = l + l = m.ExchangeRate.Size() + n += 1 + l + sovQuery(uint64(l)) + return n } -func (m *QueryAggregatePrevotesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) +func (m *QueryExchangeRatesRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n } -func (m *QueryAggregatePrevotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i +func (m *QueryExchangeRatesResponse) Size() (n int) { + if m == nil { + return 0 + } var l int _ = l - if len(m.AggregatePrevotes) > 0 { - for iNdEx := len(m.AggregatePrevotes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AggregatePrevotes[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintQuery(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0xa + if len(m.ExchangeRates) > 0 { + for _, e := range m.ExchangeRates { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) } } - return len(dAtA) - i, nil + return n } -func (m *QueryAggregateVoteRequest) 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 *QueryAggregateVoteRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAggregateVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.ValidatorAddr) > 0 { - i -= len(m.ValidatorAddr) - copy(dAtA[i:], m.ValidatorAddr) - i = encodeVarintQuery(dAtA, i, uint64(len(m.ValidatorAddr))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *QueryAggregateVoteResponse) 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 *QueryAggregateVoteResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAggregateVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - { - size, err := m.AggregateVote.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 *QueryAggregateVotesRequest) 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 *QueryAggregateVotesRequest) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAggregateVotesRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - return len(dAtA) - i, nil -} - -func (m *QueryAggregateVotesResponse) 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 *QueryAggregateVotesResponse) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *QueryAggregateVotesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.AggregateVotes) > 0 { - for iNdEx := len(m.AggregateVotes) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.AggregateVotes[iNdEx].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 *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 encodeVarintQuery(dAtA []byte, offset int, v uint64) int { - offset -= sovQuery(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *QueryExchangeRateRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Denom) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryExchangeRateResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.ExchangeRate.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryExchangeRatesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryExchangeRatesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.ExchangeRates) > 0 { - for _, e := range m.ExchangeRates { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryActivesRequest) Size() (n int) { - if m == nil { - return 0 +func (m *QueryActivesRequest) Size() (n int) { + if m == nil { + return 0 } var l int _ = l @@ -2239,32 +1288,6 @@ func (m *QueryVoteTargetsResponse) Size() (n int) { return n } -func (m *QueryFeederDelegationRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryFeederDelegationResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.FeederAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - func (m *QueryMissCounterRequest) Size() (n int) { if m == nil { return 0 @@ -2290,775 +1313,33 @@ func (m *QueryMissCounterResponse) Size() (n int) { return n } -func (m *QueryAggregatePrevoteRequest) Size() (n int) { +func (m *QueryParamsRequest) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } return n } -func (m *QueryAggregatePrevoteResponse) Size() (n int) { +func (m *QueryParamsResponse) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = m.AggregatePrevote.Size() + l = m.Params.Size() n += 1 + l + sovQuery(uint64(l)) return n } -func (m *QueryAggregatePrevotesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAggregatePrevotesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.AggregatePrevotes) > 0 { - for _, e := range m.AggregatePrevotes { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - return n -} - -func (m *QueryAggregateVoteRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.ValidatorAddr) - if l > 0 { - n += 1 + l + sovQuery(uint64(l)) - } - return n -} - -func (m *QueryAggregateVoteResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = m.AggregateVote.Size() - n += 1 + l + sovQuery(uint64(l)) - return n -} - -func (m *QueryAggregateVotesRequest) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *QueryAggregateVotesResponse) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.AggregateVotes) > 0 { - for _, e := range m.AggregateVotes { - l = e.Size() - n += 1 + l + sovQuery(uint64(l)) - } - } - 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 sovQuery(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozQuery(x uint64) (n int) { - return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *QueryExchangeRateRequest) 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: QueryExchangeRateRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryExchangeRateRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Denom", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Denom = string(dAtA[iNdEx:postIndex]) - 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 *QueryExchangeRateResponse) 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: QueryExchangeRateResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryExchangeRateResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRate", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.ExchangeRate.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 *QueryExchangeRatesRequest) 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: QueryExchangeRatesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryExchangeRatesRequest: 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 *QueryExchangeRatesResponse) 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: QueryExchangeRatesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryExchangeRatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRates", 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 - } - m.ExchangeRates = append(m.ExchangeRates, types.DecCoin{}) - if err := m.ExchangeRates[len(m.ExchangeRates)-1].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 *QueryActivesRequest) 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: QueryActivesRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryActivesRequest: 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 *QueryActivesResponse) 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: QueryActivesResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryActivesResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Actives", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Actives = append(m.Actives, string(dAtA[iNdEx:postIndex])) - 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 *QueryVoteTargetsRequest) 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: QueryVoteTargetsRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVoteTargetsRequest: 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 *QueryVoteTargetsResponse) 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: QueryVoteTargetsResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryVoteTargetsResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field VoteTargets", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.VoteTargets = append(m.VoteTargets, string(dAtA[iNdEx:postIndex])) - 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 *QueryFeederDelegationRequest) 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: QueryFeederDelegationRequest: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeederDelegationRequest: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - 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 sovQuery(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozQuery(x uint64) (n int) { + return sovQuery(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *QueryFeederDelegationResponse) Unmarshal(dAtA []byte) error { +func (m *QueryExchangeRateRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3081,15 +1362,15 @@ func (m *QueryFeederDelegationResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryFeederDelegationResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryExchangeRateRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryFeederDelegationResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryExchangeRateRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field FeederAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3117,7 +1398,7 @@ func (m *QueryFeederDelegationResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.FeederAddr = string(dAtA[iNdEx:postIndex]) + m.Symbol = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex default: iNdEx = preIndex @@ -3140,7 +1421,7 @@ func (m *QueryFeederDelegationResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryMissCounterRequest) Unmarshal(dAtA []byte) error { +func (m *QueryExchangeRateResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3163,15 +1444,15 @@ func (m *QueryMissCounterRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryMissCounterRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryExchangeRateResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMissCounterRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryExchangeRateResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRate", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -3199,77 +1480,10 @@ func (m *QueryMissCounterRequest) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipQuery(dAtA[iNdEx:]) - if err != nil { + if err := m.ExchangeRate.Unmarshal(dAtA[iNdEx:postIndex]); 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 *QueryMissCounterResponse) 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: QueryMissCounterResponse: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: QueryMissCounterResponse: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MissCounter", wireType) - } - m.MissCounter = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MissCounter |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3291,7 +1505,7 @@ func (m *QueryMissCounterResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAggregatePrevoteRequest) Unmarshal(dAtA []byte) error { +func (m *QueryExchangeRatesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3314,44 +1528,12 @@ func (m *QueryAggregatePrevoteRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAggregatePrevoteRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryExchangeRatesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregatePrevoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryExchangeRatesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3373,7 +1555,7 @@ func (m *QueryAggregatePrevoteRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAggregatePrevoteResponse) Unmarshal(dAtA []byte) error { +func (m *QueryExchangeRatesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3396,15 +1578,15 @@ func (m *QueryAggregatePrevoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAggregatePrevoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryExchangeRatesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregatePrevoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryExchangeRatesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregatePrevote", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRates", wireType) } var msglen int for shift := uint(0); ; shift += 7 { @@ -3431,7 +1613,8 @@ func (m *QueryAggregatePrevoteResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.AggregatePrevote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + m.ExchangeRates = append(m.ExchangeRates, types.DecCoin{}) + if err := m.ExchangeRates[len(m.ExchangeRates)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3456,7 +1639,7 @@ func (m *QueryAggregatePrevoteResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAggregatePrevotesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryActivesRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3479,10 +1662,10 @@ func (m *QueryAggregatePrevotesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAggregatePrevotesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryActivesRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregatePrevotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryActivesRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -3506,7 +1689,7 @@ func (m *QueryAggregatePrevotesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAggregatePrevotesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryActivesResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3529,17 +1712,17 @@ func (m *QueryAggregatePrevotesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAggregatePrevotesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryActivesResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregatePrevotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryActivesResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregatePrevotes", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Actives", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3549,25 +1732,23 @@ func (m *QueryAggregatePrevotesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - m.AggregatePrevotes = append(m.AggregatePrevotes, AggregateExchangeRatePrevote{}) - if err := m.AggregatePrevotes[len(m.AggregatePrevotes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.Actives = append(m.Actives, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -3590,7 +1771,7 @@ func (m *QueryAggregatePrevotesResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAggregateVoteRequest) Unmarshal(dAtA []byte) error { +func (m *QueryVoteTargetsRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3613,44 +1794,12 @@ func (m *QueryAggregateVoteRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAggregateVoteRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVoteTargetsRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregateVoteRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVoteTargetsRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowQuery - } - 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 ErrInvalidLengthQuery - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthQuery - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3672,7 +1821,7 @@ func (m *QueryAggregateVoteRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAggregateVoteResponse) Unmarshal(dAtA []byte) error { +func (m *QueryVoteTargetsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3695,17 +1844,17 @@ func (m *QueryAggregateVoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAggregateVoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryVoteTargetsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregateVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryVoteTargetsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregateVote", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field VoteTargets", wireType) } - var msglen int + var stringLen uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3715,24 +1864,23 @@ func (m *QueryAggregateVoteResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + stringLen |= uint64(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { + intStringLen := int(stringLen) + if intStringLen < 0 { return ErrInvalidLengthQuery } - postIndex := iNdEx + msglen + postIndex := iNdEx + intStringLen if postIndex < 0 { return ErrInvalidLengthQuery } if postIndex > l { return io.ErrUnexpectedEOF } - if err := m.AggregateVote.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } + m.VoteTargets = append(m.VoteTargets, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -3755,7 +1903,7 @@ func (m *QueryAggregateVoteResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAggregateVotesRequest) Unmarshal(dAtA []byte) error { +func (m *QueryMissCounterRequest) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3778,12 +1926,44 @@ func (m *QueryAggregateVotesRequest) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAggregateVotesRequest: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMissCounterRequest: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregateVotesRequest: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMissCounterRequest: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorAddr", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + 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 ErrInvalidLengthQuery + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorAddr = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) @@ -3805,7 +1985,7 @@ func (m *QueryAggregateVotesRequest) Unmarshal(dAtA []byte) error { } return nil } -func (m *QueryAggregateVotesResponse) Unmarshal(dAtA []byte) error { +func (m *QueryMissCounterResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -3828,17 +2008,17 @@ func (m *QueryAggregateVotesResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: QueryAggregateVotesResponse: wiretype end group for non-group") + return fmt.Errorf("proto: QueryMissCounterResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: QueryAggregateVotesResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: QueryMissCounterResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field AggregateVotes", wireType) + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field MissCounter", wireType) } - var msglen int + m.MissCounter = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowQuery @@ -3848,26 +2028,11 @@ func (m *QueryAggregateVotesResponse) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + m.MissCounter |= uint64(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 - } - m.AggregateVotes = append(m.AggregateVotes, AggregateExchangeRateVote{}) - if err := m.AggregateVotes[len(m.AggregateVotes)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipQuery(dAtA[iNdEx:]) diff --git a/x/oracle/types/query.pb.gw.go b/x/oracle/types/query.pb.gw.go index 30333d51..b8e8b033 100644 --- a/x/oracle/types/query.pb.gw.go +++ b/x/oracle/types/query.pb.gw.go @@ -20,7 +20,6 @@ import ( "google.golang.org/grpc" "google.golang.org/grpc/codes" "google.golang.org/grpc/grpclog" - "google.golang.org/grpc/metadata" "google.golang.org/grpc/status" ) @@ -31,7 +30,6 @@ var _ status.Status var _ = runtime.String var _ = utilities.NewDoubleArray var _ = descriptor.ForMessage -var _ = metadata.Join func request_Query_ExchangeRate_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryExchangeRateRequest @@ -44,15 +42,15 @@ func request_Query_ExchangeRate_0(ctx context.Context, marshaler runtime.Marshal _ = err ) - val, ok = pathParams["denom"] + val, ok = pathParams["symbol"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "symbol") } - protoReq.Denom, err = runtime.String(val) + protoReq.Symbol, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "symbol", err) } msg, err := client.ExchangeRate(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) @@ -71,15 +69,15 @@ func local_request_Query_ExchangeRate_0(ctx context.Context, marshaler runtime.M _ = err ) - val, ok = pathParams["denom"] + val, ok = pathParams["symbol"] if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "denom") + return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "symbol") } - protoReq.Denom, err = runtime.String(val) + protoReq.Symbol, err = runtime.String(val) if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "denom", err) + return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "symbol", err) } msg, err := server.ExchangeRate(ctx, &protoReq) @@ -123,60 +121,6 @@ func local_request_Query_Actives_0(ctx context.Context, marshaler runtime.Marsha } -func request_Query_FeederDelegation_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFeederDelegationRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["validator_addr"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") - } - - protoReq.ValidatorAddr, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) - } - - msg, err := client.FeederDelegation(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_FeederDelegation_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryFeederDelegationRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["validator_addr"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") - } - - protoReq.ValidatorAddr, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) - } - - msg, err := server.FeederDelegation(ctx, &protoReq) - return msg, metadata, err - -} - func request_Query_MissCounter_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { var protoReq QueryMissCounterRequest var metadata runtime.ServerMetadata @@ -231,150 +175,6 @@ func local_request_Query_MissCounter_0(ctx context.Context, marshaler runtime.Ma } -func request_Query_AggregatePrevote_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregatePrevoteRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["validator_addr"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") - } - - protoReq.ValidatorAddr, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) - } - - msg, err := client.AggregatePrevote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AggregatePrevote_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregatePrevoteRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["validator_addr"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") - } - - protoReq.ValidatorAddr, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) - } - - msg, err := server.AggregatePrevote(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_AggregatePrevotes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregatePrevotesRequest - var metadata runtime.ServerMetadata - - msg, err := client.AggregatePrevotes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AggregatePrevotes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregatePrevotesRequest - var metadata runtime.ServerMetadata - - msg, err := server.AggregatePrevotes(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_AggregateVote_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregateVoteRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["validator_addr"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") - } - - protoReq.ValidatorAddr, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) - } - - msg, err := client.AggregateVote(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AggregateVote_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregateVoteRequest - var metadata runtime.ServerMetadata - - var ( - val string - ok bool - err error - _ = err - ) - - val, ok = pathParams["validator_addr"] - if !ok { - return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "validator_addr") - } - - protoReq.ValidatorAddr, err = runtime.String(val) - - if err != nil { - return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "validator_addr", err) - } - - msg, err := server.AggregateVote(ctx, &protoReq) - return msg, metadata, err - -} - -func request_Query_AggregateVotes_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregateVotesRequest - var metadata runtime.ServerMetadata - - msg, err := client.AggregateVotes(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) - return msg, metadata, err - -} - -func local_request_Query_AggregateVotes_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { - var protoReq QueryAggregateVotesRequest - var metadata runtime.ServerMetadata - - msg, err := server.AggregateVotes(ctx, &protoReq) - return msg, metadata, err - -} - 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 @@ -396,14 +196,12 @@ func local_request_Query_Params_0(ctx context.Context, marshaler runtime.Marshal // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. -// Note that using this registration option will cause many gRPC library features to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. +// Note that using this registration option will cause many gRPC library features (such as grpc.SendHeader, etc) to stop working. Consider using RegisterQueryHandlerFromEndpoint instead. func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, server QueryServer) error { mux.Handle("GET", pattern_Query_ExchangeRate_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 { @@ -411,7 +209,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ExchangeRate_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) @@ -425,8 +222,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_ExchangeRates_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 { @@ -434,7 +229,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_ExchangeRates_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) @@ -448,8 +242,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv mux.Handle("GET", pattern_Query_Actives_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 { @@ -457,7 +249,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_Actives_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) @@ -468,34 +259,9 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_FeederDelegation_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_FeederDelegation_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_FeederDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_MissCounter_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 { @@ -503,7 +269,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv return } resp, md, err := local_request_Query_MissCounter_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) @@ -514,103 +279,9 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) - mux.Handle("GET", pattern_Query_AggregatePrevote_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_AggregatePrevote_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_AggregatePrevote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AggregatePrevotes_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_AggregatePrevotes_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_AggregatePrevotes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AggregateVote_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_AggregateVote_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_AggregateVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AggregateVotes_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_AggregateVotes_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_AggregateVotes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - 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 { @@ -618,7 +289,6 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv 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) @@ -730,26 +400,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_FeederDelegation_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_FeederDelegation_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_FeederDelegation_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - mux.Handle("GET", pattern_Query_MissCounter_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { ctx, cancel := context.WithCancel(req.Context()) defer cancel() @@ -770,86 +420,6 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) - mux.Handle("GET", pattern_Query_AggregatePrevote_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_AggregatePrevote_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_AggregatePrevote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AggregatePrevotes_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_AggregatePrevotes_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_AggregatePrevotes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AggregateVote_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_AggregateVote_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_AggregateVote_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - - mux.Handle("GET", pattern_Query_AggregateVotes_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_AggregateVotes_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_AggregateVotes_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) - - }) - 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() @@ -874,24 +444,14 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie } var ( - pattern_Query_ExchangeRate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"oracle", "denoms", "denom", "exchange_rate"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_ExchangeRate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"oracle", "symbols", "symbol", "exchange_rate"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_ExchangeRates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"oracle", "denoms", "exchange_rates"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_ExchangeRates_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"oracle", "symbols", "exchange_rates"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_Actives_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"oracle", "denoms", "actives"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_FeederDelegation_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"oracle", "validators", "validator_addr", "feeder"}, "", runtime.AssumeColonVerbOpt(true))) + pattern_Query_Actives_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"oracle", "symbols", "actives"}, "", runtime.AssumeColonVerbOpt(true))) pattern_Query_MissCounter_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"oracle", "validators", "validator_addr", "miss"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_AggregatePrevote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"oracle", "validators", "validator_addr", "aggregate_prevote"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_AggregatePrevotes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"oracle", "validators", "aggregate_prevotes"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_AggregateVote_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"oracle", "valdiators", "validator_addr", "aggregate_vote"}, "", runtime.AssumeColonVerbOpt(true))) - - pattern_Query_AggregateVotes_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"oracle", "validators", "aggregate_votes"}, "", runtime.AssumeColonVerbOpt(true))) - pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"oracle", "params"}, "", runtime.AssumeColonVerbOpt(true))) ) @@ -902,17 +462,7 @@ var ( forward_Query_Actives_0 = runtime.ForwardResponseMessage - forward_Query_FeederDelegation_0 = runtime.ForwardResponseMessage - forward_Query_MissCounter_0 = runtime.ForwardResponseMessage - forward_Query_AggregatePrevote_0 = runtime.ForwardResponseMessage - - forward_Query_AggregatePrevotes_0 = runtime.ForwardResponseMessage - - forward_Query_AggregateVote_0 = runtime.ForwardResponseMessage - - forward_Query_AggregateVotes_0 = runtime.ForwardResponseMessage - forward_Query_Params_0 = runtime.ForwardResponseMessage ) diff --git a/x/oracle/types/test_utils.go b/x/oracle/types/test_utils.go index e3223d2f..77a24fa4 100644 --- a/x/oracle/types/test_utils.go +++ b/x/oracle/types/test_utils.go @@ -1,11 +1,14 @@ -//nolint +//nolint:all package types import ( + "context" "math" "math/rand" - "time" + "cosmossdk.io/core/store" + sdkmath "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" sdk "github.com/cosmos/cosmos-sdk/types" stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" @@ -14,7 +17,7 @@ import ( tmprotocrypto "github.com/cometbft/cometbft/proto/tendermint/crypto" ) -//nolint +//nolint:all const ( TestDenomA = "ukuji" TestDenomB = "denomB" @@ -38,7 +41,6 @@ func GenerateRandomTestCase() (rates []float64, valValAddrs []sdk.ValAddress, st base := math.Pow10(OracleDecPrecision) - rand.Seed(int64(time.Now().Nanosecond())) numInputs := 10 + (rand.Int() % 100) for i := 0; i < numInputs; i++ { rate := float64(int64(rand.Float64()*base)) / base @@ -78,45 +80,46 @@ func (sk DummyStakingKeeper) Validators() []MockValidator { } // Validator nolint -func (sk DummyStakingKeeper) Validator(ctx sdk.Context, address sdk.ValAddress) stakingtypes.ValidatorI { +func (sk DummyStakingKeeper) Validator(ctx context.Context, address sdk.ValAddress) (stakingtypes.ValidatorI, error) { for _, validator := range sk.validators { - if validator.GetOperator().Equals(address) { - return validator + if validator.GetOperator() == address.String() { + return validator, nil } } - return nil + return nil, nil } // TotalBondedTokens nolint -func (DummyStakingKeeper) TotalBondedTokens(_ sdk.Context) sdk.Int { - return sdk.ZeroInt() +func (DummyStakingKeeper) TotalBondedTokens(_ context.Context) (sdkmath.Int, error) { + return sdkmath.ZeroInt(), nil } // Slash nolint -func (DummyStakingKeeper) Slash(sdk.Context, sdk.ConsAddress, int64, int64, sdk.Dec) {} +func (DummyStakingKeeper) Slash(context.Context, sdk.ConsAddress, int64, int64, sdkmath.LegacyDec) {} // ValidatorsPowerStoreIterator nolint -func (DummyStakingKeeper) ValidatorsPowerStoreIterator(ctx sdk.Context) sdk.Iterator { - return sdk.KVStoreReversePrefixIterator(nil, nil) +func (DummyStakingKeeper) ValidatorsPowerStoreIterator(ctx context.Context) (store.Iterator, error) { + return storetypes.KVStoreReversePrefixIterator(nil, nil), nil } // Jail nolint -func (DummyStakingKeeper) Jail(sdk.Context, sdk.ConsAddress) { +func (DummyStakingKeeper) Jail(context.Context, sdk.ConsAddress) { } // GetLastValidatorPower nolint -func (sk DummyStakingKeeper) GetLastValidatorPower(ctx sdk.Context, operator sdk.ValAddress) (power int64) { - return sk.Validator(ctx, operator).GetConsensusPower(sdk.DefaultPowerReduction) +func (sk DummyStakingKeeper) GetLastValidatorPower(ctx context.Context, operator sdk.ValAddress) (power int64) { + val, _ := sk.Validator(ctx, operator) + return val.GetConsensusPower(sdk.DefaultPowerReduction) } // MaxValidators returns the maximum amount of bonded validators -func (DummyStakingKeeper) MaxValidators(sdk.Context) uint32 { - return 100 +func (DummyStakingKeeper) MaxValidators(context.Context) (uint32, error) { + return 100, nil } // PowerReduction - is the amount of staking tokens required for 1 unit of consensus-engine power -func (DummyStakingKeeper) PowerReduction(ctx sdk.Context) (res sdk.Int) { +func (DummyStakingKeeper) PowerReduction(ctx context.Context) (res sdkmath.Int) { res = sdk.DefaultPowerReduction return } @@ -135,30 +138,42 @@ func (MockValidator) GetStatus() stakingtypes.BondStatus { return stakingty func (MockValidator) IsBonded() bool { return true } func (MockValidator) IsUnbonded() bool { return false } func (MockValidator) IsUnbonding() bool { return false } -func (v MockValidator) GetOperator() sdk.ValAddress { return v.operator } +func (v MockValidator) GetOperator() string { return v.operator.String() } func (MockValidator) ConsPubKey() (cryptotypes.PubKey, error) { return nil, nil } func (MockValidator) TmConsPublicKey() (tmprotocrypto.PublicKey, error) { return tmprotocrypto.PublicKey{}, nil } -func (MockValidator) GetConsAddr() (sdk.ConsAddress, error) { return nil, nil } -func (v MockValidator) GetTokens() sdk.Int { +func (MockValidator) GetConsAddr() ([]byte, error) { return nil, nil } +func (v MockValidator) GetTokens() sdkmath.Int { return sdk.TokensFromConsensusPower(v.power, sdk.DefaultPowerReduction) } -func (v MockValidator) GetBondedTokens() sdk.Int { +func (v MockValidator) GetBondedTokens() sdkmath.Int { return sdk.TokensFromConsensusPower(v.power, sdk.DefaultPowerReduction) } -func (v MockValidator) GetConsensusPower(powerReduction sdk.Int) int64 { return v.power } -func (v *MockValidator) SetConsensusPower(power int64) { v.power = power } -func (v MockValidator) GetCommission() sdk.Dec { return sdk.ZeroDec() } -func (v MockValidator) GetMinSelfDelegation() sdk.Int { return sdk.OneInt() } -func (v MockValidator) GetDelegatorShares() sdk.Dec { return sdk.NewDec(v.power) } -func (v MockValidator) TokensFromShares(sdk.Dec) sdk.Dec { return sdk.ZeroDec() } -func (v MockValidator) TokensFromSharesTruncated(sdk.Dec) sdk.Dec { return sdk.ZeroDec() } -func (v MockValidator) TokensFromSharesRoundUp(sdk.Dec) sdk.Dec { return sdk.ZeroDec() } -func (v MockValidator) SharesFromTokens(amt sdk.Int) (sdk.Dec, error) { return sdk.ZeroDec(), nil } -func (v MockValidator) SharesFromTokensTruncated(amt sdk.Int) (sdk.Dec, error) { - return sdk.ZeroDec(), nil +func (v MockValidator) GetConsensusPower(powerReduction sdkmath.Int) int64 { return v.power } +func (v *MockValidator) SetConsensusPower(power int64) { v.power = power } +func (v MockValidator) GetCommission() sdkmath.LegacyDec { return sdkmath.LegacyZeroDec() } +func (v MockValidator) GetMinSelfDelegation() sdkmath.Int { return sdkmath.OneInt() } +func (v MockValidator) GetDelegatorShares() sdkmath.LegacyDec { return sdkmath.LegacyNewDec(v.power) } +func (v MockValidator) TokensFromShares(sdkmath.LegacyDec) sdkmath.LegacyDec { + return sdkmath.LegacyZeroDec() +} + +func (v MockValidator) TokensFromSharesTruncated(sdkmath.LegacyDec) sdkmath.LegacyDec { + return sdkmath.LegacyZeroDec() +} + +func (v MockValidator) TokensFromSharesRoundUp(sdkmath.LegacyDec) sdkmath.LegacyDec { + return sdkmath.LegacyZeroDec() +} + +func (v MockValidator) SharesFromTokens(amt sdkmath.Int) (sdkmath.LegacyDec, error) { + return sdkmath.LegacyZeroDec(), nil +} + +func (v MockValidator) SharesFromTokensTruncated(amt sdkmath.Int) (sdkmath.LegacyDec, error) { + return sdkmath.LegacyZeroDec(), nil } func NewMockValidator(valAddr sdk.ValAddress, power int64) MockValidator { diff --git a/x/oracle/types/tx.pb.go b/x/oracle/types/tx.pb.go index 32f32103..a5b7d1ff 100644 --- a/x/oracle/types/tx.pb.go +++ b/x/oracle/types/tx.pb.go @@ -6,6 +6,7 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/cosmos/gogoproto/grpc" proto "github.com/cosmos/gogoproto/proto" @@ -28,26 +29,24 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -// MsgAggregateExchangeRatePrevote represents a message to submit -// aggregate exchange rate prevote. -type MsgAggregateExchangeRatePrevote struct { - Hash string `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty" yaml:"hash"` - Feeder string `protobuf:"bytes,2,opt,name=feeder,proto3" json:"feeder,omitempty" yaml:"feeder"` - Validator string `protobuf:"bytes,3,opt,name=validator,proto3" json:"validator,omitempty" yaml:"validator"` +// MsgAddRequiredSymbol represents a message to add a symbol to the whitelist +type MsgAddRequiredSymbols struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + Symbols []string `protobuf:"bytes,2,rep,name=symbols,proto3" json:"symbols,omitempty" yaml:"symbols"` } -func (m *MsgAggregateExchangeRatePrevote) Reset() { *m = MsgAggregateExchangeRatePrevote{} } -func (m *MsgAggregateExchangeRatePrevote) String() string { return proto.CompactTextString(m) } -func (*MsgAggregateExchangeRatePrevote) ProtoMessage() {} -func (*MsgAggregateExchangeRatePrevote) Descriptor() ([]byte, []int) { +func (m *MsgAddRequiredSymbols) Reset() { *m = MsgAddRequiredSymbols{} } +func (m *MsgAddRequiredSymbols) String() string { return proto.CompactTextString(m) } +func (*MsgAddRequiredSymbols) ProtoMessage() {} +func (*MsgAddRequiredSymbols) Descriptor() ([]byte, []int) { return fileDescriptor_15c3977432059018, []int{0} } -func (m *MsgAggregateExchangeRatePrevote) XXX_Unmarshal(b []byte) error { +func (m *MsgAddRequiredSymbols) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgAggregateExchangeRatePrevote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgAddRequiredSymbols) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgAggregateExchangeRatePrevote.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgAddRequiredSymbols.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -57,36 +56,48 @@ func (m *MsgAggregateExchangeRatePrevote) XXX_Marshal(b []byte, deterministic bo return b[:n], nil } } -func (m *MsgAggregateExchangeRatePrevote) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAggregateExchangeRatePrevote.Merge(m, src) +func (m *MsgAddRequiredSymbols) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddRequiredSymbols.Merge(m, src) } -func (m *MsgAggregateExchangeRatePrevote) XXX_Size() int { +func (m *MsgAddRequiredSymbols) XXX_Size() int { return m.Size() } -func (m *MsgAggregateExchangeRatePrevote) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAggregateExchangeRatePrevote.DiscardUnknown(m) +func (m *MsgAddRequiredSymbols) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddRequiredSymbols.DiscardUnknown(m) } -var xxx_messageInfo_MsgAggregateExchangeRatePrevote proto.InternalMessageInfo +var xxx_messageInfo_MsgAddRequiredSymbols proto.InternalMessageInfo -// MsgAggregateExchangeRatePrevoteResponse defines the Msg/AggregateExchangeRatePrevote response type. -type MsgAggregateExchangeRatePrevoteResponse struct { +func (m *MsgAddRequiredSymbols) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" +} + +func (m *MsgAddRequiredSymbols) GetSymbols() []string { + if m != nil { + return m.Symbols + } + return nil } -func (m *MsgAggregateExchangeRatePrevoteResponse) Reset() { - *m = MsgAggregateExchangeRatePrevoteResponse{} +// MsgAddRequiredSymbolResponse defines the Msg/AddRequiredSymbol response type. +type MsgAddRequiredSymbolsResponse struct { } -func (m *MsgAggregateExchangeRatePrevoteResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAggregateExchangeRatePrevoteResponse) ProtoMessage() {} -func (*MsgAggregateExchangeRatePrevoteResponse) Descriptor() ([]byte, []int) { + +func (m *MsgAddRequiredSymbolsResponse) Reset() { *m = MsgAddRequiredSymbolsResponse{} } +func (m *MsgAddRequiredSymbolsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgAddRequiredSymbolsResponse) ProtoMessage() {} +func (*MsgAddRequiredSymbolsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_15c3977432059018, []int{1} } -func (m *MsgAggregateExchangeRatePrevoteResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgAddRequiredSymbolsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgAggregateExchangeRatePrevoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgAddRequiredSymbolsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgAggregateExchangeRatePrevoteResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgAddRequiredSymbolsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -96,39 +107,36 @@ func (m *MsgAggregateExchangeRatePrevoteResponse) XXX_Marshal(b []byte, determin return b[:n], nil } } -func (m *MsgAggregateExchangeRatePrevoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAggregateExchangeRatePrevoteResponse.Merge(m, src) +func (m *MsgAddRequiredSymbolsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgAddRequiredSymbolsResponse.Merge(m, src) } -func (m *MsgAggregateExchangeRatePrevoteResponse) XXX_Size() int { +func (m *MsgAddRequiredSymbolsResponse) XXX_Size() int { return m.Size() } -func (m *MsgAggregateExchangeRatePrevoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAggregateExchangeRatePrevoteResponse.DiscardUnknown(m) +func (m *MsgAddRequiredSymbolsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgAddRequiredSymbolsResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgAggregateExchangeRatePrevoteResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgAddRequiredSymbolsResponse proto.InternalMessageInfo -// MsgAggregateExchangeRateVote represents a message to submit -// aggregate exchange rate vote. -type MsgAggregateExchangeRateVote struct { - Salt string `protobuf:"bytes,1,opt,name=salt,proto3" json:"salt,omitempty" yaml:"salt"` - ExchangeRates string `protobuf:"bytes,2,opt,name=exchange_rates,json=exchangeRates,proto3" json:"exchange_rates,omitempty" yaml:"exchange_rates"` - Feeder string `protobuf:"bytes,3,opt,name=feeder,proto3" json:"feeder,omitempty" yaml:"feeder"` - Validator string `protobuf:"bytes,4,opt,name=validator,proto3" json:"validator,omitempty" yaml:"validator"` +// MsgRemoveRequiredSymbol represents a message to remove a symbol from the whitelist +type MsgRemoveRequiredSymbols struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + Symbols []string `protobuf:"bytes,2,rep,name=symbols,proto3" json:"symbols,omitempty" yaml:"symbols"` } -func (m *MsgAggregateExchangeRateVote) Reset() { *m = MsgAggregateExchangeRateVote{} } -func (m *MsgAggregateExchangeRateVote) String() string { return proto.CompactTextString(m) } -func (*MsgAggregateExchangeRateVote) ProtoMessage() {} -func (*MsgAggregateExchangeRateVote) Descriptor() ([]byte, []int) { +func (m *MsgRemoveRequiredSymbols) Reset() { *m = MsgRemoveRequiredSymbols{} } +func (m *MsgRemoveRequiredSymbols) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveRequiredSymbols) ProtoMessage() {} +func (*MsgRemoveRequiredSymbols) Descriptor() ([]byte, []int) { return fileDescriptor_15c3977432059018, []int{2} } -func (m *MsgAggregateExchangeRateVote) XXX_Unmarshal(b []byte) error { +func (m *MsgRemoveRequiredSymbols) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgAggregateExchangeRateVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRemoveRequiredSymbols) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgAggregateExchangeRateVote.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRemoveRequiredSymbols.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -138,34 +146,48 @@ func (m *MsgAggregateExchangeRateVote) XXX_Marshal(b []byte, deterministic bool) return b[:n], nil } } -func (m *MsgAggregateExchangeRateVote) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAggregateExchangeRateVote.Merge(m, src) +func (m *MsgRemoveRequiredSymbols) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveRequiredSymbols.Merge(m, src) } -func (m *MsgAggregateExchangeRateVote) XXX_Size() int { +func (m *MsgRemoveRequiredSymbols) XXX_Size() int { return m.Size() } -func (m *MsgAggregateExchangeRateVote) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAggregateExchangeRateVote.DiscardUnknown(m) +func (m *MsgRemoveRequiredSymbols) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveRequiredSymbols.DiscardUnknown(m) } -var xxx_messageInfo_MsgAggregateExchangeRateVote proto.InternalMessageInfo +var xxx_messageInfo_MsgRemoveRequiredSymbols proto.InternalMessageInfo -// MsgAggregateExchangeRateVoteResponse defines the Msg/AggregateExchangeRateVote response type. -type MsgAggregateExchangeRateVoteResponse struct { +func (m *MsgRemoveRequiredSymbols) GetAuthority() string { + if m != nil { + return m.Authority + } + return "" } -func (m *MsgAggregateExchangeRateVoteResponse) Reset() { *m = MsgAggregateExchangeRateVoteResponse{} } -func (m *MsgAggregateExchangeRateVoteResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAggregateExchangeRateVoteResponse) ProtoMessage() {} -func (*MsgAggregateExchangeRateVoteResponse) Descriptor() ([]byte, []int) { +func (m *MsgRemoveRequiredSymbols) GetSymbols() []string { + if m != nil { + return m.Symbols + } + return nil +} + +// MsgRemoveRequiredSymbolResponse defines the Msg/RemoveRequiredSymbol response type. +type MsgRemoveRequiredSymbolsResponse struct { +} + +func (m *MsgRemoveRequiredSymbolsResponse) Reset() { *m = MsgRemoveRequiredSymbolsResponse{} } +func (m *MsgRemoveRequiredSymbolsResponse) String() string { return proto.CompactTextString(m) } +func (*MsgRemoveRequiredSymbolsResponse) ProtoMessage() {} +func (*MsgRemoveRequiredSymbolsResponse) Descriptor() ([]byte, []int) { return fileDescriptor_15c3977432059018, []int{3} } -func (m *MsgAggregateExchangeRateVoteResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgRemoveRequiredSymbolsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgAggregateExchangeRateVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgRemoveRequiredSymbolsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgAggregateExchangeRateVoteResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgRemoveRequiredSymbolsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -175,37 +197,35 @@ func (m *MsgAggregateExchangeRateVoteResponse) XXX_Marshal(b []byte, determinist return b[:n], nil } } -func (m *MsgAggregateExchangeRateVoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAggregateExchangeRateVoteResponse.Merge(m, src) +func (m *MsgRemoveRequiredSymbolsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgRemoveRequiredSymbolsResponse.Merge(m, src) } -func (m *MsgAggregateExchangeRateVoteResponse) XXX_Size() int { +func (m *MsgRemoveRequiredSymbolsResponse) XXX_Size() int { return m.Size() } -func (m *MsgAggregateExchangeRateVoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAggregateExchangeRateVoteResponse.DiscardUnknown(m) +func (m *MsgRemoveRequiredSymbolsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgRemoveRequiredSymbolsResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgAggregateExchangeRateVoteResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgRemoveRequiredSymbolsResponse proto.InternalMessageInfo -// MsgDelegateFeedConsent represents a message to -// delegate oracle voting rights to another address. -type MsgDelegateFeedConsent struct { - Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty" yaml:"operator"` - Delegate string `protobuf:"bytes,2,opt,name=delegate,proto3" json:"delegate,omitempty" yaml:"delegate"` +type MsgUpdateParams struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty" yaml:"authority"` + Params *Params `protobuf:"bytes,2,opt,name=params,proto3" json:"params,omitempty" yaml:"params"` } -func (m *MsgDelegateFeedConsent) Reset() { *m = MsgDelegateFeedConsent{} } -func (m *MsgDelegateFeedConsent) String() string { return proto.CompactTextString(m) } -func (*MsgDelegateFeedConsent) ProtoMessage() {} -func (*MsgDelegateFeedConsent) Descriptor() ([]byte, []int) { +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_15c3977432059018, []int{4} } -func (m *MsgDelegateFeedConsent) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDelegateFeedConsent) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateParams) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDelegateFeedConsent.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateParams.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -215,34 +235,48 @@ func (m *MsgDelegateFeedConsent) XXX_Marshal(b []byte, deterministic bool) ([]by return b[:n], nil } } -func (m *MsgDelegateFeedConsent) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegateFeedConsent.Merge(m, src) +func (m *MsgUpdateParams) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParams.Merge(m, src) } -func (m *MsgDelegateFeedConsent) XXX_Size() int { +func (m *MsgUpdateParams) XXX_Size() int { return m.Size() } -func (m *MsgDelegateFeedConsent) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegateFeedConsent.DiscardUnknown(m) +func (m *MsgUpdateParams) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParams.DiscardUnknown(m) } -var xxx_messageInfo_MsgDelegateFeedConsent proto.InternalMessageInfo +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 nil +} -// MsgDelegateFeedConsentResponse defines the Msg/DelegateFeedConsent response type. -type MsgDelegateFeedConsentResponse struct { +// MsgUpdateParamsResponse defines the Msg/UpdateParams response type. +type MsgUpdateParamsResponse struct { } -func (m *MsgDelegateFeedConsentResponse) Reset() { *m = MsgDelegateFeedConsentResponse{} } -func (m *MsgDelegateFeedConsentResponse) String() string { return proto.CompactTextString(m) } -func (*MsgDelegateFeedConsentResponse) ProtoMessage() {} -func (*MsgDelegateFeedConsentResponse) Descriptor() ([]byte, []int) { +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_15c3977432059018, []int{5} } -func (m *MsgDelegateFeedConsentResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgUpdateParamsResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgDelegateFeedConsentResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgUpdateParamsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgDelegateFeedConsentResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgUpdateParamsResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -252,62 +286,58 @@ func (m *MsgDelegateFeedConsentResponse) XXX_Marshal(b []byte, deterministic boo return b[:n], nil } } -func (m *MsgDelegateFeedConsentResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgDelegateFeedConsentResponse.Merge(m, src) +func (m *MsgUpdateParamsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateParamsResponse.Merge(m, src) } -func (m *MsgDelegateFeedConsentResponse) XXX_Size() int { +func (m *MsgUpdateParamsResponse) XXX_Size() int { return m.Size() } -func (m *MsgDelegateFeedConsentResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgDelegateFeedConsentResponse.DiscardUnknown(m) +func (m *MsgUpdateParamsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateParamsResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgDelegateFeedConsentResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgUpdateParamsResponse proto.InternalMessageInfo func init() { - proto.RegisterType((*MsgAggregateExchangeRatePrevote)(nil), "kujira.oracle.MsgAggregateExchangeRatePrevote") - proto.RegisterType((*MsgAggregateExchangeRatePrevoteResponse)(nil), "kujira.oracle.MsgAggregateExchangeRatePrevoteResponse") - proto.RegisterType((*MsgAggregateExchangeRateVote)(nil), "kujira.oracle.MsgAggregateExchangeRateVote") - proto.RegisterType((*MsgAggregateExchangeRateVoteResponse)(nil), "kujira.oracle.MsgAggregateExchangeRateVoteResponse") - proto.RegisterType((*MsgDelegateFeedConsent)(nil), "kujira.oracle.MsgDelegateFeedConsent") - proto.RegisterType((*MsgDelegateFeedConsentResponse)(nil), "kujira.oracle.MsgDelegateFeedConsentResponse") + proto.RegisterType((*MsgAddRequiredSymbols)(nil), "kujira.oracle.MsgAddRequiredSymbols") + proto.RegisterType((*MsgAddRequiredSymbolsResponse)(nil), "kujira.oracle.MsgAddRequiredSymbolsResponse") + proto.RegisterType((*MsgRemoveRequiredSymbols)(nil), "kujira.oracle.MsgRemoveRequiredSymbols") + proto.RegisterType((*MsgRemoveRequiredSymbolsResponse)(nil), "kujira.oracle.MsgRemoveRequiredSymbolsResponse") + proto.RegisterType((*MsgUpdateParams)(nil), "kujira.oracle.MsgUpdateParams") + proto.RegisterType((*MsgUpdateParamsResponse)(nil), "kujira.oracle.MsgUpdateParamsResponse") } func init() { proto.RegisterFile("kujira/oracle/tx.proto", fileDescriptor_15c3977432059018) } var fileDescriptor_15c3977432059018 = []byte{ - // 492 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0xbf, 0x6f, 0xd3, 0x40, - 0x14, 0xc7, 0x7d, 0x4d, 0x55, 0xb5, 0x87, 0x42, 0xc1, 0x2d, 0x55, 0x1a, 0x55, 0x76, 0x75, 0xfc, - 0x2c, 0xa8, 0xb6, 0xd4, 0x4a, 0x0c, 0x9d, 0xa0, 0x14, 0x16, 0x14, 0x09, 0x9d, 0x10, 0x03, 0x0b, - 0xba, 0x26, 0x8f, 0x4b, 0xa8, 0x93, 0x8b, 0xee, 0xae, 0x55, 0x3a, 0xb0, 0x21, 0xc4, 0xc8, 0x9f, - 0xd0, 0xff, 0x80, 0x7f, 0x83, 0xb1, 0x23, 0x93, 0x85, 0x92, 0x85, 0x89, 0xc1, 0x23, 0x13, 0xf2, - 0x9d, 0xed, 0xa6, 0x6a, 0xda, 0xc6, 0x9b, 0xf5, 0xbe, 0x9f, 0x7b, 0x3f, 0xbe, 0x7e, 0x7a, 0x78, - 0xe5, 0xe0, 0xf0, 0x53, 0x47, 0xb2, 0x50, 0x48, 0xd6, 0x8c, 0x20, 0xd4, 0x83, 0xa0, 0x2f, 0x85, - 0x16, 0x6e, 0xd5, 0xc6, 0x03, 0x1b, 0xaf, 0x2f, 0x73, 0xc1, 0x85, 0x51, 0xc2, 0xf4, 0xcb, 0x42, - 0xe4, 0x07, 0xc2, 0x7e, 0x43, 0xf1, 0xe7, 0x9c, 0x4b, 0xe0, 0x4c, 0xc3, 0xcb, 0x41, 0xb3, 0xcd, - 0x7a, 0x1c, 0x28, 0xd3, 0xf0, 0x46, 0xc2, 0x91, 0xd0, 0xe0, 0xde, 0xc5, 0xb3, 0x6d, 0xa6, 0xda, - 0x35, 0xb4, 0x8e, 0x1e, 0x2d, 0xec, 0x2e, 0x26, 0xb1, 0x7f, 0xe3, 0x98, 0x75, 0xa3, 0x1d, 0x92, - 0x46, 0x09, 0x35, 0xa2, 0xbb, 0x81, 0xe7, 0x3e, 0x02, 0xb4, 0x40, 0xd6, 0x66, 0x0c, 0x76, 0x3b, - 0x89, 0xfd, 0xaa, 0xc5, 0x6c, 0x9c, 0xd0, 0x0c, 0x70, 0xb7, 0xf0, 0xc2, 0x11, 0x8b, 0x3a, 0x2d, - 0xa6, 0x85, 0xac, 0x55, 0x0c, 0xbd, 0x9c, 0xc4, 0xfe, 0x2d, 0x4b, 0x17, 0x12, 0xa1, 0x67, 0xd8, - 0xce, 0xfc, 0xb7, 0x13, 0xdf, 0xf9, 0x73, 0xe2, 0x3b, 0x64, 0x03, 0x3f, 0xbc, 0xa6, 0x61, 0x0a, - 0xaa, 0x2f, 0x7a, 0x0a, 0xc8, 0x5f, 0x84, 0xd7, 0x2e, 0x63, 0xdf, 0x65, 0x93, 0x29, 0x16, 0xe9, - 0x8b, 0x93, 0xa5, 0x51, 0x42, 0x8d, 0xe8, 0x3e, 0xc3, 0x37, 0x21, 0x7b, 0xf8, 0x41, 0x32, 0x0d, - 0x2a, 0x9b, 0x70, 0x35, 0x89, 0xfd, 0x3b, 0x16, 0x3f, 0xaf, 0x13, 0x5a, 0x85, 0xb1, 0x4a, 0x6a, - 0xcc, 0x9b, 0x4a, 0x29, 0x6f, 0x66, 0xcb, 0x7a, 0xf3, 0x00, 0xdf, 0xbb, 0x6a, 0xde, 0xc2, 0x98, - 0x2f, 0x08, 0xaf, 0x34, 0x14, 0xdf, 0x83, 0xc8, 0x70, 0xaf, 0x00, 0x5a, 0x2f, 0x52, 0xa1, 0xa7, - 0xdd, 0x10, 0xcf, 0x8b, 0x3e, 0x48, 0x53, 0xdf, 0xda, 0xb2, 0x94, 0xc4, 0xfe, 0xa2, 0xad, 0x9f, - 0x2b, 0x84, 0x16, 0x50, 0xfa, 0xa0, 0x95, 0xe5, 0xc9, 0x8c, 0x19, 0x7b, 0x90, 0x2b, 0x84, 0x16, - 0xd0, 0x58, 0xbb, 0xeb, 0xd8, 0x9b, 0xdc, 0x45, 0xde, 0xe8, 0xd6, 0xbf, 0x19, 0x5c, 0x69, 0x28, - 0xee, 0x7e, 0x45, 0x78, 0xed, 0xca, 0x1d, 0x0d, 0x82, 0x73, 0xdb, 0x1e, 0x5c, 0xb3, 0x22, 0xf5, - 0xa7, 0xe5, 0xf8, 0xbc, 0x21, 0xf7, 0x33, 0x5e, 0xbd, 0x7c, 0x9d, 0x9e, 0x4c, 0x99, 0x34, 0x85, - 0xeb, 0xdb, 0x25, 0xe0, 0xa2, 0xfc, 0x01, 0x5e, 0x9a, 0xf4, 0xd3, 0xee, 0x5f, 0xcc, 0x35, 0x01, - 0xab, 0x6f, 0x4e, 0x85, 0xe5, 0xc5, 0x76, 0xf7, 0x7e, 0x0e, 0x3d, 0x74, 0x3a, 0xf4, 0xd0, 0xef, - 0xa1, 0x87, 0xbe, 0x8f, 0x3c, 0xe7, 0x74, 0xe4, 0x39, 0xbf, 0x46, 0x9e, 0xf3, 0xfe, 0x31, 0xef, - 0xe8, 0xf6, 0xe1, 0x7e, 0xd0, 0x14, 0xdd, 0xf0, 0x2d, 0xb0, 0xee, 0xe6, 0x6b, 0x7b, 0x82, 0x9a, - 0x42, 0x42, 0x38, 0x28, 0x2e, 0xd1, 0x71, 0x1f, 0xd4, 0xfe, 0x9c, 0x39, 0x34, 0xdb, 0xff, 0x03, - 0x00, 0x00, 0xff, 0xff, 0xe7, 0xd7, 0x8e, 0xe4, 0xa7, 0x04, 0x00, 0x00, + // 426 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0xcb, 0x2e, 0xcd, 0xca, + 0x2c, 0x4a, 0xd4, 0xcf, 0x2f, 0x4a, 0x4c, 0xce, 0x49, 0xd5, 0x2f, 0xa9, 0xd0, 0x2b, 0x28, 0xca, + 0x2f, 0xc9, 0x17, 0xe2, 0x85, 0x88, 0xeb, 0x41, 0xc4, 0xa5, 0x44, 0xd2, 0xf3, 0xd3, 0xf3, 0xc1, + 0x32, 0xfa, 0x20, 0x16, 0x44, 0x91, 0x94, 0x78, 0x72, 0x7e, 0x71, 0x6e, 0x7e, 0xb1, 0x7e, 0x6e, + 0x71, 0xba, 0x7e, 0x99, 0x21, 0x88, 0x82, 0x4a, 0x48, 0xa1, 0x9a, 0x0a, 0xa1, 0x20, 0x72, 0x4a, + 0x9d, 0x8c, 0x5c, 0xa2, 0xbe, 0xc5, 0xe9, 0x8e, 0x29, 0x29, 0x41, 0xa9, 0x85, 0xa5, 0x99, 0x45, + 0xa9, 0x29, 0xc1, 0x95, 0xb9, 0x49, 0xf9, 0x39, 0xc5, 0x42, 0x46, 0x5c, 0x9c, 0x89, 0xa5, 0x25, + 0x19, 0xf9, 0x45, 0x99, 0x25, 0x95, 0x12, 0x8c, 0x0a, 0x8c, 0x1a, 0x9c, 0x4e, 0x22, 0x9f, 0xee, + 0xc9, 0x0b, 0x54, 0x26, 0xe6, 0xe6, 0x58, 0x29, 0xc1, 0xa5, 0x94, 0x82, 0x10, 0xca, 0x84, 0x74, + 0xb8, 0xd8, 0x8b, 0x21, 0xda, 0x25, 0x98, 0x14, 0x98, 0x35, 0x38, 0x9d, 0x84, 0x3e, 0xdd, 0x93, + 0xe7, 0x83, 0xe8, 0x80, 0x4a, 0x28, 0x05, 0xc1, 0x94, 0x58, 0xf1, 0x35, 0x3d, 0xdf, 0xa0, 0x85, + 0xd0, 0xad, 0x24, 0xcf, 0x25, 0x8b, 0xd5, 0x29, 0x41, 0xa9, 0xc5, 0x05, 0xf9, 0x79, 0xc5, 0xa9, + 0x4a, 0x3d, 0x8c, 0x5c, 0x12, 0xbe, 0xc5, 0xe9, 0x41, 0xa9, 0xb9, 0xf9, 0x65, 0xa9, 0x03, 0xef, + 0x5e, 0x25, 0x2e, 0x05, 0x5c, 0xae, 0x81, 0x3b, 0x79, 0x3a, 0x23, 0x17, 0xbf, 0x6f, 0x71, 0x7a, + 0x68, 0x41, 0x4a, 0x62, 0x49, 0x6a, 0x40, 0x62, 0x51, 0x62, 0x2e, 0x79, 0x2e, 0x75, 0xe0, 0x62, + 0x2b, 0x00, 0xeb, 0x96, 0x60, 0x52, 0x60, 0xd4, 0xe0, 0x36, 0x12, 0xd5, 0x43, 0x49, 0x12, 0x7a, + 0x10, 0xa3, 0x9d, 0x04, 0x3f, 0xdd, 0x93, 0xe7, 0x85, 0x98, 0x03, 0x51, 0xae, 0x14, 0x04, 0xd5, + 0x87, 0xe1, 0x7a, 0x49, 0x2e, 0x71, 0x34, 0x87, 0xc1, 0x1c, 0x6d, 0xb4, 0x8b, 0x89, 0x8b, 0xd9, + 0xb7, 0x38, 0x5d, 0x28, 0x83, 0x4b, 0x08, 0x4b, 0xc2, 0x50, 0x41, 0xb3, 0x1a, 0x6b, 0x9c, 0x49, + 0xe9, 0x10, 0xa3, 0x0a, 0x66, 0xa3, 0x50, 0x21, 0x97, 0x28, 0xf6, 0x58, 0x55, 0xc7, 0x34, 0x06, + 0xab, 0x42, 0x29, 0x7d, 0x22, 0x15, 0xc2, 0xad, 0x0c, 0xe3, 0xe2, 0x41, 0x89, 0x15, 0x39, 0x4c, + 0x03, 0x90, 0xe5, 0xa5, 0xd4, 0xf0, 0xcb, 0xc3, 0xcc, 0x75, 0x72, 0x39, 0xf1, 0x48, 0x8e, 0xf1, + 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, + 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xad, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, + 0x5c, 0xfd, 0x90, 0xd4, 0xc4, 0x5c, 0x5d, 0x6f, 0x48, 0xbe, 0x4c, 0xce, 0x2f, 0x4a, 0xd5, 0xaf, + 0x80, 0x67, 0xfa, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0x70, 0xf6, 0x34, 0x06, 0x04, 0x00, 0x00, + 0xff, 0xff, 0x41, 0x98, 0xb8, 0x5b, 0x12, 0x04, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -322,14 +352,12 @@ 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 { - // AggregateExchangeRatePrevote defines a method for submitting - // aggregate exchange rate prevote - AggregateExchangeRatePrevote(ctx context.Context, in *MsgAggregateExchangeRatePrevote, opts ...grpc.CallOption) (*MsgAggregateExchangeRatePrevoteResponse, error) - // AggregateExchangeRateVote defines a method for submitting - // aggregate exchange rate vote - AggregateExchangeRateVote(ctx context.Context, in *MsgAggregateExchangeRateVote, opts ...grpc.CallOption) (*MsgAggregateExchangeRateVoteResponse, error) - // DelegateFeedConsent defines a method for setting the feeder delegation - DelegateFeedConsent(ctx context.Context, in *MsgDelegateFeedConsent, opts ...grpc.CallOption) (*MsgDelegateFeedConsentResponse, error) + // AddRequiredSymbol adds a new price to the required list of prices + AddRequiredSymbols(ctx context.Context, in *MsgAddRequiredSymbols, opts ...grpc.CallOption) (*MsgAddRequiredSymbolsResponse, error) + // RemoveRequiredSymbol removes a price from the required list of prices + RemoveRequiredSymbols(ctx context.Context, in *MsgRemoveRequiredSymbols, opts ...grpc.CallOption) (*MsgRemoveRequiredSymbolsResponse, error) + // UpdateParams sets new module params + UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) } type msgClient struct { @@ -340,27 +368,27 @@ func NewMsgClient(cc grpc1.ClientConn) MsgClient { return &msgClient{cc} } -func (c *msgClient) AggregateExchangeRatePrevote(ctx context.Context, in *MsgAggregateExchangeRatePrevote, opts ...grpc.CallOption) (*MsgAggregateExchangeRatePrevoteResponse, error) { - out := new(MsgAggregateExchangeRatePrevoteResponse) - err := c.cc.Invoke(ctx, "/kujira.oracle.Msg/AggregateExchangeRatePrevote", in, out, opts...) +func (c *msgClient) AddRequiredSymbols(ctx context.Context, in *MsgAddRequiredSymbols, opts ...grpc.CallOption) (*MsgAddRequiredSymbolsResponse, error) { + out := new(MsgAddRequiredSymbolsResponse) + err := c.cc.Invoke(ctx, "/kujira.oracle.Msg/AddRequiredSymbols", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) AggregateExchangeRateVote(ctx context.Context, in *MsgAggregateExchangeRateVote, opts ...grpc.CallOption) (*MsgAggregateExchangeRateVoteResponse, error) { - out := new(MsgAggregateExchangeRateVoteResponse) - err := c.cc.Invoke(ctx, "/kujira.oracle.Msg/AggregateExchangeRateVote", in, out, opts...) +func (c *msgClient) RemoveRequiredSymbols(ctx context.Context, in *MsgRemoveRequiredSymbols, opts ...grpc.CallOption) (*MsgRemoveRequiredSymbolsResponse, error) { + out := new(MsgRemoveRequiredSymbolsResponse) + err := c.cc.Invoke(ctx, "/kujira.oracle.Msg/RemoveRequiredSymbols", in, out, opts...) if err != nil { return nil, err } return out, nil } -func (c *msgClient) DelegateFeedConsent(ctx context.Context, in *MsgDelegateFeedConsent, opts ...grpc.CallOption) (*MsgDelegateFeedConsentResponse, error) { - out := new(MsgDelegateFeedConsentResponse) - err := c.cc.Invoke(ctx, "/kujira.oracle.Msg/DelegateFeedConsent", in, out, opts...) +func (c *msgClient) UpdateParams(ctx context.Context, in *MsgUpdateParams, opts ...grpc.CallOption) (*MsgUpdateParamsResponse, error) { + out := new(MsgUpdateParamsResponse) + err := c.cc.Invoke(ctx, "/kujira.oracle.Msg/UpdateParams", in, out, opts...) if err != nil { return nil, err } @@ -369,84 +397,82 @@ func (c *msgClient) DelegateFeedConsent(ctx context.Context, in *MsgDelegateFeed // MsgServer is the server API for Msg service. type MsgServer interface { - // AggregateExchangeRatePrevote defines a method for submitting - // aggregate exchange rate prevote - AggregateExchangeRatePrevote(context.Context, *MsgAggregateExchangeRatePrevote) (*MsgAggregateExchangeRatePrevoteResponse, error) - // AggregateExchangeRateVote defines a method for submitting - // aggregate exchange rate vote - AggregateExchangeRateVote(context.Context, *MsgAggregateExchangeRateVote) (*MsgAggregateExchangeRateVoteResponse, error) - // DelegateFeedConsent defines a method for setting the feeder delegation - DelegateFeedConsent(context.Context, *MsgDelegateFeedConsent) (*MsgDelegateFeedConsentResponse, error) + // AddRequiredSymbol adds a new price to the required list of prices + AddRequiredSymbols(context.Context, *MsgAddRequiredSymbols) (*MsgAddRequiredSymbolsResponse, error) + // RemoveRequiredSymbol removes a price from the required list of prices + RemoveRequiredSymbols(context.Context, *MsgRemoveRequiredSymbols) (*MsgRemoveRequiredSymbolsResponse, error) + // UpdateParams sets new module params + UpdateParams(context.Context, *MsgUpdateParams) (*MsgUpdateParamsResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. type UnimplementedMsgServer struct { } -func (*UnimplementedMsgServer) AggregateExchangeRatePrevote(ctx context.Context, req *MsgAggregateExchangeRatePrevote) (*MsgAggregateExchangeRatePrevoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AggregateExchangeRatePrevote not implemented") +func (*UnimplementedMsgServer) AddRequiredSymbols(ctx context.Context, req *MsgAddRequiredSymbols) (*MsgAddRequiredSymbolsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method AddRequiredSymbols not implemented") } -func (*UnimplementedMsgServer) AggregateExchangeRateVote(ctx context.Context, req *MsgAggregateExchangeRateVote) (*MsgAggregateExchangeRateVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AggregateExchangeRateVote not implemented") +func (*UnimplementedMsgServer) RemoveRequiredSymbols(ctx context.Context, req *MsgRemoveRequiredSymbols) (*MsgRemoveRequiredSymbolsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method RemoveRequiredSymbols not implemented") } -func (*UnimplementedMsgServer) DelegateFeedConsent(ctx context.Context, req *MsgDelegateFeedConsent) (*MsgDelegateFeedConsentResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method DelegateFeedConsent not implemented") +func (*UnimplementedMsgServer) UpdateParams(ctx context.Context, req *MsgUpdateParams) (*MsgUpdateParamsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateParams not implemented") } func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) } -func _Msg_AggregateExchangeRatePrevote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAggregateExchangeRatePrevote) +func _Msg_AddRequiredSymbols_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgAddRequiredSymbols) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).AggregateExchangeRatePrevote(ctx, in) + return srv.(MsgServer).AddRequiredSymbols(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/kujira.oracle.Msg/AggregateExchangeRatePrevote", + FullMethod: "/kujira.oracle.Msg/AddRequiredSymbols", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AggregateExchangeRatePrevote(ctx, req.(*MsgAggregateExchangeRatePrevote)) + return srv.(MsgServer).AddRequiredSymbols(ctx, req.(*MsgAddRequiredSymbols)) } return interceptor(ctx, in, info, handler) } -func _Msg_AggregateExchangeRateVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAggregateExchangeRateVote) +func _Msg_RemoveRequiredSymbols_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgRemoveRequiredSymbols) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).AggregateExchangeRateVote(ctx, in) + return srv.(MsgServer).RemoveRequiredSymbols(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/kujira.oracle.Msg/AggregateExchangeRateVote", + FullMethod: "/kujira.oracle.Msg/RemoveRequiredSymbols", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AggregateExchangeRateVote(ctx, req.(*MsgAggregateExchangeRateVote)) + return srv.(MsgServer).RemoveRequiredSymbols(ctx, req.(*MsgRemoveRequiredSymbols)) } return interceptor(ctx, in, info, handler) } -func _Msg_DelegateFeedConsent_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgDelegateFeedConsent) +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).DelegateFeedConsent(ctx, in) + return srv.(MsgServer).UpdateParams(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/kujira.oracle.Msg/DelegateFeedConsent", + FullMethod: "/kujira.oracle.Msg/UpdateParams", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).DelegateFeedConsent(ctx, req.(*MsgDelegateFeedConsent)) + return srv.(MsgServer).UpdateParams(ctx, req.(*MsgUpdateParams)) } return interceptor(ctx, in, info, handler) } @@ -456,23 +482,23 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ HandlerType: (*MsgServer)(nil), Methods: []grpc.MethodDesc{ { - MethodName: "AggregateExchangeRatePrevote", - Handler: _Msg_AggregateExchangeRatePrevote_Handler, + MethodName: "AddRequiredSymbols", + Handler: _Msg_AddRequiredSymbols_Handler, }, { - MethodName: "AggregateExchangeRateVote", - Handler: _Msg_AggregateExchangeRateVote_Handler, + MethodName: "RemoveRequiredSymbols", + Handler: _Msg_RemoveRequiredSymbols_Handler, }, { - MethodName: "DelegateFeedConsent", - Handler: _Msg_DelegateFeedConsent_Handler, + MethodName: "UpdateParams", + Handler: _Msg_UpdateParams_Handler, }, }, Streams: []grpc.StreamDesc{}, Metadata: "kujira/oracle/tx.proto", } -func (m *MsgAggregateExchangeRatePrevote) Marshal() (dAtA []byte, err error) { +func (m *MsgAddRequiredSymbols) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -482,41 +508,36 @@ func (m *MsgAggregateExchangeRatePrevote) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgAggregateExchangeRatePrevote) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgAddRequiredSymbols) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgAggregateExchangeRatePrevote) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgAddRequiredSymbols) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Validator) > 0 { - i -= len(m.Validator) - copy(dAtA[i:], m.Validator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Validator))) - i-- - dAtA[i] = 0x1a - } - if len(m.Feeder) > 0 { - i -= len(m.Feeder) - copy(dAtA[i:], m.Feeder) - i = encodeVarintTx(dAtA, i, uint64(len(m.Feeder))) - i-- - dAtA[i] = 0x12 + if len(m.Symbols) > 0 { + for iNdEx := len(m.Symbols) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Symbols[iNdEx]) + copy(dAtA[i:], m.Symbols[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Symbols[iNdEx]))) + i-- + dAtA[i] = 0x12 + } } - if len(m.Hash) > 0 { - i -= len(m.Hash) - copy(dAtA[i:], m.Hash) - i = encodeVarintTx(dAtA, i, uint64(len(m.Hash))) + 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 *MsgAggregateExchangeRatePrevoteResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgAddRequiredSymbolsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -526,12 +547,12 @@ func (m *MsgAggregateExchangeRatePrevoteResponse) Marshal() (dAtA []byte, err er return dAtA[:n], nil } -func (m *MsgAggregateExchangeRatePrevoteResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgAddRequiredSymbolsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgAggregateExchangeRatePrevoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgAddRequiredSymbolsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -539,7 +560,7 @@ func (m *MsgAggregateExchangeRatePrevoteResponse) MarshalToSizedBuffer(dAtA []by return len(dAtA) - i, nil } -func (m *MsgAggregateExchangeRateVote) Marshal() (dAtA []byte, err error) { +func (m *MsgRemoveRequiredSymbols) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -549,48 +570,36 @@ func (m *MsgAggregateExchangeRateVote) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgAggregateExchangeRateVote) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRemoveRequiredSymbols) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgAggregateExchangeRateVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRemoveRequiredSymbols) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Validator) > 0 { - i -= len(m.Validator) - copy(dAtA[i:], m.Validator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Validator))) - i-- - dAtA[i] = 0x22 - } - if len(m.Feeder) > 0 { - i -= len(m.Feeder) - copy(dAtA[i:], m.Feeder) - i = encodeVarintTx(dAtA, i, uint64(len(m.Feeder))) - i-- - dAtA[i] = 0x1a - } - if len(m.ExchangeRates) > 0 { - i -= len(m.ExchangeRates) - copy(dAtA[i:], m.ExchangeRates) - i = encodeVarintTx(dAtA, i, uint64(len(m.ExchangeRates))) - i-- - dAtA[i] = 0x12 + if len(m.Symbols) > 0 { + for iNdEx := len(m.Symbols) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.Symbols[iNdEx]) + copy(dAtA[i:], m.Symbols[iNdEx]) + i = encodeVarintTx(dAtA, i, uint64(len(m.Symbols[iNdEx]))) + i-- + dAtA[i] = 0x12 + } } - if len(m.Salt) > 0 { - i -= len(m.Salt) - copy(dAtA[i:], m.Salt) - i = encodeVarintTx(dAtA, i, uint64(len(m.Salt))) + 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 *MsgAggregateExchangeRateVoteResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgRemoveRequiredSymbolsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -600,12 +609,12 @@ func (m *MsgAggregateExchangeRateVoteResponse) Marshal() (dAtA []byte, err error return dAtA[:n], nil } -func (m *MsgAggregateExchangeRateVoteResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgRemoveRequiredSymbolsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgAggregateExchangeRateVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgRemoveRequiredSymbolsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -613,7 +622,7 @@ func (m *MsgAggregateExchangeRateVoteResponse) MarshalToSizedBuffer(dAtA []byte) return len(dAtA) - i, nil } -func (m *MsgDelegateFeedConsent) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -623,34 +632,39 @@ func (m *MsgDelegateFeedConsent) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDelegateFeedConsent) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParams) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDelegateFeedConsent) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int _ = l - if len(m.Delegate) > 0 { - i -= len(m.Delegate) - copy(dAtA[i:], m.Delegate) - i = encodeVarintTx(dAtA, i, uint64(len(m.Delegate))) + if m.Params != nil { + { + 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.Operator) > 0 { - i -= len(m.Operator) - copy(dAtA[i:], m.Operator) - i = encodeVarintTx(dAtA, i, uint64(len(m.Operator))) + 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 *MsgDelegateFeedConsentResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgUpdateParamsResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -660,12 +674,12 @@ func (m *MsgDelegateFeedConsentResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgDelegateFeedConsentResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgDelegateFeedConsentResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgUpdateParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -684,28 +698,26 @@ func encodeVarintTx(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *MsgAggregateExchangeRatePrevote) Size() (n int) { +func (m *MsgAddRequiredSymbols) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Hash) + l = len(m.Authority) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Feeder) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Validator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.Symbols) > 0 { + for _, s := range m.Symbols { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } } return n } -func (m *MsgAggregateExchangeRatePrevoteResponse) Size() (n int) { +func (m *MsgAddRequiredSymbolsResponse) Size() (n int) { if m == nil { return 0 } @@ -714,32 +726,26 @@ func (m *MsgAggregateExchangeRatePrevoteResponse) Size() (n int) { return n } -func (m *MsgAggregateExchangeRateVote) Size() (n int) { +func (m *MsgRemoveRequiredSymbols) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Salt) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.ExchangeRates) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) - } - l = len(m.Feeder) + l = len(m.Authority) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Validator) - if l > 0 { - n += 1 + l + sovTx(uint64(l)) + if len(m.Symbols) > 0 { + for _, s := range m.Symbols { + l = len(s) + n += 1 + l + sovTx(uint64(l)) + } } return n } -func (m *MsgAggregateExchangeRateVoteResponse) Size() (n int) { +func (m *MsgRemoveRequiredSymbolsResponse) Size() (n int) { if m == nil { return 0 } @@ -748,24 +754,24 @@ func (m *MsgAggregateExchangeRateVoteResponse) Size() (n int) { return n } -func (m *MsgDelegateFeedConsent) Size() (n int) { +func (m *MsgUpdateParams) Size() (n int) { if m == nil { return 0 } var l int _ = l - l = len(m.Operator) + l = len(m.Authority) if l > 0 { n += 1 + l + sovTx(uint64(l)) } - l = len(m.Delegate) - if l > 0 { + if m.Params != nil { + l = m.Params.Size() n += 1 + l + sovTx(uint64(l)) } return n } -func (m *MsgDelegateFeedConsentResponse) Size() (n int) { +func (m *MsgUpdateParamsResponse) Size() (n int) { if m == nil { return 0 } @@ -780,7 +786,7 @@ func sovTx(x uint64) (n int) { func sozTx(x uint64) (n int) { return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } -func (m *MsgAggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { +func (m *MsgAddRequiredSymbols) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -803,15 +809,15 @@ func (m *MsgAggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAggregateExchangeRatePrevote: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddRequiredSymbols: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAggregateExchangeRatePrevote: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddRequiredSymbols: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -839,43 +845,11 @@ func (m *MsgAggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Hash = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Feeder", 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.Feeder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Symbols", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -903,7 +877,7 @@ func (m *MsgAggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Validator = string(dAtA[iNdEx:postIndex]) + m.Symbols = append(m.Symbols, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -926,7 +900,7 @@ func (m *MsgAggregateExchangeRatePrevote) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAggregateExchangeRatePrevoteResponse) Unmarshal(dAtA []byte) error { +func (m *MsgAddRequiredSymbolsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -949,10 +923,10 @@ func (m *MsgAggregateExchangeRatePrevoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAggregateExchangeRatePrevoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgAddRequiredSymbolsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAggregateExchangeRatePrevoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgAddRequiredSymbolsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -976,7 +950,7 @@ func (m *MsgAggregateExchangeRatePrevoteResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAggregateExchangeRateVote) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveRequiredSymbols) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -999,15 +973,15 @@ func (m *MsgAggregateExchangeRateVote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAggregateExchangeRateVote: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveRequiredSymbols: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAggregateExchangeRateVote: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveRequiredSymbols: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Salt", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1035,43 +1009,11 @@ func (m *MsgAggregateExchangeRateVote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Salt = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ExchangeRates", 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.ExchangeRates = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Feeder", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Symbols", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1099,39 +1041,7 @@ func (m *MsgAggregateExchangeRateVote) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Feeder = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Validator", 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.Validator = string(dAtA[iNdEx:postIndex]) + m.Symbols = append(m.Symbols, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex default: iNdEx = preIndex @@ -1154,7 +1064,7 @@ func (m *MsgAggregateExchangeRateVote) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAggregateExchangeRateVoteResponse) Unmarshal(dAtA []byte) error { +func (m *MsgRemoveRequiredSymbolsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1177,10 +1087,10 @@ func (m *MsgAggregateExchangeRateVoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAggregateExchangeRateVoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgRemoveRequiredSymbolsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAggregateExchangeRateVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgRemoveRequiredSymbolsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: @@ -1204,7 +1114,7 @@ func (m *MsgAggregateExchangeRateVoteResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDelegateFeedConsent) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParams) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1227,15 +1137,15 @@ func (m *MsgDelegateFeedConsent) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDelegateFeedConsent: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParams: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegateFeedConsent: illegal tag %d (wire type %d)", fieldNum, wire) + 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 Operator", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Authority", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -1263,13 +1173,13 @@ func (m *MsgDelegateFeedConsent) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Operator = string(dAtA[iNdEx:postIndex]) + m.Authority = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Delegate", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) } - var stringLen uint64 + var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowTx @@ -1279,23 +1189,27 @@ func (m *MsgDelegateFeedConsent) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - stringLen |= uint64(b&0x7F) << shift + msglen |= int(b&0x7F) << shift if b < 0x80 { break } } - intStringLen := int(stringLen) - if intStringLen < 0 { + if msglen < 0 { return ErrInvalidLengthTx } - postIndex := iNdEx + intStringLen + postIndex := iNdEx + msglen if postIndex < 0 { return ErrInvalidLengthTx } if postIndex > l { return io.ErrUnexpectedEOF } - m.Delegate = string(dAtA[iNdEx:postIndex]) + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } iNdEx = postIndex default: iNdEx = preIndex @@ -1318,7 +1232,7 @@ func (m *MsgDelegateFeedConsent) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgDelegateFeedConsentResponse) Unmarshal(dAtA []byte) error { +func (m *MsgUpdateParamsResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -1341,10 +1255,10 @@ func (m *MsgDelegateFeedConsentResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgDelegateFeedConsentResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgUpdateParamsResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgDelegateFeedConsentResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgUpdateParamsResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/x/oracle/types/vote.go b/x/oracle/types/vote.go index 6e4bdf36..e1c9910b 100644 --- a/x/oracle/types/vote.go +++ b/x/oracle/types/vote.go @@ -4,42 +4,14 @@ import ( "fmt" "strings" + "cosmossdk.io/math" "gopkg.in/yaml.v2" sdk "github.com/cosmos/cosmos-sdk/types" ) -// NewAggregateExchangeRatePrevote returns AggregateExchangeRatePrevote object -func NewAggregateExchangeRatePrevote(hash AggregateVoteHash, voter sdk.ValAddress, submitBlock uint64) AggregateExchangeRatePrevote { - return AggregateExchangeRatePrevote{ - Hash: hash.String(), - Voter: voter.String(), - SubmitBlock: submitBlock, - } -} - -// String implement stringify -func (v AggregateExchangeRatePrevote) String() string { - out, _ := yaml.Marshal(v) - return string(out) -} - -// NewAggregateExchangeRateVote creates a AggregateExchangeRateVote instance -func NewAggregateExchangeRateVote(exchangeRateTuples ExchangeRateTuples, voter sdk.ValAddress) AggregateExchangeRateVote { - return AggregateExchangeRateVote{ - ExchangeRateTuples: exchangeRateTuples, - Voter: voter.String(), - } -} - -// String implement stringify -func (v AggregateExchangeRateVote) String() string { - out, _ := yaml.Marshal(v) - return string(out) -} - // NewExchangeRateTuple creates a ExchangeRateTuple instance -func NewExchangeRateTuple(denom string, exchangeRate sdk.Dec) ExchangeRateTuple { +func NewExchangeRateTuple(denom string, exchangeRate math.LegacyDec) ExchangeRateTuple { return ExchangeRateTuple{ denom, exchangeRate, @@ -78,7 +50,7 @@ func ParseExchangeRateTuples(tuplesStr string) (ExchangeRateTuples, error) { } tuples[i] = ExchangeRateTuple{ - Denom: decCoin.Denom, + Symbol: decCoin.Denom, ExchangeRate: decCoin.Amount, } diff --git a/x/oracle/wasm/interface.go b/x/oracle/wasm/interface.go index d86219bb..5f816666 100644 --- a/x/oracle/wasm/interface.go +++ b/x/oracle/wasm/interface.go @@ -3,7 +3,7 @@ package wasm import ( sdk "github.com/cosmos/cosmos-sdk/types" - wasmvmtypes "github.com/CosmWasm/wasmvm/types" + wasmvmtypes "github.com/CosmWasm/wasmvm/v2/types" "github.com/Team-Kujira/core/x/oracle/keeper" ) diff --git a/x/scheduler/client/cli/tx_hook.go b/x/scheduler/client/cli/tx_hook.go deleted file mode 100644 index 3dc2ebb7..00000000 --- a/x/scheduler/client/cli/tx_hook.go +++ /dev/null @@ -1,224 +0,0 @@ -package cli - -import ( - "fmt" - "strconv" - - "github.com/Team-Kujira/core/x/scheduler/types" - - "github.com/cosmos/cosmos-sdk/client" - "github.com/cosmos/cosmos-sdk/client/tx" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/spf13/cobra" - - wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" - "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -func CreateHookProposalCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "create-hook [contract] [executor] [msg] [frequency] [funds] --title [text] --description [text]", - Short: "Schedule a new smart contract msg hook", - Args: cobra.ExactArgs(5), - RunE: func(cmd *cobra.Command, args []string) (err error) { - argContract := args[0] - argExecutor := args[1] - argMsg := args[2] - argFrequency, err := strconv.ParseInt(args[3], 10, 64) - if err != nil { - return err - } - - argFunds, err := sdk.ParseCoinsNormalized(args[4]) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) - if err != nil { - return fmt.Errorf("proposal title: %s", err) - } - - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) - if err != nil { - return fmt.Errorf("proposal description: %s", err) - } - - depositArg, err := cmd.Flags().GetString(cli.FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositArg) - if err != nil { - return err - } - - content := types.CreateHookProposal{ - Title: proposalTitle, - Description: proposalDescr, - Contract: argContract, - Executor: argExecutor, - Frequency: argFrequency, - Funds: argFunds, - Msg: wasmtypes.RawContractMessage(argMsg), - } - - msg, err := govv1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) - if err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") - cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") - return cmd -} - -func UpdateHookProposalCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "update-hook [id] [contract] [executor] [msg] [frequency] [funds]", - Short: "Update an existing smart contract msg hook", - Args: cobra.ExactArgs(6), - RunE: func(cmd *cobra.Command, args []string) (err error) { - id, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return err - } - - argContract := args[1] - - argExecutor := args[2] - - argMsg := args[3] - - argFrequency, err := strconv.ParseInt(args[4], 10, 64) - if err != nil { - return err - } - - argFunds, err := sdk.ParseCoinsNormalized(args[5]) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) - if err != nil { - return fmt.Errorf("proposal title: %s", err) - } - - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) - if err != nil { - return fmt.Errorf("proposal description: %s", err) - } - - depositArg, err := cmd.Flags().GetString(cli.FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositArg) - if err != nil { - return err - } - - content := types.UpdateHookProposal{ - Title: proposalTitle, - Description: proposalDescr, - Id: id, - Contract: argContract, - Executor: argExecutor, - Frequency: argFrequency, - Funds: argFunds, - Msg: wasmtypes.RawContractMessage(argMsg), - } - - msg, err := govv1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) - if err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") - cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") - return cmd -} - -func DeleteHookProposalCmd() *cobra.Command { - cmd := &cobra.Command{ - Use: "delete-hook [id]", - Short: "Delete a scheduled hook by id", - Args: cobra.ExactArgs(1), - RunE: func(cmd *cobra.Command, args []string) error { - id, err := strconv.ParseUint(args[0], 10, 64) - if err != nil { - return err - } - - clientCtx, err := client.GetClientTxContext(cmd) - if err != nil { - return err - } - - proposalTitle, err := cmd.Flags().GetString(cli.FlagTitle) - if err != nil { - return fmt.Errorf("proposal title: %s", err) - } - - proposalDescr, err := cmd.Flags().GetString(cli.FlagDescription) - if err != nil { - return fmt.Errorf("proposal description: %s", err) - } - - depositArg, err := cmd.Flags().GetString(cli.FlagDeposit) - if err != nil { - return err - } - - deposit, err := sdk.ParseCoinsNormalized(depositArg) - if err != nil { - return err - } - - content := types.DeleteHookProposal{ - Title: proposalTitle, - Description: proposalDescr, - Id: id, - } - - msg, err := govv1beta1.NewMsgSubmitProposal(&content, deposit, clientCtx.GetFromAddress()) - if err != nil { - return err - } - return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) - }, - } - cmd.Flags().String(cli.FlagTitle, "", "Title of proposal") - - cmd.Flags().String(cli.FlagDescription, "", "Description of proposal") - cmd.Flags().String(cli.FlagDeposit, "", "Deposit of proposal") - - cmd.Flags().String(cli.FlagProposal, "", "Proposal file path (if this path is given, other proposal flags are ignored)") - return cmd -} diff --git a/x/scheduler/client/cli/tx_hook_test.go b/x/scheduler/client/cli/tx_hook_test.go deleted file mode 100644 index 8cf3cc9f..00000000 --- a/x/scheduler/client/cli/tx_hook_test.go +++ /dev/null @@ -1,69 +0,0 @@ -package cli_test - -/* - -import ( - "fmt" - "testing" - - "github.com/cosmos/cosmos-sdk/client/flags" - clitestutil "github.com/cosmos/cosmos-sdk/testutil/cli" - govcli "github.com/cosmos/cosmos-sdk/x/gov/client/cli" - - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" - - "github.com/Team-Kujira/core/testutil/network" - "github.com/Team-Kujira/core/x/scheduler/client/cli" -) - -func TestCreateHook(t *testing.T) { - net := network.New(t) - val := net.Validators[0] - ctx := val.ClientCtx - - fields := []string{ - "kujira14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sl4e867", - "kujira14hj2tavq8fpesdwxxcu44rty3hh90vhujrvcmstl4zr3txmfvw9sl4e867", - "'{}'", - "2", - "100ukuji", - } - for _, tc := range []struct { - desc string - args []string - err error - code uint32 - }{ - { - desc: "valid", - args: []string{ - fmt.Sprintf("--%s=%s", govcli.FlagTitle, "Title"), - fmt.Sprintf("--%s=%s", govcli.FlagDescription, "Description"), - fmt.Sprintf("--%s=%s", flags.FlagFrom, val.Address.String()), - fmt.Sprintf("--%s=true", flags.FlagSkipConfirmation), - fmt.Sprintf("--%s=%s", flags.FlagBroadcastMode, flags.BroadcastBlock), - fmt.Sprintf("--%s=%s", flags.FlagFees, sdk.NewCoins(sdk.NewCoin(net.Config.BondDenom, sdk.NewInt(10))).String()), - }, - }, - } { - tc := tc - t.Run(tc.desc, func(t *testing.T) { - args := []string{} - args = append(args, fields...) - args = append(args, tc.args...) - - out, err := clitestutil.ExecTestCLICmd(ctx, cli.CreateHookProposalCmd(), args) - if tc.err != nil { - require.ErrorIs(t, err, tc.err) - } else { - require.NoError(t, err) - var resp sdk.TxResponse - require.NoError(t, ctx.Codec.UnmarshalJSON(out.Bytes(), &resp)) - require.Equal(t, tc.code, resp.Code) - } - }) - } -} - -*/ diff --git a/x/scheduler/client/proposal_handler.go b/x/scheduler/client/proposal_handler.go deleted file mode 100644 index f40c3e5c..00000000 --- a/x/scheduler/client/proposal_handler.go +++ /dev/null @@ -1,14 +0,0 @@ -package client - -import ( - "github.com/Team-Kujira/core/x/scheduler/client/cli" - - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" -) - -// ProposalHandlers define the wasm cli proposal types and rest handler. -var ( - CreateHookProposalHandler = govclient.NewProposalHandler(cli.CreateHookProposalCmd) - UpdateHookProposalHandler = govclient.NewProposalHandler(cli.UpdateHookProposalCmd) - DeleteHookProposalHandler = govclient.NewProposalHandler(cli.DeleteHookProposalCmd) -) diff --git a/x/scheduler/genesis.go b/x/scheduler/genesis.go index d599e507..bf1ff665 100644 --- a/x/scheduler/genesis.go +++ b/x/scheduler/genesis.go @@ -16,13 +16,12 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) // Set hook count k.SetHookCount(ctx, genState.HookCount) - k.SetParams(ctx, genState.Params) } // ExportGenesis returns the capability module's exported genesis. func ExportGenesis(ctx sdk.Context, k keeper.Keeper) *types.GenesisState { genesis := types.DefaultGenesis() - genesis.Params = k.GetParams(ctx) + genesis.Params = types.Params{} genesis.HookList = k.GetAllHook(ctx) genesis.HookCount = k.GetHookCount(ctx) diff --git a/x/scheduler/genesis_test.go b/x/scheduler/genesis_test.go index d4ce66c3..2b4da71e 100644 --- a/x/scheduler/genesis_test.go +++ b/x/scheduler/genesis_test.go @@ -1,12 +1,10 @@ package scheduler_test -/* import ( "testing" - keepertest "github.com/Team-Kujira/core/testutil/keeper" - "github.com/Team-Kujira/core/testutil/nullify" "github.com/Team-Kujira/core/x/scheduler" + "github.com/Team-Kujira/core/x/scheduler/keeper" "github.com/Team-Kujira/core/x/scheduler/types" "github.com/stretchr/testify/require" ) @@ -26,15 +24,11 @@ func TestGenesis(t *testing.T) { HookCount: 2, } - k, ctx := keepertest.SchedulerKeeper(t) - scheduler.InitGenesis(ctx, *k, genesisState) - got := scheduler.ExportGenesis(ctx, *k) + k, ctx := keeper.CreateTestKeeper(t) + scheduler.InitGenesis(ctx, k, genesisState) + got := scheduler.ExportGenesis(ctx, k) require.NotNil(t, got) - nullify.Fill(&genesisState) - nullify.Fill(got) - require.ElementsMatch(t, genesisState.HookList, got.HookList) require.Equal(t, genesisState.HookCount, got.HookCount) } -*/ diff --git a/x/scheduler/keeper/abci.go b/x/scheduler/keeper/abci.go new file mode 100644 index 00000000..8ff3badb --- /dev/null +++ b/x/scheduler/keeper/abci.go @@ -0,0 +1,27 @@ +package keeper + +import ( + "fmt" + + "github.com/Team-Kujira/core/x/scheduler/types" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// EndBlocker called at every block, update validator set +func (k *Keeper) EndBlocker(ctx sdk.Context, wasmKeeper types.WasmKeeper) error { + hooks := k.GetAllHook(ctx) + block := ctx.BlockHeight() + for _, hook := range hooks { + if hook.Frequency == 0 || block%hook.Frequency == 0 { + k.Logger(ctx).Info(fmt.Sprintf("scheduled hook %d: %s %s", hook.Id, hook.Contract, string(hook.Msg))) + // These have been validated already in types/proposal.go + contract, _ := sdk.AccAddressFromBech32(hook.Contract) + executor, _ := sdk.AccAddressFromBech32(hook.Executor) + _, err := wasmKeeper.Execute(ctx, contract, executor, []byte(hook.Msg), hook.Funds) + if err != nil { + k.Logger(ctx).Error(err.Error()) + } + } + } + return nil +} diff --git a/x/scheduler/keeper/grpc_query.go b/x/scheduler/keeper/grpc_query.go index 74a7556b..0f585501 100644 --- a/x/scheduler/keeper/grpc_query.go +++ b/x/scheduler/keeper/grpc_query.go @@ -1,7 +1,13 @@ package keeper import ( + "context" + "github.com/Team-Kujira/core/x/scheduler/types" ) var _ types.QueryServer = Keeper{} + +func (k Keeper) Params(_ context.Context, _ *types.QueryParamsRequest) (*types.QueryParamsResponse, error) { + return &types.QueryParamsResponse{}, nil +} diff --git a/x/scheduler/keeper/grpc_query_hook.go b/x/scheduler/keeper/grpc_query_hook.go index 4efe4e0a..35c6d427 100644 --- a/x/scheduler/keeper/grpc_query_hook.go +++ b/x/scheduler/keeper/grpc_query_hook.go @@ -3,8 +3,8 @@ package keeper import ( "context" + "cosmossdk.io/store/prefix" "github.com/Team-Kujira/core/x/scheduler/types" - "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/cosmos/cosmos-sdk/types/query" diff --git a/x/scheduler/keeper/grpc_query_params.go b/x/scheduler/keeper/grpc_query_params.go deleted file mode 100644 index b0b8a7fa..00000000 --- a/x/scheduler/keeper/grpc_query_params.go +++ /dev/null @@ -1,19 +0,0 @@ -package keeper - -import ( - "context" - - "github.com/Team-Kujira/core/x/scheduler/types" - sdk "github.com/cosmos/cosmos-sdk/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.GetParams(ctx)}, nil -} diff --git a/x/scheduler/keeper/grpc_query_params_test.go b/x/scheduler/keeper/grpc_query_params_test.go deleted file mode 100644 index f975c464..00000000 --- a/x/scheduler/keeper/grpc_query_params_test.go +++ /dev/null @@ -1,25 +0,0 @@ -package keeper_test - -/* - -import ( - "testing" - - testkeeper "github.com/Team-Kujira/core/testutil/keeper" - "github.com/Team-Kujira/core/x/scheduler/types" - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/stretchr/testify/require" -) - -func TestParamsQuery(t *testing.T) { - keeper, ctx := testkeeper.SchedulerKeeper(t) - wctx := sdk.WrapSDKContext(ctx) - params := types.DefaultParams() - keeper.SetParams(ctx, params) - - response, err := keeper.Params(wctx, &types.QueryParamsRequest{}) - require.NoError(t, err) - require.Equal(t, &types.QueryParamsResponse{Params: params}, response) -} - -*/ diff --git a/x/scheduler/keeper/hook.go b/x/scheduler/keeper/hook.go index a90fe57d..1b122aaf 100644 --- a/x/scheduler/keeper/hook.go +++ b/x/scheduler/keeper/hook.go @@ -5,7 +5,8 @@ import ( "github.com/Team-Kujira/core/x/scheduler/types" - "github.com/cosmos/cosmos-sdk/store/prefix" + "cosmossdk.io/store/prefix" + storetypes "cosmossdk.io/store/types" sdk "github.com/cosmos/cosmos-sdk/types" ) @@ -85,7 +86,7 @@ func (k Keeper) RemoveHook(ctx sdk.Context, id uint64) { // GetAllHook returns all hook func (k Keeper) GetAllHook(ctx sdk.Context) (list []types.Hook) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.HookKey)) - iterator := sdk.KVStorePrefixIterator(store, []byte{}) + iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() diff --git a/x/scheduler/keeper/keeper.go b/x/scheduler/keeper/keeper.go index 3227cc97..9e492a55 100644 --- a/x/scheduler/keeper/keeper.go +++ b/x/scheduler/keeper/keeper.go @@ -3,38 +3,30 @@ package keeper import ( "fmt" - "github.com/cometbft/cometbft/libs/log" - + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" "github.com/Team-Kujira/core/x/scheduler/types" - "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" ) type ( Keeper struct { - cdc codec.BinaryCodec - storeKey storetypes.StoreKey - paramstore paramtypes.Subspace + cdc codec.BinaryCodec + storeKey storetypes.StoreKey + authority string } ) func NewKeeper( cdc codec.BinaryCodec, storeKey storetypes.StoreKey, - ps paramtypes.Subspace, + authority string, ) Keeper { - // set KeyTable if it has not already been set - if !ps.HasKeyTable() { - ps = ps.WithKeyTable(types.ParamKeyTable()) - } - return Keeper{ - cdc: cdc, - storeKey: storeKey, - paramstore: ps, + cdc: cdc, + storeKey: storeKey, + authority: authority, } } diff --git a/x/scheduler/keeper/msg_server.go b/x/scheduler/keeper/msg_server.go new file mode 100644 index 00000000..d5f429ea --- /dev/null +++ b/x/scheduler/keeper/msg_server.go @@ -0,0 +1,110 @@ +package keeper + +import ( + "context" + "fmt" + + "github.com/Team-Kujira/core/x/scheduler/types" + + "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" +) + +type msgServer struct { + Keeper +} + +// NewMsgServerImpl returns an implementation of the scheduler MsgServer interface +// for the provided Keeper. +func NewMsgServerImpl(keeper Keeper) types.MsgServer { + return &msgServer{Keeper: keeper} +} + +func (ms msgServer) CreateHook( + goCtx context.Context, + msg *types.MsgCreateHook, +) (*types.MsgCreateHookResponse, error) { + if ms.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, + "invalid authority; expected %s, got %s", + ms.authority, + msg.Authority, + ) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + hook := types.Hook{ + Executor: msg.Executor, + Contract: msg.Contract, + Msg: msg.Msg, + Frequency: msg.Frequency, + Funds: msg.Funds, + } + + ms.AppendHook(ctx, hook) + + return &types.MsgCreateHookResponse{}, nil +} + +func (ms msgServer) UpdateHook( + goCtx context.Context, + msg *types.MsgUpdateHook, +) (*types.MsgUpdateHookResponse, error) { + if ms.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, + "invalid authority; expected %s, got %s", + ms.authority, + msg.Authority, + ) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + hook := types.Hook{ + Executor: msg.Executor, + Contract: msg.Contract, + Msg: msg.Msg, + Frequency: msg.Frequency, + Funds: msg.Funds, + } + + // Checks that the element exists + _, found := ms.GetHook(ctx, msg.Id) + if !found { + return nil, errors.Wrap( + sdkerrors.ErrKeyNotFound, + fmt.Sprintf("key %d doesn't exist", msg.Id), + ) + } + + ms.SetHook(ctx, hook) + + return &types.MsgUpdateHookResponse{}, nil +} + +func (ms msgServer) DeleteHook( + goCtx context.Context, + msg *types.MsgDeleteHook, +) (*types.MsgDeleteHookResponse, error) { + if ms.authority != msg.Authority { + return nil, errors.Wrapf(govtypes.ErrInvalidSigner, + "invalid authority; expected %s, got %s", + ms.authority, + msg.Authority, + ) + } + + ctx := sdk.UnwrapSDKContext(goCtx) + _, found := ms.GetHook(ctx, msg.Id) + if !found { + return nil, errors.Wrap( + sdkerrors.ErrKeyNotFound, + fmt.Sprintf("key %d doesn't exist", msg.Id), + ) + } + + ms.RemoveHook(ctx, msg.Id) + + return &types.MsgDeleteHookResponse{}, nil +} diff --git a/x/scheduler/keeper/msg_server_test.go b/x/scheduler/keeper/msg_server_test.go new file mode 100644 index 00000000..a189943f --- /dev/null +++ b/x/scheduler/keeper/msg_server_test.go @@ -0,0 +1,128 @@ +package keeper + +import ( + "testing" + + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + "github.com/Team-Kujira/core/x/scheduler/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" +) + +func TestCreateHook(t *testing.T) { + keeper, ctx := SetupKeeper(t) + ms := NewMsgServerImpl(keeper) + + authority := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + executor := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh" + contract := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh" + jsonMsg := wasmtypes.RawContractMessage(`{"foo": 123}`) + frequency := int64(1000) + funds := sdk.NewCoins(sdk.NewInt64Coin("atom", 100)) + + _, err := ms.CreateHook(ctx, &types.MsgCreateHook{ + Authority: authority, + Executor: executor, + Contract: contract, + Msg: jsonMsg, + Frequency: frequency, + Funds: funds, + }) + require.NoError(t, err) + + authority = "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh" + + _, err = ms.CreateHook(ctx, &types.MsgCreateHook{ + Authority: authority, + Executor: executor, + Contract: contract, + Msg: jsonMsg, + Frequency: frequency, + Funds: funds, + }) + require.Error(t, err) +} + +func TestUpdateHook(t *testing.T) { + keeper, ctx := SetupKeeper(t) + ms := NewMsgServerImpl(keeper) + + authority := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + executor := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh" + contract := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh" + jsonMsg := wasmtypes.RawContractMessage(`{"foo": 123}`) + frequency := int64(1000) + funds := sdk.NewCoins(sdk.NewInt64Coin("atom", 100)) + + hook := types.Hook{ + Executor: executor, + Contract: contract, + Msg: jsonMsg, + Frequency: frequency, + Funds: funds, + } + id := keeper.AppendHook(ctx, hook) + + _, err := ms.UpdateHook(ctx, &types.MsgUpdateHook{ + Authority: authority, + Id: id, + Executor: executor, + Contract: contract, + Msg: jsonMsg, + Frequency: frequency, + Funds: funds, + }) + require.NoError(t, err) + + authority = "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh" + + _, err = ms.UpdateHook(ctx, &types.MsgUpdateHook{ + Authority: authority, + Id: id, + Executor: executor, + Contract: contract, + Msg: jsonMsg, + Frequency: frequency, + Funds: funds, + }) + require.Error(t, err) +} + +func TestDeleteHook(t *testing.T) { + keeper, ctx := SetupKeeper(t) + ms := NewMsgServerImpl(keeper) + + authority := "cosmos10d07y265gmmuvt4z0w9aw880jnsr700j6zn9kn" + executor := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh" + contract := "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh" + jsonMsg := wasmtypes.RawContractMessage(`{"foo": 123}`) + frequency := int64(1000) + funds := sdk.NewCoins(sdk.NewInt64Coin("atom", 100)) + + hook := types.Hook{ + Executor: executor, + Contract: contract, + Msg: jsonMsg, + Frequency: frequency, + Funds: funds, + } + id := keeper.AppendHook(ctx, hook) + + _, err := ms.DeleteHook(ctx, &types.MsgDeleteHook{ + Authority: authority, + Id: id, + }) + require.NoError(t, err) + + authority = "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh" + _, err = ms.DeleteHook(ctx, &types.MsgDeleteHook{ + Authority: authority, + Id: id, + }) + require.Error(t, err) +} + +// Setup the testing environment +func SetupKeeper(t *testing.T) (Keeper, sdk.Context) { + return CreateTestKeeper(t) +} diff --git a/x/scheduler/keeper/params.go b/x/scheduler/keeper/params.go deleted file mode 100644 index f99b12b2..00000000 --- a/x/scheduler/keeper/params.go +++ /dev/null @@ -1,16 +0,0 @@ -package keeper - -import ( - "github.com/Team-Kujira/core/x/scheduler/types" - sdk "github.com/cosmos/cosmos-sdk/types" -) - -// GetParams get all parameters as types.Params -func (k Keeper) GetParams(_ sdk.Context) types.Params { - return types.NewParams() -} - -// SetParams set the params -func (k Keeper) SetParams(ctx sdk.Context, params types.Params) { - k.paramstore.SetParamSet(ctx, ¶ms) -} diff --git a/x/scheduler/keeper/params_test.go b/x/scheduler/keeper/params_test.go deleted file mode 100644 index 202a95c9..00000000 --- a/x/scheduler/keeper/params_test.go +++ /dev/null @@ -1,22 +0,0 @@ -package keeper_test - -/* - -import ( - "testing" - - testkeeper "github.com/Team-Kujira/core/testutil/keeper" - "github.com/Team-Kujira/core/x/scheduler/types" - "github.com/stretchr/testify/require" -) - -func TestGetParams(t *testing.T) { - k, ctx := testkeeper.SchedulerKeeper(t) - params := types.DefaultParams() - - k.SetParams(ctx, params) - - require.EqualValues(t, params, k.GetParams(ctx)) -} - -*/ diff --git a/x/scheduler/keeper/proposal_handler.go b/x/scheduler/keeper/proposal_handler.go deleted file mode 100644 index a982a4de..00000000 --- a/x/scheduler/keeper/proposal_handler.go +++ /dev/null @@ -1,68 +0,0 @@ -package keeper - -import ( - "fmt" - - "github.com/Team-Kujira/core/x/scheduler/types" - - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -// NewSchedulerProposalHandler defines the 02-client proposal handler -func NewSchedulerProposalHandler(k Keeper) govtypes.Handler { - return func(ctx sdk.Context, content govtypes.Content) error { - switch c := content.(type) { - case *types.CreateHookProposal: - - hook := types.Hook{ - Executor: c.Executor, - Contract: c.Contract, - Msg: c.Msg, - Frequency: c.Frequency, - Funds: c.Funds, - } - - k.AppendHook(ctx, hook) - - return nil - - case *types.UpdateHookProposal: - - hook := types.Hook{ - Executor: c.Executor, - Id: c.Id, - Contract: c.Contract, - Msg: c.Msg, - Frequency: c.Frequency, - Funds: c.Funds, - } - - // Checks that the element exists - _, found := k.GetHook(ctx, c.Id) - if !found { - return errorsmod.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("key %d doesn't exist", c.Id)) - } - - k.SetHook(ctx, hook) - - return nil - - case *types.DeleteHookProposal: - - // Checks that the element exists - _, found := k.GetHook(ctx, c.Id) - if !found { - return errorsmod.Wrap(sdkerrors.ErrKeyNotFound, fmt.Sprintf("key %d doesn't exist", c.Id)) - } - - k.RemoveHook(ctx, c.Id) - - return nil - default: - return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized scheduler proposal content type: %T", c) - } - } -} diff --git a/x/scheduler/keeper/test_utils.go b/x/scheduler/keeper/test_utils.go new file mode 100644 index 00000000..f600dc19 --- /dev/null +++ b/x/scheduler/keeper/test_utils.go @@ -0,0 +1,56 @@ +package keeper + +import ( + "testing" + + "cosmossdk.io/log" + "cosmossdk.io/store" + storemetrics "cosmossdk.io/store/metrics" + storetypes "cosmossdk.io/store/types" + "github.com/CosmWasm/wasmd/x/wasm" + "github.com/Team-Kujira/core/x/scheduler/types" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/codec" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/std" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/module" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + "github.com/cosmos/cosmos-sdk/x/bank" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + "github.com/stretchr/testify/require" +) + +var ModuleBasics = module.NewBasicManager( + bank.AppModuleBasic{}, + wasm.AppModuleBasic{}, +) + +// Setup the testing environment +func CreateTestKeeper(t *testing.T) (Keeper, sdk.Context) { + db := dbm.NewMemDB() + logger := log.NewTestLogger(t) + + ms := store.NewCommitMultiStore(db, logger, storemetrics.NewNoOpMetrics()) + key := storetypes.NewKVStoreKey(types.StoreKey) + ms.MountStoreWithDB(key, storetypes.StoreTypeIAVL, db) + require.NoError(t, ms.LoadLatestVersion()) + + amino := codec.NewLegacyAmino() + interfaceRegistry := codectypes.NewInterfaceRegistry() + codec := codec.NewProtoCodec(interfaceRegistry) + authority := authtypes.NewModuleAddress(govtypes.ModuleName).String() + + std.RegisterInterfaces(interfaceRegistry) + std.RegisterLegacyAminoCodec(amino) + + ModuleBasics.RegisterLegacyAminoCodec(amino) + ModuleBasics.RegisterInterfaces(interfaceRegistry) + types.RegisterLegacyAminoCodec(amino) + types.RegisterInterfaces(interfaceRegistry) + + ctx := sdk.NewContext(ms, tmproto.Header{}, false, nil) + keeper := NewKeeper(codec, key, authority) + return keeper, ctx +} diff --git a/x/scheduler/module.go b/x/scheduler/module.go index c916277b..6729f775 100644 --- a/x/scheduler/module.go +++ b/x/scheduler/module.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "cosmossdk.io/core/appmodule" "github.com/gorilla/mux" "github.com/grpc-ecosystem/grpc-gateway/runtime" "github.com/spf13/cobra" @@ -23,8 +24,9 @@ import ( ) var ( - _ module.AppModule = AppModule{} - _ module.AppModuleBasic = AppModuleBasic{} + _ module.AppModule = AppModule{} + _ module.AppModuleBasic = AppModuleBasic{} + _ appmodule.HasEndBlocker = AppModule{} ) // ---------------------------------------------------------------------------- @@ -126,6 +128,12 @@ func (am AppModule) Name() string { return am.AppModuleBasic.Name() } +// IsOnePerModuleType implements the depinject.OnePerModuleType interface. +func (AppModule) IsOnePerModuleType() {} + +// IsAppModule implements the appmodule.AppModule interface. +func (AppModule) IsAppModule() {} + // QuerierRoute returns the capability module's query routing key. func (AppModule) QuerierRoute() string { return types.QuerierRoute } @@ -159,25 +167,9 @@ func (am AppModule) ExportGenesis(ctx sdk.Context, cdc codec.JSONCodec) json.Raw // ConsensusVersion implements ConsensusVersion. func (AppModule) ConsensusVersion() uint64 { return 1 } -// BeginBlock executes all ABCI BeginBlock logic respective to the capability module. -func (am AppModule) BeginBlock(_ sdk.Context, _ abci.RequestBeginBlock) {} - // EndBlock executes all ABCI EndBlock logic respective to the capability module. It // returns no validator updates. -func (am AppModule) EndBlock(ctx sdk.Context, block abci.RequestEndBlock) []abci.ValidatorUpdate { - hooks := am.keeper.GetAllHook(ctx) - for _, hook := range hooks { - if hook.Frequency == 0 || block.Height%hook.Frequency == 0 { - am.keeper.Logger(ctx).Info(fmt.Sprintf("scheduled hook %d: %s %s", hook.Id, hook.Contract, string(hook.Msg))) - // These have been validated already in types/proposal.go - contract, _ := sdk.AccAddressFromBech32(hook.Contract) - executor, _ := sdk.AccAddressFromBech32(hook.Executor) - _, err := am.wasmKeeper.Execute(ctx, contract, executor, []byte(hook.Msg), hook.Funds) - if err != nil { - am.keeper.Logger(ctx).Error(err.Error()) - } - } - } - - return []abci.ValidatorUpdate{} +func (am AppModule) EndBlock(ctx context.Context) error { + sdkCtx := sdk.UnwrapSDKContext(ctx) + return am.keeper.EndBlocker(sdkCtx, am.wasmKeeper) } diff --git a/x/scheduler/types/codec.go b/x/scheduler/types/codec.go index ee160d3b..ea54340a 100644 --- a/x/scheduler/types/codec.go +++ b/x/scheduler/types/codec.go @@ -3,21 +3,31 @@ package types import ( "github.com/cosmos/cosmos-sdk/codec" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/msgservice" ) +// RegisterLegacyAminoCodec registers the necessary x/oracle interfaces and concrete types +// on the provided LegacyAmino codec. These types are used for Amino JSON serialization. +func RegisterLegacyAminoCodec(cdc *codec.LegacyAmino) { + cdc.RegisterConcrete(&MsgCreateHook{}, "scheduler/MsgCreateHook", nil) + cdc.RegisterConcrete(&MsgUpdateHook{}, "scheduler/MsgUpdateHook", nil) + cdc.RegisterConcrete(&MsgDeleteHook{}, "scheduler/MsgDeleteHook", nil) +} + func RegisterCodec(cdc *codec.LegacyAmino) { - cdc.RegisterConcrete(&CreateHookProposal{}, "scheduler/CreateHookProposal", nil) - cdc.RegisterConcrete(&UpdateHookProposal{}, "scheduler/UpdateHookProposal", nil) - cdc.RegisterConcrete(&DeleteHookProposal{}, "scheduler/DeleteHookProposal", nil) + cdc.RegisterConcrete(&MsgCreateHook{}, "scheduler/MsgCreateHook", nil) + cdc.RegisterConcrete(&MsgUpdateHook{}, "scheduler/MsgUpdateHook", nil) + cdc.RegisterConcrete(&MsgDeleteHook{}, "scheduler/MsgDeleteHook", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { - registry.RegisterImplementations((*govtypes.Content)(nil), - &CreateHookProposal{}, - &UpdateHookProposal{}, - &DeleteHookProposal{}, + registry.RegisterImplementations((*sdk.Msg)(nil), + &MsgCreateHook{}, + &MsgUpdateHook{}, + &MsgDeleteHook{}, ) + msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) } var ( diff --git a/x/scheduler/types/expected_keepers.go b/x/scheduler/types/expected_keepers.go index 418e9379..6cf75d69 100644 --- a/x/scheduler/types/expected_keepers.go +++ b/x/scheduler/types/expected_keepers.go @@ -1,20 +1,21 @@ package types import ( + "context" + sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/x/auth/types" ) // AccountKeeper defines the expected account keeper used for simulations (noalias) type AccountKeeper interface { - GetAccount(ctx sdk.Context, addr sdk.AccAddress) types.AccountI + GetAccount(ctx context.Context, addr sdk.AccAddress) sdk.AccountI GetModuleAddress(moduleName string) sdk.AccAddress // Methods imported from account should be defined here } // BankKeeper defines the expected interface needed to retrieve account balances. type BankKeeper interface { - SpendableCoins(ctx sdk.Context, addr sdk.AccAddress) sdk.Coins + SpendableCoins(ctx context.Context, addr sdk.AccAddress) sdk.Coins // Methods imported from bank should be defined here } diff --git a/x/scheduler/types/msgs.go b/x/scheduler/types/msgs.go new file mode 100644 index 00000000..44e3fb88 --- /dev/null +++ b/x/scheduler/types/msgs.go @@ -0,0 +1,164 @@ +package types + +import ( + "cosmossdk.io/errors" + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +type ProposalType string + +var ( + _ sdk.Msg = &MsgCreateHook{} + _ sdk.Msg = &MsgUpdateHook{} + _ sdk.Msg = &MsgDeleteHook{} +) + +const ( + TypeMsgCreateHook = "create_hook" + TypeMsgUpdateHook = "update_hook" + TypeMsgDeleteHook = "delete_hook" +) + +func NewMsgCreateHook( + authority string, + executor string, + contract string, + msg wasmtypes.RawContractMessage, + frequency int64, + funds sdk.Coins, +) *MsgCreateHook { + return &MsgCreateHook{ + Authority: authority, + Executor: executor, + Contract: contract, + Msg: msg, + Frequency: frequency, + Funds: funds, + } +} + +func (msg MsgCreateHook) Route() string { + return RouterKey +} + +func (msg MsgCreateHook) Type() string { + return TypeMsgCreateHook +} + +func (msg MsgCreateHook) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil { + return errors.Wrap(err, "contract") + } + if _, err := sdk.AccAddressFromBech32(msg.Executor); err != nil { + return errors.Wrap(err, "executor") + } + if !msg.Funds.IsValid() { + return sdkerrors.ErrInvalidCoins + } + if err := msg.Msg.ValidateBasic(); err != nil { + return errors.Wrap(err, "payload msg") + } + return nil +} + +func (msg MsgCreateHook) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{authority} +} + +func NewMsgUpdateHook( + authority string, + id uint64, + executor string, + contract string, + msg wasmtypes.RawContractMessage, + frequency int64, + funds sdk.Coins, +) *MsgUpdateHook { + return &MsgUpdateHook{ + Authority: authority, + Id: id, + Executor: executor, + Contract: contract, + Msg: msg, + Frequency: frequency, + Funds: funds, + } +} + +func (msg MsgUpdateHook) Route() string { + return RouterKey +} + +func (msg MsgUpdateHook) Type() string { + return TypeMsgUpdateHook +} + +func (msg MsgUpdateHook) ValidateBasic() error { + if msg.Id == 0 { + return errors.Wrap(sdkerrors.ErrInvalidRequest, "ID is required") + } + + if _, err := sdk.AccAddressFromBech32(msg.Contract); err != nil { + return errors.Wrap(err, "contract") + } + if _, err := sdk.AccAddressFromBech32(msg.Executor); err != nil { + return errors.Wrap(err, "executor") + } + if !msg.Funds.IsValid() { + return sdkerrors.ErrInvalidCoins + } + if err := msg.Msg.ValidateBasic(); err != nil { + return errors.Wrap(err, "payload msg") + } + return nil +} + +func (msg MsgUpdateHook) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{authority} +} + +func NewMsgDeleteHook( + authority string, + id uint64, +) *MsgDeleteHook { + return &MsgDeleteHook{ + Authority: authority, + Id: id, + } +} + +func (msg MsgDeleteHook) Route() string { + return RouterKey +} + +func (msg MsgDeleteHook) Type() string { + return TypeMsgDeleteHook +} + +func (msg MsgDeleteHook) ValidateBasic() error { + if msg.Id == 0 { + return errors.Wrap(sdkerrors.ErrInvalidRequest, "ID is required") + } + return nil +} + +func (msg MsgDeleteHook) GetSigners() []sdk.AccAddress { + authority, err := sdk.AccAddressFromBech32(msg.Authority) + if err != nil { + panic(err) + } + + return []sdk.AccAddress{authority} +} diff --git a/x/scheduler/types/msgs_test.go b/x/scheduler/types/msgs_test.go new file mode 100644 index 00000000..543a574d --- /dev/null +++ b/x/scheduler/types/msgs_test.go @@ -0,0 +1,79 @@ +package types + +import ( + "testing" + + wasmtypes "github.com/CosmWasm/wasmd/x/wasm/types" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" +) + +func TestMsgCreateHook_ValidateBasic(t *testing.T) { + jsonMsg := wasmtypes.RawContractMessage(`{"foo": 123}`) + + msg := NewMsgCreateHook( + "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh", + "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh", + "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh", + jsonMsg, + 1000, + sdk.NewCoins(sdk.NewInt64Coin("atom", 100)), + ) + require.NoError(t, msg.ValidateBasic()) +} + +func TestMsgCreateHook_ValidateBasic_Error(t *testing.T) { + msg := NewMsgCreateHook( + "invalidAddress", + "invalidAddress", + "invalidAddress", + wasmtypes.RawContractMessage{}, + 1000, + sdk.NewCoins(sdk.NewInt64Coin("atom", 100)), + ) + require.Error(t, msg.ValidateBasic()) +} + +func TestMsgUpdateHook_ValidateBasic(t *testing.T) { + jsonMsg := wasmtypes.RawContractMessage(`{"foo": 123}`) + + msg := NewMsgUpdateHook( + "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh", + 1, + "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh", + "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh", + jsonMsg, + 1000, + sdk.NewCoins(sdk.NewInt64Coin("atom", 100)), + ) + require.NoError(t, msg.ValidateBasic()) +} + +func TestMsgUpdateHook_ValidateBasic_Error(t *testing.T) { + msg := NewMsgUpdateHook( + "invalidAddress", + 0, + "invalidAddress", + "invalidAddress", + wasmtypes.RawContractMessage{}, + 1000, + sdk.NewCoins(sdk.NewInt64Coin("atom", 100)), + ) + require.Error(t, msg.ValidateBasic()) +} + +func TestMsgDeleteHook_ValidateBasic(t *testing.T) { + msg := NewMsgDeleteHook( + "cosmos1fl48vsnmsdzcv85q5d2q4z5ajdha8yu34mf0eh", + 1, + ) + require.NoError(t, msg.ValidateBasic()) +} + +func TestMsgDeleteHook_ValidateBasic_Error(t *testing.T) { + msg := NewMsgDeleteHook( + "invalidAddress", + 0, + ) + require.Error(t, msg.ValidateBasic()) +} diff --git a/x/scheduler/types/proposal.go b/x/scheduler/types/proposal.go deleted file mode 100644 index 5cbaaa3c..00000000 --- a/x/scheduler/types/proposal.go +++ /dev/null @@ -1,213 +0,0 @@ -package types - -import ( - "fmt" - "strings" - - errorsmod "cosmossdk.io/errors" - sdk "github.com/cosmos/cosmos-sdk/types" - sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govtypesv1beta "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" -) - -type ProposalType string - -const ( - ProposalTypeCreateHook ProposalType = "CreateHook" - ProposalTypeUpdateHook ProposalType = "UpdateHook" - ProposalTypeDeleteHook ProposalType = "DeleteHook" -) - -func init() { // register new content types with the sdk - govtypesv1beta.RegisterProposalType(string(ProposalTypeCreateHook)) - govtypesv1beta.RegisterProposalType(string(ProposalTypeUpdateHook)) - govtypesv1beta.RegisterProposalType(string(ProposalTypeDeleteHook)) -} - -var ( - _ govtypesv1beta.Content = &CreateHookProposal{} - _ govtypesv1beta.Content = &UpdateHookProposal{} - _ govtypesv1beta.Content = &DeleteHookProposal{} -) - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p CreateHookProposal) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type -func (p CreateHookProposal) ProposalType() string { return string(ProposalTypeCreateHook) } - -// ValidateBasic validates the proposal -func (p CreateHookProposal) ValidateBasic() error { - if err := validateProposalCommons(p.Title, p.Description); err != nil { - return err - } - if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil { - return errorsmod.Wrap(err, "contract") - } - if _, err := sdk.AccAddressFromBech32(p.Executor); err != nil { - return errorsmod.Wrap(err, "executor") - } - if !p.Funds.IsValid() { - return sdkerrors.ErrInvalidCoins - } - if err := p.Msg.ValidateBasic(); err != nil { - return errorsmod.Wrap(err, "payload msg") - } - return nil -} - -// String implements the Stringer interface. -func (p CreateHookProposal) String() string { - return fmt.Sprintf(`Create Hook Proposal: - Title: %s - Description: %s - Contract: %s - Executor: %s - Msg: %q - Funds: %s -`, p.Title, p.Description, p.Contract, p.Executor, p.Msg, p.Funds) -} - -// MarshalYAML pretty prints the wasm byte code -func (p CreateHookProposal) MarshalYAML() (interface{}, error) { - return struct { - Title string `yaml:"title"` - Description string `yaml:"description"` - Contract string `yaml:"contract"` - Executor string `yaml:"executor"` - Msg string `yaml:"msg"` - Funds sdk.Coins `yaml:"funds"` - }{ - Title: p.Title, - Description: p.Description, - Contract: p.Contract, - Executor: p.Executor, - Msg: string(p.Msg), - Funds: p.Funds, - }, nil -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p UpdateHookProposal) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type -func (p UpdateHookProposal) ProposalType() string { - return string(ProposalTypeUpdateHook) -} - -// ValidateBasic validates the proposal -func (p UpdateHookProposal) ValidateBasic() error { - if err := validateProposalCommons(p.Title, p.Description); err != nil { - return err - } - - if p.Id == 0 { - return errorsmod.Wrap(sdkerrors.ErrInvalidRequest, "ID is required") - } - - if _, err := sdk.AccAddressFromBech32(p.Contract); err != nil { - return errorsmod.Wrap(err, "contract") - } - if _, err := sdk.AccAddressFromBech32(p.Executor); err != nil { - return errorsmod.Wrap(err, "executor") - } - if !p.Funds.IsValid() { - return sdkerrors.ErrInvalidCoins - } - if err := p.Msg.ValidateBasic(); err != nil { - return errorsmod.Wrap(err, "payload msg") - } - return nil -} - -// String implements the Stringer interface. -func (p UpdateHookProposal) String() string { - return fmt.Sprintf(`Update Hook Proposal: - Title: %s - Description: %s - ID: %d - Contract: %s - Executor: %s - Msg: %q - Funds: %s - `, p.Title, p.Description, p.Id, p.Contract, p.Executor, p.Msg, p.Funds) -} - -// MarshalYAML pretty prints the init message -// -//nolint:revive -func (p UpdateHookProposal) MarshalYAML() (interface{}, error) { - return struct { - Id uint64 `yaml:"id"` //nolint:stylecheck - Title string `yaml:"title"` - Description string `yaml:"description"` - Contract string `yaml:"contract"` - Executor string `yaml:"executor"` - Msg string `yaml:"msg"` - Funds sdk.Coins `yaml:"funds"` - }{ - Id: p.Id, - Title: p.Title, - Description: p.Description, - Contract: p.Contract, - Executor: p.Executor, - Msg: string(p.Msg), - Funds: p.Funds, - }, nil -} - -// ProposalRoute returns the routing key of a parameter change proposal. -func (p DeleteHookProposal) ProposalRoute() string { return RouterKey } - -// ProposalType returns the type -func (p DeleteHookProposal) ProposalType() string { return string(ProposalTypeDeleteHook) } - -// ValidateBasic validates the proposal -func (p DeleteHookProposal) ValidateBasic() error { - return validateProposalCommons(p.Title, p.Description) -} - -// String implements the Stringer interface. -func (p DeleteHookProposal) String() string { - return fmt.Sprintf(`Migrate Contract Proposal: - Title: %s - Description: %s - ID: %d -`, p.Title, p.Description, p.Id) -} - -// MarshalYAML pretty prints the migrate message -func (p DeleteHookProposal) MarshalYAML() (interface{}, error) { - return struct { - Title string `yaml:"title"` - Description string `yaml:"description"` - Id uint64 `yaml:"id"` //nolint:revive,stylecheck - }{ - Title: p.Title, - Description: p.Description, - Id: p.Id, - }, nil -} - -func validateProposalCommons(title, description string) error { - if strings.TrimSpace(title) != title { - return errorsmod.Wrap(govtypes.ErrInvalidProposalContent, "proposal title must not start/end with white spaces") - } - if len(title) == 0 { - return errorsmod.Wrap(govtypes.ErrInvalidProposalContent, "proposal title cannot be blank") - } - if len(title) > govtypesv1beta.MaxTitleLength { - return errorsmod.Wrapf(govtypes.ErrInvalidProposalContent, "proposal title is longer than max length of %d", govtypesv1beta.MaxTitleLength) - } - if strings.TrimSpace(description) != description { - return errorsmod.Wrap(govtypes.ErrInvalidProposalContent, "proposal description must not start/end with white spaces") - } - if len(description) == 0 { - return errorsmod.Wrap(govtypes.ErrInvalidProposalContent, "proposal description cannot be blank") - } - if len(description) > govtypesv1beta.MaxDescriptionLength { - return errorsmod.Wrapf(govtypes.ErrInvalidProposalContent, "proposal description is longer than max length of %d", govtypesv1beta.MaxDescriptionLength) - } - return nil -} diff --git a/x/scheduler/types/proposal.pb.go b/x/scheduler/types/proposal.pb.go deleted file mode 100644 index c306f231..00000000 --- a/x/scheduler/types/proposal.pb.go +++ /dev/null @@ -1,1409 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: kujira/scheduler/proposal.proto - -package types - -import ( - fmt "fmt" - github_com_CosmWasm_wasmd_x_wasm_types "github.com/CosmWasm/wasmd/x/wasm/types" - github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" - types "github.com/cosmos/cosmos-sdk/types" - _ "github.com/cosmos/gogoproto/gogoproto" - proto "github.com/cosmos/gogoproto/proto" - io "io" - math "math" - math_bits "math/bits" -) - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -// This is a compile-time assertion to ensure that this generated file -// is compatible with the proto package it is being compiled against. -// A compilation error at this line likely means your copy of the -// proto package needs to be updated. -const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package - -type CreateHookProposal struct { - // Title is a short summary - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - // Description is a human readable text - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - // The account that will execute the msg on the schedule - Executor string `protobuf:"bytes,3,opt,name=executor,proto3" json:"executor,omitempty"` - // The contract that the msg is called on - Contract string `protobuf:"bytes,4,opt,name=contract,proto3" json:"contract,omitempty"` - Msg github_com_CosmWasm_wasmd_x_wasm_types.RawContractMessage `protobuf:"bytes,5,opt,name=msg,proto3,casttype=github.com/CosmWasm/wasmd/x/wasm/types.RawContractMessage" json:"msg,omitempty"` - Frequency int64 `protobuf:"varint,6,opt,name=frequency,proto3" json:"frequency,omitempty"` - Funds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"` -} - -func (m *CreateHookProposal) Reset() { *m = CreateHookProposal{} } -func (*CreateHookProposal) ProtoMessage() {} -func (*CreateHookProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ad97a40d5d538195, []int{0} -} -func (m *CreateHookProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *CreateHookProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_CreateHookProposal.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 *CreateHookProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_CreateHookProposal.Merge(m, src) -} -func (m *CreateHookProposal) XXX_Size() int { - return m.Size() -} -func (m *CreateHookProposal) XXX_DiscardUnknown() { - xxx_messageInfo_CreateHookProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_CreateHookProposal proto.InternalMessageInfo - -func (m *CreateHookProposal) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *CreateHookProposal) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *CreateHookProposal) GetExecutor() string { - if m != nil { - return m.Executor - } - return "" -} - -func (m *CreateHookProposal) GetContract() string { - if m != nil { - return m.Contract - } - return "" -} - -func (m *CreateHookProposal) GetMsg() github_com_CosmWasm_wasmd_x_wasm_types.RawContractMessage { - if m != nil { - return m.Msg - } - return nil -} - -func (m *CreateHookProposal) GetFrequency() int64 { - if m != nil { - return m.Frequency - } - return 0 -} - -func (m *CreateHookProposal) GetFunds() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Funds - } - return nil -} - -type UpdateHookProposal struct { - // Title is a short summary - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - // Description is a human readable text - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Id uint64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` - Executor string `protobuf:"bytes,4,opt,name=executor,proto3" json:"executor,omitempty"` - Contract string `protobuf:"bytes,5,opt,name=contract,proto3" json:"contract,omitempty"` - Msg github_com_CosmWasm_wasmd_x_wasm_types.RawContractMessage `protobuf:"bytes,6,opt,name=msg,proto3,casttype=github.com/CosmWasm/wasmd/x/wasm/types.RawContractMessage" json:"msg,omitempty"` - Frequency int64 `protobuf:"varint,7,opt,name=frequency,proto3" json:"frequency,omitempty"` - Funds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,8,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"` -} - -func (m *UpdateHookProposal) Reset() { *m = UpdateHookProposal{} } -func (*UpdateHookProposal) ProtoMessage() {} -func (*UpdateHookProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ad97a40d5d538195, []int{1} -} -func (m *UpdateHookProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *UpdateHookProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UpdateHookProposal.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 *UpdateHookProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_UpdateHookProposal.Merge(m, src) -} -func (m *UpdateHookProposal) XXX_Size() int { - return m.Size() -} -func (m *UpdateHookProposal) XXX_DiscardUnknown() { - xxx_messageInfo_UpdateHookProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_UpdateHookProposal proto.InternalMessageInfo - -func (m *UpdateHookProposal) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *UpdateHookProposal) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *UpdateHookProposal) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func (m *UpdateHookProposal) GetExecutor() string { - if m != nil { - return m.Executor - } - return "" -} - -func (m *UpdateHookProposal) GetContract() string { - if m != nil { - return m.Contract - } - return "" -} - -func (m *UpdateHookProposal) GetMsg() github_com_CosmWasm_wasmd_x_wasm_types.RawContractMessage { - if m != nil { - return m.Msg - } - return nil -} - -func (m *UpdateHookProposal) GetFrequency() int64 { - if m != nil { - return m.Frequency - } - return 0 -} - -func (m *UpdateHookProposal) GetFunds() github_com_cosmos_cosmos_sdk_types.Coins { - if m != nil { - return m.Funds - } - return nil -} - -type DeleteHookProposal struct { - // Title is a short summary - Title string `protobuf:"bytes,1,opt,name=title,proto3" json:"title,omitempty"` - // Description is a human readable text - Description string `protobuf:"bytes,2,opt,name=description,proto3" json:"description,omitempty"` - Id uint64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` -} - -func (m *DeleteHookProposal) Reset() { *m = DeleteHookProposal{} } -func (*DeleteHookProposal) ProtoMessage() {} -func (*DeleteHookProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_ad97a40d5d538195, []int{2} -} -func (m *DeleteHookProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *DeleteHookProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteHookProposal.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 *DeleteHookProposal) XXX_Merge(src proto.Message) { - xxx_messageInfo_DeleteHookProposal.Merge(m, src) -} -func (m *DeleteHookProposal) XXX_Size() int { - return m.Size() -} -func (m *DeleteHookProposal) XXX_DiscardUnknown() { - xxx_messageInfo_DeleteHookProposal.DiscardUnknown(m) -} - -var xxx_messageInfo_DeleteHookProposal proto.InternalMessageInfo - -func (m *DeleteHookProposal) GetTitle() string { - if m != nil { - return m.Title - } - return "" -} - -func (m *DeleteHookProposal) GetDescription() string { - if m != nil { - return m.Description - } - return "" -} - -func (m *DeleteHookProposal) GetId() uint64 { - if m != nil { - return m.Id - } - return 0 -} - -func init() { - proto.RegisterType((*CreateHookProposal)(nil), "kujira.scheduler.CreateHookProposal") - proto.RegisterType((*UpdateHookProposal)(nil), "kujira.scheduler.UpdateHookProposal") - proto.RegisterType((*DeleteHookProposal)(nil), "kujira.scheduler.DeleteHookProposal") -} - -func init() { proto.RegisterFile("kujira/scheduler/proposal.proto", fileDescriptor_ad97a40d5d538195) } - -var fileDescriptor_ad97a40d5d538195 = []byte{ - // 455 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x93, 0x4d, 0x6f, 0xd3, 0x4e, - 0x10, 0xc6, 0x6d, 0xe7, 0xa5, 0xed, 0xf6, 0xaf, 0xbf, 0xd0, 0xaa, 0x07, 0x13, 0x90, 0x63, 0xf5, - 0xe4, 0x4b, 0xbc, 0x14, 0x4e, 0x1c, 0xb8, 0x24, 0x1c, 0x90, 0x2a, 0x04, 0xb2, 0x40, 0x48, 0x88, - 0xcb, 0x66, 0x3d, 0x75, 0x96, 0xc4, 0x1e, 0xb3, 0xbb, 0xa6, 0xe9, 0xb7, 0xe0, 0x73, 0xf0, 0x49, - 0x7a, 0xec, 0x09, 0xf5, 0x54, 0x20, 0x91, 0xf8, 0x10, 0x9c, 0x90, 0xbd, 0xa6, 0x04, 0xf1, 0x72, - 0x22, 0xa7, 0xd9, 0x99, 0x67, 0xf6, 0xd1, 0xa3, 0x9f, 0x34, 0x64, 0x38, 0xaf, 0x5e, 0x4b, 0xc5, - 0x99, 0x16, 0x33, 0x48, 0xab, 0x05, 0x28, 0x56, 0x2a, 0x2c, 0x51, 0xf3, 0x45, 0x5c, 0x2a, 0x34, - 0x48, 0x6f, 0xd8, 0x85, 0xf8, 0x7a, 0x61, 0x70, 0x90, 0x61, 0x86, 0x8d, 0xc8, 0xea, 0x97, 0xdd, - 0x1b, 0xdc, 0xfa, 0xc5, 0x68, 0x86, 0x38, 0x6f, 0xc5, 0x40, 0xa0, 0xce, 0x51, 0xb3, 0x29, 0xd7, - 0xc0, 0xde, 0x1e, 0x4d, 0xc1, 0xf0, 0x23, 0x26, 0x50, 0x16, 0x56, 0x3f, 0xfc, 0xe0, 0x11, 0x3a, - 0x51, 0xc0, 0x0d, 0x3c, 0x42, 0x9c, 0x3f, 0x6d, 0x13, 0xd0, 0x03, 0xd2, 0x33, 0xd2, 0x2c, 0xc0, - 0x77, 0x43, 0x37, 0xda, 0x4b, 0x6c, 0x43, 0x43, 0xb2, 0x9f, 0x82, 0x16, 0x4a, 0x96, 0x46, 0x62, - 0xe1, 0x7b, 0x8d, 0xb6, 0x39, 0xa2, 0x03, 0xb2, 0x0b, 0x4b, 0x10, 0x95, 0x41, 0xe5, 0x77, 0x1a, - 0xf9, 0xba, 0xaf, 0x35, 0x81, 0x85, 0x51, 0x5c, 0x18, 0xbf, 0x6b, 0xb5, 0xef, 0x3d, 0x7d, 0x42, - 0x3a, 0xb9, 0xce, 0xfc, 0x5e, 0xe8, 0x46, 0xff, 0x8d, 0x1f, 0x7c, 0xbd, 0x1a, 0xde, 0xcf, 0xa4, - 0x99, 0x55, 0xd3, 0x58, 0x60, 0xce, 0x26, 0xa8, 0xf3, 0x17, 0x5c, 0xe7, 0xec, 0x94, 0xeb, 0x3c, - 0x65, 0xcb, 0xa6, 0x32, 0x73, 0x56, 0x82, 0x8e, 0x13, 0x7e, 0x3a, 0x69, 0x4d, 0x1e, 0x83, 0xd6, - 0x3c, 0x83, 0xa4, 0x76, 0xa2, 0xb7, 0xc9, 0xde, 0x89, 0x82, 0x37, 0x15, 0x14, 0xe2, 0xcc, 0xef, - 0x87, 0x6e, 0xd4, 0x49, 0x7e, 0x0c, 0x28, 0x27, 0xbd, 0x93, 0xaa, 0x48, 0xb5, 0xbf, 0x13, 0x76, - 0xa2, 0xfd, 0xbb, 0x37, 0x63, 0x4b, 0x29, 0xae, 0x29, 0xc5, 0x2d, 0xa5, 0x78, 0x82, 0xb2, 0x18, - 0xdf, 0x39, 0xbf, 0x1a, 0x3a, 0xef, 0x3f, 0x0e, 0xa3, 0x8d, 0x3c, 0x2d, 0x52, 0x5b, 0x46, 0x3a, - 0x9d, 0xb7, 0x59, 0xea, 0x0f, 0x3a, 0xb1, 0xce, 0x87, 0x5f, 0x3c, 0x42, 0x9f, 0x97, 0xe9, 0xbf, - 0x02, 0xfb, 0x3f, 0xf1, 0x64, 0xda, 0x20, 0xed, 0x26, 0x9e, 0x4c, 0x7f, 0x02, 0xdd, 0xfd, 0x0b, - 0xe8, 0xde, 0xef, 0x41, 0xf7, 0xb7, 0x03, 0x7a, 0xe7, 0x8f, 0xa0, 0x77, 0xb7, 0x06, 0xfa, 0x15, - 0xa1, 0x0f, 0x61, 0x01, 0xdb, 0xe1, 0x3c, 0x3e, 0xbe, 0xfc, 0x1c, 0x38, 0xe7, 0xab, 0xc0, 0xbd, - 0x58, 0x05, 0xee, 0xa7, 0x55, 0xe0, 0xbe, 0x5b, 0x07, 0xce, 0xc5, 0x3a, 0x70, 0x2e, 0xd7, 0x81, - 0xf3, 0x72, 0xb4, 0x11, 0xf6, 0x19, 0xf0, 0x7c, 0x74, 0x6c, 0x4f, 0x51, 0xa0, 0x02, 0xb6, 0xdc, - 0xb8, 0xc8, 0x26, 0xf7, 0xb4, 0xdf, 0xdc, 0xdc, 0xbd, 0x6f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x21, - 0xb6, 0x20, 0x7c, 0xfb, 0x03, 0x00, 0x00, -} - -func (m *CreateHookProposal) 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 *CreateHookProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *CreateHookProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Funds) > 0 { - for iNdEx := len(m.Funds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Funds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProposal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x3a - } - } - if m.Frequency != 0 { - i = encodeVarintProposal(dAtA, i, uint64(m.Frequency)) - i-- - dAtA[i] = 0x30 - } - if len(m.Msg) > 0 { - i -= len(m.Msg) - copy(dAtA[i:], m.Msg) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Msg))) - i-- - dAtA[i] = 0x2a - } - if len(m.Contract) > 0 { - i -= len(m.Contract) - copy(dAtA[i:], m.Contract) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Contract))) - i-- - dAtA[i] = 0x22 - } - if len(m.Executor) > 0 { - i -= len(m.Executor) - copy(dAtA[i:], m.Executor) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Executor))) - i-- - dAtA[i] = 0x1a - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *UpdateHookProposal) 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 *UpdateHookProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *UpdateHookProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Funds) > 0 { - for iNdEx := len(m.Funds) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.Funds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintProposal(dAtA, i, uint64(size)) - } - i-- - dAtA[i] = 0x42 - } - } - if m.Frequency != 0 { - i = encodeVarintProposal(dAtA, i, uint64(m.Frequency)) - i-- - dAtA[i] = 0x38 - } - if len(m.Msg) > 0 { - i -= len(m.Msg) - copy(dAtA[i:], m.Msg) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Msg))) - i-- - dAtA[i] = 0x32 - } - if len(m.Contract) > 0 { - i -= len(m.Contract) - copy(dAtA[i:], m.Contract) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Contract))) - i-- - dAtA[i] = 0x2a - } - if len(m.Executor) > 0 { - i -= len(m.Executor) - copy(dAtA[i:], m.Executor) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Executor))) - i-- - dAtA[i] = 0x22 - } - if m.Id != 0 { - i = encodeVarintProposal(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x18 - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *DeleteHookProposal) 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 *DeleteHookProposal) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *DeleteHookProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.Id != 0 { - i = encodeVarintProposal(dAtA, i, uint64(m.Id)) - i-- - dAtA[i] = 0x18 - } - if len(m.Description) > 0 { - i -= len(m.Description) - copy(dAtA[i:], m.Description) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Description))) - i-- - dAtA[i] = 0x12 - } - if len(m.Title) > 0 { - i -= len(m.Title) - copy(dAtA[i:], m.Title) - i = encodeVarintProposal(dAtA, i, uint64(len(m.Title))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func encodeVarintProposal(dAtA []byte, offset int, v uint64) int { - offset -= sovProposal(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *CreateHookProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Executor) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Contract) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Msg) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - if m.Frequency != 0 { - n += 1 + sovProposal(uint64(m.Frequency)) - } - if len(m.Funds) > 0 { - for _, e := range m.Funds { - l = e.Size() - n += 1 + l + sovProposal(uint64(l)) - } - } - return n -} - -func (m *UpdateHookProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - if m.Id != 0 { - n += 1 + sovProposal(uint64(m.Id)) - } - l = len(m.Executor) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Contract) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Msg) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - if m.Frequency != 0 { - n += 1 + sovProposal(uint64(m.Frequency)) - } - if len(m.Funds) > 0 { - for _, e := range m.Funds { - l = e.Size() - n += 1 + l + sovProposal(uint64(l)) - } - } - return n -} - -func (m *DeleteHookProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Title) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - l = len(m.Description) - if l > 0 { - n += 1 + l + sovProposal(uint64(l)) - } - if m.Id != 0 { - n += 1 + sovProposal(uint64(m.Id)) - } - return n -} - -func sovProposal(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozProposal(x uint64) (n int) { - return sovProposal(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *CreateHookProposal) 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 ErrIntOverflowProposal - } - 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: CreateHookProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: CreateHookProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Executor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Executor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) - if m.Msg == nil { - m.Msg = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Frequency", wireType) - } - m.Frequency = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Frequency |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Funds", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Funds = append(m.Funds, types.Coin{}) - if err := m.Funds[len(m.Funds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *UpdateHookProposal) 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 ErrIntOverflowProposal - } - 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: UpdateHookProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UpdateHookProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Executor", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Executor = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Contract", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Contract = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + byteLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) - if m.Msg == nil { - m.Msg = []byte{} - } - iNdEx = postIndex - case 7: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Frequency", wireType) - } - m.Frequency = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Frequency |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Funds", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthProposal - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Funds = append(m.Funds, types.Coin{}) - if err := m.Funds[len(m.Funds)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteHookProposal) 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 ErrIntOverflowProposal - } - 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: DeleteHookProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteHookProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Title", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Title = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Description", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - 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 ErrInvalidLengthProposal - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthProposal - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Description = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowProposal - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipProposal(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthProposal - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipProposal(dAtA []byte) (n int, err error) { - l := len(dAtA) - iNdEx := 0 - depth := 0 - for iNdEx < l { - var wire uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - wire |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - wireType := int(wire & 0x7) - switch wireType { - case 0: - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - iNdEx++ - if dAtA[iNdEx-1] < 0x80 { - break - } - } - case 1: - iNdEx += 8 - case 2: - var length int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowProposal - } - if iNdEx >= l { - return 0, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - length |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if length < 0 { - return 0, ErrInvalidLengthProposal - } - iNdEx += length - case 3: - depth++ - case 4: - if depth == 0 { - return 0, ErrUnexpectedEndOfGroupProposal - } - depth-- - case 5: - iNdEx += 4 - default: - return 0, fmt.Errorf("proto: illegal wireType %d", wireType) - } - if iNdEx < 0 { - return 0, ErrInvalidLengthProposal - } - if depth == 0 { - return iNdEx, nil - } - } - return 0, io.ErrUnexpectedEOF -} - -var ( - ErrInvalidLengthProposal = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowProposal = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupProposal = fmt.Errorf("proto: unexpected end of group") -) diff --git a/x/scheduler/types/tx.pb.go b/x/scheduler/types/tx.pb.go new file mode 100644 index 00000000..656afb3d --- /dev/null +++ b/x/scheduler/types/tx.pb.go @@ -0,0 +1,1679 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: kujira/scheduler/tx.proto + +package types + +import ( + context "context" + fmt "fmt" + github_com_CosmWasm_wasmd_x_wasm_types "github.com/CosmWasm/wasmd/x/wasm/types" + _ "github.com/cosmos/cosmos-proto" + github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" + types "github.com/cosmos/cosmos-sdk/types" + _ "github.com/cosmos/cosmos-sdk/types/msgservice" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + grpc "google.golang.org/grpc" + codes "google.golang.org/grpc/codes" + status "google.golang.org/grpc/status" + io "io" + math "math" + math_bits "math/bits" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type MsgCreateHook struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + // The account that will execute the msg on the schedule + Executor string `protobuf:"bytes,2,opt,name=executor,proto3" json:"executor,omitempty"` + // The contract that the msg is called on + Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"` + Msg github_com_CosmWasm_wasmd_x_wasm_types.RawContractMessage `protobuf:"bytes,4,opt,name=msg,proto3,casttype=github.com/CosmWasm/wasmd/x/wasm/types.RawContractMessage" json:"msg,omitempty"` + Frequency int64 `protobuf:"varint,5,opt,name=frequency,proto3" json:"frequency,omitempty" yaml:"frequency"` + Funds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,6,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"` +} + +func (m *MsgCreateHook) Reset() { *m = MsgCreateHook{} } +func (m *MsgCreateHook) String() string { return proto.CompactTextString(m) } +func (*MsgCreateHook) ProtoMessage() {} +func (*MsgCreateHook) Descriptor() ([]byte, []int) { + return fileDescriptor_46e7eb5b8fdc2ba1, []int{0} +} +func (m *MsgCreateHook) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateHook) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateHook.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 *MsgCreateHook) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateHook.Merge(m, src) +} +func (m *MsgCreateHook) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateHook) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateHook.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateHook proto.InternalMessageInfo + +type MsgCreateHookResponse struct { +} + +func (m *MsgCreateHookResponse) Reset() { *m = MsgCreateHookResponse{} } +func (m *MsgCreateHookResponse) String() string { return proto.CompactTextString(m) } +func (*MsgCreateHookResponse) ProtoMessage() {} +func (*MsgCreateHookResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_46e7eb5b8fdc2ba1, []int{1} +} +func (m *MsgCreateHookResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgCreateHookResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgCreateHookResponse.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 *MsgCreateHookResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgCreateHookResponse.Merge(m, src) +} +func (m *MsgCreateHookResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgCreateHookResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgCreateHookResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgCreateHookResponse proto.InternalMessageInfo + +type MsgUpdateHook struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` + Executor string `protobuf:"bytes,3,opt,name=executor,proto3" json:"executor,omitempty"` + Contract string `protobuf:"bytes,4,opt,name=contract,proto3" json:"contract,omitempty"` + Msg github_com_CosmWasm_wasmd_x_wasm_types.RawContractMessage `protobuf:"bytes,5,opt,name=msg,proto3,casttype=github.com/CosmWasm/wasmd/x/wasm/types.RawContractMessage" json:"msg,omitempty"` + Frequency int64 `protobuf:"varint,6,opt,name=frequency,proto3" json:"frequency,omitempty"` + Funds github_com_cosmos_cosmos_sdk_types.Coins `protobuf:"bytes,7,rep,name=funds,proto3,castrepeated=github.com/cosmos/cosmos-sdk/types.Coins" json:"funds"` +} + +func (m *MsgUpdateHook) Reset() { *m = MsgUpdateHook{} } +func (m *MsgUpdateHook) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateHook) ProtoMessage() {} +func (*MsgUpdateHook) Descriptor() ([]byte, []int) { + return fileDescriptor_46e7eb5b8fdc2ba1, []int{2} +} +func (m *MsgUpdateHook) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateHook) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateHook.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 *MsgUpdateHook) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateHook.Merge(m, src) +} +func (m *MsgUpdateHook) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateHook) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateHook.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateHook proto.InternalMessageInfo + +type MsgUpdateHookResponse struct { +} + +func (m *MsgUpdateHookResponse) Reset() { *m = MsgUpdateHookResponse{} } +func (m *MsgUpdateHookResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateHookResponse) ProtoMessage() {} +func (*MsgUpdateHookResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_46e7eb5b8fdc2ba1, []int{3} +} +func (m *MsgUpdateHookResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateHookResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateHookResponse.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 *MsgUpdateHookResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateHookResponse.Merge(m, src) +} +func (m *MsgUpdateHookResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateHookResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateHookResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateHookResponse proto.InternalMessageInfo + +type MsgDeleteHook struct { + Authority string `protobuf:"bytes,1,opt,name=authority,proto3" json:"authority,omitempty"` + Id uint64 `protobuf:"varint,2,opt,name=id,proto3" json:"id,omitempty"` +} + +func (m *MsgDeleteHook) Reset() { *m = MsgDeleteHook{} } +func (m *MsgDeleteHook) String() string { return proto.CompactTextString(m) } +func (*MsgDeleteHook) ProtoMessage() {} +func (*MsgDeleteHook) Descriptor() ([]byte, []int) { + return fileDescriptor_46e7eb5b8fdc2ba1, []int{4} +} +func (m *MsgDeleteHook) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeleteHook) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeleteHook.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 *MsgDeleteHook) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeleteHook.Merge(m, src) +} +func (m *MsgDeleteHook) XXX_Size() int { + return m.Size() +} +func (m *MsgDeleteHook) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeleteHook.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeleteHook proto.InternalMessageInfo + +type MsgDeleteHookResponse struct { +} + +func (m *MsgDeleteHookResponse) Reset() { *m = MsgDeleteHookResponse{} } +func (m *MsgDeleteHookResponse) String() string { return proto.CompactTextString(m) } +func (*MsgDeleteHookResponse) ProtoMessage() {} +func (*MsgDeleteHookResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_46e7eb5b8fdc2ba1, []int{5} +} +func (m *MsgDeleteHookResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgDeleteHookResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgDeleteHookResponse.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 *MsgDeleteHookResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgDeleteHookResponse.Merge(m, src) +} +func (m *MsgDeleteHookResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgDeleteHookResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgDeleteHookResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgDeleteHookResponse proto.InternalMessageInfo + +func init() { + proto.RegisterType((*MsgCreateHook)(nil), "kujira.scheduler.MsgCreateHook") + proto.RegisterType((*MsgCreateHookResponse)(nil), "kujira.scheduler.MsgCreateHookResponse") + proto.RegisterType((*MsgUpdateHook)(nil), "kujira.scheduler.MsgUpdateHook") + proto.RegisterType((*MsgUpdateHookResponse)(nil), "kujira.scheduler.MsgUpdateHookResponse") + proto.RegisterType((*MsgDeleteHook)(nil), "kujira.scheduler.MsgDeleteHook") + proto.RegisterType((*MsgDeleteHookResponse)(nil), "kujira.scheduler.MsgDeleteHookResponse") +} + +func init() { proto.RegisterFile("kujira/scheduler/tx.proto", fileDescriptor_46e7eb5b8fdc2ba1) } + +var fileDescriptor_46e7eb5b8fdc2ba1 = []byte{ + // 595 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xc4, 0x95, 0xcd, 0x8b, 0xd3, 0x40, + 0x18, 0xc6, 0x93, 0x66, 0x5b, 0xed, 0xf8, 0xc1, 0x12, 0xaa, 0x9b, 0x56, 0x49, 0x4a, 0x2f, 0x16, + 0xa1, 0x19, 0x5b, 0x45, 0x70, 0xc1, 0x83, 0xad, 0xa0, 0x20, 0x45, 0x88, 0x5f, 0xe0, 0x45, 0xa6, + 0xc9, 0x6c, 0x1a, 0xdb, 0x64, 0xea, 0xcc, 0x64, 0xb7, 0xbd, 0x7a, 0xf2, 0x22, 0xf8, 0x27, 0xec, + 0x59, 0x10, 0x04, 0xfd, 0x23, 0xf6, 0xb8, 0x78, 0xf2, 0x54, 0xa5, 0x3d, 0xe8, 0xd9, 0xa3, 0x27, + 0xc9, 0x47, 0x9b, 0xd4, 0x76, 0x29, 0xea, 0x82, 0xa7, 0x69, 0x79, 0x9e, 0xf7, 0x99, 0x97, 0xf9, + 0xbd, 0xbc, 0x01, 0xc5, 0x9e, 0xff, 0xdc, 0xa1, 0x08, 0x32, 0xb3, 0x8b, 0x2d, 0xbf, 0x8f, 0x29, + 0xe4, 0x43, 0x7d, 0x40, 0x09, 0x27, 0xf2, 0x66, 0x24, 0xe9, 0x73, 0xa9, 0x54, 0xb0, 0x89, 0x4d, + 0x42, 0x11, 0x06, 0xbf, 0x22, 0x5f, 0xe9, 0xc2, 0x52, 0x44, 0x97, 0x90, 0x5e, 0x2c, 0xaa, 0x26, + 0x61, 0x2e, 0x61, 0xb0, 0x83, 0x18, 0x86, 0xbb, 0xf5, 0x0e, 0xe6, 0xa8, 0x0e, 0x4d, 0xe2, 0x78, + 0xb1, 0xbe, 0x15, 0xeb, 0x2e, 0xb3, 0xe1, 0x6e, 0x3d, 0x38, 0x62, 0xa1, 0x18, 0x09, 0xcf, 0xa2, + 0xeb, 0xa2, 0x3f, 0x91, 0x54, 0xf9, 0x20, 0x81, 0x33, 0x6d, 0x66, 0xb7, 0x28, 0x46, 0x1c, 0xdf, + 0x25, 0xa4, 0x27, 0x5f, 0x07, 0x79, 0xe4, 0xf3, 0x2e, 0xa1, 0x0e, 0x1f, 0x29, 0x62, 0x59, 0xac, + 0xe6, 0x9b, 0xca, 0xa7, 0x8f, 0xb5, 0x42, 0x5c, 0x76, 0xcb, 0xb2, 0x28, 0x66, 0xec, 0x01, 0xa7, + 0x8e, 0x67, 0x1b, 0x89, 0x55, 0xbe, 0x06, 0x4e, 0xe2, 0x21, 0x36, 0x7d, 0x4e, 0xa8, 0x92, 0x59, + 0x53, 0x36, 0x77, 0x06, 0x55, 0x26, 0xf1, 0x38, 0x45, 0x26, 0x57, 0xa4, 0x75, 0x55, 0x33, 0xa7, + 0x7c, 0x1f, 0x48, 0x2e, 0xb3, 0x95, 0x8d, 0xb2, 0x58, 0x3d, 0xdd, 0xbc, 0xf9, 0x73, 0xac, 0xdd, + 0xb0, 0x1d, 0xde, 0xf5, 0x3b, 0xba, 0x49, 0x5c, 0xd8, 0x22, 0xcc, 0x7d, 0x82, 0x98, 0x0b, 0xf7, + 0x10, 0x73, 0x2d, 0x38, 0x0c, 0x4f, 0xc8, 0x47, 0x03, 0xcc, 0x74, 0x03, 0xed, 0xb5, 0xe2, 0x90, + 0x36, 0x66, 0x0c, 0xd9, 0xd8, 0x08, 0x92, 0xe4, 0x06, 0xc8, 0xef, 0x50, 0xfc, 0xc2, 0xc7, 0x9e, + 0x39, 0x52, 0xb2, 0x65, 0xb1, 0x2a, 0x35, 0x0b, 0x3f, 0xc6, 0xda, 0xe6, 0x08, 0xb9, 0xfd, 0xed, + 0xca, 0x5c, 0xaa, 0x18, 0x89, 0x4d, 0x46, 0x20, 0xbb, 0xe3, 0x7b, 0x16, 0x53, 0x72, 0x65, 0xa9, + 0x7a, 0xaa, 0x51, 0xd4, 0xe3, 0xa6, 0x03, 0x3c, 0x7a, 0x8c, 0x47, 0x6f, 0x11, 0xc7, 0x6b, 0x5e, + 0x39, 0x18, 0x6b, 0xc2, 0xdb, 0x2f, 0x5a, 0x35, 0xd5, 0x65, 0xcc, 0x2a, 0x3a, 0x6a, 0xcc, 0xea, + 0xc5, 0x1d, 0x06, 0x05, 0xcc, 0x88, 0x92, 0xb7, 0xcf, 0xbf, 0xda, 0xd7, 0x84, 0xef, 0xfb, 0x9a, + 0xf0, 0xf2, 0xdb, 0xfb, 0xcb, 0xc9, 0x5b, 0x57, 0xb6, 0xc0, 0xb9, 0x05, 0x68, 0x06, 0x66, 0x03, + 0xe2, 0x31, 0x5c, 0x79, 0x17, 0xe1, 0x7c, 0x34, 0xb0, 0xfe, 0x15, 0xe7, 0x59, 0x90, 0x71, 0xac, + 0x10, 0xe4, 0x86, 0x91, 0x71, 0xac, 0x05, 0xbc, 0xd2, 0x5f, 0xe1, 0xdd, 0xf8, 0x53, 0xbc, 0xd9, + 0x63, 0xc3, 0x7b, 0x31, 0x8d, 0x37, 0x17, 0xe0, 0x5d, 0x09, 0xf2, 0xc4, 0x7f, 0x02, 0x99, 0xe0, + 0x9a, 0x83, 0x24, 0x21, 0xc7, 0xdb, 0xb8, 0x8f, 0x8f, 0x97, 0xe3, 0x9a, 0x4e, 0x92, 0x0b, 0x67, + 0x9d, 0x34, 0x5e, 0x67, 0x80, 0xd4, 0x66, 0xb6, 0xfc, 0x18, 0x80, 0xd4, 0x96, 0xd0, 0xf4, 0xdf, + 0x37, 0x9a, 0xbe, 0x30, 0x91, 0xa5, 0x4b, 0x6b, 0x0c, 0xb3, 0xfc, 0x20, 0x37, 0x35, 0xae, 0xab, + 0x73, 0x13, 0xc3, 0x11, 0xb9, 0xcb, 0x2f, 0x18, 0xe4, 0xa6, 0x9e, 0x6f, 0x75, 0x6e, 0x62, 0x38, + 0x22, 0x77, 0xf9, 0x3d, 0x9a, 0x77, 0x0e, 0x26, 0xaa, 0x78, 0x38, 0x51, 0xc5, 0xaf, 0x13, 0x55, + 0x7c, 0x33, 0x55, 0x85, 0xc3, 0xa9, 0x2a, 0x7c, 0x9e, 0xaa, 0xc2, 0xd3, 0x5a, 0x6a, 0x2a, 0x1e, + 0x62, 0xe4, 0xd6, 0xee, 0x45, 0xcb, 0xdc, 0x24, 0x14, 0xc3, 0x61, 0xfa, 0xb3, 0x10, 0x0c, 0x48, + 0x27, 0x17, 0x6e, 0xe0, 0xab, 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x9c, 0x45, 0x8e, 0x9b, 0x37, + 0x06, 0x00, 0x00, +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the grpc package it is being compiled against. +const _ = grpc.SupportPackageIsVersion4 + +// MsgClient is the client API for Msg service. +// +// 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 { + // CreateHook adds a new hook to the scheduler + CreateHook(ctx context.Context, in *MsgCreateHook, opts ...grpc.CallOption) (*MsgCreateHookResponse, error) + // UpdateHook updates an existing hook + UpdateHook(ctx context.Context, in *MsgUpdateHook, opts ...grpc.CallOption) (*MsgUpdateHookResponse, error) + // DeleteHook removes a hook from the scheduler + DeleteHook(ctx context.Context, in *MsgDeleteHook, opts ...grpc.CallOption) (*MsgDeleteHookResponse, error) +} + +type msgClient struct { + cc grpc1.ClientConn +} + +func NewMsgClient(cc grpc1.ClientConn) MsgClient { + return &msgClient{cc} +} + +func (c *msgClient) CreateHook(ctx context.Context, in *MsgCreateHook, opts ...grpc.CallOption) (*MsgCreateHookResponse, error) { + out := new(MsgCreateHookResponse) + err := c.cc.Invoke(ctx, "/kujira.scheduler.Msg/CreateHook", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) UpdateHook(ctx context.Context, in *MsgUpdateHook, opts ...grpc.CallOption) (*MsgUpdateHookResponse, error) { + out := new(MsgUpdateHookResponse) + err := c.cc.Invoke(ctx, "/kujira.scheduler.Msg/UpdateHook", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *msgClient) DeleteHook(ctx context.Context, in *MsgDeleteHook, opts ...grpc.CallOption) (*MsgDeleteHookResponse, error) { + out := new(MsgDeleteHookResponse) + err := c.cc.Invoke(ctx, "/kujira.scheduler.Msg/DeleteHook", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// MsgServer is the server API for Msg service. +type MsgServer interface { + // CreateHook adds a new hook to the scheduler + CreateHook(context.Context, *MsgCreateHook) (*MsgCreateHookResponse, error) + // UpdateHook updates an existing hook + UpdateHook(context.Context, *MsgUpdateHook) (*MsgUpdateHookResponse, error) + // DeleteHook removes a hook from the scheduler + DeleteHook(context.Context, *MsgDeleteHook) (*MsgDeleteHookResponse, error) +} + +// UnimplementedMsgServer can be embedded to have forward compatible implementations. +type UnimplementedMsgServer struct { +} + +func (*UnimplementedMsgServer) CreateHook(ctx context.Context, req *MsgCreateHook) (*MsgCreateHookResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method CreateHook not implemented") +} +func (*UnimplementedMsgServer) UpdateHook(ctx context.Context, req *MsgUpdateHook) (*MsgUpdateHookResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateHook not implemented") +} +func (*UnimplementedMsgServer) DeleteHook(ctx context.Context, req *MsgDeleteHook) (*MsgDeleteHookResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method DeleteHook not implemented") +} + +func RegisterMsgServer(s grpc1.Server, srv MsgServer) { + s.RegisterService(&_Msg_serviceDesc, srv) +} + +func _Msg_CreateHook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgCreateHook) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).CreateHook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kujira.scheduler.Msg/CreateHook", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).CreateHook(ctx, req.(*MsgCreateHook)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_UpdateHook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateHook) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateHook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kujira.scheduler.Msg/UpdateHook", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateHook(ctx, req.(*MsgUpdateHook)) + } + return interceptor(ctx, in, info, handler) +} + +func _Msg_DeleteHook_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgDeleteHook) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).DeleteHook(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/kujira.scheduler.Msg/DeleteHook", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).DeleteHook(ctx, req.(*MsgDeleteHook)) + } + return interceptor(ctx, in, info, handler) +} + +var _Msg_serviceDesc = grpc.ServiceDesc{ + ServiceName: "kujira.scheduler.Msg", + HandlerType: (*MsgServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "CreateHook", + Handler: _Msg_CreateHook_Handler, + }, + { + MethodName: "UpdateHook", + Handler: _Msg_UpdateHook_Handler, + }, + { + MethodName: "DeleteHook", + Handler: _Msg_DeleteHook_Handler, + }, + }, + Streams: []grpc.StreamDesc{}, + Metadata: "kujira/scheduler/tx.proto", +} + +func (m *MsgCreateHook) 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 *MsgCreateHook) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateHook) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Funds) > 0 { + for iNdEx := len(m.Funds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Funds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x32 + } + } + if m.Frequency != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Frequency)) + i-- + dAtA[i] = 0x28 + } + if len(m.Msg) > 0 { + i -= len(m.Msg) + copy(dAtA[i:], m.Msg) + i = encodeVarintTx(dAtA, i, uint64(len(m.Msg))) + i-- + dAtA[i] = 0x22 + } + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0x1a + } + if len(m.Executor) > 0 { + i -= len(m.Executor) + copy(dAtA[i:], m.Executor) + i = encodeVarintTx(dAtA, i, uint64(len(m.Executor))) + 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 *MsgCreateHookResponse) 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 *MsgCreateHookResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgCreateHookResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgUpdateHook) 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 *MsgUpdateHook) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateHook) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Funds) > 0 { + for iNdEx := len(m.Funds) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Funds[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if m.Frequency != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Frequency)) + i-- + dAtA[i] = 0x30 + } + if len(m.Msg) > 0 { + i -= len(m.Msg) + copy(dAtA[i:], m.Msg) + i = encodeVarintTx(dAtA, i, uint64(len(m.Msg))) + i-- + dAtA[i] = 0x2a + } + if len(m.Contract) > 0 { + i -= len(m.Contract) + copy(dAtA[i:], m.Contract) + i = encodeVarintTx(dAtA, i, uint64(len(m.Contract))) + i-- + dAtA[i] = 0x22 + } + if len(m.Executor) > 0 { + i -= len(m.Executor) + copy(dAtA[i:], m.Executor) + i = encodeVarintTx(dAtA, i, uint64(len(m.Executor))) + i-- + dAtA[i] = 0x1a + } + if m.Id != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x10 + } + 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 *MsgUpdateHookResponse) 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 *MsgUpdateHookResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateHookResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *MsgDeleteHook) 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 *MsgDeleteHook) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeleteHook) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Id != 0 { + i = encodeVarintTx(dAtA, i, uint64(m.Id)) + i-- + dAtA[i] = 0x10 + } + 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 *MsgDeleteHookResponse) 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 *MsgDeleteHookResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgDeleteHookResponse) 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 + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *MsgCreateHook) 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 = len(m.Executor) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Msg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Frequency != 0 { + n += 1 + sovTx(uint64(m.Frequency)) + } + if len(m.Funds) > 0 { + for _, e := range m.Funds { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgCreateHookResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgUpdateHook) 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)) + } + if m.Id != 0 { + n += 1 + sovTx(uint64(m.Id)) + } + l = len(m.Executor) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Contract) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = len(m.Msg) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + if m.Frequency != 0 { + n += 1 + sovTx(uint64(m.Frequency)) + } + if len(m.Funds) > 0 { + for _, e := range m.Funds { + l = e.Size() + n += 1 + l + sovTx(uint64(l)) + } + } + return n +} + +func (m *MsgUpdateHookResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *MsgDeleteHook) 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)) + } + if m.Id != 0 { + n += 1 + sovTx(uint64(m.Id)) + } + return n +} + +func (m *MsgDeleteHookResponse) 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 +} +func sozTx(x uint64) (n int) { + return sovTx(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *MsgCreateHook) 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: MsgCreateHook: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateHook: 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 Executor", 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.Executor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contract", 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.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) + if m.Msg == nil { + m.Msg = []byte{} + } + iNdEx = postIndex + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Frequency", wireType) + } + m.Frequency = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Frequency |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Funds", 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 + } + m.Funds = append(m.Funds, types.Coin{}) + if err := m.Funds[len(m.Funds)-1].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 *MsgCreateHookResponse) 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: MsgCreateHookResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgCreateHookResponse: 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 (m *MsgUpdateHook) 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: MsgUpdateHook: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateHook: 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 != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Executor", 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.Executor = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 4: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Contract", 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.Contract = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Msg", wireType) + } + var byteLen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + byteLen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if byteLen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + byteLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Msg = append(m.Msg[:0], dAtA[iNdEx:postIndex]...) + if m.Msg == nil { + m.Msg = []byte{} + } + iNdEx = postIndex + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Frequency", wireType) + } + m.Frequency = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Frequency |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Funds", 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 + } + m.Funds = append(m.Funds, types.Coin{}) + if err := m.Funds[len(m.Funds)-1].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 *MsgUpdateHookResponse) 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: MsgUpdateHookResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateHookResponse: 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 (m *MsgDeleteHook) 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: MsgDeleteHook: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeleteHook: 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 != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) + } + m.Id = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.Id |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + 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 *MsgDeleteHookResponse) 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: MsgDeleteHookResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgDeleteHookResponse: 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 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowTx + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthTx + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupTx + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthTx + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthTx = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowTx = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupTx = fmt.Errorf("proto: unexpected end of group") +)