Skip to content

Commit 6d357da

Browse files
committed
Merge remote-tracking branch 'origin/v0.12-release' into argument_ecdsa
2 parents 0ebac8c + a7a37e1 commit 6d357da

113 files changed

Lines changed: 5017 additions & 4878 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.codecov.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,11 @@ ignore:
22
- packages/cashc/src/grammar/
33
- '**/test/'
44
- examples/
5+
coverage:
6+
status:
7+
project:
8+
default:
9+
target: 95%
10+
patch:
11+
default:
12+
target: 95%

.cspell.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
"algolia",
99
"altstack",
1010
"antlr",
11+
"authchain",
1112
"anyhedge",
1213
"anyonecanpay",
1314
"badlength",
@@ -66,6 +67,7 @@
6667
"fromaltstack",
6768
"gitattributes",
6869
"gitlab",
70+
"gotchas",
6971
"greaterthan",
7072
"greaterthanorequal",
7173
"hardcodes",
@@ -211,6 +213,7 @@
211213
"branchup",
212214
"bchguru",
213215
"bchn",
216+
"bcmr",
214217
"c0ffee",
215218
"cashcompiler",
216219
"cashninjas",

.github/workflows/github-actions.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ on:
77
- 'master'
88
# - 'next'
99

10-
# pull_request:
11-
# branches:
12-
# - '*'
10+
pull_request:
11+
branches:
12+
- '*'
1313

1414
# Allows you to run this workflow manually from the Actions tab
1515
workflow_dispatch:
@@ -32,7 +32,7 @@ jobs:
3232
run: yarn
3333

3434
- name: Run tests
35-
run: TESTS_USE_MOCKNET=true yarn test -- -- --coverage --coverageProvider=v8
35+
run: yarn test -- -- --coverage --coverageProvider=v8
3636

3737
- name: Run linter
3838
run: yarn lint

DEVELOPMENT.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pushd ../.. && yarn build && popd
88

99
### Publishing a release
1010

11-
To publish a new release, we use `yarn update-version 'x.x.x'` in the root directory to bump the version before release, and then `yarn publish-all` in the root directory to publish the release. In case of a tagged release (such as `next`), we use `TESTS_USE_MOCKNET=true yarn publish-all --dist-tag <tag name>` to publish the release with the specified tag.
11+
To publish a new release, we use `yarn update-version 'x.x.x'` in the root directory to bump the version before release, and then `yarn publish-all` in the root directory to publish the release. In case of a tagged release (such as `next`), we use `yarn publish-all --dist-tag <tag name>` to publish the release with the specified tag.
1212

1313
## cashc
1414

@@ -60,11 +60,11 @@ python <cashproof_path> opt.equiv
6060

6161
### Running tests
6262

63-
By default, running tests in the `cashscript` package uses chipnet contracts, which requires the test accounts to have some chipnet BCH. To run the tests against a local "mock network", you can use the `TESTS_USE_MOCKNET` environment variable.
63+
By default, running tests in the `cashscript` package runs against a local simulated `mocknet`. To run them against the real-world chipnet, you can use the `TESTS_USE_CHIPNET` environment variable. This uses chipnet contracts, which requires the test accounts to have some chipnet BCH.
6464

6565
```bash
66-
# Run all tests using the mock network
67-
TESTS_USE_MOCKNET=true yarn test
66+
# Run all tests using chipnet
67+
TESTS_USE_CHIPNET=true yarn test
6868
```
6969

7070
To run specific tests, you can use the `-t` flag to match the name mentioned in the `it` or `describe` block:

examples/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "cashscript-examples",
33
"private": true,
4-
"version": "0.11.0",
4+
"version": "0.11.5",
55
"description": "Usage examples of the CashScript SDK",
66
"main": "p2pkh.js",
77
"type": "module",
@@ -12,10 +12,10 @@
1212
},
1313
"dependencies": {
1414
"@bitauth/libauth": "^3.1.0-next.2",
15-
"@types/node": "^22.10.7",
16-
"cashc": "^0.11.0",
17-
"cashscript": "^0.11.0",
15+
"@types/node": "^22.17.0",
16+
"cashc": "^0.11.5",
17+
"cashscript": "^0.11.5",
1818
"eslint": "^8.56.0",
19-
"typescript": "^5.7.3"
19+
"typescript": "^5.9.2"
2020
}
2121
}

