diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 532962d547..13ed5524cd 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -398,6 +398,30 @@ jobs: run: | echo "continue" + e2e-stateful-data-test: + needs: + - check_branch + runs-on: buildjet-4vcpu-ubuntu-2204 + timeout-minutes: 120 + steps: + - name: "Checkout Code" + if: ${{ github.event.inputs.skip_checks != 'true' }} + uses: actions/checkout@v3 + + - name: Execute stateful-data-test + if: ${{ github.event.inputs.skip_checks != 'true' }} + shell: bash + run: | + make start-e2e-import-mainnet-test + container_id=$(docker ps --filter "ancestor=orchestrator:latest" --format "{{.ID}}") + docker logs -f "${container_id}" & exit $(docker wait "${container_id}") + + - name: Mark Job Complete Skipped + if: ${{ github.event.inputs.skip_checks == 'true' }} + shell: bash + run: | + echo "continue" + publish-release: if: ${{ github.event.inputs.skip_release == 'false' }} needs: @@ -411,6 +435,7 @@ jobs: - e2e-admin-tests - e2e-upgrade-test - check_branch + - e2e-stateful-data-test runs-on: buildjet-4vcpu-ubuntu-2004 timeout-minutes: 60 environment: release diff --git a/Makefile b/Makefile index 2cc2bf1d80..eb3b3954f8 100644 --- a/Makefile +++ b/Makefile @@ -206,10 +206,15 @@ start-e2e-admin-test: zetanode @echo "--> Starting e2e admin test" cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-admin.yml up -d +start-e2e-import-mainnet-test: zetanode + @echo "--> Starting e2e import-data test" + cd contrib/localnet/ && ./scripts/import-data.sh mainnet && $(DOCKER) compose -f docker-compose.yml -f docker-compose-import-data.yml up -d + start-e2e-performance-test: zetanode @echo "--> Starting e2e performance test" cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-performance.yml up -d + start-stress-test: zetanode @echo "--> Starting stress test" cd contrib/localnet/ && $(DOCKER) compose -f docker-compose.yml -f docker-compose-stresstest.yml up -d diff --git a/changelog.md b/changelog.md index 1e0fe694f1..108dbc3354 100644 --- a/changelog.md +++ b/changelog.md @@ -85,6 +85,7 @@ * [1992](https://github.com/zeta-chain/node/pull/1992) - remove setupKeeper from crosschain module * [2008](https://github.com/zeta-chain/node/pull/2008) - add test for connector bytecode update * [2060](https://github.com/zeta-chain/node/pull/2060) - add unit test for rate limiter query +* [2127](https://github.com/zeta-chain/node/pull/2127) - add import data to e2e test ### Fixes diff --git a/cmd/zetacored/parse_genesis.go b/cmd/zetacored/parse_genesis.go index d0529b64d8..0e45d3c33b 100644 --- a/cmd/zetacored/parse_genesis.go +++ b/cmd/zetacored/parse_genesis.go @@ -47,20 +47,30 @@ var Copy = map[string]bool{ upgradetypes.ModuleName: true, evidencetypes.ModuleName: true, vestingtypes.ModuleName: true, - fungibletypes.ModuleName: true, emissionstypes.ModuleName: true, - authz.ModuleName: true, } // Skip represents a set of modules for which, the entire state is skipped and nothing gets imported var Skip = map[string]bool{ - evmtypes.ModuleName: true, - stakingtypes.ModuleName: true, - genutiltypes.ModuleName: true, - authtypes.ModuleName: true, - banktypes.ModuleName: true, + // Skipping evm this is done to reduce the size of the genesis file evm module uses the majority of the space due to smart contract data + evmtypes.ModuleName: true, + // Skipping staking as new validators would be created for the new chain + stakingtypes.ModuleName: true, + // Skipping genutil as new gentxs would be created + genutiltypes.ModuleName: true, + // Skipping auth as new accounts would be created for the new chain. This also needs to be done as we are skipping evm module + authtypes.ModuleName: true, + // Skipping bank module as it is not used when starting a new chain this is done to make sure the total supply invariant is maintained. + // This would need modification but might be possible to add in non evm based modules in the future + banktypes.ModuleName: true, + // Skipping distribution module as it is not used when starting a new chain , rewards are based on validators and delegators , and so rewards from a different chain do not hold any value distributiontypes.ModuleName: true, - group.ModuleName: true, + // Skipping group module as it is not used when starting a new chain, new groups should be created based on the validator operator keys + group.ModuleName: true, + // Skipping authz as it is not used when starting a new chain, new grants should be created based on the validator hotkeys abd operator keys + authz.ModuleName: true, + // Skipping fungible module as new fungible tokens would be created and system contract would be deployed + fungibletypes.ModuleName: true, } // Modify represents a set of modules for which, the state is modified before importing. Each Module should have a corresponding Modify function @@ -140,7 +150,6 @@ func ImportDataIntoFile(genDoc *types.GenesisDoc, importFile *types.GenesisDoc, } } } - appStateJSON, err := json.Marshal(appState) if err != nil { return fmt.Errorf("failed to marshal application genesis state: %w", err) @@ -153,15 +162,18 @@ func ImportDataIntoFile(genDoc *types.GenesisDoc, importFile *types.GenesisDoc, // ModifyCrosschainState modifies the crosschain state before importing // It truncates the crosschain transactions, inbound transactions and finalized inbounds to MaxItemsForList func ModifyCrosschainState(appState map[string]json.RawMessage, importAppState map[string]json.RawMessage, cdc codec.Codec) error { - importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importAppState) - importedCrossChainGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(MaxItemsForList, len(importedCrossChainGenState.CrossChainTxs))] - importedCrossChainGenState.InTxHashToCctxList = importedCrossChainGenState.InTxHashToCctxList[:math.Min(MaxItemsForList, len(importedCrossChainGenState.InTxHashToCctxList))] - importedCrossChainGenState.FinalizedInbounds = importedCrossChainGenState.FinalizedInbounds[:math.Min(MaxItemsForList, len(importedCrossChainGenState.FinalizedInbounds))] - importedCrossChainStateBz, err := json.Marshal(importedCrossChainGenState) + importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppStateLegacy(cdc, importAppState) + appStateGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, appState) + // The genesis state has been modified between the two versions, so we add only the required fields and leave out the rest + // v16 adds the rate_limiter_flags and removes params from the genesis state + appStateGenState.CrossChainTxs = importedCrossChainGenState.CrossChainTxs[:math.Min(MaxItemsForList, len(importedCrossChainGenState.CrossChainTxs))] + appStateGenState.InTxHashToCctxList = importedCrossChainGenState.InTxHashToCctxList[:math.Min(MaxItemsForList, len(importedCrossChainGenState.InTxHashToCctxList))] + appStateGenState.FinalizedInbounds = importedCrossChainGenState.FinalizedInbounds[:math.Min(MaxItemsForList, len(importedCrossChainGenState.FinalizedInbounds))] + appStateBz, err := cdc.MarshalJSON(&appStateGenState) if err != nil { - return fmt.Errorf("failed to marshal zetacrosschain genesis state: %w", err) + return fmt.Errorf("failed to marshal crosschain genesis state: %w", err) } - appState[crosschaintypes.ModuleName] = importedCrossChainStateBz + appState[crosschaintypes.ModuleName] = appStateBz return nil } diff --git a/cmd/zetacored/parse_genesis_test.go b/cmd/zetacored/parse_genesis_test.go index 76a9e1247f..228100c3ac 100644 --- a/cmd/zetacored/parse_genesis_test.go +++ b/cmd/zetacored/parse_genesis_test.go @@ -153,10 +153,10 @@ func ImportGenDoc(t *testing.T, cdc *codec.ProtoCodec, n int) *types.GenesisDoc } func GetImportData(t *testing.T, cdc *codec.ProtoCodec, n int) map[string]json.RawMessage { - importData := sample.AppState(t) + importData := sample.AppStateLegacy(t) // Add crosschain data to genesis state - importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppState(cdc, importData) + importedCrossChainGenState := crosschaintypes.GetGenesisStateFromAppStateLegacy(cdc, importData) cctxList := make([]*crosschaintypes.CrossChainTx, n) intxHashToCctxList := make([]crosschaintypes.InTxHashToCctx, n) finalLizedInbounds := make([]string, n) diff --git a/contrib/localnet/docker-compose-import-data.yml b/contrib/localnet/docker-compose-import-data.yml new file mode 100644 index 0000000000..779ae68592 --- /dev/null +++ b/contrib/localnet/docker-compose-import-data.yml @@ -0,0 +1,145 @@ +version: "3" + +# This docker-compose file configures the localnet environment +# it contains the following services: +# - ZetaChain with 2 nodes (zetacore0, zetacore1) +# - A observer set with 2 clients (zetaclient0, zetaclient1) +# - An Ethereum node (eth) +# - A Bitcoin node (bitcoin) +# - A Rosetta API (rosetta) +# - An orchestrator to manage interaction with the localnet (orchestrator) + +networks: + mynetwork: + ipam: + config: + - subnet: 172.20.0.0/24 + +services: + rosetta: + image: zetanode:latest + container_name: rosetta + hostname: rosetta + ports: + - "8080:8080" + networks: + mynetwork: + ipv4_address: 172.20.0.200 + entrypoint: ["zetacored", "rosetta", "--tendermint", "zetacore0:26657", "--grpc", "zetacore0:9090", "--network", "athens_101-1", "--blockchain", "zetacore" ,"--retries", "500"] + + zetacore0: + image: zetanode:latest + container_name: zetacore0 + build: + context: .. + dockerfile: Dockerfile-localnet + hostname: zetacore0 + ports: + - "1317:1317" + - "9545:8545" + - "9546:8546" + - "26657:26657" + - "6060:6060" + - "9090:9090" + networks: + mynetwork: + ipv4_address: 172.20.0.11 + entrypoint: ["/root/start-zetacored.sh", "2","import-data"] + environment: + - HOTKEY_BACKEND=file + - HOTKEY_PASSWORD=password # test purposes only + volumes: + - ~/genesis_export/:/root/genesis_data + + zetacore1: + image: zetanode:latest + container_name: zetacore1 + build: + context: .. + dockerfile: Dockerfile-localnet + hostname: zetacore1 + networks: + mynetwork: + ipv4_address: 172.20.0.12 + entrypoint: ["/root/start-zetacored.sh", "2","import-data"] + environment: + - HOTKEY_BACKEND=file + - HOTKEY_PASSWORD=password # test purposes only + + + zetaclient0: + image: zetanode:latest + container_name: zetaclient0 + build: + context: .. + dockerfile: Dockerfile-localnet + hostname: zetaclient0 + networks: + mynetwork: + ipv4_address: 172.20.0.21 + entrypoint: ["/root/start-zetaclientd.sh", "import-data"] + environment: + - ETHDEV_ENDPOINT=http://eth:8545 + - HOTKEY_BACKEND=file + - HOTKEY_PASSWORD=password # test purposes only + + zetaclient1: + image: zetanode:latest + container_name: zetaclient1 + build: + context: .. + dockerfile: Dockerfile-localnet + hostname: zetaclient1 + networks: + mynetwork: + ipv4_address: 172.20.0.22 + entrypoint: ["/root/start-zetaclientd.sh", "import-data"] + environment: + - ETHDEV_ENDPOINT=http://eth:8545 + - HOTKEY_BACKEND=file + - HOTKEY_PASSWORD=password # test purposes only + + eth: + image: ethereum/client-go:v1.10.26 + container_name: eth + hostname: eth + ports: + - "8545:8545" + networks: + mynetwork: + ipv4_address: 172.20.0.100 + entrypoint: ["geth", "--dev", "--http", "--http.addr", "172.20.0.100", "--http.vhosts", "*", "--http.api", "eth,web3,net", "--http.corsdomain", "https://remix.ethereum.org", "--dev.period", "2"] + + bitcoin: + image: ruimarinho/bitcoin-core:22 # version 23 is not working with btcd 0.22.0 due to change in createwallet rpc + container_name: bitcoin + hostname: bitcoin + networks: + mynetwork: + ipv4_address: 172.20.0.101 + ports: + - "18443:18443" + command: + -printtoconsole + -regtest=1 + -rpcallowip=0.0.0.0/0 + -rpcbind=0.0.0.0 + -rpcauth=smoketest:63acf9b8dccecce914d85ff8c044b78b$$5892f9bbc84f4364e79f0970039f88bdd823f168d4acc76099ab97b14a766a99 + -txindex=1 + + orchestrator: + image: orchestrator:latest + tty: true + container_name: orchestrator + build: + context: .. + dockerfile: contrib/localnet/orchestrator/Dockerfile + depends_on: + - zetacore0 + - eth + hostname: orchestrator + networks: + mynetwork: + ipv4_address: 172.20.0.2 + entrypoint: ["/work/start-zetae2e.sh", "local","import-data"] + diff --git a/contrib/localnet/docker-compose.yml b/contrib/localnet/docker-compose.yml index 52ce7d2124..17a9583cbe 100644 --- a/contrib/localnet/docker-compose.yml +++ b/contrib/localnet/docker-compose.yml @@ -64,6 +64,7 @@ services: - HOTKEY_BACKEND=file - HOTKEY_PASSWORD=password # test purposes only + zetaclient0: image: zetanode:latest container_name: zetaclient0 diff --git a/contrib/localnet/orchestrator/start-zetae2e.sh b/contrib/localnet/orchestrator/start-zetae2e.sh index 9d630950b7..ff1aab5349 100644 --- a/contrib/localnet/orchestrator/start-zetae2e.sh +++ b/contrib/localnet/orchestrator/start-zetae2e.sh @@ -9,7 +9,13 @@ ZETAE2E_CMD=$1 OPTION=$2 echo "waiting for geth RPC to start..." -sleep 2 +# pause nodes other than zetacore0 to wait for zetacore0 to create genesis.json +# additional pause time is needed for importing data into the genesis as the export file is read into memory + if [ "$OPTION" != "import-data" ]; then + sleep 2 + else + sleep 520 + fi ### Create the accounts and fund them with Ether on local Ethereum network diff --git a/contrib/localnet/scripts/import-data.sh b/contrib/localnet/scripts/import-data.sh new file mode 100755 index 0000000000..d71d5c3656 --- /dev/null +++ b/contrib/localnet/scripts/import-data.sh @@ -0,0 +1,15 @@ +#!/bin/bash +if [ $# -lt 1 ] +then + echo "Usage: import-data.sh [network]" + exit 1 +fi + +NETWORK=$1 +echo "NETWORK: ${NETWORK}" +rm -rf ~/genesis_export/ +mkdir ~/genesis_export/ +echo "Download Latest State Export" +LATEST_EXPORT_URL=$(curl https://snapshots.zetachain.com/latest-state-export | jq -r ."${NETWORK}") +echo "LATEST EXPORT URL: ${LATEST_EXPORT_URL}" +wget -q ${LATEST_EXPORT_URL} -O ~/genesis_export/exported-genesis.json \ No newline at end of file diff --git a/contrib/localnet/scripts/start-zetaclientd.sh b/contrib/localnet/scripts/start-zetaclientd.sh index 89c691d52b..7b83b84651 100755 --- a/contrib/localnet/scripts/start-zetaclientd.sh +++ b/contrib/localnet/scripts/start-zetaclientd.sh @@ -25,7 +25,14 @@ num=$(echo $HOSTNAME | tr -dc '0-9') node="zetacore$num" echo "Wait for zetacore to exchange genesis file" -sleep 40 +# pause nodes other than zetacore0 to wait for zetacore0 to create genesis.json +# additional pause time is needed for importing data into the genesis as the export file is read into memory +if [ "$OPTION" != "import-data" ]; then + sleep 40 +else + sleep 510 +fi + operator=$(cat $HOME/.zetacored/os.json | jq '.ObserverAddress' ) operatorAddress=$(echo "$operator" | tr -d '"') echo "operatorAddress: $operatorAddress" diff --git a/contrib/localnet/scripts/start-zetacored.sh b/contrib/localnet/scripts/start-zetacored.sh index d28f6ae446..863bdd695d 100755 --- a/contrib/localnet/scripts/start-zetacored.sh +++ b/contrib/localnet/scripts/start-zetacored.sh @@ -69,8 +69,15 @@ source ~/add-keys.sh # Pause other nodes so that the primary can node can do the genesis creation if [ $HOSTNAME != "zetacore0" ] then +# pause nodes other than zetacore0 to wait for zetacore0 to create genesis.json +# additional pause time is needed for importing data into the genesis as the export file is read into memory + echo "Waiting for zetacore0 to create genesis.json" - sleep 10 + if [ "$OPTION" != "import-data" ]; then + sleep 10 + else + sleep 500 + fi echo "genesis.json created" fi @@ -155,9 +162,17 @@ then # 4. Collect all the gentx files in zetacore0 and create the final genesis.json zetacored collect-gentxs + + if [ "$OPTION" == "import-data" ]; then + echo "Importing data" + zetacored parse-genesis-file /root/genesis_data/exported-genesis.json + fi + zetacored validate-genesis + # 5. Copy the final genesis.json to all the nodes for NODE in "${NODELIST[@]}"; do + echo "Copying genesis.json to $NODE" ssh $NODE rm -rf ~/.zetacored/genesis.json scp ~/.zetacored/config/genesis.json $NODE:~/.zetacored/config/genesis.json done diff --git a/proto/crosschain/genesis.proto b/proto/crosschain/genesis.proto index 9213a128a5..680af45740 100644 --- a/proto/crosschain/genesis.proto +++ b/proto/crosschain/genesis.proto @@ -12,7 +12,7 @@ import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; -// GenesisState defines the metacore module's genesis state. +// GenesisState defines the crosschain modules genesis state. message GenesisState { repeated OutTxTracker outTxTrackerList = 2 [(gogoproto.nullable) = false]; repeated GasPrice gasPriceList = 5; @@ -24,3 +24,21 @@ message GenesisState { repeated string FinalizedInbounds = 16; RateLimiterFlags rate_limiter_flags = 17 [(gogoproto.nullable) = false]; } + +// Remove legacy types +// https://github.com/zeta-chain/node/issues/2139 +message GenesisState_legacy { + Params params = 1; + repeated OutTxTracker outTxTrackerList = 2 [(gogoproto.nullable) = false]; + repeated GasPrice gasPriceList = 5; + repeated CrossChainTx CrossChainTxs = 7; + repeated LastBlockHeight lastBlockHeightList = 8; + repeated InTxHashToCctx inTxHashToCctxList = 9 [(gogoproto.nullable) = false]; + repeated InTxTracker in_tx_tracker_list = 11 [(gogoproto.nullable) = false]; + ZetaAccounting zeta_accounting = 12 [(gogoproto.nullable) = false]; + repeated string FinalizedInbounds = 16; +} + +message Params { + bool enabled = 1; +} diff --git a/proto/fungible/genesis.proto b/proto/fungible/genesis.proto index d630ff482f..8aff353b75 100644 --- a/proto/fungible/genesis.proto +++ b/proto/fungible/genesis.proto @@ -12,3 +12,11 @@ message GenesisState { repeated ForeignCoins foreignCoinsList = 2 [(gogoproto.nullable) = false]; SystemContract systemContract = 3; } + +message GenesisState_legacy { + Params params = 1 [(gogoproto.nullable) = false]; + repeated ForeignCoins foreignCoinsList = 2 [(gogoproto.nullable) = false]; + SystemContract systemContract = 3; +} + +message Params {} diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 7dae4b7dd2..bd0c8cf6e9 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -110,6 +110,12 @@ func AppState(t *testing.T) map[string]json.RawMessage { return appState } +func AppStateLegacy(t *testing.T) map[string]json.RawMessage { + appState, err := genutiltypes.GenesisStateFromGenDoc(*GenDocLegacy(t)) + require.NoError(t, err) + return appState +} + func GenDoc(t *testing.T) *types.GenesisDoc { jsonBlob := []byte("{\n \"genesis_time\": \"2024-04-12T05:07:56.004517Z\",\n \"chain_id\": \"localnet_101-1\",\n \"initial_height\": \"1\",\n \"consensus_params\": {\n \"block\": {\n \"max_bytes\": \"22020096\",\n \"max_gas\": \"10000000\",\n \"time_iota_ms\": \"1000\"\n },\n \"evidence\": {\n \"max_age_num_blocks\": \"100000\",\n \"max_age_duration\": \"172800000000000\",\n \"max_bytes\": \"1048576\"\n },\n \"validator\": {\n \"pub_key_types\": [\n \"ed25519\"\n ]\n },\n \"version\": {}\n },\n \"app_hash\": \"\",\n \"app_state\": {\n \"auth\": {\n \"params\": {\n \"max_memo_characters\": \"256\",\n \"tx_sig_limit\": \"7\",\n \"tx_size_cost_per_byte\": \"10\",\n \"sig_verify_cost_ed25519\": \"590\",\n \"sig_verify_cost_secp256k1\": \"1000\"\n },\n \"accounts\": [\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n }\n ]\n },\n \"authority\": {\n \"policies\": {\n \"items\": [\n {\n \"policy_type\": \"groupEmergency\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": \"groupOperational\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": \"groupAdmin\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n }\n ]\n }\n },\n \"authz\": {\n \"authorization\": [\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddToOutTxTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddToOutTxTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n }\n ]\n },\n \"bank\": {\n \"params\": {\n \"send_enabled\": [],\n \"default_send_enabled\": true\n },\n \"balances\": [\n {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n }\n ],\n \"supply\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"8402000000000000000000000\"\n }\n ],\n \"denom_metadata\": []\n },\n \"crisis\": {\n \"constant_fee\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000\"\n }\n },\n \"crosschain\": {\n \"outTxTrackerList\": [],\n \"inTxHashToCctxList\": [],\n \"in_tx_tracker_list\": [],\n \"zeta_accounting\": {\n \"aborted_zeta_amount\": \"0\"\n }\n },\n \"distribution\": {\n \"params\": {\n \"community_tax\": \"0.020000000000000000\",\n \"base_proposer_reward\": \"0.010000000000000000\",\n \"bonus_proposer_reward\": \"0.040000000000000000\",\n \"withdraw_addr_enabled\": true\n },\n \"fee_pool\": {\n \"community_pool\": []\n },\n \"delegator_withdraw_infos\": [],\n \"previous_proposer\": \"\",\n \"outstanding_rewards\": [],\n \"validator_accumulated_commissions\": [],\n \"validator_historical_rewards\": [],\n \"validator_current_rewards\": [],\n \"delegator_starting_infos\": [],\n \"validator_slash_events\": []\n },\n \"emissions\": {\n \"params\": {\n \"max_bond_factor\": \"1.25\",\n \"min_bond_factor\": \"0.75\",\n \"avg_block_time\": \"6.00\",\n \"target_bond_ratio\": \"00.67\",\n \"validator_emission_percentage\": \"00.50\",\n \"observer_emission_percentage\": \"00.25\",\n \"tss_signer_emission_percentage\": \"00.25\",\n \"duration_factor_constant\": \"0.001877876953694702\",\n \"observer_slash_amount\": \"0\"\n },\n \"withdrawableEmissions\": []\n },\n \"evidence\": {\n \"evidence\": []\n },\n \"evm\": {\n \"accounts\": [],\n \"params\": {\n \"evm_denom\": \"azeta\",\n \"enable_create\": true,\n \"enable_call\": true,\n \"extra_eips\": [],\n \"chain_config\": {\n \"homestead_block\": \"0\",\n \"dao_fork_block\": \"0\",\n \"dao_fork_support\": true,\n \"eip150_block\": \"0\",\n \"eip150_hash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n \"eip155_block\": \"0\",\n \"eip158_block\": \"0\",\n \"byzantium_block\": \"0\",\n \"constantinople_block\": \"0\",\n \"petersburg_block\": \"0\",\n \"istanbul_block\": \"0\",\n \"muir_glacier_block\": \"0\",\n \"berlin_block\": \"0\",\n \"london_block\": \"0\",\n \"arrow_glacier_block\": \"0\",\n \"gray_glacier_block\": \"0\",\n \"merge_netsplit_block\": \"0\",\n \"shanghai_block\": \"0\",\n \"cancun_block\": \"0\"\n },\n \"allow_unprotected_txs\": false\n }\n },\n \"feemarket\": {\n \"params\": {\n \"no_base_fee\": false,\n \"base_fee_change_denominator\": 8,\n \"elasticity_multiplier\": 2,\n \"enable_height\": \"0\",\n \"base_fee\": \"1000000000\",\n \"min_gas_price\": \"0.000000000000000000\",\n \"min_gas_multiplier\": \"0.500000000000000000\"\n },\n \"block_gas\": \"0\"\n },\n \"fungible\": {\n \"params\": {},\n \"foreignCoinsList\": [],\n \"systemContract\": null\n },\n \"genutil\": {\n \"gen_txs\": [\n {\n \"body\": {\n \"messages\": [\n {\n \"@type\": \"/cosmos.staking.v1beta1.MsgCreateValidator\",\n \"description\": {\n \"moniker\": \"Zetanode-Localnet\",\n \"identity\": \"\",\n \"website\": \"\",\n \"security_contact\": \"\",\n \"details\": \"\"\n },\n \"commission\": {\n \"rate\": \"0.100000000000000000\",\n \"max_rate\": \"0.200000000000000000\",\n \"max_change_rate\": \"0.010000000000000000\"\n },\n \"min_self_delegation\": \"1\",\n \"delegator_address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"validator_address\": \"zetavaloper13c7p3xrhd6q2rx3h235jpt8pjdwvacyw7tkass\",\n \"pubkey\": {\n \"@type\": \"/cosmos.crypto.ed25519.PubKey\",\n \"key\": \"sBSs5r1vQn1idTp4uRTbdUK0jjmEscI3pn88LUXI4CQ=\"\n },\n \"value\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n }\n ],\n \"memo\": \"1db4f4185e68c1c17d508294de2592616dad37a5@192.168.2.12:26656\",\n \"timeout_height\": \"0\",\n \"extension_options\": [],\n \"non_critical_extension_options\": []\n },\n \"auth_info\": {\n \"signer_infos\": [\n {\n \"public_key\": {\n \"@type\": \"/cosmos.crypto.secp256k1.PubKey\",\n \"key\": \"A05F6QuFVpb/5KrIPvlHr209ZsD22gW0omhLSXWAtQrh\"\n },\n \"mode_info\": {\n \"single\": {\n \"mode\": \"SIGN_MODE_DIRECT\"\n }\n },\n \"sequence\": \"0\"\n }\n ],\n \"fee\": {\n \"amount\": [],\n \"gas_limit\": \"200000\",\n \"payer\": \"\",\n \"granter\": \"\"\n },\n \"tip\": null\n },\n \"signatures\": [\n \"y5YROwZmV0jcgv5BgRJCDE+Kq5OsX8+88or1ogekPLBw3ecPt8GsCeEbPQ24JONLzNwQEIUDNYTeSQnXnCfzyg==\"\n ]\n }\n ]\n },\n \"gov\": {\n \"starting_proposal_id\": \"1\",\n \"deposits\": [],\n \"votes\": [],\n \"proposals\": [],\n \"deposit_params\": {\n \"min_deposit\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"10000000\"\n }\n ],\n \"max_deposit_period\": \"172800s\"\n },\n \"voting_params\": {\n \"voting_period\": \"10s\"\n },\n \"tally_params\": {\n \"quorum\": \"0.334000000000000000\",\n \"threshold\": \"0.500000000000000000\",\n \"veto_threshold\": \"0.334000000000000000\"\n }\n },\n \"group\": {\n \"group_seq\": \"0\",\n \"groups\": [],\n \"group_members\": [],\n \"group_policy_seq\": \"0\",\n \"group_policies\": [],\n \"proposal_seq\": \"0\",\n \"proposals\": [],\n \"votes\": []\n },\n \"mint\": {\n \"params\": {\n \"mint_denom\": \"azeta\"\n }\n },\n \"observer\": {\n \"observers\": {\n \"observer_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"nodeAccountList\": [\n {\n \"operator\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"granteeAddress\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\"\n },\n \"nodeStatus\": 4\n },\n {\n \"operator\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"granteeAddress\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n },\n \"nodeStatus\": 4\n }\n ],\n \"crosschain_flags\": {\n \"isInboundEnabled\": true,\n \"isOutboundEnabled\": true\n },\n \"params\": {\n \"observer_params\": [\n {\n \"chain\": {\n \"chain_name\": 2,\n \"chain_id\": 101\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n },\n {\n \"chain\": {\n \"chain_name\": 15,\n \"chain_id\": 18444\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n },\n {\n \"chain\": {\n \"chain_name\": 14,\n \"chain_id\": 1337\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n }\n ],\n \"admin_policy\": [\n {\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": 1,\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n }\n ],\n \"ballot_maturity_blocks\": 100\n },\n \"keygen\": {\n \"status\": 1,\n \"granteePubkeys\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ]\n },\n \"chain_params_list\": {},\n \"tss\": {\n \"tss_pubkey\": \"zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p\",\n \"tss_participant_list\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ],\n \"operator_address_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"tss_history\": [],\n \"tss_fund_migrators\": [],\n \"blame_list\": [],\n \"pending_nonces\": [],\n \"chain_nonces\": [],\n \"nonce_to_cctx\": []\n },\n \"params\": null,\n \"slashing\": {\n \"params\": {\n \"signed_blocks_window\": \"100\",\n \"min_signed_per_window\": \"0.500000000000000000\",\n \"downtime_jail_duration\": \"600s\",\n \"slash_fraction_double_sign\": \"0.050000000000000000\",\n \"slash_fraction_downtime\": \"0.010000000000000000\"\n },\n \"signing_infos\": [],\n \"missed_blocks\": []\n },\n \"staking\": {\n \"params\": {\n \"unbonding_time\": \"1814400s\",\n \"max_validators\": 100,\n \"max_entries\": 7,\n \"historical_entries\": 10000,\n \"bond_denom\": \"azeta\",\n \"min_commission_rate\": \"0.000000000000000000\"\n },\n \"last_total_power\": \"0\",\n \"last_validator_powers\": [],\n \"validators\": [],\n \"delegations\": [],\n \"unbonding_delegations\": [],\n \"redelegations\": [],\n \"exported\": false\n },\n \"upgrade\": {},\n \"vesting\": {}\n }\n}") genDoc, err := types.GenesisDocFromJSON(jsonBlob) @@ -117,6 +123,13 @@ func GenDoc(t *testing.T) *types.GenesisDoc { return genDoc } +func GenDocLegacy(t *testing.T) *types.GenesisDoc { + jsonBlob := []byte("{\n \"genesis_time\": \"2024-05-07T05:17:13.03705Z\",\n \"chain_id\": \"localnet_101-1\",\n \"initial_height\": \"1\",\n \"consensus_params\": {\n \"block\": {\n \"max_bytes\": \"22020096\",\n \"max_gas\": \"100000000\",\n \"time_iota_ms\": \"1000\"\n },\n \"evidence\": {\n \"max_age_num_blocks\": \"100000\",\n \"max_age_duration\": \"172800000000000\",\n \"max_bytes\": \"1048576\"\n },\n \"validator\": {\n \"pub_key_types\": [\n \"ed25519\"\n ]\n },\n \"version\": {}\n },\n \"app_hash\": \"\",\n \"app_state\": {\n \"auth\": {\n \"params\": {\n \"max_memo_characters\": \"256\",\n \"tx_sig_limit\": \"7\",\n \"tx_size_cost_per_byte\": \"10\",\n \"sig_verify_cost_ed25519\": \"590\",\n \"sig_verify_cost_secp256k1\": \"1000\"\n },\n \"accounts\": [\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n }\n ]\n },\n \"authz\": {\n \"authorization\": [\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddToOutTxTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedInboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOnObservedOutboundTx\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddToOutTxTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n }\n ]\n },\n \"bank\": {\n \"params\": {\n \"send_enabled\": [],\n \"default_send_enabled\": true\n },\n \"balances\": [\n {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n }\n ],\n \"supply\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"8402000000000000000000000\"\n }\n ],\n \"denom_metadata\": []\n },\n \"crisis\": {\n \"constant_fee\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000\"\n }\n },\n \"crosschain\": {\n \"params\": {},\n \"outTxTrackerList\": [],\n \"inTxHashToCctxList\": [],\n \"in_tx_tracker_list\": [],\n \"zeta_accounting\": {\n \"aborted_zeta_amount\": \"0\"\n }\n },\n \"distribution\": {\n \"params\": {\n \"community_tax\": \"0.020000000000000000\",\n \"base_proposer_reward\": \"0.010000000000000000\",\n \"bonus_proposer_reward\": \"0.040000000000000000\",\n \"withdraw_addr_enabled\": true\n },\n \"fee_pool\": {\n \"community_pool\": []\n },\n \"delegator_withdraw_infos\": [],\n \"previous_proposer\": \"\",\n \"outstanding_rewards\": [],\n \"validator_accumulated_commissions\": [],\n \"validator_historical_rewards\": [],\n \"validator_current_rewards\": [],\n \"delegator_starting_infos\": [],\n \"validator_slash_events\": []\n },\n \"emissions\": {\n \"params\": {\n \"max_bond_factor\": \"1.25\",\n \"min_bond_factor\": \"0.75\",\n \"avg_block_time\": \"6.00\",\n \"target_bond_ratio\": \"00.67\",\n \"validator_emission_percentage\": \"00.50\",\n \"observer_emission_percentage\": \"00.25\",\n \"tss_signer_emission_percentage\": \"00.25\",\n \"duration_factor_constant\": \"0.001877876953694702\",\n \"observer_slash_amount\": \"100000000000000000\"\n },\n \"withdrawableEmissions\": []\n },\n \"evidence\": {\n \"evidence\": []\n },\n \"evm\": {\n \"accounts\": [],\n \"params\": {\n \"evm_denom\": \"azeta\",\n \"enable_create\": true,\n \"enable_call\": true,\n \"extra_eips\": [],\n \"chain_config\": {\n \"homestead_block\": \"0\",\n \"dao_fork_block\": \"0\",\n \"dao_fork_support\": true,\n \"eip150_block\": \"0\",\n \"eip150_hash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n \"eip155_block\": \"0\",\n \"eip158_block\": \"0\",\n \"byzantium_block\": \"0\",\n \"constantinople_block\": \"0\",\n \"petersburg_block\": \"0\",\n \"istanbul_block\": \"0\",\n \"muir_glacier_block\": \"0\",\n \"berlin_block\": \"0\",\n \"london_block\": \"0\",\n \"arrow_glacier_block\": \"0\",\n \"gray_glacier_block\": \"0\",\n \"merge_netsplit_block\": \"0\",\n \"shanghai_block\": \"0\",\n \"cancun_block\": \"0\"\n },\n \"allow_unprotected_txs\": false\n }\n },\n \"feemarket\": {\n \"params\": {\n \"no_base_fee\": false,\n \"base_fee_change_denominator\": 8,\n \"elasticity_multiplier\": 2,\n \"enable_height\": \"0\",\n \"base_fee\": \"1000000000\",\n \"min_gas_price\": \"0.000000000000000000\",\n \"min_gas_multiplier\": \"0.500000000000000000\"\n },\n \"block_gas\": \"0\"\n },\n \"fungible\": {\n \"params\": {},\n \"foreignCoinsList\": [],\n \"systemContract\": null\n },\n \"genutil\": {\n \"gen_txs\": [\n {\n \"body\": {\n \"messages\": [\n {\n \"@type\": \"/cosmos.staking.v1beta1.MsgCreateValidator\",\n \"description\": {\n \"moniker\": \"Zetanode-Localnet\",\n \"identity\": \"\",\n \"website\": \"\",\n \"security_contact\": \"\",\n \"details\": \"\"\n },\n \"commission\": {\n \"rate\": \"0.100000000000000000\",\n \"max_rate\": \"0.200000000000000000\",\n \"max_change_rate\": \"0.010000000000000000\"\n },\n \"min_self_delegation\": \"1\",\n \"delegator_address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"validator_address\": \"zetavaloper13c7p3xrhd6q2rx3h235jpt8pjdwvacyw7tkass\",\n \"pubkey\": {\n \"@type\": \"/cosmos.crypto.ed25519.PubKey\",\n \"key\": \"bDy0AR7qdTbNDM9slpmVwkjRJOxV7sxTE5RzSKYXtMY=\"\n },\n \"value\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n }\n ],\n \"memo\": \"9e9ab1be38470032f8a58fdbd66ed446a14d40bc@192.168.2.12:26656\",\n \"timeout_height\": \"0\",\n \"extension_options\": [],\n \"non_critical_extension_options\": []\n },\n \"auth_info\": {\n \"signer_infos\": [\n {\n \"public_key\": {\n \"@type\": \"/cosmos.crypto.secp256k1.PubKey\",\n \"key\": \"A05F6QuFVpb/5KrIPvlHr209ZsD22gW0omhLSXWAtQrh\"\n },\n \"mode_info\": {\n \"single\": {\n \"mode\": \"SIGN_MODE_DIRECT\"\n }\n },\n \"sequence\": \"0\"\n }\n ],\n \"fee\": {\n \"amount\": [],\n \"gas_limit\": \"200000\",\n \"payer\": \"\",\n \"granter\": \"\"\n },\n \"tip\": null\n },\n \"signatures\": [\n \"ihZDHnOu6hkXA2TrGEaJIg+kzeKfys/3o6pC+GCv7uxudY40tZuCRDY+3vwmQ/TabuGRka0bJKa2dUBSw+JuJg==\"\n ]\n }\n ]\n },\n \"gov\": {\n \"starting_proposal_id\": \"1\",\n \"deposits\": [],\n \"votes\": [],\n \"proposals\": [],\n \"deposit_params\": {\n \"min_deposit\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"10000000\"\n }\n ],\n \"max_deposit_period\": \"172800s\"\n },\n \"voting_params\": {\n \"voting_period\": \"10s\"\n },\n \"tally_params\": {\n \"quorum\": \"0.334000000000000000\",\n \"threshold\": \"0.500000000000000000\",\n \"veto_threshold\": \"0.334000000000000000\"\n }\n },\n \"group\": {\n \"group_seq\": \"0\",\n \"groups\": [],\n \"group_members\": [],\n \"group_policy_seq\": \"0\",\n \"group_policies\": [],\n \"proposal_seq\": \"0\",\n \"proposals\": [],\n \"votes\": []\n },\n \"mint\": {\n \"params\": {\n \"mint_denom\": \"azeta\"\n }\n },\n \"observer\": {\n \"observers\": {\n \"observer_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"nodeAccountList\": [\n {\n \"operator\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"granteeAddress\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\"\n },\n \"nodeStatus\": 4\n },\n {\n \"operator\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"granteeAddress\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n },\n \"nodeStatus\": 4\n }\n ],\n \"crosschain_flags\": {\n \"isInboundEnabled\": true,\n \"isOutboundEnabled\": true\n },\n \"params\": {\n \"observer_params\": [\n {\n \"chain\": {\n \"chain_name\": 2,\n \"chain_id\": 101\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n },\n {\n \"chain\": {\n \"chain_name\": 15,\n \"chain_id\": 18444\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n },\n {\n \"chain\": {\n \"chain_name\": 14,\n \"chain_id\": 1337\n },\n \"ballot_threshold\": \"0.660000000000000000\",\n \"min_observer_delegation\": \"1000000000000000000000.000000000000000000\",\n \"is_supported\": true\n }\n ],\n \"admin_policy\": [\n {\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": 1,\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n }\n ],\n \"ballot_maturity_blocks\": 100\n },\n \"keygen\": {\n \"status\": 1,\n \"granteePubkeys\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ]\n },\n \"chain_params_list\": {},\n \"tss\": {\n \"tss_pubkey\": \"zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p\",\n \"tss_participant_list\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ],\n \"operator_address_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"tss_history\": [],\n \"tss_fund_migrators\": [],\n \"blame_list\": [],\n \"pending_nonces\": [],\n \"chain_nonces\": [],\n \"nonce_to_cctx\": []\n },\n \"params\": null,\n \"slashing\": {\n \"params\": {\n \"signed_blocks_window\": \"100\",\n \"min_signed_per_window\": \"0.500000000000000000\",\n \"downtime_jail_duration\": \"600s\",\n \"slash_fraction_double_sign\": \"0.050000000000000000\",\n \"slash_fraction_downtime\": \"0.010000000000000000\"\n },\n \"signing_infos\": [],\n \"missed_blocks\": []\n },\n \"staking\": {\n \"params\": {\n \"unbonding_time\": \"1814400s\",\n \"max_validators\": 100,\n \"max_entries\": 7,\n \"historical_entries\": 10000,\n \"bond_denom\": \"azeta\",\n \"min_commission_rate\": \"0.000000000000000000\"\n },\n \"last_total_power\": \"0\",\n \"last_validator_powers\": [],\n \"validators\": [],\n \"delegations\": [],\n \"unbonding_delegations\": [],\n \"redelegations\": [],\n \"exported\": false\n },\n \"upgrade\": {},\n \"vesting\": {}\n }\n}") + genDoc, err := types.GenesisDocFromJSON(jsonBlob) + require.NoError(t, err) + return genDoc +} + func Chain(chainID int64) *chains.Chain { r := newRandFromSeed(chainID) diff --git a/typescript/crosschain/genesis_pb.d.ts b/typescript/crosschain/genesis_pb.d.ts index 9ff48d6f47..74188cc8cc 100644 --- a/typescript/crosschain/genesis_pb.d.ts +++ b/typescript/crosschain/genesis_pb.d.ts @@ -79,3 +79,93 @@ export declare class GenesisState extends Message { static equals(a: GenesisState | PlainMessage | undefined, b: GenesisState | PlainMessage | undefined): boolean; } +/** + * GenesisState defines the metacore module's genesis state. + * + * @generated from message zetachain.zetacore.crosschain.GenesisState_legacy + */ +export declare class GenesisState_legacy extends Message { + /** + * @generated from field: zetachain.zetacore.crosschain.Params params = 1; + */ + params?: Params; + + /** + * @generated from field: repeated zetachain.zetacore.crosschain.OutTxTracker outTxTrackerList = 2; + */ + outTxTrackerList: OutTxTracker[]; + + /** + * @generated from field: repeated zetachain.zetacore.crosschain.GasPrice gasPriceList = 5; + */ + gasPriceList: GasPrice[]; + + /** + * @generated from field: repeated zetachain.zetacore.crosschain.CrossChainTx CrossChainTxs = 7; + */ + CrossChainTxs: CrossChainTx[]; + + /** + * @generated from field: repeated zetachain.zetacore.crosschain.LastBlockHeight lastBlockHeightList = 8; + */ + lastBlockHeightList: LastBlockHeight[]; + + /** + * @generated from field: repeated zetachain.zetacore.crosschain.InTxHashToCctx inTxHashToCctxList = 9; + */ + inTxHashToCctxList: InTxHashToCctx[]; + + /** + * @generated from field: repeated zetachain.zetacore.crosschain.InTxTracker in_tx_tracker_list = 11; + */ + inTxTrackerList: InTxTracker[]; + + /** + * @generated from field: zetachain.zetacore.crosschain.ZetaAccounting zeta_accounting = 12; + */ + zetaAccounting?: ZetaAccounting; + + /** + * @generated from field: repeated string FinalizedInbounds = 16; + */ + FinalizedInbounds: string[]; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.crosschain.GenesisState_legacy"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GenesisState_legacy; + + static fromJson(jsonValue: JsonValue, options?: Partial): GenesisState_legacy; + + static fromJsonString(jsonString: string, options?: Partial): GenesisState_legacy; + + static equals(a: GenesisState_legacy | PlainMessage | undefined, b: GenesisState_legacy | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.crosschain.Params + */ +export declare class Params extends Message { + /** + * @generated from field: bool enabled = 1; + */ + enabled: boolean; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.crosschain.Params"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Params; + + static fromJson(jsonValue: JsonValue, options?: Partial): Params; + + static fromJsonString(jsonString: string, options?: Partial): Params; + + static equals(a: Params | PlainMessage | undefined, b: Params | PlainMessage | undefined): boolean; +} + diff --git a/typescript/fungible/genesis_pb.d.ts b/typescript/fungible/genesis_pb.d.ts index da2d610c10..02d8243ca4 100644 --- a/typescript/fungible/genesis_pb.d.ts +++ b/typescript/fungible/genesis_pb.d.ts @@ -39,3 +39,56 @@ export declare class GenesisState extends Message { static equals(a: GenesisState | PlainMessage | undefined, b: GenesisState | PlainMessage | undefined): boolean; } +/** + * @generated from message zetachain.zetacore.fungible.GenesisState_legacy + */ +export declare class GenesisState_legacy extends Message { + /** + * @generated from field: zetachain.zetacore.fungible.Params params = 1; + */ + params?: Params; + + /** + * @generated from field: repeated zetachain.zetacore.fungible.ForeignCoins foreignCoinsList = 2; + */ + foreignCoinsList: ForeignCoins[]; + + /** + * @generated from field: zetachain.zetacore.fungible.SystemContract systemContract = 3; + */ + systemContract?: SystemContract; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.fungible.GenesisState_legacy"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): GenesisState_legacy; + + static fromJson(jsonValue: JsonValue, options?: Partial): GenesisState_legacy; + + static fromJsonString(jsonString: string, options?: Partial): GenesisState_legacy; + + static equals(a: GenesisState_legacy | PlainMessage | undefined, b: GenesisState_legacy | PlainMessage | undefined): boolean; +} + +/** + * @generated from message zetachain.zetacore.fungible.Params + */ +export declare class Params extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.fungible.Params"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Params; + + static fromJson(jsonValue: JsonValue, options?: Partial): Params; + + static fromJsonString(jsonString: string, options?: Partial): Params; + + static equals(a: Params | PlainMessage | undefined, b: Params | PlainMessage | undefined): boolean; +} + diff --git a/x/crosschain/types/genesis.go b/x/crosschain/types/genesis.go index 834e4ddb9d..04e7d45f49 100644 --- a/x/crosschain/types/genesis.go +++ b/x/crosschain/types/genesis.go @@ -65,3 +65,14 @@ func GetGenesisStateFromAppState(marshaler codec.JSONCodec, appState map[string] } return genesisState } + +func GetGenesisStateFromAppStateLegacy(marshaler codec.JSONCodec, appState map[string]json.RawMessage) GenesisStateLegacy { + var genesisState GenesisStateLegacy + if appState[ModuleName] != nil { + err := marshaler.UnmarshalJSON(appState[ModuleName], &genesisState) + if err != nil { + panic(fmt.Sprintf("Failed to get genesis state from app state: %s", err.Error())) + } + } + return genesisState +} diff --git a/x/crosschain/types/genesis.pb.go b/x/crosschain/types/genesis.pb.go index 8045b2d098..e9d64c0aac 100644 --- a/x/crosschain/types/genesis.pb.go +++ b/x/crosschain/types/genesis.pb.go @@ -133,46 +133,205 @@ func (m *GenesisState) GetRateLimiterFlags() RateLimiterFlags { return RateLimiterFlags{} } +// GenesisState defines the metacore module's genesis state. +type GenesisStateLegacy struct { + Params *Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params,omitempty"` + OutTxTrackerList []OutTxTracker `protobuf:"bytes,2,rep,name=outTxTrackerList,proto3" json:"outTxTrackerList"` + GasPriceList []*GasPrice `protobuf:"bytes,5,rep,name=gasPriceList,proto3" json:"gasPriceList,omitempty"` + CrossChainTxs []*CrossChainTx `protobuf:"bytes,7,rep,name=CrossChainTxs,proto3" json:"CrossChainTxs,omitempty"` + LastBlockHeightList []*LastBlockHeight `protobuf:"bytes,8,rep,name=lastBlockHeightList,proto3" json:"lastBlockHeightList,omitempty"` + InTxHashToCctxList []InTxHashToCctx `protobuf:"bytes,9,rep,name=inTxHashToCctxList,proto3" json:"inTxHashToCctxList"` + InTxTrackerList []InTxTracker `protobuf:"bytes,11,rep,name=in_tx_tracker_list,json=inTxTrackerList,proto3" json:"in_tx_tracker_list"` + ZetaAccounting ZetaAccounting `protobuf:"bytes,12,opt,name=zeta_accounting,json=zetaAccounting,proto3" json:"zeta_accounting"` + FinalizedInbounds []string `protobuf:"bytes,16,rep,name=FinalizedInbounds,proto3" json:"FinalizedInbounds,omitempty"` +} + +func (m *GenesisStateLegacy) Reset() { *m = GenesisStateLegacy{} } +func (m *GenesisStateLegacy) String() string { return proto.CompactTextString(m) } +func (*GenesisStateLegacy) ProtoMessage() {} +func (*GenesisStateLegacy) Descriptor() ([]byte, []int) { + return fileDescriptor_dd51403692d571f4, []int{1} +} +func (m *GenesisStateLegacy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisStateLegacy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisStateLegacy.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 *GenesisStateLegacy) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisStateLegacy.Merge(m, src) +} +func (m *GenesisStateLegacy) XXX_Size() int { + return m.Size() +} +func (m *GenesisStateLegacy) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisStateLegacy.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisStateLegacy proto.InternalMessageInfo + +func (m *GenesisStateLegacy) GetParams() *Params { + if m != nil { + return m.Params + } + return nil +} + +func (m *GenesisStateLegacy) GetOutTxTrackerList() []OutTxTracker { + if m != nil { + return m.OutTxTrackerList + } + return nil +} + +func (m *GenesisStateLegacy) GetGasPriceList() []*GasPrice { + if m != nil { + return m.GasPriceList + } + return nil +} + +func (m *GenesisStateLegacy) GetCrossChainTxs() []*CrossChainTx { + if m != nil { + return m.CrossChainTxs + } + return nil +} + +func (m *GenesisStateLegacy) GetLastBlockHeightList() []*LastBlockHeight { + if m != nil { + return m.LastBlockHeightList + } + return nil +} + +func (m *GenesisStateLegacy) GetInTxHashToCctxList() []InTxHashToCctx { + if m != nil { + return m.InTxHashToCctxList + } + return nil +} + +func (m *GenesisStateLegacy) GetInTxTrackerList() []InTxTracker { + if m != nil { + return m.InTxTrackerList + } + return nil +} + +func (m *GenesisStateLegacy) GetZetaAccounting() ZetaAccounting { + if m != nil { + return m.ZetaAccounting + } + return ZetaAccounting{} +} + +func (m *GenesisStateLegacy) GetFinalizedInbounds() []string { + if m != nil { + return m.FinalizedInbounds + } + return nil +} + +type Params struct { + Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"` +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_dd51403692d571f4, []int{2} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + +func (m *Params) GetEnabled() bool { + if m != nil { + return m.Enabled + } + return false +} + func init() { proto.RegisterType((*GenesisState)(nil), "zetachain.zetacore.crosschain.GenesisState") + proto.RegisterType((*GenesisStateLegacy)(nil), "zetachain.zetacore.crosschain.GenesisState_legacy") + proto.RegisterType((*Params)(nil), "zetachain.zetacore.crosschain.Params") } func init() { proto.RegisterFile("crosschain/genesis.proto", fileDescriptor_dd51403692d571f4) } var fileDescriptor_dd51403692d571f4 = []byte{ - // 507 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x93, 0xdf, 0x6e, 0xd3, 0x30, - 0x14, 0xc6, 0x5b, 0x06, 0x83, 0x79, 0x85, 0x6d, 0x86, 0x8b, 0xa8, 0x12, 0x59, 0x35, 0x2e, 0x98, - 0x80, 0x25, 0x02, 0x9e, 0x80, 0x55, 0xda, 0x1f, 0xad, 0x12, 0x10, 0x7a, 0x35, 0x31, 0x19, 0xd7, - 0x33, 0x89, 0xb5, 0x2c, 0xae, 0xec, 0x13, 0x29, 0xf4, 0x29, 0x78, 0x08, 0x1e, 0x66, 0x97, 0xbb, - 0xe4, 0x0a, 0xa1, 0xf6, 0x45, 0x90, 0x9d, 0x6c, 0x38, 0xa4, 0xa2, 0xbd, 0x3b, 0xf2, 0x39, 0xdf, - 0xef, 0x3b, 0x3e, 0xc7, 0x46, 0x1e, 0x53, 0x52, 0x6b, 0x96, 0x50, 0x91, 0x85, 0x31, 0xcf, 0xb8, - 0x16, 0x3a, 0x18, 0x2b, 0x09, 0x12, 0x3f, 0x9d, 0x70, 0xa0, 0x36, 0x11, 0xd8, 0x48, 0x2a, 0x1e, - 0xfc, 0x2d, 0xee, 0x6e, 0x3b, 0x42, 0x1b, 0x12, 0x1b, 0x13, 0x28, 0x4a, 0x7d, 0xb7, 0xeb, 0x92, - 0xa9, 0x26, 0x63, 0x25, 0x18, 0xaf, 0x72, 0xcf, 0x9c, 0x9c, 0xd5, 0x90, 0x84, 0xea, 0x84, 0x80, - 0x24, 0x8c, 0xdd, 0x02, 0xfc, 0x46, 0x11, 0x28, 0xca, 0x2e, 0xb8, 0xaa, 0xf2, 0x3b, 0x4e, 0x3e, - 0xa5, 0x1a, 0xc8, 0x28, 0x95, 0xec, 0x82, 0x24, 0x5c, 0xc4, 0x09, 0x54, 0x35, 0x6e, 0x97, 0x32, - 0x87, 0x26, 0xc4, 0xed, 0x44, 0x51, 0xe0, 0x24, 0x15, 0x97, 0x02, 0xb8, 0x22, 0x5f, 0x53, 0x1a, - 0x57, 0xa3, 0xe8, 0x3e, 0x89, 0x65, 0x2c, 0x6d, 0x18, 0x9a, 0xa8, 0x3c, 0xdd, 0xf9, 0xb1, 0x8a, - 0x3a, 0x87, 0xe5, 0xc8, 0x3e, 0x01, 0x05, 0x8e, 0xcf, 0xd0, 0xa6, 0xcc, 0x61, 0x58, 0x0c, 0x4b, - 0x87, 0x81, 0xd0, 0xe0, 0xdd, 0xe9, 0xad, 0xec, 0xae, 0xbf, 0x79, 0x19, 0xfc, 0x77, 0x98, 0xc1, - 0x7b, 0x47, 0xb6, 0x7f, 0xf7, 0xea, 0xd7, 0x76, 0x2b, 0x6a, 0xa0, 0xf0, 0x09, 0xea, 0xc4, 0x54, - 0x7f, 0x30, 0x63, 0xb4, 0xe8, 0x7b, 0x16, 0xfd, 0x7c, 0x01, 0xfa, 0xb0, 0x92, 0x44, 0x35, 0x31, - 0xfe, 0x88, 0x1e, 0xf6, 0x4d, 0x51, 0xdf, 0x14, 0x0d, 0x0b, 0xed, 0xdd, 0x5f, 0xaa, 0x51, 0x57, - 0x13, 0xd5, 0x09, 0xf8, 0x0b, 0x7a, 0x6c, 0xd6, 0xb0, 0x6f, 0xb6, 0x70, 0x64, 0x97, 0x60, 0xdb, - 0x7c, 0x60, 0xc1, 0xc1, 0x02, 0xf0, 0xa0, 0xae, 0x8c, 0xe6, 0xa1, 0x30, 0x43, 0xd8, 0x58, 0x1d, - 0x51, 0x9d, 0x0c, 0x65, 0x9f, 0x41, 0x61, 0x0d, 0xd6, 0xac, 0xc1, 0xde, 0x02, 0x83, 0xe3, 0x9a, - 0xb0, 0x1a, 0xf2, 0x1c, 0x1c, 0x3e, 0x33, 0x26, 0xce, 0x43, 0x21, 0xa9, 0x31, 0x59, 0xb7, 0x26, - 0x2f, 0x96, 0x30, 0xa9, 0xaf, 0x71, 0x43, 0x64, 0xf5, 0x2d, 0x7e, 0x46, 0x1b, 0x46, 0x49, 0x28, - 0x63, 0x32, 0xcf, 0x40, 0x64, 0xb1, 0xd7, 0xe9, 0xb5, 0x97, 0xb8, 0xc0, 0x29, 0x07, 0xfa, 0xee, - 0x56, 0x54, 0xe1, 0x1f, 0x4d, 0x6a, 0xa7, 0xf8, 0x15, 0xda, 0x3a, 0x10, 0x19, 0x4d, 0xc5, 0x84, - 0x9f, 0x1f, 0x67, 0x23, 0x99, 0x67, 0xe7, 0xda, 0xdb, 0xec, 0xad, 0xec, 0xae, 0x45, 0xcd, 0x84, - 0x99, 0x67, 0xf3, 0xcd, 0x7b, 0x5b, 0xb6, 0x9d, 0x70, 0x41, 0x3b, 0x11, 0x05, 0x3e, 0x28, 0x75, - 0x07, 0x46, 0x76, 0xf3, 0x6c, 0xd5, 0xbf, 0xe7, 0x27, 0x57, 0x53, 0xbf, 0x7d, 0x3d, 0xf5, 0xdb, - 0xbf, 0xa7, 0x7e, 0xfb, 0xfb, 0xcc, 0x6f, 0x5d, 0xcf, 0xfc, 0xd6, 0xcf, 0x99, 0xdf, 0x3a, 0x7d, - 0x1d, 0x0b, 0x48, 0xf2, 0x51, 0xc0, 0xe4, 0x65, 0x68, 0x2c, 0xf6, 0xca, 0x6f, 0x78, 0xe3, 0x16, - 0x16, 0xa1, 0xf3, 0x39, 0xe1, 0xdb, 0x98, 0xeb, 0xd1, 0xaa, 0xfd, 0x7a, 0x6f, 0xff, 0x04, 0x00, - 0x00, 0xff, 0xff, 0x4d, 0xc1, 0xbb, 0x72, 0xb7, 0x04, 0x00, 0x00, + // 574 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xec, 0x55, 0xcf, 0x6f, 0xd3, 0x3e, + 0x14, 0x6f, 0xbf, 0xfb, 0xd2, 0x6d, 0x5e, 0x61, 0x9b, 0xc7, 0x21, 0xaa, 0x44, 0x56, 0x15, 0x21, + 0x26, 0x60, 0x89, 0x80, 0x33, 0x07, 0x5a, 0x69, 0x3f, 0xb4, 0x4a, 0x8c, 0xd0, 0xd3, 0xc4, 0x64, + 0x5c, 0xd7, 0x24, 0xd6, 0xd2, 0xb8, 0x8a, 0x5f, 0xa5, 0xae, 0x77, 0xee, 0xfc, 0x11, 0xfc, 0x31, + 0x3b, 0xee, 0xc8, 0x09, 0xa1, 0xf6, 0x1f, 0x41, 0x76, 0xd2, 0xe1, 0xd0, 0x89, 0xf6, 0x8a, 0xb4, + 0xdb, 0x8b, 0xdf, 0xfb, 0xfc, 0xc8, 0x7b, 0xcf, 0x32, 0x72, 0x58, 0x2a, 0x95, 0x62, 0x11, 0x15, + 0x89, 0x1f, 0xf2, 0x84, 0x2b, 0xa1, 0xbc, 0x41, 0x2a, 0x41, 0xe2, 0x47, 0x63, 0x0e, 0xd4, 0x24, + 0x3c, 0x13, 0xc9, 0x94, 0x7b, 0xbf, 0x8b, 0x6b, 0xbb, 0x16, 0xd0, 0x84, 0xc4, 0xc4, 0x04, 0x46, + 0x19, 0xbe, 0x56, 0xb3, 0x99, 0xa9, 0x22, 0x83, 0x54, 0x30, 0x9e, 0xe7, 0x1e, 0x5b, 0x39, 0x83, + 0x21, 0x11, 0x55, 0x11, 0x01, 0x49, 0x18, 0xbb, 0x21, 0x70, 0xe7, 0x8a, 0x20, 0xa5, 0xec, 0x82, + 0xa7, 0x79, 0xbe, 0x61, 0xe5, 0x63, 0xaa, 0x80, 0x74, 0x63, 0xc9, 0x2e, 0x48, 0xc4, 0x45, 0x18, + 0x41, 0x5e, 0x63, 0xbb, 0x94, 0x43, 0x98, 0x27, 0xb1, 0x9d, 0xa4, 0x14, 0x38, 0x89, 0x45, 0x5f, + 0x00, 0x4f, 0xc9, 0xe7, 0x98, 0x86, 0x79, 0x2b, 0x6a, 0x0f, 0x43, 0x19, 0x4a, 0x13, 0xfa, 0x3a, + 0xca, 0x4e, 0x1b, 0xdf, 0x2a, 0xa8, 0x7a, 0x98, 0xb5, 0xec, 0x03, 0x50, 0xe0, 0xf8, 0x1c, 0x6d, + 0xc9, 0x21, 0x74, 0x46, 0x9d, 0x4c, 0xa1, 0x2d, 0x14, 0x38, 0xff, 0xd5, 0x57, 0xf6, 0x36, 0x5e, + 0x3d, 0xf7, 0xfe, 0xda, 0x4c, 0xef, 0x9d, 0x05, 0x6b, 0xfe, 0x7f, 0xf5, 0x63, 0xb7, 0x14, 0xcc, + 0x51, 0xe1, 0x13, 0x54, 0x0d, 0xa9, 0x3a, 0xd5, 0x6d, 0x34, 0xd4, 0xf7, 0x0c, 0xf5, 0xd3, 0x05, + 0xd4, 0x87, 0x39, 0x24, 0x28, 0x80, 0xf1, 0x7b, 0x74, 0xbf, 0xa5, 0x8b, 0x5a, 0xba, 0xa8, 0x33, + 0x52, 0xce, 0xea, 0x52, 0x46, 0x6d, 0x4c, 0x50, 0x64, 0xc0, 0x9f, 0xd0, 0x8e, 0x1e, 0x43, 0x53, + 0x4f, 0xe1, 0xc8, 0x0c, 0xc1, 0xd8, 0x5c, 0x33, 0xc4, 0xde, 0x02, 0xe2, 0x76, 0x11, 0x19, 0xdc, + 0x46, 0x85, 0x19, 0xc2, 0x5a, 0xea, 0x88, 0xaa, 0xa8, 0x23, 0x5b, 0x0c, 0x46, 0x46, 0x60, 0xdd, + 0x08, 0xec, 0x2f, 0x10, 0x38, 0x2e, 0x00, 0xf3, 0x26, 0xdf, 0x42, 0x87, 0xcf, 0xb5, 0x88, 0xb5, + 0x28, 0x24, 0xd6, 0x22, 0x1b, 0x46, 0xe4, 0xd9, 0x12, 0x22, 0xc5, 0x31, 0x6e, 0x8a, 0xa4, 0x38, + 0xc5, 0x8f, 0x68, 0x53, 0x23, 0x09, 0x65, 0x4c, 0x0e, 0x13, 0x10, 0x49, 0xe8, 0x54, 0xeb, 0xe5, + 0x25, 0x7e, 0xe0, 0x8c, 0x03, 0x7d, 0x7b, 0x03, 0xca, 0xe9, 0x1f, 0x8c, 0x0b, 0xa7, 0xf8, 0x05, + 0xda, 0x3e, 0x10, 0x09, 0x8d, 0xc5, 0x98, 0xf7, 0x8e, 0x93, 0xae, 0x1c, 0x26, 0x3d, 0xe5, 0x6c, + 0xd5, 0x57, 0xf6, 0xd6, 0x83, 0xf9, 0x84, 0xee, 0xe7, 0xfc, 0xce, 0x3b, 0xdb, 0xc6, 0x8e, 0xbf, + 0xc0, 0x4e, 0x40, 0x81, 0xb7, 0x33, 0xdc, 0x81, 0x86, 0xcd, 0xd6, 0x36, 0xfd, 0xe3, 0xbc, 0xf1, + 0xa5, 0x82, 0x76, 0xec, 0x6b, 0x42, 0x62, 0x1e, 0x52, 0x76, 0x89, 0xdf, 0xa0, 0xca, 0x80, 0xa6, + 0xb4, 0xaf, 0x9c, 0xb2, 0x11, 0x7c, 0xb2, 0x40, 0xf0, 0xd4, 0x14, 0x07, 0x39, 0xe8, 0xee, 0xb2, + 0xdd, 0x5d, 0xb6, 0x7f, 0xea, 0xb2, 0x35, 0x1a, 0xa8, 0x92, 0xad, 0x30, 0x76, 0xd0, 0x2a, 0x4f, + 0x68, 0x37, 0xe6, 0x3d, 0xb3, 0xfa, 0x6b, 0xc1, 0xec, 0xb3, 0x79, 0x72, 0x35, 0x71, 0xcb, 0xd7, + 0x13, 0xb7, 0xfc, 0x73, 0xe2, 0x96, 0xbf, 0x4e, 0xdd, 0xd2, 0xf5, 0xd4, 0x2d, 0x7d, 0x9f, 0xba, + 0xa5, 0xb3, 0x97, 0xa1, 0x80, 0x68, 0xd8, 0xf5, 0x98, 0xec, 0xfb, 0xda, 0xc6, 0x7e, 0xf6, 0x64, + 0xcd, 0xbc, 0xfb, 0x23, 0xdf, 0x7a, 0xc8, 0xe0, 0x72, 0xc0, 0x55, 0xb7, 0x62, 0x9e, 0xa9, 0xd7, + 0xbf, 0x02, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x2e, 0x15, 0xe7, 0xe3, 0x07, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -249,145 +408,739 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { if err != nil { return 0, err } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } + if len(m.LastBlockHeightList) > 0 { + for iNdEx := len(m.LastBlockHeightList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LastBlockHeightList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if len(m.CrossChainTxs) > 0 { + for iNdEx := len(m.CrossChainTxs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CrossChainTxs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if len(m.GasPriceList) > 0 { + for iNdEx := len(m.GasPriceList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GasPriceList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.OutTxTrackerList) > 0 { + for iNdEx := len(m.OutTxTrackerList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OutTxTrackerList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + return len(dAtA) - i, nil +} + +func (m *GenesisStateLegacy) 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 *GenesisStateLegacy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisStateLegacy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.FinalizedInbounds) > 0 { + for iNdEx := len(m.FinalizedInbounds) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.FinalizedInbounds[iNdEx]) + copy(dAtA[i:], m.FinalizedInbounds[iNdEx]) + i = encodeVarintGenesis(dAtA, i, uint64(len(m.FinalizedInbounds[iNdEx]))) + i-- + dAtA[i] = 0x1 + i-- + dAtA[i] = 0x82 + } + } + { + size, err := m.ZetaAccounting.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x62 + if len(m.InTxTrackerList) > 0 { + for iNdEx := len(m.InTxTrackerList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InTxTrackerList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x5a + } + } + if len(m.InTxHashToCctxList) > 0 { + for iNdEx := len(m.InTxHashToCctxList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.InTxHashToCctxList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x4a + } + } + if len(m.LastBlockHeightList) > 0 { + for iNdEx := len(m.LastBlockHeightList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.LastBlockHeightList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x42 + } + } + if len(m.CrossChainTxs) > 0 { + for iNdEx := len(m.CrossChainTxs) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.CrossChainTxs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x3a + } + } + if len(m.GasPriceList) > 0 { + for iNdEx := len(m.GasPriceList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.GasPriceList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x2a + } + } + if len(m.OutTxTrackerList) > 0 { + for iNdEx := len(m.OutTxTrackerList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.OutTxTrackerList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + if m.Params != nil { + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.Enabled { + i-- + if m.Enabled { + dAtA[i] = 1 + } else { + dAtA[i] = 0 + } + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { + offset -= sovGenesis(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *GenesisState) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if len(m.OutTxTrackerList) > 0 { + for _, e := range m.OutTxTrackerList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.GasPriceList) > 0 { + for _, e := range m.GasPriceList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.CrossChainTxs) > 0 { + for _, e := range m.CrossChainTxs { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.LastBlockHeightList) > 0 { + for _, e := range m.LastBlockHeightList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.InTxHashToCctxList) > 0 { + for _, e := range m.InTxHashToCctxList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.InTxTrackerList) > 0 { + for _, e := range m.InTxTrackerList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + l = m.ZetaAccounting.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.FinalizedInbounds) > 0 { + for _, s := range m.FinalizedInbounds { + l = len(s) + n += 2 + l + sovGenesis(uint64(l)) + } + } + l = m.RateLimiterFlags.Size() + n += 2 + l + sovGenesis(uint64(l)) + return n +} + +func (m *GenesisStateLegacy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Params != nil { + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + if len(m.OutTxTrackerList) > 0 { + for _, e := range m.OutTxTrackerList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.GasPriceList) > 0 { + for _, e := range m.GasPriceList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.CrossChainTxs) > 0 { + for _, e := range m.CrossChainTxs { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.LastBlockHeightList) > 0 { + for _, e := range m.LastBlockHeightList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.InTxHashToCctxList) > 0 { + for _, e := range m.InTxHashToCctxList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if len(m.InTxTrackerList) > 0 { + for _, e := range m.InTxTrackerList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + l = m.ZetaAccounting.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.FinalizedInbounds) > 0 { + for _, s := range m.FinalizedInbounds { + l = len(s) + n += 2 + l + sovGenesis(uint64(l)) + } + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.Enabled { + n += 2 + } + return n +} + +func sovGenesis(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozGenesis(x uint64) (n int) { + return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *GenesisState) 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 ErrIntOverflowGenesis + } + 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: GenesisState: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field OutTxTrackerList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.OutTxTrackerList = append(m.OutTxTrackerList, OutTxTracker{}) + if err := m.OutTxTrackerList[len(m.OutTxTrackerList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 5: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field GasPriceList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.GasPriceList = append(m.GasPriceList, &GasPrice{}) + if err := m.GasPriceList[len(m.GasPriceList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field CrossChainTxs", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.CrossChainTxs = append(m.CrossChainTxs, &CrossChainTx{}) + if err := m.CrossChainTxs[len(m.CrossChainTxs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 8: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field LastBlockHeightList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.LastBlockHeightList = append(m.LastBlockHeightList, &LastBlockHeight{}) + if err := m.LastBlockHeightList[len(m.LastBlockHeightList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 9: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InTxHashToCctxList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InTxHashToCctxList = append(m.InTxHashToCctxList, InTxHashToCctx{}) + if err := m.InTxHashToCctxList[len(m.InTxHashToCctxList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 11: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field InTxTrackerList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.InTxTrackerList = append(m.InTxTrackerList, InTxTracker{}) + if err := m.InTxTrackerList[len(m.InTxTrackerList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 12: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ZetaAccounting", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ZetaAccounting.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 16: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field FinalizedInbounds", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.FinalizedInbounds = append(m.FinalizedInbounds, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 17: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field RateLimiterFlags", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } } - i-- - dAtA[i] = 0x4a - } - } - if len(m.LastBlockHeightList) > 0 { - for iNdEx := len(m.LastBlockHeightList) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.LastBlockHeightList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + if msglen < 0 { + return ErrInvalidLengthGenesis } - i-- - dAtA[i] = 0x42 - } - } - if len(m.CrossChainTxs) > 0 { - for iNdEx := len(m.CrossChainTxs) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.CrossChainTxs[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis } - i-- - dAtA[i] = 0x3a - } - } - if len(m.GasPriceList) > 0 { - for iNdEx := len(m.GasPriceList) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.GasPriceList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + if postIndex > l { + return io.ErrUnexpectedEOF } - i-- - dAtA[i] = 0x2a - } - } - if len(m.OutTxTrackerList) > 0 { - for iNdEx := len(m.OutTxTrackerList) - 1; iNdEx >= 0; iNdEx-- { - { - size, err := m.OutTxTrackerList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) - if err != nil { - return 0, err - } - i -= size - i = encodeVarintGenesis(dAtA, i, uint64(size)) + if err := m.RateLimiterFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err } - i-- - dAtA[i] = 0x12 + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy } } - return len(dAtA) - i, nil -} -func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { - offset -= sovGenesis(v) - base := offset - for v >= 1<<7 { - dAtA[offset] = uint8(v&0x7f | 0x80) - v >>= 7 - offset++ - } - dAtA[offset] = uint8(v) - return base -} -func (m *GenesisState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.OutTxTrackerList) > 0 { - for _, e := range m.OutTxTrackerList { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.GasPriceList) > 0 { - for _, e := range m.GasPriceList { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.CrossChainTxs) > 0 { - for _, e := range m.CrossChainTxs { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.LastBlockHeightList) > 0 { - for _, e := range m.LastBlockHeightList { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.InTxHashToCctxList) > 0 { - for _, e := range m.InTxHashToCctxList { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - if len(m.InTxTrackerList) > 0 { - for _, e := range m.InTxTrackerList { - l = e.Size() - n += 1 + l + sovGenesis(uint64(l)) - } - } - l = m.ZetaAccounting.Size() - n += 1 + l + sovGenesis(uint64(l)) - if len(m.FinalizedInbounds) > 0 { - for _, s := range m.FinalizedInbounds { - l = len(s) - n += 2 + l + sovGenesis(uint64(l)) - } + if iNdEx > l { + return io.ErrUnexpectedEOF } - l = m.RateLimiterFlags.Size() - n += 2 + l + sovGenesis(uint64(l)) - return n -} - -func sovGenesis(x uint64) (n int) { - return (math_bits.Len64(x|1) + 6) / 7 -} -func sozGenesis(x uint64) (n int) { - return sovGenesis(uint64((x << 1) ^ uint64((int64(x) >> 63)))) + return nil } -func (m *GenesisState) Unmarshal(dAtA []byte) error { +func (m *GenesisStateLegacy) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -410,12 +1163,48 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: GenesisState: wiretype end group for non-group") + return fmt.Errorf("proto: GenesisState_legacy: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: GenesisState: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: GenesisState_legacy: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.Params == nil { + m.Params = &Params{} + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex case 2: if wireType != 2 { return fmt.Errorf("proto: wrong wireType = %d for field OutTxTrackerList", wireType) @@ -685,11 +1474,61 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } m.FinalizedInbounds = append(m.FinalizedInbounds, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex - case 17: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RateLimiterFlags", wireType) + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err } - var msglen int + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field Enabled", wireType) + } + var v int for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowGenesis @@ -699,25 +1538,12 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - msglen |= int(b&0x7F) << shift + v |= int(b&0x7F) << shift if b < 0x80 { break } } - if msglen < 0 { - return ErrInvalidLengthGenesis - } - postIndex := iNdEx + msglen - if postIndex < 0 { - return ErrInvalidLengthGenesis - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - if err := m.RateLimiterFlags.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex + m.Enabled = bool(v != 0) default: iNdEx = preIndex skippy, err := skipGenesis(dAtA[iNdEx:]) diff --git a/x/fungible/keeper/deposits.go b/x/fungible/keeper/deposits.go index 695386fd01..4108243a3d 100644 --- a/x/fungible/keeper/deposits.go +++ b/x/fungible/keeper/deposits.go @@ -60,6 +60,7 @@ func (k Keeper) ZRC20DepositAndCallContract( // check foreign coins cap if it has a cap if !foreignCoin.LiquidityCap.IsNil() && !foreignCoin.LiquidityCap.IsZero() { + liquidityCap := foreignCoin.LiquidityCap.BigInt() totalSupply, err := k.TotalSupplyZRC4(ctx, ZRC20Contract) if err != nil { diff --git a/x/fungible/types/genesis.go b/x/fungible/types/genesis.go index 859a19b3de..7087acb1f1 100644 --- a/x/fungible/types/genesis.go +++ b/x/fungible/types/genesis.go @@ -1,7 +1,10 @@ package types import ( + "encoding/json" "fmt" + + "github.com/cosmos/cosmos-sdk/codec" ) // DefaultGenesis returns the default fungible genesis state @@ -28,3 +31,25 @@ func (gs GenesisState) Validate() error { return nil } + +func GetGenesisStateFromAppState(marshaler codec.JSONCodec, appState map[string]json.RawMessage) GenesisState { + var genesisState GenesisState + if appState[ModuleName] != nil { + err := marshaler.UnmarshalJSON(appState[ModuleName], &genesisState) + if err != nil { + panic(fmt.Sprintf("Failed to get genesis state from app state: %s", err.Error())) + } + } + return genesisState +} + +func GetGenesisStateFromAppStateLegacy(marshaler codec.JSONCodec, appState map[string]json.RawMessage) GenesisStateLegacy { + var genesisState GenesisStateLegacy + if appState[ModuleName] != nil { + err := marshaler.UnmarshalJSON(appState[ModuleName], &genesisState) + if err != nil { + panic(fmt.Sprintf("Failed to get genesis state from app state: %s", err.Error())) + } + } + return genesisState +} diff --git a/x/fungible/types/genesis.pb.go b/x/fungible/types/genesis.pb.go index 56634c414b..3cbee16514 100644 --- a/x/fungible/types/genesis.pb.go +++ b/x/fungible/types/genesis.pb.go @@ -77,14 +77,112 @@ func (m *GenesisState) GetSystemContract() *SystemContract { return nil } +type GenesisStateLegacy struct { + Params Params `protobuf:"bytes,1,opt,name=params,proto3" json:"params"` + ForeignCoinsList []ForeignCoins `protobuf:"bytes,2,rep,name=foreignCoinsList,proto3" json:"foreignCoinsList"` + SystemContract *SystemContract `protobuf:"bytes,3,opt,name=systemContract,proto3" json:"systemContract,omitempty"` +} + +func (m *GenesisStateLegacy) Reset() { *m = GenesisStateLegacy{} } +func (m *GenesisStateLegacy) String() string { return proto.CompactTextString(m) } +func (*GenesisStateLegacy) ProtoMessage() {} +func (*GenesisStateLegacy) Descriptor() ([]byte, []int) { + return fileDescriptor_11e46382f3a6d0c2, []int{1} +} +func (m *GenesisStateLegacy) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *GenesisStateLegacy) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_GenesisStateLegacy.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 *GenesisStateLegacy) XXX_Merge(src proto.Message) { + xxx_messageInfo_GenesisStateLegacy.Merge(m, src) +} +func (m *GenesisStateLegacy) XXX_Size() int { + return m.Size() +} +func (m *GenesisStateLegacy) XXX_DiscardUnknown() { + xxx_messageInfo_GenesisStateLegacy.DiscardUnknown(m) +} + +var xxx_messageInfo_GenesisStateLegacy proto.InternalMessageInfo + +func (m *GenesisStateLegacy) GetParams() Params { + if m != nil { + return m.Params + } + return Params{} +} + +func (m *GenesisStateLegacy) GetForeignCoinsList() []ForeignCoins { + if m != nil { + return m.ForeignCoinsList + } + return nil +} + +func (m *GenesisStateLegacy) GetSystemContract() *SystemContract { + if m != nil { + return m.SystemContract + } + return nil +} + +type Params struct { +} + +func (m *Params) Reset() { *m = Params{} } +func (m *Params) String() string { return proto.CompactTextString(m) } +func (*Params) ProtoMessage() {} +func (*Params) Descriptor() ([]byte, []int) { + return fileDescriptor_11e46382f3a6d0c2, []int{2} +} +func (m *Params) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Params) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Params.Marshal(b, m, deterministic) + } else { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil + } +} +func (m *Params) XXX_Merge(src proto.Message) { + xxx_messageInfo_Params.Merge(m, src) +} +func (m *Params) XXX_Size() int { + return m.Size() +} +func (m *Params) XXX_DiscardUnknown() { + xxx_messageInfo_Params.DiscardUnknown(m) +} + +var xxx_messageInfo_Params proto.InternalMessageInfo + func init() { proto.RegisterType((*GenesisState)(nil), "zetachain.zetacore.fungible.GenesisState") + proto.RegisterType((*GenesisStateLegacy)(nil), "zetachain.zetacore.fungible.GenesisState_legacy") + proto.RegisterType((*Params)(nil), "zetachain.zetacore.fungible.Params") } func init() { proto.RegisterFile("fungible/genesis.proto", fileDescriptor_11e46382f3a6d0c2) } var fileDescriptor_11e46382f3a6d0c2 = []byte{ - // 261 bytes of a gzipped FileDescriptorProto + // 307 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x4b, 0x2b, 0xcd, 0x4b, 0xcf, 0x4c, 0xca, 0x49, 0xd5, 0x4f, 0x4f, 0xcd, 0x4b, 0x2d, 0xce, 0x2c, 0xd6, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, @@ -96,12 +194,15 @@ var fileDescriptor_11e46382f3a6d0c2 = []byte{ 0xcc, 0xe2, 0x12, 0x09, 0x26, 0x05, 0x66, 0x0d, 0x6e, 0x23, 0x4d, 0x3d, 0x3c, 0x8e, 0xd3, 0x73, 0x43, 0xd2, 0xe4, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, 0x43, 0x10, 0x86, 0x41, 0x42, 0xc1, 0x5c, 0x7c, 0x10, 0xc7, 0x39, 0x43, 0xdd, 0x26, 0xc1, 0xac, 0xc0, 0xa8, 0xc1, 0x6d, 0xa4, 0x8d, 0xd7, 0xe8, - 0x60, 0x14, 0x2d, 0x41, 0x68, 0x46, 0x38, 0x79, 0x9e, 0x78, 0x24, 0xc7, 0x78, 0xe1, 0x91, 0x1c, - 0xe3, 0x83, 0x47, 0x72, 0x8c, 0x13, 0x1e, 0xcb, 0x31, 0x5c, 0x78, 0x2c, 0xc7, 0x70, 0xe3, 0xb1, - 0x1c, 0x43, 0x94, 0x7e, 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x3e, 0xc8, - 0x58, 0x5d, 0xb0, 0x0d, 0xfa, 0x30, 0x1b, 0xf4, 0x2b, 0xf4, 0xe1, 0x61, 0x56, 0x52, 0x59, 0x90, - 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x14, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x94, 0x92, 0xf7, - 0x47, 0x9f, 0x01, 0x00, 0x00, + 0x60, 0x14, 0x2d, 0x41, 0x68, 0x46, 0x28, 0x75, 0x31, 0x71, 0x09, 0x23, 0x7b, 0x21, 0x3e, 0x27, + 0x35, 0x3d, 0x31, 0xb9, 0x52, 0xc8, 0x91, 0x8b, 0xad, 0x20, 0xb1, 0x28, 0x31, 0xb7, 0x58, 0x82, + 0x11, 0x6c, 0x89, 0x32, 0x5e, 0x4b, 0x02, 0xc0, 0x4a, 0xa1, 0x2e, 0x87, 0x6a, 0x1c, 0x82, 0x81, + 0xc1, 0xc1, 0xc5, 0x06, 0xf5, 0x89, 0xe7, 0x89, 0x47, 0x72, 0x8c, 0x17, 0x1e, 0xc9, 0x31, 0x3e, + 0x78, 0x24, 0xc7, 0x38, 0xe1, 0xb1, 0x1c, 0xc3, 0x85, 0xc7, 0x72, 0x0c, 0x37, 0x1e, 0xcb, 0x31, + 0x44, 0xe9, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x83, 0x2c, 0xd0, + 0x05, 0xdb, 0xa5, 0x0f, 0xb3, 0x4b, 0xbf, 0x42, 0x1f, 0x9e, 0x94, 0x4a, 0x2a, 0x0b, 0x52, 0x8b, + 0x93, 0xd8, 0xc0, 0x69, 0xc5, 0x18, 0x10, 0x00, 0x00, 0xff, 0xff, 0xfb, 0xae, 0x4b, 0x3c, 0xb6, + 0x02, 0x00, 0x00, } func (m *GenesisState) Marshal() (dAtA []byte, err error) { @@ -153,6 +254,88 @@ func (m *GenesisState) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *GenesisStateLegacy) 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 *GenesisStateLegacy) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *GenesisStateLegacy) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.SystemContract != nil { + { + size, err := m.SystemContract.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x1a + } + if len(m.ForeignCoinsList) > 0 { + for iNdEx := len(m.ForeignCoinsList) - 1; iNdEx >= 0; iNdEx-- { + { + size, err := m.ForeignCoinsList[iNdEx].MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + } + } + { + size, err := m.Params.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintGenesis(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + +func (m *Params) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *Params) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintGenesis(dAtA []byte, offset int, v uint64) int { offset -= sovGenesis(v) base := offset @@ -183,6 +366,36 @@ func (m *GenesisState) Size() (n int) { return n } +func (m *GenesisStateLegacy) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.Params.Size() + n += 1 + l + sovGenesis(uint64(l)) + if len(m.ForeignCoinsList) > 0 { + for _, e := range m.ForeignCoinsList { + l = e.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + } + if m.SystemContract != nil { + l = m.SystemContract.Size() + n += 1 + l + sovGenesis(uint64(l)) + } + return n +} + +func (m *Params) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovGenesis(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -309,6 +522,209 @@ func (m *GenesisState) Unmarshal(dAtA []byte) error { } return nil } +func (m *GenesisStateLegacy) 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 ErrIntOverflowGenesis + } + 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: GenesisState_legacy: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: GenesisState_legacy: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Params", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.Params.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ForeignCoinsList", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ForeignCoinsList = append(m.ForeignCoinsList, ForeignCoins{}) + if err := m.ForeignCoinsList[len(m.ForeignCoinsList)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + case 3: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field SystemContract", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthGenesis + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthGenesis + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if m.SystemContract == nil { + m.SystemContract = &SystemContract{} + } + if err := m.SystemContract.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *Params) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowGenesis + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: Params: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Params: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipGenesis(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthGenesis + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipGenesis(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0