Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

E2E tests #26

Merged
merged 64 commits into from
Sep 25, 2023
Merged
Show file tree
Hide file tree
Changes from 27 commits
Commits
Show all changes
64 commits
Select commit Hold shift + click to select a range
c8830c1
initial setup for e2e tests
Aug 31, 2023
3c6985b
adding e2e test to ci
Aug 31, 2023
84e7685
rename workflows and fixing ginkgo version to v2
Aug 31, 2023
ed613b1
fix ginkgo version and add e2e test
Aug 31, 2023
a05f114
add relayer config and write to file
Aug 31, 2023
9ae7286
build command and add RUN_E2E env var
Aug 31, 2023
e34680d
test ginkgo tests logs
Aug 31, 2023
09cb5d0
testing why ginkgo tests aren't running
Aug 31, 2023
1bda5f1
tests should fail if ran properly
Aug 31, 2023
da41994
add debug logs
Aug 31, 2023
6c2a1b4
build and run relayer
Aug 31, 2023
f2c2270
fix config file option
Aug 31, 2023
5f64426
fix logging info default
Aug 31, 2023
a84cb32
sending teleporter message from a to b
Aug 31, 2023
3994285
extra debug logs and get chainB nonce
Aug 31, 2023
50e2d5e
replacing default chainID
Sep 1, 2023
f15e704
fix eth client declarations
Sep 1, 2023
dd9d68c
fix for relayer config chain ID, need to figure out relayer logs in p…
Sep 1, 2023
dffd4dd
relays to destination chain but block has no warp message log
Sep 1, 2023
8ec2183
draft working e2e test
Sep 1, 2023
00cf1be
clean up logs and commented test code
Sep 1, 2023
630df61
fixing blockchainB overwrite and clean up scripts
Sep 1, 2023
56739c5
copyrights and clean up workflow
Sep 1, 2023
f656328
Merge remote-tracking branch 'origin/main' into e2e-tests
Sep 5, 2023
c81ce8c
use separate teleporter key for teleporter contract address
Sep 5, 2023
30871f0
pr cleanups and removing hardcoded teleporter string
Sep 5, 2023
cc775c2
readme update with testing
Sep 5, 2023
14057b7
moves tests under tests directory and cleaning up for pr
Sep 6, 2023
48bd712
add constant and check that warp genesis file exists
Sep 6, 2023
401c80d
fix go version in workflow
Sep 6, 2023
894a920
clean up variable declaration and testing
Sep 7, 2023
9fa062b
remove incorrect check since signed tx has type prefixed
Sep 7, 2023
f880c9b
cleanup readme
cam-schultz Sep 13, 2023
33328e7
e2e test cleanup
cam-schultz Sep 13, 2023
ddcdac3
Merge branch 'main' into e2e-tests
cam-schultz Sep 13, 2023
9c142dd
fix unit test job
cam-schultz Sep 13, 2023
02e234b
fix unit test job again
cam-schultz Sep 13, 2023
1d55aa5
Merge branch 'e2e-tests' into check-message-already-delivered-e2e
cam-schultz Sep 14, 2023
292cf9c
Merge branch 'check-message-already-delivered' into check-message-alr…
cam-schultz Sep 14, 2023
bfaf9e3
check message already delivered e2e
cam-schultz Sep 14, 2023
79b3252
set storage location in e2e test
cam-schultz Sep 14, 2023
b43e68c
wip
cam-schultz Sep 14, 2023
15955c4
e2e tests deploy teleporter
cam-schultz Sep 15, 2023
93020e5
e2e test already delivered message
cam-schultz Sep 15, 2023
f467aae
Merge branch 'main' into check-message-already-delivered-e2e
cam-schultz Sep 15, 2023
78334c4
Merge branch 'main' into e2e-tests
cam-schultz Sep 15, 2023
e232da3
Merge branch 'check-message-already-delivered-e2e' into e2e-tests
cam-schultz Sep 15, 2023
e05ecc4
linter
cam-schultz Sep 15, 2023
b81ae8c
remove commented out code
cam-schultz Sep 19, 2023
f8cbae6
rename SanitizeHexString
cam-schultz Sep 19, 2023
7a9985a
dot import gomega
cam-schultz Sep 19, 2023
f116ba2
rename PackSendCrossChainMessageEvent
cam-schultz Sep 20, 2023
0cca94a
export UnpackMessageReceivedResult
cam-schultz Sep 20, 2023
f30e222
export all Teleporter packing functions
cam-schultz Sep 20, 2023
34fb897
build fix
cam-schultz Sep 20, 2023
b857102
build fix
cam-schultz Sep 20, 2023
26addbd
clean up testing jobs
cam-schultz Sep 20, 2023
051e482
rename unit test job
cam-schultz Sep 20, 2023
80ab005
move subnet uri and teleporter deploy to BeforeSuite
cam-schultz Sep 20, 2023
cf97a39
unify pack and unpacks, and add docs
Sep 20, 2023
53f3833
explicit warning comment
cam-schultz Sep 21, 2023
a4d2cf5
Merge branch 'main' into e2e-tests
cam-schultz Sep 25, 2023
40be845
capitalize versions.sh
cam-schultz Sep 25, 2023
f6b04e3
fix var
cam-schultz Sep 25, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
84 changes: 56 additions & 28 deletions .github/workflows/test.yml
minghinmatthewlam marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -1,36 +1,64 @@
# Copyright (C) 2023, Ava Labs, Inc. All rights reserved.
# See the file LICENSE for licensing terms.

