( element: StackItem, debugStep: AuthenticationProgramStateCommon, vm: VM, )
| 260 | }; |
| 261 | |
| 262 | const applyStackItemTransformations = ( |
| 263 | element: StackItem, |
| 264 | debugStep: AuthenticationProgramStateCommon, |
| 265 | vm: VM, |
| 266 | ): AuthenticationProgramStateCommon => { |
| 267 | if (!element.transformations) return debugStep; |
| 268 | |
| 269 | const transformationsBytecode = asmToBytecode(element.transformations); |
| 270 | const transformationsAuthenticationInstructions = decodeAuthenticationInstructions(transformationsBytecode); |
| 271 | |
| 272 | const transformationsStartState: AuthenticationProgramStateCommon = { |
| 273 | alternateStack: [...debugStep.alternateStack], |
| 274 | controlStack: [], |
| 275 | ip: 0, |
| 276 | lastCodeSeparator: -1, |
| 277 | metrics: {} as any, |
| 278 | stack: [...debugStep.stack], |
| 279 | operationCount: 0, |
| 280 | instructions: transformationsAuthenticationInstructions, |
| 281 | signedMessages: [], |
| 282 | program: { ...debugStep.program }, |
| 283 | functionTable: debugStep.functionTable ?? {}, |
| 284 | functionCount: debugStep.functionCount ?? 0, |
| 285 | }; |
| 286 | |
| 287 | const transformationsEndState = vm.stateEvaluate(transformationsStartState); |
| 288 | |
| 289 | return transformationsEndState; |
| 290 | }; |
| 291 | |
| 292 | const decodeStackItem = (element: StackItem, stack: Uint8Array[]): string | bigint | boolean => { |
| 293 | // Reversed since stack is in reverse order |
no test coverage detected