Skip to content

Commit

Permalink
Merge branch 'develop' into sig-ci-check
Browse files Browse the repository at this point in the history
  • Loading branch information
gvladika authored Feb 14, 2024
2 parents ca030fd + 5ebb128 commit 4446f69
Show file tree
Hide file tree
Showing 48 changed files with 3,431 additions and 415 deletions.
45 changes: 43 additions & 2 deletions .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Install packages
run: yarn

- name: Run unit tests
- name: Build
run: forge test
tests:
name: Contract tests
Expand All @@ -44,6 +44,13 @@ 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
Expand All @@ -67,7 +74,7 @@ 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
Expand All @@ -94,3 +101,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
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
2 changes: 1 addition & 1 deletion .solhint.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"no-empty-blocks": "off",
"reason-string": ["warn", { "maxLength": 128 }],
"not-rely-on-time": "off",
"max-states-count": ["warn", 30],
"max-states-count": ["warn", 40],
"no-inline-assembly": "off"
},
"plugins": ["prettier"]
Expand Down
1 change: 1 addition & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Additional Use Grant: You may use the Licensed Work in a production environment
Covered Arbitrum Chain.



Change Date: Dec 31, 2028

Change License: Apache License Version 2.0
Expand Down
6 changes: 2 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,12 @@ yarn build

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.
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.

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.
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.

## Contact

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

Twitter: [Arbitrum](https://twitter.com/arbitrum)


3 changes: 3 additions & 0 deletions deploy/SequencerInbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ module.exports = async hre => {
const { deploy } = deployments
const { deployer } = await getNamedAccounts()

const blobBasefeeReader = await ethers.getContract('BlobBasefeeReader')
const dataHashReader = await ethers.getContract('DataHashReader')

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

Expand Down
16 changes: 14 additions & 2 deletions deploy/SequencerInboxStubCreator.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
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 +17,14 @@ module.exports = async hre => {
}
await deploy('SequencerInboxStub', {
from: deployer,
args: [bridge.address, deployer, maxTime, 117964],
args: [
bridge.address,
deployer,
maxTime,
117964,
reader4844.address,
false,
],
})
}

Expand Down
11 changes: 9 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
[profile.default]
src = 'src'
src = 'src/'
out = 'out'
libs = ['node_modules', 'lib']
test = 'test/foundry'
cache_path = 'forge-cache'
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'
Expand Down
1 change: 1 addition & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import '@typechain/hardhat'
import 'solidity-coverage'
import 'hardhat-gas-reporter'
import 'hardhat-ignore-warnings'
// import '@tovarishfin/hardhat-yul';
import dotenv from 'dotenv'

dotenv.config()
Expand Down
11 changes: 9 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@arbitrum/nitro-contracts",
"version": "1.1.1",
"version": "1.2.0",
"description": "Layer 2 precompiles and rollup for Arbitrum Nitro",
"author": "Offchain Labs, Inc.",
"license": "BUSL-1.1",
Expand All @@ -18,13 +18,19 @@
},
"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",
"format": "prettier './**/*.{js,json,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/sginatures/test-sigs.bash",
Expand All @@ -47,6 +53,7 @@
"@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 Down
6 changes: 5 additions & 1 deletion scripts/deployment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ async function deployAllContracts(
const ethBridge = await deployContract('Bridge', signer, [])
const ethSequencerInbox = await deployContract('SequencerInbox', signer, [
maxDataSize,
false,
])
const ethInbox = await deployContract('Inbox', signer, [maxDataSize])
const ethRollupEventInbox = await deployContract(
Expand All @@ -91,7 +92,10 @@ async function deployAllContracts(
const ethOutbox = await deployContract('Outbox', signer, [])

const erc20Bridge = await deployContract('ERC20Bridge', signer, [])
const erc20SequencerInbox = ethSequencerInbox
const erc20SequencerInbox = await deployContract('SequencerInbox', signer, [
maxDataSize,
true,
])
const erc20Inbox = await deployContract('ERC20Inbox', signer, [maxDataSize])
const erc20RollupEventInbox = await deployContract(
'ERC20RollupEventInbox',
Expand Down
12 changes: 4 additions & 8 deletions scripts/rollupCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,11 @@ export async function createRollup(feeToken?: string) {
maxDataSize: maxDataSize,
nativeToken: feeToken,
deployFactoriesToL2: true,
maxFeePerGasForRetryables: MAX_FER_PER_GAS
maxFeePerGasForRetryables: MAX_FER_PER_GAS,
}
const createRollupTx = await rollupCreator.createRollup(
deployParams,
{
value: feeCost,
}

)
const createRollupTx = await rollupCreator.createRollup(deployParams, {
value: feeCost,
})
const createRollupReceipt = await createRollupTx.wait()

const rollupCreatedEvent = createRollupReceipt.events?.find(
Expand Down
2 changes: 2 additions & 0 deletions src/bridge/GasRefunder.sol
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,7 @@ contract GasRefunder is IGasRefunder, Ownable {

function withdraw(address payable destination, uint256 amount) external onlyOwner {
// It's expected that destination is an EOA
// solhint-disable-next-line avoid-low-level-calls
(bool success, ) = destination.call{value: amount}("");
require(success, "WITHDRAW_FAILED");
emit Withdrawn(msg.sender, destination, amount);
Expand Down Expand Up @@ -249,6 +250,7 @@ contract GasRefunder is IGasRefunder, Ownable {
}

// It's expected that refundee is an EOA
// solhint-disable-next-line avoid-low-level-calls
(success, ) = refundee.call{value: refundAmount}("");
emit RefundedGasCosts(refundee, msg.sender, success, gasUsed, estGasPrice, refundAmount);
}
Expand Down
22 changes: 22 additions & 0 deletions src/bridge/IBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@ pragma solidity >=0.6.9 <0.9.0;
import "./IOwnable.sol";

interface IBridge {
/// @dev This is an instruction to offchain readers to inform them where to look
/// for sequencer inbox batch data. This is not the type of data (eg. das, brotli encoded, or blob versioned hash)
/// and this enum is not used in the state transition function, rather it informs an offchain
/// reader where to find the data so that they can supply it to the replay binary
enum BatchDataLocation {
/// @notice The data can be found in the transaction call data
TxInput,
/// @notice The data can be found in an event emitted during the transaction
SeparateBatchEvent,
/// @notice This batch contains no data
NoData,
/// @notice The data can be found in the 4844 data blobs on this transaction
Blob
}

struct TimeBounds {
uint64 minTimestamp;
uint64 maxTimestamp;
uint64 minBlockNumber;
uint64 maxBlockNumber;
}

event MessageDelivered(
uint256 indexed messageIndex,
bytes32 indexed beforeInboxAcc,
Expand Down
Loading

0 comments on commit 4446f69

Please sign in to comment.