-
Notifications
You must be signed in to change notification settings - Fork 60
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
base: master
Are you sure you want to change the base?
Conversation
8b9d6ae
to
458f951
Compare
458f951
to
9114601
Compare
execution-core/Cargo.toml
Outdated
@@ -57,3 +62,5 @@ groth16 = [ | |||
|
|||
# Enables std feature for dusk-plonk | |||
std = ["dusk-plonk/std"] | |||
|
|||
serde_support = ["serde", "bs58", "serde_json"] |
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.
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
execution-core/src/transfer.rs
Outdated
serde(with = "serde_support::bs58_serde") | ||
)] | ||
pub memo: Vec<u8>, |
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.
Memos should not be bs58 encoded. Prefer using hex for bytes and bs58 encoding only for the bytes of address types like AccountPublicKey
execution-core/src/transfer.rs
Outdated
pub refund_info: Option<(AccountPublicKey, u64)>, | ||
} | ||
|
||
#[cfg(feature = "serde_support")] | ||
mod serde_support { |
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.
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.
5e58188
to
e329820
Compare
e329820
to
645e9bc
Compare
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.