Skip to content

Commit

Permalink
Bump version to 0.11.0-next.0 and add release notes for it + update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
rkalis committed Nov 19, 2024
1 parent 3f92a3d commit 18df35a
Show file tree
Hide file tree
Showing 10 changed files with 39 additions and 18 deletions.
6 changes: 3 additions & 3 deletions examples/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "cashscript-examples",
"private": true,
"version": "0.10.2",
"version": "0.11.0-next.0",
"description": "Usage examples of the CashScript SDK",
"main": "p2pkh.js",
"type": "module",
Expand All @@ -13,8 +13,8 @@
"dependencies": {
"@bitauth/libauth": "^3.1.0-next.2",
"@types/node": "^12.7.8",
"cashc": "^0.10.2",
"cashscript": "^0.10.2",
"cashc": "^0.11.0-next.0",
"cashscript": "^0.11.0-next.0",
"eslint": "^8.56.0",
"typescript": "^4.9.5"
}
Expand Down
6 changes: 3 additions & 3 deletions examples/testing-suite/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "testing-suite",
"version": "0.10.2",
"version": "0.11.0-next.0",
"description": "Example project to develop and test CashScript contracts",
"main": "index.js",
"type": "module",
Expand All @@ -26,8 +26,8 @@
},
"dependencies": {
"@bitauth/libauth": "^3.1.0-next.2",
"cashc": "^0.10.2",
"cashscript": "^0.10.2",
"cashc": "^0.11.0-next.0",
"cashscript": "^0.11.0-next.0",
"url-join": "^5.0.0"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions packages/cashc/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cashc",
"version": "0.10.2",
"version": "0.11.0-next.0",
"description": "Compile Bitcoin Cash contracts to Bitcoin Cash Script or artifacts",
"keywords": [
"bitcoin",
Expand Down Expand Up @@ -50,7 +50,7 @@
},
"dependencies": {
"@bitauth/libauth": "^3.1.0-next.2",
"@cashscript/utils": "^0.10.2",
"@cashscript/utils": "^0.11.0-next.0",
"antlr4": "^4.13.1-patch-1",
"commander": "^7.1.0",
"semver": "^7.5.4"
Expand Down
2 changes: 1 addition & 1 deletion packages/cashc/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ export * from './Errors.js';
export * as utils from '@cashscript/utils';
export { compileFile, compileString } from './compiler.js';

export const version = '0.10.2';
export const version = '0.11.0-next.0';
4 changes: 2 additions & 2 deletions packages/cashscript/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cashscript",
"version": "0.10.2",
"version": "0.11.0-next.0",
"description": "Easily write and interact with Bitcoin Cash contracts",
"keywords": [
"bitcoin cash",
Expand Down Expand Up @@ -44,7 +44,7 @@
},
"dependencies": {
"@bitauth/libauth": "^3.1.0-next.2",
"@cashscript/utils": "^0.10.2",
"@cashscript/utils": "^0.11.0-next.0",
"@mr-zwets/bchn-api-wrapper": "^1.0.1",
"delay": "^5.0.0",
"electrum-cash": "^2.0.10",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@cashscript/utils",
"version": "0.10.2",
"version": "0.11.0-next.0",
"description": "CashScript utilities and types",
"keywords": [
"bitcoin cash",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ If your contract includes multiple functions, consider a modular design. Separat

## Operation Cost Limit

Bitcoin Cash also enforces an **operation cost limit** (op-cost) on each transaction input. The op-cost limit controls the computational budget available for operations in a contract and is calculated based on the input length, with each byte allowing for a higher maximum opereraction cost.
Bitcoin Cash also enforces an **operation cost limit** (op-cost) on each transaction input. The op-cost limit controls the computational budget available for operations in a contract and is calculated based on the input length, with each byte allowing for a higher maximum operation cost.

```ts
function maxOperationCost(unlockingBytecodeLength) {
Expand All @@ -33,7 +33,7 @@ To increase your contract's compute budget for resource-intensive operations (e.

For completeness, here are additional Bitcoin Cash VM limits relevant to CashScript development:

- **Signature Operation Count** (SigChecks) Limits the number of signature verifications (e.g. `OP_CHECKSIG`, `OP_CHECKDATASIG`) per transaction to ensure efficient validation.
- **Signature Operation Count** (SigChecks) Limits the number of signature verifications (e.g. `OP_CHECKSIG`, `OP_CHECKDATASIG`) per transaction to ensure efficient validation.

- **Hashing Limit**: Limits the number of hashing operations (e.g. `OP_SHA256`, `OP_HASH160`) allowed per transaction to prevent excessive resource usage.

Expand Down
16 changes: 13 additions & 3 deletions website/docs/language/types.md
Original file line number Diff line number Diff line change
Expand Up @@ -180,12 +180,22 @@ VM numbers follow Script Number format (A.K.A. CSCriptNum), to convert VM number

### Semantic Byte Casting

Bytes to bytes casting is just semantic and can be helpful for working with `LockingBytecode` global functions which expect a specific length input. To utilize byte-padding, convert to `int` and utilize the integer padding.
When casting unbounded `bytes` types to bounded `bytes` types (such as `bytes20` or `bytes32`), this is a purely semantic cast. The bytes are not padded with zeros, and no checks are performed to ensure the cast bytes are of the correct length. This can be helpful in certain cases, such as `LockingBytecode`, which expects a specific length input.

#### Example
```solidity
bytes pkh = nftcommitment.split(20)[0];
bytes25 lockingBytecode = new LockingBytecodeP2PKH(bytes20(pkh)):
bytes pkh = nftCommitment.split(20)[0]; // (type = bytes, content = 20 bytes)
bytes20 bytes20Pkh = bytes20(pkh); // (type = bytes20, content = 20 bytes)
bytes25 lockingBytecode = new LockingBytecodeP2PKH(bytes20Pkh);
```

If you do need to pad bytes to a specific length, you can convert the bytes to `int` first, and then cast to the bounded `bytes` type. This will pad the bytes with zeros to the specified length, like specified in the *Int to Byte Casting* section above.

#### Example
```solidity
bytes data = nftCommitment.split(10)[0]; // (type = bytes, content = 10 bytes)
bytes20 paddedData = bytes20(int(data)); // (type = bytes20, content = 20 bytes)
require(storedContractState == paddedData);
```

## Operators
Expand Down
11 changes: 11 additions & 0 deletions website/docs/releases/release-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,17 @@
title: Release Notes
---

## v0.11.0-next.0

This update adds CashScript support for the new BCH 2025 network upgrade. To read more about the upgrade, see [this blog post](https://blog.bitjson.com/2025-chips/).

#### cashc compiler
- :hammer_and_wrench: Remove warning for opcount and update warning for byte size to match new limits.

#### CashScript SDK
- :hammer_and_wrench: Update debug tooling to work with the new `BCH_2025_05` instruction set.


## v0.10.2

#### cashc compiler
Expand Down
2 changes: 1 addition & 1 deletion website/sidebars.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ module.exports = {
label: 'Compiler',
items: [
'compiler/compiler',
'compiler/vmlimits',
'compiler/vm-limits',
'compiler/artifacts',
'compiler/grammar',
],
Expand Down

0 comments on commit 18df35a

Please sign in to comment.