From 6eebd693ce902068c58eac81c8d29cbfd48c1b86 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 11 Jun 2018 16:10:15 -0700 Subject: Fix solidityVersion schema regex --- packages/sol-compiler/src/schemas/compiler_options_schema.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/sol-compiler/src/schemas/compiler_options_schema.ts b/packages/sol-compiler/src/schemas/compiler_options_schema.ts index 43a9c0879..d4d1b6017 100644 --- a/packages/sol-compiler/src/schemas/compiler_options_schema.ts +++ b/packages/sol-compiler/src/schemas/compiler_options_schema.ts @@ -3,7 +3,7 @@ export const compilerOptionsSchema = { properties: { contractsDir: { type: 'string' }, artifactsDir: { type: 'string' }, - solcVersion: { type: 'string', pattern: '^d+.d+.d+$' }, + solcVersion: { type: 'string', pattern: '^\\d+.\\d+.\\d+$' }, compilerSettings: { type: 'object' }, contracts: { oneOf: [ -- cgit v1.2.3 From f4a61b4c70b18cd4eef70eafc79e14b8c0161df3 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 11 Jun 2018 16:10:56 -0700 Subject: Don't throw when no config file is found --- .../src/artifact_adapters/sol_compiler_artifact_adapter.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts index 051782ba4..220a9f98c 100644 --- a/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts +++ b/packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts @@ -1,4 +1,4 @@ -import { ContractArtifact } from '@0xproject/sol-compiler'; +import { CompilerOptions, ContractArtifact } from '@0xproject/sol-compiler'; import { logUtils } from '@0xproject/utils'; import * as fs from 'fs'; import * as glob from 'glob'; @@ -16,15 +16,17 @@ export class SolCompilerArtifactAdapter extends AbstractArtifactAdapter { private _sourcesPath: string; constructor(artifactsPath?: string, sourcesPath?: string) { super(); - const config = JSON.parse(fs.readFileSync(CONFIG_FILE).toString()); + const config: CompilerOptions = fs.existsSync(CONFIG_FILE) + ? JSON.parse(fs.readFileSync(CONFIG_FILE).toString()) + : {}; if (_.isUndefined(artifactsPath) && _.isUndefined(config.artifactsDir)) { throw new Error(`artifactsDir not found in ${CONFIG_FILE}`); } - this._artifactsPath = artifactsPath || config.artifactsDir; + this._artifactsPath = (artifactsPath || config.artifactsDir) as string; if (_.isUndefined(sourcesPath) && _.isUndefined(config.contractsDir)) { throw new Error(`contractsDir not found in ${CONFIG_FILE}`); } - this._sourcesPath = sourcesPath || config.contractsDir; + this._sourcesPath = (sourcesPath || config.contractsDir) as string; } public async collectContractsDataAsync(): Promise { const artifactsGlob = `${this._artifactsPath}/**/*.json`; -- cgit v1.2.3 From 94398d70f4511419f77bd17b25d0060eba08c4dc Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 11 Jun 2018 18:01:33 -0700 Subject: Speed-up sol-cov --- packages/sol-cov/src/trace_collection_subprovider.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/sol-cov/src/trace_collection_subprovider.ts b/packages/sol-cov/src/trace_collection_subprovider.ts index 7500e5bd3..ba9f03897 100644 --- a/packages/sol-cov/src/trace_collection_subprovider.ts +++ b/packages/sol-cov/src/trace_collection_subprovider.ts @@ -163,7 +163,7 @@ export class TraceCollectionSubprovider extends Subprovider { cb(); } private async _recordTxTraceAsync(address: string, data: string | undefined, txHash: string): Promise { - await this._web3Wrapper.awaitTransactionMinedAsync(txHash); + await this._web3Wrapper.awaitTransactionMinedAsync(txHash, 0); const trace = await this._web3Wrapper.getTransactionTraceAsync(txHash, { disableMemory: true, disableStack: false, @@ -222,7 +222,7 @@ export class TraceCollectionSubprovider extends Subprovider { }; try { const txHash = await this._web3Wrapper.sendTransactionAsync(fakeTxData); - await this._web3Wrapper.awaitTransactionMinedAsync(txHash); + await this._web3Wrapper.awaitTransactionMinedAsync(txHash, 0); } catch (err) { // Even if this transaction failed - we've already recorded it's trace. _.noop(); -- cgit v1.2.3 From 05c914691f5b1b90079b73341e3591e6658d5c8b Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Mon, 11 Jun 2018 18:12:32 -0700 Subject: Add CHANGELOGs --- packages/sol-cov/CHANGELOG.json | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/packages/sol-cov/CHANGELOG.json b/packages/sol-cov/CHANGELOG.json index 36f8e1a7d..7e934ad6e 100644 --- a/packages/sol-cov/CHANGELOG.json +++ b/packages/sol-cov/CHANGELOG.json @@ -37,6 +37,18 @@ { "note": "Skip interface artifacts with a warning instead of failing", "pr": 675 + }, + { + "note": "Fix solcVersion regex in parameter validation", + "pr": 690 + }, + { + "note": "Fix a bug when in TruffleArtifactsAdapter causing it to throw if compiler.json is not there", + "pr": 690 + }, + { + "note": "HUGE perf improvements", + "pr": 690 } ] }, -- cgit v1.2.3