diff --git a/packages/block/CHANGELOG.md b/packages/block/CHANGELOG.md index 85374730fe..86afaa6b5d 100644 --- a/packages/block/CHANGELOG.md +++ b/packages/block/CHANGELOG.md @@ -6,7 +6,7 @@ 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 - UNRELEASED +## 3.0.0-beta.1 - 2020-10-22 ### New Package Name @@ -159,6 +159,17 @@ as an input parameter. The HF setting is now automatically taken from the HF set for `Common.DEAULT_HARDFORK`, see PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863). +### Dual ES5 and ES2017 Builds + +We significantly updated our internal tool and CI setup along the work on +PR [#913](https://github.com/ethereumjs/ethereumjs-vm/pull/913) with an update to `ESLint` from `TSLint` +for code linting and formatting and the introduction of a new build setup. + +Packages now target `ES2017` for Node.js builds (the `main` entrypoint from `package.json`) and introduce +a separate `ES5` build distributed along using the `browser` directive as an entrypoint, see +PR [#921](https://github.com/ethereumjs/ethereumjs-vm/pull/921). This will result +in performance benefits for Node.js consumers, see [here](https://github.com/ethereumjs/merkle-patricia-tree/pull/117) for a releated discussion. + ### Other Changes **Features** diff --git a/packages/block/docs/classes/_block_.block.md b/packages/block/docs/classes/_block_.block.md index 6889e556d3..35e8f6bcd3 100644 --- a/packages/block/docs/classes/_block_.block.md +++ b/packages/block/docs/classes/_block_.block.md @@ -2,7 +2,7 @@ # Class: Block -An object that represents the block +An object that represents the block. ## Hierarchy @@ -16,55 +16,70 @@ An object that represents the block ### Properties +* [_common](_block_.block.md#_common) * [header](_block_.block.md#header) * [transactions](_block_.block.md#transactions) * [txTrie](_block_.block.md#txtrie) * [uncleHeaders](_block_.block.md#uncleheaders) -### Accessors - -* [raw](_block_.block.md#raw) - ### Methods +* [canonicalDifficulty](_block_.block.md#canonicaldifficulty) * [genTxTrie](_block_.block.md#gentxtrie) * [hash](_block_.block.md#hash) * [isGenesis](_block_.block.md#isgenesis) +* [raw](_block_.block.md#raw) * [serialize](_block_.block.md#serialize) -* [setGenesisParams](_block_.block.md#setgenesisparams) * [toJSON](_block_.block.md#tojson) * [validate](_block_.block.md#validate) +* [validateDifficulty](_block_.block.md#validatedifficulty) +* [validateGasLimit](_block_.block.md#validategaslimit) * [validateTransactions](_block_.block.md#validatetransactions) * [validateTransactionsTrie](_block_.block.md#validatetransactionstrie) * [validateUncles](_block_.block.md#validateuncles) * [validateUnclesHash](_block_.block.md#validateuncleshash) +* [fromBlockData](_block_.block.md#static-fromblockdata) +* [fromRLPSerializedBlock](_block_.block.md#static-fromrlpserializedblock) +* [fromValuesArray](_block_.block.md#static-fromvaluesarray) +* [genesis](_block_.block.md#static-genesis) ## Constructors ### constructor -\+ **new Block**(`data`: Buffer | [Buffer[], Buffer[], Buffer[]] | [BlockData](../interfaces/_index_.blockdata.md), `chainOptions`: [ChainOptions](../interfaces/_index_.chainoptions.md)): *[Block](_block_.block.md)* +\+ **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:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L17)* +*Defined in [block.ts:82](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L82)* -Creates a new block object +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. **Parameters:** -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`data` | Buffer | [Buffer[], Buffer[], Buffer[]] | [BlockData](../interfaces/_index_.blockdata.md) | {} | The block's data. | -`chainOptions` | [ChainOptions](../interfaces/_index_.chainoptions.md) | {} | The network options for this block, and its header, uncle headers and txs. | +Name | Type | Default | +------ | ------ | ------ | +`header?` | [BlockHeader](_header_.blockheader.md) | - | +`transactions` | Transaction[] | [] | +`uncleHeaders` | [BlockHeader](_header_.blockheader.md)[] | [] | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | **Returns:** *[Block](_block_.block.md)* ## Properties +### _common + +• **_common**: *Common* + +*Defined in [block.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L18)* + +___ + ### header • **header**: *[BlockHeader](_header_.blockheader.md)* -*Defined in [block.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L12)* +*Defined in [block.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L14)* ___ @@ -72,7 +87,7 @@ ___ • **transactions**: *Transaction[]* = [] -*Defined in [block.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L13)* +*Defined in [block.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L15)* ___ @@ -80,7 +95,7 @@ ___ • **txTrie**: *Trie‹›* = new Trie() -*Defined in [block.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L15)* +*Defined in [block.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L17)* ___ @@ -88,28 +103,35 @@ ___ • **uncleHeaders**: *[BlockHeader](_header_.blockheader.md)[]* = [] -*Defined in [block.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L14)* +*Defined in [block.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L16)* -## Accessors +## Methods -### raw +### canonicalDifficulty -• **get raw**(): *[Buffer[], Buffer[], Buffer[]]* +▸ **canonicalDifficulty**(`parentBlock`: [Block](_block_.block.md)): *BN* -*Defined in [block.ts:84](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L84)* +*Defined in [block.ts:245](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L245)* -**Returns:** *[Buffer[], Buffer[], Buffer[]]* +Returns the canonical difficulty for this block. -## Methods +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`parentBlock` | [Block](_block_.block.md) | the parent of this `Block` | + +**Returns:** *BN* + +___ ### genTxTrie ▸ **genTxTrie**(): *Promise‹void›* -*Defined in [block.ts:133](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L133)* +*Defined in [block.ts:137](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L137)* -Generate transaction trie. The tx trie must be generated before the transaction trie can -be validated with `validateTransactionTrie` +Generates transaction trie for validation. **Returns:** *Promise‹void›* @@ -119,9 +141,9 @@ ___ ▸ **hash**(): *Buffer* -*Defined in [block.ts:91](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L91)* +*Defined in [block.ts:116](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L116)* -Produces a hash the RLP of the block +Produces a hash the RLP of the block. **Returns:** *Buffer* @@ -131,97 +153,101 @@ ___ ▸ **isGenesis**(): *boolean* -*Defined in [block.ts:98](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L98)* +*Defined in [block.ts:123](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L123)* -Determines if this block is the genesis block +Determines if this block is the genesis block. **Returns:** *boolean* ___ -### serialize +### raw -▸ **serialize**(): *Buffer* +▸ **raw**(): *[BlockBuffer](../modules/_index_.md#blockbuffer)* -*Defined in [block.ts:116](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L116)* +*Defined in [block.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L105)* -Produces a serialization of the block. + Returns a Buffer Array of the raw Buffers of this block, in order. -**Returns:** *Buffer* +**Returns:** *[BlockBuffer](../modules/_index_.md#blockbuffer)* + +___ -▸ **serialize**(`rlpEncode`: true): *Buffer* +### serialize -*Defined in [block.ts:117](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L117)* +▸ **serialize**(): *Buffer* -**Parameters:** +*Defined in [block.ts:130](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L130)* -Name | Type | ------- | ------ | -`rlpEncode` | true | +Returns the rlp encoding of the block. **Returns:** *Buffer* -▸ **serialize**(`rlpEncode`: false): *[Buffer[], Buffer[], Buffer[]]* +___ + +### toJSON -*Defined in [block.ts:118](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L118)* +▸ **toJSON**(): *[JsonBlock](../interfaces/_index_.jsonblock.md)* -**Parameters:** +*Defined in [block.ts:270](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L270)* -Name | Type | ------- | ------ | -`rlpEncode` | false | +Returns the block in JSON format. -**Returns:** *[Buffer[], Buffer[], Buffer[]]* +**Returns:** *[JsonBlock](../interfaces/_index_.jsonblock.md)* ___ -### setGenesisParams +### validate -▸ **setGenesisParams**(): *void* +▸ **validate**(`blockchain?`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* -*Defined in [block.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L105)* +*Defined in [block.ts:188](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L188)* + +Validates the block, throwing if invalid. -Turns the block into the canonical genesis block +**Parameters:** -**Returns:** *void* +Name | Type | Description | +------ | ------ | ------ | +`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against a @ethereumjs/blockchain | -___ +**Returns:** *Promise‹void›* -### toJSON +___ -▸ **toJSON**(`labeled`: boolean): *any* +### validateDifficulty -*Defined in [block.ts:242](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L242)* +▸ **validateDifficulty**(`parentBlock`: [Block](_block_.block.md)): *boolean* -Returns the block in JSON format +*Defined in [block.ts:254](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L254)* -**`see`** [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties) +Checks that the block's `difficulty` matches the canonical difficulty. **Parameters:** -Name | Type | Default | +Name | Type | Description | ------ | ------ | ------ | -`labeled` | boolean | false | +`parentBlock` | [Block](_block_.block.md) | the parent of this `Block` | -**Returns:** *any* +**Returns:** *boolean* ___ -### validate +### validateGasLimit -▸ **validate**(`blockChain`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* +▸ **validateGasLimit**(`parentBlock`: [Block](_block_.block.md)): *boolean* -*Defined in [block.ts:182](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L182)* +*Defined in [block.ts:263](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L263)* -Validates the entire block, throwing if invalid. +Validates the gasLimit. **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`blockChain` | [Blockchain](../interfaces/_index_.blockchain.md) | the blockchain that this block wants to be part of | +`parentBlock` | [Block](_block_.block.md) | the parent of this `Block` | -**Returns:** *Promise‹void›* +**Returns:** *boolean* ___ @@ -229,15 +255,15 @@ ___ ▸ **validateTransactions**(): *boolean* -*Defined in [block.ts:157](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L157)* +*Defined in [block.ts:167](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L167)* -Validates the transactions +Validates the transactions. **Returns:** *boolean* ▸ **validateTransactions**(`stringError`: false): *boolean* -*Defined in [block.ts:158](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L158)* +*Defined in [block.ts:168](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L168)* **Parameters:** @@ -247,9 +273,9 @@ Name | Type | **Returns:** *boolean* -▸ **validateTransactions**(`stringError`: true): *string* +▸ **validateTransactions**(`stringError`: true): *string[]* -*Defined in [block.ts:159](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L159)* +*Defined in [block.ts:169](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L169)* **Parameters:** @@ -257,35 +283,35 @@ Name | Type | ------ | ------ | `stringError` | true | -**Returns:** *string* +**Returns:** *string[]* ___ ### validateTransactionsTrie -▸ **validateTransactionsTrie**(): *boolean* +▸ **validateTransactionsTrie**(): *Promise‹boolean›* -*Defined in [block.ts:143](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L143)* +*Defined in [block.ts:150](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L150)* -Validates the transaction trie +Validates the transaction trie. -**Returns:** *boolean* +**Returns:** *Promise‹boolean›* ___ ### validateUncles -▸ **validateUncles**(`blockchain`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* +▸ **validateUncles**(`blockchain?`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* -*Defined in [block.ts:217](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L217)* +*Defined in [block.ts:221](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L221)* Validates the uncles that are in the block, if any. This method throws if they are invalid. **Parameters:** -Name | Type | ------- | ------ | -`blockchain` | [Blockchain](../interfaces/_index_.blockchain.md) | +Name | Type | Description | +------ | ------ | ------ | +`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against a @ethereumjs/blockchain | **Returns:** *Promise‹void›* @@ -295,8 +321,78 @@ ___ ▸ **validateUnclesHash**(): *boolean* -*Defined in [block.ts:206](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L206)* +*Defined in [block.ts:211](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L211)* -Validates the uncle's hash +Validates the uncle's hash. **Returns:** *boolean* + +___ + +### `Static` fromBlockData + +▸ **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)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`blockData` | [BlockData](../interfaces/_index_.blockdata.md) | {} | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | + +**Returns:** *[Block](_block_.block.md)‹›* + +___ + +### `Static` fromRLPSerializedBlock + +▸ **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)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`serialized` | Buffer | - | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | + +**Returns:** *[Block](_block_.block.md)‹›* + +___ + +### `Static` fromValuesArray + +▸ **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)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`values` | [BlockBuffer](../modules/_index_.md#blockbuffer) | - | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | + +**Returns:** *[Block](_block_.block.md)‹›* + +___ + +### `Static` genesis + +▸ **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)* + +Alias for Block.fromBlockData() with initWithGenesisHeader set to true. + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`blockData` | [BlockData](../interfaces/_index_.blockdata.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 732b5d0c89..dc5efdad61 100644 --- a/packages/block/docs/classes/_header_.blockheader.md +++ b/packages/block/docs/classes/_header_.blockheader.md @@ -2,7 +2,7 @@ # Class: BlockHeader -An object that represents the block header +An object that represents the block header. ## Hierarchy @@ -16,6 +16,7 @@ An object that represents the block header ### Properties +* [_common](_header_.blockheader.md#_common) * [bloom](_header_.blockheader.md#bloom) * [coinbase](_header_.blockheader.md#coinbase) * [difficulty](_header_.blockheader.md#difficulty) @@ -26,7 +27,6 @@ An object that represents the block header * [nonce](_header_.blockheader.md#nonce) * [number](_header_.blockheader.md#number) * [parentHash](_header_.blockheader.md#parenthash) -* [raw](_header_.blockheader.md#raw) * [receiptTrie](_header_.blockheader.md#receipttrie) * [stateRoot](_header_.blockheader.md#stateroot) * [timestamp](_header_.blockheader.md#timestamp) @@ -35,58 +35,88 @@ An object that represents the block header ### Methods +* [_validateBufferLengths](_header_.blockheader.md#_validatebufferlengths) * [canonicalDifficulty](_header_.blockheader.md#canonicaldifficulty) * [hash](_header_.blockheader.md#hash) * [isGenesis](_header_.blockheader.md#isgenesis) +* [raw](_header_.blockheader.md#raw) * [serialize](_header_.blockheader.md#serialize) -* [setGenesisParams](_header_.blockheader.md#setgenesisparams) * [toJSON](_header_.blockheader.md#tojson) * [validate](_header_.blockheader.md#validate) * [validateDifficulty](_header_.blockheader.md#validatedifficulty) * [validateGasLimit](_header_.blockheader.md#validategaslimit) +* [fromHeaderData](_header_.blockheader.md#static-fromheaderdata) +* [fromRLPSerializedHeader](_header_.blockheader.md#static-fromrlpserializedheader) +* [fromValuesArray](_header_.blockheader.md#static-fromvaluesarray) +* [genesis](_header_.blockheader.md#static-genesis) ## Constructors ### constructor -\+ **new BlockHeader**(`data`: Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [BlockHeaderData](../interfaces/_index_.blockheaderdata.md), `opts`: [ChainOptions](../interfaces/_index_.chainoptions.md)): *[BlockHeader](_header_.blockheader.md)* +\+ **new BlockHeader**(`parentHash`: Buffer, `uncleHash`: Buffer, `coinbase`: Address, `stateRoot`: Buffer, `transactionsTrie`: Buffer, `receiptTrie`: Buffer, `bloom`: Buffer, `difficulty`: BN, `number`: BN, `gasLimit`: BN, `gasUsed`: BN, `timestamp`: BN, `extraData`: Buffer, `mixHash`: Buffer, `nonce`: Buffer, `options`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_header_.blockheader.md)* -*Defined in [header.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L37)* +*Defined in [header.ts:138](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L138)* -Creates a new block header. +This constructor takes the values, validates them, assigns them and freezes the object. +Use the public static factory methods to assist in creating a Header object from +varying data types. +For a default empty header, use `BlockHeader.fromHeaderData()`. **Parameters:** -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`data` | Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [BlockHeaderData](../interfaces/_index_.blockheaderdata.md) | {} | The data of the block header. | -`opts` | [ChainOptions](../interfaces/_index_.chainoptions.md) | {} | The network options for this block, and its header, uncle headers and txs. | +Name | Type | Default | +------ | ------ | ------ | +`parentHash` | Buffer | - | +`uncleHash` | Buffer | - | +`coinbase` | Address | - | +`stateRoot` | Buffer | - | +`transactionsTrie` | Buffer | - | +`receiptTrie` | Buffer | - | +`bloom` | Buffer | - | +`difficulty` | BN | - | +`number` | BN | - | +`gasLimit` | BN | - | +`gasUsed` | BN | - | +`timestamp` | BN | - | +`extraData` | Buffer | - | +`mixHash` | Buffer | - | +`nonce` | Buffer | - | +`options` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | **Returns:** *[BlockHeader](_header_.blockheader.md)* ## Properties +### _common + +• **_common**: *Common* + +*Defined in [header.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L38)* + +___ + ### bloom • **bloom**: *Buffer* -*Defined in [header.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L27)* +*Defined in [header.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L28)* ___ ### coinbase -• **coinbase**: *Buffer* +• **coinbase**: *Address* -*Defined in [header.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L23)* +*Defined in [header.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L24)* ___ ### difficulty -• **difficulty**: *Buffer* +• **difficulty**: *BN* -*Defined in [header.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L28)* +*Defined in [header.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L29)* ___ @@ -94,23 +124,23 @@ ___ • **extraData**: *Buffer* -*Defined in [header.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L33)* +*Defined in [header.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L34)* ___ ### gasLimit -• **gasLimit**: *Buffer* +• **gasLimit**: *BN* -*Defined in [header.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L30)* +*Defined in [header.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L31)* ___ ### gasUsed -• **gasUsed**: *Buffer* +• **gasUsed**: *BN* -*Defined in [header.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L31)* +*Defined in [header.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L32)* ___ @@ -118,7 +148,7 @@ ___ • **mixHash**: *Buffer* -*Defined in [header.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L34)* +*Defined in [header.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L35)* ___ @@ -126,15 +156,15 @@ ___ • **nonce**: *Buffer* -*Defined in [header.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L35)* +*Defined in [header.ts:36](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L36)* ___ ### number -• **number**: *Buffer* +• **number**: *BN* -*Defined in [header.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L29)* +*Defined in [header.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L30)* ___ @@ -142,15 +172,7 @@ ___ • **parentHash**: *Buffer* -*Defined in [header.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L21)* - -___ - -### raw - -• **raw**: *Buffer[]* - -*Defined in [header.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L20)* +*Defined in [header.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L22)* ___ @@ -158,7 +180,7 @@ ___ • **receiptTrie**: *Buffer* -*Defined in [header.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L26)* +*Defined in [header.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L27)* ___ @@ -166,15 +188,15 @@ ___ • **stateRoot**: *Buffer* -*Defined in [header.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L24)* +*Defined in [header.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L25)* ___ ### timestamp -• **timestamp**: *Buffer* +• **timestamp**: *BN* -*Defined in [header.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L32)* +*Defined in [header.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L33)* ___ @@ -182,7 +204,7 @@ ___ • **transactionsTrie**: *Buffer* -*Defined in [header.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L25)* +*Defined in [header.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L26)* ___ @@ -190,15 +212,27 @@ ___ • **uncleHash**: *Buffer* -*Defined in [header.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L22)* +*Defined in [header.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L23)* ## Methods +### _validateBufferLengths + +▸ **_validateBufferLengths**(): *void* + +*Defined in [header.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L232)* + +Validates correct buffer lengths, throws if invalid. + +**Returns:** *void* + +___ + ### canonicalDifficulty -▸ **canonicalDifficulty**(`parentBlock`: [Block](_block_.block.md)): *BN* +▸ **canonicalDifficulty**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *BN* -*Defined in [header.ts:142](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L142)* +*Defined in [header.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L261)* Returns the canonical difficulty for this block. @@ -206,7 +240,7 @@ Returns the canonical difficulty for this block. Name | Type | Description | ------ | ------ | ------ | -`parentBlock` | [Block](_block_.block.md) | the parent `Block` of this header | +`parentBlockHeader` | [BlockHeader](_header_.blockheader.md) | the header from the parent `Block` of this header | **Returns:** *BN* @@ -216,7 +250,7 @@ ___ ▸ **hash**(): *Buffer* -*Defined in [header.ts:303](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L303)* +*Defined in [header.ts:447](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L447)* Returns the hash of the block header. @@ -228,7 +262,7 @@ ___ ▸ **isGenesis**(): *boolean* -*Defined in [header.ts:310](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L310)* +*Defined in [header.ts:454](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L454)* Checks if the block header is a genesis header. @@ -236,63 +270,55 @@ Checks if the block header is a genesis header. ___ -### serialize +### raw -▸ **serialize**(): *Buffer* +▸ **raw**(): *[BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer)* -*Defined in [header.ts:330](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L330)* +*Defined in [header.ts:424](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L424)* -Returns the rlp encoding of the block header +Returns a Buffer Array of the raw Buffers in this header, in order. -**Returns:** *Buffer* +**Returns:** *[BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer)* ___ -### setGenesisParams +### serialize -▸ **setGenesisParams**(): *void* +▸ **serialize**(): *Buffer* -*Defined in [header.ts:317](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L317)* +*Defined in [header.ts:461](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L461)* -Turns the header into the canonical genesis block header. +Returns the rlp encoding of the block header. -**Returns:** *void* +**Returns:** *Buffer* ___ ### toJSON -▸ **toJSON**(`_labels`: boolean): *object | string[]* - -*Defined in [header.ts:340](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L340)* +▸ **toJSON**(): *[JsonHeader](../interfaces/_index_.jsonheader.md)* -Returns the block header in JSON format +*Defined in [header.ts:468](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L468)* -**`see`** [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties) +Returns the block header in JSON format. -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`_labels` | boolean | false | - -**Returns:** *object | string[]* +**Returns:** *[JsonHeader](../interfaces/_index_.jsonheader.md)* ___ ### 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:255](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L255)* +*Defined in [header.ts:378](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L378)* -Validates the entire block header, throwing if invalid. +Validates the block header, throwing if invalid. **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`blockchain` | [Blockchain](../interfaces/_index_.blockchain.md) | the blockchain that this block is validating against | +`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally 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›* @@ -301,9 +327,9 @@ ___ ### validateDifficulty -▸ **validateDifficulty**(`parentBlock`: [Block](_block_.block.md)): *boolean* +▸ **validateDifficulty**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *boolean* -*Defined in [header.ts:221](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L221)* +*Defined in [header.ts:345](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L345)* Checks that the block's `difficulty` matches the canonical difficulty. @@ -311,7 +337,7 @@ Checks that the block's `difficulty` matches the canonical difficulty. Name | Type | Description | ------ | ------ | ------ | -`parentBlock` | [Block](_block_.block.md) | this block's parent | +`parentBlockHeader` | [BlockHeader](_header_.blockheader.md) | the header from the parent `Block` of this header | **Returns:** *boolean* @@ -319,9 +345,9 @@ ___ ### validateGasLimit -▸ **validateGasLimit**(`parentBlock`: [Block](_block_.block.md)): *boolean* +▸ **validateGasLimit**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *boolean* -*Defined in [header.ts:231](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L231)* +*Defined in [header.ts:354](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L354)* Validates the gasLimit. @@ -329,6 +355,76 @@ Validates the gasLimit. Name | Type | Description | ------ | ------ | ------ | -`parentBlock` | [Block](_block_.block.md) | this block's parent | +`parentBlockHeader` | [BlockHeader](_header_.blockheader.md) | the header from the parent `Block` of this header | **Returns:** *boolean* + +___ + +### `Static` fromHeaderData + +▸ **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)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`headerData` | [HeaderData](../interfaces/_index_.headerdata.md) | {} | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | + +**Returns:** *[BlockHeader](_header_.blockheader.md)‹›* + +___ + +### `Static` fromRLPSerializedHeader + +▸ **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)* + +**Parameters:** + +Name | Type | +------ | ------ | +`serialized` | Buffer | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | + +**Returns:** *[BlockHeader](_header_.blockheader.md)‹›* + +___ + +### `Static` fromValuesArray + +▸ **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)* + +**Parameters:** + +Name | Type | +------ | ------ | +`values` | [BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer) | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | + +**Returns:** *[BlockHeader](_header_.blockheader.md)‹›* + +___ + +### `Static` genesis + +▸ **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)* + +Alias for Header.fromHeaderData() with initWithGenesisHeader set to true. + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`headerData` | [HeaderData](../interfaces/_index_.headerdata.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 3e84df70bf..3d62d9e752 100644 --- a/packages/block/docs/classes/_index_.block.md +++ b/packages/block/docs/classes/_index_.block.md @@ -2,7 +2,7 @@ # Class: Block -An object that represents the block +An object that represents the block. ## Hierarchy @@ -16,55 +16,70 @@ An object that represents the block ### Properties +* [_common](_index_.block.md#_common) * [header](_index_.block.md#header) * [transactions](_index_.block.md#transactions) * [txTrie](_index_.block.md#txtrie) * [uncleHeaders](_index_.block.md#uncleheaders) -### Accessors - -* [raw](_index_.block.md#raw) - ### Methods +* [canonicalDifficulty](_index_.block.md#canonicaldifficulty) * [genTxTrie](_index_.block.md#gentxtrie) * [hash](_index_.block.md#hash) * [isGenesis](_index_.block.md#isgenesis) +* [raw](_index_.block.md#raw) * [serialize](_index_.block.md#serialize) -* [setGenesisParams](_index_.block.md#setgenesisparams) * [toJSON](_index_.block.md#tojson) * [validate](_index_.block.md#validate) +* [validateDifficulty](_index_.block.md#validatedifficulty) +* [validateGasLimit](_index_.block.md#validategaslimit) * [validateTransactions](_index_.block.md#validatetransactions) * [validateTransactionsTrie](_index_.block.md#validatetransactionstrie) * [validateUncles](_index_.block.md#validateuncles) * [validateUnclesHash](_index_.block.md#validateuncleshash) +* [fromBlockData](_index_.block.md#static-fromblockdata) +* [fromRLPSerializedBlock](_index_.block.md#static-fromrlpserializedblock) +* [fromValuesArray](_index_.block.md#static-fromvaluesarray) +* [genesis](_index_.block.md#static-genesis) ## Constructors ### constructor -\+ **new Block**(`data`: Buffer | [Buffer[], Buffer[], Buffer[]] | [BlockData](../interfaces/_index_.blockdata.md), `chainOptions`: [ChainOptions](../interfaces/_index_.chainoptions.md)): *[Block](_index_.block.md)* +\+ **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:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L17)* +*Defined in [block.ts:82](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L82)* -Creates a new block object +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. **Parameters:** -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`data` | Buffer | [Buffer[], Buffer[], Buffer[]] | [BlockData](../interfaces/_index_.blockdata.md) | {} | The block's data. | -`chainOptions` | [ChainOptions](../interfaces/_index_.chainoptions.md) | {} | The network options for this block, and its header, uncle headers and txs. | +Name | Type | Default | +------ | ------ | ------ | +`header?` | [BlockHeader](_index_.blockheader.md) | - | +`transactions` | Transaction[] | [] | +`uncleHeaders` | [BlockHeader](_header_.blockheader.md)[] | [] | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | **Returns:** *[Block](_index_.block.md)* ## Properties +### _common + +• **_common**: *Common* + +*Defined in [block.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L18)* + +___ + ### header • **header**: *[BlockHeader](_header_.blockheader.md)* -*Defined in [block.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L12)* +*Defined in [block.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L14)* ___ @@ -72,7 +87,7 @@ ___ • **transactions**: *Transaction[]* = [] -*Defined in [block.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L13)* +*Defined in [block.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L15)* ___ @@ -80,7 +95,7 @@ ___ • **txTrie**: *Trie‹›* = new Trie() -*Defined in [block.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L15)* +*Defined in [block.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L17)* ___ @@ -88,28 +103,35 @@ ___ • **uncleHeaders**: *[BlockHeader](_header_.blockheader.md)[]* = [] -*Defined in [block.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L14)* +*Defined in [block.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L16)* -## Accessors +## Methods -### raw +### canonicalDifficulty -• **get raw**(): *[Buffer[], Buffer[], Buffer[]]* +▸ **canonicalDifficulty**(`parentBlock`: [Block](_block_.block.md)): *BN* -*Defined in [block.ts:84](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L84)* +*Defined in [block.ts:245](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L245)* -**Returns:** *[Buffer[], Buffer[], Buffer[]]* +Returns the canonical difficulty for this block. -## Methods +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`parentBlock` | [Block](_block_.block.md) | the parent of this `Block` | + +**Returns:** *BN* + +___ ### genTxTrie ▸ **genTxTrie**(): *Promise‹void›* -*Defined in [block.ts:133](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L133)* +*Defined in [block.ts:137](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L137)* -Generate transaction trie. The tx trie must be generated before the transaction trie can -be validated with `validateTransactionTrie` +Generates transaction trie for validation. **Returns:** *Promise‹void›* @@ -119,9 +141,9 @@ ___ ▸ **hash**(): *Buffer* -*Defined in [block.ts:91](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L91)* +*Defined in [block.ts:116](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L116)* -Produces a hash the RLP of the block +Produces a hash the RLP of the block. **Returns:** *Buffer* @@ -131,97 +153,101 @@ ___ ▸ **isGenesis**(): *boolean* -*Defined in [block.ts:98](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L98)* +*Defined in [block.ts:123](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L123)* -Determines if this block is the genesis block +Determines if this block is the genesis block. **Returns:** *boolean* ___ -### serialize +### raw -▸ **serialize**(): *Buffer* +▸ **raw**(): *[BlockBuffer](../modules/_index_.md#blockbuffer)* -*Defined in [block.ts:116](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L116)* +*Defined in [block.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L105)* -Produces a serialization of the block. + Returns a Buffer Array of the raw Buffers of this block, in order. -**Returns:** *Buffer* +**Returns:** *[BlockBuffer](../modules/_index_.md#blockbuffer)* + +___ -▸ **serialize**(`rlpEncode`: true): *Buffer* +### serialize -*Defined in [block.ts:117](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L117)* +▸ **serialize**(): *Buffer* -**Parameters:** +*Defined in [block.ts:130](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L130)* -Name | Type | ------- | ------ | -`rlpEncode` | true | +Returns the rlp encoding of the block. **Returns:** *Buffer* -▸ **serialize**(`rlpEncode`: false): *[Buffer[], Buffer[], Buffer[]]* +___ + +### toJSON -*Defined in [block.ts:118](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L118)* +▸ **toJSON**(): *[JsonBlock](../interfaces/_index_.jsonblock.md)* -**Parameters:** +*Defined in [block.ts:270](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L270)* -Name | Type | ------- | ------ | -`rlpEncode` | false | +Returns the block in JSON format. -**Returns:** *[Buffer[], Buffer[], Buffer[]]* +**Returns:** *[JsonBlock](../interfaces/_index_.jsonblock.md)* ___ -### setGenesisParams +### validate -▸ **setGenesisParams**(): *void* +▸ **validate**(`blockchain?`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* -*Defined in [block.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L105)* +*Defined in [block.ts:188](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L188)* + +Validates the block, throwing if invalid. -Turns the block into the canonical genesis block +**Parameters:** -**Returns:** *void* +Name | Type | Description | +------ | ------ | ------ | +`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against a @ethereumjs/blockchain | -___ +**Returns:** *Promise‹void›* -### toJSON +___ -▸ **toJSON**(`labeled`: boolean): *any* +### validateDifficulty -*Defined in [block.ts:242](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L242)* +▸ **validateDifficulty**(`parentBlock`: [Block](_block_.block.md)): *boolean* -Returns the block in JSON format +*Defined in [block.ts:254](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L254)* -**`see`** [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties) +Checks that the block's `difficulty` matches the canonical difficulty. **Parameters:** -Name | Type | Default | +Name | Type | Description | ------ | ------ | ------ | -`labeled` | boolean | false | +`parentBlock` | [Block](_block_.block.md) | the parent of this `Block` | -**Returns:** *any* +**Returns:** *boolean* ___ -### validate +### validateGasLimit -▸ **validate**(`blockChain`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* +▸ **validateGasLimit**(`parentBlock`: [Block](_block_.block.md)): *boolean* -*Defined in [block.ts:182](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L182)* +*Defined in [block.ts:263](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L263)* -Validates the entire block, throwing if invalid. +Validates the gasLimit. **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`blockChain` | [Blockchain](../interfaces/_index_.blockchain.md) | the blockchain that this block wants to be part of | +`parentBlock` | [Block](_block_.block.md) | the parent of this `Block` | -**Returns:** *Promise‹void›* +**Returns:** *boolean* ___ @@ -229,15 +255,15 @@ ___ ▸ **validateTransactions**(): *boolean* -*Defined in [block.ts:157](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L157)* +*Defined in [block.ts:167](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L167)* -Validates the transactions +Validates the transactions. **Returns:** *boolean* ▸ **validateTransactions**(`stringError`: false): *boolean* -*Defined in [block.ts:158](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L158)* +*Defined in [block.ts:168](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L168)* **Parameters:** @@ -247,9 +273,9 @@ Name | Type | **Returns:** *boolean* -▸ **validateTransactions**(`stringError`: true): *string* +▸ **validateTransactions**(`stringError`: true): *string[]* -*Defined in [block.ts:159](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L159)* +*Defined in [block.ts:169](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L169)* **Parameters:** @@ -257,35 +283,35 @@ Name | Type | ------ | ------ | `stringError` | true | -**Returns:** *string* +**Returns:** *string[]* ___ ### validateTransactionsTrie -▸ **validateTransactionsTrie**(): *boolean* +▸ **validateTransactionsTrie**(): *Promise‹boolean›* -*Defined in [block.ts:143](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L143)* +*Defined in [block.ts:150](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L150)* -Validates the transaction trie +Validates the transaction trie. -**Returns:** *boolean* +**Returns:** *Promise‹boolean›* ___ ### validateUncles -▸ **validateUncles**(`blockchain`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* +▸ **validateUncles**(`blockchain?`: [Blockchain](../interfaces/_index_.blockchain.md)): *Promise‹void›* -*Defined in [block.ts:217](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L217)* +*Defined in [block.ts:221](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L221)* Validates the uncles that are in the block, if any. This method throws if they are invalid. **Parameters:** -Name | Type | ------- | ------ | -`blockchain` | [Blockchain](../interfaces/_index_.blockchain.md) | +Name | Type | Description | +------ | ------ | ------ | +`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally validate against a @ethereumjs/blockchain | **Returns:** *Promise‹void›* @@ -295,8 +321,78 @@ ___ ▸ **validateUnclesHash**(): *boolean* -*Defined in [block.ts:206](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L206)* +*Defined in [block.ts:211](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/block.ts#L211)* -Validates the uncle's hash +Validates the uncle's hash. **Returns:** *boolean* + +___ + +### `Static` fromBlockData + +▸ **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)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`blockData` | [BlockData](../interfaces/_index_.blockdata.md) | {} | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | + +**Returns:** *[Block](_block_.block.md)‹›* + +___ + +### `Static` fromRLPSerializedBlock + +▸ **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)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`serialized` | Buffer | - | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | + +**Returns:** *[Block](_block_.block.md)‹›* + +___ + +### `Static` fromValuesArray + +▸ **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)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`values` | [BlockBuffer](../modules/_index_.md#blockbuffer) | - | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | + +**Returns:** *[Block](_block_.block.md)‹›* + +___ + +### `Static` genesis + +▸ **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)* + +Alias for Block.fromBlockData() with initWithGenesisHeader set to true. + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`blockData` | [BlockData](../interfaces/_index_.blockdata.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 123b0274c5..78c2f415cd 100644 --- a/packages/block/docs/classes/_index_.blockheader.md +++ b/packages/block/docs/classes/_index_.blockheader.md @@ -2,7 +2,7 @@ # Class: BlockHeader -An object that represents the block header +An object that represents the block header. ## Hierarchy @@ -16,6 +16,7 @@ An object that represents the block header ### Properties +* [_common](_index_.blockheader.md#_common) * [bloom](_index_.blockheader.md#bloom) * [coinbase](_index_.blockheader.md#coinbase) * [difficulty](_index_.blockheader.md#difficulty) @@ -26,7 +27,6 @@ An object that represents the block header * [nonce](_index_.blockheader.md#nonce) * [number](_index_.blockheader.md#number) * [parentHash](_index_.blockheader.md#parenthash) -* [raw](_index_.blockheader.md#raw) * [receiptTrie](_index_.blockheader.md#receipttrie) * [stateRoot](_index_.blockheader.md#stateroot) * [timestamp](_index_.blockheader.md#timestamp) @@ -35,58 +35,88 @@ An object that represents the block header ### Methods +* [_validateBufferLengths](_index_.blockheader.md#_validatebufferlengths) * [canonicalDifficulty](_index_.blockheader.md#canonicaldifficulty) * [hash](_index_.blockheader.md#hash) * [isGenesis](_index_.blockheader.md#isgenesis) +* [raw](_index_.blockheader.md#raw) * [serialize](_index_.blockheader.md#serialize) -* [setGenesisParams](_index_.blockheader.md#setgenesisparams) * [toJSON](_index_.blockheader.md#tojson) * [validate](_index_.blockheader.md#validate) * [validateDifficulty](_index_.blockheader.md#validatedifficulty) * [validateGasLimit](_index_.blockheader.md#validategaslimit) +* [fromHeaderData](_index_.blockheader.md#static-fromheaderdata) +* [fromRLPSerializedHeader](_index_.blockheader.md#static-fromrlpserializedheader) +* [fromValuesArray](_index_.blockheader.md#static-fromvaluesarray) +* [genesis](_index_.blockheader.md#static-genesis) ## Constructors ### constructor -\+ **new BlockHeader**(`data`: Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [BlockHeaderData](../interfaces/_index_.blockheaderdata.md), `opts`: [ChainOptions](../interfaces/_index_.chainoptions.md)): *[BlockHeader](_index_.blockheader.md)* +\+ **new BlockHeader**(`parentHash`: Buffer, `uncleHash`: Buffer, `coinbase`: Address, `stateRoot`: Buffer, `transactionsTrie`: Buffer, `receiptTrie`: Buffer, `bloom`: Buffer, `difficulty`: BN, `number`: BN, `gasLimit`: BN, `gasUsed`: BN, `timestamp`: BN, `extraData`: Buffer, `mixHash`: Buffer, `nonce`: Buffer, `options`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](_index_.blockheader.md)* -*Defined in [header.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L37)* +*Defined in [header.ts:138](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L138)* -Creates a new block header. +This constructor takes the values, validates them, assigns them and freezes the object. +Use the public static factory methods to assist in creating a Header object from +varying data types. +For a default empty header, use `BlockHeader.fromHeaderData()`. **Parameters:** -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`data` | Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [BlockHeaderData](../interfaces/_index_.blockheaderdata.md) | {} | The data of the block header. | -`opts` | [ChainOptions](../interfaces/_index_.chainoptions.md) | {} | The network options for this block, and its header, uncle headers and txs. | +Name | Type | Default | +------ | ------ | ------ | +`parentHash` | Buffer | - | +`uncleHash` | Buffer | - | +`coinbase` | Address | - | +`stateRoot` | Buffer | - | +`transactionsTrie` | Buffer | - | +`receiptTrie` | Buffer | - | +`bloom` | Buffer | - | +`difficulty` | BN | - | +`number` | BN | - | +`gasLimit` | BN | - | +`gasUsed` | BN | - | +`timestamp` | BN | - | +`extraData` | Buffer | - | +`mixHash` | Buffer | - | +`nonce` | Buffer | - | +`options` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | **Returns:** *[BlockHeader](_index_.blockheader.md)* ## Properties +### _common + +• **_common**: *Common* + +*Defined in [header.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L38)* + +___ + ### bloom • **bloom**: *Buffer* -*Defined in [header.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L27)* +*Defined in [header.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L28)* ___ ### coinbase -• **coinbase**: *Buffer* +• **coinbase**: *Address* -*Defined in [header.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L23)* +*Defined in [header.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L24)* ___ ### difficulty -• **difficulty**: *Buffer* +• **difficulty**: *BN* -*Defined in [header.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L28)* +*Defined in [header.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L29)* ___ @@ -94,23 +124,23 @@ ___ • **extraData**: *Buffer* -*Defined in [header.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L33)* +*Defined in [header.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L34)* ___ ### gasLimit -• **gasLimit**: *Buffer* +• **gasLimit**: *BN* -*Defined in [header.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L30)* +*Defined in [header.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L31)* ___ ### gasUsed -• **gasUsed**: *Buffer* +• **gasUsed**: *BN* -*Defined in [header.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L31)* +*Defined in [header.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L32)* ___ @@ -118,7 +148,7 @@ ___ • **mixHash**: *Buffer* -*Defined in [header.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L34)* +*Defined in [header.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L35)* ___ @@ -126,15 +156,15 @@ ___ • **nonce**: *Buffer* -*Defined in [header.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L35)* +*Defined in [header.ts:36](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L36)* ___ ### number -• **number**: *Buffer* +• **number**: *BN* -*Defined in [header.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L29)* +*Defined in [header.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L30)* ___ @@ -142,15 +172,7 @@ ___ • **parentHash**: *Buffer* -*Defined in [header.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L21)* - -___ - -### raw - -• **raw**: *Buffer[]* - -*Defined in [header.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L20)* +*Defined in [header.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L22)* ___ @@ -158,7 +180,7 @@ ___ • **receiptTrie**: *Buffer* -*Defined in [header.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L26)* +*Defined in [header.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L27)* ___ @@ -166,15 +188,15 @@ ___ • **stateRoot**: *Buffer* -*Defined in [header.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L24)* +*Defined in [header.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L25)* ___ ### timestamp -• **timestamp**: *Buffer* +• **timestamp**: *BN* -*Defined in [header.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L32)* +*Defined in [header.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L33)* ___ @@ -182,7 +204,7 @@ ___ • **transactionsTrie**: *Buffer* -*Defined in [header.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L25)* +*Defined in [header.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L26)* ___ @@ -190,15 +212,27 @@ ___ • **uncleHash**: *Buffer* -*Defined in [header.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L22)* +*Defined in [header.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L23)* ## Methods +### _validateBufferLengths + +▸ **_validateBufferLengths**(): *void* + +*Defined in [header.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L232)* + +Validates correct buffer lengths, throws if invalid. + +**Returns:** *void* + +___ + ### canonicalDifficulty -▸ **canonicalDifficulty**(`parentBlock`: [Block](_block_.block.md)): *BN* +▸ **canonicalDifficulty**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *BN* -*Defined in [header.ts:142](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L142)* +*Defined in [header.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L261)* Returns the canonical difficulty for this block. @@ -206,7 +240,7 @@ Returns the canonical difficulty for this block. Name | Type | Description | ------ | ------ | ------ | -`parentBlock` | [Block](_block_.block.md) | the parent `Block` of this header | +`parentBlockHeader` | [BlockHeader](_header_.blockheader.md) | the header from the parent `Block` of this header | **Returns:** *BN* @@ -216,7 +250,7 @@ ___ ▸ **hash**(): *Buffer* -*Defined in [header.ts:303](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L303)* +*Defined in [header.ts:447](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L447)* Returns the hash of the block header. @@ -228,7 +262,7 @@ ___ ▸ **isGenesis**(): *boolean* -*Defined in [header.ts:310](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L310)* +*Defined in [header.ts:454](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L454)* Checks if the block header is a genesis header. @@ -236,63 +270,55 @@ Checks if the block header is a genesis header. ___ -### serialize +### raw -▸ **serialize**(): *Buffer* +▸ **raw**(): *[BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer)* -*Defined in [header.ts:330](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L330)* +*Defined in [header.ts:424](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L424)* -Returns the rlp encoding of the block header +Returns a Buffer Array of the raw Buffers in this header, in order. -**Returns:** *Buffer* +**Returns:** *[BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer)* ___ -### setGenesisParams +### serialize -▸ **setGenesisParams**(): *void* +▸ **serialize**(): *Buffer* -*Defined in [header.ts:317](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L317)* +*Defined in [header.ts:461](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L461)* -Turns the header into the canonical genesis block header. +Returns the rlp encoding of the block header. -**Returns:** *void* +**Returns:** *Buffer* ___ ### toJSON -▸ **toJSON**(`_labels`: boolean): *object | string[]* - -*Defined in [header.ts:340](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L340)* +▸ **toJSON**(): *[JsonHeader](../interfaces/_index_.jsonheader.md)* -Returns the block header in JSON format +*Defined in [header.ts:468](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L468)* -**`see`** [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties) +Returns the block header in JSON format. -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`_labels` | boolean | false | - -**Returns:** *object | string[]* +**Returns:** *[JsonHeader](../interfaces/_index_.jsonheader.md)* ___ ### 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:255](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L255)* +*Defined in [header.ts:378](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L378)* -Validates the entire block header, throwing if invalid. +Validates the block header, throwing if invalid. **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`blockchain` | [Blockchain](../interfaces/_index_.blockchain.md) | the blockchain that this block is validating against | +`blockchain?` | [Blockchain](../interfaces/_index_.blockchain.md) | additionally 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›* @@ -301,9 +327,9 @@ ___ ### validateDifficulty -▸ **validateDifficulty**(`parentBlock`: [Block](_block_.block.md)): *boolean* +▸ **validateDifficulty**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *boolean* -*Defined in [header.ts:221](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L221)* +*Defined in [header.ts:345](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L345)* Checks that the block's `difficulty` matches the canonical difficulty. @@ -311,7 +337,7 @@ Checks that the block's `difficulty` matches the canonical difficulty. Name | Type | Description | ------ | ------ | ------ | -`parentBlock` | [Block](_block_.block.md) | this block's parent | +`parentBlockHeader` | [BlockHeader](_header_.blockheader.md) | the header from the parent `Block` of this header | **Returns:** *boolean* @@ -319,9 +345,9 @@ ___ ### validateGasLimit -▸ **validateGasLimit**(`parentBlock`: [Block](_block_.block.md)): *boolean* +▸ **validateGasLimit**(`parentBlockHeader`: [BlockHeader](_header_.blockheader.md)): *boolean* -*Defined in [header.ts:231](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L231)* +*Defined in [header.ts:354](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header.ts#L354)* Validates the gasLimit. @@ -329,6 +355,76 @@ Validates the gasLimit. Name | Type | Description | ------ | ------ | ------ | -`parentBlock` | [Block](_block_.block.md) | this block's parent | +`parentBlockHeader` | [BlockHeader](_header_.blockheader.md) | the header from the parent `Block` of this header | **Returns:** *boolean* + +___ + +### `Static` fromHeaderData + +▸ **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)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`headerData` | [HeaderData](../interfaces/_index_.headerdata.md) | {} | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | {} | + +**Returns:** *[BlockHeader](_header_.blockheader.md)‹›* + +___ + +### `Static` fromRLPSerializedHeader + +▸ **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)* + +**Parameters:** + +Name | Type | +------ | ------ | +`serialized` | Buffer | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | + +**Returns:** *[BlockHeader](_header_.blockheader.md)‹›* + +___ + +### `Static` fromValuesArray + +▸ **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)* + +**Parameters:** + +Name | Type | +------ | ------ | +`values` | [BlockHeaderBuffer](../modules/_index_.md#blockheaderbuffer) | +`opts` | [BlockOptions](../interfaces/_index_.blockoptions.md) | + +**Returns:** *[BlockHeader](_header_.blockheader.md)‹›* + +___ + +### `Static` genesis + +▸ **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)* + +Alias for Header.fromHeaderData() with initWithGenesisHeader set to true. + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`headerData` | [HeaderData](../interfaces/_index_.headerdata.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 ec3bca79ea..628f5e4b62 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:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L75)* +*Defined in [types.ts:113](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L113)* **Parameters:** diff --git a/packages/block/docs/interfaces/_index_.blockdata.md b/packages/block/docs/interfaces/_index_.blockdata.md index b832fbc127..c9131d8c0b 100644 --- a/packages/block/docs/interfaces/_index_.blockdata.md +++ b/packages/block/docs/interfaces/_index_.blockdata.md @@ -20,22 +20,24 @@ A block's data. ### `Optional` header -• **header**? : *Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [BlockHeaderData](_index_.blockheaderdata.md)* +• **header**? : *[HeaderData](_index_.headerdata.md)* -*Defined in [types.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L69)* +*Defined in [types.ts:68](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L68)* + +Header data for the block ___ ### `Optional` transactions -• **transactions**? : *Array‹Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | TxData›* +• **transactions**? : *Array‹TxData›* -*Defined in [types.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L70)* +*Defined in [types.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L69)* ___ ### `Optional` uncleHeaders -• **uncleHeaders**? : *Array‹Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [BlockHeaderData](_index_.blockheaderdata.md)›* +• **uncleHeaders**? : *Array‹[HeaderData](_index_.headerdata.md)›* -*Defined in [types.ts:71](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L71)* +*Defined in [types.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L70)* diff --git a/packages/block/docs/interfaces/_index_.blockheaderdata.md b/packages/block/docs/interfaces/_index_.blockheaderdata.md deleted file mode 100644 index c5c3b684cf..0000000000 --- a/packages/block/docs/interfaces/_index_.blockheaderdata.md +++ /dev/null @@ -1,149 +0,0 @@ -[@ethereumjs/block](../README.md) › ["index"](../modules/_index_.md) › [BlockHeaderData](_index_.blockheaderdata.md) - -# Interface: BlockHeaderData - -A block header's data. - -## Hierarchy - -* **BlockHeaderData** - -## Index - -### Properties - -* [bloom](_index_.blockheaderdata.md#optional-bloom) -* [coinbase](_index_.blockheaderdata.md#optional-coinbase) -* [difficulty](_index_.blockheaderdata.md#optional-difficulty) -* [extraData](_index_.blockheaderdata.md#optional-extradata) -* [gasLimit](_index_.blockheaderdata.md#optional-gaslimit) -* [gasUsed](_index_.blockheaderdata.md#optional-gasused) -* [mixHash](_index_.blockheaderdata.md#optional-mixhash) -* [nonce](_index_.blockheaderdata.md#optional-nonce) -* [number](_index_.blockheaderdata.md#optional-number) -* [parentHash](_index_.blockheaderdata.md#optional-parenthash) -* [receiptTrie](_index_.blockheaderdata.md#optional-receipttrie) -* [stateRoot](_index_.blockheaderdata.md#optional-stateroot) -* [timestamp](_index_.blockheaderdata.md#optional-timestamp) -* [transactionsTrie](_index_.blockheaderdata.md#optional-transactionstrie) -* [uncleHash](_index_.blockheaderdata.md#optional-unclehash) - -## Properties - -### `Optional` bloom - -• **bloom**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L54)* - -___ - -### `Optional` coinbase - -• **coinbase**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L50)* - -___ - -### `Optional` difficulty - -• **difficulty**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L55)* - -___ - -### `Optional` extraData - -• **extraData**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L60)* - -___ - -### `Optional` gasLimit - -• **gasLimit**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L57)* - -___ - -### `Optional` gasUsed - -• **gasUsed**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L58)* - -___ - -### `Optional` mixHash - -• **mixHash**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L61)* - -___ - -### `Optional` nonce - -• **nonce**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:62](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L62)* - -___ - -### `Optional` number - -• **number**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L56)* - -___ - -### `Optional` parentHash - -• **parentHash**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L48)* - -___ - -### `Optional` receiptTrie - -• **receiptTrie**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L53)* - -___ - -### `Optional` stateRoot - -• **stateRoot**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:51](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L51)* - -___ - -### `Optional` timestamp - -• **timestamp**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L59)* - -___ - -### `Optional` transactionsTrie - -• **transactionsTrie**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L52)* - -___ - -### `Optional` uncleHash - -• **uncleHash**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:49](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L49)* diff --git a/packages/block/docs/interfaces/_index_.blockoptions.md b/packages/block/docs/interfaces/_index_.blockoptions.md new file mode 100644 index 0000000000..92ca5225c0 --- /dev/null +++ b/packages/block/docs/interfaces/_index_.blockoptions.md @@ -0,0 +1,63 @@ +[@ethereumjs/block](../README.md) › ["index"](../modules/_index_.md) › [BlockOptions](_index_.blockoptions.md) + +# Interface: BlockOptions + +An object to set to which blockchain the blocks and their headers belong. This could be specified +using a Common object, or `chain` and `hardfork`. Defaults to mainnet without specifying a +hardfork. + +## Hierarchy + +* **BlockOptions** + +## Index + +### Properties + +* [common](_index_.blockoptions.md#optional-common) +* [hardforkByBlockNumber](_index_.blockoptions.md#optional-hardforkbyblocknumber) +* [initWithGenesisHeader](_index_.blockoptions.md#optional-initwithgenesisheader) + +## Properties + +### `Optional` common + +• **common**? : *Common* + +*Defined in [types.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L20)* + +A Common object defining the chain and the hardfork a block/block header belongs to. + +Default: `Common` object set to `mainnet` and the HF currently defined as the default +hardfork in the `Common` class. + +Current default hardfork: `istanbul` + +___ + +### `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)* + +Determine the HF by the block number + +Default: `false` (HF is set to whatever default HF is set by the Common instance) + +___ + +### `Optional` initWithGenesisHeader + +• **initWithGenesisHeader**? : *undefined | false | true* + +*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L37)* + +Turns the block header into the canonical genesis block header + +If set to `true` all other header data is ignored. + +If a Common instance is passed the instance need to be set to `chainstart` as a HF, +otherwise usage of this option will throw + +Default: `false` diff --git a/packages/block/docs/interfaces/_index_.chainoptions.md b/packages/block/docs/interfaces/_index_.chainoptions.md deleted file mode 100644 index c45fafa983..0000000000 --- a/packages/block/docs/interfaces/_index_.chainoptions.md +++ /dev/null @@ -1,49 +0,0 @@ -[@ethereumjs/block](../README.md) › ["index"](../modules/_index_.md) › [ChainOptions](_index_.chainoptions.md) - -# Interface: ChainOptions - -An object to set to which blockchain the blocks and their headers belong. This could be specified -using a Common object, or `chain` and `hardfork`. Defaults to mainnet without specifying a -hardfork. - -## Hierarchy - -* **ChainOptions** - -## Index - -### Properties - -* [chain](_index_.chainoptions.md#optional-chain) -* [common](_index_.chainoptions.md#optional-common) -* [hardfork](_index_.chainoptions.md#optional-hardfork) - -## Properties - -### `Optional` chain - -• **chain**? : *number | string* - -*Defined in [types.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L19)* - -The chain of the block/block header, default: 'mainnet' - -___ - -### `Optional` common - -• **common**? : *Common* - -*Defined in [types.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L14)* - -A Common object defining the chain and the hardfork a block/block header belongs to. - -___ - -### `Optional` hardfork - -• **hardfork**? : *undefined | string* - -*Defined in [types.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L24)* - -The hardfork of the block/block header, default: 'petersburg' diff --git a/packages/block/docs/interfaces/_index_.headerdata.md b/packages/block/docs/interfaces/_index_.headerdata.md new file mode 100644 index 0000000000..9bd3a2badf --- /dev/null +++ b/packages/block/docs/interfaces/_index_.headerdata.md @@ -0,0 +1,149 @@ +[@ethereumjs/block](../README.md) › ["index"](../modules/_index_.md) › [HeaderData](_index_.headerdata.md) + +# Interface: HeaderData + +A block header's data. + +## Hierarchy + +* **HeaderData** + +## Index + +### Properties + +* [bloom](_index_.headerdata.md#optional-bloom) +* [coinbase](_index_.headerdata.md#optional-coinbase) +* [difficulty](_index_.headerdata.md#optional-difficulty) +* [extraData](_index_.headerdata.md#optional-extradata) +* [gasLimit](_index_.headerdata.md#optional-gaslimit) +* [gasUsed](_index_.headerdata.md#optional-gasused) +* [mixHash](_index_.headerdata.md#optional-mixhash) +* [nonce](_index_.headerdata.md#optional-nonce) +* [number](_index_.headerdata.md#optional-number) +* [parentHash](_index_.headerdata.md#optional-parenthash) +* [receiptTrie](_index_.headerdata.md#optional-receipttrie) +* [stateRoot](_index_.headerdata.md#optional-stateroot) +* [timestamp](_index_.headerdata.md#optional-timestamp) +* [transactionsTrie](_index_.headerdata.md#optional-transactionstrie) +* [uncleHash](_index_.headerdata.md#optional-unclehash) + +## Properties + +### `Optional` bloom + +• **bloom**? : *BufferLike* + +*Defined in [types.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L50)* + +___ + +### `Optional` coinbase + +• **coinbase**? : *AddressLike* + +*Defined in [types.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L46)* + +___ + +### `Optional` difficulty + +• **difficulty**? : *BNLike* + +*Defined in [types.ts:51](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L51)* + +___ + +### `Optional` extraData + +• **extraData**? : *BufferLike* + +*Defined in [types.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L56)* + +___ + +### `Optional` gasLimit + +• **gasLimit**? : *BNLike* + +*Defined in [types.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L53)* + +___ + +### `Optional` gasUsed + +• **gasUsed**? : *BNLike* + +*Defined in [types.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L54)* + +___ + +### `Optional` mixHash + +• **mixHash**? : *BufferLike* + +*Defined in [types.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L57)* + +___ + +### `Optional` nonce + +• **nonce**? : *BufferLike* + +*Defined in [types.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L58)* + +___ + +### `Optional` number + +• **number**? : *BNLike* + +*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L52)* + +___ + +### `Optional` parentHash + +• **parentHash**? : *BufferLike* + +*Defined in [types.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L44)* + +___ + +### `Optional` receiptTrie + +• **receiptTrie**? : *BufferLike* + +*Defined in [types.ts:49](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L49)* + +___ + +### `Optional` stateRoot + +• **stateRoot**? : *BufferLike* + +*Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L47)* + +___ + +### `Optional` timestamp + +• **timestamp**? : *BNLike* + +*Defined in [types.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L55)* + +___ + +### `Optional` transactionsTrie + +• **transactionsTrie**? : *BufferLike* + +*Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L48)* + +___ + +### `Optional` uncleHash + +• **uncleHash**? : *BufferLike* + +*Defined in [types.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L45)* diff --git a/packages/block/docs/interfaces/_index_.jsonblock.md b/packages/block/docs/interfaces/_index_.jsonblock.md new file mode 100644 index 0000000000..679fe54337 --- /dev/null +++ b/packages/block/docs/interfaces/_index_.jsonblock.md @@ -0,0 +1,43 @@ +[@ethereumjs/block](../README.md) › ["index"](../modules/_index_.md) › [JsonBlock](_index_.jsonblock.md) + +# Interface: JsonBlock + +An object with the block's data represented as strings. + +## Hierarchy + +* **JsonBlock** + +## Index + +### Properties + +* [header](_index_.jsonblock.md#optional-header) +* [transactions](_index_.jsonblock.md#optional-transactions) +* [uncleHeaders](_index_.jsonblock.md#optional-uncleheaders) + +## Properties + +### `Optional` header + +• **header**? : *[JsonHeader](_index_.jsonheader.md)* + +*Defined in [types.ts:86](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L86)* + +Header data for the block + +___ + +### `Optional` transactions + +• **transactions**? : *JsonTx[]* + +*Defined in [types.ts:87](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L87)* + +___ + +### `Optional` uncleHeaders + +• **uncleHeaders**? : *[JsonHeader](_index_.jsonheader.md)[]* + +*Defined in [types.ts:88](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L88)* diff --git a/packages/block/docs/interfaces/_index_.jsonheader.md b/packages/block/docs/interfaces/_index_.jsonheader.md new file mode 100644 index 0000000000..cb847d92b3 --- /dev/null +++ b/packages/block/docs/interfaces/_index_.jsonheader.md @@ -0,0 +1,149 @@ +[@ethereumjs/block](../README.md) › ["index"](../modules/_index_.md) › [JsonHeader](_index_.jsonheader.md) + +# Interface: JsonHeader + +An object with the block header's data represented as strings. + +## Hierarchy + +* **JsonHeader** + +## Index + +### Properties + +* [bloom](_index_.jsonheader.md#optional-bloom) +* [coinbase](_index_.jsonheader.md#optional-coinbase) +* [difficulty](_index_.jsonheader.md#optional-difficulty) +* [extraData](_index_.jsonheader.md#optional-extradata) +* [gasLimit](_index_.jsonheader.md#optional-gaslimit) +* [gasUsed](_index_.jsonheader.md#optional-gasused) +* [mixHash](_index_.jsonheader.md#optional-mixhash) +* [nonce](_index_.jsonheader.md#optional-nonce) +* [number](_index_.jsonheader.md#optional-number) +* [parentHash](_index_.jsonheader.md#optional-parenthash) +* [receiptTrie](_index_.jsonheader.md#optional-receipttrie) +* [stateRoot](_index_.jsonheader.md#optional-stateroot) +* [timestamp](_index_.jsonheader.md#optional-timestamp) +* [transactionsTrie](_index_.jsonheader.md#optional-transactionstrie) +* [uncleHash](_index_.jsonheader.md#optional-unclehash) + +## Properties + +### `Optional` bloom + +• **bloom**? : *undefined | string* + +*Defined in [types.ts:101](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L101)* + +___ + +### `Optional` coinbase + +• **coinbase**? : *undefined | string* + +*Defined in [types.ts:97](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L97)* + +___ + +### `Optional` difficulty + +• **difficulty**? : *undefined | string* + +*Defined in [types.ts:102](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L102)* + +___ + +### `Optional` extraData + +• **extraData**? : *undefined | string* + +*Defined in [types.ts:107](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L107)* + +___ + +### `Optional` gasLimit + +• **gasLimit**? : *undefined | string* + +*Defined in [types.ts:104](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L104)* + +___ + +### `Optional` gasUsed + +• **gasUsed**? : *undefined | string* + +*Defined in [types.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L105)* + +___ + +### `Optional` mixHash + +• **mixHash**? : *undefined | string* + +*Defined in [types.ts:108](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L108)* + +___ + +### `Optional` nonce + +• **nonce**? : *undefined | string* + +*Defined in [types.ts:109](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L109)* + +___ + +### `Optional` number + +• **number**? : *undefined | string* + +*Defined in [types.ts:103](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L103)* + +___ + +### `Optional` parentHash + +• **parentHash**? : *undefined | string* + +*Defined in [types.ts:95](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L95)* + +___ + +### `Optional` receiptTrie + +• **receiptTrie**? : *undefined | string* + +*Defined in [types.ts:100](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L100)* + +___ + +### `Optional` stateRoot + +• **stateRoot**? : *undefined | string* + +*Defined in [types.ts:98](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L98)* + +___ + +### `Optional` timestamp + +• **timestamp**? : *undefined | string* + +*Defined in [types.ts:106](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L106)* + +___ + +### `Optional` transactionsTrie + +• **transactionsTrie**? : *undefined | string* + +*Defined in [types.ts:99](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L99)* + +___ + +### `Optional` uncleHash + +• **uncleHash**? : *undefined | string* + +*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/interfaces/_index_.transformabletobuffer.md b/packages/block/docs/interfaces/_index_.transformabletobuffer.md deleted file mode 100644 index 08488a7984..0000000000 --- a/packages/block/docs/interfaces/_index_.transformabletobuffer.md +++ /dev/null @@ -1,25 +0,0 @@ -[@ethereumjs/block](../README.md) › ["index"](../modules/_index_.md) › [TransformableToBuffer](_index_.transformabletobuffer.md) - -# Interface: TransformableToBuffer - -Any object that can be transformed into a `Buffer` - -## Hierarchy - -* **TransformableToBuffer** - -## Index - -### Methods - -* [toBuffer](_index_.transformabletobuffer.md#tobuffer) - -## Methods - -### toBuffer - -▸ **toBuffer**(): *Buffer* - -*Defined in [types.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L31)* - -**Returns:** *Buffer* diff --git a/packages/block/docs/interfaces/_types_.blockchain.md b/packages/block/docs/interfaces/_types_.blockchain.md index 571d131253..01ddb71563 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:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L75)* +*Defined in [types.ts:113](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L113)* **Parameters:** diff --git a/packages/block/docs/interfaces/_types_.blockdata.md b/packages/block/docs/interfaces/_types_.blockdata.md index 1bfb52fa6c..c1d373e94e 100644 --- a/packages/block/docs/interfaces/_types_.blockdata.md +++ b/packages/block/docs/interfaces/_types_.blockdata.md @@ -20,22 +20,24 @@ A block's data. ### `Optional` header -• **header**? : *Buffer | [PrefixedHexString](../modules/_types_.md#prefixedhexstring) | [BufferLike](../modules/_types_.md#bufferlike)[] | [BlockHeaderData](_index_.blockheaderdata.md)* +• **header**? : *[HeaderData](_types_.headerdata.md)* -*Defined in [types.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L69)* +*Defined in [types.ts:68](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L68)* + +Header data for the block ___ ### `Optional` transactions -• **transactions**? : *Array‹Buffer | [PrefixedHexString](../modules/_types_.md#prefixedhexstring) | [BufferLike](../modules/_types_.md#bufferlike)[] | TxData›* +• **transactions**? : *Array‹TxData›* -*Defined in [types.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L70)* +*Defined in [types.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L69)* ___ ### `Optional` uncleHeaders -• **uncleHeaders**? : *Array‹Buffer | [PrefixedHexString](../modules/_types_.md#prefixedhexstring) | [BufferLike](../modules/_types_.md#bufferlike)[] | [BlockHeaderData](_index_.blockheaderdata.md)›* +• **uncleHeaders**? : *Array‹[HeaderData](_index_.headerdata.md)›* -*Defined in [types.ts:71](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L71)* +*Defined in [types.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L70)* diff --git a/packages/block/docs/interfaces/_types_.blockheaderdata.md b/packages/block/docs/interfaces/_types_.blockheaderdata.md deleted file mode 100644 index b3d29b31a2..0000000000 --- a/packages/block/docs/interfaces/_types_.blockheaderdata.md +++ /dev/null @@ -1,149 +0,0 @@ -[@ethereumjs/block](../README.md) › ["types"](../modules/_types_.md) › [BlockHeaderData](_types_.blockheaderdata.md) - -# Interface: BlockHeaderData - -A block header's data. - -## Hierarchy - -* **BlockHeaderData** - -## Index - -### Properties - -* [bloom](_types_.blockheaderdata.md#optional-bloom) -* [coinbase](_types_.blockheaderdata.md#optional-coinbase) -* [difficulty](_types_.blockheaderdata.md#optional-difficulty) -* [extraData](_types_.blockheaderdata.md#optional-extradata) -* [gasLimit](_types_.blockheaderdata.md#optional-gaslimit) -* [gasUsed](_types_.blockheaderdata.md#optional-gasused) -* [mixHash](_types_.blockheaderdata.md#optional-mixhash) -* [nonce](_types_.blockheaderdata.md#optional-nonce) -* [number](_types_.blockheaderdata.md#optional-number) -* [parentHash](_types_.blockheaderdata.md#optional-parenthash) -* [receiptTrie](_types_.blockheaderdata.md#optional-receipttrie) -* [stateRoot](_types_.blockheaderdata.md#optional-stateroot) -* [timestamp](_types_.blockheaderdata.md#optional-timestamp) -* [transactionsTrie](_types_.blockheaderdata.md#optional-transactionstrie) -* [uncleHash](_types_.blockheaderdata.md#optional-unclehash) - -## Properties - -### `Optional` bloom - -• **bloom**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L54)* - -___ - -### `Optional` coinbase - -• **coinbase**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L50)* - -___ - -### `Optional` difficulty - -• **difficulty**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L55)* - -___ - -### `Optional` extraData - -• **extraData**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L60)* - -___ - -### `Optional` gasLimit - -• **gasLimit**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L57)* - -___ - -### `Optional` gasUsed - -• **gasUsed**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L58)* - -___ - -### `Optional` mixHash - -• **mixHash**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L61)* - -___ - -### `Optional` nonce - -• **nonce**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:62](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L62)* - -___ - -### `Optional` number - -• **number**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L56)* - -___ - -### `Optional` parentHash - -• **parentHash**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L48)* - -___ - -### `Optional` receiptTrie - -• **receiptTrie**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L53)* - -___ - -### `Optional` stateRoot - -• **stateRoot**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:51](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L51)* - -___ - -### `Optional` timestamp - -• **timestamp**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L59)* - -___ - -### `Optional` transactionsTrie - -• **transactionsTrie**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L52)* - -___ - -### `Optional` uncleHash - -• **uncleHash**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:49](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L49)* diff --git a/packages/block/docs/interfaces/_types_.blockoptions.md b/packages/block/docs/interfaces/_types_.blockoptions.md new file mode 100644 index 0000000000..7a64e00ba5 --- /dev/null +++ b/packages/block/docs/interfaces/_types_.blockoptions.md @@ -0,0 +1,63 @@ +[@ethereumjs/block](../README.md) › ["types"](../modules/_types_.md) › [BlockOptions](_types_.blockoptions.md) + +# Interface: BlockOptions + +An object to set to which blockchain the blocks and their headers belong. This could be specified +using a Common object, or `chain` and `hardfork`. Defaults to mainnet without specifying a +hardfork. + +## Hierarchy + +* **BlockOptions** + +## Index + +### Properties + +* [common](_types_.blockoptions.md#optional-common) +* [hardforkByBlockNumber](_types_.blockoptions.md#optional-hardforkbyblocknumber) +* [initWithGenesisHeader](_types_.blockoptions.md#optional-initwithgenesisheader) + +## Properties + +### `Optional` common + +• **common**? : *Common* + +*Defined in [types.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L20)* + +A Common object defining the chain and the hardfork a block/block header belongs to. + +Default: `Common` object set to `mainnet` and the HF currently defined as the default +hardfork in the `Common` class. + +Current default hardfork: `istanbul` + +___ + +### `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)* + +Determine the HF by the block number + +Default: `false` (HF is set to whatever default HF is set by the Common instance) + +___ + +### `Optional` initWithGenesisHeader + +• **initWithGenesisHeader**? : *undefined | false | true* + +*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L37)* + +Turns the block header into the canonical genesis block header + +If set to `true` all other header data is ignored. + +If a Common instance is passed the instance need to be set to `chainstart` as a HF, +otherwise usage of this option will throw + +Default: `false` diff --git a/packages/block/docs/interfaces/_types_.chainoptions.md b/packages/block/docs/interfaces/_types_.chainoptions.md deleted file mode 100644 index 85f61d9693..0000000000 --- a/packages/block/docs/interfaces/_types_.chainoptions.md +++ /dev/null @@ -1,49 +0,0 @@ -[@ethereumjs/block](../README.md) › ["types"](../modules/_types_.md) › [ChainOptions](_types_.chainoptions.md) - -# Interface: ChainOptions - -An object to set to which blockchain the blocks and their headers belong. This could be specified -using a Common object, or `chain` and `hardfork`. Defaults to mainnet without specifying a -hardfork. - -## Hierarchy - -* **ChainOptions** - -## Index - -### Properties - -* [chain](_types_.chainoptions.md#optional-chain) -* [common](_types_.chainoptions.md#optional-common) -* [hardfork](_types_.chainoptions.md#optional-hardfork) - -## Properties - -### `Optional` chain - -• **chain**? : *number | string* - -*Defined in [types.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L19)* - -The chain of the block/block header, default: 'mainnet' - -___ - -### `Optional` common - -• **common**? : *Common* - -*Defined in [types.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L14)* - -A Common object defining the chain and the hardfork a block/block header belongs to. - -___ - -### `Optional` hardfork - -• **hardfork**? : *undefined | string* - -*Defined in [types.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L24)* - -The hardfork of the block/block header, default: 'petersburg' diff --git a/packages/block/docs/interfaces/_types_.headerdata.md b/packages/block/docs/interfaces/_types_.headerdata.md new file mode 100644 index 0000000000..639bace40d --- /dev/null +++ b/packages/block/docs/interfaces/_types_.headerdata.md @@ -0,0 +1,149 @@ +[@ethereumjs/block](../README.md) › ["types"](../modules/_types_.md) › [HeaderData](_types_.headerdata.md) + +# Interface: HeaderData + +A block header's data. + +## Hierarchy + +* **HeaderData** + +## Index + +### Properties + +* [bloom](_types_.headerdata.md#optional-bloom) +* [coinbase](_types_.headerdata.md#optional-coinbase) +* [difficulty](_types_.headerdata.md#optional-difficulty) +* [extraData](_types_.headerdata.md#optional-extradata) +* [gasLimit](_types_.headerdata.md#optional-gaslimit) +* [gasUsed](_types_.headerdata.md#optional-gasused) +* [mixHash](_types_.headerdata.md#optional-mixhash) +* [nonce](_types_.headerdata.md#optional-nonce) +* [number](_types_.headerdata.md#optional-number) +* [parentHash](_types_.headerdata.md#optional-parenthash) +* [receiptTrie](_types_.headerdata.md#optional-receipttrie) +* [stateRoot](_types_.headerdata.md#optional-stateroot) +* [timestamp](_types_.headerdata.md#optional-timestamp) +* [transactionsTrie](_types_.headerdata.md#optional-transactionstrie) +* [uncleHash](_types_.headerdata.md#optional-unclehash) + +## Properties + +### `Optional` bloom + +• **bloom**? : *BufferLike* + +*Defined in [types.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L50)* + +___ + +### `Optional` coinbase + +• **coinbase**? : *AddressLike* + +*Defined in [types.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L46)* + +___ + +### `Optional` difficulty + +• **difficulty**? : *BNLike* + +*Defined in [types.ts:51](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L51)* + +___ + +### `Optional` extraData + +• **extraData**? : *BufferLike* + +*Defined in [types.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L56)* + +___ + +### `Optional` gasLimit + +• **gasLimit**? : *BNLike* + +*Defined in [types.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L53)* + +___ + +### `Optional` gasUsed + +• **gasUsed**? : *BNLike* + +*Defined in [types.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L54)* + +___ + +### `Optional` mixHash + +• **mixHash**? : *BufferLike* + +*Defined in [types.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L57)* + +___ + +### `Optional` nonce + +• **nonce**? : *BufferLike* + +*Defined in [types.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L58)* + +___ + +### `Optional` number + +• **number**? : *BNLike* + +*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L52)* + +___ + +### `Optional` parentHash + +• **parentHash**? : *BufferLike* + +*Defined in [types.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L44)* + +___ + +### `Optional` receiptTrie + +• **receiptTrie**? : *BufferLike* + +*Defined in [types.ts:49](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L49)* + +___ + +### `Optional` stateRoot + +• **stateRoot**? : *BufferLike* + +*Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L47)* + +___ + +### `Optional` timestamp + +• **timestamp**? : *BNLike* + +*Defined in [types.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L55)* + +___ + +### `Optional` transactionsTrie + +• **transactionsTrie**? : *BufferLike* + +*Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L48)* + +___ + +### `Optional` uncleHash + +• **uncleHash**? : *BufferLike* + +*Defined in [types.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L45)* diff --git a/packages/block/docs/interfaces/_types_.jsonblock.md b/packages/block/docs/interfaces/_types_.jsonblock.md new file mode 100644 index 0000000000..b090c1df73 --- /dev/null +++ b/packages/block/docs/interfaces/_types_.jsonblock.md @@ -0,0 +1,43 @@ +[@ethereumjs/block](../README.md) › ["types"](../modules/_types_.md) › [JsonBlock](_types_.jsonblock.md) + +# Interface: JsonBlock + +An object with the block's data represented as strings. + +## Hierarchy + +* **JsonBlock** + +## Index + +### Properties + +* [header](_types_.jsonblock.md#optional-header) +* [transactions](_types_.jsonblock.md#optional-transactions) +* [uncleHeaders](_types_.jsonblock.md#optional-uncleheaders) + +## Properties + +### `Optional` header + +• **header**? : *[JsonHeader](_types_.jsonheader.md)* + +*Defined in [types.ts:86](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L86)* + +Header data for the block + +___ + +### `Optional` transactions + +• **transactions**? : *JsonTx[]* + +*Defined in [types.ts:87](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L87)* + +___ + +### `Optional` uncleHeaders + +• **uncleHeaders**? : *[JsonHeader](_index_.jsonheader.md)[]* + +*Defined in [types.ts:88](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L88)* diff --git a/packages/block/docs/interfaces/_types_.jsonheader.md b/packages/block/docs/interfaces/_types_.jsonheader.md new file mode 100644 index 0000000000..a4a7bc8f78 --- /dev/null +++ b/packages/block/docs/interfaces/_types_.jsonheader.md @@ -0,0 +1,149 @@ +[@ethereumjs/block](../README.md) › ["types"](../modules/_types_.md) › [JsonHeader](_types_.jsonheader.md) + +# Interface: JsonHeader + +An object with the block header's data represented as strings. + +## Hierarchy + +* **JsonHeader** + +## Index + +### Properties + +* [bloom](_types_.jsonheader.md#optional-bloom) +* [coinbase](_types_.jsonheader.md#optional-coinbase) +* [difficulty](_types_.jsonheader.md#optional-difficulty) +* [extraData](_types_.jsonheader.md#optional-extradata) +* [gasLimit](_types_.jsonheader.md#optional-gaslimit) +* [gasUsed](_types_.jsonheader.md#optional-gasused) +* [mixHash](_types_.jsonheader.md#optional-mixhash) +* [nonce](_types_.jsonheader.md#optional-nonce) +* [number](_types_.jsonheader.md#optional-number) +* [parentHash](_types_.jsonheader.md#optional-parenthash) +* [receiptTrie](_types_.jsonheader.md#optional-receipttrie) +* [stateRoot](_types_.jsonheader.md#optional-stateroot) +* [timestamp](_types_.jsonheader.md#optional-timestamp) +* [transactionsTrie](_types_.jsonheader.md#optional-transactionstrie) +* [uncleHash](_types_.jsonheader.md#optional-unclehash) + +## Properties + +### `Optional` bloom + +• **bloom**? : *undefined | string* + +*Defined in [types.ts:101](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L101)* + +___ + +### `Optional` coinbase + +• **coinbase**? : *undefined | string* + +*Defined in [types.ts:97](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L97)* + +___ + +### `Optional` difficulty + +• **difficulty**? : *undefined | string* + +*Defined in [types.ts:102](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L102)* + +___ + +### `Optional` extraData + +• **extraData**? : *undefined | string* + +*Defined in [types.ts:107](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L107)* + +___ + +### `Optional` gasLimit + +• **gasLimit**? : *undefined | string* + +*Defined in [types.ts:104](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L104)* + +___ + +### `Optional` gasUsed + +• **gasUsed**? : *undefined | string* + +*Defined in [types.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L105)* + +___ + +### `Optional` mixHash + +• **mixHash**? : *undefined | string* + +*Defined in [types.ts:108](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L108)* + +___ + +### `Optional` nonce + +• **nonce**? : *undefined | string* + +*Defined in [types.ts:109](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L109)* + +___ + +### `Optional` number + +• **number**? : *undefined | string* + +*Defined in [types.ts:103](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L103)* + +___ + +### `Optional` parentHash + +• **parentHash**? : *undefined | string* + +*Defined in [types.ts:95](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L95)* + +___ + +### `Optional` receiptTrie + +• **receiptTrie**? : *undefined | string* + +*Defined in [types.ts:100](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L100)* + +___ + +### `Optional` stateRoot + +• **stateRoot**? : *undefined | string* + +*Defined in [types.ts:98](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L98)* + +___ + +### `Optional` timestamp + +• **timestamp**? : *undefined | string* + +*Defined in [types.ts:106](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L106)* + +___ + +### `Optional` transactionsTrie + +• **transactionsTrie**? : *undefined | string* + +*Defined in [types.ts:99](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L99)* + +___ + +### `Optional` uncleHash + +• **uncleHash**? : *undefined | string* + +*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/interfaces/_types_.transformabletobuffer.md b/packages/block/docs/interfaces/_types_.transformabletobuffer.md deleted file mode 100644 index 9fef7bf84d..0000000000 --- a/packages/block/docs/interfaces/_types_.transformabletobuffer.md +++ /dev/null @@ -1,25 +0,0 @@ -[@ethereumjs/block](../README.md) › ["types"](../modules/_types_.md) › [TransformableToBuffer](_types_.transformabletobuffer.md) - -# Interface: TransformableToBuffer - -Any object that can be transformed into a `Buffer` - -## Hierarchy - -* **TransformableToBuffer** - -## Index - -### Methods - -* [toBuffer](_types_.transformabletobuffer.md#tobuffer) - -## Methods - -### toBuffer - -▸ **toBuffer**(): *Buffer* - -*Defined in [types.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L31)* - -**Returns:** *Buffer* diff --git a/packages/block/docs/modules/_from_rpc_.md b/packages/block/docs/modules/_from_rpc_.md index adad9e7b21..9010272b74 100644 --- a/packages/block/docs/modules/_from_rpc_.md +++ b/packages/block/docs/modules/_from_rpc_.md @@ -12,18 +12,18 @@ ### blockFromRpc -▸ **blockFromRpc**(`blockParams`: any, `uncles?`: any[], `chainOptions?`: [ChainOptions](../interfaces/_index_.chainoptions.md)): *[Block](../classes/_block_.block.md)‹›* +▸ **blockFromRpc**(`blockParams`: any, `uncles`: any[], `options?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[Block](../classes/_block_.block.md)‹›* -*Defined in [from-rpc.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/from-rpc.ts#L14)* +*Defined in [from-rpc.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/from-rpc.ts#L32)* Creates a new block object from Ethereum JSON RPC. **Parameters:** -Name | Type | Description | ------- | ------ | ------ | -`blockParams` | any | Ethereum JSON RPC of block (eth_getBlockByNumber) | -`uncles?` | any[] | Optional list of Ethereum JSON RPC of uncles (eth_getUncleByBlockHashAndIndex) | -`chainOptions?` | [ChainOptions](../interfaces/_index_.chainoptions.md) | An object describing the blockchain | +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`blockParams` | any | - | Ethereum JSON RPC of block (eth_getBlockByNumber) | +`uncles` | any[] | [] | Optional list of Ethereum JSON RPC of uncles (eth_getUncleByBlockHashAndIndex) | +`options?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | - | **Returns:** *[Block](../classes/_block_.block.md)‹›* diff --git a/packages/block/docs/modules/_header_from_rpc_.md b/packages/block/docs/modules/_header_from_rpc_.md index f560d699a4..6c116c65ae 100644 --- a/packages/block/docs/modules/_header_from_rpc_.md +++ b/packages/block/docs/modules/_header_from_rpc_.md @@ -12,9 +12,9 @@ ### blockHeaderFromRpc -▸ **blockHeaderFromRpc**(`blockParams`: any, `chainOptions?`: [ChainOptions](../interfaces/_index_.chainoptions.md)): *[BlockHeader](../classes/_header_.blockheader.md)‹›* +▸ **blockHeaderFromRpc**(`blockParams`: any, `options?`: [BlockOptions](../interfaces/_index_.blockoptions.md)): *[BlockHeader](../classes/_header_.blockheader.md)‹›* -*Defined in [header-from-rpc.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header-from-rpc.ts#L11)* +*Defined in [header-from-rpc.ts:10](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/header-from-rpc.ts#L10)* Creates a new block header object from Ethereum JSON RPC. @@ -23,6 +23,6 @@ Creates a new block header object from Ethereum JSON RPC. Name | Type | Description | ------ | ------ | ------ | `blockParams` | any | Ethereum JSON RPC of block (eth_getBlockByNumber) | -`chainOptions?` | [ChainOptions](../interfaces/_index_.chainoptions.md) | An object describing the blockchain | +`options?` | [BlockOptions](../interfaces/_index_.blockoptions.md) | - | **Returns:** *[BlockHeader](../classes/_header_.blockheader.md)‹›* diff --git a/packages/block/docs/modules/_index_.md b/packages/block/docs/modules/_index_.md index e8202fd7d6..58f70c08f4 100644 --- a/packages/block/docs/modules/_index_.md +++ b/packages/block/docs/modules/_index_.md @@ -12,32 +12,56 @@ ### Interfaces * [BlockData](../interfaces/_index_.blockdata.md) -* [BlockHeaderData](../interfaces/_index_.blockheaderdata.md) +* [BlockOptions](../interfaces/_index_.blockoptions.md) * [Blockchain](../interfaces/_index_.blockchain.md) -* [ChainOptions](../interfaces/_index_.chainoptions.md) -* [TransformableToBuffer](../interfaces/_index_.transformabletobuffer.md) +* [HeaderData](../interfaces/_index_.headerdata.md) +* [JsonBlock](../interfaces/_index_.jsonblock.md) +* [JsonHeader](../interfaces/_index_.jsonheader.md) ### Type aliases -* [BufferLike](_index_.md#bufferlike) -* [PrefixedHexString](_index_.md#prefixedhexstring) +* [BlockBodyBuffer](_index_.md#blockbodybuffer) +* [BlockBuffer](_index_.md#blockbuffer) +* [BlockHeaderBuffer](_index_.md#blockheaderbuffer) +* [TransactionsBuffer](_index_.md#transactionsbuffer) +* [UncleHeadersBuffer](_index_.md#uncleheadersbuffer) ## Type aliases -### BufferLike +### BlockBodyBuffer -Ƭ **BufferLike**: *Buffer | [TransformableToBuffer](../interfaces/_index_.transformabletobuffer.md) | [PrefixedHexString](_index_.md#prefixedhexstring) | number* +Ƭ **BlockBodyBuffer**: *[[TransactionsBuffer](_index_.md#transactionsbuffer), [UncleHeadersBuffer](_index_.md#uncleheadersbuffer)]* -*Defined in [types.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L42)* +*Defined in [types.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L75)* -A Buffer, hex string prefixed with `0x`, Number, or an object with a toBuffer method such as BN. +___ + +### BlockBuffer + +Ƭ **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)* ___ -### PrefixedHexString +### BlockHeaderBuffer + +Ƭ **BlockHeaderBuffer**: *Buffer[]* + +*Defined in [types.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L74)* + +___ + +### TransactionsBuffer + +Ƭ **TransactionsBuffer**: *Buffer[][]* + +*Defined in [types.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L76)* + +___ -Ƭ **PrefixedHexString**: *string* +### UncleHeadersBuffer -*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L37)* +Ƭ **UncleHeadersBuffer**: *Buffer[][]* -A hex string prefixed with `0x`. +*Defined in [types.ts:77](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L77)* diff --git a/packages/block/docs/modules/_types_.md b/packages/block/docs/modules/_types_.md index ec309afdc8..123128b22a 100644 --- a/packages/block/docs/modules/_types_.md +++ b/packages/block/docs/modules/_types_.md @@ -7,32 +7,56 @@ ### Interfaces * [BlockData](../interfaces/_types_.blockdata.md) -* [BlockHeaderData](../interfaces/_types_.blockheaderdata.md) +* [BlockOptions](../interfaces/_types_.blockoptions.md) * [Blockchain](../interfaces/_types_.blockchain.md) -* [ChainOptions](../interfaces/_types_.chainoptions.md) -* [TransformableToBuffer](../interfaces/_types_.transformabletobuffer.md) +* [HeaderData](../interfaces/_types_.headerdata.md) +* [JsonBlock](../interfaces/_types_.jsonblock.md) +* [JsonHeader](../interfaces/_types_.jsonheader.md) ### Type aliases -* [BufferLike](_types_.md#bufferlike) -* [PrefixedHexString](_types_.md#prefixedhexstring) +* [BlockBodyBuffer](_types_.md#blockbodybuffer) +* [BlockBuffer](_types_.md#blockbuffer) +* [BlockHeaderBuffer](_types_.md#blockheaderbuffer) +* [TransactionsBuffer](_types_.md#transactionsbuffer) +* [UncleHeadersBuffer](_types_.md#uncleheadersbuffer) ## Type aliases -### BufferLike +### BlockBodyBuffer -Ƭ **BufferLike**: *Buffer | [TransformableToBuffer](../interfaces/_index_.transformabletobuffer.md) | [PrefixedHexString](_types_.md#prefixedhexstring) | number* +Ƭ **BlockBodyBuffer**: *[[TransactionsBuffer](_types_.md#transactionsbuffer), [UncleHeadersBuffer](_types_.md#uncleheadersbuffer)]* -*Defined in [types.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L42)* +*Defined in [types.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L75)* -A Buffer, hex string prefixed with `0x`, Number, or an object with a toBuffer method such as BN. +___ + +### BlockBuffer + +Ƭ **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)* ___ -### PrefixedHexString +### BlockHeaderBuffer + +Ƭ **BlockHeaderBuffer**: *Buffer[]* + +*Defined in [types.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L74)* + +___ + +### TransactionsBuffer + +Ƭ **TransactionsBuffer**: *Buffer[][]* + +*Defined in [types.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L76)* + +___ -Ƭ **PrefixedHexString**: *string* +### UncleHeadersBuffer -*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L37)* +Ƭ **UncleHeadersBuffer**: *Buffer[][]* -A hex string prefixed with `0x`. +*Defined in [types.ts:77](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/block/src/types.ts#L77)* diff --git a/packages/block/package.json b/packages/block/package.json index a8af037074..47deb88c5d 100644 --- a/packages/block/package.json +++ b/packages/block/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/block", - "version": "3.0.0", + "version": "3.0.0-beta.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#synopsis", "dependencies": { - "@ethereumjs/common": "^1.5.1", - "@ethereumjs/tx": "^2.1.2", + "@ethereumjs/common": "2.0.0-beta.1", + "@ethereumjs/tx": "3.0.0-beta.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 bc3d30aad5..ae0465f8d8 100644 --- a/packages/blockchain/CHANGELOG.md +++ b/packages/blockchain/CHANGELOG.md @@ -6,7 +6,7 @@ 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] - UNRELEASED +## 5.0.0-beta.1 - 2020-10-22 ### New Package Name @@ -61,6 +61,17 @@ The deprecated `validate` option has been removed, please use `valdiateBlock` an [5.0.0]: https://github.com/ethereumjs/ethereumjs-vm/compare/%40ethereumjs%2Fblockchain%404.0.2...%40ethereumjs%2Fblockchain%405.0.0 +### Dual ES5 and ES2017 Builds + +We significantly updated our internal tool and CI setup along the work on +PR [#913](https://github.com/ethereumjs/ethereumjs-vm/pull/913) with an update to `ESLint` from `TSLint` +for code linting and formatting and the introduction of a new build setup. + +Packages now target `ES2017` for Node.js builds (the `main` entrypoint from `package.json`) and introduce +a separate `ES5` build distributed along using the `browser` directive as an entrypoint, see +PR [#921](https://github.com/ethereumjs/ethereumjs-vm/pull/921). This will result +in performance benefits for Node.js consumers, see [here](https://github.com/ethereumjs/merkle-patricia-tree/pull/117) for a releated discussion. + ### Other Changes **Changes and Refactoring** diff --git a/packages/blockchain/docs/classes/_index_.blockchain.md b/packages/blockchain/docs/classes/_index_.blockchain.md index d5d6445646..fc6cf9e0fe 100644 --- a/packages/blockchain/docs/classes/_index_.blockchain.md +++ b/packages/blockchain/docs/classes/_index_.blockchain.md @@ -50,7 +50,7 @@ This class stores and interacts with blocks. \+ **new Blockchain**(`opts`: [BlockchainOptions](../interfaces/_index_.blockchainoptions.md)): *[Blockchain](_index_.blockchain.md)* -*Defined in [index.ts:114](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L114)* +*Defined in [index.ts:106](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L106)* Creates new Blockchain object @@ -68,7 +68,7 @@ Name | Type | Default | Description | • **db**: *LevelUp* -*Defined in [index.ts:98](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L98)* +*Defined in [index.ts:90](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L90)* ___ @@ -76,7 +76,7 @@ ___ • **dbManager**: *DBManager* -*Defined in [index.ts:99](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L99)* +*Defined in [index.ts:91](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L91)* ___ @@ -84,7 +84,7 @@ ___ • **ethash**? : *Ethash* -*Defined in [index.ts:100](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L100)* +*Defined in [index.ts:92](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L92)* ## Accessors @@ -92,7 +92,7 @@ ___ • **get meta**(): *object* -*Defined in [index.ts:154](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L154)* +*Defined in [index.ts:152](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L152)* Returns an object with metadata about the Blockchain. It's defined for backwards compatibility. @@ -112,7 +112,7 @@ Returns an object with metadata about the Blockchain. It's defined for backwards *Implementation of [BlockchainInterface](../interfaces/_index_.blockchaininterface.md)* -*Defined in [index.ts:707](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L707)* +*Defined in [index.ts:701](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L701)* Deletes a block from the blockchain. All child blocks in the chain are deleted and any encountered heads are set to the parent block. @@ -133,7 +133,7 @@ ___ *Implementation of [BlockchainInterface](../interfaces/_index_.blockchaininterface.md)* -*Defined in [index.ts:449](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L449)* +*Defined in [index.ts:454](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L454)* Gets a block by its hash. @@ -151,7 +151,7 @@ ___ ▸ **getBlocks**(`blockId`: Buffer | BN | number, `maxBlocks`: number, `skip`: number, `reverse`: boolean): *Promise‹Block[]›* -*Defined in [index.ts:472](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L472)* +*Defined in [index.ts:477](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L477)* Looks up many blocks relative to blockId @@ -172,7 +172,7 @@ ___ ▸ **getHead**(`name`: string): *Promise‹Block›* -*Defined in [index.ts:242](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L242)* +*Defined in [index.ts:243](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L243)* Returns the specified iterator head. @@ -190,7 +190,7 @@ ___ ▸ **getLatestBlock**(): *Promise‹Block‹››* -*Defined in [index.ts:275](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L275)* +*Defined in [index.ts:276](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L276)* Returns the latest full block in the canonical chain. @@ -202,7 +202,7 @@ ___ ▸ **getLatestHeader**(): *Promise‹BlockHeader›* -*Defined in [index.ts:259](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L259)* +*Defined in [index.ts:260](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L260)* Returns the latest header in the canonical chain. @@ -216,7 +216,7 @@ ___ *Implementation of [BlockchainInterface](../interfaces/_index_.blockchaininterface.md)* -*Defined in [index.ts:819](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L819)* +*Defined in [index.ts:814](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L814)* Iterates through blocks starting at the specified iterator head and calls the onBlock function on each block. The current location of an iterator head can be retrieved using the `getHead()` @@ -239,7 +239,7 @@ ___ *Implementation of [BlockchainInterface](../interfaces/_index_.blockchaininterface.md)* -*Defined in [index.ts:303](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L303)* +*Defined in [index.ts:304](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L304)* Adds a block to the blockchain. @@ -258,7 +258,7 @@ ___ ▸ **putBlocks**(`blocks`: Block[]): *Promise‹void›* -*Defined in [index.ts:292](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L292)* +*Defined in [index.ts:293](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L293)* Adds many blocks to the blockchain. @@ -276,7 +276,7 @@ ___ ▸ **putGenesis**(`genesis`: Block): *Promise‹void›* -*Defined in [index.ts:233](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L233)* +*Defined in [index.ts:234](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L234)* Puts the genesis block in the database @@ -294,7 +294,7 @@ ___ ▸ **putHeader**(`header`: BlockHeader): *Promise‹void›* -*Defined in [index.ts:329](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L329)* +*Defined in [index.ts:336](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L336)* Adds a header to the blockchain. @@ -312,7 +312,7 @@ ___ ▸ **putHeaders**(`headers`: Array‹any›): *Promise‹void›* -*Defined in [index.ts:318](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L318)* +*Defined in [index.ts:325](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L325)* Adds many headers to the blockchain. @@ -330,7 +330,7 @@ ___ ▸ **selectNeededHashes**(`hashes`: Array‹Buffer›): *Promise‹Buffer‹›[]›* -*Defined in [index.ts:511](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L511)* +*Defined in [index.ts:516](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L516)* Given an ordered array, returns an array of hashes that are not in the blockchain yet. diff --git a/packages/blockchain/docs/interfaces/_index_.blockchainoptions.md b/packages/blockchain/docs/interfaces/_index_.blockchainoptions.md index 323e68ed5a..aed95a549f 100644 --- a/packages/blockchain/docs/interfaces/_index_.blockchainoptions.md +++ b/packages/blockchain/docs/interfaces/_index_.blockchainoptions.md @@ -12,32 +12,22 @@ This are the options that the Blockchain constructor can receive. ### Properties -* [chain](_index_.blockchainoptions.md#optional-chain) * [common](_index_.blockchainoptions.md#optional-common) * [db](_index_.blockchainoptions.md#optional-db) -* [hardfork](_index_.blockchainoptions.md#optional-hardfork) * [validateBlocks](_index_.blockchainoptions.md#optional-validateblocks) * [validatePow](_index_.blockchainoptions.md#optional-validatepow) ## Properties -### `Optional` chain - -• **chain**? : *string | number* - -*Defined in [index.ts:63](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L63)* - -The chain id or name. Default: `"mainnet"`. - -___ - ### `Optional` common • **common**? : *Common* -*Defined in [index.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L74)* +*Defined in [index.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L66)* + +Specify the chain and hardfork by passing a Common instance. -An alternative way to specify the chain and hardfork is by passing a Common instance. +If not provided this defaults to chain `mainnet` and hardfork `chainstart` ___ @@ -45,28 +35,17 @@ ___ • **db**? : *LevelUp* -*Defined in [index.ts:79](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L79)* +*Defined in [index.ts:71](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L71)* Database to store blocks and metadata. Should be an abstract-leveldown compliant store. ___ -### `Optional` hardfork - -• **hardfork**? : *string | null* - -*Defined in [index.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L69)* - -Hardfork for the blocks. If `undefined` or `null` is passed, it gets computed based on block -numbers. - -___ - ### `Optional` validateBlocks • **validateBlocks**? : *undefined | false | true* -*Defined in [index.ts:91](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L91)* +*Defined in [index.ts:83](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L83)* This flags indicates if blocks should be validated. See Block#validate for details. If `validate` is provided, this option takes its value. If neither `validate` nor this option are @@ -78,6 +57,6 @@ ___ • **validatePow**? : *undefined | false | true* -*Defined in [index.ts:84](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L84)* +*Defined in [index.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/blockchain/src/index.ts#L76)* This flags indicates if Proof-of-work should be validated. Defaults to `true`. diff --git a/packages/blockchain/package.json b/packages/blockchain/package.json index 7eff029a85..68c0ca1aff 100644 --- a/packages/blockchain/package.json +++ b/packages/blockchain/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/blockchain", - "version": "4.0.3", + "version": "5.0.0-beta.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#synopsis", "dependencies": { - "@ethereumjs/block": "^3.0.0", - "@ethereumjs/common": "^1.5.1", - "@ethereumjs/ethash": "^1.0.0", + "@ethereumjs/block": "3.0.0-beta.1", + "@ethereumjs/common": "2.0.0-beta.1", + "@ethereumjs/ethash": "1.0.0-beta.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 6d88291c08..3a7946e9e5 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -6,7 +6,7 @@ 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] - [UNRELEASED] +## 2.0.0-beta.1 - 2020-10-22 ### New Package Name @@ -85,6 +85,17 @@ The default hardfork has been added as an accessible readonly property `DEFAULT_ Current default hardfork is set to `istanbul`, PR [#906](https://github.com/ethereumjs/ethereumjs-vm/pull/906). +### Dual ES5 and ES2017 Builds + +We significantly updated our internal tool and CI setup along the work on +PR [#913](https://github.com/ethereumjs/ethereumjs-vm/pull/913) with an update to `ESLint` from `TSLint` +for code linting and formatting and the introduction of a new build setup. + +Packages now target `ES2017` for Node.js builds (the `main` entrypoint from `package.json`) and introduce +a separate `ES5` build distributed along using the `browser` directive as an entrypoint, see +PR [#921](https://github.com/ethereumjs/ethereumjs-vm/pull/921). This will result +in performance benefits for Node.js consumers, see [here](https://github.com/ethereumjs/merkle-patricia-tree/pull/117) for a releated discussion. + ### Other Changes **Changes and Refactoring** diff --git a/packages/common/docs/README.md b/packages/common/docs/README.md index 7f975fa4ee..1fcf0206f6 100644 --- a/packages/common/docs/README.md +++ b/packages/common/docs/README.md @@ -6,6 +6,7 @@ ### Modules +* ["eips/index"](modules/_eips_index_.md) * ["genesisStates/index"](modules/_genesisstates_index_.md) * ["index"](modules/_index_.md) * ["types"](modules/_types_.md) diff --git a/packages/common/docs/classes/_index_.common.md b/packages/common/docs/classes/_index_.common.md index f1722c06ec..43451c6899 100644 --- a/packages/common/docs/classes/_index_.common.md +++ b/packages/common/docs/classes/_index_.common.md @@ -14,6 +14,10 @@ Common class to access chain and hardfork parameters * [constructor](_index_.common.md#constructor) +### Properties + +* [DEFAULT_HARDFORK](_index_.common.md#default_hardfork) + ### Methods * [_calcForkHash](_index_.common.md#_calcforkhash) @@ -26,6 +30,7 @@ Common class to access chain and hardfork parameters * [bootstrapNodes](_index_.common.md#bootstrapnodes) * [chainId](_index_.common.md#chainid) * [chainName](_index_.common.md#chainname) +* [eips](_index_.common.md#eips) * [forkHash](_index_.common.md#forkhash) * [genesis](_index_.common.md#genesis) * [gteHardfork](_index_.common.md#gtehardfork) @@ -42,37 +47,47 @@ Common class to access chain and hardfork parameters * [nextHardforkBlock](_index_.common.md#nexthardforkblock) * [param](_index_.common.md#param) * [paramByBlock](_index_.common.md#parambyblock) +* [paramByEIP](_index_.common.md#parambyeip) +* [paramByHardfork](_index_.common.md#parambyhardfork) * [setChain](_index_.common.md#setchain) +* [setEIPs](_index_.common.md#seteips) * [setHardfork](_index_.common.md#sethardfork) +* [setHardforkByBlockNumber](_index_.common.md#sethardforkbyblocknumber) * [forCustomChain](_index_.common.md#static-forcustomchain) ## Constructors ### constructor -\+ **new Common**(`chain`: string | number | object, `hardfork?`: string | null, `supportedHardforks?`: Array‹string›): *[Common](_index_.common.md)* +\+ **new Common**(`opts`: [CommonOpts](../interfaces/_index_.commonopts.md)): *[Common](_index_.common.md)* -*Defined in [index.ts:63](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L63)* +*Defined in [index.ts:96](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L96)* **`constructor`** **Parameters:** -Name | Type | Description | ------- | ------ | ------ | -`chain` | string | number | object | String ('mainnet') or Number (1) chain | -`hardfork?` | string | null | String identifier ('byzantium') for hardfork (optional) | -`supportedHardforks?` | Array‹string› | Limit parameter returns to the given hardforks (optional) | +Name | Type | +------ | ------ | +`opts` | [CommonOpts](../interfaces/_index_.commonopts.md) | **Returns:** *[Common](_index_.common.md)* +## Properties + +### DEFAULT_HARDFORK + +• **DEFAULT_HARDFORK**: *string* = "istanbul" + +*Defined in [index.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L47)* + ## Methods ### _calcForkHash ▸ **_calcForkHash**(`hardfork`: string): *string* -*Defined in [index.ts:392](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L392)* +*Defined in [index.ts:516](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L516)* Internal helper function to calculate a fork hash @@ -92,7 +107,7 @@ ___ ▸ **_chooseHardfork**(`hardfork?`: string | null, `onlySupported`: boolean): *string* -*Defined in [index.ts:132](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L132)* +*Defined in [index.ts:186](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L186)* Internal helper function to choose between hardfork set and hardfork provided as param @@ -113,7 +128,7 @@ ___ ▸ **_getHardfork**(`hardfork`: string): *any* -*Defined in [index.ts:150](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L150)* +*Defined in [index.ts:200](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L200)* Internal helper function, returns the params for the given hardfork for the chain set @@ -133,7 +148,7 @@ ___ ▸ **_isSupportedHardfork**(`hardfork`: string | null): *boolean* -*Defined in [index.ts:163](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L163)* +*Defined in [index.ts:213](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L213)* Internal helper function to check if a hardfork is set to be supported by the library @@ -153,7 +168,7 @@ ___ ▸ **activeHardfork**(`blockNumber?`: number | null, `opts?`: hardforkOptions): *string* -*Defined in [index.ts:327](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L327)* +*Defined in [index.ts:451](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L451)* Returns the latest active hardfork name for chain or block or throws if unavailable @@ -174,7 +189,7 @@ ___ ▸ **activeHardforks**(`blockNumber?`: number | null, `opts?`: hardforkOptions): *Array‹any›* -*Defined in [index.ts:307](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L307)* +*Defined in [index.ts:431](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L431)* Returns the active hardfork switches for the current chain @@ -195,7 +210,7 @@ ___ ▸ **activeOnBlock**(`blockNumber`: number, `opts?`: hardforkOptions): *boolean* -*Defined in [index.ts:237](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L237)* +*Defined in [index.ts:361](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L361)* Alias to hardforkIsActiveOnBlock when hardfork is set @@ -216,7 +231,7 @@ ___ ▸ **bootstrapNodes**(): *any* -*Defined in [index.ts:467](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L467)* +*Defined in [index.ts:591](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L591)* Returns bootstrap nodes for the current chain @@ -230,7 +245,7 @@ ___ ▸ **chainId**(): *number* -*Defined in [index.ts:483](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L483)* +*Defined in [index.ts:607](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L607)* Returns the Id of current chain @@ -244,7 +259,7 @@ ___ ▸ **chainName**(): *string* -*Defined in [index.ts:491](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L491)* +*Defined in [index.ts:615](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L615)* Returns the name of current chain @@ -254,11 +269,25 @@ chain name (lower case) ___ +### eips + +▸ **eips**(): *number[]* + +*Defined in [index.ts:631](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L631)* + +Returns the active EIPs + +**Returns:** *number[]* + +List of EIPs + +___ + ### forkHash ▸ **forkHash**(`hardfork?`: undefined | string): *any* -*Defined in [index.ts:422](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L422)* +*Defined in [index.ts:546](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L546)* Returns an eth/64 compliant fork hash (EIP-2124) @@ -276,7 +305,7 @@ ___ ▸ **genesis**(): *any* -*Defined in [index.ts:451](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L451)* +*Defined in [index.ts:575](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L575)* Returns the Genesis parameters of current chain @@ -290,7 +319,7 @@ ___ ▸ **gteHardfork**(`hardfork`: string, `opts?`: hardforkOptions): *boolean* -*Defined in [index.ts:281](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L281)* +*Defined in [index.ts:405](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L405)* Alias to hardforkGteHardfork when hardfork is set @@ -311,7 +340,7 @@ ___ ▸ **hardfork**(): *string | null* -*Defined in [index.ts:475](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L475)* +*Defined in [index.ts:599](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L599)* Returns the hardfork set @@ -325,7 +354,7 @@ ___ ▸ **hardforkBlock**(`hardfork?`: undefined | string): *number* -*Defined in [index.ts:342](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L342)* +*Defined in [index.ts:466](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L466)* Returns the hardfork change block for hardfork provided or set @@ -345,7 +374,7 @@ ___ ▸ **hardforkForForkHash**(`forkHash`: string): *any | null* -*Defined in [index.ts:440](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L440)* +*Defined in [index.ts:564](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L564)* **Parameters:** @@ -363,7 +392,7 @@ ___ ▸ **hardforkGteHardfork**(`hardfork1`: string | null, `hardfork2`: string, `opts?`: hardforkOptions): *boolean* -*Defined in [index.ts:248](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L248)* +*Defined in [index.ts:372](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L372)* Sequence based check if given or set HF1 is greater than or equal HF2 @@ -385,7 +414,7 @@ ___ ▸ **hardforkIsActiveOnBlock**(`hardfork`: string | null, `blockNumber`: number, `opts?`: hardforkOptions): *boolean* -*Defined in [index.ts:218](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L218)* +*Defined in [index.ts:342](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L342)* Checks if set or provided hardfork is active on block number @@ -407,7 +436,7 @@ ___ ▸ **hardforkIsActiveOnChain**(`hardfork?`: string | null, `opts?`: hardforkOptions): *boolean* -*Defined in [index.ts:291](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L291)* +*Defined in [index.ts:415](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L415)* Checks if given or set hardfork is active on the chain @@ -428,7 +457,7 @@ ___ ▸ **hardforks**(): *any* -*Defined in [index.ts:459](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L459)* +*Defined in [index.ts:583](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L583)* Returns the hardforks for current chain @@ -442,7 +471,7 @@ ___ ▸ **isHardforkBlock**(`blockNumber`: number, `hardfork?`: undefined | string): *boolean* -*Defined in [index.ts:353](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L353)* +*Defined in [index.ts:477](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L477)* True if block number provided is the hardfork (given or set) change block @@ -463,7 +492,7 @@ ___ ▸ **isNextHardforkBlock**(`blockNumber`: number, `hardfork?`: undefined | string): *boolean* -*Defined in [index.ts:382](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L382)* +*Defined in [index.ts:506](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L506)* True if block number provided is the hardfork change block following the hardfork given or set @@ -484,7 +513,7 @@ ___ ▸ **networkId**(): *number* -*Defined in [index.ts:499](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L499)* +*Defined in [index.ts:623](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L623)* Returns the Id of current network @@ -498,7 +527,7 @@ ___ ▸ **nextHardforkBlock**(`hardfork?`: undefined | string): *number | null* -*Defined in [index.ts:363](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L363)* +*Defined in [index.ts:487](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L487)* Returns the change block for the next hardfork after the hardfork provided or set @@ -516,11 +545,15 @@ ___ ### param -▸ **param**(`topic`: string, `name`: string, `hardfork?`: undefined | string): *any* +▸ **param**(`topic`: string, `name`: string): *any* -*Defined in [index.ts:180](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L180)* +*Defined in [index.ts:254](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L254)* -Returns the parameter corresponding to a hardfork +Returns a parameter for the current chain setup + +If the parameter is present in an EIP, the EIP always takes precendence. +Otherwise the parameter if taken from the latest applied HF with +a change on the respective parameter. **Parameters:** @@ -528,17 +561,18 @@ Name | Type | Description | ------ | ------ | ------ | `topic` | string | Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow') | `name` | string | Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) | -`hardfork?` | undefined | string | Hardfork name, optional if hardfork set | **Returns:** *any* +The value requested or `null` if not found + ___ ### paramByBlock ▸ **paramByBlock**(`topic`: string, `name`: string, `blockNumber`: number): *any* -*Defined in [index.ts:205](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L205)* +*Defined in [index.ts:329](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L329)* Returns a parameter for the hardfork active on block number @@ -554,11 +588,55 @@ Name | Type | Description | ___ +### paramByEIP + +▸ **paramByEIP**(`topic`: string, `name`: string, `eip`: number): *any* + +*Defined in [index.ts:307](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L307)* + +Returns a parameter corresponding to an EIP + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`topic` | string | Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow') | +`name` | string | Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) | +`eip` | number | Number of the EIP | + +**Returns:** *any* + +The value requested or `null` if not found + +___ + +### paramByHardfork + +▸ **paramByHardfork**(`topic`: string, `name`: string, `hardfork`: string): *any* + +*Defined in [index.ts:274](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L274)* + +Returns the parameter corresponding to a hardfork + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`topic` | string | Parameter topic ('gasConfig', 'gasPrices', 'vm', 'pow') | +`name` | string | Parameter name (e.g. 'minGasLimit' for 'gasConfig' topic) | +`hardfork` | string | Hardfork name | + +**Returns:** *any* + +The value requested or `null` if not found + +___ + ### setChain ▸ **setChain**(`chain`: string | number | object): *any* -*Defined in [index.ts:90](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L90)* +*Defined in [index.ts:121](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L121)* Sets the chain @@ -574,11 +652,29 @@ The dictionary with parameters set as chain ___ +### setEIPs + +▸ **setEIPs**(`eips`: number[]): *void* + +*Defined in [index.ts:228](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L228)* + +Sets the active EIPs + +**Parameters:** + +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`eips` | number[] | [] | | + +**Returns:** *void* + +___ + ### setHardfork -▸ **setHardfork**(`hardfork`: string | null): *void* +▸ **setHardfork**(`hardfork`: string): *void* -*Defined in [index.ts:111](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L111)* +*Defined in [index.ts:142](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L142)* Sets the hardfork to get params for @@ -586,17 +682,37 @@ Sets the hardfork to get params for Name | Type | Description | ------ | ------ | ------ | -`hardfork` | string | null | String identifier ('byzantium') | +`hardfork` | string | String identifier (e.g. 'byzantium') | **Returns:** *void* ___ +### setHardforkByBlockNumber + +▸ **setHardforkByBlockNumber**(`blockNumber`: number): *string* + +*Defined in [index.ts:163](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L163)* + +Sets a new hardfork based on the block number provided + +**Parameters:** + +Name | Type | +------ | ------ | +`blockNumber` | number | + +**Returns:** *string* + +The name of the HF set + +___ + ### `Static` forCustomChain -▸ **forCustomChain**(`baseChain`: string | number, `customChainParams`: Partial‹[Chain](../interfaces/_types_.chain.md)›, `hardfork?`: string | null, `supportedHardforks?`: Array‹string›): *[Common](_index_.common.md)* +▸ **forCustomChain**(`baseChain`: string | number, `customChainParams`: Partial‹[Chain](../interfaces/_types_.chain.md)›, `hardfork?`: undefined | string, `supportedHardforks?`: Array‹string›): *[Common](_index_.common.md)* -*Defined in [index.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L31)* +*Defined in [index.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L64)* Creates a Common object for a custom chain, based on a standard one. It uses all the [Chain](../interfaces/_types_.chain.md) params from [[baseChain]] except the ones overridden in [[customChainParams]]. @@ -607,7 +723,7 @@ Name | Type | Description | ------ | ------ | ------ | `baseChain` | string | number | The name (`mainnet`) or id (`1`) of a standard chain used to base the custom chain params on. | `customChainParams` | Partial‹[Chain](../interfaces/_types_.chain.md)› | The custom parameters of the chain. | -`hardfork?` | string | null | String identifier ('byzantium') for hardfork (optional) | +`hardfork?` | undefined | string | String identifier ('byzantium') for hardfork (optional) | `supportedHardforks?` | Array‹string› | Limit parameter returns to the given hardforks (optional) | **Returns:** *[Common](_index_.common.md)* diff --git a/packages/common/docs/interfaces/_index_.commonopts.md b/packages/common/docs/interfaces/_index_.commonopts.md new file mode 100644 index 0000000000..28deae0cfc --- /dev/null +++ b/packages/common/docs/interfaces/_index_.commonopts.md @@ -0,0 +1,65 @@ +[@ethereumjs/common](../README.md) › ["index"](../modules/_index_.md) › [CommonOpts](_index_.commonopts.md) + +# Interface: CommonOpts + +Options for instantiating a [Common](../classes/_index_.common.md) instance. + +## Hierarchy + +* **CommonOpts** + +## Index + +### Properties + +* [chain](_index_.commonopts.md#chain) +* [eips](_index_.commonopts.md#optional-eips) +* [hardfork](_index_.commonopts.md#optional-hardfork) +* [supportedHardforks](_index_.commonopts.md#optional-supportedhardforks) + +## Properties + +### chain + +• **chain**: *string | number | object* + +*Defined in [index.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L14)* + +String ('mainnet') or Number (1) chain + +___ + +### `Optional` eips + +• **eips**? : *number[]* + +*Defined in [index.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L33)* + +Selected EIPs which can be activated, please use an array for instantiation +(e.g. `eips: [ 2537, ]`) + +Currently supported: + +- [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) - BLS12-381 precompiles + +___ + +### `Optional` hardfork + +• **hardfork**? : *undefined | string* + +*Defined in [index.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L20)* + +String identifier ('byzantium') for hardfork + +Default: `istanbul` + +___ + +### `Optional` supportedHardforks + +• **supportedHardforks**? : *Array‹string›* + +*Defined in [index.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/index.ts#L24)* + +Limit parameter returns to the given hardforks diff --git a/packages/common/docs/interfaces/_types_.bootstrapnode.md b/packages/common/docs/interfaces/_types_.bootstrapnode.md index 761596f9af..d580c01d54 100644 --- a/packages/common/docs/interfaces/_types_.bootstrapnode.md +++ b/packages/common/docs/interfaces/_types_.bootstrapnode.md @@ -24,7 +24,7 @@ • **chainId**? : *undefined | number* -*Defined in [types.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L45)* +*Defined in [types.ts:49](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L49)* ___ @@ -32,7 +32,7 @@ ___ • **comment**: *string* -*Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L48)* +*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L52)* ___ @@ -40,7 +40,7 @@ ___ • **id**: *string* -*Defined in [types.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L46)* +*Defined in [types.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L50)* ___ @@ -48,7 +48,7 @@ ___ • **ip**: *string* -*Defined in [types.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L42)* +*Defined in [types.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L46)* ___ @@ -56,7 +56,7 @@ ___ • **location**: *string* -*Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L47)* +*Defined in [types.ts:51](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L51)* ___ @@ -64,7 +64,7 @@ ___ • **network**? : *undefined | string* -*Defined in [types.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L44)* +*Defined in [types.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L48)* ___ @@ -72,4 +72,4 @@ ___ • **port**: *number | string* -*Defined in [types.ts:43](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L43)* +*Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L47)* diff --git a/packages/common/docs/interfaces/_types_.eipstype.md b/packages/common/docs/interfaces/_types_.eipstype.md new file mode 100644 index 0000000000..537844b520 --- /dev/null +++ b/packages/common/docs/interfaces/_types_.eipstype.md @@ -0,0 +1,11 @@ +[@ethereumjs/common](../README.md) › ["types"](../modules/_types_.md) › [eipsType](_types_.eipstype.md) + +# Interface: eipsType + +## Hierarchy + +* **eipsType** + +## Indexable + +* \[ **key**: *number*\]: any diff --git a/packages/common/docs/interfaces/_types_.genesisblock.md b/packages/common/docs/interfaces/_types_.genesisblock.md index 3dad7214fe..42385f63a6 100644 --- a/packages/common/docs/interfaces/_types_.genesisblock.md +++ b/packages/common/docs/interfaces/_types_.genesisblock.md @@ -24,7 +24,7 @@ • **difficulty**: *number* -*Defined in [types.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L30)* +*Defined in [types.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L34)* ___ @@ -32,7 +32,7 @@ ___ • **extraData**: *string* -*Defined in [types.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L32)* +*Defined in [types.ts:36](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L36)* ___ @@ -40,7 +40,7 @@ ___ • **gasLimit**: *number* -*Defined in [types.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L29)* +*Defined in [types.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L33)* ___ @@ -48,7 +48,7 @@ ___ • **hash**: *string* -*Defined in [types.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L27)* +*Defined in [types.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L31)* ___ @@ -56,7 +56,7 @@ ___ • **nonce**: *string* -*Defined in [types.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L31)* +*Defined in [types.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L35)* ___ @@ -64,7 +64,7 @@ ___ • **stateRoot**: *string* -*Defined in [types.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L33)* +*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L37)* ___ @@ -72,4 +72,4 @@ ___ • **timestamp**: *string | null* -*Defined in [types.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L28)* +*Defined in [types.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L32)* diff --git a/packages/common/docs/interfaces/_types_.hardfork.md b/packages/common/docs/interfaces/_types_.hardfork.md index 3c9efb93bb..8cd468689d 100644 --- a/packages/common/docs/interfaces/_types_.hardfork.md +++ b/packages/common/docs/interfaces/_types_.hardfork.md @@ -19,7 +19,7 @@ • **block**: *number | null* -*Defined in [types.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L38)* +*Defined in [types.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L42)* ___ @@ -27,4 +27,4 @@ ___ • **name**: *string* -*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L37)* +*Defined in [types.ts:41](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/types.ts#L41)* diff --git a/packages/common/docs/modules/_eips_index_.md b/packages/common/docs/modules/_eips_index_.md new file mode 100644 index 0000000000..a281383db8 --- /dev/null +++ b/packages/common/docs/modules/_eips_index_.md @@ -0,0 +1,35 @@ +[@ethereumjs/common](../README.md) › ["eips/index"](_eips_index_.md) + +# Module: "eips/index" + +## Index + +### Object literals + +* [EIPs](_eips_index_.md#const-eips) + +## Object literals + +### `Const` EIPs + +### ▪ **EIPs**: *object* + +*Defined in [eips/index.ts:3](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/eips/index.ts#L3)* + +### 2315 + +• **2315**: *any* = require('./2315.json') + +*Defined in [eips/index.ts:4](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/eips/index.ts#L4)* + +### 2537 + +• **2537**: *any* = require('./2537.json') + +*Defined in [eips/index.ts:5](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/eips/index.ts#L5)* + +### 2929 + +• **2929**: *any* = require('./2929.json') + +*Defined in [eips/index.ts:6](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/common/src/eips/index.ts#L6)* diff --git a/packages/common/docs/modules/_index_.md b/packages/common/docs/modules/_index_.md index 9a0031fd9e..299152c903 100644 --- a/packages/common/docs/modules/_index_.md +++ b/packages/common/docs/modules/_index_.md @@ -7,3 +7,7 @@ ### Classes * [Common](../classes/_index_.common.md) + +### Interfaces + +* [CommonOpts](../interfaces/_index_.commonopts.md) diff --git a/packages/common/docs/modules/_types_.md b/packages/common/docs/modules/_types_.md index 284ffaeac3..818462ebd0 100644 --- a/packages/common/docs/modules/_types_.md +++ b/packages/common/docs/modules/_types_.md @@ -11,4 +11,5 @@ * [GenesisBlock](../interfaces/_types_.genesisblock.md) * [Hardfork](../interfaces/_types_.hardfork.md) * [chainsType](../interfaces/_types_.chainstype.md) +* [eipsType](../interfaces/_types_.eipstype.md) * [genesisStatesType](../interfaces/_types_.genesisstatestype.md) diff --git a/packages/common/package.json b/packages/common/package.json index 925c1672f8..215b301eed 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/common", - "version": "1.5.1", + "version": "2.0.0-beta.1", "description": "Resources common to all Ethereum implementations", "main": "./dist/index.js", "types": "./dist/index.d.ts", @@ -40,6 +40,9 @@ "url": "https://github.com/ethereumjs/ethereumjs-common/issues" }, "homepage": "https://github.com/ethereumjs-ethereumjs/common", + "dependencies": { + "crc-32": "^1.2.0" + }, "devDependencies": { "@ethereumjs/config-coverage": "^2.0.0", "@ethereumjs/config-typescript": "^2.0.0", @@ -65,8 +68,5 @@ "name": "Holger Drewes", "email": "Holger.Drewes@gmail.com" } - ], - "dependencies": { - "crc-32": "^1.2.0" - } + ] } diff --git a/packages/ethash/CHANGELOG.md b/packages/ethash/CHANGELOG.md index ba36473744..5be2b2c1e2 100644 --- a/packages/ethash/CHANGELOG.md +++ b/packages/ethash/CHANGELOG.md @@ -6,7 +6,7 @@ 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] - [UNRELEASED] +## 1.0.0-beta.1 - 2020-10-22 ### New Package Name @@ -47,6 +47,17 @@ for a complete example. [1.0.0]: https://github.com/ethereumjs/ethereumjs-vm/releases/tag/%40ethereumjs%2Fethash%401.0.0 +### Dual ES5 and ES2017 Builds + +We significantly updated our internal tool and CI setup along the work on +PR [#913](https://github.com/ethereumjs/ethereumjs-vm/pull/913) with an update to `ESLint` from `TSLint` +for code linting and formatting and the introduction of a new build setup. + +Packages now target `ES2017` for Node.js builds (the `main` entrypoint from `package.json`) and introduce +a separate `ES5` build distributed along using the `browser` directive as an entrypoint, see +PR [#921](https://github.com/ethereumjs/ethereumjs-vm/pull/921). This will result +in performance benefits for Node.js consumers, see [here](https://github.com/ethereumjs/merkle-patricia-tree/pull/117) for a releated discussion. + ### Other Changes - Updated Block dependency to `@ethereumjs/block` `v3.0.0`, diff --git a/packages/ethash/package.json b/packages/ethash/package.json index 2ee0ce717c..580988b9ba 100644 --- a/packages/ethash/package.json +++ b/packages/ethash/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/ethash", - "version": "1.0.0", + "version": "1.0.0-beta.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", + "@ethereumjs/block": "3.0.0-beta.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 77c0e451a3..50d5866412 100644 --- a/packages/tx/CHANGELOG.md +++ b/packages/tx/CHANGELOG.md @@ -6,7 +6,7 @@ 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] - [UNRELEASED] +## 3.0.0-beta.1 - 2020-10-22 ### New Package Name @@ -90,6 +90,17 @@ The `FakeTransaction` class was removed since its functionality can now be imple The HF setting is now automatically taken from the HF set for `Common.DEAULT_HARDFORK`, see PR [#863](https://github.com/ethereumjs/ethereumjs-vm/pull/863). +### Dual ES5 and ES2017 Builds + +We significantly updated our internal tool and CI setup along the work on +PR [#913](https://github.com/ethereumjs/ethereumjs-vm/pull/913) with an update to `ESLint` from `TSLint` +for code linting and formatting and the introduction of a new build setup. + +Packages now target `ES2017` for Node.js builds (the `main` entrypoint from `package.json`) and introduce +a separate `ES5` build distributed along using the `browser` directive as an entrypoint, see +PR [#921](https://github.com/ethereumjs/ethereumjs-vm/pull/921). This will result +in performance benefits for Node.js consumers, see [here](https://github.com/ethereumjs/merkle-patricia-tree/pull/117) for a releated discussion. + ### Other Changes **Changes and Refactoring** diff --git a/packages/tx/docs/README.md b/packages/tx/docs/README.md index 8149e8a0d3..6981ebd760 100644 --- a/packages/tx/docs/README.md +++ b/packages/tx/docs/README.md @@ -6,7 +6,6 @@ ### Modules -* ["fake"](modules/_fake_.md) * ["index"](modules/_index_.md) * ["transaction"](modules/_transaction_.md) * ["types"](modules/_types_.md) diff --git a/packages/tx/docs/classes/_fake_.faketransaction.md b/packages/tx/docs/classes/_fake_.faketransaction.md deleted file mode 100644 index 868be5136d..0000000000 --- a/packages/tx/docs/classes/_fake_.faketransaction.md +++ /dev/null @@ -1,416 +0,0 @@ -[@ethereumjs/tx](../README.md) › ["fake"](../modules/_fake_.md) › [FakeTransaction](_fake_.faketransaction.md) - -# Class: FakeTransaction - -Creates a new transaction object that doesn't need to be signed. - -**`param`** A transaction can be initialized with its rlp representation, an array containing -the value of its fields in order, or an object containing them by name. - -**`param`** The transaction's options, used to indicate the chain and hardfork the -transactions belongs to. - -**`see`** Transaction - -## Hierarchy - -* [Transaction](_index_.transaction.md) - - ↳ **FakeTransaction** - -## Index - -### Constructors - -* [constructor](_fake_.faketransaction.md#constructor) - -### Properties - -* [data](_fake_.faketransaction.md#data) -* [from](_fake_.faketransaction.md#from) -* [gasLimit](_fake_.faketransaction.md#gaslimit) -* [gasPrice](_fake_.faketransaction.md#gasprice) -* [nonce](_fake_.faketransaction.md#nonce) -* [r](_fake_.faketransaction.md#r) -* [raw](_fake_.faketransaction.md#raw) -* [s](_fake_.faketransaction.md#s) -* [to](_fake_.faketransaction.md#to) -* [v](_fake_.faketransaction.md#v) -* [value](_fake_.faketransaction.md#value) - -### Methods - -* [getBaseFee](_fake_.faketransaction.md#getbasefee) -* [getChainId](_fake_.faketransaction.md#getchainid) -* [getDataFee](_fake_.faketransaction.md#getdatafee) -* [getSenderAddress](_fake_.faketransaction.md#getsenderaddress) -* [getSenderPublicKey](_fake_.faketransaction.md#getsenderpublickey) -* [getUpfrontCost](_fake_.faketransaction.md#getupfrontcost) -* [hash](_fake_.faketransaction.md#hash) -* [serialize](_fake_.faketransaction.md#serialize) -* [sign](_fake_.faketransaction.md#sign) -* [toCreationAddress](_fake_.faketransaction.md#tocreationaddress) -* [toJSON](_fake_.faketransaction.md#tojson) -* [validate](_fake_.faketransaction.md#validate) -* [verifySignature](_fake_.faketransaction.md#verifysignature) - -## Constructors - -### constructor - -\+ **new FakeTransaction**(`data`: Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [FakeTxData](../interfaces/_index_.faketxdata.md), `opts`: [TransactionOptions](../interfaces/_index_.transactionoptions.md)): *[FakeTransaction](_fake_.faketransaction.md)* - -*Overrides [Transaction](_index_.transaction.md).[constructor](_index_.transaction.md#constructor)* - -*Defined in [fake.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/fake.ts#L22)* - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`data` | Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [FakeTxData](../interfaces/_index_.faketxdata.md) | {} | -`opts` | [TransactionOptions](../interfaces/_index_.transactionoptions.md) | {} | - -**Returns:** *[FakeTransaction](_fake_.faketransaction.md)* - -## Properties - -### data - -• **data**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[data](_fake_.faketransaction.md#data)* - -*Defined in [transaction.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L30)* - -___ - -### from - -• **from**: *Buffer* - -*Defined in [fake.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/fake.ts#L22)* - -Set from address to bypass transaction signing. -This is not an optional property, as its getter never returns undefined. - -___ - -### gasLimit - -• **gasLimit**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[gasLimit](_fake_.faketransaction.md#gaslimit)* - -*Defined in [transaction.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L26)* - -___ - -### gasPrice - -• **gasPrice**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[gasPrice](_fake_.faketransaction.md#gasprice)* - -*Defined in [transaction.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L27)* - -___ - -### nonce - -• **nonce**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[nonce](_fake_.faketransaction.md#nonce)* - -*Defined in [transaction.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L25)* - -___ - -### r - -• **r**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[r](_fake_.faketransaction.md#r)* - -*Defined in [transaction.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L32)* - -___ - -### raw - -• **raw**: *Buffer[]* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[raw](_fake_.faketransaction.md#raw)* - -*Defined in [transaction.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L24)* - -___ - -### s - -• **s**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[s](_fake_.faketransaction.md#s)* - -*Defined in [transaction.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L33)* - -___ - -### to - -• **to**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[to](_fake_.faketransaction.md#to)* - -*Defined in [transaction.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L28)* - -___ - -### v - -• **v**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[v](_fake_.faketransaction.md#v)* - -*Defined in [transaction.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L31)* - -___ - -### value - -• **value**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[value](_fake_.faketransaction.md#value)* - -*Defined in [transaction.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L29)* - -## Methods - -### getBaseFee - -▸ **getBaseFee**(): *BN* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getBaseFee](_fake_.faketransaction.md#getbasefee)* - -*Defined in [transaction.ts:295](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L295)* - -the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) - -**Returns:** *BN* - -___ - -### getChainId - -▸ **getChainId**(): *number* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getChainId](_fake_.faketransaction.md#getchainid)* - -*Defined in [transaction.ts:201](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L201)* - -returns chain ID - -**Returns:** *number* - -___ - -### getDataFee - -▸ **getDataFee**(): *BN* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getDataFee](_fake_.faketransaction.md#getdatafee)* - -*Defined in [transaction.ts:281](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L281)* - -The amount of gas paid for the data in this tx - -**Returns:** *BN* - -___ - -### getSenderAddress - -▸ **getSenderAddress**(): *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getSenderAddress](_fake_.faketransaction.md#getsenderaddress)* - -*Defined in [transaction.ts:208](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L208)* - -returns the sender's address - -**Returns:** *Buffer* - -___ - -### getSenderPublicKey - -▸ **getSenderPublicKey**(): *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getSenderPublicKey](_fake_.faketransaction.md#getsenderpublickey)* - -*Defined in [transaction.ts:220](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L220)* - -returns the public key of the sender - -**Returns:** *Buffer* - -___ - -### getUpfrontCost - -▸ **getUpfrontCost**(): *BN* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getUpfrontCost](_fake_.faketransaction.md#getupfrontcost)* - -*Defined in [transaction.ts:306](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L306)* - -the up front amount that an account must have for this transaction to be valid - -**Returns:** *BN* - -___ - -### hash - -▸ **hash**(`includeSignature`: boolean): *Buffer* - -*Overrides [Transaction](_index_.transaction.md).[hash](_index_.transaction.md#hash)* - -*Defined in [fake.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/fake.ts#L53)* - -Computes a sha3-256 hash of the serialized tx, using the sender address to generate a fake -signature. - -**Parameters:** - -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`includeSignature` | boolean | true | Whether or not to include the signature | - -**Returns:** *Buffer* - -___ - -### serialize - -▸ **serialize**(): *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[serialize](_fake_.faketransaction.md#serialize)* - -*Defined in [transaction.ts:336](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L336)* - -Returns the rlp encoding of the transaction - -**Returns:** *Buffer* - -___ - -### sign - -▸ **sign**(`privateKey`: Buffer): *void* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[sign](_fake_.faketransaction.md#sign)* - -*Defined in [transaction.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L261)* - -sign a transaction with a given private key - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`privateKey` | Buffer | Must be 32 bytes in length | - -**Returns:** *void* - -___ - -### toCreationAddress - -▸ **toCreationAddress**(): *boolean* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[toCreationAddress](_fake_.faketransaction.md#tocreationaddress)* - -*Defined in [transaction.ts:169](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L169)* - -If the tx's `to` is to the creation address - -**Returns:** *boolean* - -___ - -### toJSON - -▸ **toJSON**(`labels`: boolean): *object | string[]* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[toJSON](_fake_.faketransaction.md#tojson)* - -*Defined in [transaction.ts:345](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L345)* - -Returns the transaction in JSON format - -**`see`** [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties) - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`labels` | boolean | false | - -**Returns:** *object | string[]* - -___ - -### validate - -▸ **validate**(): *boolean* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[validate](_fake_.faketransaction.md#validate)* - -*Defined in [transaction.ts:313](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L313)* - -Validates the signature and checks to see if it has enough gas. - -**Returns:** *boolean* - -▸ **validate**(`stringError`: false): *boolean* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[validate](_fake_.faketransaction.md#validate)* - -*Defined in [transaction.ts:314](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L314)* - -**Parameters:** - -Name | Type | ------- | ------ | -`stringError` | false | - -**Returns:** *boolean* - -▸ **validate**(`stringError`: true): *string* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[validate](_fake_.faketransaction.md#validate)* - -*Defined in [transaction.ts:315](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L315)* - -**Parameters:** - -Name | Type | ------- | ------ | -`stringError` | true | - -**Returns:** *string* - -___ - -### verifySignature - -▸ **verifySignature**(): *boolean* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[verifySignature](_fake_.faketransaction.md#verifysignature)* - -*Defined in [transaction.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L232)* - -Determines if the signature is valid - -**Returns:** *boolean* diff --git a/packages/tx/docs/classes/_index_.faketransaction.md b/packages/tx/docs/classes/_index_.faketransaction.md deleted file mode 100644 index 7487d4b520..0000000000 --- a/packages/tx/docs/classes/_index_.faketransaction.md +++ /dev/null @@ -1,416 +0,0 @@ -[@ethereumjs/tx](../README.md) › ["index"](../modules/_index_.md) › [FakeTransaction](_index_.faketransaction.md) - -# Class: FakeTransaction - -Creates a new transaction object that doesn't need to be signed. - -**`param`** A transaction can be initialized with its rlp representation, an array containing -the value of its fields in order, or an object containing them by name. - -**`param`** The transaction's options, used to indicate the chain and hardfork the -transactions belongs to. - -**`see`** Transaction - -## Hierarchy - -* [Transaction](_index_.transaction.md) - - ↳ **FakeTransaction** - -## Index - -### Constructors - -* [constructor](_index_.faketransaction.md#constructor) - -### Properties - -* [data](_index_.faketransaction.md#data) -* [from](_index_.faketransaction.md#from) -* [gasLimit](_index_.faketransaction.md#gaslimit) -* [gasPrice](_index_.faketransaction.md#gasprice) -* [nonce](_index_.faketransaction.md#nonce) -* [r](_index_.faketransaction.md#r) -* [raw](_index_.faketransaction.md#raw) -* [s](_index_.faketransaction.md#s) -* [to](_index_.faketransaction.md#to) -* [v](_index_.faketransaction.md#v) -* [value](_index_.faketransaction.md#value) - -### Methods - -* [getBaseFee](_index_.faketransaction.md#getbasefee) -* [getChainId](_index_.faketransaction.md#getchainid) -* [getDataFee](_index_.faketransaction.md#getdatafee) -* [getSenderAddress](_index_.faketransaction.md#getsenderaddress) -* [getSenderPublicKey](_index_.faketransaction.md#getsenderpublickey) -* [getUpfrontCost](_index_.faketransaction.md#getupfrontcost) -* [hash](_index_.faketransaction.md#hash) -* [serialize](_index_.faketransaction.md#serialize) -* [sign](_index_.faketransaction.md#sign) -* [toCreationAddress](_index_.faketransaction.md#tocreationaddress) -* [toJSON](_index_.faketransaction.md#tojson) -* [validate](_index_.faketransaction.md#validate) -* [verifySignature](_index_.faketransaction.md#verifysignature) - -## Constructors - -### constructor - -\+ **new FakeTransaction**(`data`: Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [FakeTxData](../interfaces/_index_.faketxdata.md), `opts`: [TransactionOptions](../interfaces/_index_.transactionoptions.md)): *[FakeTransaction](_index_.faketransaction.md)* - -*Overrides [Transaction](_index_.transaction.md).[constructor](_index_.transaction.md#constructor)* - -*Defined in [fake.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/fake.ts#L22)* - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`data` | Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [FakeTxData](../interfaces/_index_.faketxdata.md) | {} | -`opts` | [TransactionOptions](../interfaces/_index_.transactionoptions.md) | {} | - -**Returns:** *[FakeTransaction](_index_.faketransaction.md)* - -## Properties - -### data - -• **data**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[data](_fake_.faketransaction.md#data)* - -*Defined in [transaction.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L30)* - -___ - -### from - -• **from**: *Buffer* - -*Defined in [fake.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/fake.ts#L22)* - -Set from address to bypass transaction signing. -This is not an optional property, as its getter never returns undefined. - -___ - -### gasLimit - -• **gasLimit**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[gasLimit](_fake_.faketransaction.md#gaslimit)* - -*Defined in [transaction.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L26)* - -___ - -### gasPrice - -• **gasPrice**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[gasPrice](_fake_.faketransaction.md#gasprice)* - -*Defined in [transaction.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L27)* - -___ - -### nonce - -• **nonce**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[nonce](_fake_.faketransaction.md#nonce)* - -*Defined in [transaction.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L25)* - -___ - -### r - -• **r**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[r](_fake_.faketransaction.md#r)* - -*Defined in [transaction.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L32)* - -___ - -### raw - -• **raw**: *Buffer[]* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[raw](_fake_.faketransaction.md#raw)* - -*Defined in [transaction.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L24)* - -___ - -### s - -• **s**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[s](_fake_.faketransaction.md#s)* - -*Defined in [transaction.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L33)* - -___ - -### to - -• **to**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[to](_fake_.faketransaction.md#to)* - -*Defined in [transaction.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L28)* - -___ - -### v - -• **v**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[v](_fake_.faketransaction.md#v)* - -*Defined in [transaction.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L31)* - -___ - -### value - -• **value**: *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[value](_fake_.faketransaction.md#value)* - -*Defined in [transaction.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L29)* - -## Methods - -### getBaseFee - -▸ **getBaseFee**(): *BN* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getBaseFee](_fake_.faketransaction.md#getbasefee)* - -*Defined in [transaction.ts:295](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L295)* - -the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) - -**Returns:** *BN* - -___ - -### getChainId - -▸ **getChainId**(): *number* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getChainId](_fake_.faketransaction.md#getchainid)* - -*Defined in [transaction.ts:201](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L201)* - -returns chain ID - -**Returns:** *number* - -___ - -### getDataFee - -▸ **getDataFee**(): *BN* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getDataFee](_fake_.faketransaction.md#getdatafee)* - -*Defined in [transaction.ts:281](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L281)* - -The amount of gas paid for the data in this tx - -**Returns:** *BN* - -___ - -### getSenderAddress - -▸ **getSenderAddress**(): *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getSenderAddress](_fake_.faketransaction.md#getsenderaddress)* - -*Defined in [transaction.ts:208](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L208)* - -returns the sender's address - -**Returns:** *Buffer* - -___ - -### getSenderPublicKey - -▸ **getSenderPublicKey**(): *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getSenderPublicKey](_fake_.faketransaction.md#getsenderpublickey)* - -*Defined in [transaction.ts:220](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L220)* - -returns the public key of the sender - -**Returns:** *Buffer* - -___ - -### getUpfrontCost - -▸ **getUpfrontCost**(): *BN* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[getUpfrontCost](_fake_.faketransaction.md#getupfrontcost)* - -*Defined in [transaction.ts:306](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L306)* - -the up front amount that an account must have for this transaction to be valid - -**Returns:** *BN* - -___ - -### hash - -▸ **hash**(`includeSignature`: boolean): *Buffer* - -*Overrides [Transaction](_index_.transaction.md).[hash](_index_.transaction.md#hash)* - -*Defined in [fake.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/fake.ts#L53)* - -Computes a sha3-256 hash of the serialized tx, using the sender address to generate a fake -signature. - -**Parameters:** - -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`includeSignature` | boolean | true | Whether or not to include the signature | - -**Returns:** *Buffer* - -___ - -### serialize - -▸ **serialize**(): *Buffer* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[serialize](_fake_.faketransaction.md#serialize)* - -*Defined in [transaction.ts:336](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L336)* - -Returns the rlp encoding of the transaction - -**Returns:** *Buffer* - -___ - -### sign - -▸ **sign**(`privateKey`: Buffer): *void* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[sign](_fake_.faketransaction.md#sign)* - -*Defined in [transaction.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L261)* - -sign a transaction with a given private key - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`privateKey` | Buffer | Must be 32 bytes in length | - -**Returns:** *void* - -___ - -### toCreationAddress - -▸ **toCreationAddress**(): *boolean* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[toCreationAddress](_fake_.faketransaction.md#tocreationaddress)* - -*Defined in [transaction.ts:169](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L169)* - -If the tx's `to` is to the creation address - -**Returns:** *boolean* - -___ - -### toJSON - -▸ **toJSON**(`labels`: boolean): *object | string[]* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[toJSON](_fake_.faketransaction.md#tojson)* - -*Defined in [transaction.ts:345](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L345)* - -Returns the transaction in JSON format - -**`see`** [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties) - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`labels` | boolean | false | - -**Returns:** *object | string[]* - -___ - -### validate - -▸ **validate**(): *boolean* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[validate](_fake_.faketransaction.md#validate)* - -*Defined in [transaction.ts:313](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L313)* - -Validates the signature and checks to see if it has enough gas. - -**Returns:** *boolean* - -▸ **validate**(`stringError`: false): *boolean* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[validate](_fake_.faketransaction.md#validate)* - -*Defined in [transaction.ts:314](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L314)* - -**Parameters:** - -Name | Type | ------- | ------ | -`stringError` | false | - -**Returns:** *boolean* - -▸ **validate**(`stringError`: true): *string* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[validate](_fake_.faketransaction.md#validate)* - -*Defined in [transaction.ts:315](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L315)* - -**Parameters:** - -Name | Type | ------- | ------ | -`stringError` | true | - -**Returns:** *string* - -___ - -### verifySignature - -▸ **verifySignature**(): *boolean* - -*Inherited from [FakeTransaction](_fake_.faketransaction.md).[verifySignature](_fake_.faketransaction.md#verifysignature)* - -*Defined in [transaction.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L232)* - -Determines if the signature is valid - -**Returns:** *boolean* diff --git a/packages/tx/docs/classes/_index_.transaction.md b/packages/tx/docs/classes/_index_.transaction.md index 3064d448d5..34bfa54cc6 100644 --- a/packages/tx/docs/classes/_index_.transaction.md +++ b/packages/tx/docs/classes/_index_.transaction.md @@ -8,10 +8,6 @@ An Ethereum transaction. * **Transaction** - ↳ [FakeTransaction](_fake_.faketransaction.md) - - ↳ [FakeTransaction](_index_.faketransaction.md) - ## Index ### Constructors @@ -20,15 +16,15 @@ An Ethereum transaction. ### Properties +* [common](_index_.transaction.md#common) * [data](_index_.transaction.md#data) * [gasLimit](_index_.transaction.md#gaslimit) * [gasPrice](_index_.transaction.md#gasprice) * [nonce](_index_.transaction.md#nonce) -* [r](_index_.transaction.md#r) -* [raw](_index_.transaction.md#raw) -* [s](_index_.transaction.md#s) -* [to](_index_.transaction.md#to) -* [v](_index_.transaction.md#v) +* [r](_index_.transaction.md#optional-r) +* [s](_index_.transaction.md#optional-s) +* [to](_index_.transaction.md#optional-to) +* [v](_index_.transaction.md#optional-v) * [value](_index_.transaction.md#value) ### Methods @@ -36,135 +32,133 @@ An Ethereum transaction. * [getBaseFee](_index_.transaction.md#getbasefee) * [getChainId](_index_.transaction.md#getchainid) * [getDataFee](_index_.transaction.md#getdatafee) +* [getMessageToSign](_index_.transaction.md#getmessagetosign) +* [getMessageToVerifySignature](_index_.transaction.md#getmessagetoverifysignature) * [getSenderAddress](_index_.transaction.md#getsenderaddress) * [getSenderPublicKey](_index_.transaction.md#getsenderpublickey) * [getUpfrontCost](_index_.transaction.md#getupfrontcost) * [hash](_index_.transaction.md#hash) +* [isSigned](_index_.transaction.md#issigned) +* [raw](_index_.transaction.md#raw) * [serialize](_index_.transaction.md#serialize) * [sign](_index_.transaction.md#sign) * [toCreationAddress](_index_.transaction.md#tocreationaddress) * [toJSON](_index_.transaction.md#tojson) * [validate](_index_.transaction.md#validate) * [verifySignature](_index_.transaction.md#verifysignature) +* [fromRlpSerializedTx](_index_.transaction.md#static-fromrlpserializedtx) +* [fromTxData](_index_.transaction.md#static-fromtxdata) +* [fromValuesArray](_index_.transaction.md#static-fromvaluesarray) ## Constructors ### constructor -\+ **new Transaction**(`data`: Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [TxData](../interfaces/_index_.txdata.md), `opts`: [TransactionOptions](../interfaces/_index_.transactionoptions.md)): *[Transaction](_index_.transaction.md)* +\+ **new Transaction**(`nonce`: BN, `gasPrice`: BN, `gasLimit`: BN, `to`: Address | undefined, `value`: BN, `data`: Buffer, `v?`: BN, `r?`: BN, `s?`: BN, `opts?`: [TxOptions](../interfaces/_index_.txoptions.md)): *[Transaction](_index_.transaction.md)* -*Defined in [transaction.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L37)* +*Defined in [transaction.ts:87](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L87)* -Creates a new transaction from an object with its fields' values. - -**`note`** Transaction objects implement EIP155 by default. To disable it, use the constructor's -second parameter to set a chain and hardfork before EIP155 activation (i.e. before Spurious -Dragon.) - -**`example`** -```js -const txData = { - nonce: '0x00', - gasPrice: '0x09184e72a000', - gasLimit: '0x2710', - to: '0x0000000000000000000000000000000000000000', - value: '0x00', - data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057', - v: '0x1c', - r: '0x5e1d3a76fbf824220eafc8c79ad578ad2b67d01b0c2425eb1f1347e8f50882ab', - s: '0x5bd428537f05f9830e93792f90ea6a3e2d1ee84952dd96edbae9f658f831ab13' -}; -const tx = new Transaction(txData); -``` +This constructor takes the values, validates them, assigns them and freezes the object. +Use the static factory methods to assist in creating a Transaction object from varying data types. + +**`note`** Transaction objects implement EIP155 by default. To disable it, pass in an `@ethereumjs/common` object set before EIP155 activation (i.e. before Spurious Dragon). **Parameters:** -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`data` | Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [TxData](../interfaces/_index_.txdata.md) | {} | A transaction can be initialized with its rlp representation, an array containing the value of its fields in order, or an object containing them by name. | -`opts` | [TransactionOptions](../interfaces/_index_.transactionoptions.md) | {} | The transaction's options, used to indicate the chain and hardfork the transactions belongs to. | +Name | Type | +------ | ------ | +`nonce` | BN | +`gasPrice` | BN | +`gasLimit` | BN | +`to` | Address | undefined | +`value` | BN | +`data` | Buffer | +`v?` | BN | +`r?` | BN | +`s?` | BN | +`opts?` | [TxOptions](../interfaces/_index_.txoptions.md) | **Returns:** *[Transaction](_index_.transaction.md)* ## Properties -### data +### common -• **data**: *Buffer* +• **common**: *Common* -*Defined in [transaction.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L30)* +*Defined in [transaction.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L28)* ___ -### gasLimit +### data -• **gasLimit**: *Buffer* +• **data**: *Buffer* -*Defined in [transaction.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L26)* +*Defined in [transaction.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L34)* ___ -### gasPrice +### gasLimit -• **gasPrice**: *Buffer* +• **gasLimit**: *BN* -*Defined in [transaction.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L27)* +*Defined in [transaction.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L30)* ___ -### nonce +### gasPrice -• **nonce**: *Buffer* +• **gasPrice**: *BN* -*Defined in [transaction.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L25)* +*Defined in [transaction.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L31)* ___ -### r +### nonce -• **r**: *Buffer* +• **nonce**: *BN* -*Defined in [transaction.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L32)* +*Defined in [transaction.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L29)* ___ -### raw +### `Optional` r -• **raw**: *Buffer[]* +• **r**? : *BN* -*Defined in [transaction.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L24)* +*Defined in [transaction.ts:36](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L36)* ___ -### s +### `Optional` s -• **s**: *Buffer* +• **s**? : *BN* -*Defined in [transaction.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L33)* +*Defined in [transaction.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L37)* ___ -### to +### `Optional` to -• **to**: *Buffer* +• **to**? : *Address* -*Defined in [transaction.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L28)* +*Defined in [transaction.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L32)* ___ -### v +### `Optional` v -• **v**: *Buffer* +• **v**? : *BN* -*Defined in [transaction.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L31)* +*Defined in [transaction.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L35)* ___ ### value -• **value**: *Buffer* +• **value**: *BN* -*Defined in [transaction.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L29)* +*Defined in [transaction.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L33)* ## Methods @@ -172,9 +166,9 @@ ___ ▸ **getBaseFee**(): *BN* -*Defined in [transaction.ts:295](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L295)* +*Defined in [transaction.ts:292](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L292)* -the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) +The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) **Returns:** *BN* @@ -184,9 +178,9 @@ ___ ▸ **getChainId**(): *number* -*Defined in [transaction.ts:201](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L201)* +*Defined in [transaction.ts:179](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L179)* -returns chain ID +Returns chain ID **Returns:** *number* @@ -196,7 +190,7 @@ ___ ▸ **getDataFee**(): *BN* -*Defined in [transaction.ts:281](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L281)* +*Defined in [transaction.ts:278](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L278)* The amount of gas paid for the data in this tx @@ -204,15 +198,35 @@ The amount of gas paid for the data in this tx ___ +### getMessageToSign + +▸ **getMessageToSign**(): *Buffer‹›* + +*Defined in [transaction.ts:168](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L168)* + +**Returns:** *Buffer‹›* + +___ + +### getMessageToVerifySignature + +▸ **getMessageToVerifySignature**(): *Buffer‹›* + +*Defined in [transaction.ts:172](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L172)* + +**Returns:** *Buffer‹›* + +___ + ### getSenderAddress -▸ **getSenderAddress**(): *Buffer* +▸ **getSenderAddress**(): *Address* -*Defined in [transaction.ts:208](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L208)* +*Defined in [transaction.ts:186](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L186)* -returns the sender's address +Returns the sender's address -**Returns:** *Buffer* +**Returns:** *Address* ___ @@ -220,9 +234,9 @@ ___ ▸ **getSenderPublicKey**(): *Buffer* -*Defined in [transaction.ts:220](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L220)* +*Defined in [transaction.ts:193](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L193)* -returns the public key of the sender +Returns the public key of the sender **Returns:** *Buffer* @@ -232,9 +246,9 @@ ___ ▸ **getUpfrontCost**(): *BN* -*Defined in [transaction.ts:306](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L306)* +*Defined in [transaction.ts:303](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L303)* -the up front amount that an account must have for this transaction to be valid +The up front amount that an account must have for this transaction to be valid **Returns:** *BN* @@ -242,19 +256,35 @@ ___ ### hash -▸ **hash**(`includeSignature`: boolean): *Buffer* +▸ **hash**(): *Buffer* -*Defined in [transaction.ts:177](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L177)* +*Defined in [transaction.ts:152](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L152)* Computes a sha3-256 hash of the serialized tx -**Parameters:** +**Returns:** *Buffer* -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`includeSignature` | boolean | true | Whether or not to include the signature | +___ -**Returns:** *Buffer* +### isSigned + +▸ **isSigned**(): *boolean* + +*Defined in [transaction.ts:368](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L368)* + +**Returns:** *boolean* + +___ + +### raw + +▸ **raw**(): *Buffer[]* + +*Defined in [transaction.ts:330](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L330)* + +Returns a Buffer Array of the raw Buffers of this transaction, in order. + +**Returns:** *Buffer[]* ___ @@ -262,9 +292,9 @@ ___ ▸ **serialize**(): *Buffer* -*Defined in [transaction.ts:336](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L336)* +*Defined in [transaction.ts:347](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L347)* -Returns the rlp encoding of the transaction +Returns the rlp encoding of the transaction. **Returns:** *Buffer* @@ -272,19 +302,25 @@ ___ ### sign -▸ **sign**(`privateKey`: Buffer): *void* +▸ **sign**(`privateKey`: Buffer): *[Transaction](_index_.transaction.md)‹›* -*Defined in [transaction.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L261)* +*Defined in [transaction.ts:242](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L242)* -sign a transaction with a given private key +Sign a transaction with a given private key. +Returns a new Transaction object (the original tx will not be modified). +Example: +```typescript +const unsignedTx = Transaction.fromTxData(txData) +const signedTx = unsignedTx.sign(privKey) +``` **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`privateKey` | Buffer | Must be 32 bytes in length | +`privateKey` | Buffer | Must be 32 bytes in length. | -**Returns:** *void* +**Returns:** *[Transaction](_index_.transaction.md)‹›* ___ @@ -292,7 +328,7 @@ ___ ▸ **toCreationAddress**(): *boolean* -*Defined in [transaction.ts:169](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L169)* +*Defined in [transaction.ts:145](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L145)* If the tx's `to` is to the creation address @@ -302,21 +338,13 @@ ___ ### toJSON -▸ **toJSON**(`labels`: boolean): *object | string[]* +▸ **toJSON**(): *[JsonTx](../interfaces/_index_.jsontx.md)* -*Defined in [transaction.ts:345](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L345)* +*Defined in [transaction.ts:354](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L354)* -Returns the transaction in JSON format +Returns an object with the JSON representation of the transaction -**`see`** [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties) - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`labels` | boolean | false | - -**Returns:** *object | string[]* +**Returns:** *[JsonTx](../interfaces/_index_.jsontx.md)* ___ @@ -324,7 +352,7 @@ ___ ▸ **validate**(): *boolean* -*Defined in [transaction.ts:313](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L313)* +*Defined in [transaction.ts:310](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L310)* Validates the signature and checks to see if it has enough gas. @@ -332,7 +360,7 @@ Validates the signature and checks to see if it has enough gas. ▸ **validate**(`stringError`: false): *boolean* -*Defined in [transaction.ts:314](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L314)* +*Defined in [transaction.ts:311](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L311)* **Parameters:** @@ -342,9 +370,9 @@ Name | Type | **Returns:** *boolean* -▸ **validate**(`stringError`: true): *string* +▸ **validate**(`stringError`: true): *string[]* -*Defined in [transaction.ts:315](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L315)* +*Defined in [transaction.ts:312](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L312)* **Parameters:** @@ -352,7 +380,7 @@ Name | Type | ------ | ------ | `stringError` | true | -**Returns:** *string* +**Returns:** *string[]* ___ @@ -360,8 +388,59 @@ ___ ▸ **verifySignature**(): *boolean* -*Defined in [transaction.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L232)* +*Defined in [transaction.ts:224](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L224)* Determines if the signature is valid **Returns:** *boolean* + +___ + +### `Static` fromRlpSerializedTx + +▸ **fromRlpSerializedTx**(`serialized`: Buffer, `opts?`: [TxOptions](../interfaces/_index_.txoptions.md)): *[Transaction](_index_.transaction.md)‹›* + +*Defined in [transaction.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L56)* + +**Parameters:** + +Name | Type | +------ | ------ | +`serialized` | Buffer | +`opts?` | [TxOptions](../interfaces/_index_.txoptions.md) | + +**Returns:** *[Transaction](_index_.transaction.md)‹›* + +___ + +### `Static` fromTxData + +▸ **fromTxData**(`txData`: [TxData](../interfaces/_index_.txdata.md), `opts?`: [TxOptions](../interfaces/_index_.txoptions.md)): *[Transaction](_index_.transaction.md)‹›* + +*Defined in [transaction.ts:39](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L39)* + +**Parameters:** + +Name | Type | +------ | ------ | +`txData` | [TxData](../interfaces/_index_.txdata.md) | +`opts?` | [TxOptions](../interfaces/_index_.txoptions.md) | + +**Returns:** *[Transaction](_index_.transaction.md)‹›* + +___ + +### `Static` fromValuesArray + +▸ **fromValuesArray**(`values`: Buffer[], `opts?`: [TxOptions](../interfaces/_index_.txoptions.md)): *[Transaction](_index_.transaction.md)‹›* + +*Defined in [transaction.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L66)* + +**Parameters:** + +Name | Type | +------ | ------ | +`values` | Buffer[] | +`opts?` | [TxOptions](../interfaces/_index_.txoptions.md) | + +**Returns:** *[Transaction](_index_.transaction.md)‹›* diff --git a/packages/tx/docs/classes/_transaction_.transaction.md b/packages/tx/docs/classes/_transaction_.transaction.md index 5f1a38f95d..e74ca7b3de 100644 --- a/packages/tx/docs/classes/_transaction_.transaction.md +++ b/packages/tx/docs/classes/_transaction_.transaction.md @@ -16,15 +16,15 @@ An Ethereum transaction. ### Properties +* [common](_transaction_.transaction.md#common) * [data](_transaction_.transaction.md#data) * [gasLimit](_transaction_.transaction.md#gaslimit) * [gasPrice](_transaction_.transaction.md#gasprice) * [nonce](_transaction_.transaction.md#nonce) -* [r](_transaction_.transaction.md#r) -* [raw](_transaction_.transaction.md#raw) -* [s](_transaction_.transaction.md#s) -* [to](_transaction_.transaction.md#to) -* [v](_transaction_.transaction.md#v) +* [r](_transaction_.transaction.md#optional-r) +* [s](_transaction_.transaction.md#optional-s) +* [to](_transaction_.transaction.md#optional-to) +* [v](_transaction_.transaction.md#optional-v) * [value](_transaction_.transaction.md#value) ### Methods @@ -32,135 +32,133 @@ An Ethereum transaction. * [getBaseFee](_transaction_.transaction.md#getbasefee) * [getChainId](_transaction_.transaction.md#getchainid) * [getDataFee](_transaction_.transaction.md#getdatafee) +* [getMessageToSign](_transaction_.transaction.md#getmessagetosign) +* [getMessageToVerifySignature](_transaction_.transaction.md#getmessagetoverifysignature) * [getSenderAddress](_transaction_.transaction.md#getsenderaddress) * [getSenderPublicKey](_transaction_.transaction.md#getsenderpublickey) * [getUpfrontCost](_transaction_.transaction.md#getupfrontcost) * [hash](_transaction_.transaction.md#hash) +* [isSigned](_transaction_.transaction.md#issigned) +* [raw](_transaction_.transaction.md#raw) * [serialize](_transaction_.transaction.md#serialize) * [sign](_transaction_.transaction.md#sign) * [toCreationAddress](_transaction_.transaction.md#tocreationaddress) * [toJSON](_transaction_.transaction.md#tojson) * [validate](_transaction_.transaction.md#validate) * [verifySignature](_transaction_.transaction.md#verifysignature) +* [fromRlpSerializedTx](_transaction_.transaction.md#static-fromrlpserializedtx) +* [fromTxData](_transaction_.transaction.md#static-fromtxdata) +* [fromValuesArray](_transaction_.transaction.md#static-fromvaluesarray) ## Constructors ### constructor -\+ **new Transaction**(`data`: Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [TxData](../interfaces/_index_.txdata.md), `opts`: [TransactionOptions](../interfaces/_index_.transactionoptions.md)): *[Transaction](_transaction_.transaction.md)* +\+ **new Transaction**(`nonce`: BN, `gasPrice`: BN, `gasLimit`: BN, `to`: Address | undefined, `value`: BN, `data`: Buffer, `v?`: BN, `r?`: BN, `s?`: BN, `opts?`: [TxOptions](../interfaces/_index_.txoptions.md)): *[Transaction](_transaction_.transaction.md)* -*Defined in [transaction.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L37)* +*Defined in [transaction.ts:87](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L87)* -Creates a new transaction from an object with its fields' values. - -**`note`** Transaction objects implement EIP155 by default. To disable it, use the constructor's -second parameter to set a chain and hardfork before EIP155 activation (i.e. before Spurious -Dragon.) - -**`example`** -```js -const txData = { - nonce: '0x00', - gasPrice: '0x09184e72a000', - gasLimit: '0x2710', - to: '0x0000000000000000000000000000000000000000', - value: '0x00', - data: '0x7f7465737432000000000000000000000000000000000000000000000000000000600057', - v: '0x1c', - r: '0x5e1d3a76fbf824220eafc8c79ad578ad2b67d01b0c2425eb1f1347e8f50882ab', - s: '0x5bd428537f05f9830e93792f90ea6a3e2d1ee84952dd96edbae9f658f831ab13' -}; -const tx = new Transaction(txData); -``` +This constructor takes the values, validates them, assigns them and freezes the object. +Use the static factory methods to assist in creating a Transaction object from varying data types. + +**`note`** Transaction objects implement EIP155 by default. To disable it, pass in an `@ethereumjs/common` object set before EIP155 activation (i.e. before Spurious Dragon). **Parameters:** -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`data` | Buffer | [PrefixedHexString](../modules/_index_.md#prefixedhexstring) | [BufferLike](../modules/_index_.md#bufferlike)[] | [TxData](../interfaces/_index_.txdata.md) | {} | A transaction can be initialized with its rlp representation, an array containing the value of its fields in order, or an object containing them by name. | -`opts` | [TransactionOptions](../interfaces/_index_.transactionoptions.md) | {} | The transaction's options, used to indicate the chain and hardfork the transactions belongs to. | +Name | Type | +------ | ------ | +`nonce` | BN | +`gasPrice` | BN | +`gasLimit` | BN | +`to` | Address | undefined | +`value` | BN | +`data` | Buffer | +`v?` | BN | +`r?` | BN | +`s?` | BN | +`opts?` | [TxOptions](../interfaces/_index_.txoptions.md) | **Returns:** *[Transaction](_transaction_.transaction.md)* ## Properties -### data +### common -• **data**: *Buffer* +• **common**: *Common* -*Defined in [transaction.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L30)* +*Defined in [transaction.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L28)* ___ -### gasLimit +### data -• **gasLimit**: *Buffer* +• **data**: *Buffer* -*Defined in [transaction.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L26)* +*Defined in [transaction.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L34)* ___ -### gasPrice +### gasLimit -• **gasPrice**: *Buffer* +• **gasLimit**: *BN* -*Defined in [transaction.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L27)* +*Defined in [transaction.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L30)* ___ -### nonce +### gasPrice -• **nonce**: *Buffer* +• **gasPrice**: *BN* -*Defined in [transaction.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L25)* +*Defined in [transaction.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L31)* ___ -### r +### nonce -• **r**: *Buffer* +• **nonce**: *BN* -*Defined in [transaction.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L32)* +*Defined in [transaction.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L29)* ___ -### raw +### `Optional` r -• **raw**: *Buffer[]* +• **r**? : *BN* -*Defined in [transaction.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L24)* +*Defined in [transaction.ts:36](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L36)* ___ -### s +### `Optional` s -• **s**: *Buffer* +• **s**? : *BN* -*Defined in [transaction.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L33)* +*Defined in [transaction.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L37)* ___ -### to +### `Optional` to -• **to**: *Buffer* +• **to**? : *Address* -*Defined in [transaction.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L28)* +*Defined in [transaction.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L32)* ___ -### v +### `Optional` v -• **v**: *Buffer* +• **v**? : *BN* -*Defined in [transaction.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L31)* +*Defined in [transaction.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L35)* ___ ### value -• **value**: *Buffer* +• **value**: *BN* -*Defined in [transaction.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L29)* +*Defined in [transaction.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L33)* ## Methods @@ -168,9 +166,9 @@ ___ ▸ **getBaseFee**(): *BN* -*Defined in [transaction.ts:295](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L295)* +*Defined in [transaction.ts:292](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L292)* -the minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) +The minimum amount of gas the tx must have (DataFee + TxFee + Creation Fee) **Returns:** *BN* @@ -180,9 +178,9 @@ ___ ▸ **getChainId**(): *number* -*Defined in [transaction.ts:201](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L201)* +*Defined in [transaction.ts:179](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L179)* -returns chain ID +Returns chain ID **Returns:** *number* @@ -192,7 +190,7 @@ ___ ▸ **getDataFee**(): *BN* -*Defined in [transaction.ts:281](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L281)* +*Defined in [transaction.ts:278](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L278)* The amount of gas paid for the data in this tx @@ -200,15 +198,35 @@ The amount of gas paid for the data in this tx ___ +### getMessageToSign + +▸ **getMessageToSign**(): *Buffer‹›* + +*Defined in [transaction.ts:168](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L168)* + +**Returns:** *Buffer‹›* + +___ + +### getMessageToVerifySignature + +▸ **getMessageToVerifySignature**(): *Buffer‹›* + +*Defined in [transaction.ts:172](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L172)* + +**Returns:** *Buffer‹›* + +___ + ### getSenderAddress -▸ **getSenderAddress**(): *Buffer* +▸ **getSenderAddress**(): *Address* -*Defined in [transaction.ts:208](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L208)* +*Defined in [transaction.ts:186](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L186)* -returns the sender's address +Returns the sender's address -**Returns:** *Buffer* +**Returns:** *Address* ___ @@ -216,9 +234,9 @@ ___ ▸ **getSenderPublicKey**(): *Buffer* -*Defined in [transaction.ts:220](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L220)* +*Defined in [transaction.ts:193](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L193)* -returns the public key of the sender +Returns the public key of the sender **Returns:** *Buffer* @@ -228,9 +246,9 @@ ___ ▸ **getUpfrontCost**(): *BN* -*Defined in [transaction.ts:306](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L306)* +*Defined in [transaction.ts:303](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L303)* -the up front amount that an account must have for this transaction to be valid +The up front amount that an account must have for this transaction to be valid **Returns:** *BN* @@ -238,19 +256,35 @@ ___ ### hash -▸ **hash**(`includeSignature`: boolean): *Buffer* +▸ **hash**(): *Buffer* -*Defined in [transaction.ts:177](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L177)* +*Defined in [transaction.ts:152](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L152)* Computes a sha3-256 hash of the serialized tx -**Parameters:** +**Returns:** *Buffer* + +___ -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`includeSignature` | boolean | true | Whether or not to include the signature | +### isSigned -**Returns:** *Buffer* +▸ **isSigned**(): *boolean* + +*Defined in [transaction.ts:368](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L368)* + +**Returns:** *boolean* + +___ + +### raw + +▸ **raw**(): *Buffer[]* + +*Defined in [transaction.ts:330](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L330)* + +Returns a Buffer Array of the raw Buffers of this transaction, in order. + +**Returns:** *Buffer[]* ___ @@ -258,9 +292,9 @@ ___ ▸ **serialize**(): *Buffer* -*Defined in [transaction.ts:336](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L336)* +*Defined in [transaction.ts:347](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L347)* -Returns the rlp encoding of the transaction +Returns the rlp encoding of the transaction. **Returns:** *Buffer* @@ -268,19 +302,25 @@ ___ ### sign -▸ **sign**(`privateKey`: Buffer): *void* +▸ **sign**(`privateKey`: Buffer): *[Transaction](_index_.transaction.md)‹›* -*Defined in [transaction.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L261)* +*Defined in [transaction.ts:242](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L242)* -sign a transaction with a given private key +Sign a transaction with a given private key. +Returns a new Transaction object (the original tx will not be modified). +Example: +```typescript +const unsignedTx = Transaction.fromTxData(txData) +const signedTx = unsignedTx.sign(privKey) +``` **Parameters:** Name | Type | Description | ------ | ------ | ------ | -`privateKey` | Buffer | Must be 32 bytes in length | +`privateKey` | Buffer | Must be 32 bytes in length. | -**Returns:** *void* +**Returns:** *[Transaction](_index_.transaction.md)‹›* ___ @@ -288,7 +328,7 @@ ___ ▸ **toCreationAddress**(): *boolean* -*Defined in [transaction.ts:169](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L169)* +*Defined in [transaction.ts:145](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L145)* If the tx's `to` is to the creation address @@ -298,21 +338,13 @@ ___ ### toJSON -▸ **toJSON**(`labels`: boolean): *object | string[]* - -*Defined in [transaction.ts:345](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L345)* +▸ **toJSON**(): *[JsonTx](../interfaces/_index_.jsontx.md)* -Returns the transaction in JSON format +*Defined in [transaction.ts:354](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L354)* -**`see`** [ethereumjs-util](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/index.md#defineproperties) +Returns an object with the JSON representation of the transaction -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`labels` | boolean | false | - -**Returns:** *object | string[]* +**Returns:** *[JsonTx](../interfaces/_index_.jsontx.md)* ___ @@ -320,7 +352,7 @@ ___ ▸ **validate**(): *boolean* -*Defined in [transaction.ts:313](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L313)* +*Defined in [transaction.ts:310](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L310)* Validates the signature and checks to see if it has enough gas. @@ -328,7 +360,7 @@ Validates the signature and checks to see if it has enough gas. ▸ **validate**(`stringError`: false): *boolean* -*Defined in [transaction.ts:314](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L314)* +*Defined in [transaction.ts:311](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L311)* **Parameters:** @@ -338,9 +370,9 @@ Name | Type | **Returns:** *boolean* -▸ **validate**(`stringError`: true): *string* +▸ **validate**(`stringError`: true): *string[]* -*Defined in [transaction.ts:315](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L315)* +*Defined in [transaction.ts:312](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L312)* **Parameters:** @@ -348,7 +380,7 @@ Name | Type | ------ | ------ | `stringError` | true | -**Returns:** *string* +**Returns:** *string[]* ___ @@ -356,8 +388,59 @@ ___ ▸ **verifySignature**(): *boolean* -*Defined in [transaction.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L232)* +*Defined in [transaction.ts:224](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L224)* Determines if the signature is valid **Returns:** *boolean* + +___ + +### `Static` fromRlpSerializedTx + +▸ **fromRlpSerializedTx**(`serialized`: Buffer, `opts?`: [TxOptions](../interfaces/_index_.txoptions.md)): *[Transaction](_index_.transaction.md)‹›* + +*Defined in [transaction.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L56)* + +**Parameters:** + +Name | Type | +------ | ------ | +`serialized` | Buffer | +`opts?` | [TxOptions](../interfaces/_index_.txoptions.md) | + +**Returns:** *[Transaction](_index_.transaction.md)‹›* + +___ + +### `Static` fromTxData + +▸ **fromTxData**(`txData`: [TxData](../interfaces/_index_.txdata.md), `opts?`: [TxOptions](../interfaces/_index_.txoptions.md)): *[Transaction](_index_.transaction.md)‹›* + +*Defined in [transaction.ts:39](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L39)* + +**Parameters:** + +Name | Type | +------ | ------ | +`txData` | [TxData](../interfaces/_index_.txdata.md) | +`opts?` | [TxOptions](../interfaces/_index_.txoptions.md) | + +**Returns:** *[Transaction](_index_.transaction.md)‹›* + +___ + +### `Static` fromValuesArray + +▸ **fromValuesArray**(`values`: Buffer[], `opts?`: [TxOptions](../interfaces/_index_.txoptions.md)): *[Transaction](_index_.transaction.md)‹›* + +*Defined in [transaction.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/transaction.ts#L66)* + +**Parameters:** + +Name | Type | +------ | ------ | +`values` | Buffer[] | +`opts?` | [TxOptions](../interfaces/_index_.txoptions.md) | + +**Returns:** *[Transaction](_index_.transaction.md)‹›* diff --git a/packages/tx/docs/interfaces/_index_.faketxdata.md b/packages/tx/docs/interfaces/_index_.faketxdata.md deleted file mode 100644 index a9b6fdf17d..0000000000 --- a/packages/tx/docs/interfaces/_index_.faketxdata.md +++ /dev/null @@ -1,144 +0,0 @@ -[@ethereumjs/tx](../README.md) › ["index"](../modules/_index_.md) › [FakeTxData](_index_.faketxdata.md) - -# Interface: FakeTxData - -The data of a fake (self-signing) transaction. - -## Hierarchy - -* [TxData](_index_.txdata.md) - - ↳ **FakeTxData** - -## Index - -### Properties - -* [data](_index_.faketxdata.md#optional-data) -* [from](_index_.faketxdata.md#optional-from) -* [gasLimit](_index_.faketxdata.md#optional-gaslimit) -* [gasPrice](_index_.faketxdata.md#optional-gasprice) -* [nonce](_index_.faketxdata.md#optional-nonce) -* [r](_index_.faketxdata.md#optional-r) -* [s](_index_.faketxdata.md#optional-s) -* [to](_index_.faketxdata.md#optional-to) -* [v](_index_.faketxdata.md#optional-v) -* [value](_index_.faketxdata.md#optional-value) - -## Properties - -### `Optional` data - -• **data**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[data](_index_.txdata.md#optional-data)* - -*Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L47)* - -This will contain the data of the message or the init of a contract - -___ - -### `Optional` from - -• **from**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Defined in [types.ts:77](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L77)* - -The sender of the Tx. - -___ - -### `Optional` gasLimit - -• **gasLimit**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[gasLimit](_index_.txdata.md#optional-gaslimit)* - -*Defined in [types.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L27)* - -The transaction's gas limit. - -___ - -### `Optional` gasPrice - -• **gasPrice**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[gasPrice](_index_.txdata.md#optional-gasprice)* - -*Defined in [types.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L32)* - -The transaction's gas price. - -___ - -### `Optional` nonce - -• **nonce**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[nonce](_index_.txdata.md#optional-nonce)* - -*Defined in [types.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L42)* - -The transaction's nonce. - -___ - -### `Optional` r - -• **r**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[r](_index_.txdata.md#optional-r)* - -*Defined in [types.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L57)* - -EC signature parameter. - -___ - -### `Optional` s - -• **s**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[s](_index_.txdata.md#optional-s)* - -*Defined in [types.ts:62](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L62)* - -EC signature parameter. - -___ - -### `Optional` to - -• **to**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[to](_index_.txdata.md#optional-to)* - -*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L37)* - -The transaction's the address is sent to. - -___ - -### `Optional` v - -• **v**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[v](_index_.txdata.md#optional-v)* - -*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L52)* - -EC recovery ID. - -___ - -### `Optional` value - -• **value**? : *[BufferLike](../modules/_index_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[value](_index_.txdata.md#optional-value)* - -*Defined in [types.ts:67](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L67)* - -The amount of Ether sent. diff --git a/packages/tx/docs/interfaces/_index_.jsontx.md b/packages/tx/docs/interfaces/_index_.jsontx.md new file mode 100644 index 0000000000..944254956a --- /dev/null +++ b/packages/tx/docs/interfaces/_index_.jsontx.md @@ -0,0 +1,95 @@ +[@ethereumjs/tx](../README.md) › ["index"](../modules/_index_.md) › [JsonTx](_index_.jsontx.md) + +# Interface: JsonTx + +An object with all of the transaction's values represented as strings. + +## Hierarchy + +* **JsonTx** + +## Index + +### Properties + +* [data](_index_.jsontx.md#optional-data) +* [gasLimit](_index_.jsontx.md#optional-gaslimit) +* [gasPrice](_index_.jsontx.md#optional-gasprice) +* [nonce](_index_.jsontx.md#optional-nonce) +* [r](_index_.jsontx.md#optional-r) +* [s](_index_.jsontx.md#optional-s) +* [to](_index_.jsontx.md#optional-to) +* [v](_index_.jsontx.md#optional-v) +* [value](_index_.jsontx.md#optional-value) + +## Properties + +### `Optional` data + +• **data**? : *undefined | string* + +*Defined in [types.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L76)* + +___ + +### `Optional` gasLimit + +• **gasLimit**? : *undefined | string* + +*Defined in [types.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L74)* + +___ + +### `Optional` gasPrice + +• **gasPrice**? : *undefined | string* + +*Defined in [types.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L73)* + +___ + +### `Optional` nonce + +• **nonce**? : *undefined | string* + +*Defined in [types.ts:72](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L72)* + +___ + +### `Optional` r + +• **r**? : *undefined | string* + +*Defined in [types.ts:78](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L78)* + +___ + +### `Optional` s + +• **s**? : *undefined | string* + +*Defined in [types.ts:79](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L79)* + +___ + +### `Optional` to + +• **to**? : *undefined | string* + +*Defined in [types.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L75)* + +___ + +### `Optional` v + +• **v**? : *undefined | string* + +*Defined in [types.ts:77](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L77)* + +___ + +### `Optional` value + +• **value**? : *undefined | string* + +*Defined in [types.ts:80](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L80)* diff --git a/packages/tx/docs/interfaces/_index_.transactionoptions.md b/packages/tx/docs/interfaces/_index_.transactionoptions.md deleted file mode 100644 index 4d9972002c..0000000000 --- a/packages/tx/docs/interfaces/_index_.transactionoptions.md +++ /dev/null @@ -1,49 +0,0 @@ -[@ethereumjs/tx](../README.md) › ["index"](../modules/_index_.md) › [TransactionOptions](_index_.transactionoptions.md) - -# Interface: TransactionOptions - -An object to set to which blockchain the blocks and their headers belong. This could be specified -using a Common object, or `chain` and `hardfork`. Defaults to mainnet without specifying a -hardfork. - -## Hierarchy - -* **TransactionOptions** - -## Index - -### Properties - -* [chain](_index_.transactionoptions.md#optional-chain) -* [common](_index_.transactionoptions.md#optional-common) -* [hardfork](_index_.transactionoptions.md#optional-hardfork) - -## Properties - -### `Optional` chain - -• **chain**? : *number | string* - -*Defined in [types.ts:94](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L94)* - -The chain of the transaction, default: 'mainnet' - -___ - -### `Optional` common - -• **common**? : *Common* - -*Defined in [types.ts:89](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L89)* - -A Common object defining the chain and the hardfork a transaction belongs to. - -___ - -### `Optional` hardfork - -• **hardfork**? : *undefined | string* - -*Defined in [types.ts:99](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L99)* - -The hardfork of the transaction, default: 'petersburg' diff --git a/packages/tx/docs/interfaces/_index_.transformabletobuffer.md b/packages/tx/docs/interfaces/_index_.transformabletobuffer.md deleted file mode 100644 index 15a78aebc9..0000000000 --- a/packages/tx/docs/interfaces/_index_.transformabletobuffer.md +++ /dev/null @@ -1,25 +0,0 @@ -[@ethereumjs/tx](../README.md) › ["index"](../modules/_index_.md) › [TransformableToBuffer](_index_.transformabletobuffer.md) - -# Interface: TransformableToBuffer - -Any object that can be transformed into a `Buffer` - -## Hierarchy - -* **TransformableToBuffer** - -## Index - -### Methods - -* [toBuffer](_index_.transformabletobuffer.md#tobuffer) - -## Methods - -### toBuffer - -▸ **toBuffer**(): *Buffer* - -*Defined in [types.ts:7](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L7)* - -**Returns:** *Buffer* diff --git a/packages/tx/docs/interfaces/_index_.txdata.md b/packages/tx/docs/interfaces/_index_.txdata.md index 0520a59abe..4e49a6c348 100644 --- a/packages/tx/docs/interfaces/_index_.txdata.md +++ b/packages/tx/docs/interfaces/_index_.txdata.md @@ -2,16 +2,12 @@ # Interface: TxData -A transaction's data. +An object with an optional field with each of the transaction's values. ## Hierarchy * **TxData** - ↳ [FakeTxData](_index_.faketxdata.md) - - ↳ [FakeTxData](_types_.faketxdata.md) - ## Index ### Properties @@ -30,19 +26,19 @@ A transaction's data. ### `Optional` data -• **data**? : *[BufferLike](../modules/_index_.md#bufferlike)* +• **data**? : *BufferLike* -*Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L47)* +*Defined in [types.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L50)* -This will contain the data of the message or the init of a contract +This will contain the data of the message or the init of a contract. ___ ### `Optional` gasLimit -• **gasLimit**? : *[BufferLike](../modules/_index_.md#bufferlike)* +• **gasLimit**? : *BNLike* -*Defined in [types.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L27)* +*Defined in [types.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L35)* The transaction's gas limit. @@ -50,9 +46,9 @@ ___ ### `Optional` gasPrice -• **gasPrice**? : *[BufferLike](../modules/_index_.md#bufferlike)* +• **gasPrice**? : *BNLike* -*Defined in [types.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L32)* +*Defined in [types.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L30)* The transaction's gas price. @@ -60,9 +56,9 @@ ___ ### `Optional` nonce -• **nonce**? : *[BufferLike](../modules/_index_.md#bufferlike)* +• **nonce**? : *BNLike* -*Defined in [types.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L42)* +*Defined in [types.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L25)* The transaction's nonce. @@ -70,9 +66,9 @@ ___ ### `Optional` r -• **r**? : *[BufferLike](../modules/_index_.md#bufferlike)* +• **r**? : *BNLike* -*Defined in [types.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L57)* +*Defined in [types.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L60)* EC signature parameter. @@ -80,9 +76,9 @@ ___ ### `Optional` s -• **s**? : *[BufferLike](../modules/_index_.md#bufferlike)* +• **s**? : *BNLike* -*Defined in [types.ts:62](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L62)* +*Defined in [types.ts:65](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L65)* EC signature parameter. @@ -90,9 +86,9 @@ ___ ### `Optional` to -• **to**? : *[BufferLike](../modules/_index_.md#bufferlike)* +• **to**? : *AddressLike* -*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L37)* +*Defined in [types.ts:40](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L40)* The transaction's the address is sent to. @@ -100,9 +96,9 @@ ___ ### `Optional` v -• **v**? : *[BufferLike](../modules/_index_.md#bufferlike)* +• **v**? : *BNLike* -*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L52)* +*Defined in [types.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L55)* EC recovery ID. @@ -110,8 +106,8 @@ ___ ### `Optional` value -• **value**? : *[BufferLike](../modules/_index_.md#bufferlike)* +• **value**? : *BNLike* -*Defined in [types.ts:67](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L67)* +*Defined in [types.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L45)* The amount of Ether sent. diff --git a/packages/tx/docs/interfaces/_index_.txoptions.md b/packages/tx/docs/interfaces/_index_.txoptions.md new file mode 100644 index 0000000000..f569047514 --- /dev/null +++ b/packages/tx/docs/interfaces/_index_.txoptions.md @@ -0,0 +1,29 @@ +[@ethereumjs/tx](../README.md) › ["index"](../modules/_index_.md) › [TxOptions](_index_.txoptions.md) + +# Interface: TxOptions + +The options for initializing a Transaction. + +## Hierarchy + +* **TxOptions** + +## Index + +### Properties + +* [common](_index_.txoptions.md#optional-common) + +## Properties + +### `Optional` common + +• **common**? : *Common* + +*Defined in [types.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L15)* + +A Common object defining the chain and hardfork for the transaction. + +Default: `Common` object set to `mainnet` and the default hardfork as defined in the `Common` class. + +Current default hardfork: `istanbul` diff --git a/packages/tx/docs/interfaces/_types_.faketxdata.md b/packages/tx/docs/interfaces/_types_.faketxdata.md deleted file mode 100644 index 100ca9253e..0000000000 --- a/packages/tx/docs/interfaces/_types_.faketxdata.md +++ /dev/null @@ -1,144 +0,0 @@ -[@ethereumjs/tx](../README.md) › ["types"](../modules/_types_.md) › [FakeTxData](_types_.faketxdata.md) - -# Interface: FakeTxData - -The data of a fake (self-signing) transaction. - -## Hierarchy - -* [TxData](_index_.txdata.md) - - ↳ **FakeTxData** - -## Index - -### Properties - -* [data](_types_.faketxdata.md#optional-data) -* [from](_types_.faketxdata.md#optional-from) -* [gasLimit](_types_.faketxdata.md#optional-gaslimit) -* [gasPrice](_types_.faketxdata.md#optional-gasprice) -* [nonce](_types_.faketxdata.md#optional-nonce) -* [r](_types_.faketxdata.md#optional-r) -* [s](_types_.faketxdata.md#optional-s) -* [to](_types_.faketxdata.md#optional-to) -* [v](_types_.faketxdata.md#optional-v) -* [value](_types_.faketxdata.md#optional-value) - -## Properties - -### `Optional` data - -• **data**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[data](_index_.txdata.md#optional-data)* - -*Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L47)* - -This will contain the data of the message or the init of a contract - -___ - -### `Optional` from - -• **from**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Defined in [types.ts:77](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L77)* - -The sender of the Tx. - -___ - -### `Optional` gasLimit - -• **gasLimit**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[gasLimit](_index_.txdata.md#optional-gaslimit)* - -*Defined in [types.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L27)* - -The transaction's gas limit. - -___ - -### `Optional` gasPrice - -• **gasPrice**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[gasPrice](_index_.txdata.md#optional-gasprice)* - -*Defined in [types.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L32)* - -The transaction's gas price. - -___ - -### `Optional` nonce - -• **nonce**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[nonce](_index_.txdata.md#optional-nonce)* - -*Defined in [types.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L42)* - -The transaction's nonce. - -___ - -### `Optional` r - -• **r**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[r](_index_.txdata.md#optional-r)* - -*Defined in [types.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L57)* - -EC signature parameter. - -___ - -### `Optional` s - -• **s**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[s](_index_.txdata.md#optional-s)* - -*Defined in [types.ts:62](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L62)* - -EC signature parameter. - -___ - -### `Optional` to - -• **to**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[to](_index_.txdata.md#optional-to)* - -*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L37)* - -The transaction's the address is sent to. - -___ - -### `Optional` v - -• **v**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[v](_index_.txdata.md#optional-v)* - -*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L52)* - -EC recovery ID. - -___ - -### `Optional` value - -• **value**? : *[BufferLike](../modules/_types_.md#bufferlike)* - -*Inherited from [TxData](_index_.txdata.md).[value](_index_.txdata.md#optional-value)* - -*Defined in [types.ts:67](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L67)* - -The amount of Ether sent. diff --git a/packages/tx/docs/interfaces/_types_.jsontx.md b/packages/tx/docs/interfaces/_types_.jsontx.md new file mode 100644 index 0000000000..c2e3212fb7 --- /dev/null +++ b/packages/tx/docs/interfaces/_types_.jsontx.md @@ -0,0 +1,95 @@ +[@ethereumjs/tx](../README.md) › ["types"](../modules/_types_.md) › [JsonTx](_types_.jsontx.md) + +# Interface: JsonTx + +An object with all of the transaction's values represented as strings. + +## Hierarchy + +* **JsonTx** + +## Index + +### Properties + +* [data](_types_.jsontx.md#optional-data) +* [gasLimit](_types_.jsontx.md#optional-gaslimit) +* [gasPrice](_types_.jsontx.md#optional-gasprice) +* [nonce](_types_.jsontx.md#optional-nonce) +* [r](_types_.jsontx.md#optional-r) +* [s](_types_.jsontx.md#optional-s) +* [to](_types_.jsontx.md#optional-to) +* [v](_types_.jsontx.md#optional-v) +* [value](_types_.jsontx.md#optional-value) + +## Properties + +### `Optional` data + +• **data**? : *undefined | string* + +*Defined in [types.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L76)* + +___ + +### `Optional` gasLimit + +• **gasLimit**? : *undefined | string* + +*Defined in [types.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L74)* + +___ + +### `Optional` gasPrice + +• **gasPrice**? : *undefined | string* + +*Defined in [types.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L73)* + +___ + +### `Optional` nonce + +• **nonce**? : *undefined | string* + +*Defined in [types.ts:72](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L72)* + +___ + +### `Optional` r + +• **r**? : *undefined | string* + +*Defined in [types.ts:78](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L78)* + +___ + +### `Optional` s + +• **s**? : *undefined | string* + +*Defined in [types.ts:79](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L79)* + +___ + +### `Optional` to + +• **to**? : *undefined | string* + +*Defined in [types.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L75)* + +___ + +### `Optional` v + +• **v**? : *undefined | string* + +*Defined in [types.ts:77](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L77)* + +___ + +### `Optional` value + +• **value**? : *undefined | string* + +*Defined in [types.ts:80](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L80)* diff --git a/packages/tx/docs/interfaces/_types_.transactionoptions.md b/packages/tx/docs/interfaces/_types_.transactionoptions.md deleted file mode 100644 index e37daaeed1..0000000000 --- a/packages/tx/docs/interfaces/_types_.transactionoptions.md +++ /dev/null @@ -1,49 +0,0 @@ -[@ethereumjs/tx](../README.md) › ["types"](../modules/_types_.md) › [TransactionOptions](_types_.transactionoptions.md) - -# Interface: TransactionOptions - -An object to set to which blockchain the blocks and their headers belong. This could be specified -using a Common object, or `chain` and `hardfork`. Defaults to mainnet without specifying a -hardfork. - -## Hierarchy - -* **TransactionOptions** - -## Index - -### Properties - -* [chain](_types_.transactionoptions.md#optional-chain) -* [common](_types_.transactionoptions.md#optional-common) -* [hardfork](_types_.transactionoptions.md#optional-hardfork) - -## Properties - -### `Optional` chain - -• **chain**? : *number | string* - -*Defined in [types.ts:94](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L94)* - -The chain of the transaction, default: 'mainnet' - -___ - -### `Optional` common - -• **common**? : *Common* - -*Defined in [types.ts:89](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L89)* - -A Common object defining the chain and the hardfork a transaction belongs to. - -___ - -### `Optional` hardfork - -• **hardfork**? : *undefined | string* - -*Defined in [types.ts:99](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L99)* - -The hardfork of the transaction, default: 'petersburg' diff --git a/packages/tx/docs/interfaces/_types_.transformabletobuffer.md b/packages/tx/docs/interfaces/_types_.transformabletobuffer.md deleted file mode 100644 index 8ba7872b33..0000000000 --- a/packages/tx/docs/interfaces/_types_.transformabletobuffer.md +++ /dev/null @@ -1,25 +0,0 @@ -[@ethereumjs/tx](../README.md) › ["types"](../modules/_types_.md) › [TransformableToBuffer](_types_.transformabletobuffer.md) - -# Interface: TransformableToBuffer - -Any object that can be transformed into a `Buffer` - -## Hierarchy - -* **TransformableToBuffer** - -## Index - -### Methods - -* [toBuffer](_types_.transformabletobuffer.md#tobuffer) - -## Methods - -### toBuffer - -▸ **toBuffer**(): *Buffer* - -*Defined in [types.ts:7](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L7)* - -**Returns:** *Buffer* diff --git a/packages/tx/docs/interfaces/_types_.txdata.md b/packages/tx/docs/interfaces/_types_.txdata.md index 718309298e..1737904a8a 100644 --- a/packages/tx/docs/interfaces/_types_.txdata.md +++ b/packages/tx/docs/interfaces/_types_.txdata.md @@ -2,7 +2,7 @@ # Interface: TxData -A transaction's data. +An object with an optional field with each of the transaction's values. ## Hierarchy @@ -26,19 +26,19 @@ A transaction's data. ### `Optional` data -• **data**? : *[BufferLike](../modules/_types_.md#bufferlike)* +• **data**? : *BufferLike* -*Defined in [types.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L47)* +*Defined in [types.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L50)* -This will contain the data of the message or the init of a contract +This will contain the data of the message or the init of a contract. ___ ### `Optional` gasLimit -• **gasLimit**? : *[BufferLike](../modules/_types_.md#bufferlike)* +• **gasLimit**? : *BNLike* -*Defined in [types.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L27)* +*Defined in [types.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L35)* The transaction's gas limit. @@ -46,9 +46,9 @@ ___ ### `Optional` gasPrice -• **gasPrice**? : *[BufferLike](../modules/_types_.md#bufferlike)* +• **gasPrice**? : *BNLike* -*Defined in [types.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L32)* +*Defined in [types.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L30)* The transaction's gas price. @@ -56,9 +56,9 @@ ___ ### `Optional` nonce -• **nonce**? : *[BufferLike](../modules/_types_.md#bufferlike)* +• **nonce**? : *BNLike* -*Defined in [types.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L42)* +*Defined in [types.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L25)* The transaction's nonce. @@ -66,9 +66,9 @@ ___ ### `Optional` r -• **r**? : *[BufferLike](../modules/_types_.md#bufferlike)* +• **r**? : *BNLike* -*Defined in [types.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L57)* +*Defined in [types.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L60)* EC signature parameter. @@ -76,9 +76,9 @@ ___ ### `Optional` s -• **s**? : *[BufferLike](../modules/_types_.md#bufferlike)* +• **s**? : *BNLike* -*Defined in [types.ts:62](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L62)* +*Defined in [types.ts:65](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L65)* EC signature parameter. @@ -86,9 +86,9 @@ ___ ### `Optional` to -• **to**? : *[BufferLike](../modules/_types_.md#bufferlike)* +• **to**? : *AddressLike* -*Defined in [types.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L37)* +*Defined in [types.ts:40](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L40)* The transaction's the address is sent to. @@ -96,9 +96,9 @@ ___ ### `Optional` v -• **v**? : *[BufferLike](../modules/_types_.md#bufferlike)* +• **v**? : *BNLike* -*Defined in [types.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L52)* +*Defined in [types.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L55)* EC recovery ID. @@ -106,8 +106,8 @@ ___ ### `Optional` value -• **value**? : *[BufferLike](../modules/_types_.md#bufferlike)* +• **value**? : *BNLike* -*Defined in [types.ts:67](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L67)* +*Defined in [types.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L45)* The amount of Ether sent. diff --git a/packages/tx/docs/interfaces/_types_.txoptions.md b/packages/tx/docs/interfaces/_types_.txoptions.md new file mode 100644 index 0000000000..ab716be86d --- /dev/null +++ b/packages/tx/docs/interfaces/_types_.txoptions.md @@ -0,0 +1,29 @@ +[@ethereumjs/tx](../README.md) › ["types"](../modules/_types_.md) › [TxOptions](_types_.txoptions.md) + +# Interface: TxOptions + +The options for initializing a Transaction. + +## Hierarchy + +* **TxOptions** + +## Index + +### Properties + +* [common](_types_.txoptions.md#optional-common) + +## Properties + +### `Optional` common + +• **common**? : *Common* + +*Defined in [types.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L15)* + +A Common object defining the chain and hardfork for the transaction. + +Default: `Common` object set to `mainnet` and the default hardfork as defined in the `Common` class. + +Current default hardfork: `istanbul` diff --git a/packages/tx/docs/modules/_fake_.md b/packages/tx/docs/modules/_fake_.md deleted file mode 100644 index db61643f1f..0000000000 --- a/packages/tx/docs/modules/_fake_.md +++ /dev/null @@ -1,9 +0,0 @@ -[@ethereumjs/tx](../README.md) › ["fake"](_fake_.md) - -# Module: "fake" - -## Index - -### Classes - -* [FakeTransaction](../classes/_fake_.faketransaction.md) diff --git a/packages/tx/docs/modules/_index_.md b/packages/tx/docs/modules/_index_.md index 48f1fe3ea2..6f20238e2f 100644 --- a/packages/tx/docs/modules/_index_.md +++ b/packages/tx/docs/modules/_index_.md @@ -6,37 +6,10 @@ ### Classes -* [FakeTransaction](../classes/_index_.faketransaction.md) * [Transaction](../classes/_index_.transaction.md) ### Interfaces -* [FakeTxData](../interfaces/_index_.faketxdata.md) -* [TransactionOptions](../interfaces/_index_.transactionoptions.md) -* [TransformableToBuffer](../interfaces/_index_.transformabletobuffer.md) +* [JsonTx](../interfaces/_index_.jsontx.md) * [TxData](../interfaces/_index_.txdata.md) - -### Type aliases - -* [BufferLike](_index_.md#bufferlike) -* [PrefixedHexString](_index_.md#prefixedhexstring) - -## Type aliases - -### BufferLike - -Ƭ **BufferLike**: *Buffer | [TransformableToBuffer](../interfaces/_index_.transformabletobuffer.md) | [PrefixedHexString](_index_.md#prefixedhexstring) | number* - -*Defined in [types.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L18)* - -A Buffer, hex string prefixed with `0x`, Number, or an object with a toBuffer method such as BN. - -___ - -### PrefixedHexString - -Ƭ **PrefixedHexString**: *string* - -*Defined in [types.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L13)* - -A hex string prefixed with `0x`. +* [TxOptions](../interfaces/_index_.txoptions.md) diff --git a/packages/tx/docs/modules/_types_.md b/packages/tx/docs/modules/_types_.md index d06db4430d..9081033d99 100644 --- a/packages/tx/docs/modules/_types_.md +++ b/packages/tx/docs/modules/_types_.md @@ -6,32 +6,6 @@ ### Interfaces -* [FakeTxData](../interfaces/_types_.faketxdata.md) -* [TransactionOptions](../interfaces/_types_.transactionoptions.md) -* [TransformableToBuffer](../interfaces/_types_.transformabletobuffer.md) +* [JsonTx](../interfaces/_types_.jsontx.md) * [TxData](../interfaces/_types_.txdata.md) - -### Type aliases - -* [BufferLike](_types_.md#bufferlike) -* [PrefixedHexString](_types_.md#prefixedhexstring) - -## Type aliases - -### BufferLike - -Ƭ **BufferLike**: *Buffer | [TransformableToBuffer](../interfaces/_index_.transformabletobuffer.md) | [PrefixedHexString](_types_.md#prefixedhexstring) | number* - -*Defined in [types.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L18)* - -A Buffer, hex string prefixed with `0x`, Number, or an object with a toBuffer method such as BN. - -___ - -### PrefixedHexString - -Ƭ **PrefixedHexString**: *string* - -*Defined in [types.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/tx/src/types.ts#L13)* - -A hex string prefixed with `0x`. +* [TxOptions](../interfaces/_types_.txoptions.md) diff --git a/packages/tx/package.json b/packages/tx/package.json index 210d6f7d54..b90dd46d9c 100644 --- a/packages/tx/package.json +++ b/packages/tx/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/tx", - "version": "2.1.2", + "version": "3.0.0-beta.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": "^1.5.1", + "@ethereumjs/common": "2.0.0-beta.1", "ethereumjs-util": "^7.0.7" }, "devDependencies": { diff --git a/packages/vm/CHANGELOG.md b/packages/vm/CHANGELOG.md index 7db6de11db..2955dd5bfb 100644 --- a/packages/vm/CHANGELOG.md +++ b/packages/vm/CHANGELOG.md @@ -6,7 +6,7 @@ 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] - [UNRELEASED] +## 5.0.0-beta.1 - 2020-10-22 ### New Package Name @@ -75,7 +75,10 @@ since there is still an ongoing discussion on taking this EIP in for Berlin or using a more generalized approach on curve computation with the Ethereum EVM (`evm384` by the eWASM team). -The integration comes along with an API addition to the VM to support the activation +Another new EIP added is the `EIP-2929` with gas cost increases for state access +opcodes, see PR [#889](https://github.com/ethereumjs/ethereumjs-vm/pull/889). + +These integrations come along with an API addition to the VM to support the activation of specific EIPs, see PR [#856](https://github.com/ethereumjs/ethereumjs-vm/pull/856), PR [#869](https://github.com/ethereumjs/ethereumjs-vm/pull/869) and PR [#872](https://github.com/ethereumjs/ethereumjs-vm/pull/872). @@ -105,7 +108,7 @@ package name changes! All these libraries are now written in `TypeScript` and use promises instead of callbacks for accessing their APIs. -### New StateManager Interface +### New StateManager Interface / StateManager API Changes There is now a new `TypeScript` interface for the `StateManager`, see PR [#763](https://github.com/ethereumjs/ethereumjs-vm/pull/763). If you are @@ -113,6 +116,29 @@ using a custom `StateManager` you can use this interface to get better assurance that you are using a `StateManager` which conforms with the current `StateManager` API and will run in the VM without problems. +The integration of this new interface is highly encouraged since this release +also comes with `StateManager` API changes. Usage of the old +[ethereumjs-account](https://github.com/ethereumjs/ethereumjs-account) package +(this package will be retired) has been replaced by the new +[Account class](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/modules/_account_.md) +from the `ethereumjs-util` package. This affects all `Account` related +`StateManager` methods, see PR [#911](https://github.com/ethereumjs/ethereumjs-vm/pull/911). + +The Util package also introduces a new +[Address class](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/modules/_address_.md). +This class replaces all current `Buffer` inputs on `StateManager` methods representing an address. + +### Dual ES5 and ES2017 Builds + +We significantly updated our internal tool and CI setup along the work on +PR [#913](https://github.com/ethereumjs/ethereumjs-vm/pull/913) with an update to `ESLint` from `TSLint` +for code linting and formatting and the introduction of a new build setup. + +Packages now target `ES2017` for Node.js builds (the `main` entrypoint from `package.json`) and introduce +a separate `ES5` build distributed along using the `browser` directive as an entrypoint, see +PR [#921](https://github.com/ethereumjs/ethereumjs-vm/pull/921). This will result +in performance benefits for Node.js consumers, see [here](https://github.com/ethereumjs/merkle-patricia-tree/pull/117) for a releated discussion. + ### Other Changes **Changes and Refactoring** @@ -123,6 +149,27 @@ assurance that you are using a `StateManager` which conforms with the current PR [#896](https://github.com/ethereumjs/ethereumjs-vm/pull/896) - Group precompiles based upon hardfork, PR [#783](https://github.com/ethereumjs/ethereumjs-vm/pull/783) +- **Breaking:** the `step` event now emits an `ethereumjs-util` +[Account](https://github.com/ethereumjs/ethereumjs-util/blob/master/docs/modules/_account_.md) +object instead of an [ethereumjs-account](https://github.com/ethereumjs/ethereumjs-account) +(package retired) object +- **Breaking:** `NewContractEvent` now emits an `address` of + type `Address` (see `ethereumjs-util`) instead of a `Buffer`, + PR [#919](https://github.com/ethereumjs/ethereumjs-vm/pull/919) +- **Breaking:** `EVMResult` now returns a `createdAddress` of + type `Address` (see `ethereumjs-util`) instead of a `Buffer`, + PR [#919](https://github.com/ethereumjs/ethereumjs-vm/pull/919) +- **Breaking:** `RunTxResult` now returns a `createdAddress` of + type `Address` (see `ethereumjs-util`) instead of a `Buffer`, + PR [#919](https://github.com/ethereumjs/ethereumjs-vm/pull/919) +- **Breaking:** `RunCallOpts` now expects `origin`, `caller` and + `to` inputs to be of + type `Address` (see `ethereumjs-util`) instead of a `Buffer`, + PR [#919](https://github.com/ethereumjs/ethereumjs-vm/pull/919) +- **Breaking:** `RunCodeOpts` now expects `origin`, `caller` and + `address` inputs to be of + type `Address` (see `ethereumjs-util`) instead of a `Buffer`, + PR [#919](https://github.com/ethereumjs/ethereumjs-vm/pull/919) - Make `memory.ts` use Buffers instead of Arrays, PR [#850](https://github.com/ethereumjs/ethereumjs-vm/pull/850) - Use `Map` for `OpcodeList` and `opcode` handlers, diff --git a/packages/vm/docs/README.md b/packages/vm/docs/README.md index 5a54e3ded3..383a842908 100644 --- a/packages/vm/docs/README.md +++ b/packages/vm/docs/README.md @@ -6,14 +6,56 @@ ### Modules -* ["evm/evm"](modules/_evm_evm_.md) -* ["exceptions"](modules/_exceptions_.md) -* ["index"](modules/_index_.md) -* ["runBlock"](modules/_runblock_.md) -* ["runBlockchain"](modules/_runblockchain_.md) -* ["runCall"](modules/_runcall_.md) -* ["runCode"](modules/_runcode_.md) -* ["runTx"](modules/_runtx_.md) -* ["state/index"](modules/_state_index_.md) -* ["state/interface"](modules/_state_interface_.md) -* ["state/stateManager"](modules/_state_statemanager_.md) +* ["lib/evm/evm"](modules/_lib_evm_evm_.md) +* ["lib/evm/opcodes/EIP1283"](modules/_lib_evm_opcodes_eip1283_.md) +* ["lib/evm/opcodes/EIP2200"](modules/_lib_evm_opcodes_eip2200_.md) +* ["lib/evm/opcodes/EIP2929"](modules/_lib_evm_opcodes_eip2929_.md) +* ["lib/evm/opcodes/codes"](modules/_lib_evm_opcodes_codes_.md) +* ["lib/evm/opcodes/functions"](modules/_lib_evm_opcodes_functions_.md) +* ["lib/evm/opcodes/index"](modules/_lib_evm_opcodes_index_.md) +* ["lib/evm/opcodes/util"](modules/_lib_evm_opcodes_util_.md) +* ["lib/evm/precompiles/util/bls12_381"](modules/_lib_evm_precompiles_util_bls12_381_.md) +* ["lib/exceptions"](modules/_lib_exceptions_.md) +* ["lib/index"](modules/_lib_index_.md) +* ["lib/runBlock"](modules/_lib_runblock_.md) +* ["lib/runBlockchain"](modules/_lib_runblockchain_.md) +* ["lib/runCall"](modules/_lib_runcall_.md) +* ["lib/runCode"](modules/_lib_runcode_.md) +* ["lib/runTx"](modules/_lib_runtx_.md) +* ["lib/state/index"](modules/_lib_state_index_.md) +* ["lib/state/interface"](modules/_lib_state_interface_.md) +* ["lib/state/stateManager"](modules/_lib_state_statemanager_.md) +* ["tests/BlockchainTestsRunner"](modules/_tests_blockchaintestsrunner_.md) +* ["tests/GeneralStateTestsRunner"](modules/_tests_generalstatetestsrunner_.md) +* ["tests/api/EIPs/eip-2537-BLS.spec"](modules/_tests_api_eips_eip_2537_bls_spec_.md) +* ["tests/api/EIPs/eip-2929.spec"](modules/_tests_api_eips_eip_2929_spec_.md) +* ["tests/api/berlin/eip-2315.spec"](modules/_tests_api_berlin_eip_2315_spec_.md) +* ["tests/api/bloom.spec"](modules/_tests_api_bloom_spec_.md) +* ["tests/api/events.spec"](modules/_tests_api_events_spec_.md) +* ["tests/api/evm/eei.spec"](modules/_tests_api_evm_eei_spec_.md) +* ["tests/api/evm/memory.spec"](modules/_tests_api_evm_memory_spec_.md) +* ["tests/api/evm/precompiles/06-ecadd.spec"](modules/_tests_api_evm_precompiles_06_ecadd_spec_.md) +* ["tests/api/evm/precompiles/07-ecmul.spec"](modules/_tests_api_evm_precompiles_07_ecmul_spec_.md) +* ["tests/api/evm/precompiles/08-ecpairing.spec"](modules/_tests_api_evm_precompiles_08_ecpairing_spec_.md) +* ["tests/api/evm/precompiles/hardfork.spec"](modules/_tests_api_evm_precompiles_hardfork_spec_.md) +* ["tests/api/evm/stack.spec"](modules/_tests_api_evm_stack_spec_.md) +* ["tests/api/index.spec"](modules/_tests_api_index_spec_.md) +* ["tests/api/istanbul/eip-1108.spec"](modules/_tests_api_istanbul_eip_1108_spec_.md) +* ["tests/api/istanbul/eip-1344.spec"](modules/_tests_api_istanbul_eip_1344_spec_.md) +* ["tests/api/istanbul/eip-152.spec"](modules/_tests_api_istanbul_eip_152_spec_.md) +* ["tests/api/istanbul/eip-1884.spec"](modules/_tests_api_istanbul_eip_1884_spec_.md) +* ["tests/api/istanbul/eip-2200.spec"](modules/_tests_api_istanbul_eip_2200_spec_.md) +* ["tests/api/muirGlacier/index.spec"](modules/_tests_api_muirglacier_index_spec_.md) +* ["tests/api/opcodes.spec"](modules/_tests_api_opcodes_spec_.md) +* ["tests/api/runBlock.spec"](modules/_tests_api_runblock_spec_.md) +* ["tests/api/runBlockchain.spec"](modules/_tests_api_runblockchain_spec_.md) +* ["tests/api/runCall.spec"](modules/_tests_api_runcall_spec_.md) +* ["tests/api/runCode.spec"](modules/_tests_api_runcode_spec_.md) +* ["tests/api/runTx.spec"](modules/_tests_api_runtx_spec_.md) +* ["tests/api/state/cache.spec"](modules/_tests_api_state_cache_spec_.md) +* ["tests/api/state/stateManager.spec"](modules/_tests_api_state_statemanager_spec_.md) +* ["tests/api/utils"](modules/_tests_api_utils_.md) +* ["tests/config"](modules/_tests_config_.md) +* ["tests/testLoader"](modules/_tests_testloader_.md) +* ["tests/tester"](modules/_tests_tester_.md) +* ["tests/util"](modules/_tests_util_.md) diff --git a/packages/vm/docs/classes/_exceptions_.vmerror.md b/packages/vm/docs/classes/_exceptions_.vmerror.md deleted file mode 100644 index c878771ed9..0000000000 --- a/packages/vm/docs/classes/_exceptions_.vmerror.md +++ /dev/null @@ -1,50 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["exceptions"](../modules/_exceptions_.md) › [VmError](_exceptions_.vmerror.md) - -# Class: VmError - -## Hierarchy - -* **VmError** - -## Index - -### Constructors - -* [constructor](_exceptions_.vmerror.md#constructor) - -### Properties - -* [error](_exceptions_.vmerror.md#error) -* [errorType](_exceptions_.vmerror.md#errortype) - -## Constructors - -### constructor - -\+ **new VmError**(`error`: [ERROR](../enums/_exceptions_.error.md)): *[VmError](_exceptions_.vmerror.md)* - -*Defined in [exceptions.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L22)* - -**Parameters:** - -Name | Type | ------- | ------ | -`error` | [ERROR](../enums/_exceptions_.error.md) | - -**Returns:** *[VmError](_exceptions_.vmerror.md)* - -## Properties - -### error - -• **error**: *[ERROR](../enums/_exceptions_.error.md)* - -*Defined in [exceptions.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L21)* - -___ - -### errorType - -• **errorType**: *string* - -*Defined in [exceptions.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L22)* diff --git a/packages/vm/docs/classes/_index_.vm.md b/packages/vm/docs/classes/_index_.vm.md deleted file mode 100644 index 65dd26ccdb..0000000000 --- a/packages/vm/docs/classes/_index_.vm.md +++ /dev/null @@ -1,270 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["index"](../modules/_index_.md) › [VM](_index_.vm.md) - -# Class: VM - -Execution engine which can be used to run a blockchain, individual -blocks, individual transactions, or snippets of EVM bytecode. - -This class is an AsyncEventEmitter, please consult the README to learn how to use it. - -## Hierarchy - -* any - - ↳ **VM** - -## Index - -### Constructors - -* [constructor](_index_.vm.md#constructor) - -### Properties - -* [_common](_index_.vm.md#_common) -* [_emit](_index_.vm.md#_emit) -* [_opcodes](_index_.vm.md#_opcodes) -* [allowUnlimitedContractSize](_index_.vm.md#allowunlimitedcontractsize) -* [blockchain](_index_.vm.md#blockchain) -* [opts](_index_.vm.md#opts) -* [stateManager](_index_.vm.md#statemanager) - -### Methods - -* [copy](_index_.vm.md#copy) -* [init](_index_.vm.md#init) -* [runBlock](_index_.vm.md#runblock) -* [runBlockchain](_index_.vm.md#runblockchain) -* [runCall](_index_.vm.md#runcall) -* [runCode](_index_.vm.md#runcode) -* [runTx](_index_.vm.md#runtx) -* [create](_index_.vm.md#static-create) - -## Constructors - -### constructor - -\+ **new VM**(`opts`: [VMOpts](../interfaces/_index_.vmopts.md)): *[VM](_index_.vm.md)* - -*Defined in [index.ts:86](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L86)* - -Instantiates a new [VM](_index_.vm.md) Object. - -**Parameters:** - -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`opts` | [VMOpts](../interfaces/_index_.vmopts.md) | {} | Default values for the options are: - `chain`: 'mainnet' - `hardfork`: 'petersburg' [supported: 'byzantium', 'constantinople', 'petersburg', 'istanbul' (DRAFT) (will throw on unsupported)] - `activatePrecompiles`: false - `allowUnlimitedContractSize`: false [ONLY set to `true` during debugging] | - -**Returns:** *[VM](_index_.vm.md)* - -## Properties - -### _common - -• **_common**: *Common* - -*Defined in [index.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L69)* - -___ - -### _emit - -• **_emit**: *function* - -*Defined in [index.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L74)* - -#### Type declaration: - -▸ (`topic`: string, `data`: any): *Promise‹void›* - -**Parameters:** - -Name | Type | ------- | ------ | -`topic` | string | -`data` | any | - -___ - -### _opcodes - -• **_opcodes**: *OpcodeList* - -*Defined in [index.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L73)* - -___ - -### allowUnlimitedContractSize - -• **allowUnlimitedContractSize**: *boolean* - -*Defined in [index.ts:72](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L72)* - -___ - -### blockchain - -• **blockchain**: *Blockchain* - -*Defined in [index.ts:71](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L71)* - -___ - -### opts - -• **opts**: *[VMOpts](../interfaces/_index_.vmopts.md)* - -*Defined in [index.ts:68](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L68)* - -___ - -### stateManager - -• **stateManager**: *[StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [index.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L70)* - -## Methods - -### copy - -▸ **copy**(): *[VM](_index_.vm.md)* - -*Defined in [index.ts:237](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L237)* - -Returns a copy of the [VM](_index_.vm.md) instance. - -**Returns:** *[VM](_index_.vm.md)* - -___ - -### init - -▸ **init**(): *Promise‹void›* - -*Defined in [index.ts:147](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L147)* - -**Returns:** *Promise‹void›* - -___ - -### runBlock - -▸ **runBlock**(`opts`: [RunBlockOpts](../interfaces/_runblock_.runblockopts.md)): *Promise‹[RunBlockResult](../interfaces/_runblock_.runblockresult.md)›* - -*Defined in [index.ts:197](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L197)* - -Processes the `block` running all of the transactions it contains and updating the miner's account - -This method modifies the state. If `generate` is `true`, the state modifications will be -reverted if an exception is raised. If it's `false`, it won't revert if the block's header is -invalid. If an error is thrown from an event handler, the state may or may not be reverted. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`opts` | [RunBlockOpts](../interfaces/_runblock_.runblockopts.md) | Default values for options: - `generate`: false | - -**Returns:** *Promise‹[RunBlockResult](../interfaces/_runblock_.runblockresult.md)›* - -___ - -### runBlockchain - -▸ **runBlockchain**(`blockchain`: Blockchain): *Promise‹void›* - -*Defined in [index.ts:182](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L182)* - -Processes blocks and adds them to the blockchain. - -This method modifies the state. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`blockchain` | Blockchain | An [@ethereumjs/blockchain](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/blockchain) object to process | - -**Returns:** *Promise‹void›* - -___ - -### runCall - -▸ **runCall**(`opts`: [RunCallOpts](../interfaces/_runcall_.runcallopts.md)): *Promise‹[EVMResult](../interfaces/_evm_evm_.evmresult.md)›* - -*Defined in [index.ts:219](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L219)* - -runs a call (or create) operation. - -This method modifies the state. - -**Parameters:** - -Name | Type | ------- | ------ | -`opts` | [RunCallOpts](../interfaces/_runcall_.runcallopts.md) | - -**Returns:** *Promise‹[EVMResult](../interfaces/_evm_evm_.evmresult.md)›* - -___ - -### runCode - -▸ **runCode**(`opts`: [RunCodeOpts](../interfaces/_runcode_.runcodeopts.md)): *Promise‹[ExecResult](../interfaces/_evm_evm_.execresult.md)›* - -*Defined in [index.ts:229](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L229)* - -Runs EVM code. - -This method modifies the state. - -**Parameters:** - -Name | Type | ------- | ------ | -`opts` | [RunCodeOpts](../interfaces/_runcode_.runcodeopts.md) | - -**Returns:** *Promise‹[ExecResult](../interfaces/_evm_evm_.execresult.md)›* - -___ - -### runTx - -▸ **runTx**(`opts`: [RunTxOpts](../interfaces/_runtx_.runtxopts.md)): *Promise‹[RunTxResult](../interfaces/_runtx_.runtxresult.md)›* - -*Defined in [index.ts:209](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L209)* - -Process a transaction. Run the vm. Transfers eth. Checks balances. - -This method modifies the state. If an error is thrown, the modifications are reverted, except -when the error is thrown from an event handler. In the latter case the state may or may not be -reverted. - -**Parameters:** - -Name | Type | ------- | ------ | -`opts` | [RunTxOpts](../interfaces/_runtx_.runtxopts.md) | - -**Returns:** *Promise‹[RunTxResult](../interfaces/_runtx_.runtxresult.md)›* - -___ - -### `Static` create - -▸ **create**(`opts`: [VMOpts](../interfaces/_index_.vmopts.md)): *Promise‹[VM](_index_.vm.md)›* - -*Defined in [index.ts:82](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L82)* - -VM async constructor. Creates engine instance and initializes it. - -**Parameters:** - -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`opts` | [VMOpts](../interfaces/_index_.vmopts.md) | {} | VM engine constructor options | - -**Returns:** *Promise‹[VM](_index_.vm.md)›* diff --git a/packages/vm/docs/classes/_lib_evm_opcodes_codes_.opcode.md b/packages/vm/docs/classes/_lib_evm_opcodes_codes_.opcode.md new file mode 100644 index 0000000000..7deb48b721 --- /dev/null +++ b/packages/vm/docs/classes/_lib_evm_opcodes_codes_.opcode.md @@ -0,0 +1,83 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/codes"](../modules/_lib_evm_opcodes_codes_.md) › [Opcode](_lib_evm_opcodes_codes_.opcode.md) + +# Class: Opcode + +## Hierarchy + +* **Opcode** + +## Index + +### Constructors + +* [constructor](_lib_evm_opcodes_codes_.opcode.md#constructor) + +### Properties + +* [code](_lib_evm_opcodes_codes_.opcode.md#code) +* [fee](_lib_evm_opcodes_codes_.opcode.md#fee) +* [fullName](_lib_evm_opcodes_codes_.opcode.md#fullname) +* [isAsync](_lib_evm_opcodes_codes_.opcode.md#isasync) +* [name](_lib_evm_opcodes_codes_.opcode.md#name) + +## Constructors + +### constructor + +\+ **new Opcode**(`__namedParameters`: object): *[Opcode](_lib_evm_opcodes_codes_.opcode.md)* + +*Defined in [lib/evm/opcodes/codes.ts:9](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L9)* + +**Parameters:** + +▪ **__namedParameters**: *object* + +Name | Type | +------ | ------ | +`code` | number | +`fee` | number | +`fullName` | string | +`isAsync` | boolean | +`name` | string | + +**Returns:** *[Opcode](_lib_evm_opcodes_codes_.opcode.md)* + +## Properties + +### code + +• **code**: *number* + +*Defined in [lib/evm/opcodes/codes.ts:5](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L5)* + +___ + +### fee + +• **fee**: *number* + +*Defined in [lib/evm/opcodes/codes.ts:8](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L8)* + +___ + +### fullName + +• **fullName**: *string* + +*Defined in [lib/evm/opcodes/codes.ts:7](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L7)* + +___ + +### isAsync + +• **isAsync**: *boolean* + +*Defined in [lib/evm/opcodes/codes.ts:9](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L9)* + +___ + +### name + +• **name**: *string* + +*Defined in [lib/evm/opcodes/codes.ts:6](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L6)* diff --git a/packages/vm/docs/classes/_lib_evm_opcodes_index_.opcode.md b/packages/vm/docs/classes/_lib_evm_opcodes_index_.opcode.md new file mode 100644 index 0000000000..f757589862 --- /dev/null +++ b/packages/vm/docs/classes/_lib_evm_opcodes_index_.opcode.md @@ -0,0 +1,83 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/index"](../modules/_lib_evm_opcodes_index_.md) › [Opcode](_lib_evm_opcodes_index_.opcode.md) + +# Class: Opcode + +## Hierarchy + +* **Opcode** + +## Index + +### Constructors + +* [constructor](_lib_evm_opcodes_index_.opcode.md#constructor) + +### Properties + +* [code](_lib_evm_opcodes_index_.opcode.md#code) +* [fee](_lib_evm_opcodes_index_.opcode.md#fee) +* [fullName](_lib_evm_opcodes_index_.opcode.md#fullname) +* [isAsync](_lib_evm_opcodes_index_.opcode.md#isasync) +* [name](_lib_evm_opcodes_index_.opcode.md#name) + +## Constructors + +### constructor + +\+ **new Opcode**(`__namedParameters`: object): *[Opcode](_lib_evm_opcodes_index_.opcode.md)* + +*Defined in [lib/evm/opcodes/codes.ts:9](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L9)* + +**Parameters:** + +▪ **__namedParameters**: *object* + +Name | Type | +------ | ------ | +`code` | number | +`fee` | number | +`fullName` | string | +`isAsync` | boolean | +`name` | string | + +**Returns:** *[Opcode](_lib_evm_opcodes_index_.opcode.md)* + +## Properties + +### code + +• **code**: *number* + +*Defined in [lib/evm/opcodes/codes.ts:5](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L5)* + +___ + +### fee + +• **fee**: *number* + +*Defined in [lib/evm/opcodes/codes.ts:8](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L8)* + +___ + +### fullName + +• **fullName**: *string* + +*Defined in [lib/evm/opcodes/codes.ts:7](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L7)* + +___ + +### isAsync + +• **isAsync**: *boolean* + +*Defined in [lib/evm/opcodes/codes.ts:9](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L9)* + +___ + +### name + +• **name**: *string* + +*Defined in [lib/evm/opcodes/codes.ts:6](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L6)* diff --git a/packages/vm/docs/classes/_lib_exceptions_.vmerror.md b/packages/vm/docs/classes/_lib_exceptions_.vmerror.md new file mode 100644 index 0000000000..4c3bd3003c --- /dev/null +++ b/packages/vm/docs/classes/_lib_exceptions_.vmerror.md @@ -0,0 +1,50 @@ +[@ethereumjs/vm](../README.md) › ["lib/exceptions"](../modules/_lib_exceptions_.md) › [VmError](_lib_exceptions_.vmerror.md) + +# Class: VmError + +## Hierarchy + +* **VmError** + +## Index + +### Constructors + +* [constructor](_lib_exceptions_.vmerror.md#constructor) + +### Properties + +* [error](_lib_exceptions_.vmerror.md#error) +* [errorType](_lib_exceptions_.vmerror.md#errortype) + +## Constructors + +### constructor + +\+ **new VmError**(`error`: [ERROR](../enums/_lib_exceptions_.error.md)): *[VmError](_lib_exceptions_.vmerror.md)* + +*Defined in [lib/exceptions.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L29)* + +**Parameters:** + +Name | Type | +------ | ------ | +`error` | [ERROR](../enums/_lib_exceptions_.error.md) | + +**Returns:** *[VmError](_lib_exceptions_.vmerror.md)* + +## Properties + +### error + +• **error**: *[ERROR](../enums/_lib_exceptions_.error.md)* + +*Defined in [lib/exceptions.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L28)* + +___ + +### errorType + +• **errorType**: *string* + +*Defined in [lib/exceptions.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L29)* diff --git a/packages/vm/docs/classes/_lib_index_.vm.md b/packages/vm/docs/classes/_lib_index_.vm.md new file mode 100644 index 0000000000..dd913c594f --- /dev/null +++ b/packages/vm/docs/classes/_lib_index_.vm.md @@ -0,0 +1,290 @@ +[@ethereumjs/vm](../README.md) › ["lib/index"](../modules/_lib_index_.md) › [VM](_lib_index_.vm.md) + +# Class: VM + +Execution engine which can be used to run a blockchain, individual +blocks, individual transactions, or snippets of EVM bytecode. + +This class is an AsyncEventEmitter, please consult the README to learn how to use it. + +## Hierarchy + +* any + + ↳ **VM** + +## Index + +### Constructors + +* [constructor](_lib_index_.vm.md#constructor) + +### Properties + +* [_common](_lib_index_.vm.md#_common) +* [_emit](_lib_index_.vm.md#_emit) +* [_mcl](_lib_index_.vm.md#_mcl) +* [_opcodes](_lib_index_.vm.md#_opcodes) +* [allowUnlimitedContractSize](_lib_index_.vm.md#allowunlimitedcontractsize) +* [blockchain](_lib_index_.vm.md#blockchain) +* [opts](_lib_index_.vm.md#opts) +* [stateManager](_lib_index_.vm.md#statemanager) + +### Methods + +* [_updateOpcodes](_lib_index_.vm.md#_updateopcodes) +* [copy](_lib_index_.vm.md#copy) +* [init](_lib_index_.vm.md#init) +* [runBlock](_lib_index_.vm.md#runblock) +* [runBlockchain](_lib_index_.vm.md#runblockchain) +* [runCall](_lib_index_.vm.md#runcall) +* [runCode](_lib_index_.vm.md#runcode) +* [runTx](_lib_index_.vm.md#runtx) +* [create](_lib_index_.vm.md#static-create) + +## Constructors + +### constructor + +\+ **new VM**(`opts`: [VMOpts](../interfaces/_lib_index_.vmopts.md)): *[VM](_lib_index_.vm.md)* + +*Defined in [lib/index.ts:119](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L119)* + +Instantiates a new [VM](_lib_index_.vm.md) Object. + +**Parameters:** + +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`opts` | [VMOpts](../interfaces/_lib_index_.vmopts.md) | {} | | + +**Returns:** *[VM](_lib_index_.vm.md)* + +## Properties + +### _common + +• **_common**: *Common* + +*Defined in [lib/index.ts:101](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L101)* + +___ + +### _emit + +• **_emit**: *function* + +*Defined in [lib/index.ts:106](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L106)* + +#### Type declaration: + +▸ (`topic`: string, `data`: any): *Promise‹void›* + +**Parameters:** + +Name | Type | +------ | ------ | +`topic` | string | +`data` | any | + +___ + +### _mcl + +• **_mcl**: *any* + +*Defined in [lib/index.ts:108](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L108)* + +___ + +### _opcodes + +• **_opcodes**: *[OpcodeList](../modules/_lib_evm_opcodes_codes_.md#opcodelist)* + +*Defined in [lib/index.ts:105](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L105)* + +___ + +### allowUnlimitedContractSize + +• **allowUnlimitedContractSize**: *boolean* + +*Defined in [lib/index.ts:104](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L104)* + +___ + +### blockchain + +• **blockchain**: *Blockchain* + +*Defined in [lib/index.ts:103](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L103)* + +___ + +### opts + +• **opts**: *[VMOpts](../interfaces/_lib_index_.vmopts.md)* + +*Defined in [lib/index.ts:100](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L100)* + +___ + +### stateManager + +• **stateManager**: *[StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/index.ts:102](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L102)* + +## Methods + +### _updateOpcodes + +▸ **_updateOpcodes**(): *void* + +*Defined in [lib/index.ts:200](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L200)* + +**Returns:** *void* + +___ + +### copy + +▸ **copy**(): *[VM](_lib_index_.vm.md)* + +*Defined in [lib/index.ts:307](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L307)* + +Returns a copy of the [VM](_lib_index_.vm.md) instance. + +**Returns:** *[VM](_lib_index_.vm.md)* + +___ + +### init + +▸ **init**(): *Promise‹void›* + +*Defined in [lib/index.ts:204](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L204)* + +**Returns:** *Promise‹void›* + +___ + +### runBlock + +▸ **runBlock**(`opts`: [RunBlockOpts](../interfaces/_lib_runblock_.runblockopts.md)): *Promise‹[RunBlockResult](../interfaces/_lib_runblock_.runblockresult.md)›* + +*Defined in [lib/index.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L261)* + +Processes the `block` running all of the transactions it contains and updating the miner's account + +This method modifies the state. If `generate` is `true`, the state modifications will be +reverted if an exception is raised. If it's `false`, it won't revert if the block's header is +invalid. If an error is thrown from an event handler, the state may or may not be reverted. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`opts` | [RunBlockOpts](../interfaces/_lib_runblock_.runblockopts.md) | Default values for options: - `generate`: false | + +**Returns:** *Promise‹[RunBlockResult](../interfaces/_lib_runblock_.runblockresult.md)›* + +___ + +### runBlockchain + +▸ **runBlockchain**(`blockchain?`: Blockchain): *Promise‹void›* + +*Defined in [lib/index.ts:246](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L246)* + +Processes blocks and adds them to the blockchain. + +This method modifies the state. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`blockchain?` | Blockchain | An [@ethereumjs/blockchain](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/blockchain) object to process | + +**Returns:** *Promise‹void›* + +___ + +### runCall + +▸ **runCall**(`opts`: [RunCallOpts](../interfaces/_lib_runcall_.runcallopts.md)): *Promise‹[EVMResult](../interfaces/_lib_evm_evm_.evmresult.md)›* + +*Defined in [lib/index.ts:287](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L287)* + +runs a call (or create) operation. + +This method modifies the state. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`opts` | [RunCallOpts](../interfaces/_lib_runcall_.runcallopts.md) | | + +**Returns:** *Promise‹[EVMResult](../interfaces/_lib_evm_evm_.evmresult.md)›* + +___ + +### runCode + +▸ **runCode**(`opts`: [RunCodeOpts](../interfaces/_lib_runcode_.runcodeopts.md)): *Promise‹[ExecResult](../interfaces/_lib_evm_evm_.execresult.md)›* + +*Defined in [lib/index.ts:299](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L299)* + +Runs EVM code. + +This method modifies the state. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`opts` | [RunCodeOpts](../interfaces/_lib_runcode_.runcodeopts.md) | | + +**Returns:** *Promise‹[ExecResult](../interfaces/_lib_evm_evm_.execresult.md)›* + +___ + +### runTx + +▸ **runTx**(`opts`: [RunTxOpts](../interfaces/_lib_runtx_.runtxopts.md)): *Promise‹[RunTxResult](../interfaces/_lib_runtx_.runtxresult.md)›* + +*Defined in [lib/index.ts:275](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L275)* + +Process a transaction. Run the vm. Transfers eth. Checks balances. + +This method modifies the state. If an error is thrown, the modifications are reverted, except +when the error is thrown from an event handler. In the latter case the state may or may not be +reverted. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`opts` | [RunTxOpts](../interfaces/_lib_runtx_.runtxopts.md) | | + +**Returns:** *Promise‹[RunTxResult](../interfaces/_lib_runtx_.runtxresult.md)›* + +___ + +### `Static` create + +▸ **create**(`opts`: [VMOpts](../interfaces/_lib_index_.vmopts.md)): *Promise‹[VM](_lib_index_.vm.md)›* + +*Defined in [lib/index.ts:115](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L115)* + +VM async constructor. Creates engine instance and initializes it. + +**Parameters:** + +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`opts` | [VMOpts](../interfaces/_lib_index_.vmopts.md) | {} | VM engine constructor options | + +**Returns:** *Promise‹[VM](_lib_index_.vm.md)›* diff --git a/packages/vm/docs/classes/_lib_state_index_.defaultstatemanager.md b/packages/vm/docs/classes/_lib_state_index_.defaultstatemanager.md new file mode 100644 index 0000000000..a2474c3654 --- /dev/null +++ b/packages/vm/docs/classes/_lib_state_index_.defaultstatemanager.md @@ -0,0 +1,711 @@ +[@ethereumjs/vm](../README.md) › ["lib/state/index"](../modules/_lib_state_index_.md) › [DefaultStateManager](_lib_state_index_.defaultstatemanager.md) + +# Class: DefaultStateManager + +Interface for getting and setting data from an underlying +state trie. + +## Hierarchy + +* **DefaultStateManager** + +## Implements + +* [StateManager](../interfaces/_lib_state_index_.statemanager.md) + +## Index + +### Constructors + +* [constructor](_lib_state_index_.defaultstatemanager.md#constructor) + +### Properties + +* [_cache](_lib_state_index_.defaultstatemanager.md#_cache) +* [_checkpointCount](_lib_state_index_.defaultstatemanager.md#_checkpointcount) +* [_common](_lib_state_index_.defaultstatemanager.md#_common) +* [_originalStorageCache](_lib_state_index_.defaultstatemanager.md#_originalstoragecache) +* [_storageTries](_lib_state_index_.defaultstatemanager.md#_storagetries) +* [_touched](_lib_state_index_.defaultstatemanager.md#_touched) +* [_touchedStack](_lib_state_index_.defaultstatemanager.md#_touchedstack) +* [_trie](_lib_state_index_.defaultstatemanager.md#_trie) + +### Methods + +* [_clearOriginalStorageCache](_lib_state_index_.defaultstatemanager.md#_clearoriginalstoragecache) +* [_getStorageTrie](_lib_state_index_.defaultstatemanager.md#private-_getstoragetrie) +* [_lookupStorageTrie](_lib_state_index_.defaultstatemanager.md#private-_lookupstoragetrie) +* [_modifyContractStorage](_lib_state_index_.defaultstatemanager.md#private-_modifycontractstorage) +* [accountExists](_lib_state_index_.defaultstatemanager.md#accountexists) +* [accountIsEmpty](_lib_state_index_.defaultstatemanager.md#accountisempty) +* [checkpoint](_lib_state_index_.defaultstatemanager.md#checkpoint) +* [cleanupTouchedAccounts](_lib_state_index_.defaultstatemanager.md#cleanuptouchedaccounts) +* [clearContractStorage](_lib_state_index_.defaultstatemanager.md#clearcontractstorage) +* [clearOriginalStorageCache](_lib_state_index_.defaultstatemanager.md#clearoriginalstoragecache) +* [commit](_lib_state_index_.defaultstatemanager.md#commit) +* [copy](_lib_state_index_.defaultstatemanager.md#copy) +* [deleteAccount](_lib_state_index_.defaultstatemanager.md#deleteaccount) +* [dumpStorage](_lib_state_index_.defaultstatemanager.md#dumpstorage) +* [generateCanonicalGenesis](_lib_state_index_.defaultstatemanager.md#generatecanonicalgenesis) +* [generateGenesis](_lib_state_index_.defaultstatemanager.md#generategenesis) +* [getAccount](_lib_state_index_.defaultstatemanager.md#getaccount) +* [getContractCode](_lib_state_index_.defaultstatemanager.md#getcontractcode) +* [getContractStorage](_lib_state_index_.defaultstatemanager.md#getcontractstorage) +* [getOriginalContractStorage](_lib_state_index_.defaultstatemanager.md#getoriginalcontractstorage) +* [getStateRoot](_lib_state_index_.defaultstatemanager.md#getstateroot) +* [hasGenesisState](_lib_state_index_.defaultstatemanager.md#hasgenesisstate) +* [putAccount](_lib_state_index_.defaultstatemanager.md#putaccount) +* [putContractCode](_lib_state_index_.defaultstatemanager.md#putcontractcode) +* [putContractStorage](_lib_state_index_.defaultstatemanager.md#putcontractstorage) +* [revert](_lib_state_index_.defaultstatemanager.md#revert) +* [setStateRoot](_lib_state_index_.defaultstatemanager.md#setstateroot) +* [touchAccount](_lib_state_index_.defaultstatemanager.md#touchaccount) + +## Constructors + +### constructor + +\+ **new DefaultStateManager**(`opts`: [DefaultStateManagerOpts](../interfaces/_lib_state_statemanager_.defaultstatemanageropts.md)): *[DefaultStateManager](_lib_state_index_.defaultstatemanager.md)* + +*Defined in [lib/state/stateManager.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L47)* + +Instantiate the StateManager interface. + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`opts` | [DefaultStateManagerOpts](../interfaces/_lib_state_statemanager_.defaultstatemanageropts.md) | {} | + +**Returns:** *[DefaultStateManager](_lib_state_index_.defaultstatemanager.md)* + +## Properties + +### _cache + +• **_cache**: *Cache* + +*Defined in [lib/state/stateManager.ts:43](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L43)* + +___ + +### _checkpointCount + +• **_checkpointCount**: *number* + +*Defined in [lib/state/stateManager.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L46)* + +___ + +### _common + +• **_common**: *Common* + +*Defined in [lib/state/stateManager.ts:40](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L40)* + +___ + +### _originalStorageCache + +• **_originalStorageCache**: *Map‹AddressHex, Map‹AddressHex, Buffer››* + +*Defined in [lib/state/stateManager.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L47)* + +___ + +### _storageTries + +• **_storageTries**: *object* + +*Defined in [lib/state/stateManager.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L42)* + +#### Type declaration: + +* \[ **key**: *string*\]: Trie + +___ + +### _touched + +• **_touched**: *Set‹AddressHex›* + +*Defined in [lib/state/stateManager.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L44)* + +___ + +### _touchedStack + +• **_touchedStack**: *Set‹AddressHex›[]* + +*Defined in [lib/state/stateManager.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L45)* + +___ + +### _trie + +• **_trie**: *Trie* + +*Defined in [lib/state/stateManager.ts:41](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L41)* + +## Methods + +### _clearOriginalStorageCache + +▸ **_clearOriginalStorageCache**(): *void* + +*Defined in [lib/state/stateManager.ts:241](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L241)* + +Clears the original storage cache. Refer to [getOriginalContractStorage](_lib_state_index_.defaultstatemanager.md#getoriginalcontractstorage) +for more explanation. + +**Returns:** *void* + +___ + +### `Private` _getStorageTrie + +▸ **_getStorageTrie**(`address`: Address): *Promise‹Trie›* + +*Defined in [lib/state/stateManager.ts:173](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L173)* + +Gets the storage trie for an account from the storage +cache or does a lookup. + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹Trie›* + +___ + +### `Private` _lookupStorageTrie + +▸ **_lookupStorageTrie**(`address`: Address): *Promise‹Trie›* + +*Defined in [lib/state/stateManager.ts:159](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L159)* + +Creates a storage trie from the primary storage trie +for an account and saves this in the storage cache. + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹Trie›* + +___ + +### `Private` _modifyContractStorage + +▸ **_modifyContractStorage**(`address`: Address, `modifyTrie`: function): *Promise‹void›* + +*Defined in [lib/state/stateManager.ts:259](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L259)* + +Modifies the storage trie of an account. + +**Parameters:** + +▪ **address**: *Address* + +Address of the account whose storage is to be modified + +▪ **modifyTrie**: *function* + +Function to modify the storage trie of the account + +▸ (`storageTrie`: Trie, `done`: Function): *void* + +**Parameters:** + +Name | Type | +------ | ------ | +`storageTrie` | Trie | +`done` | Function | + +**Returns:** *Promise‹void›* + +___ + +### accountExists + +▸ **accountExists**(`address`: Address): *Promise‹boolean›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:514](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L514)* + +Checks if the `account` corresponding to `address` +exists + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the `account` to check | + +**Returns:** *Promise‹boolean›* + +___ + +### accountIsEmpty + +▸ **accountIsEmpty**(`address`: Address): *Promise‹boolean›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:504](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L504)* + +Checks if the `account` corresponding to `address` +is empty or non-existent as defined in +EIP-161 (https://eips.ethereum.org/EIPS/eip-161). + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address to check | + +**Returns:** *Promise‹boolean›* + +___ + +### checkpoint + +▸ **checkpoint**(): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:329](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L329)* + +Checkpoints the current state of the StateManager instance. +State changes that follow can then be committed by calling +`commit` or `reverted` by calling rollback. + +**Returns:** *Promise‹void›* + +___ + +### cleanupTouchedAccounts + +▸ **cleanupTouchedAccounts**(): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:529](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L529)* + +Removes accounts form the state trie that have been touched, +as defined in EIP-161 (https://eips.ethereum.org/EIPS/eip-161). + +**Returns:** *Promise‹void›* + +___ + +### clearContractStorage + +▸ **clearContractStorage**(`address`: Address): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:317](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L317)* + +Clears all storage entries for the account corresponding to `address`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address to clear the storage of | + +**Returns:** *Promise‹void›* + +___ + +### clearOriginalStorageCache + +▸ **clearOriginalStorageCache**(): *void* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:249](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L249)* + +Clears the original storage cache. Refer to [getOriginalContractStorage](_lib_state_index_.defaultstatemanager.md#getoriginalcontractstorage) +for more explanation. Alias of the internal _clearOriginalStorageCache + +**Returns:** *void* + +___ + +### commit + +▸ **commit**(): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:340](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L340)* + +Commits the current change-set to the instance since the +last call to checkpoint. + +**Returns:** *Promise‹void›* + +___ + +### copy + +▸ **copy**(): *[StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L73)* + +Copies the current instance of the `StateManager` +at the last fully committed point, i.e. as if all current +checkpoints were reverted. + +**Returns:** *[StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +___ + +### deleteAccount + +▸ **deleteAccount**(`address`: Address): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:103](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L103)* + +Deletes an account from state under the provided `address`. The account will also be removed from the state trie. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the account which should be deleted | + +**Returns:** *Promise‹void›* + +___ + +### dumpStorage + +▸ **dumpStorage**(`address`: Address): *Promise‹[StorageDump](../interfaces/_lib_state_interface_.storagedump.md)›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:438](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L438)* + +Dumps the RLP-encoded storage values for an `account` specified by `address`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | The address of the `account` to return storage for | + +**Returns:** *Promise‹[StorageDump](../interfaces/_lib_state_interface_.storagedump.md)›* + +- The state of the account as an `Object` map. +Keys are are the storage keys, values are the storage values as strings. +Both are represented as hex strings without the `0x` prefix. + +___ + +### generateCanonicalGenesis + +▸ **generateCanonicalGenesis**(): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:469](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L469)* + +Generates a canonical genesis state on the instance based on the +configured chain parameters. Will error if there are uncommitted +checkpoints on the instance. + +**Returns:** *Promise‹void›* + +___ + +### generateGenesis + +▸ **generateGenesis**(`initState`: any): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:484](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L484)* + +Initializes the provided genesis state into the state trie + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`initState` | any | Object (address -> balance) | + +**Returns:** *Promise‹void›* + +___ + +### getAccount + +▸ **getAccount**(`address`: Address): *Promise‹Account›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:84](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L84)* + +Gets the account associated with `address`. Returns an empty account if the account does not exist. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the `account` to get | + +**Returns:** *Promise‹Account›* + +___ + +### getContractCode + +▸ **getContractCode**(`address`: Address): *Promise‹Buffer›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:145](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L145)* + +Gets the code corresponding to the provided `address`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address to get the `code` for | + +**Returns:** *Promise‹Buffer›* + +- Resolves with the code corresponding to the provided address. +Returns an empty `Buffer` if the account has no associated code. + +___ + +### getContractStorage + +▸ **getContractStorage**(`address`: Address, `key`: Buffer): *Promise‹Buffer›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:193](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L193)* + +Gets the storage value associated with the provided `address` and `key`. This method returns +the shortest representation of the stored value. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the account to get the storage for | +`key` | Buffer | Key in the account's storage to get the value for. Must be 32 bytes long. | + +**Returns:** *Promise‹Buffer›* + +- The storage value for the account +corresponding to the provided address at the provided key. +If this does not exist an empty `Buffer` is returned. + +___ + +### getOriginalContractStorage + +▸ **getOriginalContractStorage**(`address`: Address, `key`: Buffer): *Promise‹Buffer›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:212](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L212)* + +Caches the storage value associated with the provided `address` and `key` +on first invocation, and returns the cached (original) value from then +onwards. This is used to get the original value of a storage slot for +computing gas costs according to EIP-1283. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the account to get the storage for | +`key` | Buffer | Key in the account's storage to get the value for. Must be 32 bytes long. | + +**Returns:** *Promise‹Buffer›* + +___ + +### getStateRoot + +▸ **getStateRoot**(`force`: boolean): *Promise‹Buffer›* + +*Defined in [lib/state/stateManager.ts:391](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L391)* + +Gets the state-root of the Merkle-Patricia trie representation +of the state of this StateManager. Will error if there are uncommitted +checkpoints on the instance. + +**Parameters:** + +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`force` | boolean | false | If set to `true`, force a cache flush even if there are uncommited checkpoints (this is set to `true` pre-Byzantium in order to get intermediate state roots for the receipts) | + +**Returns:** *Promise‹Buffer›* + +- Returns the state-root of the `StateManager` + +___ + +### hasGenesisState + +▸ **hasGenesisState**(): *Promise‹boolean›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:459](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L459)* + +Checks whether the current instance has the canonical genesis state +for the configured chain parameters. + +**Returns:** *Promise‹boolean›* + +- Whether the storage trie contains the +canonical genesis state for the configured chain parameters. + +___ + +### putAccount + +▸ **putAccount**(`address`: Address, `account`: Account): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:94](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L94)* + +Saves an account into state under the provided `address`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address under which to store `account` | +`account` | Account | The account to store | + +**Returns:** *Promise‹void›* + +___ + +### putContractCode + +▸ **putContractCode**(`address`: Address, `value`: Buffer): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:125](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L125)* + +Adds `value` to the state trie as code, and sets `codeHash` on the account +corresponding to `address` to reference this. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the `account` to add the `code` for | +`value` | Buffer | The value of the `code` | + +**Returns:** *Promise‹void›* + +___ + +### putContractStorage + +▸ **putContractStorage**(`address`: Address, `key`: Buffer, `value`: Buffer): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:289](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L289)* + +Adds value to the state trie for the `account` +corresponding to `address` at the provided `key`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address to set a storage value for | +`key` | Buffer | Key to set the value at. Must be 32 bytes long. | +`value` | Buffer | Value to set at `key` for account corresponding to `address`. Cannot be more than 32 bytes. Leading zeros are stripped. If it is a empty or filled with zeros, deletes the value. | + +**Returns:** *Promise‹void›* + +___ + +### revert + +▸ **revert**(): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:358](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L358)* + +Reverts the current change-set to the instance since the +last call to checkpoint. + +**Returns:** *Promise‹void›* + +___ + +### setStateRoot + +▸ **setStateRoot**(`stateRoot`: Buffer): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:407](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L407)* + +Sets the state of the instance to that represented +by the provided `stateRoot`. Will error if there are uncommitted +checkpoints on the instance or if the state root does not exist in +the state trie. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`stateRoot` | Buffer | The state-root to reset the instance to | + +**Returns:** *Promise‹void›* + +___ + +### touchAccount + +▸ **touchAccount**(`address`: Address): *void* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:115](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L115)* + +Marks an account as touched, according to the definition +in [EIP-158](https://eips.ethereum.org/EIPS/eip-158). +This happens when the account is triggered for a state-changing +event. Touched accounts that are empty will be cleared +at the end of the tx. + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *void* diff --git a/packages/vm/docs/classes/_lib_state_statemanager_.defaultstatemanager.md b/packages/vm/docs/classes/_lib_state_statemanager_.defaultstatemanager.md new file mode 100644 index 0000000000..fa64ada1c1 --- /dev/null +++ b/packages/vm/docs/classes/_lib_state_statemanager_.defaultstatemanager.md @@ -0,0 +1,711 @@ +[@ethereumjs/vm](../README.md) › ["lib/state/stateManager"](../modules/_lib_state_statemanager_.md) › [DefaultStateManager](_lib_state_statemanager_.defaultstatemanager.md) + +# Class: DefaultStateManager + +Interface for getting and setting data from an underlying +state trie. + +## Hierarchy + +* **DefaultStateManager** + +## Implements + +* [StateManager](../interfaces/_lib_state_index_.statemanager.md) + +## Index + +### Constructors + +* [constructor](_lib_state_statemanager_.defaultstatemanager.md#constructor) + +### Properties + +* [_cache](_lib_state_statemanager_.defaultstatemanager.md#_cache) +* [_checkpointCount](_lib_state_statemanager_.defaultstatemanager.md#_checkpointcount) +* [_common](_lib_state_statemanager_.defaultstatemanager.md#_common) +* [_originalStorageCache](_lib_state_statemanager_.defaultstatemanager.md#_originalstoragecache) +* [_storageTries](_lib_state_statemanager_.defaultstatemanager.md#_storagetries) +* [_touched](_lib_state_statemanager_.defaultstatemanager.md#_touched) +* [_touchedStack](_lib_state_statemanager_.defaultstatemanager.md#_touchedstack) +* [_trie](_lib_state_statemanager_.defaultstatemanager.md#_trie) + +### Methods + +* [_clearOriginalStorageCache](_lib_state_statemanager_.defaultstatemanager.md#_clearoriginalstoragecache) +* [_getStorageTrie](_lib_state_statemanager_.defaultstatemanager.md#private-_getstoragetrie) +* [_lookupStorageTrie](_lib_state_statemanager_.defaultstatemanager.md#private-_lookupstoragetrie) +* [_modifyContractStorage](_lib_state_statemanager_.defaultstatemanager.md#private-_modifycontractstorage) +* [accountExists](_lib_state_statemanager_.defaultstatemanager.md#accountexists) +* [accountIsEmpty](_lib_state_statemanager_.defaultstatemanager.md#accountisempty) +* [checkpoint](_lib_state_statemanager_.defaultstatemanager.md#checkpoint) +* [cleanupTouchedAccounts](_lib_state_statemanager_.defaultstatemanager.md#cleanuptouchedaccounts) +* [clearContractStorage](_lib_state_statemanager_.defaultstatemanager.md#clearcontractstorage) +* [clearOriginalStorageCache](_lib_state_statemanager_.defaultstatemanager.md#clearoriginalstoragecache) +* [commit](_lib_state_statemanager_.defaultstatemanager.md#commit) +* [copy](_lib_state_statemanager_.defaultstatemanager.md#copy) +* [deleteAccount](_lib_state_statemanager_.defaultstatemanager.md#deleteaccount) +* [dumpStorage](_lib_state_statemanager_.defaultstatemanager.md#dumpstorage) +* [generateCanonicalGenesis](_lib_state_statemanager_.defaultstatemanager.md#generatecanonicalgenesis) +* [generateGenesis](_lib_state_statemanager_.defaultstatemanager.md#generategenesis) +* [getAccount](_lib_state_statemanager_.defaultstatemanager.md#getaccount) +* [getContractCode](_lib_state_statemanager_.defaultstatemanager.md#getcontractcode) +* [getContractStorage](_lib_state_statemanager_.defaultstatemanager.md#getcontractstorage) +* [getOriginalContractStorage](_lib_state_statemanager_.defaultstatemanager.md#getoriginalcontractstorage) +* [getStateRoot](_lib_state_statemanager_.defaultstatemanager.md#getstateroot) +* [hasGenesisState](_lib_state_statemanager_.defaultstatemanager.md#hasgenesisstate) +* [putAccount](_lib_state_statemanager_.defaultstatemanager.md#putaccount) +* [putContractCode](_lib_state_statemanager_.defaultstatemanager.md#putcontractcode) +* [putContractStorage](_lib_state_statemanager_.defaultstatemanager.md#putcontractstorage) +* [revert](_lib_state_statemanager_.defaultstatemanager.md#revert) +* [setStateRoot](_lib_state_statemanager_.defaultstatemanager.md#setstateroot) +* [touchAccount](_lib_state_statemanager_.defaultstatemanager.md#touchaccount) + +## Constructors + +### constructor + +\+ **new DefaultStateManager**(`opts`: [DefaultStateManagerOpts](../interfaces/_lib_state_statemanager_.defaultstatemanageropts.md)): *[DefaultStateManager](_lib_state_statemanager_.defaultstatemanager.md)* + +*Defined in [lib/state/stateManager.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L47)* + +Instantiate the StateManager interface. + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`opts` | [DefaultStateManagerOpts](../interfaces/_lib_state_statemanager_.defaultstatemanageropts.md) | {} | + +**Returns:** *[DefaultStateManager](_lib_state_statemanager_.defaultstatemanager.md)* + +## Properties + +### _cache + +• **_cache**: *Cache* + +*Defined in [lib/state/stateManager.ts:43](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L43)* + +___ + +### _checkpointCount + +• **_checkpointCount**: *number* + +*Defined in [lib/state/stateManager.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L46)* + +___ + +### _common + +• **_common**: *Common* + +*Defined in [lib/state/stateManager.ts:40](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L40)* + +___ + +### _originalStorageCache + +• **_originalStorageCache**: *Map‹AddressHex, Map‹AddressHex, Buffer››* + +*Defined in [lib/state/stateManager.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L47)* + +___ + +### _storageTries + +• **_storageTries**: *object* + +*Defined in [lib/state/stateManager.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L42)* + +#### Type declaration: + +* \[ **key**: *string*\]: Trie + +___ + +### _touched + +• **_touched**: *Set‹AddressHex›* + +*Defined in [lib/state/stateManager.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L44)* + +___ + +### _touchedStack + +• **_touchedStack**: *Set‹AddressHex›[]* + +*Defined in [lib/state/stateManager.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L45)* + +___ + +### _trie + +• **_trie**: *Trie* + +*Defined in [lib/state/stateManager.ts:41](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L41)* + +## Methods + +### _clearOriginalStorageCache + +▸ **_clearOriginalStorageCache**(): *void* + +*Defined in [lib/state/stateManager.ts:241](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L241)* + +Clears the original storage cache. Refer to [getOriginalContractStorage](_lib_state_statemanager_.defaultstatemanager.md#getoriginalcontractstorage) +for more explanation. + +**Returns:** *void* + +___ + +### `Private` _getStorageTrie + +▸ **_getStorageTrie**(`address`: Address): *Promise‹Trie›* + +*Defined in [lib/state/stateManager.ts:173](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L173)* + +Gets the storage trie for an account from the storage +cache or does a lookup. + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹Trie›* + +___ + +### `Private` _lookupStorageTrie + +▸ **_lookupStorageTrie**(`address`: Address): *Promise‹Trie›* + +*Defined in [lib/state/stateManager.ts:159](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L159)* + +Creates a storage trie from the primary storage trie +for an account and saves this in the storage cache. + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹Trie›* + +___ + +### `Private` _modifyContractStorage + +▸ **_modifyContractStorage**(`address`: Address, `modifyTrie`: function): *Promise‹void›* + +*Defined in [lib/state/stateManager.ts:259](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L259)* + +Modifies the storage trie of an account. + +**Parameters:** + +▪ **address**: *Address* + +Address of the account whose storage is to be modified + +▪ **modifyTrie**: *function* + +Function to modify the storage trie of the account + +▸ (`storageTrie`: Trie, `done`: Function): *void* + +**Parameters:** + +Name | Type | +------ | ------ | +`storageTrie` | Trie | +`done` | Function | + +**Returns:** *Promise‹void›* + +___ + +### accountExists + +▸ **accountExists**(`address`: Address): *Promise‹boolean›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:514](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L514)* + +Checks if the `account` corresponding to `address` +exists + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the `account` to check | + +**Returns:** *Promise‹boolean›* + +___ + +### accountIsEmpty + +▸ **accountIsEmpty**(`address`: Address): *Promise‹boolean›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:504](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L504)* + +Checks if the `account` corresponding to `address` +is empty or non-existent as defined in +EIP-161 (https://eips.ethereum.org/EIPS/eip-161). + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address to check | + +**Returns:** *Promise‹boolean›* + +___ + +### checkpoint + +▸ **checkpoint**(): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:329](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L329)* + +Checkpoints the current state of the StateManager instance. +State changes that follow can then be committed by calling +`commit` or `reverted` by calling rollback. + +**Returns:** *Promise‹void›* + +___ + +### cleanupTouchedAccounts + +▸ **cleanupTouchedAccounts**(): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:529](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L529)* + +Removes accounts form the state trie that have been touched, +as defined in EIP-161 (https://eips.ethereum.org/EIPS/eip-161). + +**Returns:** *Promise‹void›* + +___ + +### clearContractStorage + +▸ **clearContractStorage**(`address`: Address): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:317](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L317)* + +Clears all storage entries for the account corresponding to `address`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address to clear the storage of | + +**Returns:** *Promise‹void›* + +___ + +### clearOriginalStorageCache + +▸ **clearOriginalStorageCache**(): *void* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:249](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L249)* + +Clears the original storage cache. Refer to [getOriginalContractStorage](_lib_state_statemanager_.defaultstatemanager.md#getoriginalcontractstorage) +for more explanation. Alias of the internal _clearOriginalStorageCache + +**Returns:** *void* + +___ + +### commit + +▸ **commit**(): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:340](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L340)* + +Commits the current change-set to the instance since the +last call to checkpoint. + +**Returns:** *Promise‹void›* + +___ + +### copy + +▸ **copy**(): *[StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L73)* + +Copies the current instance of the `StateManager` +at the last fully committed point, i.e. as if all current +checkpoints were reverted. + +**Returns:** *[StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +___ + +### deleteAccount + +▸ **deleteAccount**(`address`: Address): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:103](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L103)* + +Deletes an account from state under the provided `address`. The account will also be removed from the state trie. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the account which should be deleted | + +**Returns:** *Promise‹void›* + +___ + +### dumpStorage + +▸ **dumpStorage**(`address`: Address): *Promise‹[StorageDump](../interfaces/_lib_state_interface_.storagedump.md)›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:438](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L438)* + +Dumps the RLP-encoded storage values for an `account` specified by `address`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | The address of the `account` to return storage for | + +**Returns:** *Promise‹[StorageDump](../interfaces/_lib_state_interface_.storagedump.md)›* + +- The state of the account as an `Object` map. +Keys are are the storage keys, values are the storage values as strings. +Both are represented as hex strings without the `0x` prefix. + +___ + +### generateCanonicalGenesis + +▸ **generateCanonicalGenesis**(): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:469](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L469)* + +Generates a canonical genesis state on the instance based on the +configured chain parameters. Will error if there are uncommitted +checkpoints on the instance. + +**Returns:** *Promise‹void›* + +___ + +### generateGenesis + +▸ **generateGenesis**(`initState`: any): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:484](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L484)* + +Initializes the provided genesis state into the state trie + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`initState` | any | Object (address -> balance) | + +**Returns:** *Promise‹void›* + +___ + +### getAccount + +▸ **getAccount**(`address`: Address): *Promise‹Account›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:84](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L84)* + +Gets the account associated with `address`. Returns an empty account if the account does not exist. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the `account` to get | + +**Returns:** *Promise‹Account›* + +___ + +### getContractCode + +▸ **getContractCode**(`address`: Address): *Promise‹Buffer›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:145](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L145)* + +Gets the code corresponding to the provided `address`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address to get the `code` for | + +**Returns:** *Promise‹Buffer›* + +- Resolves with the code corresponding to the provided address. +Returns an empty `Buffer` if the account has no associated code. + +___ + +### getContractStorage + +▸ **getContractStorage**(`address`: Address, `key`: Buffer): *Promise‹Buffer›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:193](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L193)* + +Gets the storage value associated with the provided `address` and `key`. This method returns +the shortest representation of the stored value. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the account to get the storage for | +`key` | Buffer | Key in the account's storage to get the value for. Must be 32 bytes long. | + +**Returns:** *Promise‹Buffer›* + +- The storage value for the account +corresponding to the provided address at the provided key. +If this does not exist an empty `Buffer` is returned. + +___ + +### getOriginalContractStorage + +▸ **getOriginalContractStorage**(`address`: Address, `key`: Buffer): *Promise‹Buffer›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:212](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L212)* + +Caches the storage value associated with the provided `address` and `key` +on first invocation, and returns the cached (original) value from then +onwards. This is used to get the original value of a storage slot for +computing gas costs according to EIP-1283. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the account to get the storage for | +`key` | Buffer | Key in the account's storage to get the value for. Must be 32 bytes long. | + +**Returns:** *Promise‹Buffer›* + +___ + +### getStateRoot + +▸ **getStateRoot**(`force`: boolean): *Promise‹Buffer›* + +*Defined in [lib/state/stateManager.ts:391](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L391)* + +Gets the state-root of the Merkle-Patricia trie representation +of the state of this StateManager. Will error if there are uncommitted +checkpoints on the instance. + +**Parameters:** + +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`force` | boolean | false | If set to `true`, force a cache flush even if there are uncommited checkpoints (this is set to `true` pre-Byzantium in order to get intermediate state roots for the receipts) | + +**Returns:** *Promise‹Buffer›* + +- Returns the state-root of the `StateManager` + +___ + +### hasGenesisState + +▸ **hasGenesisState**(): *Promise‹boolean›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:459](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L459)* + +Checks whether the current instance has the canonical genesis state +for the configured chain parameters. + +**Returns:** *Promise‹boolean›* + +- Whether the storage trie contains the +canonical genesis state for the configured chain parameters. + +___ + +### putAccount + +▸ **putAccount**(`address`: Address, `account`: Account): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:94](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L94)* + +Saves an account into state under the provided `address`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address under which to store `account` | +`account` | Account | The account to store | + +**Returns:** *Promise‹void›* + +___ + +### putContractCode + +▸ **putContractCode**(`address`: Address, `value`: Buffer): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:125](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L125)* + +Adds `value` to the state trie as code, and sets `codeHash` on the account +corresponding to `address` to reference this. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address of the `account` to add the `code` for | +`value` | Buffer | The value of the `code` | + +**Returns:** *Promise‹void›* + +___ + +### putContractStorage + +▸ **putContractStorage**(`address`: Address, `key`: Buffer, `value`: Buffer): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:289](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L289)* + +Adds value to the state trie for the `account` +corresponding to `address` at the provided `key`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`address` | Address | Address to set a storage value for | +`key` | Buffer | Key to set the value at. Must be 32 bytes long. | +`value` | Buffer | Value to set at `key` for account corresponding to `address`. Cannot be more than 32 bytes. Leading zeros are stripped. If it is a empty or filled with zeros, deletes the value. | + +**Returns:** *Promise‹void›* + +___ + +### revert + +▸ **revert**(): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:358](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L358)* + +Reverts the current change-set to the instance since the +last call to checkpoint. + +**Returns:** *Promise‹void›* + +___ + +### setStateRoot + +▸ **setStateRoot**(`stateRoot`: Buffer): *Promise‹void›* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:407](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L407)* + +Sets the state of the instance to that represented +by the provided `stateRoot`. Will error if there are uncommitted +checkpoints on the instance or if the state root does not exist in +the state trie. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`stateRoot` | Buffer | The state-root to reset the instance to | + +**Returns:** *Promise‹void›* + +___ + +### touchAccount + +▸ **touchAccount**(`address`: Address): *void* + +*Implementation of [StateManager](../interfaces/_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/stateManager.ts:115](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L115)* + +Marks an account as touched, according to the definition +in [EIP-158](https://eips.ethereum.org/EIPS/eip-158). +This happens when the account is triggered for a state-changing +event. Touched accounts that are empty will be cleared +at the end of the tx. + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *void* diff --git a/packages/vm/docs/classes/_state_index_.defaultstatemanager.md b/packages/vm/docs/classes/_state_index_.defaultstatemanager.md deleted file mode 100644 index e79bd57707..0000000000 --- a/packages/vm/docs/classes/_state_index_.defaultstatemanager.md +++ /dev/null @@ -1,694 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["state/index"](../modules/_state_index_.md) › [DefaultStateManager](_state_index_.defaultstatemanager.md) - -# Class: DefaultStateManager - -Interface for getting and setting data from an underlying -state trie. - -## Hierarchy - -* **DefaultStateManager** - -## Implements - -* [StateManager](../interfaces/_state_index_.statemanager.md) - -## Index - -### Constructors - -* [constructor](_state_index_.defaultstatemanager.md#constructor) - -### Properties - -* [_cache](_state_index_.defaultstatemanager.md#_cache) -* [_checkpointCount](_state_index_.defaultstatemanager.md#_checkpointcount) -* [_common](_state_index_.defaultstatemanager.md#_common) -* [_originalStorageCache](_state_index_.defaultstatemanager.md#_originalstoragecache) -* [_storageTries](_state_index_.defaultstatemanager.md#_storagetries) -* [_touched](_state_index_.defaultstatemanager.md#_touched) -* [_touchedStack](_state_index_.defaultstatemanager.md#_touchedstack) -* [_trie](_state_index_.defaultstatemanager.md#_trie) - -### Methods - -* [_clearOriginalStorageCache](_state_index_.defaultstatemanager.md#_clearoriginalstoragecache) -* [_getStorageTrie](_state_index_.defaultstatemanager.md#private-_getstoragetrie) -* [_lookupStorageTrie](_state_index_.defaultstatemanager.md#private-_lookupstoragetrie) -* [_modifyContractStorage](_state_index_.defaultstatemanager.md#private-_modifycontractstorage) -* [accountExists](_state_index_.defaultstatemanager.md#accountexists) -* [accountIsEmpty](_state_index_.defaultstatemanager.md#accountisempty) -* [checkpoint](_state_index_.defaultstatemanager.md#checkpoint) -* [cleanupTouchedAccounts](_state_index_.defaultstatemanager.md#cleanuptouchedaccounts) -* [clearContractStorage](_state_index_.defaultstatemanager.md#clearcontractstorage) -* [commit](_state_index_.defaultstatemanager.md#commit) -* [copy](_state_index_.defaultstatemanager.md#copy) -* [deleteAccount](_state_index_.defaultstatemanager.md#deleteaccount) -* [dumpStorage](_state_index_.defaultstatemanager.md#dumpstorage) -* [generateCanonicalGenesis](_state_index_.defaultstatemanager.md#generatecanonicalgenesis) -* [generateGenesis](_state_index_.defaultstatemanager.md#generategenesis) -* [getAccount](_state_index_.defaultstatemanager.md#getaccount) -* [getContractCode](_state_index_.defaultstatemanager.md#getcontractcode) -* [getContractStorage](_state_index_.defaultstatemanager.md#getcontractstorage) -* [getOriginalContractStorage](_state_index_.defaultstatemanager.md#getoriginalcontractstorage) -* [getStateRoot](_state_index_.defaultstatemanager.md#getstateroot) -* [hasGenesisState](_state_index_.defaultstatemanager.md#hasgenesisstate) -* [putAccount](_state_index_.defaultstatemanager.md#putaccount) -* [putContractCode](_state_index_.defaultstatemanager.md#putcontractcode) -* [putContractStorage](_state_index_.defaultstatemanager.md#putcontractstorage) -* [revert](_state_index_.defaultstatemanager.md#revert) -* [setStateRoot](_state_index_.defaultstatemanager.md#setstateroot) -* [touchAccount](_state_index_.defaultstatemanager.md#touchaccount) - -## Constructors - -### constructor - -\+ **new DefaultStateManager**(`opts`: [DefaultStateManagerOpts](../interfaces/_state_statemanager_.defaultstatemanageropts.md)): *[DefaultStateManager](_state_index_.defaultstatemanager.md)* - -*Defined in [state/stateManager.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L38)* - -Instantiate the StateManager interface. - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`opts` | [DefaultStateManagerOpts](../interfaces/_state_statemanager_.defaultstatemanageropts.md) | {} | - -**Returns:** *[DefaultStateManager](_state_index_.defaultstatemanager.md)* - -## Properties - -### _cache - -• **_cache**: *Cache* - -*Defined in [state/stateManager.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L34)* - -___ - -### _checkpointCount - -• **_checkpointCount**: *number* - -*Defined in [state/stateManager.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L37)* - -___ - -### _common - -• **_common**: *Common* - -*Defined in [state/stateManager.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L31)* - -___ - -### _originalStorageCache - -• **_originalStorageCache**: *Map‹string, Map‹string, Buffer››* - -*Defined in [state/stateManager.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L38)* - -___ - -### _storageTries - -• **_storageTries**: *any* - -*Defined in [state/stateManager.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L33)* - -___ - -### _touched - -• **_touched**: *Set‹string›* - -*Defined in [state/stateManager.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L35)* - -___ - -### _touchedStack - -• **_touchedStack**: *Set‹string›[]* - -*Defined in [state/stateManager.ts:36](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L36)* - -___ - -### _trie - -• **_trie**: *Trie* - -*Defined in [state/stateManager.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L32)* - -## Methods - -### _clearOriginalStorageCache - -▸ **_clearOriginalStorageCache**(): *void* - -*Defined in [state/stateManager.ts:234](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L234)* - -Clears the original storage cache. Refer to [getOriginalContractStorage](_state_index_.defaultstatemanager.md#getoriginalcontractstorage) -for more explanation. - -**Returns:** *void* - -___ - -### `Private` _getStorageTrie - -▸ **_getStorageTrie**(`address`: Buffer): *Promise‹Trie›* - -*Defined in [state/stateManager.ts:167](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L167)* - -Gets the storage trie for an account from the storage -cache or does a lookup. - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹Trie›* - -___ - -### `Private` _lookupStorageTrie - -▸ **_lookupStorageTrie**(`address`: Buffer): *Promise‹Trie›* - -*Defined in [state/stateManager.ts:153](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L153)* - -Creates a storage trie from the primary storage trie -for an account and saves this in the storage cache. - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹Trie›* - -___ - -### `Private` _modifyContractStorage - -▸ **_modifyContractStorage**(`address`: Buffer, `modifyTrie`: function): *Promise‹void›* - -*Defined in [state/stateManager.ts:244](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L244)* - -Modifies the storage trie of an account. - -**Parameters:** - -▪ **address**: *Buffer* - -Address of the account whose storage is to be modified - -▪ **modifyTrie**: *function* - -Function to modify the storage trie of the account - -▸ (`storageTrie`: Trie, `done`: Function): *void* - -**Parameters:** - -Name | Type | ------- | ------ | -`storageTrie` | Trie | -`done` | Function | - -**Returns:** *Promise‹void›* - -___ - -### accountExists - -▸ **accountExists**(`address`: Buffer): *Promise‹boolean›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:496](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L496)* - -Checks if the `account` corresponding to `address` -exists - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the `account` to check | - -**Returns:** *Promise‹boolean›* - -___ - -### accountIsEmpty - -▸ **accountIsEmpty**(`address`: Buffer): *Promise‹boolean›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:486](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L486)* - -Checks if the `account` corresponding to `address` -is empty or non-existent as defined in -EIP-161 (https://eips.ethereum.org/EIPS/eip-161). - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address to check | - -**Returns:** *Promise‹boolean›* - -___ - -### checkpoint - -▸ **checkpoint**(): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:307](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L307)* - -Checkpoints the current state of the StateManager instance. -State changes that follow can then be committed by calling -`commit` or `reverted` by calling rollback. - -**Returns:** *Promise‹void›* - -___ - -### cleanupTouchedAccounts - -▸ **cleanupTouchedAccounts**(): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:511](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L511)* - -Removes accounts form the state trie that have been touched, -as defined in EIP-161 (https://eips.ethereum.org/EIPS/eip-161). - -**Returns:** *Promise‹void›* - -___ - -### clearContractStorage - -▸ **clearContractStorage**(`address`: Buffer): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:295](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L295)* - -Clears all storage entries for the account corresponding to `address`. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address to clear the storage of | - -**Returns:** *Promise‹void›* - -___ - -### commit - -▸ **commit**(): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:318](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L318)* - -Commits the current change-set to the instance since the -last call to checkpoint. - -**Returns:** *Promise‹void›* - -___ - -### copy - -▸ **copy**(): *[StateManager](../interfaces/_state_index_.statemanager.md)* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L64)* - -Copies the current instance of the `StateManager` -at the last fully committed point, i.e. as if all current -checkpoints were reverted. - -**Returns:** *[StateManager](../interfaces/_state_index_.statemanager.md)* - -___ - -### deleteAccount - -▸ **deleteAccount**(`address`: Buffer): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:97](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L97)* - -Deletes an [`@ethereumjs/account`](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/account) -from state under the provided `address`. The account will also be removed from the state trie. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the account which should be deleted | - -**Returns:** *Promise‹void›* - -___ - -### dumpStorage - -▸ **dumpStorage**(`address`: Buffer): *Promise‹[StorageDump](../interfaces/_state_interface_.storagedump.md)›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:416](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L416)* - -Dumps the the storage values for an `account` specified by `address`. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | The address of the `account` to return storage for | - -**Returns:** *Promise‹[StorageDump](../interfaces/_state_interface_.storagedump.md)›* - -- The state of the account as an `Object` map. -Keys are are the storage keys, values are the storage values as strings. -Both are represented as hex strings without the `0x` prefix. - -___ - -### generateCanonicalGenesis - -▸ **generateCanonicalGenesis**(): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:447](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L447)* - -Generates a canonical genesis state on the instance based on the -configured chain parameters. Will error if there are uncommitted -checkpoints on the instance. - -**Returns:** *Promise‹void›* - -___ - -### generateGenesis - -▸ **generateGenesis**(`initState`: any): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:462](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L462)* - -Initializes the provided genesis state into the state trie - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`initState` | any | Object (address -> balance) | - -**Returns:** *Promise‹void›* - -___ - -### getAccount - -▸ **getAccount**(`address`: Buffer): *Promise‹Account›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L73)* - -Gets the [`@ethereumjs/account`](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/account) -associated with `address`. Returns an empty account if the account does not exist. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the `account` to get | - -**Returns:** *Promise‹Account›* - -___ - -### getContractCode - -▸ **getContractCode**(`address`: Buffer): *Promise‹Buffer›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:139](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L139)* - -Gets the code corresponding to the provided `address`. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address to get the `code` for | - -**Returns:** *Promise‹Buffer›* - -- Resolves with the code corresponding to the provided address. -Returns an empty `Buffer` if the account has no associated code. - -___ - -### getContractStorage - -▸ **getContractStorage**(`address`: Buffer, `key`: Buffer): *Promise‹Buffer›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:186](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L186)* - -Gets the storage value associated with the provided `address` and `key`. This method returns -the shortest representation of the stored value. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the account to get the storage for | -`key` | Buffer | Key in the account's storage to get the value for. Must be 32 bytes long. | - -**Returns:** *Promise‹Buffer›* - -- The storage value for the account -corresponding to the provided address at the provided key. -If this does not exist an empty `Buffer` is returned. - -___ - -### getOriginalContractStorage - -▸ **getOriginalContractStorage**(`address`: Buffer, `key`: Buffer): *Promise‹Buffer›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:205](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L205)* - -Caches the storage value associated with the provided `address` and `key` -on first invocation, and returns the cached (original) value from then -onwards. This is used to get the original value of a storage slot for -computing gas costs according to EIP-1283. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the account to get the storage for | -`key` | Buffer | Key in the account's storage to get the value for. Must be 32 bytes long. | - -**Returns:** *Promise‹Buffer›* - -___ - -### getStateRoot - -▸ **getStateRoot**(`force`: boolean): *Promise‹Buffer›* - -*Defined in [state/stateManager.ts:369](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L369)* - -Gets the state-root of the Merkle-Patricia trie representation -of the state of this StateManager. Will error if there are uncommitted -checkpoints on the instance. - -**Parameters:** - -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`force` | boolean | false | If set to `true`, force a cache flush even if there are uncommited checkpoints (this is set to `true` pre-Byzantium in order to get intermediate state roots for the receipts) | - -**Returns:** *Promise‹Buffer›* - -- Returns the state-root of the `StateManager` - -___ - -### hasGenesisState - -▸ **hasGenesisState**(): *Promise‹boolean›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:437](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L437)* - -Checks whether the current instance has the canonical genesis state -for the configured chain parameters. - -**Returns:** *Promise‹boolean›* - -- Whether the storage trie contains the -canonical genesis state for the configured chain parameters. - -___ - -### putAccount - -▸ **putAccount**(`address`: Buffer, `account`: Account): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:84](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L84)* - -Saves an [`@ethereumjs/account`](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/account) -into state under the provided `address`. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address under which to store `account` | -`account` | Account | The [`@ethereumjs/account`](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/account) to store | - -**Returns:** *Promise‹void›* - -___ - -### putContractCode - -▸ **putContractCode**(`address`: Buffer, `value`: Buffer): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:119](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L119)* - -Adds `value` to the state trie as code, and sets `codeHash` on the account -corresponding to `address` to reference this. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the `account` to add the `code` for | -`value` | Buffer | The value of the `code` | - -**Returns:** *Promise‹void›* - -___ - -### putContractStorage - -▸ **putContractStorage**(`address`: Buffer, `key`: Buffer, `value`: Buffer): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:273](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L273)* - -Adds value to the state trie for the `account` -corresponding to `address` at the provided `key`. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address to set a storage value for | -`key` | Buffer | Key to set the value at. Must be 32 bytes long. | -`value` | Buffer | Value to set at `key` for account corresponding to `address` | - -**Returns:** *Promise‹void›* - -___ - -### revert - -▸ **revert**(): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:336](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L336)* - -Reverts the current change-set to the instance since the -last call to checkpoint. - -**Returns:** *Promise‹void›* - -___ - -### setStateRoot - -▸ **setStateRoot**(`stateRoot`: Buffer): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:385](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L385)* - -Sets the state of the instance to that represented -by the provided `stateRoot`. Will error if there are uncommitted -checkpoints on the instance or if the state root does not exist in -the state trie. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`stateRoot` | Buffer | The state-root to reset the instance to | - -**Returns:** *Promise‹void›* - -___ - -### touchAccount - -▸ **touchAccount**(`address`: Buffer): *void* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:109](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L109)* - -Marks an account as touched, according to the definition -in [EIP-158](https://eips.ethereum.org/EIPS/eip-158). -This happens when the account is triggered for a state-changing -event. Touched accounts that are empty will be cleared -at the end of the tx. - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *void* diff --git a/packages/vm/docs/classes/_state_statemanager_.defaultstatemanager.md b/packages/vm/docs/classes/_state_statemanager_.defaultstatemanager.md deleted file mode 100644 index 0f74105951..0000000000 --- a/packages/vm/docs/classes/_state_statemanager_.defaultstatemanager.md +++ /dev/null @@ -1,694 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["state/stateManager"](../modules/_state_statemanager_.md) › [DefaultStateManager](_state_statemanager_.defaultstatemanager.md) - -# Class: DefaultStateManager - -Interface for getting and setting data from an underlying -state trie. - -## Hierarchy - -* **DefaultStateManager** - -## Implements - -* [StateManager](../interfaces/_state_index_.statemanager.md) - -## Index - -### Constructors - -* [constructor](_state_statemanager_.defaultstatemanager.md#constructor) - -### Properties - -* [_cache](_state_statemanager_.defaultstatemanager.md#_cache) -* [_checkpointCount](_state_statemanager_.defaultstatemanager.md#_checkpointcount) -* [_common](_state_statemanager_.defaultstatemanager.md#_common) -* [_originalStorageCache](_state_statemanager_.defaultstatemanager.md#_originalstoragecache) -* [_storageTries](_state_statemanager_.defaultstatemanager.md#_storagetries) -* [_touched](_state_statemanager_.defaultstatemanager.md#_touched) -* [_touchedStack](_state_statemanager_.defaultstatemanager.md#_touchedstack) -* [_trie](_state_statemanager_.defaultstatemanager.md#_trie) - -### Methods - -* [_clearOriginalStorageCache](_state_statemanager_.defaultstatemanager.md#_clearoriginalstoragecache) -* [_getStorageTrie](_state_statemanager_.defaultstatemanager.md#private-_getstoragetrie) -* [_lookupStorageTrie](_state_statemanager_.defaultstatemanager.md#private-_lookupstoragetrie) -* [_modifyContractStorage](_state_statemanager_.defaultstatemanager.md#private-_modifycontractstorage) -* [accountExists](_state_statemanager_.defaultstatemanager.md#accountexists) -* [accountIsEmpty](_state_statemanager_.defaultstatemanager.md#accountisempty) -* [checkpoint](_state_statemanager_.defaultstatemanager.md#checkpoint) -* [cleanupTouchedAccounts](_state_statemanager_.defaultstatemanager.md#cleanuptouchedaccounts) -* [clearContractStorage](_state_statemanager_.defaultstatemanager.md#clearcontractstorage) -* [commit](_state_statemanager_.defaultstatemanager.md#commit) -* [copy](_state_statemanager_.defaultstatemanager.md#copy) -* [deleteAccount](_state_statemanager_.defaultstatemanager.md#deleteaccount) -* [dumpStorage](_state_statemanager_.defaultstatemanager.md#dumpstorage) -* [generateCanonicalGenesis](_state_statemanager_.defaultstatemanager.md#generatecanonicalgenesis) -* [generateGenesis](_state_statemanager_.defaultstatemanager.md#generategenesis) -* [getAccount](_state_statemanager_.defaultstatemanager.md#getaccount) -* [getContractCode](_state_statemanager_.defaultstatemanager.md#getcontractcode) -* [getContractStorage](_state_statemanager_.defaultstatemanager.md#getcontractstorage) -* [getOriginalContractStorage](_state_statemanager_.defaultstatemanager.md#getoriginalcontractstorage) -* [getStateRoot](_state_statemanager_.defaultstatemanager.md#getstateroot) -* [hasGenesisState](_state_statemanager_.defaultstatemanager.md#hasgenesisstate) -* [putAccount](_state_statemanager_.defaultstatemanager.md#putaccount) -* [putContractCode](_state_statemanager_.defaultstatemanager.md#putcontractcode) -* [putContractStorage](_state_statemanager_.defaultstatemanager.md#putcontractstorage) -* [revert](_state_statemanager_.defaultstatemanager.md#revert) -* [setStateRoot](_state_statemanager_.defaultstatemanager.md#setstateroot) -* [touchAccount](_state_statemanager_.defaultstatemanager.md#touchaccount) - -## Constructors - -### constructor - -\+ **new DefaultStateManager**(`opts`: [DefaultStateManagerOpts](../interfaces/_state_statemanager_.defaultstatemanageropts.md)): *[DefaultStateManager](_state_statemanager_.defaultstatemanager.md)* - -*Defined in [state/stateManager.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L38)* - -Instantiate the StateManager interface. - -**Parameters:** - -Name | Type | Default | ------- | ------ | ------ | -`opts` | [DefaultStateManagerOpts](../interfaces/_state_statemanager_.defaultstatemanageropts.md) | {} | - -**Returns:** *[DefaultStateManager](_state_statemanager_.defaultstatemanager.md)* - -## Properties - -### _cache - -• **_cache**: *Cache* - -*Defined in [state/stateManager.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L34)* - -___ - -### _checkpointCount - -• **_checkpointCount**: *number* - -*Defined in [state/stateManager.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L37)* - -___ - -### _common - -• **_common**: *Common* - -*Defined in [state/stateManager.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L31)* - -___ - -### _originalStorageCache - -• **_originalStorageCache**: *Map‹string, Map‹string, Buffer››* - -*Defined in [state/stateManager.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L38)* - -___ - -### _storageTries - -• **_storageTries**: *any* - -*Defined in [state/stateManager.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L33)* - -___ - -### _touched - -• **_touched**: *Set‹string›* - -*Defined in [state/stateManager.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L35)* - -___ - -### _touchedStack - -• **_touchedStack**: *Set‹string›[]* - -*Defined in [state/stateManager.ts:36](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L36)* - -___ - -### _trie - -• **_trie**: *Trie* - -*Defined in [state/stateManager.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L32)* - -## Methods - -### _clearOriginalStorageCache - -▸ **_clearOriginalStorageCache**(): *void* - -*Defined in [state/stateManager.ts:234](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L234)* - -Clears the original storage cache. Refer to [getOriginalContractStorage](_state_statemanager_.defaultstatemanager.md#getoriginalcontractstorage) -for more explanation. - -**Returns:** *void* - -___ - -### `Private` _getStorageTrie - -▸ **_getStorageTrie**(`address`: Buffer): *Promise‹Trie›* - -*Defined in [state/stateManager.ts:167](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L167)* - -Gets the storage trie for an account from the storage -cache or does a lookup. - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹Trie›* - -___ - -### `Private` _lookupStorageTrie - -▸ **_lookupStorageTrie**(`address`: Buffer): *Promise‹Trie›* - -*Defined in [state/stateManager.ts:153](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L153)* - -Creates a storage trie from the primary storage trie -for an account and saves this in the storage cache. - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹Trie›* - -___ - -### `Private` _modifyContractStorage - -▸ **_modifyContractStorage**(`address`: Buffer, `modifyTrie`: function): *Promise‹void›* - -*Defined in [state/stateManager.ts:244](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L244)* - -Modifies the storage trie of an account. - -**Parameters:** - -▪ **address**: *Buffer* - -Address of the account whose storage is to be modified - -▪ **modifyTrie**: *function* - -Function to modify the storage trie of the account - -▸ (`storageTrie`: Trie, `done`: Function): *void* - -**Parameters:** - -Name | Type | ------- | ------ | -`storageTrie` | Trie | -`done` | Function | - -**Returns:** *Promise‹void›* - -___ - -### accountExists - -▸ **accountExists**(`address`: Buffer): *Promise‹boolean›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:496](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L496)* - -Checks if the `account` corresponding to `address` -exists - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the `account` to check | - -**Returns:** *Promise‹boolean›* - -___ - -### accountIsEmpty - -▸ **accountIsEmpty**(`address`: Buffer): *Promise‹boolean›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:486](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L486)* - -Checks if the `account` corresponding to `address` -is empty or non-existent as defined in -EIP-161 (https://eips.ethereum.org/EIPS/eip-161). - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address to check | - -**Returns:** *Promise‹boolean›* - -___ - -### checkpoint - -▸ **checkpoint**(): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:307](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L307)* - -Checkpoints the current state of the StateManager instance. -State changes that follow can then be committed by calling -`commit` or `reverted` by calling rollback. - -**Returns:** *Promise‹void›* - -___ - -### cleanupTouchedAccounts - -▸ **cleanupTouchedAccounts**(): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:511](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L511)* - -Removes accounts form the state trie that have been touched, -as defined in EIP-161 (https://eips.ethereum.org/EIPS/eip-161). - -**Returns:** *Promise‹void›* - -___ - -### clearContractStorage - -▸ **clearContractStorage**(`address`: Buffer): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:295](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L295)* - -Clears all storage entries for the account corresponding to `address`. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address to clear the storage of | - -**Returns:** *Promise‹void›* - -___ - -### commit - -▸ **commit**(): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:318](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L318)* - -Commits the current change-set to the instance since the -last call to checkpoint. - -**Returns:** *Promise‹void›* - -___ - -### copy - -▸ **copy**(): *[StateManager](../interfaces/_state_index_.statemanager.md)* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L64)* - -Copies the current instance of the `StateManager` -at the last fully committed point, i.e. as if all current -checkpoints were reverted. - -**Returns:** *[StateManager](../interfaces/_state_index_.statemanager.md)* - -___ - -### deleteAccount - -▸ **deleteAccount**(`address`: Buffer): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:97](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L97)* - -Deletes an [`@ethereumjs/account`](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/account) -from state under the provided `address`. The account will also be removed from the state trie. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the account which should be deleted | - -**Returns:** *Promise‹void›* - -___ - -### dumpStorage - -▸ **dumpStorage**(`address`: Buffer): *Promise‹[StorageDump](../interfaces/_state_interface_.storagedump.md)›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:416](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L416)* - -Dumps the the storage values for an `account` specified by `address`. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | The address of the `account` to return storage for | - -**Returns:** *Promise‹[StorageDump](../interfaces/_state_interface_.storagedump.md)›* - -- The state of the account as an `Object` map. -Keys are are the storage keys, values are the storage values as strings. -Both are represented as hex strings without the `0x` prefix. - -___ - -### generateCanonicalGenesis - -▸ **generateCanonicalGenesis**(): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:447](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L447)* - -Generates a canonical genesis state on the instance based on the -configured chain parameters. Will error if there are uncommitted -checkpoints on the instance. - -**Returns:** *Promise‹void›* - -___ - -### generateGenesis - -▸ **generateGenesis**(`initState`: any): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:462](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L462)* - -Initializes the provided genesis state into the state trie - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`initState` | any | Object (address -> balance) | - -**Returns:** *Promise‹void›* - -___ - -### getAccount - -▸ **getAccount**(`address`: Buffer): *Promise‹Account›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:73](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L73)* - -Gets the [`@ethereumjs/account`](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/account) -associated with `address`. Returns an empty account if the account does not exist. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the `account` to get | - -**Returns:** *Promise‹Account›* - -___ - -### getContractCode - -▸ **getContractCode**(`address`: Buffer): *Promise‹Buffer›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:139](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L139)* - -Gets the code corresponding to the provided `address`. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address to get the `code` for | - -**Returns:** *Promise‹Buffer›* - -- Resolves with the code corresponding to the provided address. -Returns an empty `Buffer` if the account has no associated code. - -___ - -### getContractStorage - -▸ **getContractStorage**(`address`: Buffer, `key`: Buffer): *Promise‹Buffer›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:186](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L186)* - -Gets the storage value associated with the provided `address` and `key`. This method returns -the shortest representation of the stored value. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the account to get the storage for | -`key` | Buffer | Key in the account's storage to get the value for. Must be 32 bytes long. | - -**Returns:** *Promise‹Buffer›* - -- The storage value for the account -corresponding to the provided address at the provided key. -If this does not exist an empty `Buffer` is returned. - -___ - -### getOriginalContractStorage - -▸ **getOriginalContractStorage**(`address`: Buffer, `key`: Buffer): *Promise‹Buffer›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:205](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L205)* - -Caches the storage value associated with the provided `address` and `key` -on first invocation, and returns the cached (original) value from then -onwards. This is used to get the original value of a storage slot for -computing gas costs according to EIP-1283. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the account to get the storage for | -`key` | Buffer | Key in the account's storage to get the value for. Must be 32 bytes long. | - -**Returns:** *Promise‹Buffer›* - -___ - -### getStateRoot - -▸ **getStateRoot**(`force`: boolean): *Promise‹Buffer›* - -*Defined in [state/stateManager.ts:369](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L369)* - -Gets the state-root of the Merkle-Patricia trie representation -of the state of this StateManager. Will error if there are uncommitted -checkpoints on the instance. - -**Parameters:** - -Name | Type | Default | Description | ------- | ------ | ------ | ------ | -`force` | boolean | false | If set to `true`, force a cache flush even if there are uncommited checkpoints (this is set to `true` pre-Byzantium in order to get intermediate state roots for the receipts) | - -**Returns:** *Promise‹Buffer›* - -- Returns the state-root of the `StateManager` - -___ - -### hasGenesisState - -▸ **hasGenesisState**(): *Promise‹boolean›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:437](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L437)* - -Checks whether the current instance has the canonical genesis state -for the configured chain parameters. - -**Returns:** *Promise‹boolean›* - -- Whether the storage trie contains the -canonical genesis state for the configured chain parameters. - -___ - -### putAccount - -▸ **putAccount**(`address`: Buffer, `account`: Account): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:84](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L84)* - -Saves an [`@ethereumjs/account`](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/account) -into state under the provided `address`. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address under which to store `account` | -`account` | Account | The [`@ethereumjs/account`](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/account) to store | - -**Returns:** *Promise‹void›* - -___ - -### putContractCode - -▸ **putContractCode**(`address`: Buffer, `value`: Buffer): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:119](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L119)* - -Adds `value` to the state trie as code, and sets `codeHash` on the account -corresponding to `address` to reference this. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address of the `account` to add the `code` for | -`value` | Buffer | The value of the `code` | - -**Returns:** *Promise‹void›* - -___ - -### putContractStorage - -▸ **putContractStorage**(`address`: Buffer, `key`: Buffer, `value`: Buffer): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:273](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L273)* - -Adds value to the state trie for the `account` -corresponding to `address` at the provided `key`. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`address` | Buffer | Address to set a storage value for | -`key` | Buffer | Key to set the value at. Must be 32 bytes long. | -`value` | Buffer | Value to set at `key` for account corresponding to `address` | - -**Returns:** *Promise‹void›* - -___ - -### revert - -▸ **revert**(): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:336](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L336)* - -Reverts the current change-set to the instance since the -last call to checkpoint. - -**Returns:** *Promise‹void›* - -___ - -### setStateRoot - -▸ **setStateRoot**(`stateRoot`: Buffer): *Promise‹void›* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:385](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L385)* - -Sets the state of the instance to that represented -by the provided `stateRoot`. Will error if there are uncommitted -checkpoints on the instance or if the state root does not exist in -the state trie. - -**Parameters:** - -Name | Type | Description | ------- | ------ | ------ | -`stateRoot` | Buffer | The state-root to reset the instance to | - -**Returns:** *Promise‹void›* - -___ - -### touchAccount - -▸ **touchAccount**(`address`: Buffer): *void* - -*Implementation of [StateManager](../interfaces/_state_index_.statemanager.md)* - -*Defined in [state/stateManager.ts:109](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L109)* - -Marks an account as touched, according to the definition -in [EIP-158](https://eips.ethereum.org/EIPS/eip-158). -This happens when the account is triggered for a state-changing -event. Touched accounts that are empty will be cleared -at the end of the tx. - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *void* diff --git a/packages/vm/docs/enums/_exceptions_.error.md b/packages/vm/docs/enums/_exceptions_.error.md deleted file mode 100644 index 84dcd3c6f6..0000000000 --- a/packages/vm/docs/enums/_exceptions_.error.md +++ /dev/null @@ -1,152 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["exceptions"](../modules/_exceptions_.md) › [ERROR](_exceptions_.error.md) - -# Enumeration: ERROR - -## Index - -### Enumeration members - -* [CREATE_COLLISION](_exceptions_.error.md#create_collision) -* [INTERNAL_ERROR](_exceptions_.error.md#internal_error) -* [INVALID_BEGINSUB](_exceptions_.error.md#invalid_beginsub) -* [INVALID_JUMP](_exceptions_.error.md#invalid_jump) -* [INVALID_JUMPSUB](_exceptions_.error.md#invalid_jumpsub) -* [INVALID_OPCODE](_exceptions_.error.md#invalid_opcode) -* [INVALID_RETURNSUB](_exceptions_.error.md#invalid_returnsub) -* [OUT_OF_GAS](_exceptions_.error.md#out_of_gas) -* [OUT_OF_RANGE](_exceptions_.error.md#out_of_range) -* [REFUND_EXHAUSTED](_exceptions_.error.md#refund_exhausted) -* [REVERT](_exceptions_.error.md#revert) -* [STACK_OVERFLOW](_exceptions_.error.md#stack_overflow) -* [STACK_UNDERFLOW](_exceptions_.error.md#stack_underflow) -* [STATIC_STATE_CHANGE](_exceptions_.error.md#static_state_change) -* [STOP](_exceptions_.error.md#stop) -* [VALUE_OVERFLOW](_exceptions_.error.md#value_overflow) - -## Enumeration members - -### CREATE_COLLISION - -• **CREATE_COLLISION**: = "create collision" - -*Defined in [exceptions.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L11)* - -___ - -### INTERNAL_ERROR - -• **INTERNAL_ERROR**: = "internal error" - -*Defined in [exceptions.ts:10](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L10)* - -___ - -### INVALID_BEGINSUB - -• **INVALID_BEGINSUB**: = "invalid BEGINSUB" - -*Defined in [exceptions.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L15)* - -___ - -### INVALID_JUMP - -• **INVALID_JUMP**: = "invalid JUMP" - -*Defined in [exceptions.ts:5](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L5)* - -___ - -### INVALID_JUMPSUB - -• **INVALID_JUMPSUB**: = "invalid JUMPSUB" - -*Defined in [exceptions.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L17)* - -___ - -### INVALID_OPCODE - -• **INVALID_OPCODE**: = "invalid opcode" - -*Defined in [exceptions.ts:6](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L6)* - -___ - -### INVALID_RETURNSUB - -• **INVALID_RETURNSUB**: = "invalid RETURNSUB" - -*Defined in [exceptions.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L16)* - -___ - -### OUT_OF_GAS - -• **OUT_OF_GAS**: = "out of gas" - -*Defined in [exceptions.ts:2](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L2)* - -___ - -### OUT_OF_RANGE - -• **OUT_OF_RANGE**: = "value out of range" - -*Defined in [exceptions.ts:7](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L7)* - -___ - -### REFUND_EXHAUSTED - -• **REFUND_EXHAUSTED**: = "refund exhausted" - -*Defined in [exceptions.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L13)* - -___ - -### REVERT - -• **REVERT**: = "revert" - -*Defined in [exceptions.ts:8](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L8)* - -___ - -### STACK_OVERFLOW - -• **STACK_OVERFLOW**: = "stack overflow" - -*Defined in [exceptions.ts:4](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L4)* - -___ - -### STACK_UNDERFLOW - -• **STACK_UNDERFLOW**: = "stack underflow" - -*Defined in [exceptions.ts:3](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L3)* - -___ - -### STATIC_STATE_CHANGE - -• **STATIC_STATE_CHANGE**: = "static state change" - -*Defined in [exceptions.ts:9](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L9)* - -___ - -### STOP - -• **STOP**: = "stop" - -*Defined in [exceptions.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L12)* - -___ - -### VALUE_OVERFLOW - -• **VALUE_OVERFLOW**: = "value overflow" - -*Defined in [exceptions.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L14)* diff --git a/packages/vm/docs/enums/_lib_exceptions_.error.md b/packages/vm/docs/enums/_lib_exceptions_.error.md new file mode 100644 index 0000000000..b2d849356c --- /dev/null +++ b/packages/vm/docs/enums/_lib_exceptions_.error.md @@ -0,0 +1,197 @@ +[@ethereumjs/vm](../README.md) › ["lib/exceptions"](../modules/_lib_exceptions_.md) › [ERROR](_lib_exceptions_.error.md) + +# Enumeration: ERROR + +## Index + +### Enumeration members + +* [BLS_12_381_FP_NOT_IN_FIELD](_lib_exceptions_.error.md#bls_12_381_fp_not_in_field) +* [BLS_12_381_INPUT_EMPTY](_lib_exceptions_.error.md#bls_12_381_input_empty) +* [BLS_12_381_INVALID_INPUT_LENGTH](_lib_exceptions_.error.md#bls_12_381_invalid_input_length) +* [BLS_12_381_POINT_NOT_ON_CURVE](_lib_exceptions_.error.md#bls_12_381_point_not_on_curve) +* [CODESTORE_OUT_OF_GAS](_lib_exceptions_.error.md#codestore_out_of_gas) +* [CREATE_COLLISION](_lib_exceptions_.error.md#create_collision) +* [INTERNAL_ERROR](_lib_exceptions_.error.md#internal_error) +* [INVALID_BEGINSUB](_lib_exceptions_.error.md#invalid_beginsub) +* [INVALID_JUMP](_lib_exceptions_.error.md#invalid_jump) +* [INVALID_JUMPSUB](_lib_exceptions_.error.md#invalid_jumpsub) +* [INVALID_OPCODE](_lib_exceptions_.error.md#invalid_opcode) +* [INVALID_RETURNSUB](_lib_exceptions_.error.md#invalid_returnsub) +* [OUT_OF_GAS](_lib_exceptions_.error.md#out_of_gas) +* [OUT_OF_RANGE](_lib_exceptions_.error.md#out_of_range) +* [REFUND_EXHAUSTED](_lib_exceptions_.error.md#refund_exhausted) +* [REVERT](_lib_exceptions_.error.md#revert) +* [STACK_OVERFLOW](_lib_exceptions_.error.md#stack_overflow) +* [STACK_UNDERFLOW](_lib_exceptions_.error.md#stack_underflow) +* [STATIC_STATE_CHANGE](_lib_exceptions_.error.md#static_state_change) +* [STOP](_lib_exceptions_.error.md#stop) +* [VALUE_OVERFLOW](_lib_exceptions_.error.md#value_overflow) + +## Enumeration members + +### BLS_12_381_FP_NOT_IN_FIELD + +• **BLS_12_381_FP_NOT_IN_FIELD**: = "fp point not in field" + +*Defined in [lib/exceptions.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L24)* + +___ + +### BLS_12_381_INPUT_EMPTY + +• **BLS_12_381_INPUT_EMPTY**: = "input is empty" + +*Defined in [lib/exceptions.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L23)* + +___ + +### BLS_12_381_INVALID_INPUT_LENGTH + +• **BLS_12_381_INVALID_INPUT_LENGTH**: = "invalid input length" + +*Defined in [lib/exceptions.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L21)* + +___ + +### BLS_12_381_POINT_NOT_ON_CURVE + +• **BLS_12_381_POINT_NOT_ON_CURVE**: = "point not on curve" + +*Defined in [lib/exceptions.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L22)* + +___ + +### CODESTORE_OUT_OF_GAS + +• **CODESTORE_OUT_OF_GAS**: = "code store out of gas" + +*Defined in [lib/exceptions.ts:3](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L3)* + +___ + +### CREATE_COLLISION + +• **CREATE_COLLISION**: = "create collision" + +*Defined in [lib/exceptions.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L12)* + +___ + +### INTERNAL_ERROR + +• **INTERNAL_ERROR**: = "internal error" + +*Defined in [lib/exceptions.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L11)* + +___ + +### INVALID_BEGINSUB + +• **INVALID_BEGINSUB**: = "invalid BEGINSUB" + +*Defined in [lib/exceptions.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L16)* + +___ + +### INVALID_JUMP + +• **INVALID_JUMP**: = "invalid JUMP" + +*Defined in [lib/exceptions.ts:6](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L6)* + +___ + +### INVALID_JUMPSUB + +• **INVALID_JUMPSUB**: = "invalid JUMPSUB" + +*Defined in [lib/exceptions.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L18)* + +___ + +### INVALID_OPCODE + +• **INVALID_OPCODE**: = "invalid opcode" + +*Defined in [lib/exceptions.ts:7](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L7)* + +___ + +### INVALID_RETURNSUB + +• **INVALID_RETURNSUB**: = "invalid RETURNSUB" + +*Defined in [lib/exceptions.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L17)* + +___ + +### OUT_OF_GAS + +• **OUT_OF_GAS**: = "out of gas" + +*Defined in [lib/exceptions.ts:2](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L2)* + +___ + +### OUT_OF_RANGE + +• **OUT_OF_RANGE**: = "value out of range" + +*Defined in [lib/exceptions.ts:8](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L8)* + +___ + +### REFUND_EXHAUSTED + +• **REFUND_EXHAUSTED**: = "refund exhausted" + +*Defined in [lib/exceptions.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L14)* + +___ + +### REVERT + +• **REVERT**: = "revert" + +*Defined in [lib/exceptions.ts:9](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L9)* + +___ + +### STACK_OVERFLOW + +• **STACK_OVERFLOW**: = "stack overflow" + +*Defined in [lib/exceptions.ts:5](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L5)* + +___ + +### STACK_UNDERFLOW + +• **STACK_UNDERFLOW**: = "stack underflow" + +*Defined in [lib/exceptions.ts:4](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L4)* + +___ + +### STATIC_STATE_CHANGE + +• **STATIC_STATE_CHANGE**: = "static state change" + +*Defined in [lib/exceptions.ts:10](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L10)* + +___ + +### STOP + +• **STOP**: = "stop" + +*Defined in [lib/exceptions.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L13)* + +___ + +### VALUE_OVERFLOW + +• **VALUE_OVERFLOW**: = "value overflow" + +*Defined in [lib/exceptions.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/exceptions.ts#L15)* diff --git a/packages/vm/docs/interfaces/_evm_evm_.evmresult.md b/packages/vm/docs/interfaces/_evm_evm_.evmresult.md deleted file mode 100644 index cd578f1c57..0000000000 --- a/packages/vm/docs/interfaces/_evm_evm_.evmresult.md +++ /dev/null @@ -1,49 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["evm/evm"](../modules/_evm_evm_.md) › [EVMResult](_evm_evm_.evmresult.md) - -# Interface: EVMResult - -Result of executing a message via the [[EVM]]. - -## Hierarchy - -* **EVMResult** - - ↳ [RunTxResult](_runtx_.runtxresult.md) - -## Index - -### Properties - -* [createdAddress](_evm_evm_.evmresult.md#optional-createdaddress) -* [execResult](_evm_evm_.evmresult.md#execresult) -* [gasUsed](_evm_evm_.evmresult.md#gasused) - -## Properties - -### `Optional` createdAddress - -• **createdAddress**? : *Buffer* - -*Defined in [evm/evm.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L31)* - -Address of created account durint transaction, if any - -___ - -### execResult - -• **execResult**: *[ExecResult](_evm_evm_.execresult.md)* - -*Defined in [evm/evm.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L35)* - -Contains the results from running the code, if any, as described in [runCode](../classes/_index_.vm.md#runcode) - -___ - -### gasUsed - -• **gasUsed**: *BN* - -*Defined in [evm/evm.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L27)* - -Amount of gas used by the transaction diff --git a/packages/vm/docs/interfaces/_evm_evm_.execresult.md b/packages/vm/docs/interfaces/_evm_evm_.execresult.md deleted file mode 100644 index 647cd381c1..0000000000 --- a/packages/vm/docs/interfaces/_evm_evm_.execresult.md +++ /dev/null @@ -1,100 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["evm/evm"](../modules/_evm_evm_.md) › [ExecResult](_evm_evm_.execresult.md) - -# Interface: ExecResult - -Result of executing a call via the [[EVM]]. - -## Hierarchy - -* **ExecResult** - -## Index - -### Properties - -* [exceptionError](_evm_evm_.execresult.md#optional-exceptionerror) -* [gas](_evm_evm_.execresult.md#optional-gas) -* [gasRefund](_evm_evm_.execresult.md#optional-gasrefund) -* [gasUsed](_evm_evm_.execresult.md#gasused) -* [logs](_evm_evm_.execresult.md#optional-logs) -* [returnValue](_evm_evm_.execresult.md#returnvalue) -* [runState](_evm_evm_.execresult.md#optional-runstate) -* [selfdestruct](_evm_evm_.execresult.md#optional-selfdestruct) - -## Properties - -### `Optional` exceptionError - -• **exceptionError**? : *[VmError](../classes/_exceptions_.vmerror.md)* - -*Defined in [evm/evm.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L46)* - -Description of the exception, if any occured - -___ - -### `Optional` gas - -• **gas**? : *BN* - -*Defined in [evm/evm.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L50)* - -Amount of gas left - -___ - -### `Optional` gasRefund - -• **gasRefund**? : *BN* - -*Defined in [evm/evm.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L70)* - -Total amount of gas to be refunded from all nested calls. - -___ - -### gasUsed - -• **gasUsed**: *BN* - -*Defined in [evm/evm.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L54)* - -Amount of gas the code used to run - -___ - -### `Optional` logs - -• **logs**? : *any[]* - -*Defined in [evm/evm.ts:62](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L62)* - -Array of logs that the contract emitted - -___ - -### returnValue - -• **returnValue**: *Buffer* - -*Defined in [evm/evm.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L58)* - -Return value from the contract - -___ - -### `Optional` runState - -• **runState**? : *RunState* - -*Defined in [evm/evm.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L42)* - -___ - -### `Optional` selfdestruct - -• **selfdestruct**? : *undefined | object* - -*Defined in [evm/evm.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L66)* - -A map from the accounts that have self-destructed to the addresses to send their funds to diff --git a/packages/vm/docs/interfaces/_evm_evm_.newcontractevent.md b/packages/vm/docs/interfaces/_evm_evm_.newcontractevent.md deleted file mode 100644 index 282ab74c54..0000000000 --- a/packages/vm/docs/interfaces/_evm_evm_.newcontractevent.md +++ /dev/null @@ -1,30 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["evm/evm"](../modules/_evm_evm_.md) › [NewContractEvent](_evm_evm_.newcontractevent.md) - -# Interface: NewContractEvent - -## Hierarchy - -* **NewContractEvent** - -## Index - -### Properties - -* [address](_evm_evm_.newcontractevent.md#address) -* [code](_evm_evm_.newcontractevent.md#code) - -## Properties - -### address - -• **address**: *Buffer* - -*Defined in [evm/evm.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L74)* - -___ - -### code - -• **code**: *Buffer* - -*Defined in [evm/evm.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L76)* diff --git a/packages/vm/docs/interfaces/_index_.vmopts.md b/packages/vm/docs/interfaces/_index_.vmopts.md deleted file mode 100644 index cd65531685..0000000000 --- a/packages/vm/docs/interfaces/_index_.vmopts.md +++ /dev/null @@ -1,109 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["index"](../modules/_index_.md) › [VMOpts](_index_.vmopts.md) - -# Interface: VMOpts - -Options for instantiating a [VM](../classes/_index_.vm.md). - -## Hierarchy - -* **VMOpts** - -## Index - -### Properties - -* [activatePrecompiles](_index_.vmopts.md#optional-activateprecompiles) -* [allowUnlimitedContractSize](_index_.vmopts.md#optional-allowunlimitedcontractsize) -* [blockchain](_index_.vmopts.md#optional-blockchain) -* [chain](_index_.vmopts.md#optional-chain) -* [common](_index_.vmopts.md#optional-common) -* [hardfork](_index_.vmopts.md#optional-hardfork) -* [state](_index_.vmopts.md#optional-state) -* [stateManager](_index_.vmopts.md#optional-statemanager) - -## Properties - -### `Optional` activatePrecompiles - -• **activatePrecompiles**? : *undefined | false | true* - -*Defined in [index.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L53)* - -If true, create entries in the state tree for the precompiled contracts, saving some gas the -first time each of them is called. - -If this parameter is false, the first call to each of them has to pay an extra 25000 gas -for creating the account. - -Setting this to true has the effect of precompiled contracts' gas costs matching mainnet's from -the very first call, which is intended for testing networks. - -___ - -### `Optional` allowUnlimitedContractSize - -• **allowUnlimitedContractSize**? : *undefined | false | true* - -*Defined in [index.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L57)* - -Allows unlimited contract sizes while debugging. By setting this to `true`, the check for contract size limit of 24KB (see [EIP-170](https://git.io/vxZkK)) is bypassed - -___ - -### `Optional` blockchain - -• **blockchain**? : *Blockchain* - -*Defined in [index.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L42)* - -A [blockchain](https://github.com/ethereumjs/ethereumjs-blockchain) object for storing/retrieving blocks - -___ - -### `Optional` chain - -• **chain**? : *undefined | string* - -*Defined in [index.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L25)* - -The chain the VM operates on - -___ - -### `Optional` common - -• **common**? : *Common* - -*Defined in [index.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L58)* - -___ - -### `Optional` hardfork - -• **hardfork**? : *undefined | string* - -*Defined in [index.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L29)* - -Hardfork rules to be used - -___ - -### `Optional` state - -• **state**? : *any* - -*Defined in [index.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L38)* - -A [merkle-patricia-tree](https://github.com/ethereumjs/merkle-patricia-tree) instance for the state tree (ignored if stateManager is passed) - -**`deprecated`** - -___ - -### `Optional` stateManager - -• **stateManager**? : *[StateManager](_state_index_.statemanager.md)* - -*Defined in [index.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L33)* - -A [StateManager](_state_index_.statemanager.md) instance to use as the state store (Beta API) diff --git a/packages/vm/docs/interfaces/_lib_evm_evm_.evmresult.md b/packages/vm/docs/interfaces/_lib_evm_evm_.evmresult.md new file mode 100644 index 0000000000..9ca854f985 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_evm_evm_.evmresult.md @@ -0,0 +1,49 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/evm"](../modules/_lib_evm_evm_.md) › [EVMResult](_lib_evm_evm_.evmresult.md) + +# Interface: EVMResult + +Result of executing a message via the [[EVM]]. + +## Hierarchy + +* **EVMResult** + + ↳ [RunTxResult](_lib_runtx_.runtxresult.md) + +## Index + +### Properties + +* [createdAddress](_lib_evm_evm_.evmresult.md#optional-createdaddress) +* [execResult](_lib_evm_evm_.evmresult.md#execresult) +* [gasUsed](_lib_evm_evm_.evmresult.md#gasused) + +## Properties + +### `Optional` createdAddress + +• **createdAddress**? : *Address* + +*Defined in [lib/evm/evm.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L31)* + +Address of created account durint transaction, if any + +___ + +### execResult + +• **execResult**: *[ExecResult](_lib_evm_evm_.execresult.md)* + +*Defined in [lib/evm/evm.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L35)* + +Contains the results from running the code, if any, as described in [runCode](../classes/_lib_index_.vm.md#runcode) + +___ + +### gasUsed + +• **gasUsed**: *BN* + +*Defined in [lib/evm/evm.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L27)* + +Amount of gas used by the transaction diff --git a/packages/vm/docs/interfaces/_lib_evm_evm_.execresult.md b/packages/vm/docs/interfaces/_lib_evm_evm_.execresult.md new file mode 100644 index 0000000000..7777e89383 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_evm_evm_.execresult.md @@ -0,0 +1,100 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/evm"](../modules/_lib_evm_evm_.md) › [ExecResult](_lib_evm_evm_.execresult.md) + +# Interface: ExecResult + +Result of executing a call via the [[EVM]]. + +## Hierarchy + +* **ExecResult** + +## Index + +### Properties + +* [exceptionError](_lib_evm_evm_.execresult.md#optional-exceptionerror) +* [gas](_lib_evm_evm_.execresult.md#optional-gas) +* [gasRefund](_lib_evm_evm_.execresult.md#optional-gasrefund) +* [gasUsed](_lib_evm_evm_.execresult.md#gasused) +* [logs](_lib_evm_evm_.execresult.md#optional-logs) +* [returnValue](_lib_evm_evm_.execresult.md#returnvalue) +* [runState](_lib_evm_evm_.execresult.md#optional-runstate) +* [selfdestruct](_lib_evm_evm_.execresult.md#optional-selfdestruct) + +## Properties + +### `Optional` exceptionError + +• **exceptionError**? : *[VmError](../classes/_lib_exceptions_.vmerror.md)* + +*Defined in [lib/evm/evm.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L46)* + +Description of the exception, if any occured + +___ + +### `Optional` gas + +• **gas**? : *BN* + +*Defined in [lib/evm/evm.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L50)* + +Amount of gas left + +___ + +### `Optional` gasRefund + +• **gasRefund**? : *BN* + +*Defined in [lib/evm/evm.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L70)* + +Total amount of gas to be refunded from all nested calls. + +___ + +### gasUsed + +• **gasUsed**: *BN* + +*Defined in [lib/evm/evm.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L54)* + +Amount of gas the code used to run + +___ + +### `Optional` logs + +• **logs**? : *any[]* + +*Defined in [lib/evm/evm.ts:62](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L62)* + +Array of logs that the contract emitted + +___ + +### returnValue + +• **returnValue**: *Buffer* + +*Defined in [lib/evm/evm.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L58)* + +Return value from the contract + +___ + +### `Optional` runState + +• **runState**? : *RunState* + +*Defined in [lib/evm/evm.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L42)* + +___ + +### `Optional` selfdestruct + +• **selfdestruct**? : *undefined | object* + +*Defined in [lib/evm/evm.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L66)* + +A map from the accounts that have self-destructed to the addresses to send their funds to diff --git a/packages/vm/docs/interfaces/_lib_evm_evm_.newcontractevent.md b/packages/vm/docs/interfaces/_lib_evm_evm_.newcontractevent.md new file mode 100644 index 0000000000..fc37d1d085 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_evm_evm_.newcontractevent.md @@ -0,0 +1,30 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/evm"](../modules/_lib_evm_evm_.md) › [NewContractEvent](_lib_evm_evm_.newcontractevent.md) + +# Interface: NewContractEvent + +## Hierarchy + +* **NewContractEvent** + +## Index + +### Properties + +* [address](_lib_evm_evm_.newcontractevent.md#address) +* [code](_lib_evm_evm_.newcontractevent.md#code) + +## Properties + +### address + +• **address**: *Address* + +*Defined in [lib/evm/evm.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L74)* + +___ + +### code + +• **code**: *Buffer* + +*Defined in [lib/evm/evm.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L76)* diff --git a/packages/vm/docs/interfaces/_lib_evm_opcodes_functions_.asyncophandler.md b/packages/vm/docs/interfaces/_lib_evm_opcodes_functions_.asyncophandler.md new file mode 100644 index 0000000000..a08a4ecce4 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_evm_opcodes_functions_.asyncophandler.md @@ -0,0 +1,21 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/functions"](../modules/_lib_evm_opcodes_functions_.md) › [AsyncOpHandler](_lib_evm_opcodes_functions_.asyncophandler.md) + +# Interface: AsyncOpHandler + +## Hierarchy + +* **AsyncOpHandler** + +## Callable + +▸ (`runState`: RunState): *Promise‹void›* + +*Defined in [lib/evm/opcodes/functions.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/functions.ts#L34)* + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | + +**Returns:** *Promise‹void›* diff --git a/packages/vm/docs/interfaces/_lib_evm_opcodes_functions_.syncophandler.md b/packages/vm/docs/interfaces/_lib_evm_opcodes_functions_.syncophandler.md new file mode 100644 index 0000000000..63719c7638 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_evm_opcodes_functions_.syncophandler.md @@ -0,0 +1,21 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/functions"](../modules/_lib_evm_opcodes_functions_.md) › [SyncOpHandler](_lib_evm_opcodes_functions_.syncophandler.md) + +# Interface: SyncOpHandler + +## Hierarchy + +* **SyncOpHandler** + +## Callable + +▸ (`runState`: RunState): *void* + +*Defined in [lib/evm/opcodes/functions.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/functions.ts#L30)* + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | + +**Returns:** *void* diff --git a/packages/vm/docs/interfaces/_lib_evm_opcodes_index_.asyncophandler.md b/packages/vm/docs/interfaces/_lib_evm_opcodes_index_.asyncophandler.md new file mode 100644 index 0000000000..50de7b207a --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_evm_opcodes_index_.asyncophandler.md @@ -0,0 +1,21 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/index"](../modules/_lib_evm_opcodes_index_.md) › [AsyncOpHandler](_lib_evm_opcodes_index_.asyncophandler.md) + +# Interface: AsyncOpHandler + +## Hierarchy + +* **AsyncOpHandler** + +## Callable + +▸ (`runState`: RunState): *Promise‹void›* + +*Defined in [lib/evm/opcodes/functions.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/functions.ts#L34)* + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | + +**Returns:** *Promise‹void›* diff --git a/packages/vm/docs/interfaces/_lib_evm_opcodes_index_.syncophandler.md b/packages/vm/docs/interfaces/_lib_evm_opcodes_index_.syncophandler.md new file mode 100644 index 0000000000..0056054337 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_evm_opcodes_index_.syncophandler.md @@ -0,0 +1,21 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/index"](../modules/_lib_evm_opcodes_index_.md) › [SyncOpHandler](_lib_evm_opcodes_index_.syncophandler.md) + +# Interface: SyncOpHandler + +## Hierarchy + +* **SyncOpHandler** + +## Callable + +▸ (`runState`: RunState): *void* + +*Defined in [lib/evm/opcodes/functions.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/functions.ts#L30)* + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | + +**Returns:** *void* diff --git a/packages/vm/docs/interfaces/_lib_index_.vmopts.md b/packages/vm/docs/interfaces/_lib_index_.vmopts.md new file mode 100644 index 0000000000..d02139b5e4 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_index_.vmopts.md @@ -0,0 +1,118 @@ +[@ethereumjs/vm](../README.md) › ["lib/index"](../modules/_lib_index_.md) › [VMOpts](_lib_index_.vmopts.md) + +# Interface: VMOpts + +Options for instantiating a [VM](../classes/_lib_index_.vm.md). + +## Hierarchy + +* **VMOpts** + +## Index + +### Properties + +* [activatePrecompiles](_lib_index_.vmopts.md#optional-activateprecompiles) +* [allowUnlimitedContractSize](_lib_index_.vmopts.md#optional-allowunlimitedcontractsize) +* [blockchain](_lib_index_.vmopts.md#optional-blockchain) +* [common](_lib_index_.vmopts.md#optional-common) +* [state](_lib_index_.vmopts.md#optional-state) +* [stateManager](_lib_index_.vmopts.md#optional-statemanager) + +## Properties + +### `Optional` activatePrecompiles + +• **activatePrecompiles**? : *undefined | false | true* + +*Defined in [lib/index.ts:83](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L83)* + +If true, create entries in the state tree for the precompiled contracts, saving some gas the +first time each of them is called. + +If this parameter is false, the first call to each of them has to pay an extra 25000 gas +for creating the account. + +Setting this to true has the effect of precompiled contracts' gas costs matching mainnet's from +the very first call, which is intended for testing networks. + +Default: `false` + +___ + +### `Optional` allowUnlimitedContractSize + +• **allowUnlimitedContractSize**? : *undefined | false | true* + +*Defined in [lib/index.ts:90](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L90)* + +Allows unlimited contract sizes while debugging. By setting this to `true`, the check for +contract size limit of 24KB (see [EIP-170](https://git.io/vxZkK)) is bypassed. + +Default: `false` [ONLY set to `true` during debugging] + +___ + +### `Optional` blockchain + +• **blockchain**? : *Blockchain* + +*Defined in [lib/index.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L70)* + +A [blockchain](https://github.com/ethereumjs/ethereumjs-vm/packages/blockchain) object for storing/retrieving blocks + +___ + +### `Optional` common + +• **common**? : *Common* + +*Defined in [lib/index.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L57)* + +Use a [common](https://github.com/ethereumjs/ethereumjs-vm/packages/common) instance +if you want to change the chain setup. + +### Possible Values + +- `chain`: all chains supported by `Common` or a custom chain +- `hardfork`: `mainnet` hardforks up to the `MuirGlacier` hardfork +- `eips`: `2537` (usage e.g. `eips: [ 2537, ]`) + +### Supported EIPs + +- [EIP-2537](https://eips.ethereum.org/EIPS/eip-2537) (`experimental`) - BLS12-381 precompiles +- [EIP-2929](https://eips.ethereum.org/EIPS/eip-2929) (`experimental`) - Gas cost increases for state access opcodes + +*Annotations:* + +- `experimental`: behaviour can change on patch versions + +### Default Setup + +Default setup if no `Common` instance is provided: + +- `chain`: `mainnet` +- `hardfork`: `istanbul` +- `eips`: `[]` + +___ + +### `Optional` state + +• **state**? : *any* + +*Defined in [lib/index.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L66)* + +A [merkle-patricia-tree](https://github.com/ethereumjs/merkle-patricia-tree) instance for the state tree (ignored if stateManager is passed) + +**`deprecated`** + +___ + +### `Optional` stateManager + +• **stateManager**? : *[StateManager](_lib_state_index_.statemanager.md)* + +*Defined in [lib/index.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/index.ts#L61)* + +A [StateManager](_lib_state_index_.statemanager.md) instance to use as the state store (Beta API) diff --git a/packages/vm/docs/interfaces/_lib_runblock_.postbyzantiumtxreceipt.md b/packages/vm/docs/interfaces/_lib_runblock_.postbyzantiumtxreceipt.md new file mode 100644 index 0000000000..76e8979dac --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_runblock_.postbyzantiumtxreceipt.md @@ -0,0 +1,67 @@ +[@ethereumjs/vm](../README.md) › ["lib/runBlock"](../modules/_lib_runblock_.md) › [PostByzantiumTxReceipt](_lib_runblock_.postbyzantiumtxreceipt.md) + +# Interface: PostByzantiumTxReceipt + +Receipt type for Byzantium and beyond replacing the intermediary +state root field with a status code field (EIP-658) + +## Hierarchy + +* TxReceipt + + ↳ **PostByzantiumTxReceipt** + +## Index + +### Properties + +* [bitvector](_lib_runblock_.postbyzantiumtxreceipt.md#bitvector) +* [gasUsed](_lib_runblock_.postbyzantiumtxreceipt.md#gasused) +* [logs](_lib_runblock_.postbyzantiumtxreceipt.md#logs) +* [status](_lib_runblock_.postbyzantiumtxreceipt.md#status) + +## Properties + +### bitvector + +• **bitvector**: *Buffer* + +*Inherited from [PreByzantiumTxReceipt](_lib_runblock_.prebyzantiumtxreceipt.md).[bitvector](_lib_runblock_.prebyzantiumtxreceipt.md#bitvector)* + +*Defined in [lib/runBlock.ts:78](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L78)* + +Bloom bitvector + +___ + +### gasUsed + +• **gasUsed**: *Buffer* + +*Inherited from [PreByzantiumTxReceipt](_lib_runblock_.prebyzantiumtxreceipt.md).[gasUsed](_lib_runblock_.prebyzantiumtxreceipt.md#gasused)* + +*Defined in [lib/runBlock.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L74)* + +Gas used + +___ + +### logs + +• **logs**: *any[]* + +*Inherited from [PreByzantiumTxReceipt](_lib_runblock_.prebyzantiumtxreceipt.md).[logs](_lib_runblock_.prebyzantiumtxreceipt.md#logs)* + +*Defined in [lib/runBlock.ts:82](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L82)* + +Logs emitted + +___ + +### status + +• **status**: *0 | 1* + +*Defined in [lib/runBlock.ts:104](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L104)* + +Status of transaction, `1` if successful, `0` if an exception occured diff --git a/packages/vm/docs/interfaces/_lib_runblock_.prebyzantiumtxreceipt.md b/packages/vm/docs/interfaces/_lib_runblock_.prebyzantiumtxreceipt.md new file mode 100644 index 0000000000..01e3254ead --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_runblock_.prebyzantiumtxreceipt.md @@ -0,0 +1,67 @@ +[@ethereumjs/vm](../README.md) › ["lib/runBlock"](../modules/_lib_runblock_.md) › [PreByzantiumTxReceipt](_lib_runblock_.prebyzantiumtxreceipt.md) + +# Interface: PreByzantiumTxReceipt + +Pre-Byzantium receipt type with a field +for the intermediary state root + +## Hierarchy + +* TxReceipt + + ↳ **PreByzantiumTxReceipt** + +## Index + +### Properties + +* [bitvector](_lib_runblock_.prebyzantiumtxreceipt.md#bitvector) +* [gasUsed](_lib_runblock_.prebyzantiumtxreceipt.md#gasused) +* [logs](_lib_runblock_.prebyzantiumtxreceipt.md#logs) +* [stateRoot](_lib_runblock_.prebyzantiumtxreceipt.md#stateroot) + +## Properties + +### bitvector + +• **bitvector**: *Buffer* + +*Inherited from [PreByzantiumTxReceipt](_lib_runblock_.prebyzantiumtxreceipt.md).[bitvector](_lib_runblock_.prebyzantiumtxreceipt.md#bitvector)* + +*Defined in [lib/runBlock.ts:78](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L78)* + +Bloom bitvector + +___ + +### gasUsed + +• **gasUsed**: *Buffer* + +*Inherited from [PreByzantiumTxReceipt](_lib_runblock_.prebyzantiumtxreceipt.md).[gasUsed](_lib_runblock_.prebyzantiumtxreceipt.md#gasused)* + +*Defined in [lib/runBlock.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L74)* + +Gas used + +___ + +### logs + +• **logs**: *any[]* + +*Inherited from [PreByzantiumTxReceipt](_lib_runblock_.prebyzantiumtxreceipt.md).[logs](_lib_runblock_.prebyzantiumtxreceipt.md#logs)* + +*Defined in [lib/runBlock.ts:82](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L82)* + +Logs emitted + +___ + +### stateRoot + +• **stateRoot**: *Buffer* + +*Defined in [lib/runBlock.ts:93](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L93)* + +Intermediary state root diff --git a/packages/vm/docs/interfaces/_lib_runblock_.runblockopts.md b/packages/vm/docs/interfaces/_lib_runblock_.runblockopts.md new file mode 100644 index 0000000000..fe01627b7e --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_runblock_.runblockopts.md @@ -0,0 +1,86 @@ +[@ethereumjs/vm](../README.md) › ["lib/runBlock"](../modules/_lib_runblock_.md) › [RunBlockOpts](_lib_runblock_.runblockopts.md) + +# Interface: RunBlockOpts + +Options for running a block. + +## Hierarchy + +* **RunBlockOpts** + +## Index + +### Properties + +* [block](_lib_runblock_.runblockopts.md#block) +* [generate](_lib_runblock_.runblockopts.md#optional-generate) +* [root](_lib_runblock_.runblockopts.md#optional-root) +* [skipBalance](_lib_runblock_.runblockopts.md#optional-skipbalance) +* [skipBlockValidation](_lib_runblock_.runblockopts.md#optional-skipblockvalidation) +* [skipNonce](_lib_runblock_.runblockopts.md#optional-skipnonce) + +## Properties + +### block + +• **block**: *Block* + +*Defined in [lib/runBlock.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L24)* + +The @ethereumjs/block to process + +___ + +### `Optional` generate + +• **generate**? : *undefined | false | true* + +*Defined in [lib/runBlock.ts:36](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L36)* + +Whether to generate the stateRoot. If `true` `runBlock` will check the +`stateRoot` of the block against the current Trie, check the `receiptsTrie`, +the `gasUsed` and the `logsBloom` after running. If any does not match, +`runBlock` throws. +Defaults to `false`. + +___ + +### `Optional` root + +• **root**? : *Buffer* + +*Defined in [lib/runBlock.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L28)* + +Root of the state trie + +___ + +### `Optional` skipBalance + +• **skipBalance**? : *undefined | false | true* + +*Defined in [lib/runBlock.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L50)* + +If true, skips the balance check + +___ + +### `Optional` skipBlockValidation + +• **skipBlockValidation**? : *undefined | false | true* + +*Defined in [lib/runBlock.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L42)* + +If true, will skip "Block validation": +Block validation validates the header (with respect to the blockchain), +the transactions, the transaction trie and the uncle hash. + +___ + +### `Optional` skipNonce + +• **skipNonce**? : *undefined | false | true* + +*Defined in [lib/runBlock.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L46)* + +If true, skips the nonce check diff --git a/packages/vm/docs/interfaces/_lib_runblock_.runblockresult.md b/packages/vm/docs/interfaces/_lib_runblock_.runblockresult.md new file mode 100644 index 0000000000..88b6608be7 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_runblock_.runblockresult.md @@ -0,0 +1,36 @@ +[@ethereumjs/vm](../README.md) › ["lib/runBlock"](../modules/_lib_runblock_.md) › [RunBlockResult](_lib_runblock_.runblockresult.md) + +# Interface: RunBlockResult + +Result of [runBlock](../classes/_lib_index_.vm.md#runblock) + +## Hierarchy + +* **RunBlockResult** + +## Index + +### Properties + +* [receipts](_lib_runblock_.runblockresult.md#receipts) +* [results](_lib_runblock_.runblockresult.md#results) + +## Properties + +### receipts + +• **receipts**: *([PreByzantiumTxReceipt](_lib_runblock_.prebyzantiumtxreceipt.md) | [PostByzantiumTxReceipt](_lib_runblock_.postbyzantiumtxreceipt.md))[]* + +*Defined in [lib/runBlock.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L60)* + +Receipts generated for transactions in the block + +___ + +### results + +• **results**: *[RunTxResult](_lib_runtx_.runtxresult.md)[]* + +*Defined in [lib/runBlock.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L64)* + +Results of executing the transactions in the block diff --git a/packages/vm/docs/interfaces/_lib_runcall_.runcallopts.md b/packages/vm/docs/interfaces/_lib_runcall_.runcallopts.md new file mode 100644 index 0000000000..e5a19bfaaa --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_runcall_.runcallopts.md @@ -0,0 +1,151 @@ +[@ethereumjs/vm](../README.md) › ["lib/runCall"](../modules/_lib_runcall_.md) › [RunCallOpts](_lib_runcall_.runcallopts.md) + +# Interface: RunCallOpts + +Options for running a call (or create) operation + +## Hierarchy + +* **RunCallOpts** + +## Index + +### Properties + +* [block](_lib_runcall_.runcallopts.md#optional-block) +* [caller](_lib_runcall_.runcallopts.md#optional-caller) +* [code](_lib_runcall_.runcallopts.md#optional-code) +* [compiled](_lib_runcall_.runcallopts.md#optional-compiled) +* [data](_lib_runcall_.runcallopts.md#optional-data) +* [delegatecall](_lib_runcall_.runcallopts.md#optional-delegatecall) +* [depth](_lib_runcall_.runcallopts.md#optional-depth) +* [gasLimit](_lib_runcall_.runcallopts.md#optional-gaslimit) +* [gasPrice](_lib_runcall_.runcallopts.md#optional-gasprice) +* [origin](_lib_runcall_.runcallopts.md#optional-origin) +* [salt](_lib_runcall_.runcallopts.md#optional-salt) +* [selfdestruct](_lib_runcall_.runcallopts.md#optional-selfdestruct) +* [static](_lib_runcall_.runcallopts.md#optional-static) +* [to](_lib_runcall_.runcallopts.md#optional-to) +* [value](_lib_runcall_.runcallopts.md#optional-value) + +## Properties + +### `Optional` block + +• **block**? : *Block* + +*Defined in [lib/runCall.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L12)* + +___ + +### `Optional` caller + +• **caller**? : *Address* + +*Defined in [lib/runCall.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L15)* + +___ + +### `Optional` code + +• **code**? : *Buffer* + +*Defined in [lib/runCall.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L23)* + +This is for CALLCODE where the code to load is different than the code from the to account + +___ + +### `Optional` compiled + +• **compiled**? : *undefined | false | true* + +*Defined in [lib/runCall.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L25)* + +___ + +### `Optional` data + +• **data**? : *Buffer* + +*Defined in [lib/runCall.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L19)* + +___ + +### `Optional` delegatecall + +• **delegatecall**? : *undefined | false | true* + +*Defined in [lib/runCall.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L29)* + +___ + +### `Optional` depth + +• **depth**? : *undefined | number* + +*Defined in [lib/runCall.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L24)* + +___ + +### `Optional` gasLimit + +• **gasLimit**? : *BN* + +*Defined in [lib/runCall.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L16)* + +___ + +### `Optional` gasPrice + +• **gasPrice**? : *BN* + +*Defined in [lib/runCall.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L13)* + +___ + +### `Optional` origin + +• **origin**? : *Address* + +*Defined in [lib/runCall.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L14)* + +___ + +### `Optional` salt + +• **salt**? : *Buffer* + +*Defined in [lib/runCall.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L27)* + +___ + +### `Optional` selfdestruct + +• **selfdestruct**? : *undefined | object* + +*Defined in [lib/runCall.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L28)* + +___ + +### `Optional` static + +• **static**? : *undefined | false | true* + +*Defined in [lib/runCall.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L26)* + +___ + +### `Optional` to + +• **to**? : *Address* + +*Defined in [lib/runCall.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L17)* + +___ + +### `Optional` value + +• **value**? : *BN* + +*Defined in [lib/runCall.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L18)* diff --git a/packages/vm/docs/interfaces/_lib_runcode_.runcodeopts.md b/packages/vm/docs/interfaces/_lib_runcode_.runcodeopts.md new file mode 100644 index 0000000000..a50eced066 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_runcode_.runcodeopts.md @@ -0,0 +1,176 @@ +[@ethereumjs/vm](../README.md) › ["lib/runCode"](../modules/_lib_runcode_.md) › [RunCodeOpts](_lib_runcode_.runcodeopts.md) + +# Interface: RunCodeOpts + +Options for the [runCode](../classes/_lib_index_.vm.md#runcode) method. + +## Hierarchy + +* **RunCodeOpts** + +## Index + +### Properties + +* [address](_lib_runcode_.runcodeopts.md#optional-address) +* [block](_lib_runcode_.runcodeopts.md#optional-block) +* [caller](_lib_runcode_.runcodeopts.md#optional-caller) +* [code](_lib_runcode_.runcodeopts.md#optional-code) +* [data](_lib_runcode_.runcodeopts.md#optional-data) +* [depth](_lib_runcode_.runcodeopts.md#optional-depth) +* [evm](_lib_runcode_.runcodeopts.md#optional-evm) +* [gasLimit](_lib_runcode_.runcodeopts.md#optional-gaslimit) +* [gasPrice](_lib_runcode_.runcodeopts.md#optional-gasprice) +* [isStatic](_lib_runcode_.runcodeopts.md#optional-isstatic) +* [message](_lib_runcode_.runcodeopts.md#optional-message) +* [origin](_lib_runcode_.runcodeopts.md#optional-origin) +* [pc](_lib_runcode_.runcodeopts.md#optional-pc) +* [selfdestruct](_lib_runcode_.runcodeopts.md#optional-selfdestruct) +* [txContext](_lib_runcode_.runcodeopts.md#optional-txcontext) +* [value](_lib_runcode_.runcodeopts.md#optional-value) + +## Properties + +### `Optional` address + +• **address**? : *Address* + +*Defined in [lib/runCode.ts:63](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L63)* + +The address of the account that is executing this code. Defaults to the zero address. + +___ + +### `Optional` block + +• **block**? : *Block* + +*Defined in [lib/runCode.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L28)* + +The [`Block`](https://github.com/ethereumjs/ethereumjs-block) the `tx` belongs to. If omitted a blank block will be used + +___ + +### `Optional` caller + +• **caller**? : *Address* + +*Defined in [lib/runCode.ts:40](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L40)* + +The address that ran this code. Defaults to the zero address. + +___ + +### `Optional` code + +• **code**? : *Buffer* + +*Defined in [lib/runCode.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L44)* + +The EVM code to run + +___ + +### `Optional` data + +• **data**? : *Buffer* + +*Defined in [lib/runCode.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L48)* + +The input data + +___ + +### `Optional` depth + +• **depth**? : *undefined | number* + +*Defined in [lib/runCode.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L57)* + +___ + +### `Optional` evm + +• **evm**? : *EVM* + +*Defined in [lib/runCode.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L29)* + +___ + +### `Optional` gasLimit + +• **gasLimit**? : *BN* + +*Defined in [lib/runCode.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L52)* + +Gas limit + +___ + +### `Optional` gasPrice + +• **gasPrice**? : *BN* + +*Defined in [lib/runCode.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L31)* + +___ + +### `Optional` isStatic + +• **isStatic**? : *undefined | false | true* + +*Defined in [lib/runCode.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L58)* + +___ + +### `Optional` message + +• **message**? : *Message* + +*Defined in [lib/runCode.ts:36](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L36)* + +___ + +### `Optional` origin + +• **origin**? : *Address* + +*Defined in [lib/runCode.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L35)* + +The address where the call originated from. Defaults to the zero address. + +___ + +### `Optional` pc + +• **pc**? : *undefined | number* + +*Defined in [lib/runCode.ts:67](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L67)* + +The initial program counter. Defaults to `0` + +___ + +### `Optional` selfdestruct + +• **selfdestruct**? : *undefined | object* + +*Defined in [lib/runCode.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L59)* + +___ + +### `Optional` txContext + +• **txContext**? : *TxContext* + +*Defined in [lib/runCode.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L30)* + +___ + +### `Optional` value + +• **value**? : *BN* + +*Defined in [lib/runCode.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L56)* + +The value in ether that is being sent to `opt.address`. Defaults to `0` diff --git a/packages/vm/docs/interfaces/_lib_runtx_.runtxopts.md b/packages/vm/docs/interfaces/_lib_runtx_.runtxopts.md new file mode 100644 index 0000000000..8f68a302e9 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_runtx_.runtxopts.md @@ -0,0 +1,58 @@ +[@ethereumjs/vm](../README.md) › ["lib/runTx"](../modules/_lib_runtx_.md) › [RunTxOpts](_lib_runtx_.runtxopts.md) + +# Interface: RunTxOpts + +Options for the `runTx` method. + +## Hierarchy + +* **RunTxOpts** + +## Index + +### Properties + +* [block](_lib_runtx_.runtxopts.md#optional-block) +* [skipBalance](_lib_runtx_.runtxopts.md#optional-skipbalance) +* [skipNonce](_lib_runtx_.runtxopts.md#optional-skipnonce) +* [tx](_lib_runtx_.runtxopts.md#tx) + +## Properties + +### `Optional` block + +• **block**? : *Block* + +*Defined in [lib/runTx.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L17)* + +The block to which the `tx` belongs + +___ + +### `Optional` skipBalance + +• **skipBalance**? : *undefined | false | true* + +*Defined in [lib/runTx.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L29)* + +If true, skips the balance check + +___ + +### `Optional` skipNonce + +• **skipNonce**? : *undefined | false | true* + +*Defined in [lib/runTx.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L25)* + +If true, skips the nonce check + +___ + +### tx + +• **tx**: *Transaction* + +*Defined in [lib/runTx.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L21)* + +An [`@ethereumjs/tx`](https://github.com/ethereumjs/ethereumjs-vm/tree/master/packages/tx) to run diff --git a/packages/vm/docs/interfaces/_lib_runtx_.runtxresult.md b/packages/vm/docs/interfaces/_lib_runtx_.runtxresult.md new file mode 100644 index 0000000000..d4dd7d473b --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_runtx_.runtxresult.md @@ -0,0 +1,88 @@ +[@ethereumjs/vm](../README.md) › ["lib/runTx"](../modules/_lib_runtx_.md) › [RunTxResult](_lib_runtx_.runtxresult.md) + +# Interface: RunTxResult + +Execution result of a transaction + +## Hierarchy + +* [EVMResult](_lib_evm_evm_.evmresult.md) + + ↳ **RunTxResult** + +## Index + +### Properties + +* [amountSpent](_lib_runtx_.runtxresult.md#amountspent) +* [bloom](_lib_runtx_.runtxresult.md#bloom) +* [createdAddress](_lib_runtx_.runtxresult.md#optional-createdaddress) +* [execResult](_lib_runtx_.runtxresult.md#execresult) +* [gasRefund](_lib_runtx_.runtxresult.md#optional-gasrefund) +* [gasUsed](_lib_runtx_.runtxresult.md#gasused) + +## Properties + +### amountSpent + +• **amountSpent**: *BN* + +*Defined in [lib/runTx.ts:43](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L43)* + +The amount of ether used by this transaction + +___ + +### bloom + +• **bloom**: *Bloom* + +*Defined in [lib/runTx.ts:39](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L39)* + +Bloom filter resulted from transaction + +___ + +### `Optional` createdAddress + +• **createdAddress**? : *Address* + +*Inherited from [RunTxResult](_lib_runtx_.runtxresult.md).[createdAddress](_lib_runtx_.runtxresult.md#optional-createdaddress)* + +*Defined in [lib/evm/evm.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L31)* + +Address of created account durint transaction, if any + +___ + +### execResult + +• **execResult**: *[ExecResult](_lib_evm_evm_.execresult.md)* + +*Inherited from [RunTxResult](_lib_runtx_.runtxresult.md).[execResult](_lib_runtx_.runtxresult.md#execresult)* + +*Defined in [lib/evm/evm.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L35)* + +Contains the results from running the code, if any, as described in [runCode](../classes/_lib_index_.vm.md#runcode) + +___ + +### `Optional` gasRefund + +• **gasRefund**? : *BN* + +*Defined in [lib/runTx.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L47)* + +The amount of gas as that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) + +___ + +### gasUsed + +• **gasUsed**: *BN* + +*Inherited from [RunTxResult](_lib_runtx_.runtxresult.md).[gasUsed](_lib_runtx_.runtxresult.md#gasused)* + +*Defined in [lib/evm/evm.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L27)* + +Amount of gas used by the transaction diff --git a/packages/vm/docs/interfaces/_lib_state_index_.statemanager.md b/packages/vm/docs/interfaces/_lib_state_index_.statemanager.md new file mode 100644 index 0000000000..621bd6f3f9 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_state_index_.statemanager.md @@ -0,0 +1,383 @@ +[@ethereumjs/vm](../README.md) › ["lib/state/index"](../modules/_lib_state_index_.md) › [StateManager](_lib_state_index_.statemanager.md) + +# Interface: StateManager + +## Hierarchy + +* **StateManager** + +## Implemented by + +* [DefaultStateManager](../classes/_lib_state_index_.defaultstatemanager.md) +* [DefaultStateManager](../classes/_lib_state_statemanager_.defaultstatemanager.md) + +## Index + +### Methods + +* [accountExists](_lib_state_index_.statemanager.md#accountexists) +* [accountIsEmpty](_lib_state_index_.statemanager.md#accountisempty) +* [checkpoint](_lib_state_index_.statemanager.md#checkpoint) +* [cleanupTouchedAccounts](_lib_state_index_.statemanager.md#cleanuptouchedaccounts) +* [clearContractStorage](_lib_state_index_.statemanager.md#clearcontractstorage) +* [clearOriginalStorageCache](_lib_state_index_.statemanager.md#clearoriginalstoragecache) +* [commit](_lib_state_index_.statemanager.md#commit) +* [copy](_lib_state_index_.statemanager.md#copy) +* [deleteAccount](_lib_state_index_.statemanager.md#deleteaccount) +* [dumpStorage](_lib_state_index_.statemanager.md#dumpstorage) +* [generateCanonicalGenesis](_lib_state_index_.statemanager.md#generatecanonicalgenesis) +* [generateGenesis](_lib_state_index_.statemanager.md#generategenesis) +* [getAccount](_lib_state_index_.statemanager.md#getaccount) +* [getContractCode](_lib_state_index_.statemanager.md#getcontractcode) +* [getContractStorage](_lib_state_index_.statemanager.md#getcontractstorage) +* [getOriginalContractStorage](_lib_state_index_.statemanager.md#getoriginalcontractstorage) +* [getStateRoot](_lib_state_index_.statemanager.md#getstateroot) +* [hasGenesisState](_lib_state_index_.statemanager.md#hasgenesisstate) +* [putAccount](_lib_state_index_.statemanager.md#putaccount) +* [putContractCode](_lib_state_index_.statemanager.md#putcontractcode) +* [putContractStorage](_lib_state_index_.statemanager.md#putcontractstorage) +* [revert](_lib_state_index_.statemanager.md#revert) +* [setStateRoot](_lib_state_index_.statemanager.md#setstateroot) +* [touchAccount](_lib_state_index_.statemanager.md#touchaccount) + +## Methods + +### accountExists + +▸ **accountExists**(`address`: Address): *Promise‹boolean›* + +*Defined in [lib/state/interface.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L32)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹boolean›* + +___ + +### accountIsEmpty + +▸ **accountIsEmpty**(`address`: Address): *Promise‹boolean›* + +*Defined in [lib/state/interface.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L31)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹boolean›* + +___ + +### checkpoint + +▸ **checkpoint**(): *Promise‹void›* + +*Defined in [lib/state/interface.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L22)* + +**Returns:** *Promise‹void›* + +___ + +### cleanupTouchedAccounts + +▸ **cleanupTouchedAccounts**(): *Promise‹void›* + +*Defined in [lib/state/interface.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L33)* + +**Returns:** *Promise‹void›* + +___ + +### clearContractStorage + +▸ **clearContractStorage**(`address`: Address): *Promise‹void›* + +*Defined in [lib/state/interface.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L21)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹void›* + +___ + +### clearOriginalStorageCache + +▸ **clearOriginalStorageCache**(): *void* + +*Defined in [lib/state/interface.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L34)* + +**Returns:** *void* + +___ + +### commit + +▸ **commit**(): *Promise‹void›* + +*Defined in [lib/state/interface.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L23)* + +**Returns:** *Promise‹void›* + +___ + +### copy + +▸ **copy**(): *[StateManager](_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/interface.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L11)* + +**Returns:** *[StateManager](_lib_state_index_.statemanager.md)* + +___ + +### deleteAccount + +▸ **deleteAccount**(`address`: Address): *Promise‹void›* + +*Defined in [lib/state/interface.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L14)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹void›* + +___ + +### dumpStorage + +▸ **dumpStorage**(`address`: Address): *Promise‹[StorageDump](_lib_state_interface_.storagedump.md)›* + +*Defined in [lib/state/interface.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L27)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹[StorageDump](_lib_state_interface_.storagedump.md)›* + +___ + +### generateCanonicalGenesis + +▸ **generateCanonicalGenesis**(): *Promise‹void›* + +*Defined in [lib/state/interface.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L29)* + +**Returns:** *Promise‹void›* + +___ + +### generateGenesis + +▸ **generateGenesis**(`initState`: any): *Promise‹void›* + +*Defined in [lib/state/interface.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L30)* + +**Parameters:** + +Name | Type | +------ | ------ | +`initState` | any | + +**Returns:** *Promise‹void›* + +___ + +### getAccount + +▸ **getAccount**(`address`: Address): *Promise‹Account›* + +*Defined in [lib/state/interface.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L12)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹Account›* + +___ + +### getContractCode + +▸ **getContractCode**(`address`: Address): *Promise‹Buffer›* + +*Defined in [lib/state/interface.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L17)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹Buffer›* + +___ + +### getContractStorage + +▸ **getContractStorage**(`address`: Address, `key`: Buffer): *Promise‹Buffer›* + +*Defined in [lib/state/interface.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L18)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | +`key` | Buffer | + +**Returns:** *Promise‹Buffer›* + +___ + +### getOriginalContractStorage + +▸ **getOriginalContractStorage**(`address`: Address, `key`: Buffer): *Promise‹Buffer›* + +*Defined in [lib/state/interface.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L19)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | +`key` | Buffer | + +**Returns:** *Promise‹Buffer›* + +___ + +### getStateRoot + +▸ **getStateRoot**(`force?`: undefined | false | true): *Promise‹Buffer›* + +*Defined in [lib/state/interface.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L25)* + +**Parameters:** + +Name | Type | +------ | ------ | +`force?` | undefined | false | true | + +**Returns:** *Promise‹Buffer›* + +___ + +### hasGenesisState + +▸ **hasGenesisState**(): *Promise‹boolean›* + +*Defined in [lib/state/interface.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L28)* + +**Returns:** *Promise‹boolean›* + +___ + +### putAccount + +▸ **putAccount**(`address`: Address, `account`: Account): *Promise‹void›* + +*Defined in [lib/state/interface.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L13)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | +`account` | Account | + +**Returns:** *Promise‹void›* + +___ + +### putContractCode + +▸ **putContractCode**(`address`: Address, `value`: Buffer): *Promise‹void›* + +*Defined in [lib/state/interface.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L16)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | +`value` | Buffer | + +**Returns:** *Promise‹void›* + +___ + +### putContractStorage + +▸ **putContractStorage**(`address`: Address, `key`: Buffer, `value`: Buffer): *Promise‹void›* + +*Defined in [lib/state/interface.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L20)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | +`key` | Buffer | +`value` | Buffer | + +**Returns:** *Promise‹void›* + +___ + +### revert + +▸ **revert**(): *Promise‹void›* + +*Defined in [lib/state/interface.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L24)* + +**Returns:** *Promise‹void›* + +___ + +### setStateRoot + +▸ **setStateRoot**(`stateRoot`: Buffer): *Promise‹void›* + +*Defined in [lib/state/interface.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L26)* + +**Parameters:** + +Name | Type | +------ | ------ | +`stateRoot` | Buffer | + +**Returns:** *Promise‹void›* + +___ + +### touchAccount + +▸ **touchAccount**(`address`: Address): *void* + +*Defined in [lib/state/interface.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L15)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *void* diff --git a/packages/vm/docs/interfaces/_lib_state_interface_.statemanager.md b/packages/vm/docs/interfaces/_lib_state_interface_.statemanager.md new file mode 100644 index 0000000000..dfac6f511c --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_state_interface_.statemanager.md @@ -0,0 +1,378 @@ +[@ethereumjs/vm](../README.md) › ["lib/state/interface"](../modules/_lib_state_interface_.md) › [StateManager](_lib_state_interface_.statemanager.md) + +# Interface: StateManager + +## Hierarchy + +* **StateManager** + +## Index + +### Methods + +* [accountExists](_lib_state_interface_.statemanager.md#accountexists) +* [accountIsEmpty](_lib_state_interface_.statemanager.md#accountisempty) +* [checkpoint](_lib_state_interface_.statemanager.md#checkpoint) +* [cleanupTouchedAccounts](_lib_state_interface_.statemanager.md#cleanuptouchedaccounts) +* [clearContractStorage](_lib_state_interface_.statemanager.md#clearcontractstorage) +* [clearOriginalStorageCache](_lib_state_interface_.statemanager.md#clearoriginalstoragecache) +* [commit](_lib_state_interface_.statemanager.md#commit) +* [copy](_lib_state_interface_.statemanager.md#copy) +* [deleteAccount](_lib_state_interface_.statemanager.md#deleteaccount) +* [dumpStorage](_lib_state_interface_.statemanager.md#dumpstorage) +* [generateCanonicalGenesis](_lib_state_interface_.statemanager.md#generatecanonicalgenesis) +* [generateGenesis](_lib_state_interface_.statemanager.md#generategenesis) +* [getAccount](_lib_state_interface_.statemanager.md#getaccount) +* [getContractCode](_lib_state_interface_.statemanager.md#getcontractcode) +* [getContractStorage](_lib_state_interface_.statemanager.md#getcontractstorage) +* [getOriginalContractStorage](_lib_state_interface_.statemanager.md#getoriginalcontractstorage) +* [getStateRoot](_lib_state_interface_.statemanager.md#getstateroot) +* [hasGenesisState](_lib_state_interface_.statemanager.md#hasgenesisstate) +* [putAccount](_lib_state_interface_.statemanager.md#putaccount) +* [putContractCode](_lib_state_interface_.statemanager.md#putcontractcode) +* [putContractStorage](_lib_state_interface_.statemanager.md#putcontractstorage) +* [revert](_lib_state_interface_.statemanager.md#revert) +* [setStateRoot](_lib_state_interface_.statemanager.md#setstateroot) +* [touchAccount](_lib_state_interface_.statemanager.md#touchaccount) + +## Methods + +### accountExists + +▸ **accountExists**(`address`: Address): *Promise‹boolean›* + +*Defined in [lib/state/interface.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L32)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹boolean›* + +___ + +### accountIsEmpty + +▸ **accountIsEmpty**(`address`: Address): *Promise‹boolean›* + +*Defined in [lib/state/interface.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L31)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹boolean›* + +___ + +### checkpoint + +▸ **checkpoint**(): *Promise‹void›* + +*Defined in [lib/state/interface.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L22)* + +**Returns:** *Promise‹void›* + +___ + +### cleanupTouchedAccounts + +▸ **cleanupTouchedAccounts**(): *Promise‹void›* + +*Defined in [lib/state/interface.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L33)* + +**Returns:** *Promise‹void›* + +___ + +### clearContractStorage + +▸ **clearContractStorage**(`address`: Address): *Promise‹void›* + +*Defined in [lib/state/interface.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L21)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹void›* + +___ + +### clearOriginalStorageCache + +▸ **clearOriginalStorageCache**(): *void* + +*Defined in [lib/state/interface.ts:34](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L34)* + +**Returns:** *void* + +___ + +### commit + +▸ **commit**(): *Promise‹void›* + +*Defined in [lib/state/interface.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L23)* + +**Returns:** *Promise‹void›* + +___ + +### copy + +▸ **copy**(): *[StateManager](_lib_state_index_.statemanager.md)* + +*Defined in [lib/state/interface.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L11)* + +**Returns:** *[StateManager](_lib_state_index_.statemanager.md)* + +___ + +### deleteAccount + +▸ **deleteAccount**(`address`: Address): *Promise‹void›* + +*Defined in [lib/state/interface.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L14)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹void›* + +___ + +### dumpStorage + +▸ **dumpStorage**(`address`: Address): *Promise‹[StorageDump](_lib_state_interface_.storagedump.md)›* + +*Defined in [lib/state/interface.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L27)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹[StorageDump](_lib_state_interface_.storagedump.md)›* + +___ + +### generateCanonicalGenesis + +▸ **generateCanonicalGenesis**(): *Promise‹void›* + +*Defined in [lib/state/interface.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L29)* + +**Returns:** *Promise‹void›* + +___ + +### generateGenesis + +▸ **generateGenesis**(`initState`: any): *Promise‹void›* + +*Defined in [lib/state/interface.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L30)* + +**Parameters:** + +Name | Type | +------ | ------ | +`initState` | any | + +**Returns:** *Promise‹void›* + +___ + +### getAccount + +▸ **getAccount**(`address`: Address): *Promise‹Account›* + +*Defined in [lib/state/interface.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L12)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹Account›* + +___ + +### getContractCode + +▸ **getContractCode**(`address`: Address): *Promise‹Buffer›* + +*Defined in [lib/state/interface.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L17)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *Promise‹Buffer›* + +___ + +### getContractStorage + +▸ **getContractStorage**(`address`: Address, `key`: Buffer): *Promise‹Buffer›* + +*Defined in [lib/state/interface.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L18)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | +`key` | Buffer | + +**Returns:** *Promise‹Buffer›* + +___ + +### getOriginalContractStorage + +▸ **getOriginalContractStorage**(`address`: Address, `key`: Buffer): *Promise‹Buffer›* + +*Defined in [lib/state/interface.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L19)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | +`key` | Buffer | + +**Returns:** *Promise‹Buffer›* + +___ + +### getStateRoot + +▸ **getStateRoot**(`force?`: undefined | false | true): *Promise‹Buffer›* + +*Defined in [lib/state/interface.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L25)* + +**Parameters:** + +Name | Type | +------ | ------ | +`force?` | undefined | false | true | + +**Returns:** *Promise‹Buffer›* + +___ + +### hasGenesisState + +▸ **hasGenesisState**(): *Promise‹boolean›* + +*Defined in [lib/state/interface.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L28)* + +**Returns:** *Promise‹boolean›* + +___ + +### putAccount + +▸ **putAccount**(`address`: Address, `account`: Account): *Promise‹void›* + +*Defined in [lib/state/interface.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L13)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | +`account` | Account | + +**Returns:** *Promise‹void›* + +___ + +### putContractCode + +▸ **putContractCode**(`address`: Address, `value`: Buffer): *Promise‹void›* + +*Defined in [lib/state/interface.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L16)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | +`value` | Buffer | + +**Returns:** *Promise‹void›* + +___ + +### putContractStorage + +▸ **putContractStorage**(`address`: Address, `key`: Buffer, `value`: Buffer): *Promise‹void›* + +*Defined in [lib/state/interface.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L20)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | +`key` | Buffer | +`value` | Buffer | + +**Returns:** *Promise‹void›* + +___ + +### revert + +▸ **revert**(): *Promise‹void›* + +*Defined in [lib/state/interface.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L24)* + +**Returns:** *Promise‹void›* + +___ + +### setStateRoot + +▸ **setStateRoot**(`stateRoot`: Buffer): *Promise‹void›* + +*Defined in [lib/state/interface.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L26)* + +**Parameters:** + +Name | Type | +------ | ------ | +`stateRoot` | Buffer | + +**Returns:** *Promise‹void›* + +___ + +### touchAccount + +▸ **touchAccount**(`address`: Address): *void* + +*Defined in [lib/state/interface.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L15)* + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | Address | + +**Returns:** *void* diff --git a/packages/vm/docs/interfaces/_state_interface_.storagedump.md b/packages/vm/docs/interfaces/_lib_state_interface_.storagedump.md similarity index 52% rename from packages/vm/docs/interfaces/_state_interface_.storagedump.md rename to packages/vm/docs/interfaces/_lib_state_interface_.storagedump.md index 099ab3e061..1ed7bc8183 100644 --- a/packages/vm/docs/interfaces/_state_interface_.storagedump.md +++ b/packages/vm/docs/interfaces/_lib_state_interface_.storagedump.md @@ -1,4 +1,4 @@ -[@ethereumjs/vm](../README.md) › ["state/interface"](../modules/_state_interface_.md) › [StorageDump](_state_interface_.storagedump.md) +[@ethereumjs/vm](../README.md) › ["lib/state/interface"](../modules/_lib_state_interface_.md) › [StorageDump](_lib_state_interface_.storagedump.md) # Interface: StorageDump diff --git a/packages/vm/docs/interfaces/_lib_state_statemanager_.defaultstatemanageropts.md b/packages/vm/docs/interfaces/_lib_state_statemanager_.defaultstatemanageropts.md new file mode 100644 index 0000000000..84dade2e32 --- /dev/null +++ b/packages/vm/docs/interfaces/_lib_state_statemanager_.defaultstatemanageropts.md @@ -0,0 +1,36 @@ +[@ethereumjs/vm](../README.md) › ["lib/state/stateManager"](../modules/_lib_state_statemanager_.md) › [DefaultStateManagerOpts](_lib_state_statemanager_.defaultstatemanageropts.md) + +# Interface: DefaultStateManagerOpts + +Options for constructing a [StateManager](_lib_state_index_.statemanager.md). + +## Hierarchy + +* **DefaultStateManagerOpts** + +## Index + +### Properties + +* [common](_lib_state_statemanager_.defaultstatemanageropts.md#optional-common) +* [trie](_lib_state_statemanager_.defaultstatemanageropts.md#optional-trie) + +## Properties + +### `Optional` common + +• **common**? : *Common* + +*Defined in [lib/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)) + +___ + +### `Optional` trie + +• **trie**? : *Trie* + +*Defined in [lib/state/stateManager.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L32)* + +A [`merkle-patricia-tree`](https://github.com/ethereumjs/merkle-patricia-tree) instance diff --git a/packages/vm/docs/interfaces/_runblock_.postbyzantiumtxreceipt.md b/packages/vm/docs/interfaces/_runblock_.postbyzantiumtxreceipt.md deleted file mode 100644 index dd9c3cceaa..0000000000 --- a/packages/vm/docs/interfaces/_runblock_.postbyzantiumtxreceipt.md +++ /dev/null @@ -1,67 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runBlock"](../modules/_runblock_.md) › [PostByzantiumTxReceipt](_runblock_.postbyzantiumtxreceipt.md) - -# Interface: PostByzantiumTxReceipt - -Receipt type for Byzantium and beyond replacing the intermediary -state root field with a status code field (EIP-658) - -## Hierarchy - -* TxReceipt - - ↳ **PostByzantiumTxReceipt** - -## Index - -### Properties - -* [bitvector](_runblock_.postbyzantiumtxreceipt.md#bitvector) -* [gasUsed](_runblock_.postbyzantiumtxreceipt.md#gasused) -* [logs](_runblock_.postbyzantiumtxreceipt.md#logs) -* [status](_runblock_.postbyzantiumtxreceipt.md#status) - -## Properties - -### bitvector - -• **bitvector**: *Buffer* - -*Inherited from [PreByzantiumTxReceipt](_runblock_.prebyzantiumtxreceipt.md).[bitvector](_runblock_.prebyzantiumtxreceipt.md#bitvector)* - -*Defined in [runBlock.ts:65](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L65)* - -Bloom bitvector - -___ - -### gasUsed - -• **gasUsed**: *Buffer* - -*Inherited from [PreByzantiumTxReceipt](_runblock_.prebyzantiumtxreceipt.md).[gasUsed](_runblock_.prebyzantiumtxreceipt.md#gasused)* - -*Defined in [runBlock.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L61)* - -Gas used - -___ - -### logs - -• **logs**: *any[]* - -*Inherited from [PreByzantiumTxReceipt](_runblock_.prebyzantiumtxreceipt.md).[logs](_runblock_.prebyzantiumtxreceipt.md#logs)* - -*Defined in [runBlock.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L69)* - -Logs emitted - -___ - -### status - -• **status**: *0 | 1* - -*Defined in [runBlock.ts:91](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L91)* - -Status of transaction, `1` if successful, `0` if an exception occured diff --git a/packages/vm/docs/interfaces/_runblock_.prebyzantiumtxreceipt.md b/packages/vm/docs/interfaces/_runblock_.prebyzantiumtxreceipt.md deleted file mode 100644 index 0f0cfde995..0000000000 --- a/packages/vm/docs/interfaces/_runblock_.prebyzantiumtxreceipt.md +++ /dev/null @@ -1,67 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runBlock"](../modules/_runblock_.md) › [PreByzantiumTxReceipt](_runblock_.prebyzantiumtxreceipt.md) - -# Interface: PreByzantiumTxReceipt - -Pre-Byzantium receipt type with a field -for the intermediary state root - -## Hierarchy - -* TxReceipt - - ↳ **PreByzantiumTxReceipt** - -## Index - -### Properties - -* [bitvector](_runblock_.prebyzantiumtxreceipt.md#bitvector) -* [gasUsed](_runblock_.prebyzantiumtxreceipt.md#gasused) -* [logs](_runblock_.prebyzantiumtxreceipt.md#logs) -* [stateRoot](_runblock_.prebyzantiumtxreceipt.md#stateroot) - -## Properties - -### bitvector - -• **bitvector**: *Buffer* - -*Inherited from [PreByzantiumTxReceipt](_runblock_.prebyzantiumtxreceipt.md).[bitvector](_runblock_.prebyzantiumtxreceipt.md#bitvector)* - -*Defined in [runBlock.ts:65](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L65)* - -Bloom bitvector - -___ - -### gasUsed - -• **gasUsed**: *Buffer* - -*Inherited from [PreByzantiumTxReceipt](_runblock_.prebyzantiumtxreceipt.md).[gasUsed](_runblock_.prebyzantiumtxreceipt.md#gasused)* - -*Defined in [runBlock.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L61)* - -Gas used - -___ - -### logs - -• **logs**: *any[]* - -*Inherited from [PreByzantiumTxReceipt](_runblock_.prebyzantiumtxreceipt.md).[logs](_runblock_.prebyzantiumtxreceipt.md#logs)* - -*Defined in [runBlock.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L69)* - -Logs emitted - -___ - -### stateRoot - -• **stateRoot**: *Buffer* - -*Defined in [runBlock.ts:80](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L80)* - -Intermediary state root diff --git a/packages/vm/docs/interfaces/_runblock_.runblockopts.md b/packages/vm/docs/interfaces/_runblock_.runblockopts.md deleted file mode 100644 index 7711762bc5..0000000000 --- a/packages/vm/docs/interfaces/_runblock_.runblockopts.md +++ /dev/null @@ -1,81 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runBlock"](../modules/_runblock_.md) › [RunBlockOpts](_runblock_.runblockopts.md) - -# Interface: RunBlockOpts - -Options for running a block. - -## Hierarchy - -* **RunBlockOpts** - -## Index - -### Properties - -* [block](_runblock_.runblockopts.md#block) -* [generate](_runblock_.runblockopts.md#optional-generate) -* [root](_runblock_.runblockopts.md#optional-root) -* [skipBalance](_runblock_.runblockopts.md#optional-skipbalance) -* [skipBlockValidation](_runblock_.runblockopts.md#optional-skipblockvalidation) -* [skipNonce](_runblock_.runblockopts.md#optional-skipnonce) - -## Properties - -### block - -• **block**: *any* - -*Defined in [runBlock.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L16)* - -The [`Block`](https://github.com/ethereumjs/ethereumjs-block) to process - -___ - -### `Optional` generate - -• **generate**? : *undefined | false | true* - -*Defined in [runBlock.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L25)* - -Whether to generate the stateRoot. If false `runBlock` will check the -stateRoot of the block against the Trie - -___ - -### `Optional` root - -• **root**? : *Buffer* - -*Defined in [runBlock.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L20)* - -Root of the state trie - -___ - -### `Optional` skipBalance - -• **skipBalance**? : *undefined | false | true* - -*Defined in [runBlock.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L37)* - -If true, skips the balance check - -___ - -### `Optional` skipBlockValidation - -• **skipBlockValidation**? : *undefined | false | true* - -*Defined in [runBlock.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L29)* - -If true, will skip block validation - -___ - -### `Optional` skipNonce - -• **skipNonce**? : *undefined | false | true* - -*Defined in [runBlock.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L33)* - -If true, skips the nonce check diff --git a/packages/vm/docs/interfaces/_runblock_.runblockresult.md b/packages/vm/docs/interfaces/_runblock_.runblockresult.md deleted file mode 100644 index 576e926382..0000000000 --- a/packages/vm/docs/interfaces/_runblock_.runblockresult.md +++ /dev/null @@ -1,36 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runBlock"](../modules/_runblock_.md) › [RunBlockResult](_runblock_.runblockresult.md) - -# Interface: RunBlockResult - -Result of [runBlock](../classes/_index_.vm.md#runblock) - -## Hierarchy - -* **RunBlockResult** - -## Index - -### Properties - -* [receipts](_runblock_.runblockresult.md#receipts) -* [results](_runblock_.runblockresult.md#results) - -## Properties - -### receipts - -• **receipts**: *([PreByzantiumTxReceipt](_runblock_.prebyzantiumtxreceipt.md) | [PostByzantiumTxReceipt](_runblock_.postbyzantiumtxreceipt.md))[]* - -*Defined in [runBlock.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L47)* - -Receipts generated for transactions in the block - -___ - -### results - -• **results**: *[RunTxResult](_runtx_.runtxresult.md)[]* - -*Defined in [runBlock.ts:51](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runBlock.ts#L51)* - -Results of executing the transactions in the block diff --git a/packages/vm/docs/interfaces/_runcall_.runcallopts.md b/packages/vm/docs/interfaces/_runcall_.runcallopts.md deleted file mode 100644 index c68a4242c6..0000000000 --- a/packages/vm/docs/interfaces/_runcall_.runcallopts.md +++ /dev/null @@ -1,151 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runCall"](../modules/_runcall_.md) › [RunCallOpts](_runcall_.runcallopts.md) - -# Interface: RunCallOpts - -Options for running a call (or create) operation - -## Hierarchy - -* **RunCallOpts** - -## Index - -### Properties - -* [block](_runcall_.runcallopts.md#optional-block) -* [caller](_runcall_.runcallopts.md#optional-caller) -* [code](_runcall_.runcallopts.md#optional-code) -* [compiled](_runcall_.runcallopts.md#optional-compiled) -* [data](_runcall_.runcallopts.md#optional-data) -* [delegatecall](_runcall_.runcallopts.md#optional-delegatecall) -* [depth](_runcall_.runcallopts.md#optional-depth) -* [gasLimit](_runcall_.runcallopts.md#optional-gaslimit) -* [gasPrice](_runcall_.runcallopts.md#optional-gasprice) -* [origin](_runcall_.runcallopts.md#optional-origin) -* [salt](_runcall_.runcallopts.md#optional-salt) -* [selfdestruct](_runcall_.runcallopts.md#optional-selfdestruct) -* [static](_runcall_.runcallopts.md#optional-static) -* [to](_runcall_.runcallopts.md#optional-to) -* [value](_runcall_.runcallopts.md#optional-value) - -## Properties - -### `Optional` block - -• **block**? : *any* - -*Defined in [runCall.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L13)* - -___ - -### `Optional` caller - -• **caller**? : *Buffer* - -*Defined in [runCall.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L16)* - -___ - -### `Optional` code - -• **code**? : *Buffer* - -*Defined in [runCall.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L24)* - -This is for CALLCODE where the code to load is different than the code from the to account - -___ - -### `Optional` compiled - -• **compiled**? : *undefined | false | true* - -*Defined in [runCall.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L26)* - -___ - -### `Optional` data - -• **data**? : *Buffer* - -*Defined in [runCall.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L20)* - -___ - -### `Optional` delegatecall - -• **delegatecall**? : *undefined | false | true* - -*Defined in [runCall.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L30)* - -___ - -### `Optional` depth - -• **depth**? : *undefined | number* - -*Defined in [runCall.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L25)* - -___ - -### `Optional` gasLimit - -• **gasLimit**? : *Buffer* - -*Defined in [runCall.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L17)* - -___ - -### `Optional` gasPrice - -• **gasPrice**? : *Buffer* - -*Defined in [runCall.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L14)* - -___ - -### `Optional` origin - -• **origin**? : *Buffer* - -*Defined in [runCall.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L15)* - -___ - -### `Optional` salt - -• **salt**? : *Buffer* - -*Defined in [runCall.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L28)* - -___ - -### `Optional` selfdestruct - -• **selfdestruct**? : *undefined | object* - -*Defined in [runCall.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L29)* - -___ - -### `Optional` static - -• **static**? : *undefined | false | true* - -*Defined in [runCall.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L27)* - -___ - -### `Optional` to - -• **to**? : *Buffer* - -*Defined in [runCall.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L18)* - -___ - -### `Optional` value - -• **value**? : *Buffer* - -*Defined in [runCall.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCall.ts#L19)* diff --git a/packages/vm/docs/interfaces/_runcode_.runcodeopts.md b/packages/vm/docs/interfaces/_runcode_.runcodeopts.md deleted file mode 100644 index bdb9a14af3..0000000000 --- a/packages/vm/docs/interfaces/_runcode_.runcodeopts.md +++ /dev/null @@ -1,176 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runCode"](../modules/_runcode_.md) › [RunCodeOpts](_runcode_.runcodeopts.md) - -# Interface: RunCodeOpts - -Options for the [runCode](../classes/_index_.vm.md#runcode) method. - -## Hierarchy - -* **RunCodeOpts** - -## Index - -### Properties - -* [address](_runcode_.runcodeopts.md#optional-address) -* [block](_runcode_.runcodeopts.md#optional-block) -* [caller](_runcode_.runcodeopts.md#optional-caller) -* [code](_runcode_.runcodeopts.md#optional-code) -* [data](_runcode_.runcodeopts.md#optional-data) -* [depth](_runcode_.runcodeopts.md#optional-depth) -* [evm](_runcode_.runcodeopts.md#optional-evm) -* [gasLimit](_runcode_.runcodeopts.md#optional-gaslimit) -* [gasPrice](_runcode_.runcodeopts.md#optional-gasprice) -* [isStatic](_runcode_.runcodeopts.md#optional-isstatic) -* [message](_runcode_.runcodeopts.md#optional-message) -* [origin](_runcode_.runcodeopts.md#optional-origin) -* [pc](_runcode_.runcodeopts.md#optional-pc) -* [selfdestruct](_runcode_.runcodeopts.md#optional-selfdestruct) -* [txContext](_runcode_.runcodeopts.md#optional-txcontext) -* [value](_runcode_.runcodeopts.md#optional-value) - -## Properties - -### `Optional` address - -• **address**? : *Buffer* - -*Defined in [runCode.ts:63](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L63)* - -The address of the account that is executing this code. The address should be a `Buffer` of bytes. Defaults to `0` - -___ - -### `Optional` block - -• **block**? : *any* - -*Defined in [runCode.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L28)* - -The [`Block`](https://github.com/ethereumjs/ethereumjs-block) the `tx` belongs to. If omitted a blank block will be used - -___ - -### `Optional` caller - -• **caller**? : *Buffer* - -*Defined in [runCode.ts:40](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L40)* - -The address that ran this code. The address should be a `Buffer` of 20 bits. Defaults to `0` - -___ - -### `Optional` code - -• **code**? : *Buffer* - -*Defined in [runCode.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L44)* - -The EVM code to run - -___ - -### `Optional` data - -• **data**? : *Buffer* - -*Defined in [runCode.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L48)* - -The input data - -___ - -### `Optional` depth - -• **depth**? : *undefined | number* - -*Defined in [runCode.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L57)* - -___ - -### `Optional` evm - -• **evm**? : *EVM* - -*Defined in [runCode.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L29)* - -___ - -### `Optional` gasLimit - -• **gasLimit**? : *Buffer* - -*Defined in [runCode.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L52)* - -Gas limit - -___ - -### `Optional` gasPrice - -• **gasPrice**? : *Buffer* - -*Defined in [runCode.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L31)* - -___ - -### `Optional` isStatic - -• **isStatic**? : *undefined | false | true* - -*Defined in [runCode.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L58)* - -___ - -### `Optional` message - -• **message**? : *Message* - -*Defined in [runCode.ts:36](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L36)* - -___ - -### `Optional` origin - -• **origin**? : *Buffer* - -*Defined in [runCode.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L35)* - -The address where the call originated from. The address should be a `Buffer` of 20 bits. Defaults to `0` - -___ - -### `Optional` pc - -• **pc**? : *undefined | number* - -*Defined in [runCode.ts:67](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L67)* - -The initial program counter. Defaults to `0` - -___ - -### `Optional` selfdestruct - -• **selfdestruct**? : *undefined | object* - -*Defined in [runCode.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L59)* - -___ - -### `Optional` txContext - -• **txContext**? : *TxContext* - -*Defined in [runCode.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L30)* - -___ - -### `Optional` value - -• **value**? : *Buffer* - -*Defined in [runCode.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runCode.ts#L56)* - -The value in ether that is being sent to `opt.address`. Defaults to `0` diff --git a/packages/vm/docs/interfaces/_runtx_.runtxopts.md b/packages/vm/docs/interfaces/_runtx_.runtxopts.md deleted file mode 100644 index 49b43eb3fc..0000000000 --- a/packages/vm/docs/interfaces/_runtx_.runtxopts.md +++ /dev/null @@ -1,58 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runTx"](../modules/_runtx_.md) › [RunTxOpts](_runtx_.runtxopts.md) - -# Interface: RunTxOpts - -Options for the `runTx` method. - -## Hierarchy - -* **RunTxOpts** - -## Index - -### Properties - -* [block](_runtx_.runtxopts.md#optional-block) -* [skipBalance](_runtx_.runtxopts.md#optional-skipbalance) -* [skipNonce](_runtx_.runtxopts.md#optional-skipnonce) -* [tx](_runtx_.runtxopts.md#tx) - -## Properties - -### `Optional` block - -• **block**? : *any* - -*Defined in [runTx.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L19)* - -The block to which the `tx` belongs - -___ - -### `Optional` skipBalance - -• **skipBalance**? : *undefined | false | true* - -*Defined in [runTx.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L31)* - -If true, skips the balance check - -___ - -### `Optional` skipNonce - -• **skipNonce**? : *undefined | false | true* - -*Defined in [runTx.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L27)* - -If true, skips the nonce check - -___ - -### tx - -• **tx**: *Transaction* - -*Defined in [runTx.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L23)* - -A [`Transaction`](https://github.com/ethereum/ethereumjs-tx) to run diff --git a/packages/vm/docs/interfaces/_runtx_.runtxresult.md b/packages/vm/docs/interfaces/_runtx_.runtxresult.md deleted file mode 100644 index 08ccd738c9..0000000000 --- a/packages/vm/docs/interfaces/_runtx_.runtxresult.md +++ /dev/null @@ -1,88 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runTx"](../modules/_runtx_.md) › [RunTxResult](_runtx_.runtxresult.md) - -# Interface: RunTxResult - -Execution result of a transaction - -## Hierarchy - -* [EVMResult](_evm_evm_.evmresult.md) - - ↳ **RunTxResult** - -## Index - -### Properties - -* [amountSpent](_runtx_.runtxresult.md#amountspent) -* [bloom](_runtx_.runtxresult.md#bloom) -* [createdAddress](_runtx_.runtxresult.md#optional-createdaddress) -* [execResult](_runtx_.runtxresult.md#execresult) -* [gasRefund](_runtx_.runtxresult.md#optional-gasrefund) -* [gasUsed](_runtx_.runtxresult.md#gasused) - -## Properties - -### amountSpent - -• **amountSpent**: *BN* - -*Defined in [runTx.ts:45](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L45)* - -The amount of ether used by this transaction - -___ - -### bloom - -• **bloom**: *Bloom* - -*Defined in [runTx.ts:41](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L41)* - -Bloom filter resulted from transaction - -___ - -### `Optional` createdAddress - -• **createdAddress**? : *Buffer* - -*Inherited from [RunTxResult](_runtx_.runtxresult.md).[createdAddress](_runtx_.runtxresult.md#optional-createdaddress)* - -*Defined in [evm/evm.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L31)* - -Address of created account durint transaction, if any - -___ - -### execResult - -• **execResult**: *[ExecResult](_evm_evm_.execresult.md)* - -*Inherited from [RunTxResult](_runtx_.runtxresult.md).[execResult](_runtx_.runtxresult.md#execresult)* - -*Defined in [evm/evm.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L35)* - -Contains the results from running the code, if any, as described in [runCode](../classes/_index_.vm.md#runcode) - -___ - -### `Optional` gasRefund - -• **gasRefund**? : *BN* - -*Defined in [runTx.ts:49](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/runTx.ts#L49)* - -The amount of gas as that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) - -___ - -### gasUsed - -• **gasUsed**: *BN* - -*Inherited from [RunTxResult](_runtx_.runtxresult.md).[gasUsed](_runtx_.runtxresult.md#gasused)* - -*Defined in [evm/evm.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L27)* - -Amount of gas used by the transaction diff --git a/packages/vm/docs/interfaces/_state_index_.statemanager.md b/packages/vm/docs/interfaces/_state_index_.statemanager.md deleted file mode 100644 index 804648b372..0000000000 --- a/packages/vm/docs/interfaces/_state_index_.statemanager.md +++ /dev/null @@ -1,372 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["state/index"](../modules/_state_index_.md) › [StateManager](_state_index_.statemanager.md) - -# Interface: StateManager - -## Hierarchy - -* **StateManager** - -## Implemented by - -* [DefaultStateManager](../classes/_state_index_.defaultstatemanager.md) -* [DefaultStateManager](../classes/_state_statemanager_.defaultstatemanager.md) - -## Index - -### Methods - -* [accountExists](_state_index_.statemanager.md#accountexists) -* [accountIsEmpty](_state_index_.statemanager.md#accountisempty) -* [checkpoint](_state_index_.statemanager.md#checkpoint) -* [cleanupTouchedAccounts](_state_index_.statemanager.md#cleanuptouchedaccounts) -* [clearContractStorage](_state_index_.statemanager.md#clearcontractstorage) -* [commit](_state_index_.statemanager.md#commit) -* [copy](_state_index_.statemanager.md#copy) -* [deleteAccount](_state_index_.statemanager.md#deleteaccount) -* [dumpStorage](_state_index_.statemanager.md#dumpstorage) -* [generateCanonicalGenesis](_state_index_.statemanager.md#generatecanonicalgenesis) -* [generateGenesis](_state_index_.statemanager.md#generategenesis) -* [getAccount](_state_index_.statemanager.md#getaccount) -* [getContractCode](_state_index_.statemanager.md#getcontractcode) -* [getContractStorage](_state_index_.statemanager.md#getcontractstorage) -* [getOriginalContractStorage](_state_index_.statemanager.md#getoriginalcontractstorage) -* [getStateRoot](_state_index_.statemanager.md#getstateroot) -* [hasGenesisState](_state_index_.statemanager.md#hasgenesisstate) -* [putAccount](_state_index_.statemanager.md#putaccount) -* [putContractCode](_state_index_.statemanager.md#putcontractcode) -* [putContractStorage](_state_index_.statemanager.md#putcontractstorage) -* [revert](_state_index_.statemanager.md#revert) -* [setStateRoot](_state_index_.statemanager.md#setstateroot) -* [touchAccount](_state_index_.statemanager.md#touchaccount) - -## Methods - -### accountExists - -▸ **accountExists**(`address`: Buffer): *Promise‹boolean›* - -*Defined in [state/interface.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L32)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹boolean›* - -___ - -### accountIsEmpty - -▸ **accountIsEmpty**(`address`: Buffer): *Promise‹boolean›* - -*Defined in [state/interface.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L31)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹boolean›* - -___ - -### checkpoint - -▸ **checkpoint**(): *Promise‹void›* - -*Defined in [state/interface.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L22)* - -**Returns:** *Promise‹void›* - -___ - -### cleanupTouchedAccounts - -▸ **cleanupTouchedAccounts**(): *Promise‹void›* - -*Defined in [state/interface.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L33)* - -**Returns:** *Promise‹void›* - -___ - -### clearContractStorage - -▸ **clearContractStorage**(`address`: Buffer): *Promise‹void›* - -*Defined in [state/interface.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L21)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹void›* - -___ - -### commit - -▸ **commit**(): *Promise‹void›* - -*Defined in [state/interface.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L23)* - -**Returns:** *Promise‹void›* - -___ - -### copy - -▸ **copy**(): *[StateManager](_state_index_.statemanager.md)* - -*Defined in [state/interface.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L11)* - -**Returns:** *[StateManager](_state_index_.statemanager.md)* - -___ - -### deleteAccount - -▸ **deleteAccount**(`address`: Buffer): *Promise‹void›* - -*Defined in [state/interface.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L14)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹void›* - -___ - -### dumpStorage - -▸ **dumpStorage**(`address`: Buffer): *Promise‹[StorageDump](_state_interface_.storagedump.md)›* - -*Defined in [state/interface.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L27)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹[StorageDump](_state_interface_.storagedump.md)›* - -___ - -### generateCanonicalGenesis - -▸ **generateCanonicalGenesis**(): *Promise‹void›* - -*Defined in [state/interface.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L29)* - -**Returns:** *Promise‹void›* - -___ - -### generateGenesis - -▸ **generateGenesis**(`initState`: any): *Promise‹void›* - -*Defined in [state/interface.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L30)* - -**Parameters:** - -Name | Type | ------- | ------ | -`initState` | any | - -**Returns:** *Promise‹void›* - -___ - -### getAccount - -▸ **getAccount**(`address`: Buffer): *Promise‹Account›* - -*Defined in [state/interface.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L12)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹Account›* - -___ - -### getContractCode - -▸ **getContractCode**(`address`: Buffer): *Promise‹Buffer›* - -*Defined in [state/interface.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L17)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹Buffer›* - -___ - -### getContractStorage - -▸ **getContractStorage**(`address`: Buffer, `key`: Buffer): *Promise‹Buffer›* - -*Defined in [state/interface.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L18)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | -`key` | Buffer | - -**Returns:** *Promise‹Buffer›* - -___ - -### getOriginalContractStorage - -▸ **getOriginalContractStorage**(`address`: Buffer, `key`: Buffer): *Promise‹Buffer›* - -*Defined in [state/interface.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L19)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | -`key` | Buffer | - -**Returns:** *Promise‹Buffer›* - -___ - -### getStateRoot - -▸ **getStateRoot**(`force?`: undefined | false | true): *Promise‹Buffer›* - -*Defined in [state/interface.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L25)* - -**Parameters:** - -Name | Type | ------- | ------ | -`force?` | undefined | false | true | - -**Returns:** *Promise‹Buffer›* - -___ - -### hasGenesisState - -▸ **hasGenesisState**(): *Promise‹boolean›* - -*Defined in [state/interface.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L28)* - -**Returns:** *Promise‹boolean›* - -___ - -### putAccount - -▸ **putAccount**(`address`: Buffer, `account`: Account): *Promise‹void›* - -*Defined in [state/interface.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L13)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | -`account` | Account | - -**Returns:** *Promise‹void›* - -___ - -### putContractCode - -▸ **putContractCode**(`address`: Buffer, `value`: Buffer): *Promise‹void›* - -*Defined in [state/interface.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L16)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | -`value` | Buffer | - -**Returns:** *Promise‹void›* - -___ - -### putContractStorage - -▸ **putContractStorage**(`address`: Buffer, `key`: Buffer, `value`: Buffer): *Promise‹void›* - -*Defined in [state/interface.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L20)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | -`key` | Buffer | -`value` | Buffer | - -**Returns:** *Promise‹void›* - -___ - -### revert - -▸ **revert**(): *Promise‹void›* - -*Defined in [state/interface.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L24)* - -**Returns:** *Promise‹void›* - -___ - -### setStateRoot - -▸ **setStateRoot**(`stateRoot`: Buffer): *Promise‹void›* - -*Defined in [state/interface.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L26)* - -**Parameters:** - -Name | Type | ------- | ------ | -`stateRoot` | Buffer | - -**Returns:** *Promise‹void›* - -___ - -### touchAccount - -▸ **touchAccount**(`address`: Buffer): *void* - -*Defined in [state/interface.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L15)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *void* diff --git a/packages/vm/docs/interfaces/_state_interface_.statemanager.md b/packages/vm/docs/interfaces/_state_interface_.statemanager.md deleted file mode 100644 index ff53aa2d4e..0000000000 --- a/packages/vm/docs/interfaces/_state_interface_.statemanager.md +++ /dev/null @@ -1,367 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["state/interface"](../modules/_state_interface_.md) › [StateManager](_state_interface_.statemanager.md) - -# Interface: StateManager - -## Hierarchy - -* **StateManager** - -## Index - -### Methods - -* [accountExists](_state_interface_.statemanager.md#accountexists) -* [accountIsEmpty](_state_interface_.statemanager.md#accountisempty) -* [checkpoint](_state_interface_.statemanager.md#checkpoint) -* [cleanupTouchedAccounts](_state_interface_.statemanager.md#cleanuptouchedaccounts) -* [clearContractStorage](_state_interface_.statemanager.md#clearcontractstorage) -* [commit](_state_interface_.statemanager.md#commit) -* [copy](_state_interface_.statemanager.md#copy) -* [deleteAccount](_state_interface_.statemanager.md#deleteaccount) -* [dumpStorage](_state_interface_.statemanager.md#dumpstorage) -* [generateCanonicalGenesis](_state_interface_.statemanager.md#generatecanonicalgenesis) -* [generateGenesis](_state_interface_.statemanager.md#generategenesis) -* [getAccount](_state_interface_.statemanager.md#getaccount) -* [getContractCode](_state_interface_.statemanager.md#getcontractcode) -* [getContractStorage](_state_interface_.statemanager.md#getcontractstorage) -* [getOriginalContractStorage](_state_interface_.statemanager.md#getoriginalcontractstorage) -* [getStateRoot](_state_interface_.statemanager.md#getstateroot) -* [hasGenesisState](_state_interface_.statemanager.md#hasgenesisstate) -* [putAccount](_state_interface_.statemanager.md#putaccount) -* [putContractCode](_state_interface_.statemanager.md#putcontractcode) -* [putContractStorage](_state_interface_.statemanager.md#putcontractstorage) -* [revert](_state_interface_.statemanager.md#revert) -* [setStateRoot](_state_interface_.statemanager.md#setstateroot) -* [touchAccount](_state_interface_.statemanager.md#touchaccount) - -## Methods - -### accountExists - -▸ **accountExists**(`address`: Buffer): *Promise‹boolean›* - -*Defined in [state/interface.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L32)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹boolean›* - -___ - -### accountIsEmpty - -▸ **accountIsEmpty**(`address`: Buffer): *Promise‹boolean›* - -*Defined in [state/interface.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L31)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹boolean›* - -___ - -### checkpoint - -▸ **checkpoint**(): *Promise‹void›* - -*Defined in [state/interface.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L22)* - -**Returns:** *Promise‹void›* - -___ - -### cleanupTouchedAccounts - -▸ **cleanupTouchedAccounts**(): *Promise‹void›* - -*Defined in [state/interface.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L33)* - -**Returns:** *Promise‹void›* - -___ - -### clearContractStorage - -▸ **clearContractStorage**(`address`: Buffer): *Promise‹void›* - -*Defined in [state/interface.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L21)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹void›* - -___ - -### commit - -▸ **commit**(): *Promise‹void›* - -*Defined in [state/interface.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L23)* - -**Returns:** *Promise‹void›* - -___ - -### copy - -▸ **copy**(): *[StateManager](_state_index_.statemanager.md)* - -*Defined in [state/interface.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L11)* - -**Returns:** *[StateManager](_state_index_.statemanager.md)* - -___ - -### deleteAccount - -▸ **deleteAccount**(`address`: Buffer): *Promise‹void›* - -*Defined in [state/interface.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L14)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹void›* - -___ - -### dumpStorage - -▸ **dumpStorage**(`address`: Buffer): *Promise‹[StorageDump](_state_interface_.storagedump.md)›* - -*Defined in [state/interface.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L27)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹[StorageDump](_state_interface_.storagedump.md)›* - -___ - -### generateCanonicalGenesis - -▸ **generateCanonicalGenesis**(): *Promise‹void›* - -*Defined in [state/interface.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L29)* - -**Returns:** *Promise‹void›* - -___ - -### generateGenesis - -▸ **generateGenesis**(`initState`: any): *Promise‹void›* - -*Defined in [state/interface.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L30)* - -**Parameters:** - -Name | Type | ------- | ------ | -`initState` | any | - -**Returns:** *Promise‹void›* - -___ - -### getAccount - -▸ **getAccount**(`address`: Buffer): *Promise‹Account›* - -*Defined in [state/interface.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L12)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹Account›* - -___ - -### getContractCode - -▸ **getContractCode**(`address`: Buffer): *Promise‹Buffer›* - -*Defined in [state/interface.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L17)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *Promise‹Buffer›* - -___ - -### getContractStorage - -▸ **getContractStorage**(`address`: Buffer, `key`: Buffer): *Promise‹Buffer›* - -*Defined in [state/interface.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L18)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | -`key` | Buffer | - -**Returns:** *Promise‹Buffer›* - -___ - -### getOriginalContractStorage - -▸ **getOriginalContractStorage**(`address`: Buffer, `key`: Buffer): *Promise‹Buffer›* - -*Defined in [state/interface.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L19)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | -`key` | Buffer | - -**Returns:** *Promise‹Buffer›* - -___ - -### getStateRoot - -▸ **getStateRoot**(`force?`: undefined | false | true): *Promise‹Buffer›* - -*Defined in [state/interface.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L25)* - -**Parameters:** - -Name | Type | ------- | ------ | -`force?` | undefined | false | true | - -**Returns:** *Promise‹Buffer›* - -___ - -### hasGenesisState - -▸ **hasGenesisState**(): *Promise‹boolean›* - -*Defined in [state/interface.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L28)* - -**Returns:** *Promise‹boolean›* - -___ - -### putAccount - -▸ **putAccount**(`address`: Buffer, `account`: Account): *Promise‹void›* - -*Defined in [state/interface.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L13)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | -`account` | Account | - -**Returns:** *Promise‹void›* - -___ - -### putContractCode - -▸ **putContractCode**(`address`: Buffer, `value`: Buffer): *Promise‹void›* - -*Defined in [state/interface.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L16)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | -`value` | Buffer | - -**Returns:** *Promise‹void›* - -___ - -### putContractStorage - -▸ **putContractStorage**(`address`: Buffer, `key`: Buffer, `value`: Buffer): *Promise‹void›* - -*Defined in [state/interface.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L20)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | -`key` | Buffer | -`value` | Buffer | - -**Returns:** *Promise‹void›* - -___ - -### revert - -▸ **revert**(): *Promise‹void›* - -*Defined in [state/interface.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L24)* - -**Returns:** *Promise‹void›* - -___ - -### setStateRoot - -▸ **setStateRoot**(`stateRoot`: Buffer): *Promise‹void›* - -*Defined in [state/interface.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L26)* - -**Parameters:** - -Name | Type | ------- | ------ | -`stateRoot` | Buffer | - -**Returns:** *Promise‹void›* - -___ - -### touchAccount - -▸ **touchAccount**(`address`: Buffer): *void* - -*Defined in [state/interface.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/interface.ts#L15)* - -**Parameters:** - -Name | Type | ------- | ------ | -`address` | Buffer | - -**Returns:** *void* diff --git a/packages/vm/docs/interfaces/_state_statemanager_.defaultstatemanageropts.md b/packages/vm/docs/interfaces/_state_statemanager_.defaultstatemanageropts.md deleted file mode 100644 index f11648e07a..0000000000 --- a/packages/vm/docs/interfaces/_state_statemanager_.defaultstatemanageropts.md +++ /dev/null @@ -1,36 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["state/stateManager"](../modules/_state_statemanager_.md) › [DefaultStateManagerOpts](_state_statemanager_.defaultstatemanageropts.md) - -# Interface: DefaultStateManagerOpts - -Options for constructing a [StateManager](_state_index_.statemanager.md). - -## Hierarchy - -* **DefaultStateManagerOpts** - -## Index - -### Properties - -* [common](_state_statemanager_.defaultstatemanageropts.md#optional-common) -* [trie](_state_statemanager_.defaultstatemanageropts.md#optional-trie) - -## Properties - -### `Optional` common - -• **common**? : *Common* - -*Defined in [state/stateManager.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L19)* - -Parameters of the chain ([`Common`](https://github.com/ethereumjs/ethereumjs-common)) - -___ - -### `Optional` trie - -• **trie**? : *Trie* - -*Defined in [state/stateManager.ts:23](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/state/stateManager.ts#L23)* - -A [`merkle-patricia-tree`](https://github.com/ethereumjs/merkle-patricia-tree) instance diff --git a/packages/vm/docs/modules/_evm_evm_.md b/packages/vm/docs/modules/_evm_evm_.md deleted file mode 100644 index aebeca325a..0000000000 --- a/packages/vm/docs/modules/_evm_evm_.md +++ /dev/null @@ -1,31 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["evm/evm"](_evm_evm_.md) - -# Module: "evm/evm" - -## Index - -### Interfaces - -* [EVMResult](../interfaces/_evm_evm_.evmresult.md) -* [ExecResult](../interfaces/_evm_evm_.execresult.md) -* [NewContractEvent](../interfaces/_evm_evm_.newcontractevent.md) - -### Functions - -* [OOGResult](_evm_evm_.md#oogresult) - -## Functions - -### OOGResult - -▸ **OOGResult**(`gasLimit`: BN): *[ExecResult](../interfaces/_evm_evm_.execresult.md)* - -*Defined in [evm/evm.ts:79](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L79)* - -**Parameters:** - -Name | Type | ------- | ------ | -`gasLimit` | BN | - -**Returns:** *[ExecResult](../interfaces/_evm_evm_.execresult.md)* diff --git a/packages/vm/docs/modules/_exceptions_.md b/packages/vm/docs/modules/_exceptions_.md deleted file mode 100644 index e812b75add..0000000000 --- a/packages/vm/docs/modules/_exceptions_.md +++ /dev/null @@ -1,13 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["exceptions"](_exceptions_.md) - -# Module: "exceptions" - -## Index - -### Enumerations - -* [ERROR](../enums/_exceptions_.error.md) - -### Classes - -* [VmError](../classes/_exceptions_.vmerror.md) diff --git a/packages/vm/docs/modules/_index_.md b/packages/vm/docs/modules/_index_.md deleted file mode 100644 index 89ac483193..0000000000 --- a/packages/vm/docs/modules/_index_.md +++ /dev/null @@ -1,13 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["index"](_index_.md) - -# Module: "index" - -## Index - -### Classes - -* [VM](../classes/_index_.vm.md) - -### Interfaces - -* [VMOpts](../interfaces/_index_.vmopts.md) diff --git a/packages/vm/docs/modules/_lib_evm_evm_.md b/packages/vm/docs/modules/_lib_evm_evm_.md new file mode 100644 index 0000000000..b6d7554137 --- /dev/null +++ b/packages/vm/docs/modules/_lib_evm_evm_.md @@ -0,0 +1,66 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/evm"](_lib_evm_evm_.md) + +# Module: "lib/evm/evm" + +## Index + +### Interfaces + +* [EVMResult](../interfaces/_lib_evm_evm_.evmresult.md) +* [ExecResult](../interfaces/_lib_evm_evm_.execresult.md) +* [NewContractEvent](../interfaces/_lib_evm_evm_.newcontractevent.md) + +### Functions + +* [COOGResult](_lib_evm_evm_.md#coogresult) +* [OOGResult](_lib_evm_evm_.md#oogresult) +* [VmErrorResult](_lib_evm_evm_.md#vmerrorresult) + +## Functions + +### COOGResult + +▸ **COOGResult**(`gasUsedCreateCode`: BN): *[ExecResult](../interfaces/_lib_evm_evm_.execresult.md)* + +*Defined in [lib/evm/evm.ts:87](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L87)* + +**Parameters:** + +Name | Type | +------ | ------ | +`gasUsedCreateCode` | BN | + +**Returns:** *[ExecResult](../interfaces/_lib_evm_evm_.execresult.md)* + +___ + +### OOGResult + +▸ **OOGResult**(`gasLimit`: BN): *[ExecResult](../interfaces/_lib_evm_evm_.execresult.md)* + +*Defined in [lib/evm/evm.ts:79](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L79)* + +**Parameters:** + +Name | Type | +------ | ------ | +`gasLimit` | BN | + +**Returns:** *[ExecResult](../interfaces/_lib_evm_evm_.execresult.md)* + +___ + +### VmErrorResult + +▸ **VmErrorResult**(`error`: [VmError](../classes/_lib_exceptions_.vmerror.md), `gasUsed`: BN): *[ExecResult](../interfaces/_lib_evm_evm_.execresult.md)* + +*Defined in [lib/evm/evm.ts:95](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/evm.ts#L95)* + +**Parameters:** + +Name | Type | +------ | ------ | +`error` | [VmError](../classes/_lib_exceptions_.vmerror.md) | +`gasUsed` | BN | + +**Returns:** *[ExecResult](../interfaces/_lib_evm_evm_.execresult.md)* diff --git a/packages/vm/docs/modules/_lib_evm_opcodes_codes_.md b/packages/vm/docs/modules/_lib_evm_opcodes_codes_.md new file mode 100644 index 0000000000..d7a3b43dde --- /dev/null +++ b/packages/vm/docs/modules/_lib_evm_opcodes_codes_.md @@ -0,0 +1,45 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/codes"](_lib_evm_opcodes_codes_.md) + +# Module: "lib/evm/opcodes/codes" + +## Index + +### Classes + +* [Opcode](../classes/_lib_evm_opcodes_codes_.opcode.md) + +### Type aliases + +* [OpcodeList](_lib_evm_opcodes_codes_.md#opcodelist) + +### Functions + +* [getOpcodesForHF](_lib_evm_opcodes_codes_.md#getopcodesforhf) + +## Type aliases + +### OpcodeList + +Ƭ **OpcodeList**: *Map‹number, [Opcode](../classes/_lib_evm_opcodes_codes_.opcode.md)›* + +*Defined in [lib/evm/opcodes/codes.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L35)* + +## Functions + +### getOpcodesForHF + +▸ **getOpcodesForHF**(`common`: Common): *[OpcodeList](_lib_evm_opcodes_codes_.md#opcodelist)* + +*Defined in [lib/evm/opcodes/codes.ts:267](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L267)* + +Get suitable opcodes for the required hardfork. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`common` | Common | Ethereumjs Common metadata object. | + +**Returns:** *[OpcodeList](_lib_evm_opcodes_codes_.md#opcodelist)* + +Opcodes dictionary object. diff --git a/packages/vm/docs/modules/_lib_evm_opcodes_eip1283_.md b/packages/vm/docs/modules/_lib_evm_opcodes_eip1283_.md new file mode 100644 index 0000000000..915646487d --- /dev/null +++ b/packages/vm/docs/modules/_lib_evm_opcodes_eip1283_.md @@ -0,0 +1,30 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/EIP1283"](_lib_evm_opcodes_eip1283_.md) + +# Module: "lib/evm/opcodes/EIP1283" + +## Index + +### Functions + +* [updateSstoreGasEIP1283](_lib_evm_opcodes_eip1283_.md#updatesstoregaseip1283) + +## Functions + +### updateSstoreGasEIP1283 + +▸ **updateSstoreGasEIP1283**(`runState`: RunState, `found`: any, `value`: Buffer, `key`: Buffer): *void* + +*Defined in [lib/evm/opcodes/EIP1283.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/EIP1283.ts#L11)* + +Adjusts gas usage and refunds of SStore ops per EIP-1283 (Constantinople) + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`runState` | RunState | - | +`found` | any | - | +`value` | Buffer | | +`key` | Buffer | - | + +**Returns:** *void* diff --git a/packages/vm/docs/modules/_lib_evm_opcodes_eip2200_.md b/packages/vm/docs/modules/_lib_evm_opcodes_eip2200_.md new file mode 100644 index 0000000000..3ec90526d4 --- /dev/null +++ b/packages/vm/docs/modules/_lib_evm_opcodes_eip2200_.md @@ -0,0 +1,30 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/EIP2200"](_lib_evm_opcodes_eip2200_.md) + +# Module: "lib/evm/opcodes/EIP2200" + +## Index + +### Functions + +* [updateSstoreGasEIP2200](_lib_evm_opcodes_eip2200_.md#updatesstoregaseip2200) + +## Functions + +### updateSstoreGasEIP2200 + +▸ **updateSstoreGasEIP2200**(`runState`: RunState, `found`: any, `value`: Buffer, `key`: Buffer): *void* + +*Defined in [lib/evm/opcodes/EIP2200.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/EIP2200.ts#L14)* + +Adjusts gas usage and refunds of SStore ops per EIP-2200 (Istanbul) + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`runState` | RunState | - | +`found` | any | - | +`value` | Buffer | | +`key` | Buffer | - | + +**Returns:** *void* diff --git a/packages/vm/docs/modules/_lib_evm_opcodes_eip2929_.md b/packages/vm/docs/modules/_lib_evm_opcodes_eip2929_.md new file mode 100644 index 0000000000..cf4a8d31ea --- /dev/null +++ b/packages/vm/docs/modules/_lib_evm_opcodes_eip2929_.md @@ -0,0 +1,79 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/EIP2929"](_lib_evm_opcodes_eip2929_.md) + +# Module: "lib/evm/opcodes/EIP2929" + +## Index + +### Functions + +* [accessAddressEIP2929](_lib_evm_opcodes_eip2929_.md#accessaddresseip2929) +* [accessStorageEIP2929](_lib_evm_opcodes_eip2929_.md#accessstorageeip2929) +* [adjustSstoreGasEIP2929](_lib_evm_opcodes_eip2929_.md#adjustsstoregaseip2929) + +## Functions + +### accessAddressEIP2929 + +▸ **accessAddressEIP2929**(`runState`: RunState, `address`: Address, `baseFee?`: undefined | number): *void* + +*Defined in [lib/evm/opcodes/EIP2929.ts:13](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/EIP2929.ts#L13)* + +Adds address to accessedAddresses set if not already included. +Adjusts cost incurred for executing opcode based on whether address read +is warm/cold. (EIP 2929) + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`runState` | RunState | - | +`address` | Address | | +`baseFee?` | undefined | number | - | + +**Returns:** *void* + +___ + +### accessStorageEIP2929 + +▸ **accessStorageEIP2929**(`runState`: RunState, `key`: Buffer, `isSstore`: boolean): *void* + +*Defined in [lib/evm/opcodes/EIP2929.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/EIP2929.ts#L42)* + +Adds (address, key) to accessedStorage tuple set if not already included. +Adjusts cost incurred for executing opcode based on whether storage read +is warm/cold. (EIP 2929) + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`runState` | RunState | - | +`key` | Buffer | (to storage slot) | +`isSstore` | boolean | - | + +**Returns:** *void* + +___ + +### adjustSstoreGasEIP2929 + +▸ **adjustSstoreGasEIP2929**(`runState`: RunState, `key`: Buffer, `defaultCost`: number, `costName`: string): *number* + +*Defined in [lib/evm/opcodes/EIP2929.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/EIP2929.ts#L74)* + +Adjusts cost of SSTORE_RESET_GAS or SLOAD (aka sstorenoop) (EIP-2200) downward when storage +location is already warm + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`runState` | RunState | - | +`key` | Buffer | storage slot | +`defaultCost` | number | SSTORE_RESET_GAS / SLOAD | +`costName` | string | parameter name ('reset' or 'noop') | + +**Returns:** *number* + +adjusted cost diff --git a/packages/vm/docs/modules/_lib_evm_opcodes_functions_.md b/packages/vm/docs/modules/_lib_evm_opcodes_functions_.md new file mode 100644 index 0000000000..11f052b974 --- /dev/null +++ b/packages/vm/docs/modules/_lib_evm_opcodes_functions_.md @@ -0,0 +1,1181 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/functions"](_lib_evm_opcodes_functions_.md) + +# Module: "lib/evm/opcodes/functions" + +## Index + +### Interfaces + +* [AsyncOpHandler](../interfaces/_lib_evm_opcodes_functions_.asyncophandler.md) +* [SyncOpHandler](../interfaces/_lib_evm_opcodes_functions_.syncophandler.md) + +### Type aliases + +* [OpHandler](_lib_evm_opcodes_functions_.md#ophandler) + +### Variables + +* [handlers](_lib_evm_opcodes_functions_.md#const-handlers) + +## Type aliases + +### OpHandler + +Ƭ **OpHandler**: *[SyncOpHandler](../interfaces/_lib_evm_opcodes_functions_.syncophandler.md) | [AsyncOpHandler](../interfaces/_lib_evm_opcodes_functions_.asyncophandler.md)* + +*Defined in [lib/evm/opcodes/functions.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/functions.ts#L38)* + +## Variables + +### `Const` handlers + +• **handlers**: *Map‹number, [OpHandler](_lib_evm_opcodes_functions_.md#ophandler)›* = new Map([ + // 0x00: STOP + [ + 0x00, + /* eslint-disable-next-line no-unused-vars */ + function (runState: RunState) { + trap(ERROR.STOP) + }, + ], + // 0x01: ADD + [ + 0x01, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.add(b).mod(TWO_POW256) + runState.stack.push(r) + }, + ], + // 0x02: MUL + [ + 0x02, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.mul(b).mod(TWO_POW256) + runState.stack.push(r) + }, + ], + // 0x03: SUB + [ + 0x03, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.sub(b).toTwos(256) + runState.stack.push(r) + }, + ], + // 0x04: DIV + [ + 0x04, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + let r + if (b.isZero()) { + r = new BN(b) + } else { + r = a.div(b) + } + runState.stack.push(r) + }, + ], + // 0x05: SDIV + [ + 0x05, + function (runState: RunState) { + let [a, b] = runState.stack.popN(2) + let r + if (b.isZero()) { + r = new BN(b) + } else { + a = a.fromTwos(256) + b = b.fromTwos(256) + r = a.div(b).toTwos(256) + } + runState.stack.push(r) + }, + ], + // 0x06: MOD + [ + 0x06, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + let r + if (b.isZero()) { + r = new BN(b) + } else { + r = a.mod(b) + } + runState.stack.push(r) + }, + ], + // 0x07: SMOD + [ + 0x07, + function (runState: RunState) { + let [a, b] = runState.stack.popN(2) + let r + if (b.isZero()) { + r = new BN(b) + } else { + a = a.fromTwos(256) + b = b.fromTwos(256) + r = a.abs().mod(b.abs()) + if (a.isNeg()) { + r = r.ineg() + } + r = r.toTwos(256) + } + runState.stack.push(r) + }, + ], + // 0x08: ADDMOD + [ + 0x08, + function (runState: RunState) { + const [a, b, c] = runState.stack.popN(3) + let r + if (c.isZero()) { + r = new BN(c) + } else { + r = a.add(b).mod(c) + } + runState.stack.push(r) + }, + ], + // 0x09: MULMOD + [ + 0x09, + function (runState: RunState) { + const [a, b, c] = runState.stack.popN(3) + let r + if (c.isZero()) { + r = new BN(c) + } else { + r = a.mul(b).mod(c) + } + runState.stack.push(r) + }, + ], + // 0x0a: EXP + [ + 0x0a, + function (runState: RunState) { + const [base, exponent] = runState.stack.popN(2) + if (exponent.isZero()) { + runState.stack.push(new BN(1)) + return + } + const byteLength = exponent.byteLength() + if (byteLength < 1 || byteLength > 32) { + trap(ERROR.OUT_OF_RANGE) + } + const gasPrice = runState._common.param('gasPrices', 'expByte') + const amount = new BN(byteLength).muln(gasPrice) + runState.eei.useGas(amount) + + if (base.isZero()) { + runState.stack.push(new BN(0)) + return + } + const m = BN.red(TWO_POW256) + const redBase = base.toRed(m) + const r = redBase.redPow(exponent) + runState.stack.push(r.fromRed()) + }, + ], + // 0x0b: SIGNEXTEND + [ + 0x0b, + function (runState: RunState) { + /* eslint-disable-next-line prefer-const */ + let [k, val] = runState.stack.popN(2) + if (k.ltn(31)) { + const signBit = k.muln(8).iaddn(7).toNumber() + const mask = new BN(1).ishln(signBit).isubn(1) + if (val.testn(signBit)) { + val = val.or(mask.notn(256)) + } else { + val = val.and(mask) + } + } else { + // return the same value + val = new BN(val) + } + runState.stack.push(val) + }, + ], + // 0x10 range - bit ops + // 0x10: LT + [ + 0x10, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = new BN(a.lt(b) ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x11: GT + [ + 0x11, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = new BN(a.gt(b) ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x12: SLT + [ + 0x12, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = new BN(a.fromTwos(256).lt(b.fromTwos(256)) ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x13: SGT + [ + 0x13, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = new BN(a.fromTwos(256).gt(b.fromTwos(256)) ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x14: EQ + [ + 0x14, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = new BN(a.eq(b) ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x15: ISZERO + [ + 0x15, + function (runState: RunState) { + const a = runState.stack.pop() + const r = new BN(a.isZero() ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x16: AND + [ + 0x16, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.and(b) + runState.stack.push(r) + }, + ], + // 0x17: OR + [ + 0x17, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.or(b) + runState.stack.push(r) + }, + ], + // 0x18: XOR + [ + 0x18, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.xor(b) + runState.stack.push(r) + }, + ], + // 0x19: NOT + [ + 0x19, + function (runState: RunState) { + const a = runState.stack.pop() + const r = a.notn(256) + runState.stack.push(r) + }, + ], + // 0x1a: BYTE + [ + 0x1a, + function (runState: RunState) { + const [pos, word] = runState.stack.popN(2) + if (pos.gten(32)) { + runState.stack.push(new BN(0)) + return + } + + const r = new BN(word.shrn((31 - pos.toNumber()) * 8).andln(0xff)) + runState.stack.push(r) + }, + ], + // 0x1b: SHL + [ + 0x1b, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + if (a.gten(256)) { + runState.stack.push(new BN(0)) + return + } + + const r = b.shln(a.toNumber()).iand(MAX_INTEGER) + runState.stack.push(r) + }, + ], + // 0x1c: SHR + [ + 0x1c, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + if (a.gten(256)) { + runState.stack.push(new BN(0)) + return + } + + const r = b.shrn(a.toNumber()) + runState.stack.push(r) + }, + ], + // 0x1d: SAR + [ + 0x1d, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + + let r + const isSigned = b.testn(255) + if (a.gten(256)) { + if (isSigned) { + r = new BN(MAX_INTEGER) + } else { + r = new BN(0) + } + runState.stack.push(r) + return + } + + const c = b.shrn(a.toNumber()) + if (isSigned) { + const shiftedOutWidth = 255 - a.toNumber() + const mask = MAX_INTEGER.shrn(shiftedOutWidth).shln(shiftedOutWidth) + r = c.ior(mask) + } else { + r = c + } + runState.stack.push(r) + }, + ], + // 0x20 range - crypto + // 0x20: SHA3 + [ + 0x20, + function (runState: RunState) { + const [offset, length] = runState.stack.popN(2) + subMemUsage(runState, offset, length) + let data = Buffer.alloc(0) + if (!length.isZero()) { + data = runState.memory.read(offset.toNumber(), length.toNumber()) + } + // copy fee + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'sha3Word')).imul(divCeil(length, new BN(32))) + ) + const r = new BN(keccak256(data)) + runState.stack.push(r) + }, + ], + // 0x30 range - closure state + // 0x30: ADDRESS + [ + 0x30, + function (runState: RunState) { + const address = new BN(runState.eei.getAddress().buf) + runState.stack.push(address) + }, + ], + // 0x31: BALANCE + [ + 0x31, + async function (runState: RunState) { + const addressBN = runState.stack.pop() + const address = new Address(addressToBuffer(addressBN)) + accessAddressEIP2929(runState, address, runState._common.param('gasPrices', 'balance')) + const balance = await runState.eei.getExternalBalance(address) + runState.stack.push(balance) + }, + ], + // 0x32: ORIGIN + [ + 0x32, + function (runState: RunState) { + runState.stack.push(runState.eei.getTxOrigin()) + }, + ], + // 0x33: CALLER + [ + 0x33, + function (runState: RunState) { + runState.stack.push(runState.eei.getCaller()) + }, + ], + // 0x34: CALLVALUE + [ + 0x34, + function (runState: RunState) { + runState.stack.push(runState.eei.getCallValue()) + }, + ], + // 0x35: CALLDATALOAD + [ + 0x35, + function (runState: RunState) { + const pos = runState.stack.pop() + if (pos.gt(runState.eei.getCallDataSize())) { + runState.stack.push(new BN(0)) + return + } + + const i = pos.toNumber() + let loaded = runState.eei.getCallData().slice(i, i + 32) + loaded = loaded.length ? loaded : Buffer.from([0]) + const r = new BN(setLengthRight(loaded, 32)) + + runState.stack.push(r) + }, + ], + // 0x36: CALLDATASIZE + [ + 0x36, + function (runState: RunState) { + const r = runState.eei.getCallDataSize() + runState.stack.push(r) + }, + ], + // 0x37: CALLDATACOPY + [ + 0x37, + function (runState: RunState) { + const [memOffset, dataOffset, dataLength] = runState.stack.popN(3) + + subMemUsage(runState, memOffset, dataLength) + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'copy')).imul(divCeil(dataLength, new BN(32))) + ) + + const data = getDataSlice(runState.eei.getCallData(), dataOffset, dataLength) + const memOffsetNum = memOffset.toNumber() + const dataLengthNum = dataLength.toNumber() + runState.memory.extend(memOffsetNum, dataLengthNum) + runState.memory.write(memOffsetNum, dataLengthNum, data) + }, + ], + // 0x38: CODESIZE + [ + 0x38, + function (runState: RunState) { + runState.stack.push(runState.eei.getCodeSize()) + }, + ], + // 0x39: CODECOPY + [ + 0x39, + function (runState: RunState) { + const [memOffset, codeOffset, length] = runState.stack.popN(3) + + subMemUsage(runState, memOffset, length) + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'copy')).imul(divCeil(length, new BN(32))) + ) + + const data = getDataSlice(runState.eei.getCode(), codeOffset, length) + const memOffsetNum = memOffset.toNumber() + const lengthNum = length.toNumber() + runState.memory.extend(memOffsetNum, lengthNum) + runState.memory.write(memOffsetNum, lengthNum, data) + }, + ], + // 0x3b: EXTCODESIZE + [ + 0x3b, + async function (runState: RunState) { + const addressBN = runState.stack.pop() + const address = new Address(addressToBuffer(addressBN)) + accessAddressEIP2929(runState, address, runState._common.param('gasPrices', 'extcodesize')) + const size = await runState.eei.getExternalCodeSize(addressBN) + runState.stack.push(size) + }, + ], + // 0x3c: EXTCODECOPY + [ + 0x3c, + async function (runState: RunState) { + const [addressBN, memOffset, codeOffset, length] = runState.stack.popN(4) + + // FIXME: for some reason this must come before subGas + subMemUsage(runState, memOffset, length) + const address = new Address(addressToBuffer(addressBN)) + accessAddressEIP2929(runState, address, runState._common.param('gasPrices', 'extcodecopy')) + // copy fee + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'copy')).imul(divCeil(length, new BN(32))) + ) + + const code = await runState.eei.getExternalCode(addressBN) + + const data = getDataSlice(code, codeOffset, length) + const memOffsetNum = memOffset.toNumber() + const lengthNum = length.toNumber() + runState.memory.extend(memOffsetNum, lengthNum) + runState.memory.write(memOffsetNum, lengthNum, data) + }, + ], + // 0x3f: EXTCODEHASH + [ + 0x3f, + async function (runState: RunState) { + const addressBN = runState.stack.pop() + const address = new Address(addressToBuffer(addressBN)) + accessAddressEIP2929(runState, address, runState._common.param('gasPrices', 'extcodehash')) + const empty = await runState.eei.isAccountEmpty(address) + if (empty) { + runState.stack.push(new BN(0)) + return + } + + const code = await runState.eei.getExternalCode(addressBN) + if (code.length === 0) { + runState.stack.push(new BN(KECCAK256_NULL)) + return + } + + runState.stack.push(new BN(keccak256(code))) + }, + ], + // 0x3d: RETURNDATASIZE + [ + 0x3d, + function (runState: RunState) { + runState.stack.push(runState.eei.getReturnDataSize()) + }, + ], + // 0x3e: RETURNDATACOPY + [ + 0x3e, + function (runState: RunState) { + const [memOffset, returnDataOffset, length] = runState.stack.popN(3) + + if (returnDataOffset.add(length).gt(runState.eei.getReturnDataSize())) { + trap(ERROR.OUT_OF_GAS) + } + + subMemUsage(runState, memOffset, length) + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'copy')).mul(divCeil(length, new BN(32))) + ) + + const data = getDataSlice(runState.eei.getReturnData(), returnDataOffset, length) + const memOffsetNum = memOffset.toNumber() + const lengthNum = length.toNumber() + runState.memory.extend(memOffsetNum, lengthNum) + runState.memory.write(memOffsetNum, lengthNum, data) + }, + ], + // 0x3a: GASPRICE + [ + 0x3a, + function (runState: RunState) { + runState.stack.push(runState.eei.getTxGasPrice()) + }, + ], + // '0x40' range - block operations + // 0x40: BLOCKHASH + [ + 0x40, + async function (runState: RunState) { + const number = runState.stack.pop() + + const diff = runState.eei.getBlockNumber().sub(number) + // block lookups must be within the past 256 blocks + if (diff.gtn(256) || diff.lten(0)) { + runState.stack.push(new BN(0)) + return + } + + const hash = await runState.eei.getBlockHash(number) + runState.stack.push(hash) + }, + ], + // 0x41: COINBASE + [ + 0x41, + function (runState: RunState) { + runState.stack.push(runState.eei.getBlockCoinbase()) + }, + ], + // 0x42: TIMESTAMP + [ + 0x42, + function (runState: RunState) { + runState.stack.push(runState.eei.getBlockTimestamp()) + }, + ], + // 0x43: NUMBER + [ + 0x43, + function (runState: RunState) { + runState.stack.push(runState.eei.getBlockNumber()) + }, + ], + // 0x44: DIFFICULTY + [ + 0x44, + function (runState: RunState) { + runState.stack.push(runState.eei.getBlockDifficulty()) + }, + ], + // 0x45: GASLIMIT + [ + 0x45, + function (runState: RunState) { + runState.stack.push(runState.eei.getBlockGasLimit()) + }, + ], + // 0x46: CHAINID + [ + 0x46, + function (runState: RunState) { + runState.stack.push(runState.eei.getChainId()) + }, + ], + // 0x47: SELFBALANCE + [ + 0x47, + function (runState: RunState) { + runState.stack.push(runState.eei.getSelfBalance()) + }, + ], + // 0x50 range - 'storage' and execution + // 0x50: POP + [ + 0x50, + function (runState: RunState) { + runState.stack.pop() + }, + ], + // 0x51: MLOAD + [ + 0x51, + function (runState: RunState) { + const pos = runState.stack.pop() + subMemUsage(runState, pos, new BN(32)) + const word = runState.memory.read(pos.toNumber(), 32) + runState.stack.push(new BN(word)) + }, + ], + // 0x52: MSTORE + [ + 0x52, + function (runState: RunState) { + const [offset, word] = runState.stack.popN(2) + const buf = word.toArrayLike(Buffer, 'be', 32) + subMemUsage(runState, offset, new BN(32)) + const offsetNum = offset.toNumber() + runState.memory.extend(offsetNum, 32) + runState.memory.write(offsetNum, 32, buf) + }, + ], + // 0x53: MSTORE8 + [ + 0x53, + function (runState: RunState) { + const [offset, byte] = runState.stack.popN(2) + + // NOTE: we're using a 'trick' here to get the least significant byte + // NOTE: force cast necessary because `BN.andln` returns number but + // the types are wrong + const buf = Buffer.from([(byte.andln(0xff) as unknown) as number]) + subMemUsage(runState, offset, new BN(1)) + const offsetNum = offset.toNumber() + runState.memory.extend(offsetNum, 1) + runState.memory.write(offsetNum, 1, buf) + }, + ], + // 0x54: SLOAD + [ + 0x54, + async function (runState: RunState) { + const key = runState.stack.pop() + const keyBuf = key.toArrayLike(Buffer, 'be', 32) + + accessStorageEIP2929(runState, keyBuf, false) + const value = await runState.eei.storageLoad(keyBuf) + const valueBN = value.length ? new BN(value) : new BN(0) + runState.stack.push(valueBN) + }, + ], + // 0x55: SSTORE + [ + 0x55, + async function (runState: RunState) { + if (runState.eei.isStatic()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + + const [key, val] = runState.stack.popN(2) + + const keyBuf = key.toArrayLike(Buffer, 'be', 32) + // NOTE: this should be the shortest representation + let value + if (val.isZero()) { + value = Buffer.from([]) + } else { + value = val.toArrayLike(Buffer, 'be') + } + + // TODO: Replace getContractStorage with EEI method + const found = await getContractStorage(runState, runState.eei.getAddress(), keyBuf) + accessStorageEIP2929(runState, keyBuf, true) + updateSstoreGasEIP1283(runState, found, setLengthLeftStorage(value), keyBuf) + updateSstoreGasEIP2200(runState, found, setLengthLeftStorage(value), keyBuf) + await runState.eei.storageStore(keyBuf, value) + }, + ], + // 0x56: JUMP + [ + 0x56, + function (runState: RunState) { + const dest = runState.stack.pop() + if (dest.gt(runState.eei.getCodeSize())) { + trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState)) + } + + const destNum = dest.toNumber() + + if (!jumpIsValid(runState, destNum)) { + trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState)) + } + + runState.programCounter = destNum + }, + ], + // 0x57: JUMPI + [ + 0x57, + function (runState: RunState) { + const [dest, cond] = runState.stack.popN(2) + if (!cond.isZero()) { + if (dest.gt(runState.eei.getCodeSize())) { + trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState)) + } + + const destNum = dest.toNumber() + + if (!jumpIsValid(runState, destNum)) { + trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState)) + } + + runState.programCounter = destNum + } + }, + ], + // 0x58: PC + [ + 0x58, + function (runState: RunState) { + runState.stack.push(new BN(runState.programCounter - 1)) + }, + ], + // 0x59: MSIZE + [ + 0x59, + function (runState: RunState) { + runState.stack.push(runState.memoryWordCount.muln(32)) + }, + ], + // 0x5a: GAS + [ + 0x5a, + function (runState: RunState) { + runState.stack.push(new BN(runState.eei.getGasLeft())) + }, + ], + // 0x5b: JUMPDEST + /* eslint-disable-next-line no-unused-vars */ + [0x5b, function (runState: RunState) {}], + // 0x5c: BEGINSUB + [ + 0x5c, + function (runState: RunState) { + trap(ERROR.INVALID_BEGINSUB + ' at ' + describeLocation(runState)) + }, + ], + // 0x5d: RETURNSUB + [ + 0x5d, + function (runState: RunState) { + if (runState.returnStack.length < 1) { + trap(ERROR.INVALID_RETURNSUB) + } + + const dest = runState.returnStack.pop() + runState.programCounter = dest.toNumber() + }, + ], + // 0x5e: JUMPSUB + [ + 0x5e, + function (runState: RunState) { + const dest = runState.stack.pop() + + if (dest.gt(runState.eei.getCodeSize())) { + trap(ERROR.INVALID_JUMPSUB + ' at ' + describeLocation(runState)) + } + + const destNum = dest.toNumber() + + if (!jumpSubIsValid(runState, destNum)) { + trap(ERROR.INVALID_JUMPSUB + ' at ' + describeLocation(runState)) + } + + runState.returnStack.push(new BN(runState.programCounter)) + runState.programCounter = destNum + 1 + }, + ], + // 0x60: PUSH + [ + 0x60, + function (runState: RunState) { + const numToPush = runState.opCode - 0x5f + const loaded = new BN( + runState.eei.getCode().slice(runState.programCounter, runState.programCounter + numToPush) + ) + runState.programCounter += numToPush + runState.stack.push(loaded) + }, + ], + // 0x80: DUP + [ + 0x80, + function (runState: RunState) { + const stackPos = runState.opCode - 0x7f + runState.stack.dup(stackPos) + }, + ], + // 0x90: SWAP + [ + 0x90, + function (runState: RunState) { + const stackPos = runState.opCode - 0x8f + runState.stack.swap(stackPos) + }, + ], + // 0xa0: LOG + [ + 0xa0, + function (runState: RunState) { + if (runState.eei.isStatic()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + + const [memOffset, memLength] = runState.stack.popN(2) + + const topicsCount = runState.opCode - 0xa0 + if (topicsCount < 0 || topicsCount > 4) { + trap(ERROR.OUT_OF_RANGE) + } + + const topics = runState.stack.popN(topicsCount) + const topicsBuf = topics.map(function (a) { + return a.toArrayLike(Buffer, 'be', 32) + }) + + subMemUsage(runState, memOffset, memLength) + let mem = Buffer.alloc(0) + if (!memLength.isZero()) { + mem = runState.memory.read(memOffset.toNumber(), memLength.toNumber()) + } + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'logTopic')) + .imuln(topicsCount) + .iadd(memLength.muln(runState._common.param('gasPrices', 'logData'))) + ) + + runState.eei.log(mem, topicsCount, topicsBuf) + }, + ], + + // '0xf0' range - closures + // 0xf0: CREATE + [ + 0xf0, + async function (runState: RunState) { + if (runState.eei.isStatic()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + + const [value, offset, length] = runState.stack.popN(3) + + subMemUsage(runState, offset, length) + let gasLimit = new BN(runState.eei.getGasLeft()) + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) + + let data = Buffer.alloc(0) + if (!length.isZero()) { + data = runState.memory.read(offset.toNumber(), length.toNumber()) + } + + accessAddressEIP2929(runState, runState.eei.getAddress()) + const ret = await runState.eei.create(gasLimit, value, data) + runState.stack.push(ret) + }, + ], + // 0xf5: CREATE2 + [ + 0xf5, + async function (runState: RunState) { + if (runState.eei.isStatic()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + + const [value, offset, length, salt] = runState.stack.popN(4) + + subMemUsage(runState, offset, length) + accessAddressEIP2929(runState, runState.eei.getAddress()) + + // Deduct gas costs for hashing + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'sha3Word')).imul(divCeil(length, new BN(32))) + ) + let gasLimit = new BN(runState.eei.getGasLeft()) + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) // CREATE2 is only available after TangerineWhistle (Constantinople introduced this opcode) + + let data = Buffer.alloc(0) + if (!length.isZero()) { + data = runState.memory.read(offset.toNumber(), length.toNumber()) + } + + const ret = await runState.eei.create2( + gasLimit, + value, + data, + salt.toArrayLike(Buffer, 'be', 32) + ) + runState.stack.push(ret) + }, + ], + // 0xf1: CALL + [ + 0xf1, + async function (runState: RunState) { + let [gasLimit, toAddr, value, inOffset, inLength, outOffset, outLength] = runState.stack.popN( + 7 + ) + const toAddress = new Address(addressToBuffer(toAddr)) + + if (runState.eei.isStatic() && !value.isZero()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + subMemUsage(runState, inOffset, inLength) + subMemUsage(runState, outOffset, outLength) + accessAddressEIP2929(runState, toAddress, runState._common.param('gasPrices', 'call')) + + if (!value.isZero()) { + runState.eei.useGas(new BN(runState._common.param('gasPrices', 'callValueTransfer'))) + } + + let data = Buffer.alloc(0) + if (!inLength.isZero()) { + data = runState.memory.read(inOffset.toNumber(), inLength.toNumber()) + } + + if (runState._common.gteHardfork('spuriousDragon')) { + // We are at or after Spurious Dragon + // Call new account gas: account is DEAD and we transfer nonzero value + if ((await runState.eei.isAccountEmpty(toAddress)) && !value.isZero()) { + runState.eei.useGas(new BN(runState._common.param('gasPrices', 'callNewAccount'))) + } + } else if (!(await runState.eei.accountExists(toAddress))) { + // We are before Spurious Dragon and the account does not exist. + // Call new account gas: account does not exist (it is not in the state trie, not even as an "empty" account) + runState.eei.useGas(new BN(runState._common.param('gasPrices', 'callNewAccount'))) + } + + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) + // note that TangerineWhistle or later this cannot happen (it could have ran out of gas prior to getting here though) + if (gasLimit.gt(runState.eei.getGasLeft())) { + trap(ERROR.OUT_OF_GAS) + } + + if (!value.isZero()) { + // TODO: Don't use private attr directly + runState.eei._gasLeft.iaddn(runState._common.param('gasPrices', 'callStipend')) + gasLimit.iaddn(runState._common.param('gasPrices', 'callStipend')) + } + + const ret = await runState.eei.call(gasLimit, toAddress, value, data) + // Write return data to memory + writeCallOutput(runState, outOffset, outLength) + runState.stack.push(ret) + }, + ], + // 0xf2: CALLCODE + [ + 0xf2, + async function (runState: RunState) { + let [gasLimit, toAddr, value, inOffset, inLength, outOffset, outLength] = runState.stack.popN( + 7 + ) + const toAddress = new Address(addressToBuffer(toAddr)) + + subMemUsage(runState, inOffset, inLength) + subMemUsage(runState, outOffset, outLength) + accessAddressEIP2929(runState, toAddress, runState._common.param('gasPrices', 'callcode')) + + if (!value.isZero()) { + runState.eei.useGas(new BN(runState._common.param('gasPrices', 'callValueTransfer'))) + } + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) + // note that TangerineWhistle or later this cannot happen (it could have ran out of gas prior to getting here though) + if (gasLimit.gt(runState.eei.getGasLeft())) { + trap(ERROR.OUT_OF_GAS) + } + if (!value.isZero()) { + // TODO: Don't use private attr directly + runState.eei._gasLeft.iaddn(runState._common.param('gasPrices', 'callStipend')) + gasLimit.iaddn(runState._common.param('gasPrices', 'callStipend')) + } + + let data = Buffer.alloc(0) + if (!inLength.isZero()) { + data = runState.memory.read(inOffset.toNumber(), inLength.toNumber()) + } + + const ret = await runState.eei.callCode(gasLimit, toAddress, value, data) + // Write return data to memory + writeCallOutput(runState, outOffset, outLength) + runState.stack.push(ret) + }, + ], + // 0xf4: DELEGATECALL + [ + 0xf4, + async function (runState: RunState) { + const value = runState.eei.getCallValue() + let [gasLimit, toAddr, inOffset, inLength, outOffset, outLength] = runState.stack.popN(6) + const toAddress = new Address(addressToBuffer(toAddr)) + + subMemUsage(runState, inOffset, inLength) + subMemUsage(runState, outOffset, outLength) + accessAddressEIP2929(runState, toAddress, runState._common.param('gasPrices', 'delegatecall')) + + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) + // note that TangerineWhistle or later this cannot happen (it could have ran out of gas prior to getting here though) + if (gasLimit.gt(runState.eei.getGasLeft())) { + trap(ERROR.OUT_OF_GAS) + } + + let data = Buffer.alloc(0) + if (!inLength.isZero()) { + data = runState.memory.read(inOffset.toNumber(), inLength.toNumber()) + } + + const ret = await runState.eei.callDelegate(gasLimit, toAddress, value, data) + // Write return data to memory + writeCallOutput(runState, outOffset, outLength) + runState.stack.push(ret) + }, + ], + // 0x06: STATICCALL + [ + 0xfa, + async function (runState: RunState) { + const value = new BN(0) + let [gasLimit, toAddr, inOffset, inLength, outOffset, outLength] = runState.stack.popN(6) + const toAddress = new Address(addressToBuffer(toAddr)) + + subMemUsage(runState, inOffset, inLength) + subMemUsage(runState, outOffset, outLength) + accessAddressEIP2929(runState, toAddress, runState._common.param('gasPrices', 'staticcall')) + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) // we set TangerineWhistle or later to true here, as STATICCALL was available from Byzantium (which is after TangerineWhistle) + + let data = Buffer.alloc(0) + if (!inLength.isZero()) { + data = runState.memory.read(inOffset.toNumber(), inLength.toNumber()) + } + + const ret = await runState.eei.callStatic(gasLimit, toAddress, value, data) + // Write return data to memory + writeCallOutput(runState, outOffset, outLength) + runState.stack.push(ret) + }, + ], + // 0xf3: RETURN + [ + 0xf3, + function (runState: RunState) { + const [offset, length] = runState.stack.popN(2) + subMemUsage(runState, offset, length) + let returnData = Buffer.alloc(0) + if (!length.isZero()) { + returnData = runState.memory.read(offset.toNumber(), length.toNumber()) + } + runState.eei.finish(returnData) + }, + ], + // 0xfd: REVERT + [ + 0xfd, + function (runState: RunState) { + const [offset, length] = runState.stack.popN(2) + subMemUsage(runState, offset, length) + let returnData = Buffer.alloc(0) + if (!length.isZero()) { + returnData = runState.memory.read(offset.toNumber(), length.toNumber()) + } + runState.eei.revert(returnData) + }, + ], + // '0x70', range - other + // 0xff: SELFDESTRUCT + [ + 0xff, + async function (runState: RunState) { + const selfdestructToAddressBN = runState.stack.pop() + if (runState.eei.isStatic()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + + const selfdestructToAddress = new Address(addressToBuffer(selfdestructToAddressBN)) + let deductGas = false + if (runState._common.gteHardfork('spuriousDragon')) { + // EIP-161: State Trie Clearing + const balance = await runState.eei.getExternalBalance(runState.eei.getAddress()) + if (balance.gtn(0)) { + // This technically checks if account is empty or non-existent + // TODO: improve on the API here (EEI and StateManager) + const empty = await runState.eei.isAccountEmpty(selfdestructToAddress) + if (empty) { + const account = await runState.stateManager.getAccount(selfdestructToAddress) + deductGas = true + } + } + } else if (runState._common.gteHardfork('tangerineWhistle')) { + // Pre EIP-150 (Tangerine Whistle) gas semantics + const exists = await runState.stateManager.accountExists(selfdestructToAddress) + if (!exists) { + deductGas = true + } + } + if (deductGas) { + runState.eei.useGas(new BN(runState._common.param('gasPrices', 'callNewAccount'))) + } + + accessAddressEIP2929(runState, selfdestructToAddress, 0) + return runState.eei.selfDestruct(selfdestructToAddress) + }, + ], +]) + +*Defined in [lib/evm/opcodes/functions.ts:41](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/functions.ts#L41)* diff --git a/packages/vm/docs/modules/_lib_evm_opcodes_index_.md b/packages/vm/docs/modules/_lib_evm_opcodes_index_.md new file mode 100644 index 0000000000..913f550ad9 --- /dev/null +++ b/packages/vm/docs/modules/_lib_evm_opcodes_index_.md @@ -0,0 +1,1488 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/index"](_lib_evm_opcodes_index_.md) + +# Module: "lib/evm/opcodes/index" + +## Index + +### Classes + +* [Opcode](../classes/_lib_evm_opcodes_index_.opcode.md) + +### Interfaces + +* [AsyncOpHandler](../interfaces/_lib_evm_opcodes_index_.asyncophandler.md) +* [SyncOpHandler](../interfaces/_lib_evm_opcodes_index_.syncophandler.md) + +### Type aliases + +* [OpHandler](_lib_evm_opcodes_index_.md#ophandler) +* [OpcodeList](_lib_evm_opcodes_index_.md#opcodelist) + +### Variables + +* [handlers](_lib_evm_opcodes_index_.md#const-handlers) + +### Functions + +* [addressToBuffer](_lib_evm_opcodes_index_.md#addresstobuffer) +* [describeLocation](_lib_evm_opcodes_index_.md#describelocation) +* [divCeil](_lib_evm_opcodes_index_.md#divceil) +* [getContractStorage](_lib_evm_opcodes_index_.md#getcontractstorage) +* [getDataSlice](_lib_evm_opcodes_index_.md#getdataslice) +* [getFullname](_lib_evm_opcodes_index_.md#getfullname) +* [getOpcodesForHF](_lib_evm_opcodes_index_.md#getopcodesforhf) +* [jumpIsValid](_lib_evm_opcodes_index_.md#jumpisvalid) +* [jumpSubIsValid](_lib_evm_opcodes_index_.md#jumpsubisvalid) +* [maxCallGas](_lib_evm_opcodes_index_.md#maxcallgas) +* [setLengthLeftStorage](_lib_evm_opcodes_index_.md#setlengthleftstorage) +* [subMemUsage](_lib_evm_opcodes_index_.md#submemusage) +* [trap](_lib_evm_opcodes_index_.md#trap) +* [writeCallOutput](_lib_evm_opcodes_index_.md#writecalloutput) + +## Type aliases + +### OpHandler + +Ƭ **OpHandler**: *[SyncOpHandler](../interfaces/_lib_evm_opcodes_functions_.syncophandler.md) | [AsyncOpHandler](../interfaces/_lib_evm_opcodes_functions_.asyncophandler.md)* + +*Defined in [lib/evm/opcodes/functions.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/functions.ts#L38)* + +___ + +### OpcodeList + +Ƭ **OpcodeList**: *Map‹number, [Opcode](../classes/_lib_evm_opcodes_codes_.opcode.md)›* + +*Defined in [lib/evm/opcodes/codes.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L35)* + +## Variables + +### `Const` handlers + +• **handlers**: *Map‹number, [OpHandler](_lib_evm_opcodes_index_.md#ophandler)›* = new Map([ + // 0x00: STOP + [ + 0x00, + /* eslint-disable-next-line no-unused-vars */ + function (runState: RunState) { + trap(ERROR.STOP) + }, + ], + // 0x01: ADD + [ + 0x01, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.add(b).mod(TWO_POW256) + runState.stack.push(r) + }, + ], + // 0x02: MUL + [ + 0x02, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.mul(b).mod(TWO_POW256) + runState.stack.push(r) + }, + ], + // 0x03: SUB + [ + 0x03, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.sub(b).toTwos(256) + runState.stack.push(r) + }, + ], + // 0x04: DIV + [ + 0x04, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + let r + if (b.isZero()) { + r = new BN(b) + } else { + r = a.div(b) + } + runState.stack.push(r) + }, + ], + // 0x05: SDIV + [ + 0x05, + function (runState: RunState) { + let [a, b] = runState.stack.popN(2) + let r + if (b.isZero()) { + r = new BN(b) + } else { + a = a.fromTwos(256) + b = b.fromTwos(256) + r = a.div(b).toTwos(256) + } + runState.stack.push(r) + }, + ], + // 0x06: MOD + [ + 0x06, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + let r + if (b.isZero()) { + r = new BN(b) + } else { + r = a.mod(b) + } + runState.stack.push(r) + }, + ], + // 0x07: SMOD + [ + 0x07, + function (runState: RunState) { + let [a, b] = runState.stack.popN(2) + let r + if (b.isZero()) { + r = new BN(b) + } else { + a = a.fromTwos(256) + b = b.fromTwos(256) + r = a.abs().mod(b.abs()) + if (a.isNeg()) { + r = r.ineg() + } + r = r.toTwos(256) + } + runState.stack.push(r) + }, + ], + // 0x08: ADDMOD + [ + 0x08, + function (runState: RunState) { + const [a, b, c] = runState.stack.popN(3) + let r + if (c.isZero()) { + r = new BN(c) + } else { + r = a.add(b).mod(c) + } + runState.stack.push(r) + }, + ], + // 0x09: MULMOD + [ + 0x09, + function (runState: RunState) { + const [a, b, c] = runState.stack.popN(3) + let r + if (c.isZero()) { + r = new BN(c) + } else { + r = a.mul(b).mod(c) + } + runState.stack.push(r) + }, + ], + // 0x0a: EXP + [ + 0x0a, + function (runState: RunState) { + const [base, exponent] = runState.stack.popN(2) + if (exponent.isZero()) { + runState.stack.push(new BN(1)) + return + } + const byteLength = exponent.byteLength() + if (byteLength < 1 || byteLength > 32) { + trap(ERROR.OUT_OF_RANGE) + } + const gasPrice = runState._common.param('gasPrices', 'expByte') + const amount = new BN(byteLength).muln(gasPrice) + runState.eei.useGas(amount) + + if (base.isZero()) { + runState.stack.push(new BN(0)) + return + } + const m = BN.red(TWO_POW256) + const redBase = base.toRed(m) + const r = redBase.redPow(exponent) + runState.stack.push(r.fromRed()) + }, + ], + // 0x0b: SIGNEXTEND + [ + 0x0b, + function (runState: RunState) { + /* eslint-disable-next-line prefer-const */ + let [k, val] = runState.stack.popN(2) + if (k.ltn(31)) { + const signBit = k.muln(8).iaddn(7).toNumber() + const mask = new BN(1).ishln(signBit).isubn(1) + if (val.testn(signBit)) { + val = val.or(mask.notn(256)) + } else { + val = val.and(mask) + } + } else { + // return the same value + val = new BN(val) + } + runState.stack.push(val) + }, + ], + // 0x10 range - bit ops + // 0x10: LT + [ + 0x10, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = new BN(a.lt(b) ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x11: GT + [ + 0x11, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = new BN(a.gt(b) ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x12: SLT + [ + 0x12, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = new BN(a.fromTwos(256).lt(b.fromTwos(256)) ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x13: SGT + [ + 0x13, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = new BN(a.fromTwos(256).gt(b.fromTwos(256)) ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x14: EQ + [ + 0x14, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = new BN(a.eq(b) ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x15: ISZERO + [ + 0x15, + function (runState: RunState) { + const a = runState.stack.pop() + const r = new BN(a.isZero() ? 1 : 0) + runState.stack.push(r) + }, + ], + // 0x16: AND + [ + 0x16, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.and(b) + runState.stack.push(r) + }, + ], + // 0x17: OR + [ + 0x17, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.or(b) + runState.stack.push(r) + }, + ], + // 0x18: XOR + [ + 0x18, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + const r = a.xor(b) + runState.stack.push(r) + }, + ], + // 0x19: NOT + [ + 0x19, + function (runState: RunState) { + const a = runState.stack.pop() + const r = a.notn(256) + runState.stack.push(r) + }, + ], + // 0x1a: BYTE + [ + 0x1a, + function (runState: RunState) { + const [pos, word] = runState.stack.popN(2) + if (pos.gten(32)) { + runState.stack.push(new BN(0)) + return + } + + const r = new BN(word.shrn((31 - pos.toNumber()) * 8).andln(0xff)) + runState.stack.push(r) + }, + ], + // 0x1b: SHL + [ + 0x1b, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + if (a.gten(256)) { + runState.stack.push(new BN(0)) + return + } + + const r = b.shln(a.toNumber()).iand(MAX_INTEGER) + runState.stack.push(r) + }, + ], + // 0x1c: SHR + [ + 0x1c, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + if (a.gten(256)) { + runState.stack.push(new BN(0)) + return + } + + const r = b.shrn(a.toNumber()) + runState.stack.push(r) + }, + ], + // 0x1d: SAR + [ + 0x1d, + function (runState: RunState) { + const [a, b] = runState.stack.popN(2) + + let r + const isSigned = b.testn(255) + if (a.gten(256)) { + if (isSigned) { + r = new BN(MAX_INTEGER) + } else { + r = new BN(0) + } + runState.stack.push(r) + return + } + + const c = b.shrn(a.toNumber()) + if (isSigned) { + const shiftedOutWidth = 255 - a.toNumber() + const mask = MAX_INTEGER.shrn(shiftedOutWidth).shln(shiftedOutWidth) + r = c.ior(mask) + } else { + r = c + } + runState.stack.push(r) + }, + ], + // 0x20 range - crypto + // 0x20: SHA3 + [ + 0x20, + function (runState: RunState) { + const [offset, length] = runState.stack.popN(2) + subMemUsage(runState, offset, length) + let data = Buffer.alloc(0) + if (!length.isZero()) { + data = runState.memory.read(offset.toNumber(), length.toNumber()) + } + // copy fee + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'sha3Word')).imul(divCeil(length, new BN(32))) + ) + const r = new BN(keccak256(data)) + runState.stack.push(r) + }, + ], + // 0x30 range - closure state + // 0x30: ADDRESS + [ + 0x30, + function (runState: RunState) { + const address = new BN(runState.eei.getAddress().buf) + runState.stack.push(address) + }, + ], + // 0x31: BALANCE + [ + 0x31, + async function (runState: RunState) { + const addressBN = runState.stack.pop() + const address = new Address(addressToBuffer(addressBN)) + accessAddressEIP2929(runState, address, runState._common.param('gasPrices', 'balance')) + const balance = await runState.eei.getExternalBalance(address) + runState.stack.push(balance) + }, + ], + // 0x32: ORIGIN + [ + 0x32, + function (runState: RunState) { + runState.stack.push(runState.eei.getTxOrigin()) + }, + ], + // 0x33: CALLER + [ + 0x33, + function (runState: RunState) { + runState.stack.push(runState.eei.getCaller()) + }, + ], + // 0x34: CALLVALUE + [ + 0x34, + function (runState: RunState) { + runState.stack.push(runState.eei.getCallValue()) + }, + ], + // 0x35: CALLDATALOAD + [ + 0x35, + function (runState: RunState) { + const pos = runState.stack.pop() + if (pos.gt(runState.eei.getCallDataSize())) { + runState.stack.push(new BN(0)) + return + } + + const i = pos.toNumber() + let loaded = runState.eei.getCallData().slice(i, i + 32) + loaded = loaded.length ? loaded : Buffer.from([0]) + const r = new BN(setLengthRight(loaded, 32)) + + runState.stack.push(r) + }, + ], + // 0x36: CALLDATASIZE + [ + 0x36, + function (runState: RunState) { + const r = runState.eei.getCallDataSize() + runState.stack.push(r) + }, + ], + // 0x37: CALLDATACOPY + [ + 0x37, + function (runState: RunState) { + const [memOffset, dataOffset, dataLength] = runState.stack.popN(3) + + subMemUsage(runState, memOffset, dataLength) + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'copy')).imul(divCeil(dataLength, new BN(32))) + ) + + const data = getDataSlice(runState.eei.getCallData(), dataOffset, dataLength) + const memOffsetNum = memOffset.toNumber() + const dataLengthNum = dataLength.toNumber() + runState.memory.extend(memOffsetNum, dataLengthNum) + runState.memory.write(memOffsetNum, dataLengthNum, data) + }, + ], + // 0x38: CODESIZE + [ + 0x38, + function (runState: RunState) { + runState.stack.push(runState.eei.getCodeSize()) + }, + ], + // 0x39: CODECOPY + [ + 0x39, + function (runState: RunState) { + const [memOffset, codeOffset, length] = runState.stack.popN(3) + + subMemUsage(runState, memOffset, length) + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'copy')).imul(divCeil(length, new BN(32))) + ) + + const data = getDataSlice(runState.eei.getCode(), codeOffset, length) + const memOffsetNum = memOffset.toNumber() + const lengthNum = length.toNumber() + runState.memory.extend(memOffsetNum, lengthNum) + runState.memory.write(memOffsetNum, lengthNum, data) + }, + ], + // 0x3b: EXTCODESIZE + [ + 0x3b, + async function (runState: RunState) { + const addressBN = runState.stack.pop() + const address = new Address(addressToBuffer(addressBN)) + accessAddressEIP2929(runState, address, runState._common.param('gasPrices', 'extcodesize')) + const size = await runState.eei.getExternalCodeSize(addressBN) + runState.stack.push(size) + }, + ], + // 0x3c: EXTCODECOPY + [ + 0x3c, + async function (runState: RunState) { + const [addressBN, memOffset, codeOffset, length] = runState.stack.popN(4) + + // FIXME: for some reason this must come before subGas + subMemUsage(runState, memOffset, length) + const address = new Address(addressToBuffer(addressBN)) + accessAddressEIP2929(runState, address, runState._common.param('gasPrices', 'extcodecopy')) + // copy fee + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'copy')).imul(divCeil(length, new BN(32))) + ) + + const code = await runState.eei.getExternalCode(addressBN) + + const data = getDataSlice(code, codeOffset, length) + const memOffsetNum = memOffset.toNumber() + const lengthNum = length.toNumber() + runState.memory.extend(memOffsetNum, lengthNum) + runState.memory.write(memOffsetNum, lengthNum, data) + }, + ], + // 0x3f: EXTCODEHASH + [ + 0x3f, + async function (runState: RunState) { + const addressBN = runState.stack.pop() + const address = new Address(addressToBuffer(addressBN)) + accessAddressEIP2929(runState, address, runState._common.param('gasPrices', 'extcodehash')) + const empty = await runState.eei.isAccountEmpty(address) + if (empty) { + runState.stack.push(new BN(0)) + return + } + + const code = await runState.eei.getExternalCode(addressBN) + if (code.length === 0) { + runState.stack.push(new BN(KECCAK256_NULL)) + return + } + + runState.stack.push(new BN(keccak256(code))) + }, + ], + // 0x3d: RETURNDATASIZE + [ + 0x3d, + function (runState: RunState) { + runState.stack.push(runState.eei.getReturnDataSize()) + }, + ], + // 0x3e: RETURNDATACOPY + [ + 0x3e, + function (runState: RunState) { + const [memOffset, returnDataOffset, length] = runState.stack.popN(3) + + if (returnDataOffset.add(length).gt(runState.eei.getReturnDataSize())) { + trap(ERROR.OUT_OF_GAS) + } + + subMemUsage(runState, memOffset, length) + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'copy')).mul(divCeil(length, new BN(32))) + ) + + const data = getDataSlice(runState.eei.getReturnData(), returnDataOffset, length) + const memOffsetNum = memOffset.toNumber() + const lengthNum = length.toNumber() + runState.memory.extend(memOffsetNum, lengthNum) + runState.memory.write(memOffsetNum, lengthNum, data) + }, + ], + // 0x3a: GASPRICE + [ + 0x3a, + function (runState: RunState) { + runState.stack.push(runState.eei.getTxGasPrice()) + }, + ], + // '0x40' range - block operations + // 0x40: BLOCKHASH + [ + 0x40, + async function (runState: RunState) { + const number = runState.stack.pop() + + const diff = runState.eei.getBlockNumber().sub(number) + // block lookups must be within the past 256 blocks + if (diff.gtn(256) || diff.lten(0)) { + runState.stack.push(new BN(0)) + return + } + + const hash = await runState.eei.getBlockHash(number) + runState.stack.push(hash) + }, + ], + // 0x41: COINBASE + [ + 0x41, + function (runState: RunState) { + runState.stack.push(runState.eei.getBlockCoinbase()) + }, + ], + // 0x42: TIMESTAMP + [ + 0x42, + function (runState: RunState) { + runState.stack.push(runState.eei.getBlockTimestamp()) + }, + ], + // 0x43: NUMBER + [ + 0x43, + function (runState: RunState) { + runState.stack.push(runState.eei.getBlockNumber()) + }, + ], + // 0x44: DIFFICULTY + [ + 0x44, + function (runState: RunState) { + runState.stack.push(runState.eei.getBlockDifficulty()) + }, + ], + // 0x45: GASLIMIT + [ + 0x45, + function (runState: RunState) { + runState.stack.push(runState.eei.getBlockGasLimit()) + }, + ], + // 0x46: CHAINID + [ + 0x46, + function (runState: RunState) { + runState.stack.push(runState.eei.getChainId()) + }, + ], + // 0x47: SELFBALANCE + [ + 0x47, + function (runState: RunState) { + runState.stack.push(runState.eei.getSelfBalance()) + }, + ], + // 0x50 range - 'storage' and execution + // 0x50: POP + [ + 0x50, + function (runState: RunState) { + runState.stack.pop() + }, + ], + // 0x51: MLOAD + [ + 0x51, + function (runState: RunState) { + const pos = runState.stack.pop() + subMemUsage(runState, pos, new BN(32)) + const word = runState.memory.read(pos.toNumber(), 32) + runState.stack.push(new BN(word)) + }, + ], + // 0x52: MSTORE + [ + 0x52, + function (runState: RunState) { + const [offset, word] = runState.stack.popN(2) + const buf = word.toArrayLike(Buffer, 'be', 32) + subMemUsage(runState, offset, new BN(32)) + const offsetNum = offset.toNumber() + runState.memory.extend(offsetNum, 32) + runState.memory.write(offsetNum, 32, buf) + }, + ], + // 0x53: MSTORE8 + [ + 0x53, + function (runState: RunState) { + const [offset, byte] = runState.stack.popN(2) + + // NOTE: we're using a 'trick' here to get the least significant byte + // NOTE: force cast necessary because `BN.andln` returns number but + // the types are wrong + const buf = Buffer.from([(byte.andln(0xff) as unknown) as number]) + subMemUsage(runState, offset, new BN(1)) + const offsetNum = offset.toNumber() + runState.memory.extend(offsetNum, 1) + runState.memory.write(offsetNum, 1, buf) + }, + ], + // 0x54: SLOAD + [ + 0x54, + async function (runState: RunState) { + const key = runState.stack.pop() + const keyBuf = key.toArrayLike(Buffer, 'be', 32) + + accessStorageEIP2929(runState, keyBuf, false) + const value = await runState.eei.storageLoad(keyBuf) + const valueBN = value.length ? new BN(value) : new BN(0) + runState.stack.push(valueBN) + }, + ], + // 0x55: SSTORE + [ + 0x55, + async function (runState: RunState) { + if (runState.eei.isStatic()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + + const [key, val] = runState.stack.popN(2) + + const keyBuf = key.toArrayLike(Buffer, 'be', 32) + // NOTE: this should be the shortest representation + let value + if (val.isZero()) { + value = Buffer.from([]) + } else { + value = val.toArrayLike(Buffer, 'be') + } + + // TODO: Replace getContractStorage with EEI method + const found = await getContractStorage(runState, runState.eei.getAddress(), keyBuf) + accessStorageEIP2929(runState, keyBuf, true) + updateSstoreGasEIP1283(runState, found, setLengthLeftStorage(value), keyBuf) + updateSstoreGasEIP2200(runState, found, setLengthLeftStorage(value), keyBuf) + await runState.eei.storageStore(keyBuf, value) + }, + ], + // 0x56: JUMP + [ + 0x56, + function (runState: RunState) { + const dest = runState.stack.pop() + if (dest.gt(runState.eei.getCodeSize())) { + trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState)) + } + + const destNum = dest.toNumber() + + if (!jumpIsValid(runState, destNum)) { + trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState)) + } + + runState.programCounter = destNum + }, + ], + // 0x57: JUMPI + [ + 0x57, + function (runState: RunState) { + const [dest, cond] = runState.stack.popN(2) + if (!cond.isZero()) { + if (dest.gt(runState.eei.getCodeSize())) { + trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState)) + } + + const destNum = dest.toNumber() + + if (!jumpIsValid(runState, destNum)) { + trap(ERROR.INVALID_JUMP + ' at ' + describeLocation(runState)) + } + + runState.programCounter = destNum + } + }, + ], + // 0x58: PC + [ + 0x58, + function (runState: RunState) { + runState.stack.push(new BN(runState.programCounter - 1)) + }, + ], + // 0x59: MSIZE + [ + 0x59, + function (runState: RunState) { + runState.stack.push(runState.memoryWordCount.muln(32)) + }, + ], + // 0x5a: GAS + [ + 0x5a, + function (runState: RunState) { + runState.stack.push(new BN(runState.eei.getGasLeft())) + }, + ], + // 0x5b: JUMPDEST + /* eslint-disable-next-line no-unused-vars */ + [0x5b, function (runState: RunState) {}], + // 0x5c: BEGINSUB + [ + 0x5c, + function (runState: RunState) { + trap(ERROR.INVALID_BEGINSUB + ' at ' + describeLocation(runState)) + }, + ], + // 0x5d: RETURNSUB + [ + 0x5d, + function (runState: RunState) { + if (runState.returnStack.length < 1) { + trap(ERROR.INVALID_RETURNSUB) + } + + const dest = runState.returnStack.pop() + runState.programCounter = dest.toNumber() + }, + ], + // 0x5e: JUMPSUB + [ + 0x5e, + function (runState: RunState) { + const dest = runState.stack.pop() + + if (dest.gt(runState.eei.getCodeSize())) { + trap(ERROR.INVALID_JUMPSUB + ' at ' + describeLocation(runState)) + } + + const destNum = dest.toNumber() + + if (!jumpSubIsValid(runState, destNum)) { + trap(ERROR.INVALID_JUMPSUB + ' at ' + describeLocation(runState)) + } + + runState.returnStack.push(new BN(runState.programCounter)) + runState.programCounter = destNum + 1 + }, + ], + // 0x60: PUSH + [ + 0x60, + function (runState: RunState) { + const numToPush = runState.opCode - 0x5f + const loaded = new BN( + runState.eei.getCode().slice(runState.programCounter, runState.programCounter + numToPush) + ) + runState.programCounter += numToPush + runState.stack.push(loaded) + }, + ], + // 0x80: DUP + [ + 0x80, + function (runState: RunState) { + const stackPos = runState.opCode - 0x7f + runState.stack.dup(stackPos) + }, + ], + // 0x90: SWAP + [ + 0x90, + function (runState: RunState) { + const stackPos = runState.opCode - 0x8f + runState.stack.swap(stackPos) + }, + ], + // 0xa0: LOG + [ + 0xa0, + function (runState: RunState) { + if (runState.eei.isStatic()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + + const [memOffset, memLength] = runState.stack.popN(2) + + const topicsCount = runState.opCode - 0xa0 + if (topicsCount < 0 || topicsCount > 4) { + trap(ERROR.OUT_OF_RANGE) + } + + const topics = runState.stack.popN(topicsCount) + const topicsBuf = topics.map(function (a) { + return a.toArrayLike(Buffer, 'be', 32) + }) + + subMemUsage(runState, memOffset, memLength) + let mem = Buffer.alloc(0) + if (!memLength.isZero()) { + mem = runState.memory.read(memOffset.toNumber(), memLength.toNumber()) + } + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'logTopic')) + .imuln(topicsCount) + .iadd(memLength.muln(runState._common.param('gasPrices', 'logData'))) + ) + + runState.eei.log(mem, topicsCount, topicsBuf) + }, + ], + + // '0xf0' range - closures + // 0xf0: CREATE + [ + 0xf0, + async function (runState: RunState) { + if (runState.eei.isStatic()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + + const [value, offset, length] = runState.stack.popN(3) + + subMemUsage(runState, offset, length) + let gasLimit = new BN(runState.eei.getGasLeft()) + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) + + let data = Buffer.alloc(0) + if (!length.isZero()) { + data = runState.memory.read(offset.toNumber(), length.toNumber()) + } + + accessAddressEIP2929(runState, runState.eei.getAddress()) + const ret = await runState.eei.create(gasLimit, value, data) + runState.stack.push(ret) + }, + ], + // 0xf5: CREATE2 + [ + 0xf5, + async function (runState: RunState) { + if (runState.eei.isStatic()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + + const [value, offset, length, salt] = runState.stack.popN(4) + + subMemUsage(runState, offset, length) + accessAddressEIP2929(runState, runState.eei.getAddress()) + + // Deduct gas costs for hashing + runState.eei.useGas( + new BN(runState._common.param('gasPrices', 'sha3Word')).imul(divCeil(length, new BN(32))) + ) + let gasLimit = new BN(runState.eei.getGasLeft()) + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) // CREATE2 is only available after TangerineWhistle (Constantinople introduced this opcode) + + let data = Buffer.alloc(0) + if (!length.isZero()) { + data = runState.memory.read(offset.toNumber(), length.toNumber()) + } + + const ret = await runState.eei.create2( + gasLimit, + value, + data, + salt.toArrayLike(Buffer, 'be', 32) + ) + runState.stack.push(ret) + }, + ], + // 0xf1: CALL + [ + 0xf1, + async function (runState: RunState) { + let [gasLimit, toAddr, value, inOffset, inLength, outOffset, outLength] = runState.stack.popN( + 7 + ) + const toAddress = new Address(addressToBuffer(toAddr)) + + if (runState.eei.isStatic() && !value.isZero()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + subMemUsage(runState, inOffset, inLength) + subMemUsage(runState, outOffset, outLength) + accessAddressEIP2929(runState, toAddress, runState._common.param('gasPrices', 'call')) + + if (!value.isZero()) { + runState.eei.useGas(new BN(runState._common.param('gasPrices', 'callValueTransfer'))) + } + + let data = Buffer.alloc(0) + if (!inLength.isZero()) { + data = runState.memory.read(inOffset.toNumber(), inLength.toNumber()) + } + + if (runState._common.gteHardfork('spuriousDragon')) { + // We are at or after Spurious Dragon + // Call new account gas: account is DEAD and we transfer nonzero value + if ((await runState.eei.isAccountEmpty(toAddress)) && !value.isZero()) { + runState.eei.useGas(new BN(runState._common.param('gasPrices', 'callNewAccount'))) + } + } else if (!(await runState.eei.accountExists(toAddress))) { + // We are before Spurious Dragon and the account does not exist. + // Call new account gas: account does not exist (it is not in the state trie, not even as an "empty" account) + runState.eei.useGas(new BN(runState._common.param('gasPrices', 'callNewAccount'))) + } + + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) + // note that TangerineWhistle or later this cannot happen (it could have ran out of gas prior to getting here though) + if (gasLimit.gt(runState.eei.getGasLeft())) { + trap(ERROR.OUT_OF_GAS) + } + + if (!value.isZero()) { + // TODO: Don't use private attr directly + runState.eei._gasLeft.iaddn(runState._common.param('gasPrices', 'callStipend')) + gasLimit.iaddn(runState._common.param('gasPrices', 'callStipend')) + } + + const ret = await runState.eei.call(gasLimit, toAddress, value, data) + // Write return data to memory + writeCallOutput(runState, outOffset, outLength) + runState.stack.push(ret) + }, + ], + // 0xf2: CALLCODE + [ + 0xf2, + async function (runState: RunState) { + let [gasLimit, toAddr, value, inOffset, inLength, outOffset, outLength] = runState.stack.popN( + 7 + ) + const toAddress = new Address(addressToBuffer(toAddr)) + + subMemUsage(runState, inOffset, inLength) + subMemUsage(runState, outOffset, outLength) + accessAddressEIP2929(runState, toAddress, runState._common.param('gasPrices', 'callcode')) + + if (!value.isZero()) { + runState.eei.useGas(new BN(runState._common.param('gasPrices', 'callValueTransfer'))) + } + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) + // note that TangerineWhistle or later this cannot happen (it could have ran out of gas prior to getting here though) + if (gasLimit.gt(runState.eei.getGasLeft())) { + trap(ERROR.OUT_OF_GAS) + } + if (!value.isZero()) { + // TODO: Don't use private attr directly + runState.eei._gasLeft.iaddn(runState._common.param('gasPrices', 'callStipend')) + gasLimit.iaddn(runState._common.param('gasPrices', 'callStipend')) + } + + let data = Buffer.alloc(0) + if (!inLength.isZero()) { + data = runState.memory.read(inOffset.toNumber(), inLength.toNumber()) + } + + const ret = await runState.eei.callCode(gasLimit, toAddress, value, data) + // Write return data to memory + writeCallOutput(runState, outOffset, outLength) + runState.stack.push(ret) + }, + ], + // 0xf4: DELEGATECALL + [ + 0xf4, + async function (runState: RunState) { + const value = runState.eei.getCallValue() + let [gasLimit, toAddr, inOffset, inLength, outOffset, outLength] = runState.stack.popN(6) + const toAddress = new Address(addressToBuffer(toAddr)) + + subMemUsage(runState, inOffset, inLength) + subMemUsage(runState, outOffset, outLength) + accessAddressEIP2929(runState, toAddress, runState._common.param('gasPrices', 'delegatecall')) + + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) + // note that TangerineWhistle or later this cannot happen (it could have ran out of gas prior to getting here though) + if (gasLimit.gt(runState.eei.getGasLeft())) { + trap(ERROR.OUT_OF_GAS) + } + + let data = Buffer.alloc(0) + if (!inLength.isZero()) { + data = runState.memory.read(inOffset.toNumber(), inLength.toNumber()) + } + + const ret = await runState.eei.callDelegate(gasLimit, toAddress, value, data) + // Write return data to memory + writeCallOutput(runState, outOffset, outLength) + runState.stack.push(ret) + }, + ], + // 0x06: STATICCALL + [ + 0xfa, + async function (runState: RunState) { + const value = new BN(0) + let [gasLimit, toAddr, inOffset, inLength, outOffset, outLength] = runState.stack.popN(6) + const toAddress = new Address(addressToBuffer(toAddr)) + + subMemUsage(runState, inOffset, inLength) + subMemUsage(runState, outOffset, outLength) + accessAddressEIP2929(runState, toAddress, runState._common.param('gasPrices', 'staticcall')) + gasLimit = maxCallGas(gasLimit, runState.eei.getGasLeft(), runState) // we set TangerineWhistle or later to true here, as STATICCALL was available from Byzantium (which is after TangerineWhistle) + + let data = Buffer.alloc(0) + if (!inLength.isZero()) { + data = runState.memory.read(inOffset.toNumber(), inLength.toNumber()) + } + + const ret = await runState.eei.callStatic(gasLimit, toAddress, value, data) + // Write return data to memory + writeCallOutput(runState, outOffset, outLength) + runState.stack.push(ret) + }, + ], + // 0xf3: RETURN + [ + 0xf3, + function (runState: RunState) { + const [offset, length] = runState.stack.popN(2) + subMemUsage(runState, offset, length) + let returnData = Buffer.alloc(0) + if (!length.isZero()) { + returnData = runState.memory.read(offset.toNumber(), length.toNumber()) + } + runState.eei.finish(returnData) + }, + ], + // 0xfd: REVERT + [ + 0xfd, + function (runState: RunState) { + const [offset, length] = runState.stack.popN(2) + subMemUsage(runState, offset, length) + let returnData = Buffer.alloc(0) + if (!length.isZero()) { + returnData = runState.memory.read(offset.toNumber(), length.toNumber()) + } + runState.eei.revert(returnData) + }, + ], + // '0x70', range - other + // 0xff: SELFDESTRUCT + [ + 0xff, + async function (runState: RunState) { + const selfdestructToAddressBN = runState.stack.pop() + if (runState.eei.isStatic()) { + trap(ERROR.STATIC_STATE_CHANGE) + } + + const selfdestructToAddress = new Address(addressToBuffer(selfdestructToAddressBN)) + let deductGas = false + if (runState._common.gteHardfork('spuriousDragon')) { + // EIP-161: State Trie Clearing + const balance = await runState.eei.getExternalBalance(runState.eei.getAddress()) + if (balance.gtn(0)) { + // This technically checks if account is empty or non-existent + // TODO: improve on the API here (EEI and StateManager) + const empty = await runState.eei.isAccountEmpty(selfdestructToAddress) + if (empty) { + const account = await runState.stateManager.getAccount(selfdestructToAddress) + deductGas = true + } + } + } else if (runState._common.gteHardfork('tangerineWhistle')) { + // Pre EIP-150 (Tangerine Whistle) gas semantics + const exists = await runState.stateManager.accountExists(selfdestructToAddress) + if (!exists) { + deductGas = true + } + } + if (deductGas) { + runState.eei.useGas(new BN(runState._common.param('gasPrices', 'callNewAccount'))) + } + + accessAddressEIP2929(runState, selfdestructToAddress, 0) + return runState.eei.selfDestruct(selfdestructToAddress) + }, + ], +]) + +*Defined in [lib/evm/opcodes/functions.ts:41](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/functions.ts#L41)* + +## Functions + +### addressToBuffer + +▸ **addressToBuffer**(`address`: BN | Buffer): *Buffer‹›* + +*Defined in [lib/evm/opcodes/util.ts:39](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L39)* + +Converts BN address (they're stored like this on the stack) to buffer address + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | BN | Buffer | + +**Returns:** *Buffer‹›* + +___ + +### describeLocation + +▸ **describeLocation**(`runState`: RunState): *string* + +*Defined in [lib/evm/opcodes/util.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L50)* + +Error message helper - generates location string + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | + +**Returns:** *string* + +___ + +### divCeil + +▸ **divCeil**(`a`: BN, `b`: BN): *BN* + +*Defined in [lib/evm/opcodes/util.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L64)* + +Find Ceil(a / b) + +**Parameters:** + +Name | Type | +------ | ------ | +`a` | BN | +`b` | BN | + +**Returns:** *BN* + +___ + +### getContractStorage + +▸ **getContractStorage**(`runState`: RunState, `address`: Address, `key`: Buffer): *Promise‹any›* + +*Defined in [lib/evm/opcodes/util.ts:83](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L83)* + +Calls relevant stateManager.getContractStorage method based on hardfork + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | +`address` | Address | +`key` | Buffer | + +**Returns:** *Promise‹any›* + +___ + +### getDataSlice + +▸ **getDataSlice**(`data`: Buffer, `offset`: BN, `length`: BN): *Buffer* + +*Defined in [lib/evm/opcodes/util.ts:111](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L111)* + +Returns an overflow-safe slice of an array. It right-pads +the data with zeros to `length`. + +**Parameters:** + +Name | Type | +------ | ------ | +`data` | Buffer | +`offset` | BN | +`length` | BN | + +**Returns:** *Buffer* + +___ + +### getFullname + +▸ **getFullname**(`code`: number, `name`: string): *string* + +*Defined in [lib/evm/opcodes/util.ts:136](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L136)* + +Get full opcode name from its name and code. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`code` | number | Integer code of opcode. | +`name` | string | Short name of the opcode. | + +**Returns:** *string* + +Full opcode name + +___ + +### getOpcodesForHF + +▸ **getOpcodesForHF**(`common`: Common): *[OpcodeList](_lib_evm_opcodes_index_.md#opcodelist)* + +*Defined in [lib/evm/opcodes/codes.ts:267](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/codes.ts#L267)* + +Get suitable opcodes for the required hardfork. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`common` | Common | Ethereumjs Common metadata object. | + +**Returns:** *[OpcodeList](_lib_evm_opcodes_index_.md#opcodelist)* + +Opcodes dictionary object. + +___ + +### jumpIsValid + +▸ **jumpIsValid**(`runState`: RunState, `dest`: number): *boolean* + +*Defined in [lib/evm/opcodes/util.ts:161](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L161)* + +Checks if a jump is valid given a destination + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | +`dest` | number | + +**Returns:** *boolean* + +___ + +### jumpSubIsValid + +▸ **jumpSubIsValid**(`runState`: RunState, `dest`: number): *boolean* + +*Defined in [lib/evm/opcodes/util.ts:172](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L172)* + +Checks if a jumpsub is valid given a destination + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | +`dest` | number | + +**Returns:** *boolean* + +___ + +### maxCallGas + +▸ **maxCallGas**(`gasLimit`: BN, `gasLeft`: BN, `runState`: RunState): *BN* + +*Defined in [lib/evm/opcodes/util.ts:184](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L184)* + +Returns an overflow-safe slice of an array. It right-pads + +the data with zeros to `length`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`gasLimit` | BN | requested gas Limit | +`gasLeft` | BN | current gas left | +`runState` | RunState | the current runState | + +**Returns:** *BN* + +___ + +### setLengthLeftStorage + +▸ **setLengthLeftStorage**(`value`: Buffer): *Buffer‹›* + +*Defined in [lib/evm/opcodes/util.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L14)* + +Proxy function for ethereumjs-util's setLengthLeft, except it returns a zero + +length buffer in case the buffer is full of zeros. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`value` | Buffer | Buffer which we want to pad | + +**Returns:** *Buffer‹›* + +___ + +### subMemUsage + +▸ **subMemUsage**(`runState`: RunState, `offset`: BN, `length`: BN): *void* + +*Defined in [lib/evm/opcodes/util.ts:202](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L202)* + +Subtracts the amount needed for memory usage from `runState.gasLeft` + +**`method`** subMemUsage + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`runState` | RunState | - | +`offset` | BN | - | +`length` | BN | | + +**Returns:** *void* + +___ + +### trap + +▸ **trap**(`err`: string): *void* + +*Defined in [lib/evm/opcodes/util.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L28)* + +Wraps error message as VMError + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`err` | string | | + +**Returns:** *void* + +___ + +### writeCallOutput + +▸ **writeCallOutput**(`runState`: RunState, `outOffset`: BN, `outLength`: BN): *void* + +*Defined in [lib/evm/opcodes/util.ts:230](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L230)* + +Writes data returned by eei.call* methods to memory + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`runState` | RunState | - | +`outOffset` | BN | - | +`outLength` | BN | | + +**Returns:** *void* diff --git a/packages/vm/docs/modules/_lib_evm_opcodes_util_.md b/packages/vm/docs/modules/_lib_evm_opcodes_util_.md new file mode 100644 index 0000000000..832c01ba27 --- /dev/null +++ b/packages/vm/docs/modules/_lib_evm_opcodes_util_.md @@ -0,0 +1,278 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/opcodes/util"](_lib_evm_opcodes_util_.md) + +# Module: "lib/evm/opcodes/util" + +## Index + +### Functions + +* [addressToBuffer](_lib_evm_opcodes_util_.md#addresstobuffer) +* [describeLocation](_lib_evm_opcodes_util_.md#describelocation) +* [divCeil](_lib_evm_opcodes_util_.md#divceil) +* [getContractStorage](_lib_evm_opcodes_util_.md#getcontractstorage) +* [getDataSlice](_lib_evm_opcodes_util_.md#getdataslice) +* [getFullname](_lib_evm_opcodes_util_.md#getfullname) +* [jumpIsValid](_lib_evm_opcodes_util_.md#jumpisvalid) +* [jumpSubIsValid](_lib_evm_opcodes_util_.md#jumpsubisvalid) +* [maxCallGas](_lib_evm_opcodes_util_.md#maxcallgas) +* [setLengthLeftStorage](_lib_evm_opcodes_util_.md#setlengthleftstorage) +* [subMemUsage](_lib_evm_opcodes_util_.md#submemusage) +* [trap](_lib_evm_opcodes_util_.md#trap) +* [writeCallOutput](_lib_evm_opcodes_util_.md#writecalloutput) + +## Functions + +### addressToBuffer + +▸ **addressToBuffer**(`address`: BN | Buffer): *Buffer‹›* + +*Defined in [lib/evm/opcodes/util.ts:39](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L39)* + +Converts BN address (they're stored like this on the stack) to buffer address + +**Parameters:** + +Name | Type | +------ | ------ | +`address` | BN | Buffer | + +**Returns:** *Buffer‹›* + +___ + +### describeLocation + +▸ **describeLocation**(`runState`: RunState): *string* + +*Defined in [lib/evm/opcodes/util.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L50)* + +Error message helper - generates location string + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | + +**Returns:** *string* + +___ + +### divCeil + +▸ **divCeil**(`a`: BN, `b`: BN): *BN* + +*Defined in [lib/evm/opcodes/util.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L64)* + +Find Ceil(a / b) + +**Parameters:** + +Name | Type | +------ | ------ | +`a` | BN | +`b` | BN | + +**Returns:** *BN* + +___ + +### getContractStorage + +▸ **getContractStorage**(`runState`: RunState, `address`: Address, `key`: Buffer): *Promise‹any›* + +*Defined in [lib/evm/opcodes/util.ts:83](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L83)* + +Calls relevant stateManager.getContractStorage method based on hardfork + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | +`address` | Address | +`key` | Buffer | + +**Returns:** *Promise‹any›* + +___ + +### getDataSlice + +▸ **getDataSlice**(`data`: Buffer, `offset`: BN, `length`: BN): *Buffer* + +*Defined in [lib/evm/opcodes/util.ts:111](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L111)* + +Returns an overflow-safe slice of an array. It right-pads +the data with zeros to `length`. + +**Parameters:** + +Name | Type | +------ | ------ | +`data` | Buffer | +`offset` | BN | +`length` | BN | + +**Returns:** *Buffer* + +___ + +### getFullname + +▸ **getFullname**(`code`: number, `name`: string): *string* + +*Defined in [lib/evm/opcodes/util.ts:136](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L136)* + +Get full opcode name from its name and code. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`code` | number | Integer code of opcode. | +`name` | string | Short name of the opcode. | + +**Returns:** *string* + +Full opcode name + +___ + +### jumpIsValid + +▸ **jumpIsValid**(`runState`: RunState, `dest`: number): *boolean* + +*Defined in [lib/evm/opcodes/util.ts:161](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L161)* + +Checks if a jump is valid given a destination + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | +`dest` | number | + +**Returns:** *boolean* + +___ + +### jumpSubIsValid + +▸ **jumpSubIsValid**(`runState`: RunState, `dest`: number): *boolean* + +*Defined in [lib/evm/opcodes/util.ts:172](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L172)* + +Checks if a jumpsub is valid given a destination + +**Parameters:** + +Name | Type | +------ | ------ | +`runState` | RunState | +`dest` | number | + +**Returns:** *boolean* + +___ + +### maxCallGas + +▸ **maxCallGas**(`gasLimit`: BN, `gasLeft`: BN, `runState`: RunState): *BN* + +*Defined in [lib/evm/opcodes/util.ts:184](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L184)* + +Returns an overflow-safe slice of an array. It right-pads + +the data with zeros to `length`. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`gasLimit` | BN | requested gas Limit | +`gasLeft` | BN | current gas left | +`runState` | RunState | the current runState | + +**Returns:** *BN* + +___ + +### setLengthLeftStorage + +▸ **setLengthLeftStorage**(`value`: Buffer): *Buffer‹›* + +*Defined in [lib/evm/opcodes/util.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L14)* + +Proxy function for ethereumjs-util's setLengthLeft, except it returns a zero + +length buffer in case the buffer is full of zeros. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`value` | Buffer | Buffer which we want to pad | + +**Returns:** *Buffer‹›* + +___ + +### subMemUsage + +▸ **subMemUsage**(`runState`: RunState, `offset`: BN, `length`: BN): *void* + +*Defined in [lib/evm/opcodes/util.ts:202](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L202)* + +Subtracts the amount needed for memory usage from `runState.gasLeft` + +**`method`** subMemUsage + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`runState` | RunState | - | +`offset` | BN | - | +`length` | BN | | + +**Returns:** *void* + +___ + +### trap + +▸ **trap**(`err`: string): *void* + +*Defined in [lib/evm/opcodes/util.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L28)* + +Wraps error message as VMError + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`err` | string | | + +**Returns:** *void* + +___ + +### writeCallOutput + +▸ **writeCallOutput**(`runState`: RunState, `outOffset`: BN, `outLength`: BN): *void* + +*Defined in [lib/evm/opcodes/util.ts:230](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/opcodes/util.ts#L230)* + +Writes data returned by eei.call* methods to memory + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`runState` | RunState | - | +`outOffset` | BN | - | +`outLength` | BN | | + +**Returns:** *void* diff --git a/packages/vm/docs/modules/_lib_evm_precompiles_util_bls12_381_.md b/packages/vm/docs/modules/_lib_evm_precompiles_util_bls12_381_.md new file mode 100644 index 0000000000..40344ade1d --- /dev/null +++ b/packages/vm/docs/modules/_lib_evm_precompiles_util_bls12_381_.md @@ -0,0 +1,133 @@ +[@ethereumjs/vm](../README.md) › ["lib/evm/precompiles/util/bls12_381"](_lib_evm_precompiles_util_bls12_381_.md) + +# Module: "lib/evm/precompiles/util/bls12_381" + +## Index + +### Functions + +* [BLS12_381_FromG1Point](_lib_evm_precompiles_util_bls12_381_.md#bls12_381_fromg1point) +* [BLS12_381_FromG2Point](_lib_evm_precompiles_util_bls12_381_.md#bls12_381_fromg2point) +* [BLS12_381_ToFp2Point](_lib_evm_precompiles_util_bls12_381_.md#bls12_381_tofp2point) +* [BLS12_381_ToFpPoint](_lib_evm_precompiles_util_bls12_381_.md#bls12_381_tofppoint) +* [BLS12_381_ToFrPoint](_lib_evm_precompiles_util_bls12_381_.md#bls12_381_tofrpoint) +* [BLS12_381_ToG1Point](_lib_evm_precompiles_util_bls12_381_.md#bls12_381_tog1point) +* [BLS12_381_ToG2Point](_lib_evm_precompiles_util_bls12_381_.md#bls12_381_tog2point) + +## Functions + +### BLS12_381_FromG1Point + +▸ **BLS12_381_FromG1Point**(`input`: any): *Buffer* + +*Defined in [lib/evm/precompiles/util/bls12_381.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/precompiles/util/bls12_381.ts#L52)* + +**Parameters:** + +Name | Type | +------ | ------ | +`input` | any | + +**Returns:** *Buffer* + +___ + +### BLS12_381_FromG2Point + +▸ **BLS12_381_FromG2Point**(`input`: any): *Buffer* + +*Defined in [lib/evm/precompiles/util/bls12_381.ts:125](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/precompiles/util/bls12_381.ts#L125)* + +**Parameters:** + +Name | Type | +------ | ------ | +`input` | any | + +**Returns:** *Buffer* + +___ + +### BLS12_381_ToFp2Point + +▸ **BLS12_381_ToFp2Point**(`fpXCoordinate`: Buffer, `fpYCoordinate`: Buffer, `mcl`: any): *any* + +*Defined in [lib/evm/precompiles/util/bls12_381.ts:178](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/precompiles/util/bls12_381.ts#L178)* + +**Parameters:** + +Name | Type | +------ | ------ | +`fpXCoordinate` | Buffer | +`fpYCoordinate` | Buffer | +`mcl` | any | + +**Returns:** *any* + +___ + +### BLS12_381_ToFpPoint + +▸ **BLS12_381_ToFpPoint**(`fpCoordinate`: Buffer, `mcl`: any): *any* + +*Defined in [lib/evm/precompiles/util/bls12_381.ts:162](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/precompiles/util/bls12_381.ts#L162)* + +**Parameters:** + +Name | Type | +------ | ------ | +`fpCoordinate` | Buffer | +`mcl` | any | + +**Returns:** *any* + +___ + +### BLS12_381_ToFrPoint + +▸ **BLS12_381_ToFrPoint**(`input`: Buffer, `mcl`: any): *any* + +*Defined in [lib/evm/precompiles/util/bls12_381.ts:152](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/precompiles/util/bls12_381.ts#L152)* + +**Parameters:** + +Name | Type | +------ | ------ | +`input` | Buffer | +`mcl` | any | + +**Returns:** *any* + +___ + +### BLS12_381_ToG1Point + +▸ **BLS12_381_ToG1Point**(`input`: Buffer, `mcl`: any): *any* + +*Defined in [lib/evm/precompiles/util/bls12_381.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/precompiles/util/bls12_381.ts#L15)* + +**Parameters:** + +Name | Type | +------ | ------ | +`input` | Buffer | +`mcl` | any | + +**Returns:** *any* + +___ + +### BLS12_381_ToG2Point + +▸ **BLS12_381_ToG2Point**(`input`: Buffer, `mcl`: any): *any* + +*Defined in [lib/evm/precompiles/util/bls12_381.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/lib/evm/precompiles/util/bls12_381.ts#L75)* + +**Parameters:** + +Name | Type | +------ | ------ | +`input` | Buffer | +`mcl` | any | + +**Returns:** *any* diff --git a/packages/vm/docs/modules/_lib_exceptions_.md b/packages/vm/docs/modules/_lib_exceptions_.md new file mode 100644 index 0000000000..98dbcb5cc3 --- /dev/null +++ b/packages/vm/docs/modules/_lib_exceptions_.md @@ -0,0 +1,13 @@ +[@ethereumjs/vm](../README.md) › ["lib/exceptions"](_lib_exceptions_.md) + +# Module: "lib/exceptions" + +## Index + +### Enumerations + +* [ERROR](../enums/_lib_exceptions_.error.md) + +### Classes + +* [VmError](../classes/_lib_exceptions_.vmerror.md) diff --git a/packages/vm/docs/modules/_lib_index_.md b/packages/vm/docs/modules/_lib_index_.md new file mode 100644 index 0000000000..80b7a84b60 --- /dev/null +++ b/packages/vm/docs/modules/_lib_index_.md @@ -0,0 +1,13 @@ +[@ethereumjs/vm](../README.md) › ["lib/index"](_lib_index_.md) + +# Module: "lib/index" + +## Index + +### Classes + +* [VM](../classes/_lib_index_.vm.md) + +### Interfaces + +* [VMOpts](../interfaces/_lib_index_.vmopts.md) diff --git a/packages/vm/docs/modules/_lib_runblock_.md b/packages/vm/docs/modules/_lib_runblock_.md new file mode 100644 index 0000000000..6a8f307717 --- /dev/null +++ b/packages/vm/docs/modules/_lib_runblock_.md @@ -0,0 +1,12 @@ +[@ethereumjs/vm](../README.md) › ["lib/runBlock"](_lib_runblock_.md) + +# Module: "lib/runBlock" + +## Index + +### Interfaces + +* [PostByzantiumTxReceipt](../interfaces/_lib_runblock_.postbyzantiumtxreceipt.md) +* [PreByzantiumTxReceipt](../interfaces/_lib_runblock_.prebyzantiumtxreceipt.md) +* [RunBlockOpts](../interfaces/_lib_runblock_.runblockopts.md) +* [RunBlockResult](../interfaces/_lib_runblock_.runblockresult.md) diff --git a/packages/vm/docs/modules/_lib_runblockchain_.md b/packages/vm/docs/modules/_lib_runblockchain_.md new file mode 100644 index 0000000000..836be723c6 --- /dev/null +++ b/packages/vm/docs/modules/_lib_runblockchain_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["lib/runBlockchain"](_lib_runblockchain_.md) + +# Module: "lib/runBlockchain" + + diff --git a/packages/vm/docs/modules/_lib_runcall_.md b/packages/vm/docs/modules/_lib_runcall_.md new file mode 100644 index 0000000000..244bdd763c --- /dev/null +++ b/packages/vm/docs/modules/_lib_runcall_.md @@ -0,0 +1,9 @@ +[@ethereumjs/vm](../README.md) › ["lib/runCall"](_lib_runcall_.md) + +# Module: "lib/runCall" + +## Index + +### Interfaces + +* [RunCallOpts](../interfaces/_lib_runcall_.runcallopts.md) diff --git a/packages/vm/docs/modules/_lib_runcode_.md b/packages/vm/docs/modules/_lib_runcode_.md new file mode 100644 index 0000000000..21e5c034b6 --- /dev/null +++ b/packages/vm/docs/modules/_lib_runcode_.md @@ -0,0 +1,9 @@ +[@ethereumjs/vm](../README.md) › ["lib/runCode"](_lib_runcode_.md) + +# Module: "lib/runCode" + +## Index + +### Interfaces + +* [RunCodeOpts](../interfaces/_lib_runcode_.runcodeopts.md) diff --git a/packages/vm/docs/modules/_lib_runtx_.md b/packages/vm/docs/modules/_lib_runtx_.md new file mode 100644 index 0000000000..6198e0cbee --- /dev/null +++ b/packages/vm/docs/modules/_lib_runtx_.md @@ -0,0 +1,10 @@ +[@ethereumjs/vm](../README.md) › ["lib/runTx"](_lib_runtx_.md) + +# Module: "lib/runTx" + +## Index + +### Interfaces + +* [RunTxOpts](../interfaces/_lib_runtx_.runtxopts.md) +* [RunTxResult](../interfaces/_lib_runtx_.runtxresult.md) diff --git a/packages/vm/docs/modules/_lib_state_index_.md b/packages/vm/docs/modules/_lib_state_index_.md new file mode 100644 index 0000000000..fbf22a29d7 --- /dev/null +++ b/packages/vm/docs/modules/_lib_state_index_.md @@ -0,0 +1,13 @@ +[@ethereumjs/vm](../README.md) › ["lib/state/index"](_lib_state_index_.md) + +# Module: "lib/state/index" + +## Index + +### Classes + +* [DefaultStateManager](../classes/_lib_state_index_.defaultstatemanager.md) + +### Interfaces + +* [StateManager](../interfaces/_lib_state_index_.statemanager.md) diff --git a/packages/vm/docs/modules/_lib_state_interface_.md b/packages/vm/docs/modules/_lib_state_interface_.md new file mode 100644 index 0000000000..d17db2f6e2 --- /dev/null +++ b/packages/vm/docs/modules/_lib_state_interface_.md @@ -0,0 +1,10 @@ +[@ethereumjs/vm](../README.md) › ["lib/state/interface"](_lib_state_interface_.md) + +# Module: "lib/state/interface" + +## Index + +### Interfaces + +* [StateManager](../interfaces/_lib_state_interface_.statemanager.md) +* [StorageDump](../interfaces/_lib_state_interface_.storagedump.md) diff --git a/packages/vm/docs/modules/_lib_state_statemanager_.md b/packages/vm/docs/modules/_lib_state_statemanager_.md new file mode 100644 index 0000000000..59a5891e53 --- /dev/null +++ b/packages/vm/docs/modules/_lib_state_statemanager_.md @@ -0,0 +1,13 @@ +[@ethereumjs/vm](../README.md) › ["lib/state/stateManager"](_lib_state_statemanager_.md) + +# Module: "lib/state/stateManager" + +## Index + +### Classes + +* [DefaultStateManager](../classes/_lib_state_statemanager_.defaultstatemanager.md) + +### Interfaces + +* [DefaultStateManagerOpts](../interfaces/_lib_state_statemanager_.defaultstatemanageropts.md) diff --git a/packages/vm/docs/modules/_runblock_.md b/packages/vm/docs/modules/_runblock_.md deleted file mode 100644 index baea18861d..0000000000 --- a/packages/vm/docs/modules/_runblock_.md +++ /dev/null @@ -1,12 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runBlock"](_runblock_.md) - -# Module: "runBlock" - -## Index - -### Interfaces - -* [PostByzantiumTxReceipt](../interfaces/_runblock_.postbyzantiumtxreceipt.md) -* [PreByzantiumTxReceipt](../interfaces/_runblock_.prebyzantiumtxreceipt.md) -* [RunBlockOpts](../interfaces/_runblock_.runblockopts.md) -* [RunBlockResult](../interfaces/_runblock_.runblockresult.md) diff --git a/packages/vm/docs/modules/_runblockchain_.md b/packages/vm/docs/modules/_runblockchain_.md deleted file mode 100644 index 3e9d881d15..0000000000 --- a/packages/vm/docs/modules/_runblockchain_.md +++ /dev/null @@ -1,5 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runBlockchain"](_runblockchain_.md) - -# Module: "runBlockchain" - - diff --git a/packages/vm/docs/modules/_runcall_.md b/packages/vm/docs/modules/_runcall_.md deleted file mode 100644 index 7eb933b0c5..0000000000 --- a/packages/vm/docs/modules/_runcall_.md +++ /dev/null @@ -1,9 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runCall"](_runcall_.md) - -# Module: "runCall" - -## Index - -### Interfaces - -* [RunCallOpts](../interfaces/_runcall_.runcallopts.md) diff --git a/packages/vm/docs/modules/_runcode_.md b/packages/vm/docs/modules/_runcode_.md deleted file mode 100644 index 58bdee2615..0000000000 --- a/packages/vm/docs/modules/_runcode_.md +++ /dev/null @@ -1,9 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runCode"](_runcode_.md) - -# Module: "runCode" - -## Index - -### Interfaces - -* [RunCodeOpts](../interfaces/_runcode_.runcodeopts.md) diff --git a/packages/vm/docs/modules/_runtx_.md b/packages/vm/docs/modules/_runtx_.md deleted file mode 100644 index 7a247e09b4..0000000000 --- a/packages/vm/docs/modules/_runtx_.md +++ /dev/null @@ -1,10 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["runTx"](_runtx_.md) - -# Module: "runTx" - -## Index - -### Interfaces - -* [RunTxOpts](../interfaces/_runtx_.runtxopts.md) -* [RunTxResult](../interfaces/_runtx_.runtxresult.md) diff --git a/packages/vm/docs/modules/_state_index_.md b/packages/vm/docs/modules/_state_index_.md deleted file mode 100644 index e539eb52ca..0000000000 --- a/packages/vm/docs/modules/_state_index_.md +++ /dev/null @@ -1,13 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["state/index"](_state_index_.md) - -# Module: "state/index" - -## Index - -### Classes - -* [DefaultStateManager](../classes/_state_index_.defaultstatemanager.md) - -### Interfaces - -* [StateManager](../interfaces/_state_index_.statemanager.md) diff --git a/packages/vm/docs/modules/_state_interface_.md b/packages/vm/docs/modules/_state_interface_.md deleted file mode 100644 index 7c50f46828..0000000000 --- a/packages/vm/docs/modules/_state_interface_.md +++ /dev/null @@ -1,10 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["state/interface"](_state_interface_.md) - -# Module: "state/interface" - -## Index - -### Interfaces - -* [StateManager](../interfaces/_state_interface_.statemanager.md) -* [StorageDump](../interfaces/_state_interface_.storagedump.md) diff --git a/packages/vm/docs/modules/_state_statemanager_.md b/packages/vm/docs/modules/_state_statemanager_.md deleted file mode 100644 index 9156c35c5f..0000000000 --- a/packages/vm/docs/modules/_state_statemanager_.md +++ /dev/null @@ -1,13 +0,0 @@ -[@ethereumjs/vm](../README.md) › ["state/stateManager"](_state_statemanager_.md) - -# Module: "state/stateManager" - -## Index - -### Classes - -* [DefaultStateManager](../classes/_state_statemanager_.defaultstatemanager.md) - -### Interfaces - -* [DefaultStateManagerOpts](../interfaces/_state_statemanager_.defaultstatemanageropts.md) diff --git a/packages/vm/docs/modules/_tests_api_berlin_eip_2315_spec_.md b/packages/vm/docs/modules/_tests_api_berlin_eip_2315_spec_.md new file mode 100644 index 0000000000..bbfc01a1d9 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_berlin_eip_2315_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/berlin/eip-2315.spec"](_tests_api_berlin_eip_2315_spec_.md) + +# Module: "tests/api/berlin/eip-2315.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_bloom_spec_.md b/packages/vm/docs/modules/_tests_api_bloom_spec_.md new file mode 100644 index 0000000000..706ca0e141 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_bloom_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/bloom.spec"](_tests_api_bloom_spec_.md) + +# Module: "tests/api/bloom.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_eips_eip_2537_bls_spec_.md b/packages/vm/docs/modules/_tests_api_eips_eip_2537_bls_spec_.md new file mode 100644 index 0000000000..8bc91ed03b --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_eips_eip_2537_bls_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/EIPs/eip-2537-BLS.spec"](_tests_api_eips_eip_2537_bls_spec_.md) + +# Module: "tests/api/EIPs/eip-2537-BLS.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_eips_eip_2929_spec_.md b/packages/vm/docs/modules/_tests_api_eips_eip_2929_spec_.md new file mode 100644 index 0000000000..5f14c82d7e --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_eips_eip_2929_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/EIPs/eip-2929.spec"](_tests_api_eips_eip_2929_spec_.md) + +# Module: "tests/api/EIPs/eip-2929.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_events_spec_.md b/packages/vm/docs/modules/_tests_api_events_spec_.md new file mode 100644 index 0000000000..3e4a4ef603 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_events_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/events.spec"](_tests_api_events_spec_.md) + +# Module: "tests/api/events.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_evm_eei_spec_.md b/packages/vm/docs/modules/_tests_api_evm_eei_spec_.md new file mode 100644 index 0000000000..7df8bc4504 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_evm_eei_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/evm/eei.spec"](_tests_api_evm_eei_spec_.md) + +# Module: "tests/api/evm/eei.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_evm_memory_spec_.md b/packages/vm/docs/modules/_tests_api_evm_memory_spec_.md new file mode 100644 index 0000000000..f3cd01c75d --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_evm_memory_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/evm/memory.spec"](_tests_api_evm_memory_spec_.md) + +# Module: "tests/api/evm/memory.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_evm_precompiles_06_ecadd_spec_.md b/packages/vm/docs/modules/_tests_api_evm_precompiles_06_ecadd_spec_.md new file mode 100644 index 0000000000..ca73d7fc3c --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_evm_precompiles_06_ecadd_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/evm/precompiles/06-ecadd.spec"](_tests_api_evm_precompiles_06_ecadd_spec_.md) + +# Module: "tests/api/evm/precompiles/06-ecadd.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_evm_precompiles_07_ecmul_spec_.md b/packages/vm/docs/modules/_tests_api_evm_precompiles_07_ecmul_spec_.md new file mode 100644 index 0000000000..02a78a9ccb --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_evm_precompiles_07_ecmul_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/evm/precompiles/07-ecmul.spec"](_tests_api_evm_precompiles_07_ecmul_spec_.md) + +# Module: "tests/api/evm/precompiles/07-ecmul.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_evm_precompiles_08_ecpairing_spec_.md b/packages/vm/docs/modules/_tests_api_evm_precompiles_08_ecpairing_spec_.md new file mode 100644 index 0000000000..7e373312fc --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_evm_precompiles_08_ecpairing_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/evm/precompiles/08-ecpairing.spec"](_tests_api_evm_precompiles_08_ecpairing_spec_.md) + +# Module: "tests/api/evm/precompiles/08-ecpairing.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_evm_precompiles_hardfork_spec_.md b/packages/vm/docs/modules/_tests_api_evm_precompiles_hardfork_spec_.md new file mode 100644 index 0000000000..9cb8e9e79b --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_evm_precompiles_hardfork_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/evm/precompiles/hardfork.spec"](_tests_api_evm_precompiles_hardfork_spec_.md) + +# Module: "tests/api/evm/precompiles/hardfork.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_evm_stack_spec_.md b/packages/vm/docs/modules/_tests_api_evm_stack_spec_.md new file mode 100644 index 0000000000..ae3dc494e4 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_evm_stack_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/evm/stack.spec"](_tests_api_evm_stack_spec_.md) + +# Module: "tests/api/evm/stack.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_index_spec_.md b/packages/vm/docs/modules/_tests_api_index_spec_.md new file mode 100644 index 0000000000..19ceb63a42 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_index_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/index.spec"](_tests_api_index_spec_.md) + +# Module: "tests/api/index.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_istanbul_eip_1108_spec_.md b/packages/vm/docs/modules/_tests_api_istanbul_eip_1108_spec_.md new file mode 100644 index 0000000000..740052dfe8 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_istanbul_eip_1108_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/istanbul/eip-1108.spec"](_tests_api_istanbul_eip_1108_spec_.md) + +# Module: "tests/api/istanbul/eip-1108.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_istanbul_eip_1344_spec_.md b/packages/vm/docs/modules/_tests_api_istanbul_eip_1344_spec_.md new file mode 100644 index 0000000000..458991fc4e --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_istanbul_eip_1344_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/istanbul/eip-1344.spec"](_tests_api_istanbul_eip_1344_spec_.md) + +# Module: "tests/api/istanbul/eip-1344.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_istanbul_eip_152_spec_.md b/packages/vm/docs/modules/_tests_api_istanbul_eip_152_spec_.md new file mode 100644 index 0000000000..cbe24d0761 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_istanbul_eip_152_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/istanbul/eip-152.spec"](_tests_api_istanbul_eip_152_spec_.md) + +# Module: "tests/api/istanbul/eip-152.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_istanbul_eip_1884_spec_.md b/packages/vm/docs/modules/_tests_api_istanbul_eip_1884_spec_.md new file mode 100644 index 0000000000..0eecbaaed6 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_istanbul_eip_1884_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/istanbul/eip-1884.spec"](_tests_api_istanbul_eip_1884_spec_.md) + +# Module: "tests/api/istanbul/eip-1884.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_istanbul_eip_2200_spec_.md b/packages/vm/docs/modules/_tests_api_istanbul_eip_2200_spec_.md new file mode 100644 index 0000000000..5ea347f3e7 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_istanbul_eip_2200_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/istanbul/eip-2200.spec"](_tests_api_istanbul_eip_2200_spec_.md) + +# Module: "tests/api/istanbul/eip-2200.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_muirglacier_index_spec_.md b/packages/vm/docs/modules/_tests_api_muirglacier_index_spec_.md new file mode 100644 index 0000000000..efb4f6aa3b --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_muirglacier_index_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/muirGlacier/index.spec"](_tests_api_muirglacier_index_spec_.md) + +# Module: "tests/api/muirGlacier/index.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_opcodes_spec_.md b/packages/vm/docs/modules/_tests_api_opcodes_spec_.md new file mode 100644 index 0000000000..539110287b --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_opcodes_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/opcodes.spec"](_tests_api_opcodes_spec_.md) + +# Module: "tests/api/opcodes.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_runblock_spec_.md b/packages/vm/docs/modules/_tests_api_runblock_spec_.md new file mode 100644 index 0000000000..1448256ab3 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_runblock_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/runBlock.spec"](_tests_api_runblock_spec_.md) + +# Module: "tests/api/runBlock.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_runblockchain_spec_.md b/packages/vm/docs/modules/_tests_api_runblockchain_spec_.md new file mode 100644 index 0000000000..76a4798403 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_runblockchain_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/runBlockchain.spec"](_tests_api_runblockchain_spec_.md) + +# Module: "tests/api/runBlockchain.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_runcall_spec_.md b/packages/vm/docs/modules/_tests_api_runcall_spec_.md new file mode 100644 index 0000000000..9f07edeea4 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_runcall_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/runCall.spec"](_tests_api_runcall_spec_.md) + +# Module: "tests/api/runCall.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_runcode_spec_.md b/packages/vm/docs/modules/_tests_api_runcode_spec_.md new file mode 100644 index 0000000000..5bbcee6f00 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_runcode_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/runCode.spec"](_tests_api_runcode_spec_.md) + +# Module: "tests/api/runCode.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_runtx_spec_.md b/packages/vm/docs/modules/_tests_api_runtx_spec_.md new file mode 100644 index 0000000000..65abad9d2f --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_runtx_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/runTx.spec"](_tests_api_runtx_spec_.md) + +# Module: "tests/api/runTx.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_state_cache_spec_.md b/packages/vm/docs/modules/_tests_api_state_cache_spec_.md new file mode 100644 index 0000000000..5fe528ea00 --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_state_cache_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/state/cache.spec"](_tests_api_state_cache_spec_.md) + +# Module: "tests/api/state/cache.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_state_statemanager_spec_.md b/packages/vm/docs/modules/_tests_api_state_statemanager_spec_.md new file mode 100644 index 0000000000..c2b9c4573d --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_state_statemanager_spec_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/state/stateManager.spec"](_tests_api_state_statemanager_spec_.md) + +# Module: "tests/api/state/stateManager.spec" + + diff --git a/packages/vm/docs/modules/_tests_api_utils_.md b/packages/vm/docs/modules/_tests_api_utils_.md new file mode 100644 index 0000000000..96dd83fadc --- /dev/null +++ b/packages/vm/docs/modules/_tests_api_utils_.md @@ -0,0 +1,43 @@ +[@ethereumjs/vm](../README.md) › ["tests/api/utils"](_tests_api_utils_.md) + +# Module: "tests/api/utils" + +## Index + +### Functions + +* [createAccount](_tests_api_utils_.md#createaccount) +* [setupVM](_tests_api_utils_.md#setupvm) + +## Functions + +### createAccount + +▸ **createAccount**(`nonce`: BN, `balance`: BN): *Account‹›* + +*Defined in [tests/api/utils.ts:8](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/api/utils.ts#L8)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`nonce` | BN | new BN(0) | +`balance` | BN | new BN(0xfff384) | + +**Returns:** *Account‹›* + +___ + +### setupVM + +▸ **setupVM**(`opts`: [VMOpts](../interfaces/_lib_index_.vmopts.md)): *[VM](../classes/_lib_index_.vm.md)‹›* + +*Defined in [tests/api/utils.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/api/utils.ts#L12)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`opts` | [VMOpts](../interfaces/_lib_index_.vmopts.md) | {} | + +**Returns:** *[VM](../classes/_lib_index_.vm.md)‹›* diff --git a/packages/vm/docs/modules/_tests_blockchaintestsrunner_.md b/packages/vm/docs/modules/_tests_blockchaintestsrunner_.md new file mode 100644 index 0000000000..0b1934e40c --- /dev/null +++ b/packages/vm/docs/modules/_tests_blockchaintestsrunner_.md @@ -0,0 +1,27 @@ +[@ethereumjs/vm](../README.md) › ["tests/BlockchainTestsRunner"](_tests_blockchaintestsrunner_.md) + +# Module: "tests/BlockchainTestsRunner" + +## Index + +### Functions + +* [runBlockchainTest](_tests_blockchaintestsrunner_.md#runblockchaintest) + +## Functions + +### runBlockchainTest + +▸ **runBlockchainTest**(`options`: any, `testData`: any, `t`: Test): *Promise‹void›* + +*Defined in [tests/BlockchainTestsRunner.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/BlockchainTestsRunner.ts#L11)* + +**Parameters:** + +Name | Type | +------ | ------ | +`options` | any | +`testData` | any | +`t` | Test | + +**Returns:** *Promise‹void›* diff --git a/packages/vm/docs/modules/_tests_config_.md b/packages/vm/docs/modules/_tests_config_.md new file mode 100644 index 0000000000..1c3f536f2c --- /dev/null +++ b/packages/vm/docs/modules/_tests_config_.md @@ -0,0 +1,231 @@ +[@ethereumjs/vm](../README.md) › ["tests/config"](_tests_config_.md) + +# Module: "tests/config" + +## Index + +### Variables + +* [DEFAULT_FORK_CONFIG](_tests_config_.md#const-default_fork_config) +* [SKIP_BROKEN](_tests_config_.md#const-skip_broken) +* [SKIP_PERMANENT](_tests_config_.md#const-skip_permanent) +* [SKIP_SLOW](_tests_config_.md#const-skip_slow) + +### Functions + +* [getCommon](_tests_config_.md#getcommon) +* [getExpectedTests](_tests_config_.md#getexpectedtests) +* [getRequiredForkConfigAlias](_tests_config_.md#getrequiredforkconfigalias) +* [getSkipTests](_tests_config_.md#getskiptests) +* [getTestDirs](_tests_config_.md#gettestdirs) + +## Variables + +### `Const` DEFAULT_FORK_CONFIG + +• **DEFAULT_FORK_CONFIG**: *"Istanbul"* = "Istanbul" + +*Defined in [tests/config.ts:6](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/config.ts#L6)* + +Default hardfork rules to run tests against + +___ + +### `Const` SKIP_BROKEN + +• **SKIP_BROKEN**: *string[]* = [ + 'ForkStressTest', // Only BlockchainTest, temporary till fixed (2020-05-23) + 'ChainAtoChainB', // Only BlockchainTest, temporary, along expectException fixes (2020-05-23) + 'sha3_bigOffset', // SHA3: Only BlockchainTest, unclear SHA3 test situation (2020-05-28) (https://github.com/ethereumjs/ethereumjs-vm/pull/743#issuecomment-635116418) + 'sha3_memSizeNoQuadraticCost', // SHA3: See also: + 'sha3_memSizeQuadraticCost', // SHA3: https://github.com/ethereumjs/ethereumjs-vm/pull/743#issuecomment-635116418 + 'sha3_bigSize', // SHA3 + + // these tests need "re-org" support in blockchain + 'blockChainFrontierWithLargerTDvsHomesteadBlockchain2_FrontierToHomesteadAt5', + 'blockChainFrontierWithLargerTDvsHomesteadBlockchain_FrontierToHomesteadAt5', + 'HomesteadOverrideFrontier_FrontierToHomesteadAt5', + 'DaoTransactions_HomesteadToDaoAt5', + 'RPC_API_Test', + 'lotsOfBranchesOverrideAtTheEnd', + 'lotsOfBranchesOverrideAtTheMiddle', + 'newChainFrom4Block', + 'newChainFrom5Block', + 'newChainFrom6Block', + 'sideChainWithMoreTransactions', + 'sideChainWithMoreTransactions2', + 'sideChainWithNewMaxDifficultyStartingFromBlock3AfterBlock4', + 'uncleBlockAtBlock3afterBlock4', +] + +*Defined in [tests/config.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/config.ts#L11)* + +Tests which should be fixed + +___ + +### `Const` SKIP_PERMANENT + +• **SKIP_PERMANENT**: *string[]* = [ + 'SuicidesMixingCoinbase', // sucides to the coinbase, since we run a blockLevel we create coinbase account. + 'static_SuicidesMixingCoinbase', // sucides to the coinbase, since we run a blockLevel we create coinbase account. + 'ForkUncle', // Only BlockchainTest, correct behaviour unspecified (?) + 'UncleFromSideChain', // Only BlockchainTest, same as ForkUncle, the TD is the same for two diffent branches so its not clear which one should be the finally chain +] + +*Defined in [tests/config.ts:39](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/config.ts#L39)* + +Tests skipped due to system specifics / design considerations + +___ + +### `Const` SKIP_SLOW + +• **SKIP_SLOW**: *string[]* = [ + 'Call50000', + 'Call50000_ecrec', + 'Call50000_identity', + 'Call50000_identity2', + 'Call50000_sha256', + 'Call50000_rip160', + 'Call50000bytesContract50_1', + 'Call50000bytesContract50_2', + 'Call1MB1024Calldepth', + 'static_Call1MB1024Calldepth', + 'static_Call50000', + 'static_Call50000_ecrec', + 'static_Call50000_identity', + 'static_Call50000_identity2', + 'static_Call50000_rip160', + 'static_Return50000_2', + 'Callcode50000', + 'Return50000', + 'Return50000_2', + 'static_Call50000', + 'static_Call50000_ecrec', + 'static_Call50000_identity', + 'static_Call50000_identity2', + 'static_Call50000_sha256', + 'static_Call50000_rip160', + 'static_Call50000bytesContract50_1', + 'static_Call50000bytesContract50_2', + 'static_Call1MB1024Calldepth', + 'static_Callcode50000', + 'static_Return50000', + 'static_Return50000_2', + 'QuadraticComplexitySolidity_CallDataCopy', + 'CALLBlake2f_MaxRounds', + 'randomStatetest94_Istanbul', + // vmPerformance tests + 'ackermann', + 'fibonacci', + 'loop-add-10M', + 'loop-divadd-10M', + 'loop-divadd-unr100-10M', + 'loop-exp', + 'loop-mul', + 'manyFunctions100', +] + +*Defined in [tests/config.ts:49](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/config.ts#L49)* + +tests running slow (run from time to time) + +## Functions + +### getCommon + +▸ **getCommon**(`network`: string): *Common‹›* + +*Defined in [tests/config.ts:256](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/config.ts#L256)* + +Returns a Common for the given network (a test parameter) + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`network` | string | the network field of a test | + +**Returns:** *Common‹›* + +the Common which should be used + +___ + +### getExpectedTests + +▸ **getExpectedTests**(`fork`: string, `name`: string): *any* + +*Defined in [tests/config.ts:377](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/config.ts#L377)* + +Returns the amount of expected tests for a given fork, assuming all tests are ran + +**Parameters:** + +Name | Type | +------ | ------ | +`fork` | string | +`name` | string | + +**Returns:** *any* + +___ + +### getRequiredForkConfigAlias + +▸ **getRequiredForkConfigAlias**(`forkConfig`: string): *string* + +*Defined in [tests/config.ts:137](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/config.ts#L137)* + +Returns an alias for specified hardforks to meet test dependencies requirements/assumptions. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`forkConfig` | string | the name of the hardfork for which an alias should be returned | + +**Returns:** *string* + +Either an alias of the forkConfig param, or the forkConfig param itself + +___ + +### getSkipTests + +▸ **getSkipTests**(`choices`: string, `defaultChoice`: string): *string[]* + +*Defined in [tests/config.ts:394](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/config.ts#L394)* + +Returns an aggregated array with the tests to skip + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`choices` | string | comma-separated list with skip options, e.g. BROKEN,PERMANENT | +`defaultChoice` | string | if to use `NONE` or `ALL` as default choice | + +**Returns:** *string[]* + +array with test names + +___ + +### getTestDirs + +▸ **getTestDirs**(`network`: string, `testType`: string): *string[]* + +*Defined in [tests/config.ts:238](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/config.ts#L238)* + +Returns an array of dirs to run tests on + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`network` | string | (fork identifier) | +`testType` | string | - | + +**Returns:** *string[]* diff --git a/packages/vm/docs/modules/_tests_generalstatetestsrunner_.md b/packages/vm/docs/modules/_tests_generalstatetestsrunner_.md new file mode 100644 index 0000000000..5873e76707 --- /dev/null +++ b/packages/vm/docs/modules/_tests_generalstatetestsrunner_.md @@ -0,0 +1,27 @@ +[@ethereumjs/vm](../README.md) › ["tests/GeneralStateTestsRunner"](_tests_generalstatetestsrunner_.md) + +# Module: "tests/GeneralStateTestsRunner" + +## Index + +### Functions + +* [runStateTest](_tests_generalstatetestsrunner_.md#runstatetest) + +## Functions + +### runStateTest + +▸ **runStateTest**(`options`: any, `testData`: any, `t`: Test): *Promise‹void›* + +*Defined in [tests/GeneralStateTestsRunner.ts:131](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/GeneralStateTestsRunner.ts#L131)* + +**Parameters:** + +Name | Type | +------ | ------ | +`options` | any | +`testData` | any | +`t` | Test | + +**Returns:** *Promise‹void›* diff --git a/packages/vm/docs/modules/_tests_tester_.md b/packages/vm/docs/modules/_tests_tester_.md new file mode 100644 index 0000000000..50d48293ac --- /dev/null +++ b/packages/vm/docs/modules/_tests_tester_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/tester"](_tests_tester_.md) + +# Module: "tests/tester" + + diff --git a/packages/vm/docs/modules/_tests_testloader_.md b/packages/vm/docs/modules/_tests_testloader_.md new file mode 100644 index 0000000000..53f7cf5614 --- /dev/null +++ b/packages/vm/docs/modules/_tests_testloader_.md @@ -0,0 +1,5 @@ +[@ethereumjs/vm](../README.md) › ["tests/testLoader"](_tests_testloader_.md) + +# Module: "tests/testLoader" + + diff --git a/packages/vm/docs/modules/_tests_util_.md b/packages/vm/docs/modules/_tests_util_.md new file mode 100644 index 0000000000..2c6bb5160f --- /dev/null +++ b/packages/vm/docs/modules/_tests_util_.md @@ -0,0 +1,247 @@ +[@ethereumjs/vm](../README.md) › ["tests/util"](_tests_util_.md) + +# Module: "tests/util" + +## Index + +### Functions + +* [dumpState](_tests_util_.md#dumpstate) +* [getDAOCommon](_tests_util_.md#getdaocommon) +* [getRequiredForkConfigAlias](_tests_util_.md#getrequiredforkconfigalias) +* [isRunningInKarma](_tests_util_.md#isrunninginkarma) +* [makeBlockFromEnv](_tests_util_.md#makeblockfromenv) +* [makeBlockHeader](_tests_util_.md#makeblockheader) +* [makeTx](_tests_util_.md#maketx) +* [setupPreConditions](_tests_util_.md#setuppreconditions) +* [verifyAccountPostConditions](_tests_util_.md#verifyaccountpostconditions) +* [verifyGas](_tests_util_.md#verifygas) +* [verifyLogs](_tests_util_.md#verifylogs) +* [verifyPostConditions](_tests_util_.md#verifypostconditions) + +## Functions + +### dumpState + +▸ **dumpState**(`state`: any, `cb`: Function): *void* + +*Defined in [tests/util.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L15)* + +**Parameters:** + +Name | Type | +------ | ------ | +`state` | any | +`cb` | Function | + +**Returns:** *void* + +___ + +### getDAOCommon + +▸ **getDAOCommon**(`activationBlock`: number): *Common‹›* + +*Defined in [tests/util.ts:366](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L366)* + +Returns a DAO common which has a different activation block than the default block + +**Parameters:** + +Name | Type | +------ | ------ | +`activationBlock` | number | + +**Returns:** *Common‹›* + +___ + +### getRequiredForkConfigAlias + +▸ **getRequiredForkConfigAlias**(`forkConfig`: string): *string* + +*Defined in [tests/util.ts:343](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L343)* + +Returns an alias for specified hardforks to meet test dependencies requirements/assumptions. + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`forkConfig` | string | the name of the hardfork for which an alias should be returned | + +**Returns:** *string* + +Either an alias of the forkConfig param, or the forkConfig param itself + +___ + +### isRunningInKarma + +▸ **isRunningInKarma**(): *any* + +*Defined in [tests/util.ts:359](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L359)* + +Checks if in a karma test runner. + +**Returns:** *any* + +is running in karma + +___ + +### makeBlockFromEnv + +▸ **makeBlockFromEnv**(`env`: any, `opts`: BlockOptions): *Block* + +*Defined in [tests/util.ts:288](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L288)* + +makeBlockFromEnv - helper to create a block from the env object in tests repo + +**Parameters:** + +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`env` | any | - | object from tests repo | +`opts` | BlockOptions | {} | - | + +**Returns:** *Block* + +the block + +___ + +### makeBlockHeader + +▸ **makeBlockHeader**(`data`: any, `opts`: BlockOptions): *BlockHeader‹›* + +*Defined in [tests/util.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L261)* + +**Parameters:** + +Name | Type | Default | +------ | ------ | ------ | +`data` | any | - | +`opts` | BlockOptions | {} | + +**Returns:** *BlockHeader‹›* + +___ + +### makeTx + +▸ **makeTx**(`txData`: any, `opts`: TxOptions): *Transaction‹›* + +*Defined in [tests/util.ts:101](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L101)* + +Make a tx using JSON from tests repo + +**Parameters:** + +Name | Type | Default | Description | +------ | ------ | ------ | ------ | +`txData` | any | - | The tx object from tests repo | +`opts` | TxOptions | {} | Tx opts that can include an @ethereumjs/common object | + +**Returns:** *Transaction‹›* + +Transaction to be passed to VM.runTx function + +___ + +### setupPreConditions + +▸ **setupPreConditions**(`state`: any, `testData`: any): *Promise‹void›* + +*Defined in [tests/util.ts:298](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L298)* + +setupPreConditions given JSON testData + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`state` | any | the state DB/trie | +`testData` | any | JSON from tests repo | + +**Returns:** *Promise‹void›* + +___ + +### verifyAccountPostConditions + +▸ **verifyAccountPostConditions**(`state`: any, `address`: string, `account`: Account, `acctData`: any, `t`: Test): *Promise‹unknown›* + +*Defined in [tests/util.ts:162](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L162)* + +verifyAccountPostConditions using JSON from tests repo + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`state` | any | DB/trie | +`address` | string | Account Address | +`account` | Account | to verify | +`acctData` | any | postconditions JSON from tests repo | +`t` | Test | - | + +**Returns:** *Promise‹unknown›* + +___ + +### verifyGas + +▸ **verifyGas**(`results`: any, `testData`: any, `t`: Test): *void* + +*Defined in [tests/util.ts:225](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L225)* + +verifyGas by computing the difference of coinbase account balance + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`results` | any | to verify | +`testData` | any | from tests repo | +`t` | Test | - | + +**Returns:** *void* + +___ + +### verifyLogs + +▸ **verifyLogs**(`logs`: any, `testData`: any, `t`: Test): *void* + +*Defined in [tests/util.ts:248](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L248)* + +verifyLogs + +**Parameters:** + +Name | Type | Description | +------ | ------ | ------ | +`logs` | any | to verify | +`testData` | any | from tests repo | +`t` | Test | - | + +**Returns:** *void* + +___ + +### verifyPostConditions + +▸ **verifyPostConditions**(`state`: any, `testData`: any, `t`: Test): *Promise‹unknown›* + +*Defined in [tests/util.ts:112](https://github.com/ethereumjs/ethereumjs-vm/blob/master/packages/vm/tests/util.ts#L112)* + +**Parameters:** + +Name | Type | +------ | ------ | +`state` | any | +`testData` | any | +`t` | Test | + +**Returns:** *Promise‹unknown›* diff --git a/packages/vm/package.json b/packages/vm/package.json index f45cdd795b..5e864d09ab 100644 --- a/packages/vm/package.json +++ b/packages/vm/package.json @@ -1,6 +1,6 @@ { "name": "@ethereumjs/vm", - "version": "4.1.3", + "version": "5.0.0-beta.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", - "@ethereumjs/blockchain": "^4.0.3", - "@ethereumjs/common": "^1.5.1", - "@ethereumjs/tx": "^2.1.2", + "@ethereumjs/block": "3.0.0-beta.1", + "@ethereumjs/blockchain": "5.0.0-beta.1", + "@ethereumjs/common": "2.0.0-beta.1", + "@ethereumjs/tx": "3.0.0-beta.1", "ethereumjs-util": "^7.0.7", "functional-red-black-tree": "^1.0.1", "merkle-patricia-tree": "^4.0.0",