Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"cashaddress",
"cashc",
"cashlibs",
"cashproof",
"cashscript",
"cashtokens",
"castable",
Expand Down
2 changes: 1 addition & 1 deletion AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ Shared between compiler and SDK:
- `source-map.ts` — source map encoding/decoding (format: `sl:sc:el:ec:h` per opcode, `;`-separated, with field inheritance compression)
- `bitauth-script.ts` — formats bytecode as human-readable BitAuth script (used in debugging)
- `types.ts` — shared types including `SourceTagKind`, `SourceTagEntry`
- `optimisations.ts` / `cashproof-optimisations.ts` — peephole optimization rules
- `optimisations.ts` — peephole optimization rules

## Code Conventions

Expand Down
18 changes: 0 additions & 18 deletions DEVELOPMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,24 +38,6 @@ When updating the grammar file in `src/grammar/CashScript.g4`, we also need to m
yarn antlr
```

### Running `cashproof`

Most of the bytecode optimisations that the `cashc` compiler uses can be verified for correctness using the [`cashproof` tool](https://github.com/EyeOfPython/cashproof). This tool needs to be installed separately by installing its dependencies using `pip` and cloning its repository from GitHub.

From there, you can run `python <cashproof_path> [filenames]` to verify that the optimisations contained in these files are provably correct.

Example:
```bash
python <cashproof_path> packages/cashc/test/cashproof/0.1.2=0.2.0.equiv
```

Note that if you want to run `cashproof` on the "main" CashScript optimisations file, you need to first extract the optimisations from the `cashc` compiler and save them in a separate file. This can be done using the following commands:

```bash
cp packages/utils/src/cashproof-optimisations.ts opt.equiv && sed -i '' '/`/d' opt.equiv
python <cashproof_path> opt.equiv
```

## cashscript

### Running tests
Expand Down
9 changes: 0 additions & 9 deletions packages/cashc/src/compiler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import {
generateSourceTags,
generateInlineRanges,
optimiseBytecode,
optimiseBytecodeOld,
scriptToAsm,
scriptToBytecode,
sourceMapToLocationData,
} from '@cashscript/utils';
Expand Down Expand Up @@ -139,7 +137,6 @@ function compileCode(
ast = ast.accept(traversal) as Ast;

// Bytecode optimisation
const optimisedBytecodeOld = optimiseBytecodeOld(traversal.output);
const optimisationResult = optimiseBytecode(
traversal.output,
sourceMapToLocationData(traversal.sourceMap),
Expand All @@ -150,12 +147,6 @@ function compileCode(
constructorParamLength,
);

if (scriptToAsm(optimisedBytecodeOld) !== scriptToAsm(optimisationResult.script)) {
console.error(scriptToAsm(optimisedBytecodeOld));
console.error(scriptToAsm(optimisationResult.script));
throw new Error('New bytecode optimisation is not backwards compatible, please report this issue to the CashScript team');
}

const debug = {
bytecode: binToHex(scriptToBytecode(optimisationResult.script)),
sourceMap: generateSourceMap(optimisationResult.locationData),
Expand Down
111 changes: 0 additions & 111 deletions packages/cashc/test/cashproof/0.1.2=0.2.0.equiv

This file was deleted.

32 changes: 0 additions & 32 deletions packages/cashc/test/cashproof/0.3.3=0.4.0.equiv

This file was deleted.

14 changes: 0 additions & 14 deletions packages/cashc/test/cashproof/slice.equiv

This file was deleted.

Loading
Loading