|
1 |
| -import type { Fr, Point } from '@aztec/foundation/fields'; |
| 1 | +import type { Point } from '@aztec/foundation/fields'; |
2 | 2 | import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
3 | 3 | import type { FailingFunction, NoirCallStack } from '@aztec/stdlib/errors';
|
4 | 4 |
|
5 | 5 | import { ExecutionError } from '../../common/errors.js';
|
6 |
| -import type { AvmContext } from './avm_context.js'; |
7 | 6 |
|
8 | 7 | /**
|
9 | 8 | * Avm-specific errors should derive from this
|
@@ -179,54 +178,3 @@ export class AvmRevertReason extends ExecutionError {
|
179 | 178 | super(message, failingFunction, noirCallStack, options);
|
180 | 179 | }
|
181 | 180 | }
|
182 |
| - |
183 |
| -async function createRevertReason(message: string, revertData: Fr[], context: AvmContext): Promise<AvmRevertReason> { |
184 |
| - // We drop the returnPc information. |
185 |
| - const internalCallStack = context.machineState.internalCallStack.map(entry => entry.callPc); |
186 |
| - |
187 |
| - // If we are reverting due to the same error that we have been tracking, we use the nested error as the cause. |
188 |
| - let nestedError = undefined; |
189 |
| - const revertDataEquals = (a: Fr[], b: Fr[]) => a.length === b.length && a.every((v, i) => v.equals(b[i])); |
190 |
| - if ( |
191 |
| - context.machineState.collectedRevertInfo && |
192 |
| - revertDataEquals(context.machineState.collectedRevertInfo.revertDataRepresentative, revertData) |
193 |
| - ) { |
194 |
| - nestedError = context.machineState.collectedRevertInfo.recursiveRevertReason; |
195 |
| - message = context.machineState.collectedRevertInfo.recursiveRevertReason.message; |
196 |
| - } |
197 |
| - |
198 |
| - const fnName = await context.persistableState.getPublicFunctionDebugName(context.environment); |
199 |
| - |
200 |
| - return new AvmRevertReason( |
201 |
| - message, |
202 |
| - /*failingFunction=*/ { |
203 |
| - contractAddress: context.environment.address, |
204 |
| - functionName: fnName, |
205 |
| - }, |
206 |
| - /*noirCallStack=*/ [...internalCallStack, context.machineState.pc].map(pc => `0.${pc}`), |
207 |
| - /*options=*/ { cause: nestedError }, |
208 |
| - ); |
209 |
| -} |
210 |
| - |
211 |
| -/** |
212 |
| - * Create a "revert reason" error for an exceptional halt. |
213 |
| - * |
214 |
| - * @param haltingError - the lower-level error causing the exceptional halt |
215 |
| - * @param context - the context of the AVM execution used to extract the failingFunction and noirCallStack |
216 |
| - */ |
217 |
| -export async function revertReasonFromExceptionalHalt( |
218 |
| - haltingError: AvmExecutionError, |
219 |
| - context: AvmContext, |
220 |
| -): Promise<AvmRevertReason> { |
221 |
| - return await createRevertReason(haltingError.message, [], context); |
222 |
| -} |
223 |
| - |
224 |
| -/** |
225 |
| - * Create a "revert reason" error for an explicit revert (a root cause). |
226 |
| - * |
227 |
| - * @param revertData - output data of the explicit REVERT instruction |
228 |
| - * @param context - the context of the AVM execution used to extract the failingFunction and noirCallStack |
229 |
| - */ |
230 |
| -export async function revertReasonFromExplicitRevert(revertData: Fr[], context: AvmContext): Promise<AvmRevertReason> { |
231 |
| - return await createRevertReason('Assertion failed: ', revertData, context); |
232 |
| -} |
0 commit comments