Repository navigation
Commit c21017a
committed
fix: bug audit — 11 bugs found, 10 fixed
BUG 1 (Critical): Match wildcard '_' not-last arm produced dead code.
- Type checker now rejects '_' that is not the last match arm
(src/types/mod.rs:check_match_patterns)
- IR lowering defense-in-depth: break after wildcard arm to prevent
overwriting check_block terminator (src/ir/mod.rs:lower_match_expr)
BUG 2 (High): numeric_types_equal was non-commutative.
- The matches! guard only checked the first Named binding, making
Named('isize') vs Named('foo') asymmetric.
- Split into two separate matches! arms for commutativity.
BUG 3 (High): is_primitive_compat_014/is_primitive_strict inconsistent.
- is_primitive_strict() accepted '0.16'/'0.17'/'0.18' but validator
only allows '0.14'/'0.15'. is_primitive_compat_014() used != which
was true for all non-0.15 values.
- Fixed both to match the validator's allowed values.
BUG 4 (Medium): incremental_cache_hit always returned None.
- Replaced misleading if/else returning None with a single path and
clear documentation that the cache cannot yet return a full
CompileResult.
BUG 6 (Medium): min_witness_bytes hardcoded to ENTRY_WITNESS_ABI_MAGIC.len().
- Now computed as the minimum across all entry ABIs, matching
max_entry_witness_bytes which was already correctly computed.
BUG 7 (Medium): Unvalidated env vars for CKB limits.
- Added log::warn when env overrides produce zero values.
BUG 8 (Medium): Tuple metadata dropped fields at index >= 8.
- Removed the index < 8 restriction so metadata is complete; the
ABI register limit is documented in a comment.
BUG 10 (Low): ByteString always inferred as [u8; 0].
- Now uses the actual byte length from the AST.
BUG 11 (Low): Error message hardcoded --primitive-strict=0.15.
- Changed to version-neutral 'strict primitive mode'.
BUG 5 (design choice) and BUG 9 (low-probability) documented but
not changed — BUG 5 is the current schema contract and BUG 9 is
low-probability artifact corruption.1 parent be0ae55 commit c21017a
3 files changed
Lines changed: 60 additions & 20 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4120 | 4120 | | |
4121 | 4121 | | |
4122 | 4122 | | |
| 4123 | + | |
| 4124 | + | |
| 4125 | + | |
| 4126 | + | |
| 4127 | + | |
| 4128 | + | |
| 4129 | + | |
| 4130 | + | |
| 4131 | + | |
| 4132 | + | |
| 4133 | + | |
| 4134 | + | |
| 4135 | + | |
| 4136 | + | |
| 4137 | + | |
| 4138 | + | |
4123 | 4139 | | |
4124 | 4140 | | |
4125 | 4141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
61 | | - | |
| 61 | + | |
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | 66 | | |
67 | | - | |
| 67 | + | |
68 | 68 | | |
69 | 69 | | |
70 | 70 | | |
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
976 | 976 | | |
977 | 977 | | |
978 | 978 | | |
| 979 | + | |
979 | 980 | | |
980 | 981 | | |
981 | 982 | | |
982 | 983 | | |
983 | 984 | | |
984 | | - | |
| 985 | + | |
985 | 986 | | |
986 | 987 | | |
987 | 988 | | |
| |||
1116 | 1117 | | |
1117 | 1118 | | |
1118 | 1119 | | |
| 1120 | + | |
1119 | 1121 | | |
1120 | 1122 | | |
1121 | 1123 | | |
1122 | 1124 | | |
1123 | 1125 | | |
| 1126 | + | |
| 1127 | + | |
| 1128 | + | |
| 1129 | + | |
| 1130 | + | |
| 1131 | + | |
| 1132 | + | |
| 1133 | + | |
| 1134 | + | |
1124 | 1135 | | |
1125 | 1136 | | |
1126 | 1137 | | |
| |||
1200 | 1211 | | |
1201 | 1212 | | |
1202 | 1213 | | |
1203 | | - | |
| 1214 | + | |
1204 | 1215 | | |
1205 | 1216 | | |
1206 | 1217 | | |
| |||
3933 | 3944 | | |
3934 | 3945 | | |
3935 | 3946 | | |
3936 | | - | |
| 3947 | + | |
| 3948 | + | |
| 3949 | + | |
| 3950 | + | |
3937 | 3951 | | |
| 3952 | + | |
| 3953 | + | |
3938 | 3954 | | |
3939 | 3955 | | |
3940 | 3956 | | |
| |||
3945 | 3961 | | |
3946 | 3962 | | |
3947 | 3963 | | |
3948 | | - | |
3949 | | - | |
3950 | | - | |
3951 | | - | |
3952 | | - | |
3953 | | - | |
3954 | | - | |
3955 | | - | |
| 3964 | + | |
| 3965 | + | |
| 3966 | + | |
| 3967 | + | |
3956 | 3968 | | |
3957 | 3969 | | |
3958 | 3970 | | |
| |||
11477 | 11489 | | |
11478 | 11490 | | |
11479 | 11491 | | |
11480 | | - | |
| 11492 | + | |
| 11493 | + | |
| 11494 | + | |
| 11495 | + | |
11481 | 11496 | | |
11482 | 11497 | | |
11483 | 11498 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2724 | 2724 | | |
2725 | 2725 | | |
2726 | 2726 | | |
2727 | | - | |
| 2727 | + | |
2728 | 2728 | | |
2729 | 2729 | | |
2730 | 2730 | | |
| |||
3425 | 3425 | | |
3426 | 3426 | | |
3427 | 3427 | | |
3428 | | - | |
| 3428 | + | |
3429 | 3429 | | |
| 3430 | + | |
| 3431 | + | |
| 3432 | + | |
| 3433 | + | |
| 3434 | + | |
| 3435 | + | |
3430 | 3436 | | |
3431 | 3437 | | |
3432 | 3438 | | |
| |||
5270 | 5276 | | |
5271 | 5277 | | |
5272 | 5278 | | |
5273 | | - | |
5274 | | - | |
5275 | | - | |
| 5279 | + | |
5276 | 5280 | | |
5277 | 5281 | | |
| 5282 | + | |
| 5283 | + | |
| 5284 | + | |
| 5285 | + | |
| 5286 | + | |
5278 | 5287 | | |
5279 | 5288 | | |
5280 | 5289 | | |
| |||
0 commit comments