Skip to content

Commit

Permalink
merge in upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
EthenNotEthan committed Jul 8, 2024
1 parent 2f8d2cc commit 1251afe
Show file tree
Hide file tree
Showing 46 changed files with 2,486 additions and 343 deletions.
1 change: 1 addition & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ src/lib/abi/**
.nyc_output
out/**
lib/**
src/mocks/MultiCallTest.sol
14 changes: 12 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,26 @@ cache_path = 'forge-cache/sol'
optimizer = true
optimizer_runs = 100
via_ir = false
solc_version = '0.8.12'
solc_version = '0.8.9'
remappings = ['ds-test/=lib/forge-std/lib/ds-test/src/',
'forge-std/=lib/forge-std/src/',
'@openzeppelin/contracts/=node_modules/@openzeppelin/contracts/',
'@openzeppelin/contracts-upgradeable/=node_modules/@openzeppelin/contracts-upgradeable/',
'eigenda/contracts/=lib/eigenda/contracts/src',
'eigenlayer-middleware/=lib/eigenda/contracts/lib/eigenlayer-middleware/src/',
'eigenlayer-core/=lib/eigenda/contracts/lib/eigenlayer-middleware/lib/eigenlayer-contracts/src/'
]
fs_permissions = [{ access = "read", path = "./"}]

[profile.yul]
src = 'yul'
out = 'out/yul'
libs = ['node_modules', 'lib']
cache_path = 'forge-cache/yul'
remappings = []
auto_detect_remappings = false

[fmt]
number_underscore = 'thousands'
line_length = 100
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
# See more config options https://github.com/foundry-rs/foundry/tree/master/config
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,18 +42,17 @@
"deploy-factory": "hardhat run scripts/deployment.ts",
"deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts",
"deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts",
"deploy-blob": "yarn ts-node scripts/disperseBlob.ts"
"create-rollup-testnode": "hardhat run scripts/local-deployment/deployCreatorAndCreateRollup.ts"
},
"dependencies": {
"@eigenda/eigenda-utils": "2.0.0",
"@grpc/grpc-js": "^1.8.22",
"@grpc/proto-loader": "^0.7.13",
"@offchainlabs/upgrade-executor": "1.1.0-beta.0",
"@openzeppelin-upgrades/contracts": "npm:@openzeppelin/[email protected]",
"@openzeppelin/contracts": "4.7",
"@openzeppelin/contracts-upgradeable": "4.7",
"google-protobuf": "^3.21.2",
"patch-package": "^6.4.7"
"@openzeppelin/contracts": "4.5.0",
"@openzeppelin/contracts-upgradeable": "4.5.2",
"patch-package": "^6.4.7",
"solady": "0.0.182"
},
"private": false,
"devDependencies": {
Expand Down
9 changes: 0 additions & 9 deletions remappings.txt

This file was deleted.

3 changes: 2 additions & 1 deletion scripts/config.ts.example
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@ export const config = {
'0x1234123412341234123412341234123412341234',
'0x1234512345123451234512345123451234512345',
],
batchPoster: '0x1234123412341234123412341234123412341234',
batchPosters: ['0x1234123412341234123412341234123412341234'],
batchPosterManager: '0x1234123412341234123412341234123412341234'
}
12 changes: 11 additions & 1 deletion scripts/createERC20Rollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,18 @@ async function main() {
)
}

const rollupCreatorAddress = process.env.ROLLUP_CREATOR_ADDRESS
if (!rollupCreatorAddress) {
throw new Error('ROLLUP_CREATOR_ADDRESS not set')
}

console.log('Creating new rollup with', customFeeTokenAddress, 'as fee token')
await createRollup(customFeeTokenAddress)
await createRollup(
deployer,
false,
rollupCreatorAddress,
customFeeTokenAddress
)
}

main()
Expand Down
11 changes: 10 additions & 1 deletion scripts/createEthRollup.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
import { ethers } from 'hardhat'
import '@nomiclabs/hardhat-ethers'
import { createRollup } from './rollupCreation'

async function main() {
await createRollup()
const feeToken = undefined
const rollupCreatorAddress = process.env.ROLLUP_CREATOR_ADDRESS
if (!rollupCreatorAddress) {
throw new Error('ROLLUP_CREATOR_ADDRESS not set')
}

const [signer] = await ethers.getSigners()

await createRollup(signer, false, rollupCreatorAddress, feeToken)
}

main()
Expand Down
7 changes: 6 additions & 1 deletion scripts/deployment.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,18 @@
import { ethers } from 'hardhat'
import '@nomiclabs/hardhat-ethers'
import { deployAllContracts } from './deploymentUtils'
import { maxDataSize } from './config'

async function main() {
const [signer] = await ethers.getSigners()

try {
// Deploying all contracts
const contracts = await deployAllContracts(signer)
const contracts = await deployAllContracts(
signer,
ethers.BigNumber.from(maxDataSize),
true
)

// Call setTemplates with the deployed contract addresses
console.log('Waiting for the Template to be set on the Rollup Creator')
Expand Down
159 changes: 108 additions & 51 deletions scripts/deploymentUtils.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { ethers } from 'hardhat'
import { ContractFactory, Contract, Overrides } from 'ethers'
import { ContractFactory, Contract, Overrides, BigNumber } from 'ethers'
import '@nomiclabs/hardhat-ethers'
import { run } from 'hardhat'
import {
abi as UpgradeExecutorABI,
bytecode as UpgradeExecutorBytecode,
} from '@offchainlabs/upgrade-executor/build/contracts/src/UpgradeExecutor.sol/UpgradeExecutor.json'
import { maxDataSize } from './config'
import { Toolkit4844 } from '../test/contract/toolkit4844'
import { ArbSys__factory } from '../build/types'
import { ARB_SYS_ADDRESS } from '@arbitrum/sdk/dist/lib/dataEntities/constants'
Expand Down Expand Up @@ -87,80 +86,138 @@ export async function deployUpgradeExecutor(signer: any): Promise<Contract> {

// Function to handle all deployments of core contracts using deployContract function
export async function deployAllContracts(
signer: any
signer: any,
maxDataSize: BigNumber,
verify: boolean = true
): Promise<Record<string, Contract>> {
const isOnArb = await _isRunningOnArbitrum(signer)

const ethBridge = await deployContract('Bridge', signer, [])
const ethBridge = await deployContract('Bridge', signer, [], verify)
const reader4844 = isOnArb
? ethers.constants.AddressZero
: (await Toolkit4844.deployReader4844(signer)).address

const ethSequencerInbox = await deployContract('SequencerInbox', signer, [
maxDataSize,
reader4844,
false,
])
const ethSequencerInbox = await deployContract(
'SequencerInbox',
signer,
[maxDataSize, reader4844, false],
verify
)

const ethInbox = await deployContract('Inbox', signer, [maxDataSize])
const ethInbox = await deployContract('Inbox', signer, [maxDataSize], verify)
const ethRollupEventInbox = await deployContract(
'RollupEventInbox',
signer,
[]
[],
verify
)
const ethOutbox = await deployContract('Outbox', signer, [])
const ethOutbox = await deployContract('Outbox', signer, [], verify)

const erc20Bridge = await deployContract('ERC20Bridge', signer, [])
const erc20SequencerInbox = await deployContract('SequencerInbox', signer, [
maxDataSize,
reader4844,
true,
])
const erc20Inbox = await deployContract('ERC20Inbox', signer, [maxDataSize])
const erc20Bridge = await deployContract('ERC20Bridge', signer, [], verify)
const erc20SequencerInbox = await deployContract(
'SequencerInbox',
signer,
[maxDataSize, reader4844, true],
verify
)
const erc20Inbox = await deployContract(
'ERC20Inbox',
signer,
[maxDataSize],
verify
)
const erc20RollupEventInbox = await deployContract(
'ERC20RollupEventInbox',
signer,
[]
[],
verify
)
const erc20Outbox = await deployContract('ERC20Outbox', signer, [])
const erc20Outbox = await deployContract('ERC20Outbox', signer, [], verify)

const bridgeCreator = await deployContract('BridgeCreator', signer, [
const bridgeCreator = await deployContract(
'BridgeCreator',
signer,
[
ethBridge.address,
ethSequencerInbox.address,
ethInbox.address,
ethRollupEventInbox.address,
ethOutbox.address,
[
ethBridge.address,
ethSequencerInbox.address,
ethInbox.address,
ethRollupEventInbox.address,
ethOutbox.address,
],
[
erc20Bridge.address,
erc20SequencerInbox.address,
erc20Inbox.address,
erc20RollupEventInbox.address,
erc20Outbox.address,
],
],
verify
)
const prover0 = await deployContract('OneStepProver0', signer, [], verify)
const proverMem = await deployContract(
'OneStepProverMemory',
signer,
[],
verify
)
const proverMath = await deployContract(
'OneStepProverMath',
signer,
[],
verify
)
const proverHostIo = await deployContract(
'OneStepProverHostIo',
signer,
[],
verify
)
const osp: Contract = await deployContract(
'OneStepProofEntry',
signer,
[
erc20Bridge.address,
erc20SequencerInbox.address,
erc20Inbox.address,
erc20RollupEventInbox.address,
erc20Outbox.address,
prover0.address,
proverMem.address,
proverMath.address,
proverHostIo.address,
],
])
const prover0 = await deployContract('OneStepProver0', signer)
const proverMem = await deployContract('OneStepProverMemory', signer)
const proverMath = await deployContract('OneStepProverMath', signer)
const proverHostIo = await deployContract('OneStepProverHostIo', signer)
const osp: Contract = await deployContract('OneStepProofEntry', signer, [
prover0.address,
proverMem.address,
proverMath.address,
proverHostIo.address,
])
const challengeManager = await deployContract('ChallengeManager', signer)
const rollupAdmin = await deployContract('RollupAdminLogic', signer)
const rollupUser = await deployContract('RollupUserLogic', signer)
verify
)
const challengeManager = await deployContract(
'ChallengeManager',
signer,
[],
verify
)
const rollupAdmin = await deployContract(
'RollupAdminLogic',
signer,
[],
verify
)
const rollupUser = await deployContract('RollupUserLogic', signer, [], verify)
const upgradeExecutor = await deployUpgradeExecutor(signer)
const validatorUtils = await deployContract('ValidatorUtils', signer)
const validatorUtils = await deployContract(
'ValidatorUtils',
signer,
[],
verify
)
const validatorWalletCreator = await deployContract(
'ValidatorWalletCreator',
signer
signer,
[],
verify
)
const rollupCreator = await deployContract(
'RollupCreator',
signer,
[],
verify
)
const rollupCreator = await deployContract('RollupCreator', signer)
const deployHelper = await deployContract('DeployHelper', signer)
const deployHelper = await deployContract('DeployHelper', signer, [], verify)
return {
bridgeCreator,
prover0,
Expand All @@ -180,7 +237,7 @@ export async function deployAllContracts(
}

// Check if we're deploying to an Arbitrum chain
async function _isRunningOnArbitrum(signer: any): Promise<Boolean> {
export async function _isRunningOnArbitrum(signer: any): Promise<boolean> {
const arbSys = ArbSys__factory.connect(ARB_SYS_ADDRESS, signer)
try {
await arbSys.arbOSVersion()
Expand Down
Loading

0 comments on commit 1251afe

Please sign in to comment.