From 5db2d1f32d27ae9564bb201117e8f2d64bd673cd Mon Sep 17 00:00:00 2001 From: Tudor Malene Date: Thu, 9 May 2024 12:19:03 +0100 Subject: [PATCH] improve local testnet (#1903) --- go.mod | 6 + go.sum | 21 ++++ integration/eth2network/build_geth_binary.sh | 18 +-- integration/eth2network/eth2_binaries.go | 110 ++++++++++++++----- integration/eth2network/eth2_network.go | 22 ++-- testnet/launcher/eth2network/docker.go | 5 +- 6 files changed, 132 insertions(+), 50 deletions(-) diff --git a/go.mod b/go.mod index 1b31f6b8e2..0e64673930 100644 --- a/go.mod +++ b/go.mod @@ -7,6 +7,7 @@ replace github.com/docker/docker => github.com/docker/docker v20.10.3-0.20220224 require ( github.com/Microsoft/go-winio v0.6.1 github.com/andybalholm/brotli v1.1.0 + github.com/codeclysm/extract/v3 v3.1.1 github.com/deckarep/golang-set/v2 v2.6.0 github.com/dgraph-io/ristretto v0.1.1 github.com/docker/docker v25.0.4+incompatible @@ -102,11 +103,14 @@ require ( github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/gorilla/mux v1.8.1 // indirect + github.com/h2non/filetype v1.1.3 // indirect github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/huin/goupnp v1.3.0 // indirect github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/json-iterator/go v1.1.12 // indirect + github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5 // indirect + github.com/juju/loggo v1.0.0 // indirect github.com/klauspost/compress v1.17.7 // indirect github.com/klauspost/cpuid/v2 v2.2.7 // indirect github.com/kr/pretty v0.3.1 // indirect @@ -145,6 +149,7 @@ require ( github.com/twitchyliquid64/golang-asm v0.15.1 // indirect github.com/tyler-smith/go-bip39 v1.1.0 // indirect github.com/ugorji/go/codec v1.2.12 // indirect + github.com/ulikunitz/xz v0.5.11 // indirect github.com/valyala/bytebufferpool v1.0.0 // indirect github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect @@ -155,6 +160,7 @@ require ( golang.org/x/text v0.14.0 // indirect golang.org/x/tools v0.20.0 // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect + gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 // indirect gopkg.in/square/go-jose.v2 v2.6.0 // indirect gopkg.in/yaml.v3 v3.0.1 // indirect gotest.tools/v3 v3.5.1 // indirect diff --git a/go.sum b/go.sum index 307c1d4c18..ba44fffebf 100644 --- a/go.sum +++ b/go.sum @@ -13,6 +13,8 @@ github.com/allegro/bigcache v1.2.1 h1:hg1sY1raCwic3Vnsvje6TT7/pnZba83LeFck5NrFKS github.com/allegro/bigcache v1.2.1/go.mod h1:Cb/ax3seSYIx7SuZdm2G2xzfwmv3TPSk2ucNfQESPXM= github.com/andybalholm/brotli v1.1.0 h1:eLKJA0d02Lf0mVpIDgYnqXcUn0GqVmEFny3VuID1U3M= github.com/andybalholm/brotli v1.1.0/go.mod h1:sms7XGricyQI9K10gOSf56VKKWS4oLer58Q+mhRPtnY= +github.com/arduino/go-paths-helper v1.2.0 h1:qDW93PR5IZUN/jzO4rCtexiwF8P4OIcOmcSgAYLZfY4= +github.com/arduino/go-paths-helper v1.2.0/go.mod h1:HpxtKph+g238EJHq4geEPv9p+gl3v5YYu35Yb+w31Ck= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= github.com/bits-and-blooms/bitset v1.13.0 h1:bAQ9OPNFYbGHV6Nez0tmNI0RiEu7/hxlYJRUA0wFAVE= @@ -49,6 +51,8 @@ github.com/cockroachdb/redact v1.1.5 h1:u1PMllDkdFfPWaNGMyLD1+so+aq3uUItthCFqzwP github.com/cockroachdb/redact v1.1.5/go.mod h1:BVNblN9mBWFyMyqK1k3AAiSxhvhfK2oOZZ2lK+dpvRg= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 h1:zuQyyAKVxetITBuuhv3BI9cMrmStnpT18zmgmTxunpo= github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06/go.mod h1:7nc4anLGjupUW/PeY5qiNYsdNXj7zopG+eqsS7To5IQ= +github.com/codeclysm/extract/v3 v3.1.1 h1:iHZtdEAwSTqPrd+1n4jfhr1qBhUWtHlMTjT90+fJVXg= +github.com/codeclysm/extract/v3 v3.1.1/go.mod h1:ZJi80UG2JtfHqJI+lgJSCACttZi++dHxfWuPaMhlOfQ= github.com/consensys/bavard v0.1.13 h1:oLhMLOFGTLdlda/kma4VOJazblc7IM5y5QPd2A/YjhQ= github.com/consensys/bavard v0.1.13/go.mod h1:9ItSMtA/dXMAiL7BG6bqW2m3NdSEObYWoH223nGHukI= github.com/consensys/gnark-crypto v0.12.1 h1:lHH39WuuFgVHONRl3J0LRBtuYdQTumFSDtJF7HpyG8M= @@ -184,6 +188,8 @@ github.com/gorilla/mux v1.8.1 h1:TuBL49tXwgrFYWhqrNgrUNEY92u81SPhu7sTdzQEiWY= github.com/gorilla/mux v1.8.1/go.mod h1:AKf9I4AEqPTmMytcMc0KkNouC66V3BtZ4qD5fmWSiMQ= github.com/gorilla/websocket v1.5.1 h1:gmztn0JnHVt9JZquRuzLw3g4wouNVzKL15iLr/zn/QY= github.com/gorilla/websocket v1.5.1/go.mod h1:x3kM2JMyaluk02fnUJpQuwD2dCS5NDG2ZHL0uE0tcaY= +github.com/h2non/filetype v1.1.3 h1:FKkx9QbD7HR/zjK1Ia5XiBsq9zdLi5Kf3zGyFTAFkGg= +github.com/h2non/filetype v1.1.3/go.mod h1:319b3zT68BvV+WRj7cwy856M2ehB3HqNOt6sy1HndBY= github.com/hashicorp/go-bexpr v0.1.14 h1:uKDeyuOhWhT1r5CiMTjdVY4Aoxdxs6EtwgTGnlosyp4= github.com/hashicorp/go-bexpr v0.1.14/go.mod h1:gN7hRKB3s7yT+YvTdnhZVLTENejvhlkZ8UE4YVBS+Q8= github.com/hashicorp/golang-lru/v2 v2.0.7 h1:a+bsQ5rvGLjzHuww6tVxozPZFVghXaHOwFs4luLUK2k= @@ -203,6 +209,13 @@ github.com/jolestar/go-commons-pool/v2 v2.1.2 h1:E+XGo58F23t7HtZiC/W6jzO2Ux2IccS github.com/jolestar/go-commons-pool/v2 v2.1.2/go.mod h1:r4NYccrkS5UqP1YQI1COyTZ9UjPJAAGTUxzcsK1kqhY= 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/juju/ansiterm v0.0.0-20180109212912-720a0952cc2a/go.mod h1:UJSiEoRfvx3hP73CvoARgeLjaIOjybY9vj8PUPPFGeU= +github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5 h1:rhqTjzJlm7EbkELJDKMTU7udov+Se0xZkWmugr6zGok= +github.com/juju/errors v0.0.0-20181118221551-089d3ea4e4d5/go.mod h1:W54LbzXuIE0boCoNJfwqpmkKJ1O4TCTZMetAt6jGk7Q= +github.com/juju/loggo v1.0.0 h1:Y6ZMQOGR9Aj3BGkiWx7HBbIx6zNwNkxhVNOHU2i1bl0= +github.com/juju/loggo v1.0.0/go.mod h1:NIXFioti1SmKAlKNuUwbMenNdef59IF52+ZzuOmHYkg= +github.com/juju/testing v0.0.0-20200510222523-6c8c298c77a0 h1:+WWUkhnTjV6RNOxkcwk79qrjeyHEHvBzlneueBsatX4= +github.com/juju/testing v0.0.0-20200510222523-6c8c298c77a0/go.mod h1:hpGvhGHPVbNBraRLZEhoQwFLMrjK8PSlO4D3nDjKYXo= github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/compress v1.17.7 h1:ehO88t2UGzQK66LMdE8tibEd1ErmzZjNEqWkjLAKQQg= @@ -223,8 +236,11 @@ github.com/leodido/go-urn v1.4.0 h1:WT9HwE9SGECu3lg4d/dIA+jxlljEa1/ffXKmRjqdmIQ= github.com/leodido/go-urn v1.4.0/go.mod h1:bvxc+MVxLKB4z00jd1z+Dvzr47oO32F/QSNjSBOlFxI= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= +github.com/lunixbochs/vtclean v0.0.0-20160125035106-4fbf7632a2c6/go.mod h1:pHhQNgMf3btfWnGBVipUOjRYhoOsdGqdm/+2c2E2WMI= +github.com/mattn/go-colorable v0.0.6/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU= github.com/mattn/go-colorable v0.1.13 h1:fFA4WZxdEF4tXPZVKMLwD8oUnCTTo08duU7wxecdEvA= github.com/mattn/go-colorable v0.1.13/go.mod h1:7S9/ev0klgBDR4GtXTXX8a3vIGJpMovkB8vQcUbaXHg= +github.com/mattn/go-isatty v0.0.0-20160806122752-66b8e73f3f5c/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= @@ -341,6 +357,8 @@ github.com/tyler-smith/go-bip39 v1.1.0 h1:5eUemwrMargf3BSLRRCalXT93Ns6pQJIjYQN2n github.com/tyler-smith/go-bip39 v1.1.0/go.mod h1:gUYDtqQw1JS3ZJ8UWVcGTGqqr6YIN3CWg+kkNaLt55U= github.com/ugorji/go/codec v1.2.12 h1:9LC83zGrHhuUA9l16C9AHXAqEV/2wBQ4nkvumAE65EE= github.com/ugorji/go/codec v1.2.12/go.mod h1:UNopzCgEMSXjBc6AOMqYvWC1ktqTAfzJZUZgYf6w6lg= +github.com/ulikunitz/xz v0.5.11 h1:kpFauv27b6ynzBNT/Xy+1k+fK4WswhN/6PN5WhFAGw8= +github.com/ulikunitz/xz v0.5.11/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14= github.com/urfave/cli/v2 v2.27.1 h1:8xSQ6szndafKVRmfyeUMxkNUJQMjL1F2zmsZ+qHpfho= github.com/urfave/cli/v2 v2.27.1/go.mod h1:8qnjx1vcq5s2/wpsqoZFndg2CE5tNFyrTvS6SinrnYQ= github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw= @@ -445,9 +463,12 @@ google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2 google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI= google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20160105164936-4f90aeace3a2/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys= +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22 h1:VpOs+IwYnYBaFnrNAeB8UUWtL3vEUnzSCL1nVjPhqrw= +gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA= gopkg.in/natefinch/lumberjack.v2 v2.2.1 h1:bBRl1b0OH9s/DuPhuXpNl+VtCaJXFZ5/uEFST95x9zc= gopkg.in/natefinch/lumberjack.v2 v2.2.1/go.mod h1:YD8tP3GAjkrDg1eZH7EGmyESg/lsYskCTPBJVb9jqSc= gopkg.in/square/go-jose.v2 v2.6.0 h1:NGk74WTnPKBNUhNzQX7PYcTLUjoq7mzKk2OKbvwk2iI= diff --git a/integration/eth2network/build_geth_binary.sh b/integration/eth2network/build_geth_binary.sh index 5d70c83b4c..6741f36af1 100755 --- a/integration/eth2network/build_geth_binary.sh +++ b/integration/eth2network/build_geth_binary.sh @@ -4,12 +4,14 @@ # This script downloads and builds geth from source # Requires to specify the version to clone # +echo "build geth binary" help_and_exit() { echo "" - echo "Usage: $(basename "${0}") --version=v1.14.0 " + echo "Usage: $(basename "${0}") --version=v1.14.0 --output=path_to_output" echo "" echo " version *Required* Set the version of geth to build" + echo " output *Required* Where to copy the binary" echo "" echo "" exit 1 # Exit with error explicitly @@ -24,9 +26,6 @@ build_path="${script_path}/../.build" geth_repo_path="${build_path}/geth_repo" geth_repo_bin_path="${geth_repo_path}/build/bin/geth" -# Define defaults -geth_path="${build_path}/eth2_bin" - # Fetch options for argument in "$@" do @@ -35,6 +34,7 @@ do case "$key" in --version) geth_version=${value} ;; + --output) geth_path=${value} ;; --help) help_and_exit ;; *) esac @@ -48,13 +48,6 @@ fi # Make sure .build folder exists mkdir -p "${build_path}" -# Only download geth code if binary does not exist -if [ -f "${geth_path}/geth-${geth_version}" ] -then - echo "Skipping geth build - Found binary at ${geth_path}/geth-${geth_version}" - exit 0 -fi - # Clone geth source code if the path is empty if [ -d "${geth_repo_path}" ] then @@ -65,11 +58,12 @@ fi # Build geth binary cd "${geth_repo_path}" +export GOROOT= make geth # Copy binary to the correct path mkdir -p "${geth_path}" -cp "${geth_repo_bin_path}" "${geth_path}/geth-${geth_version}" +cp "${geth_repo_bin_path}" "${geth_path}/geth" cd .. diff --git a/integration/eth2network/eth2_binaries.go b/integration/eth2network/eth2_binaries.go index a75e3d18c9..eb8ffa10ab 100644 --- a/integration/eth2network/eth2_binaries.go +++ b/integration/eth2network/eth2_binaries.go @@ -1,6 +1,7 @@ package eth2network import ( + "context" "fmt" "io" "net/http" @@ -9,11 +10,14 @@ import ( "path" "path/filepath" "runtime" + "strings" "sync" + + "github.com/codeclysm/extract/v3" ) const ( - _gethVersion = "1.12.2" + _gethVersion = "1.12.2-bed84606" _prysmVersion = "v4.0.6" ) @@ -37,43 +41,88 @@ func EnsureBinariesExist() (string, error) { panic(err) } - // build geth - if !fileExists(path.Join(basepath, _eth2BinariesRelPath, _gethFileNameVersion)) { - gethScript := path.Join(basepath, "./build_geth_binary.sh") - cmd := exec.Command("bash", gethScript, fmt.Sprintf("%s=%s", "--version", "v"+_gethVersion)) - cmd.Stderr = os.Stderr - - if out, err := cmd.Output(); err != nil { - fmt.Printf("%s\n", out) - return "", err + var wg sync.WaitGroup + prysmaticURL := fmt.Sprintf("https://github.com/prysmaticlabs/prysm/releases/download/%s/", _prysmVersion) + wg.Add(4) + go func() { + defer wg.Done() + err := checkOrDownloadBinary(_prysmBeaconChainFileNameVersion, fmt.Sprintf("%s%s", prysmaticURL, _prysmBeaconChainFileNameVersion), false) + if err != nil { + panic(err) } - } - - // download prysm files - for fileName, downloadURL := range map[string]string{ - _prysmBeaconChainFileNameVersion: fmt.Sprintf("https://github.com/prysmaticlabs/prysm/releases/download/%s/beacon-chain-%s-%s-%s", _prysmVersion, _prysmVersion, runtime.GOOS, runtime.GOARCH), - _prysmCTLFileNameVersion: fmt.Sprintf("https://github.com/prysmaticlabs/prysm/releases/download/%s/prysmctl-%s-%s-%s", _prysmVersion, _prysmVersion, runtime.GOOS, runtime.GOARCH), - _prysmValidatorFileNameVersion: fmt.Sprintf("https://github.com/prysmaticlabs/prysm/releases/download/%s/validator-%s-%s-%s", _prysmVersion, _prysmVersion, runtime.GOOS, runtime.GOARCH), - } { - expectedFilePath := path.Join(basepath, _eth2BinariesRelPath, fileName) - if !fileExists(expectedFilePath) { - err := downloadFile(expectedFilePath, downloadURL) - if err != nil { - return "", err + }() + go func() { + defer wg.Done() + err := checkOrDownloadBinary(_prysmCTLFileNameVersion, fmt.Sprintf("%s%s", prysmaticURL, _prysmCTLFileNameVersion), false) + if err != nil { + panic(err) + } + }() + go func() { + defer wg.Done() + err := checkOrDownloadBinary(_prysmValidatorFileNameVersion, fmt.Sprintf("%s%s", prysmaticURL, _prysmValidatorFileNameVersion), false) + if err != nil { + panic(err) + } + }() + go func() { + defer wg.Done() + err := checkOrDownloadBinary(_gethFileNameVersion, fmt.Sprintf("https://gethstore.blob.core.windows.net/builds/%s.tar.gz", _gethFileNameVersion), true) + if err != nil { + // geth 1.12 is not available to download for the mac, so we have to build it + println("Cannot download geth binary. Compiling from source.") + gethScript := path.Join(basepath, "./build_geth_binary.sh") + + v := strings.Split(_gethVersion, "-") + cmd := exec.Command( + "bash", + gethScript, + fmt.Sprintf("%s=%s", "--version", "v"+v[0]), + fmt.Sprintf("%s=%s", "--output", path.Join(basepath, _eth2BinariesRelPath, _gethFileNameVersion)), + ) + cmd.Stderr = os.Stderr + + if out, err := cmd.Output(); err != nil { + fmt.Printf("%s\n", out) + panic(err) } - fmt.Printf("Downloaded - %s\n", fileName) } - } + }() + wg.Wait() return path.Join(basepath, _eth2BinariesRelPath), nil } -func fileExists(filename string) bool { - info, err := os.Stat(filename) - if os.IsNotExist(err) { - return false +func checkOrDownloadBinary(fileName string, url string, unTar bool) error { + expectedFilePath := path.Join(basepath, _eth2BinariesRelPath, fileName) + if fileExists(expectedFilePath) { + return nil } - return !info.IsDir() + suffix := "" + if unTar { + suffix = ".tar.gz" + } + err := downloadFile(expectedFilePath+suffix, url) + if err != nil { + return err + } + if unTar { + f, err := os.Open(expectedFilePath + suffix) + if err != nil { + return err + } + err = extract.Gz(context.TODO(), f, path.Join(basepath, _eth2BinariesRelPath), nil) + if err != nil { + return err + } + } + fmt.Printf("Downloaded - %s\n", expectedFilePath) + return nil +} + +func fileExists(filename string) bool { + _, err := os.Stat(filename) + return !os.IsNotExist(err) } func downloadFile(filepath string, url string) error { @@ -94,6 +143,7 @@ func downloadFile(filepath string, url string) error { // Check server response if resp.StatusCode != http.StatusOK { + os.Remove(filepath) return fmt.Errorf("bad status: %s", resp.Status) } diff --git a/integration/eth2network/eth2_network.go b/integration/eth2network/eth2_network.go index 3df24cf311..b3fdad4fcd 100644 --- a/integration/eth2network/eth2_network.go +++ b/integration/eth2network/eth2_network.go @@ -9,6 +9,7 @@ import ( "os" "os/exec" "path" + "runtime" "strconv" "strings" "time" @@ -23,12 +24,19 @@ import ( ) const ( - _dataDirFlag = "--datadir" - _eth2BinariesRelPath = "../.build/eth2_bin" - _gethFileNameVersion = "geth-v" + _gethVersion - _prysmBeaconChainFileNameVersion = "beacon-chain-" + _prysmVersion - _prysmCTLFileNameVersion = "prysmctl-" + _prysmVersion - _prysmValidatorFileNameVersion = "validator-" + _prysmVersion + _eth2BinariesRelPath = "../.build/eth2_bin" + _dataDirFlag = "--datadir" + _gethBinaryName = "geth" +) + +// https://gethstore.blob.core.windows.net/builds/geth-darwin-amd64-1.14.2-35b2d07f.tar.gz +var _gethFileNameVersion = fmt.Sprintf("geth-%s-%s-%s", runtime.GOOS, runtime.GOARCH, _gethVersion) + +// https://github.com/prysmaticlabs/prysm/releases/download/v4.0.6/ +var ( + _prysmBeaconChainFileNameVersion = fmt.Sprintf("beacon-chain-%s-%s-%s", _prysmVersion, runtime.GOOS, runtime.GOARCH) + _prysmCTLFileNameVersion = fmt.Sprintf("prysmctl-%s-%s-%s", _prysmVersion, runtime.GOOS, runtime.GOARCH) + _prysmValidatorFileNameVersion = fmt.Sprintf("validator-%s-%s-%s", _prysmVersion, runtime.GOOS, runtime.GOARCH) ) type Impl struct { @@ -93,7 +101,7 @@ func NewEth2Network( prysmGenesisPath := path.Join(buildDir, "genesis.ssz") prysmConfigPath := path.Join(buildDir, "prysm_chain_config.yml") - gethBinaryPath := path.Join(binDir, _gethFileNameVersion) + gethBinaryPath := path.Join(binDir, _gethFileNameVersion, _gethBinaryName) prysmBeaconBinaryPath := path.Join(binDir, _prysmBeaconChainFileNameVersion) prysmBinaryPath := path.Join(binDir, _prysmCTLFileNameVersion) prysmValidatorBinaryPath := path.Join(binDir, _prysmValidatorFileNameVersion) diff --git a/testnet/launcher/eth2network/docker.go b/testnet/launcher/eth2network/docker.go index 144e13dbf4..0a2b5d4e4e 100644 --- a/testnet/launcher/eth2network/docker.go +++ b/testnet/launcher/eth2network/docker.go @@ -45,7 +45,10 @@ func (n *Eth2Network) Start() error { exposedPorts = append(exposedPorts, n.cfg.gethWSPort) } - _, err := docker.StartNewContainer("eth2network", "testnetobscuronet.azurecr.io/obscuronet/eth2network:latest", cmds, exposedPorts, nil, nil, nil) + // keep a volume of binaries to avoid downloading + volume := map[string]string{"eth2_bin": "/home/obscuro/go-obscuro/integration/.build/eth2_bin/"} + + _, err := docker.StartNewContainer("eth2network", "testnetobscuronet.azurecr.io/obscuronet/eth2network:latest", cmds, exposedPorts, nil, nil, volume) return err }