Skip to content

Commit

Permalink
Merge pull request #19 from Layr-Labs/epociask--length-fixes-v3.0.3
Browse files Browse the repository at this point in the history
fix: Include length in preimage hash generation
  • Loading branch information
epociask authored Aug 21, 2024
2 parents de9b114 + 90dbdcf commit 9904075
Show file tree
Hide file tree
Showing 36 changed files with 666 additions and 522 deletions.
14 changes: 7 additions & 7 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: linux-2xl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
Expand All @@ -33,11 +33,11 @@ jobs:
- name: Install packages
run: yarn

- name: Build
run: forge test --fork-url https://rpc.holesky.ethpandaops.io/
# - name: Build
# run: forge test --fork-url https://rpc.holesky.ethpandaops.io/
tests:
name: Contract tests
runs-on: linux-2xl
runs-on: ubuntu-latest
defaults:
run:
shell: bash
Expand Down Expand Up @@ -79,8 +79,8 @@ jobs:
- name: Run tests
run: yarn hardhat --network hardhat test test/contract/*.spec.ts

- name: Interface compatibility
run: yarn run test:compatibility
# - name: Interface compatibility
# run: yarn run test:compatibility

- name: Forge build
run: forge build
Expand All @@ -103,7 +103,7 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
test-4844:
name: 4844 tests
runs-on: linux-2xl
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
Expand Down
11 changes: 0 additions & 11 deletions deploy/EigenDARollupManagerStubCreator.js

This file was deleted.

10 changes: 10 additions & 0 deletions deploy/L2BlobVerifierStubCreator.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('EigenDABlobVerifierL2', { from: deployer, args: [] })
}

module.exports.tags = ['EigenDABlobVerifierL2']
module.exports.dependencies = []
8 changes: 5 additions & 3 deletions deploy/SequencerInbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,11 @@ module.exports = async hre => {

const EigenDARollupUtils = await ethers.getContract('EigenDARollupUtils')



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

module.exports.tags = ['SequencerInbox']
Expand Down
9 changes: 7 additions & 2 deletions scripts/deploymentUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export async function deployContract(
verify: boolean = true,
overrides?: Overrides
): Promise<Contract> {
console.log("Deploying contract EigenDA x Arbitrum", contractName)
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 @@ -93,7 +93,12 @@ export async function deployAllContracts(
): Promise<Record<string, Contract>> {
const isOnArb = await _isRunningOnArbitrum(signer)

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

const ethBridge = await deployContract('Bridge', signer, [], verify)
const reader4844 = isOnArb
Expand Down
2 changes: 1 addition & 1 deletion scripts/local-deployment/deployCreatorAndCreateRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ async function main() {
true,
contracts.rollupCreator.address,
feeToken,
contracts.eigenDARollupManager.address,
contracts.eigenDARollupManager.address
)

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

const createRollupTx = await rollupCreator.createRollup(deployParams, {
Expand Down Expand Up @@ -328,7 +332,7 @@ async function _getDevRollupConfig(
maxFeePerGasForRetryables: MAX_FER_PER_GAS,
batchPosters: batchPosters,
batchPosterManager: batchPosterManager,
eigenDARollupManager: rollupManager
eigenDARollupManager: rollupManager,
}

function _createValidatorAddress(
Expand Down
9 changes: 4 additions & 5 deletions src/bridge/EigenDABlobVerifierL1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,16 @@ pragma solidity ^0.8.9;
import "./IRollupManager.sol";

contract EigenDABlobVerifierL1 is IRollupManager {

IEigenDAServiceManager public immutable eigenDAServiceManager;
IEigenDAServiceManager public immutable EIGEN_DA_SERVICE_MANAGER;

constructor(address _eigenDAServiceManager) {
eigenDAServiceManager = IEigenDAServiceManager(_eigenDAServiceManager);
EIGEN_DA_SERVICE_MANAGER = IEigenDAServiceManager(_eigenDAServiceManager);
}

function verifyBlob(
IEigenDAServiceManager.BlobHeader calldata blobHeader,
EigenDARollupUtils.BlobVerificationProof calldata blobVerificationProof
) external view {
EigenDARollupUtils.verifyBlob(blobHeader, eigenDAServiceManager, blobVerificationProof);
EigenDARollupUtils.verifyBlob(blobHeader, EIGEN_DA_SERVICE_MANAGER, blobVerificationProof);
}
}
}
1 change: 0 additions & 1 deletion src/bridge/EigenDABlobVerifierL2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ pragma solidity ^0.8.9;
import "./IRollupManager.sol";

contract EigenDABlobVerifierL2 is IRollupManager {

function verifyBlob(
IEigenDAServiceManager.BlobHeader calldata blobHeader,
EigenDARollupUtils.BlobVerificationProof calldata blobVerificationProof
Expand Down
22 changes: 16 additions & 6 deletions src/bridge/IBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ interface IBridge {
NoData,
/// @notice The data can be found in the 4844 data blobs on this transaction
Blob,
/// @notice The data can be found in the EigenDA blob associated with this batch
/// @notice The data can be found in the EigenDA blob associated with the metadata of this transaction
EigenDA
}

Expand All @@ -44,7 +44,10 @@ 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 @@ -77,9 +80,11 @@ 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 @@ -94,7 +99,12 @@ 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
3 changes: 1 addition & 2 deletions src/bridge/IRollupManager.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import {EigenDARollupUtils} from "@eigenda/eigenda-utils/libraries/EigenDARollup
import {IEigenDAServiceManager} from "@eigenda/eigenda-utils/interfaces/IEigenDAServiceManager.sol";

interface IRollupManager {

function verifyBlob(
IEigenDAServiceManager.BlobHeader calldata blobHeader,
EigenDARollupUtils.BlobVerificationProof calldata blobVerificationProof
) external view;
}
}
20 changes: 11 additions & 9 deletions src/bridge/ISequencerInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ interface ISequencerInbox is IDelayedMessageProvider {
IBridge.BatchDataLocation dataLocation
);

struct EigenDACert {
EigenDARollupUtils.BlobVerificationProof blobVerificationProof;
IEigenDAServiceManager.BlobHeader blobHeader;
}

event OwnerFunctionCalled(uint256 indexed id);

/// @dev a separate event that emits batch data when this isn't easily accessible in the tx.input
Expand Down Expand Up @@ -196,13 +201,12 @@ interface ISequencerInbox is IDelayedMessageProvider {
) external;

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

// ---------- onlyRollupOrOwner functions ----------
Expand All @@ -218,7 +222,6 @@ interface ISequencerInbox is IDelayedMessageProvider {
*/
function setRollupAddress() external;


/**
* @notice Set max delay for sequencer inbox
* @param maxTimeVariation_ the maximum time variation parameters
Expand Down Expand Up @@ -261,7 +264,6 @@ 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
Loading

0 comments on commit 9904075

Please sign in to comment.