Skip to content

Add deep rewrite for mutual recursion support#597

Merged
nielstron merged 46 commits intodevfrom
feat/mutual-recursion
Mar 10, 2026
Merged

Add deep rewrite for mutual recursion support#597
nielstron merged 46 commits intodevfrom
feat/mutual-recursion

Conversation

@nielstron
Copy link
Copy Markdown
Contributor

@nielstron nielstron commented Mar 6, 2026

Supercedes #525 and tackles #522

@nielstron nielstron force-pushed the feat/mutual-recursion branch from a59f0ef to ccfd904 Compare March 6, 2026 10:20
@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 6, 2026

⚠️ Binary Size Changes Detected

Binary Size Comparison Report
Loading baseline measurements...
Measuring current binary sizes and execution costs...
Measuring assert_sum...
  O0: 56318 bytes
    Evaluating test case: valid_sum
      CPU: 44,841,759 | MEM: 243,774
  O1: 15630 bytes
    Evaluating test case: valid_sum
      CPU: 25,865,759 | MEM: 125,174
  O2: 15612 bytes
    Evaluating test case: valid_sum
      CPU: 25,826,516 | MEM: 124,942
  O3: 8998 bytes
    Evaluating test case: valid_sum
      CPU: 23,586,516 | MEM: 110,942
Measuring liquidity_pool...
  O0: 154106 bytes
  O1: 59794 bytes
  O2: 59456 bytes
  O3: 26570 bytes
Measuring marketplace...
  O0: 125476 bytes
  O1: 38302 bytes
  O2: 38198 bytes
  O3: 12650 bytes
Measuring gift...
  O0: 58794 bytes
    Evaluating test case: valid_withdrawal
      CPU: 52,388,498 | MEM: 268,835
  O1: 17506 bytes
    Evaluating test case: valid_withdrawal
      CPU: 34,980,498 | MEM: 160,035
  O2: 17486 bytes
    Evaluating test case: valid_withdrawal
      CPU: 34,902,012 | MEM: 159,571
  O3: 9334 bytes
    Evaluating test case: valid_withdrawal
      CPU: 31,878,012 | MEM: 140,671
Measuring wrapped_token...
  O0: 66190 bytes
  O1: 21524 bytes
  O2: 21230 bytes
  O3: 11648 bytes
Measuring micropayments...
  O0: 89364 bytes
  O1: 31932 bytes
  O2: 31842 bytes
  O3: 14974 bytes

============================================================
BINARY SIZE AND EXECUTION COST COMPARISON REPORT
============================================================

Contract: assert_sum
Description: Simple spending validator with assertion
----------------------------------------
  O0: 54,954 → 56,318 bytes (+1,364 bytes, +2.5%)
    Test 'valid_sum': CPU 44,505,759 → 44,841,759 (+336,000, +0.8%) | MEM 241,674 → 243,774 (+2,100, +0.9%)
  O1: 3,536 → 15,630 bytes (+12,094 bytes, +342.0%) ⚠️  SIGNIFICANT CHANGE (ignored)
    Test 'valid_sum': CPU 19,817,759 → 25,865,759 (+6,048,000, +30.5%) | MEM 87,374 → 125,174 (+37,800, +43.3%) ⚠️  SIGNIFICANT CHANGE (ignored)
  O2: 3,534 → 15,612 bytes (+12,078 bytes, +341.8%) ⚠️  SIGNIFICANT CHANGE
    Test 'valid_sum': CPU 19,778,516 → 25,826,516 (+6,048,000, +30.6%) | MEM 87,142 → 124,942 (+37,800, +43.4%) ⚠️  SIGNIFICANT CHANGE
  O3: 1,348 → 8,998 bytes (+7,650 bytes, +567.5%) ⚠️  SIGNIFICANT CHANGE
    Test 'valid_sum': CPU 17,970,516 → 23,586,516 (+5,616,000, +31.3%) | MEM 75,842 → 110,942 (+35,100, +46.3%) ⚠️  SIGNIFICANT CHANGE

