Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: from bold #162

Closed
wants to merge 8 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ deployments/
scripts/config.ts
forge-cache/
out/
.env
.env
.DS_Store
45 changes: 22 additions & 23 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
# Arbitrum Nitro Rollup Contracts
# Contracts

This is the package with the smart contract code that powers Arbitrum Nitro.
It includes the rollup and fraud proof smart contracts, as well as interfaces for interacting with precompiles.
This folder contains the smart contracts needed for the rollup protocol, which are
a solidity implementation of the specification meant to match the behavior of the Go
implementation also contained in this repository.

For more information see https://developer.arbitrum.io/intro
This subfolder was initialized using [Foundry](https://github.com/foundry-rs/foundry) with `forge init`

For the deployed addresses of these contracts for Arbitrum chains see https://developer.arbitrum.io/useful-addresses
## Setup

For the token bridge contracts see https://github.com/OffchainLabs/token-bridge-contracts
Requirements: [nvm](https://github.com/nvm-sh/nvm)

Compile these contracts locally by running
```sh
# Use nvm to install node 16.x
nvm install 16
nvm use 16

```bash
git clone https://github.com/offchainlabs/nitro-contracts
cd nitro-contracts
yarn install
yarn build
```

## License

Nitro is currently licensed under a [Business Source License](./LICENSE), similar to our friends at Uniswap and Aave, with an "Additional Use Grant" to ensure that everyone can have full comfort using and running nodes on all public Arbitrum chains.

The Additional Use Grant also permits the deployment of the Nitro software, in a permissionless fashion and without cost, as a new blockchain provided that the chain settles to either Arbitrum One or Arbitrum Nova.
# Install yarn, if you don't have it already
npm i -g yarn

For those that prefer to deploy the Nitro software either directly on Ethereum (i.e. an L2) or have it settle to another Layer-2 on top of Ethereum, the [Arbitrum Expansion Program (the "AEP")](https://docs.arbitrum.foundation/assets/files/Arbitrum%20Expansion%20Program%20Jan182024-4f08b0c2cb476a55dc153380fa3e64b0.pdf) was recently established. The AEP allows for the permissionless deployment in the aforementioned fashion provided that 10% of net revenue is contributed back to the Arbitrum community in accordance with the requirements of the AEP.
# Run yarn to install deps
yarn

## Contact
# Install forge deps
forge install
```

Discord - [Arbitrum](https://discord.com/invite/5KE54JwyTs)
## Run Tests

Twitter: [Arbitrum](https://twitter.com/arbitrum)
```
forge test
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
10 changes: 3 additions & 7 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
[profile.default]
src = 'src/'
src = 'src'
out = 'out'
libs = ['node_modules', 'lib']
test = 'test/foundry'
cache_path = 'forge-cache/sol'
optimizer = true
optimizer_runs = 20000
optimizer_runs = 2000
via_ir = false
solc_version = '0.8.9'
solc_version = '0.8.17'

[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
62 changes: 26 additions & 36 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,25 +5,31 @@ 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()
import 'hardhat-contract-sizer'

const solidity = {
compilers: [
{
version: '0.8.9',
version: '0.8.17',
settings: {
optimizer: {
enabled: true,
runs: 100,
runs: 2000,
},
},
},
],
overrides: {},
overrides: {
'src/challengeV2/EdgeChallengeManager.sol': {
version: '0.8.17',
settings: {
optimizer: {
enabled: true,
runs: 200,
},
},
},
},
}

if (process.env['INTERFACE_TESTER_SOLC_VERSION']) {
Expand All @@ -37,12 +43,15 @@ if (process.env['INTERFACE_TESTER_SOLC_VERSION']) {
},
})
solidity.overrides = {
'src/test-helpers/InterfaceCompatibilityTester.sol': {
version: process.env['INTERFACE_TESTER_SOLC_VERSION'],
settings: {
optimizer: {
enabled: true,
runs: 100,
...(solidity.overrides || {}),
...{
'src/test-helpers/InterfaceCompatibilityTester.sol': {
version: process.env['INTERFACE_TESTER_SOLC_VERSION'],
settings: {
optimizer: {
enabled: true,
runs: 100,
},
},
},
},
Expand Down Expand Up @@ -93,12 +102,6 @@ module.exports = {
? [process.env['DEVNET_PRIVKEY']]
: [],
},
sepolia: {
url: 'https://sepolia.infura.io/v3/' + process.env['INFURA_KEY'],
accounts: process.env['DEVNET_PRIVKEY']
? [process.env['DEVNET_PRIVKEY']]
: [],
},
rinkeby: {
url: 'https://rinkeby.infura.io/v3/' + process.env['INFURA_KEY'],
accounts: process.env['DEVNET_PRIVKEY']
Expand All @@ -117,12 +120,6 @@ 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 @@ -143,13 +140,11 @@ module.exports = {
apiKey: {
mainnet: process.env['ETHERSCAN_API_KEY'],
goerli: process.env['ETHERSCAN_API_KEY'],
sepolia: process.env['ETHERSCAN_API_KEY'],
rinkeby: process.env['ETHERSCAN_API_KEY'],
arbitrumOne: process.env['ARBISCAN_API_KEY'],
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 @@ -168,14 +163,6 @@ 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 All @@ -188,4 +175,7 @@ module.exports = {
outDir: 'build/types',
target: 'ethers-v5',
},
contractSizer: {
strict: process.env.STRICT ? true : false
}
}
25 changes: 16 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"name": "@arbitrum/nitro-contracts",
"version": "1.2.1",
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
"name": "@arbitrum/bold-contracts",
"version": "0.0.1",
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro with BOLD",
"author": "Offchain Labs, Inc.",
"license": "BUSL-1.1",
"repository": {
"type": "git",
"url": "git+https://github.com/offchainlabs/nitro-contracts.git"
"url": "git+https://github.com/offchainlabs/bold.git"
},
"files": [
"src/",
Expand All @@ -15,19 +15,21 @@
"out/yul/Reader4844.yul/Reader4844.json"
],
"bugs": {
"url": "https://github.com/offchainlabs/nitro-contracts/issues"
"url": "https://github.com/offchainlabs/bold/issues"
},
"scripts": {
"prepublishOnly": "hardhat clean && forge clean && hardhat compile && yarn build:forge:yul",
"coverage": "forge coverage --report lcov --ir-minimum && lcov --remove lcov.info 'node_modules/*' 'test/*' 'script/*' 'src/test-helpers/*' 'challenge/*' --ignore-errors unused -o lcov.info && genhtml lcov.info --branch-coverage --output-dir coverage",
"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",
"contract:size": "STRICT=true hardhat size-contracts",
"lint:test": "eslint ./test",
"solhint": "solhint -f table src/**/*.sol",
"prettier:solidity": "prettier --write src/**/*.sol",
"format": "prettier './**/*.{js,json,ts,yml,sol}' --write && yarn run lint:test --fix",
"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",
Expand All @@ -39,12 +41,16 @@
"postinstall": "patch-package",
"deploy-factory": "hardhat run scripts/deployment.ts",
"deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts",
"deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts"
"deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts",
"script:bold-prepare": "hardhat run ./scripts/prepareBoldUpgrade.ts",
"script:bold-populate-lookup": "hardhat run ./scripts/populateLookup.ts",
"script:bold-local-execute": "hardhat run ./scripts/testLocalExecuteBoldUpgrade.ts",
"script:bold-verify": "hardhat run ./scripts/testVerifyBoldUpgrade.ts"
},
"dependencies": {
"@offchainlabs/upgrade-executor": "1.1.0-beta.0",
"@openzeppelin/contracts": "4.5.0",
"@openzeppelin/contracts-upgradeable": "4.5.2",
"@openzeppelin/contracts": "4.7.3",
"@openzeppelin/contracts-upgradeable": "4.7.3",
"patch-package": "^6.4.7"
},
"private": false,
Expand Down Expand Up @@ -75,6 +81,7 @@
"hardhat-deploy": "^0.11.37",
"hardhat-gas-reporter": "^1.0.9",
"hardhat-ignore-warnings": "^0.2.9",
"hardhat-contract-sizer": "^2.10.0",
"postinstall-postinstall": "^2.1.0",
"prettier": "^2.5.1",
"prettier-plugin-solidity": "^1.0.0-beta.19",
Expand Down
Loading
Loading