@feelyourprotocol/vm 8141.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +373 -0
- package/README.md +583 -0
- package/dist/cjs/bloom/index.d.ts +29 -0
- package/dist/cjs/bloom/index.d.ts.map +1 -0
- package/dist/cjs/bloom/index.js +76 -0
- package/dist/cjs/bloom/index.js.map +1 -0
- package/dist/cjs/buildBlock.d.ts +118 -0
- package/dist/cjs/buildBlock.d.ts.map +1 -0
- package/dist/cjs/buildBlock.js +363 -0
- package/dist/cjs/buildBlock.js.map +1 -0
- package/dist/cjs/constructors.d.ts +9 -0
- package/dist/cjs/constructors.d.ts.map +1 -0
- package/dist/cjs/constructors.js +75 -0
- package/dist/cjs/constructors.js.map +1 -0
- package/dist/cjs/emitEVMProfile.d.ts +9 -0
- package/dist/cjs/emitEVMProfile.d.ts.map +1 -0
- package/dist/cjs/emitEVMProfile.js +130 -0
- package/dist/cjs/emitEVMProfile.js.map +1 -0
- package/dist/cjs/index.d.ts +11 -0
- package/dist/cjs/index.d.ts.map +1 -0
- package/dist/cjs/index.js +36 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/package.json +3 -0
- package/dist/cjs/params.d.ts +3 -0
- package/dist/cjs/params.d.ts.map +1 -0
- package/dist/cjs/params.js +105 -0
- package/dist/cjs/params.js.map +1 -0
- package/dist/cjs/requests.d.ts +11 -0
- package/dist/cjs/requests.d.ts.map +1 -0
- package/dist/cjs/requests.js +208 -0
- package/dist/cjs/requests.js.map +1 -0
- package/dist/cjs/runBlock.d.ts +35 -0
- package/dist/cjs/runBlock.d.ts.map +1 -0
- package/dist/cjs/runBlock.js +797 -0
- package/dist/cjs/runBlock.js.map +1 -0
- package/dist/cjs/runFrameTx.d.ts +18 -0
- package/dist/cjs/runFrameTx.d.ts.map +1 -0
- package/dist/cjs/runFrameTx.js +313 -0
- package/dist/cjs/runFrameTx.js.map +1 -0
- package/dist/cjs/runTx.d.ts +18 -0
- package/dist/cjs/runTx.d.ts.map +1 -0
- package/dist/cjs/runTx.js +900 -0
- package/dist/cjs/runTx.js.map +1 -0
- package/dist/cjs/types.d.ts +452 -0
- package/dist/cjs/types.d.ts.map +1 -0
- package/dist/cjs/types.js +3 -0
- package/dist/cjs/types.js.map +1 -0
- package/dist/cjs/vm.d.ts +75 -0
- package/dist/cjs/vm.d.ts.map +1 -0
- package/dist/cjs/vm.js +111 -0
- package/dist/cjs/vm.js.map +1 -0
- package/dist/esm/bloom/index.d.ts +29 -0
- package/dist/esm/bloom/index.d.ts.map +1 -0
- package/dist/esm/bloom/index.js +72 -0
- package/dist/esm/bloom/index.js.map +1 -0
- package/dist/esm/buildBlock.d.ts +118 -0
- package/dist/esm/buildBlock.d.ts.map +1 -0
- package/dist/esm/buildBlock.js +358 -0
- package/dist/esm/buildBlock.js.map +1 -0
- package/dist/esm/constructors.d.ts +9 -0
- package/dist/esm/constructors.d.ts.map +1 -0
- package/dist/esm/constructors.js +72 -0
- package/dist/esm/constructors.js.map +1 -0
- package/dist/esm/emitEVMProfile.d.ts +9 -0
- package/dist/esm/emitEVMProfile.d.ts.map +1 -0
- package/dist/esm/emitEVMProfile.js +127 -0
- package/dist/esm/emitEVMProfile.js.map +1 -0
- package/dist/esm/index.d.ts +11 -0
- package/dist/esm/index.d.ts.map +1 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/package.json +3 -0
- package/dist/esm/params.d.ts +3 -0
- package/dist/esm/params.d.ts.map +1 -0
- package/dist/esm/params.js +102 -0
- package/dist/esm/params.js.map +1 -0
- package/dist/esm/requests.d.ts +11 -0
- package/dist/esm/requests.d.ts.map +1 -0
- package/dist/esm/requests.js +204 -0
- package/dist/esm/requests.js.map +1 -0
- package/dist/esm/runBlock.d.ts +35 -0
- package/dist/esm/runBlock.d.ts.map +1 -0
- package/dist/esm/runBlock.js +790 -0
- package/dist/esm/runBlock.js.map +1 -0
- package/dist/esm/runFrameTx.d.ts +18 -0
- package/dist/esm/runFrameTx.d.ts.map +1 -0
- package/dist/esm/runFrameTx.js +310 -0
- package/dist/esm/runFrameTx.js.map +1 -0
- package/dist/esm/runTx.d.ts +18 -0
- package/dist/esm/runTx.d.ts.map +1 -0
- package/dist/esm/runTx.js +896 -0
- package/dist/esm/runTx.js.map +1 -0
- package/dist/esm/types.d.ts +452 -0
- package/dist/esm/types.d.ts.map +1 -0
- package/dist/esm/types.js +2 -0
- package/dist/esm/types.js.map +1 -0
- package/dist/esm/vm.d.ts +75 -0
- package/dist/esm/vm.d.ts.map +1 -0
- package/dist/esm/vm.js +107 -0
- package/dist/esm/vm.js.map +1 -0
- package/dist/tsconfig.prod.cjs.tsbuildinfo +1 -0
- package/dist/tsconfig.prod.esm.tsbuildinfo +1 -0
- package/package.json +117 -0
- package/src/bloom/index.ts +83 -0
- package/src/buildBlock.ts +470 -0
- package/src/constructors.ts +91 -0
- package/src/emitEVMProfile.ts +151 -0
- package/src/index.ts +10 -0
- package/src/params.ts +104 -0
- package/src/requests.ts +293 -0
- package/src/runBlock.ts +1022 -0
- package/src/runFrameTx.ts +411 -0
- package/src/runTx.ts +1203 -0
- package/src/types.ts +511 -0
- package/src/vm.ts +147 -0
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Bloom = void 0;
|
|
4
|
+
const util_1 = require("@feelyourprotocol/util");
|
|
5
|
+
const sha3_js_1 = require("@noble/hashes/sha3.js");
|
|
6
|
+
const BYTE_SIZE = 256;
|
|
7
|
+
class Bloom {
|
|
8
|
+
/**
|
|
9
|
+
* Represents a Bloom filter.
|
|
10
|
+
*/
|
|
11
|
+
constructor(bitvector, common) {
|
|
12
|
+
if (common?.customCrypto.keccak256 !== undefined) {
|
|
13
|
+
this.keccakFunction = common.customCrypto.keccak256;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
this.keccakFunction = sha3_js_1.keccak_256;
|
|
17
|
+
}
|
|
18
|
+
if (!bitvector) {
|
|
19
|
+
this.bitvector = new Uint8Array(BYTE_SIZE);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
if (bitvector.length !== BYTE_SIZE)
|
|
23
|
+
throw (0, util_1.EthereumJSErrorWithoutCode)('bitvectors must be 2048 bits long');
|
|
24
|
+
this.bitvector = bitvector;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Adds an element to a bit vector of a 64 byte bloom filter.
|
|
29
|
+
* @param e - The element to add
|
|
30
|
+
*/
|
|
31
|
+
add(e) {
|
|
32
|
+
e = this.keccakFunction(e);
|
|
33
|
+
const mask = 2047; // binary 11111111111
|
|
34
|
+
for (let i = 0; i < 3; i++) {
|
|
35
|
+
const first2bytes = new DataView(e.buffer).getUint16(i * 2);
|
|
36
|
+
const loc = mask & first2bytes;
|
|
37
|
+
const byteLoc = loc >> 3;
|
|
38
|
+
const bitLoc = 1 << (loc % 8);
|
|
39
|
+
this.bitvector[BYTE_SIZE - byteLoc - 1] |= bitLoc;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Checks if an element is in the bloom.
|
|
44
|
+
* @param e - The element to check
|
|
45
|
+
*/
|
|
46
|
+
check(e) {
|
|
47
|
+
e = this.keccakFunction(e);
|
|
48
|
+
const mask = 2047; // binary 11111111111
|
|
49
|
+
let match = true;
|
|
50
|
+
for (let i = 0; i < 3 && match; i++) {
|
|
51
|
+
const first2bytes = new DataView(e.buffer).getUint16(i * 2);
|
|
52
|
+
const loc = mask & first2bytes;
|
|
53
|
+
const byteLoc = loc >> 3;
|
|
54
|
+
const bitLoc = 1 << (loc % 8);
|
|
55
|
+
match = (this.bitvector[BYTE_SIZE - byteLoc - 1] & bitLoc) !== 0;
|
|
56
|
+
}
|
|
57
|
+
return Boolean(match);
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Checks if multiple topics are in a bloom.
|
|
61
|
+
* @returns `true` if every topic is in the bloom
|
|
62
|
+
*/
|
|
63
|
+
multiCheck(topics) {
|
|
64
|
+
return topics.every((t) => this.check(t));
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Bitwise or blooms together.
|
|
68
|
+
*/
|
|
69
|
+
or(bloom) {
|
|
70
|
+
for (let i = 0; i <= BYTE_SIZE; i++) {
|
|
71
|
+
this.bitvector[i] = this.bitvector[i] | bloom.bitvector[i];
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
exports.Bloom = Bloom;
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/bloom/index.ts"],"names":[],"mappings":";;;AAAA,2CAA6D;AAC7D,mDAAkD;AAIlD,MAAM,SAAS,GAAG,GAAG,CAAA;AAErB,MAAa,KAAK;IAIhB;;OAEG;IACH,YAAY,SAAsB,EAAE,MAAe;QACjD,IAAI,MAAM,EAAE,YAAY,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YACjD,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC,YAAY,CAAC,SAAS,CAAA;QACrD,CAAC;aAAM,CAAC;YACN,IAAI,CAAC,cAAc,GAAG,oBAAU,CAAA;QAClC,CAAC;QACD,IAAI,CAAC,SAAS,EAAE,CAAC;YACf,IAAI,CAAC,SAAS,GAAG,IAAI,UAAU,CAAC,SAAS,CAAC,CAAA;QAC5C,CAAC;aAAM,CAAC;YACN,IAAI,SAAS,CAAC,MAAM,KAAK,SAAS;gBAChC,MAAM,IAAA,iCAA0B,EAAC,mCAAmC,CAAC,CAAA;YACvE,IAAI,CAAC,SAAS,GAAG,SAAS,CAAA;QAC5B,CAAC;IACH,CAAC;IAED;;;OAGG;IACH,GAAG,CAAC,CAAa;QACf,CAAC,GAAG,IAAI,CAAC,cAAc,CAAC,CAAC,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K,CAAC,CAAA;QAClE,CAAC;QAED,OAAO,OAAO,CAAC,KAAK,CAAC,CAAA;IACvB,CAAC;IAED;;;OAGG;IACH,UAAU,CAAC,MAAoB;QAC7B,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAa,EAAE,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA;IACvD,CAAC;IAED;;OAEG;IACH,EAAE,CAAC,KAAY;QACb,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,SAAS,EAAE,CAAC,EAAE,EAAE,CAAC;YACpC,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;CACF;AA3ED,sBA2EC"}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import type { Block } from '@feelyourprotocol/block';
|
|
2
|
+
import type { TypedTransaction } from '@feelyourprotocol/tx';
|
|
3
|
+
import type { BuildBlockOpts, RunTxResult, SealBlockOpts } from './types.ts';
|
|
4
|
+
import type { VM } from './vm.ts';
|
|
5
|
+
export type BuildStatus = (typeof BuildStatus)[keyof typeof BuildStatus];
|
|
6
|
+
export declare const BuildStatus: {
|
|
7
|
+
readonly Reverted: "reverted";
|
|
8
|
+
readonly Build: "build";
|
|
9
|
+
readonly Pending: "pending";
|
|
10
|
+
};
|
|
11
|
+
type BlockStatus = {
|
|
12
|
+
status: typeof BuildStatus.Pending | typeof BuildStatus.Reverted;
|
|
13
|
+
} | {
|
|
14
|
+
status: typeof BuildStatus.Build;
|
|
15
|
+
block: Block;
|
|
16
|
+
};
|
|
17
|
+
export declare class BlockBuilder {
|
|
18
|
+
/**
|
|
19
|
+
* The cumulative gas used by the transactions added to the block.
|
|
20
|
+
*/
|
|
21
|
+
gasUsed: bigint;
|
|
22
|
+
/**
|
|
23
|
+
* The cumulative blob gas used by the blobs in a block
|
|
24
|
+
*/
|
|
25
|
+
blobGasUsed: bigint;
|
|
26
|
+
/**
|
|
27
|
+
* Value of the block, represented by the final transaction fees
|
|
28
|
+
* accruing to the miner.
|
|
29
|
+
*/
|
|
30
|
+
private _minerValue;
|
|
31
|
+
private readonly vm;
|
|
32
|
+
private blockOpts;
|
|
33
|
+
private headerData;
|
|
34
|
+
private transactions;
|
|
35
|
+
private transactionResults;
|
|
36
|
+
private withdrawals?;
|
|
37
|
+
private checkpointed;
|
|
38
|
+
private blockStatus;
|
|
39
|
+
get transactionReceipts(): import("./types.ts").TxReceipt[];
|
|
40
|
+
get minerValue(): bigint;
|
|
41
|
+
constructor(vm: VM, opts: BuildBlockOpts);
|
|
42
|
+
/**
|
|
43
|
+
* Throws if the block has already been built or reverted.
|
|
44
|
+
*/
|
|
45
|
+
private checkStatus;
|
|
46
|
+
getStatus(): BlockStatus;
|
|
47
|
+
/**
|
|
48
|
+
* Calculates and returns the transactionsTrie for the block.
|
|
49
|
+
*/
|
|
50
|
+
transactionsTrie(): Promise<Uint8Array<ArrayBufferLike>>;
|
|
51
|
+
/**
|
|
52
|
+
* Calculates and returns the logs bloom for the block.
|
|
53
|
+
*/
|
|
54
|
+
logsBloom(): Uint8Array<ArrayBufferLike>;
|
|
55
|
+
/**
|
|
56
|
+
* Calculates and returns the receiptTrie for the block.
|
|
57
|
+
*/
|
|
58
|
+
receiptTrie(): Promise<Uint8Array<ArrayBufferLike>>;
|
|
59
|
+
/**
|
|
60
|
+
* Adds the block miner reward to the coinbase account.
|
|
61
|
+
*/
|
|
62
|
+
private rewardMiner;
|
|
63
|
+
/**
|
|
64
|
+
* Adds the withdrawal amount to the withdrawal address
|
|
65
|
+
*/
|
|
66
|
+
private processWithdrawals;
|
|
67
|
+
/**
|
|
68
|
+
* Run and add a transaction to the block being built.
|
|
69
|
+
* Please note that this modifies the state of the VM.
|
|
70
|
+
* Throws if the transaction's gasLimit is greater than
|
|
71
|
+
* the remaining gas in the block.
|
|
72
|
+
*/
|
|
73
|
+
addTransaction(tx: TypedTransaction, { skipHardForkValidation, allowNoBlobs, }?: {
|
|
74
|
+
skipHardForkValidation?: boolean;
|
|
75
|
+
allowNoBlobs?: boolean;
|
|
76
|
+
}): Promise<RunTxResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Reverts the checkpoint on the StateManager to reset the state from any transactions that have been run.
|
|
79
|
+
*/
|
|
80
|
+
revert(): Promise<void>;
|
|
81
|
+
/**
|
|
82
|
+
* This method constructs the finalized block, including withdrawals and any CLRequests.
|
|
83
|
+
* It also:
|
|
84
|
+
* - Assigns the reward for miner (PoW)
|
|
85
|
+
* - Commits the checkpoint on the StateManager
|
|
86
|
+
* - Sets the tip of the VM's blockchain to this block
|
|
87
|
+
* For PoW, optionally seals the block with params `nonce` and `mixHash`,
|
|
88
|
+
* which is validated along with the block number and difficulty by ethash.
|
|
89
|
+
* For PoA, please pass `blockOption.cliqueSigner` into the buildBlock constructor,
|
|
90
|
+
* as the signer will be awarded the txs amount spent on gas as they are added.
|
|
91
|
+
*
|
|
92
|
+
* Note: we add CLRequests here because they can be generated at any time during the
|
|
93
|
+
* lifecycle of a pending block so need to be provided only when the block is finalized.
|
|
94
|
+
*/
|
|
95
|
+
build(sealOpts?: SealBlockOpts): Promise<{
|
|
96
|
+
block: Block;
|
|
97
|
+
requests: import("@feelyourprotocol/util").CLRequest<import("@feelyourprotocol/util").CLRequestType>[] | undefined;
|
|
98
|
+
}>;
|
|
99
|
+
initState(): Promise<void>;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Build a block on top of the current state
|
|
103
|
+
* by adding one transaction at a time.
|
|
104
|
+
*
|
|
105
|
+
* Creates a checkpoint on the StateManager and modifies the state
|
|
106
|
+
* as transactions are run. The checkpoint is committed on {@link BlockBuilder.build}
|
|
107
|
+
* or discarded with {@link BlockBuilder.revert}.
|
|
108
|
+
*
|
|
109
|
+
* @param {VM} vm
|
|
110
|
+
* @param {BuildBlockOpts} opts
|
|
111
|
+
* @returns An instance of {@link BlockBuilder} with methods:
|
|
112
|
+
* - {@link BlockBuilder.addTransaction}
|
|
113
|
+
* - {@link BlockBuilder.build}
|
|
114
|
+
* - {@link BlockBuilder.revert}
|
|
115
|
+
*/
|
|
116
|
+
export declare function buildBlock(vm: VM, opts: BuildBlockOpts): Promise<BlockBuilder>;
|
|
117
|
+
export {};
|
|
118
|
+
//# sourceMappingURL=buildBlock.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildBlock.d.ts","sourceRoot":"","sources":["../../src/buildBlock.ts"],"names":[],"mappings":"AA0CA,OAAO,KAAK,EAAE,KAAK,EAAc,MAAM,mBAAmB,CAAA;AAC1D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAEtD,OAAO,KAAK,EAAE,cAAc,EAAe,WAAW,EAAE,aAAa,EAAE,MAAM,YAAY,CAAA;AACzF,OAAO,KAAK,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAEjC,MAAM,MAAM,WAAW,GAAG,CAAC,OAAO,WAAW,CAAC,CAAC,MAAM,OAAO,WAAW,CAAC,CAAA;AACxE,eAAO,MAAM,WAAW;;;;CAId,CAAA;AAEV,KAAK,WAAW,GACZ;IAAE,MAAM,EAAE,OAAO,WAAW,CAAC,OAAO,GAAG,OAAO,WAAW,CAAC,QAAQ,CAAA;CAAE,GACpE;IAAE,MAAM,EAAE,OAAO,WAAW,CAAC,KAAK,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAA;AAEtD,qBAAa,YAAY;IACvB;;OAEG;IACH,OAAO,SAAW;IAClB;;OAEG;IACH,WAAW,SAAW;IACtB;;;OAGG;IACH,OAAO,CAAC,WAAW,CAAW;IAE9B,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAI;IACvB,OAAO,CAAC,SAAS,CAAa;IAC9B,OAAO,CAAC,UAAU,CAAY;IAC9B,OAAO,CAAC,YAAY,CAAyB;IAC7C,OAAO,CAAC,kBAAkB,CAAoB;IAC9C,OAAO,CAAC,WAAW,CAAC,CAAc;IAClC,OAAO,CAAC,YAAY,CAAQ;IAC5B,OAAO,CAAC,WAAW,CAA+C;IAElE,IAAI,mBAAmB,qCAEtB;IAED,IAAI,UAAU,WAEb;gBAEW,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc;IAwCxC;;OAEG;IACH,OAAO,CAAC,WAAW;IASZ,SAAS,IAAI,WAAW;IAI/B;;OAEG;IACU,gBAAgB;IAO7B;;OAEG;IACI,SAAS;IAShB;;OAEG;IACU,WAAW;IAaxB;;OAEG;YACW,WAAW;IAUzB;;OAEG;YACW,kBAAkB;IAchC;;;;;OAKG;IACG,cAAc,CAClB,EAAE,EAAE,gBAAgB,EACpB,EACE,sBAAsB,EACtB,YAAY,GACb,GAAE;QAAE,sBAAsB,CAAC,EAAE,OAAO,CAAC;QAAC,YAAY,CAAC,EAAE,OAAO,CAAA;KAAO;IAoFtE;;OAEG;IACG,MAAM;IAQZ;;;;;;;;;;;;;OAaG;IACG,KAAK,CAAC,QAAQ,CAAC,EAAE,aAAa;;;;IAoF9B,SAAS;CA6BhB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAsB,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC,CAIpF"}
|
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BlockBuilder = exports.BuildStatus = void 0;
|
|
4
|
+
exports.buildBlock = buildBlock;
|
|
5
|
+
const block_1 = require("@feelyourprotocol/block");
|
|
6
|
+
const common_1 = require("@feelyourprotocol/common");
|
|
7
|
+
const mpt_1 = require("@feelyourprotocol/mpt");
|
|
8
|
+
const rlp_1 = require("@feelyourprotocol/rlp");
|
|
9
|
+
const tx_1 = require("@feelyourprotocol/tx");
|
|
10
|
+
const util_1 = require("@feelyourprotocol/util");
|
|
11
|
+
const sha2_js_1 = require("@noble/hashes/sha2.js");
|
|
12
|
+
const index_ts_1 = require("./bloom/index.js");
|
|
13
|
+
const index_ts_2 = require("./index.js");
|
|
14
|
+
const requests_ts_1 = require("./requests.js");
|
|
15
|
+
const runBlock_ts_1 = require("./runBlock.js");
|
|
16
|
+
exports.BuildStatus = {
|
|
17
|
+
Reverted: 'reverted',
|
|
18
|
+
Build: 'build',
|
|
19
|
+
Pending: 'pending',
|
|
20
|
+
};
|
|
21
|
+
class BlockBuilder {
|
|
22
|
+
get transactionReceipts() {
|
|
23
|
+
return this.transactionResults.map((result) => result.receipt);
|
|
24
|
+
}
|
|
25
|
+
get minerValue() {
|
|
26
|
+
return this._minerValue;
|
|
27
|
+
}
|
|
28
|
+
constructor(vm, opts) {
|
|
29
|
+
/**
|
|
30
|
+
* The cumulative gas used by the transactions added to the block.
|
|
31
|
+
*/
|
|
32
|
+
this.gasUsed = util_1.BIGINT_0;
|
|
33
|
+
/**
|
|
34
|
+
* The cumulative blob gas used by the blobs in a block
|
|
35
|
+
*/
|
|
36
|
+
this.blobGasUsed = util_1.BIGINT_0;
|
|
37
|
+
/**
|
|
38
|
+
* Value of the block, represented by the final transaction fees
|
|
39
|
+
* accruing to the miner.
|
|
40
|
+
*/
|
|
41
|
+
this._minerValue = util_1.BIGINT_0;
|
|
42
|
+
this.transactions = [];
|
|
43
|
+
this.transactionResults = [];
|
|
44
|
+
this.checkpointed = false;
|
|
45
|
+
this.blockStatus = { status: exports.BuildStatus.Pending };
|
|
46
|
+
this.vm = vm;
|
|
47
|
+
this.blockOpts = { putBlockIntoBlockchain: true, ...opts.blockOpts, common: this.vm.common };
|
|
48
|
+
this.headerData = {
|
|
49
|
+
...opts.headerData,
|
|
50
|
+
parentHash: opts.headerData?.parentHash ?? opts.parentBlock.hash(),
|
|
51
|
+
number: opts.headerData?.number ?? opts.parentBlock.header.number + util_1.BIGINT_1,
|
|
52
|
+
gasLimit: opts.headerData?.gasLimit ?? opts.parentBlock.header.gasLimit,
|
|
53
|
+
timestamp: opts.headerData?.timestamp ?? Math.round(Date.now() / 1000),
|
|
54
|
+
};
|
|
55
|
+
this.withdrawals = opts.withdrawals?.map(util_1.createWithdrawal);
|
|
56
|
+
if (this.vm.common.isActivatedEIP(1559) &&
|
|
57
|
+
typeof this.headerData.baseFeePerGas === 'undefined') {
|
|
58
|
+
if (this.headerData.number === vm.common.hardforkBlock(common_1.Hardfork.London)) {
|
|
59
|
+
this.headerData.baseFeePerGas = vm.common.param('initialBaseFee');
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
this.headerData.baseFeePerGas = opts.parentBlock.header.calcNextBaseFee();
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
if (typeof this.headerData.gasLimit === 'undefined') {
|
|
66
|
+
if (this.headerData.number === vm.common.hardforkBlock(common_1.Hardfork.London)) {
|
|
67
|
+
this.headerData.gasLimit = opts.parentBlock.header.gasLimit * util_1.BIGINT_2;
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
this.headerData.gasLimit = opts.parentBlock.header.gasLimit;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
if (this.vm.common.isActivatedEIP(4844) &&
|
|
74
|
+
typeof this.headerData.excessBlobGas === 'undefined') {
|
|
75
|
+
this.headerData.excessBlobGas = opts.parentBlock.header.calcNextExcessBlobGas(this.vm.common);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Throws if the block has already been built or reverted.
|
|
80
|
+
*/
|
|
81
|
+
checkStatus() {
|
|
82
|
+
if (this.blockStatus.status === exports.BuildStatus.Build) {
|
|
83
|
+
throw (0, util_1.EthereumJSErrorWithoutCode)('Block has already been built');
|
|
84
|
+
}
|
|
85
|
+
if (this.blockStatus.status === exports.BuildStatus.Reverted) {
|
|
86
|
+
throw (0, util_1.EthereumJSErrorWithoutCode)('State has already been reverted');
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
getStatus() {
|
|
90
|
+
return this.blockStatus;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Calculates and returns the transactionsTrie for the block.
|
|
94
|
+
*/
|
|
95
|
+
async transactionsTrie() {
|
|
96
|
+
return (0, block_1.genTransactionsTrieRoot)(this.transactions, new mpt_1.MerklePatriciaTrie({ common: this.vm.common }));
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Calculates and returns the logs bloom for the block.
|
|
100
|
+
*/
|
|
101
|
+
logsBloom() {
|
|
102
|
+
const bloom = new index_ts_1.Bloom(undefined, this.vm.common);
|
|
103
|
+
for (const txResult of this.transactionResults) {
|
|
104
|
+
// Combine blooms via bitwise OR
|
|
105
|
+
bloom.or(txResult.bloom);
|
|
106
|
+
}
|
|
107
|
+
return bloom.bitvector;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Calculates and returns the receiptTrie for the block.
|
|
111
|
+
*/
|
|
112
|
+
async receiptTrie() {
|
|
113
|
+
if (this.transactionResults.length === 0) {
|
|
114
|
+
return util_1.KECCAK256_RLP;
|
|
115
|
+
}
|
|
116
|
+
const receiptTrie = new mpt_1.MerklePatriciaTrie({ common: this.vm.common });
|
|
117
|
+
for (const [i, txResult] of this.transactionResults.entries()) {
|
|
118
|
+
const tx = this.transactions[i];
|
|
119
|
+
const encodedReceipt = (0, runBlock_ts_1.encodeReceipt)(txResult.receipt, tx.type);
|
|
120
|
+
await receiptTrie.put(rlp_1.RLP.encode(i), encodedReceipt);
|
|
121
|
+
}
|
|
122
|
+
return receiptTrie.root();
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* Adds the block miner reward to the coinbase account.
|
|
126
|
+
*/
|
|
127
|
+
async rewardMiner() {
|
|
128
|
+
const minerReward = this.vm.common.param('minerReward');
|
|
129
|
+
const reward = (0, runBlock_ts_1.calculateMinerReward)(minerReward, 0);
|
|
130
|
+
const coinbase = this.headerData.coinbase !== undefined
|
|
131
|
+
? new util_1.Address((0, util_1.toBytes)(this.headerData.coinbase))
|
|
132
|
+
: (0, util_1.createZeroAddress)();
|
|
133
|
+
await (0, runBlock_ts_1.rewardAccount)(this.vm.evm, coinbase, reward, this.vm.common);
|
|
134
|
+
}
|
|
135
|
+
/**
|
|
136
|
+
* Adds the withdrawal amount to the withdrawal address
|
|
137
|
+
*/
|
|
138
|
+
async processWithdrawals() {
|
|
139
|
+
for (const withdrawal of this.withdrawals ?? []) {
|
|
140
|
+
const { address, amount } = withdrawal;
|
|
141
|
+
// If there is no amount to add, skip touching the account
|
|
142
|
+
// as per the implementation of other clients geth/nethermind
|
|
143
|
+
// although this should never happen as no withdrawals with 0
|
|
144
|
+
// amount should ever land up here.
|
|
145
|
+
if (amount === util_1.BIGINT_0)
|
|
146
|
+
continue;
|
|
147
|
+
// Withdrawal amount is represented in Gwei so needs to be
|
|
148
|
+
// converted to wei
|
|
149
|
+
await (0, runBlock_ts_1.rewardAccount)(this.vm.evm, address, amount * util_1.GWEI_TO_WEI, this.vm.common);
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
/**
|
|
153
|
+
* Run and add a transaction to the block being built.
|
|
154
|
+
* Please note that this modifies the state of the VM.
|
|
155
|
+
* Throws if the transaction's gasLimit is greater than
|
|
156
|
+
* the remaining gas in the block.
|
|
157
|
+
*/
|
|
158
|
+
async addTransaction(tx, { skipHardForkValidation, allowNoBlobs, } = {}) {
|
|
159
|
+
this.checkStatus();
|
|
160
|
+
if (!this.checkpointed) {
|
|
161
|
+
await this.vm.evm.journal.checkpoint();
|
|
162
|
+
this.checkpointed = true;
|
|
163
|
+
}
|
|
164
|
+
// According to the Yellow Paper, a transaction's gas limit
|
|
165
|
+
// cannot be greater than the remaining gas in the block
|
|
166
|
+
const blockGasLimit = (0, util_1.toType)(this.headerData.gasLimit, util_1.TypeOutput.BigInt);
|
|
167
|
+
const blobGasPerBlob = this.vm.common.param('blobGasPerBlob');
|
|
168
|
+
const blockGasRemaining = blockGasLimit - this.gasUsed;
|
|
169
|
+
if (tx.gasLimit > blockGasRemaining) {
|
|
170
|
+
throw (0, util_1.EthereumJSErrorWithoutCode)('tx has a higher gas limit than the remaining gas in the block');
|
|
171
|
+
}
|
|
172
|
+
let blobGasUsed = undefined;
|
|
173
|
+
if (tx instanceof tx_1.Blob4844Tx) {
|
|
174
|
+
const { maxBlobGasPerBlock: blobGasLimit } = this.vm.common.getBlobGasSchedule();
|
|
175
|
+
if (tx.networkWrapperVersion === tx_1.NetworkWrapperType.EIP4844 &&
|
|
176
|
+
this.vm.common.isActivatedEIP(7594)) {
|
|
177
|
+
throw Error('eip4844 blob transaction for eip7594 activated fork');
|
|
178
|
+
}
|
|
179
|
+
else if (tx.networkWrapperVersion === tx_1.NetworkWrapperType.EIP7594 &&
|
|
180
|
+
!this.vm.common.isActivatedEIP(7594)) {
|
|
181
|
+
throw Error('eip7594 blob transaction but eip not yet activated');
|
|
182
|
+
}
|
|
183
|
+
if (this.blockOpts.common?.isActivatedEIP(4844) === false) {
|
|
184
|
+
throw Error('eip4844 not activated yet for adding a blob transaction');
|
|
185
|
+
}
|
|
186
|
+
const blobTx = tx;
|
|
187
|
+
// Guard against the case if a tx came into the pool without blobs i.e. network wrapper payload
|
|
188
|
+
if (blobTx.blobs === undefined) {
|
|
189
|
+
// TODO: verify if we want this, do we want to allow the block builder to accept blob txs without the actual blobs?
|
|
190
|
+
// (these must have at least one `blobVersionedHashes`, this is verified at tx-level)
|
|
191
|
+
if (allowNoBlobs !== true) {
|
|
192
|
+
throw (0, util_1.EthereumJSErrorWithoutCode)('blobs missing for 4844 transaction');
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
if (this.blobGasUsed + BigInt(blobTx.numBlobs()) * blobGasPerBlob > blobGasLimit) {
|
|
196
|
+
throw (0, util_1.EthereumJSErrorWithoutCode)('block blob gas limit reached');
|
|
197
|
+
}
|
|
198
|
+
blobGasUsed = this.blobGasUsed;
|
|
199
|
+
}
|
|
200
|
+
const header = {
|
|
201
|
+
...this.headerData,
|
|
202
|
+
gasUsed: this.gasUsed,
|
|
203
|
+
// correct excessBlobGas should already part of headerData used above
|
|
204
|
+
blobGasUsed,
|
|
205
|
+
};
|
|
206
|
+
const blockData = { header, transactions: this.transactions };
|
|
207
|
+
const block = (0, block_1.createBlock)(blockData, this.blockOpts);
|
|
208
|
+
const result = await (0, index_ts_2.runTx)(this.vm, { tx, block, skipHardForkValidation });
|
|
209
|
+
// If tx is a blob transaction, remove blobs/kzg commitments before adding to block per EIP-4844
|
|
210
|
+
if (tx instanceof tx_1.Blob4844Tx) {
|
|
211
|
+
const txData = tx;
|
|
212
|
+
this.blobGasUsed += BigInt(txData.blobVersionedHashes.length) * blobGasPerBlob;
|
|
213
|
+
tx = (0, tx_1.createMinimal4844TxFromNetworkWrapper)(txData, {
|
|
214
|
+
common: this.blockOpts.common,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
this.transactions.push(tx);
|
|
218
|
+
this.transactionResults.push(result);
|
|
219
|
+
this.gasUsed += result.totalGasSpent;
|
|
220
|
+
this._minerValue += result.minerValue;
|
|
221
|
+
return result;
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Reverts the checkpoint on the StateManager to reset the state from any transactions that have been run.
|
|
225
|
+
*/
|
|
226
|
+
async revert() {
|
|
227
|
+
if (this.checkpointed) {
|
|
228
|
+
await this.vm.evm.journal.revert();
|
|
229
|
+
this.checkpointed = false;
|
|
230
|
+
}
|
|
231
|
+
this.blockStatus = { status: exports.BuildStatus.Reverted };
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* This method constructs the finalized block, including withdrawals and any CLRequests.
|
|
235
|
+
* It also:
|
|
236
|
+
* - Assigns the reward for miner (PoW)
|
|
237
|
+
* - Commits the checkpoint on the StateManager
|
|
238
|
+
* - Sets the tip of the VM's blockchain to this block
|
|
239
|
+
* For PoW, optionally seals the block with params `nonce` and `mixHash`,
|
|
240
|
+
* which is validated along with the block number and difficulty by ethash.
|
|
241
|
+
* For PoA, please pass `blockOption.cliqueSigner` into the buildBlock constructor,
|
|
242
|
+
* as the signer will be awarded the txs amount spent on gas as they are added.
|
|
243
|
+
*
|
|
244
|
+
* Note: we add CLRequests here because they can be generated at any time during the
|
|
245
|
+
* lifecycle of a pending block so need to be provided only when the block is finalized.
|
|
246
|
+
*/
|
|
247
|
+
async build(sealOpts) {
|
|
248
|
+
this.checkStatus();
|
|
249
|
+
const blockOpts = this.blockOpts;
|
|
250
|
+
const consensusType = this.vm.common.consensusType();
|
|
251
|
+
if (consensusType === common_1.ConsensusType.ProofOfWork) {
|
|
252
|
+
await this.rewardMiner();
|
|
253
|
+
}
|
|
254
|
+
await this.processWithdrawals();
|
|
255
|
+
const transactionsTrie = await this.transactionsTrie();
|
|
256
|
+
const withdrawalsRoot = this.withdrawals
|
|
257
|
+
? await (0, block_1.genWithdrawalsTrieRoot)(this.withdrawals, new mpt_1.MerklePatriciaTrie({ common: this.vm.common }))
|
|
258
|
+
: undefined;
|
|
259
|
+
const receiptTrie = await this.receiptTrie();
|
|
260
|
+
const logsBloom = this.logsBloom();
|
|
261
|
+
const gasUsed = this.gasUsed;
|
|
262
|
+
// timestamp should already be set in constructor
|
|
263
|
+
const timestamp = this.headerData.timestamp ?? util_1.BIGINT_0;
|
|
264
|
+
let blobGasUsed = undefined;
|
|
265
|
+
if (this.vm.common.isActivatedEIP(4844)) {
|
|
266
|
+
blobGasUsed = this.blobGasUsed;
|
|
267
|
+
}
|
|
268
|
+
let requests;
|
|
269
|
+
let requestsHash;
|
|
270
|
+
if (this.vm.common.isActivatedEIP(7685)) {
|
|
271
|
+
const sha256Function = this.vm.common.customCrypto.sha256 ?? sha2_js_1.sha256;
|
|
272
|
+
requests = await (0, requests_ts_1.accumulateRequests)(this.vm, this.transactionResults);
|
|
273
|
+
requestsHash = (0, block_1.genRequestsRoot)(requests, sha256Function);
|
|
274
|
+
}
|
|
275
|
+
// get stateRoot after all the accumulateRequests etc have been done
|
|
276
|
+
const stateRoot = await this.vm.stateManager.getStateRoot();
|
|
277
|
+
const headerData = {
|
|
278
|
+
...this.headerData,
|
|
279
|
+
stateRoot,
|
|
280
|
+
transactionsTrie,
|
|
281
|
+
withdrawalsRoot,
|
|
282
|
+
receiptTrie,
|
|
283
|
+
logsBloom,
|
|
284
|
+
gasUsed,
|
|
285
|
+
timestamp,
|
|
286
|
+
// correct excessBlobGas should already be part of headerData used above
|
|
287
|
+
blobGasUsed,
|
|
288
|
+
requestsHash,
|
|
289
|
+
};
|
|
290
|
+
if (consensusType === common_1.ConsensusType.ProofOfWork) {
|
|
291
|
+
headerData.nonce = sealOpts?.nonce ?? headerData.nonce;
|
|
292
|
+
headerData.mixHash = sealOpts?.mixHash ?? headerData.mixHash;
|
|
293
|
+
}
|
|
294
|
+
const blockData = {
|
|
295
|
+
header: headerData,
|
|
296
|
+
transactions: this.transactions,
|
|
297
|
+
withdrawals: this.withdrawals,
|
|
298
|
+
};
|
|
299
|
+
let block;
|
|
300
|
+
const cs = this.blockOpts.cliqueSigner;
|
|
301
|
+
if (cs !== undefined) {
|
|
302
|
+
block = (0, block_1.createSealedCliqueBlock)(blockData, cs, this.blockOpts);
|
|
303
|
+
}
|
|
304
|
+
else {
|
|
305
|
+
block = (0, block_1.createBlock)(blockData, blockOpts);
|
|
306
|
+
}
|
|
307
|
+
if (this.blockOpts.putBlockIntoBlockchain === true) {
|
|
308
|
+
await this.vm.blockchain.putBlock(block);
|
|
309
|
+
}
|
|
310
|
+
this.blockStatus = { status: exports.BuildStatus.Build, block };
|
|
311
|
+
if (this.checkpointed) {
|
|
312
|
+
await this.vm.evm.journal.commit();
|
|
313
|
+
this.checkpointed = false;
|
|
314
|
+
}
|
|
315
|
+
return { block, requests };
|
|
316
|
+
}
|
|
317
|
+
async initState() {
|
|
318
|
+
if (this.vm.common.isActivatedEIP(4788)) {
|
|
319
|
+
if (!this.checkpointed) {
|
|
320
|
+
await this.vm.evm.journal.checkpoint();
|
|
321
|
+
this.checkpointed = true;
|
|
322
|
+
}
|
|
323
|
+
const { parentBeaconBlockRoot, timestamp } = this.headerData;
|
|
324
|
+
// timestamp should already be set in constructor
|
|
325
|
+
const timestampBigInt = (0, util_1.toType)(timestamp ?? 0, util_1.TypeOutput.BigInt);
|
|
326
|
+
const parentBeaconBlockRootBuf = (0, util_1.toType)(parentBeaconBlockRoot, util_1.TypeOutput.Uint8Array) ?? new Uint8Array(32);
|
|
327
|
+
await (0, runBlock_ts_1.accumulateParentBeaconBlockRoot)(this.vm, parentBeaconBlockRootBuf, timestampBigInt);
|
|
328
|
+
}
|
|
329
|
+
if (this.vm.common.isActivatedEIP(2935)) {
|
|
330
|
+
if (!this.checkpointed) {
|
|
331
|
+
await this.vm.evm.journal.checkpoint();
|
|
332
|
+
this.checkpointed = true;
|
|
333
|
+
}
|
|
334
|
+
const { parentHash, number } = this.headerData;
|
|
335
|
+
// timestamp should already be set in constructor
|
|
336
|
+
const numberBigInt = (0, util_1.toType)(number ?? 0, util_1.TypeOutput.BigInt);
|
|
337
|
+
const parentHashSanitized = (0, util_1.toType)(parentHash, util_1.TypeOutput.Uint8Array) ?? new Uint8Array(32);
|
|
338
|
+
await (0, runBlock_ts_1.accumulateParentBlockHash)(this.vm, numberBigInt, parentHashSanitized);
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
exports.BlockBuilder = BlockBuilder;
|
|
343
|
+
/**
|
|
344
|
+
* Build a block on top of the current state
|
|
345
|
+
* by adding one transaction at a time.
|
|
346
|
+
*
|
|
347
|
+
* Creates a checkpoint on the StateManager and modifies the state
|
|
348
|
+
* as transactions are run. The checkpoint is committed on {@link BlockBuilder.build}
|
|
349
|
+
* or discarded with {@link BlockBuilder.revert}.
|
|
350
|
+
*
|
|
351
|
+
* @param {VM} vm
|
|
352
|
+
* @param {BuildBlockOpts} opts
|
|
353
|
+
* @returns An instance of {@link BlockBuilder} with methods:
|
|
354
|
+
* - {@link BlockBuilder.addTransaction}
|
|
355
|
+
* - {@link BlockBuilder.build}
|
|
356
|
+
* - {@link BlockBuilder.revert}
|
|
357
|
+
*/
|
|
358
|
+
async function buildBlock(vm, opts) {
|
|
359
|
+
const blockBuilder = new BlockBuilder(vm, opts);
|
|
360
|
+
await blockBuilder.initState();
|
|
361
|
+
return blockBuilder;
|
|
362
|
+
}
|
|
363
|
+
//# sourceMappingURL=buildBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"buildBlock.js","sourceRoot":"","sources":["../../src/buildBlock.ts"],"names":[],"mappings":";;;AAidA,gCAIC;AArdD,6CAM0B;AAC1B,+CAA4D;AAC5D,yCAAoD;AACpD,yCAAqC;AACrC,uCAIuB;AACvB,2CAayB;AACzB,mDAA8C;AAE9C,+CAAwC;AACxC,yCAAkC;AAClC,+CAAkD;AAClD,+CAMsB;AAST,QAAA,WAAW,GAAG;IACzB,QAAQ,EAAE,UAAU;IACpB,KAAK,EAAE,OAAO;IACd,OAAO,EAAE,SAAS;CACV,CAAA;AAMV,MAAa,YAAY;IAwBvB,IAAI,mBAAmB;QACrB,OAAO,IAAI,CAAC,kBAAkB,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,MAAM,CAAC,OAAO,CAAC,CAAA;IAChE,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,WAAW,CAAA;IACzB,CAAC;IAED,YAAY,EAAM,EAAE,IAAoB;QA/BxC;;WAEG;QACH,YAAO,GAAG,eAAQ,CAAA;QAClB;;WAEG;QACH,gBAAW,GAAG,eAAQ,CAAA;QACtB;;;WAGG;QACK,gBAAW,GAAG,eAAQ,CAAA;QAKtB,iBAAY,GAAuB,EAAE,CAAA;QACrC,uBAAkB,GAAkB,EAAE,CAAA;QAEtC,iBAAY,GAAG,KAAK,CAAA;QACpB,gBAAW,GAAgB,EAAE,MAAM,EAAE,mBAAW,CAAC,OAAO,EAAE,CAAA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;;;GAcG;AACI,KAAK,UAAU,UAAU,CAAC,EAAM,EAAE,IAAoB;IAC3D,MAAM,YAAY,GAAG,IAAI,YAAY,CAAC,EAAE,EAAE,IAAI,CAAC,CAAA;IAC/C,MAAM,YAAY,CAAC,SAAS,EAAE,CAAA;IAC9B,OAAO,YAAY,CAAA;AACrB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { VM } from './vm.ts';
|
|
2
|
+
import type { VMOpts } from './types.ts';
|
|
3
|
+
/**
|
|
4
|
+
* VM async constructor. Creates engine instance and initializes it.
|
|
5
|
+
*
|
|
6
|
+
* @param opts VM engine constructor options
|
|
7
|
+
*/
|
|
8
|
+
export declare function createVM(opts?: VMOpts): Promise<VM>;
|
|
9
|
+
//# sourceMappingURL=constructors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constructors.d.ts","sourceRoot":"","sources":["../../src/constructors.ts"],"names":[],"mappings":"AAWA,OAAO,EAAE,EAAE,EAAE,MAAM,SAAS,CAAA;AAE5B,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC;;;;GAIG;AACH,wBAAsB,QAAQ,CAAC,IAAI,GAAE,MAAW,GAAG,OAAO,CAAC,EAAE,CAAC,CAsE7D"}
|