Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avail nitro contracts v2 upstream v2.0.0 #3

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 17 additions & 13 deletions src/data-availability/AvailDABridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
bytes32 leaf;
}
struct BlobPointer {
uint8 version;
uint32 blockHeight;
uint32 extrinsicIndex;
bytes32 dasTreeRootHash;
Expand Down Expand Up @@ -56,20 +57,23 @@
}

function verifyBatchAttestation(bytes calldata data) external view returns (bool) {
uint8 blobPointerVersion = abi.decode(data[1:], (uint8));
if (blobPointerVersion == 2) {
BlobPointer memory blobPointer;

Check warning

Code scanning / Slither

Uninitialized local variables Medium

AvailDABridge.verifyBatchAttestation(bytes).blobPointer is a local variable never initialized
(
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;
Expand Down
2 changes: 1 addition & 1 deletion test/contract/arbRollup.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
Loading