diff --git a/packages/block/CHANGELOG.md b/packages/block/CHANGELOG.md index fba210b0da..09d3efd57b 100644 --- a/packages/block/CHANGELOG.md +++ b/packages/block/CHANGELOG.md @@ -6,6 +6,12 @@ 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-rc.1 - 2020-11-19 + +This is the first release candidate towards a final library release, see [beta.2](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fblock%403.0.0-beta.2) and especially [beta.1](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fblock%403.0.0-beta.1) release notes for an overview on the full changes since the last publicly released version. + +- Additional consistency and validation checks in `Block.validateUncles()` for included uncle headers, PR [#935](https://github.com/ethereumjs/ethereumjs-vm/pull/935) + ## 3.0.0-beta.2 - 2020-11-12 This is the second beta release towards a final library release, see [beta.1 release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Ftx%403.0.0-beta.1) for an overview on the full changes since the last publicly released version. diff --git a/packages/block/README.md b/packages/block/README.md index b0b68449e4..fafb18f690 100644 --- a/packages/block/README.md +++ b/packages/block/README.md @@ -17,15 +17,19 @@ Note: this `README` reflects the state of the library from `v3.0.0` onwards. See # USAGE -There are three static factories to instantiate a `Block` or `BlockHeader`: +There are three static factories to instantiate a `Block`: - `Block.fromBlockData(blockData: BlockData = {}, opts?: BlockOptions)` - `Block.fromRLPSerializedBlock(serialized: Buffer, opts?: BlockOptions)` - `Block.fromValuesArray(values: BlockBuffer, opts?: BlockOptions)` +For `BlockHeader` instantiation analogue factory methods exists, see API docs linked below. + Instantiation Example: ```typescript +import { BlockHeader } from '@ethereumjs/block' + const headerData = { number: 15, parentHash: '0x6bfee7294bf44572b7266358e627f3c35105e1c3851f3de09e6d646f955725a7', diff --git a/packages/block/docs/classes/_block_.block.md b/packages/block/docs/classes/_block_.block.md index 35e8f6bcd3..58a41bdd37 100644 --- a/packages/block/docs/classes/_block_.block.md +++ b/packages/block/docs/classes/_block_.block.md @@ -32,6 +32,7 @@ An object that represents the block. * [serialize](_block_.block.md#serialize) * [toJSON](_block_.block.md#tojson) * [validate](_block_.block.md#validate) +* [validateData](_block_.block.md#validatedata) * [validateDifficulty](_block_.block.md#validatedifficulty) * [validateGasLimit](_block_.block.md#validategaslimit) * [validateTransactions](_block_.block.md#validatetransactions) @@ -49,7 +50,7 @@ An object that represents the block. \+ **new Block**(`header?`: [BlockHeader](_header_.blockheader.md), `transactions`: Transaction[], `uncleHeaders`: [BlockHeader](_header_.blockheader.md)[], `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)* -*Defined in [block.ts:82](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L82)* +*Defined in [block.ts:92](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L92)* 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. @@ -111,7 +112,7 @@ ___ ▸ **canonicalDifficulty**(`parentBlock`: [Block](_block_.block.md)): *BN* -*Defined in [block.ts:245](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L245)* +*Defined in [block.ts:286](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L286)* Returns the canonical difficulty for this block. @@ -129,7 +130,7 @@ ___ ▸ **genTxTrie**(): *Promise‹void›* -*Defined in [block.ts:137](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L137)* +*Defined in [block.ts:150](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L150)* Generates transaction trie for validation. @@ -141,7 +142,7 @@ ___ ▸ **hash**(): *Buffer* -*Defined in [block.ts:116](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L116)* +*Defined in [block.ts:129](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L129)* Produces a hash the RLP of the block. @@ -153,7 +154,7 @@ ___ ▸ **isGenesis**(): *boolean* -*Defined in [block.ts:123](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L123)* +*Defined in [block.ts:136](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L136)* Determines if this block is the genesis block. @@ -165,7 +166,7 @@ ___ ▸ **raw**(): *[BlockBuffer](../modules/_index_.md#blockbuffer)* -*Defined in [block.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L105)* +*Defined in [block.ts:118](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L118)* Returns a Buffer Array of the raw Buffers of this block, in order. @@ -177,7 +178,7 @@ ___ ▸ **serialize**(): *Buffer* -*Defined in [block.ts:130](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L130)* +*Defined in [block.ts:143](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L143)* Returns the rlp encoding of the block. @@ -189,7 +190,7 @@ ___ ▸ **toJSON**(): *[JsonBlock](../interfaces/_index_.jsonblock.md)* -*Defined in [block.ts:270](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L270)* +*Defined in [block.ts:312](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L312)* Returns the block in JSON format. @@ -199,17 +200,41 @@ ___ ### validate -▸ **validate**(`blockchain?`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* +▸ **validate**(`blockchain`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* + +*Defined in [block.ts:209](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L209)* -*Defined in [block.ts:188](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L188)* +Performs the following consistency checks on the block: -Validates the block, throwing if invalid. +- Value checks on the header fields +- Signature and gasLimit validation for included txs +- Validation of the tx trie +- Consistency checks and header validation of included uncles + +Throws if invalid. **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against a @ethereumjs/blockchain | +`blockchain` | [Blockchain](../interfaces/_index_.blockchain.md) | validate against a @ethereumjs/blockchain | + +**Returns:** *Promise‹void›* + +___ + +### validateData + +▸ **validateData**(): *Promise‹void›* + +*Defined in [block.ts:222](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L222)* + +Validates the block data, throwing if invalid. +This can be checked on the Block itself without needing access to any parent block +It checks: +- All transactions are valid +- The transactions trie is valid +- The uncle hash is valid **Returns:** *Promise‹void›* @@ -219,7 +244,7 @@ ___ ▸ **validateDifficulty**(`parentBlock`: [Block](_block_.block.md)): *boolean* -*Defined in [block.ts:254](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L254)* +*Defined in [block.ts:295](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L295)* Checks that the block's `difficulty` matches the canonical difficulty. @@ -237,9 +262,10 @@ ___ ▸ **validateGasLimit**(`parentBlock`: [Block](_block_.block.md)): *boolean* -*Defined in [block.ts:263](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L263)* +*Defined in [block.ts:305](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L305)* -Validates the gasLimit. +Validates if the block gasLimit remains in the +boundaries set by the protocol. **Parameters:** @@ -255,15 +281,15 @@ ___ ▸ **validateTransactions**(): *boolean* -*Defined in [block.ts:167](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L167)* +*Defined in [block.ts:181](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L181)* -Validates the transactions. +Validates transaction signatures and minimum gas requirements. **Returns:** *boolean* ▸ **validateTransactions**(`stringError`: false): *boolean* -*Defined in [block.ts:168](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L168)* +*Defined in [block.ts:182](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L182)* **Parameters:** @@ -275,7 +301,7 @@ Name | Type | ▸ **validateTransactions**(`stringError`: true): *string[]* -*Defined in [block.ts:169](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L169)* +*Defined in [block.ts:183](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L183)* **Parameters:** @@ -291,9 +317,10 @@ ___ ▸ **validateTransactionsTrie**(): *Promise‹boolean›* -*Defined in [block.ts:150](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L150)* +*Defined in [block.ts:164](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L164)* -Validates the transaction trie. +Validates the transaction trie by generating a trie +and do a check on the root hash. **Returns:** *Promise‹boolean›* @@ -301,17 +328,28 @@ ___ ### validateUncles -▸ **validateUncles**(`blockchain?`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* +▸ **validateUncles**(`blockchain`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* + +*Defined in [block.ts:262](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L262)* -*Defined in [block.ts:221](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L221)* +Consistency checks and header validation for uncles included, +in the block, if any. -Validates the uncles that are in the block, if any. This method throws if they are invalid. +Throws if invalid. + +The rules of uncles are the following: +Uncle Header is a valid header. +Uncle Header is an orphan, i.e. it is not one of the headers of the canonical chain. +Uncle Header has a parentHash which points to the canonical chain. This parentHash is within the last 7 blocks. +Uncle Header is not already included as uncle in another block. +Header has at most 2 uncles. +Header does not count an uncle twice. **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against a @ethereumjs/blockchain | +`blockchain` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against an @ethereumjs/blockchain instance | **Returns:** *Promise‹void›* @@ -321,7 +359,7 @@ ___ ▸ **validateUnclesHash**(): *boolean* -*Defined in [block.ts:211](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L211)* +*Defined in [block.ts:241](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L241)* Validates the uncle's hash. @@ -331,7 +369,7 @@ ___ ### `Static` fromBlockData -▸ **fromBlockData**(`blockData`: [BlockData](../interfaces/_index_.blockdata.md), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* +▸ **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)* @@ -340,7 +378,7 @@ ___ Name | Type | Default | ------ | ------ | ------ | `blockData` | [BlockData](../interfaces/_index_.blockdata.md) | {} | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | **Returns:** *[Block](_block_.block.md)‹›* @@ -348,16 +386,16 @@ ___ ### `Static` fromRLPSerializedBlock -▸ **fromRLPSerializedBlock**(`serialized`: Buffer, `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* +▸ **fromRLPSerializedBlock**(`serialized`: Buffer, `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* -*Defined in [block.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L42)* +*Defined in [block.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L46)* **Parameters:** -Name | Type | Default | ------- | ------ | ------ | -`serialized` | Buffer | - | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +Name | Type | +------ | ------ | +`serialized` | Buffer | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | **Returns:** *[Block](_block_.block.md)‹›* @@ -365,16 +403,16 @@ ___ ### `Static` fromValuesArray -▸ **fromValuesArray**(`values`: [BlockBuffer](../modules/_index_.md#blockbuffer), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* +▸ **fromValuesArray**(`values`: [BlockBuffer](../modules/_index_.md#blockbuffer), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* -*Defined in [block.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L52)* +*Defined in [block.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L56)* **Parameters:** -Name | Type | Default | ------- | ------ | ------ | -`values` | [BlockBuffer](../modules/_index_.md#blockbuffer) | - | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +Name | Type | +------ | ------ | +`values` | [BlockBuffer](../modules/_index_.md#blockbuffer) | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | **Returns:** *[Block](_block_.block.md)‹›* @@ -382,9 +420,9 @@ ___ ### `Static` genesis -▸ **genesis**(`blockData`: [BlockData](../interfaces/_index_.blockdata.md), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* +▸ **genesis**(`blockData`: [BlockData](../interfaces/_index_.blockdata.md), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* -*Defined in [block.ts:79](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L79)* +*Defined in [block.ts:89](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L89)* Alias for Block.fromBlockData() with initWithGenesisHeader set to true. @@ -393,6 +431,6 @@ Alias for Block.fromBlockData() with initWithGenesisHeader set to true. Name | Type | Default | ------ | ------ | ------ | `blockData` | [BlockData](../interfaces/_index_.blockdata.md) | {} | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | **Returns:** *[Block](_block_.block.md)‹›* diff --git a/packages/block/docs/classes/_header_.blockheader.md b/packages/block/docs/classes/_header_.blockheader.md index dc5efdad61..950d7f609c 100644 --- a/packages/block/docs/classes/_header_.blockheader.md +++ b/packages/block/docs/classes/_header_.blockheader.md @@ -220,7 +220,7 @@ ___ ▸ **_validateBufferLengths**(): *void* -*Defined in [header.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L232)* +*Defined in [header.ts:242](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L242)* Validates correct buffer lengths, throws if invalid. @@ -232,7 +232,7 @@ ___ ▸ **canonicalDifficulty**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *BN* -*Defined in [header.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L261)* +*Defined in [header.ts:271](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L271)* Returns the canonical difficulty for this block. @@ -250,7 +250,7 @@ ___ ▸ **hash**(): *Buffer* -*Defined in [header.ts:447](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L447)* +*Defined in [header.ts:469](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L469)* Returns the hash of the block header. @@ -262,7 +262,7 @@ ___ ▸ **isGenesis**(): *boolean* -*Defined in [header.ts:454](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L454)* +*Defined in [header.ts:476](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L476)* Checks if the block header is a genesis header. @@ -274,7 +274,7 @@ ___ ▸ **raw**(): *[BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer)* -*Defined in [header.ts:424](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L424)* +*Defined in [header.ts:446](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L446)* Returns a Buffer Array of the raw Buffers in this header, in order. @@ -286,7 +286,7 @@ ___ ▸ **serialize**(): *Buffer* -*Defined in [header.ts:461](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L461)* +*Defined in [header.ts:483](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L483)* Returns the rlp encoding of the block header. @@ -298,7 +298,7 @@ ___ ▸ **toJSON**(): *[JsonHeader](../interfaces/_index_.jsonheader.md)* -*Defined in [header.ts:468](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L468)* +*Defined in [header.ts:490](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L490)* Returns the block header in JSON format. @@ -308,17 +308,23 @@ ___ ### validate -▸ **validate**(`blockchain?`: [Blockchain](../interfaces/_index_.blockchain.md), `height?`: BN): *Promise‹void›* +▸ **validate**(`blockchain`: [Blockchain](../interfaces/_index_.blockchain.md), `height?`: BN): *Promise‹void›* -*Defined in [header.ts:378](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L378)* +*Defined in [header.ts:401](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L401)* -Validates the block header, throwing if invalid. +Validates the block header, throwing if invalid. It is being validated against the reported `parentHash`. +It verifies the current block against the `parentHash`: +- The `parentHash` is part of the blockchain (it is a valid header) +- Current block number is parent block number + 1 +- Current block has a strictly higher timestamp +- Current block has valid difficulty and gas limit +- In case that the header is an uncle header, it should not be too old or young in the chain. **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against a @ethereumjs/blockchain | +`blockchain` | [Blockchain](../interfaces/_index_.blockchain.md) | validate against a @ethereumjs/blockchain | `height?` | BN | If this is an uncle header, this is the height of the block that is including it | **Returns:** *Promise‹void›* @@ -329,7 +335,7 @@ ___ ▸ **validateDifficulty**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *boolean* -*Defined in [header.ts:345](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L345)* +*Defined in [header.ts:359](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L359)* Checks that the block's `difficulty` matches the canonical difficulty. @@ -347,9 +353,10 @@ ___ ▸ **validateGasLimit**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *boolean* -*Defined in [header.ts:354](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L354)* +*Defined in [header.ts:372](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L372)* -Validates the gasLimit. +Validates if the block gasLimit remains in the +boundaries set by the protocol. **Parameters:** @@ -363,7 +370,7 @@ ___ ### `Static` fromHeaderData -▸ **fromHeaderData**(`headerData`: [HeaderData](../interfaces/_index_.headerdata.md), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* +▸ **fromHeaderData**(`headerData`: [HeaderData](../interfaces/_index_.headerdata.md), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* *Defined in [header.ts:40](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L40)* @@ -372,7 +379,7 @@ ___ Name | Type | Default | ------ | ------ | ------ | `headerData` | [HeaderData](../interfaces/_index_.headerdata.md) | {} | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | **Returns:** *[BlockHeader](_header_.blockheader.md)‹›* @@ -380,7 +387,7 @@ ___ ### `Static` fromRLPSerializedHeader -▸ **fromRLPSerializedHeader**(`serialized`: Buffer, `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* +▸ **fromRLPSerializedHeader**(`serialized`: Buffer, `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* *Defined in [header.ts:79](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L79)* @@ -389,7 +396,7 @@ ___ Name | Type | ------ | ------ | `serialized` | Buffer | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | **Returns:** *[BlockHeader](_header_.blockheader.md)‹›* @@ -397,7 +404,7 @@ ___ ### `Static` fromValuesArray -▸ **fromValuesArray**(`values`: [BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* +▸ **fromValuesArray**(`values`: [BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* *Defined in [header.ts:89](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L89)* @@ -406,7 +413,7 @@ ___ Name | Type | ------ | ------ | `values` | [BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer) | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | **Returns:** *[BlockHeader](_header_.blockheader.md)‹›* @@ -414,7 +421,7 @@ ___ ### `Static` genesis -▸ **genesis**(`headerData`: [HeaderData](../interfaces/_index_.headerdata.md), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* +▸ **genesis**(`headerData`: [HeaderData](../interfaces/_index_.headerdata.md), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* *Defined in [header.ts:135](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L135)* @@ -425,6 +432,6 @@ Alias for Header.fromHeaderData() with initWithGenesisHeader set to true. Name | Type | Default | ------ | ------ | ------ | `headerData` | [HeaderData](../interfaces/_index_.headerdata.md) | {} | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | **Returns:** *[BlockHeader](_header_.blockheader.md)‹›* diff --git a/packages/block/docs/classes/_index_.block.md b/packages/block/docs/classes/_index_.block.md index 3d62d9e752..05dad77b8b 100644 --- a/packages/block/docs/classes/_index_.block.md +++ b/packages/block/docs/classes/_index_.block.md @@ -32,6 +32,7 @@ An object that represents the block. * [serialize](_index_.block.md#serialize) * [toJSON](_index_.block.md#tojson) * [validate](_index_.block.md#validate) +* [validateData](_index_.block.md#validatedata) * [validateDifficulty](_index_.block.md#validatedifficulty) * [validateGasLimit](_index_.block.md#validategaslimit) * [validateTransactions](_index_.block.md#validatetransactions) @@ -49,7 +50,7 @@ An object that represents the block. \+ **new Block**(`header?`: [BlockHeader](_index_.blockheader.md), `transactions`: Transaction[], `uncleHeaders`: [BlockHeader](_header_.blockheader.md)[], `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_index_.block.md)* -*Defined in [block.ts:82](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L82)* +*Defined in [block.ts:92](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L92)* 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. @@ -111,7 +112,7 @@ ___ ▸ **canonicalDifficulty**(`parentBlock`: [Block](_block_.block.md)): *BN* -*Defined in [block.ts:245](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L245)* +*Defined in [block.ts:286](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L286)* Returns the canonical difficulty for this block. @@ -129,7 +130,7 @@ ___ ▸ **genTxTrie**(): *Promise‹void›* -*Defined in [block.ts:137](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L137)* +*Defined in [block.ts:150](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L150)* Generates transaction trie for validation. @@ -141,7 +142,7 @@ ___ ▸ **hash**(): *Buffer* -*Defined in [block.ts:116](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L116)* +*Defined in [block.ts:129](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L129)* Produces a hash the RLP of the block. @@ -153,7 +154,7 @@ ___ ▸ **isGenesis**(): *boolean* -*Defined in [block.ts:123](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L123)* +*Defined in [block.ts:136](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L136)* Determines if this block is the genesis block. @@ -165,7 +166,7 @@ ___ ▸ **raw**(): *[BlockBuffer](../modules/_index_.md#blockbuffer)* -*Defined in [block.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L105)* +*Defined in [block.ts:118](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L118)* Returns a Buffer Array of the raw Buffers of this block, in order. @@ -177,7 +178,7 @@ ___ ▸ **serialize**(): *Buffer* -*Defined in [block.ts:130](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L130)* +*Defined in [block.ts:143](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L143)* Returns the rlp encoding of the block. @@ -189,7 +190,7 @@ ___ ▸ **toJSON**(): *[JsonBlock](../interfaces/_index_.jsonblock.md)* -*Defined in [block.ts:270](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L270)* +*Defined in [block.ts:312](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L312)* Returns the block in JSON format. @@ -199,17 +200,41 @@ ___ ### validate -▸ **validate**(`blockchain?`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* +▸ **validate**(`blockchain`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* + +*Defined in [block.ts:209](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L209)* -*Defined in [block.ts:188](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L188)* +Performs the following consistency checks on the block: -Validates the block, throwing if invalid. +- Value checks on the header fields +- Signature and gasLimit validation for included txs +- Validation of the tx trie +- Consistency checks and header validation of included uncles + +Throws if invalid. **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against a @ethereumjs/blockchain | +`blockchain` | [Blockchain](../interfaces/_index_.blockchain.md) | validate against a @ethereumjs/blockchain | + +**Returns:** *Promise‹void›* + +___ + +### validateData + +▸ **validateData**(): *Promise‹void›* + +*Defined in [block.ts:222](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L222)* + +Validates the block data, throwing if invalid. +This can be checked on the Block itself without needing access to any parent block +It checks: +- All transactions are valid +- The transactions trie is valid +- The uncle hash is valid **Returns:** *Promise‹void›* @@ -219,7 +244,7 @@ ___ ▸ **validateDifficulty**(`parentBlock`: [Block](_block_.block.md)): *boolean* -*Defined in [block.ts:254](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L254)* +*Defined in [block.ts:295](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L295)* Checks that the block's `difficulty` matches the canonical difficulty. @@ -237,9 +262,10 @@ ___ ▸ **validateGasLimit**(`parentBlock`: [Block](_block_.block.md)): *boolean* -*Defined in [block.ts:263](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L263)* +*Defined in [block.ts:305](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L305)* -Validates the gasLimit. +Validates if the block gasLimit remains in the +boundaries set by the protocol. **Parameters:** @@ -255,15 +281,15 @@ ___ ▸ **validateTransactions**(): *boolean* -*Defined in [block.ts:167](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L167)* +*Defined in [block.ts:181](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L181)* -Validates the transactions. +Validates transaction signatures and minimum gas requirements. **Returns:** *boolean* ▸ **validateTransactions**(`stringError`: false): *boolean* -*Defined in [block.ts:168](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L168)* +*Defined in [block.ts:182](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L182)* **Parameters:** @@ -275,7 +301,7 @@ Name | Type | ▸ **validateTransactions**(`stringError`: true): *string[]* -*Defined in [block.ts:169](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L169)* +*Defined in [block.ts:183](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L183)* **Parameters:** @@ -291,9 +317,10 @@ ___ ▸ **validateTransactionsTrie**(): *Promise‹boolean›* -*Defined in [block.ts:150](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L150)* +*Defined in [block.ts:164](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L164)* -Validates the transaction trie. +Validates the transaction trie by generating a trie +and do a check on the root hash. **Returns:** *Promise‹boolean›* @@ -301,17 +328,28 @@ ___ ### validateUncles -▸ **validateUncles**(`blockchain?`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* +▸ **validateUncles**(`blockchain`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* + +*Defined in [block.ts:262](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L262)* -*Defined in [block.ts:221](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L221)* +Consistency checks and header validation for uncles included, +in the block, if any. -Validates the uncles that are in the block, if any. This method throws if they are invalid. +Throws if invalid. + +The rules of uncles are the following: +Uncle Header is a valid header. +Uncle Header is an orphan, i.e. it is not one of the headers of the canonical chain. +Uncle Header has a parentHash which points to the canonical chain. This parentHash is within the last 7 blocks. +Uncle Header is not already included as uncle in another block. +Header has at most 2 uncles. +Header does not count an uncle twice. **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against a @ethereumjs/blockchain | +`blockchain` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against an @ethereumjs/blockchain instance | **Returns:** *Promise‹void›* @@ -321,7 +359,7 @@ ___ ▸ **validateUnclesHash**(): *boolean* -*Defined in [block.ts:211](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L211)* +*Defined in [block.ts:241](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L241)* Validates the uncle's hash. @@ -331,7 +369,7 @@ ___ ### `Static` fromBlockData -▸ **fromBlockData**(`blockData`: [BlockData](../interfaces/_index_.blockdata.md), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* +▸ **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)* @@ -340,7 +378,7 @@ ___ Name | Type | Default | ------ | ------ | ------ | `blockData` | [BlockData](../interfaces/_index_.blockdata.md) | {} | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | **Returns:** *[Block](_block_.block.md)‹›* @@ -348,16 +386,16 @@ ___ ### `Static` fromRLPSerializedBlock -▸ **fromRLPSerializedBlock**(`serialized`: Buffer, `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* +▸ **fromRLPSerializedBlock**(`serialized`: Buffer, `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* -*Defined in [block.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L42)* +*Defined in [block.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L46)* **Parameters:** -Name | Type | Default | ------- | ------ | ------ | -`serialized` | Buffer | - | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +Name | Type | +------ | ------ | +`serialized` | Buffer | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | **Returns:** *[Block](_block_.block.md)‹›* @@ -365,16 +403,16 @@ ___ ### `Static` fromValuesArray -▸ **fromValuesArray**(`values`: [BlockBuffer](../modules/_index_.md#blockbuffer), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* +▸ **fromValuesArray**(`values`: [BlockBuffer](../modules/_index_.md#blockbuffer), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* -*Defined in [block.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L52)* +*Defined in [block.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L56)* **Parameters:** -Name | Type | Default | ------- | ------ | ------ | -`values` | [BlockBuffer](../modules/_index_.md#blockbuffer) | - | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +Name | Type | +------ | ------ | +`values` | [BlockBuffer](../modules/_index_.md#blockbuffer) | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | **Returns:** *[Block](_block_.block.md)‹›* @@ -382,9 +420,9 @@ ___ ### `Static` genesis -▸ **genesis**(`blockData`: [BlockData](../interfaces/_index_.blockdata.md), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* +▸ **genesis**(`blockData`: [BlockData](../interfaces/_index_.blockdata.md), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](_block_.block.md)‹›* -*Defined in [block.ts:79](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L79)* +*Defined in [block.ts:89](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L89)* Alias for Block.fromBlockData() with initWithGenesisHeader set to true. @@ -393,6 +431,6 @@ Alias for Block.fromBlockData() with initWithGenesisHeader set to true. Name | Type | Default | ------ | ------ | ------ | `blockData` | [BlockData](../interfaces/_index_.blockdata.md) | {} | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | **Returns:** *[Block](_block_.block.md)‹›* diff --git a/packages/block/docs/classes/_index_.blockheader.md b/packages/block/docs/classes/_index_.blockheader.md index 78c2f415cd..0fdb54ea9e 100644 --- a/packages/block/docs/classes/_index_.blockheader.md +++ b/packages/block/docs/classes/_index_.blockheader.md @@ -220,7 +220,7 @@ ___ ▸ **_validateBufferLengths**(): *void* -*Defined in [header.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L232)* +*Defined in [header.ts:242](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L242)* Validates correct buffer lengths, throws if invalid. @@ -232,7 +232,7 @@ ___ ▸ **canonicalDifficulty**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *BN* -*Defined in [header.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L261)* +*Defined in [header.ts:271](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L271)* Returns the canonical difficulty for this block. @@ -250,7 +250,7 @@ ___ ▸ **hash**(): *Buffer* -*Defined in [header.ts:447](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L447)* +*Defined in [header.ts:469](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L469)* Returns the hash of the block header. @@ -262,7 +262,7 @@ ___ ▸ **isGenesis**(): *boolean* -*Defined in [header.ts:454](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L454)* +*Defined in [header.ts:476](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L476)* Checks if the block header is a genesis header. @@ -274,7 +274,7 @@ ___ ▸ **raw**(): *[BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer)* -*Defined in [header.ts:424](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L424)* +*Defined in [header.ts:446](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L446)* Returns a Buffer Array of the raw Buffers in this header, in order. @@ -286,7 +286,7 @@ ___ ▸ **serialize**(): *Buffer* -*Defined in [header.ts:461](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L461)* +*Defined in [header.ts:483](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L483)* Returns the rlp encoding of the block header. @@ -298,7 +298,7 @@ ___ ▸ **toJSON**(): *[JsonHeader](../interfaces/_index_.jsonheader.md)* -*Defined in [header.ts:468](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L468)* +*Defined in [header.ts:490](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L490)* Returns the block header in JSON format. @@ -308,17 +308,23 @@ ___ ### validate -▸ **validate**(`blockchain?`: [Blockchain](../interfaces/_index_.blockchain.md), `height?`: BN): *Promise‹void›* +▸ **validate**(`blockchain`: [Blockchain](../interfaces/_index_.blockchain.md), `height?`: BN): *Promise‹void›* -*Defined in [header.ts:378](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L378)* +*Defined in [header.ts:401](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L401)* -Validates the block header, throwing if invalid. +Validates the block header, throwing if invalid. It is being validated against the reported `parentHash`. +It verifies the current block against the `parentHash`: +- The `parentHash` is part of the blockchain (it is a valid header) +- Current block number is parent block number + 1 +- Current block has a strictly higher timestamp +- Current block has valid difficulty and gas limit +- In case that the header is an uncle header, it should not be too old or young in the chain. **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against a @ethereumjs/blockchain | +`blockchain` | [Blockchain](../interfaces/_index_.blockchain.md) | validate against a @ethereumjs/blockchain | `height?` | BN | If this is an uncle header, this is the height of the block that is including it | **Returns:** *Promise‹void›* @@ -329,7 +335,7 @@ ___ ▸ **validateDifficulty**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *boolean* -*Defined in [header.ts:345](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L345)* +*Defined in [header.ts:359](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L359)* Checks that the block's `difficulty` matches the canonical difficulty. @@ -347,9 +353,10 @@ ___ ▸ **validateGasLimit**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *boolean* -*Defined in [header.ts:354](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L354)* +*Defined in [header.ts:372](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L372)* -Validates the gasLimit. +Validates if the block gasLimit remains in the +boundaries set by the protocol. **Parameters:** @@ -363,7 +370,7 @@ ___ ### `Static` fromHeaderData -▸ **fromHeaderData**(`headerData`: [HeaderData](../interfaces/_index_.headerdata.md), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* +▸ **fromHeaderData**(`headerData`: [HeaderData](../interfaces/_index_.headerdata.md), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* *Defined in [header.ts:40](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L40)* @@ -372,7 +379,7 @@ ___ Name | Type | Default | ------ | ------ | ------ | `headerData` | [HeaderData](../interfaces/_index_.headerdata.md) | {} | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | **Returns:** *[BlockHeader](_header_.blockheader.md)‹›* @@ -380,7 +387,7 @@ ___ ### `Static` fromRLPSerializedHeader -▸ **fromRLPSerializedHeader**(`serialized`: Buffer, `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* +▸ **fromRLPSerializedHeader**(`serialized`: Buffer, `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* *Defined in [header.ts:79](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L79)* @@ -389,7 +396,7 @@ ___ Name | Type | ------ | ------ | `serialized` | Buffer | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | **Returns:** *[BlockHeader](_header_.blockheader.md)‹›* @@ -397,7 +404,7 @@ ___ ### `Static` fromValuesArray -▸ **fromValuesArray**(`values`: [BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* +▸ **fromValuesArray**(`values`: [BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* *Defined in [header.ts:89](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L89)* @@ -406,7 +413,7 @@ ___ Name | Type | ------ | ------ | `values` | [BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer) | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | **Returns:** *[BlockHeader](_header_.blockheader.md)‹›* @@ -414,7 +421,7 @@ ___ ### `Static` genesis -▸ **genesis**(`headerData`: [HeaderData](../interfaces/_index_.headerdata.md), `opts`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* +▸ **genesis**(`headerData`: [HeaderData](../interfaces/_index_.headerdata.md), `opts?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)‹›* *Defined in [header.ts:135](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L135)* @@ -425,6 +432,6 @@ Alias for Header.fromHeaderData() with initWithGenesisHeader set to true. Name | Type | Default | ------ | ------ | ------ | `headerData` | [HeaderData](../interfaces/_index_.headerdata.md) | {} | -`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | +`opts?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | **Returns:** *[BlockHeader](_header_.blockheader.md)‹›* diff --git a/packages/block/docs/interfaces/_index_.blockchain.md b/packages/block/docs/interfaces/_index_.blockchain.md index 628f5e4b62..cac552bf6d 100644 --- a/packages/block/docs/interfaces/_index_.blockchain.md +++ b/packages/block/docs/interfaces/_index_.blockchain.md @@ -18,7 +18,7 @@ ▸ **getBlock**(`hash`: Buffer): *Promise‹[Block](../classes/_block_.block.md)›* -*Defined in [types.ts:113](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L113)* +*Defined in [types.ts:132](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L132)* **Parameters:** diff --git a/packages/block/docs/interfaces/_index_.blockdata.md b/packages/block/docs/interfaces/_index_.blockdata.md index c9131d8c0b..3f0c3644b9 100644 --- a/packages/block/docs/interfaces/_index_.blockdata.md +++ b/packages/block/docs/interfaces/_index_.blockdata.md @@ -22,7 +22,7 @@ A block's data. • **header**? : *[HeaderData](_index_.headerdata.md)* -*Defined in [types.ts:68](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L68)* +*Defined in [types.ts:87](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L87)* Header data for the block @@ -32,7 +32,7 @@ ___ • **transactions**? : *Array‹TxData›* -*Defined in [types.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L69)* +*Defined in [types.ts:88](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L88)* ___ @@ -40,4 +40,4 @@ ___ • **uncleHeaders**? : *Array‹[HeaderData](_index_.headerdata.md)›* -*Defined in [types.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L70)* +*Defined in [types.ts:89](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L89)* diff --git a/packages/block/docs/interfaces/_index_.blockoptions.md b/packages/block/docs/interfaces/_index_.blockoptions.md index 92ca5225c0..9209cfd2fe 100644 --- a/packages/block/docs/interfaces/_index_.blockoptions.md +++ b/packages/block/docs/interfaces/_index_.blockoptions.md @@ -14,17 +14,31 @@ hardfork. ### Properties +* [calcDifficultyFromHeader](_index_.blockoptions.md#optional-calcdifficultyfromheader) * [common](_index_.blockoptions.md#optional-common) +* [freeze](_index_.blockoptions.md#optional-freeze) * [hardforkByBlockNumber](_index_.blockoptions.md#optional-hardforkbyblocknumber) * [initWithGenesisHeader](_index_.blockoptions.md#optional-initwithgenesisheader) ## Properties +### `Optional` calcDifficultyFromHeader + +• **calcDifficultyFromHeader**? : *[BlockHeader](../classes/_index_.blockheader.md)* + +*Defined in [types.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L45)* + +If a preceding `BlockHeader` (usually the parent header) is given the preceding +header will be used to calculate the difficulty for this block and the calculated +difficulty takes precedence over a provided static `difficulty` value. + +___ + ### `Optional` common • **common**? : *Common* -*Defined in [types.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L20)* +*Defined in [types.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L21)* A Common object defining the chain and the hardfork a block/block header belongs to. @@ -35,11 +49,28 @@ Current default hardfork: `istanbul` ___ +### `Optional` freeze + +• **freeze**? : *undefined | false | true* + +*Defined in [types.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L56)* + +A block object by default gets frozen along initialization. This gives you +strong additional security guarantees on the consistency of the block parameters. + +If you need to deactivate the block freeze - e.g. because you want to subclass block and +add aditional properties - it is strongly encouraged that you do the freeze yourself +within your code instead. + +Default: true + +___ + ### `Optional` hardforkByBlockNumber • **hardforkByBlockNumber**? : *undefined | false | true* -*Defined in [types.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L26)* +*Defined in [types.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L27)* Determine the HF by the block number @@ -51,7 +82,7 @@ ___ • **initWithGenesisHeader**? : *undefined | false | true* -*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L37)* +*Defined in [types.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L38)* Turns the block header into the canonical genesis block header diff --git a/packages/block/docs/interfaces/_index_.headerdata.md b/packages/block/docs/interfaces/_index_.headerdata.md index 9bd3a2badf..7e3a0b04d7 100644 --- a/packages/block/docs/interfaces/_index_.headerdata.md +++ b/packages/block/docs/interfaces/_index_.headerdata.md @@ -34,7 +34,7 @@ A block header's data. • **bloom**? : *BufferLike* -*Defined in [types.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L50)* +*Defined in [types.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L69)* ___ @@ -42,7 +42,7 @@ ___ • **coinbase**? : *AddressLike* -*Defined in [types.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L46)* +*Defined in [types.ts:65](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L65)* ___ @@ -50,7 +50,7 @@ ___ • **difficulty**? : *BNLike* -*Defined in [types.ts:51](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L51)* +*Defined in [types.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L70)* ___ @@ -58,7 +58,7 @@ ___ • **extraData**? : *BufferLike* -*Defined in [types.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L56)* +*Defined in [types.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L75)* ___ @@ -66,7 +66,7 @@ ___ • **gasLimit**? : *BNLike* -*Defined in [types.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L53)* +*Defined in [types.ts:72](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L72)* ___ @@ -74,7 +74,7 @@ ___ • **gasUsed**? : *BNLike* -*Defined in [types.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L54)* +*Defined in [types.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L73)* ___ @@ -82,7 +82,7 @@ ___ • **mixHash**? : *BufferLike* -*Defined in [types.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L57)* +*Defined in [types.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L76)* ___ @@ -90,7 +90,7 @@ ___ • **nonce**? : *BufferLike* -*Defined in [types.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L58)* +*Defined in [types.ts:77](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L77)* ___ @@ -98,7 +98,7 @@ ___ • **number**? : *BNLike* -*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L52)* +*Defined in [types.ts:71](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L71)* ___ @@ -106,7 +106,7 @@ ___ • **parentHash**? : *BufferLike* -*Defined in [types.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L44)* +*Defined in [types.ts:63](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L63)* ___ @@ -114,7 +114,7 @@ ___ • **receiptTrie**? : *BufferLike* -*Defined in [types.ts:49](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L49)* +*Defined in [types.ts:68](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L68)* ___ @@ -122,7 +122,7 @@ ___ • **stateRoot**? : *BufferLike* -*Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L47)* +*Defined in [types.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L66)* ___ @@ -130,7 +130,7 @@ ___ • **timestamp**? : *BNLike* -*Defined in [types.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L55)* +*Defined in [types.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L74)* ___ @@ -138,7 +138,7 @@ ___ • **transactionsTrie**? : *BufferLike* -*Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L48)* +*Defined in [types.ts:67](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L67)* ___ @@ -146,4 +146,4 @@ ___ • **uncleHash**? : *BufferLike* -*Defined in [types.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L45)* +*Defined in [types.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L64)* diff --git a/packages/block/docs/interfaces/_index_.jsonblock.md b/packages/block/docs/interfaces/_index_.jsonblock.md index 679fe54337..c226b8bd38 100644 --- a/packages/block/docs/interfaces/_index_.jsonblock.md +++ b/packages/block/docs/interfaces/_index_.jsonblock.md @@ -22,7 +22,7 @@ An object with the block's data represented as strings. • **header**? : *[JsonHeader](_index_.jsonheader.md)* -*Defined in [types.ts:86](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L86)* +*Defined in [types.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L105)* Header data for the block @@ -32,7 +32,7 @@ ___ • **transactions**? : *JsonTx[]* -*Defined in [types.ts:87](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L87)* +*Defined in [types.ts:106](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L106)* ___ @@ -40,4 +40,4 @@ ___ • **uncleHeaders**? : *[JsonHeader](_index_.jsonheader.md)[]* -*Defined in [types.ts:88](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L88)* +*Defined in [types.ts:107](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L107)* diff --git a/packages/block/docs/interfaces/_index_.jsonheader.md b/packages/block/docs/interfaces/_index_.jsonheader.md index cb847d92b3..0618b9b199 100644 --- a/packages/block/docs/interfaces/_index_.jsonheader.md +++ b/packages/block/docs/interfaces/_index_.jsonheader.md @@ -34,7 +34,7 @@ An object with the block header's data represented as strings. • **bloom**? : *undefined | string* -*Defined in [types.ts:101](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L101)* +*Defined in [types.ts:120](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L120)* ___ @@ -42,7 +42,7 @@ ___ • **coinbase**? : *undefined | string* -*Defined in [types.ts:97](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L97)* +*Defined in [types.ts:116](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L116)* ___ @@ -50,7 +50,7 @@ ___ • **difficulty**? : *undefined | string* -*Defined in [types.ts:102](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L102)* +*Defined in [types.ts:121](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L121)* ___ @@ -58,7 +58,7 @@ ___ • **extraData**? : *undefined | string* -*Defined in [types.ts:107](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L107)* +*Defined in [types.ts:126](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L126)* ___ @@ -66,7 +66,7 @@ ___ • **gasLimit**? : *undefined | string* -*Defined in [types.ts:104](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L104)* +*Defined in [types.ts:123](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L123)* ___ @@ -74,7 +74,7 @@ ___ • **gasUsed**? : *undefined | string* -*Defined in [types.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L105)* +*Defined in [types.ts:124](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L124)* ___ @@ -82,7 +82,7 @@ ___ • **mixHash**? : *undefined | string* -*Defined in [types.ts:108](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L108)* +*Defined in [types.ts:127](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L127)* ___ @@ -90,7 +90,7 @@ ___ • **nonce**? : *undefined | string* -*Defined in [types.ts:109](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L109)* +*Defined in [types.ts:128](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L128)* ___ @@ -98,7 +98,7 @@ ___ • **number**? : *undefined | string* -*Defined in [types.ts:103](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L103)* +*Defined in [types.ts:122](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L122)* ___ @@ -106,7 +106,7 @@ ___ • **parentHash**? : *undefined | string* -*Defined in [types.ts:95](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L95)* +*Defined in [types.ts:114](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L114)* ___ @@ -114,7 +114,7 @@ ___ • **receiptTrie**? : *undefined | string* -*Defined in [types.ts:100](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L100)* +*Defined in [types.ts:119](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L119)* ___ @@ -122,7 +122,7 @@ ___ • **stateRoot**? : *undefined | string* -*Defined in [types.ts:98](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L98)* +*Defined in [types.ts:117](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L117)* ___ @@ -130,7 +130,7 @@ ___ • **timestamp**? : *undefined | string* -*Defined in [types.ts:106](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L106)* +*Defined in [types.ts:125](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L125)* ___ @@ -138,7 +138,7 @@ ___ • **transactionsTrie**? : *undefined | string* -*Defined in [types.ts:99](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L99)* +*Defined in [types.ts:118](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L118)* ___ @@ -146,4 +146,4 @@ ___ • **uncleHash**? : *undefined | string* -*Defined in [types.ts:96](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L96)* +*Defined in [types.ts:115](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L115)* diff --git a/packages/block/docs/interfaces/_types_.blockchain.md b/packages/block/docs/interfaces/_types_.blockchain.md index 01ddb71563..28b9ceca4f 100644 --- a/packages/block/docs/interfaces/_types_.blockchain.md +++ b/packages/block/docs/interfaces/_types_.blockchain.md @@ -18,7 +18,7 @@ ▸ **getBlock**(`hash`: Buffer): *Promise‹[Block](../classes/_block_.block.md)›* -*Defined in [types.ts:113](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L113)* +*Defined in [types.ts:132](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L132)* **Parameters:** diff --git a/packages/block/docs/interfaces/_types_.blockdata.md b/packages/block/docs/interfaces/_types_.blockdata.md index c1d373e94e..380dd8f9c4 100644 --- a/packages/block/docs/interfaces/_types_.blockdata.md +++ b/packages/block/docs/interfaces/_types_.blockdata.md @@ -22,7 +22,7 @@ A block's data. • **header**? : *[HeaderData](_types_.headerdata.md)* -*Defined in [types.ts:68](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L68)* +*Defined in [types.ts:87](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L87)* Header data for the block @@ -32,7 +32,7 @@ ___ • **transactions**? : *Array‹TxData›* -*Defined in [types.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L69)* +*Defined in [types.ts:88](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L88)* ___ @@ -40,4 +40,4 @@ ___ • **uncleHeaders**? : *Array‹[HeaderData](_index_.headerdata.md)›* -*Defined in [types.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L70)* +*Defined in [types.ts:89](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L89)* diff --git a/packages/block/docs/interfaces/_types_.blockoptions.md b/packages/block/docs/interfaces/_types_.blockoptions.md index 7a64e00ba5..5b8970d74f 100644 --- a/packages/block/docs/interfaces/_types_.blockoptions.md +++ b/packages/block/docs/interfaces/_types_.blockoptions.md @@ -14,17 +14,31 @@ hardfork. ### Properties +* [calcDifficultyFromHeader](_types_.blockoptions.md#optional-calcdifficultyfromheader) * [common](_types_.blockoptions.md#optional-common) +* [freeze](_types_.blockoptions.md#optional-freeze) * [hardforkByBlockNumber](_types_.blockoptions.md#optional-hardforkbyblocknumber) * [initWithGenesisHeader](_types_.blockoptions.md#optional-initwithgenesisheader) ## Properties +### `Optional` calcDifficultyFromHeader + +• **calcDifficultyFromHeader**? : *[BlockHeader](../classes/_header_.blockheader.md)* + +*Defined in [types.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L45)* + +If a preceding `BlockHeader` (usually the parent header) is given the preceding +header will be used to calculate the difficulty for this block and the calculated +difficulty takes precedence over a provided static `difficulty` value. + +___ + ### `Optional` common • **common**? : *Common* -*Defined in [types.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L20)* +*Defined in [types.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L21)* A Common object defining the chain and the hardfork a block/block header belongs to. @@ -35,11 +49,28 @@ Current default hardfork: `istanbul` ___ +### `Optional` freeze + +• **freeze**? : *undefined | false | true* + +*Defined in [types.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L56)* + +A block object by default gets frozen along initialization. This gives you +strong additional security guarantees on the consistency of the block parameters. + +If you need to deactivate the block freeze - e.g. because you want to subclass block and +add aditional properties - it is strongly encouraged that you do the freeze yourself +within your code instead. + +Default: true + +___ + ### `Optional` hardforkByBlockNumber • **hardforkByBlockNumber**? : *undefined | false | true* -*Defined in [types.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L26)* +*Defined in [types.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L27)* Determine the HF by the block number @@ -51,7 +82,7 @@ ___ • **initWithGenesisHeader**? : *undefined | false | true* -*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L37)* +*Defined in [types.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L38)* Turns the block header into the canonical genesis block header diff --git a/packages/block/docs/interfaces/_types_.headerdata.md b/packages/block/docs/interfaces/_types_.headerdata.md index 639bace40d..0cafbed300 100644 --- a/packages/block/docs/interfaces/_types_.headerdata.md +++ b/packages/block/docs/interfaces/_types_.headerdata.md @@ -34,7 +34,7 @@ A block header's data. • **bloom**? : *BufferLike* -*Defined in [types.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L50)* +*Defined in [types.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L69)* ___ @@ -42,7 +42,7 @@ ___ • **coinbase**? : *AddressLike* -*Defined in [types.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L46)* +*Defined in [types.ts:65](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L65)* ___ @@ -50,7 +50,7 @@ ___ • **difficulty**? : *BNLike* -*Defined in [types.ts:51](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L51)* +*Defined in [types.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L70)* ___ @@ -58,7 +58,7 @@ ___ • **extraData**? : *BufferLike* -*Defined in [types.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L56)* +*Defined in [types.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L75)* ___ @@ -66,7 +66,7 @@ ___ • **gasLimit**? : *BNLike* -*Defined in [types.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L53)* +*Defined in [types.ts:72](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L72)* ___ @@ -74,7 +74,7 @@ ___ • **gasUsed**? : *BNLike* -*Defined in [types.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L54)* +*Defined in [types.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L73)* ___ @@ -82,7 +82,7 @@ ___ • **mixHash**? : *BufferLike* -*Defined in [types.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L57)* +*Defined in [types.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L76)* ___ @@ -90,7 +90,7 @@ ___ • **nonce**? : *BufferLike* -*Defined in [types.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L58)* +*Defined in [types.ts:77](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L77)* ___ @@ -98,7 +98,7 @@ ___ • **number**? : *BNLike* -*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L52)* +*Defined in [types.ts:71](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L71)* ___ @@ -106,7 +106,7 @@ ___ • **parentHash**? : *BufferLike* -*Defined in [types.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L44)* +*Defined in [types.ts:63](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L63)* ___ @@ -114,7 +114,7 @@ ___ • **receiptTrie**? : *BufferLike* -*Defined in [types.ts:49](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L49)* +*Defined in [types.ts:68](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L68)* ___ @@ -122,7 +122,7 @@ ___ • **stateRoot**? : *BufferLike* -*Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L47)* +*Defined in [types.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L66)* ___ @@ -130,7 +130,7 @@ ___ • **timestamp**? : *BNLike* -*Defined in [types.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L55)* +*Defined in [types.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L74)* ___ @@ -138,7 +138,7 @@ ___ • **transactionsTrie**? : *BufferLike* -*Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L48)* +*Defined in [types.ts:67](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L67)* ___ @@ -146,4 +146,4 @@ ___ • **uncleHash**? : *BufferLike* -*Defined in [types.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L45)* +*Defined in [types.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L64)* diff --git a/packages/block/docs/interfaces/_types_.jsonblock.md b/packages/block/docs/interfaces/_types_.jsonblock.md index b090c1df73..f8477dca37 100644 --- a/packages/block/docs/interfaces/_types_.jsonblock.md +++ b/packages/block/docs/interfaces/_types_.jsonblock.md @@ -22,7 +22,7 @@ An object with the block's data represented as strings. • **header**? : *[JsonHeader](_types_.jsonheader.md)* -*Defined in [types.ts:86](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L86)* +*Defined in [types.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L105)* Header data for the block @@ -32,7 +32,7 @@ ___ • **transactions**? : *JsonTx[]* -*Defined in [types.ts:87](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L87)* +*Defined in [types.ts:106](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L106)* ___ @@ -40,4 +40,4 @@ ___ • **uncleHeaders**? : *[JsonHeader](_index_.jsonheader.md)[]* -*Defined in [types.ts:88](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L88)* +*Defined in [types.ts:107](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L107)* diff --git a/packages/block/docs/interfaces/_types_.jsonheader.md b/packages/block/docs/interfaces/_types_.jsonheader.md index a4a7bc8f78..e892bca679 100644 --- a/packages/block/docs/interfaces/_types_.jsonheader.md +++ b/packages/block/docs/interfaces/_types_.jsonheader.md @@ -34,7 +34,7 @@ An object with the block header's data represented as strings. • **bloom**? : *undefined | string* -*Defined in [types.ts:101](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L101)* +*Defined in [types.ts:120](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L120)* ___ @@ -42,7 +42,7 @@ ___ • **coinbase**? : *undefined | string* -*Defined in [types.ts:97](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L97)* +*Defined in [types.ts:116](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L116)* ___ @@ -50,7 +50,7 @@ ___ • **difficulty**? : *undefined | string* -*Defined in [types.ts:102](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L102)* +*Defined in [types.ts:121](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L121)* ___ @@ -58,7 +58,7 @@ ___ • **extraData**? : *undefined | string* -*Defined in [types.ts:107](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L107)* +*Defined in [types.ts:126](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L126)* ___ @@ -66,7 +66,7 @@ ___ • **gasLimit**? : *undefined | string* -*Defined in [types.ts:104](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L104)* +*Defined in [types.ts:123](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L123)* ___ @@ -74,7 +74,7 @@ ___ • **gasUsed**? : *undefined | string* -*Defined in [types.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L105)* +*Defined in [types.ts:124](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L124)* ___ @@ -82,7 +82,7 @@ ___ • **mixHash**? : *undefined | string* -*Defined in [types.ts:108](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L108)* +*Defined in [types.ts:127](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L127)* ___ @@ -90,7 +90,7 @@ ___ • **nonce**? : *undefined | string* -*Defined in [types.ts:109](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L109)* +*Defined in [types.ts:128](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L128)* ___ @@ -98,7 +98,7 @@ ___ • **number**? : *undefined | string* -*Defined in [types.ts:103](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L103)* +*Defined in [types.ts:122](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L122)* ___ @@ -106,7 +106,7 @@ ___ • **parentHash**? : *undefined | string* -*Defined in [types.ts:95](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L95)* +*Defined in [types.ts:114](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L114)* ___ @@ -114,7 +114,7 @@ ___ • **receiptTrie**? : *undefined | string* -*Defined in [types.ts:100](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L100)* +*Defined in [types.ts:119](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L119)* ___ @@ -122,7 +122,7 @@ ___ • **stateRoot**? : *undefined | string* -*Defined in [types.ts:98](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L98)* +*Defined in [types.ts:117](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L117)* ___ @@ -130,7 +130,7 @@ ___ • **timestamp**? : *undefined | string* -*Defined in [types.ts:106](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L106)* +*Defined in [types.ts:125](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L125)* ___ @@ -138,7 +138,7 @@ ___ • **transactionsTrie**? : *undefined | string* -*Defined in [types.ts:99](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L99)* +*Defined in [types.ts:118](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L118)* ___ @@ -146,4 +146,4 @@ ___ • **uncleHash**? : *undefined | string* -*Defined in [types.ts:96](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L96)* +*Defined in [types.ts:115](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L115)* diff --git a/packages/block/docs/modules/_index_.md b/packages/block/docs/modules/_index_.md index 58f70c08f4..0de5701bd4 100644 --- a/packages/block/docs/modules/_index_.md +++ b/packages/block/docs/modules/_index_.md @@ -32,7 +32,7 @@ Ƭ **BlockBodyBuffer**: *[[TransactionsBuffer](_index_.md#transactionsbuffer), [UncleHeadersBuffer](_index_.md#uncleheadersbuffer)]* -*Defined in [types.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L75)* +*Defined in [types.ts:94](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L94)* ___ @@ -40,7 +40,7 @@ ___ Ƭ **BlockBuffer**: *[[BlockHeaderBuffer](_index_.md#blockheaderbuffer), [TransactionsBuffer](_index_.md#transactionsbuffer), [UncleHeadersBuffer](_index_.md#uncleheadersbuffer)]* -*Defined in [types.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L73)* +*Defined in [types.ts:92](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L92)* ___ @@ -48,7 +48,7 @@ ___ Ƭ **BlockHeaderBuffer**: *Buffer[]* -*Defined in [types.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L74)* +*Defined in [types.ts:93](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L93)* ___ @@ -56,7 +56,7 @@ ___ Ƭ **TransactionsBuffer**: *Buffer[][]* -*Defined in [types.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L76)* +*Defined in [types.ts:95](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L95)* ___ @@ -64,4 +64,4 @@ ___ Ƭ **UncleHeadersBuffer**: *Buffer[][]* -*Defined in [types.ts:77](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L77)* +*Defined in [types.ts:96](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L96)* diff --git a/packages/block/docs/modules/_types_.md b/packages/block/docs/modules/_types_.md index 123128b22a..0eb81b9300 100644 --- a/packages/block/docs/modules/_types_.md +++ b/packages/block/docs/modules/_types_.md @@ -27,7 +27,7 @@ Ƭ **BlockBodyBuffer**: *[[TransactionsBuffer](_types_.md#transactionsbuffer), [UncleHeadersBuffer](_types_.md#uncleheadersbuffer)]* -*Defined in [types.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L75)* +*Defined in [types.ts:94](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L94)* ___ @@ -35,7 +35,7 @@ ___ Ƭ **BlockBuffer**: *[[BlockHeaderBuffer](_types_.md#blockheaderbuffer), [TransactionsBuffer](_types_.md#transactionsbuffer), [UncleHeadersBuffer](_types_.md#uncleheadersbuffer)]* -*Defined in [types.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L73)* +*Defined in [types.ts:92](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L92)* ___ @@ -43,7 +43,7 @@ ___ Ƭ **BlockHeaderBuffer**: *Buffer[]* -*Defined in [types.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L74)* +*Defined in [types.ts:93](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L93)* ___ @@ -51,7 +51,7 @@ ___ Ƭ **TransactionsBuffer**: *Buffer[][]* -*Defined in [types.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L76)* +*Defined in [types.ts:95](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L95)* ___ @@ -59,4 +59,4 @@ ___ Ƭ **UncleHeadersBuffer**: *Buffer[][]* -*Defined in [types.ts:77](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L77)* +*Defined in [types.ts:96](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L96)* diff --git a/packages/block/package.json b/packages/block/package.json index c12d4bc640..df3a38883c 100644 --- a/packages/block/package.json +++ b/packages/block/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/block", - "version": "3.0.0-beta.2", + "version": "3.0.0-rc.1", "description": "Provides Block serialization and help functions", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -39,8 +39,8 @@ }, "homepage": "https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/block#readme", "dependencies": { - "@ethereumjs/common": "2.0.0-beta.2", - "@ethereumjs/tx": "3.0.0-beta.2", + "@ethereumjs/common": "2.0.0-rc.1", + "@ethereumjs/tx": "3.0.0-rc.1", "@types/bn.js": "^4.11.6", "ethereumjs-util": "^7.0.7", "merkle-patricia-tree": "^4.0.0" diff --git a/packages/blockchain/CHANGELOG.md b/packages/blockchain/CHANGELOG.md index 9943172fa0..620ef6da3f 100644 --- a/packages/blockchain/CHANGELOG.md +++ b/packages/blockchain/CHANGELOG.md @@ -6,7 +6,9 @@ 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). -## 5.0.0-rc.1 UNRELEASED +## 5.0.0-rc.1 2020-11-19 + +This is the first release candidate towards a final library release, see [beta.2](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fblockchain%405.0.0-beta.2) and especially [beta.1](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fblockchain%405.0.0-beta.1) release notes for an overview on the full changes since the last publicly released version. - Exposed private `Blockchain._getTd()` total difficulty function as `Blockchain.getTotalDifficulty()`, PR [#956](https://github.com/ethereumjs/ethereumjs-vm/issues/956) diff --git a/packages/blockchain/package.json b/packages/blockchain/package.json index 2d08cad004..363a9cd143 100644 --- a/packages/blockchain/package.json +++ b/packages/blockchain/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/blockchain", - "version": "5.0.0-beta.2", + "version": "5.0.0-rc.1", "description": "A module to store and interact with blocks", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -36,9 +36,9 @@ }, "homepage": "https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/blockchain#readme", "dependencies": { - "@ethereumjs/block": "3.0.0-beta.2", - "@ethereumjs/common": "2.0.0-beta.2", - "@ethereumjs/ethash": "1.0.0-beta.1", + "@ethereumjs/block": "3.0.0-rc.1", + "@ethereumjs/common": "2.0.0-rc.1", + "@ethereumjs/ethash": "1.0.0-rc.1", "ethereumjs-util": "^7.0.7", "level-mem": "^5.0.1", "lru-cache": "^5.1.1", diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 354bbeda83..ed91537c37 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -6,6 +6,12 @@ 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). +## 2.0.0-rc.1 2020-11-19 + +This is the first release candidate towards a final library release, see [beta.2](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fcommon%402.0.0-beta.2) and especially [beta.1](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fcommon%402.0.0-beta.1) release notes for an overview on the full changes since the last publicly released version. + +No changes since `beta.2` release. + ## 2.0.0-beta.2 - 2020-11-12 This is the second beta release towards a final library release, see [beta.1 release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fcommon%402.0.0-beta.1) for an overview on the full changes since the last publicly released version. diff --git a/packages/common/README.md b/packages/common/README.md index a0ebda74c2..0e596198c7 100644 --- a/packages/common/README.md +++ b/packages/common/README.md @@ -6,7 +6,7 @@ [![Code Coverage][common-coverage-badge]][common-coverage-link] [![Discord][discord-badge]][discord-link] -| Resources common to all Ethereum implementations. | +| Resources common to all EthereumJS implementations. | | --- | Note: this `README` reflects the state of the library from `v2.0.0` onwards. See `README` from the [standalone repository](https://github.com/ethereumjs/ethereumjs-common) for an introduction on the last preceeding release. diff --git a/packages/common/package.json b/packages/common/package.json index 071b16d79f..16a83e975e 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/common", - "version": "2.0.0-beta.2", + "version": "2.0.0-rc.1", "description": "Resources common to all Ethereum implementations", "main": "./dist/index.js", "types": "./dist/index.d.ts", diff --git a/packages/ethash/CHANGELOG.md b/packages/ethash/CHANGELOG.md index 5be2b2c1e2..6b4315fa15 100644 --- a/packages/ethash/CHANGELOG.md +++ b/packages/ethash/CHANGELOG.md @@ -6,6 +6,12 @@ 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). +## 1.0.0-rc.1 - 2020-11-19 + +This is the first release candidate towards a final library release, see [beta.1](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fethash%401.0.0-beta.1) release notes for an overview on the full changes since the last publicly released version. + +No changes since `beta.1` release. + ## 1.0.0-beta.1 - 2020-10-22 ### New Package Name diff --git a/packages/ethash/package.json b/packages/ethash/package.json index 531e09e5bf..050a6c0c86 100644 --- a/packages/ethash/package.json +++ b/packages/ethash/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/ethash", - "version": "1.0.0-beta.1", + "version": "1.0.0-rc.1", "description": "An ethash implementation in JS.", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -40,7 +40,7 @@ "miller-rabin": "^4.0.0" }, "devDependencies": { - "@ethereumjs/block": "3.0.0-beta.2", + "@ethereumjs/block": "3.0.0-rc.1", "@ethereumjs/config-coverage": "^2.0.0", "@ethereumjs/config-typescript": "^2.0.0", "@ethereumjs/eslint-config-defaults": "^2.0.0", diff --git a/packages/tx/CHANGELOG.md b/packages/tx/CHANGELOG.md index 4a49307206..3fc1242c3f 100644 --- a/packages/tx/CHANGELOG.md +++ b/packages/tx/CHANGELOG.md @@ -6,6 +6,12 @@ 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-rc.1 - 2020-11-19 + +This is the first release candidate towards a final library release, see [beta.2](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Ftx%403.0.0-beta.2) and especially [beta.1](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Ftx%403.0.0-beta.1) release notes for an overview on the full changes since the last publicly released version. + +- Dropped `ethereumjs-testing` dev dependency, PR [#953](https://github.com/ethereumjs/ethereumjs-vm/pull/953) + ## 3.0.0-beta.2 - 2020-11-12 This is the second beta release towards a final library release, see [beta.1 release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Ftx%403.0.0-beta.1) for an overview on the full changes since the last publicly released version. diff --git a/packages/tx/README.md b/packages/tx/README.md index 3765ef0fc9..958a2af28b 100644 --- a/packages/tx/README.md +++ b/packages/tx/README.md @@ -20,7 +20,7 @@ Note: this `README` reflects the state of the library from `v3.0.0` onwards. See - [Example](./examples/transactions.ts) ```typescript -import Transaction from '@ethereumjs/tx' +import { Transaction } from '@ethereumjs/tx' const txParams = { nonce: '0x00', diff --git a/packages/tx/package.json b/packages/tx/package.json index 9a24bd1ae5..e643a3c5ad 100644 --- a/packages/tx/package.json +++ b/packages/tx/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/tx", - "version": "3.0.0-beta.2", + "version": "3.0.0-rc.1", "description": "A simple module for creating, manipulating and signing Ethereum transactions", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -31,7 +31,7 @@ "author": "mjbecze ", "license": "MPL-2.0", "dependencies": { - "@ethereumjs/common": "2.0.0-beta.2", + "@ethereumjs/common": "2.0.0-rc.1", "ethereumjs-util": "^7.0.7" }, "devDependencies": { @@ -74,78 +74,6 @@ }, "homepage": "https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/tx#readme", "contributors": [ - { - "name": "<-c-g-> ", - "email": "christophergewecke@gmail.com", - "url": "https://github.com/cgewecke", - "contributions": 1, - "additions": 3, - "deletions": 1, - "hireable": true - }, - { - "name": "Kirill Fomichev", - "email": "fanatid@ya.ru", - "url": "https://github.com/fanatid", - "contributions": 1, - "additions": 3, - "deletions": 2, - "hireable": true - }, - { - "name": "Rick Behl", - "email": null, - "url": "https://github.com/Nexus7", - "contributions": 1, - "additions": 1, - "deletions": 1, - "hireable": null - }, - { - "name": "Tim Coulter", - "email": "tim@timothyjcoulter.com", - "url": "https://github.com/tcoulter", - "contributions": 1, - "additions": 1, - "deletions": 1, - "hireable": null - }, - { - "name": "kumavis", - "email": "aaron@kumavis.me", - "url": "https://github.com/kumavis", - "contributions": 1, - "additions": 6, - "deletions": 6, - "hireable": true - }, - { - "name": "Jack Peterson", - "email": "jack@tinybike.net", - "url": "https://github.com/tinybike", - "contributions": 2, - "additions": 1, - "deletions": 2, - "hireable": null - }, - { - "name": "Nick Dodson", - "email": null, - "url": "https://github.com/SilentCicero", - "contributions": 2, - "additions": 29, - "deletions": 0, - "hireable": true - }, - { - "name": null, - "email": null, - "url": "https://github.com/ckeenan", - "contributions": 2, - "additions": 4, - "deletions": 3, - "hireable": null - }, { "name": "Alex Beregszaszi", "email": "alex@rtfs.hu", @@ -154,24 +82,6 @@ "additions": 27562, "deletions": 42613, "hireable": true - }, - { - "name": null, - "email": null, - "url": "https://github.com/wanderer", - "contributions": 171, - "additions": 112706, - "deletions": 96355, - "hireable": null - }, - { - "name": null, - "email": null, - "url": "https://github.com/kvhnuke", - "contributions": 7, - "additions": 268, - "deletions": 53, - "hireable": null } ] } diff --git a/packages/vm/CHANGELOG.md b/packages/vm/CHANGELOG.md index d00a66e2ff..eb6cd9b907 100644 --- a/packages/vm/CHANGELOG.md +++ b/packages/vm/CHANGELOG.md @@ -6,6 +6,14 @@ 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). +## 5.0.0-rc.1 - 2020-11-19 + +This is the first release candidate towards a final library release, see [beta.2](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fvm%405.0.0-beta.2) and especially [beta.1](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fvm%405.0.0-beta.1) release notes for an overview on the full changes since the last publicly released version. + +- Security fixes by `mcl-wasm` package dependency update, PR [#955](https://github.com/ethereumjs/ethereumjs-vm/pull/955) +- On-demand state and blockchain test runs for all hardforks triggered by PR label, PR [#951](https://github.com/ethereumjs/ethereumjs-vm/pull/951) +- Dropped `ethereumjs-testing` dev dependency, PR [#953](https://github.com/ethereumjs/ethereumjs-vm/pull/953) + ## 5.0.0-beta.2 - 2020-11-12 This is the second beta release towards a final library release, see [beta.1 release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fvm%405.0.0-beta.1) for an overview on the full changes since the last publicly released version. diff --git a/packages/vm/docs/interfaces/_state_statemanager_.defaultstatemanageropts.md b/packages/vm/docs/interfaces/_state_statemanager_.defaultstatemanageropts.md index 77aceba32e..6410ac5cee 100644 --- a/packages/vm/docs/interfaces/_state_statemanager_.defaultstatemanageropts.md +++ b/packages/vm/docs/interfaces/_state_statemanager_.defaultstatemanageropts.md @@ -23,7 +23,7 @@ Options for constructing a [StateManager](_state_index_.statemanager.md). *Defined in [state/stateManager.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L28)* -Parameters of the chain ([`Common`](https://github.com/ethereumjs/ethereumjs-common)) +Parameters of the chain ([`Common`](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/common)) ___ diff --git a/packages/vm/package.json b/packages/vm/package.json index d5cf15e359..2810bf7860 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/vm", - "version": "5.0.0-beta.2", + "version": "5.0.0-rc.1", "description": "An Ethereum VM implementation", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -45,10 +45,10 @@ "dependencies": { "async-eventemitter": "^0.2.4", "core-js-pure": "^3.0.1", - "@ethereumjs/block": "3.0.0-beta.2", - "@ethereumjs/blockchain": "5.0.0-beta.2", - "@ethereumjs/common": "2.0.0-beta.2", - "@ethereumjs/tx": "3.0.0-beta.2", + "@ethereumjs/block": "3.0.0-rc.1", + "@ethereumjs/blockchain": "5.0.0-rc.1", + "@ethereumjs/common": "2.0.0-rc.1", + "@ethereumjs/tx": "3.0.0-rc.1", "ethereumjs-util": "^7.0.7", "functional-red-black-tree": "^1.0.1", "merkle-patricia-tree": "^4.0.0",