Contract: liquidity_pool
Description: Simple DEX pool
----------------------------------------
  O0: 152,112 → 154,106 bytes (+1,994 bytes, +1.3%)
  O1: 47,652 → 59,794 bytes (+12,142 bytes, +25.5%) ⚠️  SIGNIFICANT CHANGE (ignored)
  O2: 47,334 → 59,456 bytes (+12,122 bytes, +25.6%) ⚠️  SIGNIFICANT CHANGE
  O3: 18,690 → 26,570 bytes (+7,880 bytes, +42.2%) ⚠️  SIGNIFICANT CHANGE

Contract: marketplace
Description: Marketplace contract with complex data structures
----------------------------------------
  O0: 124,108 → 125,476 bytes (+1,368 bytes, +1.1%)
  O1: 26,262 → 38,302 bytes (+12,040 bytes, +45.8%) ⚠️  SIGNIFICANT CHANGE (ignored)
  O2: 26,170 → 38,198 bytes (+12,028 bytes, +46.0%) ⚠️  SIGNIFICANT CHANGE
  O3: 4,854 → 12,650 bytes (+7,796 bytes, +160.6%) ⚠️  SIGNIFICANT CHANGE

Contract: gift
Description: Gift contract with simple logic
----------------------------------------
  O0: 57,426 → 58,794 bytes (+1,368 bytes, +2.4%)
    Test 'valid_withdrawal': CPU 52,052,498 → 52,388,498 (+336,000, +0.6%) | MEM 266,735 → 268,835 (+2,100, +0.8%)
  O1: 5,356 → 17,506 bytes (+12,150 bytes, +226.8%) ⚠️  SIGNIFICANT CHANGE (ignored)
    Test 'valid_withdrawal': CPU 28,788,498 → 34,980,498 (+6,192,000, +21.5%) | MEM 121,335 → 160,035 (+38,700, +31.9%) ⚠️  SIGNIFICANT CHANGE (ignored)
  O2: 5,352 → 17,486 bytes (+12,134 bytes, +226.7%) ⚠️  SIGNIFICANT CHANGE
    Test 'valid_withdrawal': CPU 28,710,012 → 34,902,012 (+6,192,000, +21.6%) | MEM 120,871 → 159,571 (+38,700, +32.0%) ⚠️  SIGNIFICANT CHANGE
  O3: 1,676 → 9,334 bytes (+7,658 bytes, +456.9%) ⚠️  SIGNIFICANT CHANGE
    Test 'valid_withdrawal': CPU 26,262,012 → 31,878,012 (+5,616,000, +21.4%) | MEM 105,571 → 140,671 (+35,100, +33.2%) ⚠️  SIGNIFICANT CHANGE

Contract: wrapped_token
Description: Dual-use contract to generate a wrapped token
----------------------------------------
  O0: 64,838 → 66,190 bytes (+1,352 bytes, +2.1%)
  O1: 9,352 → 21,524 bytes (+12,172 bytes, +130.2%) ⚠️  SIGNIFICANT CHANGE (ignored)
  O2: 9,080 → 21,230 bytes (+12,150 bytes, +133.8%) ⚠️  SIGNIFICANT CHANGE
  O3: 3,876 → 11,648 bytes (+7,772 bytes, +200.5%) ⚠️  SIGNIFICANT CHANGE

Contract: micropayments
Description: Channel for fee-less micropayments
----------------------------------------
  O0: 88,026 → 89,364 bytes (+1,338 bytes, +1.5%)
  O1: 19,894 → 31,932 bytes (+12,038 bytes, +60.5%) ⚠️  SIGNIFICANT CHANGE (ignored)
  O2: 19,820 → 31,842 bytes (+12,022 bytes, +60.7%) ⚠️  SIGNIFICANT CHANGE
  O3: 7,212 → 14,974 bytes (+7,762 bytes, +107.6%) ⚠️  SIGNIFICANT CHANGE

Total size change compared to previous release: +200,472 bytes

⚠️  SIGNIFICANT CHANGES DETECTED
Please review the changes and consider optimization if sizes or costs increased significantly.
============================================================

Please review the binary size changes. Significant increases may impact contract deployment costs and execution limits.


This report compares the binary sizes of compiled contracts against the baseline from the latest release.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 6, 2026

