Skip to content

Commit

Permalink
chore: from bold
Browse files Browse the repository at this point in the history
  • Loading branch information
gzeoneth committed Mar 27, 2024
1 parent 90037b9 commit 7596770
Show file tree
Hide file tree
Showing 152 changed files with 16,595 additions and 3,662 deletions.
Binary file added .DS_Store
Binary file not shown.
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
```
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
}
}
44 changes: 20 additions & 24 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
{
"name": "@arbitrum/nitro-contracts",
"version": "1.2.1",
"version": "1.0.0",
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
"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/nitro.git",
"directory": "contracts"
},
"files": [
"src/",
Expand All @@ -15,46 +16,42 @@
"out/yul/Reader4844.yul/Reader4844.json"
],
"bugs": {
"url": "https://github.com/offchainlabs/nitro-contracts/issues"
"url": "https://github.com/offchainlabs/nitro/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",
"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:signatures": "./test/signatures/test-sigs.bash",
"test:e2e": "hardhat test test/e2e/*.ts",
"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"
"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",
"patch-package": "^6.4.7"
"@openzeppelin/contracts": "4.7.3",
"@openzeppelin/contracts-upgradeable": "4.7.3",
"dotenv": "^16.3.1",
"hardhat": "^2.6.6"
},
"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 @@ -64,23 +61,22 @@
"@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.17.2",
"hardhat-deploy": "^0.11.37",
"hardhat-gas-reporter": "^1.0.9",
"hardhat-ignore-warnings": "^0.2.9",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-deploy": "^0.11.4",
"hardhat-gas-reporter": "^1.0.8",
"patch-package": "^6.4.7",
"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.8.4",
"solidity-coverage": "^0.7.20",
"ts-node": "^10.4.0",
"tslint": "^6.1.3",
"typechain": "^8.0.0",
Expand Down
6 changes: 2 additions & 4 deletions remappings.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
ds-test/=lib/forge-std/lib/ds-test/src/
forge-std/=lib/forge-std/src/

@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/
@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/
@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/
@offchainlabs/upgrade-executor/=node_modules/@offchainlabs/upgrade-executor/
12 changes: 12 additions & 0 deletions script/Counter.s.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import "forge-std/Script.sol";

contract CounterScript is Script {
function setUp() public {}

function run() public {
vm.broadcast();
}
}
Binary file added scripts/.DS_Store
Binary file not shown.
Loading

0 comments on commit 7596770

Please sign in to comment.