From de4d57483aa4c5eb871577bec99c672c2beeb29b Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Fri, 24 May 2019 11:59:15 +0200 Subject: [PATCH 1/3] Generate docs via typedoc Rm existing generated docs Add typedoc configs Move typedoc annotations around Rm documentation dependency Include interpreter in docs Add docs Fix doc links in README.md --- README.md | 6 +- docs/developer.md => developer.md | 0 docs/README.md | 35 ++ docs/classes/statemanager.md | 664 +++++++++++++++++++++++++++ docs/classes/vm.md | 242 ++++++++++ docs/classes/vmerror.md | 62 +++ docs/enums/error.md | 124 +++++ docs/index.md | 294 ------------ docs/interfaces/execresult.md | 138 ++++++ docs/interfaces/interpreterresult.md | 58 +++ docs/interfaces/runblockcb.md | 30 ++ docs/interfaces/runblockopts.md | 68 +++ docs/interfaces/runblockresult.md | 44 ++ docs/interfaces/runcallcb.md | 30 ++ docs/interfaces/runcallopts.md | 182 ++++++++ docs/interfaces/runcodecb.md | 30 ++ docs/interfaces/runcodeopts.md | 208 +++++++++ docs/interfaces/runtxcb.md | 30 ++ docs/interfaces/runtxopts.md | 68 +++ docs/interfaces/runtxresult.md | 100 ++++ docs/interfaces/storagedump.md | 19 + docs/interfaces/txreceipt.md | 68 +++ docs/interfaces/vmopts.md | 106 +++++ docs/stateManager.md | 480 ------------------- lib/evm/interpreter.ts | 46 +- lib/index.ts | 68 ++- lib/runBlock.ts | 65 ++- lib/runBlockchain.ts | 5 +- lib/runCall.ts | 28 +- lib/runCode.ts | 67 +-- lib/runTx.ts | 54 ++- lib/state/cache.ts | 3 + lib/state/promisified.ts | 4 + lib/state/stateManager.ts | 3 + lib/state/storageReader.ts | 3 + package.json | 4 +- typedoc.json | 9 + 37 files changed, 2574 insertions(+), 871 deletions(-) rename docs/developer.md => developer.md (100%) create mode 100644 docs/README.md create mode 100644 docs/classes/statemanager.md create mode 100644 docs/classes/vm.md create mode 100644 docs/classes/vmerror.md create mode 100644 docs/enums/error.md delete mode 100644 docs/index.md create mode 100644 docs/interfaces/execresult.md create mode 100644 docs/interfaces/interpreterresult.md create mode 100644 docs/interfaces/runblockcb.md create mode 100644 docs/interfaces/runblockopts.md create mode 100644 docs/interfaces/runblockresult.md create mode 100644 docs/interfaces/runcallcb.md create mode 100644 docs/interfaces/runcallopts.md create mode 100644 docs/interfaces/runcodecb.md create mode 100644 docs/interfaces/runcodeopts.md create mode 100644 docs/interfaces/runtxcb.md create mode 100644 docs/interfaces/runtxopts.md create mode 100644 docs/interfaces/runtxresult.md create mode 100644 docs/interfaces/storagedump.md create mode 100644 docs/interfaces/txreceipt.md create mode 100644 docs/interfaces/vmopts.md delete mode 100644 docs/stateManager.md create mode 100644 typedoc.json diff --git a/README.md b/README.md index 6ac5afd071..ba3d57c3c3 100644 --- a/README.md +++ b/README.md @@ -57,11 +57,11 @@ To build for standalone use in the browser, install `browserify` and check [run- ## VM -For documentation on `VM` instantiation, exposed API and emitted `events` see generated [API docs](./docs/index.md). +For documentation on `VM` instantiation, exposed API and emitted `events` see generated [API docs](./docs/README.md). ## StateManger -The API for the `StateManager` is currently in `Beta`, separate documentation can be found [here](./docs/stateManager.md), see also [release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/v2.5.0) from the `v2.5.0` VM release for details on the `StateManager` rewrite. +The API for the `StateManager` is currently in `Beta`, separate documentation can be found [here](./docs/classes/statemanager.md), see also [release notes](https://github.com/ethereumjs/ethereumjs-vm/releases/tag/v2.5.0) from the `v2.5.0` VM release for details on the `StateManager` rewrite. # Internal Structure @@ -98,7 +98,7 @@ The opFns for `CREATE`, `CALL`, and `CALLCODE` call back up to `runCall`. # DEVELOPMENT -Developer documentation - currently mainly with information on testing and debugging - can be found [here](./docs/developer.md). +Developer documentation - currently mainly with information on testing and debugging - can be found [here](./developer.md). # EthereumJS diff --git a/docs/developer.md b/developer.md similarity index 100% rename from docs/developer.md rename to developer.md diff --git a/docs/README.md b/docs/README.md new file mode 100644 index 0000000000..93d7b52f70 --- /dev/null +++ b/docs/README.md @@ -0,0 +1,35 @@ + +# ethereumjs-vm + +## Index + +### Enumerations + +* [ERROR](enums/error.md) + +### Classes + +* [StateManager](classes/statemanager.md) +* [VM](classes/vm.md) +* [VmError](classes/vmerror.md) + +### Interfaces + +* [ExecResult](interfaces/execresult.md) +* [InterpreterResult](interfaces/interpreterresult.md) +* [RunBlockCb](interfaces/runblockcb.md) +* [RunBlockOpts](interfaces/runblockopts.md) +* [RunBlockResult](interfaces/runblockresult.md) +* [RunCallCb](interfaces/runcallcb.md) +* [RunCallOpts](interfaces/runcallopts.md) +* [RunCodeCb](interfaces/runcodecb.md) +* [RunCodeOpts](interfaces/runcodeopts.md) +* [RunTxCb](interfaces/runtxcb.md) +* [RunTxOpts](interfaces/runtxopts.md) +* [RunTxResult](interfaces/runtxresult.md) +* [StorageDump](interfaces/storagedump.md) +* [TxReceipt](interfaces/txreceipt.md) +* [VMOpts](interfaces/vmopts.md) + +--- + diff --git a/docs/classes/statemanager.md b/docs/classes/statemanager.md new file mode 100644 index 0000000000..8221cfcc59 --- /dev/null +++ b/docs/classes/statemanager.md @@ -0,0 +1,664 @@ +[ethereumjs-vm](../README.md) > [StateManager](../classes/statemanager.md) + +# Class: StateManager + +Interface for getting and setting data from an underlying state trie. + +## Hierarchy + +**StateManager** + +## Index + +### Constructors + +* [constructor](statemanager.md#constructor) + +### Properties + +* [_cache](statemanager.md#_cache) +* [_checkpointCount](statemanager.md#_checkpointcount) +* [_common](statemanager.md#_common) +* [_storageTries](statemanager.md#_storagetries) +* [_touched](statemanager.md#_touched) +* [_touchedStack](statemanager.md#_touchedstack) +* [_trie](statemanager.md#_trie) + +### Methods + +* [_getStorageTrie](statemanager.md#_getstoragetrie) +* [_lookupStorageTrie](statemanager.md#_lookupstoragetrie) +* [_modifyContractStorage](statemanager.md#_modifycontractstorage) +* [accountIsEmpty](statemanager.md#accountisempty) +* [checkpoint](statemanager.md#checkpoint) +* [cleanupTouchedAccounts](statemanager.md#cleanuptouchedaccounts) +* [clearContractStorage](statemanager.md#clearcontractstorage) +* [commit](statemanager.md#commit) +* [copy](statemanager.md#copy) +* [dumpStorage](statemanager.md#dumpstorage) +* [generateCanonicalGenesis](statemanager.md#generatecanonicalgenesis) +* [generateGenesis](statemanager.md#generategenesis) +* [getAccount](statemanager.md#getaccount) +* [getContractCode](statemanager.md#getcontractcode) +* [getContractStorage](statemanager.md#getcontractstorage) +* [getStateRoot](statemanager.md#getstateroot) +* [hasGenesisState](statemanager.md#hasgenesisstate) +* [putAccount](statemanager.md#putaccount) +* [putContractCode](statemanager.md#putcontractcode) +* [putContractStorage](statemanager.md#putcontractstorage) +* [revert](statemanager.md#revert) +* [setStateRoot](statemanager.md#setstateroot) + +--- + +## Constructors + + + +### constructor + +⊕ **new StateManager**(opts?: *`any`*): [StateManager](statemanager.md) + +*Defined in [state/stateManager.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L30)* + +Instantiate the StateManager interface. + +**Parameters:** + +| Name | Type | Default value | +| ------ | ------ | ------ | +| `Default value` opts | `any` | {} | + +**Returns:** [StateManager](statemanager.md) + +___ + +## Properties + + + +### _cache + +**● _cache**: *`Cache`* + +*Defined in [state/stateManager.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L27)* + +___ + + +### _checkpointCount + +**● _checkpointCount**: *`number`* + +*Defined in [state/stateManager.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L30)* + +___ + + +### _common + +**● _common**: *`Common`* + +*Defined in [state/stateManager.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L24)* + +___ + + +### _storageTries + +**● _storageTries**: *`any`* + +*Defined in [state/stateManager.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L26)* + +___ + + +### _touched + +**● _touched**: *`Set`<`string`>* + +*Defined in [state/stateManager.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L28)* + +___ + + +### _touchedStack + +**● _touchedStack**: *`Set`<`string`>[]* + +*Defined in [state/stateManager.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L29)* + +___ + + +### _trie + +**● _trie**: *`any`* + +*Defined in [state/stateManager.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L25)* + +___ + +## Methods + + + +### `` _getStorageTrie + +▸ **_getStorageTrie**(address: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:182](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L182)* + +Gets the storage trie for an account from the storage cache or does a lookup + +*__memberof__*: DefaultStateManager + +*__method__*: \_getStorageTrie + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | \- | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### `` _lookupStorageTrie + +▸ **_lookupStorageTrie**(address: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:160](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L160)* + +Creates a storage trie from the primary storage trie for an account and saves this in the storage cache. + +*__memberof__*: DefaultStateManager + +*__method__*: \_lookupStorageTrie + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | \- | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### `` _modifyContractStorage + +▸ **_modifyContractStorage**(address: *`Buffer`*, modifyTrie: *`any`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L232)* + +Modifies the storage trie of an account + +*__memberof__*: DefaultStateManager + +*__method__*: \_modifyContractStorage + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | Address of the account whose storage is to be modified | +| modifyTrie | `any` | function to modify the storage trie of the account | +| cb | `any` | + +**Returns:** `void` + +___ + + +### accountIsEmpty + +▸ **accountIsEmpty**(address: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:538](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L538)* + +Checks if the `account` corresponding to `address` is empty as defined in EIP-161 ([https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md)) + +*__memberof__*: StateManager + +*__method__*: accountIsEmpty + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | Address to check | +| cb | `any` | | + +**Returns:** `void` + +___ + + +### checkpoint + +▸ **checkpoint**(cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:304](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L304)* + +Checkpoints the current state of the StateManager instance. State changes that follow can then be committed by calling `commit` or `reverted` by calling rollback. + +*__memberof__*: StateManager + +*__method__*: checkpoint + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### cleanupTouchedAccounts + +▸ **cleanupTouchedAccounts**(cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:561](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L561)* + +Removes accounts form the state trie that have been touched, as defined in EIP-161 ([https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md)](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md)). + +*__memberof__*: StateManager + +*__method__*: cleanupTouchedAccounts + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### clearContractStorage + +▸ **clearContractStorage**(address: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:285](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L285)* + +Clears all storage entries for the account corresponding to `address` + +*__memberof__*: StateManager + +*__method__*: clearContractStorage + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | Address to clear the storage of | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### commit + +▸ **commit**(cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:319](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L319)* + +Commits the current change-set to the instance since the last call to checkpoint. + +*__memberof__*: StateManager + +*__method__*: commit + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### copy + +▸ **copy**(): [StateManager](statemanager.md) + +*Defined in [state/stateManager.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L60)* + +Copies the current instance of the `DefaultStateManager` at the last fully committed point, i.e. as if all current checkpoints were reverted + +*__memberof__*: DefaultStateManager + +*__method__*: copy + +**Returns:** [StateManager](statemanager.md) + +___ + + +### dumpStorage + +▸ **dumpStorage**(address: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:440](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L440)* + +Dumps the the storage values for an `account` specified by `address` + +*__memberof__*: DefaultStateManager + +*__method__*: dumpStorage + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | The address of the \`account\` to return storage for | +| cb | `any` | | + +**Returns:** `void` + +___ + + +### generateCanonicalGenesis + +▸ **generateCanonicalGenesis**(cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:484](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L484)* + +Generates a canonical genesis state on the instance based on the configured chain parameters. Will error if there are uncommitted checkpoints on the instance. + +*__memberof__*: StateManager + +*__method__*: generateCanonicalGenesis + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### generateGenesis + +▸ **generateGenesis**(initState: *`any`*, cb: *`any`*): `any` + +*Defined in [state/stateManager.ts:505](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L505)* + +Initializes the provided genesis state into the state trie + +*__memberof__*: DefaultStateManager + +*__method__*: generateGenesis + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| initState | `any` | \- | +| cb | `any` | Callback function | + +**Returns:** `any` + +___ + + +### getAccount + +▸ **getAccount**(address: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:80](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L80)* + +Gets the [`ethereumjs-account`](https://github.com/ethereumjs/ethereumjs-account) associated with `address`. Returns an empty account if the account does not exist. + +*__memberof__*: StateManager + +*__method__*: getAccount + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | Address of the \`account\` to get | +| cb | `any` | | + +**Returns:** `void` + +___ + + +### getContractCode + +▸ **getContractCode**(address: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:142](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L142)* + +Gets the code corresponding to the provided `address` + +*__memberof__*: StateManager + +*__method__*: getContractCode + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | Address to get the \`code\` for | +| cb | `any` | | + +**Returns:** `void` + +___ + + +### getContractStorage + +▸ **getContractStorage**(address: *`Buffer`*, key: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:209](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L209)* + +Gets the storage value associated with the provided `address` and `key` + +*__memberof__*: StateManager + +*__method__*: getContractStorage + +**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 | +| cb | `any` | | + +**Returns:** `void` + +___ + + +### getStateRoot + +▸ **getStateRoot**(cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:372](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L372)* + +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. + +*__memberof__*: StateManager + +*__method__*: getStateRoot + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| cb | `any` | | + +**Returns:** `void` + +___ + + +### hasGenesisState + +▸ **hasGenesisState**(cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:471](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L471)* + +Checks whether the current instance has the canonical genesis state for the configured chain parameters. + +*__memberof__*: DefaultStateManager + +*__method__*: hasGenesisState + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| cb | `any` | | + +**Returns:** `void` + +___ + + +### putAccount + +▸ **putAccount**(address: *`Buffer`*, account: *`Account`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:93](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L93)* + +Saves an [`ethereumjs-account`](https://github.com/ethereumjs/ethereumjs-account) into state under the provided `address` + +*__memberof__*: StateManager + +*__method__*: putAccount + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | Address under which to store \`account\` | +| account | `Account` | The [\`ethereumjs-account\`](https://github.com/ethereumjs/ethereumjs-account) to store | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### putContractCode + +▸ **putContractCode**(address: *`Buffer`*, value: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:112](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L112)* + +Adds `value` to the state trie as code, and sets `codeHash` on the account corresponding to `address` to reference this. + +*__memberof__*: StateManager + +*__method__*: putContractCode + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | Address of the \`account\` to add the \`code\` for | +| value | `Buffer` | The value of the \`code\` | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### putContractStorage + +▸ **putContractStorage**(address: *`Buffer`*, key: *`Buffer`*, value: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L261)* + +Adds value to the state trie for the `account` corresponding to `address` at the provided `key` + +*__memberof__*: StateManager + +*__method__*: putContractStorage + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| address | `Buffer` | Address to set a storage value for | +| key | `Buffer` | Key to set the value at | +| value | `Buffer` | Value to set at \`key\` for account corresponding to \`address\` | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### revert + +▸ **revert**(cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:339](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L339)* + +Reverts the current change-set to the instance since the last call to checkpoint. + +*__memberof__*: StateManager + +*__method__*: revert + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + + +### setStateRoot + +▸ **setStateRoot**(stateRoot: *`Buffer`*, cb: *`any`*): `void` + +*Defined in [state/stateManager.ts:396](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L396)* + +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. + +*__memberof__*: StateManager + +*__method__*: setStateRoot + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| stateRoot | `Buffer` | The state-root to reset the instance to | +| cb | `any` | Callback function | + +**Returns:** `void` + +___ + diff --git a/docs/classes/vm.md b/docs/classes/vm.md new file mode 100644 index 0000000000..83bae439cf --- /dev/null +++ b/docs/classes/vm.md @@ -0,0 +1,242 @@ +[ethereumjs-vm](../README.md) > [VM](../classes/vm.md) + +# Class: VM + +Execution engine which can be used to run a blockchain, individual blocks, individual transactions, or snippets of EVM bytecode. + +## Hierarchy + + `any` + +**↳ VM** + +## Index + +### Constructors + +* [constructor](vm.md#constructor) + +### Properties + +* [_common](vm.md#_common) +* [allowUnlimitedContractSize](vm.md#allowunlimitedcontractsize) +* [blockchain](vm.md#blockchain) +* [opts](vm.md#opts) +* [stateManager](vm.md#statemanager) + +### Methods + +* [_emit](vm.md#_emit) +* [copy](vm.md#copy) +* [runBlock](vm.md#runblock) +* [runBlockchain](vm.md#runblockchain) +* [runCall](vm.md#runcall) +* [runCode](vm.md#runcode) +* [runTx](vm.md#runtx) + +--- + +## Constructors + + + +### constructor + +⊕ **new VM**(opts?: *[VMOpts](../interfaces/vmopts.md)*): [VM](vm.md) + +*Defined in [index.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L59)* + +Instantiates a new [VM](vm.md) Object. + +**Parameters:** + +| Name | Type | Default value | Description | +| ------ | ------ | ------ | ------ | +| `Default value` opts | [VMOpts](../interfaces/vmopts.md) | {} | Default values for the options are:* \`chain\`: 'mainnet'* \`hardfork\`: 'petersburg' \[supported: 'byzantium', 'constantinople', 'petersburg' (will throw on unsupported)\]* \`activatePrecompiles\`: false* \`allowUnlimitedContractSize\`: false \[ONLY set to \`true\` during debugging\] | + +**Returns:** [VM](vm.md) + +___ + +## Properties + + + +### _common + +**● _common**: *`Common`* + +*Defined in [index.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L56)* + +___ + + +### allowUnlimitedContractSize + +**● allowUnlimitedContractSize**: *`boolean`* + +*Defined in [index.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L59)* + +___ + + +### blockchain + +**● blockchain**: *`any`* + +*Defined in [index.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L58)* + +___ + + +### opts + +**● opts**: *[VMOpts](../interfaces/vmopts.md)* + +*Defined in [index.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L55)* + +___ + + +### stateManager + +**● stateManager**: *[StateManager](statemanager.md)* + +*Defined in [index.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L57)* + +___ + +## Methods + + + +### _emit + +▸ **_emit**(topic: *`string`*, data: *`any`*): `Promise`<`any`> + +*Defined in [index.ts:147](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L147)* + +**Parameters:** + +| Name | Type | +| ------ | ------ | +| topic | `string` | +| data | `any` | + +**Returns:** `Promise`<`any`> + +___ + + +### copy + +▸ **copy**(): [VM](vm.md) + +*Defined in [index.ts:140](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L140)* + +Returns a copy of the [VM](vm.md) instance. + +**Returns:** [VM](vm.md) + +___ + + +### runBlock + +▸ **runBlock**(opts: *[RunBlockOpts](../interfaces/runblockopts.md)*, cb: *[RunBlockCb](../interfaces/runblockcb.md)*): `void` + +*Defined in [index.ts:112](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L112)* + +Processes the `block` running all of the transactions it contains and updating the miner's account + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| opts | [RunBlockOpts](../interfaces/runblockopts.md) | Default values for options:* \`generate\`: false @param cb - Callback function | +| cb | [RunBlockCb](../interfaces/runblockcb.md) | + +**Returns:** `void` + +___ + + +### runBlockchain + +▸ **runBlockchain**(blockchain: *`any`*, cb: *`any`*): `void` + +*Defined in [index.ts:102](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L102)* + +Processes blocks and adds them to the blockchain. + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| blockchain | `any` | A [blockchain](https://github.com/ethereum/ethereumjs-blockchain) object to process | +| cb | `any` | the callback function | + +**Returns:** `void` + +___ + + +### runCall + +▸ **runCall**(opts: *[RunCallOpts](../interfaces/runcallopts.md)*, cb: *[RunCallCb](../interfaces/runcallcb.md)*): `void` + +*Defined in [index.ts:126](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L126)* + +runs a call (or create) operation. + +**Parameters:** + +| Name | Type | +| ------ | ------ | +| opts | [RunCallOpts](../interfaces/runcallopts.md) | +| cb | [RunCallCb](../interfaces/runcallcb.md) | + +**Returns:** `void` + +___ + + +### runCode + +▸ **runCode**(opts: *[RunCodeOpts](../interfaces/runcodeopts.md)*, cb: *[RunCodeCb](../interfaces/runcodecb.md)*): `void` + +*Defined in [index.ts:133](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L133)* + +Runs EVM code. + +**Parameters:** + +| Name | Type | +| ------ | ------ | +| opts | [RunCodeOpts](../interfaces/runcodeopts.md) | +| cb | [RunCodeCb](../interfaces/runcodecb.md) | + +**Returns:** `void` + +___ + + +### runTx + +▸ **runTx**(opts: *[RunTxOpts](../interfaces/runtxopts.md)*, cb: *[RunTxCb](../interfaces/runtxcb.md)*): `void` + +*Defined in [index.ts:119](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L119)* + +Process a transaction. Run the vm. Transfers eth. Checks balances. + +**Parameters:** + +| Name | Type | +| ------ | ------ | +| opts | [RunTxOpts](../interfaces/runtxopts.md) | +| cb | [RunTxCb](../interfaces/runtxcb.md) | + +**Returns:** `void` + +___ + diff --git a/docs/classes/vmerror.md b/docs/classes/vmerror.md new file mode 100644 index 0000000000..ca9e58262e --- /dev/null +++ b/docs/classes/vmerror.md @@ -0,0 +1,62 @@ +[ethereumjs-vm](../README.md) > [VmError](../classes/vmerror.md) + +# Class: VmError + +## Hierarchy + +**VmError** + +## Index + +### Constructors + +* [constructor](vmerror.md#constructor) + +### Properties + +* [error](vmerror.md#error) +* [errorType](vmerror.md#errortype) + +--- + +## Constructors + + + +### constructor + +⊕ **new VmError**(error: *[ERROR](../enums/error.md)*): [VmError](vmerror.md) + +*Defined in [exceptions.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L17)* + +**Parameters:** + +| Name | Type | +| ------ | ------ | +| error | [ERROR](../enums/error.md) | + +**Returns:** [VmError](vmerror.md) + +___ + +## Properties + + + +### error + +**● error**: *[ERROR](../enums/error.md)* + +*Defined in [exceptions.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L16)* + +___ + + +### errorType + +**● errorType**: *`string`* + +*Defined in [exceptions.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L17)* + +___ + diff --git a/docs/enums/error.md b/docs/enums/error.md new file mode 100644 index 0000000000..4e1988060f --- /dev/null +++ b/docs/enums/error.md @@ -0,0 +1,124 @@ +[ethereumjs-vm](../README.md) > [ERROR](../enums/error.md) + +# Enumeration: ERROR + +## Index + +### Enumeration members + +* [CREATE_COLLISION](error.md#create_collision) +* [INTERNAL_ERROR](error.md#internal_error) +* [INVALID_JUMP](error.md#invalid_jump) +* [INVALID_OPCODE](error.md#invalid_opcode) +* [OUT_OF_GAS](error.md#out_of_gas) +* [OUT_OF_RANGE](error.md#out_of_range) +* [REVERT](error.md#revert) +* [STACK_OVERFLOW](error.md#stack_overflow) +* [STACK_UNDERFLOW](error.md#stack_underflow) +* [STATIC_STATE_CHANGE](error.md#static_state_change) +* [STOP](error.md#stop) + +--- + +## Enumeration members + + + +### CREATE_COLLISION + +**CREATE_COLLISION**: = "create collision" + +*Defined in [exceptions.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L11)* + +___ + + +### INTERNAL_ERROR + +**INTERNAL_ERROR**: = "internal error" + +*Defined in [exceptions.ts:10](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L10)* + +___ + + +### INVALID_JUMP + +**INVALID_JUMP**: = "invalid JUMP" + +*Defined in [exceptions.ts:5](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L5)* + +___ + + +### INVALID_OPCODE + +**INVALID_OPCODE**: = "invalid opcode" + +*Defined in [exceptions.ts:6](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L6)* + +___ + + +### OUT_OF_GAS + +**OUT_OF_GAS**: = "out of gas" + +*Defined in [exceptions.ts:2](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/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/06d36f3/lib/exceptions.ts#L7)* + +___ + + +### REVERT + +**REVERT**: = "revert" + +*Defined in [exceptions.ts:8](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L8)* + +___ + + +### STACK_OVERFLOW + +**STACK_OVERFLOW**: = "stack overflow" + +*Defined in [exceptions.ts:4](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L4)* + +___ + + +### STACK_UNDERFLOW + +**STACK_UNDERFLOW**: = "stack underflow" + +*Defined in [exceptions.ts:3](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/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/06d36f3/lib/exceptions.ts#L9)* + +___ + + +### STOP + +**STOP**: = "stop" + +*Defined in [exceptions.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L12)* + +___ + diff --git a/docs/index.md b/docs/index.md deleted file mode 100644 index 40b6fd541f..0000000000 --- a/docs/index.md +++ /dev/null @@ -1,294 +0,0 @@ - - -### Table of Contents - -- [vm.runBlockchain][1] - - [Parameters][2] -- [vm.runBlock][3] - - [Parameters][4] -- [runBlock~callback][5] - - [Parameters][6] -- [runTx~callback][7] - - [Parameters][8] -- [vm.runTx][9] - - [Parameters][10] -- [VM][11] - - [Parameters][12] -- [vm.runCode][13] - - [Parameters][14] -- [runCode~callback][15] - - [Parameters][16] -- [Event: beforeBlock][17] - - [Properties][18] -- [Event: afterBlock][19] - - [Properties][20] -- [Event: beforeTx][21] - - [Properties][22] -- [Event: afterTx][23] - - [Properties][24] -- [Event: step][25] - - [Properties][26] - -## vm.runBlockchain - -Processes blocks and adds them to the blockchain - -### Parameters - -- `blockchain` **Blockchain** A [blockchain][27] that to process -- `cb` **[Function][28]** the callback function - -## vm.runBlock - -Processes the `block` running all of the transactions it contains and updating the miner's account - -### Parameters - -- `opts` - - `opts.block` **Block** the [`Block`][29] to process - - `opts.generate` **[Boolean][30]** [gen=false] whether to generate the stateRoot, if false `runBlock` will check the stateRoot of the block against the Trie -- `cb` **[runBlock~callback][31]** callback - -## runBlock~callback - -Callback for `runBlock` method - -Type: [Function][28] - -### Parameters - -- `error` **[Error][32]** an error that may have happened or `null` -- `results` **[Object][33]** - - `results.receipts` **[Array][34]** the receipts from the transactions in the block - - `results.results` **[Array][34]** - -## runTx~callback - -Callback for `runTx` method - -Type: [Function][28] - -### Parameters - -- `error` **[Error][32]** an error that may have happened or `null` -- `results` **[Object][33]** - - `results.amountSpent` **BN** the amount of ether used by this transaction as a `bignum` - - `results.gasUsed` **BN** the amount of gas as a `bignum` used by the transaction - - `results.gasRefund` **BN** the amount of gas as a `bignum` that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) -- `vm` **[VM][35]** contains the results from running the code, if any, as described in `vm.runCode(params, cb)` - -## vm.runTx - -Process a transaction. Run the vm. Transfers eth. Checks balances. - -### Parameters - -- `opts` - - `opts.tx` **Transaction** a [`Transaction`][36] to run - - `opts.skipNonce` **[Boolean][30]** skips the nonce check - - `opts.skipBalance` **[Boolean][30]** skips the balance check - - `opts.block` **Block** the block to which the `tx` belongs, if no block is given a default one is created -- `cb` **[runTx~callback][37]** the callback - -## VM - -VM Class, `new VM(opts)` creates a new VM object - -### Parameters - -- `opts` **[Object][33]** - - `opts.stateManager` **StateManager** a [`StateManager`][38] instance to use as the state store (Beta API) - - `opts.state` **Trie** a merkle-patricia-tree instance for the state tree (ignored if stateManager is passed) - - `opts.blockchain` **Blockchain** a blockchain object for storing/retrieving blocks (ignored if stateManager is passed) - - `opts.chain` **([String][39] \| [Number][40])** the chain the VM operates on [default: 'mainnet'] - - `opts.hardfork` **[String][39]** hardfork rules to be used [default: 'petersburg', supported: 'byzantium', 'constantinople', 'petersburg' (will throw on unsupported)] - - `opts.activatePrecompiles` **[Boolean][30]** create entries in the state tree for the precompiled contracts - - `opts.allowUnlimitedContractSize` **[Boolean][30]** allows unlimited contract sizes while debugging. By setting this to `true`, the check for contract size limit of 24KB (see [EIP-170][41]) is bypassed. (default: `false`; ONLY set to `true` during debugging) - - `opts.emitFreeLogs` **[Boolean][30]** Changes the behavior of the LOG opcode, the gas cost of the opcode becomes zero and calling it using STATICCALL won't throw. (default: `false`; ONLY set to `true` during debugging) - -## vm.runCode - -Runs EVM code - -### Parameters - -- `opts` **[Object][33]** - - `opts.account` **Account** the [`Account`][42] that the executing code belongs to. If omitted an empty account will be used - - `opts.address` **[Buffer][43]** the address of the account that is executing this code. The address should be a `Buffer` of bytes. Defaults to `0` - - `opts.block` **Block** the [`Block`][29] the `tx` belongs to. If omitted a blank block will be used - - `opts.caller` **[Buffer][43]** the address that ran this code. The address should be a `Buffer` of 20bits. Defaults to `0` - - `opts.code` **[Buffer][43]** the EVM code to run given as a `Buffer` - - `opts.data` **[Buffer][43]** the input data - - `opts.gasLimit` **[Buffer][43]** the gas limit for the code - - `opts.origin` **[Buffer][43]** the address where the call originated from. The address should be a `Buffer` of 20bits. Defaults to `0` - - `opts.value` **[Buffer][43]** the value in ether that is being sent to `opt.address`. Defaults to `0` - - `opts.pc` **[Number][40]** the initial program counter. Defaults to `0` -- `cb` **[runCode~callback][44]** callback - -## runCode~callback - -Callback for `runCode` method - -Type: [Function][28] - -### Parameters - -- `error` **[Error][32]** an error that may have happened or `null` -- `results` **[Object][33]** - - `results.gas` **BN** the amount of gas left - - `results.gasUsed` **BN** the amount of gas as a `bignum` the code used to run - - `results.gasRefund` **BN** a `bignum` containing the amount of gas to refund from deleting storage values - - `results.selfdestruct` **[Object][33]** an `Object` with keys for accounts that have selfdestructed and values for balance transfer recipient accounts - - `results.logs` **[Array][34]** an `Array` of logs that the contract emitted - - `results.exception` **[Number][40]** `0` if the contract encountered an exception, `1` otherwise - - `results.exceptionError` **[String][39]** a `String` describing the exception if there was one - - `results.return` **[Buffer][43]** a `Buffer` containing the value that was returned by the contract - -## Event: beforeBlock - -The `beforeBlock` event - -Type: [Object][33] - -### Properties - -- `block` **Block** emits the block that is about to be processed - -## Event: afterBlock - -The `afterBlock` event - -Type: [Object][33] - -### Properties - -- `result` **[Object][33]** emits the results of processing a block - -## Event: beforeTx - -The `beforeTx` event - -Type: [Object][33] - -### Properties - -- `tx` **Transaction** emits the Transaction that is about to be processed - -## Event: afterTx - -The `afterTx` event - -Type: [Object][33] - -### Properties - -- `result` **[Object][33]** result of the transaction - -## Event: step - -The `step` event for trace output - -Type: [Object][33] - -### Properties - -- `pc` **[Number][40]** representing the program counter -- `opcode` **[String][39]** the next opcode to be ran -- `gasLeft` **BN** amount of gasLeft -- `stack` **[Array][34]** an `Array` of `Buffers` containing the stack -- `account` **Account** the [`Account`][45] which owns the code running -- `address` **[Buffer][43]** the address of the `account` -- `depth` **[Number][40]** the current number of calls deep the contract is -- `memory` **[Buffer][43]** the memory of the VM as a `buffer` -- `memoryWordCount` **BN** current size of memory in words -- `stateManager` **StateManager** a [`StateManager`][38] instance (Beta API) - -[1]: #vmrunblockchain - -[2]: #parameters - -[3]: #vmrunblock - -[4]: #parameters-1 - -[5]: #runblockcallback - -[6]: #parameters-2 - -[7]: #runtxcallback - -[8]: #parameters-3 - -[9]: #vmruntx - -[10]: #parameters-4 - -[11]: #vm - -[12]: #parameters-5 - -[13]: #vmruncode - -[14]: #parameters-6 - -[15]: #runcodecallback - -[16]: #parameters-7 - -[17]: #event-beforeblock - -[18]: #properties - -[19]: #event-afterblock - -[20]: #properties-1 - -[21]: #event-beforetx - -[22]: #properties-2 - -[23]: #event-aftertx - -[24]: #properties-3 - -[25]: #event-step - -[26]: #properties-4 - -[27]: https://github.com/ethereum/ethereumjs-blockchain - -[28]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function - -[29]: https://github.com/ethereumjs/ethereumjs-block - -[30]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean - -[31]: #runblockcallback - -[32]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error - -[33]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object - -[34]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array - -[35]: #vm - -[36]: https://github.com/ethereum/ethereumjs-tx - -[37]: #runtxcallback - -[38]: stateManager.md - -[39]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/String - -[40]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Number - -[41]: https://git.io/vxZkK - -[42]: https://github.com/ethereumjs/ethereumjs-account - -[43]: https://nodejs.org/api/buffer.html - -[44]: #runcodecallback - -[45]: https://github.com/ethereum/ethereumjs-account diff --git a/docs/interfaces/execresult.md b/docs/interfaces/execresult.md new file mode 100644 index 0000000000..0b5562e724 --- /dev/null +++ b/docs/interfaces/execresult.md @@ -0,0 +1,138 @@ +[ethereumjs-vm](../README.md) > [ExecResult](../interfaces/execresult.md) + +# Interface: ExecResult + +Result of executing a call via the \[\[Interpreter\]\]. + +## Hierarchy + +**ExecResult** + +## Index + +### Properties + +* [exception](execresult.md#exception) +* [exceptionError](execresult.md#exceptionerror) +* [gas](execresult.md#gas) +* [gasRefund](execresult.md#gasrefund) +* [gasUsed](execresult.md#gasused) +* [logs](execresult.md#logs) +* [return](execresult.md#return) +* [returnValue](execresult.md#returnvalue) +* [runState](execresult.md#runstate) +* [selfdestruct](execresult.md#selfdestruct) + +--- + +## Properties + + + +### exception + +**● exception**: *`IsException`* + +*Defined in [evm/interpreter.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L48)* + +`0` if the contract encountered an exception, `1` otherwise + +___ + + +### `` exceptionError + +**● exceptionError**: *[VmError](../classes/vmerror.md) \| [ERROR](../enums/error.md)* + +*Defined in [evm/interpreter.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L52)* + +Description of the exception, if any occured + +___ + + +### `` gas + +**● gas**: *`BN`* + +*Defined in [evm/interpreter.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L56)* + +Amount of gas left + +___ + + +### `` gasRefund + +**● gasRefund**: *`BN`* + +*Defined in [evm/interpreter.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L76)* + +Amount of gas to refund from deleting storage values + +___ + + +### gasUsed + +**● gasUsed**: *`BN`* + +*Defined in [evm/interpreter.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L60)* + +Amount of gas the code used to run + +___ + + +### `` logs + +**● logs**: *`any`[]* + +*Defined in [evm/interpreter.ts:68](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L68)* + +Array of logs that the contract emitted + +___ + + +### return + +**● return**: *`Buffer`* + +*Defined in [evm/interpreter.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L64)* + +Return value from the contract + +___ + + +### `` returnValue + +**● returnValue**: *`Buffer`* + +*Defined in [evm/interpreter.ts:72](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L72)* + +Value returned by the contract + +___ + + +### `` runState + +**● runState**: *`RunState`* + +*Defined in [evm/interpreter.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L44)* + +___ + + +### `` selfdestruct + +**● selfdestruct**: *`undefined` \| `object`* + +*Defined in [evm/interpreter.ts:80](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L80)* + +A set of accounts that have self-destructed + +___ + diff --git a/docs/interfaces/interpreterresult.md b/docs/interfaces/interpreterresult.md new file mode 100644 index 0000000000..b84268567a --- /dev/null +++ b/docs/interfaces/interpreterresult.md @@ -0,0 +1,58 @@ +[ethereumjs-vm](../README.md) > [InterpreterResult](../interfaces/interpreterresult.md) + +# Interface: InterpreterResult + +Result of executing a message via the \[\[Interpreter\]\]. + +## Hierarchy + +**InterpreterResult** + +↳ [RunTxResult](runtxresult.md) + +## Index + +### Properties + +* [createdAddress](interpreterresult.md#createdaddress) +* [gasUsed](interpreterresult.md#gasused) +* [vm](interpreterresult.md#vm) + +--- + +## Properties + + + +### `` createdAddress + +**● createdAddress**: *`Buffer`* + +*Defined in [evm/interpreter.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L33)* + +Address of created account durint transaction, if any + +___ + + +### gasUsed + +**● gasUsed**: *`BN`* + +*Defined in [evm/interpreter.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L29)* + +Amount of gas used by the transaction + +___ + + +### vm + +**● vm**: *[ExecResult](execresult.md)* + +*Defined in [evm/interpreter.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L37)* + +Contains the results from running the code, if any, as described in [runCode](../classes/vm.md#runcode) + +___ + diff --git a/docs/interfaces/runblockcb.md b/docs/interfaces/runblockcb.md new file mode 100644 index 0000000000..c6daef6e29 --- /dev/null +++ b/docs/interfaces/runblockcb.md @@ -0,0 +1,30 @@ +[ethereumjs-vm](../README.md) > [RunBlockCb](../interfaces/runblockcb.md) + +# Interface: RunBlockCb + +Callback function for [runBlock](../classes/vm.md#runblock) + +## Hierarchy + +**RunBlockCb** + +## Callable +▸ **__call**(err: *`Error` \| `null`*, result: *[RunBlockResult](runblockresult.md) \| `null`*): `void` + +*Defined in [runBlock.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L37)* + +Callback function for [runBlock](../classes/vm.md#runblock) + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| err | `Error` \| `null` | Any error that happened during execution, or \`null\` | +| result | [RunBlockResult](runblockresult.md) \| `null` | Result of execution, \`null\` in case of error | + +**Returns:** `void` + +## Index + +--- + diff --git a/docs/interfaces/runblockopts.md b/docs/interfaces/runblockopts.md new file mode 100644 index 0000000000..7e577d366d --- /dev/null +++ b/docs/interfaces/runblockopts.md @@ -0,0 +1,68 @@ +[ethereumjs-vm](../README.md) > [RunBlockOpts](../interfaces/runblockopts.md) + +# Interface: RunBlockOpts + +Options for running a block. + +## Hierarchy + +**RunBlockOpts** + +## Index + +### Properties + +* [block](runblockopts.md#block) +* [generate](runblockopts.md#generate) +* [root](runblockopts.md#root) +* [skipBlockValidation](runblockopts.md#skipblockvalidation) + +--- + +## Properties + + + +### block + +**● block**: *`any`* + +*Defined in [runBlock.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L18)* + +The [`Block`](https://github.com/ethereumjs/ethereumjs-block) to process + +___ + + +### `` generate + +**● generate**: *`undefined` \| `false` \| `true`* + +*Defined in [runBlock.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L27)* + +Whether to generate the stateRoot. If false `runBlock` will check the stateRoot of the block against the Trie + +___ + + +### `` root + +**● root**: *`Buffer`* + +*Defined in [runBlock.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L22)* + +Root of the state trie + +___ + + +### `` skipBlockValidation + +**● skipBlockValidation**: *`undefined` \| `false` \| `true`* + +*Defined in [runBlock.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L31)* + +If true, will skip block validation + +___ + diff --git a/docs/interfaces/runblockresult.md b/docs/interfaces/runblockresult.md new file mode 100644 index 0000000000..e6134170f8 --- /dev/null +++ b/docs/interfaces/runblockresult.md @@ -0,0 +1,44 @@ +[ethereumjs-vm](../README.md) > [RunBlockResult](../interfaces/runblockresult.md) + +# Interface: RunBlockResult + +Result of [runBlock](../classes/vm.md#runblock) + +## Hierarchy + +**RunBlockResult** + +## Index + +### Properties + +* [receipts](runblockresult.md#receipts) +* [results](runblockresult.md#results) + +--- + +## Properties + + + +### receipts + +**● receipts**: *[TxReceipt](txreceipt.md)[]* + +*Defined in [runBlock.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L52)* + +Receipts generated for transactions in the block + +___ + + +### results + +**● results**: *[RunTxResult](runtxresult.md)[]* + +*Defined in [runBlock.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L56)* + +Results of executing the transactions in the block + +___ + diff --git a/docs/interfaces/runcallcb.md b/docs/interfaces/runcallcb.md new file mode 100644 index 0000000000..cd07fc79c5 --- /dev/null +++ b/docs/interfaces/runcallcb.md @@ -0,0 +1,30 @@ +[ethereumjs-vm](../README.md) > [RunCallCb](../interfaces/runcallcb.md) + +# Interface: RunCallCb + +Callback for the [runCall](../classes/vm.md#runcall) method. + +## Hierarchy + +**RunCallCb** + +## Callable +▸ **__call**(err: *`Error` \| `null`*, results: *[InterpreterResult](interpreterresult.md) \| `null`*): `void` + +*Defined in [runCall.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L38)* + +Callback for the [runCall](../classes/vm.md#runcall) method. + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| err | `Error` \| `null` | +| results | [InterpreterResult](interpreterresult.md) \| `null` | Results of call, or \`null\` if an error occured | + +**Returns:** `void` + +## Index + +--- + diff --git a/docs/interfaces/runcallopts.md b/docs/interfaces/runcallopts.md new file mode 100644 index 0000000000..90409ab0dd --- /dev/null +++ b/docs/interfaces/runcallopts.md @@ -0,0 +1,182 @@ +[ethereumjs-vm](../README.md) > [RunCallOpts](../interfaces/runcallopts.md) + +# Interface: RunCallOpts + +Options for running a call (or create) operation + +## Hierarchy + +**RunCallOpts** + +## Index + +### Properties + +* [block](runcallopts.md#block) +* [caller](runcallopts.md#caller) +* [code](runcallopts.md#code) +* [compiled](runcallopts.md#compiled) +* [data](runcallopts.md#data) +* [delegatecall](runcallopts.md#delegatecall) +* [depth](runcallopts.md#depth) +* [gasLimit](runcallopts.md#gaslimit) +* [gasPrice](runcallopts.md#gasprice) +* [origin](runcallopts.md#origin) +* [salt](runcallopts.md#salt) +* [selfdestruct](runcallopts.md#selfdestruct) +* [static](runcallopts.md#static) +* [storageReader](runcallopts.md#storagereader) +* [to](runcallopts.md#to) +* [value](runcallopts.md#value) + +--- + +## Properties + + + +### `` block + +**● block**: *`any`* + +*Defined in [runCall.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L14)* + +___ + + +### `` caller + +**● caller**: *`Buffer`* + +*Defined in [runCall.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L18)* + +___ + + +### `` code + +**● code**: *`Buffer`* + +*Defined in [runCall.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L26)* + +This is for CALLCODE where the code to load is different than the code from the to account + +___ + + +### `` compiled + +**● compiled**: *`undefined` \| `false` \| `true`* + +*Defined in [runCall.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L28)* + +___ + + +### `` data + +**● data**: *`Buffer`* + +*Defined in [runCall.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L22)* + +___ + + +### `` delegatecall + +**● delegatecall**: *`undefined` \| `false` \| `true`* + +*Defined in [runCall.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L32)* + +___ + + +### `` depth + +**● depth**: *`undefined` \| `number`* + +*Defined in [runCall.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L27)* + +___ + + +### `` gasLimit + +**● gasLimit**: *`Buffer`* + +*Defined in [runCall.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L19)* + +___ + + +### `` gasPrice + +**● gasPrice**: *`Buffer`* + +*Defined in [runCall.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L16)* + +___ + + +### `` origin + +**● origin**: *`Buffer`* + +*Defined in [runCall.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L17)* + +___ + + +### `` salt + +**● salt**: *`Buffer`* + +*Defined in [runCall.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L30)* + +___ + + +### `` selfdestruct + +**● selfdestruct**: *`undefined` \| `object`* + +*Defined in [runCall.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L31)* + +___ + + +### `` static + +**● static**: *`undefined` \| `false` \| `true`* + +*Defined in [runCall.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L29)* + +___ + + +### `` storageReader + +**● storageReader**: *`StorageReader`* + +*Defined in [runCall.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L15)* + +___ + + +### `` to + +**● to**: *`Buffer`* + +*Defined in [runCall.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L20)* + +___ + + +### `` value + +**● value**: *`Buffer`* + +*Defined in [runCall.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L21)* + +___ + diff --git a/docs/interfaces/runcodecb.md b/docs/interfaces/runcodecb.md new file mode 100644 index 0000000000..2409bcab85 --- /dev/null +++ b/docs/interfaces/runcodecb.md @@ -0,0 +1,30 @@ +[ethereumjs-vm](../README.md) > [RunCodeCb](../interfaces/runcodecb.md) + +# Interface: RunCodeCb + +Callback for `runCode` method + +## Hierarchy + +**RunCodeCb** + +## Callable +▸ **__call**(err: *`Error` \| `null`*, res: *[ExecResult](execresult.md) \| `null`*): `void` + +*Defined in [runCode.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L75)* + +Callback for `runCode` method + +**Parameters:** + +| Name | Type | +| ------ | ------ | +| err | `Error` \| `null` | +| res | [ExecResult](execresult.md) \| `null` | + +**Returns:** `void` + +## Index + +--- + diff --git a/docs/interfaces/runcodeopts.md b/docs/interfaces/runcodeopts.md new file mode 100644 index 0000000000..2b04240d13 --- /dev/null +++ b/docs/interfaces/runcodeopts.md @@ -0,0 +1,208 @@ +[ethereumjs-vm](../README.md) > [RunCodeOpts](../interfaces/runcodeopts.md) + +# Interface: RunCodeOpts + +Options for the [runCode](../classes/vm.md#runcode) method. + +## Hierarchy + +**RunCodeOpts** + +## Index + +### Properties + +* [address](runcodeopts.md#address) +* [block](runcodeopts.md#block) +* [caller](runcodeopts.md#caller) +* [code](runcodeopts.md#code) +* [data](runcodeopts.md#data) +* [depth](runcodeopts.md#depth) +* [gasLimit](runcodeopts.md#gaslimit) +* [gasPrice](runcodeopts.md#gasprice) +* [interpreter](runcodeopts.md#interpreter) +* [isStatic](runcodeopts.md#isstatic) +* [message](runcodeopts.md#message) +* [origin](runcodeopts.md#origin) +* [pc](runcodeopts.md#pc) +* [selfdestruct](runcodeopts.md#selfdestruct) +* [storageReader](runcodeopts.md#storagereader) +* [txContext](runcodeopts.md#txcontext) +* [value](runcodeopts.md#value) + +--- + +## Properties + + + +### `` address + +**● address**: *`Buffer`* + +*Defined in [runCode.ts:65](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L65)* + +The address of the account that is executing this code. The address should be a `Buffer` of bytes. Defaults to `0` + +___ + + +### `` block + +**● block**: *`any`* + +*Defined in [runCode.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L29)* + +The [`Block`](https://github.com/ethereumjs/ethereumjs-block) the `tx` belongs to. If omitted a blank block will be used + +___ + + +### `` caller + +**● caller**: *`Buffer`* + +*Defined in [runCode.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L42)* + +The address that ran this code. The address should be a `Buffer` of 20bits. Defaults to `0` + +___ + + +### `` code + +**● code**: *`Buffer`* + +*Defined in [runCode.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L46)* + +The EVM code to run + +___ + + +### `` data + +**● data**: *`Buffer`* + +*Defined in [runCode.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L50)* + +The input data + +___ + + +### `` depth + +**● depth**: *`undefined` \| `number`* + +*Defined in [runCode.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L59)* + +___ + + +### `` gasLimit + +**● gasLimit**: *`Buffer`* + +*Defined in [runCode.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L54)* + +Gas limit + +___ + + +### `` gasPrice + +**● gasPrice**: *`Buffer`* + +*Defined in [runCode.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L33)* + +___ + + +### `` interpreter + +**● interpreter**: *`Interpreter`* + +*Defined in [runCode.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L31)* + +___ + + +### `` isStatic + +**● isStatic**: *`undefined` \| `false` \| `true`* + +*Defined in [runCode.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L60)* + +___ + + +### `` message + +**● message**: *`Message`* + +*Defined in [runCode.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L38)* + +___ + + +### `` origin + +**● origin**: *`Buffer`* + +*Defined in [runCode.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L37)* + +The address where the call originated from. The address should be a `Buffer` of 20bits. Defaults to `0` + +___ + + +### `` pc + +**● pc**: *`undefined` \| `number`* + +*Defined in [runCode.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L69)* + +The initial program counter. Defaults to `0` + +___ + + +### `` selfdestruct + +**● selfdestruct**: *`undefined` \| `object`* + +*Defined in [runCode.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L61)* + +___ + + +### `` storageReader + +**● storageReader**: *`StorageReader`* + +*Defined in [runCode.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L30)* + +___ + + +### `` txContext + +**● txContext**: *`TxContext`* + +*Defined in [runCode.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L32)* + +___ + + +### `` value + +**● value**: *`Buffer`* + +*Defined in [runCode.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L58)* + +The value in ether that is being sent to `opt.address`. Defaults to `0` + +___ + diff --git a/docs/interfaces/runtxcb.md b/docs/interfaces/runtxcb.md new file mode 100644 index 0000000000..774f3e8a50 --- /dev/null +++ b/docs/interfaces/runtxcb.md @@ -0,0 +1,30 @@ +[ethereumjs-vm](../README.md) > [RunTxCb](../interfaces/runtxcb.md) + +# Interface: RunTxCb + +Callback for `runTx` method + +## Hierarchy + +**RunTxCb** + +## Callable +▸ **__call**(err: *`Error` \| `null`*, results: *[RunTxResult](runtxresult.md) \| `null`*): `void` + +*Defined in [runTx.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L38)* + +Callback for `runTx` method + +**Parameters:** + +| Name | Type | Description | +| ------ | ------ | ------ | +| err | `Error` \| `null` | +| results | [RunTxResult](runtxresult.md) \| `null` | Results of the execution | + +**Returns:** `void` + +## Index + +--- + diff --git a/docs/interfaces/runtxopts.md b/docs/interfaces/runtxopts.md new file mode 100644 index 0000000000..9815426335 --- /dev/null +++ b/docs/interfaces/runtxopts.md @@ -0,0 +1,68 @@ +[ethereumjs-vm](../README.md) > [RunTxOpts](../interfaces/runtxopts.md) + +# Interface: RunTxOpts + +Options for the `runTx` method. + +## Hierarchy + +**RunTxOpts** + +## Index + +### Properties + +* [block](runtxopts.md#block) +* [skipBalance](runtxopts.md#skipbalance) +* [skipNonce](runtxopts.md#skipnonce) +* [tx](runtxopts.md#tx) + +--- + +## Properties + + + +### `` block + +**● block**: *`any`* + +*Defined in [runTx.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L20)* + +The block to which the `tx` belongs + +___ + + +### `` skipBalance + +**● skipBalance**: *`undefined` \| `false` \| `true`* + +*Defined in [runTx.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L32)* + +If true, skips the balance check + +___ + + +### `` skipNonce + +**● skipNonce**: *`undefined` \| `false` \| `true`* + +*Defined in [runTx.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L28)* + +If true, skips the nonce check + +___ + + +### tx + +**● tx**: *`any`* + +*Defined in [runTx.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L24)* + +A [`Transaction`](https://github.com/ethereum/ethereumjs-tx) to run + +___ + diff --git a/docs/interfaces/runtxresult.md b/docs/interfaces/runtxresult.md new file mode 100644 index 0000000000..8638f433b4 --- /dev/null +++ b/docs/interfaces/runtxresult.md @@ -0,0 +1,100 @@ +[ethereumjs-vm](../README.md) > [RunTxResult](../interfaces/runtxresult.md) + +# Interface: RunTxResult + +Execution result of a transaction + +## Hierarchy + + [InterpreterResult](interpreterresult.md) + +**↳ RunTxResult** + +## Index + +### Properties + +* [amountSpent](runtxresult.md#amountspent) +* [bloom](runtxresult.md#bloom) +* [createdAddress](runtxresult.md#createdaddress) +* [gasRefund](runtxresult.md#gasrefund) +* [gasUsed](runtxresult.md#gasused) +* [vm](runtxresult.md#vm) + +--- + +## Properties + + + +### amountSpent + +**● amountSpent**: *`BN`* + +*Defined in [runTx.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L57)* + +The amount of ether used by this transaction + +___ + + +### bloom + +**● bloom**: *`Bloom`* + +*Defined in [runTx.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L53)* + +Bloom filter resulted from transaction + +___ + + +### `` createdAddress + +**● createdAddress**: *`Buffer`* + +*Inherited from [InterpreterResult](interpreterresult.md).[createdAddress](interpreterresult.md#createdaddress)* + +*Defined in [evm/interpreter.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L33)* + +Address of created account durint transaction, if any + +___ + + +### `` gasRefund + +**● gasRefund**: *`BN`* + +*Defined in [runTx.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L61)* + +The amount of gas as that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) + +___ + + +### gasUsed + +**● gasUsed**: *`BN`* + +*Inherited from [InterpreterResult](interpreterresult.md).[gasUsed](interpreterresult.md#gasused)* + +*Defined in [evm/interpreter.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L29)* + +Amount of gas used by the transaction + +___ + + +### vm + +**● vm**: *[ExecResult](execresult.md)* + +*Inherited from [InterpreterResult](interpreterresult.md).[vm](interpreterresult.md#vm)* + +*Defined in [evm/interpreter.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L37)* + +Contains the results from running the code, if any, as described in [runCode](../classes/vm.md#runcode) + +___ + diff --git a/docs/interfaces/storagedump.md b/docs/interfaces/storagedump.md new file mode 100644 index 0000000000..6daad2c42c --- /dev/null +++ b/docs/interfaces/storagedump.md @@ -0,0 +1,19 @@ +[ethereumjs-vm](../README.md) > [StorageDump](../interfaces/storagedump.md) + +# Interface: StorageDump + +Storage values of an account + +## Hierarchy + +**StorageDump** + +## Indexable + +\[key: `string`\]: `string` +Storage values of an account + +## Index + +--- + diff --git a/docs/interfaces/txreceipt.md b/docs/interfaces/txreceipt.md new file mode 100644 index 0000000000..a944ba8e0c --- /dev/null +++ b/docs/interfaces/txreceipt.md @@ -0,0 +1,68 @@ +[ethereumjs-vm](../README.md) > [TxReceipt](../interfaces/txreceipt.md) + +# Interface: TxReceipt + +Receipt generated for a transaction + +## Hierarchy + +**TxReceipt** + +## Index + +### Properties + +* [bitvector](txreceipt.md#bitvector) +* [gasUsed](txreceipt.md#gasused) +* [logs](txreceipt.md#logs) +* [status](txreceipt.md#status) + +--- + +## Properties + + + +### bitvector + +**● bitvector**: *`Buffer`* + +*Defined in [runBlock.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L74)* + +Bloom bitvector + +___ + + +### gasUsed + +**● gasUsed**: *`Buffer`* + +*Defined in [runBlock.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L70)* + +Gas used + +___ + + +### logs + +**● logs**: *`any`[]* + +*Defined in [runBlock.ts:78](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L78)* + +Logs emitted + +___ + + +### status + +**● status**: *`0` \| `1`* + +*Defined in [runBlock.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L66)* + +Status of transaction, `0` if successful, `1` if an exception occured + +___ + diff --git a/docs/interfaces/vmopts.md b/docs/interfaces/vmopts.md new file mode 100644 index 0000000000..6786f4a203 --- /dev/null +++ b/docs/interfaces/vmopts.md @@ -0,0 +1,106 @@ +[ethereumjs-vm](../README.md) > [VMOpts](../interfaces/vmopts.md) + +# Interface: VMOpts + +Options for instantiating a [VM](../classes/vm.md). + +## Hierarchy + +**VMOpts** + +## Index + +### Properties + +* [activatePrecompiles](vmopts.md#activateprecompiles) +* [allowUnlimitedContractSize](vmopts.md#allowunlimitedcontractsize) +* [blockchain](vmopts.md#blockchain) +* [chain](vmopts.md#chain) +* [hardfork](vmopts.md#hardfork) +* [state](vmopts.md#state) +* [stateManager](vmopts.md#statemanager) + +--- + +## Properties + + + +### `` activatePrecompiles + +**● activatePrecompiles**: *`undefined` \| `false` \| `true`* + +*Defined in [index.ts:43](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L43)* + +If true, create entries in the state tree for the precompiled contracts + +___ + + +### `` allowUnlimitedContractSize + +**● allowUnlimitedContractSize**: *`undefined` \| `false` \| `true`* + +*Defined in [index.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L47)* + +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 + +___ + + +### `` blockchain + +**● blockchain**: *`any`* + +*Defined in [index.ts:39](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L39)* + +A [blockchain](https://github.com/ethereumjs/ethereumjs-blockchain) object for storing/retrieving blocks + +___ + + +### `` chain + +**● chain**: *`undefined` \| `string`* + +*Defined in [index.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L22)* + +The chain the VM operates on + +___ + + +### `` hardfork + +**● hardfork**: *`undefined` \| `string`* + +*Defined in [index.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L26)* + +Hardfork rules to be used + +___ + + +### `` state + +**● state**: *`any`* + +*Defined in [index.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L35)* + +A [merkle-patricia-tree](https://github.com/ethereumjs/merkle-patricia-tree) instance for the state tree (ignored if stateManager is passed) + +*__deprecated__*: + +___ + + +### `` stateManager + +**● stateManager**: *[StateManager](../classes/statemanager.md)* + +*Defined in [index.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L30)* + +A [StateManager](../classes/statemanager.md) instance to use as the state store (Beta API) + +___ + diff --git a/docs/stateManager.md b/docs/stateManager.md deleted file mode 100644 index beaa6e19d8..0000000000 --- a/docs/stateManager.md +++ /dev/null @@ -1,480 +0,0 @@ - - -### Table of Contents - -- [StateManager][1] - - [getAccount][2] - - [Parameters][3] - - [putAccount][4] - - [Parameters][5] - - [putContractCode][6] - - [Parameters][7] - - [getContractCode][8] - - [Parameters][9] - - [getContractStorage][10] - - [Parameters][11] - - [putContractStorage][12] - - [Parameters][13] - - [clearContractStorage][14] - - [Parameters][15] - - [checkpoint][16] - - [Parameters][17] - - [commit][18] - - [Parameters][19] - - [revert][20] - - [Parameters][21] - - [getStateRoot][22] - - [Parameters][23] - - [setStateRoot][24] - - [Parameters][25] - - [generateCanonicalGenesis][26] - - [Parameters][27] - - [accountIsEmpty][28] - - [Parameters][29] - - [cleanupTouchedAccounts][30] - - [Parameters][31] -- [DefaultStateManager][32] - - [Parameters][33] - - [copy][34] - - [dumpStorage][35] - - [Parameters][36] - - [hasGenesisState][37] - - [Parameters][38] - - [generateGenesis][39] - - [Parameters][40] -- [getAccount~callback][41] - - [Parameters][42] -- [getContractCode~callback][43] - - [Parameters][44] -- [getContractStorage~callback][45] - - [Parameters][46] -- [getStateRoot~callback][47] - - [Parameters][48] -- [dumpStorage~callback][49] - - [Parameters][50] -- [hasGenesisState~callback][51] - - [Parameters][52] -- [accountIsEmpty~callback][53] - - [Parameters][54] - -## StateManager - -Interface for getting and setting data from an underlying -state trie - -### getAccount - -Gets the [`ethereumjs-account`][55] -associated with `address`. Returns an empty account if the account does not exist. - -#### Parameters - -- `address` **[Buffer][56]** Address of the `account` to get -- `cb` **[getAccount~callback][57]** - -### putAccount - -Saves an [`ethereumjs-account`][55] -into state under the provided `address` - -#### Parameters - -- `address` **[Buffer][56]** Address under which to store `account` -- `account` **Account** The [`ethereumjs-account`][55] to store -- `cb` **[Function][58]** Callback function - -### putContractCode - -Adds `value` to the state trie as code, and sets `codeHash` on the account -corresponding to `address` to reference this. - -#### Parameters - -- `address` **[Buffer][56]** Address of the `account` to add the `code` for -- `value` **[Buffer][56]** The value of the `code` -- `cb` **[Function][58]** Callback function - -### getContractCode - -Gets the code corresponding to the provided `address` - -#### Parameters - -- `address` **[Buffer][56]** Address to get the `code` for -- `cb` **[getContractCode~callback][59]** - -### getContractStorage - -Gets the storage value associated with the provided `address` and `key` - -#### Parameters - -- `address` **[Buffer][56]** Address of the account to get the storage for -- `key` **[Buffer][56]** Key in the account's storage to get the value for -- `cb` **[getContractCode~callback][59]** - -### putContractStorage - -Adds value to the state trie for the `account` -corresponding to `address` at the provided `key` - -#### Parameters - -- `address` **[Buffer][56]** Address to set a storage value for -- `key` **[Buffer][56]** Key to set the value at -- `value` **[Buffer][56]** Value to set at `key` for account corresponding to `address` -- `cb` **[Function][58]** Callback function - -### clearContractStorage - -Clears all storage entries for the account corresponding to `address` - -#### Parameters - -- `address` **[Buffer][56]** Address to clear the storage of -- `cb` **[Function][58]** Callback function - -### checkpoint - -Checkpoints the current state of the StateManager instance. -State changes that follow can then be committed by calling -`commit` or `reverted` by calling rollback. - -#### Parameters - -- `cb` **[Function][58]** Callback function - -### commit - -Commits the current change-set to the instance since the -last call to checkpoint. - -#### Parameters - -- `cb` **[Function][58]** Callback function - -### revert - -Reverts the current change-set to the instance since the -last call to checkpoint. - -#### Parameters - -- `cb` **[Function][58]** Callback function - -### getStateRoot - -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 - -- `cb` **[getStateRoot~callback][60]** - -### setStateRoot - -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 - -- `stateRoot` **[Buffer][56]** The state-root to reset the instance to -- `cb` **[Function][58]** Callback function - -### generateCanonicalGenesis - -Generates a canonical genesis state on the instance based on the -configured chain parameters. Will error if there are uncommitted -checkpoints on the instance. - -#### Parameters - -- `cb` **[Function][58]** Callback function - -### accountIsEmpty - -Checks if the `account` corresponding to `address` is empty as defined in -EIP-161 ([https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md][61]) - -#### Parameters - -- `address` **[Buffer][56]** Address to check -- `cb` **[accountIsEmpty~callback][62]** - -### cleanupTouchedAccounts - -Removes accounts form the state trie that have been touched, -as defined in EIP-161 ([https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md][61]). - -#### Parameters - -- `cb` **[Function][58]** Callback function - -## DefaultStateManager - -Default implementation of the `StateManager` interface - -### Parameters - -- `opts` **[Object][63]** (optional, default `{}`) - - `opts.common` **Common?** [`Common`][64] parameters of the chain - - `opts.trie` **Trie?** a [`merkle-patricia-tree`][65] instance - -### copy - -Copies the current instance of the `DefaultStateManager` -at the last fully committed point, i.e. as if all current -checkpoints were reverted - -### dumpStorage - -Dumps the the storage values for an `account` specified by `address` - -#### Parameters - -- `address` **[Buffer][56]** The address of the `account` to return storage for -- `cb` **[dumpStorage~callback][66]** - -### hasGenesisState - -Checks whether the current instance has the canonical genesis state -for the configured chain parameters. - -#### Parameters - -- `cb` **[hasGenesisState~callback][67]** - -### generateGenesis - -Initializes the provided genesis state into the state trie - -#### Parameters - -- `initState` **[Object][63]** -- `cb` **[Function][58]** Callback function - -## getAccount~callback - -Callback for `getAccount` method - -Type: [Function][58] - -### Parameters - -- `error` **[Error][68]** an error that may have happened or `null` -- `account` **Account** An [`ethereumjs-account`][55] - instance corresponding to the provided `address` - -## getContractCode~callback - -Callback for `getContractCode` method - -Type: [Function][58] - -### Parameters - -- `error` **[Error][68]** an error that may have happened or `null` -- `code` **[Buffer][56]** The code corresponding to the provided address. - Returns an empty `Buffer` if the account has no associated code. - -## getContractStorage~callback - -Callback for `getContractStorage` method - -Type: [Function][58] - -### Parameters - -- `error` **[Error][68]** an error that may have happened or `null` -- `storageValue` **[Buffer][56]** The storage value for the account - corresponding to the provided address at the provided key. - If this does not exists an empty `Buffer` is returned - -## getStateRoot~callback - -Callback for `getStateRoot` method - -Type: [Function][58] - -### Parameters - -- `error` **[Error][68]** an error that may have happened or `null`. - Will be an error if the un-committed checkpoints on the instance. -- `stateRoot` **[Buffer][56]** The state-root of the `StateManager` - -## dumpStorage~callback - -Callback for `dumpStorage` method - -Type: [Function][58] - -### Parameters - -- `error` **[Error][68]** an error that may have happened or `null` -- `accountState` **[Object][63]** 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. - -## hasGenesisState~callback - -Callback for `hasGenesisState` method - -Type: [Function][58] - -### Parameters - -- `error` **[Error][68]** an error that may have happened or `null` -- `hasGenesisState` **[Boolean][69]** Whether the storage trie contains the - canonical genesis state for the configured chain parameters. - -## accountIsEmpty~callback - -Callback for `accountIsEmpty` method - -Type: [Function][58] - -### Parameters - -- `error` **[Error][68]** an error that may have happened or `null` -- `empty` **[Boolean][69]** True if the account is empty false otherwise - -[1]: #statemanager - -[2]: #getaccount - -[3]: #parameters - -[4]: #putaccount - -[5]: #parameters-1 - -[6]: #putcontractcode - -[7]: #parameters-2 - -[8]: #getcontractcode - -[9]: #parameters-3 - -[10]: #getcontractstorage - -[11]: #parameters-4 - -[12]: #putcontractstorage - -[13]: #parameters-5 - -[14]: #clearcontractstorage - -[15]: #parameters-6 - -[16]: #checkpoint - -[17]: #parameters-7 - -[18]: #commit - -[19]: #parameters-8 - -[20]: #revert - -[21]: #parameters-9 - -[22]: #getstateroot - -[23]: #parameters-10 - -[24]: #setstateroot - -[25]: #parameters-11 - -[26]: #generatecanonicalgenesis - -[27]: #parameters-12 - -[28]: #accountisempty - -[29]: #parameters-13 - -[30]: #cleanuptouchedaccounts - -[31]: #parameters-14 - -[32]: #defaultstatemanager - -[33]: #parameters-15 - -[34]: #copy - -[35]: #dumpstorage - -[36]: #parameters-16 - -[37]: #hasgenesisstate - -[38]: #parameters-17 - -[39]: #generategenesis - -[40]: #parameters-18 - -[41]: #getaccountcallback - -[42]: #parameters-19 - -[43]: #getcontractcodecallback - -[44]: #parameters-20 - -[45]: #getcontractstoragecallback - -[46]: #parameters-21 - -[47]: #getstaterootcallback - -[48]: #parameters-22 - -[49]: #dumpstoragecallback - -[50]: #parameters-23 - -[51]: #hasgenesisstatecallback - -[52]: #parameters-24 - -[53]: #accountisemptycallback - -[54]: #parameters-25 - -[55]: https://github.com/ethereumjs/ethereumjs-account - -[56]: https://nodejs.org/api/buffer.html - -[57]: #getaccountcallback - -[58]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Statements/function - -[59]: #getcontractcodecallback - -[60]: #getstaterootcallback - -[61]: https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md - -[62]: #accountisemptycallback - -[63]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Object - -[64]: https://github.com/ethereumjs/ethereumjs-common - -[65]: https://github.com/ethereumjs/merkle-patricia-tree - -[66]: #dumpstoragecallback - -[67]: #hasgenesisstatecallback - -[68]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Error - -[69]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Boolean diff --git a/lib/evm/interpreter.ts b/lib/evm/interpreter.ts index 2785c0aad1..bc0addc8c7 100644 --- a/lib/evm/interpreter.ts +++ b/lib/evm/interpreter.ts @@ -19,26 +19,70 @@ import EEI from './eei' import { default as Loop, LoopResult, RunState, IsException, RunOpts } from './loop' const Block = require('ethereumjs-block') +/** + * Result of executing a message via the [[Interpreter]]. + */ export interface InterpreterResult { + /** + * Amount of gas used by the transaction + */ gasUsed: BN + /** + * Address of created account durint transaction, if any + */ createdAddress?: Buffer + /** + * Contains the results from running the code, if any, as described in [[runCode]] + */ vm: ExecResult } +/** + * Result of executing a call via the [[Interpreter]]. + */ export interface ExecResult { runState?: RunState + /** + * `0` if the contract encountered an exception, `1` otherwise + */ exception: IsException + /** + * Description of the exception, if any occured + */ exceptionError?: VmError | ERROR + /** + * Amount of gas left + */ gas?: BN + /** + * Amount of gas the code used to run + */ gasUsed: BN + /** + * Return value from the contract + */ return: Buffer - // From RunResult + /** + * Array of logs that the contract emitted + */ logs?: any[] + /** + * Value returned by the contract + */ returnValue?: Buffer + /** + * Amount of gas to refund from deleting storage values + */ gasRefund?: BN + /** + * A set of accounts that have self-destructed + */ selfdestruct?: { [k: string]: Buffer } } +/** + * @ignore + */ export default class Interpreter { _vm: any _state: PStateManager diff --git a/lib/index.ts b/lib/index.ts index afb926864a..740f89d65d 100644 --- a/lib/index.ts +++ b/lib/index.ts @@ -12,27 +12,44 @@ const AsyncEventEmitter = require('async-eventemitter') const Blockchain = require('ethereumjs-blockchain') const Trie = require('merkle-patricia-tree/secure.js') +/** + * Options for instantiating a [[VM]]. + */ export interface VMOpts { + /** + * The chain the VM operates on + */ chain?: string + /** + * Hardfork rules to be used + */ hardfork?: string + /** + * A [[StateManager]] instance to use as the state store (Beta API) + */ stateManager?: StateManager + /** + * A [merkle-patricia-tree](https://github.com/ethereumjs/merkle-patricia-tree) instance for the state tree (ignored if stateManager is passed) + * @deprecated + */ state?: any // TODO + /** + * A [blockchain](https://github.com/ethereumjs/ethereumjs-blockchain) object for storing/retrieving blocks + */ blockchain?: any // TODO + /** + * If true, create entries in the state tree for the precompiled contracts + */ activatePrecompiles?: boolean + /** + * 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 + */ allowUnlimitedContractSize?: boolean } /** - * VM Class, `new VM(opts)` creates a new VM object - * @method VM - * @param {Object} opts - * @param {StateManager} opts.stateManager a [`StateManager`](stateManager.md) instance to use as the state store (Beta API) - * @param {Trie} opts.state a merkle-patricia-tree instance for the state tree (ignored if stateManager is passed) - * @param {Blockchain} opts.blockchain a blockchain object for storing/retrieving blocks (ignored if stateManager is passed) - * @param {String|Number} opts.chain the chain the VM operates on [default: 'mainnet'] - * @param {String} opts.hardfork hardfork rules to be used [default: 'petersburg', supported: 'byzantium', 'constantinople', 'petersburg' (will throw on unsupported)] - * @param {Boolean} opts.activatePrecompiles create entries in the state tree for the precompiled contracts - * @param {Boolean} opts.allowUnlimitedContractSize 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) + * Execution engine which can be used to run a blockchain, individual + * blocks, individual transactions, or snippets of EVM bytecode. */ export default class VM extends AsyncEventEmitter { opts: VMOpts @@ -41,6 +58,14 @@ export default class VM extends AsyncEventEmitter { blockchain: any allowUnlimitedContractSize: boolean + /** + * Instantiates a new [[VM]] Object. + * @param opts - Default values for the options are: + * - `chain`: 'mainnet' + * - `hardfork`: 'petersburg' [supported: 'byzantium', 'constantinople', 'petersburg' (will throw on unsupported)] + * - `activatePrecompiles`: false + * - `allowUnlimitedContractSize`: false [ONLY set to `true` during debugging] + */ constructor(opts: VMOpts = {}) { super() @@ -69,26 +94,49 @@ export default class VM extends AsyncEventEmitter { opts.allowUnlimitedContractSize === undefined ? false : opts.allowUnlimitedContractSize } + /** + * Processes blocks and adds them to the blockchain. + * @param blockchain - A [blockchain](https://github.com/ethereum/ethereumjs-blockchain) object to process + * @param cb - the callback function + */ runBlockchain(blockchain: any, cb: any): void { runBlockchain.bind(this)(blockchain, cb) } + /** + * Processes the `block` running all of the transactions it contains and updating the miner's account + * @param opts - Default values for options: + * - `generate`: false + * @param cb - Callback function + */ runBlock(opts: RunBlockOpts, cb: RunBlockCb): void { runBlock.bind(this)(opts, cb) } + /** + * Process a transaction. Run the vm. Transfers eth. Checks balances. + */ runTx(opts: RunTxOpts, cb: RunTxCb): void { runTx.bind(this)(opts, cb) } + /** + * runs a call (or create) operation. + */ runCall(opts: RunCallOpts, cb: RunCallCb): void { runCall.bind(this)(opts, cb) } + /** + * Runs EVM code. + */ runCode(opts: RunCodeOpts, cb: RunCodeCb): void { runCode.bind(this)(opts, cb) } + /** + * Returns a copy of the [[VM]] instance. + */ copy(): VM { return new VM({ stateManager: this.stateManager.copy(), diff --git a/lib/runBlock.ts b/lib/runBlock.ts index c186e68fc9..16d6276e58 100644 --- a/lib/runBlock.ts +++ b/lib/runBlock.ts @@ -8,45 +8,78 @@ import PStateManager from './state/promisified' const promisify = require('util.promisify') const Trie = require('merkle-patricia-tree') +/** + * Options for running a block. + */ export interface RunBlockOpts { + /** + * The [`Block`](https://github.com/ethereumjs/ethereumjs-block) to process + */ block: any + /** + * Root of the state trie + */ root?: Buffer + /** + * Whether to generate the stateRoot. If false `runBlock` will check the + * stateRoot of the block against the Trie + */ generate?: boolean + /** + * If true, will skip block validation + */ skipBlockValidation?: boolean } +/** + * Callback function for [[runBlock]] + */ export interface RunBlockCb { + /** + * @param err - Any error that happened during execution, or `null` + * @param result - Result of execution, `null` in case of error + */ (err: Error | null, result: RunBlockResult | null): void } +/** + * Result of [[runBlock]] + */ export interface RunBlockResult { + /** + * Receipts generated for transactions in the block + */ receipts: TxReceipt[] + /** + * Results of executing the transactions in the block + */ results: RunTxResult[] } +/** + * Receipt generated for a transaction + */ export interface TxReceipt { + /** + * Status of transaction, `0` if successful, `1` if an exception occured + */ status: 0 | 1 + /** + * Gas used + */ gasUsed: Buffer + /** + * Bloom bitvector + */ bitvector: Buffer + /** + * Logs emitted + */ logs: any[] } /** - * Processes the `block` running all of the transactions it contains and updating the miner's account - * @method vm.runBlock - * @param opts - * @param {Block} opts.block the [`Block`](https://github.com/ethereumjs/ethereumjs-block) to process - * @param {Boolean} opts.generate [gen=false] whether to generate the stateRoot, if false `runBlock` will check the stateRoot of the block against the Trie - * @param {runBlock~callback} cb callback - */ - -/** - * Callback for `runBlock` method - * @callback runBlock~callback - * @param {Error} error an error that may have happened or `null` - * @param {Object} results - * @param {Array} results.receipts the receipts from the transactions in the block - * @param {Array} results.results + * @ignore */ export default function runBlock(this: VM, opts: RunBlockOpts, cb: RunBlockCb): void { if (typeof opts === 'function' && cb === undefined) { @@ -69,7 +102,7 @@ async function _runBlock(this: VM, opts: RunBlockOpts): Promise const generateStateRoot = !!opts.generate /** - * The `beforeBlock` event + * The `beforeBlock` event. * * @event Event: beforeBlock * @type {Object} diff --git a/lib/runBlockchain.ts b/lib/runBlockchain.ts index 35a732ed3c..aa3b4dbd0c 100644 --- a/lib/runBlockchain.ts +++ b/lib/runBlockchain.ts @@ -2,10 +2,7 @@ import VM from './index' const async = require('async') /** - * Processes blocks and adds them to the blockchain - * @method vm.runBlockchain - * @param {Blockchain} blockchain A [blockchain](https://github.com/ethereum/ethereumjs-blockchain) that to process - * @param {Function} cb the callback function + * @ignore */ export default function runBlockchain(this: VM, blockchain: any, cb: any) { const self = this diff --git a/lib/runCall.ts b/lib/runCall.ts index db1d36f31f..9fd24094db 100644 --- a/lib/runCall.ts +++ b/lib/runCall.ts @@ -7,6 +7,9 @@ import Message from './evm/message' import { default as Interpreter, InterpreterResult } from './evm/interpreter' const Block = require('ethereumjs-block') +/** + * Options for running a call (or create) operation + */ export interface RunCallOpts { block?: any storageReader?: StorageReader @@ -17,6 +20,9 @@ export interface RunCallOpts { to?: Buffer value?: Buffer data?: Buffer + /** + * This is for CALLCODE where the code to load is different than the code from the to account + */ code?: Buffer depth?: number compiled?: boolean @@ -26,25 +32,19 @@ export interface RunCallOpts { delegatecall?: boolean } +/** + * Callback for the [[runCall]] method. + */ export interface RunCallCb { + /** + * @param error - Any error that occured during execution, or `null` + * @param results - Results of call, or `null` if an error occured + */ (err: Error | null, results: InterpreterResult | null): void } /** - * runs a CALL operation - * @method vm.runCall - * @private - * @param opts - * @param opts.block {Block} - * @param opts.caller {Buffer} - * @param opts.code {Buffer} this is for CALLCODE where the code to load is different than the code from the to account. - * @param opts.data {Buffer} - * @param opts.gasLimit {Buffer | BN.js } - * @param opts.gasPrice {Buffer} - * @param opts.origin {Buffer} [] - * @param opts.to {Buffer} - * @param opts.value {Buffer} - * @param {Function} cb the callback + * @ignore */ export default function runCall(this: VM, opts: RunCallOpts, cb: RunCallCb): void { const block = opts.block || new Block() diff --git a/lib/runCode.ts b/lib/runCode.ts index e79f005b1f..5e2985c0b5 100644 --- a/lib/runCode.ts +++ b/lib/runCode.ts @@ -19,60 +19,69 @@ import { default as Interpreter, ExecResult } from './evm/interpreter' import { StorageReader } from './state' const Block = require('ethereumjs-block') +/** + * Options for the [[runCode]] method. + */ export interface RunCodeOpts { + /** + * The [`Block`](https://github.com/ethereumjs/ethereumjs-block) the `tx` belongs to. If omitted a blank block will be used + */ block?: any storageReader?: StorageReader interpreter?: Interpreter txContext?: TxContext gasPrice?: Buffer + /** + * The address where the call originated from. The address should be a `Buffer` of 20bits. Defaults to `0` + */ origin?: Buffer message?: Message + /** + * The address that ran this code. The address should be a `Buffer` of 20bits. Defaults to `0` + */ caller?: Buffer + /** + * The EVM code to run + */ code?: Buffer + /** + * The input data + */ data?: Buffer + /** + * Gas limit + */ gasLimit?: Buffer + /** + * The value in ether that is being sent to `opt.address`. Defaults to `0` + */ value?: Buffer depth?: number isStatic?: boolean selfdestruct?: { [k: string]: boolean } + /** + * The address of the account that is executing this code. The address should be a `Buffer` of bytes. Defaults to `0` + */ address?: Buffer + /** + * The initial program counter. Defaults to `0` + */ pc?: number } +/** + * Callback for `runCode` method + */ export interface RunCodeCb { + /** + * @param error - an error that may have happened or `null` + * @param results - results of code execution + */ (err: Error | null, res: ExecResult | null): void } /** - * Runs EVM code - * @method vm.runCode - * @param {Object} opts - * @param {Account} opts.account the [`Account`](https://github.com/ethereumjs/ethereumjs-account) that the executing code belongs to. If omitted an empty account will be used - * @param {Buffer} opts.address the address of the account that is executing this code. The address should be a `Buffer` of bytes. Defaults to `0` - * @param {Block} opts.block the [`Block`](https://github.com/ethereumjs/ethereumjs-block) the `tx` belongs to. If omitted a blank block will be used - * @param {Buffer} opts.caller the address that ran this code. The address should be a `Buffer` of 20bits. Defaults to `0` - * @param {Buffer} opts.code the EVM code to run given as a `Buffer` - * @param {Buffer} opts.data the input data - * @param {Buffer} opts.gasLimit the gas limit for the code - * @param {Buffer} opts.origin the address where the call originated from. The address should be a `Buffer` of 20bits. Defaults to `0` - * @param {Buffer} opts.value the value in ether that is being sent to `opt.address`. Defaults to `0` - * @param {Number} opts.pc the initial program counter. Defaults to `0` - * @param {runCode~callback} cb callback - */ - -/** - * Callback for `runCode` method - * @callback runCode~callback - * @param {Error} error an error that may have happened or `null` - * @param {Object} results - * @param {BN} results.gas the amount of gas left - * @param {BN} results.gasUsed the amount of gas as a `bignum` the code used to run - * @param {BN} results.gasRefund a `bignum` containing the amount of gas to refund from deleting storage values - * @param {Object} results.selfdestruct an `Object` with keys for accounts that have selfdestructed and values for balance transfer recipient accounts - * @param {Array} results.logs an `Array` of logs that the contract emitted - * @param {Number} results.exception `0` if the contract encountered an exception, `1` otherwise - * @param {String} results.exceptionError a `String` describing the exception if there was one - * @param {Buffer} results.return a `Buffer` containing the value that was returned by the contract + * @ignore */ export default function runCode(this: VM, opts: RunCodeOpts, cb: RunCodeCb): void { if (!opts.block) { diff --git a/lib/runTx.ts b/lib/runTx.ts index f1dd8c4576..27ff31e9b9 100644 --- a/lib/runTx.ts +++ b/lib/runTx.ts @@ -10,43 +10,59 @@ import { StorageReader } from './state' import PStateManager from './state/promisified' const Block = require('ethereumjs-block') +/** + * Options for the `runTx` method. + */ export interface RunTxOpts { + /** + * The block to which the `tx` belongs + */ block?: any + /** + * A [`Transaction`](https://github.com/ethereum/ethereumjs-tx) to run + */ tx: any // TODO: Update ethereumjs-tx + /** + * If true, skips the nonce check + */ skipNonce?: boolean + /** + * If true, skips the balance check + */ skipBalance?: boolean } +/** + * Callback for `runTx` method + */ export interface RunTxCb { + /** + * @param error - An error that may have happened or `null` + * @param results - Results of the execution + */ (err: Error | null, results: RunTxResult | null): void } +/** + * Execution result of a transaction + */ export interface RunTxResult extends InterpreterResult { + /** + * Bloom filter resulted from transaction + */ bloom: Bloom + /** + * The amount of ether used by this transaction + */ amountSpent: BN + /** + * The amount of gas as that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) + */ gasRefund?: BN } /** - * Process a transaction. Run the vm. Transfers eth. Checks balances. - * @method vm.runTx - * @param opts - * @param {Transaction} opts.tx a [`Transaction`](https://github.com/ethereum/ethereumjs-tx) to run - * @param {Boolean} opts.skipNonce skips the nonce check - * @param {Boolean} opts.skipBalance skips the balance check - * @param {Block} opts.block the block to which the `tx` belongs, if no block is given a default one is created - * @param {runTx~callback} cb the callback - */ - -/** - * Callback for `runTx` method - * @callback runTx~callback - * @param {Error} error an error that may have happened or `null` - * @param {Object} results - * @param {BN} results.amountSpent the amount of ether used by this transaction as a `bignum` - * @param {BN} results.gasUsed the amount of gas as a `bignum` used by the transaction - * @param {BN} results.gasRefund the amount of gas as a `bignum` that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) - * @param {VM} vm contains the results from running the code, if any, as described in `vm.runCode(params, cb)` + * @ignore */ export default function runTx(this: VM, opts: RunTxOpts, cb: RunTxCb) { if (typeof opts === 'function' && cb === undefined) { diff --git a/lib/state/cache.ts b/lib/state/cache.ts index 2930b6ed23..cc33dad643 100644 --- a/lib/state/cache.ts +++ b/lib/state/cache.ts @@ -2,6 +2,9 @@ const asyncLib = require('async') const Tree = require('functional-red-black-tree') import Account from 'ethereumjs-account' +/** + * @ignore + */ export default class Cache { _cache: any _checkpoints: any[] diff --git a/lib/state/promisified.ts b/lib/state/promisified.ts index c41d853459..fc3907d200 100644 --- a/lib/state/promisified.ts +++ b/lib/state/promisified.ts @@ -2,6 +2,10 @@ const promisify = require('util.promisify') import Account from 'ethereumjs-account' import { default as StateManager, StorageDump } from './stateManager' +/** + * Promisified wrapper around [[StateManager]] + * @ignore + */ export default class PStateManager { _wrapped: StateManager diff --git a/lib/state/stateManager.ts b/lib/state/stateManager.ts index d96d814eb9..c0f3d1c3b9 100644 --- a/lib/state/stateManager.ts +++ b/lib/state/stateManager.ts @@ -9,6 +9,9 @@ import { genesisStateByName } from 'ethereumjs-common/dist/genesisStates' import Account from 'ethereumjs-account' import Cache from './cache' +/** + * Storage values of an account + */ export interface StorageDump { [key: string]: string } diff --git a/lib/state/storageReader.ts b/lib/state/storageReader.ts index 152fd985a4..e5eb89ac07 100644 --- a/lib/state/storageReader.ts +++ b/lib/state/storageReader.ts @@ -1,5 +1,8 @@ import StateManager from './stateManager' +/** + * @ignore + */ export default class StorageReader { _stateManager: StateManager _storageCache: Map diff --git a/package.json b/package.json index 5e8f38f31d..3b234e8d8c 100644 --- a/package.json +++ b/package.json @@ -13,6 +13,7 @@ "coverage": "nyc npm run coverageTests && nyc report --reporter=text-lcov > .nyc_output/lcov.info", "coverageTests": "npm run build:dist && tape './tests/api/**/*.js' ./tests/tester.js -s --dist", "coveralls": "npm run coverage && if [ -n \"$COVERALLS_REPO_TOKEN\" ]; then coveralls <.nyc_output/lcov.info; fi", + "docs:build": "typedoc lib", "testVM": "node ./tests/tester -v", "testStateByzantium": "npm run build:dist && node ./tests/tester -s --fork='Byzantium' --dist", "testStateConstantinople": "npm run build:dist && node ./tests/tester -s --fork='Constantinople' --dist", @@ -72,7 +73,6 @@ "@types/node": "^11.13.4", "browserify": "^16.2.3", "coveralls": "^3.0.0", - "documentation": "^8.1.2", "ethereumjs-testing": "git+https://github.com/ethereumjs/ethereumjs-testing.git#v1.2.7", "ethereumjs-tx": "1.3.7", "husky": "^2.1.0", @@ -92,6 +92,8 @@ "tap-spec": "^5.0.0", "tape": "4.6.3", "tslint": "^5.16.0", + "typedoc": "^0.14.2", + "typedoc-plugin-markdown": "^1.2.1", "typescript": "^3.4.3", "typestrict": "^1.0.2" }, diff --git a/typedoc.json b/typedoc.json new file mode 100644 index 0000000000..d5cc04d2af --- /dev/null +++ b/typedoc.json @@ -0,0 +1,9 @@ +{ + "out": "docs", + "mode": "file", + "readme": "none", + "theme": "markdown", + "mdEngine": "github", + "excludeNotExported": true, + "exclude": ["lib/bloom/*.ts", "lib/evm/precompiles/*.ts", "lib/evm/eei.ts", "lib/evm/loop.ts", "lib/evm/memory.ts", "lib/evm/message.ts", "lib/evm/opcodes.ts", "lib/evm/opFns.ts", "lib/evm/stack.ts", "lib/evm/txContext.ts"] +} From 984f30d28e7e5125c5aa308a74f2384eea4052ee Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Mon, 27 May 2019 15:34:16 +0200 Subject: [PATCH 2/3] Update doc links --- docs/classes/statemanager.md | 60 ++++++++++++++-------------- docs/classes/vm.md | 26 ++++++------ docs/classes/vmerror.md | 6 +-- docs/enums/error.md | 22 +++++----- docs/interfaces/execresult.md | 20 +++++----- docs/interfaces/interpreterresult.md | 6 +-- docs/interfaces/runblockcb.md | 2 +- docs/interfaces/runblockopts.md | 8 ++-- docs/interfaces/runblockresult.md | 4 +- docs/interfaces/runcallcb.md | 2 +- docs/interfaces/runcallopts.md | 32 +++++++-------- docs/interfaces/runcodecb.md | 2 +- docs/interfaces/runcodeopts.md | 34 ++++++++-------- docs/interfaces/runtxcb.md | 2 +- docs/interfaces/runtxopts.md | 8 ++-- docs/interfaces/runtxresult.md | 12 +++--- docs/interfaces/txreceipt.md | 8 ++-- docs/interfaces/vmopts.md | 14 +++---- 18 files changed, 134 insertions(+), 134 deletions(-) diff --git a/docs/classes/statemanager.md b/docs/classes/statemanager.md index 8221cfcc59..a102edbec8 100644 --- a/docs/classes/statemanager.md +++ b/docs/classes/statemanager.md @@ -59,7 +59,7 @@ Interface for getting and setting data from an underlying state trie. ⊕ **new StateManager**(opts?: *`any`*): [StateManager](statemanager.md) -*Defined in [state/stateManager.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L30)* +*Defined in [state/stateManager.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L30)* Instantiate the StateManager interface. @@ -81,7 +81,7 @@ ___ **● _cache**: *`Cache`* -*Defined in [state/stateManager.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L27)* +*Defined in [state/stateManager.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L27)* ___ @@ -90,7 +90,7 @@ ___ **● _checkpointCount**: *`number`* -*Defined in [state/stateManager.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L30)* +*Defined in [state/stateManager.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L30)* ___ @@ -99,7 +99,7 @@ ___ **● _common**: *`Common`* -*Defined in [state/stateManager.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L24)* +*Defined in [state/stateManager.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L24)* ___ @@ -108,7 +108,7 @@ ___ **● _storageTries**: *`any`* -*Defined in [state/stateManager.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L26)* +*Defined in [state/stateManager.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L26)* ___ @@ -117,7 +117,7 @@ ___ **● _touched**: *`Set`<`string`>* -*Defined in [state/stateManager.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L28)* +*Defined in [state/stateManager.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L28)* ___ @@ -126,7 +126,7 @@ ___ **● _touchedStack**: *`Set`<`string`>[]* -*Defined in [state/stateManager.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L29)* +*Defined in [state/stateManager.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L29)* ___ @@ -135,7 +135,7 @@ ___ **● _trie**: *`any`* -*Defined in [state/stateManager.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L25)* +*Defined in [state/stateManager.ts:25](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L25)* ___ @@ -147,7 +147,7 @@ ___ ▸ **_getStorageTrie**(address: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:182](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L182)* +*Defined in [state/stateManager.ts:182](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L182)* Gets the storage trie for an account from the storage cache or does a lookup @@ -171,7 +171,7 @@ ___ ▸ **_lookupStorageTrie**(address: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:160](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L160)* +*Defined in [state/stateManager.ts:160](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L160)* Creates a storage trie from the primary storage trie for an account and saves this in the storage cache. @@ -195,7 +195,7 @@ ___ ▸ **_modifyContractStorage**(address: *`Buffer`*, modifyTrie: *`any`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L232)* +*Defined in [state/stateManager.ts:232](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L232)* Modifies the storage trie of an account @@ -220,7 +220,7 @@ ___ ▸ **accountIsEmpty**(address: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:538](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L538)* +*Defined in [state/stateManager.ts:538](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L538)* Checks if the `account` corresponding to `address` is empty as defined in EIP-161 ([https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md)) @@ -244,7 +244,7 @@ ___ ▸ **checkpoint**(cb: *`any`*): `void` -*Defined in [state/stateManager.ts:304](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L304)* +*Defined in [state/stateManager.ts:304](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L304)* Checkpoints the current state of the StateManager instance. State changes that follow can then be committed by calling `commit` or `reverted` by calling rollback. @@ -267,7 +267,7 @@ ___ ▸ **cleanupTouchedAccounts**(cb: *`any`*): `void` -*Defined in [state/stateManager.ts:561](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L561)* +*Defined in [state/stateManager.ts:561](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L561)* Removes accounts form the state trie that have been touched, as defined in EIP-161 ([https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md)](https://github.com/ethereum/EIPs/blob/master/EIPS/eip-161.md)). @@ -290,7 +290,7 @@ ___ ▸ **clearContractStorage**(address: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:285](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L285)* +*Defined in [state/stateManager.ts:285](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L285)* Clears all storage entries for the account corresponding to `address` @@ -314,7 +314,7 @@ ___ ▸ **commit**(cb: *`any`*): `void` -*Defined in [state/stateManager.ts:319](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L319)* +*Defined in [state/stateManager.ts:319](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L319)* Commits the current change-set to the instance since the last call to checkpoint. @@ -337,7 +337,7 @@ ___ ▸ **copy**(): [StateManager](statemanager.md) -*Defined in [state/stateManager.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L60)* +*Defined in [state/stateManager.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L60)* Copies the current instance of the `DefaultStateManager` at the last fully committed point, i.e. as if all current checkpoints were reverted @@ -354,7 +354,7 @@ ___ ▸ **dumpStorage**(address: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:440](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L440)* +*Defined in [state/stateManager.ts:440](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L440)* Dumps the the storage values for an `account` specified by `address` @@ -378,7 +378,7 @@ ___ ▸ **generateCanonicalGenesis**(cb: *`any`*): `void` -*Defined in [state/stateManager.ts:484](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L484)* +*Defined in [state/stateManager.ts:484](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L484)* Generates a canonical genesis state on the instance based on the configured chain parameters. Will error if there are uncommitted checkpoints on the instance. @@ -401,7 +401,7 @@ ___ ▸ **generateGenesis**(initState: *`any`*, cb: *`any`*): `any` -*Defined in [state/stateManager.ts:505](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L505)* +*Defined in [state/stateManager.ts:505](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L505)* Initializes the provided genesis state into the state trie @@ -425,7 +425,7 @@ ___ ▸ **getAccount**(address: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:80](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L80)* +*Defined in [state/stateManager.ts:80](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L80)* Gets the [`ethereumjs-account`](https://github.com/ethereumjs/ethereumjs-account) associated with `address`. Returns an empty account if the account does not exist. @@ -449,7 +449,7 @@ ___ ▸ **getContractCode**(address: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:142](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L142)* +*Defined in [state/stateManager.ts:142](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L142)* Gets the code corresponding to the provided `address` @@ -473,7 +473,7 @@ ___ ▸ **getContractStorage**(address: *`Buffer`*, key: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:209](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L209)* +*Defined in [state/stateManager.ts:209](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L209)* Gets the storage value associated with the provided `address` and `key` @@ -498,7 +498,7 @@ ___ ▸ **getStateRoot**(cb: *`any`*): `void` -*Defined in [state/stateManager.ts:372](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L372)* +*Defined in [state/stateManager.ts:372](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L372)* 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. @@ -521,7 +521,7 @@ ___ ▸ **hasGenesisState**(cb: *`any`*): `void` -*Defined in [state/stateManager.ts:471](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L471)* +*Defined in [state/stateManager.ts:471](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L471)* Checks whether the current instance has the canonical genesis state for the configured chain parameters. @@ -544,7 +544,7 @@ ___ ▸ **putAccount**(address: *`Buffer`*, account: *`Account`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:93](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L93)* +*Defined in [state/stateManager.ts:93](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L93)* Saves an [`ethereumjs-account`](https://github.com/ethereumjs/ethereumjs-account) into state under the provided `address` @@ -569,7 +569,7 @@ ___ ▸ **putContractCode**(address: *`Buffer`*, value: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:112](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L112)* +*Defined in [state/stateManager.ts:112](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L112)* Adds `value` to the state trie as code, and sets `codeHash` on the account corresponding to `address` to reference this. @@ -594,7 +594,7 @@ ___ ▸ **putContractStorage**(address: *`Buffer`*, key: *`Buffer`*, value: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L261)* +*Defined in [state/stateManager.ts:261](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L261)* Adds value to the state trie for the `account` corresponding to `address` at the provided `key` @@ -620,7 +620,7 @@ ___ ▸ **revert**(cb: *`any`*): `void` -*Defined in [state/stateManager.ts:339](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L339)* +*Defined in [state/stateManager.ts:339](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L339)* Reverts the current change-set to the instance since the last call to checkpoint. @@ -643,7 +643,7 @@ ___ ▸ **setStateRoot**(stateRoot: *`Buffer`*, cb: *`any`*): `void` -*Defined in [state/stateManager.ts:396](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/state/stateManager.ts#L396)* +*Defined in [state/stateManager.ts:396](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/state/stateManager.ts#L396)* 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. diff --git a/docs/classes/vm.md b/docs/classes/vm.md index 83bae439cf..32e9864a88 100644 --- a/docs/classes/vm.md +++ b/docs/classes/vm.md @@ -44,7 +44,7 @@ Execution engine which can be used to run a blockchain, individual blocks, indiv ⊕ **new VM**(opts?: *[VMOpts](../interfaces/vmopts.md)*): [VM](vm.md) -*Defined in [index.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L59)* +*Defined in [index.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L59)* Instantiates a new [VM](vm.md) Object. @@ -66,7 +66,7 @@ ___ **● _common**: *`Common`* -*Defined in [index.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L56)* +*Defined in [index.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L56)* ___ @@ -75,7 +75,7 @@ ___ **● allowUnlimitedContractSize**: *`boolean`* -*Defined in [index.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L59)* +*Defined in [index.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L59)* ___ @@ -84,7 +84,7 @@ ___ **● blockchain**: *`any`* -*Defined in [index.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L58)* +*Defined in [index.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L58)* ___ @@ -93,7 +93,7 @@ ___ **● opts**: *[VMOpts](../interfaces/vmopts.md)* -*Defined in [index.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L55)* +*Defined in [index.ts:55](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L55)* ___ @@ -102,7 +102,7 @@ ___ **● stateManager**: *[StateManager](statemanager.md)* -*Defined in [index.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L57)* +*Defined in [index.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L57)* ___ @@ -114,7 +114,7 @@ ___ ▸ **_emit**(topic: *`string`*, data: *`any`*): `Promise`<`any`> -*Defined in [index.ts:147](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L147)* +*Defined in [index.ts:147](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L147)* **Parameters:** @@ -132,7 +132,7 @@ ___ ▸ **copy**(): [VM](vm.md) -*Defined in [index.ts:140](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L140)* +*Defined in [index.ts:140](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L140)* Returns a copy of the [VM](vm.md) instance. @@ -145,7 +145,7 @@ ___ ▸ **runBlock**(opts: *[RunBlockOpts](../interfaces/runblockopts.md)*, cb: *[RunBlockCb](../interfaces/runblockcb.md)*): `void` -*Defined in [index.ts:112](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L112)* +*Defined in [index.ts:112](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L112)* Processes the `block` running all of the transactions it contains and updating the miner's account @@ -165,7 +165,7 @@ ___ ▸ **runBlockchain**(blockchain: *`any`*, cb: *`any`*): `void` -*Defined in [index.ts:102](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L102)* +*Defined in [index.ts:102](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L102)* Processes blocks and adds them to the blockchain. @@ -185,7 +185,7 @@ ___ ▸ **runCall**(opts: *[RunCallOpts](../interfaces/runcallopts.md)*, cb: *[RunCallCb](../interfaces/runcallcb.md)*): `void` -*Defined in [index.ts:126](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L126)* +*Defined in [index.ts:126](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L126)* runs a call (or create) operation. @@ -205,7 +205,7 @@ ___ ▸ **runCode**(opts: *[RunCodeOpts](../interfaces/runcodeopts.md)*, cb: *[RunCodeCb](../interfaces/runcodecb.md)*): `void` -*Defined in [index.ts:133](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L133)* +*Defined in [index.ts:133](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L133)* Runs EVM code. @@ -225,7 +225,7 @@ ___ ▸ **runTx**(opts: *[RunTxOpts](../interfaces/runtxopts.md)*, cb: *[RunTxCb](../interfaces/runtxcb.md)*): `void` -*Defined in [index.ts:119](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L119)* +*Defined in [index.ts:119](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L119)* Process a transaction. Run the vm. Transfers eth. Checks balances. diff --git a/docs/classes/vmerror.md b/docs/classes/vmerror.md index ca9e58262e..15ef66b8a8 100644 --- a/docs/classes/vmerror.md +++ b/docs/classes/vmerror.md @@ -27,7 +27,7 @@ ⊕ **new VmError**(error: *[ERROR](../enums/error.md)*): [VmError](vmerror.md) -*Defined in [exceptions.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L17)* +*Defined in [exceptions.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L17)* **Parameters:** @@ -47,7 +47,7 @@ ___ **● error**: *[ERROR](../enums/error.md)* -*Defined in [exceptions.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L16)* +*Defined in [exceptions.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L16)* ___ @@ -56,7 +56,7 @@ ___ **● errorType**: *`string`* -*Defined in [exceptions.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L17)* +*Defined in [exceptions.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L17)* ___ diff --git a/docs/enums/error.md b/docs/enums/error.md index 4e1988060f..6be2a6e910 100644 --- a/docs/enums/error.md +++ b/docs/enums/error.md @@ -28,7 +28,7 @@ **CREATE_COLLISION**: = "create collision" -*Defined in [exceptions.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L11)* +*Defined in [exceptions.ts:11](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L11)* ___ @@ -37,7 +37,7 @@ ___ **INTERNAL_ERROR**: = "internal error" -*Defined in [exceptions.ts:10](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L10)* +*Defined in [exceptions.ts:10](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L10)* ___ @@ -46,7 +46,7 @@ ___ **INVALID_JUMP**: = "invalid JUMP" -*Defined in [exceptions.ts:5](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L5)* +*Defined in [exceptions.ts:5](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L5)* ___ @@ -55,7 +55,7 @@ ___ **INVALID_OPCODE**: = "invalid opcode" -*Defined in [exceptions.ts:6](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L6)* +*Defined in [exceptions.ts:6](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L6)* ___ @@ -64,7 +64,7 @@ ___ **OUT_OF_GAS**: = "out of gas" -*Defined in [exceptions.ts:2](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L2)* +*Defined in [exceptions.ts:2](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L2)* ___ @@ -73,7 +73,7 @@ ___ **OUT_OF_RANGE**: = "value out of range" -*Defined in [exceptions.ts:7](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L7)* +*Defined in [exceptions.ts:7](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L7)* ___ @@ -82,7 +82,7 @@ ___ **REVERT**: = "revert" -*Defined in [exceptions.ts:8](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L8)* +*Defined in [exceptions.ts:8](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L8)* ___ @@ -91,7 +91,7 @@ ___ **STACK_OVERFLOW**: = "stack overflow" -*Defined in [exceptions.ts:4](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L4)* +*Defined in [exceptions.ts:4](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L4)* ___ @@ -100,7 +100,7 @@ ___ **STACK_UNDERFLOW**: = "stack underflow" -*Defined in [exceptions.ts:3](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L3)* +*Defined in [exceptions.ts:3](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L3)* ___ @@ -109,7 +109,7 @@ ___ **STATIC_STATE_CHANGE**: = "static state change" -*Defined in [exceptions.ts:9](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L9)* +*Defined in [exceptions.ts:9](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L9)* ___ @@ -118,7 +118,7 @@ ___ **STOP**: = "stop" -*Defined in [exceptions.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/exceptions.ts#L12)* +*Defined in [exceptions.ts:12](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/exceptions.ts#L12)* ___ diff --git a/docs/interfaces/execresult.md b/docs/interfaces/execresult.md index 0b5562e724..d1d14588dc 100644 --- a/docs/interfaces/execresult.md +++ b/docs/interfaces/execresult.md @@ -33,7 +33,7 @@ Result of executing a call via the \[\[Interpreter\]\]. **● exception**: *`IsException`* -*Defined in [evm/interpreter.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L48)* +*Defined in [evm/interpreter.ts:48](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L48)* `0` if the contract encountered an exception, `1` otherwise @@ -44,7 +44,7 @@ ___ **● exceptionError**: *[VmError](../classes/vmerror.md) \| [ERROR](../enums/error.md)* -*Defined in [evm/interpreter.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L52)* +*Defined in [evm/interpreter.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L52)* Description of the exception, if any occured @@ -55,7 +55,7 @@ ___ **● gas**: *`BN`* -*Defined in [evm/interpreter.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L56)* +*Defined in [evm/interpreter.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L56)* Amount of gas left @@ -66,7 +66,7 @@ ___ **● gasRefund**: *`BN`* -*Defined in [evm/interpreter.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L76)* +*Defined in [evm/interpreter.ts:76](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L76)* Amount of gas to refund from deleting storage values @@ -77,7 +77,7 @@ ___ **● gasUsed**: *`BN`* -*Defined in [evm/interpreter.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L60)* +*Defined in [evm/interpreter.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L60)* Amount of gas the code used to run @@ -88,7 +88,7 @@ ___ **● logs**: *`any`[]* -*Defined in [evm/interpreter.ts:68](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L68)* +*Defined in [evm/interpreter.ts:68](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L68)* Array of logs that the contract emitted @@ -99,7 +99,7 @@ ___ **● return**: *`Buffer`* -*Defined in [evm/interpreter.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L64)* +*Defined in [evm/interpreter.ts:64](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L64)* Return value from the contract @@ -110,7 +110,7 @@ ___ **● returnValue**: *`Buffer`* -*Defined in [evm/interpreter.ts:72](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L72)* +*Defined in [evm/interpreter.ts:72](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L72)* Value returned by the contract @@ -121,7 +121,7 @@ ___ **● runState**: *`RunState`* -*Defined in [evm/interpreter.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L44)* +*Defined in [evm/interpreter.ts:44](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L44)* ___ @@ -130,7 +130,7 @@ ___ **● selfdestruct**: *`undefined` \| `object`* -*Defined in [evm/interpreter.ts:80](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L80)* +*Defined in [evm/interpreter.ts:80](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L80)* A set of accounts that have self-destructed diff --git a/docs/interfaces/interpreterresult.md b/docs/interfaces/interpreterresult.md index b84268567a..a6003188b3 100644 --- a/docs/interfaces/interpreterresult.md +++ b/docs/interfaces/interpreterresult.md @@ -28,7 +28,7 @@ Result of executing a message via the \[\[Interpreter\]\]. **● createdAddress**: *`Buffer`* -*Defined in [evm/interpreter.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L33)* +*Defined in [evm/interpreter.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L33)* Address of created account durint transaction, if any @@ -39,7 +39,7 @@ ___ **● gasUsed**: *`BN`* -*Defined in [evm/interpreter.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L29)* +*Defined in [evm/interpreter.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L29)* Amount of gas used by the transaction @@ -50,7 +50,7 @@ ___ **● vm**: *[ExecResult](execresult.md)* -*Defined in [evm/interpreter.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L37)* +*Defined in [evm/interpreter.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L37)* Contains the results from running the code, if any, as described in [runCode](../classes/vm.md#runcode) diff --git a/docs/interfaces/runblockcb.md b/docs/interfaces/runblockcb.md index c6daef6e29..3c86949422 100644 --- a/docs/interfaces/runblockcb.md +++ b/docs/interfaces/runblockcb.md @@ -11,7 +11,7 @@ Callback function for [runBlock](../classes/vm.md#runblock) ## Callable ▸ **__call**(err: *`Error` \| `null`*, result: *[RunBlockResult](runblockresult.md) \| `null`*): `void` -*Defined in [runBlock.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L37)* +*Defined in [runBlock.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L37)* Callback function for [runBlock](../classes/vm.md#runblock) diff --git a/docs/interfaces/runblockopts.md b/docs/interfaces/runblockopts.md index 7e577d366d..6a249d1004 100644 --- a/docs/interfaces/runblockopts.md +++ b/docs/interfaces/runblockopts.md @@ -27,7 +27,7 @@ Options for running a block. **● block**: *`any`* -*Defined in [runBlock.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L18)* +*Defined in [runBlock.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L18)* The [`Block`](https://github.com/ethereumjs/ethereumjs-block) to process @@ -38,7 +38,7 @@ ___ **● generate**: *`undefined` \| `false` \| `true`* -*Defined in [runBlock.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L27)* +*Defined in [runBlock.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L27)* Whether to generate the stateRoot. If false `runBlock` will check the stateRoot of the block against the Trie @@ -49,7 +49,7 @@ ___ **● root**: *`Buffer`* -*Defined in [runBlock.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L22)* +*Defined in [runBlock.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L22)* Root of the state trie @@ -60,7 +60,7 @@ ___ **● skipBlockValidation**: *`undefined` \| `false` \| `true`* -*Defined in [runBlock.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L31)* +*Defined in [runBlock.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L31)* If true, will skip block validation diff --git a/docs/interfaces/runblockresult.md b/docs/interfaces/runblockresult.md index e6134170f8..f69b3f161c 100644 --- a/docs/interfaces/runblockresult.md +++ b/docs/interfaces/runblockresult.md @@ -25,7 +25,7 @@ Result of [runBlock](../classes/vm.md#runblock) **● receipts**: *[TxReceipt](txreceipt.md)[]* -*Defined in [runBlock.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L52)* +*Defined in [runBlock.ts:52](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L52)* Receipts generated for transactions in the block @@ -36,7 +36,7 @@ ___ **● results**: *[RunTxResult](runtxresult.md)[]* -*Defined in [runBlock.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L56)* +*Defined in [runBlock.ts:56](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L56)* Results of executing the transactions in the block diff --git a/docs/interfaces/runcallcb.md b/docs/interfaces/runcallcb.md index cd07fc79c5..ee59b98193 100644 --- a/docs/interfaces/runcallcb.md +++ b/docs/interfaces/runcallcb.md @@ -11,7 +11,7 @@ Callback for the [runCall](../classes/vm.md#runcall) method. ## Callable ▸ **__call**(err: *`Error` \| `null`*, results: *[InterpreterResult](interpreterresult.md) \| `null`*): `void` -*Defined in [runCall.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L38)* +*Defined in [runCall.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L38)* Callback for the [runCall](../classes/vm.md#runcall) method. diff --git a/docs/interfaces/runcallopts.md b/docs/interfaces/runcallopts.md index 90409ab0dd..af00f0c501 100644 --- a/docs/interfaces/runcallopts.md +++ b/docs/interfaces/runcallopts.md @@ -39,7 +39,7 @@ Options for running a call (or create) operation **● block**: *`any`* -*Defined in [runCall.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L14)* +*Defined in [runCall.ts:14](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L14)* ___ @@ -48,7 +48,7 @@ ___ **● caller**: *`Buffer`* -*Defined in [runCall.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L18)* +*Defined in [runCall.ts:18](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L18)* ___ @@ -57,7 +57,7 @@ ___ **● code**: *`Buffer`* -*Defined in [runCall.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L26)* +*Defined in [runCall.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L26)* This is for CALLCODE where the code to load is different than the code from the to account @@ -68,7 +68,7 @@ ___ **● compiled**: *`undefined` \| `false` \| `true`* -*Defined in [runCall.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L28)* +*Defined in [runCall.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L28)* ___ @@ -77,7 +77,7 @@ ___ **● data**: *`Buffer`* -*Defined in [runCall.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L22)* +*Defined in [runCall.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L22)* ___ @@ -86,7 +86,7 @@ ___ **● delegatecall**: *`undefined` \| `false` \| `true`* -*Defined in [runCall.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L32)* +*Defined in [runCall.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L32)* ___ @@ -95,7 +95,7 @@ ___ **● depth**: *`undefined` \| `number`* -*Defined in [runCall.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L27)* +*Defined in [runCall.ts:27](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L27)* ___ @@ -104,7 +104,7 @@ ___ **● gasLimit**: *`Buffer`* -*Defined in [runCall.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L19)* +*Defined in [runCall.ts:19](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L19)* ___ @@ -113,7 +113,7 @@ ___ **● gasPrice**: *`Buffer`* -*Defined in [runCall.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L16)* +*Defined in [runCall.ts:16](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L16)* ___ @@ -122,7 +122,7 @@ ___ **● origin**: *`Buffer`* -*Defined in [runCall.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L17)* +*Defined in [runCall.ts:17](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L17)* ___ @@ -131,7 +131,7 @@ ___ **● salt**: *`Buffer`* -*Defined in [runCall.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L30)* +*Defined in [runCall.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L30)* ___ @@ -140,7 +140,7 @@ ___ **● selfdestruct**: *`undefined` \| `object`* -*Defined in [runCall.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L31)* +*Defined in [runCall.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L31)* ___ @@ -149,7 +149,7 @@ ___ **● static**: *`undefined` \| `false` \| `true`* -*Defined in [runCall.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L29)* +*Defined in [runCall.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L29)* ___ @@ -158,7 +158,7 @@ ___ **● storageReader**: *`StorageReader`* -*Defined in [runCall.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L15)* +*Defined in [runCall.ts:15](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L15)* ___ @@ -167,7 +167,7 @@ ___ **● to**: *`Buffer`* -*Defined in [runCall.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L20)* +*Defined in [runCall.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L20)* ___ @@ -176,7 +176,7 @@ ___ **● value**: *`Buffer`* -*Defined in [runCall.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCall.ts#L21)* +*Defined in [runCall.ts:21](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCall.ts#L21)* ___ diff --git a/docs/interfaces/runcodecb.md b/docs/interfaces/runcodecb.md index 2409bcab85..45a181e61b 100644 --- a/docs/interfaces/runcodecb.md +++ b/docs/interfaces/runcodecb.md @@ -11,7 +11,7 @@ Callback for `runCode` method ## Callable ▸ **__call**(err: *`Error` \| `null`*, res: *[ExecResult](execresult.md) \| `null`*): `void` -*Defined in [runCode.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L75)* +*Defined in [runCode.ts:75](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L75)* Callback for `runCode` method diff --git a/docs/interfaces/runcodeopts.md b/docs/interfaces/runcodeopts.md index 2b04240d13..90322cd7b4 100644 --- a/docs/interfaces/runcodeopts.md +++ b/docs/interfaces/runcodeopts.md @@ -40,7 +40,7 @@ Options for the [runCode](../classes/vm.md#runcode) method. **● address**: *`Buffer`* -*Defined in [runCode.ts:65](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L65)* +*Defined in [runCode.ts:65](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L65)* The address of the account that is executing this code. The address should be a `Buffer` of bytes. Defaults to `0` @@ -51,7 +51,7 @@ ___ **● block**: *`any`* -*Defined in [runCode.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L29)* +*Defined in [runCode.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L29)* The [`Block`](https://github.com/ethereumjs/ethereumjs-block) the `tx` belongs to. If omitted a blank block will be used @@ -62,7 +62,7 @@ ___ **● caller**: *`Buffer`* -*Defined in [runCode.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L42)* +*Defined in [runCode.ts:42](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L42)* The address that ran this code. The address should be a `Buffer` of 20bits. Defaults to `0` @@ -73,7 +73,7 @@ ___ **● code**: *`Buffer`* -*Defined in [runCode.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L46)* +*Defined in [runCode.ts:46](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L46)* The EVM code to run @@ -84,7 +84,7 @@ ___ **● data**: *`Buffer`* -*Defined in [runCode.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L50)* +*Defined in [runCode.ts:50](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L50)* The input data @@ -95,7 +95,7 @@ ___ **● depth**: *`undefined` \| `number`* -*Defined in [runCode.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L59)* +*Defined in [runCode.ts:59](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L59)* ___ @@ -104,7 +104,7 @@ ___ **● gasLimit**: *`Buffer`* -*Defined in [runCode.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L54)* +*Defined in [runCode.ts:54](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L54)* Gas limit @@ -115,7 +115,7 @@ ___ **● gasPrice**: *`Buffer`* -*Defined in [runCode.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L33)* +*Defined in [runCode.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L33)* ___ @@ -124,7 +124,7 @@ ___ **● interpreter**: *`Interpreter`* -*Defined in [runCode.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L31)* +*Defined in [runCode.ts:31](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L31)* ___ @@ -133,7 +133,7 @@ ___ **● isStatic**: *`undefined` \| `false` \| `true`* -*Defined in [runCode.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L60)* +*Defined in [runCode.ts:60](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L60)* ___ @@ -142,7 +142,7 @@ ___ **● message**: *`Message`* -*Defined in [runCode.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L38)* +*Defined in [runCode.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L38)* ___ @@ -151,7 +151,7 @@ ___ **● origin**: *`Buffer`* -*Defined in [runCode.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L37)* +*Defined in [runCode.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L37)* The address where the call originated from. The address should be a `Buffer` of 20bits. Defaults to `0` @@ -162,7 +162,7 @@ ___ **● pc**: *`undefined` \| `number`* -*Defined in [runCode.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L69)* +*Defined in [runCode.ts:69](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L69)* The initial program counter. Defaults to `0` @@ -173,7 +173,7 @@ ___ **● selfdestruct**: *`undefined` \| `object`* -*Defined in [runCode.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L61)* +*Defined in [runCode.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L61)* ___ @@ -182,7 +182,7 @@ ___ **● storageReader**: *`StorageReader`* -*Defined in [runCode.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L30)* +*Defined in [runCode.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L30)* ___ @@ -191,7 +191,7 @@ ___ **● txContext**: *`TxContext`* -*Defined in [runCode.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L32)* +*Defined in [runCode.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L32)* ___ @@ -200,7 +200,7 @@ ___ **● value**: *`Buffer`* -*Defined in [runCode.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runCode.ts#L58)* +*Defined in [runCode.ts:58](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runCode.ts#L58)* The value in ether that is being sent to `opt.address`. Defaults to `0` diff --git a/docs/interfaces/runtxcb.md b/docs/interfaces/runtxcb.md index 774f3e8a50..fa63807e5d 100644 --- a/docs/interfaces/runtxcb.md +++ b/docs/interfaces/runtxcb.md @@ -11,7 +11,7 @@ Callback for `runTx` method ## Callable ▸ **__call**(err: *`Error` \| `null`*, results: *[RunTxResult](runtxresult.md) \| `null`*): `void` -*Defined in [runTx.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L38)* +*Defined in [runTx.ts:38](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runTx.ts#L38)* Callback for `runTx` method diff --git a/docs/interfaces/runtxopts.md b/docs/interfaces/runtxopts.md index 9815426335..d5471faca3 100644 --- a/docs/interfaces/runtxopts.md +++ b/docs/interfaces/runtxopts.md @@ -27,7 +27,7 @@ Options for the `runTx` method. **● block**: *`any`* -*Defined in [runTx.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L20)* +*Defined in [runTx.ts:20](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runTx.ts#L20)* The block to which the `tx` belongs @@ -38,7 +38,7 @@ ___ **● skipBalance**: *`undefined` \| `false` \| `true`* -*Defined in [runTx.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L32)* +*Defined in [runTx.ts:32](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runTx.ts#L32)* If true, skips the balance check @@ -49,7 +49,7 @@ ___ **● skipNonce**: *`undefined` \| `false` \| `true`* -*Defined in [runTx.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L28)* +*Defined in [runTx.ts:28](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runTx.ts#L28)* If true, skips the nonce check @@ -60,7 +60,7 @@ ___ **● tx**: *`any`* -*Defined in [runTx.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L24)* +*Defined in [runTx.ts:24](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runTx.ts#L24)* A [`Transaction`](https://github.com/ethereum/ethereumjs-tx) to run diff --git a/docs/interfaces/runtxresult.md b/docs/interfaces/runtxresult.md index 8638f433b4..d1fb7e1fbf 100644 --- a/docs/interfaces/runtxresult.md +++ b/docs/interfaces/runtxresult.md @@ -31,7 +31,7 @@ Execution result of a transaction **● amountSpent**: *`BN`* -*Defined in [runTx.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L57)* +*Defined in [runTx.ts:57](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runTx.ts#L57)* The amount of ether used by this transaction @@ -42,7 +42,7 @@ ___ **● bloom**: *`Bloom`* -*Defined in [runTx.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L53)* +*Defined in [runTx.ts:53](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runTx.ts#L53)* Bloom filter resulted from transaction @@ -55,7 +55,7 @@ ___ *Inherited from [InterpreterResult](interpreterresult.md).[createdAddress](interpreterresult.md#createdaddress)* -*Defined in [evm/interpreter.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L33)* +*Defined in [evm/interpreter.ts:33](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L33)* Address of created account durint transaction, if any @@ -66,7 +66,7 @@ ___ **● gasRefund**: *`BN`* -*Defined in [runTx.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runTx.ts#L61)* +*Defined in [runTx.ts:61](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runTx.ts#L61)* The amount of gas as that was refunded during the transaction (i.e. `gasUsed = totalGasConsumed - gasRefund`) @@ -79,7 +79,7 @@ ___ *Inherited from [InterpreterResult](interpreterresult.md).[gasUsed](interpreterresult.md#gasused)* -*Defined in [evm/interpreter.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L29)* +*Defined in [evm/interpreter.ts:29](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L29)* Amount of gas used by the transaction @@ -92,7 +92,7 @@ ___ *Inherited from [InterpreterResult](interpreterresult.md).[vm](interpreterresult.md#vm)* -*Defined in [evm/interpreter.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/evm/interpreter.ts#L37)* +*Defined in [evm/interpreter.ts:37](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/evm/interpreter.ts#L37)* Contains the results from running the code, if any, as described in [runCode](../classes/vm.md#runcode) diff --git a/docs/interfaces/txreceipt.md b/docs/interfaces/txreceipt.md index a944ba8e0c..b85fc65587 100644 --- a/docs/interfaces/txreceipt.md +++ b/docs/interfaces/txreceipt.md @@ -27,7 +27,7 @@ Receipt generated for a transaction **● bitvector**: *`Buffer`* -*Defined in [runBlock.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L74)* +*Defined in [runBlock.ts:74](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L74)* Bloom bitvector @@ -38,7 +38,7 @@ ___ **● gasUsed**: *`Buffer`* -*Defined in [runBlock.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L70)* +*Defined in [runBlock.ts:70](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L70)* Gas used @@ -49,7 +49,7 @@ ___ **● logs**: *`any`[]* -*Defined in [runBlock.ts:78](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L78)* +*Defined in [runBlock.ts:78](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L78)* Logs emitted @@ -60,7 +60,7 @@ ___ **● status**: *`0` \| `1`* -*Defined in [runBlock.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/runBlock.ts#L66)* +*Defined in [runBlock.ts:66](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/runBlock.ts#L66)* Status of transaction, `0` if successful, `1` if an exception occured diff --git a/docs/interfaces/vmopts.md b/docs/interfaces/vmopts.md index 6786f4a203..9387c8cad3 100644 --- a/docs/interfaces/vmopts.md +++ b/docs/interfaces/vmopts.md @@ -30,7 +30,7 @@ Options for instantiating a [VM](../classes/vm.md). **● activatePrecompiles**: *`undefined` \| `false` \| `true`* -*Defined in [index.ts:43](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L43)* +*Defined in [index.ts:43](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L43)* If true, create entries in the state tree for the precompiled contracts @@ -41,7 +41,7 @@ ___ **● allowUnlimitedContractSize**: *`undefined` \| `false` \| `true`* -*Defined in [index.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L47)* +*Defined in [index.ts:47](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L47)* 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 @@ -52,7 +52,7 @@ ___ **● blockchain**: *`any`* -*Defined in [index.ts:39](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L39)* +*Defined in [index.ts:39](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L39)* A [blockchain](https://github.com/ethereumjs/ethereumjs-blockchain) object for storing/retrieving blocks @@ -63,7 +63,7 @@ ___ **● chain**: *`undefined` \| `string`* -*Defined in [index.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L22)* +*Defined in [index.ts:22](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L22)* The chain the VM operates on @@ -74,7 +74,7 @@ ___ **● hardfork**: *`undefined` \| `string`* -*Defined in [index.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L26)* +*Defined in [index.ts:26](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L26)* Hardfork rules to be used @@ -85,7 +85,7 @@ ___ **● state**: *`any`* -*Defined in [index.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L35)* +*Defined in [index.ts:35](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L35)* A [merkle-patricia-tree](https://github.com/ethereumjs/merkle-patricia-tree) instance for the state tree (ignored if stateManager is passed) @@ -98,7 +98,7 @@ ___ **● stateManager**: *[StateManager](../classes/statemanager.md)* -*Defined in [index.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/06d36f3/lib/index.ts#L30)* +*Defined in [index.ts:30](https://github.com/ethereumjs/ethereumjs-vm/blob/de4d574/lib/index.ts#L30)* A [StateManager](../classes/statemanager.md) instance to use as the state store (Beta API) From 820f3d2f99a8bd2704726e680704e63975354e17 Mon Sep 17 00:00:00 2001 From: Sina Mahmoodi Date: Mon, 27 May 2019 15:41:15 +0200 Subject: [PATCH 3/3] Fix linting errors in developer.md --- developer.md | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/developer.md b/developer.md index b59ec9f9a1..fb07f073bd 100644 --- a/developer.md +++ b/developer.md @@ -4,7 +4,7 @@ ### Running Tests -Tests can be found in the ``tests`` directory, with ``FORK_CONFIG`` set in ``tests/tester.js``. There are test runners for [State tests](http://www.ethdocs.org/en/latest/contracts-and-transactions/ethereum-tests/state_tests/index.html) and [Blockchain tests](http://www.ethdocs.org/en/latest/contracts-and-transactions/ethereum-tests/blockchain_tests/index.html). VM tests are disabled since Frontier gas costs are not supported any more. Tests are then executed by the [ethereumjs-testing](https://github.com/ethereumjs/ethereumjs-testing) utility library using the official client-independent [Ethereum tests](https://github.com/ethereum/tests). +Tests can be found in the `tests` directory, with `FORK_CONFIG` set in `tests/tester.js`. There are test runners for [State tests](http://www.ethdocs.org/en/latest/contracts-and-transactions/ethereum-tests/state_tests/index.html) and [Blockchain tests](http://www.ethdocs.org/en/latest/contracts-and-transactions/ethereum-tests/blockchain_tests/index.html). VM tests are disabled since Frontier gas costs are not supported any more. Tests are then executed by the [ethereumjs-testing](https://github.com/ethereumjs/ethereumjs-testing) utility library using the official client-independent [Ethereum tests](https://github.com/ethereum/tests). For a wider picture about how to use tests to implement EIPs you can have a look at this [reddit post](https://www.reddit.com/r/ethereum/comments/6kc5g3/ethereumjs_team_is_seeking_contributors/) or the associated YouTube video introduction to [core development with Ethereumjs-vm](https://www.youtube.com/watch?v=L0BVDl6HZzk&feature=youtu.be). @@ -19,8 +19,8 @@ Running the Blockchain tests: `node ./tests/tester -b` -State tests and Blockchain tests can also be run against the ``dist`` folder (default: ``lib``): - +State tests and Blockchain tests can also be run against the `dist` folder (default: `lib`): + `node ./tests/tester -b --dist` State tests run significantly faster than Blockchain tests, so it is often a good choice to start fixing State tests. @@ -39,13 +39,13 @@ Running a specific state test case: `node ./tests/tester -s --test='stackOverflow'` -Only run test cases with selected ``data``, ``gas`` and/or ``value`` values (see -[attribute description](http://ethereum-tests.readthedocs.io/en/latest/test_types/state_tests.html) in -test docs), provided by the index of the array element in the test ``transaction`` section: +Only run test cases with selected `data`, `gas` and/or `value` values (see +[attribute description](http://ethereum-tests.readthedocs.io/en/latest/test_types/state_tests.html) in +test docs), provided by the index of the array element in the test `transaction` section: `node tests/tester -s --test='CreateCollisionToEmpty' --data=0 --gas=1 --value=0` -Run a state test from a specified source file not under the ``tests`` directory: +Run a state test from a specified source file not under the `tests` directory: `node ./tests/tester -s --customStateTest='{path_to_file}'` #### Running tests with a reporter/formatter @@ -67,15 +67,15 @@ The `-with` flag allows the specification of a formatter of your choosing: #### Skipping Tests -There are three types of skip lists (``BROKEN``, ``PERMANENT`` and ``SLOW``) which -can be found in ``tests/tester.js``. By default tests from all skip lists are omitted. +There are three types of skip lists (`BROKEN`, `PERMANENT` and `SLOW`) which +can be found in `tests/tester.js`. By default tests from all skip lists are omitted. You can change this behaviour with: `node tests/tester -s --skip=BROKEN,PERMANENT` -to skip only the ``BROKEN`` and ``PERMANENT`` tests and include the ``SLOW`` tests. -There are also the keywords ``NONE`` or ``ALL`` for convenience. +to skip only the `BROKEN` and `PERMANENT` tests and include the `SLOW` tests. +There are also the keywords `NONE` or `ALL` for convenience. It is also possible to only run the tests from the skip lists: @@ -83,35 +83,35 @@ It is also possible to only run the tests from the skip lists: ### CI Test Integration -Tests are run on ``CircleCI`` on every PR, configuration can be found in ``.circleci/config.yml``. +Tests are run on `CircleCI` on every PR, configuration can be found in `.circleci/config.yml`. ### Debugging #### Local Debugging -For state tests you can use the ``--jsontrace`` flag to output opcode trace information. +For state tests you can use the `--jsontrace` flag to output opcode trace information. Blockchain tests support `--debug` to verify the postState: -`node ./tests/tester -b --debug --test='ZeroValue_SELFDESTRUCT_ToOneStorageKey_OOGRevert_d0g0v0_EIP158'` +`node ./tests/tester -b --debug --test='ZeroValue_SELFDESTRUCT_ToOneStorageKey_OOGRevert_d0g0v0_EIP158'` -All/most State tests are replicated as Blockchain tests in a ``GeneralStateTests`` [sub directory](https://github.com/ethereum/tests/tree/develop/BlockchainTests/GeneralStateTests) in the Ethereum tests repo, so for debugging single test cases the Blockchain test version of the State test can be used. +All/most State tests are replicated as Blockchain tests in a `GeneralStateTests` [sub directory](https://github.com/ethereum/tests/tree/develop/BlockchainTests/GeneralStateTests) in the Ethereum tests repo, so for debugging single test cases the Blockchain test version of the State test can be used. #### Comparing Stack Traces Other client implementations often also provide functionality for output trace information. -A convenient way is to use a local ``geth`` installation (can be the binary installation and doesn't has to be build from source or something) and then use the included ``evm`` tool like: +A convenient way is to use a local `geth` installation (can be the binary installation and doesn't has to be build from source or something) and then use the included `evm` tool like: ```shell evm --json --nomemory statetest node_modules/ethereumjs-testing/tests/GeneralStateTests/stCreate2/create2collisionCode2.json ``` -If you want to have only the output for a specific fork you can go into the referenced json test file and temporarily delete the ``post`` section for the non-desired fork outputs (or, more safe and also more convenient on triggering later: copy the test files you are interested in to your working directory and then modify without further worrying). +If you want to have only the output for a specific fork you can go into the referenced json test file and temporarily delete the `post` section for the non-desired fork outputs (or, more safe and also more convenient on triggering later: copy the test files you are interested in to your working directory and then modify without further worrying). #### Debugging Tools -For comparing ``EVM`` traces [here](https://gist.github.com/cdetrio/41172f374ae32047a6c9e97fa9d09ad0) are some instructions for setting up ``pyethereum`` to generate corresponding traces for state tests. +For comparing `EVM` traces [here](https://gist.github.com/cdetrio/41172f374ae32047a6c9e97fa9d09ad0) are some instructions for setting up `pyethereum` to generate corresponding traces for state tests. Compare TAP output from blockchain/state tests and produces concise diff of the differences between them (example): @@ -121,7 +121,7 @@ curl https://gist.githubusercontent.com/jwasinger/e7004e82426ff0a7137a88d273f118 python utils/diffTestOutput.py output-wip-byzantium.txt output-master.txt ``` -An extremely rich and powerful toolbox is the [evmlab](https://github.com/holiman/evmlab) from ``holiman``, both for debugging and creating new test cases or example data. +An extremely rich and powerful toolbox is the [evmlab](https://github.com/holiman/evmlab) from `holiman`, both for debugging and creating new test cases or example data. ## Profiling