Skip to content

Commit 06ced35

Browse files
authored
Merge pull request #117 from OffchainLabs/v3-support
V3 support
2 parents b6249da + 931bbef commit 06ced35

File tree

12 files changed

+116
-106
lines changed

12 files changed

+116
-106
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010
- master
1111
- develop
1212
- release
13-
# run this job on the default branch daily
13+
# run this job on the default branch (release) daily
1414
# the docker compose file contains some images with tags like 'latest' and 'stable'
1515
# we nightly run here just to double check no bugs have been merged into those tags and are now on release
1616
schedule:
@@ -20,6 +20,7 @@ jobs:
2020
build_and_run:
2121
runs-on: ubuntu-8
2222
strategy:
23+
fail-fast: false
2324
matrix:
2425
pos: [pos, no-pos]
2526
l3node: [l3node, l3node-token-6, no-l3node]
@@ -46,20 +47,3 @@ jobs:
4647

4748
- name: Startup Nitro testnode
4849
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') || '' }}
49-
50-
bold_upgrade:
51-
runs-on: ubuntu-8
52-
53-
steps:
54-
- name: Checkout
55-
uses: actions/checkout@v4
56-
with:
57-
submodules: recursive
58-
59-
- name: Set up Docker Buildx
60-
uses: docker/setup-buildx-action@v3
61-
with:
62-
driver-opts: network=host
63-
64-
- name: Startup Nitro testnode
65-
run: ${{ github.workspace }}/.github/workflows/testnode.bash --init-force --bold-upgrade --simple --detach

boldupgrader/Dockerfile

Lines changed: 0 additions & 14 deletions
This file was deleted.

