Skip to content

Commit

Permalink
Remove @types/bn.js from block,blockchain,trie,tx,vm packages (#1136)
Browse files Browse the repository at this point in the history
* deps -> remove @types/bn.js from block,blockchain,trie,tx,vm packages
* vm -> import BN from ethereumjs-util everywhere
* tx -> import BN from ethereumjs-util in TransactionFactory.ts
  • Loading branch information
cgewecke authored Mar 5, 2021
1 parent 42cf2c6 commit 5620105
Show file tree
Hide file tree
Showing 30 changed files with 25 additions and 37 deletions.
1 change: 0 additions & 1 deletion packages/block/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@
"@ethereumjs/common": "^2.1.0",
"merkle-patricia-tree": "^4.1.0",
"@ethereumjs/tx": "^3.0.2",
"@types/bn.js": "^4.11.6",
"ethereumjs-util": "^7.0.8"
},
"devDependencies": {
Expand Down
1 change: 0 additions & 1 deletion packages/blockchain/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
"@ethereumjs/config-typescript": "^2.0.0",
"@ethereumjs/eslint-config-defaults": "^2.0.0",
"@types/async": "^2.4.1",
"@types/bn.js": "^4.11.6",
"@types/lru-cache": "^5.1.0",
"@types/node": "^11.13.4",
"@types/tape": "^4.13.0",
Expand Down
1 change: 0 additions & 1 deletion packages/trie/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@
"@ethereumjs/config-typescript": "^2.0.0",
"@ethereumjs/eslint-config-defaults": "^2.0.0",
"@types/benchmark": "^1.0.33",
"@types/bn.js": "^4.11.6",
"@types/tape": "^4.13.0",
"benchmark": "^2.1.4",
"eslint": "^6.8.0",
Expand Down
1 change: 0 additions & 1 deletion packages/tx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"@ethereumjs/config-coverage": "^2.0.0",
"@ethereumjs/config-typescript": "^2.0.0",
"@ethereumjs/eslint-config-defaults": "^2.0.0",
"@types/bn.js": "^4.11.6",
"@types/minimist": "^1.2.0",
"@types/node": "^11.13.4",
"@types/tape": "^4.13.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/tx/src/transactionFactory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import Common from '@ethereumjs/common'
import { default as LegacyTransaction } from './legacyTransaction'
import { default as EIP2930Transaction } from './eip2930Transaction'
import { TxOptions, Transaction, TxData } from './types'
import BN from 'bn.js'
import { BN } from 'ethereumjs-util'

const DEFAULT_COMMON = new Common({ chain: 'mainnet' })

Expand Down
3 changes: 1 addition & 2 deletions packages/vm/benchmarks/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BN = require('bn.js')
import { Account, Address, toBuffer, bufferToInt } from 'ethereumjs-util'
import { Account, Address, toBuffer, bufferToInt, BN } from 'ethereumjs-util'
import Common from '@ethereumjs/common'
import { Block } from '@ethereumjs/block'
import { StateManager, DefaultStateManager } from '../dist/state'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/opcodes/EIP1283.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { RunState } from './../interpreter'

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/opcodes/EIP2200.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { RunState } from './../interpreter'
import { ERROR } from '../../exceptions'
import { adjustSstoreGasEIP2929 } from './EIP2929'
Expand Down
3 changes: 1 addition & 2 deletions packages/vm/lib/evm/opcodes/EIP2929.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BN = require('bn.js')
import { Address } from 'ethereumjs-util'
import { Address, BN } from 'ethereumjs-util'
import { EIP2929StateManager } from '../../state/interface'
import { RunState } from './../interpreter'

Expand Down
3 changes: 1 addition & 2 deletions packages/vm/lib/evm/precompiles/01-ecrecover.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BN = require('bn.js')
import { setLengthLeft, setLengthRight, ecrecover, publicToAddress } from 'ethereumjs-util'
import { setLengthLeft, setLengthRight, ecrecover, publicToAddress, BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { OOGResult, ExecResult } from '../evm'
const assert = require('assert')
Expand Down
3 changes: 1 addition & 2 deletions packages/vm/lib/evm/precompiles/02-sha256.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BN = require('bn.js')
import { sha256 } from 'ethereumjs-util'
import { sha256, BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { OOGResult, ExecResult } from '../evm'
const assert = require('assert')
Expand Down
3 changes: 1 addition & 2 deletions packages/vm/lib/evm/precompiles/03-ripemd160.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BN = require('bn.js')
import { ripemd160 } from 'ethereumjs-util'
import { ripemd160, BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { OOGResult, ExecResult } from '../evm'
const assert = require('assert')
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/04-identity.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { OOGResult, ExecResult } from '../evm'
const assert = require('assert')
Expand Down
3 changes: 1 addition & 2 deletions packages/vm/lib/evm/precompiles/05-modexp.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import BN = require('bn.js')
import { setLengthRight } from 'ethereumjs-util'
import { setLengthRight, BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { OOGResult, ExecResult } from '../evm'
const assert = require('assert')
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/06-ecadd.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { OOGResult, ExecResult } from '../evm'
const assert = require('assert')
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/07-ecmul.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { OOGResult, ExecResult } from '../evm'
const assert = require('assert')
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/08-ecpairing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { OOGResult, ExecResult } from '../evm'
const assert = require('assert')
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/09-blake2f.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { OOGResult, ExecResult } from '../evm'
import { VmError, ERROR } from '../../exceptions'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/0a-bls12-g1add.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { VmErrorResult, ExecResult, OOGResult } from '../evm'
import { ERROR, VmError } from '../../exceptions'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/0b-bls12-g1mul.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { VmErrorResult, ExecResult, OOGResult } from '../evm'
import { ERROR, VmError } from '../../exceptions'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/0c-bls12-g1multiexp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { VmErrorResult, ExecResult, OOGResult } from '../evm'
import { ERROR, VmError } from '../../exceptions'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/0d-bls12-g2add.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { VmErrorResult, ExecResult, OOGResult } from '../evm'
import { ERROR, VmError } from '../../exceptions'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/0e-bls12-g2mul.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { VmErrorResult, ExecResult, OOGResult } from '../evm'
import { ERROR, VmError } from '../../exceptions'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/0f-bls12-g2multiexp.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { VmErrorResult, ExecResult, OOGResult } from '../evm'
import { ERROR, VmError } from '../../exceptions'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/10-bls12-pairing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { VmErrorResult, ExecResult, OOGResult } from '../evm'
import { ERROR, VmError } from '../../exceptions'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/11-bls12-map-fp-to-g1.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { VmErrorResult, ExecResult, OOGResult } from '../evm'
import { ERROR, VmError } from '../../exceptions'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/12-bls12-map-fp2-to-g2.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import { PrecompileInput } from './types'
import { VmErrorResult, ExecResult, OOGResult } from '../evm'
import { ERROR, VmError } from '../../exceptions'
Expand Down
2 changes: 1 addition & 1 deletion packages/vm/lib/evm/precompiles/types.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import BN = require('bn.js')
import { BN } from 'ethereumjs-util'
import Common from '@ethereumjs/common'
import { ExecResult } from '../evm'
import VM from '../../index'
Expand Down
3 changes: 1 addition & 2 deletions packages/vm/lib/evm/precompiles/util/bls12_381.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const { padToEven } = require('ethereumjs-util')
import { padToEven, BN } from 'ethereumjs-util'
import { VmError, ERROR } from '../../../exceptions'
import { BN } from 'ethereumjs-util'

// base field modulus as described in the EIP
const fieldModulus = new BN(
Expand Down
1 change: 0 additions & 1 deletion packages/vm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@
"@ethereumjs/config-typescript": "^2.0.0",
"@ethereumjs/eslint-config-defaults": "^2.0.0",
"@types/benchmark": "^1.0.33",
"@types/bn.js": "^4.11.6",
"@types/core-js": "^2.5.0",
"@types/lru-cache": "^5.1.0",
"@types/node": "^11.13.4",
Expand Down

0 comments on commit 5620105

Please sign in to comment.