From bb78bc833936d95bc9e2fe24e40f8370f7f52786 Mon Sep 17 00:00:00 2001 From: Ian Suvak Date: Mon, 9 Dec 2024 14:08:34 -0500 Subject: [PATCH 1/2] apply renames from icm-contracts --- .gitmodules | 2 +- go.mod | 18 ++-- go.sum | 36 +++---- .../off-chain-registry/message_handler.go | 2 +- .../message_handler_test.go | 2 +- messages/teleporter/message_handler.go | 6 +- messages/teleporter/message_handler_test.go | 4 +- relayer/README.md | 2 +- tests/allowed_addresses.go | 6 +- tests/basic_relay.go | 6 +- tests/batch_relay.go | 6 +- tests/e2e_test.go | 4 +- tests/etna_upgrade.go | 6 +- tests/manual_message.go | 8 +- tests/relay_message_api.go | 8 +- tests/shared_db.go | 6 +- tests/signature_aggregator_api.go | 6 +- tests/utils/utils.go | 96 +++++++++---------- tests/warp_api.go | 6 +- 19 files changed, 115 insertions(+), 115 deletions(-) diff --git a/.gitmodules b/.gitmodules index 15d57c4e..a4ea1404 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,6 @@ [submodule "tests/contracts/lib/teleporter"] path = tests/contracts/lib/teleporter - url = https://github.com/ava-labs/teleporter + url = https://github.com/ava-labs/icm-contracts [submodule "tests/contracts/lib/forge-std"] path = tests/contracts/lib/forge-std url = https://github.com/foundry-rs/forge-std diff --git a/go.mod b/go.mod index b6e6202f..4d20e3d6 100644 --- a/go.mod +++ b/go.mod @@ -6,8 +6,8 @@ require ( github.com/alexliesenfeld/health v0.8.0 github.com/ava-labs/avalanchego v1.12.0-initial-poc.9.0.20241122192639-7c3ad181c928 github.com/ava-labs/coreth v0.13.9-rc.1 + github.com/ava-labs/icm-contracts v1.0.8 github.com/ava-labs/subnet-evm v0.6.12 - github.com/ava-labs/teleporter v1.0.8-0.20241122194201-a6e92843c3b1 github.com/aws/aws-sdk-go-v2 v1.32.6 github.com/aws/aws-sdk-go-v2/config v1.28.6 github.com/aws/aws-sdk-go-v2/service/kms v1.37.7 @@ -21,7 +21,7 @@ require ( github.com/redis/go-redis/v9 v9.7.0 github.com/spf13/pflag v1.0.5 github.com/spf13/viper v1.16.0 - github.com/stretchr/testify v1.9.0 + github.com/stretchr/testify v1.10.0 go.uber.org/atomic v1.11.0 go.uber.org/mock v0.5.0 go.uber.org/zap v1.27.0 @@ -34,7 +34,7 @@ require ( github.com/DataDog/zstd v1.5.2 // indirect github.com/NYTimes/gziphandler v1.1.1 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect - github.com/ava-labs/awm-relayer v1.4.1-0.20241122193929-3dae643932ee // indirect + github.com/ava-labs/awm-relayer v1.4.1-0.20241122202209-75359d908260 // indirect github.com/aws/aws-sdk-go-v2/credentials v1.17.47 // indirect github.com/aws/aws-sdk-go-v2/feature/ec2/imds v1.16.21 // indirect github.com/aws/aws-sdk-go-v2/internal/configsources v1.3.25 // indirect @@ -161,15 +161,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.29.0 // indirect + golang.org/x/crypto v0.30.0 // indirect golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect - golang.org/x/net v0.31.0 // indirect + golang.org/x/net v0.32.0 // indirect golang.org/x/oauth2 v0.23.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/sys v0.28.0 // indirect + golang.org/x/term v0.27.0 // indirect + golang.org/x/text v0.21.0 // indirect golang.org/x/time v0.3.0 // indirect - golang.org/x/tools v0.27.0 // indirect + golang.org/x/tools v0.28.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 diff --git a/go.sum b/go.sum index 855dfc4d..2194884a 100644 --- a/go.sum +++ b/go.sum @@ -62,14 +62,14 @@ github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPd github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= 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.20241122193929-3dae643932ee h1:Op1rpuqFo28RnurIfQRCgMmjpRzCcXmbRoCC0I3+NOo= -github.com/ava-labs/awm-relayer v1.4.1-0.20241122193929-3dae643932ee/go.mod h1:2/GCie3ccW/rVJfOJmJyiGDjtZILWujpB/r/KcVV8/s= +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/icm-contracts v1.0.8 h1:xS2B23WRBnG4MGSmEiy9Wp6781/wtprct9HEHrHcAic= +github.com/ava-labs/icm-contracts v1.0.8/go.mod h1:DRu0hfN9uDyxfL0tgJBVq9OM3uc+t53KiyRov9n+OG4= 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.8-0.20241122194201-a6e92843c3b1 h1:y1zjdfGlfTZQoPyUyPjsu9FjDK8w19OWUTpgVzQSh0w= -github.com/ava-labs/teleporter v1.0.8-0.20241122194201-a6e92843c3b1/go.mod h1:45NrpvVlms+xHL/rFZT7VrRJqajT7UUW78lzBe3hAzU= github.com/aws/aws-sdk-go-v2 v1.32.6 h1:7BokKRgRPuGmKkFMhEg/jSul+tB9VvXhcViILtfG8b4= github.com/aws/aws-sdk-go-v2 v1.32.6/go.mod h1:P5WJBrYqqbWVaOxgH0X/FYYD47/nooaPOZPlQdmiN2U= github.com/aws/aws-sdk-go-v2/config v1.28.6 h1:D89IKtGrs/I3QXOLNTH93NJYtDhm8SYa9Q5CsPShmyo= @@ -616,8 +616,8 @@ github.com/stretchr/testify v1.7.2/go.mod h1:R6va5+xMeoiuVRoj+gSkQ7d3FALtqAAGI1F github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= github.com/stretchr/testify v1.8.3/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo= -github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= -github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= +github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= github.com/subosito/gotenv v1.4.2 h1:X1TuBLAMDFbaTAChgCBLu3DU3UPyELpnF2jjJ2cz/S8= github.com/subosito/gotenv v1.4.2/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0= github.com/supranational/blst v0.3.13 h1:AYeSxdOMacwu7FBmpfloBz5pbFXDmJL33RuwnKtmTjk= @@ -708,8 +708,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.29.0 h1:L5SG1JTTXupVV3n6sUqMTeWbjAyfPwoda2DLX8J8FrQ= -golang.org/x/crypto v0.29.0/go.mod h1:+F4F4N5hv6v38hfeYwTdx20oUvLLc+QfrE9Ax9HtgRg= +golang.org/x/crypto v0.30.0 h1:RwoQn3GkWiMkzlX562cLB7OxWvjH1L8xutO2WoJcRoY= +golang.org/x/crypto v0.30.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= 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= @@ -793,8 +793,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.31.0 h1:68CPQngjLL0r2AlUKiSxtQFKvzRVbnzLwMUn5SzcLHo= -golang.org/x/net v0.31.0/go.mod h1:P4fl1q7dY2hnZFxEk4pPSkDHF+QqjitcnDjUQyMM+pM= +golang.org/x/net v0.32.0 h1:ZqPmj8Kzc+Y6e0+skZsuACbx+wzMgo5MQsJh9Qd6aYI= +golang.org/x/net v0.32.0/go.mod h1:CwU0IoeOlnQQWJ6ioyFrfRuomB8GKF6KbYXZVyeXNfs= 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= @@ -886,12 +886,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.27.0 h1:wBqf8DvsY9Y/2P8gAfPDEYNuS30J4lPHJxXSb/nJZ+s= -golang.org/x/sys v0.27.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.28.0 h1:Fksou7UEQUWlKvIdsqzJmUmCX3cZuD2+P3XyyzwMhlA= +golang.org/x/sys v0.28.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.26.0 h1:WEQa6V3Gja/BhNxg540hBip/kkaYtRg3cxg4oXSw4AU= -golang.org/x/term v0.26.0/go.mod h1:Si5m1o57C5nBNQo5z1iq+XDijt21BDBDp2bK0QI8e3E= +golang.org/x/term v0.27.0 h1:WP60Sv1nlK1T6SupCHbXzSaN0b9wUmsPoRS9b61A23Q= +golang.org/x/term v0.27.0/go.mod h1:iMsnZpn0cago0GOrHO2+Y7u7JPn5AylBrcoWkElMTSM= 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= @@ -902,8 +902,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.20.0 h1:gK/Kv2otX8gz+wn7Rmb3vT96ZwuoxnQlY+HlJVj7Qug= -golang.org/x/text v0.20.0/go.mod h1:D4IsuqiFMhST5bX19pQ9ikHC2GsaKyk/oF+pn3ducp4= +golang.org/x/text v0.21.0 h1:zyQAAkrwaneQ066sspRyJaG9VNi/YJ1NfzcGB3hZ/qo= +golang.org/x/text v0.21.0/go.mod h1:4IBbMaMmOPCJ8SecivzSH54+73PCFmPWxNTLm+vZkEQ= 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= @@ -965,8 +965,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.27.0 h1:qEKojBykQkQ4EynWy4S8Weg69NumxKdn40Fce3uc/8o= -golang.org/x/tools v0.27.0/go.mod h1:sUi0ZgbwW9ZPAq26Ekut+weQPR5eIM6GQLQ1Yjm1H0Q= +golang.org/x/tools v0.28.0 h1:WuB6qZ4RPCQo5aP3WdKZS7i595EdWqWR8vqJTlwTVK8= +golang.org/x/tools v0.28.0/go.mod h1:dcIOrVd3mfQKTgrDVQHqCPMWy6lnhfhtX3hLXYVLfRw= 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= diff --git a/messages/off-chain-registry/message_handler.go b/messages/off-chain-registry/message_handler.go index a3d0338b..9d37934b 100644 --- a/messages/off-chain-registry/message_handler.go +++ b/messages/off-chain-registry/message_handler.go @@ -12,12 +12,12 @@ import ( "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/vms/platformvm/warp" warpPayload "github.com/ava-labs/avalanchego/vms/platformvm/warp/payload" + teleporterregistry "github.com/ava-labs/icm-contracts/abi-bindings/go/teleporter/registry/TeleporterRegistry" "github.com/ava-labs/icm-services/messages" "github.com/ava-labs/icm-services/relayer/config" "github.com/ava-labs/icm-services/vms" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/ethclient" - teleporterregistry "github.com/ava-labs/teleporter/abi-bindings/go/teleporter/registry/TeleporterRegistry" "github.com/ethereum/go-ethereum/common" "go.uber.org/zap" ) diff --git a/messages/off-chain-registry/message_handler_test.go b/messages/off-chain-registry/message_handler_test.go index e2d7f698..e0b6da93 100644 --- a/messages/off-chain-registry/message_handler_test.go +++ b/messages/off-chain-registry/message_handler_test.go @@ -12,10 +12,10 @@ import ( "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/vms/platformvm/warp" "github.com/ava-labs/avalanchego/vms/platformvm/warp/payload" + teleporterregistry "github.com/ava-labs/icm-contracts/abi-bindings/go/teleporter/registry/TeleporterRegistry" "github.com/ava-labs/icm-services/relayer/config" mock_evm "github.com/ava-labs/icm-services/vms/evm/mocks" mock_vms "github.com/ava-labs/icm-services/vms/mocks" - teleporterregistry "github.com/ava-labs/teleporter/abi-bindings/go/teleporter/registry/TeleporterRegistry" "github.com/ethereum/go-ethereum/common" "github.com/pkg/errors" "github.com/stretchr/testify/require" diff --git a/messages/teleporter/message_handler.go b/messages/teleporter/message_handler.go index 036b53a2..befc720c 100644 --- a/messages/teleporter/message_handler.go +++ b/messages/teleporter/message_handler.go @@ -13,6 +13,9 @@ import ( "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/vms/platformvm/warp" warpPayload "github.com/ava-labs/avalanchego/vms/platformvm/warp/payload" + teleportermessenger "github.com/ava-labs/icm-contracts/abi-bindings/go/teleporter/TeleporterMessenger" + gasUtils "github.com/ava-labs/icm-contracts/utils/gas-utils" + teleporterUtils "github.com/ava-labs/icm-contracts/utils/teleporter-utils" "github.com/ava-labs/icm-services/messages" pbDecider "github.com/ava-labs/icm-services/proto/pb/decider" "github.com/ava-labs/icm-services/relayer/config" @@ -21,9 +24,6 @@ import ( "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" "github.com/ava-labs/subnet-evm/ethclient" - teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/teleporter/TeleporterMessenger" - gasUtils "github.com/ava-labs/teleporter/utils/gas-utils" - teleporterUtils "github.com/ava-labs/teleporter/utils/teleporter-utils" "github.com/ethereum/go-ethereum/common" "go.uber.org/zap" "google.golang.org/grpc" diff --git a/messages/teleporter/message_handler_test.go b/messages/teleporter/message_handler_test.go index 79ad30cd..370b5b89 100644 --- a/messages/teleporter/message_handler_test.go +++ b/messages/teleporter/message_handler_test.go @@ -11,13 +11,13 @@ import ( "github.com/ava-labs/avalanchego/utils/logging" "github.com/ava-labs/avalanchego/vms/platformvm/warp" warpPayload "github.com/ava-labs/avalanchego/vms/platformvm/warp/payload" + teleportermessenger "github.com/ava-labs/icm-contracts/abi-bindings/go/teleporter/TeleporterMessenger" + teleporterUtils "github.com/ava-labs/icm-contracts/utils/teleporter-utils" "github.com/ava-labs/icm-services/relayer/config" mock_evm "github.com/ava-labs/icm-services/vms/evm/mocks" mock_vms "github.com/ava-labs/icm-services/vms/mocks" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/interfaces" - teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/teleporter/TeleporterMessenger" - teleporterUtils "github.com/ava-labs/teleporter/utils/teleporter-utils" "github.com/ethereum/go-ethereum/common" "github.com/stretchr/testify/require" "go.uber.org/mock/gomock" diff --git a/relayer/README.md b/relayer/README.md index 8f5ef1ef..2075144b 100644 --- a/relayer/README.md +++ b/relayer/README.md @@ -423,7 +423,7 @@ The E2E tests use the `TeleporterMessenger` contract deployment transaction spec - `tests/utils/UniversalTeleporterDeployerAddress.txt` - `tests/utils/UniversalTeleporterDeployerTransaction.txt` - `tests/utils/UniversalTeleporterMessagerContractAddress.txt` - To update the version of Teleporter used by the E2E tests, update these values with the latest contract deployment information. For more information on how to deploy the Teleporter contract, see the [Teleporter documentation](https://github.com/ava-labs/teleporter/tree/main/utils/contract-deployment). + To update the version of Teleporter used by the E2E tests, update these values with the latest contract deployment information. For more information on how to deploy the Teleporter contract, see the [Teleporter documentation](https://github.com/ava-labs/icm-contracts/tree/main/utils/contract-deployment). ### Generate Mocks diff --git a/tests/allowed_addresses.go b/tests/allowed_addresses.go index 5bcb24c6..dafa0c11 100644 --- a/tests/allowed_addresses.go +++ b/tests/allowed_addresses.go @@ -8,13 +8,13 @@ import ( "time" "github.com/ava-labs/avalanchego/utils/logging" + "github.com/ava-labs/icm-contracts/tests/interfaces" + "github.com/ava-labs/icm-contracts/tests/network" + "github.com/ava-labs/icm-contracts/tests/utils" "github.com/ava-labs/icm-services/database" "github.com/ava-labs/icm-services/relayer/config" testUtils "github.com/ava-labs/icm-services/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" "github.com/ethereum/go-ethereum/log" diff --git a/tests/basic_relay.go b/tests/basic_relay.go index d7af16ac..4e82a53e 100644 --- a/tests/basic_relay.go +++ b/tests/basic_relay.go @@ -9,12 +9,12 @@ import ( "time" "github.com/ava-labs/avalanchego/utils/logging" + "github.com/ava-labs/icm-contracts/tests/interfaces" + "github.com/ava-labs/icm-contracts/tests/network" + "github.com/ava-labs/icm-contracts/tests/utils" "github.com/ava-labs/icm-services/database" testUtils "github.com/ava-labs/icm-services/tests/utils" "github.com/ava-labs/subnet-evm/core/types" - "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/crypto" "github.com/ethereum/go-ethereum/log" . "github.com/onsi/gomega" diff --git a/tests/batch_relay.go b/tests/batch_relay.go index 30223290..0157a0c9 100644 --- a/tests/batch_relay.go +++ b/tests/batch_relay.go @@ -8,12 +8,12 @@ import ( "time" "github.com/ava-labs/avalanchego/utils/set" + "github.com/ava-labs/icm-contracts/tests/interfaces" + "github.com/ava-labs/icm-contracts/tests/network" + "github.com/ava-labs/icm-contracts/tests/utils" testUtils "github.com/ava-labs/icm-services/tests/utils" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" - "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" "github.com/ethereum/go-ethereum/log" diff --git a/tests/e2e_test.go b/tests/e2e_test.go index 40fdb6c5..0180e281 100644 --- a/tests/e2e_test.go +++ b/tests/e2e_test.go @@ -16,10 +16,10 @@ import ( "time" "github.com/ava-labs/avalanchego/utils/units" + "github.com/ava-labs/icm-contracts/tests/network" + teleporterTestUtils "github.com/ava-labs/icm-contracts/tests/utils" testUtils "github.com/ava-labs/icm-services/tests/utils" "github.com/ava-labs/icm-services/utils" - "github.com/ava-labs/teleporter/tests/network" - teleporterTestUtils "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/log" "github.com/onsi/ginkgo/v2" diff --git a/tests/etna_upgrade.go b/tests/etna_upgrade.go index d9cb325a..9b88de26 100644 --- a/tests/etna_upgrade.go +++ b/tests/etna_upgrade.go @@ -7,10 +7,10 @@ import ( "context" "time" + "github.com/ava-labs/icm-contracts/tests/interfaces" + "github.com/ava-labs/icm-contracts/tests/network" + "github.com/ava-labs/icm-contracts/tests/utils" testUtils "github.com/ava-labs/icm-services/tests/utils" - "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/crypto" "github.com/ethereum/go-ethereum/log" . "github.com/onsi/gomega" diff --git a/tests/manual_message.go b/tests/manual_message.go index 111ee81b..7cc08e22 100644 --- a/tests/manual_message.go +++ b/tests/manual_message.go @@ -12,14 +12,14 @@ import ( "net/http" "time" + "github.com/ava-labs/icm-contracts/tests/interfaces" + "github.com/ava-labs/icm-contracts/tests/network" + "github.com/ava-labs/icm-contracts/tests/utils" + teleporterTestUtils "github.com/ava-labs/icm-contracts/tests/utils" offchainregistry "github.com/ava-labs/icm-services/messages/off-chain-registry" "github.com/ava-labs/icm-services/relayer/api" testUtils "github.com/ava-labs/icm-services/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" - teleporterTestUtils "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" diff --git a/tests/relay_message_api.go b/tests/relay_message_api.go index 81439276..1e92259f 100644 --- a/tests/relay_message_api.go +++ b/tests/relay_message_api.go @@ -14,15 +14,15 @@ import ( "github.com/ava-labs/avalanchego/ids" avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" + "github.com/ava-labs/icm-contracts/tests/interfaces" + "github.com/ava-labs/icm-contracts/tests/network" + "github.com/ava-labs/icm-contracts/tests/utils" + teleporterTestUtils "github.com/ava-labs/icm-contracts/tests/utils" "github.com/ava-labs/icm-services/relayer/api" testUtils "github.com/ava-labs/icm-services/tests/utils" "github.com/ava-labs/subnet-evm/core/types" subnetEvmInterfaces "github.com/ava-labs/subnet-evm/interfaces" "github.com/ava-labs/subnet-evm/precompile/contracts/warp" - "github.com/ava-labs/teleporter/tests/interfaces" - "github.com/ava-labs/teleporter/tests/network" - "github.com/ava-labs/teleporter/tests/utils" - teleporterTestUtils "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" diff --git a/tests/shared_db.go b/tests/shared_db.go index 8d5bc27f..45a8cfba 100644 --- a/tests/shared_db.go +++ b/tests/shared_db.go @@ -4,10 +4,10 @@ import ( "context" "sync" + "github.com/ava-labs/icm-contracts/tests/interfaces" + "github.com/ava-labs/icm-contracts/tests/network" + "github.com/ava-labs/icm-contracts/tests/utils" testUtils "github.com/ava-labs/icm-services/tests/utils" - "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/crypto" "github.com/ethereum/go-ethereum/log" . "github.com/onsi/gomega" diff --git a/tests/signature_aggregator_api.go b/tests/signature_aggregator_api.go index 0deecd55..0883fe3e 100644 --- a/tests/signature_aggregator_api.go +++ b/tests/signature_aggregator_api.go @@ -14,11 +14,11 @@ import ( "time" avalancheWarp "github.com/ava-labs/avalanchego/vms/platformvm/warp" + "github.com/ava-labs/icm-contracts/tests/interfaces" + "github.com/ava-labs/icm-contracts/tests/network" + "github.com/ava-labs/icm-contracts/tests/utils" "github.com/ava-labs/icm-services/signature-aggregator/api" testUtils "github.com/ava-labs/icm-services/tests/utils" - "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/log" . "github.com/onsi/gomega" ) diff --git a/tests/utils/utils.go b/tests/utils/utils.go index f05ce0cb..c37a8feb 100644 --- a/tests/utils/utils.go +++ b/tests/utils/utils.go @@ -19,6 +19,10 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/utils/logging" + teleportermessenger "github.com/ava-labs/icm-contracts/abi-bindings/go/teleporter/TeleporterMessenger" + "github.com/ava-labs/icm-contracts/tests/interfaces" + "github.com/ava-labs/icm-contracts/tests/utils" + teleporterTestUtils "github.com/ava-labs/icm-contracts/tests/utils" "github.com/ava-labs/icm-services/config" offchainregistry "github.com/ava-labs/icm-services/messages/off-chain-registry" relayercfg "github.com/ava-labs/icm-services/relayer/config" @@ -27,10 +31,6 @@ import ( relayerUtils "github.com/ava-labs/icm-services/utils" "github.com/ava-labs/subnet-evm/accounts/abi/bind" "github.com/ava-labs/subnet-evm/core/types" - teleportermessenger "github.com/ava-labs/teleporter/abi-bindings/go/teleporter/TeleporterMessenger" - "github.com/ava-labs/teleporter/tests/interfaces" - "github.com/ava-labs/teleporter/tests/utils" - teleporterTestUtils "github.com/ava-labs/teleporter/tests/utils" "github.com/ethereum/go-ethereum/common" "github.com/ethereum/go-ethereum/crypto" "github.com/ethereum/go-ethereum/log" @@ -111,8 +111,8 @@ func ReadHexTextFile(filename string) string { // Constructs a relayer config with all subnets as sources and destinations func CreateDefaultRelayerConfig( teleporter teleporterTestUtils.TeleporterTestInfo, - sourceSubnetsInfo []interfaces.SubnetTestInfo, - destinationSubnetsInfo []interfaces.SubnetTestInfo, + sourceL1sInfo []interfaces.L1TestInfo, + destinationL1sInfo []interfaces.L1TestInfo, fundedAddress common.Address, relayerKey *ecdsa.PrivateKey, ) relayercfg.Config { @@ -126,25 +126,25 @@ func CreateDefaultRelayerConfig( "logLevel", logLevel.LowerString(), ) // Construct the config values for each subnet - sources := make([]*relayercfg.SourceBlockchain, len(sourceSubnetsInfo)) - destinations := make([]*relayercfg.DestinationBlockchain, len(destinationSubnetsInfo)) - for i, subnetInfo := range sourceSubnetsInfo { - host, port, err := teleporterTestUtils.GetURIHostAndPort(subnetInfo.NodeURIs[0]) + sources := make([]*relayercfg.SourceBlockchain, len(sourceL1sInfo)) + destinations := make([]*relayercfg.DestinationBlockchain, len(destinationL1sInfo)) + for i, l1Info := range sourceL1sInfo { + host, port, err := teleporterTestUtils.GetURIHostAndPort(l1Info.NodeURIs[0]) Expect(err).Should(BeNil()) sources[i] = &relayercfg.SourceBlockchain{ - SubnetID: subnetInfo.SubnetID.String(), - BlockchainID: subnetInfo.BlockchainID.String(), + SubnetID: l1Info.L1ID.String(), + BlockchainID: l1Info.BlockchainID.String(), VM: relayercfg.EVM.String(), RPCEndpoint: config.APIConfig{ - BaseURL: fmt.Sprintf("http://%s:%d/ext/bc/%s/rpc", host, port, subnetInfo.BlockchainID.String()), + BaseURL: fmt.Sprintf("http://%s:%d/ext/bc/%s/rpc", host, port, l1Info.BlockchainID.String()), }, WSEndpoint: config.APIConfig{ - BaseURL: fmt.Sprintf("ws://%s:%d/ext/bc/%s/ws", host, port, subnetInfo.BlockchainID.String()), + BaseURL: fmt.Sprintf("ws://%s:%d/ext/bc/%s/ws", host, port, l1Info.BlockchainID.String()), }, MessageContracts: map[string]relayercfg.MessageProtocolConfig{ - teleporter.TeleporterMessengerAddress(subnetInfo).Hex(): { + teleporter.TeleporterMessengerAddress(l1Info).Hex(): { MessageFormat: relayercfg.TELEPORTER.String(), Settings: map[string]interface{}{ "reward-address": fundedAddress.Hex(), @@ -153,7 +153,7 @@ func CreateDefaultRelayerConfig( offchainregistry.OffChainRegistrySourceAddress.Hex(): { MessageFormat: relayercfg.OFF_CHAIN_REGISTRY.String(), Settings: map[string]interface{}{ - "teleporter-registry-address": teleporter.TeleporterRegistryAddress(subnetInfo).Hex(), + "teleporter-registry-address": teleporter.TeleporterRegistryAddress(l1Info).Hex(), }, }, }, @@ -161,31 +161,31 @@ func CreateDefaultRelayerConfig( log.Info( "Creating relayer config for source subnet", - "subnetID", subnetInfo.SubnetID.String(), - "blockchainID", subnetInfo.BlockchainID.String(), + "subnetID", l1Info.L1ID.String(), + "blockchainID", l1Info.BlockchainID.String(), "host", host, "port", port, ) } - for i, subnetInfo := range destinationSubnetsInfo { - host, port, err := teleporterTestUtils.GetURIHostAndPort(subnetInfo.NodeURIs[0]) + for i, l1Info := range destinationL1sInfo { + host, port, err := teleporterTestUtils.GetURIHostAndPort(l1Info.NodeURIs[0]) Expect(err).Should(BeNil()) destinations[i] = &relayercfg.DestinationBlockchain{ - SubnetID: subnetInfo.SubnetID.String(), - BlockchainID: subnetInfo.BlockchainID.String(), + SubnetID: l1Info.L1ID.String(), + BlockchainID: l1Info.BlockchainID.String(), VM: relayercfg.EVM.String(), RPCEndpoint: config.APIConfig{ - BaseURL: fmt.Sprintf("http://%s:%d/ext/bc/%s/rpc", host, port, subnetInfo.BlockchainID.String()), + BaseURL: fmt.Sprintf("http://%s:%d/ext/bc/%s/rpc", host, port, l1Info.BlockchainID.String()), }, AccountPrivateKey: relayerUtils.PrivateKeyToString(relayerKey), } log.Info( "Creating relayer config for destination subnet", - "subnetID", subnetInfo.SubnetID.String(), - "blockchainID", subnetInfo.BlockchainID.String(), + "subnetID", l1Info.L1ID.String(), + "blockchainID", l1Info.BlockchainID.String(), "host", host, "port", port, ) @@ -194,10 +194,10 @@ func CreateDefaultRelayerConfig( return relayercfg.Config{ LogLevel: logLevel.LowerString(), PChainAPI: &config.APIConfig{ - BaseURL: sourceSubnetsInfo[0].NodeURIs[0], + BaseURL: sourceL1sInfo[0].NodeURIs[0], }, InfoAPI: &config.APIConfig{ - BaseURL: sourceSubnetsInfo[0].NodeURIs[0], + BaseURL: sourceL1sInfo[0].NodeURIs[0], }, StorageLocation: StorageLocation, DBWriteIntervalSeconds: DBUpdateSeconds, @@ -215,7 +215,7 @@ func CreateDefaultRelayerConfig( // callers use the defaults defined in the config package via viper, so that // there aren't two sets of "defaults". func CreateDefaultSignatureAggregatorConfig( - sourceSubnetsInfo []interfaces.SubnetTestInfo, + sourceL1Info []interfaces.L1TestInfo, ) signatureaggregatorcfg.Config { logLevel, err := logging.ToLevel(os.Getenv("LOG_LEVEL")) if err != nil { @@ -230,10 +230,10 @@ func CreateDefaultSignatureAggregatorConfig( return signatureaggregatorcfg.Config{ LogLevel: logLevel.LowerString(), PChainAPI: &config.APIConfig{ - BaseURL: sourceSubnetsInfo[0].NodeURIs[0], + BaseURL: sourceL1Info[0].NodeURIs[0], }, InfoAPI: &config.APIConfig{ - BaseURL: sourceSubnetsInfo[0].NodeURIs[0], + BaseURL: sourceL1Info[0].NodeURIs[0], }, APIPort: 8080, MetricsPort: 8081, @@ -247,7 +247,7 @@ func ClearRelayerStorage() error { func FundRelayers( ctx context.Context, - subnetsInfo []interfaces.SubnetTestInfo, + subnetsInfo []interfaces.L1TestInfo, fundedKey *ecdsa.PrivateKey, relayerKey *ecdsa.PrivateKey, ) { @@ -265,8 +265,8 @@ func FundRelayers( func SendBasicTeleporterMessageAsync( ctx context.Context, teleporter teleporterTestUtils.TeleporterTestInfo, - source interfaces.SubnetTestInfo, - destination interfaces.SubnetTestInfo, + source interfaces.L1TestInfo, + destination interfaces.L1TestInfo, fundedKey *ecdsa.PrivateKey, destinationAddress common.Address, ids chan<- ids.ID, @@ -303,8 +303,8 @@ func SendBasicTeleporterMessageAsync( func SendBasicTeleporterMessage( ctx context.Context, teleporter teleporterTestUtils.TeleporterTestInfo, - source interfaces.SubnetTestInfo, - destination interfaces.SubnetTestInfo, + source interfaces.L1TestInfo, + destination interfaces.L1TestInfo, fundedKey *ecdsa.PrivateKey, destinationAddress common.Address, ) (*types.Receipt, teleportermessenger.TeleporterMessage, ids.ID) { @@ -346,8 +346,8 @@ func SendBasicTeleporterMessage( func RelayBasicMessage( ctx context.Context, teleporter teleporterTestUtils.TeleporterTestInfo, - source interfaces.SubnetTestInfo, - destination interfaces.SubnetTestInfo, + source interfaces.L1TestInfo, + destination interfaces.L1TestInfo, fundedKey *ecdsa.PrivateKey, destinationAddress common.Address, ) { @@ -437,8 +437,8 @@ func WriteSignatureAggregatorConfig(signatureAggregatorConfig signatureaggregato func TriggerProcessMissedBlocks( ctx context.Context, teleporter teleporterTestUtils.TeleporterTestInfo, - sourceSubnetInfo interfaces.SubnetTestInfo, - destinationSubnetInfo interfaces.SubnetTestInfo, + sourceL1Info interfaces.L1TestInfo, + destinationSubnetInfo interfaces.L1TestInfo, currRelayerCleanup context.CancelFunc, currentRelayerConfig relayercfg.Config, fundedAddress common.Address, @@ -458,7 +458,7 @@ func TriggerProcessMissedBlocks( _, _, id1 := SendBasicTeleporterMessage( ctx, teleporter, - sourceSubnetInfo, + sourceL1Info, destinationSubnetInfo, fundedKey, fundedAddress, @@ -466,7 +466,7 @@ func TriggerProcessMissedBlocks( _, _, id2 := SendBasicTeleporterMessage( ctx, teleporter, - sourceSubnetInfo, + sourceL1Info, destinationSubnetInfo, fundedKey, fundedAddress, @@ -474,13 +474,13 @@ func TriggerProcessMissedBlocks( _, _, id3 := SendBasicTeleporterMessage( ctx, teleporter, - sourceSubnetInfo, + sourceL1Info, destinationSubnetInfo, fundedKey, fundedAddress, ) - currHeight, err := sourceSubnetInfo.RPCClient.BlockNumber(ctx) + currHeight, err := sourceL1Info.RPCClient.BlockNumber(ctx) Expect(err).Should(BeNil()) log.Info("Current block height", "height", currHeight) @@ -535,21 +535,21 @@ func DeployBatchCrossChainMessenger( senderKey *ecdsa.PrivateKey, teleporter teleporterTestUtils.TeleporterTestInfo, teleporterManager common.Address, - subnet interfaces.SubnetTestInfo, + l1 interfaces.L1TestInfo, ) (common.Address, *batchcrosschainmessenger.BatchCrossChainMessenger) { opts, err := bind.NewKeyedTransactorWithChainID( - senderKey, subnet.EVMChainID) + senderKey, l1.EVMChainID) Expect(err).Should(BeNil()) address, tx, exampleMessenger, err := batchcrosschainmessenger.DeployBatchCrossChainMessenger( opts, - subnet.RPCClient, - teleporter.TeleporterRegistryAddress(subnet), + l1.RPCClient, + teleporter.TeleporterRegistryAddress(l1), teleporterManager, ) Expect(err).Should(BeNil()) // Wait for the transaction to be mined - utils.WaitForTransactionSuccess(ctx, subnet, tx.Hash()) + utils.WaitForTransactionSuccess(ctx, l1, tx.Hash()) return address, exampleMessenger } diff --git a/tests/warp_api.go b/tests/warp_api.go index 8996d2f8..79aa5f23 100644 --- a/tests/warp_api.go +++ b/tests/warp_api.go @@ -13,10 +13,10 @@ import ( "strings" "time" + "github.com/ava-labs/icm-contracts/tests/interfaces" + "github.com/ava-labs/icm-contracts/tests/network" + "github.com/ava-labs/icm-contracts/tests/utils" testUtils "github.com/ava-labs/icm-services/tests/utils" - "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/crypto" "github.com/ethereum/go-ethereum/log" . "github.com/onsi/gomega" From 6985275e30b68dafa655b958e3707755c610a822 Mon Sep 17 00:00:00 2001 From: Ian Suvak Date: Mon, 9 Dec 2024 14:40:28 -0500 Subject: [PATCH 2/2] more renames --- tests/allowed_addresses.go | 90 +++++++++++++++---------------- tests/basic_relay.go | 32 +++++------ tests/batch_relay.go | 22 ++++---- tests/contracts/lib/teleporter | 2 +- tests/e2e_test.go | 8 +-- tests/etna_upgrade.go | 18 +++---- tests/manual_message.go | 20 +++---- tests/relay_message_api.go | 24 ++++----- tests/shared_db.go | 32 +++++------ tests/signature_aggregator_api.go | 18 +++---- tests/warp_api.go | 18 +++---- 11 files changed, 142 insertions(+), 142 deletions(-) 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, )