|
1 | | -import { AuthenticationErrorCommon, AuthenticationInstruction, AuthenticationProgramCommon, AuthenticationProgramStateBCH, AuthenticationProgramStateCommon, AuthenticationVirtualMachine, ResolvedTransactionCommon, WalletTemplate, binToHex, createCompiler, createVirtualMachineBCH2023, encodeAuthenticationInstruction, walletTemplateToCompilerConfiguration } from '@bitauth/libauth'; |
| 1 | +import { AuthenticationErrorCommon, AuthenticationInstruction, AuthenticationProgramCommon, AuthenticationProgramStateCommon, AuthenticationVirtualMachine, ResolvedTransactionCommon, WalletTemplate, binToHex, createCompiler, createVirtualMachineBch2025, encodeAuthenticationInstruction, walletTemplateToCompilerConfiguration } from '@bitauth/libauth'; |
2 | 2 | import { Artifact, LogEntry, Op, PrimitiveType, StackItem, bytecodeToAsm, decodeBool, decodeInt, decodeString } from '@cashscript/utils'; |
3 | 3 | import { findLastIndex, toRegExp } from './utils.js'; |
4 | 4 | import { FailedRequireError, FailedTransactionError, FailedTransactionEvaluationError } from './Errors.js'; |
@@ -53,7 +53,7 @@ export const debugTemplate = (template: WalletTemplate, artifact: Artifact): Deb |
53 | 53 | // preceding OP_CHECKSIG opcode. The error message is registered in the next instruction, so we need to increment |
54 | 54 | // the instruction pointer to get the correct error message from the require messages in the artifact. |
55 | 55 | // Note that we do NOT use this adjusted IP when passing the failing IP into the FailedRequireError |
56 | | - const isNullFail = lastExecutedDebugStep.error === AuthenticationErrorCommon.nonNullSignatureFailure; |
| 56 | + const isNullFail = lastExecutedDebugStep.error.includes(AuthenticationErrorCommon.nonNullSignatureFailure); |
57 | 57 | const requireStatementIp = failingIp + (isNullFail ? 1 : 0); |
58 | 58 |
|
59 | 59 | const requireStatement = (artifact.debug?.requires ?? []) |
@@ -110,15 +110,15 @@ export const debugTemplate = (template: WalletTemplate, artifact: Artifact): Deb |
110 | 110 | type VM = AuthenticationVirtualMachine< |
111 | 111 | ResolvedTransactionCommon, |
112 | 112 | AuthenticationProgramCommon, |
113 | | -AuthenticationProgramStateBCH |
| 113 | +AuthenticationProgramStateCommon |
114 | 114 | >; |
115 | 115 | type Program = AuthenticationProgramCommon; |
116 | 116 | type CreateProgramResult = { vm: VM, program: Program }; |
117 | 117 |
|
118 | 118 | // internal util. instantiates the virtual machine and compiles the template into a program |
119 | 119 | const createProgram = (template: WalletTemplate): CreateProgramResult => { |
120 | 120 | const configuration = walletTemplateToCompilerConfiguration(template); |
121 | | - const vm = createVirtualMachineBCH2023(); |
| 121 | + const vm = createVirtualMachineBch2025(); |
122 | 122 | const compiler = createCompiler(configuration); |
123 | 123 |
|
124 | 124 | const scenarioGeneration = compiler.generateScenario({ |
@@ -176,8 +176,9 @@ const failedFinalVerify = (evaluationResult: string | true): evaluationResult is |
176 | 176 | // If any of the following errors occurred, then the final verify failed - any other messages |
177 | 177 | // indicate other kinds of failures |
178 | 178 | return toRegExp([ |
179 | | - AuthenticationErrorCommon.requiresCleanStack, |
180 | | - AuthenticationErrorCommon.nonEmptyControlStack, |
| 179 | + // TODO: Ask Jason to put these back into an enum and replace with the enum value |
| 180 | + 'The CashAssembly internal evaluation completed with an unexpected number of items on the stack (must be exactly 1).', // AuthenticationErrorCommon.requiresCleanStack, |
| 181 | + 'The CashAssembly internal evaluation completed with a non-empty control stack.', // AuthenticationErrorCommon.nonEmptyControlStack, |
181 | 182 | AuthenticationErrorCommon.unsuccessfulEvaluation, |
182 | 183 | ]).test(evaluationResult); |
183 | 184 | }; |
|
0 commit comments