hardhat 2.22.11 → 2.22.12

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 (90) hide show
  1. package/internal/hardhat-network/provider/provider.d.ts +2 -3
  2. package/internal/hardhat-network/provider/provider.d.ts.map +1 -1
  3. package/internal/hardhat-network/provider/provider.js +5 -19
  4. package/internal/hardhat-network/provider/provider.js.map +1 -1
  5. package/internal/hardhat-network/provider/return-data.d.ts +2 -15
  6. package/internal/hardhat-network/provider/return-data.d.ts.map +1 -1
  7. package/internal/hardhat-network/provider/return-data.js +2 -50
  8. package/internal/hardhat-network/provider/return-data.js.map +1 -1
  9. package/internal/hardhat-network/provider/vm/exit.d.ts +2 -20
  10. package/internal/hardhat-network/provider/vm/exit.d.ts.map +1 -1
  11. package/internal/hardhat-network/provider/vm/exit.js +3 -78
  12. package/internal/hardhat-network/provider/vm/exit.js.map +1 -1
  13. package/internal/hardhat-network/stack-traces/compiler-to-model.d.ts +2 -3
  14. package/internal/hardhat-network/stack-traces/compiler-to-model.d.ts.map +1 -1
  15. package/internal/hardhat-network/stack-traces/compiler-to-model.js +2 -351
  16. package/internal/hardhat-network/stack-traces/compiler-to-model.js.map +1 -1
  17. package/internal/hardhat-network/stack-traces/debug.d.ts +2 -7
  18. package/internal/hardhat-network/stack-traces/debug.d.ts.map +1 -1
  19. package/internal/hardhat-network/stack-traces/debug.js +3 -143
  20. package/internal/hardhat-network/stack-traces/debug.js.map +1 -1
  21. package/internal/hardhat-network/stack-traces/library-utils.d.ts +2 -11
  22. package/internal/hardhat-network/stack-traces/library-utils.d.ts.map +1 -1
  23. package/internal/hardhat-network/stack-traces/library-utils.js +3 -61
  24. package/internal/hardhat-network/stack-traces/library-utils.js.map +1 -1
  25. package/internal/hardhat-network/stack-traces/message-trace.d.ts +2 -51
  26. package/internal/hardhat-network/stack-traces/message-trace.d.ts.map +1 -1
  27. package/internal/hardhat-network/stack-traces/message-trace.js +0 -46
  28. package/internal/hardhat-network/stack-traces/message-trace.js.map +1 -1
  29. package/internal/hardhat-network/stack-traces/solidity-errors.d.ts.map +1 -1
  30. package/internal/hardhat-network/stack-traces/solidity-errors.js +58 -53
  31. package/internal/hardhat-network/stack-traces/solidity-errors.js.map +1 -1
  32. package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts +4 -155
  33. package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts.map +1 -1
  34. package/internal/hardhat-network/stack-traces/solidity-stack-trace.js +12 -37
  35. package/internal/hardhat-network/stack-traces/solidity-stack-trace.js.map +1 -1
  36. package/internal/hardhat-network/stack-traces/solidityTracer.d.ts +2 -13
  37. package/internal/hardhat-network/stack-traces/solidityTracer.d.ts.map +1 -1
  38. package/internal/hardhat-network/stack-traces/solidityTracer.js +2 -162
  39. package/internal/hardhat-network/stack-traces/solidityTracer.js.map +1 -1
  40. package/internal/hardhat-network/stack-traces/vm-trace-decoder.d.ts +4 -15
  41. package/internal/hardhat-network/stack-traces/vm-trace-decoder.d.ts.map +1 -1
  42. package/internal/hardhat-network/stack-traces/vm-trace-decoder.js +6 -70
  43. package/internal/hardhat-network/stack-traces/vm-trace-decoder.js.map +1 -1
  44. package/internal/hardhat-network/stack-traces/vm-tracer.d.ts +2 -19
  45. package/internal/hardhat-network/stack-traces/vm-tracer.d.ts.map +1 -1
  46. package/internal/hardhat-network/stack-traces/vm-tracer.js +3 -150
  47. package/internal/hardhat-network/stack-traces/vm-tracer.js.map +1 -1
  48. package/package.json +4 -4
  49. package/src/internal/hardhat-network/provider/provider.ts +11 -24
  50. package/src/internal/hardhat-network/provider/return-data.ts +5 -73
  51. package/src/internal/hardhat-network/provider/vm/exit.ts +4 -92
  52. package/src/internal/hardhat-network/stack-traces/compiler-to-model.ts +5 -697
  53. package/src/internal/hardhat-network/stack-traces/debug.ts +5 -218
  54. package/src/internal/hardhat-network/stack-traces/library-utils.ts +5 -90
  55. package/src/internal/hardhat-network/stack-traces/message-trace.ts +5 -122
  56. package/src/internal/hardhat-network/stack-traces/solidity-errors.ts +16 -15
  57. package/src/internal/hardhat-network/stack-traces/solidity-stack-trace.ts +83 -186
  58. package/src/internal/hardhat-network/stack-traces/solidityTracer.ts +5 -253
  59. package/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts +15 -108
  60. package/src/internal/hardhat-network/stack-traces/vm-tracer.ts +5 -206
  61. package/internal/hardhat-network/stack-traces/contracts-identifier.d.ts +0 -15
  62. package/internal/hardhat-network/stack-traces/contracts-identifier.d.ts.map +0 -1
  63. package/internal/hardhat-network/stack-traces/contracts-identifier.js +0 -166
  64. package/internal/hardhat-network/stack-traces/contracts-identifier.js.map +0 -1
  65. package/internal/hardhat-network/stack-traces/error-inferrer.d.ts +0 -85
  66. package/internal/hardhat-network/stack-traces/error-inferrer.d.ts.map +0 -1
  67. package/internal/hardhat-network/stack-traces/error-inferrer.js +0 -1168
  68. package/internal/hardhat-network/stack-traces/error-inferrer.js.map +0 -1
  69. package/internal/hardhat-network/stack-traces/mapped-inlined-internal-functions-heuristics.d.ts +0 -24
  70. package/internal/hardhat-network/stack-traces/mapped-inlined-internal-functions-heuristics.d.ts.map +0 -1
  71. package/internal/hardhat-network/stack-traces/mapped-inlined-internal-functions-heuristics.js +0 -116
  72. package/internal/hardhat-network/stack-traces/mapped-inlined-internal-functions-heuristics.js.map +0 -1
  73. package/internal/hardhat-network/stack-traces/model.d.ts +0 -140
  74. package/internal/hardhat-network/stack-traces/model.d.ts.map +0 -1
  75. package/internal/hardhat-network/stack-traces/model.js +0 -328
  76. package/internal/hardhat-network/stack-traces/model.js.map +0 -1
  77. package/internal/hardhat-network/stack-traces/opcodes.d.ts +0 -266
  78. package/internal/hardhat-network/stack-traces/opcodes.d.ts.map +0 -1
  79. package/internal/hardhat-network/stack-traces/opcodes.js +0 -320
  80. package/internal/hardhat-network/stack-traces/opcodes.js.map +0 -1
  81. package/internal/hardhat-network/stack-traces/source-maps.d.ts +0 -13
  82. package/internal/hardhat-network/stack-traces/source-maps.d.ts.map +0 -1
  83. package/internal/hardhat-network/stack-traces/source-maps.js +0 -106
  84. package/internal/hardhat-network/stack-traces/source-maps.js.map +0 -1
  85. package/src/internal/hardhat-network/stack-traces/contracts-identifier.ts +0 -235
  86. package/src/internal/hardhat-network/stack-traces/error-inferrer.ts +0 -1845
  87. package/src/internal/hardhat-network/stack-traces/mapped-inlined-internal-functions-heuristics.ts +0 -163
  88. package/src/internal/hardhat-network/stack-traces/model.ts +0 -409
  89. package/src/internal/hardhat-network/stack-traces/opcodes.ts +0 -344
  90. package/src/internal/hardhat-network/stack-traces/source-maps.ts +0 -167
