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

Commit

Permalink
resolve and un-skip issues: web3.js#6320 and web3.js#6317
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammad-Altabba committed Sep 22, 2023
1 parent 36f6591 commit 70250d8
Show file tree
Hide file tree
Showing 6 changed files with 153 additions and 98 deletions.
2 changes: 1 addition & 1 deletion packages/debugger/test/data/more-decoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ describe("Further Decoding", function () {
});

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

let instance = await abstractions.ElementaryTest.deployed();
let receipt = await instance.run();
Expand Down
96 changes: 54 additions & 42 deletions packages/debugger/test/data/returnvalue.js
Original file line number Diff line number Diff line change
Expand Up @@ -292,9 +292,7 @@ describe("Return value decoding", function () {
);
});

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

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

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

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

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

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

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

Expand All @@ -407,9 +405,11 @@ describe("Return value decoding", function () {
let instance = await abstractions.ErrorTest.deployed();
let txHash;
try {
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
// https://github.com/web3/web3.js/issues/6317
await instance.local({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
// this will throw because of the revert inside the contract method
await instance.local(
{ gas: testDefaultTxGasLimit },
{ checkRevertBeforeSending: false }
);
} catch (error) {
txHash = error.receipt.transactionHash;
}
Expand Down Expand Up @@ -449,9 +449,11 @@ describe("Return value decoding", function () {
let instance = await abstractions.ErrorTest.deployed();
let txHash;
try {
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
// https://github.com/web3/web3.js/issues/6317
await instance.global({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
// this will throw because of the revert inside the contract method
await instance.global(
{ gas: testDefaultTxGasLimit },
{ checkRevertBeforeSending: false }
);
} catch (error) {
txHash = error.receipt.transactionHash;
}
Expand Down Expand Up @@ -481,9 +483,11 @@ describe("Return value decoding", function () {
let instance = await abstractions.ErrorTest.deployed();
let txHash;
try {
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
// https://github.com/web3/web3.js/issues/6317
await instance.foreign({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
// this will throw because of the revert inside the contract method
await instance.foreign(
{ gas: testDefaultTxGasLimit },
{ checkRevertBeforeSending: false }
);
} catch (error) {
txHash = error.receipt.transactionHash;
}
Expand Down Expand Up @@ -513,9 +517,11 @@ describe("Return value decoding", function () {
let instance = await abstractions.ErrorTest.deployed();
let txHash;
try {
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
// https://github.com/web3/web3.js/issues/6317
await instance.inlined({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
// this will throw because of the revert inside the contract method
await instance.inlined(
{ gas: testDefaultTxGasLimit },
{ checkRevertBeforeSending: false }
);
} catch (error) {
txHash = error.receipt.transactionHash;
}
Expand Down Expand Up @@ -545,9 +551,11 @@ describe("Return value decoding", function () {
let instance = await abstractions.ErrorTest.deployed();
let txHash;
try {
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
// https://github.com/web3/web3.js/issues/6317
await instance.makeCall({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
// this will throw because of the revert inside the contract method
await instance.makeCall(
{ gas: testDefaultTxGasLimit },
{ checkRevertBeforeSending: false }
);
} catch (error) {
txHash = error.receipt.transactionHash;
}
Expand Down Expand Up @@ -577,9 +585,11 @@ describe("Return value decoding", function () {
let instance = await abstractions.ErrorTest.deployed();
let txHash;
try {
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
// https://github.com/web3/web3.js/issues/6317
await instance.ambiguous({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
// this will throw because of the revert inside the contract method
await instance.ambiguous(
{ gas: testDefaultTxGasLimit },
{ checkRevertBeforeSending: false }
);
} catch (error) {
txHash = error.receipt.transactionHash;
}
Expand Down Expand Up @@ -614,9 +624,11 @@ describe("Return value decoding", function () {
let instance = await abstractions.ErrorTest.deployed();
let txHash;
try {
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
// https://github.com/web3/web3.js/issues/6317
await instance.ambiguousCall({ gasLimit: testDefaultTxGasLimit }); //web3 throws on failure
// this will throw because of the revert inside the contract method
await instance.ambiguousCall(
{ gas: testDefaultTxGasLimit },
{ checkRevertBeforeSending: false }
);
} catch (error) {
txHash = error.receipt.transactionHash;
}
Expand Down
12 changes: 6 additions & 6 deletions packages/debugger/test/endstate.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,18 @@ describe("End State", function () {
compilations = prepared.compilations;
});

// TODO: un-skip once the following issue have been resolved:
// https://github.com/web3/web3.js/issues/6320
it.skip("correctly marks a failed transaction as failed", async function () {
it("correctly marks a failed transaction as failed", async function () {
const instance = await abstractions.FailureTest.deployed();
//HACK: because this transaction fails, we have to extract the hash from
//the resulting exception (there is supposed to be a non-hacky way but it
//does not presently work)
let txHash;
try {
// TODO: investigate why `gas` needed to be replaced with `gasLimit`:
// https://github.com/web3/web3.js/issues/6317
await instance.run({ gasLimit: testDefaultTxGasLimit });
// this will throw because of the revert inside the contract method
await instance.run(
{ gas: testDefaultTxGasLimit },
{ checkRevertBeforeSending: false }
);
} catch (error) {
txHash = error.receipt.transactionHash;
}
Expand Down
12 changes: 6 additions & 6 deletions packages/debugger/test/sourcemapping.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,9 +424,7 @@ describe("Source mapping (location and jumps)", function () {

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

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

0 comments on commit 70250d8

Please sign in to comment.