Skip to content

Commit

Permalink
Fix notify and return old test
Browse files Browse the repository at this point in the history
  • Loading branch information
perekopskiy committed May 26, 2021
1 parent beaf1f8 commit a585298
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 12 deletions.
10 changes: 2 additions & 8 deletions core/tests/ts-tests/tests/transfer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,20 +119,14 @@ Tester.prototype.testIgnoredBatch = async function (
{ ...tx, amount: amount.mul(10 ** 6) }
]);

// One correct tx is needed because block will not be committed if it contains only rejected txs.
const handle = await sender.syncTransfer(tx);

for (const handle of handles) {
await suppress(handle.awaitReceipt());
}
await handle.awaitReceipt();

const senderAfter = await sender.getBalance(token);
const receiverAfter = await receiver.getBalance(token);
expect(senderBefore.eq(senderAfter.add(amount).add(fee.div(2))), 'Wrong batch was not ignored').to.be.true;
expect(receiverAfter.eq(receiverBefore.add(amount)), 'Wrong batch was not ignored').to.be.true;

this.runningFee = this.runningFee.add(fee.div(2));
expect(senderBefore.eq(senderAfter), 'Wrong batch was not ignored').to.be.true;
expect(receiverAfter.eq(receiverBefore), 'Wrong batch was not ignored').to.be.true;
};

Tester.prototype.testRejectedBatch = async function (
Expand Down
8 changes: 4 additions & 4 deletions sdk/zksync.js/src/rest-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ export class RestProvider extends SyncProvider {
// it cannot be known if transaction is queued, committed or finalized.
// That is why there is separate `blockByPosition` query.
const blockStatus = await this.blockByPosition(transactionStatus.rollupBlock);
notifyDone = blockStatus.status === 'finalized';
notifyDone = blockStatus && blockStatus.status === 'finalized';
} else {
notifyDone = transactionStatus.status === 'finalized';
}
Expand Down Expand Up @@ -568,9 +568,9 @@ export class RestProvider extends SyncProvider {
if (receipt.status === 'rejected') {
const blockFullInfo = await this.blockByPosition(receipt.rollupBlock);
const blockInfo = {
blockNumber: blockFullInfo.blockNumber,
committed: <boolean>(<any>blockFullInfo.commitTxHash),
verified: <boolean>(<any>blockFullInfo.verifyTxHash)
blockNumber: receipt.rollupBlock,
committed: blockFullInfo ? true : false,
verified: blockFullInfo && blockFullInfo.status === 'finalized' ? true : false
};
return {
executed: true,
Expand Down

0 comments on commit a585298

Please sign in to comment.