⚠️ Binary Size Changes Detected

Binary Size Comparison Report
Loading baseline measurements...
Measuring current binary sizes and execution costs...
Measuring assert_sum...
  O0: 55346 bytes
    Evaluating test case: valid_sum
      CPU: 44,697,759 | MEM: 242,874
  O1: 3556 bytes
    Evaluating test case: valid_sum
      CPU: 20,009,759 | MEM: 88,574
  O2: 3554 bytes
    Evaluating test case: valid_sum
      CPU: 19,970,516 | MEM: 88,342
  O3: 1368 bytes
    Evaluating test case: valid_sum
      CPU: 18,162,516 | MEM: 77,042
Measuring liquidity_pool...
Failed to compile examples/smart_contracts/liquidity_pool.py with O0: Traceback (most recent call last):
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 98, in visit
    return super().visit(node)
           ~~~~~~~~~~~~~^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 70, in visit
    return visitor(node)
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 1186, in visit_AnnAssign
    self.set_variable_type(node.target.id, InstanceType(typed_ass.annotation))
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 454, in set_variable_type
    raise TypeInferenceError(
        f"Type '{self.scopes[-1][name].python_type()}' of variable '{map_to_orig_name(name)}' in local scope does not match inferred type '{typ.python_type()}'"
    )
opshin.type_impls.TypeInferenceError: Type 'Union[]' of variable 'redeemer' in local scope does not match inferred type 'Union[AddLiquidity(CONSTR_ID=2) , RemoveLiquidity(CONSTR_ID=3) , SwapAsset(CONSTR_ID=1) , PoolUpgrade(CONSTR_ID=4) ]'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/opshin/opshin/opshin/__main__.py", line 339, in perform_command
    code = compiler.compile(
        source_ast,
    ...<3 lines>...
        config=compiler_config,
    )
  File "/home/runner/work/opshin/opshin/opshin/compiler.py", line 1256, in compile
    prog = s.visit(prog)
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 101, in visit
    raise e
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 98, in visit
    return super().visit(node)
           ~~~~~~~~~~~~~^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 70, in visit
    return visitor(node)
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 1404, in visit_Module
    tm.body = self.visit_sequence(node.body)
              ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 1074, in visit_sequence
    typed_stmts[i] = self.visit(node)
                     ~~~~~~~~~~^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 101, in visit
    raise e
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 98, in visit
    return super().visit(node)
           ~~~~~~~~~~~~~^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 70, in visit
    return visitor(node)
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 1377, in visit_FunctionDef
    tfd.body = self.visit_sequence(resolved_node.body)
               ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 1059, in visit_sequence
    stmt = self.visit(node)
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 102, in visit
    raise CompilerError(e, node, self.step)
opshin.util.CompilerError: (TypeInferenceError("Type 'Union[]' of variable 'redeemer' in local scope does not match inferred type 'Union[AddLiquidity(CONSTR_ID=2) , RemoveLiquidity(CONSTR_ID=3) , SwapAsset(CONSTR_ID=1) , PoolUpgrade(CONSTR_ID=4) ]'"), <ast.AnnAssign object at 0x7f5d0b656f90>, 'Static Type Inference')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/opshin/opshin/.venv/bin/opshin", line 10, in <module>
    sys.exit(main())
             ~~~~^^
  File "/home/runner/work/opshin/opshin/opshin/__main__.py", line 572, in main
    perform_command(args)
    ~~~~~~~~~~~~~~~^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/__main__.py", line 376, in perform_command
    raise err
  File "examples/smart_contracts/liquidity_pool.py", line 616
    redeemer: PoolAction = context.redeemer
SyntaxError: �������������TypeInferenceError: Type 'Union[]' of variable 'redeemer' in local scope does not match inferred type 'Union[AddLiquidity(CONSTR_ID=2) , RemoveLiquidity(CONSTR_ID=3) , SwapAsset(CONSTR_ID=1) , PoolUpgrade(CONSTR_ID=4) ]'
Note that opshin errors may be overly restrictive as they aim to prevent code with unintended consequences.


