-
Notifications
You must be signed in to change notification settings - Fork 1.2k
fix: circular dependency linter for core_io and related fixes #7620
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
Changes from all commits
f4e6aa2
6c67fc3
99464cf
bbeeeb3
520a669
8e5805e
7c1f653
ef7ba7b
6f9a7ad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -47,4 +47,23 @@ std::string Object::GetDataAsPlainString() const | |
| { | ||
| return std::string(vchData.begin(), vchData.end()); | ||
| } | ||
|
|
||
| UniValue Object::ToJson() const | ||
| { | ||
| UniValue obj(UniValue::VOBJ); | ||
| obj.pushKV("objectHash", GetHash().ToString()); | ||
| obj.pushKV("parentHash", hashParent.ToString()); | ||
| obj.pushKV("collateralHash", collateralHash.ToString()); | ||
| obj.pushKV("createdAt", time); | ||
| obj.pushKV("revision", revision); | ||
| UniValue data; | ||
| if (!data.read(GetDataAsPlainString())) { | ||
| data.clear(); | ||
| data.setObject(); | ||
| data.pushKV("plain", GetDataAsPlainString()); | ||
| } | ||
| data.pushKV("hex", GetDataAsHexString()); | ||
| obj.pushKV("data", data); | ||
| return obj; | ||
| } | ||
|
Comment on lines
+51
to
+68
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
rg -n -C 4 '\b(Object::ToJson|CGovernanceManager::ToJson|GetInnerJson|GetVotesJson)\b' src test
fd -t f . src/test test | rg -i 'governance.*test|test.*governance'Repository: dashpay/dash Length of output: 6282 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '== governance test files =='
for f in src/test/governance_inv_tests.cpp \
src/test/governance_superblock_tests.cpp \
src/test/governance_validators_tests.cpp \
src/test/governance_vote_processing_tests.cpp \
src/test/governance_vote_sync_tests.cpp \
src/test/governance_vote_wire_tests.cpp \
test/functional/feature_governance.py \
test/functional/feature_governance_objects.py; do
if [ -f "$f" ]; then
printf '\n== %s ==\n' "$f"
wc -l "$f"
rg -n -i -C 3 'tojson|getinnerjson|getvotesjson|objecthash|parenthash|collateralhash|createdat|revision|absoluteyescount|yescount|nocount|abstaincount|objects_total|proposals|triggers|erased|votes|json|read\(' "$f" || true
fi
done
printf '\n== governance implementation and declarations ==\n'
rg -n -C 6 'class Object|Object::ToJson|class CGovernanceManager|CGovernanceManager::ToJson|GetAbsoluteYesCount|GetYesCount|GetNoCount|GetAbstainCount|GetVotesJson|GetInnerJson' src/governance src/rpc src/test
printf '\n== recent file history summary ==\n'
git log -8 --oneline -- src/governance/common.cpp src/governance/governance.cpp src/governance/object.cpp src/testRepository: dashpay/dash Length of output: 50368 🏁 Script executed: #!/usr/bin/env bash
set -euo pipefail
printf '%s\n' '== feature_governance_objects.py =='
cat -n test/functional/feature_governance_objects.py | sed -n '1,90p'
printf '\n%s\n' '== governance RPC JSON help and handlers =='
cat -n src/rpc/json_help.cpp | sed -n '470,545p'
cat -n src/rpc/governance.cpp | sed -n '600,675p'
cat -n src/rpc/governance.cpp | sed -n '735,770p'
printf '\n%s\n' '== manager ToJson declaration and callers =='
rg -n -C 8 'ToJson\(\) const|\.ToJson\(\)|ToJson\(' src/governance src/rpc src/test \
| rg -n -C 4 'Governance|gobject|ToJson|governance'
printf '\n%s\n' '== C++ tests that exercise JSON or governance count RPCs =='
rg -n -i -C 5 'gobject|GetInnerJson|GetVotesJson|AbsoluteYesCount|AbstainCount|objects_total|proposals|triggers|erased|read_json|UniValue' src/test/governance_*.cpp test/functional/feature_governance*.pyRepository: dashpay/dash Length of output: 50368 Add targeted governance JSON tests.
Existing functional tests cover only normal object data and selected funding vote counts. 📍 Affects 3 files
🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| } // namespace Governance | ||
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: dashpay/dash
Length of output: 9576
🏁 Script executed:
Repository: dashpay/dash
Length of output: 47937
🏁 Script executed:
Repository: dashpay/dash
Length of output: 50369
🏁 Script executed:
Repository: dashpay/dash
Length of output: 485
🏁 Script executed:
Repository: dashpay/dash
Length of output: 14507
🏁 Script executed:
Repository: dashpay/dash
Length of output: 563
🏁 Script executed:
Repository: dashpay/dash
Length of output: 32248
🏁 Script executed:
Repository: dashpay/dash
Length of output: 563
Handle valid non-object JSON before adding
"hex".data.read()succeeds for arrays and other non-object JSON values.data.pushKV("hex", ...)then throws becauseUniValue::pushKV()requiresVOBJ. Use!data.read(...) || !data.isObject()and add a regression test for an array root.🤖 Prompt for AI Agents