Skip to content
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

execution-core: added serde support for MoonlightTransactionEvent #3046

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

d-sonuga
Copy link
Collaborator

This is to add the feature described in #2773.
I've only added serde support for a single event struct - MoonlightTransactionEvent.
I need some thoughts on whether what I have now is okay.

@d-sonuga d-sonuga force-pushed the add-serde-feature-execution-core branch from 8b9d6ae to 458f951 Compare November 22, 2024 16:50
@d-sonuga d-sonuga requested a review from moCello November 22, 2024 16:52
@HDauven HDauven requested a review from Neotamandua November 22, 2024 16:57
@d-sonuga d-sonuga force-pushed the add-serde-feature-execution-core branch from 458f951 to 9114601 Compare November 25, 2024 09:27
@@ -57,3 +62,5 @@ groth16 = [

# Enables std feature for dusk-plonk
std = ["dusk-plonk/std"]

serde_support = ["serde", "bs58", "serde_json"]
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
serde_support = ["serde", "bs58", "serde_json"]
serde = ["serde", "bs58", "serde_json"]

Many crates expose serde support on their own crates through a feature flag named the same as the crate, so I would prefer to rename this to just "serde" as a flag

Comment on lines 529 to 530
serde(with = "serde_support::bs58_serde")
)]
pub memo: Vec<u8>,
Copy link
Member

Choose a reason for hiding this comment

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

Memos should not be bs58 encoded. Prefer using hex for bytes and bs58 encoding only for the bytes of address types like AccountPublicKey

pub refund_info: Option<(AccountPublicKey, u64)>,
}

#[cfg(feature = "serde_support")]
mod serde_support {
Copy link
Member

Choose a reason for hiding this comment

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

It probably makes sense to have this as a separate file. Then you can also import the modules in it that are likely to be reused (e.g., bs58_serde) on other structs located in other files.

@d-sonuga d-sonuga force-pushed the add-serde-feature-execution-core branch 2 times, most recently from 5e58188 to e329820 Compare November 25, 2024 10:55
@d-sonuga d-sonuga force-pushed the add-serde-feature-execution-core branch from e329820 to 645e9bc Compare November 25, 2024 11:10
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