diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 440372c..cb74a23 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -10,11 +10,17 @@ on: - master - develop - release + # run this job on the default branch (release) daily + # the docker compose file contains some images with tags like 'latest' and 'stable' + # we nightly run here just to double check no bugs have been merged into those tags and are now on release + schedule: + - cron: '0 0 * * *' jobs: build_and_run: runs-on: ubuntu-8 strategy: + fail-fast: false matrix: pos: [pos, no-pos] l3node: [l3node, l3node-token-6, no-l3node] @@ -41,20 +47,3 @@ jobs: - name: Startup Nitro testnode run: ${{ github.workspace }}/.github/workflows/testnode.bash --init-force ${{ (matrix.l3node == 'l3node' && '--l3node') || (matrix.l3node == 'l3node-token-6' && '--l3node --l3-fee-token --l3-token-bridge --l3-fee-token-decimals 6') || '' }} ${{ matrix.tokenbridge == 'tokenbridge' && '--tokenbridge' || '--no-tokenbridge' }} --detach ${{ matrix.pos == 'pos' && '--pos' || '' }} --simple ${{ (matrix.simple == 'simple' && '--simple') || (matrix.simple == 'no-simple' && '--no-simple') || '' }} - - bold_upgrade: - runs-on: ubuntu-8 - - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - submodules: recursive - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - driver-opts: network=host - - - name: Startup Nitro testnode - run: ${{ github.workspace }}/.github/workflows/testnode.bash --init-force --bold-upgrade --simple --detach diff --git a/boldupgrader/Dockerfile b/boldupgrader/Dockerfile deleted file mode 100644 index 72bab80..0000000 --- a/boldupgrader/Dockerfile +++ /dev/null @@ -1,14 +0,0 @@ -FROM node:20-bookworm-slim -RUN apt-get update && \ - apt-get install -y git docker.io python3 make gcc g++ curl jq -ARG BOLD_CONTRACTS_BRANCH=bold-merge-script -WORKDIR /workspace -RUN git clone --no-checkout https://github.com/OffchainLabs/nitro-contracts.git ./ -RUN git checkout ${BOLD_CONTRACTS_BRANCH} -RUN yarn install && yarn cache clean -RUN curl -L https://foundry.paradigm.xyz | bash -ENV PATH="${PATH}:/root/.foundry/bin" -RUN foundryup --install 1.0.0 -RUN touch scripts/config.ts -RUN yarn build:all -ENTRYPOINT ["yarn"] \ No newline at end of file diff --git a/docker-compose-ci-cache.json b/docker-compose-ci-cache.json index 8a9dacb..0fee603 100644 --- a/docker-compose-ci-cache.json +++ b/docker-compose-ci-cache.json @@ -22,17 +22,6 @@ "type=docker" ] }, - "boldupgrader": { - "cache-from": [ - "type=local,src=/tmp/.buildx-cache" - ], - "cache-to": [ - "type=local,dest=/tmp/.buildx-cache,mode=max" - ], - "output": [ - "type=docker" - ] - }, "tokenbridge": { "cache-from": [ "type=local,src=/tmp/.buildx-cache" diff --git a/docker-compose.yaml b/docker-compose.yaml index 2ec6323..7584f14 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -47,7 +47,7 @@ services: - "127.0.0.1:6379:6379" geth: - image: ethereum/client-go:stable + image: ethereum/client-go:v1.14.13 ports: - "127.0.0.1:8545:8545" - "127.0.0.1:8551:8551" @@ -370,26 +370,6 @@ services: - "tokenbridge-data:/workspace" - /var/run/docker.sock:/var/run/docker.sock - boldupgrader: - depends_on: - - geth - - sequencer - pid: host - build: - context: boldupgrader/ - args: - BOLD_CONTRACTS_BRANCH: ${BOLD_CONTRACTS_BRANCH:-} - environment: - - L1_RPC_URL=http://geth:8545 - - L1_PRIV_KEY=0xdc04c5399f82306ec4b4d654a342f40e2e0620fe39950d967e1e574b32d4dd36 - - CONFIG_NETWORK_NAME=local - - DEPLOYED_CONTRACTS_DIR=./scripts/files/ - - DISABLE_VERIFICATION=true - volumes: - - "config:/config" - - "boldupgrader-data:/workspace" - - /var/run/docker.sock:/var/run/docker.sock - rollupcreator: depends_on: - geth @@ -502,4 +482,3 @@ volumes: das-committee-b-data: das-mirror-data: timeboost-auctioneer-data: - boldupgrader-data: diff --git a/scripts/config.ts b/scripts/config.ts index 33cde21..097c823 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -198,6 +198,11 @@ function writeConfigs(argv: any) { "info-files": [chainInfoFile], }, "node": { + "bold": { + "rpc-block-number": "latest", + "strategy": "makeNodes", + "assertion-posting-interval": "10s" + }, "staker": { "dangerous": { "without-block-validator": false @@ -292,7 +297,7 @@ function writeConfigs(argv: any) { if (argv.simple) { let simpleConfig = JSON.parse(baseConfJSON) simpleConfig.node.staker.enable = true - simpleConfig.node.staker["use-smart-contract-wallet"] = true + simpleConfig.node.staker["use-smart-contract-wallet"] = false // TODO: set to true when fixed simpleConfig.node.staker.dangerous["without-block-validator"] = true simpleConfig.node.sequencer = true simpleConfig.node.dangerous["no-sequencer-coordinator"] = true @@ -307,7 +312,7 @@ function writeConfigs(argv: any) { } else { let validatorConfig = JSON.parse(baseConfJSON) validatorConfig.node.staker.enable = true - validatorConfig.node.staker["use-smart-contract-wallet"] = true + validatorConfig.node.staker["use-smart-contract-wallet"] = false // TODO: set to true when fixed let validconfJSON = JSON.stringify(validatorConfig) fs.writeFileSync(path.join(consts.configpath, "validator_config.json"), validconfJSON) @@ -340,13 +345,14 @@ function writeConfigs(argv: any) { let l3Config = JSON.parse(baseConfJSON) l3Config["parent-chain"].connection.url = argv.l2url - l3Config.node.staker["parent-chain-wallet"].account = namedAddress("l3owner") + // use the same account for l2 and l3 staker + // l3Config.node.staker["parent-chain-wallet"].account = namedAddress("l3owner") l3Config.node["batch-poster"]["parent-chain-wallet"].account = namedAddress("l3sequencer") l3Config.chain.id = 333333 const l3ChainInfoFile = path.join(consts.configpath, "l3_chain_info.json") l3Config.chain["info-files"] = [l3ChainInfoFile] l3Config.node.staker.enable = true - l3Config.node.staker["use-smart-contract-wallet"] = true + l3Config.node.staker["use-smart-contract-wallet"] = false // TODO: set to true when fixed l3Config.node.sequencer = true l3Config.execution["sequencer"].enable = true l3Config.node["dangerous"]["no-sequencer-coordinator"] = true @@ -436,7 +442,7 @@ function writeL3ChainConfig(argv: any) { "EnableArbOS": true, "AllowDebugPrecompiles": true, "DataAvailabilityCommittee": false, - "InitialArbOSVersion": 31, + "InitialArbOSVersion": 32, "InitialChainOwner": argv.l2owner, "GenesisBlockNum": 0 } diff --git a/scripts/ethcommands.ts b/scripts/ethcommands.ts index 0534743..f76ddf3 100644 --- a/scripts/ethcommands.ts +++ b/scripts/ethcommands.ts @@ -10,6 +10,8 @@ import * as fs from "fs"; import { ARB_OWNER } from "./consts"; import * as TransparentUpgradeableProxy from "@openzeppelin/contracts/build/contracts/TransparentUpgradeableProxy.json" import * as ExpressLaneAuctionContract from "@arbitrum/nitro-contracts/build/contracts/src/express-lane-auction/ExpressLaneAuction.sol/ExpressLaneAuction.json" +import * as StylusDeployerContract from "@arbitrum/nitro-contracts/build/contracts/src/stylus/StylusDeployer.sol/StylusDeployer.json" + const path = require("path"); async function sendTransaction(argv: any, threadId: number) { @@ -142,6 +144,41 @@ async function deployERC20Contract(deployerWallet: Wallet, decimals: number): Pr return token.address; } +async function deployFeeTokenPricerContract(deployerWallet: Wallet, exchangeRate: BigNumber): Promise { + //// Bytecode below is generated from this simple FeeTokenPricer contract + + // pragma solidity ^0.8.16; + + // interface IFeeTokenPricer { + // /** + // * @notice Get the number of child chain's fee tokens per 1 parent chain's native token. Exchange rate must be + // * denominated in 18 decimals. + // * @dev For example, parent chain's native token is ETH, fee token is DAI. If price of 1ETH = 2000DAI, then function should return 2000*1e18. + // * If fee token is USDC instead and price of 1ETH = 2000USDC, function should still return 2000*1e18, no matter that USDC uses 6 decimals. + // */ + // function getExchangeRate() external returns (uint256); + // } + + // contract ConstantFeeTokenPricer is IFeeTokenPricer { + // uint256 immutable public constExchangeRate; + // constructor(uint256 _constExchangeRate) { + // constExchangeRate = _constExchangeRate; + // } + + // function getExchangeRate() external view returns (uint256) { + // return constExchangeRate; + // } + // } + + const feeTokenPricerBytecode = "0x60a0604052348015600e575f80fd5b506040516101c63803806101c68339818101604052810190602e9190606d565b8060808181525050506093565b5f80fd5b5f819050919050565b604f81603f565b81146058575f80fd5b50565b5f815190506067816048565b92915050565b5f60208284031215607f57607e603b565b5b5f608a84828501605b565b91505092915050565b6080516101166100b05f395f8181606a0152608f01526101165ff3fe6080604052348015600e575f80fd5b50600436106030575f3560e01c8063b8910a29146034578063e6aa216c14604e575b5f80fd5b603a6068565b6040516045919060c9565b60405180910390f35b6054608c565b604051605f919060c9565b60405180910390f35b7f000000000000000000000000000000000000000000000000000000000000000081565b5f7f0000000000000000000000000000000000000000000000000000000000000000905090565b5f819050919050565b60c38160b3565b82525050565b5f60208201905060da5f83018460bc565b9291505056fea2646970667358221220ee17f22614d853ccf8b3f854137f68f06ff92f9f71ba8b811d78b1313eead0c564736f6c634300081a0033"; + const abi = ["constructor(uint256 exchangeRate)"]; + const feeTokenPricerFactory = new ContractFactory(abi, feeTokenPricerBytecode, deployerWallet); + const feeTokenPricer = await feeTokenPricerFactory.deploy(exchangeRate); + await feeTokenPricer.deployTransaction.wait(); + + return feeTokenPricer.address; +} + async function deployWETHContract(deployerWallet: Wallet): Promise { const wethFactory = new ContractFactory(TestWETH9.abi, TestWETH9.bytecode, deployerWallet); const weth = await wethFactory.deploy("Wrapped Ether", "WETH"); @@ -150,6 +187,36 @@ async function deployWETHContract(deployerWallet: Wallet): Promise { return weth.address; } +async function createStylusDeployer(deployerWallet: Wallet): Promise { + // this factory should be deployed by the rollupcreator when deploy helper is used + const create2factory = '0x4e59b44847b379578588920ca78fbf26c0b4956c' + if (await deployerWallet.provider.getCode(create2factory) === '0x') { + // wait for 30 seconds, check again before throwing an error + await new Promise(resolve => setTimeout(resolve, 30000)); + if (await deployerWallet.provider.getCode(create2factory) === '0x') { + throw new Error('Create2 factory not yet deployed') + } + } + + const salt = ethers.constants.HashZero + const stylusDeployerBytecode = StylusDeployerContract.bytecode + const stylusDeployerAddress = ethers.utils.getCreate2Address(create2factory, salt, ethers.utils.keccak256(stylusDeployerBytecode)) + + // check if the address is already deployed + const code = await deployerWallet.provider.getCode(stylusDeployerAddress) + if (code !== '0x') { + console.log("Stylus deployer already deployed") + } else { + const stylusDeployerTx = await deployerWallet.sendTransaction({ + to: create2factory, + data: ethers.utils.concat([salt, stylusDeployerBytecode]) + }) + await stylusDeployerTx.wait() + } + + return stylusDeployerAddress +} + export const bridgeFundsCommand = { command: "bridge-funds", describe: "sends funds from l1 to l2", @@ -441,6 +508,29 @@ export const deployExpressLaneAuctionContractCommand = { } }; +export const createFeeTokenPricerCommand = { + command: "create-fee-token-pricer", + describe: "creates Constant Fee Token Pricer on L2", + builder: { + deployer: { + string: true, + describe: "account (see general help)" + }, + }, + handler: async (argv: any) => { + console.log("create-fee-token-pricer"); + + argv.provider = new ethers.providers.WebSocketProvider(argv.l2url); + const deployerWallet = new Wallet( + ethers.utils.sha256(ethers.utils.toUtf8Bytes(argv.deployer)), + argv.provider + ); + const feeTokenPricerAddress = await deployFeeTokenPricerContract(deployerWallet, BigNumber.from("15000000000000000000")); + console.log("Contract deployed at address:", feeTokenPricerAddress); + + argv.provider.destroy(); + }, +}; // Will revert if the keyset is already valid. async function setValidKeyset(argv: any, upgradeExecutorAddr: string, sequencerInboxAddr: string, keyset: string){ const innerIface = new ethers.utils.Interface(["function setValidKeyset(bytes)"]) @@ -534,6 +624,30 @@ export const createWETHCommand = { }, }; +export const createStylusDeployerCommand = { + command: "create-stylus-deployer", + describe: "deploys the stylus deployer contract", + builder: { + deployer: { string: true, describe: "account (see general help)" }, + l3: { boolean: false, describe: "deploy on L3, otherwise deploy on L2" }, + }, + handler: async (argv: any) => { + console.log("create-stylus-deployer"); + + const provider = new ethers.providers.WebSocketProvider(argv.l3 ? argv.l3url : argv.l2url); + const deployerWallet = namedAccount(argv.deployer).connect(provider); + + const stylusDeployerAddress = await createStylusDeployer(deployerWallet); + if (argv.l3) { + console.log("Stylus deployer deployed at L3 address:", stylusDeployerAddress); + } else { + console.log("Stylus deployer deployed at L2 address:", stylusDeployerAddress); + } + + provider.destroy(); + } +}; + export const sendL1Command = { command: "send-l1", describe: "sends funds between l1 accounts", diff --git a/scripts/index.ts b/scripts/index.ts index 4a8142a..96e5f09 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -26,6 +26,7 @@ import { createERC20Command, deployExpressLaneAuctionContractCommand, createWETHCommand, + createStylusDeployerCommand, transferERC20Command, sendL1Command, sendL2Command, @@ -34,6 +35,7 @@ import { setValidKeysetCommand, waitForSyncCommand, transferL3ChainOwnershipCommand, + createFeeTokenPricerCommand, } from "./ethcommands"; async function main() { @@ -53,7 +55,9 @@ async function main() { .command(bridgeNativeTokenToL3Command) .command(createERC20Command) .command(deployExpressLaneAuctionContractCommand) + .command(createFeeTokenPricerCommand) .command(createWETHCommand) + .command(createStylusDeployerCommand) .command(transferERC20Command) .command(sendL1Command) .command(sendL2Command) diff --git a/scripts/package.json b/scripts/package.json index c2dc9db..05c0a2f 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -6,7 +6,7 @@ "author": "Offchain Labs, Inc.", "license": "Apache-2.0", "dependencies": { - "@arbitrum/nitro-contracts": "^2.1.1", + "@arbitrum/nitro-contracts": "^3.1.0", "@arbitrum/token-bridge-contracts": "1.2.0", "@node-redis/client": "^1.0.4", "@openzeppelin/contracts": "^4.9.3", diff --git a/scripts/yarn.lock b/scripts/yarn.lock index 26f8665..4d5a9e7 100644 --- a/scripts/yarn.lock +++ b/scripts/yarn.lock @@ -19,6 +19,17 @@ optionalDependencies: sol2uml "2.2.0" +"@arbitrum/nitro-contracts@^3.1.0": + version "3.1.0" + resolved "https://registry.yarnpkg.com/@arbitrum/nitro-contracts/-/nitro-contracts-3.1.0.tgz#89488e798593dd8d36f44ab1f684e47410e375a1" + integrity sha512-/nDcQ3bZ5D761vv5I2r2gS+HeMTj9A2wgKzSWGTkqJ1ewzz8b1892OLBWgNja24J5daBTgGYV4vlxT+75478+w== + dependencies: + "@offchainlabs/upgrade-executor" "1.1.0-beta.0" + "@openzeppelin/contracts" "4.7.3" + "@openzeppelin/contracts-upgradeable" "4.7.3" + patch-package "^6.5.1" + solady "0.0.182" + "@arbitrum/token-bridge-contracts@1.2.0": version "1.2.0" resolved "https://registry.yarnpkg.com/@arbitrum/token-bridge-contracts/-/token-bridge-contracts-1.2.0.tgz#b1dc02e123393848d0d8e5c167028bafa0ac8229" @@ -2198,7 +2209,7 @@ parse5@^7.0.0: dependencies: entities "^4.4.0" -patch-package@^6.4.7: +patch-package@^6.4.7, patch-package@^6.5.1: version "6.5.1" resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.5.1.tgz#3e5d00c16997e6160291fee06a521c42ac99b621" integrity sha512-I/4Zsalfhc6bphmJTlrLoOcAF87jcxko4q0qsv4bGcurbr8IskEOtdnt9iCmsQVGL1B+iUhSQqweyTLJfCF9rA== @@ -2522,6 +2533,11 @@ sol2uml@2.2.0: js-graph-algorithms "^1.0.18" klaw "^4.0.1" +solady@0.0.182: + version "0.0.182" + resolved "https://registry.yarnpkg.com/solady/-/solady-0.0.182.tgz#bd8c47f128a3a752358ad052782773966d74c400" + integrity sha512-FW6xo1akJoYpkXMzu58/56FcNU3HYYNamEbnFO3iSibXk0nSHo0DV2Gu/zI3FPg3So5CCX6IYli1TT1IWATnvg== + solidity-ast@^0.4.51: version "0.4.55" resolved "https://registry.yarnpkg.com/solidity-ast/-/solidity-ast-0.4.55.tgz#00b685e6eefb2e8dfb67df1fe0afbe3b3bfb4b28" diff --git a/test-node.bash b/test-node.bash index f8a9a9f..bffb910 100755 --- a/test-node.bash +++ b/test-node.bash @@ -2,25 +2,22 @@ set -eu -NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.5.3-rc.3-653b078 +NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.6.0-fc07dd2 BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8 -DEFAULT_NITRO_CONTRACTS_VERSION="v2.1.1-beta.0" +# nitro-contract workaround for testnode +# 1. authorizing validator signer key since validator wallet is buggy +# - gas estimation sent from 0x0000 lead to balance and permission error +DEFAULT_NITRO_CONTRACTS_VERSION="v3.1.0" DEFAULT_TOKEN_BRIDGE_VERSION="v1.2.2" -# The is the latest bold-merge commit in nitro-contracts at the time -DEFAULT_BOLD_CONTRACTS_VERSION="42d80e40" - # Set default versions if not overriden by provided env vars : ${NITRO_CONTRACTS_BRANCH:=$DEFAULT_NITRO_CONTRACTS_VERSION} -: ${BOLD_CONTRACTS_BRANCH:=$DEFAULT_BOLD_CONTRACTS_VERSION} : ${TOKEN_BRIDGE_BRANCH:=$DEFAULT_TOKEN_BRIDGE_VERSION} export NITRO_CONTRACTS_BRANCH -export BOLD_CONTRACTS_BRANCH export TOKEN_BRIDGE_BRANCH echo "Using NITRO_CONTRACTS_BRANCH: $NITRO_CONTRACTS_BRANCH" -echo "Using BOLD_CONTRACTS_BRANCH: $BOLD_CONTRACTS_BRANCH" echo "Using TOKEN_BRIDGE_BRANCH: $TOKEN_BRIDGE_BRANCH" mydir=`dirname $0` @@ -49,9 +46,9 @@ blockscout=false tokenbridge=false l3node=false consensusclient=false -boldupgrade=false redundantsequencers=0 l3_custom_fee_token=false +l3_custom_fee_token_pricer=false l3_token_bridge=false l3_custom_fee_token_decimals=18 batchposters=1 @@ -216,10 +213,6 @@ while [[ $# -gt 0 ]]; do l1chainid=1337 shift ;; - --bold-upgrade) - boldupgrade=true - shift - ;; --l3node) l3node=true shift @@ -232,6 +225,14 @@ while [[ $# -gt 0 ]]; do l3_custom_fee_token=true shift ;; + --l3-fee-token-pricer) + if ! $l3_custom_fee_token; then + echo "Error: --l3-fee-token-pricer requires --l3-fee-token to be provided." + exit 1 + fi + l3_custom_fee_token_pricer=true + shift + ;; --l3-fee-token-decimals) if ! $l3_custom_fee_token; then echo "Error: --l3-fee-token-decimals requires --l3-fee-token to be provided." @@ -310,8 +311,8 @@ while [[ $# -gt 0 ]]; do echo --no-build-dev-nitro don\'t rebuild dev nitro docker image echo --build-dev-blockscout rebuild dev blockscout docker image echo --no-build-dev-blockscout don\'t rebuild dev blockscout docker image - echo --build-utils rebuild scripts, rollupcreator, boldupgrader, token bridge docker images - echo --no-build-utils don\'t rebuild scripts, rollupcreator, boldupgrader, token bridge docker images + echo --build-utils rebuild scripts, rollupcreator, token bridge docker images + echo --no-build-utils don\'t rebuild scripts, rollupcreator, token bridge docker images echo --force-build-utils force rebuilding utils, useful if NITRO_CONTRACTS_ or TOKEN_BRIDGE_BRANCH changes echo echo script runs inside a separate docker. For SCRIPT-ARGS, run $0 script --help @@ -383,14 +384,13 @@ if $dev_blockscout && $build_dev_blockscout; then fi if $build_utils; then - LOCAL_BUILD_NODES="scripts rollupcreator boldupgrader" + LOCAL_BUILD_NODES="scripts rollupcreator" # always build tokenbridge in CI mode to avoid caching issues if $tokenbridge || $l3_token_bridge || $ci; then LOCAL_BUILD_NODES="$LOCAL_BUILD_NODES tokenbridge" fi if [ "$ci" == true ]; then - # workaround to cache docker layers and keep using docker-compose in CI docker buildx bake --allow=fs=/tmp --file docker-compose.yaml --file docker-compose-ci-cache.json $LOCAL_BUILD_NODES else UTILS_NOCACHE="" @@ -473,7 +473,7 @@ if $force_init; then echo == create l1 traffic docker compose run scripts send-l1 --ethamount 1000 --to user_l1user --wait - docker compose run scripts send-l1 --ethamount 0.0001 --from user_l1user --to user_l1user_b --wait --delay 500 --times 1000000 > /dev/null & + docker compose run scripts send-l1 --ethamount 0.0001 --from user_l1user --to user_l1user --wait --delay 1000 --times 1000000 > /dev/null & l2ownerAddress=`docker compose run scripts print-address --account l2owner | tail -n 1 | tr -d '\r\n'` @@ -582,24 +582,17 @@ if $force_init; then echo == Deploy CacheManager on L2 docker compose run -e CHILD_CHAIN_RPC="http://sequencer:8547" -e CHAIN_OWNER_PRIVKEY=$l2ownerKey rollupcreator deploy-cachemanager-testnode - if $boldupgrade; then - echo == Deploying WETH as BOLD stake token - stakeTokenAddress=`docker compose run scripts create-weth --deployer l2owner --deposit 100 | tail -n 1 | awk '{ print $NF }'` - echo BOLD stake token address: $stakeTokenAddress - docker compose run scripts transfer-erc20 --token $stakeTokenAddress --l1 --amount 100 --from l2owner --to validator - echo == Preparing BOLD upgrade - docker compose run -e TESTNODE_MODE=true -e ROLLUP_ADDRESS=$rollupAddress -e STAKE_TOKEN=$stakeTokenAddress boldupgrader script:bold-prepare - # retry this 10 times because the staker might not have made a node yet - for i in {1..10}; do - docker compose run -e TESTNODE_MODE=true -e ROLLUP_ADDRESS=$rollupAddress -e STAKE_TOKEN=$stakeTokenAddress boldupgrader script:bold-populate-lookup && break || true - echo "Failed to populate lookup table, retrying..." - sleep 10 - done - docker compose run -e TESTNODE_MODE=true -e ROLLUP_ADDRESS=$rollupAddress -e STAKE_TOKEN=$stakeTokenAddress boldupgrader script:bold-local-execute - fi + echo == Deploy Stylus Deployer on L2 + docker compose run scripts create-stylus-deployer --deployer l2owner + + # TODO: remove this once the gas estimation issue is fixed + echo == Gas Estimation workaround + docker compose run scripts send-l1 --ethamount 1 --to address_0x0000000000000000000000000000000000000000 --wait + docker compose run scripts send-l2 --ethamount 1 --to address_0x0000000000000000000000000000000000000000 --wait if $l3node; then echo == Funding l3 users + docker compose run scripts send-l2 --ethamount 1000 --to validator --wait docker compose run scripts send-l2 --ethamount 1000 --to l3owner --wait docker compose run scripts send-l2 --ethamount 1000 --to l3sequencer --wait @@ -613,7 +606,7 @@ if $force_init; then echo == create l2 traffic docker compose run scripts send-l2 --ethamount 100 --to user_traffic_generator --wait - docker compose run scripts send-l2 --ethamount 0.0001 --from user_traffic_generator --to user_fee_token_deployer --wait --delay 500 --times 1000000 > /dev/null & + docker compose run scripts send-l2 --ethamount 0.0001 --from user_traffic_generator --to user_traffic_generator --wait --delay 500 --times 1000000 > /dev/null & echo == Writing l3 chain config l3owneraddress=`docker compose run scripts print-address --account l3owner | tail -n 1 | tr -d '\r\n'` @@ -627,6 +620,11 @@ if $force_init; then docker compose run scripts transfer-erc20 --token $nativeTokenAddress --amount 10000 --from user_fee_token_deployer --to l3owner docker compose run scripts transfer-erc20 --token $nativeTokenAddress --amount 10000 --from user_fee_token_deployer --to user_token_bridge_deployer EXTRA_L3_DEPLOY_FLAG="-e FEE_TOKEN_ADDRESS=$nativeTokenAddress" + if $l3_custom_fee_token_pricer; then + echo == Deploying custom fee token pricer + feeTokenPricerAddress=`docker compose run scripts create-fee-token-pricer --deployer user_fee_token_deployer | tail -n 1 | awk '{ print $NF }'` + EXTRA_L3_DEPLOY_FLAG="$EXTRA_L3_DEPLOY_FLAG -e FEE_TOKEN_PRICER_ADDRESS=$feeTokenPricerAddress" + fi fi echo == Deploying L3 @@ -671,6 +669,12 @@ if $force_init; then echo == Deploy CacheManager on L3 docker compose run -e CHILD_CHAIN_RPC="http://l3node:3347" -e CHAIN_OWNER_PRIVKEY=$l3ownerkey rollupcreator deploy-cachemanager-testnode + echo == Deploy Stylus Deployer on L3 + docker compose run scripts create-stylus-deployer --deployer l3owner --l3 + + echo == create l3 traffic + docker compose run scripts send-l3 --ethamount 10 --to user_traffic_generator --wait + docker compose run scripts send-l3 --ethamount 0.0001 --from user_traffic_generator --to user_traffic_generator --wait --delay 5000 --times 1000000 > /dev/null & fi fi