From 8eadf566f972b5df871b07632a36f8ea6523f1df Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Thu, 30 May 2024 09:59:22 +0200 Subject: [PATCH 1/6] refactor(`observer`): rename `MsgAddBlameVote` to `MsgVoteBlame` (#2290) * rename occurences * do some renaming * make generate * changelog * add breaking change note * remove readme --- app/ante/ante.go | 2 +- app/ante/ante_test.go | 10 +- changelog.md | 2 +- cmd/zetae2e/local/monitor_priority_txs.go | 2 +- docs/cli/zetacored/zetacored_tx_observer.md | 2 +- ...md => zetacored_tx_observer_vote-blame.md} | 8 +- docs/openapi/openapi.swagger.yaml | 4 +- docs/releases/v17_breaking_changes.md | 4 + docs/spec/observer/messages.md | 4 +- proto/zetachain/zetacore/observer/tx.proto | 6 +- testutil/sample/sample.go | 2 +- .../zetachain/zetacore/observer/tx_pb.d.ts | 32 +- x/crosschain/types/authz.go | 2 +- x/crosschain/types/authz_test.go | 2 +- x/observer/client/cli/tx.go | 2 +- ...{tx_add_blame_vote.go => tx_vote_blame.go} | 9 +- ...blame_vote.go => msg_server_vote_blame.go} | 10 +- ..._test.go => msg_server_vote_blame_test.go} | 20 +- x/observer/types/codec.go | 4 +- ...dd_blame_vote.go => message_vote_blame.go} | 22 +- ...ote_test.go => message_vote_blame_test.go} | 36 +-- x/observer/types/tx.pb.go | 282 +++++++++--------- zetaclient/zetacore/tx.go | 2 +- 23 files changed, 236 insertions(+), 233 deletions(-) rename docs/cli/zetacored/{zetacored_tx_observer_add-blame-vote.md => zetacored_tx_observer_vote-blame.md} (94%) rename x/observer/client/cli/{tx_add_blame_vote.go => tx_vote_blame.go} (85%) rename x/observer/keeper/{msg_server_add_blame_vote.go => msg_server_vote_blame.go} (90%) rename x/observer/keeper/{msg_server_add_blame_vote_test.go => msg_server_vote_blame_test.go} (91%) rename x/observer/types/{message_add_blame_vote.go => message_vote_blame.go} (66%) rename x/observer/types/{message_add_blame_vote_test.go => message_vote_blame_test.go} (72%) diff --git a/app/ante/ante.go b/app/ante/ante.go index 48e2b634eb..eee2dd27ec 100644 --- a/app/ante/ante.go +++ b/app/ante/ante.go @@ -176,7 +176,7 @@ func IsSystemTx(tx sdk.Tx, isAuthorizedSigner func(string) bool) bool { *crosschaintypes.MsgAddInboundTracker, *observertypes.MsgVoteBlockHeader, *observertypes.MsgVoteTSS, - *observertypes.MsgAddBlameVote: + *observertypes.MsgVoteBlame: signers := innerMsg.GetSigners() if len(signers) == 1 { return isAuthorizedSigner(signers[0].String()) diff --git a/app/ante/ante_test.go b/app/ante/ante_test.go index da67472dfb..695a680cf3 100644 --- a/app/ante/ante_test.go +++ b/app/ante/ante_test.go @@ -40,7 +40,7 @@ func TestIsSystemTx(t *testing.T) { // *cctxtypes.MsgAddInboundTracker, // *observertypes.MsgVoteBlockHeader, // *observertypes.MsgVoteTSS, - // *observertypes.MsgAddBlameVote: + // *observertypes.MsgVoteBlame: buildTxFromMsg := func(msg sdk.Msg) sdk.Tx { txBuilder := app.MakeEncodingConfig().TxConfig.NewTxBuilder() txBuilder.SetMsgs(msg) @@ -225,8 +225,8 @@ func TestIsSystemTx(t *testing.T) { true, }, { - "MsgAddBlameVote", - buildTxFromMsg(&observertypes.MsgAddBlameVote{ + "MsgVoteBlame", + buildTxFromMsg(&observertypes.MsgVoteBlame{ Creator: sample.AccAddress(), }), isAuthorized, @@ -234,8 +234,8 @@ func TestIsSystemTx(t *testing.T) { true, }, { - "MsgExec{MsgAddBlameVote}", - buildAuthzTxFromMsg(&observertypes.MsgAddBlameVote{ + "MsgExec{MsgVoteBlame}", + buildAuthzTxFromMsg(&observertypes.MsgVoteBlame{ Creator: sample.AccAddress(), }), isAuthorized, diff --git a/changelog.md b/changelog.md index 584d3c2409..f5df72245c 100644 --- a/changelog.md +++ b/changelog.md @@ -33,9 +33,9 @@ * [2205](https://github.com/zeta-chain/node/pull/2205) - remove deprecated variables pre-v17 * [2226](https://github.com/zeta-chain/node/pull/2226) - improve Go formatting with imports standardization and max line length to 120 * [2262](https://github.com/zeta-chain/node/pull/2262) - refactor MsgUpdateZRC20 into MsgPauseZrc20 and MsgUnPauseZRC20 +* [2290](https://github.com/zeta-chain/node/pull/2290) - rename `MsgAddBlameVote` message to `MsgVoteBlame` * [2269](https://github.com/zeta-chain/node/pull/2269) - refactor MsgUpdateCrosschainFlags into MsgEnableCCTX, MsgDisableCCTX and MsgUpdateGasPriceIncreaseFlags - ### Tests * [2047](https://github.com/zeta-chain/node/pull/2047) - fix liquidity cap advanced test diff --git a/cmd/zetae2e/local/monitor_priority_txs.go b/cmd/zetae2e/local/monitor_priority_txs.go index e58cbab513..8fce9dda79 100644 --- a/cmd/zetae2e/local/monitor_priority_txs.go +++ b/cmd/zetae2e/local/monitor_priority_txs.go @@ -97,7 +97,7 @@ func isMsgTypeURLSystemTx(attr types.EventAttribute) bool { "\"/zetachain.zetacore.crosschain.MsgAddInboundTracker\"", "\"/zetachain.zetacore.observer.MsgVoteBlockHeader\"", "\"/zetachain.zetacore.observer.MsgVoteTSS\"", - "\"/zetachain.zetacore.observer.MsgAddBlameVote\"", + "\"/zetachain.zetacore.observer.MsgVoteBlame\"", } for _, url := range systemTxsMsgTypeUrls { diff --git a/docs/cli/zetacored/zetacored_tx_observer.md b/docs/cli/zetacored/zetacored_tx_observer.md index 25711bd3f6..47e7635991 100644 --- a/docs/cli/zetacored/zetacored_tx_observer.md +++ b/docs/cli/zetacored/zetacored_tx_observer.md @@ -26,7 +26,6 @@ zetacored tx observer [flags] ### SEE ALSO * [zetacored tx](zetacored_tx.md) - Transactions subcommands -* [zetacored tx observer add-blame-vote](zetacored_tx_observer_add-blame-vote.md) - Broadcast message add-blame-vote * [zetacored tx observer add-observer](zetacored_tx_observer_add-observer.md) - Broadcast message add-observer * [zetacored tx observer disable-cctx](zetacored_tx_observer_disable-cctx.md) - Disable inbound and outbound for CCTX * [zetacored tx observer enable-cctx](zetacored_tx_observer_enable-cctx.md) - Enable inbound and outbound for CCTX @@ -37,5 +36,6 @@ zetacored tx observer [flags] * [zetacored tx observer update-gas-price-increase-flags](zetacored_tx_observer_update-gas-price-increase-flags.md) - Update the gas price increase flags * [zetacored tx observer update-keygen](zetacored_tx_observer_update-keygen.md) - command to update the keygen block via a group proposal * [zetacored tx observer update-observer](zetacored_tx_observer_update-observer.md) - Broadcast message add-observer +* [zetacored tx observer vote-blame](zetacored_tx_observer_vote-blame.md) - Broadcast message vote-blame * [zetacored tx observer vote-tss](zetacored_tx_observer_vote-tss.md) - Vote for a new TSS creation diff --git a/docs/cli/zetacored/zetacored_tx_observer_add-blame-vote.md b/docs/cli/zetacored/zetacored_tx_observer_vote-blame.md similarity index 94% rename from docs/cli/zetacored/zetacored_tx_observer_add-blame-vote.md rename to docs/cli/zetacored/zetacored_tx_observer_vote-blame.md index 1b2b38e536..299d78d6f7 100644 --- a/docs/cli/zetacored/zetacored_tx_observer_add-blame-vote.md +++ b/docs/cli/zetacored/zetacored_tx_observer_vote-blame.md @@ -1,9 +1,9 @@ -# tx observer add-blame-vote +# tx observer vote-blame -Broadcast message add-blame-vote +Broadcast message vote-blame ``` -zetacored tx observer add-blame-vote [chain-id] [index] [failure-reason] [node-list] [flags] +zetacored tx observer vote-blame [chain-id] [index] [failure-reason] [node-list] [flags] ``` ### Options @@ -22,7 +22,7 @@ zetacored tx observer add-blame-vote [chain-id] [index] [failure-reason] [node-l --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) - -h, --help help for add-blame-vote + -h, --help help for vote-blame --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used --ledger Use a connected Ledger device diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 112be45c71..3a36ef68af 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -57746,8 +57746,6 @@ definitions: last_change_height: type: string format: int64 - observerMsgAddBlameVoteResponse: - type: object observerMsgAddObserverResponse: type: object observerMsgDisableCCTXResponse: @@ -57766,6 +57764,8 @@ definitions: type: object observerMsgUpdateObserverResponse: type: object + observerMsgVoteBlameResponse: + type: object observerMsgVoteBlockHeaderResponse: type: object properties: diff --git a/docs/releases/v17_breaking_changes.md b/docs/releases/v17_breaking_changes.md index 61d5c23921..ebe2d492da 100644 --- a/docs/releases/v17_breaking_changes.md +++ b/docs/releases/v17_breaking_changes.md @@ -58,3 +58,7 @@ * `MsgUpdateZRC20` has been removed, and replaced with `MsgPauseZRC20` and `MsgUnpauseZRC20` messages. * `MsgPauseZRC20` message pauses a ZRC20 token and can be triggered via `PolicyType_groupEmergency` * `MsgUnpauseZRC20` message unpauses a ZRC20 token and can be triggered via `PolicyType_groupOperational` + +### `MsgAddBlameVote` renaming + +* `MsgAddBlameVote` has been renamed to `MsgVoteBlame` to maintain consistency with other voting messages diff --git a/docs/spec/observer/messages.md b/docs/spec/observer/messages.md index 48e0b76de0..045de79551 100644 --- a/docs/spec/observer/messages.md +++ b/docs/spec/observer/messages.md @@ -53,10 +53,10 @@ message MsgRemoveChainParams { } ``` -## MsgAddBlameVote +## MsgVoteBlame ```proto -message MsgAddBlameVote { +message MsgVoteBlame { string creator = 1; int64 chain_id = 2; Blame blame_info = 3; diff --git a/proto/zetachain/zetacore/observer/tx.proto b/proto/zetachain/zetacore/observer/tx.proto index a3a70c6c65..d5ad32e590 100644 --- a/proto/zetachain/zetacore/observer/tx.proto +++ b/proto/zetachain/zetacore/observer/tx.proto @@ -21,7 +21,7 @@ service Msg { returns (MsgUpdateChainParamsResponse); rpc RemoveChainParams(MsgRemoveChainParams) returns (MsgRemoveChainParamsResponse); - rpc AddBlameVote(MsgAddBlameVote) returns (MsgAddBlameVoteResponse); + rpc VoteBlame(MsgVoteBlame) returns (MsgVoteBlameResponse); rpc UpdateKeygen(MsgUpdateKeygen) returns (MsgUpdateKeygenResponse); rpc VoteBlockHeader(MsgVoteBlockHeader) returns (MsgVoteBlockHeaderResponse); rpc ResetChainNonces(MsgResetChainNonces) @@ -77,13 +77,13 @@ message MsgAddObserver { message MsgAddObserverResponse {} -message MsgAddBlameVote { +message MsgVoteBlame { string creator = 1; int64 chain_id = 2; Blame blame_info = 3 [ (gogoproto.nullable) = false ]; } -message MsgAddBlameVoteResponse {} +message MsgVoteBlameResponse {} message MsgUpdateKeygen { string creator = 1; diff --git a/testutil/sample/sample.go b/testutil/sample/sample.go index 431d93337d..bdd7681ee1 100644 --- a/testutil/sample/sample.go +++ b/testutil/sample/sample.go @@ -111,7 +111,7 @@ func AppState(t *testing.T) map[string]json.RawMessage { func GenDoc(t *testing.T) *types.GenesisDoc { jsonBlob := []byte( - "{\n \"genesis_time\": \"2024-04-12T05:07:56.004517Z\",\n \"chain_id\": \"localnet_101-1\",\n \"initial_height\": \"1\",\n \"consensus_params\": {\n \"block\": {\n \"max_bytes\": \"22020096\",\n \"max_gas\": \"10000000\",\n \"time_iota_ms\": \"1000\"\n },\n \"evidence\": {\n \"max_age_num_blocks\": \"100000\",\n \"max_age_duration\": \"172800000000000\",\n \"max_bytes\": \"1048576\"\n },\n \"validator\": {\n \"pub_key_types\": [\n \"ed25519\"\n ]\n },\n \"version\": {}\n },\n \"app_hash\": \"\",\n \"app_state\": {\n \"auth\": {\n \"params\": {\n \"max_memo_characters\": \"256\",\n \"tx_sig_limit\": \"7\",\n \"tx_size_cost_per_byte\": \"10\",\n \"sig_verify_cost_ed25519\": \"590\",\n \"sig_verify_cost_secp256k1\": \"1000\"\n },\n \"accounts\": [\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n }\n ]\n },\n \"authority\": {\n \"policies\": {\n \"items\": [\n {\n \"policy_type\": \"groupEmergency\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": \"groupOperational\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": \"groupAdmin\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n }\n ]\n }\n },\n \"authz\": {\n \"authorization\": [\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteInbound\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOutbound\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddOutboundTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteInbound\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOutbound\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddOutboundTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlameVote\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n }\n ]\n },\n \"bank\": {\n \"params\": {\n \"send_enabled\": [],\n \"default_send_enabled\": true\n },\n \"balances\": [\n {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n }\n ],\n \"supply\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"8402000000000000000000000\"\n }\n ],\n \"denom_metadata\": []\n },\n \"crisis\": {\n \"constant_fee\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000\"\n }\n },\n \"crosschain\": {\n \"outboundTrackerList\": [],\n \"inboundHashToCctxList\": [],\n \"inbound_tracker_list\": [],\n \"zeta_accounting\": {\n \"aborted_zeta_amount\": \"0\"\n }\n },\n \"distribution\": {\n \"params\": {\n \"community_tax\": \"0.020000000000000000\",\n \"base_proposer_reward\": \"0.010000000000000000\",\n \"bonus_proposer_reward\": \"0.040000000000000000\",\n \"withdraw_addr_enabled\": true\n },\n \"fee_pool\": {\n \"community_pool\": []\n },\n \"delegator_withdraw_infos\": [],\n \"previous_proposer\": \"\",\n \"outstanding_rewards\": [],\n \"validator_accumulated_commissions\": [],\n \"validator_historical_rewards\": [],\n \"validator_current_rewards\": [],\n \"delegator_starting_infos\": [],\n \"validator_slash_events\": []\n },\n \"emissions\": {\n \"params\": {\n \"max_bond_factor\": \"1.25\",\n \"min_bond_factor\": \"0.75\",\n \"avg_block_time\": \"6.00\",\n \"target_bond_ratio\": \"00.67\",\n \"validator_emission_percentage\": \"00.50\",\n \"observer_emission_percentage\": \"00.25\",\n \"tss_signer_emission_percentage\": \"00.25\",\n \"duration_factor_constant\": \"0.001877876953694702\",\n \"observer_slash_amount\": \"0\"\n },\n \"withdrawableEmissions\": []\n },\n \"evidence\": {\n \"evidence\": []\n },\n \"evm\": {\n \"accounts\": [],\n \"params\": {\n \"evm_denom\": \"azeta\",\n \"enable_create\": true,\n \"enable_call\": true,\n \"extra_eips\": [],\n \"chain_config\": {\n \"homestead_block\": \"0\",\n \"dao_fork_block\": \"0\",\n \"dao_fork_support\": true,\n \"eip150_block\": \"0\",\n \"eip150_hash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n \"eip155_block\": \"0\",\n \"eip158_block\": \"0\",\n \"byzantium_block\": \"0\",\n \"constantinople_block\": \"0\",\n \"petersburg_block\": \"0\",\n \"istanbul_block\": \"0\",\n \"muir_glacier_block\": \"0\",\n \"berlin_block\": \"0\",\n \"london_block\": \"0\",\n \"arrow_glacier_block\": \"0\",\n \"gray_glacier_block\": \"0\",\n \"merge_netsplit_block\": \"0\",\n \"shanghai_block\": \"0\",\n \"cancun_block\": \"0\"\n },\n \"allow_unprotected_txs\": false\n }\n },\n \"feemarket\": {\n \"params\": {\n \"no_base_fee\": false,\n \"base_fee_change_denominator\": 8,\n \"elasticity_multiplier\": 2,\n \"enable_height\": \"0\",\n \"base_fee\": \"1000000000\",\n \"min_gas_price\": \"0.000000000000000000\",\n \"min_gas_multiplier\": \"0.500000000000000000\"\n },\n \"block_gas\": \"0\"\n },\n \"fungible\": {\n \"params\": {},\n \"foreignCoinsList\": [],\n \"systemContract\": null\n },\n \"genutil\": {\n \"gen_txs\": [\n {\n \"body\": {\n \"messages\": [\n {\n \"@type\": \"/cosmos.staking.v1beta1.MsgCreateValidator\",\n \"description\": {\n \"moniker\": \"Zetanode-Localnet\",\n \"identity\": \"\",\n \"website\": \"\",\n \"security_contact\": \"\",\n \"details\": \"\"\n },\n \"commission\": {\n \"rate\": \"0.100000000000000000\",\n \"max_rate\": \"0.200000000000000000\",\n \"max_change_rate\": \"0.010000000000000000\"\n },\n \"min_self_delegation\": \"1\",\n \"delegator_address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"validator_address\": \"zetavaloper13c7p3xrhd6q2rx3h235jpt8pjdwvacyw7tkass\",\n \"pubkey\": {\n \"@type\": \"/cosmos.crypto.ed25519.PubKey\",\n \"key\": \"sBSs5r1vQn1idTp4uRTbdUK0jjmEscI3pn88LUXI4CQ=\"\n },\n \"value\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n }\n ],\n \"memo\": \"1db4f4185e68c1c17d508294de2592616dad37a5@192.168.2.12:26656\",\n \"timeout_height\": \"0\",\n \"extension_options\": [],\n \"non_critical_extension_options\": []\n },\n \"auth_info\": {\n \"signer_infos\": [\n {\n \"public_key\": {\n \"@type\": \"/cosmos.crypto.secp256k1.PubKey\",\n \"key\": \"A05F6QuFVpb/5KrIPvlHr209ZsD22gW0omhLSXWAtQrh\"\n },\n \"mode_info\": {\n \"single\": {\n \"mode\": \"SIGN_MODE_DIRECT\"\n }\n },\n \"sequence\": \"0\"\n }\n ],\n \"fee\": {\n \"amount\": [],\n \"gas_limit\": \"200000\",\n \"payer\": \"\",\n \"granter\": \"\"\n },\n \"tip\": null\n },\n \"signatures\": [\n \"y5YROwZmV0jcgv5BgRJCDE+Kq5OsX8+88or1ogekPLBw3ecPt8GsCeEbPQ24JONLzNwQEIUDNYTeSQnXnCfzyg==\"\n ]\n }\n ]\n },\n \"gov\": {\n \"starting_proposal_id\": \"1\",\n \"deposits\": [],\n \"votes\": [],\n \"proposals\": [],\n \"deposit_params\": {\n \"min_deposit\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"10000000\"\n }\n ],\n \"max_deposit_period\": \"172800s\"\n },\n \"voting_params\": {\n \"voting_period\": \"10s\"\n },\n \"tally_params\": {\n \"quorum\": \"0.334000000000000000\",\n \"threshold\": \"0.500000000000000000\",\n \"veto_threshold\": \"0.334000000000000000\"\n }\n },\n \"group\": {\n \"group_seq\": \"0\",\n \"groups\": [],\n \"group_members\": [],\n \"group_policy_seq\": \"0\",\n \"group_policies\": [],\n \"proposal_seq\": \"0\",\n \"proposals\": [],\n \"votes\": []\n },\n \"mint\": {\n \"params\": {\n \"mint_denom\": \"azeta\"\n }\n },\n \"observer\": {\n \"observers\": {\n \"observer_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"nodeAccountList\": [\n {\n \"operator\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"granteeAddress\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\"\n },\n \"nodeStatus\": 4\n },\n {\n \"operator\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"granteeAddress\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n },\n \"nodeStatus\": 4\n }\n ],\n \"crosschain_flags\": {\n \"isInboundEnabled\": true,\n \"isOutboundEnabled\": true\n },\n \"keygen\": {\n \"status\": 1,\n \"granteePubkeys\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ]\n },\n \"chain_params_list\": {},\n \"tss\": {\n \"tss_pubkey\": \"zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p\",\n \"tss_participant_list\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ],\n \"operator_address_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"tss_history\": [],\n \"tss_fund_migrators\": [],\n \"blame_list\": [],\n \"pending_nonces\": [],\n \"chain_nonces\": [],\n \"nonce_to_cctx\": []\n },\n \"params\": null,\n \"slashing\": {\n \"params\": {\n \"signed_blocks_window\": \"100\",\n \"min_signed_per_window\": \"0.500000000000000000\",\n \"downtime_jail_duration\": \"600s\",\n \"slash_fraction_double_sign\": \"0.050000000000000000\",\n \"slash_fraction_downtime\": \"0.010000000000000000\"\n },\n \"signing_infos\": [],\n \"missed_blocks\": []\n },\n \"staking\": {\n \"params\": {\n \"unbonding_time\": \"1814400s\",\n \"max_validators\": 100,\n \"max_entries\": 7,\n \"historical_entries\": 10000,\n \"bond_denom\": \"azeta\",\n \"min_commission_rate\": \"0.000000000000000000\"\n },\n \"last_total_power\": \"0\",\n \"last_validator_powers\": [],\n \"validators\": [],\n \"delegations\": [],\n \"unbonding_delegations\": [],\n \"redelegations\": [],\n \"exported\": false\n },\n \"upgrade\": {},\n \"vesting\": {}\n }\n }", + "{\n \"genesis_time\": \"2024-04-12T05:07:56.004517Z\",\n \"chain_id\": \"localnet_101-1\",\n \"initial_height\": \"1\",\n \"consensus_params\": {\n \"block\": {\n \"max_bytes\": \"22020096\",\n \"max_gas\": \"10000000\",\n \"time_iota_ms\": \"1000\"\n },\n \"evidence\": {\n \"max_age_num_blocks\": \"100000\",\n \"max_age_duration\": \"172800000000000\",\n \"max_bytes\": \"1048576\"\n },\n \"validator\": {\n \"pub_key_types\": [\n \"ed25519\"\n ]\n },\n \"version\": {}\n },\n \"app_hash\": \"\",\n \"app_state\": {\n \"auth\": {\n \"params\": {\n \"max_memo_characters\": \"256\",\n \"tx_sig_limit\": \"7\",\n \"tx_size_cost_per_byte\": \"10\",\n \"sig_verify_cost_ed25519\": \"590\",\n \"sig_verify_cost_secp256k1\": \"1000\"\n },\n \"accounts\": [\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n },\n {\n \"@type\": \"/ethermint.types.v1.EthAccount\",\n \"base_account\": {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"pub_key\": null,\n \"account_number\": \"0\",\n \"sequence\": \"0\"\n },\n \"code_hash\": \"0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470\"\n }\n ]\n },\n \"authority\": {\n \"policies\": {\n \"items\": [\n {\n \"policy_type\": \"groupEmergency\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": \"groupOperational\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n },\n {\n \"policy_type\": \"groupAdmin\",\n \"address\": \"zeta1afk9zr2hn2jsac63h4hm60vl9z3e5u69gndzf7c99cqge3vzwjzsxn0x73\"\n }\n ]\n }\n },\n \"authz\": {\n \"authorization\": [\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteInbound\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOutbound\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddOutboundTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgVoteBlame\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"grantee\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgGasPriceVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteInbound\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgVoteOutbound\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgCreateTSSVoter\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.crosschain.MsgAddOutboundTracker\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgVoteBlame\"\n },\n \"expiration\": null\n },\n {\n \"granter\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"grantee\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"authorization\": {\n \"@type\": \"/cosmos.authz.v1beta1.GenericAuthorization\",\n \"msg\": \"/zetachain.zetacore.observer.MsgAddBlockHeader\"\n },\n \"expiration\": null\n }\n ]\n },\n \"bank\": {\n \"params\": {\n \"send_enabled\": [],\n \"default_send_enabled\": true\n },\n \"balances\": [\n {\n \"address\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"4200000000000000000000000\"\n }\n ]\n },\n {\n \"address\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"coins\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n ]\n }\n ],\n \"supply\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"8402000000000000000000000\"\n }\n ],\n \"denom_metadata\": []\n },\n \"crisis\": {\n \"constant_fee\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000\"\n }\n },\n \"crosschain\": {\n \"outboundTrackerList\": [],\n \"inboundHashToCctxList\": [],\n \"inbound_tracker_list\": [],\n \"zeta_accounting\": {\n \"aborted_zeta_amount\": \"0\"\n }\n },\n \"distribution\": {\n \"params\": {\n \"community_tax\": \"0.020000000000000000\",\n \"base_proposer_reward\": \"0.010000000000000000\",\n \"bonus_proposer_reward\": \"0.040000000000000000\",\n \"withdraw_addr_enabled\": true\n },\n \"fee_pool\": {\n \"community_pool\": []\n },\n \"delegator_withdraw_infos\": [],\n \"previous_proposer\": \"\",\n \"outstanding_rewards\": [],\n \"validator_accumulated_commissions\": [],\n \"validator_historical_rewards\": [],\n \"validator_current_rewards\": [],\n \"delegator_starting_infos\": [],\n \"validator_slash_events\": []\n },\n \"emissions\": {\n \"params\": {\n \"max_bond_factor\": \"1.25\",\n \"min_bond_factor\": \"0.75\",\n \"avg_block_time\": \"6.00\",\n \"target_bond_ratio\": \"00.67\",\n \"validator_emission_percentage\": \"00.50\",\n \"observer_emission_percentage\": \"00.25\",\n \"tss_signer_emission_percentage\": \"00.25\",\n \"duration_factor_constant\": \"0.001877876953694702\",\n \"observer_slash_amount\": \"0\"\n },\n \"withdrawableEmissions\": []\n },\n \"evidence\": {\n \"evidence\": []\n },\n \"evm\": {\n \"accounts\": [],\n \"params\": {\n \"evm_denom\": \"azeta\",\n \"enable_create\": true,\n \"enable_call\": true,\n \"extra_eips\": [],\n \"chain_config\": {\n \"homestead_block\": \"0\",\n \"dao_fork_block\": \"0\",\n \"dao_fork_support\": true,\n \"eip150_block\": \"0\",\n \"eip150_hash\": \"0x0000000000000000000000000000000000000000000000000000000000000000\",\n \"eip155_block\": \"0\",\n \"eip158_block\": \"0\",\n \"byzantium_block\": \"0\",\n \"constantinople_block\": \"0\",\n \"petersburg_block\": \"0\",\n \"istanbul_block\": \"0\",\n \"muir_glacier_block\": \"0\",\n \"berlin_block\": \"0\",\n \"london_block\": \"0\",\n \"arrow_glacier_block\": \"0\",\n \"gray_glacier_block\": \"0\",\n \"merge_netsplit_block\": \"0\",\n \"shanghai_block\": \"0\",\n \"cancun_block\": \"0\"\n },\n \"allow_unprotected_txs\": false\n }\n },\n \"feemarket\": {\n \"params\": {\n \"no_base_fee\": false,\n \"base_fee_change_denominator\": 8,\n \"elasticity_multiplier\": 2,\n \"enable_height\": \"0\",\n \"base_fee\": \"1000000000\",\n \"min_gas_price\": \"0.000000000000000000\",\n \"min_gas_multiplier\": \"0.500000000000000000\"\n },\n \"block_gas\": \"0\"\n },\n \"fungible\": {\n \"params\": {},\n \"foreignCoinsList\": [],\n \"systemContract\": null\n },\n \"genutil\": {\n \"gen_txs\": [\n {\n \"body\": {\n \"messages\": [\n {\n \"@type\": \"/cosmos.staking.v1beta1.MsgCreateValidator\",\n \"description\": {\n \"moniker\": \"Zetanode-Localnet\",\n \"identity\": \"\",\n \"website\": \"\",\n \"security_contact\": \"\",\n \"details\": \"\"\n },\n \"commission\": {\n \"rate\": \"0.100000000000000000\",\n \"max_rate\": \"0.200000000000000000\",\n \"max_change_rate\": \"0.010000000000000000\"\n },\n \"min_self_delegation\": \"1\",\n \"delegator_address\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"validator_address\": \"zetavaloper13c7p3xrhd6q2rx3h235jpt8pjdwvacyw7tkass\",\n \"pubkey\": {\n \"@type\": \"/cosmos.crypto.ed25519.PubKey\",\n \"key\": \"sBSs5r1vQn1idTp4uRTbdUK0jjmEscI3pn88LUXI4CQ=\"\n },\n \"value\": {\n \"denom\": \"azeta\",\n \"amount\": \"1000000000000000000000\"\n }\n }\n ],\n \"memo\": \"1db4f4185e68c1c17d508294de2592616dad37a5@192.168.2.12:26656\",\n \"timeout_height\": \"0\",\n \"extension_options\": [],\n \"non_critical_extension_options\": []\n },\n \"auth_info\": {\n \"signer_infos\": [\n {\n \"public_key\": {\n \"@type\": \"/cosmos.crypto.secp256k1.PubKey\",\n \"key\": \"A05F6QuFVpb/5KrIPvlHr209ZsD22gW0omhLSXWAtQrh\"\n },\n \"mode_info\": {\n \"single\": {\n \"mode\": \"SIGN_MODE_DIRECT\"\n }\n },\n \"sequence\": \"0\"\n }\n ],\n \"fee\": {\n \"amount\": [],\n \"gas_limit\": \"200000\",\n \"payer\": \"\",\n \"granter\": \"\"\n },\n \"tip\": null\n },\n \"signatures\": [\n \"y5YROwZmV0jcgv5BgRJCDE+Kq5OsX8+88or1ogekPLBw3ecPt8GsCeEbPQ24JONLzNwQEIUDNYTeSQnXnCfzyg==\"\n ]\n }\n ]\n },\n \"gov\": {\n \"starting_proposal_id\": \"1\",\n \"deposits\": [],\n \"votes\": [],\n \"proposals\": [],\n \"deposit_params\": {\n \"min_deposit\": [\n {\n \"denom\": \"azeta\",\n \"amount\": \"10000000\"\n }\n ],\n \"max_deposit_period\": \"172800s\"\n },\n \"voting_params\": {\n \"voting_period\": \"10s\"\n },\n \"tally_params\": {\n \"quorum\": \"0.334000000000000000\",\n \"threshold\": \"0.500000000000000000\",\n \"veto_threshold\": \"0.334000000000000000\"\n }\n },\n \"group\": {\n \"group_seq\": \"0\",\n \"groups\": [],\n \"group_members\": [],\n \"group_policy_seq\": \"0\",\n \"group_policies\": [],\n \"proposal_seq\": \"0\",\n \"proposals\": [],\n \"votes\": []\n },\n \"mint\": {\n \"params\": {\n \"mint_denom\": \"azeta\"\n }\n },\n \"observer\": {\n \"observers\": {\n \"observer_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"nodeAccountList\": [\n {\n \"operator\": \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"granteeAddress\": \"zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\"\n },\n \"nodeStatus\": 4\n },\n {\n \"operator\": \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\",\n \"granteeAddress\": \"zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx\",\n \"granteePubkey\": {\n \"secp256k1\": \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n },\n \"nodeStatus\": 4\n }\n ],\n \"crosschain_flags\": {\n \"isInboundEnabled\": true,\n \"isOutboundEnabled\": true\n },\n \"keygen\": {\n \"status\": 1,\n \"granteePubkeys\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ]\n },\n \"chain_params_list\": {},\n \"tss\": {\n \"tss_pubkey\": \"zetapub1addwnpepq28c57cvcs0a2htsem5zxr6qnlvq9mzhmm76z3jncsnzz32rclangr2g35p\",\n \"tss_participant_list\": [\n \"zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp\",\n \"zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045\"\n ],\n \"operator_address_list\": [\n \"zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax\",\n \"zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2\"\n ]\n },\n \"tss_history\": [],\n \"tss_fund_migrators\": [],\n \"blame_list\": [],\n \"pending_nonces\": [],\n \"chain_nonces\": [],\n \"nonce_to_cctx\": []\n },\n \"params\": null,\n \"slashing\": {\n \"params\": {\n \"signed_blocks_window\": \"100\",\n \"min_signed_per_window\": \"0.500000000000000000\",\n \"downtime_jail_duration\": \"600s\",\n \"slash_fraction_double_sign\": \"0.050000000000000000\",\n \"slash_fraction_downtime\": \"0.010000000000000000\"\n },\n \"signing_infos\": [],\n \"missed_blocks\": []\n },\n \"staking\": {\n \"params\": {\n \"unbonding_time\": \"1814400s\",\n \"max_validators\": 100,\n \"max_entries\": 7,\n \"historical_entries\": 10000,\n \"bond_denom\": \"azeta\",\n \"min_commission_rate\": \"0.000000000000000000\"\n },\n \"last_total_power\": \"0\",\n \"last_validator_powers\": [],\n \"validators\": [],\n \"delegations\": [],\n \"unbonding_delegations\": [],\n \"redelegations\": [],\n \"exported\": false\n },\n \"upgrade\": {},\n \"vesting\": {}\n }\n }", ) genDoc, err := types.GenesisDocFromJSON(jsonBlob) require.NoError(t, err) diff --git a/typescript/zetachain/zetacore/observer/tx_pb.d.ts b/typescript/zetachain/zetacore/observer/tx_pb.d.ts index 4b270f371d..dd02737886 100644 --- a/typescript/zetachain/zetacore/observer/tx_pb.d.ts +++ b/typescript/zetachain/zetacore/observer/tx_pb.d.ts @@ -298,9 +298,9 @@ export declare class MsgAddObserverResponse extends Message { +export declare class MsgVoteBlame extends Message { /** * @generated from field: string creator = 1; */ @@ -316,38 +316,38 @@ export declare class MsgAddBlameVote extends Message { */ blameInfo?: Blame; - constructor(data?: PartialMessage); + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.observer.MsgAddBlameVote"; + static readonly typeName = "zetachain.zetacore.observer.MsgVoteBlame"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): MsgAddBlameVote; + static fromBinary(bytes: Uint8Array, options?: Partial): MsgVoteBlame; - static fromJson(jsonValue: JsonValue, options?: Partial): MsgAddBlameVote; + static fromJson(jsonValue: JsonValue, options?: Partial): MsgVoteBlame; - static fromJsonString(jsonString: string, options?: Partial): MsgAddBlameVote; + static fromJsonString(jsonString: string, options?: Partial): MsgVoteBlame; - static equals(a: MsgAddBlameVote | PlainMessage | undefined, b: MsgAddBlameVote | PlainMessage | undefined): boolean; + static equals(a: MsgVoteBlame | PlainMessage | undefined, b: MsgVoteBlame | PlainMessage | undefined): boolean; } /** - * @generated from message zetachain.zetacore.observer.MsgAddBlameVoteResponse + * @generated from message zetachain.zetacore.observer.MsgVoteBlameResponse */ -export declare class MsgAddBlameVoteResponse extends Message { - constructor(data?: PartialMessage); +export declare class MsgVoteBlameResponse extends Message { + constructor(data?: PartialMessage); static readonly runtime: typeof proto3; - static readonly typeName = "zetachain.zetacore.observer.MsgAddBlameVoteResponse"; + static readonly typeName = "zetachain.zetacore.observer.MsgVoteBlameResponse"; static readonly fields: FieldList; - static fromBinary(bytes: Uint8Array, options?: Partial): MsgAddBlameVoteResponse; + static fromBinary(bytes: Uint8Array, options?: Partial): MsgVoteBlameResponse; - static fromJson(jsonValue: JsonValue, options?: Partial): MsgAddBlameVoteResponse; + static fromJson(jsonValue: JsonValue, options?: Partial): MsgVoteBlameResponse; - static fromJsonString(jsonString: string, options?: Partial): MsgAddBlameVoteResponse; + static fromJsonString(jsonString: string, options?: Partial): MsgVoteBlameResponse; - static equals(a: MsgAddBlameVoteResponse | PlainMessage | undefined, b: MsgAddBlameVoteResponse | PlainMessage | undefined): boolean; + static equals(a: MsgVoteBlameResponse | PlainMessage | undefined, b: MsgVoteBlameResponse | PlainMessage | undefined): boolean; } /** diff --git a/x/crosschain/types/authz.go b/x/crosschain/types/authz.go index 8750b41fb3..75528388ca 100644 --- a/x/crosschain/types/authz.go +++ b/x/crosschain/types/authz.go @@ -14,7 +14,7 @@ func GetAllAuthzZetaclientTxTypes() []string { sdk.MsgTypeURL(&MsgVoteOutbound{}), sdk.MsgTypeURL(&MsgAddOutboundTracker{}), sdk.MsgTypeURL(&observertypes.MsgVoteTSS{}), - sdk.MsgTypeURL(&observertypes.MsgAddBlameVote{}), + sdk.MsgTypeURL(&observertypes.MsgVoteBlame{}), sdk.MsgTypeURL(&observertypes.MsgVoteBlockHeader{}), } } diff --git a/x/crosschain/types/authz_test.go b/x/crosschain/types/authz_test.go index 615b2a775c..67b809a360 100644 --- a/x/crosschain/types/authz_test.go +++ b/x/crosschain/types/authz_test.go @@ -14,7 +14,7 @@ func TestGetAllAuthzZetaclientTxTypes(t *testing.T) { "/zetachain.zetacore.crosschain.MsgVoteOutbound", "/zetachain.zetacore.crosschain.MsgAddOutboundTracker", "/zetachain.zetacore.observer.MsgVoteTSS", - "/zetachain.zetacore.observer.MsgAddBlameVote", + "/zetachain.zetacore.observer.MsgVoteBlame", "/zetachain.zetacore.observer.MsgVoteBlockHeader"}, crosschaintypes.GetAllAuthzZetaclientTxTypes()) } diff --git a/x/observer/client/cli/tx.go b/x/observer/client/cli/tx.go index 78569fb753..815bfb21f8 100644 --- a/x/observer/client/cli/tx.go +++ b/x/observer/client/cli/tx.go @@ -24,7 +24,7 @@ func GetTxCmd() *cobra.Command { CmdUpdateChainParams(), CmdRemoveChainParams(), CmdUpdateKeygen(), - CmdAddBlameVote(), + CmdVoteBlame(), CmdUpdateObserver(), CmdEncode(), CmdResetChainNonces(), diff --git a/x/observer/client/cli/tx_add_blame_vote.go b/x/observer/client/cli/tx_vote_blame.go similarity index 85% rename from x/observer/client/cli/tx_add_blame_vote.go rename to x/observer/client/cli/tx_vote_blame.go index d15b056875..4dec44f845 100644 --- a/x/observer/client/cli/tx_add_blame_vote.go +++ b/x/observer/client/cli/tx_vote_blame.go @@ -17,10 +17,10 @@ import ( "github.com/zeta-chain/zetacore/x/observer/types" ) -func CmdAddBlameVote() *cobra.Command { +func CmdVoteBlame() *cobra.Command { cmd := &cobra.Command{ - Use: "add-blame-vote [chain-id] [index] [failure-reason] [node-list]", - Short: "Broadcast message add-blame-vote", + Use: "vote-blame [chain-id] [index] [failure-reason] [node-list]", + Short: "Broadcast message vote-blame", Args: cobra.ExactArgs(4), RunE: func(cmd *cobra.Command, args []string) (err error) { chainID, err := strconv.Atoi(args[0]) @@ -55,9 +55,8 @@ func CmdAddBlameVote() *cobra.Command { Nodes: blameNodes, } - msg := types.NewMsgAddBlameVoteMsg(clientCtx.GetFromAddress().String(), int64(chainID), blameInfo) + msg := types.NewMsgVoteBlameMsg(clientCtx.GetFromAddress().String(), int64(chainID), blameInfo) - println("about to broadcast") return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) }, } diff --git a/x/observer/keeper/msg_server_add_blame_vote.go b/x/observer/keeper/msg_server_vote_blame.go similarity index 90% rename from x/observer/keeper/msg_server_add_blame_vote.go rename to x/observer/keeper/msg_server_vote_blame.go index fec760dda8..395b2fa9c1 100644 --- a/x/observer/keeper/msg_server_add_blame_vote.go +++ b/x/observer/keeper/msg_server_vote_blame.go @@ -11,10 +11,10 @@ import ( "github.com/zeta-chain/zetacore/x/observer/types" ) -func (k msgServer) AddBlameVote( +func (k msgServer) VoteBlame( goCtx context.Context, - vote *types.MsgAddBlameVote, -) (*types.MsgAddBlameVoteResponse, error) { + vote *types.MsgVoteBlame, +) (*types.MsgVoteBlameResponse, error) { ctx := sdk.UnwrapSDKContext(goCtx) observationType := types.ObservationType_TSSKeySign @@ -52,7 +52,7 @@ func (k msgServer) AddBlameVote( _, isFinalized := k.CheckIfFinalizingVote(ctx, ballot) if !isFinalized { // Return nil here to add vote to ballot and commit state - return &types.MsgAddBlameVoteResponse{}, nil + return &types.MsgVoteBlameResponse{}, nil } // ****************************************************************************** @@ -60,5 +60,5 @@ func (k msgServer) AddBlameVote( // ****************************************************************************** k.SetBlame(ctx, vote.BlameInfo) - return &types.MsgAddBlameVoteResponse{}, nil + return &types.MsgVoteBlameResponse{}, nil } diff --git a/x/observer/keeper/msg_server_add_blame_vote_test.go b/x/observer/keeper/msg_server_vote_blame_test.go similarity index 91% rename from x/observer/keeper/msg_server_add_blame_vote_test.go rename to x/observer/keeper/msg_server_vote_blame_test.go index 8150e57517..c051c56fd6 100644 --- a/x/observer/keeper/msg_server_add_blame_vote_test.go +++ b/x/observer/keeper/msg_server_vote_blame_test.go @@ -15,12 +15,12 @@ import ( "github.com/zeta-chain/zetacore/x/observer/types" ) -func TestMsgServer_AddBlameVote(t *testing.T) { +func TestMsgServer_VoteBlame(t *testing.T) { t.Run("should error if supported chain not found", func(t *testing.T) { k, ctx, _, _ := keepertest.ObserverKeeper(t) srv := keeper.NewMsgServerImpl(*k) - res, err := srv.AddBlameVote(ctx, &types.MsgAddBlameVote{ + res, err := srv.VoteBlame(ctx, &types.MsgVoteBlame{ ChainId: 1, }) require.Error(t, err) @@ -34,7 +34,7 @@ func TestMsgServer_AddBlameVote(t *testing.T) { chainId := getValidEthChainIDWithIndex(t, 0) setSupportedChain(ctx, *k, chainId) - res, err := srv.AddBlameVote(ctx, &types.MsgAddBlameVote{ + res, err := srv.VoteBlame(ctx, &types.MsgVoteBlame{ ChainId: chainId, }) require.Error(t, err) @@ -70,13 +70,13 @@ func TestMsgServer_AddBlameVote(t *testing.T) { }) blameInfo := sample.BlameRecord(t, "index") - res, err := srv.AddBlameVote(ctx, &types.MsgAddBlameVote{ + res, err := srv.VoteBlame(ctx, &types.MsgVoteBlame{ Creator: accAddressOfValidator.String(), ChainId: chainId, BlameInfo: blameInfo, }) require.NoError(t, err) - require.Equal(t, &types.MsgAddBlameVoteResponse{}, res) + require.Equal(t, &types.MsgVoteBlameResponse{}, res) blame, found := k.GetBlame(ctx, blameInfo.Index) require.True(t, found) @@ -111,7 +111,7 @@ func TestMsgServer_AddBlameVote(t *testing.T) { ObserverList: []string{accAddressOfValidator.String(), "Observer2"}, }) blameInfo := sample.BlameRecord(t, "index") - vote := &types.MsgAddBlameVote{ + vote := &types.MsgVoteBlame{ Creator: accAddressOfValidator.String(), ChainId: chainId, BlameInfo: blameInfo, @@ -126,7 +126,7 @@ func TestMsgServer_AddBlameVote(t *testing.T) { } k.SetBallot(ctx, &ballot) - _, err = srv.AddBlameVote(ctx, vote) + _, err = srv.VoteBlame(ctx, vote) require.Error(t, err) }) @@ -158,7 +158,7 @@ func TestMsgServer_AddBlameVote(t *testing.T) { ObserverList: []string{accAddressOfValidator.String(), "Observer2"}, }) blameInfo := sample.BlameRecord(t, "index") - vote := &types.MsgAddBlameVote{ + vote := &types.MsgVoteBlame{ Creator: accAddressOfValidator.String(), ChainId: chainId, BlameInfo: blameInfo, @@ -173,9 +173,9 @@ func TestMsgServer_AddBlameVote(t *testing.T) { } k.SetBallot(ctx, &ballot) - res, err := srv.AddBlameVote(ctx, vote) + res, err := srv.VoteBlame(ctx, vote) require.NoError(t, err) - require.Equal(t, &types.MsgAddBlameVoteResponse{}, res) + require.Equal(t, &types.MsgVoteBlameResponse{}, res) _, found := k.GetBlame(ctx, blameInfo.Index) require.False(t, found) diff --git a/x/observer/types/codec.go b/x/observer/types/codec.go index 9db4078a11..778caed484 100644 --- a/x/observer/types/codec.go +++ b/x/observer/types/codec.go @@ -12,7 +12,7 @@ func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgUpdateChainParams{}, "observer/UpdateChainParams", nil) cdc.RegisterConcrete(&MsgRemoveChainParams{}, "observer/RemoveChainParams", nil) cdc.RegisterConcrete(&MsgVoteBlockHeader{}, "observer/VoteBlockHeader", nil) - cdc.RegisterConcrete(&MsgAddBlameVote{}, "observer/AddBlameVote", nil) + cdc.RegisterConcrete(&MsgVoteBlame{}, "observer/VoteBlame", nil) cdc.RegisterConcrete(&MsgUpdateKeygen{}, "observer/UpdateKeygen", nil) cdc.RegisterConcrete(&MsgUpdateObserver{}, "observer/UpdateObserver", nil) cdc.RegisterConcrete(&MsgResetChainNonces{}, "observer/ResetChainNonces", nil) @@ -27,7 +27,7 @@ func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { &MsgAddObserver{}, &MsgUpdateChainParams{}, &MsgRemoveChainParams{}, - &MsgAddBlameVote{}, + &MsgVoteBlame{}, &MsgUpdateKeygen{}, &MsgVoteBlockHeader{}, &MsgUpdateObserver{}, diff --git a/x/observer/types/message_add_blame_vote.go b/x/observer/types/message_vote_blame.go similarity index 66% rename from x/observer/types/message_add_blame_vote.go rename to x/observer/types/message_vote_blame.go index cbbc922291..2a06e84869 100644 --- a/x/observer/types/message_add_blame_vote.go +++ b/x/observer/types/message_vote_blame.go @@ -9,27 +9,27 @@ import ( "github.com/zeta-chain/zetacore/pkg/chains" ) -const TypeMsgAddBlameVote = "add_blame_vote" +const TypeMsgVoteBlame = "vote_blame" -var _ sdk.Msg = &MsgAddBlameVote{} +var _ sdk.Msg = &MsgVoteBlame{} -func NewMsgAddBlameVoteMsg(creator string, chainID int64, blameInfo Blame) *MsgAddBlameVote { - return &MsgAddBlameVote{ +func NewMsgVoteBlameMsg(creator string, chainID int64, blameInfo Blame) *MsgVoteBlame { + return &MsgVoteBlame{ Creator: creator, ChainId: chainID, BlameInfo: blameInfo, } } -func (m *MsgAddBlameVote) Route() string { +func (m *MsgVoteBlame) Route() string { return RouterKey } -func (m *MsgAddBlameVote) Type() string { - return TypeMsgAddBlameVote +func (m *MsgVoteBlame) Type() string { + return TypeMsgVoteBlame } -func (m *MsgAddBlameVote) ValidateBasic() error { +func (m *MsgVoteBlame) ValidateBasic() error { _, err := sdk.AccAddressFromBech32(m.Creator) if err != nil { return cosmoserrors.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) @@ -40,7 +40,7 @@ func (m *MsgAddBlameVote) ValidateBasic() error { return nil } -func (m *MsgAddBlameVote) GetSigners() []sdk.AccAddress { +func (m *MsgVoteBlame) GetSigners() []sdk.AccAddress { creator, err := sdk.AccAddressFromBech32(m.Creator) if err != nil { panic(err) @@ -48,12 +48,12 @@ func (m *MsgAddBlameVote) GetSigners() []sdk.AccAddress { return []sdk.AccAddress{creator} } -func (m *MsgAddBlameVote) GetSignBytes() []byte { +func (m *MsgVoteBlame) GetSignBytes() []byte { bz := ModuleCdc.MustMarshalJSON(m) return sdk.MustSortJSON(bz) } -func (m *MsgAddBlameVote) Digest() string { +func (m *MsgVoteBlame) Digest() string { msg := *m msg.Creator = "" // Generate an Identifier for the ballot corresponding to specific blame data diff --git a/x/observer/types/message_add_blame_vote_test.go b/x/observer/types/message_vote_blame_test.go similarity index 72% rename from x/observer/types/message_add_blame_vote_test.go rename to x/observer/types/message_vote_blame_test.go index e7d3178090..9514beac40 100644 --- a/x/observer/types/message_add_blame_vote_test.go +++ b/x/observer/types/message_vote_blame_test.go @@ -12,16 +12,16 @@ import ( "github.com/zeta-chain/zetacore/x/observer/types" ) -func TestNewMsgAddBlameVoteMsg_ValidateBasic(t *testing.T) { +func TestNewMsgVoteBlameMsg_ValidateBasic(t *testing.T) { keeper.SetConfig(false) tests := []struct { name string - msg *types.MsgAddBlameVote + msg *types.MsgVoteBlame error bool }{ { name: "invalid creator", - msg: types.NewMsgAddBlameVoteMsg( + msg: types.NewMsgVoteBlameMsg( "invalid_address", 1, sample.BlameRecordsList(t, 1)[0], @@ -30,7 +30,7 @@ func TestNewMsgAddBlameVoteMsg_ValidateBasic(t *testing.T) { }, { name: "invalid chain id", - msg: types.NewMsgAddBlameVoteMsg( + msg: types.NewMsgVoteBlameMsg( sample.AccAddress(), -1, sample.BlameRecordsList(t, 1)[0], @@ -39,7 +39,7 @@ func TestNewMsgAddBlameVoteMsg_ValidateBasic(t *testing.T) { }, { name: "valid", - msg: types.NewMsgAddBlameVoteMsg( + msg: types.NewMsgVoteBlameMsg( sample.AccAddress(), 5, sample.BlameRecordsList(t, 1)[0], @@ -61,23 +61,23 @@ func TestNewMsgAddBlameVoteMsg_ValidateBasic(t *testing.T) { } } -func TestNewMsgAddBlameVoteMsg_GetSigners(t *testing.T) { +func TestNewMsgVoteBlameMsg_GetSigners(t *testing.T) { signer := sample.AccAddress() tests := []struct { name string - msg types.MsgAddBlameVote + msg types.MsgVoteBlame panics bool }{ { name: "valid signer", - msg: types.MsgAddBlameVote{ + msg: types.MsgVoteBlame{ Creator: signer, }, panics: false, }, { name: "invalid signer", - msg: types.MsgAddBlameVote{ + msg: types.MsgVoteBlame{ Creator: "invalid", }, panics: true, @@ -98,22 +98,22 @@ func TestNewMsgAddBlameVoteMsg_GetSigners(t *testing.T) { } } -func TestNewMsgAddBlameVoteMsg_Type(t *testing.T) { - msg := types.MsgAddBlameVote{ +func TestNewMsgVoteBlameMsg_Type(t *testing.T) { + msg := types.MsgVoteBlame{ Creator: sample.AccAddress(), } - require.Equal(t, types.TypeMsgAddBlameVote, msg.Type()) + require.Equal(t, types.TypeMsgVoteBlame, msg.Type()) } -func TestNewMsgAddBlameVoteMsg_Route(t *testing.T) { - msg := types.MsgAddBlameVote{ +func TestNewMsgVoteBlameMsg_Route(t *testing.T) { + msg := types.MsgVoteBlame{ Creator: sample.AccAddress(), } require.Equal(t, types.RouterKey, msg.Route()) } -func TestNewMsgAddBlameVoteMsg_GetSignBytes(t *testing.T) { - msg := types.MsgAddBlameVote{ +func TestNewMsgVoteBlameMsg_GetSignBytes(t *testing.T) { + msg := types.MsgVoteBlame{ Creator: sample.AccAddress(), } require.NotPanics(t, func() { @@ -121,8 +121,8 @@ func TestNewMsgAddBlameVoteMsg_GetSignBytes(t *testing.T) { }) } -func TestNewMsgAddBlameVoteMsg_Digest(t *testing.T) { - msg := types.MsgAddBlameVote{ +func TestNewMsgVoteBlameMsg_Digest(t *testing.T) { + msg := types.MsgVoteBlame{ Creator: sample.AccAddress(), } diff --git a/x/observer/types/tx.pb.go b/x/observer/types/tx.pb.go index cc79b9c3c2..a0328fa65d 100644 --- a/x/observer/types/tx.pb.go +++ b/x/observer/types/tx.pb.go @@ -542,24 +542,24 @@ func (m *MsgAddObserverResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgAddObserverResponse proto.InternalMessageInfo -type MsgAddBlameVote struct { +type MsgVoteBlame 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"` BlameInfo Blame `protobuf:"bytes,3,opt,name=blame_info,json=blameInfo,proto3" json:"blame_info"` } -func (m *MsgAddBlameVote) Reset() { *m = MsgAddBlameVote{} } -func (m *MsgAddBlameVote) String() string { return proto.CompactTextString(m) } -func (*MsgAddBlameVote) ProtoMessage() {} -func (*MsgAddBlameVote) Descriptor() ([]byte, []int) { +func (m *MsgVoteBlame) Reset() { *m = MsgVoteBlame{} } +func (m *MsgVoteBlame) String() string { return proto.CompactTextString(m) } +func (*MsgVoteBlame) ProtoMessage() {} +func (*MsgVoteBlame) Descriptor() ([]byte, []int) { return fileDescriptor_eda6e3b1d16a4021, []int{10} } -func (m *MsgAddBlameVote) XXX_Unmarshal(b []byte) error { +func (m *MsgVoteBlame) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgAddBlameVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgVoteBlame) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgAddBlameVote.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgVoteBlame.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -569,54 +569,54 @@ func (m *MsgAddBlameVote) XXX_Marshal(b []byte, deterministic bool) ([]byte, err return b[:n], nil } } -func (m *MsgAddBlameVote) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddBlameVote.Merge(m, src) +func (m *MsgVoteBlame) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVoteBlame.Merge(m, src) } -func (m *MsgAddBlameVote) XXX_Size() int { +func (m *MsgVoteBlame) XXX_Size() int { return m.Size() } -func (m *MsgAddBlameVote) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddBlameVote.DiscardUnknown(m) +func (m *MsgVoteBlame) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVoteBlame.DiscardUnknown(m) } -var xxx_messageInfo_MsgAddBlameVote proto.InternalMessageInfo +var xxx_messageInfo_MsgVoteBlame proto.InternalMessageInfo -func (m *MsgAddBlameVote) GetCreator() string { +func (m *MsgVoteBlame) GetCreator() string { if m != nil { return m.Creator } return "" } -func (m *MsgAddBlameVote) GetChainId() int64 { +func (m *MsgVoteBlame) GetChainId() int64 { if m != nil { return m.ChainId } return 0 } -func (m *MsgAddBlameVote) GetBlameInfo() Blame { +func (m *MsgVoteBlame) GetBlameInfo() Blame { if m != nil { return m.BlameInfo } return Blame{} } -type MsgAddBlameVoteResponse struct { +type MsgVoteBlameResponse struct { } -func (m *MsgAddBlameVoteResponse) Reset() { *m = MsgAddBlameVoteResponse{} } -func (m *MsgAddBlameVoteResponse) String() string { return proto.CompactTextString(m) } -func (*MsgAddBlameVoteResponse) ProtoMessage() {} -func (*MsgAddBlameVoteResponse) Descriptor() ([]byte, []int) { +func (m *MsgVoteBlameResponse) Reset() { *m = MsgVoteBlameResponse{} } +func (m *MsgVoteBlameResponse) String() string { return proto.CompactTextString(m) } +func (*MsgVoteBlameResponse) ProtoMessage() {} +func (*MsgVoteBlameResponse) Descriptor() ([]byte, []int) { return fileDescriptor_eda6e3b1d16a4021, []int{11} } -func (m *MsgAddBlameVoteResponse) XXX_Unmarshal(b []byte) error { +func (m *MsgVoteBlameResponse) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) } -func (m *MsgAddBlameVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { +func (m *MsgVoteBlameResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { if deterministic { - return xxx_messageInfo_MsgAddBlameVoteResponse.Marshal(b, m, deterministic) + return xxx_messageInfo_MsgVoteBlameResponse.Marshal(b, m, deterministic) } else { b = b[:cap(b)] n, err := m.MarshalToSizedBuffer(b) @@ -626,17 +626,17 @@ func (m *MsgAddBlameVoteResponse) XXX_Marshal(b []byte, deterministic bool) ([]b return b[:n], nil } } -func (m *MsgAddBlameVoteResponse) XXX_Merge(src proto.Message) { - xxx_messageInfo_MsgAddBlameVoteResponse.Merge(m, src) +func (m *MsgVoteBlameResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgVoteBlameResponse.Merge(m, src) } -func (m *MsgAddBlameVoteResponse) XXX_Size() int { +func (m *MsgVoteBlameResponse) XXX_Size() int { return m.Size() } -func (m *MsgAddBlameVoteResponse) XXX_DiscardUnknown() { - xxx_messageInfo_MsgAddBlameVoteResponse.DiscardUnknown(m) +func (m *MsgVoteBlameResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgVoteBlameResponse.DiscardUnknown(m) } -var xxx_messageInfo_MsgAddBlameVoteResponse proto.InternalMessageInfo +var xxx_messageInfo_MsgVoteBlameResponse proto.InternalMessageInfo type MsgUpdateKeygen struct { Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` @@ -1251,8 +1251,8 @@ func init() { proto.RegisterType((*MsgRemoveChainParamsResponse)(nil), "zetachain.zetacore.observer.MsgRemoveChainParamsResponse") proto.RegisterType((*MsgAddObserver)(nil), "zetachain.zetacore.observer.MsgAddObserver") proto.RegisterType((*MsgAddObserverResponse)(nil), "zetachain.zetacore.observer.MsgAddObserverResponse") - proto.RegisterType((*MsgAddBlameVote)(nil), "zetachain.zetacore.observer.MsgAddBlameVote") - proto.RegisterType((*MsgAddBlameVoteResponse)(nil), "zetachain.zetacore.observer.MsgAddBlameVoteResponse") + proto.RegisterType((*MsgVoteBlame)(nil), "zetachain.zetacore.observer.MsgVoteBlame") + proto.RegisterType((*MsgVoteBlameResponse)(nil), "zetachain.zetacore.observer.MsgVoteBlameResponse") proto.RegisterType((*MsgUpdateKeygen)(nil), "zetachain.zetacore.observer.MsgUpdateKeygen") proto.RegisterType((*MsgUpdateKeygenResponse)(nil), "zetachain.zetacore.observer.MsgUpdateKeygenResponse") proto.RegisterType((*MsgResetChainNonces)(nil), "zetachain.zetacore.observer.MsgResetChainNonces") @@ -1272,86 +1272,86 @@ func init() { } var fileDescriptor_eda6e3b1d16a4021 = []byte{ - // 1257 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4b, 0x6f, 0xdb, 0x46, - 0x10, 0x36, 0xeb, 0xc4, 0x8f, 0x91, 0x25, 0x3b, 0xac, 0x1d, 0xcb, 0x74, 0xad, 0x1a, 0x44, 0xe2, - 0x28, 0xa9, 0x2b, 0xd9, 0x4a, 0xd1, 0xe7, 0xc9, 0x8f, 0xc6, 0x76, 0x53, 0xc7, 0x06, 0xe5, 0x06, - 0x45, 0x2e, 0xc4, 0x8a, 0x5c, 0x53, 0xac, 0xe9, 0x5d, 0x81, 0x4b, 0xf9, 0x91, 0x06, 0x05, 0x7a, - 0xec, 0xa9, 0xfd, 0x01, 0x05, 0x7a, 0xef, 0x3f, 0xe8, 0xb9, 0x3d, 0xa4, 0xb7, 0x1c, 0x7b, 0x2a, - 0x0a, 0xfb, 0xd4, 0x7f, 0x51, 0x70, 0x77, 0x49, 0x53, 0x0f, 0x53, 0x52, 0x8a, 0x9c, 0x24, 0xce, - 0x7e, 0xdf, 0xcc, 0x37, 0xbb, 0xb3, 0x33, 0x24, 0xdc, 0x79, 0x8e, 0x03, 0x64, 0xd5, 0x91, 0x4b, - 0xca, 0xfc, 0x1f, 0xf5, 0x71, 0x99, 0xd6, 0x18, 0xf6, 0x4f, 0xb0, 0x5f, 0x0e, 0xce, 0x4a, 0x0d, - 0x9f, 0x06, 0x54, 0x9d, 0x8f, 0x51, 0xa5, 0x08, 0x55, 0x8a, 0x50, 0xda, 0xb4, 0x43, 0x1d, 0xca, - 0x71, 0xe5, 0xf0, 0x9f, 0xa0, 0x68, 0xf7, 0xd2, 0x1c, 0xd7, 0x3c, 0x74, 0x8c, 0x25, 0xb0, 0x92, - 0x06, 0xb4, 0x7c, 0xca, 0x18, 0x5f, 0x34, 0x0f, 0x3d, 0xe4, 0x30, 0xc9, 0x79, 0x90, 0xc6, 0x89, - 0xfe, 0x48, 0x6c, 0x31, 0x0d, 0xdb, 0x40, 0x3e, 0x3a, 0x8e, 0xbc, 0xae, 0xa4, 0x22, 0x31, 0xb1, - 0x5d, 0xe2, 0x98, 0x84, 0x12, 0x0b, 0x47, 0x8c, 0xbb, 0xa9, 0xbb, 0xc7, 0xd2, 0xe4, 0x36, 0x8e, - 0x9c, 0x32, 0x37, 0x31, 0xf9, 0xd3, 0x03, 0xdb, 0xf0, 0x29, 0x3d, 0x64, 0xf2, 0x47, 0x60, 0xf5, - 0x7f, 0x15, 0xb8, 0xb5, 0xcb, 0x9c, 0xaf, 0x1a, 0x36, 0x0a, 0xf0, 0x9e, 0x8c, 0xab, 0xe6, 0x61, - 0xd4, 0xf2, 0x31, 0x0a, 0xa8, 0x9f, 0x57, 0x16, 0x95, 0xe2, 0xb8, 0x11, 0x3d, 0xaa, 0x2b, 0x30, - 0x4d, 0x3d, 0xdb, 0x8c, 0x14, 0x9a, 0xc8, 0xb6, 0x7d, 0xcc, 0x58, 0xfe, 0x2d, 0x0e, 0x53, 0xa9, - 0x67, 0x47, 0x4e, 0xd6, 0xc4, 0x4a, 0xc8, 0x20, 0xf8, 0xb4, 0x93, 0x31, 0x2c, 0x18, 0x04, 0x9f, - 0xb6, 0x33, 0x9e, 0x42, 0xb6, 0xc9, 0xf5, 0x98, 0x3e, 0x46, 0x8c, 0x92, 0xfc, 0x8d, 0x45, 0xa5, - 0x98, 0xab, 0xac, 0x96, 0x52, 0x4a, 0xa8, 0x14, 0x39, 0x11, 0x99, 0x18, 0x9c, 0x68, 0x4c, 0x34, - 0x13, 0x4f, 0xfa, 0x3c, 0xcc, 0x75, 0xa4, 0x6a, 0x60, 0xd6, 0xa0, 0x84, 0x61, 0xfd, 0x4f, 0x05, - 0xd4, 0x5d, 0xe6, 0x3c, 0xa5, 0x01, 0x5e, 0xf7, 0xa8, 0x75, 0xb4, 0x8d, 0x91, 0x9d, 0xba, 0x13, - 0x73, 0x30, 0x26, 0xaa, 0xca, 0xb5, 0x79, 0xf6, 0xc3, 0xc6, 0x28, 0x7f, 0xde, 0xb1, 0xd5, 0x05, - 0x80, 0x5a, 0xe8, 0xc3, 0xac, 0x23, 0x56, 0xe7, 0x89, 0x4e, 0x18, 0xe3, 0xdc, 0xb2, 0x8d, 0x58, - 0x5d, 0xbd, 0x0d, 0x23, 0x75, 0xec, 0x3a, 0xf5, 0x80, 0x27, 0x36, 0x6c, 0xc8, 0x27, 0x75, 0x2b, - 0xb4, 0x87, 0x51, 0xf3, 0x37, 0x17, 0x95, 0x62, 0xa6, 0x72, 0xbf, 0x5b, 0xc2, 0x8d, 0x23, 0xa7, - 0x24, 0x4f, 0x50, 0x48, 0xdc, 0x44, 0x01, 0x5a, 0xbf, 0xf1, 0xf2, 0xef, 0x77, 0x87, 0x0c, 0x49, - 0xd7, 0xbf, 0x01, 0xad, 0x33, 0x95, 0x28, 0x53, 0xf5, 0x2e, 0xe4, 0x6a, 0xc8, 0xf3, 0x68, 0x60, - 0xf2, 0x54, 0xb0, 0xcd, 0x33, 0x1b, 0x33, 0xb2, 0xc2, 0xba, 0x21, 0x8c, 0x21, 0xec, 0x84, 0x06, - 0xd8, 0x3c, 0x74, 0x09, 0xf2, 0xdc, 0xe7, 0x58, 0x64, 0x39, 0x66, 0x64, 0x43, 0xeb, 0xa3, 0xc8, - 0xa8, 0xbf, 0x80, 0xe9, 0x78, 0x53, 0x37, 0x42, 0xa9, 0xfb, 0xfc, 0x3e, 0xa4, 0x6c, 0xdc, 0x17, - 0x90, 0xb1, 0xae, 0x80, 0xdc, 0x6b, 0xa6, 0x52, 0x4c, 0x3d, 0xdc, 0x84, 0x63, 0x23, 0x49, 0xd6, - 0x0b, 0xf0, 0x4e, 0xb7, 0xe8, 0xf1, 0xa9, 0x3e, 0xe6, 0xea, 0x0c, 0x7c, 0x4c, 0x4f, 0xfa, 0x54, - 0x77, 0xfd, 0xb1, 0xca, 0x60, 0x1d, 0xce, 0xe2, 0x60, 0x7f, 0x28, 0x90, 0xdb, 0x65, 0xce, 0x9a, - 0x6d, 0xf7, 0x71, 0x91, 0xee, 0xc3, 0xd4, 0x35, 0x97, 0x68, 0x92, 0xb6, 0xdd, 0x87, 0x4f, 0x61, - 0x8e, 0x6f, 0x89, 0xe7, 0x62, 0x12, 0x98, 0x8e, 0x8f, 0x48, 0x80, 0xb1, 0xd9, 0x68, 0xd6, 0x8e, - 0xf0, 0xb9, 0xbc, 0x46, 0xb3, 0x57, 0x80, 0x2d, 0xb1, 0xbe, 0xcf, 0x97, 0xd5, 0x55, 0x98, 0x41, - 0xb6, 0x6d, 0x12, 0x6a, 0x63, 0x13, 0x59, 0x16, 0x6d, 0x92, 0xc0, 0xa4, 0xc4, 0x3b, 0xe7, 0xa5, - 0x37, 0x66, 0xa8, 0xc8, 0xb6, 0x9f, 0x50, 0x1b, 0xaf, 0x89, 0xa5, 0x3d, 0xe2, 0x9d, 0xeb, 0x79, - 0xb8, 0xdd, 0x9a, 0x45, 0x9c, 0xe0, 0x8f, 0x0a, 0x4c, 0x8a, 0xa5, 0xf5, 0xb0, 0xfb, 0x86, 0x05, - 0xf6, 0x7a, 0x17, 0x64, 0x2b, 0xbc, 0x20, 0xe8, 0x18, 0x9b, 0x2e, 0x39, 0xa4, 0x3c, 0x85, 0x4c, - 0x45, 0x4f, 0xad, 0x00, 0x1e, 0x50, 0x96, 0xf9, 0x38, 0xe7, 0xee, 0x90, 0x43, 0xaa, 0xcf, 0xc1, - 0x6c, 0x9b, 0xa0, 0x58, 0xec, 0x1a, 0xd7, 0x2a, 0x4a, 0xe3, 0x31, 0x3e, 0x77, 0x30, 0x49, 0xd1, - 0x3a, 0x0d, 0x37, 0xf9, 0xfd, 0x94, 0x42, 0xc5, 0x83, 0xf4, 0x9e, 0x74, 0x11, 0x7b, 0xff, 0x59, - 0x81, 0xb7, 0x79, 0x31, 0x30, 0x1c, 0xf0, 0x5a, 0x78, 0xc2, 0x9b, 0xfa, 0xeb, 0x6d, 0xc7, 0x12, - 0x4c, 0x8a, 0x25, 0x3e, 0x19, 0x4c, 0x8f, 0x9e, 0xf2, 0x3d, 0x19, 0x36, 0xb2, 0x56, 0xec, 0xfa, - 0x4b, 0x7a, 0xaa, 0x16, 0x61, 0x2a, 0x89, 0xab, 0xbb, 0x4e, 0x5d, 0xb6, 0x90, 0xdc, 0x15, 0x70, - 0xdb, 0x75, 0xea, 0xfa, 0x02, 0xcc, 0x77, 0x51, 0x17, 0xab, 0xff, 0x4d, 0x01, 0x90, 0x1d, 0xe2, - 0xa0, 0x5a, 0x4d, 0x11, 0xbd, 0x00, 0x10, 0x30, 0x16, 0xd5, 0x9a, 0xa8, 0xcf, 0xf1, 0x80, 0x31, - 0x59, 0x5d, 0xcb, 0xa0, 0x1e, 0xf1, 0x7d, 0x31, 0xc3, 0x13, 0x33, 0x65, 0x57, 0x13, 0xda, 0xa7, - 0xc4, 0xca, 0x33, 0x1c, 0xa0, 0x6d, 0xd1, 0xdf, 0x36, 0x61, 0x84, 0x05, 0x28, 0x68, 0x32, 0xd9, - 0xd0, 0x97, 0xaf, 0xeb, 0x6f, 0x72, 0x9a, 0x19, 0xd8, 0xc2, 0xee, 0x09, 0xae, 0x72, 0x8e, 0x21, - 0xb9, 0xfa, 0x0f, 0x57, 0x8d, 0xfa, 0xa0, 0x5a, 0x7d, 0x33, 0x5d, 0x2d, 0x84, 0xc9, 0xc4, 0x58, - 0xd3, 0xb2, 0xa2, 0x71, 0x35, 0x66, 0x64, 0x85, 0xb5, 0x2a, 0x8c, 0xfa, 0x29, 0x64, 0x77, 0x99, - 0xf3, 0x39, 0x41, 0x35, 0x0f, 0x6f, 0x6c, 0x1c, 0x7c, 0x9d, 0xb2, 0x93, 0x77, 0x20, 0x8b, 0x39, - 0x6e, 0x87, 0xd4, 0x68, 0x93, 0xc4, 0x71, 0x5b, 0x8c, 0xea, 0x12, 0xe4, 0x84, 0x61, 0xaf, 0x19, - 0x08, 0x98, 0x88, 0xdb, 0x66, 0xd5, 0x67, 0x61, 0xa6, 0x25, 0x70, 0x7c, 0xb2, 0x2f, 0x78, 0x0b, - 0xda, 0x74, 0x59, 0x1f, 0x92, 0x96, 0x20, 0x67, 0x0b, 0x60, 0xab, 0xa6, 0x36, 0xab, 0x5a, 0x84, - 0x49, 0x69, 0x69, 0x53, 0xd5, 0x6e, 0x96, 0xad, 0x23, 0x11, 0x3d, 0xd6, 0xf5, 0xab, 0x02, 0x85, - 0xf8, 0x2e, 0x6d, 0x21, 0xb6, 0xef, 0xbb, 0x16, 0xde, 0x21, 0xa1, 0x14, 0x86, 0x1f, 0x85, 0xef, - 0x65, 0x29, 0x42, 0x09, 0xcc, 0x38, 0xdd, 0x28, 0x72, 0x76, 0x54, 0x52, 0x3b, 0x47, 0xd7, 0x60, - 0xb2, 0x93, 0x74, 0x77, 0xab, 0x17, 0x61, 0x29, 0x5d, 0x6b, 0x94, 0x56, 0xe5, 0xf7, 0x0c, 0x0c, - 0xef, 0x32, 0x47, 0xa5, 0x90, 0x49, 0xb6, 0xfd, 0xf7, 0x52, 0x15, 0xb5, 0x76, 0x57, 0xed, 0xe1, - 0x00, 0xe0, 0xb8, 0xdc, 0xcf, 0x20, 0xd7, 0xf6, 0xce, 0x56, 0xea, 0xe5, 0xa6, 0x15, 0xaf, 0x7d, - 0x38, 0x18, 0x3e, 0x8e, 0xfc, 0xbd, 0x02, 0xb7, 0x3a, 0xc7, 0xfd, 0x6a, 0x7f, 0xde, 0x12, 0x14, - 0xed, 0x93, 0x81, 0x29, 0x2d, 0x1a, 0x3a, 0x87, 0x7a, 0x4f, 0x0d, 0x1d, 0x94, 0xde, 0x1a, 0xae, - 0x9d, 0xf6, 0xaa, 0x0f, 0x13, 0x2d, 0x83, 0x70, 0xb9, 0x8f, 0x63, 0x8c, 0xd1, 0xda, 0x07, 0x83, - 0xa0, 0x93, 0x31, 0x5b, 0x06, 0xda, 0x72, 0x7f, 0x5b, 0x28, 0xd0, 0xbd, 0x63, 0x76, 0x9b, 0x74, - 0xea, 0xb7, 0x30, 0xd9, 0xfe, 0x52, 0x5c, 0xee, 0xe5, 0xa8, 0x8d, 0xa0, 0x7d, 0x34, 0x20, 0x21, - 0x0e, 0xfe, 0x1d, 0x4c, 0x75, 0x8c, 0xd8, 0x95, 0xde, 0x67, 0xd6, 0xca, 0xd0, 0x3e, 0x1e, 0x94, - 0x11, 0xc7, 0xb7, 0x60, 0x34, 0x1a, 0x92, 0xf7, 0xfa, 0xc9, 0xe1, 0xa0, 0x5a, 0xd5, 0xca, 0x7d, - 0x02, 0xe3, 0x20, 0x1e, 0x40, 0x62, 0x84, 0x3c, 0xe8, 0x45, 0xbf, 0xc2, 0x6a, 0x95, 0xfe, 0xb1, - 0x71, 0x34, 0x0a, 0x99, 0xe4, 0x78, 0xe8, 0xd9, 0xaa, 0x12, 0xe0, 0xde, 0xad, 0xaa, 0x4b, 0xeb, - 0x57, 0x7f, 0x51, 0x60, 0x3e, 0xad, 0xef, 0x7f, 0xd6, 0x5f, 0x59, 0x76, 0x25, 0x6b, 0x1b, 0xff, - 0x83, 0x1c, 0x29, 0x5c, 0xdf, 0x79, 0x79, 0x51, 0x50, 0x5e, 0x5d, 0x14, 0x94, 0x7f, 0x2e, 0x0a, - 0xca, 0x4f, 0x97, 0x85, 0xa1, 0x57, 0x97, 0x85, 0xa1, 0xbf, 0x2e, 0x0b, 0x43, 0xcf, 0xca, 0x8e, - 0x1b, 0xd4, 0x9b, 0xb5, 0x92, 0x45, 0x8f, 0xf9, 0xb7, 0xf4, 0xfb, 0x6d, 0x9f, 0xd5, 0x67, 0x89, - 0x6f, 0xf5, 0xf3, 0x06, 0x66, 0xb5, 0x11, 0xfe, 0x59, 0xfd, 0xf0, 0xbf, 0x00, 0x00, 0x00, 0xff, - 0xff, 0xd6, 0x91, 0x58, 0xd4, 0x15, 0x11, 0x00, 0x00, + // 1258 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4b, 0x6f, 0xdb, 0xc6, + 0x13, 0x37, 0xff, 0xce, 0xc3, 0x1e, 0x59, 0xb2, 0xc3, 0xbf, 0x93, 0xc8, 0x74, 0xa3, 0x06, 0x44, + 0xe2, 0x28, 0x69, 0x2a, 0xd9, 0x4a, 0xd1, 0xe7, 0xc9, 0x8f, 0xc6, 0x76, 0x53, 0xc7, 0x06, 0xe5, + 0x06, 0x45, 0x2e, 0xc4, 0x8a, 0x5c, 0x53, 0xac, 0xa9, 0x5d, 0x81, 0x4b, 0xf9, 0x91, 0x06, 0x05, + 0x7a, 0x2c, 0xd0, 0x43, 0x3f, 0x40, 0x81, 0xde, 0xfb, 0x0d, 0xda, 0x73, 0x0f, 0xe9, 0x2d, 0xc7, + 0x9e, 0x8a, 0xc2, 0x3e, 0xf5, 0x5b, 0x14, 0xdc, 0x5d, 0xae, 0x9e, 0xa6, 0xa4, 0x14, 0x3d, 0x49, + 0x9c, 0xfd, 0xfd, 0x66, 0x7e, 0xb3, 0x3b, 0x3b, 0x43, 0xc2, 0x9d, 0x17, 0x38, 0x42, 0x4e, 0x1d, + 0xf9, 0xa4, 0xcc, 0xff, 0xd1, 0x10, 0x97, 0x69, 0x8d, 0xe1, 0xf0, 0x08, 0x87, 0xe5, 0xe8, 0xa4, + 0xd4, 0x0c, 0x69, 0x44, 0xf5, 0x45, 0x85, 0x2a, 0x25, 0xa8, 0x52, 0x82, 0x32, 0xe6, 0x3d, 0xea, + 0x51, 0x8e, 0x2b, 0xc7, 0xff, 0x04, 0xc5, 0xb8, 0x97, 0xe6, 0xb8, 0x16, 0xa0, 0x06, 0x96, 0xc0, + 0x4a, 0x1a, 0xd0, 0x09, 0x29, 0x63, 0x7c, 0xd1, 0x3e, 0x08, 0x90, 0xc7, 0x24, 0xe7, 0x41, 0x1a, + 0x27, 0xf9, 0x23, 0xb1, 0xc5, 0x34, 0x6c, 0x13, 0x85, 0xa8, 0x91, 0x78, 0x5d, 0x4e, 0x45, 0x62, + 0xe2, 0xfa, 0xc4, 0xb3, 0x09, 0x25, 0x0e, 0x4e, 0x18, 0x77, 0x53, 0x77, 0x8f, 0xa5, 0xc9, 0x6d, + 0x1e, 0x7a, 0x65, 0x6e, 0x62, 0xf2, 0x67, 0x08, 0xb6, 0x19, 0x52, 0x7a, 0xc0, 0xe4, 0x8f, 0xc0, + 0x9a, 0x7f, 0x6b, 0x70, 0x6d, 0x87, 0x79, 0x5f, 0x34, 0x5d, 0x14, 0xe1, 0x5d, 0x19, 0x57, 0xcf, + 0xc3, 0x55, 0x27, 0xc4, 0x28, 0xa2, 0x61, 0x5e, 0xbb, 0xad, 0x15, 0xa7, 0xad, 0xe4, 0x51, 0x5f, + 0x86, 0x79, 0x1a, 0xb8, 0x76, 0xa2, 0xd0, 0x46, 0xae, 0x1b, 0x62, 0xc6, 0xf2, 0xff, 0xe3, 0x30, + 0x9d, 0x06, 0x6e, 0xe2, 0x64, 0x55, 0xac, 0xc4, 0x0c, 0x82, 0x8f, 0xfb, 0x19, 0x93, 0x82, 0x41, + 0xf0, 0x71, 0x2f, 0xe3, 0x19, 0x64, 0x5b, 0x5c, 0x8f, 0x1d, 0x62, 0xc4, 0x28, 0xc9, 0x5f, 0xba, + 0xad, 0x15, 0x73, 0x95, 0x95, 0x52, 0x4a, 0x09, 0x95, 0x12, 0x27, 0x22, 0x13, 0x8b, 0x13, 0xad, + 0x99, 0x56, 0xc7, 0x93, 0xb9, 0x08, 0x0b, 0x7d, 0xa9, 0x5a, 0x98, 0x35, 0x29, 0x61, 0xd8, 0xfc, + 0x5d, 0x03, 0x7d, 0x87, 0x79, 0xcf, 0x68, 0x84, 0xd7, 0x02, 0xea, 0x1c, 0x6e, 0x61, 0xe4, 0xa6, + 0xee, 0xc4, 0x02, 0x4c, 0x89, 0xaa, 0xf2, 0x5d, 0x9e, 0xfd, 0xa4, 0x75, 0x95, 0x3f, 0x6f, 0xbb, + 0xfa, 0x2d, 0x80, 0x5a, 0xec, 0xc3, 0xae, 0x23, 0x56, 0xe7, 0x89, 0xce, 0x58, 0xd3, 0xdc, 0xb2, + 0x85, 0x58, 0x5d, 0xbf, 0x01, 0x57, 0xea, 0xd8, 0xf7, 0xea, 0x11, 0x4f, 0x6c, 0xd2, 0x92, 0x4f, + 0xfa, 0x66, 0x6c, 0x8f, 0xa3, 0xe6, 0x2f, 0xdf, 0xd6, 0x8a, 0x99, 0xca, 0xfd, 0x41, 0x09, 0x37, + 0x0f, 0xbd, 0x92, 0x3c, 0x41, 0x21, 0x71, 0x03, 0x45, 0x68, 0xed, 0xd2, 0xab, 0x3f, 0xdf, 0x9e, + 0xb0, 0x24, 0xdd, 0xfc, 0x0a, 0x8c, 0xfe, 0x54, 0x92, 0x4c, 0xf5, 0xbb, 0x90, 0xab, 0xa1, 0x20, + 0xa0, 0x91, 0xcd, 0x53, 0xc1, 0x2e, 0xcf, 0x6c, 0xca, 0xca, 0x0a, 0xeb, 0xba, 0x30, 0xc6, 0xb0, + 0x23, 0x1a, 0x61, 0xfb, 0xc0, 0x27, 0x28, 0xf0, 0x5f, 0x60, 0x91, 0xe5, 0x94, 0x95, 0x8d, 0xad, + 0x8f, 0x13, 0xa3, 0xf9, 0x12, 0xe6, 0xd5, 0xa6, 0xae, 0xc7, 0x52, 0xf7, 0xf8, 0x7d, 0x48, 0xd9, + 0xb8, 0xcf, 0x20, 0xe3, 0xb4, 0x81, 0xdc, 0x6b, 0xa6, 0x52, 0x4c, 0x3d, 0xdc, 0x0e, 0xc7, 0x56, + 0x27, 0xd9, 0x2c, 0xc0, 0x5b, 0x83, 0xa2, 0xab, 0x53, 0x7d, 0xc2, 0xd5, 0x59, 0xb8, 0x41, 0x8f, + 0x46, 0x54, 0x77, 0xf1, 0xb1, 0xca, 0x60, 0x7d, 0xce, 0x54, 0xb0, 0xdf, 0x34, 0xc8, 0xed, 0x30, + 0x6f, 0xd5, 0x75, 0x47, 0xb8, 0x48, 0xf7, 0x61, 0xee, 0x82, 0x4b, 0x34, 0x4b, 0x7b, 0xee, 0xc3, + 0xc7, 0xb0, 0xc0, 0xb7, 0x24, 0xf0, 0x31, 0x89, 0x6c, 0x2f, 0x44, 0x24, 0xc2, 0xd8, 0x6e, 0xb6, + 0x6a, 0x87, 0xf8, 0x54, 0x5e, 0xa3, 0x9b, 0x6d, 0xc0, 0xa6, 0x58, 0xdf, 0xe3, 0xcb, 0xfa, 0x0a, + 0x5c, 0x47, 0xae, 0x6b, 0x13, 0xea, 0x62, 0x1b, 0x39, 0x0e, 0x6d, 0x91, 0xc8, 0xa6, 0x24, 0x38, + 0xe5, 0xa5, 0x37, 0x65, 0xe9, 0xc8, 0x75, 0x9f, 0x52, 0x17, 0xaf, 0x8a, 0xa5, 0x5d, 0x12, 0x9c, + 0x9a, 0x79, 0xb8, 0xd1, 0x9d, 0x85, 0x4a, 0xf0, 0x7b, 0x0d, 0x66, 0x54, 0x61, 0xa1, 0x06, 0x7e, + 0xb3, 0xdb, 0xb1, 0x19, 0xdf, 0x0e, 0xd4, 0xc0, 0xb6, 0x4f, 0x0e, 0x28, 0xd7, 0x9f, 0xa9, 0x98, + 0xa9, 0xc7, 0xcf, 0x83, 0xc9, 0x1a, 0x9f, 0xe6, 0xdc, 0x6d, 0x72, 0x40, 0xcd, 0x1b, 0xfc, 0x70, + 0x95, 0x1a, 0x25, 0x73, 0x15, 0x66, 0x55, 0x51, 0x3c, 0xc1, 0xa7, 0x1e, 0x26, 0x29, 0x42, 0xe7, + 0xe1, 0x32, 0xbf, 0x99, 0x52, 0xa5, 0x78, 0x30, 0x17, 0xe0, 0x66, 0x8f, 0x0b, 0xe5, 0xfd, 0x47, + 0x0d, 0xfe, 0xcf, 0xcb, 0x80, 0xe1, 0x88, 0x57, 0xc1, 0x53, 0xde, 0xce, 0xdf, 0x6c, 0x2f, 0x96, + 0x60, 0x56, 0x2c, 0xf1, 0x99, 0x60, 0x07, 0xf4, 0x98, 0x6f, 0xc8, 0xa4, 0x95, 0x75, 0x94, 0xeb, + 0xcf, 0xe9, 0xb1, 0x5e, 0x84, 0xb9, 0x4e, 0x5c, 0xdd, 0xf7, 0xea, 0xb2, 0x79, 0xe4, 0xda, 0xc0, + 0x2d, 0xdf, 0xab, 0x9b, 0xb7, 0x60, 0x71, 0x80, 0x3a, 0xa5, 0xfe, 0x17, 0x0d, 0x40, 0x6e, 0xda, + 0x7e, 0xb5, 0x9a, 0x22, 0xfa, 0x16, 0x40, 0xc4, 0x58, 0x52, 0x65, 0xa2, 0x32, 0xa7, 0x23, 0xc6, + 0x64, 0x5d, 0x3d, 0x04, 0xfd, 0x90, 0xef, 0x8b, 0x1d, 0x1f, 0x97, 0x2d, 0xfb, 0x99, 0xd0, 0x3e, + 0x27, 0x56, 0x9e, 0xe3, 0x08, 0x6d, 0x89, 0xce, 0xb6, 0x01, 0x57, 0x58, 0x84, 0xa2, 0x16, 0x93, + 0xad, 0xfc, 0xe1, 0x45, 0x9d, 0x4d, 0xce, 0x31, 0x0b, 0x3b, 0xd8, 0x3f, 0xc2, 0x55, 0xce, 0xb1, + 0x24, 0xd7, 0xfc, 0xae, 0xdd, 0xa2, 0xf7, 0xab, 0xd5, 0xff, 0xa6, 0x9f, 0xc5, 0x30, 0x99, 0x18, + 0x6b, 0x39, 0x4e, 0x32, 0xa8, 0xa6, 0xac, 0xac, 0xb0, 0x56, 0x85, 0xd1, 0x3c, 0x86, 0xec, 0x0e, + 0xf3, 0x3e, 0x25, 0xa8, 0x16, 0xe0, 0xf5, 0xf5, 0xfd, 0x2f, 0x53, 0x76, 0xf2, 0x0e, 0x64, 0x31, + 0xc7, 0x6d, 0x93, 0x1a, 0x6d, 0x11, 0x15, 0xb7, 0xcb, 0xa8, 0x2f, 0x41, 0x4e, 0x18, 0x76, 0x5b, + 0x91, 0x80, 0x89, 0xb8, 0x3d, 0x56, 0xf3, 0x26, 0x5c, 0xef, 0x0a, 0xac, 0x4e, 0xf6, 0x25, 0x6f, + 0x3e, 0x1b, 0x3e, 0x1b, 0x41, 0xd2, 0x12, 0xe4, 0x5c, 0x01, 0xec, 0xd6, 0xd4, 0x63, 0xd5, 0x8b, + 0x30, 0x2b, 0x2d, 0x3d, 0xaa, 0x7a, 0xcd, 0xb2, 0x69, 0x74, 0x44, 0x57, 0xba, 0x7e, 0xd6, 0xa0, + 0xa0, 0xee, 0xd2, 0x26, 0x62, 0x7b, 0xa1, 0xef, 0xe0, 0x6d, 0x12, 0x4b, 0x61, 0xf8, 0x71, 0xfc, + 0x46, 0x96, 0x22, 0x94, 0xc0, 0x75, 0x6f, 0x10, 0x45, 0x4e, 0x8d, 0x4a, 0x6a, 0xdb, 0x18, 0x18, + 0x4c, 0xb6, 0x91, 0xc1, 0x6e, 0xcd, 0x22, 0x2c, 0xa5, 0x6b, 0x4d, 0xd2, 0xaa, 0xfc, 0x9a, 0x81, + 0xc9, 0x1d, 0xe6, 0xe9, 0x14, 0x32, 0x9d, 0x0d, 0xff, 0x9d, 0x54, 0x45, 0xdd, 0x7d, 0xd5, 0x78, + 0x34, 0x06, 0x58, 0x95, 0xfb, 0x09, 0xe4, 0x7a, 0xde, 0xd6, 0x4a, 0xc3, 0xdc, 0x74, 0xe3, 0x8d, + 0xf7, 0xc7, 0xc3, 0xab, 0xc8, 0xdf, 0x6a, 0x70, 0xad, 0x7f, 0xd0, 0xaf, 0x8c, 0xe6, 0xad, 0x83, + 0x62, 0x7c, 0x34, 0x36, 0xa5, 0x4b, 0x43, 0xff, 0x38, 0x1f, 0xaa, 0xa1, 0x8f, 0x32, 0x5c, 0xc3, + 0x85, 0x73, 0x5e, 0xf7, 0x61, 0xba, 0x3d, 0x02, 0xef, 0x0f, 0xf3, 0xa3, 0xa0, 0xc6, 0xca, 0xc8, + 0x50, 0x15, 0x2a, 0x84, 0x99, 0xae, 0x39, 0xf6, 0x70, 0xb4, 0x9d, 0x13, 0x68, 0xe3, 0xbd, 0x71, + 0xd0, 0x2a, 0xe6, 0xd7, 0x30, 0xdb, 0xfb, 0x16, 0x5c, 0x1e, 0x4d, 0xb9, 0x22, 0x18, 0x1f, 0x8c, + 0x49, 0x50, 0xc1, 0xbf, 0x81, 0xb9, 0xbe, 0xc9, 0xba, 0x3c, 0xfc, 0xa8, 0xba, 0x19, 0xc6, 0x87, + 0xe3, 0x32, 0x54, 0x7c, 0x07, 0xae, 0x26, 0xb3, 0xf1, 0xde, 0x28, 0x39, 0xec, 0x57, 0xab, 0x46, + 0x79, 0x44, 0xa0, 0x0a, 0x12, 0x00, 0x74, 0x4c, 0x8e, 0x07, 0xc3, 0xe8, 0x6d, 0xac, 0x51, 0x19, + 0x1d, 0xab, 0xa2, 0x51, 0xc8, 0x74, 0x4e, 0x85, 0xa1, 0x1d, 0xaa, 0x03, 0x3c, 0xbc, 0x43, 0x0d, + 0xe8, 0xf8, 0xfa, 0x4f, 0x1a, 0x2c, 0xa6, 0xb5, 0xfb, 0x4f, 0x46, 0x2b, 0xcb, 0x81, 0x64, 0x63, + 0xfd, 0x5f, 0x90, 0x13, 0x85, 0x6b, 0xdb, 0xaf, 0xce, 0x0a, 0xda, 0xeb, 0xb3, 0x82, 0xf6, 0xd7, + 0x59, 0x41, 0xfb, 0xe1, 0xbc, 0x30, 0xf1, 0xfa, 0xbc, 0x30, 0xf1, 0xc7, 0x79, 0x61, 0xe2, 0x79, + 0xd9, 0xf3, 0xa3, 0x7a, 0xab, 0x56, 0x72, 0x68, 0x83, 0x7f, 0x3c, 0xbf, 0xdb, 0xf3, 0x1d, 0x7d, + 0xd2, 0xf1, 0x71, 0x7e, 0xda, 0xc4, 0xac, 0x76, 0x85, 0x7f, 0x47, 0x3f, 0xfa, 0x27, 0x00, 0x00, + 0xff, 0xff, 0x9a, 0x8b, 0x97, 0x08, 0x06, 0x11, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -1370,7 +1370,7 @@ type MsgClient interface { UpdateObserver(ctx context.Context, in *MsgUpdateObserver, opts ...grpc.CallOption) (*MsgUpdateObserverResponse, error) UpdateChainParams(ctx context.Context, in *MsgUpdateChainParams, opts ...grpc.CallOption) (*MsgUpdateChainParamsResponse, error) RemoveChainParams(ctx context.Context, in *MsgRemoveChainParams, opts ...grpc.CallOption) (*MsgRemoveChainParamsResponse, error) - AddBlameVote(ctx context.Context, in *MsgAddBlameVote, opts ...grpc.CallOption) (*MsgAddBlameVoteResponse, error) + VoteBlame(ctx context.Context, in *MsgVoteBlame, opts ...grpc.CallOption) (*MsgVoteBlameResponse, error) UpdateKeygen(ctx context.Context, in *MsgUpdateKeygen, opts ...grpc.CallOption) (*MsgUpdateKeygenResponse, error) VoteBlockHeader(ctx context.Context, in *MsgVoteBlockHeader, opts ...grpc.CallOption) (*MsgVoteBlockHeaderResponse, error) ResetChainNonces(ctx context.Context, in *MsgResetChainNonces, opts ...grpc.CallOption) (*MsgResetChainNoncesResponse, error) @@ -1424,9 +1424,9 @@ func (c *msgClient) RemoveChainParams(ctx context.Context, in *MsgRemoveChainPar return out, nil } -func (c *msgClient) AddBlameVote(ctx context.Context, in *MsgAddBlameVote, opts ...grpc.CallOption) (*MsgAddBlameVoteResponse, error) { - out := new(MsgAddBlameVoteResponse) - err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/AddBlameVote", in, out, opts...) +func (c *msgClient) VoteBlame(ctx context.Context, in *MsgVoteBlame, opts ...grpc.CallOption) (*MsgVoteBlameResponse, error) { + out := new(MsgVoteBlameResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.observer.Msg/VoteBlame", in, out, opts...) if err != nil { return nil, err } @@ -1502,7 +1502,7 @@ type MsgServer interface { UpdateObserver(context.Context, *MsgUpdateObserver) (*MsgUpdateObserverResponse, error) UpdateChainParams(context.Context, *MsgUpdateChainParams) (*MsgUpdateChainParamsResponse, error) RemoveChainParams(context.Context, *MsgRemoveChainParams) (*MsgRemoveChainParamsResponse, error) - AddBlameVote(context.Context, *MsgAddBlameVote) (*MsgAddBlameVoteResponse, error) + VoteBlame(context.Context, *MsgVoteBlame) (*MsgVoteBlameResponse, error) UpdateKeygen(context.Context, *MsgUpdateKeygen) (*MsgUpdateKeygenResponse, error) VoteBlockHeader(context.Context, *MsgVoteBlockHeader) (*MsgVoteBlockHeaderResponse, error) ResetChainNonces(context.Context, *MsgResetChainNonces) (*MsgResetChainNoncesResponse, error) @@ -1528,8 +1528,8 @@ func (*UnimplementedMsgServer) UpdateChainParams(ctx context.Context, req *MsgUp func (*UnimplementedMsgServer) RemoveChainParams(ctx context.Context, req *MsgRemoveChainParams) (*MsgRemoveChainParamsResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method RemoveChainParams not implemented") } -func (*UnimplementedMsgServer) AddBlameVote(ctx context.Context, req *MsgAddBlameVote) (*MsgAddBlameVoteResponse, error) { - return nil, status.Errorf(codes.Unimplemented, "method AddBlameVote not implemented") +func (*UnimplementedMsgServer) VoteBlame(ctx context.Context, req *MsgVoteBlame) (*MsgVoteBlameResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method VoteBlame not implemented") } func (*UnimplementedMsgServer) UpdateKeygen(ctx context.Context, req *MsgUpdateKeygen) (*MsgUpdateKeygenResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdateKeygen not implemented") @@ -1629,20 +1629,20 @@ func _Msg_RemoveChainParams_Handler(srv interface{}, ctx context.Context, dec fu return interceptor(ctx, in, info, handler) } -func _Msg_AddBlameVote_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { - in := new(MsgAddBlameVote) +func _Msg_VoteBlame_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgVoteBlame) if err := dec(in); err != nil { return nil, err } if interceptor == nil { - return srv.(MsgServer).AddBlameVote(ctx, in) + return srv.(MsgServer).VoteBlame(ctx, in) } info := &grpc.UnaryServerInfo{ Server: srv, - FullMethod: "/zetachain.zetacore.observer.Msg/AddBlameVote", + FullMethod: "/zetachain.zetacore.observer.Msg/VoteBlame", } handler := func(ctx context.Context, req interface{}) (interface{}, error) { - return srv.(MsgServer).AddBlameVote(ctx, req.(*MsgAddBlameVote)) + return srv.(MsgServer).VoteBlame(ctx, req.(*MsgVoteBlame)) } return interceptor(ctx, in, info, handler) } @@ -1794,8 +1794,8 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ Handler: _Msg_RemoveChainParams_Handler, }, { - MethodName: "AddBlameVote", - Handler: _Msg_AddBlameVote_Handler, + MethodName: "VoteBlame", + Handler: _Msg_VoteBlame_Handler, }, { MethodName: "UpdateKeygen", @@ -2202,7 +2202,7 @@ func (m *MsgAddObserverResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) return len(dAtA) - i, nil } -func (m *MsgAddBlameVote) Marshal() (dAtA []byte, err error) { +func (m *MsgVoteBlame) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2212,12 +2212,12 @@ func (m *MsgAddBlameVote) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgAddBlameVote) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgVoteBlame) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgAddBlameVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgVoteBlame) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2247,7 +2247,7 @@ func (m *MsgAddBlameVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *MsgAddBlameVoteResponse) Marshal() (dAtA []byte, err error) { +func (m *MsgVoteBlameResponse) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -2257,12 +2257,12 @@ func (m *MsgAddBlameVoteResponse) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *MsgAddBlameVoteResponse) MarshalTo(dAtA []byte) (int, error) { +func (m *MsgVoteBlameResponse) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *MsgAddBlameVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *MsgVoteBlameResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) _ = i var l int @@ -2873,7 +2873,7 @@ func (m *MsgAddObserverResponse) Size() (n int) { return n } -func (m *MsgAddBlameVote) Size() (n int) { +func (m *MsgVoteBlame) Size() (n int) { if m == nil { return 0 } @@ -2891,7 +2891,7 @@ func (m *MsgAddBlameVote) Size() (n int) { return n } -func (m *MsgAddBlameVoteResponse) Size() (n int) { +func (m *MsgVoteBlameResponse) Size() (n int) { if m == nil { return 0 } @@ -4110,7 +4110,7 @@ func (m *MsgAddObserverResponse) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error { +func (m *MsgVoteBlame) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4133,10 +4133,10 @@ func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddBlameVote: wiretype end group for non-group") + return fmt.Errorf("proto: MsgVoteBlame: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddBlameVote: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgVoteBlame: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: @@ -4244,7 +4244,7 @@ func (m *MsgAddBlameVote) Unmarshal(dAtA []byte) error { } return nil } -func (m *MsgAddBlameVoteResponse) Unmarshal(dAtA []byte) error { +func (m *MsgVoteBlameResponse) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -4267,10 +4267,10 @@ func (m *MsgAddBlameVoteResponse) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: MsgAddBlameVoteResponse: wiretype end group for non-group") + return fmt.Errorf("proto: MsgVoteBlameResponse: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: MsgAddBlameVoteResponse: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: MsgVoteBlameResponse: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { default: diff --git a/zetaclient/zetacore/tx.go b/zetaclient/zetacore/tx.go index dbf144e9ab..b4aa0725f8 100644 --- a/zetaclient/zetacore/tx.go +++ b/zetaclient/zetacore/tx.go @@ -192,7 +192,7 @@ func (c *Client) PostBlameData(blame *blame.Blame, chainID int64, index string) FailureReason: blame.FailReason, Nodes: observertypes.ConvertNodes(blame.BlameNodes), } - msg := observertypes.NewMsgAddBlameVoteMsg(signerAddress, chainID, zetaBlame) + msg := observertypes.NewMsgVoteBlameMsg(signerAddress, chainID, zetaBlame) authzMsg, authzSigner, err := c.WrapMessageWithAuthz(msg) if err != nil { From 42458aeb82f34b75ecddffb979a2d3557f8814a8 Mon Sep 17 00:00:00 2001 From: Lucas Bertrand Date: Thu, 30 May 2024 14:08:19 +0200 Subject: [PATCH 2/6] feat: implement `MsgUpdateChainInfo` (#2287) * proto * codec * message type * fix tests * message handler * fix test * make generate * changelogs * add chain info in proto * message type * complete message * add cli * generate * Update x/authority/keeper/msg_server_update_chain_info.go Co-authored-by: skosito * Update x/authority/types/message_update_chain_info.go Co-authored-by: skosito * rename signer to creator * refactor test assertions * add read file function * add query * add query cli * add unit test for parse type in cli --------- Co-authored-by: skosito --- changelog.md | 1 + .../zetacored/zetacored_query_authority.md | 1 + ...tacored_query_authority_show-chain-info.md | 34 ++ docs/cli/zetacored/zetacored_tx_authority.md | 1 + ...etacored_tx_authority_update-chain-info.md | 53 +++ docs/openapi/openapi.swagger.yaml | 38 ++ docs/spec/authority/messages.md | 14 +- pkg/testdata/testdata.go | 5 + pkg/testdata/types/chain_info.json | 24 + pkg/testdata/types/policies.json | 16 + .../zetachain/zetacore/authority/query.proto | 16 + proto/zetachain/zetacore/authority/tx.proto | 13 +- .../zetacore/authority/query_pb.d.ts | 50 ++ .../zetachain/zetacore/authority/tx_pb.d.ts | 57 ++- x/authority/client/cli/query.go | 1 + x/authority/client/cli/query_chain_info.go | 36 ++ x/authority/client/cli/tx.go | 1 + .../client/cli/tx_update_chain_info.go | 55 +++ .../client/cli/tx_update_chain_info_test.go | 40 ++ x/authority/client/cli/tx_update_policies.go | 22 +- .../client/cli/tx_update_policies_test.go | 32 ++ x/authority/keeper/grpc_query_chain_info.go | 30 ++ .../keeper/grpc_query_chain_info_test.go | 38 ++ .../keeper/msg_server_update_chain_info.go | 32 ++ .../msg_server_update_chain_info_test.go | 117 +++++ .../keeper/msg_server_update_policies.go | 4 +- .../keeper/msg_server_update_policies_test.go | 4 +- x/authority/types/codec.go | 2 + .../types/message_update_chain_info.go | 52 +++ .../types/message_update_chain_info_test.go | 108 +++++ x/authority/types/message_update_policies.go | 10 +- .../types/message_update_policies_test.go | 19 +- x/authority/types/query.pb.go | 382 +++++++++++++++- x/authority/types/query.pb.gw.go | 65 +++ x/authority/types/tx.pb.go | 432 +++++++++++++++++- 35 files changed, 1730 insertions(+), 75 deletions(-) create mode 100644 docs/cli/zetacored/zetacored_query_authority_show-chain-info.md create mode 100644 docs/cli/zetacored/zetacored_tx_authority_update-chain-info.md create mode 100644 pkg/testdata/types/chain_info.json create mode 100644 pkg/testdata/types/policies.json create mode 100644 x/authority/client/cli/query_chain_info.go create mode 100644 x/authority/client/cli/tx_update_chain_info.go create mode 100644 x/authority/client/cli/tx_update_chain_info_test.go create mode 100644 x/authority/client/cli/tx_update_policies_test.go create mode 100644 x/authority/keeper/grpc_query_chain_info.go create mode 100644 x/authority/keeper/grpc_query_chain_info_test.go create mode 100644 x/authority/keeper/msg_server_update_chain_info.go create mode 100644 x/authority/keeper/msg_server_update_chain_info_test.go create mode 100644 x/authority/types/message_update_chain_info.go create mode 100644 x/authority/types/message_update_chain_info_test.go diff --git a/changelog.md b/changelog.md index f5df72245c..2776b6c1a9 100644 --- a/changelog.md +++ b/changelog.md @@ -16,6 +16,7 @@ * [2113](https://github.com/zeta-chain/node/pull/2113) - add zetaclientd-supervisor process * [2154](https://github.com/zeta-chain/node/pull/2154) - add `ibccrosschain` module * [2258](https://github.com/zeta-chain/node/pull/2258) - add Optimism and Base in static chain information +* [2287](https://github.com/zeta-chain/node/pull/2287) - implement `MsgUpdateChainInfo` message * [2279](https://github.com/zeta-chain/node/pull/2279) - add a CCTXGateway field to chain static data * [2275](https://github.com/zeta-chain/node/pull/2275) - add ChainInfo singleton state variable in authority diff --git a/docs/cli/zetacored/zetacored_query_authority.md b/docs/cli/zetacored/zetacored_query_authority.md index 1685db07ca..f1e6bd9b69 100644 --- a/docs/cli/zetacored/zetacored_query_authority.md +++ b/docs/cli/zetacored/zetacored_query_authority.md @@ -26,5 +26,6 @@ zetacored query authority [flags] ### SEE ALSO * [zetacored query](zetacored_query.md) - Querying subcommands +* [zetacored query authority show-chain-info](zetacored_query_authority_show-chain-info.md) - show the chain info * [zetacored query authority show-policies](zetacored_query_authority_show-policies.md) - show the policies diff --git a/docs/cli/zetacored/zetacored_query_authority_show-chain-info.md b/docs/cli/zetacored/zetacored_query_authority_show-chain-info.md new file mode 100644 index 0000000000..440cfc470f --- /dev/null +++ b/docs/cli/zetacored/zetacored_query_authority_show-chain-info.md @@ -0,0 +1,34 @@ +# query authority show-chain-info + +show the chain info + +``` +zetacored query authority show-chain-info [flags] +``` + +### Options + +``` + --grpc-addr string the gRPC endpoint to use for this chain + --grpc-insecure allow gRPC over insecure channels, if not TLS the server must use TLS + --height int Use a specific height to query state at (this can error if the node is pruning state) + -h, --help help for show-chain-info + --node string [host]:[port] to Tendermint RPC interface for this chain + -o, --output string Output format (text|json) +``` + +### Options inherited from parent commands + +``` + --chain-id string The network chain ID + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --log_no_color Disable colored logs + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored query authority](zetacored_query_authority.md) - Querying commands for the authority module + diff --git a/docs/cli/zetacored/zetacored_tx_authority.md b/docs/cli/zetacored/zetacored_tx_authority.md index cccd9b7dde..5a543e70b1 100644 --- a/docs/cli/zetacored/zetacored_tx_authority.md +++ b/docs/cli/zetacored/zetacored_tx_authority.md @@ -26,5 +26,6 @@ zetacored tx authority [flags] ### SEE ALSO * [zetacored tx](zetacored_tx.md) - Transactions subcommands +* [zetacored tx authority update-chain-info](zetacored_tx_authority_update-chain-info.md) - Update the chain info * [zetacored tx authority update-policies](zetacored_tx_authority_update-policies.md) - Update the policies diff --git a/docs/cli/zetacored/zetacored_tx_authority_update-chain-info.md b/docs/cli/zetacored/zetacored_tx_authority_update-chain-info.md new file mode 100644 index 0000000000..feb402a126 --- /dev/null +++ b/docs/cli/zetacored/zetacored_tx_authority_update-chain-info.md @@ -0,0 +1,53 @@ +# tx authority update-chain-info + +Update the chain info + +``` +zetacored tx authority update-chain-info [chain-info-json-file] [flags] +``` + +### Options + +``` + -a, --account-number uint The account number of the signing account (offline mode only) + --aux Generate aux signer data instead of sending a tx + -b, --broadcast-mode string Transaction broadcasting mode (sync|async) + --chain-id string The network chain ID + --dry-run ignore the --gas flag and perform a simulation of a transaction, but don't broadcast it (when enabled, the local Keybase is not accessible) + --fee-granter string Fee granter grants fees for the transaction + --fee-payer string Fee payer pays fees for the transaction instead of deducting from the signer + --fees string Fees to pay along with transaction; eg: 10uatom + --from string Name or address of private key with which to sign + --gas string gas limit to set per-transaction; set to "auto" to calculate sufficient gas automatically. Note: "auto" option doesn't always report accurate results. Set a valid coin value to adjust the result. Can be used instead of "fees". (default 200000) + --gas-adjustment float adjustment factor to be multiplied against the estimate returned by the tx simulation; if the gas limit is set manually this flag is ignored (default 1) + --gas-prices string Gas prices in decimal format to determine the transaction fee (e.g. 0.1uatom) + --generate-only Build an unsigned transaction and write it to STDOUT (when enabled, the local Keybase only accessed when providing a key name) + -h, --help help for update-chain-info + --keyring-backend string Select keyring's backend (os|file|kwallet|pass|test|memory) + --keyring-dir string The client Keyring directory; if omitted, the default 'home' directory will be used + --ledger Use a connected Ledger device + --node string [host]:[port] to tendermint rpc interface for this chain + --note string Note to add a description to the transaction (previously --memo) + --offline Offline mode (does not allow any online functionality) + -o, --output string Output format (text|json) + -s, --sequence uint The sequence number of the signing account (offline mode only) + --sign-mode string Choose sign mode (direct|amino-json|direct-aux), this is an advanced feature + --timeout-height uint Set a block timeout height to prevent the tx from being committed past a certain height + --tip string Tip is the amount that is going to be transferred to the fee payer on the target chain. This flag is only valid when used with --aux, and is ignored if the target chain didn't enable the TipDecorator + -y, --yes Skip tx broadcasting prompt confirmation +``` + +### Options inherited from parent commands + +``` + --home string directory for config and data + --log_format string The logging format (json|plain) + --log_level string The logging level (trace|debug|info|warn|error|fatal|panic) + --log_no_color Disable colored logs + --trace print out full stack trace on errors +``` + +### SEE ALSO + +* [zetacored tx authority](zetacored_tx_authority.md) - authority transactions subcommands + diff --git a/docs/openapi/openapi.swagger.yaml b/docs/openapi/openapi.swagger.yaml index 3a36ef68af..c9e758227f 100644 --- a/docs/openapi/openapi.swagger.yaml +++ b/docs/openapi/openapi.swagger.yaml @@ -28254,6 +28254,21 @@ paths: type: boolean tags: - Query + /zeta-chain/authority/chainInfo: + get: + summary: Queries ChainInfo + operationId: Query_ChainInfo + responses: + "200": + description: A successful response. + schema: + $ref: '#/definitions/authorityQueryGetChainInfoResponse' + default: + description: An unexpected error response. + schema: + $ref: '#/definitions/googlerpcStatus' + tags: + - Query /zeta-chain/authority/policies: get: summary: Queries Policies @@ -56703,6 +56718,21 @@ definitions: format: int64 balance: type: string + authorityChainInfo: + type: object + properties: + chains: + type: array + items: + type: object + $ref: '#/definitions/chainsChain' + title: |- + ChainInfo contains static information about the chains + This structure is used to dynamically update these info on a live network + before hardcoding the values in a upgrade + authorityMsgUpdateChainInfoResponse: + type: object + description: MsgUpdateChainInfoResponse defines the MsgUpdateChainInfoResponse service. authorityMsgUpdatePoliciesResponse: type: object description: MsgUpdatePoliciesResponse defines the MsgUpdatePoliciesResponse service. @@ -56736,6 +56766,14 @@ definitions: Used for administrative tasks like changing sensitive title: PolicyType defines the type of policy + authorityQueryGetChainInfoResponse: + type: object + properties: + chain_info: + $ref: '#/definitions/authorityChainInfo' + description: |- + QueryGetChainInfoResponse is the response type for the Query/ChainInfo RPC + method. authorityQueryGetPoliciesResponse: type: object properties: diff --git a/docs/spec/authority/messages.md b/docs/spec/authority/messages.md index 788e95c6f6..899a95b989 100644 --- a/docs/spec/authority/messages.md +++ b/docs/spec/authority/messages.md @@ -6,8 +6,20 @@ UpdatePolicies updates policies ```proto message MsgUpdatePolicies { - string signer = 1; + string creator = 1; Policies policies = 2; } ``` +## MsgUpdateChainInfo + +UpdateChainInfo updates the chain info structure that adds new static chain info or overwrite existing chain info +on the hard-coded chain info + +```proto +message MsgUpdateChainInfo { + string creator = 1; + ChainInfo chain_info = 2; +} +``` + diff --git a/pkg/testdata/testdata.go b/pkg/testdata/testdata.go index 37c63c4131..50f08b1451 100644 --- a/pkg/testdata/testdata.go +++ b/pkg/testdata/testdata.go @@ -17,6 +17,11 @@ const ( TxsCount = 81 ) +// TypesFiles contains the embedded files of different types in ZetaChain +// +//go:embed types/* +var TypesFiles embed.FS + //go:embed ethereum/* var ethFiles embed.FS diff --git a/pkg/testdata/types/chain_info.json b/pkg/testdata/types/chain_info.json new file mode 100644 index 0000000000..e346dac20a --- /dev/null +++ b/pkg/testdata/types/chain_info.json @@ -0,0 +1,24 @@ +{ + "chains": [ + { + "chain_id": 42, + "chain_name": 0, + "network": 0, + "network_type": 0, + "vm": 0, + "consensus": 0, + "is_external": false, + "cctx_gateway": 0 + }, + { + "chain_id": 84, + "chain_name": 1, + "network": 1, + "network_type": 1, + "vm": 1, + "consensus": 1, + "is_external": true, + "cctx_gateway": 1 + } + ] +} \ No newline at end of file diff --git a/pkg/testdata/types/policies.json b/pkg/testdata/types/policies.json new file mode 100644 index 0000000000..bbfdc2783f --- /dev/null +++ b/pkg/testdata/types/policies.json @@ -0,0 +1,16 @@ +{ + "items": [ + { + "address": "zeta1nl7550unvzyswx5ts9m338ufmfydjsz2g0xt74", + "policy_type": 0 + }, + { + "address": "zeta1n0rn6sne54hv7w2uu93fl48ncyqz97d3kty6sh", + "policy_type": 1 + }, + { + "address": "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk", + "policy_type": 2 + } + ] +} \ No newline at end of file diff --git a/proto/zetachain/zetacore/authority/query.proto b/proto/zetachain/zetacore/authority/query.proto index 393867979d..c5cb89d47a 100644 --- a/proto/zetachain/zetacore/authority/query.proto +++ b/proto/zetachain/zetacore/authority/query.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package zetachain.zetacore.authority; import "zetachain/zetacore/authority/policies.proto"; +import "zetachain/zetacore/authority/chain_info.proto"; import "cosmos/base/query/v1beta1/pagination.proto"; import "gogoproto/gogo.proto"; import "google/api/annotations.proto"; @@ -14,6 +15,11 @@ service Query { rpc Policies(QueryGetPoliciesRequest) returns (QueryGetPoliciesResponse) { option (google.api.http).get = "/zeta-chain/authority/policies"; } + + // Queries ChainInfo + rpc ChainInfo(QueryGetChainInfoRequest) returns (QueryGetChainInfoResponse) { + option (google.api.http).get = "/zeta-chain/authority/chainInfo"; + } } // QueryGetPoliciesRequest is the request type for the Query/Policies RPC @@ -25,3 +31,13 @@ message QueryGetPoliciesRequest {} message QueryGetPoliciesResponse { Policies policies = 1 [ (gogoproto.nullable) = false ]; } + +// QueryGetChainInfoRequest is the request type for the Query/ChainInfo RPC +// method. +message QueryGetChainInfoRequest {} + +// QueryGetChainInfoResponse is the response type for the Query/ChainInfo RPC +// method. +message QueryGetChainInfoResponse { + ChainInfo chain_info = 1 [ (gogoproto.nullable) = false ]; +} \ No newline at end of file diff --git a/proto/zetachain/zetacore/authority/tx.proto b/proto/zetachain/zetacore/authority/tx.proto index 7e8c007005..cc4d22a6e6 100644 --- a/proto/zetachain/zetacore/authority/tx.proto +++ b/proto/zetachain/zetacore/authority/tx.proto @@ -2,6 +2,7 @@ syntax = "proto3"; package zetachain.zetacore.authority; import "zetachain/zetacore/authority/policies.proto"; +import "zetachain/zetacore/authority/chain_info.proto"; import "gogoproto/gogo.proto"; option go_package = "github.com/zeta-chain/zetacore/x/authority/types"; @@ -9,13 +10,23 @@ option go_package = "github.com/zeta-chain/zetacore/x/authority/types"; // Msg defines the Msg service. service Msg { rpc UpdatePolicies(MsgUpdatePolicies) returns (MsgUpdatePoliciesResponse); + rpc UpdateChainInfo(MsgUpdateChainInfo) returns (MsgUpdateChainInfoResponse); } // MsgUpdatePolicies defines the MsgUpdatePolicies service. message MsgUpdatePolicies { - string signer = 1; + string creator = 1; Policies policies = 2 [ (gogoproto.nullable) = false ]; } // MsgUpdatePoliciesResponse defines the MsgUpdatePoliciesResponse service. message MsgUpdatePoliciesResponse {} + +// MsgUpdateChainInfo defines the MsgUpdateChainInfo service. +message MsgUpdateChainInfo { + string creator = 1; + ChainInfo chain_info = 2 [ (gogoproto.nullable) = false ]; +} + +// MsgUpdateChainInfoResponse defines the MsgUpdateChainInfoResponse service. +message MsgUpdateChainInfoResponse {} \ No newline at end of file diff --git a/typescript/zetachain/zetacore/authority/query_pb.d.ts b/typescript/zetachain/zetacore/authority/query_pb.d.ts index 103de61b97..13192f4592 100644 --- a/typescript/zetachain/zetacore/authority/query_pb.d.ts +++ b/typescript/zetachain/zetacore/authority/query_pb.d.ts @@ -6,6 +6,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; import type { Policies } from "./policies_pb.js"; +import type { ChainInfo } from "./chain_info_pb.js"; /** * QueryGetPoliciesRequest is the request type for the Query/Policies RPC @@ -56,3 +57,52 @@ export declare class QueryGetPoliciesResponse extends Message | undefined, b: QueryGetPoliciesResponse | PlainMessage | undefined): boolean; } +/** + * QueryGetChainInfoRequest is the request type for the Query/ChainInfo RPC + * method. + * + * @generated from message zetachain.zetacore.authority.QueryGetChainInfoRequest + */ +export declare class QueryGetChainInfoRequest extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.authority.QueryGetChainInfoRequest"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetChainInfoRequest; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetChainInfoRequest; + + static fromJsonString(jsonString: string, options?: Partial): QueryGetChainInfoRequest; + + static equals(a: QueryGetChainInfoRequest | PlainMessage | undefined, b: QueryGetChainInfoRequest | PlainMessage | undefined): boolean; +} + +/** + * QueryGetChainInfoResponse is the response type for the Query/ChainInfo RPC + * method. + * + * @generated from message zetachain.zetacore.authority.QueryGetChainInfoResponse + */ +export declare class QueryGetChainInfoResponse extends Message { + /** + * @generated from field: zetachain.zetacore.authority.ChainInfo chain_info = 1; + */ + chainInfo?: ChainInfo; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.authority.QueryGetChainInfoResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): QueryGetChainInfoResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): QueryGetChainInfoResponse; + + static fromJsonString(jsonString: string, options?: Partial): QueryGetChainInfoResponse; + + static equals(a: QueryGetChainInfoResponse | PlainMessage | undefined, b: QueryGetChainInfoResponse | PlainMessage | undefined): boolean; +} + diff --git a/typescript/zetachain/zetacore/authority/tx_pb.d.ts b/typescript/zetachain/zetacore/authority/tx_pb.d.ts index b77e1231dc..bd531ac2e5 100644 --- a/typescript/zetachain/zetacore/authority/tx_pb.d.ts +++ b/typescript/zetachain/zetacore/authority/tx_pb.d.ts @@ -6,6 +6,7 @@ import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf"; import { Message, proto3 } from "@bufbuild/protobuf"; import type { Policies } from "./policies_pb.js"; +import type { ChainInfo } from "./chain_info_pb.js"; /** * MsgUpdatePolicies defines the MsgUpdatePolicies service. @@ -14,9 +15,9 @@ import type { Policies } from "./policies_pb.js"; */ export declare class MsgUpdatePolicies extends Message { /** - * @generated from field: string signer = 1; + * @generated from field: string creator = 1; */ - signer: string; + creator: string; /** * @generated from field: zetachain.zetacore.authority.Policies policies = 2; @@ -59,3 +60,55 @@ export declare class MsgUpdatePoliciesResponse extends Message | undefined, b: MsgUpdatePoliciesResponse | PlainMessage | undefined): boolean; } +/** + * MsgUpdateChainInfo defines the MsgUpdateChainInfo service. + * + * @generated from message zetachain.zetacore.authority.MsgUpdateChainInfo + */ +export declare class MsgUpdateChainInfo extends Message { + /** + * @generated from field: string creator = 1; + */ + creator: string; + + /** + * @generated from field: zetachain.zetacore.authority.ChainInfo chain_info = 2; + */ + chainInfo?: ChainInfo; + + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.authority.MsgUpdateChainInfo"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateChainInfo; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateChainInfo; + + static fromJsonString(jsonString: string, options?: Partial): MsgUpdateChainInfo; + + static equals(a: MsgUpdateChainInfo | PlainMessage | undefined, b: MsgUpdateChainInfo | PlainMessage | undefined): boolean; +} + +/** + * MsgUpdateChainInfoResponse defines the MsgUpdateChainInfoResponse service. + * + * @generated from message zetachain.zetacore.authority.MsgUpdateChainInfoResponse + */ +export declare class MsgUpdateChainInfoResponse extends Message { + constructor(data?: PartialMessage); + + static readonly runtime: typeof proto3; + static readonly typeName = "zetachain.zetacore.authority.MsgUpdateChainInfoResponse"; + static readonly fields: FieldList; + + static fromBinary(bytes: Uint8Array, options?: Partial): MsgUpdateChainInfoResponse; + + static fromJson(jsonValue: JsonValue, options?: Partial): MsgUpdateChainInfoResponse; + + static fromJsonString(jsonString: string, options?: Partial): MsgUpdateChainInfoResponse; + + static equals(a: MsgUpdateChainInfoResponse | PlainMessage | undefined, b: MsgUpdateChainInfoResponse | PlainMessage | undefined): boolean; +} + diff --git a/x/authority/client/cli/query.go b/x/authority/client/cli/query.go index 02b056fa9e..ec6f965b7f 100644 --- a/x/authority/client/cli/query.go +++ b/x/authority/client/cli/query.go @@ -22,6 +22,7 @@ func GetQueryCmd(_ string) *cobra.Command { cmd.AddCommand( CmdShowPolicies(), + CmdShowChainInfo(), ) return cmd diff --git a/x/authority/client/cli/query_chain_info.go b/x/authority/client/cli/query_chain_info.go new file mode 100644 index 0000000000..20872224c2 --- /dev/null +++ b/x/authority/client/cli/query_chain_info.go @@ -0,0 +1,36 @@ +package cli + +import ( + "context" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/spf13/cobra" + + "github.com/zeta-chain/zetacore/x/authority/types" +) + +// CmdShowChainInfo returns the command to show the chain info +func CmdShowChainInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "show-chain-info", + Short: "show the chain info", + Args: cobra.NoArgs, + RunE: func(cmd *cobra.Command, _ []string) error { + clientCtx := client.GetClientContextFromCmd(cmd) + + queryClient := types.NewQueryClient(clientCtx) + + res, err := queryClient.ChainInfo(context.Background(), &types.QueryGetChainInfoRequest{}) + if err != nil { + return err + } + + return clientCtx.PrintProto(res) + }, + } + + flags.AddQueryFlagsToCmd(cmd) + + return cmd +} diff --git a/x/authority/client/cli/tx.go b/x/authority/client/cli/tx.go index bd36f4d246..1455773bf5 100644 --- a/x/authority/client/cli/tx.go +++ b/x/authority/client/cli/tx.go @@ -21,6 +21,7 @@ func GetTxCmd() *cobra.Command { cmd.AddCommand( CmdUpdatePolices(), + CmdUpdateChainInfo(), ) return cmd diff --git a/x/authority/client/cli/tx_update_chain_info.go b/x/authority/client/cli/tx_update_chain_info.go new file mode 100644 index 0000000000..4a2f4b93eb --- /dev/null +++ b/x/authority/client/cli/tx_update_chain_info.go @@ -0,0 +1,55 @@ +package cli + +import ( + "encoding/json" + "fmt" + "io/fs" + "os" + + "github.com/cosmos/cosmos-sdk/client" + "github.com/cosmos/cosmos-sdk/client/flags" + "github.com/cosmos/cosmos-sdk/client/tx" + "github.com/spf13/cobra" + + "github.com/zeta-chain/zetacore/x/authority/types" +) + +func CmdUpdateChainInfo() *cobra.Command { + cmd := &cobra.Command{ + Use: "update-chain-info [chain-info-json-file]", + Short: "Update the chain info", + Args: cobra.ExactArgs(1), + RunE: func(cmd *cobra.Command, args []string) (err error) { + chainInfo, err := ReadChainInfoFromFile(os.DirFS("."), args[0]) + if err != nil { + return err + } + + clientCtx, err := client.GetClientTxContext(cmd) + if err != nil { + return err + } + + msg := types.NewMsgUpdateChainInfo( + clientCtx.GetFromAddress().String(), + chainInfo, + ) + + return tx.GenerateOrBroadcastTxCLI(clientCtx, cmd.Flags(), msg) + }, + } + flags.AddTxFlagsToCmd(cmd) + return cmd +} + +// ReadChainInfoFromFile read the chain info from the file using os package and unmarshal it into the chain info variable +func ReadChainInfoFromFile(fsys fs.FS, filePath string) (types.ChainInfo, error) { + var chainInfo types.ChainInfo + chainInfoBytes, err := fs.ReadFile(fsys, filePath) + if err != nil { + return chainInfo, fmt.Errorf("failed to read file: %w", err) + } + + err = json.Unmarshal(chainInfoBytes, &chainInfo) + return chainInfo, err +} diff --git a/x/authority/client/cli/tx_update_chain_info_test.go b/x/authority/client/cli/tx_update_chain_info_test.go new file mode 100644 index 0000000000..95b033777f --- /dev/null +++ b/x/authority/client/cli/tx_update_chain_info_test.go @@ -0,0 +1,40 @@ +package cli_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/pkg/testdata" + "github.com/zeta-chain/zetacore/x/authority/client/cli" +) + +func TestReadChainInfoFromFile(t *testing.T) { + fs := testdata.TypesFiles + + chainInfo, err := cli.ReadChainInfoFromFile(fs, "types/chain_info.json") + require.NoError(t, err) + + require.Len(t, chainInfo.Chains, 2) + require.EqualValues(t, chains.Chain{ + ChainId: 42, + ChainName: chains.ChainName_empty, + Network: chains.Network_eth, + NetworkType: chains.NetworkType_mainnet, + Vm: chains.Vm_no_vm, + Consensus: chains.Consensus_ethereum, + IsExternal: false, + CctxGateway: chains.CCTXGateway_zevm, + }, chainInfo.Chains[0]) + require.EqualValues(t, chains.Chain{ + ChainId: 84, + ChainName: chains.ChainName_eth_mainnet, + Network: chains.Network_zeta, + NetworkType: chains.NetworkType_testnet, + Vm: chains.Vm_evm, + Consensus: chains.Consensus_tendermint, + IsExternal: true, + CctxGateway: chains.CCTXGateway_observers, + }, chainInfo.Chains[1]) +} diff --git a/x/authority/client/cli/tx_update_policies.go b/x/authority/client/cli/tx_update_policies.go index f1a4fac042..19bfe6ab4f 100644 --- a/x/authority/client/cli/tx_update_policies.go +++ b/x/authority/client/cli/tx_update_policies.go @@ -1,6 +1,9 @@ package cli import ( + "encoding/json" + "fmt" + "io/fs" "os" "github.com/cosmos/cosmos-sdk/client" @@ -17,15 +20,10 @@ func CmdUpdatePolices() *cobra.Command { Short: "Update the policies", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { - // Read the policies from the file using os package and unmarshal it into the policies variable - var policies types.Policies - policiesBytes, err := os.ReadFile(args[0]) + policies, err := ReadPoliciesFromFile(os.DirFS("."), args[0]) if err != nil { return err } - if err := policies.Unmarshal(policiesBytes); err != nil { - return err - } clientCtx, err := client.GetClientTxContext(cmd) if err != nil { @@ -43,3 +41,15 @@ func CmdUpdatePolices() *cobra.Command { flags.AddTxFlagsToCmd(cmd) return cmd } + +// ReadPoliciesFromFile read the policies from the file using os package and unmarshal it into the policies variable +func ReadPoliciesFromFile(fsys fs.FS, filePath string) (types.Policies, error) { + var policies types.Policies + policiesBytes, err := fs.ReadFile(fsys, filePath) + if err != nil { + return policies, fmt.Errorf("failed to read file: %w", err) + } + + err = json.Unmarshal(policiesBytes, &policies) + return policies, err +} diff --git a/x/authority/client/cli/tx_update_policies_test.go b/x/authority/client/cli/tx_update_policies_test.go new file mode 100644 index 0000000000..45e6813fcb --- /dev/null +++ b/x/authority/client/cli/tx_update_policies_test.go @@ -0,0 +1,32 @@ +package cli_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/pkg/testdata" + "github.com/zeta-chain/zetacore/x/authority/client/cli" + authoritytypes "github.com/zeta-chain/zetacore/x/authority/types" +) + +func TestReadPoliciesFromFile(t *testing.T) { + fs := testdata.TypesFiles + + policies, err := cli.ReadPoliciesFromFile(fs, "types/policies.json") + require.NoError(t, err) + + require.Len(t, policies.Items, 3) + require.EqualValues(t, &authoritytypes.Policy{ + PolicyType: authoritytypes.PolicyType_groupEmergency, + Address: "zeta1nl7550unvzyswx5ts9m338ufmfydjsz2g0xt74", + }, policies.Items[0]) + require.EqualValues(t, &authoritytypes.Policy{ + PolicyType: authoritytypes.PolicyType_groupOperational, + Address: "zeta1n0rn6sne54hv7w2uu93fl48ncyqz97d3kty6sh", + }, policies.Items[1]) + require.EqualValues(t, &authoritytypes.Policy{ + PolicyType: authoritytypes.PolicyType_groupAdmin, + Address: "zeta1srsq755t654agc0grpxj4y3w0znktrpr9tcdgk", + }, policies.Items[2]) +} diff --git a/x/authority/keeper/grpc_query_chain_info.go b/x/authority/keeper/grpc_query_chain_info.go new file mode 100644 index 0000000000..695fcee025 --- /dev/null +++ b/x/authority/keeper/grpc_query_chain_info.go @@ -0,0 +1,30 @@ +package keeper + +import ( + "context" + + sdk "github.com/cosmos/cosmos-sdk/types" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/zeta-chain/zetacore/x/authority/types" +) + +// ChainInfo queries chain info +func (k Keeper) ChainInfo( + c context.Context, + req *types.QueryGetChainInfoRequest, +) (*types.QueryGetChainInfoResponse, error) { + if req == nil { + return nil, status.Error(codes.InvalidArgument, "invalid request") + } + ctx := sdk.UnwrapSDKContext(c) + + // fetch chain info + chainInfo, found := k.GetChainInfo(ctx) + if !found { + return nil, status.Error(codes.NotFound, "chain info not found") + } + + return &types.QueryGetChainInfoResponse{ChainInfo: chainInfo}, nil +} diff --git a/x/authority/keeper/grpc_query_chain_info_test.go b/x/authority/keeper/grpc_query_chain_info_test.go new file mode 100644 index 0000000000..7529e27437 --- /dev/null +++ b/x/authority/keeper/grpc_query_chain_info_test.go @@ -0,0 +1,38 @@ +package keeper_test + +import ( + "testing" + + "github.com/stretchr/testify/require" + + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/authority/types" +) + +func TestKeeper_ChainInfo(t *testing.T) { + t.Run("invalid request", func(t *testing.T) { + k, ctx := keepertest.AuthorityKeeper(t) + + _, err := k.ChainInfo(ctx, nil) + require.ErrorContains(t, err, "invalid request") + }) + + t.Run("chain info not found", func(t *testing.T) { + k, ctx := keepertest.AuthorityKeeper(t) + + _, err := k.ChainInfo(ctx, &types.QueryGetChainInfoRequest{}) + require.ErrorContains(t, err, "chain info not found") + }) + + t.Run("can retrieve chain info", func(t *testing.T) { + k, ctx := keepertest.AuthorityKeeper(t) + + chainInfo := sample.ChainInfo(42) + k.SetChainInfo(ctx, chainInfo) + + res, err := k.ChainInfo(ctx, &types.QueryGetChainInfoRequest{}) + require.NoError(t, err) + require.Equal(t, chainInfo, res.ChainInfo) + }) +} diff --git a/x/authority/keeper/msg_server_update_chain_info.go b/x/authority/keeper/msg_server_update_chain_info.go new file mode 100644 index 0000000000..11cd064c2a --- /dev/null +++ b/x/authority/keeper/msg_server_update_chain_info.go @@ -0,0 +1,32 @@ +package keeper + +import ( + "context" + "fmt" + + cosmoserror "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + + "github.com/zeta-chain/zetacore/x/authority/types" +) + +// UpdateChainInfo updates the chain info structure that adds new static chain info or overwrite existing chain info +// on the hard-coded chain info +func (k msgServer) UpdateChainInfo( + goCtx context.Context, + msg *types.MsgUpdateChainInfo, +) (*types.MsgUpdateChainInfoResponse, error) { + ctx := sdk.UnwrapSDKContext(goCtx) + + // This message is only allowed to be called by group admin + // Group admin because this functionality would rarely be called + // and overwriting false chain info can have undesired effects + if !k.IsAuthorized(ctx, msg.Creator, types.PolicyType_groupAdmin) { + return nil, cosmoserror.Wrap(types.ErrUnauthorized, fmt.Sprintf("creator %s", msg.Creator)) + } + + // set chain info + k.SetChainInfo(ctx, msg.ChainInfo) + + return &types.MsgUpdateChainInfoResponse{}, nil +} diff --git a/x/authority/keeper/msg_server_update_chain_info_test.go b/x/authority/keeper/msg_server_update_chain_info_test.go new file mode 100644 index 0000000000..e9c5762940 --- /dev/null +++ b/x/authority/keeper/msg_server_update_chain_info_test.go @@ -0,0 +1,117 @@ +package keeper_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + keepertest "github.com/zeta-chain/zetacore/testutil/keeper" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/authority/keeper" + "github.com/zeta-chain/zetacore/x/authority/types" +) + +func TestMsgServer_UpdateChainInfo(t *testing.T) { + t.Run("can't update chain info if not authorized", func(t *testing.T) { + k, ctx := keepertest.AuthorityKeeper(t) + msgServer := keeper.NewMsgServerImpl(*k) + + _, err := msgServer.UpdateChainInfo(sdk.WrapSDKContext(ctx), &types.MsgUpdateChainInfo{ + Creator: sample.AccAddress(), + }) + require.ErrorIs(t, err, types.ErrUnauthorized) + }) + + t.Run("can set chain info when it doesn't exist", func(t *testing.T) { + k, ctx := keepertest.AuthorityKeeper(t) + msgServer := keeper.NewMsgServerImpl(*k) + + _, found := k.GetChainInfo(ctx) + require.False(t, found) + + // Set group admin policy + admin := sample.AccAddress() + k.SetPolicies(ctx, types.Policies{ + Items: []*types.Policy{ + { + PolicyType: types.PolicyType_groupAdmin, + Address: admin, + }, + }, + }) + chainInfo := sample.ChainInfo(42) + + _, err := msgServer.UpdateChainInfo(sdk.WrapSDKContext(ctx), &types.MsgUpdateChainInfo{ + Creator: admin, + ChainInfo: chainInfo, + }) + require.NoError(t, err) + + // Check if the chain info is set + storedChainInfo, found := k.GetChainInfo(ctx) + require.True(t, found) + require.Equal(t, chainInfo, storedChainInfo) + }) + + t.Run("can update existing chain info", func(t *testing.T) { + k, ctx := keepertest.AuthorityKeeper(t) + msgServer := keeper.NewMsgServerImpl(*k) + + k.SetChainInfo(ctx, sample.ChainInfo(42)) + + // Set group admin policy + admin := sample.AccAddress() + k.SetPolicies(ctx, types.Policies{ + Items: []*types.Policy{ + { + PolicyType: types.PolicyType_groupAdmin, + Address: admin, + }, + }, + }) + chainInfo := sample.ChainInfo(84) + + _, err := msgServer.UpdateChainInfo(sdk.WrapSDKContext(ctx), &types.MsgUpdateChainInfo{ + Creator: admin, + ChainInfo: chainInfo, + }) + require.NoError(t, err) + + // Check if the chain info is set + storedChainInfo, found := k.GetChainInfo(ctx) + require.True(t, found) + require.Equal(t, chainInfo, storedChainInfo) + }) + + t.Run("can remove chain info", func(t *testing.T) { + k, ctx := keepertest.AuthorityKeeper(t) + msgServer := keeper.NewMsgServerImpl(*k) + + k.SetChainInfo(ctx, sample.ChainInfo(42)) + + // Set group admin policy + admin := sample.AccAddress() + k.SetPolicies(ctx, types.Policies{ + Items: []*types.Policy{ + { + PolicyType: types.PolicyType_groupAdmin, + Address: admin, + }, + }, + }) + chainInfo := types.ChainInfo{} + + _, err := msgServer.UpdateChainInfo(sdk.WrapSDKContext(ctx), &types.MsgUpdateChainInfo{ + Creator: admin, + ChainInfo: chainInfo, + }) + require.NoError(t, err) + + // The structure should still exist but be empty + storedChainInfo, found := k.GetChainInfo(ctx) + require.True(t, found) + require.Equal(t, chainInfo, storedChainInfo) + }) + +} diff --git a/x/authority/keeper/msg_server_update_policies.go b/x/authority/keeper/msg_server_update_policies.go index fb31a2cad5..c7c21c0805 100644 --- a/x/authority/keeper/msg_server_update_policies.go +++ b/x/authority/keeper/msg_server_update_policies.go @@ -18,12 +18,12 @@ func (k msgServer) UpdatePolicies( ctx := sdk.UnwrapSDKContext(goCtx) // check called by governance - if k.govAddr.String() != msg.Signer { + if k.govAddr.String() != msg.Creator { return nil, errorsmod.Wrapf( govtypes.ErrInvalidSigner, "invalid authority, expected %s, got %s", k.govAddr.String(), - msg.Signer, + msg.Creator, ) } diff --git a/x/authority/keeper/msg_server_update_policies_test.go b/x/authority/keeper/msg_server_update_policies_test.go index a629ac1f33..45762edfe6 100644 --- a/x/authority/keeper/msg_server_update_policies_test.go +++ b/x/authority/keeper/msg_server_update_policies_test.go @@ -21,7 +21,7 @@ func TestMsgServer_UpdatePolicies(t *testing.T) { policies := sample.Policies() _, err := msgServer.UpdatePolicies(sdk.WrapSDKContext(ctx), &types.MsgUpdatePolicies{ - Signer: sample.AccAddress(), + Creator: sample.AccAddress(), Policies: policies, }) require.ErrorIs(t, err, govtypes.ErrInvalidSigner) @@ -34,7 +34,7 @@ func TestMsgServer_UpdatePolicies(t *testing.T) { policies := sample.Policies() res, err := msgServer.UpdatePolicies(sdk.WrapSDKContext(ctx), &types.MsgUpdatePolicies{ - Signer: keepertest.AuthorityGovAddress.String(), + Creator: keepertest.AuthorityGovAddress.String(), Policies: policies, }) require.NotNil(t, res) diff --git a/x/authority/types/codec.go b/x/authority/types/codec.go index ccb8f1e78b..0eddb04819 100644 --- a/x/authority/types/codec.go +++ b/x/authority/types/codec.go @@ -9,11 +9,13 @@ import ( func RegisterCodec(cdc *codec.LegacyAmino) { cdc.RegisterConcrete(&MsgUpdatePolicies{}, "authority/UpdatePolicies", nil) + cdc.RegisterConcrete(&MsgUpdateChainInfo{}, "authority/UpdateChainInfo", nil) } func RegisterInterfaces(registry cdctypes.InterfaceRegistry) { registry.RegisterImplementations((*sdk.Msg)(nil), &MsgUpdatePolicies{}, + &MsgUpdateChainInfo{}, ) msgservice.RegisterMsgServiceDesc(registry, &_Msg_serviceDesc) diff --git a/x/authority/types/message_update_chain_info.go b/x/authority/types/message_update_chain_info.go new file mode 100644 index 0000000000..faea9dcacb --- /dev/null +++ b/x/authority/types/message_update_chain_info.go @@ -0,0 +1,52 @@ +package types + +import ( + errorsmod "cosmossdk.io/errors" + sdk "github.com/cosmos/cosmos-sdk/types" + sdkerrors "github.com/cosmos/cosmos-sdk/types/errors" +) + +const TypeMsgUpdateChainInfo = "UpdateChainInfo" + +var _ sdk.Msg = &MsgUpdateChainInfo{} + +func NewMsgUpdateChainInfo(creator string, chainInfo ChainInfo) *MsgUpdateChainInfo { + return &MsgUpdateChainInfo{ + Creator: creator, + ChainInfo: chainInfo, + } +} + +func (msg *MsgUpdateChainInfo) Route() string { + return RouterKey +} + +func (msg *MsgUpdateChainInfo) Type() string { + return TypeMsgUpdateChainInfo +} + +func (msg *MsgUpdateChainInfo) GetSigners() []sdk.AccAddress { + signer, err := sdk.AccAddressFromBech32(msg.Creator) + if err != nil { + panic(err) + } + return []sdk.AccAddress{signer} +} + +func (msg *MsgUpdateChainInfo) GetSignBytes() []byte { + bz := ModuleCdc.MustMarshalJSON(msg) + return sdk.MustSortJSON(bz) +} + +func (msg *MsgUpdateChainInfo) ValidateBasic() error { + if _, err := sdk.AccAddressFromBech32(msg.Creator); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) + } + + // the chain information must be valid + if err := msg.ChainInfo.Validate(); err != nil { + return errorsmod.Wrapf(sdkerrors.ErrInvalidRequest, "invalid chain info: %s", err.Error()) + } + + return nil +} diff --git a/x/authority/types/message_update_chain_info_test.go b/x/authority/types/message_update_chain_info_test.go new file mode 100644 index 0000000000..5ddcf99730 --- /dev/null +++ b/x/authority/types/message_update_chain_info_test.go @@ -0,0 +1,108 @@ +package types_test + +import ( + "testing" + + sdk "github.com/cosmos/cosmos-sdk/types" + "github.com/stretchr/testify/require" + + "github.com/zeta-chain/zetacore/pkg/chains" + "github.com/zeta-chain/zetacore/testutil/sample" + "github.com/zeta-chain/zetacore/x/authority/types" +) + +func TestMsgUpdateChainInfo_ValidateBasic(t *testing.T) { + tests := []struct { + name string + msg *types.MsgUpdateChainInfo + errContains string + }{ + { + name: "valid message", + msg: types.NewMsgUpdateChainInfo(sample.AccAddress(), sample.ChainInfo(42)), + }, + { + name: "invalid creator address", + msg: types.NewMsgUpdateChainInfo("invalid", sample.ChainInfo(42)), + errContains: "invalid creator address", + }, + { + name: "invalid chain info", + msg: types.NewMsgUpdateChainInfo(sample.AccAddress(), types.ChainInfo{ + Chains: []chains.Chain{ + { + ChainId: 0, + ChainName: chains.ChainName_empty, + Network: chains.Network_optimism, + NetworkType: chains.NetworkType_testnet, + Vm: chains.Vm_evm, + Consensus: chains.Consensus_op_stack, + IsExternal: true, + }, + }, + }), + errContains: "invalid chain info", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + err := tt.msg.ValidateBasic() + if tt.errContains != "" { + require.ErrorContains(t, err, tt.errContains) + } else { + require.NoError(t, err) + } + }) + } +} + +func TestMsgUpdateChainInfo_GetSigners(t *testing.T) { + signer := sample.AccAddress() + tests := []struct { + name string + msg *types.MsgUpdateChainInfo + panics bool + }{ + { + name: "valid signer", + msg: types.NewMsgUpdateChainInfo(signer, sample.ChainInfo(42)), + panics: false, + }, + { + name: "invalid signer", + msg: types.NewMsgUpdateChainInfo("invalid", sample.ChainInfo(42)), + panics: true, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + if !tt.panics { + signers := tt.msg.GetSigners() + require.Equal(t, []sdk.AccAddress{sdk.MustAccAddressFromBech32(signer)}, signers) + } else { + require.Panics(t, func() { + tt.msg.GetSigners() + }) + } + }) + } +} + +func TestMsgUpdateChainInfo_Type(t *testing.T) { + msg := types.NewMsgUpdateChainInfo(sample.AccAddress(), sample.ChainInfo(42)) + require.Equal(t, types.TypeMsgUpdateChainInfo, msg.Type()) +} + +func TestMsgUpdateChainInfo_Route(t *testing.T) { + msg := types.NewMsgUpdateChainInfo(sample.AccAddress(), sample.ChainInfo(42)) + require.Equal(t, types.RouterKey, msg.Route()) +} + +func TestMsgUpdateChainInfo_GetSignBytes(t *testing.T) { + msg := types.NewMsgUpdateChainInfo(sample.AccAddress(), sample.ChainInfo(42)) + require.NotPanics(t, func() { + msg.GetSignBytes() + }) +} diff --git a/x/authority/types/message_update_policies.go b/x/authority/types/message_update_policies.go index e34a7fb6c3..64f2dc6e86 100644 --- a/x/authority/types/message_update_policies.go +++ b/x/authority/types/message_update_policies.go @@ -10,9 +10,9 @@ const TypeMsgUpdatePolicies = "UpdatePolicies" var _ sdk.Msg = &MsgUpdatePolicies{} -func NewMsgUpdatePolicies(signer string, policies Policies) *MsgUpdatePolicies { +func NewMsgUpdatePolicies(creator string, policies Policies) *MsgUpdatePolicies { return &MsgUpdatePolicies{ - Signer: signer, + Creator: creator, Policies: policies, } } @@ -26,7 +26,7 @@ func (msg *MsgUpdatePolicies) Type() string { } func (msg *MsgUpdatePolicies) GetSigners() []sdk.AccAddress { - creator, err := sdk.AccAddressFromBech32(msg.Signer) + creator, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { panic(err) } @@ -39,9 +39,9 @@ func (msg *MsgUpdatePolicies) GetSignBytes() []byte { } func (msg *MsgUpdatePolicies) ValidateBasic() error { - _, err := sdk.AccAddressFromBech32(msg.Signer) + _, err := sdk.AccAddressFromBech32(msg.Creator) if err != nil { - return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid signer address (%s)", err) + return errorsmod.Wrapf(sdkerrors.ErrInvalidAddress, "invalid creator address (%s)", err) } if err := msg.Policies.Validate(); err != nil { diff --git a/x/authority/types/message_update_policies_test.go b/x/authority/types/message_update_policies_test.go index 69c778c4dc..5e3b4ec707 100644 --- a/x/authority/types/message_update_policies_test.go +++ b/x/authority/types/message_update_policies_test.go @@ -4,7 +4,6 @@ import ( "testing" 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/testutil/sample" @@ -13,18 +12,18 @@ import ( func TestMsgUpdatePolicies_ValidateBasic(t *testing.T) { tests := []struct { - name string - msg *types.MsgUpdatePolicies - err error + name string + msg *types.MsgUpdatePolicies + errContains string }{ { name: "valid message", msg: types.NewMsgUpdatePolicies(sample.AccAddress(), sample.Policies()), }, { - name: "invalid creator address", - msg: types.NewMsgUpdatePolicies("invalid", sample.Policies()), - err: sdkerrors.ErrInvalidAddress, + name: "invalid creator address", + msg: types.NewMsgUpdatePolicies("invalid", sample.Policies()), + errContains: "invalid creator address", }, { name: "invalid policies", @@ -36,15 +35,15 @@ func TestMsgUpdatePolicies_ValidateBasic(t *testing.T) { }, }, }), - err: sdkerrors.ErrInvalidRequest, + errContains: "invalid policies", }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { err := tt.msg.ValidateBasic() - if tt.err != nil { - require.ErrorIs(t, err, tt.err) + if tt.errContains != "" { + require.ErrorContains(t, err, tt.errContains) } else { require.NoError(t, err) } diff --git a/x/authority/types/query.pb.go b/x/authority/types/query.pb.go index 2ba690ad0e..e9a4c227c3 100644 --- a/x/authority/types/query.pb.go +++ b/x/authority/types/query.pb.go @@ -114,9 +114,95 @@ func (m *QueryGetPoliciesResponse) GetPolicies() Policies { return Policies{} } +// QueryGetChainInfoRequest is the request type for the Query/ChainInfo RPC +// method. +type QueryGetChainInfoRequest struct { +} + +func (m *QueryGetChainInfoRequest) Reset() { *m = QueryGetChainInfoRequest{} } +func (m *QueryGetChainInfoRequest) String() string { return proto.CompactTextString(m) } +func (*QueryGetChainInfoRequest) ProtoMessage() {} +func (*QueryGetChainInfoRequest) Descriptor() ([]byte, []int) { + return fileDescriptor_5fe6130bc825be8d, []int{2} +} +func (m *QueryGetChainInfoRequest) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetChainInfoRequest) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetChainInfoRequest.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 *QueryGetChainInfoRequest) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetChainInfoRequest.Merge(m, src) +} +func (m *QueryGetChainInfoRequest) XXX_Size() int { + return m.Size() +} +func (m *QueryGetChainInfoRequest) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetChainInfoRequest.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetChainInfoRequest proto.InternalMessageInfo + +// QueryGetChainInfoResponse is the response type for the Query/ChainInfo RPC +// method. +type QueryGetChainInfoResponse struct { + ChainInfo ChainInfo `protobuf:"bytes,1,opt,name=chain_info,json=chainInfo,proto3" json:"chain_info"` +} + +func (m *QueryGetChainInfoResponse) Reset() { *m = QueryGetChainInfoResponse{} } +func (m *QueryGetChainInfoResponse) String() string { return proto.CompactTextString(m) } +func (*QueryGetChainInfoResponse) ProtoMessage() {} +func (*QueryGetChainInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_5fe6130bc825be8d, []int{3} +} +func (m *QueryGetChainInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *QueryGetChainInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_QueryGetChainInfoResponse.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 *QueryGetChainInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_QueryGetChainInfoResponse.Merge(m, src) +} +func (m *QueryGetChainInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *QueryGetChainInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_QueryGetChainInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_QueryGetChainInfoResponse proto.InternalMessageInfo + +func (m *QueryGetChainInfoResponse) GetChainInfo() ChainInfo { + if m != nil { + return m.ChainInfo + } + return ChainInfo{} +} + func init() { proto.RegisterType((*QueryGetPoliciesRequest)(nil), "zetachain.zetacore.authority.QueryGetPoliciesRequest") proto.RegisterType((*QueryGetPoliciesResponse)(nil), "zetachain.zetacore.authority.QueryGetPoliciesResponse") + proto.RegisterType((*QueryGetChainInfoRequest)(nil), "zetachain.zetacore.authority.QueryGetChainInfoRequest") + proto.RegisterType((*QueryGetChainInfoResponse)(nil), "zetachain.zetacore.authority.QueryGetChainInfoResponse") } func init() { @@ -124,28 +210,33 @@ func init() { } var fileDescriptor_5fe6130bc825be8d = []byte{ - // 323 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0xd2, 0xa8, 0x4a, 0x2d, 0x49, - 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x07, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x13, 0x4b, 0x4b, 0x32, - 0xf2, 0x8b, 0x32, 0x4b, 0x2a, 0xf5, 0x0b, 0x4b, 0x53, 0x8b, 0x2a, 0xf5, 0x0a, 0x8a, 0xf2, 0x4b, - 0xf2, 0x85, 0x64, 0xe0, 0x2a, 0xf5, 0x60, 0x2a, 0xf5, 0xe0, 0x2a, 0xa5, 0xb4, 0xf1, 0x9a, 0x53, - 0x90, 0x9f, 0x93, 0x99, 0x9c, 0x99, 0x5a, 0x0c, 0x31, 0x4a, 0x4a, 0x2b, 0x39, 0xbf, 0x38, 0x37, - 0xbf, 0x58, 0x3f, 0x29, 0xb1, 0x38, 0x15, 0x62, 0x87, 0x7e, 0x99, 0x61, 0x52, 0x6a, 0x49, 0xa2, - 0xa1, 0x7e, 0x41, 0x62, 0x7a, 0x66, 0x5e, 0x62, 0x49, 0x66, 0x7e, 0x1e, 0x54, 0xad, 0x48, 0x7a, - 0x7e, 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x45, 0x65, 0xd2, 0xf3, 0xf3, 0xd3, 0x73, 0x52, - 0xf5, 0x13, 0x0b, 0x32, 0xf5, 0x13, 0xf3, 0xf2, 0xf2, 0x4b, 0xc0, 0x5a, 0xa0, 0xe6, 0x2b, 0x49, - 0x72, 0x89, 0x07, 0x82, 0x4c, 0x75, 0x4f, 0x2d, 0x09, 0x80, 0xda, 0x1c, 0x94, 0x5a, 0x58, 0x9a, - 0x5a, 0x5c, 0xa2, 0x94, 0xc2, 0x25, 0x81, 0x29, 0x55, 0x5c, 0x90, 0x9f, 0x57, 0x9c, 0x2a, 0xe4, - 0xc1, 0xc5, 0x01, 0x73, 0xa8, 0x04, 0xa3, 0x02, 0xa3, 0x06, 0xb7, 0x91, 0x9a, 0x1e, 0x3e, 0x4f, - 0xeb, 0xc1, 0x4c, 0x70, 0x62, 0x39, 0x71, 0x4f, 0x9e, 0x21, 0x08, 0xae, 0xdb, 0x68, 0x35, 0x23, - 0x17, 0x2b, 0xd8, 0x1a, 0xa1, 0x85, 0x8c, 0x5c, 0x1c, 0x30, 0x65, 0x42, 0xa6, 0xf8, 0x8d, 0xc3, - 0xe1, 0x66, 0x29, 0x33, 0x52, 0xb5, 0x41, 0xfc, 0xa3, 0xa4, 0xd6, 0x74, 0xf9, 0xc9, 0x64, 0x26, - 0x05, 0x21, 0x39, 0x70, 0x94, 0xe8, 0x42, 0x62, 0x07, 0x33, 0x52, 0x9c, 0xbc, 0x4e, 0x3c, 0x92, - 0x63, 0xbc, 0xf0, 0x48, 0x8e, 0xf1, 0xc1, 0x23, 0x39, 0xc6, 0x09, 0x8f, 0xe5, 0x18, 0x2e, 0x3c, - 0x96, 0x63, 0xb8, 0xf1, 0x58, 0x8e, 0x21, 0xca, 0x20, 0x3d, 0xb3, 0x24, 0xa3, 0x34, 0x49, 0x2f, - 0x39, 0x3f, 0x17, 0xd9, 0x0c, 0x78, 0x0c, 0x57, 0x20, 0x19, 0x57, 0x52, 0x59, 0x90, 0x5a, 0x9c, - 0xc4, 0x06, 0x8e, 0x01, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0x3c, 0xf1, 0xad, 0x7a, 0x58, - 0x02, 0x00, 0x00, + // 403 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x93, 0x4f, 0xcf, 0xd2, 0x40, + 0x10, 0xc6, 0x5b, 0xa2, 0x06, 0xd6, 0xdb, 0xc6, 0x44, 0x68, 0x48, 0xc1, 0x1e, 0x80, 0x68, 0xe8, + 0x0a, 0x46, 0xbd, 0xe3, 0xc1, 0x3f, 0xf1, 0xa0, 0x1c, 0xbd, 0x98, 0x6d, 0x5d, 0xca, 0x26, 0xb0, + 0x53, 0xba, 0x5b, 0x23, 0x1e, 0xfd, 0x04, 0x26, 0x7e, 0x02, 0x0f, 0x7e, 0x17, 0x8e, 0x24, 0x5c, + 0x3c, 0x19, 0x03, 0x7e, 0x10, 0xc3, 0x76, 0x5b, 0xc8, 0x0b, 0x6f, 0xf3, 0x72, 0x9b, 0xec, 0x3c, + 0xf3, 0xcc, 0x6f, 0x26, 0xb3, 0xa8, 0xf7, 0x95, 0x29, 0x1a, 0x4e, 0x29, 0x17, 0x44, 0x47, 0x90, + 0x30, 0x42, 0x53, 0x35, 0x85, 0x84, 0xab, 0x25, 0x59, 0xa4, 0x2c, 0x59, 0xfa, 0x71, 0x02, 0x0a, + 0x70, 0xb3, 0x50, 0xfa, 0xb9, 0xd2, 0x2f, 0x94, 0xce, 0xa3, 0x52, 0x9f, 0x18, 0x66, 0x3c, 0xe4, + 0x4c, 0x66, 0x56, 0x4e, 0xbf, 0x54, 0xac, 0x13, 0x1f, 0xb9, 0x98, 0x80, 0x91, 0x3f, 0x0c, 0x41, + 0xce, 0x41, 0x92, 0x80, 0x4a, 0x96, 0x21, 0x91, 0xcf, 0x83, 0x80, 0x29, 0x3a, 0x20, 0x31, 0x8d, + 0xb8, 0xa0, 0x8a, 0x83, 0x30, 0xda, 0x7b, 0x11, 0x44, 0xa0, 0x43, 0xb2, 0x8f, 0xcc, 0x6b, 0x33, + 0x02, 0x88, 0x66, 0x8c, 0xd0, 0x98, 0x13, 0x2a, 0x04, 0x28, 0x5d, 0x62, 0x70, 0xbc, 0x06, 0xba, + 0xff, 0x7e, 0xef, 0xfa, 0x92, 0xa9, 0x77, 0x06, 0x74, 0xcc, 0x16, 0x29, 0x93, 0xca, 0xfb, 0x84, + 0xea, 0xa7, 0x29, 0x19, 0x83, 0x90, 0x0c, 0xbf, 0x42, 0xd5, 0x7c, 0xae, 0xba, 0xdd, 0xb6, 0x7b, + 0x77, 0x87, 0x1d, 0xbf, 0x6c, 0x47, 0x7e, 0xee, 0x30, 0xba, 0xb5, 0xfa, 0xd3, 0xb2, 0xc6, 0x45, + 0xb5, 0xe7, 0x1c, 0xba, 0xbc, 0xd8, 0x17, 0xbf, 0x16, 0x13, 0xc8, 0x09, 0x38, 0x6a, 0x9c, 0xc9, + 0x19, 0x84, 0xb7, 0x08, 0x1d, 0xb6, 0x65, 0x20, 0xba, 0xe5, 0x10, 0x85, 0x89, 0xa1, 0xa8, 0x85, + 0xf9, 0xc3, 0x70, 0x53, 0x41, 0xb7, 0x75, 0x2f, 0xfc, 0xd3, 0x46, 0xd5, 0x9c, 0x16, 0x3f, 0x2d, + 0x37, 0xbc, 0x66, 0x75, 0xce, 0xb3, 0x4b, 0xcb, 0xb2, 0x99, 0xbc, 0xce, 0xb7, 0xcd, 0xbf, 0x1f, + 0x95, 0x36, 0x76, 0xf5, 0x6d, 0xf4, 0xb3, 0x33, 0x39, 0x3d, 0x25, 0xfc, 0xcb, 0x46, 0xb5, 0x62, + 0x18, 0x7c, 0xc3, 0x6e, 0x57, 0xd7, 0xeb, 0x3c, 0xbf, 0xb8, 0xce, 0x60, 0x76, 0x35, 0xe6, 0x03, + 0xdc, 0x3a, 0x8f, 0x59, 0x6c, 0x75, 0xf4, 0x66, 0xb5, 0x75, 0xed, 0xf5, 0xd6, 0xb5, 0xff, 0x6e, + 0x5d, 0xfb, 0xfb, 0xce, 0xb5, 0xd6, 0x3b, 0xd7, 0xfa, 0xbd, 0x73, 0xad, 0x0f, 0x8f, 0x23, 0xae, + 0xa6, 0x69, 0xe0, 0x87, 0x30, 0x3f, 0x36, 0x29, 0xbe, 0xc4, 0x97, 0x23, 0x3f, 0xb5, 0x8c, 0x99, + 0x0c, 0xee, 0xe8, 0x83, 0x7d, 0xf2, 0x3f, 0x00, 0x00, 0xff, 0xff, 0xc1, 0xd1, 0x6c, 0x32, 0xb6, + 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -162,6 +253,8 @@ const _ = grpc.SupportPackageIsVersion4 type QueryClient interface { // Queries Policies Policies(ctx context.Context, in *QueryGetPoliciesRequest, opts ...grpc.CallOption) (*QueryGetPoliciesResponse, error) + // Queries ChainInfo + ChainInfo(ctx context.Context, in *QueryGetChainInfoRequest, opts ...grpc.CallOption) (*QueryGetChainInfoResponse, error) } type queryClient struct { @@ -181,10 +274,21 @@ func (c *queryClient) Policies(ctx context.Context, in *QueryGetPoliciesRequest, return out, nil } +func (c *queryClient) ChainInfo(ctx context.Context, in *QueryGetChainInfoRequest, opts ...grpc.CallOption) (*QueryGetChainInfoResponse, error) { + out := new(QueryGetChainInfoResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.authority.Query/ChainInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // QueryServer is the server API for Query service. type QueryServer interface { // Queries Policies Policies(context.Context, *QueryGetPoliciesRequest) (*QueryGetPoliciesResponse, error) + // Queries ChainInfo + ChainInfo(context.Context, *QueryGetChainInfoRequest) (*QueryGetChainInfoResponse, error) } // UnimplementedQueryServer can be embedded to have forward compatible implementations. @@ -194,6 +298,9 @@ type UnimplementedQueryServer struct { func (*UnimplementedQueryServer) Policies(ctx context.Context, req *QueryGetPoliciesRequest) (*QueryGetPoliciesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method Policies not implemented") } +func (*UnimplementedQueryServer) ChainInfo(ctx context.Context, req *QueryGetChainInfoRequest) (*QueryGetChainInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method ChainInfo not implemented") +} func RegisterQueryServer(s grpc1.Server, srv QueryServer) { s.RegisterService(&_Query_serviceDesc, srv) @@ -217,6 +324,24 @@ func _Query_Policies_Handler(srv interface{}, ctx context.Context, dec func(inte return interceptor(ctx, in, info, handler) } +func _Query_ChainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(QueryGetChainInfoRequest) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(QueryServer).ChainInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.authority.Query/ChainInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(QueryServer).ChainInfo(ctx, req.(*QueryGetChainInfoRequest)) + } + return interceptor(ctx, in, info, handler) +} + var _Query_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.authority.Query", HandlerType: (*QueryServer)(nil), @@ -225,6 +350,10 @@ var _Query_serviceDesc = grpc.ServiceDesc{ MethodName: "Policies", Handler: _Query_Policies_Handler, }, + { + MethodName: "ChainInfo", + Handler: _Query_ChainInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "zetachain/zetacore/authority/query.proto", @@ -286,6 +415,62 @@ func (m *QueryGetPoliciesResponse) MarshalToSizedBuffer(dAtA []byte) (int, error return len(dAtA) - i, nil } +func (m *QueryGetChainInfoRequest) 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 *QueryGetChainInfoRequest) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetChainInfoRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + +func (m *QueryGetChainInfoResponse) 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 *QueryGetChainInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *QueryGetChainInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ChainInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintQuery(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0xa + return len(dAtA) - i, nil +} + func encodeVarintQuery(dAtA []byte, offset int, v uint64) int { offset -= sovQuery(v) base := offset @@ -317,6 +502,26 @@ func (m *QueryGetPoliciesResponse) Size() (n int) { return n } +func (m *QueryGetChainInfoRequest) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + +func (m *QueryGetChainInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = m.ChainInfo.Size() + n += 1 + l + sovQuery(uint64(l)) + return n +} + func sovQuery(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -456,6 +661,139 @@ func (m *QueryGetPoliciesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *QueryGetChainInfoRequest) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetChainInfoRequest: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetChainInfoRequest: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *QueryGetChainInfoResponse) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: QueryGetChainInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: QueryGetChainInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowQuery + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthQuery + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthQuery + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ChainInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipQuery(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthQuery + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipQuery(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 diff --git a/x/authority/types/query.pb.gw.go b/x/authority/types/query.pb.gw.go index 36125dc5f5..f465e4750f 100644 --- a/x/authority/types/query.pb.gw.go +++ b/x/authority/types/query.pb.gw.go @@ -51,6 +51,24 @@ func local_request_Query_Policies_0(ctx context.Context, marshaler runtime.Marsh } +func request_Query_ChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, client QueryClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetChainInfoRequest + var metadata runtime.ServerMetadata + + msg, err := client.ChainInfo(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD)) + return msg, metadata, err + +} + +func local_request_Query_ChainInfo_0(ctx context.Context, marshaler runtime.Marshaler, server QueryServer, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) { + var protoReq QueryGetChainInfoRequest + var metadata runtime.ServerMetadata + + msg, err := server.ChainInfo(ctx, &protoReq) + return msg, metadata, err + +} + // RegisterQueryHandlerServer registers the http handlers for service Query to "mux". // UnaryRPC :call QueryServer directly. // StreamingRPC :currently unsupported pending https://github.com/grpc/grpc-go/issues/906. @@ -80,6 +98,29 @@ func RegisterQueryHandlerServer(ctx context.Context, mux *runtime.ServeMux, serv }) + mux.Handle("GET", pattern_Query_ChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + var stream runtime.ServerTransportStream + ctx = grpc.NewContextWithServerTransportStream(ctx, &stream) + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateIncomingContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := local_request_Query_ChainInfo_0(rctx, inboundMarshaler, server, req, pathParams) + md.HeaderMD, md.TrailerMD = metadata.Join(md.HeaderMD, stream.Header()), metadata.Join(md.TrailerMD, stream.Trailer()) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } @@ -141,13 +182,37 @@ func RegisterQueryHandlerClient(ctx context.Context, mux *runtime.ServeMux, clie }) + mux.Handle("GET", pattern_Query_ChainInfo_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) { + ctx, cancel := context.WithCancel(req.Context()) + defer cancel() + inboundMarshaler, outboundMarshaler := runtime.MarshalerForRequest(mux, req) + rctx, err := runtime.AnnotateContext(ctx, mux, req) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + resp, md, err := request_Query_ChainInfo_0(rctx, inboundMarshaler, client, req, pathParams) + ctx = runtime.NewServerMetadataContext(ctx, md) + if err != nil { + runtime.HTTPError(ctx, mux, outboundMarshaler, w, req, err) + return + } + + forward_Query_ChainInfo_0(ctx, mux, outboundMarshaler, w, req, resp, mux.GetForwardResponseOptions()...) + + }) + return nil } var ( pattern_Query_Policies_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "authority", "policies"}, "", runtime.AssumeColonVerbOpt(false))) + + pattern_Query_ChainInfo_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"zeta-chain", "authority", "chainInfo"}, "", runtime.AssumeColonVerbOpt(false))) ) var ( forward_Query_Policies_0 = runtime.ForwardResponseMessage + + forward_Query_ChainInfo_0 = runtime.ForwardResponseMessage ) diff --git a/x/authority/types/tx.pb.go b/x/authority/types/tx.pb.go index b27b2cfa20..4dd5469876 100644 --- a/x/authority/types/tx.pb.go +++ b/x/authority/types/tx.pb.go @@ -30,7 +30,7 @@ const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package // MsgUpdatePolicies defines the MsgUpdatePolicies service. type MsgUpdatePolicies struct { - Signer string `protobuf:"bytes,1,opt,name=signer,proto3" json:"signer,omitempty"` + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` Policies Policies `protobuf:"bytes,2,opt,name=policies,proto3" json:"policies"` } @@ -67,9 +67,9 @@ func (m *MsgUpdatePolicies) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdatePolicies proto.InternalMessageInfo -func (m *MsgUpdatePolicies) GetSigner() string { +func (m *MsgUpdatePolicies) GetCreator() string { if m != nil { - return m.Signer + return m.Creator } return "" } @@ -118,9 +118,101 @@ func (m *MsgUpdatePoliciesResponse) XXX_DiscardUnknown() { var xxx_messageInfo_MsgUpdatePoliciesResponse proto.InternalMessageInfo +// MsgUpdateChainInfo defines the MsgUpdateChainInfo service. +type MsgUpdateChainInfo struct { + Creator string `protobuf:"bytes,1,opt,name=creator,proto3" json:"creator,omitempty"` + ChainInfo ChainInfo `protobuf:"bytes,2,opt,name=chain_info,json=chainInfo,proto3" json:"chain_info"` +} + +func (m *MsgUpdateChainInfo) Reset() { *m = MsgUpdateChainInfo{} } +func (m *MsgUpdateChainInfo) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateChainInfo) ProtoMessage() {} +func (*MsgUpdateChainInfo) Descriptor() ([]byte, []int) { + return fileDescriptor_42e081863c477116, []int{2} +} +func (m *MsgUpdateChainInfo) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateChainInfo) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateChainInfo.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 *MsgUpdateChainInfo) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateChainInfo.Merge(m, src) +} +func (m *MsgUpdateChainInfo) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateChainInfo) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateChainInfo.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateChainInfo proto.InternalMessageInfo + +func (m *MsgUpdateChainInfo) GetCreator() string { + if m != nil { + return m.Creator + } + return "" +} + +func (m *MsgUpdateChainInfo) GetChainInfo() ChainInfo { + if m != nil { + return m.ChainInfo + } + return ChainInfo{} +} + +// MsgUpdateChainInfoResponse defines the MsgUpdateChainInfoResponse service. +type MsgUpdateChainInfoResponse struct { +} + +func (m *MsgUpdateChainInfoResponse) Reset() { *m = MsgUpdateChainInfoResponse{} } +func (m *MsgUpdateChainInfoResponse) String() string { return proto.CompactTextString(m) } +func (*MsgUpdateChainInfoResponse) ProtoMessage() {} +func (*MsgUpdateChainInfoResponse) Descriptor() ([]byte, []int) { + return fileDescriptor_42e081863c477116, []int{3} +} +func (m *MsgUpdateChainInfoResponse) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *MsgUpdateChainInfoResponse) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + if deterministic { + return xxx_messageInfo_MsgUpdateChainInfoResponse.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 *MsgUpdateChainInfoResponse) XXX_Merge(src proto.Message) { + xxx_messageInfo_MsgUpdateChainInfoResponse.Merge(m, src) +} +func (m *MsgUpdateChainInfoResponse) XXX_Size() int { + return m.Size() +} +func (m *MsgUpdateChainInfoResponse) XXX_DiscardUnknown() { + xxx_messageInfo_MsgUpdateChainInfoResponse.DiscardUnknown(m) +} + +var xxx_messageInfo_MsgUpdateChainInfoResponse proto.InternalMessageInfo + func init() { proto.RegisterType((*MsgUpdatePolicies)(nil), "zetachain.zetacore.authority.MsgUpdatePolicies") proto.RegisterType((*MsgUpdatePoliciesResponse)(nil), "zetachain.zetacore.authority.MsgUpdatePoliciesResponse") + proto.RegisterType((*MsgUpdateChainInfo)(nil), "zetachain.zetacore.authority.MsgUpdateChainInfo") + proto.RegisterType((*MsgUpdateChainInfoResponse)(nil), "zetachain.zetacore.authority.MsgUpdateChainInfoResponse") } func init() { @@ -128,24 +220,28 @@ func init() { } var fileDescriptor_42e081863c477116 = []byte{ - // 261 bytes of a gzipped FileDescriptorProto + // 336 bytes of a gzipped FileDescriptorProto 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xe2, 0x52, 0xad, 0x4a, 0x2d, 0x49, 0x4c, 0xce, 0x48, 0xcc, 0xcc, 0xd3, 0x07, 0xb3, 0xf2, 0x8b, 0x52, 0xf5, 0x13, 0x4b, 0x4b, 0x32, 0xf2, 0x8b, 0x32, 0x4b, 0x2a, 0xf5, 0x4b, 0x2a, 0xf4, 0x0a, 0x8a, 0xf2, 0x4b, 0xf2, 0x85, 0x64, 0xe0, 0xca, 0xf4, 0x60, 0xca, 0xf4, 0xe0, 0xca, 0xa4, 0xb4, 0xf1, 0x1a, 0x52, 0x90, 0x9f, 0x93, - 0x99, 0x9c, 0x99, 0x5a, 0x0c, 0x31, 0x4a, 0x4a, 0x24, 0x3d, 0x3f, 0x3d, 0x1f, 0xcc, 0xd4, 0x07, - 0xb1, 0x20, 0xa2, 0x4a, 0xa5, 0x5c, 0x82, 0xbe, 0xc5, 0xe9, 0xa1, 0x05, 0x29, 0x89, 0x25, 0xa9, - 0x01, 0x50, 0x0d, 0x42, 0x62, 0x5c, 0x6c, 0xc5, 0x99, 0xe9, 0x79, 0xa9, 0x45, 0x12, 0x8c, 0x0a, - 0x8c, 0x1a, 0x9c, 0x41, 0x50, 0x9e, 0x90, 0x07, 0x17, 0x07, 0xcc, 0x50, 0x09, 0x26, 0x05, 0x46, - 0x0d, 0x6e, 0x23, 0x35, 0x3d, 0x7c, 0x0e, 0xd4, 0x83, 0x99, 0xe8, 0xc4, 0x72, 0xe2, 0x9e, 0x3c, - 0x43, 0x10, 0x5c, 0xb7, 0x92, 0x34, 0x97, 0x24, 0x86, 0xb5, 0x41, 0xa9, 0xc5, 0x05, 0xf9, 0x79, - 0xc5, 0xa9, 0x46, 0x8d, 0x8c, 0x5c, 0xcc, 0xbe, 0xc5, 0xe9, 0x42, 0x55, 0x5c, 0x7c, 0x68, 0x0e, - 0xd3, 0xc7, 0x6f, 0x1d, 0x86, 0x91, 0x52, 0xe6, 0x24, 0x6a, 0x80, 0xb9, 0xc1, 0xc9, 0xeb, 0xc4, - 0x23, 0x39, 0xc6, 0x0b, 0x8f, 0xe4, 0x18, 0x1f, 0x3c, 0x92, 0x63, 0x9c, 0xf0, 0x58, 0x8e, 0xe1, - 0xc2, 0x63, 0x39, 0x86, 0x1b, 0x8f, 0xe5, 0x18, 0xa2, 0x0c, 0xd2, 0x33, 0x4b, 0x32, 0x4a, 0x93, - 0xf4, 0x92, 0xf3, 0x73, 0xc1, 0xa1, 0xae, 0x8b, 0x16, 0x01, 0x15, 0xc8, 0xf1, 0x58, 0x59, 0x90, - 0x5a, 0x9c, 0xc4, 0x06, 0x0e, 0x6a, 0x63, 0x40, 0x00, 0x00, 0x00, 0xff, 0xff, 0xdc, 0x18, 0x8a, - 0x31, 0xf4, 0x01, 0x00, 0x00, + 0x99, 0x9c, 0x99, 0x5a, 0x0c, 0x31, 0x4a, 0x4a, 0x17, 0xaf, 0x62, 0xb0, 0x44, 0x7c, 0x66, 0x5e, + 0x5a, 0x3e, 0x54, 0xb9, 0x48, 0x7a, 0x7e, 0x7a, 0x3e, 0x98, 0xa9, 0x0f, 0x62, 0x41, 0x44, 0x95, + 0xca, 0xb9, 0x04, 0x7d, 0x8b, 0xd3, 0x43, 0x0b, 0x52, 0x12, 0x4b, 0x52, 0x03, 0xa0, 0xe6, 0x0b, + 0x49, 0x70, 0xb1, 0x27, 0x17, 0xa5, 0x26, 0x96, 0xe4, 0x17, 0x49, 0x30, 0x2a, 0x30, 0x6a, 0x70, + 0x06, 0xc1, 0xb8, 0x42, 0x1e, 0x5c, 0x1c, 0x30, 0x57, 0x48, 0x30, 0x29, 0x30, 0x6a, 0x70, 0x1b, + 0xa9, 0xe9, 0xe1, 0xf3, 0x91, 0x1e, 0xcc, 0x4c, 0x27, 0x96, 0x13, 0xf7, 0xe4, 0x19, 0x82, 0xe0, + 0xba, 0x95, 0xa4, 0xb9, 0x24, 0x31, 0x2c, 0x0e, 0x4a, 0x2d, 0x2e, 0xc8, 0xcf, 0x2b, 0x4e, 0x55, + 0xaa, 0xe1, 0x12, 0x82, 0x4b, 0x3a, 0x83, 0x8c, 0xf6, 0xcc, 0x4b, 0xcb, 0xc7, 0xe3, 0x2c, 0x1f, + 0x2e, 0x2e, 0x84, 0x7f, 0xa1, 0x0e, 0x53, 0xc7, 0xef, 0x30, 0xb8, 0xb1, 0x50, 0x97, 0x71, 0x26, + 0xc3, 0x04, 0x94, 0x64, 0xb8, 0xa4, 0x30, 0x6d, 0x87, 0xb9, 0xcd, 0xa8, 0x81, 0x89, 0x8b, 0xd9, + 0xb7, 0x38, 0x5d, 0xa8, 0x8a, 0x8b, 0x0f, 0x2d, 0xd8, 0xf4, 0xf1, 0xdb, 0x88, 0xe1, 0x5d, 0x29, + 0x73, 0x12, 0x35, 0xc0, 0xdc, 0x20, 0x54, 0xcb, 0xc5, 0x8f, 0x1e, 0x38, 0x06, 0x44, 0x9a, 0x05, + 0xd7, 0x21, 0x65, 0x41, 0xaa, 0x0e, 0x98, 0xf5, 0x4e, 0x5e, 0x27, 0x1e, 0xc9, 0x31, 0x5e, 0x78, + 0x24, 0xc7, 0xf8, 0xe0, 0x91, 0x1c, 0xe3, 0x84, 0xc7, 0x72, 0x0c, 0x17, 0x1e, 0xcb, 0x31, 0xdc, + 0x78, 0x2c, 0xc7, 0x10, 0x65, 0x90, 0x9e, 0x59, 0x92, 0x51, 0x9a, 0xa4, 0x97, 0x9c, 0x9f, 0x0b, + 0x4e, 0x94, 0xba, 0x68, 0xe9, 0xb3, 0x02, 0x39, 0x4f, 0x54, 0x16, 0xa4, 0x16, 0x27, 0xb1, 0x81, + 0xd3, 0xa1, 0x31, 0x20, 0x00, 0x00, 0xff, 0xff, 0x42, 0xb9, 0x95, 0xf6, 0x40, 0x03, 0x00, 0x00, } // Reference imports to suppress errors if they are not otherwise used. @@ -161,6 +257,7 @@ const _ = grpc.SupportPackageIsVersion4 // For semantics around ctx use and closing/ending streaming RPCs, please refer to https://godoc.org/google.golang.org/grpc#ClientConn.NewStream. type MsgClient interface { UpdatePolicies(ctx context.Context, in *MsgUpdatePolicies, opts ...grpc.CallOption) (*MsgUpdatePoliciesResponse, error) + UpdateChainInfo(ctx context.Context, in *MsgUpdateChainInfo, opts ...grpc.CallOption) (*MsgUpdateChainInfoResponse, error) } type msgClient struct { @@ -180,9 +277,19 @@ func (c *msgClient) UpdatePolicies(ctx context.Context, in *MsgUpdatePolicies, o return out, nil } +func (c *msgClient) UpdateChainInfo(ctx context.Context, in *MsgUpdateChainInfo, opts ...grpc.CallOption) (*MsgUpdateChainInfoResponse, error) { + out := new(MsgUpdateChainInfoResponse) + err := c.cc.Invoke(ctx, "/zetachain.zetacore.authority.Msg/UpdateChainInfo", in, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + // MsgServer is the server API for Msg service. type MsgServer interface { UpdatePolicies(context.Context, *MsgUpdatePolicies) (*MsgUpdatePoliciesResponse, error) + UpdateChainInfo(context.Context, *MsgUpdateChainInfo) (*MsgUpdateChainInfoResponse, error) } // UnimplementedMsgServer can be embedded to have forward compatible implementations. @@ -192,6 +299,9 @@ type UnimplementedMsgServer struct { func (*UnimplementedMsgServer) UpdatePolicies(ctx context.Context, req *MsgUpdatePolicies) (*MsgUpdatePoliciesResponse, error) { return nil, status.Errorf(codes.Unimplemented, "method UpdatePolicies not implemented") } +func (*UnimplementedMsgServer) UpdateChainInfo(ctx context.Context, req *MsgUpdateChainInfo) (*MsgUpdateChainInfoResponse, error) { + return nil, status.Errorf(codes.Unimplemented, "method UpdateChainInfo not implemented") +} func RegisterMsgServer(s grpc1.Server, srv MsgServer) { s.RegisterService(&_Msg_serviceDesc, srv) @@ -215,6 +325,24 @@ func _Msg_UpdatePolicies_Handler(srv interface{}, ctx context.Context, dec func( return interceptor(ctx, in, info, handler) } +func _Msg_UpdateChainInfo_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) { + in := new(MsgUpdateChainInfo) + if err := dec(in); err != nil { + return nil, err + } + if interceptor == nil { + return srv.(MsgServer).UpdateChainInfo(ctx, in) + } + info := &grpc.UnaryServerInfo{ + Server: srv, + FullMethod: "/zetachain.zetacore.authority.Msg/UpdateChainInfo", + } + handler := func(ctx context.Context, req interface{}) (interface{}, error) { + return srv.(MsgServer).UpdateChainInfo(ctx, req.(*MsgUpdateChainInfo)) + } + return interceptor(ctx, in, info, handler) +} + var _Msg_serviceDesc = grpc.ServiceDesc{ ServiceName: "zetachain.zetacore.authority.Msg", HandlerType: (*MsgServer)(nil), @@ -223,6 +351,10 @@ var _Msg_serviceDesc = grpc.ServiceDesc{ MethodName: "UpdatePolicies", Handler: _Msg_UpdatePolicies_Handler, }, + { + MethodName: "UpdateChainInfo", + Handler: _Msg_UpdateChainInfo_Handler, + }, }, Streams: []grpc.StreamDesc{}, Metadata: "zetachain/zetacore/authority/tx.proto", @@ -258,10 +390,10 @@ func (m *MsgUpdatePolicies) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x12 - if len(m.Signer) > 0 { - i -= len(m.Signer) - copy(dAtA[i:], m.Signer) - i = encodeVarintTx(dAtA, i, uint64(len(m.Signer))) + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) i-- dAtA[i] = 0xa } @@ -291,6 +423,69 @@ func (m *MsgUpdatePoliciesResponse) MarshalToSizedBuffer(dAtA []byte) (int, erro return len(dAtA) - i, nil } +func (m *MsgUpdateChainInfo) 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 *MsgUpdateChainInfo) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateChainInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + { + size, err := m.ChainInfo.MarshalToSizedBuffer(dAtA[:i]) + if err != nil { + return 0, err + } + i -= size + i = encodeVarintTx(dAtA, i, uint64(size)) + } + i-- + dAtA[i] = 0x12 + if len(m.Creator) > 0 { + i -= len(m.Creator) + copy(dAtA[i:], m.Creator) + i = encodeVarintTx(dAtA, i, uint64(len(m.Creator))) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *MsgUpdateChainInfoResponse) 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 *MsgUpdateChainInfoResponse) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *MsgUpdateChainInfoResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + _ = i + var l int + _ = l + return len(dAtA) - i, nil +} + func encodeVarintTx(dAtA []byte, offset int, v uint64) int { offset -= sovTx(v) base := offset @@ -308,7 +503,7 @@ func (m *MsgUpdatePolicies) Size() (n int) { } var l int _ = l - l = len(m.Signer) + l = len(m.Creator) if l > 0 { n += 1 + l + sovTx(uint64(l)) } @@ -326,6 +521,30 @@ func (m *MsgUpdatePoliciesResponse) Size() (n int) { return n } +func (m *MsgUpdateChainInfo) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + l = len(m.Creator) + if l > 0 { + n += 1 + l + sovTx(uint64(l)) + } + l = m.ChainInfo.Size() + n += 1 + l + sovTx(uint64(l)) + return n +} + +func (m *MsgUpdateChainInfoResponse) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + return n +} + func sovTx(x uint64) (n int) { return (math_bits.Len64(x|1) + 6) / 7 } @@ -363,7 +582,7 @@ func (m *MsgUpdatePolicies) Unmarshal(dAtA []byte) error { switch fieldNum { case 1: if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signer", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) } var stringLen uint64 for shift := uint(0); ; shift += 7 { @@ -391,7 +610,7 @@ func (m *MsgUpdatePolicies) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - m.Signer = string(dAtA[iNdEx:postIndex]) + m.Creator = string(dAtA[iNdEx:postIndex]) iNdEx = postIndex case 2: if wireType != 2 { @@ -497,6 +716,171 @@ func (m *MsgUpdatePoliciesResponse) Unmarshal(dAtA []byte) error { } return nil } +func (m *MsgUpdateChainInfo) 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 ErrIntOverflowTx + } + 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: MsgUpdateChainInfo: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateChainInfo: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + case 1: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field Creator", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + 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 ErrInvalidLengthTx + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.Creator = string(dAtA[iNdEx:postIndex]) + iNdEx = postIndex + case 2: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ChainInfo", wireType) + } + var msglen int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowTx + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + msglen |= int(b&0x7F) << shift + if b < 0x80 { + break + } + } + if msglen < 0 { + return ErrInvalidLengthTx + } + postIndex := iNdEx + msglen + if postIndex < 0 { + return ErrInvalidLengthTx + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + if err := m.ChainInfo.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { + return err + } + iNdEx = postIndex + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *MsgUpdateChainInfoResponse) 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 ErrIntOverflowTx + } + 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: MsgUpdateChainInfoResponse: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: MsgUpdateChainInfoResponse: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { + default: + iNdEx = preIndex + skippy, err := skipTx(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthTx + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} func skipTx(dAtA []byte) (n int, err error) { l := len(dAtA) iNdEx := 0 From 14c17443fcfc8d90b8202821930063d62738eb20 Mon Sep 17 00:00:00 2001 From: Charlie Chen <34498985+ws4charlie@users.noreply.github.com> Date: Thu, 30 May 2024 09:56:56 -0500 Subject: [PATCH 3/6] fix: try fixing E2E `crosschain_swap` failure (#2266) * try fixing E2E crosschain_swap failure * added changelog entry * added log prints to crosschain_swap E2E test * filter by deployer address when listing UTXOs * filter UTXOs by amount in E2E test to avoid 'not enough input amount' * revert the log prints for debugging * remove panic from btc runner method ListDeployerUTXOs() * added comments to ListDeployerUTXOs method and places it is used --------- Co-authored-by: Lucas Bertrand --- changelog.md | 1 + e2e/e2etests/test_crosschain_swap.go | 22 +++---------- e2e/runner/bitcoin.go | 49 ++++++++++++++++++++-------- 3 files changed, 41 insertions(+), 31 deletions(-) diff --git a/changelog.md b/changelog.md index 2776b6c1a9..4c371f2c87 100644 --- a/changelog.md +++ b/changelog.md @@ -44,6 +44,7 @@ * [2184](https://github.com/zeta-chain/node/pull/2184) - add tx priority checks to e2e tests * [2199](https://github.com/zeta-chain/node/pull/2199) - custom priority mempool unit tests * [2240](https://github.com/zeta-chain/node/pull/2240) - removed hard-coded Bitcoin regnet chainID in E2E withdraw tests +* [2266](https://github.com/zeta-chain/node/pull/2266) - try fixing E2E test `crosschain_swap` failure `btc transaction not signed` ### Fixes diff --git a/e2e/e2etests/test_crosschain_swap.go b/e2e/e2etests/test_crosschain_swap.go index ef5680b331..cb74056710 100644 --- a/e2e/e2etests/test_crosschain_swap.go +++ b/e2e/e2etests/test_crosschain_swap.go @@ -137,7 +137,8 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { r.Logger.Info("cctx2 outbound tx hash %s", cctx2.GetCurrentOutboundParam().Hash) r.Logger.Info("******* Second test: BTC -> ERC20ZRC20") - utxos, err := r.BtcRPCClient.ListUnspent() + // list deployer utxos that have at least 1 BTC + utxos, err := r.ListDeployerUTXOs(1.0) if err != nil { panic(err) } @@ -153,7 +154,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { txID, err := r.SendToTSSFromDeployerWithMemo( r.BTCTSSAddress, 0.01, - utxos[0:2], + utxos[0:1], r.BtcRPCClient, memo, r.BTCDeployerAddress, @@ -161,11 +162,6 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { if err != nil { panic(err) } - r.Logger.Info("Sent BTC to TSS txid %s; now mining 10 blocks for confirmation", txID) - _, err = r.BtcRPCClient.GenerateToAddress(10, r.BTCDeployerAddress, nil) - if err != nil { - panic(err) - } cctx3 := utils.WaitCctxMinedByInboundHash(r.Ctx, txID.String(), r.CctxClient, r.Logger, r.CctxTimeout) if cctx3.CctxStatus.Status != types.CctxStatus_OutboundMined { @@ -194,11 +190,6 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { { r.Logger.Info("******* Third test: BTC -> ETH with contract call reverted; should refund BTC") - utxos, err := r.BtcRPCClient.ListUnspent() - if err != nil { - panic(err) - } - r.Logger.Info("#utxos %d", len(utxos)) // the following memo will result in a revert in the contract call as targetZRC20 is set to DeployerAddress // which is apparently not a ZRC20 contract; the UNISWAP call will revert memo, err := r.ZEVMSwapApp.EncodeMemo(&bind.CallOpts{}, r.DeployerAddress, r.DeployerAddress.Bytes()) @@ -212,7 +203,7 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { txid, err := r.SendToTSSFromDeployerWithMemo( r.BTCTSSAddress, amount, - utxos[0:2], + utxos[1:2], r.BtcRPCClient, memo, r.BTCDeployerAddress, @@ -220,11 +211,6 @@ func TestCrosschainSwap(r *runner.E2ERunner, _ []string) { if err != nil { panic(err) } - r.Logger.Info("Sent BTC to TSS txid %s; now mining 10 blocks for confirmation", txid) - _, err = r.BtcRPCClient.GenerateToAddress(10, r.BTCDeployerAddress, nil) - if err != nil { - panic(err) - } cctx := utils.WaitCctxMinedByInboundHash(r.Ctx, txid.String(), r.CctxClient, r.Logger, r.CctxTimeout) r.Logger.Info("cctx3 index %s", cctx.Index) diff --git a/e2e/runner/bitcoin.go b/e2e/runner/bitcoin.go index f1d10339fa..9143926d06 100644 --- a/e2e/runner/bitcoin.go +++ b/e2e/runner/bitcoin.go @@ -29,16 +29,35 @@ import ( var blockHeaderBTCTimeout = 5 * time.Minute -// DepositBTCWithAmount deposits BTC on ZetaChain with a specific amount -func (runner *E2ERunner) DepositBTCWithAmount(amount float64) (txHash *chainhash.Hash) { - runner.Logger.Print("⏳ depositing BTC into ZEVM") - - // fetch utxos +// ListDeployerUTXOs list the deployer's UTXOs that have at least `minAmount` +func (runner *E2ERunner) ListDeployerUTXOs(minAmount float64) ([]btcjson.ListUnspentResult, error) { + // query UTXOs from node utxos, err := runner.BtcRPCClient.ListUnspentMinMaxAddresses( 1, 9999999, []btcutil.Address{runner.BTCDeployerAddress}, ) + if err != nil { + return nil, err + } + + // filter UTXOs by `minAmount` + filtered := []btcjson.ListUnspentResult{} + for _, utxo := range utxos { + if utxo.Amount >= minAmount { + filtered = append(filtered, utxo) + } + } + + return filtered, nil +} + +// DepositBTCWithAmount deposits BTC on ZetaChain with a specific amount +func (runner *E2ERunner) DepositBTCWithAmount(amount float64) (txHash *chainhash.Hash) { + runner.Logger.Print("⏳ depositing BTC into ZEVM") + + // list deployer utxos that have at least 1 BTC + utxos, err := runner.ListDeployerUTXOs(1.0) if err != nil { panic(err) } @@ -85,12 +104,12 @@ func (runner *E2ERunner) DepositBTC(testHeader bool) { runner.Logger.Print("✅ BTC deposited in %s", time.Since(startTime)) }() - // fetch utxos - btc := runner.BtcRPCClient - utxos, err := runner.BtcRPCClient.ListUnspent() + // list deployer utxos that have at least 1 BTC + utxos, err := runner.ListDeployerUTXOs(1.0) if err != nil { panic(err) } + spendableAmount := 0.0 spendableUTXOs := 0 for _, utxo := range utxos { @@ -118,7 +137,7 @@ func (runner *E2ERunner) DepositBTC(testHeader bool) { runner.BTCTSSAddress, amount1, utxos[:2], - btc, + runner.BtcRPCClient, runner.BTCDeployerAddress, ) if err != nil { @@ -129,7 +148,7 @@ func (runner *E2ERunner) DepositBTC(testHeader bool) { runner.BTCTSSAddress, amount2, utxos[2:4], - btc, + runner.BtcRPCClient, runner.BTCDeployerAddress, ) if err != nil { @@ -142,7 +161,7 @@ func (runner *E2ERunner) DepositBTC(testHeader bool) { runner.BTCTSSAddress, 0.11, utxos[4:5], - btc, + runner.BtcRPCClient, []byte(constant.DonationMessage), runner.BTCDeployerAddress, ) @@ -214,7 +233,10 @@ func (runner *E2ERunner) SendToTSSFromDeployerWithMemo( scriptPubkeys := make([]string, len(inputUTXOs)) for i, utxo := range inputUTXOs { - inputs[i] = btcjson.TransactionInput{utxo.TxID, utxo.Vout} + inputs[i] = btcjson.TransactionInput{ + Txid: utxo.TxID, + Vout: utxo.Vout, + } inputSats += btcutil.Amount(utxo.Amount * btcutil.SatoshiPerBitcoin) amounts[i] = utxo.Amount scriptPubkeys[i] = utxo.ScriptPubKey @@ -253,7 +275,7 @@ func (runner *E2ERunner) SendToTSSFromDeployerWithMemo( tx.TxOut[1], tx.TxOut[2] = tx.TxOut[2], tx.TxOut[1] // make sure that TxOut[0] is sent to "to" address; TxOut[2] is change to oneself. TxOut[1] is memo. - if bytes.Compare(tx.TxOut[0].PkScript[2:], to.ScriptAddress()) != 0 { + if !bytes.Equal(tx.TxOut[0].PkScript[2:], to.ScriptAddress()) { runner.Logger.Info("tx.TxOut[0].PkScript: %x", tx.TxOut[0].PkScript) runner.Logger.Info("to.ScriptAddress(): %x", to.ScriptAddress()) runner.Logger.Info("swapping txout[0] with txout[2]") @@ -281,6 +303,7 @@ func (runner *E2ERunner) SendToTSSFromDeployerWithMemo( if err != nil { panic(err) } + if !signed { panic("btc transaction not signed") } From 6423a338eb9a745315e477c0048c95eea5923593 Mon Sep 17 00:00:00 2001 From: Grant Zukel <80433392+gzukel@users.noreply.github.com> Date: Thu, 30 May 2024 10:25:57 -0600 Subject: [PATCH 4/6] ci: add nightly performance testing, update localnet Docker image to Debian Bookworm, remove unnecessary build-jet runners. (#2285) * ci: adding nightly performance testing, removed buildjet where not-needed, and changed localnet docker image to use debian-bookworm * changed ubuntu-latest to ubunt-22.04, updated go releaser version to the last published 1.20 version * update orchestrator to bookworm --- .github/actions/performance-tests/art.yaml | 303 ++++++++++++ .github/workflows/change-log-check.yml | 2 +- .../ci-nightly-performance-testing.yaml | 34 ++ .github/workflows/docker-build-and-push.yml | 2 +- .github/workflows/generate-files.yml | 2 +- .github/workflows/labeler.yml | 2 +- .github/workflows/publish-release.yml | 20 +- .github/workflows/publish-typescript.yaml | 2 +- .github/workflows/rc-release.yml | 4 +- .github/workflows/release-status-changer.yml | 2 +- .github/workflows/sast-linters.yml | 8 +- .github/workflows/semantic-pr.yml | 2 +- .github/workflows/upgrade_path_testing.yaml | 451 ------------------ Dockerfile-localnet | 6 +- Makefile | 2 +- changelog.md | 4 +- .../orchestrator/Dockerfile.fastbuild | 2 +- 17 files changed, 368 insertions(+), 480 deletions(-) create mode 100644 .github/actions/performance-tests/art.yaml create mode 100644 .github/workflows/ci-nightly-performance-testing.yaml delete mode 100644 .github/workflows/upgrade_path_testing.yaml diff --git a/.github/actions/performance-tests/art.yaml b/.github/actions/performance-tests/art.yaml new file mode 100644 index 0000000000..71c1b3a15e --- /dev/null +++ b/.github/actions/performance-tests/art.yaml @@ -0,0 +1,303 @@ +# artillery run art.yaml --output results.json +# artillery report results.json --output artillery_report.html +config: + target: "http://127.0.0.1:8545" + phases: + - duration: 60 + arrivalRate: 10 + defaults: + headers: + content-type: "application/json" + http: + timeout: 60 + plugins: + metrics-by-endpoint: + useOnlyRequestNames: true + summary: true + reports: + - type: "html" + filename: "artillery_report.html" + +scenarios: + - name: web3_clientVersion + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "web3_clientVersion" + params: [] + + - name: web3_sha3 + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "web3_sha3" + params: + - "0x68656c6c6f20776f726c64" + + - name: net_version + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "net_version" + params: [] + + - name: net_listening + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "net_listening" + params: [] + + - name: net_peerCount + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "net_peerCount" + params: [] + + - name: eth_chainId + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_chainId" + params: [] + + - name: eth_getStorageAt + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getStorageAt" + params: + - "latest" + + - name: eth_getTransactionByBlockHashAndIndex + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getTransactionByBlockHashAndIndex" + params: + - "0x0" + + - name: eth_getTransactionByBlockNumberAndIndex + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getTransactionByBlockNumberAndIndex" + params: + - "latest" + - "0x0" + + - name: eth_getUncleByBlockHashAndIndex + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getUncleByBlockHashAndIndex" + params: + - "0x0" + + - name: eth_getUncleByBlockNumberAndIndex + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getUncleByBlockNumberAndIndex" + params: + - "latest" + - "0x0" + + - name: eth_newFilter + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_newFilter" + params: + - { + fromBlock: "latest", + toBlock: "latest", + address: "0x0", + topics: [] + } + + - name: eth_getFilterChanges + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getFilterChanges" + params: + - "0x0" + + - name: eth_getFilterLogs + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getFilterLogs" + params: + - "0x0" + + - name: eth_blockNumber + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_blockNumber" + params: [] + + - name: eth_getBlockByHash + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getBlockByHash" + params: + - "0x0" + - true + + - name: eth_getBlockByNumber + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getBlockByNumber" + params: + - "latest" + - true + + - name: eth_getBlockTransactionCountByHash + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getBlockTransactionCountByHash" + params: + - "0x0" + + - name: eth_getBlockTransactionCountByNumber + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getBlockTransactionCountByNumber" + params: + - "latest" + + - name: eth_getCode + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getCode" + params: + - "0x0" + - "latest" + + - name: eth_getTransactionByHash + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getTransactionByHash" + params: + - "0x0" + + - name: eth_getTransactionReceipt + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getTransactionReceipt" + params: + - "0x0" + + - name: eth_getLogs + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getLogs" + params: + - fromBlock: "0x1" + toBlock: "latest" + address: "0x0" + topics: ["0x0"] + + - name: eth_getBalance + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_getBalance" + params: + - "0x0" + - "latest" + + - name: eth_estimateGas + flow: + - post: + url: "/" + json: + id: 1 + jsonrpc: "2.0" + method: "eth_estimateGas" + params: + - from: "0x0" diff --git a/.github/workflows/change-log-check.yml b/.github/workflows/change-log-check.yml index dd3a98d4bf..85b68b70e6 100644 --- a/.github/workflows/change-log-check.yml +++ b/.github/workflows/change-log-check.yml @@ -6,7 +6,7 @@ on: jobs: check-changelog: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/ci-nightly-performance-testing.yaml b/.github/workflows/ci-nightly-performance-testing.yaml new file mode 100644 index 0000000000..15245da280 --- /dev/null +++ b/.github/workflows/ci-nightly-performance-testing.yaml @@ -0,0 +1,34 @@ +name: "NIGHTLY:EVM:PERFORMANCE:TESTING" + +on: + workflow_dispatch: + schedule: + - cron: '0 0 * * *' # Runs every day at midnight UTC + +jobs: + nightly_evm_api_performance_test: + name: "NIGHTLY:EVM:API:PERFORMANCE:TEST" + runs-on: "buildjet-16vcpu-ubuntu-2204" + steps: + - uses: actions/checkout@v4 + + - name: "START:LOCAL:NET" + run: | + make start-e2e-test + + - name: "EXECUTE:LOADTESTS" + uses: artilleryio/action-cli@v1 + with: + command: run .github/actions/performance-tests/art.yaml --output ./report.json + + - name: "GENERATE:REPORT" + uses: artilleryio/action-cli@v1 + with: + command: report report.json --output artillery_report.html + + - name: "UPLOAD:REPORT" + uses: actions/upload-artifact@v3 + if: success() + with: + name: artillery-report + path: ./artillery_report.html \ No newline at end of file diff --git a/.github/workflows/docker-build-and-push.yml b/.github/workflows/docker-build-and-push.yml index 397affe896..95ca015953 100644 --- a/.github/workflows/docker-build-and-push.yml +++ b/.github/workflows/docker-build-and-push.yml @@ -22,7 +22,7 @@ env: jobs: docker_build_ubuntu: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 30 steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/generate-files.yml b/.github/workflows/generate-files.yml index 1a948ceb96..881ec2025f 100644 --- a/.github/workflows/generate-files.yml +++ b/.github/workflows/generate-files.yml @@ -6,7 +6,7 @@ on: jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout code uses: actions/checkout@v4 diff --git a/.github/workflows/labeler.yml b/.github/workflows/labeler.yml index 936823a405..e0bd3f250f 100644 --- a/.github/workflows/labeler.yml +++ b/.github/workflows/labeler.yml @@ -10,6 +10,6 @@ jobs: permissions: contents: read pull-requests: write - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: actions/labeler@v4 diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 3adfa8e37b..a396f4d71d 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -25,7 +25,7 @@ concurrency: jobs: check_branch: if: ${{ (startsWith(github.ref, 'refs/heads/release/v') || startsWith(github.ref, 'refs/heads/hotfix/v')) }} - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Branch run: | @@ -34,7 +34,7 @@ jobs: gosec: needs: - check_branch - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: GO111MODULE: on steps: @@ -65,7 +65,7 @@ jobs: gosec-cosmos: needs: - check_branch - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: GO111MODULE: on steps: @@ -94,7 +94,7 @@ jobs: lint: needs: - check_branch - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 15 env: GO111MODULE: on @@ -128,7 +128,7 @@ jobs: check-changelog: needs: - check_branch - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout code @@ -170,7 +170,7 @@ jobs: check-upgrade-handler-updated: needs: - check_branch - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 10 steps: @@ -202,7 +202,7 @@ jobs: build-test: needs: - check_branch - runs-on: buildjet-4vcpu-ubuntu-2204 + runs-on: ubuntu-22.04 timeout-minutes: 15 concurrency: group: "build-test" @@ -279,7 +279,7 @@ jobs: smoke-test: needs: - check_branch - runs-on: buildjet-4vcpu-ubuntu-2204 + runs-on: ubuntu-22.04 timeout-minutes: 25 steps: - name: "Checkout Code" @@ -357,7 +357,7 @@ jobs: e2e-admin-tests: needs: - check_branch - runs-on: buildjet-4vcpu-ubuntu-2204 + runs-on: ubuntu-22.04 timeout-minutes: 120 steps: - name: "Checkout Code" @@ -411,7 +411,7 @@ jobs: - e2e-admin-tests - e2e-upgrade-test - check_branch - runs-on: ubuntu-20.04 + runs-on: ubuntu-22.04 timeout-minutes: 60 environment: release steps: diff --git a/.github/workflows/publish-typescript.yaml b/.github/workflows/publish-typescript.yaml index 890f867d8b..9c4358a43b 100644 --- a/.github/workflows/publish-typescript.yaml +++ b/.github/workflows/publish-typescript.yaml @@ -5,7 +5,7 @@ on: types: [created] jobs: build: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout uses: actions/checkout@v2 diff --git a/.github/workflows/rc-release.yml b/.github/workflows/rc-release.yml index 26804e8937..94f67de95b 100644 --- a/.github/workflows/rc-release.yml +++ b/.github/workflows/rc-release.yml @@ -14,7 +14,7 @@ env: jobs: pre-release-checks: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 10 steps: - uses: actions/checkout@v4 @@ -34,7 +34,7 @@ jobs: echo "The major version found in 'releaseVersion' in app/setup_handlers.go matches this tagged release - Moving Forward!" publish-release: - runs-on: buildjet-4vcpu-ubuntu-2204 + runs-on: ubuntu-22.04 timeout-minutes: 60 needs: - pre-release-checks diff --git a/.github/workflows/release-status-changer.yml b/.github/workflows/release-status-changer.yml index d07aa16fce..5095a4eb3d 100644 --- a/.github/workflows/release-status-changer.yml +++ b/.github/workflows/release-status-changer.yml @@ -7,7 +7,7 @@ on: jobs: run-script: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - name: Checkout Repository diff --git a/.github/workflows/sast-linters.yml b/.github/workflows/sast-linters.yml index 5f754ba1ac..3b8381e19d 100644 --- a/.github/workflows/sast-linters.yml +++ b/.github/workflows/sast-linters.yml @@ -15,7 +15,7 @@ concurrency: jobs: gosec: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: GO111MODULE: on steps: @@ -35,7 +35,7 @@ jobs: args: ./... gosec-cosmos: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 env: GO111MODULE: on steps: @@ -53,7 +53,7 @@ jobs: run: make lint-cosmos-gosec lint: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 15 env: GO111MODULE: on @@ -76,7 +76,7 @@ jobs: args: --out-format=json nosec_alert: - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 timeout-minutes: 10 env: GO111MODULE: on diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml index 498b95bece..11af7d5710 100644 --- a/.github/workflows/semantic-pr.yml +++ b/.github/workflows/semantic-pr.yml @@ -9,7 +9,7 @@ on: jobs: main: name: Validate PR title - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 steps: - uses: amannn/action-semantic-pull-request@v5 env: diff --git a/.github/workflows/upgrade_path_testing.yaml b/.github/workflows/upgrade_path_testing.yaml deleted file mode 100644 index a4a2af9204..0000000000 --- a/.github/workflows/upgrade_path_testing.yaml +++ /dev/null @@ -1,451 +0,0 @@ -name: "UPGRADE_PATH_TESTING" - -on: - workflow_dispatch: - inputs: - version: - description: 'The new version of tag you are going to download the binary from..' - required: true - default: 'v10.1.0' - upgrade_name: - description: 'The version that is set in setup_handlers.go' - required: true - default: 'v10.1.0' - current_version: - description: 'The version that the network is currently on.' - required: true - default: 'v10.0.0' - -jobs: - upgrade_path_test_state_export: - name: "UPGRADE_PATH_TEST_STATE_EXPORT" - runs-on: ["buildjet-8vcpu-ubuntu-2204"] - env: - latest_state_export: "https://zetachain-external-files.s3.amazonaws.com/state-export/athens3/latest.json" - github_binary_version_link: "https://github.com/zeta-chain/node/releases/download/${{ github.event.inputs.version }}/zetacored_testnet-linux-amd64" - downloaded_binary_name: "zetacored-testnet-linux-amd64" - VERSION: "${{ github.event.inputs.version }}" - aws_region: "us-east-1" - GAS_PRICES: "1.0azeta" - DEPOSIT: "10000000000000000000azeta" - METADATA: "ipfs://QmeABfwZ2nAxDzYyqZ1LEypPgQFMjEyrx8FfnoPLkF8R3f" - LOG_LEVEL: "INFO" - CHAINID: "localnet_101-1" - DAEMON_HOME: "/home/runner/.zetacored" - UPGRADE_NAME: "${{ github.event.inputs.upgrade_name }}" - DAEMON_NAME: "zetacored" - DENOM: "azeta" - DAEMON_ALLOW_DOWNLOAD_BINARIES: "true" - DAEMON_RESTART_AFTER_UPGRADE: "true" - MONIKER: "zeta" - BLOCK_TIME_SECONDS: "6" - PROPOSAL_TIME_SECONDS: "60" - UNSAFE_SKIP_BACKUP: "true" - CLIENT_DAEMON_NAME: "zetaclientd" - CLIENT_DAEMON_ARGS: "-enable-chains,GOERLI,-val,zeta" - CLIENT_SKIP_UPGRADE: "true" - CLIENT_START_PROCESS: "false" - BINARY_NAME_SUFFIX: "ubuntu-22-amd64" - UPGRADES_SLEEP_TIME: "300" - KEYRING: "test" - STATUS_ENDPOINT: "http://127.0.0.1:26657/status" - ABCI_ENDPOINT: "http://127.0.0.1:26657/abci_info" - ENDPOINT: "http://127.0.0.1:26657" - SLEEP_DURATION: "5" - GOV_ADDRESS: "zeta10d07y265gmmuvt4z0w9aw880jnsr700jvxasvr" - previous_height: "-1" - stalled_count: "0" - first: "true" - MAX_TRIES: "100" - count: "0" - steps: - - uses: actions/checkout@v1 - - - id: install-aws-cli - uses: unfor19/install-aws-cli-action@v1 - with: - version: 2 - - - uses: actions/setup-go@v5 - with: - check-latest: false - go-version: '^1.20' - - - name: "CLONE:ZETAVISOR:REPOSITORY" - uses: actions/checkout@v2 - with: - repository: zeta-chain/cosmos-sdk - path: zetavisor/ - ref: zetavisor-v0.1.5 - - - name: "INSTALL_APT_PACKAGES" - working-directory: "zetavisor/cosmovisor" - run: | - echo "*********INSTALL SOME APT PACKAGES*********" - sudo apt update - sudo apt install unzip psmisc -y - - - name: "INSTALL_ZETAVISOR" - working-directory: "zetavisor/cosmovisor" - run: | - echo "*********INSTALL ZETAVISOR*********" - go get github.com/zeta-chain/cosmos-sdk/cosmovisor/cmd/zetavisor - go install github.com/zeta-chain/cosmos-sdk/cosmovisor/cmd/zetavisor - zetavisor version || echo "zetavisor failed to install." - - echo "*********SETUP ZETAVISOR DIRECTORIES*********" - rm -rf /home/runner/.zetacored - mkdir -p /home/runner/.zetacored/zetavisor - mkdir -p /home/runner/.zetacored/zetavisor/genesis/bin - mkdir -p /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin - mkdir -p /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin - - - name: "DOWNLOAD_STATE_EXPORT_AND_BINARIES" - run: | - echo "*********DOWNLOAD STATE EXPORT*********" - wget -q ${latest_state_export} - - echo "*********DOWNLOAD UPGRADE BINARY AND PUT IN ZETAVISOR UPGRADES FOLDER*********" - wget -q ${github_binary_version_link} -O /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored - ZETACORED_CHECKSUM=$(shasum -b -a 256 /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored | cut -d ' ' -f 1) - sudo chmod a+x /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored - - echo "UPGRADE_INFO=${UPGRADE_INFO}" >> ${GITHUB_ENV} - ls -lah /home/runner/.zetacored/zetavisor/upgrades/ - ls -lah /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored - - wget -q ${github_binary_version_link} -O /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored - ZETACORED_CHECKSUM=$(shasum -b -a 256 /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored | cut -d ' ' -f 1) - sudo chmod a+x /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored - - echo "UPGRADE_INFO=${UPGRADE_INFO}" >> ${GITHUB_ENV} - ls -lah /home/runner/.zetacored/zetavisor/upgrades/ - ls -lah /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.upgrade_name }}/bin/zetacored - - echo "ZETACORED_CHECKSUM=${ZETACORED_CHECKSUM}" >> ${GITHUB_ENV} - UPGRADE_INFO='{"binaries": {"zetacored-linux/amd64": "https://github.com/zeta-chain/node/releases/download/${{ github.event.inputs.version }}/zetacored_testnet-linux-amd64?checksum=sha256:'${ZETACORED_CHECKSUM}'"}}' - echo ${UPGRADE_INFO} - - echo "*********DOWNLOAD CURRENT BINARY AND PUT IN ZETAVISOR GENESIS & CURRENT FOLDER*********" - current_version=$(curl https://rpc-archive.athens.zetachain.com:26657/abci_info -s | jq .result.response.version -r | tr -d '\n') - current_version=${{ github.event.inputs.current_version }} - echo "STARTING_VERSION=${current_version}" >> ${GITHUB_ENV} - echo "STARTING_VERSION=${current_version}" - if [ "${{ github.event.inputs.current_version }}" == "v10.0.0" ]; then - echo "download 10.0.0 binary" - wget -q https://github.com/zeta-chain/node/releases/download/${{ github.event.inputs.current_version }}/zetacored-ubuntu-22-amd64 -O /home/runner/.zetacored/zetavisor/genesis/bin/zetacored - else - echo "download non 10.0.0 version" - wget -q https://github.com/zeta-chain/node/releases/download/${{ github.event.inputs.current_version }}/zetacored_testnet-linux-amd64 -O /home/runner/.zetacored/zetavisor/genesis/bin/zetacored - fi - sudo chmod a+x /home/runner/.zetacored/zetavisor/genesis/bin/zetacored - echo "PATH=/home/runner/.zetacored/zetavisor/genesis/bin:$PATH" >> ${GITHUB_ENV} - - - name: "START_TESTING_NETWORK" - run: | - zetacored config keyring-backend $KEYRING --home ${DAEMON_HOME} - - zetacored config chain-id $CHAINID --home ${DAEMON_HOME} - - zetacored keys delete zetaa --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist" - zetacored keys delete executer_zeta --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist" - zetacored keys delete mario --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist" - zetacored keys delete executer_mario --keyring-backend $KEYRING -y > /dev/null 2>&1 || echo "doesn't exist" - - echo "race draft rival universe maid cheese steel logic crowd fork comic easy truth drift tomorrow eye buddy head time cash swing swift midnight borrow" | zetacored keys add zeta --algo=secp256k1 --recover --keyring-backend=$KEYRING - echo "hand inmate canvas head lunar naive increase recycle dog ecology inhale december wide bubble hockey dice worth gravity ketchup feed balance parent secret orchard" | zetacored keys add mario --algo secp256k1 --recover --keyring-backend=$KEYRING - echo "lounge supply patch festival retire duck foster decline theme horror decline poverty behind clever harsh layer primary syrup depart fantasy session fossil dismiss east" | zetacored keys add executer_zeta --recover --keyring-backend=$KEYRING --algo secp256k1 - echo "debris dumb among crew celery derive judge spoon road oyster dad panic adult song attack net pole merge mystery pig actual penalty neither peasant"| zetacored keys add executer_mario --algo=secp256k1 --recover --keyring-backend=$KEYRING - - echo ' - [ - { - "IsObserver": "y", - "ObserverAddress": "zeta13c7p3xrhd6q2rx3h235jpt8pjdwvacyw6twpax", - "ZetaClientGranteeAddress": "zeta10up34mvwjhjd9xkq56fwsf0k75vtg287uav69n", - "ZetaClientGranteePubKey": "zetapub1addwnpepqtlu7fykuh875xjckz4mn4x0mzc25rrqk5qne7mrwxqmatgllv3nx6lrkdp" - }, - { - "IsObserver": "y", - "ObserverAddress": "zeta1f203dypqg5jh9hqfx0gfkmmnkdfuat3jr45ep2", - "ZetaClientGranteeAddress": "zeta1unzpyll3tmutf0r8sqpxpnj46vtdr59mw8qepx", - "ZetaClientGranteePubKey": "zetapub1addwnpepqwy5pmg39regpq0gkggxehmfm8hwmxxw94sch7qzh4smava0szs07kk5045" - } - ] - ' > observers.json - - zetacored init Zetanode-Localnet --chain-id=$CHAINID - - #Set config to use azeta - cat $DAEMON_HOME/config/genesis.json | jq '.app_state["staking"]["params"]["bond_denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json - cat $DAEMON_HOME/config/genesis.json | jq '.app_state["crisis"]["constant_fee"]["denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json - cat $DAEMON_HOME/config/genesis.json | jq '.app_state["gov"]["deposit_params"]["min_deposit"][0]["denom"]="azeta"' > ~/.zetacored/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json - cat $DAEMON_HOME/config/genesis.json | jq '.app_state["mint"]["params"]["mint_denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json - cat $DAEMON_HOME/config/genesis.json | jq '.app_state["evm"]["params"]["evm_denom"]="azeta"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json - cat $DAEMON_HOME/config/genesis.json | jq '.consensus_params["block"]["max_gas"]="10000000"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json - cat $DAEMON_HOME/config/genesis.json | jq '.app_state["gov"]["voting_params"]["voting_period"]="60s"' > $DAEMON_HOME/config/tmp_genesis.json && mv $DAEMON_HOME/config/tmp_genesis.json $DAEMON_HOME/config/genesis.json - - sed -i '/\[api\]/,+3 s/enable = false/enable = true/' $DAEMON_HOME/config/app.toml - - zetacored add-observer-list observers.json --keygen-block=5 - - zetacored gentx zeta 1000000000000000000000azeta --chain-id=$CHAINID --keyring-backend=$KEYRING - - echo "Collecting genesis txs..." - zetacored collect-gentxs - - echo "Validating genesis file..." - zetacored validate-genesis - - cp $DAEMON_HOME/config/genesis.json ./genesis.json - - echo "Do Genesis Manipulation" - export OLD_GENESIS=./latest.json - export NEW_GENESIS=./genesis.json - - python .github/actions/upgrade-testing/scripts/create_genesis.py - - echo "Move Manipulated Genesis" - cp ./genesis-edited.json $DAEMON_HOME/config/genesis.json - - cat $DAEMON_HOME/config/genesis.json | grep -A 10 -B 10 out_tx_tracker - - echo "Zetavisor Version" - zetavisor version || echo "zetavisor not found" - zetacored version || echo "zetcored not found" - - echo "Start Network" - nohup zetavisor start --rpc.laddr tcp://0.0.0.0:26657 --minimum-gas-prices ${GAS_PRICES} "--grpc.enable=true" > cosmovisor.log 2>&1 & - - sleep ${UPGRADES_SLEEP_TIME} - cat cosmovisor.log - - - name: "DETERMINE_UPGRADE_TYPE" - shell: python - run: | - import os - - first_version=os.environ["STARTING_VERSION"] - first_major_version = first_version.split(".")[0] - first_minor_version = first_version.split(".")[1] - first_sub_version = first_version.split(".")[2] - - version="${{ github.event.inputs.version }}" - major_version = version.split(".")[0] - minor_version = version.split(".")[1] - sub_version = version.split(".")[2] - - print("${{ github.event.inputs.version }}") - git_env_file = open(os.environ["GITHUB_ENV"], "a+") - - if "${{ github.event.inputs.version }}" == "v10.1.0": - git_env_file.write("UPGRADE_TYPE=GOV") - elif major_version == first_major_version and minor_version != first_minor_version: - git_env_file.write("UPGRADE_TYPE=NONCON") - elif major_version == first_major_version and minor_version == first_minor_version and sub_version != first_sub_version: - git_env_file.write("UPGRADE_TYPE=NONCON") - else: - git_env_file.write("UPGRADE_TYPE=GOV") - git_env_file.close() - - - name: "NON_CONSENSUS_BREAKING_UPGRADE" - if: env.UPGRADE_TYPE == 'NONCON' - run: | - echo ${UPGRADE_TYPE} - echo "*********CHECK VERSION BEFORE BINARY SWITCH*********" - zetavisor version - - echo "*********KILLALL ZETAVISOR*********" - killall zetavisor - - echo "*********COPY UPGRADE BINARY TO NEW LOCATION*********" - rm -rf /home/runner/.zetacored/zetavisor/genesis/bin/zetacored - rm -rf /home/runner/.zetacored/zetavisor/current/bin/zetacored - - cp /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored /home/runner/.zetacored/zetavisor/genesis/bin/zetacored - cp /home/runner/.zetacored/zetavisor/upgrades/${{ github.event.inputs.version }}/bin/zetacored /home/runner/.zetacored/zetavisor/current/bin/zetacored - nohup zetavisor start --rpc.laddr tcp://0.0.0.0:26657 --minimum-gas-prices ${GAS_PRICES} "--grpc.enable=true" > cosmovisor.log 2>&1 & - - sleep ${UPGRADES_SLEEP_TIME} - cat cosmovisor.log - echo "*********CHECK VERSION AFTER BINARY SWITCH*********" - check_version=$(zetavisor version | tr -d '\n') - http_version=$(curl http://127.0.0.1:26657/abci_info | jq .result.response.version -r | tr -d '\n') - - echo "END_VERSION=${{ github.event.inputs.version }}" - echo "CURRENT_VERSION_BINARY=${check_version}" - echo "CURRENT_VERSION_HTTP=${http_version}" - - if [ "${{ github.event.inputs.version }}" == "${check_version}" ]; then - if [ "${{ github.event.inputs.version }}" == "${http_version}" ]; then - echo "*********VERSION MATCHES UPGRADE SUCCESS*********" - exit 0 - else - echo "*********VERSION DOESN'T MATCH UPGRADE FAILED*********" - exit 2 - fi - else - echo "*********VERSION DOESN'T MATCH UPGRADE FAILED*********" - exit 2 - fi - - - name: "CONSENSUS_BREAKING_UPGRADE" - if: env.UPGRADE_TYPE == 'GOV' #GOV - run: | - echo "*****UPGRADE TYPE*****" - echo ${UPGRADE_TYPE} - - echo "*****BUILD GOV PROPOSAL*****" - GOV_PROPOSAL=$(python .github/actions/upgrade-testing/scripts/raise_gov_proposal.py) - - echo "${GOV_PROPOSAL}" - cat gov.json - - GOV_PROPOSAL_OUTPUT=$(eval ${GOV_PROPOSAL}) - - echo "*****GOV PROPOSAL OUTPUT*****" - echo ${GOV_PROPOSAL_OUTPUT} - - echo "*****GET TX HASH*****" - TX_HASH=$(echo ${GOV_PROPOSAL_OUTPUT} | awk -F'txhash: ' '{print $2}' | tr -d '\n' | tr -d ' ') - echo "****TXHASH: ${TX_HASH}****" - - echo "*****SLEEP FOR 1 MIN TO ALLOW TX TO MAKE IT ON NETWORK*****" - sleep 15 - - zetacored query tx --type=hash ${TX_HASH} - - proposal_id=$(python .github/actions/upgrade-testing/scripts/get_proposal_id.py) - echo "****PROPOSAL_ID: ${proposal_id}****" - - source ${GITHUB_ENV} - - zetacored tx gov vote "${proposal_id}" yes \ - --from ${MONIKER} \ - --keyring-backend test \ - --chain-id ${CHAINID} \ - --node http://127.0.0.1:26657 \ - --gas=auto \ - --gas-adjustment=2 \ - --gas-prices=${{ env.GAS_PRICES }} \ - -y - - sleep 5 - zetacored query gov proposal ${proposal_id} --node http://127.0.0.1:26657 - - TARGET_HEIGHT=$(echo ${UPGRADE_HEIGHT} | cut -d '.' -f 1) - - echo "**** CHECK FOR HEIGHT ${TARGET_HEIGHT} ****" - while [[ $count -lt $MAX_TRIES ]] - do - echo "CURL FOR CURRENT HEIGHT" - response=$(curl -s "$ENDPOINT/status" || echo "failed curl") - if [ $? -ne 0 ]; then - echo "CURL failed with exit code $?" - else - echo "curl success" - fi - echo "curl success" - echo "${response}" - current_height=$(echo $response | jq '.result.sync_info.latest_block_height' | tr -d '"') - echo "Current Height: $current_height" - echo "Target Height: $TARGET_HEIGHT" - - if [[ $current_height -ge $TARGET_HEIGHT ]]; then - echo "Reached target height: $current_height. Sleep and wait for upgrade to take place." - sleep 120 - break - fi - - echo "attempt number ${count} of ${MAX_TRIES}" - ((count=count+1)) - echo "sleep and ty again." - sleep 10 - done - - if [[ $count -eq $MAX_TRIES ]]; then - cat cosmovisor.log - echo "Max tries reached without achieving target height." - exit 2 - fi - - for (( i=1; i<=MAX_TRIES; i++ )) - do - pgrep zetavisor > /dev/null - if [[ $? -ne 0 ]]; then - cat cosmovisor.log - echo "zetavisor process not found." - exit 2 - fi - - response=$(curl -s "$STATUS_ENDPOINT") - - # If curl fails - if [[ $? -ne 0 ]]; then - cat cosmovisor.log - echo "Failed to get a response from the status endpoint on try $i." - exit 2 - fi - - # Extracting the current height from the response - current_height=$(echo $response | jq '.result.sync_info.latest_block_height' | tr -d '"') - - # If jq fails or height is empty - if [[ $? -ne 0 || -z "$current_height" ]]; then - cat cosmovisor.log - echo "Failed to extract block height from the response on try $i." - exit 2 - fi - - # If the block height has changed since last check - if [[ $current_height -ne $previous_height ]]; then - if [ "${first}" == "true" ]; then - stalled_count=0 - first="false" - else - echo "Network appears to be processing blocks" - stalled_count=0 - - # Query the ABCI endpoint for version info - abci_response=$(curl -s "$ABCI_ENDPOINT") - - # Extracting the version from the response - app_version=$(echo $abci_response | jq '.result.response.version' | tr -d '"') - - # If jq fails or version is empty - if [[ $? -ne 0 || -z "$app_version" ]]; then - cat cosmovisor.log - echo "Failed to extract version from the ABCI response on try $i." - exit 2 - fi - - # Compare the extracted version with the expected version - if [[ "$app_version" == "$VERSION" ]]; then - echo "Version matches the expected version. Exiting..." - echo "ABCI RESPONSE \n ${abci_response}" - echo "Versions: $VERSION, Found: $app_version" - exit 0 - else - cat cosmovisor.log - echo "Version mismatch. Expected: $VERSION, Found: $app_version" - echo "ABCI RESPONSE \n ${abci_response}" - exit 2 - fi - fi - else - ((stalled_count=stalled_count+1)) - fi - - # Update the previous height - previous_height=$current_height - - # If we're on the last iteration and the block height hasn't changed for all tries - if [[ $i -eq $MAX_TRIES && $stalled_count -eq $MAX_TRIES ]]; then - cat cosmovisor.log - echo "Block height hasn't changed for $MAX_TRIES consecutive checks. Network might be stalled." - exit 2 - fi - - # Sleep for the specified duration - sleep $SLEEP_DURATION - done \ No newline at end of file diff --git a/Dockerfile-localnet b/Dockerfile-localnet index c6e4efdd94..ee16e6282b 100644 --- a/Dockerfile-localnet +++ b/Dockerfile-localnet @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1.7-labs -FROM golang:1.20.14-bullseye AS base-build +FROM golang:1.20.14-bookworm AS base-build ENV GOPATH /go ENV GOOS=linux @@ -22,10 +22,10 @@ COPY --exclude=*.sh --exclude=*.md --exclude=*.yml . . RUN --mount=type=cache,target="/root/.cache/go-build" make install RUN --mount=type=cache,target="/root/.cache/go-build" make install-zetae2e -FROM golang:1.20.14-bullseye AS cosmovisor-build +FROM golang:1.20.14-bookworm AS cosmovisor-build RUN go install cosmossdk.io/tools/cosmovisor/cmd/cosmovisor@v1.5.0 -FROM debian:bullseye-slim AS base-runtime +FROM golang:1.20.14-bookworm AS base-runtime RUN apt update && \ apt install -yq jq curl tmux python3 openssh-server iputils-ping iproute2 && \ diff --git a/Makefile b/Makefile index 6508b07b50..480c956c9a 100644 --- a/Makefile +++ b/Makefile @@ -273,7 +273,7 @@ stop-monitoring: ############################################################################### PACKAGE_NAME := github.com/zeta-chain/node -GOLANG_CROSS_VERSION ?= v1.20 +GOLANG_CROSS_VERSION ?= v1.20.7 GOPATH ?= '$(HOME)/go' release-dry-run: docker run \ diff --git a/changelog.md b/changelog.md index 4c371f2c87..442fcb68f8 100644 --- a/changelog.md +++ b/changelog.md @@ -56,7 +56,9 @@ * [2256](https://github.com/zeta-chain/node/pull/2256) - fix rate limiter falsely included reverted non-withdraw cctxs ### CI -* [2268](https://github.com/zeta-chain/node/pull/2268) - CI: updated the publish-release pipeline to utilize the Github Actions Ubuntu 20.04 Runners. + +* [2285](https://github.com/zeta-chain/node/pull/2285) - added nightly EVM performance testing pipeline, modified localnet testing docker image to utilitze debian:bookworm, removed build-jet runners where applicable, removed deprecated/removed upgrade path testing pipeline. +* [2268](https://github.com/zeta-chain/node/pull/2268) - updated the publish-release pipeline to utilize the Github Actions Ubuntu 20.04 Runners. * [2070](https://github.com/zeta-chain/node/pull/2070) - Added commands to build binaries from the working branch as a live full node rpc to test non-governance changes. * [2119](https://github.com/zeta-chain/node/pull/2119) - Updated the release pipeline to only run on hotfix/ and release/ branches. Added option to only run pre-checks and not cut release as well. Switched approval steps to use environments. * [2189](https://github.com/zeta-chain/node/pull/2189) - Updated the docker tag when a release trigger runs to be the github event for the release name which should be the version. Removed mac specific build as the arm build should handle that. diff --git a/contrib/localnet/orchestrator/Dockerfile.fastbuild b/contrib/localnet/orchestrator/Dockerfile.fastbuild index 332ed3330e..2ef5520c64 100644 --- a/contrib/localnet/orchestrator/Dockerfile.fastbuild +++ b/contrib/localnet/orchestrator/Dockerfile.fastbuild @@ -1,6 +1,6 @@ FROM zetanode:latest as zeta FROM ethereum/client-go:v1.10.26 as geth -FROM debian:bullseye-slim as orchestrator +FROM golang:1.20.14-bookworm as orchestrator RUN apt update && \ apt install -yq jq curl tmux python3 openssh-server iputils-ping iproute2 && \ From d761ed988df23f6cfec0a1f5bad8a1b0d207da1e Mon Sep 17 00:00:00 2001 From: skosito Date: Thu, 30 May 2024 19:13:25 +0200 Subject: [PATCH 5/6] lint --- rpc/backend/tx_info.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index b5b8435551..ef02e62fa6 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -55,6 +55,7 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac var ethMsg *evmtypes.MsgEthereumTx if additional == nil { + // #nosec G701 always in range if int(res.TxIndex) >= len(resBlock.Block.Txs) { b.logger.Error("tx out of bounds") return nil, fmt.Errorf("tx out of bounds") @@ -180,6 +181,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ var txData evmtypes.TxData var ethMsg *evmtypes.MsgEthereumTx if additional == nil { + // #nosec G701 always in range if int(res.TxIndex) >= len(resBlock.Block.Txs) { b.logger.Error("tx out of bounds") return nil, fmt.Errorf("tx out of bounds") From 89bd917ae71b2a02be79d92744b985a20f258405 Mon Sep 17 00:00:00 2001 From: skosito Date: Thu, 30 May 2024 19:55:40 +0200 Subject: [PATCH 6/6] PR comments --- rpc/backend/blocks.go | 32 +++++++++++++------------------- rpc/backend/tx_info.go | 4 ++++ rpc/types/events.go | 6 +++--- x/fungible/keeper/evm.go | 3 +++ 4 files changed, 23 insertions(+), 22 deletions(-) diff --git a/rpc/backend/blocks.go b/rpc/backend/blocks.go index 1b65c1d61d..d28b8345da 100644 --- a/rpc/backend/blocks.go +++ b/rpc/backend/blocks.go @@ -296,32 +296,26 @@ func (b *Backend) EthMsgsFromTendermintBlock( } tx, err := b.clientCtx.TxConfig.TxDecoder()(tx) - if err != nil { - b.logger.Debug("failed to decode transaction in block", "height", block.Height, "error", err.Error()) - // try to check if there is synthetic eth tx in tx result - ethMsg, additional := b.parseSyntheticTxFromBlockResults(txResults, i, tx, block) - if ethMsg != nil { - ethMsgs = append(ethMsgs, ethMsg) - txsAdditional = append(txsAdditional, additional) - } - continue - } - // assumption is that if regular ethermint msg is found in tx // there should not be synthetic one as well shouldCheckForSyntheticTx := true - for _, msg := range tx.GetMsgs() { - ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) - if ok { - shouldCheckForSyntheticTx = false - ethMsg.Hash = ethMsg.AsTransaction().Hash().Hex() - ethMsgs = append(ethMsgs, ethMsg) - txsAdditional = append(txsAdditional, nil) + // if tx can be decoded, try to find MsgEthereumTx inside + if err == nil { + for _, msg := range tx.GetMsgs() { + ethMsg, ok := msg.(*evmtypes.MsgEthereumTx) + if ok { + shouldCheckForSyntheticTx = false + ethMsg.Hash = ethMsg.AsTransaction().Hash().Hex() + ethMsgs = append(ethMsgs, ethMsg) + txsAdditional = append(txsAdditional, nil) + } } + } else { + b.logger.Debug("failed to decode transaction in block", "height", block.Height, "error", err.Error()) } + // if tx can not be decoded or MsgEthereumTx was not found, try to parse it from block results if shouldCheckForSyntheticTx { - // try to check if there is synthetic eth tx in tx result ethMsg, additional := b.parseSyntheticTxFromBlockResults(txResults, i, tx, block) if ethMsg != nil { ethMsgs = append(ethMsgs, ethMsg) diff --git a/rpc/backend/tx_info.go b/rpc/backend/tx_info.go index ef02e62fa6..740981f010 100644 --- a/rpc/backend/tx_info.go +++ b/rpc/backend/tx_info.go @@ -54,6 +54,7 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac } var ethMsg *evmtypes.MsgEthereumTx + // if additional fields are empty we can try to get MsgEthereumTx from sdk.Msg array if additional == nil { // #nosec G701 always in range if int(res.TxIndex) >= len(resBlock.Block.Txs) { @@ -71,6 +72,7 @@ func (b *Backend) GetTransactionByHash(txHash common.Hash) (*rpctypes.RPCTransac return nil, fmt.Errorf("failed to get eth msg") } } else { + // if additional fields are not empty try to parse synthetic tx from them ethMsg = b.parseSyntethicTxFromAdditionalFields(additional) if ethMsg == nil { b.logger.Error("failed to parse tx") @@ -180,6 +182,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ var txData evmtypes.TxData var ethMsg *evmtypes.MsgEthereumTx + // if additional fields are empty we can try to get MsgEthereumTx from sdk.Msg array if additional == nil { // #nosec G701 always in range if int(res.TxIndex) >= len(resBlock.Block.Txs) { @@ -203,6 +206,7 @@ func (b *Backend) GetTransactionReceipt(hash common.Hash) (map[string]interface{ return nil, err } } else { + // if additional fields are not empty try to parse synthetic tx from them ethMsg = b.parseSyntethicTxFromAdditionalFields(additional) if ethMsg == nil { b.logger.Error("failed to parse tx") diff --git a/rpc/types/events.go b/rpc/types/events.go index 50f6f04513..3839fb84df 100644 --- a/rpc/types/events.go +++ b/rpc/types/events.go @@ -188,7 +188,7 @@ func ParseTxResult(result *abci.ResponseDeliverTx, tx sdk.Tx) (*ParsedTxs, error // fix msg indexes, because some eth txs indexed here don't have corresponding sdk.Msg currMsgIndex := 0 for _, tx := range p.Txs { - if tx.Type == 88 { + if tx.Type == CosmosEVMTxType { tx.MsgIndex = math.MaxUint32 // todo: fix mapping as well } else { @@ -223,7 +223,7 @@ func ParseTxIndexerResult( txResult.Index, ) } - if parsedTx.Type == 88 { + if parsedTx.Type == CosmosEVMTxType { return ðermint.TxResult{ Height: txResult.Height, TxIndex: txResult.Index, @@ -270,7 +270,7 @@ func ParseTxBlockResult( return nil, nil, fmt.Errorf("ethereum tx not found in msgs: block %d, index %d", height, txIndex) } parsedTx := txs.Txs[0] - if parsedTx.Type == 88 { + if parsedTx.Type == CosmosEVMTxType { return ðermint.TxResult{ Height: height, // #nosec G701 always in range diff --git a/x/fungible/keeper/evm.go b/x/fungible/keeper/evm.go index c2cdd1d7ed..9a7ed00d5b 100644 --- a/x/fungible/keeper/evm.go +++ b/x/fungible/keeper/evm.go @@ -680,6 +680,9 @@ func (k Keeper) CallEVM( // value is the amount of wei to send; gaslimit is the custom gas limit, if nil EstimateGas is used // to bisect the correct gas limit (this may sometimes result in insufficient gas limit; not sure why) // +// noEthereumTxEvent flag is used to control if ethereum_tx eventsshould emitted +// which will mean these txs are indexed and available in rpc methods +// // returns (msg,err) the EVM execution result if there is any, even if error is non-nil due to contract reverts // Furthermore, err!=nil && msg!=nil && msg.Failed() means the contract call reverted; in which case // msg.Ret gives the RET code if contract revert with REVERT opcode with parameters.