Skip to content

V3 support #117

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

Open
wants to merge 61 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
2f18a57
Added fee token pricer command
yahgwai Sep 20, 2024
d529833
Updated nitro contracts version
yahgwai Sep 26, 2024
351be2e
Reset nitro contracts version
yahgwai Sep 26, 2024
534c41c
Run ci nightly for the release branch
yahgwai Jan 14, 2025
2b878bb
Merge branch 'release' into nightly-release-ci
yahgwai Jan 20, 2025
b2fcf42
Merged from release
yahgwai Feb 4, 2025
f504a0a
Commented out fee token pricer change
yahgwai Feb 4, 2025
939927d
Added docker tmp access
yahgwai Feb 4, 2025
b062685
Set config version
yahgwai Feb 8, 2025
12652fe
Use older geth version
yahgwai Feb 8, 2025
201f62f
Added v3 support
yahgwai Feb 9, 2025
58aa64c
Added buildx tmp file
yahgwai Feb 9, 2025
2a50b00
Use test branch
yahgwai Feb 9, 2025
5b05cf8
Comment out bold upgrade ci
yahgwai Feb 9, 2025
7cd51d0
Dont fail fast for matrix combos
yahgwai Feb 9, 2025
04f52f5
fix: config race workaround
gzeoneth Feb 10, 2025
2c0949a
revert: sleep
gzeoneth Feb 10, 2025
695a854
fix: nitro contract pin with correct stakeToken deployment
gzeoneth Feb 10, 2025
811cae8
workaround: dark magic
gzeoneth Feb 10, 2025
58ebd03
fix: enable bold
gzeoneth Feb 10, 2025
7d91c28
docs: explain dark magic
gzeoneth Feb 10, 2025
c15a9dc
feat: bold make nodes
gzeoneth Feb 10, 2025
ff58019
workaround: black magic for l3
gzeoneth Feb 10, 2025
c64ebf7
fix: enable block-validator in simple mode for bold
gzeoneth Feb 11, 2025
6e03e48
fix: remove dark magic
gzeoneth Feb 11, 2025
ba45e37
Revert "fix: remove dark magic"
gzeoneth Feb 11, 2025
d3e1fab
docs: explain
gzeoneth Feb 11, 2025
f277d70
Merge branch 'release' into v3-support
gzeoneth Feb 11, 2025
335ff17
wip: so far
gzeoneth Feb 11, 2025
caf6cc2
Merge remote-tracking branch 'origin/v3-support' into v3-support
gzeoneth Feb 11, 2025
650cb9a
Merge branch 'release' into nightly-release-ci
joshuacolvin0 Feb 21, 2025
e409c81
Merge from release
yahgwai Feb 21, 2025
af62d00
Switch back to stable
yahgwai Feb 21, 2025
1ec31a0
Merge pull request #88 from OffchainLabs/fee-token-pricer
joshuacolvin0 Feb 21, 2025
83d9514
Merge branch 'release' into nightly-release-ci
joshuacolvin0 Feb 21, 2025
72cd4e5
Merge pull request #110 from OffchainLabs/nightly-release-ci
joshuacolvin0 Feb 21, 2025
28c8160
Merge remote-tracking branch 'origin/master' into v3-support
gzeoneth Mar 17, 2025
cca465f
chore: update contract pin
gzeoneth Mar 17, 2025
dd3ffdb
chore: bump nitro
gzeoneth Mar 18, 2025
f6497a2
chore: use nitro v3.5.4-rc.1
gzeoneth Mar 21, 2025
9c8e25a
chore: update nitro-contract pin
gzeoneth Mar 21, 2025
7bafc5b
chore: use v3.5.4-rc.1 again
gzeoneth Mar 21, 2025
683351a
set latest nitro version
godzillaba Mar 26, 2025
ef577ec
Merge remote-tracking branch 'origin/release' into v3-support
gzeoneth Mar 28, 2025
aaf7be5
chore: use contract develop
gzeoneth Mar 28, 2025
3e4dfc2
revert: remove workaround
gzeoneth Mar 28, 2025
6a8bd3d
chore: remove bold upgrader
gzeoneth Mar 28, 2025
08ff5c2
workaround: disable use-smart-contract-wallet
gzeoneth Mar 29, 2025
57eaafc
fix: typo
gzeoneth Mar 29, 2025
a7b1654
fix: use same staker for l3
gzeoneth Mar 29, 2025
e120565
fix: generate l3 traffic
gzeoneth Mar 29, 2025
965bc97
workaround: slower activity
gzeoneth Mar 29, 2025
0a45f78
feat: deploy stylue deployer using create2 (#121)
gzeoneth Apr 16, 2025
15b3ac7
chore: use v3.6.0-rc.1
gzeoneth Apr 16, 2025
cb5bc8c
chore: use v3.1.0 contracts
gzeoneth Apr 16, 2025
a856bae
chore: workaround and todos
gzeoneth Apr 16, 2025
e12abbd
Merge branch 'master' into v3-support
gzeoneth Apr 16, 2025
de8cf4e
revert: workaround no longer required
gzeoneth Apr 17, 2025
fec8805
chore: use nitro-node v3.6.0
gzeoneth Apr 29, 2025
445db7f
Merge branch 'master' into v3-support
TucksonDev May 6, 2025
1fe1b72
Smol clarification comment
TucksonDev May 6, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 6 additions & 17 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
14 changes: 0 additions & 14 deletions boldupgrader/Dockerfile

This file was deleted.

11 changes: 0 additions & 11 deletions docker-compose-ci-cache.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
23 changes: 1 addition & 22 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -502,4 +482,3 @@ volumes:
das-committee-b-data:
das-mirror-data:
timeboost-auctioneer-data:
boldupgrader-data:
16 changes: 11 additions & 5 deletions scripts/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -436,7 +442,7 @@ function writeL3ChainConfig(argv: any) {
"EnableArbOS": true,
"AllowDebugPrecompiles": true,
"DataAvailabilityCommittee": false,
"InitialArbOSVersion": 31,
"InitialArbOSVersion": 32,
"InitialChainOwner": argv.l2owner,
"GenesisBlockNum": 0
}
Expand Down
114 changes: 114 additions & 0 deletions scripts/ethcommands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -142,6 +144,41 @@ async function deployERC20Contract(deployerWallet: Wallet, decimals: number): Pr
return token.address;
}