examples/testing-suite/artifacts/example.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@
1515
"bytecode": "OP_1 OP_NUMEQUAL",
1616
"source": "contract Example() {\n function test(int value) {\n console.log(value, \"test\");\n require(value == 1, \"Wrong value passed\");\n }\n}\n",
1717
"debug": {
18-
"bytecode": "007a519c",
19-
"sourceMap": "4:12:4:17;;:21::22;:12:::1",
18+
"bytecode": "519c",
19+
"sourceMap": "4:21:4:22;:4::46:1",
2020
"logs": [
2121
{
2222
"ip": 0,
@@ -33,15 +33,15 @@
3333
],
3434
"requires": [
3535
{
36-
"ip": 4,
36+
"ip": 2,
3737
"line": 4,
3838
"message": "Wrong value passed"
3939
}
4040
]
4141
},
4242
"compiler": {
4343
"name": "cashc",
44-
"version": "0.10.0"
44+
"version": "0.11.3"
4545
},
46-
"updatedAt": "2024-09-10T09:55:42.448Z"
46+
"updatedAt": "2025-08-05T08:32:16.100Z"
4747
}

examples/testing-suite/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "testing-suite",
3-
"version": "0.11.0",
3+
"version": "0.11.5",
44
"description": "Example project to develop and test CashScript contracts",
55
"main": "index.js",
66
"type": "module",
@@ -26,15 +26,15 @@
2626
},
2727
"dependencies": {
2828
"@bitauth/libauth": "^3.1.0-next.2",
29-
"cashc": "^0.11.0",
30-
"cashscript": "^0.11.0",
29+
"cashc": "^0.11.5",
30+
"cashscript": "^0.11.5",
3131
"url-join": "^5.0.0"
3232
},
3333
"devDependencies": {
3434
"@jest/globals": "^29.7.0",
3535
"@types/jest": "^29.5.14",
3636
"jest": "^29.7.0",
37-
"tsx": "^4.19.2",
38-
"typescript": "^5.7.3"
37+
"tsx": "^4.20.3",
38+
"typescript": "^5.9.2"
3939
}
4040
}

