@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.
Files changed (169) hide show
  1. package/LICENSE +373 -0
  2. package/README.md +331 -0
  3. package/dist/cjs/cache/account.d.ts +85 -0
  4. package/dist/cjs/cache/account.d.ts.map +1 -0
  5. package/dist/cjs/cache/account.js +252 -0
  6. package/dist/cjs/cache/account.js.map +1 -0
  7. package/dist/cjs/cache/cache.d.ts +23 -0
  8. package/dist/cjs/cache/cache.d.ts.map +1 -0
  9. package/dist/cjs/cache/cache.js +31 -0
  10. package/dist/cjs/cache/cache.js.map +1 -0
  11. package/dist/cjs/cache/caches.d.ts +19 -0
  12. package/dist/cjs/cache/caches.d.ts.map +1 -0
  13. package/dist/cjs/cache/caches.js +107 -0
  14. package/dist/cjs/cache/caches.js.map +1 -0
  15. package/dist/cjs/cache/code.d.ts +87 -0
  16. package/dist/cjs/cache/code.d.ts.map +1 -0
  17. package/dist/cjs/cache/code.js +258 -0
  18. package/dist/cjs/cache/code.js.map +1 -0
  19. package/dist/cjs/cache/index.d.ts +7 -0
  20. package/dist/cjs/cache/index.d.ts.map +1 -0
  21. package/dist/cjs/cache/index.js +23 -0
  22. package/dist/cjs/cache/index.js.map +1 -0
  23. package/dist/cjs/cache/originalStorageCache.d.ts +21 -0
  24. package/dist/cjs/cache/originalStorageCache.d.ts.map +1 -0
  25. package/dist/cjs/cache/originalStorageCache.js +52 -0
  26. package/dist/cjs/cache/originalStorageCache.js.map +1 -0
  27. package/dist/cjs/cache/storage.d.ts +101 -0
  28. package/dist/cjs/cache/storage.d.ts.map +1 -0
  29. package/dist/cjs/cache/storage.js +337 -0
  30. package/dist/cjs/cache/storage.js.map +1 -0
  31. package/dist/cjs/cache/types.d.ts +36 -0
  32. package/dist/cjs/cache/types.d.ts.map +1 -0
  33. package/dist/cjs/cache/types.js +8 -0
  34. package/dist/cjs/cache/types.js.map +1 -0
  35. package/dist/cjs/index.d.ts +8 -0
  36. package/dist/cjs/index.d.ts.map +1 -0
  37. package/dist/cjs/index.js +24 -0
  38. package/dist/cjs/index.js.map +1 -0
  39. package/dist/cjs/merkleStateManager.d.ts +260 -0
  40. package/dist/cjs/merkleStateManager.d.ts.map +1 -0
  41. package/dist/cjs/merkleStateManager.js +616 -0
  42. package/dist/cjs/merkleStateManager.js.map +1 -0
  43. package/dist/cjs/package.json +3 -0
  44. package/dist/cjs/proof/index.d.ts +3 -0
  45. package/dist/cjs/proof/index.d.ts.map +1 -0
  46. package/dist/cjs/proof/index.js +19 -0
  47. package/dist/cjs/proof/index.js.map +1 -0
  48. package/dist/cjs/proof/merkle.d.ts +40 -0
  49. package/dist/cjs/proof/merkle.d.ts.map +1 -0
  50. package/dist/cjs/proof/merkle.js +182 -0
  51. package/dist/cjs/proof/merkle.js.map +1 -0
  52. package/dist/cjs/proof/rpc.d.ts +10 -0
  53. package/dist/cjs/proof/rpc.d.ts.map +1 -0
  54. package/dist/cjs/proof/rpc.js +20 -0
  55. package/dist/cjs/proof/rpc.js.map +1 -0
  56. package/dist/cjs/rpcStateManager.d.ts +162 -0
  57. package/dist/cjs/rpcStateManager.d.ts.map +1 -0
  58. package/dist/cjs/rpcStateManager.js +313 -0
  59. package/dist/cjs/rpcStateManager.js.map +1 -0
  60. package/dist/cjs/simpleStateManager.d.ts +54 -0
  61. package/dist/cjs/simpleStateManager.d.ts.map +1 -0
  62. package/dist/cjs/simpleStateManager.js +125 -0
  63. package/dist/cjs/simpleStateManager.js.map +1 -0
  64. package/dist/cjs/statefulBinaryTreeStateManager.d.ts +69 -0
  65. package/dist/cjs/statefulBinaryTreeStateManager.d.ts.map +1 -0
  66. package/dist/cjs/statefulBinaryTreeStateManager.js +576 -0
  67. package/dist/cjs/statefulBinaryTreeStateManager.js.map +1 -0
  68. package/dist/cjs/types.d.ts +92 -0
  69. package/dist/cjs/types.d.ts.map +1 -0
  70. package/dist/cjs/types.js +3 -0
  71. package/dist/cjs/types.js.map +1 -0
  72. package/dist/cjs/util.d.ts +4 -0
  73. package/dist/cjs/util.d.ts.map +1 -0
  74. package/dist/cjs/util.js +21 -0
  75. package/dist/cjs/util.js.map +1 -0
  76. package/dist/esm/cache/account.d.ts +85 -0
  77. package/dist/esm/cache/account.d.ts.map +1 -0
  78. package/dist/esm/cache/account.js +248 -0
  79. package/dist/esm/cache/account.js.map +1 -0
  80. package/dist/esm/cache/cache.d.ts +23 -0
  81. package/dist/esm/cache/cache.d.ts.map +1 -0
  82. package/dist/esm/cache/cache.js +27 -0
  83. package/dist/esm/cache/cache.js.map +1 -0
  84. package/dist/esm/cache/caches.d.ts +19 -0
  85. package/dist/esm/cache/caches.d.ts.map +1 -0
  86. package/dist/esm/cache/caches.js +103 -0
  87. package/dist/esm/cache/caches.js.map +1 -0
  88. package/dist/esm/cache/code.d.ts +87 -0
  89. package/dist/esm/cache/code.d.ts.map +1 -0
  90. package/dist/esm/cache/code.js +254 -0
  91. package/dist/esm/cache/code.js.map +1 -0
  92. package/dist/esm/cache/index.d.ts +7 -0
  93. package/dist/esm/cache/index.d.ts.map +1 -0
  94. package/dist/esm/cache/index.js +7 -0
  95. package/dist/esm/cache/index.js.map +1 -0
  96. package/dist/esm/cache/originalStorageCache.d.ts +21 -0
  97. package/dist/esm/cache/originalStorageCache.d.ts.map +1 -0
  98. package/dist/esm/cache/originalStorageCache.js +48 -0
  99. package/dist/esm/cache/originalStorageCache.js.map +1 -0
  100. package/dist/esm/cache/storage.d.ts +101 -0
  101. package/dist/esm/cache/storage.d.ts.map +1 -0
  102. package/dist/esm/cache/storage.js +333 -0
  103. package/dist/esm/cache/storage.js.map +1 -0
  104. package/dist/esm/cache/types.d.ts +36 -0
  105. package/dist/esm/cache/types.d.ts.map +1 -0
  106. package/dist/esm/cache/types.js +5 -0
  107. package/dist/esm/cache/types.js.map +1 -0
  108. package/dist/esm/index.d.ts +8 -0
  109. package/dist/esm/index.d.ts.map +1 -0
  110. package/dist/esm/index.js +8 -0
  111. package/dist/esm/index.js.map +1 -0
  112. package/dist/esm/merkleStateManager.d.ts +260 -0
  113. package/dist/esm/merkleStateManager.d.ts.map +1 -0
  114. package/dist/esm/merkleStateManager.js +612 -0
  115. package/dist/esm/merkleStateManager.js.map +1 -0
  116. package/dist/esm/package.json +3 -0
  117. package/dist/esm/proof/index.d.ts +3 -0
  118. package/dist/esm/proof/index.d.ts.map +1 -0
  119. package/dist/esm/proof/index.js +3 -0
  120. package/dist/esm/proof/index.js.map +1 -0
  121. package/dist/esm/proof/merkle.d.ts +40 -0
  122. package/dist/esm/proof/merkle.d.ts.map +1 -0
  123. package/dist/esm/proof/merkle.js +175 -0
  124. package/dist/esm/proof/merkle.js.map +1 -0
  125. package/dist/esm/proof/rpc.d.ts +10 -0
  126. package/dist/esm/proof/rpc.d.ts.map +1 -0
  127. package/dist/esm/proof/rpc.js +17 -0
  128. package/dist/esm/proof/rpc.js.map +1 -0
  129. package/dist/esm/rpcStateManager.d.ts +162 -0
  130. package/dist/esm/rpcStateManager.d.ts.map +1 -0
  131. package/dist/esm/rpcStateManager.js +308 -0
  132. package/dist/esm/rpcStateManager.js.map +1 -0
  133. package/dist/esm/simpleStateManager.d.ts +54 -0
  134. package/dist/esm/simpleStateManager.d.ts.map +1 -0
  135. package/dist/esm/simpleStateManager.js +121 -0
  136. package/dist/esm/simpleStateManager.js.map +1 -0
  137. package/dist/esm/statefulBinaryTreeStateManager.d.ts +69 -0
  138. package/dist/esm/statefulBinaryTreeStateManager.d.ts.map +1 -0
  139. package/dist/esm/statefulBinaryTreeStateManager.js +572 -0
  140. package/dist/esm/statefulBinaryTreeStateManager.js.map +1 -0
  141. package/dist/esm/types.d.ts +92 -0
  142. package/dist/esm/types.d.ts.map +1 -0
  143. package/dist/esm/types.js +2 -0
  144. package/dist/esm/types.js.map +1 -0
  145. package/dist/esm/util.d.ts +4 -0
  146. package/dist/esm/util.d.ts.map +1 -0
  147. package/dist/esm/util.js +18 -0
  148. package/dist/esm/util.js.map +1 -0
  149. package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -0
  150. package/dist/tsconfig.prod.esm.tsbuildinfo +1 -0
  151. package/package.json +74 -0
  152. package/src/cache/account.ts +277 -0
  153. package/src/cache/cache.ts +35 -0
  154. package/src/cache/caches.ts +125 -0
  155. package/src/cache/code.ts +277 -0
  156. package/src/cache/index.ts +6 -0
  157. package/src/cache/originalStorageCache.ts +57 -0
  158. package/src/cache/storage.ts +369 -0
  159. package/src/cache/types.ts +38 -0
  160. package/src/index.ts +7 -0
  161. package/src/merkleStateManager.ts +737 -0
  162. package/src/proof/index.ts +2 -0
  163. package/src/proof/merkle.ts +264 -0
  164. package/src/proof/rpc.ts +24 -0
  165. package/src/rpcStateManager.ts +381 -0
  166. package/src/simpleStateManager.ts +154 -0
  167. package/src/statefulBinaryTreeStateManager.ts +789 -0
  168. package/src/types.ts +103 -0
  169. package/src/util.ts +28 -0
@@ -0,0 +1,612 @@
1
+ import { Common, Mainnet } from '@feelyourprotocol/common';
2
+ import { MerklePatriciaTrie } from '@feelyourprotocol/mpt';
3
+ import { RLP } from '@feelyourprotocol/rlp';
4
+ import { Account, EthereumJSErrorWithoutCode, bytesToUnprefixedHex, concatBytes, createAccount, createAccountFromRLP, createAddressFromString, equalsBytes, hexToBytes, isDebugEnabled, short, toBytes, unpadBytes, unprefixedHexToBytes, utf8ToBytes, } from '@feelyourprotocol/util';
5
+ import { keccak_256 } from '@noble/hashes/sha3.js';
6
+ import debugDefault from 'debug';
7
+ import { OriginalStorageCache } from "./cache/index.js";
8
+ import { modifyAccountFields } from "./util.js";
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 const CODEHASH_PREFIX = utf8ToBytes('c');
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 class MerkleStateManager {
34
+ /**
35
+ * Instantiate the StateManager interface.
36
+ */
37
+ constructor(opts = {}) {
38
+ /**
39
+ * StateManager is run in DEBUG mode (default: false)
40
+ * Taken from DEBUG environment variable
41
+ *
42
+ * Safeguards on debug() calls are added for
43
+ * performance reasons to avoid string literal evaluation
44
+ * @hidden
45
+ */
46
+ this.DEBUG = false;
47
+ // Skip DEBUG calls unless 'ethjs' included in environmental DEBUG variables
48
+ this.DEBUG = isDebugEnabled('ethjs');
49
+ this._debug = debugDefault('statemanager:merkle');
50
+ this.common = opts.common ?? new Common({ chain: Mainnet });
51
+ this._checkpointCount = 0;
52
+ this._trie = opts.trie ?? new MerklePatriciaTrie({ useKeyHashing: true, common: this.common });
53
+ this._storageTries = {};
54
+ this.keccakFunction = opts.common?.customCrypto.keccak256 ?? keccak_256;
55
+ this.originalStorageCache = new OriginalStorageCache(this.getStorage.bind(this));
56
+ this._prefixCodeHashes = opts.prefixCodeHashes ?? true;
57
+ this._prefixStorageTrieKeys = opts.prefixStorageTrieKeys ?? false;
58
+ this._caches = opts.caches;
59
+ }
60
+ /**
61
+ * Gets the account associated with `address` or `undefined` if account does not exist
62
+ * @param address - Address of the `account` to get
63
+ */
64
+ async getAccount(address) {
65
+ const elem = this._caches?.account?.get(address);
66
+ if (elem !== undefined) {
67
+ return elem.accountRLP !== undefined ? createAccountFromRLP(elem.accountRLP) : undefined;
68
+ }
69
+ const rlp = await this._trie.get(address.bytes);
70
+ const account = rlp !== null ? createAccountFromRLP(rlp) : undefined;
71
+ if (this.DEBUG) {
72
+ this._debug(`Get account ${address} from DB (${account ? 'exists' : 'non-existent'})`);
73
+ }
74
+ this._caches?.account?.put(address, account);
75
+ return account;
76
+ }
77
+ /**
78
+ * Saves an account into state under the provided `address`.
79
+ * @param address - Address under which to store `account`
80
+ * @param account - The account to store or undefined if to be deleted
81
+ */
82
+ async putAccount(address, account) {
83
+ if (this.DEBUG) {
84
+ this._debug(`Save account address=${address} nonce=${account?.nonce} balance=${account?.balance} contract=${account && account.isContract() ? 'yes' : 'no'} empty=${account && account.isEmpty() ? 'yes' : 'no'}`);
85
+ }
86
+ if (this._caches?.account === undefined) {
87
+ const trie = this._trie;
88
+ if (account !== undefined) {
89
+ await trie.put(address.bytes, account.serialize());
90
+ }
91
+ else {
92
+ await trie.del(address.bytes);
93
+ }
94
+ }
95
+ else {
96
+ if (account !== undefined) {
97
+ this._caches.account?.put(address, account);
98
+ }
99
+ else {
100
+ this._caches.account?.del(address);
101
+ }
102
+ }
103
+ }
104
+ /**
105
+ * Gets the account associated with `address`, modifies the given account
106
+ * fields, then saves the account into state. Account fields can include
107
+ * `nonce`, `balance`, `storageRoot`, and `codeHash`.
108
+ * @param address - Address of the account to modify
109
+ * @param accountFields - Object containing account fields and values to modify
110
+ */
111
+ async modifyAccountFields(address, accountFields) {
112
+ await modifyAccountFields(this, address, accountFields);
113
+ }
114
+ /**
115
+ * Deletes an account from state under the provided `address`.
116
+ * @param address - Address of the account which should be deleted
117
+ */
118
+ async deleteAccount(address) {
119
+ if (this.DEBUG) {
120
+ this._debug(`Delete account ${address}`);
121
+ }
122
+ this._caches?.deleteAccount(address);
123
+ if (this._caches?.account === undefined) {
124
+ await this._trie.del(address.bytes);
125
+ }
126
+ }
127
+ /**
128
+ * Adds `value` to the state trie as code, and sets `codeHash` on the account
129
+ * corresponding to `address` to reference this.
130
+ * @param address - Address of the `account` to add the `code` for
131
+ * @param value - The value of the `code`
132
+ */
133
+ async putCode(address, value) {
134
+ const codeHash = this.keccakFunction(value);
135
+ if (this._caches?.code !== undefined) {
136
+ this._caches.code.put(address, value);
137
+ }
138
+ else {
139
+ const key = this._prefixCodeHashes ? concatBytes(CODEHASH_PREFIX, codeHash) : codeHash;
140
+ await this._getCodeDB().put(key, value);
141
+ }
142
+ if (this.DEBUG) {
143
+ this._debug(`Update codeHash (-> ${short(codeHash)}) for account ${address}`);
144
+ }
145
+ if ((await this.getAccount(address)) === undefined) {
146
+ await this.putAccount(address, new Account());
147
+ }
148
+ await this.modifyAccountFields(address, { codeHash });
149
+ }
150
+ /**
151
+ * Gets the code corresponding to the provided `address`.
152
+ * @param address - Address to get the `code` for
153
+ * @returns {Promise<Uint8Array>} - Resolves with the code corresponding to the provided address.
154
+ * Returns an empty `Uint8Array` if the account has no associated code.
155
+ */
156
+ async getCode(address) {
157
+ const elem = this._caches?.code?.get(address);
158
+ if (elem !== undefined) {
159
+ return elem.code ?? new Uint8Array(0);
160
+ }
161
+ const account = await this.getAccount(address);
162
+ if (!account) {
163
+ return new Uint8Array(0);
164
+ }
165
+ if (!account.isContract()) {
166
+ return new Uint8Array(0);
167
+ }
168
+ const key = this._prefixCodeHashes
169
+ ? concatBytes(CODEHASH_PREFIX, account.codeHash)
170
+ : account.codeHash;
171
+ const code = (await this._trie.database().get(key)) ?? new Uint8Array(0);
172
+ this._caches?.code?.put(address, code);
173
+ return code;
174
+ }
175
+ async getCodeSize(address) {
176
+ const contractCode = await this.getCode(address);
177
+ return contractCode.length;
178
+ }
179
+ /**
180
+ * Gets the storage trie for the EVM-internal account identified by the provided address/hash.
181
+ * If the storage trie is not in the local cache ('this._storageTries'),
182
+ * generates a new storage trie object based on a lookup (shallow copy from 'this._trie'),
183
+ * applies the storage root of the provided rootAccount (or an
184
+ * empty trie root if no rootAccount is provided), and stores the new entry
185
+ * in the local cache.
186
+ * @param addressOrHash Address (or other object) with populated 'bytes', or a raw Uint8Array.
187
+ * Used to identify the requested storage trie in the local cache and define the
188
+ * prefix used when creating a new storage trie.
189
+ * @param rootAccount (Optional) Account object whose 'storageRoot' is to be used as
190
+ * the root of the new storageTrie returned when there is no pre-existing trie.
191
+ * If left undefined, the EMPTY_TRIE_ROOT will be used as the root instead.
192
+ * @returns storage MerklePatriciaTrie object
193
+ * @private
194
+ */
195
+ // TODO PR: have a better interface for hashed address pull?
196
+ _getStorageTrie(addressOrHash, rootAccount) {
197
+ // use hashed key for lookup from storage cache
198
+ const addressBytes = addressOrHash instanceof Uint8Array ? addressOrHash : this.keccakFunction(addressOrHash.bytes);
199
+ // Using deprecated bytesToUnprefixedHex for performance: used as object keys for trie cache lookups.
200
+ const addressHex = bytesToUnprefixedHex(addressBytes);
201
+ let storageTrie = this._storageTries[addressHex];
202
+ if (storageTrie === undefined) {
203
+ const keyPrefix = this._prefixStorageTrieKeys ? addressBytes.slice(0, 7) : undefined;
204
+ storageTrie = this._trie.shallowCopy(false, { keyPrefix });
205
+ if (rootAccount !== undefined) {
206
+ storageTrie.root(rootAccount.storageRoot);
207
+ }
208
+ else {
209
+ storageTrie.root(storageTrie.EMPTY_TRIE_ROOT);
210
+ }
211
+ storageTrie.flushCheckpoints();
212
+ this._storageTries[addressHex] = storageTrie;
213
+ }
214
+ return storageTrie;
215
+ }
216
+ /**
217
+ * Gets the storage trie for an account from the storage
218
+ * cache or does a lookup.
219
+ * @private
220
+ */
221
+ _getAccountTrie() {
222
+ return this._trie;
223
+ }
224
+ /**
225
+ * Gets the storage trie for an account from the storage
226
+ * cache or does a lookup.
227
+ * @private
228
+ */
229
+ _getCodeDB() {
230
+ return this._trie.database();
231
+ }
232
+ /**
233
+ * Gets the storage value associated with the provided `address` and `key`. This method returns
234
+ * the shortest representation of the stored value.
235
+ * @param address - Address of the account to get the storage for
236
+ * @param key - Key in the account's storage to get the value for. Must be 32 bytes long.
237
+ * @returns - The storage value for the account
238
+ * corresponding to the provided address at the provided key.
239
+ * If this does not exist an empty `Uint8Array` is returned.
240
+ */
241
+ async getStorage(address, key) {
242
+ if (key.length !== 32) {
243
+ throw EthereumJSErrorWithoutCode('Storage key must be 32 bytes long');
244
+ }
245
+ const cachedValue = this._caches?.storage?.get(address, key);
246
+ if (cachedValue !== undefined) {
247
+ const decoded = RLP.decode(cachedValue ?? new Uint8Array(0));
248
+ return decoded;
249
+ }
250
+ const account = await this.getAccount(address);
251
+ if (!account) {
252
+ return new Uint8Array();
253
+ }
254
+ const trie = this._getStorageTrie(address, account);
255
+ const value = await trie.get(key);
256
+ this._caches?.storage?.put(address, key, value ?? hexToBytes('0x80'));
257
+ const decoded = RLP.decode(value ?? new Uint8Array(0));
258
+ return decoded;
259
+ }
260
+ /**
261
+ * Modifies the storage trie of an account.
262
+ * @private
263
+ * @param address - Address of the account whose storage is to be modified
264
+ * @param modifyTrie - Function to modify the storage trie of the account
265
+ */
266
+ async _modifyContractStorage(address, account, modifyTrie) {
267
+ // eslint-disable-next-line no-async-promise-executor
268
+ return new Promise(async (resolve) => {
269
+ const storageTrie = this._getStorageTrie(address, account);
270
+ modifyTrie(storageTrie, async () => {
271
+ // update storage cache
272
+ // Using deprecated bytesToUnprefixedHex for performance: used as object keys for trie cache lookups.
273
+ const addressHex = bytesToUnprefixedHex(address.bytes);
274
+ this._storageTries[addressHex] = storageTrie;
275
+ // update contract storageRoot
276
+ account.storageRoot = storageTrie.root();
277
+ await this.putAccount(address, account);
278
+ resolve();
279
+ });
280
+ });
281
+ }
282
+ async _writeContractStorage(address, account, key, value) {
283
+ await this._modifyContractStorage(address, account, async (storageTrie, done) => {
284
+ if (value instanceof Uint8Array && value.length) {
285
+ // format input
286
+ const encodedValue = RLP.encode(value);
287
+ if (this.DEBUG) {
288
+ this._debug(`Update contract storage for account ${address} to ${short(value)}`);
289
+ }
290
+ await storageTrie.put(key, encodedValue);
291
+ }
292
+ else {
293
+ // deleting a value
294
+ if (this.DEBUG) {
295
+ this._debug(`Delete contract storage for account`);
296
+ }
297
+ await storageTrie.del(key);
298
+ }
299
+ done();
300
+ });
301
+ }
302
+ /**
303
+ * Adds value to the state trie for the `account`
304
+ * corresponding to `address` at the provided `key`.
305
+ * @param address - Address to set a storage value for
306
+ * @param key - Key to set the value at. Must be 32 bytes long.
307
+ * @param value - Value to set at `key` for account corresponding to `address`.
308
+ * Cannot be more than 32 bytes. Leading zeros are stripped.
309
+ * If it is a empty or filled with zeros, deletes the value.
310
+ */
311
+ async putStorage(address, key, value) {
312
+ if (key.length !== 32) {
313
+ throw EthereumJSErrorWithoutCode('Storage key must be 32 bytes long');
314
+ }
315
+ if (value.length > 32) {
316
+ throw EthereumJSErrorWithoutCode('Storage value cannot be longer than 32 bytes');
317
+ }
318
+ const account = await this.getAccount(address);
319
+ if (!account) {
320
+ throw EthereumJSErrorWithoutCode('putStorage() called on non-existing account');
321
+ }
322
+ value = unpadBytes(value);
323
+ this._caches?.storage?.put(address, key, RLP.encode(value)) ??
324
+ (await this._writeContractStorage(address, account, key, value));
325
+ }
326
+ /**
327
+ * Clears all storage entries for the account corresponding to `address`.
328
+ * @param address - Address to clear the storage of
329
+ */
330
+ async clearStorage(address) {
331
+ let account = await this.getAccount(address);
332
+ if (!account) {
333
+ account = new Account();
334
+ }
335
+ this._caches?.storage?.clearStorage(address);
336
+ await this._modifyContractStorage(address, account, (storageTrie, done) => {
337
+ storageTrie.root(storageTrie.EMPTY_TRIE_ROOT);
338
+ done();
339
+ });
340
+ }
341
+ /**
342
+ * Checkpoints the current state of the StateManager instance.
343
+ * State changes that follow can then be committed by calling
344
+ * `commit` or `reverted` by calling rollback.
345
+ */
346
+ async checkpoint() {
347
+ this._trie.checkpoint();
348
+ this._caches?.checkpoint();
349
+ this._checkpointCount++;
350
+ }
351
+ /**
352
+ * Commits the current change-set to the instance since the
353
+ * last call to checkpoint.
354
+ */
355
+ async commit() {
356
+ // setup trie checkpointing
357
+ await this._trie.commit();
358
+ this._caches?.commit();
359
+ this._checkpointCount--;
360
+ if (this._checkpointCount === 0) {
361
+ await this.flush();
362
+ this.originalStorageCache.clear();
363
+ }
364
+ if (this.DEBUG) {
365
+ this._debug(`state checkpoint committed`);
366
+ }
367
+ }
368
+ /**
369
+ * Reverts the current change-set to the instance since the
370
+ * last call to checkpoint.
371
+ */
372
+ async revert() {
373
+ // setup trie checkpointing
374
+ await this._trie.revert();
375
+ this._caches?.revert();
376
+ this._storageTries = {};
377
+ this._checkpointCount--;
378
+ if (this._checkpointCount === 0) {
379
+ await this.flush();
380
+ this.originalStorageCache.clear();
381
+ }
382
+ }
383
+ /**
384
+ * Writes all cache items to the trie
385
+ */
386
+ async flush() {
387
+ const codeItems = this._caches?.code?.flush() ?? [];
388
+ for (const item of codeItems) {
389
+ const addr = createAddressFromString(`0x${item[0]}`);
390
+ const code = item[1].code;
391
+ if (code === undefined) {
392
+ continue;
393
+ }
394
+ // update code in database
395
+ const codeHash = this.keccakFunction(code);
396
+ const key = this._prefixCodeHashes ? concatBytes(CODEHASH_PREFIX, codeHash) : codeHash;
397
+ await this._getCodeDB().put(key, code);
398
+ // update code root of associated account
399
+ if ((await this.getAccount(addr)) === undefined) {
400
+ await this.putAccount(addr, new Account());
401
+ }
402
+ await this.modifyAccountFields(addr, { codeHash });
403
+ }
404
+ const storageItems = this._caches?.storage?.flush() ?? [];
405
+ for (const item of storageItems) {
406
+ const address = createAddressFromString(`0x${item[0]}`);
407
+ const keyHex = item[1];
408
+ const keyBytes = unprefixedHexToBytes(keyHex);
409
+ const value = item[2];
410
+ const decoded = RLP.decode(value ?? new Uint8Array(0));
411
+ const account = await this.getAccount(address);
412
+ if (account) {
413
+ await this._writeContractStorage(address, account, keyBytes, decoded);
414
+ }
415
+ }
416
+ const accountItems = this._caches?.account?.flush() ?? [];
417
+ for (const item of accountItems) {
418
+ const addressHex = item[0];
419
+ const addressBytes = unprefixedHexToBytes(addressHex);
420
+ const elem = item[1];
421
+ if (elem.accountRLP === undefined) {
422
+ const trie = this._trie;
423
+ await trie.del(addressBytes);
424
+ }
425
+ else {
426
+ const trie = this._trie;
427
+ await trie.put(addressBytes, elem.accountRLP);
428
+ }
429
+ }
430
+ }
431
+ /**
432
+ * Gets the state-root of the Merkle-Patricia trie representation
433
+ * of the state of this StateManager. Will error if there are uncommitted
434
+ * checkpoints on the instance.
435
+ * @returns {Promise<Uint8Array>} - Returns the state-root of the `StateManager`
436
+ */
437
+ async getStateRoot() {
438
+ await this.flush();
439
+ return this._trie.root();
440
+ }
441
+ /**
442
+ * Sets the state of the instance to that represented
443
+ * by the provided `stateRoot`. Will error if there are uncommitted
444
+ * checkpoints on the instance or if the state root does not exist in
445
+ * the state trie.
446
+ * @param stateRoot - The state-root to reset the instance to
447
+ */
448
+ async setStateRoot(stateRoot, clearCache = true) {
449
+ await this.flush();
450
+ if (!equalsBytes(stateRoot, this._trie.EMPTY_TRIE_ROOT)) {
451
+ const hasRoot = await this._trie.checkRoot(stateRoot);
452
+ if (!hasRoot) {
453
+ throw EthereumJSErrorWithoutCode('State trie does not contain state root');
454
+ }
455
+ }
456
+ this._trie.root(stateRoot);
457
+ if (clearCache) {
458
+ this._caches?.clear();
459
+ }
460
+ this._storageTries = {};
461
+ }
462
+ /**
463
+ * Dumps the RLP-encoded storage values for an `account` specified by `address`.
464
+ * @param address - The address of the `account` to return storage for
465
+ * @returns {Promise<StorageDump>} - The state of the account as an `Object` map.
466
+ * Keys are are the storage keys, values are the storage values as strings.
467
+ * Both are represented as hex strings without the `0x` prefix.
468
+ */
469
+ async dumpStorage(address) {
470
+ await this.flush();
471
+ const account = await this.getAccount(address);
472
+ if (!account) {
473
+ throw EthereumJSErrorWithoutCode(`dumpStorage f() can only be called for an existing account`);
474
+ }
475
+ const trie = this._getStorageTrie(address, account);
476
+ return trie.getValueMap().then((value) => {
477
+ return value.values;
478
+ });
479
+ }
480
+ /**
481
+ Dumps a limited number of RLP-encoded storage values for an account specified by `address`,
482
+ starting from `startKey` or greater.
483
+ @param address - The address of the `account` to return storage for.
484
+ @param startKey - The bigint representation of the smallest storage key that will be returned.
485
+ @param limit - The maximum number of storage values that will be returned.
486
+ @returns {Promise<StorageRange>} - A {@link StorageRange} object that will contain at most `limit` entries in its `storage` field.
487
+ The object will also contain `nextKey`, the next (hashed) storage key after the range included in `storage`.
488
+ */
489
+ async dumpStorageRange(address, startKey, limit) {
490
+ if (!Number.isSafeInteger(limit) || limit < 0) {
491
+ throw EthereumJSErrorWithoutCode(`Limit is not a proper uint.`);
492
+ }
493
+ await this.flush();
494
+ const account = await this.getAccount(address);
495
+ if (!account) {
496
+ throw EthereumJSErrorWithoutCode(`Account does not exist.`);
497
+ }
498
+ const trie = this._getStorageTrie(address, account);
499
+ return trie.getValueMap(startKey, limit).then((value) => {
500
+ const values = value.values;
501
+ const dump = Object.create(null);
502
+ for (const key of Object.keys(values)) {
503
+ const val = values[key];
504
+ dump[key] = {
505
+ key: null,
506
+ value: val,
507
+ };
508
+ }
509
+ return {
510
+ storage: dump,
511
+ nextKey: value.nextKey,
512
+ };
513
+ });
514
+ }
515
+ /**
516
+ * Initializes the provided genesis state into the state trie.
517
+ * Will error if there are uncommitted checkpoints on the instance.
518
+ * @param initState address -> balance | [balance, code, storage]
519
+ */
520
+ async generateCanonicalGenesis(initState) {
521
+ if (this._checkpointCount !== 0) {
522
+ throw EthereumJSErrorWithoutCode('Cannot create genesis state with uncommitted checkpoints');
523
+ }
524
+ if (this.DEBUG) {
525
+ this._debug(`Save genesis state into the state trie`);
526
+ }
527
+ const addresses = Object.keys(initState);
528
+ for (const address of addresses) {
529
+ const addr = createAddressFromString(address);
530
+ const state = initState[address];
531
+ if (!Array.isArray(state)) {
532
+ // Prior format: address -> balance
533
+ const account = createAccount({ balance: state });
534
+ await this.putAccount(addr, account);
535
+ }
536
+ else {
537
+ // New format: address -> [balance, code, storage]
538
+ const [balance, code, storage, nonce] = state;
539
+ const account = createAccount({ balance, nonce });
540
+ await this.putAccount(addr, account);
541
+ if (code !== undefined) {
542
+ await this.putCode(addr, toBytes(code));
543
+ }
544
+ if (storage !== undefined) {
545
+ for (const [key, value] of storage) {
546
+ await this.putStorage(addr, toBytes(key), toBytes(value));
547
+ }
548
+ }
549
+ }
550
+ }
551
+ await this.flush();
552
+ }
553
+ /**
554
+ * Checks whether there is a state corresponding to a stateRoot
555
+ */
556
+ async hasStateRoot(root) {
557
+ return this._trie.checkRoot(root);
558
+ }
559
+ /**
560
+ * Copies the current instance of the `StateManager`
561
+ * at the last fully committed point, i.e. as if all current
562
+ * checkpoints were reverted.
563
+ *
564
+ * Caches are downleveled (so: adopted for short-term usage)
565
+ * by default.
566
+ *
567
+ * This means in particular:
568
+ * 1. For caches instantiated as an LRU cache type
569
+ * the copy() method will instantiate with an ORDERED_MAP cache
570
+ * instead, since copied instances are mostly used in
571
+ * short-term usage contexts and LRU cache instantiation would create
572
+ * a large overhead here.
573
+ * 2. The underlying trie object is initialized with 0 cache size
574
+ *
575
+ * Both adoptions can be deactivated by setting `downlevelCaches` to
576
+ * `false`.
577
+ *
578
+ * Cache values are generally not copied along regardless of the
579
+ * `downlevelCaches` setting.
580
+ */
581
+ shallowCopy(downlevelCaches = true) {
582
+ const common = this.common.copy();
583
+ common.setHardfork(this.common.hardfork());
584
+ const cacheSize = !downlevelCaches ? this._trie['_opts']['cacheSize'] : 0;
585
+ const trie = this._trie.shallowCopy(false, { cacheSize });
586
+ const prefixCodeHashes = this._prefixCodeHashes;
587
+ const prefixStorageTrieKeys = this._prefixStorageTrieKeys;
588
+ return new MerkleStateManager({
589
+ common,
590
+ trie,
591
+ prefixStorageTrieKeys,
592
+ prefixCodeHashes,
593
+ caches: this._caches?.shallowCopy(downlevelCaches),
594
+ });
595
+ }
596
+ /**
597
+ * Clears all underlying caches
598
+ */
599
+ clearCaches() {
600
+ this._caches?.clear();
601
+ }
602
+ /**
603
+ * Returns the applied key for a given address
604
+ * Used for saving preimages
605
+ * @param address - The address to return the applied key
606
+ * @returns {Uint8Array} - The applied key (e.g. hashed address)
607
+ */
608
+ getAppliedKey(address) {
609
+ return this._trie['appliedKey'](address);
610
+ }
611
+ }
612
+ //# sourceMappingURL=merkleStateManager.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"merkleStateMan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 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/proof/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA"}
@@ -0,0 +1,3 @@
1
+ export * from "./merkle.js";
2
+ export * from "./rpc.js";
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/proof/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA;AAC3B,cAAc,UAAU,CAAA"}