Skip to content

Commit

Permalink
feat: 36s slots and non-devnet
Browse files Browse the repository at this point in the history
  • Loading branch information
LHerskind committed Aug 22, 2024
1 parent 3aa46d5 commit 655a01b
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 47 deletions.
4 changes: 2 additions & 2 deletions l1-contracts/src/core/libraries/ConstantsGen.sol
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ library Constants {
uint256 internal constant INITIAL_L2_BLOCK_NUM = 1;
uint256 internal constant BLOB_SIZE_IN_BYTES = 126976;
uint256 internal constant ETHEREUM_SLOT_DURATION = 12;
uint256 internal constant AZTEC_SLOT_DURATION = 12;
uint256 internal constant AZTEC_SLOT_DURATION = 36;
uint256 internal constant AZTEC_EPOCH_DURATION = 48;
uint256 internal constant IS_DEV_NET = 1;
uint256 internal constant IS_DEV_NET = 0;
uint256 internal constant GENESIS_ARCHIVE_ROOT =
8142738430000951296386584486068033372964809139261822027365426310856631083550;
uint256 internal constant FEE_JUICE_INITIAL_MINT = 20000000000;
Expand Down
14 changes: 7 additions & 7 deletions l1-contracts/test/fixtures/empty_block_1.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"l2ToL1Messages": []
},
"block": {
"archive": "0x1fc4515430abede0c269e0aaf99fe032b4368b094b2a399d112144d8e0b4b803",
"archive": "0x0ae74c03163ad7ff21b5ecd379634b1efc5cae9be541257f728976b86d7cbac8",
"body": "0x00000000",
"txsEffectsHash": "0x00e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d6",
"decodedHeader": {
Expand All @@ -20,12 +20,12 @@
},
"globalVariables": {
"blockNumber": 1,
"slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000033",
"slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000031",
"chainId": 31337,
"timestamp": 1724321038,
"timestamp": 1724336155,
"version": 1,
"coinbase": "0x69d2d2c697a0ac4a874c591f6906706af27eb737",
"feeRecipient": "0x2c6280804920e2ecb139fe6185aeba95ee3687e64a14ff68a72a25ab9bb0d5eb",
"coinbase": "0x816acad9bfdeac6723e375ee1c82315afe776f5e",
"feeRecipient": "0x1136498e6982fc425cc54789a05a18aa655fd930538e7763627b1cbf40d1de8a",
"gasFees": {
"feePerDaGas": 0,
"feePerL2Gas": 0
Expand Down Expand Up @@ -56,8 +56,8 @@
}
}
},
"header": "0x1200a06aae1368abe36530b585bd7a4d2ba4de5037b82076412691a187d7621e00000001000000000000000000000000000000000000000000000000000000000000000200e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb14f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000100b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000008019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000010023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001000000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000066c70d0e69d2d2c697a0ac4a874c591f6906706af27eb7372c6280804920e2ecb139fe6185aeba95ee3687e64a14ff68a72a25ab9bb0d5eb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00acfc19a39d0814b57d47fbf843284cd2d293382e82dfcaafc819daf89b81b5",
"header": "0x1200a06aae1368abe36530b585bd7a4d2ba4de5037b82076412691a187d7621e00000001000000000000000000000000000000000000000000000000000000000000000200e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb14f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000100b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000008019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000010023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001000000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000310000000000000000000000000000000000000000000000000000000066c7481b816acad9bfdeac6723e375ee1c82315afe776f5e1136498e6982fc425cc54789a05a18aa655fd930538e7763627b1cbf40d1de8a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00b4d32b440844230141f13034d1b1ebed75fe8399b55215cd0895aeee2e8d31",
"numTxs": 0
}
}
16 changes: 8 additions & 8 deletions l1-contracts/test/fixtures/empty_block_2.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"l2ToL1Messages": []
},
"block": {
"archive": "0x2da3733e9f6522fcc8016aff753cb69100051aae6f3612a2180959adfd3293f6",
"archive": "0x2d1cbb9137fdf0d3c35a3ef87540f73392d1c611d1c7ecb711715ac510f9a585",
"body": "0x00000000",
"txsEffectsHash": "0x00e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d6",
"decodedHeader": {
Expand All @@ -20,20 +20,20 @@
},
"globalVariables": {
"blockNumber": 2,
"slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000035",
"slotNumber": "0x0000000000000000000000000000000000000000000000000000000000000033",
"chainId": 31337,
"timestamp": 1724321062,
"timestamp": 1724336227,
"version": 1,
"coinbase": "0x69d2d2c697a0ac4a874c591f6906706af27eb737",
"feeRecipient": "0x2c6280804920e2ecb139fe6185aeba95ee3687e64a14ff68a72a25ab9bb0d5eb",
"coinbase": "0x816acad9bfdeac6723e375ee1c82315afe776f5e",
"feeRecipient": "0x1136498e6982fc425cc54789a05a18aa655fd930538e7763627b1cbf40d1de8a",
"gasFees": {
"feePerDaGas": 0,
"feePerL2Gas": 0
}
},
"lastArchive": {
"nextAvailableLeafIndex": 2,
"root": "0x1fc4515430abede0c269e0aaf99fe032b4368b094b2a399d112144d8e0b4b803"
"root": "0x0ae74c03163ad7ff21b5ecd379634b1efc5cae9be541257f728976b86d7cbac8"
},
"stateReference": {
"l1ToL2MessageTree": {
Expand All @@ -56,8 +56,8 @@
}
}
},
"header": "0x1fc4515430abede0c269e0aaf99fe032b4368b094b2a399d112144d8e0b4b80300000002000000000000000000000000000000000000000000000000000000000000000200e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb14f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000200b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000010019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000018023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001800000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000350000000000000000000000000000000000000000000000000000000066c70d2669d2d2c697a0ac4a874c591f6906706af27eb7372c6280804920e2ecb139fe6185aeba95ee3687e64a14ff68a72a25ab9bb0d5eb000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x00318295aad2a231c68b825b4fca99e2cbb1345c82ee6d01888289771199d1b9",
"header": "0x0ae74c03163ad7ff21b5ecd379634b1efc5cae9be541257f728976b86d7cbac800000002000000000000000000000000000000000000000000000000000000000000000200e994e16b3763fd5039413cf99c2b3c378e2bab939e7992a77bd201b28160d600089a9d421a82c4a25f7acbebe69e638d5b064fa8a60e018793dcb0be53752c00f5a5fd42d16a20302798ef6ed309979b43003d2320d9f0e8ea9831a92759fb14f44d672eb357739e42463497f9fdac46623af863eea4d947ca00a497dcdeb3000000200b59baa35b9dc267744f0ccb4e3b0255c1fc512460d91130c6bc19fb2668568d0000010019a8c197c12bb33da6314c4ef4f8f6fcb9e25250c085df8672adf67c8f1e3dbc0000018023c08a6b1297210c5e24c76b9a936250a1ce2721576c26ea797c7ec35f9e46a9000001800000000000000000000000000000000000000000000000000000000000007a690000000000000000000000000000000000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000330000000000000000000000000000000000000000000000000000000066c74863816acad9bfdeac6723e375ee1c82315afe776f5e1136498e6982fc425cc54789a05a18aa655fd930538e7763627b1cbf40d1de8a000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000",
"publicInputsHash": "0x002ffed9eafc7cbcbf441051745d07e26628feff7ec88438b3ccd5dac5392e62",
"numTxs": 0
}
}
14 changes: 7 additions & 7 deletions l1-contracts/test/fixtures/mixed_block_1.json

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions l1-contracts/test/fixtures/mixed_block_2.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -133,9 +133,9 @@ 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_SLOT_DURATION: u32 = ETHEREUM_SLOT_DURATION * 3;
global AZTEC_EPOCH_DURATION: u32 = 48;
global IS_DEV_NET: bool = true;
global IS_DEV_NET: bool = false;
// 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;
Expand Down
4 changes: 2 additions & 2 deletions yarn-project/circuits.js/src/constants.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ export const INITIALIZATION_SLOT_SEPARATOR = 1000000000;
export const INITIAL_L2_BLOCK_NUM = 1;
export const BLOB_SIZE_IN_BYTES = 126976;
export const ETHEREUM_SLOT_DURATION = 12;
export const AZTEC_SLOT_DURATION = 12;
export const AZTEC_SLOT_DURATION = 36;
export const AZTEC_EPOCH_DURATION = 48;
export const IS_DEV_NET = 1;
export const IS_DEV_NET = 0;
export const GENESIS_ARCHIVE_ROOT = 8142738430000951296386584486068033372964809139261822027365426310856631083550n;
export const FEE_JUICE_INITIAL_MINT = 20000000000;
export const MAX_PACKED_PUBLIC_BYTECODE_SIZE_IN_FIELDS = 20000;
Expand Down
25 changes: 21 additions & 4 deletions yarn-project/sequencer-client/src/publisher/l1-publisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,14 @@ export class L1Publisher {
}

