Skip to content

feat: Candid interface compatibility checks#339

Merged
rvanasa merged 57 commits into
mainfrom
check-candid-command
Nov 20, 2025
Merged

feat: Candid interface compatibility checks#339
rvanasa merged 57 commits into
mainfrom
check-candid-command

Conversation

@rvanasa

@rvanasa rvanasa commented Nov 15, 2025

Copy link
Copy Markdown
Contributor
  • Configures Rust Wasm bindings to use the service_compatible function from the candid_parser Rust crate.
  • Adds mops check-candid <new-candid> <original-candid> to compare two Candid files.
  • Includes a way to verify that a Motoko program canister matches a Candid file when running mops build.

Usage via mops check-candid:

mops check-candid new_interface.did original_interface.did

Usage via mops build:

mops.toml:

[canisters.my_canister]
main = "src/MyCanister.mo"
candid = "candid/my_canister.did"
mops build

@rvanasa rvanasa changed the title feat: check-candid subcommand feat: Candid interface compatibility checks Nov 17, 2025
@github-actions

github-actions Bot commented Nov 19, 2025

Copy link
Copy Markdown
Contributor

Benchmark Results

bench/1-buffer-vector-add.bench.mo $({\color{green}-8.40\%})$

Add (second)

Add items one-by-one (second)

Instructions: ${\color{green}-8.40\%}$
Heap: ${\color{gray}0\%}$
Stable Memory: ${\color{gray}0\%}$
Garbage Collection: ${\color{gray}0\%}$

Instructions

10 10000 1000000
Buffer 9_493 $({\color{green}-30.14\%})$ 5_687_530 $({\color{green}-8.33\%})$ 525_783_824 $({\color{green}-8.25\%})$
Vector 13_461 $({\color{red}+17.91\%})$ 4_378_548 $({\color{green}-10.82\%})$ 417_864_434 $({\color{green}-10.74\%})$

Heap

10 10000 1000000
Buffer 272 B $({\color{gray}0\%})$ 272 B $({\color{gray}0\%})$ 272 B $({\color{gray}0\%})$
Vector 272 B $({\color{gray}0\%})$ 272 B $({\color{gray}0\%})$ 272 B $({\color{gray}0\%})$

Garbage Collection

10 10000 1000000
Buffer 1.09 KiB $({\color{gray}0\%})$ 143.28 KiB $({\color{gray}0\%})$ 12.02 MiB $({\color{gray}0\%})$
Vector 1.09 KiB $({\color{gray}0\%})$ 45.65 KiB $({\color{gray}0\%})$ 3.86 MiB $({\color{gray}0\%})$
bench/2-vector-buffer-add.bench.mo $({\color{green}-10.20\%})$

Add

Add items one-by-one

Instructions: ${\color{green}-10.20\%}$
Heap: ${\color{gray}0\%}$
Stable Memory: ${\color{gray}0\%}$
Garbage Collection: ${\color{gray}0\%}$

Instructions

10 10000 1000000
Vector 13_461 $({\color{green}-12.68\%})$ 4_378_902 $({\color{green}-10.82\%})$ 417_886_028 $({\color{green}-10.74\%})$
Buffer 9_493 $({\color{green}-10.35\%})$ 5_686_822 $({\color{green}-8.33\%})$ 525_780_992 $({\color{green}-8.25\%})$

Heap

10 10000 1000000
Vector 272 B $({\color{gray}0\%})$ 272 B $({\color{gray}0\%})$ 272 B $({\color{gray}0\%})$
Buffer 272 B $({\color{gray}0\%})$ 272 B $({\color{gray}0\%})$ 272 B $({\color{gray}0\%})$

Garbage Collection

10 10000 1000000
Vector 1.09 KiB $({\color{gray}0\%})$ 45.65 KiB $({\color{gray}0\%})$ 3.86 MiB $({\color{gray}0\%})$
Buffer 1.09 KiB $({\color{gray}0\%})$ 143.28 KiB $({\color{gray}0\%})$ 12.02 MiB $({\color{gray}0\%})$
bench/array.bench.mo $({\color{green}-18.10\%})$

Array

arr arr

Instructions: ${\color{green}-18.10\%}$
Heap: ${\color{gray}0\%}$
Stable Memory: ${\color{gray}0\%}$
Garbage Collection: ${\color{gray}0\%}$

Instructions

100k x1 reset1 100k x3 reset2 100k x4 reset3
Array 13_502_032 $({\color{green}-10.00\%})$ 3_271 $({\color{green}-26.58\%})$ 27_003_206 $({\color{green}-10.00\%})$ 3_745 $({\color{green}-26.18\%})$ 54_004_063 $({\color{green}-10.00\%})$ 4_219 $({\color{green}-25.87\%})$