name: Run Relayer Unit Tests
name: Relayer Tests

on:
push:
branches:
- '*'
push:
cam-schultz marked this conversation as resolved.
Show resolved Hide resolved
branches:
- "*"
minghinmatthewlam marked this conversation as resolved.
Show resolved Hide resolved

jobs:
build-test-relayer:
runs-on: ubuntu-20.04

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
path: awm-relayer

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: '1.20.7'

- name: Build Relayer
run: |
cd awm-relayer
go mod tidy
./scripts/build.sh

- name: Run Relayer Unit Tests
run: |
cd awm-relayer
./scripts/test.sh
build-test-relayer:
name: Build + Unit tests
runs-on: ubuntu-20.04

steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
path: awm-relayer

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.20.7"

- name: Build Relayer
run: |
cd awm-relayer
go mod tidy
./scripts/build.sh

- name: Run Relayer Unit Tests
run: |
cd awm-relayer
./scripts/test.sh

e2e_tests:
runs-on: ubuntu-20.04
name: e2e_tests

steps:
- name: Checkout subnet-evm repository
uses: actions/checkout@v3
minghinmatthewlam marked this conversation as resolved.
Show resolved Hide resolved
with:
repository: ava-labs/subnet-evm
ref: v0.5.4

- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: "1.20.7"
minghinmatthewlam marked this conversation as resolved.
Show resolved Hide resolved

- name: Install AvalancheGo Release
run: BASEDIR=/tmp/e2e-test AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/install_avalanchego_release.sh

- name: Build Subnet-EVM Plugin Binary
run: ./scripts/build.sh /tmp/e2e-test/avalanchego/plugins/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy

- name: Checkout awm-relayer repository
uses: actions/checkout@v3

- name: Run E2E Tests
run: AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego DATA_DIR=/tmp/e2e-test/data ./scripts/e2e_test.sh
7 changes: 6 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
build/
__debug_bin

.vscode*
.vscode*

# Ginkgo test outputs
main.log
server.log
*.test
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,3 +37,31 @@ The relayer consists of the following components:
<div align="center">
<img src="resources/relayer-diagram.png?raw=true">
</div>

## Testing

---

### Unit tests

Unit tests can be ran locally by running the command in root of the project:

```
go test ./...
minghinmatthewlam marked this conversation as resolved.
Show resolved Hide resolved
minghinmatthewlam marked this conversation as resolved.
Show resolved Hide resolved
```

### E2E tests
cam-schultz marked this conversation as resolved.
Show resolved Hide resolved

