diff --git a/cmd/zetae2e/config/config.go b/cmd/zetae2e/config/config.go index b83e1c9f7a..1fa0234cd1 100644 --- a/cmd/zetae2e/config/config.go +++ b/cmd/zetae2e/config/config.go @@ -39,7 +39,7 @@ func RunnerFromConfig( zetaTxServer, err := txserver.NewZetaTxServer( conf.RPCs.ZetaCoreRPC, []string{zetaUserName}, - []string{account.RawPrivateKey.String()}, + []string{conf.AdditionalAccounts.UserAdmin.RawPrivateKey.String()}, conf.ZetaChainID, ) if err != nil { diff --git a/cmd/zetae2e/config/config_test.go b/cmd/zetae2e/config/config_test.go index a27ee36ca6..6b0cf9cdf6 100644 --- a/cmd/zetae2e/config/config_test.go +++ b/cmd/zetae2e/config/config_test.go @@ -3,9 +3,6 @@ package config import ( "testing" - "github.com/cosmos/cosmos-sdk/crypto/hd" - sdktypes "github.com/cosmos/cosmos-sdk/types" - "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" "github.com/zeta-chain/zetacore/e2e/config" @@ -38,14 +35,6 @@ func TestReadConfig(t *testing.T) { require.NoError(t, err) require.NotEmpty(t, conf.Accounts.Deployer.RawEVMAddress) require.NotEmpty(t, conf.Accounts.Deployer.RawPrivateKey) - - // this test is passing, but a different key is derived by the txserver at runtime - if conf.FungibleAdminMnemonic != "" { - derivedPriv, err := hd.Secp256k1.Derive()(conf.FungibleAdminMnemonic, "", sdktypes.FullFundraiserPath) - require.NoError(t, err) - privKey := hd.Secp256k1.Generate()(derivedPriv) - require.Equal(t, common.Bytes2Hex(privKey.Bytes()), conf.AdditionalAccounts.UserAdmin.RawPrivateKey.String()) - } }) } } diff --git a/e2e/config/config.go b/e2e/config/config.go index 6809525b71..32ba6865e7 100644 --- a/e2e/config/config.go +++ b/e2e/config/config.go @@ -39,12 +39,11 @@ func (s DoubleQuotedString) AsEVMAddress() (ethcommon.Address, error) { // Config contains the configuration for the e2e test type Config struct { - Accounts Accounts `yaml:"accounts"` - AdditionalAccounts AdditionalAccounts `yaml:"additional_accounts"` - RPCs RPCs `yaml:"rpcs"` - Contracts Contracts `yaml:"contracts"` - ZetaChainID string `yaml:"zeta_chain_id"` - FungibleAdminMnemonic string `yaml:"fungible_admin_mnemonic"` + Accounts Accounts `yaml:"accounts"` + AdditionalAccounts AdditionalAccounts `yaml:"additional_accounts"` + RPCs RPCs `yaml:"rpcs"` + Contracts Contracts `yaml:"contracts"` + ZetaChainID string `yaml:"zeta_chain_id"` } // Account contains configuration for an account diff --git a/e2e/txserver/zeta_tx_server.go b/e2e/txserver/zeta_tx_server.go index b412f13102..298aa9ccef 100644 --- a/e2e/txserver/zeta_tx_server.go +++ b/e2e/txserver/zeta_tx_server.go @@ -33,9 +33,11 @@ import ( stakingtypes "github.com/cosmos/cosmos-sdk/x/staking/types" upgradetypes "github.com/cosmos/cosmos-sdk/x/upgrade/types" ethcommon "github.com/ethereum/go-ethereum/common" + "github.com/evmos/ethermint/crypto/hd" etherminttypes "github.com/evmos/ethermint/types" evmtypes "github.com/evmos/ethermint/x/evm/types" + "github.com/zeta-chain/zetacore/app" "github.com/zeta-chain/zetacore/cmd/zetacored/config" "github.com/zeta-chain/zetacore/pkg/chains" "github.com/zeta-chain/zetacore/pkg/coin" @@ -85,20 +87,23 @@ func NewZetaTxServer(rpcAddr string, names []string, privateKeys []string, chain cdc, reg := newCodec() // initialize keyring - kr := keyring.NewInMemory(cdc) + kr := keyring.NewInMemory(cdc, hd.EthSecp256k1Option()) addresses := make([]string, 0, len(names)) // create accounts for i := range names { - err = kr.ImportPrivKeyHex(names[i], privateKeys[i], "secp256k1") + err = kr.ImportPrivKeyHex(names[i], privateKeys[i], string(hd.EthSecp256k1Type)) if err != nil { - return ZetaTxServer{}, fmt.Errorf("failed to create account: %s", err.Error()) + return ZetaTxServer{}, fmt.Errorf("failed to create account: %w", err) } r, err := kr.Key(names[i]) + if err != nil { + return ZetaTxServer{}, fmt.Errorf("failed to get account key: %w", err) + } accAddr, err := r.GetAddress() if err != nil { - return ZetaTxServer{}, fmt.Errorf("failed to get account address: %s", err.Error()) + return ZetaTxServer{}, fmt.Errorf("failed to get account address: %w", err) } addresses = append(addresses, accAddr.String()) @@ -245,11 +250,11 @@ func (zts ZetaTxServer) EnableHeaderVerification(account string, chainIDList []i // retrieve account acc, err := zts.clientCtx.Keyring.Key(account) if err != nil { - return err + return fmt.Errorf("keyring: %w", err) } addr, err := acc.GetAddress() if err != nil { - return err + return fmt.Errorf("get address: %w", err) } _, err = zts.BroadcastTx(account, lightclienttypes.NewMsgEnableHeaderVerification( @@ -414,7 +419,8 @@ func (zts ZetaTxServer) FundEmissionsPool(account string, amount *big.Int) error // newCodec returns the codec for msg server func newCodec() (*codec.ProtoCodec, codectypes.InterfaceRegistry) { - interfaceRegistry := codectypes.NewInterfaceRegistry() + encodingConfig := app.MakeEncodingConfig() + interfaceRegistry := encodingConfig.InterfaceRegistry cdc := codec.NewProtoCodec(interfaceRegistry) sdktypes.RegisterInterfaces(interfaceRegistry)