From a7a48981244c790e1b72e149800a40dfee5fd529 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Fri, 9 Oct 2020 10:35:07 +0200 Subject: [PATCH 1/8] vm: completed CHANGELOG for VM up to 2020-10-08 merges --- packages/vm/CHANGELOG.md | 59 +++++++++++++++++++++++++++++++++------- 1 file changed, 49 insertions(+), 10 deletions(-) diff --git a/packages/vm/CHANGELOG.md b/packages/vm/CHANGELOG.md index 1645f772b4..cc22c5cecb 100644 --- a/packages/vm/CHANGELOG.md +++ b/packages/vm/CHANGELOG.md @@ -50,7 +50,7 @@ const common = new Common({ chain: 'mainnet', hardfork: 'spuriousDragon' }) const vm = new VM({ common }) ``` -The default HF from the VM has been updated from `petersburg` to `instanbul`. +**Breaking**: The default HF from the VM has been updated from `petersburg` to `instanbul`. The HF setting is now automatically taken from the HF set for `Common.DEAULT_HARDFORK`, see PR [#906](https://github.com/ethereumjs/ethereumjs-vm/pull/906). @@ -69,8 +69,6 @@ PR [#754](https://github.com/ethereumjs/ethereumjs-vm/pull/754). **Attention!** Berlin HF support is still considered experimental and implementations can change on non-major VM releases! -[TODO: FINALIZE THIS SECTION ONCE #785 OR FOLLOW-UP PR IS MERGED ] - Support for BLS12-381 precompiles (`EIP-2537`) is added as an independent EIP implementation - see PR [#785](https://github.com/ethereumjs/ethereumjs-vm/pull/785) - since there is still an ongoing discussion on taking this EIP in for Berlin or @@ -78,7 +76,9 @@ using a more generalized approach on curve computation with the Ethereum EVM (`evm384` by the eWASM team). The integration comes along with an API addition to the VM to support the activation -of specific EIPs, PR [#856](https://github.com/ethereumjs/ethereumjs-vm/pull/856). +of specific EIPs, see PR [#856](https://github.com/ethereumjs/ethereumjs-vm/pull/856), +PR [#869](https://github.com/ethereumjs/ethereumjs-vm/pull/869) and +PR [#872](https://github.com/ethereumjs/ethereumjs-vm/pull/872). This API can be used as follows: @@ -98,30 +98,69 @@ and can be passed in on instantiation have been updated to new major versions. PR [#833](https://github.com/ethereumjs/ethereumjs-vm/pull/833) - `ethereumjs-common` `v1` -> `@ethereumjs/common` `v2` -If you pass in instances of these libraries to the VM please make sure to +**Breaking**: If you pass in instances of these libraries to the VM please make sure to update these library versions as stated. Please also take a note on the package name changes! All these libraries are now written in `TypeScript` and use promises instead of callbacks for accessing their APIs. -### Other Additions/Changes +### New StateManager Interface + +There is now a new `TypeScript` interface for the `StateManager`, see +PR [#763](https://github.com/ethereumjs/ethereumjs-vm/pull/763). If you are +using a custom `StateManager` you can use this interface to get better +assurance that you are using a `StateManager` going conform with the current +`StateManager` API and therefore running in the VM without problems. + +### Other Changes + +**Changes and Refactoring** -- Add `StateManager` interface, - PR [#763](https://github.com/ethereumjs/ethereumjs-vm/pull/763) -- New benchmarking tool for the VM, CI integration on GitHub actions, - PR [#830](https://github.com/ethereumjs/ethereumjs-vm/pull/830) - Group opcodes based upon hardfork, PR [#798](https://github.com/ethereumjs/ethereumjs-vm/pull/798) +- Split opcodes logic into codes, fns, and utils files, + PR [#896](https://github.com/ethereumjs/ethereumjs-vm/pull/896) - Group precompiles based upon hardfork, PR [#783](https://github.com/ethereumjs/ethereumjs-vm/pull/783) - Make `memory.ts` use Buffers instead of Arrays, PR [#850](https://github.com/ethereumjs/ethereumjs-vm/pull/850) +- Use `Map` for `OpcodeList` and `opcode` handlers, + PR [#852](https://github.com/ethereumjs/ethereumjs-vm/pull/852) +- Compare buffers directly, + PR [#851](https://github.com/ethereumjs/ethereumjs-vm/pull/851) +- Moved gas base fees from VM to Common, + PR [#806](https://github.com/ethereumjs/ethereumjs-vm/pull/806) +- Return precompiles on `getPrecompile()` based on hardfork, + PR [#783](https://github.com/ethereumjs/ethereumjs-vm/pull/783) +- Removed `async` dependency, + PR [#779](https://github.com/ethereumjs/ethereumjs-vm/pull/779) +- Updated `ethereumjs-util` to v7, + PR [#748](https://github.com/ethereumjs/ethereumjs-vm/pull/748) + +**CI and Test Improvements** + +- New benchmarking tool for the VM, CI integration on GitHub actions, + PR [#794](https://github.com/ethereumjs/ethereumjs-vm/pull/794) and + PR [#830](https://github.com/ethereumjs/ethereumjs-vm/pull/830) +- Various updates, fixes and refactoring work on the test runner, + PR [#752](https://github.com/ethereumjs/ethereumjs-vm/pull/752) and + PR [#849](https://github.com/ethereumjs/ethereumjs-vm/pull/849) +- Integrated `ethereumjs-testing` code logic into VM for more + flexible future test load optimizations, + PR [#808](https://github.com/ethereumjs/ethereumjs-vm/pull/808) +- Transition VM tests to TypeScript, + PR [#881](https://github.com/ethereumjs/ethereumjs-vm/pull/881) and + PR [#882](https://github.com/ethereumjs/ethereumjs-vm/pull/882) **Bug Fixes** - Fix `activatePrecompiles`, PR [#797](https://github.com/ethereumjs/ethereumjs-vm/pull/797) +- Strip zeros when putting contract storage in StateManager, + PR [#880](https://github.com/ethereumjs/ethereumjs-vm/pull/880) +- Two bug fixes along `istanbul` `SSTORE` gas calculation, + PR [#870](https://github.com/ethereumjs/ethereumjs-vm/pull/870) ## [4.2.0] - 2020-05-06 From d70d4d8efe2c6e729eb051a56e9d1636a95ced56 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Fri, 9 Oct 2020 11:51:05 +0200 Subject: [PATCH 2/8] blockchain, ethash: completed CHANGELOG for blockchain, ethash up to 2020-10-08 merges --- packages/blockchain/CHANGELOG.md | 14 ++++++++++++++ packages/ethash/CHANGELOG.md | 5 +++++ 2 files changed, 19 insertions(+) diff --git a/packages/blockchain/CHANGELOG.md b/packages/blockchain/CHANGELOG.md index 39ac2faf09..1bf5a8f848 100644 --- a/packages/blockchain/CHANGELOG.md +++ b/packages/blockchain/CHANGELOG.md @@ -61,6 +61,20 @@ The deprecated `validate` option has been removed, please use `valdiateBlock` an [5.0.0]: https://github.com/ethereumjs/ethereumjs-vm/compare/%40ethereumjs%2Fblockchain%404.0.2...%40ethereumjs%2Fblockchain%405.0.0 +### Other Changes + +**Changes and Refactoring** + +- Removed `async` dependency, + PR [#779](https://github.com/ethereumjs/ethereumjs-vm/pull/779) +- Updated `ethereumjs-util` to v7, + PR [#748](https://github.com/ethereumjs/ethereumjs-vm/pull/748) + +**Bug Fixes** + +- Fixed blockchain hanging forever in case code throws between a semaphore `lock`/`unlock`, + Issue [#877](https://github.com/ethereumjs/ethereumjs-vm/issues/877) + ## [4.0.3] - 2019-12-19 Supports `MuirGlacier` by updating `ethereumjs-block` to diff --git a/packages/ethash/CHANGELOG.md b/packages/ethash/CHANGELOG.md index 998b894397..a8b8c9a730 100644 --- a/packages/ethash/CHANGELOG.md +++ b/packages/ethash/CHANGELOG.md @@ -47,6 +47,11 @@ for a complete example. [1.0.0]: https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fethash%401.0.0 +### Other Changes + +- Removed `async` dependency, + PR [#779](https://github.com/ethereumjs/ethereumjs-vm/pull/779) + ## [0.0.8] - 2020-05-27 This is a maintenance release with dependency updates, CI improvements, and some code modernization. From d51496220a2c93470d9f4ac4b3325ce6eb687509 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Fri, 9 Oct 2020 12:13:03 +0200 Subject: [PATCH 3/8] blockchain, common: added missing blockchain v4.0.4 and common v1.5.2 releases on respective CHANGELOG files --- packages/blockchain/CHANGELOG.md | 4 ++++ packages/common/CHANGELOG.md | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/packages/blockchain/CHANGELOG.md b/packages/blockchain/CHANGELOG.md index 1bf5a8f848..c2d1845fdf 100644 --- a/packages/blockchain/CHANGELOG.md +++ b/packages/blockchain/CHANGELOG.md @@ -75,6 +75,10 @@ The deprecated `validate` option has been removed, please use `valdiateBlock` an - Fixed blockchain hanging forever in case code throws between a semaphore `lock`/`unlock`, Issue [#877](https://github.com/ethereumjs/ethereumjs-vm/issues/877) +## [4.0.4] - 2020-07-27 + +This release replaces the tiled (`~`) dependency from `ethereumjs-util` for a caret (`^`) one, meaning that any update to `ethereumjs-util` v6 will also be available for this library. + ## [4.0.3] - 2019-12-19 Supports `MuirGlacier` by updating `ethereumjs-block` to diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index ba2d7f6c25..70c0574b75 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -27,6 +27,12 @@ A new function `setHardforkByBlockNumber()` has been added, PR [#863](https://gi The default hardfork has been added as an accessible readonly property `DEFAULT_HARDFORK`, PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863). Current default hardfork is set to `istanbul`, PR [#906](https://github.com/ethereumjs/ethereumjs-vm/pull/906). +## [1.5.2] - 2020-07-26 + +This is a maintenance release. + +- Updates Goerli chain ID, PR [#792](https://github.com/ethereumjs/ethereumjs-vm/pull/792). + ## [1.5.1] - 2020-05-04 This is a maintenance release. From 0695fda0a2e49a43b05dd7ea60834d4f51b1eae4 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Fri, 9 Oct 2020 13:11:45 +0200 Subject: [PATCH 4/8] common: completed CHANGELOG for common up to 2020-10-08 merges --- packages/blockchain/CHANGELOG.md | 2 +- packages/common/CHANGELOG.md | 81 +++++++++++++++++++++++++++++--- 2 files changed, 76 insertions(+), 7 deletions(-) diff --git a/packages/blockchain/CHANGELOG.md b/packages/blockchain/CHANGELOG.md index c2d1845fdf..37dcfd7060 100644 --- a/packages/blockchain/CHANGELOG.md +++ b/packages/blockchain/CHANGELOG.md @@ -75,7 +75,7 @@ The deprecated `validate` option has been removed, please use `valdiateBlock` an - Fixed blockchain hanging forever in case code throws between a semaphore `lock`/`unlock`, Issue [#877](https://github.com/ethereumjs/ethereumjs-vm/issues/877) -## [4.0.4] - 2020-07-27 +## 4.0.4 - 2020-07-27 This release replaces the tiled (`~`) dependency from `ethereumjs-util` for a caret (`^`) one, meaning that any update to `ethereumjs-util` v6 will also be available for this library. diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 70c0574b75..67de0e2a71 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -8,9 +8,21 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) ## [2.0.0] - [UNRELEASED] +### New Package Name + +**Attention!** This new version is part of a series of EthereumJS releases all moving to a new scoped package name format. In this case the library is renamed as follows: + +- `ethereumjs-common` -> `@ethereumjs/common` + +Please update your library references accordingly or install with: + +```shell +npm i @ethereumjs/common +``` + ### New constructor -The constructor has been changed to accept a dict, PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863) +**Breaking**: The constructor has been changed to require an options dict to be passed, PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863) Example: @@ -19,15 +31,72 @@ import Common from '@ethereumjs/common' const common = new Common({ chain: 'mainnet', hardfork: 'muirGlacier' }) ``` -### Hardfork by block number +### EIP Support + +EIPs are now native citizens within the `Common` library, see PRs [#856](https://github.com/ethereumjs/ethereumjs-vm/pull/856), [#869](https://github.com/ethereumjs/ethereumjs-vm/pull/869) and [#872](https://github.com/ethereumjs/ethereumjs-vm/pull/872). Supported EIPs have their own configuration file like the [eips/2537.json](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/eips/2537.json) file for the BLS precompile EIP and EIP settings can be activated by passing supported EIP numbers to the constructor: + +```typescript +const c = new Common({ chain: 'mainnet', eips: [2537] }) +``` + +The following EIPs are initially supported within this release: + +- [EIP-2537](https://eips.ethereum.org/EIPS/eip-2315) BLS Precompiles +- [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315) EVM Subroutines (PR [#876](https://github.com/ethereumjs/ethereumjs-vm/pull/876)) + +EIPs provided are then activated and parameters requested with `Common.param()` being present in these EIPs take precedence over the setting from the latest hardfork. + +There are two new utility functions which dedicatedly return the hardfork respectively EIP values: + +- `Common.paramByHardfork()` +- `Common.paramByEIP()` + +**Breaking**: It is now not possible any more to pass a dedicated HF setting to `Common.param()`. Please update your code to explicitly use `Common.paramByHardfork()` for requesting a parameter for a HF deviating from the HF currently set within your `Common` instance. + +For setting and requesting active EIPs there is `Common.setEIPs()` and `Common.eips()` added to the mix. + +Along there is a new EIP-based hardfork file format which allows to just reference EIPs (pointing to the EIP files which then contain the parameters) instead of containing parameters directly, see PR [#876](https://github.com/ethereumjs/ethereumjs-vm/pull/876). This is in preparation for an upcoming `Yolo v2` testnet integration. + +Side note: with this new structural setup it gets now possible for all EIPs still implicitly contained within the hardfork files to be extracted as an EIP parameter set within its own dedicated EIP file (which can then be activated via the `eip` parameter on initialization) without loosing on functionality. If you have a need there feel free to open a PR! + +### Gas Parameter Completeness for all Hardforks + +Remaining gas base fees which still resided in the VM have been moved over to `Common` along PR [#806](https://github.com/ethereumjs/ethereumjs-vm/pull/806). +Gas fees for all hardforks up to `MuirGlacier` are now completely present within the `Common` library. + +### Eth/64 Forkhash Support + +There is a new `Common.forkHash()` method returning pre-calculated Forkhash values or alternatively use the internal `Common._calcForkHash()` implementation to calculate a forkhash on the fly. + +Forkhashes are used to uniquely identify a set of hardforks passed to be able to better differentiate between different dedicated chains. This is used for the `Eth/64` devp2p protocol update and specificed in [EIP-2124](https://eips.ethereum.org/EIPS/eip-2124) to help improve the devp2p networking stack. + +### New Block/Hardfork related Utility Functions + +The following block respectively hardfork related utility functions have been added along PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863) and PR [#805](https://github.com/ethereumjs/ethereumjs-vm/pull/805): + +- `setHardforkByBlockNumber()` - Sets the hardfork determined by the block number passed +- `nextHardforkBlock()` - Returns the next HF block for a HF provided or set +- `isNextHardforkBlock()` - Some convenience additional utility method, matching the existing `hardforkBlock()` / `isHardforkBlock()` method setup +- `hardforkForForkHash()` - Returns the data available for a HF given a specific forkHash + +### Default Hardfork + +The default hardfork has been added as an accessible readonly property `DEFAULT_HARDFORK`, PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863). This setting is used starting with the latest major releases of the monorepo libraries like the VM to keep the HF setting in sync across the different libraries. + +Current default hardfork is set to `istanbul`, PR [#906](https://github.com/ethereumjs/ethereumjs-vm/pull/906). -A new function `setHardforkByBlockNumber()` has been added, PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863) +### Other Changes -### Default hardfork +**Changes and Refactoring** -The default hardfork has been added as an accessible readonly property `DEFAULT_HARDFORK`, PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863). Current default hardfork is set to `istanbul`, PR [#906](https://github.com/ethereumjs/ethereumjs-vm/pull/906). +- Removed old `consensus` and `finality` fields, + PR [#758](https://github.com/ethereumjs/ethereumjs-vm/pull/758) +- Removed old `casper` and `sharding` fields, + PR [#762](https://github.com/ethereumjs/ethereumjs-vm/pull/762) +- Updated `ethereumjs-util` to v7, + PR [#748](https://github.com/ethereumjs/ethereumjs-vm/pull/748) -## [1.5.2] - 2020-07-26 +## 1.5.2 - 2020-07-26 This is a maintenance release. From ca40efedea5e09eed459f85889fccff0c8b4f6e6 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Fri, 9 Oct 2020 14:38:35 +0200 Subject: [PATCH 5/8] tx: completed CHANGELOG for tx up to 2020-10-08 merges --- packages/tx/CHANGELOG.md | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/packages/tx/CHANGELOG.md b/packages/tx/CHANGELOG.md index 2f01dcc451..77c0e451a3 100644 --- a/packages/tx/CHANGELOG.md +++ b/packages/tx/CHANGELOG.md @@ -22,7 +22,7 @@ npm i @ethereumjs/tx ### Major Refactoring - Breaking Changes -This release is a major refactoring of the transaction library to simplify and strengthen its code base. +This release is a major refactoring of the transaction library to simplify and strengthen its code base. Refactoring work has been done along PR [#812](https://github.com/ethereumjs/ethereumjs-vm/pull/812) and PR [#887](https://github.com/ethereumjs/ethereumjs-vm/pull/887). #### New Constructor Params @@ -68,12 +68,6 @@ const tx = Transaction.fromValuesArray(arr) Learn more about the full API in the [docs](./docs/README.md). -#### New Default Hardfork - -The default HF on the library has been updated from `petersburg` to `instanbul`. -The HF setting is now automatically taken from the HF set for `Common.DEAULT_HARDFORK`, -see PR [#906](https://github.com/ethereumjs/ethereumjs-vm/pull/906). - #### Immutability The returned transaction is now frozen and immutable. To work with a maliable transaction, copy it with `const fakeTx = Object.create(tx)`. @@ -90,6 +84,21 @@ Getting a message to sign has been changed from calling `tx.hash(false)` to `tx. The `FakeTransaction` class was removed since its functionality can now be implemented with less code. To create a fake tansaction for use in e.g. `VM.runTx()` overwrite `getSenderAddress` with your own `Address`. See a full example in the section in the [README](./README.md#fake-transaction). +### New Default Hardfork + +**Breaking:** The default HF on the library has been updated from `petersburg` to `instanbul`, see PR [#906](https://github.com/ethereumjs/ethereumjs-vm/pull/906). +The HF setting is now automatically taken from the HF set for `Common.DEAULT_HARDFORK`, +see PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863). + +### Other Changes + +**Changes and Refactoring** + +- Updated `ethereumjs-util` to v7, + PR [#748](https://github.com/ethereumjs/ethereumjs-vm/pull/748) +- Replaced `new Buffer()` (deprecated) statements with `Buffer.from()`, + PR [#721](https://github.com/ethereumjs/ethereumjs-vm/pull/721) + ## [2.1.2] - 2019-12-19 - Added support for the `MuirGlacier` HF by updating the `ethereumjs-common` dependency From 46db2d75374418edc2316b61b0640a3394a6e2e2 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Thu, 15 Oct 2020 11:24:58 +0200 Subject: [PATCH 6/8] blockchain, common, vm: some re-wordings on the CHANGELOG --- packages/blockchain/CHANGELOG.md | 2 +- packages/common/CHANGELOG.md | 6 +++--- packages/vm/CHANGELOG.md | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/blockchain/CHANGELOG.md b/packages/blockchain/CHANGELOG.md index 37dcfd7060..eb52fafbbb 100644 --- a/packages/blockchain/CHANGELOG.md +++ b/packages/blockchain/CHANGELOG.md @@ -77,7 +77,7 @@ The deprecated `validate` option has been removed, please use `valdiateBlock` an ## 4.0.4 - 2020-07-27 -This release replaces the tiled (`~`) dependency from `ethereumjs-util` for a caret (`^`) one, meaning that any update to `ethereumjs-util` v6 will also be available for this library. +This release replaces the tilde (`~`) dependency from `ethereumjs-util` for a caret (`^`) one, meaning that any update to `ethereumjs-util` v6 will also be available for this library. ## [4.0.3] - 2019-12-19 diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 67de0e2a71..6d88291c08 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -46,7 +46,7 @@ The following EIPs are initially supported within this release: EIPs provided are then activated and parameters requested with `Common.param()` being present in these EIPs take precedence over the setting from the latest hardfork. -There are two new utility functions which dedicatedly return the hardfork respectively EIP values: +There are two new utility functions which return hardfork and EIP values respectively: - `Common.paramByHardfork()` - `Common.paramByEIP()` @@ -55,7 +55,7 @@ There are two new utility functions which dedicatedly return the hardfork respec For setting and requesting active EIPs there is `Common.setEIPs()` and `Common.eips()` added to the mix. -Along there is a new EIP-based hardfork file format which allows to just reference EIPs (pointing to the EIP files which then contain the parameters) instead of containing parameters directly, see PR [#876](https://github.com/ethereumjs/ethereumjs-vm/pull/876). This is in preparation for an upcoming `Yolo v2` testnet integration. +There is also a new EIP-based hardfork file format which delegates parameter definition to dedicated EIP files (see PR [#876](https://github.com/ethereumjs/ethereumjs-vm/pull/876)). This is in preparation for an upcoming `Yolo v2` testnet integration. Side note: with this new structural setup it gets now possible for all EIPs still implicitly contained within the hardfork files to be extracted as an EIP parameter set within its own dedicated EIP file (which can then be activated via the `eip` parameter on initialization) without loosing on functionality. If you have a need there feel free to open a PR! @@ -72,7 +72,7 @@ Forkhashes are used to uniquely identify a set of hardforks passed to be able to ### New Block/Hardfork related Utility Functions -The following block respectively hardfork related utility functions have been added along PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863) and PR [#805](https://github.com/ethereumjs/ethereumjs-vm/pull/805): +The following block and hardfork related utility functions have been added with PRs [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863) and [#805](https://github.com/ethereumjs/ethereumjs-vm/pull/805) respectively: - `setHardforkByBlockNumber()` - Sets the hardfork determined by the block number passed - `nextHardforkBlock()` - Returns the next HF block for a HF provided or set diff --git a/packages/vm/CHANGELOG.md b/packages/vm/CHANGELOG.md index cc22c5cecb..7db6de11db 100644 --- a/packages/vm/CHANGELOG.md +++ b/packages/vm/CHANGELOG.md @@ -110,8 +110,8 @@ callbacks for accessing their APIs. There is now a new `TypeScript` interface for the `StateManager`, see PR [#763](https://github.com/ethereumjs/ethereumjs-vm/pull/763). If you are using a custom `StateManager` you can use this interface to get better -assurance that you are using a `StateManager` going conform with the current -`StateManager` API and therefore running in the VM without problems. +assurance that you are using a `StateManager` which conforms with the current +`StateManager` API and will run in the VM without problems. ### Other Changes From 48e2f2562155cec1e27a6f11d674750329e7fd73 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Thu, 15 Oct 2020 12:55:17 +0200 Subject: [PATCH 7/8] block: first CHANGELOG integration round on refactoring PR --- packages/block/CHANGELOG.md | 140 ++++++++++++++++++++++++++++-------- 1 file changed, 109 insertions(+), 31 deletions(-) diff --git a/packages/block/CHANGELOG.md b/packages/block/CHANGELOG.md index 1c8a6491a6..58ab8e1c7d 100644 --- a/packages/block/CHANGELOG.md +++ b/packages/block/CHANGELOG.md @@ -6,13 +6,24 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) (modification: no type change headlines) and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html). -## [3.0.0] - 2020-04-01 +## 3.0.0 - UNRELEASED -Verion 3.0.0 brings modernizations to the code and some **breaking changes** you should be aware of. +### New Package Name + +**Attention!** This new version is part of a series of EthereumJS releases all moving to a new scoped package name format. In this case the library is renamed as follows: + +- `ethereumjs-block` -> `@ethereumjs/block` + +Please update your library references accordingly or install with: + +```shell +npm i @ethereumjs/block +``` ### TypeScript/Library Import -First TypeScript based release of the library. The import structure has slightly changed along: +This is the first TypeScript based release of the library, see PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72). +The import structure has slightly changed along: **TypeScript** @@ -31,10 +42,80 @@ const Block = require('ethereumjs-block').Block The library now also comes with a **type declaration file** distributed along with the package published. -### Promise-based API +### Major Refactoring - Breaking Changes + +This release is a major refactoring of the block library to simplify and strengthen its code base. +Refactoring work has been done along PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) +(Promises) and PR [#883](https://github.com/ethereumjs/ethereumjs-vm/pull/883) (refactoring of API +and internal code structure). + +#### New Constructor Params + +The way to instantiate a new `BlockHeader` or `Block` object has been completely reworked and is +now more explicit, less error prone and produces more `TypeScript` friendly and readable code. + +The old direct constructor usage is now discouraged in favor of different dedicated static +factory methods to create new objects. + +**Breaking**: While the main constructors can still be called, signatures changed significantly and +your old `new Block(...)`, `new BlockHeader(...)` instantiations won't work any more and needs to be +adopted. + +**BlockHeader Class** + +There are three new factory methods to create a new `BlockHeader`: + +1. Pass in a Header-attribute named dictionary to `BlockHeader.fromHeaderData(headerData: HeaderData = {}, opts: BlockOptions = {})`: + +```typescript +const headerData = { + number: 15, + parentHash: '0x6bfee7294bf44572b7266358e627f3c35105e1c3851f3de09e6d646f955725a7', + difficulty: 131072, + gasLimit: 8000000, + timestamp: 1562422144, +} +const header = BlockHeader.fromHeaderData(headerData, {}) +``` + +2. Create a `BlockHeader` from an RLP-serialized header `Buffer` with `BlockHeader.fromRLPSerializedHeader(serialized: Buffer, opts: BlockOptions)`. + +```typescript +const serialized = Buffer.from( + 'f901f7a06bfee7294bf44572b7266358e627f3c35105e1c3851f3de09e6d646f955725a7a01dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347940000000000000000000000000000000000000000a00000000000000000000000000000000000000000000000000000000000000000a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421a056e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421b9010000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000830200000f837a120080845d20ab8080a00000000000000000000000000000000000000000000000000000000000000000880000000000000000', + 'hex', +) +const header = BlockHeader.fromRLPSerializedHeader(serialized, {}) +``` -The API of this library is now completely promise-based, the old callback-style -interface has been dropped. +3. Create a `BlockHeader` from an array of `Buffer` values, you can do a first short roundtrip test with: + +```typescript +const valuesArray = header.raw() +BlockHeader.fromValuesArray(valuesArray, {}) +``` + +Generally internal types representing block header values are now closer to their domain representation +(number, difficulty, gasLimit) instead of having everthing represented as a `Buffer`. + +**Block Class** + +There are analogue new static factories for the `Block` class: + +- `Block.fromBlockData(blockData: BlockData = {}, opts: BlockOptions = {})` +- `Block.fromRLPSerializedBlock(serialized: Buffer, opts: BlockOptions = {})` +- `Block.fromValuesArray(values: BlockBuffer, opts: BlockOptions = {})` + +Learn more about the full API in the [docs](./docs/README.md). + +#### Immutability + +The returned block is now frozen and immutable. To work with a maliable block, copy it with `const fakeBlock = Object.create(block)`. + +#### Promise-based API + +The API of this library is now completely promise-based and the old callback-style interface +has been dropped. This affects the following methods of the API now being defined as `async` and returning a `Promise`: @@ -60,37 +141,34 @@ try { } ``` -### Different signature for constructor +### Other Changes -From now on, it's not allowed to initialize `Block` with a `null` value. If for any reason you need to initialize it without defining a value, use the more semantic `undefined` like the examples below: - -```typescript -const b = new Block(undefined, options) -``` +**Changes and Refactoring** -or just: +- Added Node `10`, `12` support, dropped Node `7` support, + PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) +- Removal of the `async` dependency, + PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) +- Update `ethereumjs-common` dependency from `v1.1.0` to `v1.5.0`, + PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) +- Update `ethereumjs-tx` dependency from `v1.2.2` to `v2.1.1`, + PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) +- Update `ethereumjs-util` dependency from `v5.0.0` to `v6.1.0`, + PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) -```typescript -const b = new Block() -``` +**CI and Testing** -### Change Summary +- Browser test run on CI, + PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) +- Karma browser test run config modernization and simplification + PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) +- Updated test source files to `TypeScript`, + PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) -Other changes along with the `TypeScript` transition PR -[#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) +**Bug Fixes** -- Added Node `10`, `12` support, dropped Node `7` support -- Browser test run on CI -- Karma browser test run config modernization and simplification -- Removal of the `async` dependency -- Update `ethereumjs-common` dependency from `v1.1.0` to `v1.5.0` -- Update `ethereumjs-tx` dependency from `v1.2.2` to `v2.1.1` -- Update `ethereumjs-util` dependency from `v5.0.0` to `v6.1.0` -- Updated test source files to `TypeScript` -- Signature fix for pre-homestead blocks, see - [#67](https://github.com/ethereumjs/ethereumjs-block/issues/67) - -[3.0.0]: https://github.com/ethereumjs/ethereumjs-vm/compare/%40ethereumjs%2Fblock%402.2.0...%40ethereumjs%2Fblock%403.0.0 +- Signature fix for pre-homestead blocks, + PR [#67](https://github.com/ethereumjs/ethereumjs-block/issues/67) ## [2.2.2] - 2019-12-17 From 5aee85b2d623ae9173110b86245fae0cdab8a216 Mon Sep 17 00:00:00 2001 From: holgerd77 Date: Thu, 15 Oct 2020 14:50:04 +0200 Subject: [PATCH 8/8] block: completed CHANGELOG for block up to 2020-10-15 merges --- packages/block/CHANGELOG.md | 37 ++++++++++++++++++++++++++------ packages/blockchain/CHANGELOG.md | 2 ++ packages/ethash/CHANGELOG.md | 2 ++ 3 files changed, 34 insertions(+), 7 deletions(-) diff --git a/packages/block/CHANGELOG.md b/packages/block/CHANGELOG.md index 58ab8e1c7d..6a6ef5a926 100644 --- a/packages/block/CHANGELOG.md +++ b/packages/block/CHANGELOG.md @@ -59,7 +59,7 @@ factory methods to create new objects. **Breaking**: While the main constructors can still be called, signatures changed significantly and your old `new Block(...)`, `new BlockHeader(...)` instantiations won't work any more and needs to be -adopted. +updated. **BlockHeader Class** @@ -141,20 +141,43 @@ try { } ``` +### New Default Hardfork + +**Breaking:** The default HF on the library has been updated from `petersburg` to `instanbul`, see PR [#906](https://github.com/ethereumjs/ethereumjs-vm/pull/906). +The HF setting is now automatically taken from the HF set for `Common.DEAULT_HARDFORK`, +see PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863). + ### Other Changes +**Features** + +- Added `Block.genesis()` and `BlockHeader.genesis()` aliases to create + a genesis block or header, + PR [#883](https://github.com/ethereumjs/ethereumjs-vm/pull/883) +- Added `DAO` hardfork support (check for `extraData` attribute if `DAO` HF is active), + PR [#843](https://github.com/ethereumjs/ethereumjs-vm/pull/843) + **Changes and Refactoring** - Added Node `10`, `12` support, dropped Node `7` support, PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) +- Passing in a blockchain is now optional on `Block.validate()`, + PR [#883](https://github.com/ethereumjs/ethereumjs-vm/pull/883) +- **Breaking**: `Block.validateTransactions(stringError: true)` now returns a `string[]`, + PR [#883](https://github.com/ethereumjs/ethereumjs-vm/pull/883) +- **Breaking**: Decoupling of the `Block.serialize()` and `Block.raw()` methods, + `Block.serialize()` now always returns the RLP-encoded block (signature change!), + `Block.raw()` always returns the pure `Buffer` array, + PR [#883](https://github.com/ethereumjs/ethereumjs-vm/pull/883) +- **Breaking**: `Block.toJSON()` now always returns the labeled `JSON` representation, + removal of the `labeled` function parameter, + PR [#883](https://github.com/ethereumjs/ethereumjs-vm/pull/883) +- Updated `merkle-patricia-tree` dependency to `v4`, + PR [#787](https://github.com/ethereumjs/ethereumjs-vm/pull/787) +- Updated `ethereumjs-util` dependency to `v7`, + PR [#748](https://github.com/ethereumjs/ethereumjs-vm/pull/748) - Removal of the `async` dependency, PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) -- Update `ethereumjs-common` dependency from `v1.1.0` to `v1.5.0`, - PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) -- Update `ethereumjs-tx` dependency from `v1.2.2` to `v2.1.1`, - PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) -- Update `ethereumjs-util` dependency from `v5.0.0` to `v6.1.0`, - PR [#72](https://github.com/ethereumjs/ethereumjs-block/pull/72) **CI and Testing** diff --git a/packages/blockchain/CHANGELOG.md b/packages/blockchain/CHANGELOG.md index eb52fafbbb..bc3d30aad5 100644 --- a/packages/blockchain/CHANGELOG.md +++ b/packages/blockchain/CHANGELOG.md @@ -65,6 +65,8 @@ The deprecated `validate` option has been removed, please use `valdiateBlock` an **Changes and Refactoring** +- Use `@ethereumjs/block` `v3.0.0` block library version, + PR [#883](https://github.com/ethereumjs/ethereumjs-vm/pull/883) - Removed `async` dependency, PR [#779](https://github.com/ethereumjs/ethereumjs-vm/pull/779) - Updated `ethereumjs-util` to v7, diff --git a/packages/ethash/CHANGELOG.md b/packages/ethash/CHANGELOG.md index a8b8c9a730..ba36473744 100644 --- a/packages/ethash/CHANGELOG.md +++ b/packages/ethash/CHANGELOG.md @@ -49,6 +49,8 @@ for a complete example. ### Other Changes +- Updated Block dependency to `@ethereumjs/block` `v3.0.0`, + PR [#883](https://github.com/ethereumjs/ethereumjs-vm/pull/883) - Removed `async` dependency, PR [#779](https://github.com/ethereumjs/ethereumjs-vm/pull/779)