Skip to content

solc-json-interface: do not unconditionally skip serialization of custom keys #337

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

Merged
merged 3 commits into from
Jun 3, 2025

Conversation

xermicus
Copy link
Member

@xermicus xermicus commented May 30, 2025

The data structure can be used to build the JSON input for resolc too. In that case serializing of provided custom options should not be dismissed.

Makes the memory settings struct more modular as a drive-by.

@xermicus xermicus requested a review from smiasojed May 30, 2025 13:17
Signed-off-by: Cyrill Leutwiler <[email protected]>
@xermicus xermicus changed the title solc-json-interface: do not uncoditionally skip serialization of custom keys solc-json-interface: do not unconditionally skip serialization of custom keys May 30, 2025
@@ -11,16 +11,18 @@ pub mod memory;
#[derive(Clone, Copy, Default, Debug, Serialize, Deserialize)]
pub struct PolkaVM {
/// The PolkaVM target machine memory configuration settings.
pub memory_config: MemoryConfig,
#[serde(skip_serializing_if = "Option::is_none")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be possible to add #[serde(default, skip_serializing_if = "Option::is_none")] to each struct field? That way, I could use the struct directly in Foundry.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't that futile? Serde deserializes absent optional fields to None anyways.

@xermicus xermicus merged commit 8a3c587 into main Jun 3, 2025
14 checks passed
@xermicus xermicus deleted the cl/opt-ser branch June 3, 2025 06:17
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