Skip to content

Commit ded149d

Browse files
committed
Merge from seq inbox optimisation
2 parents 966c2ca + 90f2262 commit ded149d

File tree

87 files changed

+7721
-1323
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+7721
-1323
lines changed

.env.sample.goerli

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
ROLLUP_CREATOR_ADDRESS=""
2+
ARBISCAN_API_KEY=""
3+
## deployer key
4+
DEVNET_PRIVKEY=""
5+
6+
## optional - address of already deployed ERC20 token which shall be used as rollup's fee token
7+
FEE_TOKEN_ADDRESS=""

.github/workflows/contract-tests.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,31 @@ on:
1010
- develop
1111

1212
jobs:
13+
test-unit:
14+
name: Test unit
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v3
18+
with:
19+
submodules: recursive
20+
21+
- name: Install Foundry
22+
uses: foundry-rs/foundry-toolchain@v1
23+
with:
24+
version: nightly
25+
26+
- name: Setup node/yarn
27+
uses: actions/setup-node@v3
28+
with:
29+
node-version: 16
30+
cache: 'yarn'
31+
cache-dependency-path: '**/yarn.lock'
32+
33+
- name: Install packages
34+
run: yarn
35+
36+
- name: Run unit tests
37+
run: forge test
1338
tests:
1439
name: Contract tests
1540
runs-on: ubuntu-8

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,6 @@ deployments/
66
/test/prover/spec-proofs/*.json
77
/test/storage/*-old.dot
88
scripts/config.ts
9+
forge-cache/
10+
out/
11+
.env

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[submodule "lib/forge-std"]
2+
path = lib/forge-std
3+
url = https://github.com/foundry-rs/forge-std

.prettierignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ coverage/**
55
deployments/**
66
src/lib/abi/**
77
.nyc_output
8+
out/**
89
lib/**

deploy/BridgeStubCreator.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ module.exports = async hre => {
33
const { deploy } = deployments
44
const { deployer } = await getNamedAccounts()
55

6-
await deploy('BridgeStub', { from: deployer, args: [] })
6+
await deploy('BridgeStub', { from: deployer, args: [deployer] })
77
}
88

99
module.exports.tags = ['BridgeStub', 'test']

foundry.toml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[profile.default]
2+
src = 'src'
3+
out = 'out'
4+
libs = ['node_modules', 'lib']
5+
test = 'test/foundry'
6+
cache_path = 'forge-cache'
7+
optimizer = true
8+
optimizer_runs = 20000
9+
via_ir = false
10+
11+
[fmt]
12+
number_underscore = 'thousands'
13+
line_length = 100
14+
# See more config options https://github.com/foundry-rs/foundry/tree/master/config

hardhat.config.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@ import '@typechain/hardhat'
66
import 'solidity-coverage'
77
import 'hardhat-gas-reporter'
88
import 'hardhat-ignore-warnings'
9+
import dotenv from 'dotenv'
10+
11+
dotenv.config()
912

1013
const solidity = {
1114
compilers: [
@@ -113,6 +116,12 @@ module.exports = {
113116
? [process.env['DEVNET_PRIVKEY']]
114117
: [],
115118
},
119+
arbSepolia: {
120+
url: 'https://sepolia-rollup.arbitrum.io/rpc',
121+
accounts: process.env['DEVNET_PRIVKEY']
122+
? [process.env['DEVNET_PRIVKEY']]
123+
: [],
124+
},
116125
arb1: {
117126
url: 'https://arb1.arbitrum.io/rpc',
118127
accounts: process.env['MAINNET_PRIVKEY']
@@ -139,6 +148,7 @@ module.exports = {
139148
arbitrumTestnet: process.env['ARBISCAN_API_KEY'],
140149
nova: process.env['NOVA_ARBISCAN_API_KEY'],
141150
arbGoerliRollup: process.env['ARBISCAN_API_KEY'],
151+
arbSepolia: process.env['ARBISCAN_API_KEY'],
142152
},
143153
customChains: [
144154
{
@@ -157,6 +167,14 @@ module.exports = {
157167
browserURL: 'https://goerli.arbiscan.io/',
158168
},
159169
},
170+
{
171+
network: 'arbSepolia',
172+
chainId: 421614,
173+
urls: {
174+
apiURL: 'https://sepolia-explorer.arbitrum.io/api',
175+
browserURL: 'https://sepolia-explorer.arbitrum.io/',
176+
},
177+
},
160178
],
161179
},
162180
mocha: {

lib/forge-std

Submodule forge-std added at e8a047e

package.json

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@arbitrum/nitro-contracts",
3-
"version": "1.0.2",
3+
"version": "1.1.0-beta.0",
44
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
55
"author": "Offchain Labs, Inc.",
66
"license": "BUSL-1.1",
@@ -9,12 +9,15 @@
99
"url": "git+https://github.com/offchainlabs/nitro-contracts.git"
1010
},
1111
"files": [
12-
"src/"
12+
"src/",
13+
"build/contracts/src",
14+
"build/contracts/@openzeppelin"
1315
],
1416
"bugs": {
1517
"url": "https://github.com/offchainlabs/nitro-contracts/issues"
1618
},
1719
"scripts": {
20+
"prepublishOnly": "hardhat clean && hardhat compile",
1821
"build": "hardhat compile",
1922
"test": "hardhat --network hardhat test test/contract/*.spec.ts",
2023
"lint:test": "eslint ./test",
@@ -25,17 +28,24 @@
2528
"build:0.7": "INTERFACE_TESTER_SOLC_VERSION=0.7.0 yarn run build",
2629
"test:compatibility": "yarn run build:0.6 && yarn run build:0.7",
2730
"test:storage": "./test/storage/test.bash",
31+
"test:e2e": "hardhat test test/e2e/*.ts",
2832
"postinstall": "patch-package",
2933
"deploy-factory": "hardhat run scripts/deployment.ts",
30-
"deploy-rollup": "hardhat run scripts/rollupCreation.ts"
34+
"deploy-rollup": "hardhat run scripts/rollupCreation.ts",
35+
"deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts",
36+
"deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts",
37+
"test": "hardhat --network hardhat test test/contract/*.spec.ts"
3138
},
3239
"dependencies": {
40+
"@offchainlabs/upgrade-executor": "1.1.0-beta.0",
3341
"@openzeppelin/contracts": "4.5.0",
3442
"@openzeppelin/contracts-upgradeable": "4.5.2",
3543
"patch-package": "^6.4.7"
3644
},
3745
"private": false,
3846
"devDependencies": {
47+
"@arbitrum/sdk": "^3.1.3",
48+
"@ethersproject/providers": "^5.7.2",
3949
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
4050
"@nomiclabs/hardhat-etherscan": "^3.1.0",
4151
"@nomiclabs/hardhat-waffle": "^2.0.1",
@@ -48,6 +58,7 @@
4858
"@typescript-eslint/eslint-plugin-tslint": "^5.27.1",
4959
"@typescript-eslint/parser": "^5.14.0",
5060
"chai": "^4.3.4",
61+
"dotenv": "^16.3.1",
5162
"eslint": "^8.23.1",
5263
"eslint-config-prettier": "^8.3.0",
5364
"eslint-plugin-mocha": "^9.0.0",

remappings.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
ds-test/=lib/forge-std/lib/ds-test/src/
2+
forge-std/=lib/forge-std/src/
3+
4+
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
5+
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/

scripts/createERC20Rollup.ts

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
import { ethers } from 'hardhat'
2+
import '@nomiclabs/hardhat-ethers'
3+
import { Signer } from 'ethers'
4+
import { createRollup } from './rollupCreation'
5+
import { TestToken__factory } from '../build/types'
6+
7+
async function deployERC20Token(deployer: Signer): Promise<string> {
8+
const factory = await new TestToken__factory(deployer).deploy(
9+
ethers.utils.parseEther('1000000000')
10+
)
11+
const feeToken = await factory.deployed()
12+
13+
return feeToken.address
14+
}
15+
16+
async function main() {
17+
const [deployer] = await ethers.getSigners()
18+
19+
let customFeeTokenAddress = process.env.FEE_TOKEN_ADDRESS
20+
if (!customFeeTokenAddress) {
21+
console.log(
22+
'FEE_TOKEN_ADDRESS env var not provided, deploying new ERC20 token'
23+
)
24+
customFeeTokenAddress = await deployERC20Token(deployer)
25+
}
26+
if (!ethers.utils.isAddress(customFeeTokenAddress)) {
27+
throw new Error(
28+
'Fee token address ' + customFeeTokenAddress + ' is not a valid address!'
29+
)
30+
}
31+
32+
console.log('Creating new rollup with', customFeeTokenAddress, 'as fee token')
33+
await createRollup(customFeeTokenAddress)
34+
}
35+
36+
main()
37+
.then(() => process.exit(0))
38+
.catch((error: Error) => {
39+
console.error(error)
40+
process.exit(1)
41+
})

scripts/createEthRollup.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
import '@nomiclabs/hardhat-ethers'
2+
import { createRollup } from './rollupCreation'
3+
4+
async function main() {
5+
await createRollup()
6+
}
7+
8+
main()
9+
.then(() => process.exit(0))
10+
.catch((error: Error) => {
11+
console.error(error)
12+
process.exit(1)
13+
})

0 commit comments

Comments
 (0)