diff --git a/e2e/interchaintestv8/e2esuite/suite.go b/e2e/interchaintestv8/e2esuite/suite.go index f4052a5..ad2d0af 100644 --- a/e2e/interchaintestv8/e2esuite/suite.go +++ b/e2e/interchaintestv8/e2esuite/suite.go @@ -126,3 +126,11 @@ func (s *TestSuite) SetupSuite(ctx context.Context) { s.proposalIDs[chain.Config().ChainID] = 1 } } + +// TODO: Remove when we have removed manual relaying and moved to +// common relaying methods that can choose the correct methods +func (s *TestSuite) SkipIfEthTestnetType(testnetType string) { + if os.Getenv(testvalues.EnvKeyEthTestnetType) == testnetType { + s.T().Skipf("Skipping test because Ethereum testnet type is %s", testnetType) + } +} diff --git a/e2e/interchaintestv8/relayer/config.go b/e2e/interchaintestv8/relayer/config.go index 698b786..2b626c2 100644 --- a/e2e/interchaintestv8/relayer/config.go +++ b/e2e/interchaintestv8/relayer/config.go @@ -1,11 +1,16 @@ package relayer import ( + "fmt" "os" "text/template" ) type EthCosmosConfigInfo struct { + // gRPC port for the Eth to Cosmos relayer module + EthToCosmosPort uint64 + // gRPC port for the Cosmos to Eth relayer module + CosmosToEthPort uint64 // Tendermint RPC URL TmRPC string // ICS26 Router address @@ -37,12 +42,12 @@ func (c *EthCosmosConfigInfo) GenerateEthCosmosConfigFile(path string) error { // EthToCosmosGRPCAddress returns the address for the eth to cosmos relayer gRPC server. func (c *EthCosmosConfigInfo) EthToCosmosGRPCAddress() string { - return "127.0.0.1:3001" + return fmt.Sprintf("127.0.0.1:%d", c.EthToCosmosPort) } // CosmosToEthGRPCAddress returns the address for the eth to cosmos relayer gRPC server. func (c *EthCosmosConfigInfo) CosmosToEthGRPCAddress() string { - return "127.0.0.1:3000" + return fmt.Sprintf("127.0.0.1:%d", c.CosmosToEthPort) } // CosmosToCosmosConfigInfo is a struct that holds the configuration information for the Cosmos to Cosmos config template diff --git a/e2e/interchaintestv8/relayer/config.tmpl b/e2e/interchaintestv8/relayer/config.tmpl index 3507559..6431974 100644 --- a/e2e/interchaintestv8/relayer/config.tmpl +++ b/e2e/interchaintestv8/relayer/config.tmpl @@ -5,24 +5,24 @@ }, "modules": [ { - "name": "cosmos_to_eth", - "port": 3000, + "name": "eth_to_cosmos", + "port": {{ .EthToCosmosPort }}, "config": { "tm_rpc_url": "{{ .TmRPC }}", "ics26_address": "{{ .ICS26Address }}", "eth_rpc_url": "{{ .EthRPC }}", - "sp1_private_key": "{{ .SP1PrivateKey }}" + "eth_beacon_api_url": "{{ .BeaconAPI }}", + "signer_address": "{{ .SignerAddress }}" } }, { - "name": "eth_to_cosmos", - "port": 3001, + "name": "cosmos_to_eth", + "port": {{ .CosmosToEthPort }}, "config": { "tm_rpc_url": "{{ .TmRPC }}", "ics26_address": "{{ .ICS26Address }}", "eth_rpc_url": "{{ .EthRPC }}", - "eth_beacon_api_url": "{{ .BeaconAPI }}", - "signer_address": "{{ .SignerAddress }}" + "sp1_private_key": "{{ .SP1PrivateKey }}" } } ] diff --git a/e2e/interchaintestv8/relayer_test.go b/e2e/interchaintestv8/relayer_test.go index 52ee5bd..ee61c8a 100644 --- a/e2e/interchaintestv8/relayer_test.go +++ b/e2e/interchaintestv8/relayer_test.go @@ -75,12 +75,14 @@ func (s *RelayerTestSuite) SetupSuite(ctx context.Context, proofType operator.Su } configInfo = relayer.EthCosmosConfigInfo{ - TmRPC: simd.GetHostRPCAddress(), - ICS26Address: s.contractAddresses.Ics26Router, - EthRPC: eth.RPC, - BeaconAPI: beaconAPI, - SP1PrivateKey: os.Getenv(testvalues.EnvKeySp1PrivateKey), - SignerAddress: s.SimdSubmitter.FormattedAddress(), + EthToCosmosPort: 3000, + CosmosToEthPort: 3001, + TmRPC: simd.GetHostRPCAddress(), + ICS26Address: s.contractAddresses.Ics26Router, + EthRPC: eth.RPC, + BeaconAPI: beaconAPI, + SP1PrivateKey: os.Getenv(testvalues.EnvKeySp1PrivateKey), + SignerAddress: s.SimdSubmitter.FormattedAddress(), } err := configInfo.GenerateEthCosmosConfigFile(testvalues.RelayerConfigFilePath) @@ -120,26 +122,26 @@ func (s *RelayerTestSuite) TestRelayerInfo() { eth, simd := s.EthChain, s.CosmosChains[0] - s.Run("Eth to Cosmos Relayer Info", func() { - info, err := s.EthToCosmosRelayerClient.Info(context.Background(), &relayertypes.InfoRequest{}) + s.Run("Cosmos to Eth Relayer Info", func() { + info, err := s.CosmosToEthRelayerClient.Info(context.Background(), &relayertypes.InfoRequest{}) s.Require().NoError(err) s.Require().NotNil(info) s.T().Logf("Relayer Info: %+v", info) - s.Require().Equal(eth.ChainID.String(), info.SourceChain.ChainId) - s.Require().Equal(simd.Config().ChainID, info.TargetChain.ChainId) + s.Require().Equal(simd.Config().ChainID, info.SourceChain.ChainId) + s.Require().Equal(eth.ChainID.String(), info.TargetChain.ChainId) }) - s.Run("Cosmos to Eth Relayer Info", func() { - info, err := s.CosmosToEthRelayerClient.Info(context.Background(), &relayertypes.InfoRequest{}) + s.Run("Eth to Cosmos Relayer Info", func() { + info, err := s.EthToCosmosRelayerClient.Info(context.Background(), &relayertypes.InfoRequest{}) s.Require().NoError(err) s.Require().NotNil(info) s.T().Logf("Relayer Info: %+v", info) - s.Require().Equal(simd.Config().ChainID, info.SourceChain.ChainId) - s.Require().Equal(eth.ChainID.String(), info.TargetChain.ChainId) + s.Require().Equal(eth.ChainID.String(), info.SourceChain.ChainId) + s.Require().Equal(simd.Config().ChainID, info.TargetChain.ChainId) }) } @@ -242,7 +244,7 @@ func (s *RelayerTestSuite) RecvPacketToEthTest( var multicallTx []byte s.Require().True(s.Run("Retrieve relay tx to Ethereum", func() { - resp, err := s.EthToCosmosRelayerClient.RelayByTx(context.Background(), &relayertypes.RelayByTxRequest{ + resp, err := s.CosmosToEthRelayerClient.RelayByTx(context.Background(), &relayertypes.RelayByTxRequest{ SourceTxIds: txHashes, TargetChannelId: s.TendermintLightClientID, }) @@ -329,6 +331,7 @@ func (s *RelayerTestSuite) Test_5_BatchedAckPacketToEth_Plonk() { func (s *RelayerTestSuite) ICS20TransferERC20TokenBatchedAckTest( ctx context.Context, proofType operator.SupportedProofType, numOfTransfers int, ) { + s.SkipIfEthTestnetType(testvalues.EthTestnetTypePoS) s.SetupSuite(ctx, proofType) eth, simd := s.EthChain, s.CosmosChains[0] @@ -464,7 +467,7 @@ func (s *RelayerTestSuite) ICS20TransferERC20TokenBatchedAckTest( s.Require().True(s.Run("Acknowledge packets on Ethereum", func() { var multicallTx []byte s.Require().True(s.Run("Retrieve relay tx to Ethereum", func() { - resp, err := s.EthToCosmosRelayerClient.RelayByTx(context.Background(), &relayertypes.RelayByTxRequest{ + resp, err := s.CosmosToEthRelayerClient.RelayByTx(context.Background(), &relayertypes.RelayByTxRequest{ SourceTxIds: [][]byte{txHash}, TargetChannelId: s.TendermintLightClientID, }) @@ -612,7 +615,7 @@ func (s *RelayerTestSuite) ICS20TimeoutFromEthereumToTimeoutTest( s.True(s.Run("Timeout packet on Ethereum", func() { var multicallTx []byte s.Require().True(s.Run("Retrieve timeout tx to Ethereum", func() { - resp, err := s.EthToCosmosRelayerClient.RelayByTx(context.Background(), &relayertypes.RelayByTxRequest{ + resp, err := s.CosmosToEthRelayerClient.RelayByTx(context.Background(), &relayertypes.RelayByTxRequest{ TimeoutTxIds: txHashes, TargetChannelId: s.TendermintLightClientID, }) @@ -666,7 +669,7 @@ func (s *RelayerTestSuite) ICS20TimeoutFromEthereumToTimeoutTest( } func (s *RelayerTestSuite) TestRecvPacketToCosmos_Groth16() { - // TODO: Skip if not PoS? + s.SkipIfEthTestnetType(testvalues.EthTestnetTypePoW) ctx := context.Background() s.RecvPacketCosmosTest(ctx, operator.ProofTypeGroth16, 1) } @@ -758,7 +761,7 @@ func (s *RelayerTestSuite) RecvPacketCosmosTest(ctx context.Context, proofType o var txBodyBz []byte s.Require().True(s.Run("Retrieve relay tx to Cosmos chain", func() { - resp, err := s.EthToCosmosRelayerClient.RelayByTx(context.Background(), &relayertypes.RelayByTxRequest{ + resp, err := s.CosmosToEthRelayerClient.RelayByTx(context.Background(), &relayertypes.RelayByTxRequest{ SourceTxIds: txHashes, TargetChannelId: ibctesting.FirstChannelID, })