Implement FromStr for UDecimal/Decimal.#142
Conversation
|
Can you add a fuzz test that tries to parse a decimal, and when it succeeds tries to reserialize it (and check that it roundtrips correctly)? |
8c892c4 to
175895b
Compare
|
Done |
|
Nice, thanks! Unfortunately it looks like it failed trying to roundtrip the number '6' (which I kinda expected to happen ... that should obviously parse as a 6, but then I'd expect it to serialize as 6.00000000, so I guess the fuzz test needs to be more accepting... perhaps it should parse, then serialize, then parse again, and check that both parses gave the same Also, not a big deal, but in future I'd appreciate if fuzz-tests would appear in their own commit, because they're generally independent of other changes and can be reviewed independently. |
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
175895b to
be0d547
Compare
|
Done 👍, fuzz tests are now in their own commit. |
|
Build is failing because |
|
Tracking issue: alexcrichton/cc-rs#336 |
|
Looks like there is also a failing fuzz test case (hex |
…mal`. Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
|
That hex string is the number |
|
Ok, don't know why tests are failing I'm feeling stupid right now :P, I'm going to sleep and check that tomorrow. |
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
8fe36fd to
a915bc1
Compare
The negative symbol wasn't there when `int_part` was equal to zero. Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
|
I don't mind the churn, but you may find life easier if you run I'm glad we're finding this stuff though ... I expect all of these issues existed in the old code, we just never sussed them out. |
|
@apoelstra I can't do fuzzing right now on my PC (some reasons, not related to this), that's why I'm pushing and fixing. |
|
Also the tests are failing with the bytes let ten = 10i64.pow(self.exponent as u32);Not sure how to handle this though. |
|
I think we should just forbid exponents larger than 18. I guess this could cause issues for Dogecoin or something but we don't support anything like that now. |
Signed-off-by: Jean Pierre Dudey <jeandudey@hotmail.com>
|
lol, the build is finally green |
|
Thanks so much! Seems like most of the bugs were latent and had been hanging around since 2014 so it's awesome to finally clear them out. |
…bitcoin#142) - Eliminate duplicate ChainState initialization by sharing a single Arc<RwLock<ChainState>> across client and header sync. - HeaderSyncManagerWithReorg now holds shared state and no longer constructs its own ChainState. - SequentialSyncManager::new signature updated to accept the shared ChainState and plumb it through. - Client passes its ChainState to sync manager and removes the client-side header copy path. - Read/write updated to use RwLock guards; added lightweight cached checkpoint flags in header sync. This removes the duplicate "Initialized ChainState" logs and unifies state as a single source of truth.
Solves #140