(executedDebugSteps: AuthenticationProgramStateCommon[])
| 354 | }; |
| 355 | |
| 356 | const getFinalExecutedVerifyIp = (executedDebugSteps: AuthenticationProgramStateCommon[]): number => { |
| 357 | // Map every executed debug step to its corresponding instruction |
| 358 | // (note that the last executed step(s) may not have a corresponding instruction and will be `undefined`) |
| 359 | const executedInstructions = executedDebugSteps.map((step) => step.instructions[step.ip]); |
| 360 | |
| 361 | const finalExecutedDebugStepIndex = executedDebugSteps.length - 1; |
| 362 | const cleanupSize = calculateCleanupSize(executedInstructions); |
| 363 | const finalExecutedNonCleanupStep = executedDebugSteps[finalExecutedDebugStepIndex - cleanupSize]; |
| 364 | |
| 365 | // The final verify in a function is dropped, so after cleanup, we get the final OP that was executed *before* the |
| 366 | // final verify, so we need to add one to get the actual final verify instruction |
| 367 | const finalExecutedVerifyIp = finalExecutedNonCleanupStep.ip + 1; |
| 368 | return finalExecutedVerifyIp; |
| 369 | }; |
| 370 | |
| 371 | // After debugging, we want to verify the full transaction to ensure it is valid (this catches any errors that are not |
| 372 | // necessarily script errors) |
no test coverage detected