Skip to content

Commit

Permalink
Merge pull request #224 from lambdaclass/feat_mode_getter_in_executor
Browse files Browse the repository at this point in the history
feat(Validium): Add getter to `Executor.sol` for retrieving the init mode (Validium or Rollup)
  • Loading branch information
ilitteri authored Feb 27, 2024
2 parents bf0dbcc + 798a9fb commit 9d20f8f
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
4 changes: 2 additions & 2 deletions l1-contracts/contracts/zksync/facets/Executor.sol
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,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
// #if VALIDIUM_MODE == false
require(logSender == L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, "ln");
require(providedL2ToL1PubdataHash == logValue, "wp");
// #endif
// #endif
} else if (logKey == uint256(SystemLogKey.STATE_DIFF_HASH_KEY)) {
require(logSender == L2_TO_L1_MESSENGER_SYSTEM_CONTRACT_ADDR, "lb");
stateDiffHash = logValue;
Expand Down
7 changes: 6 additions & 1 deletion l1-contracts/contracts/zksync/facets/Getters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pragma solidity 0.8.20;

import {Base} from "./Base.sol";
import {VerifierParams} from "../Storage.sol";
import {VerifierParams, PubdataPricingMode} from "../Storage.sol";
import {Diamond} from "../libraries/Diamond.sol";
import {PriorityQueue, PriorityOperation} from "../libraries/PriorityQueue.sol";
import {UncheckedMath} from "../../common/libraries/UncheckedMath.sol";
Expand Down Expand Up @@ -158,6 +158,11 @@ contract GettersFacet is Base, IGetters, ILegacyGetters {
return s.isEthWithdrawalFinalized[_l2BatchNumber][_l2MessageIndex];
}

/// @inheritdoc IGetters
function getPubdataPricingMode() external view returns (PubdataPricingMode) {
return s.feeParams.pubdataPricingMode;
}

/*//////////////////////////////////////////////////////////////
DIAMOND LOUPE
//////////////////////////////////////////////////////////////*/
Expand Down
6 changes: 5 additions & 1 deletion l1-contracts/contracts/zksync/interfaces/IGetters.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
pragma solidity 0.8.20;

import {PriorityOperation} from "../libraries/PriorityQueue.sol";
import {VerifierParams, UpgradeState} from "../Storage.sol";
import {VerifierParams, UpgradeState, PubdataPricingMode} from "../Storage.sol";
import "./IBase.sol";

/// @title The interface of the Getters Contract that implements functions for getting contract state from outside the blockchain.
Expand Down Expand Up @@ -92,6 +92,10 @@ interface IGetters is IBase {
/// @param _l2MessageIndex The index of the L2->L1 message denoting the withdrawal.
function isEthWithdrawalFinalized(uint256 _l2BatchNumber, uint256 _l2MessageIndex) external view returns (bool);

/// @return The pubdata pricing mode.
/// @dev This method is unstable and will likely change in the future. Use at your own risk.
function getPubdataPricingMode() external view returns (PubdataPricingMode);

/*//////////////////////////////////////////////////////////////
DIAMOND LOUPE
//////////////////////////////////////////////////////////////*/
Expand Down

0 comments on commit 9d20f8f

Please sign in to comment.