webevm 0.6.0 → 0.8.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/README.md +148 -63
- package/dist/derived-trie.d.ts +38 -0
- package/dist/derived-trie.d.ts.map +1 -0
- package/dist/derived-trie.js +187 -0
- package/dist/derived-trie.js.map +1 -0
- package/dist/engine.d.ts +1 -2
- package/dist/engine.d.ts.map +1 -1
- package/dist/engine.js +2 -3
- package/dist/engine.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/node.d.ts +45 -0
- package/dist/node.d.ts.map +1 -1
- package/dist/node.js +1125 -141
- package/dist/node.js.map +1 -1
- package/dist/revm-state-store.d.ts +5 -0
- package/dist/revm-state-store.d.ts.map +1 -1
- package/dist/revm-state-store.js +42 -13
- package/dist/revm-state-store.js.map +1 -1
- package/dist/revm.d.ts.map +1 -1
- package/dist/revm.js +5 -19
- package/dist/revm.js.map +1 -1
- package/dist/state-manager.d.ts +256 -18
- package/dist/state-manager.d.ts.map +1 -1
- package/dist/state-manager.js +429 -20
- package/dist/state-manager.js.map +1 -1
- package/dist/storage-keys.d.ts +8 -0
- package/dist/storage-keys.d.ts.map +1 -1
- package/dist/storage-keys.js +18 -2
- package/dist/storage-keys.js.map +1 -1
- package/dist/types.d.ts +180 -34
- package/dist/types.d.ts.map +1 -1
- package/dist/worker-client.d.ts.map +1 -1
- package/dist/worker-client.js +37 -11
- package/dist/worker-client.js.map +1 -1
- package/dist/worker-host.d.ts.map +1 -1
- package/dist/worker-host.js +21 -8
- package/dist/worker-host.js.map +1 -1
- package/dist/worker-rpc-error.d.ts +21 -0
- package/dist/worker-rpc-error.d.ts.map +1 -0
- package/dist/worker-rpc-error.js +121 -0
- package/dist/worker-rpc-error.js.map +1 -0
- package/package.json +4 -1
- package/src/derived-trie.ts +214 -0
- package/src/engine.ts +2 -3
- package/src/index.ts +3 -1
- package/src/node.ts +1335 -138
- package/src/revm-state-store.ts +47 -13
- package/src/revm.ts +11 -25
- package/src/state-manager.ts +515 -21
- package/src/storage-keys.ts +21 -2
- package/src/types.ts +183 -35
- package/src/worker-client.ts +42 -11
- package/src/worker-host.ts +21 -8
- package/src/worker-rpc-error.ts +139 -0
package/dist/state-manager.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* state-manager.ts
|
|
2
|
+
* state-manager.ts: the node's state manager, on EVERY node: a
|
|
3
|
+
* `computeStateRoot: true` node runs on it too and derives its trie from it
|
|
4
|
+
* (./derived-trie.ts, ADR 0014).
|
|
3
5
|
*
|
|
4
6
|
* `@ethereumjs/statemanager@10.1.2`'s `SimpleStateManager` keeps storage in ONE
|
|
5
7
|
* FLAT `Map` keyed `` `${address}_${slot}` ``, and `checkpointSync()` pushes a
|
|
@@ -98,19 +100,71 @@
|
|
|
98
100
|
* has to live in code we publish. That argument is even stronger for the layout,
|
|
99
101
|
* which is a representation our own `dumpState` and revm store read directly.
|
|
100
102
|
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
* has non-empty storage
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
103
|
+
* WHICH COLLISION RULE EVERY NODE FOLLOWS, and why this class is where it is
|
|
104
|
+
* decided. `@ethereumjs/evm` also carries an EIP-7610 guard, just above that
|
|
105
|
+
* call, that refuses a creation when the target has non-empty storage; it reads
|
|
106
|
+
* `account.storageRoot`, which this class never sets (`SimpleStateManager` has no
|
|
107
|
+
* trie), so the guard never fires. That is the INTENDED rule, not a gap: a
|
|
108
|
+
* creation over a zero-nonce, code-less account that holds storage SUCCEEDS and
|
|
109
|
+
* the storage is WIPED by the `clearStorage` above, which is what the reference
|
|
110
|
+
* spec specifies (EIP-684 plus the Yellow Paper, execution-specs PR #3508) and
|
|
111
|
+
* what revm does through this same state. A nonce or code at the target is still
|
|
112
|
+
* a collision on both engines. Every node follows it, with or without
|
|
113
|
+
* `computeStateRoot`, because every node runs on this class: a root-computing
|
|
114
|
+
* node derives its trie from this state rather than running on
|
|
115
|
+
* `MerkleStateManager` (whose real `storageRoot` used to make trie mode, as it
|
|
116
|
+
* was then called, refuse the creation, EIP-7610, the one
|
|
117
|
+
* behaviour that differed by mode). Decided with the user 2026-09-28; the
|
|
118
|
+
* evidence is
|
|
119
|
+
* `work/notes/findings/storage-only-creation-collisions-are-not-refused-by-the-reference-spec.md`
|
|
120
|
+
* and the record is
|
|
121
|
+
* `docs/adr/0014-the-trie-is-derived-from-the-flat-state-not-a-state-manager.md`.
|
|
122
|
+
* So a real `storageRoot` must never be written into this class's accounts: it
|
|
123
|
+
* would silently switch the EIP-7610 guard back on for that account.
|
|
124
|
+
*
|
|
125
|
+
* ## The per-block CHANGE SET (the open record), and why it lives HERE
|
|
126
|
+
*
|
|
127
|
+
* When switched on ({@link OverlayStorageStateManager.enableChangeSets}, an
|
|
128
|
+
* INTERNAL switch the node flips; no option exposes it yet), this class keeps
|
|
129
|
+
* the OPEN RECORD: every account, code entry and storage slot changed since the
|
|
130
|
+
* record was last taken, with the value each had when it was (FIRST WRITE WINS),
|
|
131
|
+
* plus a per-account "storage was cleared" marker. The node takes it at the end
|
|
132
|
+
* of each mined block, so it names what that block (and any `evm_set*` cheat
|
|
133
|
+
* issued before it) changed, and the value at the end of the previous block. It
|
|
134
|
+
* is the seam bounded state history (an undo log) and trie-from-flat-state (the
|
|
135
|
+
* keys to rehash) both stand on: `work/specs/tasked/bounded-state-history.md`.
|
|
136
|
+
*
|
|
137
|
+
* IT IS HERE, IN ONE PLACE, because every write reaches this class: the default
|
|
138
|
+
* engine's through the async `StateManagerInterface` methods overridden below,
|
|
139
|
+
* revm's through the SYNCHRONOUS by-key methods ({@link setAccountAt},
|
|
140
|
+
* {@link setCodeAt}, {@link removeAccountAt}, {@link setStorageAt},
|
|
141
|
+
* {@link clearStorageAt}) that `src/revm-state-store.ts` is required to call
|
|
142
|
+
* instead of writing the maps itself. The async writers are thin wrappers over
|
|
143
|
+
* the same by-key methods, so there is ONE recording path per key kind.
|
|
144
|
+
*
|
|
145
|
+
* CHECKPOINT-AWARE, the same way the storage overlays are. A record is kept PER
|
|
146
|
+
* CHECKPOINT LEVEL (lazily: a level with no write allocates nothing), holding the
|
|
147
|
+
* value each key had at the START of that level, which is its value in the level
|
|
148
|
+
* BELOW (frozen while this one is open, so reading it at first-write time is the
|
|
149
|
+
* same as reading it at checkpoint time). `commit()` merges the top record into
|
|
150
|
+
* the one below with the BELOW entry winning (it is older), `revert()` drops it.
|
|
151
|
+
* So a write inside a reverted frame, a reverted transaction's inner writes, and
|
|
152
|
+
* every `eth_call` / `eth_estimateGas` / state override leave no trace, by
|
|
153
|
+
* construction rather than by bookkeeping. Pure reads additionally SUSPEND
|
|
154
|
+
* recording ({@link withChangeSetsSuspended}) because their levels are always
|
|
155
|
+
* reverted: a cost rule, not a correctness one.
|
|
156
|
+
*
|
|
157
|
+
* THE PRIOR IS READ FROM THE LEVEL BELOW, NOT FROM THE LEVEL BEING WRITTEN, and
|
|
158
|
+
* that is what makes it immune to an in-place mutation inside a checkpoint
|
|
159
|
+
* (`@ethereumjs/vm` mutates the `Account` object it got and then `putAccount`s
|
|
160
|
+
* it). At the BOTTOM level there is no level below, so the prior is the map's
|
|
161
|
+
* current value, and {@link getAccount} hands out a COPY there so that no caller
|
|
162
|
+
* can mutate it before the write arrives. See {@link getAccount} for the
|
|
163
|
+
* decision and its measured cost.
|
|
111
164
|
*/
|
|
112
165
|
import { SimpleStateManager } from '@ethereumjs/statemanager';
|
|
113
|
-
import type {
|
|
166
|
+
import type { AccountFields } from '@ethereumjs/common';
|
|
167
|
+
import { Account, type Address } from '@ethereumjs/util';
|
|
114
168
|
import { type HexKey, type PackedAddressKey, type PackedSlotKey } from './storage-keys.js';
|
|
115
169
|
export type { PackedAddressKey, PackedSlotKey, HexKey } from './storage-keys.js';
|
|
116
170
|
/**
|
|
@@ -140,6 +194,51 @@ export interface StorageOverlay {
|
|
|
140
194
|
/** Accounts cleared in this overlay: every overlay below it is hidden for them. */
|
|
141
195
|
readonly cleared: Set<PackedAddressKey>;
|
|
142
196
|
}
|
|
197
|
+
/**
|
|
198
|
+
* THE PER-BLOCK CHANGE SET: for every key changed since the record was opened,
|
|
199
|
+
* the value it had THEN (`undefined` = absent). See the header's change-set
|
|
200
|
+
* section.
|
|
201
|
+
*
|
|
202
|
+
* Keys are the representation's own: accounts and code by `address.toString()`
|
|
203
|
+
* (the upstream stacks' key), storage by PACKED key (the overlays' key).
|
|
204
|
+
*/
|
|
205
|
+
export interface ChangeSet {
|
|
206
|
+
/** Account (whole) before the first change, `undefined` if it was absent. */
|
|
207
|
+
readonly accounts: Map<string, Account | undefined>;
|
|
208
|
+
/** Code by address before the first change, `undefined` if there was none. */
|
|
209
|
+
readonly code: Map<string, Uint8Array | undefined>;
|
|
210
|
+
/** Slot values before the first change, `undefined` if the slot was unset. */
|
|
211
|
+
readonly storage: Map<PackedAddressKey, Map<PackedSlotKey, Uint8Array | undefined>>;
|
|
212
|
+
/**
|
|
213
|
+
* Accounts whose storage was CLEARED (creation over storage, `SELFDESTRUCT`,
|
|
214
|
+
* EIP-161 removal). A clear also records every slot the account held, so this
|
|
215
|
+
* marker is not needed to restore a value; it tells a consumer that the
|
|
216
|
+
* account's WHOLE storage changed (a trie must rebuild it).
|
|
217
|
+
*/
|
|
218
|
+
readonly storageCleared: Set<PackedAddressKey>;
|
|
219
|
+
}
|
|
220
|
+
/** `true` when the change set records nothing. */
|
|
221
|
+
export declare function isEmptyChangeSet(cs: ChangeSet): boolean;
|
|
222
|
+
/**
|
|
223
|
+
* Merge `newer` INTO `older`, the OLDER entry winning for a key both name: it
|
|
224
|
+
* holds the value from before the first of the two changes, which is what a
|
|
225
|
+
* change set means. `newer` is consumed (its inner storage maps may be handed to
|
|
226
|
+
* `older` whole), so the caller must not use it afterwards.
|
|
227
|
+
*
|
|
228
|
+
* Two callers, one rule: {@link OverlayStorageStateManager.commit} merging a
|
|
229
|
+
* checkpoint level's record down, and the node sealing a block under the number
|
|
230
|
+
* of the block it replaces (`sealBlock` in ./node.ts).
|
|
231
|
+
*/
|
|
232
|
+
export declare function mergeChangeSetOlderWins(older: ChangeSet, newer: ChangeSet): void;
|
|
233
|
+
/**
|
|
234
|
+
* A copy of an `Account` that shares no mutable state with it: the same trick
|
|
235
|
+
* `checkpointSync()` uses (upstream's, kept byte for byte), which copies the
|
|
236
|
+
* instance's own fields onto a fresh object of the same prototype. The fields are
|
|
237
|
+
* bigints and `Uint8Array`s that are REPLACED rather than mutated, so a shallow
|
|
238
|
+
* copy is independent. Exported for the node, which hands a sealed record's
|
|
239
|
+
* account to the engine for a historical call (`historicalEntries`).
|
|
240
|
+
*/
|
|
241
|
+
export declare function copyAccount(account: Account): Account;
|
|
143
242
|
export declare class OverlayStorageStateManager extends SimpleStateManager {
|
|
144
243
|
/**
|
|
145
244
|
* The overlay stack, bottom (committed state) to top (the innermost open
|
|
@@ -154,6 +253,16 @@ export declare class OverlayStorageStateManager extends SimpleStateManager {
|
|
|
154
253
|
* NO INITIALISER — see the header's field-initialiser trap.
|
|
155
254
|
*/
|
|
156
255
|
storageOverlays: StorageOverlay[];
|
|
256
|
+
/**
|
|
257
|
+
* The change set PER CHECKPOINT LEVEL, parallel to `accountStack` (index 0 is
|
|
258
|
+
* the OPEN RECORD). `undefined` as a whole means recording is OFF, which is the
|
|
259
|
+
* default and costs nothing; an `undefined` entry means that level has written
|
|
260
|
+
* nothing yet. NO INITIALISER, for the header's field-initialiser trap: the
|
|
261
|
+
* base constructor's `checkpointSync()` runs before any field would.
|
|
262
|
+
*/
|
|
263
|
+
private changeLevels;
|
|
264
|
+
/** > 0 while a pure read runs: see {@link withChangeSetsSuspended}. */
|
|
265
|
+
private changeSetsSuspended;
|
|
157
266
|
constructor(opts?: ConstructorParameters<typeof SimpleStateManager>[0]);
|
|
158
267
|
/**
|
|
159
268
|
* Push a frame. Accounts and code exactly as upstream (they are not what this
|
|
@@ -185,6 +294,130 @@ export declare class OverlayStorageStateManager extends SimpleStateManager {
|
|
|
185
294
|
commit(): Promise<void>;
|
|
186
295
|
/** Drop the top overlay. Everything written since the checkpoint goes with it. */
|
|
187
296
|
revert(): Promise<void>;
|
|
297
|
+
/**
|
|
298
|
+
* Switch change-set recording ON. INTERNAL: called by the node when a feature
|
|
299
|
+
* that consumes change sets is on (bounded state history, trie-from-flat-state);
|
|
300
|
+
* no option exposes it directly. Only with no checkpoint open, so the level
|
|
301
|
+
* array starts parallel to the stacks.
|
|
302
|
+
*/
|
|
303
|
+
enableChangeSets(): void;
|
|
304
|
+
/** Whether {@link enableChangeSets} was called. */
|
|
305
|
+
get recordsChangeSets(): boolean;
|
|
306
|
+
/**
|
|
307
|
+
* The OPEN RECORD as it stands, without taking it. `undefined` when recording
|
|
308
|
+
* is off. Read-only by contract: the node's test-only probe and the next
|
|
309
|
+
* consumers read it; nothing may mutate it.
|
|
310
|
+
*/
|
|
311
|
+
peekChangeSet(): ChangeSet | undefined;
|
|
312
|
+
/**
|
|
313
|
+
* TAKE the open record and open a fresh one: the node calls this at the end of
|
|
314
|
+
* each mined block. `undefined` when recording is off. Refused with a
|
|
315
|
+
* checkpoint open, because the writes of an open level are not in the open
|
|
316
|
+
* record yet and would be attributed to the wrong block.
|
|
317
|
+
*/
|
|
318
|
+
takeChangeSet(): ChangeSet | undefined;
|
|
319
|
+
/**
|
|
320
|
+
* Run a PURE READ (`eth_call`, `eth_estimateGas`, a state override) with
|
|
321
|
+
* recording suspended. Its levels are always reverted, so recording there is
|
|
322
|
+
* wasted work that the revert would throw away: a COST rule. Correctness does
|
|
323
|
+
* not depend on it, and it is guarded anyway: a write at the bottom level (no
|
|
324
|
+
* checkpoint open) is still recorded, and a commit INTO the bottom level while
|
|
325
|
+
* suspended throws, since that would be a suspended write becoming state.
|
|
326
|
+
*/
|
|
327
|
+
withChangeSetsSuspended<T>(read: () => Promise<T>): Promise<T>;
|
|
328
|
+
/**
|
|
329
|
+
* The record of the CURRENT (top) level, created on first use, or `undefined`
|
|
330
|
+
* when nothing should be recorded: recording off, or a suspended pure read above
|
|
331
|
+
* the bottom level.
|
|
332
|
+
*/
|
|
333
|
+
private recordingLevel;
|
|
334
|
+
/**
|
|
335
|
+
* The stack index the PRIOR of a write is read from: the level below the top
|
|
336
|
+
* (frozen while the top is open), or the bottom itself when no checkpoint is
|
|
337
|
+
* open (read before the write lands).
|
|
338
|
+
*/
|
|
339
|
+
private priorIndex;
|
|
340
|
+
private recordAccountPrior;
|
|
341
|
+
private recordCodePrior;
|
|
342
|
+
private recordSlotPrior;
|
|
343
|
+
/**
|
|
344
|
+
* A storage CLEAR: record every slot the account held (as seen from the level
|
|
345
|
+
* below) that is not already recorded, plus the cleared marker. O(slots of
|
|
346
|
+
* that account), paid only on a clear and only with recording on.
|
|
347
|
+
*/
|
|
348
|
+
private recordClearPrior;
|
|
349
|
+
/**
|
|
350
|
+
* A commit INTO the bottom level while recording is suspended would turn a
|
|
351
|
+
* pure read's unrecorded writes into committed state behind the record, so it
|
|
352
|
+
* is refused. No pure read does it (each reverts the level it opened); this is
|
|
353
|
+
* the guard that makes the suspension a cost rule and never a correctness one.
|
|
354
|
+
*/
|
|
355
|
+
private refuseCommitIntoBottomWhileSuspended;
|
|
356
|
+
/**
|
|
357
|
+
* `commit()`'s half for the change set: merge the top level's record into the
|
|
358
|
+
* one below, the BELOW entry winning (it holds the older value: the key was
|
|
359
|
+
* written there before the checkpoint).
|
|
360
|
+
*/
|
|
361
|
+
private mergeChangeLevelDown;
|
|
362
|
+
/**
|
|
363
|
+
* Write one account SYNCHRONOUSLY, by key, into the TOP level: the account
|
|
364
|
+
* twin of {@link setStorageAt}, for revm's synchronous commit callback. The key
|
|
365
|
+
* is `address.toString()` (`0x`, lowercase), the upstream stack's key.
|
|
366
|
+
* `undefined` tombstones the account, as upstream's `putAccount` does.
|
|
367
|
+
*/
|
|
368
|
+
setAccountAt(addressKey: string, account: Account | undefined): void;
|
|
369
|
+
/**
|
|
370
|
+
* Tombstone one account SYNCHRONOUSLY, by key. The ACCOUNT only: the storage
|
|
371
|
+
* half is {@link clearStorageAt}, which revm's binding sends immediately
|
|
372
|
+
* before (see `removeAccount` in `src/revm-state-store.ts`), and the async
|
|
373
|
+
* {@link deleteAccount} does both. Code is left in place, as upstream leaves it.
|
|
374
|
+
*/
|
|
375
|
+
removeAccountAt(addressKey: string): void;
|
|
376
|
+
/**
|
|
377
|
+
* Write one account's CODE SYNCHRONOUSLY, by key, into the TOP level. The code
|
|
378
|
+
* map only: the account's `codeHash` is the caller's to write (revm's
|
|
379
|
+
* `setAccount` carries it; the async {@link putCode} writes it itself).
|
|
380
|
+
*/
|
|
381
|
+
setCodeAt(addressKey: string, code: Uint8Array): void;
|
|
382
|
+
/**
|
|
383
|
+
* Read one account, handing out a COPY WHEN NO CHECKPOINT IS OPEN.
|
|
384
|
+
*
|
|
385
|
+
* THE HAZARD: upstream returns the object stored IN the top account map.
|
|
386
|
+
* Inside a checkpoint that is harmless, because a level holds copies and the
|
|
387
|
+
* change set reads a write's prior from the level below. At the BOTTOM level
|
|
388
|
+
* (where the `evm_set*` cheats, `refuseIfSenderCannotSend` and every RPC read
|
|
389
|
+
* run) there is no level below: a caller that edits the object and then calls
|
|
390
|
+
* `putAccount` (the node's `mutateAccount`, upstream `modifyAccountFields`,
|
|
391
|
+
* reached from `putCode`) has overwritten the prior before any write hook
|
|
392
|
+
* runs, and the record would hold the NEW value as the old one.
|
|
393
|
+
*
|
|
394
|
+
* DECISION (state-change-set-capture, 2026-09-28): close it at the seam, by
|
|
395
|
+
* copying at the bottom level only, and regardless of whether change sets are
|
|
396
|
+
* on, so aliasing semantics do not depend on an internal flag. Rejected: fixing
|
|
397
|
+
* `mutateAccount` alone (upstream `modifyAccountFields` does the same);
|
|
398
|
+
* recording the prior on the first bottom-level READ (it would put every
|
|
399
|
+
* `eth_getBalance`'d key in the record, a superset the history would then
|
|
400
|
+
* store per block); copying at every level (the default engine's hot path runs
|
|
401
|
+
* inside checkpoints and needs no copy). MEASURED COST: one object allocation
|
|
402
|
+
* per bottom-level read, which is only RPC reads and cheats, never the
|
|
403
|
+
* interpreter; see
|
|
404
|
+
* `docs/spikes/state-change-set-capture/measurements.md`.
|
|
405
|
+
*/
|
|
406
|
+
getAccount(address: Address): Promise<Account | undefined>;
|
|
407
|
+
putAccount(address: Address, account?: Account | undefined): Promise<void>;
|
|
408
|
+
/**
|
|
409
|
+
* Read-modify-write of named fields. Overridden rather than inherited so the
|
|
410
|
+
* write provably goes through {@link putAccount} and the read through
|
|
411
|
+
* {@link getAccount}'s bottom-level copy, instead of depending on upstream's
|
|
412
|
+
* `modifyAccountFields` helper keeping that shape.
|
|
413
|
+
*/
|
|
414
|
+
modifyAccountFields(address: Address, accountFields: AccountFields): Promise<void>;
|
|
415
|
+
/**
|
|
416
|
+
* Upstream's `putCode`, restated so the code-map write goes through
|
|
417
|
+
* {@link setCodeAt}: the code, then an empty account if there was none, then
|
|
418
|
+
* the account's `codeHash`.
|
|
419
|
+
*/
|
|
420
|
+
putCode(address: Address, value: Uint8Array): Promise<void>;
|
|
188
421
|
private topOverlay;
|
|
189
422
|
/**
|
|
190
423
|
* Read one slot SYNCHRONOUSLY, by key, walking the overlay stack downwards.
|
|
@@ -205,6 +438,8 @@ export declare class OverlayStorageStateManager extends SimpleStateManager {
|
|
|
205
438
|
* distinguishable from the flat map's single lookup; see the spike.
|
|
206
439
|
*/
|
|
207
440
|
storageAt(addressKey: PackedAddressKey, slotKey: PackedSlotKey): Uint8Array | undefined;
|
|
441
|
+
/** {@link storageAt} as seen from overlay `from` downwards. */
|
|
442
|
+
private storageAtDepth;
|
|
208
443
|
/**
|
|
209
444
|
* Write one slot SYNCHRONOUSLY, by key, into the TOP overlay — the write-side
|
|
210
445
|
* twin of {@link storageAt}, and for the same reason it exists: revm's commit
|
|
@@ -274,15 +509,15 @@ export declare class OverlayStorageStateManager extends SimpleStateManager {
|
|
|
274
509
|
* clearing) left every slot of the dead account READABLE at its address, and
|
|
275
510
|
* `dumpState` kept serialising them. Measured through the node's own surface:
|
|
276
511
|
* after a contract that writes slot 0 and selfdestructs in the same
|
|
277
|
-
* transaction, `eth_getStorageAt` answered `0x2a`
|
|
278
|
-
* `0x0`
|
|
512
|
+
* transaction, `eth_getStorageAt` answered `0x2a` on a node computing no root and
|
|
513
|
+
* `0x0` on one computing a root (which then ran on `MerkleStateManager`)
|
|
279
514
|
* (`docs/spikes/revm-write-callbacks-reproduce-the-post-state/measurements.md`).
|
|
280
515
|
*
|
|
281
516
|
* A DELETED ACCOUNT HAS NO STORAGE, in a trie by construction: the account is
|
|
282
|
-
* removed and its storage trie goes with it, which
|
|
283
|
-
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
517
|
+
* removed and its storage trie goes with it. This makes the flat state, which
|
|
518
|
+
* every node now runs on, say the same thing (the derived trie of
|
|
519
|
+
* a `computeStateRoot` node sees this clear as a storage-cleared change), and it is
|
|
520
|
+
* the reason the revm
|
|
286
521
|
* engine — whose host is handed `clearStorage` then `removeAccount` for exactly
|
|
287
522
|
* these two cases, with revm's commit semantics already applied — now leaves
|
|
288
523
|
* post-state a diff cannot tell apart from `@ethereumjs/vm`'s. See
|
|
@@ -321,6 +556,9 @@ export declare class OverlayStorageStateManager extends SimpleStateManager {
|
|
|
321
556
|
* overlay's outer map and each inner map), because the copy's overlays are not
|
|
322
557
|
* this object's: sharing an inner map would let a write on the copy land in
|
|
323
558
|
* this manager's committed state.
|
|
559
|
+
*
|
|
560
|
+
* CHANGE-SET RECORDING IS NOT COPIED: the copy starts with it off. A copy's
|
|
561
|
+
* writes are not this node's blocks.
|
|
324
562
|
*/
|
|
325
563
|
shallowCopy(): OverlayStorageStateManager;
|
|
326
564
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"state-manager.d.ts","sourceRoot":"","sources":["../src/state-manager.ts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