Skip to content

Commit

Permalink
fix: gas test
Browse files Browse the repository at this point in the history
  • Loading branch information
Westlad committed Aug 15, 2022
1 parent c02f9b2 commit 4734ece
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"neg-test": "mocha --timeout 0 --bail --exit test/neg-http.mjs",
"neg-test-ropsten": "mocha --timeout 0 --bail --exit test/neg-http.mjs",
"test-e2e-protocol": "LOG_LEVEL=error mocha --timeout 0 --bail --exit test/e2e/protocol/*.test.mjs ",
"test-gas": "mocha --timeout 0 --bail --exit test/e2e/gas.test.mjs ",
"test-gas": "LOG_LEVEL=error mocha --timeout 0 --bail --exit test/e2e/gas.test.mjs ",
"test-circuits": "LOG_LEVEL=error mocha --timeout 0 --bail --exit test/e2e/circuits.test.mjs ",
"test-e2e-tokens": "LOG_LEVEL=error mocha --timeout 0 --bail --exit test/e2e/tokens/*.test.mjs ",
"test-erc20-tokens": "LOG_LEVEL=error mocha --timeout 0 --bail --exit test/e2e/tokens/erc20.test.mjs ",
Expand Down
6 changes: 3 additions & 3 deletions test/adversary.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ describe('Testing with an adversary', () => {
// Chalenger listening for incoming events
const challengerEmitter = await nf3Challenger.startChallenger();

challengerEmitter.on('data', txDataToSign => {
challengerEmitter.on('receipt', txDataToSign => {
logger.debug(`Challenger emitter with data ${txDataToSign}`);
});

Expand All @@ -141,7 +141,7 @@ describe('Testing with an adversary', () => {

console.log('Pausing challenger queue...');
// we pause the challenger queue and don't process challenger until unpauseQueueChallenger
nf3Challenger.pauseQueueChallenger();
await nf3Challenger.pauseQueueChallenger();
});

describe('User creates deposit and transfer transactions', () => {
Expand Down Expand Up @@ -224,7 +224,7 @@ describe('Testing with an adversary', () => {
it('User should have the correct balance after challenge and a series of rollbacks', async () => {
console.log('Unpausing challenger queue...');
// Challenger unpause
await nf3Challenger.unpauseQueueChallenger();
nf3Challenger.unpauseQueueChallenger();
// waiting sometime to ensure that all the good transactions from bad
// blocks were proposed in other good blocks
console.log('Waiting for rollbacks...');
Expand Down
10 changes: 5 additions & 5 deletions test/e2e/gas.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('Gas test', () => {
tokenId,
0,
);
eventLogs = await web3Client.waitForEvent(eventLogs, ['blockProposed']);
({ eventLogs } = await web3Client.waitForEvent(eventLogs, ['blockProposed']));

expect(gasCost).to.be.lessThan(expectedGasCostPerTx);
});
Expand All @@ -97,7 +97,7 @@ describe('Gas test', () => {
tokenId,
0,
);
eventLogs = await web3Client.waitForEvent(eventLogs, ['blockProposed']);
({ eventLogs } = await web3Client.waitForEvent(eventLogs, ['blockProposed']));
expect(gasCost).to.be.lessThan(expectedGasCostPerTx);
console.log('Deposit L1 average gas used was', averageL1GasCost(receipts));
});
Expand All @@ -116,7 +116,7 @@ describe('Gas test', () => {
nf3Users[0].zkpKeys.compressedZkpPublicKey,
0,
);
eventLogs = await web3Client.waitForEvent(eventLogs, ['blockProposed']);
({ eventLogs } = await web3Client.waitForEvent(eventLogs, ['blockProposed']));
expect(gasCost).to.be.lessThan(expectedGasCostPerTx);
console.log(
'Single transfer L1 average gas used, if on-chain, was',
Expand All @@ -138,7 +138,7 @@ describe('Gas test', () => {
nf3Users[0].zkpKeys.compressedZkpPublicKey,
0,
);
eventLogs = await web3Client.waitForEvent(eventLogs, ['blockProposed']);
({ eventLogs } = await web3Client.waitForEvent(eventLogs, ['blockProposed']));
expect(gasCost).to.be.lessThan(expectedGasCostPerTx);
console.log(
'Double transfer L1 average gas used, if on-chain, was',
Expand All @@ -161,7 +161,7 @@ describe('Gas test', () => {
0,
);
await nf3Users[0].makeBlockNow();
eventLogs = await web3Client.waitForEvent(eventLogs, ['blockProposed']);
({ eventLogs } = await web3Client.waitForEvent(eventLogs, ['blockProposed']));
expect(gasCost).to.be.lessThan(expectedGasCostPerTx);
console.log('Withdraw L1 average gas used, if on-chain, was', averageL1GasCost(receipts));
});
Expand Down

0 comments on commit 4734ece

Please sign in to comment.