diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-23 08:41:48 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2018-05-23 08:41:48 +0800 |
commit | ebc750d5bf95da76424da81550a88e6b74de8c36 (patch) | |
tree | 607d46add71ea974b01642848f2794bb44d43f4d /packages/sol-cov/src/coverage_manager.ts | |
parent | d49f2c40ae28bde3574907a72c0fdd84196e8303 (diff) | |
download | dexon-sol-tools-ebc750d5bf95da76424da81550a88e6b74de8c36.tar dexon-sol-tools-ebc750d5bf95da76424da81550a88e6b74de8c36.tar.gz dexon-sol-tools-ebc750d5bf95da76424da81550a88e6b74de8c36.tar.bz2 dexon-sol-tools-ebc750d5bf95da76424da81550a88e6b74de8c36.tar.lz dexon-sol-tools-ebc750d5bf95da76424da81550a88e6b74de8c36.tar.xz dexon-sol-tools-ebc750d5bf95da76424da81550a88e6b74de8c36.tar.zst dexon-sol-tools-ebc750d5bf95da76424da81550a88e6b74de8c36.zip |
Address feedback
Diffstat (limited to 'packages/sol-cov/src/coverage_manager.ts')
-rw-r--r-- | packages/sol-cov/src/coverage_manager.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/packages/sol-cov/src/coverage_manager.ts b/packages/sol-cov/src/coverage_manager.ts index ef893527a..31b0e6fbc 100644 --- a/packages/sol-cov/src/coverage_manager.ts +++ b/packages/sol-cov/src/coverage_manager.ts @@ -125,13 +125,15 @@ export class CoverageManager { } private static _getContractDataIfExists(contractsData: ContractData[], bytecode: string): ContractData | undefined { if (!bytecode.startsWith('0x')) { - throw new Error('0x missing'); + throw new Error(`0x hex prefix missing: ${bytecode}`); } const contractData = _.find(contractsData, contractDataCandidate => { const bytecodeRegex = CoverageManager._bytecodeToBytecodeRegex(contractDataCandidate.bytecode); const runtimeBytecodeRegex = CoverageManager._bytecodeToBytecodeRegex( contractDataCandidate.runtimeBytecode, ); + // We use that function to find by bytecode or runtimeBytecode. Those are quasi-random strings so + // collisions are practically impossible and it allows us to reuse that code return !_.isNull(bytecode.match(bytecodeRegex)) || !_.isNull(bytecode.match(runtimeBytecodeRegex)); }); return contractData; |