remove minimal_devnet

This commit is contained in:
Evan Gray 2022-07-15 11:59:24 -04:00
parent 22cb3f0868
commit b669228722
7 changed files with 0 additions and 494 deletions

View File

@ -1,43 +0,0 @@
# Bare bones linux
FROM alpine:3.8 AS checkout
# Update apline linux and add git.
RUN apk update && apk upgrade && apk add --no-cache git openssh
# Clone the wormhole repo.
RUN mkdir /app && cd /app && git clone https://github.com/certusone/wormhole.git . && git checkout tags/v2.6.0
# syntax=docker.io/docker/dockerfile:experimental@sha256:de85b2f3a3e8a2f7fe48e8e84a65f6fdd5cd5183afa6412fff9caa6871649c44
FROM docker.io/golang:1.17.0@sha256:06e92e576fc7a7067a268d47727f3083c0a564331bfcbfdde633157fc91fb17d AS go-tools
COPY --from=checkout /app /app
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
cd /app/tools && CGO_ENABLED=0 ./build.sh
# syntax=docker.io/docker/dockerfile:experimental@sha256:de85b2f3a3e8a2f7fe48e8e84a65f6fdd5cd5183afa6412fff9caa6871649c44
FROM docker.io/golang:1.17.0@sha256:06e92e576fc7a7067a268d47727f3083c0a564331bfcbfdde633157fc91fb17d AS go-build
COPY --from=go-tools /app /app
RUN --mount=type=cache,target=/root/.cache \
cd /app && \
tools/bin/buf lint && \
tools/bin/buf generate
# RUN cp /app/node/pkg/proto /app/pkg/proto
# syntax=docker.io/docker/dockerfile:experimental@sha256:de85b2f3a3e8a2f7fe48e8e84a65f6fdd5cd5183afa6412fff9caa6871649c44
FROM docker.io/golang:1.17.0@sha256:06e92e576fc7a7067a268d47727f3083c0a564331bfcbfdde633157fc91fb17d
WORKDIR /app/node
COPY --from=go-build /app /app
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
cd tools/ && go build -mod=readonly -o /dlv github.com/go-delve/delve/cmd/dlv
RUN --mount=type=cache,target=/root/.cache --mount=type=cache,target=/go \
go build -race -gcflags="all=-N -l" -mod=readonly -o /guardiand github.com/certusone/wormhole/node
RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && chmod +x wait-for-it.sh

View File

