Skip to content

Commit

Permalink
fix verifySharesToDataRootTupleRoot and verifyRowRootToDataRootTupleRoot
Browse files Browse the repository at this point in the history
  • Loading branch information
zhiqiangxu committed May 3, 2024
1 parent c92e4a1 commit f62ca0e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 14 deletions.
7 changes: 3 additions & 4 deletions src/lib/verifier/DAVerifier.sol
Original file line number Diff line number Diff line change
Expand Up @@ -163,15 +163,13 @@ library DAVerifier {
/// @param _bridge The Blobstream smart contract instance.
/// @param _rowRoot The row/column root to be proven.
/// @param _rowProof The proof of the row/column root to the data root.
/// @param _root The data root of the block that contains the row.
/// @return `true` if the proof is valid, `false` otherwise.
/// @return an error code if the proof is invalid, ErrorCodes.NoError otherwise.
function verifyRowRootToDataRootTupleRoot(
IDAOracle _bridge,
NamespaceNode memory _rowRoot,
BinaryMerkleProof memory _rowProof,
AttestationProof memory _attestationProof,
bytes32 _root
AttestationProof memory _attestationProof
) internal view returns (bool, ErrorCodes) {
// checking that the data root was committed to by the Blobstream smart contract
if (
Expand All @@ -182,7 +180,8 @@ library DAVerifier {
return (false, ErrorCodes.InvalidDataRootTupleToDataRootTupleRootProof);
}

(bool valid, ErrorCodes error) = verifyRowRootToDataRootTupleRootProof(_rowRoot, _rowProof, _root);
(bool valid, ErrorCodes error) =
verifyRowRootToDataRootTupleRootProof(_rowRoot, _rowProof, _attestationProof.tuple.dataRoot);

return (valid, error);
}
Expand Down
6 changes: 1 addition & 5 deletions src/lib/verifier/test/DAVerifier.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,7 @@ contract DAVerifierTest is DSTest {
);

(bool valid, DAVerifier.ErrorCodes errorCode) = DAVerifier.verifyRowRootToDataRootTupleRoot(
bridge,
fixture.getFirstRowRootNode(),
fixture.getRowRootToDataRootProof(),
attestationProof,
fixture.dataRoot()
bridge, fixture.getFirstRowRootNode(), fixture.getRowRootToDataRootProof(), attestationProof
);
assertTrue(valid);
assertEq(uint8(errorCode), uint8(DAVerifier.ErrorCodes.NoError));
Expand Down
6 changes: 1 addition & 5 deletions src/lib/verifier/test/RollupInclusionProofs.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,7 @@ contract RollupInclusionProofTest is DSTest {
);
bool success;
(success, error) = DAVerifier.verifyRowRootToDataRootTupleRoot(
bridge,
fixture.getFirstRowRootNode(),
fixture.getRowRootToDataRootProof(),
attestationProof,
fixture.dataRoot()
bridge, fixture.getFirstRowRootNode(), fixture.getRowRootToDataRootProof(), attestationProof
);
assertTrue(success);
assertEq(uint8(error), uint8(DAVerifier.ErrorCodes.NoError));
Expand Down

0 comments on commit f62ca0e

Please sign in to comment.