Traceback (most recent call last):
  File "/home/runner/work/opshin/opshin/scripts/binary_size_tracker.py", line 547, in <module>
    main()
    ~~~~^^
  File "/home/runner/work/opshin/opshin/scripts/binary_size_tracker.py", line 539, in main
    has_changes = compare_with_baseline(
        args.baseline_file, args.work_dir, args.config_file
    )
  File "/home/runner/work/opshin/opshin/scripts/binary_size_tracker.py", line 316, in compare_with_baseline
    current = measure_contract_sizes(
        config["contracts"], config["optimization_levels"], work_dir
    )
  File "/home/runner/work/opshin/opshin/scripts/binary_size_tracker.py", line 227, in measure_contract_sizes
    size = compile_contract(path, opt_level, extra_flags, work_dir)
  File "/home/runner/work/opshin/opshin/scripts/binary_size_tracker.py", line 116, in compile_contract
    raise Exception(f"Compilation failed: {stderr}")
Exception: Compilation failed: Traceback (most recent call last):
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 98, in visit
    return super().visit(node)
           ~~~~~~~~~~~~~^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 70, in visit
    return visitor(node)
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 1186, in visit_AnnAssign
    self.set_variable_type(node.target.id, InstanceType(typed_ass.annotation))
    ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 454, in set_variable_type
    raise TypeInferenceError(
        f"Type '{self.scopes[-1][name].python_type()}' of variable '{map_to_orig_name(name)}' in local scope does not match inferred type '{typ.python_type()}'"
    )
opshin.type_impls.TypeInferenceError: Type 'Union[]' of variable 'redeemer' in local scope does not match inferred type 'Union[AddLiquidity(CONSTR_ID=2) , RemoveLiquidity(CONSTR_ID=3) , SwapAsset(CONSTR_ID=1) , PoolUpgrade(CONSTR_ID=4) ]'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/opshin/opshin/opshin/__main__.py", line 339, in perform_command
    code = compiler.compile(
        source_ast,
    ...<3 lines>...
        config=compiler_config,
    )
  File "/home/runner/work/opshin/opshin/opshin/compiler.py", line 1256, in compile
    prog = s.visit(prog)
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 101, in visit
    raise e
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 98, in visit
    return super().visit(node)
           ~~~~~~~~~~~~~^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 70, in visit
    return visitor(node)
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 1404, in visit_Module
    tm.body = self.visit_sequence(node.body)
              ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 1074, in visit_sequence
    typed_stmts[i] = self.visit(node)
                     ~~~~~~~~~~^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 101, in visit
    raise e
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 98, in visit
    return super().visit(node)
           ~~~~~~~~~~~~~^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 70, in visit
    return visitor(node)
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 1377, in visit_FunctionDef
    tfd.body = self.visit_sequence(resolved_node.body)
               ~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/type_inference.py", line 1059, in visit_sequence
    stmt = self.visit(node)
  File "/home/runner/work/opshin/opshin/opshin/util.py", line 102, in visit
    raise CompilerError(e, node, self.step)
opshin.util.CompilerError: (TypeInferenceError("Type 'Union[]' of variable 'redeemer' in local scope does not match inferred type 'Union[AddLiquidity(CONSTR_ID=2) , RemoveLiquidity(CONSTR_ID=3) , SwapAsset(CONSTR_ID=1) , PoolUpgrade(CONSTR_ID=4) ]'"), <ast.AnnAssign object at 0x7f5d0b656f90>, 'Static Type Inference')

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/runner/work/opshin/opshin/.venv/bin/opshin", line 10, in <module>
    sys.exit(main())
             ~~~~^^
  File "/home/runner/work/opshin/opshin/opshin/__main__.py", line 572, in main
    perform_command(args)
    ~~~~~~~~~~~~~~~^^^^^^
  File "/home/runner/work/opshin/opshin/opshin/__main__.py", line 376, in perform_command
    raise err
  File "examples/smart_contracts/liquidity_pool.py", line 616
    redeemer: PoolAction = context.redeemer
SyntaxError: �������������TypeInferenceError: Type 'Union[]' of variable 'redeemer' in local scope does not match inferred type 'Union[AddLiquidity(CONSTR_ID=2) , RemoveLiquidity(CONSTR_ID=3) , SwapAsset(CONSTR_ID=1) , PoolUpgrade(CONSTR_ID=4) ]'
Note that opshin errors may be overly restrictive as they aim to prevent code with unintended consequences.


