Skip to content

Commit

Permalink
Merge pull request #654 from ava-labs/p2p-peer-fetching-compatibility
Browse files Browse the repository at this point in the history
P2p peer fetching compatibility
  • Loading branch information
cam-schultz authored Nov 26, 2024
2 parents a236757 + 7f04068 commit 790ccce
Show file tree
Hide file tree
Showing 35 changed files with 212 additions and 126 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ module github.com/ava-labs/teleporter
go 1.22.8

require (
github.com/ava-labs/avalanchego v1.12.0-fuji
github.com/ava-labs/avalanchego v1.12.0-initial-poc.9.0.20241122192639-7c3ad181c928
github.com/supranational/blst v0.3.13 // indirect
)

require (
github.com/ava-labs/awm-relayer v1.4.1-0.20241121212846-90ad76f595d6
github.com/ava-labs/awm-relayer v1.4.1-0.20241122202209-75359d908260
github.com/ava-labs/subnet-evm v0.6.12
github.com/ethereum/go-ethereum v1.13.14
github.com/onsi/ginkgo/v2 v2.22.0
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,10 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio=
github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs=
github.com/ava-labs/avalanchego v1.12.0-fuji h1:o/GbXrqW9CAXu2jX/a1dZtvFiiSVCWomJZyxF4hCQOA=
github.com/ava-labs/avalanchego v1.12.0-fuji/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0=
github.com/ava-labs/awm-relayer v1.4.1-0.20241121212846-90ad76f595d6 h1:diUjomjOuTFwk3Z2FUxA94PzLZy+6ONfZVuaRhDrtmA=
github.com/ava-labs/awm-relayer v1.4.1-0.20241121212846-90ad76f595d6/go.mod h1:mNQitNat92izhmMF0++6/REQQI3W+h0oRAnLl3bs/6I=
github.com/ava-labs/avalanchego v1.12.0-initial-poc.9.0.20241122192639-7c3ad181c928 h1:th+K+wWgAYL/NsrFJyO+/sThLRdEDE0+I4vgbPLoWQQ=
github.com/ava-labs/avalanchego v1.12.0-initial-poc.9.0.20241122192639-7c3ad181c928/go.mod h1:yhD5dpZyStIVbxQ550EDi5w5SL7DQ/xGE6TIxosb7U0=
github.com/ava-labs/awm-relayer v1.4.1-0.20241122202209-75359d908260 h1:VRNzoY1xvXHphcXXmuXMrUFp5Gm/eiipVJMmNV+UN9c=
github.com/ava-labs/awm-relayer v1.4.1-0.20241122202209-75359d908260/go.mod h1:/hrQpd8P3BfShbRoDE1vD1WZXBchu7r8CQPTEb5tWOQ=
github.com/ava-labs/coreth v0.13.9-rc.1 h1:qIICpC/OZGYUP37QnLgIqqwGmxnLwLpZaUlqJNI85vU=
github.com/ava-labs/coreth v0.13.9-rc.1/go.mod h1:7aMsRIo/3GBE44qWZMjnfqdqfcfZ5yShTTm2LObLaYo=
github.com/ava-labs/subnet-evm v0.6.12 h1:jL3FmjdFcNfS0qwbehwN6DkAg9y7zexB1riiGBxRsM0=
Expand Down
2 changes: 2 additions & 0 deletions scripts/versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ AWM_RELAYER_VERSION=${AWM_RELAYER_VERSION:-'v1.0.0'}

# Don't export them as they're used in the context of other calls
AVALANCHEGO_VERSION=${AVALANCHEGO_VERSION:-$(extract_commit "$(getDepVersion github.com/ava-labs/avalanchego)")}
# Temporarily hardcode the Avalanchego version until outbound networking relaxation is available
AVALANCHEGO_VERSION=v1.12.0-fuji
GINKGO_VERSION=${GINKGO_VERSION:-$(extract_commit "$(getDepVersion github.com/onsi/ginkgo/v2)")}
SUBNET_EVM_VERSION=${SUBNET_EVM_VERSION:-$(extract_commit "$(getDepVersion github.com/ava-labs/subnet-evm)")}

Expand Down
5 changes: 4 additions & 1 deletion tests/flows/governance/validator_set_sig.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,9 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) {
// Test Case 1: validatorChain (subnetB) != targetChain (subnetA)
// ************************************************************************************************

aggregator := network.GetSignatureAggregator()
defer aggregator.Shutdown()

// Execute the ValidatorSetSig executeCall and wait for acceptance
receipt := utils.ExecuteValidatorSetSigCallAndVerify(
ctx,
Expand All @@ -153,7 +156,7 @@ func ValidatorSetSig(network *localnetwork.LocalNetwork) {
validatorSetSigContractAddress,
fundedKey,
&offchainMessages[0],
network.GetSignatureAggregator(),
aggregator,
true,
)

Expand Down
9 changes: 6 additions & 3 deletions tests/flows/ictt/erc20_home_erc20_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport
tokenDecimals,
)

aggregator := network.GetSignatureAggregator()
defer aggregator.Shutdown()

utils.RegisterERC20TokenRemoteOnHome(
ctx,
teleporter,
Expand All @@ -79,7 +82,7 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport
subnetAInfo,
erc20TokenRemoteAddress,
fundedKey,
network.GetSignatureAggregator(),
aggregator,
)

// Generate new recipient to receive transferred tokens
Expand Down Expand Up @@ -119,7 +122,7 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

utils.CheckERC20TokenRemoteWithdrawal(
Expand Down Expand Up @@ -172,7 +175,7 @@ func ERC20TokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, teleport
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

utils.CheckERC20TokenHomeWithdrawal(
Expand Down
13 changes: 8 additions & 5 deletions tests/flows/ictt/erc20_home_erc20_remote_multihop.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
tokenDecimals,
)

aggregator := network.GetSignatureAggregator()
defer aggregator.Shutdown()

// Register both ERC20TokenRemote instances on the ERC20TokenHome
utils.RegisterERC20TokenRemoteOnHome(
ctx,
Expand All @@ -95,7 +98,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
subnetAInfo,
erc20TokenRemoteAddressA,
fundedKey,
network.GetSignatureAggregator(),
aggregator,
)
utils.RegisterERC20TokenRemoteOnHome(
ctx,
Expand All @@ -105,7 +108,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
subnetBInfo,
erc20TokenRemoteAddressB,
fundedKey,
network.GetSignatureAggregator(),
aggregator,
)

// Generate new recipient to receive transferred tokens
Expand Down Expand Up @@ -145,7 +148,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

utils.CheckERC20TokenRemoteWithdrawal(
Expand Down Expand Up @@ -179,7 +182,7 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
cChainInfo,
transferredAmount,
secondaryFeeAmount,
network.GetSignatureAggregator(),
aggregator,
)

// Multi-hop transfer back to Subnet A
Expand All @@ -200,6 +203,6 @@ func ERC20TokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
cChainInfo,
transferredAmount,
secondaryFeeAmount,
network.GetSignatureAggregator(),
aggregator,
)
}
11 changes: 7 additions & 4 deletions tests/flows/ictt/erc20_home_erc20_remote_send_and_call.go
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,9 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall(
tokenDecimals,
)