const currentSlot = BigInt(await this.rollupContract.read.getCurrentSlot());
return currentSlot != slot;

if (currentSlot === slot) {
return false;
}

this.log.verbose(`Simulation will fail for slot ${slot} as it is not the current slot ${currentSlot}`);

return true;
}

// @note Assumes that all ethereum slots have blocks
Expand Down Expand Up @@ -239,9 +246,19 @@ export class L1Publisher {
};

if (await this.willSimulationFail(block.header.globalVariables.slotNumber.toBigInt())) {
// @note See comment in willSimulationFail for more information
this.log.info(`Simulation will fail for slot ${block.header.globalVariables.slotNumber.toBigInt()}`);
return false;
// If we entered this case, it should be because the simulation is deemed to fail since the `timestamp` of anvil
// simulation is that of the LAST block, and not the block of the next, but we throughout the rest of the logic, have estimated
// that we will be the sequencer in the NEXT block.
//
// We will be cheating again here, if possible, we are going to perform a time jump.
// This should not be the case, but should be addressed along with #8110
await this.commitTimeJump(block.header.globalVariables.slotNumber.toBigInt());

// If we are still in the same slot, we will just wait for the next block to be mined.
// If in auto-mine, this might never happen.
if (await this.willSimulationFail(block.header.globalVariables.slotNumber.toBigInt())) {
return false;
}
}

const processTxArgs = {
Expand Down
7 changes: 0 additions & 7 deletions yarn-project/sequencer-client/src/sequencer/sequencer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -291,13 +291,6 @@ export class Sequencer {

const [submitter, slot, pendingBlockNumber, archive] = await this.publisher.getMetadataForSlotAtNextEthBlock();

if (await this.publisher.willSimulationFail(slot)) {
// @note See comment in willSimulationFail for more information
const msg = `Simulation will fail for slot ${slot}`;
this.log.debug(msg);
throw new Error(msg);
}

// If our tip of the chain is different from the tip on L1, we should not propose a block
// @note This will change along with the data publication changes.
if (tipArchive && !archive.equals(tipArchive)) {
Expand Down

0 comments on commit 655a01b

Please sign in to comment.