Skip to content
This repository has been archived by the owner on Nov 26, 2024. It is now read-only.

Commit

Permalink
Merge commit '9a6bfad2363322099d399698751551ff044c7a72' into nitro-2.…
Browse files Browse the repository at this point in the history
…2.5-merge
  • Loading branch information
tsahee committed Mar 11, 2024
2 parents 5666569 + 9a6bfad commit aeaae5d
Show file tree
Hide file tree
Showing 118 changed files with 11,421 additions and 2,379 deletions.
7 changes: 7 additions & 0 deletions .env.sample.goerli
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
ROLLUP_CREATOR_ADDRESS=""
ARBISCAN_API_KEY=""
## deployer key
DEVNET_PRIVKEY=""

## optional - address of already deployed ERC20 token which shall be used as rollup's fee token
FEE_TOKEN_ADDRESS=""
78 changes: 76 additions & 2 deletions .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,31 @@ on:
- develop

jobs:
test-unit:
name: Test unit
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Setup node/yarn
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install packages
run: yarn

- name: Build
run: forge test
tests:
name: Contract tests
runs-on: ubuntu-8
Expand All @@ -19,14 +44,26 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Setup nodejs
uses: actions/setup-node@v2
with:
node-version: '16'
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- name: Install dependencies
run: yarn install

Expand All @@ -37,14 +74,17 @@ jobs:
run: yarn lint:test

- name: Build
run: yarn build
run: yarn build:all

