diff --git a/examples/package.json b/examples/package.json index a6dc2d95..db1eb81b 100644 --- a/examples/package.json +++ b/examples/package.json @@ -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", @@ -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" } diff --git a/examples/testing-suite/package.json b/examples/testing-suite/package.json index 44bb15fc..df6f195c 100644 --- a/examples/testing-suite/package.json +++ b/examples/testing-suite/package.json @@ -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", @@ -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": { diff --git a/packages/cashc/package.json b/packages/cashc/package.json index 5befef7b..5648a24e 100644 --- a/packages/cashc/package.json +++ b/packages/cashc/package.json @@ -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", @@ -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" diff --git a/packages/cashc/src/index.ts b/packages/cashc/src/index.ts index e62cf342..dcf7c2f4 100644 --- a/packages/cashc/src/index.ts +++ b/packages/cashc/src/index.ts @@ -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'; diff --git a/packages/cashscript/package.json b/packages/cashscript/package.json index 54ca21c2..623e664a 100644 --- a/packages/cashscript/package.json +++ b/packages/cashscript/package.json @@ -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", @@ -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", diff --git a/packages/utils/package.json b/packages/utils/package.json index 2cc05ac7..1b93cbff 100644 --- a/packages/utils/package.json +++ b/packages/utils/package.json @@ -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", diff --git a/website/docs/compiler/vmlimits.md b/website/docs/compiler/vm-limits.md similarity index 97% rename from website/docs/compiler/vmlimits.md rename to website/docs/compiler/vm-limits.md index da7daf3d..a25c8cde 100644 --- a/website/docs/compiler/vmlimits.md +++ b/website/docs/compiler/vm-limits.md @@ -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) { @@ -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. diff --git a/website/docs/language/types.md b/website/docs/language/types.md index 11edc4e9..f55968fa 100644 --- a/website/docs/language/types.md +++ b/website/docs/language/types.md @@ -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 diff --git a/website/docs/releases/release-notes.md b/website/docs/releases/release-notes.md index da27834f..6e356d8b 100644 --- a/website/docs/releases/release-notes.md +++ b/website/docs/releases/release-notes.md @@ -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 diff --git a/website/sidebars.js b/website/sidebars.js index bf89d5f8..3a455816 100755 --- a/website/sidebars.js +++ b/website/sidebars.js @@ -25,7 +25,7 @@ module.exports = { label: 'Compiler', items: [ 'compiler/compiler', - 'compiler/vmlimits', + 'compiler/vm-limits', 'compiler/artifacts', 'compiler/grammar', ],