Skip to content

Commit bb0d1bd

Browse files
authored
Merge pull request #763 from matter-labs/dvush/add-events-from-pending-withdrawals-pr
Cherry pick contract events
2 parents 14424a6 + 54e6f78 commit bb0d1bd

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

contracts/contracts/Events.sol

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,21 +54,37 @@ interface Events {
5454
uint256 expirationBlock
5555
);
5656

57+
/// @notice Deposit committed event.
5758
event DepositCommit(
58-
uint32 indexed franklinBlockId,
59+
uint32 indexed zkSyncBlockId,
5960
uint32 indexed accountId,
6061
address owner,
6162
uint16 indexed tokenId,
6263
uint128 amount
6364
);
6465

66+
/// @notice Full exit committed event.
6567
event FullExitCommit(
66-
uint32 indexed franklinBlockId,
68+
uint32 indexed zkSyncBlockId,
6769
uint32 indexed accountId,
6870
address owner,
6971
uint16 indexed tokenId,
7072
uint128 amount
7173
);
74+
75+
/// @notice Pending withdrawals index range that were added in the verifyBlock operation.
76+
/// NOTE: processed indexes in the queue map are [queueStartIndex, queueEndIndex)
77+
event PendingWithdrawalsAdd(
78+
uint32 queueStartIndex,
79+
uint32 queueEndIndex
80+
);
81+
82+
/// @notice Pending withdrawals index range that were executed in the completeWithdrawals operation.
83+
/// NOTE: processed indexes in the queue map are [queueStartIndex, queueEndIndex)
84+
event PendingWithdrawalsComplete(
85+
uint32 queueStartIndex,
86+
uint32 queueEndIndex
87+
);
7288
}
7389

7490
/// @title Upgrade events

contracts/contracts/ZkSync.sol

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,9 @@ contract ZkSync is UpgradeableMaster, Storage, Config, Events, ReentrancyGuard {
138138
}
139139
}
140140
}
141+
if (toProcess > 0) {
142+
emit PendingWithdrawalsComplete(startIndex, startIndex + toProcess);
143+
}
141144
}
142145

143146
/// @notice Accrues users balances from deposit priority requests in Exodus mode
@@ -686,8 +689,11 @@ contract ZkSync is UpgradeableMaster, Storage, Config, Events, ReentrancyGuard {
686689
withdrawalsDataHash = keccak256(abi.encode(withdrawalsDataHash, addToPendingWithdrawalsQueue, _to, _tokenId, _amount));
687690
offset += ONCHAIN_WITHDRAWAL_BYTES;
688691
}
689-
numberOfPendingWithdrawals = localNumberOfPendingWithdrawals;
690692
require(withdrawalsDataHash == expectedWithdrawalsDataHash, "pow12"); // pow12 - withdrawals data hash not matches with expected value
693+
if (numberOfPendingWithdrawals != localNumberOfPendingWithdrawals) {
694+
emit PendingWithdrawalsAdd(firstPendingWithdrawalIndex + numberOfPendingWithdrawals, firstPendingWithdrawalIndex + localNumberOfPendingWithdrawals);
695+
}
696+
numberOfPendingWithdrawals = localNumberOfPendingWithdrawals;
691697
}
692698

693699
/// @notice Checks whether oldest unverified block has expired

0 commit comments

Comments
 (0)