Skip to content

Commit

Permalink
Merge branch 'eigenda-v3.1.2' of github.com:Layr-Labs/nitro-contracts…
Browse files Browse the repository at this point in the history
… into epociask--fix-timestamp-invariant
  • Loading branch information
epociask committed Sep 6, 2024
2 parents 144aba6 + 2ac6e81 commit 77a701a
Show file tree
Hide file tree
Showing 71 changed files with 4,774 additions and 15,813 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/audit-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16, 18, 20]
node-version: [18, 20]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down
99 changes: 97 additions & 2 deletions .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
- name: Setup node/yarn
uses: actions/setup-node@v3
with:
node-version: 16
node-version: 18
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

Expand Down Expand Up @@ -85,6 +85,9 @@ jobs:
- name: Forge build
run: forge build

- name: Test size
run: yarn contract:size

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

Expand Down Expand Up @@ -123,7 +126,7 @@ jobs:
- name: Setup nodejs
uses: actions/setup-node@v2
with:
node-version: '18'
node-version: 18
cache: 'yarn'
cache-dependency-path: '**/yarn.lock'

Expand All @@ -135,3 +138,95 @@ jobs:

- name: Test 4844
run: yarn test:4844
test-e2e:
name: Test e2e
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: OffchainLabs/actions/run-nitro-test-node@main
with:
l3-node: true
no-token-bridge: true
no-l3-token-bridge: true
nitro-contracts-branch: '${{ github.event.pull_request.head.sha || github.sha }}'

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

- name: Install packages
run: yarn

- name: Compile contracts
run: yarn build

- name: Run e2e tests
run: yarn test:e2e
test-e2e-custom-fee-token:
name: Test e2e custom fee token
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: OffchainLabs/actions/run-nitro-test-node@main
with:
l3-node: true
args: --l3-fee-token
no-token-bridge: true
no-l3-token-bridge: true
nitro-contracts-branch: '${{ github.event.pull_request.head.sha || github.sha }}'

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

- name: Install packages
run: yarn

- name: Compile contracts
run: yarn build

- name: Run e2e tests
run: yarn test:e2e
test-e2e-fee-token-6-decimals:
name: Test e2e fee token with 6 decimals
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- uses: OffchainLabs/actions/run-nitro-test-node@main
with:
l3-node: true
args: --l3-fee-token --l3-fee-token-decimals 6
no-token-bridge: true
no-l3-token-bridge: true
nitro-contracts-branch: '${{ github.event.pull_request.head.sha || github.sha }}'

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

- name: Install packages
run: yarn

- name: Compile contracts
run: yarn build

- name: Run e2e tests
run: yarn test:e2e
3 changes: 2 additions & 1 deletion .github/workflows/slither.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,12 @@ jobs:
- uses: actions/checkout@v4

- name: Run Slither
uses: crytic/slither-action@v0.3.1
uses: crytic/slither-action@v0.4.0
id: slither
with:
sarif: results.sarif
fail-on: medium
slither-args: --skip-assembly

- name: Upload SARIF file
if: always()
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ 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.
Nitro is currently licensed under a [Business Source License](./LICENSE.md), 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.

Expand Down
10 changes: 9 additions & 1 deletion audit-ci.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,14 @@
// Exposure of sensitive information in follow-redirects
"GHSA-74fj-2j2h-c42q",
// Open Zeppelin: Base64 encoding may read from potentially dirty memory
"GHSA-9vx6-7xxf-x967"
"GHSA-9vx6-7xxf-x967",
// semver vulnerable to Regular Expression Denial of Service
"GHSA-c2qf-rxjj-qqgw",
// follow-redirects' Proxy-Authorization header kept across hosts
"GHSA-cxjh-pqwp-8mfp",
// Prototype Pollution in async
"GHSA-fwr7-v2mv-hh25",
// ws affected by a DoS when handling a request with many HTTP headers
"GHSA-3h5v-q93c-6h6q"
]
}
1 change: 0 additions & 1 deletion foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,3 @@ auto_detect_remappings = false
number_underscore = 'thousands'
line_length = 100
# See more config options https://github.com/foundry-rs/foundry/tree/master/config

18 changes: 16 additions & 2 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import '@nomiclabs/hardhat-etherscan'
import '@typechain/hardhat'
import 'solidity-coverage'
import 'hardhat-gas-reporter'
import 'hardhat-contract-sizer'
import 'hardhat-ignore-warnings'
// import '@tovarishfin/hardhat-yul';
import dotenv from 'dotenv'
Expand All @@ -22,8 +23,18 @@ const solidity = {
},
},
},
],
overrides: {},
]
// overrides: {
// 'src/rollup/RollupUserLogic.sol': {
// version: '0.8.9',
// settings: {
// optimizer: {
// enabled: true,
// runs: 0,
// },
// },
// },
// },
}

