-
Notifications
You must be signed in to change notification settings - Fork 76
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: add full e2e dockerfile and upgrade node version (#229)
- Loading branch information
Showing
19 changed files
with
218 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
'@fuel-bridge/solidity-contracts': minor | ||
'@fuel-bridge/test-utils': minor | ||
--- | ||
|
||
Adapted deployments for a full e2e environment, and minor util adaptions to anvil quirks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# OS | ||
.DS_Store | ||
# Node.js | ||
node_modules | ||
.env | ||
.turbo | ||
|
||
# Misc | ||
.idea | ||
.DS_Store | ||
|
||
# Hardhat files | ||
cache | ||
artifacts | ||
|
||
# Cargo and Forc artifacts | ||
out | ||
target | ||
*/out | ||
*/target | ||
|
||
# fuels-ts typegen artifacts | ||
packages/fungible-token/exports/types | ||
|
||
# General dist folders | ||
dist |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
# This image is built for external projects that want to have | ||
# an e2e test environment | ||
FROM ghcr.io/fuellabs/fuel-core:v0.31.0 as fuel-core | ||
FROM ghcr.io/fuellabs/fuel-block-committer:v0.4.0 as fuel-committer | ||
|
||
FROM node:20-slim as base | ||
USER 0 | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN corepack enable | ||
|
||
RUN apt update | ||
RUN apt install -y curl git file jq | ||
|
||
# Download and install forc binaries | ||
FROM base as forc-downloader | ||
|
||
ENV FORC_VERSION=v0.60.0 | ||
RUN ARCH=$(uname -m) && \ | ||
if [ "$ARCH" = "aarch64" ]; then \ | ||
FORC_URL="https://github.com/FuelLabs/sway/releases/download/$FORC_VERSION/forc-binaries-linux_arm64.tar.gz"; \ | ||
elif [ "$ARCH" = "x86_64" ]; then \ | ||
FORC_URL="https://github.com/FuelLabs/sway/releases/download/$FORC_VERSION/forc-binaries-linux_amd64.tar.gz"; \ | ||
else \ | ||
echo "Unsupported architecture: $ARCH" && exit 1; \ | ||
fi && \ | ||
mkdir -p /tmp/forc-binaries && \ | ||
curl -L $FORC_URL | tar -xz -C /tmp && \ | ||
mv /tmp/forc-binaries/* /usr/local/bin/ | ||
|
||
# Download and install anvil | ||
FROM base as foundry-downloader | ||
RUN curl -L https://foundry.paradigm.xyz | bash | ||
RUN /root/.foundry/bin/foundryup | ||
|
||
FROM base as base-builder | ||
|
||
COPY --from=fuel-core /root/fuel-core /root/fuel-core | ||
COPY --from=fuel-committer /root/fuel-block-committer /root/fuel-block-committer | ||
COPY --from=forc-downloader /usr/local/bin/forc* /usr/local/bin | ||
COPY --from=foundry-downloader /root/.foundry /root/.foundry | ||
|
||
ENV DEBIAN_FRONTEND=noninteractive | ||
ENV PNPM_HOME="/pnpm" | ||
ENV PATH="$PNPM_HOME:$PATH" | ||
RUN npm i -g pm2 | ||
|
||
WORKDIR /fuel-bridge | ||
|
||
COPY packages packages | ||
COPY package.json package.json | ||
COPY pnpm-* . | ||
COPY Forc* . | ||
COPY fuel-toolchain.toml . | ||
COPY tsconfig.json . | ||
COPY turbo.json . | ||
|
||
RUN --mount=type=cache,id=pnpm,target=/pnpm/store pnpm install --frozen-lockfile | ||
|
||
FROM base-builder as sway-contracts | ||
RUN cd /fuel-bridge/packages/esbuild-bin-loader && pnpm build | ||
RUN cd /fuel-bridge && forc build --release | ||
RUN cd /fuel-bridge/packages/fungible-token && pnpm build | ||
|
||
FROM base-builder as solidity-contracts | ||
RUN cd /fuel-bridge/packages/solidity-contracts && pnpm build | ||
|
||
FROM solidity-contracts as full-env | ||
|
||
COPY --from=sway-contracts /fuel-bridge/packages/esbuild-bin-loader /fuel-bridge/packages/esbuild-bin-loader | ||
COPY --from=sway-contracts /fuel-bridge/packages/fungible-token /fuel-bridge/packages/fungible-token | ||
|
||
COPY docker/full-env/run.sh /run.sh | ||
|
||
ENTRYPOINT [ "bash", "/run.sh" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
#!/bin/bash | ||
|
||
#### ETHEREUM BOOTSTRAP | ||
export ETH_BLOCK_TIME=${ETH_BLOCK_TIME:-12} | ||
export ETH_ACCOUNTS=${ETH_ACCOUNTS:-20} | ||
export ETH_MNEMONIC="${ETH_MNEMONIC:-test test test test test test test test test test test junk}" | ||
pm2 --name eth start "/root/.foundry/bin/anvil \ | ||
--host 0.0.0.0 \ | ||
--mnemonic \"$ETH_MNEMONIC\" \ | ||
--accounts $ETH_ACCOUNTS \ | ||
--block-time $ETH_BLOCK_TIME \ | ||
--mixed-mining \ | ||
--slots-in-an-epoch 1" | ||
|
||
cd /fuel-bridge/packages/solidity-contracts \ | ||
&& npx hardhat deploy --network localhost --reset \ | ||
&& cd - | ||
|
||
export DEPLOYMENTS_DIR=/fuel-bridge/packages/solidity-contracts/deployments/localhost | ||
export STATE_ADDRESS=$(jq -r '.address' $DEPLOYMENTS_DIR/FuelChainState.json) | ||
export PORTAL_ADDRESS=$(jq -r '.address' $DEPLOYMENTS_DIR/FuelMessagePortal.json) | ||
export GATEWAY_ADDRESS=$(jq -r '.address' $DEPLOYMENTS_DIR/FuelERC20Gateway.json) | ||
|
||
#### FUEL BOOTSTRAP | ||
pm2 --name fuel start "/root/fuel-core run \ | ||
--ip 0.0.0.0 \ | ||
--port 4000 \ | ||
--db-type in-memory \ | ||
--utxo-validation \ | ||
--vm-backtrace \ | ||
--enable-relayer \ | ||
--relayer http://localhost:8545 \ | ||
--relayer-v2-listening-contracts $PORTAL_ADDRESS \ | ||
--poa-interval-period 1sec \ | ||
--debug \ | ||
--min-gas-price 0" | ||
|
||
export COMMIT_INTERVAL=${COMMIT_INTERVAL:-30} | ||
export COMMITTER_PRIVATE_KEY=${COMMITTER_PRIVATE_KEY:-0x59c6995e998f97a5a0044966f0945389dc9e86dae88c7a8412f4603b6b78690d} | ||
pm2 --name committer start "/root/fuel-block-committer \ | ||
--host 0.0.0.0 \ | ||
--port 8888 \ | ||
--ethereum-chain anvil \ | ||
--ethereum-rpc ws://localhost:8545 \ | ||
--ethereum-wallet-key $COMMITTER_PRIVATE_KEY \ | ||
--state-contract-address $STATE_ADDRESS \ | ||
--commit-interval $COMMIT_INTERVAL" | ||
|
||
#### L2 BRIDGE DEPLOYMENT | ||
export L2_BRIDGE_DEPLOYER=${L2_BRIDGE_DEPLOYER:-0xde97d8624a438121b86a1956544bd72ed68cd69f2c99555b08b1e8c51ffd511c} | ||
export ASSET_ISSUER_ID=$(cd /fuel-bridge/packages/test-utils \ | ||
&& L1_TOKEN_GATEWAY=$GATEWAY_ADDRESS \ | ||
L2_SIGNER=$L2_BRIDGE_DEPLOYER \ | ||
L2_RPC=http://localhost:4000/v1/graphql \ | ||
pnpm deploy:bridge 2>&1 | grep "Proxy at" | awk '{print $3}') | ||
|
||
echo "Asset issuer ID is at $ASSET_ISSUER_ID" | ||
|
||
cd /fuel-bridge/packages/solidity-contracts \ | ||
&& npx hardhat deploy --network localhost --tags set_asset_issuer_id,all \ | ||
&& cd - | ||
|
||
#### HTTP SERVER FOR BACKWARDS COMPAT | ||
pm2 --name deployments start "pnpm run serve-deployments" --cwd /fuel-bridge/packages/solidity-contracts | ||
|
||
#### Attach to logs | ||
pm2 logs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.