Input & Integration
IDL / JSON Input
What layoutd reads, and how to produce the two version files.
What layoutd reads
layoutd’s primary input is the Anchor IDL JSON — the same IDL your program already emits. You provide two versions of it and select which account to compare with --account <Name>. For zero-copy structs where the IDL is insufficient, the Rust source can be used as a fallback.
- Primary: Anchor IDL JSON (the common path).
- Fallback: the account’s Rust source, for zero-copy layouts.
- Optional: a hint file for facts the tool can’t infer, such as confirmed renames.
Producing the two version files
Export the IDL at the old commit and the new commit, then point layoutd at both. The account-type entry layoutd reads for UserState looks like this:
{"name": "UserState","type": {"kind": "struct","fields": ["name": "authority", "type": "publicKey" },"name": "balance", "type": "u64" },"name": "bump", "type": "u8" } ] }}{"name": "UserState","type": {"kind": "struct","fields": ["name": "authority", "type": "publicKey" },"name": "is_active", "type": "bool" },"name": "balance", "type": "u64" },"name": "bump", "type": "u8" } ] }}The only difference above is the inserted is_active field in v2.json — which is exactly the change layoutd flags as DANGER, because it shifts the offsets of balance and bump.
Selecting the account
An IDL can contain many accounts. Use --account to pick the one you want to diff:
layoutd diff v1.json v2.json --account UserStateVerify against your binary
Ready to wire this into CI? See CI Setup.