Skip to content

fix(idl): emit account helper types in deterministic order#232

Open
0x-r4bbit wants to merge 1 commit into
logos-co:mainfrom
0x-r4bbit:fix/idl-sorting
Open

fix(idl): emit account helper types in deterministic order#232
0x-r4bbit wants to merge 1 commit into
logos-co:mainfrom
0x-r4bbit:fix/idl-sorting

Conversation

@0x-r4bbit

Copy link
Copy Markdown
Contributor

collect_account_types seeded its BFS queue via a HashSet, whose iteration order is randomized per process. The order helper types were discovered — and emitted in the IDL — therefore varied run-to-run, so the same source produced byte-different IDL.

Use order-preserving dedup and sort the returned helper types by name, so output is byte-stable and independent of source declaration order. This is shared by both the CLI and proc-macro paths. Add a regression test.

`collect_account_types` seeded its BFS queue via a `HashSet`, whose
iteration order is randomized per process. The order helper types were
discovered — and emitted in the IDL — therefore varied run-to-run, so
the same source produced byte-different IDL.

Use order-preserving dedup and sort the returned helper types by name,
so output is byte-stable and independent of source declaration order.
This is shared by both the CLI and proc-macro paths. Add a regression
test.
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.

1 participant