diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-06-12 12:55:38 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-12 12:55:38 +0800 |
commit | 387c80e00af6db337f23ad9a762fcb5ca0cd7d09 (patch) | |
tree | b8eb50091625254f9ff50d686e3cd60ef8744cf2 /packages/sol-cov | |
parent | bc0ae6be318a15bf8670a6da9a59d9bdb12cadae (diff) | |
parent | 05c914691f5b1b90079b73341e3591e6658d5c8b (diff) | |
download | dexon-sol-tools-387c80e00af6db337f23ad9a762fcb5ca0cd7d09.tar dexon-sol-tools-387c80e00af6db337f23ad9a762fcb5ca0cd7d09.tar.gz dexon-sol-tools-387c80e00af6db337f23ad9a762fcb5ca0cd7d09.tar.bz2 dexon-sol-tools-387c80e00af6db337f23ad9a762fcb5ca0cd7d09.tar.lz dexon-sol-tools-387c80e00af6db337f23ad9a762fcb5ca0cd7d09.tar.xz dexon-sol-tools-387c80e00af6db337f23ad9a762fcb5ca0cd7d09.tar.zst dexon-sol-tools-387c80e00af6db337f23ad9a762fcb5ca0cd7d09.zip |
Merge pull request #690 from 0xProject/feature/truffle-sol-cov-fixes
Sol-cov fixes
Diffstat (limited to 'packages/sol-cov')
-rw-r--r-- | packages/sol-cov/CHANGELOG.json | 12 | ||||
-rw-r--r-- | packages/sol-cov/src/artifact_adapters/sol_compiler_artifact_adapter.ts | 10 | ||||
-rw-r--r-- | packages/sol-cov/src/trace_collection_subprovider.ts | 4 |
3 files changed, 20 insertions, 6 deletions
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 } ] }, 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<ContractData[]> { const artifactsGlob = `${this._artifactsPath}/**/*.json`; diff --git a/packages/sol-cov/src/trace_collection_subprovider.ts b/packages/sol-cov/src/trace_collection_subprovider.ts index 8b5168c45..fe73546e8 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<void> { - 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(); |