Commit 80ba314
feat(verify): Tier-2 access-typing self-certification (per-site type/width/offset)
The L2 verifier now independently DECODES the code section and checks that each
pinned access site lands on a load/store of the target field's exact type,
width, and static offset, in-region — discharging proposal 0002's deferred
`AccessSiteMisalignment` at decode time, with zero producer trust.
Producer (codegen):
- AccessSite.offset:u32 -> instr_index:Option<usize>: a site pins the body
instruction index of its load/store, or None for declared-only.
- emit() writes the pinned index (or the ACCESS_SITE_UNPINNED sentinel) into
the access-sites carrier; the parser's real reader/writer lowering pins
Some(1)/Some(2); the 15 hand-written example01/paint-type sites become
declared-only (honestly not type-checked).
Verifier (typed-wasm-verify):
- verify_access_typing_from_module + AccessTypingReport { type_verified,
declared_only, errors }; AccessTypingError variants (type/offset mismatch,
not-a-memory-op, index/region out of range, unresolvable).
- WasmTy::byte_width(); the field-offset recompute mirrors codegen
resolve_field (the T4 layout-equivalence lemma will prove they agree).
- tw-verify prints "L2 access typing: N type-verified, M declared-only" so the
assurance mode is knowable to anyone reading the output.
Tests (tests/access_typing.rs): real lowering type-verifies (3/3); example01 is
reported declared-only (6); five teeth (wrong width/offset, non-memory op,
index OOB, out-of-region) each rejected with the matching variant; plus a
correct-control. Mutation-checked: a width-blind verifier fails the width
teeth. No regression across the existing 153-test suite.
Docs: PROOF-NEEDS.md gains the codegen->verified-wasm assurance-ladder
reconciliation (T1 execution gate landed, T2 here, T3-T5 open).
Notes:
- Corrected pre-existing owner-Copyright header drift on
verify.rs/section.rs/lib.rs under one-time owner authorization; the strict
pre-commit hook is retained.
- One pre-existing clippy collapsible_match in verify_from_module's
MemorySection arm is left for the separate lint chore PR.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent fd788c4 commit 80ba314
8 files changed
Lines changed: 896 additions & 28 deletions
File tree
- crates
- typed-wasm-codegen
- src
- tests
- typed-wasm-verify/src
- bin
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
26 | 73 | | |
27 | 74 | | |
28 | 75 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
35 | 35 | | |
36 | 36 | | |
37 | 37 | | |
38 | | - | |
| 38 | + | |
39 | 39 | | |
40 | 40 | | |
41 | 41 | | |
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
272 | | - | |
273 | | - | |
| 272 | + | |
| 273 | + | |
274 | 274 | | |
275 | 275 | | |
276 | 276 | | |
277 | 277 | | |
278 | 278 | | |
279 | 279 | | |
280 | | - | |
281 | | - | |
282 | | - | |
283 | | - | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
284 | 288 | | |
285 | 289 | | |
286 | 290 | | |
| |||
444 | 448 | | |
445 | 449 | | |
446 | 450 | | |
447 | | - | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
448 | 457 | | |
449 | 458 | | |
450 | 459 | | |
| |||
582 | 591 | | |
583 | 592 | | |
584 | 593 | | |
585 | | - | |
| 594 | + | |
586 | 595 | | |
587 | 596 | | |
588 | 597 | | |
| |||
595 | 604 | | |
596 | 605 | | |
597 | 606 | | |
598 | | - | |
| 607 | + | |
599 | 608 | | |
600 | 609 | | |
601 | 610 | | |
| |||
610 | 619 | | |
611 | 620 | | |
612 | 621 | | |
613 | | - | |
| 622 | + | |
614 | 623 | | |
615 | 624 | | |
616 | 625 | | |
617 | 626 | | |
618 | | - | |
| 627 | + | |
619 | 628 | | |
620 | 629 | | |
621 | 630 | | |
| |||
629 | 638 | | |
630 | 639 | | |
631 | 640 | | |
632 | | - | |
| 641 | + | |
633 | 642 | | |
634 | 643 | | |
635 | 644 | | |
| |||
646 | 655 | | |
647 | 656 | | |
648 | 657 | | |
649 | | - | |
| 658 | + | |
650 | 659 | | |
651 | 660 | | |
652 | 661 | | |
| |||
745 | 754 | | |
746 | 755 | | |
747 | 756 | | |
748 | | - | |
| 757 | + | |
749 | 758 | | |
750 | 759 | | |
751 | 760 | | |
| |||
761 | 770 | | |
762 | 771 | | |
763 | 772 | | |
764 | | - | |
| 773 | + | |
765 | 774 | | |
766 | 775 | | |
767 | 776 | | |
| |||
781 | 790 | | |
782 | 791 | | |
783 | 792 | | |
784 | | - | |
| 793 | + | |
785 | 794 | | |
786 | 795 | | |
787 | 796 | | |
| |||
796 | 805 | | |
797 | 806 | | |
798 | 807 | | |
799 | | - | |
| 808 | + | |
800 | 809 | | |
801 | 810 | | |
802 | 811 | | |
| |||
888 | 897 | | |
889 | 898 | | |
890 | 899 | | |
891 | | - | |
892 | | - | |
893 | | - | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
894 | 903 | | |
895 | 904 | | |
896 | 905 | | |
| |||
905 | 914 | | |
906 | 915 | | |
907 | 916 | | |
908 | | - | |
| 917 | + | |
909 | 918 | | |
910 | 919 | | |
911 | 920 | | |
| |||
921 | 930 | | |
922 | 931 | | |
923 | 932 | | |
924 | | - | |
| 933 | + | |
925 | 934 | | |
926 | 935 | | |
927 | 936 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
764 | 764 | | |
765 | 765 | | |
766 | 766 | | |
767 | | - | |
| 767 | + | |
| 768 | + | |
768 | 769 | | |
769 | 770 | | |
770 | 771 | | |
| |||
847 | 848 | | |
848 | 849 | | |
849 | 850 | | |
850 | | - | |
| 851 | + | |
| 852 | + | |
851 | 853 | | |
852 | 854 | | |
853 | 855 | | |
| |||
0 commit comments