Skip to content

Commit 221deef

Browse files
committed
Clean up TODOs / comments before release
1 parent 3d0512a commit 221deef

File tree

7 files changed

+9
-24
lines changed

7 files changed

+9
-24
lines changed

packages/cashc/src/compiler.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,13 @@ export function compileString(code: string): Artifact {
4141
if (scriptToAsm(optimisedBytecodeOld) !== scriptToAsm(optimisationResult.script)) {
4242
console.error(scriptToAsm(optimisedBytecodeOld));
4343
console.error(scriptToAsm(optimisationResult.script));
44-
throw new Error('New bytecode optimisation is not backwards compatible');
44+
throw new Error('New bytecode optimisation is not backwards compatible, please report this issue to the CashScript team');
4545
}
4646

4747
// Attach debug information
4848
const debug = {
4949
bytecode: binToHex(scriptToBytecode(optimisationResult.script)),
5050
sourceMap: generateSourceMap(optimisationResult.locationData),
51-
// sourceMap: traversal.sourceMap,
5251
logs: optimisationResult.logs,
5352
requires: optimisationResult.requires,
5453
};

packages/cashscript/src/LibauthTemplate.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -321,21 +321,6 @@ export const generateTemplateScenarioTransactionOutputLockingBytecode = (
321321
return binToHex(addressToLockScript(csOutput.to));
322322
};
323323

324-
/**
325-
* Generates source outputs for a BitAuth template scenario
326-
*
327-
* @param csTransaction - The CashScript transaction to generate source outputs for
328-
* @returns An array of BitAuth template scenario outputs with locking scripts and values
329-
*
330-
* For each input in the transaction:
331-
* - Generates appropriate locking bytecode (P2PKH or contract)
332-
* - Includes the input value in satoshis
333-
* - Includes any token details if present
334-
*
335-
* The slotIndex tracks which input is the contract input vs P2PKH inputs
336-
* to properly generate the locking scripts.
337-
*/
338-
// TODO: This looks like it needs some refactor to work with the new stuff
339324
const generateTemplateScenarioSourceOutputs = (
340325
csTransaction: Transaction,
341326
): Array<WalletTemplateScenarioOutput<true>> => {

packages/cashscript/src/Transaction.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ export class Transaction {
187187

188188
// method to debug the transaction with libauth VM, throws upon evaluation error
189189
async debug(): Promise<DebugResults> {
190-
if (!semver.satisfies(this.contract.artifact.compiler.version, '>=0.11.0-next.4', { includePrerelease: true })) {
190+
if (!semver.satisfies(this.contract.artifact.compiler.version, '>=0.11.0')) {
191191
console.warn('For the best debugging experience, please recompile your contract with cashc version 0.11.0 or newer.');
192192
}
193193

packages/cashscript/src/TransactionBuilder.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export class TransactionBuilder {
170170
.map((input) => 'contract' in input.unlocker ? input.unlocker.contract.artifact.compiler.version : null)
171171
.filter((version) => version !== null);
172172

173-
if (!contractVersions.every((version) => semver.satisfies(version, '>=0.11.0-next.4', { includePrerelease: true }))) {
173+
if (!contractVersions.every((version) => semver.satisfies(version, '>=0.11.0'))) {
174174
console.warn('For the best debugging experience, please recompile your contract with cashc version 0.11.0 or newer.');
175175
}
176176

@@ -186,7 +186,6 @@ export class TransactionBuilder {
186186
return getLibauthTemplates(this);
187187
}
188188

189-
// TODO: see if we can merge with Transaction.ts
190189
async send(): Promise<TransactionDetails>;
191190
async send(raw: true): Promise<string>;
192191
async send(raw?: true): Promise<TransactionDetails | string> {
@@ -207,7 +206,6 @@ export class TransactionBuilder {
207206
}
208207
}
209208

210-
// TODO: see if we can merge with Transaction.ts
211209
private async getTxDetails(txid: string): Promise<TransactionDetails>;
212210
private async getTxDetails(txid: string, raw: true): Promise<string>;
213211
private async getTxDetails(txid: string, raw?: true): Promise<TransactionDetails | string> {

packages/cashscript/src/debugging.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,10 @@ const calculateCleanupSize = (instructions: Array<AuthenticationInstruction | un
258258
// OP_NIP (or OP_DROP/OP_2DROP in optimised bytecode) is used for cleanup at the end of a function,
259259
// OP_ENDIF and OP_ELSE are the end of branches. We need to remove all of these to get to the actual last
260260
// executed instruction of a function
261-
// TODO: What about OP_1??
261+
// Note that in the case where we re-add OP_1 because we cannot optimise the final explicit VERIFY into an implicit one
262+
// (like when dealing with if-statements, or with CHECKLOCKTIMEVERIFY), it is impossible to run into an implicit final
263+
// verify failure. That is why OP_1 does not need to be included in the cleanup opcodes.
264+
// TODO: Perhaps we also do not need to add OP_DROP/OP_2DROP either, because they only occur together with OP_1
262265
const cleanupOpcodes = [Op.OP_ENDIF, Op.OP_NIP, Op.OP_ELSE, Op.OP_DROP, Op.OP_2DROP];
263266

264267
let cleanupSize = 0;

website/docs/basics/getting-started.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ To write CashScript smart contracts locally you use a code editor. For the best
3131

3232
:::note prerequisites
3333
- Basic familiarity with the command line
34-
- Node.js installed (v20 or newer)
34+
- Node.js installed (v22 or newer)
3535
- A code editor (VS Code recommended)
3636
:::
3737

website/docs/releases/release-notes.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
title: Release Notes
33
---
44

5-
## v0.11.0-next.4
5+
## v0.11.0
66

77
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/).
88

0 commit comments

Comments
 (0)