guppylang icon indicating copy to clipboard operation
guppylang copied to clipboard

feat!: Validate signatures against wasm file

Open croyzor opened this issue 3 weeks ago • 4 comments

Resolves #1093

BREAKING CHANGE:

  • The @wasm_module decorator now raises a compile time error unless it points to a matching .wasm file in the users filesystem
  • @wasm functions raise errors unless they match the corresponding functions in the .wasm file
  • Redo the FirstArgNotModule error class, which is used for WASM errors

croyzor avatar Nov 11 '25 15:11 croyzor

🐰 Bencher Report

Branchcr/wasm-validation
TestbedLinux
Click to view all benchmark results
BenchmarkLatencyBenchmark Result
microseconds (µs)
(Result Δ%)
Upper Boundary
microseconds (µs)
(Limit %)
tests/benchmarks/test_big_array.py::test_big_array_check📈 view plot
🚷 view threshold
666,636.75 µs
(-8.01%)Baseline: 724,696.70 µs
760,931.54 µs
(87.61%)
tests/benchmarks/test_big_array.py::test_big_array_compile📈 view plot
🚷 view threshold
1,549,056.21 µs
(+1.26%)Baseline: 1,529,801.08 µs
1,606,291.13 µs
(96.44%)
tests/benchmarks/test_big_array.py::test_big_array_executable📈 view plot
🚷 view threshold
7,290,417.46 µs
(+1.29%)Baseline: 7,197,522.87 µs
7,557,399.01 µs
(96.47%)
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_check📈 view plot
🚷 view threshold
48,547.71 µs
(-35.96%)Baseline: 75,811.73 µs
79,602.32 µs
(60.99%)
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile📈 view plot
🚷 view threshold
88,358.79 µs
(+1.32%)Baseline: 87,208.44 µs
91,568.87 µs
(96.49%)
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_executable📈 view plot
🚷 view threshold
592,629.06 µs
(+0.04%)Baseline: 592,365.66 µs
621,983.94 µs
(95.28%)
tests/benchmarks/test_prelude.py::test_import_guppy📈 view plot
🚷 view threshold
48.67 µs
(-1.68%)Baseline: 49.50 µs
51.98 µs
(93.64%)
🐰 View full continuous benchmarking report in Bencher

github-actions[bot] avatar Nov 11 '25 15:11 github-actions[bot]

🐰 Bencher Report

Branchcr/wasm-validation
TestbedLinux
Click to view all benchmark results
Benchmarkhugr_bytesBenchmark Result
bytes x 1e3
(Result Δ%)
Upper Boundary
bytes x 1e3
(Limit %)
hugr_nodesBenchmark Result
nodes
(Result Δ%)
Upper Boundary
nodes
(Limit %)
tests/benchmarks/test_big_array.py::test_big_array_compile📈 view plot
🚷 view threshold
143.67 x 1e3
(0.00%)Baseline: 143.67 x 1e3
145.10 x 1e3
(99.01%)
📈 view plot
🚷 view threshold
6,590.00
(0.00%)Baseline: 6,590.00
6,655.90
(99.01%)
tests/benchmarks/test_ctrl_flow.py::test_many_ctrl_flow_compile📈 view plot
🚷 view threshold
21.64 x 1e3
(0.00%)Baseline: 21.64 x 1e3
21.86 x 1e3
(99.01%)
📈 view plot
🚷 view threshold
606.00
(0.00%)Baseline: 606.00
612.06
(99.01%)
🐰 View full continuous benchmarking report in Bencher

github-actions[bot] avatar Nov 11 '25 15:11 github-actions[bot]

Codecov Report

:white_check_mark: All modified and coverable lines are covered by tests. :white_check_mark: Project coverage is 93.54%. Comparing base (bae0da1) to head (4f929ba). :warning: Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1339      +/-   ##
==========================================
+ Coverage   93.45%   93.54%   +0.08%     
==========================================
  Files         125      126       +1     
  Lines       11278    11395     +117     
==========================================
+ Hits        10540    10659     +119     
+ Misses        738      736       -2     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

codecov-commenter avatar Nov 11 '25 17:11 codecov-commenter

This PR contains breaking changes to the public Python API.

Breaking changes summary
guppylang-internals/src/guppylang_internals/checker/errors/wasm.py:15: FirstArgNotModule.span_label:
Attribute value was changed:
Old: 'First argument to WASM function should be a reference to a WASM module. Found `{ty}` instead'
New: 'First argument to WASM function should be a WASM module.'

guppylang-internals/src/guppylang_internals/checker/errors/wasm.py:0: FirstArgNotModule.ty:
Public object was removed

guppylang-internals/src/guppylang_internals/checker/errors/wasm.py:0: FirstArgNotModule.__init__(ty):
Parameter was removed


hugrbot avatar Nov 24 '25 11:11 hugrbot