Skip to content

Commit

Permalink
vm: bumped version to v5.2.0, added CHANGELOG entry, updated README, …
Browse files Browse the repository at this point in the history
…updated upstream dependency versions
  • Loading branch information
holgerd77 committed Mar 18, 2021
1 parent bd6cdfb commit 9ae81ce
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 10 deletions.
9 changes: 9 additions & 0 deletions packages/block/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

This release gets the `Block` library ready for the `berlin` HF by adding support for [EIP2718](https://eips.ethereum.org/EIPS/eip-2718) Typed Transactions. Transaction objects are now created with the new `TransactionFactory` introduced with the `@ethereumjs/tx` `v3.1.0` release which chooses the correct tx type for the data. The initial tx release supports the old legacy transactions and the newly added [EIP2930](https://eips.ethereum.org/EIPS/eip-2930) Access List Transaction Type, see PR [#1048](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1048).

Please note that the default HF is still set to `istanbul`. You therefore need to explicitly set the `hardfork` parameter for instantiating a `Block` instance with a `berlin` HF activated:

```typescript
import { Block } from 'ethereumjs-block'
import Common from '@ethereumjs/common'
const common = new Common({ chain: 'mainnet', hardfork: 'berlin' })
const block = Block.fromBlockData({}, { common })
```

#### EthereumJS Libraries - Typed Transactions Readiness

If you are using this library in conjunction with other EthereumJS libraries make sure to minimally have the following library versions installed for typed transaction support:
Expand Down
9 changes: 9 additions & 0 deletions packages/blockchain/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,15 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)

This release comes with full `berlin` HF support by setting the `Block`, `Tx` and `Common` dependencies to versions which ensure a working set of `berlin`-enabled library versions. In particular this allows for running a blockchain with blocks containing typed transactions.

Please note that the default HF is still set to `istanbul`. You therefore need to explicitly set the `hardfork` parameter for instantiating a `Blockchain` instance with a `berlin` HF activated:

```typescript
import Blockchain from '@ethereumjs/blockchain'
import Common from '@ethereumjs/common'
const common = new Common({ chain: 'mainnet', hardfork: 'berlin' })
const blockchain = await Blockchain.create({ common })
```

#### EthereumJS Libraries - Typed Transactions Readiness

