diff --git a/src/data-availability/AvailDABridge.sol b/src/data-availability/AvailDABridge.sol index ae577332..833110d0 100644 --- a/src/data-availability/AvailDABridge.sol +++ b/src/data-availability/AvailDABridge.sol @@ -22,6 +22,7 @@ contract AvailDABridge is IDABridge { bytes32 leaf; } struct BlobPointer { + uint8 version; uint32 blockHeight; uint32 extrinsicIndex; bytes32 dasTreeRootHash; @@ -56,20 +57,23 @@ contract AvailDABridge is IDABridge { } function verifyBatchAttestation(bytes calldata data) external view returns (bool) { + uint8 blobPointerVersion = abi.decode(data[1:], (uint8)); + if (blobPointerVersion == 2) { + BlobPointer memory blobPointer; + ( + blobPointer.version, + blobPointer.blockHeight, + blobPointer.extrinsicIndex, + blobPointer.dasTreeRootHash, + blobPointer.blobDataKeccak256H, + blobPointer.blobProof + ) = abi.decode(data[1:], (uint8, uint32, uint32, bytes32, bytes32, BlobProof)); + require( + blobPointer.blobDataKeccak256H == blobPointer.blobProof.leaf, + "Squencer batch data keccak256H preimage is not matching with the blobProof commitment" + ); + } // console.logString("Avail header found"); - BlobPointer memory blobPointer; - ( - blobPointer.blockHeight, - blobPointer.extrinsicIndex, - blobPointer.dasTreeRootHash, - blobPointer.blobDataKeccak256H, - blobPointer.blobProof - ) = abi.decode(data[1:], (uint32, uint32, bytes32, bytes32, BlobProof)); - - require( - blobPointer.blobDataKeccak256H == blobPointer.blobProof.leaf, - "Squencer batch data keccak256H preimage is not matching with the blobProof commitment" - ); // For Phase 1 of Optimistic DA verification, the blobProof is not getting verified return false; diff --git a/test/contract/arbRollup.spec.ts b/test/contract/arbRollup.spec.ts index c3d2c161..e3ca7589 100644 --- a/test/contract/arbRollup.spec.ts +++ b/test/contract/arbRollup.spec.ts @@ -1519,7 +1519,7 @@ describe('ArbRollup', () => { it('should validate the batch data with Avail header and BlobPointer', async () => { // Fixed blobPointer with Specified value const data = - '0x0a00000000000000000000000000000000000000000000000000000000000007e8000000000000000000000000000000000000000000000000000000000000000197a3dacf2a1bfc09eb047e4194084b021fa949cb9b660e1f94d484c070e154f50000000000000000000000000000000000000000000000000000000000000080835f5ef98bd9d8cbb41b0786f3f4f7726d54500cb15fc0f4d607d47b419a9a09532168c18a2b1e006ffd66c402a31fc61c82c62e7ec9bd983dc6b87e75f59479000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000000b71373eb01c940a02447728c5708ae02b443e525b0a98ba42b143189fad2ab1100000000000000000000000000000000000000000000000000000000000000044d539f7068ca4f7848f6ff751382936de97c5f36f1119d02b8409b4d5ce908e4ef44f2bb8a5ac9b38e1e67d7f5defc21afeb2015085de38e82888a2d8a60cfdbfa1ebbc9251f163a9a4ef4418f4c80765c8fb9d7a709b77946bb846f597ff00aae1ecba2081478fa8eddeb64dfbe3e1f16f587bc02a29259796bea9256cf05ab' + '0x0a000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000007e8000000000000000000000000000000000000000000000000000000000000000197a3dacf2a1bfc09eb047e4194084b021fa949cb9b660e1f94d484c070e154f5b71373eb01c940a02447728c5708ae02b443e525b0a98ba42b143189fad2ab1100000000000000000000000000000000000000000000000000000000000000c017a9a988843e9a384779474e486d2e911e62a8ddb3f605ec4a1c245c42dfecf87ba9b91957bb73f4284f93b65a3d7f0a53530cfb3a0fe53b1253ba0d1995248f000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000e000000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000b71373eb01c940a02447728c5708ae02b443e525b0a98ba42b143189fad2ab1100000000000000000000000000000000000000000000000000000000000000035b7b99083c32347e2a2b6b5f54087ca93bd6a64471f774e1adb04aca57ef4d58a0a3591c547a0443f34bfc1513fee5dc717d42ab6e8bdaf3597533fc95851ae98115d2411c2a53640c8801cc89e67d6fe49b30c14288094f85b408c1ff589b18' const transaction = await sequencerInbox .connect(sequencer) .addSequencerL2Batch(