Skip to content

Commit

Permalink
Merge pull request #65 from base-org/jack/ts-filler-l2-timestamp
Browse files Browse the repository at this point in the history
add ts filler validation against selected L2 block timestamp
  • Loading branch information
jackchuma authored Dec 30, 2024
2 parents 21ad0a7 + ea1f755 commit 78b3437
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
7 changes: 6 additions & 1 deletion services/ts-filler/src/prover/prover.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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,
Expand Down
3 changes: 2 additions & 1 deletion services/ts-filler/src/rewards/monitor.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 78b3437

Please sign in to comment.