@ -1,97 +0,0 @@
# Bare bones linux
FROM alpine:3.8 AS checkout
# Update apline linux and add git.
RUN apk update && apk upgrade && apk add --no-cache git openssh
# Clone the wormhole repo.
RUN mkdir /app && cd /app && git clone https://github.com/certusone/wormhole.git .
# syntax=docker.io/docker/dockerfile:1.3@sha256:42399d4635eddd7a9b8a24be879d2f9a930d0ed040a61324cfdf59ef1357b3b2
FROM docker.io/library/rust:1.49@sha256:a50165ea96983c21832578afb1c8c028674c965bc1ed43b607871b1f362e06a5 AS build
RUN apt-get update && apt-get install -y libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang
RUN rustup component add rustfmt
RUN rustup default nightly-2021-08-01
WORKDIR /usr/src/bridge
RUN cargo install wasm-pack --vers 0.9.1
ENV RUST_LOG="solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=trace,solana_bpf_loader=debug,solana_rbpf=debug"
ENV EMITTER_ADDRESS="11111111111111111111111111111115"
ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"
COPY --from=checkout /app/solana/bridge bridge
COPY --from=checkout /app/solana/modules modules
COPY --from=checkout /app/solana/solitaire solitaire
COPY --from=checkout /app/solana/migration migration
COPY --from=checkout /app/solana/pyth2wormhole pyth2wormhole
# Compile Wormhole
RUN cd bridge/program && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm
# Compile Token Bridge
RUN cd modules/token_bridge/program && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm
# Compile NFT Bridge
RUN cd modules/nft_bridge/program && /usr/local/cargo/bin/wasm-pack build --target nodejs -d nodejs -- --features wasm
#syntax=docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313c3e2230a333fdbcc
FROM docker.io/library/rust:1.49@sha256:a50165ea96983c21832578afb1c8c028674c965bc1ed43b607871b1f362e06a5
RUN apt-get update && apt-get install -yq libssl-dev libudev-dev pkg-config zlib1g-dev llvm clang ncat
RUN curl -fsSL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
RUN curl -sSfL https://release.solana.com/v1.8.1/install | sh
RUN rustup default nightly-2021-08-01
RUN rustup component add rustfmt
RUN cargo install --version =2.0.12 spl-token-cli
ENV SOLANA_BIN_PATH="/root/.local/share/solana/install/active_release/bin"
ENV PATH="$SOLANA_BIN_PATH:$PATH"
COPY --from=checkout /app/ethereum /usr/src/ethereum
WORKDIR /usr/src/ethereum
RUN npm ci
COPY --from=checkout /app/clients/token_bridge /usr/src/clients/token_bridge
COPY --from=build /usr/src/bridge/bridge/program/nodejs /usr/src/clients/token_bridge/pkg/core
COPY --from=build /usr/src/bridge/modules/token_bridge/program/nodejs /usr/src/clients/token_bridge/pkg/token
WORKDIR /usr/src/clients/token_bridge
RUN sed -i 's/localhost/solana-devnet/g' main.ts
RUN set -xe && \
npm ci && \
npm run build-contracts && \
npm run build
COPY --from=checkout /app/clients/nft_bridge /usr/src/clients/nft_bridge
COPY --from=build /usr/src/bridge/bridge/program/nodejs /usr/src/clients/nft_bridge/pkg/core
COPY --from=build /usr/src/bridge/modules/nft_bridge/program/nodejs /usr/src/clients/nft_bridge/pkg/nft
WORKDIR /usr/src/clients/nft_bridge
RUN sed -i 's/localhost/solana-devnet/g' main.ts
RUN set -xe && \
npm ci && \
npm run build-contracts && \
npm run build
COPY --from=checkout /app/solana /usr/src/solana
COPY --from=checkout /app/proto /usr/src/proto
WORKDIR /usr/src/solana
RUN sed -i 's/127.0.0.1/solana-devnet/g' devnet_setup.sh
RUN solana config set --keypair "/usr/src/solana/keys/solana-devnet.json"
RUN solana config set --url "http://solana-devnet:8899"
ENV EMITTER_ADDRESS="11111111111111111111111111111115"
ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"
RUN set -xe && \
cargo build --manifest-path ./bridge/Cargo.toml --package client --release && \
cargo build --manifest-path ./modules/token_bridge/Cargo.toml --package client --release && \
cp bridge/target/release/client /usr/local/bin && \
cp modules/token_bridge/target/release/client /usr/local/bin/token-bridge-client
RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && chmod +x wait-for-it.sh

View File

@ -1,30 +0,0 @@
# Bare bones linux
FROM alpine:3.8 AS checkout
# Update apline linux and add git.
RUN apk update && apk upgrade && apk add --no-cache git openssh
# Clone the wormhole repo.
RUN mkdir /app && cd /app && git clone https://github.com/certusone/wormhole.git .
FROM node:lts-alpine
# we need support for gyp
RUN apk add git openssh python3 make gcc g++ build-base bash
# Run as user, otherwise, npx explodes.
USER 1000
RUN mkdir -p /home/node/app
WORKDIR /home/node/app
# Only invalidate the npm install step if package.json changed
COPY --from=checkout --chown=node:node /app/ethereum/package.json .
COPY --from=checkout --chown=node:node /app/ethereum/package-lock.json .
COPY --from=checkout --chown=node:node /app/ethereum/.env.test .env
RUN npm ci
COPY --from=checkout --chown=node:node /app/ethereum .
ADD --chown=node:node truffle-config.js .
RUN wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && chmod +x wait-for-it.sh

View File

