You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Change DefaultStateManager to MerkleStateManager
* Fix mispelling
* Reword and add example to example description
* Update example
* Update and reembed example
Copy file name to clipboardExpand all lines: packages/statemanager/README.md
+17-8Lines changed: 17 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -26,13 +26,13 @@ The `StateManager` provides high-level access and manipulation methods to and fo
26
26
This library includes several different implementations that all implement the `StateManager` interface which is accepted by the `vm` library. These include:
27
27
28
28
-[`SimpleStateManager`](./src/simpleStateManager.ts) -a minimally functional (and dependency minimized) version of the state manager suitable for most basic EVM bytecode operations
29
-
-[`DefaultStateManager`](./src//stateManager.ts) - a Merkle-Patricia Trie-based `DefaultStateManager` implementation that is used by the `@ethereumjs/client` and `@ethereumjs/vm`
29
+
-[`MerkleStateManager`](./src//stateManager.ts) - a Merkle-Patricia Trie-based `MerkleStateManager` implementation that is used by the `@ethereumjs/client` and `@ethereumjs/vm`
30
30
-[`RPCStateManager`](./src/rpcStateManager.ts) - a light-weight implementation that sources state and history data from an external JSON-RPC provider
31
31
-[`StatelessVerkleStateManager`](./src/statelessVerkleStateManager.ts) - an experimental implementation of a "stateless" state manager that uses Verkle proofs to provide necessary state access for processing verkle-trie based blocks
32
32
33
33
It also includes a checkpoint/revert/commit mechanism to either persist or revert state changes and provides a sophisticated caching mechanism under the hood to reduce the need reading state accesses from disk.
34
34
35
-
### `DefaultStateManager`
35
+
### `MerkleStateManager`
36
36
37
37
#### Usage example
38
38
@@ -69,7 +69,7 @@ There are now two cache options available: an unbounded cache (`CacheType.ORDERE
69
69
70
70
Caches now "survive" a flush operation and especially long-lived usage scenarios will benefit from increased performance by a growing and more "knowing" cache leading to less and less trie reads.
71
71
72
-
Have a loot at the extended `CacheOptions` on how to use and leverage the new cache system.
72
+
Have a look at the extended `CacheOptions` on how to use and leverage the new cache system.
73
73
74
74
### `SimpleStateManager`
75
75
@@ -95,11 +95,20 @@ const main = async () => {
95
95
voidmain()
96
96
```
97
97
98
-
### `DefaultStateManager` -> Proofs
98
+
### `MerkleStateManager` -> Proofs
99
99
100
100
#### Instantiating from a Proof
101
101
102
-
The `DefaultStateManager` has a static constructor `fromProof` that accepts one or more [EIP-1186](https://eips.ethereum.org/EIPS/eip-1186)[proofs](./src/stateManager.ts) and will instantiate a `DefaultStateManager` with a partial trie containing the state provided by the proof(s). Be aware that this constructor accepts the `StateManagerOpts` dictionary as a third parameter (i.e. `stateManager.fromProof(proof, safe, opts)`). Therefore, if you need to use a customized trie (e.g. one that does not use key hashing) or specify caching options, you can pass them in here. If you do instantiate a trie and pass it into the `fromProof` constructor, you also need to instantiate the trie using the corresponding `fromProof` constructor to ensure the state root matches when the proof data is added to the trie. See [this test](./test/stateManager.spec.ts#L287-L288) for more details.
102
+
The `MerkleStateManager` has a standalone constructor function `fromMerkleStateProof` that accepts one or more [EIP-1186](https://eips.ethereum.org/EIPS/eip-1186)[proofs](./src/stateManager.ts) and will instantiate a `MerkleStateManager` with a partial trie containing the state provided by the proof(s). Be aware that this constructor accepts the `StateManagerOpts` dictionary as a third parameter (i.e. `fromMerkleStateProof(proof, safe, opts)`).
103
+
104
+
Therefore, if you need to use a customized trie (e.g. one that does not use key hashing) or specify caching options, you can pass them in here. If you do instantiate a trie and pass it into the `createTrieFromProof` constructor, you also need to instantiate the trie using the corresponding `createStateManagerFromProof` constructor to ensure the state root matches when the proof data is added to the trie, consider an example:
0 commit comments