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

Add UniValue as subtree #2082

Merged
merged 43 commits into from Feb 10, 2017

Conversation

Projects
None yet
7 participants
@str4d
Copy link
Contributor

commented Feb 10, 2017

Jeff Garzik and others added some commits Aug 20, 2014

univalue: add support for real, fix percision and make it json_spirit…
… compatible

- avoid breaking the API because of different number/percision handling
fix rpc unit test, plain numbers are not JSON compatible object
UniValues read() does only read valid json.
Remove JSON Spirit wrapper, remove JSON Spirit leftovers
- implement find_value() function for UniValue
- replace all Array/Value/Object types with UniValues, remove JSON Spirit to UniValue wrapper
- remove JSON Spirit sources
Simplify RPCclient, adapt json_parse_error test
# Conflicts:
#	src/test/rpc_tests.cpp
util: Add ParseInt64 and ParseDouble functions
Strict parsing functions for other numeric types.

- ParseInt64 analogous to ParseInt32, but for 64-bit values.
- ParseDouble for doubles.
- Make all three Parse* functions more strict (e.g. reject whitespace on
  the inside)

Also add tests.
fix util_tests.cpp clang warnings
was introduced with #6121
Squashed 'src/univalue/' content from commit 9ef5b78
git-subtree-dir: src/univalue
git-subtree-split: 9ef5b78
[Univalue] add univalue over subtree
similar to secp256k1 include and compile univalue over a subtree

laanwj and others added some commits Jul 6, 2015

rpc: Accept scientific notation for monetary amounts in JSON
Add a function `ParseFixedPoint` that parses numbers according
to the JSON number specification and returns a 64-bit integer.

Then this in `AmountFromValue`, rather than `ParseMoney`.

Also add lots of tests (thanks to @jonasschnelli for some of them).

Fixes issue #6297.
rpc: Make ValueFromAmount always return 8 decimals
This is the format that was always returned to JSON clients.
The difference was not noticed before, because VREAL values
are post-processed by univalue.

By implementing the functionality directly it breaks the dependency
of rpcserver on utilmoneystr. FormatMoney is now only used for debugging
purposes.

To test, port over the formatting tests from util_tests.cpp to
rpc_tests.cpp.
univalue: Avoid unnecessary roundtrip through double for numbers
JSON makes no distinction between numbers and reals, and our code
doesn't need to do so either.

This removes VREAL, as well as its specific post-processing in
`UniValue::write`. Non-monetary amounts do not need to be forcibly
formatted with 8 decimals, so the extra roundtrip was unnecessary
(and potentially loses precision).

Zcash: cherry-picked from commit 7650449
Dropped changes to qa/rpc-tests/rest.py pending addition of /rest/headers/
util: use locale-independent parsing in ParseDouble
Use locale-indepent C++ based parsing instead of C's strtod,
which checks for different input based on the user's locale.
Fixes #6443.
@str4d

This comment has been minimized.

Copy link
Contributor Author

commented Feb 10, 2017

Based on #1990, merge that first.

@str4d str4d added this to the 1.0.6 milestone Feb 10, 2017

@str4d

This comment has been minimized.

Copy link
Contributor Author

commented Feb 10, 2017

Note that commit 9ef5b78 (the UniValue version being squashed in) is the head of the branch I created for jgarzik/univalue#35 (ie. UniValue 1.0.3 + the size_t patch).

@str4d

This comment has been minimized.

Copy link
Contributor Author

commented Feb 10, 2017

Commands used to add UniValue as a subtree:

git remote add univalue_str4d https://github.com/str4d/univalue.git
git fetch univalue_str4d
git subtree add --prefix=src/univalue --squash univalue_str4d size_t
@daira

This comment has been minimized.

Copy link
Contributor

commented Feb 10, 2017

ACK on the last three, Zcash-specific, commits.

@bitcartel

This comment has been minimized.

Copy link
Contributor

commented Feb 10, 2017

Updated test which failed.

@bitcartel

This comment has been minimized.

Copy link
Contributor

commented Feb 10, 2017

ACK

@bitcartel

This comment has been minimized.

Copy link
Contributor

commented Feb 10, 2017

@zkbot r+

@zkbot

This comment has been minimized.

Copy link
Collaborator

commented Feb 10, 2017

📌 Commit 238fec6 has been approved by bitcartel

@zkbot

This comment has been minimized.

Copy link
Collaborator

commented Feb 10, 2017

⌛️ Testing commit 238fec6 with merge eaaa5f6...

zkbot added a commit that referenced this pull request Feb 10, 2017

@zkbot

This comment has been minimized.

Copy link
Collaborator

commented Feb 10, 2017

☀️ Test successful - zcash

@zkbot zkbot merged commit 238fec6 into zcash:master Feb 10, 2017

1 check passed

homu Test successful
Details

@str4d str4d referenced this pull request Feb 15, 2017

Merged

Bitcoin 0.12 RPC PRs 1 #2100

@str4d str4d referenced this pull request Mar 4, 2017

Open

Bitcoin Core 0.12.0 #2074

196 of 452 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.