hardhat 2.22.10 → 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 (129) hide show
  1. package/console.sol +1 -1
  2. package/internal/cli/project-creation.d.ts +1 -1
  3. package/internal/cli/project-creation.js +1 -1
  4. package/internal/core/providers/lazy-initialization.d.ts.map +1 -1
  5. package/internal/core/providers/lazy-initialization.js +10 -10
  6. package/internal/core/providers/lazy-initialization.js.map +1 -1
  7. package/internal/hardhat-network/jsonrpc/handler.d.ts.map +1 -1
  8. package/internal/hardhat-network/jsonrpc/handler.js +2 -1
  9. package/internal/hardhat-network/jsonrpc/handler.js.map +1 -1
  10. package/internal/hardhat-network/provider/provider.d.ts +2 -3
  11. package/internal/hardhat-network/provider/provider.d.ts.map +1 -1
  12. package/internal/hardhat-network/provider/provider.js +5 -19
  13. package/internal/hardhat-network/provider/provider.js.map +1 -1
  14. package/internal/hardhat-network/provider/return-data.d.ts +2 -15
  15. package/internal/hardhat-network/provider/return-data.d.ts.map +1 -1
  16. package/internal/hardhat-network/provider/return-data.js +2 -50
  17. package/internal/hardhat-network/provider/return-data.js.map +1 -1
  18. package/internal/hardhat-network/provider/vm/exit.d.ts +2 -20
  19. package/internal/hardhat-network/provider/vm/exit.d.ts.map +1 -1
  20. package/internal/hardhat-network/provider/vm/exit.js +3 -78
  21. package/internal/hardhat-network/provider/vm/exit.js.map +1 -1
  22. package/internal/hardhat-network/stack-traces/compiler-to-model.d.ts +2 -3
  23. package/internal/hardhat-network/stack-traces/compiler-to-model.d.ts.map +1 -1
  24. package/internal/hardhat-network/stack-traces/compiler-to-model.js +2 -351
  25. package/internal/hardhat-network/stack-traces/compiler-to-model.js.map +1 -1
  26. package/internal/hardhat-network/stack-traces/consoleLogger.d.ts +2 -1
  27. package/internal/hardhat-network/stack-traces/consoleLogger.d.ts.map +1 -1
  28. package/internal/hardhat-network/stack-traces/consoleLogger.js +2 -1
  29. package/internal/hardhat-network/stack-traces/consoleLogger.js.map +1 -1
  30. package/internal/hardhat-network/stack-traces/constants.d.ts +1 -1
  31. package/internal/hardhat-network/stack-traces/constants.js +1 -1
  32. package/internal/hardhat-network/stack-traces/debug.d.ts +2 -7
  33. package/internal/hardhat-network/stack-traces/debug.d.ts.map +1 -1
  34. package/internal/hardhat-network/stack-traces/debug.js +3 -143
  35. package/internal/hardhat-network/stack-traces/debug.js.map +1 -1
  36. package/internal/hardhat-network/stack-traces/library-utils.d.ts +2 -11
  37. package/internal/hardhat-network/stack-traces/library-utils.d.ts.map +1 -1
  38. package/internal/hardhat-network/stack-traces/library-utils.js +3 -61
  39. package/internal/hardhat-network/stack-traces/library-utils.js.map +1 -1
  40. package/internal/hardhat-network/stack-traces/logger.js +596 -596
  41. package/internal/hardhat-network/stack-traces/logger.js.map +1 -1
  42. package/internal/hardhat-network/stack-traces/message-trace.d.ts +2 -51
  43. package/internal/hardhat-network/stack-traces/message-trace.d.ts.map +1 -1
  44. package/internal/hardhat-network/stack-traces/message-trace.js +0 -46
  45. package/internal/hardhat-network/stack-traces/message-trace.js.map +1 -1
  46. package/internal/hardhat-network/stack-traces/solidity-errors.d.ts.map +1 -1
  47. package/internal/hardhat-network/stack-traces/solidity-errors.js +58 -53
  48. package/internal/hardhat-network/stack-traces/solidity-errors.js.map +1 -1
  49. package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts +4 -155
  50. package/internal/hardhat-network/stack-traces/solidity-stack-trace.d.ts.map +1 -1
  51. package/internal/hardhat-network/stack-traces/solidity-stack-trace.js +12 -37
  52. package/internal/hardhat-network/stack-traces/solidity-stack-trace.js.map +1 -1
  53. package/internal/hardhat-network/stack-traces/solidityTracer.d.ts +2 -13
  54. package/internal/hardhat-network/stack-traces/solidityTracer.d.ts.map +1 -1
  55. package/internal/hardhat-network/stack-traces/solidityTracer.js +2 -162
  56. package/internal/hardhat-network/stack-traces/solidityTracer.js.map +1 -1
  57. package/internal/hardhat-network/stack-traces/vm-trace-decoder.d.ts +4 -15
  58. package/internal/hardhat-network/stack-traces/vm-trace-decoder.d.ts.map +1 -1
  59. package/internal/hardhat-network/stack-traces/vm-trace-decoder.js +6 -70
  60. package/internal/hardhat-network/stack-traces/vm-trace-decoder.js.map +1 -1
  61. package/internal/hardhat-network/stack-traces/vm-tracer.d.ts +2 -19
  62. package/internal/hardhat-network/stack-traces/vm-tracer.d.ts.map +1 -1
  63. package/internal/hardhat-network/stack-traces/vm-tracer.js +3 -150
  64. package/internal/hardhat-network/stack-traces/vm-tracer.js.map +1 -1
  65. package/internal/solidity/compiler/solc-info.d.ts.map +1 -1
  66. package/internal/solidity/compiler/solc-info.js +3 -0
  67. package/internal/solidity/compiler/solc-info.js.map +1 -1
  68. package/package.json +6 -5
  69. package/sample-projects/javascript/contracts/Lock.sol +1 -1
  70. package/sample-projects/javascript/hardhat.config.js +1 -1
  71. package/sample-projects/javascript/ignition/modules/Lock.js +3 -0
  72. package/sample-projects/javascript-esm/contracts/Lock.sol +1 -1
  73. package/sample-projects/javascript-esm/hardhat.config.cjs +1 -1
  74. package/sample-projects/javascript-esm/ignition/modules/Lock.js +3 -0
  75. package/sample-projects/typescript/contracts/Lock.sol +1 -1
  76. package/sample-projects/typescript/hardhat.config.ts +1 -1
  77. package/sample-projects/typescript/ignition/modules/Lock.ts +3 -0
  78. package/sample-projects/typescript-viem/contracts/Lock.sol +1 -1
  79. package/sample-projects/typescript-viem/hardhat.config.ts +1 -1
  80. package/sample-projects/typescript-viem/ignition/modules/Lock.ts +3 -0
  81. package/src/internal/cli/project-creation.ts +1 -1
  82. package/src/internal/core/providers/lazy-initialization.ts +13 -13
  83. package/src/internal/hardhat-network/jsonrpc/handler.ts +2 -1
  84. package/src/internal/hardhat-network/provider/provider.ts +11 -24
  85. package/src/internal/hardhat-network/provider/return-data.ts +5 -73
  86. package/src/internal/hardhat-network/provider/vm/exit.ts +4 -92
  87. package/src/internal/hardhat-network/stack-traces/compiler-to-model.ts +5 -697
  88. package/src/internal/hardhat-network/stack-traces/consoleLogger.ts +2 -1
  89. package/src/internal/hardhat-network/stack-traces/constants.ts +1 -1
  90. package/src/internal/hardhat-network/stack-traces/debug.ts +5 -218
  91. package/src/internal/hardhat-network/stack-traces/library-utils.ts +5 -90
  92. package/src/internal/hardhat-network/stack-traces/logger.ts +596 -596
  93. package/src/internal/hardhat-network/stack-traces/message-trace.ts +5 -122
  94. package/src/internal/hardhat-network/stack-traces/solidity-errors.ts +16 -15
  95. package/src/internal/hardhat-network/stack-traces/solidity-stack-trace.ts +83 -186
  96. package/src/internal/hardhat-network/stack-traces/solidityTracer.ts +5 -253
  97. package/src/internal/hardhat-network/stack-traces/vm-trace-decoder.ts +15 -108
  98. package/src/internal/hardhat-network/stack-traces/vm-tracer.ts +5 -206
  99. package/src/internal/solidity/compiler/solc-info.ts +3 -0
  100. package/internal/hardhat-network/stack-traces/contracts-identifier.d.ts +0 -15
  101. package/internal/hardhat-network/stack-traces/contracts-identifier.d.ts.map +0 -1
  102. package/internal/hardhat-network/stack-traces/contracts-identifier.js +0 -166
  103. package/internal/hardhat-network/stack-traces/contracts-identifier.js.map +0 -1
  104. package/internal/hardhat-network/stack-traces/error-inferrer.d.ts +0 -85
  105. package/internal/hardhat-network/stack-traces/error-inferrer.d.ts.map +0 -1
  106. package/internal/hardhat-network/stack-traces/error-inferrer.js +0 -1168
  107. package/internal/hardhat-network/stack-traces/error-inferrer.js.map +0 -1
  108. package/internal/hardhat-network/stack-traces/mapped-inlined-internal-functions-heuristics.d.ts +0 -24
  109. package/internal/hardhat-network/stack-traces/mapped-inlined-internal-functions-heuristics.d.ts.map +0 -1
  110. package/internal/hardhat-network/stack-traces/mapped-inlined-internal-functions-heuristics.js +0 -116
  111. package/internal/hardhat-network/stack-traces/mapped-inlined-internal-functions-heuristics.js.map +0 -1
  112. package/internal/hardhat-network/stack-traces/model.d.ts +0 -140
  113. package/internal/hardhat-network/stack-traces/model.d.ts.map +0 -1
  114. package/internal/hardhat-network/stack-traces/model.js +0 -328
  115. package/internal/hardhat-network/stack-traces/model.js.map +0 -1
  116. package/internal/hardhat-network/stack-traces/opcodes.d.ts +0 -266
  117. package/internal/hardhat-network/stack-traces/opcodes.d.ts.map +0 -1
  118. package/internal/hardhat-network/stack-traces/opcodes.js +0 -320
  119. package/internal/hardhat-network/stack-traces/opcodes.js.map +0 -1
  120. package/internal/hardhat-network/stack-traces/source-maps.d.ts +0 -13
  121. package/internal/hardhat-network/stack-traces/source-maps.d.ts.map +0 -1
  122. package/internal/hardhat-network/stack-traces/source-maps.js +0 -106
  123. package/internal/hardhat-network/stack-traces/source-maps.js.map +0 -1
  124. package/src/internal/hardhat-network/stack-traces/contracts-identifier.ts +0 -235
  125. package/src/internal/hardhat-network/stack-traces/error-inferrer.ts +0 -1845
  126. package/src/internal/hardhat-network/stack-traces/mapped-inlined-internal-functions-heuristics.ts +0 -163
  127. package/src/internal/hardhat-network/stack-traces/model.ts +0 -409
  128. package/src/internal/hardhat-network/stack-traces/opcodes.ts +0 -344
  129. package/src/internal/hardhat-network/stack-traces/source-maps.ts +0 -167
