Skip to content

Commit

Permalink
Merge pull request #1151 from ethereumjs/berlin-releases
Browse files Browse the repository at this point in the history
Berlin Releases
  • Loading branch information
holgerd77 authored Mar 22, 2021
2 parents b2d171c + 5c90450 commit 4672761
Show file tree
Hide file tree
Showing 119 changed files with 21,934 additions and 7,681 deletions.
22,236 changes: 16,221 additions & 6,015 deletions package-lock.json

Large diffs are not rendered by default.

30 changes: 28 additions & 2 deletions packages/block/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,35 @@ 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
## 3.2.0 - 2021-03-18

- 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). It is now possible to create blocks with access list transactions.
### Berlin HF Support

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:

- `@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 Changes

- Added support for very large chain IDs when using Block `cliqueSigner()` address recovery, PR [#1139](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1139)
- Fixed a TS compilation failure on install relating to `ethereumjs-util` `v7.0.9`, PR [#1136](https://github.com/ethereumjs/ethereumjs-monorepo/pull/1136)

## 3.1.0 - 2021-02-22

Expand Down
92 changes: 49 additions & 43 deletions packages/block/docs/classes/_block_.block.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ An object that represents the block.

### constructor

\+ **new Block**(`header?`: [BlockHeader](_header_.blockheader.md), `transactions`: Transaction[], `uncleHeaders`: [BlockHeader](_header_.blockheader.md)[], `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)*
\+ **new Block**(`header?`: [BlockHeader](_header_.blockheader.md), `transactions`: TypedTransaction[], `uncleHeaders`: [BlockHeader](_header_.blockheader.md)[], `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)*

*Defined in [block.ts:107](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L107)*
*Defined in [block.ts:125](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L125)*

This constructor takes the values, validates them, assigns them and freezes the object.
Use the static factory methods to assist in creating a Block object from varying data types and options.
Expand All @@ -60,7 +60,7 @@ Use the static factory methods to assist in creating a Block object from varying
Name | Type | Default |
------ | ------ | ------ |
`header?` | [BlockHeader](_header_.blockheader.md) | - |
`transactions` | Transaction[] | [] |
`transactions` | TypedTransaction[] | [] |
`uncleHeaders` | [BlockHeader](_header_.blockheader.md)[] | [] |
`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} |

Expand All @@ -72,47 +72,47 @@ Name | Type | Default |

**_common**: *Common*

*Defined in [block.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L18)*
*Defined in [block.ts:18](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L18)*

___

### header

**header**: *[BlockHeader](_header_.blockheader.md)*

*Defined in [block.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L14)*
*Defined in [block.ts:14](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L14)*

___

### transactions

**transactions**: *Transaction[]* = []
**transactions**: *TypedTransaction[]* = []

*Defined in [block.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L15)*
*Defined in [block.ts:15](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L15)*

___

### txTrie

**txTrie**: *Trie‹›* = new Trie()

*Defined in [block.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L17)*
*Defined in [block.ts:17](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L17)*

___

### uncleHeaders

**uncleHeaders**: *[BlockHeader](_header_.blockheader.md)[]* = []

*Defined in [block.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L16)*
*Defined in [block.ts:16](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L16)*

## Methods

### canonicalDifficulty

**canonicalDifficulty**(`parentBlock`: [Block](_block_.block.md)): *BN*

*Defined in [block.ts:307](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L307)*
*Defined in [block.ts:327](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L327)*

Returns the canonical difficulty for this block.

Expand All @@ -130,7 +130,7 @@ ___

**genTxTrie**(): *Promise‹void›*

*Defined in [block.ts:168](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L168)*
*Defined in [block.ts:188](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L188)*

Generates transaction trie for validation.

Expand All @@ -142,7 +142,7 @@ ___

**hash**(): *Buffer*

*Defined in [block.ts:147](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L147)*
*Defined in [block.ts:167](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L167)*

Produces a hash the RLP of the block.

Expand All @@ -154,7 +154,7 @@ ___

**isGenesis**(): *boolean*

*Defined in [block.ts:154](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L154)*
*Defined in [block.ts:174](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L174)*

Determines if this block is the genesis block.

Expand All @@ -166,9 +166,9 @@ ___

