Skip to content

Commit

Permalink
Remove unused variables
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio committed Mar 31, 2021
1 parent d214ee7 commit 695e8c9
Show file tree
Hide file tree
Showing 29 changed files with 17 additions and 101 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ function optional<TypeT, OutputT>(

const HEX_STRING_REGEX = /^(0x)?([0-9a-f]{2})+$/gi;

const HEX_PREFIX = "0x";

function isHexString(v: unknown): v is string {
if (typeof v !== "string") {
return false;
Expand Down
2 changes: 0 additions & 2 deletions packages/hardhat-core/src/internal/core/providers/accounts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ export interface JsonRpcTransactionData {
nonce?: string | number;
}

const HD_PATH_REGEX = /^m(:?\/\d+'?)+\/?$/;

export class LocalAccountsProvider extends ProviderWrapperWithChainId {
private _addressToPrivateKey: Map<string, Buffer> = new Map();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
HardhatConfig,
HardhatRuntimeEnvironment,
Network,
NetworkConfig,
ParamDefinition,
RunSuperFunction,
RunTaskFunction,
Expand Down Expand Up @@ -298,7 +297,7 @@ export class Environment implements HardhatRuntimeEnvironment {
paramDefinition: ParamDefinition<any>,
argumentValue: any
) {
const { name, isOptional, defaultValue, type } = paramDefinition;
const { name, isOptional, defaultValue } = paramDefinition;

if (argumentValue === undefined) {
if (isOptional) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import path from "path";
import { HttpProvider } from "../../core/providers/http";
import { createNonCryptographicHashBasedIdentifier } from "../../util/hash";
import { rpcData, rpcQuantity } from "../provider/input";
import { bufferToRpcData, numberToRpcQuantity } from "../provider/output";
import { numberToRpcQuantity } from "../provider/output";

import {
decode,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Block } from "@ethereumjs/block";
import { TypedTransaction } from "@ethereumjs/tx";
import { BN, bufferToInt, zeros } from "ethereumjs-util";
import { BN, zeros } from "ethereumjs-util";

import { BlockchainData } from "./BlockchainData";
import { FilterParams } from "./node-types";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Transaction } from "@ethereumjs/tx";
import { BN, bufferToHex } from "ethereumjs-util";
import { BN } from "ethereumjs-util";
import { MaxHeap } from "mnemonist/heap";

import { OrderedTransaction } from "./PoolState";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Block } from "@ethereumjs/block";
import Common from "@ethereumjs/common";
import { TypedTransaction } from "@ethereumjs/tx";
import { Address, BN, bufferToHex, bufferToInt } from "ethereumjs-util";
import { Address, BN, bufferToHex } from "ethereumjs-util";

import { JsonRpcClient } from "../../jsonrpc/client";
import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import {
unpadBuffer,
} from "ethereumjs-util";
import { Map as ImmutableMap, Record as ImmutableRecord } from "immutable";
import { callbackify } from "util";

import { assertHardhatInvariant } from "../../../core/errors";
import { JsonRpcClient } from "../../jsonrpc/client";
Expand All @@ -24,10 +23,6 @@ import { randomHash } from "./random";

type State = ImmutableMap<string, ImmutableRecord<AccountState>>;

const encodeStorageKey = (address: Buffer, position: Buffer): string => {
return `${address.toString("hex")}${unpadBuffer(position).toString("hex")}`;
};

const checkpointedError = (method: string) =>
new Error(`${method} called when checkpointed`);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import { Transaction, TxData, TxOptions } from "@ethereumjs/tx";
import {
Address,
BN,
BufferLike,
bufferToInt,
ecrecover,
PrefixedHexString,
publicToAddress,
rlphash,
toBuffer,
unpadBuffer,
} from "ethereumjs-util";
import { Address, BN } from "ethereumjs-util";

import { InternalError } from "../errors";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BN, bufferToInt } from "ethereumjs-util";
import { BN } from "ethereumjs-util";
import * as t from "io-ts";

import { BoundExperimentalHardhatNetworkMessageTraceHook } from "../../../../types";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { BN, bufferToInt } from "ethereumjs-util";
import { BN } from "ethereumjs-util";
import * as t from "io-ts";

import {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Transaction } from "@ethereumjs/tx";
import VM from "@ethereumjs/vm";
import Bloom from "@ethereumjs/vm/dist/bloom";
import { EVMResult, ExecResult } from "@ethereumjs/vm/dist/evm/evm";
import { ERROR, VmError } from "@ethereumjs/vm/dist/exceptions";
import { ERROR } from "@ethereumjs/vm/dist/exceptions";
import {
PostByzantiumTxReceipt,
PreByzantiumTxReceipt,
Expand All @@ -27,7 +27,6 @@ import {
} from "ethereumjs-util";
import EventEmitter from "events";
import { BaseTrie as Trie } from "merkle-patricia-tree";
import { promisify } from "util";

import { CompilerInput, CompilerOutput } from "../../../types";
import { HARDHAT_NETWORK_DEFAULT_GAS_PRICE } from "../../core/config/default-config";
Expand Down Expand Up @@ -1290,10 +1289,6 @@ export class HardhatNode extends EventEmitter {
timestamp,
};

const header = BlockHeader.fromHeaderData(headerData, {
common: this._vm._common,
});

const block = Block.fromBlockData(
{
header: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import type {
RequestArguments,
} from "../../../types";
import { HARDHAT_NETWORK_RESET_EVENT } from "../../constants";
import { SolidityError } from "../stack-traces/solidity-errors";
import { FIRST_SOLC_VERSION_SUPPORTED } from "../stack-traces/solidityTracer";
import { Mutex } from "../vendor/await-semaphore";

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Block } from "@ethereumjs/block";
import { TypedTransaction } from "@ethereumjs/tx";
import { BN } from "ethereumjs-util";
import { callbackify } from "util";

import { FilterParams } from "../node-types";
import { RpcLogOutput, RpcReceiptOutput } from "../output";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,5 @@
import Common from "@ethereumjs/common";
import { Transaction, TxData, TxOptions } from "@ethereumjs/tx";
import {
Address,
AddressLike,
BN,
bufferToInt,
rlphash,
toBuffer,
unpadBuffer,
} from "ethereumjs-util";

import { TransactionParams } from "../node-types";
import { Address, AddressLike, BN, toBuffer } from "ethereumjs-util";

export interface FakeTxData extends TxData {
from?: AddressLike;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { HttpProvider } from "../../../core/providers/http";
import { rpcQuantityToNumber } from "../../../core/providers/provider-utils";
import { JsonRpcClient } from "../../jsonrpc/client";
import { ForkConfig } from "../node-types";
import { getRpcBlock, numberToRpcQuantity, RpcBlockOutput } from "../output";
import { numberToRpcQuantity, RpcBlockOutput } from "../output";

import {
FALLBACK_MAX_REORG,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Account, BN } from "ethereumjs-util";
import { SecureTrie as Trie } from "merkle-patricia-tree";
import { promisify } from "util";

import { GenesisAccount } from "../node-types";

Expand Down
6 changes: 0 additions & 6 deletions packages/hardhat-core/src/internal/util/global-dir.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,6 @@ function generatePathsSync(packageName = "hardhat") {
return envPaths(packageName);
}

async function getConfigDir(): Promise<string> {
const { config } = await generatePaths();
await fs.ensureDir(config);
return config;
}

function getConfigDirSync(): string {
const { config } = generatePathsSync();
fs.ensureDirSync(config);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ import * as types from "../../../../src/internal/core/params/argumentTypes";
import { ArgumentType } from "../../../../src/types";
import { expectHardhatError } from "../../../helpers/errors";

function a(f: () => any) {
expectHardhatError(f, ERRORS.ARGUMENTS.INVALID_VALUE_FOR_TYPE);
}

describe("argumentTypes", () => {
it("should set the right name to all the argument types", () => {
for (const typeName of Object.keys(types)) {
Expand Down
12 changes: 0 additions & 12 deletions packages/hardhat-core/test/internal/core/providers/construction.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import Common from "@ethereumjs/common";
import { assert } from "chai";

import {
Expand Down Expand Up @@ -112,22 +111,11 @@ describe("Base providers wrapping", () => {
});

describe("Sender wrapping", () => {
let common: Common;

beforeEach(async () => {
mockedProvider.setReturnValue(
"eth_estimateGas",
numberToRpcQuantity(123)
);

common = Common.forCustomChain(
"mainnet",
{
chainId: CHAIN_ID,
networkId: CHAIN_ID,
},
"petersburg"
);
});

it("Should wrap with a fixed sender param", async () => {
Expand Down
6 changes: 1 addition & 5 deletions packages/hardhat-core/test/internal/core/providers/mocks.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import { EventEmitter } from "events";

import {
EIP1193Provider,
EthereumProvider,
RequestArguments,
} from "../../../../src/types";
import { EIP1193Provider, RequestArguments } from "../../../../src/types";

export class MockedProvider extends EventEmitter implements EIP1193Provider {
private _returnValues: any = {};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { Transaction } from "@ethereumjs/tx";
import { assert } from "chai";
import { bufferToHex } from "ethereumjs-util";

import { randomAddress } from "../../../../src/internal/hardhat-network/provider/fork/random";
import { OrderedTransaction } from "../../../../src/internal/hardhat-network/provider/PoolState";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import Common from "@ethereumjs/common";
import { Transaction, TxData } from "@ethereumjs/tx";
import { Address, BN, bufferToHex } from "ethereumjs-util";
import { BN, bufferToHex } from "ethereumjs-util";

import { randomAddress } from "../../../../src/internal/hardhat-network/provider/fork/random";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import { bufferToHex } from "ethereumjs-util";

import { OrderedTransaction } from "../../../../src/internal/hardhat-network/provider/PoolState";

export function makeOrderedTxMap(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import {
randomAddressBuffer,
} from "../../../../src/internal/hardhat-network/provider/fork/random";
import { TxPool } from "../../../../src/internal/hardhat-network/provider/TxPool";
import { PStateManager } from "../../../../src/internal/hardhat-network/provider/types/PStateManager";
import { txMapToArray } from "../../../../src/internal/hardhat-network/provider/utils/txMapToArray";
import { assertEqualTransactionMaps } from "../helpers/assertEqualTransactionMaps";
import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,7 @@
import { Block } from "@ethereumjs/block";
import Common from "@ethereumjs/common";
import { assert } from "chai";
import {
Address,
BN,
BufferLike,
bufferToHex,
toBuffer,
zeros,
} from "ethereumjs-util";
import { BN, BufferLike, bufferToHex, toBuffer, zeros } from "ethereumjs-util";

import { JsonRpcClient } from "../../../../../src/internal/hardhat-network/jsonrpc/client";
import { ForkBlockchain } from "../../../../../src/internal/hardhat-network/provider/fork/ForkBlockchain";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { assert } from "chai";
import {
Account,
Address,
BN,
bufferToHex,
keccak256,
Expand Down Expand Up @@ -689,7 +688,6 @@ describe("ForkStateManager", () => {
DAI_TOTAL_SUPPLY_STORAGE_POSITION,
toBuffer("0xfeedface")
);
const blockTwoStateRoot = await fsm.getStateRoot();

fsm.setBlockContext(blockOneStateRoot, forkBlockNumber.addn(1));
const fsmValue = await fsm.getContractStorage(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { assert } from "chai";
import { BN, bufferToHex, zeroAddress } from "ethereumjs-util";
import { BN, zeroAddress } from "ethereumjs-util";
import sinon from "sinon";

import {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import { Block } from "@ethereumjs/block";
import Common from "@ethereumjs/common";
import { Transaction } from "@ethereumjs/tx";
import VM from "@ethereumjs/vm";
import {
AfterBlockEvent,
PostByzantiumTxReceipt,
RunBlockOpts,
} from "@ethereumjs/vm/dist/runBlock";
import { PostByzantiumTxReceipt } from "@ethereumjs/vm/dist/runBlock";
import { assert } from "chai";
import { BN, bufferToHex, bufferToInt } from "ethereumjs-util";
import { BN, bufferToHex } from "ethereumjs-util";
import path from "path";
import sinon from "sinon";

Expand Down

0 comments on commit 695e8c9

Please sign in to comment.