From f693378a957dea92c9ff07b8aeab60021f9c4cb7 Mon Sep 17 00:00:00 2001 From: skosito Date: Wed, 27 Mar 2024 01:06:20 +0000 Subject: [PATCH] refactor: replace common package with pkg (#1936) --- .goreleaser.yaml | 8 +- Makefile | 8 +- changelog.md | 1 + cmd/zetaclientd/debug.go | 27 +- cmd/zetaclientd/hsm.go | 5 +- cmd/zetaclientd/keygen_tss.go | 8 +- cmd/zetaclientd/main.go | 3 +- cmd/zetaclientd/p2p_diagnostics.go | 2 +- cmd/zetaclientd/start.go | 7 +- cmd/zetaclientd/utils.go | 3 +- cmd/zetaclientd/version.go | 4 +- cmd/zetacored/get_pubkey.go | 10 +- cmd/zetacored/observer_accounts.go | 6 +- cmd/zetatool/filterdeposit/btc.go | 4 +- cmd/zetatool/filterdeposit/evm.go | 4 +- common/commands.go | 8 - common/constant.go | 7 - common/cosmos/cosmos.go | 72 -- docs/openapi/openapi.swagger.yaml | 130 +-- docs/spec/crosschain/messages.md | 14 +- docs/spec/fungible/messages.md | 2 +- docs/spec/observer/messages.md | 2 +- e2e/e2etests/test_bitcoin_withdraw.go | 4 +- e2e/e2etests/test_donation.go | 4 +- e2e/e2etests/test_update_bytecode.go | 4 +- e2e/e2etests/test_zeta_withdraw.go | 4 +- e2e/runner/bitcoin.go | 12 +- e2e/runner/evm.go | 9 +- e2e/runner/setup_evm.go | 4 +- e2e/runner/setup_zeta.go | 8 +- e2e/txserver/zeta_tx_server.go | 15 +- {common => pkg/authz}/authz_tx_types.go | 2 +- {common => pkg/authz}/authz_tx_types_test.go | 2 +- {common => pkg/chains}/address.go | 2 +- {common => pkg/chains}/address_test.go | 2 +- {common => pkg/chains}/bitcoin.go | 2 +- {common => pkg/chains}/bitcoin_test.go | 2 +- {common => pkg/chains}/chain.go | 2 +- {common => pkg/chains}/chain_id.go | 2 +- {common => pkg/chains}/chain_id_test.go | 5 +- {common => pkg/chains}/chain_test.go | 2 +- {common => pkg/chains}/chains.go | 2 +- pkg/chains/chains.pb.go | 450 ++++++++++ {common => pkg/chains}/chains_test.go | 2 +- common/utils.go => pkg/chains/conversion.go | 2 +- {common => pkg/chains}/utils_test.go | 2 +- {common => pkg/coin}/coin.go | 2 +- pkg/coin/coin.pb.go | 76 ++ {common => pkg/coin}/coin_test.go | 23 +- pkg/constant/constant.go | 11 + {common => pkg/constant}/version.go | 2 +- pkg/cosmos/cosmos.go | 11 + {common => pkg}/cosmos/cosmos_test.go | 0 pkg/crypto/crypto.pb.go | 371 +++++++++ {common => pkg/crypto}/pubkey.go | 21 +- {common => pkg/crypto}/pubkey_test.go | 19 +- {common => pkg/crypto}/tss.go | 8 +- {common => pkg/crypto}/tss_test.go | 4 +- {common => pkg/gas}/gas_limits.go | 2 +- {common => pkg/gas}/gas_limits_test.go | 2 +- {common => pkg/proofs}/bitcoin/bitcoin.pb.go | 34 +- {common => pkg/proofs}/bitcoin/bitcoin_spv.go | 0 .../proofs}/bitcoin/bitcoin_spv_test.go | 0 {common => pkg/proofs}/bitcoin/proof.go | 0 {common => pkg/proofs}/bitcoin/proof_test.go | 2 +- .../proofs}/ethereum/ethereum.pb.go | 33 +- {common => pkg/proofs}/ethereum/proof.go | 0 {common => pkg/proofs}/ethereum/proof_test.go | 2 +- {common => pkg/proofs}/headers.go | 7 +- {common => pkg/proofs}/headers_test.go | 29 +- {common => pkg/proofs}/proof.go | 6 +- {common => pkg/proofs}/proof_test.go | 43 +- .../common.pb.go => pkg/proofs/proofs.pb.go | 773 +++--------------- .../testdata/eth_header_18495266.json | 0 {common => pkg}/testdata/ethereum/header.json | 0 .../testdata/ethereum/receipt_0.json | 0 .../testdata/ethereum/receipt_1.json | 0 .../testdata/ethereum/receipt_10.json | 0 .../testdata/ethereum/receipt_11.json | 0 .../testdata/ethereum/receipt_12.json | 0 .../testdata/ethereum/receipt_13.json | 0 .../testdata/ethereum/receipt_14.json | 0 .../testdata/ethereum/receipt_15.json | 0 .../testdata/ethereum/receipt_16.json | 0 .../testdata/ethereum/receipt_17.json | 0 .../testdata/ethereum/receipt_18.json | 0 .../testdata/ethereum/receipt_19.json | 0 .../testdata/ethereum/receipt_2.json | 0 .../testdata/ethereum/receipt_20.json | 0 .../testdata/ethereum/receipt_21.json | 0 .../testdata/ethereum/receipt_22.json | 0 .../testdata/ethereum/receipt_23.json | 0 .../testdata/ethereum/receipt_24.json | 0 .../testdata/ethereum/receipt_25.json | 0 .../testdata/ethereum/receipt_26.json | 0 .../testdata/ethereum/receipt_27.json | 0 .../testdata/ethereum/receipt_28.json | 0 .../testdata/ethereum/receipt_29.json | 0 .../testdata/ethereum/receipt_3.json | 0 .../testdata/ethereum/receipt_30.json | 0 .../testdata/ethereum/receipt_31.json | 0 .../testdata/ethereum/receipt_32.json | 0 .../testdata/ethereum/receipt_33.json | 0 .../testdata/ethereum/receipt_34.json | 0 .../testdata/ethereum/receipt_35.json | 0 .../testdata/ethereum/receipt_36.json | 0 .../testdata/ethereum/receipt_37.json | 0 .../testdata/ethereum/receipt_38.json | 0 .../testdata/ethereum/receipt_39.json | 0 .../testdata/ethereum/receipt_4.json | 0 .../testdata/ethereum/receipt_40.json | 0 .../testdata/ethereum/receipt_41.json | 0 .../testdata/ethereum/receipt_42.json | 0 .../testdata/ethereum/receipt_43.json | 0 .../testdata/ethereum/receipt_44.json | 0 .../testdata/ethereum/receipt_45.json | 0 .../testdata/ethereum/receipt_46.json | 0 .../testdata/ethereum/receipt_47.json | 0 .../testdata/ethereum/receipt_48.json | 0 .../testdata/ethereum/receipt_49.json | 0 .../testdata/ethereum/receipt_5.json | 0 .../testdata/ethereum/receipt_50.json | 0 .../testdata/ethereum/receipt_51.json | 0 .../testdata/ethereum/receipt_52.json | 0 .../testdata/ethereum/receipt_53.json | 0 .../testdata/ethereum/receipt_54.json | 0 .../testdata/ethereum/receipt_55.json | 0 .../testdata/ethereum/receipt_56.json | 0 .../testdata/ethereum/receipt_57.json | 0 .../testdata/ethereum/receipt_58.json | 0 .../testdata/ethereum/receipt_59.json | 0 .../testdata/ethereum/receipt_6.json | 0 .../testdata/ethereum/receipt_60.json | 0 .../testdata/ethereum/receipt_61.json | 0 .../testdata/ethereum/receipt_62.json | 0 .../testdata/ethereum/receipt_63.json | 0 .../testdata/ethereum/receipt_64.json | 0 .../testdata/ethereum/receipt_65.json | 0 .../testdata/ethereum/receipt_66.json | 0 .../testdata/ethereum/receipt_67.json | 0 .../testdata/ethereum/receipt_68.json | 0 .../testdata/ethereum/receipt_69.json | 0 .../testdata/ethereum/receipt_7.json | 0 .../testdata/ethereum/receipt_70.json | 0 .../testdata/ethereum/receipt_71.json | 0 .../testdata/ethereum/receipt_72.json | 0 .../testdata/ethereum/receipt_73.json | 0 .../testdata/ethereum/receipt_74.json | 0 .../testdata/ethereum/receipt_75.json | 0 .../testdata/ethereum/receipt_76.json | 0 .../testdata/ethereum/receipt_77.json | 0 .../testdata/ethereum/receipt_78.json | 0 .../testdata/ethereum/receipt_79.json | 0 .../testdata/ethereum/receipt_8.json | 0 .../testdata/ethereum/receipt_80.json | 0 .../testdata/ethereum/receipt_9.json | 0 {common => pkg}/testdata/ethereum/tx_0.json | 0 {common => pkg}/testdata/ethereum/tx_1.json | 0 {common => pkg}/testdata/ethereum/tx_10.json | 0 {common => pkg}/testdata/ethereum/tx_11.json | 0 {common => pkg}/testdata/ethereum/tx_12.json | 0 {common => pkg}/testdata/ethereum/tx_13.json | 0 {common => pkg}/testdata/ethereum/tx_14.json | 0 {common => pkg}/testdata/ethereum/tx_15.json | 0 {common => pkg}/testdata/ethereum/tx_16.json | 0 {common => pkg}/testdata/ethereum/tx_17.json | 0 {common => pkg}/testdata/ethereum/tx_18.json | 0 {common => pkg}/testdata/ethereum/tx_19.json | 0 {common => pkg}/testdata/ethereum/tx_2.json | 0 {common => pkg}/testdata/ethereum/tx_20.json | 0 {common => pkg}/testdata/ethereum/tx_21.json | 0 {common => pkg}/testdata/ethereum/tx_22.json | 0 {common => pkg}/testdata/ethereum/tx_23.json | 0 {common => pkg}/testdata/ethereum/tx_24.json | 0 {common => pkg}/testdata/ethereum/tx_25.json | 0 {common => pkg}/testdata/ethereum/tx_26.json | 0 {common => pkg}/testdata/ethereum/tx_27.json | 0 {common => pkg}/testdata/ethereum/tx_28.json | 0 {common => pkg}/testdata/ethereum/tx_29.json | 0 {common => pkg}/testdata/ethereum/tx_3.json | 0 {common => pkg}/testdata/ethereum/tx_30.json | 0 {common => pkg}/testdata/ethereum/tx_31.json | 0 {common => pkg}/testdata/ethereum/tx_32.json | 0 {common => pkg}/testdata/ethereum/tx_33.json | 0 {common => pkg}/testdata/ethereum/tx_34.json | 0 {common => pkg}/testdata/ethereum/tx_35.json | 0 {common => pkg}/testdata/ethereum/tx_36.json | 0 {common => pkg}/testdata/ethereum/tx_37.json | 0 {common => pkg}/testdata/ethereum/tx_38.json | 0 {common => pkg}/testdata/ethereum/tx_39.json | 0 {common => pkg}/testdata/ethereum/tx_4.json | 0 {common => pkg}/testdata/ethereum/tx_40.json | 0 {common => pkg}/testdata/ethereum/tx_41.json | 0 {common => pkg}/testdata/ethereum/tx_42.json | 0 {common => pkg}/testdata/ethereum/tx_43.json | 0 {common => pkg}/testdata/ethereum/tx_44.json | 0 {common => pkg}/testdata/ethereum/tx_45.json | 0 {common => pkg}/testdata/ethereum/tx_46.json | 0 {common => pkg}/testdata/ethereum/tx_47.json | 0 {common => pkg}/testdata/ethereum/tx_48.json | 0 {common => pkg}/testdata/ethereum/tx_49.json | 0 {common => pkg}/testdata/ethereum/tx_5.json | 0 {common => pkg}/testdata/ethereum/tx_50.json | 0 {common => pkg}/testdata/ethereum/tx_51.json | 0 {common => pkg}/testdata/ethereum/tx_52.json | 0 {common => pkg}/testdata/ethereum/tx_53.json | 0 {common => pkg}/testdata/ethereum/tx_54.json | 0 {common => pkg}/testdata/ethereum/tx_55.json | 0 {common => pkg}/testdata/ethereum/tx_56.json | 0 {common => pkg}/testdata/ethereum/tx_57.json | 0 {common => pkg}/testdata/ethereum/tx_58.json | 0 {common => pkg}/testdata/ethereum/tx_59.json | 0 {common => pkg}/testdata/ethereum/tx_6.json | 0 {common => pkg}/testdata/ethereum/tx_60.json | 0 {common => pkg}/testdata/ethereum/tx_61.json | 0 {common => pkg}/testdata/ethereum/tx_62.json | 0 {common => pkg}/testdata/ethereum/tx_63.json | 0 {common => pkg}/testdata/ethereum/tx_64.json | 0 {common => pkg}/testdata/ethereum/tx_65.json | 0 {common => pkg}/testdata/ethereum/tx_66.json | 0 {common => pkg}/testdata/ethereum/tx_67.json | 0 {common => pkg}/testdata/ethereum/tx_68.json | 0 {common => pkg}/testdata/ethereum/tx_69.json | 0 {common => pkg}/testdata/ethereum/tx_7.json | 0 {common => pkg}/testdata/ethereum/tx_70.json | 0 {common => pkg}/testdata/ethereum/tx_71.json | 0 {common => pkg}/testdata/ethereum/tx_72.json | 0 {common => pkg}/testdata/ethereum/tx_73.json | 0 {common => pkg}/testdata/ethereum/tx_74.json | 0 {common => pkg}/testdata/ethereum/tx_75.json | 0 {common => pkg}/testdata/ethereum/tx_76.json | 0 {common => pkg}/testdata/ethereum/tx_77.json | 0 {common => pkg}/testdata/ethereum/tx_78.json | 0 {common => pkg}/testdata/ethereum/tx_79.json | 0 {common => pkg}/testdata/ethereum/tx_8.json | 0 {common => pkg}/testdata/ethereum/tx_80.json | 0 {common => pkg}/testdata/ethereum/tx_9.json | 0 {common => pkg}/testdata/test_blocks.json | 0 {common => pkg}/testdata/testdata.go | 0 proto/common/common.proto | 89 -- proto/crosschain/cross_chain_tx.proto | 6 +- proto/crosschain/events.proto | 1 - proto/crosschain/in_tx_tracker.proto | 4 +- proto/crosschain/tx.proto | 18 +- proto/fungible/events.proto | 6 +- proto/fungible/foreign_coins.proto | 4 +- proto/fungible/tx.proto | 4 +- proto/observer/chain_nonces.proto | 1 - proto/observer/node_account.proto | 4 +- proto/observer/nonce_to_cctx.proto | 1 - proto/observer/observer.proto | 4 +- proto/observer/params.proto | 4 +- proto/observer/pending_nonces.proto | 1 - proto/observer/query.proto | 11 +- proto/observer/tx.proto | 4 +- proto/pkg/chains/chains.proto | 44 + proto/pkg/coin/coin.proto | 14 + proto/pkg/crypto/crypto.proto | 15 + .../proofs}/bitcoin/bitcoin.proto | 2 +- .../proofs}/ethereum/ethereum.proto | 2 +- proto/pkg/proofs/proofs.proto | 31 + rpc/namespaces/ethereum/web3/api.go | 4 +- testutil/keeper/mocks/crosschain/fungible.go | 22 +- testutil/keeper/mocks/crosschain/observer.go | 67 +- testutil/keeper/mocks/fungible/observer.go | 10 +- testutil/network/genesis_state.go | 13 +- testutil/sample/common.go | 17 +- testutil/sample/crosschain.go | 8 +- testutil/sample/fungible.go | 4 +- testutil/sample/observer.go | 9 +- testutil/sample/sample.go | 6 +- typescript/common/common_pb.d.ts | 338 -------- typescript/common/index.d.ts | 1 - typescript/crosschain/cross_chain_tx_pb.d.ts | 6 +- typescript/crosschain/in_tx_tracker_pb.d.ts | 4 +- typescript/crosschain/tx_pb.d.ts | 18 +- typescript/fungible/events_pb.d.ts | 6 +- typescript/fungible/foreign_coins_pb.d.ts | 4 +- typescript/fungible/tx_pb.d.ts | 4 +- typescript/observer/node_account_pb.d.ts | 4 +- typescript/observer/observer_pb.d.ts | 4 +- typescript/observer/params_pb.d.ts | 4 +- typescript/observer/query_pb.d.ts | 11 +- typescript/observer/tx_pb.d.ts | 4 +- typescript/pkg/chains/chains_pb.d.ts | 152 ++++ typescript/pkg/chains/index.d.ts | 1 + typescript/pkg/coin/coin_pb.d.ts | 36 + typescript/pkg/coin/index.d.ts | 1 + typescript/pkg/crypto/crypto_pb.d.ts | 39 + typescript/pkg/crypto/index.d.ts | 1 + .../proofs}/bitcoin/bitcoin_pb.d.ts | 2 +- .../{common => pkg/proofs}/bitcoin/index.d.ts | 0 .../proofs}/ethereum/ethereum_pb.d.ts | 2 +- .../proofs}/ethereum/index.d.ts | 0 typescript/pkg/proofs/index.d.ts | 1 + typescript/pkg/proofs/proofs_pb.d.ts | 132 +++ x/crosschain/client/cli/cli_cctx.go | 17 +- x/crosschain/client/cli/cli_in_tx_tracker.go | 4 +- x/crosschain/client/cli/cli_tss.go | 8 +- .../client/integrationtests/cli_helpers.go | 25 +- x/crosschain/keeper/abci.go | 6 +- x/crosschain/keeper/abci_test.go | 20 +- x/crosschain/keeper/cctx.go | 4 +- x/crosschain/keeper/cctx_test.go | 4 +- x/crosschain/keeper/cctx_utils.go | 6 +- x/crosschain/keeper/cctx_utils_test.go | 20 +- x/crosschain/keeper/events.go | 6 +- x/crosschain/keeper/evm_deposit.go | 9 +- x/crosschain/keeper/evm_deposit_test.go | 40 +- x/crosschain/keeper/evm_hooks.go | 15 +- x/crosschain/keeper/evm_hooks_test.go | 64 +- x/crosschain/keeper/gas_payment.go | 14 +- x/crosschain/keeper/gas_payment_test.go | 55 +- .../keeper/grpc_query_zeta_conversion_rate.go | 4 +- x/crosschain/keeper/in_tx_tracker_test.go | 4 +- .../keeper/msg_server_add_to_intx_tracker.go | 4 +- .../msg_server_add_to_intx_tracker_test.go | 19 +- .../keeper/msg_server_add_to_outtx_tracker.go | 16 +- .../keeper/msg_server_migrate_tss_funds.go | 31 +- .../msg_server_migrate_tss_funds_test.go | 7 +- .../keeper/msg_server_refund_aborted_tx.go | 4 +- .../msg_server_refund_aborted_tx_test.go | 28 +- x/crosschain/keeper/msg_server_tss_voter.go | 6 +- .../keeper/msg_server_vote_inbound_tx.go | 4 +- .../keeper/msg_server_vote_inbound_tx_test.go | 10 +- .../keeper/msg_server_vote_outbound_tx.go | 5 +- .../keeper/msg_server_whitelist_erc20.go | 13 +- .../keeper/msg_server_whitelist_erc20_test.go | 4 +- x/crosschain/keeper/refund.go | 15 +- x/crosschain/keeper/refund_test.go | 32 +- x/crosschain/keeper/utils_test.go | 14 +- x/crosschain/keeper/verify_proof.go | 20 +- x/crosschain/migrations/v4/migrate.go | 7 +- x/crosschain/migrations/v4/migrate_test.go | 33 +- x/crosschain/migrations/v5/migrate.go | 19 +- x/crosschain/migrations/v5/migrate_test.go | 57 +- x/crosschain/types/cross_chain_tx.pb.go | 161 ++-- x/crosschain/types/events.pb.go | 84 +- x/crosschain/types/expected_keepers.go | 20 +- x/crosschain/types/in_tx_tracker.pb.go | 40 +- .../types/message_add_to_in_tx_tracker.go | 9 +- .../message_add_to_in_tx_tracker_test.go | 44 +- .../types/message_add_to_out_tx_tracker.go | 4 +- x/crosschain/types/message_gas_price_voter.go | 4 +- .../types/message_gas_price_voter_test.go | 4 +- .../types/message_migrate_tss_funds.go | 4 +- .../types/message_migrate_tss_funds_test.go | 18 +- x/crosschain/types/message_tss_voter.go | 4 +- x/crosschain/types/message_tss_voter_test.go | 18 +- .../types/message_update_tss_address.go | 2 +- .../message_vote_on_observed_inbound_tx.go | 7 +- ...essage_vote_on_observed_inbound_tx_test.go | 19 +- .../message_vote_on_observed_outbound_tx.go | 12 +- ...ssage_vote_on_observed_outbound_tx_test.go | 26 +- x/crosschain/types/tx.pb.go | 269 +++--- x/emissions/abci_test.go | 6 +- .../keeper/block_rewards_components.go | 4 +- .../cli/tx_deploy_fungible_coin_zrc_4.go | 4 +- x/fungible/keeper/deposits.go | 20 +- x/fungible/keeper/deposits_test.go | 61 +- x/fungible/keeper/evm.go | 7 +- x/fungible/keeper/evm_test.go | 9 +- x/fungible/keeper/foreign_coins.go | 8 +- x/fungible/keeper/foreign_coins_test.go | 24 +- x/fungible/keeper/gas_coin_and_pool.go | 9 +- .../msg_server_deploy_fungible_coin_zrc20.go | 4 +- ..._server_deploy_fungible_coin_zrc20_test.go | 20 +- ...sg_server_update_contract_bytecode_test.go | 9 +- .../msg_server_update_system_contract.go | 4 +- .../msg_server_update_system_contract_test.go | 6 +- x/fungible/types/events.pb.go | 148 ++-- x/fungible/types/expected_keepers.go | 4 +- x/fungible/types/foreign_coins.pb.go | 67 +- .../message_deploy_fungible_coin_zrc20.go | 4 +- ...message_deploy_fungible_coin_zrc20_test.go | 10 +- x/fungible/types/tx.pb.go | 150 ++-- x/observer/genesis.go | 4 +- x/observer/keeper/block_header.go | 6 +- x/observer/keeper/chain_params.go | 16 +- x/observer/keeper/chain_params_test.go | 14 +- x/observer/keeper/grpc_query_block_header.go | 6 +- x/observer/keeper/grpc_query_prove.go | 11 +- x/observer/keeper/grpc_query_tss.go | 19 +- .../keeper/msg_server_add_block_header.go | 9 +- .../msg_server_add_block_header_test.go | 31 +- x/observer/keeper/msg_server_add_observer.go | 8 +- .../msg_server_remove_chain_params_test.go | 20 +- .../keeper/msg_server_reset_chain_nonces.go | 4 +- .../msg_server_reset_chain_nonces_test.go | 10 +- .../msg_server_update_chain_params_test.go | 10 +- x/observer/keeper/utils.go | 4 +- x/observer/keeper/utils_test.go | 6 +- x/observer/keeper/vote_inbound.go | 6 +- x/observer/keeper/vote_inbound_test.go | 39 +- x/observer/keeper/vote_outbound.go | 4 +- x/observer/keeper/vote_outbound_test.go | 18 +- x/observer/migrations/v5/migrate_test.go | 6 +- x/observer/types/chain_nonces.pb.go | 38 +- x/observer/types/chain_params.go | 34 +- x/observer/types/message_add_blame_vote.go | 4 +- x/observer/types/message_add_block_header.go | 7 +- .../types/message_add_block_header_test.go | 14 +- x/observer/types/message_add_observer.go | 6 +- .../types/message_remove_chain_params.go | 4 +- .../types/message_remove_chain_params_test.go | 6 +- .../types/message_reset_chain_nonces.go | 4 +- .../types/message_reset_chain_nonces_test.go | 14 +- .../types/message_update_chain_params_test.go | 6 +- x/observer/types/node_account.pb.go | 57 +- x/observer/types/nonce_to_cctx.pb.go | 28 +- x/observer/types/observer.pb.go | 62 +- x/observer/types/observer_set.go | 8 +- x/observer/types/params.go | 4 +- x/observer/types/params.pb.go | 112 +-- x/observer/types/parsers.go | 8 +- x/observer/types/pending_nonces.pb.go | 28 +- x/observer/types/query.pb.go | 342 ++++---- x/observer/types/tx.pb.go | 138 ++-- zetaclient/app_context/app_context.go | 6 +- zetaclient/authz/authz_signer.go | 6 +- zetaclient/bitcoin/bitcoin_client.go | 37 +- zetaclient/bitcoin/bitcoin_client_rpc_test.go | 4 +- zetaclient/bitcoin/bitcoin_client_test.go | 6 +- zetaclient/bitcoin/bitcoin_signer.go | 13 +- zetaclient/bitcoin/bitcoin_signer_test.go | 4 +- zetaclient/bitcoin/bitcoin_test.go | 4 +- zetaclient/bitcoin/inbound_tracker.go | 4 +- zetaclient/bitcoin/utils.go | 8 +- zetaclient/bitcoin/utils_test.go | 8 +- zetaclient/config/config_chain.go | 28 +- zetaclient/config/types.go | 4 +- zetaclient/core_context/zeta_core_context.go | 18 +- .../core_context/zeta_core_context_test.go | 20 +- zetaclient/evm/evm_client.go | 66 +- zetaclient/evm/evm_client_test.go | 9 +- zetaclient/evm/evm_signer.go | 32 +- zetaclient/evm/evm_signer_test.go | 13 +- zetaclient/evm/inbounds.go | 34 +- zetaclient/evm/inbounds_test.go | 66 +- zetaclient/evm/outbound_transaction_data.go | 11 +- .../evm/outbound_transaction_data_test.go | 6 +- zetaclient/evm/validation_test.go | 70 +- zetaclient/interfaces/interfaces.go | 22 +- zetaclient/interfaces/signer.go | 6 +- zetaclient/keys/keys.go | 14 +- zetaclient/keys/keys_test.go | 6 +- .../supplychecker/zeta_supply_checker.go | 19 +- zetaclient/testutils/stub/chain_signer.go | 6 +- zetaclient/testutils/stub/core_bridge.go | 22 +- zetaclient/testutils/stub/tss_signer.go | 4 +- zetaclient/testutils/testdata.go | 24 +- zetaclient/testutils/testdata_naming.go | 12 +- zetaclient/tss/tss_signer.go | 22 +- zetaclient/tss/tss_signer_test.go | 6 +- zetaclient/zetabridge/broadcast.go | 3 +- zetaclient/zetabridge/query.go | 13 +- zetaclient/zetabridge/tx.go | 26 +- zetaclient/zetabridge/tx_vote_inbound.go | 4 +- zetaclient/zetabridge/zetacore_bridge.go | 39 +- zetaclient/zetacore_observer.go | 12 +- zetaclient/zetacore_observer_test.go | 22 +- 461 files changed, 3938 insertions(+), 3562 deletions(-) delete mode 100644 common/commands.go delete mode 100644 common/constant.go delete mode 100644 common/cosmos/cosmos.go rename {common => pkg/authz}/authz_tx_types.go (97%) rename {common => pkg/authz}/authz_tx_types_test.go (98%) rename {common => pkg/chains}/address.go (99%) rename {common => pkg/chains}/address_test.go (99%) rename {common => pkg/chains}/bitcoin.go (98%) rename {common => pkg/chains}/bitcoin_test.go (98%) rename {common => pkg/chains}/chain.go (99%) rename {common => pkg/chains}/chain_id.go (98%) rename {common => pkg/chains}/chain_id_test.go (88%) rename {common => pkg/chains}/chain_test.go (99%) rename {common => pkg/chains}/chains.go (99%) create mode 100644 pkg/chains/chains.pb.go rename {common => pkg/chains}/chains_test.go (99%) rename common/utils.go => pkg/chains/conversion.go (99%) rename {common => pkg/chains}/utils_test.go (99%) rename {common => pkg/coin}/coin.go (97%) create mode 100644 pkg/coin/coin.pb.go rename {common => pkg/coin}/coin_test.go (84%) create mode 100644 pkg/constant/constant.go rename {common => pkg/constant}/version.go (81%) create mode 100644 pkg/cosmos/cosmos.go rename {common => pkg}/cosmos/cosmos_test.go (100%) create mode 100644 pkg/crypto/crypto.pb.go rename {common => pkg/crypto}/pubkey.go (90%) rename {common => pkg/crypto}/pubkey_test.go (95%) rename {common => pkg/crypto}/tss.go (83%) rename {common => pkg/crypto}/tss_test.go (97%) rename {common => pkg/gas}/gas_limits.go (98%) rename {common => pkg/gas}/gas_limits_test.go (98%) rename {common => pkg/proofs}/bitcoin/bitcoin.pb.go (86%) rename {common => pkg/proofs}/bitcoin/bitcoin_spv.go (100%) rename {common => pkg/proofs}/bitcoin/bitcoin_spv_test.go (100%) rename {common => pkg/proofs}/bitcoin/proof.go (100%) rename {common => pkg/proofs}/bitcoin/proof_test.go (98%) rename {common => pkg/proofs}/ethereum/ethereum.pb.go (86%) rename {common => pkg/proofs}/ethereum/proof.go (100%) rename {common => pkg/proofs}/ethereum/proof_test.go (98%) rename {common => pkg/proofs}/headers.go (97%) rename {common => pkg/proofs}/headers_test.go (88%) rename {common => pkg/proofs}/proof.go (95%) rename {common => pkg/proofs}/proof_test.go (78%) rename common/common.pb.go => pkg/proofs/proofs.pb.go (52%) rename {common => pkg}/testdata/eth_header_18495266.json (100%) rename {common => pkg}/testdata/ethereum/header.json (100%) rename {common => pkg}/testdata/ethereum/receipt_0.json (100%) rename {common => pkg}/testdata/ethereum/receipt_1.json (100%) rename {common => pkg}/testdata/ethereum/receipt_10.json (100%) rename {common => pkg}/testdata/ethereum/receipt_11.json (100%) rename {common => pkg}/testdata/ethereum/receipt_12.json (100%) rename {common => pkg}/testdata/ethereum/receipt_13.json (100%) rename {common => pkg}/testdata/ethereum/receipt_14.json (100%) rename {common => pkg}/testdata/ethereum/receipt_15.json (100%) rename {common => pkg}/testdata/ethereum/receipt_16.json (100%) rename {common => pkg}/testdata/ethereum/receipt_17.json (100%) rename {common => pkg}/testdata/ethereum/receipt_18.json (100%) rename {common => pkg}/testdata/ethereum/receipt_19.json (100%) rename {common => pkg}/testdata/ethereum/receipt_2.json (100%) rename {common => pkg}/testdata/ethereum/receipt_20.json (100%) rename {common => pkg}/testdata/ethereum/receipt_21.json (100%) rename {common => pkg}/testdata/ethereum/receipt_22.json (100%) rename {common => pkg}/testdata/ethereum/receipt_23.json (100%) rename {common => pkg}/testdata/ethereum/receipt_24.json (100%) rename {common => pkg}/testdata/ethereum/receipt_25.json (100%) rename {common => pkg}/testdata/ethereum/receipt_26.json (100%) rename {common => pkg}/testdata/ethereum/receipt_27.json (100%) rename {common => pkg}/testdata/ethereum/receipt_28.json (100%) rename {common => pkg}/testdata/ethereum/receipt_29.json (100%) rename {common => pkg}/testdata/ethereum/receipt_3.json (100%) rename {common => pkg}/testdata/ethereum/receipt_30.json (100%) rename {common => pkg}/testdata/ethereum/receipt_31.json (100%) rename {common => pkg}/testdata/ethereum/receipt_32.json (100%) rename {common => pkg}/testdata/ethereum/receipt_33.json (100%) rename {common => pkg}/testdata/ethereum/receipt_34.json (100%) rename {common => pkg}/testdata/ethereum/receipt_35.json (100%) rename {common => pkg}/testdata/ethereum/receipt_36.json (100%) rename {common => pkg}/testdata/ethereum/receipt_37.json (100%) rename {common => pkg}/testdata/ethereum/receipt_38.json (100%) rename {common => pkg}/testdata/ethereum/receipt_39.json (100%) rename {common => pkg}/testdata/ethereum/receipt_4.json (100%) rename {common => pkg}/testdata/ethereum/receipt_40.json (100%) rename {common => pkg}/testdata/ethereum/receipt_41.json (100%) rename {common => pkg}/testdata/ethereum/receipt_42.json (100%) rename {common => pkg}/testdata/ethereum/receipt_43.json (100%) rename {common => pkg}/testdata/ethereum/receipt_44.json (100%) rename {common => pkg}/testdata/ethereum/receipt_45.json (100%) rename {common => pkg}/testdata/ethereum/receipt_46.json (100%) rename {common => pkg}/testdata/ethereum/receipt_47.json (100%) rename {common => pkg}/testdata/ethereum/receipt_48.json (100%) rename {common => pkg}/testdata/ethereum/receipt_49.json (100%) rename {common => pkg}/testdata/ethereum/receipt_5.json (100%) rename {common => pkg}/testdata/ethereum/receipt_50.json (100%) rename {common => pkg}/testdata/ethereum/receipt_51.json (100%) rename {common => pkg}/testdata/ethereum/receipt_52.json (100%) rename {common => pkg}/testdata/ethereum/receipt_53.json (100%) rename {common => pkg}/testdata/ethereum/receipt_54.json (100%) rename {common => pkg}/testdata/ethereum/receipt_55.json (100%) rename {common => pkg}/testdata/ethereum/receipt_56.json (100%) rename {common => pkg}/testdata/ethereum/receipt_57.json (100%) rename {common => pkg}/testdata/ethereum/receipt_58.json (100%) rename {common => pkg}/testdata/ethereum/receipt_59.json (100%) rename {common => pkg}/testdata/ethereum/receipt_6.json (100%) rename {common => pkg}/testdata/ethereum/receipt_60.json (100%) rename {common => pkg}/testdata/ethereum/receipt_61.json (100%) rename {common => pkg}/testdata/ethereum/receipt_62.json (100%) rename {common => pkg}/testdata/ethereum/receipt_63.json (100%) rename {common => pkg}/testdata/ethereum/receipt_64.json (100%) rename {common => pkg}/testdata/ethereum/receipt_65.json (100%) rename {common => pkg}/testdata/ethereum/receipt_66.json (100%) rename {common => pkg}/testdata/ethereum/receipt_67.json (100%) rename {common => pkg}/testdata/ethereum/receipt_68.json (100%) rename {common => pkg}/testdata/ethereum/receipt_69.json (100%) rename {common => pkg}/testdata/ethereum/receipt_7.json (100%) rename {common => pkg}/testdata/ethereum/receipt_70.json (100%) rename {common => pkg}/testdata/ethereum/receipt_71.json (100%) rename {common => pkg}/testdata/ethereum/receipt_72.json (100%) rename {common => pkg}/testdata/ethereum/receipt_73.json (100%) rename {common => pkg}/testdata/ethereum/receipt_74.json (100%) rename {common => pkg}/testdata/ethereum/receipt_75.json (100%) rename {common => pkg}/testdata/ethereum/receipt_76.json (100%) rename {common => pkg}/testdata/ethereum/receipt_77.json (100%) rename {common => pkg}/testdata/ethereum/receipt_78.json (100%) rename {common => pkg}/testdata/ethereum/receipt_79.json (100%) rename {common => pkg}/testdata/ethereum/receipt_8.json (100%) rename {common => pkg}/testdata/ethereum/receipt_80.json (100%) rename {common => pkg}/testdata/ethereum/receipt_9.json (100%) rename {common => pkg}/testdata/ethereum/tx_0.json (100%) rename {common => pkg}/testdata/ethereum/tx_1.json (100%) rename {common => pkg}/testdata/ethereum/tx_10.json (100%) rename {common => pkg}/testdata/ethereum/tx_11.json (100%) rename {common => pkg}/testdata/ethereum/tx_12.json (100%) rename {common => pkg}/testdata/ethereum/tx_13.json (100%) rename {common => pkg}/testdata/ethereum/tx_14.json (100%) rename {common => pkg}/testdata/ethereum/tx_15.json (100%) rename {common => pkg}/testdata/ethereum/tx_16.json (100%) rename {common => pkg}/testdata/ethereum/tx_17.json (100%) rename {common => pkg}/testdata/ethereum/tx_18.json (100%) rename {common => pkg}/testdata/ethereum/tx_19.json (100%) rename {common => pkg}/testdata/ethereum/tx_2.json (100%) rename {common => pkg}/testdata/ethereum/tx_20.json (100%) rename {common => pkg}/testdata/ethereum/tx_21.json (100%) rename {common => pkg}/testdata/ethereum/tx_22.json (100%) rename {common => pkg}/testdata/ethereum/tx_23.json (100%) rename {common => pkg}/testdata/ethereum/tx_24.json (100%) rename {common => pkg}/testdata/ethereum/tx_25.json (100%) rename {common => pkg}/testdata/ethereum/tx_26.json (100%) rename {common => pkg}/testdata/ethereum/tx_27.json (100%) rename {common => pkg}/testdata/ethereum/tx_28.json (100%) rename {common => pkg}/testdata/ethereum/tx_29.json (100%) rename {common => pkg}/testdata/ethereum/tx_3.json (100%) rename {common => pkg}/testdata/ethereum/tx_30.json (100%) rename {common => pkg}/testdata/ethereum/tx_31.json (100%) rename {common => pkg}/testdata/ethereum/tx_32.json (100%) rename {common => pkg}/testdata/ethereum/tx_33.json (100%) rename {common => pkg}/testdata/ethereum/tx_34.json (100%) rename {common => pkg}/testdata/ethereum/tx_35.json (100%) rename {common => pkg}/testdata/ethereum/tx_36.json (100%) rename {common => pkg}/testdata/ethereum/tx_37.json (100%) rename {common => pkg}/testdata/ethereum/tx_38.json (100%) rename {common => pkg}/testdata/ethereum/tx_39.json (100%) rename {common => pkg}/testdata/ethereum/tx_4.json (100%) rename {common => pkg}/testdata/ethereum/tx_40.json (100%) rename {common => pkg}/testdata/ethereum/tx_41.json (100%) rename {common => pkg}/testdata/ethereum/tx_42.json (100%) rename {common => pkg}/testdata/ethereum/tx_43.json (100%) rename {common => pkg}/testdata/ethereum/tx_44.json (100%) rename {common => pkg}/testdata/ethereum/tx_45.json (100%) rename {common => pkg}/testdata/ethereum/tx_46.json (100%) rename {common => pkg}/testdata/ethereum/tx_47.json (100%) rename {common => pkg}/testdata/ethereum/tx_48.json (100%) rename {common => pkg}/testdata/ethereum/tx_49.json (100%) rename {common => pkg}/testdata/ethereum/tx_5.json (100%) rename {common => pkg}/testdata/ethereum/tx_50.json (100%) rename {common => pkg}/testdata/ethereum/tx_51.json (100%) rename {common => pkg}/testdata/ethereum/tx_52.json (100%) rename {common => pkg}/testdata/ethereum/tx_53.json (100%) rename {common => pkg}/testdata/ethereum/tx_54.json (100%) rename {common => pkg}/testdata/ethereum/tx_55.json (100%) rename {common => pkg}/testdata/ethereum/tx_56.json (100%) rename {common => pkg}/testdata/ethereum/tx_57.json (100%) rename {common => pkg}/testdata/ethereum/tx_58.json (100%) rename {common => pkg}/testdata/ethereum/tx_59.json (100%) rename {common => pkg}/testdata/ethereum/tx_6.json (100%) rename {common => pkg}/testdata/ethereum/tx_60.json (100%) rename {common => pkg}/testdata/ethereum/tx_61.json (100%) rename {common => pkg}/testdata/ethereum/tx_62.json (100%) rename {common => pkg}/testdata/ethereum/tx_63.json (100%) rename {common => pkg}/testdata/ethereum/tx_64.json (100%) rename {common => pkg}/testdata/ethereum/tx_65.json (100%) rename {common => pkg}/testdata/ethereum/tx_66.json (100%) rename {common => pkg}/testdata/ethereum/tx_67.json (100%) rename {common => pkg}/testdata/ethereum/tx_68.json (100%) rename {common => pkg}/testdata/ethereum/tx_69.json (100%) rename {common => pkg}/testdata/ethereum/tx_7.json (100%) rename {common => pkg}/testdata/ethereum/tx_70.json (100%) rename {common => pkg}/testdata/ethereum/tx_71.json (100%) rename {common => pkg}/testdata/ethereum/tx_72.json (100%) rename {common => pkg}/testdata/ethereum/tx_73.json (100%) rename {common => pkg}/testdata/ethereum/tx_74.json (100%) rename {common => pkg}/testdata/ethereum/tx_75.json (100%) rename {common => pkg}/testdata/ethereum/tx_76.json (100%) rename {common => pkg}/testdata/ethereum/tx_77.json (100%) rename {common => pkg}/testdata/ethereum/tx_78.json (100%) rename {common => pkg}/testdata/ethereum/tx_79.json (100%) rename {common => pkg}/testdata/ethereum/tx_8.json (100%) rename {common => pkg}/testdata/ethereum/tx_80.json (100%) rename {common => pkg}/testdata/ethereum/tx_9.json (100%) rename {common => pkg}/testdata/test_blocks.json (100%) rename {common => pkg}/testdata/testdata.go (100%) delete mode 100644 proto/common/common.proto create mode 100644 proto/pkg/chains/chains.proto create mode 100644 proto/pkg/coin/coin.proto create mode 100644 proto/pkg/crypto/crypto.proto rename proto/{common => pkg/proofs}/bitcoin/bitcoin.proto (61%) rename proto/{common => pkg/proofs}/ethereum/ethereum.proto (60%) create mode 100644 proto/pkg/proofs/proofs.proto delete mode 100644 typescript/common/common_pb.d.ts delete mode 100644 typescript/common/index.d.ts create mode 100644 typescript/pkg/chains/chains_pb.d.ts create mode 100644 typescript/pkg/chains/index.d.ts create mode 100644 typescript/pkg/coin/coin_pb.d.ts create mode 100644 typescript/pkg/coin/index.d.ts create mode 100644 typescript/pkg/crypto/crypto_pb.d.ts create mode 100644 typescript/pkg/crypto/index.d.ts rename typescript/{common => pkg/proofs}/bitcoin/bitcoin_pb.d.ts (92%) rename typescript/{common => pkg/proofs}/bitcoin/index.d.ts (100%) rename typescript/{common => pkg/proofs}/ethereum/ethereum_pb.d.ts (92%) rename typescript/{common => pkg/proofs}/ethereum/index.d.ts (100%) create mode 100644 typescript/pkg/proofs/index.d.ts create mode 100644 typescript/pkg/proofs/proofs_pb.d.ts diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 0b3917dead..16541f2291 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -56,10 +56,10 @@ builds: - -X github.com/cosmos/cosmos-sdk/version.ClientName=zetaclientd - -X github.com/cosmos/cosmos-sdk/version.Version={{ .Version }} - -X github.com/cosmos/cosmos-sdk/version.Commit={{ .Env.COMMIT }} - - -X github.com/zeta-chain/zetacore/common.Name=zetacored - - -X github.com/zeta-chain/zetacore/common.Version={{ .Version }} - - -X github.com/zeta-chain/zetacore/common.CommitHash={{ .Env.COMMIT }} - - -X github.com/zeta-chain/zetacore/common.BuildTime=={{ .Env.BUILDTIME }} + - -X github.com/zeta-chain/zetacore/pkg/constant.Name=zetacored + - -X github.com/zeta-chain/zetacore/pkg/constant.Version={{ .Version }} + - -X github.com/zeta-chain/zetacore/pkg/constant.CommitHash={{ .Env.COMMIT }} + - -X github.com/zeta-chain/zetacore/pkg/constant.BuildTime={{ .Env.BUILDTIME }} - -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb - id: "zetaclientd" diff --git a/Makefile b/Makefile index 9a4ccfe3fa..b8a6d7415f 100644 --- a/Makefile +++ b/Makefile @@ -12,10 +12,10 @@ ldflags = -X github.com/cosmos/cosmos-sdk/version.Name=zetacore \ -X github.com/cosmos/cosmos-sdk/version.ClientName=zetaclientd \ -X github.com/cosmos/cosmos-sdk/version.Version=$(VERSION) \ -X github.com/cosmos/cosmos-sdk/version.Commit=$(COMMIT) \ - -X github.com/zeta-chain/zetacore/common.Name=zetacored \ - -X github.com/zeta-chain/zetacore/common.Version=$(VERSION) \ - -X github.com/zeta-chain/zetacore/common.CommitHash=$(COMMIT) \ - -X github.com/zeta-chain/zetacore/common.BuildTime=$(BUILDTIME) \ + -X github.com/zeta-chain/zetacore/pkg/constant.Name=zetacored \ + -X github.com/zeta-chain/zetacore/pkg/constant.Version=$(VERSION) \ + -X github.com/zeta-chain/zetacore/pkg/constant.CommitHash=$(COMMIT) \ + -X github.com/zeta-chain/zetacore/pkg/constant.BuildTime=$(BUILDTIME) \ -X github.com/cosmos/cosmos-sdk/types.DBBackend=pebbledb BUILD_FLAGS := -ldflags '$(ldflags)' -tags pebbledb,ledger diff --git a/changelog.md b/changelog.md index a75fda8219..b1a6037800 100644 --- a/changelog.md +++ b/changelog.md @@ -20,6 +20,7 @@ * [1885](https://github.com/zeta-chain/node/pull/1885) - change important metrics on port 8123 to be prometheus compatible * [1863](https://github.com/zeta-chain/node/pull/1863) - remove duplicate ValidateChainParams function * [1914](https://github.com/zeta-chain/node/pull/1914) - move crosschain flags to core context in zetaclient +* [1936](https://github.com/zeta-chain/node/pull/1936) - refactor common package into subpackages and rename to pkg ### Features diff --git a/cmd/zetaclientd/debug.go b/cmd/zetaclientd/debug.go index 93d9717d9f..76450875cb 100644 --- a/cmd/zetaclientd/debug.go +++ b/cmd/zetaclientd/debug.go @@ -10,6 +10,8 @@ import ( "github.com/ethereum/go-ethereum/ethclient" "github.com/onrik/ethrpc" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/zetaclient/bitcoin" corecontext "github.com/zeta-chain/zetacore/zetaclient/core_context" "github.com/zeta-chain/zetacore/zetaclient/evm" @@ -22,7 +24,6 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog" "github.com/spf13/cobra" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/testutil/sample" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/config" @@ -90,12 +91,12 @@ func DebugCmd() *cobra.Command { return err } - chain := common.GetChainFromChainID(chainID) + chain := chains.GetChainFromChainID(chainID) if chain == nil { return fmt.Errorf("invalid chain id") } - if common.IsEVMChain(chain.ChainId) { + if chains.IsEVMChain(chain.ChainId) { ob := evm.ChainClient{ Mu: &sync.Mutex{}, @@ -104,7 +105,7 @@ func DebugCmd() *cobra.Command { ob.WithLogger(chainLogger) var ethRPC *ethrpc.EthRPC var client *ethclient.Client - coinType := common.CoinType_Cmd + coinType := coin.CoinType_Cmd for chain, evmConfig := range cfg.GetAllEVMConfigs() { if chainID == chain { ethRPC = ethrpc.NewEthRPC(evmConfig.Endpoint) @@ -114,7 +115,7 @@ func DebugCmd() *cobra.Command { } ob.WithEvmClient(client) ob.WithEvmJSONRPC(ethRPC) - ob.WithChain(*common.GetChainFromChainID(chainID)) + ob.WithChain(*chains.GetChainFromChainID(chainID)) } } hash := ethcommon.HexToHash(txHash) @@ -144,29 +145,29 @@ func DebugCmd() *cobra.Command { } evmChainParams.ZetaTokenContractAddress = chainParams.ZetaTokenContractAddress if strings.EqualFold(tx.To, chainParams.ConnectorContractAddress) { - coinType = common.CoinType_Zeta + coinType = coin.CoinType_Zeta } else if strings.EqualFold(tx.To, chainParams.Erc20CustodyContractAddress) { - coinType = common.CoinType_ERC20 + coinType = coin.CoinType_ERC20 } else if strings.EqualFold(tx.To, tssEthAddress) { - coinType = common.CoinType_Gas + coinType = coin.CoinType_Gas } } } switch coinType { - case common.CoinType_Zeta: + case coin.CoinType_Zeta: ballotIdentifier, err = ob.CheckAndVoteInboundTokenZeta(tx, receipt, false) if err != nil { return err } - case common.CoinType_ERC20: + case coin.CoinType_ERC20: ballotIdentifier, err = ob.CheckAndVoteInboundTokenERC20(tx, receipt, false) if err != nil { return err } - case common.CoinType_Gas: + case coin.CoinType_Gas: ballotIdentifier, err = ob.CheckAndVoteInboundTokenGas(tx, receipt, false) if err != nil { return err @@ -175,13 +176,13 @@ func DebugCmd() *cobra.Command { fmt.Println("CoinType not detected") } fmt.Println("CoinType : ", coinType) - } else if common.IsBitcoinChain(chain.ChainId) { + } else if chains.IsBitcoinChain(chain.ChainId) { obBtc := bitcoin.BTCChainClient{ Mu: &sync.Mutex{}, } obBtc.WithZetaClient(bridge) obBtc.WithLogger(chainLogger) - obBtc.WithChain(*common.GetChainFromChainID(chainID)) + obBtc.WithChain(*chains.GetChainFromChainID(chainID)) connCfg := &rpcclient.ConnConfig{ Host: cfg.BitcoinConfig.RPCHost, User: cfg.BitcoinConfig.RPCUsername, diff --git a/cmd/zetaclientd/hsm.go b/cmd/zetaclientd/hsm.go index d15ac3b1bd..578d7909cb 100644 --- a/cmd/zetaclientd/hsm.go +++ b/cmd/zetaclientd/hsm.go @@ -3,11 +3,12 @@ package main import ( "fmt" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/pkg/errors" "github.com/spf13/cobra" keystone "github.com/zeta-chain/keystone/keys" "github.com/zeta-chain/zetacore/cmd" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/cosmos" "github.com/zeta-chain/zetacore/zetaclient/hsm" ) @@ -63,7 +64,7 @@ func GetHsmAddress(_ *cobra.Command, _ []string) error { return err } - address, err := cosmos.Bech32ifyAddressBytes(cmd.Bech32PrefixAccAddr, pubKey.Address().Bytes()) + address, err := sdk.Bech32ifyAddressBytes(cmd.Bech32PrefixAccAddr, pubKey.Address().Bytes()) if err != nil { return err } diff --git a/cmd/zetaclientd/keygen_tss.go b/cmd/zetaclientd/keygen_tss.go index 16f79581b5..72c7946da3 100644 --- a/cmd/zetaclientd/keygen_tss.go +++ b/cmd/zetaclientd/keygen_tss.go @@ -17,7 +17,7 @@ import ( tsscommon "github.com/zeta-chain/go-tss/common" "github.com/zeta-chain/go-tss/keygen" "github.com/zeta-chain/go-tss/p2p" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/metrics" ) @@ -37,7 +37,7 @@ func GenerateTss( // Bitcoin chain ID is currently used for using the correct signature format // TODO: remove this once we have a better way to determine the signature format // https://github.com/zeta-chain/node/issues/1397 - bitcoinChainID := common.BtcRegtestChain().ChainId + bitcoinChainID := chains.BtcRegtestChain().ChainId btcChain, _, btcEnabled := appContext.GetBTCChainAndConfig() if btcEnabled { bitcoinChainID = btcChain.ChainId @@ -109,7 +109,7 @@ func GenerateTss( err = keygenTss(keyGen, tss, keygenLogger) if err != nil { keygenLogger.Error().Err(err).Msg("keygenTss error") - tssFailedVoteHash, err := zetaBridge.SetTSS("", keyGen.BlockNumber, common.ReceiveStatus_Failed) + tssFailedVoteHash, err := zetaBridge.SetTSS("", keyGen.BlockNumber, chains.ReceiveStatus_Failed) if err != nil { keygenLogger.Error().Err(err).Msg("Failed to broadcast Failed TSS Vote to zetacore") return nil, err @@ -127,7 +127,7 @@ func GenerateTss( } // If TSS is successful , broadcast the vote to zetacore and set Pubkey - tssSuccessVoteHash, err := zetaBridge.SetTSS(newTss.CurrentPubkey, keyGen.BlockNumber, common.ReceiveStatus_Success) + tssSuccessVoteHash, err := zetaBridge.SetTSS(newTss.CurrentPubkey, keyGen.BlockNumber, chains.ReceiveStatus_Success) if err != nil { keygenLogger.Error().Err(err).Msg("TSS successful but unable to broadcast vote to zeta-core") return nil, err diff --git a/cmd/zetaclientd/main.go b/cmd/zetaclientd/main.go index 07654a0375..9502c438f9 100644 --- a/cmd/zetaclientd/main.go +++ b/cmd/zetaclientd/main.go @@ -13,7 +13,6 @@ import ( "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/cmd" - "github.com/zeta-chain/zetacore/common/cosmos" //mcconfig "github.com/Meta-Protocol/zetacore/metaclient/config" "github.com/cosmos/cosmos-sdk/types" @@ -46,7 +45,7 @@ func main() { } func SetupConfigForTest() { - config := cosmos.GetConfig() + config := types.GetConfig() config.SetBech32PrefixForAccount(cmd.Bech32PrefixAccAddr, cmd.Bech32PrefixAccPub) config.SetBech32PrefixForValidator(cmd.Bech32PrefixValAddr, cmd.Bech32PrefixValPub) config.SetBech32PrefixForConsensusNode(cmd.Bech32PrefixConsAddr, cmd.Bech32PrefixConsPub) diff --git a/cmd/zetaclientd/p2p_diagnostics.go b/cmd/zetaclientd/p2p_diagnostics.go index 72a1580224..3ece29933d 100644 --- a/cmd/zetaclientd/p2p_diagnostics.go +++ b/cmd/zetaclientd/p2p_diagnostics.go @@ -22,7 +22,7 @@ import ( "github.com/rs/zerolog" "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/zeta-chain/go-tss/p2p" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/cosmos" "github.com/zeta-chain/zetacore/zetaclient/config" ) diff --git a/cmd/zetaclientd/start.go b/cmd/zetaclientd/start.go index f402b26b4d..56d77e0950 100644 --- a/cmd/zetaclientd/start.go +++ b/cmd/zetaclientd/start.go @@ -20,7 +20,8 @@ import ( "github.com/spf13/cobra" "github.com/tendermint/tendermint/crypto/secp256k1" "github.com/zeta-chain/go-tss/p2p" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/authz" + "github.com/zeta-chain/zetacore/pkg/constant" observerTypes "github.com/zeta-chain/zetacore/x/observer/types" mc "github.com/zeta-chain/zetacore/zetaclient" appcontext "github.com/zeta-chain/zetacore/zetaclient/app_context" @@ -99,7 +100,7 @@ func start(_ *cobra.Command, _ []string) error { } zetaBridge.WaitForCoreToCreateBlocks() startLogger.Info().Msgf("ZetaBridge is ready") - zetaBridge.SetAccountNumber(common.ZetaClientGranteeKey) + zetaBridge.SetAccountNumber(authz.ZetaClientGranteeKey) // cross-check chainid res, err := zetaBridge.GetNodeInfo() @@ -169,7 +170,7 @@ func start(_ *cobra.Command, _ []string) error { } m.Start() - metrics.Info.WithLabelValues(common.Version).Set(1) + metrics.Info.WithLabelValues(constant.Version).Set(1) metrics.LastStartTime.SetToCurrentTime() var tssHistoricalList []observerTypes.TSS diff --git a/cmd/zetaclientd/utils.go b/cmd/zetaclientd/utils.go index e7e9bdc7ca..1ea6eb8c5b 100644 --- a/cmd/zetaclientd/utils.go +++ b/cmd/zetaclientd/utils.go @@ -3,7 +3,6 @@ package main import ( sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/common/cosmos" appcontext "github.com/zeta-chain/zetacore/zetaclient/app_context" "github.com/zeta-chain/zetacore/zetaclient/authz" "github.com/zeta-chain/zetacore/zetaclient/bitcoin" @@ -34,7 +33,7 @@ func CreateZetaBridge(cfg config.Config, telemetry *metrics.TelemetryServer, hot return nil, err } - granterAddreess, err := cosmos.AccAddressFromBech32(cfg.AuthzGranter) + granterAddreess, err := sdk.AccAddressFromBech32(cfg.AuthzGranter) if err != nil { return nil, err } diff --git a/cmd/zetaclientd/version.go b/cmd/zetaclientd/version.go index 285545e74f..0cdc1ac59e 100644 --- a/cmd/zetaclientd/version.go +++ b/cmd/zetaclientd/version.go @@ -4,7 +4,7 @@ import ( "fmt" "github.com/spf13/cobra" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/constant" ) var VersionCmd = &cobra.Command{ @@ -14,6 +14,6 @@ var VersionCmd = &cobra.Command{ } func Version(_ *cobra.Command, _ []string) error { - fmt.Printf(common.Version) + fmt.Printf(constant.Version) return nil } diff --git a/cmd/zetacored/get_pubkey.go b/cmd/zetacored/get_pubkey.go index a924c199af..4743a5dd14 100644 --- a/cmd/zetacored/get_pubkey.go +++ b/cmd/zetacored/get_pubkey.go @@ -6,8 +6,8 @@ import ( "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/crypto" "github.com/spf13/cobra" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/cosmos" + zetacrypto "github.com/zeta-chain/zetacore/pkg/crypto" ) func GetPubKeyCmd() *cobra.Command { @@ -33,8 +33,8 @@ func GetPubKeyCmd() *cobra.Command { return cmd } -func GetPubKeySet(clientctx client.Context, tssAccountName, password string) (common.PubKeySet, error) { - pubkeySet := common.PubKeySet{ +func GetPubKeySet(clientctx client.Context, tssAccountName, password string) (zetacrypto.PubKeySet, error) { + pubkeySet := zetacrypto.PubKeySet{ Secp256k1: "", Ed25519: "", } @@ -52,7 +52,7 @@ func GetPubKeySet(clientctx client.Context, tssAccountName, password string) (co if err != nil { return pubkeySet, err } - pubkey, err := common.NewPubKey(s) + pubkey, err := zetacrypto.NewPubKey(s) if err != nil { return pubkeySet, err } diff --git a/cmd/zetacored/observer_accounts.go b/cmd/zetacored/observer_accounts.go index 38768c5926..a4f6dedf84 100644 --- a/cmd/zetacored/observer_accounts.go +++ b/cmd/zetacored/observer_accounts.go @@ -23,7 +23,7 @@ import ( "github.com/spf13/cobra" "github.com/zeta-chain/zetacore/app" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/crypto" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -115,11 +115,11 @@ func AddObserverAccountsCmd() *cobra.Command { observerSet.ObserverList = append(observerSet.ObserverList, info.ObserverAddress) if info.ZetaClientGranteePubKey != "" { - pubkey, err := common.NewPubKey(info.ZetaClientGranteePubKey) + pubkey, err := crypto.NewPubKey(info.ZetaClientGranteePubKey) if err != nil { panic(err) } - pubkeySet := common.PubKeySet{ + pubkeySet := crypto.PubKeySet{ Secp256k1: pubkey, Ed25519: "", } diff --git a/cmd/zetatool/filterdeposit/btc.go b/cmd/zetatool/filterdeposit/btc.go index bc2397523d..684bb4b428 100644 --- a/cmd/zetatool/filterdeposit/btc.go +++ b/cmd/zetatool/filterdeposit/btc.go @@ -13,7 +13,7 @@ import ( "github.com/spf13/cobra" "github.com/zeta-chain/zetacore/cmd/zetatool/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/constant" ) func NewBtcCmd() *cobra.Command { @@ -162,7 +162,7 @@ func getHashList(cfg *config.Config, tssAddress string) ([]Deposit, error) { if err != nil { continue } - if bytes.Equal(memoBytes, []byte(common.DonationMessage)) { + if bytes.Equal(memoBytes, []byte(constant.DonationMessage)) { continue } } else { diff --git a/cmd/zetatool/filterdeposit/evm.go b/cmd/zetatool/filterdeposit/evm.go index 73e1f8b78f..e9ed6b3d63 100644 --- a/cmd/zetatool/filterdeposit/evm.go +++ b/cmd/zetatool/filterdeposit/evm.go @@ -18,7 +18,7 @@ import ( "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol" "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.non-eth.sol" "github.com/zeta-chain/zetacore/cmd/zetatool/config" - zetacommon "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/constant" ) const ( @@ -202,7 +202,7 @@ func getTSSDeposits(tssAddress string, startBlock uint64, endBlock uint64, apiKe for _, tx := range txns { if tx.To == tssAddress { - if strings.Compare(tx.Input, zetacommon.DonationMessage) == 0 { + if strings.Compare(tx.Input, constant.DonationMessage) == 0 { continue // skip donation tx } if tx.TxReceiptStatus != "1" { diff --git a/common/commands.go b/common/commands.go deleted file mode 100644 index eb51797c3d..0000000000 --- a/common/commands.go +++ /dev/null @@ -1,8 +0,0 @@ -package common - -// commands for the zetaclient; mostly administrative commands/txs - -const ( - CmdWhitelistERC20 = "cmd_whitelist_erc20" - CmdMigrateTssFunds = "cmd_migrate_tss_funds" -) diff --git a/common/constant.go b/common/constant.go deleted file mode 100644 index 8280246a80..0000000000 --- a/common/constant.go +++ /dev/null @@ -1,7 +0,0 @@ -package common - -const ( - // DonationMessage is the message for donation transactions - // Transaction sent to the TSS or ERC20 Custody address containing this message are considered as a donation - DonationMessage = "I am rich!" -) diff --git a/common/cosmos/cosmos.go b/common/cosmos/cosmos.go deleted file mode 100644 index 9d0c072a8c..0000000000 --- a/common/cosmos/cosmos.go +++ /dev/null @@ -1,72 +0,0 @@ -package cosmos - -import ( - sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/cosmos/cosmos-sdk/types/bech32/legacybech32" // nolint - se "github.com/cosmos/cosmos-sdk/types/errors" - authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" -) - -const DefaultCoinDecimals = 18 - -var ( - KeyringServiceName = sdk.KeyringServiceName - NewRoute = sdk.NewRoute - NewKVStoreKeys = sdk.NewKVStoreKeys - NewUint = sdk.NewUint - NewInt = sdk.NewInt - NewDec = sdk.NewDec - ZeroDec = sdk.ZeroDec - NewCoin = sdk.NewCoin - NewCoins = sdk.NewCoins - ParseCoins = sdk.ParseCoinsNormalized - NewDecWithPrec = sdk.NewDecWithPrec - NewDecFromBigInt = sdk.NewDecFromBigInt - NewIntFromBigInt = sdk.NewIntFromBigInt - AccAddressFromBech32 = sdk.AccAddressFromBech32 - VerifyAddressFormat = sdk.VerifyAddressFormat - GetFromBech32 = sdk.GetFromBech32 - NewAttribute = sdk.NewAttribute - NewDecFromStr = sdk.NewDecFromStr - GetConfig = sdk.GetConfig - NewEvent = sdk.NewEvent - RegisterCodec = sdk.RegisterLegacyAminoCodec - NewEventManager = sdk.NewEventManager - EventTypeMessage = sdk.EventTypeMessage - AttributeKeyModule = sdk.AttributeKeyModule - KVStorePrefixIterator = sdk.KVStorePrefixIterator - NewKVStoreKey = sdk.NewKVStoreKey - NewTransientStoreKey = sdk.NewTransientStoreKey - NewContext = sdk.NewContext - Bech32ifyAddressBytes = sdk.Bech32ifyAddressBytes - GetPubKeyFromBech32 = legacybech32.UnmarshalPubKey - Bech32ifyPubKey = legacybech32.MarshalPubKey - Bech32PubKeyTypeConsPub = legacybech32.ConsPK - Bech32PubKeyTypeAccPub = legacybech32.AccPK - Wrapf = se.Wrapf - MustSortJSON = sdk.MustSortJSON - CodeUnauthorized = uint32(4) - CodeInsufficientFunds = uint32(5) -) - -type ( - Context = sdk.Context - Route = sdk.Route - Uint = sdk.Uint - Coin = sdk.Coin - Coins = sdk.Coins - AccAddress = sdk.AccAddress - Attribute = sdk.Attribute - Result = sdk.Result - Event = sdk.Event - Events = sdk.Events - Dec = sdk.Dec - Msg = sdk.Msg - Iterator = sdk.Iterator - Handler = sdk.Handler - Querier = sdk.Querier - TxResponse = sdk.TxResponse - Account = authtypes.AccountI -) - -var _ sdk.Address = AccAddress{} diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index dc7759c5a2..804a4fd88c 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -53521,33 +53521,15 @@ definitions: index: type: integer format: int64 - commonBlockHeader: - type: object - properties: - height: - type: string - format: int64 - hash: - type: string - format: byte - parent_hash: - type: string - format: byte - chain_id: - type: string - format: int64 - header: - $ref: '#/definitions/commonHeaderData' - title: chain specific header - commonChain: + chainsChain: type: object properties: chain_name: - $ref: '#/definitions/commonChainName' + $ref: '#/definitions/chainsChainName' chain_id: type: string format: int64 - commonChainName: + chainsChainName: type: string enum: - empty @@ -53573,7 +53555,15 @@ definitions: zeta_localnet = 13; - btc_regtest: Athens zeta_athensnet=15; - commonCoinType: + chainsReceiveStatus: + type: string + enum: + - Created + - Success + - Failed + default: Created + title: '- Created: some observer sees inbound tx' + coinCoinType: type: string enum: - Zeta @@ -53585,40 +53575,6 @@ definitions: - Gas: Ether, BNB, Matic, Klay, BTC, etc - ERC20: ERC20 token - Cmd: not a real coin, rather a command - commonHeaderData: - type: object - properties: - ethereum_header: - type: string - format: byte - title: binary encoded headers; RLP for ethereum - bitcoin_header: - type: string - format: byte - title: 80-byte little-endian encoded binary data - commonProof: - type: object - properties: - ethereum_proof: - $ref: '#/definitions/ethereumProof' - bitcoin_proof: - $ref: '#/definitions/bitcoinProof' - commonPubKeySet: - type: object - properties: - secp256k1: - type: string - ed25519: - type: string - title: PubKeySet contains two pub keys , secp256k1 and ed25519 - commonReceiveStatus: - type: string - enum: - - Created - - Success - - Failed - default: Created - title: '- Created: some observer sees inbound tx' crosschainCctxStatus: type: string enum: @@ -53702,7 +53658,7 @@ definitions: tx_hash: type: string coin_type: - $ref: '#/definitions/commonCoinType' + $ref: '#/definitions/coinCoinType' crosschainInboundTxParams: type: object properties: @@ -53716,7 +53672,7 @@ definitions: type: string title: this address is the EOA that signs the inbound tx coin_type: - $ref: '#/definitions/commonCoinType' + $ref: '#/definitions/coinCoinType' asset: type: string title: for ERC20 coin type, the asset is an address of the ERC20 contract @@ -53808,7 +53764,7 @@ definitions: type: string format: int64 coin_type: - $ref: '#/definitions/commonCoinType' + $ref: '#/definitions/coinCoinType' amount: type: string outbound_tx_tss_nonce: @@ -54011,6 +53967,14 @@ definitions: type: string proved: type: boolean + cryptoPubKeySet: + type: object + properties: + secp256k1: + type: string + ed25519: + type: string + title: PubKeySet contains two pub keys , secp256k1 and ed25519 emissionsMsgWithdrawEmissionResponse: type: object emissionsQueryGetEmissionsFactorsResponse: @@ -54069,7 +54033,7 @@ definitions: symbol: type: string coin_type: - $ref: '#/definitions/commonCoinType' + $ref: '#/definitions/coinCoinType' gas_limit: type: string format: uint64 @@ -54393,7 +54357,7 @@ definitions: granteeAddress: type: string granteePubkey: - $ref: '#/definitions/commonPubKeySet' + $ref: '#/definitions/cryptoPubKeySet' nodeStatus: $ref: '#/definitions/observerNodeStatus' observerNodeStatus: @@ -54419,7 +54383,7 @@ definitions: type: object properties: chain: - $ref: '#/definitions/commonChain' + $ref: '#/definitions/chainsChain' ballot_threshold: type: string min_observer_delegation: @@ -54473,7 +54437,7 @@ definitions: type: array items: type: object - $ref: '#/definitions/commonBlockHeader' + $ref: '#/definitions/proofsBlockHeader' pagination: $ref: '#/definitions/v1beta1PageResponse' observerQueryAllChainNoncesResponse: @@ -54537,7 +54501,7 @@ definitions: type: object properties: block_header: - $ref: '#/definitions/commonBlockHeader' + $ref: '#/definitions/proofsBlockHeader' observerQueryGetBlockHeaderStateResponse: type: object properties: @@ -54619,7 +54583,7 @@ definitions: type: array items: type: object - $ref: '#/definitions/commonChain' + $ref: '#/definitions/chainsChain' observerQueryTssHistoryResponse: type: object properties: @@ -54664,6 +54628,42 @@ definitions: type: string vote_type: $ref: '#/definitions/observerVoteType' + proofsBlockHeader: + type: object + properties: + height: + type: string + format: int64 + hash: + type: string + format: byte + parent_hash: + type: string + format: byte + chain_id: + type: string + format: int64 + header: + $ref: '#/definitions/proofsHeaderData' + title: chain specific header + proofsHeaderData: + type: object + properties: + ethereum_header: + type: string + format: byte + title: binary encoded headers; RLP for ethereum + bitcoin_header: + type: string + format: byte + title: 80-byte little-endian encoded binary data + proofsProof: + type: object + properties: + ethereum_proof: + $ref: '#/definitions/ethereumProof' + bitcoin_proof: + $ref: '#/definitions/bitcoinProof' protobufAny: type: object properties: diff --git a/docs/spec/crosschain/messages.md b/docs/spec/crosschain/messages.md index d18adeb778..506ca0f94c 100644 --- a/docs/spec/crosschain/messages.md +++ b/docs/spec/crosschain/messages.md @@ -14,7 +14,7 @@ message MsgAddToOutTxTracker { int64 chain_id = 2; uint64 nonce = 3; string tx_hash = 4; - common.Proof proof = 5; + proofs.Proof proof = 5; string block_hash = 6; int64 tx_index = 7; } @@ -31,8 +31,8 @@ message MsgAddToInTxTracker { string creator = 1; int64 chain_id = 2; string tx_hash = 3; - common.CoinType coin_type = 4; - common.Proof proof = 5; + coin.CoinType coin_type = 4; + proofs.Proof proof = 5; string block_hash = 6; int64 tx_index = 7; } @@ -124,10 +124,10 @@ message MsgVoteOnObservedOutboundTx { string observed_outTx_effective_gas_price = 11; uint64 observed_outTx_effective_gas_limit = 12; string value_received = 5; - common.ReceiveStatus status = 6; + chains.ReceiveStatus status = 6; int64 outTx_chain = 7; uint64 outTx_tss_nonce = 8; - common.CoinType coin_type = 9; + coin.CoinType coin_type = 9; } ``` @@ -187,7 +187,7 @@ message MsgVoteOnObservedInboundTx { string in_tx_hash = 9; uint64 in_block_height = 10; uint64 gas_limit = 11; - common.CoinType coin_type = 12; + coin.CoinType coin_type = 12; string tx_origin = 13; string asset = 14; uint64 event_index = 15; @@ -254,7 +254,7 @@ message MsgCreateTSSVoter { string creator = 1; string tss_pubkey = 2; int64 keyGenZetaHeight = 3; - common.ReceiveStatus status = 4; + chains.ReceiveStatus status = 4; } ``` diff --git a/docs/spec/fungible/messages.md b/docs/spec/fungible/messages.md index 696cc70631..57c089699f 100644 --- a/docs/spec/fungible/messages.md +++ b/docs/spec/fungible/messages.md @@ -41,7 +41,7 @@ message MsgDeployFungibleCoinZRC20 { uint32 decimals = 4; string name = 5; string symbol = 6; - common.CoinType coin_type = 7; + coin.CoinType coin_type = 7; int64 gas_limit = 8; } ``` diff --git a/docs/spec/observer/messages.md b/docs/spec/observer/messages.md index dfa2d3d1de..9ddfdc0fd0 100644 --- a/docs/spec/observer/messages.md +++ b/docs/spec/observer/messages.md @@ -104,7 +104,7 @@ message MsgAddBlockHeader { int64 chain_id = 2; bytes block_hash = 3; int64 height = 4; - common.HeaderData header = 5; + proofs.HeaderData header = 5; } ``` diff --git a/e2e/e2etests/test_bitcoin_withdraw.go b/e2e/e2etests/test_bitcoin_withdraw.go index edd779b595..3920b7b3ce 100644 --- a/e2e/e2etests/test_bitcoin_withdraw.go +++ b/e2e/e2etests/test_bitcoin_withdraw.go @@ -8,9 +8,9 @@ import ( "github.com/btcsuite/btcd/btcjson" "github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcutil" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/e2e/runner" "github.com/zeta-chain/zetacore/e2e/utils" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/zetaclient/testutils" ) @@ -122,7 +122,7 @@ func WithdrawBitcoin(r *runner.E2ERunner, amount *big.Int) { func WithdrawBitcoinRestricted(r *runner.E2ERunner, amount *big.Int) { // use restricted BTC P2WPKH address - addressRestricted, err := common.DecodeBtcAddress(testutils.RestrictedBtcAddressTest, common.BtcRegtestChain().ChainId) + addressRestricted, err := chains.DecodeBtcAddress(testutils.RestrictedBtcAddressTest, chains.BtcRegtestChain().ChainId) if err != nil { panic(err) } diff --git a/e2e/e2etests/test_donation.go b/e2e/e2etests/test_donation.go index fbf4670c3e..f6d9bac3ff 100644 --- a/e2e/e2etests/test_donation.go +++ b/e2e/e2etests/test_donation.go @@ -3,9 +3,9 @@ package e2etests import ( "math/big" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/e2e/runner" "github.com/zeta-chain/zetacore/e2e/utils" + "github.com/zeta-chain/zetacore/pkg/constant" ) // TestDonationEther tests donation of ether to the tss address @@ -19,7 +19,7 @@ func TestDonationEther(r *runner.E2ERunner, args []string) { panic("Invalid amount specified for TestDonationEther.") } - txDonation, err := r.SendEther(r.TSSAddress, amount, []byte(common.DonationMessage)) + txDonation, err := r.SendEther(r.TSSAddress, amount, []byte(constant.DonationMessage)) if err != nil { panic(err) } diff --git a/e2e/e2etests/test_update_bytecode.go b/e2e/e2etests/test_update_bytecode.go index 6bf5bf9f70..a36af1db7c 100644 --- a/e2e/e2etests/test_update_bytecode.go +++ b/e2e/e2etests/test_update_bytecode.go @@ -4,10 +4,10 @@ import ( "math/big" "github.com/ethereum/go-ethereum/accounts/abi/bind" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/e2e/contracts/testzrc20" "github.com/zeta-chain/zetacore/e2e/runner" "github.com/zeta-chain/zetacore/e2e/utils" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/testutil/sample" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" ) @@ -32,7 +32,7 @@ func TestUpdateBytecode(r *runner.E2ERunner, _ []string) { r.ZEVMClient, big.NewInt(5), // #nosec G701 test - always in range - uint8(common.CoinType_Gas), + uint8(coin.CoinType_Gas), ) if err != nil { panic(err) diff --git a/e2e/e2etests/test_zeta_withdraw.go b/e2e/e2etests/test_zeta_withdraw.go index fd5d91cd14..2b5dc055e0 100644 --- a/e2e/e2etests/test_zeta_withdraw.go +++ b/e2e/e2etests/test_zeta_withdraw.go @@ -7,9 +7,9 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/connectorzevm.sol" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/e2e/runner" "github.com/zeta-chain/zetacore/e2e/utils" + "github.com/zeta-chain/zetacore/pkg/chains" cctxtypes "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -135,7 +135,7 @@ func TestZetaWithdrawBTCRevert(r *runner.E2ERunner, args []string) { lessThanAmount := amount.Div(amount, big.NewInt(10)) // 1/10 of amount tx, err = r.ConnectorZEVM.Send(r.ZEVMAuth, connectorzevm.ZetaInterfacesSendInput{ - DestinationChainId: big.NewInt(common.BtcRegtestChain().ChainId), + DestinationChainId: big.NewInt(chains.BtcRegtestChain().ChainId), DestinationAddress: r.DeployerAddress.Bytes(), DestinationGasLimit: big.NewInt(400_000), Message: nil, diff --git a/e2e/runner/bitcoin.go b/e2e/runner/bitcoin.go index 1aa9c52ea8..df0c2d1a23 100644 --- a/e2e/runner/bitcoin.go +++ b/e2e/runner/bitcoin.go @@ -15,9 +15,11 @@ import ( "github.com/btcsuite/btcutil" "github.com/ethereum/go-ethereum/accounts/abi/bind" "github.com/rs/zerolog/log" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/bitcoin" "github.com/zeta-chain/zetacore/e2e/utils" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/constant" + "github.com/zeta-chain/zetacore/pkg/proofs" + "github.com/zeta-chain/zetacore/pkg/proofs/bitcoin" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" zetabitcoin "github.com/zeta-chain/zetacore/zetaclient/bitcoin" @@ -117,7 +119,7 @@ func (runner *E2ERunner) DepositBTC(testHeader bool) { 0.11, utxos[4:5], btc, - []byte(common.DonationMessage), + []byte(constant.DonationMessage), runner.BTCDeployerAddress, ) if err != nil { @@ -387,10 +389,10 @@ func (runner *E2ERunner) ProveBTCTransaction(txHash *chainhash.Hash) { // verify merkle proof through RPC res, err := runner.ObserverClient.Prove(runner.Ctx, &observertypes.QueryProveRequest{ - ChainId: common.BtcRegtestChain().ChainId, + ChainId: chains.BtcRegtestChain().ChainId, TxHash: txHash.String(), BlockHash: blockHash.String(), - Proof: common.NewBitcoinProof(txBytes, path, index), + Proof: proofs.NewBitcoinProof(txBytes, path, index), TxIndex: 0, // bitcoin doesn't use txIndex }) if err != nil { diff --git a/e2e/runner/evm.go b/e2e/runner/evm.go index 119b93d79a..8a931eeccd 100644 --- a/e2e/runner/evm.go +++ b/e2e/runner/evm.go @@ -7,9 +7,10 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/ethereum" "github.com/zeta-chain/zetacore/e2e/utils" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/proofs" + "github.com/zeta-chain/zetacore/pkg/proofs/ethereum" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -244,8 +245,8 @@ func (runner *E2ERunner) ProveEthTransaction(receipt *ethtypes.Receipt) { BlockHash: blockHash.Hex(), TxIndex: int64(txIndex), TxHash: txHash.Hex(), - Proof: common.NewEthereumProof(txProof), - ChainId: common.GoerliLocalnetChain().ChainId, + Proof: proofs.NewEthereumProof(txProof), + ChainId: chains.GoerliLocalnetChain().ChainId, }) if err != nil { panic(err) diff --git a/e2e/runner/setup_evm.go b/e2e/runner/setup_evm.go index 5b95095344..e8ff909169 100644 --- a/e2e/runner/setup_evm.go +++ b/e2e/runner/setup_evm.go @@ -8,11 +8,11 @@ import ( "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol" zetaeth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zeta.eth.sol" zetaconnectoreth "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.eth.sol" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/contracts/erc20" "github.com/zeta-chain/zetacore/e2e/contracts/testdapp" "github.com/zeta-chain/zetacore/e2e/utils" + "github.com/zeta-chain/zetacore/pkg/constant" ) const ( @@ -62,7 +62,7 @@ func (runner *E2ERunner) SetupEVM(contractsDeployed bool) { // donate to the TSS address to avoid account errors because deploying gas token ZRC20 will automatically mint // gas token on ZetaChain to initialize the pool - txDonation, err := runner.SendEther(runner.TSSAddress, big.NewInt(101000000000000000), []byte(common.DonationMessage)) + txDonation, err := runner.SendEther(runner.TSSAddress, big.NewInt(101000000000000000), []byte(constant.DonationMessage)) if err != nil { panic(err) } diff --git a/e2e/runner/setup_zeta.go b/e2e/runner/setup_zeta.go index bb058a87d6..28d9f25658 100644 --- a/e2e/runner/setup_zeta.go +++ b/e2e/runner/setup_zeta.go @@ -5,6 +5,7 @@ import ( "time" "github.com/zeta-chain/zetacore/e2e/txserver" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/btcsuite/btcutil" "github.com/ethereum/go-ethereum/accounts/abi/bind" @@ -15,7 +16,6 @@ import ( "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-core/contracts/uniswapv2factory.sol" uniswapv2router "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/e2e/contracts/contextapp" "github.com/zeta-chain/zetacore/e2e/contracts/zevmswap" e2eutils "github.com/zeta-chain/zetacore/e2e/utils" @@ -31,7 +31,7 @@ var EmissionsPoolFunding = big.NewInt(0).Mul(big.NewInt(1e18), big.NewInt(2e7)) func (runner *E2ERunner) SetTSSAddresses() error { runner.Logger.Print("⚙️ setting up TSS address") - btcChainID, err := common.GetBTCChainIDFromChainParams(runner.BitcoinParams) + btcChainID, err := chains.GetBTCChainIDFromChainParams(runner.BitcoinParams) if err != nil { return err } @@ -175,7 +175,7 @@ func (runner *E2ERunner) SetZEVMContracts() { // SetupETHZRC20 sets up the ETH ZRC20 in the runner from the values queried from the chain func (runner *E2ERunner) SetupETHZRC20() { - ethZRC20Addr, err := runner.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.GoerliLocalnetChain().ChainId)) + ethZRC20Addr, err := runner.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(chains.GoerliLocalnetChain().ChainId)) if err != nil { panic(err) } @@ -192,7 +192,7 @@ func (runner *E2ERunner) SetupETHZRC20() { // SetupBTCZRC20 sets up the BTC ZRC20 in the runner from the values queried from the chain func (runner *E2ERunner) SetupBTCZRC20() { - BTCZRC20Addr, err := runner.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(common.BtcRegtestChain().ChainId)) + BTCZRC20Addr, err := runner.SystemContract.GasCoinZRC20ByChainId(&bind.CallOpts{}, big.NewInt(chains.BtcRegtestChain().ChainId)) if err != nil { panic(err) } diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index 910224d567..f610b8b2bf 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -34,7 +34,8 @@ import ( evmtypes "github.com/evmos/ethermint/x/evm/types" rpchttp "github.com/tendermint/tendermint/rpc/client/http" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" emissionstypes "github.com/zeta-chain/zetacore/x/emissions/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" @@ -233,11 +234,11 @@ func (zts ZetaTxServer) DeploySystemContractsAndZRC20(account, erc20Addr string) _, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20( addr.String(), "", - common.GoerliLocalnetChain().ChainId, + chains.GoerliLocalnetChain().ChainId, 18, "ETH", "gETH", - common.CoinType_Gas, + coin.CoinType_Gas, 100000, )) if err != nil { @@ -248,11 +249,11 @@ func (zts ZetaTxServer) DeploySystemContractsAndZRC20(account, erc20Addr string) _, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20( addr.String(), "", - common.BtcRegtestChain().ChainId, + chains.BtcRegtestChain().ChainId, 8, "BTC", "tBTC", - common.CoinType_Gas, + coin.CoinType_Gas, 100000, )) if err != nil { @@ -263,11 +264,11 @@ func (zts ZetaTxServer) DeploySystemContractsAndZRC20(account, erc20Addr string) res, err = zts.BroadcastTx(account, fungibletypes.NewMsgDeployFungibleCoinZRC20( addr.String(), erc20Addr, - common.GoerliLocalnetChain().ChainId, + chains.GoerliLocalnetChain().ChainId, 6, "USDT", "USDT", - common.CoinType_ERC20, + coin.CoinType_ERC20, 100000, )) if err != nil { diff --git a/common/authz_tx_types.go b/pkg/authz/authz_tx_types.go similarity index 97% rename from common/authz_tx_types.go rename to pkg/authz/authz_tx_types.go index 2eb205f6f9..74eafc93d0 100644 --- a/common/authz_tx_types.go +++ b/pkg/authz/authz_tx_types.go @@ -1,4 +1,4 @@ -package common +package authz type TxType string diff --git a/common/authz_tx_types_test.go b/pkg/authz/authz_tx_types_test.go similarity index 98% rename from common/authz_tx_types_test.go rename to pkg/authz/authz_tx_types_test.go index 2f5fcce8b1..49252706fe 100644 --- a/common/authz_tx_types_test.go +++ b/pkg/authz/authz_tx_types_test.go @@ -1,4 +1,4 @@ -package common +package authz import ( "testing" diff --git a/common/address.go b/pkg/chains/address.go similarity index 99% rename from common/address.go rename to pkg/chains/address.go index 6a2cdd7df1..6ee8647f8b 100644 --- a/common/address.go +++ b/pkg/chains/address.go @@ -1,4 +1,4 @@ -package common +package chains import ( "errors" diff --git a/common/address_test.go b/pkg/chains/address_test.go similarity index 99% rename from common/address_test.go rename to pkg/chains/address_test.go index dd78dda391..f34b1145c5 100644 --- a/common/address_test.go +++ b/pkg/chains/address_test.go @@ -1,4 +1,4 @@ -package common +package chains import ( "errors" diff --git a/common/bitcoin.go b/pkg/chains/bitcoin.go similarity index 98% rename from common/bitcoin.go rename to pkg/chains/bitcoin.go index 2392a344c7..42f5ee7db2 100644 --- a/common/bitcoin.go +++ b/pkg/chains/bitcoin.go @@ -1,4 +1,4 @@ -package common +package chains import ( "fmt" diff --git a/common/bitcoin_test.go b/pkg/chains/bitcoin_test.go similarity index 98% rename from common/bitcoin_test.go rename to pkg/chains/bitcoin_test.go index 9f4c075a25..042cc6acaa 100644 --- a/common/bitcoin_test.go +++ b/pkg/chains/bitcoin_test.go @@ -1,4 +1,4 @@ -package common +package chains import ( "testing" diff --git a/common/chain.go b/pkg/chains/chain.go similarity index 99% rename from common/chain.go rename to pkg/chains/chain.go index 20386e2a09..9d24216272 100644 --- a/common/chain.go +++ b/pkg/chains/chain.go @@ -1,4 +1,4 @@ -package common +package chains import ( "fmt" diff --git a/common/chain_id.go b/pkg/chains/chain_id.go similarity index 98% rename from common/chain_id.go rename to pkg/chains/chain_id.go index 1be8a0129a..18b0704752 100644 --- a/common/chain_id.go +++ b/pkg/chains/chain_id.go @@ -1,4 +1,4 @@ -package common +package chains import ( "errors" diff --git a/common/chain_id_test.go b/pkg/chains/chain_id_test.go similarity index 88% rename from common/chain_id_test.go rename to pkg/chains/chain_id_test.go index 142162b097..63395a2265 100644 --- a/common/chain_id_test.go +++ b/pkg/chains/chain_id_test.go @@ -1,10 +1,9 @@ -package common_test +package chains import ( "testing" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" ) func TestCosmosToEthChainID(t *testing.T) { @@ -51,7 +50,7 @@ func TestCosmosToEthChainID(t *testing.T) { for _, tc := range testCases { tc := tc t.Run(tc.name, func(t *testing.T) { - ethChainID, err := common.CosmosToEthChainID(tc.chainID) + ethChainID, err := CosmosToEthChainID(tc.chainID) if tc.isErr { require.Error(t, err) } else { diff --git a/common/chain_test.go b/pkg/chains/chain_test.go similarity index 99% rename from common/chain_test.go rename to pkg/chains/chain_test.go index f694439d8c..8d491d1780 100644 --- a/common/chain_test.go +++ b/pkg/chains/chain_test.go @@ -1,4 +1,4 @@ -package common +package chains import ( "encoding/hex" diff --git a/common/chains.go b/pkg/chains/chains.go similarity index 99% rename from common/chains.go rename to pkg/chains/chains.go index a689489818..ef1ffc9caf 100644 --- a/common/chains.go +++ b/pkg/chains/chains.go @@ -1,4 +1,4 @@ -package common +package chains import "fmt" diff --git a/pkg/chains/chains.pb.go b/pkg/chains/chains.pb.go new file mode 100644 index 0000000000..a305e7adbd --- /dev/null +++ b/pkg/chains/chains.pb.go @@ -0,0 +1,450 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pkg/chains/chains.proto + +package chains + +import ( + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type ReceiveStatus int32 + +const ( + ReceiveStatus_Created ReceiveStatus = 0 + ReceiveStatus_Success ReceiveStatus = 1 + ReceiveStatus_Failed ReceiveStatus = 2 +) + +var ReceiveStatus_name = map[int32]string{ + 0: "Created", + 1: "Success", + 2: "Failed", +} + +var ReceiveStatus_value = map[string]int32{ + "Created": 0, + "Success": 1, + "Failed": 2, +} + +func (x ReceiveStatus) String() string { + return proto.EnumName(ReceiveStatus_name, int32(x)) +} + +func (ReceiveStatus) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_37ad35e0488e8bbc, []int{0} +} + +type ChainName int32 + +const ( + ChainName_empty ChainName = 0 + ChainName_eth_mainnet ChainName = 1 + ChainName_zeta_mainnet ChainName = 2 + ChainName_btc_mainnet ChainName = 3 + ChainName_polygon_mainnet ChainName = 4 + ChainName_bsc_mainnet ChainName = 5 + // Testnet + ChainName_goerli_testnet ChainName = 6 + ChainName_mumbai_testnet ChainName = 7 + ChainName_ganache_testnet ChainName = 8 + ChainName_baobab_testnet ChainName = 9 + ChainName_bsc_testnet ChainName = 10 + ChainName_zeta_testnet ChainName = 11 + ChainName_btc_testnet ChainName = 12 + ChainName_sepolia_testnet ChainName = 13 + // LocalNet + // zeta_localnet = 13; + ChainName_goerli_localnet ChainName = 14 + ChainName_btc_regtest ChainName = 15 +) + +var ChainName_name = map[int32]string{ + 0: "empty", + 1: "eth_mainnet", + 2: "zeta_mainnet", + 3: "btc_mainnet", + 4: "polygon_mainnet", + 5: "bsc_mainnet", + 6: "goerli_testnet", + 7: "mumbai_testnet", + 8: "ganache_testnet", + 9: "baobab_testnet", + 10: "bsc_testnet", + 11: "zeta_testnet", + 12: "btc_testnet", + 13: "sepolia_testnet", + 14: "goerli_localnet", + 15: "btc_regtest", +} + +var ChainName_value = map[string]int32{ + "empty": 0, + "eth_mainnet": 1, + "zeta_mainnet": 2, + "btc_mainnet": 3, + "polygon_mainnet": 4, + "bsc_mainnet": 5, + "goerli_testnet": 6, + "mumbai_testnet": 7, + "ganache_testnet": 8, + "baobab_testnet": 9, + "bsc_testnet": 10, + "zeta_testnet": 11, + "btc_testnet": 12, + "sepolia_testnet": 13, + "goerli_localnet": 14, + "btc_regtest": 15, +} + +func (x ChainName) String() string { + return proto.EnumName(ChainName_name, int32(x)) +} + +func (ChainName) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_37ad35e0488e8bbc, []int{1} +} + +type Chain struct { + ChainName ChainName `protobuf:"varint,1,opt,name=chain_name,json=chainName,proto3,enum=chains.ChainName" json:"chain_name,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` +} + +func (m *Chain) Reset() { *m = Chain{} } +func (m *Chain) String() string { return proto.CompactTextString(m) } +func (*Chain) ProtoMessage() {} +func (*Chain) Descriptor() ([]byte, []int) { + return fileDescriptor_37ad35e0488e8bbc, []int{0} +} +func (m *Chain) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *Chain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_Chain.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 *Chain) XXX_Merge(src proto.Message) { + xxx_messageInfo_Chain.Merge(m, src) +} +func (m *Chain) XXX_Size() int { + return m.Size() +} +func (m *Chain) XXX_DiscardUnknown() { + xxx_messageInfo_Chain.DiscardUnknown(m) +} + +var xxx_messageInfo_Chain proto.InternalMessageInfo + +func (m *Chain) GetChainName() ChainName { + if m != nil { + return m.ChainName + } + return ChainName_empty +} + +func (m *Chain) GetChainId() int64 { + if m != nil { + return m.ChainId + } + return 0 +} + +func init() { + proto.RegisterEnum("chains.ReceiveStatus", ReceiveStatus_name, ReceiveStatus_value) + proto.RegisterEnum("chains.ChainName", ChainName_name, ChainName_value) + proto.RegisterType((*Chain)(nil), "chains.Chain") +} + +func init() { proto.RegisterFile("pkg/chains/chains.proto", fileDescriptor_37ad35e0488e8bbc) } + +var fileDescriptor_37ad35e0488e8bbc = []byte{ + // 390 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x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0x99, 0xcc, 0x30, + 0x09, 0xdc, 0xc5, 0xed, 0xef, 0x5f, 0x21, 0x59, 0xff, 0x71, 0xc1, 0xef, 0x1b, 0x52, 0x1f, 0x46, + 0x98, 0x97, 0xfa, 0x18, 0x38, 0x74, 0x06, 0x13, 0xd4, 0xe9, 0x21, 0x67, 0xb2, 0x28, 0x50, 0x07, + 0x84, 0x06, 0x70, 0xff, 0x03, 0x35, 0xeb, 0x89, 0x6b, 0x94, 0x58, 0xf3, 0x1e, 0xdc, 0xd0, 0xa7, + 0x30, 0x2b, 0x55, 0x76, 0x14, 0xaa, 0xe8, 0xe1, 0xad, 0xb5, 0xea, 0xc1, 0x1a, 0x51, 0x0a, 0x53, + 0xa1, 0xb0, 0xca, 0xe4, 0x41, 0x63, 0xad, 0x0d, 0xf3, 0x0c, 0xcb, 0x9b, 0x3c, 0x66, 0x03, 0x1b, + 0x9b, 0x6a, 0x82, 0x15, 0x8c, 0xa7, 0xd8, 0xc3, 0x3b, 0x23, 0xc6, 0x4c, 0xc5, 0x2c, 0xee, 0x99, + 0xdf, 0x75, 0xe8, 0x00, 0xf4, 0xa3, 0x76, 0x64, 0xd2, 0x8d, 0xda, 0x81, 0x7b, 0x53, 0xbc, 0xc6, + 0x52, 0x65, 0x72, 0xb0, 0x1e, 0x6c, 0xc7, 0x76, 0xb2, 0x4c, 0x71, 0x96, 0x19, 0x38, 0xed, 0xae, + 0x56, 0x28, 0x8c, 0x18, 0xcc, 0xda, 0x1f, 0xf7, 0x61, 0xfb, 0xf7, 0x1c, 0x92, 0xd3, 0x39, 0x24, + 0xff, 0xcf, 0x21, 0xf9, 0x79, 0x09, 0x9d, 0xd3, 0x25, 0x74, 0xfe, 0x5d, 0x42, 0xe7, 0xeb, 0x2b, + 0x21, 0x75, 0xda, 0xc4, 0x1b, 0xae, 0xf2, 0xc8, 0x8c, 0xf1, 0xda, 0x3e, 0x94, 0x0d, 0xb9, 0xaa, + 0x30, 0x1a, 0x76, 0x27, 0xf6, 0xec, 0x5e, 0xbc, 0x7b, 0x0c, 0x00, 0x00, 0xff, 0xff, 0xad, 0x5e, + 0x66, 0xdc, 0x50, 0x02, 0x00, 0x00, +} + +func (m *Chain) 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 *Chain) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if m.ChainId != 0 { + i = encodeVarintChains(dAtA, i, uint64(m.ChainId)) + i-- + dAtA[i] = 0x10 + } + if m.ChainName != 0 { + i = encodeVarintChains(dAtA, i, uint64(m.ChainName)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func encodeVarintChains(dAtA []byte, offset int, v uint64) int { + offset -= sovChains(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *Chain) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ChainName != 0 { + n += 1 + sovChains(uint64(m.ChainName)) + } + if m.ChainId != 0 { + n += 1 + sovChains(uint64(m.ChainId)) + } + return n +} + +func sovChains(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozChains(x uint64) (n int) { + return sovChains(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *Chain) 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 ErrIntOverflowChains + } + 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: Chain: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: Chain: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainName", wireType) + } + m.ChainName = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChains + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainName |= ChainName(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) + } + m.ChainId = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowChains + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ChainId |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipChains(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthChains + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipChains(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowChains + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowChains + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowChains + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthChains + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupChains + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthChains + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthChains = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowChains = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupChains = fmt.Errorf("proto: unexpected end of group") +) diff --git a/common/chains_test.go b/pkg/chains/chains_test.go similarity index 99% rename from common/chains_test.go rename to pkg/chains/chains_test.go index bfe1523398..070cb5922e 100644 --- a/common/chains_test.go +++ b/pkg/chains/chains_test.go @@ -1,4 +1,4 @@ -package common +package chains import ( "testing" diff --git a/common/utils.go b/pkg/chains/conversion.go similarity index 99% rename from common/utils.go rename to pkg/chains/conversion.go index 62c4e27ad5..6a6a6f4091 100644 --- a/common/utils.go +++ b/pkg/chains/conversion.go @@ -1,4 +1,4 @@ -package common +package chains import ( "encoding/hex" diff --git a/common/utils_test.go b/pkg/chains/utils_test.go similarity index 99% rename from common/utils_test.go rename to pkg/chains/utils_test.go index d63cc107bd..ca1f4722ef 100644 --- a/common/utils_test.go +++ b/pkg/chains/utils_test.go @@ -1,4 +1,4 @@ -package common +package chains import ( "encoding/hex" diff --git a/common/coin.go b/pkg/coin/coin.go similarity index 97% rename from common/coin.go rename to pkg/coin/coin.go index e2b4e0d44e..74bbca935b 100644 --- a/common/coin.go +++ b/pkg/coin/coin.go @@ -1,4 +1,4 @@ -package common +package coin import ( "fmt" diff --git a/pkg/coin/coin.pb.go b/pkg/coin/coin.pb.go new file mode 100644 index 0000000000..ac4a65780c --- /dev/null +++ b/pkg/coin/coin.pb.go @@ -0,0 +1,76 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pkg/coin/coin.proto + +package coin + +import ( + fmt "fmt" + math "math" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +type CoinType int32 + +const ( + CoinType_Zeta CoinType = 0 + CoinType_Gas CoinType = 1 + CoinType_ERC20 CoinType = 2 + CoinType_Cmd CoinType = 3 +) + +var CoinType_name = map[int32]string{ + 0: "Zeta", + 1: "Gas", + 2: "ERC20", + 3: "Cmd", +} + +var CoinType_value = map[string]int32{ + "Zeta": 0, + "Gas": 1, + "ERC20": 2, + "Cmd": 3, +} + +func (x CoinType) String() string { + return proto.EnumName(CoinType_name, int32(x)) +} + +func (CoinType) EnumDescriptor() ([]byte, []int) { + return fileDescriptor_dc61d0144bf70fc2, []int{0} +} + +func init() { + proto.RegisterEnum("coin.CoinType", CoinType_name, CoinType_value) +} + +func init() { proto.RegisterFile("pkg/coin/coin.proto", fileDescriptor_dc61d0144bf70fc2) } + +var fileDescriptor_dc61d0144bf70fc2 = []byte{ + // 178 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2e, 0xc8, 0x4e, 0xd7, + 0x4f, 0xce, 0xcf, 0xcc, 0x03, 0x13, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x2c, 0x20, 0xb6, + 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x58, 0x40, 0x1f, 0xc4, 0x82, 0xc8, 0x69, 0x99, 0x73, 0x71, + 0x38, 0xe7, 0x67, 0xe6, 0x85, 0x54, 0x16, 0xa4, 0x0a, 0x71, 0x70, 0xb1, 0x44, 0xa5, 0x96, 0x24, + 0x0a, 0x30, 0x08, 0xb1, 0x73, 0x31, 0xbb, 0x27, 0x16, 0x0b, 0x30, 0x0a, 0x71, 0x72, 0xb1, 0xba, + 0x06, 0x39, 0x1b, 0x19, 0x08, 0x30, 0x81, 0xc4, 0x9c, 0x73, 0x53, 0x04, 0x98, 0xa5, 0x58, 0x56, + 0x2c, 0x91, 0x63, 0x74, 0x72, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, + 0xe4, 0x18, 0x27, 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, + 0xf5, 0xf4, 0xcc, 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0xfd, 0xaa, 0xd4, 0x92, 0x44, + 0xdd, 0xe4, 0x8c, 0xc4, 0xcc, 0x3c, 0x30, 0x33, 0x39, 0xbf, 0x28, 0x55, 0x1f, 0xe6, 0xc4, 0x24, + 0x36, 0xb0, 0x13, 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x4c, 0x7f, 0xab, 0x6e, 0xb5, 0x00, + 0x00, 0x00, +} diff --git a/common/coin_test.go b/pkg/coin/coin_test.go similarity index 84% rename from common/coin_test.go rename to pkg/coin/coin_test.go index b43feb8f24..6110c20538 100644 --- a/common/coin_test.go +++ b/pkg/coin/coin_test.go @@ -1,11 +1,10 @@ -package common_test +package coin import ( "testing" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" ) func Test_GetAzetaDecFromAmountInZeta(t *testing.T) { @@ -54,7 +53,7 @@ func Test_GetAzetaDecFromAmountInZeta(t *testing.T) { } for _, tc := range tt { t.Run(tc.name, func(t *testing.T) { - azeta, err := common.GetAzetaDecFromAmountInZeta(tc.zetaAmount) + azeta, err := GetAzetaDecFromAmountInZeta(tc.zetaAmount) tc.err(t, err) if err == nil { require.Equal(t, tc.azetaAmount, azeta) @@ -68,56 +67,56 @@ func TestGetCoinType(t *testing.T) { tests := []struct { name string coin string - want common.CoinType + want CoinType wantErr bool }{ { name: "valid coin type 0", coin: "0", - want: common.CoinType(0), + want: CoinType(0), wantErr: false, }, { name: "valid coin type 1", coin: "1", - want: common.CoinType(1), + want: CoinType(1), wantErr: false, }, { name: "valid coin type 2", coin: "2", - want: common.CoinType(2), + want: CoinType(2), wantErr: false, }, { name: "valid coin type 3", coin: "3", - want: common.CoinType(3), + want: CoinType(3), wantErr: false, }, { name: "invalid coin type negative", coin: "-1", - want: common.CoinType_Cmd, + want: CoinType_Cmd, wantErr: true, }, { name: "invalid coin type large number", coin: "4", - want: common.CoinType_Cmd, + want: CoinType_Cmd, wantErr: true, }, { name: "invalid coin type non-integer", coin: "abc", - want: common.CoinType_Cmd, + want: CoinType_Cmd, wantErr: true, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - got, err := common.GetCoinType(tt.coin) + got, err := GetCoinType(tt.coin) if tt.wantErr { require.Error(t, err) } else { diff --git a/pkg/constant/constant.go b/pkg/constant/constant.go new file mode 100644 index 0000000000..447eca98e5 --- /dev/null +++ b/pkg/constant/constant.go @@ -0,0 +1,11 @@ +package constant + +const ( + // DonationMessage is the message for donation transactions + // Transaction sent to the TSS or ERC20 Custody address containing this message are considered as a donation + DonationMessage = "I am rich!" + // CmdWhitelistERC20 is used for CCTX of type cmd to give the instruction to the TSS to whitelist an ERC20 on an exeternal chain + CmdWhitelistERC20 = "cmd_whitelist_erc20" + // CmdMigrateTssFunds is used for CCTX of type cmd to give the instruction to the TSS to transfer its funds on a new address + CmdMigrateTssFunds = "cmd_migrate_tss_funds" +) diff --git a/common/version.go b/pkg/constant/version.go similarity index 81% rename from common/version.go rename to pkg/constant/version.go index ceb247379f..c8bd89866a 100644 --- a/common/version.go +++ b/pkg/constant/version.go @@ -1,4 +1,4 @@ -package common +package constant var ( Name = "" diff --git a/pkg/cosmos/cosmos.go b/pkg/cosmos/cosmos.go new file mode 100644 index 0000000000..bcaccacf11 --- /dev/null +++ b/pkg/cosmos/cosmos.go @@ -0,0 +1,11 @@ +package cosmos + +import ( + "github.com/cosmos/cosmos-sdk/types/bech32/legacybech32" // nolint +) + +var ( + GetPubKeyFromBech32 = legacybech32.UnmarshalPubKey + Bech32ifyPubKey = legacybech32.MarshalPubKey + Bech32PubKeyTypeAccPub = legacybech32.AccPK +) diff --git a/common/cosmos/cosmos_test.go b/pkg/cosmos/cosmos_test.go similarity index 100% rename from common/cosmos/cosmos_test.go rename to pkg/cosmos/cosmos_test.go diff --git a/pkg/crypto/crypto.pb.go b/pkg/crypto/crypto.pb.go new file mode 100644 index 0000000000..db9a9a6821 --- /dev/null +++ b/pkg/crypto/crypto.pb.go @@ -0,0 +1,371 @@ +// Code generated by protoc-gen-gogo. DO NOT EDIT. +// source: pkg/crypto/crypto.proto + +package crypto + +import ( + fmt "fmt" + io "io" + math "math" + math_bits "math/bits" + + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/gogo/protobuf/proto" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package + +// PubKeySet contains two pub keys , secp256k1 and ed25519 +type PubKeySet struct { + Secp256k1 PubKey `protobuf:"bytes,1,opt,name=secp256k1,proto3,casttype=PubKey" json:"secp256k1,omitempty"` + Ed25519 PubKey `protobuf:"bytes,2,opt,name=ed25519,proto3,casttype=PubKey" json:"ed25519,omitempty"` +} + +func (m *PubKeySet) Reset() { *m = PubKeySet{} } +func (m *PubKeySet) String() string { return proto.CompactTextString(m) } +func (*PubKeySet) ProtoMessage() {} +func (*PubKeySet) Descriptor() ([]byte, []int) { + return fileDescriptor_5643a513c82df681, []int{0} +} +func (m *PubKeySet) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *PubKeySet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_PubKeySet.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 *PubKeySet) XXX_Merge(src proto.Message) { + xxx_messageInfo_PubKeySet.Merge(m, src) +} +func (m *PubKeySet) XXX_Size() int { + return m.Size() +} +func (m *PubKeySet) XXX_DiscardUnknown() { + xxx_messageInfo_PubKeySet.DiscardUnknown(m) +} + +var xxx_messageInfo_PubKeySet proto.InternalMessageInfo + +func (m *PubKeySet) GetSecp256k1() PubKey { + if m != nil { + return m.Secp256k1 + } + return "" +} + +func (m *PubKeySet) GetEd25519() PubKey { + if m != nil { + return m.Ed25519 + } + return "" +} + +func init() { + proto.RegisterType((*PubKeySet)(nil), "crypto.PubKeySet") +} + +func init() { proto.RegisterFile("pkg/crypto/crypto.proto", fileDescriptor_5643a513c82df681) } + +var fileDescriptor_5643a513c82df681 = []byte{ + // 195 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x12, 0x2f, 0xc8, 0x4e, 0xd7, + 0x4f, 0x2e, 0xaa, 0x2c, 0x28, 0xc9, 0x87, 0x52, 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0x6c, + 0x10, 0x9e, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x58, 0x48, 0x1f, 0xc4, 0x82, 0xc8, 0x2a, 0x65, + 0x70, 0x71, 0x06, 0x94, 0x26, 0x79, 0xa7, 0x56, 0x06, 0xa7, 0x96, 0x08, 0x99, 0x72, 0x71, 0x16, + 0xa7, 0x26, 0x17, 0x18, 0x99, 0x9a, 0x65, 0x1b, 0x4a, 0x30, 0x2a, 0x30, 0x6a, 0x70, 0x3a, 0x89, + 0x3f, 0xba, 0x27, 0xcf, 0x19, 0x0c, 0x13, 0xfc, 0x75, 0x4f, 0x9e, 0x0d, 0xa2, 0x3c, 0x08, 0xa1, + 0x52, 0x48, 0x85, 0x8b, 0x3d, 0x35, 0xc5, 0xc8, 0xd4, 0xd4, 0xd0, 0x52, 0x82, 0x09, 0xac, 0x89, + 0x0b, 0x49, 0x1d, 0x4c, 0xca, 0xc9, 0xf9, 0xc4, 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, + 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, + 0xa2, 0x34, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0xf4, 0x92, 0xf3, 0x73, 0xf5, 0xab, 0x52, 0x4b, + 0x12, 0x75, 0x93, 0x33, 0x12, 0x33, 0xf3, 0xc0, 0xcc, 0xe4, 0xfc, 0xa2, 0x54, 0x7d, 0x84, 0xcf, + 0x92, 0xd8, 0xc0, 0xae, 0x36, 0x06, 0x04, 0x00, 0x00, 0xff, 0xff, 0xe0, 0x44, 0x43, 0x35, 0xee, + 0x00, 0x00, 0x00, +} + +func (m *PubKeySet) 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 *PubKeySet) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *PubKeySet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + if len(m.Ed25519) > 0 { + i -= len(m.Ed25519) + copy(dAtA[i:], m.Ed25519) + i = encodeVarintCrypto(dAtA, i, uint64(len(m.Ed25519))) + i-- + dAtA[i] = 0x12 + } + if len(m.Secp256k1) > 0 { + i -= len(m.Secp256k1) + copy(dAtA[i:], m.Secp256k1) + i = encodeVarintCrypto(dAtA, i, uint64(len(m.Secp256k1))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func encodeVarintCrypto(dAtA []byte, offset int, v uint64) int { + offset -= sovCrypto(v) + base := offset + for v >= 1<<7 { + dAtA[offset] = uint8(v&0x7f | 0x80) + v >>= 7 + offset++ + } + dAtA[offset] = uint8(v) + return base +} +func (m *PubKeySet) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Secp256k1) + if l > 0 { + n += 1 + l + sovCrypto(uint64(l)) + } + l = len(m.Ed25519) + if l > 0 { + n += 1 + l + sovCrypto(uint64(l)) + } + return n +} + +func sovCrypto(x uint64) (n int) { + return (math_bits.Len64(x|1) + 6) / 7 +} +func sozCrypto(x uint64) (n int) { + return sovCrypto(uint64((x << 1) ^ uint64((int64(x) >> 63)))) +} +func (m *PubKeySet) 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 ErrIntOverflowCrypto + } + 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: PubKeySet: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: PubKeySet: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Secp256k1", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrypto + } + 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 ErrInvalidLengthCrypto + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCrypto + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Secp256k1 = PubKey(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowCrypto + } + 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 ErrInvalidLengthCrypto + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthCrypto + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Ed25519 = PubKey(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipCrypto(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthCrypto + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func skipCrypto(dAtA []byte) (n int, err error) { + l := len(dAtA) + iNdEx := 0 + depth := 0 + for iNdEx < l { + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCrypto + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= (uint64(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + wireType := int(wire & 0x7) + switch wireType { + case 0: + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCrypto + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + iNdEx++ + if dAtA[iNdEx-1] < 0x80 { + break + } + } + case 1: + iNdEx += 8 + case 2: + var length int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return 0, ErrIntOverflowCrypto + } + if iNdEx >= l { + return 0, io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + length |= (int(b) & 0x7F) << shift + if b < 0x80 { + break + } + } + if length < 0 { + return 0, ErrInvalidLengthCrypto + } + iNdEx += length + case 3: + depth++ + case 4: + if depth == 0 { + return 0, ErrUnexpectedEndOfGroupCrypto + } + depth-- + case 5: + iNdEx += 4 + default: + return 0, fmt.Errorf("proto: illegal wireType %d", wireType) + } + if iNdEx < 0 { + return 0, ErrInvalidLengthCrypto + } + if depth == 0 { + return iNdEx, nil + } + } + return 0, io.ErrUnexpectedEOF +} + +var ( + ErrInvalidLengthCrypto = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowCrypto = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupCrypto = fmt.Errorf("proto: unexpected end of group") +) diff --git a/common/pubkey.go b/pkg/crypto/pubkey.go similarity index 90% rename from common/pubkey.go rename to pkg/crypto/pubkey.go index 1c597cc25c..703d0bdad4 100644 --- a/common/pubkey.go +++ b/pkg/crypto/pubkey.go @@ -1,4 +1,4 @@ -package common +package crypto import ( "encoding/json" @@ -15,7 +15,8 @@ import ( eth "github.com/ethereum/go-ethereum/crypto" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/cosmos" ) // PubKey is bech32 encoded string @@ -71,31 +72,31 @@ func (pubKey PubKey) String() string { } // GetAddress will return an address for the given chain -func (pubKey PubKey) GetAddress(chain Chain) (Address, error) { - if IsEVMChain(chain.ChainId) { +func (pubKey PubKey) GetAddress(chain chains.Chain) (chains.Address, error) { + if chains.IsEVMChain(chain.ChainId) { return pubKey.GetEVMAddress() } - return NoAddress, nil + return chains.NoAddress, nil } // GetEVMAddress will return the evm address -func (pubKey PubKey) GetEVMAddress() (Address, error) { +func (pubKey PubKey) GetEVMAddress() (chains.Address, error) { if pubKey.IsEmpty() { - return NoAddress, nil + return chains.NoAddress, nil } // retrieve compressed pubkey bytes from bechh32 encoded str pk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, string(pubKey)) if err != nil { - return NoAddress, err + return chains.NoAddress, err } // parse compressed bytes removing 5 first bytes (amino encoding) to get uncompressed pub, err := secp256k1.ParsePubKey(pk.Bytes()) if err != nil { - return NoAddress, err + return chains.NoAddress, err } str := strings.ToLower(eth.PubkeyToAddress(*pub.ToECDSA()).String()) - return NewAddress(str), nil + return chains.NewAddress(str), nil } // MarshalJSON to Marshals to JSON using Bech32 diff --git a/common/pubkey_test.go b/pkg/crypto/pubkey_test.go similarity index 95% rename from common/pubkey_test.go rename to pkg/crypto/pubkey_test.go index 6984f31f26..f86f07fcc0 100644 --- a/common/pubkey_test.go +++ b/pkg/crypto/pubkey_test.go @@ -1,4 +1,4 @@ -package common +package crypto import ( "encoding/hex" @@ -13,7 +13,8 @@ import ( . "gopkg.in/check.v1" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/cosmos" ) type KeyDataAddr struct { @@ -131,23 +132,23 @@ func (s *PubKeyTestSuite) TestPubKeyGetAddress(c *C) { c.Assert(err, IsNil) c.Assert(os.Setenv("NET", "mainnet"), IsNil) - addrETH, err := pk.GetAddress(GoerliChain()) + addrETH, err := pk.GetAddress(chains.GoerliChain()) c.Assert(err, IsNil) c.Assert(addrETH.String(), Equals, d.addrETH.mainnet) c.Assert(os.Setenv("NET", "testnet"), IsNil) - addrETH, err = pk.GetAddress(GoerliChain()) + addrETH, err = pk.GetAddress(chains.GoerliChain()) c.Assert(err, IsNil) c.Assert(addrETH.String(), Equals, d.addrETH.testnet) c.Assert(os.Setenv("NET", "mocknet"), IsNil) - addrETH, err = pk.GetAddress(GoerliChain()) + addrETH, err = pk.GetAddress(chains.GoerliChain()) c.Assert(err, IsNil) c.Assert(addrETH.String(), Equals, d.addrETH.mocknet) - addrETH, err = pk.GetAddress(BtcRegtestChain()) + addrETH, err = pk.GetAddress(chains.BtcRegtestChain()) c.Assert(err, IsNil) - c.Assert(addrETH, Equals, NoAddress) + c.Assert(addrETH, Equals, chains.NoAddress) } } @@ -349,7 +350,7 @@ func TestGetEVMAddress(t *testing.T) { pubKey := PubKey("") e, err := pubKey.GetEVMAddress() require.Nil(t, err) - require.Equal(t, NoAddress, e) + require.Equal(t, chains.NoAddress, e) }) t.Run("should return addr from pubkey", func(t *testing.T) { @@ -365,6 +366,6 @@ func TestGetEVMAddress(t *testing.T) { pk := PubKey("invalid") e, err := pk.GetEVMAddress() require.NotNil(t, err) - require.Equal(t, NoAddress, e) + require.Equal(t, chains.NoAddress, e) }) } diff --git a/common/tss.go b/pkg/crypto/tss.go similarity index 83% rename from common/tss.go rename to pkg/crypto/tss.go index 2f7831ae4c..fc3c36ed8a 100644 --- a/common/tss.go +++ b/pkg/crypto/tss.go @@ -1,17 +1,17 @@ -package common +package crypto import ( "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcutil" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - zcommon "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/cosmos" ) // GetTssAddrEVM returns the ethereum address of the tss pubkey func GetTssAddrEVM(tssPubkey string) (ethcommon.Address, error) { var keyAddr ethcommon.Address - pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) + pubk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, tssPubkey) if err != nil { return keyAddr, err } @@ -36,7 +36,7 @@ func GetTssAddrBTC(tssPubkey string, bitcoinParams *chaincfg.Params) (string, er } func getKeyAddrBTCWitnessPubkeyHash(tssPubkey string, bitcoinParams *chaincfg.Params) (*btcutil.AddressWitnessPubKeyHash, error) { - pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) + pubk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, tssPubkey) if err != nil { return nil, err } diff --git a/common/tss_test.go b/pkg/crypto/tss_test.go similarity index 97% rename from common/tss_test.go rename to pkg/crypto/tss_test.go index d860973b92..10497f1e85 100644 --- a/common/tss_test.go +++ b/pkg/crypto/tss_test.go @@ -1,4 +1,4 @@ -package common +package crypto import ( "testing" @@ -9,7 +9,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/cosmos" ) func TestGetTssAddrEVM(t *testing.T) { diff --git a/common/gas_limits.go b/pkg/gas/gas_limits.go similarity index 98% rename from common/gas_limits.go rename to pkg/gas/gas_limits.go index 96748d1d86..d4a3938adb 100644 --- a/common/gas_limits.go +++ b/pkg/gas/gas_limits.go @@ -1,4 +1,4 @@ -package common +package gas import ( sdkmath "cosmossdk.io/math" diff --git a/common/gas_limits_test.go b/pkg/gas/gas_limits_test.go similarity index 98% rename from common/gas_limits_test.go rename to pkg/gas/gas_limits_test.go index 0277e48c61..e9b1bbecd0 100644 --- a/common/gas_limits_test.go +++ b/pkg/gas/gas_limits_test.go @@ -1,4 +1,4 @@ -package common +package gas import ( "testing" diff --git a/common/bitcoin/bitcoin.pb.go b/pkg/proofs/bitcoin/bitcoin.pb.go similarity index 86% rename from common/bitcoin/bitcoin.pb.go rename to pkg/proofs/bitcoin/bitcoin.pb.go index e56ac19d24..07f03aa927 100644 --- a/common/bitcoin/bitcoin.pb.go +++ b/pkg/proofs/bitcoin/bitcoin.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: common/bitcoin/bitcoin.proto +// source: pkg/proofs/bitcoin/bitcoin.proto package bitcoin @@ -33,7 +33,7 @@ func (m *Proof) Reset() { *m = Proof{} } func (m *Proof) String() string { return proto.CompactTextString(m) } func (*Proof) ProtoMessage() {} func (*Proof) Descriptor() ([]byte, []int) { - return fileDescriptor_0a2411cf854c4a85, []int{0} + return fileDescriptor_683fe0fe4796f27d, []int{0} } func (m *Proof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -87,22 +87,22 @@ func init() { proto.RegisterType((*Proof)(nil), "bitcoin.Proof") } -func init() { proto.RegisterFile("common/bitcoin/bitcoin.proto", fileDescriptor_0a2411cf854c4a85) } +func init() { proto.RegisterFile("pkg/proofs/bitcoin/bitcoin.proto", fileDescriptor_683fe0fe4796f27d) } -var fileDescriptor_0a2411cf854c4a85 = []byte{ - // 180 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x49, 0xce, 0xcf, 0xcd, - 0xcd, 0xcf, 0xd3, 0x4f, 0xca, 0x2c, 0x49, 0xce, 0xcf, 0x84, 0xd3, 0x7a, 0x05, 0x45, 0xf9, 0x25, - 0xf9, 0x42, 0xec, 0x50, 0xae, 0x92, 0x0f, 0x17, 0x6b, 0x40, 0x51, 0x7e, 0x7e, 0x9a, 0x90, 0x24, - 0x17, 0x47, 0x49, 0x45, 0x7c, 0x52, 0x65, 0x49, 0x6a, 0xb1, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0x4f, - 0x10, 0x7b, 0x49, 0x85, 0x13, 0x88, 0x2b, 0x24, 0xc4, 0xc5, 0x52, 0x90, 0x58, 0x92, 0x21, 0xc1, - 0x04, 0x16, 0x06, 0xb3, 0x85, 0x44, 0xb8, 0x58, 0x33, 0xf3, 0x52, 0x52, 0x2b, 0x24, 0x98, 0x15, - 0x18, 0x35, 0x78, 0x83, 0x20, 0x1c, 0x27, 0xf7, 0x13, 0x8f, 0xe4, 0x18, 0x2f, 0x3c, 0x92, 0x63, - 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, 0x6e, 0x3c, 0x96, - 0x63, 0x88, 0xd2, 0x4d, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, 0xd5, 0xaf, 0x4a, - 0x2d, 0x49, 0xd4, 0x4d, 0xce, 0x48, 0xcc, 0xcc, 0x03, 0x33, 0x93, 0xf3, 0x8b, 0x52, 0xf5, 0x51, - 0x5d, 0x9b, 0xc4, 0x06, 0x76, 0xa6, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x02, 0xc5, 0x71, 0x41, - 0xc6, 0x00, 0x00, 0x00, +var fileDescriptor_683fe0fe4796f27d = []byte{ + // 183 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x28, 0xc8, 0x4e, 0xd7, + 0x2f, 0x28, 0xca, 0xcf, 0x4f, 0x2b, 0xd6, 0x4f, 0xca, 0x2c, 0x49, 0xce, 0xcf, 0xcc, 0x83, 0xd1, + 0x7a, 0x05, 0x45, 0xf9, 0x25, 0xf9, 0x42, 0xec, 0x50, 0xae, 0x92, 0x0f, 0x17, 0x6b, 0x00, 0x48, + 0xa1, 0x90, 0x24, 0x17, 0x47, 0x49, 0x45, 0x7c, 0x52, 0x65, 0x49, 0x6a, 0xb1, 0x04, 0xa3, 0x02, + 0xa3, 0x06, 0x4f, 0x10, 0x7b, 0x49, 0x85, 0x13, 0x88, 0x2b, 0x24, 0xc4, 0xc5, 0x52, 0x90, 0x58, + 0x92, 0x21, 0xc1, 0x04, 0x16, 0x06, 0xb3, 0x85, 0x44, 0xb8, 0x58, 0x33, 0xf3, 0x52, 0x52, 0x2b, + 0x24, 0x98, 0x15, 0x18, 0x35, 0x78, 0x83, 0x20, 0x1c, 0x27, 0xef, 0x13, 0x8f, 0xe4, 0x18, 0x2f, + 0x3c, 0x92, 0x63, 0x7c, 0xf0, 0x48, 0x8e, 0x71, 0xc2, 0x63, 0x39, 0x86, 0x0b, 0x8f, 0xe5, 0x18, + 0x6e, 0x3c, 0x96, 0x63, 0x88, 0x32, 0x4c, 0xcf, 0x2c, 0xc9, 0x28, 0x4d, 0xd2, 0x4b, 0xce, 0xcf, + 0xd5, 0xaf, 0x4a, 0x2d, 0x49, 0xd4, 0x4d, 0xce, 0x48, 0xcc, 0xcc, 0x03, 0x33, 0x93, 0xf3, 0x8b, + 0x52, 0xf5, 0x31, 0x5d, 0x9c, 0xc4, 0x06, 0x76, 0xaa, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x4f, + 0xf2, 0x97, 0x80, 0xce, 0x00, 0x00, 0x00, } func (m *Proof) Marshal() (dAtA []byte, err error) { diff --git a/common/bitcoin/bitcoin_spv.go b/pkg/proofs/bitcoin/bitcoin_spv.go similarity index 100% rename from common/bitcoin/bitcoin_spv.go rename to pkg/proofs/bitcoin/bitcoin_spv.go diff --git a/common/bitcoin/bitcoin_spv_test.go b/pkg/proofs/bitcoin/bitcoin_spv_test.go similarity index 100% rename from common/bitcoin/bitcoin_spv_test.go rename to pkg/proofs/bitcoin/bitcoin_spv_test.go diff --git a/common/bitcoin/proof.go b/pkg/proofs/bitcoin/proof.go similarity index 100% rename from common/bitcoin/proof.go rename to pkg/proofs/bitcoin/proof.go diff --git a/common/bitcoin/proof_test.go b/pkg/proofs/bitcoin/proof_test.go similarity index 98% rename from common/bitcoin/proof_test.go rename to pkg/proofs/bitcoin/proof_test.go index 0f521c4934..7ad3199493 100644 --- a/common/bitcoin/proof_test.go +++ b/pkg/proofs/bitcoin/proof_test.go @@ -12,7 +12,7 @@ import ( "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common/testdata" + "github.com/zeta-chain/zetacore/pkg/testdata" ) func TestBitcoinMerkleProof(t *testing.T) { diff --git a/common/ethereum/ethereum.pb.go b/pkg/proofs/ethereum/ethereum.pb.go similarity index 86% rename from common/ethereum/ethereum.pb.go rename to pkg/proofs/ethereum/ethereum.pb.go index 8dd8096019..4cbfd2ba74 100644 --- a/common/ethereum/ethereum.pb.go +++ b/pkg/proofs/ethereum/ethereum.pb.go @@ -1,5 +1,5 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: common/ethereum/ethereum.proto +// source: pkg/proofs/ethereum/ethereum.proto package ethereum @@ -32,7 +32,7 @@ func (m *Proof) Reset() { *m = Proof{} } func (m *Proof) String() string { return proto.CompactTextString(m) } func (*Proof) ProtoMessage() {} func (*Proof) Descriptor() ([]byte, []int) { - return fileDescriptor_93e74b59a4555c70, []int{0} + return fileDescriptor_bd99cabd67598caa, []int{0} } func (m *Proof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -79,20 +79,23 @@ func init() { proto.RegisterType((*Proof)(nil), "ethereum.Proof") } -func init() { proto.RegisterFile("common/ethereum/ethereum.proto", fileDescriptor_93e74b59a4555c70) } +func init() { + proto.RegisterFile("pkg/proofs/ethereum/ethereum.proto", fileDescriptor_bd99cabd67598caa) +} -var fileDescriptor_93e74b59a4555c70 = []byte{ - // 159 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0x4b, 0xce, 0xcf, 0xcd, - 0xcd, 0xcf, 0xd3, 0x4f, 0x2d, 0xc9, 0x48, 0x2d, 0x4a, 0x2d, 0xcd, 0x85, 0x33, 0xf4, 0x0a, 0x8a, - 0xf2, 0x4b, 0xf2, 0x85, 0x38, 0x60, 0x7c, 0x25, 0x63, 0x2e, 0xd6, 0x80, 0xa2, 0xfc, 0xfc, 0x34, - 0x21, 0x21, 0x2e, 0x96, 0xec, 0xd4, 0xca, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x9e, 0x20, 0x30, - 0x5b, 0x48, 0x8c, 0x8b, 0xad, 0x2c, 0x31, 0xa7, 0x34, 0xb5, 0x58, 0x82, 0x09, 0x2c, 0x0a, 0xe5, - 0x39, 0x79, 0x9c, 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, 0x5e, 0x7a, 0x66, - 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x55, 0x6a, 0x49, 0xa2, 0x6e, 0x72, 0x46, - 0x62, 0x66, 0x1e, 0x98, 0x99, 0x9c, 0x5f, 0x94, 0xaa, 0x8f, 0xe6, 0xae, 0x24, 0x36, 0xb0, 0x7b, - 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0x31, 0x9b, 0x72, 0x4f, 0xb1, 0x00, 0x00, 0x00, +var fileDescriptor_bd99cabd67598caa = []byte{ + // 161 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0x2a, 0xc8, 0x4e, 0xd7, + 0x2f, 0x28, 0xca, 0xcf, 0x4f, 0x2b, 0xd6, 0x4f, 0x2d, 0xc9, 0x48, 0x2d, 0x4a, 0x2d, 0xcd, 0x85, + 0x33, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x38, 0x60, 0x7c, 0x25, 0x63, 0x2e, 0xd6, 0x00, + 0x90, 0x5a, 0x21, 0x21, 0x2e, 0x96, 0xec, 0xd4, 0xca, 0x62, 0x09, 0x46, 0x05, 0x66, 0x0d, 0x9e, + 0x20, 0x30, 0x5b, 0x48, 0x8c, 0x8b, 0xad, 0x2c, 0x31, 0xa7, 0x34, 0xb5, 0x58, 0x82, 0x09, 0x2c, + 0x0a, 0xe5, 0x39, 0xf9, 0x9c, 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, 0x51, + 0x7a, 0x66, 0x49, 0x46, 0x69, 0x92, 0x5e, 0x72, 0x7e, 0xae, 0x7e, 0x55, 0x6a, 0x49, 0xa2, 0x6e, + 0x72, 0x46, 0x62, 0x66, 0x1e, 0x98, 0x99, 0x9c, 0x5f, 0x94, 0xaa, 0x8f, 0xc5, 0x6d, 0x49, 0x6c, + 0x60, 0x37, 0x19, 0x03, 0x02, 0x00, 0x00, 0xff, 0xff, 0xdc, 0xc4, 0xcc, 0xc8, 0xb9, 0x00, 0x00, + 0x00, } func (m *Proof) Marshal() (dAtA []byte, err error) { diff --git a/common/ethereum/proof.go b/pkg/proofs/ethereum/proof.go similarity index 100% rename from common/ethereum/proof.go rename to pkg/proofs/ethereum/proof.go diff --git a/common/ethereum/proof_test.go b/pkg/proofs/ethereum/proof_test.go similarity index 98% rename from common/ethereum/proof_test.go rename to pkg/proofs/ethereum/proof_test.go index da0a60e463..1fc3dc1c51 100644 --- a/common/ethereum/proof_test.go +++ b/pkg/proofs/ethereum/proof_test.go @@ -5,7 +5,7 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common/testdata" + "github.com/zeta-chain/zetacore/pkg/testdata" ) func TestProofGeneration(t *testing.T) { diff --git a/common/headers.go b/pkg/proofs/headers.go similarity index 97% rename from common/headers.go rename to pkg/proofs/headers.go index 528bcffb78..64d2a6b2f1 100644 --- a/common/headers.go +++ b/pkg/proofs/headers.go @@ -1,4 +1,4 @@ -package common +package proofs import ( "bytes" @@ -13,7 +13,8 @@ import ( "github.com/btcsuite/btcutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rlp" - "github.com/zeta-chain/zetacore/common/bitcoin" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/proofs/bitcoin" ) // NewEthereumHeader returns a new HeaderData containing an Ethereum header @@ -148,7 +149,7 @@ func ValidateBitcoinHeader(headerBytes []byte, blockHash []byte, chainID int64) } // Timestamp must be not earlier than genesis block - chainParams, err := GetBTCChainParams(chainID) + chainParams, err := chains.GetBTCChainParams(chainID) if err != nil { return fmt.Errorf("cannot get chain params (%s) for chain id (%d)", err, chainID) } diff --git a/common/headers_test.go b/pkg/proofs/headers_test.go similarity index 88% rename from common/headers_test.go rename to pkg/proofs/headers_test.go index 059fe7db7d..9b10450fb0 100644 --- a/common/headers_test.go +++ b/pkg/proofs/headers_test.go @@ -1,4 +1,4 @@ -package common_test +package proofs import ( "bytes" @@ -16,8 +16,7 @@ import ( "github.com/btcsuite/btcd/wire" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/testdata" + "github.com/zeta-chain/zetacore/pkg/testdata" ) const numHeadersToTest = 100 @@ -25,7 +24,7 @@ const numHeadersToTest = 100 func TestTrueEthereumHeader(t *testing.T) { var header ethtypes.Header // read file into a byte slice - file, err := os.Open("./testdata/eth_header_18495266.json") + file, err := os.Open("../testdata/eth_header_18495266.json") require.NoError(t, err) defer file.Close() headerBytes := make([]byte, 4096) @@ -37,7 +36,7 @@ func TestTrueEthereumHeader(t *testing.T) { err = header.EncodeRLP(&buffer) require.NoError(t, err) - headerData := common.NewEthereumHeader(buffer.Bytes()) + headerData := NewEthereumHeader(buffer.Bytes()) err = headerData.Validate(header.Hash().Bytes(), 1, 18495266) require.NoError(t, err) @@ -52,7 +51,7 @@ func TestTrueEthereumHeader(t *testing.T) { func TestFalseEthereumHeader(t *testing.T) { var header ethtypes.Header // read file into a byte slice - file, err := os.Open("./testdata/eth_header_18495266.json") + file, err := os.Open("../testdata/eth_header_18495266.json") require.NoError(t, err) defer file.Close() headerBytes := make([]byte, 4096) @@ -66,7 +65,7 @@ func TestFalseEthereumHeader(t *testing.T) { err = header.EncodeRLP(&buffer) require.NoError(t, err) - headerData := common.NewEthereumHeader(buffer.Bytes()) + headerData := NewEthereumHeader(buffer.Bytes()) err = headerData.Validate(hash.Bytes(), 1, 18495267) require.Error(t, err) } @@ -100,7 +99,7 @@ func TestFakeBitcoinHeader(t *testing.T) { } func TestNonExistentHeaderType(t *testing.T) { - headerData := common.HeaderData{} + headerData := HeaderData{} err := headerData.Validate([]byte{}, 18332, 0) require.EqualError(t, err, "unrecognized header type") @@ -184,7 +183,7 @@ func unmarshalHeader(t *testing.T, headerBytes []byte) *wire.BlockHeader { func validateTrueBitcoinHeader(t *testing.T, header *wire.BlockHeader, headerBytes []byte) { blockHash := header.BlockHash() - headerData := common.NewBitcoinHeader(headerBytes) + headerData := NewBitcoinHeader(headerBytes) // True Bitcoin header should pass validation err := headerData.Validate(blockHash[:], 18332, 0) require.NoError(t, err) @@ -202,7 +201,7 @@ func validateFakeBitcoinHeader(t *testing.T, header *wire.BlockHeader, headerByt blockHash := header.BlockHash() // Incorrect header length should fail validation - err := common.ValidateBitcoinHeader(headerBytes[:79], blockHash[:], 18332) + err := ValidateBitcoinHeader(headerBytes[:79], blockHash[:], 18332) require.Error(t, err) // Incorrect version should fail validation @@ -210,7 +209,7 @@ func validateFakeBitcoinHeader(t *testing.T, header *wire.BlockHeader, headerByt fakeHeader.Version = 0 fakeBytes := marshalHeader(t, fakeHeader) fakeHash := fakeHeader.BlockHash() - err = common.ValidateBitcoinHeader(fakeBytes, fakeHash[:], 18332) + err = ValidateBitcoinHeader(fakeBytes, fakeHash[:], 18332) require.Error(t, err) // Incorrect timestamp should fail validation @@ -219,24 +218,24 @@ func validateFakeBitcoinHeader(t *testing.T, header *wire.BlockHeader, headerByt fakeHeader.Timestamp = chaincfg.TestNet3Params.GenesisBlock.Header.Timestamp.Add(-time.Second) fakeBytes = marshalHeader(t, fakeHeader) fakeHash = fakeHeader.BlockHash() - err = common.ValidateBitcoinHeader(fakeBytes, fakeHash[:], 18332) + err = ValidateBitcoinHeader(fakeBytes, fakeHash[:], 18332) require.Error(t, err) // Case2: timestamp is after 2 hours in the future fakeHeader = copyHeader(header) fakeHeader.Timestamp = header.Timestamp.Add(time.Second * (blockchain.MaxTimeOffsetSeconds + 1)) fakeBytes = marshalHeader(t, fakeHeader) - err = common.NewBitcoinHeader(fakeBytes).ValidateTimestamp(header.Timestamp) + err = NewBitcoinHeader(fakeBytes).ValidateTimestamp(header.Timestamp) require.Error(t, err) // Incorrect block hash should fail validation fakeHeader = copyHeader(header) header.Nonce = 0 fakeBytes = marshalHeader(t, header) - err = common.ValidateBitcoinHeader(fakeBytes, blockHash[:], 18332) + err = ValidateBitcoinHeader(fakeBytes, blockHash[:], 18332) require.Error(t, err) // PoW not satisfied should fail validation fakeHash = fakeHeader.BlockHash() - err = common.ValidateBitcoinHeader(fakeBytes, fakeHash[:], 18332) + err = ValidateBitcoinHeader(fakeBytes, fakeHash[:], 18332) require.Error(t, err) } diff --git a/common/proof.go b/pkg/proofs/proof.go similarity index 95% rename from common/proof.go rename to pkg/proofs/proof.go index 668b1024a8..85b62d6bd0 100644 --- a/common/proof.go +++ b/pkg/proofs/proof.go @@ -1,4 +1,4 @@ -package common +package proofs import ( "bytes" @@ -8,8 +8,8 @@ import ( "github.com/btcsuite/btcutil" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rlp" - bitcoin "github.com/zeta-chain/zetacore/common/bitcoin" - "github.com/zeta-chain/zetacore/common/ethereum" + "github.com/zeta-chain/zetacore/pkg/proofs/bitcoin" + "github.com/zeta-chain/zetacore/pkg/proofs/ethereum" ) // ErrInvalidProof is a error type for invalid proofs embedding the underlying error diff --git a/common/proof_test.go b/pkg/proofs/proof_test.go similarity index 78% rename from common/proof_test.go rename to pkg/proofs/proof_test.go index 3b26b5c0a3..44f28535cb 100644 --- a/common/proof_test.go +++ b/pkg/proofs/proof_test.go @@ -1,4 +1,4 @@ -package common_test +package proofs import ( "errors" @@ -12,12 +12,9 @@ import ( "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/rlp" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/bitcoin" - "github.com/zeta-chain/zetacore/common/ethereum" - "github.com/zeta-chain/zetacore/common/testdata" - "github.com/zeta-chain/zetacore/x/crosschain/keeper" - crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" + "github.com/zeta-chain/zetacore/pkg/proofs/bitcoin" + "github.com/zeta-chain/zetacore/pkg/proofs/ethereum" + "github.com/zeta-chain/zetacore/pkg/testdata" "github.com/btcsuite/btcd/blockchain" "github.com/btcsuite/btcd/btcjson" @@ -30,11 +27,11 @@ const ( ) func Test_IsErrorInvalidProof(t *testing.T) { - require.False(t, common.IsErrorInvalidProof(nil)) - require.False(t, common.IsErrorInvalidProof(errors.New("foo"))) + require.False(t, IsErrorInvalidProof(nil)) + require.False(t, IsErrorInvalidProof(errors.New("foo"))) invalidProofErr := errors.New("foo") - invalidProof := common.NewErrInvalidProof(invalidProofErr) - require.True(t, common.IsErrorInvalidProof(invalidProof)) + invalidProof := NewErrInvalidProof(invalidProofErr) + require.True(t, IsErrorInvalidProof(invalidProof)) require.Equal(t, invalidProofErr.Error(), invalidProof.Error()) } @@ -65,7 +62,7 @@ func TestEthereumMerkleProof(t *testing.T) { b, err := rlp.EncodeToBytes(&header) require.NoError(t, err) - headerData := common.NewEthereumHeader(b) + headerData := NewEthereumHeader(b) t.Run("should verify tx proof", func(t *testing.T) { var txs types.Transactions for i := 0; i < testdata.TxsCount; i++ { @@ -83,7 +80,7 @@ func TestEthereumMerkleProof(t *testing.T) { proof, err := txsTree.GenerateProof(i) require.NoError(t, err) - ethProof := common.NewEthereumProof(proof) + ethProof := NewEthereumProof(proof) _, err = ethProof.Verify(headerData, i) require.NoError(t, err) @@ -107,7 +104,7 @@ func TestEthereumMerkleProof(t *testing.T) { proof, err := txsTree.GenerateProof(i) require.NoError(t, err) - ethProof := common.NewEthereumProof(proof) + ethProof := NewEthereumProof(proof) _, err = ethProof.Verify(headerData, i) require.Error(t, err) @@ -153,16 +150,6 @@ func validateBitcoinBlock(t *testing.T, _ *wire.BlockHeader, headerBytes []byte, tx, err := btcutil.NewTxFromBytes(txBytes) require.NoError(t, err) - // Validate Tss SegWit transaction if it's an outTx - if res.Txid == outTxid { - msg := &crosschaintypes.MsgAddToOutTxTracker{ - ChainId: common.BtcTestNetChain().ChainId, - Nonce: nonce, - TxHash: outTxid, - } - err = keeper.VerifyBTCOutTxBody(msg, txBytes, tssAddress) - require.NoError(t, err) - } txns = append(txns, tx) txBodies = append(txBodies, txBytes) } @@ -174,15 +161,15 @@ func validateBitcoinBlock(t *testing.T, _ *wire.BlockHeader, headerBytes []byte, require.NoError(t, err) // True proof should verify - proof := common.NewBitcoinProof(txBodies[i], path, index) - txBytes, err := proof.Verify(common.NewBitcoinHeader(headerBytes), 0) + proof := NewBitcoinProof(txBodies[i], path, index) + txBytes, err := proof.Verify(NewBitcoinHeader(headerBytes), 0) require.NoError(t, err) require.Equal(t, txBytes, txBodies[i]) // Fake proof should not verify fakeIndex := index ^ 0xffffffff // flip all bits - fakeProof := common.NewBitcoinProof(txBodies[i], path, fakeIndex) - txBytes, err = fakeProof.Verify(common.NewBitcoinHeader(headerBytes), 0) + fakeProof := NewBitcoinProof(txBodies[i], path, fakeIndex) + txBytes, err = fakeProof.Verify(NewBitcoinHeader(headerBytes), 0) require.Error(t, err) require.Nil(t, txBytes) } diff --git a/common/common.pb.go b/pkg/proofs/proofs.pb.go similarity index 52% rename from common/common.pb.go rename to pkg/proofs/proofs.pb.go index 76f8d4d9de..f866e9d782 100644 --- a/common/common.pb.go +++ b/pkg/proofs/proofs.pb.go @@ -1,7 +1,7 @@ // Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: common/common.proto +// source: pkg/proofs/proofs.proto -package common +package proofs import ( fmt "fmt" @@ -11,8 +11,8 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - bitcoin "github.com/zeta-chain/zetacore/common/bitcoin" - ethereum "github.com/zeta-chain/zetacore/common/ethereum" + bitcoin "github.com/zeta-chain/zetacore/pkg/proofs/bitcoin" + ethereum "github.com/zeta-chain/zetacore/pkg/proofs/ethereum" ) // Reference imports to suppress errors if they are not otherwise used. @@ -26,240 +26,6 @@ var _ = math.Inf // proto package needs to be updated. const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package -type ReceiveStatus int32 - -const ( - ReceiveStatus_Created ReceiveStatus = 0 - ReceiveStatus_Success ReceiveStatus = 1 - ReceiveStatus_Failed ReceiveStatus = 2 -) - -var ReceiveStatus_name = map[int32]string{ - 0: "Created", - 1: "Success", - 2: "Failed", -} - -var ReceiveStatus_value = map[string]int32{ - "Created": 0, - "Success": 1, - "Failed": 2, -} - -func (x ReceiveStatus) String() string { - return proto.EnumName(ReceiveStatus_name, int32(x)) -} - -func (ReceiveStatus) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{0} -} - -type CoinType int32 - -const ( - CoinType_Zeta CoinType = 0 - CoinType_Gas CoinType = 1 - CoinType_ERC20 CoinType = 2 - CoinType_Cmd CoinType = 3 -) - -var CoinType_name = map[int32]string{ - 0: "Zeta", - 1: "Gas", - 2: "ERC20", - 3: "Cmd", -} - -var CoinType_value = map[string]int32{ - "Zeta": 0, - "Gas": 1, - "ERC20": 2, - "Cmd": 3, -} - -func (x CoinType) String() string { - return proto.EnumName(CoinType_name, int32(x)) -} - -func (CoinType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{1} -} - -type ChainName int32 - -const ( - ChainName_empty ChainName = 0 - ChainName_eth_mainnet ChainName = 1 - ChainName_zeta_mainnet ChainName = 2 - ChainName_btc_mainnet ChainName = 3 - ChainName_polygon_mainnet ChainName = 4 - ChainName_bsc_mainnet ChainName = 5 - // Testnet - ChainName_goerli_testnet ChainName = 6 - ChainName_mumbai_testnet ChainName = 7 - ChainName_ganache_testnet ChainName = 8 - ChainName_baobab_testnet ChainName = 9 - ChainName_bsc_testnet ChainName = 10 - ChainName_zeta_testnet ChainName = 11 - ChainName_btc_testnet ChainName = 12 - ChainName_sepolia_testnet ChainName = 13 - // LocalNet - // zeta_localnet = 13; - ChainName_goerli_localnet ChainName = 14 - ChainName_btc_regtest ChainName = 15 -) - -var ChainName_name = map[int32]string{ - 0: "empty", - 1: "eth_mainnet", - 2: "zeta_mainnet", - 3: "btc_mainnet", - 4: "polygon_mainnet", - 5: "bsc_mainnet", - 6: "goerli_testnet", - 7: "mumbai_testnet", - 8: "ganache_testnet", - 9: "baobab_testnet", - 10: "bsc_testnet", - 11: "zeta_testnet", - 12: "btc_testnet", - 13: "sepolia_testnet", - 14: "goerli_localnet", - 15: "btc_regtest", -} - -var ChainName_value = map[string]int32{ - "empty": 0, - "eth_mainnet": 1, - "zeta_mainnet": 2, - "btc_mainnet": 3, - "polygon_mainnet": 4, - "bsc_mainnet": 5, - "goerli_testnet": 6, - "mumbai_testnet": 7, - "ganache_testnet": 8, - "baobab_testnet": 9, - "bsc_testnet": 10, - "zeta_testnet": 11, - "btc_testnet": 12, - "sepolia_testnet": 13, - "goerli_localnet": 14, - "btc_regtest": 15, -} - -func (x ChainName) String() string { - return proto.EnumName(ChainName_name, int32(x)) -} - -func (ChainName) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{2} -} - -// PubKeySet contains two pub keys , secp256k1 and ed25519 -type PubKeySet struct { - Secp256k1 PubKey `protobuf:"bytes,1,opt,name=secp256k1,proto3,casttype=PubKey" json:"secp256k1,omitempty"` - Ed25519 PubKey `protobuf:"bytes,2,opt,name=ed25519,proto3,casttype=PubKey" json:"ed25519,omitempty"` -} - -func (m *PubKeySet) Reset() { *m = PubKeySet{} } -func (m *PubKeySet) String() string { return proto.CompactTextString(m) } -func (*PubKeySet) ProtoMessage() {} -func (*PubKeySet) Descriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{0} -} -func (m *PubKeySet) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *PubKeySet) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PubKeySet.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 *PubKeySet) XXX_Merge(src proto.Message) { - xxx_messageInfo_PubKeySet.Merge(m, src) -} -func (m *PubKeySet) XXX_Size() int { - return m.Size() -} -func (m *PubKeySet) XXX_DiscardUnknown() { - xxx_messageInfo_PubKeySet.DiscardUnknown(m) -} - -var xxx_messageInfo_PubKeySet proto.InternalMessageInfo - -func (m *PubKeySet) GetSecp256k1() PubKey { - if m != nil { - return m.Secp256k1 - } - return "" -} - -func (m *PubKeySet) GetEd25519() PubKey { - if m != nil { - return m.Ed25519 - } - return "" -} - -type Chain struct { - ChainName ChainName `protobuf:"varint,1,opt,name=chain_name,json=chainName,proto3,enum=common.ChainName" json:"chain_name,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` -} - -func (m *Chain) Reset() { *m = Chain{} } -func (m *Chain) String() string { return proto.CompactTextString(m) } -func (*Chain) ProtoMessage() {} -func (*Chain) Descriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{1} -} -func (m *Chain) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) -} -func (m *Chain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Chain.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 *Chain) XXX_Merge(src proto.Message) { - xxx_messageInfo_Chain.Merge(m, src) -} -func (m *Chain) XXX_Size() int { - return m.Size() -} -func (m *Chain) XXX_DiscardUnknown() { - xxx_messageInfo_Chain.DiscardUnknown(m) -} - -var xxx_messageInfo_Chain proto.InternalMessageInfo - -func (m *Chain) GetChainName() ChainName { - if m != nil { - return m.ChainName - } - return ChainName_empty -} - -func (m *Chain) GetChainId() int64 { - if m != nil { - return m.ChainId - } - return 0 -} - type BlockHeader struct { Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` @@ -273,7 +39,7 @@ func (m *BlockHeader) Reset() { *m = BlockHeader{} } func (m *BlockHeader) String() string { return proto.CompactTextString(m) } func (*BlockHeader) ProtoMessage() {} func (*BlockHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{2} + return fileDescriptor_248469268b1ea9af, []int{0} } func (m *BlockHeader) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -349,7 +115,7 @@ func (m *HeaderData) Reset() { *m = HeaderData{} } func (m *HeaderData) String() string { return proto.CompactTextString(m) } func (*HeaderData) ProtoMessage() {} func (*HeaderData) Descriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{3} + return fileDescriptor_248469268b1ea9af, []int{1} } func (m *HeaderData) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -435,7 +201,7 @@ func (m *Proof) Reset() { *m = Proof{} } func (m *Proof) String() string { return proto.CompactTextString(m) } func (*Proof) ProtoMessage() {} func (*Proof) Descriptor() ([]byte, []int) { - return fileDescriptor_8f954d82c0b891f6, []int{4} + return fileDescriptor_248469268b1ea9af, []int{2} } func (m *Proof) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -510,134 +276,39 @@ func (*Proof) XXX_OneofWrappers() []interface{} { } func init() { - proto.RegisterEnum("common.ReceiveStatus", ReceiveStatus_name, ReceiveStatus_value) - proto.RegisterEnum("common.CoinType", CoinType_name, CoinType_value) - proto.RegisterEnum("common.ChainName", ChainName_name, ChainName_value) - proto.RegisterType((*PubKeySet)(nil), "common.PubKeySet") - proto.RegisterType((*Chain)(nil), "common.Chain") - proto.RegisterType((*BlockHeader)(nil), "common.BlockHeader") - proto.RegisterType((*HeaderData)(nil), "common.HeaderData") - proto.RegisterType((*Proof)(nil), "common.Proof") -} - -func init() { proto.RegisterFile("common/common.proto", fileDescriptor_8f954d82c0b891f6) } - -var fileDescriptor_8f954d82c0b891f6 = []byte{ - // 693 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x94, 0xcd, 0x6e, 0xd3, 0x4a, - 0x14, 0xc7, 0xed, 0x7c, 0xfb, 0x24, 0x4d, 0x7c, 0xa7, 0x57, 0xf7, 0xf6, 0x56, 0x57, 0x4e, 0x15, - 0x81, 0x28, 0x95, 0x48, 0xdb, 0xa0, 0xf0, 0x21, 0x16, 0x48, 0x09, 0x1f, 0x45, 0x48, 0xa8, 0x72, - 0xba, 0xea, 0x26, 0x1a, 0xdb, 0x07, 0xdb, 0x6a, 0xec, 0xb1, 0xec, 0x09, 0x52, 0xd8, 0xf1, 0x06, - 0x3c, 0x04, 0x12, 0x3c, 0x01, 0xcf, 0xd0, 0x65, 0x97, 0xac, 0x2a, 0x94, 0xbe,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 0xb3, 0xa5, 0xeb, 0x62, 0x96, 0x99, 0x3a, - 0x01, 0x68, 0xbc, 0xa2, 0xe1, 0x02, 0x3d, 0xb3, 0xb2, 0x5b, 0xfb, 0xf6, 0xc5, 0xd2, 0x0f, 0x1e, - 0x43, 0x6b, 0xca, 0xc2, 0xf8, 0x6c, 0x95, 0x20, 0x69, 0x41, 0xed, 0x1c, 0x39, 0x35, 0x35, 0xd2, - 0x84, 0xea, 0x6b, 0x2a, 0x0c, 0x06, 0xd4, 0x5f, 0xda, 0xd3, 0xd1, 0x91, 0x59, 0x11, 0x6c, 0x1a, - 0x79, 0x66, 0xb5, 0x30, 0x7e, 0xaf, 0x80, 0x51, 0xde, 0x20, 0xa1, 0xc3, 0x28, 0xe1, 0x2b, 0x53, - 0x23, 0x3d, 0x68, 0x23, 0x0f, 0xe6, 0x11, 0x0d, 0xe3, 0x18, 0xb9, 0xa9, 0x13, 0x13, 0x3a, 0x1f, - 0x91, 0xd3, 0x92, 0x54, 0x84, 0xc4, 0xe1, 0x6e, 0x09, 0xaa, 0x64, 0x1b, 0x7a, 0x09, 0x5b, 0xac, - 0x7c, 0x16, 0x97, 0xb0, 0x26, 0x55, 0xd9, 0x46, 0x55, 0x27, 0x04, 0xba, 0x3e, 0xc3, 0x74, 0x11, - 0xce, 0x39, 0x66, 0x5c, 0xb0, 0x86, 0x60, 0xd1, 0x32, 0x72, 0xe8, 0x86, 0x35, 0x45, 0x37, 0x9f, - 0xc6, 0xd4, 0x0d, 0xb0, 0x84, 0x2d, 0x21, 0x74, 0x28, 0x73, 0xa8, 0x53, 0x32, 0x43, 0x4d, 0x50, - 0x00, 0xca, 0x55, 0x15, 0x69, 0xab, 0x55, 0x15, 0xe8, 0x88, 0xe6, 0x19, 0x26, 0x6c, 0x11, 0x6e, - 0x54, 0x5b, 0x72, 0x62, 0xbe, 0xd9, 0x82, 0xb9, 0x74, 0x21, 0x60, 0x57, 0x59, 0x53, 0xf4, 0x85, - 0xd0, 0xec, 0xe5, 0x3f, 0xdc, 0xe4, 0xf9, 0xe5, 0xda, 0xd2, 0xaf, 0xd6, 0x96, 0xfe, 0x73, 0x6d, - 0xe9, 0x9f, 0x6f, 0x2c, 0xed, 0xea, 0xc6, 0xd2, 0x7e, 0xdc, 0x58, 0xda, 0xf9, 0x5d, 0x3f, 0xe4, - 0xc1, 0xd2, 0x11, 0xd7, 0xfb, 0x50, 0xac, 0xf1, 0x40, 0xfe, 0x03, 0x64, 0xe8, 0xb2, 0x14, 0x8b, - 0x2f, 0x95, 0xd3, 0x90, 0x9f, 0x93, 0x87, 0xbf, 0x03, 0x00, 0x00, 0xff, 0xff, 0x67, 0xf0, 0x01, - 0x28, 0xc1, 0x04, 0x00, 0x00, -} - -func (m *PubKeySet) 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 *PubKeySet) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *PubKeySet) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if len(m.Ed25519) > 0 { - i -= len(m.Ed25519) - copy(dAtA[i:], m.Ed25519) - i = encodeVarintCommon(dAtA, i, uint64(len(m.Ed25519))) - i-- - dAtA[i] = 0x12 - } - if len(m.Secp256k1) > 0 { - i -= len(m.Secp256k1) - copy(dAtA[i:], m.Secp256k1) - i = encodeVarintCommon(dAtA, i, uint64(len(m.Secp256k1))) - i-- - dAtA[i] = 0xa - } - return len(dAtA) - i, nil -} - -func (m *Chain) 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 *Chain) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *Chain) MarshalToSizedBuffer(dAtA []byte) (int, error) { - i := len(dAtA) - _ = i - var l int - _ = l - if m.ChainId != 0 { - i = encodeVarintCommon(dAtA, i, uint64(m.ChainId)) - i-- - dAtA[i] = 0x10 - } - if m.ChainName != 0 { - i = encodeVarintCommon(dAtA, i, uint64(m.ChainName)) - i-- - dAtA[i] = 0x8 - } - return len(dAtA) - i, nil + proto.RegisterType((*BlockHeader)(nil), "proofs.BlockHeader") + proto.RegisterType((*HeaderData)(nil), "proofs.HeaderData") + proto.RegisterType((*Proof)(nil), "proofs.Proof") +} + +func init() { proto.RegisterFile("pkg/proofs/proofs.proto", fileDescriptor_248469268b1ea9af) } + +var fileDescriptor_248469268b1ea9af = []byte{ + // 373 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x91, 0xbd, 0x6e, 0xea, 0x30, + 0x14, 0xc7, 0x63, 0x08, 0xe1, 0xea, 0x84, 0x0b, 0x92, 0x75, 0x75, 0x6f, 0x2e, 0x43, 0x88, 0xb2, + 0x14, 0x86, 0x26, 0x15, 0x55, 0xa5, 0xce, 0x69, 0x07, 0xba, 0x55, 0x19, 0xbb, 0x44, 0x26, 0x71, + 0xe3, 0x88, 0x82, 0xa3, 0x60, 0x96, 0x6e, 0x7d, 0x83, 0xbe, 0x45, 0x5f, 0x85, 0x91, 0xb1, 0x53, + 0x55, 0xc1, 0x8b, 0x54, 0x71, 0x6c, 0x60, 0xf2, 0xf9, 0xf8, 0x9d, 0xbf, 0xcf, 0x07, 0xfc, 0x2b, + 0x17, 0x79, 0x58, 0x56, 0x9c, 0x3f, 0xaf, 0xd5, 0x13, 0x94, 0x15, 0x17, 0x1c, 0x5b, 0x8d, 0x37, + 0xfc, 0x93, 0xf3, 0x9c, 0xcb, 0x50, 0x58, 0x5b, 0x4d, 0x76, 0xe8, 0x9d, 0x95, 0xcd, 0x0b, 0x91, + 0xf2,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0x85, 0xfd, 0x40, 0x9f, 0x48, 0xd7, 0xf5, 0x54, + 0x40, 0xfa, 0x51, 0x17, 0x3a, 0x12, 0x8f, 0xee, 0xb6, 0x7b, 0x17, 0xed, 0xf6, 0x2e, 0xfa, 0xde, + 0xbb, 0xe8, 0xfd, 0xe0, 0x1a, 0xbb, 0x83, 0x6b, 0x7c, 0x1e, 0x5c, 0xe3, 0x69, 0x92, 0x17, 0x82, + 0x6d, 0xe6, 0x41, 0xca, 0x97, 0xe1, 0x2b, 0x15, 0xe4, 0x52, 0xae, 0x54, 0x9a, 0x29, 0xaf, 0x68, + 0x78, 0x3a, 0xfa, 0xdc, 0x92, 0x37, 0xbe, 0xfe, 0x09, 0x00, 0x00, 0xff, 0xff, 0x53, 0xf1, 0xe6, + 0x53, 0x62, 0x02, 0x00, 0x00, } func (m *BlockHeader) Marshal() (dAtA []byte, err error) { @@ -666,31 +337,31 @@ func (m *BlockHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintCommon(dAtA, i, uint64(size)) + i = encodeVarintProofs(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x2a if m.ChainId != 0 { - i = encodeVarintCommon(dAtA, i, uint64(m.ChainId)) + i = encodeVarintProofs(dAtA, i, uint64(m.ChainId)) i-- dAtA[i] = 0x20 } if len(m.ParentHash) > 0 { i -= len(m.ParentHash) copy(dAtA[i:], m.ParentHash) - i = encodeVarintCommon(dAtA, i, uint64(len(m.ParentHash))) + i = encodeVarintProofs(dAtA, i, uint64(len(m.ParentHash))) i-- dAtA[i] = 0x1a } if len(m.Hash) > 0 { i -= len(m.Hash) copy(dAtA[i:], m.Hash) - i = encodeVarintCommon(dAtA, i, uint64(len(m.Hash))) + i = encodeVarintProofs(dAtA, i, uint64(len(m.Hash))) i-- dAtA[i] = 0x12 } if m.Height != 0 { - i = encodeVarintCommon(dAtA, i, uint64(m.Height)) + i = encodeVarintProofs(dAtA, i, uint64(m.Height)) i-- dAtA[i] = 0x8 } @@ -739,7 +410,7 @@ func (m *HeaderData_EthereumHeader) MarshalToSizedBuffer(dAtA []byte) (int, erro if m.EthereumHeader != nil { i -= len(m.EthereumHeader) copy(dAtA[i:], m.EthereumHeader) - i = encodeVarintCommon(dAtA, i, uint64(len(m.EthereumHeader))) + i = encodeVarintProofs(dAtA, i, uint64(len(m.EthereumHeader))) i-- dAtA[i] = 0xa } @@ -755,7 +426,7 @@ func (m *HeaderData_BitcoinHeader) MarshalToSizedBuffer(dAtA []byte) (int, error if m.BitcoinHeader != nil { i -= len(m.BitcoinHeader) copy(dAtA[i:], m.BitcoinHeader) - i = encodeVarintCommon(dAtA, i, uint64(len(m.BitcoinHeader))) + i = encodeVarintProofs(dAtA, i, uint64(len(m.BitcoinHeader))) i-- dAtA[i] = 0x12 } @@ -807,7 +478,7 @@ func (m *Proof_EthereumProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintCommon(dAtA, i, uint64(size)) + i = encodeVarintProofs(dAtA, i, uint64(size)) } i-- dAtA[i] = 0xa @@ -828,15 +499,15 @@ func (m *Proof_BitcoinProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { return 0, err } i -= size - i = encodeVarintCommon(dAtA, i, uint64(size)) + i = encodeVarintProofs(dAtA, i, uint64(size)) } i-- dAtA[i] = 0x12 } return len(dAtA) - i, nil } -func encodeVarintCommon(dAtA []byte, offset int, v uint64) int { - offset -= sovCommon(v) +func encodeVarintProofs(dAtA []byte, offset int, v uint64) int { + offset -= sovProofs(v) base := offset for v >= 1<<7 { dAtA[offset] = uint8(v&0x7f | 0x80) @@ -846,38 +517,6 @@ func encodeVarintCommon(dAtA []byte, offset int, v uint64) int { dAtA[offset] = uint8(v) return base } -func (m *PubKeySet) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Secp256k1) - if l > 0 { - n += 1 + l + sovCommon(uint64(l)) - } - l = len(m.Ed25519) - if l > 0 { - n += 1 + l + sovCommon(uint64(l)) - } - return n -} - -func (m *Chain) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.ChainName != 0 { - n += 1 + sovCommon(uint64(m.ChainName)) - } - if m.ChainId != 0 { - n += 1 + sovCommon(uint64(m.ChainId)) - } - return n -} - func (m *BlockHeader) Size() (n int) { if m == nil { return 0 @@ -885,21 +524,21 @@ func (m *BlockHeader) Size() (n int) { var l int _ = l if m.Height != 0 { - n += 1 + sovCommon(uint64(m.Height)) + n += 1 + sovProofs(uint64(m.Height)) } l = len(m.Hash) if l > 0 { - n += 1 + l + sovCommon(uint64(l)) + n += 1 + l + sovProofs(uint64(l)) } l = len(m.ParentHash) if l > 0 { - n += 1 + l + sovCommon(uint64(l)) + n += 1 + l + sovProofs(uint64(l)) } if m.ChainId != 0 { - n += 1 + sovCommon(uint64(m.ChainId)) + n += 1 + sovProofs(uint64(m.ChainId)) } l = m.Header.Size() - n += 1 + l + sovCommon(uint64(l)) + n += 1 + l + sovProofs(uint64(l)) return n } @@ -923,7 +562,7 @@ func (m *HeaderData_EthereumHeader) Size() (n int) { _ = l if m.EthereumHeader != nil { l = len(m.EthereumHeader) - n += 1 + l + sovCommon(uint64(l)) + n += 1 + l + sovProofs(uint64(l)) } return n } @@ -935,7 +574,7 @@ func (m *HeaderData_BitcoinHeader) Size() (n int) { _ = l if m.BitcoinHeader != nil { l = len(m.BitcoinHeader) - n += 1 + l + sovCommon(uint64(l)) + n += 1 + l + sovProofs(uint64(l)) } return n } @@ -959,7 +598,7 @@ func (m *Proof_EthereumProof) Size() (n int) { _ = l if m.EthereumProof != nil { l = m.EthereumProof.Size() - n += 1 + l + sovCommon(uint64(l)) + n += 1 + l + sovProofs(uint64(l)) } return n } @@ -971,218 +610,16 @@ func (m *Proof_BitcoinProof) Size() (n int) { _ = l if m.BitcoinProof != nil { l = m.BitcoinProof.Size() - n += 1 + l + sovCommon(uint64(l)) + n += 1 + l + sovProofs(uint64(l)) } return n } -func sovCommon(x uint64) (n int) { +func sovProofs(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } -func sozCommon(x uint64) (n int) { - return sovCommon(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (m *PubKeySet) 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 ErrIntOverflowCommon - } - 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: PubKeySet: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PubKeySet: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Secp256k1", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - 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 ErrInvalidLengthCommon - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCommon - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Secp256k1 = PubKey(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Ed25519", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - 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 ErrInvalidLengthCommon - } - postIndex := iNdEx + intStringLen - if postIndex < 0 { - return ErrInvalidLengthCommon - } - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Ed25519 = PubKey(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipCommon(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCommon - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Chain) 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 ErrIntOverflowCommon - } - 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: Chain: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Chain: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainName", wireType) - } - m.ChainName = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChainName |= ChainName(b&0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ChainId", wireType) - } - m.ChainId = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowCommon - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ChainId |= int64(b&0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipCommon(dAtA[iNdEx:]) - if err != nil { - return err - } - if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCommon - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil +func sozProofs(x uint64) (n int) { + return sovProofs(uint64((x << 1) ^ uint64((int64(x) >> 63)))) } func (m *BlockHeader) Unmarshal(dAtA []byte) error { l := len(dAtA) @@ -1192,7 +629,7 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1220,7 +657,7 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error { m.Height = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1239,7 +676,7 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1252,11 +689,11 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } if postIndex > l { return io.ErrUnexpectedEOF @@ -1273,7 +710,7 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1286,11 +723,11 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } if postIndex > l { return io.ErrUnexpectedEOF @@ -1307,7 +744,7 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error { m.ChainId = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1326,7 +763,7 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1339,11 +776,11 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } if postIndex > l { return io.ErrUnexpectedEOF @@ -1354,12 +791,12 @@ func (m *BlockHeader) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipCommon(dAtA[iNdEx:]) + skippy, err := skipProofs(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1381,7 +818,7 @@ func (m *HeaderData) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1409,7 +846,7 @@ func (m *HeaderData) Unmarshal(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1422,11 +859,11 @@ func (m *HeaderData) Unmarshal(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } if postIndex > l { return io.ErrUnexpectedEOF @@ -1442,7 +879,7 @@ func (m *HeaderData) Unmarshal(dAtA []byte) error { var byteLen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1455,11 +892,11 @@ func (m *HeaderData) Unmarshal(dAtA []byte) error { } } if byteLen < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } postIndex := iNdEx + byteLen if postIndex < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } if postIndex > l { return io.ErrUnexpectedEOF @@ -1470,12 +907,12 @@ func (m *HeaderData) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipCommon(dAtA[iNdEx:]) + skippy, err := skipProofs(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1497,7 +934,7 @@ func (m *Proof) Unmarshal(dAtA []byte) error { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1525,7 +962,7 @@ func (m *Proof) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1538,11 +975,11 @@ func (m *Proof) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } if postIndex > l { return io.ErrUnexpectedEOF @@ -1560,7 +997,7 @@ func (m *Proof) Unmarshal(dAtA []byte) error { var msglen int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return ErrIntOverflowCommon + return ErrIntOverflowProofs } if iNdEx >= l { return io.ErrUnexpectedEOF @@ -1573,11 +1010,11 @@ func (m *Proof) Unmarshal(dAtA []byte) error { } } if msglen < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } postIndex := iNdEx + msglen if postIndex < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } if postIndex > l { return io.ErrUnexpectedEOF @@ -1590,12 +1027,12 @@ func (m *Proof) Unmarshal(dAtA []byte) error { iNdEx = postIndex default: iNdEx = preIndex - skippy, err := skipCommon(dAtA[iNdEx:]) + skippy, err := skipProofs(dAtA[iNdEx:]) if err != nil { return err } if (skippy < 0) || (iNdEx+skippy) < 0 { - return ErrInvalidLengthCommon + return ErrInvalidLengthProofs } if (iNdEx + skippy) > l { return io.ErrUnexpectedEOF @@ -1609,7 +1046,7 @@ func (m *Proof) Unmarshal(dAtA []byte) error { } return nil } -func skipCommon(dAtA []byte) (n int, err error) { +func skipProofs(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 depth := 0 @@ -1617,7 +1054,7 @@ func skipCommon(dAtA []byte) (n int, err error) { var wire uint64 for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowCommon + return 0, ErrIntOverflowProofs } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1634,7 +1071,7 @@ func skipCommon(dAtA []byte) (n int, err error) { case 0: for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowCommon + return 0, ErrIntOverflowProofs } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1650,7 +1087,7 @@ func skipCommon(dAtA []byte) (n int, err error) { var length int for shift := uint(0); ; shift += 7 { if shift >= 64 { - return 0, ErrIntOverflowCommon + return 0, ErrIntOverflowProofs } if iNdEx >= l { return 0, io.ErrUnexpectedEOF @@ -1663,14 +1100,14 @@ func skipCommon(dAtA []byte) (n int, err error) { } } if length < 0 { - return 0, ErrInvalidLengthCommon + return 0, ErrInvalidLengthProofs } iNdEx += length case 3: depth++ case 4: if depth == 0 { - return 0, ErrUnexpectedEndOfGroupCommon + return 0, ErrUnexpectedEndOfGroupProofs } depth-- case 5: @@ -1679,7 +1116,7 @@ func skipCommon(dAtA []byte) (n int, err error) { return 0, fmt.Errorf("proto: illegal wireType %d", wireType) } if iNdEx < 0 { - return 0, ErrInvalidLengthCommon + return 0, ErrInvalidLengthProofs } if depth == 0 { return iNdEx, nil @@ -1689,7 +1126,7 @@ func skipCommon(dAtA []byte) (n int, err error) { } var ( - ErrInvalidLengthCommon = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowCommon = fmt.Errorf("proto: integer overflow") - ErrUnexpectedEndOfGroupCommon = fmt.Errorf("proto: unexpected end of group") + ErrInvalidLengthProofs = fmt.Errorf("proto: negative length found during unmarshaling") + ErrIntOverflowProofs = fmt.Errorf("proto: integer overflow") + ErrUnexpectedEndOfGroupProofs = fmt.Errorf("proto: unexpected end of group") ) diff --git a/common/testdata/eth_header_18495266.json b/pkg/testdata/eth_header_18495266.json similarity index 100% rename from common/testdata/eth_header_18495266.json rename to pkg/testdata/eth_header_18495266.json diff --git a/common/testdata/ethereum/header.json b/pkg/testdata/ethereum/header.json similarity index 100% rename from common/testdata/ethereum/header.json rename to pkg/testdata/ethereum/header.json diff --git a/common/testdata/ethereum/receipt_0.json b/pkg/testdata/ethereum/receipt_0.json similarity index 100% rename from common/testdata/ethereum/receipt_0.json rename to pkg/testdata/ethereum/receipt_0.json diff --git a/common/testdata/ethereum/receipt_1.json b/pkg/testdata/ethereum/receipt_1.json similarity index 100% rename from common/testdata/ethereum/receipt_1.json rename to pkg/testdata/ethereum/receipt_1.json diff --git a/common/testdata/ethereum/receipt_10.json b/pkg/testdata/ethereum/receipt_10.json similarity index 100% rename from common/testdata/ethereum/receipt_10.json rename to pkg/testdata/ethereum/receipt_10.json diff --git a/common/testdata/ethereum/receipt_11.json b/pkg/testdata/ethereum/receipt_11.json similarity index 100% rename from common/testdata/ethereum/receipt_11.json rename to pkg/testdata/ethereum/receipt_11.json diff --git a/common/testdata/ethereum/receipt_12.json b/pkg/testdata/ethereum/receipt_12.json similarity index 100% rename from common/testdata/ethereum/receipt_12.json rename to pkg/testdata/ethereum/receipt_12.json diff --git a/common/testdata/ethereum/receipt_13.json b/pkg/testdata/ethereum/receipt_13.json similarity index 100% rename from common/testdata/ethereum/receipt_13.json rename to pkg/testdata/ethereum/receipt_13.json diff --git a/common/testdata/ethereum/receipt_14.json b/pkg/testdata/ethereum/receipt_14.json similarity index 100% rename from common/testdata/ethereum/receipt_14.json rename to pkg/testdata/ethereum/receipt_14.json diff --git a/common/testdata/ethereum/receipt_15.json b/pkg/testdata/ethereum/receipt_15.json similarity index 100% rename from common/testdata/ethereum/receipt_15.json rename to pkg/testdata/ethereum/receipt_15.json diff --git a/common/testdata/ethereum/receipt_16.json b/pkg/testdata/ethereum/receipt_16.json similarity index 100% rename from common/testdata/ethereum/receipt_16.json rename to pkg/testdata/ethereum/receipt_16.json diff --git a/common/testdata/ethereum/receipt_17.json b/pkg/testdata/ethereum/receipt_17.json similarity index 100% rename from common/testdata/ethereum/receipt_17.json rename to pkg/testdata/ethereum/receipt_17.json diff --git a/common/testdata/ethereum/receipt_18.json b/pkg/testdata/ethereum/receipt_18.json similarity index 100% rename from common/testdata/ethereum/receipt_18.json rename to pkg/testdata/ethereum/receipt_18.json diff --git a/common/testdata/ethereum/receipt_19.json b/pkg/testdata/ethereum/receipt_19.json similarity index 100% rename from common/testdata/ethereum/receipt_19.json rename to pkg/testdata/ethereum/receipt_19.json diff --git a/common/testdata/ethereum/receipt_2.json b/pkg/testdata/ethereum/receipt_2.json similarity index 100% rename from common/testdata/ethereum/receipt_2.json rename to pkg/testdata/ethereum/receipt_2.json diff --git a/common/testdata/ethereum/receipt_20.json b/pkg/testdata/ethereum/receipt_20.json similarity index 100% rename from common/testdata/ethereum/receipt_20.json rename to pkg/testdata/ethereum/receipt_20.json diff --git a/common/testdata/ethereum/receipt_21.json b/pkg/testdata/ethereum/receipt_21.json similarity index 100% rename from common/testdata/ethereum/receipt_21.json rename to pkg/testdata/ethereum/receipt_21.json diff --git a/common/testdata/ethereum/receipt_22.json b/pkg/testdata/ethereum/receipt_22.json similarity index 100% rename from common/testdata/ethereum/receipt_22.json rename to pkg/testdata/ethereum/receipt_22.json diff --git a/common/testdata/ethereum/receipt_23.json b/pkg/testdata/ethereum/receipt_23.json similarity index 100% rename from common/testdata/ethereum/receipt_23.json rename to pkg/testdata/ethereum/receipt_23.json diff --git a/common/testdata/ethereum/receipt_24.json b/pkg/testdata/ethereum/receipt_24.json similarity index 100% rename from common/testdata/ethereum/receipt_24.json rename to pkg/testdata/ethereum/receipt_24.json diff --git a/common/testdata/ethereum/receipt_25.json b/pkg/testdata/ethereum/receipt_25.json similarity index 100% rename from common/testdata/ethereum/receipt_25.json rename to pkg/testdata/ethereum/receipt_25.json diff --git a/common/testdata/ethereum/receipt_26.json b/pkg/testdata/ethereum/receipt_26.json similarity index 100% rename from common/testdata/ethereum/receipt_26.json rename to pkg/testdata/ethereum/receipt_26.json diff --git a/common/testdata/ethereum/receipt_27.json b/pkg/testdata/ethereum/receipt_27.json similarity index 100% rename from common/testdata/ethereum/receipt_27.json rename to pkg/testdata/ethereum/receipt_27.json diff --git a/common/testdata/ethereum/receipt_28.json b/pkg/testdata/ethereum/receipt_28.json similarity index 100% rename from common/testdata/ethereum/receipt_28.json rename to pkg/testdata/ethereum/receipt_28.json diff --git a/common/testdata/ethereum/receipt_29.json b/pkg/testdata/ethereum/receipt_29.json similarity index 100% rename from common/testdata/ethereum/receipt_29.json rename to pkg/testdata/ethereum/receipt_29.json diff --git a/common/testdata/ethereum/receipt_3.json b/pkg/testdata/ethereum/receipt_3.json similarity index 100% rename from common/testdata/ethereum/receipt_3.json rename to pkg/testdata/ethereum/receipt_3.json diff --git a/common/testdata/ethereum/receipt_30.json b/pkg/testdata/ethereum/receipt_30.json similarity index 100% rename from common/testdata/ethereum/receipt_30.json rename to pkg/testdata/ethereum/receipt_30.json diff --git a/common/testdata/ethereum/receipt_31.json b/pkg/testdata/ethereum/receipt_31.json similarity index 100% rename from common/testdata/ethereum/receipt_31.json rename to pkg/testdata/ethereum/receipt_31.json diff --git a/common/testdata/ethereum/receipt_32.json b/pkg/testdata/ethereum/receipt_32.json similarity index 100% rename from common/testdata/ethereum/receipt_32.json rename to pkg/testdata/ethereum/receipt_32.json diff --git a/common/testdata/ethereum/receipt_33.json b/pkg/testdata/ethereum/receipt_33.json similarity index 100% rename from common/testdata/ethereum/receipt_33.json rename to pkg/testdata/ethereum/receipt_33.json diff --git a/common/testdata/ethereum/receipt_34.json b/pkg/testdata/ethereum/receipt_34.json similarity index 100% rename from common/testdata/ethereum/receipt_34.json rename to pkg/testdata/ethereum/receipt_34.json diff --git a/common/testdata/ethereum/receipt_35.json b/pkg/testdata/ethereum/receipt_35.json similarity index 100% rename from common/testdata/ethereum/receipt_35.json rename to pkg/testdata/ethereum/receipt_35.json diff --git a/common/testdata/ethereum/receipt_36.json b/pkg/testdata/ethereum/receipt_36.json similarity index 100% rename from common/testdata/ethereum/receipt_36.json rename to pkg/testdata/ethereum/receipt_36.json diff --git a/common/testdata/ethereum/receipt_37.json b/pkg/testdata/ethereum/receipt_37.json similarity index 100% rename from common/testdata/ethereum/receipt_37.json rename to pkg/testdata/ethereum/receipt_37.json diff --git a/common/testdata/ethereum/receipt_38.json b/pkg/testdata/ethereum/receipt_38.json similarity index 100% rename from common/testdata/ethereum/receipt_38.json rename to pkg/testdata/ethereum/receipt_38.json diff --git a/common/testdata/ethereum/receipt_39.json b/pkg/testdata/ethereum/receipt_39.json similarity index 100% rename from common/testdata/ethereum/receipt_39.json rename to pkg/testdata/ethereum/receipt_39.json diff --git a/common/testdata/ethereum/receipt_4.json b/pkg/testdata/ethereum/receipt_4.json similarity index 100% rename from common/testdata/ethereum/receipt_4.json rename to pkg/testdata/ethereum/receipt_4.json diff --git a/common/testdata/ethereum/receipt_40.json b/pkg/testdata/ethereum/receipt_40.json similarity index 100% rename from common/testdata/ethereum/receipt_40.json rename to pkg/testdata/ethereum/receipt_40.json diff --git a/common/testdata/ethereum/receipt_41.json b/pkg/testdata/ethereum/receipt_41.json similarity index 100% rename from common/testdata/ethereum/receipt_41.json rename to pkg/testdata/ethereum/receipt_41.json diff --git a/common/testdata/ethereum/receipt_42.json b/pkg/testdata/ethereum/receipt_42.json similarity index 100% rename from common/testdata/ethereum/receipt_42.json rename to pkg/testdata/ethereum/receipt_42.json diff --git a/common/testdata/ethereum/receipt_43.json b/pkg/testdata/ethereum/receipt_43.json similarity index 100% rename from common/testdata/ethereum/receipt_43.json rename to pkg/testdata/ethereum/receipt_43.json diff --git a/common/testdata/ethereum/receipt_44.json b/pkg/testdata/ethereum/receipt_44.json similarity index 100% rename from common/testdata/ethereum/receipt_44.json rename to pkg/testdata/ethereum/receipt_44.json diff --git a/common/testdata/ethereum/receipt_45.json b/pkg/testdata/ethereum/receipt_45.json similarity index 100% rename from common/testdata/ethereum/receipt_45.json rename to pkg/testdata/ethereum/receipt_45.json diff --git a/common/testdata/ethereum/receipt_46.json b/pkg/testdata/ethereum/receipt_46.json similarity index 100% rename from common/testdata/ethereum/receipt_46.json rename to pkg/testdata/ethereum/receipt_46.json diff --git a/common/testdata/ethereum/receipt_47.json b/pkg/testdata/ethereum/receipt_47.json similarity index 100% rename from common/testdata/ethereum/receipt_47.json rename to pkg/testdata/ethereum/receipt_47.json diff --git a/common/testdata/ethereum/receipt_48.json b/pkg/testdata/ethereum/receipt_48.json similarity index 100% rename from common/testdata/ethereum/receipt_48.json rename to pkg/testdata/ethereum/receipt_48.json diff --git a/common/testdata/ethereum/receipt_49.json b/pkg/testdata/ethereum/receipt_49.json similarity index 100% rename from common/testdata/ethereum/receipt_49.json rename to pkg/testdata/ethereum/receipt_49.json diff --git a/common/testdata/ethereum/receipt_5.json b/pkg/testdata/ethereum/receipt_5.json similarity index 100% rename from common/testdata/ethereum/receipt_5.json rename to pkg/testdata/ethereum/receipt_5.json diff --git a/common/testdata/ethereum/receipt_50.json b/pkg/testdata/ethereum/receipt_50.json similarity index 100% rename from common/testdata/ethereum/receipt_50.json rename to pkg/testdata/ethereum/receipt_50.json diff --git a/common/testdata/ethereum/receipt_51.json b/pkg/testdata/ethereum/receipt_51.json similarity index 100% rename from common/testdata/ethereum/receipt_51.json rename to pkg/testdata/ethereum/receipt_51.json diff --git a/common/testdata/ethereum/receipt_52.json b/pkg/testdata/ethereum/receipt_52.json similarity index 100% rename from common/testdata/ethereum/receipt_52.json rename to pkg/testdata/ethereum/receipt_52.json diff --git a/common/testdata/ethereum/receipt_53.json b/pkg/testdata/ethereum/receipt_53.json similarity index 100% rename from common/testdata/ethereum/receipt_53.json rename to pkg/testdata/ethereum/receipt_53.json diff --git a/common/testdata/ethereum/receipt_54.json b/pkg/testdata/ethereum/receipt_54.json similarity index 100% rename from common/testdata/ethereum/receipt_54.json rename to pkg/testdata/ethereum/receipt_54.json diff --git a/common/testdata/ethereum/receipt_55.json b/pkg/testdata/ethereum/receipt_55.json similarity index 100% rename from common/testdata/ethereum/receipt_55.json rename to pkg/testdata/ethereum/receipt_55.json diff --git a/common/testdata/ethereum/receipt_56.json b/pkg/testdata/ethereum/receipt_56.json similarity index 100% rename from common/testdata/ethereum/receipt_56.json rename to pkg/testdata/ethereum/receipt_56.json diff --git a/common/testdata/ethereum/receipt_57.json b/pkg/testdata/ethereum/receipt_57.json similarity index 100% rename from common/testdata/ethereum/receipt_57.json rename to pkg/testdata/ethereum/receipt_57.json diff --git a/common/testdata/ethereum/receipt_58.json b/pkg/testdata/ethereum/receipt_58.json similarity index 100% rename from common/testdata/ethereum/receipt_58.json rename to pkg/testdata/ethereum/receipt_58.json diff --git a/common/testdata/ethereum/receipt_59.json b/pkg/testdata/ethereum/receipt_59.json similarity index 100% rename from common/testdata/ethereum/receipt_59.json rename to pkg/testdata/ethereum/receipt_59.json diff --git a/common/testdata/ethereum/receipt_6.json b/pkg/testdata/ethereum/receipt_6.json similarity index 100% rename from common/testdata/ethereum/receipt_6.json rename to pkg/testdata/ethereum/receipt_6.json diff --git a/common/testdata/ethereum/receipt_60.json b/pkg/testdata/ethereum/receipt_60.json similarity index 100% rename from common/testdata/ethereum/receipt_60.json rename to pkg/testdata/ethereum/receipt_60.json diff --git a/common/testdata/ethereum/receipt_61.json b/pkg/testdata/ethereum/receipt_61.json similarity index 100% rename from common/testdata/ethereum/receipt_61.json rename to pkg/testdata/ethereum/receipt_61.json diff --git a/common/testdata/ethereum/receipt_62.json b/pkg/testdata/ethereum/receipt_62.json similarity index 100% rename from common/testdata/ethereum/receipt_62.json rename to pkg/testdata/ethereum/receipt_62.json diff --git a/common/testdata/ethereum/receipt_63.json b/pkg/testdata/ethereum/receipt_63.json similarity index 100% rename from common/testdata/ethereum/receipt_63.json rename to pkg/testdata/ethereum/receipt_63.json diff --git a/common/testdata/ethereum/receipt_64.json b/pkg/testdata/ethereum/receipt_64.json similarity index 100% rename from common/testdata/ethereum/receipt_64.json rename to pkg/testdata/ethereum/receipt_64.json diff --git a/common/testdata/ethereum/receipt_65.json b/pkg/testdata/ethereum/receipt_65.json similarity index 100% rename from common/testdata/ethereum/receipt_65.json rename to pkg/testdata/ethereum/receipt_65.json diff --git a/common/testdata/ethereum/receipt_66.json b/pkg/testdata/ethereum/receipt_66.json similarity index 100% rename from common/testdata/ethereum/receipt_66.json rename to pkg/testdata/ethereum/receipt_66.json diff --git a/common/testdata/ethereum/receipt_67.json b/pkg/testdata/ethereum/receipt_67.json similarity index 100% rename from common/testdata/ethereum/receipt_67.json rename to pkg/testdata/ethereum/receipt_67.json diff --git a/common/testdata/ethereum/receipt_68.json b/pkg/testdata/ethereum/receipt_68.json similarity index 100% rename from common/testdata/ethereum/receipt_68.json rename to pkg/testdata/ethereum/receipt_68.json diff --git a/common/testdata/ethereum/receipt_69.json b/pkg/testdata/ethereum/receipt_69.json similarity index 100% rename from common/testdata/ethereum/receipt_69.json rename to pkg/testdata/ethereum/receipt_69.json diff --git a/common/testdata/ethereum/receipt_7.json b/pkg/testdata/ethereum/receipt_7.json similarity index 100% rename from common/testdata/ethereum/receipt_7.json rename to pkg/testdata/ethereum/receipt_7.json diff --git a/common/testdata/ethereum/receipt_70.json b/pkg/testdata/ethereum/receipt_70.json similarity index 100% rename from common/testdata/ethereum/receipt_70.json rename to pkg/testdata/ethereum/receipt_70.json diff --git a/common/testdata/ethereum/receipt_71.json b/pkg/testdata/ethereum/receipt_71.json similarity index 100% rename from common/testdata/ethereum/receipt_71.json rename to pkg/testdata/ethereum/receipt_71.json diff --git a/common/testdata/ethereum/receipt_72.json b/pkg/testdata/ethereum/receipt_72.json similarity index 100% rename from common/testdata/ethereum/receipt_72.json rename to pkg/testdata/ethereum/receipt_72.json diff --git a/common/testdata/ethereum/receipt_73.json b/pkg/testdata/ethereum/receipt_73.json similarity index 100% rename from common/testdata/ethereum/receipt_73.json rename to pkg/testdata/ethereum/receipt_73.json diff --git a/common/testdata/ethereum/receipt_74.json b/pkg/testdata/ethereum/receipt_74.json similarity index 100% rename from common/testdata/ethereum/receipt_74.json rename to pkg/testdata/ethereum/receipt_74.json diff --git a/common/testdata/ethereum/receipt_75.json b/pkg/testdata/ethereum/receipt_75.json similarity index 100% rename from common/testdata/ethereum/receipt_75.json rename to pkg/testdata/ethereum/receipt_75.json diff --git a/common/testdata/ethereum/receipt_76.json b/pkg/testdata/ethereum/receipt_76.json similarity index 100% rename from common/testdata/ethereum/receipt_76.json rename to pkg/testdata/ethereum/receipt_76.json diff --git a/common/testdata/ethereum/receipt_77.json b/pkg/testdata/ethereum/receipt_77.json similarity index 100% rename from common/testdata/ethereum/receipt_77.json rename to pkg/testdata/ethereum/receipt_77.json diff --git a/common/testdata/ethereum/receipt_78.json b/pkg/testdata/ethereum/receipt_78.json similarity index 100% rename from common/testdata/ethereum/receipt_78.json rename to pkg/testdata/ethereum/receipt_78.json diff --git a/common/testdata/ethereum/receipt_79.json b/pkg/testdata/ethereum/receipt_79.json similarity index 100% rename from common/testdata/ethereum/receipt_79.json rename to pkg/testdata/ethereum/receipt_79.json diff --git a/common/testdata/ethereum/receipt_8.json b/pkg/testdata/ethereum/receipt_8.json similarity index 100% rename from common/testdata/ethereum/receipt_8.json rename to pkg/testdata/ethereum/receipt_8.json diff --git a/common/testdata/ethereum/receipt_80.json b/pkg/testdata/ethereum/receipt_80.json similarity index 100% rename from common/testdata/ethereum/receipt_80.json rename to pkg/testdata/ethereum/receipt_80.json diff --git a/common/testdata/ethereum/receipt_9.json b/pkg/testdata/ethereum/receipt_9.json similarity index 100% rename from common/testdata/ethereum/receipt_9.json rename to pkg/testdata/ethereum/receipt_9.json diff --git a/common/testdata/ethereum/tx_0.json b/pkg/testdata/ethereum/tx_0.json similarity index 100% rename from common/testdata/ethereum/tx_0.json rename to pkg/testdata/ethereum/tx_0.json diff --git a/common/testdata/ethereum/tx_1.json b/pkg/testdata/ethereum/tx_1.json similarity index 100% rename from common/testdata/ethereum/tx_1.json rename to pkg/testdata/ethereum/tx_1.json diff --git a/common/testdata/ethereum/tx_10.json b/pkg/testdata/ethereum/tx_10.json similarity index 100% rename from common/testdata/ethereum/tx_10.json rename to pkg/testdata/ethereum/tx_10.json diff --git a/common/testdata/ethereum/tx_11.json b/pkg/testdata/ethereum/tx_11.json similarity index 100% rename from common/testdata/ethereum/tx_11.json rename to pkg/testdata/ethereum/tx_11.json diff --git a/common/testdata/ethereum/tx_12.json b/pkg/testdata/ethereum/tx_12.json similarity index 100% rename from common/testdata/ethereum/tx_12.json rename to pkg/testdata/ethereum/tx_12.json diff --git a/common/testdata/ethereum/tx_13.json b/pkg/testdata/ethereum/tx_13.json similarity index 100% rename from common/testdata/ethereum/tx_13.json rename to pkg/testdata/ethereum/tx_13.json diff --git a/common/testdata/ethereum/tx_14.json b/pkg/testdata/ethereum/tx_14.json similarity index 100% rename from common/testdata/ethereum/tx_14.json rename to pkg/testdata/ethereum/tx_14.json diff --git a/common/testdata/ethereum/tx_15.json b/pkg/testdata/ethereum/tx_15.json similarity index 100% rename from common/testdata/ethereum/tx_15.json rename to pkg/testdata/ethereum/tx_15.json diff --git a/common/testdata/ethereum/tx_16.json b/pkg/testdata/ethereum/tx_16.json similarity index 100% rename from common/testdata/ethereum/tx_16.json rename to pkg/testdata/ethereum/tx_16.json diff --git a/common/testdata/ethereum/tx_17.json b/pkg/testdata/ethereum/tx_17.json similarity index 100% rename from common/testdata/ethereum/tx_17.json rename to pkg/testdata/ethereum/tx_17.json diff --git a/common/testdata/ethereum/tx_18.json b/pkg/testdata/ethereum/tx_18.json similarity index 100% rename from common/testdata/ethereum/tx_18.json rename to pkg/testdata/ethereum/tx_18.json diff --git a/common/testdata/ethereum/tx_19.json b/pkg/testdata/ethereum/tx_19.json similarity index 100% rename from common/testdata/ethereum/tx_19.json rename to pkg/testdata/ethereum/tx_19.json diff --git a/common/testdata/ethereum/tx_2.json b/pkg/testdata/ethereum/tx_2.json similarity index 100% rename from common/testdata/ethereum/tx_2.json rename to pkg/testdata/ethereum/tx_2.json diff --git a/common/testdata/ethereum/tx_20.json b/pkg/testdata/ethereum/tx_20.json similarity index 100% rename from common/testdata/ethereum/tx_20.json rename to pkg/testdata/ethereum/tx_20.json diff --git a/common/testdata/ethereum/tx_21.json b/pkg/testdata/ethereum/tx_21.json similarity index 100% rename from common/testdata/ethereum/tx_21.json rename to pkg/testdata/ethereum/tx_21.json diff --git a/common/testdata/ethereum/tx_22.json b/pkg/testdata/ethereum/tx_22.json similarity index 100% rename from common/testdata/ethereum/tx_22.json rename to pkg/testdata/ethereum/tx_22.json diff --git a/common/testdata/ethereum/tx_23.json b/pkg/testdata/ethereum/tx_23.json similarity index 100% rename from common/testdata/ethereum/tx_23.json rename to pkg/testdata/ethereum/tx_23.json diff --git a/common/testdata/ethereum/tx_24.json b/pkg/testdata/ethereum/tx_24.json similarity index 100% rename from common/testdata/ethereum/tx_24.json rename to pkg/testdata/ethereum/tx_24.json diff --git a/common/testdata/ethereum/tx_25.json b/pkg/testdata/ethereum/tx_25.json similarity index 100% rename from common/testdata/ethereum/tx_25.json rename to pkg/testdata/ethereum/tx_25.json diff --git a/common/testdata/ethereum/tx_26.json b/pkg/testdata/ethereum/tx_26.json similarity index 100% rename from common/testdata/ethereum/tx_26.json rename to pkg/testdata/ethereum/tx_26.json diff --git a/common/testdata/ethereum/tx_27.json b/pkg/testdata/ethereum/tx_27.json similarity index 100% rename from common/testdata/ethereum/tx_27.json rename to pkg/testdata/ethereum/tx_27.json diff --git a/common/testdata/ethereum/tx_28.json b/pkg/testdata/ethereum/tx_28.json similarity index 100% rename from common/testdata/ethereum/tx_28.json rename to pkg/testdata/ethereum/tx_28.json diff --git a/common/testdata/ethereum/tx_29.json b/pkg/testdata/ethereum/tx_29.json similarity index 100% rename from common/testdata/ethereum/tx_29.json rename to pkg/testdata/ethereum/tx_29.json diff --git a/common/testdata/ethereum/tx_3.json b/pkg/testdata/ethereum/tx_3.json similarity index 100% rename from common/testdata/ethereum/tx_3.json rename to pkg/testdata/ethereum/tx_3.json diff --git a/common/testdata/ethereum/tx_30.json b/pkg/testdata/ethereum/tx_30.json similarity index 100% rename from common/testdata/ethereum/tx_30.json rename to pkg/testdata/ethereum/tx_30.json diff --git a/common/testdata/ethereum/tx_31.json b/pkg/testdata/ethereum/tx_31.json similarity index 100% rename from common/testdata/ethereum/tx_31.json rename to pkg/testdata/ethereum/tx_31.json diff --git a/common/testdata/ethereum/tx_32.json b/pkg/testdata/ethereum/tx_32.json similarity index 100% rename from common/testdata/ethereum/tx_32.json rename to pkg/testdata/ethereum/tx_32.json diff --git a/common/testdata/ethereum/tx_33.json b/pkg/testdata/ethereum/tx_33.json similarity index 100% rename from common/testdata/ethereum/tx_33.json rename to pkg/testdata/ethereum/tx_33.json diff --git a/common/testdata/ethereum/tx_34.json b/pkg/testdata/ethereum/tx_34.json similarity index 100% rename from common/testdata/ethereum/tx_34.json rename to pkg/testdata/ethereum/tx_34.json diff --git a/common/testdata/ethereum/tx_35.json b/pkg/testdata/ethereum/tx_35.json similarity index 100% rename from common/testdata/ethereum/tx_35.json rename to pkg/testdata/ethereum/tx_35.json diff --git a/common/testdata/ethereum/tx_36.json b/pkg/testdata/ethereum/tx_36.json similarity index 100% rename from common/testdata/ethereum/tx_36.json rename to pkg/testdata/ethereum/tx_36.json diff --git a/common/testdata/ethereum/tx_37.json b/pkg/testdata/ethereum/tx_37.json similarity index 100% rename from common/testdata/ethereum/tx_37.json rename to pkg/testdata/ethereum/tx_37.json diff --git a/common/testdata/ethereum/tx_38.json b/pkg/testdata/ethereum/tx_38.json similarity index 100% rename from common/testdata/ethereum/tx_38.json rename to pkg/testdata/ethereum/tx_38.json diff --git a/common/testdata/ethereum/tx_39.json b/pkg/testdata/ethereum/tx_39.json similarity index 100% rename from common/testdata/ethereum/tx_39.json rename to pkg/testdata/ethereum/tx_39.json diff --git a/common/testdata/ethereum/tx_4.json b/pkg/testdata/ethereum/tx_4.json similarity index 100% rename from common/testdata/ethereum/tx_4.json rename to pkg/testdata/ethereum/tx_4.json diff --git a/common/testdata/ethereum/tx_40.json b/pkg/testdata/ethereum/tx_40.json similarity index 100% rename from common/testdata/ethereum/tx_40.json rename to pkg/testdata/ethereum/tx_40.json diff --git a/common/testdata/ethereum/tx_41.json b/pkg/testdata/ethereum/tx_41.json similarity index 100% rename from common/testdata/ethereum/tx_41.json rename to pkg/testdata/ethereum/tx_41.json diff --git a/common/testdata/ethereum/tx_42.json b/pkg/testdata/ethereum/tx_42.json similarity index 100% rename from common/testdata/ethereum/tx_42.json rename to pkg/testdata/ethereum/tx_42.json diff --git a/common/testdata/ethereum/tx_43.json b/pkg/testdata/ethereum/tx_43.json similarity index 100% rename from common/testdata/ethereum/tx_43.json rename to pkg/testdata/ethereum/tx_43.json diff --git a/common/testdata/ethereum/tx_44.json b/pkg/testdata/ethereum/tx_44.json similarity index 100% rename from common/testdata/ethereum/tx_44.json rename to pkg/testdata/ethereum/tx_44.json diff --git a/common/testdata/ethereum/tx_45.json b/pkg/testdata/ethereum/tx_45.json similarity index 100% rename from common/testdata/ethereum/tx_45.json rename to pkg/testdata/ethereum/tx_45.json diff --git a/common/testdata/ethereum/tx_46.json b/pkg/testdata/ethereum/tx_46.json similarity index 100% rename from common/testdata/ethereum/tx_46.json rename to pkg/testdata/ethereum/tx_46.json diff --git a/common/testdata/ethereum/tx_47.json b/pkg/testdata/ethereum/tx_47.json similarity index 100% rename from common/testdata/ethereum/tx_47.json rename to pkg/testdata/ethereum/tx_47.json diff --git a/common/testdata/ethereum/tx_48.json b/pkg/testdata/ethereum/tx_48.json similarity index 100% rename from common/testdata/ethereum/tx_48.json rename to pkg/testdata/ethereum/tx_48.json diff --git a/common/testdata/ethereum/tx_49.json b/pkg/testdata/ethereum/tx_49.json similarity index 100% rename from common/testdata/ethereum/tx_49.json rename to pkg/testdata/ethereum/tx_49.json diff --git a/common/testdata/ethereum/tx_5.json b/pkg/testdata/ethereum/tx_5.json similarity index 100% rename from common/testdata/ethereum/tx_5.json rename to pkg/testdata/ethereum/tx_5.json diff --git a/common/testdata/ethereum/tx_50.json b/pkg/testdata/ethereum/tx_50.json similarity index 100% rename from common/testdata/ethereum/tx_50.json rename to pkg/testdata/ethereum/tx_50.json diff --git a/common/testdata/ethereum/tx_51.json b/pkg/testdata/ethereum/tx_51.json similarity index 100% rename from common/testdata/ethereum/tx_51.json rename to pkg/testdata/ethereum/tx_51.json diff --git a/common/testdata/ethereum/tx_52.json b/pkg/testdata/ethereum/tx_52.json similarity index 100% rename from common/testdata/ethereum/tx_52.json rename to pkg/testdata/ethereum/tx_52.json diff --git a/common/testdata/ethereum/tx_53.json b/pkg/testdata/ethereum/tx_53.json similarity index 100% rename from common/testdata/ethereum/tx_53.json rename to pkg/testdata/ethereum/tx_53.json diff --git a/common/testdata/ethereum/tx_54.json b/pkg/testdata/ethereum/tx_54.json similarity index 100% rename from common/testdata/ethereum/tx_54.json rename to pkg/testdata/ethereum/tx_54.json diff --git a/common/testdata/ethereum/tx_55.json b/pkg/testdata/ethereum/tx_55.json similarity index 100% rename from common/testdata/ethereum/tx_55.json rename to pkg/testdata/ethereum/tx_55.json diff --git a/common/testdata/ethereum/tx_56.json b/pkg/testdata/ethereum/tx_56.json similarity index 100% rename from common/testdata/ethereum/tx_56.json rename to pkg/testdata/ethereum/tx_56.json diff --git a/common/testdata/ethereum/tx_57.json b/pkg/testdata/ethereum/tx_57.json similarity index 100% rename from common/testdata/ethereum/tx_57.json rename to pkg/testdata/ethereum/tx_57.json diff --git a/common/testdata/ethereum/tx_58.json b/pkg/testdata/ethereum/tx_58.json similarity index 100% rename from common/testdata/ethereum/tx_58.json rename to pkg/testdata/ethereum/tx_58.json diff --git a/common/testdata/ethereum/tx_59.json b/pkg/testdata/ethereum/tx_59.json similarity index 100% rename from common/testdata/ethereum/tx_59.json rename to pkg/testdata/ethereum/tx_59.json diff --git a/common/testdata/ethereum/tx_6.json b/pkg/testdata/ethereum/tx_6.json similarity index 100% rename from common/testdata/ethereum/tx_6.json rename to pkg/testdata/ethereum/tx_6.json diff --git a/common/testdata/ethereum/tx_60.json b/pkg/testdata/ethereum/tx_60.json similarity index 100% rename from common/testdata/ethereum/tx_60.json rename to pkg/testdata/ethereum/tx_60.json diff --git a/common/testdata/ethereum/tx_61.json b/pkg/testdata/ethereum/tx_61.json similarity index 100% rename from common/testdata/ethereum/tx_61.json rename to pkg/testdata/ethereum/tx_61.json diff --git a/common/testdata/ethereum/tx_62.json b/pkg/testdata/ethereum/tx_62.json similarity index 100% rename from common/testdata/ethereum/tx_62.json rename to pkg/testdata/ethereum/tx_62.json diff --git a/common/testdata/ethereum/tx_63.json b/pkg/testdata/ethereum/tx_63.json similarity index 100% rename from common/testdata/ethereum/tx_63.json rename to pkg/testdata/ethereum/tx_63.json diff --git a/common/testdata/ethereum/tx_64.json b/pkg/testdata/ethereum/tx_64.json similarity index 100% rename from common/testdata/ethereum/tx_64.json rename to pkg/testdata/ethereum/tx_64.json diff --git a/common/testdata/ethereum/tx_65.json b/pkg/testdata/ethereum/tx_65.json similarity index 100% rename from common/testdata/ethereum/tx_65.json rename to pkg/testdata/ethereum/tx_65.json diff --git a/common/testdata/ethereum/tx_66.json b/pkg/testdata/ethereum/tx_66.json similarity index 100% rename from common/testdata/ethereum/tx_66.json rename to pkg/testdata/ethereum/tx_66.json diff --git a/common/testdata/ethereum/tx_67.json b/pkg/testdata/ethereum/tx_67.json similarity index 100% rename from common/testdata/ethereum/tx_67.json rename to pkg/testdata/ethereum/tx_67.json diff --git a/common/testdata/ethereum/tx_68.json b/pkg/testdata/ethereum/tx_68.json similarity index 100% rename from common/testdata/ethereum/tx_68.json rename to pkg/testdata/ethereum/tx_68.json diff --git a/common/testdata/ethereum/tx_69.json b/pkg/testdata/ethereum/tx_69.json similarity index 100% rename from common/testdata/ethereum/tx_69.json rename to pkg/testdata/ethereum/tx_69.json diff --git a/common/testdata/ethereum/tx_7.json b/pkg/testdata/ethereum/tx_7.json similarity index 100% rename from common/testdata/ethereum/tx_7.json rename to pkg/testdata/ethereum/tx_7.json diff --git a/common/testdata/ethereum/tx_70.json b/pkg/testdata/ethereum/tx_70.json similarity index 100% rename from common/testdata/ethereum/tx_70.json rename to pkg/testdata/ethereum/tx_70.json diff --git a/common/testdata/ethereum/tx_71.json b/pkg/testdata/ethereum/tx_71.json similarity index 100% rename from common/testdata/ethereum/tx_71.json rename to pkg/testdata/ethereum/tx_71.json diff --git a/common/testdata/ethereum/tx_72.json b/pkg/testdata/ethereum/tx_72.json similarity index 100% rename from common/testdata/ethereum/tx_72.json rename to pkg/testdata/ethereum/tx_72.json diff --git a/common/testdata/ethereum/tx_73.json b/pkg/testdata/ethereum/tx_73.json similarity index 100% rename from common/testdata/ethereum/tx_73.json rename to pkg/testdata/ethereum/tx_73.json diff --git a/common/testdata/ethereum/tx_74.json b/pkg/testdata/ethereum/tx_74.json similarity index 100% rename from common/testdata/ethereum/tx_74.json rename to pkg/testdata/ethereum/tx_74.json diff --git a/common/testdata/ethereum/tx_75.json b/pkg/testdata/ethereum/tx_75.json similarity index 100% rename from common/testdata/ethereum/tx_75.json rename to pkg/testdata/ethereum/tx_75.json diff --git a/common/testdata/ethereum/tx_76.json b/pkg/testdata/ethereum/tx_76.json similarity index 100% rename from common/testdata/ethereum/tx_76.json rename to pkg/testdata/ethereum/tx_76.json diff --git a/common/testdata/ethereum/tx_77.json b/pkg/testdata/ethereum/tx_77.json similarity index 100% rename from common/testdata/ethereum/tx_77.json rename to pkg/testdata/ethereum/tx_77.json diff --git a/common/testdata/ethereum/tx_78.json b/pkg/testdata/ethereum/tx_78.json similarity index 100% rename from common/testdata/ethereum/tx_78.json rename to pkg/testdata/ethereum/tx_78.json diff --git a/common/testdata/ethereum/tx_79.json b/pkg/testdata/ethereum/tx_79.json similarity index 100% rename from common/testdata/ethereum/tx_79.json rename to pkg/testdata/ethereum/tx_79.json diff --git a/common/testdata/ethereum/tx_8.json b/pkg/testdata/ethereum/tx_8.json similarity index 100% rename from common/testdata/ethereum/tx_8.json rename to pkg/testdata/ethereum/tx_8.json diff --git a/common/testdata/ethereum/tx_80.json b/pkg/testdata/ethereum/tx_80.json similarity index 100% rename from common/testdata/ethereum/tx_80.json rename to pkg/testdata/ethereum/tx_80.json diff --git a/common/testdata/ethereum/tx_9.json b/pkg/testdata/ethereum/tx_9.json similarity index 100% rename from common/testdata/ethereum/tx_9.json rename to pkg/testdata/ethereum/tx_9.json diff --git a/common/testdata/test_blocks.json b/pkg/testdata/test_blocks.json similarity index 100% rename from common/testdata/test_blocks.json rename to pkg/testdata/test_blocks.json diff --git a/common/testdata/testdata.go b/pkg/testdata/testdata.go similarity index 100% rename from common/testdata/testdata.go rename to pkg/testdata/testdata.go diff --git a/proto/common/common.proto b/proto/common/common.proto deleted file mode 100644 index a3dc8ad69e..0000000000 --- a/proto/common/common.proto +++ /dev/null @@ -1,89 +0,0 @@ -syntax = "proto3"; -package common; - -import "common/bitcoin/bitcoin.proto"; -import "common/ethereum/ethereum.proto"; -//option (gogoproto.goproto_stringer_all) = false; -//option (gogoproto.stringer_all) = false; -//option (gogoproto.goproto_getters_all) = false; -import "gogoproto/gogo.proto"; - -option go_package = "github.com/zeta-chain/zetacore/common"; - -// PubKeySet contains two pub keys , secp256k1 and ed25519 -message PubKeySet { - string secp256k1 = 1 [ - (gogoproto.casttype) = "PubKey", - (gogoproto.customname) = "Secp256k1" - ]; - string ed25519 = 2 [(gogoproto.casttype) = "PubKey"]; -} - -enum ReceiveStatus { - option (gogoproto.goproto_enum_stringer) = true; - Created = 0; // some observer sees inbound tx - Success = 1; - Failed = 2; -} - -enum CoinType { - option (gogoproto.goproto_enum_stringer) = true; - Zeta = 0; - Gas = 1; // Ether, BNB, Matic, Klay, BTC, etc - ERC20 = 2; // ERC20 token - Cmd = 3; // not a real coin, rather a command -} - -enum ChainName { - option (gogoproto.goproto_enum_stringer) = true; - empty = 0; - - eth_mainnet = 1; - zeta_mainnet = 2; - btc_mainnet = 3; - polygon_mainnet = 4; - bsc_mainnet = 5; - // Testnet - goerli_testnet = 6; - mumbai_testnet = 7; - ganache_testnet = 8; - baobab_testnet = 9; - bsc_testnet = 10; - zeta_testnet = 11; - btc_testnet = 12; - sepolia_testnet = 13; - // LocalNet - // zeta_localnet = 13; - goerli_localnet = 14; - btc_regtest = 15; - // Athens - // zeta_athensnet=15; -} - -message Chain { - ChainName chain_name = 1; - int64 chain_id = 2; -} - -message BlockHeader { - int64 height = 1; - bytes hash = 2; - bytes parent_hash = 3; - int64 chain_id = 4; - // chain specific header - HeaderData header = 5 [(gogoproto.nullable) = false]; -} - -message HeaderData { - oneof data { - bytes ethereum_header = 1; // binary encoded headers; RLP for ethereum - bytes bitcoin_header = 2; // 80-byte little-endian encoded binary data - } -} - -message Proof { - oneof proof { - ethereum.Proof ethereum_proof = 1; - bitcoin.Proof bitcoin_proof = 2; - } -} diff --git a/proto/crosschain/cross_chain_tx.proto b/proto/crosschain/cross_chain_tx.proto index 28aeab85db..4ed336ed8f 100644 --- a/proto/crosschain/cross_chain_tx.proto +++ b/proto/crosschain/cross_chain_tx.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package zetachain.zetacore.crosschain; -import "common/common.proto"; import "gogoproto/gogo.proto"; +import "pkg/coin/coin.proto"; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; @@ -26,7 +26,7 @@ message InboundTxParams { string sender = 1; // this address is the immediate contract/EOA that calls the Connector.send() int64 sender_chain_id = 2; string tx_origin = 3; // this address is the EOA that signs the inbound tx - common.CoinType coin_type = 4; + coin.CoinType coin_type = 4; string asset = 5; // for ERC20 coin type, the asset is an address of the ERC20 contract string amount = 6 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", @@ -50,7 +50,7 @@ message ZetaAccounting { message OutboundTxParams { string receiver = 1; int64 receiver_chainId = 2; - common.CoinType coin_type = 3; + coin.CoinType coin_type = 3; string amount = 4 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Uint", (gogoproto.nullable) = false diff --git a/proto/crosschain/events.proto b/proto/crosschain/events.proto index 6497fd147e..05786446ed 100644 --- a/proto/crosschain/events.proto +++ b/proto/crosschain/events.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package zetachain.zetacore.crosschain; -import "common/common.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; diff --git a/proto/crosschain/in_tx_tracker.proto b/proto/crosschain/in_tx_tracker.proto index e0775f7e0c..a29d0d6f55 100644 --- a/proto/crosschain/in_tx_tracker.proto +++ b/proto/crosschain/in_tx_tracker.proto @@ -1,12 +1,12 @@ syntax = "proto3"; package zetachain.zetacore.crosschain; -import "common/common.proto"; +import "pkg/coin/coin.proto"; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; message InTxTracker { int64 chain_id = 1; string tx_hash = 2; - common.CoinType coin_type = 3; + coin.CoinType coin_type = 3; } diff --git a/proto/crosschain/tx.proto b/proto/crosschain/tx.proto index 5cee0f1f21..d6e4fc093b 100644 --- a/proto/crosschain/tx.proto +++ b/proto/crosschain/tx.proto @@ -1,8 +1,10 @@ syntax = "proto3"; package zetachain.zetacore.crosschain; -import "common/common.proto"; import "gogoproto/gogo.proto"; +import "pkg/chains/chains.proto"; +import "pkg/coin/coin.proto"; +import "pkg/proofs/proofs.proto"; option go_package = "github.com/zeta-chain/zetacore/x/crosschain/types"; @@ -28,7 +30,7 @@ message MsgCreateTSSVoter { string creator = 1; string tss_pubkey = 2; int64 keyGenZetaHeight = 3; - common.ReceiveStatus status = 4; + chains.ReceiveStatus status = 4; } message MsgCreateTSSVoterResponse {} @@ -54,8 +56,8 @@ message MsgAddToInTxTracker { string creator = 1; int64 chain_id = 2; string tx_hash = 3; - common.CoinType coin_type = 4; - common.Proof proof = 5; + coin.CoinType coin_type = 4; + proofs.Proof proof = 5; string block_hash = 6; int64 tx_index = 7; } @@ -81,7 +83,7 @@ message MsgAddToOutTxTracker { int64 chain_id = 2; uint64 nonce = 3; string tx_hash = 4; - common.Proof proof = 5; + proofs.Proof proof = 5; string block_hash = 6; int64 tx_index = 7; } @@ -124,10 +126,10 @@ message MsgVoteOnObservedOutboundTx { (gogoproto.nullable) = false, (gogoproto.moretags) = "yaml:\"value_received\"" ]; - common.ReceiveStatus status = 6; + chains.ReceiveStatus status = 6; int64 outTx_chain = 7; uint64 outTx_tss_nonce = 8; - common.CoinType coin_type = 9; + coin.CoinType coin_type = 9; } message MsgVoteOnObservedOutboundTxResponse {} @@ -148,7 +150,7 @@ message MsgVoteOnObservedInboundTx { string in_tx_hash = 9; uint64 in_block_height = 10; uint64 gas_limit = 11; - common.CoinType coin_type = 12; + coin.CoinType coin_type = 12; string tx_origin = 13; string asset = 14; // event index of the sent asset in the observed tx diff --git a/proto/fungible/events.proto b/proto/fungible/events.proto index 06e7af005f..6e47edbfb8 100644 --- a/proto/fungible/events.proto +++ b/proto/fungible/events.proto @@ -1,9 +1,9 @@ syntax = "proto3"; package zetachain.zetacore.fungible; -import "common/common.proto"; import "fungible/tx.proto"; import "gogoproto/gogo.proto"; +import "pkg/coin/coin.proto"; option go_package = "github.com/zeta-chain/zetacore/x/fungible/types"; @@ -21,7 +21,7 @@ message EventZRC20Deployed { string name = 4; string symbol = 5; int64 decimals = 6; - common.CoinType coin_type = 7; + coin.CoinType coin_type = 7; string erc20 = 8; int64 gas_limit = 9; } @@ -29,7 +29,7 @@ message EventZRC20Deployed { message EventZRC20WithdrawFeeUpdated { string msg_type_url = 1; int64 chain_id = 2; - common.CoinType coin_type = 3; + coin.CoinType coin_type = 3; string zrc20_address = 4; string old_withdraw_fee = 5; string new_withdraw_fee = 6; diff --git a/proto/fungible/foreign_coins.proto b/proto/fungible/foreign_coins.proto index 81d52f0220..e943d6b574 100644 --- a/proto/fungible/foreign_coins.proto +++ b/proto/fungible/foreign_coins.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package zetachain.zetacore.fungible; -import "common/common.proto"; import "gogoproto/gogo.proto"; +import "pkg/coin/coin.proto"; option go_package = "github.com/zeta-chain/zetacore/x/fungible/types"; @@ -14,7 +14,7 @@ message ForeignCoins { uint32 decimals = 5; string name = 6; string symbol = 7; - common.CoinType coin_type = 8; + coin.CoinType coin_type = 8; uint64 gas_limit = 9; bool paused = 10; string liquidity_cap = 11 [ diff --git a/proto/fungible/tx.proto b/proto/fungible/tx.proto index e6599a55b9..9ba063b43a 100644 --- a/proto/fungible/tx.proto +++ b/proto/fungible/tx.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package zetachain.zetacore.fungible; -import "common/common.proto"; import "gogoproto/gogo.proto"; +import "pkg/coin/coin.proto"; option go_package = "github.com/zeta-chain/zetacore/x/fungible/types"; @@ -59,7 +59,7 @@ message MsgDeployFungibleCoinZRC20 { uint32 decimals = 4; string name = 5; string symbol = 6; - common.CoinType coin_type = 7; + coin.CoinType coin_type = 7; int64 gas_limit = 8; } diff --git a/proto/observer/chain_nonces.proto b/proto/observer/chain_nonces.proto index 2ca53ac4cb..3d4ff65c32 100644 --- a/proto/observer/chain_nonces.proto +++ b/proto/observer/chain_nonces.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package zetachain.zetacore.observer; -import "common/common.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; diff --git a/proto/observer/node_account.proto b/proto/observer/node_account.proto index 83e3014aea..ed6141e23e 100644 --- a/proto/observer/node_account.proto +++ b/proto/observer/node_account.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package zetachain.zetacore.observer; -import "common/common.proto"; import "gogoproto/gogo.proto"; +import "pkg/crypto/crypto.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; @@ -19,6 +19,6 @@ enum NodeStatus { message NodeAccount { string operator = 1; string granteeAddress = 2; - common.PubKeySet granteePubkey = 3; + crypto.PubKeySet granteePubkey = 3; NodeStatus nodeStatus = 4; } diff --git a/proto/observer/nonce_to_cctx.proto b/proto/observer/nonce_to_cctx.proto index 0c26d3b34c..947e9c6f35 100644 --- a/proto/observer/nonce_to_cctx.proto +++ b/proto/observer/nonce_to_cctx.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package zetachain.zetacore.observer; -import "common/common.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; diff --git a/proto/observer/observer.proto b/proto/observer/observer.proto index 2c3cf0b931..575eea04f1 100644 --- a/proto/observer/observer.proto +++ b/proto/observer/observer.proto @@ -1,8 +1,8 @@ syntax = "proto3"; package zetachain.zetacore.observer; -import "common/common.proto"; import "gogoproto/gogo.proto"; +import "pkg/chains/chains.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; @@ -24,7 +24,7 @@ enum ObserverUpdateReason { message ObserverMapper { string index = 1; - common.Chain observer_chain = 2; + chains.Chain observer_chain = 2; repeated string observer_list = 4; } diff --git a/proto/observer/params.proto b/proto/observer/params.proto index 271710ca33..8c26206ff6 100644 --- a/proto/observer/params.proto +++ b/proto/observer/params.proto @@ -1,9 +1,9 @@ syntax = "proto3"; package zetachain.zetacore.observer; -import "common/common.proto"; import "gogoproto/gogo.proto"; import "observer/observer.proto"; +import "pkg/chains/chains.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; @@ -36,7 +36,7 @@ message ChainParams { // Deprecated(v13): Use ChainParamsList message ObserverParams { - common.Chain chain = 1; + chains.Chain chain = 1; string ballot_threshold = 3 [ (gogoproto.customtype) = "github.com/cosmos/cosmos-sdk/types.Dec", (gogoproto.nullable) = false diff --git a/proto/observer/pending_nonces.proto b/proto/observer/pending_nonces.proto index d3aee10cf1..e733843d01 100644 --- a/proto/observer/pending_nonces.proto +++ b/proto/observer/pending_nonces.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package zetachain.zetacore.observer; -import "common/common.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; diff --git a/proto/observer/query.proto b/proto/observer/query.proto index 0ef0914d74..0c2cde9644 100644 --- a/proto/observer/query.proto +++ b/proto/observer/query.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package zetachain.zetacore.observer; -import "common/common.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; @@ -16,6 +15,8 @@ import "observer/observer.proto"; import "observer/params.proto"; import "observer/pending_nonces.proto"; import "observer/tss.proto"; +import "pkg/chains/chains.proto"; +import "pkg/proofs/proofs.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; @@ -217,7 +218,7 @@ message QueryTssHistoryResponse { message QueryProveRequest { int64 chain_id = 1; string tx_hash = 2; - common.Proof proof = 3; + proofs.Proof proof = 3; string block_hash = 4; int64 tx_index = 5; } @@ -267,7 +268,7 @@ message QueryObserverSetResponse { message QuerySupportedChains {} message QuerySupportedChainsResponse { - repeated common.Chain chains = 1; + repeated chains.Chain chains = 1; } message QueryGetChainParamsForChainRequest { @@ -350,7 +351,7 @@ message QueryAllBlockHeaderRequest { } message QueryAllBlockHeaderResponse { - repeated common.BlockHeader block_headers = 1; + repeated proofs.BlockHeader block_headers = 1; cosmos.base.query.v1beta1.PageResponse pagination = 2; } @@ -359,7 +360,7 @@ message QueryGetBlockHeaderByHashRequest { } message QueryGetBlockHeaderByHashResponse { - common.BlockHeader block_header = 1; + proofs.BlockHeader block_header = 1; } message QueryGetBlockHeaderStateRequest { diff --git a/proto/observer/tx.proto b/proto/observer/tx.proto index 85e0ffe9ef..8245827f16 100644 --- a/proto/observer/tx.proto +++ b/proto/observer/tx.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package zetachain.zetacore.observer; -import "common/common.proto"; import "gogoproto/gogo.proto"; import "observer/blame.proto"; import "observer/crosschain_flags.proto"; @@ -9,6 +8,7 @@ import "observer/observer.proto"; import "observer/params.proto"; import "observer/pending_nonces.proto"; import "observer/tss.proto"; +import "pkg/proofs/proofs.proto"; option go_package = "github.com/zeta-chain/zetacore/x/observer/types"; @@ -38,7 +38,7 @@ message MsgAddBlockHeader { int64 chain_id = 2; bytes block_hash = 3; int64 height = 4; - common.HeaderData header = 5 [(gogoproto.nullable) = false]; + proofs.HeaderData header = 5 [(gogoproto.nullable) = false]; } message MsgAddBlockHeaderResponse {} diff --git a/proto/pkg/chains/chains.proto b/proto/pkg/chains/chains.proto new file mode 100644 index 0000000000..fa9e9e49db --- /dev/null +++ b/proto/pkg/chains/chains.proto @@ -0,0 +1,44 @@ +syntax = "proto3"; +package chains; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/zeta-chain/zetacore/pkg/chains"; + +enum ReceiveStatus { + option (gogoproto.goproto_enum_stringer) = true; + Created = 0; // some observer sees inbound tx + Success = 1; + Failed = 2; +} + +enum ChainName { + option (gogoproto.goproto_enum_stringer) = true; + empty = 0; + + eth_mainnet = 1; + zeta_mainnet = 2; + btc_mainnet = 3; + polygon_mainnet = 4; + bsc_mainnet = 5; + // Testnet + goerli_testnet = 6; + mumbai_testnet = 7; + ganache_testnet = 8; + baobab_testnet = 9; + bsc_testnet = 10; + zeta_testnet = 11; + btc_testnet = 12; + sepolia_testnet = 13; + // LocalNet + // zeta_localnet = 13; + goerli_localnet = 14; + btc_regtest = 15; + // Athens + // zeta_athensnet=15; +} + +message Chain { + ChainName chain_name = 1; + int64 chain_id = 2; +} diff --git a/proto/pkg/coin/coin.proto b/proto/pkg/coin/coin.proto new file mode 100644 index 0000000000..52d2a67967 --- /dev/null +++ b/proto/pkg/coin/coin.proto @@ -0,0 +1,14 @@ +syntax = "proto3"; +package coin; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/zeta-chain/zetacore/pkg/coin"; + +enum CoinType { + option (gogoproto.goproto_enum_stringer) = true; + Zeta = 0; + Gas = 1; // Ether, BNB, Matic, Klay, BTC, etc + ERC20 = 2; // ERC20 token + Cmd = 3; // not a real coin, rather a command +} diff --git a/proto/pkg/crypto/crypto.proto b/proto/pkg/crypto/crypto.proto new file mode 100644 index 0000000000..f74878f490 --- /dev/null +++ b/proto/pkg/crypto/crypto.proto @@ -0,0 +1,15 @@ +syntax = "proto3"; +package crypto; + +import "gogoproto/gogo.proto"; + +option go_package = "github.com/zeta-chain/zetacore/pkg/crypto"; + +// PubKeySet contains two pub keys , secp256k1 and ed25519 +message PubKeySet { + string secp256k1 = 1 [ + (gogoproto.casttype) = "PubKey", + (gogoproto.customname) = "Secp256k1" + ]; + string ed25519 = 2 [(gogoproto.casttype) = "PubKey"]; +} diff --git a/proto/common/bitcoin/bitcoin.proto b/proto/pkg/proofs/bitcoin/bitcoin.proto similarity index 61% rename from proto/common/bitcoin/bitcoin.proto rename to proto/pkg/proofs/bitcoin/bitcoin.proto index dc1df2fa42..7712782ce3 100644 --- a/proto/common/bitcoin/bitcoin.proto +++ b/proto/pkg/proofs/bitcoin/bitcoin.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package bitcoin; -option go_package = "github.com/zeta-chain/zetacore/common/bitcoin"; +option go_package = "github.com/zeta-chain/zetacore/pkg/proofs/bitcoin"; message Proof { bytes tx_bytes = 1; diff --git a/proto/common/ethereum/ethereum.proto b/proto/pkg/proofs/ethereum/ethereum.proto similarity index 60% rename from proto/common/ethereum/ethereum.proto rename to proto/pkg/proofs/ethereum/ethereum.proto index 92d3813035..76d9489292 100644 --- a/proto/common/ethereum/ethereum.proto +++ b/proto/pkg/proofs/ethereum/ethereum.proto @@ -1,7 +1,7 @@ syntax = "proto3"; package ethereum; -option go_package = "github.com/zeta-chain/zetacore/common/ethereum"; +option go_package = "github.com/zeta-chain/zetacore/pkg/proofs/ethereum"; message Proof { repeated bytes keys = 1; diff --git a/proto/pkg/proofs/proofs.proto b/proto/pkg/proofs/proofs.proto new file mode 100644 index 0000000000..e8360d5cbd --- /dev/null +++ b/proto/pkg/proofs/proofs.proto @@ -0,0 +1,31 @@ +syntax = "proto3"; +package proofs; + +import "gogoproto/gogo.proto"; +import "pkg/proofs/bitcoin/bitcoin.proto"; +import "pkg/proofs/ethereum/ethereum.proto"; + +option go_package = "github.com/zeta-chain/zetacore/pkg/proofs"; + +message BlockHeader { + int64 height = 1; + bytes hash = 2; + bytes parent_hash = 3; + int64 chain_id = 4; + // chain specific header + HeaderData header = 5 [(gogoproto.nullable) = false]; +} + +message HeaderData { + oneof data { + bytes ethereum_header = 1; // binary encoded headers; RLP for ethereum + bytes bitcoin_header = 2; // 80-byte little-endian encoded binary data + } +} + +message Proof { + oneof proof { + ethereum.Proof ethereum_proof = 1; + bitcoin.Proof bitcoin_proof = 2; + } +} diff --git a/rpc/namespaces/ethereum/web3/api.go b/rpc/namespaces/ethereum/web3/api.go index 46e09d9637..de40837ee1 100644 --- a/rpc/namespaces/ethereum/web3/api.go +++ b/rpc/namespaces/ethereum/web3/api.go @@ -21,7 +21,7 @@ import ( "github.com/ethereum/go-ethereum/common/hexutil" "github.com/ethereum/go-ethereum/crypto" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/constant" ) // PublicAPI is the web3_ prefixed set of APIs in the Web3 JSON-RPC spec. @@ -34,7 +34,7 @@ func NewPublicAPI() *PublicAPI { // ClientVersion returns the client version in the Web3 user agent format. func (a *PublicAPI) ClientVersion() string { - return fmt.Sprintf("%s/%s/%s/%s", common.Name, common.Version, runtime.GOOS+"-"+runtime.GOARCH, runtime.Version()) + return fmt.Sprintf("%s/%s/%s/%s", constant.Name, constant.Version, runtime.GOOS+"-"+runtime.GOARCH, runtime.Version()) } // Sha3 returns the keccak-256 hash of the passed-in input. diff --git a/testutil/keeper/mocks/crosschain/fungible.go b/testutil/keeper/mocks/crosschain/fungible.go index 7a0a40a6de..54b7e54a03 100644 --- a/testutil/keeper/mocks/crosschain/fungible.go +++ b/testutil/keeper/mocks/crosschain/fungible.go @@ -6,6 +6,8 @@ import ( big "math/big" common "github.com/ethereum/go-ethereum/common" + coin "github.com/zeta-chain/zetacore/pkg/coin" + evmtypes "github.com/evmos/ethermint/x/evm/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" @@ -13,8 +15,6 @@ import ( mock "github.com/stretchr/testify/mock" types "github.com/cosmos/cosmos-sdk/types" - - zetacorecommon "github.com/zeta-chain/zetacore/common" ) // CrosschainFungibleKeeper is an autogenerated mock type for the CrosschainFungibleKeeper type @@ -119,7 +119,7 @@ func (_m *CrosschainFungibleKeeper) CallZRC20Burn(ctx types.Context, sender comm } // DeployZRC20Contract provides a mock function with given fields: ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit -func (_m *CrosschainFungibleKeeper) DeployZRC20Contract(ctx types.Context, name string, symbol string, decimals uint8, chainID int64, coinType zetacorecommon.CoinType, erc20Contract string, gasLimit *big.Int) (common.Address, error) { +func (_m *CrosschainFungibleKeeper) DeployZRC20Contract(ctx types.Context, name string, symbol string, decimals uint8, chainID int64, coinType coin.CoinType, erc20Contract string, gasLimit *big.Int) (common.Address, error) { ret := _m.Called(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) if len(ret) == 0 { @@ -128,10 +128,10 @@ func (_m *CrosschainFungibleKeeper) DeployZRC20Contract(ctx types.Context, name var r0 common.Address var r1 error - if rf, ok := ret.Get(0).(func(types.Context, string, string, uint8, int64, zetacorecommon.CoinType, string, *big.Int) (common.Address, error)); ok { + if rf, ok := ret.Get(0).(func(types.Context, string, string, uint8, int64, coin.CoinType, string, *big.Int) (common.Address, error)); ok { return rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) } - if rf, ok := ret.Get(0).(func(types.Context, string, string, uint8, int64, zetacorecommon.CoinType, string, *big.Int) common.Address); ok { + if rf, ok := ret.Get(0).(func(types.Context, string, string, uint8, int64, coin.CoinType, string, *big.Int) common.Address); ok { r0 = rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) } else { if ret.Get(0) != nil { @@ -139,7 +139,7 @@ func (_m *CrosschainFungibleKeeper) DeployZRC20Contract(ctx types.Context, name } } - if rf, ok := ret.Get(1).(func(types.Context, string, string, uint8, int64, zetacorecommon.CoinType, string, *big.Int) error); ok { + if rf, ok := ret.Get(1).(func(types.Context, string, string, uint8, int64, coin.CoinType, string, *big.Int) error); ok { r1 = rf(ctx, name, symbol, decimals, chainID, coinType, erc20Contract, gasLimit) } else { r1 = ret.Error(1) @@ -598,7 +598,7 @@ func (_m *CrosschainFungibleKeeper) WithdrawFromGasStabilityPool(ctx types.Conte } // ZRC20DepositAndCallContract provides a mock function with given fields: ctx, from, to, amount, senderChainID, data, coinType, asset -func (_m *CrosschainFungibleKeeper) ZRC20DepositAndCallContract(ctx types.Context, from []byte, to common.Address, amount *big.Int, senderChainID int64, data []byte, coinType zetacorecommon.CoinType, asset string) (*evmtypes.MsgEthereumTxResponse, bool, error) { +func (_m *CrosschainFungibleKeeper) ZRC20DepositAndCallContract(ctx types.Context, from []byte, to common.Address, amount *big.Int, senderChainID int64, data []byte, coinType coin.CoinType, asset string) (*evmtypes.MsgEthereumTxResponse, bool, error) { ret := _m.Called(ctx, from, to, amount, senderChainID, data, coinType, asset) if len(ret) == 0 { @@ -608,10 +608,10 @@ func (_m *CrosschainFungibleKeeper) ZRC20DepositAndCallContract(ctx types.Contex var r0 *evmtypes.MsgEthereumTxResponse var r1 bool var r2 error - if rf, ok := ret.Get(0).(func(types.Context, []byte, common.Address, *big.Int, int64, []byte, zetacorecommon.CoinType, string) (*evmtypes.MsgEthereumTxResponse, bool, error)); ok { + if rf, ok := ret.Get(0).(func(types.Context, []byte, common.Address, *big.Int, int64, []byte, coin.CoinType, string) (*evmtypes.MsgEthereumTxResponse, bool, error)); ok { return rf(ctx, from, to, amount, senderChainID, data, coinType, asset) } - if rf, ok := ret.Get(0).(func(types.Context, []byte, common.Address, *big.Int, int64, []byte, zetacorecommon.CoinType, string) *evmtypes.MsgEthereumTxResponse); ok { + if rf, ok := ret.Get(0).(func(types.Context, []byte, common.Address, *big.Int, int64, []byte, coin.CoinType, string) *evmtypes.MsgEthereumTxResponse); ok { r0 = rf(ctx, from, to, amount, senderChainID, data, coinType, asset) } else { if ret.Get(0) != nil { @@ -619,13 +619,13 @@ func (_m *CrosschainFungibleKeeper) ZRC20DepositAndCallContract(ctx types.Contex } } - if rf, ok := ret.Get(1).(func(types.Context, []byte, common.Address, *big.Int, int64, []byte, zetacorecommon.CoinType, string) bool); ok { + if rf, ok := ret.Get(1).(func(types.Context, []byte, common.Address, *big.Int, int64, []byte, coin.CoinType, string) bool); ok { r1 = rf(ctx, from, to, amount, senderChainID, data, coinType, asset) } else { r1 = ret.Get(1).(bool) } - if rf, ok := ret.Get(2).(func(types.Context, []byte, common.Address, *big.Int, int64, []byte, zetacorecommon.CoinType, string) error); ok { + if rf, ok := ret.Get(2).(func(types.Context, []byte, common.Address, *big.Int, int64, []byte, coin.CoinType, string) error); ok { r2 = rf(ctx, from, to, amount, senderChainID, data, coinType, asset) } else { r2 = ret.Error(2) diff --git a/testutil/keeper/mocks/crosschain/observer.go b/testutil/keeper/mocks/crosschain/observer.go index d100894b02..84590ca702 100644 --- a/testutil/keeper/mocks/crosschain/observer.go +++ b/testutil/keeper/mocks/crosschain/observer.go @@ -3,14 +3,17 @@ package mocks import ( - context "context" + chains "github.com/zeta-chain/zetacore/pkg/chains" + coin "github.com/zeta-chain/zetacore/pkg/coin" - common "github.com/zeta-chain/zetacore/common" + context "context" mock "github.com/stretchr/testify/mock" observertypes "github.com/zeta-chain/zetacore/x/observer/types" + proofs "github.com/zeta-chain/zetacore/pkg/proofs" + types "github.com/cosmos/cosmos-sdk/types" ) @@ -109,7 +112,7 @@ func (_m *CrosschainObserverKeeper) CheckIfTssPubkeyHasBeenGenerated(ctx types.C } // FindBallot provides a mock function with given fields: ctx, index, chain, observationType -func (_m *CrosschainObserverKeeper) FindBallot(ctx types.Context, index string, chain *common.Chain, observationType observertypes.ObservationType) (observertypes.Ballot, bool, error) { +func (_m *CrosschainObserverKeeper) FindBallot(ctx types.Context, index string, chain *chains.Chain, observationType observertypes.ObservationType) (observertypes.Ballot, bool, error) { ret := _m.Called(ctx, index, chain, observationType) if len(ret) == 0 { @@ -119,22 +122,22 @@ func (_m *CrosschainObserverKeeper) FindBallot(ctx types.Context, index string, var r0 observertypes.Ballot var r1 bool var r2 error - if rf, ok := ret.Get(0).(func(types.Context, string, *common.Chain, observertypes.ObservationType) (observertypes.Ballot, bool, error)); ok { + if rf, ok := ret.Get(0).(func(types.Context, string, *chains.Chain, observertypes.ObservationType) (observertypes.Ballot, bool, error)); ok { return rf(ctx, index, chain, observationType) } - if rf, ok := ret.Get(0).(func(types.Context, string, *common.Chain, observertypes.ObservationType) observertypes.Ballot); ok { + if rf, ok := ret.Get(0).(func(types.Context, string, *chains.Chain, observertypes.ObservationType) observertypes.Ballot); ok { r0 = rf(ctx, index, chain, observationType) } else { r0 = ret.Get(0).(observertypes.Ballot) } - if rf, ok := ret.Get(1).(func(types.Context, string, *common.Chain, observertypes.ObservationType) bool); ok { + if rf, ok := ret.Get(1).(func(types.Context, string, *chains.Chain, observertypes.ObservationType) bool); ok { r1 = rf(ctx, index, chain, observationType) } else { r1 = ret.Get(1).(bool) } - if rf, ok := ret.Get(2).(func(types.Context, string, *common.Chain, observertypes.ObservationType) error); ok { + if rf, ok := ret.Get(2).(func(types.Context, string, *chains.Chain, observertypes.ObservationType) error); ok { r2 = rf(ctx, index, chain, observationType) } else { r2 = ret.Error(2) @@ -302,22 +305,22 @@ func (_m *CrosschainObserverKeeper) GetBallot(ctx types.Context, index string) ( } // GetBlockHeader provides a mock function with given fields: ctx, hash -func (_m *CrosschainObserverKeeper) GetBlockHeader(ctx types.Context, hash []byte) (common.BlockHeader, bool) { +func (_m *CrosschainObserverKeeper) GetBlockHeader(ctx types.Context, hash []byte) (proofs.BlockHeader, bool) { ret := _m.Called(ctx, hash) if len(ret) == 0 { panic("no return value specified for GetBlockHeader") } - var r0 common.BlockHeader + var r0 proofs.BlockHeader var r1 bool - if rf, ok := ret.Get(0).(func(types.Context, []byte) (common.BlockHeader, bool)); ok { + if rf, ok := ret.Get(0).(func(types.Context, []byte) (proofs.BlockHeader, bool)); ok { return rf(ctx, hash) } - if rf, ok := ret.Get(0).(func(types.Context, []byte) common.BlockHeader); ok { + if rf, ok := ret.Get(0).(func(types.Context, []byte) proofs.BlockHeader); ok { r0 = rf(ctx, hash) } else { - r0 = ret.Get(0).(common.BlockHeader) + r0 = ret.Get(0).(proofs.BlockHeader) } if rf, ok := ret.Get(1).(func(types.Context, []byte) bool); ok { @@ -584,19 +587,19 @@ func (_m *CrosschainObserverKeeper) GetPendingNonces(ctx types.Context, tss stri } // GetSupportedChainFromChainID provides a mock function with given fields: ctx, chainID -func (_m *CrosschainObserverKeeper) GetSupportedChainFromChainID(ctx types.Context, chainID int64) *common.Chain { +func (_m *CrosschainObserverKeeper) GetSupportedChainFromChainID(ctx types.Context, chainID int64) *chains.Chain { ret := _m.Called(ctx, chainID) if len(ret) == 0 { panic("no return value specified for GetSupportedChainFromChainID") } - var r0 *common.Chain - if rf, ok := ret.Get(0).(func(types.Context, int64) *common.Chain); ok { + var r0 *chains.Chain + if rf, ok := ret.Get(0).(func(types.Context, int64) *chains.Chain); ok { r0 = rf(ctx, chainID) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*common.Chain) + r0 = ret.Get(0).(*chains.Chain) } } @@ -604,19 +607,19 @@ func (_m *CrosschainObserverKeeper) GetSupportedChainFromChainID(ctx types.Conte } // GetSupportedChains provides a mock function with given fields: ctx -func (_m *CrosschainObserverKeeper) GetSupportedChains(ctx types.Context) []*common.Chain { +func (_m *CrosschainObserverKeeper) GetSupportedChains(ctx types.Context) []*chains.Chain { ret := _m.Called(ctx) if len(ret) == 0 { panic("no return value specified for GetSupportedChains") } - var r0 []*common.Chain - if rf, ok := ret.Get(0).(func(types.Context) []*common.Chain); ok { + var r0 []*chains.Chain + if rf, ok := ret.Get(0).(func(types.Context) []*chains.Chain); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]*common.Chain) + r0 = ret.Get(0).([]*chains.Chain) } } @@ -783,7 +786,7 @@ func (_m *CrosschainObserverKeeper) SetTssAndUpdateNonce(ctx types.Context, tss } // VoteOnInboundBallot provides a mock function with given fields: ctx, senderChainID, receiverChainID, coinType, voter, ballotIndex, inTxHash -func (_m *CrosschainObserverKeeper) VoteOnInboundBallot(ctx types.Context, senderChainID int64, receiverChainID int64, coinType common.CoinType, voter string, ballotIndex string, inTxHash string) (bool, bool, error) { +func (_m *CrosschainObserverKeeper) VoteOnInboundBallot(ctx types.Context, senderChainID int64, receiverChainID int64, coinType coin.CoinType, voter string, ballotIndex string, inTxHash string) (bool, bool, error) { ret := _m.Called(ctx, senderChainID, receiverChainID, coinType, voter, ballotIndex, inTxHash) if len(ret) == 0 { @@ -793,22 +796,22 @@ func (_m *CrosschainObserverKeeper) VoteOnInboundBallot(ctx types.Context, sende var r0 bool var r1 bool var r2 error - if rf, ok := ret.Get(0).(func(types.Context, int64, int64, common.CoinType, string, string, string) (bool, bool, error)); ok { + if rf, ok := ret.Get(0).(func(types.Context, int64, int64, coin.CoinType, string, string, string) (bool, bool, error)); ok { return rf(ctx, senderChainID, receiverChainID, coinType, voter, ballotIndex, inTxHash) } - if rf, ok := ret.Get(0).(func(types.Context, int64, int64, common.CoinType, string, string, string) bool); ok { + if rf, ok := ret.Get(0).(func(types.Context, int64, int64, coin.CoinType, string, string, string) bool); ok { r0 = rf(ctx, senderChainID, receiverChainID, coinType, voter, ballotIndex, inTxHash) } else { r0 = ret.Get(0).(bool) } - if rf, ok := ret.Get(1).(func(types.Context, int64, int64, common.CoinType, string, string, string) bool); ok { + if rf, ok := ret.Get(1).(func(types.Context, int64, int64, coin.CoinType, string, string, string) bool); ok { r1 = rf(ctx, senderChainID, receiverChainID, coinType, voter, ballotIndex, inTxHash) } else { r1 = ret.Get(1).(bool) } - if rf, ok := ret.Get(2).(func(types.Context, int64, int64, common.CoinType, string, string, string) error); ok { + if rf, ok := ret.Get(2).(func(types.Context, int64, int64, coin.CoinType, string, string, string) error); ok { r2 = rf(ctx, senderChainID, receiverChainID, coinType, voter, ballotIndex, inTxHash) } else { r2 = ret.Error(2) @@ -818,7 +821,7 @@ func (_m *CrosschainObserverKeeper) VoteOnInboundBallot(ctx types.Context, sende } // VoteOnOutboundBallot provides a mock function with given fields: ctx, ballotIndex, outTxChainID, receiveStatus, voter -func (_m *CrosschainObserverKeeper) VoteOnOutboundBallot(ctx types.Context, ballotIndex string, outTxChainID int64, receiveStatus common.ReceiveStatus, voter string) (bool, bool, observertypes.Ballot, string, error) { +func (_m *CrosschainObserverKeeper) VoteOnOutboundBallot(ctx types.Context, ballotIndex string, outTxChainID int64, receiveStatus chains.ReceiveStatus, voter string) (bool, bool, observertypes.Ballot, string, error) { ret := _m.Called(ctx, ballotIndex, outTxChainID, receiveStatus, voter) if len(ret) == 0 { @@ -830,34 +833,34 @@ func (_m *CrosschainObserverKeeper) VoteOnOutboundBallot(ctx types.Context, ball var r2 observertypes.Ballot var r3 string var r4 error - if rf, ok := ret.Get(0).(func(types.Context, string, int64, common.ReceiveStatus, string) (bool, bool, observertypes.Ballot, string, error)); ok { + if rf, ok := ret.Get(0).(func(types.Context, string, int64, chains.ReceiveStatus, string) (bool, bool, observertypes.Ballot, string, error)); ok { return rf(ctx, ballotIndex, outTxChainID, receiveStatus, voter) } - if rf, ok := ret.Get(0).(func(types.Context, string, int64, common.ReceiveStatus, string) bool); ok { + if rf, ok := ret.Get(0).(func(types.Context, string, int64, chains.ReceiveStatus, string) bool); ok { r0 = rf(ctx, ballotIndex, outTxChainID, receiveStatus, voter) } else { r0 = ret.Get(0).(bool) } - if rf, ok := ret.Get(1).(func(types.Context, string, int64, common.ReceiveStatus, string) bool); ok { + if rf, ok := ret.Get(1).(func(types.Context, string, int64, chains.ReceiveStatus, string) bool); ok { r1 = rf(ctx, ballotIndex, outTxChainID, receiveStatus, voter) } else { r1 = ret.Get(1).(bool) } - if rf, ok := ret.Get(2).(func(types.Context, string, int64, common.ReceiveStatus, string) observertypes.Ballot); ok { + if rf, ok := ret.Get(2).(func(types.Context, string, int64, chains.ReceiveStatus, string) observertypes.Ballot); ok { r2 = rf(ctx, ballotIndex, outTxChainID, receiveStatus, voter) } else { r2 = ret.Get(2).(observertypes.Ballot) } - if rf, ok := ret.Get(3).(func(types.Context, string, int64, common.ReceiveStatus, string) string); ok { + if rf, ok := ret.Get(3).(func(types.Context, string, int64, chains.ReceiveStatus, string) string); ok { r3 = rf(ctx, ballotIndex, outTxChainID, receiveStatus, voter) } else { r3 = ret.Get(3).(string) } - if rf, ok := ret.Get(4).(func(types.Context, string, int64, common.ReceiveStatus, string) error); ok { + if rf, ok := ret.Get(4).(func(types.Context, string, int64, chains.ReceiveStatus, string) error); ok { r4 = rf(ctx, ballotIndex, outTxChainID, receiveStatus, voter) } else { r4 = ret.Error(4) diff --git a/testutil/keeper/mocks/fungible/observer.go b/testutil/keeper/mocks/fungible/observer.go index 83cdb37bcc..bbe76b1afa 100644 --- a/testutil/keeper/mocks/fungible/observer.go +++ b/testutil/keeper/mocks/fungible/observer.go @@ -4,7 +4,7 @@ package mocks import ( mock "github.com/stretchr/testify/mock" - common "github.com/zeta-chain/zetacore/common" + chains "github.com/zeta-chain/zetacore/pkg/chains" types "github.com/cosmos/cosmos-sdk/types" ) @@ -15,19 +15,19 @@ type FungibleObserverKeeper struct { } // GetSupportedChains provides a mock function with given fields: ctx -func (_m *FungibleObserverKeeper) GetSupportedChains(ctx types.Context) []*common.Chain { +func (_m *FungibleObserverKeeper) GetSupportedChains(ctx types.Context) []*chains.Chain { ret := _m.Called(ctx) if len(ret) == 0 { panic("no return value specified for GetSupportedChains") } - var r0 []*common.Chain - if rf, ok := ret.Get(0).(func(types.Context) []*common.Chain); ok { + var r0 []*chains.Chain + if rf, ok := ret.Get(0).(func(types.Context) []*chains.Chain); ok { r0 = rf(ctx) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).([]*common.Chain) + r0 = ret.Get(0).([]*chains.Chain) } } diff --git a/testutil/network/genesis_state.go b/testutil/network/genesis_state.go index c1a1d2f311..4263ac256b 100644 --- a/testutil/network/genesis_state.go +++ b/testutil/network/genesis_state.go @@ -6,6 +6,8 @@ import ( "strconv" "testing" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" "cosmossdk.io/math" @@ -14,7 +16,6 @@ import ( evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/require" cmdcfg "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/testutil/nullify" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -61,8 +62,8 @@ func SetupZetaGenesisState(t *testing.T, genesisState map[string]json.RawMessage } if setupChainNonces { - chainNonceList := make([]observertypes.ChainNonces, len(common.PrivnetChainList())) - for i, chain := range common.PrivnetChainList() { + chainNonceList := make([]observertypes.ChainNonces, len(chains.PrivnetChainList())) + for i, chain := range chains.PrivnetChainList() { chainNonceList[i] = observertypes.ChainNonces{ Index: chain.ChainName.String(), ChainId: chain.ChainId, @@ -139,8 +140,8 @@ func AddObserverData(t *testing.T, n int, genesisState map[string]json.RawMessag FinalizedZetaHeight: 1, KeyGenZetaHeight: 1, } - pendingNonces := make([]observertypes.PendingNonces, len(common.DefaultChainsList())) - for i, chain := range common.DefaultChainsList() { + pendingNonces := make([]observertypes.PendingNonces, len(chains.DefaultChainsList())) + for i, chain := range chains.DefaultChainsList() { pendingNonces[i] = observertypes.PendingNonces{ ChainId: chain.ChainId, NonceLow: 0, @@ -205,7 +206,7 @@ func AddCrosschainData(t *testing.T, n int, genesisState map[string]json.RawMess inTxTracker := types.InTxTracker{ ChainId: 5, TxHash: fmt.Sprintf("txHash-%d", i), - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, } nullify.Fill(&inTxTracker) state.InTxTrackerList = append(state.InTxTrackerList, inTxTracker) diff --git a/testutil/sample/common.go b/testutil/sample/common.go index 86eef50a71..7549d80ce0 100644 --- a/testutil/sample/common.go +++ b/testutil/sample/common.go @@ -3,22 +3,23 @@ package sample import ( "github.com/cosmos/cosmos-sdk/crypto/keys/ed25519" "github.com/tendermint/tendermint/crypto/secp256k1" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/crypto" ) -func Chain(chainID int64) *common.Chain { +func Chain(chainID int64) *chains.Chain { r := newRandFromSeed(chainID) - return &common.Chain{ - ChainName: common.ChainName(r.Intn(4)), + return &chains.Chain{ + ChainName: chains.ChainName(r.Intn(4)), ChainId: chainID, } } -func PubKeySet() *common.PubKeySet { - pubKeySet := common.PubKeySet{ - Secp256k1: common.PubKey(secp256k1.GenPrivKey().PubKey().Bytes()), - Ed25519: common.PubKey(ed25519.GenPrivKey().PubKey().String()), +func PubKeySet() *crypto.PubKeySet { + pubKeySet := crypto.PubKeySet{ + Secp256k1: crypto.PubKey(secp256k1.GenPrivKey().PubKey().Bytes()), + Ed25519: crypto.PubKey(ed25519.GenPrivKey().PubKey().String()), } return &pubKeySet } diff --git a/testutil/sample/crosschain.go b/testutil/sample/crosschain.go index 2e8c98fda6..3fa5d04983 100644 --- a/testutil/sample/crosschain.go +++ b/testutil/sample/crosschain.go @@ -9,7 +9,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -42,7 +42,7 @@ func InboundTxParams(r *rand.Rand) *types.InboundTxParams { Sender: EthAddress().String(), SenderChainId: r.Int63(), TxOrigin: EthAddress().String(), - CoinType: common.CoinType(r.Intn(100)), + CoinType: coin.CoinType(r.Intn(100)), Asset: StringRandom(r, 32), Amount: math.NewUint(uint64(r.Int63())), InboundTxObservedHash: StringRandom(r, 32), @@ -56,7 +56,7 @@ func OutboundTxParams(r *rand.Rand) *types.OutboundTxParams { return &types.OutboundTxParams{ Receiver: EthAddress().String(), ReceiverChainId: r.Int63(), - CoinType: common.CoinType(r.Intn(100)), + CoinType: coin.CoinType(r.Intn(100)), Amount: math.NewUint(uint64(r.Int63())), OutboundTxTssNonce: r.Uint64(), OutboundTxGasLimit: r.Uint64(), @@ -125,7 +125,7 @@ func ZetaAccounting(t *testing.T, index string) types.ZetaAccounting { } } -func InboundVote(coinType common.CoinType, from, to int64) types.MsgVoteOnObservedInboundTx { +func InboundVote(coinType coin.CoinType, from, to int64) types.MsgVoteOnObservedInboundTx { return types.MsgVoteOnObservedInboundTx{ Creator: "", Sender: EthAddress().String(), diff --git a/testutil/sample/fungible.go b/testutil/sample/fungible.go index 0310870046..73fdc2b2e3 100644 --- a/testutil/sample/fungible.go +++ b/testutil/sample/fungible.go @@ -3,7 +3,7 @@ package sample import ( "testing" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/fungible/types" ) @@ -17,7 +17,7 @@ func ForeignCoins(t *testing.T, address string) types.ForeignCoins { Decimals: uint32(r.Uint64()), Name: StringRandom(r, 32), Symbol: StringRandom(r, 32), - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, GasLimit: r.Uint64(), } } diff --git a/testutil/sample/observer.go b/testutil/sample/observer.go index 7cb0b9b27b..c90036ff07 100644 --- a/testutil/sample/observer.go +++ b/testutil/sample/observer.go @@ -8,8 +8,9 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/crypto" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/cosmos" + zetacrypto "github.com/zeta-chain/zetacore/pkg/crypto" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -111,7 +112,7 @@ func ChainParamsSupported(chainID int64) *types.ChainParams { } func ChainParamsList() (cpl types.ChainParamsList) { - chainList := common.PrivnetChainList() + chainList := chains.PrivnetChainList() for _, chain := range chainList { cpl.ChainParams = append(cpl.ChainParams, ChainParams(chain.ChainId)) @@ -125,7 +126,7 @@ func Tss() types.TSS { if err != nil { panic(err) } - pk, err := common.NewPubKey(spk) + pk, err := zetacrypto.NewPubKey(spk) if err != nil { panic(err) } diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 020ff9104b..0ac8621411 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -16,8 +16,8 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/cosmos" + "github.com/zeta-chain/zetacore/pkg/crypto" ) var ErrSample = errors.New("sample error") @@ -86,7 +86,7 @@ func PubKeyString() string { if err != nil { panic(err) } - pubkey, err := common.NewPubKey(s) + pubkey, err := crypto.NewPubKey(s) if err != nil { panic(err) } diff --git a/typescript/common/common_pb.d.ts b/typescript/common/common_pb.d.ts deleted file mode 100644 index dbba2518c0..0000000000 --- a/typescript/common/common_pb.d.ts +++ /dev/null @@ -1,338 +0,0 @@ -// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" -// @generated from file common/common.proto (package common, syntax proto3) -/* eslint-disable */ -// @ts-nocheck - -import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; -import { Message, proto3 } from "@bufbuild/protobuf"; -import type { Proof as Proof$1 } from "./ethereum/ethereum_pb.js"; -import type { Proof as Proof$2 } from "./bitcoin/bitcoin_pb.js"; - -/** - * @generated from enum common.ReceiveStatus - */ -export declare enum ReceiveStatus { - /** - * some observer sees inbound tx - * - * @generated from enum value: Created = 0; - */ - Created = 0, - - /** - * @generated from enum value: Success = 1; - */ - Success = 1, - - /** - * @generated from enum value: Failed = 2; - */ - Failed = 2, -} - -/** - * @generated from enum common.CoinType - */ -export declare enum CoinType { - /** - * @generated from enum value: Zeta = 0; - */ - Zeta = 0, - - /** - * Ether, BNB, Matic, Klay, BTC, etc - * - * @generated from enum value: Gas = 1; - */ - Gas = 1, - - /** - * ERC20 token - * - * @generated from enum value: ERC20 = 2; - */ - ERC20 = 2, - - /** - * not a real coin, rather a command - * - * @generated from enum value: Cmd = 3; - */ - Cmd = 3, -} - -/** - * @generated from enum common.ChainName - */ -export declare enum ChainName { - /** - * @generated from enum value: empty = 0; - */ - empty = 0, - - /** - * @generated from enum value: eth_mainnet = 1; - */ - eth_mainnet = 1, - - /** - * @generated from enum value: zeta_mainnet = 2; - */ - zeta_mainnet = 2, - - /** - * @generated from enum value: btc_mainnet = 3; - */ - btc_mainnet = 3, - - /** - * @generated from enum value: polygon_mainnet = 4; - */ - polygon_mainnet = 4, - - /** - * @generated from enum value: bsc_mainnet = 5; - */ - bsc_mainnet = 5, - - /** - * Testnet - * - * @generated from enum value: goerli_testnet = 6; - */ - goerli_testnet = 6, - - /** - * @generated from enum value: mumbai_testnet = 7; - */ - mumbai_testnet = 7, - - /** - * @generated from enum value: ganache_testnet = 8; - */ - ganache_testnet = 8, - - /** - * @generated from enum value: baobab_testnet = 9; - */ - baobab_testnet = 9, - - /** - * @generated from enum value: bsc_testnet = 10; - */ - bsc_testnet = 10, - - /** - * @generated from enum value: zeta_testnet = 11; - */ - zeta_testnet = 11, - - /** - * @generated from enum value: btc_testnet = 12; - */ - btc_testnet = 12, - - /** - * @generated from enum value: sepolia_testnet = 13; - */ - sepolia_testnet = 13, - - /** - * LocalNet - * zeta_localnet = 13; - * - * @generated from enum value: goerli_localnet = 14; - */ - goerli_localnet = 14, - - /** - * Athens - * zeta_athensnet=15; - * - * @generated from enum value: btc_regtest = 15; - */ - btc_regtest = 15, -} - -/** - * PubKeySet contains two pub keys , secp256k1 and ed25519 - * - * @generated from message common.PubKeySet - */ -export declare class PubKeySet extends Message { - /** - * @generated from field: string secp256k1 = 1; - */ - secp256k1: string; - - /** - * @generated from field: string ed25519 = 2; - */ - ed25519: string; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "common.PubKeySet"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): PubKeySet; - - static fromJson(jsonValue: JsonValue, options?: Partial): PubKeySet; - - static fromJsonString(jsonString: string, options?: Partial): PubKeySet; - - static equals(a: PubKeySet | PlainMessage | undefined, b: PubKeySet | PlainMessage | undefined): boolean; -} - -/** - * @generated from message common.Chain - */ -export declare class Chain extends Message { - /** - * @generated from field: common.ChainName chain_name = 1; - */ - chainName: ChainName; - - /** - * @generated from field: int64 chain_id = 2; - */ - chainId: bigint; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "common.Chain"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): Chain; - - static fromJson(jsonValue: JsonValue, options?: Partial): Chain; - - static fromJsonString(jsonString: string, options?: Partial): Chain; - - static equals(a: Chain | PlainMessage | undefined, b: Chain | PlainMessage | undefined): boolean; -} - -/** - * @generated from message common.BlockHeader - */ -export declare class BlockHeader extends Message { - /** - * @generated from field: int64 height = 1; - */ - height: bigint; - - /** - * @generated from field: bytes hash = 2; - */ - hash: Uint8Array; - - /** - * @generated from field: bytes parent_hash = 3; - */ - parentHash: Uint8Array; - - /** - * @generated from field: int64 chain_id = 4; - */ - chainId: bigint; - - /** - * chain specific header - * - * @generated from field: common.HeaderData header = 5; - */ - header?: HeaderData; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "common.BlockHeader"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): BlockHeader; - - static fromJson(jsonValue: JsonValue, options?: Partial): BlockHeader; - - static fromJsonString(jsonString: string, options?: Partial): BlockHeader; - - static equals(a: BlockHeader | PlainMessage | undefined, b: BlockHeader | PlainMessage | undefined): boolean; -} - -/** - * @generated from message common.HeaderData - */ -export declare class HeaderData extends Message { - /** - * @generated from oneof common.HeaderData.data - */ - data: { - /** - * binary encoded headers; RLP for ethereum - * - * @generated from field: bytes ethereum_header = 1; - */ - value: Uint8Array; - case: "ethereumHeader"; - } | { - /** - * 80-byte little-endian encoded binary data - * - * @generated from field: bytes bitcoin_header = 2; - */ - value: Uint8Array; - case: "bitcoinHeader"; - } | { case: undefined; value?: undefined }; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "common.HeaderData"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): HeaderData; - - static fromJson(jsonValue: JsonValue, options?: Partial): HeaderData; - - static fromJsonString(jsonString: string, options?: Partial): HeaderData; - - static equals(a: HeaderData | PlainMessage | undefined, b: HeaderData | PlainMessage | undefined): boolean; -} - -/** - * @generated from message common.Proof - */ -export declare class Proof extends Message { - /** - * @generated from oneof common.Proof.proof - */ - proof: { - /** - * @generated from field: ethereum.Proof ethereum_proof = 1; - */ - value: Proof$1; - case: "ethereumProof"; - } | { - /** - * @generated from field: bitcoin.Proof bitcoin_proof = 2; - */ - value: Proof$2; - case: "bitcoinProof"; - } | { case: undefined; value?: undefined }; - - constructor(data?: PartialMessage); - - static readonly runtime: typeof proto3; - static readonly typeName = "common.Proof"; - static readonly fields: FieldList; - - static fromBinary(bytes: Uint8Array, options?: Partial): Proof; - - static fromJson(jsonValue: JsonValue, options?: Partial): Proof; - - static fromJsonString(jsonString: string, options?: Partial): Proof; - - static equals(a: Proof | PlainMessage | undefined, b: Proof | PlainMessage | undefined): boolean; -} - diff --git a/typescript/common/index.d.ts b/typescript/common/index.d.ts deleted file mode 100644 index 78b610bcc1..0000000000 --- a/typescript/common/index.d.ts +++ /dev/null @@ -1 +0,0 @@ -export * from "./common_pb"; diff --git a/typescript/crosschain/cross_chain_tx_pb.d.ts b/typescript/crosschain/cross_chain_tx_pb.d.ts index 0157548d54..9aa537b31b 100644 --- a/typescript/crosschain/cross_chain_tx_pb.d.ts +++ b/typescript/crosschain/cross_chain_tx_pb.d.ts @@ -5,7 +5,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; -import type { CoinType } from "../common/common_pb.js"; +import type { CoinType } from "../pkg/coin/coin_pb.js"; /** * @generated from enum zetachain.zetacore.crosschain.CctxStatus @@ -104,7 +104,7 @@ export declare class InboundTxParams extends Message { txOrigin: string; /** - * @generated from field: common.CoinType coin_type = 4; + * @generated from field: coin.CoinType coin_type = 4; */ coinType: CoinType; @@ -201,7 +201,7 @@ export declare class OutboundTxParams extends Message { receiverChainId: bigint; /** - * @generated from field: common.CoinType coin_type = 3; + * @generated from field: coin.CoinType coin_type = 3; */ coinType: CoinType; diff --git a/typescript/crosschain/in_tx_tracker_pb.d.ts b/typescript/crosschain/in_tx_tracker_pb.d.ts index d280f82524..9cb101adea 100644 --- a/typescript/crosschain/in_tx_tracker_pb.d.ts +++ b/typescript/crosschain/in_tx_tracker_pb.d.ts @@ -5,7 +5,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; -import type { CoinType } from "../common/common_pb.js"; +import type { CoinType } from "../pkg/coin/coin_pb.js"; /** * @generated from message zetachain.zetacore.crosschain.InTxTracker @@ -22,7 +22,7 @@ export declare class InTxTracker extends Message { txHash: string; /** - * @generated from field: common.CoinType coin_type = 3; + * @generated from field: coin.CoinType coin_type = 3; */ coinType: CoinType; diff --git a/typescript/crosschain/tx_pb.d.ts b/typescript/crosschain/tx_pb.d.ts index 2371a9405c..b1900d7c66 100644 --- a/typescript/crosschain/tx_pb.d.ts +++ b/typescript/crosschain/tx_pb.d.ts @@ -5,7 +5,9 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; -import type { CoinType, Proof, ReceiveStatus } from "../common/common_pb.js"; +import type { ReceiveStatus } from "../pkg/chains/chains_pb.js"; +import type { CoinType } from "../pkg/coin/coin_pb.js"; +import type { Proof } from "../pkg/proofs/proofs_pb.js"; /** * @generated from message zetachain.zetacore.crosschain.MsgCreateTSSVoter @@ -27,7 +29,7 @@ export declare class MsgCreateTSSVoter extends Message { keyGenZetaHeight: bigint; /** - * @generated from field: common.ReceiveStatus status = 4; + * @generated from field: chains.ReceiveStatus status = 4; */ status: ReceiveStatus; @@ -186,12 +188,12 @@ export declare class MsgAddToInTxTracker extends Message { txHash: string; /** - * @generated from field: common.CoinType coin_type = 4; + * @generated from field: coin.CoinType coin_type = 4; */ coinType: CoinType; /** - * @generated from field: common.Proof proof = 5; + * @generated from field: proofs.Proof proof = 5; */ proof?: Proof; @@ -347,7 +349,7 @@ export declare class MsgAddToOutTxTracker extends Message txHash: string; /** - * @generated from field: common.Proof proof = 5; + * @generated from field: proofs.Proof proof = 5; */ proof?: Proof; @@ -563,7 +565,7 @@ export declare class MsgVoteOnObservedOutboundTx extends Message { decimals: bigint; /** - * @generated from field: common.CoinType coin_type = 7; + * @generated from field: coin.CoinType coin_type = 7; */ coinType: CoinType; @@ -126,7 +126,7 @@ export declare class EventZRC20WithdrawFeeUpdated extends Message { symbol: string; /** - * @generated from field: common.CoinType coin_type = 8; + * @generated from field: coin.CoinType coin_type = 8; */ coinType: CoinType; diff --git a/typescript/fungible/tx_pb.d.ts b/typescript/fungible/tx_pb.d.ts index e20d4bde71..57ec4bbddc 100644 --- a/typescript/fungible/tx_pb.d.ts +++ b/typescript/fungible/tx_pb.d.ts @@ -5,7 +5,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; -import type { CoinType } from "../common/common_pb.js"; +import type { CoinType } from "../pkg/coin/coin_pb.js"; /** * @generated from enum zetachain.zetacore.fungible.UpdatePausedStatusAction @@ -233,7 +233,7 @@ export declare class MsgDeployFungibleCoinZRC20 extends Message { granteeAddress: string; /** - * @generated from field: common.PubKeySet granteePubkey = 3; + * @generated from field: crypto.PubKeySet granteePubkey = 3; */ granteePubkey?: PubKeySet; diff --git a/typescript/observer/observer_pb.d.ts b/typescript/observer/observer_pb.d.ts index cf8f1beb79..79bd712ab5 100644 --- a/typescript/observer/observer_pb.d.ts +++ b/typescript/observer/observer_pb.d.ts @@ -5,7 +5,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; -import type { Chain } from "../common/common_pb.js"; +import type { Chain } from "../pkg/chains/chains_pb.js"; /** * @generated from enum zetachain.zetacore.observer.ObservationType @@ -67,7 +67,7 @@ export declare class ObserverMapper extends Message { index: string; /** - * @generated from field: common.Chain observer_chain = 2; + * @generated from field: chains.Chain observer_chain = 2; */ observerChain?: Chain; diff --git a/typescript/observer/params_pb.d.ts b/typescript/observer/params_pb.d.ts index e06b0aebe5..93f7ab74c7 100644 --- a/typescript/observer/params_pb.d.ts +++ b/typescript/observer/params_pb.d.ts @@ -5,7 +5,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; -import type { Chain } from "../common/common_pb.js"; +import type { Chain } from "../pkg/chains/chains_pb.js"; /** * Deprecated(v14):Moved into the authority module @@ -144,7 +144,7 @@ export declare class ChainParams extends Message { */ export declare class ObserverParams extends Message { /** - * @generated from field: common.Chain chain = 1; + * @generated from field: chains.Chain chain = 1; */ chain?: Chain; diff --git a/typescript/observer/query_pb.d.ts b/typescript/observer/query_pb.d.ts index b346e34a87..a98680eeb8 100644 --- a/typescript/observer/query_pb.d.ts +++ b/typescript/observer/query_pb.d.ts @@ -9,10 +9,11 @@ import type { ChainNonces } from "./chain_nonces_pb.js"; import type { PageRequest, PageResponse } from "../cosmos/base/query/v1beta1/pagination_pb.js"; import type { PendingNonces } from "./pending_nonces_pb.js"; import type { TSS } from "./tss_pb.js"; -import type { BlockHeader, Chain, Proof } from "../common/common_pb.js"; +import type { BlockHeader, Proof } from "../pkg/proofs/proofs_pb.js"; import type { ChainParams, ChainParamsList, Params } from "./params_pb.js"; import type { BallotStatus, VoteType } from "./ballot_pb.js"; import type { LastObserverCount, ObservationType } from "./observer_pb.js"; +import type { Chain } from "../pkg/chains/chains_pb.js"; import type { NodeAccount } from "./node_account_pb.js"; import type { CrosschainFlags } from "./crosschain_flags_pb.js"; import type { Keygen } from "./keygen_pb.js"; @@ -443,7 +444,7 @@ export declare class QueryProveRequest extends Message { txHash: string; /** - * @generated from field: common.Proof proof = 3; + * @generated from field: proofs.Proof proof = 3; */ proof?: Proof; @@ -755,7 +756,7 @@ export declare class QuerySupportedChains extends Message */ export declare class QuerySupportedChainsResponse extends Message { /** - * @generated from field: repeated common.Chain chains = 1; + * @generated from field: repeated chains.Chain chains = 1; */ chains: Chain[]; @@ -1278,7 +1279,7 @@ export declare class QueryAllBlockHeaderRequest extends Message { /** - * @generated from field: repeated common.BlockHeader block_headers = 1; + * @generated from field: repeated proofs.BlockHeader block_headers = 1; */ blockHeaders: BlockHeader[]; @@ -1331,7 +1332,7 @@ export declare class QueryGetBlockHeaderByHashRequest extends Message { /** - * @generated from field: common.BlockHeader block_header = 1; + * @generated from field: proofs.BlockHeader block_header = 1; */ blockHeader?: BlockHeader; diff --git a/typescript/observer/tx_pb.d.ts b/typescript/observer/tx_pb.d.ts index 4f7a346cc2..4418e5569e 100644 --- a/typescript/observer/tx_pb.d.ts +++ b/typescript/observer/tx_pb.d.ts @@ -6,7 +6,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; import type { ObserverUpdateReason } from "./observer_pb.js"; -import type { HeaderData } from "../common/common_pb.js"; +import type { HeaderData } from "../pkg/proofs/proofs_pb.js"; import type { ChainParams } from "./params_pb.js"; import type { Blame } from "./blame_pb.js"; import type { BlockHeaderVerificationFlags, GasPriceIncreaseFlags } from "./crosschain_flags_pb.js"; @@ -94,7 +94,7 @@ export declare class MsgAddBlockHeader extends Message { height: bigint; /** - * @generated from field: common.HeaderData header = 5; + * @generated from field: proofs.HeaderData header = 5; */ header?: HeaderData; diff --git a/typescript/pkg/chains/chains_pb.d.ts b/typescript/pkg/chains/chains_pb.d.ts new file mode 100644 index 0000000000..0a04c14420 --- /dev/null +++ b/typescript/pkg/chains/chains_pb.d.ts @@ -0,0 +1,152 @@ +// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" +// @generated from file pkg/chains/chains.proto (package chains, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * @generated from enum chains.ReceiveStatus + */ +export declare enum ReceiveStatus { + /** + * some observer sees inbound tx + * + * @generated from enum value: Created = 0; + */ + Created = 0, + + /** + * @generated from enum value: Success = 1; + */ + Success = 1, + + /** + * @generated from enum value: Failed = 2; + */ + Failed = 2, +} + +/** + * @generated from enum chains.ChainName + */ +export declare enum ChainName { + /** + * @generated from enum value: empty = 0; + */ + empty = 0, + + /** + * @generated from enum value: eth_mainnet = 1; + */ + eth_mainnet = 1, + + /** + * @generated from enum value: zeta_mainnet = 2; + */ + zeta_mainnet = 2, + + /** + * @generated from enum value: btc_mainnet = 3; + */ + btc_mainnet = 3, + + /** + * @generated from enum value: polygon_mainnet = 4; + */ + polygon_mainnet = 4, + + /** + * @generated from enum value: bsc_mainnet = 5; + */ + bsc_mainnet = 5, + + /** + * Testnet + * + * @generated from enum value: goerli_testnet = 6; + */ + goerli_testnet = 6, + + /** + * @generated from enum value: mumbai_testnet = 7; + */ + mumbai_testnet = 7, + + /** + * @generated from enum value: ganache_testnet = 8; + */ + ganache_testnet = 8, + + /** + * @generated from enum value: baobab_testnet = 9; + */ + baobab_testnet = 9, + + /** + * @generated from enum value: bsc_testnet = 10; + */ + bsc_testnet = 10, + + /** + * @generated from enum value: zeta_testnet = 11; + */ + zeta_testnet = 11, + + /** + * @generated from enum value: btc_testnet = 12; + */ + btc_testnet = 12, + + /** + * @generated from enum value: sepolia_testnet = 13; + */ + sepolia_testnet = 13, + + /** + * LocalNet + * zeta_localnet = 13; + * + * @generated from enum value: goerli_localnet = 14; + */ + goerli_localnet = 14, + + /** + * Athens + * zeta_athensnet=15; + * + * @generated from enum value: btc_regtest = 15; + */ + btc_regtest = 15, +} + +/** + * @generated from message chains.Chain + */ +export declare class Chain extends Message { + /** + * @generated from field: chains.ChainName chain_name = 1; + */ + chainName: ChainName; + + /** + * @generated from field: int64 chain_id = 2; + */ + chainId: bigint; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "chains.Chain"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Chain; + + static fromJson(jsonValue: JsonValue, options?: Partial): Chain; + + static fromJsonString(jsonString: string, options?: Partial): Chain; + + static equals(a: Chain | PlainMessage | undefined, b: Chain | PlainMessage | undefined): boolean; +} + diff --git a/typescript/pkg/chains/index.d.ts b/typescript/pkg/chains/index.d.ts new file mode 100644 index 0000000000..1c53d86b35 --- /dev/null +++ b/typescript/pkg/chains/index.d.ts @@ -0,0 +1 @@ +export * from "./chains_pb"; diff --git a/typescript/pkg/coin/coin_pb.d.ts b/typescript/pkg/coin/coin_pb.d.ts new file mode 100644 index 0000000000..394472cf10 --- /dev/null +++ b/typescript/pkg/coin/coin_pb.d.ts @@ -0,0 +1,36 @@ +// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" +// @generated from file pkg/coin/coin.proto (package coin, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +/** + * @generated from enum coin.CoinType + */ +export declare enum CoinType { + /** + * @generated from enum value: Zeta = 0; + */ + Zeta = 0, + + /** + * Ether, BNB, Matic, Klay, BTC, etc + * + * @generated from enum value: Gas = 1; + */ + Gas = 1, + + /** + * ERC20 token + * + * @generated from enum value: ERC20 = 2; + */ + ERC20 = 2, + + /** + * not a real coin, rather a command + * + * @generated from enum value: Cmd = 3; + */ + Cmd = 3, +} + diff --git a/typescript/pkg/coin/index.d.ts b/typescript/pkg/coin/index.d.ts new file mode 100644 index 0000000000..4ca9ff3633 --- /dev/null +++ b/typescript/pkg/coin/index.d.ts @@ -0,0 +1 @@ +export * from "./coin_pb"; diff --git a/typescript/pkg/crypto/crypto_pb.d.ts b/typescript/pkg/crypto/crypto_pb.d.ts new file mode 100644 index 0000000000..2e29039c56 --- /dev/null +++ b/typescript/pkg/crypto/crypto_pb.d.ts @@ -0,0 +1,39 @@ +// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" +// @generated from file pkg/crypto/crypto.proto (package crypto, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; + +/** + * PubKeySet contains two pub keys , secp256k1 and ed25519 + * + * @generated from message crypto.PubKeySet + */ +export declare class PubKeySet extends Message { + /** + * @generated from field: string secp256k1 = 1; + */ + secp256k1: string; + + /** + * @generated from field: string ed25519 = 2; + */ + ed25519: string; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "crypto.PubKeySet"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): PubKeySet; + + static fromJson(jsonValue: JsonValue, options?: Partial): PubKeySet; + + static fromJsonString(jsonString: string, options?: Partial): PubKeySet; + + static equals(a: PubKeySet | PlainMessage | undefined, b: PubKeySet | PlainMessage | undefined): boolean; +} + diff --git a/typescript/pkg/crypto/index.d.ts b/typescript/pkg/crypto/index.d.ts new file mode 100644 index 0000000000..3e597e1b09 --- /dev/null +++ b/typescript/pkg/crypto/index.d.ts @@ -0,0 +1 @@ +export * from "./crypto_pb"; diff --git a/typescript/common/bitcoin/bitcoin_pb.d.ts b/typescript/pkg/proofs/bitcoin/bitcoin_pb.d.ts similarity index 92% rename from typescript/common/bitcoin/bitcoin_pb.d.ts rename to typescript/pkg/proofs/bitcoin/bitcoin_pb.d.ts index 4ba8f93863..baeeb0f2f0 100644 --- a/typescript/common/bitcoin/bitcoin_pb.d.ts +++ b/typescript/pkg/proofs/bitcoin/bitcoin_pb.d.ts @@ -1,5 +1,5 @@ // @generated by protoc-gen-es v1.3.0 with parameter "target=dts" -// @generated from file common/bitcoin/bitcoin.proto (package bitcoin, syntax proto3) +// @generated from file pkg/proofs/bitcoin/bitcoin.proto (package bitcoin, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/typescript/common/bitcoin/index.d.ts b/typescript/pkg/proofs/bitcoin/index.d.ts similarity index 100% rename from typescript/common/bitcoin/index.d.ts rename to typescript/pkg/proofs/bitcoin/index.d.ts diff --git a/typescript/common/ethereum/ethereum_pb.d.ts b/typescript/pkg/proofs/ethereum/ethereum_pb.d.ts similarity index 92% rename from typescript/common/ethereum/ethereum_pb.d.ts rename to typescript/pkg/proofs/ethereum/ethereum_pb.d.ts index d0d2fa9513..28d7ba9671 100644 --- a/typescript/common/ethereum/ethereum_pb.d.ts +++ b/typescript/pkg/proofs/ethereum/ethereum_pb.d.ts @@ -1,5 +1,5 @@ // @generated by protoc-gen-es v1.3.0 with parameter "target=dts" -// @generated from file common/ethereum/ethereum.proto (package ethereum, syntax proto3) +// @generated from file pkg/proofs/ethereum/ethereum.proto (package ethereum, syntax proto3) /* eslint-disable */ // @ts-nocheck diff --git a/typescript/common/ethereum/index.d.ts b/typescript/pkg/proofs/ethereum/index.d.ts similarity index 100% rename from typescript/common/ethereum/index.d.ts rename to typescript/pkg/proofs/ethereum/index.d.ts diff --git a/typescript/pkg/proofs/index.d.ts b/typescript/pkg/proofs/index.d.ts new file mode 100644 index 0000000000..367acd3a6e --- /dev/null +++ b/typescript/pkg/proofs/index.d.ts @@ -0,0 +1 @@ +export * from "./proofs_pb"; diff --git a/typescript/pkg/proofs/proofs_pb.d.ts b/typescript/pkg/proofs/proofs_pb.d.ts new file mode 100644 index 0000000000..5e0e804c09 --- /dev/null +++ b/typescript/pkg/proofs/proofs_pb.d.ts @@ -0,0 +1,132 @@ +// @generated by protoc-gen-es v1.3.0 with parameter "target=dts" +// @generated from file pkg/proofs/proofs.proto (package proofs, syntax proto3) +/* eslint-disable */ +// @ts-nocheck + +import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; +import { Message, proto3 } from "@bufbuild/protobuf"; +import type { Proof as Proof$1 } from "./ethereum/ethereum_pb.js"; +import type { Proof as Proof$2 } from "./bitcoin/bitcoin_pb.js"; + +/** + * @generated from message proofs.BlockHeader + */ +export declare class BlockHeader extends Message { + /** + * @generated from field: int64 height = 1; + */ + height: bigint; + + /** + * @generated from field: bytes hash = 2; + */ + hash: Uint8Array; + + /** + * @generated from field: bytes parent_hash = 3; + */ + parentHash: Uint8Array; + + /** + * @generated from field: int64 chain_id = 4; + */ + chainId: bigint; + + /** + * chain specific header + * + * @generated from field: proofs.HeaderData header = 5; + */ + header?: HeaderData; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "proofs.BlockHeader"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): BlockHeader; + + static fromJson(jsonValue: JsonValue, options?: Partial): BlockHeader; + + static fromJsonString(jsonString: string, options?: Partial): BlockHeader; + + static equals(a: BlockHeader | PlainMessage | undefined, b: BlockHeader | PlainMessage | undefined): boolean; +} + +/** + * @generated from message proofs.HeaderData + */ +export declare class HeaderData extends Message { + /** + * @generated from oneof proofs.HeaderData.data + */ + data: { + /** + * binary encoded headers; RLP for ethereum + * + * @generated from field: bytes ethereum_header = 1; + */ + value: Uint8Array; + case: "ethereumHeader"; + } | { + /** + * 80-byte little-endian encoded binary data + * + * @generated from field: bytes bitcoin_header = 2; + */ + value: Uint8Array; + case: "bitcoinHeader"; + } | { case: undefined; value?: undefined }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "proofs.HeaderData"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): HeaderData; + + static fromJson(jsonValue: JsonValue, options?: Partial): HeaderData; + + static fromJsonString(jsonString: string, options?: Partial): HeaderData; + + static equals(a: HeaderData | PlainMessage | undefined, b: HeaderData | PlainMessage | undefined): boolean; +} + +/** + * @generated from message proofs.Proof + */ +export declare class Proof extends Message { + /** + * @generated from oneof proofs.Proof.proof + */ + proof: { + /** + * @generated from field: ethereum.Proof ethereum_proof = 1; + */ + value: Proof$1; + case: "ethereumProof"; + } | { + /** + * @generated from field: bitcoin.Proof bitcoin_proof = 2; + */ + value: Proof$2; + case: "bitcoinProof"; + } | { case: undefined; value?: undefined }; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "proofs.Proof"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): Proof; + + static fromJson(jsonValue: JsonValue, options?: Partial): Proof; + + static fromJsonString(jsonString: string, options?: Partial): Proof; + + static equals(a: Proof | PlainMessage | undefined, b: Proof | PlainMessage | undefined): boolean; +} + diff --git a/x/crosschain/client/cli/cli_cctx.go b/x/crosschain/client/cli/cli_cctx.go index e85712f50e..92fed899d3 100644 --- a/x/crosschain/client/cli/cli_cctx.go +++ b/x/crosschain/client/cli/cli_cctx.go @@ -12,7 +12,8 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -148,11 +149,11 @@ func CmdCCTXInboundVoter() *cobra.Command { return err } - coinType, ok := common.CoinType_value[args[9]] + coinType, ok := coin.CoinType_value[args[9]] if !ok { return fmt.Errorf("wrong coin type %s", args[9]) } - argsCoinType := common.CoinType(coinType) + argsCoinType := coin.CoinType(coinType) argsAsset := args[10] @@ -224,11 +225,11 @@ func CmdCCTXOutboundVoter() *cobra.Command { argsMMint := args[6] - var status common.ReceiveStatus + var status chains.ReceiveStatus if args[7] == "0" { - status = common.ReceiveStatus_Success + status = chains.ReceiveStatus_Success } else if args[7] == "1" { - status = common.ReceiveStatus_Failed + status = chains.ReceiveStatus_Failed } else { return fmt.Errorf("wrong status") } @@ -243,11 +244,11 @@ func CmdCCTXOutboundVoter() *cobra.Command { return err } - coinType, ok := common.CoinType_value[args[10]] + coinType, ok := coin.CoinType_value[args[10]] if !ok { return fmt.Errorf("wrong coin type %s", args[10]) } - argsCoinType := common.CoinType(coinType) + argsCoinType := coin.CoinType(coinType) clientCtx, err := client.GetClientTxContext(cmd) if err != nil { diff --git a/x/crosschain/client/cli/cli_in_tx_tracker.go b/x/crosschain/client/cli/cli_in_tx_tracker.go index 6a3f4bd1c0..5afcec7ec8 100644 --- a/x/crosschain/client/cli/cli_in_tx_tracker.go +++ b/x/crosschain/client/cli/cli_in_tx_tracker.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/flags" "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cobra" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -24,7 +24,7 @@ func CmdAddToInTxTracker() *cobra.Command { return err } argTxHash := args[1] - argsCoinType, err := common.GetCoinType(args[2]) + argsCoinType, err := coin.GetCoinType(args[2]) if err != nil { return err } diff --git a/x/crosschain/client/cli/cli_tss.go b/x/crosschain/client/cli/cli_tss.go index f3055bbe81..7c85ea8b72 100644 --- a/x/crosschain/client/cli/cli_tss.go +++ b/x/crosschain/client/cli/cli_tss.go @@ -10,7 +10,7 @@ import ( "github.com/cosmos/cosmos-sdk/client/tx" "github.com/spf13/cast" "github.com/spf13/cobra" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -29,11 +29,11 @@ func CmdCreateTSSVoter() *cobra.Command { if err != nil { return err } - var status common.ReceiveStatus + var status chains.ReceiveStatus if args[2] == "0" { - status = common.ReceiveStatus_Success + status = chains.ReceiveStatus_Success } else if args[2] == "1" { - status = common.ReceiveStatus_Failed + status = chains.ReceiveStatus_Failed } else { return fmt.Errorf("wrong status") } diff --git a/x/crosschain/client/integrationtests/cli_helpers.go b/x/crosschain/client/integrationtests/cli_helpers.go index 3195782031..9cc05b32d6 100644 --- a/x/crosschain/client/integrationtests/cli_helpers.go +++ b/x/crosschain/client/integrationtests/cli_helpers.go @@ -17,7 +17,8 @@ import ( authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/stretchr/testify/require" tmcli "github.com/tendermint/tendermint/libs/cli" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/testutil/network" "github.com/zeta-chain/zetacore/x/crosschain/client/cli" "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -137,11 +138,11 @@ func BuildSignedDeployETHZRC20( } args := append([]string{ "", - strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), + strconv.FormatInt(chains.GoerliLocalnetChain().ChainId, 10), "18", "ETH", "gETH", - strconv.FormatInt(int64(common.CoinType_Gas), 10), + strconv.FormatInt(int64(coin.CoinType_Gas), 10), "1000000", }, txArgs...) out, err := clitestutil.ExecTestCLICmd(val.ClientCtx, cmd, args) @@ -156,7 +157,7 @@ func BuildSignedDeployETHZRC20( func BuildSignedGasPriceVote(t testing.TB, val *network.Validator, denom string, account authtypes.AccountI) *os.File { cmd := cli.CmdGasPriceVoter() inboundVoterArgs := []string{ - strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), + strconv.FormatInt(chains.GoerliLocalnetChain().ChainId, 10), "10000000000", "100", "100", @@ -225,7 +226,7 @@ func BuildSignedOutboundVote( "0", valueReceived, status, - strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), + strconv.FormatInt(chains.GoerliLocalnetChain().ChainId, 10), strconv.FormatUint(nonce, 10), "Zeta", } @@ -252,10 +253,10 @@ func BuildSignedInboundVote(t testing.TB, val *network.Validator, denom string, cmd := cli.CmdCCTXInboundVoter() inboundVoterArgs := []string{ "0x96B05C238b99768F349135de0653b687f9c13fEE", - strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), + strconv.FormatInt(chains.GoerliLocalnetChain().ChainId, 10), "0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7", "0x96B05C238b99768F349135de0653b687f9c13fEE", - strconv.FormatInt(common.GoerliLocalnetChain().ChainId, 10), + strconv.FormatInt(chains.GoerliLocalnetChain().ChainId, 10), "10000000000000000000", message, "0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680", @@ -286,16 +287,16 @@ func GetBallotIdentifier(message string, eventIndex int) string { msg := types.NewMsgVoteOnObservedInboundTx( "", "0x96B05C238b99768F349135de0653b687f9c13fEE", - common.GoerliLocalnetChain().ChainId, + chains.GoerliLocalnetChain().ChainId, "0x3b9Fe88DE29efD13240829A0c18E9EC7A44C3CA7", "0x96B05C238b99768F349135de0653b687f9c13fEE", - common.GoerliLocalnetChain().ChainId, + chains.GoerliLocalnetChain().ChainId, sdk.NewUint(10000000000000000000), message, "0x19398991572a825894b34b904ac1e3692720895351466b5c9e6bb7ae1e21d680", 100, 250_000, - common.CoinType_Zeta, + coin.CoinType_Zeta, "", // #nosec G701 always positive uint(eventIndex), @@ -314,9 +315,9 @@ func GetBallotIdentifierOutBound(nonce uint64, cctxindex, outtxHash, valueReceiv 0, math.NewUintFromString(valueReceived), 0, - common.GoerliLocalnetChain().ChainId, + chains.GoerliLocalnetChain().ChainId, nonce, - common.CoinType_Zeta, + coin.CoinType_Zeta, ) return msg.Digest() } diff --git a/x/crosschain/keeper/abci.go b/x/crosschain/keeper/abci.go index dac6bcacc3..5a02c53676 100644 --- a/x/crosschain/keeper/abci.go +++ b/x/crosschain/keeper/abci.go @@ -4,7 +4,7 @@ import ( "fmt" "time" - "github.com/zeta-chain/zetacore/common" + zetachains "github.com/zeta-chain/zetacore/pkg/chains" cosmoserrors "cosmossdk.io/errors" "cosmossdk.io/math" @@ -30,7 +30,7 @@ type CheckAndUpdateCctxGasPriceFunc func( // The function returns the number of cctxs updated and the gas price increase flags used func (k Keeper) IterateAndUpdateCctxGasPrice( ctx sdk.Context, - chains []*common.Chain, + chains []*zetachains.Chain, updateFunc CheckAndUpdateCctxGasPriceFunc, ) (int, observertypes.GasPriceIncreaseFlags) { // fetch the gas price increase flags or use default @@ -50,7 +50,7 @@ func (k Keeper) IterateAndUpdateCctxGasPrice( IterateChains: for _, chain := range chains { // support only external evm chains - if common.IsEVMChain(chain.ChainId) && !common.IsZetaChain(chain.ChainId) { + if zetachains.IsEVMChain(chain.ChainId) && !zetachains.IsZetaChain(chain.ChainId) { res, err := k.CctxListPending(sdk.UnwrapSDKContext(ctx), &types.QueryListCctxPendingRequest{ ChainId: chain.ChainId, Limit: gasPriceIncreaseFlags.MaxPendingCctxs, diff --git a/x/crosschain/keeper/abci_test.go b/x/crosschain/keeper/abci_test.go index 4487d7dcec..c8ef411f4b 100644 --- a/x/crosschain/keeper/abci_test.go +++ b/x/crosschain/keeper/abci_test.go @@ -9,7 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" testkeeper "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/keeper" @@ -42,20 +42,20 @@ func TestKeeper_IterateAndUpdateCctxGasPrice(t *testing.T) { } // add some evm and non-evm chains - supportedChains := []*common.Chain{ - {ChainId: common.EthChain().ChainId}, - {ChainId: common.BtcMainnetChain().ChainId}, - {ChainId: common.BscMainnetChain().ChainId}, - {ChainId: common.ZetaChainMainnet().ChainId}, + supportedChains := []*chains.Chain{ + {ChainId: chains.EthChain().ChainId}, + {ChainId: chains.BtcMainnetChain().ChainId}, + {ChainId: chains.BscMainnetChain().ChainId}, + {ChainId: chains.ZetaChainMainnet().ChainId}, } // set pending cctx tss := sample.Tss() zk.ObserverKeeper.SetTSS(ctx, tss) - createCctxWithNonceRange(t, ctx, *k, 10, 15, common.EthChain().ChainId, tss, zk) - createCctxWithNonceRange(t, ctx, *k, 20, 25, common.BtcMainnetChain().ChainId, tss, zk) - createCctxWithNonceRange(t, ctx, *k, 30, 35, common.BscMainnetChain().ChainId, tss, zk) - createCctxWithNonceRange(t, ctx, *k, 40, 45, common.ZetaChainMainnet().ChainId, tss, zk) + createCctxWithNonceRange(t, ctx, *k, 10, 15, chains.EthChain().ChainId, tss, zk) + createCctxWithNonceRange(t, ctx, *k, 20, 25, chains.BtcMainnetChain().ChainId, tss, zk) + createCctxWithNonceRange(t, ctx, *k, 30, 35, chains.BscMainnetChain().ChainId, tss, zk) + createCctxWithNonceRange(t, ctx, *k, 40, 45, chains.ZetaChainMainnet().ChainId, tss, zk) // set a cctx where the update function should fail to test that the next cctx are not updated but the next chains are failMap[sample.GetCctxIndexFromString("1-12")] = struct{}{} diff --git a/x/crosschain/keeper/cctx.go b/x/crosschain/keeper/cctx.go index d6fb9b117b..c689e0cc00 100644 --- a/x/crosschain/keeper/cctx.go +++ b/x/crosschain/keeper/cctx.go @@ -6,7 +6,7 @@ import ( "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" observerTypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -48,7 +48,7 @@ func (k Keeper) SetCctxAndNonceToCctxAndInTxHashToCctx(ctx sdk.Context, cctx typ Tss: tss.TssPubkey, }) } - if cctx.CctxStatus.Status == types.CctxStatus_Aborted && cctx.GetCurrentOutTxParam().CoinType == common.CoinType_Zeta { + if cctx.CctxStatus.Status == types.CctxStatus_Aborted && cctx.GetCurrentOutTxParam().CoinType == coin.CoinType_Zeta { k.AddZetaAbortedAmount(ctx, GetAbortedAmount(cctx)) } } diff --git a/x/crosschain/keeper/cctx_test.go b/x/crosschain/keeper/cctx_test.go index 6732ed6795..7f51dca642 100644 --- a/x/crosschain/keeper/cctx_test.go +++ b/x/crosschain/keeper/cctx_test.go @@ -8,6 +8,7 @@ import ( "cosmossdk.io/math" "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/keeper" @@ -15,7 +16,6 @@ import ( "google.golang.org/grpc/status" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -48,7 +48,7 @@ func createNCctx(keeper *keeper.Keeper, ctx sdk.Context, n int) []types.CrossCha SenderChainId: int64(i), TxOrigin: fmt.Sprintf("%d", i), Asset: fmt.Sprintf("%d", i), - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, InboundTxObservedHash: fmt.Sprintf("%d", i), InboundTxObservedExternalHeight: uint64(i), InboundTxFinalizedZetaHeight: uint64(i), diff --git a/x/crosschain/keeper/cctx_utils.go b/x/crosschain/keeper/cctx_utils.go index 8c2edd5013..0fde2fb2e6 100644 --- a/x/crosschain/keeper/cctx_utils.go +++ b/x/crosschain/keeper/cctx_utils.go @@ -9,7 +9,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -59,7 +59,7 @@ func (k Keeper) GetRevertGasLimit(ctx sdk.Context, cctx types.CrossChainTx) (uin return 0, nil } - if cctx.InboundTxParams.CoinType == common.CoinType_Gas { + if cctx.InboundTxParams.CoinType == coin.CoinType_Gas { // get the gas limit of the gas token fc, found := k.fungibleKeeper.GetGasCoinForForeignCoin(ctx, cctx.InboundTxParams.SenderChainId) if !found { @@ -70,7 +70,7 @@ func (k Keeper) GetRevertGasLimit(ctx sdk.Context, cctx types.CrossChainTx) (uin return 0, errors.Wrap(fungibletypes.ErrContractCall, err.Error()) } return gasLimit.Uint64(), nil - } else if cctx.InboundTxParams.CoinType == common.CoinType_ERC20 { + } else if cctx.InboundTxParams.CoinType == coin.CoinType_ERC20 { // get the gas limit of the associated asset fc, found := k.fungibleKeeper.GetForeignCoinFromAsset(ctx, cctx.InboundTxParams.Asset, cctx.InboundTxParams.SenderChainId) if !found { diff --git a/x/crosschain/keeper/cctx_utils_test.go b/x/crosschain/keeper/cctx_utils_test.go index 319ef35a54..c637cc4cc9 100644 --- a/x/crosschain/keeper/cctx_utils_test.go +++ b/x/crosschain/keeper/cctx_utils_test.go @@ -6,7 +6,7 @@ import ( sdkmath "cosmossdk.io/math" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" crosschainkeeper "github.com/zeta-chain/zetacore/x/crosschain/keeper" @@ -28,7 +28,7 @@ func TestGetRevertGasLimit(t *testing.T) { gasLimit, err := k.GetRevertGasLimit(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }}) require.NoError(t, err) require.Equal(t, uint64(0), gasLimit) @@ -47,7 +47,7 @@ func TestGetRevertGasLimit(t *testing.T) { gasLimit, err := k.GetRevertGasLimit(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, SenderChainId: chainID, }}) require.NoError(t, err) @@ -77,7 +77,7 @@ func TestGetRevertGasLimit(t *testing.T) { gasLimit, err := k.GetRevertGasLimit(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, SenderChainId: chainID, Asset: asset, }}) @@ -90,7 +90,7 @@ func TestGetRevertGasLimit(t *testing.T) { _, err := k.GetRevertGasLimit(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, SenderChainId: 999999, }}) require.ErrorIs(t, err, types.ErrForeignCoinNotFound) @@ -105,13 +105,13 @@ func TestGetRevertGasLimit(t *testing.T) { zk.FungibleKeeper.SetForeignCoins(ctx, fungibletypes.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), ForeignChainId: chainID, - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, }) // no contract deployed therefore will fail _, err := k.GetRevertGasLimit(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, SenderChainId: chainID, }}) require.ErrorIs(t, err, fungibletypes.ErrContractCall) @@ -122,7 +122,7 @@ func TestGetRevertGasLimit(t *testing.T) { _, err := k.GetRevertGasLimit(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, SenderChainId: 999999, }}) require.ErrorIs(t, err, types.ErrForeignCoinNotFound) @@ -138,14 +138,14 @@ func TestGetRevertGasLimit(t *testing.T) { zk.FungibleKeeper.SetForeignCoins(ctx, fungibletypes.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), ForeignChainId: chainID, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Asset: asset, }) // no contract deployed therefore will fail _, err := k.GetRevertGasLimit(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, SenderChainId: chainID, Asset: asset, }}) diff --git a/x/crosschain/keeper/events.go b/x/crosschain/keeper/events.go index 2f6a88908c..6943d77723 100644 --- a/x/crosschain/keeper/events.go +++ b/x/crosschain/keeper/events.go @@ -3,7 +3,7 @@ package keeper import ( "strconv" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -15,13 +15,13 @@ func EmitEventInboundFinalized(ctx sdk.Context, cctx *types.CrossChainTx) { MsgTypeUrl: sdk.MsgTypeURL(&types.MsgVoteOnObservedInboundTx{}), CctxIndex: cctx.Index, Sender: cctx.InboundTxParams.Sender, - SenderChain: common.GetChainFromChainID(cctx.InboundTxParams.SenderChainId).ChainName.String(), + SenderChain: chains.GetChainFromChainID(cctx.InboundTxParams.SenderChainId).ChainName.String(), TxOrgin: cctx.InboundTxParams.TxOrigin, Asset: cctx.InboundTxParams.Asset, InTxHash: cctx.InboundTxParams.InboundTxObservedHash, InBlockHeight: strconv.FormatUint(cctx.InboundTxParams.InboundTxObservedExternalHeight, 10), Receiver: currentOutParam.Receiver, - ReceiverChain: common.GetChainFromChainID(currentOutParam.ReceiverChainId).ChainName.String(), + ReceiverChain: chains.GetChainFromChainID(currentOutParam.ReceiverChainId).ChainName.String(), Amount: cctx.InboundTxParams.Amount.String(), RelayedMessage: cctx.RelayedMessage, NewStatus: cctx.CctxStatus.Status.String(), diff --git a/x/crosschain/keeper/evm_deposit.go b/x/crosschain/keeper/evm_deposit.go index c3392e005e..96be91a5d4 100644 --- a/x/crosschain/keeper/evm_deposit.go +++ b/x/crosschain/keeper/evm_deposit.go @@ -10,7 +10,8 @@ import ( "github.com/pkg/errors" tmbytes "github.com/tendermint/tendermint/libs/bytes" tmtypes "github.com/tendermint/tendermint/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" ) @@ -35,7 +36,7 @@ func (k Keeper) HandleEVMDeposit( cctx.GetCurrentOutTxParam().OutboundTxObservedExternalHeight = uint64(ctx.BlockHeight()) } - if msg.CoinType == common.CoinType_Zeta { + if msg.CoinType == coin.CoinType_Zeta { // if coin type is Zeta, this is a deposit ZETA to zEVM cctx. err := k.fungibleKeeper.DepositCoinZeta(ctx, to, msg.Amount.BigInt()) if err != nil { @@ -43,7 +44,7 @@ func (k Keeper) HandleEVMDeposit( } } else { // cointype is Gas or ERC20; then it could be a ZRC20 deposit/depositAndCall cctx. - parsedAddress, data, err := common.ParseAddressAndData(msg.Message) + parsedAddress, data, err := chains.ParseAddressAndData(msg.Message) if err != nil { return false, errors.Wrap(types.ErrUnableToParseAddress, err.Error()) } @@ -51,7 +52,7 @@ func (k Keeper) HandleEVMDeposit( to = parsedAddress } - from, err := common.DecodeAddressFromChainID(senderChainID, msg.Sender) + from, err := chains.DecodeAddressFromChainID(senderChainID, msg.Sender) if err != nil { return false, fmt.Errorf("HandleEVMDeposit: unable to decode address: %s", err.Error()) } diff --git a/x/crosschain/keeper/evm_deposit_test.go b/x/crosschain/keeper/evm_deposit_test.go index dd6528e639..15ca00a62a 100644 --- a/x/crosschain/keeper/evm_deposit_test.go +++ b/x/crosschain/keeper/evm_deposit_test.go @@ -10,7 +10,7 @@ import ( evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -37,7 +37,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { types.MsgVoteOnObservedInboundTx{ Receiver: receiver.String(), Amount: math.NewUintFromBigInt(amount), - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }, 0, ) @@ -66,7 +66,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { types.MsgVoteOnObservedInboundTx{ Receiver: receiver.String(), Amount: math.NewUintFromBigInt(amount), - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }, 0, ) @@ -96,7 +96,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { amount, senderChain, mock.Anything, - common.CoinType_ERC20, + coin.CoinType_ERC20, mock.Anything, ).Return(&evmtypes.MsgEthereumTxResponse{}, false, nil) @@ -108,7 +108,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { Sender: sample.EthAddress().String(), Receiver: receiver.String(), Amount: math.NewUintFromBigInt(amount), - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Message: "", Asset: "", }, @@ -141,7 +141,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { amount, senderChain, mock.Anything, - common.CoinType_ERC20, + coin.CoinType_ERC20, mock.Anything, ).Return(&evmtypes.MsgEthereumTxResponse{}, false, errDeposit) @@ -153,7 +153,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { Sender: sample.EthAddress().String(), Receiver: receiver.String(), Amount: math.NewUintFromBigInt(amount), - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Message: "", Asset: "", }, @@ -186,7 +186,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { amount, senderChain, mock.Anything, - common.CoinType_ERC20, + coin.CoinType_ERC20, mock.Anything, ).Return(&evmtypes.MsgEthereumTxResponse{VmError: "reverted"}, false, errDeposit) @@ -198,7 +198,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { Sender: sample.EthAddress().String(), Receiver: receiver.String(), Amount: math.NewUintFromBigInt(amount), - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Message: "", Asset: "", }, @@ -230,7 +230,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { amount, senderChain, mock.Anything, - common.CoinType_ERC20, + coin.CoinType_ERC20, mock.Anything, ).Return(&evmtypes.MsgEthereumTxResponse{}, false, fungibletypes.ErrForeignCoinCapReached) @@ -242,7 +242,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { Sender: sample.EthAddress().String(), Receiver: receiver.String(), Amount: math.NewUintFromBigInt(amount), - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Message: "", Asset: "", }, @@ -274,7 +274,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { amount, senderChain, mock.Anything, - common.CoinType_ERC20, + coin.CoinType_ERC20, mock.Anything, ).Return(&evmtypes.MsgEthereumTxResponse{}, false, fungibletypes.ErrPausedZRC20) @@ -286,7 +286,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { Sender: sample.EthAddress().String(), Receiver: receiver.String(), Amount: math.NewUintFromBigInt(amount), - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Message: "", Asset: "", }, @@ -316,7 +316,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { amount, senderChain, mock.Anything, - common.CoinType_ERC20, + coin.CoinType_ERC20, mock.Anything, ).Return(&evmtypes.MsgEthereumTxResponse{}, false, fungibletypes.ErrCallNonContract) @@ -328,7 +328,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { Sender: sample.EthAddress().String(), Receiver: receiver.String(), Amount: math.NewUintFromBigInt(amount), - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Message: "", Asset: "", }, @@ -352,7 +352,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { Sender: sample.EthAddress().String(), Receiver: sample.EthAddress().String(), Amount: math.NewUint(42), - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, Message: "not_hex", Asset: "", }, @@ -382,7 +382,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { amount, senderChain, data, - common.CoinType_ERC20, + coin.CoinType_ERC20, mock.Anything, ).Return(&evmtypes.MsgEthereumTxResponse{}, false, nil) @@ -393,7 +393,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { Sender: sample.EthAddress().String(), Receiver: sample.EthAddress().String(), Amount: math.NewUintFromBigInt(amount), - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Message: receiver.Hex()[2:] + "DEADBEEF", Asset: "", }, @@ -425,7 +425,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { amount, senderChain, data, - common.CoinType_ERC20, + coin.CoinType_ERC20, mock.Anything, ).Return(&evmtypes.MsgEthereumTxResponse{}, false, nil) @@ -436,7 +436,7 @@ func TestMsgServer_HandleEVMDeposit(t *testing.T) { Sender: sample.EthAddress().String(), Receiver: receiver.String(), Amount: math.NewUintFromBigInt(amount), - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Message: "DEADBEEF", Asset: "", }, diff --git a/x/crosschain/keeper/evm_hooks.go b/x/crosschain/keeper/evm_hooks.go index 9428865463..e5d85aba2a 100644 --- a/x/crosschain/keeper/evm_hooks.go +++ b/x/crosschain/keeper/evm_hooks.go @@ -17,7 +17,8 @@ import ( connectorzevm "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/connectorzevm.sol" zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -137,7 +138,7 @@ func (k Keeper) ProcessZRC20WithdrawalEvent(ctx sdk.Context, event *zrc20.ZRC20W if receiverChain == nil { return errorsmod.Wrapf(observertypes.ErrSupportedChains, "chain with chainID %d not supported", foreignCoin.ForeignChainId) } - senderChain, err := common.ZetaChainFromChainID(ctx.ChainID()) + senderChain, err := chains.ZetaChainFromChainID(ctx.ChainID()) if err != nil { return fmt.Errorf("ProcessZRC20WithdrawalEvent: failed to convert chainID: %s", err.Error()) } @@ -224,7 +225,7 @@ func (k Keeper) ProcessZetaSentEvent(ctx sdk.Context, event *connectorzevm.ZetaC return types.ErrUnableToSendCoinType } toAddr := "0x" + hex.EncodeToString(event.DestinationAddress) - senderChain, err := common.ZetaChainFromChainID(ctx.ChainID()) + senderChain, err := chains.ZetaChainFromChainID(ctx.ChainID()) if err != nil { return fmt.Errorf("ProcessZetaSentEvent: failed to convert chainID: %s", err.Error()) } @@ -242,7 +243,7 @@ func (k Keeper) ProcessZetaSentEvent(ctx sdk.Context, event *connectorzevm.ZetaC event.Raw.TxHash.String(), event.Raw.BlockNumber, 90000, - common.CoinType_Zeta, + coin.CoinType_Zeta, "", event.Raw.Index, ) @@ -273,7 +274,7 @@ func (k Keeper) ProcessZetaSentEvent(ctx sdk.Context, event *connectorzevm.ZetaC return k.ProcessCCTX(ctx, cctx, receiverChain) } -func (k Keeper) ProcessCCTX(ctx sdk.Context, cctx types.CrossChainTx, receiverChain *common.Chain) error { +func (k Keeper) ProcessCCTX(ctx sdk.Context, cctx types.CrossChainTx, receiverChain *chains.Chain) error { inCctxIndex, ok := ctx.Value("inCctxIndex").(string) if ok { cctx.InboundTxParams.InboundTxObservedHash = inCctxIndex @@ -310,11 +311,11 @@ func ParseZRC20WithdrawalEvent(log ethtypes.Log) (*zrc20.ZRC20Withdrawal, error) func ValidateZrc20WithdrawEvent(event *zrc20.ZRC20Withdrawal, chainID int64) error { // The event was parsed; that means the user has deposited tokens to the contract. - if common.IsBitcoinChain(chainID) { + if chains.IsBitcoinChain(chainID) { if event.Value.Cmp(big.NewInt(0)) <= 0 { return fmt.Errorf("ParseZRC20WithdrawalEvent: invalid amount %s", event.Value.String()) } - addr, err := common.DecodeBtcAddress(string(event.To), chainID) + addr, err := chains.DecodeBtcAddress(string(event.To), chainID) if err != nil { return fmt.Errorf("ParseZRC20WithdrawalEvent: invalid address %s: %s", event.To, err) } diff --git a/x/crosschain/keeper/evm_hooks_test.go b/x/crosschain/keeper/evm_hooks_test.go index 9dc5377ab2..85676457cf 100644 --- a/x/crosschain/keeper/evm_hooks_test.go +++ b/x/crosschain/keeper/evm_hooks_test.go @@ -13,7 +13,7 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" crosschainkeeper "github.com/zeta-chain/zetacore/x/crosschain/keeper" @@ -22,7 +22,7 @@ import ( observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -func SetupStateForProcessLogsZetaSent(t *testing.T, ctx sdk.Context, k *crosschainkeeper.Keeper, zk keepertest.ZetaKeepers, sdkk keepertest.SDKKeepers, chain common.Chain) { +func SetupStateForProcessLogsZetaSent(t *testing.T, ctx sdk.Context, k *crosschainkeeper.Keeper, zk keepertest.ZetaKeepers, sdkk keepertest.SDKKeepers, chain chains.Chain) { assetAddress := sample.EthAddress().String() gasZRC20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, chain.ChainId, "ethereum", "ETH") zrc20Addr := deployZRC20( @@ -53,7 +53,7 @@ func SetupStateForProcessLogsZetaSent(t *testing.T, ctx sdk.Context, k *crosscha ) } -func SetupStateForProcessLogs(t *testing.T, ctx sdk.Context, k *crosschainkeeper.Keeper, zk keepertest.ZetaKeepers, sdkk keepertest.SDKKeepers, chain common.Chain) { +func SetupStateForProcessLogs(t *testing.T, ctx sdk.Context, k *crosschainkeeper.Keeper, zk keepertest.ZetaKeepers, sdkk keepertest.SDKKeepers, chain chains.Chain) { deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) tss := sample.Tss() @@ -134,7 +134,7 @@ func TestValidateZrc20WithdrawEvent(t *testing.T) { t.Run("successfully validate a valid event", func(t *testing.T) { btcMainNetWithdrawalEvent, err := crosschainkeeper.ParseZRC20WithdrawalEvent(*sample.GetValidZRC20WithdrawToBTC(t).Logs[3]) require.NoError(t, err) - err = crosschainkeeper.ValidateZrc20WithdrawEvent(btcMainNetWithdrawalEvent, common.BtcMainnetChain().ChainId) + err = crosschainkeeper.ValidateZrc20WithdrawEvent(btcMainNetWithdrawalEvent, chains.BtcMainnetChain().ChainId) require.NoError(t, err) }) @@ -142,14 +142,14 @@ func TestValidateZrc20WithdrawEvent(t *testing.T) { btcMainNetWithdrawalEvent, err := crosschainkeeper.ParseZRC20WithdrawalEvent(*sample.GetValidZRC20WithdrawToBTC(t).Logs[3]) require.NoError(t, err) btcMainNetWithdrawalEvent.Value = big.NewInt(0) - err = crosschainkeeper.ValidateZrc20WithdrawEvent(btcMainNetWithdrawalEvent, common.BtcMainnetChain().ChainId) + err = crosschainkeeper.ValidateZrc20WithdrawEvent(btcMainNetWithdrawalEvent, chains.BtcMainnetChain().ChainId) require.ErrorContains(t, err, "ParseZRC20WithdrawalEvent: invalid amount") }) t.Run("unable to validate a event with an invalid chain ID", func(t *testing.T) { btcMainNetWithdrawalEvent, err := crosschainkeeper.ParseZRC20WithdrawalEvent(*sample.GetValidZRC20WithdrawToBTC(t).Logs[3]) require.NoError(t, err) - err = crosschainkeeper.ValidateZrc20WithdrawEvent(btcMainNetWithdrawalEvent, common.BtcTestNetChain().ChainId) + err = crosschainkeeper.ValidateZrc20WithdrawEvent(btcMainNetWithdrawalEvent, chains.BtcTestNetChain().ChainId) require.ErrorContains(t, err, "address is not for network testnet3") }) @@ -157,7 +157,7 @@ func TestValidateZrc20WithdrawEvent(t *testing.T) { btcMainNetWithdrawalEvent, err := crosschainkeeper.ParseZRC20WithdrawalEvent(*sample.GetValidZRC20WithdrawToBTC(t).Logs[3]) require.NoError(t, err) btcMainNetWithdrawalEvent.To = []byte("1EYVvXLusCxtVuEwoYvWRyN5EZTXwPVvo3") - err = crosschainkeeper.ValidateZrc20WithdrawEvent(btcMainNetWithdrawalEvent, common.BtcTestNetChain().ChainId) + err = crosschainkeeper.ValidateZrc20WithdrawEvent(btcMainNetWithdrawalEvent, chains.BtcTestNetChain().ChainId) require.ErrorContains(t, err, "decode address failed: unknown address type") }) } @@ -167,7 +167,7 @@ func TestKeeper_ProcessZRC20WithdrawalEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.BtcMainnetChain() + chain := chains.BtcMainnetChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -193,7 +193,7 @@ func TestKeeper_ProcessZRC20WithdrawalEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -219,7 +219,7 @@ func TestKeeper_ProcessZRC20WithdrawalEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -240,7 +240,7 @@ func TestKeeper_ProcessZRC20WithdrawalEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -261,7 +261,7 @@ func TestKeeper_ProcessZRC20WithdrawalEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -284,7 +284,7 @@ func TestKeeper_ProcessZRC20WithdrawalEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -310,7 +310,7 @@ func TestKeeper_ProcessZRC20WithdrawalEvent(t *testing.T) { fungibleMock := keepertest.GetCrosschainFungibleMock(t, k) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -335,7 +335,7 @@ func TestKeeper_ProcessZRC20WithdrawalEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -358,7 +358,7 @@ func TestKeeper_ProcessZRC20WithdrawalEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -393,7 +393,7 @@ func TestKeeper_ParseZetaSentEvent(t *testing.T) { require.Nil(t, event) continue } - require.Equal(t, common.EthChain().ChainId, event.DestinationChainId.Int64()) + require.Equal(t, chains.EthChain().ChainId, event.DestinationChainId.Int64()) require.Equal(t, "70000000000000000000", event.ZetaValueAndGas.String()) require.Equal(t, "0x60983881bdf302dcfa96603A58274D15D5966209", event.SourceTxOriginAddress.String()) require.Equal(t, "0xF0a3F93Ed1B126142E61423F9546bf1323Ff82DF", event.ZetaTxSenderAddress.String()) @@ -430,7 +430,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) @@ -452,7 +452,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { cctxList := k.GetAllCrossChainTx(ctx) require.Len(t, cctxList, 1) require.Equal(t, strings.Compare("0x60983881bdf302dcfa96603a58274d15d5966209", cctxList[0].GetCurrentOutTxParam().Receiver), 0) - require.Equal(t, common.EthChain().ChainId, cctxList[0].GetCurrentOutTxParam().ReceiverChainId) + require.Equal(t, chains.EthChain().ChainId, cctxList[0].GetCurrentOutTxParam().ReceiverChainId) require.Equal(t, emittingContract.Hex(), cctxList[0].InboundTxParams.Sender) require.Equal(t, txOrigin.Hex(), cctxList[0].InboundTxParams.TxOrigin) }) @@ -461,7 +461,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -481,7 +481,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) SetupStateForProcessLogsZetaSent(t, ctx, k, zk, sdkk, chain) @@ -503,7 +503,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -528,7 +528,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -551,7 +551,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) @@ -583,7 +583,7 @@ func TestKeeper_ProcessLogs(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.BtcMainnetChain() + chain := chains.BtcMainnetChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -609,7 +609,7 @@ func TestKeeper_ProcessLogs(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -633,7 +633,7 @@ func TestKeeper_ProcessLogs(t *testing.T) { cctxList := k.GetAllCrossChainTx(ctx) require.Len(t, cctxList, 1) require.Equal(t, strings.Compare("0x60983881bdf302dcfa96603a58274d15d5966209", cctxList[0].GetCurrentOutTxParam().Receiver), 0) - require.Equal(t, common.EthChain().ChainId, cctxList[0].GetCurrentOutTxParam().ReceiverChainId) + require.Equal(t, chains.EthChain().ChainId, cctxList[0].GetCurrentOutTxParam().ReceiverChainId) require.Equal(t, emittingContract.Hex(), cctxList[0].InboundTxParams.Sender) require.Equal(t, txOrigin.Hex(), cctxList[0].InboundTxParams.TxOrigin) }) @@ -652,7 +652,7 @@ func TestKeeper_ProcessLogs(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.BtcMainnetChain() + chain := chains.BtcMainnetChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -673,7 +673,7 @@ func TestKeeper_ProcessLogs(t *testing.T) { t.Run("no cctx created for logs containing proper event but not emitted from a known ZRC20 contract", func(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.BtcMainnetChain() + chain := chains.BtcMainnetChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -694,7 +694,7 @@ func TestKeeper_ProcessLogs(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.BtcMainnetChain() + chain := chains.BtcMainnetChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -718,7 +718,7 @@ func TestKeeper_ProcessLogs(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.BtcMainnetChain() + chain := chains.BtcMainnetChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) @@ -739,7 +739,7 @@ func TestKeeper_ProcessLogs(t *testing.T) { k, ctx, sdkk, zk := keepertest.CrosschainKeeper(t) k.GetAuthKeeper().GetModuleAccount(ctx, fungibletypes.ModuleName) - chain := common.BtcMainnetChain() + chain := chains.BtcMainnetChain() chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) diff --git a/x/crosschain/keeper/gas_payment.go b/x/crosschain/keeper/gas_payment.go index e42c6df643..6a9b957f16 100644 --- a/x/crosschain/keeper/gas_payment.go +++ b/x/crosschain/keeper/gas_payment.go @@ -11,7 +11,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -29,11 +29,11 @@ func (k Keeper) PayGasAndUpdateCctx( ) error { // Dispatch to the correct function based on the coin type switch cctx.InboundTxParams.CoinType { - case common.CoinType_Zeta: + case coin.CoinType_Zeta: return k.PayGasInZetaAndUpdateCctx(ctx, chainID, cctx, inputAmount, noEthereumTxEvent) - case common.CoinType_Gas: + case coin.CoinType_Gas: return k.PayGasNativeAndUpdateCctx(ctx, chainID, cctx, inputAmount) - case common.CoinType_ERC20: + case coin.CoinType_ERC20: return k.PayGasInERC20AndUpdateCctx(ctx, chainID, cctx, inputAmount, noEthereumTxEvent) default: // can't pay gas with coin type @@ -90,7 +90,7 @@ func (k Keeper) PayGasNativeAndUpdateCctx( inputAmount math.Uint, ) error { // preliminary checks - if cctx.InboundTxParams.CoinType != common.CoinType_Gas { + if cctx.InboundTxParams.CoinType != coin.CoinType_Gas { return cosmoserrors.Wrapf(types.ErrInvalidCoinType, "can't pay gas in native gas with %s", cctx.InboundTxParams.CoinType.String()) } if chain := k.zetaObserverKeeper.GetSupportedChainFromChainID(ctx, chainID); chain == nil { @@ -137,7 +137,7 @@ func (k Keeper) PayGasInERC20AndUpdateCctx( noEthereumTxEvent bool, ) error { // preliminary checks - if cctx.InboundTxParams.CoinType != common.CoinType_ERC20 { + if cctx.InboundTxParams.CoinType != coin.CoinType_ERC20 { return cosmoserrors.Wrapf(types.ErrInvalidCoinType, "can't pay gas in erc20 with %s", cctx.InboundTxParams.CoinType.String()) } @@ -264,7 +264,7 @@ func (k Keeper) PayGasInZetaAndUpdateCctx( noEthereumTxEvent bool, ) error { // preliminary checks - if cctx.InboundTxParams.CoinType != common.CoinType_Zeta { + if cctx.InboundTxParams.CoinType != coin.CoinType_Zeta { return cosmoserrors.Wrapf(types.ErrInvalidCoinType, "can't pay gas in zeta with %s", cctx.InboundTxParams.CoinType.String()) } diff --git a/x/crosschain/keeper/gas_payment_test.go b/x/crosschain/keeper/gas_payment_test.go index 8ed31d8a46..1ccb31c937 100644 --- a/x/crosschain/keeper/gas_payment_test.go +++ b/x/crosschain/keeper/gas_payment_test.go @@ -4,13 +4,14 @@ import ( "math/big" "testing" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/testutil/sample" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "cosmossdk.io/math" "github.com/stretchr/testify/require" - zetacommon "github.com/zeta-chain/zetacore/common" testkeeper "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" @@ -47,11 +48,11 @@ func TestKeeper_PayGasNativeAndUpdateCctx(t *testing.T) { // create a cctx reverted from zeta cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Gas, + CoinType: coin.CoinType_Gas, }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, + ReceiverChainId: chains.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -73,7 +74,7 @@ func TestKeeper_PayGasNativeAndUpdateCctx(t *testing.T) { chainID := getValidEthChainID(t) cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }, } err := k.PayGasNativeAndUpdateCctx(ctx, chainID, &cctx, math.NewUint(inputAmount)) @@ -84,7 +85,7 @@ func TestKeeper_PayGasNativeAndUpdateCctx(t *testing.T) { k, ctx, _, _ := testkeeper.CrosschainKeeper(t) cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Gas, + CoinType: coin.CoinType_Gas, }, } err := k.PayGasNativeAndUpdateCctx(ctx, 999999, &cctx, math.NewUint(inputAmount)) @@ -104,11 +105,11 @@ func TestKeeper_PayGasNativeAndUpdateCctx(t *testing.T) { // create a cctx reverted from zeta cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Gas, + CoinType: coin.CoinType_Gas, }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, + ReceiverChainId: chains.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -141,11 +142,11 @@ func TestKeeper_PayGasNativeAndUpdateCctx(t *testing.T) { cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Gas, + CoinType: coin.CoinType_Gas, }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, + ReceiverChainId: chains.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -202,12 +203,12 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { // create a cctx reverted from zeta cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Asset: assetAddress, }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, + ReceiverChainId: chains.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -234,7 +235,7 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { chainID := getValidEthChainID(t) cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Gas, + CoinType: coin.CoinType_Gas, }, } err := k.PayGasInERC20AndUpdateCctx(ctx, chainID, &cctx, math.NewUint(inputAmount), false) @@ -245,7 +246,7 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { k, ctx, _, _ := testkeeper.CrosschainKeeper(t) cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, }, } err := k.PayGasInERC20AndUpdateCctx(ctx, 999999, &cctx, math.NewUint(inputAmount), false) @@ -265,11 +266,11 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { // create a cctx reverted from zeta cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, + ReceiverChainId: chains.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -306,12 +307,12 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { // create a cctx reverted from zeta cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Asset: assetAddress, }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, + ReceiverChainId: chains.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -358,12 +359,12 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { // create a cctx reverted from zeta cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Asset: assetAddress, }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, + ReceiverChainId: chains.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -416,12 +417,12 @@ func TestKeeper_PayGasInERC20AndUpdateCctx(t *testing.T) { // create a cctx reverted from zeta cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Asset: assetAddress, }, OutboundTxParams: []*types.OutboundTxParams{ { - ReceiverChainId: zetacommon.ZetaPrivnetChain().ChainId, + ReceiverChainId: chains.ZetaPrivnetChain().ChainId, }, { ReceiverChainId: chainID, @@ -461,7 +462,7 @@ func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) { // create a cctx reverted from zeta cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }, OutboundTxParams: []*types.OutboundTxParams{ { @@ -487,7 +488,7 @@ func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) { // can call with undefined zeta fees cctx = types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }, OutboundTxParams: []*types.OutboundTxParams{ { @@ -512,7 +513,7 @@ func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) { chainID := getValidEthChainID(t) cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Gas, + CoinType: coin.CoinType_Gas, }, } err := k.PayGasInZetaAndUpdateCctx(ctx, chainID, &cctx, math.NewUint(100000), false) @@ -523,7 +524,7 @@ func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) { k, ctx, _, _ := testkeeper.CrosschainKeeper(t) cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }, } err := k.PayGasInZetaAndUpdateCctx(ctx, 999999, &cctx, math.NewUint(100000), false) @@ -545,7 +546,7 @@ func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) { // create a cctx reverted from zeta cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }, OutboundTxParams: []*types.OutboundTxParams{ { @@ -577,7 +578,7 @@ func TestKeeper_PayGasInZetaAndUpdateCctx(t *testing.T) { // create a cctx reverted from zeta cctx := types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: zetacommon.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }, OutboundTxParams: []*types.OutboundTxParams{ { diff --git a/x/crosschain/keeper/grpc_query_zeta_conversion_rate.go b/x/crosschain/keeper/grpc_query_zeta_conversion_rate.go index 93b86a6e26..5cb26ef831 100644 --- a/x/crosschain/keeper/grpc_query_zeta_conversion_rate.go +++ b/x/crosschain/keeper/grpc_query_zeta_conversion_rate.go @@ -6,7 +6,7 @@ import ( "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/x/crosschain/types" zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" @@ -15,7 +15,7 @@ import ( func (k Keeper) ConvertGasToZeta(context context.Context, request *types.QueryConvertGasToZetaRequest) (*types.QueryConvertGasToZetaResponse, error) { ctx := sdk.UnwrapSDKContext(context) - chain := common.GetChainFromChainID(request.ChainId) + chain := chains.GetChainFromChainID(request.ChainId) if chain == nil { return nil, zetaObserverTypes.ErrSupportedChains diff --git a/x/crosschain/keeper/in_tx_tracker_test.go b/x/crosschain/keeper/in_tx_tracker_test.go index a4bda41192..317f305a82 100644 --- a/x/crosschain/keeper/in_tx_tracker_test.go +++ b/x/crosschain/keeper/in_tx_tracker_test.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/nullify" "github.com/zeta-chain/zetacore/x/crosschain/keeper" @@ -20,7 +20,7 @@ func createNInTxTracker(keeper *keeper.Keeper, ctx sdk.Context, n int, chainID i for i := range items { items[i].TxHash = fmt.Sprintf("TxHash-%d", i) items[i].ChainId = chainID - items[i].CoinType = common.CoinType_Gas + items[i].CoinType = coin.CoinType_Gas keeper.SetInTxTracker(ctx, items[i]) } return items diff --git a/x/crosschain/keeper/msg_server_add_to_intx_tracker.go b/x/crosschain/keeper/msg_server_add_to_intx_tracker.go index fcd58780af..960fa3d2c5 100644 --- a/x/crosschain/keeper/msg_server_add_to_intx_tracker.go +++ b/x/crosschain/keeper/msg_server_add_to_intx_tracker.go @@ -6,7 +6,7 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -32,7 +32,7 @@ func (k msgServer) AddToInTxTracker(goCtx context.Context, msg *types.MsgAddToIn return nil, types.ErrProofVerificationFail.Wrapf(err.Error()) } - if common.IsEVMChain(msg.ChainId) { + if chains.IsEVMChain(msg.ChainId) { err = k.VerifyEVMInTxBody(ctx, msg, txBytes) if err != nil { return nil, types.ErrTxBodyVerificationFail.Wrapf(err.Error()) diff --git a/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go b/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go index 50e8164eb7..a43816db66 100644 --- a/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go +++ b/x/crosschain/keeper/msg_server_add_to_intx_tracker_test.go @@ -6,7 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/proofs" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -18,12 +19,12 @@ import ( func setupVerificationParams(zk keepertest.ZetaKeepers, ctx sdk.Context, tx_index int64, chainID int64, header ethtypes.Header, headerRLP []byte, block *ethtypes.Block) { params := zk.ObserverKeeper.GetParamsIfExists(ctx) zk.ObserverKeeper.SetParams(ctx, params) - zk.ObserverKeeper.SetBlockHeader(ctx, common.BlockHeader{ + zk.ObserverKeeper.SetBlockHeader(ctx, proofs.BlockHeader{ Height: block.Number().Int64(), Hash: block.Hash().Bytes(), ParentHash: header.ParentHash.Bytes(), ChainId: chainID, - Header: common.NewEthereumHeader(headerRLP), + Header: proofs.NewEthereumHeader(headerRLP), }) zk.ObserverKeeper.SetChainParamsList(ctx, observertypes.ChainParamsList{ChainParams: []*observertypes.ChainParams{ { @@ -56,7 +57,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { Creator: sample.AccAddress(), ChainId: chainID, TxHash: tx_hash, - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, Proof: nil, BlockHash: "", TxIndex: 0, @@ -85,7 +86,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { Creator: admin, ChainId: chainID, TxHash: tx_hash, - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, Proof: nil, BlockHash: "", TxIndex: 0, @@ -114,7 +115,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { Creator: admin, ChainId: chainID, TxHash: "Malicious TX HASH", - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, Proof: nil, BlockHash: "", TxIndex: 0, @@ -143,7 +144,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { // Creator: sample.AccAddress(), // ChainId: chainID, // TxHash: tx.Hash().Hex(), - // CoinType: common.CoinType_Zeta, + // CoinType: pkg.CoinType_Zeta, // Proof: proof, // BlockHash: block.Hash().Hex(), // TxIndex: txIndex, @@ -166,7 +167,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { // Creator: sample.AccAddress(), // ChainId: chainID, // TxHash: "fake_hash", - // CoinType: common.CoinType_Zeta, + // CoinType: pkg.CoinType_Zeta, // Proof: proof, // BlockHash: block.Hash().Hex(), // TxIndex: txIndex, @@ -190,7 +191,7 @@ func TestMsgServer_AddToInTxTracker(t *testing.T) { // Creator: sample.AccAddress(), // ChainId: 97, // TxHash: tx.Hash().Hex(), - // CoinType: common.CoinType_Zeta, + // CoinType: pkg.CoinType_Zeta, // Proof: proof, // BlockHash: block.Hash().Hex(), // TxIndex: txIndex, diff --git a/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go b/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go index 518a601965..7f747fbcd7 100644 --- a/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go +++ b/x/crosschain/keeper/msg_server_add_to_outtx_tracker.go @@ -12,7 +12,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" eth "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -116,7 +116,7 @@ func (k msgServer) AddToOutTxTracker(goCtx context.Context, msg *types.MsgAddToO func (k Keeper) VerifyOutTxBody(ctx sdk.Context, msg *types.MsgAddToOutTxTracker, txBytes []byte) error { // get tss address var bitcoinChainID int64 - if common.IsBitcoinChain(msg.ChainId) { + if chains.IsBitcoinChain(msg.ChainId) { bitcoinChainID = msg.ChainId } tss, err := k.zetaObserverKeeper.GetTssAddress(ctx, &observertypes.QueryGetTssAddressRequest{ @@ -127,9 +127,9 @@ func (k Keeper) VerifyOutTxBody(ctx sdk.Context, msg *types.MsgAddToOutTxTracker } // verify message against transaction body - if common.IsEVMChain(msg.ChainId) { + if chains.IsEVMChain(msg.ChainId) { err = VerifyEVMOutTxBody(msg, txBytes, tss.Eth) - } else if common.IsBitcoinChain(msg.ChainId) { + } else if chains.IsBitcoinChain(msg.ChainId) { err = VerifyBTCOutTxBody(msg, txBytes, tss.Btc) } else { return fmt.Errorf("cannot verify outTx body for chain %d", msg.ChainId) @@ -172,7 +172,7 @@ func VerifyEVMOutTxBody(msg *types.MsgAddToOutTxTracker, txBytes []byte, tssEth // VerifyBTCOutTxBody validates the SegWit sender address, nonce and chain id and tx hash // Note: 'msg' may contain fabricated information func VerifyBTCOutTxBody(msg *types.MsgAddToOutTxTracker, txBytes []byte, tssBtc string) error { - if !common.IsBitcoinChain(msg.ChainId) { + if !chains.IsBitcoinChain(msg.ChainId) { return fmt.Errorf("not a Bitcoin chain ID %d", msg.ChainId) } tx, err := btcutil.NewTxFromBytes(txBytes) @@ -187,7 +187,7 @@ func VerifyBTCOutTxBody(msg *types.MsgAddToOutTxTracker, txBytes []byte, tssBtc if err != nil { return fmt.Errorf("failed to parse public key") } - bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(msg.ChainId) + bitcoinNetParams, err := chains.BitcoinNetParamsFromChainID(msg.ChainId) if err != nil { return fmt.Errorf("failed to get Bitcoin net params, error %s", err.Error()) } @@ -205,8 +205,8 @@ func VerifyBTCOutTxBody(msg *types.MsgAddToOutTxTracker, txBytes []byte, tssBtc if len(tx.MsgTx().TxOut) < 1 { return fmt.Errorf("outTx should have at least one output") } - if tx.MsgTx().TxOut[0].Value != common.NonceMarkAmount(msg.Nonce) { - return fmt.Errorf("want nonce mark %d, got %d", tx.MsgTx().TxOut[0].Value, common.NonceMarkAmount(msg.Nonce)) + if tx.MsgTx().TxOut[0].Value != chains.NonceMarkAmount(msg.Nonce) { + return fmt.Errorf("want nonce mark %d, got %d", tx.MsgTx().TxOut[0].Value, chains.NonceMarkAmount(msg.Nonce)) } if tx.MsgTx().TxHash().String() != msg.TxHash { return fmt.Errorf("want tx hash %s, got %s", tx.MsgTx().TxHash(), msg.TxHash) diff --git a/x/crosschain/keeper/msg_server_migrate_tss_funds.go b/x/crosschain/keeper/msg_server_migrate_tss_funds.go index 96db6a964d..fa0c7fb1f4 100644 --- a/x/crosschain/keeper/msg_server_migrate_tss_funds.go +++ b/x/crosschain/keeper/msg_server_migrate_tss_funds.go @@ -12,7 +12,12 @@ import ( "github.com/ethereum/go-ethereum/crypto" tmbytes "github.com/tendermint/tendermint/libs/bytes" tmtypes "github.com/tendermint/tendermint/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/constant" + zetacrypto "github.com/zeta-chain/zetacore/pkg/crypto" + "github.com/zeta-chain/zetacore/pkg/gas" + + "github.com/zeta-chain/zetacore/pkg/coin" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -82,7 +87,7 @@ func (k Keeper) MigrateTSSFundsForChain(ctx sdk.Context, chainID int64, amount s Creator: "", Index: index, ZetaFees: sdkmath.Uint{}, - RelayedMessage: fmt.Sprintf("%s:%s", common.CmdMigrateTssFunds, "Funds Migrator Admin Cmd"), + RelayedMessage: fmt.Sprintf("%s:%s", constant.CmdMigrateTssFunds, "Funds Migrator Admin Cmd"), CctxStatus: &types.Status{ Status: types.CctxStatus_PendingOutbound, StatusMessage: "", @@ -92,7 +97,7 @@ func (k Keeper) MigrateTSSFundsForChain(ctx sdk.Context, chainID int64, amount s Sender: "", SenderChainId: chainID, TxOrigin: "", - CoinType: common.CoinType_Cmd, + CoinType: coin.CoinType_Cmd, Asset: "", Amount: amount, InboundTxObservedHash: tmbytes.HexBytes(tmtypes.Tx(ctx.TxBytes()).Hash()).String(), @@ -103,7 +108,7 @@ func (k Keeper) MigrateTSSFundsForChain(ctx sdk.Context, chainID int64, amount s OutboundTxParams: []*types.OutboundTxParams{{ Receiver: "", ReceiverChainId: chainID, - CoinType: common.CoinType_Cmd, + CoinType: coin.CoinType_Cmd, Amount: amount, OutboundTxTssNonce: 0, OutboundTxGasLimit: 1_000_000, @@ -117,21 +122,21 @@ func (k Keeper) MigrateTSSFundsForChain(ctx sdk.Context, chainID int64, amount s TssPubkey: currentTss.TssPubkey, }}} // Set the sender and receiver addresses for EVM chain - if common.IsEVMChain(chainID) { - ethAddressOld, err := common.GetTssAddrEVM(currentTss.TssPubkey) + if chains.IsEVMChain(chainID) { + ethAddressOld, err := zetacrypto.GetTssAddrEVM(currentTss.TssPubkey) if err != nil { return err } - ethAddressNew, err := common.GetTssAddrEVM(newTss.TssPubkey) + ethAddressNew, err := zetacrypto.GetTssAddrEVM(newTss.TssPubkey) if err != nil { return err } cctx.InboundTxParams.Sender = ethAddressOld.String() cctx.GetCurrentOutTxParam().Receiver = ethAddressNew.String() // Tss migration is a send transaction, so the gas limit is set to 21000 - cctx.GetCurrentOutTxParam().OutboundTxGasLimit = common.EVMSend + cctx.GetCurrentOutTxParam().OutboundTxGasLimit = gas.EVMSend // Multiple current gas price with standard multiplier to add some buffer - multipliedGasPrice, err := common.MultiplyGasPrice(medianGasPrice, types.TssMigrationGasMultiplierEVM) + multipliedGasPrice, err := gas.MultiplyGasPrice(medianGasPrice, types.TssMigrationGasMultiplierEVM) if err != nil { return err } @@ -143,16 +148,16 @@ func (k Keeper) MigrateTSSFundsForChain(ctx sdk.Context, chainID int64, amount s cctx.GetCurrentOutTxParam().Amount = amount.Sub(evmFee) } // Set the sender and receiver addresses for Bitcoin chain - if common.IsBitcoinChain(chainID) { - bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(chainID) + if chains.IsBitcoinChain(chainID) { + bitcoinNetParams, err := chains.BitcoinNetParamsFromChainID(chainID) if err != nil { return err } - btcAddressOld, err := common.GetTssAddrBTC(currentTss.TssPubkey, bitcoinNetParams) + btcAddressOld, err := zetacrypto.GetTssAddrBTC(currentTss.TssPubkey, bitcoinNetParams) if err != nil { return err } - btcAddressNew, err := common.GetTssAddrBTC(newTss.TssPubkey, bitcoinNetParams) + btcAddressNew, err := zetacrypto.GetTssAddrBTC(newTss.TssPubkey, bitcoinNetParams) if err != nil { return err } diff --git a/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go b/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go index 8eadd25049..d4a6c5206e 100644 --- a/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go +++ b/x/crosschain/keeper/msg_server_migrate_tss_funds_test.go @@ -7,7 +7,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/gas" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -20,7 +21,7 @@ func setupTssMigrationParams( zk keepertest.ZetaKeepers, k *keeper.Keeper, ctx sdk.Context, - chain common.Chain, + chain chains.Chain, amount sdkmath.Uint, setNewTss bool, setCurrentTSS bool, @@ -102,7 +103,7 @@ func TestKeeper_MigrateTSSFundsForChain(t *testing.T) { index := hash.Hex() cctx, found := k.GetCrossChainTx(ctx, index) require.True(t, found) - multipliedValue, err := common.MultiplyGasPrice(gp, crosschaintypes.TssMigrationGasMultiplierEVM) + multipliedValue, err := gas.MultiplyGasPrice(gp, crosschaintypes.TssMigrationGasMultiplierEVM) require.NoError(t, err) require.Equal(t, multipliedValue.String(), cctx.GetCurrentOutTxParam().OutboundTxGasPrice) diff --git a/x/crosschain/keeper/msg_server_refund_aborted_tx.go b/x/crosschain/keeper/msg_server_refund_aborted_tx.go index fc651ec249..2d08296630 100644 --- a/x/crosschain/keeper/msg_server_refund_aborted_tx.go +++ b/x/crosschain/keeper/msg_server_refund_aborted_tx.go @@ -6,7 +6,7 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -43,7 +43,7 @@ func (k msgServer) RefundAbortedCCTX(goCtx context.Context, msg *types.MsgRefund } // Check if aborted amount is available to maintain zeta accounting - if cctx.InboundTxParams.CoinType == common.CoinType_Zeta { + if cctx.InboundTxParams.CoinType == coin.CoinType_Zeta { err := k.RemoveZetaAbortedAmount(ctx, GetAbortedAmount(cctx)) // if the zeta accounting is not found, it means the zeta accounting is not set yet and the refund should not be processed if errors.Is(err, types.ErrUnableToFindZetaAccounting) { diff --git a/x/crosschain/keeper/msg_server_refund_aborted_tx_test.go b/x/crosschain/keeper/msg_server_refund_aborted_tx_test.go index 1c6f7da680..5defcd882a 100644 --- a/x/crosschain/keeper/msg_server_refund_aborted_tx_test.go +++ b/x/crosschain/keeper/msg_server_refund_aborted_tx_test.go @@ -7,7 +7,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -55,7 +55,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Gas + cctx.InboundTxParams.CoinType = coin.CoinType_Gas k.SetCrossChainTx(ctx, *cctx) deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) zrc20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, cctx.InboundTxParams.SenderChainId, "foobar", "foobar") @@ -94,7 +94,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Zeta + cctx.InboundTxParams.CoinType = coin.CoinType_Zeta k.SetCrossChainTx(ctx, *cctx) k.SetZetaAccounting(ctx, crosschaintypes.ZetaAccounting{AbortedZetaAmount: cctx.GetCurrentOutTxParam().Amount}) deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) @@ -133,7 +133,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Zeta + cctx.InboundTxParams.CoinType = coin.CoinType_Zeta cctx.OutboundTxParams = nil k.SetCrossChainTx(ctx, *cctx) k.SetZetaAccounting(ctx, crosschaintypes.ZetaAccounting{AbortedZetaAmount: cctx.GetCurrentOutTxParam().Amount}) @@ -173,7 +173,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Zeta + cctx.InboundTxParams.CoinType = coin.CoinType_Zeta k.SetCrossChainTx(ctx, *cctx) k.SetZetaAccounting(ctx, crosschaintypes.ZetaAccounting{AbortedZetaAmount: cctx.InboundTxParams.Amount}) deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) @@ -212,7 +212,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.Status = crosschaintypes.CctxStatus_Aborted cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_ERC20 + cctx.InboundTxParams.CoinType = coin.CoinType_ERC20 cctx.InboundTxParams.Asset = asset k.SetCrossChainTx(ctx, *cctx) // deploy zrc20 @@ -262,7 +262,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Gas + cctx.InboundTxParams.CoinType = coin.CoinType_Gas k.SetCrossChainTx(ctx, *cctx) deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) zrc20 := setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, cctx.InboundTxParams.SenderChainId, "foobar", "foobar") @@ -301,7 +301,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Zeta + cctx.InboundTxParams.CoinType = coin.CoinType_Zeta k.SetCrossChainTx(ctx, *cctx) k.SetZetaAccounting(ctx, crosschaintypes.ZetaAccounting{AbortedZetaAmount: cctx.InboundTxParams.Amount}) deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) @@ -332,7 +332,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Zeta + cctx.InboundTxParams.CoinType = coin.CoinType_Zeta k.SetCrossChainTx(ctx, *cctx) k.SetZetaAccounting(ctx, crosschaintypes.ZetaAccounting{AbortedZetaAmount: cctx.InboundTxParams.Amount}) deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) @@ -363,7 +363,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Gas + cctx.InboundTxParams.CoinType = coin.CoinType_Gas k.SetCrossChainTx(ctx, *cctx) deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) @@ -396,7 +396,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Gas + cctx.InboundTxParams.CoinType = coin.CoinType_Gas deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) _, err := msgServer.RefundAbortedCCTX(ctx, &crosschaintypes.MsgRefundAbortedCCTX{ @@ -425,7 +425,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Gas + cctx.InboundTxParams.CoinType = coin.CoinType_Gas k.SetCrossChainTx(ctx, *cctx) deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) _ = setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, cctx.InboundTxParams.SenderChainId, "foobar", "foobar") @@ -456,7 +456,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Zeta + cctx.InboundTxParams.CoinType = coin.CoinType_Zeta k.SetCrossChainTx(ctx, *cctx) deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) @@ -486,7 +486,7 @@ func TestMsgServer_RefundAbortedCCTX(t *testing.T) { cctx.CctxStatus.IsAbortRefunded = false cctx.InboundTxParams.TxOrigin = cctx.InboundTxParams.Sender cctx.InboundTxParams.SenderChainId = chainID - cctx.InboundTxParams.CoinType = common.CoinType_Gas + cctx.InboundTxParams.CoinType = coin.CoinType_Gas k.SetCrossChainTx(ctx, *cctx) deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) _ = setupGasCoin(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper, cctx.InboundTxParams.SenderChainId, "foobar", "foobar") diff --git a/x/crosschain/keeper/msg_server_tss_voter.go b/x/crosschain/keeper/msg_server_tss_voter.go index 29672a1a6d..a3782729b1 100644 --- a/x/crosschain/keeper/msg_server_tss_voter.go +++ b/x/crosschain/keeper/msg_server_tss_voter.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" math2 "github.com/ethereum/go-ethereum/common/math" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/x/observer/keeper" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -65,12 +65,12 @@ func (k msgServer) CreateTSSVoter(goCtx context.Context, msg *types.MsgCreateTSS k.zetaObserverKeeper.AddBallotToList(ctx, ballot) } var err error - if msg.Status == common.ReceiveStatus_Success { + if msg.Status == chains.ReceiveStatus_Success { ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observertypes.VoteType_SuccessObservation) if err != nil { return &types.MsgCreateTSSVoterResponse{}, err } - } else if msg.Status == common.ReceiveStatus_Failed { + } else if msg.Status == chains.ReceiveStatus_Failed { ballot, err = k.zetaObserverKeeper.AddVoteToBallot(ctx, ballot, msg.Creator, observertypes.VoteType_FailureObservation) if err != nil { return &types.MsgCreateTSSVoterResponse{}, err diff --git a/x/crosschain/keeper/msg_server_vote_inbound_tx.go b/x/crosschain/keeper/msg_server_vote_inbound_tx.go index db287e6b82..4fee3a2c9d 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx.go @@ -6,7 +6,7 @@ import ( cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -121,7 +121,7 @@ func (k msgServer) VoteOnObservedInboundTx(goCtx context.Context, msg *types.Msg // FinalizeInbound updates CCTX Prices and Nonce // Aborts is any of the updates fail - if common.IsZetaChain(msg.ReceiverChain) { + if chains.IsZetaChain(msg.ReceiverChain) { tmpCtx, commit := ctx.CacheContext() isContractReverted, err := k.HandleEVMDeposit(tmpCtx, &cctx, *msg, msg.SenderChainId) diff --git a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go index 803de84576..fa51c66bfa 100644 --- a/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go +++ b/x/crosschain/keeper/msg_server_vote_inbound_tx_test.go @@ -7,7 +7,7 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/keeper" @@ -42,12 +42,12 @@ func TestKeeper_VoteOnObservedInboundTx(t *testing.T) { msgServer := keeper.NewMsgServerImpl(*k) validatorList := setObservers(t, k, ctx, zk) to, from := int64(1337), int64(101) - chains := zk.ObserverKeeper.GetSupportedChains(ctx) - for _, chain := range chains { - if common.IsEVMChain(chain.ChainId) { + supportedChains := zk.ObserverKeeper.GetSupportedChains(ctx) + for _, chain := range supportedChains { + if chains.IsEVMChain(chain.ChainId) { from = chain.ChainId } - if common.IsZetaChain(chain.ChainId) { + if chains.IsZetaChain(chain.ChainId) { to = chain.ChainId } } diff --git a/x/crosschain/keeper/msg_server_vote_outbound_tx.go b/x/crosschain/keeper/msg_server_vote_outbound_tx.go index 5c36a2abf9..9286f0865a 100644 --- a/x/crosschain/keeper/msg_server_vote_outbound_tx.go +++ b/x/crosschain/keeper/msg_server_vote_outbound_tx.go @@ -12,7 +12,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/rs/zerolog/log" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" observerkeeper "github.com/zeta-chain/zetacore/x/observer/keeper" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -142,7 +143,7 @@ func (k msgServer) VoteOnObservedOutboundTx(goCtx context.Context, msg *types.Ms newStatus := cctx.CctxStatus.Status.String() EmitOutboundSuccess(tmpCtx, msg, oldStatus.String(), newStatus, cctx) case observertypes.BallotStatus_BallotFinalized_FailureObservation: - if msg.CoinType == common.CoinType_Cmd || common.IsZetaChain(cctx.InboundTxParams.SenderChainId) { + if msg.CoinType == coin.CoinType_Cmd || chains.IsZetaChain(cctx.InboundTxParams.SenderChainId) { // if the cctx is of coin type cmd or the sender chain is zeta chain, then we do not revert, the cctx is aborted cctx.CctxStatus.ChangeStatus(types.CctxStatus_Aborted, "") } else { diff --git a/x/crosschain/keeper/msg_server_whitelist_erc20.go b/x/crosschain/keeper/msg_server_whitelist_erc20.go index e269f2312a..e1b4dc705d 100644 --- a/x/crosschain/keeper/msg_server_whitelist_erc20.go +++ b/x/crosschain/keeper/msg_server_whitelist_erc20.go @@ -5,6 +5,8 @@ import ( "fmt" "math/big" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/constant" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" errorsmod "cosmossdk.io/errors" @@ -15,7 +17,6 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" ) @@ -72,7 +73,7 @@ func (k msgServer) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelist // #nosec G701 always in range uint8(msg.Decimals), chain.ChainId, - common.CoinType_ERC20, + coin.CoinType_ERC20, msg.Erc20Address, big.NewInt(msg.GasLimit), ) @@ -115,7 +116,7 @@ func (k msgServer) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelist Creator: msg.Creator, Index: index, ZetaFees: sdk.NewUint(0), - RelayedMessage: fmt.Sprintf("%s:%s", common.CmdWhitelistERC20, msg.Erc20Address), + RelayedMessage: fmt.Sprintf("%s:%s", constant.CmdWhitelistERC20, msg.Erc20Address), CctxStatus: &types.Status{ Status: types.CctxStatus_PendingOutbound, StatusMessage: "", @@ -125,7 +126,7 @@ func (k msgServer) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelist Sender: "", SenderChainId: 0, TxOrigin: "", - CoinType: common.CoinType_Cmd, + CoinType: coin.CoinType_Cmd, Asset: "", Amount: math.Uint{}, InboundTxObservedHash: hash.String(), // all Upper case Cosmos TX HEX, with no 0x prefix @@ -137,7 +138,7 @@ func (k msgServer) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelist { Receiver: param.Erc20CustodyContractAddress, ReceiverChainId: msg.ChainId, - CoinType: common.CoinType_Cmd, + CoinType: coin.CoinType_Cmd, Amount: math.NewUint(0), OutboundTxTssNonce: 0, OutboundTxGasLimit: 100_000, @@ -162,7 +163,7 @@ func (k msgServer) WhitelistERC20(goCtx context.Context, msg *types.MsgWhitelist Decimals: msg.Decimals, Name: msg.Name, Symbol: msg.Symbol, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, // #nosec G701 always positive GasLimit: uint64(msg.GasLimit), } diff --git a/x/crosschain/keeper/msg_server_whitelist_erc20_test.go b/x/crosschain/keeper/msg_server_whitelist_erc20_test.go index 7f13a25611..66a1bcb0e9 100644 --- a/x/crosschain/keeper/msg_server_whitelist_erc20_test.go +++ b/x/crosschain/keeper/msg_server_whitelist_erc20_test.go @@ -9,7 +9,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/constant" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" crosschainkeeper "github.com/zeta-chain/zetacore/x/crosschain/keeper" @@ -65,7 +65,7 @@ func TestKeeper_WhitelistERC20(t *testing.T) { require.EqualValues(t, erc20Address, fc.Asset) cctx, found := k.GetCrossChainTx(ctx, cctxIndex) require.True(t, found) - require.EqualValues(t, fmt.Sprintf("%s:%s", common.CmdWhitelistERC20, erc20Address), cctx.RelayedMessage) + require.EqualValues(t, fmt.Sprintf("%s:%s", constant.CmdWhitelistERC20, erc20Address), cctx.RelayedMessage) // check gas limit is set gasLimit, err := zk.FungibleKeeper.QueryGasLimit(ctx, ethcommon.HexToAddress(zrc20)) diff --git a/x/crosschain/keeper/refund.go b/x/crosschain/keeper/refund.go index 9d10b7ce13..1781264c1c 100644 --- a/x/crosschain/keeper/refund.go +++ b/x/crosschain/keeper/refund.go @@ -7,18 +7,19 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" ) func (k Keeper) RefundAbortedAmountOnZetaChain(ctx sdk.Context, cctx types.CrossChainTx, refundAddress ethcommon.Address) error { coinType := cctx.InboundTxParams.CoinType switch coinType { - case common.CoinType_Gas: + case coin.CoinType_Gas: return k.RefundAmountOnZetaChainGas(ctx, cctx, refundAddress) - case common.CoinType_Zeta: + case coin.CoinType_Zeta: return k.RefundAmountOnZetaChainZeta(ctx, cctx, refundAddress) - case common.CoinType_ERC20: + case coin.CoinType_ERC20: return k.RefundAmountOnZetaChainERC20(ctx, cctx, refundAddress) default: return errors.New("unsupported coin type for refund on ZetaChain") @@ -56,7 +57,7 @@ func (k Keeper) RefundAmountOnZetaChainZeta(ctx sdk.Context, cctx types.CrossCha refundAmount := GetAbortedAmount(cctx) chainID := cctx.InboundTxParams.SenderChainId // check if chain is an EVM chain - if !common.IsEVMChain(chainID) { + if !chains.IsEVMChain(chainID) { return errors.New("only EVM chains are supported for refund when coin type is Zeta") } if cctx.InboundTxParams.Amount.IsNil() || cctx.InboundTxParams.Amount.IsZero() { @@ -75,10 +76,10 @@ func (k Keeper) RefundAmountOnZetaChainZeta(ctx sdk.Context, cctx types.CrossCha func (k Keeper) RefundAmountOnZetaChainERC20(ctx sdk.Context, cctx types.CrossChainTx, refundAddress ethcommon.Address) error { refundAmount := GetAbortedAmount(cctx) // preliminary checks - if cctx.InboundTxParams.CoinType != common.CoinType_ERC20 { + if cctx.InboundTxParams.CoinType != coin.CoinType_ERC20 { return errors.New("unsupported coin type for refund on ZetaChain") } - if !common.IsEVMChain(cctx.InboundTxParams.SenderChainId) { + if !chains.IsEVMChain(cctx.InboundTxParams.SenderChainId) { return errors.New("only EVM chains are supported for refund on ZetaChain") } diff --git a/x/crosschain/keeper/refund_test.go b/x/crosschain/keeper/refund_test.go index e9ecfd346f..933359008f 100644 --- a/x/crosschain/keeper/refund_test.go +++ b/x/crosschain/keeper/refund_test.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -26,7 +26,7 @@ func TestKeeper_RefundAmountOnZetaChainGas(t *testing.T) { err := k.RefundAmountOnZetaChainGas(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, SenderChainId: chainID, Sender: sender.String(), TxOrigin: sender.String(), @@ -53,7 +53,7 @@ func TestKeeper_RefundAmountOnZetaChainGas(t *testing.T) { err := k.RefundAmountOnZetaChainGas(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, SenderChainId: chainID, Sender: sender.String(), TxOrigin: sender.String(), @@ -75,7 +75,7 @@ func TestKeeper_RefundAmountOnZetaChainGas(t *testing.T) { deploySystemContracts(t, ctx, zk.FungibleKeeper, sdkk.EvmKeeper) err := k.RefundAmountOnZetaChainGas(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, SenderChainId: chainID, Sender: sender.String(), TxOrigin: sender.String(), @@ -100,7 +100,7 @@ func TestKeeper_RefundAmountOnZetaChainGas(t *testing.T) { err := k.RefundAmountOnZetaChainGas(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, SenderChainId: chainID, Sender: sender.String(), TxOrigin: sender.String(), @@ -126,7 +126,7 @@ func TestKeeper_RefundAmountOnZetaChainZeta(t *testing.T) { err := k.RefundAmountOnZetaChainZeta(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, SenderChainId: chainID, Sender: sender.String(), TxOrigin: sender.String(), @@ -151,7 +151,7 @@ func TestKeeper_RefundAmountOnZetaChainZeta(t *testing.T) { err := k.RefundAmountOnZetaChainZeta(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, SenderChainId: chainID, Sender: sender.String(), TxOrigin: sender.String(), @@ -172,7 +172,7 @@ func TestKeeper_RefundAmountOnZetaChainZeta(t *testing.T) { err := k.RefundAmountOnZetaChainZeta(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, SenderChainId: chainID, Sender: sender.String(), TxOrigin: sender.String(), @@ -211,7 +211,7 @@ func TestKeeper_RefundAmountOnZetaChainERC20(t *testing.T) { err := k.RefundAmountOnZetaChainERC20(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, SenderChainId: chainID, Sender: sender.String(), Asset: asset, @@ -233,7 +233,7 @@ func TestKeeper_RefundAmountOnZetaChainERC20(t *testing.T) { // can refund again err = k.RefundAmountOnZetaChainERC20(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, SenderChainId: chainID, Sender: sender.String(), Asset: asset, @@ -252,7 +252,7 @@ func TestKeeper_RefundAmountOnZetaChainERC20(t *testing.T) { err := k.RefundAmountOnZetaChainERC20(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, Amount: math.NewUint(42), }}, sample.EthAddress(), @@ -261,7 +261,7 @@ func TestKeeper_RefundAmountOnZetaChainERC20(t *testing.T) { err = k.RefundAmountOnZetaChainERC20(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, }}, sample.EthAddress(), ) @@ -269,7 +269,7 @@ func TestKeeper_RefundAmountOnZetaChainERC20(t *testing.T) { err = k.RefundAmountOnZetaChainERC20(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, SenderChainId: 999999, Amount: math.NewUint(42), }}, @@ -279,7 +279,7 @@ func TestKeeper_RefundAmountOnZetaChainERC20(t *testing.T) { err = k.RefundAmountOnZetaChainERC20(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, SenderChainId: getValidEthChainID(t), Sender: sample.EthAddress().String(), Amount: math.Uint{}, @@ -290,7 +290,7 @@ func TestKeeper_RefundAmountOnZetaChainERC20(t *testing.T) { err = k.RefundAmountOnZetaChainERC20(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, SenderChainId: getValidEthChainID(t), Sender: sample.EthAddress().String(), Amount: math.ZeroUint(), @@ -302,7 +302,7 @@ func TestKeeper_RefundAmountOnZetaChainERC20(t *testing.T) { // the foreign coin has not been set err = k.RefundAmountOnZetaChainERC20(ctx, types.CrossChainTx{ InboundTxParams: &types.InboundTxParams{ - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, SenderChainId: getValidEthChainID(t), Sender: sample.EthAddress().String(), Asset: sample.EthAddress().String(), diff --git a/x/crosschain/keeper/utils_test.go b/x/crosschain/keeper/utils_test.go index 141cfd3e00..732ec5d0bd 100644 --- a/x/crosschain/keeper/utils_test.go +++ b/x/crosschain/keeper/utils_test.go @@ -5,6 +5,7 @@ import ( "math/big" "testing" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -15,7 +16,6 @@ import ( "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - zetacommon "github.com/zeta-chain/zetacore/common" testkeeper "github.com/zeta-chain/zetacore/testutil/keeper" fungiblekeeper "github.com/zeta-chain/zetacore/x/fungible/keeper" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -27,13 +27,13 @@ func getValidEthChainID(t *testing.T) int64 { } // getValidEthChain get a valid eth chain -func getValidEthChain(_ *testing.T) *zetacommon.Chain { - goerli := zetacommon.GoerliLocalnetChain() +func getValidEthChain(_ *testing.T) *chains.Chain { + goerli := chains.GoerliLocalnetChain() return &goerli } -func getValidBTCChain() *zetacommon.Chain { - btcRegNet := zetacommon.BtcRegtestChain() +func getValidBTCChain() *chains.Chain { + btcRegNet := chains.BtcRegtestChain() return &btcRegNet } @@ -45,9 +45,9 @@ func getValidBtcChainID() int64 { func getValidEthChainIDWithIndex(t *testing.T, index int) int64 { switch index { case 0: - return zetacommon.GoerliLocalnetChain().ChainId + return chains.GoerliLocalnetChain().ChainId case 1: - return zetacommon.GoerliChain().ChainId + return chains.GoerliChain().ChainId default: require.Fail(t, "invalid index") } diff --git a/x/crosschain/keeper/verify_proof.go b/x/crosschain/keeper/verify_proof.go index a2d6464855..5c58c98b10 100644 --- a/x/crosschain/keeper/verify_proof.go +++ b/x/crosschain/keeper/verify_proof.go @@ -7,12 +7,14 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" eth "github.com/ethereum/go-ethereum/common" ethtypes "github.com/ethereum/go-ethereum/core/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/proofs" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) -func (k Keeper) VerifyProof(ctx sdk.Context, proof *common.Proof, chainID int64, blockHash string, txIndex int64) ([]byte, error) { +func (k Keeper) VerifyProof(ctx sdk.Context, proof *proofs.Proof, chainID int64, blockHash string, txIndex int64) ([]byte, error) { // header-based merkle proof verification must be enabled crosschainFlags, found := k.zetaObserverKeeper.GetCrosschainFlags(ctx) if !found { @@ -21,15 +23,15 @@ func (k Keeper) VerifyProof(ctx sdk.Context, proof *common.Proof, chainID int64, if crosschainFlags.BlockHeaderVerificationFlags == nil { return nil, fmt.Errorf("block header verification flags not found") } - if common.IsBitcoinChain(chainID) && !crosschainFlags.BlockHeaderVerificationFlags.IsBtcTypeChainEnabled { + if chains.IsBitcoinChain(chainID) && !crosschainFlags.BlockHeaderVerificationFlags.IsBtcTypeChainEnabled { return nil, fmt.Errorf("proof verification not enabled for bitcoin chain") } - if common.IsEVMChain(chainID) && !crosschainFlags.BlockHeaderVerificationFlags.IsEthTypeChainEnabled { + if chains.IsEVMChain(chainID) && !crosschainFlags.BlockHeaderVerificationFlags.IsEthTypeChainEnabled { return nil, fmt.Errorf("proof verification not enabled for evm chain") } // chain must support header-based merkle proof verification - senderChain := common.GetChainFromChainID(chainID) + senderChain := chains.GetChainFromChainID(chainID) if senderChain == nil { return nil, types.ErrUnsupportedChain } @@ -38,7 +40,7 @@ func (k Keeper) VerifyProof(ctx sdk.Context, proof *common.Proof, chainID int64, } // get block header from the store - hashBytes, err := common.StringToHash(chainID, blockHash) + hashBytes, err := chains.StringToHash(chainID, blockHash) if err != nil { return nil, fmt.Errorf("block hash %s conversion failed %s", blockHash, err) } @@ -68,7 +70,7 @@ func (k Keeper) VerifyEVMInTxBody(ctx sdk.Context, msg *types.MsgAddToInTxTracke return fmt.Errorf("want evm chain id %d, got %d", txx.ChainId(), msg.ChainId) } switch msg.CoinType { - case common.CoinType_Zeta: + case coin.CoinType_Zeta: chainParams, found := k.zetaObserverKeeper.GetChainParamsByChainID(ctx, msg.ChainId) if !found { return types.ErrUnsupportedChain.Wrapf("chain params not found for chain %d", msg.ChainId) @@ -77,7 +79,7 @@ func (k Keeper) VerifyEVMInTxBody(ctx sdk.Context, msg *types.MsgAddToInTxTracke return fmt.Errorf("receiver is not connector contract for coin type %s", msg.CoinType) } return nil - case common.CoinType_ERC20: + case coin.CoinType_ERC20: chainParams, found := k.zetaObserverKeeper.GetChainParamsByChainID(ctx, msg.ChainId) if !found { return types.ErrUnsupportedChain.Wrapf("chain params not found for chain %d", msg.ChainId) @@ -86,7 +88,7 @@ func (k Keeper) VerifyEVMInTxBody(ctx sdk.Context, msg *types.MsgAddToInTxTracke return fmt.Errorf("receiver is not erc20Custory contract for coin type %s", msg.CoinType) } return nil - case common.CoinType_Gas: + case coin.CoinType_Gas: tss, err := k.zetaObserverKeeper.GetTssAddress(ctx, &observertypes.QueryGetTssAddressRequest{ BitcoinChainId: msg.ChainId, }) diff --git a/x/crosschain/migrations/v4/migrate.go b/x/crosschain/migrations/v4/migrate.go index e4b368e44c..da289e062e 100644 --- a/x/crosschain/migrations/v4/migrate.go +++ b/x/crosschain/migrations/v4/migrate.go @@ -8,7 +8,8 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -54,7 +55,7 @@ func SetZetaAccounting( for ; iterator.Valid(); iterator.Next() { var val types.CrossChainTx cdc.MustUnmarshal(iterator.Value(), &val) - if val.CctxStatus.Status == types.CctxStatus_Aborted && val.GetCurrentOutTxParam().CoinType == common.CoinType_Zeta { + if val.CctxStatus.Status == types.CctxStatus_Aborted && val.GetCurrentOutTxParam().CoinType == coin.CoinType_Zeta { abortedAmountZeta = abortedAmountZeta.Add(val.GetCurrentOutTxParam().Amount) } } @@ -176,7 +177,7 @@ func SetBitcoinFinalizedInbound(ctx sdk.Context, crosschainKeeper crosschainKeep for _, cctx := range crosschainKeeper.GetAllCrossChainTx(ctx) { if cctx.InboundTxParams != nil { // check if bitcoin inbound - if common.IsBitcoinChain(cctx.InboundTxParams.SenderChainId) { + if chains.IsBitcoinChain(cctx.InboundTxParams.SenderChainId) { // add finalized inbound crosschainKeeper.AddFinalizedInbound( ctx, diff --git a/x/crosschain/migrations/v4/migrate_test.go b/x/crosschain/migrations/v4/migrate_test.go index d377f1a6fa..c4c68d93a5 100644 --- a/x/crosschain/migrations/v4/migrate_test.go +++ b/x/crosschain/migrations/v4/migrate_test.go @@ -10,7 +10,8 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/keeper" @@ -96,49 +97,49 @@ func TestSetBitcoinFinalizedInbound(t *testing.T) { k.SetCrossChainTx(ctx, types.CrossChainTx{ Index: "0", InboundTxParams: &types.InboundTxParams{ - SenderChainId: common.GoerliChain().ChainId, + SenderChainId: chains.GoerliChain().ChainId, InboundTxObservedHash: "0xaaa", }, }) k.SetCrossChainTx(ctx, types.CrossChainTx{ Index: "1", InboundTxParams: &types.InboundTxParams{ - SenderChainId: common.BtcMainnetChain().ChainId, + SenderChainId: chains.BtcMainnetChain().ChainId, InboundTxObservedHash: "0x111", }, }) k.SetCrossChainTx(ctx, types.CrossChainTx{ Index: "2", InboundTxParams: &types.InboundTxParams{ - SenderChainId: common.EthChain().ChainId, + SenderChainId: chains.EthChain().ChainId, InboundTxObservedHash: "0xbbb", }, }) k.SetCrossChainTx(ctx, types.CrossChainTx{ Index: "3", InboundTxParams: &types.InboundTxParams{ - SenderChainId: common.BtcTestNetChain().ChainId, + SenderChainId: chains.BtcTestNetChain().ChainId, InboundTxObservedHash: "0x222", }, }) k.SetCrossChainTx(ctx, types.CrossChainTx{ Index: "4", InboundTxParams: &types.InboundTxParams{ - SenderChainId: common.BtcTestNetChain().ChainId, + SenderChainId: chains.BtcTestNetChain().ChainId, InboundTxObservedHash: "0x333", }, }) k.SetCrossChainTx(ctx, types.CrossChainTx{ Index: "5", InboundTxParams: &types.InboundTxParams{ - SenderChainId: common.MumbaiChain().ChainId, + SenderChainId: chains.MumbaiChain().ChainId, InboundTxObservedHash: "0xccc", }, }) k.SetCrossChainTx(ctx, types.CrossChainTx{ Index: "6", InboundTxParams: &types.InboundTxParams{ - SenderChainId: common.BtcRegtestChain().ChainId, + SenderChainId: chains.BtcRegtestChain().ChainId, InboundTxObservedHash: "0x444", }, }) @@ -147,13 +148,13 @@ func TestSetBitcoinFinalizedInbound(t *testing.T) { v4.SetBitcoinFinalizedInbound(ctx, k) // check finalized inbound - require.False(t, k.IsFinalizedInbound(ctx, "0xaaa", common.GoerliChain().ChainId, 0)) - require.False(t, k.IsFinalizedInbound(ctx, "0xbbb", common.EthChain().ChainId, 0)) - require.False(t, k.IsFinalizedInbound(ctx, "0xccc", common.MumbaiChain().ChainId, 0)) - require.True(t, k.IsFinalizedInbound(ctx, "0x111", common.BtcMainnetChain().ChainId, 0)) - require.True(t, k.IsFinalizedInbound(ctx, "0x222", common.BtcTestNetChain().ChainId, 0)) - require.True(t, k.IsFinalizedInbound(ctx, "0x333", common.BtcTestNetChain().ChainId, 0)) - require.True(t, k.IsFinalizedInbound(ctx, "0x444", common.BtcRegtestChain().ChainId, 0)) + require.False(t, k.IsFinalizedInbound(ctx, "0xaaa", chains.GoerliChain().ChainId, 0)) + require.False(t, k.IsFinalizedInbound(ctx, "0xbbb", chains.EthChain().ChainId, 0)) + require.False(t, k.IsFinalizedInbound(ctx, "0xccc", chains.MumbaiChain().ChainId, 0)) + require.True(t, k.IsFinalizedInbound(ctx, "0x111", chains.BtcMainnetChain().ChainId, 0)) + require.True(t, k.IsFinalizedInbound(ctx, "0x222", chains.BtcTestNetChain().ChainId, 0)) + require.True(t, k.IsFinalizedInbound(ctx, "0x333", chains.BtcTestNetChain().ChainId, 0)) + require.True(t, k.IsFinalizedInbound(ctx, "0x444", chains.BtcRegtestChain().ChainId, 0)) }) } @@ -170,7 +171,7 @@ func SetRandomCctx(ctx sdk.Context, k keeper.Keeper) sdkmath.Uint { CctxStatus: &types.Status{Status: types.CctxStatus_Aborted}, OutboundTxParams: []*types.OutboundTxParams{{ Amount: amount, - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }}, }) totalZeta = totalZeta.Add(amount) diff --git a/x/crosschain/migrations/v5/migrate.go b/x/crosschain/migrations/v5/migrate.go index 27ceba92cc..98fee02256 100644 --- a/x/crosschain/migrations/v5/migrate.go +++ b/x/crosschain/migrations/v5/migrate.go @@ -7,7 +7,8 @@ import ( "github.com/cosmos/cosmos-sdk/codec" storetypes "github.com/cosmos/cosmos-sdk/store/types" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -69,17 +70,17 @@ func ResetTestnetNonce( } type TestnetNonce struct { - chain common.Chain + chain chains.Chain nonceHigh uint64 nonceLow uint64 } func CurrentTestnetChains() []TestnetNonce { return []TestnetNonce{ - {chain: common.GoerliChain(), nonceHigh: 226841, nonceLow: 226841}, - {chain: common.MumbaiChain(), nonceHigh: 200599, nonceLow: 200599}, - {chain: common.BscTestnetChain(), nonceHigh: 110454, nonceLow: 110454}, - {chain: common.BtcTestNetChain(), nonceHigh: 4881, nonceLow: 4881}, + {chain: chains.GoerliChain(), nonceHigh: 226841, nonceLow: 226841}, + {chain: chains.MumbaiChain(), nonceHigh: 200599, nonceLow: 200599}, + {chain: chains.BscTestnetChain(), nonceHigh: 110454, nonceLow: 110454}, + {chain: chains.BtcTestNetChain(), nonceHigh: 4881, nonceLow: 4881}, } } @@ -94,7 +95,7 @@ func SetZetaAccounting( if cctx.CctxStatus.Status == types.CctxStatus_Aborted { switch cctx.InboundTxParams.CoinType { - case common.CoinType_ERC20: + case coin.CoinType_ERC20: { receiverChain := observerKeeper.GetSupportedChainFromChainID(ctx, cctx.GetCurrentOutTxParam().ReceiverChainId) if receiverChain == nil { @@ -110,7 +111,7 @@ func SetZetaAccounting( cctx.CctxStatus.IsAbortRefunded = false } } - case common.CoinType_Zeta: + case coin.CoinType_Zeta: { // add the required amount into the zeta accounting. // GetAbortedAmount replaces using Outbound Amount directly, to make sure we refund the amount deposited by the user if the outbound is never created and the cctx is aborted. @@ -120,7 +121,7 @@ func SetZetaAccounting( cctx.CctxStatus.IsAbortRefunded = false } - case common.CoinType_Gas: + case coin.CoinType_Gas: { // CointType gas can be processed as normal and we can issue the refund using the admin refund tx . cctx.CctxStatus.IsAbortRefunded = false diff --git a/x/crosschain/migrations/v5/migrate_test.go b/x/crosschain/migrations/v5/migrate_test.go index 62169c0431..3e9e535fda 100644 --- a/x/crosschain/migrations/v5/migrate_test.go +++ b/x/crosschain/migrations/v5/migrate_test.go @@ -7,7 +7,8 @@ import ( "cosmossdk.io/math" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" crosschainkeeper "github.com/zeta-chain/zetacore/x/crosschain/keeper" @@ -24,7 +25,7 @@ func TestMigrateStore(t *testing.T) { v4ZetaAccountingAmount := math.ZeroUint() for _, cctx := range cctxList { k.SetCrossChainTx(ctx, cctx) - if cctx.CctxStatus.Status != crosschaintypes.CctxStatus_Aborted || cctx.GetCurrentOutTxParam().CoinType != common.CoinType_Zeta { + if cctx.CctxStatus.Status != crosschaintypes.CctxStatus_Aborted || cctx.GetCurrentOutTxParam().CoinType != coin.CoinType_Zeta { continue } v5ZetaAccountingAmount = v5ZetaAccountingAmount.Add(crosschainkeeper.GetAbortedAmount(cctx)) @@ -45,7 +46,7 @@ func TestMigrateStore(t *testing.T) { // Check refund status of the cctx for _, cctx := range cctxListUpdated { switch cctx.InboundTxParams.CoinType { - case common.CoinType_ERC20: + case coin.CoinType_ERC20: receiverChain := zk.ObserverKeeper.GetSupportedChainFromChainID(ctx, cctx.GetCurrentOutTxParam().ReceiverChainId) require.NotNil(t, receiverChain) if receiverChain.IsZetaChain() { @@ -53,9 +54,9 @@ func TestMigrateStore(t *testing.T) { } else { require.False(t, cctx.CctxStatus.IsAbortRefunded) } - case common.CoinType_Zeta: + case coin.CoinType_Zeta: require.False(t, cctx.CctxStatus.IsAbortRefunded) - case common.CoinType_Gas: + case coin.CoinType_Gas: require.False(t, cctx.CctxStatus.IsAbortRefunded) } } @@ -66,8 +67,8 @@ func TestMigrateStore(t *testing.T) { func TestResetTestnetNonce(t *testing.T) { t.Run("reset only testnet nonce without changing mainnet chains", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) - testnetChains := []common.Chain{common.GoerliChain(), common.MumbaiChain(), common.BscTestnetChain(), common.BtcTestNetChain()} - mainnetChains := []common.Chain{common.EthChain(), common.BscMainnetChain(), common.BtcMainnetChain()} + testnetChains := []chains.Chain{chains.GoerliChain(), chains.MumbaiChain(), chains.BscTestnetChain(), chains.BtcTestNetChain()} + mainnetChains := []chains.Chain{chains.EthChain(), chains.BscMainnetChain(), chains.BtcMainnetChain()} nonceLow := int64(1) nonceHigh := int64(10) tss := sample.Tss() @@ -100,11 +101,11 @@ func TestResetTestnetNonce(t *testing.T) { } err := v5.MigrateStore(ctx, k, zk.ObserverKeeper) require.NoError(t, err) - assertValues := map[common.Chain]int64{ - common.GoerliChain(): 226841, - common.MumbaiChain(): 200599, - common.BscTestnetChain(): 110454, - common.BtcTestNetChain(): 4881, + assertValues := map[chains.Chain]int64{ + chains.GoerliChain(): 226841, + chains.MumbaiChain(): 200599, + chains.BscTestnetChain(): 110454, + chains.BtcTestNetChain(): 4881, } for _, chain := range testnetChains { @@ -129,7 +130,7 @@ func TestResetTestnetNonce(t *testing.T) { t.Run("reset nonce even if some chain values are missing", func(t *testing.T) { k, ctx, _, zk := keepertest.CrosschainKeeper(t) - testnetChains := []common.Chain{common.GoerliChain()} + testnetChains := []chains.Chain{chains.GoerliChain()} nonceLow := int64(1) nonceHigh := int64(10) tss := sample.Tss() @@ -149,10 +150,10 @@ func TestResetTestnetNonce(t *testing.T) { } err := v5.MigrateStore(ctx, k, zk.ObserverKeeper) require.NoError(t, err) - assertValuesSet := map[common.Chain]int64{ - common.GoerliChain(): 226841, + assertValuesSet := map[chains.Chain]int64{ + chains.GoerliChain(): 226841, } - assertValuesNotSet := []common.Chain{common.MumbaiChain(), common.BscTestnetChain(), common.BtcTestNetChain()} + assertValuesNotSet := []chains.Chain{chains.MumbaiChain(), chains.BscTestnetChain(), chains.BtcTestNetChain()} for _, chain := range testnetChains { pn, found := zk.ObserverKeeper.GetPendingNonces(ctx, tss.TssPubkey, chain.ChainId) @@ -183,11 +184,11 @@ func CrossChainTxList(count int) []crosschaintypes.CrossChainTx { CctxStatus: &crosschaintypes.Status{Status: crosschaintypes.CctxStatus_Aborted}, InboundTxParams: &crosschaintypes.InboundTxParams{ Amount: amount.Add(math.NewUint(uint64(r.Uint32()))), - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }, OutboundTxParams: []*crosschaintypes.OutboundTxParams{{ Amount: amount, - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }}, } for ; i < count; i++ { @@ -197,11 +198,11 @@ func CrossChainTxList(count int) []crosschaintypes.CrossChainTx { CctxStatus: &crosschaintypes.Status{Status: crosschaintypes.CctxStatus_Aborted}, InboundTxParams: &crosschaintypes.InboundTxParams{ Amount: amount, - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }, OutboundTxParams: []*crosschaintypes.OutboundTxParams{{ Amount: math.ZeroUint(), - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, }}, } } @@ -212,12 +213,12 @@ func CrossChainTxList(count int) []crosschaintypes.CrossChainTx { CctxStatus: &crosschaintypes.Status{Status: crosschaintypes.CctxStatus_Aborted}, InboundTxParams: &crosschaintypes.InboundTxParams{ Amount: amount, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, }, OutboundTxParams: []*crosschaintypes.OutboundTxParams{{ Amount: math.ZeroUint(), - CoinType: common.CoinType_ERC20, - ReceiverChainId: common.ZetaPrivnetChain().ChainId, + CoinType: coin.CoinType_ERC20, + ReceiverChainId: chains.ZetaPrivnetChain().ChainId, }}, } } @@ -228,12 +229,12 @@ func CrossChainTxList(count int) []crosschaintypes.CrossChainTx { CctxStatus: &crosschaintypes.Status{Status: crosschaintypes.CctxStatus_Aborted}, InboundTxParams: &crosschaintypes.InboundTxParams{ Amount: amount, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, }, OutboundTxParams: []*crosschaintypes.OutboundTxParams{{ Amount: math.ZeroUint(), - CoinType: common.CoinType_ERC20, - ReceiverChainId: common.GoerliLocalnetChain().ChainId, + CoinType: coin.CoinType_ERC20, + ReceiverChainId: chains.GoerliLocalnetChain().ChainId, }}, } } @@ -244,11 +245,11 @@ func CrossChainTxList(count int) []crosschaintypes.CrossChainTx { CctxStatus: &crosschaintypes.Status{Status: crosschaintypes.CctxStatus_Aborted}, InboundTxParams: &crosschaintypes.InboundTxParams{ Amount: amount, - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, }, OutboundTxParams: []*crosschaintypes.OutboundTxParams{{ Amount: amount, - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, }}, } } diff --git a/x/crosschain/types/cross_chain_tx.pb.go b/x/crosschain/types/cross_chain_tx.pb.go index 94f34e6e46..665a7958b6 100644 --- a/x/crosschain/types/cross_chain_tx.pb.go +++ b/x/crosschain/types/cross_chain_tx.pb.go @@ -12,7 +12,7 @@ import ( github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + coin "github.com/zeta-chain/zetacore/pkg/coin" ) // Reference imports to suppress errors if they are not otherwise used. @@ -95,7 +95,7 @@ type InboundTxParams struct { Sender string `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` SenderChainId int64 `protobuf:"varint,2,opt,name=sender_chain_id,json=senderChainId,proto3" json:"sender_chain_id,omitempty"` TxOrigin string `protobuf:"bytes,3,opt,name=tx_origin,json=txOrigin,proto3" json:"tx_origin,omitempty"` - CoinType common.CoinType `protobuf:"varint,4,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` + CoinType coin.CoinType `protobuf:"varint,4,opt,name=coin_type,json=coinType,proto3,enum=coin.CoinType" json:"coin_type,omitempty"` Asset string `protobuf:"bytes,5,opt,name=asset,proto3" json:"asset,omitempty"` Amount github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,6,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"amount"` InboundTxObservedHash string `protobuf:"bytes,7,opt,name=inbound_tx_observed_hash,json=inboundTxObservedHash,proto3" json:"inbound_tx_observed_hash,omitempty"` @@ -159,11 +159,11 @@ func (m *InboundTxParams) GetTxOrigin() string { return "" } -func (m *InboundTxParams) GetCoinType() common.CoinType { +func (m *InboundTxParams) GetCoinType() coin.CoinType { if m != nil { return m.CoinType } - return common.CoinType_Zeta + return coin.CoinType_Zeta } func (m *InboundTxParams) GetAsset() string { @@ -249,7 +249,7 @@ var xxx_messageInfo_ZetaAccounting proto.InternalMessageInfo type OutboundTxParams struct { Receiver string `protobuf:"bytes,1,opt,name=receiver,proto3" json:"receiver,omitempty"` ReceiverChainId int64 `protobuf:"varint,2,opt,name=receiver_chainId,json=receiverChainId,proto3" json:"receiver_chainId,omitempty"` - CoinType common.CoinType `protobuf:"varint,3,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` + CoinType coin.CoinType `protobuf:"varint,3,opt,name=coin_type,json=coinType,proto3,enum=coin.CoinType" json:"coin_type,omitempty"` Amount github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,4,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"amount"` OutboundTxTssNonce uint64 `protobuf:"varint,5,opt,name=outbound_tx_tss_nonce,json=outboundTxTssNonce,proto3" json:"outbound_tx_tss_nonce,omitempty"` OutboundTxGasLimit uint64 `protobuf:"varint,6,opt,name=outbound_tx_gas_limit,json=outboundTxGasLimit,proto3" json:"outbound_tx_gas_limit,omitempty"` @@ -313,11 +313,11 @@ func (m *OutboundTxParams) GetReceiverChainId() int64 { return 0 } -func (m *OutboundTxParams) GetCoinType() common.CoinType { +func (m *OutboundTxParams) GetCoinType() coin.CoinType { if m != nil { return m.CoinType } - return common.CoinType_Zeta + return coin.CoinType_Zeta } func (m *OutboundTxParams) GetOutboundTxTssNonce() uint64 { @@ -556,77 +556,78 @@ func init() { func init() { proto.RegisterFile("crosschain/cross_chain_tx.proto", fileDescriptor_af3a0ad055343c21) } var fileDescriptor_af3a0ad055343c21 = []byte{ - // 1120 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0xcd, 0x6e, 0x1b, 0x37, - 0x10, 0xd6, 0x46, 0x8a, 0x2c, 0x8d, 0x6c, 0x6b, 0x4d, 0xcb, 0xe9, 0xc2, 0x69, 0x24, 0x41, 0x6d, - 0x12, 0x25, 0x80, 0x25, 0xd8, 0x41, 0x11, 0xa0, 0x37, 0xdb, 0xb5, 0x13, 0x23, 0x89, 0x6d, 0x6c, - 0xed, 0x8b, 0x81, 0x62, 0x4b, 0xed, 0xd2, 0x12, 0x11, 0x69, 0xa9, 0x2e, 0x29, 0x43, 0x0e, 0xfa, - 0x10, 0x3d, 0xf4, 0x11, 0x7a, 0xe8, 0xa3, 0xe4, 0x50, 0xa0, 0x39, 0x16, 0x3d, 0x18, 0x85, 0x7d, - 0xee, 0xa5, 0x4f, 0x50, 0xf0, 0x67, 0x57, 0x6b, 0xd5, 0x3f, 0xfd, 0x3b, 0xed, 0x70, 0xc8, 0xef, -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xdb, 0x24, - 0xb0, 0xef, 0xa2, 0x12, 0xcc, 0xac, 0xeb, 0x77, 0xcb, 0xce, 0x2f, 0xe7, 0x7e, 0xfc, 0xa1, 0x6a, - 0x3d, 0x7d, 0x05, 0x95, 0xab, 0x9a, 0x09, 0xd9, 0x30, 0xbb, 0xcb, 0x44, 0xf2, 0x8a, 0xdb, 0x19, - 0x34, 0x07, 0xc5, 0xc9, 0xd0, 0x92, 0xcc, 0x5b, 0x63, 0xe2, 0x8f, 0x24, 0xd9, 0x1d, 0x4d, 0xb6, - 0xf1, 0xea, 0xfd, 0x79, 0xd5, 0xfa, 0x70, 0x5e, 0xb5, 0x7e, 0x3b, 0xaf, 0x5a, 0xdf, 0x5d, 0x54, - 0x33, 0x1f, 0x2e, 0xaa, 0x99, 0x5f, 0x2e, 0xaa, 0x99, 0xa3, 0xd5, 0x94, 0xae, 0xe4, 0x39, 0xad, - 0xe8, 0xbf, 0xce, 0xf8, 0xc8, 0xda, 0xe3, 0x76, 0xea, 0x5f, 0x54, 0xc9, 0xac, 0x93, 0x57, 0x7f, - 0x8e, 0xcf, 0xfe, 0x0c, 0x00, 0x00, 0xff, 0xff, 0x13, 0xc7, 0x24, 0x8d, 0xa6, 0x0a, 0x00, 0x00, + // 1125 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xac, 0x56, 0x5d, 0x4f, 0x1b, 0x47, + 0x17, 0xf6, 0xc6, 0xc6, 0xd8, 0xc7, 0x60, 0x2f, 0x83, 0xe1, 0x5d, 0x91, 0x37, 0xb6, 0xe5, 0x36, + 0x89, 0x93, 0x2a, 0xb6, 0x20, 0xaa, 0x22, 0xf5, 0x0e, 0x28, 0x24, 0x28, 0x09, 0xa0, 0x2d, 0xdc, + 0x20, 0x55, 0xdb, 0xf1, 0xee, 0x60, 0x8f, 0xb0, 0x77, 0xdc, 0x9d, 0x31, 0x32, 0x51, 0x7f, 0x44, + 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, 0x61, + 0xc7, 0xe4, 0x65, 0xa7, 0xd0, 0x22, 0x94, 0x8c, 0x2f, 0xa6, 0xb3, 0x2d, 0xb4, 0x00, 0xf3, 0xf1, + 0xe8, 0x2d, 0x0d, 0x49, 0x60, 0xa7, 0xa5, 0xcb, 0xac, 0x73, 0xc9, 0x29, 0x89, 0x84, 0x9d, 0x41, + 0x73, 0x90, 0xd3, 0x36, 0x09, 0xec, 0x19, 0x54, 0x80, 0xd9, 0x75, 0x7d, 0x6b, 0xd9, 0xd9, 0x95, + 0xcc, 0x0f, 0xdf, 0x57, 0xac, 0xa7, 0xaf, 0xa1, 0x7c, 0x5d, 0x33, 0x21, 0x1b, 0xe6, 0x76, 0x99, + 0x18, 0xdf, 0xe1, 0x76, 0x0a, 0xcd, 0x43, 0x7e, 0x32, 0xb4, 0x24, 0xf3, 0xd6, 0x88, 0xf8, 0x43, + 0x49, 0x76, 0x4f, 0x93, 0x6d, 0xbc, 0x7e, 0x7f, 0x51, 0xb1, 0x3e, 0x5c, 0x54, 0xac, 0x5f, 0x2f, + 0x2a, 0xd6, 0xb7, 0x97, 0x95, 0xd4, 0x87, 0xcb, 0x4a, 0xea, 0xe7, 0xcb, 0x4a, 0xea, 0x68, 0x35, + 0xa1, 0x2b, 0xb9, 0x4f, 0xcf, 0xf4, 0x8b, 0x33, 0xde, 0xb2, 0xd6, 0xa8, 0x95, 0x78, 0x87, 0x2a, + 0x99, 0xb5, 0xb3, 0xea, 0xd5, 0xf8, 0xfc, 0x8f, 0x00, 0x00, 0x00, 0xff, 0xff, 0xec, 0x1d, 0x5c, + 0x64, 0xa2, 0x0a, 0x00, 0x00, } func (m *InboundTxParams) Marshal() (dAtA []byte, err error) { @@ -1337,7 +1338,7 @@ func (m *InboundTxParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift + m.CoinType |= coin.CoinType(b&0x7F) << shift if b < 0x80 { break } @@ -1728,7 +1729,7 @@ func (m *OutboundTxParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift + m.CoinType |= coin.CoinType(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/crosschain/types/events.pb.go b/x/crosschain/types/events.pb.go index 68c05a18f0..39d521d4a7 100644 --- a/x/crosschain/types/events.pb.go +++ b/x/crosschain/types/events.pb.go @@ -11,7 +11,6 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - _ "github.com/zeta-chain/zetacore/common" ) // Reference imports to suppress errors if they are not otherwise used. @@ -581,48 +580,47 @@ func init() { func init() { proto.RegisterFile("crosschain/events.proto", fileDescriptor_7398db8b12b87b9e) } var fileDescriptor_7398db8b12b87b9e = []byte{ - // 654 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0xcf, 0x6e, 0x13, 0x3b, - 0x14, 0xc6, 0x3b, 0x6d, 0x92, 0x26, 0x6e, 0x9b, 0x5e, 0xcd, 0xed, 0xbd, 0xf5, 0x8d, 0x6e, 0xa3, - 0x52, 0x89, 0x3f, 0x0b, 0x48, 0x84, 0x78, 0x83, 0x46, 0x94, 0x56, 0x08, 0x15, 0xb5, 0x45, 0xa0, - 0x6e, 0x2c, 0xc7, 0x73, 0x98, 0xb1, 0x98, 0xb1, 0x23, 0xdb, 0xd3, 0x4e, 0xfb, 0x14, 0x88, 0xf7, - 0x40, 0xe2, 0x01, 0x78, 0x00, 0x96, 0x5d, 0xb0, 0x60, 0x89, 0xda, 0x17, 0x41, 0xb6, 0x67, 0x68, - 0x33, 0x45, 0xb0, 0x40, 0x20, 0xb1, 0x8a, 0xcf, 0x77, 0xec, 0x93, 0x9f, 0xbf, 0xe3, 0xe4, 0xa0, - 0x55, 0xa6, 0xa4, 0xd6, 0x2c, 0xa1, 0x5c, 0x0c, 0xe1, 0x08, 0x84, 0xd1, 0x83, 0x89, 0x92, 0x46, - 0x86, 0x6b, 0xa7, 0x60, 0xa8, 0xd3, 0x07, 0x6e, 0x25, 0x15, 0x0c, 0x2e, 0xf7, 0xf6, 0xfe, 0x66, - 0x32, 0xcb, 0xa4, 0x18, 0xfa, 0x0f, 0x7f, 0xa6, 0xb7, 0x12, 0xcb, 0x58, 0xba, 0xe5, 0xd0, 0xae, - 0xbc, 0xba, 0xf1, 0x71, 0x0e, 0xfd, 0xf3, 0xd0, 0x96, 0xde, 0x11, 0x63, 0x99, 0x8b, 0x68, 0x8b, - 0x0b, 0x9a, 0xf2, 0x53, 0x88, 0xc2, 0x75, 0xb4, 0x98, 0xe9, 0x98, 0x98, 0x93, 0x09, 0x90, 0x5c, - 0xa5, 0x38, 0x58, 0x0f, 0xee, 0x74, 0xf6, 0x50, 0xa6, 0xe3, 0x83, 0x93, 0x09, 0x3c, 0x53, 0x69, - 0xb8, 0x86, 0x10, 0x63, 0xa6, 0x20, 0x5c, 0x44, 0x50, 0xe0, 0x59, 0x97, 0xef, 0x58, 0x65, 0xc7, - 0x0a, 0xe1, 0xbf, 0xa8, 0xa5, 0x41, 0x44, 0xa0, 0xf0, 0x9c, 0x4b, 0x95, 0x51, 0xf8, 0x1f, 0x6a, - 0x9b, 0x82, 0x48, 0x15, 0x73, 0x81, 0x1b, 0x2e, 0x33, 0x6f, 0x8a, 0x5d, 0x1b, 0x86, 0x2b, 0xa8, - 0x49, 0xb5, 0x06, 0x83, 0x9b, 0x4e, 0xf7, 0x41, 0xf8, 0x3f, 0x42, 0x5c, 0x10, 0x53, 0x90, 0x84, - 0xea, 0x04, 0xb7, 0x5c, 0xaa, 0xcd, 0xc5, 0x41, 0xb1, 0x4d, 0x75, 0x12, 0xde, 0x42, 0xcb, 0x5c, - 0x90, 0x71, 0x2a, 0xd9, 0x2b, 0x92, 0x00, 0x8f, 0x13, 0x83, 0xe7, 0xdd, 0x96, 0x25, 0x2e, 0x36, - 0xad, 0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, 0x00, 0x00, + // 640 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x95, 0xdf, 0x4e, 0x14, 0x31, + 0x14, 0xc6, 0x19, 0xd8, 0x5d, 0x76, 0x0b, 0x2c, 0x66, 0x82, 0x52, 0x89, 0x4c, 0x90, 0xc4, 0x3f, + 0x17, 0xba, 0x1b, 0xe3, 0x1b, 0xb0, 0x11, 0x21, 0xc6, 0x60, 0x00, 0xa3, 0xe1, 0xa6, 0xe9, 0x4e, + 0x8f, 0x33, 0x8d, 0xb3, 0xed, 0xa6, 0xed, 0xc0, 0xc0, 0x53, 0x18, 0xdf, 0xc3, 0xc4, 0x07, 0xf0, + 0x01, 0xbc, 0xe4, 0xc2, 0x0b, 0x2f, 0x0d, 0xbc, 0x88, 0x69, 0x3b, 0x23, 0xec, 0x60, 0xf4, 0xc2, + 0x68, 0xe2, 0x5d, 0xcf, 0x77, 0x4e, 0x0f, 0xbf, 0x7e, 0x67, 0xd8, 0x83, 0x96, 0x63, 0x25, 0xb5, + 0x8e, 0x53, 0xca, 0x45, 0x1f, 0x0e, 0x41, 0x18, 0xdd, 0x1b, 0x2b, 0x69, 0x64, 0xb8, 0x7a, 0x02, + 0x86, 0x3a, 0xbd, 0xe7, 0x4e, 0x52, 0x41, 0xef, 0xa2, 0x76, 0x65, 0x29, 0x91, 0x89, 0x74, 0x95, + 0x7d, 0x7b, 0xf2, 0x97, 0xd6, 0xbf, 0xcc, 0xa0, 0xeb, 0x4f, 0x6c, 0x97, 0x6d, 0x31, 0x94, 0xb9, + 0x60, 0x9b, 0x5c, 0xd0, 0x8c, 0x9f, 0x00, 0x0b, 0xd7, 0xd0, 0xfc, 0x48, 0x27, 0xc4, 0x1c, 0x8f, + 0x81, 0xe4, 0x2a, 0xc3, 0xc1, 0x5a, 0x70, 0xbf, 0xb3, 0x8b, 0x46, 0x3a, 0xd9, 0x3f, 0x1e, 0x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x9f, 0xfa, 0xd1, 0x66, 0xc1, 0x63, 0x78, 0xb5, 0xea, 0x72, 0x1b, 0xcd, + 0x7b, 0x2b, 0x4b, 0xd6, 0xae, 0x2b, 0x9a, 0xf3, 0x9a, 0x23, 0x5d, 0xff, 0x30, 0x8d, 0x96, 0xdd, + 0x58, 0x0f, 0x54, 0xfc, 0x8a, 0x9b, 0x94, 0x29, 0x7a, 0x34, 0x50, 0x40, 0xcd, 0xdf, 0x1c, 0x6c, + 0x9d, 0xab, 0x71, 0x85, 0xab, 0x36, 0xca, 0x66, 0x6d, 0x94, 0x97, 0x47, 0xd4, 0xfa, 0xed, 0x88, + 0x66, 0x7f, 0x3d, 0xa2, 0xf6, 0xc4, 0x88, 0x26, 0x9d, 0xef, 0xd4, 0x9c, 0x5f, 0xff, 0x18, 0x20, + 0xec, 0xfd, 0x02, 0x43, 0xff, 0x99, 0x61, 0x93, 0x6e, 0x34, 0x6a, 0x6e, 0x4c, 0x22, 0x37, 0xeb, + 0xc8, 0x9f, 0x02, 0xb4, 0xe4, 0x90, 0x77, 0x72, 0xe3, 0xff, 0x75, 0x29, 0xcf, 0x72, 0x05, 0x7f, + 0x8e, 0xbb, 0x8a, 0x90, 0xcc, 0x58, 0xf5, 0x87, 0x3d, 0x72, 0x47, 0x66, 0xac, 0xfc, 0x4a, 0x27, + 0xb9, 0x1a, 0x3f, 0xf9, 0x88, 0x0f, 0x69, 0x96, 0x03, 0x29, 0x07, 0xc3, 0x4a, 0xf4, 0x05, 0xa7, + 0xee, 0x96, 0xe2, 0x55, 0xfc, 0xbd, 0x3c, 0x8e, 0x41, 0xeb, 0xff, 0x04, 0xff, 0x7d, 0x80, 0x56, + 0x1c, 0xfe, 0x60, 0xb0, 0xff, 0xfa, 0x29, 0xd5, 0x2f, 0x14, 0x8f, 0x61, 0x5b, 0xc4, 0x0a, 0xa8, + 0x06, 0x56, 0x43, 0x0c, 0xea, 0x88, 0x0f, 0x50, 0x98, 0x50, 0x4d, 0xc6, 0xf6, 0x12, 0xe1, 0xe5, + 0xad, 0xf2, 0x25, 0xd7, 0x92, 0x5a, 0x37, 0xfb, 0xf3, 0x42, 0x19, 0xe3, 0x86, 0x4b, 0x41, 0x33, + 0xf2, 0x06, 0xa0, 0x7a, 0x55, 0xf7, 0x42, 0xde, 0x04, 0xd0, 0x1b, 0xcf, 0x3e, 0x9f, 0x45, 0xc1, + 0xe9, 0x59, 0x14, 0x7c, 0x3b, 0x8b, 0x82, 0x77, 0xe7, 0xd1, 0xd4, 0xe9, 0x79, 0x34, 0xf5, 0xf5, + 0x3c, 0x9a, 0x3a, 0x78, 0x94, 0x70, 0x93, 0xe6, 0xc3, 0x5e, 0x2c, 0x47, 0x7d, 0xbb, 0x1c, 0x1e, + 0xfa, 0xfd, 0x51, 0xed, 0x89, 0x7e, 0xd1, 0xbf, 0xb4, 0x55, 0xac, 0xf5, 0x7a, 0xd8, 0x72, 0x0b, + 0xe2, 0xf1, 0xf7, 0x00, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xf3, 0x4a, 0xbd, 0x70, 0x06, 0x00, 0x00, } func (m *EventInboundFinalized) Marshal() (dAtA []byte, err error) { diff --git a/x/crosschain/types/expected_keepers.go b/x/crosschain/types/expected_keepers.go index 6f77d4c2dc..eb291938c4 100644 --- a/x/crosschain/types/expected_keepers.go +++ b/x/crosschain/types/expected_keepers.go @@ -9,7 +9,9 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" eth "github.com/ethereum/go-ethereum/common" evmtypes "github.com/evmos/ethermint/x/evm/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/proofs" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" fungibletypes "github.com/zeta-chain/zetacore/x/fungible/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -46,9 +48,9 @@ type ObserverKeeper interface { AddVoteToBallot(ctx sdk.Context, ballot observertypes.Ballot, address string, observationType observertypes.VoteType) (observertypes.Ballot, error) CheckIfFinalizingVote(ctx sdk.Context, ballot observertypes.Ballot) (observertypes.Ballot, bool) IsAuthorized(ctx sdk.Context, address string) bool - FindBallot(ctx sdk.Context, index string, chain *common.Chain, observationType observertypes.ObservationType) (ballot observertypes.Ballot, isNew bool, err error) + FindBallot(ctx sdk.Context, index string, chain *chains.Chain, observationType observertypes.ObservationType) (ballot observertypes.Ballot, isNew bool, err error) AddBallotToList(ctx sdk.Context, ballot observertypes.Ballot) - GetBlockHeader(ctx sdk.Context, hash []byte) (val common.BlockHeader, found bool) + GetBlockHeader(ctx sdk.Context, hash []byte) (val proofs.BlockHeader, found bool) CheckIfTssPubkeyHasBeenGenerated(ctx sdk.Context, tssPubkey string) (observertypes.TSS, bool) GetAllTSS(ctx sdk.Context) (list []observertypes.TSS) GetTSS(ctx sdk.Context) (val observertypes.TSS, found bool) @@ -75,7 +77,7 @@ type ObserverKeeper interface { ctx sdk.Context, senderChainID int64, receiverChainID int64, - coinType common.CoinType, + coinType coin.CoinType, voter string, ballotIndex string, inTxHash string, @@ -84,11 +86,11 @@ type ObserverKeeper interface { ctx sdk.Context, ballotIndex string, outTxChainID int64, - receiveStatus common.ReceiveStatus, + receiveStatus chains.ReceiveStatus, voter string, ) (bool, bool, observertypes.Ballot, string, error) - GetSupportedChainFromChainID(ctx sdk.Context, chainID int64) *common.Chain - GetSupportedChains(ctx sdk.Context) []*common.Chain + GetSupportedChainFromChainID(ctx sdk.Context, chainID int64) *chains.Chain + GetSupportedChains(ctx sdk.Context) []*chains.Chain } type FungibleKeeper interface { @@ -120,7 +122,7 @@ type FungibleKeeper interface { amount *big.Int, senderChainID int64, data []byte, - coinType common.CoinType, + coinType coin.CoinType, asset string, ) (*evmtypes.MsgEthereumTxResponse, bool, error) CallUniswapV2RouterSwapExactTokensForTokens( @@ -154,7 +156,7 @@ type FungibleKeeper interface { name, symbol string, decimals uint8, chainID int64, - coinType common.CoinType, + coinType coin.CoinType, erc20Contract string, gasLimit *big.Int, ) (eth.Address, error) diff --git a/x/crosschain/types/in_tx_tracker.pb.go b/x/crosschain/types/in_tx_tracker.pb.go index 75074880b6..244ec7aec3 100644 --- a/x/crosschain/types/in_tx_tracker.pb.go +++ b/x/crosschain/types/in_tx_tracker.pb.go @@ -10,7 +10,7 @@ import ( math_bits "math/bits" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + coin "github.com/zeta-chain/zetacore/pkg/coin" ) // Reference imports to suppress errors if they are not otherwise used. @@ -25,9 +25,9 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type InTxTracker struct { - ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - CoinType common.CoinType `protobuf:"varint,3,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` + ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + CoinType coin.CoinType `protobuf:"varint,3,opt,name=coin_type,json=coinType,proto3,enum=coin.CoinType" json:"coin_type,omitempty"` } func (m *InTxTracker) Reset() { *m = InTxTracker{} } @@ -77,11 +77,11 @@ func (m *InTxTracker) GetTxHash() string { return "" } -func (m *InTxTracker) GetCoinType() common.CoinType { +func (m *InTxTracker) GetCoinType() coin.CoinType { if m != nil { return m.CoinType } - return common.CoinType_Zeta + return coin.CoinType_Zeta } func init() { @@ -91,22 +91,22 @@ func init() { func init() { proto.RegisterFile("crosschain/in_tx_tracker.proto", fileDescriptor_799b411f065af0ce) } var fileDescriptor_799b411f065af0ce = []byte{ - // 237 bytes of a gzipped FileDescriptorProto + // 240 bytes of a gzipped FileDescriptorProto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2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, - 0x0c, 0xd3, 0x33, 0x4b, 0x32, 0x4a, 0x93, 0x40, 0x7a, 0xf5, 0x41, 0x1e, 0xd0, 0x85, 0x78, 0x15, - 0xe6, 0x17, 0xfd, 0x0a, 0x7d, 0xa4, 0x00, 0x00, 0xd9, 0x56, 0x9c, 0xc4, 0x06, 0xf6, 0x85, 0x31, - 0x20, 0x00, 0x00, 0xff, 0xff, 0x60, 0xe9, 0x97, 0x6f, 0x1b, 0x01, 0x00, 0x00, + 0x04, 0x4b, 0xeb, 0x81, 0x59, 0xf9, 0x45, 0xa9, 0x7a, 0x08, 0x2d, 0x52, 0xc2, 0x05, 0xd9, 0xe9, + 0xfa, 0xc9, 0xf9, 0x99, 0x79, 0x60, 0x02, 0xa2, 0x47, 0x29, 0x8f, 0x8b, 0xdb, 0x33, 0x2f, 0xa4, + 0x22, 0x04, 0x62, 0x90, 0x90, 0x24, 0x17, 0x07, 0x58, 0x71, 0x7c, 0x66, 0x8a, 0x04, 0xa3, 0x02, + 0xa3, 0x06, 0x73, 0x10, 0x3b, 0x98, 0xef, 0x99, 0x22, 0x24, 0xce, 0xc5, 0x5e, 0x52, 0x11, 0x9f, + 0x91, 0x58, 0x9c, 0x21, 0xc1, 0xa4, 0xc0, 0xa8, 0xc1, 0x19, 0xc4, 0x56, 0x52, 0xe1, 0x91, 0x58, + 0x9c, 0x21, 0xa4, 0xcd, 0xc5, 0x09, 0x32, 0x30, 0xbe, 0xa4, 0xb2, 0x20, 0x55, 0x82, 0x59, 0x81, + 0x51, 0x83, 0xcf, 0x88, 0x4f, 0x0f, 0x6c, 0x85, 0x73, 0x7e, 0x66, 0x5e, 0x48, 0x65, 0x41, 0x6a, + 0x10, 0x47, 0x32, 0x94, 0xe5, 0xe4, 0x7d, 0xe2, 0x91, 0x1c, 0xe3, 0x85, 0x47, 0x72, 0x8c, 0x0f, + 0x1e, 0xc9, 0x31, 0x4e, 0x78, 0x2c, 0xc7, 0x70, 0xe1, 0xb1, 0x1c, 0xc3, 0x8d, 0xc7, 0x72, 0x0c, + 0x51, 0x86, 0xe9, 0x99, 0x25, 0x19, 0xa5, 0x49, 0x7a, 0xc9, 0xf9, 0xb9, 0xfa, 0x20, 0xe7, 0xeb, + 0x42, 0x3c, 0x0a, 0xf3, 0x89, 0x7e, 0x85, 0x3e, 0x92, 0xf7, 0x41, 0x76, 0x15, 0x27, 0xb1, 0x81, + 0xfd, 0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0xba, 0x1e, 0xbf, 0xb5, 0x19, 0x01, 0x00, 0x00, } func (m *InTxTracker) Marshal() (dAtA []byte, err error) { @@ -279,7 +279,7 @@ func (m *InTxTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift + m.CoinType |= coin.CoinType(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/crosschain/types/message_add_to_in_tx_tracker.go b/x/crosschain/types/message_add_to_in_tx_tracker.go index 5f15f4d735..66498192a7 100644 --- a/x/crosschain/types/message_add_to_in_tx_tracker.go +++ b/x/crosschain/types/message_add_to_in_tx_tracker.go @@ -4,14 +4,15 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" ) const TypeMsgAddToInTxTracker = "AddToInTxTracker" var _ sdk.Msg = &MsgAddToInTxTracker{} -func NewMsgAddToInTxTracker(creator string, chain int64, coinType common.CoinType, txHash string) *MsgAddToInTxTracker { +func NewMsgAddToInTxTracker(creator string, chain int64, coinType coin.CoinType, txHash string) *MsgAddToInTxTracker { return &MsgAddToInTxTracker{ Creator: creator, ChainId: chain, @@ -46,14 +47,14 @@ func (msg *MsgAddToInTxTracker) ValidateBasic() error { if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } - chain := common.GetChainFromChainID(msg.ChainId) + chain := chains.GetChainFromChainID(msg.ChainId) if chain == nil { return errorsmod.Wrapf(ErrInvalidChainID, "chain id (%d)", msg.ChainId) } if msg.Proof != nil && !chain.SupportMerkleProof() { return errorsmod.Wrapf(ErrProofVerificationFail, "chain id %d does not support proof-based trackers", msg.ChainId) } - _, ok := common.CoinType_value[msg.CoinType.String()] + _, ok := coin.CoinType_value[msg.CoinType.String()] if !ok { return errorsmod.Wrapf(ErrProofVerificationFail, "coin-type not supported") } diff --git a/x/crosschain/types/message_add_to_in_tx_tracker_test.go b/x/crosschain/types/message_add_to_in_tx_tracker_test.go index 2200f04421..b145737eaa 100644 --- a/x/crosschain/types/message_add_to_in_tx_tracker_test.go +++ b/x/crosschain/types/message_add_to_in_tx_tracker_test.go @@ -7,7 +7,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/proofs" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -22,8 +24,8 @@ func TestMsgAddToInTxTracker_ValidateBasic(t *testing.T) { name: "invalid address", msg: types.NewMsgAddToInTxTracker( "invalid_address", - common.GoerliChain().ChainId, - common.CoinType_Gas, + chains.GoerliChain().ChainId, + coin.CoinType_Gas, "hash", ), err: sdkerrors.ErrInvalidAddress, @@ -33,7 +35,7 @@ func TestMsgAddToInTxTracker_ValidateBasic(t *testing.T) { msg: types.NewMsgAddToInTxTracker( sample.AccAddress(), 42, - common.CoinType_Gas, + coin.CoinType_Gas, "hash", ), err: errorsmod.Wrapf(types.ErrInvalidChainID, "chain id (%d)", 42), @@ -42,17 +44,17 @@ func TestMsgAddToInTxTracker_ValidateBasic(t *testing.T) { name: "invalid proof", msg: &types.MsgAddToInTxTracker{ Creator: sample.AccAddress(), - ChainId: common.ZetaTestnetChain().ChainId, - CoinType: common.CoinType_Gas, - Proof: &common.Proof{}, + ChainId: chains.ZetaTestnetChain().ChainId, + CoinType: coin.CoinType_Gas, + Proof: &proofs.Proof{}, }, - err: errorsmod.Wrapf(types.ErrProofVerificationFail, "chain id %d does not support proof-based trackers", common.ZetaTestnetChain().ChainId), + err: errorsmod.Wrapf(types.ErrProofVerificationFail, "chain id %d does not support proof-based trackers", chains.ZetaTestnetChain().ChainId), }, { name: "invalid coin type", msg: &types.MsgAddToInTxTracker{ Creator: sample.AccAddress(), - ChainId: common.ZetaTestnetChain().ChainId, + ChainId: chains.ZetaTestnetChain().ChainId, CoinType: 5, }, err: errorsmod.Wrapf(types.ErrProofVerificationFail, "coin-type not supported"), @@ -61,8 +63,8 @@ func TestMsgAddToInTxTracker_ValidateBasic(t *testing.T) { name: "valid", msg: types.NewMsgAddToInTxTracker( sample.AccAddress(), - common.GoerliChain().ChainId, - common.CoinType_Gas, + chains.GoerliChain().ChainId, + coin.CoinType_Gas, "hash", ), err: nil, @@ -91,8 +93,8 @@ func TestMsgAddToInTxTracker_GetSigners(t *testing.T) { name: "valid signer", msg: types.NewMsgAddToInTxTracker( signer, - common.GoerliChain().ChainId, - common.CoinType_Gas, + chains.GoerliChain().ChainId, + coin.CoinType_Gas, "hash", ), panics: false, @@ -101,8 +103,8 @@ func TestMsgAddToInTxTracker_GetSigners(t *testing.T) { name: "invalid signer", msg: types.NewMsgAddToInTxTracker( "invalid_address", - common.GoerliChain().ChainId, - common.CoinType_Gas, + chains.GoerliChain().ChainId, + coin.CoinType_Gas, "hash", ), panics: true, @@ -126,8 +128,8 @@ func TestMsgAddToInTxTracker_GetSigners(t *testing.T) { func TestMsgAddToInTxTracker_Type(t *testing.T) { msg := types.NewMsgAddToInTxTracker( sample.AccAddress(), - common.GoerliChain().ChainId, - common.CoinType_Gas, + chains.GoerliChain().ChainId, + coin.CoinType_Gas, "hash", ) require.Equal(t, types.TypeMsgAddToInTxTracker, msg.Type()) @@ -136,8 +138,8 @@ func TestMsgAddToInTxTracker_Type(t *testing.T) { func TestMsgAddToInTxTracker_Route(t *testing.T) { msg := types.NewMsgAddToInTxTracker( sample.AccAddress(), - common.GoerliChain().ChainId, - common.CoinType_Gas, + chains.GoerliChain().ChainId, + coin.CoinType_Gas, "hash", ) require.Equal(t, types.RouterKey, msg.Route()) @@ -146,8 +148,8 @@ func TestMsgAddToInTxTracker_Route(t *testing.T) { func TestMsgAddToInTxTracker_GetSignBytes(t *testing.T) { msg := types.NewMsgAddToInTxTracker( sample.AccAddress(), - common.GoerliChain().ChainId, - common.CoinType_Gas, + chains.GoerliChain().ChainId, + coin.CoinType_Gas, "hash", ) require.NotPanics(t, func() { diff --git a/x/crosschain/types/message_add_to_out_tx_tracker.go b/x/crosschain/types/message_add_to_out_tx_tracker.go index 45084ec7b3..4e1900bb65 100644 --- a/x/crosschain/types/message_add_to_out_tx_tracker.go +++ b/x/crosschain/types/message_add_to_out_tx_tracker.go @@ -4,7 +4,7 @@ import ( cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/proofs" ) const TypeMsgAddToOutTxTracker = "AddToTracker" @@ -16,7 +16,7 @@ func NewMsgAddToOutTxTracker( chain int64, nonce uint64, txHash string, - proof *common.Proof, + proof *proofs.Proof, blockHash string, txIndex int64, ) *MsgAddToOutTxTracker { diff --git a/x/crosschain/types/message_gas_price_voter.go b/x/crosschain/types/message_gas_price_voter.go index e21fa80dce..89dc8030c4 100644 --- a/x/crosschain/types/message_gas_price_voter.go +++ b/x/crosschain/types/message_gas_price_voter.go @@ -4,7 +4,7 @@ import ( cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/authz" ) var _ sdk.Msg = &MsgGasPriceVoter{} @@ -24,7 +24,7 @@ func (msg *MsgGasPriceVoter) Route() string { } func (msg *MsgGasPriceVoter) Type() string { - return common.GasPriceVoter.String() + return authz.GasPriceVoter.String() } func (msg *MsgGasPriceVoter) GetSigners() []sdk.AccAddress { diff --git a/x/crosschain/types/message_gas_price_voter_test.go b/x/crosschain/types/message_gas_price_voter_test.go index 1c8ec9bd47..10ce98a1bd 100644 --- a/x/crosschain/types/message_gas_price_voter_test.go +++ b/x/crosschain/types/message_gas_price_voter_test.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" - common "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/authz" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -103,7 +103,7 @@ func TestMsgGasPriceVoter_Type(t *testing.T) { msg := types.MsgGasPriceVoter{ Creator: sample.AccAddress(), } - require.Equal(t, common.GasPriceVoter.String(), msg.Type()) + require.Equal(t, authz.GasPriceVoter.String(), msg.Type()) } func TestMsgGasPriceVoter_Route(t *testing.T) { diff --git a/x/crosschain/types/message_migrate_tss_funds.go b/x/crosschain/types/message_migrate_tss_funds.go index ec5076caa0..cb78371d43 100644 --- a/x/crosschain/types/message_migrate_tss_funds.go +++ b/x/crosschain/types/message_migrate_tss_funds.go @@ -5,7 +5,7 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" ) const TypeMsgMigrateTssFunds = "MigrateTssFunds" @@ -46,7 +46,7 @@ func (msg *MsgMigrateTssFunds) ValidateBasic() error { if err != nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } - if common.GetChainFromChainID(msg.ChainId) == nil { + if chains.GetChainFromChainID(msg.ChainId) == nil { return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid chain id (%d)", msg.ChainId) } if msg.Amount.IsZero() { diff --git a/x/crosschain/types/message_migrate_tss_funds_test.go b/x/crosschain/types/message_migrate_tss_funds_test.go index e3461982f9..f882cf90fa 100644 --- a/x/crosschain/types/message_migrate_tss_funds_test.go +++ b/x/crosschain/types/message_migrate_tss_funds_test.go @@ -6,7 +6,7 @@ import ( sdkmath "cosmossdk.io/math" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -23,7 +23,7 @@ func TestNewMsgMigrateTssFunds_ValidateBasic(t *testing.T) { name: "invalid creator", msg: types.NewMsgMigrateTssFunds( "invalid address", - common.DefaultChainsList()[0].ChainId, + chains.DefaultChainsList()[0].ChainId, sdkmath.NewUintFromString("100000"), ), error: true, @@ -41,7 +41,7 @@ func TestNewMsgMigrateTssFunds_ValidateBasic(t *testing.T) { name: "invalid amount", msg: types.NewMsgMigrateTssFunds( sample.AccAddress(), - common.DefaultChainsList()[0].ChainId, + chains.DefaultChainsList()[0].ChainId, sdkmath.NewUintFromString("0"), ), error: true, @@ -50,7 +50,7 @@ func TestNewMsgMigrateTssFunds_ValidateBasic(t *testing.T) { name: "valid msg", msg: types.NewMsgMigrateTssFunds( sample.AccAddress(), - common.DefaultChainsList()[0].ChainId, + chains.DefaultChainsList()[0].ChainId, sdkmath.NewUintFromString("100000"), ), error: false, @@ -80,7 +80,7 @@ func TestNewMsgMigrateTssFunds_GetSigners(t *testing.T) { name: "valid signer", msg: types.MsgMigrateTssFunds{ Creator: signer, - ChainId: common.DefaultChainsList()[0].ChainId, + ChainId: chains.DefaultChainsList()[0].ChainId, Amount: sdkmath.NewUintFromString("100000"), }, panics: false, @@ -89,7 +89,7 @@ func TestNewMsgMigrateTssFunds_GetSigners(t *testing.T) { name: "invalid signer", msg: types.MsgMigrateTssFunds{ Creator: "invalid_address", - ChainId: common.DefaultChainsList()[0].ChainId, + ChainId: chains.DefaultChainsList()[0].ChainId, Amount: sdkmath.NewUintFromString("100000"), }, panics: true, @@ -113,7 +113,7 @@ func TestNewMsgMigrateTssFunds_GetSigners(t *testing.T) { func TestNewMsgMigrateTssFunds_Type(t *testing.T) { msg := types.MsgMigrateTssFunds{ Creator: sample.AccAddress(), - ChainId: common.DefaultChainsList()[0].ChainId, + ChainId: chains.DefaultChainsList()[0].ChainId, Amount: sdkmath.NewUintFromString("100000"), } require.Equal(t, types.TypeMsgMigrateTssFunds, msg.Type()) @@ -122,7 +122,7 @@ func TestNewMsgMigrateTssFunds_Type(t *testing.T) { func TestNewMsgMigrateTssFunds_Route(t *testing.T) { msg := types.MsgMigrateTssFunds{ Creator: sample.AccAddress(), - ChainId: common.DefaultChainsList()[0].ChainId, + ChainId: chains.DefaultChainsList()[0].ChainId, Amount: sdkmath.NewUintFromString("100000"), } require.Equal(t, types.RouterKey, msg.Route()) @@ -131,7 +131,7 @@ func TestNewMsgMigrateTssFunds_Route(t *testing.T) { func TestNewMsgMigrateTssFunds_GetSignBytes(t *testing.T) { msg := types.MsgMigrateTssFunds{ Creator: sample.AccAddress(), - ChainId: common.DefaultChainsList()[0].ChainId, + ChainId: chains.DefaultChainsList()[0].ChainId, Amount: sdkmath.NewUintFromString("100000"), } require.NotPanics(t, func() { diff --git a/x/crosschain/types/message_tss_voter.go b/x/crosschain/types/message_tss_voter.go index 6d65f19140..dc9abc4ccb 100644 --- a/x/crosschain/types/message_tss_voter.go +++ b/x/crosschain/types/message_tss_voter.go @@ -6,14 +6,14 @@ import ( cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" ) const TypeMsgCreateTSSVoter = "CreateTSSVoter" var _ sdk.Msg = &MsgCreateTSSVoter{} -func NewMsgCreateTSSVoter(creator string, pubkey string, keygenZetaHeight int64, status common.ReceiveStatus) *MsgCreateTSSVoter { +func NewMsgCreateTSSVoter(creator string, pubkey string, keygenZetaHeight int64, status chains.ReceiveStatus) *MsgCreateTSSVoter { return &MsgCreateTSSVoter{ Creator: creator, TssPubkey: pubkey, diff --git a/x/crosschain/types/message_tss_voter_test.go b/x/crosschain/types/message_tss_voter_test.go index 6fc5ca89ec..8c87c0e552 100644 --- a/x/crosschain/types/message_tss_voter_test.go +++ b/x/crosschain/types/message_tss_voter_test.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -20,11 +20,11 @@ func TestMsgCreateTSSVoter_ValidateBasic(t *testing.T) { }{ { name: "valid message", - msg: types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, common.ReceiveStatus_Created), + msg: types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, chains.ReceiveStatus_Created), }, { name: "invalid creator address", - msg: types.NewMsgCreateTSSVoter("invalid", "pubkey", 1, common.ReceiveStatus_Created), + msg: types.NewMsgCreateTSSVoter("invalid", "pubkey", 1, chains.ReceiveStatus_Created), err: sdkerrors.ErrInvalidAddress, }, } @@ -50,12 +50,12 @@ func TestMsgCreateTSSVoter_GetSigners(t *testing.T) { }{ { name: "valid signer", - msg: types.NewMsgCreateTSSVoter(signer, "pubkey", 1, common.ReceiveStatus_Created), + msg: types.NewMsgCreateTSSVoter(signer, "pubkey", 1, chains.ReceiveStatus_Created), panics: false, }, { name: "invalid signer", - msg: types.NewMsgCreateTSSVoter("invalid", "pubkey", 1, common.ReceiveStatus_Created), + msg: types.NewMsgCreateTSSVoter("invalid", "pubkey", 1, chains.ReceiveStatus_Created), panics: true, }, } @@ -75,23 +75,23 @@ func TestMsgCreateTSSVoter_GetSigners(t *testing.T) { } func TestMsgCreateTSSVoter_Type(t *testing.T) { - msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, common.ReceiveStatus_Created) + msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, chains.ReceiveStatus_Created) require.Equal(t, types.TypeMsgCreateTSSVoter, msg.Type()) } func TestMsgCreateTSSVoter_Route(t *testing.T) { - msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, common.ReceiveStatus_Created) + msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, chains.ReceiveStatus_Created) require.Equal(t, types.RouterKey, msg.Route()) } func TestMsgCreateTSSVoter_GetSignBytes(t *testing.T) { - msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, common.ReceiveStatus_Created) + msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, chains.ReceiveStatus_Created) require.NotPanics(t, func() { msg.GetSignBytes() }) } func TestMsgCreateTSSVoter_Digest(t *testing.T) { - msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, common.ReceiveStatus_Created) + msg := types.NewMsgCreateTSSVoter(sample.AccAddress(), "pubkey", 1, chains.ReceiveStatus_Created) require.Equal(t, "1-tss-keygen", msg.Digest()) } diff --git a/x/crosschain/types/message_update_tss_address.go b/x/crosschain/types/message_update_tss_address.go index d9740514c3..163e232780 100644 --- a/x/crosschain/types/message_update_tss_address.go +++ b/x/crosschain/types/message_update_tss_address.go @@ -4,7 +4,7 @@ import ( errorsmod "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/cosmos" ) const TypeMsgUpdateTssAddress = "UpdateTssAddress" diff --git a/x/crosschain/types/message_vote_on_observed_inbound_tx.go b/x/crosschain/types/message_vote_on_observed_inbound_tx.go index 251a8a8077..aeb8305f57 100644 --- a/x/crosschain/types/message_vote_on_observed_inbound_tx.go +++ b/x/crosschain/types/message_vote_on_observed_inbound_tx.go @@ -6,7 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/ethereum/go-ethereum/crypto" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/authz" + "github.com/zeta-chain/zetacore/pkg/coin" ) // MaxMessageLength is the maximum length of a message in a cctx @@ -29,7 +30,7 @@ func NewMsgVoteOnObservedInboundTx( inTxHash string, inBlockHeight, gasLimit uint64, - coinType common.CoinType, + coinType coin.CoinType, asset string, eventIndex uint, ) *MsgVoteOnObservedInboundTx { @@ -56,7 +57,7 @@ func (msg *MsgVoteOnObservedInboundTx) Route() string { } func (msg *MsgVoteOnObservedInboundTx) Type() string { - return common.InboundVoter.String() + return authz.InboundVoter.String() } func (msg *MsgVoteOnObservedInboundTx) GetSigners() []sdk.AccAddress { diff --git a/x/crosschain/types/message_vote_on_observed_inbound_tx_test.go b/x/crosschain/types/message_vote_on_observed_inbound_tx_test.go index ea3bff7bf7..a62a3e2b62 100644 --- a/x/crosschain/types/message_vote_on_observed_inbound_tx_test.go +++ b/x/crosschain/types/message_vote_on_observed_inbound_tx_test.go @@ -9,7 +9,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/authz" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -36,7 +37,7 @@ func TestMsgVoteOnObservedInboundTx_ValidateBasic(t *testing.T) { sample.String(), 42, 42, - common.CoinType_Zeta, + coin.CoinType_Zeta, sample.String(), 42, ), @@ -55,7 +56,7 @@ func TestMsgVoteOnObservedInboundTx_ValidateBasic(t *testing.T) { sample.String(), 42, 42, - common.CoinType_Zeta, + coin.CoinType_Zeta, sample.String(), 42, ), @@ -75,7 +76,7 @@ func TestMsgVoteOnObservedInboundTx_ValidateBasic(t *testing.T) { sample.String(), 42, 42, - common.CoinType_Zeta, + coin.CoinType_Zeta, sample.String(), 42, ), @@ -95,7 +96,7 @@ func TestMsgVoteOnObservedInboundTx_ValidateBasic(t *testing.T) { sample.String(), 42, 42, - common.CoinType_Zeta, + coin.CoinType_Zeta, sample.String(), 42, ), @@ -115,7 +116,7 @@ func TestMsgVoteOnObservedInboundTx_ValidateBasic(t *testing.T) { sample.String(), 42, 42, - common.CoinType_Zeta, + coin.CoinType_Zeta, sample.String(), 42, ), @@ -149,7 +150,7 @@ func TestMsgVoteOnObservedInboundTx_Digest(t *testing.T) { InTxHash: sample.String(), InBlockHeight: 42, GasLimit: 42, - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, Asset: sample.String(), EventIndex: 42, } @@ -224,7 +225,7 @@ func TestMsgVoteOnObservedInboundTx_Digest(t *testing.T) { // coin type used msg2 = msg - msg2.CoinType = common.CoinType_ERC20 + msg2.CoinType = coin.CoinType_ERC20 hash2 = msg2.Digest() require.NotEqual(t, hash, hash2, "coin type should change hash") @@ -282,7 +283,7 @@ func TestMsgVoteOnObservedInboundTx_Type(t *testing.T) { msg := types.MsgVoteOnObservedInboundTx{ Creator: sample.AccAddress(), } - require.Equal(t, common.InboundVoter.String(), msg.Type()) + require.Equal(t, authz.InboundVoter.String(), msg.Type()) } func TestMsgVoteOnObservedInboundTx_Route(t *testing.T) { diff --git a/x/crosschain/types/message_vote_on_observed_outbound_tx.go b/x/crosschain/types/message_vote_on_observed_outbound_tx.go index 12d0276847..360038c6f4 100644 --- a/x/crosschain/types/message_vote_on_observed_outbound_tx.go +++ b/x/crosschain/types/message_vote_on_observed_outbound_tx.go @@ -6,7 +6,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/ethereum/go-ethereum/crypto" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/authz" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" ) var _ sdk.Msg = &MsgVoteOnObservedOutboundTx{} @@ -20,10 +22,10 @@ func NewMsgVoteOnObservedOutboundTx( outTxEffectiveGasPrice math.Int, outTxEffectiveGasLimit uint64, valueReceived math.Uint, - status common.ReceiveStatus, + status chains.ReceiveStatus, chain int64, nonce uint64, - coinType common.CoinType, + coinType coin.CoinType, ) *MsgVoteOnObservedOutboundTx { return &MsgVoteOnObservedOutboundTx{ Creator: creator, @@ -46,7 +48,7 @@ func (msg *MsgVoteOnObservedOutboundTx) Route() string { } func (msg *MsgVoteOnObservedOutboundTx) Type() string { - return common.OutboundVoter.String() + return authz.OutboundVoter.String() } func (msg *MsgVoteOnObservedOutboundTx) GetSigners() []sdk.AccAddress { @@ -79,7 +81,7 @@ func (msg *MsgVoteOnObservedOutboundTx) Digest() string { m.Creator = "" // Set status to ReceiveStatus_Created to make sure both successful and failed votes are added to the same ballot - m.Status = common.ReceiveStatus_Created + m.Status = chains.ReceiveStatus_Created // Outbound and reverted txs have different digest as ObservedOutTxHash is different so they are stored in different ballots hash := crypto.Keccak256Hash([]byte(m.String())) diff --git a/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go b/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go index 5e669aefa3..d9e3f6a3ca 100644 --- a/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go +++ b/x/crosschain/types/message_vote_on_observed_outbound_tx_test.go @@ -8,7 +8,9 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/authz" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -30,10 +32,10 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { math.NewInt(42), 42, math.NewUint(42), - common.ReceiveStatus_Created, + chains.ReceiveStatus_Created, 42, 42, - common.CoinType_Zeta, + coin.CoinType_Zeta, ), }, { @@ -47,10 +49,10 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { math.NewInt(42), 42, math.NewUint(42), - common.ReceiveStatus_Created, + chains.ReceiveStatus_Created, 42, 42, - common.CoinType_Zeta, + coin.CoinType_Zeta, ), err: sdkerrors.ErrInvalidAddress, }, @@ -65,10 +67,10 @@ func TestMsgVoteOnObservedOutboundTx_ValidateBasic(t *testing.T) { math.NewInt(42), 42, math.NewUint(42), - common.ReceiveStatus_Created, + chains.ReceiveStatus_Created, -1, 42, - common.CoinType_Zeta, + coin.CoinType_Zeta, ), err: types.ErrInvalidChainID, }, @@ -97,10 +99,10 @@ func TestMsgVoteOnObservedOutboundTx_Digest(t *testing.T) { ObservedOutTxEffectiveGasPrice: math.NewInt(42), ObservedOutTxEffectiveGasLimit: 42, ValueReceived: math.NewUint(42), - Status: common.ReceiveStatus_Created, + Status: chains.ReceiveStatus_Created, OutTxChain: 42, OutTxTssNonce: 42, - CoinType: common.CoinType_Zeta, + CoinType: coin.CoinType_Zeta, } hash := msg.Digest() require.NotEmpty(t, hash, "hash should not be empty") @@ -113,7 +115,7 @@ func TestMsgVoteOnObservedOutboundTx_Digest(t *testing.T) { // status not used msg2 = msg - msg2.Status = common.ReceiveStatus_Failed + msg2.Status = chains.ReceiveStatus_Failed hash2 = msg2.Digest() require.Equal(t, hash, hash2, "status should not change hash") @@ -173,7 +175,7 @@ func TestMsgVoteOnObservedOutboundTx_Digest(t *testing.T) { // coin type used msg2 = msg - msg2.CoinType = common.CoinType_ERC20 + msg2.CoinType = coin.CoinType_ERC20 hash2 = msg2.Digest() require.NotEqual(t, hash, hash2, "coin type should change hash") } @@ -219,7 +221,7 @@ func TestMsgVoteOnObservedOutboundTx_Type(t *testing.T) { msg := types.MsgVoteOnObservedOutboundTx{ Creator: sample.AccAddress(), } - require.Equal(t, common.OutboundVoter.String(), msg.Type()) + require.Equal(t, authz.OutboundVoter.String(), msg.Type()) } func TestMsgVoteOnObservedOutboundTx_Route(t *testing.T) { diff --git a/x/crosschain/types/tx.pb.go b/x/crosschain/types/tx.pb.go index 650ef991dd..c8338b386b 100644 --- a/x/crosschain/types/tx.pb.go +++ b/x/crosschain/types/tx.pb.go @@ -14,7 +14,9 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + chains "github.com/zeta-chain/zetacore/pkg/chains" + coin "github.com/zeta-chain/zetacore/pkg/coin" + proofs "github.com/zeta-chain/zetacore/pkg/proofs" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -35,7 +37,7 @@ type MsgCreateTSSVoter struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` TssPubkey string `protobuf:"bytes,2,opt,name=tss_pubkey,json=tssPubkey,proto3" json:"tss_pubkey,omitempty"` KeyGenZetaHeight int64 `protobuf:"varint,3,opt,name=keyGenZetaHeight,proto3" json:"keyGenZetaHeight,omitempty"` - Status common.ReceiveStatus `protobuf:"varint,4,opt,name=status,proto3,enum=common.ReceiveStatus" json:"status,omitempty"` + Status chains.ReceiveStatus `protobuf:"varint,4,opt,name=status,proto3,enum=chains.ReceiveStatus" json:"status,omitempty"` } func (m *MsgCreateTSSVoter) Reset() { *m = MsgCreateTSSVoter{} } @@ -92,11 +94,11 @@ func (m *MsgCreateTSSVoter) GetKeyGenZetaHeight() int64 { return 0 } -func (m *MsgCreateTSSVoter) GetStatus() common.ReceiveStatus { +func (m *MsgCreateTSSVoter) GetStatus() chains.ReceiveStatus { if m != nil { return m.Status } - return common.ReceiveStatus_Created + return chains.ReceiveStatus_Created } type MsgCreateTSSVoterResponse struct { @@ -313,13 +315,13 @@ func (m *MsgUpdateTssAddressResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateTssAddressResponse proto.InternalMessageInfo type MsgAddToInTxTracker struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - TxHash string `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - CoinType common.CoinType `protobuf:"varint,4,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` - Proof *common.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` - BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + TxHash string `protobuf:"bytes,3,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` + CoinType coin.CoinType `protobuf:"varint,4,opt,name=coin_type,json=coinType,proto3,enum=coin.CoinType" json:"coin_type,omitempty"` + Proof *proofs.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` + BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` } func (m *MsgAddToInTxTracker) Reset() { *m = MsgAddToInTxTracker{} } @@ -376,14 +378,14 @@ func (m *MsgAddToInTxTracker) GetTxHash() string { return "" } -func (m *MsgAddToInTxTracker) GetCoinType() common.CoinType { +func (m *MsgAddToInTxTracker) GetCoinType() coin.CoinType { if m != nil { return m.CoinType } - return common.CoinType_Zeta + return coin.CoinType_Zeta } -func (m *MsgAddToInTxTracker) GetProof() *common.Proof { +func (m *MsgAddToInTxTracker) GetProof() *proofs.Proof { if m != nil { return m.Proof } @@ -589,7 +591,7 @@ type MsgAddToOutTxTracker struct { ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` Nonce uint64 `protobuf:"varint,3,opt,name=nonce,proto3" json:"nonce,omitempty"` TxHash string `protobuf:"bytes,4,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - Proof *common.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` + Proof *proofs.Proof `protobuf:"bytes,5,opt,name=proof,proto3" json:"proof,omitempty"` BlockHash string `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` TxIndex int64 `protobuf:"varint,7,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` } @@ -655,7 +657,7 @@ func (m *MsgAddToOutTxTracker) GetTxHash() string { return "" } -func (m *MsgAddToOutTxTracker) GetProof() *common.Proof { +func (m *MsgAddToOutTxTracker) GetProof() *proofs.Proof { if m != nil { return m.Proof } @@ -937,10 +939,10 @@ type MsgVoteOnObservedOutboundTx struct { ObservedOutTxEffectiveGasPrice github_com_cosmos_cosmos_sdk_types.Int `protobuf:"bytes,11,opt,name=observed_outTx_effective_gas_price,json=observedOutTxEffectiveGasPrice,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Int" json:"observed_outTx_effective_gas_price"` ObservedOutTxEffectiveGasLimit uint64 `protobuf:"varint,12,opt,name=observed_outTx_effective_gas_limit,json=observedOutTxEffectiveGasLimit,proto3" json:"observed_outTx_effective_gas_limit,omitempty"` ValueReceived github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,5,opt,name=value_received,json=valueReceived,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"value_received" yaml:"value_received"` - Status common.ReceiveStatus `protobuf:"varint,6,opt,name=status,proto3,enum=common.ReceiveStatus" json:"status,omitempty"` + Status chains.ReceiveStatus `protobuf:"varint,6,opt,name=status,proto3,enum=chains.ReceiveStatus" json:"status,omitempty"` OutTxChain int64 `protobuf:"varint,7,opt,name=outTx_chain,json=outTxChain,proto3" json:"outTx_chain,omitempty"` OutTxTssNonce uint64 `protobuf:"varint,8,opt,name=outTx_tss_nonce,json=outTxTssNonce,proto3" json:"outTx_tss_nonce,omitempty"` - CoinType common.CoinType `protobuf:"varint,9,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` + CoinType coin.CoinType `protobuf:"varint,9,opt,name=coin_type,json=coinType,proto3,enum=coin.CoinType" json:"coin_type,omitempty"` } func (m *MsgVoteOnObservedOutboundTx) Reset() { *m = MsgVoteOnObservedOutboundTx{} } @@ -1018,11 +1020,11 @@ func (m *MsgVoteOnObservedOutboundTx) GetObservedOutTxEffectiveGasLimit() uint64 return 0 } -func (m *MsgVoteOnObservedOutboundTx) GetStatus() common.ReceiveStatus { +func (m *MsgVoteOnObservedOutboundTx) GetStatus() chains.ReceiveStatus { if m != nil { return m.Status } - return common.ReceiveStatus_Created + return chains.ReceiveStatus_Created } func (m *MsgVoteOnObservedOutboundTx) GetOutTxChain() int64 { @@ -1039,11 +1041,11 @@ func (m *MsgVoteOnObservedOutboundTx) GetOutTxTssNonce() uint64 { return 0 } -func (m *MsgVoteOnObservedOutboundTx) GetCoinType() common.CoinType { +func (m *MsgVoteOnObservedOutboundTx) GetCoinType() coin.CoinType { if m != nil { return m.CoinType } - return common.CoinType_Zeta + return coin.CoinType_Zeta } type MsgVoteOnObservedOutboundTxResponse struct { @@ -1091,13 +1093,13 @@ type MsgVoteOnObservedInboundTx struct { // string zeta_burnt = 6; Amount github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,6,opt,name=amount,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"amount"` // string mMint = 7; - Message string `protobuf:"bytes,8,opt,name=message,proto3" json:"message,omitempty"` - InTxHash string `protobuf:"bytes,9,opt,name=in_tx_hash,json=inTxHash,proto3" json:"in_tx_hash,omitempty"` - InBlockHeight uint64 `protobuf:"varint,10,opt,name=in_block_height,json=inBlockHeight,proto3" json:"in_block_height,omitempty"` - GasLimit uint64 `protobuf:"varint,11,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` - CoinType common.CoinType `protobuf:"varint,12,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` - TxOrigin string `protobuf:"bytes,13,opt,name=tx_origin,json=txOrigin,proto3" json:"tx_origin,omitempty"` - Asset string `protobuf:"bytes,14,opt,name=asset,proto3" json:"asset,omitempty"` + Message string `protobuf:"bytes,8,opt,name=message,proto3" json:"message,omitempty"` + InTxHash string `protobuf:"bytes,9,opt,name=in_tx_hash,json=inTxHash,proto3" json:"in_tx_hash,omitempty"` + InBlockHeight uint64 `protobuf:"varint,10,opt,name=in_block_height,json=inBlockHeight,proto3" json:"in_block_height,omitempty"` + GasLimit uint64 `protobuf:"varint,11,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + CoinType coin.CoinType `protobuf:"varint,12,opt,name=coin_type,json=coinType,proto3,enum=coin.CoinType" json:"coin_type,omitempty"` + TxOrigin string `protobuf:"bytes,13,opt,name=tx_origin,json=txOrigin,proto3" json:"tx_origin,omitempty"` + Asset string `protobuf:"bytes,14,opt,name=asset,proto3" json:"asset,omitempty"` // event index of the sent asset in the observed tx EventIndex uint64 `protobuf:"varint,15,opt,name=event_index,json=eventIndex,proto3" json:"event_index,omitempty"` } @@ -1198,11 +1200,11 @@ func (m *MsgVoteOnObservedInboundTx) GetGasLimit() uint64 { return 0 } -func (m *MsgVoteOnObservedInboundTx) GetCoinType() common.CoinType { +func (m *MsgVoteOnObservedInboundTx) GetCoinType() coin.CoinType { if m != nil { return m.CoinType } - return common.CoinType_Zeta + return coin.CoinType_Zeta } func (m *MsgVoteOnObservedInboundTx) GetTxOrigin() string { @@ -1476,101 +1478,102 @@ func init() { func init() { proto.RegisterFile("crosschain/tx.proto", fileDescriptor_81d6d611190b7635) } var fileDescriptor_81d6d611190b7635 = []byte{ - // 1502 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x58, 0x6f, 0x4f, 0xdb, 0x56, - 0x17, 0xc7, 0x0f, 0x10, 0x92, 0x03, 0x01, 0x6a, 0x68, 0x9b, 0x9a, 0x12, 0xa8, 0x79, 0xda, 0x07, - 0x3d, 0x12, 0x49, 0x4b, 0x35, 0xad, 0xed, 0x36, 0x69, 0x10, 0xb5, 0x94, 0xad, 0x94, 0xca, 0xa4, - 0xdb, 0xd4, 0x37, 0x96, 0x63, 0x5f, 0x1c, 0x8b, 0xc4, 0x37, 0xf2, 0xbd, 0x8e, 0x12, 0x34, 0x69, - 0x52, 0xa5, 0xbd, 0x9f, 0xa6, 0x49, 0x9b, 0xf6, 0x05, 0xf6, 0x55, 0xfa, 0xb2, 0xda, 0xab, 0x75, - 0x2f, 0xaa, 0xa9, 0x7c, 0x82, 0xed, 0x13, 0x4c, 0xf7, 0x8f, 0x4d, 0x9c, 0x90, 0x3f, 0x50, 0xf5, - 0x55, 0x7c, 0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d8, 0xf6, 0xe9, 0x7b, 0xf5, - 0x23, 0xb8, 0xda, 0x25, 0xcd, 0x1a, 0x36, 0x24, 0xc8, 0xc9, 0x01, 0x17, 0x5d, 0x4c, 0x88, 0xee, - 0x58, 0xe4, 0x39, 0x41, 0x8e, 0x7a, 0x0c, 0x7a, 0x97, 0x18, 0x3a, 0x3c, 0x44, 0x36, 0xf5, 0x9a, - 0x88, 0x2b, 0x10, 0x59, 0x98, 0xe6, 0x53, 0xa9, 0x20, 0xa7, 0xd2, 0xad, 0x11, 0xa6, 0xd2, 0xae, - 0x4f, 0x8d, 0x7c, 0xc2, 0xe2, 0xc3, 0x48, 0x6f, 0x94, 0x04, 0xf5, 0x8b, 0x21, 0xb6, 0xc5, 0x6d, - 0x33, 0xc3, 0xbd, 0xef, 0xaf, 0x8b, 0xdf, 0x41, 0x2a, 0x86, 0xd9, 0xa6, 0x55, 0x0b, 0x91, 0x19, - 0x88, 0x49, 0xee, 0x88, 0xfc, 0x6f, 0x3f, 0x3e, 0xe7, 0x24, 0xfd, 0xe7, 0xed, 0xca, 0xe5, 0xb6, - 0x55, 0xaf, 0x3d, 0xd0, 0x93, 0xea, 0x74, 0x23, 0xcb, 0x19, 0x72, 0x51, 0x70, 0x3a, 0x56, 0x89, - 0xd4, 0x08, 0xab, 0x84, 0xba, 0x02, 0xd3, 0x22, 0x44, 0x5e, 0xe1, 0xf2, 0x12, 0x00, 0xce, 0x2a, - 0x31, 0x8e, 0x7a, 0x0b, 0xe6, 0xc4, 0x01, 0x36, 0x70, 0x45, 0x03, 0xa6, 0x79, 0xe4, 0x59, 0xce, - 0x2e, 0x13, 0xf2, 0x94, 0xdf, 0x53, 0x89, 0x71, 0x97, 0x19, 0x36, 0xee, 0xf4, 0x9b, 0xb0, 0x36, - 0xa0, 0xb4, 0xe3, 0x16, 0x78, 0x39, 0xc1, 0x17, 0x87, 0xe4, 0xb9, 0x5d, 0x7f, 0x78, 0x07, 0xb0, - 0x7e, 0x43, 0xbe, 0x83, 0x02, 0x59, 0xfe, 0x92, 0x62, 0xe1, 0x88, 0x27, 0xb3, 0x6b, 0x34, 0x65, - 0x05, 0xbb, 0x24, 0x1b, 0x5d, 0x83, 0xb4, 0x84, 0x38, 0x90, 0xf7, 0x6e, 0x4c, 0xab, 0x37, 0x61, - 0x36, 0x7a, 0x96, 0xb0, 0x4d, 0x0a, 0x15, 0x11, 0x57, 0x20, 0x77, 0xba, 0x3c, 0xa5, 0xde, 0x6b, - 0x79, 0x62, 0x51, 0xd6, 0x11, 0x21, 0x96, 0x2b, 0xa0, 0xcf, 0x18, 0x11, 0xa9, 0x5e, 0x07, 0x60, - 0x90, 0xcb, 0x0e, 0xce, 0x08, 0x3f, 0x3d, 0x5f, 0x36, 0xee, 0x2d, 0x98, 0xf3, 0x7c, 0x53, 0xde, - 0xff, 0xa2, 0x5b, 0x45, 0xcb, 0x65, 0x3d, 0xbf, 0xb3, 0x45, 0x13, 0x43, 0x74, 0x9a, 0x9f, 0x88, - 0x87, 0x68, 0x32, 0xaf, 0x33, 0x43, 0xd7, 0x98, 0x25, 0xc8, 0xd0, 0x96, 0x89, 0x03, 0xcf, 0xf5, - 0xfc, 0x5c, 0x56, 0x38, 0x44, 0x5b, 0xfb, 0x9c, 0x66, 0xb7, 0xa7, 0x45, 0x08, 0xa2, 0xb9, 0x59, - 0xfe, 0x42, 0x10, 0xac, 0x04, 0x51, 0x13, 0xf9, 0x54, 0xce, 0xa1, 0x39, 0xee, 0x00, 0x70, 0x96, - 0x18, 0x45, 0xff, 0x05, 0xbd, 0x7f, 0x0d, 0xc4, 0xa5, 0xf2, 0x84, 0x6f, 0x30, 0x5b, 0x15, 0x1c, - 0xd0, 0x03, 0x1a, 0xda, 0x47, 0xa5, 0x52, 0xf9, 0x9b, 0xc1, 0x2b, 0xe4, 0xa0, 0xd1, 0x2e, 0x56, - 0xec, 0xa4, 0xb6, 0xd8, 0x54, 0x93, 0x8f, 0x7d, 0x03, 0x1d, 0x86, 0xbe, 0xc3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 0xba, 0xbf, 0x2b, 0xdc, 0x19, 0xae, 0xae, 0x4b, 0x44, 0xbb, 0x7f, 0x6e, 0x91, 0xce, 0x1c, 0x74, - 0x7d, 0x9f, 0x19, 0x21, 0x07, 0x49, 0x89, 0x51, 0x72, 0x70, 0xf6, 0xa7, 0x15, 0x66, 0xbd, 0x6b, - 0xbe, 0x8c, 0x60, 0x3d, 0x29, 0x31, 0x8a, 0xf5, 0xb3, 0xa7, 0x0e, 0xbf, 0xd5, 0x7b, 0x67, 0xce, - 0xdd, 0x51, 0x6e, 0xa2, 0x2e, 0xa1, 0x51, 0x6e, 0xf5, 0xbe, 0x53, 0x66, 0xfb, 0xcb, 0x57, 0xef, - 0xf2, 0xca, 0xeb, 0x77, 0x79, 0xe5, 0xaf, 0x77, 0x79, 0xe5, 0x87, 0x93, 0xfc, 0xd8, 0xeb, 0x93, - 0xfc, 0xd8, 0x1f, 0x27, 0xf9, 0xb1, 0x17, 0x77, 0x3a, 0x36, 0x1b, 0xa6, 0x76, 0x43, 0x7c, 0xab, - 0x8b, 0x2c, 0x14, 0x5b, 0xc5, 0xce, 0x2f, 0x78, 0x6c, 0xd1, 0xa9, 0xa4, 0xf8, 0xb7, 0xb7, 0xbb, - 0xff, 0x06, 0x00, 0x00, 0xff, 0xff, 0x8e, 0x99, 0xcd, 0x4c, 0xdc, 0x13, 0x00, 0x00, + // 1517 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x18, 0xdd, 0x4e, 0x1b, 0x47, + 0x97, 0xfd, 0x00, 0x63, 0x1f, 0x30, 0x24, 0x0b, 0x09, 0xce, 0x12, 0x0c, 0x59, 0xbe, 0xa4, 0xa8, + 0x55, 0xec, 0x84, 0xa8, 0x6a, 0x92, 0xb6, 0x52, 0x01, 0x25, 0x84, 0x36, 0x84, 0x68, 0x71, 0xda, + 0x2a, 0x37, 0xd6, 0x7a, 0x77, 0x58, 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08, 0xaa, 0x5d, 0x39, 0x08, 0x14, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3678,7 +3681,7 @@ func (m *MsgCreateTSSVoter) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= common.ReceiveStatus(b&0x7F) << shift + m.Status |= chains.ReceiveStatus(b&0x7F) << shift if b < 0x80 { break } @@ -4229,7 +4232,7 @@ func (m *MsgAddToInTxTracker) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift + m.CoinType |= coin.CoinType(b&0x7F) << shift if b < 0x80 { break } @@ -4264,7 +4267,7 @@ func (m *MsgAddToInTxTracker) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Proof == nil { - m.Proof = &common.Proof{} + m.Proof = &proofs.Proof{} } if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -4902,7 +4905,7 @@ func (m *MsgAddToOutTxTracker) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Proof == nil { - m.Proof = &common.Proof{} + m.Proof = &proofs.Proof{} } if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -5633,7 +5636,7 @@ func (m *MsgVoteOnObservedOutboundTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.Status |= common.ReceiveStatus(b&0x7F) << shift + m.Status |= chains.ReceiveStatus(b&0x7F) << shift if b < 0x80 { break } @@ -5690,7 +5693,7 @@ func (m *MsgVoteOnObservedOutboundTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift + m.CoinType |= coin.CoinType(b&0x7F) << shift if b < 0x80 { break } @@ -6151,7 +6154,7 @@ func (m *MsgVoteOnObservedInboundTx) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift + m.CoinType |= coin.CoinType(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/emissions/abci_test.go b/x/emissions/abci_test.go index 207840f79b..65153b377a 100644 --- a/x/emissions/abci_test.go +++ b/x/emissions/abci_test.go @@ -8,7 +8,7 @@ import ( "github.com/cosmos/cosmos-sdk/x/auth/types" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" emissionsModule "github.com/zeta-chain/zetacore/x/emissions" @@ -88,7 +88,7 @@ func TestBeginBlocker(t *testing.T) { }) // Total block rewards is the fixed amount of rewards that are distributed - totalBlockRewards, err := common.GetAzetaDecFromAmountInZeta(emissionstypes.BlockRewardsInZeta) + totalBlockRewards, err := coin.GetAzetaDecFromAmountInZeta(emissionstypes.BlockRewardsInZeta) totalRewardCoins := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, totalBlockRewards.TruncateInt())) require.NoError(t, err) // Fund the emission pool to start the emission process @@ -246,7 +246,7 @@ func TestDistributeObserverRewards(t *testing.T) { zk.ObserverKeeper.SetObserverSet(ctx, observerSet) // Total block rewards is the fixed amount of rewards that are distributed - totalBlockRewards, err := common.GetAzetaDecFromAmountInZeta(emissionstypes.BlockRewardsInZeta) + totalBlockRewards, err := coin.GetAzetaDecFromAmountInZeta(emissionstypes.BlockRewardsInZeta) totalRewardCoins := sdk.NewCoins(sdk.NewCoin(config.BaseDenom, totalBlockRewards.TruncateInt())) require.NoError(t, err) diff --git a/x/emissions/keeper/block_rewards_components.go b/x/emissions/keeper/block_rewards_components.go index fe4140805d..e1eadf66ad 100644 --- a/x/emissions/keeper/block_rewards_components.go +++ b/x/emissions/keeper/block_rewards_components.go @@ -3,7 +3,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/emissions/types" ) @@ -66,7 +66,7 @@ func (k Keeper) GetFixedBlockRewards() (sdk.Dec, error) { } func CalculateFixedValidatorRewards(avgBlockTimeString string) (sdk.Dec, error) { - azetaAmountTotalRewards, err := common.GetAzetaDecFromAmountInZeta(types.BlockRewardsInZeta) + azetaAmountTotalRewards, err := coin.GetAzetaDecFromAmountInZeta(types.BlockRewardsInZeta) if err != nil { return sdk.ZeroDec(), err } diff --git a/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go b/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go index 2be8037801..703b57fd1e 100644 --- a/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go +++ b/x/fungible/client/cli/tx_deploy_fungible_coin_zrc_4.go @@ -3,7 +3,7 @@ package cli import ( "strconv" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/cosmos/cosmos-sdk/client" "github.com/cosmos/cosmos-sdk/client/flags" @@ -50,7 +50,7 @@ func CmdDeployFungibleCoinZRC4() *cobra.Command { uint32(argDecimals), argName, argSymbol, - common.CoinType(argCoinType), + coin.CoinType(argCoinType), argGasLimit, ) diff --git a/x/fungible/keeper/deposits.go b/x/fungible/keeper/deposits.go index 3d8ebfb28b..c7d786db18 100644 --- a/x/fungible/keeper/deposits.go +++ b/x/fungible/keeper/deposits.go @@ -7,7 +7,7 @@ import ( eth "github.com/ethereum/go-ethereum/common" evmtypes "github.com/evmos/ethermint/x/evm/types" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/x/fungible/types" ) @@ -28,35 +28,35 @@ func (k Keeper) ZRC20DepositAndCallContract( amount *big.Int, senderChainID int64, data []byte, - coinType common.CoinType, + coinType coin.CoinType, asset string, ) (*evmtypes.MsgEthereumTxResponse, bool, error) { var ZRC20Contract eth.Address - var coin types.ForeignCoins + var foreignCoin types.ForeignCoins var found bool // get foreign coin - if coinType == common.CoinType_Gas { - coin, found = k.GetGasCoinForForeignCoin(ctx, senderChainID) + if coinType == coin.CoinType_Gas { + foreignCoin, found = k.GetGasCoinForForeignCoin(ctx, senderChainID) if !found { return nil, false, crosschaintypes.ErrGasCoinNotFound } } else { - coin, found = k.GetForeignCoinFromAsset(ctx, asset, senderChainID) + foreignCoin, found = k.GetForeignCoinFromAsset(ctx, asset, senderChainID) if !found { return nil, false, crosschaintypes.ErrForeignCoinNotFound } } - ZRC20Contract = eth.HexToAddress(coin.Zrc20ContractAddress) + ZRC20Contract = eth.HexToAddress(foreignCoin.Zrc20ContractAddress) // check if foreign coin is paused - if coin.Paused { + if foreignCoin.Paused { return nil, false, types.ErrPausedZRC20 } // check foreign coins cap if it has a cap - if !coin.LiquidityCap.IsNil() && !coin.LiquidityCap.IsZero() { - liquidityCap := coin.LiquidityCap.BigInt() + if !foreignCoin.LiquidityCap.IsNil() && !foreignCoin.LiquidityCap.IsZero() { + liquidityCap := foreignCoin.LiquidityCap.BigInt() totalSupply, err := k.TotalSupplyZRC4(ctx, ZRC20Contract) if err != nil { return nil, false, err diff --git a/x/fungible/keeper/deposits_test.go b/x/fungible/keeper/deposits_test.go index bfd3f7eecd..858a8130ce 100644 --- a/x/fungible/keeper/deposits_test.go +++ b/x/fungible/keeper/deposits_test.go @@ -7,7 +7,8 @@ import ( "cosmossdk.io/math" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/testutil/contracts" testkeeper "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" @@ -21,7 +22,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) - chainList := common.DefaultChainsList() + chainList := chains.DefaultChainsList() chain := chainList[0].ChainId // deploy the system contracts @@ -37,7 +38,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { big.NewInt(42), chain, []byte{}, - common.CoinType_Gas, + coin.CoinType_Gas, sample.EthAddress().String(), ) require.NoError(t, err) @@ -52,7 +53,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) - chainList := common.DefaultChainsList() + chainList := chains.DefaultChainsList() chain := chainList[0].ChainId assetAddress := sample.EthAddress().String() @@ -69,7 +70,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { big.NewInt(42), chain, []byte{}, - common.CoinType_ERC20, + coin.CoinType_ERC20, assetAddress, ) require.NoError(t, err) @@ -84,7 +85,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) - chainList := common.DefaultChainsList() + chainList := chains.DefaultChainsList() chain := chainList[0].ChainId assetAddress := sample.EthAddress().String() @@ -101,7 +102,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { big.NewInt(42), chain, []byte("DEADBEEF"), - common.CoinType_ERC20, + coin.CoinType_ERC20, assetAddress, ) require.ErrorIs(t, err, types.ErrCallNonContract) @@ -112,7 +113,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) - chainList := common.DefaultChainsList() + chainList := chains.DefaultChainsList() chain := chainList[0].ChainId // deploy the system contracts @@ -124,10 +125,10 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { require.NoError(t, err) // set a liquidity cap - coin, found := k.GetForeignCoins(ctx, zrc20.String()) + foreignCoin, found := k.GetForeignCoins(ctx, zrc20.String()) require.True(t, found) - coin.LiquidityCap = math.NewUint(initialTotalSupply.Uint64() + 1000) - k.SetForeignCoins(ctx, coin) + foreignCoin.LiquidityCap = math.NewUint(initialTotalSupply.Uint64() + 1000) + k.SetForeignCoins(ctx, foreignCoin) // increase total supply _, err = k.DepositZRC20(ctx, zrc20, sample.EthAddress(), big.NewInt(500)) @@ -142,7 +143,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { big.NewInt(500), chain, []byte{}, - common.CoinType_Gas, + coin.CoinType_Gas, sample.EthAddress().String(), ) require.NoError(t, err) @@ -158,7 +159,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) - chainList := common.DefaultChainsList() + chainList := chains.DefaultChainsList() chain := chainList[0].ChainId // deploy the system contracts @@ -166,10 +167,10 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { zrc20 := setupGasCoin(t, ctx, k, sdkk.EvmKeeper, chain, "foobar", "foobar") // pause the coin - coin, found := k.GetForeignCoins(ctx, zrc20.String()) + foreignCoin, found := k.GetForeignCoins(ctx, zrc20.String()) require.True(t, found) - coin.Paused = true - k.SetForeignCoins(ctx, coin) + foreignCoin.Paused = true + k.SetForeignCoins(ctx, foreignCoin) to := sample.EthAddress() _, _, err := k.ZRC20DepositAndCallContract( @@ -179,7 +180,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { big.NewInt(42), chain, []byte{}, - common.CoinType_Gas, + coin.CoinType_Gas, sample.EthAddress().String(), ) require.ErrorIs(t, err, types.ErrPausedZRC20) @@ -190,7 +191,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) - chainList := common.DefaultChainsList() + chainList := chains.DefaultChainsList() chain := chainList[0].ChainId // deploy the system contracts @@ -202,10 +203,10 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { require.NoError(t, err) // set a liquidity cap - coin, found := k.GetForeignCoins(ctx, zrc20.String()) + foreignCoin, found := k.GetForeignCoins(ctx, zrc20.String()) require.True(t, found) - coin.LiquidityCap = math.NewUint(initialTotalSupply.Uint64() + 1000) - k.SetForeignCoins(ctx, coin) + foreignCoin.LiquidityCap = math.NewUint(initialTotalSupply.Uint64() + 1000) + k.SetForeignCoins(ctx, foreignCoin) // increase total supply _, err = k.DepositZRC20(ctx, zrc20, sample.EthAddress(), big.NewInt(500)) @@ -220,7 +221,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { big.NewInt(501), chain, []byte{}, - common.CoinType_Gas, + coin.CoinType_Gas, sample.EthAddress().String(), ) require.ErrorIs(t, err, types.ErrForeignCoinCapReached) @@ -231,7 +232,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) - chainList := common.DefaultChainsList() + chainList := chains.DefaultChainsList() chain := chainList[0].ChainId // deploy the system contracts @@ -246,7 +247,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { big.NewInt(42), chain, []byte{}, - common.CoinType_Gas, + coin.CoinType_Gas, sample.EthAddress().String(), ) require.ErrorIs(t, err, crosschaintypes.ErrGasCoinNotFound) @@ -256,7 +257,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) - chainList := common.DefaultChainsList() + chainList := chains.DefaultChainsList() chain := chainList[0].ChainId assetAddress := sample.EthAddress().String() @@ -272,7 +273,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { big.NewInt(42), chain, []byte{}, - common.CoinType_ERC20, + coin.CoinType_ERC20, assetAddress, ) require.ErrorIs(t, err, crosschaintypes.ErrForeignCoinNotFound) @@ -283,7 +284,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) - chainList := common.DefaultChainsList() + chainList := chains.DefaultChainsList() chain := chainList[0].ChainId // deploy the system contracts @@ -302,7 +303,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { big.NewInt(42), chain, []byte{}, - common.CoinType_Gas, + coin.CoinType_Gas, sample.EthAddress().String(), ) require.NoError(t, err) @@ -321,7 +322,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { k, ctx, sdkk, _ := testkeeper.FungibleKeeper(t) _ = k.GetAuthKeeper().GetModuleAccount(ctx, types.ModuleName) - chainList := common.DefaultChainsList() + chainList := chains.DefaultChainsList() chain := chainList[0].ChainId // deploy the system contracts @@ -340,7 +341,7 @@ func TestKeeper_ZRC20DepositAndCallContract(t *testing.T) { big.NewInt(42), chain, []byte{}, - common.CoinType_Gas, + coin.CoinType_Gas, sample.EthAddress().String(), ) require.Error(t, err) diff --git a/x/fungible/keeper/evm.go b/x/fungible/keeper/evm.go index 04251028f0..313a1301aa 100644 --- a/x/fungible/keeper/evm.go +++ b/x/fungible/keeper/evm.go @@ -26,7 +26,8 @@ import ( zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" uniswapv2factory "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-core/contracts/uniswapv2factory.sol" uniswapv2router02 "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol" - zetacommon "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/server/config" "github.com/zeta-chain/zetacore/x/fungible/types" zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -89,11 +90,11 @@ func (k Keeper) DeployZRC20Contract( name, symbol string, decimals uint8, chainID int64, - coinType zetacommon.CoinType, + coinType coin.CoinType, erc20Contract string, gasLimit *big.Int, ) (common.Address, error) { - chain := zetacommon.GetChainFromChainID(chainID) + chain := chains.GetChainFromChainID(chainID) if chain == nil { return common.Address{}, cosmoserrors.Wrapf(zetaObserverTypes.ErrSupportedChains, "chain %d not found", chainID) } diff --git a/x/fungible/keeper/evm_test.go b/x/fungible/keeper/evm_test.go index e1af5c041c..8d52742c0c 100644 --- a/x/fungible/keeper/evm_test.go +++ b/x/fungible/keeper/evm_test.go @@ -12,7 +12,8 @@ import ( "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" - zetacommon "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/server/config" "github.com/zeta-chain/zetacore/testutil/contracts" testkeeper "github.com/zeta-chain/zetacore/testutil/keeper" @@ -23,7 +24,7 @@ import ( // get a valid chain id independently of the build flag func getValidChainID(t *testing.T) int64 { - list := zetacommon.DefaultChainsList() + list := chains.DefaultChainsList() require.NotEmpty(t, list) require.NotNil(t, list[0]) @@ -181,7 +182,7 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { "bar", 8, chainID, - zetacommon.CoinType_Gas, + coin.CoinType_Gas, "foobar", big.NewInt(1000), ) @@ -196,7 +197,7 @@ func TestKeeper_DeployZRC20Contract(t *testing.T) { require.Equal(t, uint32(8), foreignCoins.Decimals) require.Equal(t, "foo", foreignCoins.Name) require.Equal(t, "bar", foreignCoins.Symbol) - require.Equal(t, zetacommon.CoinType_Gas, foreignCoins.CoinType) + require.Equal(t, coin.CoinType_Gas, foreignCoins.CoinType) require.Equal(t, uint64(1000), foreignCoins.GasLimit) // can get the zrc20 data diff --git a/x/fungible/keeper/foreign_coins.go b/x/fungible/keeper/foreign_coins.go index 028c961609..ee424e92c1 100644 --- a/x/fungible/keeper/foreign_coins.go +++ b/x/fungible/keeper/foreign_coins.go @@ -4,7 +4,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/fungible/types" ) @@ -82,9 +82,9 @@ func (k Keeper) GetAllForeignCoins(ctx sdk.Context) (list []types.ForeignCoins) // GetGasCoinForForeignCoin returns the gas coin for a given chain func (k Keeper) GetGasCoinForForeignCoin(ctx sdk.Context, chainID int64) (types.ForeignCoins, bool) { foreignCoinList := k.GetAllForeignCoinsForChain(ctx, chainID) - for _, coin := range foreignCoinList { - if coin.CoinType == common.CoinType_Gas { - return coin, true + for _, c := range foreignCoinList { + if c.CoinType == coin.CoinType_Gas { + return c, true } } return types.ForeignCoins{}, false diff --git a/x/fungible/keeper/foreign_coins_test.go b/x/fungible/keeper/foreign_coins_test.go index 0a5a0f37f0..d9a98a4031 100644 --- a/x/fungible/keeper/foreign_coins_test.go +++ b/x/fungible/keeper/foreign_coins_test.go @@ -5,7 +5,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" @@ -38,31 +38,31 @@ func TestKeeper_GetGasCoinForForeignCoin(t *testing.T) { types.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), ForeignChainId: 1, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Name: "foo", }, types.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), ForeignChainId: 1, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Name: "foo", }, types.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), ForeignChainId: 1, - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, Name: "bar", }, types.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), ForeignChainId: 2, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Name: "foo", }, types.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), ForeignChainId: 2, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Name: "foo", }, ) @@ -88,35 +88,35 @@ func TestKeeperGetForeignCoinFromAsset(t *testing.T) { Zrc20ContractAddress: sample.EthAddress().String(), Asset: sample.EthAddress().String(), ForeignChainId: 1, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Name: "foo", }, types.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), Asset: gasAsset, ForeignChainId: 1, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Name: "bar", }, types.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), Asset: sample.EthAddress().String(), ForeignChainId: 1, - CoinType: common.CoinType_Gas, + CoinType: coin.CoinType_Gas, Name: "foo", }, types.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), Asset: sample.EthAddress().String(), ForeignChainId: 2, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Name: "foo", }, types.ForeignCoins{ Zrc20ContractAddress: sample.EthAddress().String(), Asset: sample.EthAddress().String(), ForeignChainId: 2, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Name: "foo", }, ) @@ -142,7 +142,7 @@ func TestKeeperGetForeignCoinFromAsset(t *testing.T) { Zrc20ContractAddress: sample.EthAddress().String(), Asset: "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48", ForeignChainId: 1, - CoinType: common.CoinType_ERC20, + CoinType: coin.CoinType_ERC20, Name: "foo", }, ) diff --git a/x/fungible/keeper/gas_coin_and_pool.go b/x/fungible/keeper/gas_coin_and_pool.go index 7a847f3906..6b06cd8cec 100644 --- a/x/fungible/keeper/gas_coin_and_pool.go +++ b/x/fungible/keeper/gas_coin_and_pool.go @@ -10,7 +10,8 @@ import ( systemcontract "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" uniswapv2router02 "github.com/zeta-chain/protocol-contracts/pkg/uniswap/v2-periphery/contracts/uniswapv2router02.sol" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/fungible/types" zetaObserverTypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -26,7 +27,7 @@ func (k Keeper) SetupChainGasCoinAndPool( decimals uint8, gasLimit *big.Int, ) (ethcommon.Address, error) { - chain := common.GetChainFromChainID(chainID) + chain := chains.GetChainFromChainID(chainID) if chain == nil { return ethcommon.Address{}, zetaObserverTypes.ErrSupportedChains } @@ -43,12 +44,12 @@ func (k Keeper) SetupChainGasCoinAndPool( // default values if transferGasLimit == nil { transferGasLimit = big.NewInt(21_000) - if common.IsBitcoinChain(chain.ChainId) { + if chains.IsBitcoinChain(chain.ChainId) { transferGasLimit = big.NewInt(100) // 100B for a typical tx } } - zrc20Addr, err := k.DeployZRC20Contract(ctx, name, symbol, decimals, chain.ChainId, common.CoinType_Gas, "", transferGasLimit) + zrc20Addr, err := k.DeployZRC20Contract(ctx, name, symbol, decimals, chain.ChainId, coin.CoinType_Gas, "", transferGasLimit) if err != nil { return ethcommon.Address{}, cosmoserrors.Wrapf(err, "failed to DeployZRC20Contract") } diff --git a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go index dece8b65de..27b31aab29 100644 --- a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go +++ b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/ethereum/go-ethereum/common" - zetacommon "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" "github.com/zeta-chain/zetacore/x/fungible/types" ) @@ -45,7 +45,7 @@ func (k msgServer) DeployFungibleCoinZRC20(goCtx context.Context, msg *types.Msg return nil, cosmoserrors.Wrap(sdkerrors.ErrUnauthorized, "Deploy can only be executed by the correct policy account") } - if msg.CoinType == zetacommon.CoinType_Gas { + if msg.CoinType == coin.CoinType_Gas { // #nosec G701 always in range address, err = k.SetupChainGasCoinAndPool(ctx, msg.ForeignChainId, msg.Name, msg.Symbol, uint8(msg.Decimals), big.NewInt(msg.GasLimit)) if err != nil { diff --git a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go index 0413c6d239..75ec3f4d08 100644 --- a/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go +++ b/x/fungible/keeper/msg_server_deploy_fungible_coin_zrc20_test.go @@ -7,7 +7,7 @@ import ( sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -39,7 +39,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { 8, "foo", "foo", - common.CoinType_Gas, + coin.CoinType_Gas, 1000000, )) require.NoError(t, err) @@ -49,7 +49,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { // can retrieve the gas coin foreignCoin, found := k.GetForeignCoins(ctx, gasAddress) require.True(t, found) - require.Equal(t, foreignCoin.CoinType, common.CoinType_Gas) + require.Equal(t, foreignCoin.CoinType, coin.CoinType_Gas) require.Contains(t, foreignCoin.Name, "foo") // check gas limit @@ -71,7 +71,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { 8, "bar", "bar", - common.CoinType_ERC20, + coin.CoinType_ERC20, 2000000, )) require.NoError(t, err) @@ -79,7 +79,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { foreignCoin, found = k.GetForeignCoins(ctx, res.Address) require.True(t, found) - require.Equal(t, foreignCoin.CoinType, common.CoinType_ERC20) + require.Equal(t, foreignCoin.CoinType, coin.CoinType_ERC20) require.Contains(t, foreignCoin.Name, "bar") // check gas limit @@ -115,7 +115,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { 8, "foo", "foo", - common.CoinType_Gas, + coin.CoinType_Gas, 1000000, )) require.Error(t, err) @@ -142,7 +142,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { 78, "foo", "foo", - common.CoinType_Gas, + coin.CoinType_Gas, 1000000, )) require.Error(t, err) @@ -169,7 +169,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { 8, "foo", "foo", - common.CoinType_Gas, + coin.CoinType_Gas, 1000000, )) require.Error(t, err) @@ -196,7 +196,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { 8, "foo", "foo", - common.CoinType_Gas, + coin.CoinType_Gas, 1000000, ) @@ -213,7 +213,7 @@ func TestMsgServer_DeployFungibleCoinZRC20(t *testing.T) { require.ErrorIs(t, err, types.ErrForeignCoinAlreadyExist) // Similar to above, redeploying existing erc20 should also fail - deployMsg.CoinType = common.CoinType_ERC20 + deployMsg.CoinType = coin.CoinType_ERC20 keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupAdmin, true) _, err = keeper.NewMsgServerImpl(*k).DeployFungibleCoinZRC20(ctx, deployMsg) diff --git a/x/fungible/keeper/msg_server_update_contract_bytecode_test.go b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go index 530d23b306..48f7db6b6c 100644 --- a/x/fungible/keeper/msg_server_update_contract_bytecode_test.go +++ b/x/fungible/keeper/msg_server_update_contract_bytecode_test.go @@ -11,7 +11,8 @@ import ( "github.com/evmos/ethermint/x/evm/statedb" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" - zetacommon "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -39,7 +40,7 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { authorityMock := keepertest.GetFungibleAuthorityMock(t, k) // sample chainIDs and addresses - chainList := zetacommon.DefaultChainsList() + chainList := chains.DefaultChainsList() require.True(t, len(chainList) > 1) require.NotNil(t, chainList[0]) require.NotNil(t, chainList[1]) @@ -86,7 +87,7 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { "BETA", 18, chainID2, - zetacommon.CoinType_ERC20, + coin.CoinType_ERC20, "beta", big.NewInt(90_000), ) @@ -132,7 +133,7 @@ func TestKeeper_UpdateContractBytecode(t *testing.T) { "GAMMA", 18, chainID1, - zetacommon.CoinType_ERC20, + coin.CoinType_ERC20, "gamma", big.NewInt(90_000), ) diff --git a/x/fungible/keeper/msg_server_update_system_contract.go b/x/fungible/keeper/msg_server_update_system_contract.go index 3e76f9abb2..bda5373c3c 100644 --- a/x/fungible/keeper/msg_server_update_system_contract.go +++ b/x/fungible/keeper/msg_server_update_system_contract.go @@ -10,7 +10,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" "github.com/zeta-chain/zetacore/x/fungible/types" ) @@ -47,7 +47,7 @@ func (k msgServer) UpdateSystemContract(goCtx context.Context, msg *types.MsgUpd if err != nil { return nil, cosmoserrors.Wrapf(types.ErrContractCall, "failed to call zrc20 contract method updateSystemContractAddress (%s)", err.Error()) } - if fcoin.CoinType == common.CoinType_Gas { + if fcoin.CoinType == coin.CoinType_Gas { _, err = k.CallEVM(tmpCtx, *sysABI, types.ModuleAddressEVM, newSystemContractAddr, BigIntZero, nil, true, false, "setGasCoinZRC20", big.NewInt(fcoin.ForeignChainId), zrc20Addr) if err != nil { return nil, cosmoserrors.Wrapf(types.ErrContractCall, "failed to call system contract method setGasCoinZRC20 (%s)", err.Error()) diff --git a/x/fungible/keeper/msg_server_update_system_contract_test.go b/x/fungible/keeper/msg_server_update_system_contract_test.go index 60ae69dc80..f66ccd1643 100644 --- a/x/fungible/keeper/msg_server_update_system_contract_test.go +++ b/x/fungible/keeper/msg_server_update_system_contract_test.go @@ -10,7 +10,7 @@ import ( "github.com/stretchr/testify/require" "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/systemcontract.sol" zrc20 "github.com/zeta-chain/protocol-contracts/pkg/contracts/zevm/zrc20.sol" - zetacommon "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -43,7 +43,7 @@ func TestKeeper_UpdateSystemContract(t *testing.T) { return address.Hex() } - chains := zetacommon.DefaultChainsList() + chains := chains.DefaultChainsList() require.True(t, len(chains) > 1) require.NotNil(t, chains[0]) require.NotNil(t, chains[1]) @@ -193,7 +193,7 @@ func TestKeeper_UpdateSystemContract(t *testing.T) { admin := sample.AccAddress() authorityMock := keepertest.GetFungibleAuthorityMock(t, k) - chains := zetacommon.DefaultChainsList() + chains := chains.DefaultChainsList() require.True(t, len(chains) > 1) require.NotNil(t, chains[0]) chainID1 := chains[0].ChainId diff --git a/x/fungible/types/events.pb.go b/x/fungible/types/events.pb.go index 3216373f9a..b6e51845c2 100644 --- a/x/fungible/types/events.pb.go +++ b/x/fungible/types/events.pb.go @@ -11,7 +11,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + coin "github.com/zeta-chain/zetacore/pkg/coin" ) // Reference imports to suppress errors if they are not otherwise used. @@ -94,15 +94,15 @@ func (m *EventSystemContractUpdated) GetSigner() string { } type EventZRC20Deployed struct { - MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"` - Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` - Symbol string `protobuf:"bytes,5,opt,name=symbol,proto3" json:"symbol,omitempty"` - Decimals int64 `protobuf:"varint,6,opt,name=decimals,proto3" json:"decimals,omitempty"` - CoinType common.CoinType `protobuf:"varint,7,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` - Erc20 string `protobuf:"bytes,8,opt,name=erc20,proto3" json:"erc20,omitempty"` - GasLimit int64 `protobuf:"varint,9,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + Contract string `protobuf:"bytes,3,opt,name=contract,proto3" json:"contract,omitempty"` + Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,5,opt,name=symbol,proto3" json:"symbol,omitempty"` + Decimals int64 `protobuf:"varint,6,opt,name=decimals,proto3" json:"decimals,omitempty"` + CoinType coin.CoinType `protobuf:"varint,7,opt,name=coin_type,json=coinType,proto3,enum=coin.CoinType" json:"coin_type,omitempty"` + Erc20 string `protobuf:"bytes,8,opt,name=erc20,proto3" json:"erc20,omitempty"` + GasLimit int64 `protobuf:"varint,9,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` } func (m *EventZRC20Deployed) Reset() { *m = EventZRC20Deployed{} } @@ -180,11 +180,11 @@ func (m *EventZRC20Deployed) GetDecimals() int64 { return 0 } -func (m *EventZRC20Deployed) GetCoinType() common.CoinType { +func (m *EventZRC20Deployed) GetCoinType() coin.CoinType { if m != nil { return m.CoinType } - return common.CoinType_Zeta + return coin.CoinType_Zeta } func (m *EventZRC20Deployed) GetErc20() string { @@ -202,15 +202,15 @@ func (m *EventZRC20Deployed) GetGasLimit() int64 { } type EventZRC20WithdrawFeeUpdated struct { - MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` - ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` - CoinType common.CoinType `protobuf:"varint,3,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` - Zrc20Address string `protobuf:"bytes,4,opt,name=zrc20_address,json=zrc20Address,proto3" json:"zrc20_address,omitempty"` - OldWithdrawFee string `protobuf:"bytes,5,opt,name=old_withdraw_fee,json=oldWithdrawFee,proto3" json:"old_withdraw_fee,omitempty"` - NewWithdrawFee string `protobuf:"bytes,6,opt,name=new_withdraw_fee,json=newWithdrawFee,proto3" json:"new_withdraw_fee,omitempty"` - Signer string `protobuf:"bytes,7,opt,name=signer,proto3" json:"signer,omitempty"` - OldGasLimit string `protobuf:"bytes,8,opt,name=old_gas_limit,json=oldGasLimit,proto3" json:"old_gas_limit,omitempty"` - NewGasLimit string `protobuf:"bytes,9,opt,name=new_gas_limit,json=newGasLimit,proto3" json:"new_gas_limit,omitempty"` + MsgTypeUrl string `protobuf:"bytes,1,opt,name=msg_type_url,json=msgTypeUrl,proto3" json:"msg_type_url,omitempty"` + ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` + CoinType coin.CoinType `protobuf:"varint,3,opt,name=coin_type,json=coinType,proto3,enum=coin.CoinType" json:"coin_type,omitempty"` + Zrc20Address string `protobuf:"bytes,4,opt,name=zrc20_address,json=zrc20Address,proto3" json:"zrc20_address,omitempty"` + OldWithdrawFee string `protobuf:"bytes,5,opt,name=old_withdraw_fee,json=oldWithdrawFee,proto3" json:"old_withdraw_fee,omitempty"` + NewWithdrawFee string `protobuf:"bytes,6,opt,name=new_withdraw_fee,json=newWithdrawFee,proto3" json:"new_withdraw_fee,omitempty"` + Signer string `protobuf:"bytes,7,opt,name=signer,proto3" json:"signer,omitempty"` + OldGasLimit string `protobuf:"bytes,8,opt,name=old_gas_limit,json=oldGasLimit,proto3" json:"old_gas_limit,omitempty"` + NewGasLimit string `protobuf:"bytes,9,opt,name=new_gas_limit,json=newGasLimit,proto3" json:"new_gas_limit,omitempty"` } func (m *EventZRC20WithdrawFeeUpdated) Reset() { *m = EventZRC20WithdrawFeeUpdated{} } @@ -260,11 +260,11 @@ func (m *EventZRC20WithdrawFeeUpdated) GetChainId() int64 { return 0 } -func (m *EventZRC20WithdrawFeeUpdated) GetCoinType() common.CoinType { +func (m *EventZRC20WithdrawFeeUpdated) GetCoinType() coin.CoinType { if m != nil { return m.CoinType } - return common.CoinType_Zeta + return coin.CoinType_Zeta } func (m *EventZRC20WithdrawFeeUpdated) GetZrc20Address() string { @@ -557,55 +557,55 @@ func init() { func init() { proto.RegisterFile("fungible/events.proto", fileDescriptor_858e6494730deffd) } var fileDescriptor_858e6494730deffd = []byte{ - // 756 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xdf, 0x6e, 0xd3, 0x3e, - 0x14, 0x5e, 0xd6, 0xad, 0x5b, 0xbd, 0x3f, 0xed, 0xfc, 0xeb, 0x0f, 0x85, 0x0e, 0xaa, 0xa9, 0x08, - 0x31, 0x26, 0xd6, 0x4c, 0x45, 0x3c, 0xc0, 0x36, 0x18, 0x4c, 0x02, 0x09, 0x75, 0x0c, 0xa4, 0xdd, - 0x44, 0x6e, 0x72, 0x96, 0x46, 0x4a, 0xec, 0x2a, 0x76, 0x9b, 0x65, 0x4f, 0xc1, 0x1d, 0x3c, 0x0b, - 0x4f, 0xc0, 0xe5, 0x10, 0x37, 0x5c, 0xa2, 0xf5, 0x45, 0x90, 0x1d, 0x27, 0x6d, 0x86, 0x36, 0xb6, - 0xab, 0xfa, 0xb8, 0xdf, 0x39, 0xe7, 0xf3, 0xe7, 0xcf, 0x27, 0xe8, 0xff, 0xd3, 0x21, 0xf5, 0xfc, - 0x5e, 0x00, 0x16, 0x8c, 0x80, 0x0a, 0xde, 0x1e, 0x44, 0x4c, 0x30, 0xbc, 0x7e, 0x0e, 0x82, 0x38, - 0x7d, 0xe2, 0xd3, 0xb6, 0x5a, 0xb1, 0x08, 0xda, 0x19, 0xb2, 0xf1, 0x9f, 0xc3, 0xc2, 0x90, 0x51, - 0x2b, 0xfd, 0x49, 0x33, 0x1a, 0x6b, 0x79, 0x21, 0x71, 0xa6, 0xb7, 0xea, 0x1e, 0xf3, 0x98, 0x5a, - 0x5a, 0x72, 0x95, 0xee, 0xb6, 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f8, 0x7d, 0xd9, 0x34, 0x3e, 0x8f, 0x9b, 0x33, - 0x17, 0xe3, 0xe6, 0xcc, 0xaf, 0x71, 0x73, 0xe6, 0xc4, 0xf2, 0x7c, 0xd1, 0x1f, 0xf6, 0xe4, 0xcb, - 0xb6, 0xe4, 0xa5, 0x6c, 0x2b, 0xb3, 0x59, 0x99, 0xd9, 0xac, 0x33, 0x6b, 0xf2, 0x95, 0x49, 0x06, - 0xc0, 0x7b, 0x65, 0xf5, 0x4d, 0x79, 0xfe, 0x27, 0x00, 0x00, 0xff, 0xff, 0x50, 0x31, 0x7b, 0x39, - 0xc7, 0x06, 0x00, 0x00, + // 761 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x55, 0xd1, 0x4e, 0xdb, 0x48, + 0x14, 0xc5, 0x04, 0x02, 0x19, 0x20, 0x81, 0xd9, 0xec, 0xca, 0x1b, 0x76, 0x23, 0x94, 0xd5, 0x6a, + 0x59, 0xda, 0xc6, 0x28, 0x55, 0x3f, 0x00, 0x68, 0x69, 0x91, 0x5a, 0xa9, 0x0a, 0xa5, 0x95, 0x78, + 0xb1, 0x26, 0xf6, 0xc5, 0xb1, 0x6a, 0xcf, 0x58, 0x9e, 0x49, 0x8c, 0xf9, 0x8a, 0xbe, 0x54, 0xea, + 0xb7, 0xf4, 0x0b, 0xfa, 0x48, 0xd5, 0x97, 0x3e, 0xb6, 0xf0, 0x23, 0xd5, 0x8c, 0xc7, 0x4e, 0x4c, + 0x05, 0x85, 0x97, 0x68, 0xee, 0xe4, 0xdc, 0x7b, 0xcf, 0x9c, 0x39, 0x73, 0x8d, 0x7e, 0x3f, 0x19, + 0x51, 0xcf, 0x1f, 0x04, 0x60, 0xc1, 0x18, 0xa8, 0xe0, 0xdd, 0x28, 0x66, 0x82, 0xe1, 0xf5, 0x33, + 0x10, 0xc4, 0x19, 0x12, 0x9f, 0x76, 0xd5, 0x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a1, 0xd6, 0xa6, 0x41, 0x21, 0xc9, 0x7b, 0x3f, 0x23, + 0x7c, 0x28, 0xb1, 0xd2, 0xc8, 0x65, 0xac, 0x56, 0x89, 0x05, 0x6e, 0x09, 0x3b, 0x39, 0xd5, 0xfc, + 0xf4, 0xa9, 0x76, 0x0f, 0x3e, 0x5d, 0xb4, 0x8d, 0xf3, 0x8b, 0xb6, 0xf1, 0xed, 0xa2, 0x6d, 0xbc, + 0xbb, 0x6c, 0xcf, 0x9c, 0x5f, 0xb6, 0x67, 0xbe, 0x5e, 0xb6, 0x67, 0x8e, 0x2d, 0xcf, 0x17, 0xc3, + 0xd1, 0xa0, 0xeb, 0xb0, 0xd0, 0x92, 0x97, 0xf2, 0x40, 0x99, 0xcd, 0xca, 0xcd, 0x66, 0x9d, 0x5a, + 0x93, 0xcf, 0x4e, 0x1a, 0x01, 0x1f, 0x54, 0xd5, 0xf7, 0xe4, 0xe1, 0x8f, 0x00, 0x00, 0x00, 0xff, + 0xff, 0xbf, 0x18, 0x8d, 0x7b, 0xc3, 0x06, 0x00, 0x00, } func (m *EventSystemContractUpdated) Marshal() (dAtA []byte, err error) { @@ -1605,7 +1605,7 @@ func (m *EventZRC20Deployed) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift + m.CoinType |= coin.CoinType(b&0x7F) << shift if b < 0x80 { break } @@ -1776,7 +1776,7 @@ func (m *EventZRC20WithdrawFeeUpdated) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift + m.CoinType |= coin.CoinType(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/fungible/types/expected_keepers.go b/x/fungible/types/expected_keepers.go index 5ffc04c723..f1064b0476 100644 --- a/x/fungible/types/expected_keepers.go +++ b/x/fungible/types/expected_keepers.go @@ -11,7 +11,7 @@ import ( "github.com/ethereum/go-ethereum/core/vm" "github.com/evmos/ethermint/x/evm/statedb" evmtypes "github.com/evmos/ethermint/x/evm/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" ) @@ -31,7 +31,7 @@ type BankKeeper interface { } type ObserverKeeper interface { - GetSupportedChains(ctx sdk.Context) []*common.Chain + GetSupportedChains(ctx sdk.Context) []*chains.Chain } type EVMKeeper interface { diff --git a/x/fungible/types/foreign_coins.pb.go b/x/fungible/types/foreign_coins.pb.go index dd834ae48d..05a014fa47 100644 --- a/x/fungible/types/foreign_coins.pb.go +++ b/x/fungible/types/foreign_coins.pb.go @@ -12,7 +12,7 @@ import ( github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + coin "github.com/zeta-chain/zetacore/pkg/coin" ) // Reference imports to suppress errors if they are not otherwise used. @@ -27,14 +27,14 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ForeignCoins struct { - // string index = 1; + // string index = 1; Zrc20ContractAddress string `protobuf:"bytes,2,opt,name=zrc20_contract_address,json=zrc20ContractAddress,proto3" json:"zrc20_contract_address,omitempty"` Asset string `protobuf:"bytes,3,opt,name=asset,proto3" json:"asset,omitempty"` ForeignChainId int64 `protobuf:"varint,4,opt,name=foreign_chain_id,json=foreignChainId,proto3" json:"foreign_chain_id,omitempty"` Decimals uint32 `protobuf:"varint,5,opt,name=decimals,proto3" json:"decimals,omitempty"` Name string `protobuf:"bytes,6,opt,name=name,proto3" json:"name,omitempty"` Symbol string `protobuf:"bytes,7,opt,name=symbol,proto3" json:"symbol,omitempty"` - CoinType common.CoinType `protobuf:"varint,8,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` + CoinType coin.CoinType `protobuf:"varint,8,opt,name=coin_type,json=coinType,proto3,enum=coin.CoinType" json:"coin_type,omitempty"` GasLimit uint64 `protobuf:"varint,9,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` Paused bool `protobuf:"varint,10,opt,name=paused,proto3" json:"paused,omitempty"` LiquidityCap github_com_cosmos_cosmos_sdk_types.Uint `protobuf:"bytes,11,opt,name=liquidity_cap,json=liquidityCap,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Uint" json:"liquidity_cap"` @@ -115,11 +115,11 @@ func (m *ForeignCoins) GetSymbol() string { return "" } -func (m *ForeignCoins) GetCoinType() common.CoinType { +func (m *ForeignCoins) GetCoinType() coin.CoinType { if m != nil { return m.CoinType } - return common.CoinType_Zeta + return coin.CoinType_Zeta } func (m *ForeignCoins) GetGasLimit() uint64 { @@ -143,33 +143,34 @@ func init() { func init() { proto.RegisterFile("fungible/foreign_coins.proto", fileDescriptor_5285bb476cecbbf8) } var fileDescriptor_5285bb476cecbbf8 = []byte{ - // 416 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x52, 0xc1, 0x6e, 0xd4, 0x30, - 0x14, 0x5c, 0xb3, 0xdb, 0x25, 0x6b, 0xda, 0xaa, 0x32, 0xab, 0xca, 0xda, 0xa2, 0x34, 0xe2, 0x42, - 0x2e, 0x1b, 0xa3, 0xc2, 0x0f, 0xd0, 0x48, 0x48, 0x95, 0x38, 0x45, 0xe5, 0xc2, 0x25, 0x72, 0x6c, - 0x37, 0xb5, 0x48, 0xec, 0x10, 0x3b, 0x12, 0xe9, 0x07, 0x70, 0xe6, 0xb3, 0x7a, 0xec, 0x11, 0x71, - 0xa8, 0xd0, 0xee, 0x8f, 0x20, 0x3b, 0x69, 0xd4, 0x93, 0x67, 0xe6, 0xc5, 0xf3, 0x26, 0xef, 0x19, - 0xbe, 0xb9, 0xe9, 0x54, 0x29, 0x8b, 0x4a, 0x90, 0x1b, 0xdd, 0x0a, 0x59, 0xaa, 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b8, 0x2a, 0xa9, 0xc9, 0x2b, 0x59, 0x4b, 0x8b, 0x57, 0x11, 0x88, 0x17, 0x59, 0x50, 0x52, - 0xf3, 0xc5, 0x71, 0xd7, 0xa3, 0xa1, 0x9d, 0x11, 0x1c, 0xc3, 0x08, 0xc4, 0x41, 0x36, 0x32, 0x74, - 0x0d, 0x8f, 0x2a, 0xf9, 0xa3, 0x93, 0x5c, 0xda, 0x3e, 0x67, 0xb4, 0xc1, 0xaf, 0x5c, 0x84, 0x4b, - 0x72, 0xff, 0x78, 0x3e, 0xfb, 0xfb, 0x78, 0xfe, 0xae, 0x94, 0xf6, 0xb6, 0x2b, 0x5c, 0x57, 0xc2, - 0xb4, 0xa9, 0xb5, 0x19, 0x8f, 0xad, 0xe1, 0xdf, 0x89, 0x0b, 0x66, 0x92, 0xaf, 0x52, 0xd9, 0xec, - 0x70, 0x72, 0x49, 0x69, 0x73, 0x79, 0x75, 0xbf, 0x0b, 0xc1, 0xc3, 0x2e, 0x04, 0xff, 0x76, 0x21, - 0xf8, 0xbd, 0x0f, 0x67, 0x0f, 0xfb, 0x70, 0xf6, 0x67, 0x1f, 0xce, 0xbe, 0x91, 0x67, 0x86, 0x6e, - 0xd7, 0x5b, 0x3f, 0x4b, 0xf2, 0xb4, 0x76, 0xf2, 0x93, 0x4c, 0x2f, 0xc5, 0xbb, 0x17, 0x4b, 0xbf, - 0xda, 0x0f, 0xff, 0x03, 0x00, 0x00, 0xff, 0xff, 0x1b, 0xf5, 0xe7, 0x49, 0x42, 0x02, 0x00, 0x00, + // 418 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x4c, 0x52, 0xc1, 0x6a, 0xdc, 0x30, + 0x14, 0x5c, 0x75, 0x37, 0x5b, 0xaf, 0x9a, 0x2c, 0x45, 0x5d, 0x82, 0xd8, 0x14, 0xc7, 0xf4, 0x52, + 0x43, 0x89, 0x55, 0xd2, 0xfe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xbb, 0x17, + 0x4b, 0xbf, 0xd8, 0x0f, 0xff, 0x02, 0x00, 0x00, 0xff, 0xff, 0x6a, 0xca, 0x24, 0xbf, 0x40, 0x02, + 0x00, 0x00, } func (m *ForeignCoins) Marshal() (dAtA []byte, err error) { @@ -531,7 +532,7 @@ func (m *ForeignCoins) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift + m.CoinType |= coin.CoinType(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/fungible/types/message_deploy_fungible_coin_zrc20.go b/x/fungible/types/message_deploy_fungible_coin_zrc20.go index 1f695e63cb..6103b6ef35 100644 --- a/x/fungible/types/message_deploy_fungible_coin_zrc20.go +++ b/x/fungible/types/message_deploy_fungible_coin_zrc20.go @@ -4,14 +4,14 @@ import ( cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" ) const TypeMsgDeployFungibleCoinZRC20 = "deploy_fungible_coin_zrc_20" var _ sdk.Msg = &MsgDeployFungibleCoinZRC20{} -func NewMsgDeployFungibleCoinZRC20(creator string, ERC20 string, foreignChainID int64, decimals uint32, name string, symbol string, coinType common.CoinType, gasLimit int64) *MsgDeployFungibleCoinZRC20 { +func NewMsgDeployFungibleCoinZRC20(creator string, ERC20 string, foreignChainID int64, decimals uint32, name string, symbol string, coinType coin.CoinType, gasLimit int64) *MsgDeployFungibleCoinZRC20 { return &MsgDeployFungibleCoinZRC20{ Creator: creator, ERC20: ERC20, diff --git a/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go b/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go index 4450dffff4..99b7ea9886 100644 --- a/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go +++ b/x/fungible/types/message_deploy_fungible_coin_zrc20_test.go @@ -7,7 +7,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/fungible/types" ) @@ -27,7 +27,7 @@ func TestMsgDeployFungibleCoinZRC4_ValidateBasic(t *testing.T) { 6, "test", "test", - common.CoinType_ERC20, + coin.CoinType_ERC20, 10, ), err: sdkerrors.ErrInvalidAddress, @@ -41,7 +41,7 @@ func TestMsgDeployFungibleCoinZRC4_ValidateBasic(t *testing.T) { 6, "test", "test", - common.CoinType_ERC20, + coin.CoinType_ERC20, -1, ), err: sdkerrors.ErrInvalidGasLimit, @@ -55,7 +55,7 @@ func TestMsgDeployFungibleCoinZRC4_ValidateBasic(t *testing.T) { 78, "test", "test", - common.CoinType_ERC20, + coin.CoinType_ERC20, 10, ), err: cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "decimals must be less than 78"), @@ -69,7 +69,7 @@ func TestMsgDeployFungibleCoinZRC4_ValidateBasic(t *testing.T) { 6, "test", "test", - common.CoinType_ERC20, + coin.CoinType_ERC20, 10, ), }, diff --git a/x/fungible/types/tx.pb.go b/x/fungible/types/tx.pb.go index 35820af781..a4db855245 100644 --- a/x/fungible/types/tx.pb.go +++ b/x/fungible/types/tx.pb.go @@ -14,7 +14,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + coin "github.com/zeta-chain/zetacore/pkg/coin" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -355,14 +355,14 @@ func (m *MsgUpdateSystemContractResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdateSystemContractResponse proto.InternalMessageInfo type MsgDeployFungibleCoinZRC20 struct { - Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` - ERC20 string `protobuf:"bytes,2,opt,name=ERC20,proto3" json:"ERC20,omitempty"` - ForeignChainId int64 `protobuf:"varint,3,opt,name=foreign_chain_id,json=foreignChainId,proto3" json:"foreign_chain_id,omitempty"` - Decimals uint32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty"` - Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` - Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"` - CoinType common.CoinType `protobuf:"varint,7,opt,name=coin_type,json=coinType,proto3,enum=common.CoinType" json:"coin_type,omitempty"` - GasLimit int64 `protobuf:"varint,8,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ERC20 string `protobuf:"bytes,2,opt,name=ERC20,proto3" json:"ERC20,omitempty"` + ForeignChainId int64 `protobuf:"varint,3,opt,name=foreign_chain_id,json=foreignChainId,proto3" json:"foreign_chain_id,omitempty"` + Decimals uint32 `protobuf:"varint,4,opt,name=decimals,proto3" json:"decimals,omitempty"` + Name string `protobuf:"bytes,5,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,6,opt,name=symbol,proto3" json:"symbol,omitempty"` + CoinType coin.CoinType `protobuf:"varint,7,opt,name=coin_type,json=coinType,proto3,enum=coin.CoinType" json:"coin_type,omitempty"` + GasLimit int64 `protobuf:"varint,8,opt,name=gas_limit,json=gasLimit,proto3" json:"gas_limit,omitempty"` } func (m *MsgDeployFungibleCoinZRC20) Reset() { *m = MsgDeployFungibleCoinZRC20{} } @@ -440,11 +440,11 @@ func (m *MsgDeployFungibleCoinZRC20) GetSymbol() string { return "" } -func (m *MsgDeployFungibleCoinZRC20) GetCoinType() common.CoinType { +func (m *MsgDeployFungibleCoinZRC20) GetCoinType() coin.CoinType { if m != nil { return m.CoinType } - return common.CoinType_Zeta + return coin.CoinType_Zeta } func (m *MsgDeployFungibleCoinZRC20) GetGasLimit() int64 { @@ -890,70 +890,70 @@ func init() { func init() { proto.RegisterFile("fungible/tx.proto", fileDescriptor_197fdedece277fa0) } var fileDescriptor_197fdedece277fa0 = []byte{ - // 998 bytes of a gzipped FileDescriptorProto + // 1001 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x57, 0x5d, 0x6f, 0xdb, 0x54, - 0x18, 0xae, 0xdb, 0xf5, 0x23, 0xef, 0x96, 0x34, 0x3b, 0x84, 0xcd, 0xa4, 0x28, 0xdd, 0xbc, 0x89, - 0x95, 0x49, 0x8d, 0x47, 0x18, 0x4c, 0x48, 0x6c, 0xa8, 0xcd, 0x5a, 0x98, 0xb4, 0xa0, 0xc9, 0x5d, - 0x87, 0xe8, 0x8d, 0x75, 0x6a, 0x9f, 0x3a, 0x16, 0xf1, 0x39, 0xc6, 0xe7, 0x84, 0x2c, 0xbb, 0x43, - 0xe2, 0xaa, 0x12, 0x68, 0x12, 0xff, 0x03, 0x89, 0x7f, 0xb1, 0xcb, 0x5d, 0x22, 0x84, 0x26, 0xd4, - 0xfe, 0x11, 0xe4, 0xe3, 0x8f, 0x3a, 0x1f, 0x4e, 0x9b, 0x70, 0x95, 0x73, 0xde, 0xbc, 0xef, 0xe3, - 0xe7, 0xfd, 0x7a, 0x9c, 0xc0, 0xd5, 0xa3, 0x2e, 0x75, 0xdc, 0xc3, 0x0e, 0xd1, 0xc5, 0xcb, 0xba, - 0x1f, 0x30, 0xc1, 0xd0, 0xda, 0x2b, 0x22, 0xb0, 0xd5, 0xc6, 0x2e, 0xad, 0xcb, 0x13, 0x0b, 0x48, - 0x3d, 0xf1, 0xaa, 0xbe, 0x67, 0x31, 0xcf, 0x63, 0x54, 0x8f, 0x3e, 0xa2, 0x88, 0x6a, 0xc5, 0x61, - 0x0e, 0x93, 0x47, 0x3d, 0x3c, 0x45, 0x56, 0xed, 0x3e, 0xa8, 0x2d, 0xee, 0x3c, 0x26, 0x7e, 0x87, - 0xf5, 0xf7, 0xfa, 0x5c, 0x10, 0xaf, 0xc9, 0xa8, 0x08, 0xb0, 0x25, 0x38, 0x52, 0x61, 0xd9, 0x0a, - 0x08, 0x16, 0x2c, 0x50, 0x95, 0x1b, 0xca, 0x46, 0xc1, 0x48, 0xae, 0xda, 0x3f, 0x0a, 0xdc, 0xc8, - 0x0b, 0x33, 0x08, 0xf7, 0x19, 0xe5, 0x04, 0xdd, 0x85, 0x72, 0x97, 0xba, 0xbc, 0x87, 0xfd, 0x17, - 0x8d, 0x5d, 0x6c, 0x09, 0x16, 0xf4, 0x63, 0x9c, 0x11, 0x3b, 0xaa, 0xc0, 0x62, 0x2f, 0xcc, 0x43, - 0x9d, 0x97, 0x0e, 0xd1, 0x05, 0x6d, 0xc0, 0x6a, 0xea, 0x69, 0xb0, 0xae, 0x20, 0x81, 0xba, 0x20, - 0xbf, 0x1f, 0x36, 0xa3, 0xdb, 0x50, 0xb4, 0x18, 0xa5, 0x24, 0x44, 0x3b, 0xd8, 0x79, 0xd1, 0x52, - 0x2f, 0x49, 0xbf, 0x41, 0x23, 0xfa, 0x08, 0x4a, 0x7c, 0x80, 0xac, 0xba, 0x28, 0xdd, 0x86, 0xac, - 0xda, 0xf1, 0x3c, 0x7c, 0xd0, 0xe2, 0xce, 0xbe, 0x6f, 0x63, 0x41, 0x0e, 0x8c, 0x66, 0xe3, 0xde, - 0x77, 0xae, 0x68, 0xdb, 0x01, 0xee, 0xed, 0x12, 0x92, 0x5f, 0x16, 0x74, 0x0b, 0x8a, 0xaf, 0x02, - 0xab, 0x71, 0xcf, 0xc4, 0xb6, 0x1d, 0x10, 0xce, 0xe3, 0x6c, 0xae, 0x48, 0xe3, 0x56, 0x64, 0x43, - 0xdf, 0x43, 0x99, 0x92, 0x9e, 0xd9, 0x8b, 0x11, 0xcd, 0x23, 0x42, 0xd4, 0xa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, 0x67, 0x4f, 0x9e, 0xd1, 0x35, 0x58, 0xe2, 0x7d, 0xef, 0x90, 0x75, 0xa2, 0x51, 0x30, - 0xe2, 0x1b, 0xda, 0x84, 0x82, 0xc5, 0x5c, 0x6a, 0x86, 0xcd, 0x91, 0xdd, 0x2c, 0x35, 0xca, 0xf5, - 0x78, 0xad, 0xc3, 0x3c, 0x9e, 0xf7, 0x7d, 0x62, 0xac, 0x58, 0xf1, 0x09, 0xad, 0x41, 0xe1, 0xac, - 0xf9, 0x2b, 0x92, 0xd9, 0x8a, 0x93, 0x34, 0xf2, 0x11, 0x68, 0xf9, 0xb5, 0x48, 0xb7, 0x56, 0x85, - 0xe5, 0xa4, 0x01, 0x71, 0x4d, 0xe2, 0xab, 0xf6, 0x18, 0x2a, 0x2d, 0xee, 0x18, 0xc4, 0x63, 0x3f, - 0x91, 0xdd, 0x38, 0x5d, 0xe6, 0xd2, 0x09, 0x55, 0x4c, 0x32, 0x9d, 0x3f, 0xcb, 0x54, 0xab, 0xc1, - 0x87, 0xe3, 0x50, 0xd2, 0x96, 0xfd, 0xa2, 0x64, 0x76, 0x2f, 0x69, 0xe8, 0x76, 0x5f, 0x10, 0x8b, - 0xd9, 0x93, 0x76, 0xef, 0x63, 0x28, 0xe7, 0x4c, 0xd0, 0xaa, 0x35, 0x38, 0x38, 0x48, 0x8b, 0xd6, - 0x24, 0x04, 0x34, 0xdb, 0x98, 0xb7, 0x63, 0x51, 0x09, 0xa7, 0xbe, 0xc9, 0x6c, 0xf2, 0x0d, 0xe6, - 0xed, 0x81, 0xa9, 0x1f, 0x66, 0x91, 0x72, 0xfd, 0x43, 0x91, 0xe3, 0x95, 0xd9, 0x8d, 0x67, 0xb8, - 0xcb, 0x89, 0xbd, 0x27, 0xb0, 0xe8, 0x4e, 0xd0, 0x4f, 0x74, 0x07, 0x56, 0x07, 0x84, 0x82, 0x84, - 0x5c, 0x17, 0x42, 0x25, 0xca, 0x4a, 0x05, 0xe1, 0xa8, 0x05, 0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x83, 0xf4, 0x62, 0x5f, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -3058,7 +3058,7 @@ func (m *MsgDeployFungibleCoinZRC20) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.CoinType |= common.CoinType(b&0x7F) << shift + m.CoinType |= coin.CoinType(b&0x7F) << shift if b < 0x80 { break } diff --git a/x/observer/genesis.go b/x/observer/genesis.go index 1c1b10ef26..7e3ff44311 100644 --- a/x/observer/genesis.go +++ b/x/observer/genesis.go @@ -2,7 +2,7 @@ package observer import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/x/observer/keeper" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -106,7 +106,7 @@ func InitGenesis(ctx sdk.Context, k keeper.Keeper, genState types.GenesisState) k.SetPendingNonces(ctx, pendingNonce) } } else { - for _, chain := range common.DefaultChainsList() { + for _, chain := range chains.DefaultChainsList() { if genState.Tss != nil { k.SetPendingNonces(ctx, types.PendingNonces{ NonceLow: 0, diff --git a/x/observer/keeper/block_header.go b/x/observer/keeper/block_header.go index e5f6aa74f4..aaf06bca4b 100644 --- a/x/observer/keeper/block_header.go +++ b/x/observer/keeper/block_header.go @@ -5,19 +5,19 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/proofs" "github.com/zeta-chain/zetacore/x/observer/types" ) // SetBlockHeader set a specific block header in the store from its index -func (k Keeper) SetBlockHeader(ctx sdk.Context, header common.BlockHeader) { +func (k Keeper) SetBlockHeader(ctx sdk.Context, header proofs.BlockHeader) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey)) b := k.cdc.MustMarshal(&header) store.Set(header.Hash, b) } // GetBlockHeader returns a block header from its hash -func (k Keeper) GetBlockHeader(ctx sdk.Context, hash []byte) (val common.BlockHeader, found bool) { +func (k Keeper) GetBlockHeader(ctx sdk.Context, hash []byte) (val proofs.BlockHeader, found bool) { store := prefix.NewStore(ctx.KVStore(k.storeKey), types.KeyPrefix(types.BlockHeaderKey)) b := store.Get(hash) diff --git a/x/observer/keeper/chain_params.go b/x/observer/keeper/chain_params.go index b28adc6e23..7b5e0a246e 100644 --- a/x/observer/keeper/chain_params.go +++ b/x/observer/keeper/chain_params.go @@ -4,7 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -42,7 +42,7 @@ func (k Keeper) GetChainParamsByChainID(ctx sdk.Context, chainID int64) (*types. // GetSupportedChainFromChainID returns the chain from the chain id // it returns nil if the chain doesn't exist or is not supported -func (k Keeper) GetSupportedChainFromChainID(ctx sdk.Context, chainID int64) *common.Chain { +func (k Keeper) GetSupportedChainFromChainID(ctx sdk.Context, chainID int64) *chains.Chain { cpl, found := k.GetChainParamsList(ctx) if !found { return nil @@ -50,24 +50,24 @@ func (k Keeper) GetSupportedChainFromChainID(ctx sdk.Context, chainID int64) *co for _, cp := range cpl.ChainParams { if cp.ChainId == chainID && cp.IsSupported { - return common.GetChainFromChainID(chainID) + return chains.GetChainFromChainID(chainID) } } return nil } // GetSupportedChains returns the list of supported chains -func (k Keeper) GetSupportedChains(ctx sdk.Context) []*common.Chain { +func (k Keeper) GetSupportedChains(ctx sdk.Context) []*chains.Chain { cpl, found := k.GetChainParamsList(ctx) if !found { - return []*common.Chain{} + return []*chains.Chain{} } - var chains []*common.Chain + var c []*chains.Chain for _, cp := range cpl.ChainParams { if cp.IsSupported { - chains = append(chains, common.GetChainFromChainID(cp.ChainId)) + c = append(c, chains.GetChainFromChainID(cp.ChainId)) } } - return chains + return c } diff --git a/x/observer/keeper/chain_params_test.go b/x/observer/keeper/chain_params_test.go index 2d63265122..3464c950fa 100644 --- a/x/observer/keeper/chain_params_test.go +++ b/x/observer/keeper/chain_params_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/types" @@ -49,12 +49,12 @@ func TestKeeper_GetSupportedChains(t *testing.T) { t.Run("return list containing supported chains", func(t *testing.T) { k, ctx, _, _ := keepertest.ObserverKeeper(t) - require.Greater(t, len(common.ExternalChainList()), 5) - supported1 := common.ExternalChainList()[0] - supported2 := common.ExternalChainList()[1] - unsupported := common.ExternalChainList()[2] - supported3 := common.ExternalChainList()[3] - supported4 := common.ExternalChainList()[4] + require.Greater(t, len(chains.ExternalChainList()), 5) + supported1 := chains.ExternalChainList()[0] + supported2 := chains.ExternalChainList()[1] + unsupported := chains.ExternalChainList()[2] + supported3 := chains.ExternalChainList()[3] + supported4 := chains.ExternalChainList()[4] var chainParamsList []*types.ChainParams chainParamsList = append(chainParamsList, sample.ChainParamsSupported(supported1.ChainId)) diff --git a/x/observer/keeper/grpc_query_block_header.go b/x/observer/keeper/grpc_query_block_header.go index 1fd95c24d5..18e9c955c6 100644 --- a/x/observer/keeper/grpc_query_block_header.go +++ b/x/observer/keeper/grpc_query_block_header.go @@ -7,7 +7,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/cosmos/cosmos-sdk/types/query" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/proofs" "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -22,9 +22,9 @@ func (k Keeper) GetAllBlockHeaders(c context.Context, req *types.QueryAllBlockHe store := ctx.KVStore(k.storeKey) blockHeaderStore := prefix.NewStore(store, types.KeyPrefix(types.BlockHeaderKey)) - var blockHeaders []*common.BlockHeader + var blockHeaders []*proofs.BlockHeader pageRes, err := query.Paginate(blockHeaderStore, req.Pagination, func(key []byte, value []byte) error { - var blockHeader common.BlockHeader + var blockHeader proofs.BlockHeader if err := k.cdc.Unmarshal(value, &blockHeader); err != nil { return err } diff --git a/x/observer/keeper/grpc_query_prove.go b/x/observer/keeper/grpc_query_prove.go index 6f184cebed..edfd0588e5 100644 --- a/x/observer/keeper/grpc_query_prove.go +++ b/x/observer/keeper/grpc_query_prove.go @@ -5,7 +5,8 @@ import ( "fmt" "github.com/btcsuite/btcutil" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/proofs" sdk "github.com/cosmos/cosmos-sdk/types" ethtypes "github.com/ethereum/go-ethereum/core/types" @@ -23,7 +24,7 @@ func (k Keeper) Prove(c context.Context, req *types.QueryProveRequest) (*types.Q } ctx := sdk.UnwrapSDKContext(c) - blockHash, err := common.StringToHash(req.ChainId, req.BlockHash) + blockHash, err := chains.StringToHash(req.ChainId, req.BlockHash) if err != nil { return nil, status.Error(codes.InvalidArgument, err.Error()) } @@ -35,11 +36,11 @@ func (k Keeper) Prove(c context.Context, req *types.QueryProveRequest) (*types.Q proven := false txBytes, err := req.Proof.Verify(res.Header, int(req.TxIndex)) - if err != nil && !common.IsErrorInvalidProof(err) { + if err != nil && !proofs.IsErrorInvalidProof(err) { return nil, status.Error(codes.Internal, err.Error()) } if err == nil { - if common.IsEVMChain(req.ChainId) { + if chains.IsEVMChain(req.ChainId) { var txx ethtypes.Transaction err = txx.UnmarshalBinary(txBytes) if err != nil { @@ -49,7 +50,7 @@ func (k Keeper) Prove(c context.Context, req *types.QueryProveRequest) (*types.Q return nil, status.Error(codes.InvalidArgument, fmt.Sprintf("tx hash mismatch: %s != %s", txx.Hash().Hex(), req.TxHash)) } proven = true - } else if common.IsBitcoinChain(req.ChainId) { + } else if chains.IsBitcoinChain(req.ChainId) { tx, err := btcutil.NewTxFromBytes(txBytes) if err != nil { return nil, status.Error(codes.Internal, fmt.Sprintf("failed to unmarshal btc transaction: %s", err)) diff --git a/x/observer/keeper/grpc_query_tss.go b/x/observer/keeper/grpc_query_tss.go index 081d801277..48485f0112 100644 --- a/x/observer/keeper/grpc_query_tss.go +++ b/x/observer/keeper/grpc_query_tss.go @@ -5,7 +5,8 @@ import ( "sort" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/crypto" "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc/codes" "google.golang.org/grpc/status" @@ -45,18 +46,18 @@ func (k Keeper) GetTssAddress(goCtx context.Context, req *types.QueryGetTssAddre if !found { return nil, status.Error(codes.NotFound, "current tss not set") } - ethAddress, err := common.GetTssAddrEVM(tss.TssPubkey) + ethAddress, err := crypto.GetTssAddrEVM(tss.TssPubkey) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - bitcoinParams := common.BitcoinRegnetParams + bitcoinParams := chains.BitcoinRegnetParams if req.BitcoinChainId != 0 { - bitcoinParams, err = common.BitcoinNetParamsFromChainID(req.BitcoinChainId) + bitcoinParams, err = chains.BitcoinNetParamsFromChainID(req.BitcoinChainId) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } } - btcAddress, err := common.GetTssAddrBTC(tss.TssPubkey, bitcoinParams) + btcAddress, err := crypto.GetTssAddrBTC(tss.TssPubkey, bitcoinParams) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } @@ -76,18 +77,18 @@ func (k Keeper) GetTssAddressByFinalizedHeight(goCtx context.Context, req *types if !found { return nil, status.Error(codes.NotFound, "tss not found") } - ethAddress, err := common.GetTssAddrEVM(tss.TssPubkey) + ethAddress, err := crypto.GetTssAddrEVM(tss.TssPubkey) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } - bitcoinParams := common.BitcoinRegnetParams + bitcoinParams := chains.BitcoinRegnetParams if req.BitcoinChainId != 0 { - bitcoinParams, err = common.BitcoinNetParamsFromChainID(req.BitcoinChainId) + bitcoinParams, err = chains.BitcoinNetParamsFromChainID(req.BitcoinChainId) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } } - btcAddress, err := common.GetTssAddrBTC(tss.TssPubkey, bitcoinParams) + btcAddress, err := crypto.GetTssAddrBTC(tss.TssPubkey, bitcoinParams) if err != nil { return nil, status.Error(codes.Internal, err.Error()) } diff --git a/x/observer/keeper/msg_server_add_block_header.go b/x/observer/keeper/msg_server_add_block_header.go index 56b0bfbec7..427ab53175 100644 --- a/x/observer/keeper/msg_server_add_block_header.go +++ b/x/observer/keeper/msg_server_add_block_header.go @@ -6,7 +6,8 @@ import ( cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/proofs" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -31,10 +32,10 @@ func (k msgServer) AddBlockHeader(goCtx context.Context, msg *types.MsgAddBlockH if crosschainFlags.BlockHeaderVerificationFlags == nil { return nil, fmt.Errorf("block header verification flags not found") } - if common.IsBitcoinChain(msg.ChainId) && !crosschainFlags.BlockHeaderVerificationFlags.IsBtcTypeChainEnabled { + if chains.IsBitcoinChain(msg.ChainId) && !crosschainFlags.BlockHeaderVerificationFlags.IsBtcTypeChainEnabled { return nil, cosmoserrors.Wrapf(types.ErrBlockHeaderVerificationDisabled, "proof verification not enabled for bitcoin ,chain id: %d", msg.ChainId) } - if common.IsEVMChain(msg.ChainId) && !crosschainFlags.BlockHeaderVerificationFlags.IsEthTypeChainEnabled { + if chains.IsEVMChain(msg.ChainId) && !crosschainFlags.BlockHeaderVerificationFlags.IsEthTypeChainEnabled { return nil, cosmoserrors.Wrapf(types.ErrBlockHeaderVerificationDisabled, "proof verification not enabled for evm ,chain id: %d", msg.ChainId) } @@ -111,7 +112,7 @@ func (k msgServer) AddBlockHeader(goCtx context.Context, msg *types.MsgAddBlockH } k.Keeper.SetBlockHeaderState(ctx, bhs) - bh := common.BlockHeader{ + bh := proofs.BlockHeader{ Header: msg.Header, Height: msg.Height, Hash: msg.BlockHash, diff --git a/x/observer/keeper/msg_server_add_block_header_test.go b/x/observer/keeper/msg_server_add_block_header_test.go index 8d6c9cc8ba..f5fc68f55a 100644 --- a/x/observer/keeper/msg_server_add_block_header_test.go +++ b/x/observer/keeper/msg_server_add_block_header_test.go @@ -11,7 +11,8 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" "github.com/ethereum/go-ethereum/rlp" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/proofs" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/keeper" @@ -45,10 +46,10 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { name: "success submit eth header", msg: &types.MsgAddBlockHeader{ Creator: observerAddress.String(), - ChainId: common.GoerliLocalnetChain().ChainId, + ChainId: chains.GoerliLocalnetChain().ChainId, BlockHash: header.Hash().Bytes(), Height: 1, - Header: common.NewEthereumHeader(header1RLP), + Header: proofs.NewEthereumHeader(header1RLP), }, IsEthTypeChainEnabled: true, IsBtcTypeChainEnabled: true, @@ -59,10 +60,10 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { name: "failure submit eth header eth disabled", msg: &types.MsgAddBlockHeader{ Creator: observerAddress.String(), - ChainId: common.GoerliLocalnetChain().ChainId, + ChainId: chains.GoerliLocalnetChain().ChainId, BlockHash: header.Hash().Bytes(), Height: 1, - Header: common.NewEthereumHeader(header1RLP), + Header: proofs.NewEthereumHeader(header1RLP), }, IsEthTypeChainEnabled: false, IsBtcTypeChainEnabled: true, @@ -75,10 +76,10 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { name: "failure submit eth header eth disabled", msg: &types.MsgAddBlockHeader{ Creator: sample.AccAddress(), - ChainId: common.GoerliLocalnetChain().ChainId, + ChainId: chains.GoerliLocalnetChain().ChainId, BlockHash: header.Hash().Bytes(), Height: 1, - Header: common.NewEthereumHeader(header1RLP), + Header: proofs.NewEthereumHeader(header1RLP), }, IsEthTypeChainEnabled: false, IsBtcTypeChainEnabled: true, @@ -91,10 +92,10 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { name: "should succeed if block header parent does exist", msg: &types.MsgAddBlockHeader{ Creator: observerAddress.String(), - ChainId: common.GoerliLocalnetChain().ChainId, + ChainId: chains.GoerliLocalnetChain().ChainId, BlockHash: header2.Hash().Bytes(), Height: 2, - Header: common.NewEthereumHeader(header2RLP), + Header: proofs.NewEthereumHeader(header2RLP), }, IsEthTypeChainEnabled: true, IsBtcTypeChainEnabled: true, @@ -109,10 +110,10 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { // name: "should fail if block header parent does not exist", // msg: &types.MsgAddBlockHeader{ // Creator: observerAddress.String(), - // ChainId: common.GoerliLocalnetChain().ChainId, + // ChainId: chains.GoerliLocalnetChain().ChainId, // BlockHash: header3.Hash().Bytes(), // Height: 3, - // Header: common.NewEthereumHeader(header3RLP), + // Header: chains.NewEthereumHeader(header3RLP), // }, // IsEthTypeChainEnabled: true, // IsBtcTypeChainEnabled: true, @@ -125,10 +126,10 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { // name: "should succeed to post 3rd header if 2nd header is posted", // msg: &types.MsgAddBlockHeader{ // Creator: observerAddress.String(), - // ChainId: common.GoerliLocalnetChain().ChainId, + // ChainId: chains.GoerliLocalnetChain().ChainId, // BlockHash: header3.Hash().Bytes(), // Height: 3, - // Header: common.NewEthereumHeader(header3RLP), + // Header: chains.NewEthereumHeader(header3RLP), // }, // IsEthTypeChainEnabled: true, // IsBtcTypeChainEnabled: true, @@ -144,7 +145,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { ChainId: 9999, BlockHash: header3.Hash().Bytes(), Height: 3, - Header: common.NewEthereumHeader(header3RLP), + Header: proofs.NewEthereumHeader(header3RLP), }, IsEthTypeChainEnabled: true, IsBtcTypeChainEnabled: true, @@ -172,7 +173,7 @@ func TestMsgServer_AddBlockHeader(t *testing.T) { }, }) - setSupportedChain(ctx, *k, common.GoerliLocalnetChain().ChainId) + setSupportedChain(ctx, *k, chains.GoerliLocalnetChain().ChainId) _, err := srv.AddBlockHeader(ctx, tc.msg) tc.wantErr(t, err) diff --git a/x/observer/keeper/msg_server_add_observer.go b/x/observer/keeper/msg_server_add_observer.go index efdb085b01..7ea31c9ed2 100644 --- a/x/observer/keeper/msg_server_add_observer.go +++ b/x/observer/keeper/msg_server_add_observer.go @@ -4,12 +4,12 @@ import ( "context" "math" + "github.com/zeta-chain/zetacore/pkg/crypto" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -22,11 +22,11 @@ func (k msgServer) AddObserver(goCtx context.Context, msg *types.MsgAddObserver) return &types.MsgAddObserverResponse{}, types.ErrNotAuthorizedPolicy } - pubkey, err := common.NewPubKey(msg.ZetaclientGranteePubkey) + pubkey, err := crypto.NewPubKey(msg.ZetaclientGranteePubkey) if err != nil { return &types.MsgAddObserverResponse{}, cosmoserrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error()) } - granteeAddress, err := common.GetAddressFromPubkeyString(msg.ZetaclientGranteePubkey) + granteeAddress, err := crypto.GetAddressFromPubkeyString(msg.ZetaclientGranteePubkey) if err != nil { return &types.MsgAddObserverResponse{}, cosmoserrors.Wrap(sdkerrors.ErrInvalidPubKey, err.Error()) } @@ -38,7 +38,7 @@ func (k msgServer) AddObserver(goCtx context.Context, msg *types.MsgAddObserver) // False: adds observer to the observer list, and not the node account list // Inbound is disabled in both cases and needs to be enabled manually using an admin TX if msg.AddNodeAccountOnly { - pubkeySet := common.PubKeySet{Secp256k1: pubkey, Ed25519: ""} + pubkeySet := crypto.PubKeySet{Secp256k1: pubkey, Ed25519: ""} k.SetNodeAccount(ctx, types.NodeAccount{ Operator: msg.ObserverAddress, GranteeAddress: granteeAddress.String(), diff --git a/x/observer/keeper/msg_server_remove_chain_params_test.go b/x/observer/keeper/msg_server_remove_chain_params_test.go index bc273fd57b..6faaa0325a 100644 --- a/x/observer/keeper/msg_server_remove_chain_params_test.go +++ b/x/observer/keeper/msg_server_remove_chain_params_test.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -23,9 +23,9 @@ func TestMsgServer_RemoveChainParams(t *testing.T) { // mock the authority keeper for authorization authorityMock := keepertest.GetObserverAuthorityMock(t, k) - chain1 := common.ExternalChainList()[0].ChainId - chain2 := common.ExternalChainList()[1].ChainId - chain3 := common.ExternalChainList()[2].ChainId + chain1 := chains.ExternalChainList()[0].ChainId + chain2 := chains.ExternalChainList()[1].ChainId + chain3 := chains.ExternalChainList()[2].ChainId // set admin admin := sample.AccAddress() @@ -97,7 +97,7 @@ func TestMsgServer_RemoveChainParams(t *testing.T) { _, err := srv.RemoveChainParams(sdk.WrapSDKContext(ctx), &types.MsgRemoveChainParams{ Creator: admin, - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: chains.ExternalChainList()[0].ChainId, }) require.ErrorIs(t, err, types.ErrNotAuthorizedPolicy) }) @@ -119,16 +119,16 @@ func TestMsgServer_RemoveChainParams(t *testing.T) { _, err := srv.RemoveChainParams(sdk.WrapSDKContext(ctx), &types.MsgRemoveChainParams{ Creator: admin, - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: chains.ExternalChainList()[0].ChainId, }) require.ErrorIs(t, err, types.ErrChainParamsNotFound) // add chain params k.SetChainParamsList(ctx, types.ChainParamsList{ ChainParams: []*types.ChainParams{ - sample.ChainParams(common.ExternalChainList()[0].ChainId), - sample.ChainParams(common.ExternalChainList()[1].ChainId), - sample.ChainParams(common.ExternalChainList()[2].ChainId), + sample.ChainParams(chains.ExternalChainList()[0].ChainId), + sample.ChainParams(chains.ExternalChainList()[1].ChainId), + sample.ChainParams(chains.ExternalChainList()[2].ChainId), }, }) @@ -137,7 +137,7 @@ func TestMsgServer_RemoveChainParams(t *testing.T) { // not found if chain ID not in list _, err = srv.RemoveChainParams(sdk.WrapSDKContext(ctx), &types.MsgRemoveChainParams{ Creator: admin, - ChainId: common.ExternalChainList()[3].ChainId, + ChainId: chains.ExternalChainList()[3].ChainId, }) require.ErrorIs(t, err, types.ErrChainParamsNotFound) }) diff --git a/x/observer/keeper/msg_server_reset_chain_nonces.go b/x/observer/keeper/msg_server_reset_chain_nonces.go index b3d1731645..211b4dee8c 100644 --- a/x/observer/keeper/msg_server_reset_chain_nonces.go +++ b/x/observer/keeper/msg_server_reset_chain_nonces.go @@ -4,7 +4,7 @@ import ( "context" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -22,7 +22,7 @@ func (k msgServer) ResetChainNonces(goCtx context.Context, msg *types.MsgResetCh return nil, types.ErrTssNotFound } - chain := common.GetChainFromChainID(msg.ChainId) + chain := chains.GetChainFromChainID(msg.ChainId) if chain == nil { return nil, types.ErrSupportedChains } diff --git a/x/observer/keeper/msg_server_reset_chain_nonces_test.go b/x/observer/keeper/msg_server_reset_chain_nonces_test.go index 46da328fe8..58f673c3ba 100644 --- a/x/observer/keeper/msg_server_reset_chain_nonces_test.go +++ b/x/observer/keeper/msg_server_reset_chain_nonces_test.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" @@ -19,7 +19,7 @@ func TestMsgServer_ResetChainNonces(t *testing.T) { UseAuthorityMock: true, }) srv := keeper.NewMsgServerImpl(*k) - chainId := common.GoerliLocalnetChain().ChainId + chainId := chains.GoerliLocalnetChain().ChainId admin := sample.AccAddress() authorityMock := keepertest.GetObserverAuthorityMock(t, k) @@ -44,7 +44,7 @@ func TestMsgServer_ResetChainNonces(t *testing.T) { authorityMock := keepertest.GetObserverAuthorityMock(t, k) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupAdmin, true) - chainId := common.GoerliLocalnetChain().ChainId + chainId := chains.GoerliLocalnetChain().ChainId _, err := srv.ResetChainNonces(sdk.WrapSDKContext(ctx), &types.MsgResetChainNonces{ Creator: admin, ChainId: chainId, @@ -88,8 +88,8 @@ func TestMsgServer_ResetChainNonces(t *testing.T) { keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupAdmin, true) keepertest.MockIsAuthorized(&authorityMock.Mock, admin, authoritytypes.PolicyType_groupAdmin, true) - chainId := common.GoerliLocalnetChain().ChainId - index := common.GoerliLocalnetChain().ChainName.String() + chainId := chains.GoerliLocalnetChain().ChainId + index := chains.GoerliLocalnetChain().ChainName.String() // check existing chain nonces _, found := k.GetChainNonces(ctx, index) diff --git a/x/observer/keeper/msg_server_update_chain_params_test.go b/x/observer/keeper/msg_server_update_chain_params_test.go index 2a14a752b4..274730a4bf 100644 --- a/x/observer/keeper/msg_server_update_chain_params_test.go +++ b/x/observer/keeper/msg_server_update_chain_params_test.go @@ -3,11 +3,11 @@ package keeper_test import ( "testing" + "github.com/zeta-chain/zetacore/pkg/chains" authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/keeper" @@ -21,9 +21,9 @@ func TestMsgServer_UpdateChainParams(t *testing.T) { }) srv := keeper.NewMsgServerImpl(*k) - chain1 := common.ExternalChainList()[0].ChainId - chain2 := common.ExternalChainList()[1].ChainId - chain3 := common.ExternalChainList()[2].ChainId + chain1 := chains.ExternalChainList()[0].ChainId + chain2 := chains.ExternalChainList()[1].ChainId + chain3 := chains.ExternalChainList()[2].ChainId // set admin admin := sample.AccAddress() @@ -115,7 +115,7 @@ func TestMsgServer_UpdateChainParams(t *testing.T) { _, err := srv.UpdateChainParams(sdk.WrapSDKContext(ctx), &types.MsgUpdateChainParams{ Creator: admin, - ChainParams: sample.ChainParams(common.ExternalChainList()[0].ChainId), + ChainParams: sample.ChainParams(chains.ExternalChainList()[0].ChainId), }) require.ErrorIs(t, err, types.ErrNotAuthorizedPolicy) }) diff --git a/x/observer/keeper/utils.go b/x/observer/keeper/utils.go index 5a1896755e..95787cf1a1 100644 --- a/x/observer/keeper/utils.go +++ b/x/observer/keeper/utils.go @@ -4,7 +4,7 @@ import ( "fmt" sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -48,7 +48,7 @@ func (k Keeper) IsAuthorized(ctx sdk.Context, address string) bool { func (k Keeper) FindBallot( ctx sdk.Context, index string, - chain *common.Chain, + chain *chains.Chain, observationType types.ObservationType, ) (ballot types.Ballot, isNew bool, err error) { isNew = false diff --git a/x/observer/keeper/utils_test.go b/x/observer/keeper/utils_test.go index e8e2a9ab98..8a59bfe310 100644 --- a/x/observer/keeper/utils_test.go +++ b/x/observer/keeper/utils_test.go @@ -8,7 +8,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types" "github.com/stretchr/testify/require" - zetacommon "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/keeper" @@ -32,9 +32,9 @@ func setSupportedChain(ctx sdk.Context, observerKeeper keeper.Keeper, chainIDs . func getValidEthChainIDWithIndex(t *testing.T, index int) int64 { switch index { case 0: - return zetacommon.GoerliLocalnetChain().ChainId + return chains.GoerliLocalnetChain().ChainId case 1: - return zetacommon.GoerliChain().ChainId + return chains.GoerliChain().ChainId default: require.Fail(t, "invalid index") } diff --git a/x/observer/keeper/vote_inbound.go b/x/observer/keeper/vote_inbound.go index 5bc70ede88..31b56912e5 100644 --- a/x/observer/keeper/vote_inbound.go +++ b/x/observer/keeper/vote_inbound.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -16,7 +16,7 @@ func (k Keeper) VoteOnInboundBallot( ctx sdk.Context, senderChainID int64, receiverChainID int64, - coinType common.CoinType, + coinType coin.CoinType, voter string, ballotIndex string, inTxHash string, @@ -58,7 +58,7 @@ func (k Keeper) VoteOnInboundBallot( if !found { return false, false, types.ErrChainParamsNotFound } - if coreParams.ZetaTokenContractAddress == "" && coinType == common.CoinType_Zeta { + if coreParams.ZetaTokenContractAddress == "" && coinType == coin.CoinType_Zeta { return false, false, types.ErrInvalidZetaCoinTypes } } diff --git a/x/observer/keeper/vote_inbound_test.go b/x/observer/keeper/vote_inbound_test.go index 94b9ed4105..41a3999b75 100644 --- a/x/observer/keeper/vote_inbound_test.go +++ b/x/observer/keeper/vote_inbound_test.go @@ -5,7 +5,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/types" @@ -23,8 +24,8 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { _, _, err := k.VoteOnInboundBallot( ctx, getValidEthChainIDWithIndex(t, 0), - common.ZetaPrivnetChain().ChainId, - common.CoinType_ERC20, + chains.ZetaPrivnetChain().ChainId, + coin.CoinType_ERC20, sample.AccAddress(), "index", "inTxHash", @@ -45,8 +46,8 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { _, _, err := k.VoteOnInboundBallot( ctx, getValidEthChainIDWithIndex(t, 0), - common.ZetaPrivnetChain().ChainId, - common.CoinType_ERC20, + chains.ZetaPrivnetChain().ChainId, + coin.CoinType_ERC20, sample.AccAddress(), "index", "inTxHash", @@ -67,8 +68,8 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { _, _, err = k.VoteOnInboundBallot( ctx, getValidEthChainIDWithIndex(t, 0), - common.ZetaPrivnetChain().ChainId, - common.CoinType_ERC20, + chains.ZetaPrivnetChain().ChainId, + coin.CoinType_ERC20, sample.AccAddress(), "index", "inTxHash", @@ -96,8 +97,8 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { _, _, err := k.VoteOnInboundBallot( ctx, getValidEthChainIDWithIndex(t, 0), - common.ZetaPrivnetChain().ChainId, - common.CoinType_ERC20, + chains.ZetaPrivnetChain().ChainId, + coin.CoinType_ERC20, sample.AccAddress(), "index", "inTxHash", @@ -133,8 +134,8 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { _, _, err := k.VoteOnInboundBallot( ctx, getValidEthChainIDWithIndex(t, 0), - common.ZetaPrivnetChain().ChainId, - common.CoinType_ERC20, + chains.ZetaPrivnetChain().ChainId, + coin.CoinType_ERC20, observer, "index", "inTxHash", @@ -150,7 +151,7 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { IsSupported: true, }, { - ChainId: common.ZetaPrivnetChain().ChainId, + ChainId: chains.ZetaPrivnetChain().ChainId, IsSupported: false, }, }, @@ -161,8 +162,8 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { _, _, err = k.VoteOnInboundBallot( ctx, getValidEthChainIDWithIndex(t, 0), - common.ZetaPrivnetChain().ChainId, - common.CoinType_ERC20, + chains.ZetaPrivnetChain().ChainId, + coin.CoinType_ERC20, observer, "index", "inTxHash", @@ -204,7 +205,7 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { ctx, getValidEthChainIDWithIndex(t, 0), getValidEthChainIDWithIndex(t, 1), - common.CoinType_Zeta, + coin.CoinType_Zeta, observer, "index", "inTxHash", @@ -245,7 +246,7 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { ctx, getValidEthChainIDWithIndex(t, 0), getValidEthChainIDWithIndex(t, 1), - common.CoinType_ERC20, + coin.CoinType_ERC20, observer, "index", "inTxHash", @@ -298,7 +299,7 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { ctx, getValidEthChainIDWithIndex(t, 0), getValidEthChainIDWithIndex(t, 1), - common.CoinType_ERC20, + coin.CoinType_ERC20, observer, "index", "inTxHash", @@ -362,7 +363,7 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { ctx, getValidEthChainIDWithIndex(t, 0), getValidEthChainIDWithIndex(t, 1), - common.CoinType_ERC20, + coin.CoinType_ERC20, observer, "index", "inTxHash", @@ -424,7 +425,7 @@ func TestKeeper_VoteOnInboundBallot(t *testing.T) { ctx, getValidEthChainIDWithIndex(t, 0), getValidEthChainIDWithIndex(t, 1), - common.CoinType_ERC20, + coin.CoinType_ERC20, observer, "index", "inTxHash", diff --git a/x/observer/keeper/vote_outbound.go b/x/observer/keeper/vote_outbound.go index 3ee0c6b585..34f3c73fc0 100644 --- a/x/observer/keeper/vote_outbound.go +++ b/x/observer/keeper/vote_outbound.go @@ -2,7 +2,7 @@ package keeper import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -15,7 +15,7 @@ func (k Keeper) VoteOnOutboundBallot( ctx sdk.Context, ballotIndex string, outTxChainID int64, - receiveStatus common.ReceiveStatus, + receiveStatus chains.ReceiveStatus, voter string, ) (isFinalized bool, isNew bool, ballot observertypes.Ballot, observationChainName string, err error) { // Observer Chain already checked then inbound is created diff --git a/x/observer/keeper/vote_outbound_test.go b/x/observer/keeper/vote_outbound_test.go index ad84672d4f..fa34a11ca6 100644 --- a/x/observer/keeper/vote_outbound_test.go +++ b/x/observer/keeper/vote_outbound_test.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/types" @@ -21,7 +21,7 @@ func TestKeeper_VoteOnOutboundBallot(t *testing.T) { ctx, "index", getValidEthChainIDWithIndex(t, 0), - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, sample.AccAddress(), ) require.Error(t, err) @@ -41,7 +41,7 @@ func TestKeeper_VoteOnOutboundBallot(t *testing.T) { ctx, "index", getValidEthChainIDWithIndex(t, 0), - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, sample.AccAddress(), ) require.Error(t, err) @@ -64,7 +64,7 @@ func TestKeeper_VoteOnOutboundBallot(t *testing.T) { ctx, "index", getValidEthChainIDWithIndex(t, 0), - common.ReceiveStatus(1000), + chains.ReceiveStatus(1000), sample.AccAddress(), ) require.Error(t, err) @@ -88,7 +88,7 @@ func TestKeeper_VoteOnOutboundBallot(t *testing.T) { ctx, "index", getValidEthChainIDWithIndex(t, 0), - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, sample.AccAddress(), ) require.Error(t, err) @@ -120,7 +120,7 @@ func TestKeeper_VoteOnOutboundBallot(t *testing.T) { ctx, "index", getValidEthChainIDWithIndex(t, 0), - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, observer, ) require.NoError(t, err) @@ -166,7 +166,7 @@ func TestKeeper_VoteOnOutboundBallot(t *testing.T) { ctx, "index", getValidEthChainIDWithIndex(t, 0), - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, observer, ) require.NoError(t, err) @@ -224,7 +224,7 @@ func TestKeeper_VoteOnOutboundBallot(t *testing.T) { ctx, "index", getValidEthChainIDWithIndex(t, 0), - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, observer, ) require.NoError(t, err) @@ -280,7 +280,7 @@ func TestKeeper_VoteOnOutboundBallot(t *testing.T) { ctx, "index", getValidEthChainIDWithIndex(t, 0), - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, observer, ) require.NoError(t, err) diff --git a/x/observer/migrations/v5/migrate_test.go b/x/observer/migrations/v5/migrate_test.go index 1ba3d77eff..40d072230d 100644 --- a/x/observer/migrations/v5/migrate_test.go +++ b/x/observer/migrations/v5/migrate_test.go @@ -6,7 +6,7 @@ import ( "github.com/cosmos/cosmos-sdk/store/prefix" sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" keepertest "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" v5 "github.com/zeta-chain/zetacore/x/observer/migrations/v5" @@ -68,13 +68,13 @@ func TestMigrateObserverParams(t *testing.T) { params := types.Params{ ObserverParams: []*types.ObserverParams{ { - Chain: &common.Chain{ChainId: 2}, + Chain: &chains.Chain{ChainId: 2}, BallotThreshold: dec42, MinObserverDelegation: dec1000, IsSupported: true, }, { - Chain: &common.Chain{ChainId: 3}, + Chain: &chains.Chain{ChainId: 3}, BallotThreshold: dec43, MinObserverDelegation: dec1001, IsSupported: true, diff --git a/x/observer/types/chain_nonces.pb.go b/x/observer/types/chain_nonces.pb.go index 47ea34bda2..18090e8ec5 100644 --- a/x/observer/types/chain_nonces.pb.go +++ b/x/observer/types/chain_nonces.pb.go @@ -11,7 +11,6 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - _ "github.com/zeta-chain/zetacore/common" ) // Reference imports to suppress errors if they are not otherwise used. @@ -116,25 +115,24 @@ func init() { func init() { proto.RegisterFile("observer/chain_nonces.proto", fileDescriptor_a4a180ef3ffea001) } var fileDescriptor_a4a180ef3ffea001 = []byte{ - // 276 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0xbd, 0x4e, 0xc3, 0x30, - 0x14, 0x85, 0x6b, 0xd2, 0x1f, 0x30, 0x03, 0x52, 0xe8, 0x60, 0x5a, 0xc9, 0x8a, 0x98, 0xb2, 0x10, - 0x0f, 0xbc, 0x01, 0x2c, 0x74, 0x61, 0xc8, 0xc8, 0x82, 0xf2, 0x73, 0x49, 0x2c, 0x11, 0xdf, 0xca, - 0x36, 0xa8, 0xf4, 0x29, 0x78, 0x16, 0x9e, 0x82, 0xb1, 0x23, 0x23, 0x4a, 0x5e, 0x04, 0xd9, 0x26, - 0x0c, 0x4c, 0xbe, 0xdf, 0x91, 0xcf, 0xbd, 0x47, 0x87, 0xae, 0xb1, 0x34, 0xa0, 0x5f, 0x41, 0x8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 0xd7, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x3c, 0x24, 0x62, 0xd5, - 0x6d, 0x01, 0x00, 0x00, + // 267 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x5c, 0x90, 0x3d, 0x4e, 0xfc, 0x30, + 0x10, 0xc5, 0xe3, 0x7f, 0xf6, 0xe3, 0x8f, 0x29, 0x90, 0xac, 0x2d, 0x0c, 0x2b, 0x59, 0x11, 0x55, + 0x1a, 0xe2, 0x82, 0x1b, 0x40, 0xc3, 0x36, 0x14, 0x29, 0x69, 0x50, 0x3e, 0x06, 0xc7, 0x12, 0xd8, + 0x2b, 0xdb, 0xa0, 0x65, 0x4f, 0xc1, 0x59, 0x38, 0x05, 0xe5, 0x96, 0x94, 0x28, 0xb9, 0x08, 0xf2, + 0x84, 0x50, 0xd0, 0xcd, 0xef, 0x69, 0xde, 0xcc, 0xd3, 0xa3, 0x6b, 0x5b, 0x7b, 0x70, 0x2f, 0xe0, + 0x64, 0xd3, 0x55, 0xda, 0xdc, 0x1b, 0x6b, 0x1a, 0xf0, 0xc5, 0xd6, 0xd9, 0x60, 0xd9, 0x7a, 0x0f, + 0xa1, 0x42, 0xbd, 0xc0, 0xc9, 0x3a, 0x28, 0xa6, 0xfd, 0xb3, 0x95, 0xb2, 0xca, 0xe2, 0x9e, 0x8c, + 0xd3, 0x68, 0x39, 0x7f, 0x27, 0xf4, 0xf8, 0x3a, 0x3a, 0x6e, 0xf1, 0x10, 0xe3, 0x74, 0xd9, 0x38, + 0xa8, 0x82, 0x75, 0x9c, 0x64, 0x24, 0x3f, 0x2a, 0x27, 0x64, 0x2b, 0x3a, 0xd7, 0xa6, 0x85, 0x1d, + 0xff, 0x87, 0xfa, 0x08, 0xec, 0x94, 0xfe, 0x1f, 0x83, 0xe8, 0x96, 0xa7, 0x19, 0xc9, 0xd3, 0x72, + 0x89, 0xbc, 0x69, 0xa3, 0x01, 0xd3, 0xf1, 0x59, 0x46, 0xf2, 0x59, 0x39, 0x42, 0x7c, 0xe0, 0xb5, + 0x32, 0xe0, 0x3c, 0x9f, 0x67, 0x69, 0x7c, 0xf0, 0x83, 0x2c, 0xa7, 0x27, 0x0f, 0xda, 0x54, 0x8f, + 0x7a, 0x0f, 0xed, 0x0d, 0x68, 0xd5, 0x05, 0xbe, 0x40, 0xe7, 0x5f, 0xf9, 0x6a, 0xf3, 0xd1, 0x0b, + 0x72, 0xe8, 0x05, 0xf9, 0xea, 0x05, 0x79, 0x1b, 0x44, 0x72, 0x18, 0x44, 0xf2, 0x39, 0x88, 0xe4, + 0x4e, 0x2a, 0x1d, 0xba, 0xe7, 0xba, 0x68, 0xec, 0x93, 0x8c, 0x15, 0x5c, 0x60, 0x18, 0x39, 0xb5, + 0x21, 0x77, 0xf2, 0xb7, 0xbf, 0xf0, 0xba, 0x05, 0x5f, 0x2f, 0xb0, 0x86, 0xcb, 0xef, 0x00, 0x00, + 0x00, 0xff, 0xff, 0xfa, 0xab, 0xcc, 0x63, 0x58, 0x01, 0x00, 0x00, } func (m *ChainNonces) Marshal() (dAtA []byte, err error) { diff --git a/x/observer/types/chain_params.go b/x/observer/types/chain_params.go index d76557584d..e32ee9e597 100644 --- a/x/observer/types/chain_params.go +++ b/x/observer/types/chain_params.go @@ -8,8 +8,8 @@ import ( errorsmod "cosmossdk.io/errors" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/common" + ethchains "github.com/ethereum/go-ethereum/common" + "github.com/zeta-chain/zetacore/pkg/chains" ) const ( @@ -27,7 +27,7 @@ func (cpl ChainParamsList) Validate() error { chainMap := make(map[int64]struct{}) existingChainMap := make(map[int64]struct{}) - externalChainList := common.DefaultChainsList() + externalChainList := chains.DefaultChainsList() for _, chain := range externalChainList { chainMap[chain.ChainId] = struct{}{} } @@ -54,7 +54,7 @@ func ValidateChainParams(params *ChainParams) error { if params == nil { return fmt.Errorf("chain params cannot be nil") } - chain := common.GetChainFromChainID(params.ChainId) + chain := chains.GetChainFromChainID(params.ChainId) if chain == nil { return fmt.Errorf("ChainId %d not supported", params.ChainId) } @@ -83,12 +83,12 @@ func ValidateChainParams(params *ChainParams) error { } // chain type specific checks - if common.IsBitcoinChain(params.ChainId) { + if chains.IsBitcoinChain(params.ChainId) { if params.WatchUtxoTicker == 0 || params.WatchUtxoTicker > 300 { return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "WatchUtxoTicker %d out of range", params.WatchUtxoTicker) } } - if common.IsEVMChain(params.ChainId) { + if chains.IsEVMChain(params.ChainId) { if !validChainContractAddress(params.ZetaTokenContractAddress) { return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid ZetaTokenContractAddress %s", params.ZetaTokenContractAddress) } @@ -115,7 +115,7 @@ func validChainContractAddress(address string) bool { if !strings.HasPrefix(address, "0x") { return false } - return ethcommon.IsHexAddress(address) + return ethchains.IsHexAddress(address) } // GetDefaultChainParams returns a list of default chain params @@ -140,7 +140,7 @@ func GetDefaultChainParams() ChainParamsList { func GetDefaultEthMainnetChainParams() *ChainParams { return &ChainParams{ - ChainId: common.EthChain().ChainId, + ChainId: chains.EthChain().ChainId, ConfirmationCount: 14, ZetaTokenContractAddress: zeroAddress, ConnectorContractAddress: zeroAddress, @@ -158,7 +158,7 @@ func GetDefaultEthMainnetChainParams() *ChainParams { } func GetDefaultBscMainnetChainParams() *ChainParams { return &ChainParams{ - ChainId: common.BscMainnetChain().ChainId, + ChainId: chains.BscMainnetChain().ChainId, ConfirmationCount: 14, ZetaTokenContractAddress: zeroAddress, ConnectorContractAddress: zeroAddress, @@ -176,7 +176,7 @@ func GetDefaultBscMainnetChainParams() *ChainParams { } func GetDefaultBtcMainnetChainParams() *ChainParams { return &ChainParams{ - ChainId: common.BtcMainnetChain().ChainId, + ChainId: chains.BtcMainnetChain().ChainId, ConfirmationCount: 2, ZetaTokenContractAddress: zeroAddress, ConnectorContractAddress: zeroAddress, @@ -194,7 +194,7 @@ func GetDefaultBtcMainnetChainParams() *ChainParams { } func GetDefaultGoerliTestnetChainParams() *ChainParams { return &ChainParams{ - ChainId: common.GoerliChain().ChainId, + ChainId: chains.GoerliChain().ChainId, ConfirmationCount: 6, // This is the actual Zeta token Goerli testnet, we need to specify this address for the integration tests to pass ZetaTokenContractAddress: "0x0000c304d2934c00db1d51995b9f6996affd17c0", @@ -213,7 +213,7 @@ func GetDefaultGoerliTestnetChainParams() *ChainParams { } func GetDefaultBscTestnetChainParams() *ChainParams { return &ChainParams{ - ChainId: common.BscTestnetChain().ChainId, + ChainId: chains.BscTestnetChain().ChainId, ConfirmationCount: 6, ZetaTokenContractAddress: zeroAddress, ConnectorContractAddress: zeroAddress, @@ -231,7 +231,7 @@ func GetDefaultBscTestnetChainParams() *ChainParams { } func GetDefaultMumbaiTestnetChainParams() *ChainParams { return &ChainParams{ - ChainId: common.MumbaiChain().ChainId, + ChainId: chains.MumbaiChain().ChainId, ConfirmationCount: 12, ZetaTokenContractAddress: zeroAddress, ConnectorContractAddress: zeroAddress, @@ -249,7 +249,7 @@ func GetDefaultMumbaiTestnetChainParams() *ChainParams { } func GetDefaultBtcTestnetChainParams() *ChainParams { return &ChainParams{ - ChainId: common.BtcTestNetChain().ChainId, + ChainId: chains.BtcTestNetChain().ChainId, ConfirmationCount: 2, ZetaTokenContractAddress: zeroAddress, ConnectorContractAddress: zeroAddress, @@ -267,7 +267,7 @@ func GetDefaultBtcTestnetChainParams() *ChainParams { } func GetDefaultBtcRegtestChainParams() *ChainParams { return &ChainParams{ - ChainId: common.BtcRegtestChain().ChainId, + ChainId: chains.BtcRegtestChain().ChainId, ConfirmationCount: 1, ZetaTokenContractAddress: zeroAddress, ConnectorContractAddress: zeroAddress, @@ -285,7 +285,7 @@ func GetDefaultBtcRegtestChainParams() *ChainParams { } func GetDefaultGoerliLocalnetChainParams() *ChainParams { return &ChainParams{ - ChainId: common.GoerliLocalnetChain().ChainId, + ChainId: chains.GoerliLocalnetChain().ChainId, ConfirmationCount: 1, ZetaTokenContractAddress: "0x733aB8b06DDDEf27Eaa72294B0d7c9cEF7f12db9", ConnectorContractAddress: "0xD28D6A0b8189305551a0A8bd247a6ECa9CE781Ca", @@ -303,7 +303,7 @@ func GetDefaultGoerliLocalnetChainParams() *ChainParams { } func GetDefaultZetaPrivnetChainParams() *ChainParams { return &ChainParams{ - ChainId: common.ZetaPrivnetChain().ChainId, + ChainId: chains.ZetaPrivnetChain().ChainId, ConfirmationCount: 1, ZetaTokenContractAddress: zeroAddress, ConnectorContractAddress: zeroAddress, diff --git a/x/observer/types/message_add_blame_vote.go b/x/observer/types/message_add_blame_vote.go index d10411f026..5a93f0cafe 100644 --- a/x/observer/types/message_add_blame_vote.go +++ b/x/observer/types/message_add_blame_vote.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/ethereum/go-ethereum/crypto" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" ) const TypeMsgAddBlameVote = "add_blame_vote" @@ -33,7 +33,7 @@ func (m *MsgAddBlameVote) ValidateBasic() error { if err != nil { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } - if common.GetChainFromChainID(m.ChainId) == nil { + if chains.GetChainFromChainID(m.ChainId) == nil { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidChainID, "chain id (%d)", m.ChainId) } return nil diff --git a/x/observer/types/message_add_block_header.go b/x/observer/types/message_add_block_header.go index f7094a002c..58be17f079 100644 --- a/x/observer/types/message_add_block_header.go +++ b/x/observer/types/message_add_block_header.go @@ -6,7 +6,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/ethereum/go-ethereum/crypto" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/proofs" ) var _ sdk.Msg = &MsgAddBlockHeader{} @@ -15,7 +16,7 @@ const ( TypeMsgAddBlockHeader = "add_block_header" ) -func NewMsgAddBlockHeader(creator string, chainID int64, blockHash []byte, height int64, header common.HeaderData) *MsgAddBlockHeader { +func NewMsgAddBlockHeader(creator string, chainID int64, blockHash []byte, height int64, header proofs.HeaderData) *MsgAddBlockHeader { return &MsgAddBlockHeader{ Creator: creator, ChainId: chainID, @@ -52,7 +53,7 @@ func (msg *MsgAddBlockHeader) ValidateBasic() error { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, err.Error()) } - if common.IsHeaderSupportedEvmChain(msg.ChainId) || common.IsBitcoinChain(msg.ChainId) { + if chains.IsHeaderSupportedEvmChain(msg.ChainId) || chains.IsBitcoinChain(msg.ChainId) { if len(msg.BlockHash) != 32 { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidRequest, "invalid block hash length (%d)", len(msg.BlockHash)) } diff --git a/x/observer/types/message_add_block_header_test.go b/x/observer/types/message_add_block_header_test.go index f3b86b6bc1..9f53590dde 100644 --- a/x/observer/types/message_add_block_header_test.go +++ b/x/observer/types/message_add_block_header_test.go @@ -9,7 +9,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/proofs" "github.com/zeta-chain/zetacore/testutil/keeper" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/types" @@ -18,7 +18,7 @@ import ( func TestMsgAddBlockHeader_ValidateBasic(t *testing.T) { keeper.SetConfig(false) var header ethtypes.Header - file, err := os.Open("../../../common/testdata/eth_header_18495266.json") + file, err := os.Open("../../../pkg/testdata/eth_header_18495266.json") require.NoError(t, err) defer file.Close() headerBytes := make([]byte, 4096) @@ -29,7 +29,7 @@ func TestMsgAddBlockHeader_ValidateBasic(t *testing.T) { var buffer bytes.Buffer err = header.EncodeRLP(&buffer) require.NoError(t, err) - headerData := common.NewEthereumHeader(buffer.Bytes()) + headerData := proofs.NewEthereumHeader(buffer.Bytes()) tests := []struct { name string msg *types.MsgAddBlockHeader @@ -42,7 +42,7 @@ func TestMsgAddBlockHeader_ValidateBasic(t *testing.T) { 1, []byte{}, 6, - common.HeaderData{}, + proofs.HeaderData{}, ), error: true, }, @@ -53,7 +53,7 @@ func TestMsgAddBlockHeader_ValidateBasic(t *testing.T) { -1, []byte{}, 6, - common.HeaderData{}, + proofs.HeaderData{}, ), error: true, }, @@ -64,7 +64,7 @@ func TestMsgAddBlockHeader_ValidateBasic(t *testing.T) { 5, sample.Hash().Bytes(), 6, - common.HeaderData{}, + proofs.HeaderData{}, ), error: true, }, @@ -75,7 +75,7 @@ func TestMsgAddBlockHeader_ValidateBasic(t *testing.T) { 5, sample.Hash().Bytes()[:31], 6, - common.HeaderData{}, + proofs.HeaderData{}, ), error: true, }, diff --git a/x/observer/types/message_add_observer.go b/x/observer/types/message_add_observer.go index 991bb0afa1..087636b10a 100644 --- a/x/observer/types/message_add_observer.go +++ b/x/observer/types/message_add_observer.go @@ -4,7 +4,7 @@ import ( cosmoserrors "cosmossdk.io/errors" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/crypto" ) const TypeMsgAddObserver = "add_observer" @@ -50,11 +50,11 @@ func (msg *MsgAddObserver) ValidateBasic() error { if err != nil { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid observer address (%s)", err) } - _, err = common.NewPubKey(msg.ZetaclientGranteePubkey) + _, err = crypto.NewPubKey(msg.ZetaclientGranteePubkey) if err != nil { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidPubKey, "invalid zetaclient grantee pubkey (%s)", err) } - _, err = common.GetAddressFromPubkeyString(msg.ZetaclientGranteePubkey) + _, err = crypto.GetAddressFromPubkeyString(msg.ZetaclientGranteePubkey) if err != nil { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidPubKey, "invalid zetaclient grantee pubkey (%s)", err) } diff --git a/x/observer/types/message_remove_chain_params.go b/x/observer/types/message_remove_chain_params.go index dbf4484263..5b333c4bc1 100644 --- a/x/observer/types/message_remove_chain_params.go +++ b/x/observer/types/message_remove_chain_params.go @@ -2,7 +2,7 @@ package types import ( cosmoserrors "cosmossdk.io/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -47,7 +47,7 @@ func (msg *MsgRemoveChainParams) ValidateBasic() error { } // Check if chain exists - chain := common.GetChainFromChainID(msg.ChainId) + chain := chains.GetChainFromChainID(msg.ChainId) if chain == nil { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidChainID, "invalid chain id (%d)", msg.ChainId) } diff --git a/x/observer/types/message_remove_chain_params_test.go b/x/observer/types/message_remove_chain_params_test.go index 9168821413..bd46dfe692 100644 --- a/x/observer/types/message_remove_chain_params_test.go +++ b/x/observer/types/message_remove_chain_params_test.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -21,14 +21,14 @@ func TestMsgRemoveChainParams_ValidateBasic(t *testing.T) { name: "valid message", msg: types.NewMsgRemoveChainParams( sample.AccAddress(), - common.ExternalChainList()[0].ChainId, + chains.ExternalChainList()[0].ChainId, ), }, { name: "invalid address", msg: types.NewMsgRemoveChainParams( "invalid_address", - common.ExternalChainList()[0].ChainId, + chains.ExternalChainList()[0].ChainId, ), err: sdkerrors.ErrInvalidAddress, }, diff --git a/x/observer/types/message_reset_chain_nonces.go b/x/observer/types/message_reset_chain_nonces.go index 71e438d103..c7bb615040 100644 --- a/x/observer/types/message_reset_chain_nonces.go +++ b/x/observer/types/message_reset_chain_nonces.go @@ -4,7 +4,7 @@ import ( "errors" cosmoserrors "cosmossdk.io/errors" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" @@ -51,7 +51,7 @@ func (msg *MsgResetChainNonces) ValidateBasic() error { } // Check if chain exists - chain := common.GetChainFromChainID(msg.ChainId) + chain := chains.GetChainFromChainID(msg.ChainId) if chain == nil { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidChainID, "invalid chain id (%d)", msg.ChainId) } diff --git a/x/observer/types/message_reset_chain_nonces_test.go b/x/observer/types/message_reset_chain_nonces_test.go index 7043432952..4f37b359bb 100644 --- a/x/observer/types/message_reset_chain_nonces_test.go +++ b/x/observer/types/message_reset_chain_nonces_test.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -20,7 +20,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "valid message chain nonce high greater than nonce low", msg: types.MsgResetChainNonces{ Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: chains.ExternalChainList()[0].ChainId, ChainNonceLow: 1, ChainNonceHigh: 5, }, @@ -30,7 +30,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "valid message chain nonce high same as nonce low", msg: types.MsgResetChainNonces{ Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: chains.ExternalChainList()[0].ChainId, ChainNonceLow: 1, ChainNonceHigh: 1, }, @@ -40,7 +40,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "invalid address", msg: types.MsgResetChainNonces{ Creator: "invalid_address", - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: chains.ExternalChainList()[0].ChainId, }, wantErr: true, }, @@ -56,7 +56,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "invalid chain nonce low", msg: types.MsgResetChainNonces{ Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: chains.ExternalChainList()[0].ChainId, ChainNonceLow: -1, }, wantErr: true, @@ -65,7 +65,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "invalid chain nonce high", msg: types.MsgResetChainNonces{ Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: chains.ExternalChainList()[0].ChainId, ChainNonceLow: 1, ChainNonceHigh: -1, }, @@ -75,7 +75,7 @@ func TestMsgResetChainNonces_ValidateBasic(t *testing.T) { name: "invalid chain nonce low greater than chain nonce high", msg: types.MsgResetChainNonces{ Creator: sample.AccAddress(), - ChainId: common.ExternalChainList()[0].ChainId, + ChainId: chains.ExternalChainList()[0].ChainId, ChainNonceLow: 1, ChainNonceHigh: 0, }, diff --git a/x/observer/types/message_update_chain_params_test.go b/x/observer/types/message_update_chain_params_test.go index 633720d6b7..1e909ea783 100644 --- a/x/observer/types/message_update_chain_params_test.go +++ b/x/observer/types/message_update_chain_params_test.go @@ -6,7 +6,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -21,14 +21,14 @@ func TestMsgUpdateChainParams_ValidateBasic(t *testing.T) { name: "valid message", msg: types.NewMsgUpdateChainParams( sample.AccAddress(), - sample.ChainParams(common.ExternalChainList()[0].ChainId), + sample.ChainParams(chains.ExternalChainList()[0].ChainId), ), }, { name: "invalid address", msg: types.NewMsgUpdateChainParams( "invalid_address", - sample.ChainParams(common.ExternalChainList()[0].ChainId), + sample.ChainParams(chains.ExternalChainList()[0].ChainId), ), err: sdkerrors.ErrInvalidAddress, }, diff --git a/x/observer/types/node_account.pb.go b/x/observer/types/node_account.pb.go index 41e6be9761..a127e290e6 100644 --- a/x/observer/types/node_account.pb.go +++ b/x/observer/types/node_account.pb.go @@ -11,7 +11,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + crypto "github.com/zeta-chain/zetacore/pkg/crypto" ) // Reference imports to suppress errors if they are not otherwise used. @@ -65,7 +65,7 @@ func (NodeStatus) EnumDescriptor() ([]byte, []int) { type NodeAccount struct { Operator string `protobuf:"bytes,1,opt,name=operator,proto3" json:"operator,omitempty"` GranteeAddress string `protobuf:"bytes,2,opt,name=granteeAddress,proto3" json:"granteeAddress,omitempty"` - GranteePubkey *common.PubKeySet `protobuf:"bytes,3,opt,name=granteePubkey,proto3" json:"granteePubkey,omitempty"` + GranteePubkey *crypto.PubKeySet `protobuf:"bytes,3,opt,name=granteePubkey,proto3" json:"granteePubkey,omitempty"` NodeStatus NodeStatus `protobuf:"varint,4,opt,name=nodeStatus,proto3,enum=zetachain.zetacore.observer.NodeStatus" json:"nodeStatus,omitempty"` } @@ -116,7 +116,7 @@ func (m *NodeAccount) GetGranteeAddress() string { return "" } -func (m *NodeAccount) GetGranteePubkey() *common.PubKeySet { +func (m *NodeAccount) GetGranteePubkey() *crypto.PubKeySet { if m != nil { return m.GranteePubkey } @@ -138,30 +138,31 @@ func init() { func init() { proto.RegisterFile("observer/node_account.proto", fileDescriptor_6f54e38f9d1a9953) } var fileDescriptor_6f54e38f9d1a9953 = []byte{ - // 366 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x51, 0xcd, 0x6a, 0xdb, 0x40, - 0x18, 0xd4, 0xfa, 0xaf, 0xf6, 0xaa, 0x75, 0xd5, 0x6d, 0x0f, 0x42, 0x06, 0x61, 0x7a, 0x68, 0x4d, - 0xa1, 0x5a, 0x70, 0x0f, 0x3d, 0xbb, 0x14, 0x4a, 0x29, 0x18, 0x23, 0x53, 0x0a, 0xbd, 0x84, 0x5d, - 0xed, 0x87, 0x2c, 0x6c, 0xef, 0x9a, 0xd5, 0xca, 0x89, 0xf2, 0x14, 0x79, 0x88, 0x1c, 0xf2, 0x28, - 0x39, 0x1a, 0x72, 0xc9, 0x31, 0xd8, 0x2f, 0x12, 0x24, 0xd9, 0xce, 0xcf, 0x21, 0xa7, 0x9d, 0x9d, - 0x6f, 0xbe, 0x8f, 0x19, 0x06, 0xf7, 0x14, 0x4f, 0x41, 0xaf, 0x41, 0x53, 0xa9, 0x04, 0x9c, 0xb0, - 0x28, 0x52, 0x99, 0x34, 0xc1, 0x4a, 0x2b, 0xa3, 0x48, 0xef, 0x1c, 0x0c, 0x8b, 0x66, 0x2c, 0x91, - 0x41, 0x89, 0x94, 0x86, 0xe0, 0xa0, 0xf7, 0xde, 0x47, 0x6a, 0xb9, 0x54, 0x92, 0x56, 0x4f, 0xb5, - 0xe1, 0x7d, 0x88, 0x55, 0xac, 0x4a, 0x48, 0x0b, 0x54, 0xb1, 0x1f, 0x6f, 0x10, 0xb6, 0xc7, 0x4a, - 0xc0, 0xa8, 0xba, 0x4e, 0x3c, 0xdc, 0x56, 0x2b, 0xd0, 0xcc, 0x28, 0xed, 0xa2, 0x3e, 0x1a, 0x74, - 0xc2, 0xe3, 0x9f, 0x7c, 0xc2, 0xdd, 0x58, 0x33, 0x69, 0x00, 0x46, 0x42, 0x68, 0x48, 0x53, 0xb7, - 0x56, 0x2a, 0x9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 0xa4, 0x08, 0xf2, 0x01, 0x00, 0x00, + // 370 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x91, 0xcb, 0x6a, 0xdb, 0x40, + 0x14, 0x86, 0x35, 0xbe, 0xd5, 0x1e, 0xb5, 0xae, 0x3a, 0x14, 0x2a, 0x64, 0x10, 0xa6, 0x8b, 0xd6, + 0x14, 0xaa, 0x01, 0x77, 0xd1, 0xb5, 0x4b, 0xa1, 0x94, 0x82, 0x31, 0x32, 0x25, 0x90, 0x4d, 0x98, + 0xd1, 0x1c, 0x64, 0x61, 0x67, 0x46, 0x8c, 0x46, 0x4e, 0x94, 0xa7, 0xc8, 0x43, 0x64, 0x91, 0x47, + 0xc9, 0xd2, 0x90, 0x4d, 0x96, 0xc1, 0x7e, 0x91, 0x20, 0xf9, 0x92, 0xcb, 0x22, 0xab, 0x39, 0x73, + 0xfe, 0xef, 0x70, 0xfe, 0xc3, 0x8f, 0x7b, 0x8a, 0x67, 0xa0, 0x97, 0xa0, 0xa9, 0x54, 0x02, 0x4e, + 0x58, 0x14, 0xa9, 0x5c, 0x9a, 0x20, 0xd5, 0xca, 0x28, 0xd2, 0xbb, 0x00, 0xc3, 0xa2, 0x19, 0x4b, + 0x64, 0x50, 0x55, 0x4a, 0x43, 0xb0, 0xe7, 0xbd, 0x8f, 0xb1, 0x8a, 0x55, 0xc5, 0xd1, 0xb2, 0xda, + 0x8e, 0x78, 0x9f, 0xd2, 0x79, 0x4c, 0x23, 0x5d, 0xa4, 0x46, 0xed, 0x9e, 0xad, 0xf0, 0xf9, 0x16, + 0x61, 0x7b, 0xac, 0x04, 0x8c, 0xb6, 0x1b, 0x88, 0x87, 0xdb, 0x2a, 0x05, 0xcd, 0x8c, 0xd2, 0x2e, + 0xea, 0xa3, 0x41, 0x27, 0x3c, 0xfc, 0xc9, 0x17, 0xdc, 0x8d, 0x35, 0x93, 0x06, 0x60,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xfc, 0x78, 0x08, 0x00, 0x00, 0xff, 0xff, 0x94, 0xd1, 0x0e, 0xdf, 0xf6, 0x01, + 0x00, 0x00, } func (m *NodeAccount) Marshal() (dAtA []byte, err error) { @@ -382,7 +383,7 @@ func (m *NodeAccount) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.GranteePubkey == nil { - m.GranteePubkey = &common.PubKeySet{} + m.GranteePubkey = &crypto.PubKeySet{} } if err := m.GranteePubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/observer/types/nonce_to_cctx.pb.go b/x/observer/types/nonce_to_cctx.pb.go index b6c0a77386..0e7e05e98c 100644 --- a/x/observer/types/nonce_to_cctx.pb.go +++ b/x/observer/types/nonce_to_cctx.pb.go @@ -11,7 +11,6 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - _ "github.com/zeta-chain/zetacore/common" ) // Reference imports to suppress errors if they are not otherwise used. @@ -101,23 +100,22 @@ func init() { func init() { proto.RegisterFile("observer/nonce_to_cctx.proto", fileDescriptor_6f9bbe8a689fa6e4) } var fileDescriptor_6f9bbe8a689fa6e4 = []byte{ - // 242 bytes of a gzipped FileDescriptorProto + // 230 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xc9, 0x4f, 0x2a, 0x4e, 0x2d, 0x2a, 0x4b, 0x2d, 0xd2, 0xcf, 0xcb, 0xcf, 0x4b, 0x4e, 0x8d, 0x2f, 0xc9, 0x8f, 0x4f, 0x4e, 0x2e, 0xa9, 0xd0, 0x2b, 0x28, 0xca, 0x2f, 0xc9, 0x17, 0x92, 0xae, 0x4a, 0x2d, 0x49, 0x4c, 0xce, - 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x60, 0x1a, 0xa4, 0x84, 0x93, 0xf3, - 0x73, 0x73, 0xf3, 0xf3, 0xf4, 0x21, 0x14, 0x44, 0x87, 0x94, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x98, - 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, 0xf2, 0xb8, 0xb8, 0xfd, 0x40, 0xc6, 0x87, 0xe4, 0x3b, 0x27, - 0x97, 0x54, 0x08, 0x49, 0x72, 0x71, 0x80, 0x0d, 0x8d, 0xcf, 0x4c, 0x91, 0x60, 0x54, 0x60, 0xd4, - 0x60, 0x0e, 0x62, 0x07, 0xf3, 0x3d, 0x53, 0x84, 0x44, 0xb8, 0x58, 0xc1, 0x0e, 0x91, 0x60, 0x02, - 0x8b, 0x43, 0x38, 0x42, 0x32, 0x5c, 0x9c, 0x20, 0x57, 0x79, 0xe6, 0xa5, 0xa4, 0x56, 0x48, 0x30, - 0x2b, 0x30, 0x6a, 0x70, 0x06, 0x21, 0x04, 0x84, 0x04, 0xb8, 0x98, 0x4b, 0x8a, 0x8b, 0x25, 0x58, - 0xc0, 0xe2, 0x20, 0xa6, 0x93, 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, 0xbc, 0xa4, 0x0b, - 0xb6, 0x58, 0x1f, 0xe6, 0x3b, 0xfd, 0x0a, 0x7d, 0x78, 0x80, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, - 0xb1, 0x81, 0x7d, 0x60, 0x0c, 0x08, 0x00, 0x00, 0xff, 0xff, 0x18, 0xf1, 0x0b, 0xf9, 0x29, 0x01, - 0x00, 0x00, + 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x60, 0x1a, 0xa4, 0x44, 0xd2, 0xf3, + 0xd3, 0xf3, 0xc1, 0xea, 0xf4, 0x41, 0x2c, 0x88, 0x16, 0xa5, 0x3c, 0x2e, 0x6e, 0x3f, 0x90, 0x49, + 0x21, 0xf9, 0xce, 0xc9, 0x25, 0x15, 0x42, 0x92, 0x5c, 0x1c, 0x60, 0xfd, 0xf1, 0x99, 0x29, 0x12, + 0x8c, 0x0a, 0x8c, 0x1a, 0xcc, 0x41, 0xec, 0x60, 0xbe, 0x67, 0x8a, 0x90, 0x08, 0x17, 0x2b, 0xd8, + 0x4e, 0x09, 0x26, 0xb0, 0x38, 0x84, 0x23, 0x24, 0xc3, 0xc5, 0x09, 0x72, 0x80, 0x67, 0x5e, 0x4a, + 0x6a, 0x85, 0x04, 0xb3, 0x02, 0xa3, 0x06, 0x67, 0x10, 0x42, 0x40, 0x48, 0x80, 0x8b, 0xb9, 0xa4, + 0xb8, 0x58, 0x82, 0x05, 0x2c, 0x0e, 0x62, 0x3a, 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, 0xf5, 0xba, 0x60, 0x8b, 0xf5, 0x61, 0x1e, 0xd1, 0xaf, 0xd0, 0x87, 0xfb, 0xbd, 0xa4, 0xb2, + 0x20, 0xb5, 0x38, 0x89, 0x0d, 0xec, 0x03, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x54, 0xf7, + 0xb7, 0x20, 0x14, 0x01, 0x00, 0x00, } func (m *NonceToCctx) Marshal() (dAtA []byte, err error) { diff --git a/x/observer/types/observer.pb.go b/x/observer/types/observer.pb.go index 07218c037a..ede9e119a5 100644 --- a/x/observer/types/observer.pb.go +++ b/x/observer/types/observer.pb.go @@ -11,7 +11,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + chains "github.com/zeta-chain/zetacore/pkg/chains" ) // Reference imports to suppress errors if they are not otherwise used. @@ -89,7 +89,7 @@ func (ObserverUpdateReason) EnumDescriptor() ([]byte, []int) { type ObserverMapper struct { Index string `protobuf:"bytes,1,opt,name=index,proto3" json:"index,omitempty"` - ObserverChain *common.Chain `protobuf:"bytes,2,opt,name=observer_chain,json=observerChain,proto3" json:"observer_chain,omitempty"` + ObserverChain *chains.Chain `protobuf:"bytes,2,opt,name=observer_chain,json=observerChain,proto3" json:"observer_chain,omitempty"` ObserverList []string `protobuf:"bytes,4,rep,name=observer_list,json=observerList,proto3" json:"observer_list,omitempty"` } @@ -133,7 +133,7 @@ func (m *ObserverMapper) GetIndex() string { return "" } -func (m *ObserverMapper) GetObserverChain() *common.Chain { +func (m *ObserverMapper) GetObserverChain() *chains.Chain { if m != nil { return m.ObserverChain } @@ -254,34 +254,34 @@ func init() { func init() { proto.RegisterFile("observer/observer.proto", fileDescriptor_3004233a4a5969ce) } var fileDescriptor_3004233a4a5969ce = []byte{ - // 427 bytes of a gzipped FileDescriptorProto + // 429 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x6c, 0x52, 0xc1, 0x8a, 0x13, 0x41, - 0x10, 0x9d, 0x4e, 0xa2, 0x90, 0x8e, 0xc9, 0xce, 0xb6, 0x11, 0x43, 0x84, 0x21, 0xac, 0x97, 0xb0, - 0x68, 0x1a, 0x56, 0x7f, 0xc0, 0x0d, 0xa2, 0x8b, 0x91, 0x85, 0x49, 0x16, 0xc1, 0x4b, 0xe8, 0x64, - 0xca, 0x49, 0x43, 0xa6, 0x7b, 0x98, 0xae, 0x48, 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 0x9f, 0x90, 0xef, 0x87, 0x24, 0xba, 0x3b, 0x24, 0xd1, 0xef, 0x43, 0x12, 0x7d, + 0xcc, 0x4a, 0x81, 0xcb, 0xcd, 0x3c, 0x5d, 0xa8, 0x75, 0x66, 0x6f, 0xe6, 0xb9, 0xfb, 0xb4, 0x2c, + 0x9c, 0x4f, 0xb6, 0xbd, 0xbf, 0xb1, 0x0c, 0x77, 0x1a, 0xcc, 0xfc, 0xa1, 0x3b, 0x8f, 0x17, 0x7f, + 0x03, 0x00, 0x00, 0xff, 0xff, 0x91, 0x8a, 0xa2, 0x49, 0x85, 0x02, 0x00, 0x00, } func (m *ObserverMapper) Marshal() (dAtA []byte, err error) { @@ -561,7 +561,7 @@ func (m *ObserverMapper) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.ObserverChain == nil { - m.ObserverChain = &common.Chain{} + m.ObserverChain = &chains.Chain{} } if err := m.ObserverChain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/observer/types/observer_set.go b/x/observer/types/observer_set.go index e1b6c61c9b..483f28592c 100644 --- a/x/observer/types/observer_set.go +++ b/x/observer/types/observer_set.go @@ -2,7 +2,7 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" ) func (m *ObserverSet) Len() int { @@ -24,11 +24,11 @@ func (m *ObserverSet) Validate() error { return nil } -func CheckReceiveStatus(status common.ReceiveStatus) error { +func CheckReceiveStatus(status chains.ReceiveStatus) error { switch status { - case common.ReceiveStatus_Success: + case chains.ReceiveStatus_Success: return nil - case common.ReceiveStatus_Failed: + case chains.ReceiveStatus_Failed: return nil default: return ErrInvalidStatus diff --git a/x/observer/types/params.go b/x/observer/types/params.go index 5dda864446..7fc72c1e89 100644 --- a/x/observer/types/params.go +++ b/x/observer/types/params.go @@ -5,7 +5,7 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" paramtypes "github.com/cosmos/cosmos-sdk/x/params/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "gopkg.in/yaml.v2" ) @@ -28,7 +28,7 @@ func NewParams(observerParams []*ObserverParams, adminParams []*Admin_Policy, ba // privnet chains are supported by default for testing purposes // custom params must be provided in genesis for other networks func DefaultParams() Params { - chains := common.PrivnetChainList() + chains := chains.PrivnetChainList() observerParams := make([]*ObserverParams, len(chains)) for i, chain := range chains { observerParams[i] = &ObserverParams{ diff --git a/x/observer/types/params.pb.go b/x/observer/types/params.pb.go index c2d571d7a2..8e223d5571 100644 --- a/x/observer/types/params.pb.go +++ b/x/observer/types/params.pb.go @@ -12,7 +12,7 @@ import ( github_com_cosmos_cosmos_sdk_types "github.com/cosmos/cosmos-sdk/types" _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + chains "github.com/zeta-chain/zetacore/pkg/chains" ) // Reference imports to suppress errors if they are not otherwise used. @@ -232,7 +232,7 @@ func (m *ChainParams) GetIsSupported() bool { // Deprecated(v13): Use ChainParamsList type ObserverParams struct { - Chain *common.Chain `protobuf:"bytes,1,opt,name=chain,proto3" json:"chain,omitempty"` + Chain *chains.Chain `protobuf:"bytes,1,opt,name=chain,proto3" json:"chain,omitempty"` BallotThreshold github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,3,opt,name=ballot_threshold,json=ballotThreshold,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"ballot_threshold"` MinObserverDelegation github_com_cosmos_cosmos_sdk_types.Dec `protobuf:"bytes,4,opt,name=min_observer_delegation,json=minObserverDelegation,proto3,customtype=github.com/cosmos/cosmos-sdk/types.Dec" json:"min_observer_delegation"` IsSupported bool `protobuf:"varint,5,opt,name=is_supported,json=isSupported,proto3" json:"is_supported,omitempty"` @@ -271,7 +271,7 @@ func (m *ObserverParams) XXX_DiscardUnknown() { var xxx_messageInfo_ObserverParams proto.InternalMessageInfo -func (m *ObserverParams) GetChain() *common.Chain { +func (m *ObserverParams) GetChain() *chains.Chain { if m != nil { return m.Chain } @@ -412,58 +412,58 @@ func init() { func init() { proto.RegisterFile("observer/params.proto", fileDescriptor_4542fa62877488a1) } var fileDescriptor_4542fa62877488a1 = []byte{ - // 808 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x41, 0x8f, 0xdb, 0x44, - 0x14, 0xc7, 0xe3, 0x4d, 0x76, 0xbb, 0x7d, 0xce, 0x26, 0xa9, 0x69, 0xa9, 0xc9, 0x0a, 0x6f, 0x08, - 0x12, 0x0a, 0xad, 0xd6, 0x86, 0x85, 0x13, 0x82, 0xc3, 0x6e, 0x7a, 0x59, 0xb1, 0x88, 0x95, 0x1b, - 0x0e, 0x70, 0x60, 0x34, 0x19, 0x4f, 0x93, 0x51, 0x6c, 0x3f, 0x6b, 0x66, 0x5c, 0x12, 0x3e, 0x05, - 0x47, 0x24, 0x2e, 0x48, 0x70, 0xe0, 0xa3, 0xf4, 0xd8, 0x23, 0xe2, 0x50, 0xa1, 0xdd, 0x0b, 0x1f, - 0x03, 0x79, 0x6c, 0x87, 0x6c, 0xb7, 0x5a, 0xa4, 0x4a, 0x3d, 0xf9, 0x79, 0xde, 0xef, 0xfd, 0xe7, - 0xcd, 0x9b, 0xf7, 0x6c, 0xb8, 0x87, 0x53, 0xc5, 0xe5, 0x53, 0x2e, 0x83, 0x8c, 0x4a, 0x9a, 0x28, - 0x3f, 0x93, 0xa8, 0xd1, 0xd9, 0xff, 0x91, 0x6b, 0xca, 0xe6, 0x54, 0xa4, 0xbe, 0xb1, 0x50, 0x72, - 0xbf, 0x26, 0xfb, 0x6f, 0x31, 0x4c, 0x12, 0x4c, 0x83, 0xf2, 0x51, 0x46, 0xf4, 0xef, 0xce, 0x70, - 0x86, 0xc6, 0x0c, 0x0a, 0xab, 0x5a, 0xbd, 0x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 0x42, 0x99, 0x7e, 0x68, - 0x86, 0x77, 0x4b, 0xef, 0x57, 0x95, 0xf3, 0xc4, 0xf8, 0x3e, 0x6b, 0xfd, 0xfc, 0xeb, 0x41, 0xe3, - 0xc1, 0x43, 0xb0, 0x37, 0xea, 0xe3, 0x00, 0xec, 0xcc, 0x24, 0xe6, 0xd9, 0xc7, 0xbd, 0xc6, 0xda, - 0x3e, 0xea, 0x59, 0xfd, 0xd6, 0x1f, 0xbf, 0x7b, 0xd6, 0xc9, 0xe9, 0xb3, 0x0b, 0xcf, 0x7a, 0x7e, - 0xe1, 0x59, 0x7f, 0x5f, 0x78, 0xd6, 0x4f, 0x97, 0x5e, 0xe3, 0xf9, 0xa5, 0xd7, 0xf8, 0xf3, 0xd2, - 0x6b, 0x7c, 0x17, 0x6c, 0x34, 0x42, 0x91, 0xfa, 0xa1, 0x39, 0x45, 0x50, 0x9f, 0x22, 0x58, 0xae, - 0xff, 0x3d, 0x65, 0x57, 0x4c, 0x77, 0xcc, 0x2f, 0xe8, 0x93, 0x7f, 0x03, 0x00, 0x00, 0xff, 0xff, - 0xaf, 0x0f, 0xcf, 0xef, 0xfc, 0x06, 0x00, 0x00, + // 805 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x41, 0x6f, 0xe3, 0x44, + 0x14, 0xc7, 0xe3, 0x24, 0xcd, 0x76, 0x9f, 0xd3, 0x24, 0x6b, 0xed, 0xb2, 0x26, 0x15, 0x6e, 0x08, + 0x12, 0x0a, 0xbb, 0xaa, 0x0d, 0x81, 0x13, 0x82, 0x43, 0x9b, 0xbd, 0x44, 0x14, 0x51, 0x79, 0xc3, + 0x01, 0x0e, 0x8c, 0x26, 0xe3, 0x59, 0x67, 0x14, 0xc7, 0x63, 0xcd, 0x8c, 0x4b, 0xc2, 0xa7, 0xe0, + 0x88, 0xc4, 0x05, 0x09, 0x0e, 0x7c, 0x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, 0xfa, + 0xb7, 0x00, 0x07, 0x00, 0x00, } func (m *ChainParamsList) Marshal() (dAtA []byte, err error) { @@ -1448,7 +1448,7 @@ func (m *ObserverParams) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Chain == nil { - m.Chain = &common.Chain{} + m.Chain = &chains.Chain{} } if err := m.Chain.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/observer/types/parsers.go b/x/observer/types/parsers.go index a1d3c9a889..ad7537e18e 100644 --- a/x/observer/types/parsers.go +++ b/x/observer/types/parsers.go @@ -2,14 +2,14 @@ package types import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" ) -func ConvertReceiveStatusToVoteType(status common.ReceiveStatus) VoteType { +func ConvertReceiveStatusToVoteType(status chains.ReceiveStatus) VoteType { switch status { - case common.ReceiveStatus_Success: + case chains.ReceiveStatus_Success: return VoteType_SuccessObservation - case common.ReceiveStatus_Failed: + case chains.ReceiveStatus_Failed: return VoteType_FailureObservation default: return VoteType_NotYetVoted diff --git a/x/observer/types/pending_nonces.pb.go b/x/observer/types/pending_nonces.pb.go index dee38660f7..2769d17d76 100644 --- a/x/observer/types/pending_nonces.pb.go +++ b/x/observer/types/pending_nonces.pb.go @@ -11,7 +11,6 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" proto "github.com/gogo/protobuf/proto" - _ "github.com/zeta-chain/zetacore/common" ) // Reference imports to suppress errors if they are not otherwise used. @@ -101,23 +100,22 @@ func init() { func init() { proto.RegisterFile("observer/pending_nonces.proto", fileDescriptor_dd001e4838750ecf) } var fileDescriptor_dd001e4838750ecf = []byte{ - // 251 bytes of a gzipped FileDescriptorProto + // 239 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x92, 0xcd, 0x4f, 0x2a, 0x4e, 0x2d, 0x2a,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x44, 0xe9, 0xa7, 0x67, 0x96, 0x64, 0x94, 0x26, - 0xe9, 0x25, 0xe7, 0xe7, 0xea, 0x83, 0x3c, 0xa7, 0x0b, 0x36, 0x44, 0x1f, 0xe6, 0x4f, 0xfd, 0x0a, - 0x7d, 0x78, 0xd8, 0x94, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, 0xfd, 0x62, 0x0c, 0x08, 0x00, - 0x00, 0xff, 0xff, 0xd9, 0xc8, 0x8e, 0xf9, 0x34, 0x01, 0x00, 0x00, + 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x03, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x60, 0x3a, 0xa4, 0x44, 0xd2, + 0xf3, 0xd3, 0xf3, 0xc1, 0xea, 0xf4, 0x41, 0x2c, 0x88, 0x16, 0xa5, 0x0a, 0x2e, 0xde, 0x00, 0x88, + 0x51, 0x7e, 0x60, 0x93, 0x84, 0xa4, 0xb9, 0x38, 0xc1, 0x66, 0xc6, 0xe7, 0xe4, 0x97, 0x4b, 0x30, + 0x2a, 0x30, 0x6a, 0x30, 0x07, 0x71, 0x80, 0x05, 0x7c, 0xf2, 0xcb, 0x85, 0x64, 0xb9, 0xb8, 0x20, + 0x92, 0x19, 0x99, 0xe9, 0x19, 0x12, 0x4c, 0x60, 0x59, 0x88, 0x72, 0x8f, 0xcc, 0xf4, 0x0c, 0x21, + 0x49, 0x2e, 0x0e, 0xb0, 0xed, 0xf1, 0x99, 0x29, 0x12, 0xcc, 0x60, 0x49, 0x76, 0x30, 0xdf, 0x33, + 0x45, 0x48, 0x80, 0x8b, 0xb9, 0xa4, 0xb8, 0x58, 0x82, 0x45, 0x81, 0x51, 0x83, 0x33, 0x08, 0xc4, + 0x74, 0xf2, 0x3c, 0xf1, 0x48, 0x8e, 0xf1, 0xc2, 0x23, 0x39, 0xc6, 0x07, 0x8f, 0xe4, 0x18, 0x27, + 0x3c, 0x96, 0x63, 0xb8, 0xf0, 0x58, 0x8e, 0xe1, 0xc6, 0x63, 0x39, 0x86, 0x28, 0xfd, 0xf4, 0xcc, + 0x92, 0x8c, 0xd2, 0x24, 0xbd, 0xe4, 0xfc, 0x5c, 0x7d, 0x90, 0x3f, 0x74, 0xc1, 0x86, 0xe8, 0xc3, + 0xbc, 0xa4, 0x5f, 0xa1, 0x0f, 0x0f, 0x86, 0x92, 0xca, 0x82, 0xd4, 0xe2, 0x24, 0x36, 0xb0, 0x5f, + 0x8c, 0x01, 0x01, 0x00, 0x00, 0xff, 0xff, 0xa8, 0x1d, 0x35, 0x4c, 0x1f, 0x01, 0x00, 0x00, } func (m *PendingNonces) Marshal() (dAtA []byte, err error) { diff --git a/x/observer/types/query.pb.go b/x/observer/types/query.pb.go index 73d1d320b3..4c2dc1375c 100644 --- a/x/observer/types/query.pb.go +++ b/x/observer/types/query.pb.go @@ -14,7 +14,8 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + chains "github.com/zeta-chain/zetacore/pkg/chains" + proofs "github.com/zeta-chain/zetacore/pkg/proofs" _ "google.golang.org/genproto/googleapis/api/annotations" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" @@ -787,7 +788,7 @@ func (m *QueryTssHistoryResponse) GetPagination() *query.PageResponse { type QueryProveRequest struct { ChainId int64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` TxHash string `protobuf:"bytes,2,opt,name=tx_hash,json=txHash,proto3" json:"tx_hash,omitempty"` - Proof *common.Proof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` + Proof *proofs.Proof `protobuf:"bytes,3,opt,name=proof,proto3" json:"proof,omitempty"` BlockHash string `protobuf:"bytes,4,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` TxIndex int64 `protobuf:"varint,5,opt,name=tx_index,json=txIndex,proto3" json:"tx_index,omitempty"` } @@ -839,7 +840,7 @@ func (m *QueryProveRequest) GetTxHash() string { return "" } -func (m *QueryProveRequest) GetProof() *common.Proof { +func (m *QueryProveRequest) GetProof() *proofs.Proof { if m != nil { return m.Proof } @@ -1363,7 +1364,7 @@ func (m *QuerySupportedChains) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySupportedChains proto.InternalMessageInfo type QuerySupportedChainsResponse struct { - Chains []*common.Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` + Chains []*chains.Chain `protobuf:"bytes,1,rep,name=chains,proto3" json:"chains,omitempty"` } func (m *QuerySupportedChainsResponse) Reset() { *m = QuerySupportedChainsResponse{} } @@ -1399,7 +1400,7 @@ func (m *QuerySupportedChainsResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QuerySupportedChainsResponse proto.InternalMessageInfo -func (m *QuerySupportedChainsResponse) GetChains() []*common.Chain { +func (m *QuerySupportedChainsResponse) GetChains() []*chains.Chain { if m != nil { return m.Chains } @@ -2323,7 +2324,7 @@ func (m *QueryAllBlockHeaderRequest) GetPagination() *query.PageRequest { } type QueryAllBlockHeaderResponse struct { - BlockHeaders []*common.BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers,omitempty"` + BlockHeaders []*proofs.BlockHeader `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers,omitempty"` Pagination *query.PageResponse `protobuf:"bytes,2,opt,name=pagination,proto3" json:"pagination,omitempty"` } @@ -2360,7 +2361,7 @@ func (m *QueryAllBlockHeaderResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryAllBlockHeaderResponse proto.InternalMessageInfo -func (m *QueryAllBlockHeaderResponse) GetBlockHeaders() []*common.BlockHeader { +func (m *QueryAllBlockHeaderResponse) GetBlockHeaders() []*proofs.BlockHeader { if m != nil { return m.BlockHeaders } @@ -2419,7 +2420,7 @@ func (m *QueryGetBlockHeaderByHashRequest) GetBlockHash() []byte { } type QueryGetBlockHeaderByHashResponse struct { - BlockHeader *common.BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"` + BlockHeader *proofs.BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"block_header,omitempty"` } func (m *QueryGetBlockHeaderByHashResponse) Reset() { *m = QueryGetBlockHeaderByHashResponse{} } @@ -2455,7 +2456,7 @@ func (m *QueryGetBlockHeaderByHashResponse) XXX_DiscardUnknown() { var xxx_messageInfo_QueryGetBlockHeaderByHashResponse proto.InternalMessageInfo -func (m *QueryGetBlockHeaderByHashResponse) GetBlockHeader() *common.BlockHeader { +func (m *QueryGetBlockHeaderByHashResponse) GetBlockHeader() *proofs.BlockHeader { if m != nil { return m.BlockHeader } @@ -2611,163 +2612,164 @@ func init() { func init() { proto.RegisterFile("observer/query.proto", fileDescriptor_dcb801e455adaee4) } var fileDescriptor_dcb801e455adaee4 = []byte{ - // 2495 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x5a, 0xcd, 0x6f, 0xdc, 0xc6, - 0x15, 0x37, 0xad, 0x48, 0x96, 0x9e, 0x3e, 0x2c, 0x8f, 0xe5, 0x2f, 0xda, 0x96, 0x65, 0x2a, 0x8e, - 0x65, 0xc5, 0x5e, 0xc6, 0x72, 0x12, 0xcb, 0x1f, 0x8a, 0xad, 0x75, 0x6d, 0xc9, 0x4e, 0x6a, 0x2b, - 0xbb, 0x6a, 0x53, 0x38, 0x6d, 0xb7, 0xdc, 0xdd, 0xd1, 0x2e, 0x9b, 0x15, 0xb9, 0x21, 0x47, 0x8a, - 0x36, 0xaa, 0xd0, 0xa2, 0xc7, 0xa0, 0x87, 0x00, 0x05, 0xda, 0x5b, 0x11, 0xa0, 0x68, 0x6f, 0x05, - 0x8a, 0x00, 0x45, 0x0b, 0x14, 0x3d, 0xe4, 0xd4, 0x1c, 0x7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 0xc0, 0x53, 0xbd, 0x66, 0xb2, 0xfa, 0x56, 0x39, 0x57, - 0xb1, 0x37, 0x53, 0x0b, 0xfb, 0x1d, 0x61, 0xef, 0xb4, 0x9a, 0xd4, 0x2d, 0x0f, 0xf1, 0x0f, 0x27, - 0xaf, 0xfd, 0x2f, 0x00, 0x00, 0xff, 0xff, 0x52, 0xe2, 0xbb, 0x9a, 0x01, 0x2b, 0x00, 0x00, + // 2504 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x5a, 0xcd, 0x6f, 0x1b, 0xc7, + 0x15, 0xf7, 0x5a, 0x91, 0x22, 0x3d, 0x7d, 0x58, 0x1e, 0xcb, 0x5f, 0x6b, 0x5b, 0x96, 0x57, 0x71, + 0x2c, 0x2b, 0x36, 0x19, 0xcb, 0x49, 0xfc, 0x1d, 0x5b, 0x74, 0x6d, 0xc9, 0x4e, 0x6a, 0x3b, 0xa4, + 0xdb, 0x14, 0x4e, 0x5b, 0x76, 0x49, 0x8e, 0xc8, 0xad, 0xa9, 0x5d, 0x66, 0x77, 0xa4, 0x88, 0x51, + 0x85, 0x16, 0x3d, 0x06, 0x3d, 0x04, 0x28, 0xd0, 0xde, 0x8a, 0x00, 0x45, 0x7b, 0x2b, 0x50, 0x04, + 0x28, 0x5a, 0xa0, 0xe8, 0x21, 0xa7, 0xe6, 0xd0, 0x43, 0x8a, 0x02, 0x45, 0x7b, 0x69, 0x03, 0xbb, + 0xfd, 0x3f, 0x8a, 0x9d, 0x79, 0xbb, 0x3b, 0xbb, 0x5c, 0x2e, 0x87, 0x0a, 0x7b, 0x12, 0x77, 0x66, + 0xde, 0x9b, 0xdf, 0xef, 0xcd, 0x9b, 0x99, 0xf7, 0xd3, 0x2e, 0xcc, 0x38, 0x15, 0x8f, 0xba, 0x9b, + 0xd4, 0xcd, 0xbf, 0xbf, 0x41, 0xdd, 0x76, 0xae, 0xe5, 0x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xe4, 0x63, 0x0d, 0x46, 0x44, 0xe1, + 0x41, 0xf2, 0x99, 0x5e, 0x3b, 0x25, 0x99, 0xfe, 0xaa, 0xba, 0x81, 0x20, 0x65, 0xcc, 0xff, 0xf8, + 0x6f, 0xff, 0xf9, 0xe9, 0xde, 0x13, 0xe4, 0x58, 0xde, 0x1f, 0x7f, 0x9e, 0x9b, 0xe6, 0x13, 0xff, + 0xc8, 0x25, 0x7f, 0xd2, 0x60, 0x34, 0x50, 0x48, 0xe4, 0x42, 0xef, 0x39, 0x12, 0xba, 0x4d, 0x5f, + 0xea, 0xc7, 0x04, 0x81, 0xdd, 0xe7, 0xc0, 0xbe, 0x46, 0x0a, 0xa9, 0xc0, 0x42, 0x6d, 0x96, 0xdf, + 0xee, 0x10, 0x28, 0x3b, 0xf9, 0xed, 0x98, 0x82, 0xda, 0x21, 0x7f, 0xd7, 0x80, 0x74, 0xaa, 0x1c, + 0x72, 0xad, 0x37, 0xac, 0xae, 0x0a, 0x4f, 0xbf, 0xbe, 0x3b, 0x63, 0x64, 0x77, 0x87, 0xb3, 0xbb, + 0x49, 0x6e, 0xa4, 0xb2, 0x43, 0x4a, 0x95, 0xb6, 0xc4, 0x2a, 0x8d, 0x28, 0xf9, 0x85, 0x06, 0xe3, + 0x92, 0xe2, 0x20, 0xe7, 0x7b, 0x83, 0x92, 0x86, 0xeb, 0xaf, 0xf7, 0x35, 0x3c, 0x04, 0x7f, 0x96, + 0x83, 0x9f, 0x27, 0xa7, 0x52, 0xc1, 0x87, 0x15, 0x81, 0x47, 0x19, 0xf9, 0x8d, 0x06, 0xfb, 0x12, + 0x02, 0x46, 0x25, 0x81, 0x12, 0x26, 0xfa, 0x95, 0xbe, 0x4d, 0x42, 0xb0, 0xe7, 0x38, 0xd8, 0x97, + 0xc9, 0x4b, 0xa9, 0x60, 0xbd, 0x04, 0xb6, 0x7f, 0x6b, 0x70, 0x28, 0x5d, 0xe8, 0x90, 0x9b, 0xbd, + 0x31, 0x64, 0x6a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xfe, 0x8c, 0x10, 0xdb, 0x19, 0x8e, 0xed, 0x14, 0x39, 0x99, + 0x8a, 0x8d, 0x45, 0x98, 0x7e, 0xa7, 0xc1, 0x74, 0xec, 0x93, 0x13, 0xbf, 0xd0, 0x56, 0xbb, 0x85, + 0xd3, 0x3e, 0x32, 0xd2, 0xaf, 0xee, 0xc6, 0x14, 0x41, 0x2f, 0x72, 0xd0, 0x2f, 0x11, 0x23, 0x7d, + 0xf7, 0xc6, 0xbe, 0x04, 0xfa, 0x8b, 0x06, 0x33, 0x69, 0x5f, 0xdf, 0xa8, 0x5c, 0x0c, 0x19, 0x1f, + 0xfd, 0xa8, 0x5c, 0x0c, 0x59, 0x1f, 0xfd, 0x18, 0xaf, 0x73, 0x0e, 0x79, 0x72, 0xbe, 0x37, 0x87, + 0x84, 0xae, 0x8c, 0x7d, 0x14, 0xd6, 0x87, 0xa8, 0x8c, 0xc7, 0xff, 0x72, 0xff, 0x86, 0x4a, 0x12, + 0xad, 0x1a, 0x59, 0xc4, 0x24, 0x9a, 0xe4, 0x49, 0x5d, 0xa2, 0xed, 0x0e, 0x77, 0xfa, 0x17, 0x79, + 0x3d, 0x24, 0x9a, 0x84, 0xbb, 0x70, 0xef, 0xf3, 0x67, 0xb3, 0xda, 0x17, 0xcf, 0x66, 0xb5, 0x2f, + 0x9f, 0xcd, 0x6a, 0x1f, 0x3f, 0x9f, 0xdd, 0xf3, 0xc5, 0xf3, 0xd9, 0x3d, 0xff, 0x78, 0x3e, 0xbb, + 0xe7, 0x49, 0xbe, 0x6e, 0xb1, 0xc6, 0x46, 0x25, 0x57, 0x75, 0xd6, 0x53, 0x0b, 0xfb, 0x2d, 0x69, + 0xef, 0xb4, 0x5b, 0xd4, 0xab, 0x8c, 0xf0, 0x0f, 0x27, 0x2f, 0xfe, 0x2f, 0x00, 0x00, 0xff, 0xff, + 0xcd, 0x82, 0xdb, 0xae, 0x1e, 0x2b, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -8048,7 +8050,7 @@ func (m *QueryProveRequest) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.Proof == nil { - m.Proof = &common.Proof{} + m.Proof = &proofs.Proof{} } if err := m.Proof.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err @@ -9090,7 +9092,7 @@ func (m *QuerySupportedChainsResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Chains = append(m.Chains, &common.Chain{}) + m.Chains = append(m.Chains, &chains.Chain{}) if err := m.Chains[len(m.Chains)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -10876,7 +10878,7 @@ func (m *QueryAllBlockHeaderResponse) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.BlockHeaders = append(m.BlockHeaders, &common.BlockHeader{}) + m.BlockHeaders = append(m.BlockHeaders, &proofs.BlockHeader{}) if err := m.BlockHeaders[len(m.BlockHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err } @@ -11081,7 +11083,7 @@ func (m *QueryGetBlockHeaderByHashResponse) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } if m.BlockHeader == nil { - m.BlockHeader = &common.BlockHeader{} + m.BlockHeader = &proofs.BlockHeader{} } if err := m.BlockHeader.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { return err diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go index 481efd0716..fef0e1ec4a 100644 --- a/x/observer/types/tx.pb.go +++ b/x/observer/types/tx.pb.go @@ -13,7 +13,7 @@ import ( _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" proto "github.com/gogo/protobuf/proto" - common "github.com/zeta-chain/zetacore/common" + proofs "github.com/zeta-chain/zetacore/pkg/proofs" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -139,7 +139,7 @@ type MsgAddBlockHeader struct { ChainId int64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"` BlockHash []byte `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` Height int64 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"` - Header common.HeaderData `protobuf:"bytes,5,opt,name=header,proto3" json:"header"` + Header proofs.HeaderData `protobuf:"bytes,5,opt,name=header,proto3" json:"header"` } func (m *MsgAddBlockHeader) Reset() { *m = MsgAddBlockHeader{} } @@ -203,11 +203,11 @@ func (m *MsgAddBlockHeader) GetHeight() int64 { return 0 } -func (m *MsgAddBlockHeader) GetHeader() common.HeaderData { +func (m *MsgAddBlockHeader) GetHeader() proofs.HeaderData { if m != nil { return m.Header } - return common.HeaderData{} + return proofs.HeaderData{} } type MsgAddBlockHeaderResponse struct { @@ -950,71 +950,71 @@ func init() { func init() { proto.RegisterFile("observer/tx.proto", fileDescriptor_1bcd40fa296a2b1d) } var fileDescriptor_1bcd40fa296a2b1d = []byte{ - // 1021 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x56, 0xcb, 0x6e, 0xdb, 0x46, - 0x17, 0x36, 0xa3, 0xc4, 0xb1, 0x8f, 0x1c, 0x5f, 0x26, 0x76, 0x2c, 0xcb, 0xb1, 0x62, 0x70, 0xf1, - 0x43, 0x7f, 0xeb, 0x4a, 0xb6, 0xd2, 0x16, 0x4d, 0x81, 0x2e, 0xec, 0x5e, 0x6c, 0x35, 0x4d, 0x6c, - 0x10, 0xa8, 0x17, 0xdd, 0x10, 0x23, 0xce, 0x98, 0x24, 0x42, 0xcd, 0x08, 0x1c, 0x2a, 0xb6, 0x8a, - 0xb6, 0x40, 0x1f, 0xa0, 0x68, 0x1f, 0xa0, 0x2f, 0xd1, 0x77, 0xe8, 0x22, 0xcb, 0x2c, 0xbb, 0x2a, - 0x0a, 0x7b, 0xd5, 0xbe, 0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d5, 0xfb, 0x0f, 0xfd, 0x5e, 0x87, 0x8a, 0xd6, 0xbc, 0x7c, 0xeb, 0x3f, 0xfd, - 0x2f, 0x00, 0x00, 0xff, 0xff, 0xd0, 0xc2, 0x64, 0xda, 0xe2, 0x0c, 0x00, 0x00, + // 1024 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x9c, 0x57, 0x4d, 0x6f, 0xe3, 0x44, + 0x18, 0xae, 0x37, 0xfb, 0xd1, 0xbe, 0xe9, 0xf6, 0x63, 0x48, 0xb7, 0x69, 0xba, 0xcd, 0x56, 0x3e, + 0xa0, 0x00, 0x25, 0x69, 0xb3, 0x80, 0x58, 0x24, 0x0e, 0x2d, 0x1f, 0x6d, 0x58, 0x76, 0x5b, 0x59, + 0xa2, 0x07, 0x2e, 0xd6, 0xc4, 0x33, 0xb1, 0xad, 0x3a, 0x33, 0x91, 0xc7, 0xd9, 0x36, 0x08, 0x90, + 0xf8, 0x01, 0x08, 0x7e, 0x00, 0x7f, 0x82, 0xff, 0xc0, 0x61, 0x8f, 0x7b, 0xe4, 0x84, 0x50, 0x7b, + 0x82, 0x3f, 0xc0, 0x15, 0x79, 0x6c, 0x4f, 0xe2, 0x7c, 0x38, 0x49, 0x4f, 0xcd, 0xcc, 0xfb, 0xbc, + 0xcf, 0xfb, 0x31, 0xcf, 0xbc, 0xe3, 0xc2, 0x3a, 0x6f, 0x0a, 0xea, 0xbf, 0xa2, 0x7e, 0x2d, 0xb8, + 0xaa, 0x76, 0x7c, 0x1e, 0x70, 0xb4, 0xfd, 0x1d, 0x0d, 0xb0, 0xe5, 0x60, 0x97, 0x55, 0xe5, 0x2f, + 0xee, 0xd3, 0x6a, 0x82, 0x2a, 0x15, 0x6c, 0x6e, 0x73, 0x89, 0xab, 0x85, 0xbf, 0x22, 0x97, 0x52, + 0x41, 0xb1, 0x34, 0x3d, 0xdc, 0xa6, 0xf1, 0xee, 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, 0xfa, 0x60, 0x1e, 0xb4, 0x8a, 0xf9, 0xb3, 0x06, 0x1b, 0xe3, 0xa7, 0xe4, 0x87, 0x33, 0x36, + 0x33, 0xed, 0x56, 0xfa, 0xf4, 0x56, 0x6e, 0x83, 0x3d, 0x48, 0xcd, 0x85, 0xbd, 0xd9, 0xe8, 0x22, + 0xf4, 0xf4, 0x1e, 0x8c, 0x1b, 0x18, 0xa1, 0xf2, 0x87, 0x3e, 0xc9, 0xaa, 0x33, 0xf5, 0x52, 0xe1, + 0xa7, 0x2b, 0x7f, 0xfc, 0xf7, 0x13, 0xfa, 0x11, 0xd6, 0x46, 0xc6, 0xd4, 0xfe, 0x74, 0x01, 0xa5, + 0x3d, 0x4a, 0x1f, 0xcf, 0xeb, 0x91, 0xc4, 0x3f, 0x6a, 0xbc, 0xbe, 0x2e, 0x6b, 0x6f, 0xae, 0xcb, + 0xda, 0xdf, 0xd7, 0x65, 0xed, 0xd7, 0x9b, 0xf2, 0xc2, 0x9b, 0x9b, 0xf2, 0xc2, 0x9f, 0x37, 0xe5, + 0x85, 0x6f, 0x6b, 0xb6, 0x1b, 0x38, 0xdd, 0x66, 0xd5, 0xe2, 0xed, 0x5a, 0xc8, 0xf9, 0xbe, 0xa4, + 0xaf, 0x25, 0xf4, 0xb5, 0xab, 0x5a, 0xff, 0x3f, 0x80, 0x5e, 0x87, 0x8a, 0xe6, 0x7d, 0xf9, 0xad, + 0xff, 0xf4, 0xff, 0x00, 0x00, 0x00, 0xff, 0xff, 0xc5, 0x1a, 0xf7, 0xc9, 0xe6, 0x0c, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. diff --git a/zetaclient/app_context/app_context.go b/zetaclient/app_context/app_context.go index d73f48d9d0..ba4cafbace 100644 --- a/zetaclient/app_context/app_context.go +++ b/zetaclient/app_context/app_context.go @@ -1,7 +1,7 @@ package appcontext import ( - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/zetaclient/config" corecontext "github.com/zeta-chain/zetacore/zetaclient/core_context" ) @@ -32,12 +32,12 @@ func (a AppContext) ZetaCoreContext() *corecontext.ZetaCoreContext { } // GetBTCChainAndConfig returns btc chain and config if enabled -func (a AppContext) GetBTCChainAndConfig() (common.Chain, config.BTCConfig, bool) { +func (a AppContext) GetBTCChainAndConfig() (chains.Chain, config.BTCConfig, bool) { btcConfig, configEnabled := a.Config().GetBTCConfig() btcChain, _, paramsEnabled := a.ZetaCoreContext().GetBTCChainParams() if !configEnabled || !paramsEnabled { - return common.Chain{}, config.BTCConfig{}, false + return chains.Chain{}, config.BTCConfig{}, false } return btcChain, btcConfig, true diff --git a/zetaclient/authz/authz_signer.go b/zetaclient/authz/authz_signer.go index cc9cccb37a..42f9cea92a 100644 --- a/zetaclient/authz/authz_signer.go +++ b/zetaclient/authz/authz_signer.go @@ -2,12 +2,12 @@ package authz import ( sdk "github.com/cosmos/cosmos-sdk/types" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/authz" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" ) type Signer struct { - KeyType common.KeyType + KeyType authz.KeyType GranterAddress string GranteeAddress sdk.AccAddress } @@ -21,7 +21,7 @@ var signers map[string]Signer func init() { signersList := make(map[string]Signer) for _, tx := range crosschaintypes.GetAllAuthzZetaclientTxTypes() { - signersList[tx] = Signer{KeyType: common.ZetaClientGranteeKey} + signersList[tx] = Signer{KeyType: authz.ZetaClientGranteeKey} } signers = signersList } diff --git a/zetaclient/bitcoin/bitcoin_client.go b/zetaclient/bitcoin/bitcoin_client.go index 514447f0d9..8f9c1f9463 100644 --- a/zetaclient/bitcoin/bitcoin_client.go +++ b/zetaclient/bitcoin/bitcoin_client.go @@ -13,6 +13,10 @@ import ( "sync/atomic" "time" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/constant" + "github.com/zeta-chain/zetacore/pkg/proofs" corecontext "github.com/zeta-chain/zetacore/zetaclient/core_context" appcontext "github.com/zeta-chain/zetacore/zetaclient/app_context" @@ -34,7 +38,6 @@ import ( lru "github.com/hashicorp/golang-lru" "github.com/pkg/errors" "github.com/rs/zerolog" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" clienttypes "github.com/zeta-chain/zetacore/zetaclient/types" @@ -62,7 +65,7 @@ type BTCLog struct { // BTCChainClient represents a chain configuration for Bitcoin // Filled with above constants depending on chain type BTCChainClient struct { - chain common.Chain + chain chains.Chain netParams *chaincfg.Params rpcClient interfaces.BTCRPCClient zetaClient interfaces.ZetaCoreBridger @@ -118,7 +121,7 @@ func (ob *BTCChainClient) WithBtcClient(client *rpcclient.Client) { ob.rpcClient = client } -func (ob *BTCChainClient) WithChain(chain common.Chain) { +func (ob *BTCChainClient) WithChain(chain chains.Chain) { ob.Mu.Lock() defer ob.Mu.Unlock() ob.chain = chain @@ -139,7 +142,7 @@ func (ob *BTCChainClient) GetChainParams() observertypes.ChainParams { // NewBitcoinClient returns a new configuration based on supplied target chain func NewBitcoinClient( appcontext *appcontext.AppContext, - chain common.Chain, + chain chains.Chain, bridge interfaces.ZetaCoreBridger, tss interfaces.TSSSigner, dbpath string, @@ -152,7 +155,7 @@ func NewBitcoinClient( } ob.stop = make(chan struct{}) ob.chain = chain - netParams, err := common.BitcoinNetParamsFromChainID(ob.chain.ChainId) + netParams, err := chains.BitcoinNetParamsFromChainID(ob.chain.ChainId) if err != nil { return nil, fmt.Errorf("error getting net params for chain %d: %s", ob.chain.ChainId, err) } @@ -370,7 +373,7 @@ func (ob *BTCChainClient) postBlockHeader(tip int64) error { ob.chain.ChainId, blockHash[:], res2.Block.Height, - common.NewBitcoinHeader(headerBuf.Bytes()), + proofs.NewBitcoinHeader(headerBuf.Bytes()), ) ob.logger.WatchInTx.Info().Msgf("posted block header %d: %s", bn, blockHash) if err != nil { // error shouldn't block the process @@ -559,10 +562,10 @@ func (ob *BTCChainClient) IsSendOutTxProcessed(cctx *types.CrossChainTx, logger nil, // gas price not used with Bitcoin 0, // gas limit not used with Bitcoin amountInSat, - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, ob.chain, nonce, - common.CoinType_Gas, + coin.CoinType_Gas, ) if err != nil { logger.Error().Err(err).Msgf("IsSendOutTxProcessed: error confirming bitcoin outTx %s, nonce %d ballot %s", res.TxID, nonce, ballot) @@ -699,7 +702,7 @@ func (ob *BTCChainClient) GetInboundVoteMessageFromBtcEvent(inTx *BTCInTxEvnet) inTx.TxHash, inTx.BlockNumber, 0, - common.CoinType_Gas, + coin.CoinType_Gas, "", ob.zetaClient.GetKeys().GetOperatorAddress().String(), 0, @@ -709,7 +712,7 @@ func (ob *BTCChainClient) GetInboundVoteMessageFromBtcEvent(inTx *BTCInTxEvnet) // IsInTxRestricted returns true if the inTx contains restricted addresses func (ob *BTCChainClient) IsInTxRestricted(inTx *BTCInTxEvnet) bool { receiver := "" - parsedAddress, _, err := common.ParseAddressAndData(hex.EncodeToString(inTx.MemoBytes)) + parsedAddress, _, err := chains.ParseAddressAndData(hex.EncodeToString(inTx.MemoBytes)) if err == nil && parsedAddress != (ethcommon.Address{}) { receiver = parsedAddress.Hex() } @@ -769,7 +772,7 @@ func GetBtcEvent( logger.Warn().Err(err).Msgf("error hex decoding memo") return nil, fmt.Errorf("error hex decoding memo: %s", err) } - if bytes.Equal(memoBytes, []byte(common.DonationMessage)) { + if bytes.Equal(memoBytes, []byte(constant.DonationMessage)) { logger.Info().Msgf("donation tx: %s; value %f", tx.Txid, value) return nil, fmt.Errorf("donation tx: %s; value %f", tx.Txid, value) } @@ -852,7 +855,7 @@ func (ob *BTCChainClient) FetchUTXOS() error { // List all unspent UTXOs (160ms) tssAddr := ob.Tss.BTCAddress() - address, err := common.DecodeBtcAddress(tssAddr, ob.chain.ChainId) + address, err := chains.DecodeBtcAddress(tssAddr, ob.chain.ChainId) if err != nil { return fmt.Errorf("btc: error decoding wallet address (%s) : %s", tssAddr, err.Error()) } @@ -967,7 +970,7 @@ func (ob *BTCChainClient) getOutTxidByNonce(nonce uint64, test bool) (string, er func (ob *BTCChainClient) findNonceMarkUTXO(nonce uint64, txid string) (int, error) { tssAddress := ob.Tss.BTCAddressWitnessPubkeyHash().EncodeAddress() - amount := common.NonceMarkAmount(nonce) + amount := chains.NonceMarkAmount(nonce) for i, utxo := range ob.utxos { sats, err := GetSatoshis(utxo.Amount) if err != nil { @@ -1340,8 +1343,8 @@ func (ob *BTCChainClient) checkTSSVout(params *types.OutboundTxParams, vouts []b if recvAddress != tssAddress { return fmt.Errorf("checkTSSVout: nonce-mark address %s not match TSS address %s", recvAddress, tssAddress) } - if amount != common.NonceMarkAmount(nonce) { - return fmt.Errorf("checkTSSVout: nonce-mark amount %d not match nonce-mark amount %d", amount, common.NonceMarkAmount(nonce)) + if amount != chains.NonceMarkAmount(nonce) { + return fmt.Errorf("checkTSSVout: nonce-mark amount %d not match nonce-mark amount %d", amount, chains.NonceMarkAmount(nonce)) } } // 2nd vout: payment to recipient @@ -1385,8 +1388,8 @@ func (ob *BTCChainClient) checkTSSVoutCancelled(params *types.OutboundTxParams, if recvAddress != tssAddress { return fmt.Errorf("checkTSSVoutCancelled: nonce-mark address %s not match TSS address %s", recvAddress, tssAddress) } - if amount != common.NonceMarkAmount(nonce) { - return fmt.Errorf("checkTSSVoutCancelled: nonce-mark amount %d not match nonce-mark amount %d", amount, common.NonceMarkAmount(nonce)) + if amount != chains.NonceMarkAmount(nonce) { + return fmt.Errorf("checkTSSVoutCancelled: nonce-mark amount %d not match nonce-mark amount %d", amount, chains.NonceMarkAmount(nonce)) } } // 2nd vout: change to TSS (optional) diff --git a/zetaclient/bitcoin/bitcoin_client_rpc_test.go b/zetaclient/bitcoin/bitcoin_client_rpc_test.go index 0c8870a525..d4f65ed84a 100644 --- a/zetaclient/bitcoin/bitcoin_client_rpc_test.go +++ b/zetaclient/bitcoin/bitcoin_client_rpc_test.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" appcontext "github.com/zeta-chain/zetacore/zetaclient/app_context" clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/config" @@ -47,7 +47,7 @@ func (suite *BitcoinClientTestSuite) SetupTest() { PrivKey: privateKey, } appContext := appcontext.NewAppContext(&corecontext.ZetaCoreContext{}, config.Config{}) - client, err := NewBitcoinClient(appContext, common.BtcRegtestChain(), nil, tss, tempSQLiteDbPath, + client, err := NewBitcoinClient(appContext, chains.BtcRegtestChain(), nil, tss, tempSQLiteDbPath, clientcommon.DefaultLoggers(), config.BTCConfig{}, nil) suite.Require().NoError(err) suite.BitcoinChainClient = client diff --git a/zetaclient/bitcoin/bitcoin_client_test.go b/zetaclient/bitcoin/bitcoin_client_test.go index 81edf59bf5..fa7a84b02f 100644 --- a/zetaclient/bitcoin/bitcoin_client_test.go +++ b/zetaclient/bitcoin/bitcoin_client_test.go @@ -15,7 +15,7 @@ import ( "github.com/btcsuite/btcutil" "github.com/rs/zerolog/log" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" observertypes "github.com/zeta-chain/zetacore/x/observer/types" appcontext "github.com/zeta-chain/zetacore/zetaclient/app_context" @@ -32,7 +32,7 @@ func MockBTCClientMainnet() *BTCChainClient { coreContext := corecontext.NewZetaCoreContext(cfg) return &BTCChainClient{ - chain: common.BtcMainnetChain(), + chain: chains.BtcMainnetChain(), zetaClient: stub.NewMockZetaCoreBridge(), Tss: stub.NewTSSMainnet(), coreContext: coreContext, @@ -44,7 +44,7 @@ func TestNewBitcoinClient(t *testing.T) { cfg := config.NewConfig() coreContext := corecontext.NewZetaCoreContext(cfg) appContext := appcontext.NewAppContext(coreContext, cfg) - chain := common.BtcMainnetChain() + chain := chains.BtcMainnetChain() bridge := stub.NewMockZetaCoreBridge() tss := stub.NewMockTSS(sample.EthAddress().String(), "") loggers := clientcommon.ClientLogger{} diff --git a/zetaclient/bitcoin/bitcoin_signer.go b/zetaclient/bitcoin/bitcoin_signer.go index 01e05715ab..747649be06 100644 --- a/zetaclient/bitcoin/bitcoin_signer.go +++ b/zetaclient/bitcoin/bitcoin_signer.go @@ -8,6 +8,8 @@ import ( "math/rand" "time" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" corecontext "github.com/zeta-chain/zetacore/zetaclient/core_context" ethcommon "github.com/ethereum/go-ethereum/common" @@ -25,7 +27,6 @@ import ( "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/rs/zerolog" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/config" @@ -106,11 +107,11 @@ func (signer *BTCSigner) SignWithdrawTx( btcClient *BTCChainClient, height uint64, nonce uint64, - chain *common.Chain, + chain *chains.Chain, cancelTx bool, ) (*wire.MsgTx, error) { estimateFee := float64(gasPrice.Uint64()*outTxBytesMax) / 1e8 - nonceMark := common.NonceMarkAmount(nonce) + nonceMark := chains.NonceMarkAmount(nonce) // refresh unspent UTXOs and continue with keysign regardless of error err := btcClient.FetchUTXOS() @@ -285,7 +286,7 @@ func (signer *BTCSigner) TryProcessOutTx( Logger() params := cctx.GetCurrentOutTxParam() - if params.CoinType == common.CoinType_Zeta || params.CoinType == common.CoinType_ERC20 { + if params.CoinType == coin.CoinType_Zeta || params.CoinType == coin.CoinType_ERC20 { logger.Error().Msgf("BTC TryProcessOutTx: can only send BTC to a BTC network") return } @@ -312,12 +313,12 @@ func (signer *BTCSigner) TryProcessOutTx( } // Check receiver P2WPKH address - bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(params.ReceiverChainId) + bitcoinNetParams, err := chains.BitcoinNetParamsFromChainID(params.ReceiverChainId) if err != nil { logger.Error().Err(err).Msgf("cannot get bitcoin net params%v", err) return } - addr, err := common.DecodeBtcAddress(params.Receiver, params.ReceiverChainId) + addr, err := chains.DecodeBtcAddress(params.Receiver, params.ReceiverChainId) if err != nil { logger.Error().Err(err).Msgf("cannot decode address %s ", params.Receiver) return diff --git a/zetaclient/bitcoin/bitcoin_signer_test.go b/zetaclient/bitcoin/bitcoin_signer_test.go index 5c12e54b11..26e79ed8d6 100644 --- a/zetaclient/bitcoin/bitcoin_signer_test.go +++ b/zetaclient/bitcoin/bitcoin_signer_test.go @@ -19,7 +19,7 @@ import ( "github.com/btcsuite/btcutil" "github.com/ethereum/go-ethereum/crypto" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/zeta-chain/zetacore/zetaclient/config" corecontext "github.com/zeta-chain/zetacore/zetaclient/core_context" @@ -458,7 +458,7 @@ func mineTxNSetNonceMark(ob *BTCChainClient, nonce uint64, txid string, preMarkI // Set nonce mark tssAddress := ob.Tss.BTCAddressWitnessPubkeyHash().EncodeAddress() - nonceMark := btcjson.ListUnspentResult{TxID: txid, Address: tssAddress, Amount: float64(common.NonceMarkAmount(nonce)) * 1e-8} + nonceMark := btcjson.ListUnspentResult{TxID: txid, Address: tssAddress, Amount: float64(chains.NonceMarkAmount(nonce)) * 1e-8} if preMarkIndex >= 0 { // replace nonce-mark utxo ob.utxos[preMarkIndex] = nonceMark diff --git a/zetaclient/bitcoin/bitcoin_test.go b/zetaclient/bitcoin/bitcoin_test.go index de73756be4..12e9e29136 100644 --- a/zetaclient/bitcoin/bitcoin_test.go +++ b/zetaclient/bitcoin/bitcoin_test.go @@ -7,6 +7,7 @@ import ( "math/big" "testing" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/zetaclient/interfaces" "github.com/btcsuite/btcd/btcec" @@ -16,7 +17,6 @@ import ( "github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcutil" "github.com/stretchr/testify/suite" - "github.com/zeta-chain/zetacore/common" "gorm.io/driver/sqlite" "gorm.io/gorm" ) @@ -145,7 +145,7 @@ func getTSSTX(tss *interfaces.TestSigner, tx *wire.MsgTx, sigHashes *txscript.Tx return "", err } - sig65B, err := tss.Sign(witnessHash, 10, 10, &common.Chain{}, "") + sig65B, err := tss.Sign(witnessHash, 10, 10, &chains.Chain{}, "") R := big.NewInt(0).SetBytes(sig65B[:32]) S := big.NewInt(0).SetBytes(sig65B[32:64]) sig := btcec.Signature{ diff --git a/zetaclient/bitcoin/inbound_tracker.go b/zetaclient/bitcoin/inbound_tracker.go index 3aa83dc031..2a6b80c124 100644 --- a/zetaclient/bitcoin/inbound_tracker.go +++ b/zetaclient/bitcoin/inbound_tracker.go @@ -5,7 +5,7 @@ import ( "fmt" "github.com/btcsuite/btcd/chaincfg/chainhash" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/zetaclient/types" "github.com/zeta-chain/zetacore/zetaclient/zetabridge" ) @@ -44,7 +44,7 @@ func (ob *BTCChainClient) ObserveTrackerSuggestions() error { if err != nil { return err } - ob.logger.WatchInTx.Info().Msgf("Vote submitted for inbound Tracker,Chain : %s,Ballot Identifier : %s, coin-type %s", ob.chain.ChainName, ballotIdentifier, common.CoinType_Gas.String()) + ob.logger.WatchInTx.Info().Msgf("Vote submitted for inbound Tracker,Chain : %s,Ballot Identifier : %s, coin-type %s", ob.chain.ChainName, ballotIdentifier, coin.CoinType_Gas.String()) } return nil } diff --git a/zetaclient/bitcoin/utils.go b/zetaclient/bitcoin/utils.go index 33d654fa6c..12d24a5880 100644 --- a/zetaclient/bitcoin/utils.go +++ b/zetaclient/bitcoin/utils.go @@ -12,7 +12,7 @@ import ( "github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcutil" "github.com/rs/zerolog" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" "github.com/btcsuite/btcd/txscript" @@ -172,11 +172,11 @@ func CalcDepositorFee(blockVb *btcjson.GetBlockVerboseTxResult, chainID int64, n dynamicFee := true // use default fee for regnet - if common.IsBitcoinRegnet(chainID) { + if chains.IsBitcoinRegnet(chainID) { dynamicFee = false } // mainnet dynamic fee takes effect only after a planned upgrade height - if common.IsBitcoinMainnet(chainID) && blockVb.Height < DynamicDepositorFeeHeight { + if chains.IsBitcoinMainnet(chainID) && blockVb.Height < DynamicDepositorFeeHeight { dynamicFee = false } if !dynamicFee { @@ -227,7 +227,7 @@ func PayToWitnessPubKeyHashScript(pubKeyHash []byte) ([]byte, error) { } // DecodeP2WPKHVout decodes receiver and amount from P2WPKH output -func DecodeP2WPKHVout(vout btcjson.Vout, chain common.Chain) (string, int64, error) { +func DecodeP2WPKHVout(vout btcjson.Vout, chain chains.Chain) (string, int64, error) { amount, err := GetSatoshis(vout.Value) if err != nil { return "", 0, errors.Wrap(err, "error getting satoshis") diff --git a/zetaclient/bitcoin/utils_test.go b/zetaclient/bitcoin/utils_test.go index 6ae066f424..7196460cd8 100644 --- a/zetaclient/bitcoin/utils_test.go +++ b/zetaclient/bitcoin/utils_test.go @@ -6,14 +6,14 @@ import ( "github.com/btcsuite/btcd/btcjson" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/zetaclient/testutils" ) func TestDecodeP2WPKHVout(t *testing.T) { // load archived outtx raw result // https://blockstream.info/tx/030cd813443f7b70cc6d8a544d320c6d8465e4528fc0f3410b599dc0b26753a0 - chain := common.BtcMainnetChain() + chain := chains.BtcMainnetChain() nonce := uint64(148) nameTx := path.Join("../", testutils.TestDataPathBTC, testutils.FileNameBTCOuttx(chain.ChainId, nonce)) @@ -26,7 +26,7 @@ func TestDecodeP2WPKHVout(t *testing.T) { receiver, amount, err := DecodeP2WPKHVout(rawResult.Vout[0], chain) require.NoError(t, err) require.Equal(t, testutils.TSSAddressBTCMainnet, receiver) - require.Equal(t, common.NonceMarkAmount(nonce), amount) + require.Equal(t, chains.NonceMarkAmount(nonce), amount) // decode vout 1, payment 0.00012000 BTC receiver, amount, err = DecodeP2WPKHVout(rawResult.Vout[1], chain) @@ -44,7 +44,7 @@ func TestDecodeP2WPKHVout(t *testing.T) { func TestDecodeP2WPKHVoutErrors(t *testing.T) { // load archived outtx raw result // https://blockstream.info/tx/030cd813443f7b70cc6d8a544d320c6d8465e4528fc0f3410b599dc0b26753a0 - chain := common.BtcMainnetChain() + chain := chains.BtcMainnetChain() nonce := uint64(148) nameTx := path.Join("../", testutils.TestDataPathBTC, testutils.FileNameBTCOuttx(chain.ChainId, nonce)) diff --git a/zetaclient/config/config_chain.go b/zetaclient/config/config_chain.go index 329c650023..869d9111ea 100644 --- a/zetaclient/config/config_chain.go +++ b/zetaclient/config/config_chain.go @@ -1,8 +1,6 @@ package config -import ( - "github.com/zeta-chain/zetacore/common" -) +import "github.com/zeta-chain/zetacore/pkg/chains" const ( BtcConfirmationCount = 1 @@ -46,26 +44,26 @@ var bitcoinConfigRegnet = BTCConfig{ } var evmChainsConfigs = map[int64]EVMConfig{ - common.EthChain().ChainId: { - Chain: common.EthChain(), + chains.EthChain().ChainId: { + Chain: chains.EthChain(), }, - common.BscMainnetChain().ChainId: { - Chain: common.BscMainnetChain(), + chains.BscMainnetChain().ChainId: { + Chain: chains.BscMainnetChain(), }, - common.GoerliChain().ChainId: { - Chain: common.GoerliChain(), + chains.GoerliChain().ChainId: { + Chain: chains.GoerliChain(), Endpoint: "", }, - common.BscTestnetChain().ChainId: { - Chain: common.BscTestnetChain(), + chains.BscTestnetChain().ChainId: { + Chain: chains.BscTestnetChain(), Endpoint: "", }, - common.MumbaiChain().ChainId: { - Chain: common.MumbaiChain(), + chains.MumbaiChain().ChainId: { + Chain: chains.MumbaiChain(), Endpoint: "", }, - common.GoerliLocalnetChain().ChainId: { - Chain: common.GoerliLocalnetChain(), + chains.GoerliLocalnetChain().ChainId: { + Chain: chains.GoerliLocalnetChain(), Endpoint: "http://eth:8545", }, } diff --git a/zetaclient/config/types.go b/zetaclient/config/types.go index 69e4e8da2c..ea861d46bb 100644 --- a/zetaclient/config/types.go +++ b/zetaclient/config/types.go @@ -5,7 +5,7 @@ import ( "strings" "sync" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" ) // KeyringBackend is the type of keyring backend to use for the hotkey @@ -27,7 +27,7 @@ type ClientConfiguration struct { } type EVMConfig struct { - Chain common.Chain + Chain chains.Chain Endpoint string } diff --git a/zetaclient/core_context/zeta_core_context.go b/zetaclient/core_context/zeta_core_context.go index 540d32110c..d35c502c86 100644 --- a/zetaclient/core_context/zeta_core_context.go +++ b/zetaclient/core_context/zeta_core_context.go @@ -6,7 +6,7 @@ import ( "sync" "github.com/rs/zerolog" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/config" ) @@ -16,7 +16,7 @@ import ( type ZetaCoreContext struct { coreContextLock *sync.RWMutex keygen observertypes.Keygen - chainsEnabled []common.Chain + chainsEnabled []chains.Chain evmChainParams map[int64]*observertypes.ChainParams bitcoinChainParams *observertypes.ChainParams currentTssPubkey string @@ -37,7 +37,7 @@ func NewZetaCoreContext(cfg config.Config) *ZetaCoreContext { } return &ZetaCoreContext{ coreContextLock: new(sync.RWMutex), - chainsEnabled: []common.Chain{}, + chainsEnabled: []chains.Chain{}, evmChainParams: evmChainParams, bitcoinChainParams: bitcoinChainParams, crossChainFlags: observertypes.CrosschainFlags{}, @@ -66,10 +66,10 @@ func (c *ZetaCoreContext) GetCurrentTssPubkey() string { return c.currentTssPubkey } -func (c *ZetaCoreContext) GetEnabledChains() []common.Chain { +func (c *ZetaCoreContext) GetEnabledChains() []chains.Chain { c.coreContextLock.RLock() defer c.coreContextLock.RUnlock() - copiedChains := make([]common.Chain, len(c.chainsEnabled)) + copiedChains := make([]chains.Chain, len(c.chainsEnabled)) copy(copiedChains, c.chainsEnabled) return copiedChains } @@ -94,14 +94,14 @@ func (c *ZetaCoreContext) GetAllEVMChainParams() map[int64]*observertypes.ChainP return copied } -func (c *ZetaCoreContext) GetBTCChainParams() (common.Chain, *observertypes.ChainParams, bool) { +func (c *ZetaCoreContext) GetBTCChainParams() (chains.Chain, *observertypes.ChainParams, bool) { c.coreContextLock.RLock() defer c.coreContextLock.RUnlock() if c.bitcoinChainParams == nil { // bitcoin is not enabled - return common.Chain{}, &observertypes.ChainParams{}, false + return chains.Chain{}, &observertypes.ChainParams{}, false } - chain := common.GetChainFromChainID(c.bitcoinChainParams.ChainId) + chain := chains.GetChainFromChainID(c.bitcoinChainParams.ChainId) if chain == nil { panic(fmt.Sprintf("BTCChain is missing for chainID %d", c.bitcoinChainParams.ChainId)) } @@ -118,7 +118,7 @@ func (c *ZetaCoreContext) GetCrossChainFlags() observertypes.CrosschainFlags { // this must be the ONLY function that writes to core context func (c *ZetaCoreContext) Update( keygen *observertypes.Keygen, - newChains []common.Chain, + newChains []chains.Chain, evmChainParams map[int64]*observertypes.ChainParams, btcChainParams *observertypes.ChainParams, tssPubKey string, diff --git a/zetaclient/core_context/zeta_core_context_test.go b/zetaclient/core_context/zeta_core_context_test.go index 65011d2981..14f36a1cc2 100644 --- a/zetaclient/core_context/zeta_core_context_test.go +++ b/zetaclient/core_context/zeta_core_context_test.go @@ -4,7 +4,7 @@ import ( "testing" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" observertypes "github.com/zeta-chain/zetacore/x/observer/types" clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" @@ -31,7 +31,7 @@ func TestNewZetaCoreContext(t *testing.T) { // assert btc chain params chain, btcChainParams, btcChainParamsFound := zetaContext.GetBTCChainParams() - require.Equal(t, common.Chain{}, chain) + require.Equal(t, chains.Chain{}, chain) require.False(t, btcChainParamsFound) require.Equal(t, &observertypes.ChainParams{}, btcChainParams) @@ -44,13 +44,13 @@ func TestNewZetaCoreContext(t *testing.T) { testCfg := config.NewConfig() testCfg.EVMChainConfigs = map[int64]config.EVMConfig{ 1: { - Chain: common.Chain{ + Chain: chains.Chain{ ChainName: 1, ChainId: 1, }, }, 2: { - Chain: common.Chain{ + Chain: chains.Chain{ ChainName: 2, ChainId: 2, }, @@ -103,7 +103,7 @@ func TestUpdateZetaCoreContext(t *testing.T) { Status: observertypes.KeygenStatus_KeyGenSuccess, GranteePubkeys: []string{"testpubkey1"}, } - enabledChainsToUpdate := []common.Chain{ + enabledChainsToUpdate := []chains.Chain{ { ChainName: 1, ChainId: 1, @@ -151,7 +151,7 @@ func TestUpdateZetaCoreContext(t *testing.T) { // assert btc chain params still empty because they were not specified in config chain, btcChainParams, btcChainParamsFound := zetaContext.GetBTCChainParams() - require.Equal(t, common.Chain{}, chain) + require.Equal(t, chains.Chain{}, chain) require.False(t, btcChainParamsFound) require.Equal(t, &observertypes.ChainParams{}, btcChainParams) @@ -167,13 +167,13 @@ func TestUpdateZetaCoreContext(t *testing.T) { testCfg := config.NewConfig() testCfg.EVMChainConfigs = map[int64]config.EVMConfig{ 1: { - Chain: common.Chain{ + Chain: chains.Chain{ ChainName: 1, ChainId: 1, }, }, 2: { - Chain: common.Chain{ + Chain: chains.Chain{ ChainName: 2, ChainId: 2, }, @@ -193,7 +193,7 @@ func TestUpdateZetaCoreContext(t *testing.T) { Status: observertypes.KeygenStatus_KeyGenSuccess, GranteePubkeys: []string{"testpubkey1"}, } - enabledChainsToUpdate := []common.Chain{ + enabledChainsToUpdate := []chains.Chain{ { ChainName: 1, ChainId: 1, @@ -212,7 +212,7 @@ func TestUpdateZetaCoreContext(t *testing.T) { }, } - testBtcChain := common.BtcTestNetChain() + testBtcChain := chains.BtcTestNetChain() btcChainParamsToUpdate := &observertypes.ChainParams{ ChainId: testBtcChain.ChainId, } diff --git a/zetaclient/evm/evm_client.go b/zetaclient/evm/evm_client.go index 3b1b39bb1d..a70401365e 100644 --- a/zetaclient/evm/evm_client.go +++ b/zetaclient/evm/evm_client.go @@ -13,6 +13,9 @@ import ( "sync/atomic" "time" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/proofs" appcontext "github.com/zeta-chain/zetacore/zetaclient/app_context" corecontext "github.com/zeta-chain/zetacore/zetaclient/core_context" @@ -36,7 +39,6 @@ import ( "github.com/rs/zerolog/log" "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol" "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.non-eth.sol" - "github.com/zeta-chain/zetacore/common" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" @@ -70,7 +72,7 @@ var _ interfaces.ChainClient = &ChainClient{} // ChainClient represents the chain configuration for an EVM chain // Filled with above constants depending on chain type ChainClient struct { - chain common.Chain + chain chains.Chain evmClient interfaces.EVMRPCClient evmJSONRPC interfaces.EVMJSONRPCClient zetaClient interfaces.ZetaCoreBridger @@ -161,7 +163,7 @@ func NewEVMChainClient( return &ob, nil } -func (ob *ChainClient) WithChain(chain common.Chain) { +func (ob *ChainClient) WithChain(chain chains.Chain) { ob.Mu.Lock() defer ob.Mu.Unlock() ob.chain = chain @@ -332,9 +334,9 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, // compliance check, special handling the cancelled cctx if compliance.IsCctxRestricted(cctx) { - recvStatus := common.ReceiveStatus_Failed + recvStatus := chains.ReceiveStatus_Failed if receipt.Status == 1 { - recvStatus = common.ReceiveStatus_Success + recvStatus = chains.ReceiveStatus_Success } zetaTxHash, ballot, err := ob.zetaClient.PostVoteOutbound( sendHash, @@ -348,7 +350,7 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, recvStatus, ob.chain, nonce, - common.CoinType_Cmd, + coin.CoinType_Cmd, ) if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) @@ -358,10 +360,10 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, return true, true, nil } - if cointype == common.CoinType_Cmd { - recvStatus := common.ReceiveStatus_Failed + if cointype == coin.CoinType_Cmd { + recvStatus := chains.ReceiveStatus_Failed if receipt.Status == 1 { - recvStatus = common.ReceiveStatus_Success + recvStatus = chains.ReceiveStatus_Success } zetaTxHash, ballot, err := ob.zetaClient.PostVoteOutbound( sendHash, @@ -374,7 +376,7 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, recvStatus, ob.chain, nonce, - common.CoinType_Cmd, + coin.CoinType_Cmd, ) if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) @@ -383,7 +385,7 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, } return true, true, nil - } else if cointype == common.CoinType_Gas { // the outbound is a regular Ether/BNB/Matic transfer; no need to check events + } else if cointype == coin.CoinType_Gas { // the outbound is a regular Ether/BNB/Matic transfer; no need to check events if receipt.Status == 1 { zetaTxHash, ballot, err := ob.zetaClient.PostVoteOutbound( sendHash, @@ -393,10 +395,10 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, transaction.GasPrice(), transaction.Gas(), transaction.Value(), - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, ob.chain, nonce, - common.CoinType_Gas, + coin.CoinType_Gas, ) if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) @@ -414,10 +416,10 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, transaction.GasPrice(), transaction.Gas(), big.NewInt(0), - common.ReceiveStatus_Failed, + chains.ReceiveStatus_Failed, ob.chain, nonce, - common.CoinType_Gas, + coin.CoinType_Gas, ) if err != nil { logger.Error().Err(err).Msgf("PostVoteOutbound error in WatchTxHashWithTimeout; zeta tx hash %s cctx %s nonce %d", zetaTxHash, sendHash, nonce) @@ -426,7 +428,7 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, } return true, true, nil } - } else if cointype == common.CoinType_Zeta { // the outbound is a Zeta transfer; need to check events ZetaReceived + } else if cointype == coin.CoinType_Zeta { // the outbound is a Zeta transfer; need to check events ZetaReceived if receipt.Status == 1 { logs := receipt.Logs for _, vLog := range logs { @@ -458,10 +460,10 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, transaction.GasPrice(), transaction.Gas(), mMint, - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, ob.chain, nonce, - common.CoinType_Zeta, + coin.CoinType_Zeta, ) if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) @@ -495,10 +497,10 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, transaction.GasPrice(), transaction.Gas(), mMint, - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, ob.chain, nonce, - common.CoinType_Zeta, + coin.CoinType_Zeta, ) if err != nil { logger.Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) @@ -523,10 +525,10 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, transaction.GasPrice(), transaction.Gas(), big.NewInt(0), - common.ReceiveStatus_Failed, + chains.ReceiveStatus_Failed, ob.chain, nonce, - common.CoinType_Zeta, + coin.CoinType_Zeta, ) if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) @@ -535,7 +537,7 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, } return true, true, nil } - } else if cointype == common.CoinType_ERC20 { + } else if cointype == coin.CoinType_ERC20 { if receipt.Status == 1 { logs := receipt.Logs addrCustody, ERC20Custody, err := ob.GetERC20CustodyContract() @@ -563,10 +565,10 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, transaction.GasPrice(), transaction.Gas(), event.Amount, - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, ob.chain, nonce, - common.CoinType_ERC20, + coin.CoinType_ERC20, ) if err != nil { logger.Error().Err(err).Msgf("error posting confirmation to meta core for cctx %s nonce %d", sendHash, nonce) @@ -590,10 +592,10 @@ func (ob *ChainClient) IsSendOutTxProcessed(cctx *crosschaintypes.CrossChainTx, transaction.GasPrice(), transaction.Gas(), big.NewInt(0), - common.ReceiveStatus_Failed, + chains.ReceiveStatus_Failed, ob.chain, nonce, - common.CoinType_ERC20, + coin.CoinType_ERC20, ) if err != nil { logger.Error().Err(err).Msgf("PostVoteOutbound error in WatchTxHashWithTimeout; zeta tx hash %s", zetaTxHash) @@ -897,7 +899,7 @@ func (ob *ChainClient) postBlockHeader(tip uint64) error { ob.chain.ChainId, header.Hash().Bytes(), header.Number.Int64(), - common.NewEthereumHeader(headerRLP), + proofs.NewEthereumHeader(headerRLP), ) if err != nil { ob.logger.ExternalChainWatcher.Error().Err(err).Msgf("postBlockHeader: error posting block header: %d", bn) @@ -1035,7 +1037,7 @@ func (ob *ChainClient) ObserveZetaSent(startBlock, toBlock uint64) uint64 { msg := ob.BuildInboundVoteMsgForZetaSentEvent(event) if msg != nil { - _, err = ob.PostVoteInbound(msg, common.CoinType_Zeta, zetabridge.PostVoteInboundMessagePassingExecutionGasLimit) + _, err = ob.PostVoteInbound(msg, coin.CoinType_Zeta, zetabridge.PostVoteInboundMessagePassingExecutionGasLimit) if err != nil { return beingScanned - 1 // we have to re-scan from this block next time } @@ -1115,7 +1117,7 @@ func (ob *ChainClient) ObserveERC20Deposited(startBlock, toBlock uint64) uint64 msg := ob.BuildInboundVoteMsgForDepositedEvent(event, sender) if msg != nil { - _, err = ob.PostVoteInbound(msg, common.CoinType_ERC20, zetabridge.PostVoteInboundExecutionGasLimit) + _, err = ob.PostVoteInbound(msg, coin.CoinType_ERC20, zetabridge.PostVoteInboundExecutionGasLimit) if err != nil { return beingScanned - 1 // we have to re-scan from this block next time } @@ -1138,7 +1140,7 @@ func (ob *ChainClient) ObserverTSSReceive(startBlock, toBlock uint64, flags obse // TODO: consider having a independent ticker(from TSS scaning) for posting block headers if flags.BlockHeaderVerificationFlags != nil && flags.BlockHeaderVerificationFlags.IsEthTypeChainEnabled && - common.IsHeaderSupportedEvmChain(ob.chain.ChainId) { // post block header for supported chains + chains.IsHeaderSupportedEvmChain(ob.chain.ChainId) { // post block header for supported chains err := ob.postBlockHeader(toBlock) if err != nil { ob.logger.ExternalChainWatcher.Error().Err(err).Msg("error posting block header") @@ -1280,7 +1282,7 @@ func (ob *ChainClient) BuildReceiptsMap() error { } // LoadDB open sql database and load data into EVMChainClient -func (ob *ChainClient) LoadDB(dbPath string, chain common.Chain) error { +func (ob *ChainClient) LoadDB(dbPath string, chain chains.Chain) error { if dbPath != "" { if _, err := os.Stat(dbPath); os.IsNotExist(err) { err := os.MkdirAll(dbPath, os.ModePerm) diff --git a/zetaclient/evm/evm_client_test.go b/zetaclient/evm/evm_client_test.go index 6f4cb677ed..7596931f3e 100644 --- a/zetaclient/evm/evm_client_test.go +++ b/zetaclient/evm/evm_client_test.go @@ -8,7 +8,8 @@ import ( lru "github.com/hashicorp/golang-lru" "github.com/onrik/ethrpc" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/zetaclient/evm" "github.com/zeta-chain/zetacore/zetaclient/testutils" @@ -45,7 +46,7 @@ func TestEVM_CheckTxInclusion(t *testing.T) { // load archived evm outtx Gas // https://etherscan.io/tx/0xd13b593eb62b5500a00e288cc2fb2c8af1339025c0e6bc6183b8bef2ebbed0d3 chainID := int64(1) - coinType := common.CoinType_Gas + coinType := coin.CoinType_Gas outtxHash := "0xd13b593eb62b5500a00e288cc2fb2c8af1339025c0e6bc6183b8bef2ebbed0d3" tx, receipt := testutils.LoadEVMOuttxNReceipt(t, chainID, outtxHash, coinType) @@ -96,7 +97,7 @@ func TestEVM_VoteOutboundBallot(t *testing.T) { // load archived evm outtx Gas // https://etherscan.io/tx/0xd13b593eb62b5500a00e288cc2fb2c8af1339025c0e6bc6183b8bef2ebbed0d3 chainID := int64(1) - coinType := common.CoinType_Gas + coinType := coin.CoinType_Gas outtxHash := "0xd13b593eb62b5500a00e288cc2fb2c8af1339025c0e6bc6183b8bef2ebbed0d3" tx, receipt := testutils.LoadEVMOuttxNReceipt(t, chainID, outtxHash, coinType) @@ -113,7 +114,7 @@ func TestEVM_VoteOutboundBallot(t *testing.T) { math.NewIntFromBigInt(tx.GasPrice()), tx.Gas(), math.NewUintFromBigInt(tx.Value()), - common.ReceiveStatus_Success, + chains.ReceiveStatus_Success, chainID, tx.Nonce(), coinType, diff --git a/zetaclient/evm/evm_signer.go b/zetaclient/evm/evm_signer.go index b6454b1820..a5f6114822 100644 --- a/zetaclient/evm/evm_signer.go +++ b/zetaclient/evm/evm_signer.go @@ -20,7 +20,9 @@ import ( "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/constant" crosschainkeeper "github.com/zeta-chain/zetacore/x/crosschain/keeper" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" @@ -37,7 +39,7 @@ import ( // Signer deals with the signing EVM transactions and implements the ChainSigner interface type Signer struct { client interfaces.EVMRPCClient - chain *common.Chain + chain *chains.Chain tssSigner interfaces.TSSSigner ethSigner ethtypes.Signer logger clientcommon.ClientLogger @@ -56,7 +58,7 @@ type Signer struct { var _ interfaces.ChainSigner = &Signer{} func NewEVMSigner( - chain common.Chain, + chain chains.Chain, endpoint string, tssSigner interfaces.TSSSigner, zetaConnectorABI string, @@ -295,9 +297,9 @@ func (signer *Signer) SignWithdrawTx(txData *OutBoundTransactionData) (*ethtypes // cmd_migrate_tss_funds func (signer *Signer) SignCommandTx(txData *OutBoundTransactionData, cmd string, params string) (*ethtypes.Transaction, error) { switch cmd { - case common.CmdWhitelistERC20: + case constant.CmdWhitelistERC20: return signer.SignWhitelistERC20Cmd(txData, params) - case common.CmdMigrateTssFunds: + case constant.CmdMigrateTssFunds: return signer.SignMigrateTssFundsCmd(txData) } return nil, fmt.Errorf("SignCommandTx: unknown command %s", cmd) @@ -343,7 +345,7 @@ func (signer *Signer) TryProcessOutTx( } // Get destination chain for logging - toChain := common.GetChainFromChainID(txData.toChainID.Int64()) + toChain := chains.GetChainFromChainID(txData.toChainID.Int64()) // Get cross-chain flags crossChainflags := signer.coreContext.GetCrossChainFlags() @@ -358,7 +360,7 @@ func (signer *Signer) TryProcessOutTx( logger.Warn().Err(err).Msg(SignerErrorMsg(cctx)) return } - } else if cctx.GetCurrentOutTxParam().CoinType == common.CoinType_Cmd { // admin command + } else if cctx.GetCurrentOutTxParam().CoinType == coin.CoinType_Cmd { // admin command to := ethcommon.HexToAddress(cctx.GetCurrentOutTxParam().Receiver) if to == (ethcommon.Address{}) { logger.Error().Msgf("invalid receiver %s", cctx.GetCurrentOutTxParam().Receiver) @@ -370,7 +372,7 @@ func (signer *Signer) TryProcessOutTx( return } // cmd field is used to determine whether to execute ERC20 whitelist or migrate TSS funds given that the coin type - // from the cctx is common.CoinType_Cmd + // from the cctx is coin.CoinType_Cmd cmd := msg[0] // params field is used to pass input parameters for command requests, currently it is used to pass the ERC20 // contract address when a whitelist command is requested @@ -382,13 +384,13 @@ func (signer *Signer) TryProcessOutTx( } } else if IsSenderZetaChain(cctx, zetaBridge, &crossChainflags) { switch cctx.GetCurrentOutTxParam().CoinType { - case common.CoinType_Gas: + case coin.CoinType_Gas: logger.Info().Msgf("SignWithdrawTx: %d => %s, nonce %d, gasPrice %d", cctx.InboundTxParams.SenderChainId, toChain, cctx.GetCurrentOutTxParam().OutboundTxTssNonce, txData.gasPrice) tx, err = signer.SignWithdrawTx(txData) - case common.CoinType_ERC20: + case coin.CoinType_ERC20: logger.Info().Msgf("SignERC20WithdrawTx: %d => %s, nonce %d, gasPrice %d", cctx.InboundTxParams.SenderChainId, toChain, cctx.GetCurrentOutTxParam().OutboundTxTssNonce, txData.gasPrice) tx, err = signer.SignERC20WithdrawTx(txData) - case common.CoinType_Zeta: + case coin.CoinType_Zeta: logger.Info().Msgf("SignOutboundTx: %d => %s, nonce %d, gasPrice %d", cctx.InboundTxParams.SenderChainId, toChain, cctx.GetCurrentOutTxParam().OutboundTxTssNonce, txData.gasPrice) tx, err = signer.SignOutboundTx(txData) } @@ -398,10 +400,10 @@ func (signer *Signer) TryProcessOutTx( } } else if cctx.CctxStatus.Status == types.CctxStatus_PendingRevert && cctx.OutboundTxParams[0].ReceiverChainId == zetaBridge.ZetaChain().ChainId { switch cctx.GetCurrentOutTxParam().CoinType { - case common.CoinType_Gas: + case coin.CoinType_Gas: logger.Info().Msgf("SignWithdrawTx: %d => %s, nonce %d, gasPrice %d", cctx.InboundTxParams.SenderChainId, toChain, cctx.GetCurrentOutTxParam().OutboundTxTssNonce, txData.gasPrice) tx, err = signer.SignWithdrawTx(txData) - case common.CoinType_ERC20: + case coin.CoinType_ERC20: logger.Info().Msgf("SignERC20WithdrawTx: %d => %s, nonce %d, gasPrice %d", cctx.InboundTxParams.SenderChainId, toChain, cctx.GetCurrentOutTxParam().OutboundTxTssNonce, txData.gasPrice) tx, err = signer.SignERC20WithdrawTx(txData) } @@ -443,7 +445,7 @@ func (signer *Signer) BroadcastOutTx( zetaBridge interfaces.ZetaCoreBridger, txData *OutBoundTransactionData) { // Get destination chain for logging - toChain := common.GetChainFromChainID(txData.toChainID.Int64()) + toChain := chains.GetChainFromChainID(txData.toChainID.Int64()) // Try to broadcast transaction if tx != nil { @@ -642,7 +644,7 @@ func (signer *Signer) EvmSigner() ethtypes.Signer { // getEVMRPC is a helper function to set up the client and signer, also initializes a mock client for unit tests func getEVMRPC(endpoint string) (interfaces.EVMRPCClient, ethtypes.Signer, error) { if endpoint == stub.EVMRPCEnabled { - chainID := big.NewInt(common.BscMainnetChain().ChainId) + chainID := big.NewInt(chains.BscMainnetChain().ChainId) ethSigner := ethtypes.NewLondonSigner(chainID) client := &stub.MockEvmClient{} return client, ethSigner, nil diff --git a/zetaclient/evm/evm_signer_test.go b/zetaclient/evm/evm_signer_test.go index 656908ce51..b78a3d1c26 100644 --- a/zetaclient/evm/evm_signer_test.go +++ b/zetaclient/evm/evm_signer_test.go @@ -8,7 +8,8 @@ import ( "github.com/ethereum/go-ethereum/crypto" "github.com/rs/zerolog" "github.com/stretchr/testify/require" - corecommon "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/constant" "github.com/zeta-chain/zetacore/testutil/sample" "github.com/zeta-chain/zetacore/x/crosschain/types" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" @@ -35,7 +36,7 @@ func getNewEvmSigner() (*Signer, error) { ts := &metrics.TelemetryServer{} cfg := config.NewConfig() return NewEVMSigner( - corecommon.BscMainnetChain(), + chains.BscMainnetChain(), stub.EVMRPCEnabled, stub.NewTSSMainnet(), config.GetConnectorABI(), @@ -53,8 +54,8 @@ func getNewEvmChainClient() (*ChainClient, error) { cfg := config.NewConfig() tss := stub.NewTSSMainnet() - evmcfg := config.EVMConfig{Chain: corecommon.BscMainnetChain(), Endpoint: "http://localhost:8545"} - cfg.EVMChainConfigs[corecommon.BscMainnetChain().ChainId] = evmcfg + evmcfg := config.EVMConfig{Chain: chains.BscMainnetChain(), Endpoint: "http://localhost:8545"} + cfg.EVMChainConfigs[chains.BscMainnetChain().ChainId] = evmcfg coreCTX := corecontext.NewZetaCoreContext(cfg) appCTX := appcontext.NewAppContext(coreCTX, cfg) @@ -224,7 +225,7 @@ func TestSigner_SignCommandTx(t *testing.T) { require.NoError(t, err) t.Run("SignCommandTx CmdWhitelistERC20", func(t *testing.T) { - cmd := corecommon.CmdWhitelistERC20 + cmd := constant.CmdWhitelistERC20 params := ConnectorAddress.Hex() // Call SignCommandTx tx, err := evmSigner.SignCommandTx(txData, cmd, params) @@ -241,7 +242,7 @@ func TestSigner_SignCommandTx(t *testing.T) { }) t.Run("SignCommandTx CmdMigrateTssFunds", func(t *testing.T) { - cmd := corecommon.CmdMigrateTssFunds + cmd := constant.CmdMigrateTssFunds // Call SignCommandTx tx, err := evmSigner.SignCommandTx(txData, cmd, "") require.NoError(t, err) diff --git a/zetaclient/evm/inbounds.go b/zetaclient/evm/inbounds.go index 8828d5b59f..2daa4fc0c1 100644 --- a/zetaclient/evm/inbounds.go +++ b/zetaclient/evm/inbounds.go @@ -13,12 +13,14 @@ import ( "github.com/pkg/errors" "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/erc20custody.sol" "github.com/zeta-chain/protocol-contracts/pkg/contracts/evm/zetaconnector.non-eth.sol" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/zetaclient/compliance" "github.com/zeta-chain/zetacore/zetaclient/config" clienttypes "github.com/zeta-chain/zetacore/zetaclient/types" ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/constant" "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/zetaclient/zetabridge" "golang.org/x/net/context" @@ -73,11 +75,11 @@ func (ob *ChainClient) ObserveIntxTrackers() error { // check and vote on inbound tx switch tracker.CoinType { - case common.CoinType_Zeta: + case coin.CoinType_Zeta: _, err = ob.CheckAndVoteInboundTokenZeta(tx, receipt, true) - case common.CoinType_ERC20: + case coin.CoinType_ERC20: _, err = ob.CheckAndVoteInboundTokenERC20(tx, receipt, true) - case common.CoinType_Gas: + case coin.CoinType_Gas: _, err = ob.CheckAndVoteInboundTokenGas(tx, receipt, true) default: return fmt.Errorf("unknown coin type %s for intx %s chain %d", tracker.CoinType, tx.Hash, ob.chain.ChainId) @@ -123,7 +125,7 @@ func (ob *ChainClient) CheckAndVoteInboundTokenZeta(tx *ethrpc.Transaction, rece return "", nil } if vote { - return ob.PostVoteInbound(msg, common.CoinType_Zeta, zetabridge.PostVoteInboundMessagePassingExecutionGasLimit) + return ob.PostVoteInbound(msg, coin.CoinType_Zeta, zetabridge.PostVoteInboundMessagePassingExecutionGasLimit) } return msg.Digest(), nil } @@ -164,7 +166,7 @@ func (ob *ChainClient) CheckAndVoteInboundTokenERC20(tx *ethrpc.Transaction, rec return "", nil } if vote { - return ob.PostVoteInbound(msg, common.CoinType_ERC20, zetabridge.PostVoteInboundExecutionGasLimit) + return ob.PostVoteInbound(msg, coin.CoinType_ERC20, zetabridge.PostVoteInboundExecutionGasLimit) } return msg.Digest(), nil } @@ -192,13 +194,13 @@ func (ob *ChainClient) CheckAndVoteInboundTokenGas(tx *ethrpc.Transaction, recei return "", nil } if vote { - return ob.PostVoteInbound(msg, common.CoinType_Gas, zetabridge.PostVoteInboundExecutionGasLimit) + return ob.PostVoteInbound(msg, coin.CoinType_Gas, zetabridge.PostVoteInboundExecutionGasLimit) } return msg.Digest(), nil } // PostVoteInbound posts a vote for the given vote message -func (ob *ChainClient) PostVoteInbound(msg *types.MsgVoteOnObservedInboundTx, coinType common.CoinType, retryGasLimit uint64) (string, error) { +func (ob *ChainClient) PostVoteInbound(msg *types.MsgVoteOnObservedInboundTx, coinType coin.CoinType, retryGasLimit uint64) (string, error) { txHash := msg.InTxHash chainID := ob.chain.ChainId zetaHash, ballot, err := ob.zetaClient.PostVoteInbound(zetabridge.PostVoteInboundGasLimit, retryGasLimit, msg) @@ -223,7 +225,7 @@ func (ob *ChainClient) HasEnoughConfirmations(receipt *ethtypes.Receipt, lastHei func (ob *ChainClient) BuildInboundVoteMsgForDepositedEvent(event *erc20custody.ERC20CustodyDeposited, sender ethcommon.Address) *types.MsgVoteOnObservedInboundTx { // compliance check maybeReceiver := "" - parsedAddress, _, err := common.ParseAddressAndData(hex.EncodeToString(event.Message)) + parsedAddress, _, err := chains.ParseAddressAndData(hex.EncodeToString(event.Message)) if err == nil && parsedAddress != (ethcommon.Address{}) { maybeReceiver = parsedAddress.Hex() } @@ -234,7 +236,7 @@ func (ob *ChainClient) BuildInboundVoteMsgForDepositedEvent(event *erc20custody. } // donation check - if bytes.Equal(event.Message, []byte(common.DonationMessage)) { + if bytes.Equal(event.Message, []byte(constant.DonationMessage)) { ob.logger.ExternalChainWatcher.Info().Msgf("thank you rich folk for your donation! tx %s chain %d", event.Raw.TxHash.Hex(), ob.chain.ChainId) return nil } @@ -253,7 +255,7 @@ func (ob *ChainClient) BuildInboundVoteMsgForDepositedEvent(event *erc20custody. event.Raw.TxHash.Hex(), event.Raw.BlockNumber, 1_500_000, - common.CoinType_ERC20, + coin.CoinType_ERC20, event.Asset.String(), ob.zetaClient.GetKeys().GetOperatorAddress().String(), event.Raw.Index, @@ -262,7 +264,7 @@ func (ob *ChainClient) BuildInboundVoteMsgForDepositedEvent(event *erc20custody. // BuildInboundVoteMsgForZetaSentEvent builds a inbound vote message for a ZetaSent event func (ob *ChainClient) BuildInboundVoteMsgForZetaSentEvent(event *zetaconnector.ZetaConnectorNonEthZetaSent) *types.MsgVoteOnObservedInboundTx { - destChain := common.GetChainFromChainID(event.DestinationChainId.Int64()) + destChain := chains.GetChainFromChainID(event.DestinationChainId.Int64()) if destChain == nil { ob.logger.ExternalChainWatcher.Warn().Msgf("chain id not supported %d", event.DestinationChainId.Int64()) return nil @@ -304,7 +306,7 @@ func (ob *ChainClient) BuildInboundVoteMsgForZetaSentEvent(event *zetaconnector. event.Raw.TxHash.Hex(), event.Raw.BlockNumber, event.DestinationGasLimit.Uint64(), - common.CoinType_Zeta, + coin.CoinType_Zeta, "", ob.zetaClient.GetKeys().GetOperatorAddress().String(), event.Raw.Index, @@ -317,7 +319,7 @@ func (ob *ChainClient) BuildInboundVoteMsgForTokenSentToTSS(tx *ethrpc.Transacti // compliance check maybeReceiver := "" - parsedAddress, _, err := common.ParseAddressAndData(message) + parsedAddress, _, err := chains.ParseAddressAndData(message) if err == nil && parsedAddress != (ethcommon.Address{}) { maybeReceiver = parsedAddress.Hex() } @@ -330,7 +332,7 @@ func (ob *ChainClient) BuildInboundVoteMsgForTokenSentToTSS(tx *ethrpc.Transacti // donation check // #nosec G703 err is already checked data, _ := hex.DecodeString(message) - if bytes.Equal(data, []byte(common.DonationMessage)) { + if bytes.Equal(data, []byte(constant.DonationMessage)) { ob.logger.ExternalChainWatcher.Info().Msgf("thank you rich folk for your donation! tx %s chain %d", tx.Hash, ob.chain.ChainId) return nil } @@ -348,7 +350,7 @@ func (ob *ChainClient) BuildInboundVoteMsgForTokenSentToTSS(tx *ethrpc.Transacti tx.Hash, blockNumber, 90_000, - common.CoinType_Gas, + coin.CoinType_Gas, "", ob.zetaClient.GetKeys().GetOperatorAddress().String(), 0, // not a smart contract call diff --git a/zetaclient/evm/inbounds_test.go b/zetaclient/evm/inbounds_test.go index e382340590..e24c66b4d5 100644 --- a/zetaclient/evm/inbounds_test.go +++ b/zetaclient/evm/inbounds_test.go @@ -10,7 +10,9 @@ import ( lru "github.com/hashicorp/golang-lru" "github.com/onrik/ethrpc" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/constant" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/evm" @@ -22,7 +24,7 @@ import ( // MockEVMClient creates a mock ChainClient with custom chain, TSS, params etc func MockEVMClient( - chain common.Chain, + chain chains.Chain, evmClient interfaces.EVMRPCClient, evmJSONRPC interfaces.EVMJSONRPCClient, zetClient interfaces.ZetaCoreBridger, @@ -52,14 +54,14 @@ func MockEVMClient( func TestEVM_CheckAndVoteInboundTokenZeta(t *testing.T) { // load archived ZetaSent intx, receipt and cctx // https://etherscan.io/tx/0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76 - chain := common.EthChain() + chain := chains.EthChain() confirmation := uint64(10) chainID := chain.ChainId chainParam := stub.MockChainParams(chain.ChainId, confirmation) intxHash := "0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76" t.Run("should pass for archived intx, receipt and cctx", func(t *testing.T) { - tx, receipt, cctx := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Zeta) + tx, receipt, cctx := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_Zeta) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation @@ -69,7 +71,7 @@ func TestEVM_CheckAndVoteInboundTokenZeta(t *testing.T) { require.Equal(t, cctx.InboundTxParams.InboundTxBallotIndex, ballot) }) t.Run("should fail on unconfirmed intx", func(t *testing.T) { - tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Zeta) + tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_Zeta) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - 1 @@ -78,7 +80,7 @@ func TestEVM_CheckAndVoteInboundTokenZeta(t *testing.T) { require.ErrorContains(t, err, "not been confirmed") }) t.Run("should not act if no ZetaSent event", func(t *testing.T) { - tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Zeta) + tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_Zeta) receipt.Logs = receipt.Logs[:2] // remove ZetaSent event require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation @@ -89,7 +91,7 @@ func TestEVM_CheckAndVoteInboundTokenZeta(t *testing.T) { require.Equal(t, "", ballot) }) t.Run("should not act if emitter is not ZetaConnector", func(t *testing.T) { - tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Zeta) + tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_Zeta) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation @@ -103,14 +105,14 @@ func TestEVM_CheckAndVoteInboundTokenZeta(t *testing.T) { func TestEVM_CheckAndVoteInboundTokenERC20(t *testing.T) { // load archived ERC20 intx, receipt and cctx // https://etherscan.io/tx/0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da - chain := common.EthChain() + chain := chains.EthChain() confirmation := uint64(10) chainID := chain.ChainId chainParam := stub.MockChainParams(chain.ChainId, confirmation) intxHash := "0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da" t.Run("should pass for archived intx, receipt and cctx", func(t *testing.T) { - tx, receipt, cctx := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_ERC20) + tx, receipt, cctx := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_ERC20) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation @@ -120,7 +122,7 @@ func TestEVM_CheckAndVoteInboundTokenERC20(t *testing.T) { require.Equal(t, cctx.InboundTxParams.InboundTxBallotIndex, ballot) }) t.Run("should fail on unconfirmed intx", func(t *testing.T) { - tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_ERC20) + tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_ERC20) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - 1 @@ -129,7 +131,7 @@ func TestEVM_CheckAndVoteInboundTokenERC20(t *testing.T) { require.ErrorContains(t, err, "not been confirmed") }) t.Run("should not act if no Deposit event", func(t *testing.T) { - tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_ERC20) + tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_ERC20) receipt.Logs = receipt.Logs[:1] // remove Deposit event require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation @@ -140,7 +142,7 @@ func TestEVM_CheckAndVoteInboundTokenERC20(t *testing.T) { require.Equal(t, "", ballot) }) t.Run("should not act if emitter is not ERC20 Custody", func(t *testing.T) { - tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_ERC20) + tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_ERC20) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation @@ -154,14 +156,14 @@ func TestEVM_CheckAndVoteInboundTokenERC20(t *testing.T) { func TestEVM_CheckAndVoteInboundTokenGas(t *testing.T) { // load archived Gas intx, receipt and cctx // https://etherscan.io/tx/0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532 - chain := common.EthChain() + chain := chains.EthChain() confirmation := uint64(10) chainID := chain.ChainId chainParam := stub.MockChainParams(chain.ChainId, confirmation) intxHash := "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532" t.Run("should pass for archived intx, receipt and cctx", func(t *testing.T) { - tx, receipt, cctx := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Gas) + tx, receipt, cctx := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_Gas) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation @@ -171,7 +173,7 @@ func TestEVM_CheckAndVoteInboundTokenGas(t *testing.T) { require.Equal(t, cctx.InboundTxParams.InboundTxBallotIndex, ballot) }) t.Run("should fail on unconfirmed intx", func(t *testing.T) { - tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Gas) + tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_Gas) require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation - 1 @@ -180,7 +182,7 @@ func TestEVM_CheckAndVoteInboundTokenGas(t *testing.T) { require.ErrorContains(t, err, "not been confirmed") }) t.Run("should not act if receiver is not TSS", func(t *testing.T) { - tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Gas) + tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_Gas) tx.To = testutils.OtherAddress1 // use other address require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation @@ -191,7 +193,7 @@ func TestEVM_CheckAndVoteInboundTokenGas(t *testing.T) { require.Equal(t, "", ballot) }) t.Run("should not act if transaction failed", func(t *testing.T) { - tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Gas) + tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_Gas) receipt.Status = ethtypes.ReceiptStatusFailed require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation @@ -202,8 +204,8 @@ func TestEVM_CheckAndVoteInboundTokenGas(t *testing.T) { require.Equal(t, "", ballot) }) t.Run("should not act on nil message", func(t *testing.T) { - tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, common.CoinType_Gas) - tx.Input = hex.EncodeToString([]byte(common.DonationMessage)) // donation will result in nil message + tx, receipt, _ := testutils.LoadEVMIntxNReceiptNCctx(t, chainID, intxHash, coin.CoinType_Gas) + tx.Input = hex.EncodeToString([]byte(constant.DonationMessage)) // donation will result in nil message require.NoError(t, evm.ValidateEvmTransaction(tx)) lastBlock := receipt.BlockNumber.Uint64() + confirmation @@ -218,10 +220,10 @@ func TestEVM_BuildInboundVoteMsgForZetaSentEvent(t *testing.T) { // load archived ZetaSent receipt // https://etherscan.io/tx/0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76 chainID := int64(1) - chain := common.EthChain() + chain := chains.EthChain() intxHash := "0xf3935200c80f98502d5edc7e871ffc40ca898e134525c42c2ae3cbc5725f9d76" - receipt := testutils.LoadEVMIntxReceipt(t, chainID, intxHash, common.CoinType_Zeta) - cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, common.CoinType_Zeta) + receipt := testutils.LoadEVMIntxReceipt(t, chainID, intxHash, coin.CoinType_Zeta) + cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, coin.CoinType_Zeta) // parse ZetaSent event ob := MockEVMClient(chain, nil, nil, nil, nil, 1, stub.MockChainParams(1, 1)) @@ -264,11 +266,11 @@ func TestEVM_BuildInboundVoteMsgForZetaSentEvent(t *testing.T) { func TestEVM_BuildInboundVoteMsgForDepositedEvent(t *testing.T) { // load archived Deposited receipt // https://etherscan.io/tx/0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId intxHash := "0x4ea69a0e2ff36f7548ab75791c3b990e076e2a4bffeb616035b239b7d33843da" - tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, common.CoinType_ERC20) - cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, common.CoinType_ERC20) + tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, coin.CoinType_ERC20) + cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, coin.CoinType_ERC20) // parse Deposited event ob := MockEVMClient(chain, nil, nil, nil, nil, 1, stub.MockChainParams(1, 1)) @@ -300,7 +302,7 @@ func TestEVM_BuildInboundVoteMsgForDepositedEvent(t *testing.T) { require.Nil(t, msg) }) t.Run("should return nil msg on donation transaction", func(t *testing.T) { - event.Message = []byte(common.DonationMessage) + event.Message = []byte(constant.DonationMessage) msg := ob.BuildInboundVoteMsgForDepositedEvent(event, sender) require.Nil(t, msg) }) @@ -309,17 +311,17 @@ func TestEVM_BuildInboundVoteMsgForDepositedEvent(t *testing.T) { func TestEVM_BuildInboundVoteMsgForTokenSentToTSS(t *testing.T) { // load archived gas token transfer to TSS // https://etherscan.io/tx/0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532 - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId intxHash := "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532" - tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, common.CoinType_Gas) + tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, coin.CoinType_Gas) require.NoError(t, evm.ValidateEvmTransaction(tx)) - cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, common.CoinType_Gas) + cctx := testutils.LoadEVMIntxCctx(t, chainID, intxHash, coin.CoinType_Gas) // load archived gas token donation to TSS // https://etherscan.io/tx/0x52f214cf7b10be71f4d274193287d47bc9632b976e69b9d2cdeb527c2ba32155 inTxHashDonation := "0x52f214cf7b10be71f4d274193287d47bc9632b976e69b9d2cdeb527c2ba32155" - txDonation, receiptDonation := testutils.LoadEVMIntxNReceiptDonation(t, chainID, inTxHashDonation, common.CoinType_Gas) + txDonation, receiptDonation := testutils.LoadEVMIntxNReceiptDonation(t, chainID, inTxHashDonation, coin.CoinType_Gas) require.NoError(t, evm.ValidateEvmTransaction(txDonation)) // create test compliance config @@ -358,14 +360,14 @@ func TestEVM_BuildInboundVoteMsgForTokenSentToTSS(t *testing.T) { func TestEVM_ObserveTSSReceiveInBlock(t *testing.T) { // https://etherscan.io/tx/0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532 - chain := common.EthChain() + chain := chains.EthChain() chainID := chain.ChainId confirmation := uint64(1) chainParam := stub.MockChainParams(chain.ChainId, confirmation) intxHash := "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532" // load archived tx and receipt - tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, common.CoinType_Gas) + tx, receipt := testutils.LoadEVMIntxNReceipt(t, chainID, intxHash, coin.CoinType_Gas) require.NoError(t, evm.ValidateEvmTransaction(tx)) // load archived evm block diff --git a/zetaclient/evm/outbound_transaction_data.go b/zetaclient/evm/outbound_transaction_data.go index 76f8cf6d8f..0255c1c525 100644 --- a/zetaclient/evm/outbound_transaction_data.go +++ b/zetaclient/evm/outbound_transaction_data.go @@ -10,7 +10,8 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/zetaclient/interfaces" ) @@ -66,7 +67,7 @@ func (txData *OutBoundTransactionData) SetupGas( cctx *types.CrossChainTx, logger zerolog.Logger, client interfaces.EVMRPCClient, - chain *common.Chain, + chain *chains.Chain, ) error { txData.gasLimit = cctx.GetCurrentOutTxParam().OutboundTxGasLimit @@ -85,7 +86,7 @@ func (txData *OutBoundTransactionData) SetupGas( // we should possibly remove it completely and return an error if no OutboundTxGasPrice is provided because it means no fee is processed on ZetaChain specified, ok := new(big.Int).SetString(cctx.GetCurrentOutTxParam().OutboundTxGasPrice, 10) if !ok { - if common.IsEthereumChain(chain.ChainId) { + if chains.IsEthereumChain(chain.ChainId) { suggested, err := client.SuggestGasPrice(context.Background()) if err != nil { return errors.Join(err, fmt.Errorf("cannot get gas price from chain %s ", chain)) @@ -127,7 +128,7 @@ func NewOutBoundTransactionData( return nil, true, nil } - toChain := common.GetChainFromChainID(txData.toChainID.Int64()) + toChain := chains.GetChainFromChainID(txData.toChainID.Int64()) if toChain == nil { return nil, true, fmt.Errorf("unknown chain: %d", txData.toChainID.Int64()) } @@ -169,7 +170,7 @@ func NewOutBoundTransactionData( } // Base64 decode message - if cctx.GetCurrentOutTxParam().CoinType != common.CoinType_Cmd { + if cctx.GetCurrentOutTxParam().CoinType != coin.CoinType_Cmd { txData.message, err = base64.StdEncoding.DecodeString(cctx.RelayedMessage) if err != nil { logger.Err(err).Msgf("decode CCTX.Message %s error", cctx.RelayedMessage) diff --git a/zetaclient/evm/outbound_transaction_data_test.go b/zetaclient/evm/outbound_transaction_data_test.go index cc5de0489b..8943091157 100644 --- a/zetaclient/evm/outbound_transaction_data_test.go +++ b/zetaclient/evm/outbound_transaction_data_test.go @@ -7,7 +7,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog" "github.com/stretchr/testify/require" - corecommon "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -55,14 +55,14 @@ func TestSigner_SetupGas(t *testing.T) { logger := zerolog.Logger{} t.Run("SetupGas_success", func(t *testing.T) { - chain := corecommon.BscMainnetChain() + chain := chains.BscMainnetChain() err := txData.SetupGas(cctx, logger, evmSigner.EvmClient(), &chain) require.NoError(t, err) }) t.Run("SetupGas_error", func(t *testing.T) { cctx.GetCurrentOutTxParam().OutboundTxGasPrice = "invalidGasPrice" - chain := corecommon.BscMainnetChain() + chain := chains.BscMainnetChain() err := txData.SetupGas(cctx, logger, evmSigner.EvmClient(), &chain) require.ErrorContains(t, err, "cannot convert gas price") }) diff --git a/zetaclient/evm/validation_test.go b/zetaclient/evm/validation_test.go index a1e2d3de9c..61075b1025 100644 --- a/zetaclient/evm/validation_test.go +++ b/zetaclient/evm/validation_test.go @@ -9,7 +9,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/onrik/ethrpc" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/zetaclient/testutils" ) @@ -117,7 +117,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { }{ { name: "should pass for valid transaction", - tx: testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas), + tx: testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas), fail: false, }, { @@ -129,7 +129,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for empty hash", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.Hash = "" return tx }(), @@ -139,7 +139,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for negative nonce", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.Nonce = -1 return tx }(), @@ -149,7 +149,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for empty from address", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.From = "" return tx }(), @@ -159,7 +159,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for invalid from address", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.From = "0x" return tx }(), @@ -169,7 +169,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should pass for empty to address", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.To = "" return tx }(), @@ -178,7 +178,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for invalid to address", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.To = "0xinvalid" return tx }(), @@ -188,7 +188,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for negative value", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.Value = *big.NewInt(-1) return tx }(), @@ -198,7 +198,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for negative gas", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.Gas = -1 return tx }(), @@ -208,7 +208,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for negative gas price", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.GasPrice = *big.NewInt(-1) return tx }(), @@ -218,7 +218,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should remove '0x' prefix from input data", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) return tx }(), fail: false, @@ -226,7 +226,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "nil block number should pass", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.BlockNumber = nil return tx }(), @@ -235,7 +235,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for negative block number", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) negBlockNumber := -1 tx.BlockNumber = &negBlockNumber return tx @@ -246,7 +246,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for empty block hash", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.BlockHash = "" return tx }(), @@ -256,7 +256,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "nil transaction index should fail", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.TransactionIndex = nil return tx }(), @@ -266,7 +266,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for negative transaction index", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) negTransactionIndex := -1 tx.TransactionIndex = &negTransactionIndex return tx @@ -277,7 +277,7 @@ func TestCheckEvmTransactionTable(t *testing.T) { { name: "should fail for invalid input data", tx: func() *ethrpc.Transaction { - tx := testutils.LoadEVMIntx(t, chainID, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, chainID, intxHash, coin.CoinType_Gas) tx.Input = "03befinvalid" return tx }(), @@ -304,7 +304,7 @@ func TestCheckEvmTransaction(t *testing.T) { intxHash := "0xeaec67d5dd5d85f27b21bef83e01cbdf59154fd793ea7a22c297f7c3a722c532" t.Run("should pass for valid transaction", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) err := ValidateEvmTransaction(tx) require.NoError(t, err) }) @@ -313,99 +313,99 @@ func TestCheckEvmTransaction(t *testing.T) { require.ErrorContains(t, err, "transaction is nil") }) t.Run("should fail for empty hash", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.Hash = "" err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "hash is empty") }) t.Run("should fail for negative nonce", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.Nonce = -1 err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "nonce -1 is negative") }) t.Run("should fail for empty from address", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.From = "" err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "not a valid hex address") }) t.Run("should fail for invalid from address", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.From = "0x" err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "from 0x is not a valid hex address") }) t.Run("should pass for empty to address", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.To = "" err := ValidateEvmTransaction(tx) require.NoError(t, err) }) t.Run("should fail for invalid to address", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.To = "0xinvalid" err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "to 0xinvalid is not a valid hex address") }) t.Run("should fail for negative value", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.Value = *big.NewInt(-1) err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "value -1 is negative") }) t.Run("should fail for negative gas", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.Gas = -1 err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "gas -1 is negative") }) t.Run("should fail for negative gas price", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.GasPrice = *big.NewInt(-1) err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "gas price -1 is negative") }) t.Run("should remove '0x' prefix from input data", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) err := ValidateEvmTransaction(tx) require.NoError(t, err) require.Equal(t, "", tx.Input) }) t.Run("nil block number should pass", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.BlockNumber = nil err := ValidateEvmTransaction(tx) require.NoError(t, err) }) t.Run("should fail for negative block number", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) negBlockNumber := -1 tx.BlockNumber = &negBlockNumber err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "block number -1 is not positive") }) t.Run("should fail for empty block hash", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.BlockHash = "" err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "block hash is empty") }) t.Run("nil transaction index should fail", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.TransactionIndex = nil err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "index is nil") }) t.Run("should fail for negative transaction index", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) negTransactionIndex := -1 tx.TransactionIndex = &negTransactionIndex err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "index -1 is negative") }) t.Run("should fail for invalid input data", func(t *testing.T) { - tx := testutils.LoadEVMIntx(t, 1, intxHash, common.CoinType_Gas) + tx := testutils.LoadEVMIntx(t, 1, intxHash, coin.CoinType_Gas) tx.Input = "03befinvalid" err := ValidateEvmTransaction(tx) require.ErrorContains(t, err, "input data is not hex encoded") diff --git a/zetaclient/interfaces/interfaces.go b/zetaclient/interfaces/interfaces.go index 5842c2b944..75242ab17d 100644 --- a/zetaclient/interfaces/interfaces.go +++ b/zetaclient/interfaces/interfaces.go @@ -5,6 +5,9 @@ import ( "math/big" "github.com/onrik/ethrpc" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/proofs" "github.com/zeta-chain/zetacore/zetaclient/keys" "github.com/zeta-chain/zetacore/zetaclient/outtxprocessor" @@ -20,7 +23,6 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/rs/zerolog" "github.com/zeta-chain/go-tss/blame" - "github.com/zeta-chain/zetacore/common" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" ) @@ -71,13 +73,13 @@ type ZetaCoreBridger interface { outTxEffectiveGasPrice *big.Int, outTxEffectiveGasLimit uint64, amount *big.Int, - status common.ReceiveStatus, - chain common.Chain, + status chains.ReceiveStatus, + chain chains.Chain, nonce uint64, - coinType common.CoinType, + coinType coin.CoinType, ) (string, string, error) - PostGasPrice(chain common.Chain, gasPrice uint64, supply string, blockNum uint64) (string, error) - PostAddBlockHeader(chainID int64, txhash []byte, height int64, header common.HeaderData) (string, error) + PostGasPrice(chain chains.Chain, gasPrice uint64, supply string, blockNum uint64) (string, error) + PostAddBlockHeader(chainID int64, txhash []byte, height int64, header proofs.HeaderData) (string, error) GetBlockHeaderStateByChain(chainID int64) (observertypes.QueryGetBlockHeaderStateResponse, error) PostBlameData(blame *blame.Blame, chainID int64, index string) (string, error) @@ -85,18 +87,18 @@ type ZetaCoreBridger interface { chainID int64, nonce uint64, txHash string, - proof *common.Proof, + proof *proofs.Proof, blockHash string, txIndex int64, ) (string, error) GetKeys() *keys.Keys GetBlockHeight() (int64, error) GetZetaBlockHeight() (int64, error) - GetLastBlockHeightByChain(chain common.Chain) (*crosschaintypes.LastBlockHeight, error) + GetLastBlockHeightByChain(chain chains.Chain) (*crosschaintypes.LastBlockHeight, error) ListPendingCctx(chainID int64) ([]*crosschaintypes.CrossChainTx, uint64, error) GetPendingNoncesByChain(chainID int64) (observertypes.PendingNonces, error) GetCctxByNonce(chainID int64, nonce uint64) (*crosschaintypes.CrossChainTx, error) - GetOutTxTracker(chain common.Chain, nonce uint64) (*crosschaintypes.OutTxTracker, error) + GetOutTxTracker(chain chains.Chain, nonce uint64) (*crosschaintypes.OutTxTracker, error) GetAllOutTxTrackerByChain(chainID int64, order Order) ([]crosschaintypes.OutTxTracker, error) GetCrosschainFlags() (observertypes.CrosschainFlags, error) GetObserverList() ([]string, error) @@ -104,7 +106,7 @@ type ZetaCoreBridger interface { GetBtcTssAddress(chainID int64) (string, error) GetInboundTrackersForChain(chainID int64) ([]crosschaintypes.InTxTracker, error) GetLogger() *zerolog.Logger - ZetaChain() common.Chain + ZetaChain() chains.Chain Pause() Unpause() GetZetaHotKeyBalance() (sdkmath.Int, error) diff --git a/zetaclient/interfaces/signer.go b/zetaclient/interfaces/signer.go index ae6ef31b59..461902359c 100644 --- a/zetaclient/interfaces/signer.go +++ b/zetaclient/interfaces/signer.go @@ -4,7 +4,7 @@ import ( "crypto/ecdsa" "fmt" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/btcsuite/btcd/btcec/v2" "github.com/btcsuite/btcd/chaincfg" @@ -17,7 +17,7 @@ import ( type TSSSigner interface { Pubkey() []byte // Sign: Specify optionalPubkey to use a different pubkey than the current pubkey set during keygen - Sign(data []byte, height uint64, nonce uint64, chain *common.Chain, optionalPubkey string) ([65]byte, error) + Sign(data []byte, height uint64, nonce uint64, chain *chains.Chain, optionalPubkey string) ([65]byte, error) EVMAddress() ethcommon.Address BTCAddress() string BTCAddressWitnessPubkeyHash() *btcutil.AddressWitnessPubKeyHash @@ -31,7 +31,7 @@ type TestSigner struct { PrivKey *ecdsa.PrivateKey } -func (s TestSigner) Sign(digest []byte, _ uint64, _ uint64, _ *common.Chain, _ string) ([65]byte, error) { +func (s TestSigner) Sign(digest []byte, _ uint64, _ uint64, _ *chains.Chain, _ string) ([65]byte, error) { sig, err := crypto.Sign(digest, s.PrivKey) if err != nil { return [65]byte{}, err diff --git a/zetaclient/keys/keys.go b/zetaclient/keys/keys.go index e7e40c2bdc..1ca248aff9 100644 --- a/zetaclient/keys/keys.go +++ b/zetaclient/keys/keys.go @@ -15,8 +15,8 @@ import ( sdk "github.com/cosmos/cosmos-sdk/types" "github.com/rs/zerolog/log" "github.com/zeta-chain/zetacore/cmd" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/cosmos" + zetacrypto "github.com/zeta-chain/zetacore/pkg/crypto" "github.com/zeta-chain/zetacore/zetaclient/config" zetaerrors "github.com/zeta-chain/zetacore/zetaclient/errors" ) @@ -78,7 +78,7 @@ func GetKeyringKeybase(cfg config.Config, hotkeyPassword string) (ckeys.Keyring, return nil, "", fmt.Errorf("key not in backend %s present with name (%s): %w", kb.Backend(), granteeName, err) } - pubkeyBech32, err := common.GetPubkeyBech32FromRecord(rc) + pubkeyBech32, err := zetacrypto.GetPubkeyBech32FromRecord(rc) if err != nil { return nil, "", fmt.Errorf("fail to get pubkey from record,err:%w", err) } @@ -151,8 +151,8 @@ func (k *Keys) GetKeybase() ckeys.Keyring { return k.kb } -func (k *Keys) GetPubKeySet(password string) (common.PubKeySet, error) { - pubkeySet := common.PubKeySet{ +func (k *Keys) GetPubKeySet(password string) (zetacrypto.PubKeySet, error) { + pubkeySet := zetacrypto.PubKeySet{ Secp256k1: "", Ed25519: "", } @@ -166,7 +166,7 @@ func (k *Keys) GetPubKeySet(password string) (common.PubKeySet, error) { if err != nil { return pubkeySet, zetaerrors.ErrBech32ifyPubKey } - pubkey, err := common.NewPubKey(s) + pubkey, err := zetacrypto.NewPubKey(s) if err != nil { return pubkeySet, zetaerrors.ErrNewPubKey } @@ -184,7 +184,7 @@ func (k *Keys) GetHotkeyPassword() string { } func SetupConfigForTest() { - config := cosmos.GetConfig() + config := sdk.GetConfig() config.SetBech32PrefixForAccount(cmd.Bech32PrefixAccAddr, cmd.Bech32PrefixAccPub) config.SetBech32PrefixForValidator(cmd.Bech32PrefixValAddr, cmd.Bech32PrefixValPub) config.SetBech32PrefixForConsensusNode(cmd.Bech32PrefixConsAddr, cmd.Bech32PrefixConsPub) diff --git a/zetaclient/keys/keys_test.go b/zetaclient/keys/keys_test.go index 2b37f5a63c..347195869f 100644 --- a/zetaclient/keys/keys_test.go +++ b/zetaclient/keys/keys_test.go @@ -18,8 +18,8 @@ import ( "github.com/zeta-chain/zetacore/zetaclient/config" . "gopkg.in/check.v1" + sdk "github.com/cosmos/cosmos-sdk/types" "github.com/zeta-chain/zetacore/cmd" - "github.com/zeta-chain/zetacore/common/cosmos" ) type KeysSuite struct{} @@ -53,7 +53,7 @@ func (*KeysSuite) setupKeysForTest(c *C) string { registry := codectypes.NewInterfaceRegistry() cryptocodec.RegisterInterfaces(registry) cdc := codec.NewProtoCodec(registry) - kb, err := cKeys.New(cosmos.KeyringServiceName(), cKeys.BackendTest, metaCliDir, buf, cdc) + kb, err := cKeys.New(sdk.KeyringServiceName(), cKeys.BackendTest, metaCliDir, buf, cdc) c.Assert(err, IsNil) _, _, err = kb.NewMnemonic(GetGranteeKeyName(signerNameForTest), cKeys.English, cmd.ZetaChainHDPath, password, hd.Secp256k1) @@ -91,7 +91,7 @@ func (ks *KeysSuite) TestNewKeys(c *C) { k, _, err := GetKeyringKeybase(cfg, "") c.Assert(err, IsNil) c.Assert(k, NotNil) - granter := cosmos.AccAddress(crypto.AddressHash([]byte("granter"))) + granter := sdk.AccAddress(crypto.AddressHash([]byte("granter"))) ki := NewKeysWithKeybase(k, granter, signerNameForTest, "") kInfo := ki.GetSignerInfo() c.Assert(kInfo, NotNil) diff --git a/zetaclient/supplychecker/zeta_supply_checker.go b/zetaclient/supplychecker/zeta_supply_checker.go index 2a2e112c4a..2168c5483e 100644 --- a/zetaclient/supplychecker/zeta_supply_checker.go +++ b/zetaclient/supplychecker/zeta_supply_checker.go @@ -15,7 +15,8 @@ import ( "github.com/ethereum/go-ethereum/ethclient" "github.com/pkg/errors" "github.com/rs/zerolog" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" corecontext "github.com/zeta-chain/zetacore/zetaclient/core_context" clienttypes "github.com/zeta-chain/zetacore/zetaclient/types" @@ -28,8 +29,8 @@ type ZetaSupplyChecker struct { ticker *clienttypes.DynamicTicker stop chan struct{} logger zerolog.Logger - externalEvmChain []common.Chain - ethereumChain common.Chain + externalEvmChain []chains.Chain + ethereumChain chains.Chain genesisSupply sdkmath.Int } @@ -61,11 +62,11 @@ func NewZetaSupplyChecker(appContext *appcontext.AppContext, zetaClient *zetabri } for chainID := range zetaSupplyChecker.evmClient { - chain := common.GetChainFromChainID(chainID) - if chain.IsExternalChain() && common.IsEVMChain(chain.ChainId) && !common.IsEthereumChain(chain.ChainId) { + chain := chains.GetChainFromChainID(chainID) + if chain.IsExternalChain() && chains.IsEVMChain(chain.ChainId) && !chains.IsEthereumChain(chain.ChainId) { zetaSupplyChecker.externalEvmChain = append(zetaSupplyChecker.externalEvmChain, *chain) } - if common.IsEthereumChain(chain.ChainId) { + if chains.IsEthereumChain(chain.ChainId) { zetaSupplyChecker.ethereumChain = *chain } } @@ -224,7 +225,7 @@ func (zs *ZetaSupplyChecker) AbortedTxAmount() (sdkmath.Int, error) { } func (zs *ZetaSupplyChecker) GetAmountOfZetaInTransit() sdkmath.Int { - chainsToCheck := make([]common.Chain, len(zs.externalEvmChain)+1) + chainsToCheck := make([]chains.Chain, len(zs.externalEvmChain)+1) chainsToCheck = append(append(chainsToCheck, zs.externalEvmChain...), zs.ethereumChain) cctxs := zs.GetPendingCCTXInTransit(chainsToCheck) amount := sdkmath.ZeroUint() @@ -237,7 +238,7 @@ func (zs *ZetaSupplyChecker) GetAmountOfZetaInTransit() sdkmath.Int { } return amountInt } -func (zs *ZetaSupplyChecker) GetPendingCCTXInTransit(receivingChains []common.Chain) []*types.CrossChainTx { +func (zs *ZetaSupplyChecker) GetPendingCCTXInTransit(receivingChains []chains.Chain) []*types.CrossChainTx { cctxInTransit := make([]*types.CrossChainTx, 0) for _, chain := range receivingChains { cctx, _, err := zs.zetaClient.ListPendingCctx(chain.ChainId) @@ -246,7 +247,7 @@ func (zs *ZetaSupplyChecker) GetPendingCCTXInTransit(receivingChains []common.Ch } nonceToCctxMap := make(map[uint64]*types.CrossChainTx) for _, c := range cctx { - if c.GetInboundTxParams().CoinType == common.CoinType_Zeta { + if c.GetInboundTxParams().CoinType == coin.CoinType_Zeta { nonceToCctxMap[c.GetCurrentOutTxParam().OutboundTxTssNonce] = c } } diff --git a/zetaclient/testutils/stub/chain_signer.go b/zetaclient/testutils/stub/chain_signer.go index 364cbc22bb..487452cea7 100644 --- a/zetaclient/testutils/stub/chain_signer.go +++ b/zetaclient/testutils/stub/chain_signer.go @@ -2,7 +2,7 @@ package stub import ( ethcommon "github.com/ethereum/go-ethereum/common" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/zetaclient/interfaces" "github.com/zeta-chain/zetacore/zetaclient/outtxprocessor" @@ -15,13 +15,13 @@ var _ interfaces.ChainSigner = (*EVMSigner)(nil) // EVMSigner is a mock of evm chain signer for testing type EVMSigner struct { - Chain common.Chain + Chain chains.Chain ZetaConnectorAddress ethcommon.Address ERC20CustodyAddress ethcommon.Address } func NewEVMSigner( - chain common.Chain, + chain chains.Chain, zetaConnectorAddress ethcommon.Address, erc20CustodyAddress ethcommon.Address, ) *EVMSigner { diff --git a/zetaclient/testutils/stub/core_bridge.go b/zetaclient/testutils/stub/core_bridge.go index d9172636c3..111d73983a 100644 --- a/zetaclient/testutils/stub/core_bridge.go +++ b/zetaclient/testutils/stub/core_bridge.go @@ -7,7 +7,9 @@ import ( "cosmossdk.io/math" "github.com/rs/zerolog" "github.com/zeta-chain/go-tss/blame" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/proofs" cctxtypes "github.com/zeta-chain/zetacore/x/crosschain/types" observerTypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/interfaces" @@ -21,11 +23,11 @@ var _ interfaces.ZetaCoreBridger = &MockZetaCoreBridge{} type MockZetaCoreBridge struct { paused bool - zetaChain common.Chain + zetaChain chains.Chain } func NewMockZetaCoreBridge() *MockZetaCoreBridge { - zetaChain, err := common.ZetaChainFromChainID("zetachain_7000-1") + zetaChain, err := chains.ZetaChainFromChainID("zetachain_7000-1") if err != nil { panic(err) } @@ -42,21 +44,21 @@ func (z *MockZetaCoreBridge) PostVoteInbound(_, _ uint64, _ *cctxtypes.MsgVoteOn return "", "", nil } -func (z *MockZetaCoreBridge) PostVoteOutbound(_ string, _ string, _ uint64, _ uint64, _ *big.Int, _ uint64, _ *big.Int, _ common.ReceiveStatus, _ common.Chain, _ uint64, _ common.CoinType) (string, string, error) { +func (z *MockZetaCoreBridge) PostVoteOutbound(_ string, _ string, _ uint64, _ uint64, _ *big.Int, _ uint64, _ *big.Int, _ chains.ReceiveStatus, _ chains.Chain, _ uint64, _ coin.CoinType) (string, string, error) { if z.paused { return "", "", errors.New(ErrMsgPaused) } return "", "", nil } -func (z *MockZetaCoreBridge) PostGasPrice(_ common.Chain, _ uint64, _ string, _ uint64) (string, error) { +func (z *MockZetaCoreBridge) PostGasPrice(_ chains.Chain, _ uint64, _ string, _ uint64) (string, error) { if z.paused { return "", errors.New(ErrMsgPaused) } return "", nil } -func (z *MockZetaCoreBridge) PostAddBlockHeader(_ int64, _ []byte, _ int64, _ common.HeaderData) (string, error) { +func (z *MockZetaCoreBridge) PostAddBlockHeader(_ int64, _ []byte, _ int64, _ proofs.HeaderData) (string, error) { if z.paused { return "", errors.New(ErrMsgPaused) } @@ -77,7 +79,7 @@ func (z *MockZetaCoreBridge) PostBlameData(_ *blame.Blame, _ int64, _ string) (s return "", nil } -func (z *MockZetaCoreBridge) AddTxHashToOutTxTracker(_ int64, _ uint64, _ string, _ *common.Proof, _ string, _ int64) (string, error) { +func (z *MockZetaCoreBridge) AddTxHashToOutTxTracker(_ int64, _ uint64, _ string, _ *proofs.Proof, _ string, _ int64) (string, error) { if z.paused { return "", errors.New(ErrMsgPaused) } @@ -102,7 +104,7 @@ func (z *MockZetaCoreBridge) GetZetaBlockHeight() (int64, error) { return 0, nil } -func (z *MockZetaCoreBridge) GetLastBlockHeightByChain(_ common.Chain) (*cctxtypes.LastBlockHeight, error) { +func (z *MockZetaCoreBridge) GetLastBlockHeightByChain(_ chains.Chain) (*cctxtypes.LastBlockHeight, error) { if z.paused { return nil, errors.New(ErrMsgPaused) } @@ -130,7 +132,7 @@ func (z *MockZetaCoreBridge) GetCctxByNonce(_ int64, _ uint64) (*cctxtypes.Cross return &cctxtypes.CrossChainTx{}, nil } -func (z *MockZetaCoreBridge) GetOutTxTracker(_ common.Chain, _ uint64) (*cctxtypes.OutTxTracker, error) { +func (z *MockZetaCoreBridge) GetOutTxTracker(_ chains.Chain, _ uint64) (*cctxtypes.OutTxTracker, error) { if z.paused { return nil, errors.New(ErrMsgPaused) } @@ -183,7 +185,7 @@ func (z *MockZetaCoreBridge) GetLogger() *zerolog.Logger { return nil } -func (z *MockZetaCoreBridge) ZetaChain() common.Chain { +func (z *MockZetaCoreBridge) ZetaChain() chains.Chain { return z.zetaChain } diff --git a/zetaclient/testutils/stub/tss_signer.go b/zetaclient/testutils/stub/tss_signer.go index da3f954588..5270618df0 100644 --- a/zetaclient/testutils/stub/tss_signer.go +++ b/zetaclient/testutils/stub/tss_signer.go @@ -7,7 +7,7 @@ import ( "github.com/btcsuite/btcutil" ethcommon "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/zetaclient/interfaces" "github.com/zeta-chain/zetacore/zetaclient/testutils" ) @@ -46,7 +46,7 @@ func NewTSSAthens3() *TSS { } // Sign uses test key unrelated to any tss key in production -func (s *TSS) Sign(data []byte, _ uint64, _ uint64, _ *common.Chain, _ string) ([65]byte, error) { +func (s *TSS) Sign(data []byte, _ uint64, _ uint64, _ *chains.Chain, _ string) ([65]byte, error) { signature, err := crypto.Sign(data, TestPrivateKey) if err != nil { return [65]byte{}, err diff --git a/zetaclient/testutils/testdata.go b/zetaclient/testutils/testdata.go index 0676824514..c8d5788d8d 100644 --- a/zetaclient/testutils/testdata.go +++ b/zetaclient/testutils/testdata.go @@ -11,7 +11,7 @@ import ( ethtypes "github.com/ethereum/go-ethereum/core/types" "github.com/onrik/ethrpc" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/zetaclient/config" ) @@ -106,7 +106,7 @@ func LoadEVMIntx( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) *ethrpc.Transaction { + coinType coin.CoinType) *ethrpc.Transaction { nameTx := path.Join("../", TestDataPathEVM, FileNameEVMIntx(chainID, intxHash, coinType, false)) tx := ðrpc.Transaction{} @@ -120,7 +120,7 @@ func LoadEVMIntxReceipt( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) *ethtypes.Receipt { + coinType coin.CoinType) *ethtypes.Receipt { nameReceipt := path.Join("../", TestDataPathEVM, FileNameEVMIntxReceipt(chainID, intxHash, coinType, false)) receipt := ðtypes.Receipt{} @@ -134,7 +134,7 @@ func LoadEVMIntxCctx( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) *crosschaintypes.CrossChainTx { + coinType coin.CoinType) *crosschaintypes.CrossChainTx { nameCctx := path.Join("../", TestDataPathCctx, FileNameEVMIntxCctx(chainID, intxHash, coinType)) cctx := &crosschaintypes.CrossChainTx{} @@ -161,7 +161,7 @@ func LoadEVMIntxNReceipt( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) (*ethrpc.Transaction, *ethtypes.Receipt) { + coinType coin.CoinType) (*ethrpc.Transaction, *ethtypes.Receipt) { // load archived intx and receipt tx := LoadEVMIntx(t, chainID, intxHash, coinType) receipt := LoadEVMIntxReceipt(t, chainID, intxHash, coinType) @@ -174,7 +174,7 @@ func LoadEVMIntxDonation( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) *ethrpc.Transaction { + coinType coin.CoinType) *ethrpc.Transaction { nameTx := path.Join("../", TestDataPathEVM, FileNameEVMIntx(chainID, intxHash, coinType, true)) tx := ðrpc.Transaction{} @@ -188,7 +188,7 @@ func LoadEVMIntxReceiptDonation( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) *ethtypes.Receipt { + coinType coin.CoinType) *ethtypes.Receipt { nameReceipt := path.Join("../", TestDataPathEVM, FileNameEVMIntxReceipt(chainID, intxHash, coinType, true)) receipt := ðtypes.Receipt{} @@ -202,7 +202,7 @@ func LoadEVMIntxNReceiptDonation( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) (*ethrpc.Transaction, *ethtypes.Receipt) { + coinType coin.CoinType) (*ethrpc.Transaction, *ethtypes.Receipt) { // load archived donation intx and receipt tx := LoadEVMIntxDonation(t, chainID, intxHash, coinType) receipt := LoadEVMIntxReceiptDonation(t, chainID, intxHash, coinType) @@ -215,7 +215,7 @@ func LoadEVMIntxNReceiptNCctx( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) (*ethrpc.Transaction, *ethtypes.Receipt, *crosschaintypes.CrossChainTx) { + coinType coin.CoinType) (*ethrpc.Transaction, *ethtypes.Receipt, *crosschaintypes.CrossChainTx) { // load archived intx, receipt and cctx tx := LoadEVMIntx(t, chainID, intxHash, coinType) receipt := LoadEVMIntxReceipt(t, chainID, intxHash, coinType) @@ -229,7 +229,7 @@ func LoadEVMOuttx( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) *ethtypes.Transaction { + coinType coin.CoinType) *ethtypes.Transaction { nameTx := path.Join("../", TestDataPathEVM, FileNameEVMOuttx(chainID, intxHash, coinType)) tx := ðtypes.Transaction{} @@ -243,7 +243,7 @@ func LoadEVMOuttxReceipt( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) *ethtypes.Receipt { + coinType coin.CoinType) *ethtypes.Receipt { nameReceipt := path.Join("../", TestDataPathEVM, FileNameEVMOuttxReceipt(chainID, intxHash, coinType)) receipt := ðtypes.Receipt{} @@ -257,7 +257,7 @@ func LoadEVMOuttxNReceipt( t *testing.T, chainID int64, intxHash string, - coinType common.CoinType) (*ethtypes.Transaction, *ethtypes.Receipt) { + coinType coin.CoinType) (*ethtypes.Transaction, *ethtypes.Receipt) { // load archived evm outtx and receipt tx := LoadEVMOuttx(t, chainID, intxHash, coinType) receipt := LoadEVMOuttxReceipt(t, chainID, intxHash, coinType) diff --git a/zetaclient/testutils/testdata_naming.go b/zetaclient/testutils/testdata_naming.go index 404b2471eb..bfe842310e 100644 --- a/zetaclient/testutils/testdata_naming.go +++ b/zetaclient/testutils/testdata_naming.go @@ -3,7 +3,7 @@ package testutils import ( "fmt" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" ) // FileNameEVMBlock returns unified archive file name for block @@ -15,7 +15,7 @@ func FileNameEVMBlock(chainID int64, blockNumber uint64, trimmed bool) string { } // FileNameEVMIntx returns unified archive file name for inbound tx -func FileNameEVMIntx(chainID int64, intxHash string, coinType common.CoinType, donation bool) string { +func FileNameEVMIntx(chainID int64, intxHash string, coinType coin.CoinType, donation bool) string { if !donation { return fmt.Sprintf("chain_%d_intx_ethrpc_%s_%s.json", chainID, coinType, intxHash) } @@ -23,7 +23,7 @@ func FileNameEVMIntx(chainID int64, intxHash string, coinType common.CoinType, d } // FileNameEVMIntxReceipt returns unified archive file name for inbound tx receipt -func FileNameEVMIntxReceipt(chainID int64, intxHash string, coinType common.CoinType, donation bool) string { +func FileNameEVMIntxReceipt(chainID int64, intxHash string, coinType coin.CoinType, donation bool) string { if !donation { return fmt.Sprintf("chain_%d_intx_receipt_%s_%s.json", chainID, coinType, intxHash) } @@ -31,7 +31,7 @@ func FileNameEVMIntxReceipt(chainID int64, intxHash string, coinType common.Coin } // FileNameEVMIntxCctx returns unified archive file name for inbound cctx -func FileNameEVMIntxCctx(chainID int64, intxHash string, coinType common.CoinType) string { +func FileNameEVMIntxCctx(chainID int64, intxHash string, coinType coin.CoinType) string { return fmt.Sprintf("cctx_intx_%d_%s_%s.json", chainID, coinType, intxHash) } @@ -54,11 +54,11 @@ func FileNameCctxByNonce(chainID int64, nonce uint64) string { } // FileNameEVMOuttx returns unified archive file name for outbound tx -func FileNameEVMOuttx(chainID int64, txHash string, coinType common.CoinType) string { +func FileNameEVMOuttx(chainID int64, txHash string, coinType coin.CoinType) string { return fmt.Sprintf("chain_%d_outtx_%s_%s.json", chainID, coinType, txHash) } // FileNameEVMOuttxReceipt returns unified archive file name for outbound tx receipt -func FileNameEVMOuttxReceipt(chainID int64, txHash string, coinType common.CoinType) string { +func FileNameEVMOuttxReceipt(chainID int64, txHash string, coinType coin.CoinType) string { return fmt.Sprintf("chain_%d_outtx_receipt_%s_%s.json", chainID, coinType, txHash) } diff --git a/zetaclient/tss/tss_signer.go b/zetaclient/tss/tss_signer.go index b95baadf1b..72cc1b30d2 100644 --- a/zetaclient/tss/tss_signer.go +++ b/zetaclient/tss/tss_signer.go @@ -12,6 +12,8 @@ import ( "strings" "time" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/cosmos" appcontext "github.com/zeta-chain/zetacore/zetaclient/app_context" "github.com/zeta-chain/zetacore/zetaclient/interfaces" "github.com/zeta-chain/zetacore/zetaclient/keys" @@ -29,8 +31,6 @@ import ( "github.com/zeta-chain/go-tss/keysign" "github.com/zeta-chain/go-tss/p2p" "github.com/zeta-chain/go-tss/tss" - "github.com/zeta-chain/zetacore/common" - zcommon "github.com/zeta-chain/zetacore/common/cosmos" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/config" "github.com/zeta-chain/zetacore/zetaclient/metrics" @@ -50,7 +50,7 @@ func NewTSSKey(pk string) (*Key, error) { TSSKey := &Key{ PubkeyInBech32: pk, } - pubkey, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, pk) + pubkey, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, pk) if err != nil { log.Error().Err(err).Msgf("GetPubKeyFromBech32 from %s", pk) return nil, fmt.Errorf("GetPubKeyFromBech32: %w", err) @@ -193,7 +193,7 @@ func (tss *TSS) Pubkey() []byte { // Sign signs a digest // digest should be Hashes of some data // NOTE: Specify optionalPubkey to use a different pubkey than the current pubkey set during keygen -func (tss *TSS) Sign(digest []byte, height uint64, nonce uint64, chain *common.Chain, optionalPubKey string) ([65]byte, error) { +func (tss *TSS) Sign(digest []byte, height uint64, nonce uint64, chain *chains.Chain, optionalPubKey string) ([65]byte, error) { H := digest log.Debug().Msgf("hash of digest is %s", H) @@ -263,7 +263,7 @@ func (tss *TSS) Sign(digest []byte, height uint64, nonce uint64, chain *common.C // SignBatch is hash of some data // digest should be batch of hashes of some data -func (tss *TSS) SignBatch(digests [][]byte, height uint64, nonce uint64, chain *common.Chain) ([][65]byte, error) { +func (tss *TSS) SignBatch(digests [][]byte, height uint64, nonce uint64, chain *chains.Chain) ([][65]byte, error) { tssPubkey := tss.CurrentPubkey digestBase64 := make([]string, len(digests)) for i, digest := range digests { @@ -311,7 +311,7 @@ func (tss *TSS) SignBatch(digests [][]byte, height uint64, nonce uint64, chain * // log.Error().Err(err).Msgf("signature verification failure") // return [][65]byte{}, fmt.Errorf("signuature verification fail") //} - pubkey, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) + pubkey, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, tssPubkey) if err != nil { log.Error().Msg("get pubkey from bech32 fail") } @@ -399,7 +399,7 @@ func (tss *TSS) BTCAddressWitnessPubkeyHash() *btcutil.AddressWitnessPubKeyHash } func (tss *TSS) PubKeyCompressedBytes() []byte { - pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tss.CurrentPubkey) + pubk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, tss.CurrentPubkey) if err != nil { log.Error().Err(err).Msg("PubKeyCompressedBytes error") return nil @@ -487,7 +487,7 @@ func GetTssAddrBTC(tssPubkey string, bitcoinChainID int64) (string, error) { func GetTssAddrEVM(tssPubkey string) (ethcommon.Address, error) { var keyAddr ethcommon.Address - pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) + pubk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, tssPubkey) if err != nil { log.Fatal().Err(err) return keyAddr, err @@ -537,7 +537,7 @@ func verifySignature(tssPubkey string, signature []keysign.Signature, H []byte) log.Warn().Msg("verify_signature: empty signature array") return false } - pubkey, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) + pubkey, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, tssPubkey) if err != nil { log.Error().Msg("get pubkey from bech32 fail") } @@ -584,12 +584,12 @@ func wasNodePartOfTss(granteePubKey32 string, granteeList []string) bool { } func getKeyAddrBTCWitnessPubkeyHash(tssPubkey string, chainID int64) (*btcutil.AddressWitnessPubKeyHash, error) { - pubk, err := zcommon.GetPubKeyFromBech32(zcommon.Bech32PubKeyTypeAccPub, tssPubkey) + pubk, err := cosmos.GetPubKeyFromBech32(cosmos.Bech32PubKeyTypeAccPub, tssPubkey) if err != nil { return nil, err } - bitcoinNetParams, err := common.BitcoinNetParamsFromChainID(chainID) + bitcoinNetParams, err := chains.BitcoinNetParamsFromChainID(chainID) if err != nil { return nil, err } diff --git a/zetaclient/tss/tss_signer_test.go b/zetaclient/tss/tss_signer_test.go index d4cc48f7ce..4388fc5ef1 100644 --- a/zetaclient/tss/tss_signer_test.go +++ b/zetaclient/tss/tss_signer_test.go @@ -10,8 +10,8 @@ import ( "github.com/cosmos/cosmos-sdk/testutil/testdata" "github.com/rs/zerolog" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/cosmos" + "github.com/zeta-chain/zetacore/pkg/crypto" ) func Test_LoadTssFilesFromDirectory(t *testing.T) { @@ -63,7 +63,7 @@ func GenerateKeyshareFiles(n int, dir string) error { if err != nil { return err } - pk, err := common.NewPubKey(spk) + pk, err := crypto.NewPubKey(spk) if err != nil { return err } diff --git a/zetaclient/zetabridge/broadcast.go b/zetaclient/zetabridge/broadcast.go index 93de44f3f1..9c1e620474 100644 --- a/zetaclient/zetabridge/broadcast.go +++ b/zetaclient/zetabridge/broadcast.go @@ -20,7 +20,6 @@ import ( rpchttp "github.com/tendermint/tendermint/rpc/client/http" "github.com/zeta-chain/zetacore/app/ante" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common/cosmos" "github.com/zeta-chain/zetacore/zetaclient/hsm" ) @@ -87,7 +86,7 @@ func (b *ZetaCoreBridge) Broadcast(gaslimit uint64, authzWrappedMsg sdktypes.Msg // #nosec G701 always in range fee := sdktypes.NewCoins(sdktypes.NewCoin(config.BaseDenom, - cosmos.NewInt(int64(gaslimit)).Mul(adjustedBaseGasPrice.Ceil().RoundInt()))) + sdktypes.NewInt(int64(gaslimit)).Mul(adjustedBaseGasPrice.Ceil().RoundInt()))) builder.SetFeeAmount(fee) err = b.SignTx(factory, ctx.GetFromName(), builder, true, ctx.TxConfig) if err != nil { diff --git a/zetaclient/zetabridge/query.go b/zetaclient/zetabridge/query.go index c2a8269ed3..218c8494fa 100644 --- a/zetaclient/zetabridge/query.go +++ b/zetaclient/zetabridge/query.go @@ -6,6 +6,8 @@ import ( "sort" "time" + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/proofs" "github.com/zeta-chain/zetacore/zetaclient/interfaces" sdkmath "cosmossdk.io/math" @@ -18,7 +20,6 @@ import ( upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" tmhttp "github.com/tendermint/tendermint/rpc/client/http" "github.com/zeta-chain/zetacore/cmd/zetacored/config" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "google.golang.org/grpc" @@ -193,7 +194,7 @@ func (b *ZetaCoreBridge) GetNodeInfo() (*tmservice.GetNodeInfoResponse, error) { return nil, err } -func (b *ZetaCoreBridge) GetLastBlockHeightByChain(chain common.Chain) (*types.LastBlockHeight, error) { +func (b *ZetaCoreBridge) GetLastBlockHeightByChain(chain chains.Chain) (*types.LastBlockHeight, error) { client := types.NewQueryClient(b.grpcConn) resp, err := client.LastBlockHeight(context.Background(), &types.QueryGetLastBlockHeightRequest{Index: chain.ChainName.String()}) if err != nil { @@ -230,7 +231,7 @@ func (b *ZetaCoreBridge) GetBallotByID(id string) (*observertypes.QueryBallotByI }) } -func (b *ZetaCoreBridge) GetNonceByChain(chain common.Chain) (observertypes.ChainNonces, error) { +func (b *ZetaCoreBridge) GetNonceByChain(chain chains.Chain) (observertypes.ChainNonces, error) { client := observertypes.NewQueryClient(b.grpcConn) resp, err := client.ChainNonces(context.Background(), &observertypes.QueryGetChainNoncesRequest{Index: chain.ChainName.String()}) if err != nil { @@ -322,7 +323,7 @@ func (b *ZetaCoreBridge) GetTssHistory() ([]observertypes.TSS, error) { return resp.TssList, nil } -func (b *ZetaCoreBridge) GetOutTxTracker(chain common.Chain, nonce uint64) (*types.OutTxTracker, error) { +func (b *ZetaCoreBridge) GetOutTxTracker(chain chains.Chain, nonce uint64) (*types.OutTxTracker, error) { client := types.NewQueryClient(b.grpcConn) resp, err := client.OutTxTracker(context.Background(), &types.QueryGetOutTxTrackerRequest{ ChainID: chain.ChainId, @@ -380,7 +381,7 @@ func (b *ZetaCoreBridge) GetBlockHeaderStateByChain(chainID int64) (observertype return *resp, nil } -func (b *ZetaCoreBridge) GetSupportedChains() ([]*common.Chain, error) { +func (b *ZetaCoreBridge) GetSupportedChains() ([]*chains.Chain, error) { client := observertypes.NewQueryClient(b.grpcConn) resp, err := client.SupportedChains(context.Background(), &observertypes.QuerySupportedChains{}) if err != nil { @@ -398,7 +399,7 @@ func (b *ZetaCoreBridge) GetPendingNonces() (*observertypes.QueryAllPendingNonce return resp, nil } -func (b *ZetaCoreBridge) Prove(blockHash string, txHash string, txIndex int64, proof *common.Proof, chainID int64) (bool, error) { +func (b *ZetaCoreBridge) Prove(blockHash string, txHash string, txIndex int64, proof *proofs.Proof, chainID int64) (bool, error) { client := observertypes.NewQueryClient(b.grpcConn) resp, err := client.Prove(context.Background(), &observertypes.QueryProveRequest{ BlockHash: blockHash, diff --git a/zetaclient/zetabridge/tx.go b/zetaclient/zetabridge/tx.go index f1b4d4807a..1c604af4ef 100644 --- a/zetaclient/zetabridge/tx.go +++ b/zetaclient/zetabridge/tx.go @@ -7,6 +7,8 @@ import ( "time" "cosmossdk.io/math" + "github.com/zeta-chain/zetacore/pkg/coin" + "github.com/zeta-chain/zetacore/pkg/proofs" appcontext "github.com/zeta-chain/zetacore/zetaclient/app_context" authz2 "github.com/zeta-chain/zetacore/zetaclient/authz" clientcommon "github.com/zeta-chain/zetacore/zetaclient/common" @@ -15,16 +17,16 @@ import ( "github.com/cosmos/cosmos-sdk/x/authz" "github.com/pkg/errors" "github.com/zeta-chain/go-tss/blame" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/x/crosschain/types" observerTypes "github.com/zeta-chain/zetacore/x/observer/types" ) // GasPriceMultiplier returns the gas price multiplier for the given chain func GasPriceMultiplier(chainID int64) (float64, error) { - if common.IsEVMChain(chainID) { + if chains.IsEVMChain(chainID) { return clientcommon.EVMOuttxGasPriceMultiplier, nil - } else if common.IsBitcoinChain(chainID) { + } else if chains.IsBitcoinChain(chainID) { return clientcommon.BTCOuttxGasPriceMultiplier, nil } return 0, fmt.Errorf("cannot get gas price multiplier for unknown chain %d", chainID) @@ -43,7 +45,7 @@ func (b *ZetaCoreBridge) WrapMessageWithAuthz(msg sdk.Msg) (sdk.Msg, authz2.Sign return &authzMessage, authzSigner, nil } -func (b *ZetaCoreBridge) PostGasPrice(chain common.Chain, gasPrice uint64, supply string, blockNum uint64) (string, error) { +func (b *ZetaCoreBridge) PostGasPrice(chain chains.Chain, gasPrice uint64, supply string, blockNum uint64) (string, error) { // apply gas price multiplier for the chain multiplier, err := GasPriceMultiplier(chain.ChainId) if err != nil { @@ -75,12 +77,12 @@ func (b *ZetaCoreBridge) AddTxHashToOutTxTracker( chainID int64, nonce uint64, txHash string, - proof *common.Proof, + proof *proofs.Proof, blockHash string, txIndex int64, ) (string, error) { // don't report if the tracker already contains the txHash - tracker, err := b.GetOutTxTracker(common.Chain{ChainId: chainID}, nonce) + tracker, err := b.GetOutTxTracker(chains.Chain{ChainId: chainID}, nonce) if err == nil { for _, hash := range tracker.HashList { if strings.EqualFold(hash.TxHash, txHash) { @@ -103,7 +105,7 @@ func (b *ZetaCoreBridge) AddTxHashToOutTxTracker( return zetaTxHash, nil } -func (b *ZetaCoreBridge) SetTSS(tssPubkey string, keyGenZetaHeight int64, status common.ReceiveStatus) (string, error) { +func (b *ZetaCoreBridge) SetTSS(tssPubkey string, keyGenZetaHeight int64, status chains.ReceiveStatus) (string, error) { signerAddress := b.keys.GetOperatorAddress().String() msg := types.NewMsgCreateTSSVoter(signerAddress, tssPubkey, keyGenZetaHeight, status) @@ -171,7 +173,7 @@ func (b *ZetaCoreBridge) PostBlameData(blame *blame.Blame, chainID int64, index return "", fmt.Errorf("post blame data failed after %d retries", DefaultRetryCount) } -func (b *ZetaCoreBridge) PostAddBlockHeader(chainID int64, blockHash []byte, height int64, header common.HeaderData) (string, error) { +func (b *ZetaCoreBridge) PostAddBlockHeader(chainID int64, blockHash []byte, height int64, header proofs.HeaderData) (string, error) { signerAddress := b.keys.GetOperatorAddress().String() msg := observerTypes.NewMsgAddBlockHeader(signerAddress, chainID, blockHash, height, header) @@ -287,10 +289,10 @@ func (b *ZetaCoreBridge) PostVoteOutbound( outTxEffectiveGasPrice *big.Int, outTxEffectiveGasLimit uint64, amount *big.Int, - status common.ReceiveStatus, - chain common.Chain, + status chains.ReceiveStatus, + chain chains.Chain, nonce uint64, - coinType common.CoinType, + coinType coin.CoinType, ) (string, string, error) { signerAddress := b.keys.GetOperatorAddress().String() msg := types.NewMsgVoteOnObservedOutboundTx( @@ -313,7 +315,7 @@ func (b *ZetaCoreBridge) PostVoteOutbound( // the higher gas limit is only necessary when the vote is finalized and the outbound is processed // therefore we use a retryGasLimit with a higher value to resend the tx if it fails (when the vote is finalized) retryGasLimit := uint64(0) - if msg.Status == common.ReceiveStatus_Failed { + if msg.Status == chains.ReceiveStatus_Failed { retryGasLimit = PostVoteOutboundRevertGasLimit } diff --git a/zetaclient/zetabridge/tx_vote_inbound.go b/zetaclient/zetabridge/tx_vote_inbound.go index 0885d84117..43bbd4aaaf 100644 --- a/zetaclient/zetabridge/tx_vote_inbound.go +++ b/zetaclient/zetabridge/tx_vote_inbound.go @@ -2,7 +2,7 @@ package zetabridge import ( "cosmossdk.io/math" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/coin" "github.com/zeta-chain/zetacore/x/crosschain/types" ) @@ -30,7 +30,7 @@ func GetInBoundVoteMessage( inTxHash string, inBlockHeight uint64, gasLimit uint64, - coinType common.CoinType, + coinType coin.CoinType, asset string, signerAddress string, eventIndex uint, diff --git a/zetaclient/zetabridge/zetacore_bridge.go b/zetaclient/zetabridge/zetacore_bridge.go index eef5b9295a..684092c744 100644 --- a/zetaclient/zetabridge/zetacore_bridge.go +++ b/zetaclient/zetabridge/zetacore_bridge.go @@ -7,14 +7,15 @@ import ( "github.com/cosmos/cosmos-sdk/codec" "github.com/cosmos/cosmos-sdk/simapp/params" + sdk "github.com/cosmos/cosmos-sdk/types" authtypes "github.com/cosmos/cosmos-sdk/x/auth/types" banktypes "github.com/cosmos/cosmos-sdk/x/bank/types" "github.com/hashicorp/go-retryablehttp" "github.com/rs/zerolog" "github.com/rs/zerolog/log" "github.com/zeta-chain/zetacore/app" - "github.com/zeta-chain/zetacore/common" - "github.com/zeta-chain/zetacore/common/cosmos" + "github.com/zeta-chain/zetacore/pkg/authz" + "github.com/zeta-chain/zetacore/pkg/chains" crosschaintypes "github.com/zeta-chain/zetacore/x/crosschain/types" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/config" @@ -31,8 +32,8 @@ var _ interfaces.ZetaCoreBridger = &ZetaCoreBridge{} type ZetaCoreBridge struct { logger zerolog.Logger blockHeight int64 - accountNumber map[common.KeyType]uint64 - seqNumber map[common.KeyType]uint64 + accountNumber map[authz.KeyType]uint64 + seqNumber map[authz.KeyType]uint64 grpcConn *grpc.ClientConn httpClient *retryablehttp.Client cfg config.ClientConfiguration @@ -40,7 +41,7 @@ type ZetaCoreBridge struct { keys *keys.Keys broadcastLock *sync.RWMutex zetaChainID string - zetaChain common.Chain + zetaChain chains.Chain stop chan struct{} pause chan struct{} Telemetry *metrics.TelemetryServer @@ -77,14 +78,14 @@ func NewZetaCoreBridge( logger.Error().Err(err).Msg("grpc dial fail") return nil, err } - accountsMap := make(map[common.KeyType]uint64) - seqMap := make(map[common.KeyType]uint64) - for _, keyType := range common.GetAllKeyTypes() { + accountsMap := make(map[authz.KeyType]uint64) + seqMap := make(map[authz.KeyType]uint64) + for _, keyType := range authz.GetAllKeyTypes() { accountsMap[keyType] = 0 seqMap[keyType] = 0 } - zetaChain, err := common.ZetaChainFromChainID(chainID) + zetaChain, err := chains.ZetaChainFromChainID(chainID) if err != nil { return nil, fmt.Errorf("invalid chain id %s, %w", chainID, err) } @@ -112,7 +113,7 @@ func MakeLegacyCodec() *codec.LegacyAmino { cdc := codec.NewLegacyAmino() banktypes.RegisterLegacyAminoCodec(cdc) authtypes.RegisterLegacyAminoCodec(cdc) - cosmos.RegisterCodec(cdc) + sdk.RegisterLegacyAminoCodec(cdc) crosschaintypes.RegisterCodec(cdc) return cdc } @@ -125,7 +126,7 @@ func (b *ZetaCoreBridge) UpdateChainID(chainID string) error { if b.zetaChainID != chainID { b.zetaChainID = chainID - zetaChain, err := common.ZetaChainFromChainID(chainID) + zetaChain, err := chains.ZetaChainFromChainID(chainID) if err != nil { return fmt.Errorf("invalid chain id %s, %w", chainID, err) } @@ -136,7 +137,7 @@ func (b *ZetaCoreBridge) UpdateChainID(chainID string) error { } // ZetaChain returns the ZetaChain chain object -func (b *ZetaCoreBridge) ZetaChain() common.Chain { +func (b *ZetaCoreBridge) ZetaChain() chains.Chain { return b.zetaChain } @@ -146,7 +147,7 @@ func (b *ZetaCoreBridge) Stop() { } // GetAccountNumberAndSequenceNumber We do not use multiple KeyType for now , but this can be optionally used in the future to seprate TSS signer from Zetaclient GRantee -func (b *ZetaCoreBridge) GetAccountNumberAndSequenceNumber(_ common.KeyType) (uint64, uint64, error) { +func (b *ZetaCoreBridge) GetAccountNumberAndSequenceNumber(_ authz.KeyType) (uint64, uint64, error) { ctx, err := b.GetContext() if err != nil { return 0, 0, err @@ -155,7 +156,7 @@ func (b *ZetaCoreBridge) GetAccountNumberAndSequenceNumber(_ common.KeyType) (ui return ctx.AccountRetriever.GetAccountNumberSequence(ctx, address) } -func (b *ZetaCoreBridge) SetAccountNumber(keyType common.KeyType) { +func (b *ZetaCoreBridge) SetAccountNumber(keyType authz.KeyType) { ctx, err := b.GetContext() if err != nil { b.logger.Error().Err(err).Msg("fail to get context") @@ -229,19 +230,19 @@ func (b *ZetaCoreBridge) UpdateZetaCoreContext(coreContext *corecontext.ZetaCore b.logger.Info().Msgf("Chain %d is not supported yet", chainParam.ChainId) continue } - if common.IsBitcoinChain(chainParam.ChainId) { + if chains.IsBitcoinChain(chainParam.ChainId) { newBTCParams = chainParam - } else if common.IsEVMChain(chainParam.ChainId) { + } else if chains.IsEVMChain(chainParam.ChainId) { newEVMParams[chainParam.ChainId] = chainParam } } - chains, err := b.GetSupportedChains() + supporteChains, err := b.GetSupportedChains() if err != nil { return err } - newChains := make([]common.Chain, len(chains)) - for i, chain := range chains { + newChains := make([]chains.Chain, len(supporteChains)) + for i, chain := range supporteChains { newChains[i] = *chain } keyGen, err := b.GetKeyGen() diff --git a/zetaclient/zetacore_observer.go b/zetaclient/zetacore_observer.go index 1307a2bad0..8ec76013a5 100644 --- a/zetaclient/zetacore_observer.go +++ b/zetaclient/zetacore_observer.go @@ -6,6 +6,7 @@ import ( "time" ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/zeta-chain/zetacore/pkg/chains" appcontext "github.com/zeta-chain/zetacore/zetaclient/app_context" "github.com/zeta-chain/zetacore/zetaclient/bitcoin" corecontext "github.com/zeta-chain/zetacore/zetaclient/core_context" @@ -17,7 +18,6 @@ import ( sdkmath "cosmossdk.io/math" "github.com/rs/zerolog" - "github.com/zeta-chain/zetacore/common" "github.com/zeta-chain/zetacore/x/crosschain/types" "github.com/zeta-chain/zetacore/zetaclient/metrics" ) @@ -165,9 +165,9 @@ func (co *CoreObserver) startCctxScheduler(appContext *appcontext.AppContext) { // #nosec G701 range is verified zetaHeight := uint64(bn) - if common.IsEVMChain(c.ChainId) { + if chains.IsEVMChain(c.ChainId) { co.scheduleCctxEVM(outTxMan, zetaHeight, c.ChainId, cctxList, ob, signer) - } else if common.IsBitcoinChain(c.ChainId) { + } else if chains.IsBitcoinChain(c.ChainId) { co.scheduleCctxBTC(outTxMan, zetaHeight, c.ChainId, cctxList, ob, signer) } else { co.logger.ZetaChainWatcher.Error().Msgf("startCctxScheduler: unsupported chain %d", c.ChainId) @@ -332,7 +332,7 @@ func (co *CoreObserver) GetUpdatedSigner(coreContext *corecontext.ZetaCoreContex return nil, fmt.Errorf("signer not found for chainID %d", chainID) } // update EVM signer parameters only. BTC signer doesn't use chain parameters for now. - if common.IsEVMChain(chainID) { + if chains.IsEVMChain(chainID) { evmParams, found := coreContext.GetEVMChainParams(chainID) if found { // update zeta connector and ERC20 custody addresses @@ -361,14 +361,14 @@ func (co *CoreObserver) GetUpdatedChainClient(coreContext *corecontext.ZetaCoreC } // update chain client chain parameters curParams := chainOb.GetChainParams() - if common.IsEVMChain(chainID) { + if chains.IsEVMChain(chainID) { evmParams, found := coreContext.GetEVMChainParams(chainID) if found && !observertypes.ChainParamsEqual(curParams, *evmParams) { chainOb.SetChainParams(*evmParams) co.logger.ZetaChainWatcher.Info().Msgf( "updated chain params for chainID %d, new params: %v", chainID, *evmParams) } - } else if common.IsBitcoinChain(chainID) { + } else if chains.IsBitcoinChain(chainID) { _, btcParams, found := coreContext.GetBTCChainParams() if found && !observertypes.ChainParamsEqual(curParams, *btcParams) { diff --git a/zetaclient/zetacore_observer_test.go b/zetaclient/zetacore_observer_test.go index 004f70af91..56ca752b97 100644 --- a/zetaclient/zetacore_observer_test.go +++ b/zetaclient/zetacore_observer_test.go @@ -7,7 +7,7 @@ import ( ethcommon "github.com/ethereum/go-ethereum/common" "github.com/rs/zerolog" "github.com/stretchr/testify/require" - "github.com/zeta-chain/zetacore/common" + "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/testutil/sample" observertypes "github.com/zeta-chain/zetacore/x/observer/types" "github.com/zeta-chain/zetacore/zetaclient/config" @@ -17,7 +17,7 @@ import ( "github.com/zeta-chain/zetacore/zetaclient/testutils/stub" ) -func MockCoreObserver(t *testing.T, evmChain, btcChain common.Chain, evmChainParams, btcChainParams *observertypes.ChainParams) *CoreObserver { +func MockCoreObserver(t *testing.T, evmChain, btcChain chains.Chain, evmChainParams, btcChainParams *observertypes.ChainParams) *CoreObserver { // create mock signers and clients evmSigner := stub.NewEVMSigner( evmChain, @@ -42,7 +42,7 @@ func MockCoreObserver(t *testing.T, evmChain, btcChain common.Chain, evmChainPar return observer } -func CreateCoreContext(evmChain, btcChain common.Chain, evmChainParams, btcChainParams *observertypes.ChainParams) *corecontext.ZetaCoreContext { +func CreateCoreContext(evmChain, btcChain chains.Chain, evmChainParams, btcChainParams *observertypes.ChainParams) *corecontext.ZetaCoreContext { // new config cfg := config.NewConfig() cfg.EVMChainConfigs[evmChain.ChainId] = config.EVMConfig{ @@ -60,7 +60,7 @@ func CreateCoreContext(evmChain, btcChain common.Chain, evmChainParams, btcChain // feed chain params coreContext.Update( &observertypes.Keygen{}, - []common.Chain{evmChain, btcChain}, + []chains.Chain{evmChain, btcChain}, evmChainParamsMap, btcChainParams, "", @@ -73,8 +73,8 @@ func CreateCoreContext(evmChain, btcChain common.Chain, evmChainParams, btcChain func Test_GetUpdatedSigner(t *testing.T) { // initial parameters for core observer creation - evmChain := common.EthChain() - btcChain := common.BtcMainnetChain() + evmChain := chains.EthChain() + btcChain := chains.BtcMainnetChain() evmChainParams := &observertypes.ChainParams{ ChainId: evmChain.ChainId, ConnectorContractAddress: testutils.ConnectorAddresses[evmChain.ChainId].Hex(), @@ -93,7 +93,7 @@ func Test_GetUpdatedSigner(t *testing.T) { observer := MockCoreObserver(t, evmChain, btcChain, evmChainParams, btcChainParams) coreContext := CreateCoreContext(evmChain, btcChain, evmChainParamsNew, btcChainParams) // BSC signer should not be found - _, err := observer.GetUpdatedSigner(coreContext, common.BscMainnetChain().ChainId) + _, err := observer.GetUpdatedSigner(coreContext, chains.BscMainnetChain().ChainId) require.ErrorContains(t, err, "signer not found") }) t.Run("should be able to update connector and erc20 custody address", func(t *testing.T) { @@ -109,8 +109,8 @@ func Test_GetUpdatedSigner(t *testing.T) { func Test_GetUpdatedChainClient(t *testing.T) { // initial parameters for core observer creation - evmChain := common.EthChain() - btcChain := common.BtcMainnetChain() + evmChain := chains.EthChain() + btcChain := chains.BtcMainnetChain() evmChainParams := &observertypes.ChainParams{ ChainId: evmChain.ChainId, ConnectorContractAddress: testutils.ConnectorAddresses[evmChain.ChainId].Hex(), @@ -158,7 +158,7 @@ func Test_GetUpdatedChainClient(t *testing.T) { observer := MockCoreObserver(t, evmChain, btcChain, evmChainParams, btcChainParams) coreContext := CreateCoreContext(evmChain, btcChain, evmChainParamsNew, btcChainParams) // BSC chain client should not be found - _, err := observer.GetUpdatedChainClient(coreContext, common.BscMainnetChain().ChainId) + _, err := observer.GetUpdatedChainClient(coreContext, chains.BscMainnetChain().ChainId) require.ErrorContains(t, err, "chain client not found") }) t.Run("chain params in evm chain client should be updated successfully", func(t *testing.T) { @@ -174,7 +174,7 @@ func Test_GetUpdatedChainClient(t *testing.T) { observer := MockCoreObserver(t, evmChain, btcChain, evmChainParams, btcChainParams) coreContext := CreateCoreContext(btcChain, btcChain, evmChainParams, btcChainParamsNew) // BTC testnet chain client should not be found - _, err := observer.GetUpdatedChainClient(coreContext, common.BtcTestNetChain().ChainId) + _, err := observer.GetUpdatedChainClient(coreContext, chains.BtcTestNetChain().ChainId) require.ErrorContains(t, err, "chain client not found") }) t.Run("chain params in btc chain client should be updated successfully", func(t *testing.T) {