**raw**(): *[BlockBuffer](../modules/_index_.md#blockbuffer)*

*Defined in [block.ts:136](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L136)*
*Defined in [block.ts:154](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L154)*

Returns a Buffer Array of the raw Buffers of this block, in order.
Returns a Buffer Array of the raw Buffers of this block, in order.

**Returns:** *[BlockBuffer](../modules/_index_.md#blockbuffer)*

Expand All @@ -178,7 +178,7 @@ ___

**serialize**(): *Buffer*

*Defined in [block.ts:161](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L161)*
*Defined in [block.ts:181](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L181)*

Returns the rlp encoding of the block.

Expand All @@ -190,7 +190,7 @@ ___

**toJSON**(): *[JsonBlock](../interfaces/_index_.jsonblock.md)*

*Defined in [block.ts:333](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L333)*
*Defined in [block.ts:353](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L353)*

Returns the block in JSON format.

Expand All @@ -202,7 +202,7 @@ ___

**validate**(`blockchain`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›*

*Defined in [block.ts:229](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L229)*
*Defined in [block.ts:249](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L249)*

Performs the following consistency checks on the block:

Expand All @@ -227,7 +227,7 @@ ___

**validateData**(): *Promise‹void›*

*Defined in [block.ts:242](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L242)*
*Defined in [block.ts:262](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L262)*

Validates the block data, throwing if invalid.
This can be checked on the Block itself without needing access to any parent block
Expand All @@ -244,7 +244,7 @@ ___

**validateDifficulty**(`parentBlock`: [Block](_block_.block.md)): *boolean*

*Defined in [block.ts:316](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L316)*
*Defined in [block.ts:336](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L336)*

Checks that the block's `difficulty` matches the canonical difficulty.

Expand All @@ -262,7 +262,7 @@ ___

**validateGasLimit**(`parentBlock`: [Block](_block_.block.md)): *boolean*

*Defined in [block.ts:326](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L326)*
*Defined in [block.ts:346](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L346)*

Validates if the block gasLimit remains in the
boundaries set by the protocol.
Expand All @@ -281,15 +281,15 @@ ___

**validateTransactions**(): *boolean*

*Defined in [block.ts:201](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L201)*
*Defined in [block.ts:221](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L221)*

Validates transaction signatures and minimum gas requirements.

**Returns:** *boolean*

**validateTransactions**(`stringError`: false): *boolean*

*Defined in [block.ts:202](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L202)*
*Defined in [block.ts:222](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L222)*

**Parameters:**

Expand All @@ -301,7 +301,7 @@ Name | Type |

**validateTransactions**(`stringError`: true): *string[]*

*Defined in [block.ts:203](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L203)*
*Defined in [block.ts:223](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L223)*

**Parameters:**

Expand All @@ -317,7 +317,7 @@ ___

**validateTransactionsTrie**(): *Promise‹boolean›*

*Defined in [block.ts:182](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L182)*
*Defined in [block.ts:202](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L202)*

Validates the transaction trie by generating a trie
and do a check on the root hash.
Expand All @@ -330,7 +330,7 @@ ___

**validateUncles**(`blockchain`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›*

*Defined in [block.ts:283](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L283)*
*Defined in [block.ts:303](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L303)*

Consistency checks and header validation for uncles included,
in the block, if any.
Expand Down Expand Up @@ -359,7 +359,7 @@ ___

**validateUnclesHash**(): *boolean*

*Defined in [block.ts:262](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L262)*
*Defined in [block.ts:282](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L282)*

Validates the uncle's hash.

Expand All @@ -371,14 +371,16 @@ ___

**fromBlockData**(`blockData`: [BlockData](../interfaces/_index_.blockdata.md), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›*

*Defined in [block.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L20)*
*Defined in [block.ts:26](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L26)*

Static constructor to create a block from a block data dictionary

**Parameters:**

Name | Type | Default |
------ | ------ | ------ |
`blockData` | [BlockData](../interfaces/_index_.blockdata.md) | {} |
`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - |
Name | Type | Default | Description |
------ | ------ | ------ | ------ |
`blockData` | [BlockData](../interfaces/_index_.blockdata.md) | {} | - |
`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | |

**Returns:** *[Block](_block_.block.md)‹›*

Expand All @@ -388,14 +390,16 @@ ___

**fromRLPSerializedBlock**(`serialized`: Buffer, `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›*

*Defined in [block.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L53)*
*Defined in [block.ts:65](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L65)*

Static constructor to create a block from a RLP-serialized block

**Parameters:**

Name | Type |
------ | ------ |
`serialized` | Buffer |
`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) |
Name | Type | Description |
------ | ------ | ------ |
`serialized` | Buffer | - |
`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | |

**Returns:** *[Block](_block_.block.md)‹›*

Expand All @@ -405,14 +409,16 @@ ___

**fromValuesArray**(`values`: [BlockBuffer](../modules/_index_.md#blockbuffer), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›*

*Defined in [block.ts:63](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L63)*
*Defined in [block.ts:81](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L81)*

Static constructor to create a block from an array of Buffer values

**Parameters:**

Name | Type |
------ | ------ |
`values` | [BlockBuffer](../modules/_index_.md#blockbuffer) |
`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) |
Name | Type | Description |
------ | ------ | ------ |
`values` | [BlockBuffer](../modules/_index_.md#blockbuffer) | - |
`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | |

**Returns:** *[Block](_block_.block.md)‹›*

Expand All @@ -422,7 +428,7 @@ ___

**genesis**(`blockData`: [BlockData](../interfaces/_index_.blockdata.md), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›*

*Defined in [block.ts:104](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L104)*
*Defined in [block.ts:122](https://github.com/ethereumjs/ethereumjs-monorepo/blob/master/packages/block/src/block.ts#L122)*

Alias for Block.fromBlockData() with initWithGenesisHeader set to true.

Expand Down
Loading

0 comments on commit 4672761

Please sign in to comment.