Skip to content

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 28522af5e7c06e32a3eb9024d1d683b9d87f838e

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

98261b1e7b Merge PIVX-Project#22: Clamp JSON object depth to PHP limit
54c4015415 Clamp JSON object depth to PHP limit
5a58a46671 Merge PIVX-Project#21: Remove hand-coded UniValue destructor.
b4cdfc4f47 Remove hand-coded UniValue destructor.
7fba60b5ad Merge PIVX-Project#17: [docs] Update readme
4577454e7e Merge PIVX-Project#13: Fix typo
ac7e73cda8 [docs] Update readme
7890db99d6 Merge PIVX-Project#11: Remove deprecated std pair wrappers
40e34852ac Merge PIVX-Project#14: Cleaned up namespace imports to reduce symbol collisions
4a4964729b Fix typo
85052a4819 Remove deprecated std::pair wrappers
51d3ab34ba Merge PIVX-Project#10: Add pushKV(key, boolean) function (replaces PIVX-Project#5)
129bad96d5 [tests] test pushKV for boolean values
b3c44c947f Pushing boolean value to univalue correctly
07947ff2da Merge PIVX-Project#9: [tests] Fix BOOST_CHECK_THROW macro
ec849d9a28 [tests] Fix BOOST_CHECK_THROW macro
d208f986dd Cleaned up namespace imports to reduce symbol collisions
31bc9f5a49 Merge PIVX-Project#8: Remove unused Homebrew workaround
fa042093d1 Remove HomeBrew workaround
a523e08ae4 Merge PIVX-Project#7: Declare single-argument (non-converting) constructors "explicit"
a9e53b38ba Merge PIVX-Project#4: Pull upstream
fe805ea74f Declare single-argument (non-converting) constructors "explicit"
8a2d6f1e36 Merge pull request PIVX-Project#41 from jgarzik/get-obj-map
ba341a20d7 Add getObjMap() helper method.  Also, constify checkObject().
ceb1194137 Handle .pushKV() and .checkObject() edge cases.
107db98299 Add ::push_back(double) method for feature parity.
d415300316 Move one-line implementation of UniValue::read() to header.
52e85b35b8 Move exception-throwing get_* methods into separate implementation module.
16a1f7f6e9 Merge PIVX-Project#3: Pull upstream
daf1285af6 Merge pull request PIVX-Project#2 from jgarzik/master
f32df99e96 Merge branch '2016_04_unicode' into bitcoin
280b191cb1 Merge remote-tracking branch 'jgarzik/master' into bitcoin
2740c4f712 Merge branch '2015_11_escape_plan' into bitcoin

git-subtree-dir: src/univalue
git-subtree-split: 98261b1e7be4ce9820e25c8ce37d40cdef19ab20
-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.

3 participants