Skip to content

v1.3.41

Latest

Choose a tag to compare

@github-actions github-actions released this 13 Mar 21:36

simgo v1.3.41 — Release Notes

Summary

Bugfix for v1.3.4: FeeAdjustedLe128 expansion used jet::add_128, which does not exist in
the Simplicity protocol. Replaced with jet::add_64 on u64 values after individually asserting
each product fits in 64 bits.


Bug Fixed

jet::add_128 is not a valid Simplicity jet.

Simplicity arithmetic jets top out at 64-bit (add_64, full_add_64, etc.). The v1.3.4
expansion for FeeAdjustedLe128 attempted to sum two u128 products with a non-existent
add_128 jet, causing simc to reject the generated .shl with:

Jet 'add_128' does not exist

Fix

Instead of summing the u128 products directly, decompose each into (hi, lo) and assert both
hi words are zero before adding the lo words with add_64:

Before (broken):

let (_, fa_adj): (bool, u128) = jet::add_128(fa_t1, fa_t2);
let (fa_adj_hi, fa_adj_lo): (u64, u64) = <u128>::into(fa_adj);
assert!(jet::eq_64(fa_adj_hi, 0));

After (correct):

let (fa_t1_hi, fa_t1_lo): (u64, u64) = <u128>::into(fa_t1);
let (fa_t2_hi, fa_t2_lo): (u64, u64) = <u128>::into(fa_t2);
assert!(jet::eq_64(fa_t1_hi, 0));
assert!(jet::eq_64(fa_t2_hi, 0));
let (fa_carry, fa_adj_lo): (bool, u64) = jet::add_64(fa_t1_lo, fa_t2_lo);
unwrap_left::<()>(<bool>::into(fa_carry));

The semantics are identical: both products are asserted to fit in u64 (same overflow guard as
before), and the sum is asserted to not overflow u64. Valid for all practical pool sizes.


Test Update

TestFeeAdjustedLe128Verify updated with two new assertions:

  • Output contains jet::add_64(
  • Output does not contain jet::add_128(

Full Changelog: v1.3.4...v1.3.41