From f56756d9532ae7131d25e34dba0e3c832a450694 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 2 Oct 2024 12:16:00 +0200 Subject: [PATCH 01/30] Initial cut of timeboost app and account config --- docker-compose.yaml | 20 ++++++++++++++++++++ scripts/accounts.ts | 8 ++++++-- scripts/config.ts | 44 ++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 70 insertions(+), 2 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index f595b66a..eca6c965 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -415,6 +415,25 @@ services: command: - --conf.file=/config/l2_das_mirror.json + timeboost-auctioneer: + pid: host # allow debugging + image: nitro-node-dev-testnode + entrypoint: /usr/local/bin/autonomous-auctioneer + volumes: + - "config:/config" + - "timeboost-auctioneer-data:/data" + command: + - --auctioneer-server.redis-url redis://redis:6379 + depends_on: + - redis + + timeboost-bid-validator: + pid: host # allow debugging + image: nitro-node-dev-testnode + entrypoint: /usr/local/bin/autonomous-auctioneer + depends_on: + - redis + volumes: l1data: consensus: @@ -434,3 +453,4 @@ volumes: das-committee-a-data: das-committee-b-data: das-mirror-data: + timeboost-auctioneer-data: diff --git a/scripts/accounts.ts b/scripts/accounts.ts index 20c1cbbe..233d5f49 100644 --- a/scripts/accounts.ts +++ b/scripts/accounts.ts @@ -5,7 +5,7 @@ import * as crypto from "crypto"; import { runStress } from "./stress"; const path = require("path"); -const specialAccounts = 6; +const specialAccounts = 7; async function writeAccounts() { for (let i = 0; i < specialAccounts; i++) { @@ -47,6 +47,9 @@ export function namedAccount( if (name == "l2owner") { return specialAccount(5); } + if (name == "auctioneer") { + return specialAccount(6); + } if (name.startsWith("user_")) { return new ethers.Wallet( ethers.utils.sha256(ethers.utils.toUtf8Bytes(name)) @@ -85,7 +88,8 @@ export function namedAddress( export const namedAccountHelpString = "Valid account names:\n" + - " funnel | sequencer | validator | l2owner - known keys used by l2\n" + + " funnel | sequencer | validator | l2owner\n" + + " | auctioneer - known keys used by l2\n" + " l3owner | l3sequencer - known keys used by l3\n" + " user_[Alphanumeric] - key will be generated from username\n" + " threaduser_[Alphanumeric] - same as user_[Alphanumeric]_thread_[thread-id]\n" + diff --git a/scripts/config.ts b/scripts/config.ts index 15bc6f7b..eaf12c34 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -514,6 +514,42 @@ function dasBackendsJsonConfig(argv: any) { return backends } +function writeAutonomousAuctioneerConfig(argv: any) { + const autonomousAuctioneerConfig = { + "auctioneer-server": { + "auction-contract-address": "TODO", + "db-directory": "/data", + "redis-url": "redis://redis:6379", + "sequencer-endpoint": "http://sequencer:8547", + "sequencer-jwt-path": "/config/jwt.hex", + "wallet": { + "account": namedAddress("auctioneer"), + "password": consts.l1passphrase, + "pathname": consts.l1keystore + }, + }, + "bid-validator": { + "enable": false + } + } + const autonomousAuctioneerConfigJSON = JSON.stringify(autonomousAuctioneerConfig) + fs.writeFileSync(path.join(consts.configpath, "autonomous_auctioneer_config.json"), autonomousAuctioneerConfigJSON) +} + +function writeBidValidatorConfig(argv: any) { + const bidValidatorConfig = { + "auctioneer-server": { + "enable": false + } + "bid-validator": { + "auction-contract-address": "TODO", + "redis-url": "redis://redis:6379" + } + } + const bidValidatorConfigJSON = JSON.stringify(bidValidatorConfig) + fs.writeFileSync(path.join(consts.configpath, bid_validator_config.json"), bidValidatorConfigJSON) +} + export const writeConfigCommand = { command: "write-config", describe: "writes config files", @@ -620,3 +656,11 @@ export const writeL2DASKeysetConfigCommand = { writeL2DASKeysetConfig(argv) } } + +function auctioneerServerConfig(argv: any) { + const conf = { + "auctioneer-server": { + } + } + return conf +} From 9e68b9069690a133fff7fc2f0a9ad71f9aa3d464 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Thu, 10 Oct 2024 12:09:00 +0200 Subject: [PATCH 02/30] ExpressLaneAuction contract deploy from dev source This adds a command for deploying the ExpressLaneAuction contract: docker compose run scripts deploy-express-lane-auction Since the contracts branch with ExpressLaneAuction is not published to NPM this commit adds a way for it to be included from the local workspace into the scripts docker image with the --dev-contracts flag. The bash and docker logic here needs to be cleaned up so that it will use the NPM version when not using the --dev-contracts flag. The commit includes WIP code for initializing the contract. --- docker-compose.yaml | 2 +- scripts/Dockerfile | 20 ++++++++++- scripts/config.ts | 4 +-- scripts/ethcommands.ts | 78 ++++++++++++++++++++++++++++++++++++++++++ scripts/index.ts | 2 ++ scripts/package.json | 1 + test-node.bash | 22 ++++++++++-- 7 files changed, 123 insertions(+), 6 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index eca6c965..3f792a8a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -422,7 +422,7 @@ services: volumes: - "config:/config" - "timeboost-auctioneer-data:/data" - command: + command: - --auctioneer-server.redis-url redis://redis:6379 depends_on: - redis diff --git a/scripts/Dockerfile b/scripts/Dockerfile index ca2c677e..ede3ffba 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -1,7 +1,25 @@ -FROM node:18-bullseye-slim +# Stage 1: Base build environment +FROM node:18-bullseye-slim AS base WORKDIR /workspace COPY ./package.json ./yarn.lock ./ RUN yarn + +# Stage 2: Copy files and run build +FROM base AS pre-build COPY ./*.ts ./tsconfig.json ./ +COPY ./nitro-contracts ./nitro-contracts + +RUN if [ -d "./nitro-contracts" ]; then \ + echo "Overwriting @arbitrum/nitro-contracts with local version"; \ + rm -rf node_modules/@arbitrum/nitro-contracts; \ + cp -a ./nitro-contracts node_modules/@arbitrum/nitro-contracts; \ + else \ + echo "local nitro-contracts directory not found, using npm version"; \ + fi +# At this stage, the intermediate image will stop +RUN echo "Intermediate image created before yarn build" + +# Stage 3: Final build +FROM pre-build AS final RUN yarn build ENTRYPOINT ["node", "index.js"] diff --git a/scripts/config.ts b/scripts/config.ts index eaf12c34..701ba50f 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -540,14 +540,14 @@ function writeBidValidatorConfig(argv: any) { const bidValidatorConfig = { "auctioneer-server": { "enable": false - } + }, "bid-validator": { "auction-contract-address": "TODO", "redis-url": "redis://redis:6379" } } const bidValidatorConfigJSON = JSON.stringify(bidValidatorConfig) - fs.writeFileSync(path.join(consts.configpath, bid_validator_config.json"), bidValidatorConfigJSON) + fs.writeFileSync(path.join(consts.configpath, "bid_validator_config.json"), bidValidatorConfigJSON) } export const writeConfigCommand = { diff --git a/scripts/ethcommands.ts b/scripts/ethcommands.ts index 06285e79..51ec13f8 100644 --- a/scripts/ethcommands.ts +++ b/scripts/ethcommands.ts @@ -7,6 +7,7 @@ import * as L1AtomicTokenBridgeCreator from "@arbitrum/token-bridge-contracts/bu import * as ERC20 from "@openzeppelin/contracts/build/contracts/ERC20.json"; import * as fs from "fs"; import { ARB_OWNER } from "./consts"; +import * as ExpressLaneAuctionContract from "@arbitrum/nitro-contracts/out/ExpressLaneAuction.sol/ExpressLaneAuction.json" const path = require("path"); async function sendTransaction(argv: any, threadId: number) { @@ -372,6 +373,25 @@ export const createERC20Command = { }, }; +export const deployExpressLaneAuctionContractCommand = { + command: "deploy-express-lane-auction", + describe: "Deploy the ExpressLaneAuction contract", + builder: { + }, + handler: async (argv: any) => { + console.log("deploy ExpressLaneAuction contract"); + argv.provider = new ethers.providers.WebSocketProvider(argv.l2url); + const auctioneerWallet = namedAccount("auctioneer").connect(argv.provider) + const contractFactory = new ContractFactory(ExpressLaneAuctionContract.abi, ExpressLaneAuctionContract.bytecode, auctioneerWallet) + + const contract = await contractFactory.deploy(); + await contract.deployTransaction.wait(); + console.log("Contract deployed at address:", contract.address); + + 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)"]) @@ -391,6 +411,41 @@ async function setValidKeyset(argv: any, upgradeExecutorAddr: string, sequencerI argv.provider.destroy(); } +/* +// The ExpressLaneAuction contract has many configurable addresses, for simplicity +// this function just uses auctioneerAddr for all although in production this is unlikely to be true. +// This function also hardcoded the RoundTimingInfo +async function initializeAuctionContract(argv: any, auctionContractAddr: string, auctioneerAddr: string, biddingTokenAddr: string){ + const initIface = new ethers.utils.Interface(["function initialize((address,address,address,(uint64,uint64,uint64,uint64),uint256,address,address,address,address,address,address,address))"]) + argv.data = initIface.encodeFunctionData("initialize", [ + auctioneerAddr, //_auctioneer + biddingTokenAddr, //_biddingToken + auctioneerAddr, //_beneficiary + [ + 1728401460, // offsetTimestamp - TODO set this based on now()? + 60, // roundDurationSeconds + 15, // auctionClosingSeconds + 45 // reserveSubmissionSeconds + ],// RoundTiminginfo + 1, // _minReservePrice + auctioneerAddr, //_auctioneerAdmin + auctioneerAddr, //_minReservePriceSetter, + auctioneerAddr, //_reservePriceSetterAdmin, + auctioneerAddr, //_beneficiarySetter, + auctioneerAddr, //_roundTimingSetter, + auctioneerAddr //_masterAdmin + ]); + + argv.from = "l2owner"; + argv.to = "address_" + auctionContractAddr + argv.ethamount = "0" + + await sendTransaction(argv, 0); + + argv.provider.destroy(); +} +*/ + export const transferERC20Command = { command: "transfer-erc20", describe: "transfers ERC20 token", @@ -566,6 +621,29 @@ export const setValidKeysetCommand = { } }; +/* +export const initializeAuctionContractCommand = { + command: "initialize-auction-contract", + describe: "sets the anytrust keyset", + handler: async (argv: any) => { + argv.provider = new ethers.providers.WebSocketProvider(argv.l1url); + const deploydata = JSON.parse( + fs + .readFileSync(path.join(consts.configpath, "deployment.json")) + .toString() + ); + const sequencerInboxAddr = ethers.utils.hexlify(deploydata["sequencer-inbox"]); + const upgradeExecutorAddr = ethers.utils.hexlify(deploydata["upgrade-executor"]); + + const keyset = fs + .readFileSync(path.join(consts.configpath, "l2_das_keyset.hex")) + .toString() + + await setValidKeyset(argv, upgradeExecutorAddr, sequencerInboxAddr, keyset) + } +}; +*/ + export const waitForSyncCommand = { command: "wait-for-sync", describe: "wait for rpc to sync", diff --git a/scripts/index.ts b/scripts/index.ts index e9c8531c..33019cb5 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -14,6 +14,7 @@ import { bridgeNativeTokenToL3Command, bridgeToL3Command, createERC20Command, + deployExpressLaneAuctionContractCommand, transferERC20Command, sendL1Command, sendL2Command, @@ -40,6 +41,7 @@ async function main() { .command(bridgeToL3Command) .command(bridgeNativeTokenToL3Command) .command(createERC20Command) + .command(deployExpressLaneAuctionContractCommand) .command(transferERC20Command) .command(sendL1Command) .command(sendL2Command) diff --git a/scripts/package.json b/scripts/package.json index d1de3706..5f6e879a 100644 --- a/scripts/package.json +++ b/scripts/package.json @@ -6,6 +6,7 @@ "author": "Offchain Labs, Inc.", "license": "Apache-2.0", "dependencies": { + "@arbitrum/nitro-contracts": "^2.1.0", "@arbitrum/token-bridge-contracts": "1.2.0", "@node-redis/client": "^1.0.4", "@openzeppelin/contracts": "^4.9.3", diff --git a/test-node.bash b/test-node.bash index 9c7204cf..3bca7ccd 100755 --- a/test-node.bash +++ b/test-node.bash @@ -6,7 +6,7 @@ NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.2.1-d81324d-dev BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8 # This commit matches v2.1.0 release of nitro-contracts, with additional support to set arb owner through upgrade executor -DEFAULT_NITRO_CONTRACTS_VERSION="99c07a7db2fcce75b751c5a2bd4936e898cda065" +DEFAULT_NITRO_CONTRACTS_VERSION="a815490fce7c7869f026df88efb437856caa46d8" # TODO express lane latest DEFAULT_TOKEN_BRIDGE_VERSION="v1.2.2" # Set default versions if not overriden by provided env vars @@ -55,6 +55,7 @@ l2anytrust=false # Use the dev versions of nitro/blockscout dev_nitro=false dev_blockscout=false +dev_contracts=false # Rebuild docker images build_dev_nitro=false @@ -108,6 +109,10 @@ while [[ $# -gt 0 ]]; do done fi ;; + --dev-contracts) + dev_contracts=true + shift + ;; --build) build_dev_nitro=true build_dev_blockscout=true @@ -148,6 +153,7 @@ while [[ $# -gt 0 ]]; do ;; --force-build-utils) force_build_utils=true + build_utils=true shift ;; --validate) @@ -253,6 +259,7 @@ while [[ $# -gt 0 ]]; do echo --build rebuild docker images echo --no-build don\'t rebuild docker images echo --dev build nitro and blockscout dockers from source instead of pulling them. Disables simple mode + echo --dev-contracts build scripts with local development version of contracts echo --init remove all data, rebuild, deploy new rollup echo --pos l1 is a proof-of-stake chain \(using prysm for consensus\) echo --validate heavy computation, validating all blocks in WASM @@ -342,6 +349,12 @@ if $dev_blockscout && $build_dev_blockscout; then fi fi +# Use dev contracts when building scripts. See scripts/Dockerfile +# TODO handle non --dev-contracts case properly - dockerfile COPY expects dir to be there. +if ($build_utils || $build_node_images) && $dev_contracts; then + cp -ar ../contracts scripts/nitro-contracts +fi + if $build_utils; then LOCAL_BUILD_NODES="scripts rollupcreator" if $tokenbridge || $l3_token_bridge; then @@ -371,7 +384,12 @@ if $blockscout; then fi if $build_node_images; then - docker compose build --no-rm $NODES scripts + docker compose build --no-rm $NODES + docker compose build --no-rm scripts +fi + +if ($build_utils || $build_node_images) && $dev_contracts; then + rm -rf scripts/nitro-contracts fi if $force_init; then From e04b9f23bb06a21cdf976c57938c8afb8fcf4b5f Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Thu, 10 Oct 2024 15:09:23 +0200 Subject: [PATCH 03/30] Initiailize Auction contract via proxy --- scripts/ethcommands.ts | 113 ++++++++++++++++------------------------- 1 file changed, 44 insertions(+), 69 deletions(-) diff --git a/scripts/ethcommands.ts b/scripts/ethcommands.ts index 51ec13f8..472310ce 100644 --- a/scripts/ethcommands.ts +++ b/scripts/ethcommands.ts @@ -8,6 +8,7 @@ import * as ERC20 from "@openzeppelin/contracts/build/contracts/ERC20.json"; import * as fs from "fs"; import { ARB_OWNER } from "./consts"; import * as ExpressLaneAuctionContract from "@arbitrum/nitro-contracts/out/ExpressLaneAuction.sol/ExpressLaneAuction.json" +import * as TransparentUpgradeableProxy from "@openzeppelin/contracts/build/contracts/TransparentUpgradeableProxy.json" const path = require("path"); async function sendTransaction(argv: any, threadId: number) { @@ -294,7 +295,8 @@ export const createERC20Command = { builder: { deployer: { string: true, - describe: "account (see general help)" + describe: "account (see general help)", + demandOption: true }, bridgeable: { boolean: true, @@ -320,10 +322,7 @@ export const createERC20Command = { const l1provider = new ethers.providers.WebSocketProvider(argv.l1url); const l2provider = new ethers.providers.WebSocketProvider(argv.l2url); - const deployerWallet = new Wallet( - ethers.utils.sha256(ethers.utils.toUtf8Bytes(argv.deployer)), - l1provider - ); + const deployerWallet = namedAccount(argv.deployer).connect(l1provider) const tokenAddress = await deployERC20Contract(deployerWallet, argv.decimals); const token = new ethers.Contract(tokenAddress, ERC20.abi, deployerWallet); @@ -362,10 +361,7 @@ export const createERC20Command = { // no l1-l2 token bridge, deploy token on l2 directly argv.provider = new ethers.providers.WebSocketProvider(argv.l2url); - const deployerWallet = new Wallet( - ethers.utils.sha256(ethers.utils.toUtf8Bytes(argv.deployer)), - argv.provider - ); + const deployerWallet = namedAccount(argv.deployer).connect(argv.provider) const tokenAddress = await deployERC20Contract(deployerWallet, argv.decimals); console.log("Contract deployed at address:", tokenAddress); @@ -377,16 +373,53 @@ export const deployExpressLaneAuctionContractCommand = { command: "deploy-express-lane-auction", describe: "Deploy the ExpressLaneAuction contract", builder: { + "bidding-token": { + string: true, + describe: "bidding token address", + demandOption: true + }, + "auctioneer": { + string: true, + describe: "account name to set as auctioneer and admin on contract (default auctioneer)", + default: "auctioneer" + } }, handler: async (argv: any) => { console.log("deploy ExpressLaneAuction contract"); argv.provider = new ethers.providers.WebSocketProvider(argv.l2url); - const auctioneerWallet = namedAccount("auctioneer").connect(argv.provider) + const auctioneerWallet = namedAccount(argv.auctioneer).connect(argv.provider) const contractFactory = new ContractFactory(ExpressLaneAuctionContract.abi, ExpressLaneAuctionContract.bytecode, auctioneerWallet) const contract = await contractFactory.deploy(); await contract.deployTransaction.wait(); - console.log("Contract deployed at address:", contract.address); + console.log("ExpressLaneAuction contract deployed at address:", contract.address); + + const auctioneerAddr = namedAddress(argv.auctioneer) + const initIface = new ethers.utils.Interface(["function initialize((address,address,address,(uint64,uint64,uint64,uint64),uint256,address,address,address,address,address,address,address))"]) + const initData = initIface.encodeFunctionData("initialize", [[ + auctioneerAddr, //_auctioneer + argv.biddingToken, //_biddingToken + auctioneerAddr, //_beneficiary + [ + Math.round(Date.now() / 60000) * 60, // offsetTimestamp - most recent minute + 60, // roundDurationSeconds + 15, // auctionClosingSeconds + 45 // reserveSubmissionSeconds + ],// RoundTiminginfo + 1, // _minReservePrice + auctioneerAddr, //_auctioneerAdmin + auctioneerAddr, //_minReservePriceSetter, + auctioneerAddr, //_reservePriceSetter, + auctioneerAddr, //_reservePriceSetterAdmin, + auctioneerAddr, //_beneficiarySetter, + auctioneerAddr, //_roundTimingSetter, + auctioneerAddr //_masterAdmin + ]]); + + const proxyFactory = new ethers.ContractFactory(TransparentUpgradeableProxy.abi, TransparentUpgradeableProxy.bytecode, auctioneerWallet) + const proxy = await proxyFactory.deploy(contract.address, namedAddress(argv.auctioneer), initData) + await proxy.deployed() + console.log("Proxy(ExpressLaneAuction) contract deployed at address:", proxy.address); argv.provider.destroy(); } @@ -411,41 +444,6 @@ async function setValidKeyset(argv: any, upgradeExecutorAddr: string, sequencerI argv.provider.destroy(); } -/* -// The ExpressLaneAuction contract has many configurable addresses, for simplicity -// this function just uses auctioneerAddr for all although in production this is unlikely to be true. -// This function also hardcoded the RoundTimingInfo -async function initializeAuctionContract(argv: any, auctionContractAddr: string, auctioneerAddr: string, biddingTokenAddr: string){ - const initIface = new ethers.utils.Interface(["function initialize((address,address,address,(uint64,uint64,uint64,uint64),uint256,address,address,address,address,address,address,address))"]) - argv.data = initIface.encodeFunctionData("initialize", [ - auctioneerAddr, //_auctioneer - biddingTokenAddr, //_biddingToken - auctioneerAddr, //_beneficiary - [ - 1728401460, // offsetTimestamp - TODO set this based on now()? - 60, // roundDurationSeconds - 15, // auctionClosingSeconds - 45 // reserveSubmissionSeconds - ],// RoundTiminginfo - 1, // _minReservePrice - auctioneerAddr, //_auctioneerAdmin - auctioneerAddr, //_minReservePriceSetter, - auctioneerAddr, //_reservePriceSetterAdmin, - auctioneerAddr, //_beneficiarySetter, - auctioneerAddr, //_roundTimingSetter, - auctioneerAddr //_masterAdmin - ]); - - argv.from = "l2owner"; - argv.to = "address_" + auctionContractAddr - argv.ethamount = "0" - - await sendTransaction(argv, 0); - - argv.provider.destroy(); -} -*/ - export const transferERC20Command = { command: "transfer-erc20", describe: "transfers ERC20 token", @@ -621,29 +619,6 @@ export const setValidKeysetCommand = { } }; -/* -export const initializeAuctionContractCommand = { - command: "initialize-auction-contract", - describe: "sets the anytrust keyset", - handler: async (argv: any) => { - argv.provider = new ethers.providers.WebSocketProvider(argv.l1url); - const deploydata = JSON.parse( - fs - .readFileSync(path.join(consts.configpath, "deployment.json")) - .toString() - ); - const sequencerInboxAddr = ethers.utils.hexlify(deploydata["sequencer-inbox"]); - const upgradeExecutorAddr = ethers.utils.hexlify(deploydata["upgrade-executor"]); - - const keyset = fs - .readFileSync(path.join(consts.configpath, "l2_das_keyset.hex")) - .toString() - - await setValidKeyset(argv, upgradeExecutorAddr, sequencerInboxAddr, keyset) - } -}; -*/ - export const waitForSyncCommand = { command: "wait-for-sync", describe: "wait for rpc to sync", From 41905df91c7108fb546a71b84fa025f9a3744801 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Thu, 10 Oct 2024 18:52:02 +0200 Subject: [PATCH 04/30] --l2-timeboost mode, write auctioneer and val conf --- docker-compose.yaml | 7 ++++- scripts/config.ts | 75 +++++++++++++++++++++++++++------------------ scripts/index.ts | 13 +++++++- test-node.bash | 17 ++++++++-- 4 files changed, 79 insertions(+), 33 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 3f792a8a..45e22f9a 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -422,8 +422,9 @@ services: volumes: - "config:/config" - "timeboost-auctioneer-data:/data" + - "l1keystore:/home/user/l1keystore" command: - - --auctioneer-server.redis-url redis://redis:6379 + - --conf.file=/config/autonomous_auctioneer_config.json depends_on: - redis @@ -431,6 +432,10 @@ services: pid: host # allow debugging image: nitro-node-dev-testnode entrypoint: /usr/local/bin/autonomous-auctioneer + volumes: + - "config:/config" + command: + - --conf.file=/config/bid_validator_config.json depends_on: - redis diff --git a/scripts/config.ts b/scripts/config.ts index 701ba50f..7d7c371a 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -385,7 +385,7 @@ function writeL2ChainConfig(argv: any) { "EnableArbOS": true, "AllowDebugPrecompiles": true, "DataAvailabilityCommittee": argv.anytrust, - "InitialArbOSVersion": 32, + "InitialArbOSVersion": 31, // TODO put back to version 32 "InitialChainOwner": argv.l2owner, "GenesisBlockNum": 0 } @@ -514,40 +514,57 @@ function dasBackendsJsonConfig(argv: any) { return backends } +export const writeTimeboostConfigsCommand = { + command: "write-timeboost-configs", + describe: "writes configs for the timeboost autonomous auctioneer and bid validator", + builder: { + "auction-contract": { + string: true, + describe: "auction contract address", + demandOption: true + }, + }, + handler: (argv: any) => { + writeAutonomousAuctioneerConfig(argv) + writeBidValidatorConfig(argv) + } +} + function writeAutonomousAuctioneerConfig(argv: any) { - const autonomousAuctioneerConfig = { - "auctioneer-server": { - "auction-contract-address": "TODO", - "db-directory": "/data", - "redis-url": "redis://redis:6379", - "sequencer-endpoint": "http://sequencer:8547", - "sequencer-jwt-path": "/config/jwt.hex", - "wallet": { - "account": namedAddress("auctioneer"), - "password": consts.l1passphrase, - "pathname": consts.l1keystore - }, - }, - "bid-validator": { - "enable": false - } + const autonomousAuctioneerConfig = { + "auctioneer-server": { + "auction-contract-address": argv.auctionContract, + "db-directory": "/data", + "redis-url": "redis://redis:6379", + "sequencer-endpoint": "http://sequencer:8547", + "sequencer-jwt-path": "/config/jwt.hex", + "wallet": { + "account": namedAddress("auctioneer"), + "password": consts.l1passphrase, + "pathname": consts.l1keystore + }, + }, + "bid-validator": { + "enable": false } - const autonomousAuctioneerConfigJSON = JSON.stringify(autonomousAuctioneerConfig) - fs.writeFileSync(path.join(consts.configpath, "autonomous_auctioneer_config.json"), autonomousAuctioneerConfigJSON) + } + const autonomousAuctioneerConfigJSON = JSON.stringify(autonomousAuctioneerConfig) + fs.writeFileSync(path.join(consts.configpath, "autonomous_auctioneer_config.json"), autonomousAuctioneerConfigJSON) } function writeBidValidatorConfig(argv: any) { - const bidValidatorConfig = { - "auctioneer-server": { - "enable": false - }, - "bid-validator": { - "auction-contract-address": "TODO", - "redis-url": "redis://redis:6379" - } + const bidValidatorConfig = { + "auctioneer-server": { + "enable": false + }, + "bid-validator": { + "auction-contract-address": argv.auctionContract, + "redis-url": "redis://redis:6379", + "sequencer-endpoint": "http://sequencer:8547" } - const bidValidatorConfigJSON = JSON.stringify(bidValidatorConfig) - fs.writeFileSync(path.join(consts.configpath, "bid_validator_config.json"), bidValidatorConfigJSON) + } + const bidValidatorConfigJSON = JSON.stringify(bidValidatorConfig) + fs.writeFileSync(path.join(consts.configpath, "bid_validator_config.json"), bidValidatorConfigJSON) } export const writeConfigCommand = { diff --git a/scripts/index.ts b/scripts/index.ts index 33019cb5..4f7d81ee 100644 --- a/scripts/index.ts +++ b/scripts/index.ts @@ -2,7 +2,17 @@ import { hideBin } from "yargs/helpers"; import Yargs from "yargs/yargs"; import { stressOptions } from "./stress"; import { redisReadCommand, redisInitCommand } from "./redis"; -import { writeConfigCommand, writeGethGenesisCommand, writePrysmCommand, writeL2ChainConfigCommand, writeL3ChainConfigCommand, writeL2DASCommitteeConfigCommand, writeL2DASMirrorConfigCommand, writeL2DASKeysetConfigCommand } from "./config"; +import { + writeConfigCommand, + writeGethGenesisCommand, + writePrysmCommand, + writeL2ChainConfigCommand, + writeL3ChainConfigCommand, + writeL2DASCommitteeConfigCommand, + writeL2DASMirrorConfigCommand, + writeL2DASKeysetConfigCommand, + writeTimeboostConfigsCommand +} from "./config"; import { printAddressCommand, namedAccountHelpString, @@ -58,6 +68,7 @@ async function main() { .command(writeL2DASKeysetConfigCommand) .command(writePrysmCommand) .command(writeAccountsCommand) + .command(writeTimeboostConfigsCommand) .command(printAddressCommand) .command(printPrivateKeyCommand) .command(redisReadCommand) diff --git a/test-node.bash b/test-node.bash index 3bca7ccd..5ff3405d 100755 --- a/test-node.bash +++ b/test-node.bash @@ -51,6 +51,7 @@ devprivkey=b6b15c8cb491557369f3c7d2c287b053eb229daa9c22138887752191c9520659 l1chainid=1337 simple=true l2anytrust=false +l2timeboost=false # Use the dev versions of nitro/blockscout dev_nitro=false @@ -233,6 +234,10 @@ while [[ $# -gt 0 ]]; do l2anytrust=true shift ;; + --l2-timeboost) + l2timeboost=true + shift + ;; --redundantsequencers) simple=false redundantsequencers=$2 @@ -268,6 +273,7 @@ while [[ $# -gt 0 ]]; do echo --l3-fee-token-decimals Number of decimals to use for custom fee token. Only valid if also '--l3-fee-token' is provided echo --l3-token-bridge Deploy L2-L3 token bridge. Only valid if also '--l3node' is provided echo --l2-anytrust run the L2 as an AnyTrust chain + echo --l2-timeboost run the L2 with Timeboost enabled, including auctioneer and bid validator echo --batchposters batch posters [0-3] echo --redundantsequencers redundant sequencers [0-3] echo --detach detach from nodes after running them @@ -384,8 +390,7 @@ if $blockscout; then fi if $build_node_images; then - docker compose build --no-rm $NODES - docker compose build --no-rm scripts + docker compose build --no-rm $NODES scripts fi if ($build_utils || $build_node_images) && $dev_contracts; then @@ -513,6 +518,14 @@ if $force_init; then docker compose run scripts bridge-funds --ethamount 100000 --wait docker compose run scripts send-l2 --ethamount 100 --to l2owner --wait + if $l2timeboost; then + docker compose run scripts send-l2 --ethamount 100 --to auctioneer --wait + biddingTokenAddress=`docker compose run scripts create-erc20 --deployer auctioneer | tail -n 1 | awk '{ print $NF }'` + auctionContractAddress=`docker compose run scripts deploy-express-lane-auction --bidding-token $biddingTokenAddress | tail -n 1 | awk '{ print $NF }'` + docker compose run scripts write-timeboost-configs --auction-contract $auctionContractAddress + docker compose run --user root --entrypoint sh timeboost-auctioneer -c "chown -R 1000:1000 /data" + fi + if $tokenbridge; then echo == Deploying L1-L2 token bridge sleep 10 # no idea why this sleep is needed but without it the deploy fails randomly From 2bf4141d43fc5e06258446770c27d961796ab2fc Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Fri, 11 Oct 2024 12:09:34 +0200 Subject: [PATCH 05/30] Start auctioneer + bid validator, set up usr accts --- test-node.bash | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/test-node.bash b/test-node.bash index 5ff3405d..c044134f 100755 --- a/test-node.bash +++ b/test-node.bash @@ -522,8 +522,16 @@ if $force_init; then docker compose run scripts send-l2 --ethamount 100 --to auctioneer --wait biddingTokenAddress=`docker compose run scripts create-erc20 --deployer auctioneer | tail -n 1 | awk '{ print $NF }'` auctionContractAddress=`docker compose run scripts deploy-express-lane-auction --bidding-token $biddingTokenAddress | tail -n 1 | awk '{ print $NF }'` + echo == Starting up Timeboost auctioneer and bid validator. + echo == Bidding token ($biddingTokenAddress), auction contract ($auctionContractAddress) docker compose run scripts write-timeboost-configs --auction-contract $auctionContractAddress docker compose run --user root --entrypoint sh timeboost-auctioneer -c "chown -R 1000:1000 /data" + docker compose up --wait timeboost-auctioneer timeboost-bid-validator + echo == Funding alice and bob user accounts for timeboost testing + docker compose run scripts send-l2 --ethamount 10 --to user_alice --wait + docker compose run scripts send-l2 --ethamount 10 --to user_bob --wait + docker compose run scripts transfer-erc20 --token $biddingTokenAddress --amount 10000 --from auctioneer --to user_alice + docker compose run scripts transfer-erc20 --token $biddingTokenAddress --amount 10000 --from auctioneer --to user_bob fi if $tokenbridge; then From b5d2b0388388d78d95b1713592faa64dfd9caa1b Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Tue, 15 Oct 2024 17:28:45 +0200 Subject: [PATCH 06/30] Bounce sequencer w changed conf to start timeboost --- docker-compose.yaml | 2 +- scripts/config.ts | 3 +++ test-node.bash | 12 ++++++++++-- 3 files changed, 14 insertions(+), 3 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 45e22f9a..1ee116aa 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -167,7 +167,7 @@ services: - "l1keystore:/home/user/l1keystore" - "config:/config" - "tokenbridge-data:/tokenbridge-data" - command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain * + command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain * --execution.sequencer.timeboost.sequencer-http-endpoint http://sequencer:8547 depends_on: - geth diff --git a/scripts/config.ts b/scripts/config.ts index 7d7c371a..b4d36d58 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -258,6 +258,9 @@ function writeConfigs(argv: any) { "execution": { "sequencer": { "enable": false, + "timeboost": { + "enable": false + } }, "forwarding-target": "null", }, diff --git a/test-node.bash b/test-node.bash index c044134f..419e96a9 100755 --- a/test-node.bash +++ b/test-node.bash @@ -336,6 +336,10 @@ if $blockscout; then NODES="$NODES blockscout" fi +if $l2timeboost; then + NODES="$NODES timeboost-auctioneer timeboost-bid-validator" +fi + if $dev_nitro && $build_dev_nitro; then echo == Building Nitro if ! [ -n "${NITRO_SRC+set}" ]; then @@ -522,16 +526,20 @@ if $force_init; then docker compose run scripts send-l2 --ethamount 100 --to auctioneer --wait biddingTokenAddress=`docker compose run scripts create-erc20 --deployer auctioneer | tail -n 1 | awk '{ print $NF }'` auctionContractAddress=`docker compose run scripts deploy-express-lane-auction --bidding-token $biddingTokenAddress | tail -n 1 | awk '{ print $NF }'` + auctioneerAddress=`docker compose run scripts print-address --account auctioneer | tail -n1 | tr -d '\r\n'` echo == Starting up Timeboost auctioneer and bid validator. - echo == Bidding token ($biddingTokenAddress), auction contract ($auctionContractAddress) + echo == Bidding token: $biddingTokenAddress, auction contract $auctionContractAddress docker compose run scripts write-timeboost-configs --auction-contract $auctionContractAddress docker compose run --user root --entrypoint sh timeboost-auctioneer -c "chown -R 1000:1000 /data" - docker compose up --wait timeboost-auctioneer timeboost-bid-validator + echo == Funding alice and bob user accounts for timeboost testing docker compose run scripts send-l2 --ethamount 10 --to user_alice --wait docker compose run scripts send-l2 --ethamount 10 --to user_bob --wait docker compose run scripts transfer-erc20 --token $biddingTokenAddress --amount 10000 --from auctioneer --to user_alice docker compose run scripts transfer-erc20 --token $biddingTokenAddress --amount 10000 --from auctioneer --to user_bob + + docker compose run --entrypoint sh scripts -c "sed -i 's/\(\"execution\":{\"sequencer\":{\"enable\":true,\"timeboost\":{\"enable\":\)false/\1true,\"auction-contract-address\":\"$auctionContractAddress\",\"auctioneer-address\":\"$auctioneerAddress\"/' /config/sequencer_config.json" --wait + docker compose restart sequencer fi if $tokenbridge; then From 27230906f15e4a40ea9639a64b535fe5dd54ba24 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Fri, 18 Oct 2024 16:02:08 +0200 Subject: [PATCH 07/30] Fixes to get timeboost working e2e Open ports and set up auth endpoint correctly on sequencer. Deploy auction contract with l2owner instead of auctioneer accounts (admin account on proxy contract cannot make calls on the proxied-to contract). --- docker-compose.yaml | 9 ++++++++- scripts/config.ts | 2 +- scripts/ethcommands.ts | 8 ++++---- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1ee116aa..073f03e1 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -161,13 +161,14 @@ services: ports: - "127.0.0.1:8547:8547" - "127.0.0.1:8548:8548" + - "127.0.0.1:9549:8549" - "127.0.0.1:9642:9642" volumes: - "seqdata:/home/user/.arbitrum/local/nitro" - "l1keystore:/home/user/l1keystore" - "config:/config" - "tokenbridge-data:/tokenbridge-data" - command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain * --execution.sequencer.timeboost.sequencer-http-endpoint http://sequencer:8547 + command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain * --execution.sequencer.timeboost.sequencer-http-endpoint http://sequencer:8547 --auth.addr 0.0.0.0 --auth.api auctioneer,eth,validation --auth.jwtsecret=/config/jwt.hex --auth.origins * depends_on: - geth @@ -432,10 +433,16 @@ services: pid: host # allow debugging image: nitro-node-dev-testnode entrypoint: /usr/local/bin/autonomous-auctioneer + ports: + - "127.0.0.1:9372:8547" volumes: - "config:/config" command: - --conf.file=/config/bid_validator_config.json + - --http.addr=0.0.0.0 + - --http.corsdomain=* + - --http.api=auctioneer + - --log-level=INFO depends_on: - redis diff --git a/scripts/config.ts b/scripts/config.ts index b4d36d58..859f9aba 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -539,7 +539,7 @@ function writeAutonomousAuctioneerConfig(argv: any) { "auction-contract-address": argv.auctionContract, "db-directory": "/data", "redis-url": "redis://redis:6379", - "sequencer-endpoint": "http://sequencer:8547", + "sequencer-endpoint": "ws://sequencer:8549", "sequencer-jwt-path": "/config/jwt.hex", "wallet": { "account": namedAddress("auctioneer"), diff --git a/scripts/ethcommands.ts b/scripts/ethcommands.ts index 472310ce..a4f7e8f5 100644 --- a/scripts/ethcommands.ts +++ b/scripts/ethcommands.ts @@ -387,8 +387,8 @@ export const deployExpressLaneAuctionContractCommand = { handler: async (argv: any) => { console.log("deploy ExpressLaneAuction contract"); argv.provider = new ethers.providers.WebSocketProvider(argv.l2url); - const auctioneerWallet = namedAccount(argv.auctioneer).connect(argv.provider) - const contractFactory = new ContractFactory(ExpressLaneAuctionContract.abi, ExpressLaneAuctionContract.bytecode, auctioneerWallet) + const l2OwnerWallet = namedAccount("l2owner").connect(argv.provider) + const contractFactory = new ContractFactory(ExpressLaneAuctionContract.abi, ExpressLaneAuctionContract.bytecode, l2OwnerWallet) const contract = await contractFactory.deploy(); await contract.deployTransaction.wait(); @@ -416,8 +416,8 @@ export const deployExpressLaneAuctionContractCommand = { auctioneerAddr //_masterAdmin ]]); - const proxyFactory = new ethers.ContractFactory(TransparentUpgradeableProxy.abi, TransparentUpgradeableProxy.bytecode, auctioneerWallet) - const proxy = await proxyFactory.deploy(contract.address, namedAddress(argv.auctioneer), initData) + const proxyFactory = new ethers.ContractFactory(TransparentUpgradeableProxy.abi, TransparentUpgradeableProxy.bytecode, l2OwnerWallet) + const proxy = await proxyFactory.deploy(contract.address, namedAddress("l2owner"), initData) await proxy.deployed() console.log("Proxy(ExpressLaneAuction) contract deployed at address:", proxy.address); From 53c2236814e8892fc4c148b36944313c97cd3193 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Mon, 21 Oct 2024 15:20:27 +0200 Subject: [PATCH 08/30] Non-dev contracts workaround --- scripts/Dockerfile | 2 +- test-node.bash | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index ede3ffba..4c46f9d3 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -9,7 +9,7 @@ FROM base AS pre-build COPY ./*.ts ./tsconfig.json ./ COPY ./nitro-contracts ./nitro-contracts -RUN if [ -d "./nitro-contracts" ]; then \ +RUN if [ -d "./nitro-contracts/DEV_CONTRACTS" ]; then \ echo "Overwriting @arbitrum/nitro-contracts with local version"; \ rm -rf node_modules/@arbitrum/nitro-contracts; \ cp -a ./nitro-contracts node_modules/@arbitrum/nitro-contracts; \ diff --git a/test-node.bash b/test-node.bash index 419e96a9..7df14926 100755 --- a/test-node.bash +++ b/test-node.bash @@ -360,9 +360,13 @@ if $dev_blockscout && $build_dev_blockscout; then fi # Use dev contracts when building scripts. See scripts/Dockerfile -# TODO handle non --dev-contracts case properly - dockerfile COPY expects dir to be there. if ($build_utils || $build_node_images) && $dev_contracts; then cp -ar ../contracts scripts/nitro-contracts + touch scripts/nitro-contracts/DEV_CONTRACTS +else + # The scripts/dockerfile COPY directive expects the nitro-contracts dir + # to be there even if it is empty. + mkdir scripts/nitro-contracts fi if $build_utils; then @@ -397,7 +401,8 @@ if $build_node_images; then docker compose build --no-rm $NODES scripts fi -if ($build_utils || $build_node_images) && $dev_contracts; then +# Clean up nitro-contracts dir needed by scripts dockerfile. +if [ -d scripts/nitro-contracts ]; then rm -rf scripts/nitro-contracts fi From e3c0ac9f02603462f72f1814f92aa9ac7e55594b Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Mon, 21 Oct 2024 15:24:05 +0200 Subject: [PATCH 09/30] Set default contracts back to version on master --- test-node.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-node.bash b/test-node.bash index 7df14926..c8c4b4f5 100755 --- a/test-node.bash +++ b/test-node.bash @@ -6,7 +6,7 @@ NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.2.1-d81324d-dev BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8 # This commit matches v2.1.0 release of nitro-contracts, with additional support to set arb owner through upgrade executor -DEFAULT_NITRO_CONTRACTS_VERSION="a815490fce7c7869f026df88efb437856caa46d8" # TODO express lane latest +DEFAULT_NITRO_CONTRACTS_VERSION="99c07a7db2fcce75b751c5a2bd4936e898cda065" DEFAULT_TOKEN_BRIDGE_VERSION="v1.2.2" # Set default versions if not overriden by provided env vars From 690c96e1b4d47cf6a6bc018942f8aafcadc93a90 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Mon, 21 Oct 2024 15:45:50 +0200 Subject: [PATCH 10/30] Note about writeL2ChainConfig timeboost arbos vers --- scripts/config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/config.ts b/scripts/config.ts index 859f9aba..dea50842 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -388,7 +388,7 @@ function writeL2ChainConfig(argv: any) { "EnableArbOS": true, "AllowDebugPrecompiles": true, "DataAvailabilityCommittee": argv.anytrust, - "InitialArbOSVersion": 31, // TODO put back to version 32 + "InitialArbOSVersion": 32, // TODO For Timeboost, this still needs to be set to 31 "InitialChainOwner": argv.l2owner, "GenesisBlockNum": 0 } From 57e29251b352c077854eeebc6f81385273d72aae Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Mon, 21 Oct 2024 16:08:55 +0200 Subject: [PATCH 11/30] Make inclusion of auction contract optional --- scripts/ethcommands.ts | 14 +++++++++++++- test-node.bash | 2 ++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/scripts/ethcommands.ts b/scripts/ethcommands.ts index a4f7e8f5..7d14e79d 100644 --- a/scripts/ethcommands.ts +++ b/scripts/ethcommands.ts @@ -7,10 +7,17 @@ import * as L1AtomicTokenBridgeCreator from "@arbitrum/token-bridge-contracts/bu import * as ERC20 from "@openzeppelin/contracts/build/contracts/ERC20.json"; import * as fs from "fs"; import { ARB_OWNER } from "./consts"; -import * as ExpressLaneAuctionContract from "@arbitrum/nitro-contracts/out/ExpressLaneAuction.sol/ExpressLaneAuction.json" import * as TransparentUpgradeableProxy from "@openzeppelin/contracts/build/contracts/TransparentUpgradeableProxy.json" const path = require("path"); +let ExpressLaneAuctionContract: any; +try { + ExpressLaneAuctionContract = require("@arbitrum/nitro-contracts/out/ExpressLaneAuction.sol/ExpressLaneAuction.json"); +} catch (e) { + console.warn("ExpressLaneAuction contract JSON not found. This is expected if not running with --l2timeboost."); +} + + async function sendTransaction(argv: any, threadId: number) { const account = namedAccount(argv.from, threadId).connect(argv.provider) const startNonce = await account.getTransactionCount("pending") @@ -385,6 +392,11 @@ export const deployExpressLaneAuctionContractCommand = { } }, handler: async (argv: any) => { + if (!ExpressLaneAuctionContract) { + console.error("ExpressLaneAuctionContract is not available. Ensure that you are using the correct contracts branch."); + process.exit(1); + } + console.log("deploy ExpressLaneAuction contract"); argv.provider = new ethers.providers.WebSocketProvider(argv.l2url); const l2OwnerWallet = namedAccount("l2owner").connect(argv.provider) diff --git a/test-node.bash b/test-node.bash index c8c4b4f5..9e0c3ebe 100755 --- a/test-node.bash +++ b/test-node.bash @@ -361,11 +361,13 @@ fi # Use dev contracts when building scripts. See scripts/Dockerfile if ($build_utils || $build_node_images) && $dev_contracts; then + rm -rf scripts/nitro-contracts cp -ar ../contracts scripts/nitro-contracts touch scripts/nitro-contracts/DEV_CONTRACTS else # The scripts/dockerfile COPY directive expects the nitro-contracts dir # to be there even if it is empty. + rm -rf scripts/nitro-contracts mkdir scripts/nitro-contracts fi From 92148779498f0ce8b98107da78ccd9b8a5928a20 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Mon, 21 Oct 2024 17:05:54 +0200 Subject: [PATCH 12/30] Remove setting sequencer-http-endpoint in yaml The default value in nitro should work. --- docker-compose.yaml | 2 +- scripts/config.ts | 16 +++++++++++----- test-node.bash | 8 ++++++-- 3 files changed, 18 insertions(+), 8 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 073f03e1..1702cfbe 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -168,7 +168,7 @@ services: - "l1keystore:/home/user/l1keystore" - "config:/config" - "tokenbridge-data:/tokenbridge-data" - command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain * --execution.sequencer.timeboost.sequencer-http-endpoint http://sequencer:8547 --auth.addr 0.0.0.0 --auth.api auctioneer,eth,validation --auth.jwtsecret=/config/jwt.hex --auth.origins * + command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain * --auth.addr 0.0.0.0 --auth.api auctioneer,eth,validation --auth.jwtsecret=/config/jwt.hex --auth.origins * depends_on: - geth diff --git a/scripts/config.ts b/scripts/config.ts index dea50842..c5b4a6b8 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -257,10 +257,7 @@ function writeConfigs(argv: any) { }, "execution": { "sequencer": { - "enable": false, - "timeboost": { - "enable": false - } + "enable": false }, "forwarding-target": "null", }, @@ -312,6 +309,11 @@ function writeConfigs(argv: any) { sequencerConfig.node["seq-coordinator"].enable = true sequencerConfig.execution["sequencer"].enable = true sequencerConfig.node["delayed-sequencer"].enable = true + if (argv.timeboost) { + sequencerConfig.execution.sequencer.timeboost = { + "enable": true + }; + } fs.writeFileSync(path.join(consts.configpath, "sequencer_config.json"), JSON.stringify(sequencerConfig)) let posterConfig = JSON.parse(baseConfJSON) @@ -594,7 +596,11 @@ export const writeConfigCommand = { describe: "DAS committee member B BLS pub key", default: "" }, - + timeboost: { + boolean: true, + describe: "run sequencer in timeboost mode", + default: false + }, }, handler: (argv: any) => { writeConfigs(argv) diff --git a/test-node.bash b/test-node.bash index 9e0c3ebe..f19291f4 100755 --- a/test-node.bash +++ b/test-node.bash @@ -483,6 +483,7 @@ if $force_init; then fi # $force_init anytrustNodeConfigLine="" +timeboostNodeConfigLine="" # Remaining init may require AnyTrust committee/mirrors to have been started if $l2anytrust; then @@ -512,12 +513,15 @@ if $l2anytrust; then fi if $force_init; then + if $l2timeboost; then + timeboostNodeConfigLine="--timeboost" + fi if $simple; then echo == Writing configs - docker compose run scripts write-config --simple $anytrustNodeConfigLine + docker compose run scripts write-config --simple $anytrustNodeConfigLine $timeboostNodeConfigLine else echo == Writing configs - docker compose run scripts write-config $anytrustNodeConfigLine + docker compose run scripts write-config $anytrustNodeConfigLine $timeboostNodeConfigLine echo == Initializing redis docker compose up --wait redis From a4dedcb8c064216097b4483b303c8aeb55db9d63 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Tue, 22 Oct 2024 12:25:04 +0200 Subject: [PATCH 13/30] Fix scripts dockerfile contracts existence check --- scripts/Dockerfile | 2 +- test-node.bash | 8 +------- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 4c46f9d3..0d4e8b26 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -9,7 +9,7 @@ FROM base AS pre-build COPY ./*.ts ./tsconfig.json ./ COPY ./nitro-contracts ./nitro-contracts -RUN if [ -d "./nitro-contracts/DEV_CONTRACTS" ]; then \ +RUN if [ -f "./nitro-contracts/DEV_CONTRACTS" ]; then \ echo "Overwriting @arbitrum/nitro-contracts with local version"; \ rm -rf node_modules/@arbitrum/nitro-contracts; \ cp -a ./nitro-contracts node_modules/@arbitrum/nitro-contracts; \ diff --git a/test-node.bash b/test-node.bash index f19291f4..a0babc68 100755 --- a/test-node.bash +++ b/test-node.bash @@ -360,14 +360,13 @@ if $dev_blockscout && $build_dev_blockscout; then fi # Use dev contracts when building scripts. See scripts/Dockerfile +rm -rf scripts/nitro-contracts if ($build_utils || $build_node_images) && $dev_contracts; then - rm -rf scripts/nitro-contracts cp -ar ../contracts scripts/nitro-contracts touch scripts/nitro-contracts/DEV_CONTRACTS else # The scripts/dockerfile COPY directive expects the nitro-contracts dir # to be there even if it is empty. - rm -rf scripts/nitro-contracts mkdir scripts/nitro-contracts fi @@ -403,11 +402,6 @@ if $build_node_images; then docker compose build --no-rm $NODES scripts fi -# Clean up nitro-contracts dir needed by scripts dockerfile. -if [ -d scripts/nitro-contracts ]; then - rm -rf scripts/nitro-contracts -fi - if $force_init; then echo == Removing old data.. docker compose down From bad7cdc041a66da4b616fbf2eff8eff42439ff29 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Tue, 22 Oct 2024 12:34:38 +0200 Subject: [PATCH 14/30] Fix timeboost seq conf, initally must be false --- scripts/config.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/config.ts b/scripts/config.ts index c5b4a6b8..952c6349 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -310,9 +310,11 @@ function writeConfigs(argv: any) { sequencerConfig.execution["sequencer"].enable = true sequencerConfig.node["delayed-sequencer"].enable = true if (argv.timeboost) { - sequencerConfig.execution.sequencer.timeboost = { - "enable": true - }; + // Initially we create it disabled but then replace it using test-node.bash + // once we have the contract and auctioneer address. + sequencerConfig.execution.sequencer.timeboost = { + "enable": false + }; } fs.writeFileSync(path.join(consts.configpath, "sequencer_config.json"), JSON.stringify(sequencerConfig)) From f9a6efa72d232eb37e7630e3666ba8174d4485bd Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Fri, 25 Oct 2024 12:26:58 +0200 Subject: [PATCH 15/30] Add timeboost rpc to sequencer command line Even if using an nitro image that doesn't have timeboost enabled yet, nitro will still start after logging an error message. Unavailable modules in HTTP API list unavailable=[timeboost] available="[admin debug web3 eth txpool personal net arb arbdebug arbtrace]" --- docker-compose.yaml | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 1702cfbe..5665fec6 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -168,7 +168,19 @@ services: - "l1keystore:/home/user/l1keystore" - "config:/config" - "tokenbridge-data:/tokenbridge-data" - command: --conf.file /config/sequencer_config.json --node.feed.output.enable --node.feed.output.port 9642 --http.api net,web3,eth,txpool,debug --node.seq-coordinator.my-url ws://sequencer:8548 --graphql.enable --graphql.vhosts * --graphql.corsdomain * --auth.addr 0.0.0.0 --auth.api auctioneer,eth,validation --auth.jwtsecret=/config/jwt.hex --auth.origins * + command: + - --conf.file=/config/sequencer_config.json + - --node.feed.output.enable + - --node.feed.output.port=9642 + - --http.api=net,web3,eth,txpool,debug,timeboost + - --node.seq-coordinator.my-url=ws://sequencer:8548 + - --graphql.enable + - --graphql.vhosts=* + - --graphql.corsdomain=* + - --auth.addr=0.0.0.0 + - --auth.api=auctioneer,eth,validation + - --auth.jwtsecret=/config/jwt.hex + - --auth.origins=* depends_on: - geth From 358074364161702d4f7ae9f5f580431f9076ecf3 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 30 Oct 2024 19:26:46 +0100 Subject: [PATCH 16/30] Fix vhosts for timeboost-bid-validator --- docker-compose.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/docker-compose.yaml b/docker-compose.yaml index 5665fec6..890bed6d 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -452,6 +452,7 @@ services: command: - --conf.file=/config/bid_validator_config.json - --http.addr=0.0.0.0 + - --http.vhosts=* - --http.corsdomain=* - --http.api=auctioneer - --log-level=INFO From 437d8aa15a796972e653ce6e497f2df889095fe6 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Thu, 21 Nov 2024 12:12:08 -0800 Subject: [PATCH 17/30] Set a better default ReserveSubmissionSeconds ReserveSubmissionSeconds represents a period BEFORE the auction closes that the reserve price may be updated for the next round. The previous setting of 45 seconds means that the reserve price could not be updated at all after the round started, coupled with the auction closing period of 15 seconds (round duration is 60 seconds). --- scripts/ethcommands.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/ethcommands.ts b/scripts/ethcommands.ts index 7d14e79d..0942cbc1 100644 --- a/scripts/ethcommands.ts +++ b/scripts/ethcommands.ts @@ -416,7 +416,7 @@ export const deployExpressLaneAuctionContractCommand = { Math.round(Date.now() / 60000) * 60, // offsetTimestamp - most recent minute 60, // roundDurationSeconds 15, // auctionClosingSeconds - 45 // reserveSubmissionSeconds + 15 // reserveSubmissionSeconds ],// RoundTiminginfo 1, // _minReservePrice auctioneerAddr, //_auctioneerAdmin From 78a369a3189204f650ea04a51b439a1e09b99448 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Thu, 21 Nov 2024 15:20:49 -0800 Subject: [PATCH 18/30] Set correct contracts version, new init iface --- scripts/ethcommands.ts | 2 +- test-node.bash | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/ethcommands.ts b/scripts/ethcommands.ts index 0942cbc1..79134951 100644 --- a/scripts/ethcommands.ts +++ b/scripts/ethcommands.ts @@ -407,7 +407,7 @@ export const deployExpressLaneAuctionContractCommand = { console.log("ExpressLaneAuction contract deployed at address:", contract.address); const auctioneerAddr = namedAddress(argv.auctioneer) - const initIface = new ethers.utils.Interface(["function initialize((address,address,address,(uint64,uint64,uint64,uint64),uint256,address,address,address,address,address,address,address))"]) + const initIface = new ethers.utils.Interface(["function initialize((address,address,address,(int64,uint64,uint64,uint64),uint256,address,address,address,address,address,address,address))"]) const initData = initIface.encodeFunctionData("initialize", [[ auctioneerAddr, //_auctioneer argv.biddingToken, //_biddingToken diff --git a/test-node.bash b/test-node.bash index a0babc68..8026a7d8 100755 --- a/test-node.bash +++ b/test-node.bash @@ -6,7 +6,7 @@ NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.2.1-d81324d-dev BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8 # This commit matches v2.1.0 release of nitro-contracts, with additional support to set arb owner through upgrade executor -DEFAULT_NITRO_CONTRACTS_VERSION="99c07a7db2fcce75b751c5a2bd4936e898cda065" +DEFAULT_NITRO_CONTRACTS_VERSION="bec7d629c5f4a9dc4ec786e9d6e99734a11d109b" DEFAULT_TOKEN_BRIDGE_VERSION="v1.2.2" # Set default versions if not overriden by provided env vars From c177f282340285bcdae2d6a784547e2bb8b97498 Mon Sep 17 00:00:00 2001 From: Gabriel de Quadros Ligneul Date: Thu, 12 Dec 2024 12:56:40 -0300 Subject: [PATCH 19/30] Set ensure-rollup-deployment to false Disable this feature because the testnode doesn't support finalized blocks. --- scripts/config.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/scripts/config.ts b/scripts/config.ts index 15bc6f7b..add522b2 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -177,6 +177,7 @@ function writeConfigs(argv: any) { const valJwtSecret = path.join(consts.configpath, "val_jwt.hex") const chainInfoFile = path.join(consts.configpath, "l2_chain_info.json") let baseConfig = { + "ensure-rollup-deployment": false, "parent-chain": { "connection": { "url": argv.l1url, From 15a2bfea7030377771c5d2749f24afc6b48c5deb Mon Sep 17 00:00:00 2001 From: Ganesh Vanahalli Date: Fri, 27 Dec 2024 15:17:27 -0600 Subject: [PATCH 20/30] Set track-block-metadata-from flag to a non-zero value when sequencer is enabled (required for timeboost) --- scripts/config.ts | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/scripts/config.ts b/scripts/config.ts index add522b2..ec8bf3b2 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -192,7 +192,7 @@ function writeConfigs(argv: any) { "dangerous": { "without-block-validator": false }, - "parent-chain-wallet" : { + "parent-chain-wallet": { "account": namedAddress("validator"), "password": consts.l1passphrase, "pathname": consts.l1keystore, @@ -204,6 +204,9 @@ function writeConfigs(argv: any) { "strategy": "MakeNodes", }, "sequencer": false, + "transaction-streamer": { + "track-block-metadata-from": 0 + }, "dangerous": { "no-sequencer-coordinator": false, "disable-blob-reader": true, @@ -226,7 +229,7 @@ function writeConfigs(argv: any) { "redis-url": argv.redisUrl, "max-delay": "30s", "l1-block-bound": "ignore", - "parent-chain-wallet" : { + "parent-chain-wallet": { "account": namedAddress("sequencer"), "password": consts.l1passphrase, "pathname": consts.l1keystore, @@ -285,6 +288,7 @@ function writeConfigs(argv: any) { simpleConfig.node.staker["use-smart-contract-wallet"] = true simpleConfig.node.staker.dangerous["without-block-validator"] = true simpleConfig.node.sequencer = true + simpleConfig.node["transaction-streamer"]["track-block-metadata-from"] = 1 simpleConfig.node.dangerous["no-sequencer-coordinator"] = true simpleConfig.node["delayed-sequencer"].enable = true simpleConfig.node["batch-poster"].enable = true @@ -307,6 +311,7 @@ function writeConfigs(argv: any) { let sequencerConfig = JSON.parse(baseConfJSON) sequencerConfig.node.sequencer = true + sequencerConfig.node["transaction-streamer"]["track-block-metadata-from"] = 1 sequencerConfig.node["seq-coordinator"].enable = true sequencerConfig.execution["sequencer"].enable = true sequencerConfig.node["delayed-sequencer"].enable = true @@ -331,6 +336,7 @@ function writeConfigs(argv: any) { l3Config.node.staker.enable = true l3Config.node.staker["use-smart-contract-wallet"] = true l3Config.node.sequencer = true + l3Config.node["transaction-streamer"]["track-block-metadata-from"] = 1 l3Config.execution["sequencer"].enable = true l3Config.node["dangerous"]["no-sequencer-coordinator"] = true l3Config.node["delayed-sequencer"].enable = true @@ -520,9 +526,9 @@ export const writeConfigCommand = { describe: "writes config files", builder: { simple: { - boolean: true, - describe: "simple config (sequencer is also poster, validator)", - default: false, + boolean: true, + describe: "simple config (sequencer is also poster, validator)", + default: false, }, anytrust: { boolean: true, @@ -540,7 +546,7 @@ export const writeConfigCommand = { default: "" }, - }, + }, handler: (argv: any) => { writeConfigs(argv) } @@ -616,8 +622,8 @@ export const writeL2DASKeysetConfigCommand = { describe: "DAS committee member B BLS pub key", default: "" }, - }, + }, handler: (argv: any) => { - writeL2DASKeysetConfig(argv) + writeL2DASKeysetConfig(argv) } } From 32c817a762327235694981edfb0fcf7594010c22 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Mon, 20 Jan 2025 17:32:14 +0100 Subject: [PATCH 21/30] Remove contracts hack, use released version --- scripts/Dockerfile | 10 ---------- scripts/ethcommands.ts | 14 +------------- scripts/package.json | 2 +- test-node.bash | 14 +------------- 4 files changed, 3 insertions(+), 37 deletions(-) diff --git a/scripts/Dockerfile b/scripts/Dockerfile index 0d4e8b26..88bf9dcb 100644 --- a/scripts/Dockerfile +++ b/scripts/Dockerfile @@ -7,16 +7,6 @@ RUN yarn # Stage 2: Copy files and run build FROM base AS pre-build COPY ./*.ts ./tsconfig.json ./ -COPY ./nitro-contracts ./nitro-contracts - -RUN if [ -f "./nitro-contracts/DEV_CONTRACTS" ]; then \ - echo "Overwriting @arbitrum/nitro-contracts with local version"; \ - rm -rf node_modules/@arbitrum/nitro-contracts; \ - cp -a ./nitro-contracts node_modules/@arbitrum/nitro-contracts; \ - else \ - echo "local nitro-contracts directory not found, using npm version"; \ - fi -# At this stage, the intermediate image will stop RUN echo "Intermediate image created before yarn build" # Stage 3: Final build diff --git a/scripts/ethcommands.ts b/scripts/ethcommands.ts index 79134951..02e7af18 100644 --- a/scripts/ethcommands.ts +++ b/scripts/ethcommands.ts @@ -8,16 +8,9 @@ import * as ERC20 from "@openzeppelin/contracts/build/contracts/ERC20.json"; 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" const path = require("path"); -let ExpressLaneAuctionContract: any; -try { - ExpressLaneAuctionContract = require("@arbitrum/nitro-contracts/out/ExpressLaneAuction.sol/ExpressLaneAuction.json"); -} catch (e) { - console.warn("ExpressLaneAuction contract JSON not found. This is expected if not running with --l2timeboost."); -} - - async function sendTransaction(argv: any, threadId: number) { const account = namedAccount(argv.from, threadId).connect(argv.provider) const startNonce = await account.getTransactionCount("pending") @@ -392,11 +385,6 @@ export const deployExpressLaneAuctionContractCommand = { } }, handler: async (argv: any) => { - if (!ExpressLaneAuctionContract) { - console.error("ExpressLaneAuctionContract is not available. Ensure that you are using the correct contracts branch."); - process.exit(1); - } - console.log("deploy ExpressLaneAuction contract"); argv.provider = new ethers.providers.WebSocketProvider(argv.l2url); const l2OwnerWallet = namedAccount("l2owner").connect(argv.provider) diff --git a/scripts/package.json b/scripts/package.json index 5f6e879a..c2dc9db9 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.0", + "@arbitrum/nitro-contracts": "^2.1.1", "@arbitrum/token-bridge-contracts": "1.2.0", "@node-redis/client": "^1.0.4", "@openzeppelin/contracts": "^4.9.3", diff --git a/test-node.bash b/test-node.bash index 8026a7d8..1c8e4c6b 100755 --- a/test-node.bash +++ b/test-node.bash @@ -5,8 +5,7 @@ set -eu NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.2.1-d81324d-dev BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8 -# This commit matches v2.1.0 release of nitro-contracts, with additional support to set arb owner through upgrade executor -DEFAULT_NITRO_CONTRACTS_VERSION="bec7d629c5f4a9dc4ec786e9d6e99734a11d109b" +DEFAULT_NITRO_CONTRACTS_VERSION="v2.1.1" DEFAULT_TOKEN_BRIDGE_VERSION="v1.2.2" # Set default versions if not overriden by provided env vars @@ -359,17 +358,6 @@ if $dev_blockscout && $build_dev_blockscout; then fi fi -# Use dev contracts when building scripts. See scripts/Dockerfile -rm -rf scripts/nitro-contracts -if ($build_utils || $build_node_images) && $dev_contracts; then - cp -ar ../contracts scripts/nitro-contracts - touch scripts/nitro-contracts/DEV_CONTRACTS -else - # The scripts/dockerfile COPY directive expects the nitro-contracts dir - # to be there even if it is empty. - mkdir scripts/nitro-contracts -fi - if $build_utils; then LOCAL_BUILD_NODES="scripts rollupcreator" if $tokenbridge || $l3_token_bridge; then From 392c7d50970678d397359d01f7ffd2f9a6432552 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Tue, 28 Jan 2025 12:37:16 +0100 Subject: [PATCH 22/30] Support multiple sequencers with timeboost Advertise http port instead of ws port to sequencer coordinator. Only the http APIs are configured in the docker-compose.yaml so it behaves more like you would expect. Restart all initial sequencers instead of just "sequencer" when setting up timeboost. --- docker-compose.yaml | 24 ++++++++++++++---------- scripts/config.ts | 2 +- scripts/redis.ts | 4 ++-- test-node.bash | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 890bed6d..168ca181 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -161,7 +161,6 @@ services: ports: - "127.0.0.1:8547:8547" - "127.0.0.1:8548:8548" - - "127.0.0.1:9549:8549" - "127.0.0.1:9642:9642" volumes: - "seqdata:/home/user/.arbitrum/local/nitro" @@ -172,15 +171,11 @@ services: - --conf.file=/config/sequencer_config.json - --node.feed.output.enable - --node.feed.output.port=9642 - - --http.api=net,web3,eth,txpool,debug,timeboost - - --node.seq-coordinator.my-url=ws://sequencer:8548 + - --http.api=net,web3,eth,txpool,debug,timeboost,auctioneer + - --node.seq-coordinator.my-url=http://sequencer:8547 - --graphql.enable - --graphql.vhosts=* - --graphql.corsdomain=* - - --auth.addr=0.0.0.0 - - --auth.api=auctioneer,eth,validation - - --auth.jwtsecret=/config/jwt.hex - - --auth.origins=* depends_on: - geth @@ -194,7 +189,10 @@ services: volumes: - "seqdata_b:/home/user/.arbitrum/local/nitro" - "config:/config" - command: --conf.file /config/sequencer_config.json --node.seq-coordinator.my-url ws://sequencer_b:8548 + command: + - --conf.file=/config/sequencer_config.json + - --node.seq-coordinator.my-url=http://sequencer_b:8547 + - --http.api=net,web3,eth,txpool,debug,timeboost,auctioneer depends_on: - geth - redis @@ -209,7 +207,10 @@ services: volumes: - "seqdata_c:/home/user/.arbitrum/local/nitro" - "config:/config" - command: --conf.file /config/sequencer_config.json --node.seq-coordinator.my-url ws://sequencer_c:8548 + command: + - --conf.file=/config/sequencer_config.json + - --node.seq-coordinator.my-url=http://sequencer_c:8547 + - --http.api=net,web3,eth,txpool,debug,timeboost,auctioneer depends_on: - geth - redis @@ -224,7 +225,10 @@ services: volumes: - "seqdata_d:/home/user/.arbitrum/local/nitro" - "config:/config" - command: --conf.file /config/sequencer_config.json --node.seq-coordinator.my-url ws://sequencer_d:8548 + command: + - --conf.file=/config/sequencer_config.json + - --node.seq-coordinator.my-url=http://sequencer_d:8547 + - --http.api=net,web3,eth,txpool,debug,timeboost,auctioneer depends_on: - geth - redis diff --git a/scripts/config.ts b/scripts/config.ts index ea0f16de..41bd63a8 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -550,7 +550,7 @@ function writeAutonomousAuctioneerConfig(argv: any) { "auction-contract-address": argv.auctionContract, "db-directory": "/data", "redis-url": "redis://redis:6379", - "sequencer-endpoint": "ws://sequencer:8549", + "sequencer-endpoint": "http://sequencer:8547", "sequencer-jwt-path": "/config/jwt.hex", "wallet": { "account": namedAddress("auctioneer"), diff --git a/scripts/redis.ts b/scripts/redis.ts index 1d13c21d..1282368a 100644 --- a/scripts/redis.ts +++ b/scripts/redis.ts @@ -40,14 +40,14 @@ async function writeRedisPriorities(redisUrl: string, priorities: number) { let prio_sequencers = "bcd"; let priostring = ""; if (priorities == 0) { - priostring = "ws://sequencer:8548"; + priostring = "http://sequencer:8547"; } if (priorities > prio_sequencers.length) { priorities = prio_sequencers.length; } for (let index = 0; index < priorities; index++) { const this_prio = - "ws://sequencer_" + prio_sequencers.charAt(index) + ":8548"; + "http://sequencer_" + prio_sequencers.charAt(index) + ":8547"; if (index != 0) { priostring = priostring + ","; } diff --git a/test-node.bash b/test-node.bash index 1c8e4c6b..53ef70cc 100755 --- a/test-node.bash +++ b/test-node.bash @@ -532,7 +532,7 @@ if $force_init; then docker compose run scripts transfer-erc20 --token $biddingTokenAddress --amount 10000 --from auctioneer --to user_bob docker compose run --entrypoint sh scripts -c "sed -i 's/\(\"execution\":{\"sequencer\":{\"enable\":true,\"timeboost\":{\"enable\":\)false/\1true,\"auction-contract-address\":\"$auctionContractAddress\",\"auctioneer-address\":\"$auctioneerAddress\"/' /config/sequencer_config.json" --wait - docker compose restart sequencer + docker compose restart $INITIAL_SEQ_NODES fi if $tokenbridge; then From 387ac8cc66c1bcf7062629702f851fc6eb4492d0 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Tue, 28 Jan 2025 19:19:13 +0100 Subject: [PATCH 23/30] Use redis coordinator to find sequencer Also remove jwt token for auctioneer api. --- scripts/config.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/config.ts b/scripts/config.ts index 41bd63a8..ce4bcf50 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -319,7 +319,8 @@ function writeConfigs(argv: any) { // Initially we create it disabled but then replace it using test-node.bash // once we have the contract and auctioneer address. sequencerConfig.execution.sequencer.timeboost = { - "enable": false + "enable": false, + "redis-url": argv.redisUrl }; } fs.writeFileSync(path.join(consts.configpath, "sequencer_config.json"), JSON.stringify(sequencerConfig)) @@ -550,8 +551,8 @@ function writeAutonomousAuctioneerConfig(argv: any) { "auction-contract-address": argv.auctionContract, "db-directory": "/data", "redis-url": "redis://redis:6379", - "sequencer-endpoint": "http://sequencer:8547", - "sequencer-jwt-path": "/config/jwt.hex", + "use-redis-coordinator": true, + "redis-coordinator-url": "redis://redis:6379", "wallet": { "account": namedAddress("auctioneer"), "password": consts.l1passphrase, From 4c9cd5f56738367e6e024bf760849c54207c82f5 Mon Sep 17 00:00:00 2001 From: Tsahi Zidenberg Date: Fri, 31 Jan 2025 20:26:31 -0700 Subject: [PATCH 24/30] use track-block-metadata in chain-config --- scripts/config.ts | 10 +--------- test-node.bash | 6 +++++- 2 files changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/config.ts b/scripts/config.ts index ce4bcf50..ee756305 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -204,9 +204,6 @@ function writeConfigs(argv: any) { "strategy": "MakeNodes", }, "sequencer": false, - "transaction-streamer": { - "track-block-metadata-from": 0 - }, "dangerous": { "no-sequencer-coordinator": false, "disable-blob-reader": true, @@ -288,7 +285,6 @@ function writeConfigs(argv: any) { simpleConfig.node.staker["use-smart-contract-wallet"] = true simpleConfig.node.staker.dangerous["without-block-validator"] = true simpleConfig.node.sequencer = true - simpleConfig.node["transaction-streamer"]["track-block-metadata-from"] = 1 simpleConfig.node.dangerous["no-sequencer-coordinator"] = true simpleConfig.node["delayed-sequencer"].enable = true simpleConfig.node["batch-poster"].enable = true @@ -311,15 +307,12 @@ function writeConfigs(argv: any) { let sequencerConfig = JSON.parse(baseConfJSON) sequencerConfig.node.sequencer = true - sequencerConfig.node["transaction-streamer"]["track-block-metadata-from"] = 1 sequencerConfig.node["seq-coordinator"].enable = true sequencerConfig.execution["sequencer"].enable = true sequencerConfig.node["delayed-sequencer"].enable = true if (argv.timeboost) { - // Initially we create it disabled but then replace it using test-node.bash - // once we have the contract and auctioneer address. sequencerConfig.execution.sequencer.timeboost = { - "enable": false, + "enable": true, "redis-url": argv.redisUrl }; } @@ -344,7 +337,6 @@ function writeConfigs(argv: any) { l3Config.node.staker.enable = true l3Config.node.staker["use-smart-contract-wallet"] = true l3Config.node.sequencer = true - l3Config.node["transaction-streamer"]["track-block-metadata-from"] = 1 l3Config.execution["sequencer"].enable = true l3Config.node["dangerous"]["no-sequencer-coordinator"] = true l3Config.node["delayed-sequencer"].enable = true diff --git a/test-node.bash b/test-node.bash index 53ef70cc..b525b49d 100755 --- a/test-node.bash +++ b/test-node.bash @@ -460,7 +460,11 @@ if $force_init; then echo == Deploying L2 chain docker compose run -e PARENT_CHAIN_RPC="http://geth:8545" -e DEPLOYER_PRIVKEY=$l2ownerKey -e PARENT_CHAIN_ID=$l1chainid -e CHILD_CHAIN_NAME="arb-dev-test" -e MAX_DATA_SIZE=117964 -e OWNER_ADDRESS=$l2ownerAddress -e WASM_MODULE_ROOT=$wasmroot -e SEQUENCER_ADDRESS=$sequenceraddress -e AUTHORIZE_VALIDATORS=10 -e CHILD_CHAIN_CONFIG_PATH="/config/l2_chain_config.json" -e CHAIN_DEPLOYMENT_INFO="/config/deployment.json" -e CHILD_CHAIN_INFO="/config/deployed_chain_info.json" rollupcreator create-rollup-testnode - docker compose run --entrypoint sh rollupcreator -c "jq [.[]] /config/deployed_chain_info.json > /config/l2_chain_info.json" + if $l2timeboost; then + docker compose run --entrypoint sh rollupcreator -c 'jq ".[] | .\"track-block-metadata-from\"=1 | [.]" /config/deployed_chain_info.json > /config/l2_chain_info.json' + else + docker compose run --entrypoint sh rollupcreator -c "jq [.[]] /config/deployed_chain_info.json > /config/l2_chain_info.json" + fi fi # $force_init From 0b008e6135944c68182e8a79503897b68df0e03a Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Mon, 10 Feb 2025 18:13:29 +0100 Subject: [PATCH 25/30] use execution.sequencer.dangerous.timeboost --- scripts/config.ts | 3 ++- test-node.bash | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/scripts/config.ts b/scripts/config.ts index ee756305..934cb4f5 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -311,7 +311,8 @@ function writeConfigs(argv: any) { sequencerConfig.execution["sequencer"].enable = true sequencerConfig.node["delayed-sequencer"].enable = true if (argv.timeboost) { - sequencerConfig.execution.sequencer.timeboost = { + sequencerConfig.execution.sequencer.dangerous = {}; + sequencerConfig.execution.sequencer.dangerous.timeboost = { "enable": true, "redis-url": argv.redisUrl }; diff --git a/test-node.bash b/test-node.bash index b525b49d..5b415777 100755 --- a/test-node.bash +++ b/test-node.bash @@ -535,7 +535,7 @@ if $force_init; then docker compose run scripts transfer-erc20 --token $biddingTokenAddress --amount 10000 --from auctioneer --to user_alice docker compose run scripts transfer-erc20 --token $biddingTokenAddress --amount 10000 --from auctioneer --to user_bob - docker compose run --entrypoint sh scripts -c "sed -i 's/\(\"execution\":{\"sequencer\":{\"enable\":true,\"timeboost\":{\"enable\":\)false/\1true,\"auction-contract-address\":\"$auctionContractAddress\",\"auctioneer-address\":\"$auctioneerAddress\"/' /config/sequencer_config.json" --wait + docker compose run --entrypoint sh scripts -c "sed -i 's/\(\"execution\":{\"sequencer\":{\"enable\":true,\"dangerous\":{\"timeboost\":{\"enable\":\)false/\1true,\"auction-contract-address\":\"$auctionContractAddress\",\"auctioneer-address\":\"$auctioneerAddress\"/' /config/sequencer_config.json" --wait docker compose restart $INITIAL_SEQ_NODES fi From 801b432afeaf465c16b39e921c2d3911e203b7c2 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Mon, 10 Feb 2025 18:14:39 +0100 Subject: [PATCH 26/30] Use latest release containing timeboost --- test-node.bash | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test-node.bash b/test-node.bash index 5b415777..fb2729df 100755 --- a/test-node.bash +++ b/test-node.bash @@ -2,7 +2,7 @@ set -eu -NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.2.1-d81324d-dev +NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.5.1-rc.2-69577b7 BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8 DEFAULT_NITRO_CONTRACTS_VERSION="v2.1.1" From 3c850b3d5c2d921e0bc2acadf6dd0cb090ea358f Mon Sep 17 00:00:00 2001 From: Diego Ximenes Date: Mon, 10 Feb 2025 17:15:15 -0300 Subject: [PATCH 27/30] Removes --geth-genesis-json-out=/config/geth_genesis.json from create_beacon_chain_genesis --- docker-compose.yaml | 1 - 1 file changed, 1 deletion(-) diff --git a/docker-compose.yaml b/docker-compose.yaml index 168ca181..184e564c 100644 --- a/docker-compose.yaml +++ b/docker-compose.yaml @@ -98,7 +98,6 @@ services: - --output-ssz=/consensus/genesis.ssz - --chain-config-file=/config/prysm.yaml - --geth-genesis-json-in=/config/geth_genesis.json - - --geth-genesis-json-out=/config/geth_genesis.json volumes: - "consensus:/consensus" - "config:/config" From 29521d6b8c08384f42e66f3ce9b328b6d455e3a2 Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Wed, 12 Feb 2025 14:20:28 +0100 Subject: [PATCH 28/30] Fix bad merge resolution --- scripts/ethcommands.ts | 9 --------- 1 file changed, 9 deletions(-) diff --git a/scripts/ethcommands.ts b/scripts/ethcommands.ts index 5e47974f..05347434 100644 --- a/scripts/ethcommands.ts +++ b/scripts/ethcommands.ts @@ -344,15 +344,6 @@ export const createERC20Command = { .toString() ); - const l1provider = new ethers.providers.WebSocketProvider(argv.l1url); - const l2provider = new ethers.providers.WebSocketProvider(argv.l2url); - - const deployerWallet = namedAccount(argv.deployer).connect(l1provider) - - const tokenAddress = await deployERC20Contract(deployerWallet, argv.decimals); - const token = new ethers.Contract(tokenAddress, ERC20.abi, deployerWallet); - console.log("Contract deployed at L1 address:", token.address); - const l1GatewayRouter = new ethers.Contract(l1l2tokenbridge.l2Network.tokenBridge.l1GatewayRouter, L1GatewayRouter.abi, deployerWallet); await (await token.functions.approve(l1l2tokenbridge.l2Network.tokenBridge.l1ERC20Gateway, ethers.constants.MaxUint256)).wait(); const supply = await token.totalSupply(); From 585de4ad29e96bfbd032522d7845a800bc568c2a Mon Sep 17 00:00:00 2001 From: Tristan Wilson Date: Thu, 20 Feb 2025 12:10:46 +0100 Subject: [PATCH 29/30] Fix timeboost flag and update nitro ver --- scripts/config.ts | 2 +- test-node.bash | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/config.ts b/scripts/config.ts index f90e652e..33cde21a 100644 --- a/scripts/config.ts +++ b/scripts/config.ts @@ -323,7 +323,7 @@ function writeConfigs(argv: any) { if (argv.timeboost) { sequencerConfig.execution.sequencer.dangerous = {}; sequencerConfig.execution.sequencer.dangerous.timeboost = { - "enable": true, + "enable": false, // Create it false initially, turn it on with sed in test-node.bash after contract setup. "redis-url": argv.redisUrl }; } diff --git a/test-node.bash b/test-node.bash index 52c4fa4c..f8a9a9fb 100755 --- a/test-node.bash +++ b/test-node.bash @@ -2,7 +2,7 @@ set -eu -NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.5.1-rc.2-69577b7 +NITRO_NODE_VERSION=offchainlabs/nitro-node:v3.5.3-rc.3-653b078 BLOCKSCOUT_VERSION=offchainlabs/blockscout:v1.1.0-0e716c8 DEFAULT_NITRO_CONTRACTS_VERSION="v2.1.1-beta.0" From 3a826de46363d0fdacf3ea178df7b06ccb281ee2 Mon Sep 17 00:00:00 2001 From: Pepper Lebeck-Jobe Date: Thu, 3 Apr 2025 11:08:58 +0200 Subject: [PATCH 30/30] Update the blockscout pin This pulls in the Abi files for contract changes that are active on the `master` branch of the nitro repository. --- blockscout | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockscout b/blockscout index 60d60cb3..3a1ba51e 160000 --- a/blockscout +++ b/blockscout @@ -1 +1 @@ -Subproject commit 60d60cb331b0289d39c7480379a14a86100af37a +Subproject commit 3a1ba51edf359b893050c25de5a1bb26c245c942