docker-compose-ci-cache.json

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,6 @@
2222
"type=docker"
2323
]
2424
},
25-
"boldupgrader": {
26-
"cache-from": [
27-
"type=local,src=/tmp/.buildx-cache"
28-
],
29-
"cache-to": [
30-
"type=local,dest=/tmp/.buildx-cache,mode=max"
31-
],
32-
"output": [
33-
"type=docker"
34-
]
35-
},
3625
"tokenbridge": {
3726
"cache-from": [
3827
"type=local,src=/tmp/.buildx-cache"

docker-compose.yaml

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ services:
4747
- "127.0.0.1:6379:6379"
4848

4949
geth:
50-
image: ethereum/client-go:stable
50+
image: ethereum/client-go:v1.14.13
5151
ports:
5252
- "127.0.0.1:8545:8545"
5353
- "127.0.0.1:8551:8551"
@@ -370,26 +370,6 @@ services:
370370
- "tokenbridge-data:/workspace"
371371
- /var/run/docker.sock:/var/run/docker.sock
372372

373-
boldupgrader:
374-
depends_on:
375-
- geth
376-
- sequencer
377-
pid: host
378-
build:
379-
context: boldupgrader/
380-
args:
381-
BOLD_CONTRACTS_BRANCH: ${BOLD_CONTRACTS_BRANCH:-}
382-
environment:
383-
- L1_RPC_URL=http://geth:8545
384-
- L1_PRIV_KEY=0xdc04c5399f82306ec4b4d654a342f40e2e0620fe39950d967e1e574b32d4dd36
385-
- CONFIG_NETWORK_NAME=local
386-
- DEPLOYED_CONTRACTS_DIR=./scripts/files/
387-
- DISABLE_VERIFICATION=true
388-
volumes:
389-
- "config:/config"
390-
- "boldupgrader-data:/workspace"
391-
- /var/run/docker.sock:/var/run/docker.sock
392-
393373
rollupcreator:
394374
depends_on:
395375
- geth
@@ -502,4 +482,3 @@ volumes:
502482
das-committee-b-data:
503483
das-mirror-data:
504484
timeboost-auctioneer-data:
505-
boldupgrader-data:

rollupcreator/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ ARG NITRO_CONTRACTS_BRANCH=main
55
WORKDIR /workspace
66
RUN git clone --no-checkout https://github.com/OffchainLabs/nitro-contracts.git ./
77
RUN git checkout ${NITRO_CONTRACTS_BRANCH}
8+
RUN git submodule update --init --recursive
89
RUN yarn install && yarn cache clean
910
RUN curl -L https://foundry.paradigm.xyz | bash
1011
ENV PATH="${PATH}:/root/.foundry/bin"

scripts/config.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,11 @@ function writeConfigs(argv: any) {
198198
"info-files": [chainInfoFile],
199199
},
200200
"node": {
201+
"bold": {
202+
"rpc-block-number": "latest",
203+
"strategy": "makeNodes",
204+
"assertion-posting-interval": "10s"
205+
},
201206
"staker": {
202207
"dangerous": {
203208
"without-block-validator": false
@@ -292,7 +297,7 @@ function writeConfigs(argv: any) {
292297
if (argv.simple) {
293298
let simpleConfig = JSON.parse(baseConfJSON)
294299
simpleConfig.node.staker.enable = true
295-
simpleConfig.node.staker["use-smart-contract-wallet"] = true
300+
simpleConfig.node.staker["use-smart-contract-wallet"] = false // TODO: set to true when fixed
296301
simpleConfig.node.staker.dangerous["without-block-validator"] = true
297302
simpleConfig.node.sequencer = true
298303
simpleConfig.node.dangerous["no-sequencer-coordinator"] = true
@@ -307,7 +312,7 @@ function writeConfigs(argv: any) {
307312
} else {
308313
let validatorConfig = JSON.parse(baseConfJSON)
309314
validatorConfig.node.staker.enable = true
310-
validatorConfig.node.staker["use-smart-contract-wallet"] = true
315+
validatorConfig.node.staker["use-smart-contract-wallet"] = false // TODO: set to true when fixed
311316
let validconfJSON = JSON.stringify(validatorConfig)
312317
fs.writeFileSync(path.join(consts.configpath, "validator_config.json"), validconfJSON)
313318

@@ -340,13 +345,14 @@ function writeConfigs(argv: any) {
340345

341346
let l3Config = JSON.parse(baseConfJSON)
342347
l3Config["parent-chain"].connection.url = argv.l2url
343-
l3Config.node.staker["parent-chain-wallet"].account = namedAddress("l3owner")
348+
// use the same account for l2 and l3 staker
349+
// l3Config.node.staker["parent-chain-wallet"].account = namedAddress("l3owner")
344350
l3Config.node["batch-poster"]["parent-chain-wallet"].account = namedAddress("l3sequencer")
345351
l3Config.chain.id = 333333
346352
const l3ChainInfoFile = path.join(consts.configpath, "l3_chain_info.json")
347353
l3Config.chain["info-files"] = [l3ChainInfoFile]
348354
l3Config.node.staker.enable = true
349-
l3Config.node.staker["use-smart-contract-wallet"] = true
355+
l3Config.node.staker["use-smart-contract-wallet"] = false // TODO: set to true when fixed
350356
l3Config.node.sequencer = true
351357
l3Config.execution["sequencer"].enable = true
352358
l3Config.node["dangerous"]["no-sequencer-coordinator"] = true
@@ -436,7 +442,7 @@ function writeL3ChainConfig(argv: any) {
436442
"EnableArbOS": true,
437443
"AllowDebugPrecompiles": true,
438444
"DataAvailabilityCommittee": false,
439-
"InitialArbOSVersion": 31,
445+
"InitialArbOSVersion": 32,
440446
"InitialChainOwner": argv.l2owner,
441447
"GenesisBlockNum": 0
442448
}

scripts/ethcommands.ts

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import * as fs from "fs";
1010
import { ARB_OWNER } from "./consts";
1111
import * as TransparentUpgradeableProxy from "@openzeppelin/contracts/build/contracts/TransparentUpgradeableProxy.json"
1212
import * as ExpressLaneAuctionContract from "@arbitrum/nitro-contracts/build/contracts/src/express-lane-auction/ExpressLaneAuction.sol/ExpressLaneAuction.json"
13+
import * as StylusDeployerContract from "@arbitrum/nitro-contracts/build/contracts/src/stylus/StylusDeployer.sol/StylusDeployer.json"
14+
1315
const path = require("path");
1416

1517
async function sendTransaction(argv: any, threadId: number) {
@@ -185,6 +187,36 @@ async function deployWETHContract(deployerWallet: Wallet): Promise<string> {
185187
return weth.address;
186188
}
187189

190+
async function createStylusDeployer(deployerWallet: Wallet): Promise<string> {
191+
// this factory should be deployed by the rollupcreator when deploy helper is used
192+
const create2factory = '0x4e59b44847b379578588920ca78fbf26c0b4956c'
193+
if (await deployerWallet.provider.getCode(create2factory) === '0x') {
194+
// wait for 30 seconds, check again before throwing an error
195+
await new Promise(resolve => setTimeout(resolve, 30000));
196+
if (await deployerWallet.provider.getCode(create2factory) === '0x') {
197+
throw new Error('Create2 factory not yet deployed')
198+
}
199+
}
200+
201+
const salt = ethers.constants.HashZero
202+
const stylusDeployerBytecode = StylusDeployerContract.bytecode
203+
const stylusDeployerAddress = ethers.utils.getCreate2Address(create2factory, salt, ethers.utils.keccak256(stylusDeployerBytecode))
204+
205+
// check if the address is already deployed
206+
const code = await deployerWallet.provider.getCode(stylusDeployerAddress)
207+
if (code !== '0x') {
208+
console.log("Stylus deployer already deployed")
209+
} else {
210+
const stylusDeployerTx = await deployerWallet.sendTransaction({
211+
to: create2factory,
212+
data: ethers.utils.concat([salt, stylusDeployerBytecode])
213+
})
214+
await stylusDeployerTx.wait()
215+
}
216+
217+
return stylusDeployerAddress
218+
}
219+
188220
export const bridgeFundsCommand = {
189221
command: "bridge-funds",
190222
describe: "sends funds from l1 to l2",
@@ -593,6 +625,30 @@ export const createWETHCommand = {
593625
},
594626
};
595627

628+
export const createStylusDeployerCommand = {
629+
command: "create-stylus-deployer",
630+
describe: "deploys the stylus deployer contract",
631+
builder: {
632+
deployer: { string: true, describe: "account (see general help)" },
633+
l3: { boolean: false, describe: "deploy on L3, otherwise deploy on L2" },
634+
},
635+
handler: async (argv: any) => {
636+
console.log("create-stylus-deployer");
637+
638+
const provider = new ethers.providers.WebSocketProvider(argv.l3 ? argv.l3url : argv.l2url);
639+
const deployerWallet = namedAccount(argv.deployer).connect(provider);
640+
641+
const stylusDeployerAddress = await createStylusDeployer(deployerWallet);
642+
if (argv.l3) {
643+
console.log("Stylus deployer deployed at L3 address:", stylusDeployerAddress);
644+
} else {
645+
console.log("Stylus deployer deployed at L2 address:", stylusDeployerAddress);
646+
}
647+
648+
provider.destroy();
649+
}
650+
};
651+
596652
export const sendL1Command = {
597653
command: "send-l1",
598654
describe: "sends funds between l1 accounts",

scripts/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import {
2626
createERC20Command,
2727
deployExpressLaneAuctionContractCommand,
2828
createWETHCommand,
29+
createStylusDeployerCommand,
2930
transferERC20Command,
3031
sendL1Command,
3132
sendL2Command,
@@ -56,6 +57,7 @@ async function main() {
5657
.command(createFeeTokenPricerCommand)
5758
.command(deployExpressLaneAuctionContractCommand)
5859
.command(createWETHCommand)
60+
.command(createStylusDeployerCommand)
5961
.command(transferERC20Command)
6062
.command(sendL1Command)
6163
.command(sendL2Command)

scripts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
"author": "Offchain Labs, Inc.",
77
"license": "Apache-2.0",
88
"dependencies": {
9-
"@arbitrum/nitro-contracts": "^2.1.1",
9+
"@arbitrum/nitro-contracts": "^3.1.1",
1010
"@arbitrum/token-bridge-contracts": "1.2.0",
1111
"@node-redis/client": "^1.0.4",
1212
"@openzeppelin/contracts": "^4.9.3",

scripts/yarn.lock

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,17 @@
1919
optionalDependencies:
2020
sol2uml "2.2.0"
2121

22+
"@arbitrum/nitro-contracts@^3.1.1":
23+
version "3.1.1"
24+
resolved "https://registry.yarnpkg.com/@arbitrum/nitro-contracts/-/nitro-contracts-3.1.1.tgz#f2efac5329e3f187ade998bbbbad93070e2e90a3"
25+
integrity sha512-30s5ocUZbDx22MybngvO7WZtCgYoPYmkHnnBl07FZnN3gOv+oy4WQB0Ln2QG4aBzPp6hCg76Yw9mQJDN/+OkCg==
26+
dependencies:
27+
"@offchainlabs/upgrade-executor" "1.1.0-beta.0"
28+
"@openzeppelin/contracts" "4.7.3"
29+
"@openzeppelin/contracts-upgradeable" "4.7.3"
30+
patch-package "^6.5.1"
31+
solady "0.0.182"
32+
2233
"@arbitrum/[email protected]":
2334
version "1.2.0"
2435
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:
21982209
dependencies:
21992210
entities "^4.4.0"
22002211

2201-
patch-package@^6.4.7:
2212+
patch-package@^6.4.7, patch-package@^6.5.1:
22022213
version "6.5.1"
22032214
resolved "https://registry.yarnpkg.com/patch-package/-/patch-package-6.5.1.tgz#3e5d00c16997e6160291fee06a521c42ac99b621"
22042215
integrity sha512-I/4Zsalfhc6bphmJTlrLoOcAF87jcxko4q0qsv4bGcurbr8IskEOtdnt9iCmsQVGL1B+iUhSQqweyTLJfCF9rA==
@@ -2522,6 +2533,11 @@ [email protected]:
25222533
js-graph-algorithms "^1.0.18"
25232534
klaw "^4.0.1"
25242535

2536+
2537+
version "0.0.182"
2538+
resolved "https://registry.yarnpkg.com/solady/-/solady-0.0.182.tgz#bd8c47f128a3a752358ad052782773966d74c400"
2539+
integrity sha512-FW6xo1akJoYpkXMzu58/56FcNU3HYYNamEbnFO3iSibXk0nSHo0DV2Gu/zI3FPg3So5CCX6IYli1TT1IWATnvg==
2540+
25252541
solidity-ast@^0.4.51:
25262542
version "0.4.55"
25272543
resolved "https://registry.yarnpkg.com/solidity-ast/-/solidity-ast-0.4.55.tgz#00b685e6eefb2e8dfb67df1fe0afbe3b3bfb4b28"

0 commit comments

Comments
 (0)