Skip to content

Commit

Permalink
Check parent shnarf exists for calldata submission
Browse files Browse the repository at this point in the history
  • Loading branch information
thedarkjester committed Oct 22, 2024
1 parent cd58916 commit 8800eaa
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
4 changes: 4 additions & 0 deletions contracts/contracts/LineaRollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,10 @@ contract LineaRollup is
revert EmptySubmissionData();
}

if (blobShnarfExists[_parentShnarf] == 0) {
revert ParentBlobNotSubmitted(_parentShnarf);
}

bytes32 currentDataHash = keccak256(_submission.compressedData);

bytes32 dataEvaluationPoint = Utils._efficientKeccak(_submission.snarkHash, currentDataHash);
Expand Down
10 changes: 10 additions & 0 deletions contracts/test/LineaRollup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -391,6 +391,16 @@ describe("Linea Rollup contract", () => {
await expectRevertWithCustomError(lineaRollup, submitDataCall, "EmptySubmissionData");
});

it("Should fail when the parent shnarf does not exist", async () => {
const [submissionData] = generateCallDataSubmission(0, 1);
const nonExistingParentShnarf = generateRandomBytes(32);
const asyncCall = lineaRollup
.connect(operator)
.submitDataAsCalldata(submissionData, nonExistingParentShnarf, expectedShnarf, { gasLimit: 30_000_000 });

await expectRevertWithCustomError(lineaRollup, asyncCall, "ParentBlobNotSubmitted", [nonExistingParentShnarf]);
});

it("Should succesfully submit 1 compressed data chunk setting values", async () => {
const [submissionData] = generateCallDataSubmission(0, 1);

Expand Down

0 comments on commit 8800eaa

Please sign in to comment.