Remove unused variables and other small fixes
This commit is contained in:
@@ -19,7 +19,7 @@
|
||||
"rebuild_and_test": "run-s build test",
|
||||
"test:coverage": "SOLIDITY_COVERAGE=true run-s build run_mocha coverage:report:text coverage:report:lcov",
|
||||
"test:profiler": "SOLIDITY_PROFILER=true run-s build run_mocha profiler:report:html",
|
||||
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s run_mocha",
|
||||
"test:trace": "SOLIDITY_REVERT_TRACE=true run-s build run_mocha",
|
||||
"run_mocha": "mocha --require source-map-support/register 'lib/test/**/*.js' --timeout 100000 --bail --exit",
|
||||
"compile": "sol-compiler",
|
||||
"clean": "shx rm -rf lib src/generated_contract_wrappers",
|
||||
|
@@ -7,6 +7,8 @@ import { coverage } from './coverage';
|
||||
import { profiler } from './profiler';
|
||||
import { revertTrace } from './revert_trace';
|
||||
|
||||
import * as _ from 'lodash';
|
||||
|
||||
enum ProviderType {
|
||||
Ganache = 'ganache',
|
||||
Geth = 'geth',
|
||||
@@ -50,11 +52,10 @@ export const provider = web3Factory.getRpcProvider(providerConfigs);
|
||||
const isCoverageEnabled = env.parseBoolean(EnvVars.SolidityCoverage);
|
||||
const isProfilerEnabled = env.parseBoolean(EnvVars.SolidityProfiler);
|
||||
const isRevertTraceEnabled = env.parseBoolean(EnvVars.SolidityRevertTrace);
|
||||
// TODO(albrow): Include revertTrace checks in the warnings below.
|
||||
if (isCoverageEnabled && isProfilerEnabled) {
|
||||
throw new Error(
|
||||
`Unfortunately for now you can't enable both coverage and profiler at the same time. They both use coverage.json file and there is no way to configure that.`,
|
||||
);
|
||||
const enabledSubproviderCount = _.filter([isCoverageEnabled, isProfilerEnabled, isRevertTraceEnabled], _.identity)
|
||||
.length;
|
||||
if (enabledSubproviderCount > 1) {
|
||||
throw new Error(`Only one of coverage, profiler, and revert trace subproviders can be enabled at a time`);
|
||||
}
|
||||
if (isCoverageEnabled) {
|
||||
const coverageSubprovider = coverage.getCoverageSubproviderSingleton();
|
||||
|
@@ -3,7 +3,7 @@ import { OpCode, StructLog } from 'ethereum-types';
|
||||
|
||||
import * as _ from 'lodash';
|
||||
|
||||
import { EvmCallStack, EvmCallStackEntry } from './types';
|
||||
import { EvmCallStack } from './types';
|
||||
import { utils } from './utils';
|
||||
|
||||
export function getRevertTrace(structLogs: StructLog[], startAddress: string): EvmCallStack {
|
||||
|
@@ -117,14 +117,14 @@ export class RevertTraceSubprovider extends Subprovider {
|
||||
if (_.isNull(err)) {
|
||||
const toAddress =
|
||||
_.isUndefined(txData.to) || txData.to === NULL_ADDRESS ? constants.NEW_CONTRACT : txData.to;
|
||||
await this._recordTxTraceAsync(toAddress, txData.data, txHash as string);
|
||||
await this._recordTxTraceAsync(toAddress, 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 === NULL_ADDRESS ? constants.NEW_CONTRACT : txData.to;
|
||||
await this._recordTxTraceAsync(toAddress, transaction.input, transaction.hash);
|
||||
await this._recordTxTraceAsync(toAddress, transaction.hash);
|
||||
}
|
||||
}
|
||||
if (!txData.isFakeTransaction) {
|
||||
@@ -143,7 +143,7 @@ export class RevertTraceSubprovider extends Subprovider {
|
||||
await this._recordCallOrGasEstimateTraceAsync(callData);
|
||||
cb();
|
||||
}
|
||||
private async _recordTxTraceAsync(address: string, data: string | undefined, txHash: string): Promise<void> {
|
||||
private async _recordTxTraceAsync(address: string, txHash: string): Promise<void> {
|
||||
await this._web3Wrapper.awaitTransactionMinedAsync(txHash, 0);
|
||||
const trace = await this._web3Wrapper.getTransactionTraceAsync(txHash, {
|
||||
disableMemory: true,
|
||||
|
Reference in New Issue
Block a user