@ton/sandbox 0.41.0 → 0.43.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/dist/blockchain/Blockchain.d.ts +1 -6
- package/dist/blockchain/Blockchain.js +0 -15
- package/dist/blockchain/SmartContract.d.ts +0 -3
- package/dist/blockchain/SmartContract.js +1 -39
- package/dist/config/config.tlb-gen.d.ts +69 -18
- package/dist/config/config.tlb-gen.js +273 -53
- package/dist/config/defaultConfig.d.ts +2 -2
- package/dist/config/defaultConfig.js +2 -2
- package/dist/config/slimConfig.d.ts +2 -2
- package/dist/config/slimConfig.js +2 -2
- package/dist/executor/Executor.d.ts +1 -37
- package/dist/executor/Executor.js +3 -160
- package/dist/executor/emulator-emscripten.js +1 -1
- package/dist/executor/emulator-emscripten.wasm.js +1 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js +1 -3
- package/package.json +4 -6
- package/CHANGELOG.md +0 -531
- package/dist/debugger/DebugContext.d.ts +0 -14
- package/dist/debugger/DebugContext.js +0 -29
- package/dist/debugger/DebugInfoCache.d.ts +0 -9
- package/dist/debugger/DebugInfoCache.js +0 -87
- package/dist/debugger/Debuggee.d.ts +0 -147
- package/dist/debugger/Debuggee.js +0 -451
- package/dist/debugger/TVMDebugSession.d.ts +0 -26
- package/dist/debugger/TVMDebugSession.js +0 -272
- package/dist/debugger/debug.d.ts +0 -4
- package/dist/debugger/debug.js +0 -76
- package/dist/debugger/index.d.ts +0 -1
- package/dist/debugger/index.js +0 -5
- package/dist/debugger/marks.d.ts +0 -2
- package/dist/debugger/marks.js +0 -127
- package/dist/executor/emulator-emscripten.debugger.bpatch.gzip.js +0 -1
- package/dist/executor/emulator-emscripten.debugger.js +0 -20
- package/dist/utils/bpatch.d.ts +0 -9
- package/dist/utils/bpatch.js +0 -52
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { LoggingDebugSession } from '@vscode/debugadapter';
|
|
2
|
-
import { DebugProtocol } from '@vscode/debugprotocol';
|
|
3
|
-
import { Debuggee } from './Debuggee';
|
|
4
|
-
export declare class TVMDebugSession extends LoggingDebugSession {
|
|
5
|
-
static readonly threadID = 1;
|
|
6
|
-
static readonly stackFrameID = 1;
|
|
7
|
-
static readonly localVariablesReference = 1;
|
|
8
|
-
static readonly globalVariablesReference = 2;
|
|
9
|
-
debuggee: Debuggee;
|
|
10
|
-
constructor(debuggee: Debuggee);
|
|
11
|
-
protected initializeRequest(response: DebugProtocol.InitializeResponse, _args: DebugProtocol.InitializeRequestArguments): void;
|
|
12
|
-
protected loadedSourcesRequest(response: DebugProtocol.LoadedSourcesResponse, _args: DebugProtocol.LoadedSourcesArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
13
|
-
protected breakpointLocationsRequest(response: DebugProtocol.BreakpointLocationsResponse, args: DebugProtocol.BreakpointLocationsArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
14
|
-
protected launchRequest(response: DebugProtocol.LaunchResponse, args: DebugProtocol.LaunchRequestArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
15
|
-
protected attachRequest(response: DebugProtocol.AttachResponse, args: DebugProtocol.AttachRequestArguments, request?: DebugProtocol.Request | undefined): void;
|
|
16
|
-
protected setBreakPointsRequest(response: DebugProtocol.SetBreakpointsResponse, args: DebugProtocol.SetBreakpointsArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
17
|
-
protected threadsRequest(response: DebugProtocol.ThreadsResponse, _request?: DebugProtocol.Request | undefined): void;
|
|
18
|
-
protected continueRequest(response: DebugProtocol.ContinueResponse, _args: DebugProtocol.ContinueArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
19
|
-
protected nextRequest(response: DebugProtocol.NextResponse, _args: DebugProtocol.NextArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
20
|
-
protected stepInRequest(response: DebugProtocol.StepInResponse, _args: DebugProtocol.StepInArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
21
|
-
protected stepOutRequest(response: DebugProtocol.StepOutResponse, _args: DebugProtocol.StepOutArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
22
|
-
protected stackTraceRequest(response: DebugProtocol.StackTraceResponse, args: DebugProtocol.StackTraceArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
23
|
-
protected scopesRequest(response: DebugProtocol.ScopesResponse, args: DebugProtocol.ScopesArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
24
|
-
protected variablesRequest(response: DebugProtocol.VariablesResponse, args: DebugProtocol.VariablesArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
25
|
-
protected disconnectRequest(response: DebugProtocol.DisconnectResponse, args: DebugProtocol.DisconnectArguments, _request?: DebugProtocol.Request | undefined): void;
|
|
26
|
-
}
|
|
@@ -1,272 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.TVMDebugSession = void 0;
|
|
4
|
-
const node_path_1 = require("node:path");
|
|
5
|
-
const debugadapter_1 = require("@vscode/debugadapter");
|
|
6
|
-
class TVMDebugSession extends debugadapter_1.LoggingDebugSession {
|
|
7
|
-
static threadID = 1;
|
|
8
|
-
static stackFrameID = 1;
|
|
9
|
-
static localVariablesReference = 1;
|
|
10
|
-
static globalVariablesReference = 2;
|
|
11
|
-
debuggee;
|
|
12
|
-
constructor(debuggee) {
|
|
13
|
-
super();
|
|
14
|
-
this.debuggee = debuggee;
|
|
15
|
-
this.debuggee.on('stopOnEntry', () => {
|
|
16
|
-
this.sendEvent(new debugadapter_1.StoppedEvent('entry', TVMDebugSession.threadID));
|
|
17
|
-
});
|
|
18
|
-
this.debuggee.on('stopOnBreakpoint', () => {
|
|
19
|
-
this.sendEvent(new debugadapter_1.StoppedEvent('breakpoint', TVMDebugSession.threadID));
|
|
20
|
-
});
|
|
21
|
-
this.debuggee.on('stopOnStep', () => {
|
|
22
|
-
this.sendEvent(new debugadapter_1.StoppedEvent('step', TVMDebugSession.threadID));
|
|
23
|
-
});
|
|
24
|
-
this.debuggee.on('end', () => {
|
|
25
|
-
this.sendEvent(new debugadapter_1.TerminatedEvent());
|
|
26
|
-
});
|
|
27
|
-
this.debuggee.on('output', (s) => {
|
|
28
|
-
this.sendEvent(new debugadapter_1.OutputEvent(s + '\n', 'stdout'));
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
initializeRequest(response, _args) {
|
|
32
|
-
response.body = response.body || {};
|
|
33
|
-
const b = response.body;
|
|
34
|
-
b.supportsConfigurationDoneRequest = false;
|
|
35
|
-
b.supportsFunctionBreakpoints = false;
|
|
36
|
-
b.supportsConditionalBreakpoints = false;
|
|
37
|
-
b.supportsHitConditionalBreakpoints = false;
|
|
38
|
-
b.supportsEvaluateForHovers = false;
|
|
39
|
-
b.supportsStepBack = false;
|
|
40
|
-
b.supportsSetVariable = false;
|
|
41
|
-
b.supportsRestartFrame = false;
|
|
42
|
-
b.supportsGotoTargetsRequest = false;
|
|
43
|
-
b.supportsStepInTargetsRequest = false;
|
|
44
|
-
b.supportsCompletionsRequest = false;
|
|
45
|
-
b.supportsModulesRequest = false;
|
|
46
|
-
b.supportsRestartRequest = false;
|
|
47
|
-
b.supportsValueFormattingOptions = false;
|
|
48
|
-
b.supportsExceptionInfoRequest = false;
|
|
49
|
-
b.supportTerminateDebuggee = false;
|
|
50
|
-
b.supportSuspendDebuggee = false;
|
|
51
|
-
b.supportsDelayedStackTraceLoading = false;
|
|
52
|
-
b.supportsLoadedSourcesRequest = true;
|
|
53
|
-
b.supportsLogPoints = false;
|
|
54
|
-
b.supportsTerminateThreadsRequest = false;
|
|
55
|
-
b.supportsSetExpression = false;
|
|
56
|
-
b.supportsTerminateRequest = false;
|
|
57
|
-
b.supportsDataBreakpoints = false;
|
|
58
|
-
b.supportsReadMemoryRequest = false;
|
|
59
|
-
b.supportsWriteMemoryRequest = false;
|
|
60
|
-
b.supportsDisassembleRequest = false;
|
|
61
|
-
b.supportsCancelRequest = false;
|
|
62
|
-
b.supportsBreakpointLocationsRequest = true;
|
|
63
|
-
b.supportsClipboardContext = false;
|
|
64
|
-
b.supportsSteppingGranularity = false;
|
|
65
|
-
b.supportsInstructionBreakpoints = false;
|
|
66
|
-
b.supportsExceptionFilterOptions = false;
|
|
67
|
-
b.supportsSingleThreadExecutionRequests = false;
|
|
68
|
-
this.sendResponse(response);
|
|
69
|
-
this.sendEvent(new debugadapter_1.InitializedEvent());
|
|
70
|
-
}
|
|
71
|
-
loadedSourcesRequest(response, _args, _request) {
|
|
72
|
-
response.body = response.body || {};
|
|
73
|
-
response.body.sources = this.debuggee.getAvailableSourcePaths().map((v) => ({
|
|
74
|
-
path: v,
|
|
75
|
-
name: (0, node_path_1.basename)(v),
|
|
76
|
-
}));
|
|
77
|
-
this.sendResponse(response);
|
|
78
|
-
}
|
|
79
|
-
breakpointLocationsRequest(response, args, _request) {
|
|
80
|
-
response.body = response.body || {};
|
|
81
|
-
const path = args.source.path;
|
|
82
|
-
if (path === undefined) {
|
|
83
|
-
this.sendErrorResponse(response, {
|
|
84
|
-
id: 1001,
|
|
85
|
-
format: 'No path',
|
|
86
|
-
});
|
|
87
|
-
return;
|
|
88
|
-
}
|
|
89
|
-
response.body.breakpoints = this.debuggee
|
|
90
|
-
.getAvailableLines(path)
|
|
91
|
-
.filter((l) => l >= args.line && l <= (args.endLine ?? args.line))
|
|
92
|
-
.map((l) => ({
|
|
93
|
-
line: l,
|
|
94
|
-
}));
|
|
95
|
-
this.sendResponse(response);
|
|
96
|
-
}
|
|
97
|
-
launchRequest(response, args, _request) {
|
|
98
|
-
debugadapter_1.logger.setup(debugadapter_1.Logger.LogLevel.Log);
|
|
99
|
-
this.debuggee.start(!args.noDebug, true);
|
|
100
|
-
this.sendResponse(response);
|
|
101
|
-
}
|
|
102
|
-
attachRequest(response, args, request) {
|
|
103
|
-
this.launchRequest(response, args, request);
|
|
104
|
-
}
|
|
105
|
-
setBreakPointsRequest(response, args, _request) {
|
|
106
|
-
const path = args.source.path;
|
|
107
|
-
if (path === undefined) {
|
|
108
|
-
this.sendErrorResponse(response, {
|
|
109
|
-
id: 1001,
|
|
110
|
-
format: 'No path',
|
|
111
|
-
});
|
|
112
|
-
return;
|
|
113
|
-
}
|
|
114
|
-
const breakpoints = args.breakpoints;
|
|
115
|
-
if (breakpoints === undefined) {
|
|
116
|
-
this.sendErrorResponse(response, {
|
|
117
|
-
id: 1002,
|
|
118
|
-
format: 'No breakpoints',
|
|
119
|
-
});
|
|
120
|
-
return;
|
|
121
|
-
}
|
|
122
|
-
this.debuggee.clearBreakpoints(path);
|
|
123
|
-
const bps = [];
|
|
124
|
-
for (const bp of breakpoints) {
|
|
125
|
-
const sbp = this.debuggee.setBreakpoint(path, bp.line);
|
|
126
|
-
bps.push({
|
|
127
|
-
id: sbp.id,
|
|
128
|
-
line: sbp.line,
|
|
129
|
-
verified: sbp.verified,
|
|
130
|
-
});
|
|
131
|
-
}
|
|
132
|
-
response.body = {
|
|
133
|
-
breakpoints: bps,
|
|
134
|
-
};
|
|
135
|
-
this.sendResponse(response);
|
|
136
|
-
}
|
|
137
|
-
threadsRequest(response, _request) {
|
|
138
|
-
response.body = {
|
|
139
|
-
threads: [new debugadapter_1.Thread(TVMDebugSession.threadID, 'main')],
|
|
140
|
-
};
|
|
141
|
-
this.sendResponse(response);
|
|
142
|
-
}
|
|
143
|
-
continueRequest(response, _args, _request) {
|
|
144
|
-
this.debuggee.continue();
|
|
145
|
-
this.sendResponse(response);
|
|
146
|
-
}
|
|
147
|
-
nextRequest(response, _args, _request) {
|
|
148
|
-
this.debuggee.stepOver();
|
|
149
|
-
this.sendResponse(response);
|
|
150
|
-
}
|
|
151
|
-
stepInRequest(response, _args, _request) {
|
|
152
|
-
this.debuggee.stepIn();
|
|
153
|
-
this.sendResponse(response);
|
|
154
|
-
}
|
|
155
|
-
stepOutRequest(response, _args, _request) {
|
|
156
|
-
this.debuggee.stepOut();
|
|
157
|
-
this.sendResponse(response);
|
|
158
|
-
}
|
|
159
|
-
stackTraceRequest(response, args, _request) {
|
|
160
|
-
response.body = response.body || {};
|
|
161
|
-
const sme = this.debuggee.currentSourceMapEntry(false);
|
|
162
|
-
if (sme === undefined) {
|
|
163
|
-
response.body.stackFrames = [];
|
|
164
|
-
response.body.totalFrames = 0;
|
|
165
|
-
this.sendResponse(response);
|
|
166
|
-
return;
|
|
167
|
-
}
|
|
168
|
-
const frames = this.debuggee.stackFrames();
|
|
169
|
-
response.body.totalFrames = frames.length;
|
|
170
|
-
if (args.startFrame ?? 0 >= frames.length) {
|
|
171
|
-
response.body.stackFrames = [];
|
|
172
|
-
this.sendResponse(response);
|
|
173
|
-
return;
|
|
174
|
-
}
|
|
175
|
-
response.body.stackFrames = [];
|
|
176
|
-
for (let i = args.startFrame ?? 0; i < frames.length; i++) {
|
|
177
|
-
const frame = frames[i];
|
|
178
|
-
response.body.stackFrames.push({
|
|
179
|
-
id: i === frames.length - 1 ? TVMDebugSession.stackFrameID : 0,
|
|
180
|
-
name: frame.function,
|
|
181
|
-
line: frame.line,
|
|
182
|
-
column: 0,
|
|
183
|
-
source: {
|
|
184
|
-
name: (0, node_path_1.basename)(frame.path),
|
|
185
|
-
path: frame.path,
|
|
186
|
-
},
|
|
187
|
-
});
|
|
188
|
-
}
|
|
189
|
-
response.body.stackFrames.reverse();
|
|
190
|
-
this.sendResponse(response);
|
|
191
|
-
}
|
|
192
|
-
scopesRequest(response, args, _request) {
|
|
193
|
-
response.body = response.body || {};
|
|
194
|
-
if (args.frameId !== TVMDebugSession.stackFrameID) {
|
|
195
|
-
response.body.scopes = [];
|
|
196
|
-
this.sendResponse(response);
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
const sme = this.debuggee.currentSourceMapEntry(false);
|
|
200
|
-
if (sme === undefined) {
|
|
201
|
-
response.body.scopes = [];
|
|
202
|
-
this.sendResponse(response);
|
|
203
|
-
return;
|
|
204
|
-
}
|
|
205
|
-
response.body.scopes = [
|
|
206
|
-
{
|
|
207
|
-
name: 'Locals',
|
|
208
|
-
variablesReference: TVMDebugSession.localVariablesReference,
|
|
209
|
-
expensive: false,
|
|
210
|
-
},
|
|
211
|
-
{
|
|
212
|
-
name: 'Globals',
|
|
213
|
-
variablesReference: TVMDebugSession.globalVariablesReference,
|
|
214
|
-
expensive: false,
|
|
215
|
-
},
|
|
216
|
-
];
|
|
217
|
-
this.sendResponse(response);
|
|
218
|
-
}
|
|
219
|
-
variablesRequest(response, args, _request) {
|
|
220
|
-
response.body = response.body || {};
|
|
221
|
-
response.body.variables = [];
|
|
222
|
-
let vars = undefined;
|
|
223
|
-
if (args.variablesReference === TVMDebugSession.localVariablesReference) {
|
|
224
|
-
vars = this.debuggee.getLocalVariables();
|
|
225
|
-
}
|
|
226
|
-
else if (args.variablesReference === TVMDebugSession.globalVariablesReference) {
|
|
227
|
-
vars = this.debuggee.getGlobalVariables();
|
|
228
|
-
}
|
|
229
|
-
if (vars === undefined) {
|
|
230
|
-
this.sendResponse(response);
|
|
231
|
-
return;
|
|
232
|
-
}
|
|
233
|
-
for (const v of vars) {
|
|
234
|
-
response.body.variables.push({
|
|
235
|
-
name: v.name,
|
|
236
|
-
value: tupleItemToString(v.value),
|
|
237
|
-
type: v.value.type,
|
|
238
|
-
variablesReference: 0,
|
|
239
|
-
});
|
|
240
|
-
}
|
|
241
|
-
response.body.variables.sort((a, b) => (a.name < b.name ? -1 : a.name > b.name ? 1 : 0));
|
|
242
|
-
this.sendResponse(response);
|
|
243
|
-
}
|
|
244
|
-
disconnectRequest(response, args, _request) {
|
|
245
|
-
if (args.restart) {
|
|
246
|
-
this.sendErrorResponse(response, {
|
|
247
|
-
id: 1003,
|
|
248
|
-
format: 'Cannot restart',
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
else {
|
|
252
|
-
this.sendResponse(response);
|
|
253
|
-
}
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
exports.TVMDebugSession = TVMDebugSession;
|
|
257
|
-
function tupleItemToString(ti) {
|
|
258
|
-
switch (ti.type) {
|
|
259
|
-
case 'int':
|
|
260
|
-
return ti.value.toString();
|
|
261
|
-
case 'null':
|
|
262
|
-
return 'null';
|
|
263
|
-
case 'nan':
|
|
264
|
-
return 'NaN';
|
|
265
|
-
case 'cell':
|
|
266
|
-
case 'slice':
|
|
267
|
-
case 'builder':
|
|
268
|
-
return ti.cell.toBoc().toString('base64');
|
|
269
|
-
case 'tuple':
|
|
270
|
-
return `[${ti.items.map((v) => tupleItemToString(v)).join(', ')}]`;
|
|
271
|
-
}
|
|
272
|
-
}
|
package/dist/debugger/debug.d.ts
DELETED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { GetMethodArgs, Executor, GetMethodResult, RunTransactionArgs, EmulationResult } from '../executor/Executor';
|
|
2
|
-
import { DebugInfo } from './Debuggee';
|
|
3
|
-
export declare function debugGetMethod(executor: Executor, args: GetMethodArgs, debugInfo: DebugInfo): Promise<GetMethodResult>;
|
|
4
|
-
export declare function debugTransaction(executor: Executor, args: RunTransactionArgs, debugInfo: DebugInfo): Promise<EmulationResult>;
|
package/dist/debugger/debug.js
DELETED
|
@@ -1,76 +0,0 @@
|
|
|
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 __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.debugGetMethod = debugGetMethod;
|
|
37
|
-
exports.debugTransaction = debugTransaction;
|
|
38
|
-
const Net = __importStar(require("net"));
|
|
39
|
-
const Debuggee_1 = require("./Debuggee");
|
|
40
|
-
const TVMDebugSession_1 = require("./TVMDebugSession");
|
|
41
|
-
const port = 42069;
|
|
42
|
-
function initDebuggee(executor) {
|
|
43
|
-
let dbg;
|
|
44
|
-
const promise = new Promise((resolve) => {
|
|
45
|
-
dbg = new Debuggee_1.Debuggee(executor, resolve);
|
|
46
|
-
});
|
|
47
|
-
return { dbg, promise };
|
|
48
|
-
}
|
|
49
|
-
async function debugGetMethod(executor, args, debugInfo) {
|
|
50
|
-
// eslint-disable-next-line no-console
|
|
51
|
-
console.log('Launched get method debug session. Please connect using the extension.');
|
|
52
|
-
const { dbg, promise } = initDebuggee(executor);
|
|
53
|
-
dbg.prepareGetMethod(args, debugInfo);
|
|
54
|
-
const server = Net.createServer((socket) => {
|
|
55
|
-
const session = new TVMDebugSession_1.TVMDebugSession(dbg);
|
|
56
|
-
session.setRunAsServer(true);
|
|
57
|
-
session.start(socket, socket);
|
|
58
|
-
}).listen(port);
|
|
59
|
-
const result = await promise;
|
|
60
|
-
server.close();
|
|
61
|
-
return result;
|
|
62
|
-
}
|
|
63
|
-
async function debugTransaction(executor, args, debugInfo) {
|
|
64
|
-
// eslint-disable-next-line no-console
|
|
65
|
-
console.log('Launched transaction debug session. Please connect using the extension.');
|
|
66
|
-
const { dbg, promise } = initDebuggee(executor);
|
|
67
|
-
dbg.prepareTransaction(args, debugInfo);
|
|
68
|
-
const server = Net.createServer((socket) => {
|
|
69
|
-
const session = new TVMDebugSession_1.TVMDebugSession(dbg);
|
|
70
|
-
session.setRunAsServer(true);
|
|
71
|
-
session.start(socket, socket);
|
|
72
|
-
}).listen(port);
|
|
73
|
-
const result = await promise;
|
|
74
|
-
server.close();
|
|
75
|
-
return result;
|
|
76
|
-
}
|
package/dist/debugger/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { getDebugContext } from './DebugContext';
|
package/dist/debugger/index.js
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getDebugContext = void 0;
|
|
4
|
-
var DebugContext_1 = require("./DebugContext");
|
|
5
|
-
Object.defineProperty(exports, "getDebugContext", { enumerable: true, get: function () { return DebugContext_1.getDebugContext; } });
|
package/dist/debugger/marks.d.ts
DELETED
package/dist/debugger/marks.js
DELETED
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseMarks = parseMarks;
|
|
4
|
-
const core_1 = require("@ton/core");
|
|
5
|
-
const MarksDictValue = {
|
|
6
|
-
parse(src) {
|
|
7
|
-
return src
|
|
8
|
-
.loadRef()
|
|
9
|
-
.beginParse()
|
|
10
|
-
.loadDictDirect(core_1.Dictionary.Keys.Uint(10), {
|
|
11
|
-
parse(_src) {
|
|
12
|
-
return null;
|
|
13
|
-
},
|
|
14
|
-
serialize(_src, _builder) {
|
|
15
|
-
throw new Error('Not implemented');
|
|
16
|
-
},
|
|
17
|
-
});
|
|
18
|
-
},
|
|
19
|
-
serialize(_src, _builder) {
|
|
20
|
-
throw new Error('Not implemented');
|
|
21
|
-
},
|
|
22
|
-
};
|
|
23
|
-
const CellInfoValue = {
|
|
24
|
-
parse(src) {
|
|
25
|
-
return {
|
|
26
|
-
isNormal: src.loadBit(),
|
|
27
|
-
marks: src.loadDict(core_1.Dictionary.Keys.Uint(32), MarksDictValue),
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
serialize(_src, _builder) {
|
|
31
|
-
throw new Error('Not implemented');
|
|
32
|
-
},
|
|
33
|
-
};
|
|
34
|
-
const CellValue = {
|
|
35
|
-
parse(src) {
|
|
36
|
-
return src.asCell();
|
|
37
|
-
},
|
|
38
|
-
serialize(_src, _builder) {
|
|
39
|
-
throw new Error('Not implemented');
|
|
40
|
-
},
|
|
41
|
-
};
|
|
42
|
-
function sliceToString(slice, len) {
|
|
43
|
-
let out = '';
|
|
44
|
-
for (let i = 0; i < len; i++) {
|
|
45
|
-
out += slice.loadBit() ? '1' : '0';
|
|
46
|
-
}
|
|
47
|
-
return out;
|
|
48
|
-
}
|
|
49
|
-
function readLabel(slice, m) {
|
|
50
|
-
if (slice.loadBit()) {
|
|
51
|
-
if (slice.loadBit()) {
|
|
52
|
-
const bit = slice.loadBit();
|
|
53
|
-
const len = slice.loadUint(Math.ceil(Math.log2(m + 1)));
|
|
54
|
-
return (bit ? '1' : '0').repeat(len);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
const len = slice.loadUint(Math.ceil(Math.log2(m + 1)));
|
|
58
|
-
return sliceToString(slice, len);
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
else {
|
|
62
|
-
let len = 0;
|
|
63
|
-
while (slice.loadBit()) {
|
|
64
|
-
len++;
|
|
65
|
-
}
|
|
66
|
-
return sliceToString(slice, len);
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
function getFinalSlice(dc, key) {
|
|
70
|
-
const dict = dc.beginParse();
|
|
71
|
-
const lbl = readLabel(dict, key.length);
|
|
72
|
-
if (!key.startsWith(lbl)) {
|
|
73
|
-
throw new Error('Invalid label');
|
|
74
|
-
}
|
|
75
|
-
if (lbl.length === key.length) {
|
|
76
|
-
return dc;
|
|
77
|
-
}
|
|
78
|
-
let child = dict.loadRef();
|
|
79
|
-
if (key[lbl.length] === '1') {
|
|
80
|
-
child = dict.loadRef();
|
|
81
|
-
}
|
|
82
|
-
return getFinalSlice(child, key.slice(lbl.length + 1));
|
|
83
|
-
}
|
|
84
|
-
function hashToString(hash) {
|
|
85
|
-
return hash.toString('hex').toUpperCase();
|
|
86
|
-
}
|
|
87
|
-
function getRealCodeHashes(code) {
|
|
88
|
-
const dictC = code.beginParse().loadRef();
|
|
89
|
-
const d = dictC.beginParse().loadDictDirect(core_1.Dictionary.Keys.Int(19), CellValue);
|
|
90
|
-
const r = new Map();
|
|
91
|
-
for (const [idx, v] of d) {
|
|
92
|
-
const idxKey = sliceToString((0, core_1.beginCell)().storeInt(idx, 19).endCell().beginParse(), 19);
|
|
93
|
-
const finalSlice = getFinalSlice(dictC, idxKey);
|
|
94
|
-
const originalSlice = d.get(idx);
|
|
95
|
-
if (originalSlice === undefined) {
|
|
96
|
-
throw new Error('Unknown original slice');
|
|
97
|
-
}
|
|
98
|
-
r.set(hashToString(v.hash()), {
|
|
99
|
-
hash: hashToString(finalSlice.hash()),
|
|
100
|
-
diff: finalSlice.bits.length - originalSlice.bits.length,
|
|
101
|
-
});
|
|
102
|
-
}
|
|
103
|
-
return r;
|
|
104
|
-
}
|
|
105
|
-
function parseMarks(marksCell, code) {
|
|
106
|
-
const realCodeHashes = getRealCodeHashes(code);
|
|
107
|
-
const d = marksCell.beginParse().loadDictDirect(core_1.Dictionary.Keys.Buffer(32), CellInfoValue);
|
|
108
|
-
const r = new Map();
|
|
109
|
-
for (const [hash, info] of d) {
|
|
110
|
-
const hashStr = hashToString(hash);
|
|
111
|
-
const finalHash = info.isNormal ? hashStr : realCodeHashes.get(hashStr)?.hash;
|
|
112
|
-
if (finalHash === undefined) {
|
|
113
|
-
continue;
|
|
114
|
-
}
|
|
115
|
-
const marks = new Map();
|
|
116
|
-
for (const [mark, offsets] of info.marks) {
|
|
117
|
-
for (const offset of offsets.keys()) {
|
|
118
|
-
const adjustedOffset = offset + (info.isNormal ? 0 : (realCodeHashes.get(hashStr)?.diff ?? 0));
|
|
119
|
-
const arr = marks.get(adjustedOffset) ?? [];
|
|
120
|
-
arr.push(mark);
|
|
121
|
-
marks.set(adjustedOffset, arr);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
r.set(finalHash, marks);
|
|
125
|
-
}
|
|
126
|
-
return r;
|
|
127
|
-
}
|