diff --git a/contracts/contracts/LineaRollup.sol b/contracts/contracts/LineaRollup.sol index 5d55b52bb..73d72346a 100644 --- a/contracts/contracts/LineaRollup.sol +++ b/contracts/contracts/LineaRollup.sol @@ -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); diff --git a/contracts/test/LineaRollup.ts b/contracts/test/LineaRollup.ts index 6edd28b3d..3b6cbc1c2 100644 --- a/contracts/test/LineaRollup.ts +++ b/contracts/test/LineaRollup.ts @@ -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);