Skip to content

Commit

Permalink
Merge pull request #703 from sc-forks/patch-experimental-options
Browse files Browse the repository at this point in the history
Fixes for beta release
  • Loading branch information
cgewecke authored Mar 29, 2022
2 parents 498b8cd + 2cbef21 commit a475216
Show file tree
Hide file tree
Showing 12 changed files with 49 additions and 41 deletions.
6 changes: 2 additions & 4 deletions lib/parse.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,14 @@ parse.BinaryOperation = function(contract, expression, skipStatementRegistry) {
// Free-floating ternary conditional
if (expression.left && expression.left.type === 'Conditional'){
parse[expression.left.type](contract, expression.left, true);
register.statement(contract, expression);

// Ternary conditional assignment
} else if (expression.right && expression.right.type === 'Conditional'){
parse[expression.right.type](contract, expression.right, true);
register.statement(contract, expression);

// Regular binary operation
} else if(!skipStatementRegistry){
register.statement(contract, expression);
// noop

// LogicalOR condition search...
} else {
Expand Down Expand Up @@ -89,7 +87,7 @@ parse.FunctionCall = function(contract, expression, skipStatementRegistry) {

parse.Conditional = function(contract, expression, skipStatementRegistry) {
parse[expression.condition.type] &&
parse[expression.condition.type](contract, expression.condition, skipStatementRegistry);
parse[expression.condition.type](contract, expression.condition, true);

register.conditional(contract, expression);
};
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
"license": "ISC",
"dependencies": {
"@ethersproject/abi": "^5.0.9",
"@solidity-parser/parser": "^0.11.0",
"@solidity-parser/parser": "^0.14.1",
"@truffle/provider": "^0.2.24",
"chalk": "^2.4.2",
"death": "^1.1.0",
Expand Down
2 changes: 1 addition & 1 deletion plugins/hardhat.plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ task("coverage", "Generates a code coverage report for tests")
api = new API(utils.loadSolcoverJS(config));

// Catch interrupt signals
process.on("SIGINT", nomiclabsUtils.finish.bind(null, config, api));
process.on("SIGINT", nomiclabsUtils.finish.bind(null, config, api, true));

// Version Info
ui.report('hardhat-versions', [pkg.version]);
Expand Down
4 changes: 3 additions & 1 deletion plugins/resources/nomiclabs.utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,7 @@ function configureHardhatEVMGas(networkConfig, api){
networkConfig.blockGasLimit = api.gasLimitNumber;
networkConfig.gas = api.gasLimit;
networkConfig.gasPrice = api.gasPrice;
networkConfig.initialBaseFeePerGas = 0;
}

function configureNetworkEnv(env, networkName, networkConfig, provider, isHardhatEVM){
Expand Down Expand Up @@ -239,7 +240,7 @@ function tempCacheDir(config){
* @param {SolidityCoverage} api
* @return {Promise}
*/
async function finish(config, api){
async function finish(config, api, shouldKill){
const {
tempContractsDir,
tempArtifactsDir
Expand All @@ -252,6 +253,7 @@ async function finish(config, api){
shell.config.silent = false;

if (api) await api.finish();
if (shouldKill) process.exit(1)
}

module.exports = {
Expand Down
22 changes: 11 additions & 11 deletions test/units/conditional.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ describe('ternary conditionals', () => {
1: [1, 0],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -50,7 +50,7 @@ describe('ternary conditionals', () => {
1: [1, 0],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -67,7 +67,7 @@ describe('ternary conditionals', () => {
1: [1, 0],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -84,7 +84,7 @@ describe('ternary conditionals', () => {
1: [0, 1], 2: [1, 0],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -101,7 +101,7 @@ describe('ternary conditionals', () => {
1: [0, 1], 2: [1, 0],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -118,7 +118,7 @@ describe('ternary conditionals', () => {
1: [0, 0], 2: [0, 1],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -135,7 +135,7 @@ describe('ternary conditionals', () => {
1: [0, 1],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -152,7 +152,7 @@ describe('ternary conditionals', () => {
1: [1, 0],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -169,7 +169,7 @@ describe('ternary conditionals', () => {
1: [0, 1],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand Down Expand Up @@ -205,7 +205,7 @@ describe('ternary conditionals', () => {
1: [0, 1],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1, 4: 1,
1: 1, 2: 1, 3: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -222,7 +222,7 @@ describe('ternary conditionals', () => {
1: [0, 1],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1,
1: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand Down
2 changes: 1 addition & 1 deletion test/units/function.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ describe('function declarations', () => {
});
assert.deepEqual(mapping[util.filePath].b, {});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1
1: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand Down
18 changes: 9 additions & 9 deletions test/units/if.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ describe('if, else, and else if statements', () => {
1: [1, 0],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1,
1: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -60,7 +60,7 @@ describe('if, else, and else if statements', () => {
1: [1, 0],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1,
1: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -82,7 +82,7 @@ describe('if, else, and else if statements', () => {
1: [1, 0],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1,
1: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -105,7 +105,7 @@ describe('if, else, and else if statements', () => {
1: [1, 0],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1,
1: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -127,7 +127,7 @@ describe('if, else, and else if statements', () => {
1: [0, 1],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 0,
1: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -149,7 +149,7 @@ describe('if, else, and else if statements', () => {
1: [0, 1],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 0, 3: 1,
1: 1, 2: 0,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -170,7 +170,7 @@ describe('if, else, and else if statements', () => {
1: [0, 1],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 0, 3: 1,
1: 1, 2: 0,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -192,7 +192,7 @@ describe('if, else, and else if statements', () => {
1: [0, 1], 2: [0, 1]
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 0, 3: 1, 4: 0
1: 1, 2: 0, 3: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand Down Expand Up @@ -235,7 +235,7 @@ describe('if, else, and else if statements', () => {
1: [0, 1], 2: [1, 0], 3: [0, 1], 4: [1, 0]
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 0, 3: 1, 4: 1, 5: 0, 6: 1, 7: 0, 8: 1, 9: 1, 10: 0,
1: 1, 2: 1, 3: 1, 4: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand Down
4 changes: 2 additions & 2 deletions test/units/loops.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('for and while statements', () => {
});
assert.deepEqual(mapping[util.filePath].b, {});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -85,7 +85,7 @@ describe('for and while statements', () => {
});
assert.deepEqual(mapping[util.filePath].b, {});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand Down
4 changes: 2 additions & 2 deletions test/units/modifiers.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ describe('modifiers', () => {
1: [1, 2], 2: [1, 2],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 3, 2: 1, 3: 1,
1: 3, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 3, 2: 1, 3: 1
Expand Down Expand Up @@ -187,7 +187,7 @@ describe('modifiers', () => {
"1":[3,0],"2":[1,2],"3":[3,0],"4":[1,2]
});
assert.deepEqual(mapping[util.filePath].s, {
"1":3,"2":3,"3":1,"4":1
"1":3,"2":3,"3":1,
});
assert.deepEqual(mapping[util.filePath].f, {
"1":3,"2":3,"3":1,"4":1
Expand Down
4 changes: 2 additions & 2 deletions test/units/options.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ describe('measureCoverage options', () => {
});
assert.deepEqual(mapping[util.filePath].b, {});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1,
1: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -76,7 +76,7 @@ describe('measureCoverage options', () => {
assert.deepEqual(mapping[util.filePath].b, {});

assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand Down
6 changes: 3 additions & 3 deletions test/units/statements.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ describe('generic statements', () => {
1: [0, 1],
});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 0, 3: 1,
1: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1,
Expand All @@ -130,7 +130,7 @@ describe('generic statements', () => {
});
assert.deepEqual(mapping[util.filePath].b, {});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1, 2: 1,
Expand All @@ -148,7 +148,7 @@ describe('generic statements', () => {
});
assert.deepEqual(mapping[util.filePath].b, {});
assert.deepEqual(mapping[util.filePath].s, {
1: 1, 2: 1, 3: 1,
1: 1, 2: 1,
});
assert.deepEqual(mapping[util.filePath].f, {
1: 1, 2: 1,
Expand Down
16 changes: 12 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -609,10 +609,12 @@
version "0.7.0"
resolved "https://registry.yarnpkg.com/@sindresorhus/is/-/is-0.7.0.tgz#9a06f4f137ee84d7df0460c1fdb1135ffa6c50fd"

"@solidity-parser/parser@^0.11.0":
version "0.11.0"
resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.11.0.tgz#28bc1972e1620f7b388b485bca76a78ac2cb5c59"
integrity sha512-IaC4IaW8uoOB8lmEkw6c19y1vJBK/+7SzAbGQ+LmBYRPXSLNB+UgpORvmcAJEXhB04kWKyz/Os1U8onqm6U/+w==
"@solidity-parser/parser@^0.14.1":
version "0.14.1"
resolved "https://registry.yarnpkg.com/@solidity-parser/parser/-/parser-0.14.1.tgz#179afb29f4e295a77cc141151f26b3848abc3c46"
integrity sha512-eLjj2L6AuQjBB6s/ibwCAc0DwrR5Ge+ys+wgWo+bviU7fV2nTMQhU63CGaDKXg9iTmMxwhkyoggdIR7ZGRfMgw==
dependencies:
antlr4ts "^0.5.0-alpha.4"

"@solidity-parser/parser@^0.5.2":
version "0.5.2"
Expand Down Expand Up @@ -1008,6 +1010,11 @@ ansi-styles@^4.1.0:
dependencies:
color-convert "^2.0.1"

antlr4ts@^0.5.0-alpha.4:
version "0.5.0-alpha.4"
resolved "https://registry.yarnpkg.com/antlr4ts/-/antlr4ts-0.5.0-alpha.4.tgz#71702865a87478ed0b40c0709f422cf14d51652a"
integrity sha512-WPQDt1B74OfPv/IMS2ekXAKkTZIHl88uMetg6q3OTqgFxZ/dxDXI0EWLyZid/1Pe6hTftyg5N7gel5wNAGxXyQ==

[email protected]:
version "1.3.0"
resolved "https://registry.yarnpkg.com/any-promise/-/any-promise-1.3.0.tgz#abc6afeedcea52e809cdc0376aed3ce39635d17f"
Expand Down Expand Up @@ -7141,6 +7148,7 @@ websocket@^1.0.31:
dependencies:
debug "^2.2.0"
es5-ext "^0.10.50"
gulp "^4.0.2"
nan "^2.14.0"
typedarray-to-buffer "^3.1.5"
yaeti "^0.0.6"
Expand Down

0 comments on commit a475216

Please sign in to comment.