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

V2.0.0 #10

Closed
wants to merge 41 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
6bd3cf1
add the eigenDA header flag
afkbyte Apr 19, 2024
ccaa00e
Fix broken lock file
epociask May 30, 2024
c455ef1
Merge pull request #1 from Layr-Labs/epociask--fix-lockfile
epociask May 30, 2024
a14d145
feat: Rollup manager
epociask May 30, 2024
9c99910
feat: EigenDA support - update test scripts
epociask May 31, 2024
051f6f8
Merge pull request #2 from Layr-Labs/epociask--rollup-manager-contract
epociask May 31, 2024
6333a3e
fix: Update dependency wiring for test deployments
epociask Jun 5, 2024
8c302f4
update prooftype from 1 to 0
afkbyte Jun 5, 2024
a6edf09
Merge pull request #4 from Layr-Labs/afk/fix-osp-proof-version
epociask Jun 5, 2024
f00ebfb
save work
afkbyte Jun 11, 2024
fa30403
Update ERC20Outbox.t.sol
0x0aa0 Jun 18, 2024
c81054f
Update ERC20Outbox.t.sol
0x0aa0 Jun 18, 2024
fa9a0b3
update storage layout
afkbyte Jun 19, 2024
6e5074e
nit: etching comment
0x0aa0 Jun 20, 2024
33b9f0a
Merge pull request #6 from Layr-Labs/fix-unkknown-root-bug
afkbyte Jun 21, 2024
2d525bd
dispersed new blob and deployed rollup manager
afkbyte Jun 27, 2024
a8eebef
all tests passing
afkbyte Jun 27, 2024
f1a5caf
feat(contracts): Update SequencerInbox and add additional stub contra…
epociask Jul 1, 2024
24f58bb
kinda fix broken sequencerInbox forge test
epociask Jul 2, 2024
3c7744f
removed typescript client
epociask Jul 2, 2024
2f8d2cc
Merge pull request #8 from Layr-Labs/epociask--cherry-pick-test-fix-c…
epociask Jul 2, 2024
63bdd82
merge upstream changes and fix failing inbox test
epociask Jul 2, 2024
7d788fd
fix tests, remove debug stmts, unecessary structs
epociask Jul 3, 2024
2946c01
update SequencerInbox stub
epociask Jul 3, 2024
657a088
remove dummyManager artifact
epociask Jul 4, 2024
2a561f8
fix one step prover
epociask Jul 4, 2024
4395fa7
Merge pull request #7 from Layr-Labs/epociask--fix-bugs
epociask Jul 8, 2024
1251afe
merge in upstream
epociask Jul 8, 2024
40ffbee
fix compilation bugs
epociask Jul 8, 2024
95162e1
use in-house runner
epociask Jul 8, 2024
9595d1c
Merge branch 'develop' of github.com:Layr-Labs/nitro-contracts-privat…
epociask Jul 8, 2024
37383c2
update rollupCreation script
epociask Jul 9, 2024
e8eb3f3
update console log in deploymentUtils
epociask Jul 9, 2024
344fc29
update wiring for setting rollup manager
epociask Jul 9, 2024
3ced162
update rollup mgmt contract and deployment logic
epociask Jul 9, 2024
acc6f31
fix stack too deep compilation bug
epociask Jul 9, 2024
ad6ad21
updated tests
epociask Jul 9, 2024
5172b81
Merge branch 'v3.0.3-chnages' of github.com:Layr-Labs/nitro-contracts…
epociask Jul 9, 2024
0f9ddd7
update package dep
epociask Jul 9, 2024
a450cd9
dummy file for debugging
epociask Jul 9, 2024
cce6f3a
update batch entry function to use _sequenceNumber
epociask Jul 10, 2024
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
8 changes: 4 additions & 4 deletions .github/workflows/contract-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ on:
jobs:
test-unit:
name: Test unit
runs-on: ubuntu-latest
runs-on: linux-2xl
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -34,10 +34,10 @@ jobs:
run: yarn