Please review the binary size changes. Significant increases may impact contract deployment costs and execution limits.


This report compares the binary sizes of compiled contracts against the baseline from the latest release.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Mar 7, 2026

✅ Binary Size Check Passed

Binary Size Comparison Report
Loading baseline measurements...
Measuring current binary sizes and execution costs...
Measuring assert_sum...
  O0: 54450 bytes
    Evaluating test case: valid_sum
      CPU: 44,089,759 | MEM: 239,074
  O1: 3440 bytes
    Evaluating test case: valid_sum
      CPU: 19,353,759 | MEM: 84,474
  O2: 3438 bytes
    Evaluating test case: valid_sum
      CPU: 19,314,516 | MEM: 84,242
  O3: 1296 bytes
    Evaluating test case: valid_sum
      CPU: 17,506,516 | MEM: 72,942
Measuring liquidity_pool...
  O0: 151088 bytes
  O1: 47478 bytes
  O2: 47144 bytes
  O3: 18544 bytes
Measuring marketplace...
  O0: 123448 bytes
  O1: 26036 bytes
  O2: 25940 bytes
  O3: 4708 bytes
Measuring gift...
  O0: 56918 bytes
    Evaluating test case: valid_withdrawal
      CPU: 51,588,498 | MEM: 263,835
  O1: 5256 bytes
    Evaluating test case: valid_withdrawal
      CPU: 28,276,498 | MEM: 118,135
  O2: 5252 bytes
    Evaluating test case: valid_withdrawal
      CPU: 28,198,012 | MEM: 117,671
  O3: 1614 bytes
    Evaluating test case: valid_withdrawal
      CPU: 25,702,012 | MEM: 102,071
Measuring wrapped_token...
  O0: 64204 bytes
  O1: 9186 bytes
  O2: 8906 bytes
  O3: 3770 bytes
Measuring micropayments...
  O0: 87178 bytes
  O1: 19562 bytes
  O2: 19488 bytes
  O3: 6918 bytes

============================================================
BINARY SIZE AND EXECUTION COST COMPARISON REPORT
============================================================

Contract: assert_sum
Description: Simple spending validator with assertion
----------------------------------------
  O0: 54,954 → 54,450 bytes (-504 bytes, -0.9%) ↘️ (size reduced)
    Test 'valid_sum': CPU 44,505,759 → 44,089,759 (-416,000, -0.9%) | MEM 241,674 → 239,074 (-2,600, -1.1%) ↘️ (costs reduced)
  O1: 3,536 → 3,440 bytes (-96 bytes, -2.7%) ↘️ (size reduced)
    Test 'valid_sum': CPU 19,817,759 → 19,353,759 (-464,000, -2.3%) | MEM 87,374 → 84,474 (-2,900, -3.3%) ↘️ (costs reduced)
  O2: 3,534 → 3,438 bytes (-96 bytes, -2.7%) ↘️ (size reduced)
    Test 'valid_sum': CPU 19,778,516 → 19,314,516 (-464,000, -2.3%) | MEM 87,142 → 84,242 (-2,900, -3.3%) ↘️ (costs reduced)
  O3: 1,348 → 1,296 bytes (-52 bytes, -3.9%) ↘️ (size reduced)
    Test 'valid_sum': CPU 17,970,516 → 17,506,516 (-464,000, -2.6%) | MEM 75,842 → 72,942 (-2,900, -3.8%) ↘️ (costs reduced)

Contract: liquidity_pool
Description: Simple DEX pool
----------------------------------------
  O0: 152,112 → 151,088 bytes (-1,024 bytes, -0.7%) ↘️ (size reduced)
  O1: 47,652 → 47,478 bytes (-174 bytes, -0.4%) ↘️ (size reduced)
  O2: 47,334 → 47,144 bytes (-190 bytes, -0.4%) ↘️ (size reduced)
  O3: 18,690 → 18,544 bytes (-146 bytes, -0.8%) ↘️ (size reduced)

