Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Use the native type for Validium mode instead of solpp (Moved) #20

Open
wants to merge 7 commits into
base: feat_validium_mode
Choose a base branch
from
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ contract ExecutorProvingTest is ExecutorFacet {
bytes32 _expectedSystemContractUpgradeTxHash
)
external
pure
view
returns (
uint256 numberOfLayer1Txs,
bytes32 chainedPriorityTxsHash,
Expand Down
21 changes: 10 additions & 11 deletions l1-contracts/contracts/zksync/facets/Executor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {IExecutor, L2_LOG_ADDRESS_OFFSET, L2_LOG_KEY_OFFSET, L2_LOG_VALUE_OFFSET
import {PriorityQueue, PriorityOperation} from "../libraries/PriorityQueue.sol";
import {UncheckedMath} from "../../common/libraries/UncheckedMath.sol";
import {UnsafeBytes} from "../../common/libraries/UnsafeBytes.sol";
import {VerifierParams} from "../Storage.sol";
import {VerifierParams, PubdataPricingMode} from "../Storage.sol";
import {L2_BOOTLOADER_ADDRESS, L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, L2_SYSTEM_CONTEXT_SYSTEM_CONTRACT_ADDR} from "../../common/L2ContractAddresses.sol";

// While formally the following import is not used, it is needed to inherit documentation from it
Expand All @@ -24,8 +24,6 @@ contract ExecutorFacet is Base, IExecutor {
/// @inheritdoc IBase
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 @@ -108,7 +106,7 @@ contract ExecutorFacet is Base, IExecutor {
bytes32 _expectedSystemContractUpgradeTxHash
)
internal
pure
view
returns (
uint256 numberOfLayer1Txs,
bytes32 chainedPriorityTxsHash,
Expand All @@ -125,9 +123,10 @@ 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
bytes32 providedL2ToL1PubdataHash;
if (s.feeParams.pubdataPricingMode == PubdataPricingMode.Rollup) {
providedL2ToL1PubdataHash = keccak256(_newBatch.totalL2ToL1Pubdata);
}

// linear traversal of the logs
for (uint256 i = 0; i < emittedL2Logs.length; i = i.uncheckedAdd(L2_TO_L1_LOG_SERIALIZE_SIZE)) {
Expand All @@ -145,10 +144,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
if (s.feeParams.pubdataPricingMode == PubdataPricingMode.Rollup) {
require(logSender == L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, "ln");
require(providedL2ToL1PubdataHash == logValue, "wp");
}
} else if (logKey == uint256(SystemLogKey.STATE_DIFF_HASH_KEY)) {
require(logSender == L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, "lb");
stateDiffHash = logValue;
Expand Down
1 change: 0 additions & 1 deletion l1-contracts/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ export default {
return {
...systemParams,
...defs,
VALIDIUM_MODE: process.env.VALIDIUM_MODE == "true",
};
})(),
},
Expand Down
Loading