Skip to content

Commit

Permalink
review
Browse files Browse the repository at this point in the history
  • Loading branch information
TonioMacaronio committed Jan 20, 2020
1 parent 31f3c8a commit 35b18c7
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ push-image-rust: image-rust
deploy-contracts: confirm_action
@bin/deploy-contracts.sh

test-contracts: confirm_action
test-contracts: confirm_action build-contracts
@bin/contracts-test.sh

build-contracts: confirm_action flatten
Expand Down
4 changes: 2 additions & 2 deletions contracts/contracts/Franklin.sol
Original file line number Diff line number Diff line change
Expand Up @@ -225,13 +225,13 @@ contract Franklin {
/// @notice Accrues users balances from deposit priority requests in Exodus mode
/// @dev WARNING: Only for Exodus mode
/// @dev Canceling may take several separate transactions to be completed
/// @dev getOutstandingDeposits returns only limited number of deposits so as not to go beyond the block gas limit
/// @dev popOutstandingDeposits returns only limited number of deposits so as not to go beyond the block gas limit
function cancelOutstandingDepositsForExodusMode() external {
require(
exodusMode,
"frс11"
); // frс11 - exodus mode is not activated
bytes memory depositsPubData = priorityQueue.getOutstandingDeposits();
bytes memory depositsPubData = priorityQueue.popOutstandingDeposits();
uint64 i = 0;
while (i < depositsPubData.length) {
bytes memory deposit = Bytes.slice(depositsPubData, i, ETH_ADDR_BYTES+TOKEN_BYTES+AMOUNT_BYTES);
Expand Down
7 changes: 4 additions & 3 deletions contracts/contracts/PriorityQueue.sol
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ contract PriorityQueue {
/// @notice Concates open (outstanding) deposit requests public data up to defined deposits number
/// @dev Deletes processed requests. Number of request is determined in MAX_OUTSTANDING_DEPOSITS_TO_CANCEL_IN_ONE_CALL
/// @return concated deposits public data for limited number of deposits so as not to go beyond the block gas limit in the caller function
function getOutstandingDeposits() external returns (bytes memory depositsPubData) {
function popOutstandingDeposits() external returns (bytes memory depositsPubData) {
requireFranklin();
require(
totalOpenPriorityRequests > 0,
Expand All @@ -178,8 +178,9 @@ contract PriorityQueue {
delete priorityRequests[i];
i++;
}
firstPriorityRequestId += i - firstPriorityRequestId;
totalOpenPriorityRequests -= i - firstPriorityRequestId;
uint64 numberDeleted = i - firstPriorityRequestId;
firstPriorityRequestId = i;
totalOpenPriorityRequests -= numberDeleted;
}

/// @notice Compares Rollup operation with corresponding priority requests' operation
Expand Down
2 changes: 1 addition & 1 deletion contracts/test/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ export function createDepositPublicData(tokenId, hexAmount: string, franklinAddr
const amountBytes = Buffer.from(hexAmount, "hex");
const pad1BytesLength = 16 - amountBytes.length;
const pad1Bytes = Buffer.alloc(pad1BytesLength, 0);
if (franklinAddress.charAt(0) === "0" && franklinAddress.charAt(1) === "x") {
if (franklinAddress.startsWith("0x")) {
franklinAddress = franklinAddress.substr(2);
}
const addressBytes = Buffer.from(franklinAddress, "hex");
Expand Down

0 comments on commit 35b18c7

Please sign in to comment.