@feelyourprotocol/statemanager 8141.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.md +331 -0
- package/dist/cjs/cache/account.d.ts +85 -0
- package/dist/cjs/cache/account.d.ts.map +1 -0
- package/dist/cjs/cache/account.js +252 -0
- package/dist/cjs/cache/account.js.map +1 -0
- package/dist/cjs/cache/cache.d.ts +23 -0
- package/dist/cjs/cache/cache.d.ts.map +1 -0
- package/dist/cjs/cache/cache.js +31 -0
- package/dist/cjs/cache/cache.js.map +1 -0
- package/dist/cjs/cache/caches.d.ts +19 -0
- package/dist/cjs/cache/caches.d.ts.map +1 -0
- package/dist/cjs/cache/caches.js +107 -0
- package/dist/cjs/cache/caches.js.map +1 -0
- package/dist/cjs/cache/code.d.ts +87 -0
- package/dist/cjs/cache/code.d.ts.map +1 -0
- package/dist/cjs/cache/code.js +258 -0
- package/dist/cjs/cache/code.js.map +1 -0
- package/dist/cjs/cache/index.d.ts +7 -0
- package/dist/cjs/cache/index.d.ts.map +1 -0
- package/dist/cjs/cache/index.js +23 -0
- package/dist/cjs/cache/index.js.map +1 -0
- package/dist/cjs/cache/originalStorageCache.d.ts +21 -0
- package/dist/cjs/cache/originalStorageCache.d.ts.map +1 -0
- package/dist/cjs/cache/originalStorageCache.js +52 -0
- package/dist/cjs/cache/originalStorageCache.js.map +1 -0
- package/dist/cjs/cache/storage.d.ts +101 -0
- package/dist/cjs/cache/storage.d.ts.map +1 -0
- package/dist/cjs/cache/storage.js +337 -0
- package/dist/cjs/cache/storage.js.map +1 -0
- package/dist/cjs/cache/types.d.ts +36 -0
- package/dist/cjs/cache/types.d.ts.map +1 -0
- package/dist/cjs/cache/types.js +8 -0
- package/dist/cjs/cache/types.js.map +1 -0
- package/dist/cjs/index.d.ts +8 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +24 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/merkleStateManager.d.ts +260 -0
- package/dist/cjs/merkleStateManager.d.ts.map +1 -0
- package/dist/cjs/merkleStateManager.js +616 -0
- package/dist/cjs/merkleStateManager.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/proof/index.d.ts +3 -0
- package/dist/cjs/proof/index.d.ts.map +1 -0
- package/dist/cjs/proof/index.js +19 -0
- package/dist/cjs/proof/index.js.map +1 -0
- package/dist/cjs/proof/merkle.d.ts +40 -0
- package/dist/cjs/proof/merkle.d.ts.map +1 -0
- package/dist/cjs/proof/merkle.js +182 -0
- package/dist/cjs/proof/merkle.js.map +1 -0
- package/dist/cjs/proof/rpc.d.ts +10 -0
- package/dist/cjs/proof/rpc.d.ts.map +1 -0
- package/dist/cjs/proof/rpc.js +20 -0
- package/dist/cjs/proof/rpc.js.map +1 -0
- package/dist/cjs/rpcStateManager.d.ts +162 -0
- package/dist/cjs/rpcStateManager.d.ts.map +1 -0
- package/dist/cjs/rpcStateManager.js +313 -0
- package/dist/cjs/rpcStateManager.js.map +1 -0
- package/dist/cjs/simpleStateManager.d.ts +54 -0
- package/dist/cjs/simpleStateManager.d.ts.map +1 -0
- package/dist/cjs/simpleStateManager.js +125 -0
- package/dist/cjs/simpleStateManager.js.map +1 -0
- package/dist/cjs/statefulBinaryTreeStateManager.d.ts +69 -0
- package/dist/cjs/statefulBinaryTreeStateManager.d.ts.map +1 -0
- package/dist/cjs/statefulBinaryTreeStateManager.js +576 -0
- package/dist/cjs/statefulBinaryTreeStateManager.js.map +1 -0
- package/dist/cjs/types.d.ts +92 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/util.d.ts +4 -0
- package/dist/cjs/util.d.ts.map +1 -0
- package/dist/cjs/util.js +21 -0
- package/dist/cjs/util.js.map +1 -0
- package/dist/esm/cache/account.d.ts +85 -0
- package/dist/esm/cache/account.d.ts.map +1 -0
- package/dist/esm/cache/account.js +248 -0
- package/dist/esm/cache/account.js.map +1 -0
- package/dist/esm/cache/cache.d.ts +23 -0
- package/dist/esm/cache/cache.d.ts.map +1 -0
- package/dist/esm/cache/cache.js +27 -0
- package/dist/esm/cache/cache.js.map +1 -0
- package/dist/esm/cache/caches.d.ts +19 -0
- package/dist/esm/cache/caches.d.ts.map +1 -0
- package/dist/esm/cache/caches.js +103 -0
- package/dist/esm/cache/caches.js.map +1 -0
- package/dist/esm/cache/code.d.ts +87 -0
- package/dist/esm/cache/code.d.ts.map +1 -0
- package/dist/esm/cache/code.js +254 -0
- package/dist/esm/cache/code.js.map +1 -0
- package/dist/esm/cache/index.d.ts +7 -0
- package/dist/esm/cache/index.d.ts.map +1 -0
- package/dist/esm/cache/index.js +7 -0
- package/dist/esm/cache/index.js.map +1 -0
- package/dist/esm/cache/originalStorageCache.d.ts +21 -0
- package/dist/esm/cache/originalStorageCache.d.ts.map +1 -0
- package/dist/esm/cache/originalStorageCache.js +48 -0
- package/dist/esm/cache/originalStorageCache.js.map +1 -0
- package/dist/esm/cache/storage.d.ts +101 -0
- package/dist/esm/cache/storage.d.ts.map +1 -0
- package/dist/esm/cache/storage.js +333 -0
- package/dist/esm/cache/storage.js.map +1 -0
- package/dist/esm/cache/types.d.ts +36 -0
- package/dist/esm/cache/types.d.ts.map +1 -0
- package/dist/esm/cache/types.js +5 -0
- package/dist/esm/cache/types.js.map +1 -0
- package/dist/esm/index.d.ts +8 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +8 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/merkleStateManager.d.ts +260 -0
- package/dist/esm/merkleStateManager.d.ts.map +1 -0
- package/dist/esm/merkleStateManager.js +612 -0
- package/dist/esm/merkleStateManager.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/proof/index.d.ts +3 -0
- package/dist/esm/proof/index.d.ts.map +1 -0
- package/dist/esm/proof/index.js +3 -0
- package/dist/esm/proof/index.js.map +1 -0
- package/dist/esm/proof/merkle.d.ts +40 -0
- package/dist/esm/proof/merkle.d.ts.map +1 -0
- package/dist/esm/proof/merkle.js +175 -0
- package/dist/esm/proof/merkle.js.map +1 -0
- package/dist/esm/proof/rpc.d.ts +10 -0
- package/dist/esm/proof/rpc.d.ts.map +1 -0
- package/dist/esm/proof/rpc.js +17 -0
- package/dist/esm/proof/rpc.js.map +1 -0
- package/dist/esm/rpcStateManager.d.ts +162 -0
- package/dist/esm/rpcStateManager.d.ts.map +1 -0
- package/dist/esm/rpcStateManager.js +308 -0
- package/dist/esm/rpcStateManager.js.map +1 -0
- package/dist/esm/simpleStateManager.d.ts +54 -0
- package/dist/esm/simpleStateManager.d.ts.map +1 -0
- package/dist/esm/simpleStateManager.js +121 -0
- package/dist/esm/simpleStateManager.js.map +1 -0
- package/dist/esm/statefulBinaryTreeStateManager.d.ts +69 -0
- package/dist/esm/statefulBinaryTreeStateManager.d.ts.map +1 -0
- package/dist/esm/statefulBinaryTreeStateManager.js +572 -0
- package/dist/esm/statefulBinaryTreeStateManager.js.map +1 -0
- package/dist/esm/types.d.ts +92 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/util.d.ts +4 -0
- package/dist/esm/util.d.ts.map +1 -0
- package/dist/esm/util.js +18 -0
- package/dist/esm/util.js.map +1 -0
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.prod.esm.tsbuildinfo +1 -0
- package/package.json +74 -0
- package/src/cache/account.ts +277 -0
- package/src/cache/cache.ts +35 -0
- package/src/cache/caches.ts +125 -0
- package/src/cache/code.ts +277 -0
- package/src/cache/index.ts +6 -0
- package/src/cache/originalStorageCache.ts +57 -0
- package/src/cache/storage.ts +369 -0
- package/src/cache/types.ts +38 -0
- package/src/index.ts +7 -0
- package/src/merkleStateManager.ts +737 -0
- package/src/proof/index.ts +2 -0
- package/src/proof/merkle.ts +264 -0
- package/src/proof/rpc.ts +24 -0
- package/src/rpcStateManager.ts +381 -0
- package/src/simpleStateManager.ts +154 -0
- package/src/statefulBinaryTreeStateManager.ts +789 -0
- package/src/types.ts +103 -0
- package/src/util.ts +28 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { Common } from '@feelyourprotocol/common';
|
|
2
|
+
import { MerklePatriciaTrie } from '@feelyourprotocol/mpt';
|
|
3
|
+
import { Account } from '@feelyourprotocol/util';
|
|
4
|
+
import { OriginalStorageCache } from './cache/index.ts';
|
|
5
|
+
import type { Caches, MerkleStateManagerOpts } from './index.ts';
|
|
6
|
+
import type { AccountFields, StateManagerInterface, StorageDump, StorageRange } from '@feelyourprotocol/common';
|
|
7
|
+
import type { Address, DB } from '@feelyourprotocol/util';
|
|
8
|
+
import type { Debugger } from 'debug';
|
|
9
|
+
/**
|
|
10
|
+
* Prefix to distinguish between a contract deployed with code `0x80`
|
|
11
|
+
* and `RLP([])` (also having the value `0x80`).
|
|
12
|
+
*
|
|
13
|
+
* Otherwise the creation of the code hash for the `0x80` contract
|
|
14
|
+
* will be the same as the hash of the empty trie which leads to
|
|
15
|
+
* misbehaviour in the underlying trie library.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CODEHASH_PREFIX: Uint8Array<ArrayBufferLike>;
|
|
18
|
+
/**
|
|
19
|
+
* Default StateManager implementation for the VM.
|
|
20
|
+
*
|
|
21
|
+
* The state manager abstracts from the underlying data store
|
|
22
|
+
* by providing higher level access to accounts, contract code
|
|
23
|
+
* and storage slots.
|
|
24
|
+
*
|
|
25
|
+
* The default state manager implementation uses a
|
|
26
|
+
* `@feelyourprotocol/mpt` trie as a data backend.
|
|
27
|
+
*
|
|
28
|
+
* Note that there is a `SimpleStateManager` dependency-free state
|
|
29
|
+
* manager implementation available shipped with the `@feelyourprotocol/statemanager`
|
|
30
|
+
* package which might be an alternative to this implementation
|
|
31
|
+
* for many basic use cases.
|
|
32
|
+
*/
|
|
33
|
+
export declare class MerkleStateManager implements StateManagerInterface {
|
|
34
|
+
protected _debug: Debugger;
|
|
35
|
+
protected _caches?: Caches;
|
|
36
|
+
originalStorageCache: OriginalStorageCache;
|
|
37
|
+
protected _trie: MerklePatriciaTrie;
|
|
38
|
+
protected _storageTries: {
|
|
39
|
+
[key: string]: MerklePatriciaTrie;
|
|
40
|
+
};
|
|
41
|
+
protected readonly _prefixCodeHashes: boolean;
|
|
42
|
+
protected readonly _prefixStorageTrieKeys: boolean;
|
|
43
|
+
readonly common: Common;
|
|
44
|
+
protected _checkpointCount: number;
|
|
45
|
+
private keccakFunction;
|
|
46
|
+
/**
|
|
47
|
+
* StateManager is run in DEBUG mode (default: false)
|
|
48
|
+
* Taken from DEBUG environment variable
|
|
49
|
+
*
|
|
50
|
+
* Safeguards on debug() calls are added for
|
|
51
|
+
* performance reasons to avoid string literal evaluation
|
|
52
|
+
* @hidden
|
|
53
|
+
*/
|
|
54
|
+
protected readonly DEBUG: boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Instantiate the StateManager interface.
|
|
57
|
+
*/
|
|
58
|
+
constructor(opts?: MerkleStateManagerOpts);
|
|
59
|
+
/**
|
|
60
|
+
* Gets the account associated with `address` or `undefined` if account does not exist
|
|
61
|
+
* @param address - Address of the `account` to get
|
|
62
|
+
*/
|
|
63
|
+
getAccount(address: Address): Promise<Account | undefined>;
|
|
64
|
+
/**
|
|
65
|
+
* Saves an account into state under the provided `address`.
|
|
66
|
+
* @param address - Address under which to store `account`
|
|
67
|
+
* @param account - The account to store or undefined if to be deleted
|
|
68
|
+
*/
|
|
69
|
+
putAccount(address: Address, account: Account | undefined): Promise<void>;
|
|
70
|
+
/**
|
|
71
|
+
* Gets the account associated with `address`, modifies the given account
|
|
72
|
+
* fields, then saves the account into state. Account fields can include
|
|
73
|
+
* `nonce`, `balance`, `storageRoot`, and `codeHash`.
|
|
74
|
+
* @param address - Address of the account to modify
|
|
75
|
+
* @param accountFields - Object containing account fields and values to modify
|
|
76
|
+
*/
|
|
77
|
+
modifyAccountFields(address: Address, accountFields: AccountFields): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Deletes an account from state under the provided `address`.
|
|
80
|
+
* @param address - Address of the account which should be deleted
|
|
81
|
+
*/
|
|
82
|
+
deleteAccount(address: Address): Promise<void>;
|
|
83
|
+
/**
|
|
84
|
+
* Adds `value` to the state trie as code, and sets `codeHash` on the account
|
|
85
|
+
* corresponding to `address` to reference this.
|
|
86
|
+
* @param address - Address of the `account` to add the `code` for
|
|
87
|
+
* @param value - The value of the `code`
|
|
88
|
+
*/
|
|
89
|
+
putCode(address: Address, value: Uint8Array): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Gets the code corresponding to the provided `address`.
|
|
92
|
+
* @param address - Address to get the `code` for
|
|
93
|
+
* @returns {Promise<Uint8Array>} - Resolves with the code corresponding to the provided address.
|
|
94
|
+
* Returns an empty `Uint8Array` if the account has no associated code.
|
|
95
|
+
*/
|
|
96
|
+
getCode(address: Address): Promise<Uint8Array>;
|
|
97
|
+
getCodeSize(address: Address): Promise<number>;
|
|
98
|
+
/**
|
|
99
|
+
* Gets the storage trie for the EVM-internal account identified by the provided address/hash.
|
|
100
|
+
* If the storage trie is not in the local cache ('this._storageTries'),
|
|
101
|
+
* generates a new storage trie object based on a lookup (shallow copy from 'this._trie'),
|
|
102
|
+
* applies the storage root of the provided rootAccount (or an
|
|
103
|
+
* empty trie root if no rootAccount is provided), and stores the new entry
|
|
104
|
+
* in the local cache.
|
|
105
|
+
* @param addressOrHash Address (or other object) with populated 'bytes', or a raw Uint8Array.
|
|
106
|
+
* Used to identify the requested storage trie in the local cache and define the
|
|
107
|
+
* prefix used when creating a new storage trie.
|
|
108
|
+
* @param rootAccount (Optional) Account object whose 'storageRoot' is to be used as
|
|
109
|
+
* the root of the new storageTrie returned when there is no pre-existing trie.
|
|
110
|
+
* If left undefined, the EMPTY_TRIE_ROOT will be used as the root instead.
|
|
111
|
+
* @returns storage MerklePatriciaTrie object
|
|
112
|
+
* @private
|
|
113
|
+
*/
|
|
114
|
+
protected _getStorageTrie(addressOrHash: Address | {
|
|
115
|
+
bytes: Uint8Array;
|
|
116
|
+
} | Uint8Array, rootAccount?: Account): MerklePatriciaTrie;
|
|
117
|
+
/**
|
|
118
|
+
* Gets the storage trie for an account from the storage
|
|
119
|
+
* cache or does a lookup.
|
|
120
|
+
* @private
|
|
121
|
+
*/
|
|
122
|
+
protected _getAccountTrie(): MerklePatriciaTrie;
|
|
123
|
+
/**
|
|
124
|
+
* Gets the storage trie for an account from the storage
|
|
125
|
+
* cache or does a lookup.
|
|
126
|
+
* @private
|
|
127
|
+
*/
|
|
128
|
+
protected _getCodeDB(): DB;
|
|
129
|
+
/**
|
|
130
|
+
* Gets the storage value associated with the provided `address` and `key`. This method returns
|
|
131
|
+
* the shortest representation of the stored value.
|
|
132
|
+
* @param address - Address of the account to get the storage for
|
|
133
|
+
* @param key - Key in the account's storage to get the value for. Must be 32 bytes long.
|
|
134
|
+
* @returns - The storage value for the account
|
|
135
|
+
* corresponding to the provided address at the provided key.
|
|
136
|
+
* If this does not exist an empty `Uint8Array` is returned.
|
|
137
|
+
*/
|
|
138
|
+
getStorage(address: Address, key: Uint8Array): Promise<Uint8Array>;
|
|
139
|
+
/**
|
|
140
|
+
* Modifies the storage trie of an account.
|
|
141
|
+
* @private
|
|
142
|
+
* @param address - Address of the account whose storage is to be modified
|
|
143
|
+
* @param modifyTrie - Function to modify the storage trie of the account
|
|
144
|
+
*/
|
|
145
|
+
protected _modifyContractStorage(address: Address, account: Account, modifyTrie: (storageTrie: MerklePatriciaTrie, done: Function) => void): Promise<void>;
|
|
146
|
+
protected _writeContractStorage(address: Address, account: Account, key: Uint8Array, value: Uint8Array): Promise<void>;
|
|
147
|
+
/**
|
|
148
|
+
* Adds value to the state trie for the `account`
|
|
149
|
+
* corresponding to `address` at the provided `key`.
|
|
150
|
+
* @param address - Address to set a storage value for
|
|
151
|
+
* @param key - Key to set the value at. Must be 32 bytes long.
|
|
152
|
+
* @param value - Value to set at `key` for account corresponding to `address`.
|
|
153
|
+
* Cannot be more than 32 bytes. Leading zeros are stripped.
|
|
154
|
+
* If it is a empty or filled with zeros, deletes the value.
|
|
155
|
+
*/
|
|
156
|
+
putStorage(address: Address, key: Uint8Array, value: Uint8Array): Promise<void>;
|
|
157
|
+
/**
|
|
158
|
+
* Clears all storage entries for the account corresponding to `address`.
|
|
159
|
+
* @param address - Address to clear the storage of
|
|
160
|
+
*/
|
|
161
|
+
clearStorage(address: Address): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Checkpoints the current state of the StateManager instance.
|
|
164
|
+
* State changes that follow can then be committed by calling
|
|
165
|
+
* `commit` or `reverted` by calling rollback.
|
|
166
|
+
*/
|
|
167
|
+
checkpoint(): Promise<void>;
|
|
168
|
+
/**
|
|
169
|
+
* Commits the current change-set to the instance since the
|
|
170
|
+
* last call to checkpoint.
|
|
171
|
+
*/
|
|
172
|
+
commit(): Promise<void>;
|
|
173
|
+
/**
|
|
174
|
+
* Reverts the current change-set to the instance since the
|
|
175
|
+
* last call to checkpoint.
|
|
176
|
+
*/
|
|
177
|
+
revert(): Promise<void>;
|
|
178
|
+
/**
|
|
179
|
+
* Writes all cache items to the trie
|
|
180
|
+
*/
|
|
181
|
+
flush(): Promise<void>;
|
|
182
|
+
/**
|
|
183
|
+
* Gets the state-root of the Merkle-Patricia trie representation
|
|
184
|
+
* of the state of this StateManager. Will error if there are uncommitted
|
|
185
|
+
* checkpoints on the instance.
|
|
186
|
+
* @returns {Promise<Uint8Array>} - Returns the state-root of the `StateManager`
|
|
187
|
+
*/
|
|
188
|
+
getStateRoot(): Promise<Uint8Array>;
|
|
189
|
+
/**
|
|
190
|
+
* Sets the state of the instance to that represented
|
|
191
|
+
* by the provided `stateRoot`. Will error if there are uncommitted
|
|
192
|
+
* checkpoints on the instance or if the state root does not exist in
|
|
193
|
+
* the state trie.
|
|
194
|
+
* @param stateRoot - The state-root to reset the instance to
|
|
195
|
+
*/
|
|
196
|
+
setStateRoot(stateRoot: Uint8Array, clearCache?: boolean): Promise<void>;
|
|
197
|
+
/**
|
|
198
|
+
* Dumps the RLP-encoded storage values for an `account` specified by `address`.
|
|
199
|
+
* @param address - The address of the `account` to return storage for
|
|
200
|
+
* @returns {Promise<StorageDump>} - The state of the account as an `Object` map.
|
|
201
|
+
* Keys are are the storage keys, values are the storage values as strings.
|
|
202
|
+
* Both are represented as hex strings without the `0x` prefix.
|
|
203
|
+
*/
|
|
204
|
+
dumpStorage(address: Address): Promise<StorageDump>;
|
|
205
|
+
/**
|
|
206
|
+
Dumps a limited number of RLP-encoded storage values for an account specified by `address`,
|
|
207
|
+
starting from `startKey` or greater.
|
|
208
|
+
@param address - The address of the `account` to return storage for.
|
|
209
|
+
@param startKey - The bigint representation of the smallest storage key that will be returned.
|
|
210
|
+
@param limit - The maximum number of storage values that will be returned.
|
|
211
|
+
@returns {Promise<StorageRange>} - A {@link StorageRange} object that will contain at most `limit` entries in its `storage` field.
|
|
212
|
+
The object will also contain `nextKey`, the next (hashed) storage key after the range included in `storage`.
|
|
213
|
+
*/
|
|
214
|
+
dumpStorageRange(address: Address, startKey: bigint, limit: number): Promise<StorageRange>;
|
|
215
|
+
/**
|
|
216
|
+
* Initializes the provided genesis state into the state trie.
|
|
217
|
+
* Will error if there are uncommitted checkpoints on the instance.
|
|
218
|
+
* @param initState address -> balance | [balance, code, storage]
|
|
219
|
+
*/
|
|
220
|
+
generateCanonicalGenesis(initState: any): Promise<void>;
|
|
221
|
+
/**
|
|
222
|
+
* Checks whether there is a state corresponding to a stateRoot
|
|
223
|
+
*/
|
|
224
|
+
hasStateRoot(root: Uint8Array): Promise<boolean>;
|
|
225
|
+
/**
|
|
226
|
+
* Copies the current instance of the `StateManager`
|
|
227
|
+
* at the last fully committed point, i.e. as if all current
|
|
228
|
+
* checkpoints were reverted.
|
|
229
|
+
*
|
|
230
|
+
* Caches are downleveled (so: adopted for short-term usage)
|
|
231
|
+
* by default.
|
|
232
|
+
*
|
|
233
|
+
* This means in particular:
|
|
234
|
+
* 1. For caches instantiated as an LRU cache type
|
|
235
|
+
* the copy() method will instantiate with an ORDERED_MAP cache
|
|
236
|
+
* instead, since copied instances are mostly used in
|
|
237
|
+
* short-term usage contexts and LRU cache instantiation would create
|
|
238
|
+
* a large overhead here.
|
|
239
|
+
* 2. The underlying trie object is initialized with 0 cache size
|
|
240
|
+
*
|
|
241
|
+
* Both adoptions can be deactivated by setting `downlevelCaches` to
|
|
242
|
+
* `false`.
|
|
243
|
+
*
|
|
244
|
+
* Cache values are generally not copied along regardless of the
|
|
245
|
+
* `downlevelCaches` setting.
|
|
246
|
+
*/
|
|
247
|
+
shallowCopy(downlevelCaches?: boolean): MerkleStateManager;
|
|
248
|
+
/**
|
|
249
|
+
* Clears all underlying caches
|
|
250
|
+
*/
|
|
251
|
+
clearCaches(): void;
|
|
252
|
+
/**
|
|
253
|
+
* Returns the applied key for a given address
|
|
254
|
+
* Used for saving preimages
|
|
255
|
+
* @param address - The address to return the applied key
|
|
256
|
+
* @returns {Uint8Array} - The applied key (e.g. hashed address)
|
|
257
|
+
*/
|
|
258
|
+
getAppliedKey(address: Uint8Array): Uint8Array;
|
|
259
|
+
}
|
|
260
|
+
//# sourceMappingURL=merkleStateManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"merkleStateManager.d.ts","sourceRoot":"","sources":["../../src/merkleStateManager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAW,MAAM,oBAAoB,CAAA;AACpD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAA;AAEpD,OAAO,EACL,OAAO,EAeR,MAAM,kBAAkB,CAAA;AAIzB,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAA;AACvD,OAAO,KAAK,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,YAAY,CAAA;AAGhE,OAAO,KAAK,EACV,aAAa,EACb,qBAAqB,EAC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