Skip to content

Commit

Permalink
fix execute index bug of slaver chain
Browse files Browse the repository at this point in the history
  • Loading branch information
zkcarter committed Dec 2, 2023
1 parent 7dbfdf4 commit f282ab6
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/contracts/zklink.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -890,14 +890,15 @@ mod Zklink {
if i.into() == nBlocks {
break;
}
let _executedBlockIdx = _totalBlocksExecuted + i.into() + 1;
let _blockExecuteData: @ExecuteBlockInfo = _blocksData[i];
assert(
*_blockExecuteData
.storedBlock
.preCommittedBlockNumber == latestExecutedBlockNumber,
'd2'
);
self.executeOneBlock(_blockExecuteData);
self.executeOneBlock(_blockExecuteData, _executedBlockIdx);
priorityRequestsExecuted += *_blockExecuteData.storedBlock.priorityOperations;
latestExecutedBlockNumber = *_blockExecuteData.storedBlock.blockNumber;
i += 1;
Expand Down Expand Up @@ -1520,12 +1521,14 @@ mod Zklink {
// Executes one block
// 1. Processes all pending operations (Send Exits, Complete priority requests)
// 2. Finalizes block on Ethereum
fn executeOneBlock(ref self: ContractState, _blockExecuteData: @ExecuteBlockInfo) {
fn executeOneBlock(
ref self: ContractState, _blockExecuteData: @ExecuteBlockInfo, _executedBlockIdx: u64
) {
// Ensure block was committed
assert(
hashStoredBlockInfo(*_blockExecuteData.storedBlock) == self
.storedBlockHashes
.read(*_blockExecuteData.storedBlock.blockNumber),
.read(_executedBlockIdx),
'm0'
);

Expand Down

0 comments on commit f282ab6

Please sign in to comment.