If you are using this library in conjunction with other EthereumJS libraries make sure to minimally have the following library versions installed for typed transaction support:
Expand Down
2 changes: 1 addition & 1 deletion packages/client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@ethereumjs/devp2p": "^3.0.3",
"@ethereumjs/tx": "^3.1.0",
"merkle-patricia-tree": "^4.1.0",
"@ethereumjs/vm": "^5.1.0",
"@ethereumjs/vm": "^5.2.0",
"chalk": "^2.4.2",
"ethereumjs-util": "^7.0.9",
"fs-extra": "^7.0.1",
Expand Down
1 change: 1 addition & 0 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const common = new Common({ chain: 'mainnet', hardfork: 'berlin' })
- Added final list of `berlin` EIPs (`EIP-2565`, `EIP-2929`, `EIP-2718`, `EIP-2930`), PR [#1124](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1124) and PR [#1048](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1048)
- Corrected base gas costs for `EIP-2929` related opcodes, PR [#1124](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1124)
- New EIP configuration files for `EIP-2718` (typed txs) and `EIP-2930` (optional access lists), PR [#1048](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1048)
- Added `berlin` hardfork block numbers for `mainnet`, `ropsten`, `rinkeby` and `goerli`, PR [#1142](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1142)

### BN Support for high Chain IDs and Block Numbers

Expand Down
2 changes: 2 additions & 0 deletions packages/tx/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ const txData = {
const tx = AccessListEIP2930Transaction.fromTxData(txData, { common })
```

Please note that the default HF is still set to `istanbul`. You therefore need to explicitly set the `hardfork` parameter for instantiating a `Transaction` instance with a `berlin` HF activated.

The now called "legacy" transactions are still supported and can be used as before by using the `Transaction` class. If the type of a tx is only known at runtime there is a new `TransactionFactory` class introduced for your convenience. This factory class decides on the tx type based on the input data and uses the corresponding tx type class for instantiation.

For more guidance on how to use the new tx types and the tx factory have a look at the [README](./README.md) of this library which has perceived an extensive update along with this release.
Expand Down
71 changes: 67 additions & 4 deletions packages/vm/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,78 @@ 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).

## UNRELEASED
## 5.2.0 - 2021-03-18

### Berlin HF Support

This release is the first VM release with official `berlin` HF support. All `EthereumJS` dependencies are updated with `berlin` enabling versions and support for all EIPs which finally made it into `berlin` has been added, namely:

- [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565): ModExp gas cost
- [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718): Typed transactions
- [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929): Gas cost increases for state access opcodes
- [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930): Optional Access Lists Typed Transactions

Please note that the default HF is still set to `istanbul`. You therefore need to explicitly set the `hardfork` parameter for instantiating a `VM` instance with a `berlin` HF activated:

```typescript
import VM from '@ethereumjs/vm'
import Common from '@ethereumjs/common'
const common = new Common({ chain: 'mainnet', hardfork: 'berlin' })
const vm = new VM({ common })
```

There is a relatively broad set of changes since the last VM version `v5.1.0` introducing support for a first set of to-be-expected `berlin` EIPs, here is a summary:

#### Added Typed Transaction Support (EIP-2718 / EIP-2930)

The VM is now prepared to work with Typed Transactions ([EIP2718](https://eips.ethereum.org/EIPS/eip-2718)) which have been introduced along the `@ethereumjs/tx` `v3.1.0` release. It now therefore gets possible to pass typed txs to `VM.runTx()` respectively a block containing typed txs to `VM.runBlock()`, see PR [#1048](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1048) and PR [#1138](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1138).

There is a first concrete tx type 1 including optional access lists added along the `berlin` HF ([EIP2930](https://eips.ethereum.org/EIPS/eip-2930)). Access lists are now properly detected by the VM and gas costs calculated accordingly.

#### Fixed EIP-2929 Implementation

Our implementation of `EIP-2929` (gas cost increases for state access opcodes) was falling short in the form that warm storage slots / addresses were only tracked per internal message, not on the entire transaction as implied by the EIP. This needed a relatively intense rework along PR [#1124](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1124). We are now confident in the implementation and official tests are passing.

Along with this rework a new `StateManager` interface `EIP2929StateManager` has been introduced which inherits from `StateManager` and adds the following methods:

```typescript
export interface EIP2929StateManager extends StateManager {
addWarmedAddress(address: Buffer): void
isWarmedAddress(address: Buffer): boolean
addWarmedStorage(address: Buffer, slot: Buffer): void
isWarmedStorage(address: Buffer, slot: Buffer): boolean
clearWarmedAccounts(): void
}
```

The `StateManager` base interface and the inherited `EIP2929StateManager` interface will be merged again on the next breaking release.

#### Removed EIP-2315 from Berlin

`EIP-2315` has been removed from the list of EIPs included in `berlin`. This is ensured by using a `Common` dependency version `v2.2.0`+ containing the final list of `Berlin` EIPs and also needed some changes in the VM code, see PR [#1142](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1142).

#### EthereumJS Libraries - Typed Transactions Readiness

If you are using this library in conjunction with other EthereumJS libraries make sure to minimally have the following library versions installed for typed transaction support:

- `@ethereumjs/common` `v2.2.0`
- `@ethereumjs/tx` `v3.1.0`
- `@ethereumjs/block` `v3.2.0`
- `@ethereumjs/blockchain` `v5.2.0`
- `@ethereumjs/vm` `v5.2.0`

### Other Features

- `{ stateRoot, gasUsed, logsBloom, receiptRoot }` have been added to `RunBlockResult` and will be emitted with `afterBlock`, PR [#853](https://github.com/ethereumjs/ethereumjs-vm/pull/853)
- Added `vm:eei:gas` EEI gas debug looger, PR [#1124](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1124)

### Other Fixes

- Fixes for [EIP2929](https://eips.ethereum.org/EIPS/eip-2929) (Gas cost increases for state access opcodes), PR [#1124](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1124)
- Integration of [EIP2718](https://eips.ethereum.org/EIPS/eip-2718) (Typed Transactions) and [EIP2930](https://eips.ethereum.org/EIPS/eip-2930) (Access List Transaction), PR [#1048](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1048). VM now has support for access list transactions.
- Fixes VM Node 10 support being broken due to the usage of `globalThis` for browser detection, PR [#1151](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1151)
- Fixed `ECRECOVER` precompile to work correctly on networks with very large chain IDs, PR [#1139](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1139)

**CI and Test Improvements**

- `{ stateRoot, gasUsed, logsBloom, receiptRoot }` have been added to `RunBlockResult` and will be emitted with `afterBlock`, PR [#853](https://github.com/ethereumjs/ethereumjs-vm/pull/853)
- Benchmark improvements and fixes, PR [#853](https://github.com/ethereumjs/ethereumjs-vm/pull/853)

### 5.1.0 - 2021-02-22
Expand Down
14 changes: 10 additions & 4 deletions packages/vm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { BN } from 'ethereumjs-util'
import Common from '@ethereumjs/common'
import VM from '@ethereumjs/vm'

const common = new Common({ chain: 'mainnet' })
const common = new Common({ chain: 'mainnet', hardfork: 'berlin' })
const vm = new VM({ common })

const STOP = '00'
Expand Down Expand Up @@ -69,6 +69,8 @@ For documentation on `VM` instantiation, exposed API and emitted `events` see ge

Documentation on the `StateManager` can be found [here](./docs/classes/_state_statemanager_.defaultstatemanager.md). If you want to provide your own `StateManager` you can implement the dedicated [interface](./docs/interfaces/_state_interface_.statemanager.md) to ensure that your implementation conforms with the current API.

Note: along the `EIP-2929` (Gas cost increases for state access opcodes) implementation released in `v5.2.0` a new `EIP2929StateManager` interface has been introduced inheriting from the base `StateManager` interface. The methods introduced there will be merged into the base state manager on the next breaking release.

# BROWSER

To build the VM for standalone use in the browser, see: [Running the VM in a browser](https://github.com/ethereumjs/ethereumjs-vm/tree/master/examples/run-code-browser).
Expand Down Expand Up @@ -121,7 +123,7 @@ The VM currently supports the following hardfork rules:
- `petersburg`
- `istanbul` (`v4.1.1`+)
- `muirGlacier` (only `mainnet` and `ropsten`) (`v4.1.3`+)
- `berlin` (`DRAFT`, only `EIP-2315`)
- `berlin` (`v5.2.0`+)

Default: `istanbul` (taken from `Common.DEFAULT_HARDFORK`)

Expand All @@ -132,7 +134,7 @@ along the `Common` instance:
import Common from '@ethereumjs/common'
import VM from '@ethereumjs/vm'

const common = new Common({ chain: 'mainnet', hardfork: 'byzantium' })
const common = new Common({ chain: 'mainnet', hardfork: 'berlin' })
const vm = new VM({ common })
```

Expand All @@ -151,8 +153,12 @@ const vm = new VM({ common })

Currently supported EIPs:

- [EIP-2315](https://eips.ethereum.org/EIPS/eip-2315): Simple subroutines
- [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537): BLS precompiles
- [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929): gas cost increases for state access opcodes
- [EIP-2565](https://eips.ethereum.org/EIPS/eip-2565): ModExp gas cost (`berlin` EIP)
- [EIP-2718](https://eips.ethereum.org/EIPS/eip-2718): Typed transactions (`berlin` EIP)
- [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929): Gas cost increases for state access opcodes (`berlin` EIP)
- [EIP-2930](https://eips.ethereum.org/EIPS/eip-2930): Optional Access Lists Typed Transactions (`berlin` EIP)

## Tracing Events

Expand Down
2 changes: 1 addition & 1 deletion packages/vm/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@ethereumjs/vm",
"version": "5.1.0",
"version": "5.2.0",
"description": "An Ethereum VM implementation",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down

0 comments on commit 9ae81ce

Please sign in to comment.