E2E tests are ran as part of CI, but can also be ran locally. To run the E2E tests locally, you need to have the `avalanchego` build path and vm binary set up. For example with [subnet-evm](https://github.com/ava-labs/subnet-evm):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe leave an additional note here on how to pick compatible versions of avalanchego and subnet-evm - probably by looking in go.mod.

cam-schultz marked this conversation as resolved.
Show resolved Hide resolved

```
cd <SUBNET_EVM_PATH>
minghinmatthewlam marked this conversation as resolved.
Show resolved Hide resolved
BASEDIR=/tmp/e2e-test AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego ./scripts/install_avalanchego_release.sh
./scripts/build.sh /tmp/e2e-test/avalanchego/plugins/srEXiWaHuhNyGwPUi444Tu47ZEDwxTWrbQiuD7FmgSAQ6X7Dy
geoff-vball marked this conversation as resolved.
Show resolved Hide resolved
```

Then, in the root of the `awm-relayer` project, run:

```
AVALANCHEGO_BUILD_PATH=/tmp/e2e-test/avalanchego DATA_DIR=/tmp/e2e-test/data ./scripts/e2e_test.sh
```
3 changes: 2 additions & 1 deletion config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

"github.com/ava-labs/avalanchego/ids"
"github.com/ava-labs/avalanchego/utils/constants"
"github.com/ava-labs/avalanchego/utils/logging"
"github.com/ava-labs/avalanchego/utils/set"
"github.com/ava-labs/awm-relayer/utils"
"github.com/ethereum/go-ethereum/common"
Expand Down Expand Up @@ -67,7 +68,7 @@ type Config struct {
}

func SetDefaultConfigValues(v *viper.Viper) {
v.SetDefault(LogLevelKey, "info")
v.SetDefault(LogLevelKey, logging.Info.String())
v.SetDefault(NetworkIDKey, constants.MainnetID)
v.SetDefault(PChainAPIURLKey, "https://api.avax.network")
v.SetDefault(EncryptConnectionKey, true)
Expand Down
2 changes: 1 addition & 1 deletion config/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ var (
EncryptConnection: false,
MessageContracts: map[string]MessageProtocolConfig{
testAddress: {
MessageFormat: "teleporter",
MessageFormat: TELEPORTER.String(),
},
},
},
Expand Down
46 changes: 38 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,71 @@ module github.com/ava-labs/awm-relayer
go 1.18

require (
github.com/ava-labs/avalanche-network-runner v1.7.2-0.20230825150237-723bc7b31724
github.com/ava-labs/avalanchego v1.10.9
github.com/ava-labs/subnet-evm v0.5.4
github.com/ethereum/go-ethereum v1.12.0
github.com/golang/mock v1.6.0
github.com/onsi/ginkgo/v2 v2.12.0
github.com/onsi/gomega v1.27.10
github.com/prometheus/client_golang v1.16.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
go.uber.org/mock v0.2.0
go.uber.org/zap v1.25.0
)

require (
github.com/Microsoft/go-winio v0.5.2 // indirect
github.com/ava-labs/coreth v0.12.5-rc.3 // indirect
github.com/cockroachdb/errors v1.9.1 // indirect
github.com/cockroachdb/logtags v0.0.0-20230118201751-21c54148d20b // indirect
github.com/cockroachdb/pebble v0.0.0-20230209160836-829675f94811 // indirect
github.com/cockroachdb/redact v1.1.3 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.2 // indirect
github.com/deckarep/golang-set/v2 v2.1.0 // indirect
github.com/dlclark/regexp2 v1.7.0 // indirect
github.com/dop251/goja v0.0.0-20230605162241-28ee0ee714f3 // indirect
github.com/fjl/memsize v0.0.0-20190710130421-bcb5799ab5e5 // indirect
github.com/fsnotify/fsnotify v1.6.0 // indirect
github.com/getsentry/sentry-go v0.18.0 // indirect
github.com/go-cmd/cmd v1.4.1 // indirect
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.3.0 // indirect
github.com/google/go-cmp v0.5.9 // indirect
github.com/google/pprof v0.0.0-20230207041349-798e818bf904 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect
github.com/hashicorp/go-bexpr v0.1.10 // indirect
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/huin/goupnp v1.0.3 // indirect
github.com/jackpal/gateway v1.0.6 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
github.com/klauspost/compress v1.15.15 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/magiconair/properties v1.8.7 // indirect
github.com/mattn/go-colorable v0.1.13 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mitchellh/mapstructure v1.5.0 // indirect
github.com/mitchellh/pointerstructure v1.2.0 // indirect
github.com/otiai10/copy v1.11.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/rogpeppe/go-internal v1.9.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/spf13/afero v1.9.5 // indirect
github.com/spf13/cast v1.5.1 // indirect
github.com/spf13/jwalterweatherman v1.1.0 // indirect
github.com/subosito/gotenv v1.4.2 // indirect
go.uber.org/mock v0.2.0 // indirect
github.com/urfave/cli/v2 v2.17.2-0.20221006022127-8f469abc00aa // indirect
github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect
golang.org/x/exp v0.0.0-20230206171751-46f607a40771 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/tools v0.12.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
)

Expand All @@ -54,7 +84,7 @@ require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-stack/stack v1.8.1 // indirect
Expand Down Expand Up @@ -97,12 +127,12 @@ require (
go.opentelemetry.io/otel/trace v1.11.0 // indirect
go.opentelemetry.io/proto/otlp v0.19.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/crypto v0.9.0 // indirect
golang.org/x/net v0.10.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/net v0.14.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sys v0.9.0 // indirect
golang.org/x/term v0.8.0 // indirect
golang.org/x/text v0.9.0 // indirect
golang.org/x/sys v0.11.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/time v0.3.0 // indirect
gonum.org/v1/gonum v0.11.0 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
Expand Down
Loading