-
Notifications
You must be signed in to change notification settings - Fork 2.2k
feat(cheats): preserve struct order when parsing JSON objects #11612
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…sorted-json-w-compiler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please revert, this looks unrelated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i manually reverted my ConfigAndProject
struct thingy, hence the diff.
will leave untouched 🤝
crates/cli/src/opts/build/utils.rs
Outdated
} | ||
}); | ||
|
||
(version, paths.into_iter().filter_map(|p| dunce::canonicalize(p).ok()).collect()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is a bit hard to follow, can you rewrite with a single for loop, also combining this second iter here?
Motivation
Historical limitation in
vm.parseJson
where JSON object fields had to be sorted alphabetically, breaking compatibility with Solidity struct field order. This required developers to work around the limitation by manually ordering JSON fields.Solution
Integrate Solar's compiler output into the multi-runners. The PR introduces a
CheatcodeAnalysis
architecture that provides the cheatcode inspector access to Solar's compiler output, enabling order-preserving JSON parsing.JSON cheats improvements
parseJson
andparseJsonType
now use struct definitions to preserve field orderCheatcodeAnalysis Architecture
New
CheatcodeAnalysis
struct that provides cached, on-demand access to Solar's compiler output:the impl aims to be:
CheatcodeAnalysis
struct with the new fields and getter methodsintegrating a new analysis tool only requires setting up a new getter method (besides its impl):
note:
StructDefinitionResolver
is a HIR visitorold disc: