mirror of
https://github.com/logos-blockchain/lez-programs.git
synced 2026-06-28 11:10:08 +00:00
The IDL `types` array was emitted in HashMap iteration order by spel-framework-core, which is non-deterministic across processes. Two independent regenerations of the same source could therefore disagree on type ordering, producing different bytes. This is what makes the check-idl CI job flaky: a PR's committed IDL is generated locally with one ordering, but CI regenerates with a different ordering and the diff fails — including PRs that were green when posted then breaking main after merge. Sort the top-level `types` array by name before serializing so output is byte-stable regardless of where idl-gen runs. Enable serde_json's `preserve_order` feature so the Value round-trip preserves struct-field key order (otherwise all keys would alphabetize and churn every artifact). Only top-level `types` was unstable; variants and fields already follow source order. Committed artifacts are unchanged — they happened to already be in sorted order.
22 lines
536 B
TOML
22 lines
536 B
TOML
[package]
|
|
name = "idl-gen"
|
|
version = "0.1.0"
|
|
edition = "2021"
|
|
|
|
[lints]
|
|
workspace = true
|
|
|
|
[[bin]]
|
|
name = "idl-gen"
|
|
path = "src/main.rs"
|
|
|
|
[dependencies]
|
|
spel-framework-core = { git = "https://github.com/logos-co/spel.git", tag = "v0.3.0", features = [
|
|
"idl-gen",
|
|
] }
|
|
# `preserve_order` keeps object keys in struct-declaration order when
|
|
# round-tripping through serde_json::Value (see main.rs), so the only
|
|
# reordering we apply is sorting the `types` array.
|
|
serde_json = { version = "1.0", features = ["preserve_order"] }
|
|
toml = "0.8"
|