Skip to content

Commit

Permalink
increment time by 1 for next rollup if warped
Browse files Browse the repository at this point in the history
  • Loading branch information
rahul-kothari committed Aug 17, 2023
1 parent 9e516e4 commit e168b1f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
1 change: 0 additions & 1 deletion yarn-project/end-to-end/src/e2e_cheat_codes.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ describe('e2e_cheat_codes', () => {
expect(await cc.l1.timestamp()).toEqual(newTimestamp);
// ensure rollup contract is correctly updated
expect(Number(await rollup.read.lastBlockTs())).toEqual(newTimestamp);
expect;
}, 50_000);
});
});
11 changes: 11 additions & 0 deletions yarn-project/sequencer-client/src/sequencer/public_processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,17 @@ export class PublicProcessorFactory {
globalVariables: GlobalVariables,
): Promise<PublicProcessor> {
const blockData = await getHistoricBlockData(this.merkleTree, prevGlobalVariables);

// TODO(rahul) - fix #1614. By using the cheatcode warp to modify L2 time,
// txs in the new rollup would have same time as the txs in the previous rollup.
// We overcome this now by identifying if the last rollup time was warped (if two rollups have same time)
// and tell public-processor to use a different time (increment last rollup block)
// more details at https://github.com/AztecProtocol/aztec-packages/issues/1614
const isWarped = prevGlobalVariables.timestamp == globalVariables.timestamp;
if (isWarped) {
globalVariables.timestamp = new Fr(globalVariables.timestamp.value + 1n);
}

return new PublicProcessor(
this.merkleTree,
getPublicExecutor(this.merkleTree, this.contractDataSource, this.l1Tol2MessagesDataSource, blockData),
Expand Down

0 comments on commit e168b1f

Please sign in to comment.