async function deployFeeTokenPricerContract(deployerWallet: Wallet, exchangeRate: BigNumber): Promise<string> {
//// 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<string> {
const wethFactory = new ContractFactory(TestWETH9.abi, TestWETH9.bytecode, deployerWallet);
const weth = await wethFactory.deploy("Wrapped Ether", "WETH");
Expand All @@ -150,6 +187,36 @@ async function deployWETHContract(deployerWallet: Wallet): Promise<string> {
return weth.address;
}

async function createStylusDeployer(deployerWallet: Wallet): Promise<string> {
// 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",
Expand Down Expand Up @@ -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)"])
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 4 additions & 0 deletions scripts/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
createERC20Command,
deployExpressLaneAuctionContractCommand,
createWETHCommand,
createStylusDeployerCommand,
transferERC20Command,
sendL1Command,
sendL2Command,
Expand All @@ -34,6 +35,7 @@ import {
setValidKeysetCommand,
waitForSyncCommand,
transferL3ChainOwnershipCommand,
createFeeTokenPricerCommand,
} from "./ethcommands";

async function main() {
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
18 changes: 17 additions & 1 deletion scripts/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]":
version "1.2.0"
resolved "https://registry.yarnpkg.com/@arbitrum/token-bridge-contracts/-/token-bridge-contracts-1.2.0.tgz#b1dc02e123393848d0d8e5c167028bafa0ac8229"
Expand Down Expand Up @@ -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==
Expand Down Expand Up @@ -2522,6 +2533,11 @@ [email protected]:
js-graph-algorithms "^1.0.18"
klaw "^4.0.1"

[email protected]:
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"
Expand Down
Loading