-
Notifications
You must be signed in to change notification settings - Fork 993
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
Fix #566: serialize commit to hex #574
Conversation
We have the following representations of an
Seems like we may be able to consolidate these into just a single representation (this is likely what you are doing by using OutputPrintable and not Output). As these are all http/json serialization (via the api) - it seems like everything should be "printable". |
I can give that a shot. Full disclosure, I'm still a Rust noob so it'll take a little time for me to refactor all the places that these output types are used and to test them thoroughly. |
Any interest in picking this up? |
I'm actually deep in the output serialization code due to us picking #215 back up. So I'd recommend holding off on changing any of the output serialization until #215 is merged (assuming we don't find any blockers with this proposed approach). [Bringing this up because I'm expecting api codebase to change a fair bit in the next couple of days.] |
Ok great. I'll hold off then until #215 is merged. |
Ok - #215 ended up not getting merged. So now we have the following "models" in api -
A Utxo currently looks like this -
And OutputPrintables look like this (nested in a BlockPrintable here) -
So -
|
Agreed on your points. I can pick this back up and look into using Rust's |
Sounds like a good plan. For example - Lines 246 to 253 in f1bbf53
Edit: One thing to point out - we wrapped a |
Great, this is really helpful! |
@antiochp FYI will have this ready by EOD today. |
api/src/types.rs
Outdated
let hex_output = "{\ | ||
\"output_type\":\"Coinbase\",\ | ||
\"commit\":\"083eafae5d61a85ab07b12e1a51b3918d8e6de11fc6cde641d54af53608aa77b9f\",\ | ||
\"switch_commit_hash\":\"85daaf11011dc11e52af84ebe78e2f2d19cbdc76000000000000000000000000\",\ |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
@@ -153,29 +167,72 @@ pub enum OutputType { | |||
#[derive(Debug, Serialize, Deserialize, Clone)] | |||
pub struct Utxo { | |||
/// The output commitment representing the amount | |||
pub commit: pedersen::Commitment, | |||
pub commit: PrintableCommitment, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
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.
👍
@@ -153,29 +167,72 @@ pub enum OutputType { | |||
#[derive(Debug, Serialize, Deserialize, Clone)] | |||
pub struct Utxo { | |||
/// The output commitment representing the amount | |||
pub commit: pedersen::Commitment, | |||
pub commit: PrintableCommitment, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
spent: spent, | ||
proof: proof, | ||
output_type, | ||
commit: output.commit, |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
} | ||
} | ||
|
||
impl<'de> serde::de::Deserialize<'de> for OutputPrintable { |
This comment was marked as spam.
This comment was marked as spam.
Sorry, something went wrong.
No description provided.