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