diff --git a/api/reserve/vaults/params.pulsar.go b/api/reserve/vaults/params.pulsar.go index 3caea97f..d0f914ef 100644 --- a/api/reserve/vaults/params.pulsar.go +++ b/api/reserve/vaults/params.pulsar.go @@ -132,12 +132,6 @@ func (x *fastReflection_Params) Range(f func(protoreflect.FieldDescriptor, proto return } } - if x.LiquidatePeriod != uint64(0) { - value := protoreflect.ValueOfUint64(x.LiquidatePeriod) - if !f(fd_Params_liquidate_period, value) { - return - } - } } // Has reports whether a field is populated. @@ -163,8 +157,6 @@ func (x *fastReflection_Params) Has(fd protoreflect.FieldDescriptor) bool { return x.MinInitialDebt != "" case "reserve.vaults.Params.recalculate_debt_period": return x.RecalculateDebtPeriod != uint64(0) - case "reserve.vaults.Params.liquidate_period": - return x.LiquidatePeriod != uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Params")) @@ -191,8 +183,6 @@ func (x *fastReflection_Params) Clear(fd protoreflect.FieldDescriptor) { x.MinInitialDebt = "" case "reserve.vaults.Params.recalculate_debt_period": x.RecalculateDebtPeriod = uint64(0) - case "reserve.vaults.Params.liquidate_period": - x.LiquidatePeriod = uint64(0) default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Params")) @@ -224,9 +214,6 @@ func (x *fastReflection_Params) Get(descriptor protoreflect.FieldDescriptor) pro case "reserve.vaults.Params.recalculate_debt_period": value := x.RecalculateDebtPeriod return protoreflect.ValueOfUint64(value) - case "reserve.vaults.Params.liquidate_period": - value := x.LiquidatePeriod - return protoreflect.ValueOfUint64(value) default: if descriptor.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Params")) @@ -257,8 +244,6 @@ func (x *fastReflection_Params) Set(fd protoreflect.FieldDescriptor, value proto x.MinInitialDebt = value.Interface().(string) case "reserve.vaults.Params.recalculate_debt_period": x.RecalculateDebtPeriod = value.Uint() - case "reserve.vaults.Params.liquidate_period": - x.LiquidatePeriod = value.Uint() default: if fd.IsExtension() { panic(fmt.Errorf("proto3 declared messages do not support extensions: reserve.vaults.Params")) @@ -404,9 +389,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { if x.RecalculateDebtPeriod != 0 { n += 1 + runtime.Sov(uint64(x.RecalculateDebtPeriod)) } - if x.LiquidatePeriod != 0 { - n += 1 + runtime.Sov(uint64(x.LiquidatePeriod)) - } if x.unknownFields != nil { n += len(x.unknownFields) } @@ -436,11 +418,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { i -= len(x.unknownFields) copy(dAtA[i:], x.unknownFields) } - if x.LiquidatePeriod != 0 { - i = runtime.EncodeVarint(dAtA, i, uint64(x.LiquidatePeriod)) - i-- - dAtA[i] = 0x30 - } if x.RecalculateDebtPeriod != 0 { i = runtime.EncodeVarint(dAtA, i, uint64(x.RecalculateDebtPeriod)) i-- @@ -670,25 +647,6 @@ func (x *fastReflection_Params) ProtoMethods() *protoiface.Methods { break } } - case 6: - if wireType != 0 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, fmt.Errorf("proto: wrong wireType = %d for field LiquidatePeriod", wireType) - } - x.LiquidatePeriod = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, runtime.ErrIntOverflow - } - if iNdEx >= l { - return protoiface.UnmarshalOutput{NoUnkeyedLiterals: input.NoUnkeyedLiterals, Flags: input.Flags}, io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - x.LiquidatePeriod |= uint64(b&0x7F) << shift - if b < 0x80 { - break - } - } default: iNdEx = preIndex skippy, err := runtime.Skip(dAtA[iNdEx:]) @@ -1296,7 +1254,6 @@ type Params struct { LiquidationPenalty string `protobuf:"bytes,3,opt,name=liquidation_penalty,json=liquidationPenalty,proto3" json:"liquidation_penalty,omitempty"` MinInitialDebt string `protobuf:"bytes,4,opt,name=min_initial_debt,json=minInitialDebt,proto3" json:"min_initial_debt,omitempty"` RecalculateDebtPeriod uint64 `protobuf:"varint,5,opt,name=recalculate_debt_period,json=recalculateDebtPeriod,proto3" json:"recalculate_debt_period,omitempty"` - LiquidatePeriod uint64 `protobuf:"varint,6,opt,name=liquidate_period,json=liquidatePeriod,proto3" json:"liquidate_period,omitempty"` } func (x *Params) Reset() { @@ -1354,13 +1311,6 @@ func (x *Params) GetRecalculateDebtPeriod() uint64 { return 0 } -func (x *Params) GetLiquidatePeriod() uint64 { - if x != nil { - return x.LiquidatePeriod - } - return 0 -} - // VaultParams defines the parameters for each collateral vault type. type VaultMamagerParams struct { state protoimpl.MessageState diff --git a/app/app.go b/app/app.go index ff2fc1a6..af18cb52 100644 --- a/app/app.go +++ b/app/app.go @@ -1,94 +1,65 @@ package app import ( + "encoding/json" + "fmt" "io" "os" "path/filepath" - _ "cosmossdk.io/api/cosmos/tx/config/v1" // import for side-effects - "cosmossdk.io/depinject" "cosmossdk.io/log" storetypes "cosmossdk.io/store/types" - _ "cosmossdk.io/x/circuit" // import for side-effects - circuitkeeper "cosmossdk.io/x/circuit/keeper" - _ "cosmossdk.io/x/evidence" // import for side-effects - evidencekeeper "cosmossdk.io/x/evidence/keeper" - feegrantkeeper "cosmossdk.io/x/feegrant/keeper" - _ "cosmossdk.io/x/feegrant/module" // import for side-effects - nftkeeper "cosmossdk.io/x/nft/keeper" - _ "cosmossdk.io/x/nft/module" // import for side-effects - _ "cosmossdk.io/x/upgrade" // import for side-effects - upgradekeeper "cosmossdk.io/x/upgrade/keeper" + dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/codec" - codectypes "github.com/cosmos/cosmos-sdk/codec/types" + + autocliv1 "cosmossdk.io/api/cosmos/autocli/v1" + reflectionv1 "cosmossdk.io/api/cosmos/reflection/v1" + autocli "cosmossdk.io/client/v2/autocli" + "cosmossdk.io/core/appmodule" + "cosmossdk.io/x/tx/signing" + abci "github.com/cometbft/cometbft/abci/types" + tmjson "github.com/cometbft/cometbft/libs/json" + tmos "github.com/cometbft/cometbft/libs/os" + "github.com/cosmos/cosmos-sdk/client/grpc/cmtservice" + nodeservice "github.com/cosmos/cosmos-sdk/client/grpc/node" + "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" + "github.com/cosmos/cosmos-sdk/std" + "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/x/auth" - authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" - authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" - _ "github.com/cosmos/cosmos-sdk/x/auth/tx/config" // import for side-effects + "github.com/cosmos/cosmos-sdk/types/msgservice" + sigtypes "github.com/cosmos/cosmos-sdk/types/tx/signing" + "github.com/cosmos/cosmos-sdk/version" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + authtx "github.com/cosmos/cosmos-sdk/x/auth/tx" + txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - _ "github.com/cosmos/cosmos-sdk/x/auth/vesting" // import for side-effects - authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" - _ "github.com/cosmos/cosmos-sdk/x/authz/module" // import for side-effects - _ "github.com/cosmos/cosmos-sdk/x/bank" // import for side-effects - bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" - _ "github.com/cosmos/cosmos-sdk/x/consensus" // import for side-effects - consensuskeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" - _ "github.com/cosmos/cosmos-sdk/x/crisis" // import for side-effects - crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" - _ "github.com/cosmos/cosmos-sdk/x/distribution" // import for side-effects - distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" - "github.com/cosmos/cosmos-sdk/x/genutil" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - "github.com/cosmos/cosmos-sdk/x/gov" - govclient "github.com/cosmos/cosmos-sdk/x/gov/client" - govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + "github.com/cosmos/cosmos-sdk/x/crisis" + + // govclient "github.com/cosmos/cosmos-sdk/x/gov/client" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - groupkeeper "github.com/cosmos/cosmos-sdk/x/group/keeper" - _ "github.com/cosmos/cosmos-sdk/x/group/module" // import for side-effects - _ "github.com/cosmos/cosmos-sdk/x/mint" // import for side-effects - mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" - _ "github.com/cosmos/cosmos-sdk/x/params" // import for side-effects - paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" - paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + // paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - _ "github.com/cosmos/cosmos-sdk/x/slashing" // import for side-effects - slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" - _ "github.com/cosmos/cosmos-sdk/x/staking" // import for side-effects - stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" - _ "github.com/cosmos/ibc-go/modules/capability" // import for side-effects - capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" - _ "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts" // import for side-effects - icacontrollerkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/controller/keeper" - icahostkeeper "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/host/keeper" - _ "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" // import for side-effects - ibcfeekeeper "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/keeper" - ibctransferkeeper "github.com/cosmos/ibc-go/v8/modules/apps/transfer/keeper" + "github.com/cosmos/gogoproto/proto" ibckeeper "github.com/cosmos/ibc-go/v8/modules/core/keeper" ibctestingtypes "github.com/cosmos/ibc-go/v8/testing/types" - - auctionkeeper "github.com/onomyprotocol/reserve/x/auction/keeper" - oraclemodulekeeper "github.com/onomyprotocol/reserve/x/oracle/keeper" - psmkeeper "github.com/onomyprotocol/reserve/x/psm/keeper" - vaultskeeper "github.com/onomyprotocol/reserve/x/vaults/keeper" - - // this line is used by starport scaffolding # stargate/app/moduleImport - - "github.com/onomyprotocol/reserve/docs" + "github.com/onomyprotocol/reserve/app/keepers" + "github.com/spf13/cast" ) const ( AccountAddressPrefix = "onomy" - Name = "reserve" + AppName = "reserve" ) var ( @@ -105,56 +76,23 @@ var ( // They are exported for convenience in creating helper functions, as object // capabilities aren't needed for testing. type App struct { - *runtime.App + *baseapp.BaseApp + keepers.AppKeepers + legacyAmino *codec.LegacyAmino appCodec codec.Codec txConfig client.TxConfig - interfaceRegistry codectypes.InterfaceRegistry - - // keepers - AccountKeeper authkeeper.AccountKeeper - BankKeeper bankkeeper.Keeper - StakingKeeper *stakingkeeper.Keeper - DistrKeeper distrkeeper.Keeper - ConsensusParamsKeeper consensuskeeper.Keeper - - SlashingKeeper slashingkeeper.Keeper - MintKeeper mintkeeper.Keeper - GovKeeper *govkeeper.Keeper - CrisisKeeper *crisiskeeper.Keeper - UpgradeKeeper *upgradekeeper.Keeper - ParamsKeeper paramskeeper.Keeper - AuthzKeeper authzkeeper.Keeper - EvidenceKeeper evidencekeeper.Keeper - FeeGrantKeeper feegrantkeeper.Keeper - GroupKeeper groupkeeper.Keeper - NFTKeeper nftkeeper.Keeper - CircuitBreakerKeeper circuitkeeper.Keeper - - // IBC - IBCKeeper *ibckeeper.Keeper // IBC Keeper must be a pointer in the app, so we can SetRouter on it correctly - CapabilityKeeper *capabilitykeeper.Keeper - IBCFeeKeeper ibcfeekeeper.Keeper - ICAControllerKeeper icacontrollerkeeper.Keeper - ICAHostKeeper icahostkeeper.Keeper - TransferKeeper ibctransferkeeper.Keeper - - // Scoped IBC - ScopedIBCKeeper capabilitykeeper.ScopedKeeper - ScopedIBCTransferKeeper capabilitykeeper.ScopedKeeper - ScopedICAControllerKeeper capabilitykeeper.ScopedKeeper - ScopedICAHostKeeper capabilitykeeper.ScopedKeeper - ScopedKeepers map[string]capabilitykeeper.ScopedKeeper - // ScopedOracleKeeper capabilitykeeper.ScopedKeeper - - OracleKeeper oraclemodulekeeper.Keeper - VaultsKeeper vaultskeeper.Keeper - PSMKeeper psmkeeper.Keeper - AuctionKeeper auctionkeeper.Keeper - // this line is used by starport scaffolding # stargate/app/keeperDeclaration + interfaceRegistry types.InterfaceRegistry + + invCheckPeriod uint + + // the module manager + mm *module.Manager + ModuleBasics module.BasicManager // simulation manager - sm *module.SimulationManager + sm *module.SimulationManager + configurator module.Configurator } func init() { @@ -163,7 +101,7 @@ func init() { panic(err) } - DefaultNodeHome = filepath.Join(userHomeDir, "."+Name) + DefaultNodeHome = filepath.Join(userHomeDir, "."+AppName) // Set prefixes accountPubKeyPrefix := AccountAddressPrefix + "pub" @@ -180,213 +118,189 @@ func init() { config.Seal() } -// getGovProposalHandlers return the chain proposal handlers. -func getGovProposalHandlers() []govclient.ProposalHandler { - var govProposalHandlers []govclient.ProposalHandler - // this line is used by starport scaffolding # stargate/app/govProposalHandlers - - govProposalHandlers = append(govProposalHandlers, - paramsclient.ProposalHandler, - // this line is used by starport scaffolding # stargate/app/govProposalHandler - ) - - return govProposalHandlers -} - -// AppConfig returns the default app config. -func AppConfig() depinject.Config { - return depinject.Configs( - appConfig, - // Loads the app config from a YAML file. - // appconfig.LoadYAML(AppConfigYAML), - depinject.Supply( - // supply custom module basics - map[string]module.AppModuleBasic{ - genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), - govtypes.ModuleName: gov.NewAppModuleBasic(getGovProposalHandlers()), - // this line is used by starport scaffolding # stargate/appConfig/moduleBasic - }, - ), - ) -} - -// New returns a reference to an initialized App. -func New( +// NewGaiaApp returns a reference to an initialized Gaia. +func NewApp( logger log.Logger, db dbm.DB, traceStore io.Writer, loadLatest bool, + skipUpgradeHeights map[int64]bool, + homePath string, appOpts servertypes.AppOptions, baseAppOptions ...func(*baseapp.BaseApp), -) (*App, error) { - var ( - app = &App{ScopedKeepers: make(map[string]capabilitykeeper.ScopedKeeper)} - appBuilder *runtime.AppBuilder - - // merge the AppConfig and other configuration in one config - appConfig = depinject.Configs( - AppConfig(), - depinject.Supply( - // Supply the application options - appOpts, - // Supply with IBC keeper getter for the IBC modules with App Wiring. - // The IBC Keeper cannot be passed because it has not been initiated yet. - // Passing the getter, the app IBC Keeper will always be accessible. - // This needs to be removed after IBC supports App Wiring. - app.GetIBCKeeper, - app.GetCapabilityScopedKeeper, - // Supply the logger - logger, - - // ADVANCED CONFIGURATION - // - // AUTH - // - // For providing a custom function required in auth to generate custom account types - // add it below. By default the auth module uses simulation.RandomGenesisAccounts. - // - // authtypes.RandomGenesisAccountsFn(simulation.RandomGenesisAccounts), - // - // For providing a custom a base account type add it below. - // By default the auth module uses authtypes.ProtoBaseAccount(). - // - // func() sdk.AccountI { return authtypes.ProtoBaseAccount() }, - // - // For providing a different address codec, add it below. - // By default the auth module uses a Bech32 address codec, - // with the prefix defined in the auth module configuration. - // - // func() address.Codec { return <- custom address codec type -> } - - // - // STAKING - // - // For provinding a different validator and consensus address codec, add it below. - // By default the staking module uses the bech32 prefix provided in the auth config, - // and appends "valoper" and "valcons" for validator and consensus addresses respectively. - // When providing a custom address codec in auth, custom address codecs must be provided here as well. - // - // func() runtime.ValidatorAddressCodec { return <- custom validator address codec type -> } - // func() runtime.ConsensusAddressCodec { return <- custom consensus address codec type -> } - - // - // MINT - // - - // For providing a custom inflation function for x/mint add here your - // custom function that implements the minttypes.InflationCalculationFn - // interface. - ), - ) - ) - - if err := depinject.Inject(appConfig, - &appBuilder, - &app.appCodec, - &app.legacyAmino, - &app.txConfig, - &app.interfaceRegistry, - &app.AccountKeeper, - &app.BankKeeper, - &app.StakingKeeper, - &app.DistrKeeper, - &app.ConsensusParamsKeeper, - &app.SlashingKeeper, - &app.MintKeeper, - &app.GovKeeper, - &app.CrisisKeeper, - &app.UpgradeKeeper, - &app.ParamsKeeper, - &app.AuthzKeeper, - &app.EvidenceKeeper, - &app.FeeGrantKeeper, - &app.NFTKeeper, - &app.GroupKeeper, - &app.CircuitBreakerKeeper, - &app.OracleKeeper, - &app.VaultsKeeper, - &app.PSMKeeper, - &app.AuctionKeeper, - // this line is used by starport scaffolding # stargate/app/keeperDefinition - ); err != nil { +) *App { + legacyAmino := codec.NewLegacyAmino() + interfaceRegistry, err := types.NewInterfaceRegistryWithOptions(types.InterfaceRegistryOptions{ + ProtoFiles: proto.HybridResolver, + SigningOptions: signing.Options{ + AddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32AccountAddrPrefix(), + }, + ValidatorAddressCodec: address.Bech32Codec{ + Bech32Prefix: sdk.GetConfig().GetBech32ValidatorAddrPrefix(), + }, + }, + }) + if err != nil { panic(err) } + appCodec := codec.NewProtoCodec(interfaceRegistry) + txConfig := authtx.NewTxConfig(appCodec, authtx.DefaultSignModes) + + std.RegisterLegacyAminoCodec(legacyAmino) + std.RegisterInterfaces(interfaceRegistry) + + // App Opts + skipGenesisInvariants := cast.ToBool(appOpts.Get(crisis.FlagSkipGenesisInvariants)) + invCheckPeriod := cast.ToUint(appOpts.Get(server.FlagInvCheckPeriod)) + + bApp := baseapp.NewBaseApp( + AppName, + logger, + db, + txConfig.TxDecoder(), + baseAppOptions...) + + bApp.SetCommitMultiStoreTracer(traceStore) + bApp.SetVersion(version.Version) + bApp.SetInterfaceRegistry(interfaceRegistry) + bApp.SetTxEncoder(txConfig.TxEncoder()) + + app := &App{ + BaseApp: bApp, + legacyAmino: legacyAmino, + txConfig: txConfig, + appCodec: appCodec, + interfaceRegistry: interfaceRegistry, + invCheckPeriod: invCheckPeriod, + } - // Below we could construct and set an application specific mempool and - // ABCI 1.0 PrepareProposal and ProcessProposal handlers. These defaults are - // already set in the SDK's BaseApp, this shows an example of how to override - // them. - // - // Example: - // - // app.App = appBuilder.Build(...) - // nonceMempool := mempool.NewSenderNonceMempool() - // abciPropHandler := NewDefaultProposalHandler(nonceMempool, app.App.BaseApp) - // - // app.App.BaseApp.SetMempool(nonceMempool) - // app.App.BaseApp.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) - // app.App.BaseApp.SetProcessProposal(abciPropHandler.ProcessProposalHandler()) - // - // Alternatively, you can construct BaseApp options, append those to - // baseAppOptions and pass them to the appBuilder. - // - // Example: - // - // prepareOpt = func(app *baseapp.BaseApp) { - // abciPropHandler := baseapp.NewDefaultProposalHandler(nonceMempool, app) - // app.SetPrepareProposal(abciPropHandler.PrepareProposalHandler()) - // } - // baseAppOptions = append(baseAppOptions, prepareOpt) - // - // create and set vote extension handler - // voteExtOp := func(bApp *baseapp.BaseApp) { - // voteExtHandler := NewVoteExtensionHandler() - // voteExtHandler.SetHandlers(bApp) - // } + moduleAccountAddresses := app.ModuleAccountAddrs() + + // Setup keepers + app.AppKeepers = keepers.NewAppKeeper( + appCodec, + bApp, + legacyAmino, + maccPerms, + moduleAccountAddresses, + app.BlockedModuleAccountAddrs(moduleAccountAddresses), + skipUpgradeHeights, + homePath, + invCheckPeriod, + logger, + appOpts, + ) - app.App = appBuilder.Build(db, traceStore, baseAppOptions...) + // NOTE: Any module instantiated in the module manager that is later modified + // must be passed by reference here. + // fmt.Println(txConfig.NewTxBuilder() == nil) + app.mm = module.NewManager(appModules(app, appCodec, txConfig, skipGenesisInvariants)...) + app.ModuleBasics = newBasicManagerFromManager(app) - // Register legacy modules - if err := app.registerIBCModules(); err != nil { - return nil, err - } + enabledSignModes := append([]sigtypes.SignMode(nil), authtx.DefaultSignModes...) + enabledSignModes = append(enabledSignModes, sigtypes.SignMode_SIGN_MODE_TEXTUAL) - // register streaming services - if err := app.RegisterStreamingServices(appOpts, app.kvStoreKeys()); err != nil { - return nil, err + txConfigOpts := authtx.ConfigOptions{ + EnabledSignModes: enabledSignModes, + TextualCoinMetadataQueryFn: txmodule.NewBankKeeperCoinMetadataQueryFn(app.BankKeeper), } + txConfig, err = authtx.NewTxConfigWithOptions( + appCodec, + txConfigOpts, + ) + if err != nil { + panic(err) + } + app.txConfig = txConfig + + // NOTE: upgrade module is required to be prioritized + // 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 + // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) + // Tell the app's module manager how to set the order of BeginBlockers, which are run at the beginning of every block. + app.mm.SetOrderBeginBlockers(orderBeginBlockers()...) + + app.mm.SetOrderEndBlockers(orderEndBlockers()...) + + // NOTE: The genutils module must occur after staking so that pools are + // properly initialized with tokens from genesis accounts. + // NOTE: The genutils module must also occur after auth so that it can access the params from auth. + // NOTE: Capability module must occur first so that it can initialize any capabilities + // so that other modules that want to create or claim capabilities afterwards in InitChain + // can do so safely. + app.mm.SetOrderInitGenesis(orderInitBlockers()...) + + // Uncomment if you want to set a custom migration order here. + // app.mm.SetOrderMigrations(custom order) + + app.mm.RegisterInvariants(app.CrisisKeeper) + app.configurator = module.NewConfigurator(app.appCodec, app.MsgServiceRouter(), app.GRPCQueryRouter()) + err = app.mm.RegisterServices(app.configurator) + if err != nil { + panic(err) + } + + autocliv1.RegisterQueryServer(app.GRPCQueryRouter(), runtimeservices.NewAutoCLIQueryService(app.mm.Modules)) - /**** Module Options ****/ + reflectionSvc, err := runtimeservices.NewReflectionService() + if err != nil { + panic(err) + } + reflectionv1.RegisterReflectionServiceServer(app.GRPCQueryRouter(), reflectionSvc) - app.ModuleManager.RegisterInvariants(app.CrisisKeeper) + // add test gRPC service for testing gRPC queries in isolation + testdata.RegisterQueryServer(app.GRPCQueryRouter(), testdata.QueryImpl{}) // create the simulation manager and define the order of the modules for deterministic simulations // - // NOTE: this is not required apps that don't use the simulator for fuzz testing transactions - overrideModules := map[string]module.AppModuleSimulation{ - authtypes.ModuleName: auth.NewAppModule(app.appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), - } - app.sm = module.NewSimulationManagerFromAppModules(app.ModuleManager.Modules, overrideModules) + // NOTE: this is not required apps that don't use the simulator for fuzz testing + // transactions + app.sm = module.NewSimulationManager(simulationModules(app, appCodec, skipGenesisInvariants)...) + app.sm.RegisterStoreDecoders() - // A custom InitChainer can be set if extra pre-init-genesis logic is required. - // By default, when using app wiring enabled module, this is not required. - // For instance, the upgrade module will set automatically the module version map in its init genesis thanks to app wiring. - // However, when registering a module manually (i.e. that does not support app wiring), the module version map - // must be set manually as follow. The upgrade module will de-duplicate the module version map. - // - // app.SetInitChainer(func(ctx sdk.Context, req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { - // app.UpgradeKeeper.SetModuleVersionMap(ctx, app.ModuleManager.GetVersionMap()) - // return app.App.InitChainer(ctx, req) - // }) + // initialize stores + app.MountKVStores(app.GetKVStoreKey()) + app.MountTransientStores(app.GetTransientStoreKey()) + app.MountMemoryStores(app.GetMemoryStoreKey()) + + app.SetInitChainer(app.InitChainer) + app.SetPreBlocker(app.PreBlocker) + app.SetBeginBlocker(app.BeginBlocker) + app.SetEndBlocker(app.EndBlocker) + + // app.setupUpgradeHandlers() + app.setupUpgradeStoreLoaders() - if err := app.Load(loadLatest); err != nil { - return nil, err + // At startup, after all modules have been registered, check that all prot + // annotations are correct. + protoFiles, err := proto.MergedRegistry() + if err != nil { + panic(err) + } + err = msgservice.ValidateProtoAnnotations(protoFiles) + if err != nil { + // Once we switch to using protoreflect-based antehandlers, we might + // want to panic here instead of logging a warning. + fmt.Fprintln(os.Stderr, err.Error()) } - return app, nil + if loadLatest { + if err := app.LoadLatestVersion(); err != nil { + tmos.Exit(fmt.Sprintf("failed to load latest version: %s", err)) + } + } + + // fmt.Println("new_app=0", app.ModuleBasics["bank"] == nil) + return app } +// Name returns the name of the App +func (app *App) Name() string { return app.BaseApp.Name() } + // LegacyAmino returns App's amino codec. // // NOTE: This is solely to be used for testing purposes as it may be desirable @@ -405,33 +319,18 @@ func (app *App) AppCodec() codec.Codec { // GetKey returns the KVStoreKey for the provided store key. func (app *App) GetKey(storeKey string) *storetypes.KVStoreKey { - kvStoreKey, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.KVStoreKey) - if !ok { - return nil - } - return kvStoreKey + return app.AppKeepers.GetKey(storeKey) } // GetMemKey returns the MemoryStoreKey for the provided store key. func (app *App) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { - key, ok := app.UnsafeFindStoreKey(storeKey).(*storetypes.MemoryStoreKey) - if !ok { - return nil - } - - return key + return app.AppKeepers.GetMemKey(storeKey) } // kvStoreKeys returns all the kv store keys registered inside App. -func (app *App) kvStoreKeys() map[string]*storetypes.KVStoreKey { - keys := make(map[string]*storetypes.KVStoreKey) - for _, k := range app.GetStoreKeys() { - if kv, ok := k.(*storetypes.KVStoreKey); ok { - keys[kv.Name()] = kv - } - } +func (app *App) KvStoreKeys() map[string]*storetypes.KVStoreKey { - return keys + return app.AppKeepers.GetKVStoreKey() } // GetSubspace returns a param subspace for a given module name. @@ -445,16 +344,6 @@ func (app *App) GetIBCKeeper() *ibckeeper.Keeper { return app.IBCKeeper } -// GetCapabilityScopedKeeper returns the capability scoped keeper. -func (app *App) GetCapabilityScopedKeeper(moduleName string) capabilitykeeper.ScopedKeeper { - sk, ok := app.ScopedKeepers[moduleName] - if !ok { - sk = app.CapabilityKeeper.ScopeToModule(moduleName) - app.ScopedKeepers[moduleName] = sk - } - return sk -} - // SimulationManager implements the SimulationApp interface. func (app *App) SimulationManager() *module.SimulationManager { return app.sm @@ -463,50 +352,147 @@ func (app *App) SimulationManager() *module.SimulationManager { // RegisterAPIRoutes registers all application module routes with the provided // API server. func (app *App) RegisterAPIRoutes(apiSvr *api.Server, apiConfig config.APIConfig) { - app.App.RegisterAPIRoutes(apiSvr, apiConfig) - // register swagger API in app.go so that other applications can override easily + clientCtx := apiSvr.ClientCtx + // Register new tx routes from grpc-gateway. + authtx.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + // Register new tendermint queries routes from grpc-gateway. + cmtservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // Register legacy and grpc-gateway routes for all modules. + app.ModuleBasics.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // Register nodeservice grpc-gateway routes. + nodeservice.RegisterGRPCGatewayRoutes(clientCtx, apiSvr.GRPCGatewayRouter) + + // register swagger API from root so that other applications can override easily if err := server.RegisterSwaggerAPI(apiSvr.ClientCtx, apiSvr.Router, apiConfig.Swagger); err != nil { panic(err) } +} - // register app's OpenAPI routes. - docs.RegisterOpenAPIService(Name, apiSvr.Router) +// GetMaccPerms returns a copy of the module account permissions +// +// NOTE: This is solely to be used for testing purposes. +func GetMaccPerms() map[string][]string { + dup := make(map[string][]string) + for k, v := range maccPerms { + dup[k] = v + } + return dup } -func (app *App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } +func (app *App) BlockedModuleAccountAddrs(modAccAddrs map[string]bool) map[string]bool { + // remove module accounts that are ALLOWED to received funds + delete(modAccAddrs, authtypes.NewModuleAddress(govtypes.ModuleName).String()) + return modAccAddrs +} -func (app *App) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { - return app.ScopedIBCKeeper +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) + } + + if err := app.UpgradeKeeper.SetModuleVersionMap(ctx, app.mm.GetVersionMap()); err != nil { + panic(err) + } + + response, err := app.mm.InitGenesis(ctx, app.appCodec, genesisState) + if err != nil { + panic(err) + } + + return response, nil } -func (app *App) GetStakingKeeper() ibctestingtypes.StakingKeeper { - return app.StakingKeeper +func (app *App) PreBlocker(ctx sdk.Context, _ *abci.RequestFinalizeBlock) (*sdk.ResponsePreBlock, error) { + return app.mm.PreBlock(ctx) } -func (app *App) GetTxConfig() client.TxConfig { return app.txConfig } +func (app *App) BeginBlocker(ctx sdk.Context) (sdk.BeginBlock, error) { + return app.mm.BeginBlock(ctx) +} -// GetMaccPerms returns a copy of the module account permissions -// -// NOTE: This is solely to be used for testing purposes. -func GetMaccPerms() map[string][]string { - dup := make(map[string][]string) - for _, perms := range moduleAccPerms { - dup[perms.Account] = perms.Permissions +func (app *App) EndBlocker(ctx sdk.Context) (sdk.EndBlock, error) { + return app.mm.EndBlock(ctx) +} + +func (app *App) setupUpgradeStoreLoaders() { + upgradeInfo, err := app.UpgradeKeeper.ReadUpgradeInfoFromDisk() + if err != nil { + panic(fmt.Sprintf("failed to read upgrade info from disk %s", err)) + } + + if app.UpgradeKeeper.IsSkipHeight(upgradeInfo.Height) { + return } - return dup } -// BlockedAddresses returns all the app's blocked account addresses. -func BlockedAddresses() map[string]bool { - result := make(map[string]bool) - if len(blockAccAddrs) > 0 { - for _, addr := range blockAccAddrs { - result[addr] = true - } - } else { - for addr := range GetMaccPerms() { - result[addr] = true +func (app *App) LoadHeight(height int64) error { + return app.LoadVersion(height) +} + +func (app *App) RegisterNodeService(clientCtx client.Context, cfg config.Config) { + nodeservice.RegisterNodeService(clientCtx, app.GRPCQueryRouter(), cfg) +} + +func (app *App) RegisterTendermintService(clientCtx client.Context) { + cmtservice.RegisterTendermintService( + clientCtx, + app.BaseApp.GRPCQueryRouter(), + app.interfaceRegistry, + app.Query, + ) +} + +func (app *App) RegisterTxService(clientCtx client.Context) { + authtx.RegisterTxService(app.BaseApp.GRPCQueryRouter(), clientCtx, app.BaseApp.Simulate, app.interfaceRegistry) +} + +func (app *App) ModuleAccountAddrs() map[string]bool { + modAccAddrs := make(map[string]bool) + for acc := range maccPerms { + modAccAddrs[authtypes.NewModuleAddress(acc).String()] = true + } + + return modAccAddrs +} + +// 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.mm.Modules { + if moduleWithName, ok := m.(module.HasName); ok { + moduleName := moduleWithName.Name() + if appModule, ok := moduleWithName.(appmodule.AppModule); ok { + modules[moduleName] = appModule + } } } - return result + + return autocli.AppOptions{ + Modules: modules, + AddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + ValidatorAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + ConsensusAddressCodec: authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), + } +} + +func (app *App) GetTxConfig() client.TxConfig { + return app.txConfig +} + +func (app *App) InterfaceRegistry() types.InterfaceRegistry { + return app.interfaceRegistry +} + +// DefaultGenesis returns a default genesis from the registered AppModuleBasic's. +func (a *App) DefaultGenesis() map[string]json.RawMessage { + return a.ModuleBasics.DefaultGenesis(a.appCodec) +} + +func (app *App) GetBaseApp() *baseapp.BaseApp { return app.BaseApp } + +func (app *App) GetStakingKeeper() ibctestingtypes.StakingKeeper { + return app.StakingKeeper } diff --git a/app/app_config.go b/app/app_config.go deleted file mode 100644 index d285c7d8..00000000 --- a/app/app_config.go +++ /dev/null @@ -1,338 +0,0 @@ -package app - -import ( - "time" - - auctionmodulev1 "github.com/onomyprotocol/reserve/api/reserve/auction/module" - oraclemodulev1 "github.com/onomyprotocol/reserve/api/reserve/oracle/module" - psmmodulev1 "github.com/onomyprotocol/reserve/api/reserve/psm/module/v1" - vaultmodulev1 "github.com/onomyprotocol/reserve/api/reserve/vaults/module" - auctionmoduletypes "github.com/onomyprotocol/reserve/x/auction/types" - _ "github.com/onomyprotocol/reserve/x/oracle/module" // import for side-effects - - _ "github.com/onomyprotocol/reserve/x/auction/module" // import for side-effects - oraclemoduletypes "github.com/onomyprotocol/reserve/x/oracle/types" - psmtypes "github.com/onomyprotocol/reserve/x/psm/types" - _ "github.com/onomyprotocol/reserve/x/vaults/module" // import for side-effects - vaultsmoduletypes "github.com/onomyprotocol/reserve/x/vaults/types" - - runtimev1alpha1 "cosmossdk.io/api/cosmos/app/runtime/v1alpha1" - appv1alpha1 "cosmossdk.io/api/cosmos/app/v1alpha1" - authmodulev1 "cosmossdk.io/api/cosmos/auth/module/v1" - authzmodulev1 "cosmossdk.io/api/cosmos/authz/module/v1" - bankmodulev1 "cosmossdk.io/api/cosmos/bank/module/v1" - circuitmodulev1 "cosmossdk.io/api/cosmos/circuit/module/v1" - consensusmodulev1 "cosmossdk.io/api/cosmos/consensus/module/v1" - crisismodulev1 "cosmossdk.io/api/cosmos/crisis/module/v1" - distrmodulev1 "cosmossdk.io/api/cosmos/distribution/module/v1" - evidencemodulev1 "cosmossdk.io/api/cosmos/evidence/module/v1" - feegrantmodulev1 "cosmossdk.io/api/cosmos/feegrant/module/v1" - genutilmodulev1 "cosmossdk.io/api/cosmos/genutil/module/v1" - govmodulev1 "cosmossdk.io/api/cosmos/gov/module/v1" - groupmodulev1 "cosmossdk.io/api/cosmos/group/module/v1" - mintmodulev1 "cosmossdk.io/api/cosmos/mint/module/v1" - nftmodulev1 "cosmossdk.io/api/cosmos/nft/module/v1" - paramsmodulev1 "cosmossdk.io/api/cosmos/params/module/v1" - slashingmodulev1 "cosmossdk.io/api/cosmos/slashing/module/v1" - stakingmodulev1 "cosmossdk.io/api/cosmos/staking/module/v1" - txconfigv1 "cosmossdk.io/api/cosmos/tx/config/v1" - upgrademodulev1 "cosmossdk.io/api/cosmos/upgrade/module/v1" - vestingmodulev1 "cosmossdk.io/api/cosmos/vesting/module/v1" - "cosmossdk.io/core/appconfig" - circuittypes "cosmossdk.io/x/circuit/types" - evidencetypes "cosmossdk.io/x/evidence/types" - "cosmossdk.io/x/feegrant" - "cosmossdk.io/x/nft" - upgradetypes "cosmossdk.io/x/upgrade/types" - "github.com/cosmos/cosmos-sdk/runtime" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" - "github.com/cosmos/cosmos-sdk/x/authz" - banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" - consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" - crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" - distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" - genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - "github.com/cosmos/cosmos-sdk/x/group" - minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - 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" - icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" - ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" - ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" - ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" - "google.golang.org/protobuf/types/known/durationpb" - // this line is used by starport scaffolding # stargate/app/moduleImport -) - -var ( - // NOTE: The genutils module must occur after staking so that pools are - // properly initialized with tokens from genesis accounts. - // NOTE: The genutils module must also occur after auth so that it can access the params from auth. - // NOTE: Capability module must occur first so that it can initialize any capabilities - // so that other modules that want to create or claim capabilities afterwards in InitChain - // can do so safely. - genesisModuleOrder = []string{ - // cosmos-sdk/ibc modules - capabilitytypes.ModuleName, - authtypes.ModuleName, - banktypes.ModuleName, - distrtypes.ModuleName, - stakingtypes.ModuleName, - slashingtypes.ModuleName, - govtypes.ModuleName, - minttypes.ModuleName, - crisistypes.ModuleName, - ibcexported.ModuleName, - genutiltypes.ModuleName, - evidencetypes.ModuleName, - authz.ModuleName, - ibctransfertypes.ModuleName, - icatypes.ModuleName, - ibcfeetypes.ModuleName, - feegrant.ModuleName, - paramstypes.ModuleName, - upgradetypes.ModuleName, - vestingtypes.ModuleName, - circuittypes.ModuleName, - nft.ModuleName, - group.ModuleName, - consensustypes.ModuleName, - circuittypes.ModuleName, - // chain modules - oraclemoduletypes.ModuleName, - vaultsmoduletypes.ModuleName, - psmtypes.ModuleName, - auctionmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/initGenesis - } - - // 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 - // NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) - beginBlockers = []string{ - // cosmos sdk modules - minttypes.ModuleName, - distrtypes.ModuleName, - slashingtypes.ModuleName, - evidencetypes.ModuleName, - stakingtypes.ModuleName, - authz.ModuleName, - genutiltypes.ModuleName, - // ibc modules - capabilitytypes.ModuleName, - ibcexported.ModuleName, - ibctransfertypes.ModuleName, - icatypes.ModuleName, - ibcfeetypes.ModuleName, - // chain modules - oraclemoduletypes.ModuleName, - vaultsmoduletypes.ModuleName, - psmtypes.ModuleName, - auctionmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/beginBlockers - } - - endBlockers = []string{ - // cosmos sdk modules - crisistypes.ModuleName, - govtypes.ModuleName, - stakingtypes.ModuleName, - feegrant.ModuleName, - group.ModuleName, - genutiltypes.ModuleName, - // ibc modules - ibcexported.ModuleName, - ibctransfertypes.ModuleName, - capabilitytypes.ModuleName, - icatypes.ModuleName, - ibcfeetypes.ModuleName, - // chain modules - oraclemoduletypes.ModuleName, - vaultsmoduletypes.ModuleName, - psmtypes.ModuleName, - auctionmoduletypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/endBlockers - } - - preBlockers = []string{ - upgradetypes.ModuleName, - // this line is used by starport scaffolding # stargate/app/preBlockers - } - - // module account permissions - moduleAccPerms = []*authmodulev1.ModuleAccountPermission{ - {Account: authtypes.FeeCollectorName}, - {Account: distrtypes.ModuleName}, - {Account: minttypes.ModuleName, Permissions: []string{authtypes.Minter}}, - {Account: stakingtypes.BondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, - {Account: stakingtypes.NotBondedPoolName, Permissions: []string{authtypes.Burner, stakingtypes.ModuleName}}, - {Account: govtypes.ModuleName, Permissions: []string{authtypes.Burner}}, - {Account: nft.ModuleName}, - {Account: ibctransfertypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, - {Account: ibcfeetypes.ModuleName}, - {Account: icatypes.ModuleName}, - {Account: psmtypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, - // this line is used by starport scaffolding # stargate/app/maccPerms - {Account: vaultsmoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, - {Account: vaultsmoduletypes.ReserveModuleName, Permissions: []string{authtypes.Burner}}, - {Account: auctionmoduletypes.ModuleName, Permissions: []string{authtypes.Minter, authtypes.Burner}}, - } - - // blocked account addresses - blockAccAddrs = []string{ - authtypes.FeeCollectorName, - distrtypes.ModuleName, - minttypes.ModuleName, - stakingtypes.BondedPoolName, - stakingtypes.NotBondedPoolName, - nft.ModuleName, - // We allow the following module accounts to receive funds: - // govtypes.ModuleName - } - - // appConfig application configuration (used by depinject) - appConfig = appconfig.Compose(&appv1alpha1.Config{ - Modules: []*appv1alpha1.ModuleConfig{ - { - Name: runtime.ModuleName, - Config: appconfig.WrapAny(&runtimev1alpha1.Module{ - AppName: Name, - PreBlockers: preBlockers, - BeginBlockers: beginBlockers, - EndBlockers: endBlockers, - InitGenesis: genesisModuleOrder, - OverrideStoreKeys: []*runtimev1alpha1.StoreKeyConfig{ - { - ModuleName: authtypes.ModuleName, - KvStoreKey: "acc", - }, - }, - // When ExportGenesis is not specified, the export genesis module order - // is equal to the init genesis order - // ExportGenesis: genesisModuleOrder, - // Uncomment if you want to set a custom migration order here. - // OrderMigrations: nil, - }), - }, - { - Name: authtypes.ModuleName, - Config: appconfig.WrapAny(&authmodulev1.Module{ - Bech32Prefix: AccountAddressPrefix, - ModuleAccountPermissions: moduleAccPerms, - // By default modules authority is the governance module. This is configurable with the following: - // Authority: "group", // A custom module authority can be set using a module name - // Authority: "cosmos1cwwv22j5ca08ggdv9c2uky355k908694z577tv", // or a specific address - }), - }, - { - Name: nft.ModuleName, - Config: appconfig.WrapAny(&nftmodulev1.Module{}), - }, - { - Name: vestingtypes.ModuleName, - Config: appconfig.WrapAny(&vestingmodulev1.Module{}), - }, - { - Name: banktypes.ModuleName, - Config: appconfig.WrapAny(&bankmodulev1.Module{ - BlockedModuleAccountsOverride: blockAccAddrs, - }), - }, - { - Name: stakingtypes.ModuleName, - Config: appconfig.WrapAny(&stakingmodulev1.Module{ - // NOTE: specifying a prefix is only necessary when using bech32 addresses - // If not specfied, the auth Bech32Prefix appended with "valoper" and "valcons" is used by default - Bech32PrefixValidator: AccountAddressPrefix + "valoper", - Bech32PrefixConsensus: AccountAddressPrefix + "valcons", - }), - }, - { - Name: slashingtypes.ModuleName, - Config: appconfig.WrapAny(&slashingmodulev1.Module{}), - }, - { - Name: paramstypes.ModuleName, - Config: appconfig.WrapAny(¶msmodulev1.Module{}), - }, - { - Name: "tx", - Config: appconfig.WrapAny(&txconfigv1.Config{}), - }, - { - Name: genutiltypes.ModuleName, - Config: appconfig.WrapAny(&genutilmodulev1.Module{}), - }, - { - Name: authz.ModuleName, - Config: appconfig.WrapAny(&authzmodulev1.Module{}), - }, - { - Name: upgradetypes.ModuleName, - Config: appconfig.WrapAny(&upgrademodulev1.Module{}), - }, - { - Name: distrtypes.ModuleName, - Config: appconfig.WrapAny(&distrmodulev1.Module{}), - }, - { - Name: evidencetypes.ModuleName, - Config: appconfig.WrapAny(&evidencemodulev1.Module{}), - }, - { - Name: minttypes.ModuleName, - Config: appconfig.WrapAny(&mintmodulev1.Module{}), - }, - { - Name: group.ModuleName, - Config: appconfig.WrapAny(&groupmodulev1.Module{ - MaxExecutionPeriod: durationpb.New(time.Second * 1209600), - MaxMetadataLen: 255, - }), - }, - { - Name: feegrant.ModuleName, - Config: appconfig.WrapAny(&feegrantmodulev1.Module{}), - }, - { - Name: govtypes.ModuleName, - Config: appconfig.WrapAny(&govmodulev1.Module{}), - }, - { - Name: crisistypes.ModuleName, - Config: appconfig.WrapAny(&crisismodulev1.Module{}), - }, - { - Name: consensustypes.ModuleName, - Config: appconfig.WrapAny(&consensusmodulev1.Module{}), - }, - { - Name: circuittypes.ModuleName, - Config: appconfig.WrapAny(&circuitmodulev1.Module{}), - }, - { - Name: oraclemoduletypes.ModuleName, - Config: appconfig.WrapAny(&oraclemodulev1.Module{}), - }, - { - Name: vaultsmoduletypes.ModuleName, - Config: appconfig.WrapAny(&vaultmodulev1.Module{}), - }, - { - Name: psmtypes.ModuleName, - Config: appconfig.WrapAny(&psmmodulev1.Module{}), - }, - { - Name: auctionmoduletypes.ModuleName, - Config: appconfig.WrapAny(&auctionmodulev1.Module{}), - }, - // this line is used by starport scaffolding # stargate/app/moduleConfig - }, - }) -) diff --git a/app/app_test.go b/app/app_test.go deleted file mode 100644 index 0334d464..00000000 --- a/app/app_test.go +++ /dev/null @@ -1,15 +0,0 @@ -package app_test - -import ( - "testing" - - "github.com/stretchr/testify/require" - - "github.com/onomyprotocol/reserve/app" -) - -func TestGaiaApp_Export(t *testing.T) { - app := app.Setup(t, false) - _, err := app.ExportAppStateAndValidators(true, []string{}, []string{}) - require.NoError(t, err, "ExportAppStateAndValidators should not have an error") -} diff --git a/app/apptesting/test_suite.go b/app/apptesting/test_suite.go index d3df2c58..0f6e5aa3 100644 --- a/app/apptesting/test_suite.go +++ b/app/apptesting/test_suite.go @@ -71,6 +71,8 @@ func (s *KeeperTestHelper) Setup() { } func (s *KeeperTestHelper) FundAccount(acccount sdk.AccAddress, moduleName string, coins sdk.Coins) { - s.App.BankKeeper.MintCoins(s.Ctx, moduleName, coins) - s.App.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, moduleName, acccount, coins) + err := s.App.BankKeeper.MintCoins(s.Ctx, moduleName, coins) + s.Require().NoError(err) + err = s.App.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, moduleName, acccount, coins) + s.Require().NoError(err) } diff --git a/app/export.go b/app/export.go index f6f22f97..7ba5cd81 100644 --- a/app/export.go +++ b/app/export.go @@ -2,11 +2,11 @@ package app import ( "encoding/json" - "fmt" - "log" + + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" storetypes "cosmossdk.io/store/types" - cmtproto "github.com/cometbft/cometbft/proto/tendermint/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" @@ -16,19 +16,23 @@ import ( // ExportAppStateAndValidators exports the state of the application for a genesis // file. -func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs, modulesToExport []string) (servertypes.ExportedApp, error) { +func (app *App) ExportAppStateAndValidators( + forZeroHeight bool, + jailAllowedAddrs []string, + modulesToExport []string, +) (servertypes.ExportedApp, error) { // as if they could withdraw from the start of the next block - ctx := app.NewContextLegacy(true, cmtproto.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 - // CometBFT will start InitChain. + // Tendermint will start InitChain. height := app.LastBlockHeight() + 1 if forZeroHeight { height = 0 app.prepForZeroHeightGenesis(ctx, jailAllowedAddrs) } - genState, err := app.ModuleManager.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) + genState, err := app.mm.ExportGenesisForModules(ctx, app.appCodec, modulesToExport) if err != nil { return servertypes.ExportedApp{}, err } @@ -49,8 +53,7 @@ func (app *App) ExportAppStateAndValidators(forZeroHeight bool, jailAllowedAddrs // prepare for fresh start at zero height // NOTE zero height genesis is a temporary feature which will be deprecated -// -// in favor of export at a block height +// in favour of export at a block height func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []string) { applyAllowedAddrs := false @@ -64,7 +67,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str for _, addr := range jailAllowedAddrs { _, err := sdk.ValAddressFromBech32(addr) if err != nil { - log.Fatal(err) + panic(err) } allowedAddrsMap[addr] = true } @@ -76,11 +79,14 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str // withdraw all validator commission err := app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + valAddr, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) if err != nil { - panic(err) + app.Logger().Error(err.Error(), "ValOperatorAddress", val.GetOperator()) + } + _, err = app.DistrKeeper.WithdrawValidatorCommission(ctx, valAddr) + if err != nil { + app.Logger().Error(err.Error(), "ValOperatorAddress", val.GetOperator()) } - _, _ = app.DistrKeeper.WithdrawValidatorCommission(ctx, valBz) return false }) if err != nil { @@ -92,16 +98,21 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str if err != nil { panic(err) } - for _, delegation := range dels { valAddr, err := sdk.ValAddressFromBech32(delegation.ValidatorAddress) if err != nil { panic(err) } - delAddr := sdk.MustAccAddressFromBech32(delegation.DelegatorAddress) + delAddr, err := sdk.AccAddressFromBech32(delegation.DelegatorAddress) + if err != nil { + panic(err) + } - _, _ = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) + _, err = app.DistrKeeper.WithdrawDelegationRewards(ctx, delAddr, valAddr) + if err != nil { + panic(err) + } } // clear validator slash events @@ -114,14 +125,29 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str height := ctx.BlockHeight() ctx = ctx.WithBlockHeight(0) + // reinitialize all validators (v0.46 version) + // app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { + // // donate any unwithdrawn outstanding reward fraction tokens to the community pool + // scraps := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, val.GetOperator()) + // feePool := app.DistrKeeper.GetFeePool(ctx) + // feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) + // app.DistrKeeper.SetFeePool(ctx, feePool) + + // err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, val.GetOperator()) + // if err != nil { + // panic(err) + // } + // return false + // }) + // reinitialize all validators err = app.StakingKeeper.IterateValidators(ctx, func(_ int64, val stakingtypes.ValidatorI) (stop bool) { - valBz, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) + // donate any unwithdrawn outstanding reward fraction tokens to the community pool + valAddr, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(val.GetOperator()) if err != nil { panic(err) } - // donate any unwithdrawn outstanding reward fraction tokens to the community pool - scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valBz) + scraps, err := app.DistrKeeper.GetValidatorOutstandingRewardsCoins(ctx, valAddr) if err != nil { panic(err) } @@ -130,15 +156,18 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str panic(err) } feePool.CommunityPool = feePool.CommunityPool.Add(scraps...) - if err := app.DistrKeeper.FeePool.Set(ctx, feePool); err != nil { + err = app.DistrKeeper.FeePool.Set(ctx, feePool) + if err != nil { panic(err) } - - if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, valBz); err != nil { + if err := app.DistrKeeper.Hooks().AfterValidatorCreated(ctx, valAddr); err != nil { panic(err) } return false }) + if err != nil { + panic(err) + } // reinitialize all delegations for _, del := range dels { @@ -146,16 +175,15 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str if err != nil { panic(err) } - delAddr := sdk.MustAccAddressFromBech32(del.DelegatorAddress) - + delAddr, err := sdk.AccAddressFromBech32(del.DelegatorAddress) + if err != nil { + panic(err) + } 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)) + panic(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)) + panic(err) } } @@ -169,8 +197,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str for i := range red.Entries { red.Entries[i].CreationHeight = 0 } - err = app.StakingKeeper.SetRedelegation(ctx, red) - if err != nil { + if err := app.StakingKeeper.SetRedelegation(ctx, red); err != nil { panic(err) } return false @@ -184,8 +211,7 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str for i := range ubd.Entries { ubd.Entries[i].CreationHeight = 0 } - err = app.StakingKeeper.SetUnbondingDelegation(ctx, ubd) - if err != nil { + if err := app.StakingKeeper.SetUnbondingDelegation(ctx, ubd); err != nil { panic(err) } return false @@ -198,48 +224,51 @@ func (app *App) prepForZeroHeightGenesis(ctx sdk.Context, jailAllowedAddrs []str // update bond intra-tx counters. store := ctx.KVStore(app.GetKey(stakingtypes.StoreKey)) iter := storetypes.KVStoreReversePrefixIterator(store, stakingtypes.ValidatorsKey) - counter := int16(0) - - for ; iter.Valid(); iter.Next() { - addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) - validator, err := app.StakingKeeper.GetValidator(ctx, addr) - if err != nil { - panic("expected validator, not found") - } - validator.UnbondingHeight = 0 - if applyAllowedAddrs && !allowedAddrsMap[addr.String()] { - validator.Jailed = true - } + counter := int16(0) - if err := app.StakingKeeper.SetValidator(ctx, validator); err != nil { - panic(err) + // Closure to ensure iterator doesn't leak. + func() { + defer iter.Close() + for ; iter.Valid(); iter.Next() { + addr := sdk.ValAddress(stakingtypes.AddressFromValidatorsKey(iter.Key())) + validator, err := app.StakingKeeper.GetValidator(ctx, addr) + if err != nil { + panic("expected validator, not found") + } + + validator.UnbondingHeight = 0 + if applyAllowedAddrs && !allowedAddrsMap[addr.String()] { + validator.Jailed = true + } + + if err = app.StakingKeeper.SetValidator(ctx, validator); err != nil { + panic(err) + } + + counter++ } - counter++ - } - - if err := iter.Close(); err != nil { - app.Logger().Error("error while closing the key-value store reverse prefix iterator: ", err) - return - } + }() _, err = app.StakingKeeper.ApplyAndReturnValidatorSetUpdates(ctx) if err != nil { - log.Fatal(err) + panic(err) } /* Handle slashing state. */ // reset start height on signing infos - if err := 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) + if err = app.SlashingKeeper.SetValidatorSigningInfo(ctx, addr, info); err != nil { + panic(err) + } return false }, - ); err != nil { - log.Fatal(err) + ) + if err != nil { + panic(err) } - } diff --git a/app/ibc.go b/app/ibc.go deleted file mode 100644 index b067a54c..00000000 --- a/app/ibc.go +++ /dev/null @@ -1,224 +0,0 @@ -package app - -import ( - "cosmossdk.io/core/appmodule" - storetypes "cosmossdk.io/store/types" - cdctypes "github.com/cosmos/cosmos-sdk/codec/types" - "github.com/cosmos/cosmos-sdk/types/module" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" - govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" - govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" - "github.com/cosmos/cosmos-sdk/x/params" - paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" - paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" - "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" - icamodule "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" - ibctransfer "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" - ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint: staticcheck - ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" - porttypes "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" - solomachine "github.com/cosmos/ibc-go/v8/modules/light-clients/06-solomachine" - ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" - - oracle "github.com/onomyprotocol/reserve/x/oracle" - oraclemodule "github.com/onomyprotocol/reserve/x/oracle/module" - oraclemoduletypes "github.com/onomyprotocol/reserve/x/oracle/types" - psm "github.com/onomyprotocol/reserve/x/psm/module" - psmtypes "github.com/onomyprotocol/reserve/x/psm/types" -) - -// registerIBCModules register IBC keepers and non dependency inject modules. -func (app *App) registerIBCModules() error { - // set up non depinject support modules store keys - if err := app.RegisterStores( - storetypes.NewKVStoreKey(capabilitytypes.StoreKey), - storetypes.NewKVStoreKey(ibcexported.StoreKey), - storetypes.NewKVStoreKey(ibctransfertypes.StoreKey), - storetypes.NewKVStoreKey(ibcfeetypes.StoreKey), - storetypes.NewKVStoreKey(icahosttypes.StoreKey), - storetypes.NewKVStoreKey(icacontrollertypes.StoreKey), - storetypes.NewMemoryStoreKey(capabilitytypes.MemStoreKey), - storetypes.NewTransientStoreKey(paramstypes.TStoreKey), - ); err != nil { - return err - } - - // register the key tables for legacy param subspaces - keyTable := ibcclienttypes.ParamKeyTable() - keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) - app.ParamsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) - app.ParamsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) - app.ParamsKeeper.Subspace(icacontrollertypes.SubModuleName).WithKeyTable(icacontrollertypes.ParamKeyTable()) - app.ParamsKeeper.Subspace(icahosttypes.SubModuleName).WithKeyTable(icahosttypes.ParamKeyTable()) - - // add capability keeper and ScopeToModule for ibc module - app.CapabilityKeeper = capabilitykeeper.NewKeeper( - app.AppCodec(), - app.GetKey(capabilitytypes.StoreKey), - app.GetMemKey(capabilitytypes.MemStoreKey), - ) - - // add capability keeper and ScopeToModule for ibc module - scopedIBCKeeper := app.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) - scopedIBCTransferKeeper := app.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) - scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icacontrollertypes.SubModuleName) - scopedICAHostKeeper := app.CapabilityKeeper.ScopeToModule(icahosttypes.SubModuleName) - - // Create IBC keeper - app.IBCKeeper = ibckeeper.NewKeeper( - app.appCodec, - app.GetKey(ibcexported.StoreKey), - app.GetSubspace(ibcexported.ModuleName), - app.StakingKeeper, - app.UpgradeKeeper, - scopedIBCKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - // Register the proposal types - // Deprecated: Avoid adding new handlers, instead use the new proposal flow - // by granting the governance module the right to execute the message. - // See: https://docs.cosmos.network/main/modules/gov#proposal-messages - govRouter := govv1beta1.NewRouter() - govRouter.AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). - AddRoute(oraclemoduletypes.RouterKey, oracle.NewOracleProposalHandler(app.OracleKeeper)). - AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(app.ParamsKeeper)). - AddRoute(psmtypes.RouterKey, psm.NewPSMProposalHandler(&app.PSMKeeper)) - - app.IBCFeeKeeper = ibcfeekeeper.NewKeeper( - app.appCodec, app.GetKey(ibcfeetypes.StoreKey), - app.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, app.AccountKeeper, app.BankKeeper, - ) - - // Create IBC transfer keeper - app.TransferKeeper = ibctransferkeeper.NewKeeper( - app.appCodec, - app.GetKey(ibctransfertypes.StoreKey), - app.GetSubspace(ibctransfertypes.ModuleName), - app.IBCFeeKeeper, - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, - app.AccountKeeper, - app.BankKeeper, - scopedIBCTransferKeeper, - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - - // Create interchain account keepers - app.ICAHostKeeper = icahostkeeper.NewKeeper( - app.appCodec, - app.GetKey(icahosttypes.StoreKey), - app.GetSubspace(icahosttypes.SubModuleName), - app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, - app.AccountKeeper, - scopedICAHostKeeper, - app.MsgServiceRouter(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - app.ICAControllerKeeper = icacontrollerkeeper.NewKeeper( - app.appCodec, - app.GetKey(icacontrollertypes.StoreKey), - app.GetSubspace(icacontrollertypes.SubModuleName), - app.IBCFeeKeeper, // use ics29 fee as ics4Wrapper in middleware stack - app.IBCKeeper.ChannelKeeper, - app.IBCKeeper.PortKeeper, - scopedICAControllerKeeper, - app.MsgServiceRouter(), - authtypes.NewModuleAddress(govtypes.ModuleName).String(), - ) - app.GovKeeper.SetLegacyRouter(govRouter) - - // Create IBC modules with ibcfee middleware - transferIBCModule := ibcfee.NewIBCMiddleware(ibctransfer.NewIBCModule(app.TransferKeeper), app.IBCFeeKeeper) - - // integration point for custom authentication modules - var noAuthzModule porttypes.IBCModule - icaControllerIBCModule := ibcfee.NewIBCMiddleware( - icacontroller.NewIBCMiddleware(noAuthzModule, app.ICAControllerKeeper), - app.IBCFeeKeeper, - ) - - icaHostIBCModule := ibcfee.NewIBCMiddleware(icahost.NewIBCModule(app.ICAHostKeeper), app.IBCFeeKeeper) - - // Create static IBC router, add transfer route, then set and seal it - ibcRouter := porttypes.NewRouter(). - AddRoute(ibctransfertypes.ModuleName, transferIBCModule). - AddRoute(icacontrollertypes.SubModuleName, icaControllerIBCModule). - AddRoute(icahosttypes.SubModuleName, icaHostIBCModule) - - oracleIBCModule := ibcfee.NewIBCMiddleware(oraclemodule.NewIBCModule(app.OracleKeeper), app.IBCFeeKeeper) - // oracleStack, err := app.registerOracleModule() - // if err != nil { - // return err - // } - - // ibcRouter.AddRoute(oraclemoduletypes.ModuleName, oracleStack) - ibcRouter.AddRoute(oraclemoduletypes.ModuleName, oracleIBCModule) - // this line is used by starport scaffolding # ibc/app/module - - app.IBCKeeper.SetRouter(ibcRouter) - - app.ScopedIBCKeeper = scopedIBCKeeper - app.ScopedIBCTransferKeeper = scopedIBCTransferKeeper - app.ScopedICAHostKeeper = scopedICAHostKeeper - app.ScopedICAControllerKeeper = scopedICAControllerKeeper - - // register IBC modules - if err := app.RegisterModules( - ibc.NewAppModule(app.IBCKeeper), - ibctransfer.NewAppModule(app.TransferKeeper), - ibcfee.NewAppModule(app.IBCFeeKeeper), - icamodule.NewAppModule(&app.ICAControllerKeeper, &app.ICAHostKeeper), - capability.NewAppModule(app.appCodec, *app.CapabilityKeeper, false), - ibctm.NewAppModule(), - solomachine.NewAppModule(), - ); err != nil { - return err - } - - return nil -} - -// RegisterIBC Since the IBC modules don't support dependency injection, -// we need to manually register the modules on the client side. -// This needs to be removed after IBC supports App Wiring. -func RegisterIBC(registry cdctypes.InterfaceRegistry) map[string]appmodule.AppModule { - modules := map[string]appmodule.AppModule{ - ibcexported.ModuleName: ibc.AppModule{}, - ibctransfertypes.ModuleName: ibctransfer.AppModule{}, - ibcfeetypes.ModuleName: ibcfee.AppModule{}, - icatypes.ModuleName: icamodule.AppModule{}, - capabilitytypes.ModuleName: capability.AppModule{}, - ibctm.ModuleName: ibctm.AppModule{}, - solomachine.ModuleName: solomachine.AppModule{}, - - // oraclemoduletypes.ModuleName: oraclemodule.AppModule{}, - } - - for name, m := range modules { - module.CoreAppModuleBasicAdaptor(name, m).RegisterInterfaces(registry) - } - - return modules -} diff --git a/app/keepers/keepers.go b/app/keepers/keepers.go new file mode 100644 index 00000000..87945ea9 --- /dev/null +++ b/app/keepers/keepers.go @@ -0,0 +1,467 @@ +package keepers + +import ( + "fmt" + "os" + + "cosmossdk.io/log" + storetypes "cosmossdk.io/store/types" + evidencekeeper "cosmossdk.io/x/evidence/keeper" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + feegrantkeeper "cosmossdk.io/x/feegrant/keeper" + upgradekeeper "cosmossdk.io/x/upgrade/keeper" + upgradetypes "cosmossdk.io/x/upgrade/types" + + "github.com/cosmos/cosmos-sdk/baseapp" + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/codec/address" + "github.com/cosmos/cosmos-sdk/runtime" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + authcodec "github.com/cosmos/cosmos-sdk/x/auth/codec" + authkeeper "github.com/cosmos/cosmos-sdk/x/auth/keeper" + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + authzkeeper "github.com/cosmos/cosmos-sdk/x/authz/keeper" + bankkeeper "github.com/cosmos/cosmos-sdk/x/bank/keeper" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + consensusparamkeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + crisiskeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distrkeeper "github.com/cosmos/cosmos-sdk/x/distribution/keeper" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govkeeper "github.com/cosmos/cosmos-sdk/x/gov/keeper" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" + mintkeeper "github.com/cosmos/cosmos-sdk/x/mint/keeper" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + "github.com/cosmos/cosmos-sdk/x/params" + paramskeeper "github.com/cosmos/cosmos-sdk/x/params/keeper" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + paramproposal "github.com/cosmos/cosmos-sdk/x/params/types/proposal" + slashingkeeper "github.com/cosmos/cosmos-sdk/x/slashing/keeper" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingkeeper "github.com/cosmos/cosmos-sdk/x/staking/keeper" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/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" + ibctransfer "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" + ibcclienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck + ibcconnectiontypes "github.com/cosmos/ibc-go/v8/modules/core/03-connection/types" + porttypes "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" + + psmkeeper "github.com/onomyprotocol/reserve/x/psm/keeper" + psmtypes "github.com/onomyprotocol/reserve/x/psm/types" + + oraclekeeper "github.com/onomyprotocol/reserve/x/oracle/keeper" + oraclemodule "github.com/onomyprotocol/reserve/x/oracle/module" + oracletypes "github.com/onomyprotocol/reserve/x/oracle/types" + + vaultskeeper "github.com/onomyprotocol/reserve/x/vaults/keeper" + vaultstypes "github.com/onomyprotocol/reserve/x/vaults/types" + + auctionkeeper "github.com/onomyprotocol/reserve/x/auction/keeper" + auctiontypes "github.com/onomyprotocol/reserve/x/auction/types" +) + +type AppKeepers struct { + // keys to access the substores + keys map[string]*storetypes.KVStoreKey + tkeys map[string]*storetypes.TransientStoreKey + memKeys map[string]*storetypes.MemoryStoreKey + + // keepers + AccountKeeper authkeeper.AccountKeeper + BankKeeper bankkeeper.Keeper + CapabilityKeeper *capabilitykeeper.Keeper + StakingKeeper *stakingkeeper.Keeper + SlashingKeeper slashingkeeper.Keeper + MintKeeper mintkeeper.Keeper + DistrKeeper distrkeeper.Keeper + GovKeeper *govkeeper.Keeper + CrisisKeeper *crisiskeeper.Keeper + UpgradeKeeper *upgradekeeper.Keeper + ParamsKeeper paramskeeper.Keeper + + EvidenceKeeper evidencekeeper.Keeper + FeeGrantKeeper feegrantkeeper.Keeper + AuthzKeeper authzkeeper.Keeper + ConsensusParamsKeeper consensusparamkeeper.Keeper + + // ibc keepers + IBCKeeper *ibckeeper.Keeper + TransferKeeper ibctransferkeeper.Keeper + IBCFeeKeeper ibcfeekeeper.Keeper + + // make scoped keepers public for test purposes + ScopedIBCKeeper capabilitykeeper.ScopedKeeper + ScopedTransferKeeper capabilitykeeper.ScopedKeeper + ScopedOracleKeeper capabilitykeeper.ScopedKeeper + + PSMKeeper psmkeeper.Keeper + VaultsKeeper vaultskeeper.Keeper + OracleKeeper oraclekeeper.Keeper + AuctionKeeper auctionkeeper.Keeper +} + +func NewAppKeeper( + appCodec codec.Codec, + bApp *baseapp.BaseApp, + legacyAmino *codec.LegacyAmino, + maccPerms map[string][]string, + modAccAddrs map[string]bool, + blockedAddress map[string]bool, + skipUpgradeHeights map[int64]bool, + homePath string, + invCheckPeriod uint, + logger log.Logger, + appOpts servertypes.AppOptions, +) AppKeepers { + appKeepers := AppKeepers{} + + // Set keys KVStoreKey, TransientStoreKey, MemoryStoreKey + appKeepers.GenerateKeys() + + /* + configure state listening capabilities using AppOptions + we are doing nothing with the returned streamingServices and waitGroup in this case + */ + // load state streaming if enabled + + if err := bApp.RegisterStreamingServices(appOpts, appKeepers.keys); err != nil { + logger.Error("failed to load state streaming", "err", err) + os.Exit(1) + } + + appKeepers.ParamsKeeper = initParamsKeeper( + appCodec, + legacyAmino, + appKeepers.keys[paramstypes.StoreKey], + appKeepers.tkeys[paramstypes.TStoreKey], + ) + + // UpgradeKeeper must be created before IBCKeeper + appKeepers.UpgradeKeeper = upgradekeeper.NewKeeper( + skipUpgradeHeights, + runtime.NewKVStoreService(appKeepers.keys[upgradetypes.StoreKey]), + appCodec, + homePath, + bApp, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // set the BaseApp's parameter store + appKeepers.ConsensusParamsKeeper = consensusparamkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[consensusparamtypes.StoreKey]), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + runtime.EventService{}, + ) + bApp.SetParamStore(appKeepers.ConsensusParamsKeeper.ParamsStore) + + // add capability keeper and ScopeToModule for ibc module + appKeepers.CapabilityKeeper = capabilitykeeper.NewKeeper( + appCodec, + appKeepers.keys[capabilitytypes.StoreKey], + appKeepers.memKeys[capabilitytypes.MemStoreKey], + ) + + appKeepers.ScopedIBCKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibcexported.ModuleName) + appKeepers.ScopedTransferKeeper = appKeepers.CapabilityKeeper.ScopeToModule(ibctransfertypes.ModuleName) + appKeepers.ScopedOracleKeeper = appKeepers.CapabilityKeeper.ScopeToModule(oracletypes.ModuleName) + + // Applications that wish to enforce statically created ScopedKeepers should call `Seal` after creating + // their scoped modules in `NewApp` with `ScopeToModule` + appKeepers.CapabilityKeeper.Seal() + + // Add normal keepers + appKeepers.AccountKeeper = authkeeper.NewAccountKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[authtypes.StoreKey]), + authtypes.ProtoBaseAccount, + maccPerms, + address.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()), + sdk.GetConfig().GetBech32AccountAddrPrefix(), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.BankKeeper = bankkeeper.NewBaseKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[banktypes.StoreKey]), + appKeepers.AccountKeeper, + blockedAddress, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + logger, + ) + + appKeepers.AuthzKeeper = authzkeeper.NewKeeper( + runtime.NewKVStoreService(appKeepers.keys[authzkeeper.StoreKey]), + appCodec, + bApp.MsgServiceRouter(), + appKeepers.AccountKeeper, + ) + + appKeepers.AuthzKeeper = appKeepers.AuthzKeeper.SetBankKeeper(appKeepers.BankKeeper) + + appKeepers.FeeGrantKeeper = feegrantkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[feegrant.StoreKey]), + appKeepers.AccountKeeper, + ) + + appKeepers.StakingKeeper = stakingkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[stakingtypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()), + authcodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()), + ) + + // mint keeper must be created after provider keeper + appKeepers.MintKeeper = mintkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[minttypes.StoreKey]), + appKeepers.StakingKeeper, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.DistrKeeper = distrkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[distrtypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.StakingKeeper, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.SlashingKeeper = slashingkeeper.NewKeeper( + appCodec, + legacyAmino, + runtime.NewKVStoreService(appKeepers.keys[slashingtypes.StoreKey]), + appKeepers.StakingKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.CrisisKeeper = crisiskeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[crisistypes.StoreKey]), + invCheckPeriod, + appKeepers.BankKeeper, + authtypes.FeeCollectorName, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appKeepers.AccountKeeper.AddressCodec(), + ) + + // register the staking hooks + // NOTE: stakingKeeper above is passed by reference, so that it will contain these hooks + appKeepers.StakingKeeper.SetHooks( + stakingtypes.NewMultiStakingHooks( + appKeepers.DistrKeeper.Hooks(), + appKeepers.SlashingKeeper.Hooks(), + ), + ) + + // UpgradeKeeper must be created before IBCKeeper + appKeepers.IBCKeeper = ibckeeper.NewKeeper( + appCodec, + appKeepers.keys[ibcexported.StoreKey], + appKeepers.GetSubspace(ibcexported.ModuleName), + appKeepers.StakingKeeper, + appKeepers.UpgradeKeeper, + appKeepers.ScopedIBCKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.IBCFeeKeeper = ibcfeekeeper.NewKeeper( + appCodec, + appKeepers.keys[ibcfeetypes.StoreKey], + appKeepers.IBCKeeper.ChannelKeeper, // may be replaced with IBC middleware + appKeepers.IBCKeeper.ChannelKeeper, + appKeepers.IBCKeeper.PortKeeper, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + ) + + appKeepers.TransferKeeper = ibctransferkeeper.NewKeeper( + appCodec, + appKeepers.GetKey(ibctransfertypes.StoreKey), + appKeepers.GetSubspace(ibctransfertypes.ModuleName), + appKeepers.IBCFeeKeeper, + appKeepers.IBCKeeper.ChannelKeeper, + appKeepers.IBCKeeper.PortKeeper, + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + appKeepers.ScopedTransferKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.OracleKeeper = oraclekeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[oracletypes.StoreKey]), + logger, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appKeepers.GetIBCKeeper, + appKeepers.GetScopedKeeper, + ) + + appKeepers.PSMKeeper = psmkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[psmtypes.StoreKey]), + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + appKeepers.BankKeeper, + appKeepers.AccountKeeper, + &appKeepers.OracleKeeper, + ) + + appKeepers.VaultsKeeper = *vaultskeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[vaultstypes.ModuleName]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + &appKeepers.OracleKeeper, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + appKeepers.AuctionKeeper = auctionkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[auctiontypes.ModuleName]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + &appKeepers.VaultsKeeper, + &appKeepers.OracleKeeper, + logger, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // gov depends on provider, so needs to be set after + govConfig := govtypes.DefaultConfig() + // set the MaxMetadataLen for proposals to the same value as it was pre-sdk v0.47.x + govConfig.MaxMetadataLen = 10200 + appKeepers.GovKeeper = govkeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[govtypes.StoreKey]), + appKeepers.AccountKeeper, + appKeepers.BankKeeper, + // use the ProviderKeeper as StakingKeeper for gov + // because governance should be based on the consensus-active validators + appKeepers.StakingKeeper, + appKeepers.DistrKeeper, + bApp.MsgServiceRouter(), + govConfig, + authtypes.NewModuleAddress(govtypes.ModuleName).String(), + ) + + // Create IBC modules with ibcfee middleware + transferIBCModule := ibcfee.NewIBCMiddleware(ibctransfer.NewIBCModule(appKeepers.TransferKeeper), appKeepers.IBCFeeKeeper) + // Create static IBC router, add transfer route, then set and seal it + ibcRouter := porttypes.NewRouter(). + AddRoute(ibctransfertypes.ModuleName, transferIBCModule) + + ibcRouter.AddRoute(oracletypes.ModuleName, oraclemodule.NewIBCModule(appKeepers.OracleKeeper)) + // this line is used by starport scaffolding # ibc/app/module + + appKeepers.IBCKeeper.SetRouter(ibcRouter) + // Register the proposal types + // Deprecated: Avoid adding new handlers, instead use the new proposal flow + // by granting the governance module the right to execute the message. + // See: https://docs.cosmos.network/main/modules/gov#proposal-messages + govRouter := govv1beta1.NewRouter() + govRouter. + AddRoute(govtypes.RouterKey, govv1beta1.ProposalHandler). + AddRoute(paramproposal.RouterKey, params.NewParamChangeProposalHandler(appKeepers.ParamsKeeper)) + + // Set legacy router for backwards compatibility with gov v1beta1 + appKeepers.GovKeeper.SetLegacyRouter(govRouter) + + evidenceKeeper := evidencekeeper.NewKeeper( + appCodec, + runtime.NewKVStoreService(appKeepers.keys[evidencetypes.StoreKey]), + appKeepers.StakingKeeper, + appKeepers.SlashingKeeper, + appKeepers.AccountKeeper.AddressCodec(), + runtime.ProvideCometInfoService(), + ) + + // If evidence needs to be handled for the app, set routes in router here and seal + appKeepers.EvidenceKeeper = *evidenceKeeper + + return appKeepers +} + +// GetSubspace returns a param subspace for a given module name. +func (appKeepers *AppKeepers) GetSubspace(moduleName string) paramstypes.Subspace { + subspace, ok := appKeepers.ParamsKeeper.GetSubspace(moduleName) + if !ok { + panic("couldn't load subspace for module: " + moduleName) + } + return subspace +} + +// initParamsKeeper init params keeper and its subspaces +func initParamsKeeper(appCodec codec.BinaryCodec, legacyAmino *codec.LegacyAmino, key, tkey storetypes.StoreKey) paramskeeper.Keeper { + paramsKeeper := paramskeeper.NewKeeper(appCodec, legacyAmino, key, tkey) + + keyTable := ibcclienttypes.ParamKeyTable() + keyTable.RegisterParamSet(&ibcconnectiontypes.Params{}) + + // SDK subspaces + paramsKeeper.Subspace(authtypes.ModuleName) + paramsKeeper.Subspace(banktypes.ModuleName) + paramsKeeper.Subspace(stakingtypes.ModuleName) + paramsKeeper.Subspace(minttypes.ModuleName) + paramsKeeper.Subspace(distrtypes.ModuleName) + paramsKeeper.Subspace(slashingtypes.ModuleName) + paramsKeeper.Subspace(govtypes.ModuleName) + paramsKeeper.Subspace(crisistypes.ModuleName) + + paramsKeeper.Subspace(ibcexported.ModuleName).WithKeyTable(keyTable) + paramsKeeper.Subspace(ibctransfertypes.ModuleName).WithKeyTable(ibctransfertypes.ParamKeyTable()) + + paramsKeeper.Subspace(psmtypes.ModuleName).WithKeyTable(psmtypes.ParamKeyTable()) + paramsKeeper.Subspace(vaultstypes.ModuleName) + paramsKeeper.Subspace(oracletypes.ModuleName).WithKeyTable(oracletypes.ParamKeyTable()) + + return paramsKeeper +} + +type DefaultFeemarketDenomResolver struct{} + +func (r *DefaultFeemarketDenomResolver) ConvertToDenom(_ sdk.Context, coin sdk.DecCoin, denom string) (sdk.DecCoin, error) { + if coin.Denom == denom { + return coin, nil + } + + return sdk.DecCoin{}, fmt.Errorf("error resolving denom") +} + +func (r *DefaultFeemarketDenomResolver) ExtraDenoms(_ sdk.Context) ([]string, error) { + return []string{}, nil +} + +// GetIBCKeeper returns the IBC keeper. +func (app *AppKeepers) GetIBCKeeper() *ibckeeper.Keeper { + return app.IBCKeeper +} + +func (app *AppKeepers) GetScopedKeeper(string) capabilitykeeper.ScopedKeeper { + return app.ScopedIBCKeeper +} + +func (app *AppKeepers) GetScopedIBCKeeper() capabilitykeeper.ScopedKeeper { + return app.ScopedIBCKeeper +} diff --git a/app/keepers/keys.go b/app/keepers/keys.go new file mode 100644 index 00000000..76f65940 --- /dev/null +++ b/app/keepers/keys.go @@ -0,0 +1,100 @@ +package keepers + +import ( + storetypes "cosmossdk.io/store/types" + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + upgradetypes "cosmossdk.io/x/upgrade/types" + 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" + consensusparamtypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + 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" + 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" + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + + auctiontypes "github.com/onomyprotocol/reserve/x/auction/types" + oracletypes "github.com/onomyprotocol/reserve/x/oracle/types" + psmtypes "github.com/onomyprotocol/reserve/x/psm/types" + vaultstypes "github.com/onomyprotocol/reserve/x/vaults/types" +) + +func (appKeepers *AppKeepers) GenerateKeys() { + // Define what keys will be used in the cosmos-sdk key/value store. + // Cosmos-SDK modules each have a "key" that allows the application to reference what they've stored on the chain. + appKeepers.keys = storetypes.NewKVStoreKeys( + authtypes.StoreKey, + banktypes.StoreKey, + stakingtypes.StoreKey, + crisistypes.StoreKey, + minttypes.StoreKey, + distrtypes.StoreKey, + slashingtypes.StoreKey, + govtypes.StoreKey, + paramstypes.StoreKey, + ibcexported.StoreKey, + upgradetypes.StoreKey, + evidencetypes.StoreKey, + ibctransfertypes.StoreKey, + ibcfeetypes.StoreKey, + icahosttypes.StoreKey, + icacontrollertypes.StoreKey, + capabilitytypes.StoreKey, + feegrant.StoreKey, + authzkeeper.StoreKey, + consensusparamtypes.StoreKey, + psmtypes.StoreKey, + oracletypes.StoreKey, + vaultstypes.StoreKey, + auctiontypes.StoreKey, + ) + + // Define transient store keys + appKeepers.tkeys = storetypes.NewTransientStoreKeys(paramstypes.TStoreKey) + + // MemKeys are for information that is stored only in RAM. + appKeepers.memKeys = storetypes.NewMemoryStoreKeys(capabilitytypes.MemStoreKey) +} + +func (appKeepers *AppKeepers) GetKVStoreKey() map[string]*storetypes.KVStoreKey { + return appKeepers.keys +} + +func (appKeepers *AppKeepers) GetTransientStoreKey() map[string]*storetypes.TransientStoreKey { + return appKeepers.tkeys +} + +func (appKeepers *AppKeepers) GetMemoryStoreKey() map[string]*storetypes.MemoryStoreKey { + return appKeepers.memKeys +} + +// GetKey returns the KVStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (appKeepers *AppKeepers) GetKey(storeKey string) *storetypes.KVStoreKey { + return appKeepers.keys[storeKey] +} + +// GetTKey returns the TransientStoreKey for the provided store key. +// +// NOTE: This is solely to be used for testing purposes. +func (appKeepers *AppKeepers) GetTKey(storeKey string) *storetypes.TransientStoreKey { + return appKeepers.tkeys[storeKey] +} + +// GetMemKey returns the MemStoreKey for the provided mem key. +// +// NOTE: This is solely used for testing purposes. +func (appKeepers *AppKeepers) GetMemKey(storeKey string) *storetypes.MemoryStoreKey { + return appKeepers.memKeys[storeKey] +} diff --git a/app/module.go b/app/module.go new file mode 100644 index 00000000..93edf0a0 --- /dev/null +++ b/app/module.go @@ -0,0 +1,267 @@ +package app + +import ( + icatypes "github.com/cosmos/ibc-go/v8/modules/apps/27-interchain-accounts/types" + + ibcfeetypes "github.com/cosmos/ibc-go/v8/modules/apps/29-fee/types" + ibctransfertypes "github.com/cosmos/ibc-go/v8/modules/apps/transfer/types" + + authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" + + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + + govtypes "github.com/cosmos/cosmos-sdk/x/gov/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + + "github.com/cosmos/ibc-go/modules/capability" + + ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" + + // ibc "github.com/cosmos/ibc-go/v8/modules/core" + + ibctm "github.com/cosmos/ibc-go/v8/modules/light-clients/07-tendermint" + + "cosmossdk.io/x/evidence" + + feegrantmodule "cosmossdk.io/x/feegrant/module" + "cosmossdk.io/x/upgrade" + + "github.com/cosmos/cosmos-sdk/codec" + "github.com/cosmos/cosmos-sdk/types/module" + "github.com/cosmos/cosmos-sdk/x/auth" + + // "github.com/cosmos/cosmos-sdk/x/staking" + + "github.com/cosmos/cosmos-sdk/x/auth/vesting" + + authzmodule "github.com/cosmos/cosmos-sdk/x/authz/module" + "github.com/cosmos/cosmos-sdk/x/bank" + banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" + "github.com/cosmos/cosmos-sdk/x/consensus" + consensustypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + + "github.com/cosmos/cosmos-sdk/x/crisis" + crisistypes "github.com/cosmos/cosmos-sdk/x/crisis/types" + distr "github.com/cosmos/cosmos-sdk/x/distribution" + + "github.com/cosmos/cosmos-sdk/x/gov" + + "github.com/cosmos/cosmos-sdk/x/mint" + + sdkparams "github.com/cosmos/cosmos-sdk/x/params" + + "github.com/cosmos/cosmos-sdk/x/slashing" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + + evidencetypes "cosmossdk.io/x/evidence/types" + "cosmossdk.io/x/feegrant" + upgradetypes "cosmossdk.io/x/upgrade/types" + "github.com/cosmos/cosmos-sdk/client" + authsims "github.com/cosmos/cosmos-sdk/x/auth/simulation" + vestingtypes "github.com/cosmos/cosmos-sdk/x/auth/vesting/types" + authz "github.com/cosmos/cosmos-sdk/x/authz" + genutil "github.com/cosmos/cosmos-sdk/x/genutil" + genutiltypes "github.com/cosmos/cosmos-sdk/x/genutil/types" + govclient "github.com/cosmos/cosmos-sdk/x/gov/client" + paramsclient "github.com/cosmos/cosmos-sdk/x/params/client" + paramstypes "github.com/cosmos/cosmos-sdk/x/params/types" + "github.com/cosmos/cosmos-sdk/x/staking" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" + ibc "github.com/cosmos/ibc-go/v8/modules/core" + ibcexported "github.com/cosmos/ibc-go/v8/modules/core/exported" + + auction "github.com/onomyprotocol/reserve/x/auction/module" + auctiontypes "github.com/onomyprotocol/reserve/x/auction/types" + oracle "github.com/onomyprotocol/reserve/x/oracle/module" + oracletypes "github.com/onomyprotocol/reserve/x/oracle/types" + psm "github.com/onomyprotocol/reserve/x/psm/module" + psmtypes "github.com/onomyprotocol/reserve/x/psm/types" + vaults "github.com/onomyprotocol/reserve/x/vaults/module" + vaultstypes "github.com/onomyprotocol/reserve/x/vaults/types" +) + +var maccPerms = map[string][]string{ + authtypes.FeeCollectorName: nil, + distrtypes.ModuleName: nil, + icatypes.ModuleName: nil, + minttypes.ModuleName: {authtypes.Minter}, + stakingtypes.BondedPoolName: {authtypes.Burner, authtypes.Staking}, + stakingtypes.NotBondedPoolName: {authtypes.Burner, authtypes.Staking}, + govtypes.ModuleName: {authtypes.Burner}, + // liquiditytypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibctransfertypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + ibcfeetypes.ModuleName: nil, + psmtypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + vaultstypes.ModuleName: {authtypes.Minter, authtypes.Burner}, + vaultstypes.ReserveModuleName: {authtypes.Minter, authtypes.Burner}, + auctiontypes.ModuleName: {authtypes.Minter, authtypes.Burner}, +} + +func appModules( + app *App, + appCodec codec.Codec, + txConfig client.TxEncodingConfig, + skipGenesisInvariants bool, +) []module.AppModule { + return []module.AppModule{ + genutil.NewAppModule(app.AccountKeeper, app.StakingKeeper, app, txConfig), + auth.NewAppModule(appCodec, app.AccountKeeper, nil, app.GetSubspace(authtypes.ModuleName)), + vesting.NewAppModule(app.AccountKeeper, app.BankKeeper), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), + capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), + crisis.NewAppModule(app.CrisisKeeper, skipGenesisInvariants, app.GetSubspace(crisistypes.ModuleName)), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + upgrade.NewAppModule(app.UpgradeKeeper, app.AccountKeeper.AddressCodec()), + evidence.NewAppModule(app.EvidenceKeeper), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + ibc.NewAppModule(app.IBCKeeper), + ibcfee.NewAppModule(app.IBCFeeKeeper), + ibctm.NewAppModule(), + sdkparams.NewAppModule(app.ParamsKeeper), + consensus.NewAppModule(appCodec, app.ConsensusParamsKeeper), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + genutil.NewAppModule(app.AccountKeeper, app.StakingKeeper, app, txConfig), + psm.NewAppModule(appCodec, app.PSMKeeper, app.AccountKeeper, app.BankKeeper), + oracle.NewAppModule(appCodec, app.OracleKeeper, app.AccountKeeper, app.BankKeeper), + vaults.NewAppModule(appCodec, app.VaultsKeeper, app.AccountKeeper, app.BankKeeper), + auction.NewAppModule(appCodec, app.AuctionKeeper, app.AccountKeeper, app.BankKeeper), + } + +} + +func newBasicManagerFromManager(app *App) module.BasicManager { + basicManager := module.NewBasicManagerFromManager( + app.mm, + map[string]module.AppModuleBasic{ + genutiltypes.ModuleName: genutil.NewAppModuleBasic(genutiltypes.DefaultMessageValidator), + govtypes.ModuleName: gov.NewAppModuleBasic( + []govclient.ProposalHandler{ + paramsclient.ProposalHandler, + }, + ), + }) + basicManager.RegisterLegacyAminoCodec(app.legacyAmino) + basicManager.RegisterInterfaces(app.interfaceRegistry) + return basicManager +} + +// 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 +// NOTE: capability module's beginblocker must come before any modules using capabilities (e.g. IBC) +func orderBeginBlockers() []string { + return []string{ + // cosmos sdk modules + minttypes.ModuleName, + distrtypes.ModuleName, + slashingtypes.ModuleName, + evidencetypes.ModuleName, + stakingtypes.ModuleName, + authz.ModuleName, + genutiltypes.ModuleName, + // ibc modules + capabilitytypes.ModuleName, + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + oracletypes.ModuleName, + vaultstypes.ModuleName, + psmtypes.ModuleName, + auctiontypes.ModuleName, + } +} + +func orderEndBlockers() []string { + return []string{ + // cosmos sdk modules + crisistypes.ModuleName, + govtypes.ModuleName, + stakingtypes.ModuleName, + feegrant.ModuleName, + genutiltypes.ModuleName, + // ibc modules + ibcexported.ModuleName, + ibctransfertypes.ModuleName, + capabilitytypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + // chain modules + oracletypes.ModuleName, + vaultstypes.ModuleName, + psmtypes.ModuleName, + auctiontypes.ModuleName, + } +} + +// NOTE: The genutils module must occur after staking so that pools are +// properly initialized with tokens from genesis accounts. +// NOTE: The genutils module must also occur after auth so that it can access the params from auth. +// NOTE: Capability module must occur first so that it can initialize any capabilities +// so that other modules that want to create or claim capabilities afterwards in InitChain +// can do so safely. +func orderInitBlockers() []string { + return []string{ + // cosmos-sdk/ibc modules + capabilitytypes.ModuleName, + authtypes.ModuleName, + banktypes.ModuleName, + distrtypes.ModuleName, + stakingtypes.ModuleName, + slashingtypes.ModuleName, + govtypes.ModuleName, + minttypes.ModuleName, + crisistypes.ModuleName, + ibcexported.ModuleName, + genutiltypes.ModuleName, + evidencetypes.ModuleName, + authz.ModuleName, + ibctransfertypes.ModuleName, + icatypes.ModuleName, + ibcfeetypes.ModuleName, + feegrant.ModuleName, + paramstypes.ModuleName, + upgradetypes.ModuleName, + vestingtypes.ModuleName, + consensustypes.ModuleName, + // chain modules + oracletypes.ModuleName, + vaultstypes.ModuleName, + psmtypes.ModuleName, + auctiontypes.ModuleName, + } +} + +func simulationModules( + app *App, + appCodec codec.Codec, + _ bool, +) []module.AppModuleSimulation { + return []module.AppModuleSimulation{ + auth.NewAppModule(appCodec, app.AccountKeeper, authsims.RandomGenesisAccounts, app.GetSubspace(authtypes.ModuleName)), + bank.NewAppModule(appCodec, app.BankKeeper, app.AccountKeeper, app.GetSubspace(banktypes.ModuleName)), + capability.NewAppModule(appCodec, *app.CapabilityKeeper, false), + feegrantmodule.NewAppModule(appCodec, app.AccountKeeper, app.BankKeeper, app.FeeGrantKeeper, app.interfaceRegistry), + gov.NewAppModule(appCodec, app.GovKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(govtypes.ModuleName)), + mint.NewAppModule(appCodec, app.MintKeeper, app.AccountKeeper, nil, app.GetSubspace(minttypes.ModuleName)), + staking.NewAppModule(appCodec, app.StakingKeeper, app.AccountKeeper, app.BankKeeper, app.GetSubspace(stakingtypes.ModuleName)), + distr.NewAppModule(appCodec, app.DistrKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(distrtypes.ModuleName)), + slashing.NewAppModule(appCodec, app.SlashingKeeper, app.AccountKeeper, app.BankKeeper, app.StakingKeeper, app.GetSubspace(slashingtypes.ModuleName), app.interfaceRegistry), + sdkparams.NewAppModule(app.ParamsKeeper), + evidence.NewAppModule(app.EvidenceKeeper), + authzmodule.NewAppModule(appCodec, app.AuthzKeeper, app.AccountKeeper, app.BankKeeper, app.interfaceRegistry), + ibc.NewAppModule(app.IBCKeeper), + psm.NewAppModule(appCodec, app.PSMKeeper, app.AccountKeeper, app.BankKeeper), + // oracle.NewAppModule(appCodec,app.OracleKeeper, app.AccountKeeper, app.BankKeeper), + // vaults.NewAppModule(appCodec, app.VaultsKeeper, app.AccountKeeper, app.BankKeeper), + // auction.NewAppModule(appCodec, app.VaultsKeeper, app.AccountKeeper, app.BankKeeper), + } +} diff --git a/app/oracle.go b/app/oracle.go deleted file mode 100644 index e882f392..00000000 --- a/app/oracle.go +++ /dev/null @@ -1,56 +0,0 @@ -package app - -// import ( -// storetypes "cosmossdk.io/store/types" -// oraclekeeper "github.com/onomyprotocol/reserve/x/oracle/keeper" -// oraclemodule "github.com/onomyprotocol/reserve/x/oracle/module" -// oracletypes "github.com/onomyprotocol/reserve/x/oracle/types" -// "github.com/cosmos/cosmos-sdk/runtime" -// authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -// ibcfee "github.com/cosmos/ibc-go/v8/modules/apps/29-fee" -// porttypes "github.com/cosmos/ibc-go/v8/modules/core/05-port/types" -// ) - -// // registerOracleModule register Oracle keepers and non dependency inject modules. -// func (app *App) registerOracleModule() (porttypes.IBCModule, error) { -// // set up non depinject support modules store keys -// if err := app.RegisterStores( -// storetypes.NewKVStoreKey(oracletypes.StoreKey), -// ); err != nil { -// panic(err) -// } - -// // register the key tables for legacy param subspaces -// app.ParamsKeeper.Subspace(oracletypes.ModuleName).WithKeyTable(oracletypes.ParamKeyTable()) -// // add capability keeper and ScopeToModule for oracle ibc module -// scopedOralceKeeper := app.CapabilityKeeper.ScopeToModule(oracletypes.ModuleName) - -// app.OracleKeeper = oraclekeeper.NewKeeper( -// app.AppCodec(), -// runtime.NewKVStoreService(app.GetKey(oracletypes.StoreKey)), -// app.Logger(), -// authtypes.NewModuleAddress(oracletypes.ModuleName).String(), -// app.GetIBCKeeper, -// scopedOralceKeeper, -// ) - -// // register IBC modules -// if err := app.RegisterModules( -// oraclemodule.NewAppModule( -// app.AppCodec(), -// app.OracleKeeper, -// app.AccountKeeper, -// app.BankKeeper, -// )); err != nil { -// return nil, err -// } - -// app.ScopedOracleKeeper = scopedOralceKeeper - -// // Create fee enabled ibc stack for oracel -// var oracleStack porttypes.IBCModule -// oracleStack = oraclemodule.NewIBCModule(app.OracleKeeper) -// oracleStack = ibcfee.NewIBCMiddleware(oracleStack, app.IBCFeeKeeper) - -// return oracleStack, nil -// } diff --git a/app/sim_bench_test.go b/app/sim_bench_test.go index 6ae73cfb..3d051d22 100644 --- a/app/sim_bench_test.go +++ b/app/sim_bench_test.go @@ -6,6 +6,7 @@ import ( "testing" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" + "github.com/cosmos/cosmos-sdk/baseapp" "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/server" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" @@ -43,19 +44,28 @@ func BenchmarkFullAppSimulation(b *testing.B) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp, err := app.New(logger, db, nil, true, appOptions, interBlockCacheOpt()) - require.NoError(b, err) - require.Equal(b, app.Name, bApp.Name()) + bApp := app.NewApp( + logger, + db, + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + appOptions, + interBlockCacheOpt(), + baseapp.SetChainID(SimAppChainID), + ) + require.Equal(b, app.AppName, bApp.Name()) // run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( b, os.Stdout, bApp.BaseApp, - simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.ModuleBasics.DefaultGenesis(bApp.AppCodec())), simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - app.BlockedAddresses(), + bApp.ModuleAccountAddrs(), config, bApp.AppCodec(), ) @@ -100,19 +110,28 @@ func BenchmarkInvariants(b *testing.B) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp, err := app.New(logger, db, nil, true, appOptions, interBlockCacheOpt()) - require.NoError(b, err) - require.Equal(b, app.Name, bApp.Name()) + bApp := app.NewApp( + logger, + db, + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + appOptions, + interBlockCacheOpt(), + baseapp.SetChainID(SimAppChainID), + ) + require.Equal(b, app.AppName, bApp.Name()) // run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( b, os.Stdout, bApp.BaseApp, - simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.ModuleBasics.DefaultGenesis(bApp.AppCodec())), simtypes.RandomAccounts, // Replace with own random account function if using keys other than secp256k1 simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - app.BlockedAddresses(), + bApp.ModuleAccountAddrs(), config, bApp.AppCodec(), ) diff --git a/app/sim_test.go b/app/sim_test.go index 38219df7..49fd12f9 100644 --- a/app/sim_test.go +++ b/app/sim_test.go @@ -13,9 +13,9 @@ import ( "cosmossdk.io/log" "cosmossdk.io/store" - storetypes "cosmossdk.io/store/types" "cosmossdk.io/x/feegrant" abci "github.com/cometbft/cometbft/abci/types" + tmjson "github.com/cometbft/cometbft/libs/json" cmtproto "github.com/cometbft/cometbft/proto/tendermint/types" dbm "github.com/cosmos/cosmos-db" "github.com/cosmos/cosmos-sdk/baseapp" @@ -48,9 +48,9 @@ func init() { // fauxMerkleModeOpt returns a BaseApp option to use a dbStoreAdapter instead of // an IAVLStore for faster simulation speed. -func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { - bapp.SetFauxMerkleMode() -} +// func fauxMerkleModeOpt(bapp *baseapp.BaseApp) { +// bapp.SetFauxMerkleMode() +// } // interBlockCacheOpt returns a BaseApp option function that sets the persistent // inter-block write-through cache. @@ -87,19 +87,28 @@ func BenchmarkSimulation(b *testing.B) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.NoError(b, err) - require.Equal(b, app.Name, bApp.Name()) + bApp := app.NewApp( + logger, + db, + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + appOptions, + interBlockCacheOpt(), + baseapp.SetChainID(SimAppChainID), + ) + require.Equal(b, app.AppName, bApp.Name()) // run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( b, os.Stdout, bApp.BaseApp, - simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.ModuleBasics.DefaultGenesis(bApp.AppCodec())), simulationtypes.RandomAccounts, simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - app.BlockedAddresses(), + bApp.ModuleAccountAddrs(), config, bApp.AppCodec(), ) @@ -133,19 +142,28 @@ func TestAppImportExport(t *testing.T) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.NoError(t, err) - require.Equal(t, app.Name, bApp.Name()) + bApp := app.NewApp( + logger, + db, + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + appOptions, + interBlockCacheOpt(), + baseapp.SetChainID(SimAppChainID), + ) + require.Equal(t, app.AppName, bApp.Name()) // Run randomized simulation _, simParams, simErr := simulation.SimulateFromSeed( t, os.Stdout, bApp.BaseApp, - simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.ModuleBasics.DefaultGenesis(bApp.AppCodec())), simulationtypes.RandomAccounts, simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - app.BlockedAddresses(), + bApp.ModuleAccountAddrs(), config, bApp.AppCodec(), ) @@ -174,9 +192,18 @@ func TestAppImportExport(t *testing.T) { require.NoError(t, os.RemoveAll(newDir)) }() - newApp, err := app.New(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.NoError(t, err) - require.Equal(t, app.Name, newApp.Name()) + newApp := app.NewApp( + logger, + db, + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + appOptions, + interBlockCacheOpt(), + baseapp.SetChainID(SimAppChainID), + ) + require.Equal(t, app.AppName, newApp.Name()) var genesisState app.GenesisState err = json.Unmarshal(exported.AppState, &genesisState) @@ -184,7 +211,13 @@ func TestAppImportExport(t *testing.T) { ctxA := bApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight()}) ctxB := newApp.NewContextLegacy(true, cmtproto.Header{Height: bApp.LastBlockHeight()}) - _, err = newApp.ModuleManager.InitGenesis(ctxB, bApp.AppCodec(), genesisState) + + bz, err := tmjson.Marshal(genesisState) + require.NoError(t, err) + req := abci.RequestInitChain{ + AppStateBytes: bz, + } + _, err = newApp.InitChainer(ctxB, &req) if err != nil { if strings.Contains(err.Error(), "validator set is empty after InitGenesis") { @@ -210,15 +243,10 @@ func TestAppImportExport(t *testing.T) { slashingtypes.StoreKey: {slashingtypes.ValidatorMissedBlockBitmapKeyPrefix}, } - storeKeys := bApp.GetStoreKeys() + storeKeys := bApp.GetKVStoreKey() require.NotEmpty(t, storeKeys) for _, appKeyA := range storeKeys { - // only compare kvstores - if _, ok := appKeyA.(*storetypes.KVStoreKey); !ok { - continue - } - keyName := appKeyA.Name() appKeyB := newApp.GetKey(keyName) @@ -253,19 +281,28 @@ func TestAppSimulationAfterImport(t *testing.T) { appOptions[flags.FlagHome] = app.DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = simcli.FlagPeriodValue - bApp, err := app.New(logger, db, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.NoError(t, err) - require.Equal(t, app.Name, bApp.Name()) + bApp := app.NewApp( + logger, + db, + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + appOptions, + interBlockCacheOpt(), + baseapp.SetChainID(SimAppChainID), + ) + require.Equal(t, app.AppName, bApp.Name()) // Run randomized simulation stopEarly, simParams, simErr := simulation.SimulateFromSeed( t, os.Stdout, bApp.BaseApp, - simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.ModuleBasics.DefaultGenesis(bApp.AppCodec())), simulationtypes.RandomAccounts, simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - app.BlockedAddresses(), + bApp.ModuleAccountAddrs(), config, bApp.AppCodec(), ) @@ -299,9 +336,18 @@ func TestAppSimulationAfterImport(t *testing.T) { require.NoError(t, os.RemoveAll(newDir)) }() - newApp, err := app.New(log.NewNopLogger(), newDB, nil, true, appOptions, fauxMerkleModeOpt, baseapp.SetChainID(SimAppChainID)) - require.NoError(t, err) - require.Equal(t, app.Name, newApp.Name()) + newApp := app.NewApp( + logger, + db, + nil, + true, + map[int64]bool{}, + app.DefaultNodeHome, + appOptions, + interBlockCacheOpt(), + baseapp.SetChainID(SimAppChainID), + ) + require.Equal(t, app.AppName, newApp.Name()) _, err = newApp.InitChain(&abci.RequestInitChain{ AppStateBytes: exported.AppState, @@ -313,10 +359,10 @@ func TestAppSimulationAfterImport(t *testing.T) { t, os.Stdout, newApp.BaseApp, - simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.DefaultGenesis()), + simtestutil.AppStateFn(bApp.AppCodec(), bApp.SimulationManager(), bApp.ModuleBasics.DefaultGenesis(bApp.AppCodec())), simulationtypes.RandomAccounts, simtestutil.SimulationOperations(newApp, newApp.AppCodec(), config), - app.BlockedAddresses(), + bApp.ModuleAccountAddrs(), config, bApp.AppCodec(), ) @@ -333,6 +379,7 @@ func TestAppStateDeterminism(t *testing.T) { config.ExportParamsPath = "" config.OnOperation = true config.AllInvariants = true + config.ChainID = SimAppChainID numSeeds := 3 numTimesToRunPerSeed := 3 // This used to be set to 5, but we've temporarily reduced it to 3 for the sake of faster CI. @@ -372,38 +419,38 @@ func TestAppStateDeterminism(t *testing.T) { } else { logger = log.NewNopLogger() } - chainID := fmt.Sprintf("chain-id-%d-%d", i, j) - config.ChainID = chainID db := dbm.NewMemDB() - bApp, err := app.New( + bApp := app.NewApp( logger, db, nil, true, + map[int64]bool{}, + app.DefaultNodeHome, appOptions, interBlockCacheOpt(), - baseapp.SetChainID(chainID), + baseapp.SetChainID(SimAppChainID), ) - require.NoError(t, err) + require.Equal(t, app.AppName, bApp.Name()) fmt.Printf( "running non-determinism simulation; seed %d: %d/%d, attempt: %d/%d\n", config.Seed, i+1, numSeeds, j+1, numTimesToRunPerSeed, ) - _, _, err = simulation.SimulateFromSeed( + _, _, err := simulation.SimulateFromSeed( t, os.Stdout, bApp.BaseApp, simtestutil.AppStateFn( bApp.AppCodec(), bApp.SimulationManager(), - bApp.DefaultGenesis(), + bApp.ModuleBasics.DefaultGenesis(bApp.AppCodec()), ), simulationtypes.RandomAccounts, simtestutil.SimulationOperations(bApp, bApp.AppCodec(), config), - app.BlockedAddresses(), + bApp.ModuleAccountAddrs(), config, bApp.AppCodec(), ) diff --git a/app/test_helpers.go b/app/test_helpers.go index ceb93e9d..5d2f3064 100644 --- a/app/test_helpers.go +++ b/app/test_helpers.go @@ -2,8 +2,8 @@ package app import ( "encoding/json" - "testing" "os" + "testing" abci "github.com/cometbft/cometbft/abci/types" cmtjson "github.com/cometbft/cometbft/libs/json" @@ -40,7 +40,7 @@ func setup(withGenesis bool, invCheckPeriod uint) (*App, GenesisState) { appOptions[flags.FlagHome] = DefaultNodeHome appOptions[server.FlagInvCheckPeriod] = invCheckPeriod - app, _ := New(log.NewNopLogger(), db, nil, true, appOptions) + app := NewApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, DefaultNodeHome, appOptions) if withGenesis { return app, app.DefaultGenesis() } @@ -66,7 +66,7 @@ func NewSimappWithCustomOptions(t *testing.T, isCheckTx bool, options SetupOptio Coins: sdk.NewCoins(sdk.NewCoin(sdk.DefaultBondDenom, sdkmath.NewInt(100000000000000))), } - app, _ := New(options.Logger, options.DB, nil, true, options.AppOpts) + app := NewApp(options.Logger, options.DB, nil, true, map[int64]bool{}, DefaultNodeHome, options.AppOpts) genesisState := app.DefaultGenesis() genesisState, err = simtestutil.GenesisStateWithValSet(app.AppCodec(), genesisState, valSet, []authtypes.GenesisAccount{acc}, balance) require.NoError(t, err) @@ -211,6 +211,6 @@ func initAccountWithCoins(app *App, ctx sdk.Context, addr sdk.AccAddress, coins } } -func Cleanup(app *App) { // release cosmwasm instance cache lock +func Cleanup(app *App) { // release cosmwasm instance cache lock _ = os.RemoveAll(DefaultNodeHome) // remove default dir, if it was overridden during test Setup, it's a responsibility of the sender to remove the folder -} \ No newline at end of file +} diff --git a/cmd/reserved/cmd/commands.go b/cmd/reserved/cmd/commands.go index ad1147f0..00a3e8de 100644 --- a/cmd/reserved/cmd/commands.go +++ b/cmd/reserved/cmd/commands.go @@ -2,6 +2,7 @@ package cmd import ( "errors" + // "fmt" "io" "cosmossdk.io/log" @@ -20,6 +21,7 @@ import ( authcmd "github.com/cosmos/cosmos-sdk/x/auth/client/cli" "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" @@ -28,11 +30,12 @@ import ( func initRootCmd( rootCmd *cobra.Command, - txConfig client.TxConfig, basicManager module.BasicManager, + txConfig client.TxConfig, ) { rootCmd.AddCommand( genutilcli.InitCmd(basicManager, app.DefaultNodeHome), + NewTestnetCmd(addModuleInitFlags), debug.Cmd(), confixcmd.ConfigCommand(), pruning.Cmd(newApp, app.DefaultNodeHome), @@ -57,6 +60,7 @@ func addModuleInitFlags(startCmd *cobra.Command) { // genesisCommand builds genesis-related `reserved genesis` command. Users may provide application specific commands as a parameter func genesisCommand(txConfig client.TxConfig, basicManager module.BasicManager, cmds ...*cobra.Command) *cobra.Command { + // fmt.Println(basicManager["genutil"] == nil) cmd := genutilcli.Commands(txConfig, basicManager, app.DefaultNodeHome) for _, subCmd := range cmds { @@ -96,7 +100,7 @@ func txCommand(basicManager module.BasicManager) *cobra.Command { cmd := &cobra.Command{ Use: "tx", Short: "Transactions subcommands", - DisableFlagParsing: false, + DisableFlagParsing: true, SuggestionsMinimumDistance: 2, RunE: client.ValidateCmd, } @@ -111,7 +115,6 @@ func txCommand(basicManager module.BasicManager) *cobra.Command { authcmd.GetBroadcastCommand(), authcmd.GetEncodeCommand(), authcmd.GetDecodeCommand(), - authcmd.GetSimulateCmd(), ) basicManager.AddTxCommands(cmd) @@ -130,15 +133,21 @@ func newApp( ) servertypes.Application { baseappOptions := server.DefaultBaseappOptions(appOpts) - app, err := app.New( - logger, db, traceStore, true, + skipUpgradeHeights := make(map[int64]bool) + for _, h := range cast.ToIntSlice(appOpts.Get(server.FlagUnsafeSkipUpgrades)) { + skipUpgradeHeights[int64(h)] = true + } + + return app.NewApp( + logger, + db, + traceStore, + true, + skipUpgradeHeights, + cast.ToString(appOpts.Get(flags.FlagHome)), appOpts, baseappOptions..., ) - if err != nil { - panic(err) - } - return app } // appExport creates a new app (optionally at a given height) and exports state. @@ -154,7 +163,6 @@ func appExport( ) (servertypes.ExportedApp, error) { var ( bApp *app.App - err error ) // this check is necessary as we use the flag in x/upgrade. @@ -173,20 +181,25 @@ func appExport( viperAppOpts.Set(server.FlagInvCheckPeriod, 1) appOpts = viperAppOpts - if height != -1 { - bApp, err = app.New(logger, db, traceStore, false, appOpts) - if err != nil { - return servertypes.ExportedApp{}, err - } + var loadLatest bool + if height == -1 { + loadLatest = true + } + + bApp = app.NewApp( + logger, + db, + traceStore, + loadLatest, + map[int64]bool{}, + homePath, + appOpts, + ) + if height != -1 { if err := bApp.LoadHeight(height); err != nil { return servertypes.ExportedApp{}, err } - } else { - bApp, err = app.New(logger, db, traceStore, true, appOpts) - if err != nil { - return servertypes.ExportedApp{}, err - } } return bApp.ExportAppStateAndValidators(forZeroHeight, jailAllowedAddrs, modulesToExport) diff --git a/cmd/reserved/cmd/root.go b/cmd/reserved/cmd/root.go index 8f90556a..c42f5cc8 100644 --- a/cmd/reserved/cmd/root.go +++ b/cmd/reserved/cmd/root.go @@ -1,97 +1,101 @@ package cmd import ( + // "fmt" + // "fmt" "os" "strings" "cosmossdk.io/client/v2/autocli" - clientv2keyring "cosmossdk.io/client/v2/autocli/keyring" - "cosmossdk.io/core/address" - "cosmossdk.io/depinject" "cosmossdk.io/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/flags" "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" - "github.com/cosmos/cosmos-sdk/types/module" - "github.com/cosmos/cosmos-sdk/types/tx/signing" + + // "github.com/cosmos/cosmos-sdk/types/module" "github.com/cosmos/cosmos-sdk/x/auth/tx" - txmodule "github.com/cosmos/cosmos-sdk/x/auth/tx/config" + authtxconfig "github.com/cosmos/cosmos-sdk/x/auth/tx/config" "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/spf13/cobra" "github.com/spf13/pflag" + "github.com/spf13/viper" + + addresscodec "github.com/cosmos/cosmos-sdk/codec/address" + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/cosmos/cosmos-sdk/types/tx/signing" "github.com/onomyprotocol/reserve/app" ) // NewRootCmd creates a new root command for reserved. It is called once in the main function. func NewRootCmd() *cobra.Command { - var ( - txConfigOpts tx.ConfigOptions - autoCliOpts autocli.AppOptions - moduleBasicManager module.BasicManager - clientCtx client.Context + initAppOptions := viper.New() + tempDir := tempDir() + initAppOptions.Set(flags.FlagHome, tempDir) + tempApplication := app.NewApp( + log.NewNopLogger(), + dbm.NewMemDB(), + nil, + true, + map[int64]bool{}, + tempDir, + initAppOptions, ) + defer func() { + if err := tempApplication.Close(); err != nil { + panic(err) + } + }() - if err := depinject.Inject( - depinject.Configs(app.AppConfig(), - depinject.Supply( - log.NewNopLogger(), - ), - depinject.Provide( - ProvideClientContext, - ProvideKeyring, - ), - ), - &txConfigOpts, - &autoCliOpts, - &moduleBasicManager, - &clientCtx, - ); err != nil { - panic(err) - } + // fmt.Println(tempApplication.GetTxConfig().NewTxBuilder() == nil) + + initClientCtx := client.Context{}. + WithCodec(tempApplication.AppCodec()). + WithInterfaceRegistry(tempApplication.InterfaceRegistry()). + WithLegacyAmino(tempApplication.LegacyAmino()). + WithInput(os.Stdin). + WithAccountRetriever(types.AccountRetriever{}). + WithHomeDir(app.DefaultNodeHome). + WithViper("") rootCmd := &cobra.Command{ - Use: app.Name + "d", - Short: "Start reserve node", - SilenceErrors: true, + Use: app.AppName + "d", + Short: "Start reserve node", PersistentPreRunE: func(cmd *cobra.Command, _ []string) error { - // set the default command outputs cmd.SetOut(cmd.OutOrStdout()) cmd.SetErr(cmd.ErrOrStderr()) - clientCtx = clientCtx.WithCmdContext(cmd.Context()) - clientCtx, err := client.ReadPersistentCommandFlags(clientCtx, cmd.Flags()) - if err != nil { - return err - } - - clientCtx, err = config.ReadFromClientConfig(clientCtx) + initClientCtx = initClientCtx.WithCmdContext(cmd.Context()) + initClientCtx, err := client.ReadPersistentCommandFlags(initClientCtx, cmd.Flags()) if err != nil { return err } - // This needs to go after ReadFromClientConfig, as that function - // sets the RPC client needed for SIGN_MODE_TEXTUAL. - txConfigOpts.EnabledSignModes = append(txConfigOpts.EnabledSignModes, signing.SignMode_SIGN_MODE_TEXTUAL) - txConfigOpts.TextualCoinMetadataQueryFn = txmodule.NewGRPCCoinMetadataQueryFn(clientCtx) - txConfigWithTextual, err := tx.NewTxConfigWithOptions( - codec.NewProtoCodec(clientCtx.InterfaceRegistry), - txConfigOpts, - ) + initClientCtx, err = config.ReadFromClientConfig(initClientCtx) if err != nil { return err } - clientCtx = clientCtx.WithTxConfig(txConfigWithTextual) - if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil { - return err + if !initClientCtx.Offline { + txConfigOpts := tx.ConfigOptions{ + EnabledSignModes: append(tx.DefaultSignModes, signing.SignMode_SIGN_MODE_TEXTUAL), + TextualCoinMetadataQueryFn: authtxconfig.NewGRPCCoinMetadataQueryFn(initClientCtx), + } + txConfigWithTextual, err := tx.NewTxConfigWithOptions( + initClientCtx.Codec, + txConfigOpts, + ) + if err != nil { + return err + } + initClientCtx = initClientCtx.WithTxConfig(txConfigWithTextual) } - if err := client.SetCmdClientContextHandler(clientCtx, cmd); err != nil { + if err := client.SetCmdClientContextHandler(initClientCtx, cmd); err != nil { return err } @@ -105,19 +109,20 @@ func NewRootCmd() *cobra.Command { // Since the IBC modules don't support dependency injection, we need to // manually register the modules on the client side. // This needs to be removed after IBC supports App Wiring. - ibcModules := app.RegisterIBC(clientCtx.InterfaceRegistry) - for name, mod := range ibcModules { - moduleBasicManager[name] = module.CoreAppModuleBasicAdaptor(name, mod) - autoCliOpts.Modules[name] = mod - } - - initRootCmd(rootCmd, clientCtx.TxConfig, moduleBasicManager) + // ibcModules := app.RegisterIBC(clientCtx.InterfaceRegistry) + // for name, mod := range ibcModules { + // moduleBasicManager[name] = module.CoreAppModuleBasicAdaptor(name, mod) + // autoCliOpts.Modules[name] = mod + // } + // fmt.Println(tempApplication.ModuleBasics["genutil"] == nil) + initRootCmd(rootCmd, tempApplication.ModuleBasics, tempApplication.GetTxConfig()) overwriteFlagDefaults(rootCmd, map[string]string{ - flags.FlagChainID: strings.ReplaceAll(app.Name, "-", ""), + flags.FlagChainID: strings.ReplaceAll(app.AppName, "-", ""), flags.FlagKeyringBackend: "test", }) + autoCliOpts := enrichAutoCliOpts(tempApplication.AutoCliOpts(), initClientCtx) if err := autoCliOpts.EnhanceRootCommand(rootCmd); err != nil { panic(err) } @@ -125,6 +130,16 @@ func NewRootCmd() *cobra.Command { return rootCmd } +func enrichAutoCliOpts(autoCliOpts autocli.AppOptions, clientCtx client.Context) autocli.AppOptions { + autoCliOpts.AddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32AccountAddrPrefix()) + autoCliOpts.ValidatorAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ValidatorAddrPrefix()) + autoCliOpts.ConsensusAddressCodec = addresscodec.NewBech32Codec(sdk.GetConfig().GetBech32ConsensusAddrPrefix()) + + autoCliOpts.ClientCtx = clientCtx + + return autoCliOpts +} + func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) { set := func(s *pflag.FlagSet, key, val string) { if f := s.Lookup(key); f != nil { @@ -144,30 +159,38 @@ func overwriteFlagDefaults(c *cobra.Command, defaults map[string]string) { func ProvideClientContext( appCodec codec.Codec, interfaceRegistry codectypes.InterfaceRegistry, - txConfig client.TxConfig, + txConfigOpts tx.ConfigOptions, legacyAmino *codec.LegacyAmino, ) client.Context { clientCtx := client.Context{}. WithCodec(appCodec). WithInterfaceRegistry(interfaceRegistry). - WithTxConfig(txConfig). WithLegacyAmino(legacyAmino). WithInput(os.Stdin). WithAccountRetriever(types.AccountRetriever{}). WithHomeDir(app.DefaultNodeHome). - WithViper(app.Name) // env variable prefix + WithViper(app.AppName) // env variable prefix // Read the config again to overwrite the default values with the values from the config file clientCtx, _ = config.ReadFromClientConfig(clientCtx) + // textual is enabled by default, we need to re-create the tx config grpc instead of bank keeper. + txConfigOpts.TextualCoinMetadataQueryFn = authtxconfig.NewGRPCCoinMetadataQueryFn(clientCtx) + txConfig, err := tx.NewTxConfigWithOptions(clientCtx.Codec, txConfigOpts) + if err != nil { + panic(err) + } + clientCtx = clientCtx.WithTxConfig(txConfig) + return clientCtx } -func ProvideKeyring(clientCtx client.Context, addressCodec address.Codec) (clientv2keyring.Keyring, error) { - kb, err := client.NewKeyringFromBackend(clientCtx, clientCtx.Keyring.Backend()) +var tempDir = func() string { + dir, err := os.MkdirTemp("", "."+app.AppName) if err != nil { - return nil, err + dir = app.DefaultNodeHome } + defer os.RemoveAll(dir) - return keyring.NewAutoCLIKeyring(kb) + return dir } diff --git a/cmd/reserved/cmd/testnet.go b/cmd/reserved/cmd/testnet.go new file mode 100644 index 00000000..da414ea8 --- /dev/null +++ b/cmd/reserved/cmd/testnet.go @@ -0,0 +1,285 @@ +package cmd + +import ( + "fmt" + "io" + "strings" + + "cosmossdk.io/log" + "cosmossdk.io/math" + storetypes "cosmossdk.io/store/types" + "github.com/cometbft/cometbft/crypto" + "github.com/cometbft/cometbft/libs/bytes" + tmos "github.com/cometbft/cometbft/libs/os" + tmproto "github.com/cometbft/cometbft/proto/tendermint/types" + dbm "github.com/cosmos/cosmos-db" + "github.com/cosmos/cosmos-sdk/client/flags" + codectypes "github.com/cosmos/cosmos-sdk/codec/types" + "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" + "github.com/cosmos/cosmos-sdk/server" + servertypes "github.com/cosmos/cosmos-sdk/server/types" + sdk "github.com/cosmos/cosmos-sdk/types" + distrtypes "github.com/cosmos/cosmos-sdk/x/distribution/types" + minttypes "github.com/cosmos/cosmos-sdk/x/mint/types" + slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" + stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" + "github.com/spf13/cast" + "github.com/spf13/cobra" + + "github.com/onomyprotocol/reserve/app" +) + +const ( + valVotingPower int64 = 900000000000000 +) + +var ( + flagAccountsToFund = "accounts-to-fund" +) + +type valArgs struct { + newValAddr bytes.HexBytes + newOperatorAddress string + newValPubKey crypto.PubKey + accountsToFund []sdk.AccAddress + upgradeToTrigger string + homeDir string +} + +func NewTestnetCmd(addStartFlags servertypes.ModuleInitFlags) *cobra.Command { + cmd := server.InPlaceTestnetCreator(newTestnetApp) + addStartFlags(cmd) + cmd.Short = "Updates chain's application and consensus state with provided validator info and starts the node" + cmd.Long = `The test command modifies both application and consensus stores within a local mainnet node and starts the node, +with the aim of facilitating testing procedures. This command replaces existing validator data with updated information, +thereby removing the old validator set and introducing a new set suitable for local testing purposes. By altering the state extracted from the mainnet node, +it enables developers to configure their local environments to reflect mainnet conditions more accurately.` + + cmd.Example = fmt.Sprintf(`%sd in-place-testnet testing-1 cosmosvaloper1w7f3xx7e75p4l7qdym5msqem9rd4dyc4mq79dm --home $HOME/.%sd/validator1 --validator-privkey=6dq+/KHNvyiw2TToCgOpUpQKIzrLs69Rb8Az39xvmxPHNoPxY1Cil8FY+4DhT9YwD6s0tFABMlLcpaylzKKBOg== --accounts-to-fund="cosmos1f7twgcq4ypzg7y24wuywy06xmdet8pc4473tnq,cosmos1qvuhm5m644660nd8377d6l7yz9e9hhm9evmx3x"`, "github.com/onomyprotocol/reserve", "github.com/onomyprotocol/reserve") + + cmd.Flags().String(flagAccountsToFund, "", "Comma-separated list of account addresses that will be funded for testing purposes") + return cmd +} + +// newTestnetApp starts by running the normal newApp method. From there, the app interface returned is modified in order +// for a testnet to be created from the provided app. +func newTestnetApp(logger log.Logger, db dbm.DB, traceStore io.Writer, appOpts servertypes.AppOptions) servertypes.Application { + // Create an app and type cast to an App + newApp := newApp(logger, db, traceStore, appOpts) + testApp, ok := newApp.(*app.App) + if !ok { + panic("app created from newApp is not of type App") + } + + // Get command args + args, err := getCommandArgs(appOpts) + if err != nil { + panic(err) + } + + return initAppForTestnet(testApp, args) +} + +func initAppForTestnet(app *app.App, args valArgs) *app.App { + // Required Changes: + // + ctx := app.BaseApp.NewUncachedContext(true, tmproto.Header{}) + + pubkey := &ed25519.PubKey{Key: args.newValPubKey.Bytes()} + pubkeyAny, err := codectypes.NewAnyWithValue(pubkey) + if err != nil { + tmos.Exit(err.Error()) + } + + // STAKING + // + + // Create Validator struct for our new validator. + newVal := stakingtypes.Validator{ + OperatorAddress: args.newOperatorAddress, + ConsensusPubkey: pubkeyAny, + Jailed: false, + Status: stakingtypes.Bonded, + Tokens: math.NewInt(valVotingPower), + DelegatorShares: math.LegacyMustNewDecFromStr("10000000"), + Description: stakingtypes.Description{ + Moniker: "Testnet Validator", + }, + Commission: stakingtypes.Commission{ + CommissionRates: stakingtypes.CommissionRates{ + Rate: math.LegacyMustNewDecFromStr("0.05"), + MaxRate: math.LegacyMustNewDecFromStr("0.1"), + MaxChangeRate: math.LegacyMustNewDecFromStr("0.05"), + }, + }, + MinSelfDelegation: math.OneInt(), + } + + validator, err := app.StakingKeeper.ValidatorAddressCodec().StringToBytes(newVal.GetOperator()) + if err != nil { + tmos.Exit(err.Error()) + } + + // Remove all validators from power store + stakingKey := app.GetKey(stakingtypes.ModuleName) + stakingStore := ctx.KVStore(stakingKey) + iterator, err := app.StakingKeeper.ValidatorsPowerStoreIterator(ctx) + if err != nil { + tmos.Exit(err.Error()) + } + for ; iterator.Valid(); iterator.Next() { + stakingStore.Delete(iterator.Key()) + } + iterator.Close() + + // Remove all valdiators from last validators store + iterator, err = app.StakingKeeper.LastValidatorsIterator(ctx) + if err != nil { + tmos.Exit(err.Error()) + } + for ; iterator.Valid(); iterator.Next() { + stakingStore.Delete(iterator.Key()) + } + iterator.Close() + + // Remove all validators from validators store + iterator = stakingStore.Iterator(stakingtypes.ValidatorsKey, storetypes.PrefixEndBytes(stakingtypes.ValidatorsKey)) + for ; iterator.Valid(); iterator.Next() { + stakingStore.Delete(iterator.Key()) + } + iterator.Close() + + // Remove all validators from unbonding queue + iterator = stakingStore.Iterator(stakingtypes.ValidatorQueueKey, storetypes.PrefixEndBytes(stakingtypes.ValidatorQueueKey)) + for ; iterator.Valid(); iterator.Next() { + stakingStore.Delete(iterator.Key()) + } + iterator.Close() + + // Add our validator to power and last validators store + err = app.StakingKeeper.SetValidator(ctx, newVal) + if err != nil { + tmos.Exit(err.Error()) + } + err = app.StakingKeeper.SetValidatorByConsAddr(ctx, newVal) + if err != nil { + tmos.Exit(err.Error()) + } + err = app.StakingKeeper.SetValidatorByPowerIndex(ctx, newVal) + if err != nil { + tmos.Exit(err.Error()) + } + err = app.StakingKeeper.SetLastValidatorPower(ctx, validator, 0) + if err != nil { + tmos.Exit(err.Error()) + } + if err := app.StakingKeeper.Hooks().AfterValidatorCreated(ctx, validator); err != nil { + tmos.Exit(err.Error()) + } + + // DISTRIBUTION + // + + // Initialize records for this validator across all distribution stores + err = app.DistrKeeper.SetValidatorHistoricalRewards(ctx, validator, 0, distrtypes.NewValidatorHistoricalRewards(sdk.DecCoins{}, 1)) + if err != nil { + tmos.Exit(err.Error()) + } + err = app.DistrKeeper.SetValidatorCurrentRewards(ctx, validator, distrtypes.NewValidatorCurrentRewards(sdk.DecCoins{}, 1)) + if err != nil { + tmos.Exit(err.Error()) + } + err = app.DistrKeeper.SetValidatorAccumulatedCommission(ctx, validator, distrtypes.InitialValidatorAccumulatedCommission()) + if err != nil { + tmos.Exit(err.Error()) + } + err = app.DistrKeeper.SetValidatorOutstandingRewards(ctx, validator, distrtypes.ValidatorOutstandingRewards{Rewards: sdk.DecCoins{}}) + if err != nil { + tmos.Exit(err.Error()) + } + + // SLASHING + // + + // Set validator signing info for our new validator. + newConsAddr := sdk.ConsAddress(args.newValAddr.Bytes()) + newValidatorSigningInfo := slashingtypes.ValidatorSigningInfo{ + Address: newConsAddr.String(), + StartHeight: app.LastBlockHeight() - 1, + Tombstoned: false, + } + err = app.SlashingKeeper.SetValidatorSigningInfo(ctx, newConsAddr, newValidatorSigningInfo) + if err != nil { + tmos.Exit(err.Error()) + } + // BANK + // + bondDenom, err := app.StakingKeeper.BondDenom(ctx) + if err != nil { + tmos.Exit(err.Error()) + } + + defaultCoins := sdk.NewCoins(sdk.NewInt64Coin(bondDenom, 1000000000)) + + // Fund local accounts + for _, account := range args.accountsToFund { + err := app.BankKeeper.MintCoins(ctx, minttypes.ModuleName, defaultCoins) + if err != nil { + tmos.Exit(err.Error()) + } + err = app.BankKeeper.SendCoinsFromModuleToAccount(ctx, minttypes.ModuleName, account, defaultCoins) + if err != nil { + tmos.Exit(err.Error()) + } + } + + return app +} + +// parse the input flags and returns valArgs +func getCommandArgs(appOpts servertypes.AppOptions) (valArgs, error) { + args := valArgs{} + + newValAddr, ok := appOpts.Get(server.KeyNewValAddr).(bytes.HexBytes) + if !ok { + panic("newValAddr is not of type bytes.HexBytes") + } + args.newValAddr = newValAddr + newValPubKey, ok := appOpts.Get(server.KeyUserPubKey).(crypto.PubKey) + if !ok { + panic("newValPubKey is not of type crypto.PubKey") + } + args.newValPubKey = newValPubKey + newOperatorAddress, ok := appOpts.Get(server.KeyNewOpAddr).(string) + if !ok { + panic("newOperatorAddress is not of type string") + } + args.newOperatorAddress = newOperatorAddress + upgradeToTrigger, ok := appOpts.Get(server.KeyTriggerTestnetUpgrade).(string) + if !ok { + panic("upgradeToTrigger is not of type string") + } + args.upgradeToTrigger = upgradeToTrigger + + // validate and set accounts to fund + accountsString := cast.ToString(appOpts.Get(flagAccountsToFund)) + + for _, account := range strings.Split(accountsString, ",") { + if account != "" { + addr, err := sdk.AccAddressFromBech32(account) + if err != nil { + return args, fmt.Errorf("invalid bech32 address format %w", err) + } + args.accountsToFund = append(args.accountsToFund, addr) + } + } + + // home dir + homeDir := cast.ToString(appOpts.Get(flags.FlagHome)) + if homeDir == "" { + return args, fmt.Errorf("invalid home dir") + } + args.homeDir = homeDir + + return args, nil +} diff --git a/cmd/reserved/main.go b/cmd/reserved/main.go index cafbd53a..4246af7c 100644 --- a/cmd/reserved/main.go +++ b/cmd/reserved/main.go @@ -4,6 +4,7 @@ import ( "fmt" "os" + clienthelpers "cosmossdk.io/client/v2/helpers" svrcmd "github.com/cosmos/cosmos-sdk/server/cmd" "github.com/onomyprotocol/reserve/app" @@ -12,7 +13,7 @@ import ( func main() { rootCmd := cmd.NewRootCmd() - if err := svrcmd.Execute(rootCmd, "", app.DefaultNodeHome); err != nil { + if err := svrcmd.Execute(rootCmd, clienthelpers.EnvPrefix, app.DefaultNodeHome); err != nil { fmt.Fprintln(rootCmd.OutOrStderr(), err) os.Exit(1) } diff --git a/go.mod b/go.mod index bd9545c1..ec0c1b98 100644 --- a/go.mod +++ b/go.mod @@ -10,28 +10,26 @@ replace ( ) require ( - cosmossdk.io/api v0.7.3 - cosmossdk.io/client/v2 v2.0.0-beta.1 + cosmossdk.io/api v0.7.5 + cosmossdk.io/client/v2 v2.0.0-beta.5 cosmossdk.io/collections v0.4.0 cosmossdk.io/core v0.11.1 cosmossdk.io/depinject v1.0.0 cosmossdk.io/errors v1.0.1 - cosmossdk.io/log v1.3.1 + cosmossdk.io/log v1.4.1 cosmossdk.io/math v1.3.0 - cosmossdk.io/store v1.0.2 + cosmossdk.io/store v1.1.0 cosmossdk.io/tools/confix v0.1.1 - cosmossdk.io/x/circuit v0.1.0 cosmossdk.io/x/evidence v0.1.0 cosmossdk.io/x/feegrant v0.1.0 - cosmossdk.io/x/nft v0.1.0 - cosmossdk.io/x/tx v0.13.1 + cosmossdk.io/x/tx v0.13.5 cosmossdk.io/x/upgrade v0.1.1 github.com/bufbuild/buf v1.30.0 - github.com/cometbft/cometbft v0.38.6 + github.com/cometbft/cometbft v0.38.12 github.com/cosmos/cosmos-db v1.0.2 github.com/cosmos/cosmos-proto v1.0.0-beta.5 - github.com/cosmos/cosmos-sdk v0.50.5 - github.com/cosmos/gogoproto v1.5.0 + github.com/cosmos/cosmos-sdk v0.50.6 + github.com/cosmos/gogoproto v1.7.0 github.com/cosmos/ibc-go/modules/capability v1.0.0 github.com/cosmos/ibc-go/v8 v8.1.1 github.com/golang/protobuf v1.5.4 @@ -41,9 +39,9 @@ require ( github.com/pkg/errors v0.9.1 github.com/rakyll/statik v0.1.7 github.com/spf13/cast v1.6.0 - github.com/spf13/cobra v1.8.0 + github.com/spf13/cobra v1.8.1 github.com/spf13/pflag v1.0.5 - github.com/spf13/viper v1.18.2 + github.com/spf13/viper v1.19.0 github.com/stretchr/testify v1.9.0 golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8 @@ -61,6 +59,7 @@ require ( cloud.google.com/go/storage v1.38.0 // indirect connectrpc.com/connect v1.15.0 // indirect connectrpc.com/otelconnect v0.7.0 // indirect + cosmossdk.io/x/circuit v0.1.0 // 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.1 // indirect @@ -74,29 +73,30 @@ require ( 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/btcsuite/btcd/btcec/v2 v2.3.4 // indirect github.com/bufbuild/protocompile v0.9.0 // indirect github.com/bufbuild/protovalidate-go v0.6.0 // indirect github.com/bufbuild/protoyaml-go v0.1.8 // 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.11.1 // indirect + github.com/cockroachdb/errors v1.11.3 // indirect + github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce // indirect github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect - github.com/cockroachdb/pebble v1.1.0 // indirect + github.com/cockroachdb/pebble v1.1.1 // indirect github.com/cockroachdb/redact v1.1.5 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect - github.com/cometbft/cometbft-db v0.9.1 // indirect + github.com/cometbft/cometbft-db v0.11.0 // indirect github.com/containerd/stargz-snapshotter/estargz v0.15.1 // 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 v1.0.1 // indirect - github.com/cosmos/ics23/go v0.10.0 // indirect + github.com/cosmos/iavl v1.1.2 // indirect + github.com/cosmos/ics23/go v0.11.0 // indirect github.com/cosmos/ledger-cosmos-go v0.13.3 // indirect - github.com/cpuguy83/go-md2man/v2 v2.0.3 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/creachadair/atomicfile v0.3.1 // indirect github.com/creachadair/tomledit v0.0.24 // indirect github.com/danieljoos/wincred v1.2.1 // indirect @@ -145,20 +145,21 @@ require ( github.com/google/s2a-go v0.1.7 // indirect 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.2 // indirect + github.com/googleapis/gax-go/v2 v2.12.3 // indirect github.com/gorilla/handlers v1.5.2 // indirect - github.com/gorilla/websocket v1.5.0 // indirect + github.com/gorilla/websocket v1.5.3 // 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/hashicorp/go-cleanhttp v0.5.2 // 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-metrics v0.5.2 // indirect + github.com/hashicorp/go-metrics v0.5.3 // 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 v1.0.2 // indirect + github.com/hashicorp/golang-lru/v2 v2.0.7 // 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 @@ -169,13 +170,12 @@ require ( github.com/jdx/go-netrc v1.0.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.7 // indirect + github.com/klauspost/compress v1.17.9 // indirect github.com/klauspost/pgzip v1.2.6 // 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.8.12 // 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 @@ -187,23 +187,24 @@ require ( github.com/moby/term v0.5.0 // indirect github.com/morikuni/aec v1.0.0 // indirect github.com/mtibben/percent v0.2.1 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // 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/opencontainers/image-spec v1.1.0 // indirect - github.com/pelletier/go-toml/v2 v2.1.0 // indirect - github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc // indirect + github.com/pelletier/go-toml/v2 v2.2.2 // indirect + github.com/petermattis/goid v0.0.0-20231207134359-e60b3f734c67 // indirect github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c // indirect github.com/pkg/profile v1.7.0 // indirect github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect - github.com/prometheus/client_golang v1.18.0 // indirect - github.com/prometheus/client_model v0.6.0 // indirect - github.com/prometheus/common v0.47.0 // indirect - github.com/prometheus/procfs v0.12.0 // indirect + github.com/prometheus/client_golang v1.20.1 // indirect + github.com/prometheus/client_model v0.6.1 // indirect + github.com/prometheus/common v0.55.0 // indirect + github.com/prometheus/procfs v0.15.1 // indirect github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect - github.com/rs/cors v1.10.1 // indirect - github.com/rs/zerolog v1.32.0 // indirect + github.com/rs/cors v1.11.1 // indirect + github.com/rs/zerolog v1.33.0 // indirect github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.4.0 // indirect github.com/sagikazarmark/slog-shim v0.1.0 // indirect @@ -220,7 +221,7 @@ require ( github.com/vbatts/tar-split v0.11.5 // indirect github.com/zondax/hid v0.9.2 // indirect github.com/zondax/ledger-go v0.14.3 // indirect - go.etcd.io/bbolt v1.3.8 // indirect + go.etcd.io/bbolt v1.3.10 // indirect go.opencensus.io v0.24.0 // indirect go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect @@ -233,18 +234,18 @@ require ( go.uber.org/atomic v1.11.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/crypto v0.25.0 // indirect - golang.org/x/exp v0.0.0-20240222234643-814bf88cf225 // indirect + golang.org/x/crypto v0.26.0 // indirect + golang.org/x/exp v0.0.0-20240404231335-c0f41cb1a7a0 // indirect golang.org/x/mod v0.17.0 // indirect - golang.org/x/net v0.27.0 // indirect - golang.org/x/oauth2 v0.20.0 // indirect - golang.org/x/sync v0.7.0 // indirect + golang.org/x/net v0.28.0 // indirect + golang.org/x/oauth2 v0.21.0 // indirect + golang.org/x/sync v0.8.0 // indirect golang.org/x/sys v0.24.0 // indirect - golang.org/x/term v0.22.0 // indirect - golang.org/x/text v0.16.0 // indirect + golang.org/x/term v0.23.0 // indirect + golang.org/x/text v0.17.0 // indirect golang.org/x/time v0.5.0 // indirect - google.golang.org/api v0.169.0 // indirect - google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9 // indirect + google.golang.org/api v0.171.0 // indirect + google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 // indirect gopkg.in/ini.v1 v1.67.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect diff --git a/go.sum b/go.sum index b9c3670e..defa306b 100644 --- a/go.sum +++ b/go.sum @@ -188,10 +188,10 @@ connectrpc.com/connect v1.15.0 h1:lFdeCbZrVVDydAqwr4xGV2y+ULn+0Z73s5JBj2LikWo= connectrpc.com/connect v1.15.0/go.mod h1:bQmjpDY8xItMnttnurVgOkHUBMRT9cpsNi2O4AjKhmA= connectrpc.com/otelconnect v0.7.0 h1:ZH55ZZtcJOTKWWLy3qmL4Pam4RzRWBJFOqTPyAqCXkY= connectrpc.com/otelconnect v0.7.0/go.mod h1:Bt2ivBymHZHqxvo4HkJ0EwHuUzQN6k2l0oH+mp/8nwc= -cosmossdk.io/api v0.7.3 h1:V815i8YOwOAQa1rLCsSMjVG5Gnzs02JLq+l7ks8s1jk= -cosmossdk.io/api v0.7.3/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/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.5 h1:0LVv3nEByn//hFDIrYLs2WvsEU3HodOelh4SDHnA/1I= +cosmossdk.io/client/v2 v2.0.0-beta.5/go.mod h1:4p0P6o0ro+FizakJUYS9SeM94RNbv0thLmkHRw5o5as= 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.1 h1:h9WfBey7NAiFfIcUhDVNS503I2P2HdZLebJlUIs8LPA= @@ -200,12 +200,12 @@ cosmossdk.io/depinject v1.0.0 h1:dQaTu6+O6askNXO06+jyeUAnF2/ssKwrrszP9t5q050= cosmossdk.io/depinject v1.0.0/go.mod h1:zxK/h3HgHoA/eJVtiSsoaRaRA2D5U4cJ5thIG4ssbB8= cosmossdk.io/errors v1.0.1 h1:bzu+Kcr0kS/1DuPBtUFdWjzLqyUuCiyHjyJB6srBV/0= cosmossdk.io/errors v1.0.1/go.mod h1:MeelVSZThMi4bEakzhhhE/CKqVv3nOJDA25bIqRDu/U= -cosmossdk.io/log v1.3.1 h1:UZx8nWIkfbbNEWusZqzAx3ZGvu54TZacWib3EzUYmGI= -cosmossdk.io/log v1.3.1/go.mod h1:2/dIomt8mKdk6vl3OWJcPk2be3pGOS8OQaLUM/3/tCM= +cosmossdk.io/log v1.4.1 h1:wKdjfDRbDyZRuWa8M+9nuvpVYxrEOwbD/CA8hvhU8QM= +cosmossdk.io/log v1.4.1/go.mod h1:k08v0Pyq+gCP6phvdI6RCGhLf/r425UT6Rk/m+o74rU= cosmossdk.io/math v1.3.0 h1:RC+jryuKeytIiictDslBP9i1fhkVm6ZDmZEoNP316zE= cosmossdk.io/math v1.3.0/go.mod h1:vnRTxewy+M7BtXBNFybkuhSH4WfedVAAnERHgVFhp3k= -cosmossdk.io/store v1.0.2 h1:lSg5BTvJBHUDwswNNyeh4K/CbqiHER73VU4nDNb8uk0= -cosmossdk.io/store v1.0.2/go.mod h1:EFtENTqVTuWwitGW1VwaBct+yDagk7oG/axBMPH+FXs= +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= @@ -214,10 +214,8 @@ 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.1 h1:Mg+EMp67Pz+NukbJqYxuo8uRp7N/a9uR+oVS9pONtj8= -cosmossdk.io/x/tx v0.13.1/go.mod h1:CBCU6fsRVz23QGFIQBb1DNX2DztJCf3jWyEkHY2nJQ0= +cosmossdk.io/x/tx v0.13.5 h1:FdnU+MdmFWn1pTsbfU0OCf2u6mJ8cqc1H4OMG418MLw= +cosmossdk.io/x/tx v0.13.5/go.mod h1:V6DImnwJMTq5qFjeGWpXNiT/fjgE4HtmclRmTqRVM3w= 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= @@ -282,10 +280,10 @@ github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816 h1:41iFGWnSlI2 github.com/bgentry/speakeasy v0.1.1-0.20220910012023-760eaf8b6816/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs= 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.3 h1:xfbtw8lwpp0G6NwSHb+UE67ryTFHJAiNuipusjXSohQ= -github.com/btcsuite/btcd/btcutil v1.1.3/go.mod h1:UR7dsSJzJUfMmFiiLlIrMq1lS9jh9EdCV7FStZSnpi0= +github.com/btcsuite/btcd/btcec/v2 v2.3.4 h1:3EJjcN70HCu/mwqlUsGK8GcNVyLVxFDlWurTXGPFfiQ= +github.com/btcsuite/btcd/btcec/v2 v2.3.4/go.mod h1:zYzJ8etWJQIv1Ogk7OzpWjowwOdXY1W/17j2MW85J04= +github.com/btcsuite/btcd/btcutil v1.1.6 h1:zFL2+c3Lb9gEgqKNzowKUPQNb8jV7v5Oaodi/AYFd6c= +github.com/btcsuite/btcd/btcutil v1.1.6/go.mod h1:9dFymx8HpuLqBnsPELrImQeTQfKBQqzqGbbV3jK55aE= 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/bufbuild/buf v1.30.0 h1:V/Gir+aVKukqI/w2Eqoiv4tqUs01KBWP9t3Hz/9/25I= @@ -306,8 +304,8 @@ github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA 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/chromedp/cdproto v0.0.0-20230802225258-3cf4e6d46a89/go.mod h1:GKljq0VrfU4D5yc+2qA6OVr8pmO/MBbPEWqWQ/oqGEs= github.com/chromedp/chromedp v0.9.2/go.mod h1:LkSXJKONWTCHAfQasKFUZI+mxqS4tZqhmtGzzhLsnLs= @@ -339,21 +337,23 @@ github.com/cockroachdb/apd/v2 v2.0.2/go.mod h1:DDxRlzC2lo3/vSlmSoS7JkqbbrARPuFOG github.com/cockroachdb/datadriven v0.0.0-20190809214429-80d97fb3cbaa/go.mod h1:zn76sxSg3SzpJ0PPJaLDCu+Bu0Lg3sKTORVIj19EIF8= 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/errors v1.11.3 h1:5bA+k2Y6r+oz/6Z/RFlNeVCesGARKuC6YymtcDrbC/I= +github.com/cockroachdb/errors v1.11.3/go.mod h1:m4UIW4CDjx+R5cybPsNrRbreomiFqt8o1h1wUVazSd8= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce h1:giXvy4KSc/6g/esnpM7Geqxka4WSqI1SZc7sMJFd3y4= +github.com/cockroachdb/fifo v0.0.0-20240606204812-0bbfbd93a7ce/go.mod h1:9/y3cnZ5GKakj/H4y9r9GTjCvAFta7KLgSHPJJYc52M= 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/pebble v1.1.1 h1:XnKU22oiCLy2Xn8vp1re67cXg4SAasg/WDt1NtcRFaw= +github.com/cockroachdb/pebble v1.1.1/go.mod h1:4exszw1r40423ZsmkG/09AFEG83I0uDgfujJdbL6kYU= 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/cometbft/cometbft v0.38.6 h1:QSgpCzrGWJ2KUq1qpw+FCfASRpE27T6LQbfEHscdyOk= -github.com/cometbft/cometbft v0.38.6/go.mod h1:8rSPxzUJYquCN8uuBgbUHOMg2KAwvr7CyUw+6ukO4nw= -github.com/cometbft/cometbft-db v0.9.1 h1:MIhVX5ja5bXNHF8EYrThkG9F7r9kSfv8BX4LWaxWJ4M= -github.com/cometbft/cometbft-db v0.9.1/go.mod h1:iliyWaoV0mRwBJoizElCwwRA9Tf7jZJOURcRZF9m60U= +github.com/cometbft/cometbft v0.38.12 h1:OWsLZN2KcSSFe8bet9xCn07VwhBnavPea3VyPnNq1bg= +github.com/cometbft/cometbft v0.38.12/go.mod h1:GPHp3/pehPqgX1930HmK1BpBLZPxB75v/dZg8Viwy+o= +github.com/cometbft/cometbft-db v0.11.0 h1:M3Lscmpogx5NTbb1EGyGDaFRdsoLWrUWimFEyf7jej8= +github.com/cometbft/cometbft-db v0.11.0/go.mod h1:GDPJAC/iFHNjmZZPN8V8C1yr/eyityhi2W1hz2MGKSc= github.com/containerd/continuity v0.3.0 h1:nisirsYROK15TAMVukJOUyGJjz4BNQJBVsNvAXZJ/eg= github.com/containerd/continuity v0.3.0/go.mod h1:wJEAIwKOm/pBZuBd0JmeTvnLquTB1Ag8espWhkykbPM= github.com/containerd/log v0.1.0 h1:TCJt7ioM2cr/tfR8GPbGf9/VRAX8D2B4PjzCpfX540I= @@ -372,29 +372,29 @@ github.com/cosmos/cosmos-db v1.0.2 h1:hwMjozuY1OlJs/uh6vddqnk9j7VamLv+0DBlbEXbAK 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.50.5 h1:MOEi+DKYgW67YaPgB+Pf+nHbD3V9S/ayitRKJYLfGIA= -github.com/cosmos/cosmos-sdk v0.50.5/go.mod h1:oV/k6GJgXV9QPoM2fsYDPPsyPBgQbdotv532O6Mz1OQ= +github.com/cosmos/cosmos-sdk v0.50.6 h1:efR3MsvMHX5sxS3be+hOobGk87IzlZbSpsI2x/Vw3hk= +github.com/cosmos/cosmos-sdk v0.50.6/go.mod h1:lVkRY6cdMJ0fG3gp8y4hFrsKZqF4z7y0M2UXFb9Yt40= 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.5.0 h1:SDVwzEqZDDBoslaeZg+dGE55hdzHfgUA40pEanMh52o= -github.com/cosmos/gogoproto v1.5.0/go.mod h1:iUM31aofn3ymidYG6bUR5ZFrk+Om8p5s754eMUcyp8I= -github.com/cosmos/iavl v1.0.1 h1:D+mYbcRO2wptYzOM1Hxl9cpmmHU1ZEt9T2Wv5nZTeUw= -github.com/cosmos/iavl v1.0.1/go.mod h1:8xIUkgVvwvVrBu81scdPty+/Dx9GqwHnAvXz4cwF7RY= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= +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/v8 v8.1.1 h1:N2+GA86yACcXnKWCKtqdbCwP0/Eo8pH79+6e7TicULU= github.com/cosmos/ibc-go/v8 v8.1.1/go.mod h1:o1ipS95xpdjqNcB8Drq0eI3Sn4FRLigjll42ec1ECuU= -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/ics23/go v0.11.0 h1:jk5skjT0TqX5e5QJbEnwXIS2yI2vnmLOgpQPeM5RtnU= +github.com/cosmos/ics23/go v0.11.0/go.mod h1:A8OjxPE67hHST4Icw94hOxxFEJMBG031xIGF/JHNIY0= 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/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 h1:qMCsGGgs+MAzDFyp9LpAe1Lqy/fY/qCovCm0qnXZOBM= -github.com/cpuguy83/go-md2man/v2 v2.0.3/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= +github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= +github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= 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= @@ -673,8 +673,8 @@ github.com/googleapis/gax-go/v2 v2.3.0/go.mod h1:b8LNqSzNabLiUpXKkY7HAR5jr6bIT99 github.com/googleapis/gax-go/v2 v2.4.0/go.mod h1:XOTVJ59hdnfJLIP/dh8n5CGryZR2LxK9wbMD5+iXC6c= github.com/googleapis/gax-go/v2 v2.5.1/go.mod h1:h6B0KMMFNtI2ddbGJn3T3ZbwkeT6yqEF02fYlzkUCyo= github.com/googleapis/gax-go/v2 v2.6.0/go.mod h1:1mjbznJAPHFpesgE5ucqfYEscaz5kMdcIDwU/6+DDoY= -github.com/googleapis/gax-go/v2 v2.12.2 h1:mhN09QQW1jEWeMF74zGR81R30z4VJzjZsfkUhuHF+DA= -github.com/googleapis/gax-go/v2 v2.12.2/go.mod h1:61M8vcyyXR2kqKFxKrfA22jaA8JGF7Dc8App1U3H6jc= +github.com/googleapis/gax-go/v2 v2.12.3 h1:5/zPPDvw8Q1SuXjrqrZslrqT7dL/uJT2CQii/cLCKqA= +github.com/googleapis/gax-go/v2 v2.12.3/go.mod h1:AKloxT6GtNbaLm8QTNSidHUVsHYcBHwWRvkNFJUQcS4= 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= @@ -686,8 +686,8 @@ 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.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc= -github.com/gorilla/websocket v1.5.0/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= +github.com/gorilla/websocket v1.5.3 h1:saDtZ6Pbx/0u+bgYQ3q96pZgCzfhKXGPqt7kZ72aNNg= +github.com/gorilla/websocket v1.5.3/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE= 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.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI= @@ -714,8 +714,8 @@ github.com/hashicorp/go-hclog v1.5.0/go.mod h1:W4Qnvbt70Wk/zYJryRzDRU/4r0kIg0PVH 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.2 h1:ErEYO2f//CjKsUDw4SmLzelsK6L3ZmOAR/4P9iS7ruY= -github.com/hashicorp/go-metrics v0.5.2/go.mod h1:KEjodfebIOuBYSAe/bHTm+HChmKSxAOXPBieMLYozDE= +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= @@ -738,6 +738,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8= 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/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= +github.com/hashicorp/golang-lru/v2 v2.0.7/go.mod h1:QeFd9opnmA6QUJc5vARoKUSoFhyfM2/ZepoAG6RGpeM= 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= @@ -800,8 +802,8 @@ github.com/klauspost/compress v1.10.3/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYs github.com/klauspost/compress v1.11.7/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs= github.com/klauspost/compress v1.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.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= -github.com/klauspost/compress v1.17.7/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= +github.com/klauspost/compress v1.17.9 h1:6KIumPrER1LHsvBVuDa0r5xaG0Es51mhhB9BQB2qeMA= +github.com/klauspost/compress v1.17.9/go.mod h1:Di0epgTjJY877eYKx5yC51cX2A2Vl2ibi7bDH9ttBbw= github.com/klauspost/pgzip v1.2.6 h1:8RXeL5crjEUFnR2/Sn6GJNWtSQ3Dk8pq4CL3jvdDyjU= github.com/klauspost/pgzip v1.2.6/go.mod h1:Ch1tH69qFZu15pkjo5kYi6mth2Zzwzt50oCQKQE9RUs= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= @@ -814,18 +816,18 @@ 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 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/ledongthuc/pdf v0.0.0-20220302134840-0c2507a12d80/go.mod h1:imJHygn/1yfhB7XSJJKlFZKl/J+dCPAknuiaGOshXAs= github.com/leodido/go-urn v1.2.0/go.mod h1:+8+nEpDfqqsY+g338gtMEUOtuK+4dEMhiQEgxpxOKII= github.com/leodido/go-urn v1.2.1 h1:BqpAaACuzVSgi/VLzGZIobT2z4v53pjosyNd9Yv6n/w= github.com/leodido/go-urn v1.2.1/go.mod h1:zt4jvISO2HfUBqxjfIshjdMTYS56ZS/qv49ictyFfxY= github.com/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.8.12 h1:1/pCztQUOa3BX/1gR3jSZDoaKFpeHFvQ1XrqZpSvZVo= -github.com/linxGnu/grocksdb v1.8.12/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY= +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= @@ -878,6 +880,8 @@ github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/morikuni/aec v1.0.0/go.mod h1:BbKIizmSmc5MMPqRYbxO4ZU0S0+P200+tUnFx7PXmsc= 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/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= 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= @@ -935,12 +939,12 @@ github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0Mw github.com/pascaldekloe/goe v0.1.0/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= 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.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4= -github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc= +github.com/pelletier/go-toml/v2 v2.2.2 h1:aYUidT7k73Pcl9nb2gScu7NSrKCSHIDE89b3+6Wq+LM= +github.com/pelletier/go-toml/v2 v2.2.2/go.mod h1:1t835xjRzz80PqgE6HHgN2JOsmgYu/h4qDAS4n929Rs= github.com/performancecopilot/speed v3.0.0+incompatible/go.mod h1:/CLtqpZ5gBg1M9iaPbIdPPGyKcA8hKdoy6hAWba7Yac= github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA= -github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4= +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= @@ -965,32 +969,32 @@ 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.18.0 h1:HzFfmkOzH5Q8L8G+kSJKUx5dtG87sewO+FoDDqP5Tbk= -github.com/prometheus/client_golang v1.18.0/go.mod h1:T+GXkCk5wSJyOqMIzVgvvjFDlkOQntgjkJWKrN5txjA= +github.com/prometheus/client_golang v1.20.1 h1:IMJXHOD6eARkQpxo8KkhgEVFlBNm+nkrFUyGlIu7Na8= +github.com/prometheus/client_golang v1.20.1/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE= 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.6.0 h1:k1v3CzpSRUTrKMppY35TLwPvxHqBu0bYgxZzqGIgaos= -github.com/prometheus/client_model v0.6.0/go.mod h1:NTQHnmxFpouOD0DpvP4XujX3CdOAGQPoaGhyTchlyt8= +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.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.47.0 h1:p5Cz0FNHo7SnWOmWmoRozVcjEp0bIVU8cV7OShpjL1k= -github.com/prometheus/common v0.47.0/go.mod h1:0/KsvlIEfPQCQ5I2iNSAWKPZziNCvRs5EC6ILDTlAPc= +github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc= +github.com/prometheus/common v0.55.0/go.mod h1:2SECS4xJG1kd8XF9IcM1gMX6510RAEL65zxzNImwdc8= 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.12.0 h1:jluTpSng7V9hY0O2R9DzzJHYb2xULk9VTR1V1R/k6Bo= -github.com/prometheus/procfs v0.12.0/go.mod h1:pcuDEFsWDnvcgNzo4EEweacyhjeA9Zk3cnaOZAZEfOo= +github.com/prometheus/procfs v0.15.1 h1:YagwOFzUgYfKKHX6Dr+sHT7km/hxC76UB0learggepc= +github.com/prometheus/procfs v0.15.1/go.mod h1:fB45yRUv8NstnjriLhBQLuOUt+WW4BsoGhij/e3PBqk= github.com/rakyll/statik v0.1.7 h1:OF3QCZUuyPxuGEP7B4ypUa7sB/iHtqOTDYZXGM8KOdQ= github.com/rakyll/statik v0.1.7/go.mod h1:AlZONWzMtEnMs7W4e/1LURLiI49pIMmp6V9Unghqrcc= github.com/rcrowley/go-metrics v0.0.0-20181016184325-3113b8401b8a/go.mod h1:bCqnVzQkZxMG4s8nGwiZ5l3QUCyqpo9Y+/ZMZ9VjZe4= @@ -1003,11 +1007,11 @@ github.com/rogpeppe/go-internal v1.9.0/go.mod h1:WtVeX8xhTBvf0smdhujwtBcq4Qrzq/f 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.10.1 h1:L0uuZVXIKlI1SShY2nhFfo44TYvDPQ1w4oFkUJNfhyo= -github.com/rs/cors v1.10.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= +github.com/rs/cors v1.11.1 h1:eU3gRzXLRK57F5rKMGMZURNdIG4EoAmX8k94r9wXWHA= +github.com/rs/cors v1.11.1/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= github.com/rs/xid v1.5.0/go.mod h1:trrq9SKmegXys3aeAKXMUTdJsYXVwGY3RLcfgqegfbg= -github.com/rs/zerolog v1.32.0 h1:keLypqrlIjaFsbmJOBdB/qvyF8KEtCWHwobLp5l/mQ0= -github.com/rs/zerolog v1.32.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= +github.com/rs/zerolog v1.33.0 h1:1cU2KZkvPxNyfgEmhHAz/1A9Bz+llsdYzklWFzgp0r8= +github.com/rs/zerolog v1.33.0/go.mod h1:/7mN4D5sKwJLZQ2b/znpjC3/GQWY/xaDXUM0kKWRHss= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= @@ -1045,16 +1049,16 @@ github.com/spf13/cast v1.6.0 h1:GEiTHELF+vaR5dhz3VqZfFSzZjYbgeKDpBxQVS4GYJ0= github.com/spf13/cast v1.6.0/go.mod h1:ancEpBxwJDODSW/UG4rDrAqiKolqNNh2DX3mk86cAdo= github.com/spf13/cobra v0.0.3/go.mod h1:1l0Ry5zgKvJasoi3XT1TypsSe7PqH0Sj9dhYf7v3XqQ= github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU= -github.com/spf13/cobra v1.8.0 h1:7aJaZx1B85qltLMc546zn58BxxfZdR/W22ej9CFoEf0= -github.com/spf13/cobra v1.8.0/go.mod h1:WXLWApfZ71AjXPya3WOlMsY9yMs7YeiHhFVlvLyhcho= +github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM= +github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y= github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo= github.com/spf13/pflag v1.0.1/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.3/go.mod h1:DYY7MBk1bdzusC3SYhjObp+wFpr4gzcvqqNjLnInEg4= github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= 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/spf13/viper v1.19.0 h1:RWq5SEjt8o25SROyN3z2OrDB9l7RPd3lwTWU8EcEdcI= +github.com/spf13/viper v1.19.0/go.mod h1:GQUN9bilAbhU/jgc1bKs99f/suXKeUMct8Adx5+Ntkg= github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= @@ -1115,8 +1119,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.8 h1:xs88BrvEv273UsB79e0hcVrlUWmS0a8upikMFhSyAtA= -go.etcd.io/bbolt v1.3.8/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw= +go.etcd.io/bbolt v1.3.10 h1:+BqfJTcCzTItrop8mq/lbzL8wSGtj94UO/3U31shqG0= +go.etcd.io/bbolt v1.3.10/go.mod h1:bK3UQLPJZly7IlNmV7uVHJDxfe5aK9Ll93e/74Y9oEQ= 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= @@ -1181,8 +1185,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U 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-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= -golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= -golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= +golang.org/x/crypto v0.26.0 h1:RrRspgV4mU+YwB4FYnuBoKsUapNIL5cohGAmSH3azsw= +golang.org/x/crypto v0.26.0/go.mod h1:GY7jblb9wI+FOo5y8/S2oY4zWP07AkOJ4+jxCqdqn54= 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= @@ -1194,8 +1198,8 @@ golang.org/x/exp v0.0.0-20200119233911-0405dc783f0a/go.mod h1:2RIsYlXP63K8oxa1u0 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-20240222234643-814bf88cf225 h1:LfspQV/FYTatPTr/3HzIcmiUFH7PGP+OQ6mgDYo3yuQ= -golang.org/x/exp v0.0.0-20240222234643-814bf88cf225/go.mod h1:CxmFvTBINI24O/j8iY7H1xHzx2i4OsyguNBmN/uPtqc= +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= @@ -1283,8 +1287,8 @@ golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug golang.org/x/net v0.0.0-20220909164309-bea034e7d591/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.0.0-20221014081412-f15817d10f9b/go.mod h1:YDH+HFinaLZZlnHAfSS6ZXJJ9M9t4Dl22yv3iI2vPwk= golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco= -golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= -golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= +golang.org/x/net v0.28.0 h1:a9JDOJc5GMUJ0+UDqmLT86WiEy7iWyIhz8gz8E4e5hE= +golang.org/x/net v0.28.0/go.mod h1:yqtgsTWOOnlGLG9GFRrK3++bGOUEkNBoHZc8MEDWPNg= 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= @@ -1310,8 +1314,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.20.0 h1:4mQdhULixXKP1rwYBW0vAijoXnkTG0BLCDRzfe1idMo= -golang.org/x/oauth2 v0.20.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= +golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= +golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= 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= @@ -1326,8 +1330,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.7.0 h1:YsImfSBoP9QPYL0xyKJPq0gcaJdG3rInoqxTWbfQu9M= -golang.org/x/sync v0.7.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= +golang.org/x/sync v0.8.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,8 +1435,8 @@ golang.org/x/sys v0.24.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.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= -golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= +golang.org/x/term v0.23.0 h1:F6D4vR+EHoL9/sWAWgAR1H2DcHr4PareCbAaCo1RpuU= +golang.org/x/term v0.23.0/go.mod h1:DgV24QBUrK6jhZXl+20l6UWznPlwAHm1Q1mGHtydmSk= 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= @@ -1443,8 +1447,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= -golang.org/x/text v0.16.0 h1:a94ExnEXNtEwYLGJSIUxnWoxoRz/ZcCsV63ROupILh4= -golang.org/x/text v0.16.0/go.mod h1:GhwF1Be+LQoKShO3cGOHzqOgRrGaYc9AvblQOmPVHnI= +golang.org/x/text v0.17.0 h1:XtiM5bkSOt+ewxlOE/aE/AKEHibwj/6gvWMl9Rsh0Qc= +golang.org/x/text v0.17.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY= golang.org/x/time v0.0.0-20180412165947-fbb02b2291d2/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= 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= @@ -1574,8 +1578,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.169.0 h1:QwWPy71FgMWqJN/l6jVlFHUa29a7dcUy02I8o799nPY= -google.golang.org/api v0.169.0/go.mod h1:gpNOiMA2tZ4mf5R9Iwf4rK/Dcz0fbdIgWYWVoxmsyLg= +google.golang.org/api v0.171.0 h1:w174hnBPqut76FzW5Qaupt7zY8Kql6fiVjgys4f58sU= +google.golang.org/api v0.171.0/go.mod h1:Hnq5AHm4OTMt2BUVjael2CWZFD6vksJdWCWiUAmjC9o= 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= @@ -1690,8 +1694,8 @@ 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-20240213162025-012b6fc9bca9 h1:9+tzLLstTlPTRyJTh+ah5wIMsBW5c4tQwGTN3thOW9Y= -google.golang.org/genproto v0.0.0-20240213162025-012b6fc9bca9/go.mod h1:mqHbVIp48Muh7Ywss/AD6I5kNVKZMmAa/QEW58Gxp2s= +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-20240513163218-0867130af1f8 h1:W5Xj/70xIA4x60O/IFyXivR5MGqblAb8R3w26pnD6No= google.golang.org/genproto/googleapis/api v0.0.0-20240513163218-0867130af1f8/go.mod h1:vPrPUTsDCYxXWjP7clS81mZ6/803D8K4iM9Ma27VKas= google.golang.org/genproto/googleapis/rpc v0.0.0-20240709173604-40e1e62336c5 h1:SbSDUWW1PAO24TNpLdeheoYPd7kllICcLU52x6eD4kQ= diff --git a/proto/reserve/auction/v1/auction.proto b/proto/reserve/auction/v1/auction.proto index 1bab4a39..0e1fcc87 100644 --- a/proto/reserve/auction/v1/auction.proto +++ b/proto/reserve/auction/v1/auction.proto @@ -25,20 +25,6 @@ enum AuctionStatus { // Auction struct message Auction { - // start_time defines auction's start time - google.protobuf.Timestamp start_time = 1 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - - // end_time defines where the auction ended when there are no winning bid - google.protobuf.Timestamp end_time = 2 [ - (gogoproto.stdtime) = true, - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; - // for simplicity, will use vault id that start the auction as auction id uint64 auction_id = 3; diff --git a/proto/reserve/auction/v1/query.proto b/proto/reserve/auction/v1/query.proto index 5ce43ca7..0b78bdb9 100644 --- a/proto/reserve/auction/v1/query.proto +++ b/proto/reserve/auction/v1/query.proto @@ -20,8 +20,13 @@ service Query { rpc QueryAllAuction(QueryAllAuctionRequest) returns (QueryAllAuctionResponse){ option (google.api.http).get = "/reserve/auction/auction"; } + + rpc QueryAllBids(QueryAllBidsRequest) returns (QueryAllBidsResponse){ + option (google.api.http).get = "/reserve/auction/auction"; + } } + // QueryParamsRequest is request type for the Query/Params RPC method. message QueryParamsRequest {} @@ -38,4 +43,13 @@ message QueryAllAuctionResponse { // params holds all the parameters of this module. repeated Auction auctions = 1 [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; +} + + +message QueryAllBidsRequest {} + +message QueryAllBidsResponse { + // params holds all the parameters of this module. + repeated Bid Bids = 1 + [ (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; } \ No newline at end of file diff --git a/proto/reserve/vaults/params.proto b/proto/reserve/vaults/params.proto index 63253ad9..84e00349 100644 --- a/proto/reserve/vaults/params.proto +++ b/proto/reserve/vaults/params.proto @@ -29,12 +29,6 @@ message Params { (gogoproto.nullable) = false, (amino.dont_omitempty) = true ]; - - google.protobuf.Duration liquidate_period = 4 [ - (gogoproto.stdduration) = true, - (gogoproto.nullable) = false, - (amino.dont_omitempty) = true - ]; } // VaultParams defines the parameters for each collateral vault type. diff --git a/script/proposal-vault-1.json b/script/proposal-vault-1.json new file mode 100644 index 00000000..ce67d458 --- /dev/null +++ b/script/proposal-vault-1.json @@ -0,0 +1,13 @@ +{ + "messages": [{ + "@type": "/reserve.vaults.MsgActiveCollateral", + "denom": "usdt", + "authority":"onomy10d07y265gmmuvt4z0w9aw880jnsr700jqr8n8k", + "min_collateral_ratio": "0.5", + "liquidation_ratio":"0.5", + "max_debt":"1000000000000000000000000000" + }], + "deposit": "100000000stake", + "title": "My proposal", + "summary": "A short summary of my proposal" + } \ No newline at end of file diff --git a/script/proposal-1.json b/script/proposal-vault-2.json similarity index 88% rename from script/proposal-1.json rename to script/proposal-vault-2.json index 7f7fc6ee..11a199c6 100644 --- a/script/proposal-1.json +++ b/script/proposal-vault-2.json @@ -5,7 +5,7 @@ "authority":"onomy10d07y265gmmuvt4z0w9aw880jnsr700jqr8n8k", "min_collateral_ratio": "0.5", "liquidation_ratio":"0.5", - "max_debt":"10000" + "max_debt":"1000000000000000000000000000" }], "deposit": "100000000stake", "title": "My proposal", diff --git a/script/psm-test.sh b/script/psm-test.sh index 12d3d40f..f9096478 100755 --- a/script/psm-test.sh +++ b/script/psm-test.sh @@ -112,40 +112,40 @@ sed -i -E "s|persistent_peers = \"\"|persistent_peers = \"$node1@localhost:26656 # # start all three validators -screen -S onomy1 -t onomy1 -d -m reserved start --home=$HOME/.reserved/validator1 -screen -S onomy2 -t onomy2 -d -m reserved start --home=$HOME/.reserved/validator2 -screen -S onomy3 -t onomy3 -d -m reserved start --home=$HOME/.reserved/validator3 +# screen -S onomy1 -t onomy1 -d -m reserved start --home=$HOME/.reserved/validator1 +# screen -S onomy2 -t onomy2 -d -m reserved start --home=$HOME/.reserved/validator2 +# screen -S onomy3 -t onomy3 -d -m reserved start --home=$HOME/.reserved/validator3 # submit proposal add usdt -sleep 7 -reserved tx gov submit-proposal ./script/proposal-2.json --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y - -# # vote -sleep 7 -reserved tx gov vote 1 yes --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake -reserved tx gov vote 1 yes --from validator2 --keyring-backend test --home ~/.reserved/validator2 --chain-id testing-1 -y --fees 20stake -reserved tx gov vote 1 yes --from validator3 --keyring-backend test --home ~/.reserved/validator3 --chain-id testing-1 -y --fees 20stake - -# wait voting_perio=15s -sleep 15 -echo "========sleep==========" - -# check add usdt, balances -reserved q psm all-stablecoin -reserved q bank balances $(reserved keys show validator1 -a --keyring-backend test --home /Users/donglieu/.reserved/validator1) - -# tx swap usdt to nomUSD -echo "========swap===========" -reserved tx psm swap-to-nomUSD 100000000000000000000000000000usdt --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake - -sleep 7 -# Check account after swap -reserved q bank balances $(reserved keys show validator1 -a --keyring-backend test --home /Users/donglieu/.reserved/validator1) - -# tx swap nomUSD to usdt -reserved tx psm swap-to-stablecoin usdt 1000nomUSD --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake - -sleep 7 -# Check account after swap -reserved q bank balances $(reserved keys show validator1 -a --keyring-backend test --home /Users/donglieu/.reserved/validator1) -# killall reserved || true \ No newline at end of file +# sleep 7 +# reserved tx gov submit-proposal ./script/proposal-2.json --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y + +# # # vote +# sleep 7 +reserved tx gov vote 2 yes --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake +reserved tx gov vote 2 yes --from validator2 --keyring-backend test --home ~/.reserved/validator2 --chain-id testing-1 -y --fees 20stake +reserved tx gov vote 2 yes --from validator3 --keyring-backend test --home ~/.reserved/validator3 --chain-id testing-1 -y --fees 20stake + +# # wait voting_perio=15s +# sleep 15 +# echo "========sleep==========" + +# # check add usdt, balances +# reserved q psm all-stablecoin +# reserved q bank balances $(reserved keys show validator1 -a --keyring-backend test --home /Users/donglieu/.reserved/validator1) + +# # tx swap usdt to nomUSD +# echo "========swap===========" +# reserved tx psm swap-to-nomUSD 100000000000000000000000000000usdt --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake + +# sleep 7 +# # Check account after swap +# reserved q bank balances $(reserved keys show validator1 -a --keyring-backend test --home /Users/donglieu/.reserved/validator1) + +# # tx swap nomUSD to usdt +# reserved tx psm swap-to-stablecoin usdt 1000nomUSD --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake + +# sleep 7 +# # Check account after swap +# reserved q bank balances $(reserved keys show validator1 -a --keyring-backend test --home /Users/donglieu/.reserved/validator1) +# # killall reserved || true \ No newline at end of file diff --git a/script/vaults-gov-test.sh b/script/vaults-gov-test.sh index 3231dc8c..56ec754a 100755 --- a/script/vaults-gov-test.sh +++ b/script/vaults-gov-test.sh @@ -25,15 +25,15 @@ echo $mnemonic2| reserved keys add validator2 --recover --keyring-backend=test - echo $mnemonic3| reserved keys add validator3 --recover --keyring-backend=test --home=$HOME/.reserved/validator3 # create validator node with tokens to transfer to the three other nodes -reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 -reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 -reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator1 -reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 -reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 -reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator2 -reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 -reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 -reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000atom --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000atom --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000atom --home=$HOME/.reserved/validator1 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000atom --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000atom --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000atom --home=$HOME/.reserved/validator2 +reserved genesis add-genesis-account $(reserved keys show validator1 -a --keyring-backend=test --home=$HOME/.reserved/validator1) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000atom --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator2 -a --keyring-backend=test --home=$HOME/.reserved/validator2) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000atom --home=$HOME/.reserved/validator3 +reserved genesis add-genesis-account $(reserved keys show validator3 -a --keyring-backend=test --home=$HOME/.reserved/validator3) 10000000000000000000000000000000stake,10000000000000000000000000000000usdt,10000000000000000000000000000000atom --home=$HOME/.reserved/validator3 reserved genesis gentx validator1 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator1 --chain-id=testing-1 reserved genesis gentx validator2 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator2 --chain-id=testing-1 reserved genesis gentx validator3 1000000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator3 --chain-id=testing-1 @@ -121,17 +121,34 @@ sleep 7 reserved q gov proposals # reserved tx gov submit-legacy-proposal active-collateral "title" "description" "atom" "10" "0.1" "10000" 10000000000000000000stake --keyring-backend=test --home=$HOME/.reserved/validator1 --from validator1 -y --chain-id testing-1 --fees 20stake -reserved tx gov submit-proposal ./script/proposal-1.json --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y +reserved tx gov submit-proposal ./script/proposal-vault-1.json --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y +reserved tx gov submit-proposal ./script/proposal-vault-2.json --home=$HOME/.reserved/validator2 --from validator2 --keyring-backend test --fees 20stake --chain-id testing-1 -y # # vote sleep 7 reserved tx gov vote 1 yes --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake reserved tx gov vote 1 yes --from validator2 --keyring-backend test --home ~/.reserved/validator2 --chain-id testing-1 -y --fees 20stake reserved tx gov vote 1 yes --from validator3 --keyring-backend test --home ~/.reserved/validator3 --chain-id testing-1 -y --fees 20stake +sleep 7 +reserved tx gov vote 2 yes --from validator1 --keyring-backend test --home ~/.reserved/validator1 --chain-id testing-1 -y --fees 20stake +reserved tx gov vote 2 yes --from validator2 --keyring-backend test --home ~/.reserved/validator2 --chain-id testing-1 -y --fees 20stake +reserved tx gov vote 2 yes --from validator3 --keyring-backend test --home ~/.reserved/validator3 --chain-id testing-1 -y --fees 20stake # wait voting_perio=15s echo "========sleep==========" -sleep 15 +sleep 8 reserved q gov proposals +reserved tx oracle set-price usdt 1 --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y +reserved tx oracle set-price atom 8 --home=$HOME/.reserved/validator2 --from validator2 --keyring-backend test --fees 20stake --chain-id testing-1 -y + +sleep 7 + +reserved tx vaults create-vault 1250000000usdt 50000000nomUSD --home=$HOME/.reserved/validator1 --from validator1 --keyring-backend test --fees 20stake --chain-id testing-1 -y +reserved tx vaults create-vault 1250000000atom 50000000nomUSD --home=$HOME/.reserved/validator2 --from validator2 --keyring-backend test --fees 20stake --chain-id testing-1 -y +# killall reserved || true + -killall reserved || true \ No newline at end of file +# 02420E85EC300BE3E9219C5D8330207451F0D33764 +# liquidationMap map[] +# nextId 0 +# 10:26AM ERR panic recovered in runTx err="recovered: module account reserve does not exist: unknown address [cosmos/cosmos-sdk@v0.50.6/x/bank/keeper/keeper.go:286]\nstack:\ngoroutine 438 [running]:\nruntime/debug.Stack()\n\t/usr/local/go/src/runtime/debug/stack.go:26 +0x64\ngithub.com/cosmos/cosmos-sdk/baseapp.NewBaseApp.newDefaultRecoveryMiddleware.func5({0x106011480, 0x140023cc840})\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/recovery.go:74 +0x24\ngithub.com/cosmos/cosmos-sdk/baseapp.NewBaseApp.newDefaultRecoveryMiddleware.newRecoveryMiddleware.func7({0x106011480?, 0x140023cc840?})\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/recovery.go:42 +0x38\ngithub.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x106011480, 0x140023cc840}, 0x14003c493d8?)\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/recovery.go:31 +0x38\ngithub.com/cosmos/cosmos-sdk/baseapp.processRecovery({0x106011480, 0x140023cc840}, 0x8?)\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/recovery.go:36 +0x60\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx.func1()\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/baseapp.go:837 +0xd4\npanic({0x106011480?, 0x140023cc840?})\n\t/usr/local/go/src/runtime/panic.go:785 +0x124\ngithub.com/cosmos/cosmos-sdk/x/bank/keeper.BaseKeeper.SendCoinsFromModuleToModule({{{{0x106376aa0, 0x14000d05160}, {0x1063259e0, 0x14001588318}, {0x10637e670, 0x14000355400}, {0x106364930, 0x1400208e620}, {0x140015946a8, {...}, ...}, ...}, ...}, ...}, ...)\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/x/bank/keeper/keeper.go:286 +0x15c\ngithub.com/onomyprotocol/reserve/x/vaults/keeper.(*Keeper).CreateNewVault(0x14003c4aab8, {0x10635c228, 0x14006ab5080}, {0x140023664b0, 0x14, 0x15}, {{0x140019fcb80?, 0x1063259c0?}, {0x14001b59520?}}, {{0x140019fcbc0?, ...}, ...})\n\t/Users/donglieu/102024/main/reserve/x/vaults/keeper/vault.go:68 +0x3dc\ngithub.com/onomyprotocol/reserve/x/vaults/keeper.msgServer.CreateVault({{{0x106376aa0, 0x14000d05160}, {0x1063259e0, 0x140015883a0}, {0x1519327e8, 0x14000595688}, {0x10633ca60, 0x140015fd040}, {0x106336280, 0x14000be1c78}, ...}}, ...)\n\t/Users/donglieu/102024/main/reserve/x/vaults/keeper/msg_server.go:67 +0x74\ngithub.com/onomyprotocol/reserve/x/vaults/types._Msg_CreateVault_Handler.func1({0x10635c228?, 0x14006ab5080?}, {0x1061a5b00?, 0x14006296080?})\n\t/Users/donglieu/102024/main/reserve/x/vaults/types/tx.pb.go:1102 +0xd0\ngithub.com/cosmos/cosmos-sdk/baseapp.(*MsgServiceRouter).registerMsgServiceHandler.func2.1({0x10635c0d8, 0x14003c68008}, {0x14003c4b098?, 0x103f592f0?}, 0x358?, 0x140011a5bc0)\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/msg_service_router.go:175 +0x98\ngithub.com/onomyprotocol/reserve/x/vaults/types._Msg_CreateVault_Handler({0x1062c7640, 0x140012ca008}, {0x10635c0d8, 0x14003c68008}, 0x1063132e8, 0x14001b59580)\n\t/Users/donglieu/102024/main/reserve/x/vaults/types/tx.pb.go:1104 +0x148\ngithub.com/cosmos/cosmos-sdk/baseapp.(*MsgServiceRouter).registerMsgServiceHandler.func2({{0x10635c0a0, 0x107e7b100}, {0x106377360, 0x14006296100}, {{0x0, 0x0}, {0x14001c322a0, 0x9}, 0x67, {0x60f9708, ...}, ...}, ...}, ...)\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/msg_service_router.go:198 +0x2b0\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runMsgs(_, {{0x10635c0a0, 0x107e7b100}, {0x106377360, 0x14006296100}, {{0x0, 0x0}, {0x14001c322a0, 0x9}, 0x67, ...}, ...}, ...)\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/baseapp.go:1010 +0x170\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).runTx(0x140023fc248, 0x7, {0x140014f4140, 0x123, 0x123})\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/baseapp.go:948 +0xbf8\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).deliverTx(0x140023fc248, {0x140014f4140?, 0x123?, 0x14001a01540?})\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/baseapp.go:763 +0x88\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).internalFinalizeBlock(0x140023fc248, {0x10635c0a0, 0x107e7b100}, 0x14003c33b00)\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/abci.go:790 +0xc2c\ngithub.com/cosmos/cosmos-sdk/baseapp.(*BaseApp).FinalizeBlock(0x140023fc248, 0x14003c33b00)\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/baseapp/abci.go:884 +0x118\ngithub.com/cosmos/cosmos-sdk/server.cometABCIWrapper.FinalizeBlock(...)\n\t/Users/donglieu/go/pkg/mod/github.com/cosmos/cosmos-sdk@v0.50.6/server/cmt_abci.go:44\ngithub.com/cometbft/cometbft/abci/client.(*localClient).FinalizeBlock(0x14001688c20?, {0x10635c308?, 0x107e7b100?}, 0x10a8b0a68?)\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/abci/client/local_client.go:185 +0xe4\ngithub.com/cometbft/cometbft/proxy.(*appConnConsensus).FinalizeBlock(0x14001a040c0, {0x10635c308, 0x107e7b100}, 0x14003c33b00)\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/proxy/app_conn.go:104 +0x124\ngithub.com/cometbft/cometbft/state.(*BlockExecutor).applyBlock(_, {{{0xb, 0x0}, {0x14000a14069, 0x7}}, {0x14000a14080, 0x9}, 0x1, 0x66, {{0x140061a1b20, ...}, ...}, ...}, ...)\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/state/execution.go:224 +0x410\ngithub.com/cometbft/cometbft/state.(*BlockExecutor).ApplyVerifiedBlock(...)\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/state/execution.go:202\ngithub.com/cometbft/cometbft/consensus.(*State).finalizeCommit(0x1400248b508, 0x67)\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/consensus/state.go:1772 +0x97c\ngithub.com/cometbft/cometbft/consensus.(*State).tryFinalizeCommit(0x1400248b508, 0x67)\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/consensus/state.go:1682 +0x26c\ngithub.com/cometbft/cometbft/consensus.(*State).enterCommit.func1()\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/consensus/state.go:1617 +0x8c\ngithub.com/cometbft/cometbft/consensus.(*State).enterCommit(0x1400248b508, 0x67, 0x0)\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/consensus/state.go:1655 +0xac0\ngithub.com/cometbft/cometbft/consensus.(*State).addVote(0x1400248b508, 0x14001334750, {0x14001004090, 0x28})\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/consensus/state.go:2335 +0x182c\ngithub.com/cometbft/cometbft/consensus.(*State).tryAddVote(0x1400248b508, 0x14001334750, {0x14001004090?, 0x103dd81c4?})\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/consensus/state.go:2067 +0x28\ngithub.com/cometbft/cometbft/consensus.(*State).handleMsg(0x1400248b508, {{0x10632e320, 0x14000e82200}, {0x14001004090, 0x28}})\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/consensus/state.go:929 +0x2fc\ngithub.com/cometbft/cometbft/consensus.(*State).receiveRoutine(0x1400248b508, 0x0)\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/consensus/state.go:836 +0x2b8\ncreated by github.com/cometbft/cometbft/consensus.(*State).OnStart in goroutine 372\n\t/Users/donglieu/go/pkg/mod/github.com/cometbft/cometbft@v0.38.12/consensus/state.go:398 +0xf0\n: panic" module=server \ No newline at end of file diff --git a/testutil/network/network.go b/testutil/network/network.go index 29c13c7e..072c95c9 100644 --- a/testutil/network/network.go +++ b/testutil/network/network.go @@ -1,80 +1,80 @@ package network -import ( - "fmt" - "testing" +// import ( +// "fmt" +// "testing" - "github.com/cosmos/cosmos-sdk/testutil/network" - "github.com/stretchr/testify/require" +// "github.com/cosmos/cosmos-sdk/testutil/network" +// "github.com/stretchr/testify/require" - "github.com/onomyprotocol/reserve/app" -) +// "github.com/onomyprotocol/reserve/app" +// ) -type ( - Network = network.Network - Config = network.Config -) +// type ( +// Network = network.Network +// Config = network.Config +// ) -// New creates instance with fully configured cosmos network. -// Accepts optional config, that will be used in place of the DefaultConfig() if provided. -func New(t *testing.T, configs ...Config) *Network { - t.Helper() - if len(configs) > 1 { - panic("at most one config should be provided") - } - var cfg network.Config - if len(configs) == 0 { - cfg = DefaultConfig() - } else { - cfg = configs[0] - } - net, err := network.New(t, t.TempDir(), cfg) - require.NoError(t, err) - _, err = net.WaitForHeight(1) - require.NoError(t, err) - t.Cleanup(net.Cleanup) - return net -} +// // New creates instance with fully configured cosmos network. +// // Accepts optional config, that will be used in place of the DefaultConfig() if provided. +// func New(t *testing.T, configs ...Config) *Network { +// t.Helper() +// if len(configs) > 1 { +// panic("at most one config should be provided") +// } +// var cfg network.Config +// if len(configs) == 0 { +// cfg = DefaultConfig() +// } else { +// cfg = configs[0] +// } +// net, err := network.New(t, t.TempDir(), cfg) +// require.NoError(t, err) +// _, err = net.WaitForHeight(1) +// require.NoError(t, err) +// t.Cleanup(net.Cleanup) +// return net +// } -// DefaultConfig will initialize config for the network with custom application, -// genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig -func DefaultConfig() network.Config { - cfg, err := network.DefaultConfigWithAppConfig(app.AppConfig()) - if err != nil { - panic(err) - } - ports, err := freePorts(3) - if err != nil { - panic(err) - } - if cfg.APIAddress == "" { - cfg.APIAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[0]) - } - if cfg.RPCAddress == "" { - cfg.RPCAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[1]) - } - if cfg.GRPCAddress == "" { - cfg.GRPCAddress = fmt.Sprintf("0.0.0.0:%s", ports[2]) - } - return cfg -} +// // DefaultConfig will initialize config for the network with custom application, +// // genesis and single validator. All other parameters are inherited from cosmos-sdk/testutil/network.DefaultConfig +// func DefaultConfig() network.Config { +// cfg, err := network.DefaultConfigWithAppConfig(app.AppConfig()) +// if err != nil { +// panic(err) +// } +// ports, err := freePorts(3) +// if err != nil { +// panic(err) +// } +// if cfg.APIAddress == "" { +// cfg.APIAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[0]) +// } +// if cfg.RPCAddress == "" { +// cfg.RPCAddress = fmt.Sprintf("tcp://0.0.0.0:%s", ports[1]) +// } +// if cfg.GRPCAddress == "" { +// cfg.GRPCAddress = fmt.Sprintf("0.0.0.0:%s", ports[2]) +// } +// return cfg +// } -// freePorts return the available ports based on the number of requested ports. -func freePorts(n int) ([]string, error) { - closeFns := make([]func() error, n) - ports := make([]string, n) - for i := 0; i < n; i++ { - _, port, closeFn, err := network.FreeTCPAddr() - if err != nil { - return nil, err - } - ports[i] = port - closeFns[i] = closeFn - } - for _, closeFn := range closeFns { - if err := closeFn(); err != nil { - return nil, err - } - } - return ports, nil -} +// // freePorts return the available ports based on the number of requested ports. +// func freePorts(n int) ([]string, error) { +// closeFns := make([]func() error, n) +// ports := make([]string, n) +// for i := 0; i < n; i++ { +// _, port, closeFn, err := network.FreeTCPAddr() +// if err != nil { +// return nil, err +// } +// ports[i] = port +// closeFns[i] = closeFn +// } +// for _, closeFn := range closeFns { +// if err := closeFn(); err != nil { +// return nil, err +// } +// } +// return ports, nil +// } diff --git a/x/auction/client/cli/query.go b/x/auction/client/cli/query.go index 3178828b..8cfe68d5 100644 --- a/x/auction/client/cli/query.go +++ b/x/auction/client/cli/query.go @@ -22,6 +22,7 @@ func GetQueryCmd() *cobra.Command { cmd.AddCommand(CmdParams()) cmd.AddCommand(CmdQueryAllAuctions()) + cmd.AddCommand(CmdQueryAllBids()) return cmd } @@ -68,3 +69,25 @@ func CmdParams() *cobra.Command { flags.AddQueryFlagsToCmd(cmd) return cmd } + +func CmdQueryAllBids() *cobra.Command { + cmd := &cobra.Command{ + Use: "all-bids", + Short: "show all bids", + Args: cobra.ExactArgs(0), + RunE: func(cmd *cobra.Command, args []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.QueryAllBids(context.Background(), &types.QueryAllBidsRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + flags.AddQueryFlagsToCmd(cmd) + return cmd +} diff --git a/x/auction/keeper/abci.go b/x/auction/keeper/abci.go index 37a1a4d6..b4c00874 100644 --- a/x/auction/keeper/abci.go +++ b/x/auction/keeper/abci.go @@ -2,6 +2,7 @@ package keeper import ( "context" + "fmt" "time" "cosmossdk.io/math" @@ -14,18 +15,11 @@ func (k *Keeper) BeginBlocker(ctx context.Context) error { params := k.GetParams(ctx) currentTime := sdk.UnwrapSDKContext(ctx).BlockHeader().Time - lastAuctionPeriods_unix, err := k.lastestAuctionPeriod.Get(ctx) - if err != nil { - return err - } - lastAuctionPeriods := time.Unix(lastAuctionPeriods_unix, 0) + lastAuctionPeriods := time.Unix(k.LastestAuctionPeriod, 0) // check if has reached the next auction periods if lastAuctionPeriods.Add(params.AuctionPeriods).Before(currentTime) { // update latest auction period - err := k.lastestAuctionPeriod.Set(ctx, lastAuctionPeriods.Add(params.AuctionPeriods).Unix()) - if err != nil { - return err - } + k.LastestAuctionPeriod = lastAuctionPeriods.Add(params.AuctionPeriods).Unix() liquidations, err := k.vaultKeeper.GetLiquidations(ctx) if err != nil { @@ -68,7 +62,7 @@ func (k *Keeper) BeginBlocker(ctx context.Context) error { // loop through all auctions // get liquidations data then distribute debt & collateral remain liquidationMap := make(map[string]*vaultstypes.Liquidation) - err = k.Auctions.Walk(ctx, nil, func(auctionId uint64, auction types.Auction) (bool, error) { + err := k.Auctions.Walk(ctx, nil, func(auctionId uint64, auction types.Auction) (bool, error) { bidQueue, err := k.Bids.Get(ctx, auction.AuctionId) if err != nil { return true, err @@ -79,15 +73,19 @@ func (k *Keeper) BeginBlocker(ctx context.Context) error { } needCleanup := false + currentRate := math.LegacyMustNewDecFromStr(auction.CurrentRate) + lowestRate := math.LegacyMustNewDecFromStr(params.LowestRate) if auction.Status == types.AuctionStatus_AUCTION_STATUS_FINISHED || auction.Status == types.AuctionStatus_AUCTION_STATUS_OUT_OF_COLLATHERAL || - auction.EndTime.Before(currentTime) { + currentRate.Equal(lowestRate) { liquidation_tmp, ok := liquidationMap[auction.Item.Denom] if ok && liquidation_tmp != nil { liquidation_tmp.Denom = auction.Item.Denom liquidation_tmp.LiquidatingVaults = append(liquidation_tmp.LiquidatingVaults, &vault) - liquidation_tmp.VaultLiquidationStatus[vault.Id].Sold = liquidation_tmp.VaultLiquidationStatus[vault.Id].Sold.Add(auction.TokenRaised) - liquidation_tmp.VaultLiquidationStatus[vault.Id].RemainCollateral = liquidation_tmp.VaultLiquidationStatus[vault.Id].RemainCollateral.Add(auction.Item) + liquidation_tmp.VaultLiquidationStatus[vault.Id] = &vaultstypes.VaultLiquidationStatus{ + Sold: auction.TokenRaised, + RemainCollateral: auction.Item, + } } else { liquidation_tmp = &vaultstypes.Liquidation{ Denom: auction.Item.Denom, @@ -111,7 +109,10 @@ func (k *Keeper) BeginBlocker(ctx context.Context) error { } if needCleanup { - k.refundBidders(ctx, bidQueue) + err = k.refundBidders(ctx, bidQueue) + if err != nil { + return true, err + } // clear the auction afterward err = k.DeleteAuction(ctx, auction.AuctionId) @@ -141,6 +142,7 @@ func (k *Keeper) BeginBlocker(ctx context.Context) error { } } + fmt.Println("fillBids", bidQueue) err = k.fillBids(ctx, auction, bidQueue) if err != nil { return true, err @@ -150,6 +152,7 @@ func (k *Keeper) BeginBlocker(ctx context.Context) error { }) // Loop through liquidationMap and liquidate + fmt.Println("liquidationMap", liquidationMap) for _, liq := range liquidationMap { err := k.vaultKeeper.Liquidate(ctx, *liq) if err != nil { @@ -220,6 +223,8 @@ func (k Keeper) fillBids(ctx context.Context, auction types.Auction, bidQueue ty auction.Item = sdk.NewCoin(auction.Item.Denom, math.ZeroInt()) auction.TokenRaised = auction.TokenRaised.Add(sdk.NewCoin(bid.Amount.Denom, amountBuy)) + bidQueue.Bids[i].IsHandle = true + break } else { err = k.bankKeeper.SendCoins(ctx, sdk.MustAccAddressFromBech32(vault.Address), bidderAddr, sdk.NewCoins(receiveCoin)) if err != nil { @@ -234,16 +239,18 @@ func (k Keeper) fillBids(ctx context.Context, auction types.Auction, bidQueue ty if auction.TokenRaised.IsGTE(auction.TargetGoal) { auction.Status = types.AuctionStatus_AUCTION_STATUS_FINISHED + bidQueue.Bids[i].IsHandle = true + break } bidQueue.Bids[i].IsHandle = true } + } - // update auction status - err = k.Auctions.Set(ctx, auction.AuctionId, auction) - if err != nil { - return err - } + // update auction status + err = k.Auctions.Set(ctx, auction.AuctionId, auction) + if err != nil { + return err } // update bid queue diff --git a/x/auction/keeper/auction.go b/x/auction/keeper/auction.go index 15fceac0..9e199612 100644 --- a/x/auction/keeper/auction.go +++ b/x/auction/keeper/auction.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "fmt" "time" "cosmossdk.io/math" @@ -19,17 +18,20 @@ func (k Keeper) GetNewAuction(ctx context.Context, vaultId uint64, ) (*types.Auction, bool, error) { var newAuction *types.Auction - k.Auctions.Walk(ctx, nil, func(key uint64, value types.Auction) (stop bool, err error) { + err := k.Auctions.Walk(ctx, nil, func(key uint64, value types.Auction) (stop bool, err error) { if value.VaultId == vaultId { newAuction = &value return true, nil } return false, nil }) + if err != nil { + return nil, false, err + } if newAuction != nil { return newAuction, false, nil } - newAuction, err := k.NewAuction(ctx, startTime, initialPrice, item, targetGoal, vaultId) + newAuction, err = k.NewAuction(ctx, startTime, initialPrice, item, targetGoal, vaultId) if err != nil { return newAuction, true, err } @@ -48,23 +50,7 @@ func (k Keeper) NewAuction(ctx context.Context, } params := k.GetParams(ctx) - startingRate, err := math.LegacyNewDecFromStr(params.StartingRate) - if err != nil { - return nil, fmt.Errorf("invalid starting rate params: %v", err) - } - lowestRate, err := math.LegacyNewDecFromStr(params.LowestRate) - if err != nil { - return nil, fmt.Errorf("invalid lowest rate params: %v", err) - } - discountRate, err := math.LegacyNewDecFromStr(params.DiscountRate) - if err != nil { - return nil, fmt.Errorf("invalid discount rate params: %v", err) - } - endTime := startTime.Add(time.Duration(startingRate.Sub(lowestRate).Quo(discountRate).Ceil().RoundInt64() * int64(params.ReduceStep))) - return &types.Auction{ - StartTime: startTime, - EndTime: endTime, AuctionId: auctionId, InitialPrice: initialPrice.String(), Item: item, diff --git a/x/auction/keeper/genesis.go b/x/auction/keeper/genesis.go index c1c4ce82..b2604517 100644 --- a/x/auction/keeper/genesis.go +++ b/x/auction/keeper/genesis.go @@ -10,7 +10,7 @@ func (k Keeper) InitGennesis(ctx sdk.Context, genState types.GenesisState) { if err := k.SetParams(ctx, genState.Params); err != nil { panic(err) } - k.lastestAuctionPeriod.Set(ctx, ctx.BlockTime().Unix()) + k.LastestAuctionPeriod = ctx.BlockTime().Unix() } func (k Keeper) ExportGenesis(ctx sdk.Context) *types.GenesisState { diff --git a/x/auction/keeper/grpc_query.go b/x/auction/keeper/grpc_query.go index dad13b22..91b3d459 100644 --- a/x/auction/keeper/grpc_query.go +++ b/x/auction/keeper/grpc_query.go @@ -2,7 +2,6 @@ package keeper import ( "context" - "fmt" sdk "github.com/cosmos/cosmos-sdk/types" "google.golang.org/grpc/codes" @@ -35,19 +34,33 @@ func (k Querier) QueryAllAuction(ctx context.Context, req *types.QueryAllAuction return nil, status.Error(codes.InvalidArgument, "invalid request") } - t, _ := k.k.Auctions.Has(ctx, 0) - fmt.Println() - fmt.Println(t) - allAuction := []types.Auction{} - k.k.Auctions.Walk(ctx, nil, func(key uint64, value types.Auction) (stop bool, err error) { - fmt.Println("----1----") + err := k.k.Auctions.Walk(ctx, nil, func(key uint64, value types.Auction) (stop bool, err error) { allAuction = append(allAuction, value) return false, nil }) return &types.QueryAllAuctionResponse{ Auctions: allAuction, - }, nil + }, err +} + +func (k Querier) QueryAllBids(ctx context.Context, req *types.QueryAllBidsRequest) (*types.QueryAllBidsResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + + allBids := []types.Bid{} + + err := k.k.Bids.Walk(ctx, nil, func(key uint64, value types.BidQueue) (stop bool, err error) { + for _, bid := range value.Bids { + allBids = append(allBids, *bid) + } + return false, nil + }) + + return &types.QueryAllBidsResponse{ + Bids: allBids, + }, err } diff --git a/x/auction/keeper/keeper.go b/x/auction/keeper/keeper.go index c6206f23..9fa13c3b 100644 --- a/x/auction/keeper/keeper.go +++ b/x/auction/keeper/keeper.go @@ -31,7 +31,7 @@ type ( authority string // timestamp of lastest auction period (Unix timestamp) - lastestAuctionPeriod collections.Item[int64] + LastestAuctionPeriod int64 AuctionIdSeq collections.Sequence @@ -66,20 +66,19 @@ func NewKeeper( sb := collections.NewSchemaBuilder(storeService) return Keeper{ - cdc: cdc, - storeService: storeService, - authority: authority, - logger: logger, - authKeeper: ak, - bankKeeper: bk, - vaultKeeper: vk, - OracleKeeper: ok, - lastestAuctionPeriod: collections.NewItem(sb, types.LastestAuctionPeriodPrefix, "lastest_auction_period", collections.Int64Value), - AuctionIdSeq: collections.NewSequence(sb, types.AuctionIdSeqPrefix, "auction_id_sequence"), - BidIdSeq: collections.NewMap(sb, types.BidIdSeqPrefix, "bid_id_sequence", collections.Uint64Key, collections.Uint64Value), - Auctions: collections.NewMap(sb, types.AuctionsPrefix, "auctions", collections.Uint64Key, codec.CollValue[types.Auction](cdc)), - Bids: collections.NewMap(sb, types.BidsPrefix, "bids", collections.Uint64Key, codec.CollValue[types.BidQueue](cdc)), - BidByAddress: collections.NewMap(sb, types.BidByAddressPrefix, "bids_by_address", collections.PairKeyCodec(collections.Uint64Key, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), codec.CollValue[types.Bids](cdc)), + cdc: cdc, + storeService: storeService, + authority: authority, + logger: logger, + authKeeper: ak, + bankKeeper: bk, + vaultKeeper: vk, + OracleKeeper: ok, + AuctionIdSeq: collections.NewSequence(sb, types.AuctionIdSeqPrefix, "auction_id_sequence"), + BidIdSeq: collections.NewMap(sb, types.BidIdSeqPrefix, "bid_id_sequence", collections.Uint64Key, collections.Uint64Value), + Auctions: collections.NewMap(sb, types.AuctionsPrefix, "auctions", collections.Uint64Key, codec.CollValue[types.Auction](cdc)), + Bids: collections.NewMap(sb, types.BidsPrefix, "bids", collections.Uint64Key, codec.CollValue[types.BidQueue](cdc)), + BidByAddress: collections.NewMap(sb, types.BidByAddressPrefix, "bids_by_address", collections.PairKeyCodec(collections.Uint64Key, sdk.LengthPrefixedAddressKey(sdk.AccAddressKey)), codec.CollValue[types.Bids](cdc)), //nolint:staticcheck } } diff --git a/x/auction/keeper/keeper_test.go b/x/auction/keeper/keeper_test.go index deca5731..bd39088b 100644 --- a/x/auction/keeper/keeper_test.go +++ b/x/auction/keeper/keeper_test.go @@ -29,7 +29,7 @@ func (s *KeeperTestSuite) SetupTest() { } mockOracleKeeper.SetPrice(s.Ctx, "nomUSD", math.LegacyMustNewDecFromStr("1")) - s.App.PSMKeeper.OracleKeeper = mockOracleKeeper + s.App.AuctionKeeper.OracleKeeper = mockOracleKeeper s.mockOracleKeeper = &mockOracleKeeper s.k = s.App.AuctionKeeper diff --git a/x/auction/types/auction.pb.go b/x/auction/types/auction.pb.go index f89e978e..efe4b046 100644 --- a/x/auction/types/auction.pb.go +++ b/x/auction/types/auction.pb.go @@ -72,10 +72,6 @@ func (AuctionStatus) EnumDescriptor() ([]byte, []int) { // Auction struct type Auction struct { - // start_time defines auction's start time - StartTime time.Time `protobuf:"bytes,1,opt,name=start_time,json=startTime,proto3,stdtime" json:"start_time"` - // end_time defines where the auction ended when there are no winning bid - EndTime time.Time `protobuf:"bytes,2,opt,name=end_time,json=endTime,proto3,stdtime" json:"end_time"` // for simplicity, will use vault id that start the auction as auction id AuctionId uint64 `protobuf:"varint,3,opt,name=auction_id,json=auctionId,proto3" json:"auction_id,omitempty"` // starting price (currently only support usd stable token) @@ -128,20 +124,6 @@ func (m *Auction) XXX_DiscardUnknown() { var xxx_messageInfo_Auction proto.InternalMessageInfo -func (m *Auction) GetStartTime() time.Time { - if m != nil { - return m.StartTime - } - return time.Time{} -} - -func (m *Auction) GetEndTime() time.Time { - if m != nil { - return m.EndTime - } - return time.Time{} -} - func (m *Auction) GetAuctionId() uint64 { if m != nil { return m.AuctionId @@ -416,57 +398,56 @@ func init() { func init() { proto.RegisterFile("reserve/auction/v1/auction.proto", fileDescriptor_8758264ed04201a2) } var fileDescriptor_8758264ed04201a2 = []byte{ - // 799 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xc1, 0x6e, 0xdb, 0x46, - 0x10, 0x15, 0x6d, 0x59, 0x96, 0x46, 0x76, 0xa0, 0x2e, 0x9c, 0x86, 0x56,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, 0x51, 0x84, 0x56, 0xc4, 0x53, 0x9b, 0x67, 0x3c, 0x7d, 0xa9, 0x9e, 0x6e, 0xc4, - 0x13, 0x7b, 0xf9, 0xfb, 0xbf, 0x78, 0xff, 0x0f, 0x20, 0x5f, 0x5e, 0x53, 0x11, 0x36, 0x14, 0xe2, - 0xf8, 0xdf, 0x00, 0x00, 0x00, 0xff, 0xff, 0xb1, 0x7e, 0xd9, 0xcf, 0x21, 0x06, 0x00, 0x00, + // 770 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x94, 0x41, 0x6f, 0xdb, 0x36, + 0x14, 0xc7, 0xad, 0x44, 0x71, 0x6c, 0x2a, 0x29, 0x3c, 0x22, 0x5d, 0x15, 0x17, 0x53, 0xdc, 0x00, + 0x03, 0x8c, 0x0e, 0x95, 0xea, 0xe4, 0xb2, 0x01, 0xbb, 0x58, 0xb6, 0xd2, 0x68, 0x08, 0xe2, 0x4c, + 0xb6, 0xbb, 0x61, 0x17, 0x81, 0x12, 0x39, 0x95, 0x98, 0x24, 0x1a, 0x22, 0x65, 0xb8, 0x1f, 0x61, + 0xb7, 0x7e, 0x8c, 0x61, 0xa7, 0x1d, 0x7a, 0xd9, 0x37, 0xe8, 0xb1, 0xe8, 0x69, 0xa7, 0x6d, 0x48, + 0x0e, 0xfb, 0x1a, 0x83, 0x28, 0xba, 0xc0, 0xbc, 0xa2, 0x48, 0x2e, 0x06, 0x1f, 0xdf, 0xef, 0xaf, + 0xf7, 0xfc, 0xf8, 0x27, 0x41, 0xaf, 0x20, 0x9c, 0x14, 0x4b, 0xe2, 0xa0, 0x32, 0x16, 0x94, 0xe5, + 0xce, 0x72, 0xb0, 0x5e, 0xda, 0x8b, 0x82, 0x09, 0x06, 0xa1, 0x22, 0xec, 0xf5, 0xf6, 0x72, 0xd0, + 0xfd, 0x04, 0x65, 0x34, 0x67, 0x8e, 0xfc, 0xad, 0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0x35, + 0x0d, 0x73, 0x57, 0x96, 0xee, 0xda, 0xf5, 0xa8, 0xec, 0xf5, 0xa8, 0xec, 0xd9, 0x7a, 0x54, 0xee, + 0x7e, 0x55, 0xfb, 0xd5, 0x5f, 0x47, 0x5a, 0x5d, 0xbf, 0x53, 0x7d, 0x64, 0xac, 0xbe, 0x51, 0x51, + 0xf0, 0x19, 0xd8, 0x13, 0xec, 0x27, 0x92, 0x87, 0x05, 0xa2, 0x9c, 0x60, 0xb3, 0x75, 0x87, 0x7f, + 0x63, 0x48, 0x65, 0x20, 0x85, 0xf0, 0x2b, 0xd0, 0xe4, 0x02, 0x89, 0x92, 0x9b, 0xed, 0x9e, 0xd6, + 0xbf, 0x77, 0xf2, 0xc8, 0xfe, 0xbf, 0x31, 0x6c, 0x75, 0x1e, 0x53, 0x09, 0x06, 0x4a, 0x00, 0x3d, + 0x60, 0x08, 0x54, 0x24, 0x44, 0x84, 0x09, 0x43, 0xa9, 0x09, 0xee, 0xd0, 0x02, 0xa8, 0x85, 0xcf, + 0x18, 0x4a, 0xe1, 0x21, 0x68, 0x2d, 0x51, 0x99, 0x8a, 0xea, 0x88, 0x0d, 0x79, 0xc4, 0xbb, 0x32, + 0xf6, 0xf1, 0xf1, 0xef, 0x5b, 0x60, 0xdb, 0xa5, 0x18, 0xde, 0x07, 0xcd, 0x88, 0xe2, 0x0a, 0xd0, + 0x24, 0xb0, 0x13, 0x51, 0xec, 0x63, 0xf8, 0x54, 0x6e, 0x63, 0x52, 0x98, 0x5b, 0xf2, 0x28, 0xcc, + 0x77, 0xaf, 0x9f, 0x1c, 0xa8, 0xf2, 0x43, 0x8c, 0x0b, 0xc2, 0xf9, 0x54, 0x14, 0x34, 0x4f, 0x02, + 0xc5, 0xc1, 0xaf, 0x41, 0x13, 0x65, 0xd5, 0x10, 0xa5, 0x99, 0x6e, 0xdb, 0xad, 0xd2, 0x54, 0x06, + 0x28, 0x48, 0x4c, 0x97, 0xe4, 0xa3, 0x76, 0x33, 0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85, 0x93, 0xb3, 0x70, 0x34, + 0xb9, 0xb8, 0x18, 0xce, 0xce, 0xbd, 0x60, 0x78, 0xd1, 0xd1, 0xdd, 0x6f, 0xde, 0x5c, 0x5b, 0xda, + 0xdb, 0x6b, 0x4b, 0xfb, 0xfb, 0xda, 0xd2, 0x5e, 0xdd, 0x58, 0x8d, 0xb7, 0x37, 0x56, 0xe3, 0x8f, + 0x1b, 0xab, 0xf1, 0xc3, 0xd3, 0x84, 0x8a, 0x17, 0x65, 0x64, 0xc7, 0x2c, 0x73, 0x58, 0xce, 0xb2, + 0x97, 0xf2, 0xea, 0xc6, 0x2c, 0x75, 0xd6, 0xef, 0xed, 0xea, 0xfd, 0x8b, 0x2b, 0x5e, 0x2e, 0x08, + 0x8f, 0x9a, 0x92, 0x38, 0xfd, 0x37, 0x00, 0x00, 0xff, 0xff, 0x36, 0xe4, 0x60, 0x5e, 0x91, 0x05, + 0x00, 0x00, } func (m *Auction) Marshal() (dAtA []byte, err error) { @@ -556,22 +537,6 @@ func (m *Auction) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.EndTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.EndTime):]) - if err5 != nil { - return 0, err5 - } - i -= n5 - i = encodeVarintAuction(dAtA, i, uint64(n5)) - i-- - dAtA[i] = 0x12 - n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.StartTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartTime):]) - if err6 != nil { - return 0, err6 - } - i -= n6 - i = encodeVarintAuction(dAtA, i, uint64(n6)) - i-- - dAtA[i] = 0xa return len(dAtA) - i, nil } @@ -748,10 +713,6 @@ func (m *Auction) Size() (n int) { } var l int _ = l - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.StartTime) - n += 1 + l + sovAuction(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.EndTime) - n += 1 + l + sovAuction(uint64(l)) if m.AuctionId != 0 { n += 1 + sovAuction(uint64(m.AuctionId)) } @@ -878,72 +839,6 @@ func (m *Auction) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: Auction: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StartTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.StartTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field EndTime", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowAuction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthAuction - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthAuction - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.EndTime, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field AuctionId", wireType) diff --git a/x/auction/types/query.pb.go b/x/auction/types/query.pb.go index dab8e08d..1a1c1b2d 100644 --- a/x/auction/types/query.pb.go +++ b/x/auction/types/query.pb.go @@ -195,42 +195,129 @@ func (m *QueryAllAuctionResponse) GetAuctions() []Auction { return nil } +type QueryAllBidsRequest struct { +} + +func (m *QueryAllBidsRequest) Reset() { *m = QueryAllBidsRequest{} } +func (m *QueryAllBidsRequest) String() string { return proto.CompactTextString(m) } +func (*QueryAllBidsRequest) ProtoMessage() {} +func (*QueryAllBidsRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_c0d0f2ec58bf1126, []int{4} +} +func (m *QueryAllBidsRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBidsRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBidsRequest.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 *QueryAllBidsRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBidsRequest.Merge(m, src) +} +func (m *QueryAllBidsRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBidsRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBidsRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllBidsRequest proto.InternalMessageInfo + +type QueryAllBidsResponse struct { + // params holds all the parameters of this module. + Bids []Bid `protobuf:"bytes,1,rep,name=Bids,proto3" json:"Bids"` +} + +func (m *QueryAllBidsResponse) Reset() { *m = QueryAllBidsResponse{} } +func (m *QueryAllBidsResponse) String() string { return proto.CompactTextString(m) } +func (*QueryAllBidsResponse) ProtoMessage() {} +func (*QueryAllBidsResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_c0d0f2ec58bf1126, []int{5} +} +func (m *QueryAllBidsResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryAllBidsResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryAllBidsResponse.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 *QueryAllBidsResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryAllBidsResponse.Merge(m, src) +} +func (m *QueryAllBidsResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryAllBidsResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryAllBidsResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryAllBidsResponse proto.InternalMessageInfo + +func (m *QueryAllBidsResponse) GetBids() []Bid { + if m != nil { + return m.Bids + } + return nil +} + func init() { proto.RegisterType((*QueryParamsRequest)(nil), "reserve.auction.v1.QueryParamsRequest") proto.RegisterType((*QueryParamsResponse)(nil), "reserve.auction.v1.QueryParamsResponse") proto.RegisterType((*QueryAllAuctionRequest)(nil), "reserve.auction.v1.QueryAllAuctionRequest") proto.RegisterType((*QueryAllAuctionResponse)(nil), "reserve.auction.v1.QueryAllAuctionResponse") + proto.RegisterType((*QueryAllBidsRequest)(nil), "reserve.auction.v1.QueryAllBidsRequest") + proto.RegisterType((*QueryAllBidsResponse)(nil), "reserve.auction.v1.QueryAllBidsResponse") } func init() { proto.RegisterFile("reserve/auction/v1/query.proto", fileDescriptor_c0d0f2ec58bf1126) } var fileDescriptor_c0d0f2ec58bf1126 = []byte{ - // 392 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x2b, 0x4a, 0x2d, 0x4e, - 0x2d, 0x2a, 0x4b, 0xd5, 0x4f, 0x2c, 0x4d, 0x2e, 0xc9, 0xcc, 0xcf, 0xd3, 0x2f, 0x33, 0xd4, 0x2f, - 0x2c, 0x4d, 0x2d, 0xaa, 0xd4, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x12, 0x82, 0xca, 0xeb, 0x41, - 0xe5, 0xf5, 0xca, 0x0c, 0xa5, 0x04, 0x13, 0x73, 0x33, 0xf3, 0xf2, 0xf5, 0xc1, 0x24, 0x44, 0x99, - 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x45, 0x65, 0xd2, 0xf3, 0xf3, - 0xd3, 0x73, 0x52, 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0x12, 0x41, 0x46, - 0x14, 0x43, 0x65, 0xe5, 0xb1, 0x58, 0x5d, 0x90, 0x58, 0x94, 0x98, 0x0b, 0x53, 0xa0, 0x80, 0x45, - 0x01, 0xcc, 0x19, 0x10, 0x15, 0x92, 0xc9, 0xf9, 0xc5, 0xb9, 0xf9, 0xc5, 0xf1, 0x10, 0x9b, 0x21, - 0x1c, 0x88, 0x94, 0x92, 0x08, 0x97, 0x50, 0x20, 0xc8, 0x1f, 0x01, 0x60, 0x13, 0x83, 0x52, 0x0b, - 0x4b, 0x53, 0x8b, 0x4b, 0x94, 0x42, 0xb8, 0x84, 0x51, 0x44, 0x8b, 0x0b, 0xf2, 0xf3, 0x8a, 0x53, - 0x85, 0x6c, 0xb9, 0xd8, 0x20, 0x36, 0x4b, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x1b, 0x49, 0xe9, 0x61, - 0x7a, 0x5b, 0x0f, 0xa2, 0xc7, 0x89, 0xf3, 0xc4, 0x3d, 0x79, 0x86, 0x15, 0xcf, 0x37, 0x68, 0x31, - 0x06, 0x41, 0x35, 0x29, 0x49, 0x70, 0x89, 0x81, 0x4d, 0x75, 0xcc, 0xc9, 0x71, 0x84, 0xa8, 0x87, - 0xd9, 0x17, 0xcb, 0x25, 0x8e, 0x21, 0x03, 0xb5, 0xd3, 0x89, 0x8b, 0x03, 0x6a, 0x38, 0xc8, 0x56, - 0x66, 0x0d, 0x6e, 0x23, 0x69, 0x6c, 0xb6, 0x42, 0xb5, 0x21, 0x5b, 0x0b, 0xd7, 0x67, 0x34, 0x89, - 0x89, 0x8b, 0x15, 0x6c, 0xbe, 0x50, 0x15, 0x17, 0x1b, 0xc4, 0x7d, 0x42, 0x6a, 0xd8, 0x4c, 0xc1, - 0x0c, 0x0a, 0x29, 0x75, 0x82, 0xea, 0x20, 0x0e, 0x55, 0x92, 0x6f, 0xba, 0xfc, 0x64, 0x32, 0x93, - 0xa4, 0x90, 0xb8, 0x3e, 0x7a, 0x7c, 0x40, 0xbc, 0x2f, 0xd4, 0xc3, 0xc8, 0xc5, 0x8f, 0xe6, 0x4b, - 0x21, 0x2d, 0x9c, 0xa6, 0x63, 0x04, 0x92, 0x94, 0x36, 0x51, 0x6a, 0xa1, 0xae, 0x51, 0x00, 0xbb, - 0x46, 0x4a, 0x48, 0x02, 0xc3, 0x35, 0x50, 0xda, 0xc9, 0xeb, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, - 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, - 0x8f, 0xe5, 0x18, 0xa2, 0x0c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, - 0xf3, 0xf3, 0xf2, 0x73, 0x2b, 0xc1, 0x49, 0x25, 0x39, 0x3f, 0x07, 0x6e, 0x56, 0x05, 0xdc, 0xb4, - 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x0a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xf2, 0x86, 0x6b, 0x57, 0x27, 0x03, 0x00, 0x00, + // 449 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xcf, 0xaa, 0xd3, 0x40, + 0x14, 0xc6, 0x33, 0x5e, 0x2d, 0x3a, 0x57, 0x10, 0xc7, 0x6a, 0x7b, 0xa3, 0xa4, 0x25, 0x0b, 0x6f, + 0xa9, 0x90, 0xb1, 0x15, 0xdc, 0xb9, 0x68, 0x96, 0x2e, 0x44, 0x8b, 0x2b, 0x41, 0x24, 0x4d, 0x87, + 0x18, 0x48, 0x72, 0xd2, 0x4c, 0x52, 0xac, 0x4b, 0xdd, 0xba, 0x10, 0xdc, 0xf8, 0x08, 0x2e, 0x7d, + 0x8c, 0x2e, 0x0b, 0x6e, 0x5c, 0x89, 0xb4, 0x82, 0xaf, 0x21, 0x99, 0x99, 0x86, 0xb4, 0x89, 0xb7, + 0xdd, 0xb4, 0x33, 0x73, 0xbe, 0xf3, 0xfd, 0xce, 0x1f, 0x82, 0x8d, 0x84, 0x71, 0x96, 0xcc, 0x19, + 0x75, 0x32, 0x37, 0xf5, 0x21, 0xa2, 0xf3, 0x01, 0x9d, 0x65, 0x2c, 0x59, 0x58, 0x71, 0x02, 0x29, + 0x10, 0xa2, 0xe2, 0x96, 0x8a, 0x5b, 0xf3, 0x81, 0x7e, 0xd3, 0x09, 0xfd, 0x08, 0xa8, 0xf8, 0x95, + 0x32, 0xbd, 0xe9, 0x81, 0x07, 0xe2, 0x48, 0xf3, 0x93, 0x7a, 0xbd, 0xe7, 0x01, 0x78, 0x01, 0xa3, + 0x4e, 0xec, 0x53, 0x27, 0x8a, 0x20, 0x75, 0x72, 0x0b, 0xae, 0xa2, 0x9d, 0x1a, 0x74, 0xec, 0x24, + 0x4e, 0xb8, 0x15, 0x74, 0x6b, 0x04, 0xdb, 0x32, 0xa4, 0xe2, 0xcc, 0x05, 0x1e, 0x02, 0x7f, 0x23, + 0xc9, 0xf2, 0x22, 0x43, 0x66, 0x13, 0x93, 0x17, 0x79, 0x1f, 0xcf, 0x85, 0xe3, 0x98, 0xcd, 0x32, + 0xc6, 0x53, 0xf3, 0x25, 0xbe, 0xb5, 0xf3, 0xca, 0x63, 0x88, 0x38, 0x23, 0x4f, 0x70, 0x43, 0x92, + 0xdb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b5, 0x36, 0xd0, 0xef, 0xb5, 0x81, 0x3e, 0x6f, 0x0c, 0x6d, 0xb5, 0x31, + 0xb4, 0x9f, 0x1b, 0x43, 0x7b, 0xf5, 0xd0, 0xf3, 0xd3, 0xb7, 0xd9, 0xc4, 0x72, 0x21, 0xa4, 0x10, + 0x41, 0xb8, 0x10, 0xdf, 0x85, 0x0b, 0x41, 0xe1, 0xf5, 0xae, 0x70, 0x4b, 0x17, 0x31, 0xe3, 0x93, + 0x86, 0x50, 0x3c, 0xfa, 0x17, 0x00, 0x00, 0xff, 0xff, 0x91, 0x1e, 0x9b, 0x35, 0x14, 0x04, 0x00, + 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -248,6 +335,7 @@ type QueryClient interface { // Parameters queries the parameters of the module. Params(ctx context.Context, in *QueryParamsRequest, opts ...grpc.CallOption) (*QueryParamsResponse, error) QueryAllAuction(ctx context.Context, in *QueryAllAuctionRequest, opts ...grpc.CallOption) (*QueryAllAuctionResponse, error) + QueryAllBids(ctx context.Context, in *QueryAllBidsRequest, opts ...grpc.CallOption) (*QueryAllBidsResponse, error) } type queryClient struct { @@ -276,11 +364,21 @@ func (c *queryClient) QueryAllAuction(ctx context.Context, in *QueryAllAuctionRe return out, nil } +func (c *queryClient) QueryAllBids(ctx context.Context, in *QueryAllBidsRequest, opts ...grpc.CallOption) (*QueryAllBidsResponse, error) { + out := new(QueryAllBidsResponse) + err := c.cc.Invoke(ctx, "/reserve.auction.v1.Query/QueryAllBids", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Parameters queries the parameters of the module. Params(context.Context, *QueryParamsRequest) (*QueryParamsResponse, error) QueryAllAuction(context.Context, *QueryAllAuctionRequest) (*QueryAllAuctionResponse, error) + QueryAllBids(context.Context, *QueryAllBidsRequest) (*QueryAllBidsResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -293,6 +391,9 @@ func (*UnimplementedQueryServer) Params(ctx context.Context, req *QueryParamsReq func (*UnimplementedQueryServer) QueryAllAuction(ctx context.Context, req *QueryAllAuctionRequest) (*QueryAllAuctionResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method QueryAllAuction not implemented") } +func (*UnimplementedQueryServer) QueryAllBids(ctx context.Context, req *QueryAllBidsRequest) (*QueryAllBidsResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method QueryAllBids not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -334,6 +435,24 @@ func _Query_QueryAllAuction_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } +func _Query_QueryAllBids_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryAllBidsRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).QueryAllBids(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/reserve.auction.v1.Query/QueryAllBids", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).QueryAllBids(ctx, req.(*QueryAllBidsRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "reserve.auction.v1.Query", HandlerType: (*QueryServer)(nil), @@ -346,6 +465,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "QueryAllAuction", Handler: _Query_QueryAllAuction_Handler, }, + { + MethodName: "QueryAllBids", + Handler: _Query_QueryAllBids_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "reserve/auction/v1/query.proto", @@ -467,6 +590,66 @@ func (m *QueryAllAuctionResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } +func (m *QueryAllBidsRequest) 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 *QueryAllBidsRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBidsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryAllBidsResponse) 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 *QueryAllBidsResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryAllBidsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Bids) > 0 { + for iNdEx := len(m.Bids) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.Bids[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 encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -522,6 +705,30 @@ func (m *QueryAllAuctionResponse) Size() (n int) { return n } +func (m *QueryAllBidsRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryAllBidsResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.Bids) > 0 { + for _, e := range m.Bids { + l = e.Size() + n += 1 + l + sovQuery(uint64(l)) + } + } + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -795,6 +1002,140 @@ func (m *QueryAllAuctionResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryAllBidsRequest) 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: QueryAllBidsRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllBidsRequest: 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 *QueryAllBidsResponse) 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: QueryAllBidsResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryAllBidsResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Bids", 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.Bids = append(m.Bids, Bid{}) + if err := m.Bids[len(m.Bids)-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 skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/auction/types/query.pb.gw.go b/x/auction/types/query.pb.gw.go index c47d9454..1bad430e 100644 --- a/x/auction/types/query.pb.gw.go +++ b/x/auction/types/query.pb.gw.go @@ -69,6 +69,24 @@ func local_request_Query_QueryAllAuction_0(ctx context.Context, marshaler runtim } +func request_Query_QueryAllBids_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllBidsRequest + var metadata runtime.ServerMetadata + + msg, err := client.QueryAllBids(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_QueryAllBids_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryAllBidsRequest + var metadata runtime.ServerMetadata + + msg, err := server.QueryAllBids(ctx, &protoReq) + return msg, metadata, err + +} + // 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. @@ -121,6 +139,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_QueryAllBids_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_QueryAllBids_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_QueryAllBids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -202,6 +243,26 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_QueryAllBids_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_QueryAllBids_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_QueryAllBids_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -209,10 +270,14 @@ var ( pattern_Query_Params_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"reserve", "auction", "params"}, "", runtime.AssumeColonVerbOpt(false))) pattern_Query_QueryAllAuction_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1}, []string{"reserve", "auction"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_QueryAllBids_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 1}, []string{"reserve", "auction"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Params_0 = runtime.ForwardResponseMessage forward_Query_QueryAllAuction_0 = runtime.ForwardResponseMessage + + forward_Query_QueryAllBids_0 = runtime.ForwardResponseMessage ) diff --git a/x/auction/types/tx.pb.go b/x/auction/types/tx.pb.go index 6f7e034d..71405056 100644 --- a/x/auction/types/tx.pb.go +++ b/x/auction/types/tx.pb.go @@ -370,43 +370,43 @@ func init() { proto.RegisterFile("reserve/auction/v1/tx.proto", fileDescriptor_1 var fileDescriptor_18d11acb13497546 = []byte{ // 594 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x54, 0xb1, 0x6f, 0xd3, 0x4e, - 0x18, 0x8d, 0x9b, 0x36, 0xfa, 0xe5, 0x5a, 0xf5, 0x27, 0xac, 0x42, 0x5d, 0x23, 0xdc, 0x60, 0x96, - 0x28, 0xa8, 0xbe, 0xa6, 0x20, 0x86, 0x08, 0x06, 0x1c, 0x18, 0x8a, 0x14, 0x09, 0x19, 0x21, 0x24, - 0x96, 0x70, 0xf6, 0x9d, 0xdc, 0x93, 0x6a, 0x5f, 0x74, 0x77, 0x89, 0x9a, 0x0d, 0x31, 0x32, 0x20, - 0xfe, 0x0a, 0xc4, 0x98, 0xa1, 0x33, 0x73, 0xc7, 0xaa, 0x13, 0x13, 0x42, 0xc9, 0x90, 0x9d, 0xbf, - 0x00, 0xd9, 0xbe, 0x38, 0xd4, 0x4d, 0x54, 0xc4, 0x12, 0xdd, 0x77, 0xef, 0x7d, 0xef, 0xbe, 0xf7, - 0xfc, 0x29, 0xe0, 0x36, 0x27, 0x82, 0xf0, 0x01, 0x81, 0xa8, 0x1f, 0x48, 0xca, 0x62, 0x38, 0x68, - 0x42, 0x79, 0xe2, 0xf4, 0x38, 0x93, 0x4c, 0xd7, 0x15, 0xe8, 0x28, 0xd0, 0x19, 0x34, 0xcd, 0x1b, - 0x28, 0xa2, 0x31, 0x83, 0xe9, 0x6f, 0x46, 0x33, 0xb7, 0x42, 0x16, 0xb2, 0xf4, 0x08, 0x93, 0x93, - 0xba, 0xdd, 0x09, 0x98, 0x88, 0x98, 0xe8, 0x66, 0x40, 0x56, 0x28, 0x68, 0x3b, 0xab, 0x60, 0x24, - 0xc2, 0xe4, 0xbd, 0x48, 0x84, 0x0a, 0xb0, 0x14, 0xe0, 0x23, 0x41, 0xe0, 0xa0, 0xe9, 0x13, 0x89, - 0x9a, 0x30, 0x60, 0x34, 0x56, 0xf8, 0xee, 0x82, 0x69, 0x7b, 0x88, 0xa3, 0x48, 0x29, 0xdb, 0xdf, - 0x34, 0xf0, 0x7f, 0x47, 0x84, 0xaf, 0x7b, 0x18, 0x49, 0xf2, 0x32, 0x45, 0xf4, 0x47, 0xa0, 0x8a, - 0xfa, 0xf2, 0x88, 0x71, 0x2a, 0x87, 0x86, 0x56, 0xd3, 0xea, 0x55, 0xd7, 0xb8, 0x38, 0xdd, 0xdb, - 0x52, 0x23, 0x3d, 0xc5, 0x98, 0x13, 0x21, 0x5e, 0x49, 0x4e, 0xe3, 0xd0, 0x9b, 0x53, 0xf5, 0x27, - 0xa0, 0x92, 0x69, 0x1b, 0x2b, 0x35, 0xad, 0xbe, 0x7e, 0x60, 0x3a, 0x57, 0xe3, 0x70, 0xb2, 0x37, - 0xdc, 0xea, 0xd9, 0x8f, 0xdd, 0xd2, 0xd7, 0xe9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x13, 0x00, 0x00, 0xff, 0xff, 0x67, 0x86, 0xec, 0x77, 0x0d, 0x05, 0x00, 0x00, } diff --git a/x/oracle/bandtesting/x/oracle/keeper/result.go b/x/oracle/bandtesting/x/oracle/keeper/result.go index 239b3cc3..7ad4b62a 100644 --- a/x/oracle/bandtesting/x/oracle/keeper/result.go +++ b/x/oracle/bandtesting/x/oracle/keeper/result.go @@ -2,7 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" diff --git a/x/oracle/bandtesting/x/oracle/types/expected_keepers.go b/x/oracle/bandtesting/x/oracle/types/expected_keepers.go index 82907899..359aa65e 100644 --- a/x/oracle/bandtesting/x/oracle/types/expected_keepers.go +++ b/x/oracle/bandtesting/x/oracle/types/expected_keepers.go @@ -3,7 +3,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ) diff --git a/x/oracle/client/cli/tx.go b/x/oracle/client/cli/tx.go index eea8042a..799adb4b 100644 --- a/x/oracle/client/cli/tx.go +++ b/x/oracle/client/cli/tx.go @@ -134,7 +134,7 @@ func NewUpdateBandOracleRequestProposalTxCmd() *cobra.Command { cmd.Flags().Uint64(flagSufficientValidatorCount, 0, "Sufficient Validator Count") cmd.Flags().Uint64(flagMinSourceCount, 3, "Min Source Count") cmd.Flags().String(govcli.FlagTitle, "", "title of proposal") - cmd.Flags().String(govcli.FlagDescription, "", "description of proposal") + cmd.Flags().String(govcli.FlagDescription, "", "description of proposal") //nolint:staticcheck cmd.Flags().String(govcli.FlagDeposit, "", "deposit of proposal") flags.AddTxFlagsToCmd(cmd) @@ -182,7 +182,7 @@ func NewDeleteBandOracleRequestProposalTxCmd() *cobra.Command { } cmd.Flags().String(govcli.FlagTitle, "", "title of proposal") - cmd.Flags().String(govcli.FlagDescription, "", "description of proposal") + cmd.Flags().String(govcli.FlagDescription, "", "description of proposal") //nolint:staticcheck cmd.Flags().String(govcli.FlagDeposit, "", "deposit of proposal") flags.AddTxFlagsToCmd(cmd) @@ -198,7 +198,7 @@ func updateBandOracleRequestProposalArgsToContent( return nil, err } - description, err := cmd.Flags().GetString(govcli.FlagDescription) + description, err := cmd.Flags().GetString(govcli.FlagDescription) //nolint:staticcheck if err != nil { return nil, err } @@ -283,7 +283,7 @@ func deleteBandOracleRequestProposalArgsToContent( return nil, err } - description, err := cmd.Flags().GetString(govcli.FlagDescription) + description, err := cmd.Flags().GetString(govcli.FlagDescription) //nolint:staticcheck if err != nil { return nil, err } diff --git a/x/oracle/keeper/band_oracle.go b/x/oracle/keeper/band_oracle.go index b5be80b1..94238756 100644 --- a/x/oracle/keeper/band_oracle.go +++ b/x/oracle/keeper/band_oracle.go @@ -12,7 +12,7 @@ import ( runtime "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" "github.com/onomyprotocol/reserve/x/oracle/types" @@ -250,8 +250,7 @@ func (k Keeper) AddNewSymbolToBandOracleRequest(ctx context.Context, symbol stri for _, req := range allBandOracleRequests { if req.OracleScriptId == oracleScriptId { req.Symbols = append(req.Symbols, symbol) - k.SetBandOracleRequest(ctx, *req) - return nil + return k.SetBandOracleRequest(ctx, *req) } } @@ -269,10 +268,12 @@ func (k Keeper) AddNewSymbolToBandOracleRequest(ctx context.Context, symbol stri MinSourceCount: bandOracleRequestParams.MinSourceCount, } - k.SetBandOracleRequest(ctx, newBandOracleRequest) + err := k.SetBandOracleRequest(ctx, newBandOracleRequest) + if err != nil { + return err + } - k.SetBandLatestRequestID(ctx, requestID) - return nil + return k.SetBandLatestRequestID(ctx, requestID) } // GetPrice fetches band ibc prices for a given pair in math.LegacyDec @@ -366,14 +367,15 @@ func (k *Keeper) RequestBandOraclePrices( // Persist the sequence number and OracleRequest CallData. CallData contains list of symbols. // This is used to map the prices/rates with the symbols upon receiving oracle response from Band IBC. - k.SetBandCallDataRecord(ctx, &types.CalldataRecord{ + err = k.SetBandCallDataRecord(ctx, &types.CalldataRecord{ ClientId: clientID, Calldata: calldata, }) + if err != nil { + return err + } - k.SetBandLatestClientID(ctx, clientID) - - return + return k.SetBandLatestClientID(ctx, clientID) } func (k *Keeper) ProcessBandOraclePrices( @@ -405,9 +407,7 @@ func (k *Keeper) ProcessBandOraclePrices( k.updateBandPriceStates(ctx, input, output, packet, relayer, clientID) // Delete the calldata corresponding to the sequence number - k.DeleteBandCallDataRecord(ctx, uint64(clientID)) - - return nil + return k.DeleteBandCallDataRecord(ctx, uint64(clientID)) } func (k *Keeper) updateBandPriceStates( @@ -508,7 +508,10 @@ func (k *Keeper) CleanUpStaleBandCalldataRecords(ctx context.Context) { } for _, id := range k.getPreviousRecordIDs(ctx, earliestToKeepClientID) { - k.DeleteBandCallDataRecord(ctx, id) + err := k.DeleteBandCallDataRecord(ctx, id) + if err != nil { + panic(err) + } } } diff --git a/x/oracle/keeper/keeper.go b/x/oracle/keeper/keeper.go index f3dc10bd..96ef7258 100644 --- a/x/oracle/keeper/keeper.go +++ b/x/oracle/keeper/keeper.go @@ -1,17 +1,17 @@ package keeper import ( - "fmt" "context" "cosmossdk.io/core/store" errorsmod "cosmossdk.io/errors" "cosmossdk.io/log" "cosmossdk.io/store/prefix" + "fmt" "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/runtime" sdk "github.com/cosmos/cosmos-sdk/types" - capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" capabilitykeeper "github.com/cosmos/ibc-go/modules/capability/keeper" + capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" "github.com/cosmos/ibc-go/v8/modules/core/exported" @@ -59,7 +59,6 @@ func NewKeeper( } } - // GetAuthority returns the module's authority. func (k Keeper) GetAuthority() string { return k.authority diff --git a/x/oracle/module/genesis.go b/x/oracle/module/genesis.go index 54210700..44192d95 100644 --- a/x/oracle/module/genesis.go +++ b/x/oracle/module/genesis.go @@ -15,14 +15,23 @@ func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisSta } for _, bandPriceState := range genState.BandPriceStates { - k.SetBandPriceState(ctx, bandPriceState.Symbol, bandPriceState) + err := k.SetBandPriceState(ctx, bandPriceState.Symbol, bandPriceState) + if err != nil { + panic(err) + } } for _, bandOracleRequest := range genState.BandOracleRequests { - k.SetBandOracleRequest(ctx, *bandOracleRequest) + err := k.SetBandOracleRequest(ctx, *bandOracleRequest) + if err != nil { + panic(err) + } } - k.SetBandParams(ctx, genState.BandParams) + err := k.SetBandParams(ctx, genState.BandParams) + if err != nil { + panic(err) + } if genState.BandParams.IbcPortId != "" { k.SetPort(ctx, genState.BandParams.IbcPortId) @@ -38,18 +47,30 @@ func InitGenesis(ctx context.Context, k keeper.Keeper, genState types.GenesisSta } if genState.BandLatestClientId != 0 { - k.SetBandLatestClientID(ctx, genState.BandLatestClientId) + err = k.SetBandLatestClientID(ctx, genState.BandLatestClientId) + if err != nil { + panic(err) + } } for _, record := range genState.CalldataRecords { - k.SetBandCallDataRecord(ctx, record) + err = k.SetBandCallDataRecord(ctx, record) + if err != nil { + panic(err) + } } if genState.BandLatestRequestId != 0 { - k.SetBandLatestRequestID(ctx, genState.BandLatestRequestId) + err = k.SetBandLatestRequestID(ctx, genState.BandLatestRequestId) + if err != nil { + panic(err) + } } - k.SetBandOracleRequestParams(ctx, genState.BandOracleRequestParams) + err = k.SetBandOracleRequestParams(ctx, genState.BandOracleRequestParams) + if err != nil { + panic(err) + } } // ExportGenesis returns the module's exported genesis. diff --git a/x/oracle/module/module_ibc.go b/x/oracle/module/module_ibc.go index 7909d269..46ff3c1a 100644 --- a/x/oracle/module/module_ibc.go +++ b/x/oracle/module/module_ibc.go @@ -164,7 +164,10 @@ func (im IBCModule) OnRecvPacket( return channeltypes.NewErrorAcknowledgement(fmt.Errorf("failed to parse client ID: %w", err)) } // Delete the calldata corresponding to the sequence number - im.keeper.DeleteBandCallDataRecord(ctx, uint64(clientID)) + err = im.keeper.DeleteBandCallDataRecord(ctx, uint64(clientID)) + if err != nil { + return channeltypes.NewErrorAcknowledgement(fmt.Errorf("failed to parse client ID: %w", err)) + } return channeltypes.NewErrorAcknowledgement(types.ErrResolveStatusNotSuccess) } println("Process OnrecvPacket ..........") @@ -207,7 +210,7 @@ func (im IBCModule) OnAcknowledgementPacket( ClientId: int64(clientID), }) case *channeltypes.Acknowledgement_Error: - im.keeper.DeleteBandCallDataRecord(ctx, uint64(clientID)) + err = im.keeper.DeleteBandCallDataRecord(ctx, uint64(clientID)) // nolint:errcheck //ignored on purpose ctx.EventManager().EmitTypedEvent(&types.EventBandAckError{ AckError: resp.Error, @@ -215,7 +218,7 @@ func (im IBCModule) OnAcknowledgementPacket( }) } - return nil + return err } // OnTimeoutPacket implements the IBCModule interface @@ -235,11 +238,11 @@ func (im IBCModule) OnTimeoutPacket( } // Delete the calldata corresponding to the sequence number - im.keeper.DeleteBandCallDataRecord(ctx, uint64(clientID)) + err = im.keeper.DeleteBandCallDataRecord(ctx, uint64(clientID)) // nolint:errcheck //ignored on purpose ctx.EventManager().EmitTypedEvent(&types.EventBandResponseTimeout{ ClientId: int64(clientID), }) - return nil + return err } diff --git a/x/oracle/module/module_ibc_test.go b/x/oracle/module/module_ibc_test.go index 58c10736..0bf8de41 100644 --- a/x/oracle/module/module_ibc_test.go +++ b/x/oracle/module/module_ibc_test.go @@ -5,7 +5,7 @@ import ( "cosmossdk.io/math" capabilitytypes "github.com/cosmos/ibc-go/modules/capability/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" host "github.com/cosmos/ibc-go/v8/modules/core/24-host" ibctesting "github.com/cosmos/ibc-go/v8/testing" @@ -299,10 +299,11 @@ func (suite *PriceRelayTestSuite) TestOnRecvPacket() { suite.Require().True(ok) onomyApp := suite.chainO.App.(*reserveapp.App) - onomyApp.OracleKeeper.SetBandCallDataRecord(suite.chainO.GetContext(), &oracletypes.CalldataRecord{ + err = onomyApp.OracleKeeper.SetBandCallDataRecord(suite.chainO.GetContext(), &oracletypes.CalldataRecord{ ClientId: 1, Calldata: data, }) + suite.Require().NoError(err) // call recv packet ack := cbs.OnRecvPacket(suite.chainO.GetContext(), packet, nil) diff --git a/x/oracle/module/price_relay_test.go b/x/oracle/module/price_relay_test.go index 333e27df..53b10c0c 100644 --- a/x/oracle/module/price_relay_test.go +++ b/x/oracle/module/price_relay_test.go @@ -8,7 +8,7 @@ import ( dbm "github.com/cosmos/cosmos-db" simtestutil "github.com/cosmos/cosmos-sdk/testutil/sims" sdk "github.com/cosmos/cosmos-sdk/types" - clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" + clienttypes "github.com/cosmos/ibc-go/v8/modules/core/02-client/types" //nolint:staticcheck channeltypes "github.com/cosmos/ibc-go/v8/modules/core/04-channel/types" ibctesting "github.com/cosmos/ibc-go/v8/testing" testifysuite "github.com/stretchr/testify/suite" @@ -37,7 +37,7 @@ func (suite *PriceRelayTestSuite) SetupTest() { ibctesting.DefaultTestingAppInit = func() (ibctesting.TestingApp, map[string]json.RawMessage) { db := dbm.NewMemDB() encCdc := bandapp.MakeEncodingConfig() - app, _ := reserveapp.New(log.NewNopLogger(), db, nil, true, simtestutil.EmptyAppOptions{}) + app := reserveapp.NewApp(log.NewNopLogger(), db, nil, true, map[int64]bool{}, reserveapp.DefaultNodeHome, simtestutil.EmptyAppOptions{}) genesisState := app.DefaultGenesis() oracleGenesis := oracletypes.DefaultGenesis() oracleGenesis.BandParams = *oracletypes.DefaultTestBandIbcParams() @@ -123,7 +123,7 @@ func (suite *PriceRelayTestSuite) TestHandlePriceRelay() { suite.Equal(expectCommitment, commitment) // injectiveApp := suite.chainO.App.(*reserveapp.App) - onomyapp.OracleKeeper.SetBandOracleRequest(suite.chainO.GetContext(), oracletypes.BandOracleRequest{ + err = onomyapp.OracleKeeper.SetBandOracleRequest(suite.chainO.GetContext(), oracletypes.BandOracleRequest{ RequestId: 1, OracleScriptId: 1, Symbols: []string{"A"}, @@ -133,6 +133,7 @@ func (suite *PriceRelayTestSuite) TestHandlePriceRelay() { PrepareGas: 100, ExecuteGas: 200, }) + suite.Require().NoError(err) // send from chainI to chainB msg := oracletypes.NewMsgRequestBandRates(suite.chainO.SenderAccount.GetAddress(), 1) diff --git a/x/oracle/proposal_handler.go b/x/oracle/proposal_handler.go index 7f9b5822..da17ee97 100644 --- a/x/oracle/proposal_handler.go +++ b/x/oracle/proposal_handler.go @@ -1,11 +1,11 @@ package oracle import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" govtypes "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" "github.com/onomyprotocol/reserve/x/oracle/keeper" "github.com/onomyprotocol/reserve/x/oracle/types" - sdk "github.com/cosmos/cosmos-sdk/types" - errorsmod "cosmossdk.io/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ) @@ -20,7 +20,7 @@ func NewOracleProposalHandler(k keeper.Keeper) govtypes.Handler { return handleUpdateBandOracleRequestProposal(ctx, k, c) case *types.DeleteBandOracleRequestProposal: - return handleDeleteBandOracleRequestProposal(ctx, k, c) + return handleDeleteBandOracleRequestProposal(ctx, k, c) default: return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized param proposal content type: %T", c) } @@ -43,8 +43,7 @@ func handleUpdateBandParamsProposal(ctx sdk.Context, k keeper.Keeper, p *types.U } } - k.SetBandParams(ctx, p.BandParams) - return nil + return k.SetBandParams(ctx, p.BandParams) } func handleUpdateBandOracleRequestProposal(ctx sdk.Context, k keeper.Keeper, p *types.UpdateBandOracleRequestProposal) error { @@ -89,9 +88,7 @@ func handleUpdateBandOracleRequestProposal(ctx sdk.Context, k keeper.Keeper, p * request.MinSourceCount = p.UpdateOracleRequest.MinSourceCount } - k.SetBandOracleRequest(ctx, *request) - - return nil + return k.SetBandOracleRequest(ctx, *request) } func handleDeleteBandOracleRequestProposal(ctx sdk.Context, k keeper.Keeper, p *types.DeleteBandOracleRequestProposal) error { @@ -100,7 +97,10 @@ func handleDeleteBandOracleRequestProposal(ctx sdk.Context, k keeper.Keeper, p * } for _, requestID := range p.DeleteRequestIds { - k.DeleteBandOracleRequest(ctx, requestID) + err := k.DeleteBandOracleRequest(ctx, requestID) + if err != nil { + return err + } } return nil diff --git a/x/psm/keeper/abci_test.go b/x/psm/keeper/abci_test.go index 4ba687a7..f27d8a7b 100644 --- a/x/psm/keeper/abci_test.go +++ b/x/psm/keeper/abci_test.go @@ -48,9 +48,9 @@ func (s *KeeperTestSuite) TestUpdatesStablecoinEpoch() { FeeOut: t.feeOut, } s.mockOracleKeeper.SetPrice(s.Ctx, sc.Denom, t.priceCurrent) - s.k.FeeMaxStablecoin.Set(s.Ctx, usdt, t.feeIn.Add(t.feeOut).String()) - - err := s.k.SetStablecoin(s.Ctx, sc) + err := s.k.FeeMaxStablecoin.Set(s.Ctx, usdt, t.feeIn.Add(t.feeOut).String()) + s.Require().NoError(err) + err = s.k.SetStablecoin(s.Ctx, sc) s.Require().NoError(err) s.mockOracleKeeper.SetPrice(s.Ctx, usdt, t.priceUpdate) diff --git a/x/psm/keeper/keeper.go b/x/psm/keeper/keeper.go index e14c6085..dee9d23b 100644 --- a/x/psm/keeper/keeper.go +++ b/x/psm/keeper/keeper.go @@ -98,12 +98,12 @@ func (k Keeper) Logger() log.Logger { func (k Keeper) TotalStablecoinLock(ctx context.Context, nameStablecoin string) (math.Int, error) { total := math.ZeroInt() - k.totalStablecoinLock.Walk(ctx, nil, func(key string, value math.Int) (stop bool, err error) { + err := k.totalStablecoinLock.Walk(ctx, nil, func(key string, value math.Int) (stop bool, err error) { if key == nameStablecoin { total.Add(value) } return false, nil }) - return total, nil + return total, err } diff --git a/x/psm/keeper/msg_server.go b/x/psm/keeper/msg_server.go index 97308d87..bd364797 100644 --- a/x/psm/keeper/msg_server.go +++ b/x/psm/keeper/msg_server.go @@ -73,7 +73,10 @@ func (k msgServer) SwapTonomUSD(ctx context.Context, msg *types.MsgSwapTonomUSD) return nil, err } newTotalStablecoinLock := totalStablecoinLock.Add(msg.Coin.Amount) - k.keeper.totalStablecoinLock.Set(ctx, msg.Coin.Denom, newTotalStablecoinLock) + err = k.keeper.totalStablecoinLock.Set(ctx, msg.Coin.Denom, newTotalStablecoinLock) + if err != nil { + return nil, err + } // send stablecoin to module err = k.keeper.BankKeeper.SendCoinsFromAccountToModule(ctx, addr, types.ModuleName, sdk.NewCoins(*msg.Coin)) @@ -150,7 +153,10 @@ func (k msgServer) SwapToStablecoin(ctx context.Context, msg *types.MsgSwapToSta // unlock stablecoinReceive := sdk.NewCoin(msg.ToDenom, receiveAmountStablecoin) newTotalStablecoinLock := totalStablecoinLock.Sub(receiveAmountStablecoin) - k.keeper.totalStablecoinLock.Set(ctx, msg.ToDenom, newTotalStablecoinLock) + err = k.keeper.totalStablecoinLock.Set(ctx, msg.ToDenom, newTotalStablecoinLock) + if err != nil { + return nil, err + } // send stablecoin to user err = k.keeper.BankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, addr, sdk.NewCoins(stablecoinReceive)) @@ -192,8 +198,15 @@ func (k msgServer) AddStableCoinProposal(ctx context.Context, msg *types.MsgAddS return &types.MsgAddStableCoinResponse{}, err } - k.keeper.totalStablecoinLock.Set(ctx, msg.Denom, math.ZeroInt()) - k.keeper.FeeMaxStablecoin.Set(ctx, msg.Denom, msg.FeeIn.Add(msg.FeeOut).String()) + err = k.keeper.totalStablecoinLock.Set(ctx, msg.Denom, math.ZeroInt()) + if err != nil { + return &types.MsgAddStableCoinResponse{}, err + } + + err = k.keeper.FeeMaxStablecoin.Set(ctx, msg.Denom, msg.FeeIn.Add(msg.FeeOut).String()) + if err != nil { + return &types.MsgAddStableCoinResponse{}, err + } sdkCtx.EventManager().EmitEvent( sdk.NewEvent( @@ -219,7 +232,10 @@ func (k msgServer) UpdatesStableCoinProposal(ctx context.Context, msg *types.Msg if err != nil { return &types.MsgUpdatesStableCoinResponse{}, err } - k.keeper.FeeMaxStablecoin.Set(ctx, msg.Denom, msg.FeeIn.Add(msg.FeeOut).String()) + err = k.keeper.FeeMaxStablecoin.Set(ctx, msg.Denom, msg.FeeIn.Add(msg.FeeOut).String()) + if err != nil { + return &types.MsgUpdatesStableCoinResponse{}, err + } sdkCtx.EventManager().EmitEvent( sdk.NewEvent( diff --git a/x/psm/keeper/query.go b/x/psm/keeper/query.go index 64235b8b..08f98699 100644 --- a/x/psm/keeper/query.go +++ b/x/psm/keeper/query.go @@ -83,10 +83,10 @@ func (q queryServer) AllStablecoin(c context.Context, req *types.QueryAllStablec allStablecoins = append(allStablecoins, &newStablecoinResponse) } - q.keeper.IterateStablecoin(c, func(red types.Stablecoin) (stop bool) { + err := q.keeper.IterateStablecoin(c, func(red types.Stablecoin) (stop bool) { adder(red) return false }) - return &types.QueryAllStablecoinResponse{AllStablecoinResponse: allStablecoins}, nil + return &types.QueryAllStablecoinResponse{AllStablecoinResponse: allStablecoins}, err } diff --git a/x/vaults/keeper/genesis.go b/x/vaults/keeper/genesis.go index 4e03588d..abf901cf 100644 --- a/x/vaults/keeper/genesis.go +++ b/x/vaults/keeper/genesis.go @@ -30,13 +30,17 @@ func (k *Keeper) InitGenesis(ctx context.Context, data types.GenesisState) error } if data.LastUpdate != nil { - k.LastUpdateTime.Set(ctx, *data.LastUpdate) + err = k.LastUpdateTime.Set(ctx, *data.LastUpdate) + if err != nil { + return err + } } else { sdkCtx := sdk.UnwrapSDKContext(ctx) - k.LastUpdateTime.Set(ctx, types.LastUpdate{Time: sdkCtx.BlockTime()}) + err = k.LastUpdateTime.Set(ctx, types.LastUpdate{Time: sdkCtx.BlockTime()}) + if err != nil { + return err + } } - k.ShortfallAmount.Set(ctx, data.ShortfallAmount) - - return nil + return k.ShortfallAmount.Set(ctx, data.ShortfallAmount) } diff --git a/x/vaults/keeper/keeper_test.go b/x/vaults/keeper/keeper_test.go index 01ca2bec..8b2df65e 100644 --- a/x/vaults/keeper/keeper_test.go +++ b/x/vaults/keeper/keeper_test.go @@ -44,5 +44,4 @@ func (s *KeeperTestSuite) TestParams() { p := s.k.GetParams(s.Ctx) s.Require().Equal(p.MinInitialDebt, types.DefaultMinInitialDebt) - s.Require().Equal(p.LiquidatePeriod, types.DefaultLiquidatePeriod) } diff --git a/x/vaults/keeper/query.go b/x/vaults/keeper/query.go index ff305a4b..352dc271 100644 --- a/x/vaults/keeper/query.go +++ b/x/vaults/keeper/query.go @@ -37,27 +37,27 @@ func (q queryServer) Params(ctx context.Context, req *types.QueryParamsRequest) func (q queryServer) QueryAllCollateral(ctx context.Context, req *types.QueryAllCollateralRequest) (*types.QueryAllCollateralResponse, error) { allCollateral := []*types.VaultMamager{} - q.keeper.VaultsManager.Walk(ctx, nil, func(key string, value types.VaultMamager) (stop bool, err error) { + err := q.keeper.VaultsManager.Walk(ctx, nil, func(key string, value types.VaultMamager) (stop bool, err error) { allCollateral = append(allCollateral, &value) return false, nil }) return &types.QueryAllCollateralResponse{ AllVaultMamager: allCollateral, - }, nil + }, err } func (q queryServer) QueryAllVaults(ctx context.Context, req *types.QueryAllVaultsRequest) (*types.QueryAllVaultsResponse, error) { allVaults := []*types.Vault{} - q.keeper.Vaults.Walk(ctx, nil, func(key uint64, value types.Vault) (stop bool, err error) { + err := q.keeper.Vaults.Walk(ctx, nil, func(key uint64, value types.Vault) (stop bool, err error) { allVaults = append(allVaults, &value) return false, nil }) return &types.QueryAllVaultsResponse{ AllVault: allVaults, - }, nil + }, err } func (q queryServer) QueryVaults(ctx context.Context, req *types.QueryVaultIdRequest) (*types.QueryVaultIdResponse, error) { diff --git a/x/vaults/keeper/vault.go b/x/vaults/keeper/vault.go index cad817d6..bef3ecaa 100644 --- a/x/vaults/keeper/vault.go +++ b/x/vaults/keeper/vault.go @@ -304,12 +304,15 @@ func (k *Keeper) UpdateVaultsDebt( rate := math.LegacyNewDec(deltaDur.Milliseconds()).Quo(math.LegacyNewDec((time.Hour * 24 * 365).Milliseconds())) // divice 365 days // Get stability fee of all denoms fees := make(map[string]math.LegacyDec, 0) - k.VaultsManager.Walk(ctx, nil, func(denom string, vm types.VaultMamager) (bool, error) { + err := k.VaultsManager.Walk(ctx, nil, func(denom string, vm types.VaultMamager) (bool, error) { fees[denom] = vm.Params.StabilityFee.Mul(rate) return false, nil }) + if err != nil { + return err + } - err := k.Vaults.Walk(ctx, nil, func(id uint64, vault types.Vault) (bool, error) { + err = k.Vaults.Walk(ctx, nil, func(id uint64, vault types.Vault) (bool, error) { var err error if vault.Status == types.ACTIVE { debtAmount := vault.Debt.Amount @@ -406,6 +409,7 @@ func (k *Keeper) Liquidate( ctx context.Context, liquidation types.Liquidation, ) error { + fmt.Println("START LIQUIDATE", liquidation) params := k.GetParams(ctx) vm, err := k.GetVaultManager(ctx, liquidation.Denom) @@ -458,31 +462,32 @@ func (k *Keeper) Liquidate( } // Take the liquidation penalty and send back to vault owner - if totalCollateralRemain.Amount.GT(math.ZeroInt()) { - //TODO: decimal + for _, vault := range liquidation.LiquidatingVaults { + collateralRemain := liquidation.VaultLiquidationStatus[vault.Id].RemainCollateral + + if collateralRemain.Amount.Equal(math.ZeroInt()) { + vault.CollateralLocked.Amount = math.ZeroInt() + vault.Debt.Amount = math.ZeroInt() + vault.Status = types.CLOSED + continue + } - for _, vault := range liquidation.LiquidatingVaults { - collateralRemain := liquidation.VaultLiquidationStatus[vault.Id].RemainCollateral - if collateralRemain.Amount.Equal(math.ZeroInt()) { - continue + penaltyAmount := math.LegacyNewDecFromInt(vault.Debt.Amount).Quo(vault.LiquidationPrice).Mul(vm.Params.LiquidationPenalty).TruncateInt() + + vault.Debt.Amount = math.ZeroInt() + if penaltyAmount.GTE(collateralRemain.Amount) { + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(collateralRemain)) + if err != nil { + return err } - penaltyAmount := math.LegacyNewDecFromInt(vault.Debt.Amount).Quo(vault.LiquidationPrice).Mul(vm.Params.LiquidationPenalty).TruncateInt() - fmt.Println("penaltyAmount", penaltyAmount) - if penaltyAmount.GTE(collateralRemain.Amount) { - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(collateralRemain)) - if err != nil { - return err - } - } else { - err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(sdk.NewCoin(collateralRemain.Denom, penaltyAmount))) - if err != nil { - return err - } - err = k.bankKeeper.SendCoinsFromModuleToAccount(ctx, types.ModuleName, sdk.MustAccAddressFromBech32(vault.Owner), sdk.NewCoins(sdk.NewCoin(collateralRemain.Denom, collateralRemain.Amount.Sub(penaltyAmount)))) - if err != nil { - return err - } + vault.CollateralLocked.Amount = math.ZeroInt() + vault.Status = types.CLOSED + } else { + err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(sdk.NewCoin(collateralRemain.Denom, penaltyAmount))) + if err != nil { + return err } + vault.CollateralLocked.Amount = collateralRemain.Amount.Sub(penaltyAmount) } } } else { @@ -502,10 +507,20 @@ func (k *Keeper) Liquidate( // No collateral remain if totalCollateralRemain.Amount.Equal(math.ZeroInt()) { - //TODO: send shortfall to reserve // Update vaults status for _, vault := range liquidation.LiquidatingVaults { - k.SetVault(ctx, *vault) + soldAmount := liquidation.VaultLiquidationStatus[vault.Id].Sold.Amount + if soldAmount.GTE(vault.Debt.Amount) { + vault.Debt.Amount = math.ZeroInt() + } else { + vault.Debt.Amount = vault.Debt.Amount.Sub(soldAmount) + } + vault.CollateralLocked.Amount = math.ZeroInt() + // LIQUIDATED + err = k.SetVault(ctx, *vault) + if err != nil { + return err + } } currentShortfall, err := k.ShortfallAmount.Get(ctx) if err != nil { @@ -521,12 +536,19 @@ func (k *Keeper) Liquidate( ratios := make([]math.LegacyDec, 0) //TODO: Sort by CR in GetLiquidations could reduce calculate here for _, vault := range liquidation.LiquidatingVaults { + collateralRemain := liquidation.VaultLiquidationStatus[vault.Id].RemainCollateral.Amount penaltyAmount := math.LegacyNewDecFromInt(vault.Debt.Amount).Quo(vault.LiquidationPrice).Mul(vm.Params.LiquidationPenalty).TruncateInt() - - // If collateral locked not enough for penalty, + + // If remain collateral not enough for penalty, // transfer all and mark vault CLOSED - if penaltyAmount.GT(vault.CollateralLocked.Amount) { - penaltyAmount = vault.CollateralLocked.Amount + if penaltyAmount.GT(collateralRemain) { + soldAmount := liquidation.VaultLiquidationStatus[vault.Id].Sold.Amount + if soldAmount.GTE(vault.Debt.Amount) { + vault.Debt.Amount = math.ZeroInt() + } else { + vault.Debt.Amount = vault.Debt.Amount.Sub(soldAmount) + } + penaltyAmount = collateralRemain vault.Status = types.CLOSED } err := k.bankKeeper.SendCoinsFromModuleToModule(ctx, types.ModuleName, types.ReserveModuleName, sdk.NewCoins(sdk.NewCoin(liquidation.Denom, penaltyAmount))) @@ -546,11 +568,11 @@ func (k *Keeper) Liquidate( }) // Try to reconstitue vaults - // list contains both LIQUIDATING & CLOSED, - // only reconstitue LIQUIDATING vaults + // list contains both LIQUIDATED & CLOSED, + // only reconstitue LIQUIDATED vaults totalRemainDebt := totalDebt.Sub(sold) for _, vault := range liquidation.LiquidatingVaults { - if vault.Status != types.LIQUIDATING { + if vault.Status != types.LIQUIDATED { continue } // if remain debt & collateral can cover full vault @@ -566,7 +588,14 @@ func (k *Keeper) Liquidate( vault.Status = types.ACTIVE } else { - vault.Status = types.LIQUIDATED + // Update debt then mark liquidated + soldAmount := liquidation.VaultLiquidationStatus[vault.Id].Sold.Amount + if soldAmount.GTE(vault.Debt.Amount) { + vault.Debt.Amount = math.ZeroInt() + } else { + vault.Debt.Amount = vault.Debt.Amount.Sub(soldAmount) + } + vault.CollateralLocked.Amount = math.ZeroInt() } } @@ -582,7 +611,10 @@ func (k *Keeper) Liquidate( if totalRemainDebt.Amount.GT(math.ZeroInt()) { // Update vaults status for _, vault := range liquidation.LiquidatingVaults { - k.SetVault(ctx, *vault) + err = k.SetVault(ctx, *vault) + if err != nil { + return err + } } currentShortfall, err := k.ShortfallAmount.Get(ctx) if err != nil { @@ -596,9 +628,9 @@ func (k *Keeper) Liquidate( } // Update vaults status for _, vault := range liquidation.LiquidatingVaults { - k.SetVault(ctx, *vault) + err = k.SetVault(ctx, *vault) } - return nil + return err } func (k *Keeper) GetVault( diff --git a/x/vaults/keeper/vaults_test.go b/x/vaults/keeper/vaults_test.go index dcc86016..e84f3474 100644 --- a/x/vaults/keeper/vaults_test.go +++ b/x/vaults/keeper/vaults_test.go @@ -521,12 +521,15 @@ func (s *KeeperTestSuite) TestLiquidate() { // Fund collateral locked for vault lockCoins := sdk.NewCoins(t.liquidation.VaultLiquidationStatus[vaultId].RemainCollateral) - s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, lockCoins) - s.App.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, types.ModuleName, vaultAddr, lockCoins) + err = s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, lockCoins) + s.Require().NoError(err) + err = s.App.BankKeeper.SendCoinsFromModuleToAccount(s.Ctx, types.ModuleName, vaultAddr, lockCoins) + s.Require().NoError(err) // Fund sold coins to vault Module soldCoins := sdk.NewCoins(t.liquidation.VaultLiquidationStatus[vaultId].Sold) - s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, soldCoins) + err = s.App.BankKeeper.MintCoins(s.Ctx, types.ModuleName, soldCoins) + s.Require().NoError(err) } err = s.App.VaultsKeeper.Liquidate(s.Ctx, t.liquidation) diff --git a/x/vaults/module/module.go b/x/vaults/module/module.go index 790fee24..9df83d45 100644 --- a/x/vaults/module/module.go +++ b/x/vaults/module/module.go @@ -26,6 +26,7 @@ import ( "cosmossdk.io/core/appmodule" cdctypes "github.com/cosmos/cosmos-sdk/codec/types" + govv1beta1 "github.com/cosmos/cosmos-sdk/x/gov/types/v1beta1" modulev1 "github.com/onomyprotocol/reserve/api/reserve/vaults/module" oraclekeeper "github.com/onomyprotocol/reserve/x/oracle/keeper" "github.com/onomyprotocol/reserve/x/vaults/keeper" @@ -176,8 +177,9 @@ type ModuleInputs struct { type ModuleOutputs struct { depinject.Out - PsmKeeper keeper.Keeper - Module appmodule.AppModule + PsmKeeper keeper.Keeper + Module appmodule.AppModule + GovHandler govv1beta1.HandlerRoute } func ProvideModule(in ModuleInputs) ModuleOutputs { @@ -202,6 +204,7 @@ func ProvideModule(in ModuleInputs) ModuleOutputs { in.AccountKeeper, in.BankKeeper, ) + govHandler := govv1beta1.HandlerRoute{RouteKey: types.RouterKey, Handler: NewVaultsProposalHandler(k)} - return ModuleOutputs{PsmKeeper: *k, Module: m} + return ModuleOutputs{PsmKeeper: *k, Module: m, GovHandler: govHandler} } diff --git a/x/vaults/module/proposal_handler.go b/x/vaults/module/proposal_handler.go new file mode 100644 index 00000000..75452f2a --- /dev/null +++ b/x/vaults/module/proposal_handler.go @@ -0,0 +1,28 @@ +package vaults + +import ( + 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" + + "github.com/onomyprotocol/reserve/x/vaults/keeper" + "github.com/onomyprotocol/reserve/x/vaults/types" +) + +func NewVaultsProposalHandler(k *keeper.Keeper) govtypes.Handler { + return func(ctx sdk.Context, content govtypes.Content) error { + msgSv := keeper.NewMsgServerImpl(*k) + switch c := content.(type) { + case *types.ActiveCollateralProposal: + _, err := msgSv.ActiveCollateral(ctx, types.NewMsgActiveCollateral(c)) + return err + case *types.UpdatesCollateralProposal: + _, err := msgSv.UpdatesCollateral(ctx, types.NewMsgUpdatesCollateral(c)) + return err + default: + return errorsmod.Wrapf(sdkerrors.ErrUnknownRequest, "unrecognized %s proposal content type: %T", types.ModuleName, c) + } + } +} diff --git a/x/vaults/types/msgs.go b/x/vaults/types/msgs.go index ef34e08e..b41f7def 100644 --- a/x/vaults/types/msgs.go +++ b/x/vaults/types/msgs.go @@ -67,6 +67,34 @@ func NewMsgClose(vaultId uint64, sender string) MsgClose { var _ govtypes.Content = &ActiveCollateralProposal{} var _ govtypes.Content = &UpdatesCollateralProposal{} +func NewMsgActiveCollateral(a *ActiveCollateralProposal) *MsgActiveCollateral { + return &MsgActiveCollateral{ + Denom: a.ActiveCollateral.Denom, + MinCollateralRatio: a.ActiveCollateral.MinCollateralRatio, + LiquidationRatio: a.ActiveCollateral.LiquidationRatio, + MaxDebt: a.ActiveCollateral.MaxDebt, + StabilityFee: a.ActiveCollateral.StabilityFee, + LiquidationPenalty: a.ActiveCollateral.LiquidationPenalty, + MintingFee: a.ActiveCollateral.MintingFee, + OraclScript: a.ActiveCollateral.OraclScript, + Authority: a.ActiveCollateral.Authority, + } +} + +func NewMsgUpdatesCollateral(u *UpdatesCollateralProposal) *MsgUpdatesCollateral { + return &MsgUpdatesCollateral{ + Denom: u.UpdatesCollateral.Denom, + MinCollateralRatio: u.UpdatesCollateral.MinCollateralRatio, + LiquidationRatio: u.UpdatesCollateral.LiquidationRatio, + MaxDebt: u.UpdatesCollateral.MaxDebt, + StabilityFee: u.UpdatesCollateral.StabilityFee, + LiquidationPenalty: u.UpdatesCollateral.LiquidationPenalty, + MintingFee: u.UpdatesCollateral.MintingFee, + OraclScript: u.UpdatesCollateral.OraclScript, + Authority: u.UpdatesCollateral.Authority, + } +} + func (m *ActiveCollateralProposal) GetDescription() string { return " " } diff --git a/x/vaults/types/params.go b/x/vaults/types/params.go index 52c4c799..ac2505ca 100644 --- a/x/vaults/types/params.go +++ b/x/vaults/types/params.go @@ -11,9 +11,8 @@ var ( DefaultMintingFee = math.LegacyMustNewDecFromStr("0.05") DefaultStabilityFee = math.LegacyMustNewDecFromStr("0.05") DefaultLiquidationPenalty = math.LegacyMustNewDecFromStr("0.05") - DefaultMinInitialDebt = math.NewInt(20_000_000) + DefaultMinInitialDebt = math.NewInt(50_000_000) DefaultRecalculateDebtPeriod = time.Hour - DefaultLiquidatePeriod = time.Hour DefaultMintDenom = "nomUSD" KeyMintingFee = []byte("MintingFee") @@ -21,7 +20,6 @@ var ( KeyLiquidationPenalty = []byte("LiquidationPenalty") KeyMinInitialDebt = []byte("MinInitialDebt") KeyRecalculateDebtPeriod = []byte("RecalculateDebtPeriod") - KeyLiquidatePeriod = []byte("LiquidatePeriod") ) // NewParams creates a new Params instance. @@ -29,13 +27,11 @@ func NewParams( minInitialDebt math.Int, mintDenom string, chargingPeriod time.Duration, - liquidatePeriod time.Duration, ) Params { return Params{ - MinInitialDebt: minInitialDebt, - LiquidatePeriod: liquidatePeriod, - ChargingPeriod: chargingPeriod, - MintDenom: mintDenom, + MinInitialDebt: minInitialDebt, + ChargingPeriod: chargingPeriod, + MintDenom: mintDenom, } } @@ -45,7 +41,6 @@ func DefaultParams() Params { DefaultMinInitialDebt, DefaultMintDenom, DefaultRecalculateDebtPeriod, - DefaultLiquidatePeriod, ) } @@ -57,42 +52,10 @@ func (m Params) Validate() error { if err := validateRecalculateDebtPeriod(m.ChargingPeriod); err != nil { return err } - if err := validateLiquidatePeriod(m.LiquidatePeriod); err != nil { - return err - } return nil } -func validateRecalculateDebtPeriod(i interface{}) error { - return nil -} -func validateLiquidatePeriod(i interface{}) error { - return nil -} - -func validateStabilityFee(i interface{}) error { - v, ok := i.(math.LegacyDec) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v.IsNil() || v.IsNegative() { - return fmt.Errorf("total limit rate cannot be negative or nil: %s", v) - } - - return nil -} - -func validateLiquidationPenalty(i interface{}) error { - v, ok := i.(math.LegacyDec) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v.IsNil() || v.IsNegative() { - return fmt.Errorf("total limit rate cannot be negative or nil: %s", v) - } - +func validateRecalculateDebtPeriod(_ interface{}) error { return nil } @@ -108,16 +71,3 @@ func validateMinInitialDebt(i interface{}) error { return nil } - -func validateMintingFee(i interface{}) error { - v, ok := i.(math.LegacyDec) - if !ok { - return fmt.Errorf("invalid parameter type: %T", i) - } - - if v.IsNil() || v.IsNegative() { - return fmt.Errorf("total limit rate cannot be negative or nil: %s", v) - } - - return nil -} diff --git a/x/vaults/types/params.pb.go b/x/vaults/types/params.pb.go index 6cf27bb2..f7323cf5 100644 --- a/x/vaults/types/params.pb.go +++ b/x/vaults/types/params.pb.go @@ -78,10 +78,9 @@ func (VaultStatus) EnumDescriptor() ([]byte, []int) { // Params defines the parameters for the module. type Params struct { - MinInitialDebt cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=min_initial_debt,json=minInitialDebt,proto3,customtype=cosmossdk.io/math.Int" json:"min_initial_debt"` - MintDenom string `protobuf:"bytes,2,opt,name=mint_denom,json=mintDenom,proto3" json:"mint_denom,omitempty"` - ChargingPeriod time.Duration `protobuf:"bytes,3,opt,name=charging_period,json=chargingPeriod,proto3,stdduration" json:"charging_period"` - LiquidatePeriod time.Duration `protobuf:"bytes,4,opt,name=liquidate_period,json=liquidatePeriod,proto3,stdduration" json:"liquidate_period"` + MinInitialDebt cosmossdk_io_math.Int `protobuf:"bytes,1,opt,name=min_initial_debt,json=minInitialDebt,proto3,customtype=cosmossdk.io/math.Int" json:"min_initial_debt"` + MintDenom string `protobuf:"bytes,2,opt,name=mint_denom,json=mintDenom,proto3" json:"mint_denom,omitempty"` + ChargingPeriod time.Duration `protobuf:"bytes,3,opt,name=charging_period,json=chargingPeriod,proto3,stdduration" json:"charging_period"` } func (m *Params) Reset() { *m = Params{} } @@ -131,13 +130,6 @@ func (m *Params) GetChargingPeriod() time.Duration { return 0 } -func (m *Params) GetLiquidatePeriod() time.Duration { - if m != nil { - return m.LiquidatePeriod - } - return 0 -} - // VaultParams defines the parameters for each collateral vault type. type VaultMamagerParams struct { MinCollateralRatio cosmossdk_io_math.LegacyDec `protobuf:"bytes,1,opt,name=min_collateral_ratio,json=minCollateralRatio,proto3,customtype=cosmossdk.io/math.LegacyDec" json:"min_collateral_ratio"` @@ -491,74 +483,73 @@ func init() { func init() { proto.RegisterFile("reserve/vaults/params.proto", fileDescriptor_1f12ab0d072f9f7c) } var fileDescriptor_1f12ab0d072f9f7c = []byte{ - // 1065 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x56, 0x4f, 0x4f, 0x1b, 0x47, - 0x14, 0xf7, 0xda, 0xc6, 0x49, 0x9e, 0x83, 0x31, 0x53, 0x42, 0x1d, 0xa3, 0x1a, 0xcb, 0x87, 0x0a, - 0x21, 0x65, 0xb7, 0x71, 0xa4, 0x36, 0x8a, 0xda, 0x03, 0x60, 0x53, 0x59, 0x71, 0x53, 0x58, 0x48, - 0x22, 0xa5, 0x07, 0x6b, 0xbc, 0x9e, 0x2c, 0x23, 0x76, 0x77, 0xcc, 0xee, 0xd8, 0xc5, 0xdf, 0xa0, - 0xe2, 0x94, 0x63, 0x2f, 0x48, 0xfd, 0xa3, 0x4a, 0x3d, 0xe6, 0x90, 0x8f, 0xd0, 0x43, 0x2e, 0x55, - 0xa2, 0x9c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- 0xdd, 0xcf, 0x95, 0xd4, 0x6a, 0xeb, 0xf9, 0x51, 0xc5, 0x78, 0x79, 0x54, 0x31, 0xfe, 0x3e, 0xaa, - 0x18, 0x4f, 0x8e, 0x2b, 0xa9, 0x97, 0xc7, 0x95, 0xd4, 0x1f, 0xc7, 0x95, 0xd4, 0x23, 0xcb, 0xa5, - 0x7c, 0x67, 0xd0, 0x35, 0x1d, 0xe6, 0x5b, 0x2c, 0x60, 0xfe, 0x48, 0xa6, 0xed, 0x30, 0xcf, 0x3a, - 0xf5, 0xe8, 0xf3, 0x51, 0x9f, 0x44, 0xdd, 0x9c, 0x34, 0xb8, 0xf5, 0x6f, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xb7, 0x17, 0xaf, 0x8b, 0x1e, 0x0a, 0x00, 0x00, + // 1047 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x55, 0xcf, 0x4f, 0x1b, 0xc7, + 0x17, 0xf7, 0xda, 0xc6, 0x84, 0x67, 0x70, 0xcc, 0x7c, 0x09, 0x5f, 0xc7, 0xa8, 0xc6, 0xf2, 0xa1, + 0x42, 0x48, 0xd9, 0x6d, 0x1c, 0xa9, 0x8d, 0xa2, 0xf6, 0x00, 0xd8, 0x54, 0x56, 0xdc, 0x14, 0x16, + 0x92, 0x48, 0xe9, 0xc1, 0x1a, 0xef, 0x4e, 0x96, 0x11, 0xbb, 0x3b, 0x66, 0x77, 0xec, 0xe2, 0xff, + 0xa0, 0xe2, 0x94, 0x63, 0x2f, 0x48, 0xfd, 0xa1, 0x4a, 0x3d, 0xe6, 0x90, 0x3f, 0xa1, 0x87, 0xdc, + 0x12, 0xe5, 0x54, 0xf5, 0x90, 0x56, 0x70, 0x48, 0xff, 0x84, 0x1e, 0xab, 0xf9, 0xb1, 0xb0, 0x01, + 0xd4, 0xa6, 0xe1, 0xb2, 0xda, 0x99, 0xf7, 0xde, 0x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e, 0x0b, 0x2c, 0x16, 0xb2, 0x60, 0x2c, 0xd3, 0x76, 0x98, 0x6f, 0x9d, 0x7b, + 0xf4, 0xf9, 0x78, 0x40, 0xe2, 0x7e, 0x41, 0x2a, 0xdc, 0xfa, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x07, + 0x17, 0x0f, 0x8e, 0xc9, 0x09, 0x00, 0x00, } func (this *Params) Equal(that interface{}) bool { @@ -589,9 +580,6 @@ func (this *Params) Equal(that interface{}) bool { if this.ChargingPeriod != that1.ChargingPeriod { return false } - if this.LiquidatePeriod != that1.LiquidatePeriod { - return false - } return true } func (m *Params) Marshal() (dAtA []byte, err error) { @@ -614,21 +602,13 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.LiquidatePeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.LiquidatePeriod):]) + n1, err1 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.ChargingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.ChargingPeriod):]) if err1 != nil { return 0, err1 } i -= n1 i = encodeVarintParams(dAtA, i, uint64(n1)) i-- - dAtA[i] = 0x22 - n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.ChargingPeriod, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.ChargingPeriod):]) - if err2 != nil { - return 0, err2 - } - i -= n2 - i = encodeVarintParams(dAtA, i, uint64(n2)) - i-- dAtA[i] = 0x1a if len(m.MintDenom) > 0 { i -= len(m.MintDenom) @@ -991,12 +971,12 @@ func (m *LastUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n9, err9 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) - if err9 != nil { - return 0, err9 + n8, err8 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) + if err8 != nil { + return 0, err8 } - i -= n9 - i = encodeVarintParams(dAtA, i, uint64(n9)) + i -= n8 + i = encodeVarintParams(dAtA, i, uint64(n8)) i-- dAtA[i] = 0xa return len(dAtA) - i, nil @@ -1027,8 +1007,6 @@ func (m *Params) Size() (n int) { } l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.ChargingPeriod) n += 1 + l + sovParams(uint64(l)) - l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.LiquidatePeriod) - n += 1 + l + sovParams(uint64(l)) return n } @@ -1289,39 +1267,6 @@ func (m *Params) Unmarshal(dAtA []byte) error { return err } iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LiquidatePeriod", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowParams - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= int(b&0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthParams - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthParams - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.LiquidatePeriod, dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:])