|
| 1 | +# 0.25 to 0.30 syntax compatibility audit |
| 2 | + |
| 3 | +The 2026 edition retains the checked source meaning of 0.25. New 2027 authoring |
| 4 | +forms remain opt-in. Compiler requirements, package locks, source editions, |
| 5 | +and artifact compatibility are separate axes; accepting old source does not |
| 6 | +promise identical ELF bytes across compiler releases. |
| 7 | + |
| 8 | +## Comparison boundary |
| 9 | + |
| 10 | +The audit compared tag `v0.25.0` (`3b481eb019a1fdc358d4efbe8340d28d3e6a9441`) |
| 11 | +with the pre-fix 0.30 candidate `9007851852072f6757686bdea2abfb79d87269c2`. |
| 12 | +The original 0.25 compiler was built from that exact source archive. Of 86 |
| 13 | +historical source samples compiled outside their original package contexts, |
| 14 | +52 compiled with 0.25 and all 52 also compiled with the candidate. This is a |
| 15 | +bounded acceptance comparison, not a proof of semantic equivalence for all |
| 16 | +programs. Package-context failures from old lock schemas were classified |
| 17 | +separately; intentional repinning uses `cellc lock` or `cellc update`. The same |
| 18 | +86-source comparison was repeated after the fixes: all 52 old-accepted sources |
| 19 | +still compile. The exact original 0.25 compiler also successfully generated |
| 20 | +ELF from the historical generic seed after formatting with the fixed compiler. |
| 21 | + |
| 22 | +Targeted examples exposed three gaps that the broad historical sample did not |
| 23 | +cover. The regression tests now enforce the following boundaries. |
| 24 | + |
| 25 | +## Public generic declarations |
| 26 | + |
| 27 | +This 0.25 program remains valid in edition 2026: |
| 28 | + |
| 29 | +```cellscript |
| 30 | +module legacy |
| 31 | +struct Box<T: copy> has copy { value: T } |
| 32 | +action main() -> u64 { |
| 33 | + verification |
| 34 | + let value: Box<u64> = Box<u64> { value: 7 } |
| 35 | + return value.value |
| 36 | +} |
| 37 | +``` |
| 38 | + |
| 39 | +Unconstrained public templates remain accepted in 2026 as well. Concrete |
| 40 | +specializations still enforce declared abilities, bounded monomorphization, |
| 41 | +layout validity, phantom restrictions, and the prohibition on hiding Cells. |
| 42 | +Edition 2027 requires public non-phantom layout parameters to declare `fixed`, |
| 43 | +`serializable`, and `non_linear`. This stricter rule belongs to the template |
| 44 | +owner's edition, including imports across editions. |
| 45 | + |
| 46 | +The compiler, canonical interface validator, Registry API, and independent |
| 47 | +artifact checker agree on this distinction. Current interface editions must |
| 48 | +match their enclosing metadata or publication record. Registry publication |
| 49 | +continues to accept only its existing supported edition; this fix does not |
| 50 | +expand Registry admission to preview packages. |
| 51 | + |
| 52 | +## Full Script hashes in native lifecycle syntax |
| 53 | + |
| 54 | +Both ordinary replacement relations and native `type_script` lifecycle |
| 55 | +clauses accept `ScriptHash` for `exact_hash(...)`. Native replacement, pool, |
| 56 | +and fresh-output paths share the fixed 32-byte hash representation. Existing |
| 57 | +native-preview `Address` and `Hash` arguments remain compatibility inputs. |
| 58 | +Ordinary replacement relations retain their stricter nominal-domain check: |
| 59 | +use `ckb::script_hash(hash)` when explicitly interpreting a trusted raw `Hash` |
| 60 | +as a complete Script hash. No arbitrary integer or unrelated nominal value |
| 61 | +is accepted as a lock hash. |
| 62 | + |
| 63 | +The native witness builder uses `EntryWitnessArg::Bytes` for the nominal |
| 64 | +`ScriptHash` value, with exactly 32 bytes. This matches the existing nominal |
| 65 | +fixed-byte encoding rather than introducing a new wire ABI. Real CKB-VM tests |
| 66 | +exercise typed fresh outputs and replacement group binding. |
| 67 | + |
| 68 | +## Formatting is not a source migration |
| 69 | + |
| 70 | +`cellc fmt` preserves expanded generic constraints and explicit `has` clauses. |
| 71 | +If the source already uses `fixed_value`, it keeps that compact spelling. |
| 72 | +Formatting does not introduce `fixed_value` into a 0.25-compatible file or |
| 73 | +remove an explicit ability declaration that an older compiler needs. Compact |
| 74 | +and expanded constraints still produce the same canonical interface identity. |
| 75 | +This applies to the shared formatter used by CLI and editor consumers. |
| 76 | + |
| 77 | +Opting into new shorthand or inferred abilities is an intentional source |
| 78 | +change. It requires a compatible compiler requirement; formatting alone does |
| 79 | +not change that requirement or repin a package. |
| 80 | + |
| 81 | +## Regression evidence |
| 82 | + |
| 83 | +- `tests/syntax_compatibility.rs`: legacy declarations, strict 2027 rejection, |
| 84 | + formatter stability and interface identity, native hash-domain acceptance. |
| 85 | +- `compile_file_monomorphizes_imported_generic_types_and_functions_in_their_owner_module`: |
| 86 | + dependency-owned contracts across both importer/owner edition directions. |
| 87 | +- `tests/native_group_binding.rs` and `tests/native_lifecycle_binding.rs`: |
| 88 | + actual CKB-VM typed lock-hash execution and adversarial transaction shapes. |
| 89 | +- Interface, independent checker, Registry, and WASM tests cover the consumer |
| 90 | + boundaries; the syntax matrix includes a nominal ScriptHash native seed. |
| 91 | + |
| 92 | +Local gate results are recorded with the implementing change. Branch pushes |
| 93 | +are separate from publication: this work creates no release tag, invokes no |
| 94 | +Release workflow, and does not publish packages or trigger TAC. |
0 commit comments