Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion SystemConfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"L1_TX_DELTA_FACTORY_DEPS_L2_GAS": 2473,
"L1_TX_DELTA_FACTORY_DEPS_PUBDATA": 64,
"MAX_NEW_FACTORY_DEPS": 32,
"REQUIRED_L2_GAS_PRICE_PER_PUBDATA": 800
"REQUIRED_L2_GAS_PRICE_PER_PUBDATA": 800,
"VALIDIUM_MODE": true
}
6 changes: 6 additions & 0 deletions l1-contracts/contracts/zksync/facets/Executor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ contract ExecutorFacet is Base, IExecutor {

string public constant override getName = "ExecutorFacet";

bool constant VALIDIUM_MODE = $(VALIDIUM_MODE);

/// @dev Process one batch commit using the previous batch StoredBatchInfo
/// @dev returns new batch StoredBatchInfo
/// @notice Does not change storage
Expand Down Expand Up @@ -119,7 +121,9 @@ contract ExecutorFacet is Base, IExecutor {
// See SystemLogKey enum in Constants.sol for ordering.
uint256 processedLogs;

// #if VALIDIUM_MODE == false
bytes32 providedL2ToL1PubdataHash = keccak256(_newBatch.totalL2ToL1Pubdata);
// #endif

// linear traversal of the logs
for (uint256 i = 0; i < emittedL2Logs.length; i = i.uncheckedAdd(L2_TO_L1_LOG_SERIALIZE_SIZE)) {
Expand All @@ -137,8 +141,10 @@ contract ExecutorFacet is Base, IExecutor {
require(logSender == L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, "lm");
l2LogsTreeRoot = logValue;
} else if (logKey == uint256(SystemLogKey.TOTAL_L2_TO_L1_PUBDATA_KEY)) {
// #if VALIDIUM_MODE == false
require(logSender == L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, "ln");
require(providedL2ToL1PubdataHash == logValue, "wp");
// #endif
} else if (logKey == uint256(SystemLogKey.STATE_DIFF_HASH_KEY)) {
require(logSender == L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, "lb");
stateDiffHash = logValue;
Expand Down
5 changes: 5 additions & 0 deletions system-contracts/bootloader/bootloader.yul
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,12 @@ object "Bootloader" {
/// we demand at least 17 to cover up for the costs of additional
/// hashing of it, etc.
function L1_GAS_PER_PUBDATA_BYTE() -> ret {
<!-- @if VALIDIUM_MODE=='false' -->
ret := 17
<!-- @endif -->
<!-- @if VALIDIUM_MODE=='true' -->
ret := 0
<!-- @endif -->
}

/// @dev The size of the bootloader memory that is to spent by the transaction's
Expand Down
9 changes: 5 additions & 4 deletions system-contracts/scripts/preprocess-bootloader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,15 @@ async function main() {
});

console.log("Preprocessing production bootloader");
const provedBatchBootloader = preprocess.preprocess(bootloader, { BOOTLOADER_TYPE: "proved_batch" });
const provedBatchBootloader = preprocess.preprocess(bootloader, { BOOTLOADER_TYPE: "proved_batch", VALIDIUM_MODE: process.env.VALIDIUM_MODE });
console.log("Preprocessing playground block bootloader");
const playgroundBatchBootloader = preprocess.preprocess(bootloader, { BOOTLOADER_TYPE: "playground_batch" });
const playgroundBatchBootloader = preprocess.preprocess(bootloader, { BOOTLOADER_TYPE: "playground_batch", VALIDIUM_MODE: process.env.VALIDIUM_MODE });
console.log("Preprocessing gas test bootloader");
const gasTestBootloader = preprocess.preprocess(gasTestBootloaderTemplate, { BOOTLOADER_TYPE: "proved_batch" });
const gasTestBootloader = preprocess.preprocess(gasTestBootloaderTemplate, { BOOTLOADER_TYPE: "proved_batch", VALIDIUM_MODE: process.env.VALIDIUM_MODE });
console.log("Preprocessing fee estimation bootloader");
const feeEstimationBootloader = preprocess.preprocess(feeEstimationBootloaderTemplate, {
BOOTLOADER_TYPE: "playground_batch",
VALIDIUM_MODE: process.env.VALIDIUM_MODE,
});

console.log("Preprocessing bootloader tests");
Expand All @@ -247,7 +248,7 @@ async function main() {
...params,
CODE_START_PLACEHOLDER: "\n" + bootloaderTestUtils + "\n" + bootloaderTests + "\n" + testFramework,
});
const provedBootloaderWithTests = preprocess.preprocess(bootloaderWithTests, { BOOTLOADER_TYPE: "proved_batch" });
const provedBootloaderWithTests = preprocess.preprocess(bootloaderWithTests, { BOOTLOADER_TYPE: "proved_batch", VALIDIUM_MODE: process.env.VALIDIUM_MODE });

if (!existsSync(OUTPUT_DIR)) {
mkdirSync(OUTPUT_DIR);
Expand Down