aboutsummaryrefslogtreecommitdiffstats
path: root/packages/sol-cov
diff options
context:
space:
mode:
Diffstat (limited to 'packages/sol-cov')
-rw-r--r--packages/sol-cov/src/coverage_subprovider.ts8
-rw-r--r--packages/sol-cov/src/types.ts4
2 files changed, 8 insertions, 4 deletions
diff --git a/packages/sol-cov/src/coverage_subprovider.ts b/packages/sol-cov/src/coverage_subprovider.ts
index 1e050080f..3fd45bbd1 100644
--- a/packages/sol-cov/src/coverage_subprovider.ts
+++ b/packages/sol-cov/src/coverage_subprovider.ts
@@ -8,7 +8,7 @@ import { AbstractArtifactAdapter } from './artifact_adapters/abstract_artifact_a
import { constants } from './constants';
import { CoverageManager } from './coverage_manager';
import { getTracesByContractAddress } from './trace';
-import { TraceInfoExistingContract, TraceInfoNewContract } from './types';
+import { BlockParamLiteral, TraceInfoExistingContract, TraceInfoNewContract } from './types';
interface MaybeFakeTxData extends TxData {
isFakeTransaction?: boolean;
@@ -89,7 +89,7 @@ export class CoverageSubprovider extends Subprovider {
} else {
const payload = {
method: 'eth_getBlockByNumber',
- params: ['latest', true],
+ params: [BlockParamLiteral.Latest, true],
};
const jsonRPCResponsePayload = await this.emitPayloadAsync(payload);
const transactions = jsonRPCResponsePayload.result.transactions;
@@ -136,7 +136,7 @@ export class CoverageSubprovider extends Subprovider {
} else {
const tracesByContractAddress = getTracesByContractAddress(trace.structLogs, address);
for (const subcallAddress of _.keys(tracesByContractAddress)) {
- payload = { method: 'eth_getCode', params: [subcallAddress, 'latest'] };
+ payload = { method: 'eth_getCode', params: [subcallAddress, BlockParamLiteral.Latest] };
const runtimeBytecode = (await this.emitPayloadAsync(payload)).result;
const traceForThatSubcall = tracesByContractAddress[subcallAddress];
const coveredPcs = _.map(traceForThatSubcall, log => log.pc);
@@ -178,7 +178,7 @@ export class CoverageSubprovider extends Subprovider {
private async _getContractCodeAsync(address: string): Promise<string> {
const payload = {
method: 'eth_getCode',
- params: [address, 'latest'],
+ params: [address, BlockParamLiteral.Latest],
};
const jsonRPCResponsePayload = await this.emitPayloadAsync(payload);
const contractCode: string = jsonRPCResponsePayload.result;
diff --git a/packages/sol-cov/src/types.ts b/packages/sol-cov/src/types.ts
index 01359d858..4c3de55a1 100644
--- a/packages/sol-cov/src/types.ts
+++ b/packages/sol-cov/src/types.ts
@@ -98,3 +98,7 @@ export interface TraceInfoExistingContract extends TraceInfoBase {
}
export type TraceInfo = TraceInfoNewContract | TraceInfoExistingContract;
+
+export enum BlockParamLiteral {
+ Latest = 'latest',
+}