Skip to content

Commit

Permalink
Latest libauth, default to BCH 2025 VM
Browse files Browse the repository at this point in the history
  • Loading branch information
bitjson committed Nov 15, 2024
1 parent e2d8875 commit 40c56a7
Show file tree
Hide file tree
Showing 16 changed files with 82 additions and 78 deletions.
2 changes: 1 addition & 1 deletion libauth
Submodule libauth updated 2546 files
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.1",
"@bitauth/libauth": "3.1.0-next.2",
"@blueprintjs/core": "^5.8.2",
"@blueprintjs/icons": "^5.7.0",
"@blueprintjs/select": "^5.0.23",
Expand Down
2 changes: 1 addition & 1 deletion src/editor/constants.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
export const ideURI = window.location.origin;

export const bitauthWalletTemplateSchema =
'https://ide.bitauth.com/authentication-template-v0.schema.json';
'https://libauth.org/schemas/wallet-template-v0.schema.json';

export const localStorageBackupPrefix = 'BITAUTH_IDE_BACKUP_';

Expand Down
1 change: 1 addition & 0 deletions src/editor/dialogs/edit-script-dialog/EditScriptDialog.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ export const EditScriptDialog = ({
>
<HTMLSelect
id="script-p2sh"
value={scriptLockingType}
options={lockingTypes}
onChange={(e) => {
setScriptLockingType(e.currentTarget.value as LockingType);

Check warning on line 136 in src/editor/dialogs/edit-script-dialog/EditScriptDialog.tsx

View check run for this annotation

Codecov / codecov/patch

src/editor/dialogs/edit-script-dialog/EditScriptDialog.tsx#L136

Added line #L136 was not covered by tests
Expand Down
2 changes: 0 additions & 2 deletions src/editor/script-editor/error-assistance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { abbreviateStackItem } from '../common';
import { ScriptEditorFrame } from '../editor-types';

import {
AuthenticationErrorBch2023Additions,
AuthenticationErrorBch2025Additions,
AuthenticationErrorBchSpec,
AuthenticationErrorBchSpecAdditions,
Expand All @@ -14,7 +13,6 @@ import { Popover } from '@blueprintjs/core';

export type PossibleErrors =
| AuthenticationErrorCommon
| AuthenticationErrorBch2023Additions
| AuthenticationErrorBch2025Additions
| AuthenticationErrorBchSpecAdditions;

Expand Down
108 changes: 60 additions & 48 deletions src/editor/script-editor/wallet-template.schema.json

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions src/state/defaults.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ export const defaultState: AppState = {
currentScenarioInternalId: undefined,
lastSelectedScenarioInternalId: undefined,
currentTemplate: defaultTemplate,
currentVmId: 'BCH_2023_05',
currentVmId: 'BCH_2025_05',
evaluationViewerSettings: {
abbreviateLongStackItems: true,
groupStackItemsDeeperThan: 3,
supportBigInt: false,
supportBigInt: true,
vmNumbersDisplayFormat: 'integer',
reverseStack: false,
showAlternateStack: false,
Expand Down
5 changes: 2 additions & 3 deletions src/templates/2-of-3.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://ide.bitauth.com/authentication-template-v0.schema.json",
"$schema": "https://libauth.org/schemas/wallet-template-v0.schema.json",
"name": "2-of-3 Multisig",
"entities": {
"signer_1": {
Expand Down Expand Up @@ -62,6 +62,5 @@
"BCH_2026_05",
"BCH_SPEC",
"BTC_2017_08"
],
"version": 0
]
}
5 changes: 2 additions & 3 deletions tests/fixtures/empty.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://ide.bitauth.com/authentication-template-v0.schema.json",
"$schema": "https://libauth.org/schemas/wallet-template-v0.schema.json",
"description": "An empty wallet template.\n",
"name": "empty.json",
"entities": {},
Expand All @@ -15,6 +15,5 @@
"script": ""
}
},
"supported": ["BCH_2023_05"],
"version": 0
"supported": ["BCH_2023_05", "BCH_2025_05"]
}
5 changes: 2 additions & 3 deletions tests/fixtures/loops.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://ide.bitauth.com/authentication-template-v0.schema.json",
"$schema": "https://libauth.org/schemas/wallet-template-v0.schema.json",
"description": "Render loops and loop controls in the evaluation viewer.\n",
"name": "loops.json",
"entities": {},
Expand All @@ -9,6 +9,5 @@
"script": "\n<0> <0>\nOP_BEGIN\n\n <1> OP_IF \n <0> OP_BEGIN OP_1ADD OP_DUP <2> OP_EQUAL OP_UNTIL\n <1> <1> OP_BEGIN \n OP_UNTIL OP_BEGIN\n OP_UNTIL\n OP_ENDIF\n OP_ADD\n OP_SWAP OP_1ADD OP_SWAP\n OP_OVER\n <1> OP_IF \n <0> OP_BEGIN OP_BEGIN\n OP_1ADD\n OP_DUP\n <$(\n <0> OP_BEGIN \n OP_1ADD \n OP_DUP <5>\n OP_EQUAL\n OP_UNTIL\n )>\n OP_EQUAL\n OP_UNTIL <1> OP_UNTIL\n OP_ENDIF\n OP_EQUAL\nOP_UNTIL\nOP_NIP\n"
}
},
"supported": ["BCH_SPEC"],
"version": 0
"supported": ["BCH_SPEC"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"raw_url": "https://gist.githubusercontent.com/bitjson/a055ad6ba863a4472767bb5e441a3437/raw/9c014d7e356f33c1b981d07538a936434a08fc27/single-sig.json",
"size": 1254,
"truncated": false,
"content": "{\n \"$schema\": \"https://ide.bitauth.com/authentication-template-v0.schema.json\",\n \"description\": \"A standard single-factor authentication template that uses Pay-to-Public-Key-Hash (P2PKH), the most common authentication scheme in use on the network.\\n\\nThis P2PKH template uses BCH Schnorr signatures, reducing the size of transactions. Because the template uses a Hierarchical Deterministic (HD) key, it also supports watch-only clients.\",\n \"name\": \"Single Signature (P2PKH)\",\n \"entities\": {\n \"owner\": {\n \"description\": \"The individual who can spend from this wallet.\",\n \"name\": \"Owner\",\n \"scripts\": [\"lock\", \"unlock\"],\n \"variables\": {\n \"key\": {\n \"description\": \"The private key that controls this wallet.\",\n \"name\": \"Key\",\n \"type\": \"HdKey\"\n }\n }\n }\n },\n \"scripts\": {\n \"unlock\": {\n \"name\": \"Unlock\",\n \"script\": \"<key.schnorr_signature.all_outputs>\\n<key.public_key>\",\n \"unlocks\": \"lock\"\n },\n \"lock\": {\n \"lockingType\": \"standard\",\n \"name\": \"P2PKH Lock\",\n \"script\": \"OP_DUP\\nOP_HASH160 <$(<key.public_key> OP_HASH160\\n)> OP_EQUALVERIFY\\nOP_CHECKSIG\"\n }\n },\n \"supported\": [\"BCH_2020_05\", \"BCH_2021_05\", \"BCH_2022_05\"],\n \"version\": 0\n}"
"content": "{\n \"$schema\": \"https://libauth.org/schemas/wallet-template-v0.schema.json\",\n \"description\": \"A standard single-factor authentication template that uses Pay-to-Public-Key-Hash (P2PKH), the most common authentication scheme in use on the network.\\n\\nThis P2PKH template uses BCH Schnorr signatures, reducing the size of transactions. Because the template uses a Hierarchical Deterministic (HD) key, it also supports watch-only clients.\",\n \"name\": \"Single Signature (P2PKH)\",\n \"entities\": {\n \"owner\": {\n \"description\": \"The individual who can spend from this wallet.\",\n \"name\": \"Owner\",\n \"scripts\": [\"lock\", \"unlock\"],\n \"variables\": {\n \"key\": {\n \"description\": \"The private key that controls this wallet.\",\n \"name\": \"Key\",\n \"type\": \"HdKey\"\n }\n }\n }\n },\n \"scripts\": {\n \"unlock\": {\n \"name\": \"Unlock\",\n \"script\": \"<key.schnorr_signature.all_outputs>\\n<key.public_key>\",\n \"unlocks\": \"lock\"\n },\n \"lock\": {\n \"lockingType\": \"standard\",\n \"name\": \"P2PKH Lock\",\n \"script\": \"OP_DUP\\nOP_HASH160 <$(<key.public_key> OP_HASH160\\n)> OP_EQUALVERIFY\\nOP_CHECKSIG\"\n }\n },\n \"supported\": [\"BCH_2020_05\", \"BCH_2021_05\", \"BCH_2022_05\"],\n \"version\": 0\n}"
}
},
"public": true,
Expand Down
5 changes: 2 additions & 3 deletions tests/fixtures/non-push-unlocking-opcode.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://ide.bitauth.com/authentication-template-v0.schema.json",
"$schema": "https://libauth.org/schemas/wallet-template-v0.schema.json",
"description": "Render the error for a non-push opcode located in unlocking bytecode.\n",
"name": "non-push-unlocking-opcode.json",
"entities": {},
Expand All @@ -15,6 +15,5 @@
"script": "OP_ADD\n"
}
},
"supported": ["BCH_2023_05"],
"version": 0
"supported": ["BCH_2023_05", "BCH_2025_05"]
}
5 changes: 2 additions & 3 deletions tests/fixtures/single_signature_p2pkh.wallet-template.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://ide.bitauth.com/authentication-template-v0.schema.json",
"$schema": "https://libauth.org/schemas/wallet-template-v0.schema.json",
"description": "A standard single-factor wallet template that uses Pay-to-Public-Key-Hash (P2PKH), the most common authentication scheme in use on the network.\n\nThis P2PKH template uses BCH Schnorr signatures, reducing the size of transactions. Because the template uses a Hierarchical Deterministic (HD) key, it also supports watch-only clients.",
"name": "Single Signature (P2PKH)",
"entities": {
Expand Down Expand Up @@ -37,6 +37,5 @@
"BCH_2025_05",
"BCH_2026_05",
"BCH_SPEC"
],
"version": 0
]
}
5 changes: 2 additions & 3 deletions tests/fixtures/spacers.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://ide.bitauth.com/authentication-template-v0.schema.json",
"$schema": "https://libauth.org/schemas/wallet-template-v0.schema.json",
"description": "Render an example of deeply-nested spacers in the evaluation viewer.",
"name": "spacers.json",
"entities": {},
Expand All @@ -20,6 +20,5 @@
"script": "OP_IF\n <1> OP_IF\n <\n $(<'eval_1'> \n <$(\n <'eval_2'>\n <1> OP_IF\n OP_DROP\n <'inner_if'>\n OP_ENDIF\n )>\n OP_2DROP\n <1> OP_IF\n <'if_1'>\n <1> OP_IF\n <'if_2'>\n OP_ENDIF \n OP_DROP\n OP_ENDIF\n )\n > // push happens after this line\n OP_ELSE <'never'>\n OP_ENDIF\nOP_ELSE\n <0>\nOP_ELSE <'Multiple OP_ELSE quirk'> OP_DROP\nOP_ELSE OP_NOT\nOP_ENDIF \nOP_0NOTEQUAL"
}
},
"supported": ["BCH_2023_05"],
"version": 0
"supported": ["BCH_2023_05", "BCH_2025_05"]
}
5 changes: 2 additions & 3 deletions tests/fixtures/state-merkle-trees.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$schema": "https://ide.bitauth.com/authentication-template-v0.schema.json",
"$schema": "https://libauth.org/schemas/wallet-template-v0.schema.json",
"description": "This contract demonstrates a simple Merkle tree leaf replacement within a covenant. Leaves can be used to maintain any kind of state that a covenant must manage internally like sealed ballots (e.g. shareholder votes), deposit receipts (e.g. for issuing refunds), an order book, etc.\n\nThis demonstration uses a 3-level Merkle tree for which each leaf has been initialized to OP_0:\n \n rt\n / \\\n z0 z1\n / \\ / \\\n y0 y1 y2 y3\n /\\ /\\ /\\ /\\\n x0 x1 x2 x3 x4 x5 x6 x7\n | | | | | | | |\n a0 a1 a2 a3 a4 a5 a6 a7\n\nIn this demo, both \"before\" and \"after\" Merkle trees are simultaneously built/validated for each tree level, optimizing contract size.\n\nYou can explore scripts on the left sidebar:\n\n- See the \"Replace Empty Leaf\" script for a full demo.\n- See the \"Left Sibling\" and \"Right Sibling\" scripts for unit tests of a single tree level.\n\nNote: Merkle trees are typically less efficient for state management than token commitments. Before choosing a Merkle tree, verify that the intended use case cannot be served by placing state in token commitments issued either to certain participants or to covenants designed for this purpose.",
"name": "Experimenting with Contract State Merkle Trees",
"entities": {},
Expand Down Expand Up @@ -103,6 +103,5 @@
}
}
},
"supported": ["BCH_2022_05"],
"version": 0
"supported": ["BCH_2022_05"]
}
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.1"
"@bitauth/libauth": "npm:3.1.0-next.2"
"@blueprintjs/core": "npm:^5.8.2"
"@blueprintjs/icons": "npm:^5.7.0"
"@blueprintjs/select": "npm:^5.0.23"
Expand Down

0 comments on commit 40c56a7

Please sign in to comment.