if (process.env['INTERFACE_TESTER_SOLC_VERSION']) {
Expand Down Expand Up @@ -188,4 +199,7 @@ module.exports = {
outDir: 'build/types',
target: 'ethers-v5',
},
contractSizer: {
strict: true
}
}
9 changes: 6 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arbitrum/nitro-contracts",
"version": "1.2.1",
"version": "2.0.0",
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
"author": "Offchain Labs, Inc.",
"license": "BUSL-1.1",
Expand All @@ -26,6 +26,7 @@
"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": "hardhat size-contracts",
"lint:test": "eslint ./test",
"solhint": "solhint -f table src/**/*.sol",
"prettier:solidity": "prettier --write src/**/*.sol",
Expand All @@ -42,7 +43,8 @@
"deploy-factory": "hardhat run scripts/deployment.ts",
"deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts",
"deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts",
"create-rollup-testnode": "hardhat run scripts/local-deployment/deployCreatorAndCreateRollup.ts"
"create-rollup-testnode": "hardhat run scripts/local-deployment/deployCreatorAndCreateRollup.ts",
"deploy-cachemanager-testnode": "hardhat run scripts/local-deployment/deployCacheManager.ts"
},
"dependencies": {
"@eigenda/eigenda-utils": "2.0.0",
Expand All @@ -58,7 +60,7 @@
},
"private": false,
"devDependencies": {
"@arbitrum/sdk": "^3.1.3",
"@arbitrum/sdk": "^3.4.1",
"@ethersproject/providers": "^5.7.2",
"@nomiclabs/hardhat-ethers": "npm:hardhat-deploy-ethers@^0.3.0-beta.13",
"@nomiclabs/hardhat-etherscan": "^3.1.0",
Expand All @@ -83,6 +85,7 @@
"ethereum-waffle": "^4.0.10",
"ethers": "^5.5.4",
"hardhat": "^2.17.2",
"hardhat-contract-sizer": "^2.10.0",
"hardhat-deploy": "^0.11.37",
"hardhat-gas-reporter": "^1.0.9",
"hardhat-ignore-warnings": "^0.2.9",
Expand Down
53 changes: 51 additions & 2 deletions scripts/deploymentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,16 @@ import {
bytecode as UpgradeExecutorBytecode,
} from '@offchainlabs/upgrade-executor/build/contracts/src/UpgradeExecutor.sol/UpgradeExecutor.json'
import { Toolkit4844 } from '../test/contract/toolkit4844'
import { ArbSys__factory } from '../build/types'
import { ARB_SYS_ADDRESS } from '@arbitrum/sdk/dist/lib/dataEntities/constants'
import {
ArbOwner__factory,
ArbSys__factory,
CacheManager__factory,
} from '../build/types'

const INIT_CACHE_SIZE = 536870912
const INIT_DECAY = 10322197911
const ARB_OWNER_ADDRESS = '0x0000000000000000000000000000000000000070'
const ARB_SYS_ADDRESS = '0x0000000000000000000000000000000000000064'

// Define a verification function
export async function verifyContract(
Expand Down Expand Up @@ -246,6 +254,47 @@ export async function deployAllContracts(
}
}

export async function deployAndSetCacheManager(
chainOwnerWallet: any,
verify: boolean = true
) {
const cacheManagerLogic = await deployContract(
'CacheManager',
chainOwnerWallet,
[],
verify
)

const proxyAdmin = await deployContract(
'ProxyAdmin',
chainOwnerWallet,
[],
verify
)

const cacheManagerProxy = await deployContract(
'TransparentUpgradeableProxy',
chainOwnerWallet,
[cacheManagerLogic.address, proxyAdmin.address, '0x'],
verify
)

const cacheManager = CacheManager__factory.connect(
cacheManagerProxy.address,
chainOwnerWallet
)

await (await cacheManager.initialize(INIT_CACHE_SIZE, INIT_DECAY)).wait()

const arbOwner = ArbOwner__factory.connect(
ARB_OWNER_ADDRESS,
chainOwnerWallet
)
await (await arbOwner.addWasmCacheManager(cacheManagerProxy.address)).wait()

return cacheManagerProxy
}

// Check if we're deploying to an Arbitrum chain
export async function _isRunningOnArbitrum(signer: any): Promise<boolean> {
const arbSys = ArbSys__factory.connect(ARB_SYS_ADDRESS, signer)
Expand Down
17 changes: 0 additions & 17 deletions scripts/genNetwork.ts

This file was deleted.

32 changes: 32 additions & 0 deletions scripts/local-deployment/deployCacheManager.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ethers } from 'hardhat'
import '@nomiclabs/hardhat-ethers'
import { deployAndSetCacheManager } from '../deploymentUtils'

async function main() {
/// read env vars needed for deployment
let chainOwnerPrivKey = process.env.CHAIN_OWNER_PRIVKEY as string
if (!chainOwnerPrivKey) {
throw new Error('CHAIN_OWNER_PRIVKEY not set')
}

const childChainRpc = process.env.CHILD_CHAIN_RPC as string
if (!childChainRpc) {
throw new Error('CHILD_CHAIN_RPC not set')
}

const chainOwnerWallet = new ethers.Wallet(
chainOwnerPrivKey,
new ethers.providers.JsonRpcProvider(childChainRpc)
)

// deploy cache manager
const cacheManager = await deployAndSetCacheManager(chainOwnerWallet, false)
console.log('Cache manager deployed at:', cacheManager.address)
}

main()
.then(() => process.exit(0))
.catch((error: Error) => {
console.error(error)
process.exit(1)
})
1 change: 0 additions & 1 deletion scripts/local-deployment/deployCreatorAndCreateRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ async function main() {
if (!feeToken) {
feeToken = ethers.constants.AddressZero
}
console.log('Fee token address:', feeToken)

/// deploy templates and rollup creator
console.log('Deploy RollupCreator')
Expand Down
Loading

0 comments on commit 77a701a

Please sign in to comment.