Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit 70250d8

Browse files
resolve and un-skip issues: web3.js#6320 and web3.js#6317
1 parent 36f6591 commit 70250d8

File tree

6 files changed

+153
-98
lines changed

6 files changed

+153
-98
lines changed

packages/debugger/test/data/more-decoding.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -428,7 +428,7 @@ describe("Further Decoding", function () {
428428
});
429429

430430
it("Decodes elementary types and mappings correctly", async function () {
431-
this.timeout(12000);
431+
this.timeout(20000);
432432

433433
let instance = await abstractions.ElementaryTest.deployed();
434434
let receipt = await instance.run();

packages/debugger/test/data/returnvalue.js

Lines changed: 54 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -292,9 +292,7 @@ describe("Return value decoding", function () {
292292
);
293293
});
294294

295-
// TODO: un-skip once the following issue have been resolved:
296-
// https://github.com/web3/web3.js/issues/6320
297-
it.skip("Decodes messageless revert", async function () {
295+
it("Decodes messageless revert", async function () {
298296
this.timeout(9000);
299297

300298
//HACK: because this transaction makes web3 throw, we have to extract the hash from
@@ -303,9 +301,11 @@ describe("Return value decoding", function () {
303301
let instance = await abstractions.ReturnValues.deployed();
304302
let txHash;
305303
try {
306-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
307-
// https://github.com/web3/web3.js/issues/6317
308-
await instance.fail({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
304+
// this will throw because of the revert inside the contract method
305+
await instance.fail(
306+
{ gas: testDefaultTxGasLimit },
307+
{ checkRevertBeforeSending: false }
308+
);
309309
} catch (error) {
310310
txHash = error.receipt.transactionHash;
311311
}
@@ -321,9 +321,7 @@ describe("Return value decoding", function () {
321321
assert.strictEqual(decoding.kind, "failure");
322322
});
323323

324-
// TODO: un-skip once the following issue have been resolved:
325-
// https://github.com/web3/web3.js/issues/6320
326-
it.skip("Decodes revert string", async function () {
324+
it("Decodes revert string", async function () {
327325
this.timeout(9000);
328326

329327
//HACK: because this transaction makes web3 throw, we have to extract the hash from
@@ -332,9 +330,11 @@ describe("Return value decoding", function () {
332330
let instance = await abstractions.ReturnValues.deployed();
333331
let txHash;
334332
try {
335-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
336-
// https://github.com/web3/web3.js/issues/6317
337-
await instance.failNoisy({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
333+
// this will throw because of the revert inside the contract method
334+
await instance.failNoisy(
335+
{ gas: testDefaultTxGasLimit },
336+
{ checkRevertBeforeSending: false }
337+
);
338338
} catch (error) {
339339
txHash = error.receipt.transactionHash;
340340
}
@@ -357,9 +357,7 @@ describe("Return value decoding", function () {
357357
assert.strictEqual(message, "Noise!");
358358
});
359359

360-
// TODO: un-skip once the following issue have been resolved:
361-
// https://github.com/web3/web3.js/issues/6320
362-
it.skip("Decodes panic code", async function () {
360+
it("Decodes panic code", async function () {
363361
this.timeout(9000);
364362

365363
//HACK: because this transaction makes web3 throw, we have to extract the hash from
@@ -368,9 +366,11 @@ describe("Return value decoding", function () {
368366
let instance = await abstractions.ReturnValues.deployed();
369367
let txHash;
370368
try {
371-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
372-
// https://github.com/web3/web3.js/issues/6317
373-
await instance.panic({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
369+
// this will throw because of the revert inside the contract method
370+
await instance.panic(
371+
{ gas: testDefaultTxGasLimit },
372+
{ checkRevertBeforeSending: false }
373+
);
374374
} catch (error) {
375375
txHash = error.receipt.transactionHash;
376376
}
@@ -395,9 +395,7 @@ describe("Return value decoding", function () {
395395
assert.strictEqual(panicCode, 1);
396396
});
397397

398-
// TODO: un-skip once the following issue have been resolved:
399-
// https://github.com/web3/web3.js/issues/6320
400-
describe.skip("Custom errors", function () {
398+
describe("Custom errors", function () {
401399
it("Decodes custom errors", async function () {
402400
this.timeout(9000);
403401

@@ -407,9 +405,11 @@ describe("Return value decoding", function () {
407405
let instance = await abstractions.ErrorTest.deployed();
408406
let txHash;
409407
try {
410-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
411-
// https://github.com/web3/web3.js/issues/6317
412-
await instance.local({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
408+
// this will throw because of the revert inside the contract method
409+
await instance.local(
410+
{ gas: testDefaultTxGasLimit },
411+
{ checkRevertBeforeSending: false }
412+
);
413413
} catch (error) {
414414
txHash = error.receipt.transactionHash;
415415
}
@@ -449,9 +449,11 @@ describe("Return value decoding", function () {
449449
let instance = await abstractions.ErrorTest.deployed();
450450
let txHash;
451451
try {
452-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
453-
// https://github.com/web3/web3.js/issues/6317
454-
await instance.global({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
452+
// this will throw because of the revert inside the contract method
453+
await instance.global(
454+
{ gas: testDefaultTxGasLimit },
455+
{ checkRevertBeforeSending: false }
456+
);
455457
} catch (error) {
456458
txHash = error.receipt.transactionHash;
457459
}
@@ -481,9 +483,11 @@ describe("Return value decoding", function () {
481483
let instance = await abstractions.ErrorTest.deployed();
482484
let txHash;
483485
try {
484-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
485-
// https://github.com/web3/web3.js/issues/6317
486-
await instance.foreign({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
486+
// this will throw because of the revert inside the contract method
487+
await instance.foreign(
488+
{ gas: testDefaultTxGasLimit },
489+
{ checkRevertBeforeSending: false }
490+
);
487491
} catch (error) {
488492
txHash = error.receipt.transactionHash;
489493
}
@@ -513,9 +517,11 @@ describe("Return value decoding", function () {
513517
let instance = await abstractions.ErrorTest.deployed();
514518
let txHash;
515519
try {
516-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
517-
// https://github.com/web3/web3.js/issues/6317
518-
await instance.inlined({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
520+
// this will throw because of the revert inside the contract method
521+
await instance.inlined(
522+
{ gas: testDefaultTxGasLimit },
523+
{ checkRevertBeforeSending: false }
524+
);
519525
} catch (error) {
520526
txHash = error.receipt.transactionHash;
521527
}
@@ -545,9 +551,11 @@ describe("Return value decoding", function () {
545551
let instance = await abstractions.ErrorTest.deployed();
546552
let txHash;
547553
try {
548-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
549-
// https://github.com/web3/web3.js/issues/6317
550-
await instance.makeCall({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
554+
// this will throw because of the revert inside the contract method
555+
await instance.makeCall(
556+
{ gas: testDefaultTxGasLimit },
557+
{ checkRevertBeforeSending: false }
558+
);
551559
} catch (error) {
552560
txHash = error.receipt.transactionHash;
553561
}
@@ -577,9 +585,11 @@ describe("Return value decoding", function () {
577585
let instance = await abstractions.ErrorTest.deployed();
578586
let txHash;
579587
try {
580-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
581-
// https://github.com/web3/web3.js/issues/6317
582-
await instance.ambiguous({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
588+
// this will throw because of the revert inside the contract method
589+
await instance.ambiguous(
590+
{ gas: testDefaultTxGasLimit },
591+
{ checkRevertBeforeSending: false }
592+
);
583593
} catch (error) {
584594
txHash = error.receipt.transactionHash;
585595
}
@@ -614,9 +624,11 @@ describe("Return value decoding", function () {
614624
let instance = await abstractions.ErrorTest.deployed();
615625
let txHash;
616626
try {
617-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
618-
// https://github.com/web3/web3.js/issues/6317
619-
await instance.ambiguousCall({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
627+
// this will throw because of the revert inside the contract method
628+
await instance.ambiguousCall(
629+
{ gas: testDefaultTxGasLimit },
630+
{ checkRevertBeforeSending: false }
631+
);
620632
} catch (error) {
621633
txHash = error.receipt.transactionHash;
622634
}

packages/debugger/test/endstate.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -68,18 +68,18 @@ describe("End State", function () {
6868
compilations = prepared.compilations;
6969
});
7070

71-
// TODO: un-skip once the following issue have been resolved:
72-
// https://github.com/web3/web3.js/issues/6320
73-
it.skip("correctly marks a failed transaction as failed", async function () {
71+
it("correctly marks a failed transaction as failed", async function () {
7472
const instance = await abstractions.FailureTest.deployed();
7573
//HACK: because this transaction fails, we have to extract the hash from
7674
//the resulting exception (there is supposed to be a non-hacky way but it
7775
//does not presently work)
7876
let txHash;
7977
try {
80-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
81-
// https://github.com/web3/web3.js/issues/6317
82-
await instance.run({ gasLimit: testDefaultTxGasLimit });
78+
// this will throw because of the revert inside the contract method
79+
await instance.run(
80+
{ gas: testDefaultTxGasLimit },
81+
{ checkRevertBeforeSending: false }
82+
);
8383
} catch (error) {
8484
txHash = error.receipt.transactionHash;
8585
}

packages/debugger/test/sourcemapping.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,9 +424,7 @@ describe("Source mapping (location and jumps)", function () {
424424

425425
//NOTE: this is same as previous test except for the transaction run;
426426
//not bothering to factor for now
427-
// TODO: un-skip once the following issue have been resolved:
428-
// https://github.com/web3/web3.js/issues/6320
429-
it.skip("is unaffected by overly large transfers", async function () {
427+
it("is unaffected by overly large transfers", async function () {
430428
const numExpected = 0;
431429

432430
let instance = await abstractions.BadTransferTest.deployed();
@@ -435,9 +433,11 @@ describe("Source mapping (location and jumps)", function () {
435433
//does not presently work)
436434
let txHash;
437435
try {
438-
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
439-
// https://github.com/web3/web3.js/issues/6317
440-
await instance.run({ gasLimit: testDefaultTxGasLimit }); //this will throw because of the revert
436+
// this will throw because of the revert inside the contract method
437+
await instance.run(
438+
{ gas: testDefaultTxGasLimit },
439+
{ checkRevertBeforeSending: false }
440+
);
441441
} catch (error) {
442442
txHash = error.receipt.transactionHash;
443443
}

0 commit comments

Comments
 (0)