forked from OffchainLabs/nitro-contracts
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from availproject/avail-develop-v2-upstream-v2.0.0
feat: added version to blobPointer
- Loading branch information
Showing
2 changed files
with
18 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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; | ||
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; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters