Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CHANGELOG Completion for VM v5 Release #908

Merged
merged 8 commits into from
Oct 15, 2020
171 changes: 136 additions & 35 deletions packages/block/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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**

Expand All @@ -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
updated.

**BlockHeader Class**

There are three new factory methods to create a new `BlockHeader`:

The API of this library is now completely promise-based, the old callback-style
interface has been dropped.
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, {})
```

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`:
Expand All @@ -60,37 +141,57 @@ try {
}
```

### Different signature for constructor

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)
```

or just:

```typescript
const b = new Block()
```

### Change Summary
### 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)

**CI and Testing**

- 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

Expand Down
20 changes: 20 additions & 0 deletions packages/blockchain/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,26 @@ 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**

- 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,
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.4 - 2020-07-27

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

Supports `MuirGlacier` by updating `ethereumjs-block` to
Expand Down
85 changes: 80 additions & 5 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand All @@ -19,13 +31,76 @@ 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 return hardfork and EIP values respectively:

- `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.

A new function `setHardforkByBlockNumber()` has been added, PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863)
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.

### Default hardfork
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!
evertonfraga marked this conversation as resolved.
Show resolved Hide resolved

### 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 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
- `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).

### Other Changes

**Changes and Refactoring**

- 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

This is a maintenance release.

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).
- Updates Goerli chain ID, PR [#792](https://github.com/ethereumjs/ethereumjs-vm/pull/792).

## [1.5.1] - 2020-05-04

Expand Down
7 changes: 7 additions & 0 deletions packages/ethash/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,13 @@ for a complete example.

[1.0.0]: https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fethash%401.0.0

### 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)

## [0.0.8] - 2020-05-27

This is a maintenance release with dependency updates, CI improvements, and some code modernization.
Expand Down
23 changes: 16 additions & 7 deletions packages/tx/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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)`.
Expand All @@ -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
Expand Down
Loading