Skip to content

Commit

Permalink
Merge pull request #560 from ava-labs/sov-compatible-test-network
Browse files Browse the repository at this point in the history
Tests use SoV compatible framework
  • Loading branch information
cam-schultz authored Nov 22, 2024
2 parents 7021dec + f2498c4 commit 0648caa
Show file tree
Hide file tree
Showing 15 changed files with 217 additions and 149 deletions.
18 changes: 9 additions & 9 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ require (
github.com/ava-labs/avalanchego v1.12.0-fuji
github.com/ava-labs/coreth v0.13.9-rc.1
github.com/ava-labs/subnet-evm v0.6.12
github.com/ava-labs/teleporter v1.0.7
github.com/ava-labs/teleporter v1.0.8-0.20241121223552-226937a967e8
github.com/aws/aws-sdk-go-v2 v1.32.5
github.com/aws/aws-sdk-go-v2/config v1.28.5
github.com/aws/aws-sdk-go-v2/service/kms v1.37.6
github.com/aws/aws-sdk-go-v2/config v1.28.3
github.com/aws/aws-sdk-go-v2/service/kms v1.37.5
github.com/ethereum/go-ethereum v1.13.14
github.com/hashicorp/golang-lru/v2 v2.0.7
github.com/onsi/ginkgo/v2 v2.22.0
Expand Down Expand Up @@ -156,15 +156,15 @@ require (
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.28.0 // indirect
golang.org/x/crypto v0.29.0 // indirect
golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect
golang.org/x/net v0.30.0 // indirect
golang.org/x/net v0.31.0 // indirect
golang.org/x/oauth2 v0.23.0 // indirect
golang.org/x/sys v0.26.0 // indirect
golang.org/x/term v0.25.0 // indirect
golang.org/x/text v0.19.0 // indirect
golang.org/x/sys v0.27.0 // indirect
golang.org/x/term v0.26.0 // indirect
golang.org/x/text v0.20.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.26.0 // indirect
golang.org/x/tools v0.27.0 // indirect
gonum.org/v1/gonum v0.11.0 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240903143218-8af14fe29dc1 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240903143218-8af14fe29dc1 // indirect
Expand Down
36 changes: 18 additions & 18 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,12 @@ github.com/ava-labs/coreth v0.13.9-rc.1 h1:qIICpC/OZGYUP37QnLgIqqwGmxnLwLpZaUlqJ
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=
github.com/ava-labs/subnet-evm v0.6.12/go.mod h1:vffwL4UqAh7ibpWjveUuUhamm3a9w75q92bG5vXdX5k=
github.com/ava-labs/teleporter v1.0.7 h1:9H0wTWhgWeA4u6uxi9KngdBu/LOoYsfAmIZhXNzuvf8=
github.com/ava-labs/teleporter v1.0.7/go.mod h1:wgCgU6vU5MtP83otpjEin8jL2jrflVBNQCTxVXMx/kU=
github.com/ava-labs/teleporter v1.0.8-0.20241121223552-226937a967e8 h1:jsH1wv1GgeztvipQG3di1OTruSHbFAwwP4K6clzTRLE=
github.com/ava-labs/teleporter v1.0.8-0.20241121223552-226937a967e8/go.mod h1:Q4/DDZPLI5f96xDykVXPT85PeJS3IqDPDJDk3UdQOuQ=
github.com/aws/aws-sdk-go-v2 v1.32.5 h1:U8vdWJuY7ruAkzaOdD7guwJjD06YSKmnKCJs7s3IkIo=
github.com/aws/aws-sdk-go-v2 v1.32.5/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U=
github.com/aws/aws-sdk-go-v2/config v1.28.5 h1:Za41twdCXbuyyWv9LndXxZZv3QhTG1DinqlFsSuvtI0=
github.com/aws/aws-sdk-go-v2/config v1.28.5/go.mod h1:4VsPbHP8JdcdUDmbTVgNL/8w9SqOkM5jyY8ljIxLO3o=
github.com/aws/aws-sdk-go-v2/config v1.28.3 h1:kL5uAptPcPKaJ4q0sDUjUIdueO18Q7JDzl64GpVwdOM=
github.com/aws/aws-sdk-go-v2/config v1.28.3/go.mod h1:SPEn1KA8YbgQnwiJ/OISU4fz7+F6Fe309Jf0QTsRCl4=
github.com/aws/aws-sdk-go-v2/credentials v1.17.46 h1:AU7RcriIo2lXjUfHFnFKYsLCwgbz1E7Mm95ieIRDNUg=
github.com/aws/aws-sdk-go-v2/credentials v1.17.46/go.mod h1:1FmYyLGL08KQXQ6mcTlifyFXfJVCNJTVGuQP4m0d/UA=
github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.20 h1:sDSXIrlsFSFJtWKLQS4PUWRvrT580rrnuLydJrCQ/yA=
Expand All @@ -86,8 +86,8 @@ github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1 h1:iXtILhv
github.com/aws/aws-sdk-go-v2/service/internal/accept-encoding v1.12.1/go.mod h1:9nu0fVANtYiAePIBh2/pFUSwtJ402hLnp854CNoDOeE=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.5 h1:wtpJ4zcwrSbwhECWQoI/g6WM9zqCcSpHDJIWSbMLOu4=
github.com/aws/aws-sdk-go-v2/service/internal/presigned-url v1.12.5/go.mod h1:qu/W9HXQbbQ4+1+JcZp0ZNPV31ym537ZJN+fiS7Ti8E=
github.com/aws/aws-sdk-go-v2/service/kms v1.37.6 h1:CZImQdb1QbU9sGgJ9IswhVkxAcjkkD1eQTMA1KHWk+E=
github.com/aws/aws-sdk-go-v2/service/kms v1.37.6/go.mod h1:YJDdlK0zsyxVBxGU48AR/Mi8DMrGdc1E3Yij4fNrONA=
github.com/aws/aws-sdk-go-v2/service/kms v1.37.5 h1:5dQJ6Q5QrQOqZxXjSbRXukBqU8Pgu6Ro6Qqtyd8yiz4=
github.com/aws/aws-sdk-go-v2/service/kms v1.37.5/go.mod h1:A9vfQcNHVBCE7ZZN6H+UUJpXtbH26Vv6L7Zhk5nIJAY=
github.com/aws/aws-sdk-go-v2/service/sso v1.24.6 h1:3zu537oLmsPfDMyjnUS2g+F2vITgy5pB74tHI+JBNoM=
github.com/aws/aws-sdk-go-v2/service/sso v1.24.6/go.mod h1:WJSZH2ZvepM6t6jwu4w/Z45Eoi75lPN7DcydSRtJg6Y=
github.com/aws/aws-sdk-go-v2/service/ssooidc v1.28.5 h1:K0OQAsDywb0ltlFrZm0JHPY3yZp/S9OaoLU33S7vPS8=
Expand Down Expand Up @@ -706,8 +706,8 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.28.0 h1:GBDwsMXVQi34v5CCYUm2jkJvu4cbtru2U4TN2PSyQnw=
golang.org/x/crypto v0.28.0/go.mod h1:rmgy+3RHxRZMyY0jjAJShp2zgEdOqj2AO7U0pYmeQ7U=
golang.org/x/crypto v0.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ=
golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
Expand Down Expand Up @@ -791,8 +791,8 @@ golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.30.0 h1:AcW1SDZMkb8IpzCdQUaIq2sP4sZ4zw+55h6ynffypl4=
golang.org/x/net v0.30.0/go.mod h1:2wGyMJ5iFasEhkwi13ChkO/t1ECNC4X4eBKkVFyYFlU=
golang.org/x/net v0.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo=
golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand Down Expand Up @@ -884,12 +884,12 @@ golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.8.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.26.0 h1:KHjCJyddX0LoSTb3J+vWpupP9p0oznkqVk/IfjymZbo=
golang.org/x/sys v0.26.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/sys v0.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s=
golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.25.0 h1:WtHI/ltw4NvSUig5KARz9h521QvRC8RmF/cuYqifU24=
golang.org/x/term v0.25.0/go.mod h1:RPyXicDX+6vLxogjjRxjgD2TKtmAO6NZBsBRfrOLu7M=
golang.org/x/term v0.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU=
golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -900,8 +900,8 @@ golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ=
golang.org/x/text v0.19.0 h1:kTxAhCbGbxhK0IwgSKiMO5awPoDQ0RpfiVYBfK860YM=
golang.org/x/text v0.19.0/go.mod h1:BuEKDfySbSR4drPmRPG/7iBdf8hvFMuRexcpahXilzY=
golang.org/x/text v0.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug=
golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down Expand Up @@ -963,8 +963,8 @@ golang.org/x/tools v0.0.0-20210108195828-e2f9c7f1fc8e/go.mod h1:emZCQorbCU4vsT4f
golang.org/x/tools v0.1.0/go.mod h1:xkSsbof2nBLbhDlRMhhhyNLN/zl3eTqcnHD5viDpcZ0=
golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk=
golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc=
golang.org/x/tools v0.26.0 h1:v/60pFQmzmT9ExmjDv2gGIfi3OqfKoEP6I5+umXlbnQ=
golang.org/x/tools v0.26.0/go.mod h1:TPVVj70c7JJ3WCazhD8OdXcZg/og+b9+tH/KxylGwH0=
golang.org/x/tools v0.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o=
golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q=
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
Expand Down
42 changes: 13 additions & 29 deletions scripts/e2e_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,10 @@

set -e

SUBNET_EVM_PATH=
LOCAL=
DATA_DIRECTORY=
HELP=
LOG_LEVEL=
while [ $# -gt 0 ]; do
case "$1" in
-l | --local) LOCAL=true ;;
-s | --subnet-evm) SUBNET_EVM_PATH=$2 ;;
-d | --data-dir) DATA_DIRECTORY=$2 ;;
-v | --verbose) LOG_LEVEL=debug ;;
-h | --help) HELP=true ;;
esac
Expand All @@ -25,42 +19,32 @@ if [ "$HELP" = true ]; then
echo "Run E2E tests for AWM Relayer."
echo ""
echo "Options:"
echo " -l, --local Run the test locally. Requires --subnet-evm and --data-dir"
echo " -s, --subnet-evm <path> Path to subnet-evm repo"
echo " -d, --data-dir <path> Path to data directory"
echo " -v, --verbose Enable debug logs"
echo " -h, --help Print this help message"
exit 0
fi

