From 16d38f1f4e540dabc5b4e53c3f00b88aab05a619 Mon Sep 17 00:00:00 2001 From: Tanmay Date: Wed, 10 Jul 2024 13:47:48 -0400 Subject: [PATCH] remove fungible admin and add changelog --- changelog.md | 2 +- cmd/zetae2e/config/localnet.yml | 4 --- contrib/localnet/scripts/start-zetacored.sh | 3 +- e2e/config/config.go | 35 ++++++++++++--------- e2e/txserver/zeta_tx_server.go | 3 +- e2e/utils/zetacore.go | 2 -- 6 files changed, 24 insertions(+), 25 deletions(-) diff --git a/changelog.md b/changelog.md index 7b679fb678..fc417b1109 100644 --- a/changelog.md +++ b/changelog.md @@ -76,7 +76,7 @@ * [2349](https://github.com/zeta-chain/node/pull/2349) - add TestBitcoinDepositRefund and WithdrawBitcoinMultipleTimes E2E tests * [2368](https://github.com/zeta-chain/node/pull/2368) - eliminate panic usage across testing suite * [2369](https://github.com/zeta-chain/node/pull/2369) - fix random cross-chain swap failure caused by using tiny UTXO - +* [2549](https://github.com/zeta-chain/node/pull/2459) - add separate accounts for each policy in e2e tests ### Fixes diff --git a/cmd/zetae2e/config/localnet.yml b/cmd/zetae2e/config/localnet.yml index 8026e67219..114f1c4f32 100644 --- a/cmd/zetae2e/config/localnet.yml +++ b/cmd/zetae2e/config/localnet.yml @@ -32,10 +32,6 @@ additional_accounts: bech32_address: "zeta17w0adeg64ky0daxwd2ugyuneellmjgnx4e483s" evm_address: "0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266" private_key: "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" - user_fungible_admin: - bech32_address: "zeta1svzuz982w09vf2y08xsh8qplj36phyz466krj3" - evm_address: "0x8305C114Ea73cAc4A88f39A173803F94741b9055" - private_key: "d88d09a7d6849c15a36eb6931f9dd616091a63e9849a2cc86f309ba11fb8fec5" policy_accounts: emergency_policy_account: bech32_address: "zeta16m2cnrdwtgweq4njc6t470vl325gw4kp6s7tap" diff --git a/contrib/localnet/scripts/start-zetacored.sh b/contrib/localnet/scripts/start-zetacored.sh index 5e4b7e72b6..c3e53c6c93 100755 --- a/contrib/localnet/scripts/start-zetacored.sh +++ b/contrib/localnet/scripts/start-zetacored.sh @@ -219,8 +219,7 @@ then # set admin account zetacored add-genesis-account zeta1n0rn6sne54hv7w2uu93fl48ncyqz97d3kty6sh 100000000000000000000000000azeta # Funds the localnet_gov_admin account - - address=$(yq -r '.additional_accounts.user_fungible_admin.bech32_address' /root/config.yml) + emergency_policy=$(yq -r '.policy_accounts.emergency_policy_account.bech32_address' /root/config.yml) admin_policy=$(yq -r '.policy_accounts.admin_policy_account.bech32_address' /root/config.yml) operational_policy=$(yq -r '.policy_accounts.operational_policy_account.bech32_address' /root/config.yml) diff --git a/e2e/config/config.go b/e2e/config/config.go index 235b7cb568..6cde9bac26 100644 --- a/e2e/config/config.go +++ b/e2e/config/config.go @@ -58,14 +58,13 @@ type Account struct { // AdditionalAccounts are extra accounts required to run specific tests type AdditionalAccounts struct { - UserERC20 Account `yaml:"user_erc20"` - UserZetaTest Account `yaml:"user_zeta_test"` - UserZEVMMPTest Account `yaml:"user_zevm_mp_test"` - UserBitcoin Account `yaml:"user_bitcoin"` - UserEther Account `yaml:"user_ether"` - UserMisc Account `yaml:"user_misc"` - UserAdmin Account `yaml:"user_admin"` - UserFungibleAdmin Account `yaml:"user_fungible_admin"` + UserERC20 Account `yaml:"user_erc20"` + UserZetaTest Account `yaml:"user_zeta_test"` + UserZEVMMPTest Account `yaml:"user_zevm_mp_test"` + UserBitcoin Account `yaml:"user_bitcoin"` + UserEther Account `yaml:"user_ether"` + UserMisc Account `yaml:"user_misc"` + UserAdmin Account `yaml:"user_admin"` } type PolicyAccounts struct { @@ -199,7 +198,6 @@ func (a AdditionalAccounts) AsSlice() []Account { a.UserEther, a.UserMisc, a.UserAdmin, - a.UserFungibleAdmin, } } @@ -209,7 +207,6 @@ func (a PolicyAccounts) AsSlice() []Account { a.OperationalPolicyAccount, a.AdminPolicyAccount, } - } // Validate validates the config @@ -232,9 +229,21 @@ func (c Config) Validate() error { } err := account.Validate() if err != nil { - return fmt.Errorf("validating account %d: %w", i, err) + return fmt.Errorf("validating additional account %d: %w", i, err) } } + + policyAccounts := c.PolicyAccounts.AsSlice() + for i, account := range policyAccounts { + if account.RawEVMAddress == "" { + continue + } + err := account.Validate() + if err != nil { + return fmt.Errorf("validating policy account %d: %w", i, err) + } + } + return nil } @@ -273,10 +282,6 @@ func (c *Config) GenerateKeys() error { if err != nil { return err } - c.AdditionalAccounts.UserFungibleAdmin, err = generateAccount() - if err != nil { - return err - } c.PolicyAccounts.EmergencyPolicyAccount, err = generateAccount() if err != nil { return err diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index c0119eadec..9b93aee293 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -153,7 +153,8 @@ func (zts ZetaTxServer) GetAccountAddressFromName(name string) (string, error) { return addr.String(), nil } -// GetAccountAddressFromName returns the account address from the given name +// MustGetAccountAddressFromName returns the account address from the given name.It panics on error +// and should be used in tests only func (zts ZetaTxServer) MustGetAccountAddressFromName(name string) string { acc, err := zts.clientCtx.Keyring.Key(name) if err != nil { diff --git a/e2e/utils/zetacore.go b/e2e/utils/zetacore.go index 89f5c81042..a10dc8d68b 100644 --- a/e2e/utils/zetacore.go +++ b/e2e/utils/zetacore.go @@ -16,8 +16,6 @@ import ( type CCTXClient = crosschaintypes.QueryClient const ( - FungibleAdminName = "fungibleadmin" - EmergencyPolicyName = "emergency" AdminPolicyName = "admin" OperationalPolicyName = "operational"