Contract: marketplace
Description: Marketplace contract with complex data structures
----------------------------------------
  O0: 124,108 → 123,448 bytes (-660 bytes, -0.5%) ↘️ (size reduced)
  O1: 26,262 → 26,036 bytes (-226 bytes, -0.9%) ↘️ (size reduced)
  O2: 26,170 → 25,940 bytes (-230 bytes, -0.9%) ↘️ (size reduced)
  O3: 4,854 → 4,708 bytes (-146 bytes, -3.0%) ↘️ (size reduced)

Contract: gift
Description: Gift contract with simple logic
----------------------------------------
  O0: 57,426 → 56,918 bytes (-508 bytes, -0.9%) ↘️ (size reduced)
    Test 'valid_withdrawal': CPU 52,052,498 → 51,588,498 (-464,000, -0.9%) | MEM 266,735 → 263,835 (-2,900, -1.1%) ↘️ (costs reduced)
  O1: 5,356 → 5,256 bytes (-100 bytes, -1.9%) ↘️ (size reduced)
    Test 'valid_withdrawal': CPU 28,788,498 → 28,276,498 (-512,000, -1.8%) | MEM 121,335 → 118,135 (-3,200, -2.6%) ↘️ (costs reduced)
  O2: 5,352 → 5,252 bytes (-100 bytes, -1.9%) ↘️ (size reduced)
    Test 'valid_withdrawal': CPU 28,710,012 → 28,198,012 (-512,000, -1.8%) | MEM 120,871 → 117,671 (-3,200, -2.6%) ↘️ (costs reduced)
  O3: 1,676 → 1,614 bytes (-62 bytes, -3.7%) ↘️ (size reduced)
    Test 'valid_withdrawal': CPU 26,262,012 → 25,702,012 (-560,000, -2.1%) | MEM 105,571 → 102,071 (-3,500, -3.3%) ↘️ (costs reduced)

Contract: wrapped_token
Description: Dual-use contract to generate a wrapped token
----------------------------------------
  O0: 64,838 → 64,204 bytes (-634 bytes, -1.0%) ↘️ (size reduced)
  O1: 9,352 → 9,186 bytes (-166 bytes, -1.8%) ↘️ (size reduced)
  O2: 9,080 → 8,906 bytes (-174 bytes, -1.9%) ↘️ (size reduced)
  O3: 3,876 → 3,770 bytes (-106 bytes, -2.7%) ↘️ (size reduced)

Contract: micropayments
Description: Channel for fee-less micropayments
----------------------------------------
  O0: 88,026 → 87,178 bytes (-848 bytes, -1.0%) ↘️ (size reduced)
  O1: 19,894 → 19,562 bytes (-332 bytes, -1.7%) ↘️ (size reduced)
  O2: 19,820 → 19,488 bytes (-332 bytes, -1.7%) ↘️ (size reduced)
  O3: 7,212 → 6,918 bytes (-294 bytes, -4.1%) ↘️ (size reduced)

Total size change compared to previous release: -7,200 bytes

✅ No significant changes detected
============================================================

No significant binary size changes were detected in this PR.


This report compares the binary sizes of compiled contracts against the baseline from the latest release.

nielstron added 13 commits March 9, 2026 14:33
- Extend `PLUTUS_VM_PROFILE` test deadline from 2s to 4s in `tests/__init__.py`
- Reduces spurious timeouts for slower Plutus VM test runs
- build an index of function types by `function_id` during module compilation
- resolve call/dunder function instance types against refreshed function definitions
- re-thread function-valued bindings through statement sequences in closure rewrite pass
- Reassign `InstanceType(FunctionType)` references using `function_id` after closure rewriting
- Update closure optimization to rewrite node and dunder override function types consistently
- Simplify compiler call/dunder typing to rely on canonicalized function instance types
- Seed function types with closure placeholders during inference for stable recursive/forward references
- Resolve `bind_self` from actual self-reads in closure rewrite instead of pre-inference guesses
- Add closure rewrite assertions for unresolved placeholders and incompatible function redefinitions
@nielstron nielstron merged commit 032e24f into dev Mar 10, 2026
21 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant