Skip to content

Commit 8800eaa

Browse files
committed
Check parent shnarf exists for calldata submission
1 parent cd58916 commit 8800eaa

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

contracts/contracts/LineaRollup.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,10 @@ contract LineaRollup is
301301
revert EmptySubmissionData();
302302
}
303303

304+
if (blobShnarfExists[_parentShnarf] == 0) {
305+
revert ParentBlobNotSubmitted(_parentShnarf);
306+
}
307+
304308
bytes32 currentDataHash = keccak256(_submission.compressedData);
305309

306310
bytes32 dataEvaluationPoint = Utils._efficientKeccak(_submission.snarkHash, currentDataHash);

contracts/test/LineaRollup.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -391,6 +391,16 @@ describe("Linea Rollup contract", () => {
391391
await expectRevertWithCustomError(lineaRollup, submitDataCall, "EmptySubmissionData");
392392
});
393393

394+
it("Should fail when the parent shnarf does not exist", async () => {
395+
const [submissionData] = generateCallDataSubmission(0, 1);
396+
const nonExistingParentShnarf = generateRandomBytes(32);
397+
const asyncCall = lineaRollup
398+
.connect(operator)
399+
.submitDataAsCalldata(submissionData, nonExistingParentShnarf, expectedShnarf, { gasLimit: 30_000_000 });
400+
401+
await expectRevertWithCustomError(lineaRollup, asyncCall, "ParentBlobNotSubmitted", [nonExistingParentShnarf]);
402+
});
403+
394404
it("Should succesfully submit 1 compressed data chunk setting values", async () => {
395405
const [submissionData] = generateCallDataSubmission(0, 1);
396406

0 commit comments

Comments
 (0)