> For the complete documentation index, see [llms.txt](https://docs.midnight.network/llms.txt)

# Compact toolchain 0.31.1

* **Date**: 2026-06-25
* **Language version:** 0.23.0
* **Compact runtime version:** 0.16.0
* **Environment**: All public Midnight environments at the time of release. For the full compatibility matrix, see the [release notes overview](https://docs.midnight.network/relnotes/overview)

## High-level summary[​](#high-level-summary "Direct link to High-level summary")

Version 0.31.1 of the Compact toolchain is a patch release on the 0.31 line that fixes code generation for certain casts. The language version and the Compact runtime version are unchanged, so contracts compile against the same runtime as with 0.31.0. You can update to this version with `compact update 0.31`.

## Audience[​](#audience "Direct link to Audience")

These release notes are intended for Compact smart contract developers.

## What changed[​](#what-changed "Direct link to What changed")

* Fixed code generation for certain casts

## Bug fixes[​](#bug-fixes "Direct link to Bug fixes")

### Code generation for certain casts[​](#code-generation-for-certain-casts "Direct link to Code generation for certain casts")

The compiler's common-subexpression matching treated a guarded (safe) unsigned downcast and an unguarded one of the same value as the same operation, so one could be substituted for the other in the generated circuit. The `safe` flag is now part of the comparison and of the hash, so the two forms stay distinct.

## Links and references[​](#links-and-references "Direct link to Links and references")

* [Compact toolchain 0.31.1 on GitHub](https://github.com/midnightntwrk/compact/releases/tag/compactc-v0.31.1)
* [Changelog in the Compact repository](https://github.com/LFDT-Minokawa/compact/blob/compactc-v0.31.1/CHANGELOG.md)
* [Compact toolchain 0.31.0 release notes](https://docs.midnight.network/relnotes/compact/toolchain-0.31.0.md)
