diff --git a/docs/cli/zetacored/zetacored_tx_authority.md b/docs/cli/zetacored/zetacored_tx_authority.md index 78af9f3a66..59a0ca9ffa 100644 --- a/docs/cli/zetacored/zetacored_tx_authority.md +++ b/docs/cli/zetacored/zetacored_tx_authority.md @@ -26,8 +26,8 @@ zetacored tx authority [flags] ### SEE ALSO * [zetacored tx](zetacored_tx.md) - Transactions subcommands -* [zetacored tx authority add-authorization](zetacored_tx_authority_add-authorization.md) - add a new authorization or update the policy of an existing authorization.Policy type can be 0 for groupEmergency, 1 for groupOperational, 2 for groupAdmin +* [zetacored tx authority add-authorization](zetacored_tx_authority_add-authorization.md) - Add a new authorization or update the policy of an existing authorization. Policy type can be 0 for groupEmergency, 1 for groupOperational, 2 for groupAdmin. * [zetacored tx authority remove-authorization](zetacored_tx_authority_remove-authorization.md) - removes an existing authorization * [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 +* [zetacored tx authority update-policies](zetacored_tx_authority_update-policies.md) - Update policies to values provided in the JSON file. diff --git a/docs/cli/zetacored/zetacored_tx_authority_add-authorization.md b/docs/cli/zetacored/zetacored_tx_authority_add-authorization.md index b0a28c7b53..4ed717b2b6 100644 --- a/docs/cli/zetacored/zetacored_tx_authority_add-authorization.md +++ b/docs/cli/zetacored/zetacored_tx_authority_add-authorization.md @@ -1,6 +1,6 @@ # tx authority add-authorization -add a new authorization or update the policy of an existing authorization.Policy type can be 0 for groupEmergency, 1 for groupOperational, 2 for groupAdmin +Add a new authorization or update the policy of an existing authorization. Policy type can be 0 for groupEmergency, 1 for groupOperational, 2 for groupAdmin. ``` zetacored tx authority add-authorization [msg-url] [authorized-policy] [flags] diff --git a/docs/cli/zetacored/zetacored_tx_authority_update-policies.md b/docs/cli/zetacored/zetacored_tx_authority_update-policies.md index c26e3f0080..7e375d8d1e 100644 --- a/docs/cli/zetacored/zetacored_tx_authority_update-policies.md +++ b/docs/cli/zetacored/zetacored_tx_authority_update-policies.md @@ -1,6 +1,6 @@ # tx authority update-policies -Update the policies +Update policies to values provided in the JSON file. ``` zetacored tx authority update-policies [policies-json-file] [flags] diff --git a/docs/spec/authority/messages.md b/docs/spec/authority/messages.md index 4fb65814c9..8ee4264bab 100644 --- a/docs/spec/authority/messages.md +++ b/docs/spec/authority/messages.md @@ -2,6 +2,8 @@ ## MsgUpdatePolicies +UpdatePolicies updates policies + ```proto message MsgUpdatePolicies { string creator = 1; @@ -11,6 +13,9 @@ message MsgUpdatePolicies { ## 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; @@ -20,6 +25,9 @@ message MsgUpdateChainInfo { ## MsgAddAuthorization +AddAuthorization defines a method to add an authorization.If the authorization already exists, it will be overwritten with the provided policy. +This should be called by the admin policy account. + ```proto message MsgAddAuthorization { string creator = 1; @@ -30,6 +38,8 @@ message MsgAddAuthorization { ## MsgRemoveAuthorization +RemoveAuthorization removes the authorization from the list. It should be called by the admin policy account. + ```proto message MsgRemoveAuthorization { string creator = 1; diff --git a/docs/spec/crosschain/messages.md b/docs/spec/crosschain/messages.md index d2626d2da2..3ac1d484bb 100644 --- a/docs/spec/crosschain/messages.md +++ b/docs/spec/crosschain/messages.md @@ -2,6 +2,10 @@ ## MsgAddOutboundTracker +AddOutboundTracker adds a new record to the outbound transaction tracker. +only the admin policy account and the observer validators are authorized to broadcast this message without proof. +If no pending cctx is found, the tracker is removed, if there is an existed tracker with the nonce & chainID. + ```proto message MsgAddOutboundTracker { string creator = 1; @@ -16,6 +20,8 @@ message MsgAddOutboundTracker { ## MsgAddInboundTracker +AddInboundTracker adds a new record to the inbound transaction tracker. + ```proto message MsgAddInboundTracker { string creator = 1; @@ -30,6 +36,10 @@ message MsgAddInboundTracker { ## MsgRemoveOutboundTracker +RemoveOutboundTracker removes a record from the outbound transaction tracker by chain ID and nonce. + +Authorized: admin policy group 1. + ```proto message MsgRemoveOutboundTracker { string creator = 1; @@ -40,6 +50,12 @@ message MsgRemoveOutboundTracker { ## MsgVoteGasPrice +VoteGasPrice submits information about the connected chain's gas price at a specific block +height. Gas price submitted by each validator is recorded separately and a +median index is updated. + +Only observer validators are authorized to broadcast this message. + ```proto message MsgVoteGasPrice { string creator = 1; @@ -52,6 +68,48 @@ message MsgVoteGasPrice { ## MsgVoteOutbound +VoteOutbound casts a vote on an outbound transaction observed on a connected chain (after +it has been broadcasted to and finalized on a connected chain). If this is +the first vote, a new ballot is created. When a threshold of votes is +reached, the ballot is finalized. When a ballot is finalized, the outbound +transaction is processed. + +If the observation is successful, the difference between zeta burned +and minted is minted by the bank module and deposited into the module +account. + +If the observation is unsuccessful, the logic depends on the previous +status. + +If the previous status was `PendingOutbound`, a new revert transaction is +created. To cover the revert transaction fee, the required amount of tokens +submitted with the CCTX are swapped using a Uniswap V2 contract instance on +ZetaChain for the ZRC20 of the gas token of the receiver chain. The ZRC20 +tokens are then +burned. The nonce is updated. If everything is successful, the CCTX status is +changed to `PendingRevert`. + +If the previous status was `PendingRevert`, the CCTX is aborted. + +```mermaid +stateDiagram-v2 + + state observation <> + state success_old_status <> + state fail_old_status <> + PendingOutbound --> observation: Finalize outbound + observation --> success_old_status: Observation succeeded + success_old_status --> Reverted: Old status is PendingRevert + success_old_status --> OutboundMined: Old status is PendingOutbound + observation --> fail_old_status: Observation failed + fail_old_status --> PendingRevert: Old status is PendingOutbound + fail_old_status --> Aborted: Old status is PendingRevert + PendingOutbound --> Aborted: Finalize outbound error + +``` + +Only observer validators are authorized to broadcast this message. + ```proto message MsgVoteOutbound { string creator = 1; @@ -71,6 +129,48 @@ message MsgVoteOutbound { ## MsgVoteInbound +VoteInbound casts a vote on an inbound transaction observed on a connected chain. If this +is the first vote, a new ballot is created. When a threshold of votes is +reached, the ballot is finalized. When a ballot is finalized, a new CCTX is +created. + +If the receiver chain is ZetaChain, `HandleEVMDeposit` is called. If the +tokens being deposited are ZETA, `MintZetaToEVMAccount` is called and the +tokens are minted to the receiver account on ZetaChain. If the tokens being +deposited are gas tokens or ERC20 of a connected chain, ZRC20's `deposit` +method is called and the tokens are deposited to the receiver account on +ZetaChain. If the message is not empty, system contract's `depositAndCall` +method is also called and an omnichain contract on ZetaChain is executed. +Omnichain contract address and arguments are passed as part of the message. +If everything is successful, the CCTX status is changed to `OutboundMined`. + +If the receiver chain is a connected chain, the `FinalizeInbound` method is +called to prepare the CCTX to be processed as an outbound transaction. To +cover the outbound transaction fee, the required amount of tokens submitted +with the CCTX are swapped using a Uniswap V2 contract instance on ZetaChain +for the ZRC20 of the gas token of the receiver chain. The ZRC20 tokens are +then burned. The nonce is updated. If everything is successful, the CCTX +status is changed to `PendingOutbound`. + +```mermaid +stateDiagram-v2 + + state evm_deposit_success <> + state finalize_inbound <> + state evm_deposit_error <> + PendingInbound --> evm_deposit_success: Receiver is ZetaChain + evm_deposit_success --> OutboundMined: EVM deposit success + evm_deposit_success --> evm_deposit_error: EVM deposit error + evm_deposit_error --> PendingRevert: Contract error + evm_deposit_error --> Aborted: Internal error, invalid chain, gas, nonce + PendingInbound --> finalize_inbound: Receiver is connected chain + finalize_inbound --> Aborted: Finalize inbound error + finalize_inbound --> PendingOutbound: Finalize inbound success + +``` + +Only observer validators are authorized to broadcast this message. + ```proto message MsgVoteInbound { string creator = 1; @@ -92,6 +192,11 @@ message MsgVoteInbound { ## MsgWhitelistERC20 +WhitelistERC20 deploys a new zrc20, create a foreign coin object for the ERC20 +and emit a crosschain tx to whitelist the ERC20 on the external chain + +Authorized: admin policy group 1. + ```proto message MsgWhitelistERC20 { string creator = 1; @@ -106,6 +211,8 @@ message MsgWhitelistERC20 { ## MsgUpdateTssAddress +UpdateTssAddress updates the TSS address. + ```proto message MsgUpdateTssAddress { string creator = 1; @@ -115,6 +222,8 @@ message MsgUpdateTssAddress { ## MsgMigrateTssFunds +MigrateTssFunds migrates the funds from the current TSS to the new TSS + ```proto message MsgMigrateTssFunds { string creator = 1; @@ -125,6 +234,9 @@ message MsgMigrateTssFunds { ## MsgAbortStuckCCTX +AbortStuckCCTX aborts a stuck CCTX +Authorized: admin policy group 2 + ```proto message MsgAbortStuckCCTX { string creator = 1; @@ -134,6 +246,12 @@ message MsgAbortStuckCCTX { ## MsgRefundAbortedCCTX +RefundAbortedCCTX refunds the aborted CCTX. +It verifies if the CCTX is aborted and not refunded, and if the refund address is valid. +It refunds the amount to the refund address and sets the CCTX as refunded. +Refer to documentation for GetRefundAddress for the refund address logic. +Refer to documentation for GetAbortedAmount for the aborted amount logic. + ```proto message MsgRefundAbortedCCTX { string creator = 1; @@ -144,6 +262,9 @@ message MsgRefundAbortedCCTX { ## MsgUpdateRateLimiterFlags +UpdateRateLimiterFlags updates the rate limiter flags. +Authorized: admin policy operational. + ```proto message MsgUpdateRateLimiterFlags { string creator = 1; diff --git a/docs/spec/emissions/messages.md b/docs/spec/emissions/messages.md index 557bf1e214..b3549681bd 100644 --- a/docs/spec/emissions/messages.md +++ b/docs/spec/emissions/messages.md @@ -2,6 +2,9 @@ ## MsgUpdateParams +UpdateParams defines a governance operation for updating the x/emissions module parameters. +The authority is hard-coded to the x/gov module account. + ```proto message MsgUpdateParams { string authority = 1; @@ -11,6 +14,11 @@ message MsgUpdateParams { ## MsgWithdrawEmission +WithdrawEmission allows the user to withdraw from their withdrawable emissions. +on a successful withdrawal, the amount is transferred from the undistributed rewards pool to the user's account. +if the amount to be withdrawn is greater than the available withdrawable emission, the max available amount is withdrawn. +if the pool does not have enough balance to process this request, an error is returned. + ```proto message MsgWithdrawEmission { string creator = 1; diff --git a/docs/spec/fungible/messages.md b/docs/spec/fungible/messages.md index 2d051c03ea..93c7864aef 100644 --- a/docs/spec/fungible/messages.md +++ b/docs/spec/fungible/messages.md @@ -2,6 +2,10 @@ ## MsgDeploySystemContracts +DeploySystemContracts deploy new instances of the system contracts + +Authorized: admin policy group 2. + ```proto message MsgDeploySystemContracts { string creator = 1; @@ -10,6 +14,25 @@ message MsgDeploySystemContracts { ## MsgDeployFungibleCoinZRC20 +DeployFungibleCoinZRC20 deploys a fungible coin from a connected chains as a ZRC20 on ZetaChain. + +If this is a gas coin, the following happens: + +* ZRC20 contract for the coin is deployed +* contract address of ZRC20 is set as a token address in the system +contract +* ZETA tokens are minted and deposited into the module account +* setGasZetaPool is called on the system contract to add the information +about the pool to the system contract +* addLiquidityETH is called to add liquidity to the pool + +If this is a non-gas coin, the following happens: + +* ZRC20 contract for the coin is deployed +* The coin is added to the list of foreign coins in the module's state + +Authorized: admin policy group 2. + ```proto message MsgDeployFungibleCoinZRC20 { string creator = 1; @@ -25,6 +48,11 @@ message MsgDeployFungibleCoinZRC20 { ## MsgRemoveForeignCoin +RemoveForeignCoin removes a coin from the list of foreign coins in the +module's state. + +Authorized: admin policy group 2. + ```proto message MsgRemoveForeignCoin { string creator = 1; @@ -34,6 +62,8 @@ message MsgRemoveForeignCoin { ## MsgUpdateSystemContract +UpdateSystemContract updates the system contract + ```proto message MsgUpdateSystemContract { string creator = 1; @@ -43,6 +73,14 @@ message MsgUpdateSystemContract { ## MsgUpdateContractBytecode +UpdateContractBytecode updates the bytecode of a contract from the bytecode +of an existing contract Only a ZRC20 contract or the WZeta connector contract +can be updated IMPORTANT: the new contract bytecode must have the same +storage layout as the old contract bytecode the new contract can add new +variable but cannot remove any existing variable + +Authozied: admin policy group 2 + ```proto message MsgUpdateContractBytecode { string creator = 1; @@ -53,6 +91,8 @@ message MsgUpdateContractBytecode { ## MsgUpdateZRC20WithdrawFee +UpdateZRC20WithdrawFee updates the withdraw fee and gas limit of a zrc20 token + ```proto message MsgUpdateZRC20WithdrawFee { string creator = 1; @@ -64,6 +104,10 @@ message MsgUpdateZRC20WithdrawFee { ## MsgUpdateZRC20LiquidityCap +UpdateZRC20LiquidityCap updates the liquidity cap for a ZRC20 token. + +Authorized: admin policy group 2. + ```proto message MsgUpdateZRC20LiquidityCap { string creator = 1; @@ -74,6 +118,9 @@ message MsgUpdateZRC20LiquidityCap { ## MsgPauseZRC20 +PauseZRC20 pauses a list of ZRC20 tokens +Authorized: admin policy group groupEmergency. + ```proto message MsgPauseZRC20 { string creator = 1; @@ -83,6 +130,9 @@ message MsgPauseZRC20 { ## MsgUnpauseZRC20 +UnpauseZRC20 unpauses the ZRC20 token +Authorized: admin policy group groupOperational. + ```proto message MsgUnpauseZRC20 { string creator = 1; diff --git a/docs/spec/lightclient/messages.md b/docs/spec/lightclient/messages.md index 95b9743c64..394d4b7398 100644 --- a/docs/spec/lightclient/messages.md +++ b/docs/spec/lightclient/messages.md @@ -2,6 +2,9 @@ ## MsgEnableHeaderVerification +EnableHeaderVerification enables the verification flags for the given chain IDs +Enabled chains allow the submissions of block headers and using it to verify the correctness of proofs + ```proto message MsgEnableHeaderVerification { string creator = 1; @@ -11,6 +14,9 @@ message MsgEnableHeaderVerification { ## MsgDisableHeaderVerification +DisableHeaderVerification disables the verification flags for the given chain IDs +Disabled chains do not allow the submissions of block headers or using it to verify the correctness of proofs + ```proto message MsgDisableHeaderVerification { string creator = 1; diff --git a/docs/spec/observer/messages.md b/docs/spec/observer/messages.md index e877867d94..045de79551 100644 --- a/docs/spec/observer/messages.md +++ b/docs/spec/observer/messages.md @@ -2,6 +2,8 @@ ## MsgAddObserver +AddObserver adds an observer address to the observer set + ```proto message MsgAddObserver { string creator = 1; @@ -13,6 +15,10 @@ message MsgAddObserver { ## MsgUpdateObserver +UpdateObserver handles updating an observer address +Authorized: admin policy (admin update), old observer address (if the +reason is that the observer was tombstoned). + ```proto message MsgUpdateObserver { string creator = 1; @@ -24,6 +30,11 @@ message MsgUpdateObserver { ## MsgUpdateChainParams +UpdateChainParams updates chain parameters for a specific chain, or add a new one. +Chain parameters include: confirmation count, outbound transaction schedule interval, ZETA token, +connector and ERC20 custody contract addresses, etc. +Only the admin policy account is authorized to broadcast this message. + ```proto message MsgUpdateChainParams { string creator = 1; @@ -33,6 +44,8 @@ message MsgUpdateChainParams { ## MsgRemoveChainParams +RemoveChainParams removes chain parameters for a specific chain. + ```proto message MsgRemoveChainParams { string creator = 1; @@ -52,6 +65,11 @@ message MsgVoteBlame { ## MsgUpdateKeygen +UpdateKeygen updates the block height of the keygen and sets the status to +"pending keygen". + +Authorized: admin policy group 1. + ```proto message MsgUpdateKeygen { string creator = 1; @@ -61,6 +79,8 @@ message MsgUpdateKeygen { ## MsgVoteBlockHeader +VoteBlockHeader vote for a new block header to the storers + ```proto message MsgVoteBlockHeader { string creator = 1; @@ -73,6 +93,8 @@ message MsgVoteBlockHeader { ## MsgResetChainNonces +ResetChainNonces handles resetting chain nonces + ```proto message MsgResetChainNonces { string creator = 1; @@ -84,6 +106,17 @@ message MsgResetChainNonces { ## MsgVoteTSS +VoteTSS votes on creating a TSS key and recording the information about it (public +key, participant and operator addresses, finalized and keygen heights). + +If the vote passes, the information about the TSS key is recorded on chain +and the status of the keygen is set to "success". + +Fails if the keygen does not exist, the keygen has been already +completed, or the keygen has failed. + +Only node accounts are authorized to broadcast this message. + ```proto message MsgVoteTSS { string creator = 1; @@ -95,6 +128,9 @@ message MsgVoteTSS { ## MsgEnableCCTX +EnableCCTX enables the IsInboundEnabled and IsOutboundEnabled flags.These flags control the creation of inbounds and outbounds. +The flags are enabled by the policy account with the groupOperational policy type. + ```proto message MsgEnableCCTX { string creator = 1; @@ -105,6 +141,9 @@ message MsgEnableCCTX { ## MsgDisableCCTX +DisableCCTX disables the IsInboundEnabled and IsOutboundEnabled flags. These flags control the creation of inbounds and outbounds. +The flags are disabled by the policy account with the groupEmergency policy type. + ```proto message MsgDisableCCTX { string creator = 1; @@ -115,6 +154,9 @@ message MsgDisableCCTX { ## MsgUpdateGasPriceIncreaseFlags +UpdateGasPriceIncreaseFlags updates the GasPriceIncreaseFlags. These flags control the increase of gas prices. +The flags are updated by the policy account with the groupOperational policy type. + ```proto message MsgUpdateGasPriceIncreaseFlags { string creator = 1; diff --git a/testutil/keeper/authority.go b/testutil/keeper/authority.go index 3e7f98b506..be9101d1df 100644 --- a/testutil/keeper/authority.go +++ b/testutil/keeper/authority.go @@ -79,7 +79,7 @@ func MockIsAuthorized(m *mock.Mock, address string, policyType types.PolicyType, m.On("IsAuthorized", mock.Anything, address, policyType).Return(isAuthorized).Once() } -func SetAdminPolices(ctx sdk.Context, ak *keeper.Keeper) string { +func SetAdminPolicies(ctx sdk.Context, ak *keeper.Keeper) string { admin := sample.AccAddress() ak.SetPolicies(ctx, types.Policies{Items: []*types.Policy{ { diff --git a/x/authority/client/cli/tx.go b/x/authority/client/cli/tx.go index 7eea187fc5..8c1c1396db 100644 --- a/x/authority/client/cli/tx.go +++ b/x/authority/client/cli/tx.go @@ -20,7 +20,7 @@ func GetTxCmd() *cobra.Command { } cmd.AddCommand( - CmdUpdatePolices(), + CmdUpdatePolicies(), CmdUpdateChainInfo(), CmdAddAuthorization(), CmdRemoveAuthorization(), diff --git a/x/authority/client/cli/tx_update_policies.go b/x/authority/client/cli/tx_update_policies.go index 19bfe6ab4f..69b8cd71f0 100644 --- a/x/authority/client/cli/tx_update_policies.go +++ b/x/authority/client/cli/tx_update_policies.go @@ -14,10 +14,10 @@ import ( "github.com/zeta-chain/zetacore/x/authority/types" ) -func CmdUpdatePolices() *cobra.Command { +func CmdUpdatePolicies() *cobra.Command { cmd := &cobra.Command{ Use: "update-policies [policies-json-file]", - Short: "Update the policies", + Short: "Update policies to values provided in the JSON file.", Args: cobra.ExactArgs(1), RunE: func(cmd *cobra.Command, args []string) (err error) { policies, err := ReadPoliciesFromFile(os.DirFS("."), args[0]) diff --git a/x/authority/keeper/msg_server_add_authorization_test.go b/x/authority/keeper/msg_server_add_authorization_test.go index 340c6f975e..95c962951e 100644 --- a/x/authority/keeper/msg_server_add_authorization_test.go +++ b/x/authority/keeper/msg_server_add_authorization_test.go @@ -16,7 +16,7 @@ func TestMsgServer_AddAuthorization(t *testing.T) { const url = "/zetachain.zetacore.sample.ABC" t.Run("successfully add authorization of type admin to existing authorization list", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) k.SetAuthorizationList(ctx, types.DefaultAuthorizationsList()) msgServer := keeper.NewMsgServerImpl(*k) prevLen := len(types.DefaultAuthorizationsList().Authorizations) @@ -40,7 +40,7 @@ func TestMsgServer_AddAuthorization(t *testing.T) { t.Run("successfully add authorization of type operational to existing authorization list", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) k.SetAuthorizationList(ctx, types.DefaultAuthorizationsList()) prevLen := len(types.DefaultAuthorizationsList().Authorizations) msgServer := keeper.NewMsgServerImpl(*k) @@ -64,7 +64,7 @@ func TestMsgServer_AddAuthorization(t *testing.T) { t.Run("successfully add authorization of type emergency to existing authorization list", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) k.SetAuthorizationList(ctx, types.DefaultAuthorizationsList()) prevLen := len(types.DefaultAuthorizationsList().Authorizations) msgServer := keeper.NewMsgServerImpl(*k) @@ -88,7 +88,7 @@ func TestMsgServer_AddAuthorization(t *testing.T) { t.Run("successfully add authorization to empty authorization list", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) k.SetAuthorizationList(ctx, types.AuthorizationList{}) msgServer := keeper.NewMsgServerImpl(*k) @@ -111,7 +111,7 @@ func TestMsgServer_AddAuthorization(t *testing.T) { t.Run("successfully set authorization when list is not found ", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) msgServer := keeper.NewMsgServerImpl(*k) authorizationList, found := k.GetAuthorizationList(ctx) require.False(t, found) @@ -135,7 +135,7 @@ func TestMsgServer_AddAuthorization(t *testing.T) { t.Run("update existing authorization", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) authorizationList := types.AuthorizationList{Authorizations: []types.Authorization{ { MsgUrl: "/zetachain.zetacore.sample.ABC", @@ -188,7 +188,7 @@ func TestMsgServer_AddAuthorization(t *testing.T) { // This scenario is not possible as the authorization list is always valid.But it is good to have in case the validation logic is changed in the future t.Run("fail to set invalid authorization list", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) authorizationList := types.AuthorizationList{Authorizations: []types.Authorization{ { MsgUrl: url, diff --git a/x/authority/keeper/msg_server_remove_authorization_test.go b/x/authority/keeper/msg_server_remove_authorization_test.go index 6fa326466e..566369839a 100644 --- a/x/authority/keeper/msg_server_remove_authorization_test.go +++ b/x/authority/keeper/msg_server_remove_authorization_test.go @@ -15,7 +15,7 @@ import ( func TestMsgServer_RemoveAuthorization(t *testing.T) { t.Run("successfully remove operational policy authorization", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) k.SetAuthorizationList(ctx, types.DefaultAuthorizationsList()) prevLen := len(types.DefaultAuthorizationsList().Authorizations) msgServer := keeper.NewMsgServerImpl(*k) @@ -43,7 +43,7 @@ func TestMsgServer_RemoveAuthorization(t *testing.T) { t.Run("successfully remove admin policy authorization", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) k.SetAuthorizationList(ctx, types.DefaultAuthorizationsList()) prevLen := len(types.DefaultAuthorizationsList().Authorizations) msgServer := keeper.NewMsgServerImpl(*k) @@ -71,7 +71,7 @@ func TestMsgServer_RemoveAuthorization(t *testing.T) { t.Run("successfully remove emergency policy authorization", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) k.SetAuthorizationList(ctx, types.DefaultAuthorizationsList()) prevLen := len(types.DefaultAuthorizationsList().Authorizations) msgServer := keeper.NewMsgServerImpl(*k) @@ -125,7 +125,7 @@ func TestMsgServer_RemoveAuthorization(t *testing.T) { t.Run("unable to remove authorization if authorization list does not exist", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) msgServer := keeper.NewMsgServerImpl(*k) url := types.OperationPolicyMessages[0] @@ -140,7 +140,7 @@ func TestMsgServer_RemoveAuthorization(t *testing.T) { t.Run("unable to remove authorization if authorization does not exist", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) authorizationList := types.AuthorizationList{Authorizations: []types.Authorization{ { MsgUrl: "ABC", @@ -171,7 +171,7 @@ func TestMsgServer_RemoveAuthorization(t *testing.T) { t.Run("unable to remove authorization if authorization list is invalid", func(t *testing.T) { k, ctx := keepertest.AuthorityKeeper(t) - admin := keepertest.SetAdminPolices(ctx, k) + admin := keepertest.SetAdminPolicies(ctx, k) authorizationList := types.AuthorizationList{Authorizations: []types.Authorization{ { MsgUrl: "ABC", diff --git a/x/crosschain/keeper/evm_hooks_test.go b/x/crosschain/keeper/evm_hooks_test.go index 3ec4b49e65..80f8c3b28b 100644 --- a/x/crosschain/keeper/evm_hooks_test.go +++ b/x/crosschain/keeper/evm_hooks_test.go @@ -470,7 +470,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) - admin := keepertest.SetAdminPolices(ctx, zk.AuthorityKeeper) + admin := keepertest.SetAdminPolicies(ctx, zk.AuthorityKeeper) SetupStateForProcessLogsZetaSent(t, ctx, k, zk, sdkk, chain, admin) amount, ok := sdkmath.NewIntFromString("20000000000000000000000") @@ -516,7 +516,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) - admin := keepertest.SetAdminPolices(ctx, zk.AuthorityKeeper) + admin := keepertest.SetAdminPolicies(ctx, zk.AuthorityKeeper) SetupStateForProcessLogsZetaSent(t, ctx, k, zk, sdkk, chain, admin) event, err := crosschainkeeper.ParseZetaSentEvent( @@ -538,7 +538,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { chain := chains.Ethereum SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) - admin := keepertest.SetAdminPolices(ctx, zk.AuthorityKeeper) + admin := keepertest.SetAdminPolicies(ctx, zk.AuthorityKeeper) SetupStateForProcessLogsZetaSent(t, ctx, k, zk, sdkk, chain, admin) amount, ok := sdkmath.NewIntFromString("20000000000000000000000") @@ -570,7 +570,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) - admin := keepertest.SetAdminPolices(ctx, zk.AuthorityKeeper) + admin := keepertest.SetAdminPolicies(ctx, zk.AuthorityKeeper) SetupStateForProcessLogsZetaSent(t, ctx, k, zk, sdkk, chain, admin) amount, ok := sdkmath.NewIntFromString("20000000000000000000000") @@ -634,7 +634,7 @@ func TestKeeper_ProcessZetaSentEvent(t *testing.T) { setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) - admin := keepertest.SetAdminPolices(ctx, zk.AuthorityKeeper) + admin := keepertest.SetAdminPolicies(ctx, zk.AuthorityKeeper) SetupStateForProcessLogsZetaSent(t, ctx, k, zk, sdkk, chain, admin) zk.ObserverKeeper.SetChainNonces(ctx, observertypes.ChainNonces{ @@ -699,7 +699,7 @@ func TestKeeper_ProcessLogs(t *testing.T) { chainID := chain.ChainId setSupportedChain(ctx, zk, chainID) SetupStateForProcessLogs(t, ctx, k, zk, sdkk, chain) - admin := keepertest.SetAdminPolices(ctx, zk.AuthorityKeeper) + admin := keepertest.SetAdminPolicies(ctx, zk.AuthorityKeeper) SetupStateForProcessLogsZetaSent(t, ctx, k, zk, sdkk, chain, admin) amount, ok := sdkmath.NewIntFromString("20000000000000000000000")