Skip to content

Commit

Permalink
Add P2S and OP_EVAL support
Browse files Browse the repository at this point in the history
  • Loading branch information
bitjson committed Dec 12, 2024
1 parent 40c56a7 commit da5fb61
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 14 deletions.
2 changes: 1 addition & 1 deletion libauth
Submodule libauth updated 96 files
+1 −0 .changeset/pre.json
+5 −0 .changeset/tall-actors-sell.md
+6 −0 CHANGELOG.md
+1 −1 package.json
+2 −0 src/lib/engine/types/template-types.ts
+13 −6 src/lib/language/language-utils.ts
+5 −1 src/lib/vm/instruction-sets/bch/2023/bch-2023-consensus.ts
+37 −13 src/lib/vm/instruction-sets/bch/2023/bch-2023-instruction-set.ts
+3 −5 src/lib/vm/instruction-sets/bch/2023/bch-2023-tokens.ts
+4 −1 src/lib/vm/instruction-sets/bch/2026/bch-2026-consensus.ts
+20 −0 src/lib/vm/instruction-sets/bch/2026/bch-2026-descriptions.ts
+1 −0 src/lib/vm/instruction-sets/bch/2026/bch-2026-errors.ts
+49 −0 src/lib/vm/instruction-sets/bch/2026/bch-2026-eval.ts
+19 −0 src/lib/vm/instruction-sets/bch/2026/bch-2026-instruction-set.ts
+5 −4 src/lib/vm/instruction-sets/bch/2026/bch-2026-loops.ts
+1 −0 src/lib/vm/instruction-sets/bch/2026/bch-2026-opcodes.ts
+4 −5 src/lib/vm/instruction-sets/bch/spec/bch-spec-descriptions.ts
+3 −1 src/lib/vm/instruction-sets/bch/spec/bch-spec-errors.ts
+14 −0 src/lib/vm/instruction-sets/bch/spec/bch-spec-instruction-set.ts
+3 −1 src/lib/vm/instruction-sets/bch/spec/bch-spec-opcodes.ts
+63 −0 src/lib/vm/instruction-sets/bch/spec/bch-spec-pow.ts
+2 −1 src/lib/vm/instruction-sets/common/flow-control.ts
+17 −13 src/lib/vm/vm-types.ts
+145 −12 src/lib/vmb-tests/bch-vmb-test-utils.ts
+2 −0 src/lib/vmb-tests/bchn/bchn-error-map.spec.helper.ts
+4 −0 src/lib/vmb-tests/bchn/libauth_expected_test_metrics.json
+2 −1 src/lib/vmb-tests/generate-vmb-tests.spec.helper.ts
+4 −0 src/lib/vmb-tests/generated/bch_2023_nonstandard/chip.eval.nonstandard_limits.json
+4 −0 src/lib/vmb-tests/generated/bch_2023_nonstandard/chip.eval.nonstandard_results.json
+3 −0 src/lib/vmb-tests/generated/bch_2023_nonstandard/chip.eval.nonstandard_stats.csv
+4 −0 src/lib/vmb-tests/generated/bch_2023_nonstandard/chip.eval.standard_limits.json
+4 −0 src/lib/vmb-tests/generated/bch_2023_nonstandard/chip.eval.standard_results.json
+3 −0 src/lib/vmb-tests/generated/bch_2023_nonstandard/chip.eval.standard_stats.csv
+2 −0 src/lib/vmb-tests/generated/bch_2023_nonstandard/chip.eval.vmb_tests.json
+6 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.eval.nonstandard_limits.json
+6 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.eval.nonstandard_results.json
+5 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.eval.nonstandard_stats.csv
+6 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.eval.standard_limits.json
+6 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.eval.standard_results.json
+5 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.eval.standard_stats.csv
+4 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.eval.vmb_tests.json
+4 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.p2s.nonstandard_limits.json
+4 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.p2s.nonstandard_results.json
+3 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.p2s.nonstandard_stats.csv
+4 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.p2s.standard_limits.json
+4 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.p2s.standard_results.json
+3 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.p2s.standard_stats.csv
+2 −0 src/lib/vmb-tests/generated/bch_2023_standard/chip.p2s.vmb_tests.json
+59 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.eval.nonstandard_limits.json
+59 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.eval.nonstandard_results.json
+58 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.eval.nonstandard_stats.csv
+59 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.eval.standard_limits.json
+59 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.eval.standard_results.json
+58 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.eval.standard_stats.csv
+57 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.eval.vmb_tests.json
+11 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.loops.nonstandard_limits.json
+11 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.loops.nonstandard_results.json
+10 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.loops.nonstandard_stats.csv
+11 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.loops.standard_limits.json
+11 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.loops.standard_results.json
+10 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.loops.standard_stats.csv
+9 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.loops.vmb_tests.json
+4 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.p2s.nonstandard_limits.json
+4 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.p2s.nonstandard_results.json
+3 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.p2s.nonstandard_stats.csv
+4 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.p2s.standard_limits.json
+4 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.p2s.standard_results.json
+3 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.p2s.standard_stats.csv
+2 −0 src/lib/vmb-tests/generated/bch_2025_invalid/chip.p2s.vmb_tests.json
+4 −0 src/lib/vmb-tests/generated/bch_2025_nonstandard/chip.eval.nonstandard_limits.json
+4 −0 src/lib/vmb-tests/generated/bch_2025_nonstandard/chip.eval.nonstandard_results.json
+3 −0 src/lib/vmb-tests/generated/bch_2025_nonstandard/chip.eval.nonstandard_stats.csv
+4 −0 src/lib/vmb-tests/generated/bch_2025_nonstandard/chip.eval.standard_limits.json
+4 −0 src/lib/vmb-tests/generated/bch_2025_nonstandard/chip.eval.standard_results.json
+3 −0 src/lib/vmb-tests/generated/bch_2025_nonstandard/chip.eval.standard_stats.csv
+2 −0 src/lib/vmb-tests/generated/bch_2025_nonstandard/chip.eval.vmb_tests.json
+6 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.eval.nonstandard_limits.json
+6 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.eval.nonstandard_results.json
+5 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.eval.nonstandard_stats.csv
+6 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.eval.standard_limits.json
+6 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.eval.standard_results.json
+5 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.eval.standard_stats.csv
+4 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.eval.vmb_tests.json
+4 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.p2s.nonstandard_limits.json
+4 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.p2s.nonstandard_results.json
+3 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.p2s.nonstandard_stats.csv
+4 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.p2s.standard_limits.json
+4 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.p2s.standard_results.json
+3 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.p2s.standard_stats.csv
+2 −0 src/lib/vmb-tests/generated/bch_2025_standard/chip.p2s.vmb_tests.json
+125 −24 src/lib/vmb-tests/run-live-bch-vmb-test.spec.helper.ts
+65 −0 src/lib/vmb-tests/sources/chip.eval.ts
+2 −1 src/lib/vmb-tests/sources/chip.loops.ts
+74 −0 src/lib/vmb-tests/sources/chip.p2s.ts
+15 −0 src/lib/vmb-tests/sources/chip.pow.ts
+6 −0 src/lib/vmb-tests/vmb-tests.spec.helper.ts
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "1.0.0",
"private": true,
"devDependencies": {
"@bitauth/libauth": "3.1.0-next.2",
"@bitauth/libauth": "3.1.0-next.3",
"@blueprintjs/core": "^5.8.2",
"@blueprintjs/icons": "^5.7.0",
"@blueprintjs/select": "^5.0.23",
Expand Down
18 changes: 11 additions & 7 deletions src/cash-assembly/editor-tooling.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,17 @@ export type MonacoMarkerDataRequired = {
const getExecutionSpacers = (
controlStack: IDESupportedProgramState['controlStack'],
) =>
controlStack.map((item) =>
typeof item === 'number'
? EvaluationViewerSpacer.loop
: item
? EvaluationViewerSpacer.executedConditional
: EvaluationViewerSpacer.skippedConditional,
);
controlStack
.map((item) =>
typeof item === 'object'
? undefined
: typeof item === 'number'
? EvaluationViewerSpacer.loop
: item
? EvaluationViewerSpacer.executedConditional
: EvaluationViewerSpacer.skippedConditional,
)
.filter((item) => item !== undefined);

/**
* @param samples a list of samples ordered by their ending position
Expand Down
2 changes: 1 addition & 1 deletion src/editor/script-editor/ScriptEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -824,7 +824,7 @@ export const ScriptEditor = (props: {
className="script-tag locking-type-tag"
title={lockingTypeDescriptions.standard}
>
bare
P2S
</span>
)}
{props.isPushed && scriptType === 'tested' && (
Expand Down
2 changes: 1 addition & 1 deletion src/header/HeaderBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const ideModes: IDESupportedModes[] = [
const vms: IDESupportedVirtualMachine[] = [
{ id: 'BCH_2023_05', name: 'BCH 2023 VM', disabled: false },
{ id: 'BCH_2025_05', name: 'BCH 2025 VM', disabled: false },
{ id: 'BCH_2026_05', name: 'BCH 2026 VM', disabled: true },
{ id: 'BCH_2026_05', name: 'BCH 2026 VM', disabled: false },
{ id: 'BCH_SPEC', name: 'BCH SPEC VM', disabled: false },
{ id: 'BTC_2017_08', name: 'BTC 2017 VM', disabled: true },
{ id: 'BSV_2020_02', name: 'BSV 2020 VM', disabled: true },
Expand Down
4 changes: 2 additions & 2 deletions src/state/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ export type LockingType = WalletTemplateScriptLocking['lockingType'];
export const lockingTypes: { label: string; value: LockingType }[] = [
{ label: 'P2SH20', value: 'p2sh20' },
{ label: 'P2SH32', value: 'p2sh32' },
{ label: 'Bare (non-P2SH)', value: 'standard' },
{ label: 'P2S', value: 'standard' },
];

export const lockingTypeDescriptions: {
Expand All @@ -153,7 +153,7 @@ export const lockingTypeDescriptions: {
p2sh32:
'This is a P2SH32 script. The P2SH32-wrapping bytecode is automatically included during compilation.',
standard:
'This is a bare (non-P2SH) script: it is compiled directly into the transaction output without P2SH-wrapping bytecode.',
'This is a P2S script: it is compiled directly into the transaction output without P2SH-wrapping bytecode.',
};

export type BaseScriptType =
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -3407,7 +3407,7 @@ __metadata:
version: 0.0.0-use.local
resolution: "bitauth-ide@workspace:."
dependencies:
"@bitauth/libauth": "npm:3.1.0-next.2"
"@bitauth/libauth": "npm:3.1.0-next.3"
"@blueprintjs/core": "npm:^5.8.2"
"@blueprintjs/icons": "npm:^5.7.0"
"@blueprintjs/select": "npm:^5.0.23"
Expand Down

0 comments on commit da5fb61

Please sign in to comment.