aggregator := network.GetSignatureAggregator()
defer aggregator.Shutdown()

utils.RegisterERC20TokenRemoteOnHome(
ctx,
teleporter,
Expand All @@ -95,7 +98,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall(
subnetAInfo,
erc20TokenRemoteAddress,
fundedKey,
network.GetSignatureAggregator(),
aggregator,
)

// Generate new recipient to receive transferred tokens
Expand Down Expand Up @@ -147,7 +150,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall(
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

event, err := utils.GetEventFromLogs(receipt.Logs, erc20TokenRemote.ParseCallSucceeded)
Expand Down Expand Up @@ -199,7 +202,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall(
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

utils.CheckERC20TokenRemoteWithdrawal(
Expand Down Expand Up @@ -258,7 +261,7 @@ func ERC20TokenHomeERC20TokenRemoteSendAndCall(
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

homeEvent, err := utils.GetEventFromLogs(receipt.Logs, erc20TokenHome.ParseCallSucceeded)
Expand Down
9 changes: 6 additions & 3 deletions tests/flows/ictt/erc20_home_native_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,9 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor
burnedFeesReportingRewardPercentage,
)

aggregator := network.GetSignatureAggregator()
defer aggregator.Shutdown()

collateralAmount := utils.RegisterTokenRemoteOnHome(
ctx,
teleporter,
Expand All @@ -85,7 +88,7 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor
utils.GetTokenMultiplier(decimalsShift),
multiplyOnRemote,
fundedKey,
network.GetSignatureAggregator(),
aggregator,
)

utils.AddCollateralToERC20TokenHome(
Expand Down Expand Up @@ -138,7 +141,7 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

// Verify the recipient received the tokens
Expand Down Expand Up @@ -174,7 +177,7 @@ func ERC20TokenHomeNativeTokenRemote(network *localnetwork.LocalNetwork, telepor
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

// Check that the recipient received the tokens
Expand Down
15 changes: 9 additions & 6 deletions tests/flows/ictt/erc20_home_native_remote_multihop.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,9 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork,
burnedFeesReportingRewardPercentage,
)

aggregator := network.GetSignatureAggregator()
defer aggregator.Shutdown()

// Register both NativeTokenDestinations on the ERC20TokenHome
collateralAmountA := utils.RegisterTokenRemoteOnHome(
ctx,
Expand All @@ -90,7 +93,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork,
utils.GetTokenMultiplier(decimalsShift),
multiplyOnRemote,
fundedKey,
network.GetSignatureAggregator(),
aggregator,
)

collateralAmountB := utils.RegisterTokenRemoteOnHome(
Expand All @@ -104,7 +107,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork,
utils.GetTokenMultiplier(decimalsShift),
multiplyOnRemote,
fundedKey,
network.GetSignatureAggregator(),
aggregator,
)

// Add collateral for both NativeTokenDestinations
Expand Down Expand Up @@ -171,7 +174,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork,
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

// Verify the recipient received the tokens
Expand Down Expand Up @@ -208,7 +211,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork,
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

// Verify the recipient received the tokens
Expand All @@ -232,7 +235,7 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork,
cChainInfo,
amountToSend,
big.NewInt(0),
network.GetSignatureAggregator(),
aggregator,
)

// Multi-hop transfer back to Subnet A
Expand All @@ -251,6 +254,6 @@ func ERC20TokenHomeNativeTokenRemoteMultiHop(network *localnetwork.LocalNetwork,
cChainInfo,
amountToSend,
secondaryFeeAmount,
network.GetSignatureAggregator(),
aggregator,
)
}
9 changes: 6 additions & 3 deletions tests/flows/ictt/native_home_erc20_remote.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,9 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor
tokenDecimals,
)

aggregator := network.GetSignatureAggregator()
defer aggregator.Shutdown()

utils.RegisterERC20TokenRemoteOnHome(
ctx,
teleporter,
Expand All @@ -75,7 +78,7 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor
subnetAInfo,
erc20TokenRemoteAddress,
fundedKey,
network.GetSignatureAggregator(),
aggregator,
)

// Generate new recipient to receive transferred tokens
Expand Down Expand Up @@ -116,7 +119,7 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

utils.CheckERC20TokenRemoteWithdrawal(
Expand Down Expand Up @@ -169,7 +172,7 @@ func NativeTokenHomeERC20TokenRemote(network *localnetwork.LocalNetwork, telepor
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

// Check that the recipient received the tokens
Expand Down
11 changes: 7 additions & 4 deletions tests/flows/ictt/native_home_erc20_remote_multihop.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,9 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
tokenDecimals,
)

aggregator := network.GetSignatureAggregator()
defer aggregator.Shutdown()

// Register both ERC20Destinations on the NativeTokenHome
utils.RegisterERC20TokenRemoteOnHome(
ctx,
Expand All @@ -90,7 +93,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
subnetAInfo,
erc20TokenRemoteAddressA,
fundedKey,
network.GetSignatureAggregator(),
aggregator,
)

utils.RegisterERC20TokenRemoteOnHome(
Expand All @@ -101,7 +104,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
subnetBInfo,
erc20TokenRemoteAddressB,
fundedKey,
network.GetSignatureAggregator(),
aggregator,
)

// Generate new recipient to receive transferred tokens
Expand Down Expand Up @@ -142,7 +145,7 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
true,
fundedKey,
nil,
network.GetSignatureAggregator(),
aggregator,
)

utils.CheckERC20TokenRemoteWithdrawal(
Expand Down Expand Up @@ -175,6 +178,6 @@ func NativeTokenHomeERC20TokenRemoteMultiHop(network *localnetwork.LocalNetwork,
cChainInfo,
transferredAmount,
secondaryFeeAmount,
network.GetSignatureAggregator(),
aggregator,
)
}
Loading

0 comments on commit 790ccce

Please sign in to comment.