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

[RPC] Update univalue and unify JSON obj pushes #1869

Merged
merged 5 commits into from
Sep 25, 2020

Conversation

Fuzzbawls
Copy link
Collaborator

@Fuzzbawls Fuzzbawls commented Sep 24, 2020

The pervious usage of push_back(Pair()) was needed for compatibility with the old json spirit library, which we transitioned away from quite a while ago in favor of Univalue.

Univalue provides a more convenient method for pushing key/value pairs into a JSON object or array in the form of pushKV(), which is easier to read and leads to shorter code segments.

This PR first updates our univalue subtree with upstream, which has removed the now-unneeded declaration methods for push_back(Pair()), as well as patch a bug with pushKV() being supplied with a boolean instead of an integer argument.

92c8273 handles the majority of the work to replace usages of push_back(Pair()) with pushKV() with a reproducible shell command.

b401d55 takes care of 3 instances that were not picked up in the previous commit due to multiline code

7723a0a finally, this commit adds the scripted-diff verification linter to TravisCI for future use.

Note: Depending on merge order, existing open PRs may "leak" new or conflicting introductions of push_back(Pair())

random-zebra
random-zebra previously approved these changes Sep 24, 2020
Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

ACK 28522af

Would merge this sooner rather than later, to minimize the need for multiple rebases (being it a sweeping change) and be sure that open PRs do not introduce code with the outdated push_back(Pair()).

@random-zebra random-zebra dismissed their stale review September 24, 2020 16:00

Whoops, nevermind... looks like it already has a conflict

98261b1 Merge PIVX-Project#22: Clamp JSON object depth to PHP limit
54c4015 Clamp JSON object depth to PHP limit
5a58a46 Merge PIVX-Project#21: Remove hand-coded UniValue destructor.
b4cdfc4 Remove hand-coded UniValue destructor.
7fba60b Merge PIVX-Project#17: [docs] Update readme
4577454 Merge PIVX-Project#13: Fix typo
ac7e73c [docs] Update readme
7890db9 Merge PIVX-Project#11: Remove deprecated std pair wrappers
40e3485 Merge PIVX-Project#14: Cleaned up namespace imports to reduce symbol collisions
4a49647 Fix typo
85052a4 Remove deprecated std::pair wrappers
51d3ab3 Merge PIVX-Project#10: Add pushKV(key, boolean) function (replaces PIVX-Project#5)
129bad9 [tests] test pushKV for boolean values
b3c44c9 Pushing boolean value to univalue correctly
07947ff Merge PIVX-Project#9: [tests] Fix BOOST_CHECK_THROW macro
ec849d9 [tests] Fix BOOST_CHECK_THROW macro
d208f98 Cleaned up namespace imports to reduce symbol collisions
31bc9f5 Merge PIVX-Project#8: Remove unused Homebrew workaround
fa04209 Remove HomeBrew workaround
a523e08 Merge PIVX-Project#7: Declare single-argument (non-converting) constructors "explicit"
a9e53b3 Merge PIVX-Project#4: Pull upstream
fe805ea Declare single-argument (non-converting) constructors "explicit"
8a2d6f1 Merge pull request PIVX-Project#41 from jgarzik/get-obj-map
ba341a2 Add getObjMap() helper method.  Also, constify checkObject().
ceb1194 Handle .pushKV() and .checkObject() edge cases.
107db98 Add ::push_back(double) method for feature parity.
d415300 Move one-line implementation of UniValue::read() to header.
52e85b3 Move exception-throwing get_* methods into separate implementation module.
16a1f7f Merge PIVX-Project#3: Pull upstream
daf1285 Merge pull request PIVX-Project#2 from jgarzik/master
f32df99 Merge branch '2016_04_unicode' into bitcoin
280b191 Merge remote-tracking branch 'jgarzik/master' into bitcoin
2740c4f Merge branch '2015_11_escape_plan' into bitcoin

git-subtree-dir: src/univalue
git-subtree-split: 98261b1
-BEGIN VERIFY SCRIPT-
git grep -l "push_back(Pair" | xargs sed -i "s/push_back(Pair(\(.*\)));/pushKV(\1);/g"
-END VERIFY SCRIPT-
3 remaining instances of `push_back(Pair())` due to multiline code.
@Fuzzbawls
Copy link
Collaborator Author

Updated to resolve conflicts. and yes, would be good to merge this sooner rather than later as rebasing isn't possible with subtree updates, need to manually redo the process.

Copy link

@random-zebra random-zebra left a comment

Choose a reason for hiding this comment

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

rebase ut-ACK 7723a0a

Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

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

utACK 7723a0a

@furszy furszy merged commit 525a45a into PIVX-Project:master Sep 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants