From 23046984b3a44174081ddcc1e4eee217c0e01ebb Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 12 Jun 2023 16:57:11 +0200 Subject: [PATCH 01/14] use knuu for PoC e2e test --- go.mod | 35 +++- go.sum | 79 +++++++-- test/e2e/Makefile | 9 - test/e2e/README.md | 43 ----- test/e2e/cmd/e2e/main.go | 124 ------------- test/e2e/networks/simple.toml | 13 -- test/e2e/node.go | 229 ++++++++++++++++++++++++ test/e2e/pkg/exec.go | 33 ---- test/e2e/pkg/lifecycle.go | 106 ------------ test/e2e/pkg/manifest.go | 70 -------- test/e2e/pkg/rpc.go | 129 -------------- test/e2e/pkg/testnet.go | 316 ---------------------------------- test/e2e/{pkg => }/setup.go | 214 ++--------------------- test/e2e/simple_test.go | 35 ++++ test/e2e/testnet.go | 135 +++++++++++++++ test/e2e/util.go | 37 ++++ 16 files changed, 553 insertions(+), 1054 deletions(-) delete mode 100644 test/e2e/Makefile delete mode 100644 test/e2e/README.md delete mode 100644 test/e2e/cmd/e2e/main.go delete mode 100644 test/e2e/networks/simple.toml create mode 100644 test/e2e/node.go delete mode 100644 test/e2e/pkg/exec.go delete mode 100644 test/e2e/pkg/lifecycle.go delete mode 100644 test/e2e/pkg/manifest.go delete mode 100644 test/e2e/pkg/rpc.go delete mode 100644 test/e2e/pkg/testnet.go rename test/e2e/{pkg => }/setup.go (50%) create mode 100644 test/e2e/simple_test.go create mode 100644 test/e2e/testnet.go create mode 100644 test/e2e/util.go diff --git a/go.mod b/go.mod index 7e6f24acc2..2fa438cf11 100644 --- a/go.mod +++ b/go.mod @@ -39,15 +39,40 @@ require ( ) require ( - github.com/Microsoft/go-winio v0.6.0 // indirect - github.com/docker/distribution v2.8.1+incompatible // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/docker/distribution v2.8.2+incompatible // indirect github.com/docker/go-connections v0.4.0 // indirect github.com/docker/go-units v0.5.0 // indirect + github.com/emicklei/go-restful/v3 v3.9.0 // indirect + github.com/go-logr/logr v1.2.3 // indirect + github.com/go-openapi/jsonpointer v0.19.6 // indirect + github.com/go-openapi/jsonreference v0.20.1 // indirect + github.com/go-openapi/swag v0.22.3 // indirect + github.com/google/gnostic v0.5.7-v3refs // indirect + github.com/google/gofuzz v1.2.0 // indirect + github.com/imdario/mergo v0.3.13 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/moby/spdystream v0.2.0 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.2 // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect + github.com/sirupsen/logrus v1.9.2 // indirect golang.org/x/mod v0.9.0 // indirect + golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect golang.org/x/tools v0.7.0 // indirect - gotest.tools/v3 v3.4.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + k8s.io/api v0.27.2 // indirect + k8s.io/apimachinery v0.27.2 // indirect + k8s.io/client-go v0.27.2 // indirect + k8s.io/klog/v2 v2.90.1 // indirect + k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect + k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect + sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect + sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect ) require ( @@ -59,7 +84,6 @@ require ( filippo.io/edwards25519 v1.0.0-rc.1 // indirect github.com/99designs/go-keychain v0.0.0-20191008050251-8e49817e8af4 // indirect github.com/99designs/keyring v1.2.1 // indirect - github.com/BurntSushi/toml v1.3.0 github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect github.com/StackExchange/wmi v1.2.1 // indirect github.com/Workiva/go-datastructures v1.0.53 // indirect @@ -69,6 +93,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect + github.com/celestiaorg/knuu v0.6.0 github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect @@ -93,7 +118,7 @@ require ( github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.0 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/docker/docker v24.0.2+incompatible + github.com/docker/docker v24.0.2+incompatible // indirect github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect diff --git a/go.sum b/go.sum index 7ff6bcedf2..6a0895a96f 100644 --- a/go.sum +++ b/go.sum @@ -68,8 +68,6 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSu github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -github.com/BurntSushi/toml v1.3.0 h1:Ws8e5YmnrGEHzZEzg0YvK/7COGYtTC5PbaH9oSSbgfA= -github.com/BurntSushi/toml v1.3.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg= github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4= @@ -78,8 +76,8 @@ github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3 github.com/DataDog/zstd v1.5.0/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw= github.com/DataDog/zstd v1.5.2 h1:vUG4lAyuPCXO0TLbXvPv7EB7cNK1QV/luu55UHLrrn8= github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0= -github.com/Microsoft/go-winio v0.6.0 h1:slsWYD/zyx7lCXoZVlvQrj0hPTM1HI4+v1sIda2yDvg= -github.com/Microsoft/go-winio v0.6.0/go.mod h1:cTAf44im0RAYeL23bpB+fzCyDH2MJiz2BO69KH/soAE= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 h1:TngWCqHvy9oXAN6lEVMRuU21PR1EtLVZJmdB18Gu3Rw= github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE= github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU= @@ -116,6 +114,7 @@ github.com/armon/go-metrics v0.0.0-20180917152333-f0300d1749da/go.mod h1:Q73ZrmV github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA= github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4= github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6lCRdSC2Tm3DSWRPvIPr6xNKyeHdqDQSQT+A= github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU= github.com/aws/aws-sdk-go v1.15.78/go.mod h1:E3/ieXAlvM0XWO57iftYVDLLvQ824smPP3ATZkfNZeM= @@ -173,6 +172,8 @@ github.com/celestiaorg/celestia-core v1.21.2-tm-v0.34.27 h1:nmr9O5BflgNR1aWehs1Z github.com/celestiaorg/celestia-core v1.21.2-tm-v0.34.27/go.mod h1:GVo91Wifg9KL/nFx9nPkpl0UIFdvvs4fhnly9GhGxZU= github.com/celestiaorg/cosmos-sdk v1.14.0-sdk-v0.46.11 h1:xDLC0ZvIwj9S2gTs9b8EespilL/u/vOGcqJuHz1r/eA= github.com/celestiaorg/cosmos-sdk v1.14.0-sdk-v0.46.11/go.mod h1:IwvD2nN3vEMkjxhTw/SF5tyJ0+x3GB0EdyQJyteK06U= +github.com/celestiaorg/knuu v0.6.0 h1:g+RDNGvWoKd0GMxna1b38cdiXreBdTf79saaq15bpRU= +github.com/celestiaorg/knuu v0.6.0/go.mod h1:CYayB+f3iGVpcBqR9xM0hrnjQpIm/Q+FD020TMRGETk= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA= github.com/celestiaorg/nmt v0.16.0 h1:4CX6d1Uwf1C+tGcAWskPve0HCDTnI4Ey8ffjiDwcGH0= @@ -297,8 +298,8 @@ github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8 github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= -github.com/docker/distribution v2.8.1+incompatible h1:Q50tZOPR6T/hjNsyc9g8/syEs6bk8XXApsHjKukMl68= -github.com/docker/distribution v2.8.1+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= +github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= +github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= @@ -306,6 +307,7 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= +github.com/docopt/docopt-go v0.0.0-20180111231733-ee0de3bc6815/go.mod h1:WwZ+bS3ebgob9U8Nd0kOddGdZWjyMGR8Wziv+TBNwSE= github.com/dop251/goja v0.0.0-20211011172007-d99e4b8cbf48/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= github.com/dustin/go-humanize v0.0.0-20171111073723-bb3d318650d4/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= @@ -319,6 +321,8 @@ github.com/eapache/go-xerial-snappy v0.0.0-20180814174437-776d5712da21/go.mod h1 github.com/eapache/queue v1.1.0/go.mod h1:6eCeP0CKFpHLu8blIFXhExK/dRa7WDZfr6jVFPTqq+I= github.com/eclipse/paho.mqtt.golang v1.2.0/go.mod h1:H9keYFcgq3Qr5OUJm/JZI/i6U7joQ8SYLhZwfeOo6Ts= github.com/edsrzf/mmap-go v1.0.0/go.mod h1:YO35OhQPt3KJa3ryjFM5Bs14WD66h8eGKpfaBNrHW5M= +github.com/emicklei/go-restful/v3 v3.9.0 h1:XwGDlfxEnQZzuopoqxwSEllNcCOM9DhhFyhFIIGKwxE= +github.com/emicklei/go-restful/v3 v3.9.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/envoyproxy/go-control-plane v0.6.9/go.mod h1:SBwIajubJHhxtWwsL9s8ss4safvEdbitLhGGK48rN6g= github.com/envoyproxy/go-control-plane v0.9.0/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= github.com/envoyproxy/go-control-plane v0.9.1-0.20191026205805-5f8ba28d4473/go.mod h1:YTl/9mNaCwkRvm6d1a2C3ymFceY/DCBVvsKhRF0iEA4= @@ -375,12 +379,21 @@ github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A= github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA= github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-logr/logr v1.2.0/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.2.3 h1:2DntVwHkVopvECVRSlL5PSo9eG+cAkDCuckLubN+rq0= +github.com/go-logr/logr v1.2.3/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= github.com/go-ole/go-ole v1.2.1/go.mod h1:7FAglXiTm7HKlQRDeOQ6ZNUHidzCWXuZWq/1dTyBNF8= github.com/go-ole/go-ole v1.2.5/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY= github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0= github.com/go-openapi/jsonpointer v0.19.5/go.mod h1:Pl9vOtqEWErmShwVjC8pYs9cog34VGT37dQOVbmoatg= +github.com/go-openapi/jsonpointer v0.19.6 h1:eCs3fxoIi3Wh6vtgmLTOjdhSpiqphQ+DaPn38N2ZdrE= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonreference v0.20.1 h1:FBLnyygC4/IZZr893oiomc9XaghoveYTrLC1F86HID8= +github.com/go-openapi/jsonreference v0.20.1/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh66Z9tfKk= +github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-playground/assert/v2 v2.0.1/go.mod h1:VDjEfimB/XKnb+ZQfWdccd7VUvScMdVu0Titje2rxJ4= github.com/go-playground/locales v0.13.0 h1:HyWk6mgj5qFqCT5fjGBuRArbVDfE4hi8+e8ceBS/t7Q= github.com/go-playground/locales v0.13.0/go.mod h1:taPMhCMXrRLJO55olJkUXHZBHCxTMfnGwq/HNwmWNS8= @@ -395,6 +408,7 @@ github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= +github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= @@ -447,6 +461,7 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -460,6 +475,8 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/btree v1.1.2 h1:xf4v41cLI2Z6FxbKm+8Bu+m8ifhj15JuZ9sa0jZCMUU= github.com/google/btree v1.1.2/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= github.com/google/flatbuffers v1.11.0/go.mod h1:1AeVuKshWv4vARoZatz6mlQ0JxURH0Kv5+zNeJKJCa8= +github.com/google/gnostic v0.5.7-v3refs h1:FhTMOKj2VhjpouxvWJAV1TL304uMlb9zcDqkl6cEI54= +github.com/google/gnostic v0.5.7-v3refs/go.mod h1:73MKFl6jIHelAJNaBGFzt3SPtZULs9dYrGFt8OiIsHQ= github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -477,6 +494,7 @@ github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSN github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/martian v2.1.0+incompatible h1:/CP5g8u/VJHijgedC/Legn3BAbAaWPgecwXBIDzw5no= github.com/google/martian v2.1.0+incompatible/go.mod h1:9I4somxYTbIHy5NJKHRl3wXiIaQGbYVAs8BPL6v8lEs= github.com/google/martian/v3 v3.0.0/go.mod h1:y5Zk1BBys9G+gd6Jrk0W3cC1+ELVxBWuIGO+w/tUAp0= @@ -494,6 +512,7 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -592,6 +611,8 @@ github.com/huin/goupnp v1.0.3 h1:N8No57ls+MnjlB+JPiCVSOyy/ot7MJTqlo7rn+NYSqQ= github.com/huin/goutil v0.0.0-20170803182201-1ca381bf3150/go.mod h1:PpLOETDnJ0o3iZrZfqZzyLl6l7F3c6L1oWn7OICBi6o= github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/imdario/mergo v0.3.13 h1:lFzP57bqS/wsqKssCGmtLAb8A0wKjLGrve2q3PPVcBk= +github.com/imdario/mergo v0.3.13/go.mod h1:4lJ1jqUDcsbIECGy0RUJAXNIhg+6ocWgb1ALK2O4oXg= github.com/improbable-eng/grpc-web v0.15.0 h1:BN+7z6uNXZ1tQGcNAuaU1YjsLTApzkjt2tzCixLaUPQ= github.com/improbable-eng/grpc-web v0.15.0/go.mod h1:1sy9HKV4Jt9aEs9JSnkWlRJPuPtwNr0l57L4f878wP8= github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8= @@ -627,6 +648,8 @@ github.com/jmespath/go-jmespath/internal/testify v1.5.1/go.mod h1:L3OGu8Wl2/fWfC github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U= github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ= github.com/jonboulle/clockwork v0.1.0/go.mod h1:Ii8DK3G1RaLaWxj9trq07+26W01tbo22gdxWY5EU2bo= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4= github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= @@ -635,6 +658,7 @@ github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/u github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.10/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU= github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk= github.com/jsternberg/zap-logfmt v1.0.0/go.mod h1:uvPs/4X51zdkcm5jXl5SYoN+4RK21K8mysFmDaM/h+o= @@ -667,6 +691,7 @@ github.com/konsorten/go-windows-terminal-sequences v1.0.3/go.mod h1:T0+1ngSBFLxv github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.2.0/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= @@ -694,6 +719,8 @@ github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamh github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60= github.com/mailru/easyjson v0.0.0-20190614124828-94de47d64c63/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= github.com/mailru/easyjson v0.0.0-20190626092158-b2ccc519800e/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= github.com/manifoldco/promptui v0.9.0 h1:3V4HzJk1TtXW1MTZMP7mdlwbBpIinw3HztaIlYthEiA= github.com/manifoldco/promptui v0.9.0/go.mod h1:ka04sppxSGFAtxX0qhlYQjISsg9mR4GWtQEhdbn6Pgg= github.com/matryer/moq v0.0.0-20190312154309-6cfb0558e1bd/go.mod h1:9ELz6aaclSIGnZBoaSLZ3NAl1VTufbOrXBPvtcy6WiQ= @@ -748,18 +775,23 @@ github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyua github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= github.com/mitchellh/pointerstructure v1.2.0/go.mod h1:BRAsLI5zgXmw97Lf6s25bs8ohIXc3tViBH44KcwB2g4= -github.com/moby/term v0.0.0-20220808134915-39b0c02b01ae h1:O4SWKdcHVCvYqyDV+9CJA1fcDN2L11Bule0iFy3YlAI= +github.com/moby/spdystream v0.2.0 h1:cjW1zVyyoiM0T7b6UoySUFqzXMoqRckQtXwGPiBhOM8= +github.com/moby/spdystream v0.2.0/go.mod h1:f7i0iNDQJ059oMTcWxx8MA/zKFIuD/lY+0GqbN2Wy8c= +github.com/moby/term v0.5.0 h1:xt8Q1nalod/v7BqbG21f8mQPqH+xAaC9C3N3wfWbVP0= github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0= github.com/modern-go/reflect2 v1.0.2 h1:xBagoLtFs94CBntxluKeaWgTMpvLxC4ur3nMaC9Gz0M= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/morikuni/aec v1.0.0 h1:nP9CBfwrvYnBRgY6qfDQkygYDmYwOilePFkwzv4dU8A= github.com/mschoch/smat v0.0.0-20160514031455-90eadee771ae/go.mod h1:qAyveg+e4CE+eKJXWVjKXM4ck2QobLqTDytGJbLLhJg= github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs= github.com/mtibben/percent v0.2.1/go.mod h1:KG9uO+SZkUp+VkRHsCdYQV3XSZrrSpR3O9ibNBTZrns= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f h1:KUppIJq7/+SVif2QVs3tOP0zanoHgBEVAwHxUSIzRqU= github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U= @@ -790,11 +822,12 @@ github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108 github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= github.com/onsi/ginkgo v1.16.4 h1:29JGrr5oVBm5ulCWet69zQkzWipVXIol6ygQUe/EzNc= github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= +github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk= github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= -github.com/onsi/gomega v1.10.1 h1:o0+MgICZLuZ7xjH7Vx6zS/zcu93/BEp1VwkIW1mEXCE= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= +github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= @@ -892,7 +925,7 @@ github.com/rjeczalik/notify v0.9.1/go.mod h1:rKwnCoCGeuQnwBtTSPL9Dad03Vh2n40ePRr github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg= github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ= github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4= -github.com/rogpeppe/go-internal v1.9.0 h1:73kH8U+JUqXU8lRuOHeVHaa/SZPifC7BkcraZVejAe8= +github.com/rogpeppe/go-internal v1.10.0 h1:TMyTOH3F/DB16zRVcYyreMH6GnZZrwQVAoYjRBZyWFQ= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= github.com/rs/cors v1.8.2 h1:KCooALfAYGs415Cwu5ABvv9n9509fSiG5SQJn/AQo4U= github.com/rs/cors v1.8.2/go.mod h1:XyqrcTp5zjWr1wsJ8PIRZssZ8b/WMcMf71DJnit4EMU= @@ -921,7 +954,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.9.0 h1:trlNQbNUG3OdDrDil03MCb1H2o9nJ1x4/5LYw7byDE0= +github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y= +github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -951,6 +985,7 @@ github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU= github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As= github.com/status-im/keycard-go v0.0.0-20190316090335-8537d3370df4/go.mod h1:RZLeN1LMWmRsyYjvAu+I6Dm9QmlDaIIt+Y+4Kd7Tp+Q= github.com/status-im/keycard-go v0.2.0 h1:QDLFswOQu1r5jsycloeQh3bVU8n/NatHHaZobtDnDzA= +github.com/stoewer/go-strcase v1.2.0/go.mod h1:IBiWB2sKIp3wVVQ3Y035++gc+knqhUQag1KpM8ahLw8= github.com/streadway/amqp v0.0.0-20190404075320-75d898a42a94/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/amqp v0.0.0-20190827072141-edfb9018d271/go.mod h1:AZpEONHx3DKn8O/DFsRAY58/XVQiIPMTMB1SddzLXVw= github.com/streadway/handy v0.0.0-20190108123426-d5acb3125c2a/go.mod h1:qNTQ5P5JnDBl6z3cMAg/SywNDC5ABu5ApDIw6lUbRmI= @@ -1288,6 +1323,7 @@ golang.org/x/sys v0.0.0-20211019181941-9d821ace8654/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20220128215802-99c3d69c2c27/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220517195934-5e4e11fc645e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU= @@ -1314,6 +1350,7 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxb golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20210220033141-f8bda1e9f3ba/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/time v0.0.0-20220922220347-f3bd1da661af h1:Yx9k8YCG3dvF87UAn2tu2HQLf2dt/eR1bXxpLMWeH+Y= +golang.org/x/time v0.0.0-20220922220347-f3bd1da661af/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180525024113-a5b4c53f6e8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= @@ -1456,6 +1493,7 @@ google.golang.org/genproto v0.0.0-20200729003335-053ba62fc06f/go.mod h1:FWY/as6D google.golang.org/genproto v0.0.0-20200804131852-c06518451d9c/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200825200019-8632dd797987/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20200904004341-0bd0a958aa1d/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= +google.golang.org/genproto v0.0.0-20201019141844-1ed22bb0c154/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201109203340-2640f1f9cdfb/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201201144952-b05cb90ed32e/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= google.golang.org/genproto v0.0.0-20201210142538-e3217bee35cc/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no= @@ -1517,6 +1555,8 @@ gopkg.in/cheggaaa/pb.v1 v1.0.27/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qS gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= gopkg.in/gcfg.v1 v1.2.3/go.mod h1:yesOnuUOFQAhST5vPY4nbZsb/huCgGGXlipJsBn0b3o= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA= gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k= gopkg.in/natefinch/lumberjack.v2 v2.0.0 h1:1Lc07Kr7qY4U2YPouBjpCLxpiyxIVoxqXgkXLknAOE8= @@ -1539,12 +1579,13 @@ gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0-20200615113413-eeeca48fe776/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.0/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= gotest.tools/v3 v3.4.0 h1:ZazjZUfuVeZGLAmlKKuyv3IKP5orXcwtOwDQH6YVr6o= -gotest.tools/v3 v3.4.0/go.mod h1:CtbdzLSsqVhDgMtKsx03ird5YTGB3ar27v0u/yKBW5g= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= @@ -1554,6 +1595,18 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= +k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= +k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= +k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= +k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/client-go v0.27.2 h1:vDLSeuYvCHKeoQRhCXjxXO45nHVv2Ip4Fe0MfioMrhE= +k8s.io/client-go v0.27.2/go.mod h1:tY0gVmUsHrAmjzHX9zs7eCjxcBsf8IiNe7KQ52biTcQ= +k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= +k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= +k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= +k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f/go.mod h1:byini6yhqGC14c3ebc/QwanvYwhuMWF6yz2F8uwW8eg= +k8s.io/utils v0.0.0-20230209194617-a36077c30491 h1:r0BAOLElQnnFhE/ApUsg3iHdVYYPBjNSSOMowRZxxsY= +k8s.io/utils v0.0.0-20230209194617-a36077c30491/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= nhooyr.io/websocket v1.8.6 h1:s+C3xAMLwGmlI31Nyn/eAehUlZPwfYZu2JXM621Q5/k= nhooyr.io/websocket v1.8.6/go.mod h1:B70DZP8IakI65RVQ51MsWP/8jndNma26DVA/nFSCgW0= pgregory.net/rapid v0.5.3 h1:163N50IHFqr1phZens4FQOdPgfJscR7a562mjQqeo4M= @@ -1562,6 +1615,10 @@ rsc.io/pdf v0.1.1/go.mod h1:n8OzWcQ6Sp37PL01nO98y4iUCRdTGarVfzxY20ICaU4= rsc.io/quote/v3 v3.1.0/go.mod h1:yEA65RcK8LyAZtP9Kv3t0HmxON59tX3rD+tICJqUlj0= rsc.io/sampler v1.3.0/go.mod h1:T1hPZKmBbMNahiBKFy5HrXp6adAjACjK9JXDnKaTXpA= rsc.io/tmplfunc v0.0.3/go.mod h1:AG3sTPzElb1Io3Yg4voV9AGZJuleGAwaVRxL9M49PhA= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd h1:EDPBXCAspyGV4jQlpZSudPeMmr1bNJefnuqLsRAsHZo= +sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd/go.mod h1:B8JuhiUyNFVKdsE8h686QcCxMaH6HrOAZj4vswFpcB0= +sigs.k8s.io/structured-merge-diff/v4 v4.2.3 h1:PRbqxJClWWYMNV1dhaG4NsibJbArud9kFxnAMREiWFE= +sigs.k8s.io/structured-merge-diff/v4 v4.2.3/go.mod h1:qjx8mGObPmV2aSZepjQjbmb2ihdVs8cGKBraizNC69E= sigs.k8s.io/yaml v1.1.0/go.mod h1:UJmg0vDUVViEyp3mgSv9WPwZCDxu4rQW1olrI1uml+o= sigs.k8s.io/yaml v1.3.0 h1:a2VclLzOGrwOHDiV8EfBGhvjHvP46CtW5j6POvhYGGo= sigs.k8s.io/yaml v1.3.0/go.mod h1:GeOyir5tyXNByN85N/dRIT9es5UQNerPYEKK56eTBm8= diff --git a/test/e2e/Makefile b/test/e2e/Makefile deleted file mode 100644 index 1b63d30a3b..0000000000 --- a/test/e2e/Makefile +++ /dev/null @@ -1,9 +0,0 @@ -all: cli docker - -cli: - go build -o build/e2e ./cmd/e2e - -docker: - docker build --tag ghcr.io/celestiaorg/celestia-app:current -f ../../Dockerfile ../.. - -PHONY: all cli docker diff --git a/test/e2e/README.md b/test/e2e/README.md deleted file mode 100644 index 56b6c75232..0000000000 --- a/test/e2e/README.md +++ /dev/null @@ -1,43 +0,0 @@ -# E2E Framework - -## Purpose - -The e2e package provides a framework for integration testing of the Celestia consensus network. -It consists of a simple CLI and a series of TOML testnet files which manage the running of -several instances within the same network. The e2e test suite has the following purposes in mind: - -- **Compatibility testing**: Ensuring that multiple minor versions can operate successfully together within the same network. -- **Upgrade testing**: Ensure upgrades, whether major or minor, can perform seamlessly. -- **Sync testing**: Ensure that the latest version can sync data from the entire chain. -- **Non determinism check**: Ensure that the state machine is free of non-determinism that could compromise replication. -- **Invariant checking**: Ensure that system wide invariants hold. - -The e2e package is designed predominantly for correctness based testing of small clusters of node. -It is designed to be relatively quick and can be used locally. It relies on docker and docker compose -to orchestrate the nodes. - -## Usage - -To get started, run `make` within the e2e package directory. This builds the image referring to the current -branch as well as the cli (To build just the cli run `make cli`). Then, to run the complete suite: - -```bash -./build/e2e -f networks/simple.toml -``` - -You should see something like - -```bash -Setting up network simple-56602 -Spinning up testnet -Starting validator01 on -Starting validator02 on -Starting validator03 on -Starting validator04 on -Starting full01 on -Waiting for the network to reach height 20 -Stopping testnet -Finished testnet successfully -``` - -Alternatively you can use the commands: `setup`, `start`, `stop`, and `cleanup`. diff --git a/test/e2e/cmd/e2e/main.go b/test/e2e/cmd/e2e/main.go deleted file mode 100644 index 551ce64fa6..0000000000 --- a/test/e2e/cmd/e2e/main.go +++ /dev/null @@ -1,124 +0,0 @@ -package main - -import ( - "context" - "fmt" - "os" - "os/signal" - "syscall" - - e2e "github.com/celestiaorg/celestia-app/test/e2e/pkg" - "github.com/rs/zerolog/log" - "github.com/spf13/cobra" -) - -func main() { - NewCLI().Run() -} - -type CLI struct { - root *cobra.Command - testnet *e2e.Testnet -} - -func NewCLI() *CLI { - cli := &CLI{} - cli.root = &cobra.Command{ - Use: "e2e", - Short: "Command line runner for celestia app e2e framework", - SilenceUsage: true, - PersistentPreRunE: func(cmd *cobra.Command, args []string) error { - file, err := cmd.Flags().GetString("file") - if err != nil { - return err - } - - manifest, err := e2e.LoadManifest(file) - if err != nil { - return fmt.Errorf("loading manifest: %w", err) - } - - testnet, err := e2e.LoadTestnet(manifest, file) - if err != nil { - return fmt.Errorf("building testnet: %w", err) - } - - cli.testnet = testnet - return nil - }, - RunE: func(cmd *cobra.Command, args []string) error { - ctx := cmd.Context() - if err := e2e.Cleanup(ctx, cli.testnet); err != nil { - return fmt.Errorf("preparing testnet: %w", err) - } - - if err := e2e.Setup(ctx, cli.testnet); err != nil { - return fmt.Errorf("setting up testnet: %w", err) - } - defer func() { _ = e2e.Cleanup(ctx, cli.testnet) }() - - if err := e2e.Start(ctx, cli.testnet); err != nil { - return fmt.Errorf("starting network: %w", err) - } - - if err := e2e.WaitForNBlocks(ctx, cli.testnet, 10); err != nil { - return fmt.Errorf("waiting for the network to produce blocks: %w", err) - } - - if err := e2e.Stop(ctx, cli.testnet); err != nil { - return fmt.Errorf("stopping network: %w", err) - } - - fmt.Println("Finished testnet successfully") - return nil - }, - } - cli.root.PersistentFlags().StringP("file", "f", "", "Testnet TOML manifest") - _ = cli.root.MarkPersistentFlagRequired("file") - - cli.root.AddCommand(&cobra.Command{ - Use: "setup", - Short: "Setups a testnet", - RunE: func(cmd *cobra.Command, args []string) error { - return e2e.Setup(cmd.Context(), cli.testnet) - }, - }) - - cli.root.AddCommand(&cobra.Command{ - Use: "start", - Short: "Starts a testnet", - RunE: func(cmd *cobra.Command, args []string) error { - return e2e.Start(cmd.Context(), cli.testnet) - }, - }) - - cli.root.AddCommand(&cobra.Command{ - Use: "stop", - Short: "Stops a testnet", - RunE: func(cmd *cobra.Command, args []string) error { - return e2e.Stop(cmd.Context(), cli.testnet) - }, - }) - - cli.root.AddCommand(&cobra.Command{ - Use: "cleanup", - Short: "Tears down network and removes all resources", - RunE: func(cmd *cobra.Command, args []string) error { - return e2e.Cleanup(cmd.Context(), cli.testnet) - }, - }) - - return cli -} - -func (cli *CLI) Run() { - ctx, cancel := signal.NotifyContext(context.Background(), - syscall.SIGINT, - syscall.SIGTERM, - ) - defer cancel() - if err := cli.root.ExecuteContext(ctx); err != nil { - log.Err(err) - os.Exit(1) - } -} diff --git a/test/e2e/networks/simple.toml b/test/e2e/networks/simple.toml deleted file mode 100644 index 26ef084c64..0000000000 --- a/test/e2e/networks/simple.toml +++ /dev/null @@ -1,13 +0,0 @@ -[node.validator01] -self_delegation = 1000000 -[node.validator02] -self_delegation = 1000000 -[node.validator03] -self_delegation = 1000000 -[node.validator04] -self_delegation = 1000000 -[node.full01] -start_height = 10 - -[account.user1] -[account.user2] \ No newline at end of file diff --git a/test/e2e/node.go b/test/e2e/node.go new file mode 100644 index 0000000000..0b0d6315ce --- /dev/null +++ b/test/e2e/node.go @@ -0,0 +1,229 @@ +package e2e + +import ( + "fmt" + "os" + "path/filepath" + + "github.com/celestiaorg/knuu/pkg/knuu" + serverconfig "github.com/cosmos/cosmos-sdk/server/config" + "github.com/tendermint/tendermint/config" + "github.com/tendermint/tendermint/crypto" + "github.com/tendermint/tendermint/p2p" + "github.com/tendermint/tendermint/privval" + "github.com/tendermint/tendermint/rpc/client/http" + "github.com/tendermint/tendermint/types" +) + +const ( + rpcPort = 26657 + p2pPort = 26656 + grpcPort = 9090 + dockerSrcURL = "ghcr.io/celestiaorg/celestia-app" + secp256k1Type = "secp256k1" + ed25519Type = "ed25519" +) + +type Node struct { + Name string + Version string + StartHeight int64 + InitialPeers []string + SignerKey crypto.PrivKey + NetworkKey crypto.PrivKey + AccountKey crypto.PrivKey + SelfDelegation int64 + Instance *knuu.Instance + + rpcProxyPort int + grpcProxyPort int +} + +func NewNode( + name, version string, + startHeight, selfDelegation int64, + peers []string, + signerKey, networkKey, accountKey crypto.PrivKey, +) (*Node, error) { + instance, err := knuu.NewInstance(name) + if err != nil { + return nil, err + } + err = instance.SetImage(fmt.Sprintf("%s:%s", dockerSrcURL, version)) + if err != nil { + return nil, err + } + if err := instance.AddPortTCP(rpcPort); err != nil { + return nil, err + } + if err := instance.AddPortTCP(p2pPort); err != nil { + return nil, err + } + if err := instance.AddPortTCP(grpcPort); err != nil { + return nil, err + } + err = instance.SetMemory("200Mi", "200Mi") + if err != nil { + return nil, err + } + err = instance.SetCPU("300m") + if err != nil { + return nil, err + } + err = instance.AddVolume("/root/.celestia-app", "1Gi") + if err != nil { + return nil, err + } + err = instance.SetArgs("start", "--home=/root/.celestia-app", "--rpc.laddr=tcp://0.0.0.0:26657") + if err != nil { + return nil, err + } + return &Node{ + Name: name, + Instance: instance, + Version: version, + StartHeight: startHeight, + InitialPeers: peers, + SignerKey: signerKey, + NetworkKey: networkKey, + AccountKey: accountKey, + SelfDelegation: selfDelegation, + }, nil +} + +func (n *Node) Init(genesis types.GenesisDoc) error { + // Initialize file directories + rootDir := os.TempDir() + nodeDir := filepath.Join(rootDir, n.Name) + for _, dir := range []string{ + filepath.Join(nodeDir, "config"), + filepath.Join(nodeDir, "data"), + } { + if err := os.MkdirAll(dir, os.ModePerm); err != nil { + return fmt.Errorf("error creating directory %s: %w", dir, err) + } + } + + // Create and write the config file + cfg, err := MakeConfig(n) + if err != nil { + return fmt.Errorf("making config: %w", err) + } + configFilePath := filepath.Join(nodeDir, "config", "config.toml") + config.WriteConfigFile(configFilePath, cfg) + + // Store the genesis file + genesisFilePath := filepath.Join(nodeDir, "config", "genesis.json") + err = genesis.SaveAs(genesisFilePath) + if err != nil { + return fmt.Errorf("saving genesis: %w", err) + } + + // Create the app.toml file + appConfig, err := MakeAppConfig(n) + if err != nil { + return fmt.Errorf("making app config: %w", err) + } + appConfigFilePath := filepath.Join(nodeDir, "config", "app.toml") + serverconfig.WriteConfigFile(appConfigFilePath, appConfig) + + // Store the node key for the p2p handshake + nodeKeyFilePath := filepath.Join(nodeDir, "config", "node_key.json") + err = (&p2p.NodeKey{PrivKey: n.NetworkKey}).SaveAs(nodeKeyFilePath) + if err != nil { + return err + } + + // Store the validator signer key for consensus + pvKeyPath := filepath.Join(nodeDir, "config", "priv_validator_key.json") + pvStatePath := filepath.Join(nodeDir, "data", "priv_validator_state.json") + (privval.NewFilePV(n.SignerKey, pvKeyPath, pvStatePath)).Save() + + err = n.Instance.AddFile(configFilePath, filepath.Join("/root/.celestia-app/config", "config.toml"), "0:0") + if err != nil { + return fmt.Errorf("adding config file: %w", err) + } + + err = n.Instance.AddFile(genesisFilePath, filepath.Join("/root/.celestia-app/config", "genesis.json"), "0:0") + if err != nil { + return fmt.Errorf("adding genesis file: %w", err) + } + + err = n.Instance.AddFile(appConfigFilePath, filepath.Join("/root/.celestia-app/config", "app.toml"), "0:0") + if err != nil { + return fmt.Errorf("adding app config file: %w", err) + } + + err = n.Instance.AddFile(pvKeyPath, filepath.Join("/root/.celestia-app/config", "priv_validator_key.json"), "0:0") + if err != nil { + return fmt.Errorf("adding priv_validator_key file: %w", err) + } + + err = n.Instance.AddFile(pvStatePath, filepath.Join("/root/.celestia-app/data", "priv_validator_state.json"), "0:0") + if err != nil { + return fmt.Errorf("adding priv_validator_state file: %w", err) + } + + err = n.Instance.AddFile(nodeKeyFilePath, filepath.Join("/root/.celestia-app/config", "node_key.json"), "0:0") + if err != nil { + return fmt.Errorf("adding node_key file: %w", err) + } + + return n.Instance.Commit() +} + +// Address returns a P2P endpoint address for the node. +func (n Node) AddressP2P(withID bool) string { + ip, err := n.Instance.GetIP() + if err != nil { + panic(err) + } + addr := fmt.Sprintf("%v:%d", ip, p2pPort) + if withID { + addr = fmt.Sprintf("%x@%v", n.NetworkKey.PubKey().Address().Bytes(), addr) + } + return addr +} + +// Address returns an RPC endpoint address for the node. +func (n Node) AddressRPC() string { + ip, err := n.Instance.GetIP() + if err != nil { + panic(err) + } + return fmt.Sprintf("%v:%d", ip, rpcPort) +} + +// Address returns a GRPC endpoint address for the node. +func (n Node) AddressGRPC() string { + ip, err := n.Instance.GetIP() + if err != nil { + panic(err) + } + return fmt.Sprintf("%v:%d", ip, grpcPort) +} + +func (n Node) IsValidator() bool { + return n.SelfDelegation != 0 +} + +func (n Node) Client() (*http.HTTP, error) { + return http.New(fmt.Sprintf("http://127.0.0.1:%v", n.rpcProxyPort), "/websocket") +} + +func (n *Node) Start() error { + if err := n.Instance.Start(); err != nil { + return err + } + rpcProxyPort, err := n.Instance.PortForwardTCP(rpcPort) + if err != nil { + return err + } + grpcProxyPort, err := n.Instance.PortForwardTCP(grpcPort) + if err != nil { + return err + } + n.rpcProxyPort = rpcProxyPort + n.grpcProxyPort = grpcProxyPort + return nil +} diff --git a/test/e2e/pkg/exec.go b/test/e2e/pkg/exec.go deleted file mode 100644 index 2410b53193..0000000000 --- a/test/e2e/pkg/exec.go +++ /dev/null @@ -1,33 +0,0 @@ -package e2e - -import ( - "fmt" - osexec "os/exec" - "path/filepath" -) - -// execute executes a shell command. -func exec(args ...string) error { - cmd := osexec.Command(args[0], args[1:]...) - out, err := cmd.CombinedOutput() - switch err := err.(type) { - case nil: - return nil - case *osexec.ExitError: - return fmt.Errorf("failed to run %q:\n%v", args, string(out)) - default: - return err - } -} - -// execCompose runs a Docker Compose command for a testnet. -func execCompose(dir string, args ...string) error { - return exec(append( - []string{"docker compose", "-f", filepath.Join(dir, "docker-compose.yml")}, - args...)...) -} - -// execDocker runs a Docker command. -func execDocker(args ...string) error { - return exec(append([]string{"docker"}, args...)...) -} diff --git a/test/e2e/pkg/lifecycle.go b/test/e2e/pkg/lifecycle.go deleted file mode 100644 index 0f169b498f..0000000000 --- a/test/e2e/pkg/lifecycle.go +++ /dev/null @@ -1,106 +0,0 @@ -package e2e - -import ( - "context" - "errors" - "fmt" - "os" - "path/filepath" -) - -// Start commences the testnet. -func Start(ctx context.Context, testnet *Testnet) error { - fmt.Println("Spinning up testnet") - nodes := testnet.NodesByStartHeight() - for _, node := range nodes { - - if node.StartHeight != 0 { - if err := WaitForHeight(ctx, testnet, node.StartHeight); err != nil { - return err - } - } - - fmt.Printf("Starting %s at height %d on %s\n", node.Name, node.StartHeight, fmt.Sprintf("http://localhost:%d", node.ProxyPort)) - - if err := execCompose(testnet.Dir, "up", "-d", node.Name); err != nil { - return err - } - } - - return nil -} - -// Stop stops the currently running network -func Stop(_ context.Context, testnet *Testnet) error { - fmt.Println("Stopping testnet") - return execCompose(testnet.Dir, "down") -} - -// Cleanup removes the Docker Compose containers and testnet directory. -func Cleanup(_ context.Context, testnet *Testnet) error { - err := cleanupDocker() - if err != nil { - return err - } - err = cleanupDir(testnet.Dir) - if err != nil { - return err - } - return nil -} - -// cleanupDocker removes all E2E resources (with label e2e=True), regardless -// of testnet. -func cleanupDocker() error { - // GNU xargs requires the -r flag to not run when input is empty, macOS - // does this by default. Ugly, but works. - xargsR := `$(if [[ $OSTYPE == "linux-gnu"* ]]; then echo -n "-r"; fi)` - - err := exec("bash", "-c", fmt.Sprintf( - "docker container ls -qa --filter label=e2e | xargs %v docker container rm -f", xargsR)) - if err != nil { - return err - } - - err = exec("bash", "-c", fmt.Sprintf( - "docker network ls -q --filter label=e2e | xargs %v docker network rm", xargsR)) - if err != nil { - return err - } - - return nil -} - -// cleanupDir cleans up a testnet directory -func cleanupDir(dir string) error { - if dir == "" { - return errors.New("no directory set") - } - - _, err := os.Stat(dir) - if os.IsNotExist(err) { - return nil - } else if err != nil { - return err - } - - // On Linux, some local files in the volume will be owned by root since Tendermint - // runs as root inside the container, so we need to clean them up from within a - // container running as root too. - absDir, err := filepath.Abs(dir) - if err != nil { - return err - } - err = execDocker("run", "--rm", "--entrypoint", "", "-v", fmt.Sprintf("%v:/network", absDir), - "tendermint/e2e-node", "sh", "-c", "rm -rf /network/*/") - if err != nil { - return err - } - - err = os.RemoveAll(dir) - if err != nil { - return err - } - - return nil -} diff --git a/test/e2e/pkg/manifest.go b/test/e2e/pkg/manifest.go deleted file mode 100644 index 82d64f2f89..0000000000 --- a/test/e2e/pkg/manifest.go +++ /dev/null @@ -1,70 +0,0 @@ -package e2e - -import ( - "fmt" - "os" - - "github.com/BurntSushi/toml" -) - -type Manifest struct { - Nodes map[string]*ManifestNode `toml:"node"` - Accounts map[string]*ManifestAccount `toml:"account"` -} - -type ManifestNode struct { - // Versions is an array of binary versions that the node - // will run in it's lifetime. A series of upgrades can be - // triggered by the upgrade command or will happen automatically - // across a testnet. - // - // Version strings are used to pull docker images from ghcr.io. - // Alternatively, use "current", if you want to use the binary - // based on the current branch. You must have the image built by - // running "make docker". Default set to "current" - Versions []string `toml:"versions"` - - // The height that the node will start at - StartHeight int64 `toml:"start_height"` - - // Peers are the set of peers that initially populate the address - // book. Persistent peers and seeds are currently not supported - // By default all nodes declared in the manifest are included - Peers []string `toml:"peers"` - - // SelfDelegation is the delegation of the validator when they - // first come up. If set to 0, the node is not considered a validator - SelfDelegation int64 `toml:"self_delegation"` -} - -// ManifestAccounts represent SDK accounts that sign and -// submit transactions. If the account has the same name as -// the node it is the operator address for the validator. -// Unless specified it will have a default self delegation -// All accounts specfied are created at genesis. -type ManifestAccount struct { - // Tokens symbolizes the genesis supply of liquid tokens to that account - Tokens int64 `toml:"tokens"` - - // The key type to derive the account key from. Defaults to secp256k1 - KeyType string `toml:"key_type"` -} - -// Save saves the testnet manifest to a file. -func (m Manifest) Save(file string) error { - f, err := os.Create(file) - if err != nil { - return fmt.Errorf("failed to create manifest file %q: %w", file, err) - } - return toml.NewEncoder(f).Encode(m) -} - -// LoadManifest loads a testnet manifest from a file. -func LoadManifest(file string) (Manifest, error) { - manifest := Manifest{} - _, err := toml.DecodeFile(file, &manifest) - if err != nil { - return manifest, fmt.Errorf("failed to load testnet manifest %q: %w", file, err) - } - return manifest, nil -} diff --git a/test/e2e/pkg/rpc.go b/test/e2e/pkg/rpc.go deleted file mode 100644 index 070020cbb0..0000000000 --- a/test/e2e/pkg/rpc.go +++ /dev/null @@ -1,129 +0,0 @@ -package e2e - -import ( - "context" - "errors" - "fmt" - "sort" - "time" - - rpchttp "github.com/tendermint/tendermint/rpc/client/http" -) - -const ( - waitForHeightTimeout = 20 * time.Second -) - -// WaitForNBlocks queries the current latest height and waits until the network -// progresses to "blocks" blocks ahead. -func WaitForNBlocks(ctx context.Context, testnet *Testnet, blocks int64) error { - height, err := GetHeights(ctx, testnet) - if err != nil { - return err - } - - fmt.Printf("Waiting for the network to reach height %d\n", height[0]+blocks) - - return WaitForHeight(ctx, testnet, height[0]+blocks) -} - -// WaitForHeight waits until the first node reaches the height specified. If -// no progress is made within a 20 second window then the function times out -// with an error. -func WaitForHeight(ctx context.Context, testnet *Testnet, height int64) error { - var ( - err error - maxHeight int64 - clients = map[string]*rpchttp.HTTP{} - lastIncrease = time.Now() - ) - - for { - for _, node := range testnet.Nodes { - if node.StartHeight > height { - continue - } - client, ok := clients[node.Name] - if !ok { - client, err = node.Client() - if err != nil { - continue - } - clients[node.Name] = client - } - subctx, cancel := context.WithTimeout(ctx, 1*time.Second) - defer cancel() - - // request the status of the node - result, err := client.Status(subctx) - if err != nil { - if errors.Is(err, context.DeadlineExceeded) { - return err - } - continue - } - - if result.SyncInfo.LatestBlockHeight >= height { - return nil - } - - if result.SyncInfo.LatestBlockHeight > maxHeight { - maxHeight = result.SyncInfo.LatestBlockHeight - lastIncrease = time.Now() - } - - // If no progress has been made in the last 20 seconds, return an error. - if time.Since(lastIncrease) > waitForHeightTimeout { - return fmt.Errorf("network unable to reach next height within %s (max height: %d, target height: %d)", - waitForHeightTimeout, maxHeight, height, - ) - } - - time.Sleep(1 * time.Second) - } - } -} - -// GetHeights loops through all running nodes and returns an array of heights -// in order of highest to lowest. -func GetHeights(ctx context.Context, testnet *Testnet) ([]int64, error) { - var ( - err error - heights = make([]int64, 0, len(testnet.Nodes)) - clients = map[string]*rpchttp.HTTP{} - ) - - for _, node := range testnet.Nodes { - client, ok := clients[node.Name] - if !ok { - client, err = node.Client() - if err != nil { - continue - } - clients[node.Name] = client - } - subctx, cancel := context.WithTimeout(ctx, 1*time.Second) - defer cancel() - - // request the status of the node - result, err := client.Status(subctx) - if err != nil { - if errors.Is(err, context.DeadlineExceeded) { - return nil, err - } - continue - } - - heights = append(heights, result.SyncInfo.LatestBlockHeight) - } - if len(heights) == 0 { - return nil, errors.New("network is not running") - } - - // return heights in descending order - sort.Slice(heights, func(i, j int) bool { - return heights[i] > heights[j] - }) - - return heights, nil -} diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go deleted file mode 100644 index d7b15d7fda..0000000000 --- a/test/e2e/pkg/testnet.go +++ /dev/null @@ -1,316 +0,0 @@ -package e2e - -import ( - "errors" - "fmt" - "io" - "math" - "math/rand" - "net" - "path/filepath" - "sort" - "strings" - - "github.com/tendermint/tendermint/crypto" - "github.com/tendermint/tendermint/crypto/ed25519" - "github.com/tendermint/tendermint/crypto/secp256k1" - "github.com/tendermint/tendermint/rpc/client/http" -) - -const ( - secp256k1Type = "secp256k1" - ed25519Type = "ed25519" - networkIPv4 = "10.186.73.0/24" - firstProxyPort uint32 = 4201 - dockerSrcURL = "ghcr.io/celestiaorg/celestia-app" - randomSeed int64 = 589308084734268 - defaultAccountTokens = 1e6 - rpcPort = 26657 -) - -type Testnet struct { - Name string // also used as the chain-id - Dir string - IP *net.IPNet - Nodes map[string]*Node - Accounts map[string]*Account -} - -type Node struct { - Name string - Versions []string - StartHeight int64 - Peers []string - SignerKey crypto.PrivKey - NetworkKey crypto.PrivKey - AccountKey crypto.PrivKey - IP net.IP - ProxyPort uint32 - SelfDelegation int64 -} - -type Account struct { - Name string - Tokens int64 - Key crypto.PrivKey -} - -func LoadTestnet(manifest Manifest, file string) (*Testnet, error) { - // the directory that the toml file is located in - dir := strings.TrimSuffix(file, filepath.Ext(file)) - name := fmt.Sprintf("%s-%d", filepath.Base(dir), rand.Intn(math.MaxUint16)) - _, ipNet, err := net.ParseCIDR(networkIPv4) - if err != nil { - return nil, fmt.Errorf("invalid IP network address %q: %w", networkIPv4, err) - } - ipGen := newIPGenerator(ipNet) - keyGen := newKeyGenerator(randomSeed) - proxyPort := firstProxyPort - - testnet := &Testnet{ - Dir: dir, - Name: name, - Nodes: make(map[string]*Node), - Accounts: make(map[string]*Account), - IP: ipGen.Network(), - } - - // deterministically sort names in alphabetical order - nodeNames := []string{} - for name := range manifest.Nodes { - nodeNames = append(nodeNames, name) - } - sort.Strings(nodeNames) - - for _, name := range nodeNames { - nodeManifest := manifest.Nodes[name] - if _, ok := testnet.Nodes[name]; ok { - return nil, fmt.Errorf("duplicate node name %s", name) - } - node := &Node{ - Name: name, - Versions: nodeManifest.Versions, - StartHeight: nodeManifest.StartHeight, - Peers: nodeManifest.Peers, - SignerKey: keyGen.Generate(ed25519Type), - NetworkKey: keyGen.Generate(ed25519Type), - AccountKey: keyGen.Generate(secp256k1Type), - SelfDelegation: nodeManifest.SelfDelegation, - IP: ipGen.Next(), - ProxyPort: proxyPort, - } - if len(node.Versions) == 0 { - node.Versions = []string{"current"} - } - - testnet.Nodes[name] = node - proxyPort++ - } - - for name, node := range testnet.Nodes { - // fill up the peers field if it is empty - if len(node.Peers) == 0 { - for otherName := range testnet.Nodes { - if otherName == name { - continue - } - node.Peers = append(node.Peers, otherName) - } - } - // replace the peer names with the P2P address. - for idx, peer := range node.Peers { - node.Peers[idx] = testnet.Nodes[peer].AddressP2P(true) - } - } - - // deterministically sort accounts in alphabetical order - accountNames := []string{} - for name := range manifest.Accounts { - accountNames = append(accountNames, name) - } - sort.Strings(accountNames) - - for _, name := range accountNames { - accountManifest := manifest.Accounts[name] - if _, ok := testnet.Accounts[name]; ok { - return nil, fmt.Errorf("duplicate account name %s", name) - } - account := &Account{ - Name: name, - Tokens: accountManifest.Tokens, - Key: keyGen.Generate(accountManifest.KeyType), - } - if account.Tokens == 0 { - account.Tokens = defaultAccountTokens - } - testnet.Accounts[name] = account - } - - return testnet, testnet.Validate() -} - -func (t *Testnet) Validate() (err error) { - if len(t.Accounts) == 0 { - return errors.New("at least one account is required") - } - if len(t.Nodes) == 0 { - return errors.New("at least one node is required") - } - validators := 0 - for name, node := range t.Nodes { - if err := node.Validate(); err != nil { - return fmt.Errorf("invalid node %s: %w", name, err) - } - // must have at least one validator - if node.SelfDelegation > 0 { - validators++ - } - } - if validators == 0 { - return errors.New("at least one node must a validator by having an associated account") - } - for _, account := range t.Accounts { - if err := account.Validate(); err != nil { - return err - } - } - - return nil -} - -func (t *Testnet) GetAllVersions() []string { - versions := make(map[string]struct{}) - // filter duplicate version strings - for _, node := range t.Nodes { - for _, version := range node.Versions { - versions[version] = struct{}{} - } - } - - // convert to list - versionsList := []string{} - for version := range versions { - versionsList = append(versionsList, version) - } - return versionsList -} - -func (t *Testnet) NodesByStartHeight() []*Node { - nodes := make([]*Node, 0, len(t.Nodes)) - for _, node := range t.Nodes { - nodes = append(nodes, node) - } - sort.Slice(nodes, func(i, j int) bool { - if nodes[i].StartHeight == nodes[j].StartHeight { - return nodes[i].Name < nodes[j].Name - } - return nodes[i].StartHeight < nodes[j].StartHeight - }) - return nodes -} - -// Address returns a P2P endpoint address for the node. -func (n Node) AddressP2P(withID bool) string { - addr := fmt.Sprintf("%v:26656", n.IP.String()) - if withID { - addr = fmt.Sprintf("%x@%v", n.NetworkKey.PubKey().Address().Bytes(), addr) - } - return addr -} - -// Address returns an RPC endpoint address for the node. -func (n Node) AddressRPC() string { - return fmt.Sprintf("%v:%d", n.IP.String(), rpcPort) -} - -func (n Node) IsValidator() bool { - return n.SelfDelegation != 0 -} - -func (n Node) Client() (*http.HTTP, error) { - return http.New(fmt.Sprintf("http://127.0.0.1:%v", n.ProxyPort), "/websocket") -} - -func (n Node) Validate() error { - if len(n.Versions) == 0 { - return errors.New("at least one version is required") - } - if n.StartHeight < 0 { - return errors.New("start height must be non-negative") - } - if n.SelfDelegation < 0 { - return errors.New("self delegation must be non-negative") - } - return nil -} - -func (a Account) Validate() error { - if a.Tokens < 0 { - return errors.New("tokens must be non-negative") - } - return nil -} - -type keyGenerator struct { - random *rand.Rand -} - -func newKeyGenerator(seed int64) *keyGenerator { - return &keyGenerator{ - random: rand.New(rand.NewSource(seed)), //nolint:gosec - } -} - -func (g *keyGenerator) Generate(keyType string) crypto.PrivKey { - seed := make([]byte, ed25519.SeedSize) - - _, err := io.ReadFull(g.random, seed) - if err != nil { - panic(err) // this shouldn't happen - } - switch keyType { - case "secp256k1": - return secp256k1.GenPrivKeySecp256k1(seed) - case "", "ed25519": - return ed25519.GenPrivKeyFromSecret(seed) - default: - panic("KeyType not supported") // should not make it this far - } -} - -type ipGenerator struct { - network *net.IPNet - nextIP net.IP -} - -func newIPGenerator(network *net.IPNet) *ipGenerator { - nextIP := make([]byte, len(network.IP)) - copy(nextIP, network.IP) - gen := &ipGenerator{network: network, nextIP: nextIP} - // Skip network and gateway addresses - gen.Next() - gen.Next() - return gen -} - -func (g *ipGenerator) Network() *net.IPNet { - n := &net.IPNet{ - IP: make([]byte, len(g.network.IP)), - Mask: make([]byte, len(g.network.Mask)), - } - copy(n.IP, g.network.IP) - copy(n.Mask, g.network.Mask) - return n -} - -func (g *ipGenerator) Next() net.IP { - ip := make([]byte, len(g.nextIP)) - copy(ip, g.nextIP) - for i := len(g.nextIP) - 1; i >= 0; i-- { - g.nextIP[i]++ - if g.nextIP[i] != 0 { - break - } - } - return ip -} diff --git a/test/e2e/pkg/setup.go b/test/e2e/setup.go similarity index 50% rename from test/e2e/pkg/setup.go rename to test/e2e/setup.go index 5dd624b68c..6278791e2c 100644 --- a/test/e2e/pkg/setup.go +++ b/test/e2e/setup.go @@ -1,15 +1,8 @@ package e2e import ( - "bytes" - "context" "encoding/json" - "errors" "fmt" - "html/template" - "io" - "os" - "path/filepath" "strings" "time" @@ -17,99 +10,27 @@ import ( "github.com/celestiaorg/celestia-app/app/encoding" codectypes "github.com/cosmos/cosmos-sdk/codec/types" cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec" + cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types" serverconfig "github.com/cosmos/cosmos-sdk/server/config" sdk "github.com/cosmos/cosmos-sdk/types" auth "github.com/cosmos/cosmos-sdk/x/auth/types" bank "github.com/cosmos/cosmos-sdk/x/bank/types" slashing "github.com/cosmos/cosmos-sdk/x/slashing/types" staking "github.com/cosmos/cosmos-sdk/x/staking/types" - dockertypes "github.com/docker/docker/api/types" - "github.com/docker/docker/client" "github.com/ethereum/go-ethereum/common" "github.com/tendermint/tendermint/config" "github.com/tendermint/tendermint/crypto" "github.com/tendermint/tendermint/p2p" "github.com/tendermint/tendermint/p2p/pex" - "github.com/tendermint/tendermint/privval" "github.com/tendermint/tendermint/types" ) -func Setup(ctx context.Context, testnet *Testnet) error { - // Ensure that all the requisite images are available - if err := SetupImages(ctx, testnet); err != nil { - return fmt.Errorf("setting up images: %w", err) - } - - fmt.Printf("Setting up network %s\n", testnet.Name) - - _, err := os.Stat(testnet.Dir) - if err == nil { - return errors.New("testnet directory already exists") - } else if !errors.Is(err, os.ErrNotExist) { - return fmt.Errorf("checking if testnet directory exists: %w", err) - } - - // Create the directory for the testnet - if err := os.MkdirAll(testnet.Dir, os.ModePerm); err != nil { - return err - } - cleanup := func() { os.RemoveAll(testnet.Dir) } - - // Create the docker compose file - if err := WriteDockerCompose(testnet, filepath.Join(testnet.Dir, "docker-compose.yml")); err != nil { - cleanup() - return fmt.Errorf("setting up docker compose: %w", err) - } - - // Make the genesis file for the testnet - genesis, err := MakeGenesis(testnet) - if err != nil { - cleanup() - return fmt.Errorf("making genesis: %w", err) - } - - // Initialize the file system and configs for each node - for name, node := range testnet.Nodes { - err := InitNode(node, genesis, testnet.Dir) - if err != nil { - cleanup() - return fmt.Errorf("initializing node %s: %w", name, err) - } - } - - return nil +type GenesisAccount struct { + PubKey cryptotypes.PubKey + InitialTokens int64 } -// SetupImages ensures that all the requisite docker images for each -// used celestia consensus version. -func SetupImages(ctx context.Context, testnet *Testnet) error { - c, err := client.NewClientWithOpts() - if err != nil { - return fmt.Errorf("establishing docker client: %v", err) - } - - versions := testnet.GetAllVersions() - - for _, v := range versions { - if v == "current" { - // we assume that the user has locally downloaded - // the current docker image - continue - } - refStr := dockerSrcURL + ":" + v - fmt.Printf("Pulling in docker image: %s\n", refStr) - rc, err := c.ImagePull(ctx, refStr, dockertypes.ImagePullOptions{}) - if err != nil { - return fmt.Errorf("error pulling image %s: %w", refStr, err) - } - _, _ = io.Copy(io.Discard, rc) - _ = rc.Close() - } - - return nil -} - -func MakeGenesis(testnet *Testnet) (types.GenesisDoc, error) { +func MakeGenesis(nodes []*Node, accounts []*GenesisAccount) (types.GenesisDoc, error) { encCdc := encoding.MakeConfig(app.ModuleEncodingRegisters...) appGenState := app.ModuleBasics.DefaultGenesis(encCdc.Codec) bankGenesis := bank.DefaultGenesisState() @@ -117,16 +38,16 @@ func MakeGenesis(testnet *Testnet) (types.GenesisDoc, error) { slashingGenesis := slashing.DefaultGenesisState() genAccs := []auth.GenesisAccount{} stakingGenesis.Params.BondDenom = app.BondDenom - delegations := make([]staking.Delegation, 0, len(testnet.Nodes)) - valInfo := make([]slashing.SigningInfo, 0, len(testnet.Nodes)) - balances := make([]bank.Balance, 0, len(testnet.Accounts)+1) + delegations := make([]staking.Delegation, 0, len(nodes)) + valInfo := make([]slashing.SigningInfo, 0, len(nodes)) + balances := make([]bank.Balance, 0, len(accounts)) var ( validators staking.Validators totalBonded int64 ) // setup the validator information on the state machine - for name, node := range testnet.Nodes { + for _, node := range nodes { if !node.IsValidator() || node.StartHeight != 0 { continue } @@ -146,7 +67,7 @@ func MakeGenesis(testnet *Testnet) (types.GenesisDoc, error) { OperatorAddress: sdk.ValAddress(addr).String(), ConsensusPubkey: pkAny, Description: staking.Description{ - Moniker: name, + Moniker: node.Name, }, Status: staking.Bonded, Tokens: sdk.NewInt(node.SelfDelegation), @@ -168,20 +89,17 @@ func MakeGenesis(testnet *Testnet) (types.GenesisDoc, error) { stakingGenesis.Validators = validators slashingGenesis.SigningInfos = valInfo - accountNumber := uint64(0) - for _, account := range testnet.Accounts { - pk, err := cryptocodec.FromTmPubKeyInterface(account.Key.PubKey()) - if err != nil { - return types.GenesisDoc{}, fmt.Errorf("converting public key for account %s: %w", account.Name, err) - } - - addr := pk.Address() - acc := auth.NewBaseAccount(addr.Bytes(), pk, accountNumber, 0) + for idx, account := range accounts { + addr := account.PubKey.Address() + acc := auth.NewBaseAccount(addr.Bytes(), account.PubKey, uint64(idx), 0) genAccs = append(genAccs, acc) + if account.InitialTokens == 0 { + return types.GenesisDoc{}, fmt.Errorf("account %s has no initial tokens", addr) + } balances = append(balances, bank.Balance{ Address: sdk.AccAddress(addr).String(), Coins: sdk.NewCoins( - sdk.NewCoin(app.BondDenom, sdk.NewInt(account.Tokens)), + sdk.NewCoin(app.BondDenom, sdk.NewInt(account.InitialTokens)), ), }) } @@ -210,7 +128,7 @@ func MakeGenesis(testnet *Testnet) (types.GenesisDoc, error) { // Validator set and app hash are set in InitChain return types.GenesisDoc{ - ChainID: testnet.Name, + ChainID: "testnet", GenesisTime: time.Now().UTC(), ConsensusParams: types.DefaultConsensusParams(), AppState: appState, @@ -223,7 +141,7 @@ func MakeConfig(node *Node) (*config.Config, error) { cfg.Moniker = node.Name cfg.RPC.ListenAddress = "tcp://0.0.0.0:26657" cfg.P2P.ExternalAddress = fmt.Sprintf("tcp://%v", node.AddressP2P(false)) - cfg.P2P.PersistentPeers = strings.Join(node.Peers, ",") + cfg.P2P.PersistentPeers = strings.Join(node.InitialPeers, ",") // TODO: when we use adaptive timeouts, add a parameter in the testnet manifest // to set block times @@ -234,100 +152,6 @@ func MakeConfig(node *Node) (*config.Config, error) { return cfg, nil } -func InitNode(node *Node, genesis types.GenesisDoc, rootDir string) error { - // Initialize file directories - nodeDir := filepath.Join(rootDir, node.Name) - for _, dir := range []string{ - filepath.Join(nodeDir, "config"), - filepath.Join(nodeDir, "data"), - } { - if err := os.MkdirAll(dir, os.ModePerm); err != nil { - return fmt.Errorf("error creating directory %s: %w", dir, err) - } - } - - // Create and write the config file - cfg, err := MakeConfig(node) - if err != nil { - return fmt.Errorf("making config: %w", err) - } - config.WriteConfigFile(filepath.Join(nodeDir, "config", "config.toml"), cfg) - - // Store the genesis file - err = genesis.SaveAs(filepath.Join(nodeDir, "config", "genesis.json")) - if err != nil { - return fmt.Errorf("saving genesis: %w", err) - } - - // Create the app.toml file - appConfig, err := MakeAppConfig(node) - if err != nil { - return fmt.Errorf("making app config: %w", err) - } - serverconfig.WriteConfigFile(filepath.Join(nodeDir, "config", "app.toml"), appConfig) - - // Store the node key for the p2p handshake - err = (&p2p.NodeKey{PrivKey: node.NetworkKey}).SaveAs(filepath.Join(nodeDir, "config", "node_key.json")) - if err != nil { - return err - } - - // Store the validator signer key for consensus - (privval.NewFilePV(node.SignerKey, - filepath.Join(nodeDir, "config", "priv_validator_key.json"), - filepath.Join(nodeDir, "data", "priv_validator_state.json"), - )).Save() - - return nil -} - -func WriteDockerCompose(testnet *Testnet, file string) error { - tmpl, err := template.New("docker-compose").Parse(`version: '2.4' - -networks: - {{ .Name }}: - labels: - e2e: true - driver: bridge - ipam: - driver: default - config: - - subnet: {{ .IP }} - -services: -{{- range .Nodes }} - {{ .Name }}: - labels: - e2e: true - container_name: {{ .Name }} - image: ghcr.io/celestiaorg/celestia-app:{{ index .Versions 0 }} - entrypoint: ["/bin/celestia-appd"] - command: ["start"] - init: true - ports: - - 26656 - - {{ if .ProxyPort }}{{ .ProxyPort }}:{{ end }}26657 - - 6060 - - 9090 - - 1317 - volumes: - - ./{{ .Name }}:/home/celestia/.celestia-app - networks: - {{ $.Name }}: - ipv4_address: {{ .IP }} - -{{end}}`) - if err != nil { - return err - } - var buf bytes.Buffer - err = tmpl.Execute(&buf, testnet) - if err != nil { - return err - } - return os.WriteFile(file, buf.Bytes(), 0o644) -} - func WriteAddressBook(peers []string, file string) error { book := pex.NewAddrBook(file, true) for _, peer := range peers { diff --git a/test/e2e/simple_test.go b/test/e2e/simple_test.go new file mode 100644 index 0000000000..530e320c81 --- /dev/null +++ b/test/e2e/simple_test.go @@ -0,0 +1,35 @@ +package e2e + +import ( + "context" + "errors" + "testing" + "time" + + "github.com/celestiaorg/celestia-app/test/txsim" + "github.com/stretchr/testify/require" +) + +const ( + latestVersion = "latest" + seed = 42 +) + +func TestE2ESimple(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + testnet := New(seed) + require.NoError(t, testnet.CreateGenesisNodes(4, latestVersion, 10000)) + + kr, err := testnet.CreateGenesisAccount("alice", 10000000) + require.NoError(t, err) + + require.NoError(t, testnet.Setup()) + require.NoError(t, testnet.Start()) + + sequences := txsim.NewBlobSequence(txsim.NewRange(200, 4000), txsim.NewRange(1, 3)).Clone(5) + sequences = append(sequences, txsim.NewSendSequence(4, 1000, 100).Clone(5)...) + + err = txsim.Run(ctx, testnet.RPCEndpoints(), testnet.GRPCEndpoints(), kr, seed, 1*time.Second, sequences...) + require.True(t, errors.Is(err, context.DeadlineExceeded), err.Error()) +} diff --git a/test/e2e/testnet.go b/test/e2e/testnet.go new file mode 100644 index 0000000000..c8af575cf1 --- /dev/null +++ b/test/e2e/testnet.go @@ -0,0 +1,135 @@ +package e2e + +import ( + "fmt" + + "github.com/celestiaorg/celestia-app/app" + "github.com/celestiaorg/celestia-app/app/encoding" + "github.com/celestiaorg/celestia-app/test/txsim" + "github.com/cosmos/cosmos-sdk/crypto/hd" + "github.com/cosmos/cosmos-sdk/crypto/keyring" +) + +type Testnet struct { + seed int64 + nodes []*Node + genesisAccounts []*GenesisAccount + sequences []*txsim.Sequence + keygen *keyGenerator +} + +func New(seed int64) *Testnet { + return &Testnet{ + seed: seed, + nodes: make([]*Node, 0), + genesisAccounts: make([]*GenesisAccount, 0), + keygen: newKeyGenerator(seed), + } +} + +func (t *Testnet) CreateGenesisNode(version string, selfDelegation int64) error { + signerKey := t.keygen.Generate(ed25519Type) + networkKey := t.keygen.Generate(ed25519Type) + accountKey := t.keygen.Generate(secp256k1Type) + node, err := NewNode(fmt.Sprintf("val%d", len(t.nodes)), version, 0, selfDelegation, nil, signerKey, networkKey, accountKey) + if err != nil { + return err + } + t.nodes = append(t.nodes, node) + return nil +} + +func (t *Testnet) CreateGenesisNodes(num int, version string, selfDelegation int64) error { + for i := -0; i < num; i++ { + if err := t.CreateGenesisNode(version, selfDelegation); err != nil { + return err + } + } + return nil +} + +func (t *Testnet) CreateNode(version string, startHeight int64) error { + signerKey := t.keygen.Generate(ed25519Type) + networkKey := t.keygen.Generate(ed25519Type) + accountKey := t.keygen.Generate(secp256k1Type) + node, err := NewNode(fmt.Sprintf("val%d", len(t.nodes)), version, startHeight, 0, nil, signerKey, networkKey, accountKey) + if err != nil { + return err + } + t.nodes = append(t.nodes, node) + return nil +} + +func (t *Testnet) CreateGenesisAccount(name string, tokens int64) (keyring.Keyring, error) { + cdc := encoding.MakeConfig(app.ModuleEncodingRegisters...).Codec + kr := keyring.NewInMemory(cdc) + key, _, err := kr.NewMnemonic(name, keyring.English, "", "", hd.Secp256k1) + if err != nil { + return nil, err + } + pk, err := key.GetPubKey() + if err != nil { + return nil, err + } + t.genesisAccounts = append(t.genesisAccounts, &GenesisAccount{ + PubKey: pk, + InitialTokens: tokens, + }) + return kr, nil +} + +func (t *Testnet) SetSequences(sequences []*txsim.Sequence) { + t.sequences = sequences +} + +func (t *Testnet) Setup() error { + genesisNodes := make([]*Node, 0) + for _, node := range t.nodes { + if node.StartHeight == 0 && node.SelfDelegation > 0 { + genesisNodes = append(genesisNodes, node) + } + } + genesis, err := MakeGenesis(genesisNodes, t.genesisAccounts) + if err != nil { + return err + } + for _, node := range t.nodes { + err = node.Init(genesis) + if err != nil { + return err + } + } + return nil +} + +func (t *Testnet) RPCEndpoints() []string { + rpcEndpoints := make([]string, len(t.nodes)) + for idx, node := range t.nodes { + rpcEndpoints[idx] = node.AddressRPC() + } + return rpcEndpoints +} + +func (t *Testnet) GRPCEndpoints() []string { + grpcEndpoints := make([]string, len(t.nodes)) + for idx, node := range t.nodes { + grpcEndpoints[idx] = node.AddressGRPC() + } + return grpcEndpoints +} + +func (t *Testnet) Start() error { + genesisNodes := make([]*Node, 0) + for _, node := range t.nodes { + if node.StartHeight == 0 { + genesisNodes = append(genesisNodes, node) + } + } + for _, node := range genesisNodes { + err := node.Start() + if err != nil { + return err + } + } + return nil +} diff --git a/test/e2e/util.go b/test/e2e/util.go new file mode 100644 index 0000000000..b291bba559 --- /dev/null +++ b/test/e2e/util.go @@ -0,0 +1,37 @@ +package e2e + +import ( + "io" + "math/rand" + + "github.com/tendermint/tendermint/crypto" + "github.com/tendermint/tendermint/crypto/ed25519" + "github.com/tendermint/tendermint/crypto/secp256k1" +) + +type keyGenerator struct { + random *rand.Rand +} + +func newKeyGenerator(seed int64) *keyGenerator { + return &keyGenerator{ + random: rand.New(rand.NewSource(seed)), //nolint:gosec + } +} + +func (g *keyGenerator) Generate(keyType string) crypto.PrivKey { + seed := make([]byte, ed25519.SeedSize) + + _, err := io.ReadFull(g.random, seed) + if err != nil { + panic(err) // this shouldn't happen + } + switch keyType { + case "secp256k1": + return secp256k1.GenPrivKeySecp256k1(seed) + case "", "ed25519": + return ed25519.GenPrivKeyFromSecret(seed) + default: + panic("KeyType not supported") // should not make it this far + } +} From bbcc10a7b55329d962f7865ae6cf83e754e88f77 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 14 Jun 2023 11:35:24 +0200 Subject: [PATCH 02/14] initialize knuu --- test/e2e/simple_test.go | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/test/e2e/simple_test.go b/test/e2e/simple_test.go index 530e320c81..be5b6907d1 100644 --- a/test/e2e/simple_test.go +++ b/test/e2e/simple_test.go @@ -3,10 +3,12 @@ package e2e import ( "context" "errors" + "fmt" "testing" "time" "github.com/celestiaorg/celestia-app/test/txsim" + "github.com/celestiaorg/knuu/pkg/knuu" "github.com/stretchr/testify/require" ) @@ -16,6 +18,11 @@ const ( ) func TestE2ESimple(t *testing.T) { + if testing.Short() { + t.Skip("skipping e2e test in short mode") + } + identifier := fmt.Sprintf("%s_%s", t.Name(), time.Now().Format("20060102_150405")) + err := knuu.InitializeWithIdentifier(identifier) ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() testnet := New(seed) From 9e36ff4c34c41db5158f8003a13e60fa1900de0d Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Fri, 16 Jun 2023 14:23:37 +0200 Subject: [PATCH 03/14] try to setup directories correctly --- test/e2e/node.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/test/e2e/node.go b/test/e2e/node.go index 0b0d6315ce..33c26bea99 100644 --- a/test/e2e/node.go +++ b/test/e2e/node.go @@ -134,11 +134,25 @@ func (n *Node) Init(genesis types.GenesisDoc) error { return err } + err = os.Chmod(nodeKeyFilePath, 0777) + if err != nil { + return fmt.Errorf("chmod node key: %w", err) + } + // Store the validator signer key for consensus pvKeyPath := filepath.Join(nodeDir, "config", "priv_validator_key.json") pvStatePath := filepath.Join(nodeDir, "data", "priv_validator_state.json") (privval.NewFilePV(n.SignerKey, pvKeyPath, pvStatePath)).Save() + _, err = n.Instance.ExecuteCommand("mkdir -p /root/.celestia-app/config") + if err != nil { + return fmt.Errorf("creating config directory: %w", err) + } + _, err = n.Instance.ExecuteCommand("mkdir -p /root/.celestia-app/data") + if err != nil { + return fmt.Errorf("creating data directory: %w", err) + } + err = n.Instance.AddFile(configFilePath, filepath.Join("/root/.celestia-app/config", "config.toml"), "0:0") if err != nil { return fmt.Errorf("adding config file: %w", err) From d88bdbed09dbe79927e476ed34047e8e65910411 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 21 Jun 2023 15:25:05 +0200 Subject: [PATCH 04/14] update go sum --- go.sum | 43 +------------------------------------------ 1 file changed, 1 insertion(+), 42 deletions(-) diff --git a/go.sum b/go.sum index 2cf4acfa61..870c60fe97 100644 --- a/go.sum +++ b/go.sum @@ -68,14 +68,6 @@ github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.3/go.mod h1:KLF4gFr6DcKFZwSu github.com/Azure/azure-sdk-for-go/sdk/storage/azblob v0.3.0/go.mod h1:tPaiy8S5bQ+S5sOiDlINkp7+Ef339+Nz5L5XO+cnOHo= github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= -<<<<<<< HEAD -||||||| 766b8a5c -github.com/BurntSushi/toml v1.3.0 h1:Ws8e5YmnrGEHzZEzg0YvK/7COGYtTC5PbaH9oSSbgfA= -github.com/BurntSushi/toml v1.3.0/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= -======= -github.com/BurntSushi/toml v1.3.2 h1:o7IhLm0Msx3BaB+n3Ag7L8EVlByGnpq14C4YWiu/gL8= -github.com/BurntSushi/toml v1.3.2/go.mod h1:CxXYINrC8qIiEnFrOxCa7Jy5BFHlXnUU2pbicEuybxQ= ->>>>>>> main github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo= github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM= github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4= @@ -418,13 +410,7 @@ github.com/go-sql-driver/mysql v1.4.1/go.mod h1:zAC/RDZ24gD3HViQzih4MyKcchzm+sOG github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-stack/stack v1.8.1 h1:ntEHSVwIt7PNXNpgPmVfMrNhLtgjlmnZha2kOpuRiDw= github.com/go-stack/stack v1.8.1/go.mod h1:dcoOX6HbPZSZptuspn9bctJ+N/CnF5gGygcUP3XYfe4= -<<<<<<< HEAD github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0 h1:p104kn46Q8WdvHunIJ9dAyjPVtrBPhSr3KT2yUst43I= -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -||||||| 766b8a5c -github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= -======= ->>>>>>> main github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee h1:s+21KNqlpePfkah2I+gwHF8xmJWRjooY+5248k6m4A0= github.com/gobwas/httphead v0.0.0-20180130184737-2c6c146eadee/go.mod h1:L0fX3K22YWvt/FAX9NnzrNzcI4wNYi9Yku4O0LKYflo= github.com/gobwas/pool v0.2.0 h1:QEmUOlnSjWtnpRGHF3SauEiOsy82Cup83Vf2LcMlnc8= @@ -476,6 +462,7 @@ github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QD github.com/golang/protobuf v1.4.2/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/protobuf v1.5.0/go.mod h1:FsONVRAS9T7sI+LIUmWTfcYkHO4aIWwzhcaSAoJOfIk= +github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/protobuf v1.5.3 h1:KhyjKVUg7Usr/dYsdSqoFveMYd5ko72D+zANwlG1mmg= github.com/golang/protobuf v1.5.3/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiuN0vRsmY= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -526,13 +513,7 @@ github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hf github.com/google/pprof v0.0.0-20201023163331-3e6fc7fc9c4c/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201203190320-1bf35d6f28c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20201218002935-b9804c9f04c2/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -<<<<<<< HEAD -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= github.com/google/pprof v0.0.0-20210720184732-4bb14d4b1be1 h1:K6RDEckDVWvDI9JAJYCmNdQXq6neHJOYx3V6jnqNEec= -||||||| 766b8a5c -github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= -======= ->>>>>>> main github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI= github.com/google/uuid v1.0.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= @@ -842,34 +823,12 @@ github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+W github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk= github.com/onsi/ginkgo v1.14.0 h1:2mOpI4JVVPBN+WQRa0WKH2eXR+Ey+uK4n7Zj0aYpIQA= github.com/onsi/ginkgo v1.14.0/go.mod h1:iSB4RoI2tjJc9BBv4NKIKWKya62Rps+oPG/Lv9klQyY= -<<<<<<< HEAD -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= github.com/onsi/ginkgo/v2 v2.9.1 h1:zie5Ly042PD3bsCvsSOPvRnFwyo3rKe64TJlD6nu0mk= -||||||| 766b8a5c -github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0= -github.com/onsi/ginkgo v1.16.5 h1:8xi0RTUf59SOSfEtZMvwTvXYMzG4gV23XVHOZiXNtnE= -github.com/onsi/ginkgo v1.16.5/go.mod h1:+E8gABHa3K6zRBolWtd+ROzc/U5bkGt0FwiG042wbpU= -github.com/onsi/ginkgo/v2 v2.1.3/go.mod h1:vw5CSIxN1JObi/U8gcbwft7ZxR2dgaR70JSE3/PpL4c= -======= ->>>>>>> main github.com/onsi/gomega v1.4.1/go.mod h1:C1qb7wdrVGGVU+Z6iS04AVkA3Q65CEZX59MT0QO5uiA= github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY= github.com/onsi/gomega v1.7.1/go.mod h1:XdKZgCCFLUoM/7CFJVPcG8C1xQ1AJ0vpAezJrB7JYyY= github.com/onsi/gomega v1.10.1/go.mod h1:iN09h71vgCQne3DLsj+A5owkum+a2tYe+TOCB1ybHNo= -<<<<<<< HEAD -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= github.com/onsi/gomega v1.27.4 h1:Z2AnStgsdSayCMDiCU42qIz+HLqEPcgiOCXjAU/w+8E= -||||||| 766b8a5c -github.com/onsi/gomega v1.17.0/go.mod h1:HnhC7FXeEQY45zxNK3PPoIUhzk/80Xly9PcubAlGdZY= -github.com/onsi/gomega v1.19.0/go.mod h1:LY+I3pBVzYsTBU1AnDwOSxaYi9WoWiqgwooUqq9yPro= -github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= -======= -github.com/onsi/gomega v1.20.0 h1:8W0cWlwFkflGPLltQvLRB7ZVD5HuP6ng320w2IS245Q= ->>>>>>> main github.com/op/go-logging v0.0.0-20160315200505-970db520ece7/go.mod h1:HzydrMdWErDVzsI23lYNej1Htcns9BCg93Dk0bBINWk= github.com/opencontainers/go-digest v1.0.0 h1:apOUWs51W5PlhuyGyz9FCeeBIOUDA/6nW8Oi/yOhh5U= github.com/opencontainers/go-digest v1.0.0/go.mod h1:0JzlMkj0TRzQZfJkVvzbP0HBR3IKzErnv2BNG4W4MAM= From f1683e28b9b11ff840d25ecafbace15f46ad5589 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 21 Jun 2023 15:26:18 +0200 Subject: [PATCH 05/14] use knuu 0.7.1 --- go.mod | 10 +++++----- go.sum | 20 ++++++++++---------- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/go.mod b/go.mod index bb938aa0e6..4591d42d59 100644 --- a/go.mod +++ b/go.mod @@ -60,14 +60,14 @@ require ( github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect github.com/opencontainers/go-digest v1.0.0 // indirect github.com/opencontainers/image-spec v1.1.0-rc2 // indirect - github.com/sirupsen/logrus v1.9.2 // indirect + github.com/sirupsen/logrus v1.9.3 // indirect golang.org/x/mod v0.9.0 // indirect golang.org/x/time v0.0.0-20220922220347-f3bd1da661af // indirect golang.org/x/tools v0.7.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect - k8s.io/api v0.27.2 // indirect - k8s.io/apimachinery v0.27.2 // indirect - k8s.io/client-go v0.27.2 // indirect + k8s.io/api v0.27.3 // indirect + k8s.io/apimachinery v0.27.3 // indirect + k8s.io/client-go v0.27.3 // indirect k8s.io/klog/v2 v2.90.1 // indirect k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect k8s.io/utils v0.0.0-20230209194617-a36077c30491 // indirect @@ -93,7 +93,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/celestiaorg/knuu v0.6.0 + github.com/celestiaorg/knuu v0.7.1 github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect diff --git a/go.sum b/go.sum index 870c60fe97..998b48e123 100644 --- a/go.sum +++ b/go.sum @@ -173,8 +173,8 @@ github.com/celestiaorg/celestia-core v1.22.0-tm-v0.34.28 h1:idHJK9i4WCkYOf5PXVWZ github.com/celestiaorg/celestia-core v1.22.0-tm-v0.34.28/go.mod h1:LOxHW9nA++/9U8TgvTyKo9TO3F09sWv8asKQs00m73U= github.com/celestiaorg/cosmos-sdk v1.15.0-sdk-v0.46.13 h1:vaQKgaOm0w58JAvOgn2iDohqjH7kvvRqVKiMcBDWifA= github.com/celestiaorg/cosmos-sdk v1.15.0-sdk-v0.46.13/go.mod h1:G9XkhOJZde36FH0kt/1ayg4ZaioZEQmmRfMa/zQig0I= -github.com/celestiaorg/knuu v0.6.0 h1:g+RDNGvWoKd0GMxna1b38cdiXreBdTf79saaq15bpRU= -github.com/celestiaorg/knuu v0.6.0/go.mod h1:CYayB+f3iGVpcBqR9xM0hrnjQpIm/Q+FD020TMRGETk= +github.com/celestiaorg/knuu v0.7.1 h1:JGkd3ulC/xpzfvg3lFkNrgvZFzZEf6Tb631fNMz4G9A= +github.com/celestiaorg/knuu v0.7.1/go.mod h1:TEqLSR4fTZ/45t/jIvYN/zr0IvLZlGrGRd2XoqDZcM4= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA= github.com/celestiaorg/nmt v0.16.0 h1:4CX6d1Uwf1C+tGcAWskPve0HCDTnI4Ey8ffjiDwcGH0= @@ -956,8 +956,8 @@ github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPx github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.6.0/go.mod h1:7uNnSEd1DgxDLC74fIahvMZmmYsHGZGEOFrfsX/uA88= github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= -github.com/sirupsen/logrus v1.9.2 h1:oxx1eChJGI6Uks2ZC4W1zpLlVgqB8ner4EuQwV4Ik1Y= -github.com/sirupsen/logrus v1.9.2/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= +github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= +github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc= github.com/smartystreets/goconvey v1.6.4/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA= github.com/soheilhy/cmux v0.1.4/go.mod h1:IM3LyeVVIOuxMH7sFAkER9+bJ4dT7Ms6E4xg4kGIyLM= @@ -1597,12 +1597,12 @@ honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.0.1-2020.1.4/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k= honnef.co/go/tools v0.1.3/go.mod h1:NgwopIslSNH47DimFoV78dnkksY2EFtX0ajyb3K/las= -k8s.io/api v0.27.2 h1:+H17AJpUMvl+clT+BPnKf0E3ksMAzoBBg7CntpSuADo= -k8s.io/api v0.27.2/go.mod h1:ENmbocXfBT2ADujUXcBhHV55RIT31IIEvkntP6vZKS4= -k8s.io/apimachinery v0.27.2 h1:vBjGaKKieaIreI+oQwELalVG4d8f3YAMNpWLzDXkxeg= -k8s.io/apimachinery v0.27.2/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= -k8s.io/client-go v0.27.2 h1:vDLSeuYvCHKeoQRhCXjxXO45nHVv2Ip4Fe0MfioMrhE= -k8s.io/client-go v0.27.2/go.mod h1:tY0gVmUsHrAmjzHX9zs7eCjxcBsf8IiNe7KQ52biTcQ= +k8s.io/api v0.27.3 h1:yR6oQXXnUEBWEWcvPWS0jQL575KoAboQPfJAuKNrw5Y= +k8s.io/api v0.27.3/go.mod h1:C4BNvZnQOF7JA/0Xed2S+aUyJSfTGkGFxLXz9MnpIpg= +k8s.io/apimachinery v0.27.3 h1:Ubye8oBufD04l9QnNtW05idcOe9Z3GQN8+7PqmuVcUM= +k8s.io/apimachinery v0.27.3/go.mod h1:XNfZ6xklnMCOGGFNqXG7bUrQCoR04dh/E7FprV6pb+E= +k8s.io/client-go v0.27.3 h1:7dnEGHZEJld3lYwxvLl7WoehK6lAq7GvgjxpA3nv1E8= +k8s.io/client-go v0.27.3/go.mod h1:2MBEKuTo6V1lbKy3z1euEGnhPfGZLKTS9tiJ2xodM48= k8s.io/klog/v2 v2.90.1 h1:m4bYOKall2MmOiRaR1J+We67Do7vm9KiQVlT96lnHUw= k8s.io/klog/v2 v2.90.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0= k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f h1:2kWPakN3i/k81b0gvD5C5FJ2kxm1WrQFanWchyKuqGg= From 46e22658c8ae47f6539b359ab489193c312b8e97 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Wed, 21 Jun 2023 16:45:27 +0200 Subject: [PATCH 06/14] fix some bugs --- test/e2e/node.go | 31 +++++++++++++++++++------------ test/e2e/simple_test.go | 6 +++--- test/e2e/testnet.go | 2 +- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/test/e2e/node.go b/test/e2e/node.go index 33c26bea99..7f81505ab6 100644 --- a/test/e2e/node.go +++ b/test/e2e/node.go @@ -22,6 +22,7 @@ const ( dockerSrcURL = "ghcr.io/celestiaorg/celestia-app" secp256k1Type = "secp256k1" ed25519Type = "ed25519" + remoteRootDir = "/home/celestia/.celestia-app" ) type Node struct { @@ -70,11 +71,11 @@ func NewNode( if err != nil { return nil, err } - err = instance.AddVolume("/root/.celestia-app", "1Gi") + err = instance.AddVolume(remoteRootDir, "1Gi") if err != nil { return nil, err } - err = instance.SetArgs("start", "--home=/root/.celestia-app", "--rpc.laddr=tcp://0.0.0.0:26657") + err = instance.SetArgs("start", fmt.Sprintf("--home=%s", remoteRootDir), "--rpc.laddr=tcp://0.0.0.0:26657") if err != nil { return nil, err } @@ -144,41 +145,41 @@ func (n *Node) Init(genesis types.GenesisDoc) error { pvStatePath := filepath.Join(nodeDir, "data", "priv_validator_state.json") (privval.NewFilePV(n.SignerKey, pvKeyPath, pvStatePath)).Save() - _, err = n.Instance.ExecuteCommand("mkdir -p /root/.celestia-app/config") + _, err = n.Instance.ExecuteCommand(fmt.Sprintf("mkdir -p %s/config", remoteRootDir)) if err != nil { return fmt.Errorf("creating config directory: %w", err) } - _, err = n.Instance.ExecuteCommand("mkdir -p /root/.celestia-app/data") + _, err = n.Instance.ExecuteCommand(fmt.Sprintf("mkdir -p %s/data", remoteRootDir)) if err != nil { return fmt.Errorf("creating data directory: %w", err) } - err = n.Instance.AddFile(configFilePath, filepath.Join("/root/.celestia-app/config", "config.toml"), "0:0") + err = n.Instance.AddFile(configFilePath, filepath.Join(remoteRootDir, "config", "config.toml"), "0:0") if err != nil { return fmt.Errorf("adding config file: %w", err) } - err = n.Instance.AddFile(genesisFilePath, filepath.Join("/root/.celestia-app/config", "genesis.json"), "0:0") + err = n.Instance.AddFile(genesisFilePath, filepath.Join(remoteRootDir, "config", "genesis.json"), "0:0") if err != nil { return fmt.Errorf("adding genesis file: %w", err) } - err = n.Instance.AddFile(appConfigFilePath, filepath.Join("/root/.celestia-app/config", "app.toml"), "0:0") + err = n.Instance.AddFile(appConfigFilePath, filepath.Join(remoteRootDir, "config", "app.toml"), "0:0") if err != nil { return fmt.Errorf("adding app config file: %w", err) } - err = n.Instance.AddFile(pvKeyPath, filepath.Join("/root/.celestia-app/config", "priv_validator_key.json"), "0:0") + err = n.Instance.AddFile(pvKeyPath, filepath.Join(remoteRootDir, "config", "priv_validator_key.json"), "0:0") if err != nil { return fmt.Errorf("adding priv_validator_key file: %w", err) } - err = n.Instance.AddFile(pvStatePath, filepath.Join("/root/.celestia-app/data", "priv_validator_state.json"), "0:0") + err = n.Instance.AddFile(pvStatePath, filepath.Join(remoteRootDir, "data", "priv_validator_state.json"), "0:0") if err != nil { return fmt.Errorf("adding priv_validator_state file: %w", err) } - err = n.Instance.AddFile(nodeKeyFilePath, filepath.Join("/root/.celestia-app/config", "node_key.json"), "0:0") + err = n.Instance.AddFile(nodeKeyFilePath, filepath.Join(remoteRootDir, "config", "node_key.json"), "0:0") if err != nil { return fmt.Errorf("adding node_key file: %w", err) } @@ -229,13 +230,19 @@ func (n *Node) Start() error { if err := n.Instance.Start(); err != nil { return err } + + if err := n.Instance.WaitInstanceIsRunning(); err != nil { + return err + } + rpcProxyPort, err := n.Instance.PortForwardTCP(rpcPort) if err != nil { - return err + return fmt.Errorf("forwarding port %d: %w", rpcPort, err) } + grpcProxyPort, err := n.Instance.PortForwardTCP(grpcPort) if err != nil { - return err + return fmt.Errorf("forwarding port %d: %w", grpcPort, err) } n.rpcProxyPort = rpcProxyPort n.grpcProxyPort = grpcProxyPort diff --git a/test/e2e/simple_test.go b/test/e2e/simple_test.go index be5b6907d1..6520e5abf4 100644 --- a/test/e2e/simple_test.go +++ b/test/e2e/simple_test.go @@ -13,7 +13,7 @@ import ( ) const ( - latestVersion = "latest" + latestVersion = "v1.0.0-rc4" seed = 42 ) @@ -23,8 +23,6 @@ func TestE2ESimple(t *testing.T) { } identifier := fmt.Sprintf("%s_%s", t.Name(), time.Now().Format("20060102_150405")) err := knuu.InitializeWithIdentifier(identifier) - ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) - defer cancel() testnet := New(seed) require.NoError(t, testnet.CreateGenesisNodes(4, latestVersion, 10000)) @@ -37,6 +35,8 @@ func TestE2ESimple(t *testing.T) { sequences := txsim.NewBlobSequence(txsim.NewRange(200, 4000), txsim.NewRange(1, 3)).Clone(5) sequences = append(sequences, txsim.NewSendSequence(4, 1000, 100).Clone(5)...) + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() err = txsim.Run(ctx, testnet.RPCEndpoints(), testnet.GRPCEndpoints(), kr, seed, 1*time.Second, sequences...) require.True(t, errors.Is(err, context.DeadlineExceeded), err.Error()) } diff --git a/test/e2e/testnet.go b/test/e2e/testnet.go index c8af575cf1..bd64d863fc 100644 --- a/test/e2e/testnet.go +++ b/test/e2e/testnet.go @@ -128,7 +128,7 @@ func (t *Testnet) Start() error { for _, node := range genesisNodes { err := node.Start() if err != nil { - return err + return fmt.Errorf("node %s failed to start: %w", node.Name, err) } } return nil From 2750934f0e6ae9437aff855407eca6c174f3dcd3 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Fri, 23 Jun 2023 16:43:36 +0200 Subject: [PATCH 07/14] update to 0.7.2 and make some minor tweaks --- go.mod | 2 +- go.sum | 4 ++-- test/e2e/node.go | 14 +++++++------- test/e2e/setup.go | 2 +- test/e2e/simple_test.go | 5 ++++- test/e2e/testnet.go | 10 ++++++++++ 6 files changed, 25 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 4591d42d59..19d89466fd 100644 --- a/go.mod +++ b/go.mod @@ -93,7 +93,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/celestiaorg/knuu v0.7.1 + github.com/celestiaorg/knuu v0.7.2 github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect diff --git a/go.sum b/go.sum index 998b48e123..662c541206 100644 --- a/go.sum +++ b/go.sum @@ -173,8 +173,8 @@ github.com/celestiaorg/celestia-core v1.22.0-tm-v0.34.28 h1:idHJK9i4WCkYOf5PXVWZ github.com/celestiaorg/celestia-core v1.22.0-tm-v0.34.28/go.mod h1:LOxHW9nA++/9U8TgvTyKo9TO3F09sWv8asKQs00m73U= github.com/celestiaorg/cosmos-sdk v1.15.0-sdk-v0.46.13 h1:vaQKgaOm0w58JAvOgn2iDohqjH7kvvRqVKiMcBDWifA= github.com/celestiaorg/cosmos-sdk v1.15.0-sdk-v0.46.13/go.mod h1:G9XkhOJZde36FH0kt/1ayg4ZaioZEQmmRfMa/zQig0I= -github.com/celestiaorg/knuu v0.7.1 h1:JGkd3ulC/xpzfvg3lFkNrgvZFzZEf6Tb631fNMz4G9A= -github.com/celestiaorg/knuu v0.7.1/go.mod h1:TEqLSR4fTZ/45t/jIvYN/zr0IvLZlGrGRd2XoqDZcM4= +github.com/celestiaorg/knuu v0.7.2 h1:+Rj1O+kalNVtXlPwztGmwDdEN6biqNEv0DD/9Q6nSog= +github.com/celestiaorg/knuu v0.7.2/go.mod h1:TEqLSR4fTZ/45t/jIvYN/zr0IvLZlGrGRd2XoqDZcM4= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA= github.com/celestiaorg/nmt v0.16.0 h1:4CX6d1Uwf1C+tGcAWskPve0HCDTnI4Ey8ffjiDwcGH0= diff --git a/test/e2e/node.go b/test/e2e/node.go index 7f81505ab6..c15f71096b 100644 --- a/test/e2e/node.go +++ b/test/e2e/node.go @@ -71,7 +71,7 @@ func NewNode( if err != nil { return nil, err } - err = instance.AddVolume(remoteRootDir, "1Gi") + err = instance.AddVolumeWithOwner(remoteRootDir, "1Gi", 10001) if err != nil { return nil, err } @@ -154,32 +154,32 @@ func (n *Node) Init(genesis types.GenesisDoc) error { return fmt.Errorf("creating data directory: %w", err) } - err = n.Instance.AddFile(configFilePath, filepath.Join(remoteRootDir, "config", "config.toml"), "0:0") + err = n.Instance.AddFile(configFilePath, filepath.Join(remoteRootDir, "config", "config.toml"), "10001:10001") if err != nil { return fmt.Errorf("adding config file: %w", err) } - err = n.Instance.AddFile(genesisFilePath, filepath.Join(remoteRootDir, "config", "genesis.json"), "0:0") + err = n.Instance.AddFile(genesisFilePath, filepath.Join(remoteRootDir, "config", "genesis.json"), "10001:10001") if err != nil { return fmt.Errorf("adding genesis file: %w", err) } - err = n.Instance.AddFile(appConfigFilePath, filepath.Join(remoteRootDir, "config", "app.toml"), "0:0") + err = n.Instance.AddFile(appConfigFilePath, filepath.Join(remoteRootDir, "config", "app.toml"), "10001:10001") if err != nil { return fmt.Errorf("adding app config file: %w", err) } - err = n.Instance.AddFile(pvKeyPath, filepath.Join(remoteRootDir, "config", "priv_validator_key.json"), "0:0") + err = n.Instance.AddFile(pvKeyPath, filepath.Join(remoteRootDir, "config", "priv_validator_key.json"), "10001:10001") if err != nil { return fmt.Errorf("adding priv_validator_key file: %w", err) } - err = n.Instance.AddFile(pvStatePath, filepath.Join(remoteRootDir, "data", "priv_validator_state.json"), "0:0") + err = n.Instance.AddFile(pvStatePath, filepath.Join(remoteRootDir, "data", "priv_validator_state.json"), "10001:10001") if err != nil { return fmt.Errorf("adding priv_validator_state file: %w", err) } - err = n.Instance.AddFile(nodeKeyFilePath, filepath.Join(remoteRootDir, "config", "node_key.json"), "0:0") + err = n.Instance.AddFile(nodeKeyFilePath, filepath.Join(remoteRootDir, "config", "node_key.json"), "10001:10001") if err != nil { return fmt.Errorf("adding node_key file: %w", err) } diff --git a/test/e2e/setup.go b/test/e2e/setup.go index 6278791e2c..c12a704a1c 100644 --- a/test/e2e/setup.go +++ b/test/e2e/setup.go @@ -130,7 +130,7 @@ func MakeGenesis(nodes []*Node, accounts []*GenesisAccount) (types.GenesisDoc, e return types.GenesisDoc{ ChainID: "testnet", GenesisTime: time.Now().UTC(), - ConsensusParams: types.DefaultConsensusParams(), + ConsensusParams: app.DefaultConsensusParams(), AppState: appState, // AppHash is not provided but computed after InitChain }, nil diff --git a/test/e2e/simple_test.go b/test/e2e/simple_test.go index 6520e5abf4..7dc1abfc61 100644 --- a/test/e2e/simple_test.go +++ b/test/e2e/simple_test.go @@ -24,7 +24,10 @@ func TestE2ESimple(t *testing.T) { identifier := fmt.Sprintf("%s_%s", t.Name(), time.Now().Format("20060102_150405")) err := knuu.InitializeWithIdentifier(identifier) testnet := New(seed) - require.NoError(t, testnet.CreateGenesisNodes(4, latestVersion, 10000)) + t.Cleanup(func() { + _ = testnet.Cleanup() + }) + require.NoError(t, testnet.CreateGenesisNodes(4, latestVersion, 10000000)) kr, err := testnet.CreateGenesisAccount("alice", 10000000) require.NoError(t, err) diff --git a/test/e2e/testnet.go b/test/e2e/testnet.go index bd64d863fc..f2cbfa1e7d 100644 --- a/test/e2e/testnet.go +++ b/test/e2e/testnet.go @@ -133,3 +133,13 @@ func (t *Testnet) Start() error { } return nil } + +func (t *Testnet) Cleanup() error { + for _, node := range t.nodes { + err := node.Instance.Destroy() + if err != nil { + return fmt.Errorf("node %s failed to cleanup: %w", node.Name, err) + } + } + return nil +} From 4da9e95c2bb795edd55c7bca49322a36b6882e52 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 10 Jul 2023 16:07:31 +0200 Subject: [PATCH 08/14] fix problem with peers finding each other --- Makefile | 5 +++++ test/e2e/node.go | 18 +++++++++++++++++- test/e2e/setup.go | 2 +- test/e2e/simple_test.go | 4 ++-- test/e2e/testnet.go | 15 ++++++++++++++- 5 files changed, 39 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index 47b9fa5466..26bc94a47b 100644 --- a/Makefile +++ b/Makefile @@ -111,6 +111,11 @@ test-short: @go test -mod=readonly ./... -short .PHONY: test-short +test-e2e: + @echo "--> Running e2e tests" + @go test -mod=readonly ./test/e2e/... --e2e +.PHONY: test-e2e + ## test-race: Run unit tests in race mode. test-race: @echo "--> Running tests in race mode" diff --git a/test/e2e/node.go b/test/e2e/node.go index c15f71096b..b27d0e0bd6 100644 --- a/test/e2e/node.go +++ b/test/e2e/node.go @@ -79,6 +79,7 @@ func NewNode( if err != nil { return nil, err } + return &Node{ Name: name, Instance: instance, @@ -92,7 +93,11 @@ func NewNode( }, nil } -func (n *Node) Init(genesis types.GenesisDoc) error { +func (n *Node) Init(genesis types.GenesisDoc, peers []string) error { + if len(peers) == 0 { + return fmt.Errorf("no peers provided") + } + // Initialize file directories rootDir := os.TempDir() nodeDir := filepath.Join(rootDir, n.Name) @@ -145,6 +150,12 @@ func (n *Node) Init(genesis types.GenesisDoc) error { pvStatePath := filepath.Join(nodeDir, "data", "priv_validator_state.json") (privval.NewFilePV(n.SignerKey, pvKeyPath, pvStatePath)).Save() + addrBookFile := filepath.Join(nodeDir, "config", "addrbook.json") + err = WriteAddressBook(peers, addrBookFile) + if err != nil { + return fmt.Errorf("writing address book: %w", err) + } + _, err = n.Instance.ExecuteCommand(fmt.Sprintf("mkdir -p %s/config", remoteRootDir)) if err != nil { return fmt.Errorf("creating config directory: %w", err) @@ -184,6 +195,11 @@ func (n *Node) Init(genesis types.GenesisDoc) error { return fmt.Errorf("adding node_key file: %w", err) } + err = n.Instance.AddFile(addrBookFile, filepath.Join(remoteRootDir, "config", "addrbook.json"), "10001:10001") + if err != nil { + return fmt.Errorf("adding addrbook file: %w", err) + } + return n.Instance.Commit() } diff --git a/test/e2e/setup.go b/test/e2e/setup.go index c12a704a1c..6b59d96715 100644 --- a/test/e2e/setup.go +++ b/test/e2e/setup.go @@ -153,7 +153,7 @@ func MakeConfig(node *Node) (*config.Config, error) { } func WriteAddressBook(peers []string, file string) error { - book := pex.NewAddrBook(file, true) + book := pex.NewAddrBook(file, false) for _, peer := range peers { addr, err := p2p.NewNetAddressString(peer) if err != nil { diff --git a/test/e2e/simple_test.go b/test/e2e/simple_test.go index 7dc1abfc61..48c3efcc58 100644 --- a/test/e2e/simple_test.go +++ b/test/e2e/simple_test.go @@ -18,8 +18,8 @@ const ( ) func TestE2ESimple(t *testing.T) { - if testing.Short() { - t.Skip("skipping e2e test in short mode") + if !*e2eEnabled { + t.Skip("skipping e2e test. Use --e2e to run end to end tests") } identifier := fmt.Sprintf("%s_%s", t.Name(), time.Now().Format("20060102_150405")) err := knuu.InitializeWithIdentifier(identifier) diff --git a/test/e2e/testnet.go b/test/e2e/testnet.go index f2cbfa1e7d..2950a9fd1c 100644 --- a/test/e2e/testnet.go +++ b/test/e2e/testnet.go @@ -1,6 +1,7 @@ package e2e import ( + "flag" "fmt" "github.com/celestiaorg/celestia-app/app" @@ -10,6 +11,9 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" ) +// flag to enable e2e tests +var e2eEnabled = flag.Bool("e2e", false, "enable e2e tests") + type Testnet struct { seed int64 nodes []*Node @@ -94,7 +98,16 @@ func (t *Testnet) Setup() error { return err } for _, node := range t.nodes { - err = node.Init(genesis) + // nodes are initialized with the addresses of all other + // nodes in their addressbook + peers := make([]string, 0, len(t.nodes)-1) + for _, peer := range t.nodes { + if peer.Name != node.Name { + peers = append(peers, peer.AddressP2P(true)) + } + } + + err = node.Init(genesis, peers) if err != nil { return err } From 9d2254373d99a062c593eba02b21c40dcc9f07c2 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 13 Jul 2023 16:50:26 +0200 Subject: [PATCH 09/14] update knuu and correct e2e test --- go.mod | 4 ++-- go.sum | 8 ++++---- test/e2e/node.go | 16 ++++------------ test/e2e/simple_test.go | 17 ++++++++++++----- test/e2e/testnet.go | 33 +++++++++++++++++++++++++++++---- x/qgb/types/query.pb.go | 2 +- 6 files changed, 52 insertions(+), 28 deletions(-) diff --git a/go.mod b/go.mod index 5eaf44527a..9757a8b9a2 100644 --- a/go.mod +++ b/go.mod @@ -93,7 +93,7 @@ require ( github.com/bgentry/go-netrc v0.0.0-20140422174119-9fd32a8b3d3d // indirect github.com/bgentry/speakeasy v0.1.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.2 // indirect - github.com/celestiaorg/knuu v0.7.2 + github.com/celestiaorg/knuu v0.8.2 github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 // indirect github.com/cenkalti/backoff/v4 v4.1.3 // indirect github.com/cespare/xxhash v1.1.0 // indirect @@ -118,7 +118,7 @@ require ( github.com/dgraph-io/badger/v2 v2.2007.4 // indirect github.com/dgraph-io/ristretto v0.1.0 // indirect github.com/dgryski/go-farm v0.0.0-20200201041132-a6ae2369ad13 // indirect - github.com/docker/docker v24.0.2+incompatible // indirect + github.com/docker/docker v24.0.4+incompatible // indirect github.com/dustin/go-humanize v1.0.1-0.20200219035652-afde56e7acac // indirect github.com/dvsekhvalnov/jose2go v1.5.0 // indirect github.com/felixge/httpsnoop v1.0.1 // indirect diff --git a/go.sum b/go.sum index 135f85f43f..819b3cae1e 100644 --- a/go.sum +++ b/go.sum @@ -173,8 +173,8 @@ github.com/celestiaorg/celestia-core v1.23.0-tm-v0.34.28 h1:G7/rq6xTnuFf3XsVZEcl github.com/celestiaorg/celestia-core v1.23.0-tm-v0.34.28/go.mod h1:J/GsBjoTZaFz71VeyrLZbG8rV+Rzi6oFEUZUipQ97hQ= github.com/celestiaorg/cosmos-sdk v1.15.0-sdk-v0.46.13 h1:vaQKgaOm0w58JAvOgn2iDohqjH7kvvRqVKiMcBDWifA= github.com/celestiaorg/cosmos-sdk v1.15.0-sdk-v0.46.13/go.mod h1:G9XkhOJZde36FH0kt/1ayg4ZaioZEQmmRfMa/zQig0I= -github.com/celestiaorg/knuu v0.7.2 h1:+Rj1O+kalNVtXlPwztGmwDdEN6biqNEv0DD/9Q6nSog= -github.com/celestiaorg/knuu v0.7.2/go.mod h1:TEqLSR4fTZ/45t/jIvYN/zr0IvLZlGrGRd2XoqDZcM4= +github.com/celestiaorg/knuu v0.8.2 h1:x63nYTO46j293VkNP7VcRHtYHSize6dM/h7xME2Vgi0= +github.com/celestiaorg/knuu v0.8.2/go.mod h1:zBrMXhFl7irCPOVJyHS8sBg7K9Hux5dLy9VChA40LTo= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4 h1:CJdIpo8n5MFP2MwK0gSRcOVlDlFdQJO1p+FqdxYzmvc= github.com/celestiaorg/merkletree v0.0.0-20210714075610-a84dc3ddbbe4/go.mod h1:fzuHnhzj1pUygGz+1ZkB3uQbEUL4htqCGJ4Qs2LwMZA= github.com/celestiaorg/nmt v0.17.0 h1:/k8YLwJvuHgT/jQ435zXKaDX811+sYEMXL4B/vYdSLU= @@ -303,8 +303,8 @@ github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5O github.com/docker/distribution v2.8.2+incompatible h1:T3de5rq0dB1j30rp0sA2rER+m322EBzniBPB6ZIzuh8= github.com/docker/distribution v2.8.2+incompatible/go.mod h1:J2gT2udsDAN96Uj4KfcMRqY0/ypR+oyYUYmja8H+y+w= github.com/docker/docker v1.4.2-0.20180625184442-8e610b2b55bf/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= -github.com/docker/docker v24.0.2+incompatible h1:eATx+oLz9WdNVkQrr0qjQ8HvRJ4bOOxfzEo8R+dA3cg= -github.com/docker/docker v24.0.2+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= +github.com/docker/docker v24.0.4+incompatible h1:s/LVDftw9hjblvqIeTiGYXBCD95nOEEl7qRsRrIOuQI= +github.com/docker/docker v24.0.4+incompatible/go.mod h1:eEKB0N0r5NX/I1kEveEz05bcu8tLC/8azJZsviup8Sk= github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKohAFqRJQ= github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4= diff --git a/test/e2e/node.go b/test/e2e/node.go index b27d0e0bd6..52a8e69b63 100644 --- a/test/e2e/node.go +++ b/test/e2e/node.go @@ -140,7 +140,7 @@ func (n *Node) Init(genesis types.GenesisDoc, peers []string) error { return err } - err = os.Chmod(nodeKeyFilePath, 0777) + err = os.Chmod(nodeKeyFilePath, 0o777) if err != nil { return fmt.Errorf("chmod node key: %w", err) } @@ -218,20 +218,12 @@ func (n Node) AddressP2P(withID bool) string { // Address returns an RPC endpoint address for the node. func (n Node) AddressRPC() string { - ip, err := n.Instance.GetIP() - if err != nil { - panic(err) - } - return fmt.Sprintf("%v:%d", ip, rpcPort) + return fmt.Sprintf("http://127.0.0.1:%d", n.rpcProxyPort) } // Address returns a GRPC endpoint address for the node. func (n Node) AddressGRPC() string { - ip, err := n.Instance.GetIP() - if err != nil { - panic(err) - } - return fmt.Sprintf("%v:%d", ip, grpcPort) + return fmt.Sprintf("127.0.0.1:%d", n.grpcProxyPort) } func (n Node) IsValidator() bool { @@ -239,7 +231,7 @@ func (n Node) IsValidator() bool { } func (n Node) Client() (*http.HTTP, error) { - return http.New(fmt.Sprintf("http://127.0.0.1:%v", n.rpcProxyPort), "/websocket") + return http.New(n.AddressRPC(), "/websocket") } func (n *Node) Start() error { diff --git a/test/e2e/simple_test.go b/test/e2e/simple_test.go index 48c3efcc58..20d782e72d 100644 --- a/test/e2e/simple_test.go +++ b/test/e2e/simple_test.go @@ -8,6 +8,7 @@ import ( "time" "github.com/celestiaorg/celestia-app/test/txsim" + "github.com/celestiaorg/celestia-app/test/util/testnode" "github.com/celestiaorg/knuu/pkg/knuu" "github.com/stretchr/testify/require" ) @@ -18,9 +19,6 @@ const ( ) func TestE2ESimple(t *testing.T) { - if !*e2eEnabled { - t.Skip("skipping e2e test. Use --e2e to run end to end tests") - } identifier := fmt.Sprintf("%s_%s", t.Name(), time.Now().Format("20060102_150405")) err := knuu.InitializeWithIdentifier(identifier) testnet := New(seed) @@ -29,7 +27,7 @@ func TestE2ESimple(t *testing.T) { }) require.NoError(t, testnet.CreateGenesisNodes(4, latestVersion, 10000000)) - kr, err := testnet.CreateGenesisAccount("alice", 10000000) + kr, err := testnet.CreateGenesisAccount("alice", 1e12) require.NoError(t, err) require.NoError(t, testnet.Setup()) @@ -40,6 +38,15 @@ func TestE2ESimple(t *testing.T) { ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) defer cancel() - err = txsim.Run(ctx, testnet.RPCEndpoints(), testnet.GRPCEndpoints(), kr, seed, 1*time.Second, sequences...) + err = txsim.Run(ctx, testnet.RPCEndpoints(), testnet.GRPCEndpoints(), kr, seed, 3*time.Second, sequences...) require.True(t, errors.Is(err, context.DeadlineExceeded), err.Error()) + + blockchain, err := testnode.ReadBlockchain(context.Background(), testnet.Node(0).AddressRPC()) + require.NoError(t, err) + + totalTxs := 0 + for _, block := range blockchain { + totalTxs += len(block.Data.Txs) + } + require.Greater(t, totalTxs, 10) } diff --git a/test/e2e/testnet.go b/test/e2e/testnet.go index 2950a9fd1c..66b2dbc4a3 100644 --- a/test/e2e/testnet.go +++ b/test/e2e/testnet.go @@ -1,8 +1,9 @@ package e2e import ( - "flag" + "context" "fmt" + "time" "github.com/celestiaorg/celestia-app/app" "github.com/celestiaorg/celestia-app/app/encoding" @@ -11,9 +12,6 @@ import ( "github.com/cosmos/cosmos-sdk/crypto/keyring" ) -// flag to enable e2e tests -var e2eEnabled = flag.Bool("e2e", false, "enable e2e tests") - type Testnet struct { seed int64 nodes []*Node @@ -144,6 +142,29 @@ func (t *Testnet) Start() error { return fmt.Errorf("node %s failed to start: %w", node.Name, err) } } + timer := time.NewTimer(time.Minute) + ticker := time.NewTicker(time.Second) + for _, node := range genesisNodes { + client, err := node.Client() + if err != nil { + return fmt.Errorf("failed to initialized node %s: %w", node.Name, err) + } + for { + select { + case <-timer.C: + return fmt.Errorf("node %s failed to start", node.Name) + case <-ticker.C: + resp, err := client.Status(context.Background()) + if err != nil { + return fmt.Errorf("node %s status response: %w", node.Name, err) + } + if resp.SyncInfo.LatestBlockHeight > 0 { + break + } + } + } + } + return nil } @@ -156,3 +177,7 @@ func (t *Testnet) Cleanup() error { } return nil } + +func (t *Testnet) Node(i int) *Node { + return t.nodes[i] +} diff --git a/x/qgb/types/query.pb.go b/x/qgb/types/query.pb.go index 02ca439127..1ab440ebc0 100644 --- a/x/qgb/types/query.pb.go +++ b/x/qgb/types/query.pb.go @@ -6,8 +6,8 @@ package types import ( context "context" fmt "fmt" - types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-proto" + types "github.com/cosmos/cosmos-sdk/codec/types" _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" From c437ad8eda6265b22e60efd96e52c4f9652a30a9 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 13 Jul 2023 18:06:59 +0200 Subject: [PATCH 10/14] finish test and update makefile --- Makefile | 2 +- test/e2e/setup.go | 9 ++------ test/e2e/simple_test.go | 23 +++++++++++--------- test/e2e/testnet.go | 48 +++++++++++++++++++---------------------- 4 files changed, 38 insertions(+), 44 deletions(-) diff --git a/Makefile b/Makefile index e1820d81cd..6f5fd22256 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,7 @@ test-short: test-e2e: @echo "--> Running e2e tests" - @go test -mod=readonly ./test/e2e/... --e2e + @E2E=true go test -mod=readonly ./test/e2e/... -timeout 30m .PHONY: test-e2e ## test-race: Run unit tests in race mode. diff --git a/test/e2e/setup.go b/test/e2e/setup.go index 6b59d96715..ce9ba5173c 100644 --- a/test/e2e/setup.go +++ b/test/e2e/setup.go @@ -142,13 +142,8 @@ func MakeConfig(node *Node) (*config.Config, error) { cfg.RPC.ListenAddress = "tcp://0.0.0.0:26657" cfg.P2P.ExternalAddress = fmt.Sprintf("tcp://%v", node.AddressP2P(false)) cfg.P2P.PersistentPeers = strings.Join(node.InitialPeers, ",") - - // TODO: when we use adaptive timeouts, add a parameter in the testnet manifest - // to set block times - // FIXME: This values get overridden by the timeout consts in the app package. - // We should modify this if we want to quicken the time of the blocks. - cfg.Consensus.TimeoutPropose = 1000 * time.Millisecond - cfg.Consensus.TargetHeightDuration = 300 * time.Millisecond + cfg.Consensus.TimeoutPropose = time.Second + cfg.Consensus.TimeoutCommit = time.Second return cfg, nil } diff --git a/test/e2e/simple_test.go b/test/e2e/simple_test.go index 20d782e72d..1fd2af3292 100644 --- a/test/e2e/simple_test.go +++ b/test/e2e/simple_test.go @@ -3,28 +3,31 @@ package e2e import ( "context" "errors" - "fmt" + "os" "testing" "time" "github.com/celestiaorg/celestia-app/test/txsim" "github.com/celestiaorg/celestia-app/test/util/testnode" - "github.com/celestiaorg/knuu/pkg/knuu" "github.com/stretchr/testify/require" ) const ( - latestVersion = "v1.0.0-rc4" - seed = 42 + latestVersion = "v1.0.0-rc9" + seed = 42 // the meaning of life ) +// This test runs a simple testnet with 4 validators. It submits both MsgPayForBlobs +// and MsgSends over 30 seconds and then asserts that at least 10 transactions were +// committed. func TestE2ESimple(t *testing.T) { - identifier := fmt.Sprintf("%s_%s", t.Name(), time.Now().Format("20060102_150405")) - err := knuu.InitializeWithIdentifier(identifier) - testnet := New(seed) - t.Cleanup(func() { - _ = testnet.Cleanup() - }) + if os.Getenv("E2E") == "" { + t.Skip("skipping e2e test") + } + + testnet, err := New(t.Name(), seed) + require.NoError(t, err) + t.Cleanup(testnet.Cleanup) require.NoError(t, testnet.CreateGenesisNodes(4, latestVersion, 10000000)) kr, err := testnet.CreateGenesisAccount("alice", 1e12) diff --git a/test/e2e/testnet.go b/test/e2e/testnet.go index 66b2dbc4a3..ad3a104662 100644 --- a/test/e2e/testnet.go +++ b/test/e2e/testnet.go @@ -7,26 +7,31 @@ import ( "github.com/celestiaorg/celestia-app/app" "github.com/celestiaorg/celestia-app/app/encoding" - "github.com/celestiaorg/celestia-app/test/txsim" + "github.com/celestiaorg/knuu/pkg/knuu" "github.com/cosmos/cosmos-sdk/crypto/hd" "github.com/cosmos/cosmos-sdk/crypto/keyring" + "github.com/rs/zerolog/log" ) type Testnet struct { seed int64 nodes []*Node genesisAccounts []*GenesisAccount - sequences []*txsim.Sequence keygen *keyGenerator } -func New(seed int64) *Testnet { +func New(name string, seed int64) (*Testnet, error) { + identifier := fmt.Sprintf("%s_%s", name, time.Now().Format("20060102_150405")) + if err := knuu.InitializeWithIdentifier(identifier); err != nil { + return nil, err + } + return &Testnet{ seed: seed, nodes: make([]*Node, 0), genesisAccounts: make([]*GenesisAccount, 0), keygen: newKeyGenerator(seed), - } + }, nil } func (t *Testnet) CreateGenesisNode(version string, selfDelegation int64) error { @@ -80,10 +85,6 @@ func (t *Testnet) CreateGenesisAccount(name string, tokens int64) (keyring.Keyri return kr, nil } -func (t *Testnet) SetSequences(sequences []*txsim.Sequence) { - t.sequences = sequences -} - func (t *Testnet) Setup() error { genesisNodes := make([]*Node, 0) for _, node := range t.nodes { @@ -142,40 +143,35 @@ func (t *Testnet) Start() error { return fmt.Errorf("node %s failed to start: %w", node.Name, err) } } - timer := time.NewTimer(time.Minute) - ticker := time.NewTicker(time.Second) for _, node := range genesisNodes { client, err := node.Client() if err != nil { return fmt.Errorf("failed to initialized node %s: %w", node.Name, err) } - for { - select { - case <-timer.C: - return fmt.Errorf("node %s failed to start", node.Name) - case <-ticker.C: - resp, err := client.Status(context.Background()) - if err != nil { - return fmt.Errorf("node %s status response: %w", node.Name, err) - } - if resp.SyncInfo.LatestBlockHeight > 0 { - break - } + for i := 0; i < 10; i++ { + resp, err := client.Status(context.Background()) + if err != nil { + return fmt.Errorf("node %s status response: %w", node.Name, err) + } + if resp.SyncInfo.LatestBlockHeight > 0 { + break + } + if i == 9 { + return fmt.Errorf("failed to start node %s", node.Name) } + time.Sleep(time.Second) } } - return nil } -func (t *Testnet) Cleanup() error { +func (t *Testnet) Cleanup() { for _, node := range t.nodes { err := node.Instance.Destroy() if err != nil { - return fmt.Errorf("node %s failed to cleanup: %w", node.Name, err) + log.Err(err).Msg(fmt.Sprintf("node %s failed to cleanup", node.Name)) } } - return nil } func (t *Testnet) Node(i int) *Node { From bae4d675a25f3eb3cb0359dc79f591c3c146a446 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Thu, 13 Jul 2023 18:25:08 +0200 Subject: [PATCH 11/14] update makefile --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index 6f5fd22256..a6b896e466 100644 --- a/Makefile +++ b/Makefile @@ -113,7 +113,7 @@ test-short: test-e2e: @echo "--> Running e2e tests" - @E2E=true go test -mod=readonly ./test/e2e/... -timeout 30m + @KNUU_NAMESPACE=app E2E=true go test -mod=readonly ./test/e2e/... -timeout 30m .PHONY: test-e2e ## test-race: Run unit tests in race mode. From 03a990b88131239b0f3f05631125cef918400a9d Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 17 Jul 2023 11:24:44 +0200 Subject: [PATCH 12/14] add a readme --- test/e2e/readme.md | 11 +++++++++++ x/qgb/types/query.pb.go | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/e2e/readme.md diff --git a/test/e2e/readme.md b/test/e2e/readme.md new file mode 100644 index 0000000000..a92d4f66af --- /dev/null +++ b/test/e2e/readme.md @@ -0,0 +1,11 @@ +# End to End Testing + +Celestia uses the [knuu](https://github.com/celestiaorg/knuu) framework to orchestrate clusters of nodes in a network for end to end testing. This relies on Docker and a kubeconfig to access the Kubernetes cluster. + +## Usage + +E2E tests can be simply run through go tests. They are distinguished from unit tets through an envornment variable. To run all e2e tests run: + +```shell +E2E=true go test ./test/e2e/... +``` diff --git a/x/qgb/types/query.pb.go b/x/qgb/types/query.pb.go index 1ab440ebc0..02ca439127 100644 --- a/x/qgb/types/query.pb.go +++ b/x/qgb/types/query.pb.go @@ -6,8 +6,8 @@ package types import ( context "context" fmt "fmt" - _ "github.com/cosmos/cosmos-proto" types "github.com/cosmos/cosmos-sdk/codec/types" + _ "github.com/cosmos/cosmos-proto" _ "github.com/cosmos/cosmos-sdk/types/query" _ "github.com/cosmos/gogoproto/gogoproto" grpc1 "github.com/gogo/protobuf/grpc" From 4f53156e14523d4034c6844b06aaadc0829f2036 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Mon, 17 Jul 2023 11:36:05 +0200 Subject: [PATCH 13/14] add more documentation --- Makefile | 3 ++- test/e2e/node.go | 10 +++++++--- test/e2e/readme.md | 8 ++++++-- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/Makefile b/Makefile index a6b896e466..6c7fe6a7a2 100644 --- a/Makefile +++ b/Makefile @@ -111,9 +111,10 @@ test-short: @go test -mod=readonly ./... -short .PHONY: test-short +## test-e2e: Run end to end tests via knuu. test-e2e: @echo "--> Running e2e tests" - @KNUU_NAMESPACE=app E2E=true go test -mod=readonly ./test/e2e/... -timeout 30m + @KNUU_NAMESPACE=celestia-app E2E=true go test -mod=readonly ./test/e2e/... -timeout 30m .PHONY: test-e2e ## test-race: Run unit tests in race mode. diff --git a/test/e2e/node.go b/test/e2e/node.go index 52a8e69b63..57bd165d6e 100644 --- a/test/e2e/node.go +++ b/test/e2e/node.go @@ -203,7 +203,9 @@ func (n *Node) Init(genesis types.GenesisDoc, peers []string) error { return n.Instance.Commit() } -// Address returns a P2P endpoint address for the node. +// AddressP2P returns a P2P endpoint address for the node. This is used for +// populating the address book. This will look something like: +// 3314051954fc072a0678ec0cbac690ad8676ab98@61.108.66.220:26656 func (n Node) AddressP2P(withID bool) string { ip, err := n.Instance.GetIP() if err != nil { @@ -216,12 +218,14 @@ func (n Node) AddressP2P(withID bool) string { return addr } -// Address returns an RPC endpoint address for the node. +// AddressRPC returns an RPC endpoint address for the node. +// This returns the local proxy port that can be used to communicate with the node func (n Node) AddressRPC() string { return fmt.Sprintf("http://127.0.0.1:%d", n.rpcProxyPort) } -// Address returns a GRPC endpoint address for the node. +// AddressGRPC returns a GRPC endpoint address for the node. This returns the +// local proxy port that can be used to communicate with the node func (n Node) AddressGRPC() string { return fmt.Sprintf("127.0.0.1:%d", n.grpcProxyPort) } diff --git a/test/e2e/readme.md b/test/e2e/readme.md index a92d4f66af..af43799516 100644 --- a/test/e2e/readme.md +++ b/test/e2e/readme.md @@ -1,11 +1,15 @@ # End to End Testing -Celestia uses the [knuu](https://github.com/celestiaorg/knuu) framework to orchestrate clusters of nodes in a network for end to end testing. This relies on Docker and a kubeconfig to access the Kubernetes cluster. +Celestia uses the [knuu](https://github.com/celestiaorg/knuu) framework to orchestrate clusters of nodes in a network for end to end testing. This relies on Docker and a kubeconfig (in `~/.kube/config`) to access the Kubernetes cluster. ## Usage E2E tests can be simply run through go tests. They are distinguished from unit tets through an envornment variable. To run all e2e tests run: ```shell -E2E=true go test ./test/e2e/... +E2E=true KNUU_NAMESPACE=celestia-app go test ./test/e2e/... -timeout 30m ``` + +## Observation + +Logs of each of the nodes are posted to Grafana and can be accessed through Celestia's dashboard (using the `celestia-app` namespace). From dd53ee15cca504c7105849370c37c25add84dc56 Mon Sep 17 00:00:00 2001 From: Callum Waters Date: Tue, 18 Jul 2023 10:00:54 +0200 Subject: [PATCH 14/14] Update test/e2e/readme.md Co-authored-by: CHAMI Rachid --- test/e2e/readme.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/e2e/readme.md b/test/e2e/readme.md index af43799516..dadd80bbbf 100644 --- a/test/e2e/readme.md +++ b/test/e2e/readme.md @@ -4,7 +4,7 @@ Celestia uses the [knuu](https://github.com/celestiaorg/knuu) framework to orche ## Usage -E2E tests can be simply run through go tests. They are distinguished from unit tets through an envornment variable. To run all e2e tests run: +E2E tests can be simply run through go tests. They are distinguished from unit tets through an environment variable. To run all e2e tests run: ```shell E2E=true KNUU_NAMESPACE=celestia-app go test ./test/e2e/... -timeout 30m