diff --git a/.github/workflows/contract-tests.yml b/.github/workflows/contract-tests.yml index 5637607f..afd31ba1 100644 --- a/.github/workflows/contract-tests.yml +++ b/.github/workflows/contract-tests.yml @@ -21,7 +21,7 @@ jobs: - name: Install Foundry uses: foundry-rs/foundry-toolchain@v1 with: - version: nightly + version: nightly-5b7e4cb3c882b28f3c32ba580de27ce7381f415a - name: Setup node/yarn uses: actions/setup-node@v3 @@ -34,7 +34,7 @@ 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 diff --git a/foundry.toml b/foundry.toml index b37100ba..124f0678 100644 --- a/foundry.toml +++ b/foundry.toml @@ -8,6 +8,7 @@ optimizer = true optimizer_runs = 100 via_ir = false solc_version = '0.8.12' +fs_permissions = [{ access = "read", path = "./"}] [profile.yul] src = 'yul' diff --git a/package.json b/package.json index 4e3cf233..8cc1a9ec 100644 --- a/package.json +++ b/package.json @@ -41,14 +41,18 @@ "postinstall": "patch-package", "deploy-factory": "hardhat run scripts/deployment.ts", "deploy-eth-rollup": "hardhat run scripts/createEthRollup.ts", - "deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts" + "deploy-erc20-rollup": "hardhat run scripts/createERC20Rollup.ts", + "deploy-blob": "yarn ts-node scripts/disperseBlob.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/contracts-upgradeable@4.7", "@openzeppelin/contracts": "4.7", "@openzeppelin/contracts-upgradeable": "4.7", + "google-protobuf": "^3.21.2", "patch-package": "^6.4.7" }, "private": false, @@ -62,6 +66,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", diff --git a/src/bridge/ISequencerInbox.sol b/src/bridge/ISequencerInbox.sol index 33a6861d..43279dcb 100644 --- a/src/bridge/ISequencerInbox.sol +++ b/src/bridge/ISequencerInbox.sol @@ -257,10 +257,8 @@ 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; // ---------- initializer ---------- diff --git a/src/bridge/SequencerInbox.sol b/src/bridge/SequencerInbox.sol index a048b949..bd3092c0 100644 --- a/src/bridge/SequencerInbox.sol +++ b/src/bridge/SequencerInbox.sol @@ -50,6 +50,7 @@ import {IERC20Bridge} from "./IERC20Bridge.sol"; import {IRollupManager} from "./RollupManager.sol"; import {IEigenDAServiceManager} from "@eigenda/eigenda-utils/interfaces/IEigenDAServiceManager.sol"; + /** * @title Accepts batches from the sequencer and adds them to the rollup inbox. * @notice Contains the inbox accumulator which is the ordering of all data and transactions to be processed by the rollup. @@ -62,6 +63,9 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox IBridge public bridge; + address public eigenDAServiceManager; + address public eigenDARollupManager; + /// @inheritdoc ISequencerInbox uint256 public constant HEADER_LENGTH = 40; @@ -133,9 +137,6 @@ 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_, @@ -424,6 +425,7 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox // verify that the blob was actually included before continuing 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 // batch header hash -> can get by computing hash(blobVerificationproof.batchMetadata.batchheader) @@ -815,6 +817,15 @@ contract SequencerInbox is DelegateCallAware, GasRefundEnabled, ISequencerInbox emit OwnerFunctionCalled(8); } + /// @notice Allows the rollup owner to sync the rollup address + function updateRollupAddress() external { + if (msg.sender != IOwnable(rollup).owner()) + revert NotOwner(msg.sender, IOwnable(rollup).owner()); + IOwnable newRollup = bridge.rollup(); + if (rollup == newRollup) revert RollupNotChanged(); + rollup = newRollup; + } + function isValidKeysetHash(bytes32 ksHash) external view returns (bool) { return dasKeySetInfo[ksHash].isValidKeyset; } diff --git a/test/foundry/BridgeCreator.t.sol b/test/foundry/BridgeCreator.t.sol index 18da6e53..0f270034 100644 --- a/test/foundry/BridgeCreator.t.sol +++ b/test/foundry/BridgeCreator.t.sol @@ -20,7 +20,7 @@ contract BridgeCreatorTest is Test { BridgeCreator.BridgeContracts ethBasedTemplates = BridgeCreator.BridgeContracts({ bridge: new Bridge(), - sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, false), + sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, false), inbox: new Inbox(MAX_DATA_SIZE), rollupEventInbox: new RollupEventInbox(), outbox: new Outbox() @@ -28,7 +28,7 @@ contract BridgeCreatorTest is Test { BridgeCreator.BridgeContracts erc20BasedTemplates = BridgeCreator.BridgeContracts({ bridge: new ERC20Bridge(), - sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, true), + sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, true), inbox: new ERC20Inbox(MAX_DATA_SIZE), rollupEventInbox: new ERC20RollupEventInbox(), outbox: new ERC20Outbox() diff --git a/test/foundry/ERC20Outbox.t.sol b/test/foundry/ERC20Outbox.t.sol index f97e96be..165d1657 100644 --- a/test/foundry/ERC20Outbox.t.sol +++ b/test/foundry/ERC20Outbox.t.sol @@ -14,7 +14,13 @@ contract ERC20OutboxTest is AbsOutboxTest { function setUp() public { // deploy token, bridge and outbox - nativeToken = new ERC20PresetFixedSupply("Appchain Token", "App", 1_000_000, address(this)); + + // hardcoded proof in tests assume that this contract is deployed at the repsective address + IERC20 nativeTokenCode = new ERC20PresetFixedSupply("Appchain Token", "App", 1_000_000, address(this)); + nativeToken = IERC20(0xFEfC6BAF87cF3684058D62Da40Ff3A795946Ab06); + vm.etch(address(nativeToken), address(nativeTokenCode).code); + deal(address(nativeToken), address(this), 1_000_000); + bridge = IBridge(TestUtil.deployProxy(address(new ERC20Bridge()))); erc20Bridge = ERC20Bridge(address(bridge)); outbox = IOutbox(TestUtil.deployProxy(address(new ERC20Outbox()))); @@ -51,7 +57,10 @@ contract ERC20OutboxTest is AbsOutboxTest { ); // create msg receiver on L1 - ERC20L2ToL1Target target = new ERC20L2ToL1Target(); + // hardcoded proof in tests assume that this contract is deployed at the repsective address + ERC20L2ToL1Target targetCode = new ERC20L2ToL1Target(); + ERC20L2ToL1Target target = ERC20L2ToL1Target(0x87B2d08110B7D50861141D7bBDd49326af3Ecb31); + vm.etch(address(target), address(targetCode).code); target.setOutbox(address(outbox)); //// execute transaction diff --git a/test/foundry/RollupCreator.t.sol b/test/foundry/RollupCreator.t.sol index 8bf9f10f..fd77054f 100644 --- a/test/foundry/RollupCreator.t.sol +++ b/test/foundry/RollupCreator.t.sol @@ -38,7 +38,7 @@ contract RollupCreatorTest is Test { BridgeCreator.BridgeContracts public ethBasedTemplates = BridgeCreator.BridgeContracts({ bridge: new Bridge(), - sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, false), + sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, false), inbox: new Inbox(MAX_DATA_SIZE), rollupEventInbox: new RollupEventInbox(), outbox: new Outbox() @@ -46,7 +46,7 @@ contract RollupCreatorTest is Test { BridgeCreator.BridgeContracts public erc20BasedTemplates = BridgeCreator.BridgeContracts({ bridge: new ERC20Bridge(), - sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, dummyEigenDAServiceManager, rollupManager, true), + sequencerInbox: new SequencerInbox(MAX_DATA_SIZE, dummyReader4844, true), inbox: new ERC20Inbox(MAX_DATA_SIZE), rollupEventInbox: new ERC20RollupEventInbox(), outbox: new ERC20Outbox() @@ -126,18 +126,23 @@ contract RollupCreatorTest is Test { address[] memory validators = new address[](2); validators[0] = makeAddr("validator1"); validators[1] = makeAddr("validator2"); - - RollupCreator.RollupDeploymentParams memory deployParams = RollupCreator - .RollupDeploymentParams({ - config: config, - batchPosters: batchPosters, - validators: validators, - maxDataSize: MAX_DATA_SIZE, - nativeToken: address(0), - deployFactoriesToL2: true, - maxFeePerGasForRetryables: MAX_FEE_PER_GAS, - batchPosterManager: batchPosterManager - }); + + address eigenDASvcManager = makeAddr("eigenDASvcManager"); + address eigenDARollupManager = makeAddr("rollupManager"); + + RollupCreator.RollupDeploymentParams memory deployParams = RollupCreator.RollupDeploymentParams({ + config: config, + batchPosters: batchPosters, + validators: validators, + maxDataSize: MAX_DATA_SIZE, + nativeToken: address(0), + deployFactoriesToL2: true, + maxFeePerGasForRetryables: MAX_FEE_PER_GAS, + batchPosterManager: batchPosterManager, + eigenDAServiceManager: eigenDASvcManager, + eigenDARollupManager: eigenDARollupManager + }); + address rollupAddress = rollupCreator.createRollup{value: factoryDeploymentFunds}( deployParams ); @@ -283,6 +288,9 @@ contract RollupCreatorTest is Test { validators[0] = makeAddr("validator1"); validators[1] = makeAddr("validator2"); + address eigenDASvcManager = makeAddr("eigenDASvcManager"); + address eigenDARollupManager = makeAddr("rollupManager"); + RollupCreator.RollupDeploymentParams memory deployParams = RollupCreator .RollupDeploymentParams({ config: config, @@ -292,7 +300,9 @@ contract RollupCreatorTest is Test { nativeToken: nativeToken, deployFactoriesToL2: true, maxFeePerGasForRetryables: MAX_FEE_PER_GAS, - batchPosterManager: batchPosterManager + batchPosterManager: batchPosterManager, + eigenDAServiceManager: eigenDASvcManager, + eigenDARollupManager: eigenDARollupManager }); address rollupAddress = rollupCreator.createRollup(deployParams); @@ -435,6 +445,8 @@ contract RollupCreatorTest is Test { address[] memory validators = new address[](2); validators[0] = makeAddr("validator1"); validators[1] = makeAddr("validator2"); + address eigenDASvcManager = makeAddr("eigenDASvcManager"); + address eigenDARollupManager = makeAddr("rollupManager"); RollupCreator.RollupDeploymentParams memory deployParams = RollupCreator .RollupDeploymentParams({ @@ -445,7 +457,9 @@ contract RollupCreatorTest is Test { nativeToken: address(0), deployFactoriesToL2: true, maxFeePerGasForRetryables: MAX_FEE_PER_GAS, - batchPosterManager: batchPosterManager + batchPosterManager: batchPosterManager, + eigenDAServiceManager: eigenDASvcManager, + eigenDARollupManager: eigenDARollupManager }); address rollupAddress = rollupCreator.createRollup{value: factoryDeploymentFunds}( deployParams diff --git a/test/foundry/SequencerInbox.t.sol b/test/foundry/SequencerInbox.t.sol index ae993a6e..8c6e4fba 100644 --- a/test/foundry/SequencerInbox.t.sol +++ b/test/foundry/SequencerInbox.t.sol @@ -10,6 +10,7 @@ import "@openzeppelin/contracts/token/ERC20/presets/ERC20PresetMinterPauser.sol" import {EigenDARollupUtils} from "@eigenda/eigenda-utils/libraries/EigenDARollupUtils.sol"; import {IEigenDAServiceManager} from "@eigenda/eigenda-utils/interfaces/IEigenDAServiceManager.sol"; +import {IRollupManager, EigenDADummyManager} from "../../src/bridge/RollupManager.sol"; import {BN254} from "@eigenda/eigenda-utils/libraries/BN254.sol"; contract RollupMock { @@ -109,7 +110,7 @@ contract SequencerInboxTest is Test { abi.encode(uint256(11)) ); SequencerInbox seqInboxImpl = new SequencerInbox( - maxDataSize, IReader4844(address(0)), dummyEigenDAServiceManager, rollupManager, true + maxDataSize, IReader4844(address(0)), true ); SequencerInbox seqInbox = SequencerInbox( address(new TransparentUpgradeableProxy(address(seqInboxImpl), proxyAdmin, "")) @@ -588,65 +589,19 @@ contract SequencerInboxTest is Test { ); } - // TODO: put these in jsons later - // grpcurl \ - // -import-path ./api/proto \ - // -proto ./api/proto/disperser/disperser.proto \ - // -d '{"request_id": "NmQ2ODZiOWY4YzcwOGQ0YjhhNDJiN2FiOGRjYmI2MDAzOTk2NDk4NTU5Nzk0OWZkNjQ3ZGE4N2I2NDViZGUxNS0zMTM3MzEzMjM4MzQzNTMyMzgzNjMzMzkzODM5MzYzOTM3MzMzNDJmMzAyZjMzMzMyZjMxMmYzMzMzMmZlM2IwYzQ0Mjk4ZmMxYzE0OWFmYmY0Yzg5OTZmYjkyNDI3YWU0MWU0NjQ5YjkzNGNhNDk1OTkxYjc4NTJiODU1"}' \ - // disperser-holesky.eigenda.xyz:443 disperser.Disperser/GetBlobStatus - BN254.G1Point commitment = BN254.G1Point({ - X: 11973800683352706081745043032492841023821816921595457420358142752350183450007, - Y: 2805225659489681354691976220137232537594717765057043399317547797368322962514 - }); - - IEigenDAServiceManager.BlobHeader blobHeader; - - IEigenDAServiceManager.BatchHeader batchHeader = IEigenDAServiceManager.BatchHeader({ - blobHeadersRoot: 0x2f3d0afe00f1a3eccb2a77a053c9fa850d4809913ece2f6a5dcdc9ecb5347c8b, - quorumNumbers: hex"0001", - signedStakeForQuorums: hex"4d4f", // quorum_signed_percentages - referenceBlockNumber: 1325741 - }); - - IEigenDAServiceManager.BatchMetadata batchMetadata = IEigenDAServiceManager.BatchMetadata({ - batchHeader: batchHeader, - signatoryRecordHash: 0x9c2295a45e69a5369008e65fa2afc40eccb8e8be2f453998207e9b0a8d3bc72b, - confirmationBlockNumber: 1325845 - }); - - EigenDARollupUtils.BlobVerificationProof blobVerificationProof = EigenDARollupUtils - .BlobVerificationProof({ - batchId: 9869, - blobIndex: 570, - batchMetadata: batchMetadata, - inclusionProof: hex"86d042bea74e8fc60ce55410490d2e8bf312ff03aca9d369296d8cb25cd622096d79ebf24023971807ca680bfeac081bca250544e65147ffc0f7fdd3f3f973b885c252331c8385b767138702b5ba6155ae518fd98ebb966c5d2dfc2364ee0d49c203f38ebd01f85755bd59903ad850ea040fb94611fd554deb03c35ce43453f616866b1248350c1f1af7f3ce0f9b1beb712de850ce4e9cdfee6073fd54b8bca69011c9eca7800d59e6831f055972ae7430b8b52423cf455c2e0a3b11343890c713b16d87b5458476d589dd0f2146b14b9380f69aa8b1b546c75de4bfe925167204dd92138a76c02a4854973ed7016c6c110d41563acbc8cafefbe5d2f0ff490a83cd05a84bdfdd1542ebbbf20ca8b8968407a993919ffe5e159faf5941a95ae878a69d797b170a7a375d88b92c000c70871ae9ed5042f481743a27e97cf8665e8ebdea8f3dc226cc4c9a1cf3863ab4e60900a600fbfe5381cc0912f7aab88686", - 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 - }) - ); + EigenDADummyManager rollupManagerImpl = new EigenDADummyManager(); (SequencerInbox seqInbox, Bridge bridge) = deployRollup(false); // update the dummyEigenDAServiceManager to use the holesky serviceManager contract - vm.prank(rollupOwner); + + vm.startPrank(rollupOwner); + // deploy rollup + seqInbox.setEigenDARollupManager(address(rollupManagerImpl)); seqInbox.setEigenDAServiceManager(0xD4A7E1Bd8015057293f0D0A557088c286942e84b); + vm.stopPrank(); + address delayedInboxSender = address(140); uint8 delayedInboxKind = 3; bytes32 messageDataHash = RAND.Bytes32(); @@ -654,9 +609,11 @@ contract SequencerInboxTest is Test { vm.prank(dummyInbox); bridge.enqueueDelayedMessage(delayedInboxKind, delayedInboxSender, messageDataHash); + (IEigenDAServiceManager.BlobHeader memory blobHeader, EigenDARollupUtils.BlobVerificationProof memory blobVerificationProof) = readAndParseBlobInfo(); + // ed is EIGEN_DA_MESSAGE_HEADER_FLAG rest is abi.encodePacked(blobHeader.commitment.X, blobHeader.commitment.Y, blobHeader.dataLength) bytes memory data = - hex"ed1a78ee576b0026de661b72106bf447f5bb70881f24a3fa8b1f312992c8e165970633b392b3d3f66407d912aafcc2f0231c31918f0485e8476975edc710fcb45200000001"; + abi.encodePacked(hex"ed", blobHeader.commitment.X, blobHeader.commitment.Y, blobHeader.dataLength); uint256 subMessageCount = bridge.sequencerReportedSubMessageCount(); uint256 sequenceNumber = bridge.sequencerMessageCount(); @@ -707,7 +664,7 @@ contract SequencerInboxTest is Test { quorumIndices: bytes("") }); - function testAddSequencerL2BatchFromEigenDARevert() public { + function testAddSequencerL2BatchFrom() public { // finish filling out the illegalBlobHeader illegalBlobHeader.commitment = illegalCommitment; illegalBlobHeader.dataLength = 20; @@ -777,10 +734,10 @@ contract SequencerInboxTest is Test { ); // IMPORTANT: slots have moved down by one because we have added additional variables for eigenDA - vm.store(address(seqInbox), bytes32(uint256(5)), bytes32(uint256(delayBlocks))); // slot 5: delayBlocks - vm.store(address(seqInbox), bytes32(uint256(6)), bytes32(uint256(futureBlocks))); // slot 6: futureBlocks - vm.store(address(seqInbox), bytes32(uint256(7)), bytes32(uint256(delaySeconds))); // slot 7: delaySeconds - vm.store(address(seqInbox), bytes32(uint256(8)), bytes32(uint256(futureSeconds))); // slot 8: futureSeconds + vm.store(address(seqInbox), bytes32(uint256(6)), bytes32(uint256(delayBlocks))); // slot 6: delayBlocks + vm.store(address(seqInbox), bytes32(uint256(7)), bytes32(uint256(futureBlocks))); // slot 7: futureBlocks + vm.store(address(seqInbox), bytes32(uint256(8)), bytes32(uint256(delaySeconds))); // slot 8: delaySeconds + vm.store(address(seqInbox), bytes32(uint256(9)), bytes32(uint256(futureSeconds))); // slot 9: futureSeconds vm.prank(proxyAdmin); TransparentUpgradeableProxy(payable(address(seqInbox))).upgradeToAndCall( address(seqInboxImpl), abi.encodeWithSelector(SequencerInbox.postUpgradeInit.selector) @@ -868,4 +825,67 @@ contract SequencerInboxTest is Test { }) ); } + + function readAndParseBlobInfo() public returns (IEigenDAServiceManager.BlobHeader memory, EigenDARollupUtils.BlobVerificationProof memory) { + string memory json = vm.readFile("test/foundry/blobInfo/blobInfo.json"); + + // parse the blob header + + IEigenDAServiceManager.BlobHeader memory blobHeader; + + BN254.G1Point memory commitment = BN254.G1Point({ + X: uint256(vm.parseJsonInt(json, ".blob_info.blob_header.commitment.x")), + Y: uint256(vm.parseJsonInt(json, ".blob_info.blob_header.commitment.y")) + }); + + blobHeader.commitment = commitment; + blobHeader.dataLength = uint32(uint256(vm.parseJsonInt(json, ".blob_info.blob_header.data_length"))); + + //bytes memory quorumParamsBytes = vm.parseJson(json, ".blob_info.blob_header.blob_quorum_params"); + + // TODO: Parse these from the array, for some reason parsing them reads in the wrong order + IEigenDAServiceManager.QuorumBlobParam[] memory quorumParams = new IEigenDAServiceManager.QuorumBlobParam[](2); + + quorumParams[0].quorumNumber = 0; + quorumParams[0].adversaryThresholdPercentage = 33; + quorumParams[0].confirmationThresholdPercentage = 55; + quorumParams[0].chunkLength = 1; + + quorumParams[1].quorumNumber = 1; + quorumParams[1].adversaryThresholdPercentage = 33; + quorumParams[1].confirmationThresholdPercentage = 55; + quorumParams[1].chunkLength = 1; + + blobHeader.quorumBlobParams = quorumParams; + + + // parse the blob verification proof + + IEigenDAServiceManager.BatchHeader memory batchHeader = IEigenDAServiceManager.BatchHeader({ + blobHeadersRoot: vm.parseJsonBytes32(json, ".blob_info.blob_verification_proof.batch_metadata.batch_header.batch_root"), + quorumNumbers: vm.parseJsonBytes(json, ".blob_info.blob_verification_proof.batch_metadata.batch_header.quorum_numbers"), + signedStakeForQuorums: vm.parseJsonBytes(json, ".blob_info.blob_verification_proof.batch_metadata.batch_header.quorum_signed_percentages"), + referenceBlockNumber: uint32(uint256(vm.parseJsonUint(json, ".blob_info.blob_verification_proof.batch_metadata.batch_header.reference_block_number"))) + }); + + IEigenDAServiceManager.BatchMetadata memory batchMetadata = IEigenDAServiceManager.BatchMetadata({ + batchHeader: batchHeader, + signatoryRecordHash: vm.parseJsonBytes32(json, ".blob_info.blob_verification_proof.batch_metadata.signatory_record_hash"), + confirmationBlockNumber: uint32(uint256(vm.parseJsonUint(json, ".blob_info.blob_verification_proof.batch_metadata.confirmation_block_number"))) + }); + + EigenDARollupUtils.BlobVerificationProof memory blobVerificationProof = EigenDARollupUtils + .BlobVerificationProof({ + batchId: uint32(uint256(vm.parseJsonUint(json, ".blob_info.blob_verification_proof.batch_id"))), + blobIndex: uint32(uint256(vm.parseJsonUint(json, ".blob_info.blob_verification_proof.blob_index"))), + batchMetadata: batchMetadata, + inclusionProof: vm.parseJsonBytes(json, ".blob_info.blob_verification_proof.inclusion_proof"), + quorumIndices: vm.parseJsonBytes(json, ".blob_info.blob_verification_proof.quorum_indexes") + }); + console.logBytes32(keccak256(abi.encode(blobHeader))); + return (blobHeader, blobVerificationProof); + + } + + } diff --git a/test/foundry/blobInfo/blobInfo.json b/test/foundry/blobInfo/blobInfo.json new file mode 100644 index 00000000..e45fdd28 --- /dev/null +++ b/test/foundry/blobInfo/blobInfo.json @@ -0,0 +1,44 @@ +{ + "request_id": "316638323561613266303032306566376366393164666133306461343636386437393163356434383234666338653431333534623839656330353739356162332d33313337333133393335333233373333333633303336333133363333333533303330333133363266333032663333333332663331326633333333326665336230633434323938666331633134396166626634633839393666623932343237616534316534363439623933346361343935393931623738353262383535", + "blob_info": { + "blob_header": { + "commitment": { + "x": "0x2569a1994232d43b210e860d876c0bbc8d7f22dc0b8ae17d4c369ce7c2d33c26", + "y": "0x14f8198412fea43aaeb4a5355600d0fe3f175ea2f5d7246a7c6472c453fcde53" + }, + "data_length": 1, + "blob_quorum_params": [ + { + "quorum_number": 0, + "adversary_threshold_percentage": 33, + "confirmation_threshold_percentage": 55, + "chunk_length": 1 + }, + { + "quorum_number": 1, + "adversary_threshold_percentage": 33, + "confirmation_threshold_percentage": 55, + "chunk_length": 1 + } + ] + }, + "blob_verification_proof": { + "batch_id": 21103, + "blob_index": 1905, + "batch_metadata": { + "batch_header": { + "batch_root": "d627b55c1f307c37d0543562cdb2e1faf907dd98c1e5f94be62785ac30cca851", + "quorum_numbers": "0001", + "quorum_signed_percentages": "6362", + "reference_block_number": 1820787 + }, + "signatory_record_hash": "390703dea190bab4fc41037a72055dfe8ad3df2cf359a15dca3ebe601c4a0bd9", + "fee": "00", + "confirmation_block_number": 1820926, + "batch_header_hash": "f38003c8fed893238c3e8712efe1149333ed86a163fffdb77c98595fa76454aa" + }, + "inclusion_proof": "75ad90fbbde05f97f78dd7908f85a45c4e851cc29b796b70f78cf704a6e32815089c0d4db7fafbb64881a16d7f85e0e8c87129295a31a33e496cde48b1d08c8355754e58189833af2acd177159cd5f433420f335089f657643b85bef9d5701972354f1d752a9d31fce3ca7773c341b8aa729c88a2b3a2bb678c166f563b33f622c587b69c2ec92c998385010f08dc4170a08747c42e23ef429b67cf505a471d0eed3f79adb6a4d781e242ff800c29214f8fbf4f57d7d57ea48082f54e52d7f759afd178572e6986ba7ef6e9050184332eebd04cec473279188ae2a0f780d2ed69a0b17cfa3962bc09162db8b469ae8a38e3db31042338457f765c77f6b28cdd7e14df7b2c40f27f32bd7d4907816fb2655e06414a5b180ade4ebe295662c007428e2141faccaee62f177305df72d1f3b0f8dfc90235272f9a741af4eae6af6dc7bce2ce5f9c820c78fe436beaeef9b6734702cfc3d7863fac39ed52dc3061a1cf4f895c0797e6aff0a6076044102b00663e5e74f5ec53e4621312b98f4c74a7e", + "quorum_indexes": "0001" + } + } +} \ No newline at end of file diff --git a/yarn.lock b/yarn.lock index 8cd61d15..50c6fa22 100644 --- a/yarn.lock +++ b/yarn.lock @@ -855,6 +855,24 @@ optionalDependencies: "@trufflesuite/bigint-buffer" "1.1.9" +"@grpc/grpc-js@^1.8.22": + version "1.8.22" + resolved "https://registry.yarnpkg.com/@grpc/grpc-js/-/grpc-js-1.8.22.tgz#847930c9af46e14df05b57fc12325db140ceff1d" + integrity sha512-oAjDdN7fzbUi+4hZjKG96MR6KTEubAeMpQEb+77qy+3r0Ua5xTFuie6JOLr4ZZgl5g+W5/uRTS2M1V8mVAFPuA== + dependencies: + "@grpc/proto-loader" "^0.7.0" + "@types/node" ">=12.12.47" + +"@grpc/proto-loader@^0.7.0", "@grpc/proto-loader@^0.7.13": + version "0.7.13" + resolved "https://registry.yarnpkg.com/@grpc/proto-loader/-/proto-loader-0.7.13.tgz#f6a44b2b7c9f7b609f5748c6eac2d420e37670cf" + integrity sha512-AiXO/bfe9bmxBjxxtYxFAXGZvMaN5s8kO+jBHAJCON8rJoB5YS/D6X7ZNc6XQkuHNmyl4CYaMI1fJ/Gn27RGGw== + dependencies: + lodash.camelcase "^4.3.0" + long "^5.0.0" + protobufjs "^7.2.5" + yargs "^17.7.2" + "@humanwhocodes/config-array@^0.10.4": version "0.10.4" resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.10.4.tgz#01e7366e57d2ad104feea63e72248f22015c520c" @@ -1204,6 +1222,59 @@ resolved "https://registry.yarnpkg.com/@openzeppelin/contracts/-/contracts-4.7.3.tgz#939534757a81f8d69cc854c7692805684ff3111e" integrity sha512-dGRS0agJzu8ybo44pCIf3xBaPQN/65AIXNgK8+4gzKd5kbvlqyxryUYVLJv7fK98Seyd2hDZzVEHSWAh0Bt1Yw== +"@protobufjs/aspromise@^1.1.1", "@protobufjs/aspromise@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/aspromise/-/aspromise-1.1.2.tgz#9b8b0cc663d669a7d8f6f5d0893a14d348f30fbf" + integrity sha512-j+gKExEuLmKwvz3OgROXtrJ2UG2x8Ch2YZUxahh+s1F2HZ+wAceUNLkvy6zKCPVRkU++ZWQrdxsUeQXmcg4uoQ== + +"@protobufjs/base64@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/base64/-/base64-1.1.2.tgz#4c85730e59b9a1f1f349047dbf24296034bb2735" + integrity sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg== + +"@protobufjs/codegen@^2.0.4": + version "2.0.4" + resolved "https://registry.yarnpkg.com/@protobufjs/codegen/-/codegen-2.0.4.tgz#7ef37f0d010fb028ad1ad59722e506d9262815cb" + integrity sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg== + +"@protobufjs/eventemitter@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz#355cbc98bafad5978f9ed095f397621f1d066b70" + integrity sha512-j9ednRT81vYJ9OfVuXG6ERSTdEL1xVsNgqpkxMsbIabzSo3goCjDIveeGv5d03om39ML71RdmrGNjG5SReBP/Q== + +"@protobufjs/fetch@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/fetch/-/fetch-1.1.0.tgz#ba99fb598614af65700c1619ff06d454b0d84c45" + integrity sha512-lljVXpqXebpsijW71PZaCYeIcE5on1w5DlQy5WH6GLbFryLUrBD4932W/E2BSpfRJWseIL4v/KPgBFxDOIdKpQ== + dependencies: + "@protobufjs/aspromise" "^1.1.1" + "@protobufjs/inquire" "^1.1.0" + +"@protobufjs/float@^1.0.2": + version "1.0.2" + resolved "https://registry.yarnpkg.com/@protobufjs/float/-/float-1.0.2.tgz#5e9e1abdcb73fc0a7cb8b291df78c8cbd97b87d1" + integrity sha512-Ddb+kVXlXst9d+R9PfTIxh1EdNkgoRe5tOX6t01f1lYWOvJnSPDBlG241QLzcyPdoNTsblLUdujGSE4RzrTZGQ== + +"@protobufjs/inquire@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/inquire/-/inquire-1.1.0.tgz#ff200e3e7cf2429e2dcafc1140828e8cc638f089" + integrity sha512-kdSefcPdruJiFMVSbn801t4vFK7KB/5gd2fYvrxhuJYg8ILrmn9SKSX2tZdV6V+ksulWqS7aXjBcRXl3wHoD9Q== + +"@protobufjs/path@^1.1.2": + version "1.1.2" + resolved "https://registry.yarnpkg.com/@protobufjs/path/-/path-1.1.2.tgz#6cc2b20c5c9ad6ad0dccfd21ca7673d8d7fbf68d" + integrity sha512-6JOcJ5Tm08dOHAbdR3GrvP+yUUfkjG5ePsHYczMFLq3ZmMkAD98cDgcT2iA1lJ9NVwFd4tH/iSSoe44YWkltEA== + +"@protobufjs/pool@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/pool/-/pool-1.1.0.tgz#09fd15f2d6d3abfa9b65bc366506d6ad7846ff54" + integrity sha512-0kELaGSIDBKvcgS4zkjz1PeddatrjYcmMWOlAuAPwAeccUrPHdUqo/J6LiymHHEiJT5NrF1UVwxY14f+fy4WQw== + +"@protobufjs/utf8@^1.1.0": + version "1.1.0" + resolved "https://registry.yarnpkg.com/@protobufjs/utf8/-/utf8-1.1.0.tgz#a777360b5b39a1a2e5106f8e858f2fd2d060c570" + integrity sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw== + "@resolver-engine/core@^0.3.3": version "0.3.3" resolved "https://registry.yarnpkg.com/@resolver-engine/core/-/core-0.3.3.tgz#590f77d85d45bc7ecc4e06c654f41345db6ca967" @@ -1488,6 +1559,11 @@ "@types/minimatch" "*" "@types/node" "*" +"@types/google-protobuf@^3.15.12": + version "3.15.12" + resolved "https://registry.yarnpkg.com/@types/google-protobuf/-/google-protobuf-3.15.12.tgz#eb2ba0eddd65712211a2b455dc6071d665ccf49b" + integrity sha512-40um9QqwHjRS92qnOaDpL7RmDK15NuZYo9HihiJRbYkMQZlWnuH8AdvbMy8/o6lgLmKbDUKa+OALCltHdbOTpQ== + "@types/json-schema@^7.0.9": version "7.0.11" resolved "https://registry.yarnpkg.com/@types/json-schema/-/json-schema-7.0.11.tgz#d421b6c527a3037f7c84433fd2c4229e016863d3" @@ -1566,6 +1642,13 @@ resolved "https://registry.yarnpkg.com/@types/node/-/node-11.11.6.tgz#df929d1bb2eee5afdda598a41930fe50b43eaa6a" integrity sha512-Exw4yUWMBXM3X+8oqzJNRqZSwUAaS4+7NdvHqQuFi/d+synz++xmX3QIf+BFqneW8N31R8Ky+sikfZUXq07ggQ== +"@types/node@>=12.12.47", "@types/node@>=13.7.0": + version "20.14.2" + resolved "https://registry.yarnpkg.com/@types/node/-/node-20.14.2.tgz#a5f4d2bcb4b6a87bffcaa717718c5a0f208f4a18" + integrity sha512-xyu6WAMVwv6AKFLB+e/7ySZVr/0zLCzOa7rSpq6jNwpqOrUbcACDWC+53d4n2QHOnDou0fbIsg8wZu/sxrnI4Q== + dependencies: + undici-types "~5.26.4" + "@types/node@^10.0.3": version "10.17.60" resolved "https://registry.yarnpkg.com/@types/node/-/node-10.17.60.tgz#35f3d6213daed95da7f0f73e75bcc6980e90597b" @@ -4333,6 +4416,11 @@ globby@^11.1.0: merge2 "^1.4.1" slash "^3.0.0" +google-protobuf@^3.21.2: + version "3.21.2" + resolved "https://registry.yarnpkg.com/google-protobuf/-/google-protobuf-3.21.2.tgz#4580a2bea8bbb291ee579d1fefb14d6fa3070ea4" + integrity sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA== + graceful-fs@^4.1.11, graceful-fs@^4.1.2, graceful-fs@^4.1.6, graceful-fs@^4.1.9, graceful-fs@^4.2.0: version "4.2.10" resolved "https://registry.yarnpkg.com/graceful-fs/-/graceful-fs-4.2.10.tgz#147d3a006da4ca3ce14728c7aefc287c367d7a6c" @@ -5367,6 +5455,11 @@ log-symbols@4.1.0: chalk "^4.1.0" is-unicode-supported "^0.1.0" +long@^5.0.0: + version "5.2.3" + resolved "https://registry.yarnpkg.com/long/-/long-5.2.3.tgz#a3ba97f3877cf1d778eccbcb048525ebb77499e1" + integrity sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q== + loupe@^2.3.1: version "2.3.4" resolved "https://registry.yarnpkg.com/loupe/-/loupe-2.3.4.tgz#7e0b9bffc76f148f9be769cb1321d3dcf3cb25f3" @@ -6280,6 +6373,24 @@ promise@^8.0.0: dependencies: asap "~2.0.6" +protobufjs@^7.2.5: + version "7.3.0" + resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-7.3.0.tgz#a32ec0422c039798c41a0700306a6e305b9cb32c" + integrity sha512-YWD03n3shzV9ImZRX3ccbjqLxj7NokGN0V/ESiBV5xWqrommYHYiihuIyavq03pWSGqlyvYUFmfoMKd+1rPA/g== + dependencies: + "@protobufjs/aspromise" "^1.1.2" + "@protobufjs/base64" "^1.1.2" + "@protobufjs/codegen" "^2.0.4" + "@protobufjs/eventemitter" "^1.1.0" + "@protobufjs/fetch" "^1.1.0" + "@protobufjs/float" "^1.0.2" + "@protobufjs/inquire" "^1.1.0" + "@protobufjs/path" "^1.1.2" + "@protobufjs/pool" "^1.1.0" + "@protobufjs/utf8" "^1.1.0" + "@types/node" ">=13.7.0" + long "^5.0.0" + prr@~1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/prr/-/prr-1.0.1.tgz#d3fc114ba06995a45ec6893f484ceb1d78f5f476" @@ -7738,6 +7849,11 @@ unbox-primitive@^1.0.1: has-symbols "^1.0.2" which-boxed-primitive "^1.0.2" +undici-types@~5.26.4: + version "5.26.5" + resolved "https://registry.yarnpkg.com/undici-types/-/undici-types-5.26.5.tgz#bcd539893d00b56e964fd2657a4866b221a65617" + integrity sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA== + undici@^5.14.0: version "5.23.0" resolved "https://registry.yarnpkg.com/undici/-/undici-5.23.0.tgz#e7bdb0ed42cebe7b7aca87ced53e6eaafb8f8ca0" @@ -8102,7 +8218,7 @@ yargs@^11.0.0: y18n "^3.2.1" yargs-parser "^9.0.2" -yargs@^17.0.0: +yargs@^17.0.0, yargs@^17.7.2: version "17.7.2" resolved "https://registry.yarnpkg.com/yargs/-/yargs-17.7.2.tgz#991df39aca675a192b816e1e0363f9d75d2aa269" integrity sha512-7dSzzRQ++CKnNI/krKnYRV7JKKPUXMEh61soaHKg9mrWEhzFWhFnxPxGl+69cD1Ou63C13NUPCnmIcrvqCuM6w==