aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov/src
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sol-cov/src')
-rw-r--r--packages/sol-cov/src/trace_collection_subprovider.ts11
-rw-r--r--packages/sol-cov/src/utils.ts2
2 files changed, 9 insertions, 4 deletions
diff --git a/packages/sol-cov/src/trace_collection_subprovider.ts b/packages/sol-cov/src/trace_collection_subprovider.ts
index ffa33ad41..a6af7d4d2 100644
--- a/packages/sol-cov/src/trace_collection_subprovider.ts
+++ b/packages/sol-cov/src/trace_collection_subprovider.ts
@@ -132,19 +132,22 @@ export class TraceCollectionSubprovider extends Subprovider {
// And we don't want it to be executed within a snapshotting period
await this._lock.acquire();
}
+ const NULL_ADDRESS = '0x0';
if (_.isNull(err)) {
- const toAddress = _.isUndefined(txData.to) || txData.to === '0x0' ? constants.NEW_CONTRACT : txData.to;
+ const toAddress =
+ _.isUndefined(txData.to) || txData.to === NULL_ADDRESS ? constants.NEW_CONTRACT : txData.to;
await this._recordTxTraceAsync(toAddress, txData.data, txHash as string);
} else {
const latestBlock = await this._web3Wrapper.getBlockWithTransactionDataAsync(BlockParamLiteral.Latest);
const transactions = latestBlock.transactions;
for (const transaction of transactions) {
- const toAddress = _.isUndefined(txData.to) || txData.to === '0x0' ? constants.NEW_CONTRACT : txData.to;
+ const toAddress =
+ _.isUndefined(txData.to) || txData.to === NULL_ADDRESS ? constants.NEW_CONTRACT : txData.to;
await this._recordTxTraceAsync(toAddress, transaction.input, transaction.hash);
}
}
if (!txData.isFakeTransaction) {
- // This transaction is a usual ttransaction. Not a call executed as one.
+ // This transaction is a usual transaction. Not a call executed as one.
// And we don't want it to be executed within a snapshotting period
this._lock.release();
}
@@ -230,6 +233,7 @@ export class TraceCollectionSubprovider extends Subprovider {
await this._web3Wrapper.awaitTransactionMinedAsync(txHash);
} catch (err) {
// Even if this transaction failed - we've already recorded it's trace.
+ _.noop();
}
await blockchainLifecycle.revertAsync();
this._lock.release();
@@ -251,6 +255,7 @@ export class TraceCollectionSubprovider extends Subprovider {
await this._web3Wrapper.awaitTransactionMinedAsync(txHash);
} catch (err) {
// Even if this transaction failed - we've already recorded it's trace.
+ _.noop();
}
await blockchainLifecycle.revertAsync();
this._lock.release();
diff --git a/packages/sol-cov/src/utils.ts b/packages/sol-cov/src/utils.ts
index 7333b2f4d..0b32df02e 100644
--- a/packages/sol-cov/src/utils.ts
+++ b/packages/sol-cov/src/utils.ts
@@ -24,7 +24,7 @@ export const utils = {
.replace(/.{86}$/, '')
// Libraries contain their own address at the beginning of the code and it's impossible to know it in advance
.replace(/^0x730000000000000000000000000000000000000000/, '0x73........................................');
- // HACK: Node regexes can't be longer that 32767 characters. Contracts bytecode can. We jsut truncate the regexes. It's safe in practice.
+ // HACK: Node regexes can't be longer that 32767 characters. Contracts bytecode can. We just truncate the regexes. It's safe in practice.
const MAX_REGEX_LENGTH = 32767;
const truncatedBytecodeRegex = bytecodeRegex.slice(0, MAX_REGEX_LENGTH);
return truncatedBytecodeRegex;