- name: Run tests
run: yarn hardhat --network hardhat test test/contract/*.spec.ts

- name: Interface compatibility
run: yarn run test:compatibility

- name: Forge build
run: forge build

- name: Test Storage Layouts
run: yarn run test:storage

Expand All @@ -58,3 +98,37 @@ jobs:
files: ./contracts/coverage.json
verbose: false
token: ${{ secrets.CODECOV_TOKEN }}
test-4844:
name: 4844 tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
with:
version: nightly

- uses: OffchainLabs/actions/run-nitro-test-node@test-node-args
with:
nitro-testnode-ref: deneb-integration
args: --pos
no-token-bridge: true

- name: Setup nodejs
uses: actions/setup-node@v2
with:
node-version: '18'
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

- name: Install dependencies
run: yarn install

- name: Build
run: yarn build:all

- name: Test 4844
run: yarn test:4844
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,8 @@ node_modules/
deployments/
/test/prover/proofs/*.json
/test/prover/spec-proofs/*.json
/test/storage/*-old.dot
/test/storage/*-old
scripts/config.ts
forge-cache/
out/
.env
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "lib/forge-std"]
path = lib/forge-std
url = https://github.com/foundry-rs/forge-std
2 changes: 2 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ coverage/**
deployments/**
src/lib/abi/**
.nyc_output
out/**
lib/**
2 changes: 1 addition & 1 deletion .prettierrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ module.exports = {
printWidth: 100,
singleQuote: false,
bracketSpacing: false,
compiler: '0.8.6',
compiler: '0.8.9',
},
},
],
Expand Down
5 changes: 4 additions & 1 deletion deploy/SequencerInbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@ module.exports = async hre => {
const { deploy } = deployments
const { deployer } = await getNamedAccounts()

await deploy('SequencerInbox', { from: deployer, args: [] })
const blobBasefeeReader = await ethers.getContract('BlobBasefeeReader')
const dataHashReader = await ethers.getContract('DataHashReader')

await deploy('SequencerInbox', { from: deployer, args: [117964] })
}

module.exports.tags = ['SequencerInbox']
Expand Down
13 changes: 11 additions & 2 deletions deploy/SequencerInboxStubCreator.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import { Toolkit4844 } from '../test/contract/toolkit4844'

module.exports = async hre => {
const { deployments, getNamedAccounts, ethers } = hre
const { deployments, getSigners, getNamedAccounts, ethers } = hre
const { deploy } = deployments
const { deployer } = await getNamedAccounts()

const bridge = await ethers.getContract('BridgeStub')
const reader4844 = await Toolkit4844.deployReader4844(await ethers.getSigner(deployer))
const maxTime = {
delayBlocks: 10000,
futureBlocks: 10000,
Expand All @@ -12,7 +15,13 @@ module.exports = async hre => {
}
await deploy('SequencerInboxStub', {
from: deployer,
args: [bridge.address, deployer, maxTime],
args: [
bridge.address,
deployer,
maxTime,
117964,
reader4844.address,
],
})
}

Expand Down
21 changes: 21 additions & 0 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
[profile.default]
src = 'src/'
out = 'out'
libs = ['node_modules', 'lib']
test = 'test/foundry'
cache_path = 'forge-cache/sol'
optimizer = true
optimizer_runs = 20000
via_ir = false
solc_version = '0.8.9'

[profile.yul]
src = 'yul'
out = 'out/yul'
libs = ['node_modules', 'lib']
cache_path = 'forge-cache/yul'

[fmt]
number_underscore = 'thousands'
line_length = 100
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
20 changes: 20 additions & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import '@nomiclabs/hardhat-etherscan'
import '@typechain/hardhat'
import 'solidity-coverage'
import 'hardhat-gas-reporter'
import 'hardhat-ignore-warnings'
// import '@tovarishfin/hardhat-yul';
import dotenv from 'dotenv'

dotenv.config()

const solidity = {
compilers: [
Expand Down Expand Up @@ -112,6 +117,12 @@ module.exports = {
? [process.env['DEVNET_PRIVKEY']]
: [],
},
arbSepolia: {
url: 'https://sepolia-rollup.arbitrum.io/rpc',
accounts: process.env['DEVNET_PRIVKEY']
? [process.env['DEVNET_PRIVKEY']]
: [],
},
arb1: {
url: 'https://arb1.arbitrum.io/rpc',
accounts: process.env['MAINNET_PRIVKEY']
Expand All @@ -138,6 +149,7 @@ module.exports = {
arbitrumTestnet: process.env['ARBISCAN_API_KEY'],
nova: process.env['NOVA_ARBISCAN_API_KEY'],
arbGoerliRollup: process.env['ARBISCAN_API_KEY'],
arbSepolia: process.env['ARBISCAN_API_KEY'],
},
customChains: [
{
Expand All @@ -156,6 +168,14 @@ module.exports = {
browserURL: 'https://goerli.arbiscan.io/',
},
},
{
network: 'arbSepolia',
chainId: 421614,
urls: {
apiURL: 'https://sepolia-explorer.arbitrum.io/api',
browserURL: 'https://sepolia-explorer.arbitrum.io/',
},
},
],
},
mocha: {
Expand Down
1 change: 1 addition & 0 deletions lib/forge-std
Submodule forge-std added at e8a047
33 changes: 25 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arbitrum/nitro-contracts",
"version": "1.0.2",
"version": "1.1.0",
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
"author": "Offchain Labs, Inc.",
"license": "BUSL-1.1",
Expand All @@ -9,35 +9,50 @@
"url": "git+https://github.com/offchainlabs/nitro-contracts.git"
},
"files": [
"src/"
"src/",
"build/contracts/src",
"build/contracts/@openzeppelin"
],
"bugs": {
"url": "https://github.com/offchainlabs/nitro-contracts/issues"
},
"scripts": {
"prepublishOnly": "hardhat clean && hardhat compile",
"build:all": "yarn build && yarn build:forge",
"build": "hardhat compile",
"build:forge:sol": "forge build --skip *.yul",
"build:forge:yul": "FOUNDRY_PROFILE=yul forge build --skip *.sol",
"build:forge": "yarn build:forge:sol && yarn build:forge:yul",
"lint:test": "eslint ./test",
"solhint": "solhint -f table src/**/*.sol",
"prettier:solidity": "prettier --write src/**/*.sol",
"format": "prettier './**/*.{js,json,md,ts,yml,sol}' --write && yarn run lint:test --fix",
"build:0.6": "INTERFACE_TESTER_SOLC_VERSION=0.6.9 yarn run build",
"build:0.7": "INTERFACE_TESTER_SOLC_VERSION=0.7.0 yarn run build",
"test": "DISABLE_GAS_REPORTER=true hardhat --network hardhat test test/contract/*.spec.ts",
"test:4844": "DISABLE_GAS_REPORTER=true hardhat --network hardhat test test/contract/*.spec.4844.ts",
"test:compatibility": "yarn run build:0.6 && yarn run build:0.7",
"test:storage": "./test/storage/test.bash",
"test:e2e": "hardhat test test/e2e/*.ts",
"postinstall": "patch-package",
"deploy-factory": "hardhat run scripts/deployment.ts",
"deploy-rollup": "hardhat run scripts/rollupCreation.ts"
"deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts",
"deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts"
},
"dependencies": {
"@offchainlabs/upgrade-executor": "1.1.0-beta.0",
"@openzeppelin/contracts": "4.5.0",
"@openzeppelin/contracts-upgradeable": "4.5.2",
"patch-package": "^6.4.7"
},
"private": false,
"devDependencies": {
"@arbitrum/sdk": "^3.1.3",
"@ethersproject/providers": "^5.7.2",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
"@nomiclabs/hardhat-etherscan": "^3.1.0",
"@nomiclabs/hardhat-waffle": "^2.0.1",
"@tovarishfin/hardhat-yul": "^3.0.5",
"@typechain/ethers-v5": "^10.0.0",
"@typechain/hardhat": "^6.0.0",
"@types/chai": "^4.3.0",
Expand All @@ -47,23 +62,25 @@
"@typescript-eslint/eslint-plugin-tslint": "^5.27.1",
"@typescript-eslint/parser": "^5.14.0",
"chai": "^4.3.4",
"dotenv": "^16.3.1",
"eslint": "^8.23.1",
"eslint-config-prettier": "^8.3.0",
"eslint-plugin-mocha": "^9.0.0",
"eslint-plugin-prettier": "^4.0.0",
"ethereum-waffle": "^3.4.0",
"ethers": "^5.5.2",
"hardhat": "^2.6.6",
"hardhat-deploy": "^0.11.4",
"hardhat-gas-reporter": "^1.0.8",
"hardhat": "^2.17.2",
"hardhat-deploy": "^0.11.37",
"hardhat-gas-reporter": "^1.0.9",
"hardhat-ignore-warnings": "^0.2.9",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.5.1",
"prettier-plugin-solidity": "^1.0.0-beta.19",
"solhint": "^3.3.7",
"solhint-plugin-prettier": "^0.0.5",
"solidity-coverage": "^0.7.20",
"tslint": "^6.1.3",
"solidity-coverage": "^0.8.4",
"ts-node": "^10.4.0",
"tslint": "^6.1.3",
"typechain": "^8.0.0",
"typescript": "^4.5.4"
},
Expand Down
5 changes: 5 additions & 0 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/

@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/
4 changes: 4 additions & 0 deletions scripts/config.ts.example
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
import { ethers } from 'ethers'

// 90% of Geth's 128KB tx size limit, leaving ~13KB for proving
// This need to be adjusted for Orbit chains
export const maxDataSize = 117964

export const config = {
rollupConfig: {
confirmPeriodBlocks: ethers.BigNumber.from('45818'),
Expand Down
Loading

0 comments on commit aeaae5d

Please sign in to comment.