- name: Build
run: forge test
run: forge test --fork-url https://rpc.holesky.ethpandaops.io/
tests:
name: Contract tests
runs-on: ubuntu-8
runs-on: linux-2xl
defaults:
run:
shell: bash
Expand Down Expand Up @@ -106,7 +106,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
test-4844:
name: 4844 tests
runs-on: ubuntu-latest
runs-on: linux-2xl
steps:
- uses: actions/checkout@v3
with:
Expand Down
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
url = https://github.com/foundry-rs/forge-std
[submodule "lib/eigenda"]
path = lib/eigenda
url = https://github.com/Layr-Labs/eigenda
url = https://github.com/Layr-Labs/eigenda
11 changes: 11 additions & 0 deletions deploy/EigenDARollupManagerStubCreator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
module.exports = async hre => {
const { deployments, getNamedAccounts, ethers } = hre
const { deploy } = deployments
const { deployer } = await getNamedAccounts()

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

module.exports.tags = ['EigenDADummyManager']
module.exports.dependencies = []

10 changes: 10 additions & 0 deletions deploy/EigenDAServiceManagerStubCreator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = async hre => {
const { deployments, getNamedAccounts, ethers } = hre
const { deploy } = deployments
const { deployer } = await getNamedAccounts()

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

module.exports.tags = ['EigenDAServiceManagerStub', 'test']
module.exports.dependencies = []
8 changes: 6 additions & 2 deletions deploy/SequencerInbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,12 @@ module.exports = async hre => {
const blobBasefeeReader = await ethers.getContract('BlobBasefeeReader')
const dataHashReader = await ethers.getContract('DataHashReader')

await deploy('SequencerInbox', { from: deployer, args: [117964] })
const EigenDARollupUtils = await ethers.getContract('EigenDARollupUtils')



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

module.exports.tags = ['SequencerInbox']
module.exports.dependencies = []
module.exports.dependencies = ['EigenDARollupUtils']
1 change: 1 addition & 0 deletions deploy/SequencerInboxStubCreator.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ module.exports = async hre => {
delaySeconds: 10000,
futureSeconds: 10000,
}

await deploy('SequencerInboxStub', {
from: deployer,
args: [
Expand Down
Empty file added hello.txt
Empty file.
9 changes: 7 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,13 @@
"deploy-cachemanager-testnode": "hardhat run scripts/local-deployment/deployCacheManager.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/contracts": "4.5.0",
"@openzeppelin/contracts-upgradeable": "4.5.2",
"@openzeppelin/contracts": "4.7.0",
"@openzeppelin-upgrades/contracts": "npm:@openzeppelin/contracts-upgradeable@4.7",
"@openzeppelin/contracts-upgradeable": "4.7.2",
"patch-package": "^6.4.7",
"solady": "0.0.182"
},
Expand All @@ -64,6 +68,7 @@
"@typechain/ethers-v5": "^10.0.0",
"@typechain/hardhat": "^6.0.0",
"@types/chai": "^4.3.0",
"@types/google-protobuf": "^3.15.12",
"@types/mocha": "^9.0.0",
"@types/node": "^17.0.5",
"@typescript-eslint/eslint-plugin": "^5.14.0",
Expand Down
5 changes: 5 additions & 0 deletions scripts/deploymentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ export async function deployContract(
verify: boolean = true,
overrides?: Overrides
): Promise<Contract> {
console.log("Deploying contract EigenDA x Arbitrum", contractName)
const factory: ContractFactory = await ethers.getContractFactory(contractName)
const connectedFactory: ContractFactory = factory.connect(signer)

Expand Down Expand Up @@ -100,6 +101,8 @@ export async function deployAllContracts(
): Promise<Record<string, Contract>> {
const isOnArb = await _isRunningOnArbitrum(signer)

const eigenDARollupManager = await deployContract('EigenDADummyManager', signer, [], verify)

const ethBridge = await deployContract('Bridge', signer, [], verify)
const reader4844 = isOnArb
? ethers.constants.AddressZero
Expand Down Expand Up @@ -227,6 +230,7 @@ export async function deployAllContracts(
)
const deployHelper = await deployContract('DeployHelper', signer, [], verify)
return {
ethSequencerInbox,
bridgeCreator,
prover0,
proverMem,
Expand All @@ -241,6 +245,7 @@ export async function deployAllContracts(
validatorWalletCreator,
rollupCreator,
deployHelper,
eigenDARollupManager,
}
}

Expand Down
3 changes: 2 additions & 1 deletion scripts/local-deployment/deployCreatorAndCreateRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ async function main() {
deployerWallet,
true,
contracts.rollupCreator.address,
feeToken
feeToken,
contracts.eigenDARollupManager.address,
)

if (!result) {
Expand Down
8 changes: 6 additions & 2 deletions scripts/rollupCreation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ export async function createRollup(
signer: Signer,
isDevDeployment: boolean,
rollupCreatorAddress: string,
feeToken: string
feeToken: string,
eigenDARollupManager: string,
): Promise<{
rollupCreationResult: RollupCreationResult
chainInfo: ChainInfo
Expand Down Expand Up @@ -101,7 +102,7 @@ export async function createRollup(
// Call the createRollup function
console.log('Calling createRollup to generate a new rollup ...')
const deployParams = isDevDeployment
? await _getDevRollupConfig(feeToken, validatorWalletCreator)
? await _getDevRollupConfig(eigenDARollupManager, feeToken, validatorWalletCreator)
: {
config: config.rollupConfig,
validators: config.validators,
Expand All @@ -111,6 +112,7 @@ export async function createRollup(
maxFeePerGasForRetryables: MAX_FER_PER_GAS,
batchPosters: config.batchPosters,
batchPosterManager: config.batchPosterManager,
eigenDARollupManager: eigenDARollupManager
}

const createRollupTx = await rollupCreator.createRollup(deployParams, {
Expand Down Expand Up @@ -229,6 +231,7 @@ export async function createRollup(
}

async function _getDevRollupConfig(
rollupManager: string,
feeToken: string,
validatorWalletCreator: string
) {
Expand Down Expand Up @@ -329,6 +332,7 @@ async function _getDevRollupConfig(
maxFeePerGasForRetryables: MAX_FER_PER_GAS,
batchPosters: batchPosters,
batchPosterManager: batchPosterManager,
eigenDARollupManager: rollupManager
}

function _createValidatorAddress(
Expand Down
24 changes: 8 additions & 16 deletions src/bridge/IBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,9 @@ interface IBridge {
/// @notice This batch contains no data
NoData,
/// @notice The data can be found in the 4844 data blobs on this transaction
Blob
Blob,
/// @notice The data can be found in the EigenDA blob associated with this batch
EigenDA
}

struct TimeBounds {
Expand All @@ -42,10 +44,7 @@ interface IBridge {
);

event BridgeCallTriggered(
address indexed outbox,
address indexed to,
uint256 value,
bytes data
address indexed outbox, address indexed to, uint256 value, bytes data
);

event InboxToggle(address indexed inbox, bool enabled);
Expand Down Expand Up @@ -78,11 +77,9 @@ interface IBridge {

function sequencerReportedSubMessageCount() external view returns (uint256);

function executeCall(
address to,
uint256 value,
bytes calldata data
) external returns (bool success, bytes memory returnData);
function executeCall(address to, uint256 value, bytes calldata data)
external
returns (bool success, bytes memory returnData);

function delayedMessageCount() external view returns (uint256);

Expand All @@ -97,12 +94,7 @@ interface IBridge {
uint256 newMessageCount
)
external
returns (
uint256 seqMessageIndex,
bytes32 beforeAcc,
bytes32 delayedAcc,
bytes32 acc
);
returns (uint256 seqMessageIndex, bytes32 beforeAcc, bytes32 delayedAcc, bytes32 acc);

/**
* @dev Allows the sequencer inbox to submit a delayed message of the batchPostingReport type
Expand Down
31 changes: 31 additions & 0 deletions src/bridge/ISequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ import "../libraries/IGasRefunder.sol";
import "./IDelayedMessageProvider.sol";
import "./IBridge.sol";

import {EigenDARollupUtils} from "@eigenda/eigenda-utils/libraries/EigenDARollupUtils.sol";
import {IEigenDAServiceManager} from "@eigenda/eigenda-utils/interfaces/IEigenDAServiceManager.sol";

interface ISequencerInbox is IDelayedMessageProvider {
struct MaxTimeVariation {
uint256 delayBlocks;
Expand Down Expand Up @@ -83,6 +86,12 @@ interface ISequencerInbox is IDelayedMessageProvider {
// solhint-disable-next-line func-name-mixedcase
function ZERO_HEAVY_MESSAGE_HEADER_FLAG() external view returns (bytes1);

/// @dev If the first data byte after the header has this bit set,
/// then the batch data is an eigenDA message
/// See: https://github.com/Layr-Labs/nitro/blob/2ad088cb5943ec50ed8b521c4681561817a602c5/das/eigenda/eigenda.go
// solhint-disable-next-line func-name-mixedcase
function EIGENDA_MESSAGE_HEADER_FLAG() external view returns (bytes1);

function rollup() external view returns (IOwnable);

function isBatchPoster(address) external view returns (bool);
Expand Down Expand Up @@ -179,8 +188,29 @@ interface ISequencerInbox is IDelayedMessageProvider {
uint256 newMessageCount
) external;

function addSequencerL2BatchFromEigenDA(
uint256 sequenceNumber,
EigenDARollupUtils.BlobVerificationProof calldata blobVerificationProof,
IEigenDAServiceManager.BlobHeader calldata blobHeader,
uint256 afterDelayedMessagesRead,
uint256 prevMessageCount,
uint256 newMessageCount
) external;

// ---------- onlyRollupOrOwner functions ----------

/**
* @notice Set the rollup manager contract address
* @param newRollupManager the new rollup manager contract address
*/
function setEigenDARollupManager(address newRollupManager) external;

/**
* @notice Set the new rollup contract address
*/
function setRollupAddress() external;


/**
* @notice Set max delay for sequencer inbox
* @param maxTimeVariation_ the maximum time variation parameters
Expand Down Expand Up @@ -223,6 +253,7 @@ interface ISequencerInbox is IDelayedMessageProvider {
/// @notice Allows the rollup owner to sync the rollup address
function updateRollupAddress() external;


// ---------- initializer ----------

function initialize(IBridge bridge_, MaxTimeVariation calldata maxTimeVariation_) external;
Expand Down
84 changes: 84 additions & 0 deletions src/bridge/RollupManager.sol
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
// SPDX-License-Identifier: MIT

pragma solidity ^0.8.9;

import {Merkle} from "@eigenda/eigenda-utils/libraries/Merkle.sol";
import {BN254} from "@eigenda/eigenda-utils/libraries/BN254.sol";
import {EigenDAHasher} from "@eigenda/eigenda-utils/libraries/EigenDAHasher.sol";
import {IEigenDAServiceManager} from "@eigenda/eigenda-utils/interfaces/IEigenDAServiceManager.sol";
import {BitmapUtils} from "@eigenda/eigenda-utils/libraries/BitmapUtils.sol";
import {EigenDARollupUtils} from "@eigenda/eigenda-utils/libraries/EigenDARollupUtils.sol";
import {IBLSSignatureChecker} from "@eigenda/eigenda-utils/interfaces/IBLSSignatureChecker.sol";
import {IPaymentCoordinator} from "@eigenda/eigenda-utils/interfaces/IPaymentCoordinator.sol";
import {ISignatureUtils} from "@eigenda/eigenda-utils/interfaces/ISignatureUtils.sol";

import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

interface IRollupManager {

function verifyBlob(
IEigenDAServiceManager.BlobHeader calldata blobHeader,
EigenDARollupUtils.BlobVerificationProof calldata blobVerificationProof
) external view;

function openCommitment(
uint256 point,
uint256 evaluation,
BN254.G1Point memory tau,
BN254.G1Point memory commitment,
BN254.G2Point memory proof
) external view returns(bool);

}

// EigenDADummyManager is a dummy implementation of IRollupManager
// and is used in nitro-testnode to avoid the overhead of deploying core EigenDA contracts
// to simplify the testing process.
contract EigenDADummyManager {

function verifyBlob(
IEigenDAServiceManager.BlobHeader calldata,
EigenDARollupUtils.BlobVerificationProof calldata
) external view {
return ;
}

function openCommitment(
uint256 point,
uint256 evaluation,
BN254.G1Point memory tau,
BN254.G1Point memory commitment,
BN254.G2Point memory proof
) internal view returns(bool) {

return EigenDARollupUtils.openCommitment(point, evaluation, tau, commitment, proof);
}
}

contract EigenDARollupManager is Ownable, IRollupManager {
using BN254 for BN254.G1Point;

address public eigenDAServiceManager;

function verifyBlob(
IEigenDAServiceManager.BlobHeader calldata blobHeader,
EigenDARollupUtils.BlobVerificationProof calldata blobVerificationProof
) external view {
return EigenDARollupUtils.verifyBlob(blobHeader, IEigenDAServiceManager(eigenDAServiceManager), blobVerificationProof);
}

function openCommitment(
uint256 point,
uint256 evaluation,
BN254.G1Point memory tau,
BN254.G1Point memory commitment,
BN254.G2Point memory proof
) external view returns(bool) {

return EigenDARollupUtils.openCommitment(point, evaluation, tau, commitment, proof);
}

function setEigenDAServiceManager(address _eigenDAServiceManager) external onlyOwner {
eigenDAServiceManager = _eigenDAServiceManager;
}
}
Loading
Loading