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

Named mapping variables #143

Merged
merged 2 commits into from
Jan 16, 2024
Merged
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
6 changes: 3 additions & 3 deletions ethereum/contracts/bridge/L1ERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,11 @@ contract L1ERC20Bridge is IL1Bridge, IL1BridgeLegacy, ReentrancyGuard {

/// @dev A mapping L2 batch number => message number => flag
/// @dev Used to indicate that zkSync L2 -> L1 message was already processed
mapping(uint256 => mapping(uint256 => bool)) public isWithdrawalFinalized;
mapping(uint256 l2BatchNumber => mapping(uint256 l2ToL1MessageNumber => bool isFinalized)) public isWithdrawalFinalized;

/// @dev A mapping account => L1 token address => L2 deposit transaction hash => amount
/// @dev Used for saving the number of deposited funds, to claim them in case the deposit transaction will fail
mapping(address => mapping(address => mapping(bytes32 => uint256))) internal depositAmount;
mapping(address account => mapping(address l1Token => mapping(bytes32 depositL2TxHash => uint256 amount))) internal depositAmount;

/// @dev The address of deployed L2 bridge counterpart
address public l2Bridge;
Expand All @@ -53,7 +53,7 @@ contract L1ERC20Bridge is IL1Bridge, IL1BridgeLegacy, ReentrancyGuard {

/// @dev The accumulated deposited amount per user.
/// @dev A mapping L1 token address => user address => the total deposited amount by the user
mapping(address => mapping(address => uint256)) public totalDepositedAmountPerUser;
mapping(address => mapping(address => uint256)) public __DEPRECATED_totalDepositedAmountPerUser;

/// @dev Contract is expected to be used as proxy implementation.
/// @dev Initialize the implementation to prevent Parity hack.
Expand Down
2 changes: 1 addition & 1 deletion ethereum/contracts/bridge/L1WethBridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ contract L1WethBridge is IL1Bridge, ReentrancyGuard {

/// @dev A mapping L2 batch number => message number => flag
/// @dev Used to indicate that zkSync L2 -> L1 WETH message was already processed
mapping(uint256 => mapping(uint256 => bool)) public isWithdrawalFinalized;
mapping(uint256 l2BatchNumber => mapping(uint256 l2ToL1MessageNumber => bool isFinalized)) public isWithdrawalFinalized;

/// @dev Contract is expected to be used as proxy implementation.
/// @dev Initialize the implementation to prevent Parity hack.
Expand Down
2 changes: 1 addition & 1 deletion ethereum/contracts/governance/Governance.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract Governance is IGovernance, Ownable2Step {
/// @dev - 0 means the operation is not created.
/// @dev - 1 (EXECUTED_PROPOSAL_TIMESTAMP) means the operation is already executed.
/// @dev - any other value means timestamp in seconds when the operation will be ready for execution.
mapping(bytes32 => uint256) public timestamps;
mapping(bytes32 operationId => uint256 executionTimestamp) public timestamps;

/// @notice The minimum delay in seconds for operations to be ready for execution.
uint256 public minDelay;
Expand Down
10 changes: 5 additions & 5 deletions ethereum/contracts/zksync/Storage.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ struct AppStorage {
/// @notice Address that the governor proposed as one that will replace it
address pendingGovernor;
/// @notice List of permitted validators
mapping(address => bool) validators;
mapping(address validatorAddress => bool isValidator) validators;
/// @dev Verifier contract. Used to verify aggregated proof for batches
IVerifier verifier;
/// @notice Total number of executed batches i.e. batches[totalBatchesExecuted] points at the latest executed batch
Expand All @@ -120,9 +120,9 @@ struct AppStorage {
/// batch
uint256 totalBatchesCommitted;
/// @dev Stored hashed StoredBatch for batch number
mapping(uint256 => bytes32) storedBatchHashes;
mapping(uint256 batchNumber => bytes32 batchHash) storedBatchHashes;
/// @dev Stored root hashes of L2 -> L1 logs
mapping(uint256 => bytes32) l2LogsRootHashes;
mapping(uint256 batchNumber => bytes32 l2LogsRootHash) l2LogsRootHashes;
/// @dev Container that stores transactions requested from L1
PriorityQueue.Queue priorityQueue;
/// @dev The smart contract that manages the list with permission to call contract functions
Expand All @@ -148,13 +148,13 @@ struct AppStorage {
/// @dev The L2 -> L1 log is sent for every withdrawal, so this mapping is serving as
/// a flag to indicate that the message was already processed.
/// @dev Used to indicate that eth withdrawal was already processed
mapping(uint256 => mapping(uint256 => bool)) isEthWithdrawalFinalized;
mapping(uint256 l2BatchNumber => mapping(uint256 l2ToL1MessageNumber => bool isFinalized)) isEthWithdrawalFinalized;
/// @dev The most recent withdrawal time and amount reset
uint256 __DEPRECATED_lastWithdrawalLimitReset;
/// @dev The accumulated withdrawn amount during the withdrawal limit window
uint256 __DEPRECATED_withdrawnAmountInWindow;
/// @dev A mapping user address => the total deposited amount by the user
mapping(address => uint256) totalDepositedAmountPerUser;
mapping(address => uint256) __DEPRECATED_totalDepositedAmountPerUser;
/// @dev Stores the protocol version. Note, that the protocol version may not only encompass changes to the
/// smart contracts, but also to the node behavior.
uint256 protocolVersion;
Expand Down
4 changes: 2 additions & 2 deletions ethereum/contracts/zksync/libraries/Diamond.sol
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ library Diamond {
/// @param facets The array of all unique facet addresses that belong to the diamond proxy
/// @param isFrozen Denotes whether the diamond proxy is frozen and all freezable facets are not accessible
struct DiamondStorage {
mapping(bytes4 => SelectorToFacet) selectorToFacet;
mapping(address => FacetToSelectors) facetToSelectors;
mapping(bytes4 selector => SelectorToFacet selectorInfo) selectorToFacet;
mapping(address facetAddress => FacetToSelectors facetInfo) facetToSelectors;
address[] facets;
bool isFrozen;
}
Expand Down
2 changes: 1 addition & 1 deletion ethereum/contracts/zksync/libraries/LibMap.sol
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ pragma solidity 0.8.20;
library LibMap {
/// @dev A uint32 map in storage.
struct Uint32Map {
mapping(uint256 => uint256) map;
mapping(uint256 packedIndex => uint256 eightPackedValues) map;
}

/// @dev Retrieves the uint32 value at a specific index from the Uint32Map.
Expand Down
2 changes: 1 addition & 1 deletion ethereum/contracts/zksync/libraries/PriorityQueue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ library PriorityQueue {
/// @param head The pointer to the first unprocessed priority operation, equal to the tail if the queue is empty
/// @param tail The pointer to the free slot
struct Queue {
mapping(uint256 => PriorityOperation) data;
mapping(uint256 priorityOpId => PriorityOperation priorityOp) data;
uint256 tail;
uint256 head;
}
Expand Down
2 changes: 1 addition & 1 deletion zksync/contracts/bridge/L2ERC20Bridge.sol
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ contract L2ERC20Bridge is IL2Bridge, Initializable {
bytes32 internal l2TokenProxyBytecodeHash;

/// @dev A mapping l2 token address => l1 token address
mapping(address => address) public override l1TokenAddress;
mapping(address l2TokenAddress => address l1TokenAddress) public override l1TokenAddress;

/// @dev Contract is expected to be used as proxy implementation.
/// @dev Disable the initialization to prevent Parity hack.
Expand Down
Loading