package.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010
"devDependencies": {
1111
"@jest/reporters": "^26.6.2",
1212
"@types/jest": "^29.5.14",
13-
"@types/node": "^22.10.7",
13+
"@types/node": "^22.17.0",
1414
"@typescript-eslint/eslint-plugin": "^7.0.0",
1515
"@typescript-eslint/parser": "^7.0.0",
16-
"cspell": "^8.17.2",
16+
"cspell": "^9.2.0",
1717
"eslint": "^8.54.0",
1818
"eslint-config-airbnb-typescript": "^18.0.0",
1919
"eslint-plugin-import": "^2.31.0",
2020
"lerna": "^3.22.1",
21-
"tsx": "^4.19.2",
22-
"typescript": "^5.7.3"
21+
"tsx": "^4.20.3",
22+
"typescript": "^5.9.2"
2323
},
2424
"scripts": {
2525
"test": "lerna run test --ignore cashscript-examples --ignore testing-suite",

packages/cashc/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "cashc",
3-
"version": "0.11.0",
3+
"version": "0.11.5",
44
"description": "Compile Bitcoin Cash contracts to Bitcoin Cash Script or artifacts",
55
"keywords": [
66
"bitcoin",
@@ -51,23 +51,23 @@
5151
"test": "NODE_OPTIONS='--experimental-vm-modules --no-warnings' jest"
5252
},
5353
"dependencies": {
54-
"@bitauth/libauth": "^3.1.0-next.2",
55-
"@cashscript/utils": "^0.11.0",
54+
"@bitauth/libauth": "^3.1.0-next.8",
55+
"@cashscript/utils": "^0.11.5",
5656
"antlr4": "^4.13.2",
57-
"commander": "^13.1.0",
58-
"semver": "^7.6.3"
57+
"commander": "^14.0.0",
58+
"semver": "^7.7.2"
5959
},
6060
"devDependencies": {
6161
"@jest/globals": "^29.7.0",
6262
"@types/jest": "^29.5.14",
63-
"@types/node": "^22.10.7",
64-
"@types/semver": "^7.5.8",
63+
"@types/node": "^22.17.0",
64+
"@types/semver": "^7.7.0",
6565
"cpy-cli": "^5.0.0",
6666
"eslint": "^8.54.0",
6767
"eslint-plugin-import": "^2.31.0",
6868
"jest": "^29.7.0",
69-
"tsx": "^4.19.2",
70-
"typescript": "^5.7.3",
69+
"tsx": "^4.20.3",
70+
"typescript": "^5.9.2",
7171
"url-join": "^5.0.0"
7272
},
7373
"gitHead": "bf02a4b641d5d03c035d052247a545109c17b708"

packages/cashc/src/Errors.ts

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,12 @@ import {
1919
StatementNode,
2020
ContractNode,
2121
ExpressionNode,
22+
SliceNode,
23+
IntLiteralNode,
2224
} from './ast/AST.js';
2325
import { Symbol, SymbolType } from './ast/SymbolTable.js';
2426
import { Location, Point } from './ast/Location.js';
27+
import { BinaryOperator } from './ast/Operator.js';
2528

2629
export class CashScriptError extends Error {
2730
node: Node;
@@ -73,7 +76,7 @@ export class InvalidSymbolTypeError extends CashScriptError {
7376
}
7477
}
7578

76-
export class RedefinitionError extends CashScriptError {}
79+
export class RedefinitionError extends CashScriptError { }
7780

7881
export class FunctionRedefinitionError extends RedefinitionError {
7982
constructor(
@@ -160,7 +163,7 @@ export class UnequalTypeError extends TypeError {
160163

161164
export class UnsupportedTypeError extends TypeError {
162165
constructor(
163-
node: BinaryOpNode | UnaryOpNode | TimeOpNode | TupleIndexOpNode,
166+
node: BinaryOpNode | UnaryOpNode | TimeOpNode | TupleIndexOpNode | SliceNode,
164167
actual?: Type,
165168
expected?: Type,
166169
) {
@@ -170,6 +173,8 @@ export class UnsupportedTypeError extends TypeError {
170173
} else {
171174
super(node, actual, expected, `Tried to call member 'split' on unsupported type '${actual}'`);
172175
}
176+
} else if (node instanceof SliceNode) {
177+
super(node, actual, expected, `Tried to call member 'slice' on unsupported type '${actual}'`);
173178
} else if (node instanceof BinaryOpNode) {
174179
super(node, actual, expected, `Tried to apply operator '${node.operator}' to unsupported type '${actual}'`);
175180
} else if (node instanceof UnaryOpNode && node.operator.startsWith('.')) {
@@ -249,9 +254,22 @@ export class ArrayElementError extends CashScriptError {
249254

250255
export class IndexOutOfBoundsError extends CashScriptError {
251256
constructor(
252-
node: TupleIndexOpNode,
257+
node: TupleIndexOpNode | BinaryOpNode | SliceNode,
253258
) {
254-
super(node, `Index ${node.index} out of bounds`);
259+
if (node instanceof TupleIndexOpNode) {
260+
super(node, `Index ${node.index} out of bounds`);
261+
} else if (
262+
node instanceof BinaryOpNode && node.operator === BinaryOperator.SPLIT && node.right instanceof IntLiteralNode
263+
) {
264+
const splitIndex = Number(node.right.value);
265+
super(node, `Split index ${splitIndex} out of bounds for type ${node.left.type}`);
266+
} else if (node instanceof SliceNode) {
267+
const start = node.start instanceof IntLiteralNode ? Number(node.start.value) : 'start';
268+
const end = node.end instanceof IntLiteralNode ? Number(node.end.value) : 'end';
269+
super(node, `Slice indexes (${start}, ${end}) out of bounds for type ${node.element.type}`);
270+
} else {
271+
super(node, 'Index out of bounds');
272+
}
255273
}
256274
}
257275

0 commit comments

Comments
 (0)