Skip to content

Commit

Permalink
remove fungible admin and add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
kingpinXD committed Jul 10, 2024
1 parent 4f0d18a commit 16d38f1
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
2 changes: 1 addition & 1 deletion changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
4 changes: 0 additions & 4 deletions cmd/zetae2e/config/localnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
3 changes: 1 addition & 2 deletions contrib/localnet/scripts/start-zetacored.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
35 changes: 20 additions & 15 deletions e2e/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -199,7 +198,6 @@ func (a AdditionalAccounts) AsSlice() []Account {
a.UserEther,
a.UserMisc,
a.UserAdmin,
a.UserFungibleAdmin,
}
}

Expand All @@ -209,7 +207,6 @@ func (a PolicyAccounts) AsSlice() []Account {
a.OperationalPolicyAccount,
a.AdminPolicyAccount,

Check warning on line 208 in e2e/config/config.go

View check run for this annotation

Codecov / codecov/patch

e2e/config/config.go#L204-L208

Added lines #L204 - L208 were not covered by tests
}

}

// Validate validates the config
Expand All @@ -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)

Check warning on line 232 in e2e/config/config.go

View check run for this annotation

Codecov / codecov/patch

e2e/config/config.go#L232

Added line #L232 was not covered by tests
}
}

policyAccounts := c.PolicyAccounts.AsSlice()
for i, account := range policyAccounts {
if account.RawEVMAddress == "" {
continue

Check warning on line 239 in e2e/config/config.go

View check run for this annotation

Codecov / codecov/patch

e2e/config/config.go#L236-L239

Added lines #L236 - L239 were not covered by tests
}
err := account.Validate()
if err != nil {
return fmt.Errorf("validating policy account %d: %w", i, err)

Check warning on line 243 in e2e/config/config.go

View check run for this annotation

Codecov / codecov/patch

e2e/config/config.go#L241-L243

Added lines #L241 - L243 were not covered by tests
}
}

return nil
}

Expand Down Expand Up @@ -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

Check warning on line 287 in e2e/config/config.go

View check run for this annotation

Codecov / codecov/patch

e2e/config/config.go#L287

Added line #L287 was not covered by tests
Expand Down
3 changes: 2 additions & 1 deletion e2e/txserver/zeta_tx_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 0 additions & 2 deletions e2e/utils/zetacore.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,6 @@ import (
type CCTXClient = crosschaintypes.QueryClient

const (
FungibleAdminName = "fungibleadmin"

EmergencyPolicyName = "emergency"
AdminPolicyName = "admin"
OperationalPolicyName = "operational"
Expand Down

0 comments on commit 16d38f1

Please sign in to comment.