sol-dbg 0.4.2 → 0.6.1

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 (101) hide show
  1. package/dist/debug/decoding/general.d.ts +2 -1
  2. package/dist/debug/decoding/general.d.ts.map +1 -1
  3. package/dist/debug/decoding/general.js +8 -7
  4. package/dist/debug/decoding/general.js.map +1 -1
  5. package/dist/debug/decoding/storage.d.ts +6 -3
  6. package/dist/debug/decoding/storage.d.ts.map +1 -1
  7. package/dist/debug/decoding/storage.js +73 -13
  8. package/dist/debug/decoding/storage.js.map +1 -1
  9. package/dist/debug/foundry_cheatcodes.d.ts +2 -1
  10. package/dist/debug/foundry_cheatcodes.d.ts.map +1 -1
  11. package/dist/debug/foundry_cheatcodes.js +4 -0
  12. package/dist/debug/foundry_cheatcodes.js.map +1 -1
  13. package/dist/debug/index.d.ts +2 -1
  14. package/dist/debug/index.d.ts.map +1 -1
  15. package/dist/debug/index.js +2 -1
  16. package/dist/debug/index.js.map +1 -1
  17. package/dist/debug/layout.d.ts +9 -0
  18. package/dist/debug/layout.d.ts.map +1 -0
  19. package/dist/debug/layout.js +80 -0
  20. package/dist/debug/layout.js.map +1 -0
  21. package/dist/debug/tracers/base_tracer.d.ts +33 -0
  22. package/dist/debug/tracers/base_tracer.d.ts.map +1 -0
  23. package/dist/debug/tracers/base_tracer.js +118 -0
  24. package/dist/debug/tracers/base_tracer.js.map +1 -0
  25. package/dist/debug/tracers/index.d.ts +5 -0
  26. package/dist/debug/tracers/index.d.ts.map +1 -0
  27. package/dist/debug/tracers/index.js +21 -0
  28. package/dist/debug/tracers/index.js.map +1 -0
  29. package/dist/debug/tracers/sol_debugger.d.ts +9 -0
  30. package/dist/debug/tracers/sol_debugger.d.ts.map +1 -0
  31. package/dist/debug/tracers/sol_debugger.js +22 -0
  32. package/dist/debug/tracers/sol_debugger.js.map +1 -0
  33. package/dist/debug/tracers/support_tracer.d.ts +15 -0
  34. package/dist/debug/tracers/support_tracer.d.ts.map +1 -0
  35. package/dist/debug/tracers/support_tracer.js +22 -0
  36. package/dist/debug/tracers/support_tracer.js.map +1 -0
  37. package/dist/debug/tracers/transformers/basic_info.d.ts +25 -0
  38. package/dist/debug/tracers/transformers/basic_info.d.ts.map +1 -0
  39. package/dist/debug/tracers/transformers/basic_info.js +54 -0
  40. package/dist/debug/tracers/transformers/basic_info.js.map +1 -0
  41. package/dist/debug/tracers/transformers/contract_lifetime.d.ts +21 -0
  42. package/dist/debug/tracers/transformers/contract_lifetime.d.ts.map +1 -0
  43. package/dist/debug/tracers/transformers/contract_lifetime.js +70 -0
  44. package/dist/debug/tracers/transformers/contract_lifetime.js.map +1 -0
  45. package/dist/debug/tracers/transformers/events.d.ts +12 -0
  46. package/dist/debug/tracers/transformers/events.d.ts.map +1 -0
  47. package/dist/debug/tracers/transformers/events.js +30 -0
  48. package/dist/debug/tracers/transformers/events.js.map +1 -0
  49. package/dist/debug/tracers/transformers/ext_stack.d.ts +17 -0
  50. package/dist/debug/tracers/transformers/ext_stack.d.ts.map +1 -0
  51. package/dist/debug/tracers/transformers/ext_stack.js +200 -0
  52. package/dist/debug/tracers/transformers/ext_stack.js.map +1 -0
  53. package/dist/debug/tracers/transformers/index.d.ts +12 -0
  54. package/dist/debug/tracers/transformers/index.d.ts.map +1 -0
  55. package/dist/debug/tracers/transformers/index.js +25 -0
  56. package/dist/debug/tracers/transformers/index.js.map +1 -0
  57. package/dist/debug/tracers/transformers/int_stack.d.ts +13 -0
  58. package/dist/debug/tracers/transformers/int_stack.d.ts.map +1 -0
  59. package/dist/debug/tracers/transformers/int_stack.js +139 -0
  60. package/dist/debug/tracers/transformers/int_stack.js.map +1 -0
  61. package/dist/debug/tracers/transformers/keccak256_invert.d.ts +29 -0
  62. package/dist/debug/tracers/transformers/keccak256_invert.d.ts.map +1 -0
  63. package/dist/debug/tracers/transformers/keccak256_invert.js +65 -0
  64. package/dist/debug/tracers/transformers/keccak256_invert.js.map +1 -0
  65. package/dist/debug/tracers/transformers/op.d.ts +11 -0
  66. package/dist/debug/tracers/transformers/op.d.ts.map +1 -0
  67. package/dist/debug/tracers/transformers/op.js +11 -0
  68. package/dist/debug/tracers/transformers/op.js.map +1 -0
  69. package/dist/debug/tracers/transformers/source.d.ts +26 -0
  70. package/dist/debug/tracers/transformers/source.d.ts.map +1 -0
  71. package/dist/debug/tracers/transformers/source.js +38 -0
  72. package/dist/debug/tracers/transformers/source.js.map +1 -0
  73. package/dist/debug/types.d.ts +3 -6
  74. package/dist/debug/types.d.ts.map +1 -1
  75. package/dist/debug/types.js +8 -0
  76. package/dist/debug/types.js.map +1 -1
  77. package/dist/utils/index.d.ts +2 -0
  78. package/dist/utils/index.d.ts.map +1 -1
  79. package/dist/utils/index.js +2 -0
  80. package/dist/utils/index.js.map +1 -1
  81. package/dist/utils/map.d.ts +5 -0
  82. package/dist/utils/map.d.ts.map +1 -0
  83. package/dist/utils/map.js +12 -0
  84. package/dist/utils/map.js.map +1 -0
  85. package/dist/utils/pp.d.ts +4 -2
  86. package/dist/utils/pp.d.ts.map +1 -1
  87. package/dist/utils/pp.js +22 -10
  88. package/dist/utils/pp.js.map +1 -1
  89. package/dist/utils/set.d.ts +9 -0
  90. package/dist/utils/set.d.ts.map +1 -0
  91. package/dist/utils/set.js +21 -0
  92. package/dist/utils/set.js.map +1 -0
  93. package/dist/utils/test_runner.d.ts +22 -10
  94. package/dist/utils/test_runner.d.ts.map +1 -1
  95. package/dist/utils/test_runner.js +73 -33
  96. package/dist/utils/test_runner.js.map +1 -1
  97. package/package.json +1 -1
  98. package/dist/debug/sol_debugger.d.ts +0 -107
  99. package/dist/debug/sol_debugger.d.ts.map +0 -1
  100. package/dist/debug/sol_debugger.js +0 -521
  101. package/dist/debug/sol_debugger.js.map +0 -1