Heap

100k x1 reset1 100k x3 reset2 100k x4 reset3
Array 390.9 KiB $({\color{gray}0\%})$ -390.37 KiB $({\color{gray}0\%})$ 390.9 KiB $({\color{gray}0\%})$ -390.37 KiB $({\color{gray}0\%})$ 390.9 KiB $({\color{gray}0\%})$ -390.37 KiB $({\color{gray}0\%})$

Garbage Collection

100k x1 reset1 100k x3 reset2 100k x4 reset3
Array 360 B $({\color{gray}0\%})$ 390.97 KiB $({\color{gray}0\%})$ 391 KiB $({\color{gray}0\%})$ 390.97 KiB $({\color{gray}0\%})$ 1.14 MiB $({\color{gray}0\%})$ 390.97 KiB $({\color{gray}0\%})$
bench/removeLast.bench.mo $({\color{green}-10.90\%})$

Remove items using removeLast

Vector and buffer are initialized with 100k items and then 70k items are removed one-by-one.

Instructions: ${\color{green}-10.90\%}$
Heap: ${\color{gray}0\%}$
Stable Memory: ${\color{gray}0\%}$
Garbage Collection: ${\color{gray}0\%}$

Instructions

remove 70k
Vector 27_707_652 $({\color{green}-13.98\%})$
Buffer 29_236_913 $({\color{green}-7.82\%})$

Heap

remove 70k
Vector -136.8 KiB $({\color{gray}0\%})$
Buffer -269.76 KiB $({\color{gray}0\%})$

Garbage Collection

remove 70k
Vector 139.45 KiB $({\color{gray}0\%})$
Buffer 540.43 KiB $({\color{gray}0\%})$
bench/stable-memory.bench.mo $({\color{green}-134.72\%})$

Stable Memory and Region

Grow Region and store blobs in it

Instructions: ${\color{green}-67.65\%}$
Heap: ${\color{green}-6.10\%}$
Stable Memory: ${\color{gray}0\%}$
Garbage Collection: ${\color{green}-60.97\%}$

Instructions

Region (fill 1/100) Region (fill 1/50) StableMemory
10 pages 2_626_941 $({\color{green}-95.97\%})$ 10_496_174 $({\color{green}-95.97\%})$ 2_629 $({\color{green}-8.11\%})$
100 pages 52_466_841 $({\color{green}-95.97\%})$ 104_914_378 $({\color{green}-95.97\%})$ 2_634 $({\color{green}-10.83\%})$
256 pages 134_273_822 $({\color{green}-95.97\%})$ 268_575_319 $({\color{green}-95.97\%})$ 3_182 $({\color{green}-14.09\%})$

Heap

Region (fill 1/100) Region (fill 1/50) StableMemory
10 pages 272 B $({\color{green}-8.11\%})$ 272 B $({\color{gray}0\%})$ 276 B $({\color{gray}0\%})$
100 pages 272 B $({\color{green}-11.69\%})$ 272 B $({\color{green}-11.69\%})$ 272 B $({\color{gray}0\%})$
256 pages 272 B $({\color{green}-11.69\%})$ 272 B $({\color{green}-11.69\%})$ 276 B $({\color{gray}0\%})$

Garbage Collection

Region (fill 1/100) Region (fill 1/50) StableMemory
10 pages 208.34 KiB $({\color{green}-91.44\%})$ 832.38 KiB $({\color{green}-91.45\%})$ 336 B $({\color{gray}0\%})$
100 pages 4.06 MiB $({\color{green}-91.46\%})$ 8.13 MiB $({\color{green}-91.46\%})$ 340 B $({\color{gray}0\%})$
256 pages 10.4 MiB $({\color{green}-91.46\%})$ 20.8 MiB $({\color{green}-91.46\%})$ 340 B $({\color{gray}0\%})$

Stable Memory

Region (fill 1/100) Region (fill 1/50) StableMemory
10 pages 8 MiB $({\color{gray}0\%})$ 8 MiB $({\color{gray}0\%})$ 8 MiB $({\color{gray}0\%})$
100 pages 8 MiB $({\color{gray}0\%})$ 8 MiB $({\color{gray}0\%})$ 0 B $({\color{gray}0\%})$
256 pages 16 MiB $({\color{gray}0\%})$ 16 MiB $({\color{gray}0\%})$ 16 MiB $({\color{gray}0\%})$

@rvanasa rvanasa marked this pull request as ready for review November 20, 2025 17:01
@rvanasa rvanasa merged commit f6e03bf into main Nov 20, 2025
23 checks passed
@rvanasa rvanasa deleted the check-candid-command branch November 20, 2025 17:21
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.

2 participants