Page MenuHomePhabricator

RPC: access RPC arguments by name
ClosedPublic

Authored by PiRK on Thu, Apr 17, 15:29.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABC977989ed441c: RPC: access RPC arguments by name
Summary

Add arg helper unit test. Compare the results of self.Arg with the request.params accessors to ensure they behave the same way.

Overload the Arg and MaybeArg helpers to allow accessing arguments by name as well.

Also update the docs to document Arg and MaybeArg separately

Use the new key-based Arg helper in a few locations to show how it is used.

This is a backport of core#29277
Depends on D17946

Test Plan

ninja all check-all

Event Timeline

PiRK requested review of this revision.Thu, Apr 17, 15:29
src/rpc/blockchain.cpp
2516–2517 ↗(On Diff #53539)

This change bypasses some other backport that changed the error message. Better to update it here, it will be easy to understand that it is already up-to-date when that other backport is done.

Failed tests logs:

====== Bitcoin ABC functional tests: abc_p2p_compactproofs.py ======

------- Stdout: -------
2025-04-17T15:32:34.735000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250417_153207/abc_p2p_compactproofs_15
2025-04-17T15:32:36.287000Z TestFramework (INFO): Check we send a getavaproofs message to our avalanche outbound peers
2025-04-17T15:32:38.315000Z TestFramework (INFO): Check we send periodic getavaproofs message to some of our peers
2025-04-17T15:32:38.366000Z TestFramework (INFO): After the first avaproofs has been received, all the peers are requested periodically
2025-04-17T15:32:38.669000Z TestFramework (INFO): Empty avaproofs will not trigger any request
2025-04-17T15:32:38.670000Z TestFramework (INFO): Check we send a getavaproofs message to our manually connected peers that support avalanche
2025-04-17T15:32:39.917000Z TestFramework (INFO): Check the node responds to getavaproofs messages
2025-04-17T15:32:44.431000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 152, in main
    self._run_test_internal()
  File "/work/test/functional/test_framework/test_framework.py", line 142, in _run_test_internal
    self.run_test()
  File "/work/test/functional/abc_p2p_compactproofs.py", line 728, in run_test
    self.test_respond_getavaproofs()
  File "/work/test/functional/abc_p2p_compactproofs.py", line 319, in test_respond_getavaproofs
    send_getavaproof_check_shortid_len(receiving_peer, len(proofids))
  File "/work/test/functional/abc_p2p_compactproofs.py", line 276, in send_getavaproof_check_shortid_len
    assert_equal(len(avaproofs.shortids), expected_len)
  File "/work/test/functional/test_framework/util.py", line 56, in assert_equal
    raise AssertionError(
AssertionError: not(6 == 5)
2025-04-17T15:32:44.483000Z TestFramework (INFO): Stopping nodes
2025-04-17T15:32:44.685000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250417_153207/abc_p2p_compactproofs_15
2025-04-17T15:32:44.685000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250417_153207/abc_p2p_compactproofs_15/test_framework.log
2025-04-17T15:32:44.685000Z TestFramework (ERROR): 
2025-04-17T15:32:44.685000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_🏃_20250417_153207/abc_p2p_compactproofs_15' to consolidate all logs
2025-04-17T15:32:44.685000Z TestFramework (ERROR): 
2025-04-17T15:32:44.685000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2025-04-17T15:32:44.685000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2025-04-17T15:32:44.685000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: abc_p2p_compactproofs.py

remove accidental character in doxygen doc

This revision is now accepted and ready to land.Thu, Apr 17, 18:32
This revision was automatically updated to reflect the committed changes.