if [ "$LOCAL" = true ]; then
if [ -z "$DATA_DIRECTORY" ]; then
echo "Must specify data directory when running local"
exit 1
fi
if [ -z "$SUBNET_EVM_PATH" ]; then
echo "Must specify subnet-evm path when running local"
exit 1
fi
cwd=$PWD
BASEDIR=$DATA_DIRECTORY AVALANCHEGO_BUILD_PATH=$DATA_DIRECTORY/avalanchego ./scripts/install_avalanchego_release.sh
cd $SUBNET_EVM_PATH
./scripts/build.sh $DATA_DIRECTORY/avalanchego/plugins/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy

cd $cwd
export AVALANCHEGO_BUILD_PATH=$DATA_DIRECTORY/avalanchego
export DATA_DIR=$DATA_DIRECTORY/data
fi

BASE_PATH=$(
cd "$(dirname "${BASH_SOURCE[0]}")"
cd .. && pwd
)

source "$BASE_PATH"/scripts/constants.sh

source "$BASE_PATH"/scripts/versions.sh

BASEDIR=${BASEDIR:-"$HOME/.teleporter-deps"}

cwd=$(pwd)
# Install the avalanchego and subnet-evm binaries
rm -rf $BASEDIR/avalanchego
BASEDIR=$BASEDIR AVALANCHEGO_BUILD_PATH=$BASEDIR/avalanchego ./scripts/install_avalanchego_release.sh
BASEDIR=$BASEDIR "${TELEPORTER_PATH}/scripts/install_subnetevm_release.sh"

