webevm 0.7.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.
Files changed (56) hide show
  1. package/README.md +115 -63
  2. package/dist/derived-trie.d.ts +38 -0
  3. package/dist/derived-trie.d.ts.map +1 -0
  4. package/dist/derived-trie.js +187 -0
  5. package/dist/derived-trie.js.map +1 -0
  6. package/dist/engine.d.ts +1 -2
  7. package/dist/engine.d.ts.map +1 -1
  8. package/dist/engine.js +2 -3
  9. package/dist/engine.js.map +1 -1
  10. package/dist/index.d.ts +1 -1
  11. package/dist/index.d.ts.map +1 -1
  12. package/dist/index.js.map +1 -1
  13. package/dist/node.d.ts +45 -0
  14. package/dist/node.d.ts.map +1 -1
  15. package/dist/node.js +1083 -140
  16. package/dist/node.js.map +1 -1
  17. package/dist/revm-state-store.d.ts +5 -0
  18. package/dist/revm-state-store.d.ts.map +1 -1
  19. package/dist/revm-state-store.js +42 -13
  20. package/dist/revm-state-store.js.map +1 -1
  21. package/dist/revm.d.ts.map +1 -1
  22. package/dist/revm.js +5 -19
  23. package/dist/revm.js.map +1 -1
  24. package/dist/state-manager.d.ts +256 -18
  25. package/dist/state-manager.d.ts.map +1 -1
  26. package/dist/state-manager.js +429 -20
  27. package/dist/state-manager.js.map +1 -1
  28. package/dist/storage-keys.d.ts +8 -0
  29. package/dist/storage-keys.d.ts.map +1 -1
  30. package/dist/storage-keys.js +18 -2
  31. package/dist/storage-keys.js.map +1 -1
  32. package/dist/types.d.ts +150 -33
  33. package/dist/types.d.ts.map +1 -1
  34. package/dist/worker-client.d.ts.map +1 -1
  35. package/dist/worker-client.js +20 -12
  36. package/dist/worker-client.js.map +1 -1
  37. package/dist/worker-host.d.ts.map +1 -1
  38. package/dist/worker-host.js +17 -9
  39. package/dist/worker-host.js.map +1 -1
  40. package/dist/worker-rpc-error.d.ts +21 -0
  41. package/dist/worker-rpc-error.d.ts.map +1 -0
  42. package/dist/worker-rpc-error.js +121 -0
  43. package/dist/worker-rpc-error.js.map +1 -0
  44. package/package.json +3 -1
  45. package/src/derived-trie.ts +214 -0
  46. package/src/engine.ts +2 -3
  47. package/src/index.ts +2 -1
  48. package/src/node.ts +1293 -136
  49. package/src/revm-state-store.ts +47 -13
  50. package/src/revm.ts +11 -25
  51. package/src/state-manager.ts +515 -21
  52. package/src/storage-keys.ts +21 -2
  53. package/src/types.ts +152 -34
  54. package/src/worker-client.ts +22 -12
  55. package/src/worker-host.ts +17 -9
  56. package/src/worker-rpc-error.ts +139 -0
package/dist/node.d.ts CHANGED
@@ -1,3 +1,48 @@
1
+ import { type ChangeSet } from './state-manager.js';
1
2
  import { type NodeOptions, type SlimNode } from './types.js';
3
+ /**
4
+ * Switches the node's INTERNAL machinery on that no {@link NodeOptions} field
5
+ * exposes yet. NOT exported from `src/index.ts`: only this package's own tests
6
+ * and the next tasks reach it.
7
+ */
8
+ export interface NodeInternals {
9
+ /**
10
+ * Record the per-block CHANGE SET (the open record of prior values; see the
11
+ * header of ./state-manager.ts). Off by default, and a node with it off
12
+ * records nothing and pays nothing. `stateHistory` turns it on (and RETAINS
13
+ * the records); `computeStateRoot: true` does too (the change set is the list of
14
+ * keys the derived trie rehashes, ./derived-trie.ts). This flag turns on
15
+ * recording alone, for the tests, through {@link createNodeWithInternals}.
16
+ */
17
+ recordChangeSets?: boolean;
18
+ }
19
+ /**
20
+ * What {@link changeSetsForTests} returns: the change set of the HEAD block
21
+ * (taken when it was mined) and the OPEN record (every write since), as live
22
+ * read-only references. `recording: false` and both `undefined` on a node that
23
+ * does not record.
24
+ */
25
+ export interface ChangeSetProbe {
26
+ recording: boolean;
27
+ /**
28
+ * The block numbers whose change set the node RETAINS as a sealed undo record
29
+ * (`stateHistory`), oldest first. Empty on a node without history.
30
+ */
31
+ sealedBlocks: readonly number[];
32
+ /** What the last MINED block changed, with each key's value at the end of the block before it. */
33
+ headBlock: ChangeSet | undefined;
34
+ /** Every write since the head was mined (cheats, a loaded baseline is cleared). */
35
+ open: ChangeSet | undefined;
36
+ }
37
+ /**
38
+ * TEST-ONLY ACCESSOR for a node's change sets, named as such: it hands out the
39
+ * node's own record objects (read-only by contract) so a test can hold them
40
+ * against the state it reads through the public surface. Not part of
41
+ * `SlimNode` (the worker proxy's shape test would otherwise demand it cross a
42
+ * comlink boundary) and not exported from `src/index.ts`.
43
+ */
44
+ export declare function changeSetsForTests(node: SlimNode): ChangeSetProbe;
2
45
  export declare function createNode(options?: NodeOptions): Promise<SlimNode>;
46
+ /** {@link createNode} with {@link NodeInternals}; internal, see there. */
47
+ export declare function createNodeWithInternals(options: NodeOptions, internals: NodeInternals): Promise<SlimNode>;
3
48
  //# sourceMappingURL=node.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AA+EA,OAAO,EAEN,KAAK,WAAW,EAIhB,KAAK,QAAQ,EAOb,MAAM,YAAY,CAAC;AAiMpB,wBAAsB,UAAU,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAg3D7E"}
1
+ {"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAwCA,OAAO,EAIN,KAAK,SAAS,EACd,MAAM,oBAAoB,CAAC;AAiD5B,OAAO,EAEN,KAAK,WAAW,EAIhB,KAAK,QAAQ,EAQb,MAAM,YAAY,CAAC;AAqTpB;;;;GAIG;AACH,MAAM,WAAW,aAAa;IAC7B;;;;;;;OAOG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED;;;;;GAKG;AACH,MAAM,WAAW,cAAc;IAC9B,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,kGAAkG;IAClG,SAAS,EAAE,SAAS,GAAG,SAAS,CAAC;IACjC,mFAAmF;IACnF,IAAI,EAAE,SAAS,GAAG,SAAS,CAAC;CAC5B;AAID;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,cAAc,CAOjE;AA6DD,wBAAsB,UAAU,CAAC,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,QAAQ,CAAC,CAE7E;AAED,0EAA0E;AAC1E,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,aAAa,GACtB,OAAO,CAAC,QAAQ,CAAC,CAwvFnB"}