diff --git a/app/app.go b/app/app.go index 28ccbce2..e9c71689 100644 --- a/app/app.go +++ b/app/app.go @@ -37,6 +37,9 @@ import ( // Consensus "github.com/cosmos/cosmos-sdk/x/consensus" consensusKeeper "github.com/cosmos/cosmos-sdk/x/consensus/keeper" + // Consumer + "github.com/cosmos/interchain-security/v3/x/ccv/consumer" + consumerKeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper" // Crisis "github.com/cosmos/cosmos-sdk/x/crisis" crisisKeeper "github.com/cosmos/cosmos-sdk/x/crisis/keeper" @@ -126,6 +129,7 @@ var ( upgrade.AppModuleBasic{}, vesting.AppModuleBasic{}, + consumer.AppModuleBasic{}, ibc.AppModuleBasic{}, ibcClientSolomachine.AppModuleBasic{}, ibcClientTendermint.AppModuleBasic{}, @@ -172,6 +176,7 @@ type NobleApp struct { UpgradeKeeper *upgradeKeeper.Keeper // IBC Keepers + ConsumerKeeper consumerKeeper.Keeper IBCKeeper *ibcKeeper.Keeper IBCFeeKeeper ibcFeeKeeper.Keeper IBCTransferKeeper ibcTransferKeeper.Keeper @@ -187,6 +192,7 @@ type NobleApp struct { TokenFactoryKeeper *tokenFactoryKeeper.Keeper // Scoped Keepers (for IBC) + ScopedConsumerKeeper capabilityKeeper.ScopedKeeper ScopedIBCKeeper capabilityKeeper.ScopedKeeper ScopedIBCTransferKeeper capabilityKeeper.ScopedKeeper ScopedICAControllerKeeper capabilityKeeper.ScopedKeeper @@ -254,9 +260,9 @@ func NewNobleApp( app.App = appBuilder.Build(logger, db, traceStore, baseAppOptions...) // Registers all modules that don't use App Wiring (e.g. IBC). - // app.RegisterLegacyModules() + app.RegisterLegacyModules() // Registers all proposals handlers that are using v1beta1 governance. - // app.RegisterLegacyRouter() + app.RegisterLegacyRouter() if err := app.Load(loadLatest); err != nil { panic(err) diff --git a/app/app_config.go b/app/app_config.go index 77854e09..4868440d 100644 --- a/app/app_config.go +++ b/app/app_config.go @@ -26,6 +26,8 @@ import ( // Consensus consensus "cosmossdk.io/api/cosmos/consensus/module/v1" consensusTypes "github.com/cosmos/cosmos-sdk/x/consensus/types" + // Consumer + consumerTypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" // Crisis crisis "cosmossdk.io/api/cosmos/crisis/module/v1" crisisTypes "github.com/cosmos/cosmos-sdk/x/crisis/types" @@ -102,6 +104,7 @@ var AppConfig = appconfig.Compose(&app.Config{ authTypes.ModuleName, bankTypes.ModuleName, crisisTypes.ModuleName, + consumerTypes.ModuleName, // ICS ibcTransferTypes.ModuleName, // IBC ibcTypes.ModuleName, // IBC icaTypes.ModuleName, // IBC @@ -123,6 +126,7 @@ var AppConfig = appconfig.Compose(&app.Config{ EndBlockers: []string{ crisisTypes.ModuleName, stakingTypes.ModuleName, + consumerTypes.ModuleName, // ICS ibcTransferTypes.ModuleName, // IBC ibcTypes.ModuleName, // IBC icaTypes.ModuleName, // IBC @@ -174,6 +178,7 @@ var AppConfig = appconfig.Compose(&app.Config{ vestingTypes.ModuleName, consensusTypes.ModuleName, + consumerTypes.ModuleName, ibcTransferTypes.ModuleName, ibcTypes.ModuleName, icaTypes.ModuleName, diff --git a/app/legacy_modules.go b/app/legacy_modules.go index 9338d5c8..b8ffe511 100644 --- a/app/legacy_modules.go +++ b/app/legacy_modules.go @@ -4,8 +4,13 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/module" + // Auth + authTypes "github.com/cosmos/cosmos-sdk/x/auth/types" // BlockIBC blockIBC "github.com/strangelove-ventures/noble/x/blockibc" + // Consumer + consumerKeeper "github.com/cosmos/interchain-security/v3/x/ccv/consumer/keeper" + consumerTypes "github.com/cosmos/interchain-security/v3/x/ccv/consumer/types" // IBC Client ibcClientSolomachine "github.com/cosmos/ibc-go/v7/modules/light-clients/06-solomachine" ibcClientTendermint "github.com/cosmos/ibc-go/v7/modules/light-clients/07-tendermint" @@ -40,15 +45,17 @@ import ( var ( keys = sdk.NewKVStoreKeys( - ibcTypes.StoreKey, ibcFeeTypes.StoreKey, ibcTransferTypes.StoreKey, - icaControllerTypes.StoreKey, icaHostTypes.StoreKey, pfmTypes.StoreKey, + consumerTypes.StoreKey, ibcTypes.StoreKey, ibcFeeTypes.StoreKey, + ibcTransferTypes.StoreKey, icaControllerTypes.StoreKey, + icaHostTypes.StoreKey, pfmTypes.StoreKey, ) memKeys = sdk.NewMemoryStoreKeys() subspaces = []string{ - ibcTypes.ModuleName, ibcFeeTypes.ModuleName, ibcTransferTypes.ModuleName, - icaControllerTypes.SubModuleName, icaHostTypes.SubModuleName, pfmTypes.ModuleName, + consumerTypes.ModuleName, ibcTypes.ModuleName, ibcFeeTypes.ModuleName, + ibcTransferTypes.ModuleName, icaControllerTypes.SubModuleName, + icaHostTypes.SubModuleName, pfmTypes.ModuleName, } ) @@ -119,6 +126,26 @@ func (app *NobleApp) RegisterLegacyModules() { app.ScopedIBCTransferKeeper = scopedIBCTransferKeeper app.PFMKeeper.SetTransferKeeper(app.IBCTransferKeeper) + // Keeper: Consumer + scopedConsumerKeeper := app.CapabilityKeeper.ScopeToModule(consumerTypes.ModuleName) + app.ConsumerKeeper = consumerKeeper.NewKeeper( + app.appCodec, + keys[consumerTypes.StoreKey], + app.GetSubspace(consumerTypes.ModuleName), + + scopedConsumerKeeper, + app.IBCKeeper.ChannelKeeper, + &app.IBCKeeper.PortKeeper, + app.IBCKeeper.ConnectionKeeper, + app.IBCKeeper.ClientKeeper, + app.SlashingKeeper, + app.BankKeeper, + app.AccountKeeper, + app.IBCTransferKeeper, + app.IBCKeeper, + authTypes.FeeCollectorName, + ) + // Keeper: ICA Controller scopedICAControllerKeeper := app.CapabilityKeeper.ScopeToModule(icaControllerTypes.SubModuleName) app.ICAControllerKeeper = icaControllerKeeper.NewKeeper( diff --git a/genesis.json b/genesis.json new file mode 100644 index 00000000..c0fe8f89 --- /dev/null +++ b/genesis.json @@ -0,0 +1,301 @@ +{ + "app_message": { + "06-solomachine": null, + "07-tendermint": null, + "auth": { + "accounts": [], + "params": { + "max_memo_characters": "256", + "sig_verify_cost_ed25519": "590", + "sig_verify_cost_secp256k1": "1000", + "tx_sig_limit": "7", + "tx_size_cost_per_byte": "10" + } + }, + "authority": { + "authority": "" + }, + "authz": { + "authorization": [] + }, + "bank": { + "balances": [], + "denom_metadata": [], + "params": { + "default_send_enabled": true, + "send_enabled": [] + }, + "send_enabled": [], + "supply": [] + }, + "capability": { + "index": "1", + "owners": [] + }, + "ccvconsumer": { + "height_to_valset_update_id": [], + "initial_val_set": [], + "last_transmission_block_height": { + "height": "0" + }, + "maturing_packets": [], + "new_chain": false, + "outstanding_downtime_slashing": [], + "params": { + "blocks_per_distribution_transmission": "1000", + "ccv_timeout_period": "2419200s", + "consumer_redistribution_fraction": "0.75", + "distribution_transmission_channel": "", + "enabled": false, + "historical_entries": "10000", + "provider_fee_pool_addr_str": "", + "provider_reward_denoms": [], + "reward_denoms": [], + "soft_opt_out_threshold": "0.05", + "transfer_timeout_period": "3600s", + "unbonding_period": "1728000s" + }, + "pending_consumer_packets": { + "list": [] + }, + "preCCV": false, + "provider_channel_id": "", + "provider_client_id": "", + "provider_client_state": null, + "provider_consensus_state": null + }, + "consensus": null, + "crisis": { + "constant_fee": { + "amount": "1000", + "denom": "stake" + } + }, + "distribution": { + "delegator_starting_infos": [], + "delegator_withdraw_infos": [], + "fee_pool": { + "community_pool": [] + }, + "outstanding_rewards": [], + "params": { + "base_proposer_reward": "0.000000000000000000", + "bonus_proposer_reward": "0.000000000000000000", + "community_tax": "0.020000000000000000", + "withdraw_addr_enabled": true + }, + "previous_proposer": "", + "validator_accumulated_commissions": [], + "validator_current_rewards": [], + "validator_historical_rewards": [], + "validator_slash_events": [] + }, + "evidence": { + "evidence": [] + }, + "feegrant": { + "allowances": [] + }, + "feeibc": { + "fee_enabled_channels": [], + "forward_relayers": [], + "identified_fees": [], + "registered_counterparty_payees": [], + "registered_payees": [] + }, + "fiat-tokenfactory": { + "blacklisted_list": [], + "blacklister": null, + "master_minter": null, + "minter_controller_list": [], + "minters_list": [], + "minting_denom": null, + "owner": null, + "paused": null, + "pauser": null + }, + "genutil": { + "gen_txs": [] + }, + "globalfee": { + "params": { + "bypass_min_fee_msg_types": [ + "/ibc.core.client.v1.MsgUpdateClient", + "/ibc.core.channel.v1.MsgRecvPacket", + "/ibc.core.channel.v1.MsgAcknowledgement", + "/ibc.applications.transfer.v1.MsgTransfer", + "/ibc.core.channel.v1.MsgTimeout", + "/ibc.core.channel.v1.MsgTimeoutOnClose", + "/cosmos.params.v1beta1.MsgUpdateParams", + "/cosmos.upgrade.v1beta1.MsgSoftwareUpgrade", + "/cosmos.upgrade.v1beta1.MsgCancelUpgrade", + "/noble.fiattokenfactory.MsgUpdateMasterMinter", + "/noble.fiattokenfactory.MsgUpdatePauser", + "/noble.fiattokenfactory.MsgUpdateBlacklister", + "/noble.fiattokenfactory.MsgUpdateOwner", + "/noble.fiattokenfactory.MsgAcceptOwner", + "/noble.fiattokenfactory.MsgConfigureMinter", + "/noble.fiattokenfactory.MsgRemoveMinter", + "/noble.fiattokenfactory.MsgMint", + "/noble.fiattokenfactory.MsgBurn", + "/noble.fiattokenfactory.MsgBlacklist", + "/noble.fiattokenfactory.MsgUnblacklist", + "/noble.fiattokenfactory.MsgPause", + "/noble.fiattokenfactory.MsgUnpause", + "/noble.fiattokenfactory.MsgConfigureMinterController", + "/noble.fiattokenfactory.MsgRemoveMinterController", + "/noble.tokenfactory.MsgUpdatePauser", + "/noble.tokenfactory.MsgUpdateBlacklister", + "/noble.tokenfactory.MsgUpdateOwner", + "/noble.tokenfactory.MsgAcceptOwner", + "/noble.tokenfactory.MsgConfigureMinter", + "/noble.tokenfactory.MsgRemoveMinter", + "/noble.tokenfactory.MsgMint", + "/noble.tokenfactory.MsgBurn", + "/noble.tokenfactory.MsgBlacklist", + "/noble.tokenfactory.MsgUnblacklist", + "/noble.tokenfactory.MsgPause", + "/noble.tokenfactory.MsgUnpause", + "/noble.tokenfactory.MsgConfigureMinterController", + "/noble.tokenfactory.MsgRemoveMinterController" + ], + "minimum_gas_prices": [] + } + }, + "group": { + "group_members": [], + "group_policies": [], + "group_policy_seq": "0", + "group_seq": "0", + "groups": [], + "proposal_seq": "0", + "proposals": [], + "votes": [] + }, + "ibc": { + "channel_genesis": { + "ack_sequences": [], + "acknowledgements": [], + "channels": [], + "commitments": [], + "next_channel_sequence": "0", + "receipts": [], + "recv_sequences": [], + "send_sequences": [] + }, + "client_genesis": { + "clients": [], + "clients_consensus": [], + "clients_metadata": [], + "create_localhost": false, + "next_client_sequence": "0", + "params": { + "allowed_clients": [ + "06-solomachine", + "07-tendermint", + "09-localhost" + ] + } + }, + "connection_genesis": { + "client_connection_paths": [], + "connections": [], + "next_connection_sequence": "0", + "params": { + "max_expected_time_per_block": "30000000000" + } + } + }, + "interchainaccounts": { + "controller_genesis_state": { + "active_channels": [], + "interchain_accounts": [], + "params": { + "controller_enabled": true + }, + "ports": [] + }, + "host_genesis_state": { + "active_channels": [], + "interchain_accounts": [], + "params": { + "allow_messages": [ + "*" + ], + "host_enabled": true + }, + "port": "icahost" + } + }, + "packetfowardmiddleware": { + "in_flight_packets": {}, + "params": { + "fee_percentage": "0.000000000000000000" + } + }, + "params": null, + "slashing": { + "missed_blocks": [], + "params": { + "downtime_jail_duration": "600s", + "min_signed_per_window": "0.500000000000000000", + "signed_blocks_window": "100", + "slash_fraction_double_sign": "0.050000000000000000", + "slash_fraction_downtime": "0.010000000000000000" + }, + "signing_infos": [] + }, + "staking": { + "delegations": [], + "exported": false, + "last_total_power": "0", + "last_validator_powers": [], + "params": { + "bond_denom": "stake", + "historical_entries": 10000, + "max_entries": 7, + "max_validators": 100, + "min_commission_rate": "0.000000000000000000", + "unbonding_time": "1814400s" + }, + "redelegations": [], + "unbonding_delegations": [], + "validators": [] + }, + "tariff": { + "params": { + "distribution_entities": [], + "share": "0", + "transfer_fee_bps": "0", + "transfer_fee_denom": "", + "transfer_fee_max": "0" + } + }, + "tokenfactory": { + "blacklisted_list": [], + "blacklister": null, + "master_minter": null, + "minter_controller_list": [], + "minters_list": [], + "minting_denom": null, + "owner": null, + "paused": null, + "pauser": null + }, + "transfer": { + "denom_traces": [], + "params": { + "receive_enabled": true, + "send_enabled": true + }, + "port_id": "transfer", + "total_escrowed": [] + }, + "upgrade": {}, + "vesting": {} + }, + "chain_id": "noble-1", + "gentxs_dir": "", + "moniker": "john", + "node_id": "3ddf7033ebb809e49b56bf407710791db5d0fe66" +} diff --git a/go.mod b/go.mod index 0778ce8a..b0c253f6 100644 --- a/go.mod +++ b/go.mod @@ -15,6 +15,7 @@ require ( github.com/cosmos/cosmos-sdk v0.47.4 github.com/cosmos/gogoproto v1.4.10 github.com/cosmos/ibc-go/v7 v7.2.0 + github.com/cosmos/interchain-security/v3 v3.1.0 github.com/golang/protobuf v1.5.3 github.com/golangci/golangci-lint v1.54.1 github.com/grpc-ecosystem/grpc-gateway v1.16.0 diff --git a/go.sum b/go.sum index fa07c301..86a2266c 100644 --- a/go.sum +++ b/go.sum @@ -399,6 +399,8 @@ github.com/cosmos/ibc-go/v7 v7.2.0 h1:dx0DLUl7rxdyZ8NiT6UsrbzKOJx/w7s+BOaewFRH6c github.com/cosmos/ibc-go/v7 v7.2.0/go.mod h1:OOcjKIRku/j1Xs1RgKK0yvKRrJ5iFuZYMetR1n3yMlc= 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/interchain-security/v3 v3.1.0 h1:EKDJCIKIDLG45tvKwfoANrRPgqvqfUt/f1TNKx3b7Uo= +github.com/cosmos/interchain-security/v3 v3.1.0/go.mod h1:2fILBgypEZcwR3BSzKDw+EsYtMKv9Z6cYXfouh4xTYU= github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA= github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI= github.com/cosmos/rosetta-sdk-go v0.10.0 h1:E5RhTruuoA7KTIXUcMicL76cffyeoyvNybzUGSKFTcM= @@ -516,8 +518,9 @@ github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KE github.com/go-logr/logr v1.2.4 h1:g01GSCwiDw2xSZfjJ2/T9M+S6pFdcNtFYsp+Y43HYDQ= github.com/go-logr/logr v1.2.4/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= -github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= +github.com/go-playground/locales v0.14.0 h1:u50s323jtVGugKlcYeyzC0etD1HifMjqmJqb8WugfUU= +github.com/go-playground/locales v0.14.0/go.mod h1:sawfccIbzZTqEDETgFXqTho0QybSa7l++s0DH+LDiLs= github.com/go-playground/universal-translator v0.17.0/go.mod h1:UkSxE5sNxxRwHyU+Scu5vgOQjsIJAF8j9muTVoKLVtA= github.com/go-playground/universal-translator v0.18.0 h1:82dyy6p4OuJq4/CByFNOn/jYrnRPArHwAcmLoJZxyho= github.com/go-playground/universal-translator v0.18.0/go.mod h1:UvRDBj+xPUEGrFYl+lu/H90nyDXpg0fqeB/AQUGNTVA= @@ -775,8 +778,9 @@ github.com/hashicorp/go-safetemp v1.0.0/go.mod h1:oaerMy3BhqiTbVye6QuFhFtIceqFoD github.com/hashicorp/go-sockaddr v1.0.0/go.mod h1:7Xibr9yA9JjQq1JpNB2Vw7kxv8xerXegt+ozgdvDeDU= github.com/hashicorp/go-syslog v1.0.0/go.mod h1:qPfqrKkXGihmCqbJM2mZgkZGvKG1dFdvsLplgctolz4= github.com/hashicorp/go-uuid v1.0.0/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= -github.com/hashicorp/go-uuid v1.0.1 h1:fv1ep09latC32wFoVwnqcnKJGnMSdBanPczbHAYm1BE= github.com/hashicorp/go-uuid v1.0.1/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= +github.com/hashicorp/go-uuid v1.0.2 h1:cfejS+Tpcp13yd5nYHWDI6qVCny6wyX2Mt5SGur2IGE= +github.com/hashicorp/go-uuid v1.0.2/go.mod h1:6SBZvOh/SIDV7/2o3Jml5SYk/TvGqwFJ/bN7x4byOro= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.2.1/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= github.com/hashicorp/go-version v1.6.0 h1:feTTfFNnjP967rlCxM/I9g701jU+RN74YKx2mOkIeek= @@ -1031,6 +1035,8 @@ github.com/otiai10/curr v0.0.0-20150429015615-9b4961190c95/go.mod h1:9qAhocn7zKJ github.com/otiai10/curr v1.0.0/go.mod h1:LskTG5wDwr8Rs+nNQ+1LlxRjAtTZZjtJW4rMXl6j4vs= github.com/otiai10/mint v1.3.0/go.mod h1:F5AjcsTsWUqX+Na9fpHb52P8pcRX2CI6A3ctIT91xUo= github.com/otiai10/mint v1.3.1/go.mod h1:/yxELlJQ0ufhjUwhshSj+wFjZ78CnZ48/1wtmBH1OTc= +github.com/oxyno-zeta/gomock-extra-matcher v1.1.0 h1:Yyk5ov0ZPKBXtVEeIWtc4J2XVrHuNoIK+0F2BUJgtsc= +github.com/oxyno-zeta/gomock-extra-matcher v1.1.0/go.mod h1:UMGTHYEmJ1dRq8LDZ7VTAYO4nqM3GD1UGC3RJEUxEz0= github.com/pact-foundation/pact-go v1.0.4/go.mod h1:uExwJY4kCzNPcHRj+hCR/HBbOOIwwtUjcrb0b5/5kLM= github.com/pascaldekloe/goe v0.0.0-20180627143212-57f6aae5913c/go.mod h1:lzWF7FIEvWOWxwDKqyGYQf6ZUaNfKdP144TG7ZOy1lc= github.com/pascaldekloe/goe v0.1.0 h1:cBOtyMzM9HTpWjXfbbunk26uA6nG3a8n06Wieeh0MwY=