Skip to content

Commit

Permalink
Allow panic errors without source references
Browse files Browse the repository at this point in the history
  • Loading branch information
fvictorio committed Oct 6, 2022
1 parent 8e8127d commit 642f2ce
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1177,10 +1177,6 @@ export class ErrorInferrer {
errorCode: bigint
): PanicErrorStackTraceEntry {
const lastSourceReference = this._getLastSourceReference(trace);
assertHardhatInvariant(
lastSourceReference !== undefined,
"Expected last source reference to be defined"
);
return {
type: StackTraceEntryType.PANIC_ERROR,
sourceReference:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ function encodeStackTraceEntry(

case StackTraceEntryType.CALLSTACK_ENTRY:
case StackTraceEntryType.REVERT_ERROR:
case StackTraceEntryType.PANIC_ERROR:
case StackTraceEntryType.CUSTOM_ERROR:
case StackTraceEntryType.FUNCTION_NOT_PAYABLE_ERROR:
case StackTraceEntryType.INVALID_PARAMS_ERROR:
Expand Down Expand Up @@ -188,6 +187,7 @@ function encodeStackTraceEntry(

case StackTraceEntryType.OTHER_EXECUTION_ERROR:
case StackTraceEntryType.CONTRACT_TOO_LARGE_ERROR:
case StackTraceEntryType.PANIC_ERROR:
if (stackTraceEntry.sourceReference === undefined) {
return new SolidityCallSite(
undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ export interface RevertErrorStackTraceEntry {
export interface PanicErrorStackTraceEntry {
type: StackTraceEntryType.PANIC_ERROR;
errorCode: bigint;
sourceReference: SourceReference;
sourceReference?: SourceReference;
}

export interface CustomErrorStackTraceEntry {
Expand Down

0 comments on commit 642f2ce

Please sign in to comment.