diff --git a/tests/allowed_addresses.go b/tests/allowed_addresses.go index dafa0c11..1d4d76d4 100644 --- a/tests/allowed_addresses.go +++ b/tests/allowed_addresses.go @@ -38,8 +38,8 @@ const numKeys = 4 // Then, checks that each relayer instance is able to properly catch up on missed messages that // match its particular configuration. func AllowedAddresses(network *network.LocalNetwork, teleporter utils.TeleporterTestInfo) { - subnetAInfo := network.GetPrimaryNetworkInfo() - subnetBInfo, _ := network.GetTwoSubnets() + l1AInfo := network.GetPrimaryNetworkInfo() + l1BInfo, _ := network.GetTwoL1s() fundedAddress, fundedKey := network.GetFundedAccountInfo() err := testUtils.ClearRelayerStorage() Expect(err).Should(BeNil()) @@ -52,7 +52,7 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter log.Info("Funding relayer address on all subnets") relayerKey, err := crypto.GenerateKey() Expect(err).Should(BeNil()) - testUtils.FundRelayers(ctx, []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, fundedKey, relayerKey) + testUtils.FundRelayers(ctx, []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedKey, relayerKey) // Create distinct key/address pairs to be used in the configuration, and fund them var allowedKeys []*ecdsa.PrivateKey @@ -63,7 +63,7 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter allowedKey, err := crypto.GenerateKey() Expect(err).Should(BeNil()) allowedAddress := crypto.PubkeyToAddress(allowedKey.PublicKey) - testUtils.FundRelayers(ctx, []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, fundedKey, allowedKey) + testUtils.FundRelayers(ctx, []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedKey, allowedKey) allowedKeys = append(allowedKeys, allowedKey) allowedAddresses = append(allowedAddresses, allowedAddress) allowedAddressesStr = append(allowedAddressesStr, allowedAddress.String()) @@ -85,8 +85,8 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter // Will send from allowed Address 0 -> 0 relayerConfig1 := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedAddress, relayerKey, ) @@ -95,8 +95,8 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter // Will send from allowed Address 1 -> 0 relayerConfig2 := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedAddress, relayerKey, ) @@ -110,18 +110,18 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter // Will send from allowed Address 2 -> 0 relayerConfig3 := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedAddress, relayerKey, ) supportedDestinations := []*config.SupportedDestination{ { - BlockchainID: subnetAInfo.BlockchainID.String(), + BlockchainID: l1AInfo.BlockchainID.String(), Addresses: []string{allowedAddresses[relayer3AllowedDstAddressIdx].String()}, }, { - BlockchainID: subnetBInfo.BlockchainID.String(), + BlockchainID: l1BInfo.BlockchainID.String(), Addresses: []string{allowedAddresses[relayer3AllowedDstAddressIdx].String()}, }, } @@ -136,8 +136,8 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter // Will send from allowed Address 3 -> 0 relayerConfig4 := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedAddress, relayerKey, ) @@ -146,11 +146,11 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter } supportedDestinations = []*config.SupportedDestination{ { - BlockchainID: subnetAInfo.BlockchainID.String(), + BlockchainID: l1AInfo.BlockchainID.String(), Addresses: []string{allowedAddresses[relayer4AllowedDstAddressIdx].String()}, }, { - BlockchainID: subnetBInfo.BlockchainID.String(), + BlockchainID: l1BInfo.BlockchainID.String(), Addresses: []string{allowedAddresses[relayer4AllowedDstAddressIdx].String()}, }, } @@ -189,12 +189,12 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter testUtils.RelayBasicMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, allowedKeys[generalAllowedAddressIdx], allowedAddresses[generalAllowedAddressIdx], ) - height1, err := subnetAInfo.RPCClient.BlockNumber(ctx) + height1, err := l1AInfo.RPCClient.BlockNumber(ctx) Expect(err).Should(BeNil()) // Sleep for some time to make sure the DB is updated time.Sleep(time.Duration(5*relayerConfig1.DBWriteIntervalSeconds) * time.Second) @@ -219,13 +219,13 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter _, _, id := testUtils.SendBasicTeleporterMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, allowedKeys[generalAllowedAddressIdx], // not allowed allowedAddresses[generalAllowedAddressIdx], ) Consistently(func() bool { - delivered, err := teleporter.TeleporterMessenger(subnetBInfo).MessageReceived( + delivered, err := teleporter.TeleporterMessenger(l1BInfo).MessageReceived( &bind.CallOpts{}, id, ) Expect(err).Should(BeNil()) @@ -236,12 +236,12 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter testUtils.RelayBasicMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, allowedKeys[relayer2AllowedSrcAddressIdx], allowedAddresses[generalAllowedAddressIdx], ) - height2, err := subnetAInfo.RPCClient.BlockNumber(ctx) + height2, err := l1AInfo.RPCClient.BlockNumber(ctx) Expect(err).Should(BeNil()) // Sleep for some time to make sure the DB is updated time.Sleep(time.Duration(5*relayerConfig2.DBWriteIntervalSeconds) * time.Second) @@ -266,13 +266,13 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter _, _, id = testUtils.SendBasicTeleporterMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, allowedKeys[generalAllowedAddressIdx], allowedAddresses[generalAllowedAddressIdx], // not allowed ) Consistently(func() bool { - delivered, err := teleporter.TeleporterMessenger(subnetBInfo).MessageReceived( + delivered, err := teleporter.TeleporterMessenger(l1BInfo).MessageReceived( &bind.CallOpts{}, id, ) Expect(err).Should(BeNil()) @@ -283,12 +283,12 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter testUtils.RelayBasicMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, allowedKeys[generalAllowedAddressIdx], allowedAddresses[relayer3AllowedDstAddressIdx], ) - height3, err := subnetAInfo.RPCClient.BlockNumber(ctx) + height3, err := l1AInfo.RPCClient.BlockNumber(ctx) Expect(err).Should(BeNil()) // Sleep for some time to make sure the DB is updated time.Sleep(time.Duration(5*relayerConfig3.DBWriteIntervalSeconds) * time.Second) @@ -312,13 +312,13 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter _, _, id = testUtils.SendBasicTeleporterMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, allowedKeys[generalAllowedAddressIdx], // not allowed allowedAddresses[generalAllowedAddressIdx], ) Consistently(func() bool { - delivered, err := teleporter.TeleporterMessenger(subnetBInfo).MessageReceived( + delivered, err := teleporter.TeleporterMessenger(l1BInfo).MessageReceived( &bind.CallOpts{}, id, ) Expect(err).Should(BeNil()) @@ -329,12 +329,12 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter testUtils.RelayBasicMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, allowedKeys[relayer4AllowedSrcAddressIdx], allowedAddresses[relayer4AllowedDstAddressIdx], ) - height4, err := subnetAInfo.RPCClient.BlockNumber(ctx) + height4, err := l1AInfo.RPCClient.BlockNumber(ctx) Expect(err).Should(BeNil()) // Sleep for some time to make sure the DB is updated time.Sleep(time.Duration(5*relayerConfig4.DBWriteIntervalSeconds) * time.Second) @@ -346,26 +346,26 @@ func AllowedAddresses(network *network.LocalNetwork, teleporter utils.Teleporter // Create relayer keys that allow all source and destination addresses relayerID1 := database.NewRelayerID( - subnetAInfo.BlockchainID, - subnetBInfo.BlockchainID, + l1AInfo.BlockchainID, + l1BInfo.BlockchainID, database.AllAllowedAddress, database.AllAllowedAddress, ) relayerID2 := database.NewRelayerID( - subnetAInfo.BlockchainID, - subnetBInfo.BlockchainID, + l1AInfo.BlockchainID, + l1BInfo.BlockchainID, allowedAddresses[relayer2AllowedSrcAddressIdx], database.AllAllowedAddress, ) relayerID3 := database.NewRelayerID( - subnetAInfo.BlockchainID, - subnetBInfo.BlockchainID, + l1AInfo.BlockchainID, + l1BInfo.BlockchainID, database.AllAllowedAddress, allowedAddresses[relayer3AllowedDstAddressIdx], ) relayerID4 := database.NewRelayerID( - subnetAInfo.BlockchainID, - subnetBInfo.BlockchainID, + l1AInfo.BlockchainID, + l1BInfo.BlockchainID, allowedAddresses[relayer4AllowedSrcAddressIdx], allowedAddresses[relayer4AllowedDstAddressIdx], ) diff --git a/tests/basic_relay.go b/tests/basic_relay.go index 4e82a53e..7ad55a96 100644 --- a/tests/basic_relay.go +++ b/tests/basic_relay.go @@ -26,8 +26,8 @@ import ( // - Relaying an already delivered message // - Setting ProcessHistoricalBlocksFromHeight in config func BasicRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestInfo) { - subnetAInfo := network.GetPrimaryNetworkInfo() - subnetBInfo, _ := network.GetTwoSubnets() + l1AInfo := network.GetPrimaryNetworkInfo() + l1BInfo, _ := network.GetTwoL1s() fundedAddress, fundedKey := network.GetFundedAccountInfo() err := testUtils.ClearRelayerStorage() Expect(err).Should(BeNil()) @@ -40,15 +40,15 @@ func BasicRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn log.Info("Funding relayer address on all subnets") relayerKey, err := crypto.GenerateKey() Expect(err).Should(BeNil()) - testUtils.FundRelayers(ctx, []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, fundedKey, relayerKey) + testUtils.FundRelayers(ctx, []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedKey, relayerKey) // // Set up relayer config // relayerConfig := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedAddress, relayerKey, ) @@ -80,8 +80,8 @@ func BasicRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn testUtils.RelayBasicMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, fundedKey, fundedAddress, ) @@ -93,8 +93,8 @@ func BasicRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn testUtils.RelayBasicMessage( ctx, teleporter, - subnetBInfo, - subnetAInfo, + l1BInfo, + l1AInfo, fundedKey, fundedAddress, ) @@ -124,14 +124,14 @@ func BasicRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn // Create relayer keys that allow all source and destination addresses relayerIDA := database.CalculateRelayerID( - subnetAInfo.BlockchainID, - subnetBInfo.BlockchainID, + l1AInfo.BlockchainID, + l1BInfo.BlockchainID, database.AllAllowedAddress, database.AllAllowedAddress, ) relayerIDB := database.CalculateRelayerID( - subnetBInfo.BlockchainID, - subnetAInfo.BlockchainID, + l1BInfo.BlockchainID, + l1AInfo.BlockchainID, database.AllAllowedAddress, database.AllAllowedAddress, ) @@ -143,7 +143,7 @@ func BasicRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn // Subscribe to the destination chain newHeadsB := make(chan *types.Header, 10) - sub, err := subnetBInfo.WSClient.SubscribeNewHead(ctx, newHeadsB) + sub, err := l1BInfo.WSClient.SubscribeNewHead(ctx, newHeadsB) Expect(err).Should(BeNil()) defer sub.Unsubscribe() @@ -174,8 +174,8 @@ func BasicRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn testUtils.TriggerProcessMissedBlocks( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, relayerCleanup, relayerConfig, fundedAddress, diff --git a/tests/batch_relay.go b/tests/batch_relay.go index 0157a0c9..cfb5ac89 100644 --- a/tests/batch_relay.go +++ b/tests/batch_relay.go @@ -22,7 +22,7 @@ import ( // Processes multiple Warp messages contained in the same block func BatchRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestInfo) { - subnetAInfo, subnetBInfo := network.GetTwoSubnets() + l1AInfo, l1BInfo := network.GetTwoL1s() fundedAddress, fundedKey := network.GetFundedAccountInfo() err := testUtils.ClearRelayerStorage() Expect(err).Should(BeNil()) @@ -36,14 +36,14 @@ func BatchRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn fundedKey, teleporter, fundedAddress, - subnetAInfo, + l1AInfo, ) batchMessengerAddressB, batchMessengerB := testUtils.DeployBatchCrossChainMessenger( ctx, fundedKey, teleporter, fundedAddress, - subnetBInfo, + l1BInfo, ) // @@ -53,15 +53,15 @@ func BatchRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn log.Info("Funding relayer address on all subnets") relayerKey, err := crypto.GenerateKey() Expect(err).Should(BeNil()) - testUtils.FundRelayers(ctx, []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, fundedKey, relayerKey) + testUtils.FundRelayers(ctx, []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedKey, relayerKey) // // Set up relayer config // relayerConfig := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedAddress, relayerKey, ) @@ -87,7 +87,7 @@ func BatchRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn // newHeadsDest := make(chan *types.Header, 10) - sub, err := subnetBInfo.WSClient.SubscribeNewHead(ctx, newHeadsDest) + sub, err := l1BInfo.WSClient.SubscribeNewHead(ctx, newHeadsDest) Expect(err).Should(BeNil()) defer sub.Unsubscribe() @@ -97,11 +97,11 @@ func BatchRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn sentMessages.Add(strconv.Itoa(i)) } - optsA, err := bind.NewKeyedTransactorWithChainID(fundedKey, subnetAInfo.EVMChainID) + optsA, err := bind.NewKeyedTransactorWithChainID(fundedKey, l1AInfo.EVMChainID) Expect(err).Should(BeNil()) tx, err := batchMessengerA.SendMessages( optsA, - subnetBInfo.BlockchainID, + l1BInfo.BlockchainID, batchMessengerAddressB, common.Address{}, big.NewInt(0), @@ -110,14 +110,14 @@ func BatchRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestIn ) Expect(err).Should(BeNil()) - utils.WaitForTransactionSuccess(ctx, subnetAInfo, tx.Hash()) + utils.WaitForTransactionSuccess(ctx, l1AInfo, tx.Hash()) // Wait for the message on the destination maxWait := 30 currWait := 0 log.Info("Waiting to receive all messages on destination...") for { - receivedMessages, err := batchMessengerB.GetCurrentMessages(&bind.CallOpts{}, subnetAInfo.BlockchainID) + receivedMessages, err := batchMessengerB.GetCurrentMessages(&bind.CallOpts{}, l1AInfo.BlockchainID) Expect(err).Should(BeNil()) // Remove the received messages from the set of sent messages diff --git a/tests/contracts/lib/teleporter b/tests/contracts/lib/teleporter index a6e92843..57796c8d 160000 --- a/tests/contracts/lib/teleporter +++ b/tests/contracts/lib/teleporter @@ -1 +1 @@ -Subproject commit a6e92843c3b13eef1e813fd898d9a44a2da6a2a0 +Subproject commit 57796c8d6c5fc7ac984b492b93233cf083ea8381 diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 0180e281..6d799dc6 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -88,7 +88,7 @@ var _ = ginkgo.BeforeSuite(func() { networkStartCtx, "icm-off-chain-services-e2e-test", warpGenesisTemplateFile, - []network.SubnetSpec{ + []network.L1Spec{ { Name: "A", EVMChainID: 12345, @@ -109,7 +109,7 @@ var _ = ginkgo.BeforeSuite(func() { 4, 0, ) - teleporterInfo = teleporterTestUtils.NewTeleporterTestInfo(localNetworkInstance.GetAllSubnetsInfo()) + teleporterInfo = teleporterTestUtils.NewTeleporterTestInfo(localNetworkInstance.GetAllL1Infos()) // Only need to deploy Teleporter on the C-Chain since it is included in the genesis of the subnet chains. _, fundedKey := localNetworkInstance.GetFundedAccountInfo() @@ -123,14 +123,14 @@ var _ = ginkgo.BeforeSuite(func() { ) // Deploy the Teleporter registry contracts to all subnets and the C-Chain. - for _, subnet := range localNetworkInstance.GetAllSubnetsInfo() { + for _, subnet := range localNetworkInstance.GetAllL1Infos() { teleporterInfo.SetTeleporter(teleporterContractAddress, subnet) teleporterInfo.InitializeBlockchainID(subnet, fundedKey) teleporterInfo.DeployTeleporterRegistry(subnet, fundedKey) } // Convert the subnets to sovereign L1s - for _, subnet := range localNetworkInstance.GetSubnetsInfo() { + for _, subnet := range localNetworkInstance.GetL1Infos() { localNetworkInstance.ConvertSubnet( networkStartCtx, subnet, diff --git a/tests/etna_upgrade.go b/tests/etna_upgrade.go index 9b88de26..b42cfce2 100644 --- a/tests/etna_upgrade.go +++ b/tests/etna_upgrade.go @@ -22,8 +22,8 @@ import ( // - Relaying from Subnet A to Subnet B // - Relaying from Subnet B to Subnet A func EtnaUpgrade(network *network.LocalNetwork, teleporter utils.TeleporterTestInfo) { - subnetAInfo := network.GetPrimaryNetworkInfo() - subnetBInfo, _ := network.GetTwoSubnets() + l1AInfo := network.GetPrimaryNetworkInfo() + l1BInfo, _ := network.GetTwoL1s() fundedAddress, fundedKey := network.GetFundedAccountInfo() err := testUtils.ClearRelayerStorage() Expect(err).Should(BeNil()) @@ -35,15 +35,15 @@ func EtnaUpgrade(network *network.LocalNetwork, teleporter utils.TeleporterTestI log.Info("Funding relayer address on all subnets") relayerKey, err := crypto.GenerateKey() Expect(err).Should(BeNil()) - testUtils.FundRelayers(ctx, []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, fundedKey, relayerKey) + testUtils.FundRelayers(ctx, []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedKey, relayerKey) // // Set up relayer config // relayerConfig := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedAddress, relayerKey, ) @@ -76,8 +76,8 @@ func EtnaUpgrade(network *network.LocalNetwork, teleporter utils.TeleporterTestI testUtils.RelayBasicMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, fundedKey, fundedAddress, ) @@ -86,8 +86,8 @@ func EtnaUpgrade(network *network.LocalNetwork, teleporter utils.TeleporterTestI testUtils.RelayBasicMessage( ctx, teleporter, - subnetBInfo, - subnetAInfo, + l1BInfo, + l1AInfo, fundedKey, fundedAddress, ) diff --git a/tests/manual_message.go b/tests/manual_message.go index 7cc08e22..3f41b233 100644 --- a/tests/manual_message.go +++ b/tests/manual_message.go @@ -31,7 +31,7 @@ import ( // - Verifies that the Teleporter Registry is updated func ManualMessage(network *network.LocalNetwork, teleporter utils.TeleporterTestInfo) { cChainInfo := network.GetPrimaryNetworkInfo() - subnetAInfo, subnetBInfo := network.GetTwoSubnets() + l1AInfo, l1BInfo := network.GetTwoL1s() fundedAddress, fundedKey := network.GetFundedAccountInfo() err := testUtils.ClearRelayerStorage() Expect(err).Should(BeNil()) @@ -51,7 +51,7 @@ func ManualMessage(network *network.LocalNetwork, teleporter utils.TeleporterTes log.Info("Funding relayer address on all subnets") relayerKey, err := crypto.GenerateKey() Expect(err).Should(BeNil()) - testUtils.FundRelayers(ctx, []interfaces.SubnetTestInfo{cChainInfo}, fundedKey, relayerKey) + testUtils.FundRelayers(ctx, []interfaces.L1TestInfo{cChainInfo}, fundedKey, relayerKey) // // Define the off-chain Warp message @@ -73,15 +73,15 @@ func ManualMessage(network *network.LocalNetwork, teleporter utils.TeleporterTes ) _, warpEnabledChainConfigA := teleporterTestUtils.InitOffChainMessageChainConfig( networkID, - subnetAInfo, - teleporter.TeleporterRegistryAddress(subnetAInfo), + l1AInfo, + teleporter.TeleporterRegistryAddress(l1AInfo), newProtocolAddress, 2, ) _, warpEnabledChainConfigB := teleporterTestUtils.InitOffChainMessageChainConfig( networkID, - subnetBInfo, - teleporter.TeleporterRegistryAddress(subnetBInfo), + l1BInfo, + teleporter.TeleporterRegistryAddress(l1BInfo), newProtocolAddress, 2, ) @@ -89,8 +89,8 @@ func ManualMessage(network *network.LocalNetwork, teleporter utils.TeleporterTes // Create chain config with off chain messages chainConfigs := make(teleporterTestUtils.ChainConfigMap) chainConfigs.Add(cChainInfo, warpEnabledChainConfigC) - chainConfigs.Add(subnetBInfo, warpEnabledChainConfigB) - chainConfigs.Add(subnetAInfo, warpEnabledChainConfigA) + chainConfigs.Add(l1BInfo, warpEnabledChainConfigB) + chainConfigs.Add(l1AInfo, warpEnabledChainConfigA) // Restart nodes with new chain config log.Info("Restarting nodes with new chain config") @@ -104,8 +104,8 @@ func ManualMessage(network *network.LocalNetwork, teleporter utils.TeleporterTes // relayerConfig := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{cChainInfo}, - []interfaces.SubnetTestInfo{cChainInfo}, + []interfaces.L1TestInfo{cChainInfo}, + []interfaces.L1TestInfo{cChainInfo}, fundedAddress, relayerKey, ) diff --git a/tests/relay_message_api.go b/tests/relay_message_api.go index 1e92259f..e71beafb 100644 --- a/tests/relay_message_api.go +++ b/tests/relay_message_api.go @@ -31,8 +31,8 @@ import ( func RelayMessageAPI(network *network.LocalNetwork, teleporter utils.TeleporterTestInfo) { ctx := context.Background() - subnetAInfo := network.GetPrimaryNetworkInfo() - subnetBInfo, _ := network.GetTwoSubnets() + l1AInfo := network.GetPrimaryNetworkInfo() + l1BInfo, _ := network.GetTwoL1s() fundedAddress, fundedKey := network.GetFundedAccountInfo() err := testUtils.ClearRelayerStorage() Expect(err).Should(BeNil()) @@ -40,24 +40,24 @@ func RelayMessageAPI(network *network.LocalNetwork, teleporter utils.TeleporterT log.Info("Funding relayer address on all subnets") relayerKey, err := crypto.GenerateKey() Expect(err).Should(BeNil()) - testUtils.FundRelayers(ctx, []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, fundedKey, relayerKey) + testUtils.FundRelayers(ctx, []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedKey, relayerKey) log.Info("Sending teleporter message") receipt, _, teleporterMessageID := testUtils.SendBasicTeleporterMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, fundedKey, fundedAddress, ) - warpMessage := getWarpMessageFromLog(ctx, receipt, subnetAInfo) + warpMessage := getWarpMessageFromLog(ctx, receipt, l1AInfo) // Set up relayer config relayerConfig := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedAddress, relayerKey, ) @@ -81,7 +81,7 @@ func RelayMessageAPI(network *network.LocalNetwork, teleporter utils.TeleporterT testUtils.WaitForChannelClose(startupCtx, readyChan) reqBody := api.RelayMessageRequest{ - BlockchainID: subnetAInfo.BlockchainID.String(), + BlockchainID: l1AInfo.BlockchainID.String(), MessageID: warpMessage.ID().String(), BlockNum: receipt.BlockNumber.Uint64(), } @@ -114,11 +114,11 @@ func RelayMessageAPI(network *network.LocalNetwork, teleporter utils.TeleporterT err = json.Unmarshal(body, &response) Expect(err).Should(BeNil()) - receipt, err := subnetBInfo.RPCClient.TransactionReceipt(ctx, common.HexToHash(response.TransactionHash)) + receipt, err := l1BInfo.RPCClient.TransactionReceipt(ctx, common.HexToHash(response.TransactionHash)) Expect(err).Should(BeNil()) receiveEvent, err := teleporterTestUtils.GetEventFromLogs( receipt.Logs, - teleporter.TeleporterMessenger(subnetBInfo).ParseReceiveCrossChainMessage, + teleporter.TeleporterMessenger(l1BInfo).ParseReceiveCrossChainMessage, ) Expect(err).Should(BeNil()) Expect(ids.ID(receiveEvent.MessageID)).Should(Equal(teleporterMessageID)) @@ -157,7 +157,7 @@ func RelayMessageAPI(network *network.LocalNetwork, teleporter utils.TeleporterT func getWarpMessageFromLog( ctx context.Context, receipt *types.Receipt, - source interfaces.SubnetTestInfo, + source interfaces.L1TestInfo, ) *avalancheWarp.UnsignedMessage { log.Info("Fetching relevant warp logs from the newly produced block") logs, err := source.RPCClient.FilterLogs(ctx, subnetEvmInterfaces.FilterQuery{ diff --git a/tests/shared_db.go b/tests/shared_db.go index 45a8cfba..7a8bd366 100644 --- a/tests/shared_db.go +++ b/tests/shared_db.go @@ -17,8 +17,8 @@ const relayerCfgFnameA = "relayer-config-a.json" const relayerCfgFnameB = "relayer-config-b.json" func SharedDatabaseAccess(network *network.LocalNetwork, teleporter utils.TeleporterTestInfo) { - subnetAInfo := network.GetPrimaryNetworkInfo() - subnetBInfo, _ := network.GetTwoSubnets() + l1AInfo := network.GetPrimaryNetworkInfo() + l1BInfo, _ := network.GetTwoL1s() fundedAddress, fundedKey := network.GetFundedAccountInfo() err := testUtils.ClearRelayerStorage() Expect(err).Should(BeNil()) @@ -34,8 +34,8 @@ func SharedDatabaseAccess(network *network.LocalNetwork, teleporter utils.Telepo relayerKeyB, err := crypto.GenerateKey() Expect(err).Should(BeNil()) - testUtils.FundRelayers(ctx, []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, fundedKey, relayerKeyA) - testUtils.FundRelayers(ctx, []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, fundedKey, relayerKeyB) + testUtils.FundRelayers(ctx, []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedKey, relayerKeyA) + testUtils.FundRelayers(ctx, []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedKey, relayerKeyB) // // Set up relayer config @@ -43,16 +43,16 @@ func SharedDatabaseAccess(network *network.LocalNetwork, teleporter utils.Telepo // Relayer A will relay messages from Subnet A to Subnet B relayerConfigA := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetAInfo}, - []interfaces.SubnetTestInfo{subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo}, + []interfaces.L1TestInfo{l1BInfo}, fundedAddress, relayerKeyA, ) // Relayer B will relay messages from Subnet B to Subnet A relayerConfigB := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetBInfo}, - []interfaces.SubnetTestInfo{subnetAInfo}, + []interfaces.L1TestInfo{l1BInfo}, + []interfaces.L1TestInfo{l1AInfo}, fundedAddress, relayerKeyB, ) @@ -97,8 +97,8 @@ func SharedDatabaseAccess(network *network.LocalNetwork, teleporter utils.Telepo testUtils.RelayBasicMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, fundedKey, fundedAddress, ) @@ -110,8 +110,8 @@ func SharedDatabaseAccess(network *network.LocalNetwork, teleporter utils.Telepo testUtils.RelayBasicMessage( ctx, teleporter, - subnetBInfo, - subnetAInfo, + l1BInfo, + l1AInfo, fundedKey, fundedAddress, ) @@ -123,8 +123,8 @@ func SharedDatabaseAccess(network *network.LocalNetwork, teleporter utils.Telepo testUtils.TriggerProcessMissedBlocks( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, relayerCleanupA, relayerConfigA, fundedAddress, @@ -135,8 +135,8 @@ func SharedDatabaseAccess(network *network.LocalNetwork, teleporter utils.Telepo testUtils.TriggerProcessMissedBlocks( ctx, teleporter, - subnetBInfo, - subnetAInfo, + l1BInfo, + l1AInfo, relayerCleanupB, relayerConfigB, fundedAddress, diff --git a/tests/signature_aggregator_api.go b/tests/signature_aggregator_api.go index 0883fe3e..6edfe83c 100644 --- a/tests/signature_aggregator_api.go +++ b/tests/signature_aggregator_api.go @@ -36,12 +36,12 @@ func SignatureAggregatorAPI(network *network.LocalNetwork, teleporter utils.Tele // Begin Setup step ctx := context.Background() - subnetAInfo := network.GetPrimaryNetworkInfo() - subnetBInfo, _ := network.GetTwoSubnets() + l1AInfo := network.GetPrimaryNetworkInfo() + l1BInfo, _ := network.GetTwoL1s() fundedAddress, fundedKey := network.GetFundedAccountInfo() signatureAggregatorConfig := testUtils.CreateDefaultSignatureAggregatorConfig( - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, ) signatureAggregatorConfigPath := testUtils.WriteSignatureAggregatorConfig( @@ -69,12 +69,12 @@ func SignatureAggregatorAPI(network *network.LocalNetwork, teleporter utils.Tele receipt, _, _ := testUtils.SendBasicTeleporterMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, fundedKey, fundedAddress, ) - warpMessage := getWarpMessageFromLog(ctx, receipt, subnetAInfo) + warpMessage := getWarpMessageFromLog(ctx, receipt, l1AInfo) reqBody := api.AggregateSignatureRequest{ Message: "0x" + hex.EncodeToString(warpMessage.Bytes()), @@ -123,12 +123,12 @@ func SignatureAggregatorAPI(network *network.LocalNetwork, teleporter utils.Tele receipt, _, _ = testUtils.SendBasicTeleporterMessage( ctx, teleporter, - subnetBInfo, - subnetAInfo, + l1BInfo, + l1AInfo, fundedKey, fundedAddress, ) - warpMessage = getWarpMessageFromLog(ctx, receipt, subnetBInfo) + warpMessage = getWarpMessageFromLog(ctx, receipt, l1BInfo) reqBody = api.AggregateSignatureRequest{ Message: "0x" + hex.EncodeToString(warpMessage.Bytes()), diff --git a/tests/warp_api.go b/tests/warp_api.go index 79aa5f23..8dc6a02b 100644 --- a/tests/warp_api.go +++ b/tests/warp_api.go @@ -30,8 +30,8 @@ const rpcSignatureMetricName = "app_fetch_signature_rpc_count" // - Relaying from Subnet B to Subnet A // - Verifying the messages were signed using the Warp API func WarpAPIRelay(network *network.LocalNetwork, teleporter utils.TeleporterTestInfo) { - subnetAInfo := network.GetPrimaryNetworkInfo() - subnetBInfo, _ := network.GetTwoSubnets() + l1AInfo := network.GetPrimaryNetworkInfo() + l1BInfo, _ := network.GetTwoL1s() fundedAddress, fundedKey := network.GetFundedAccountInfo() err := testUtils.ClearRelayerStorage() Expect(err).Should(BeNil()) @@ -44,15 +44,15 @@ func WarpAPIRelay(network *network.LocalNetwork, teleporter utils.TeleporterTest log.Info("Funding relayer address on all subnets") relayerKey, err := crypto.GenerateKey() Expect(err).Should(BeNil()) - testUtils.FundRelayers(ctx, []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, fundedKey, relayerKey) + testUtils.FundRelayers(ctx, []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedKey, relayerKey) // // Set up relayer config // relayerConfig := testUtils.CreateDefaultRelayerConfig( teleporter, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, - []interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, + []interfaces.L1TestInfo{l1AInfo, l1BInfo}, fundedAddress, relayerKey, ) @@ -86,8 +86,8 @@ func WarpAPIRelay(network *network.LocalNetwork, teleporter utils.TeleporterTest testUtils.RelayBasicMessage( ctx, teleporter, - subnetAInfo, - subnetBInfo, + l1AInfo, + l1BInfo, fundedKey, fundedAddress, ) @@ -99,8 +99,8 @@ func WarpAPIRelay(network *network.LocalNetwork, teleporter utils.TeleporterTest testUtils.RelayBasicMessage( ctx, teleporter, - subnetBInfo, - subnetAInfo, + l1BInfo, + l1AInfo, fundedKey, fundedAddress, )