From 58b2d923dbf95f8e91e040079420c6ff9acb0124 Mon Sep 17 00:00:00 2001 From: lumtis Date: Wed, 17 Apr 2024 10:20:18 +0200 Subject: [PATCH] revert fungible admin --- cmd/zetae2e/balances.go | 5 +++-- cmd/zetae2e/bitcoin_address.go | 5 +++-- cmd/zetae2e/local/accounts.go | 2 +- cmd/zetae2e/local/local.go | 4 ++-- cmd/zetae2e/local/utils.go | 4 ++-- cmd/zetae2e/run.go | 7 +++---- cmd/zetae2e/setup_bitcoin.go | 5 +++-- cmd/zetae2e/show_tss.go | 12 ++++++------ cmd/zetae2e/stress.go | 5 ++--- e2e/e2etests/test_erc20_refund.go | 2 +- e2e/e2etests/test_eth_deposit.go | 4 ++-- e2e/e2etests/test_migrate_chain_support.go | 14 +++++++------- e2e/e2etests/test_pause_zrc20.go | 4 ++-- e2e/e2etests/test_update_bytecode_zrc20.go | 2 +- e2e/runner/runner.go | 20 ++++++++++---------- e2e/runner/setup_zeta.go | 6 +++--- e2e/utils/zetacore.go | 2 +- 17 files changed, 52 insertions(+), 51 deletions(-) diff --git a/cmd/zetae2e/balances.go b/cmd/zetae2e/balances.go index d384d965c9..3815613781 100644 --- a/cmd/zetae2e/balances.go +++ b/cmd/zetae2e/balances.go @@ -9,6 +9,7 @@ import ( "github.com/spf13/cobra" "github.com/zeta-chain/zetacore/app" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" + "github.com/zeta-chain/zetacore/cmd/zetae2e/local" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" "github.com/zeta-chain/zetacore/e2e/utils" @@ -69,8 +70,8 @@ func runBalances(cmd *cobra.Command, args []string) error { conf, ethcommon.HexToAddress(evmAddr), conf.Accounts.EVMPrivKey, - utils.AdminName, // placeholder value, not used - AdminMnemonic, // placeholder value, not used + utils.FungibleAdminName, // placeholder value, not used + local.FungibleAdminMnemonic, // placeholder value, not used logger, ) if err != nil { diff --git a/cmd/zetae2e/bitcoin_address.go b/cmd/zetae2e/bitcoin_address.go index a0b2e9dc4b..77df85d116 100644 --- a/cmd/zetae2e/bitcoin_address.go +++ b/cmd/zetae2e/bitcoin_address.go @@ -9,6 +9,7 @@ import ( "github.com/spf13/cobra" "github.com/zeta-chain/zetacore/app" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" + "github.com/zeta-chain/zetacore/cmd/zetae2e/local" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" "github.com/zeta-chain/zetacore/e2e/utils" @@ -69,8 +70,8 @@ func runBitcoinAddress(cmd *cobra.Command, args []string) error { conf, ethcommon.HexToAddress(evmAddr), conf.Accounts.EVMPrivKey, - utils.AdminName, // placeholder value, not used - AdminMnemonic, // placeholder value, not used + utils.FungibleAdminName, // placeholder value, not used + local.FungibleAdminMnemonic, // placeholder value, not used logger, ) if err != nil { diff --git a/cmd/zetae2e/local/accounts.go b/cmd/zetae2e/local/accounts.go index 075eb8e7d8..bcdd741e7f 100644 --- a/cmd/zetae2e/local/accounts.go +++ b/cmd/zetae2e/local/accounts.go @@ -34,5 +34,5 @@ var ( UserAdminAddress = ethcommon.HexToAddress("0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266") UserAdminPrivateKey = "ac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80" // #nosec G101 - used for testing - AdminMnemonic = "snow grace federal cupboard arrive fancy gym lady uniform rotate exercise either leave alien grass" // #nosec G101 - used for testing + FungibleAdminMnemonic = "snow grace federal cupboard arrive fancy gym lady uniform rotate exercise either leave alien grass" // #nosec G101 - used for testing ) diff --git a/cmd/zetae2e/local/local.go b/cmd/zetae2e/local/local.go index a85dad7f3b..1d6a664d71 100644 --- a/cmd/zetae2e/local/local.go +++ b/cmd/zetae2e/local/local.go @@ -165,8 +165,8 @@ func localE2ETest(cmd *cobra.Command, _ []string) { conf, DeployerAddress, DeployerPrivateKey, - utils.AdminName, - AdminMnemonic, + utils.FungibleAdminName, + FungibleAdminMnemonic, logger, ) if err != nil { diff --git a/cmd/zetae2e/local/utils.go b/cmd/zetae2e/local/utils.go index 9eb28ee1f2..f59782183c 100644 --- a/cmd/zetae2e/local/utils.go +++ b/cmd/zetae2e/local/utils.go @@ -62,8 +62,8 @@ func initTestRunner( conf, userAddress, userPrivKey, - utils.AdminName, - AdminMnemonic, + utils.FungibleAdminName, + FungibleAdminMnemonic, logger, ) if err != nil { diff --git a/cmd/zetae2e/run.go b/cmd/zetae2e/run.go index 5eea1c9e7e..da0494919f 100644 --- a/cmd/zetae2e/run.go +++ b/cmd/zetae2e/run.go @@ -11,6 +11,7 @@ import ( "github.com/spf13/cobra" "github.com/zeta-chain/zetacore/app" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" + "github.com/zeta-chain/zetacore/cmd/zetae2e/local" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/e2etests" "github.com/zeta-chain/zetacore/e2e/runner" @@ -20,8 +21,6 @@ import ( const flagVerbose = "verbose" const flagConfig = "config" -const AdminMnemonic = "snow grace federal cupboard arrive fancy gym lady uniform rotate exercise either leave alien grass" // #nosec G101 - used for testing - // NewRunCmd returns the run command // which runs the E2E from a config file describing the tests, networks, and accounts func NewRunCmd() *cobra.Command { @@ -93,8 +92,8 @@ func runE2ETest(cmd *cobra.Command, args []string) error { conf, ethcommon.HexToAddress(evmAddr), conf.Accounts.EVMPrivKey, - utils.AdminName, // placeholder value, not used - AdminMnemonic, // placeholder value, not used + utils.FungibleAdminName, // placeholder value, not used + local.FungibleAdminMnemonic, // placeholder value, not used logger, ) if err != nil { diff --git a/cmd/zetae2e/setup_bitcoin.go b/cmd/zetae2e/setup_bitcoin.go index 5a66d61fad..15e9877164 100644 --- a/cmd/zetae2e/setup_bitcoin.go +++ b/cmd/zetae2e/setup_bitcoin.go @@ -9,6 +9,7 @@ import ( "github.com/spf13/cobra" "github.com/zeta-chain/zetacore/app" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" + "github.com/zeta-chain/zetacore/cmd/zetae2e/local" "github.com/zeta-chain/zetacore/e2e/config" "github.com/zeta-chain/zetacore/e2e/runner" "github.com/zeta-chain/zetacore/e2e/utils" @@ -56,8 +57,8 @@ func runSetupBitcoin(_ *cobra.Command, args []string) error { conf, ethcommon.HexToAddress(evmAddr), conf.Accounts.EVMPrivKey, - utils.AdminName, // placeholder value, not used - AdminMnemonic, // placeholder value, not used + utils.FungibleAdminName, // placeholder value, not used + local.FungibleAdminMnemonic, // placeholder value, not used logger, ) if err != nil { diff --git a/cmd/zetae2e/show_tss.go b/cmd/zetae2e/show_tss.go index 33f3ba500e..1d610eb150 100644 --- a/cmd/zetae2e/show_tss.go +++ b/cmd/zetae2e/show_tss.go @@ -4,15 +4,15 @@ import ( "context" "errors" - "github.com/zeta-chain/zetacore/e2e/config" - "github.com/zeta-chain/zetacore/e2e/runner" - "github.com/zeta-chain/zetacore/e2e/utils" - ethcommon "github.com/ethereum/go-ethereum/common" "github.com/fatih/color" "github.com/spf13/cobra" "github.com/zeta-chain/zetacore/app" zetae2econfig "github.com/zeta-chain/zetacore/cmd/zetae2e/config" + "github.com/zeta-chain/zetacore/cmd/zetae2e/local" + "github.com/zeta-chain/zetacore/e2e/config" + "github.com/zeta-chain/zetacore/e2e/runner" + "github.com/zeta-chain/zetacore/e2e/utils" ) // NewShowTSSCmd returns the show TSS command @@ -58,8 +58,8 @@ func runShowTSS(_ *cobra.Command, args []string) error { conf, ethcommon.HexToAddress(evmAddr), conf.Accounts.EVMPrivKey, - utils.AdminName, // placeholder value, not used - AdminMnemonic, // placeholder value, not used + utils.FungibleAdminName, // placeholder value, not used + local.FungibleAdminMnemonic, // placeholder value, not used logger, ) if err != nil { diff --git a/cmd/zetae2e/stress.go b/cmd/zetae2e/stress.go index f7eb89413c..5228905074 100644 --- a/cmd/zetae2e/stress.go +++ b/cmd/zetae2e/stress.go @@ -4,7 +4,6 @@ import ( "context" "errors" "fmt" - "math/big" "os" "sort" @@ -142,8 +141,8 @@ func StressTest(cmd *cobra.Command, _ []string) { conf, local.DeployerAddress, local.DeployerPrivateKey, - utils.AdminName, - AdminMnemonic, + utils.FungibleAdminName, + local.FungibleAdminMnemonic, logger, ) if err != nil { diff --git a/e2e/e2etests/test_erc20_refund.go b/e2e/e2etests/test_erc20_refund.go index 209760a87c..4d378f91b5 100644 --- a/e2e/e2etests/test_erc20_refund.go +++ b/e2e/e2etests/test_erc20_refund.go @@ -46,7 +46,7 @@ func TestERC20DepositAndCallRefund(r *runner.E2ERunner, _ []string) { r.ZetaTxServer.GetAccountAddress(0), cctx.Index, r.DeployerAddress.String()) - _, err = r.ZetaTxServer.BroadcastTx(utils.AdminName, msg) + _, err = r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } diff --git a/e2e/e2etests/test_eth_deposit.go b/e2e/e2etests/test_eth_deposit.go index 00caf0b8d9..bfcc33e1a8 100644 --- a/e2e/e2etests/test_eth_deposit.go +++ b/e2e/e2etests/test_eth_deposit.go @@ -274,7 +274,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { r.ETHZRC20Addr.Hex(), liquidityCap, ) - res, err := r.ZetaTxServer.BroadcastTx(utils.AdminName, msg) + res, err := r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } @@ -326,7 +326,7 @@ func TestDepositEtherLiquidityCap(r *runner.E2ERunner, args []string) { r.ETHZRC20Addr.Hex(), math.ZeroUint(), ) - res, err = r.ZetaTxServer.BroadcastTx(utils.AdminName, msg) + res, err = r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } diff --git a/e2e/e2etests/test_migrate_chain_support.go b/e2e/e2etests/test_migrate_chain_support.go index 393826b9b3..75bdb29d0e 100644 --- a/e2e/e2etests/test_migrate_chain_support.go +++ b/e2e/e2etests/test_migrate_chain_support.go @@ -57,11 +57,11 @@ func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) { // update the chain params to set up the chain chainParams := getNewEVMChainParams(newRunner) - adminAddr, err := newRunner.ZetaTxServer.GetAccountAddressFromName(utils.AdminName) + adminAddr, err := newRunner.ZetaTxServer.GetAccountAddressFromName(utils.FungibleAdminName) if err != nil { panic(err) } - _, err = newRunner.ZetaTxServer.BroadcastTx(utils.AdminName, observertypes.NewMsgUpdateChainParams( + _, err = newRunner.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, observertypes.NewMsgUpdateChainParams( adminAddr, chainParams, )) @@ -73,7 +73,7 @@ func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) { if err != nil { panic(err) } - _, err = newRunner.ZetaTxServer.BroadcastTx(utils.AdminName, fungibletypes.NewMsgDeployFungibleCoinZRC20( + _, err = newRunner.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, fungibletypes.NewMsgDeployFungibleCoinZRC20( adminAddr, "", chainParams.ChainId, @@ -103,7 +103,7 @@ func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) { newRunner.ETHZRC20 = ethZRC20 // set the chain nonces for the new chain - _, err = r.ZetaTxServer.BroadcastTx(utils.AdminName, observertypes.NewMsgResetChainNonces( + _, err = r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, observertypes.NewMsgResetChainNonces( adminAddr, chainParams.ChainId, 0, @@ -116,7 +116,7 @@ func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) { // deactivate the previous chain chainParams = observertypes.GetDefaultGoerliLocalnetChainParams() chainParams.IsSupported = false - _, err = newRunner.ZetaTxServer.BroadcastTx(utils.AdminName, observertypes.NewMsgUpdateChainParams( + _, err = newRunner.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, observertypes.NewMsgUpdateChainParams( adminAddr, chainParams, )) @@ -167,7 +167,7 @@ func TestMigrateChainSupport(r *runner.E2ERunner, _ []string) { // whitelist erc20 zrc20 newRunner.Logger.Info("whitelisting ERC20 on new network") - res, err := newRunner.ZetaTxServer.BroadcastTx(utils.AdminName, crosschaintypes.NewMsgWhitelistERC20( + res, err := newRunner.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, crosschaintypes.NewMsgWhitelistERC20( adminAddr, newRunner.ERC20Addr.Hex(), chains.SepoliaChain().ChainId, @@ -221,7 +221,7 @@ func configureEVM2(r *runner.E2ERunner) (*runner.E2ERunner, error) { r.CtxCancel, r.DeployerAddress, r.DeployerPrivateKey, - r.AdminMnemonic, + r.FungibleAdminMnemonic, r.EVMClient, r.ZEVMClient, r.CctxClient, diff --git a/e2e/e2etests/test_pause_zrc20.go b/e2e/e2etests/test_pause_zrc20.go index 1986e79da6..0635fc6623 100644 --- a/e2e/e2etests/test_pause_zrc20.go +++ b/e2e/e2etests/test_pause_zrc20.go @@ -44,7 +44,7 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) { []string{r.ETHZRC20Addr.Hex()}, fungibletypes.UpdatePausedStatusAction_PAUSE, ) - res, err := r.ZetaTxServer.BroadcastTx(utils.AdminName, msg) + res, err := r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } @@ -134,7 +134,7 @@ func TestPauseZRC20(r *runner.E2ERunner, _ []string) { []string{r.ETHZRC20Addr.Hex()}, fungibletypes.UpdatePausedStatusAction_UNPAUSE, ) - res, err = r.ZetaTxServer.BroadcastTx(utils.AdminName, msg) + res, err = r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } diff --git a/e2e/e2etests/test_update_bytecode_zrc20.go b/e2e/e2etests/test_update_bytecode_zrc20.go index 318d29eac3..d5730415bf 100644 --- a/e2e/e2etests/test_update_bytecode_zrc20.go +++ b/e2e/e2etests/test_update_bytecode_zrc20.go @@ -85,7 +85,7 @@ func TestUpdateBytecodeZRC20(r *runner.E2ERunner, _ []string) { r.ETHZRC20Addr.Hex(), codeHashRes.CodeHash, ) - res, err := r.ZetaTxServer.BroadcastTx(utils.AdminName, msg) + res, err := r.ZetaTxServer.BroadcastTx(utils.FungibleAdminName, msg) if err != nil { panic(err) } diff --git a/e2e/runner/runner.go b/e2e/runner/runner.go index ccc7417fe8..d45b542c97 100644 --- a/e2e/runner/runner.go +++ b/e2e/runner/runner.go @@ -37,12 +37,12 @@ import ( // It also provides some helper functions type E2ERunner struct { // accounts - DeployerAddress ethcommon.Address - DeployerPrivateKey string - TSSAddress ethcommon.Address - BTCTSSAddress btcutil.Address - BTCDeployerAddress *btcutil.AddressWitnessPubKeyHash - AdminMnemonic string + DeployerAddress ethcommon.Address + DeployerPrivateKey string + TSSAddress ethcommon.Address + BTCTSSAddress btcutil.Address + BTCDeployerAddress *btcutil.AddressWitnessPubKeyHash + FungibleAdminMnemonic string // rpc clients ZEVMClient *ethclient.Client @@ -117,7 +117,7 @@ func NewE2ERunner( ctxCancel context.CancelFunc, deployerAddress ethcommon.Address, deployerPrivateKey string, - adminMnemonic string, + fungibleAdminMnemonic string, evmClient *ethclient.Client, zevmClient *ethclient.Client, cctxClient crosschaintypes.QueryClient, @@ -137,9 +137,9 @@ func NewE2ERunner( Ctx: ctx, CtxCancel: ctxCancel, - DeployerAddress: deployerAddress, - DeployerPrivateKey: deployerPrivateKey, - AdminMnemonic: adminMnemonic, + DeployerAddress: deployerAddress, + DeployerPrivateKey: deployerPrivateKey, + FungibleAdminMnemonic: fungibleAdminMnemonic, ZEVMClient: zevmClient, EVMClient: evmClient, diff --git a/e2e/runner/setup_zeta.go b/e2e/runner/setup_zeta.go index bbde558a3e..0de4693210 100644 --- a/e2e/runner/setup_zeta.go +++ b/e2e/runner/setup_zeta.go @@ -74,7 +74,7 @@ func (runner *E2ERunner) SetZEVMContracts() { // deploy system contracts and ZRC20 contracts on ZetaChain uniswapV2FactoryAddr, uniswapV2RouterAddr, zevmConnectorAddr, wzetaAddr, erc20zrc20Addr, err := runner.ZetaTxServer.DeploySystemContractsAndZRC20( - e2eutils.AdminName, + e2eutils.FungibleAdminName, runner.ERC20Addr.Hex(), ) if err != nil { @@ -208,12 +208,12 @@ func (runner *E2ERunner) SetupBTCZRC20() { func (runner *E2ERunner) EnableVerificationFlags() error { runner.Logger.Print("⚙️ enabling verification flags for block headers") - return runner.ZetaTxServer.EnableVerificationFlags(e2eutils.AdminName) + return runner.ZetaTxServer.EnableVerificationFlags(e2eutils.FungibleAdminName) } // FundEmissionsPool funds the emissions pool on ZetaChain with the same value as used originally on mainnet (20M ZETA) func (runner *E2ERunner) FundEmissionsPool() error { runner.Logger.Print("⚙️ funding the emissions pool on ZetaChain with 20M ZETA (%s)", txserver.EmissionsPoolAddress) - return runner.ZetaTxServer.FundEmissionsPool(e2eutils.AdminName, EmissionsPoolFunding) + return runner.ZetaTxServer.FundEmissionsPool(e2eutils.FungibleAdminName, EmissionsPoolFunding) } diff --git a/e2e/utils/zetacore.go b/e2e/utils/zetacore.go index caaea9b6fa..4aeac71ba3 100644 --- a/e2e/utils/zetacore.go +++ b/e2e/utils/zetacore.go @@ -11,7 +11,7 @@ import ( ) const ( - AdminName = "fadmin" + FungibleAdminName = "fungibleadmin" DefaultCctxTimeout = 4 * time.Minute )