@@ -1,208 +1,7 @@
1
- import type {
2
- CreateOutput,
3
- ExecutionResult,
4
- TracingMessage,
5
- TracingStep,
6
- } from "@nomicfoundation/edr";
1
+ import { requireNapiRsModule } from "../../../common/napi-rs";
7
2
 
8
- import { bytesToBigInt } from "@nomicfoundation/ethereumjs-util";
3
+ const { VmTracer } = requireNapiRsModule(
4
+ "@nomicfoundation/edr"
5
+ ) as typeof import("@nomicfoundation/edr");
9
6
 
10
- import { assertHardhatInvariant } from "../../core/errors";
11
- import { Exit, ExitCode } from "../provider/vm/exit";
12
-
13
- import {
14
- CallMessageTrace,
15
- CreateMessageTrace,
16
- isCreateTrace,
17
- isHaltResult,
18
- isPrecompileTrace,
19
- isSuccessResult,
20
- MessageTrace,
21
- PrecompileMessageTrace,
22
- } from "./message-trace";
23
-
24
- /* eslint-disable @nomicfoundation/hardhat-internal-rules/only-hardhat-error */
25
-
26
- const DUMMY_RETURN_DATA = Buffer.from([]);
27
- const DUMMY_GAS_USED = 0n;
28
-
29
- /**
30
- * Consumes the incoming VM trace events, until an error occurs, to keep track
31
- * of the last top level message trace/error.
32
- */
33
- export class VMTracer {
34
- public tracingSteps: TracingStep[] = [];
35
-
36
- private _messageTraces: MessageTrace[] = [];
37
- private _lastError: Error | undefined;
38
- private _maxPrecompileNumber;
39
-
40
- constructor() {
41
- // TODO: temporarily hardcoded to remove the need of using ethereumjs' common and evm here
42
- this._maxPrecompileNumber = 10;
43
- }
44
-
45
- public getLastTopLevelMessageTrace(): MessageTrace | undefined {
46
- return this._messageTraces[0];
47
- }
48
-
49
- public getLastError(): Error | undefined {
50
- return this._lastError;
51
- }
52
-
53
- private _shouldKeepTracing() {
54
- return this._lastError === undefined;
55
- }
56
-
57
- public addBeforeMessage(message: TracingMessage) {
58
- if (!this._shouldKeepTracing()) {
59
- return;
60
- }
61
-
62
- try {
63
- let trace: MessageTrace;
64
-
65
- if (message.depth === 0) {
66
- this._messageTraces = [];
67
- this.tracingSteps = [];
68
- }
69
-
70
- if (message.to === undefined) {
71
- const createTrace: CreateMessageTrace = {
72
- code: message.data,
73
- steps: [],
74
- value: message.value,
75
- exit: new Exit(ExitCode.SUCCESS),
76
- returnData: DUMMY_RETURN_DATA,
77
- numberOfSubtraces: 0,
78
- depth: message.depth,
79
- deployedContract: undefined,
80
- gasUsed: DUMMY_GAS_USED,
81
- };
82
-
83
- trace = createTrace;
84
- } else {
85
- const toAsBigInt = bytesToBigInt(message.to);
86
-
87
- if (toAsBigInt > 0 && toAsBigInt <= this._maxPrecompileNumber) {
88
- const precompileTrace: PrecompileMessageTrace = {
89
- precompile: Number(toAsBigInt),
90
- calldata: message.data,
91
- value: message.value,
92
- exit: new Exit(ExitCode.SUCCESS),
93
- returnData: DUMMY_RETURN_DATA,
94
- depth: message.depth,
95
- gasUsed: DUMMY_GAS_USED,
96
- };
97
-
98
- trace = precompileTrace;
99
- } else {
100
- const codeAddress = message.codeAddress;
101
-
102
- // if we enter here, then `to` is not undefined, therefore
103
- // `codeAddress` and `code` should be defined
104
- assertHardhatInvariant(
105
- codeAddress !== undefined,
106
- "codeAddress should be defined"
107
- );
108
- assertHardhatInvariant(
109
- message.code !== undefined,
110
- "code should be defined"
111
- );
112
-
113
- const callTrace: CallMessageTrace = {
114
- code: message.code,
115
- calldata: message.data,
116
- steps: [],
117
- value: message.value,
118
- exit: new Exit(ExitCode.SUCCESS),
119
- returnData: DUMMY_RETURN_DATA,
120
- address: message.to,
121
- numberOfSubtraces: 0,
122
- depth: message.depth,
123
- gasUsed: DUMMY_GAS_USED,
124
- codeAddress,
125
- };
126
-
127
- trace = callTrace;
128
- }
129
- }
130
-
131
- if (this._messageTraces.length > 0) {
132
- const parentTrace = this._messageTraces[this._messageTraces.length - 1];
133
-
134
- if (isPrecompileTrace(parentTrace)) {
135
- throw new Error(
136
- "This should not happen: message execution started while a precompile was executing"
137
- );
138
- }
139
-
140
- parentTrace.steps.push(trace);
141
- parentTrace.numberOfSubtraces += 1;
142
- }
143
-
144
- this._messageTraces.push(trace);
145
- } catch (error) {
146
- this._lastError = error as Error;
147
- }
148
- }
149
-
150
- public addStep(step: TracingStep) {
151
- if (!this._shouldKeepTracing()) {
152
- return;
153
- }
154
-
155
- this.tracingSteps.push(step);
156
-
157
- try {
158
- const trace = this._messageTraces[this._messageTraces.length - 1];
159
-
160
- if (isPrecompileTrace(trace)) {
161
- throw new Error(
162
- "This should not happen: step event fired while a precompile was executing"
163
- );
164
- }
165
-
166
- trace.steps.push({ pc: Number(step.pc) });
167
- } catch (error) {
168
- this._lastError = error as Error;
169
- }
170
- }
171
-
172
- public addAfterMessage(result: ExecutionResult) {
173
- if (!this._shouldKeepTracing()) {
174
- return;
175
- }
176
-
177
- try {
178
- const trace = this._messageTraces[this._messageTraces.length - 1];
179
- trace.gasUsed = result.result.gasUsed;
180
-
181
- const executionResult = result.result;
182
- if (isSuccessResult(executionResult)) {
183
- trace.exit = Exit.fromEdrSuccessReason(executionResult.reason);
184
- trace.returnData = executionResult.output.returnValue;
185
-
186
- if (isCreateTrace(trace)) {
187
- trace.deployedContract = (
188
- executionResult.output as CreateOutput
189
- ).address;
190
- }
191
- } else if (isHaltResult(executionResult)) {
192
- trace.exit = Exit.fromEdrExceptionalHalt(executionResult.reason);
193
-
194
- trace.returnData = Buffer.from([]);
195
- } else {
196
- trace.exit = new Exit(ExitCode.REVERT);
197
-
198
- trace.returnData = executionResult.output;
199
- }
200
-
201
- if (this._messageTraces.length > 1) {
202
- this._messageTraces.pop();
203
- }
204
- } catch (error) {
205
- this._lastError = error as Error;
206
- }
207
- }
208
- }
7
+ export { VmTracer as VMTracer };
@@ -1,15 +0,0 @@
1
- import { Bytecode } from "./model";
2
- export declare class ContractsIdentifier {
3
- private readonly _enableCache;
4
- private _trie;
5
- private _cache;
6
- constructor(_enableCache?: boolean);
7
- addBytecode(bytecode: Bytecode): void;
8
- getBytecodeForCall(code: Uint8Array, isCreate: boolean): Bytecode | undefined;
9
- private _searchBytecode;
10
- /**
11
- * Returns true if the lastByte is placed right when the metadata starts or after it.
12
- */
13
- private _isMatchingMetadata;
14
- }
15
- //# sourceMappingURL=contracts-identifier.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contracts-identifier.d.ts","sourceRoot":"","sources":["../../../src/internal/hardhat-network/stack-traces/contracts-identifier.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAmFnC,qBAAa,mBAAmB;IAIlB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAHzC,OAAO,CAAC,KAAK,CAAwB;IACrC,OAAO,CAAC,MAAM,CAAoC;gBAErB,YAAY,UAAO;IAEzC,WAAW,CAAC,QAAQ,EAAE,QAAQ;IAK9B,kBAAkB,CACvB,IAAI,EAAE,UAAU,EAChB,QAAQ,EAAE,OAAO,GAChB,QAAQ,GAAG,SAAS;IAwBvB,OAAO,CAAC,eAAe;IAyFvB;;OAEG;IACH,OAAO,CAAC,mBAAmB;CAc5B"}
@@ -1,166 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ContractsIdentifier = void 0;
4
- const ethereumjs_util_1 = require("@nomicfoundation/ethereumjs-util");
5
- const library_utils_1 = require("./library-utils");
6
- const opcodes_1 = require("./opcodes");
7
- /**
8
- * This class represent a somewhat special Trie of bytecodes.
9
- *
10
- * What makes it special is that every node has a set of all of its descendants and its depth.
11
- */
12
- class BytecodeTrie {
13
- static isBytecodeTrie(o) {
14
- if (o === undefined || o === null) {
15
- return false;
16
- }
17
- return "childNodes" in o;
18
- }
19
- constructor(depth) {
20
- this.depth = depth;
21
- this.childNodes = new Map();
22
- this.descendants = [];
23
- }
24
- add(bytecode) {
25
- // eslint-disable-next-line @typescript-eslint/no-this-alias
26
- let trieNode = this;
27
- for (let currentCodeByte = 0; currentCodeByte <= bytecode.normalizedCode.length; currentCodeByte += 1) {
28
- if (currentCodeByte === bytecode.normalizedCode.length) {
29
- // If multiple contracts with the exact same bytecode are added we keep the last of them.
30
- // Note that this includes the metadata hash, so the chances of happening are pretty remote,
31
- // except in super artificial cases that we have in our test suite.
32
- trieNode.match = bytecode;
33
- return;
34
- }
35
- const byte = bytecode.normalizedCode[currentCodeByte];
36
- trieNode.descendants.push(bytecode);
37
- let childNode = trieNode.childNodes.get(byte);
38
- if (childNode === undefined) {
39
- childNode = new BytecodeTrie(currentCodeByte);
40
- trieNode.childNodes.set(byte, childNode);
41
- }
42
- trieNode = childNode;
43
- }
44
- }
45
- /**
46
- * Searches for a bytecode. If it's an exact match, it is returned. If there's no match, but a
47
- * prefix of the code is found in the trie, the node of the longest prefix is returned. If the
48
- * entire code is covered by the trie, and there's no match, we return undefined.
49
- */
50
- search(code, currentCodeByte = 0) {
51
- if (currentCodeByte > code.length) {
52
- return undefined;
53
- }
54
- // eslint-disable-next-line @typescript-eslint/no-this-alias
55
- let trieNode = this;
56
- for (; currentCodeByte <= code.length; currentCodeByte += 1) {
57
- if (currentCodeByte === code.length) {
58
- return trieNode.match;
59
- }
60
- const childNode = trieNode.childNodes.get(code[currentCodeByte]);
61
- if (childNode === undefined) {
62
- return trieNode;
63
- }
64
- trieNode = childNode;
65
- }
66
- }
67
- }
68
- class ContractsIdentifier {
69
- constructor(_enableCache = true) {
70
- this._enableCache = _enableCache;
71
- this._trie = new BytecodeTrie(-1);
72
- this._cache = new Map();
73
- }
74
- addBytecode(bytecode) {
75
- this._trie.add(bytecode);
76
- this._cache.clear();
77
- }
78
- getBytecodeForCall(code, isCreate) {
79
- const normalizedCode = (0, library_utils_1.normalizeLibraryRuntimeBytecodeIfNecessary)(code);
80
- let normalizedCodeHex;
81
- if (this._enableCache) {
82
- normalizedCodeHex = (0, ethereumjs_util_1.bytesToHex)(normalizedCode);
83
- const cached = this._cache.get(normalizedCodeHex);
84
- if (cached !== undefined) {
85
- return cached;
86
- }
87
- }
88
- const result = this._searchBytecode(isCreate, normalizedCode);
89
- if (this._enableCache) {
90
- if (result !== undefined) {
91
- this._cache.set(normalizedCodeHex, result);
92
- }
93
- }
94
- return result;
95
- }
96
- _searchBytecode(isCreate, code, normalizeLibraries = true, trie = this._trie, firstByteToSearch = 0) {
97
- const searchResult = trie.search(code, firstByteToSearch);
98
- if (searchResult === undefined) {
99
- return undefined;
100
- }
101
- if (!BytecodeTrie.isBytecodeTrie(searchResult)) {
102
- return searchResult;
103
- }
104
- // Deployment messages have their abi-encoded arguments at the end of the bytecode.
105
- //
106
- // We don't know how long those arguments are, as we don't know which contract is being
107
- // deployed, hence we don't know the signature of its constructor.
108
- //
109
- // To make things even harder, we can't trust that the user actually passed the right
110
- // amount of arguments.
111
- //
112
- // Luckily, the chances of a complete deployment bytecode being the prefix of another one are
113
- // remote. For example, most of the time it ends with its metadata hash, which will differ.
114
- //
115
- // We take advantage of this last observation, and just return the bytecode that exactly
116
- // matched the searchResult (sub)trie that we got.
117
- if (isCreate &&
118
- searchResult.match !== undefined &&
119
- searchResult.match.isDeployment) {
120
- return searchResult.match;
121
- }
122
- if (normalizeLibraries) {
123
- for (const bytecodeWithLibraries of searchResult.descendants) {
124
- if (bytecodeWithLibraries.libraryAddressPositions.length === 0 &&
125
- bytecodeWithLibraries.immutableReferences.length === 0) {
126
- continue;
127
- }
128
- const normalizedLibrariesCode = (0, library_utils_1.zeroOutAddresses)(code, bytecodeWithLibraries.libraryAddressPositions);
129
- const normalizedCode = (0, library_utils_1.zeroOutSlices)(normalizedLibrariesCode, bytecodeWithLibraries.immutableReferences);
130
- const normalizedResult = this._searchBytecode(isCreate, normalizedCode, false, searchResult, searchResult.depth + 1);
131
- if (normalizedResult !== undefined) {
132
- return normalizedResult;
133
- }
134
- }
135
- }
136
- // If we got here we may still have the contract, but with a different metadata hash.
137
- //
138
- // We check if we got to match the entire executable bytecode, and are just stuck because
139
- // of the metadata. If that's the case, we can assume that any descendant will be a valid
140
- // Bytecode, so we just choose the most recently added one.
141
- //
142
- // The reason this works is because there's no chance that Solidity includes an entire
143
- // bytecode (i.e. with metadata), as a prefix of another one.
144
- if (this._isMatchingMetadata(code, searchResult.depth) &&
145
- searchResult.descendants.length > 0) {
146
- return searchResult.descendants[searchResult.descendants.length - 1];
147
- }
148
- return undefined;
149
- }
150
- /**
151
- * Returns true if the lastByte is placed right when the metadata starts or after it.
152
- */
153
- _isMatchingMetadata(code, lastByte) {
154
- for (let byte = 0; byte < lastByte;) {
155
- const opcode = code[byte];
156
- // Solidity always emits REVERT INVALID right before the metadata
157
- if (opcode === opcodes_1.Opcode.REVERT && code[byte + 1] === opcodes_1.Opcode.INVALID) {
158
- return true;
159
- }
160
- byte += (0, opcodes_1.getOpcodeLength)(opcode);
161
- }
162
- return false;
163
- }
164
- }
165
- exports.ContractsIdentifier = ContractsIdentifier;
166
- //# sourceMappingURL=contracts-identifier.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"contracts-identifier.js","sourceRoot":"","sources":["../../../src/internal/hardhat-network/stack-traces/contracts-identifier.ts"],"names":[],"mappings":";;;AAAA,sEAA8D;AAE9D,mDAIyB;AAEzB,uCAAoD;AAEpD;;;;GAIG;AACH,MAAM,YAAY;IACT,MAAM,CAAC,cAAc,CAAC,CAAM;QACjC,IAAI,CAAC,KAAK,SAAS,IAAI,CAAC,KAAK,IAAI,EAAE;YACjC,OAAO,KAAK,CAAC;SACd;QAED,OAAO,YAAY,IAAI,CAAC,CAAC;IAC3B,CAAC;IAMD,YAA4B,KAAa;Q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,KAAK,GAAG,CAAC,CACvB,CAAC;gBAEF,IAAI,gBAAgB,KAAK,SAAS,EAAE;oBAClC,OAAO,gBAAgB,CAAC;iBACzB;aACF;SACF;QAED,qFAAqF;QACrF,EAAE;QACF,yFAAyF;QACzF,yFAAyF;QACzF,2DAA2D;QAC3D,EAAE;QACF,sFAAsF;QACtF,6DAA6D;QAC7D,IACE,IAAI,CAAC,mBAAmB,CAAC,IAAI,EAAE,YAAY,CAAC,KAAK,CAAC;YAClD,YAAY,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,EACnC;YACA,OAAO,YAAY,CAAC,WAAW,CAAC,YAAY,CAAC,WAAW,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC;SACtE;QAED,OAAO,SAAS,CAAC;IACnB,CAAC;IAED;;OAEG;IACK,mBAAmB,CAAC,IAAgB,EAAE,QAAgB;QAC5D,KAAK,IAAI,IAAI,GAAG,CAAC,EAAE,IAAI,GAAG,QAAQ,GAAI;YACpC,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;YAE1B,iEAAiE;YACjE,IAAI,MAAM,KAAK,gBAAM,CAAC,MAAM,IAAI,IAAI,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,gBAAM,CAAC,OAAO,EAAE;gBACjE,OAAO,IAAI,CAAC;aACb;YAED,IAAI,IAAI,IAAA,yBAAe,EAAC,MAAM,CAAC,CAAC;SACjC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;CACF;AAhJD,kDAgJC"}
@@ -1,85 +0,0 @@
1
- import { DecodedCallMessageTrace, DecodedCreateMessageTrace, DecodedEvmMessageTrace, MessageTrace } from "./message-trace";
2
- import { Bytecode, Instruction } from "./model";
3
- import { CallstackEntryStackTraceEntry, InternalFunctionCallStackEntry, SolidityStackTrace } from "./solidity-stack-trace";
4
- export interface SubmessageData {
5
- messageTrace: MessageTrace;
6
- stacktrace: SolidityStackTrace;
7
- stepIndex: number;
8
- }
9
- export declare class ErrorInferrer {
10
- inferBeforeTracingCallMessage(trace: DecodedCallMessageTrace): SolidityStackTrace | undefined;
11
- inferBeforeTracingCreateMessage(trace: DecodedCreateMessageTrace): SolidityStackTrace | undefined;
12
- inferAfterTracing(trace: DecodedEvmMessageTrace, stacktrace: SolidityStackTrace, functionJumpdests: Instruction[], jumpedIntoFunction: boolean, lastSubmessageData: SubmessageData | undefined): SolidityStackTrace;
13
- filterRedundantFrames(stacktrace: SolidityStackTrace): SolidityStackTrace;
14
- /**
15
- * Check if the last submessage can be used to generate the stack trace.
16
- */
17
- private _checkLastSubmessage;
18
- /**
19
- * Check if the last call/create that was done failed.
20
- */
21
- private _checkFailedLastCall;
22
- /**
23
- * Check if the execution stopped with a revert or an invalid opcode.
24
- */
25
- private _checkRevertOrInvalidOpcode;
26
- /**
27
- * Check if the trace reverted with a panic error.
28
- */
29
- private _checkPanic;
30
- private _checkCustomErrors;
31
- /**
32
- * Check last instruction to try to infer the error.
33
- */
34
- private _checkLastInstruction;
35
- private _checkNonContractCalled;
36
- private _checkSolidity063UnmappedRevert;
37
- private _checkContractTooLarge;
38
- private _otherExecutionErrorStacktrace;
39
- private _fixInitialModifier;
40
- private _isDirectLibraryCall;
41
- private _getDirectLibraryCallErrorStackTrace;
42
- private _isFunctionNotPayableError;
43
- private _getFunctionStartSourceReference;
44
- private _isMissingFunctionAndFallbackError;
45
- private _emptyCalldataAndNoReceive;
46
- private _getContractStartWithoutFunctionSourceReference;
47
- private _isFallbackNotPayableError;
48
- private _getFallbackStartSourceReference;
49
- private _isConstructorNotPayableError;
50
- /**
51
- * Returns a source reference pointing to the constructor if it exists, or to the contract
52
- * otherwise.
53
- */
54
- private _getConstructorStartSourceReference;
55
- private _isConstructorInvalidArgumentsError;
56
- private _getEntryBeforeInitialModifierCallstackEntry;
57
- private _getLastSourceReference;
58
- private _hasFailedInsideTheFallbackFunction;
59
- private _hasFailedInsideTheReceiveFunction;
60
- private _hasFailedInsideFunction;
61
- private _instructionWithinFunctionToRevertStackTraceEntry;
62
- private _instructionWithinFunctionToUnmappedSolc063RevertErrorStackTraceEntry;
63
- private _instructionWithinFunctionToPanicStackTraceEntry;
64
- private _instructionWithinFunctionToCustomErrorStackTraceEntry;
65
- private _solidity063MaybeUnmappedRevert;
66
- private _solidity063GetFrameForUnmappedRevertBeforeFunction;
67
- private _getOtherErrorBeforeCalledFunctionStackTraceEntry;
68
- private _isCalledNonContractAccountError;
69
- private _solidity063GetFrameForUnmappedRevertWithinFunction;
70
- private _isContractTooLargeError;
71
- private _solidity063CorrectLineNumber;
72
- private _getLastInstructionWithValidLocationStepIndex;
73
- private _getLastInstructionWithValidLocation;
74
- private _callInstructionToCallFailedToExecuteStackTraceEntry;
75
- private _getEntryBeforeFailureInModifier;
76
- private _failsRightAfterCall;
77
- private _isCallFailedError;
78
- private _isLastLocation;
79
- private _isSubtraceErrorPropagated;
80
- private _isProxyErrorPropagated;
81
- private _isContractCallRunOutOfGasError;
82
- private _isPanicReturnData;
83
- }
84
- export declare function instructionToCallstackStackTraceEntry(bytecode: Bytecode, inst: Instruction): CallstackEntryStackTraceEntry | InternalFunctionCallStackEntry;
85
- //# sourceMappingURL=error-inferrer.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"error-inferrer.d.ts","sourceRoot":"","sources":["../../../src/internal/hardhat-network/stack-traces/error-inferrer.ts"],"names":[],"mappings":"AAUA,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,sBAAsB,EAOtB,YAAY,EACb,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,QAAQ,EAIR,WAAW,EAGZ,MAAM,SAAS,CAAC;AAEjB,OAAO,EAEL,6BAA6B,EAI7B,8BAA8B,EAK9B,kBAAkB,EAKnB,MAAM,wBAAwB,CAAC;AAMhC,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,YAAY,CAAC;IAC3B,UAAU,EAAE,kBAAkB,CAAC;IAC/B,SAAS,EAAE,MAAM,CAAC;CACnB;AAID,qBAAa,aAAa;IACjB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