@@ -0,0 +1,200 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.topExtFrame = topExtFrame;
4
+ exports.getContractInfo = getContractInfo;
5
+ exports.getCode = getCode;
6
+ exports.addExternalFrame = addExternalFrame;
7
+ const util_1 = require("@ethereumjs/util");
8
+ const solc_typed_ast_1 = require("solc-typed-ast");
9
+ const artifacts_1 = require("../../../artifacts");
10
+ const utils_1 = require("../../../utils");
11
+ const abi_1 = require("../../abi");
12
+ const opcodes_1 = require("../../opcodes");
13
+ const types_1 = require("../../types");
14
+ function topExtFrame(arg) {
15
+ if ((0, types_1.isFrame)(arg)) {
16
+ return arg.kind === types_1.FrameKind.InternalCall ? arg.nearestExtFrame : arg;
17
+ }
18
+ if (!(arg instanceof Array)) {
19
+ arg = arg.stack;
20
+ }
21
+ (0, solc_typed_ast_1.assert)(arg.length > 0, `Empty stack!`);
22
+ return arg[arg.length - 1];
23
+ }
24
+ function getContractInfo(step) {
25
+ return topExtFrame(step).info;
26
+ }
27
+ function getCode(step) {
28
+ return topExtFrame(step).code;
29
+ }
30
+ /**
31
+ * Given a contract info and a function selector find the (potentially inherited) entry point (function or public var getter).
32
+ * @param info
33
+ * @param selector
34
+ * @returns
35
+ */
36
+ function findEntryPoint(info, selector, artifactManager) {
37
+ if (info.ast === undefined) {
38
+ return undefined;
39
+ }
40
+ const contract = info.ast;
41
+ const infer = artifactManager.infer(info.artifact.compilerVersion);
42
+ return (0, abi_1.findMethodBySelector)(selector, contract, infer);
43
+ }
44
+ /**
45
+ * Build a `CallFrame` from the given `sender` address, `receiver` address, `data` `Uint8Array`, (msg.data) and the current trace step number.
46
+ */
47
+ function makeCallFrame(sender, receiver, codeAddress, data, receiverCode, codeHash, step, artifactManager) {
48
+ const contractInfo = codeHash === undefined ? codeHash : artifactManager.getContractFromMDHash(codeHash);
49
+ const selector = (0, util_1.bytesToHex)(data.slice(0, 4)).slice(2);
50
+ let callee;
51
+ let args;
52
+ if (contractInfo && contractInfo.ast) {
53
+ const abiVersion = contractInfo.artifact.abiEncoderVersion;
54
+ const infer = artifactManager.infer(contractInfo.artifact.compilerVersion);
55
+ callee = findEntryPoint(contractInfo, selector, artifactManager);
56
+ if (callee !== undefined) {
57
+ try {
58
+ args = (0, abi_1.buildMsgDataViews)(callee, data, types_1.DataLocationKind.CallData, infer, abiVersion);
59
+ }
60
+ catch (e) {
61
+ args = undefined;
62
+ }
63
+ }
64
+ }
65
+ return {
66
+ kind: types_1.FrameKind.Call,
67
+ sender, // TODO: This should be Address
68
+ msgData: data,
69
+ receiver: receiver, // TODO: This should be Address
70
+ code: receiverCode,
71
+ info: contractInfo,
72
+ callee,
73
+ address: receiver,
74
+ startStep: step,
75
+ arguments: args,
76
+ codeMdHash: codeHash,
77
+ codeAddress,
78
+ internalFrames: []
79
+ };
80
+ }
81
+ /**
82
+ * Build a `CreationFrame` from the given `sender` address, `data` `Uint8Array`(msg.data) and the current trace step number.
83
+ */
84
+ function makeCreationFrame(sender, data, step, artifactManager) {
85
+ const contractInfo = artifactManager.getContractFromCreationBytecode(data);
86
+ let args;
87
+ const callee = contractInfo && contractInfo.ast ? contractInfo.ast.vConstructor : undefined;
88
+ if (contractInfo && callee instanceof solc_typed_ast_1.FunctionDefinition) {
89
+ // TODO: Try and find the arguments inside the creation code and decode them
90
+ }
91
+ return {
92
+ kind: types_1.FrameKind.Creation,
93
+ sender,
94
+ msgData: data,
95
+ code: data,
96
+ info: contractInfo,
97
+ callee,
98
+ address: utils_1.ZERO_ADDRESS,
99
+ startStep: step,
100
+ arguments: args,
101
+ codeMdHash: (0, artifacts_1.getCreationCodeHash)(data),
102
+ internalFrames: []
103
+ };
104
+ }
105
+ /**
106
+ * Decode a *CALL* instruction. Computes:
107
+ * 1. The receiver address
108
+ * 2. The code address
109
+ * 3. The msg.data
110
+ * @param step
111
+ */
112
+ function decodeCall(step) {
113
+ const op = step.op;
114
+ (0, solc_typed_ast_1.assert)(op.opcode === opcodes_1.OPCODES.CALL ||
115
+ op.opcode === opcodes_1.OPCODES.CALLCODE ||
116
+ op.opcode === opcodes_1.OPCODES.DELEGATECALL ||
117
+ op.opcode === opcodes_1.OPCODES.STATICCALL, `Unexpected call instruction {0}`, op.mnemonic);
118
+ const stackTop = step.evmStack.length - 1;
119
+ const argStackOff = op.opcode === opcodes_1.OPCODES.CALL || op.opcode === opcodes_1.OPCODES.CALLCODE ? 3 : 2;
120
+ const argSizeStackOff = argStackOff + 1;
121
+ const receiverArg = (0, utils_1.wordToAddress)(step.evmStack[stackTop - 1]);
122
+ const argOff = (0, utils_1.bigEndianBufToNumber)(step.evmStack[stackTop - argStackOff]);
123
+ const argSize = (0, utils_1.bigEndianBufToNumber)(step.evmStack[stackTop - argSizeStackOff]);
124
+ const receiver = op.opcode === opcodes_1.OPCODES.DELEGATECALL ? step.address : receiverArg;
125
+ const codeAddr = receiverArg;
126
+ const msgData = step.memory.slice(argOff, argOff + argSize);
127
+ return [receiver, codeAddr, msgData];
128
+ }
129
+ /**
130
+ * Adds external frame info for each step
131
+ */
132
+ async function addExternalFrame(vm, step, state, trace, artifactManager, tx) {
133
+ let extFrame;
134
+ if (trace.length === 0) {
135
+ const sender = tx.getSenderAddress();
136
+ if (tx.to === undefined) {
137
+ extFrame = makeCreationFrame(sender, tx.data, 0, artifactManager);
138
+ }
139
+ else {
140
+ const code = await vm.stateManager.getContractCode(tx.to);
141
+ /// @todo remove - arbitrary restriction, only good for debugging
142
+ (0, solc_typed_ast_1.assert)(code.length > 0, "Missing code for address {0}", tx.to.toString());
143
+ const codeHash = (0, artifacts_1.getCodeHash)(code);
144
+ extFrame = makeCallFrame(sender, tx.to, tx.to, tx.data, code, codeHash, 0, artifactManager);
145
+ }
146
+ return {
147
+ stack: [extFrame],
148
+ ...state
149
+ };
150
+ }
151
+ const lastStep = trace[trace.length - 1];
152
+ if (lastStep.depth === state.depth) {
153
+ return {
154
+ stack: lastStep.stack,
155
+ ...state
156
+ };
157
+ }
158
+ const lastStackTop = lastStep.evmStack.length - 1;
159
+ const lastOp = lastStep.op;
160
+ if (state.depth > lastStep.depth) {
161
+ (0, solc_typed_ast_1.assert)(state.depth === lastStep.depth + 1, `Unexpected depth increase by more than 1 on step {0}`, trace.length);
162
+ (0, solc_typed_ast_1.assert)((0, opcodes_1.increasesDepth)(lastOp), `Unexpected depth increase on op ${lastOp.mnemonic}`);
163
+ if ((0, opcodes_1.createsContract)(lastOp)) {
164
+ // Contract creation call
165
+ const off = (0, utils_1.bigEndianBufToNumber)(lastStep.evmStack[lastStackTop - 1]);
166
+ const size = (0, utils_1.bigEndianBufToNumber)(lastStep.evmStack[lastStackTop - 2]);
167
+ const creationBytecode = lastStep.memory.slice(off, off + size);
168
+ extFrame = makeCreationFrame(lastStep.address, creationBytecode, trace.length, artifactManager);
169
+ }
170
+ else {
171
+ const [receiver, codeAddr, msgData] = decodeCall(lastStep);
172
+ const code = await vm.stateManager.getContractCode(codeAddr);
173
+ const codeHash = (0, artifacts_1.getCodeHash)(code);
174
+ extFrame = await makeCallFrame(lastStep.address, receiver, codeAddr, msgData, code, codeHash, trace.length, artifactManager);
175
+ }
176
+ return {
177
+ stack: [...lastStep.stack, extFrame],
178
+ ...state
179
+ };
180
+ }
181
+ else {
182
+ const stack = [...lastStep.stack];
183
+ // External return or exception
184
+ let nFramesPopped = lastStep.depth - state.depth;
185
+ // Pop as many external frames as neccessary to match the decrease in
186
+ // depth reported by web3. We need the loop since we don't count the internal frames as decreasing depth
187
+ while (nFramesPopped > 0 && stack.length > 0) {
188
+ const topFrame = stack[stack.length - 1];
189
+ if (topFrame.kind === types_1.FrameKind.Creation || topFrame.kind === types_1.FrameKind.Call) {
190
+ nFramesPopped--;
191
+ }
192
+ stack.pop();
193
+ }
194
+ return {
195
+ stack: stack,
196
+ ...state
197
+ };
198
+ }
199
+ }
200
+ //# sourceMappingURL=ext_stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ext_stack.js","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/ext_stack.ts"],"names":[],"mappings":";;AA+BA,kCAWC;AAED,0CAEC;AAED,0BAEC;AAsJD,4CAqHC;AA3TD,2CAAuD;AAEvD,mDAAiF;AACjF,kDAK4B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,GAAG,QAAQ,CAAC,KAAK,GAAG,KAAK,CAAC,KAAK,CAAC;QAEjD,qEAAqE;QACrE,wGAAwG;QACxG,OAAO,aAAa,GAAG,CAAC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YAC3C,MAAM,QAAQ,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;YAEzC,IAAI,QAAQ,CAAC,IAAI,KAAK,iBAAS,CAAC,QAAQ,IAAI,QAAQ,CAAC,IAAI,KAAK,iBAAS,CAAC,IAAI,EAAE,CAAC;gBAC3E,aAAa,EAAE,CAAC;YACpB,CAAC;YAED,KAAK,CAAC,GAAG,EAAE,CAAC;QAChB,CAAC;QAED,OAAO;YACH,KAAK,EAAE,KAAK;YACZ,GAAG,KAAK;SACX,CAAC;IACN,CAAC;AACL,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { InterpreterStep } from "@ethereumjs/evm";
2
+ import { VM } from "@ethereumjs/vm";
3
+ export type TransformerF<T extends object, T1 extends T> = (vm: VM, step: InterpreterStep, state: T, trace: T1[]) => T1;
4
+ export * from "./basic_info";
5
+ export * from "./contract_lifetime";
6
+ export * from "./events";
7
+ export * from "./ext_stack";
8
+ export * from "./int_stack";
9
+ export * from "./keccak256_invert";
10
+ export * from "./op";
11
+ export * from "./source";
12
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,MAAM,MAAM,YAAY,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,SAAS,CAAC,IAAI,CACvD,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,EAAE,EAAE,KACV,EAAE,CAAC;AAER,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,aAAa,CAAC;AAC5B,cAAc,oBAAoB,CAAC;AACnC,cAAc,MAAM,CAAC;AACrB,cAAc,UAAU,CAAC"}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./basic_info"), exports);
18
+ __exportStar(require("./contract_lifetime"), exports);
19
+ __exportStar(require("./events"), exports);
20
+ __exportStar(require("./ext_stack"), exports);
21
+ __exportStar(require("./int_stack"), exports);
22
+ __exportStar(require("./keccak256_invert"), exports);
23
+ __exportStar(require("./op"), exports);
24
+ __exportStar(require("./source"), exports);
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAUA,+CAA6B;AAC7B,sDAAoC;AACpC,2CAAyB;AACzB,8CAA4B;AAC5B,8CAA4B;AAC5B,qDAAmC;AACnC,uCAAqB;AACrB,2CAAyB"}
@@ -0,0 +1,13 @@
1
+ import { InterpreterStep } from "@ethereumjs/evm";
2
+ import { VM } from "@ethereumjs/vm";
3
+ import { IArtifactManager } from "../../artifact_manager";
4
+ import { ExternalFrame, Frame } from "../../types";
5
+ import { BasicStepInfo } from "./basic_info";
6
+ import { ExternalFrameInfo } from "./ext_stack";
7
+ import { SourceInfo } from "./source";
8
+ export declare function topFrame(stack: ExternalFrame[] | ExternalFrameInfo): Frame;
9
+ /**
10
+ * Adds external frame info for each step
11
+ */
12
+ export declare function addInternalFrame<T extends object & BasicStepInfo & ExternalFrameInfo & SourceInfo>(vm: VM, step: InterpreterStep, state: T, trace: T[], artifactManager: IArtifactManager, strict: boolean): Promise<T>;
13
+ //# sourceMappingURL=int_stack.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"int_stack.d.ts","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/int_stack.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAEpC,OAAO,EAAgB,gBAAgB,EAAE,MAAM,wBAAwB,CAAC;AAExE,OAAO,EAGH,aAAa,EACb,KAAK,EAIR,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAe,MAAM,aAAa,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAEtC,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,iBAAiB,GAAG,KAAK,CAQ1E;AA2DD;;GAEG;AACH,wBAAsB,gBAAgB,CAClC,CAAC,SAAS,MAAM,GAAG,aAAa,GAAG,iBAAiB,GAAG,UAAU,EAEjE,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,CAAC,EAAE,EACV,eAAe,EAAE,gBAAgB,EACjC,MAAM,EAAE,OAAO,GAChB,OAAO,CAAC,CAAC,CAAC,CAkGZ"}
@@ -0,0 +1,139 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.topFrame = topFrame;
4
+ exports.addInternalFrame = addInternalFrame;
5
+ const solc_typed_ast_1 = require("solc-typed-ast");
6
+ const decoding_1 = require("../../decoding");
7
+ const types_1 = require("../../types");
8
+ const ext_stack_1 = require("./ext_stack");
9
+ function topFrame(stack) {
10
+ const topExt = (0, ext_stack_1.topExtFrame)(stack);
11
+ if (topExt.internalFrames === undefined || topExt.internalFrames.length === 0) {
12
+ return topExt;
13
+ }
14
+ return topExt.internalFrames[topExt.internalFrames.length - 1];
15
+ }
16
+ /**
17
+ * WIP: TODO document
18
+ */
19
+ function buildFunArgViews(callee, stack, contractInfo, artifactManager) {
20
+ const res = [];
21
+ let formals;
22
+ const infer = artifactManager.infer(contractInfo.artifact.compilerVersion);
23
+ try {
24
+ formals =
25
+ callee instanceof solc_typed_ast_1.FunctionDefinition
26
+ ? callee.vParameters.vParameters.map((argDef) => [
27
+ argDef.name,
28
+ infer.variableDeclarationToTypeNode(argDef)
29
+ ])
30
+ : infer
31
+ .getterArgsAndReturn(callee)[0]
32
+ .map((typ, i) => [`ARG_${i}`, typ]);
33
+ }
34
+ catch (e) {
35
+ // `variableDeclarationToTypeNode` may fail when referencing structs/contracts that are defined
36
+ // in SourceUnits that are missing
37
+ return undefined;
38
+ }
39
+ let offsetFromTop = -1;
40
+ for (let i = formals.length - 1; i >= 0; i--) {
41
+ const [name, typ] = formals[i];
42
+ const stackSize = (0, decoding_1.isCalldataType2Slots)(typ) ? 2 : 1;
43
+ offsetFromTop += stackSize;
44
+ if (offsetFromTop > stack.length) {
45
+ // Stack underflow. Could be due to optimized code?
46
+ return undefined;
47
+ }
48
+ res.unshift([
49
+ name,
50
+ {
51
+ type: typ,
52
+ loc: {
53
+ kind: types_1.DataLocationKind.Stack,
54
+ offsetFromTop
55
+ }
56
+ }
57
+ ]);
58
+ }
59
+ return res;
60
+ }
61
+ /**
62
+ * Adds external frame info for each step
63
+ */
64
+ async function addInternalFrame(vm, step, state, trace, artifactManager, strict) {
65
+ // No internal stack frame on first step of trace
66
+ if (trace.length === 0) {
67
+ return state;
68
+ }
69
+ const lastStep = trace[trace.length - 1];
70
+ // External call/return - no change to internal stack
71
+ if (lastStep.depth !== state.depth) {
72
+ return state;
73
+ }
74
+ // There are 2 ways to enter an internal function:
75
+ let enteringInternalFun = false;
76
+ // 1. Jumping into an internal function (the previous instruction is a JUMP with source map jump index i)
77
+ if (state.op.mnemonic === "JUMPDEST" &&
78
+ lastStep.op.mnemonic === "JUMP" &&
79
+ lastStep.src &&
80
+ lastStep.src.jump === "i") {
81
+ enteringInternalFun = true;
82
+ }
83
+ const ast = state.astNode;
84
+ const curExtFrame = (0, ext_stack_1.topExtFrame)(state.stack);
85
+ // 2. Fall-through (the previous instruction is literally the pervious instruction in the contract body,
86
+ // AND the current JUMPDEST corresponds to a whole function, AND the pervious instructions' callee is different
87
+ // from the current instruction's function.
88
+ if (!enteringInternalFun &&
89
+ state.op.mnemonic === "JUMPDEST" &&
90
+ (ast instanceof solc_typed_ast_1.FunctionDefinition ||
91
+ (ast instanceof solc_typed_ast_1.VariableDeclaration && ast.stateVariable)) &&
92
+ topFrame(lastStep.stack).callee !== ast) {
93
+ enteringInternalFun = true;
94
+ }
95
+ if (enteringInternalFun) {
96
+ let args;
97
+ if (ast instanceof solc_typed_ast_1.FunctionDefinition ||
98
+ (ast instanceof solc_typed_ast_1.VariableDeclaration && ast.stateVariable)) {
99
+ (0, solc_typed_ast_1.assert)(curExtFrame.info !== undefined, ``);
100
+ args = buildFunArgViews(ast, state.evmStack, curExtFrame.info, artifactManager);
101
+ }
102
+ const newFrame = {
103
+ kind: types_1.FrameKind.InternalCall,
104
+ nearestExtFrame: curExtFrame,
105
+ callee: ast,
106
+ offset: state.pc,
107
+ startStep: trace.length,
108
+ arguments: args
109
+ };
110
+ const newInternalFrames = [...curExtFrame.internalFrames, newFrame];
111
+ return {
112
+ ...state,
113
+ stack: [
114
+ ...state.stack.slice(0, -1),
115
+ { ...curExtFrame, internalFrames: newInternalFrames }
116
+ ]
117
+ };
118
+ }
119
+ // Returning from an internal function call
120
+ if (state.op.mnemonic === "JUMP" && state.src && state.src.jump === "o") {
121
+ const curFrame = topFrame(state.stack);
122
+ const newInternalFrames = curExtFrame.internalFrames.slice(0, -1);
123
+ if (strict) {
124
+ (0, solc_typed_ast_1.assert)(curFrame.kind === types_1.FrameKind.InternalCall, `Mismatched internal return from frame `, curFrame.kind);
125
+ }
126
+ else {
127
+ // @todo log an error somewhere
128
+ }
129
+ return {
130
+ ...state,
131
+ stack: [
132
+ ...state.stack.slice(0, -1),
133
+ { ...curExtFrame, internalFrames: newInternalFrames }
134
+ ]
135
+ };
136
+ }
137
+ return state;
138
+ }
139
+ //# sourceMappingURL=int_stack.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"int_stack.js","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/int_stack.ts"],"names":[],"mappings":";;AAkBA,4BAQC;AA8DD,4CA2GC;AAjMD,mDAA2F;AAE3F,6CAAsD;AACtD,uCAQqB;AAErB,2CAA6D;AAG7D,SAAgB,QAAQ,CAAC,KAA0C;IAC/D,MAAM,MAAM,GAAG,IAAA,uBAAW,EAAC,KAAK,CAAC,CAAC;IAElC,IAAI,MAAM,CAAC,cAAc,KAAK,SAAS,IAAI,MAAM,CAAC,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5E,OAAO,MAAM,CAAC;IAClB,CAAC;IAED,OAAO,MAAM,CAAC,cAAc,CAAC,MAAM,CAAC,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;AACnE,CAAC;AAED;;GAEG;AACH,SAAS,gBAAgB,CACrB,MAAgD,EAChD,KAAY,EACZ,YAA0B,EAC1B,eAAiC;IAEjC,MAAM,GAAG,GAA8B,EAAE,CAAC;IAC1C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,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAElE,IAAI,MAAM,EAAE,CAAC;YACT,IAAA,uBAAM,EACF,QAAQ,CAAC,IAAI,KAAK,iBAAS,CAAC,YAAY,EACxC,wCAAwC,EACxC,QAAQ,CAAC,IAAI,CAChB,CAAC;QACN,CAAC;aAAM,CAAC;YACJ,+BAA+B;QACnC,CAAC;QAED,OAAO;YACH,GAAG,KAAK;YACR,KAAK,EAAE;gBACH,GAAG,KAAK,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;gBAC3B,EAAE,GAAG,WAAW,EAAE,cAAc,EAAE,iBAAiB,EAAE;aACxD;SACJ,CAAC;IACN,CAAC;IAED,OAAO,KAAK,CAAC;AACjB,CAAC"}
@@ -0,0 +1,29 @@
1
+ import { InterpreterStep } from "@ethereumjs/evm";
2
+ import { VM } from "@ethereumjs/vm";
3
+ import { BasicStepInfo } from "./basic_info";
4
+ export type KeccakPreimageMap = Map<bigint, Uint8Array>;
5
+ export interface Keccak256InvertInfo {
6
+ keccak?: {
7
+ from: Uint8Array;
8
+ to: bigint;
9
+ };
10
+ }
11
+ /**
12
+ * Given a trace of contract creation/deletion event compute a gen/kill set summary for the trace.
13
+ */
14
+ export declare function getKeccakPreimages(trace: Keccak256InvertInfo[]): KeccakPreimageMap;
15
+ /**
16
+ * A map index is computed by doing keccak(key . p) where p is the slot of the
17
+ * map and key is the original key. MapKeys is a map from p => [... [keyN,
18
+ * keccak(keyN . p)] ... ]
19
+ */
20
+ export type MapKeys = Map<bigint, Array<[Uint8Array, bigint]>>;
21
+ /**
22
+ * Build a `MapKeys` map from a KeccakPreimageMap
23
+ */
24
+ export declare function getMapKeys(preImageMap: KeccakPreimageMap): MapKeys;
25
+ /**
26
+ * Add keccak256 pre-image info. Note we add it on the next instruction after the keccak
27
+ */
28
+ export declare function addKeccakInvertInfo<T extends object & BasicStepInfo>(vm: VM, step: InterpreterStep, state: T, trace: Array<T & Keccak256InvertInfo>): T & Keccak256InvertInfo;
29
+ //# sourceMappingURL=keccak256_invert.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keccak256_invert.d.ts","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/keccak256_invert.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AAGpC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAE7C,MAAM,MAAM,iBAAiB,GAAG,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;AACxD,MAAM,WAAW,mBAAmB;IAChC,MAAM,CAAC,EAAE;QACL,IAAI,EAAE,UAAU,CAAC;QACjB,EAAE,EAAE,MAAM,CAAC;KACd,CAAC;CACL;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,mBAAmB,EAAE,GAAG,iBAAiB,CAOlF;AAED;;;;GAIG;AACH,MAAM,MAAM,OAAO,GAAG,GAAG,CAAC,MAAM,EAAE,KAAK,CAAC,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;AAE/D;;GAEG;AACH,wBAAgB,UAAU,CAAC,WAAW,EAAE,iBAAiB,GAAG,OAAO,CAuBlE;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,CAAC,SAAS,MAAM,GAAG,aAAa,EAChE,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,CAAC,EACR,KAAK,EAAE,KAAK,CAAC,CAAC,GAAG,mBAAmB,CAAC,GACtC,CAAC,GAAG,mBAAmB,CAyBzB"}
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getKeccakPreimages = getKeccakPreimages;
4
+ exports.getMapKeys = getMapKeys;
5
+ exports.addKeccakInvertInfo = addKeccakInvertInfo;
6
+ const utils_1 = require("../../../utils");
7
+ const opcodes_1 = require("../../opcodes");
8
+ /**
9
+ * Given a trace of contract creation/deletion event compute a gen/kill set summary for the trace.
10
+ */
11
+ function getKeccakPreimages(trace) {
12
+ return trace.reduce((m, info) => {
13
+ if (info.keccak) {
14
+ m.set(info.keccak.to, info.keccak.from);
15
+ }
16
+ return m;
17
+ }, new Map());
18
+ }
19
+ /**
20
+ * Build a `MapKeys` map from a KeccakPreimageMap
21
+ */
22
+ function getMapKeys(preImageMap) {
23
+ const res = new Map();
24
+ for (const [keccakVal, origKey] of preImageMap) {
25
+ // Since preimages for map indexing are a concatenation of the real key, and the 32bit
26
+ // storage slot, we don't care about any keccak operations not gerater than 32 bytes
27
+ if (origKey.length <= 32) {
28
+ continue;
29
+ }
30
+ const keySuffix = origKey.slice(-32);
31
+ const slot = (0, utils_1.bigEndianBufToBigint)(keySuffix);
32
+ if (!res.has(slot)) {
33
+ res.set(slot, []);
34
+ }
35
+ // Note we don't have to worry about duplicates. Values in KeccakPreimageMap are guaranteed to be unique due to the keys being
36
+ // their keccaks
37
+ res.get(slot).push([origKey.slice(0, -32), keccakVal]);
38
+ }
39
+ return res;
40
+ }
41
+ /**
42
+ * Add keccak256 pre-image info. Note we add it on the next instruction after the keccak
43
+ */
44
+ function addKeccakInvertInfo(vm, step, state, trace) {
45
+ if (trace.length === 0) {
46
+ return state;
47
+ }
48
+ const lastStep = trace[trace.length - 1];
49
+ if (!(lastStep.op.opcode === opcodes_1.OPCODES.SHA3)) {
50
+ return state;
51
+ }
52
+ const res = (0, utils_1.bigEndianBufToBigint)(state.evmStack[state.evmStack.length - 1]);
53
+ const lastStepTop = lastStep.evmStack.length - 1;
54
+ const off = (0, utils_1.bigEndianBufToNumber)(lastStep.evmStack[lastStepTop]);
55
+ const size = (0, utils_1.bigEndianBufToNumber)(lastStep.evmStack[lastStepTop - 1]);
56
+ const preImage = lastStep.memory.slice(off, off + size);
57
+ return {
58
+ keccak: {
59
+ from: preImage,
60
+ to: res
61
+ },
62
+ ...state
63
+ };
64
+ }
65
+ //# sourceMappingURL=keccak256_invert.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"keccak256_invert.js","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/keccak256_invert.ts"],"names":[],"mappings":";;AAiBA,gDAOC;AAYD,gCAuBC;AAKD,kDA8BC;AA5FD,0CAA4E;AAC5E,2CAAwC;AAWxC;;GAEG;AACH,SAAgB,kBAAkB,CAAC,KAA4B;IAC3D,OAAO,KAAK,CAAC,MAAM,CAAoB,CAAC,CAAC,EAAE,IAAI,EAAE,EAAE;QAC/C,IAAI,IAAI,CAAC,MAAM,EAAE,CAAC;YACd,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QAC5C,CAAC;QACD,OAAO,CAAC,CAAC;IACb,CAAC,EAAE,IAAI,GAAG,EAAE,CAAC,CAAC;AAClB,CAAC;AASD;;GAEG;AACH,SAAgB,UAAU,CAAC,WAA8B;IACrD,MAAM,GAAG,GAAY,IAAI,GAAG,EAAE,CAAC;IAE/B,KAAK,MAAM,CAAC,SAAS,EAAE,OAAO,CAAC,IAAI,WAAW,EAAE,CAAC;QAC7C,sFAAsF;QACtF,oFAAoF;QACpF,IAAI,OAAO,CAAC,MAAM,IAAI,EAAE,EAAE,CAAC;YACvB,SAAS;QACb,CAAC;QAED,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC;QACrC,MAAM,IAAI,GAAG,IAAA,4BAAoB,EAAC,SAAS,CAAC,CAAC;QAE7C,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;YACjB,GAAG,CAAC,GAAG,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QACtB,CAAC;QAED,8HAA8H;QAC9H,gBAAgB;QACf,GAAG,CAAC,GAAG,CAAC,IAAI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js/evm";
2
+ import { VM } from "@ethereumjs/vm";
3
+ import { EVMOpInfo } from "../../opcodes";
4
+ export interface OpInfo {
5
+ op: EVMOpInfo;
6
+ }
7
+ /**
8
+ * Adds op info to each step
9
+ */
10
+ export declare function addOpInfo<T extends object>(vm: VM, step: InterpreterStep, state: T): T & OpInfo;
11
+ //# sourceMappingURL=op.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"op.d.ts","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/op.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,EAAE,SAAS,EAAa,MAAM,eAAe,CAAC;AAErD,MAAM,WAAW,MAAM;IACnB,EAAE,EAAE,SAAS,CAAC;CACjB;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,CAAC,SAAS,MAAM,EAAE,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,GAAG,MAAM,CAE/F"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.addOpInfo = addOpInfo;
4
+ const opcodes_1 = require("../../opcodes");
5
+ /**
6
+ * Adds op info to each step
7
+ */
8
+ function addOpInfo(vm, step, state) {
9
+ return { op: (0, opcodes_1.getOpInfo)(step.opcode.name), ...state };
10
+ }
11
+ //# sourceMappingURL=op.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"op.js","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/op.ts"],"names":[],"mappings":";;AAWA,8BAEC;AAXD,2CAAqD;AAMrD;;GAEG;AACH,SAAgB,SAAS,CAAmB,EAAM,EAAE,IAAqB,EAAE,KAAQ;IAC/E,OAAO,EAAE,EAAE,EAAE,IAAA,mBAAS,EAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,GAAG,KAAK,EAAE,CAAC;AACzD,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { InterpreterStep } from "@ethereumjs/evm";
2
+ import { VM } from "@ethereumjs/vm";
3
+ import * as sol from "solc-typed-ast";
4
+ import { ExternalFrame } from "../../types";
5
+ import { BasicStepInfo } from "./basic_info";
6
+ import { ExternalFrameInfo } from "./ext_stack";
7
+ export interface SourceInfo {
8
+ src: sol.DecodedBytecodeSourceMapEntry | undefined;
9
+ astNode: sol.ASTNode | undefined;
10
+ }
11
+ /**
12
+ * Helper function to get the source information for the instruction at a given `instrOffset`,
13
+ * in the context of the external call `ctx`.
14
+ *
15
+ * There are several cases this handles:
16
+ *
17
+ * 1. If there is no debug info for the contract executing in `ctx` return undefined
18
+ * 2. If there is debug info, but no AST return only the decoded bytecode sourcemap entry
19
+ * 3. If there is both debug info and an AST return the decoded source location and any AST nodes that match this location
20
+ */
21
+ export declare function decodeSourceLoc(instrOffset: number, ctx: ExternalFrame): [sol.DecodedBytecodeSourceMapEntry | undefined, sol.ASTNode | undefined];
22
+ /**
23
+ * Adds source info for each step (if available)
24
+ */
25
+ export declare function addSource<T extends object & BasicStepInfo & ExternalFrameInfo>(vm: VM, step: InterpreterStep, state: T): Promise<T & SourceInfo>;
26
+ //# sourceMappingURL=source.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.d.ts","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/source.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAClD,OAAO,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAC;AACpC,OAAO,KAAK,GAAG,MAAM,gBAAgB,CAAC;AAEtC,OAAO,EAAE,aAAa,EAAa,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,iBAAiB,EAAe,MAAM,aAAa,CAAC;AAE7D,MAAM,WAAW,UAAU;IACvB,GAAG,EAAE,GAAG,CAAC,6BAA6B,GAAG,SAAS,CAAC;IACnD,OAAO,EAAE,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC;CACpC;AAED;;;;;;;;;GASG;AACH,wBAAgB,eAAe,CAC3B,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,aAAa,GACnB,CAAC,GAAG,CAAC,6BAA6B,GAAG,SAAS,EAAE,GAAG,CAAC,OAAO,GAAG,SAAS,CAAC,CAa1E;AAED;;GAEG;AACH,wBAAsB,SAAS,CAAC,CAAC,SAAS,MAAM,GAAG,aAAa,GAAG,iBAAiB,EAChF,EAAE,EAAE,EAAE,EACN,IAAI,EAAE,eAAe,EACrB,KAAK,EAAE,CAAC,GACT,OAAO,CAAC,CAAC,GAAG,UAAU,CAAC,CAQzB"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.decodeSourceLoc = decodeSourceLoc;
4
+ exports.addSource = addSource;
5
+ const artifact_manager_1 = require("../../artifact_manager");
6
+ const types_1 = require("../../types");
7
+ const ext_stack_1 = require("./ext_stack");
8
+ /**
9
+ * Helper function to get the source information for the instruction at a given `instrOffset`,
10
+ * in the context of the external call `ctx`.
11
+ *
12
+ * There are several cases this handles:
13
+ *
14
+ * 1. If there is no debug info for the contract executing in `ctx` return undefined
15
+ * 2. If there is debug info, but no AST return only the decoded bytecode sourcemap entry
16
+ * 3. If there is both debug info and an AST return the decoded source location and any AST nodes that match this location
17
+ */
18
+ function decodeSourceLoc(instrOffset, ctx) {
19
+ if (!ctx.info) {
20
+ return [undefined, undefined];
21
+ }
22
+ const bytecodeInfo = ctx.kind === types_1.FrameKind.Creation ? ctx.info.bytecode : ctx.info.deployedBytecode;
23
+ const src = (0, artifact_manager_1.getOffsetSrc)(instrOffset, bytecodeInfo);
24
+ const astNode = ctx.info.artifact.srcMap.get(`${src.start}:${src.length}:${src.sourceIndex}`);
25
+ return [src, astNode];
26
+ }
27
+ /**
28
+ * Adds source info for each step (if available)
29
+ */
30
+ async function addSource(vm, step, state) {
31
+ const [src, astNode] = decodeSourceLoc(state.pc, (0, ext_stack_1.topExtFrame)(state.stack));
32
+ return {
33
+ src,
34
+ astNode,
35
+ ...state
36
+ };
37
+ }
38
+ //# sourceMappingURL=source.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"source.js","sourceRoot":"","sources":["../../../../src/debug/tracers/transformers/source.ts"],"names":[],"mappings":";;AAuBA,0CAgBC;AAKD,8BAYC;AArDD,6DAAsD;AACtD,uCAAuD;AAEvD,2CAA6D;AAO7D;;;;;;;;;GASG;AACH,SAAgB,eAAe,CAC3B,WAAmB,EACnB,GAAkB;IAElB,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC;QACZ,OAAO,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAClC,CAAC;IAED,MAAM,YAAY,GACd,GAAG,CAAC,IAAI,KAAK,iBAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAEpF,MAAM,GAAG,GAAG,IAAA,+BAAY,EAAC,WAAW,EAAE,YAAY,CAAC,CAAC;IAEpD,MAAM,OAAO,GAAG,GAAG,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,IAAI,GAAG,CAAC,MAAM,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,CAAC;IAE9F,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;AAC1B,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,SAAS,CAC3B,EAAM,EACN,IAAqB,EACrB,KAAQ;IAER,MAAM,CAAC,GAAG,EAAE,OAAO,CAAC,GAAG,eAAe,CAAC,KAAK,CAAC,EAAE,EAAE,IAAA,uBAAW,EAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC;IAE3E,OAAO;QACH,GAAG;QACH,OAAO;QACP,GAAG,KAAK;KACX,CAAC;AACN,CAAC"}