Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add custom configurable forks #59

Merged
merged 11 commits into from
Aug 23, 2024
Prev Previous commit
Next Next commit
fix conflict
barnabasbusa committed Aug 22, 2024

Verified

This commit was signed with the committer’s verified signature.
barnabasbusa Barnabas Busa
commit b1bee269e7b4062de3372a92ed9effa9b806f043
38 changes: 14 additions & 24 deletions src/contracts/contract_deployer.star
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
IMAGE = "ethpandaops/optimism-contract-deployer:develop"
IMAGE = "ethpandaops/optimism-contract-deployer:develop"

ENVRC_PATH = "/workspace/optimism/.envrc"
FACTORY_DEPLOYER_ADDRESS = "0x3fAB184622Dc19b6109349B94811493BF2a45362"
@@ -16,31 +17,28 @@ def deploy_factory_contract(
):
factory_deployment_result = plan.run_sh(
name="op-deploy-factory-contract",
description="Deploying L2 factory contract to L1 (needs to wait for l1 to finalize, about 4 min for minimal preset, 30 min for mainnet)",
description="Deploying L2 factory contract to L1 (takes about a minute)",
image=IMAGE,
env_vars={
"WEB3_PRIVATE_KEY": str(priv_key),
"FUND_VALUE": "10",
"PRIVATE_KEY": str(priv_key),
"FUND_VALUE": "10ether",
"DEPLOY_CONFIG_PATH": "/workspace/optimism/packages/contracts-bedrock/deploy-config/getting-started.json",
"DEPLOYMENT_CONTEXT": "getting-started",
}
| l1_config_env_vars,
run=" && ".join(
[
"web3 transfer $FUND_VALUE to {0}".format(FACTORY_DEPLOYER_ADDRESS),
"sleep 3",
"while true; do sleep 1; echo 'L1 Chain is starting up'; if [ \"$(curl -s $CL_RPC_URL/eth/v1/beacon/headers/ | jq -r '.data[0].header.message.slot')\" != \"0\" ]; then echo 'L1 Chain has started!'; break; fi; done",
"cast send {0} --value $FUND_VALUE --rpc-url $L1_RPC_URL --private-key $PRIVATE_KEY".format(
FACTORY_DEPLOYER_ADDRESS
),
"if [ $(cast codesize {0} --rpc-url $L1_RPC_URL) -gt 0 ]; then echo 'Factory contract already deployed!'; exit 0; fi".format(
FACTORY_ADDRESS
),
# 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",
"cast publish --rpc-url $L1_RPC_URL {0}".format(FACTORY_DEPLOYER_CODE),
"while true; do sleep 3; echo 'Factory code is not yet deployed...'; if [ $(cast codesize {0} --rpc-url $L1_RPC_URL) -gt 0 ]; then echo 'Factory contract already deployed!'; break; fi; done".format(
FACTORY_ADDRESS
),
]
),
wait="2000s",
wait="300s",
)


@@ -62,8 +60,8 @@ def deploy_l2_contracts(
description="Deploying L2 contracts (takes about a minute)",
image=IMAGE,
env_vars={
"WEB3_PRIVATE_KEY": str(priv_key),
"FUND_VALUE": "10",
"PRIVATE_KEY": str(priv_key),
"FUND_VALUE": "10ether",
"DEPLOY_CONFIG_PATH": "/workspace/optimism/packages/contracts-bedrock/deploy-config/getting-started.json",
"DEPLOYMENT_CONTEXT": "getting-started",
}
@@ -89,21 +87,13 @@ def deploy_l2_contracts(
),
". {0}".format(ENVRC_PATH),
"mkdir -p /network-configs",
"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",
"cast send $GS_ADMIN_ADDRESS --value $FUND_VALUE --private-key $PRIVATE_KEY --rpc-url $L1_RPC_URL", # Fund Admin
"cast send $GS_BATCHER_ADDRESS --value $FUND_VALUE --private-key $PRIVATE_KEY --rpc-url $L1_RPC_URL", # Fund Batcher
"cast send $GS_PROPOSER_ADDRESS --value $FUND_VALUE --private-key $PRIVATE_KEY --rpc-url $L1_RPC_URL", # Fund Proposer
"cd /workspace/optimism/packages/contracts-bedrock",
"./scripts/getting-started/config.sh",
'jq \'. + {"fundDevAccounts": true, "useInterop": true}\' $DEPLOY_CONFIG_PATH > tmp.$$.json && mv tmp.$$.json $DEPLOY_CONFIG_PATH',
# sleep till gs_admin_address is funded
"while true; do sleep 1; echo 'GS_ADMIN_ADDRESS is not yet funded...'; if [ \"$(web3 balance $GS_ADMIN_ADDRESS)\" != \"0\" ]; then echo 'GS_ADMIN_ADDRESS is funded!'; break; fi; done",
"echo 'Deploying scripts/deploy/Deploy.s.sol'",
"forge script scripts/deploy/Deploy.s.sol:Deploy --private-key $GS_ADMIN_PRIVATE_KEY --broadcast --rpc-url $L1_RPC_URL",
"sleep 3",
"echo 'Deploying scripts/L2Genesis.s.sol'",
"CONTRACT_ADDRESSES_PATH=$DEPLOYMENT_OUTFILE forge script scripts/L2Genesis.s.sol:L2Genesis --sig 'runWithStateDump()' --chain-id $L2_CHAIN_ID",
"cd /workspace/optimism/op-node/bin",
"./op-node genesis l2 \
You are viewing a condensed version of this merge commit. You can view the full changes here.