cp ${BASEDIR}/subnet-evm/subnet-evm ${BASEDIR}/avalanchego/plugins/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy
echo "Copied ${BASEDIR}/subnet-evm/subnet-evm binary to ${BASEDIR}/avalanchego/plugins/"

export AVALANCHEGO_BUILD_PATH=$BASEDIR/avalanchego

# Build ginkgo
# to install the ginkgo binary (required for test build and run)
go install -v github.com/onsi/ginkgo/v2/ginkgo@${GINKGO_VERSION}
Expand Down
31 changes: 17 additions & 14 deletions tests/allowed_addresses.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
testUtils "github.com/ava-labs/awm-relayer/tests/utils"
"github.com/ava-labs/subnet-evm/accounts/abi/bind"
"github.com/ava-labs/teleporter/tests/interfaces"
"github.com/ava-labs/teleporter/tests/network"
"github.com/ava-labs/teleporter/tests/utils"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/crypto"
Expand All @@ -36,11 +37,10 @@ const numKeys = 4
// - Deliver from a specific source address to a specific destination address
// Then, checks that each relayer instance is able to properly catch up on missed messages that
// match its particular configuration.
func AllowedAddresses(network interfaces.LocalNetwork) {
func AllowedAddresses(network *network.LocalNetwork, teleporter utils.TeleporterTestInfo) {
subnetAInfo := network.GetPrimaryNetworkInfo()
subnetBInfo, _ := utils.GetTwoSubnets(network)
subnetBInfo, _ := network.GetTwoSubnets()
fundedAddress, fundedKey := network.GetFundedAccountInfo()
teleporterContractAddress := network.GetTeleporterContractAddress()
err := testUtils.ClearRelayerStorage()
Expect(err).Should(BeNil())

Expand Down Expand Up @@ -84,19 +84,19 @@ func AllowedAddresses(network interfaces.LocalNetwork) {
// All sources -> All destinations
// Will send from allowed Address 0 -> 0
relayerConfig1 := testUtils.CreateDefaultRelayerConfig(
teleporter,
[]interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo},
[]interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo},
teleporterContractAddress,
fundedAddress,
relayerKey,
)

// Specific source -> All destinations
// Will send from allowed Address 1 -> 0
relayerConfig2 := testUtils.CreateDefaultRelayerConfig(
teleporter,
[]interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo},
[]interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo},
teleporterContractAddress,
fundedAddress,
relayerKey,
)
Expand All @@ -109,9 +109,9 @@ func AllowedAddresses(network interfaces.LocalNetwork) {
// All sources -> Specific destination
// Will send from allowed Address 2 -> 0
relayerConfig3 := testUtils.CreateDefaultRelayerConfig(
teleporter,
[]interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo},
[]interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo},
teleporterContractAddress,
fundedAddress,
relayerKey,
)
Expand All @@ -135,9 +135,9 @@ func AllowedAddresses(network interfaces.LocalNetwork) {
// Specific source -> Specific destination
// Will send from allowed Address 3 -> 0
relayerConfig4 := testUtils.CreateDefaultRelayerConfig(
teleporter,
[]interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo},
[]interfaces.SubnetTestInfo{subnetAInfo, subnetBInfo},
teleporterContractAddress,
fundedAddress,
relayerKey,
)
Expand Down Expand Up @@ -188,9 +188,9 @@ func AllowedAddresses(network interfaces.LocalNetwork) {
// Allowed by Relayer 1
testUtils.RelayBasicMessage(
ctx,
teleporter,
subnetAInfo,
subnetBInfo,
teleporterContractAddress,
allowedKeys[generalAllowedAddressIdx],
allowedAddresses[generalAllowedAddressIdx],
)
Expand Down Expand Up @@ -218,13 +218,14 @@ func AllowedAddresses(network interfaces.LocalNetwork) {
// Disallowed by Relayer 2
_, _, id := testUtils.SendBasicTeleporterMessage(
ctx,
teleporter,
subnetAInfo,
subnetBInfo,
allowedKeys[generalAllowedAddressIdx], // not allowed
allowedAddresses[generalAllowedAddressIdx],
)
Consistently(func() bool {
delivered, err := subnetBInfo.TeleporterMessenger.MessageReceived(
delivered, err := teleporter.TeleporterMessenger(subnetBInfo).MessageReceived(
&bind.CallOpts{}, id,
)
Expect(err).Should(BeNil())
Expand All @@ -234,9 +235,9 @@ func AllowedAddresses(network interfaces.LocalNetwork) {
// Allowed by Relayer 2
testUtils.RelayBasicMessage(
ctx,
teleporter,
subnetAInfo,
subnetBInfo,
teleporterContractAddress,
allowedKeys[relayer2AllowedSrcAddressIdx],
allowedAddresses[generalAllowedAddressIdx],
)
Expand Down Expand Up @@ -264,13 +265,14 @@ func AllowedAddresses(network interfaces.LocalNetwork) {
// Disallowed by Relayer 3
_, _, id = testUtils.SendBasicTeleporterMessage(
ctx,
teleporter,
subnetAInfo,
subnetBInfo,
allowedKeys[generalAllowedAddressIdx],
allowedAddresses[generalAllowedAddressIdx], // not allowed
)
Consistently(func() bool {
delivered, err := subnetBInfo.TeleporterMessenger.MessageReceived(
delivered, err := teleporter.TeleporterMessenger(subnetBInfo).MessageReceived(
&bind.CallOpts{}, id,
)
Expect(err).Should(BeNil())
Expand All @@ -280,9 +282,9 @@ func AllowedAddresses(network interfaces.LocalNetwork) {
// Allowed by Relayer 3
testUtils.RelayBasicMessage(
ctx,
teleporter,
subnetAInfo,
subnetBInfo,
teleporterContractAddress,
allowedKeys[generalAllowedAddressIdx],
allowedAddresses[relayer3AllowedDstAddressIdx],
)
Expand All @@ -309,13 +311,14 @@ func AllowedAddresses(network interfaces.LocalNetwork) {
// Disallowed by Relayer 4
_, _, id = testUtils.SendBasicTeleporterMessage(
ctx,
teleporter,
subnetAInfo,
subnetBInfo,
allowedKeys[generalAllowedAddressIdx], // not allowed
allowedAddresses[generalAllowedAddressIdx],
)
Consistently(func() bool {
delivered, err := subnetBInfo.TeleporterMessenger.MessageReceived(
delivered, err := teleporter.TeleporterMessenger(subnetBInfo).MessageReceived(
&bind.CallOpts{}, id,
)
Expect(err).Should(BeNil())
Expand All @@ -325,9 +328,9 @@ func AllowedAddresses(network interfaces.LocalNetwork) {
// Allowed by Relayer 4
testUtils.RelayBasicMessage(
ctx,
teleporter,
subnetAInfo,
subnetBInfo,
teleporterContractAddress,
allowedKeys[relayer4AllowedSrcAddressIdx],
allowedAddresses[relayer4AllowedDstAddressIdx],
)
Expand Down
Loading

0 comments on commit 0648caa

Please sign in to comment.