diff --git a/networks/testnets/fairyring-testnet-2/genesis.json b/networks/testnets/fairyring-testnet-2/genesis.json new file mode 100644 index 00000000..f37d370f --- /dev/null +++ b/networks/testnets/fairyring-testnet-2/genesis.json @@ -0,0 +1,396 @@ +{ + "app_name": "fairyringd", + "app_version": "v0.8.0", + "genesis_time": "2024-08-01T16:00:00.00Z", + "chain_id": "fairyring-testnet-2", + "initial_height": 1, + "app_hash": null, + "app_state": { + "06-solomachine": null, + "07-tendermint": null, + "auth": { + "params": { + "max_memo_characters": "256", + "tx_sig_limit": "7", + "tx_size_cost_per_byte": "10", + "sig_verify_cost_ed25519": "590", + "sig_verify_cost_secp256k1": "1000" + }, + "accounts": [] + }, + "authz": { + "authorization": [] + }, + "bank": { + "params": { + "send_enabled": [], + "default_send_enabled": true + }, + "balances": [], + "supply": [], + "denom_metadata": [], + "send_enabled": [] + }, + "capability": { + "index": "1", + "owners": [] + }, + "ccvconsumer": { + "params": { + "enabled": false, + "blocks_per_distribution_transmission": "1000", + "distribution_transmission_channel": "", + "provider_fee_pool_addr_str": "", + "ccv_timeout_period": "2419200s", + "transfer_timeout_period": "3600s", + "consumer_redistribution_fraction": "0.75", + "historical_entries": "10000", + "unbonding_period": "1209600s", + "soft_opt_out_threshold": "0.05", + "reward_denoms": [], + "provider_reward_denoms": [] + }, + "provider_client_id": "", + "provider_channel_id": "", + "new_chain": false, + "provider_client_state": null, + "provider_consensus_state": null, + "maturing_packets": [], + "initial_val_set": [], + "height_to_valset_update_id": [], + "outstanding_downtime_slashing": [], + "pending_consumer_packets": { + "list": [] + }, + "last_transmission_block_height": { + "height": "0" + }, + "preCCV": false + }, + "circuit": { + "account_permissions": [], + "disabled_type_urls": [] + }, + "consensus": null, + "crisis": { + "constant_fee": { + "denom": "ufairy", + "amount": "1000" + } + }, + "distribution": { + "params": { + "community_tax": "0.020000000000000000", + "base_proposer_reward": "0.000000000000000000", + "bonus_proposer_reward": "0.000000000000000000", + "withdraw_addr_enabled": true + }, + "fee_pool": { + "community_pool": [] + }, + "delegator_withdraw_infos": [], + "previous_proposer": "", + "outstanding_rewards": [], + "validator_accumulated_commissions": [], + "validator_historical_rewards": [], + "validator_current_rewards": [], + "delegator_starting_infos": [], + "validator_slash_events": [] + }, + "evidence": { + "evidence": [] + }, + "feegrant": { + "allowances": [] + }, + "feeibc": { + "identified_fees": [], + "fee_enabled_channels": [], + "registered_payees": [], + "registered_counterparty_payees": [], + "forward_relayers": [] + }, + "genutil": { + "gen_txs": [] + }, + "gov": { + "starting_proposal_id": "1", + "deposits": [], + "votes": [], + "proposals": [], + "deposit_params": null, + "voting_params": null, + "tally_params": null, + "params": { + "min_deposit": [ + { + "denom": "ufairy", + "amount": "10000000000" + } + ], + "max_deposit_period": "43200s", + "voting_period": "43200s", + "quorum": "0.334000000000000000", + "threshold": "0.500000000000000000", + "veto_threshold": "0.334000000000000000", + "min_initial_deposit_ratio": "0.500000000000000000", + "proposal_cancel_ratio": "0.500000000000000000", + "proposal_cancel_dest": "", + "expedited_voting_period": "21600s", + "expedited_threshold": "0.667000000000000000", + "expedited_min_deposit": [ + { + "denom": "ufairy", + "amount": "50000000000" + } + ], + "burn_vote_quorum": false, + "burn_proposal_deposit_prevote": false, + "burn_vote_veto": true, + "min_deposit_ratio": "0.010000000000000000", + "max_tally_period": "120s", + "trusted_counter_parties": [], + "channel_id": "channel-0", + "is_source_chain": true + }, + "constitution": "", + "port_id": "" + }, + "group": { + "group_seq": "0", + "groups": [], + "group_members": [], + "group_policy_seq": "0", + "group_policies": [], + "proposal_seq": "0", + "proposals": [], + "votes": [] + }, + "ibc": { + "client_genesis": { + "clients": [], + "clients_consensus": [], + "clients_metadata": [], + "params": { + "allowed_clients": [ + "*" + ] + }, + "create_localhost": false, + "next_client_sequence": "0" + }, + "connection_genesis": { + "connections": [], + "client_connection_paths": [], + "next_connection_sequence": "0", + "params": { + "max_expected_time_per_block": "30000000000" + } + }, + "channel_genesis": { + "channels": [], + "acknowledgements": [], + "commitments": [], + "receipts": [], + "send_sequences": [], + "recv_sequences": [], + "ack_sequences": [], + "next_channel_sequence": "0", + "params": { + "upgrade_timeout": { + "height": { + "revision_number": "0", + "revision_height": "0" + }, + "timestamp": "600000000000" + } + } + } + }, + "interchainaccounts": { + "controller_genesis_state": { + "active_channels": [], + "interchain_accounts": [], + "ports": [], + "params": { + "controller_enabled": true + } + }, + "host_genesis_state": { + "active_channels": [], + "interchain_accounts": [], + "port": "icahost", + "params": { + "host_enabled": true, + "allow_messages": [ + "*" + ] + } + } + }, + "keyshare": { + "params": { + "key_expiry": "463000", + "minimum_bonded": "10000000000", + "max_idled_block": "20000", + "trusted_addresses": [ + "fairy1r6q07ne3deq64ezcjwkedcfe6669f0ewpwnxy9" + ], + "slash_fraction_no_keyshare": "0.500000000000000000", + "slash_fraction_wrong_keyshare": "0.500000000000000000" + }, + "port_id": "keyshare", + "validatorSetList": [], + "keyShareList": [], + "aggregatedKeyShareList": [], + "activePubKey": { + "publicKey": "", + "creator": "", + "expiry": "0", + "numberOfValidators": "0", + "encryptedKeyShares": [] + }, + "queuedPubKey": { + "publicKey": "", + "creator": "", + "expiry": "0", + "numberOfValidators": "0", + "encryptedKeyShares": [] + }, + "authorizedAddressList": [], + "request_count": "0", + "generalKeyShareList": [] + }, + "mint": { + "minter": { + "inflation": "0.130000000000000000", + "annual_provisions": "0.000000000000000000" + }, + "params": { + "mint_denom": "ufairy", + "inflation_rate_change": "0.130000000000000000", + "inflation_max": "0.000000000000000000", + "inflation_min": "0.000000000000000000", + "goal_bonded": "0.670000000000000000", + "blocks_per_year": "6311520" + } + }, + "nft": { + "classes": [], + "entries": [] + }, + "params": null, + "pep": { + "params": { + "keyshare_channel_id": "channel-1", + "is_source_chain": true, + "trusted_counter_parties": [ + { + "client_id": "07-tendermint-0", + "connection_id": "connection-0", + "channel_id": "channel-0" + } + ], + "trusted_addresses": [ + "fairy1yhpqdugfmfuhlvekkurnkstf2vl82063ajmfe5", + "fairy1r6q07ne3deq64ezcjwkedcfe6669f0ewpwnxy9" + ], + "min_gas_price": { + "denom": "ufairy", + "amount": "300000" + } + }, + "port_id": "pep", + "encryptedTxArray": [], + "pepNonceList": [], + "aggregatedKeyShareList": [], + "activePubKey": { + "publicKey": "", + "creator": "", + "expiry": "0" + }, + "queuedPubKey": { + "publicKey": "", + "creator": "", + "expiry": "0" + }, + "request_count": "0" + }, + "runtime": null, + "slashing": { + "params": { + "signed_blocks_window": "5000", + "min_signed_per_window": "0.500000000000000000", + "downtime_jail_duration": "600s", + "slash_fraction_double_sign": "0.050000000000000000", + "slash_fraction_downtime": "0.010000000000000000" + }, + "signing_infos": [], + "missed_blocks": [] + }, + "staking": { + "params": { + "unbonding_time": "1814400s", + "max_validators": 100, + "max_entries": 7, + "historical_entries": 10000, + "bond_denom": "ufairy", + "min_commission_rate": "0.000000000000000000" + }, + "last_total_power": "0", + "last_validator_powers": [], + "validators": [], + "delegations": [], + "unbonding_delegations": [], + "redelegations": [], + "exported": false + }, + "transfer": { + "port_id": "transfer", + "denom_traces": [], + "params": { + "send_enabled": true, + "receive_enabled": true + }, + "total_escrowed": [] + }, + "upgrade": {}, + "vesting": {}, + "wasm": { + "params": { + "code_upload_access": { + "permission": "Everybody", + "addresses": [] + }, + "instantiate_default_permission": "Everybody" + }, + "codes": [], + "contracts": [], + "sequences": [] + } + }, + "consensus": { + "params": { + "block": { + "max_bytes": "22020096", + "max_gas": "-1" + }, + "evidence": { + "max_age_num_blocks": "100000", + "max_age_duration": "172800000000000", + "max_bytes": "1048576" + }, + "validator": { + "pub_key_types": [ + "ed25519" + ] + }, + "version": { + "app": "0" + }, + "abci": { + "vote_extensions_enable_height": "0" + } + } + } +} \ No newline at end of file diff --git a/networks/testnets/fairyring-testnet-2/gentxs/gentx-fairblock.json b/networks/testnets/fairyring-testnet-2/gentxs/gentx-fairblock.json new file mode 100644 index 00000000..24b54d01 --- /dev/null +++ b/networks/testnets/fairyring-testnet-2/gentxs/gentx-fairblock.json @@ -0,0 +1,62 @@ +{ + "body": { + "messages": [ + { + "@type": "/cosmos.staking.v1beta1.MsgCreateValidator", + "description": { + "moniker": "Fairblock", + "identity": "", + "website": "https://fairblock.network", + "security_contact": "hello@fairblock.network", + "details": "The modular ecosystem of privacy-enabled infrastructure and dapps." + }, + "commission": { + "rate": "0.100000000000000000", + "max_rate": "0.200000000000000000", + "max_change_rate": "0.010000000000000000" + }, + "min_self_delegation": "1", + "delegator_address": "", + "validator_address": "fairyvaloper1zrpp7dfav7kancgse2peh3k98u9ueajwhmnm3y", + "pubkey": { + "@type": "/cosmos.crypto.ed25519.PubKey", + "key": "03vG/iogYilO9qeSoVIJIZl6QC3ARWFgqSwhQ621z3g=" + }, + "value": { + "denom": "ufairy", + "amount": "10000000000" + } + } + ], + "memo": "cd1cbf64a3e85d511c2a40b9e3e7b2e9b40d5905@18.183.243.242:26656", + "timeout_height": "0", + "extension_options": [], + "non_critical_extension_options": [] + }, + "auth_info": { + "signer_infos": [ + { + "public_key": { + "@type": "/cosmos.crypto.secp256k1.PubKey", + "key": "A8S5yG2QJE4nV1vCObdnbouIkooccDzAO1GHX9fSQ1x/" + }, + "mode_info": { + "single": { + "mode": "SIGN_MODE_DIRECT" + } + }, + "sequence": "0" + } + ], + "fee": { + "amount": [], + "gas_limit": "200000", + "payer": "", + "granter": "" + }, + "tip": null + }, + "signatures": [ + "G55bLAtTtLxbJcgZbjP8aO1G8JlPnVhiISjKsOweXl5H/kweOkSmugiaL47CynbsCFMzoBtwLeKCHbwngeA1ew==" + ] +} \ No newline at end of file diff --git a/networks/testnets/fairyring-testnet-2/peers-node.txt b/networks/testnets/fairyring-testnet-2/peers-node.txt new file mode 100644 index 00000000..e69de29b diff --git a/networks/testnets/fairyring-testnet-2/peers/peers-fairblock.json b/networks/testnets/fairyring-testnet-2/peers/peers-fairblock.json new file mode 100644 index 00000000..c5914215 --- /dev/null +++ b/networks/testnets/fairyring-testnet-2/peers/peers-fairblock.json @@ -0,0 +1,5 @@ +{ + "node_id": "cd1cbf64a3e85d511c2a40b9e3e7b2e9b40d5905", + "public_ip": "18.183.243.242", + "port": "26656" +} diff --git a/x/keyshare/keeper/authorized_address.go b/x/keyshare/keeper/authorized_address.go index ac199e67..b446ef53 100644 --- a/x/keyshare/keeper/authorized_address.go +++ b/x/keyshare/keeper/authorized_address.go @@ -67,7 +67,7 @@ func (k Keeper) DecreaseAuthorizedCount( // SetAuthorizedAddress set a specific authorizedAddress in the store from its index func (k Keeper) SetAuthorizedAddress(ctx context.Context, authorizedAddress types.AuthorizedAddress) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.AuthorizedCountKeyPrefix)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.AuthorizedAddressKeyPrefix)) b := k.cdc.MustMarshal(&authorizedAddress) store.Set(types.AuthorizedAddressKey( authorizedAddress.Target, @@ -81,7 +81,7 @@ func (k Keeper) GetAuthorizedAddress( ) (val types.AuthorizedAddress, found bool) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.AuthorizedCountKeyPrefix)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.AuthorizedAddressKeyPrefix)) b := store.Get(types.AuthorizedAddressKey( target, @@ -101,7 +101,7 @@ func (k Keeper) RemoveAuthorizedAddress( ) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.AuthorizedCountKeyPrefix)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.AuthorizedAddressKeyPrefix)) store.Delete(types.AuthorizedAddressKey( target, )) @@ -110,7 +110,7 @@ func (k Keeper) RemoveAuthorizedAddress( // GetAllAuthorizedAddress returns all authorizedAddress func (k Keeper) GetAllAuthorizedAddress(ctx context.Context) (list []types.AuthorizedAddress) { storeAdapter := runtime.KVStoreAdapter(k.storeService.OpenKVStore(ctx)) - store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.AuthorizedCountKeyPrefix)) + store := prefix.NewStore(storeAdapter, types.KeyPrefix(types.AuthorizedAddressKeyPrefix)) iterator := storetypes.KVStorePrefixIterator(store, []byte{}) defer iterator.Close() diff --git a/x/pep/keeper/migrations.go b/x/pep/keeper/migrations.go new file mode 100644 index 00000000..1a7005d9 --- /dev/null +++ b/x/pep/keeper/migrations.go @@ -0,0 +1,21 @@ +package keeper + +import ( + v2 "github.com/Fairblock/fairyring/x/pep/migrations/v2" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// Migrator is a struct for handling in-place store migrations. +type Migrator struct { + keeper Keeper +} + +// NewMigrator returns a new Migrator. +func NewMigrator(keeper Keeper) Migrator { + return Migrator{keeper: keeper} +} + +// Migrate1to2 migrates from version 1 to 2. +func (m Migrator) Migrate1to2(ctx sdk.Context) error { + return v2.MigrateStore(ctx, m.keeper.storeService, m.keeper.cdc) +} diff --git a/x/pep/migrations/v2/store.go b/x/pep/migrations/v2/store.go new file mode 100644 index 00000000..863105ca --- /dev/null +++ b/x/pep/migrations/v2/store.go @@ -0,0 +1,33 @@ +package v2 + +import ( + "cosmossdk.io/core/store" + "github.com/Fairblock/fairyring/x/pep/types" + "github.com/cosmos/cosmos-sdk/codec" + sdk "github.com/cosmos/cosmos-sdk/types" +) + +// MigrateStore migrates the x/pep module state from the consensus version 1 to version 2. +func MigrateStore(ctx sdk.Context, storeService store.KVStoreService, cdc codec.BinaryCodec) error { + currParams := types.NewParams( + []string{"fairy1yhpqdugfmfuhlvekkurnkstf2vl82063ajmfe5", "fairy1r6q07ne3deq64ezcjwkedcfe6669f0ewpwnxy9"}, + []*types.TrustedCounterParty{ + { + ClientId: "07-tendermint-0", + ConnectionId: "connection-0", + ChannelId: "channel-1", + }, + }, + types.DefaultKeyshareChannelID, + &types.DefaultMinGasPrice, + true, + ) + + bz, err := cdc.Marshal(&currParams) + if err != nil { + return err + } + + store := storeService.OpenKVStore(ctx) + return store.Set(types.ParamsKey, bz) +} diff --git a/x/pep/module/module.go b/x/pep/module/module.go index 9cd4af4d..0c0f946f 100644 --- a/x/pep/module/module.go +++ b/x/pep/module/module.go @@ -55,7 +55,7 @@ var ( ) // ConsensusVersion defines the current x/pep module consensus version. -const ConsensusVersion = 1 +const ConsensusVersion = 2 // ---------------------------------------------------------------------------- // AppModuleBasic @@ -154,6 +154,10 @@ func NewAppModule( func (am AppModule) RegisterServices(cfg module.Configurator) { types.RegisterMsgServer(cfg.MsgServer(), keeper.NewMsgServerImpl(am.keeper)) types.RegisterQueryServer(cfg.QueryServer(), am.keeper) + m := keeper.NewMigrator(am.keeper) + if err := cfg.RegisterMigration(types.ModuleName, 1, m.Migrate1to2); err != nil { + panic(fmt.Errorf("failed to migrate x/%s from version 1 to 2: %w", types.ModuleName, err)) + } } // RegisterInvariants registers the invariants of the module. If an invariant deviates from its predicted value, the InvariantRegistry triggers appropriate logic (most often the chain will be halted)