Repository navigation
Compact toolchain 0.37.0 (Compact language 0.29.0)
Compact toolchain 0.37.0
- Date: 2026-11-30
- Language version: 0.29.0
- Compact runtime version: 0.22.0
- Environment: This release works with a Midnight ledger 9 blockchain. For the full compatibility matrix, see the release notes compatibility matrix.
High-level summary
Version 0.37.0 of the Compact toolchain is a major release. It contains a number of bug fixes, two new features, and some breaking changes. Not all of the fixes are described in the "Fixed defect" list, and we strongly recommend that all users update to 0.37.0.
You can update to version 0.37.0 using the Compact devtools. compact update will update to the latest released version, and compact update 0.37 will specifically update to the latest patch release of toolchain 0.37.
Audience
These release notes are intended for Compact smart-contract developers and for DApp developers who use the Compact runtime.
New features
Casts are allowed in both directions between JubjubScalar and Bytes<32>
New casts are allowed between JubjubScalar and Bytes<32> in both directions, following the same rules as the foreign field casts. Casting to Bytes<32> always succeeds, and casting to JubjubScalar reduces the value modulo the field order if it is too large. The Bytes<32> representation is the little-endian encoding of the value.
canonicalContractAddress is exported by the Compact runtime
The Compact runtime now exports canonicalContractAddress, which checks that its argument is a valid contract address and returns its canonical lowercase spelling.
Breaking changes
createCircuitContext rejects an invalid contract address
createCircuitContext in the Compact runtime now rejects an invalid contractAddress and throws a CompactError.
Constructors that rely on initialized ledger state are rejected
The compiler now rejects constructors that call operations requiring the contract's state to be already initialized. This includes certain standard library functions and ledger operations; see the Compact language reference for the full list.
Fixed defect list
The following defects are fixed by updating to Compact toolchain 0.37.
-
Fixed an internal compiler error when calling
resetToDefault()on aMerkleTreeorHistoricMerkleTreeof depth 16–32, or when storing a default tree of such depth in aMapviainsertDefault()orinsert(). (#879) -
Fixed an internal compiler error when calling
serializeon certain deeply nested structures. (#943) -
Fixed serialization and deserialization of
JubjubScalarvalues, which failed with an internal compiler error. Serialization and deserialization tried to useBytes<32>casts which were not provided by the language. (#938) -
Fixed the compiler's check that exported circuits do not modify
sealedledger fields, which did not look inside tuple and vector literals or the arguments ofmapandfold, includingforloops over a computed vector. Contracts that the compiler incorrectly accepted before will now be rejected, so this is a breaking fix. (#932) -
Fixed
sha512so it disallows inputs that contain opaque types. They cannot be hashed correctly in circuit. They are now rejected, just as they already are rejected by the other byte-oriented hashing functions (persistentHash,persistentCommit, andkeccak256). Contracts that the compiler incorrectly accepted before will now be rejected, so this is a breaking fix. -
Fixed the Compact runtime's stripping of a leading U+FEFF, as if it were a byte order mark, when reading an
Opaque<'string'>value from ledger state. The resulting string no longer matched the bytes stored on the ledger, so circuits that returned it, wrote it back, compared it, or used it as a map key could not be proven. -
Fixed the Compact runtime's rejection of shielded coins with values that did not fit in 64 bits when creating or looking up their commitments, even though
ShieldedCoinInfo.valueis aUint<128>. Circuits that received, merged, or sent such coins through the standard library failed before they could be proven. -
Fixed the Compact runtime's treatment of different hex spellings of the same contract address as different contracts.
createCircuitContextandcrossContractCallkeyed per-contract state and the re-entrancy guard by the address as spelled, so a re-entrant call using a differently-cased address was not refused and ran against a second copy of the contract's state. -
The Compact runtime's ledger decoding of
enumtypes has been hardened to avoid a bug involving JavaScript's left-shift operation. This could cause encoded values to be decoded incorrectly. Such encodings were impractical to create in Compact, so this can only affect a DApp that used the runtime to decodeenumtypes with more than2^32values. -
Fixed the Compact runtime's descriptor for
JubjubScalar, which previously accepted values outside theJubjubScalarrange. Out-of-range values are now rejected on both encoding and decoding. Compact code never wrote such values to the ledger, so this can only affect a DApp that used the runtime to encode or decode out-of-rangeJubjubScalarvalues. -
Additional fixes for issues not listed here. Thanks to @0xSHKWON for reporting several of them.
Links and references
- The Compact documentation portal,
including the language reference,
the standard library documentation,
and the ledger ADT documentation - The Compact runtime TypeScript API for DApps
- Compact compiler usage
- The open-source project on GitHub for bug reports and feature requests