From 6484e3d7ef21febb156a65103c8c1941d5ff3ef3 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 07:24:56 -0400 Subject: [PATCH 01/15] Readme package renaming --- README.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index fd10febbdd..c9e05b6e63 100644 --- a/README.md +++ b/README.md @@ -14,12 +14,12 @@ This was originally the EthereumJS VM repository. On Q1 2020 we brought some of | package | npm | issues | tests | coverage | | ------------------------------------------- | ----------------------------------------------------------- | ----------------------------------------------------------------------- | ---------------------------------------------------------------------- | ----------------------------------------------------------------------- | -| [ethereumjs-account][account-package] | [![NPM Package][account-npm-badge]][account-npm-link] | [![Account Issues][account-issues-badge]][account-issues-link] | [![Actions Status][account-actions-badge]][account-actions-link] | [![Code Coverage][account-coverage-badge]][account-coverage-link] | -| [ethereumjs-block][block-package] | [![NPM Package][block-npm-badge]][block-npm-link] | [![Block Issues][block-issues-badge]][block-issues-link] | [![Actions Status][block-actions-badge]][block-actions-link] | [![Code Coverage][block-coverage-badge]][block-coverage-link] | -| [ethereumjs-blockchain][blockchain-package] | [![NPM Package][blockchain-npm-badge]][blockchain-npm-link] | [![Blockchain Issues][blockchain-issues-badge]][blockchain-issues-link] | [![Actions Status][blockchain-actions-badge]][blockchain-actions-link] | [![Code Coverage][blockchain-coverage-badge]][blockchain-coverage-link] | -| [ethereumjs-common][common-package] | [![NPM Package][common-npm-badge]][common-npm-link] | [![Common Issues][common-issues-badge]][common-issues-link] | [![Actions Status][common-actions-badge]][common-actions-link] | [![Code Coverage][common-coverage-badge]][common-coverage-link] | -| [ethereumjs-tx][tx-package] | [![NPM Package][tx-npm-badge]][tx-npm-link] | [![Tx Issues][tx-issues-badge]][tx-issues-link] | [![Actions Status][tx-actions-badge]][tx-actions-link] | [![Code Coverage][tx-coverage-badge]][tx-coverage-link] | -| [ethereumjs-vm][vm-package] | [![NPM Package][vm-npm-badge]][vm-npm-link] | [![VM Issues][vm-issues-badge]][vm-issues-link] | [![Actions Status][vm-actions-badge]][vm-actions-link] | [![Code Coverage][vm-coverage-badge]][vm-coverage-link] | +| [@ethereumjs/account][account-package] | [![NPM Package][account-npm-badge]][account-npm-link] | [![Account Issues][account-issues-badge]][account-issues-link] | [![Actions Status][account-actions-badge]][account-actions-link] | [![Code Coverage][account-coverage-badge]][account-coverage-link] | +| [@ethereumjs/block][block-package] | [![NPM Package][block-npm-badge]][block-npm-link] | [![Block Issues][block-issues-badge]][block-issues-link] | [![Actions Status][block-actions-badge]][block-actions-link] | [![Code Coverage][block-coverage-badge]][block-coverage-link] | +| [@ethereumjs/blockchain][blockchain-package] | [![NPM Package][blockchain-npm-badge]][blockchain-npm-link] | [![Blockchain Issues][blockchain-issues-badge]][blockchain-issues-link] | [![Actions Status][blockchain-actions-badge]][blockchain-actions-link] | [![Code Coverage][blockchain-coverage-badge]][blockchain-coverage-link] | +| [@ethereumjs/common][common-package] | [![NPM Package][common-npm-badge]][common-npm-link] | [![Common Issues][common-issues-badge]][common-issues-link] | [![Actions Status][common-actions-badge]][common-actions-link] | [![Code Coverage][common-coverage-badge]][common-coverage-link] | +| [@ethereumjs/tx][tx-package] | [![NPM Package][tx-npm-badge]][tx-npm-link] | [![Tx Issues][tx-issues-badge]][tx-issues-link] | [![Actions Status][tx-actions-badge]][tx-actions-link] | [![Code Coverage][tx-coverage-badge]][tx-coverage-link] | +| [@ethereumjs/vm][vm-package] | [![NPM Package][vm-npm-badge]][vm-npm-link] | [![VM Issues][vm-issues-badge]][vm-issues-link] | [![Actions Status][vm-actions-badge]][vm-actions-link] | [![Code Coverage][vm-coverage-badge]][vm-coverage-link] | ## Coverage report @@ -73,7 +73,7 @@ If you want to join for work or do improvements on the libraries have a look at [js-standard-style-link]: https://github.com/feross/standard [account-package]: ./packages/account [account-npm-badge]: https://img.shields.io/npm/v/ethereumjs-account.svg -[account-npm-link]: https://www.npmjs.org/package/ethereumjs-account +[account-npm-link]: https://www.npmjs.org/package/@ethereumjs/account [account-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20account?label=issues [account-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+account" [account-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/Account%20Test/badge.svg @@ -82,7 +82,7 @@ If you want to join for work or do improvements on the libraries have a look at [account-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/account [block-package]: ./packages/block [block-npm-badge]: https://img.shields.io/npm/v/ethereumjs-block.svg -[block-npm-link]: https://www.npmjs.org/package/ethereumjs-block +[block-npm-link]: https://www.npmjs.org/package/@ethereumjs/block [block-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20block?label=issues [block-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+block" [block-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/Block%20Test/badge.svg @@ -91,7 +91,7 @@ If you want to join for work or do improvements on the libraries have a look at [block-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/block [blockchain-package]: ./packages/blockchain [blockchain-npm-badge]: https://img.shields.io/npm/v/ethereumjs-blockchain.svg -[blockchain-npm-link]: https://www.npmjs.org/package/ethereumjs-blockchain +[blockchain-npm-link]: https://www.npmjs.org/package/@ethereumjs/blockchain [blockchain-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20blockchain?label=issues [blockchain-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+blockchain" [blockchain-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/Blockchain%20Test/badge.svg @@ -100,7 +100,7 @@ If you want to join for work or do improvements on the libraries have a look at [blockchain-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/blockchain [common-package]: ./packages/common [common-npm-badge]: https://img.shields.io/npm/v/ethereumjs-common.svg -[common-npm-link]: https://www.npmjs.org/package/ethereumjs-common +[common-npm-link]: https://www.npmjs.org/package/@ethereumjs/common [common-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20common?label=issues [common-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+common" [common-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/Common%20Test/badge.svg @@ -109,7 +109,7 @@ If you want to join for work or do improvements on the libraries have a look at [common-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/common [tx-package]: ./packages/tx [tx-npm-badge]: https://img.shields.io/npm/v/ethereumjs-tx.svg -[tx-npm-link]: https://www.npmjs.org/package/ethereumjs-tx +[tx-npm-link]: https://www.npmjs.org/package/@ethereumjs/tx [tx-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20tx?label=issues [tx-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+tx" [tx-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/Tx%20Test/badge.svg @@ -118,7 +118,7 @@ If you want to join for work or do improvements on the libraries have a look at [tx-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/tx [vm-package]: ./packages/vm [vm-npm-badge]: https://img.shields.io/npm/v/ethereumjs-vm.svg -[vm-npm-link]: https://www.npmjs.org/package/ethereumjs-vm +[vm-npm-link]: https://www.npmjs.org/package/@ethereumjs/vm [vm-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20vm?label=issues [vm-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+vm" [vm-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/VM%20Test/badge.svg From 53c64c28563a40cec6162c625d7d4a1080d325a9 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 07:25:17 -0400 Subject: [PATCH 02/15] account: renaming package --- packages/account/package.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/account/package.json b/packages/account/package.json index ddf94585c5..9fdad4d1ce 100644 --- a/packages/account/package.json +++ b/packages/account/package.json @@ -1,5 +1,5 @@ { - "name": "ethereumjs-account", + "name": "@ethereumjs/account", "version": "3.0.0", "description": "Encoding, decoding and validation of Ethereum's Account schema", "main": "./dist/index.js", @@ -9,7 +9,7 @@ ], "repository": { "type": "git", - "url": "git+https://github.com/ethereumjs/ethereumjs-account.git" + "url": "git+https://github.com/ethereumjs/ethereumjs-vm.git" }, "scripts": { "build": "ethereumjs-config-build", @@ -32,9 +32,9 @@ "author": "mjbecze (mjbecze@gmail.com)", "license": "MPL-2.0", "bugs": { - "url": "https://github.com/ethereumjs/ethereumjs-account/issues" + "url": "https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aissue+label%3A\"package%3A+account\"" }, - "homepage": "https://github.com/ethereumjs/ethereumjs-account#readme", + "homepage": "https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/account#synopsis", "dependencies": { "ethereumjs-util": "^7.0.2", "rlp": "^2.2.1", From 94808c6507cccc52a9fc9a6dcb0d9a5b640911fd Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 07:29:35 -0400 Subject: [PATCH 03/15] block: Migrating to scoped packages --- packages/block/README.md | 8 ++++---- packages/block/package.json | 13 +++++++------ 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/packages/block/README.md b/packages/block/README.md index 5cc2cc3a4d..b9dec6fb87 100644 --- a/packages/block/README.md +++ b/packages/block/README.md @@ -12,7 +12,7 @@ Implements schema and functions related to Ethereum's block. # INSTALL -`npm install ethereumjs-block` +`npm install @ethereumjs/block` # BROWSER @@ -24,9 +24,9 @@ This module works with `browserify`. # TESTING -Tests in the `tests` directory are partly outdated and testing is primarily done by running the `BlockchainTests` from within the [ethereumjs-vm](https://github.com/ethereumjs/ethereumjs-vm) repository. +Tests in the `tests` directory are partly outdated and testing is primarily done by running the `BlockchainTests` from within the [ethereumjs-vm](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/vm#synopsis) package. -To avoid bloating this repository with [ethereum/tests](https://github.com/ethereum/tests) JSON files, we usually copy specific JSON files and wrap them with some metadata (source, date, commit hash). There's a helper to aid in that process and can be found at [wrap-ethereum-test.sh](https://github.com/ethereumjs/ethereumjs-block/blob/master/scripts/wrap-ethereum-test.sh). +To avoid bloating this repository with [ethereum/tests](https://github.com/ethereum/tests) JSON files, we usually copy specific JSON files and wrap them with some metadata (source, date, commit hash). There's a helper to aid in that process and can be found at [wrap-ethereum-test.sh](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/scripts/wrap-ethereum-test.sh). # EthereumJS @@ -43,7 +43,7 @@ If you want to join for work or do improvements on the libraries have a look at [js-standard-style-badge]: https://cdn.rawgit.com/feross/standard/master/badge.svg [js-standard-style-link]: https://github.com/feross/standard [block-npm-badge]: https://img.shields.io/npm/v/ethereumjs-block.svg -[block-npm-link]: https://www.npmjs.org/package/ethereumjs-block +[block-npm-link]: https://www.npmjs.org/package/@ethereumjs/block [block-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20block?label=issues [block-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+block" [block-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/Block%20Test/badge.svg diff --git a/packages/block/package.json b/packages/block/package.json index d0e0b1a837..d216c0999d 100644 --- a/packages/block/package.json +++ b/packages/block/package.json @@ -1,5 +1,5 @@ { - "name": "ethereumjs-block", + "name": "@ethereumjs/block", "version": "3.0.0", "description": "Provides Block serialization and help functions", "main": "dist/index.js", @@ -26,7 +26,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/ethereumjs/ethereumjs-block.git" + "url": "git+https://github.com/ethereumjs/ethereumjs-vm.git" }, "keywords": [ "ethereum", @@ -35,17 +35,18 @@ "author": "mjbecze (mb@ethdev.com)", "license": "MPL-2.0", "bugs": { - "url": "https://github.com/ethereumjs/ethereumjs-block/issues" + "url": "https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aissue+label%3A\"package%3A+block\"" }, - "homepage": "https://github.com/ethereumjs/ethereumjs-block#readme", + "homepage": "https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/block#synopsis", "dependencies": { + "@ethereumjs/common": "^1.5.0", + "@ethereumjs/tx": "^2.1.1", "@types/bn.js": "^4.11.6", - "ethereumjs-common": "^1.5.0", - "ethereumjs-tx": "^2.1.1", "ethereumjs-util": "^7.0.2", "merkle-patricia-tree": "^2.1.2" }, "devDependencies": { + "@ethereumjs/blockchain": "^4.0.3", "@ethereumjs/config-nyc": "^1.1.1", "@ethereumjs/config-prettier": "^1.1.1", "@ethereumjs/config-tsc": "^1.1.1", From 7c88c836e42c132643f57ccaca1ca75d982872a7 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 13:20:30 -0400 Subject: [PATCH 04/15] npm package URL --- README.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index c9e05b6e63..e09bc014d9 100644 --- a/README.md +++ b/README.md @@ -72,7 +72,7 @@ If you want to join for work or do improvements on the libraries have a look at [js-standard-style-badge]: https://cdn.rawgit.com/feross/standard/master/badge.svg [js-standard-style-link]: https://github.com/feross/standard [account-package]: ./packages/account -[account-npm-badge]: https://img.shields.io/npm/v/ethereumjs-account.svg +[account-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/account.svg [account-npm-link]: https://www.npmjs.org/package/@ethereumjs/account [account-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20account?label=issues [account-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+account" @@ -81,7 +81,7 @@ If you want to join for work or do improvements on the libraries have a look at [account-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/branch/master/graph/badge.svg?flag=account [account-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/account [block-package]: ./packages/block -[block-npm-badge]: https://img.shields.io/npm/v/ethereumjs-block.svg +[block-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/block.svg [block-npm-link]: https://www.npmjs.org/package/@ethereumjs/block [block-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20block?label=issues [block-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+block" @@ -90,7 +90,7 @@ If you want to join for work or do improvements on the libraries have a look at [block-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/branch/master/graph/badge.svg?flag=block [block-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/block [blockchain-package]: ./packages/blockchain -[blockchain-npm-badge]: https://img.shields.io/npm/v/ethereumjs-blockchain.svg +[blockchain-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/blockchain.svg [blockchain-npm-link]: https://www.npmjs.org/package/@ethereumjs/blockchain [blockchain-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20blockchain?label=issues [blockchain-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+blockchain" @@ -99,7 +99,7 @@ If you want to join for work or do improvements on the libraries have a look at [blockchain-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/branch/master/graph/badge.svg?flag=blockchain [blockchain-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/blockchain [common-package]: ./packages/common -[common-npm-badge]: https://img.shields.io/npm/v/ethereumjs-common.svg +[common-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/common.svg [common-npm-link]: https://www.npmjs.org/package/@ethereumjs/common [common-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20common?label=issues [common-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+common" @@ -108,7 +108,7 @@ If you want to join for work or do improvements on the libraries have a look at [common-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/branch/master/graph/badge.svg?flag=common [common-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/common [tx-package]: ./packages/tx -[tx-npm-badge]: https://img.shields.io/npm/v/ethereumjs-tx.svg +[tx-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/tx.svg [tx-npm-link]: https://www.npmjs.org/package/@ethereumjs/tx [tx-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20tx?label=issues [tx-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+tx" @@ -117,7 +117,7 @@ If you want to join for work or do improvements on the libraries have a look at [tx-coverage-badge]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/branch/master/graph/badge.svg?flag=tx [tx-coverage-link]: https://codecov.io/gh/ethereumjs/ethereumjs-vm/tree/master/packages/tx [vm-package]: ./packages/vm -[vm-npm-badge]: https://img.shields.io/npm/v/ethereumjs-vm.svg +[vm-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/vm.svg [vm-npm-link]: https://www.npmjs.org/package/@ethereumjs/vm [vm-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20vm?label=issues [vm-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+vm" From 09a1b83ba4c7841a0ca0156f5ed65c6df50cb8b5 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 13:33:06 -0400 Subject: [PATCH 05/15] block: updating dependencies to scoped packages --- packages/block/src/block.ts | 4 +-- packages/block/src/from-rpc.ts | 5 ++-- packages/block/src/header.ts | 2 +- packages/block/src/types.ts | 4 +-- packages/block/test/block.spec.ts | 2 +- packages/block/test/header.spec.ts | 2 +- packages/block/test/util.ts | 41 ++++++++++++++++++++++++++++++ 7 files changed, 50 insertions(+), 10 deletions(-) create mode 100644 packages/block/test/util.ts diff --git a/packages/block/src/block.ts b/packages/block/src/block.ts index 2732727729..f39d86fef5 100644 --- a/packages/block/src/block.ts +++ b/packages/block/src/block.ts @@ -1,6 +1,6 @@ -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import { rlp, keccak256, KECCAK256_RLP, baToJSON } from 'ethereumjs-util' -import { Transaction, TransactionOptions } from 'ethereumjs-tx' +import { Transaction, TransactionOptions } from '@ethereumjs/tx' import { BlockHeader } from './header' import { Blockchain, BlockData, ChainOptions } from './types' diff --git a/packages/block/src/from-rpc.ts b/packages/block/src/from-rpc.ts index 7b86cb54a9..b2a92733f4 100644 --- a/packages/block/src/from-rpc.ts +++ b/packages/block/src/from-rpc.ts @@ -1,7 +1,6 @@ -import { FakeTransaction, TransactionOptions } from 'ethereumjs-tx' +import { FakeTransaction, TransactionOptions } from '@ethereumjs/tx' import { toBuffer, setLengthLeft } from 'ethereumjs-util' -import { Block } from './index' -import { ChainOptions } from './types' +import { Block, ChainOptions } from './index' import blockHeaderFromRpc from './header-from-rpc' diff --git a/packages/block/src/header.ts b/packages/block/src/header.ts index 16bb58a6db..04c2db42bb 100644 --- a/packages/block/src/header.ts +++ b/packages/block/src/header.ts @@ -1,4 +1,4 @@ -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import { BN, zeros, diff --git a/packages/block/src/types.ts b/packages/block/src/types.ts index 7b4b89a9d5..a9ae40b9fb 100644 --- a/packages/block/src/types.ts +++ b/packages/block/src/types.ts @@ -1,5 +1,5 @@ -import Common from 'ethereumjs-common' -import { TxData } from 'ethereumjs-tx' +import Common from '@ethereumjs/common' +import { TxData } from '@ethereumjs/tx' import { Block } from './block' /** diff --git a/packages/block/test/block.spec.ts b/packages/block/test/block.spec.ts index fe27d38651..5d4431e306 100644 --- a/packages/block/test/block.spec.ts +++ b/packages/block/test/block.spec.ts @@ -1,4 +1,4 @@ -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import tape = require('tape') import { rlp } from 'ethereumjs-util' diff --git a/packages/block/test/header.spec.ts b/packages/block/test/header.spec.ts index 66bb60b5b0..6c21bde5ad 100644 --- a/packages/block/test/header.spec.ts +++ b/packages/block/test/header.spec.ts @@ -1,5 +1,5 @@ import tape = require('tape') -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import { rlp, toBuffer, zeros, KECCAK256_RLP_S, KECCAK256_RLP_ARRAY_S } from 'ethereumjs-util' import { BlockHeader } from '../src/header' import { Block } from '../src/block' diff --git a/packages/block/test/util.ts b/packages/block/test/util.ts new file mode 100644 index 0000000000..fb351899a1 --- /dev/null +++ b/packages/block/test/util.ts @@ -0,0 +1,41 @@ +import Blockchain from '@ethereumjs/blockchain' +import { toBuffer } from 'ethereumjs-util' +import { Block } from '../src/block' +import { BlockHeader } from '../src/header' + +export const setupBlockchain = async (): Promise<[Blockchain, Block]> => { + return new Promise((resolve, reject) => { + const blockchain = new Blockchain({ + validateBlocks: true, + validatePow: false, + chain: 'ropsten', + }) + const genesisBlock = new Block(undefined, { chain: 'ropsten' }) + genesisBlock.setGenesisParams() + + blockchain.putGenesis(genesisBlock, (err?: Error) => { + if (err) { + return reject(err) + } + const nextBlock = new Block( + { + header: new BlockHeader({ + number: 1, + parentHash: genesisBlock.header.hash(), + gasLimit: genesisBlock.header.gasLimit, + timestamp: Date.now(), + }), + }, + { chain: 'ropsten' }, + ) + nextBlock.header.difficulty = toBuffer(nextBlock.header.canonicalDifficulty(genesisBlock)) + + blockchain.putBlock(nextBlock, async (err?: Error) => { + if (err) { + return reject(err) + } + resolve([blockchain, nextBlock]) + }) + }) + }) +} From 88ccadf5e0cc907a3361aacb6992d3b2ab30c643 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 13:55:10 -0400 Subject: [PATCH 06/15] blockchain: migrating to scoped packages --- packages/blockchain/README.md | 8 ++++---- packages/blockchain/package.json | 14 +++++++------- packages/blockchain/src/dbManager.ts | 2 +- packages/blockchain/src/index.ts | 4 ++-- packages/blockchain/test/index.ts | 2 +- packages/blockchain/test/util.ts | 2 +- 6 files changed, 16 insertions(+), 16 deletions(-) diff --git a/packages/blockchain/README.md b/packages/blockchain/README.md index cd026d0e5a..0c39fbcf99 100644 --- a/packages/blockchain/README.md +++ b/packages/blockchain/README.md @@ -26,7 +26,7 @@ This module performs write operations. Making a backup of your data before tryin ```javascript const level = require('level') -const Blockchain = require('ethereumjs-blockchain').default +const Blockchain = require('@ethereumjs/blockchain').default const utils = require('ethereumjs-util') const gethDbPath = './chaindata' // Add your own path here. It will get modified, see remarks. @@ -44,7 +44,7 @@ new Blockchain({ db: db }).iterator( ) ``` -**WARNING**: Since `ethereumjs-blockchain` is also doing write operations +**WARNING**: Since `@ethereumjs/blockchain` is also doing write operations on the DB for safety reasons only run this on a copy of your database, otherwise this might lead to a compromised DB state. @@ -58,8 +58,8 @@ If you want to join for work or do improvements on the libraries have a look at [gitter-link]: https://gitter.im/ethereum/ethereumjs [js-standard-style-badge]: https://cdn.rawgit.com/feross/standard/master/badge.svg [js-standard-style-link]: https://github.com/feross/standard -[blockchain-npm-badge]: https://img.shields.io/npm/v/ethereumjs-blockchain.svg -[blockchain-npm-link]: https://www.npmjs.org/package/ethereumjs-blockchain +[blockchain-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/blockchain.svg +[blockchain-npm-link]: https://www.npmjs.org/package/@ethereumjs/blockchain [blockchain-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20blockchain?label=issues [blockchain-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+blockchain" [blockchain-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/Blockchain%20Test/badge.svg diff --git a/packages/blockchain/package.json b/packages/blockchain/package.json index e31207b270..a35769c577 100644 --- a/packages/blockchain/package.json +++ b/packages/blockchain/package.json @@ -1,5 +1,5 @@ { - "name": "ethereumjs-blockchain", + "name": "@ethereumjs/blockchain", "version": "4.0.3", "description": "A module to store and interact with blocks", "main": "dist/index.js", @@ -24,7 +24,7 @@ }, "repository": { "type": "git", - "url": "git+https://github.com/ethereumjs/ethereumjs-blockchain.git" + "url": "git+https://github.com/ethereumjs/ethereumjs-vm.git" }, "keywords": [ "ethereum", @@ -33,15 +33,15 @@ "author": "mjbecze ", "license": "MPL-2.0", "bugs": { - "url": "https://github.com/ethereumjs/ethereumjs-blockchain/issues" + "url": "https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aissue+label%3A\"package%3A+blockchain\"" }, - "homepage": "https://github.com/ethereumjs/ethereumjs-blockchain#readme", + "homepage": "https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/blockchain#synopsis", "dependencies": { + "@ethereumjs/block": "~3.0.0", + "@ethereumjs/common": "^1.5.0", "async": "^2.6.1", "ethashjs": "~0.0.7", - "ethereumjs-block": "~3.0.0", - "ethereumjs-common": "^1.5.0", - "ethereumjs-util": "^7.0.2", + "ethereumjs-util": "~6.1.0", "flow-stoplight": "^1.0.0", "level-mem": "^3.0.1", "lru-cache": "^5.1.1", diff --git a/packages/blockchain/src/dbManager.ts b/packages/blockchain/src/dbManager.ts index 7d5db247fa..9a4b8642d3 100644 --- a/packages/blockchain/src/dbManager.ts +++ b/packages/blockchain/src/dbManager.ts @@ -14,7 +14,7 @@ import { import BN = require('bn.js') const level = require('level-mem') -import { Block, BlockHeader } from 'ethereumjs-block' +import { Block, BlockHeader } from '@ethereumjs/block' /** * Abstraction over a DB to facilitate storing/fetching blockchain-related diff --git a/packages/blockchain/src/index.ts b/packages/blockchain/src/index.ts index f2e4413238..2d4b7cd9c5 100644 --- a/packages/blockchain/src/index.ts +++ b/packages/blockchain/src/index.ts @@ -1,6 +1,7 @@ import * as async from 'async' import { BN, rlp } from 'ethereumjs-util' -import Common from 'ethereumjs-common' +import { Block, BlockHeader } from '@ethereumjs/block' +import Common from '@ethereumjs/common' import { callbackify } from './callbackify' import DBManager from './dbManager' import { @@ -14,7 +15,6 @@ import { tdKey, } from './util' -import { Block, BlockHeader } from 'ethereumjs-block' const Ethash = require('ethashjs') const Stoplight = require('flow-stoplight') const level = require('level-mem') diff --git a/packages/blockchain/test/index.ts b/packages/blockchain/test/index.ts index 0b10f399fa..1d5e6b8586 100644 --- a/packages/blockchain/test/index.ts +++ b/packages/blockchain/test/index.ts @@ -1,5 +1,5 @@ import * as async from 'async' -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import { toBuffer, bufferToInt } from 'ethereumjs-util' import * as test from 'tape' import Blockchain from '../src' diff --git a/packages/blockchain/test/util.ts b/packages/blockchain/test/util.ts index de769b79ec..6eb0c8ea7e 100644 --- a/packages/blockchain/test/util.ts +++ b/packages/blockchain/test/util.ts @@ -3,7 +3,7 @@ import BN = require('bn.js') import Blockchain from '../src' const util = require('util') -import { Block } from 'ethereumjs-block' +import { Block } from '@ethereumjs/block' const level = require('level-mem') export const generateBlockchain = async ( From c1bd59def6f089971f3ff0bd086adf530a9e2c86 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 13:58:55 -0400 Subject: [PATCH 07/15] common: migrating to scoped packages --- packages/common/README.md | 6 +++--- packages/common/package.json | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/common/README.md b/packages/common/README.md index deb72c7b2d..70c5e81612 100644 --- a/packages/common/README.md +++ b/packages/common/README.md @@ -25,7 +25,7 @@ together with a specific `hardfork` provided. Here are some simple usage examples: ```javascript -const Common = require('ethereumjs-common') +const Common = require('@ethereumjs/common') // Instantiate with only the chain let c = new Common('ropsten') @@ -176,8 +176,8 @@ If you want to join for work or do improvements on the libraries have a look at [gitter-link]: https://gitter.im/ethereum/ethereumjs [js-standard-style-badge]: https://cdn.rawgit.com/feross/standard/master/badge.svg [js-standard-style-link]: https://github.com/feross/standard -[common-npm-badge]: https://img.shields.io/npm/v/ethereumjs-common.svg -[common-npm-link]: https://www.npmjs.org/package/ethereumjs-common +[common-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/common.svg +[common-npm-link]: https://www.npmjs.org/package/@ethereumjs/common [common-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20common?label=issues [common-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+common" [common-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/Common%20Test/badge.svg diff --git a/packages/common/package.json b/packages/common/package.json index 36b3b62ee3..a1c0e17088 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,5 +1,5 @@ { - "name": "ethereumjs-common", + "name": "@ethereumjs/common", "version": "1.5.0", "description": "Resources common to all Ethereum implementations", "main": "./dist/index.js", From 36fc1909217a2441b604a2a88e7e942457bbd05b Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 14:09:02 -0400 Subject: [PATCH 08/15] tx: migrating to scoped packages --- packages/tx/README.md | 8 ++++---- packages/tx/examples/custom-chain-tx.ts | 2 +- packages/tx/package.json | 4 ++-- packages/tx/src/transaction.ts | 2 +- packages/tx/src/types.ts | 2 +- packages/tx/test/api.ts | 2 +- packages/tx/test/fake.ts | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/tx/README.md b/packages/tx/README.md index 46b4fcbe3d..1a90fcab10 100644 --- a/packages/tx/README.md +++ b/packages/tx/README.md @@ -17,7 +17,7 @@ - [example](https://github.com/ethereumjs/ethereumjs-tx/blob/master/examples/transactions.ts) ```javascript -const EthereumTx = require('ethereumjs-tx').Transaction +const EthereumTx = require('@ethereumjs/tx').Transaction const privateKey = Buffer.from( 'e331b6d69882b4cb4ea581d88e0b604039a3de5967688d3dcffdd2270c0fd109', 'hex', @@ -46,7 +46,7 @@ to be used. By default, `mainnet` and `petersburg` will be used. There are two ways of customizing these. The first one, as shown in the previous section, is by using an object with `chain` and `hardfork` names. You can see en example of this in [./examples/ropsten-tx.ts](./examples/ropsten-tx.ts). -The second option is by passing the option `common` set to an instance of [ethereumjs-common](https://github.com/ethereumjs/ethereumjs-common)' Common. This is specially useful for custom networks or chains/hardforks not yet supported by `ethereumjs-common`. You can see en example of this in [./examples/custom-chain-tx.ts](./examples/custom-chain-tx.ts). +The second option is by passing the option `common` set to an instance of [@ethereumjs/common](https://github.com/ethereumjs/ethereumjs-common)' Common. This is specially useful for custom networks or chains/hardforks not yet supported by `ethereumjs-common`. You can see en example of this in [./examples/custom-chain-tx.ts](./examples/custom-chain-tx.ts). ## MuirGlacier Support @@ -81,8 +81,8 @@ If you want to join for work or do improvements on the libraries have a look at [gitter-link]: https://gitter.im/ethereum/ethereumjs [js-standard-style-badge]: https://cdn.rawgit.com/feross/standard/master/badge.svg [js-standard-style-link]: https://github.com/feross/standard -[tx-npm-badge]: https://img.shields.io/npm/v/ethereumjs-tx.svg -[tx-npm-link]: https://www.npmjs.org/package/ethereumjs-tx +[tx-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/tx.svg +[tx-npm-link]: https://www.npmjs.org/package/@ethereumjs/tx [tx-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20tx?label=issues [tx-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+tx" [tx-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/Tx%20Test/badge.svg diff --git a/packages/tx/examples/custom-chain-tx.ts b/packages/tx/examples/custom-chain-tx.ts index 01191efae7..589dfa1648 100644 --- a/packages/tx/examples/custom-chain-tx.ts +++ b/packages/tx/examples/custom-chain-tx.ts @@ -1,5 +1,5 @@ import { Transaction } from '../src' -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import { bufferToHex, privateToAddress } from 'ethereumjs-util' // In this example we create a transaction for a custom network. diff --git a/packages/tx/package.json b/packages/tx/package.json index 3fcddb90af..961c0af739 100644 --- a/packages/tx/package.json +++ b/packages/tx/package.json @@ -1,5 +1,5 @@ { - "name": "ethereumjs-tx", + "name": "@ethereumjs/tx", "version": "2.1.2", "description": "A simple module for creating, manipulating and signing Ethereum transactions", "main": "dist/index.js", @@ -32,7 +32,7 @@ "author": "mjbecze ", "license": "MPL-2.0", "dependencies": { - "ethereumjs-common": "^1.5.0", + "@ethereumjs/common": "^1.5.0", "ethereumjs-util": "^7.0.2" }, "devDependencies": { diff --git a/packages/tx/src/transaction.ts b/packages/tx/src/transaction.ts index b3a72c11f2..e87f161ede 100644 --- a/packages/tx/src/transaction.ts +++ b/packages/tx/src/transaction.ts @@ -10,7 +10,7 @@ import { rlp, unpadBuffer, } from 'ethereumjs-util' -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import { Buffer } from 'buffer' import { BufferLike, PrefixedHexString, TxData, TransactionOptions } from './types' diff --git a/packages/tx/src/types.ts b/packages/tx/src/types.ts index 03d0c4efba..a53ed090ee 100644 --- a/packages/tx/src/types.ts +++ b/packages/tx/src/types.ts @@ -1,4 +1,4 @@ -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' /** * Any object that can be transformed into a `Buffer` diff --git a/packages/tx/test/api.ts b/packages/tx/test/api.ts index 996f3c3600..bd31d08960 100644 --- a/packages/tx/test/api.ts +++ b/packages/tx/test/api.ts @@ -4,7 +4,7 @@ import { rlp, zeros, privateToPublic, toBuffer } from 'ethereumjs-util' import Transaction from '../src/transaction' import { FakeTxData, TxsJsonEntry, VitaliksTestsDataEntry } from './types' -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import { TxData } from '../src' const txFixtures: TxsJsonEntry[] = require('./txs.json') diff --git a/packages/tx/test/fake.ts b/packages/tx/test/fake.ts index 53018e46fa..5c22d59cc0 100644 --- a/packages/tx/test/fake.ts +++ b/packages/tx/test/fake.ts @@ -1,7 +1,7 @@ import * as tape from 'tape' import { Buffer } from 'buffer' import { bufferToHex } from 'ethereumjs-util' -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import { FakeTransaction } from '../src' import { FakeTxData } from './types' From 859bf37456365b3bfb31eb8d6b19fcaf4c077a1a Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 15:39:38 -0400 Subject: [PATCH 09/15] vm: migrating to scoped packages --- packages/vm/README.md | 6 +- packages/vm/examples/run-blockchain/index.ts | 9 +- .../examples/run-solidity-contract/index.ts | 7 +- .../run-transactions-complete/index.ts | 4 +- packages/vm/lib/evm/eei.ts | 6 +- packages/vm/lib/evm/evm.ts | 5 +- packages/vm/lib/evm/interpreter.ts | 4 +- packages/vm/lib/evm/opcodes.ts | 2 +- packages/vm/lib/evm/precompiles/types.ts | 2 +- packages/vm/lib/index.ts | 4 - packages/vm/lib/runBlockchain.ts | 2 +- packages/vm/lib/runCall.ts | 2 +- packages/vm/lib/runCode.ts | 2 +- packages/vm/lib/runTx.ts | 6 +- packages/vm/lib/state/cache.ts | 4 +- packages/vm/lib/state/promisified.ts | 85 +++++++++++++++++++ packages/vm/lib/state/stateManager.ts | 4 +- packages/vm/package.json | 12 +-- packages/vm/tests/BlockchainTestsRunner.js | 4 +- packages/vm/tests/GeneralStateTestsRunner.js | 2 +- packages/vm/tests/VMTestsRunner.js | 2 +- packages/vm/tests/api/events.js | 5 ++ .../vm/tests/api/evm/precompiles/06-ecadd.js | 2 +- .../vm/tests/api/evm/precompiles/07-ecmul.js | 2 +- .../tests/api/evm/precompiles/08-ecpairing.js | 2 +- packages/vm/tests/api/index.js | 4 +- packages/vm/tests/api/istanbul/eip-1108.js | 2 +- packages/vm/tests/api/istanbul/eip-1344.js | 2 +- packages/vm/tests/api/istanbul/eip-152.js | 2 +- packages/vm/tests/api/istanbul/eip-1884.js | 2 +- packages/vm/tests/api/istanbul/eip-2200.js | 2 +- packages/vm/tests/api/opcodes.js | 2 +- packages/vm/tests/api/runBlock.js | 5 +- packages/vm/tests/api/runBlockchain.js | 6 +- packages/vm/tests/api/runTx.js | 2 +- packages/vm/tests/api/state/cache.js | 2 +- packages/vm/tests/api/state/stateManager.js | 5 ++ packages/vm/tests/api/utils.js | 6 +- packages/vm/tests/util.js | 6 +- 39 files changed, 162 insertions(+), 71 deletions(-) create mode 100644 packages/vm/lib/state/promisified.ts diff --git a/packages/vm/README.md b/packages/vm/README.md index 4c62c5867f..1c1a3bac98 100644 --- a/packages/vm/README.md +++ b/packages/vm/README.md @@ -62,7 +62,7 @@ Supported `Istanbul` EIPs: ```javascript const BN = require('bn.js') -var VM = require('ethereumjs-vm').default +var VM = require('@ethereumjs/vm').default // Create a new VM instance // For explicity setting the HF use e.g. `new VM({ hardfork: 'petersburg' })` @@ -207,8 +207,8 @@ If you want to join for work or do improvements on the libraries have a look at [gitter-link]: https://gitter.im/ethereum/ethereumjs [js-standard-style-badge]: https://cdn.rawgit.com/feross/standard/master/badge.svg [js-standard-style-link]: https://github.com/feross/standard -[vm-npm-badge]: https://img.shields.io/npm/v/ethereumjs-vm.svg -[vm-npm-link]: https://www.npmjs.org/package/ethereumjs-vm +[vm-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/vm.svg +[vm-npm-link]: https://www.npmjs.org/package/@ethereumjs/vm [vm-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20vm?label=issues [vm-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+vm" [vm-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/VM%20Test/badge.svg diff --git a/packages/vm/examples/run-blockchain/index.ts b/packages/vm/examples/run-blockchain/index.ts index 2cffe4a085..80be92583d 100644 --- a/packages/vm/examples/run-blockchain/index.ts +++ b/packages/vm/examples/run-blockchain/index.ts @@ -1,13 +1,14 @@ import VM from '../../' -import Account from 'ethereumjs-account' -import { Block, BlockHeader } from 'ethereumjs-block' -import Blockchain from 'ethereumjs-blockchain' +import Account from '@ethereumjs/account' +import { Block, BlockHeader } from '@ethereumjs/block' +import Blockchain from '@ethereumjs/blockchain' import { toBuffer, setLengthLeft } from 'ethereumjs-util' +import { promisify } from 'util' + const testData = require('./test-data') const level = require('level') -const { promisify } = require('util') async function main() { const hardfork = testData.network.toLowerCase() diff --git a/packages/vm/examples/run-solidity-contract/index.ts b/packages/vm/examples/run-solidity-contract/index.ts index 460867ecd1..5734aab147 100644 --- a/packages/vm/examples/run-solidity-contract/index.ts +++ b/packages/vm/examples/run-solidity-contract/index.ts @@ -4,11 +4,12 @@ import * as assert from 'assert' import * as path from 'path' import * as fs from 'fs' import { privateToAddress, bufferToHex } from 'ethereumjs-util' -import Account from 'ethereumjs-account' -import { Transaction } from 'ethereumjs-tx' +import { promisify } from 'util' +import Account from '@ethereumjs/account' +import { Transaction } from '@ethereumjs/tx' + const abi = require('ethereumjs-abi') const solc = require('solc') -const { promisify } = require('util') const INITIAL_GREETING = 'Hello, World!' const SECOND_GREETING = 'Hola, Mundo!' diff --git a/packages/vm/examples/run-transactions-complete/index.ts b/packages/vm/examples/run-transactions-complete/index.ts index 227c47db77..55fa4473ee 100644 --- a/packages/vm/examples/run-transactions-complete/index.ts +++ b/packages/vm/examples/run-transactions-complete/index.ts @@ -1,7 +1,7 @@ import VM from '../..' -import Account from 'ethereumjs-account' +import Account from '@ethereumjs/account' import { toBuffer, pubToAddress, bufferToHex } from 'ethereumjs-util' -import { Transaction } from 'ethereumjs-tx' +import { Transaction } from '@ethereumjs/tx' async function main() { const vm = new VM() diff --git a/packages/vm/lib/evm/eei.ts b/packages/vm/lib/evm/eei.ts index 4df63ea985..7f22d09a6a 100644 --- a/packages/vm/lib/evm/eei.ts +++ b/packages/vm/lib/evm/eei.ts @@ -1,8 +1,8 @@ import BN = require('bn.js') import { toBuffer } from 'ethereumjs-util' -import Account from 'ethereumjs-account' -import Blockchain from 'ethereumjs-blockchain' -import Common from 'ethereumjs-common' +import Account from '@ethereumjs/account' +import Blockchain from '@ethereumjs/blockchain' +import Common from '@ethereumjs/common' import { StateManager } from '../state/index' import { VmError, ERROR } from '../exceptions' import Message from './message' diff --git a/packages/vm/lib/evm/evm.ts b/packages/vm/lib/evm/evm.ts index 3db478d7fe..d658787d99 100644 --- a/packages/vm/lib/evm/evm.ts +++ b/packages/vm/lib/evm/evm.ts @@ -7,7 +7,8 @@ import { toBuffer, zeros, } from 'ethereumjs-util' -import Account from 'ethereumjs-account' +import Account from '@ethereumjs/account' +import { Block } from '@ethereumjs/block' import { ERROR, VmError } from '../exceptions' import { StateManager } from '../state/index' import { getPrecompile, PrecompileFunc, ripemdPrecompileAddress } from './precompiles' @@ -16,8 +17,6 @@ import Message from './message' import EEI from './eei' import { default as Interpreter, InterpreterOpts, RunState } from './interpreter' -import { Block } from 'ethereumjs-block' - /** * Result of executing a message via the [[EVM]]. */ diff --git a/packages/vm/lib/evm/interpreter.ts b/packages/vm/lib/evm/interpreter.ts index 259fae8061..2a8fa53656 100644 --- a/packages/vm/lib/evm/interpreter.ts +++ b/packages/vm/lib/evm/interpreter.ts @@ -1,5 +1,6 @@ import BN = require('bn.js') -import Common from 'ethereumjs-common' +import Account from '@ethereumjs/account' +import Common from '@ethereumjs/common' import { StateManager } from '../state/index' import { ERROR, VmError } from '../exceptions' import Memory from './memory' @@ -7,7 +8,6 @@ import Stack from './stack' import EEI from './eei' import { Opcode } from './opcodes' import { handlers as opHandlers, OpHandler } from './opFns' -import Account from 'ethereumjs-account' export interface InterpreterOpts { pc?: number diff --git a/packages/vm/lib/evm/opcodes.ts b/packages/vm/lib/evm/opcodes.ts index b89d2264ba..86269e52d1 100644 --- a/packages/vm/lib/evm/opcodes.ts +++ b/packages/vm/lib/evm/opcodes.ts @@ -1,4 +1,4 @@ -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' export class Opcode { readonly code: number diff --git a/packages/vm/lib/evm/precompiles/types.ts b/packages/vm/lib/evm/precompiles/types.ts index 2b75632267..9263493c5e 100644 --- a/packages/vm/lib/evm/precompiles/types.ts +++ b/packages/vm/lib/evm/precompiles/types.ts @@ -1,5 +1,5 @@ import BN = require('bn.js') -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import { ExecResult } from '../evm' export interface PrecompileFunc { diff --git a/packages/vm/lib/index.ts b/packages/vm/lib/index.ts index 0e38a2ab5f..23525e8ea4 100644 --- a/packages/vm/lib/index.ts +++ b/packages/vm/lib/index.ts @@ -1,8 +1,4 @@ import BN = require('bn.js') -import Account from 'ethereumjs-account' -import Blockchain from 'ethereumjs-blockchain' -import Common from 'ethereumjs-common' -import { StateManager } from './state/index' import { default as runCode, RunCodeOpts } from './runCode' import { default as runCall, RunCallOpts } from './runCall' import { default as runTx, RunTxOpts, RunTxResult } from './runTx' diff --git a/packages/vm/lib/runBlockchain.ts b/packages/vm/lib/runBlockchain.ts index 472cffabd9..bbc8afb21d 100644 --- a/packages/vm/lib/runBlockchain.ts +++ b/packages/vm/lib/runBlockchain.ts @@ -1,4 +1,4 @@ -import Blockchain from 'ethereumjs-blockchain' +import Blockchain from '@ethereumjs/blockchain' import VM from './index' const async = require('async') const callbackify = require('util-callbackify') diff --git a/packages/vm/lib/runCall.ts b/packages/vm/lib/runCall.ts index 43d747de71..374204a5e0 100644 --- a/packages/vm/lib/runCall.ts +++ b/packages/vm/lib/runCall.ts @@ -4,7 +4,7 @@ import VM from './index' import TxContext from './evm/txContext' import Message from './evm/message' import { default as EVM, EVMResult } from './evm/evm' -import { Block } from 'ethereumjs-block' +import { Block } from '@ethereumjs/block' /** * Options for running a call (or create) operation diff --git a/packages/vm/lib/runCode.ts b/packages/vm/lib/runCode.ts index 03bc748019..ffb02f93ae 100644 --- a/packages/vm/lib/runCode.ts +++ b/packages/vm/lib/runCode.ts @@ -16,7 +16,7 @@ import VM from './index' import TxContext from './evm/txContext' import Message from './evm/message' import { default as EVM, ExecResult } from './evm/evm' -import { Block } from 'ethereumjs-block' +import { Block } from '@ethereumjs/block' /** * Options for the [[runCode]] method. diff --git a/packages/vm/lib/runTx.ts b/packages/vm/lib/runTx.ts index 10ffe459d8..fad163bcbc 100644 --- a/packages/vm/lib/runTx.ts +++ b/packages/vm/lib/runTx.ts @@ -1,13 +1,13 @@ import BN = require('bn.js') import { toBuffer } from 'ethereumjs-util' -import Account from 'ethereumjs-account' -import { Transaction } from 'ethereumjs-tx' +import Account from '@ethereumjs/account' +import { Transaction } from '@ethereumjs/tx' import VM from './index' import Bloom from './bloom' import { default as EVM, EVMResult } from './evm/evm' import Message from './evm/message' import TxContext from './evm/txContext' -import { Block } from 'ethereumjs-block' +import { Block } from '@ethereumjs/block' /** * Options for the `runTx` method. diff --git a/packages/vm/lib/state/cache.ts b/packages/vm/lib/state/cache.ts index 9b17303904..c745728e2d 100644 --- a/packages/vm/lib/state/cache.ts +++ b/packages/vm/lib/state/cache.ts @@ -1,6 +1,6 @@ -import Account from 'ethereumjs-account' -const Tree = require('functional-red-black-tree') const promisify = require('util.promisify') +const Tree = require('functional-red-black-tree') +import Account from '@ethereumjs/account' /** * @ignore diff --git a/packages/vm/lib/state/promisified.ts b/packages/vm/lib/state/promisified.ts new file mode 100644 index 0000000000..fa97252a5d --- /dev/null +++ b/packages/vm/lib/state/promisified.ts @@ -0,0 +1,85 @@ +const promisify = require('util.promisify') +import Account from '@ethereumjs/account' +import { default as StateManager, StorageDump } from './stateManager' + +/** + * Promisified wrapper around [[StateManager]] + * @ignore + */ +export default class PStateManager { + _wrapped: StateManager + + public readonly getAccount: (addr: Buffer) => Promise + public readonly putAccount: (addr: Buffer, account: Account) => Promise + public readonly putContractCode: (addr: Buffer, code: Buffer) => Promise + public readonly getContractCode: (addr: Buffer) => Promise + public readonly getContractStorage: (addr: Buffer, key: Buffer) => Promise + public readonly getOriginalContractStorage: (addr: Buffer, key: Buffer) => Promise + public readonly putContractStorage: (addr: Buffer, key: Buffer, value: Buffer) => Promise + public readonly clearContractStorage: (addr: Buffer) => Promise + public readonly checkpoint: () => Promise + public readonly commit: () => Promise + public readonly revert: () => Promise + public readonly getStateRoot: () => Promise + public readonly setStateRoot: (root: Buffer) => Promise + public readonly dumpStorage: (address: Buffer) => Promise + public readonly hasGenesisState: () => Promise + public readonly generateCanonicalGenesis: () => Promise + public readonly generateGenesis: (initState: any) => Promise + public readonly accountIsEmpty: (address: Buffer) => Promise + public readonly cleanupTouchedAccounts: () => Promise + + constructor(wrapped: StateManager) { + this._wrapped = wrapped + + // We cache these promisified function as they are called lots of times during the VM execution, + // and promisifying them each time has degrades its performance. + this.getAccount = promisify(this._wrapped.getAccount.bind(this._wrapped)) + + this.putAccount = promisify(this._wrapped.putAccount.bind(this._wrapped)) + + this.putContractCode = promisify(this._wrapped.putContractCode.bind(this._wrapped)) + + this.getContractCode = promisify(this._wrapped.getContractCode.bind(this._wrapped)) + + this.getContractStorage = promisify(this._wrapped.getContractStorage.bind(this._wrapped)) + + this.getOriginalContractStorage = promisify( + this._wrapped.getOriginalContractStorage.bind(this._wrapped), + ) + + this.putContractStorage = promisify(this._wrapped.putContractStorage.bind(this._wrapped)) + + this.clearContractStorage = promisify(this._wrapped.clearContractStorage.bind(this._wrapped)) + + this.checkpoint = promisify(this._wrapped.checkpoint.bind(this._wrapped)) + + this.commit = promisify(this._wrapped.commit.bind(this._wrapped)) + + this.revert = promisify(this._wrapped.revert.bind(this._wrapped)) + + this.getStateRoot = promisify(this._wrapped.getStateRoot.bind(this._wrapped)) + + this.setStateRoot = promisify(this._wrapped.setStateRoot.bind(this._wrapped)) + + this.dumpStorage = promisify(this._wrapped.dumpStorage.bind(this._wrapped)) + + this.hasGenesisState = promisify(this._wrapped.hasGenesisState.bind(this._wrapped)) + + this.generateCanonicalGenesis = promisify( + this._wrapped.generateCanonicalGenesis.bind(this._wrapped), + ) + + this.generateGenesis = promisify(this._wrapped.generateGenesis.bind(this._wrapped)) + + this.accountIsEmpty = promisify(this._wrapped.accountIsEmpty.bind(this._wrapped)) + + this.cleanupTouchedAccounts = promisify( + this._wrapped.cleanupTouchedAccounts.bind(this._wrapped), + ) + } + + copy(): PStateManager { + return new PStateManager(this._wrapped.copy()) + } +} diff --git a/packages/vm/lib/state/stateManager.ts b/packages/vm/lib/state/stateManager.ts index 7c80edda73..58671bf79b 100644 --- a/packages/vm/lib/state/stateManager.ts +++ b/packages/vm/lib/state/stateManager.ts @@ -4,9 +4,9 @@ const promisify = require('util.promisify') import { toBuffer, KECCAK256_NULL_S } from 'ethereumjs-util' import BN = require('bn.js') import { encode, decode } from 'rlp' -import Common from 'ethereumjs-common' +import Common from '@ethereumjs/common' import { genesisStateByName } from 'ethereumjs-common/dist/genesisStates' -import Account from 'ethereumjs-account' +import Account from '@ethereumjs/account' import Cache from './cache' import { ripemdPrecompileAddress } from '../evm/precompiles' diff --git a/packages/vm/package.json b/packages/vm/package.json index b15f245b98..779bae8920 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -1,5 +1,5 @@ { - "name": "ethereumjs-vm", + "name": "@ethereumjs/vm", "version": "4.1.3", "description": "An Ethereum VM implementation", "main": "dist/index.js", @@ -44,11 +44,11 @@ "async": "^3.2.0", "async-eventemitter": "^0.2.4", "core-js-pure": "^3.0.1", - "ethereumjs-account": "^3.0.0", - "ethereumjs-block": "^3.0.0", - "ethereumjs-blockchain": "^4.0.3", - "ethereumjs-common": "^1.5.0", - "ethereumjs-tx": "^2.1.2", + "@ethereumjs/account": "^3.0.0", + "@ethereumjs/block": "^2.2.2", + "@ethereumjs/blockchain": "^4.0.3", + "@ethereumjs/common": "^1.5.0", + "@ethereumjs/tx": "^2.1.2", "ethereumjs-util": "^7.0.2", "functional-red-black-tree": "^1.0.1", "merkle-patricia-tree": "^2.3.2", diff --git a/packages/vm/tests/BlockchainTestsRunner.js b/packages/vm/tests/BlockchainTestsRunner.js index c53a7430d4..fc999d77fe 100644 --- a/packages/vm/tests/BlockchainTestsRunner.js +++ b/packages/vm/tests/BlockchainTestsRunner.js @@ -2,8 +2,8 @@ const async = require('async') const testUtil = require('./util.js') const ethUtil = require('ethereumjs-util') const Trie = require('merkle-patricia-tree/secure') -const {Block, BlockHeader} = require('ethereumjs-block') -const Blockchain = require('ethereumjs-blockchain').default +const { Block, BlockHeader } = require('@ethereumjs/block') +const { Blockchain } = require('@ethereumjs/blockchain') const level = require('level') const levelMem = require('level-mem') diff --git a/packages/vm/tests/GeneralStateTestsRunner.js b/packages/vm/tests/GeneralStateTestsRunner.js index 58831b199b..fcc7ab9beb 100644 --- a/packages/vm/tests/GeneralStateTestsRunner.js +++ b/packages/vm/tests/GeneralStateTestsRunner.js @@ -2,7 +2,7 @@ const async = require('async') const testUtil = require('./util') const Trie = require('merkle-patricia-tree/secure') const ethUtil = require('ethereumjs-util') -const Account = require('ethereumjs-account').default +const Account = require('@ethereumjs/account').default const BN = ethUtil.BN function parseTestCases(forkConfigTestSuite, testData, data, gasLimit, value) { diff --git a/packages/vm/tests/VMTestsRunner.js b/packages/vm/tests/VMTestsRunner.js index 0d19503d42..2e61a38cad 100644 --- a/packages/vm/tests/VMTestsRunner.js +++ b/packages/vm/tests/VMTestsRunner.js @@ -1,6 +1,6 @@ const async = require('async') const VM = require('../') -const Account = require('ethereumjs-account').default +const Account = require('@ethereumjs/account').default const testUtil = require('./util') const Trie = require('merkle-patricia-tree/secure') const ethUtil = require('ethereumjs-util') diff --git a/packages/vm/tests/api/events.js b/packages/vm/tests/api/events.js index 3616d5eb36..331376b4d4 100644 --- a/packages/vm/tests/api/events.js +++ b/packages/vm/tests/api/events.js @@ -1,7 +1,12 @@ const tape = require('tape') const util = require('ethereumjs-util') +<<<<<<< HEAD const { Transaction } = require('ethereumjs-tx') const Block = require('ethereumjs-block').Block +======= +const { Transaction } = require('@ethereumjs/tx') +const Block = require('@ethereumjs/block') +>>>>>>> vm: migrating to scoped packages const VM = require('../../dist/index').default tape('VM events', t => { diff --git a/packages/vm/tests/api/evm/precompiles/06-ecadd.js b/packages/vm/tests/api/evm/precompiles/06-ecadd.js index a99cd65c2d..0b57ee64b9 100644 --- a/packages/vm/tests/api/evm/precompiles/06-ecadd.js +++ b/packages/vm/tests/api/evm/precompiles/06-ecadd.js @@ -1,6 +1,6 @@ const BN = require('bn.js') const tape = require('tape') -const Common = require('ethereumjs-common').default +const Common = require('@ethereumjs/common').default const util = require('ethereumjs-util') const VM = require('../../../../dist/index').default const { getPrecompile } = require('../../../../dist/evm/precompiles') diff --git a/packages/vm/tests/api/evm/precompiles/07-ecmul.js b/packages/vm/tests/api/evm/precompiles/07-ecmul.js index 16cfc54587..5ec9593ad8 100644 --- a/packages/vm/tests/api/evm/precompiles/07-ecmul.js +++ b/packages/vm/tests/api/evm/precompiles/07-ecmul.js @@ -1,6 +1,6 @@ const BN = require('bn.js') const tape = require('tape') -const Common = require('ethereumjs-common').default +const Common = require('@ethereumjs/common').default const util = require('ethereumjs-util') const VM = require('../../../../dist/index').default const { getPrecompile } = require('../../../../dist/evm/precompiles') diff --git a/packages/vm/tests/api/evm/precompiles/08-ecpairing.js b/packages/vm/tests/api/evm/precompiles/08-ecpairing.js index 71b8ee7490..3dffac03e1 100644 --- a/packages/vm/tests/api/evm/precompiles/08-ecpairing.js +++ b/packages/vm/tests/api/evm/precompiles/08-ecpairing.js @@ -1,6 +1,6 @@ const BN = require('bn.js') const tape = require('tape') -const Common = require('ethereumjs-common').default +const Common = require('@ethereumjs/common').default const util = require('ethereumjs-util') const VM = require('../../../../dist/index').default const { getPrecompile } = require('../../../../dist/evm/precompiles') diff --git a/packages/vm/tests/api/index.js b/packages/vm/tests/api/index.js index b795439290..49e1f4154f 100644 --- a/packages/vm/tests/api/index.js +++ b/packages/vm/tests/api/index.js @@ -1,8 +1,8 @@ const tape = require('tape') const promisify = require('util.promisify') const util = require('ethereumjs-util') -const Block = require('ethereumjs-block').Block -const Common = require('ethereumjs-common').default +const { Block } = require('@ethereumjs/block') +const Common = require('@ethereumjs/common').default const Trie = require('merkle-patricia-tree/secure') const VM = require('../../dist/index').default const { setupVM } = require('./utils') diff --git a/packages/vm/tests/api/istanbul/eip-1108.js b/packages/vm/tests/api/istanbul/eip-1108.js index 48751e4301..e3b77384b9 100644 --- a/packages/vm/tests/api/istanbul/eip-1108.js +++ b/packages/vm/tests/api/istanbul/eip-1108.js @@ -1,6 +1,6 @@ const BN = require('bn.js') const tape = require('tape') -const Common = require('ethereumjs-common').default +const Common = require('@ethereumjs/common').default const util = require('ethereumjs-util') const VM = require('../../../dist/index').default const { getPrecompile } = require('../../../dist/evm/precompiles') diff --git a/packages/vm/tests/api/istanbul/eip-1344.js b/packages/vm/tests/api/istanbul/eip-1344.js index a5209d3c78..45b4c5ee04 100644 --- a/packages/vm/tests/api/istanbul/eip-1344.js +++ b/packages/vm/tests/api/istanbul/eip-1344.js @@ -1,6 +1,6 @@ const tape = require('tape') const BN = require('bn.js') -const Common = require('ethereumjs-common').default +const Common = require('@ethereumjs/common').default const VM = require('../../../dist/index').default const { ERROR } = require('../../../dist/exceptions') diff --git a/packages/vm/tests/api/istanbul/eip-152.js b/packages/vm/tests/api/istanbul/eip-152.js index 9e684bb92a..6cd0f8cde3 100644 --- a/packages/vm/tests/api/istanbul/eip-152.js +++ b/packages/vm/tests/api/istanbul/eip-152.js @@ -1,6 +1,6 @@ const tape = require('tape') const BN = require('bn.js') -const Common = require('ethereumjs-common').default +const Common = require('@ethereumjs/common').default const blake2f = require('../../../dist/evm/precompiles/09-blake2f').default const F = require('../../../dist/evm/precompiles/09-blake2f').F const { ERROR } = require('../../../dist/exceptions') diff --git a/packages/vm/tests/api/istanbul/eip-1884.js b/packages/vm/tests/api/istanbul/eip-1884.js index 50ed1175ed..08a6cb2298 100644 --- a/packages/vm/tests/api/istanbul/eip-1884.js +++ b/packages/vm/tests/api/istanbul/eip-1884.js @@ -1,6 +1,6 @@ const tape = require('tape') const BN = require('bn.js') -const Common = require('ethereumjs-common').default +const Common = require('@ethereumjs/common').default const VM = require('../../../dist/index').default const { ERROR } = require('../../../dist/exceptions') const { createAccount } = require('../utils') diff --git a/packages/vm/tests/api/istanbul/eip-2200.js b/packages/vm/tests/api/istanbul/eip-2200.js index e8378273fa..f697592f49 100644 --- a/packages/vm/tests/api/istanbul/eip-2200.js +++ b/packages/vm/tests/api/istanbul/eip-2200.js @@ -1,6 +1,6 @@ const tape = require('tape') const BN = require('bn.js') -const Common = require('ethereumjs-common').default +const Common = require('@ethereumjs/common').default const VM = require('../../../dist/index').default const { ERROR } = require('../../../dist/exceptions') const { createAccount } = require('../utils') diff --git a/packages/vm/tests/api/opcodes.js b/packages/vm/tests/api/opcodes.js index d0480fd07b..1e583d9822 100644 --- a/packages/vm/tests/api/opcodes.js +++ b/packages/vm/tests/api/opcodes.js @@ -1,6 +1,6 @@ const tape = require('tape') const { getOpcodesForHF } = require('../../dist/evm/opcodes') -const Common = require('ethereumjs-common').default +const Common = require('@ethereumjs/common').default const CHAINID = 0x46 diff --git a/packages/vm/tests/api/runBlock.js b/packages/vm/tests/api/runBlock.js index 7028eb5527..f9e90331c7 100644 --- a/packages/vm/tests/api/runBlock.js +++ b/packages/vm/tests/api/runBlock.js @@ -1,7 +1,6 @@ const tape = require('tape') -const promisify = require('util.promisify') -const Block = require('ethereumjs-block').Block -const Common = require('ethereumjs-common').default +const { Block } = require('@ethereumjs/block') +const Common = require('@ethereumjs/common').default const util = require('ethereumjs-util') const runBlock = require('../../dist/runBlock').default const { StateManager } = require('../../dist/state') diff --git a/packages/vm/tests/api/runBlockchain.js b/packages/vm/tests/api/runBlockchain.js index 5eb07946b7..e7a7633eb0 100644 --- a/packages/vm/tests/api/runBlockchain.js +++ b/packages/vm/tests/api/runBlockchain.js @@ -1,9 +1,9 @@ const tape = require('tape') const level = require('level-mem') const promisify = require('util.promisify') -const Blockchain = require('ethereumjs-blockchain').default -const Block = require('ethereumjs-block').Block -const Common = require('ethereumjs-common').default +const Blockchain = require('@ethereumjs/blockchain').default +const Block = require('@ethereumjs/block') +const Common = require('@ethereumjs/common').default const util = require('ethereumjs-util') const runBlockchain = require('../../dist/runBlockchain').default const { StateManager } = require('../../dist/state') diff --git a/packages/vm/tests/api/runTx.js b/packages/vm/tests/api/runTx.js index da7be15c2b..bf8825d27f 100644 --- a/packages/vm/tests/api/runTx.js +++ b/packages/vm/tests/api/runTx.js @@ -1,5 +1,5 @@ const tape = require('tape') -const Transaction = require('ethereumjs-tx').Transaction +const Transaction = require('@ethereumjs/tx').Transaction const ethUtil = require('ethereumjs-util') const runTx = require('../../dist/runTx').default const { StateManager } = require('../../dist/state') diff --git a/packages/vm/tests/api/state/cache.js b/packages/vm/tests/api/state/cache.js index 0e41891d25..929b91d754 100644 --- a/packages/vm/tests/api/state/cache.js +++ b/packages/vm/tests/api/state/cache.js @@ -1,7 +1,7 @@ const tape = require('tape') const promisify = require('util.promisify') const Trie = require('merkle-patricia-tree/secure.js') -const Account = require('ethereumjs-account').default +const Account = require('@ethereumjs/account').default const Cache = require('../../../dist/state/cache').default const utils = require('../utils') diff --git a/packages/vm/tests/api/state/stateManager.js b/packages/vm/tests/api/state/stateManager.js index b04804724b..93d5a94543 100644 --- a/packages/vm/tests/api/state/stateManager.js +++ b/packages/vm/tests/api/state/stateManager.js @@ -1,7 +1,12 @@ const tape = require('tape') const { parallel } = require('async') +<<<<<<< HEAD const { toBuffer, keccak256, KECCAK256_RLP } = require('ethereumjs-util') const Common = require('ethereumjs-common').default +======= +const util = require('ethereumjs-util') +const Common = require('@ethereumjs/common').default +>>>>>>> vm: migrating to scoped packages const { StateManager } = require('../../../dist/state') const { createAccount } = require('../utils') const { isRunningInKarma } = require('../../util') diff --git a/packages/vm/tests/api/utils.js b/packages/vm/tests/api/utils.js index 8aede871b5..449ee9546a 100644 --- a/packages/vm/tests/api/utils.js +++ b/packages/vm/tests/api/utils.js @@ -1,7 +1,7 @@ -const Block = require('ethereumjs-block').Block -const Account = require('ethereumjs-account').default +const Block = require('@ethereumjs/block') +const { Account } = require('@ethereumjs/account').default const level = require('level-mem') -const Blockchain = require('ethereumjs-blockchain').default +const Blockchain = require('@ethereumjs/blockchain').default const VM = require('../../dist/index').default function createGenesis (opts = {}) { diff --git a/packages/vm/tests/util.js b/packages/vm/tests/util.js index 07c0b4fe45..f2fe067367 100644 --- a/packages/vm/tests/util.js +++ b/packages/vm/tests/util.js @@ -1,8 +1,8 @@ const async = require('async') const { BN, rlp, keccak256, stripHexPrefix, setLengthLeft } = require('ethereumjs-util') -const Account = require('ethereumjs-account').default -const Transaction = require('ethereumjs-tx').Transaction -const Block = require('ethereumjs-block').Block +const { Account } = require('@ethereumjs/account') +const Transaction = require('@ethereumjs/tx').Transaction +const Block = require('@ethereumjs/block').Block exports.dumpState = function (state, cb) { function readAccounts(state) { From 7440612a8667ddc3f3ee6ea9ca68ee52264f4a2d Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 15:41:00 -0400 Subject: [PATCH 10/15] account,block: updating badges --- packages/account/README.md | 4 ++-- packages/block/README.md | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/account/README.md b/packages/account/README.md index 8af8050aa8..5b5e03683c 100644 --- a/packages/account/README.md +++ b/packages/account/README.md @@ -42,8 +42,8 @@ If you want to join for work or do improvements on the libraries have a look at [gitter-link]: https://gitter.im/ethereum/ethereumjs [js-standard-style-badge]: https://cdn.rawgit.com/feross/standard/master/badge.svg [js-standard-style-link]: https://github.com/feross/standard -[account-npm-badge]: https://img.shields.io/npm/v/ethereumjs-account.svg -[account-npm-link]: https://www.npmjs.org/package/ethereumjs-account +[account-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/account.svg +[account-npm-link]: https://www.npmjs.org/package/@ethereumjs/account [account-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20account?label=issues [account-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+account" [account-actions-badge]: https://github.com/ethereumjs/ethereumjs-vm/workflows/Account%20Test/badge.svg diff --git a/packages/block/README.md b/packages/block/README.md index b9dec6fb87..3de044bb65 100644 --- a/packages/block/README.md +++ b/packages/block/README.md @@ -42,7 +42,7 @@ If you want to join for work or do improvements on the libraries have a look at [gitter-link]: https://gitter.im/ethereum/ethereumjs [js-standard-style-badge]: https://cdn.rawgit.com/feross/standard/master/badge.svg [js-standard-style-link]: https://github.com/feross/standard -[block-npm-badge]: https://img.shields.io/npm/v/ethereumjs-block.svg +[block-npm-badge]: https://img.shields.io/npm/v/@ethereumjs/block.svg [block-npm-link]: https://www.npmjs.org/package/@ethereumjs/block [block-issues-badge]: https://img.shields.io/github/issues/ethereumjs/ethereumjs-vm/package:%20block?label=issues [block-issues-link]: https://github.com/ethereumjs/ethereumjs-vm/issues?q=is%3Aopen+is%3Aissue+label%3A"package%3A+block" From 0866c46e68df2e1dc51b0e4224761890ac09da40 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 16 Mar 2020 15:41:50 -0400 Subject: [PATCH 11/15] vm: updating patch to scoped packages --- scripts/01-modify-require-dist-to-src.patch | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 scripts/01-modify-require-dist-to-src.patch diff --git a/scripts/01-modify-require-dist-to-src.patch b/scripts/01-modify-require-dist-to-src.patch new file mode 100644 index 0000000000..64267f8fe9 --- /dev/null +++ b/scripts/01-modify-require-dist-to-src.patch @@ -0,0 +1,11 @@ +--- ./packages/vm/lib/state/stateManager.ts ++++ ./packages/vm/lib/state/stateManager.ts +@@ -5,7 +5,7 @@ import * as utils from 'ethereumjs-util' + import BN = require('bn.js') + import { encode, decode } from 'rlp' + import Common from '@ethereumjs/common' +-import { genesisStateByName } from 'ethereumjs-common/dist/genesisStates' ++import { genesisStateByName } from 'ethereumjs-common/genesisStates' + import Account from '@ethereumjs/account' + import Cache from './cache' + import { ripemdPrecompileAddress } from '../evm/precompiles' From 039e50a62473429f6022f2a87349cb857e736f08 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 1 Jun 2020 21:41:11 -0400 Subject: [PATCH 12/15] fix: updating new occurrences of package names --- .github/workflows/account-build.yml | 6 +++--- .github/workflows/block-build.yml | 2 +- .github/workflows/blockchain-build.yml | 6 +++--- .github/workflows/common-build.yml | 6 +++--- .github/workflows/tx-bulid.yml | 6 +++--- .github/workflows/vm-build.yml | 14 +++++++------- .github/workflows/vm-nightly-test.yml | 16 ++++++++-------- packages/blockchain/test/index.ts | 2 +- packages/vm/lib/state/stateManager.ts | 2 +- packages/vm/package.json | 2 +- packages/vm/tests/api/events.js | 5 ----- packages/vm/tests/api/state/stateManager.js | 5 ----- scripts/01-modify-require-dist-to-src.patch | 4 ++-- 13 files changed, 33 insertions(+), 43 deletions(-) diff --git a/.github/workflows/account-build.yml b/.github/workflows/account-build.yml index e11d97fed7..e7f062b1b1 100644 --- a/.github/workflows/account-build.yml +++ b/.github/workflows/account-build.yml @@ -29,9 +29,9 @@ jobs: with: node-version: '${{ matrix.node-version }}' - uses: actions/checkout@v1 - - run: npx lerna bootstrap --scope ethereumjs-account --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run build --scope ethereumjs-account --include-dependencies - - run: npx lerna run lint --scope ethereumjs-account + - run: npx lerna bootstrap --scope @ethereumjs/account --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run build --scope @ethereumjs/account --include-dependencies + - run: npx lerna run lint --scope @ethereumjs/account - run: npm test env: CI: true diff --git a/.github/workflows/block-build.yml b/.github/workflows/block-build.yml index fcb39afefa..f244851c02 100644 --- a/.github/workflows/block-build.yml +++ b/.github/workflows/block-build.yml @@ -29,7 +29,7 @@ jobs: - uses: actions/checkout@v1 - run: npm install working-directory: '${{ env.cwd }}' - - run: npx lerna run lint --scope ethereumjs-block + - run: npx lerna run lint --scope @ethereumjs/block - run: npm run test:node env: CI: true diff --git a/.github/workflows/blockchain-build.yml b/.github/workflows/blockchain-build.yml index ff282b8e8e..30507c3c18 100644 --- a/.github/workflows/blockchain-build.yml +++ b/.github/workflows/blockchain-build.yml @@ -29,9 +29,9 @@ jobs: with: node-version: '${{ matrix.node-version }}' - uses: actions/checkout@v1 - - run: npx lerna bootstrap --scope ethereumjs-blockchain --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run --scope ethereumjs-blockchain --include-dependencies build - - run: npx lerna run lint --scope ethereumjs-blockchain + - run: npx lerna bootstrap --scope @ethereumjs/blockchain --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run --scope @ethereumjs/blockchain --include-dependencies build + - run: npx lerna run lint --scope @ethereumjs/blockchain - run: npm test env: CI: true diff --git a/.github/workflows/common-build.yml b/.github/workflows/common-build.yml index 84e0732d4c..05b465c984 100644 --- a/.github/workflows/common-build.yml +++ b/.github/workflows/common-build.yml @@ -23,9 +23,9 @@ jobs: with: node-version: '${{ matrix.node-version }}' - uses: actions/checkout@v1 - - run: npx lerna bootstrap --scope ethereumjs-common --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run --scope ethereumjs-common --include-dependencies build - - run: npx lerna run lint --scope ethereumjs-common + - run: npx lerna bootstrap --scope @ethereumjs/common --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run --scope @ethereumjs/common --include-dependencies build + - run: npx lerna run lint --scope @ethereumjs/common - run: npm test env: CI: true diff --git a/.github/workflows/tx-bulid.yml b/.github/workflows/tx-bulid.yml index c17335f0f4..d52e8454b4 100644 --- a/.github/workflows/tx-bulid.yml +++ b/.github/workflows/tx-bulid.yml @@ -25,9 +25,9 @@ jobs: with: node-version: '${{ matrix.node-version }}' - uses: actions/checkout@v1 - - run: npx lerna bootstrap --scope ethereumjs-tx --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run --scope ethereumjs-tx --include-dependencies build - - run: npx lerna run lint --scope ethereumjs-tx + - run: npx lerna bootstrap --scope @ethereumjs/tx --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run --scope @ethereumjs/tx --include-dependencies build + - run: npx lerna run lint --scope @ethereumjs/tx - run: 'npm run test:node' env: CI: true diff --git a/.github/workflows/vm-build.yml b/.github/workflows/vm-build.yml index 235e598707..a07fa171e4 100644 --- a/.github/workflows/vm-build.yml +++ b/.github/workflows/vm-build.yml @@ -27,9 +27,9 @@ jobs: with: node-version: 12.x - uses: actions/checkout@v1 - - run: npx lerna bootstrap --scope ethereumjs-vm --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run --scope ethereumjs-vm --include-dependencies build - - run: npx lerna run lint --scope ethereumjs-vm + - run: npx lerna bootstrap --scope @ethereumjs/vm --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run --scope @ethereumjs/vm --include-dependencies build + - run: npx lerna run lint --scope @ethereumjs/vm - run: 'npm run test:API' env: CI: true @@ -47,8 +47,8 @@ jobs: with: node-version: 12.x - uses: actions/checkout@v1 - - run: npx lerna bootstrap --scope ethereumjs-vm --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run --scope ethereumjs-vm --include-dependencies build + - run: npx lerna bootstrap --scope @ethereumjs/vm --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run --scope @ethereumjs/vm --include-dependencies build - run: 'npm run test:state:selectedForks' env: CI: true @@ -62,8 +62,8 @@ jobs: with: node-version: 12.x - uses: actions/checkout@v1 - - run: npx lerna bootstrap --scope ethereumjs-vm --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run --scope ethereumjs-vm --include-dependencies build + - run: npx lerna bootstrap --scope @ethereumjs/vm --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run --scope @ethereumjs/vm --include-dependencies build - run: 'npm run test:blockchain' env: CI: true diff --git a/.github/workflows/vm-nightly-test.yml b/.github/workflows/vm-nightly-test.yml index 7a4bd144ba..ab70e8d28a 100644 --- a/.github/workflows/vm-nightly-test.yml +++ b/.github/workflows/vm-nightly-test.yml @@ -10,8 +10,8 @@ jobs: with: node-version: 12.x - uses: actions/checkout@v1 - - run: npx lerna bootstrap --scope ethereumjs-vm --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run --scope ethereumjs-vm --include-dependencies build + - run: npx lerna bootstrap --scope @ethereumjs/vm --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run --scope @ethereumjs/vm --include-dependencies build - run: 'npm run test:API' env: CI: true @@ -29,8 +29,8 @@ jobs: with: node-version: 12.x - uses: actions/checkout@v1 - - run: npx lerna bootstrap --scope ethereumjs-vm --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run --scope ethereumjs-vm --include-dependencies build + - run: npx lerna bootstrap --scope @ethereumjs/vm --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run --scope @ethereumjs/vm --include-dependencies build - run: 'npm run test:state:allForks' env: CI: true @@ -43,8 +43,8 @@ jobs: - uses: actions/setup-node@v1 with: node-version: 12.x - - run: npx lerna bootstrap --scope ethereumjs-vm --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run --scope ethereumjs-vm --include-dependencies build + - run: npx lerna bootstrap --scope @ethereumjs/vm --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run --scope @ethereumjs/vm --include-dependencies build working-directory: '${{ env.cwd }}' - run: 'npm run test:blockchain' env: @@ -59,8 +59,8 @@ jobs: with: node-version: 12.x - uses: actions/checkout@v1 - - run: npx lerna bootstrap --scope ethereumjs-vm --ignore-scripts --include-dependencies --no-ci - - run: npx lerna run --scope ethereumjs-vm --include-dependencies build + - run: npx lerna bootstrap --scope @ethereumjs/vm --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run --scope @ethereumjs/vm --include-dependencies build - run: 'npm run test:state:slow' env: CI: true diff --git a/packages/blockchain/test/index.ts b/packages/blockchain/test/index.ts index 1d5e6b8586..78a4fc6bf0 100644 --- a/packages/blockchain/test/index.ts +++ b/packages/blockchain/test/index.ts @@ -1,9 +1,9 @@ import * as async from 'async' import Common from '@ethereumjs/common' +import { Block, BlockHeader } from '@ethereumjs/block' import { toBuffer, bufferToInt } from 'ethereumjs-util' import * as test from 'tape' import Blockchain from '../src' -import { Block, BlockHeader } from 'ethereumjs-block' import { generateBlockchain, generateBlocks, isConsecutive, createTestDB } from './util' import BN = require('bn.js') diff --git a/packages/vm/lib/state/stateManager.ts b/packages/vm/lib/state/stateManager.ts index 58671bf79b..89d1b4e30a 100644 --- a/packages/vm/lib/state/stateManager.ts +++ b/packages/vm/lib/state/stateManager.ts @@ -5,7 +5,7 @@ import { toBuffer, KECCAK256_NULL_S } from 'ethereumjs-util' import BN = require('bn.js') import { encode, decode } from 'rlp' import Common from '@ethereumjs/common' -import { genesisStateByName } from 'ethereumjs-common/dist/genesisStates' +import { genesisStateByName } from '@ethereumjs/common/dist/genesisStates' import Account from '@ethereumjs/account' import Cache from './cache' import { ripemdPrecompileAddress } from '../evm/precompiles' diff --git a/packages/vm/package.json b/packages/vm/package.json index 779bae8920..7b210c1087 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -45,7 +45,7 @@ "async-eventemitter": "^0.2.4", "core-js-pure": "^3.0.1", "@ethereumjs/account": "^3.0.0", - "@ethereumjs/block": "^2.2.2", + "@ethereumjs/block": "^3.0.0", "@ethereumjs/blockchain": "^4.0.3", "@ethereumjs/common": "^1.5.0", "@ethereumjs/tx": "^2.1.2", diff --git a/packages/vm/tests/api/events.js b/packages/vm/tests/api/events.js index 331376b4d4..9d9395ad99 100644 --- a/packages/vm/tests/api/events.js +++ b/packages/vm/tests/api/events.js @@ -1,12 +1,7 @@ const tape = require('tape') const util = require('ethereumjs-util') -<<<<<<< HEAD -const { Transaction } = require('ethereumjs-tx') -const Block = require('ethereumjs-block').Block -======= const { Transaction } = require('@ethereumjs/tx') const Block = require('@ethereumjs/block') ->>>>>>> vm: migrating to scoped packages const VM = require('../../dist/index').default tape('VM events', t => { diff --git a/packages/vm/tests/api/state/stateManager.js b/packages/vm/tests/api/state/stateManager.js index 93d5a94543..69245a5b52 100644 --- a/packages/vm/tests/api/state/stateManager.js +++ b/packages/vm/tests/api/state/stateManager.js @@ -1,12 +1,7 @@ const tape = require('tape') const { parallel } = require('async') -<<<<<<< HEAD const { toBuffer, keccak256, KECCAK256_RLP } = require('ethereumjs-util') -const Common = require('ethereumjs-common').default -======= -const util = require('ethereumjs-util') const Common = require('@ethereumjs/common').default ->>>>>>> vm: migrating to scoped packages const { StateManager } = require('../../../dist/state') const { createAccount } = require('../utils') const { isRunningInKarma } = require('../../util') diff --git a/scripts/01-modify-require-dist-to-src.patch b/scripts/01-modify-require-dist-to-src.patch index 64267f8fe9..6f74dcfec7 100644 --- a/scripts/01-modify-require-dist-to-src.patch +++ b/scripts/01-modify-require-dist-to-src.patch @@ -4,8 +4,8 @@ import BN = require('bn.js') import { encode, decode } from 'rlp' import Common from '@ethereumjs/common' --import { genesisStateByName } from 'ethereumjs-common/dist/genesisStates' -+import { genesisStateByName } from 'ethereumjs-common/genesisStates' +-import { genesisStateByName } from '@ethereumjs/common/dist/genesisStates' ++import { genesisStateByName } from '@ethereumjs/common/genesisStates' import Account from '@ethereumjs/account' import Cache from './cache' import { ripemdPrecompileAddress } from '../evm/precompiles' From d1d8200663b5b66bbcf6c2d5eb89108222c73e34 Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 1 Jun 2020 21:58:38 -0400 Subject: [PATCH 13/15] fix: updating new occurrences of package names --- packages/block/package.json | 1 - packages/tx/package.json | 6 +++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/packages/block/package.json b/packages/block/package.json index d216c0999d..ad7b0be759 100644 --- a/packages/block/package.json +++ b/packages/block/package.json @@ -46,7 +46,6 @@ "merkle-patricia-tree": "^2.1.2" }, "devDependencies": { - "@ethereumjs/blockchain": "^4.0.3", "@ethereumjs/config-nyc": "^1.1.1", "@ethereumjs/config-prettier": "^1.1.1", "@ethereumjs/config-tsc": "^1.1.1", diff --git a/packages/tx/package.json b/packages/tx/package.json index 961c0af739..162c59f839 100644 --- a/packages/tx/package.json +++ b/packages/tx/package.json @@ -67,12 +67,12 @@ }, "repository": { "type": "git", - "url": "https://github.com/ethereumjs/ethereumjs-tx.git" + "url": "https://github.com/ethereumjs/ethereumjs-vm.git" }, "bugs": { - "url": "https://github.com/ethereumjs/ethereumjs-tx/issues" + "url": "https://github.com/ethereumjs/ethereumjs-vm/issues" }, - "homepage": "https://github.com/ethereumjs/ethereumjs-tx", + "homepage": "https://github.com/ethereumjs/ethereumjs-vm", "contributors": [ { "name": "<-c-g-> ", From b0b42cbcb872801bab0e048d21c6fb5866df397b Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 1 Jun 2020 22:25:29 -0400 Subject: [PATCH 14/15] fix: rebase re-touching --- packages/block/test/util.ts | 41 ---------------------- packages/common/package.json | 2 +- packages/vm/lib/index.ts | 4 +++ packages/vm/tests/BlockchainTestsRunner.js | 2 +- packages/vm/tests/api/events.js | 2 +- packages/vm/tests/api/runBlock.js | 1 + packages/vm/tests/api/runBlockchain.js | 2 +- packages/vm/tests/api/utils.js | 6 ++-- packages/vm/tests/util.js | 2 +- 9 files changed, 13 insertions(+), 49 deletions(-) delete mode 100644 packages/block/test/util.ts diff --git a/packages/block/test/util.ts b/packages/block/test/util.ts deleted file mode 100644 index fb351899a1..0000000000 --- a/packages/block/test/util.ts +++ /dev/null @@ -1,41 +0,0 @@ -import Blockchain from '@ethereumjs/blockchain' -import { toBuffer } from 'ethereumjs-util' -import { Block } from '../src/block' -import { BlockHeader } from '../src/header' - -export const setupBlockchain = async (): Promise<[Blockchain, Block]> => { - return new Promise((resolve, reject) => { - const blockchain = new Blockchain({ - validateBlocks: true, - validatePow: false, - chain: 'ropsten', - }) - const genesisBlock = new Block(undefined, { chain: 'ropsten' }) - genesisBlock.setGenesisParams() - - blockchain.putGenesis(genesisBlock, (err?: Error) => { - if (err) { - return reject(err) - } - const nextBlock = new Block( - { - header: new BlockHeader({ - number: 1, - parentHash: genesisBlock.header.hash(), - gasLimit: genesisBlock.header.gasLimit, - timestamp: Date.now(), - }), - }, - { chain: 'ropsten' }, - ) - nextBlock.header.difficulty = toBuffer(nextBlock.header.canonicalDifficulty(genesisBlock)) - - blockchain.putBlock(nextBlock, async (err?: Error) => { - if (err) { - return reject(err) - } - resolve([blockchain, nextBlock]) - }) - }) - }) -} diff --git a/packages/common/package.json b/packages/common/package.json index a1c0e17088..9b16103423 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -20,7 +20,7 @@ "lint": "ethereumjs-config-lint", "lint:fix": "ethereumjs-config-lint-fix", "unitTests": "ts-node ./node_modules/tape/bin/tape ./tests/*.ts", - "test": "npm run lint && npm run unitTests", + "test": "npm run unitTests", "test:fix": "npm run lint:fix && npm run unitTests", "docs:build": "typedoc --options typedoc.js" }, diff --git a/packages/vm/lib/index.ts b/packages/vm/lib/index.ts index 23525e8ea4..1e54305beb 100644 --- a/packages/vm/lib/index.ts +++ b/packages/vm/lib/index.ts @@ -1,4 +1,8 @@ import BN = require('bn.js') +import Account from '@ethereumjs/account' +import Blockchain from '@ethereumjs/blockchain' +import Common from '@ethereumjs/common' +import { StateManager } from './state/index' import { default as runCode, RunCodeOpts } from './runCode' import { default as runCall, RunCallOpts } from './runCall' import { default as runTx, RunTxOpts, RunTxResult } from './runTx' diff --git a/packages/vm/tests/BlockchainTestsRunner.js b/packages/vm/tests/BlockchainTestsRunner.js index fc999d77fe..4984c36c2b 100644 --- a/packages/vm/tests/BlockchainTestsRunner.js +++ b/packages/vm/tests/BlockchainTestsRunner.js @@ -3,7 +3,7 @@ const testUtil = require('./util.js') const ethUtil = require('ethereumjs-util') const Trie = require('merkle-patricia-tree/secure') const { Block, BlockHeader } = require('@ethereumjs/block') -const { Blockchain } = require('@ethereumjs/blockchain') +const Blockchain = require('@ethereumjs/blockchain').default const level = require('level') const levelMem = require('level-mem') diff --git a/packages/vm/tests/api/events.js b/packages/vm/tests/api/events.js index 9d9395ad99..abf072c9e3 100644 --- a/packages/vm/tests/api/events.js +++ b/packages/vm/tests/api/events.js @@ -1,7 +1,7 @@ const tape = require('tape') const util = require('ethereumjs-util') const { Transaction } = require('@ethereumjs/tx') -const Block = require('@ethereumjs/block') +const { Block } = require('@ethereumjs/block') const VM = require('../../dist/index').default tape('VM events', t => { diff --git a/packages/vm/tests/api/runBlock.js b/packages/vm/tests/api/runBlock.js index f9e90331c7..47484cd34a 100644 --- a/packages/vm/tests/api/runBlock.js +++ b/packages/vm/tests/api/runBlock.js @@ -1,4 +1,5 @@ const tape = require('tape') +const promisify = require('util.promisify') const { Block } = require('@ethereumjs/block') const Common = require('@ethereumjs/common').default const util = require('ethereumjs-util') diff --git a/packages/vm/tests/api/runBlockchain.js b/packages/vm/tests/api/runBlockchain.js index e7a7633eb0..23338c8ccb 100644 --- a/packages/vm/tests/api/runBlockchain.js +++ b/packages/vm/tests/api/runBlockchain.js @@ -2,7 +2,7 @@ const tape = require('tape') const level = require('level-mem') const promisify = require('util.promisify') const Blockchain = require('@ethereumjs/blockchain').default -const Block = require('@ethereumjs/block') +const { Block } = require('@ethereumjs/block') const Common = require('@ethereumjs/common').default const util = require('ethereumjs-util') const runBlockchain = require('../../dist/runBlockchain').default diff --git a/packages/vm/tests/api/utils.js b/packages/vm/tests/api/utils.js index 449ee9546a..35e4bda822 100644 --- a/packages/vm/tests/api/utils.js +++ b/packages/vm/tests/api/utils.js @@ -1,7 +1,7 @@ -const Block = require('@ethereumjs/block') -const { Account } = require('@ethereumjs/account').default -const level = require('level-mem') +const { Block } = require('@ethereumjs/block') +const Account = require('@ethereumjs/account').default const Blockchain = require('@ethereumjs/blockchain').default +const level = require('level-mem') const VM = require('../../dist/index').default function createGenesis (opts = {}) { diff --git a/packages/vm/tests/util.js b/packages/vm/tests/util.js index f2fe067367..abd936ca35 100644 --- a/packages/vm/tests/util.js +++ b/packages/vm/tests/util.js @@ -1,6 +1,6 @@ const async = require('async') const { BN, rlp, keccak256, stripHexPrefix, setLengthLeft } = require('ethereumjs-util') -const { Account } = require('@ethereumjs/account') +const Account = require('@ethereumjs/account').default const Transaction = require('@ethereumjs/tx').Transaction const Block = require('@ethereumjs/block').Block From f017dbd34e58d96aef5c04489052d8f4444a9f6b Mon Sep 17 00:00:00 2001 From: Everton Fraga Date: Mon, 1 Jun 2020 22:31:26 -0400 Subject: [PATCH 15/15] ci: updating Block ci file --- .github/workflows/block-build.yml | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/.github/workflows/block-build.yml b/.github/workflows/block-build.yml index f244851c02..3d87a33080 100644 --- a/.github/workflows/block-build.yml +++ b/.github/workflows/block-build.yml @@ -27,16 +27,10 @@ jobs: with: node-version: '${{ matrix.node-version }}' - uses: actions/checkout@v1 - - run: npm install - working-directory: '${{ env.cwd }}' + - run: npx lerna bootstrap --scope @ethereumjs/block --ignore-scripts --include-dependencies --no-ci + - run: npx lerna run build --scope @ethereumjs/block --include-dependencies - run: npx lerna run lint --scope @ethereumjs/block - - run: npm run test:node - env: - CI: true - working-directory: '${{ env.cwd }}' - - run: 'npm run test:browser' - env: - CI: true - working-directory: '${{ env.cwd }}' + - run: npx lerna run test:node --scope @ethereumjs/block + - run: npx lerna run test:browser --scope @ethereumjs/block env: cwd: '${{github.workspace}}/packages/block'