Skip to content

Commit

Permalink
Monorepo: remove default exports and adjust imports in non-test files
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrocheleau committed Jul 7, 2022
1 parent 5b1da6a commit 49682a0
Show file tree
Hide file tree
Showing 139 changed files with 267 additions and 268 deletions.
4 changes: 2 additions & 2 deletions packages/block/src/block.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Trie } from '@ethereumjs/trie'
import { keccak256 } from 'ethereum-cryptography/keccak'
import { arrToBufArr, bufArrToArr, KECCAK256_RLP, bufferToHex } from '@ethereumjs/util'
import RLP from 'rlp'
import Common, { ConsensusType } from '@ethereumjs/common'
import { RLP } from 'rlp'
import { Common, ConsensusType } from '@ethereumjs/common'
import {
TransactionFactory,
TypedTransaction,
Expand Down
4 changes: 2 additions & 2 deletions packages/block/src/from-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { toBuffer, setLengthLeft } from '@ethereumjs/util'
import { Block, BlockOptions } from './index'
import { numberToHex } from './helpers'

import blockHeaderFromRpc from './header-from-rpc'
import { blockHeaderFromRpc } from './header-from-rpc'

function normalizeTxParams(_txParams: any) {
const txParams = Object.assign({}, _txParams)
Expand Down Expand Up @@ -34,7 +34,7 @@ function normalizeTxParams(_txParams: any) {
* @param uncles - Optional list of Ethereum JSON RPC of uncles (eth_getUncleByBlockHashAndIndex)
* @param chainOptions - An object describing the blockchain
*/
export default function blockFromRpc(blockParams: any, uncles: any[] = [], options?: BlockOptions) {
export function blockFromRpc(blockParams: any, uncles: any[] = [], options?: BlockOptions) {
const header = blockHeaderFromRpc(blockParams, options)

const transactions: TypedTransaction[] = []
Expand Down
2 changes: 1 addition & 1 deletion packages/block/src/header-from-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { numberToHex } from './helpers'
* @param blockParams - Ethereum JSON RPC of block (eth_getBlockByNumber)
* @param chainOptions - An object describing the blockchain
*/
export default function blockHeaderFromRpc(blockParams: any, options?: BlockOptions) {
export function blockHeaderFromRpc(blockParams: any, options?: BlockOptions) {
const {
parentHash,
sha3Uncles,
Expand Down
5 changes: 3 additions & 2 deletions packages/block/src/header.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import Common, {
import {
Chain,
Common,
ConsensusAlgorithm,
ConsensusType,
Hardfork,
Expand All @@ -23,7 +24,7 @@ import {
TypeOutput,
zeros,
} from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { BlockHeaderBuffer, BlockOptions, HeaderData, JsonHeader } from './types'
import { CLIQUE_EXTRA_VANITY, CLIQUE_EXTRA_SEAL } from './clique'

Expand Down
2 changes: 1 addition & 1 deletion packages/block/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { AddressLike, BigIntLike, BufferLike } from '@ethereumjs/util'
import Common from '@ethereumjs/common'
import { Common } from '@ethereumjs/common'
import { TxData, JsonTx, AccessListEIP2930TxData, FeeMarketEIP1559TxData } from '@ethereumjs/tx'
import { BlockHeader } from './header'

Expand Down
4 changes: 2 additions & 2 deletions packages/block/test/util.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import Common, { Chain, Hardfork } from '@ethereumjs/common'
import { Chain, Common, Hardfork } from '@ethereumjs/common'
import { keccak256 } from 'ethereum-cryptography/keccak'
import { bufArrToArr } from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { Block, BlockHeader } from '../src'

/**
Expand Down
3 changes: 2 additions & 1 deletion packages/blockchain/src/blockchain.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import Semaphore from 'semaphore-async-await'
import { Block, BlockData, BlockHeader } from '@ethereumjs/block'
import Common, {
import {
Chain,
CliqueConfig,
Common,
ConsensusAlgorithm,
ConsensusType,
Hardfork,
Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain/src/consensus/clique.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { debug as createDebugLogger } from 'debug'
import { Block, BlockHeader } from '@ethereumjs/block'
import { Address, bigIntToBuffer, bufferToBigInt, arrToBufArr, bufArrToArr } from '@ethereumjs/util'
import RLP from 'rlp'
import Blockchain from '..'
import { RLP } from 'rlp'
import { Blockchain } from '..'
import { Consensus, ConsensusOptions } from './interface'
import { CliqueConfig, ConsensusAlgorithm } from '@ethereumjs/common'

Expand Down
4 changes: 2 additions & 2 deletions packages/blockchain/src/consensus/ethash.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Block, BlockHeader } from '@ethereumjs/block'
import { ConsensusAlgorithm } from '@ethereumjs/common'
import Ethash, { EthashCacheDB } from '@ethereumjs/ethash'
import Blockchain from '..'
import { Ethash, EthashCacheDB } from '@ethereumjs/ethash'
import { Blockchain } from '..'
import { Consensus, ConsensusOptions } from './interface'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain/src/consensus/interface.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Block, BlockHeader } from '@ethereumjs/block'
import { ConsensusAlgorithm } from '@ethereumjs/common'
import Blockchain from '..'
import { Blockchain } from '..'

/**
* Interface that a consensus class needs to implement.
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain/src/db/cache.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import * as LRUCache from 'lru-cache'
* Simple LRU Cache that allows for keys of type Buffer
* @hidden
*/
export default class Cache<V> {
export class Cache<V> {
_cache: LRUCache<string, V>

constructor(opts: LRUCache.Options<string, V>) {
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain/src/db/helpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { DBOp, DBTarget } from './operation'
import { bufArrToArr } from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { Block, BlockHeader } from '@ethereumjs/block'
import { bufBE8 } from './constants'

Expand Down
6 changes: 3 additions & 3 deletions packages/blockchain/src/db/manager.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { arrToBufArr, bufferToBigInt } from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { Block, BlockHeader, BlockOptions, BlockBuffer, BlockBodyBuffer } from '@ethereumjs/block'
import Common from '@ethereumjs/common'
import { Common } from '@ethereumjs/common'
import { AbstractLevel } from 'abstract-level'
import Cache from './cache'
import { Cache } from './cache'
import { DatabaseKey, DBOp, DBTarget, DBOpData } from './operation'

class NotFoundError extends Error {
Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain/src/genesisStates/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { SecureTrie as Trie } from '@ethereumjs/trie'
import { keccak256 } from 'ethereum-cryptography/keccak'
import { Account, isHexPrefixed, toBuffer, unpadBuffer, PrefixedHexString } from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'

export type StoragePair = [key: PrefixedHexString, value: PrefixedHexString]

Expand Down
2 changes: 1 addition & 1 deletion packages/blockchain/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
export { Consensus, CasperConsensus, CliqueConsensus, EthashConsensus } from './consensus'
export { Blockchain as default } from './blockchain'
export { Blockchain } from './blockchain'
export { BlockchainInterface, BlockchainOptions } from './types'
2 changes: 1 addition & 1 deletion packages/blockchain/src/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Block } from '@ethereumjs/block'
import Common from '@ethereumjs/common'
import { Common } from '@ethereumjs/common'
import { AbstractLevel } from 'abstract-level'
import { Consensus } from '.'
import { GenesisState } from './genesisStates'
Expand Down
6 changes: 3 additions & 3 deletions packages/blockchain/test/util.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { bufArrToArr, toBuffer } from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { Block, BlockHeader } from '@ethereumjs/block'
import Common, { Chain, Hardfork } from '@ethereumjs/common'
import Blockchain from '../src'
import { Chain, Common, Hardfork } from '@ethereumjs/common'
import { Blockchain } from '../src'
import { MemoryLevel } from 'memory-level'
import { Level } from 'level'
import { keccak256 } from 'ethereum-cryptography/keccak'
Expand Down
6 changes: 3 additions & 3 deletions packages/client/bin/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@ import * as readline from 'readline'
import { randomBytes } from 'crypto'
import { existsSync } from 'fs'
import { ensureDirSync, readFileSync, removeSync } from 'fs-extra'
import Blockchain from '@ethereumjs/blockchain'
import Common, { Chain, Hardfork, ConsensusAlgorithm } from '@ethereumjs/common'
import { Blockchain } from '@ethereumjs/blockchain'
import { Chain, Common, Hardfork, ConsensusAlgorithm } from '@ethereumjs/common'
import { Address, toBuffer } from '@ethereumjs/util'
import {
parseMultiaddrs,
parseGenesisState,
parseCustomParams,
setCommonForkHashes,
} from '../lib/util'
import EthereumClient from '../lib/client'
import { EthereumClient } from '../lib/client'
import { Config, DataDirectory, SyncMode } from '../lib/config'
import { Logger, getLogger } from '../lib/logging'
import { startRPCServers, helprpc } from './startRpc'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/bin/startRpc.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Server as RPCServer } from 'jayson/promise'
import { readFileSync, writeFileSync } from 'fs-extra'
import { RPCManager } from '../lib/rpc'
import EthereumClient from '../lib/client'
import { EthereumClient } from '../lib/client'
import {
MethodConfig,
createRPCServer,
Expand Down
4 changes: 2 additions & 2 deletions packages/client/browser/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Common, { Chain } from '@ethereumjs/common'
import { Chain, Common } from '@ethereumjs/common'

// Blockchain
export * from '../lib/blockchain/chain'
Expand All @@ -23,7 +23,7 @@ export * from '../lib/net/server/libp2pserver'

// EthereumClient
export * from '../lib/client'
import EthereumClient from '../lib/client'
import { EthereumClient } from '../lib/client'

// Service
export * from '../lib/service/service'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/blockchain/chain.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Block, BlockHeader } from '@ethereumjs/block'
import Blockchain from '@ethereumjs/blockchain'
import { Blockchain } from '@ethereumjs/blockchain'
import { ConsensusAlgorithm, Hardfork } from '@ethereumjs/common'
import { AbstractLevel } from 'abstract-level'
import { Config } from '../config'
Expand Down
4 changes: 2 additions & 2 deletions packages/client/lib/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { Config, SyncMode } from './config'
import { FullEthereumService, LightEthereumService } from './service'
import { Event } from './types'
import { Chain } from './blockchain'
import type Blockchain from '@ethereumjs/blockchain'
import type { Blockchain } from '@ethereumjs/blockchain'
import { AbstractLevel } from 'abstract-level'

export interface EthereumClientOptions {
Expand Down Expand Up @@ -53,7 +53,7 @@ export interface EthereumClientOptions {
* lifecycle of included services.
* @memberof module:node
*/
export default class EthereumClient {
export class EthereumClient {
public config: Config
public chain: Chain
public services: (FullEthereumService | LightEthereumService)[]
Expand Down
4 changes: 2 additions & 2 deletions packages/client/lib/config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Common, { Hardfork } from '@ethereumjs/common'
import VM from '@ethereumjs/vm'
import { Common, Hardfork } from '@ethereumjs/common'
import { VM } from '@ethereumjs/vm'
import { genPrivateKey } from '@ethereumjs/devp2p'
import { Address } from '@ethereumjs/util'
import { Multiaddr } from 'multiaddr'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/execution/receipt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
bufferToInt,
intToBuffer,
} from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { MetaDBManager, DBKey } from '../util/metaDBManager'
import type { Block } from '@ethereumjs/block'

Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/execution/vmexecution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
DBSetHashToNumber,
} from '@ethereumjs/blockchain/dist/db/helpers'
import { ConsensusType, Hardfork } from '@ethereumjs/common'
import VM from '@ethereumjs/vm'
import { VM } from '@ethereumjs/vm'
import { bufferToHex } from '@ethereumjs/util'
import { DefaultStateManager } from '@ethereumjs/statemanager'
import { LevelDB, SecureTrie as Trie } from '@ethereumjs/trie'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/index.ts
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
export * from './config'
export { default as EthereumClient } from './client'
export { EthereumClient } from './client'
2 changes: 1 addition & 1 deletion packages/client/lib/miner/miner.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import Ethash, { Solution, Miner as EthashMiner } from '@ethereumjs/ethash'
import { Ethash, Solution, Miner as EthashMiner } from '@ethereumjs/ethash'
import { BlockHeader } from '@ethereumjs/block'
import { CliqueConsensus } from '@ethereumjs/blockchain'
import { ConsensusType, Hardfork, CliqueConfig } from '@ethereumjs/common'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/miner/pendingBlock.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { randomBytes } from 'crypto'
import type VM from '@ethereumjs/vm'
import type { VM } from '@ethereumjs/vm'
import type { TxReceipt } from '@ethereumjs/vm'
import type { BlockBuilder } from '@ethereumjs/vm/dist/buildBlock'
import type { Block, HeaderData } from '@ethereumjs/block'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/net/protocol/ethprotocol.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
bufferToInt,
intToBuffer,
} from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { Chain } from './../../blockchain'
import { Message, Protocol, ProtocolOptions } from './protocol'
import type { TxReceiptWithType } from '../../execution/receipt'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/net/protocol/libp2psender.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import * as pipe from 'it-pipe'
import * as pushable from 'it-pushable'
import { arrToBufArr, bufferToInt, bufArrToArr, intToBuffer } from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { Libp2pMuxedStream as MuxedStream } from '../../types'
import { Sender } from './sender'

Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/rpc/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Config } from '../config'
import EthereumClient from '../client'
import { EthereumClient } from '../client'
import * as modules from './modules'
import { INTERNAL_ERROR } from './error-code'

Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/rpc/modules/admin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getClientVersion } from '../../util'
import { middleware } from '../validation'
import type { Chain } from '../../blockchain'
import type { RlpxServer } from '../../net/server'
import type EthereumClient from '../../client'
import type { EthereumClient } from '../../client'
import type { EthereumService } from '../../service'

/**
Expand Down
6 changes: 3 additions & 3 deletions packages/client/lib/rpc/modules/engine.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Block, HeaderData } from '@ethereumjs/block'
import { TransactionFactory, TypedTransaction } from '@ethereumjs/tx'
import { bufferToHex, toBuffer, zeros } from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { Trie } from '@ethereumjs/trie'
import { Hardfork } from '@ethereumjs/common'

Expand All @@ -10,8 +10,8 @@ import { INTERNAL_ERROR, INVALID_PARAMS } from '../error-code'
import { short } from '../../util'
import { PendingBlock } from '../../miner'
import { CLConnectionManager } from '../util/CLConnectionManager'
import type VM from '@ethereumjs/vm'
import type EthereumClient from '../../client'
import type { VM } from '@ethereumjs/vm'
import type { EthereumClient } from '../../client'
import type { Chain } from '../../blockchain'
import type { VMExecution } from '../../execution'
import type { Config } from '../../config'
Expand Down
4 changes: 2 additions & 2 deletions packages/client/lib/rpc/modules/eth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ import {
toType,
TypeOutput,
} from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'
import { middleware, validators } from '../validation'
import { INTERNAL_ERROR, INVALID_PARAMS, PARSE_ERROR } from '../error-code'
import { RpcTx } from '../types'
import { EthereumService, FullEthereumService } from '../../service'
import type VM from '@ethereumjs/vm'
import type { VM } from '@ethereumjs/vm'
import type { PostByzantiumTxReceipt, PreByzantiumTxReceipt, TxReceipt } from '@ethereumjs/vm'
import type { Log } from '@ethereumjs/evm'
import type { Proof } from '@ethereumjs/statemanager'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/service/txpool.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { Address, bufferToHex } from '@ethereumjs/util'
import { Config } from '../config'
import { Peer } from '../net/peer'
import type VM from '@ethereumjs/vm'
import type { VM } from '@ethereumjs/vm'
import type { FullEthereumService } from './fullethereumservice'
import type { PeerPool } from '../net/peerpool'
import type { Block } from '@ethereumjs/block'
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/sync/skeleton.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Block } from '@ethereumjs/block'
import { bigIntToBuffer, bufferToBigInt } from '@ethereumjs/util'
import RLP from 'rlp'
import { RLP } from 'rlp'

import { DBKey, MetaDBManager, MetaDBManagerOptions } from '../util/metaDBManager'
import { short, timeDuration } from '../util'
Expand Down
6 changes: 3 additions & 3 deletions packages/client/lib/util/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ export async function debugCodeReplayBlock(execution: VMExecution, block: Block)
*/
import { Level } from 'level';
import Common from '@ethereumjs/common'
import { Common } from '@ethereumjs/common'
import { Block } from '@ethereumjs/block'
import VM from './lib'
import { VM } from './lib'
import { SecureTrie as Trie } from '@ethereumjs/trie'
import { DefaultStateManager } from './lib/state'
import Blockchain from '@ethereumjs/blockchain'
import { Blockchain } from '@ethereumjs/blockchain'
const main = async () => {
const common = new Common({ chain: '${execution.config.execCommon.chainName()}', hardfork: '${
Expand Down
2 changes: 1 addition & 1 deletion packages/client/lib/util/parse.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from '@ethereumjs/util'
import type { MultiaddrLike } from '../types'
import type { GenesisState } from '@ethereumjs/blockchain/dist/genesisStates'
import type Common from '@ethereumjs/common'
import type { Common } from '@ethereumjs/common'

/**
* Parses multiaddrs and bootnodes to multiaddr format.
Expand Down
Loading

0 comments on commit 49682a0

Please sign in to comment.