Check parent shnarf exists for calldata submission (#223)

This commit is contained in:
The Dark Jester
2024-10-31 09:38:31 -07:00
committed by GitHub
parent 4a9b4ec096
commit 31f946ede7
2 changed files with 14 additions and 0 deletions

View File

@@ -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);

View File

@@ -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);