-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from ethpandaops/bbusa/contracts
feat: add funding contract deployer
- Loading branch information
Showing
9 changed files
with
268 additions
and
8 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,22 @@ | ||
# Check PR title for conventional commits | ||
name: Check PR title | ||
on: | ||
pull_request_target: | ||
types: | ||
- opened | ||
- reopened | ||
- edited | ||
- synchronize | ||
|
||
# cancel redundant builds | ||
concurrency: | ||
group: "title-checker-${{ github.head_ref }}" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
title_check: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: aslafy-z/conventional-pr-title-action@v3 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,48 @@ | ||
name: CI | ||
|
||
on: | ||
pull_request: | ||
|
||
concurrency: | ||
group: "tests-${{ github.head_ref }}" | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
run_with_args: | ||
strategy: | ||
matrix: | ||
file_name: | ||
[ | ||
"./network_params.yaml" | ||
] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Kurtosis | ||
run: | | ||
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list | ||
sudo apt update | ||
sudo apt install kurtosis-cli | ||
kurtosis analytics disable | ||
- name: Run Starlark | ||
run: kurtosis run ${{ github.workspace }} --args-file ${{ matrix.file_name }} | ||
|
||
lint: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Setup Kurtosis | ||
run: | | ||
echo "deb [trusted=yes] https://apt.fury.io/kurtosis-tech/ /" | sudo tee /etc/apt/sources.list.d/kurtosis.list | ||
sudo apt update | ||
sudo apt install kurtosis-cli | ||
kurtosis analytics disable | ||
- name: Kurtosis Lint | ||
run: kurtosis lint ${{ github.workspace }} | ||
|
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,15 @@ | ||
on: | ||
push: | ||
branches: [main] | ||
|
||
name: release-please | ||
jobs: | ||
release-please: | ||
name: "Release please" | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: google-github-actions/release-please-action@v3 | ||
with: | ||
release-type: simple | ||
package-name: kurtosis | ||
include-v-in-tag: false |
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,74 @@ | ||
FROM debian:latest as builder | ||
|
||
WORKDIR /workspace | ||
|
||
# Install dependencies using apt | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
git \ | ||
make \ | ||
jq \ | ||
direnv \ | ||
bash \ | ||
curl \ | ||
gcc \ | ||
g++ \ | ||
python3 \ | ||
python3-pip \ | ||
nodejs \ | ||
npm \ | ||
vim \ | ||
build-essential \ | ||
libusb-1.0-0-dev \ | ||
libssl-dev \ | ||
ca-certificates \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install pnpm | ||
RUN npm install -g pnpm@9 | ||
|
||
# Install Go from the official golang image | ||
COPY --from=golang:alpine /usr/local/go/ /usr/local/go/ | ||
ENV PATH="/usr/local/go/bin:${PATH}" | ||
|
||
# Install web3 cli | ||
RUN curl -LSs https://raw.githubusercontent.com/gochain/web3/master/install.sh | sh | ||
|
||
# Install Rust and Foundry | ||
RUN curl -L https://foundry.paradigm.xyz | bash | ||
ENV PATH="/root/.foundry/bin:${PATH}" | ||
RUN foundryup | ||
|
||
RUN git clone https://github.com/ethereum-optimism/optimism.git && \ | ||
cd optimism && \ | ||
git checkout tutorials/chain && \ | ||
pnpm install && \ | ||
pnpm build | ||
|
||
|
||
# Use multi-stage build to keep the final image lean | ||
FROM debian:stable-slim | ||
|
||
WORKDIR /workspace | ||
|
||
# Install dependencies using apt | ||
RUN apt-get update && apt-get install -y --no-install-recommends \ | ||
jq \ | ||
direnv \ | ||
bash \ | ||
curl \ | ||
ca-certificates \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
COPY --from=builder /usr/local /usr/local | ||
COPY --from=builder /workspace/optimism /workspace/optimism | ||
COPY --from=builder /root/.foundry /root/.foundry | ||
|
||
# Set up environment variables | ||
ENV PATH="/root/.foundry/bin:/usr/local/go/bin:${PATH}" | ||
|
||
|
||
# Set the working directory and default command | ||
WORKDIR /workspace/optimism | ||
CMD ["bash"] |
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 @@ | ||
## Welcome to Optimism Package |
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,75 @@ | ||
IMAGE = "parithoshj/op-test:v3" | ||
|
||
ENVRC_PATH = "/workspace/optimism/.envrc" | ||
|
||
FACTORY_DEPLOYER_ADDRESS = "0x3fAB184622Dc19b6109349B94811493BF2a45362" | ||
FACTORY_DEPLOYER_CODE = "0xf8a58085174876e800830186a08080b853604580600e600039806000f350fe7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe03601600081602082378035828234f58015156039578182fd5b8082525050506014600cf31ba02222222222222222222222222222222222222222222222222222222222222222a02222222222222222222222222222222222222222222222222222222222222222" | ||
|
||
|
||
def launch_contract_deployer( | ||
plan, | ||
el_rpc_http_url, | ||
cl_rpc_http_url, | ||
priv_key, | ||
): | ||
plan.run_sh( | ||
description="Deploying L2 contracts (takes a few minutes (30 mins for mainnet preset - 4 mins for minimal preset) -- L1 has to be finalized first)", | ||
image=IMAGE, | ||
env_vars={ | ||
"WEB3_RPC_URL": str(el_rpc_http_url), | ||
"WEB3_PRIVATE_KEY": str(priv_key), | ||
"CL_RPC_URL": str(cl_rpc_http_url), | ||
"FUND_VALUE": "10", | ||
}, | ||
store=[ | ||
StoreSpec(src="/network-configs", name="op-genesis-configs"), | ||
], | ||
run=" && ".join( | ||
[ | ||
"./packages/contracts-bedrock/scripts/getting-started/wallets.sh >> {0}".format( | ||
ENVRC_PATH | ||
), | ||
"sed -i '1d' {0}".format( | ||
ENVRC_PATH | ||
), # Remove the first line (not commented out) | ||
"echo 'export L1_RPC_KIND=any' >> {0}".format(ENVRC_PATH), | ||
"echo 'export L1_RPC_URL={0}' >> {1}".format( | ||
el_rpc_http_url, ENVRC_PATH | ||
), | ||
"echo 'export IMPL_SALT=$(openssl rand -hex 32)' >> {0}".format( | ||
ENVRC_PATH | ||
), | ||
"echo 'export DEPLOYMENT_CONTEXT=getting-started' >> {0}".format( | ||
ENVRC_PATH | ||
), | ||
". {0}".format(ENVRC_PATH), | ||
"web3 transfer $FUND_VALUE to $GS_ADMIN_ADDRESS", # Fund Admin | ||
"sleep 3", | ||
"web3 transfer $FUND_VALUE to $GS_BATCHER_ADDRESS", # Fund Batcher | ||
"sleep 3", | ||
"web3 transfer $FUND_VALUE to $GS_PROPOSER_ADDRESS", # Fund Proposer | ||
"sleep 3", | ||
"web3 transfer $FUND_VALUE to {0}".format( | ||
FACTORY_DEPLOYER_ADDRESS | ||
), # Fund Factory deployer | ||
"sleep 3", | ||
# sleep till chain is finalized | ||
"while true; do sleep 3; echo 'Chain is not yet finalized...'; if [ \"$(curl -s $CL_RPC_URL/eth/v1/beacon/states/head/finality_checkpoints | jq -r '.data.finalized.epoch')\" != \"0\" ]; then echo 'Chain is finalized!'; break; fi; done", | ||
"cd /workspace/optimism/packages/contracts-bedrock", | ||
"./scripts/getting-started/config.sh", | ||
"cast publish --rpc-url $WEB3_RPC_URL {0}".format( | ||
FACTORY_DEPLOYER_CODE | ||
), | ||
"sleep 12", | ||
"forge script scripts/Deploy.s.sol:Deploy --private-key $GS_ADMIN_PRIVATE_KEY --broadcast --rpc-url $L1_RPC_URL", | ||
"sleep 3", | ||
"cd /workspace/optimism/op-node", | ||
"go run cmd/main.go genesis l2 --deploy-config ../packages/contracts-bedrock/deploy-config/getting-started.json --l1-deployments ../packages/contracts-bedrock/deployments/getting-started/.deploy --outfile.l2 genesis.json --outfile.rollup rollup.json --l1-rpc $L1_RPC_URL", | ||
"mkdir -p /network-configs", | ||
"mv /workspace/optimism/op-node/genesis.json /network-configs/genesis.json", | ||
"mv /workspace/optimism/op-node/rollup.json /network-configs/rollup.json", | ||
"mv /workspace/optimism/packages/contracts-bedrock/deployments/getting-started/.deploy /network-configs/.deploy", | ||
] | ||
), | ||
wait="2000s", | ||
) |
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