diff --git a/services/ts-filler/src/prover/prover.service.ts b/services/ts-filler/src/prover/prover.service.ts index 5936d88..7784e36 100644 --- a/services/ts-filler/src/prover/prover.service.ts +++ b/services/ts-filler/src/prover/prover.service.ts @@ -54,7 +54,8 @@ export default class ProverService { } async generateProofWithL2Block( - requestHash: Address + requestHash: Address, + timestampCutoff = 0 ): Promise<{ proof: ProofType; l2Block: Block }> { let beaconData: GetBeaconRootAndL2TimestampReturnType | undefined; let l1BlockNumber: bigint | undefined; @@ -86,6 +87,10 @@ export default class ProverService { await this.chainService.getL2Block(l1BlockNumber); const l2Slot = this.deriveRIP7755VerifierStorageSlot(requestHash); + if (timestampCutoff > l2Block.timestamp) { + throw new Error("L2 block timestamp is too old"); + } + const storageProofOpts = { l1BlockNumber, l2Block, diff --git a/services/ts-filler/src/rewards/monitor.service.ts b/services/ts-filler/src/rewards/monitor.service.ts index ecabc5d..de6b5f6 100644 --- a/services/ts-filler/src/rewards/monitor.service.ts +++ b/services/ts-filler/src/rewards/monitor.service.ts @@ -72,7 +72,8 @@ export default class RewardMonitorService { const { requestHash, sender, receiver, payload, attributes } = job; const { proof, l2Block } = await proverService.generateProofWithL2Block( - requestHash + requestHash, + job.claimAvailableAt ); const attributesClass = new Attributes(attributes); attributesClass.removeFulfiller();