diff --git a/docker/colony-cdapp-dev-env-network b/docker/colony-cdapp-dev-env-network index 57c09500c24..7e52786ecb5 100644 --- a/docker/colony-cdapp-dev-env-network +++ b/docker/colony-cdapp-dev-env-network @@ -1,6 +1,6 @@ FROM colony-cdapp-dev-env/base:latest -ENV NETWORK_HASH=b20c6962b8be9ec89bef83051f3d4f7a8635726d +ENV NETWORK_HASH=45f052f5a680da3487d5a86c8f69909cf25d21f3 # Declare volumes to set up metadata VOLUME [ "/colonyCDapp/amplify/mock-data" ] @@ -30,6 +30,8 @@ RUN git submodule update --init --recursive --depth 1 # Install required network dependencies RUN pnpm i --frozen-lockfile +RUN npx hardhat compile + # Initialize the justification tree cache # To avoid the error spewed by the miner at startup RUN echo "{}" > ./packages/reputation-miner/justificationTreeCache.json diff --git a/docker/colony-cdapp-dev-env-network-remote b/docker/colony-cdapp-dev-env-network-remote new file mode 100644 index 00000000000..255ec87d630 --- /dev/null +++ b/docker/colony-cdapp-dev-env-network-remote @@ -0,0 +1,17 @@ +FROM colony-cdapp-dev-env/network:latest +# Add dependencies from the host +# Note: these are listed individually so that if they change, they won't affect +# the build of the other images +ADD docker/files/network-remote/run.sh.base /colonyCDappBackend/run.sh + +WORKDIR /colonyCDappBackend + +# Open up ports to the docker image +# Ganache +EXPOSE 8545 + +# Make the run script executable +RUN chmod +x ./run.sh + +# Battlecruiser Operational! +CMD [ "./run.sh" ] diff --git a/docker/colony-cdapp-dev-env-network-wormhole-relayer b/docker/colony-cdapp-dev-env-network-wormhole-relayer new file mode 100644 index 00000000000..3f880ebf52e --- /dev/null +++ b/docker/colony-cdapp-dev-env-network-wormhole-relayer @@ -0,0 +1,33 @@ +FROM colony-cdapp-dev-env/network:latest +# Add dependencies from the host +# Note: these are listed individually so that if they change, they won't affect +# the build of the other images +ADD docker/files/network-wormhole-relayer/run.sh.base /colonyCDappBackend/run.sh + +WORKDIR /colonyCDappBackend + +# Open up ports to the docker image +# Ganache +# EXPOSE 8545 + +RUN apt-get update +RUN apt-get install -y ca-certificates curl +RUN install -m 0755 -d /etc/apt/keyrings +RUN curl -fsSL https://download.docker.com/linux/debian/gpg -o /etc/apt/keyrings/docker.asc +RUN chmod a+r /etc/apt/keyrings/docker.asc + +# Add the repository to Apt sources: +RUN echo \ + "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/debian \ + $(. /etc/os-release && echo "$VERSION_CODENAME") stable" | \ + tee /etc/apt/sources.list.d/docker.list > /dev/null +RUN apt-get update +RUN apt-get install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugin + +RUN cd ./colonyNetwork/lib/wormhole/sdk/js-proto-node && npm i + +# Make the run script executable +RUN chmod +x ./run.sh + +# Battlecruiser Operational! +CMD [ "./run.sh" ] diff --git a/docker/colony-cdapp-dev-env-orchestration.yaml b/docker/colony-cdapp-dev-env-orchestration.yaml index ef1a2846bec..0cb177b8437 100644 --- a/docker/colony-cdapp-dev-env-orchestration.yaml +++ b/docker/colony-cdapp-dev-env-orchestration.yaml @@ -26,6 +26,40 @@ services: amplify-setup: condition: service_completed_successfully + network-contracts-remote: + container_name: 'network-remote' + image: colony-cdapp-dev-env/network-remote:latest + volumes: + - 'amplify-mock-data:/colonyCDapp/amplify/mock-data' + ports: + - '8546:8545' + healthcheck: + test: ['CMD', 'curl', '-f', 'http://localhost:8545'] + interval: 5s + retries: 1000 + depends_on: + amplify-setup: + condition: service_completed_successfully + environment: + CHAIN_ID: 265669101 + + network-contracts-remote-2: + container_name: 'network-remote-2' + image: colony-cdapp-dev-env/network-remote:latest + volumes: + - 'amplify-mock-data:/colonyCDapp/amplify/mock-data' + ports: + - '8547:8545' + healthcheck: + test: ['CMD', 'curl', '-f', 'http://localhost:8545'] + interval: 5s + retries: 1000 + depends_on: + amplify-setup: + condition: service_completed_successfully + environment: + CHAIN_ID: 265669102 + reputation-monitor: container_name: 'monitor' image: colony-cdapp-dev-env/reputation-monitor:latest @@ -104,6 +138,19 @@ services: network-contracts: condition: service_healthy + wormhole-relayer: + container_name: 'wormhole-relayer' + image: colony-cdapp-dev-env/network-wormhole-relayer:latest + volumes: + - '/var/run/docker.sock:/var/run/docker.sock' + depends_on: + network-contracts: + condition: service_healthy + network-contracts-remote: + condition: service_healthy + network-contracts-remote-2: + condition: service_healthy + volumes: amplify-backend: amplify-mock-data: diff --git a/docker/files/network-remote/run.sh.base b/docker/files/network-remote/run.sh.base new file mode 100644 index 00000000000..06beccf9be2 --- /dev/null +++ b/docker/files/network-remote/run.sh.base @@ -0,0 +1,17 @@ +#!/bin/bash + +cd colonyNetwork + +# Ganache + +# Uncomment the line below if you need ganache to run in verbose mode +# sed -i 's/100000000000000000000" >\/dev\/null 2>&1/100000000000000000000" --verbose/g' scripts/start-blockchain-client.sh +# sed -i 's/--db $DBPATH/--db $DBPATH --server.host "0.0.0.0"/g' scripts/start-blockchain-client.sh +pnpm run start:blockchain:client + +# Colony Network Contracts + +npx hardhat compile +npx hardhat deploy-proxy-network --network development + +sleep infinity \ No newline at end of file diff --git a/docker/files/network-wormhole-relayer/run.sh.base b/docker/files/network-wormhole-relayer/run.sh.base new file mode 100644 index 00000000000..0c3c343cd2a --- /dev/null +++ b/docker/files/network-wormhole-relayer/run.sh.base @@ -0,0 +1,48 @@ +#!/bin/bash +cd ./colonyNetwork/lib/wormhole/ && DOCKER_BUILDKIT=1 docker build --target node-export -f Dockerfile.proto -o type=local,dest=. . +cd ../.. && npx tsc --esModuleInterop --downlevelIteration ./scripts/mockGuardianSpy.ts + +cd ./lib/safe-contracts + +# This is the private key for the first account we create on ganache, so has ether to pay for gas fees +rm -rf ./deployments/custom +PK="0x0355596cdb5e5242ad082c4fe3f8bbe48c9dba843fe1f99dd8272f487e70efae" NODE_URL=http://network:8545 npx hardhat deploy --network custom + +rm -rf ./deployments/custom +PK="0x0355596cdb5e5242ad082c4fe3f8bbe48c9dba843fe1f99dd8272f487e70efae" NODE_URL=http://network-remote:8545 npx hardhat deploy --network custom + +rm -rf ./deployments/custom +PK="0x0355596cdb5e5242ad082c4fe3f8bbe48c9dba843fe1f99dd8272f487e70efae" NODE_URL=http://network-remote-2:8545 npx hardhat deploy --network custom + +cd ../../ + +echo "const wormhole = require("@certusone/wormhole-sdk"); + +module.exports = { + chains: { + [wormhole.CHAIN_ID_ARBITRUM_SEPOLIA]: { + endpoints: ["http://localhost:8545"], + colonyBridgeAddress: "0x633899227A3BC1f79de097149E1E3C8097c07b1a", + payForGas: true, + evmChainId: 265669100, + }, + [wormhole.CHAIN_ID_SEPOLIA]: { + endpoints: ["http://localhost:8546"], + colonyBridgeAddress: "0x161944B5601a7d3004E20d4Ca823F710838Ea1be", + payForGas: true, + evmChainId: 265669101, + }, + [wormhole.CHAIN_ID_OPTIMISM_SEPOLIA]: { + endpoints: ["http://localhost:8547"], + colonyBridgeAddress: "0x161944B5601a7d3004E20d4Ca823F710838Ea1be", + payForGas: false, + evmChainId: 265669102, + }, + } + }, +}; +" > ./packages/wormhole-relayer/config.js + +node -e 'require("./scripts/setup-bridging-contracts.js").setupBridging("http://network:8545", ["http://network-remote:8545", "http://network-remote-2:8545"])' + +sleep infinity \ No newline at end of file diff --git a/docker/files/network/run.sh.base b/docker/files/network/run.sh.base index a831289454c..ea421a39166 100644 --- a/docker/files/network/run.sh.base +++ b/docker/files/network/run.sh.base @@ -7,7 +7,7 @@ cd colonyNetwork # Uncomment the line below if you need ganache to run in verbose mode # sed -i 's/100000000000000000000" >\/dev\/null 2>&1/100000000000000000000" --verbose/g' scripts/start-blockchain-client.sh # sed -i 's/--db $DBPATH/--db $DBPATH --server.host "0.0.0.0"/g' scripts/start-blockchain-client.sh -pnpm run start:blockchain:client & +pnpm run start:blockchain:client # Colony Network Contracts diff --git a/package.json b/package.json index 2e54da818e9..4d8665ea5ad 100644 --- a/package.json +++ b/package.json @@ -6,14 +6,16 @@ "scripts": { "docker:build:base": "DOCKER_BUILDKIT=1 docker build --build-arg AMAZON_ARCH_FLAG=$(bash scripts/amazon-arch-flag.sh) --tag colony-cdapp-dev-env/base --file ./docker/colony-cdapp-dev-env-base .", "docker:build:network": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/network --file ./docker/colony-cdapp-dev-env-network .", + "docker:build:network-remote": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/network-remote --file ./docker/colony-cdapp-dev-env-network-remote .", + "docker:build:network-wormhole-relayer": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/network-wormhole-relayer --file ./docker/colony-cdapp-dev-env-network-wormhole-relayer .", "docker:build:monitor": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/reputation-monitor --file ./docker/colony-cdapp-dev-env-reputation-monitor .", "docker:build:mocking": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/mocking --file ./docker/colony-cdapp-dev-env-mocking .", "docker:build:ingestor": "DOCKER_BUILDKIT=1 docker build --ulimit nofile=5000:5000 --tag colony-cdapp-dev-env/block-ingestor --file ./docker/colony-cdapp-dev-env-block-ingestor .", "docker:build:amplify": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/amplify --file ./docker/colony-cdapp-dev-env-amplify .", "docker:build:safe": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/safe --file ./docker/colony-cdapp-dev-env-safe .", "docker:build:auth": "DOCKER_BUILDKIT=1 docker build --tag colony-cdapp-dev-env/auth-proxy --file ./docker/colony-cdapp-dev-env-auth-proxy .", - "docker:build:core": "npm run docker:build:base && npm run docker:build:network && npm run docker:build:monitor && npm run docker:build:mocking && npm run docker:build:ingestor && npm run docker:build:amplify && npm run docker:build:auth", - "docker:build:all": "npm run docker:build:base && npm run docker:build:network && npm run docker:build:monitor && npm run docker:build:mocking && npm run docker:build:ingestor && npm run docker:build:amplify && npm run docker:build:safe && npm run docker:build:auth", + "docker:build:core": "npm run docker:build:base && npm run docker:build:network && npm run docker:build:network-remote && npm run docker:build:network-wormhole-relayer && npm run docker:build:monitor && npm run docker:build:mocking && npm run docker:build:ingestor && npm run docker:build:amplify && npm run docker:build:auth", + "docker:build:all": "npm run docker:build:base && npm run docker:build:network && npm run docker:build:network-remote && && npm run docker:build:network-wormhole-relayer && npm run docker:build:monitor && npm run docker:build:mocking && npm run docker:build:ingestor && npm run docker:build:amplify && npm run docker:build:safe && npm run docker:build:auth", "docker:compose:core": "docker compose --file docker/colony-cdapp-dev-env-orchestration.yaml", "docker:compose:all": "docker compose --file docker/colony-cdapp-dev-env-orchestration-all.yaml", "dev": "npm run watch-amplify & npm run docker:build:core && npm run docker:compose:core up -- --force-recreate -V",