@@ -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;QAAb,UAAK,GAAL,KAAK,CAAQ;QAJzB,eAAU,GAA8B,IAAI,GAAG,EAAE,CAAC;QAClD,gBAAW,GAAe,EAAE,CAAC;IAGD,CAAC;IAEtC,GAAG,CAAC,QAAkB;QAC3B,4DAA4D;QAC5D,IAAI,QAAQ,GAAiB,IAAI,CAAC;QAClC,KACE,IAAI,eAAe,GAAG,CAAC,EACvB,eAAe,IAAI,QAAQ,CAAC,cAAc,CAAC,MAAM,EACjD,eAAe,IAAI,CAAC,EACpB;YACA,IA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,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,6BAA6B,CAClC,KAAK,EAAE,uBAAuB,GAC7B,kBAAkB,GAAG,SAAS;IAkE1B,+BAA+B,CACpC,KAAK,EAAE,yBAAyB,GAC/B,kBAAkB,GAAG,SAAS;IAqB1B,iBAAiB,CACtB,KAAK,EAAE,sBAAsB,EAC7B,UAAU,EAAE,kBAAkB,EAC9B,iBAAiB,EAAE,WAAW,EAAE,EAChC,kBAAkB,EAAE,OAAO,EAC3B,kBAAkB,EAAE,cAAc,GAAG,SAAS,GAC7C,kBAAkB;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