Skip to content

Commit

Permalink
chore: address comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Aug 22, 2024
1 parent 57dbd32 commit f056f6b
Show file tree
Hide file tree
Showing 9 changed files with 18 additions and 14 deletions.
7 changes: 2 additions & 5 deletions l1-contracts/src/core/Rollup.sol
Original file line number Diff line number Diff line change
Expand Up @@ -88,11 +88,8 @@ contract Rollup is Leonidas, IRollup, ITestRollup {
VERSION = 1;

// Genesis block
blocks[0] = BlockLog({
archive: bytes32(0x1200a06aae1368abe36530b585bd7a4d2ba4de5037b82076412691a187d7621e),
slotNumber: 0,
isProven: true
});
blocks[0] =
BlockLog({archive: bytes32(Constants.GENESIS_ARCHIVE_ROOT), slotNumber: 0, isProven: true});
pendingBlockCount = 1;
provenBlockCount = 1;
}
Expand Down
2 changes: 2 additions & 0 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,8 @@ library Constants {
uint256 internal constant AZTEC_SLOT_DURATION = 12;
uint256 internal constant AZTEC_EPOCH_DURATION = 48;
uint256 internal constant IS_DEV_NET = 1;
uint256 internal constant GENESIS_ARCHIVE_ROOT =
8142738430000951296386584486068033372964809139261822027365426310856631083550;
uint256 internal constant FEE_JUICE_INITIAL_MINT = 20000000000;
uint256 internal constant MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 20000;
uint256 internal constant MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS = 3000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,13 @@ global INITIALIZATION_SLOT_SEPARATOR: Field = 1000_000_000;
global INITIAL_L2_BLOCK_NUM: Field = 1;
global BLOB_SIZE_IN_BYTES: Field = 31 * 4096;
global ETHEREUM_SLOT_DURATION: u32 = 12;
// AZTEC_SLOT_DURATION should be a multiple of ETHEREUM_SLOT_DURATION
global AZTEC_SLOT_DURATION: u32 = ETHEREUM_SLOT_DURATION * 1;
global AZTEC_EPOCH_DURATION: u32 = 48;
global IS_DEV_NET: bool = true;
// The following is taken from building a block and looking at the `lastArchive` value in it.
// You can run the `integration_l1_publisher.test.ts` and look at the first blocks in the fixtures.
global GENESIS_ARCHIVE_ROOT: Field = 0x1200a06aae1368abe36530b585bd7a4d2ba4de5037b82076412691a187d7621e;
// The following and the value in `deploy_l1_contracts´ must match. We should not have the code both places, but
// we are running into circular dependency issues. #3342
global FEE_JUICE_INITIAL_MINT: Field = 20000000000;
Expand Down
1 change: 1 addition & 0 deletions yarn-project/circuits.js/src/constants.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export const ETHEREUM_SLOT_DURATION = 12;
export const AZTEC_SLOT_DURATION = 12;
export const AZTEC_EPOCH_DURATION = 48;
export const IS_DEV_NET = 1;
export const GENESIS_ARCHIVE_ROOT = 8142738430000951296386584486068033372964809139261822027365426310856631083550n;
export const FEE_JUICE_INITIAL_MINT = 20000000000;
export const MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 20000;
export const MAX_PACKED_BYTECODE_SIZE_PER_PRIVATE_FUNCTION_IN_FIELDS = 3000;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
import {
ETHEREUM_SLOT_DURATION,
EthAddress,
GENESIS_ARCHIVE_ROOT,
GasFees,
type Header,
KernelCircuitPublicInputs,
Expand Down Expand Up @@ -77,9 +78,6 @@ const config = getConfigEnvVars();

const numberOfConsecutiveBlocks = 2;

// The initial archive is what we have in the genesis block in `Rollup.sol`.
const INITIAL_ARCHIVE = Fr.fromString('0x1200a06aae1368abe36530b585bd7a4d2ba4de5037b82076412691a187d7621e').toBuffer();

describe('L1Publisher integration', () => {
let publicClient: PublicClient<HttpTransport, Chain>;
let walletClient: WalletClient<HttpTransport, Chain, Account>;
Expand Down Expand Up @@ -351,7 +349,7 @@ describe('L1Publisher integration', () => {

it(`Build ${numberOfConsecutiveBlocks} blocks of 4 bloated txs building on each other`, async () => {
const archiveInRollup_ = await rollup.read.archive();
expect(hexStringToBuffer(archiveInRollup_.toString())).toEqual(INITIAL_ARCHIVE);
expect(hexStringToBuffer(archiveInRollup_.toString())).toEqual(new Fr(GENESIS_ARCHIVE_ROOT).toBuffer());

const blockNumber = await publicClient.getBlockNumber();
// random recipient address, just kept consistent for easy testing ts/sol.
Expand Down Expand Up @@ -468,14 +466,14 @@ describe('L1Publisher integration', () => {
// We wipe the messages from previous iteration
nextL1ToL2Messages = [];

// @todo @LHerskind need to make sure that time have progressed to the next slot!
// Make sure that time have progressed to the next slot!
await progressTimeBySlot();
}
});

it(`Build ${numberOfConsecutiveBlocks} blocks of 2 empty txs building on each other`, async () => {
const archiveInRollup_ = await rollup.read.archive();
expect(hexStringToBuffer(archiveInRollup_.toString())).toEqual(INITIAL_ARCHIVE);
expect(hexStringToBuffer(archiveInRollup_.toString())).toEqual(new Fr(GENESIS_ARCHIVE_ROOT).toBuffer());

const blockNumber = await publicClient.getBlockNumber();

Expand Down
3 changes: 2 additions & 1 deletion yarn-project/ethereum/src/deploy_l1_contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,8 @@ export const deployL1Contracts = async (
client: walletClient,
});

// @note We make a time jump PAST the very first slot to not have to deal with the edge case of the first slot
// @note We make a time jump PAST the very first slot to not have to deal with the edge case of the first slot.
// The edge case being that the genesis block is already occupying slot 0, so we cannot have another block.
try {
// Need to get the time
const currentSlot = (await rollup.read.getCurrentSlot([])) as bigint;
Expand Down
1 change: 1 addition & 0 deletions yarn-project/sequencer-client/src/publisher/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface PublisherConfig {
l1PublishRetryIntervalMS: number;
/**
* Whether the publisher is a time traveler and can warp the underlying chain
* @todo #8153 - Remove this flag once the time traveler is removed
*/
timeTraveler: boolean;
}
Expand Down
2 changes: 2 additions & 0 deletions yarn-project/sequencer-client/src/publisher/l1-publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,8 @@ export class L1Publisher {
// Time jumps only allowed into the future.
//
// If this is run on top of a real chain, the time lords will catch you.
//
// @todo #8153

if (!this.timeTraveler) {
return;
Expand Down
2 changes: 0 additions & 2 deletions yarn-project/sequencer-client/src/sequencer/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -440,8 +440,6 @@ export class Sequencer {
return true;
}

async assertCanStillProposeBlock(): Promise<void> {}

@trackSpan(
'Sequencer.buildBlockAndPublish',
(_validTxs, newGlobalVariables, _historicalHeader, _chainTipArchive) => ({
Expand Down

0 comments on commit f056f6b

Please sign in to comment.