v0.2.0
Pre-release
Pre-release
cashc compiler
- 🐎 Implement compiler optimisations
- For the final use of a variable, it is retrieved with OP_ROLL rather than OP_PICK. This removes the need to clean the stack at the end of a contract.
- Final OP_VERIFY OP_TRUE is removed as there is an implicit OP_VERIFY at the end of a Script.
- OP_VERIFY is merged with preceding opcode where applicable.
- Shallow OP_PICK and OP_ROLL are replaced by hardcoded opcodes (e.g. OP_SWAP, OP_DUP).
- Several other bytecode optimisations.
- ✨ Add
pragmakeyword to specify intended compiler version.- Example:
pragma cashscript ^0.2.0; - Contract fails to compile when compiler version does not satisfy constraints.
- Example:
- 🚨 Add CashProof for all individual bytecode optimisations and for example contracts from 0.1.2 to 0.2.0.
- 🐛 Add "default case" for function selection that fixes a vulnerability where people could spend funds by not calling any function.
- ⬆️ Update dependencies.
CashScript SDK
- ⬆️ Update
cashcand other dependencies.
Update notes
Due to compiler optimisations, this version of CashScript will output different bytecode than version 0.1.x. Keep this in mind when updating. If you are using contracts compiled with version 0.1.2 make sure to store an artifact file compiled with version 0.1.2 before upgrading to 0.2.0 to keep using these contracts.
Going forward, it is also recommended to add a pragma directive at the start of each contract file to enforce the compiler version that this contract was written for.