8000 Remove Decimal and replace strason with serde_json by stevenroose · Pull Request #250 · rust-bitcoin/rust-bitcoin · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Remove Decimal and replace strason with serde_json #250

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 1 commit into from
Jul 3, 2019

Conversation

stevenroose
Copy link
Collaborator

I'm also wondering if it makes sense to have Decimal in here at all.. Was that intended to be used for difficulty numbers or so? In rust-bitcoincore-rpc we're using BigUint from the num-bigint crate for that.

Copy link
Contributor
@sgeisler sgeisler left a comment

Choose a reason for hiding this comment

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

Hey, thank you for tackling this issue (thought about doing this since we switched to 1.21/22). This should fix our random fuzz-test stack overflows. I noticed that it wasn't compiling half-way through and will do a full review once it does. In the meantime I'll mark the PR as WIP.

@sgeisler sgeisler changed the title Replace strason with serde_json WIP: Replace strason with serde_json Mar 26, 2019
@stevenroose
Copy link
Collaborator Author
stevenroose commented Mar 27, 2019 via email

@stevenroose stevenroose force-pushed the no-strason branch 4 times, most recently from 15bdc37 to fe67ce8 Compare March 27, 2019 15:46
@stevenroose stevenroose changed the title WIP: Replace strason with serde_json Replace strason with serde_json Mar 27, 2019
@@ -116,7 +116,7 @@ impl<D: Decoder> Decodable<D> for PartiallySignedTransaction {
return Err(Error::InvalidMagic.into());
}

if 0xff_u8 != Decodable::consensus_decode(d)? {
if 0xff != u8::consensus_decode(d)? {
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Just wanted to mention that this somehow broke for me. It couldn't infer type, even though the 0xff_u8 is very explicitly typed. Same goes for the misc.rs change. Well, never hurts to be more specific I guess.

sgeisler
sgeisler previously approved these changes Mar 27, 2019
Copy link
Contributor
@sgeisler sgeisler left a comment

Choose a reason for hiding this comment

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

Thank you for fixing it :) LGTM. We should have a look at Decimal, but that's out of scope here (#251).

@sgeisler sgeisler added the API break This PR requires a version bump for the next release label Mar 27, 2019
@stevenroose
Copy link
Collaborator Author

Would be nice to have this merged together with #252.

@stevenroose stevenroose requested a review from apoelstra April 3, 2019 14:26
@dpc
Copy link
Contributor
dpc commented Apr 3, 2019

Maybe I don't understand something and it's not an issue, but just thinking aloud:

I don't understand how the "arbitrary_precision" feature on serde_json works exactly, but it looks too me like a potential misfeature. Since features in cargo are accumulative, once someone includes this library in their project, it will enable arbitrary_precision on serde_json for all libraries. What if some piece of code (maybe accidently) is depending on the loss of precision?

@stevenroose stevenroose mentioned this pull request Apr 4, 2019
@stevenroose
Copy link
Collaborator Author

@dpc arbitrary_precision is only enabled when you're using Decimal, which I think can be removed once Amount lands.

@apoelstra any other objection to this?

@apoelstra
Copy link
Member

Cool. Let's get Amount in so we can remove arbitrary_precision and then I'll take a look at this.

Frustrating that we can't feature-gate dev-dependencies, it would eliminate any concern about downstream users being affected by our feature choices.

@stevenroose
Copy link
Collaborator Author

So you prefer to have Amount come first? Because currently it builds on this PR. I could change that though.
Thing is that this PR also does some [dev-]dependency cleanup that I'd want to do for Amount as well.

@apoelstra
Copy link
Member
8000

Can this be rebased now that #270 is in?

@stevenroose
Copy link
Collaborator Author

I also removed Decimal, is that ok?

@stevenroose stevenroose changed the title Replace strason with serde_json Remove Decimal and replace strason with serde_json Jun 8, 2019
@@ -805,15 +805,14 @@ mod test {
}

#[test]
#[cfg(all(feature = "serde", feature = "strason"))]
#[cfg(feature = "serde")]
Copy link
Member

Choose a reason for hiding this comment

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

Needs to be feature = "serde_json", no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No, you're testing the serde stuff in the main code and serde_json is a dev-dependency that is always present for testing.

(I was mistaken in the Cargo file, though, I forgot to move serde_json to dev-dependencies. We don't rely on it for anything else than tests.)

Copy link
Contributor
@sgeisler sgeisler left a comment

Choose a reason for hiding this comment

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

@apoelstra do we need to coordinate that with other breaking changes? Since the Amount PR was merged this seems to be ready for review/merging.

@apoelstra
Copy link
Member

No coordination, we'll put it all in the next major release.

@apoelstra apoelstra merged commit b2727b6 into rust-bitcoin:master Jul 3, 2019
This was referenced Jul 11, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API break This PR requires a version bump for the next release enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0