import type { WalletTemplate, WalletTemplateScenario } from '../lib.js'; /** * These are the VM versions for which tests are currently generated. * * A new 4-digit year should be added to prepare for each annual upgrade. * Libauth can also support testing of draft proposals by specifying a short * identifier for each independent proposal. */ declare const vmVersionsBCH: readonly ["2022", "2023", "chip_cashtokens", "before_chip_cashtokens", "chip_limits", "chip_loops", "chip_p2sh32", "chip_strict_checkmultisig", "chip_zce"]; /** * These are the VM "modes" for which tests can be generated. */ declare const vmModes: readonly ["nop2sh", "p2sh", "p2sh20", "p2sh32"]; type TestSetType = 'invalid' | 'nonstandard' | 'standard'; type TestSetOverrideType = TestSetType | 'ignore'; type VmVersionBCH = (typeof vmVersionsBCH)[number]; type VmMode = (typeof vmModes)[number]; type TestSetOverrideLabelBCH = 'default' | `${TestSetOverrideType}` | `${VmMode}_${TestSetOverrideType}` | `${VmMode}` | `${VmVersionBCH}_${TestSetOverrideType}` | `${VmVersionBCH}_${VmMode}_${TestSetOverrideType}` | `${VmVersionBCH}`; export type TestSetIdBCH = `${VmVersionBCH}_${TestSetType}`; export type VmbTestMasterBCH = [ shortId: string, testDescription: string, unlockingScriptAsm: string, redeemOrLockingScriptAsm: string, testTransactionHex: string, sourceOutputsHex: string, testSets: TestSetIdBCH[], /** * This isn't required for testing (implementations should always validate the * full test transaction), but it can allow downstream applications to * identify which source output/transaction input index is the focus of each * test. This is sometimes useful for debugging or for VM documentation * projects that extract usage examples from vmb tests. * * This field is left undefined for `inputIndex`s of `0` (the default). */ inputIndex?: number ]; export type VmbTest = [ shortId: string, testDescription: string, unlockingScriptAsm: string, redeemOrLockingScriptAsm: string, testTransactionHex: string, sourceOutputsHex: string, inputIndex?: number ]; /** * Not used currently, but these are the defaults that inform * {@link supportedTestSetOverridesBCH}. */ export declare const vmbTestDefinitionDefaultBehaviorBCH: TestSetOverrideLabelBCH[]; /** * The list of test set overrides currently supported. Eventually this should be * `TestSetOverride`. * * For now, this implementation simplifies VMB test generation – we just * `join()` the provided overrides and look up resulting modes/test sets here. */ declare const testSetOverrideListBCH: readonly [readonly ["chip_cashtokens_invalid"], readonly ["chip_cashtokens_invalid", "2022_p2sh32_nonstandard"], readonly ["default", "chip_cashtokens"], readonly ["chip_cashtokens"], readonly ["chip_cashtokens", "2022_p2sh32_nonstandard"], readonly ["chip_loops_invalid"], readonly ["chip_loops"], readonly ["invalid", "2022_p2sh32_nonstandard", "chip_cashtokens"], readonly ["invalid", "2022_p2sh32_nonstandard", "chip_cashtokens_invalid"], readonly ["invalid", "2022_p2sh32_nonstandard", "chip_cashtokens_nonstandard"], readonly ["invalid", "chip_cashtokens_invalid"], readonly ["invalid", "chip_cashtokens", "nop2sh_invalid"], readonly ["invalid", "chip_cashtokens"], readonly ["invalid", "chip_cashtokens", "chip_cashtokens_p2sh20_nonstandard", "chip_cashtokens_p2sh32_nonstandard"], readonly ["invalid", "chip_cashtokens", "chip_cashtokens_p2sh32_nonstandard"], readonly ["invalid", "chip_cashtokens", "p2sh_ignore"], readonly ["invalid", "chip_cashtokens_invalid", "p2sh_ignore"], readonly ["invalid", "nop2sh_nonstandard"], readonly ["invalid", "nop2sh_nonstandard"], readonly ["invalid", "p2sh_ignore"], readonly ["invalid", "p2sh_nonstandard", "chip_cashtokens_invalid"], readonly ["invalid", "p2sh_nonstandard", "chip_cashtokens"], readonly ["invalid", "p2sh_standard"], readonly ["invalid", "p2sh20_standard"], readonly ["invalid"], readonly ["nop2sh_invalid"], readonly ["nonstandard", "chip_cashtokens_invalid"], readonly ["nonstandard", "chip_cashtokens"], readonly ["nonstandard", "chip_cashtokens", "chip_cashtokens_p2sh20_nonstandard", "chip_cashtokens_p2sh32_nonstandard"], readonly ["nonstandard", "chip_cashtokens", "chip_cashtokens_p2sh32_nonstandard"], readonly ["nonstandard", "p2sh_ignore"], readonly ["nonstandard", "p2sh_invalid"], readonly ["nonstandard"], readonly ["p2sh_ignore"], readonly ["p2sh_invalid"], readonly []]; type TestSetOverrideListBCH = (typeof testSetOverrideListBCH)[number]; type TestPlan = { mode: 'nonP2SH' | 'P2SH20' | 'P2SH32'; sets: TestSetIdBCH[]; }[]; /** * Given one of these values and the * {@link vmbTestDefinitionDefaultBehaviorBCH}, return these test plans. */ export declare const supportedTestSetOverridesBCH: { [joinedList: string]: TestPlan; }; export type VmbTestDefinition = [ /** * This script (defined using CashAssembly) is compiled to `unlockingBytecode` * in the test transaction(s) produced by this test definition. */ unlockingScript: string, /** * This script (defined using CashAssembly) is compiled to the * `redeemBytecode` and/or `lockingBytecode` to be satisfied by * `unlockingScript`. * * By default, each test definitions generates two tests, one test uses this * value as a simple `lockingBytecode`, the other test encodes this value as * the `redeemBytecode` of a P2SH20 UTXO (properly appending it to * `unlockingBytecode` in the test transaction). * * For `standard` test definitions, the P2SH evaluation is tested in standard * mode and the non-P2SH evaluation is tested in non-standard mode (marked as * only a `valid` test). For `valid` test definitions, both tests are marked * as `valid`. */ redeemOrLockingScript: string, testDescription: string, testSetOverrideLabels?: TestSetOverrideListBCH, /** * A scenario that extends the default scenario for use with this test. */ scenario?: WalletTemplateScenario, /** * An additional mapping of scripts to make available during scenario * generation. */ additionalScripts?: WalletTemplate['scripts'] ]; export type VmbTestDefinitionGroup = [ groupDescription: string, tests: VmbTestDefinition[] ]; /** * Given a VMB test definition, generate a full VMB test vector. Note, this * method throws immediately on the first test vector generation failure. */ export declare const vmbTestDefinitionToVmbTests: (testDefinition: VmbTestDefinition, groupName?: string, shortIdLength?: number) => VmbTestMasterBCH[]; export declare const vmbTestGroupToVmbTests: (testGroup: VmbTestDefinitionGroup) => VmbTestMasterBCH[][]; /** * Partition a master test list (produced by {@link vmbTestGroupToVmbTests} or * {@link vmbTestDefinitionToVmbTests}) into sets. E.g.: * ```ts * const definitions: VmbTestDefinitionGroup[] = [...] * const master = [ * vmbTestDefinitionToVmbTests(...), * vmbTestDefinitionToVmbTests(...), * ]; * const partitioned = vmbTestPartitionMasterTestList(master); * ``` * Or: * ```ts * const definitions: VmbTestDefinitionGroup[] = [...] * const master = definitions.map(vmbTestGroupToVmbTests).flat(2); * const partitioned = vmbTestPartitionMasterTestList(master); * ``` * Tests are aggregated by set into a map of test sets (e.g. to export to * separate files). */ export declare const vmbTestPartitionMasterTestList: (masterTestList: VmbTestMasterBCH[]) => { "2022_standard"?: VmbTest[] | undefined; "2022_invalid"?: VmbTest[] | undefined; "2022_nonstandard"?: VmbTest[] | undefined; "2023_standard"?: VmbTest[] | undefined; "2023_invalid"?: VmbTest[] | undefined; "2023_nonstandard"?: VmbTest[] | undefined; chip_cashtokens_standard?: VmbTest[] | undefined; chip_cashtokens_invalid?: VmbTest[] | undefined; chip_cashtokens_nonstandard?: VmbTest[] | undefined; before_chip_cashtokens_standard?: VmbTest[] | undefined; before_chip_cashtokens_invalid?: VmbTest[] | undefined; before_chip_cashtokens_nonstandard?: VmbTest[] | undefined; chip_limits_standard?: VmbTest[] | undefined; chip_limits_invalid?: VmbTest[] | undefined; chip_limits_nonstandard?: VmbTest[] | undefined; chip_loops_standard?: VmbTest[] | undefined; chip_loops_invalid?: VmbTest[] | undefined; chip_loops_nonstandard?: VmbTest[] | undefined; chip_p2sh32_standard?: VmbTest[] | undefined; chip_p2sh32_invalid?: VmbTest[] | undefined; chip_p2sh32_nonstandard?: VmbTest[] | undefined; chip_strict_checkmultisig_standard?: VmbTest[] | undefined; chip_strict_checkmultisig_invalid?: VmbTest[] | undefined; chip_strict_checkmultisig_nonstandard?: VmbTest[] | undefined; chip_zce_standard?: VmbTest[] | undefined; chip_zce_invalid?: VmbTest[] | undefined; chip_zce_nonstandard?: VmbTest[] | undefined; }; export {}; //# sourceMappingURL=bch-vmb-test-utils.d.ts.map