@ -1,76 +0,0 @@
# Bare bones linux
FROM alpine:3.8 AS checkout
# Update apline linux and add git.
RUN apk update && apk upgrade && apk add --no-cache git openssh
# Clone the wormhole repo.
RUN mkdir /app && cd /app && git clone https://github.com/certusone/wormhole.git .
#syntax=docker/dockerfile:1.2@sha256:e2a8561e419ab1ba6b2fe6cbdf49fd92b95912df1cf7d313c3e2230a333fdbcc
FROM docker.io/library/rust:1.49@sha256:a50165ea96983c21832578afb1c8c028674c965bc1ed43b607871b1f362e06a5
RUN apt-get update && \
apt-get install -y \
clang \
libssl-dev \
libudev-dev \
llvm \
pkg-config \
zlib1g-dev \
&& \
rm -rf /var/lib/apt/lists/* && \
rustup component add rustfmt && \
rustup default nightly-2021-08-01
RUN sh -c "$(curl -sSfL https://release.solana.com/v1.8.1/install)"
ENV PATH="/root/.local/share/solana/install/active_release/bin:$PATH"
# Solana does a questionable download at the beginning of a *first* build-bpf call. Trigger and layer-cache it explicitly.
RUN cargo init --lib /tmp/decoy-crate && \
cd /tmp/decoy-crate && cargo build-bpf && \
rm -rf /tmp/decoy-crate
# Cache Pyth sources
# This comes soon after mainnet-v2.1
ENV PYTH_SRC_REV=31e3188bbf52ec1a25f71e4ab969378b27415b0a
ENV PYTH_DIR=/usr/src/pyth/pyth-client
WORKDIR $PYTH_DIR
ADD https://github.com/pyth-network/pyth-client/archive/$PYTH_SRC_REV.tar.gz .
# GitHub appends revision to dir in archive
RUN tar -xvf *.tar.gz && rm -rf *.tar.gz && mv pyth-client-$PYTH_SRC_REV pyth-client
# Add bridge contract sources
WORKDIR /usr/src/bridge
COPY --from=checkout /app/solana .
RUN mkdir -p /opt/solana/deps
ENV EMITTER_ADDRESS="11111111111111111111111111111115"
ENV BRIDGE_ADDRESS="Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o"
# Build Wormhole Solana programs
RUN cargo build-bpf --manifest-path "bridge/program/Cargo.toml" && \
cargo build-bpf --manifest-path "bridge/cpi_poster/Cargo.toml" && \
cargo build-bpf --manifest-path "modules/token_bridge/program/Cargo.toml" && \
cargo build-bpf --manifest-path "pyth2wormhole/program/Cargo.toml" && \
cargo build-bpf --manifest-path "modules/nft_bridge/program/Cargo.toml" && \
cargo build-bpf --manifest-path "migration/Cargo.toml" && \
cp bridge/target/deploy/bridge.so /opt/solana/deps/bridge.so && \
cp bridge/target/deploy/cpi_poster.so /opt/solana/deps/cpi_poster.so && \
cp migration/target/deploy/wormhole_migration.so /opt/solana/deps/wormhole_migration.so && \
cp modules/token_bridge/target/deploy/token_bridge.so /opt/solana/deps/token_bridge.so && \
cp modules/nft_bridge/target/deploy/nft_bridge.so /opt/solana/deps/nft_bridge.so && \
cp modules/token_bridge/token-metadata/spl_token_metadata.so /opt/solana/deps/spl_token_metadata.so && \
cp pyth2wormhole/target/deploy/pyth2wormhole.so /opt/solana/deps/pyth2wormhole.so
# Build the Pyth Solana program
WORKDIR $PYTH_DIR/pyth-client/program
RUN make SOLANA=~/.local/share/solana/install/active_release/bin OUT_DIR=../target && \
cp ../target/oracle.so /opt/solana/deps/pyth_oracle.so
ENV RUST_LOG="solana_runtime::system_instruction_processor=trace,solana_runtime::message_processor=trace,solana_bpf_loader=debug,solana_rbpf=debug"
ENV RUST_BACKTRACE=1

View File

@ -1,40 +0,0 @@
# Minimal Devnet
A development Wormhole network using Docker Compose that consists of 2 Ethereum nodes and 1 Guardian
## Install
Docker Compose is included with Docker Desktop, but if you are on Linux and don't have it, run the following commands (from [https://docs.docker.com/compose/install/]())
```bash
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
```
## Build
```bash
# No Solana:
docker-compose build --no-cache
# Include Solana:
docker-compose --profile solana build --no-cache
```
## Start
```bash
# No Solana:
docker-compose up
# Include Solana:
docker-compose --profile solana up
```
The network is ready when you see logs from `guardian_1`
## Stop / Teardown
`Ctrl+c`
```bash
docker-compose down
```

View File

@ -1,174 +0,0 @@
services:
guardian:
build:
context: .
dockerfile: Dockerfile
cap_add:
- IPC_LOCK
hostname: guardian-0
ports:
- "7070:7070"
- "7071:7071"
command:
- ./wait-for-it.sh
- -t
- "0"
- eth1-deploy:2000
- --
- ./wait-for-it.sh
- -t
- "0"
- eth2-deploy:2000
- --
- /guardiand
- node
- --ethRPC
- ws://eth1:8545
- --bscRPC
- ws://eth2:8546
- --polygonRPC
- ws://eth1:8545
- --avalancheRPC
- ws://eth1:8545
- --terraWS
- ws://terra-terrad:26657/websocket
- --terraLCD
- http://terra-lcd:1317
- --terraContract
- terra18vd8fpwxzck93qlwghaj6arh4p7c5n896xzem5
- --solanaContract
- Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o
- --solanaWS
- ws://solana-devnet:8900
- --solanaRPC
- http://solana-devnet:8899
- --unsafeDevMode
- --guardianKey
- /tmp/bridge.key
- --publicRPC
- "[::]:7070"
- --publicWeb
- "[::]:7071"
- --adminSocket
- /tmp/admin.sock
- --dataDir
- /tmp/data
depends_on:
- eth1
- eth2
eth1:
build:
context: .
dockerfile: Dockerfile.eth
ports:
- "8545:8545"
command:
- npx
- ganache-cli
- -e 10000
- --deterministic
- --time="1970-01-01T00:00:00+00:00"
- --host=0.0.0.0
eth1-deploy:
build:
context: .
dockerfile: Dockerfile.eth
command:
- /bin/sh
- -c
- "./wait-for-it.sh -t 0 eth1:8545 -- mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && npx truffle migrate && npx truffle exec scripts/deploy_test_token.js && npx truffle exec scripts/register_bsc_chain.js && nc -lkp 2000 0.0.0.0"
depends_on:
- eth1
eth1-mine:
build:
context: .
dockerfile: Dockerfile.eth
command:
- /bin/sh
- -c
- "npx truffle exec mine.js"
depends_on:
- eth1
eth2:
build:
context: .
dockerfile: Dockerfile.eth
ports:
- "8546:8546"
command:
- npx
- ganache-cli
- -e 10000
- --deterministic
- --time="1970-01-01T00:00:00+00:00"
- --host=0.0.0.0
- --chainId=1397
- --port=8546
eth2-deploy:
build:
context: .
dockerfile: Dockerfile.eth
command:
- /bin/sh
- -c
- "./wait-for-it.sh -t 0 eth2:8546 -- sed -i 's/CHAIN_ID=0x2/CHAIN_ID=0x4/g' .env && mkdir -p build/contracts && cp node_modules/@openzeppelin/contracts/build/contracts/* build/contracts/ && npx truffle migrate --network development2 && npx truffle exec scripts/deploy_test_token.js --network development2 && npx truffle exec scripts/register_eth_chain.js --network development2 && nc -lkp 2000 0.0.0.0"
depends_on:
- eth2
eth2-mine:
build:
context: .
dockerfile: Dockerfile.eth
command:
- /bin/sh
- -c
- "npx truffle exec mine.js --network development2"
depends_on:
- eth2
solana-devnet:
build:
context: .
dockerfile: Dockerfile.solana
profiles:
- solana
ports:
- "1027:1027/udp"
- "8899:8899"
- "8900:8900"
- "9900:9900"
command:
- /root/.local/share/solana/install/active_release/bin/solana-test-validator
- --bpf-program
- Bridge1p5gheXUvJ6jGWGeCsgPKgnE3YgdGKRVCMY9o
- /opt/solana/deps/bridge.so
- --bpf-program
- B6RHG3mfcckmrYN1UhmJzyS1XX3fZKbkeUcpJe9Sy3FE
- /opt/solana/deps/token_bridge.so
- --bpf-program
- NFTWqJR8YnRVqPDvTJrYuLrQDitTG5AScqbeghi4zSA
- /opt/solana/deps/nft_bridge.so
- --bpf-program
- CP1co2QMMoDPbsmV7PGcUTLFwyhgCgTXt25gLQ5LewE1
- /opt/solana/deps/cpi_poster.so
- --bpf-program
- metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s
- /opt/solana/deps/spl_token_metadata.so
- --bpf-program
- gMYYig2utAxVoXnM9UhtTWrt8e7x2SVBZqsWZJeT5Gw # Derived from pyth_program.json
- /opt/solana/deps/pyth_oracle.so
- --bpf-program
- P2WH424242424242424242424242424242424242424
- /opt/solana/deps/pyth2wormhole.so
- --bpf-program
- Ex9bCdVMSfx7EzB3pgSi2R4UHwJAXvTw18rBQm5YQ8gK
- /opt/solana/deps/wormhole_migration.so
- --log
solana-setup:
build:
context: .
dockerfile: Dockerfile.client
profiles:
- solana
command:
- /bin/sh
- -c
- "wget https://raw.githubusercontent.com/vishnubob/wait-for-it/master/wait-for-it.sh && chmod +x wait-for-it.sh && ./wait-for-it.sh -t 0 solana-devnet:8899 -- /usr/src/solana/devnet_setup.sh"

View File

@ -1,34 +0,0 @@
require("dotenv").config({ path: ".env" });
module.exports = {
networks: {
development: {
host: "eth1",
port: 8545,
network_id: "*",
},
development2: {
host: "eth2",
port: 8546,
network_id: "*",
},
},
compilers: {
solc: {
version: "0.8.4",
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
},
plugins: ["@chainsafe/truffle-plugin-abigen", "truffle-plugin-verify"],
api_keys: {
etherscan: process.env.ETHERSCAN_KEY,
},
};