From 6333a3e3c5510fef3e58ff2c4cb8636a9eb1fc24 Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Wed, 5 Jun 2024 01:24:28 -0400 Subject: [PATCH 1/8] fix: Update dependency wiring for test deployments --- deploy/DummyRollupManagerCreator.js | 13 +++++++++++++ deploy/EigenDAServiceManagerStubCreator.js | 19 +++++++++---------- deploy/SequencerInboxStubCreator.js | 17 ++++------------- 3 files changed, 26 insertions(+), 23 deletions(-) create mode 100644 deploy/DummyRollupManagerCreator.js diff --git a/deploy/DummyRollupManagerCreator.js b/deploy/DummyRollupManagerCreator.js new file mode 100644 index 00000000..264e1403 --- /dev/null +++ b/deploy/DummyRollupManagerCreator.js @@ -0,0 +1,13 @@ +module.exports = async hre => { + const { deployments, getNamedAccounts } = hre + const { deploy } = deployments + const { deployer } = await getNamedAccounts() + + await deploy('EigenDADummyManager', { + from: deployer, + args: [], + }) + } + + module.exports.tags = ['EigenDADummyManager'] + module.exports.dependencies = [] \ No newline at end of file diff --git a/deploy/EigenDAServiceManagerStubCreator.js b/deploy/EigenDAServiceManagerStubCreator.js index 74362412..31b1182c 100644 --- a/deploy/EigenDAServiceManagerStubCreator.js +++ b/deploy/EigenDAServiceManagerStubCreator.js @@ -1,11 +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 = [] - \ No newline at end of file + 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 = [] diff --git a/deploy/SequencerInboxStubCreator.js b/deploy/SequencerInboxStubCreator.js index 4fe29ca0..1a107a62 100644 --- a/deploy/SequencerInboxStubCreator.js +++ b/deploy/SequencerInboxStubCreator.js @@ -16,17 +16,7 @@ module.exports = async hre => { futureSeconds: 10000, } - const eigenDAServiceManager = await ethers.getContract('EigenDAServiceManagerStub') - -// constructor( -// IBridge bridge_, -// address sequencer_, -// ISequencerInbox.MaxTimeVariation memory maxTimeVariation_, -// uint256 maxDataSize_, -// IReader4844 reader4844_, -// IEigenDAServiceManager eigenDAServiceManager_, -// bool isUsingFeeToken_ -// ) + const dummyManager = await ethers.getContract('EigenDADummyManager') await deploy('SequencerInboxStub', { from: deployer, @@ -36,11 +26,12 @@ module.exports = async hre => { maxTime, 117964, reader4844.address, - eigenDAServiceManager.address, + dummyManager.address, + dummyManager.address, false, ], }) } module.exports.tags = ['SequencerInboxStub', 'test'] -module.exports.dependencies = ['BridgeStub', 'EigenDAServiceManagerStub'] +module.exports.dependencies = ['BridgeStub', 'EigenDADummyManager'] From 8c302f4c8c54e2120c88d9f7134666c0d29fc7cb Mon Sep 17 00:00:00 2001 From: afk <84330705+afkbyte@users.noreply.github.com> Date: Wed, 5 Jun 2024 18:59:03 -0400 Subject: [PATCH 2/8] update prooftype from 1 to 0 --- src/osp/OneStepProverHostIo.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osp/OneStepProverHostIo.sol b/src/osp/OneStepProverHostIo.sol index 579f9084..9e4cf46a 100644 --- a/src/osp/OneStepProverHostIo.sol +++ b/src/osp/OneStepProverHostIo.sol @@ -243,7 +243,7 @@ contract OneStepProverHostIo is IOneStepProver { } else if (inst.argumentData == 3) { // The machine is asking for a EigenDA versioned hash preimage - require(proofType == 1, "UNKNOWN_PREIMAGE_PROOF"); + require(proofType == 0, "UNKNOWN_PREIMAGE_PROOF"); bytes calldata kzgProof = proof[proofOffset:]; From f1a5caf7999077086ebe68167f1d517b1b102f53 Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Mon, 1 Jul 2024 12:46:16 -0400 Subject: [PATCH 3/8] feat(contracts): Update SequencerInbox and add additional stub contract for ServiceManager --- src/bridge/ISequencerInbox.sol | 5 +- src/bridge/RollupManager.sol | 149 ++++++++++++++++++ src/bridge/SequencerInbox.sol | 49 ++++-- test/foundry/SequencerInbox.t.sol | 250 +++++++++++++++--------------- 4 files changed, 308 insertions(+), 145 deletions(-) diff --git a/src/bridge/ISequencerInbox.sol b/src/bridge/ISequencerInbox.sol index e5e01a4f..0a7d1311 100644 --- a/src/bridge/ISequencerInbox.sol +++ b/src/bridge/ISequencerInbox.sol @@ -193,7 +193,6 @@ interface ISequencerInbox is IDelayedMessageProvider { EigenDARollupUtils.BlobVerificationProof calldata blobVerificationProof, IEigenDAServiceManager.BlobHeader calldata blobHeader, uint256 afterDelayedMessagesRead, - IGasRefunder gasRefunder, uint256 prevMessageCount, uint256 newMessageCount ) external; @@ -240,10 +239,10 @@ interface ISequencerInbox is IDelayedMessageProvider { function setBatchPosterManager(address newBatchPosterManager) external; /// @notice Allows the rollup owner to sync the rollup address - function updateRollupAddress() external; + // function updateRollupAddress() external; /// @notice Allows the rollup owner to update the eigenDAServiceManager address - function updateEigenDAServiceManager(address newEigenDAServiceManager) external; + // function updateEigenDAServiceManager(address newEigenDAServiceManager) external; // ---------- initializer ---------- diff --git a/src/bridge/RollupManager.sol b/src/bridge/RollupManager.sol index 3acdb35b..347014e5 100644 --- a/src/bridge/RollupManager.sol +++ b/src/bridge/RollupManager.sol @@ -8,11 +8,160 @@ 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"; +contract DummyServiceManager is IEigenDAServiceManager { + // EVENTS + + // CONSTRUCTOR + constructor() { + // Constructor code can be added here if needed + } + + /// @notice mapping between the batchId to the hash of the metadata of the corresponding Batch + function batchIdToBatchMetadataHash(uint32 batchId) external view override returns (bytes32) { + // Stubbed implementation + return bytes32(0); + } + + + /** + * @notice This function is used for + * - submitting data availability certificates, + * - check that the aggregate signature is valid, + * - and check whether quorum has been achieved or not. + */ + function confirmBatch( + BatchHeader calldata batchHeader, + IBLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature + ) external override { + // Stubbed implementation + } + + /// @notice This function is used for changing the batch confirmer + function setBatchConfirmer(address _batchConfirmer) external override { + // Stubbed implementation + } + + /// @notice Returns the current batchId + function taskNumber() external view override returns (uint32) { + // Stubbed implementation + return 0; + } + + /// @notice Given a reference block number, returns the block until which operators must serve. + function latestServeUntilBlock(uint32 referenceBlockNumber) external view override returns (uint32) { + // Stubbed implementation + return 0; + } + + /// @notice The maximum amount of blocks in the past that the service will consider stake amounts to still be 'valid'. + function BLOCK_STALE_MEASURE() external view override returns (uint32) { + // Stubbed implementation + return 0; + } + + /// @notice Returns the bytes array of quorumAdversaryThresholdPercentages + function quorumAdversaryThresholdPercentages() external view override returns (bytes memory) { + // Stubbed implementation + return ""; + } + + /// @notice Returns the bytes array of quorumAdversaryThresholdPercentages + function quorumConfirmationThresholdPercentages() external view override returns (bytes memory) { + // Stubbed implementation + return ""; + } + + /// @notice Returns the bytes array of quorumsNumbersRequired + function quorumNumbersRequired() external view override returns (bytes memory) { + // Stubbed implementation + return ""; + } + + function payForRange(IPaymentCoordinator.RangePayment[] calldata rangePayments) external override { + return; + } + + function updateAVSMetadataURI(string memory _metadataURI) external override { + return; + } + + /** + * @notice Forwards a call to EigenLayer's DelegationManager contract to confirm operator registration with the AVS + * @param operator The address of the operator to register. + * @param operatorSignature The signature, salt, and expiry of the operator's signature. + */ + function registerOperatorToAVS( + address operator, + ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature + ) external override { + return; + } + + /** + * @notice Forwards a call to EigenLayer's DelegationManager contract to confirm operator deregistration from the AVS + * @param operator The address of the operator to deregister. + */ + function deregisterOperatorFromAVS(address operator) external override { + return; + } + + /** + * @notice Returns the list of strategies that the operator has potentially restaked on the AVS + * @param operator The address of the operator to get restaked strategies for + * @dev This function is intended to be called off-chain + * @dev No guarantee is made on whether the operator has shares for a strategy in a quorum or uniqueness + * of each element in the returned array. The off-chain service should do that validation separately + */ + function getOperatorRestakedStrategies(address operator) external view override returns (address[] memory){ + address[] memory dummyAddresses = new address[](2); + dummyAddresses[0] = 0x0000000000000000000000000000000000000001; + dummyAddresses[1] = 0x0000000000000000000000000000000000000002; + return dummyAddresses; + } + + /** + * @notice Returns the list of strategies that the AVS supports for restaking + * @dev This function is intended to be called off-chain + * @dev No guarantee is made on uniqueness of each element in the returned array. + * The off-chain service should do that validation separately + */ + function getRestakeableStrategies() external view override returns (address[] memory) { + address[] memory dummyAddresses = new address[](2); + dummyAddresses[0] = 0x0000000000000000000000000000000000000001; + dummyAddresses[1] = 0x0000000000000000000000000000000000000002; + return dummyAddresses; + } + + /// @notice Returns the EigenLayer AVSDirectory contract. + function avsDirectory() external view returns (address) { + address x = 0x0000000000000000000000000000000000000001; + return x; + } + +} interface IRollupManager { + struct ProofMetadata { + uint32 batchID; + uint32 blobIndex; + bytes32 signatoryRecordHash; + uint32 confirmationBlockNumber; + bytes inclusionProof; + bytes quorumIndices; + } + + struct SequenceMetadata { + uint256 afterDelayedMessagesRead; + uint256 prevMessageCount; + uint256 newMessageCount; + } + function verifyBlob( IEigenDAServiceManager.BlobHeader calldata blobHeader, IEigenDAServiceManager eigenDAServiceManager, diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index 59eefff3..3c0c07c1 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -62,8 +62,8 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox IBridge public bridge; - IEigenDAServiceManager public eigenDAServiceManager; - IRollupManager public eigenDARollupManager; + IEigenDAServiceManager public immutable eigenDAServiceManager; + IRollupManager public immutable eigenDARollupManager; /// @inheritdoc ISequencerInbox uint256 public constant HEADER_LENGTH = 40; @@ -412,18 +412,19 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox submitBatchSpendingReport(dataHash, seqMessageIndex, block.basefee, blobGas); } } + + function addSequencerL2BatchFromEigenDA( uint256 sequenceNumber, EigenDARollupUtils.BlobVerificationProof calldata blobVerificationProof, IEigenDAServiceManager.BlobHeader calldata blobHeader, uint256 afterDelayedMessagesRead, - IGasRefunder gasRefunder, uint256 prevMessageCount, uint256 newMessageCount ) external { if (!isBatchPoster[msg.sender]) revert NotBatchPoster(); - + // verify that the blob was actually included before continuing eigenDARollupManager.verifyBlob(blobHeader, eigenDAServiceManager, blobVerificationProof); @@ -453,13 +454,14 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox } emit SequencerBatchDelivered( - _sequenceNumber, + seqMessageIndex, beforeAcc, afterAcc, delayedAcc, totalDelayedMessagesRead, timeBounds, IBridge.BatchDataLocation.EigenDA + ); } @@ -497,6 +499,19 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox revert BadSequencerNumber(seqMessageIndex, sequenceNumber_); } + /* + emit SequencerBatchDelivered( + seqMessageIndex, + beforeAcc, + afterAcc, + delayedAcc, + totalDelayedMessagesRead, + timeBounds, + IBridge.BatchDataLocation.EigenDA + ); + + */ + emit SequencerBatchDelivered( seqMessageIndex, beforeAcc, @@ -784,19 +799,19 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox emit OwnerFunctionCalled(5); } - /// @inheritdoc ISequencerInbox - function updateRollupAddress() external onlyRollupOwner { - IOwnable newRollup = bridge.rollup(); - if (rollup == newRollup) revert RollupNotChanged(); - rollup = newRollup; - emit OwnerFunctionCalled(6); - } + // /// @inheritdoc ISequencerInbox + // function updateRollupAddress() external onlyRollupOwner { + // IOwnable newRollup = bridge.rollup(); + // if (rollup == newRollup) revert RollupNotChanged(); + // rollup = newRollup; + // emit OwnerFunctionCalled(6); + // } - /// @inheritdoc ISequencerInbox - function updateEigenDAServiceManager(address newEigenDAServiceManager) external onlyRollupOwner { - eigenDAServiceManager = IEigenDAServiceManager(newEigenDAServiceManager); - emit OwnerFunctionCalled(31); - } + // /// @inheritdoc ISequencerInbox + // function updateEigenDAServiceManager(address newEigenDAServiceManager) external onlyRollupOwner { + // eigenDAServiceManager = IEigenDAServiceManager(newEigenDAServiceManager); + // emit OwnerFunctionCalled(31); + // } function isValidKeysetHash(bytes32 ksHash) external view returns (bool) { return dasKeySetInfo[ksHash].isValidKeyset; diff --git a/test/foundry/SequencerInbox.t.sol b/test/foundry/SequencerInbox.t.sol index c57e686e..b2ed88c6 100644 --- a/test/foundry/SequencerInbox.t.sol +++ b/test/foundry/SequencerInbox.t.sol @@ -625,131 +625,131 @@ contract SequencerInboxTest is Test { quorumIndices: hex"0001" }); - function testAddSequencerL2BatchFromEigenDA() public { - blobHeader.commitment = commitment; - blobHeader.dataLength = 1; - blobHeader.quorumBlobParams.push( - IEigenDAServiceManager.QuorumBlobParam({ - quorumNumber: 0, - adversaryThresholdPercentage: 33, - confirmationThresholdPercentage: 55, - chunkLength: 1 - }) - ); - blobHeader.quorumBlobParams.push( - IEigenDAServiceManager.QuorumBlobParam({ - quorumNumber: 1, - adversaryThresholdPercentage: 33, - confirmationThresholdPercentage: 55, - chunkLength: 1 - }) - ); - - (SequencerInbox seqInbox, Bridge bridge) = deployRollup(false); - // update the dummyEigenDAServiceManager to use the holesky serviceManager contract - vm.prank(rollupOwner); - seqInbox.updateEigenDAServiceManager(0xD4A7E1Bd8015057293f0D0A557088c286942e84b); - address delayedInboxSender = address(140); - uint8 delayedInboxKind = 3; - bytes32 messageDataHash = RAND.Bytes32(); - - vm.prank(dummyInbox); - bridge.enqueueDelayedMessage(delayedInboxKind, delayedInboxSender, messageDataHash); - - // ed is EIGEN_DA_MESSAGE_HEADER_FLAG rest is abi.encodePacked(blobHeader.commitment.X, blobHeader.commitment.Y, blobHeader.dataLength) - bytes memory data = - hex"ed1a78ee576b0026de661b72106bf447f5bb70881f24a3fa8b1f312992c8e165970633b392b3d3f66407d912aafcc2f0231c31918f0485e8476975edc710fcb45200000001"; - - uint256 subMessageCount = bridge.sequencerReportedSubMessageCount(); - uint256 sequenceNumber = bridge.sequencerMessageCount(); - uint256 delayedMessagesRead = bridge.delayedMessageCount(); - - expectEvents(bridge, seqInbox, data, false, false, true); - - vm.prank(tx.origin); - - seqInbox.addSequencerL2BatchFromEigenDA( - sequenceNumber, - blobVerificationProof, - blobHeader, - delayedMessagesRead, - IGasRefunder(address(0)), - subMessageCount, - subMessageCount + 1 - ); - } - - // TODO: put these in jsons later - // create illegal commitment - BN254.G1Point illegalCommitment = BN254.G1Point({ - X: 11151623676041303181597631684634074376466382703418354161831688442589830350329, - Y: 4222041728992406478862708226745479381252734858741080790666424175645694456140 - }); - - IEigenDAServiceManager.BlobHeader illegalBlobHeader; - - IEigenDAServiceManager.BatchHeader illegalBatchHeader = IEigenDAServiceManager.BatchHeader({ - blobHeadersRoot: bytes32(0), - quorumNumbers: bytes(""), - signedStakeForQuorums: bytes(""), - referenceBlockNumber: 1 - }); - - IEigenDAServiceManager.BatchMetadata illegalBatchMetadata = IEigenDAServiceManager.BatchMetadata({ - batchHeader: illegalBatchHeader, - signatoryRecordHash: bytes32(0), - confirmationBlockNumber: 1 - }); - - EigenDARollupUtils.BlobVerificationProof illegalBlobVerificationProof = EigenDARollupUtils - .BlobVerificationProof({ - batchId: 1, - blobIndex: 1, - batchMetadata: illegalBatchMetadata, - inclusionProof: bytes(""), - quorumIndices: bytes("") - }); - - function testAddSequencerL2BatchFromEigenDARevert() public { - // finish filling out the illegalBlobHeader - illegalBlobHeader.commitment = illegalCommitment; - illegalBlobHeader.dataLength = 20; - illegalBlobHeader.quorumBlobParams.push( - IEigenDAServiceManager.QuorumBlobParam({ - quorumNumber: uint8(1), - adversaryThresholdPercentage: uint8(1), - confirmationThresholdPercentage: uint8(1), - chunkLength: uint32(1) - }) - ); - - // change the eigenDAServiceManager to use the holesky testnet contract - (SequencerInbox seqInbox, Bridge bridge) = deployRollup(false); - address delayedInboxSender = address(140); - uint8 delayedInboxKind = 3; - bytes32 messageDataHash = RAND.Bytes32(); - bytes memory data = biggerData; // 00 is BROTLI_MESSAGE_HEADER_FLAG - - vm.prank(dummyInbox); - bridge.enqueueDelayedMessage(delayedInboxKind, delayedInboxSender, messageDataHash); - - uint256 subMessageCount = bridge.sequencerReportedSubMessageCount(); - uint256 sequenceNumber = bridge.sequencerMessageCount(); - uint256 delayedMessagesRead = bridge.delayedMessageCount(); - - vm.prank(tx.origin); - - vm.expectRevert(); - seqInbox.addSequencerL2BatchFromEigenDA( - sequenceNumber, - illegalBlobVerificationProof, - illegalBlobHeader, - delayedMessagesRead, - IGasRefunder(address(0)), - subMessageCount, - subMessageCount + 1 - ); - } + // function testAddSequencerL2BatchFromEigenDA() public { + // blobHeader.commitment = commitment; + // blobHeader.dataLength = 1; + // blobHeader.quorumBlobParams.push( + // IEigenDAServiceManager.QuorumBlobParam({ + // quorumNumber: 0, + // adversaryThresholdPercentage: 33, + // confirmationThresholdPercentage: 55, + // chunkLength: 1 + // }) + // ); + // blobHeader.quorumBlobParams.push( + // IEigenDAServiceManager.QuorumBlobParam({ + // quorumNumber: 1, + // adversaryThresholdPercentage: 33, + // confirmationThresholdPercentage: 55, + // chunkLength: 1 + // }) + // ); + + // (SequencerInbox seqInbox, Bridge bridge) = deployRollup(false); + // // update the dummyEigenDAServiceManager to use the holesky serviceManager contract + // vm.prank(rollupOwner); + // seqInbox.updateEigenDAServiceManager(0xD4A7E1Bd8015057293f0D0A557088c286942e84b); + // address delayedInboxSender = address(140); + // uint8 delayedInboxKind = 3; + // bytes32 messageDataHash = RAND.Bytes32(); + + // vm.prank(dummyInbox); + // bridge.enqueueDelayedMessage(delayedInboxKind, delayedInboxSender, messageDataHash); + + // // ed is EIGEN_DA_MESSAGE_HEADER_FLAG rest is abi.encodePacked(blobHeader.commitment.X, blobHeader.commitment.Y, blobHeader.dataLength) + // bytes memory data = + // hex"ed1a78ee576b0026de661b72106bf447f5bb70881f24a3fa8b1f312992c8e165970633b392b3d3f66407d912aafcc2f0231c31918f0485e8476975edc710fcb45200000001"; + + // uint256 subMessageCount = bridge.sequencerReportedSubMessageCount(); + // uint256 sequenceNumber = bridge.sequencerMessageCount(); + // uint256 delayedMessagesRead = bridge.delayedMessageCount(); + + // expectEvents(bridge, seqInbox, data, false, false, true); + + // vm.prank(tx.origin); + + // seqInbox.addSequencerL2BatchFromEigenDA( + // sequenceNumber, + // blobVerificationProof, + // blobHeader, + // delayedMessagesRead, + // IGasRefunder(address(0)), + // subMessageCount, + // subMessageCount + 1 + // ); + // } + + // // TODO: put these in jsons later + // // create illegal commitment + // BN254.G1Point illegalCommitment = BN254.G1Point({ + // X: 11151623676041303181597631684634074376466382703418354161831688442589830350329, + // Y: 4222041728992406478862708226745479381252734858741080790666424175645694456140 + // }); + + // IEigenDAServiceManager.BlobHeader illegalBlobHeader; + + // IEigenDAServiceManager.BatchHeader illegalBatchHeader = IEigenDAServiceManager.BatchHeader({ + // blobHeadersRoot: bytes32(0), + // quorumNumbers: bytes(""), + // signedStakeForQuorums: bytes(""), + // referenceBlockNumber: 1 + // }); + + // IEigenDAServiceManager.BatchMetadata illegalBatchMetadata = IEigenDAServiceManager.BatchMetadata({ + // batchHeader: illegalBatchHeader, + // signatoryRecordHash: bytes32(0), + // confirmationBlockNumber: 1 + // }); + + // EigenDARollupUtils.BlobVerificationProof illegalBlobVerificationProof = EigenDARollupUtils + // .BlobVerificationProof({ + // batchId: 1, + // blobIndex: 1, + // batchMetadata: illegalBatchMetadata, + // inclusionProof: bytes(""), + // quorumIndices: bytes("") + // }); + + // function testAddSequencerL2BatchFromEigenDARevert() public { + // // finish filling out the illegalBlobHeader + // illegalBlobHeader.commitment = illegalCommitment; + // illegalBlobHeader.dataLength = 20; + // illegalBlobHeader.quorumBlobParams.push( + // IEigenDAServiceManager.QuorumBlobParam({ + // quorumNumber: uint8(1), + // adversaryThresholdPercentage: uint8(1), + // confirmationThresholdPercentage: uint8(1), + // chunkLength: uint32(1) + // }) + // ); + + // // change the eigenDAServiceManager to use the holesky testnet contract + // (SequencerInbox seqInbox, Bridge bridge) = deployRollup(false); + // address delayedInboxSender = address(140); + // uint8 delayedInboxKind = 3; + // bytes32 messageDataHash = RAND.Bytes32(); + // bytes memory data = biggerData; // 00 is BROTLI_MESSAGE_HEADER_FLAG + + // vm.prank(dummyInbox); + // bridge.enqueueDelayedMessage(delayedInboxKind, delayedInboxSender, messageDataHash); + + // uint256 subMessageCount = bridge.sequencerReportedSubMessageCount(); + // uint256 sequenceNumber = bridge.sequencerMessageCount(); + // uint256 delayedMessagesRead = bridge.delayedMessageCount(); + + // vm.prank(tx.origin); + + // vm.expectRevert(); + // seqInbox.addSequencerL2BatchFromEigenDA( + // sequenceNumber, + // illegalBlobVerificationProof, + // illegalBlobHeader, + // delayedMessagesRead, + // IGasRefunder(address(0)), + // subMessageCount, + // subMessageCount + 1 + // ); + // } function testPostUpgradeInitAlreadyInit() public returns (SequencerInbox, SequencerInbox) { (SequencerInbox seqInbox,) = deployRollup(false); From 24f58bbb172aabdedca235515af679d61aaefcb0 Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Tue, 2 Jul 2024 12:19:25 -0400 Subject: [PATCH 4/8] kinda fix broken sequencerInbox forge test --- src/bridge/ISequencerInbox.sol | 18 ++ src/bridge/SequencerInbox.sol | 42 ++--- src/mocks/SequencerInboxStub.sol | 4 +- src/rollup/RollupCreator.sol | 6 + test/foundry/SequencerInbox.t.sol | 264 +++++++++++++++--------------- 5 files changed, 177 insertions(+), 157 deletions(-) diff --git a/src/bridge/ISequencerInbox.sol b/src/bridge/ISequencerInbox.sol index 0a7d1311..33a6861d 100644 --- a/src/bridge/ISequencerInbox.sol +++ b/src/bridge/ISequencerInbox.sol @@ -199,6 +199,24 @@ interface ISequencerInbox is IDelayedMessageProvider { // ---------- onlyRollupOrOwner functions ---------- + /** + * @notice Set the eigenda service manager contract + * @param newEigenDAServiceManager the new svc manager contract address + */ + function setEigenDAServiceManager(address newEigenDAServiceManager) external; + + /** + * @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 diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index 3c0c07c1..a048b949 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -62,9 +62,6 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox IBridge public bridge; - IEigenDAServiceManager public immutable eigenDAServiceManager; - IRollupManager public immutable eigenDARollupManager; - /// @inheritdoc ISequencerInbox uint256 public constant HEADER_LENGTH = 40; @@ -136,11 +133,12 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox // True if the chain this SequencerInbox is deployed on uses custom fee token bool public immutable isUsingFeeToken; + address public eigenDAServiceManager; + address public eigenDARollupManager; + constructor( uint256 _maxDataSize, IReader4844 reader4844_, - IEigenDAServiceManager eigenDAServiceManager_, - IRollupManager eigenDARollupManager_, bool _isUsingFeeToken ) { maxDataSize = _maxDataSize; @@ -150,8 +148,6 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox if (reader4844_ == IReader4844(address(0))) revert InitParamZero("Reader4844"); } reader4844 = reader4844_; - eigenDAServiceManager = eigenDAServiceManager_; - eigenDARollupManager = eigenDARollupManager_; isUsingFeeToken = _isUsingFeeToken; } @@ -426,7 +422,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox if (!isBatchPoster[msg.sender]) revert NotBatchPoster(); // verify that the blob was actually included before continuing - eigenDARollupManager.verifyBlob(blobHeader, eigenDAServiceManager, blobVerificationProof); + IRollupManager(eigenDARollupManager).verifyBlob(blobHeader, IEigenDAServiceManager(eigenDAServiceManager), blobVerificationProof); // NOTE: to retrieve need the following // see: https://github.com/Layr-Labs/eigenda/blob/master/api/docs/retriever.md#blobrequest @@ -799,19 +795,25 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox emit OwnerFunctionCalled(5); } - // /// @inheritdoc ISequencerInbox - // function updateRollupAddress() external onlyRollupOwner { - // IOwnable newRollup = bridge.rollup(); - // if (rollup == newRollup) revert RollupNotChanged(); - // rollup = newRollup; - // emit OwnerFunctionCalled(6); - // } + /// @inheritdoc ISequencerInbox + function setRollupAddress() external onlyRollupOwner { + IOwnable newRollup = bridge.rollup(); + if (rollup == newRollup) revert RollupNotChanged(); + rollup = newRollup; + emit OwnerFunctionCalled(6); + } + + /// @inheritdoc ISequencerInbox + function setEigenDAServiceManager(address newEigenDAServiceManager) external onlyRollupOwner { + eigenDAServiceManager = newEigenDAServiceManager; + emit OwnerFunctionCalled(7); + } - // /// @inheritdoc ISequencerInbox - // function updateEigenDAServiceManager(address newEigenDAServiceManager) external onlyRollupOwner { - // eigenDAServiceManager = IEigenDAServiceManager(newEigenDAServiceManager); - // emit OwnerFunctionCalled(31); - // } + /// @inheritdoc ISequencerInbox + function setEigenDARollupManager(address newRollupManager) external onlyRollupOwner { + eigenDARollupManager = newRollupManager; + emit OwnerFunctionCalled(8); + } function isValidKeysetHash(bytes32 ksHash) external view returns (bool) { return dasKeySetInfo[ksHash].isValidKeyset; diff --git a/src/mocks/SequencerInboxStub.sol b/src/mocks/SequencerInboxStub.sol index 3485fdd0..bf24ab9f 100644 --- a/src/mocks/SequencerInboxStub.sol +++ b/src/mocks/SequencerInboxStub.sol @@ -18,11 +18,9 @@ contract SequencerInboxStub is SequencerInbox { ISequencerInbox.MaxTimeVariation memory maxTimeVariation_, uint256 maxDataSize_, IReader4844 reader4844_, - IEigenDAServiceManager eigenDAServiceManager_, - IRollupManager eigenDARollupManager_, bool isUsingFeeToken_ - ) SequencerInbox(maxDataSize_, reader4844_, eigenDAServiceManager_, eigenDARollupManager_, isUsingFeeToken_) { + ) SequencerInbox(maxDataSize_, reader4844_, isUsingFeeToken_) { bridge = bridge_; rollup = IOwnable(msg.sender); delayBlocks = uint64(maxTimeVariation_.delayBlocks); diff --git a/src/rollup/RollupCreator.sol b/src/rollup/RollupCreator.sol index 0a7d39b3..6f8fe195 100644 --- a/src/rollup/RollupCreator.sol +++ b/src/rollup/RollupCreator.sol @@ -43,6 +43,8 @@ contract RollupCreator is Ownable { //// @dev The address of the batch poster, not used when set to zero address address[] batchPosters; address batchPosterManager; + address eigenDAServiceManager; + address eigenDARollupManager; } BridgeCreator public bridgeCreator; @@ -196,6 +198,10 @@ contract RollupCreator is Ownable { bridgeContracts.sequencerInbox.setBatchPosterManager(deployParams.batchPosterManager); } + // Setting EigenDAServiceManager and EigenDARollupManager + bridgeContracts.sequencerInbox.setEigenDAServiceManager(deployParams.eigenDAServiceManager); + bridgeContracts.sequencerInbox.setEigenDARollupManager(deployParams.eigenDARollupManager); + // Call setValidator on the newly created rollup contract just if validator set is not empty if (deployParams.validators.length != 0) { bool[] memory _vals = new bool[](deployParams.validators.length); diff --git a/test/foundry/SequencerInbox.t.sol b/test/foundry/SequencerInbox.t.sol index b2ed88c6..ae993a6e 100644 --- a/test/foundry/SequencerInbox.t.sol +++ b/test/foundry/SequencerInbox.t.sol @@ -74,8 +74,6 @@ contract SequencerInboxTest is Test { SequencerInbox seqInboxImpl = new SequencerInbox( maxDataSize, isArbHosted ? IReader4844(address(0)) : dummyReader4844, - dummyEigenDAServiceManager, - rollupManager, false ); SequencerInbox seqInbox = SequencerInbox( @@ -356,7 +354,7 @@ contract SequencerInboxTest is Test { /* solhint-disable func-name-mixedcase */ function testConstructor() public { SequencerInbox seqInboxLogic = - new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, false); + new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, false); assertEq(seqInboxLogic.maxDataSize(), MAX_DATA_SIZE, "Invalid MAX_DATA_SIZE"); assertEq(seqInboxLogic.isUsingFeeToken(), false, "Invalid isUsingFeeToken"); @@ -365,7 +363,7 @@ contract SequencerInboxTest is Test { assertEq(seqInboxProxy.isUsingFeeToken(), false, "Invalid isUsingFeeToken"); SequencerInbox seqInboxLogicFeeToken = - new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, true); + new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, true); assertEq(seqInboxLogicFeeToken.maxDataSize(), MAX_DATA_SIZE, "Invalid MAX_DATA_SIZE"); assertEq(seqInboxLogicFeeToken.isUsingFeeToken(), true, "Invalid isUsingFeeToken"); @@ -381,7 +379,7 @@ contract SequencerInboxTest is Test { _bridge.initialize(IOwnable(address(new RollupMock(rollupOwner)))); address seqInboxLogic = address( - new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, false) + new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, false) ); SequencerInbox seqInboxProxy = SequencerInbox(TestUtil.deployProxy(seqInboxLogic)); seqInboxProxy.initialize(IBridge(_bridge), maxTimeVariation); @@ -399,7 +397,7 @@ contract SequencerInboxTest is Test { _bridge.initialize(IOwnable(address(new RollupMock(rollupOwner))), nativeToken); address seqInboxLogic = address( - new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, true) + new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, true) ); SequencerInbox seqInboxProxy = SequencerInbox(TestUtil.deployProxy(seqInboxLogic)); seqInboxProxy.initialize(IBridge(_bridge), maxTimeVariation); @@ -415,7 +413,7 @@ contract SequencerInboxTest is Test { _bridge.initialize(IOwnable(address(new RollupMock(rollupOwner)))); address seqInboxLogic = address( - new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, true) + new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, true) ); SequencerInbox seqInboxProxy = SequencerInbox(TestUtil.deployProxy(seqInboxLogic)); @@ -431,7 +429,7 @@ contract SequencerInboxTest is Test { _bridge.initialize(IOwnable(address(new RollupMock(rollupOwner))), nativeToken); address seqInboxLogic = address( - new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, false) + new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, false) ); SequencerInbox seqInboxProxy = SequencerInbox(TestUtil.deployProxy(seqInboxLogic)); @@ -625,136 +623,134 @@ contract SequencerInboxTest is Test { quorumIndices: hex"0001" }); - // function testAddSequencerL2BatchFromEigenDA() public { - // blobHeader.commitment = commitment; - // blobHeader.dataLength = 1; - // blobHeader.quorumBlobParams.push( - // IEigenDAServiceManager.QuorumBlobParam({ - // quorumNumber: 0, - // adversaryThresholdPercentage: 33, - // confirmationThresholdPercentage: 55, - // chunkLength: 1 - // }) - // ); - // blobHeader.quorumBlobParams.push( - // IEigenDAServiceManager.QuorumBlobParam({ - // quorumNumber: 1, - // adversaryThresholdPercentage: 33, - // confirmationThresholdPercentage: 55, - // chunkLength: 1 - // }) - // ); - - // (SequencerInbox seqInbox, Bridge bridge) = deployRollup(false); - // // update the dummyEigenDAServiceManager to use the holesky serviceManager contract - // vm.prank(rollupOwner); - // seqInbox.updateEigenDAServiceManager(0xD4A7E1Bd8015057293f0D0A557088c286942e84b); - // address delayedInboxSender = address(140); - // uint8 delayedInboxKind = 3; - // bytes32 messageDataHash = RAND.Bytes32(); - - // vm.prank(dummyInbox); - // bridge.enqueueDelayedMessage(delayedInboxKind, delayedInboxSender, messageDataHash); - - // // ed is EIGEN_DA_MESSAGE_HEADER_FLAG rest is abi.encodePacked(blobHeader.commitment.X, blobHeader.commitment.Y, blobHeader.dataLength) - // bytes memory data = - // hex"ed1a78ee576b0026de661b72106bf447f5bb70881f24a3fa8b1f312992c8e165970633b392b3d3f66407d912aafcc2f0231c31918f0485e8476975edc710fcb45200000001"; - - // uint256 subMessageCount = bridge.sequencerReportedSubMessageCount(); - // uint256 sequenceNumber = bridge.sequencerMessageCount(); - // uint256 delayedMessagesRead = bridge.delayedMessageCount(); - - // expectEvents(bridge, seqInbox, data, false, false, true); - - // vm.prank(tx.origin); - - // seqInbox.addSequencerL2BatchFromEigenDA( - // sequenceNumber, - // blobVerificationProof, - // blobHeader, - // delayedMessagesRead, - // IGasRefunder(address(0)), - // subMessageCount, - // subMessageCount + 1 - // ); - // } - - // // TODO: put these in jsons later - // // create illegal commitment - // BN254.G1Point illegalCommitment = BN254.G1Point({ - // X: 11151623676041303181597631684634074376466382703418354161831688442589830350329, - // Y: 4222041728992406478862708226745479381252734858741080790666424175645694456140 - // }); - - // IEigenDAServiceManager.BlobHeader illegalBlobHeader; - - // IEigenDAServiceManager.BatchHeader illegalBatchHeader = IEigenDAServiceManager.BatchHeader({ - // blobHeadersRoot: bytes32(0), - // quorumNumbers: bytes(""), - // signedStakeForQuorums: bytes(""), - // referenceBlockNumber: 1 - // }); - - // IEigenDAServiceManager.BatchMetadata illegalBatchMetadata = IEigenDAServiceManager.BatchMetadata({ - // batchHeader: illegalBatchHeader, - // signatoryRecordHash: bytes32(0), - // confirmationBlockNumber: 1 - // }); - - // EigenDARollupUtils.BlobVerificationProof illegalBlobVerificationProof = EigenDARollupUtils - // .BlobVerificationProof({ - // batchId: 1, - // blobIndex: 1, - // batchMetadata: illegalBatchMetadata, - // inclusionProof: bytes(""), - // quorumIndices: bytes("") - // }); - - // function testAddSequencerL2BatchFromEigenDARevert() public { - // // finish filling out the illegalBlobHeader - // illegalBlobHeader.commitment = illegalCommitment; - // illegalBlobHeader.dataLength = 20; - // illegalBlobHeader.quorumBlobParams.push( - // IEigenDAServiceManager.QuorumBlobParam({ - // quorumNumber: uint8(1), - // adversaryThresholdPercentage: uint8(1), - // confirmationThresholdPercentage: uint8(1), - // chunkLength: uint32(1) - // }) - // ); - - // // change the eigenDAServiceManager to use the holesky testnet contract - // (SequencerInbox seqInbox, Bridge bridge) = deployRollup(false); - // address delayedInboxSender = address(140); - // uint8 delayedInboxKind = 3; - // bytes32 messageDataHash = RAND.Bytes32(); - // bytes memory data = biggerData; // 00 is BROTLI_MESSAGE_HEADER_FLAG - - // vm.prank(dummyInbox); - // bridge.enqueueDelayedMessage(delayedInboxKind, delayedInboxSender, messageDataHash); - - // uint256 subMessageCount = bridge.sequencerReportedSubMessageCount(); - // uint256 sequenceNumber = bridge.sequencerMessageCount(); - // uint256 delayedMessagesRead = bridge.delayedMessageCount(); - - // vm.prank(tx.origin); - - // vm.expectRevert(); - // seqInbox.addSequencerL2BatchFromEigenDA( - // sequenceNumber, - // illegalBlobVerificationProof, - // illegalBlobHeader, - // delayedMessagesRead, - // IGasRefunder(address(0)), - // subMessageCount, - // subMessageCount + 1 - // ); - // } + function testAddSequencerL2BatchFromEigenDA() public { + blobHeader.commitment = commitment; + blobHeader.dataLength = 1; + blobHeader.quorumBlobParams.push( + IEigenDAServiceManager.QuorumBlobParam({ + quorumNumber: 0, + adversaryThresholdPercentage: 33, + confirmationThresholdPercentage: 55, + chunkLength: 1 + }) + ); + blobHeader.quorumBlobParams.push( + IEigenDAServiceManager.QuorumBlobParam({ + quorumNumber: 1, + adversaryThresholdPercentage: 33, + confirmationThresholdPercentage: 55, + chunkLength: 1 + }) + ); + + (SequencerInbox seqInbox, Bridge bridge) = deployRollup(false); + // update the dummyEigenDAServiceManager to use the holesky serviceManager contract + vm.prank(rollupOwner); + seqInbox.setEigenDAServiceManager(0xD4A7E1Bd8015057293f0D0A557088c286942e84b); + address delayedInboxSender = address(140); + uint8 delayedInboxKind = 3; + bytes32 messageDataHash = RAND.Bytes32(); + + vm.prank(dummyInbox); + bridge.enqueueDelayedMessage(delayedInboxKind, delayedInboxSender, messageDataHash); + + // ed is EIGEN_DA_MESSAGE_HEADER_FLAG rest is abi.encodePacked(blobHeader.commitment.X, blobHeader.commitment.Y, blobHeader.dataLength) + bytes memory data = + hex"ed1a78ee576b0026de661b72106bf447f5bb70881f24a3fa8b1f312992c8e165970633b392b3d3f66407d912aafcc2f0231c31918f0485e8476975edc710fcb45200000001"; + + uint256 subMessageCount = bridge.sequencerReportedSubMessageCount(); + uint256 sequenceNumber = bridge.sequencerMessageCount(); + uint256 delayedMessagesRead = bridge.delayedMessageCount(); + + expectEvents(bridge, seqInbox, data, false, false, true); + + vm.prank(tx.origin); + + seqInbox.addSequencerL2BatchFromEigenDA( + sequenceNumber, + blobVerificationProof, + blobHeader, + delayedMessagesRead, + subMessageCount, + subMessageCount + 1 + ); + } + + // TODO: put these in jsons later + // create illegal commitment + BN254.G1Point illegalCommitment = BN254.G1Point({ + X: 11151623676041303181597631684634074376466382703418354161831688442589830350329, + Y: 4222041728992406478862708226745479381252734858741080790666424175645694456140 + }); + + IEigenDAServiceManager.BlobHeader illegalBlobHeader; + + IEigenDAServiceManager.BatchHeader illegalBatchHeader = IEigenDAServiceManager.BatchHeader({ + blobHeadersRoot: bytes32(0), + quorumNumbers: bytes(""), + signedStakeForQuorums: bytes(""), + referenceBlockNumber: 1 + }); + + IEigenDAServiceManager.BatchMetadata illegalBatchMetadata = IEigenDAServiceManager.BatchMetadata({ + batchHeader: illegalBatchHeader, + signatoryRecordHash: bytes32(0), + confirmationBlockNumber: 1 + }); + + EigenDARollupUtils.BlobVerificationProof illegalBlobVerificationProof = EigenDARollupUtils + .BlobVerificationProof({ + batchId: 1, + blobIndex: 1, + batchMetadata: illegalBatchMetadata, + inclusionProof: bytes(""), + quorumIndices: bytes("") + }); + + function testAddSequencerL2BatchFromEigenDARevert() public { + // finish filling out the illegalBlobHeader + illegalBlobHeader.commitment = illegalCommitment; + illegalBlobHeader.dataLength = 20; + illegalBlobHeader.quorumBlobParams.push( + IEigenDAServiceManager.QuorumBlobParam({ + quorumNumber: uint8(1), + adversaryThresholdPercentage: uint8(1), + confirmationThresholdPercentage: uint8(1), + chunkLength: uint32(1) + }) + ); + + // change the eigenDAServiceManager to use the holesky testnet contract + (SequencerInbox seqInbox, Bridge bridge) = deployRollup(false); + address delayedInboxSender = address(140); + uint8 delayedInboxKind = 3; + bytes32 messageDataHash = RAND.Bytes32(); + bytes memory data = biggerData; // 00 is BROTLI_MESSAGE_HEADER_FLAG + + vm.prank(dummyInbox); + bridge.enqueueDelayedMessage(delayedInboxKind, delayedInboxSender, messageDataHash); + + uint256 subMessageCount = bridge.sequencerReportedSubMessageCount(); + uint256 sequenceNumber = bridge.sequencerMessageCount(); + uint256 delayedMessagesRead = bridge.delayedMessageCount(); + + vm.prank(tx.origin); + + vm.expectRevert(); + seqInbox.addSequencerL2BatchFromEigenDA( + sequenceNumber, + illegalBlobVerificationProof, + illegalBlobHeader, + delayedMessagesRead, + subMessageCount, + subMessageCount + 1 + ); + } function testPostUpgradeInitAlreadyInit() public returns (SequencerInbox, SequencerInbox) { (SequencerInbox seqInbox,) = deployRollup(false); SequencerInbox seqInboxImpl = - new SequencerInbox(maxDataSize, dummyReader4844, dummyEigenDAServiceManager, rollupManager, false); + new SequencerInbox(maxDataSize, dummyReader4844, false); vm.expectRevert(abi.encodeWithSelector(AlreadyInit.selector)); vm.prank(proxyAdmin); From 7d788fdf7191ddf23ee24bd7b5c3134c73c1b3de Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Tue, 2 Jul 2024 22:37:54 -0400 Subject: [PATCH 5/8] fix tests, remove debug stmts, unecessary structs --- deploy/DummyRollupManagerCreator.js | 13 ----- src/bridge/RollupManager.sol | 74 +++-------------------------- src/bridge/SequencerInbox.sol | 13 ----- src/osp/OneStepProverHostIo.sol | 2 +- 4 files changed, 7 insertions(+), 95 deletions(-) delete mode 100644 deploy/DummyRollupManagerCreator.js diff --git a/deploy/DummyRollupManagerCreator.js b/deploy/DummyRollupManagerCreator.js deleted file mode 100644 index 264e1403..00000000 --- a/deploy/DummyRollupManagerCreator.js +++ /dev/null @@ -1,13 +0,0 @@ -module.exports = async hre => { - const { deployments, getNamedAccounts } = hre - const { deploy } = deployments - const { deployer } = await getNamedAccounts() - - await deploy('EigenDADummyManager', { - from: deployer, - args: [], - }) - } - - module.exports.tags = ['EigenDADummyManager'] - module.exports.dependencies = [] \ No newline at end of file diff --git a/src/bridge/RollupManager.sol b/src/bridge/RollupManager.sol index 347014e5..ea1bc7ea 100644 --- a/src/bridge/RollupManager.sol +++ b/src/bridge/RollupManager.sol @@ -13,72 +13,46 @@ import {IPaymentCoordinator} from "@eigenda/eigenda-utils/interfaces/IPaymentCoo import {ISignatureUtils} from "@eigenda/eigenda-utils/interfaces/ISignatureUtils.sol"; +// DummyServiceManager is a dummy implementation of IEigenDAServiceManager +// and is used in nitro-testnode to avoid the overhead of deploying core EigenDA contracts +// to simplify the testing process. contract DummyServiceManager is IEigenDAServiceManager { - // EVENTS - // CONSTRUCTOR constructor() { - // Constructor code can be added here if needed } - /// @notice mapping between the batchId to the hash of the metadata of the corresponding Batch function batchIdToBatchMetadataHash(uint32 batchId) external view override returns (bytes32) { - // Stubbed implementation return bytes32(0); } - - /** - * @notice This function is used for - * - submitting data availability certificates, - * - check that the aggregate signature is valid, - * - and check whether quorum has been achieved or not. - */ function confirmBatch( BatchHeader calldata batchHeader, IBLSSignatureChecker.NonSignerStakesAndSignature memory nonSignerStakesAndSignature ) external override { - // Stubbed implementation } - /// @notice This function is used for changing the batch confirmer function setBatchConfirmer(address _batchConfirmer) external override { - // Stubbed implementation } - /// @notice Returns the current batchId function taskNumber() external view override returns (uint32) { - // Stubbed implementation return 0; } - - /// @notice Given a reference block number, returns the block until which operators must serve. function latestServeUntilBlock(uint32 referenceBlockNumber) external view override returns (uint32) { - // Stubbed implementation return 0; } - - /// @notice The maximum amount of blocks in the past that the service will consider stake amounts to still be 'valid'. function BLOCK_STALE_MEASURE() external view override returns (uint32) { - // Stubbed implementation return 0; } - /// @notice Returns the bytes array of quorumAdversaryThresholdPercentages function quorumAdversaryThresholdPercentages() external view override returns (bytes memory) { - // Stubbed implementation return ""; } - /// @notice Returns the bytes array of quorumAdversaryThresholdPercentages function quorumConfirmationThresholdPercentages() external view override returns (bytes memory) { - // Stubbed implementation return ""; } - /// @notice Returns the bytes array of quorumsNumbersRequired function quorumNumbersRequired() external view override returns (bytes memory) { - // Stubbed implementation return ""; } @@ -90,11 +64,6 @@ contract DummyServiceManager is IEigenDAServiceManager { return; } - /** - * @notice Forwards a call to EigenLayer's DelegationManager contract to confirm operator registration with the AVS - * @param operator The address of the operator to register. - * @param operatorSignature The signature, salt, and expiry of the operator's signature. - */ function registerOperatorToAVS( address operator, ISignatureUtils.SignatureWithSaltAndExpiry memory operatorSignature @@ -102,21 +71,10 @@ contract DummyServiceManager is IEigenDAServiceManager { return; } - /** - * @notice Forwards a call to EigenLayer's DelegationManager contract to confirm operator deregistration from the AVS - * @param operator The address of the operator to deregister. - */ function deregisterOperatorFromAVS(address operator) external override { return; } - /** - * @notice Returns the list of strategies that the operator has potentially restaked on the AVS - * @param operator The address of the operator to get restaked strategies for - * @dev This function is intended to be called off-chain - * @dev No guarantee is made on whether the operator has shares for a strategy in a quorum or uniqueness - * of each element in the returned array. The off-chain service should do that validation separately - */ function getOperatorRestakedStrategies(address operator) external view override returns (address[] memory){ address[] memory dummyAddresses = new address[](2); dummyAddresses[0] = 0x0000000000000000000000000000000000000001; @@ -124,12 +82,6 @@ contract DummyServiceManager is IEigenDAServiceManager { return dummyAddresses; } - /** - * @notice Returns the list of strategies that the AVS supports for restaking - * @dev This function is intended to be called off-chain - * @dev No guarantee is made on uniqueness of each element in the returned array. - * The off-chain service should do that validation separately - */ function getRestakeableStrategies() external view override returns (address[] memory) { address[] memory dummyAddresses = new address[](2); dummyAddresses[0] = 0x0000000000000000000000000000000000000001; @@ -137,7 +89,6 @@ contract DummyServiceManager is IEigenDAServiceManager { return dummyAddresses; } - /// @notice Returns the EigenLayer AVSDirectory contract. function avsDirectory() external view returns (address) { address x = 0x0000000000000000000000000000000000000001; return x; @@ -147,21 +98,6 @@ contract DummyServiceManager is IEigenDAServiceManager { interface IRollupManager { - struct ProofMetadata { - uint32 batchID; - uint32 blobIndex; - bytes32 signatoryRecordHash; - uint32 confirmationBlockNumber; - bytes inclusionProof; - bytes quorumIndices; - } - - struct SequenceMetadata { - uint256 afterDelayedMessagesRead; - uint256 prevMessageCount; - uint256 newMessageCount; - } - function verifyBlob( IEigenDAServiceManager.BlobHeader calldata blobHeader, IEigenDAServiceManager eigenDAServiceManager, @@ -178,7 +114,9 @@ interface IRollupManager { } - +// 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( diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index bd3092c0..90014f6a 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -497,19 +497,6 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox revert BadSequencerNumber(seqMessageIndex, sequenceNumber_); } - /* - emit SequencerBatchDelivered( - seqMessageIndex, - beforeAcc, - afterAcc, - delayedAcc, - totalDelayedMessagesRead, - timeBounds, - IBridge.BatchDataLocation.EigenDA - ); - - */ - emit SequencerBatchDelivered( seqMessageIndex, beforeAcc, diff --git a/src/osp/OneStepProverHostIo.sol b/src/osp/OneStepProverHostIo.sol index 9e4cf46a..579f9084 100644 --- a/src/osp/OneStepProverHostIo.sol +++ b/src/osp/OneStepProverHostIo.sol @@ -243,7 +243,7 @@ contract OneStepProverHostIo is IOneStepProver { } else if (inst.argumentData == 3) { // The machine is asking for a EigenDA versioned hash preimage - require(proofType == 0, "UNKNOWN_PREIMAGE_PROOF"); + require(proofType == 1, "UNKNOWN_PREIMAGE_PROOF"); bytes calldata kzgProof = proof[proofOffset:]; From 2946c01a9032be24b2436f6ab7c3e985fd705dc0 Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Wed, 3 Jul 2024 18:17:51 -0400 Subject: [PATCH 6/8] update SequencerInbox stub --- deploy/SequencerInboxStubCreator.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/deploy/SequencerInboxStubCreator.js b/deploy/SequencerInboxStubCreator.js index 1a107a62..e5c46ea9 100644 --- a/deploy/SequencerInboxStubCreator.js +++ b/deploy/SequencerInboxStubCreator.js @@ -26,8 +26,6 @@ module.exports = async hre => { maxTime, 117964, reader4844.address, - dummyManager.address, - dummyManager.address, false, ], }) From 657a0885e9a171df902b60737aaf573a30b221cf Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Thu, 4 Jul 2024 16:11:20 -0400 Subject: [PATCH 7/8] remove dummyManager artifact --- deploy/SequencerInboxStubCreator.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/deploy/SequencerInboxStubCreator.js b/deploy/SequencerInboxStubCreator.js index e5c46ea9..495263c9 100644 --- a/deploy/SequencerInboxStubCreator.js +++ b/deploy/SequencerInboxStubCreator.js @@ -16,8 +16,6 @@ module.exports = async hre => { futureSeconds: 10000, } - const dummyManager = await ethers.getContract('EigenDADummyManager') - await deploy('SequencerInboxStub', { from: deployer, args: [ @@ -32,4 +30,4 @@ module.exports = async hre => { } module.exports.tags = ['SequencerInboxStub', 'test'] -module.exports.dependencies = ['BridgeStub', 'EigenDADummyManager'] +module.exports.dependencies = ['BridgeStub'] From 2a561f88513b1473bd333dbc88f9b11c21df35be Mon Sep 17 00:00:00 2001 From: Ethen Pociask Date: Thu, 4 Jul 2024 16:40:06 -0400 Subject: [PATCH 8/8] fix one step prover --- src/osp/OneStepProverHostIo.sol | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/osp/OneStepProverHostIo.sol b/src/osp/OneStepProverHostIo.sol index 579f9084..72e5c077 100644 --- a/src/osp/OneStepProverHostIo.sol +++ b/src/osp/OneStepProverHostIo.sol @@ -243,7 +243,7 @@ contract OneStepProverHostIo is IOneStepProver { } else if (inst.argumentData == 3) { // The machine is asking for a EigenDA versioned hash preimage - require(proofType == 1, "UNKNOWN_PREIMAGE_PROOF"); + require(proofType == 0, "UNKNOWN_EIGENDA_PREIMAGE_PROOF"); bytes calldata kzgProof = proof[proofOffset:];