Page MenuHomePhabricator

[avalanche] make the delegateavalancheproof RPC take a limited ID
AbandonedPublic

Authored by PiRK on Jun 1 2021, 08:57.

Details

Reviewers
deadalnix
Group Reviewers
Restricted Project
Summary

Replace the proof parameter with a limited id parameter.

A complete proof is not necessary to build a delegation. We only need the limited proof id and the proof master key.
The proof master key can be deduced from the exisiting privkey parameter when building a new delegation, and when adding a level to an existing delegation it can be found in the delegation (since D9564).

The RPC is no longer responsible for checking following potential errors:

  • passing an invalid proof
  • passing a private key that does not match the proof's public master key (when building a new delegation)

Depends on D9613

Test Plan

ninja check-functional

Event Timeline

PiRK requested review of this revision.Jun 1 2021, 08:57

Failed tests logs:

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

------- Stdout: -------
2021-06-01T09:09:38.083000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20210601_090904/abc_rpc_avalancheproof_358
2021-06-01T09:09:38.370000Z TestFramework (INFO): Make build a valid proof and restart the node to use it
2021-06-01T09:09:38.373000Z TestFramework (INFO): Test decodeavalancheproof RPC
2021-06-01T09:09:38.879000Z TestFramework (INFO): The proof verification should be delayed until IBD is complete
2021-06-01T09:09:38.882000Z TestFramework (INFO): Generate delegations for the proof
2021-06-01T09:09:38.917000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/util.py", line 146, in try_rpc
    fun(*args, **kwds)
  File "/work/test/functional/test_framework/coverage.py", line 48, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 159, in __call__
    raise JSONRPCException(response['error'], status)
test_framework.authproxy.JSONRPCException: The supplied private key does not match the delegation (-8)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 126, in main
    self.run_test()
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 205, in run_test
    delegation,
  File "/work/test/functional/test_framework/util.py", line 137, in assert_raises_rpc_error
    assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
  File "/work/test/functional/test_framework/util.py", line 156, in try_rpc
    message, e.error['message']))
AssertionError: Expected substring not found in error message:
substring: 'The private key does not match the proof or the delegation'
error message: 'The supplied private key does not match the delegation'.
2021-06-01T09:09:38.968000Z TestFramework (INFO): Stopping nodes
2021-06-01T09:09:39.069000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20210601_090904/abc_rpc_avalancheproof_358
2021-06-01T09:09:39.069000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20210601_090904/abc_rpc_avalancheproof_358/test_framework.log
2021-06-01T09:09:39.069000Z TestFramework (ERROR): 
2021-06-01T09:09:39.069000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20210601_090904/abc_rpc_avalancheproof_358' to consolidate all logs
2021-06-01T09:09:39.069000Z TestFramework (ERROR): 
2021-06-01T09:09:39.069000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2021-06-01T09:09:39.069000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2021-06-01T09:09:39.069000Z TestFramework (ERROR):

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

Failed tests logs:

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

------- Stdout: -------
2021-06-01T09:09:45.318000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20210601_090725/abc_rpc_avalancheproof_111
2021-06-01T09:09:46.013000Z TestFramework (INFO): Make build a valid proof and restart the node to use it
2021-06-01T09:09:46.018000Z TestFramework (INFO): Test decodeavalancheproof RPC
2021-06-01T09:09:46.777000Z TestFramework (INFO): The proof verification should be delayed until IBD is complete
2021-06-01T09:09:46.784000Z TestFramework (INFO): A proof using the maximum number of stakes is accepted...
2021-06-01T09:09:54.061000Z TestFramework (INFO): A proof using too many stakes should be rejected...
2021-06-01T09:09:54.470000Z TestFramework (INFO): Generate delegations for the proof
2021-06-01T09:09:54.508000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/util.py", line 146, in try_rpc
    fun(*args, **kwds)
  File "/work/test/functional/test_framework/coverage.py", line 48, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 159, in __call__
    raise JSONRPCException(response['error'], status)
test_framework.authproxy.JSONRPCException: The supplied private key does not match the delegation (-8)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 126, in main
    self.run_test()
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 205, in run_test
    delegation,
  File "/work/test/functional/test_framework/util.py", line 137, in assert_raises_rpc_error
    assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
  File "/work/test/functional/test_framework/util.py", line 156, in try_rpc
    message, e.error['message']))
AssertionError: Expected substring not found in error message:
substring: 'The private key does not match the proof or the delegation'
error message: 'The supplied private key does not match the delegation'.
2021-06-01T09:09:54.559000Z TestFramework (INFO): Stopping nodes
2021-06-01T09:09:54.760000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20210601_090725/abc_rpc_avalancheproof_111
2021-06-01T09:09:54.760000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20210601_090725/abc_rpc_avalancheproof_111/test_framework.log
2021-06-01T09:09:54.760000Z TestFramework (ERROR): 
2021-06-01T09:09:54.761000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20210601_090725/abc_rpc_avalancheproof_111' to consolidate all logs
2021-06-01T09:09:54.761000Z TestFramework (ERROR): 
2021-06-01T09:09:54.761000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2021-06-01T09:09:54.761000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2021-06-01T09:09:54.761000Z TestFramework (ERROR):

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

Failed tests logs:

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

------- Stdout: -------
2021-06-01T09:10:44.573000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20210601_090855/abc_rpc_avalancheproof_385
2021-06-01T09:10:44.867000Z TestFramework (INFO): Make build a valid proof and restart the node to use it
2021-06-01T09:10:44.870000Z TestFramework (INFO): Test decodeavalancheproof RPC
2021-06-01T09:10:45.282000Z TestFramework (INFO): The proof verification should be delayed until IBD is complete
2021-06-01T09:10:45.299000Z TestFramework (INFO): A proof using the maximum number of stakes is accepted...
2021-06-01T09:10:47.933000Z TestFramework (INFO): A proof using too many stakes should be rejected...
2021-06-01T09:10:48.123000Z TestFramework (INFO): Generate delegations for the proof
2021-06-01T09:10:48.155000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/util.py", line 146, in try_rpc
    fun(*args, **kwds)
  File "/work/test/functional/test_framework/coverage.py", line 48, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 159, in __call__
    raise JSONRPCException(response['error'], status)
test_framework.authproxy.JSONRPCException: The supplied private key does not match the delegation (-8)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 126, in main
    self.run_test()
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 205, in run_test
    delegation,
  File "/work/test/functional/test_framework/util.py", line 137, in assert_raises_rpc_error
    assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
  File "/work/test/functional/test_framework/util.py", line 156, in try_rpc
    message, e.error['message']))
AssertionError: Expected substring not found in error message:
substring: 'The private key does not match the proof or the delegation'
error message: 'The supplied private key does not match the delegation'.
2021-06-01T09:10:48.206000Z TestFramework (INFO): Stopping nodes
2021-06-01T09:10:48.557000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20210601_090855/abc_rpc_avalancheproof_385
2021-06-01T09:10:48.557000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20210601_090855/abc_rpc_avalancheproof_385/test_framework.log
2021-06-01T09:10:48.557000Z TestFramework (ERROR): 
2021-06-01T09:10:48.557000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20210601_090855/abc_rpc_avalancheproof_385' to consolidate all logs
2021-06-01T09:10:48.557000Z TestFramework (ERROR): 
2021-06-01T09:10:48.557000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2021-06-01T09:10:48.557000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2021-06-01T09:10:48.558000Z TestFramework (ERROR):
====== Bitcoin ABC functional tests with the next upgrade activated: abc_rpc_avalancheproof.py ======

------- Stdout: -------
2021-06-01T09:13:31.520000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20210601_091158/abc_rpc_avalancheproof_204
2021-06-01T09:13:31.834000Z TestFramework (INFO): Make build a valid proof and restart the node to use it
2021-06-01T09:13:31.837000Z TestFramework (INFO): Test decodeavalancheproof RPC
2021-06-01T09:13:32.244000Z TestFramework (INFO): The proof verification should be delayed until IBD is complete
2021-06-01T09:13:32.248000Z TestFramework (INFO): A proof using the maximum number of stakes is accepted...
2021-06-01T09:13:34.489000Z TestFramework (INFO): A proof using too many stakes should be rejected...
2021-06-01T09:13:34.684000Z TestFramework (INFO): Generate delegations for the proof
2021-06-01T09:13:34.717000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/util.py", line 146, in try_rpc
    fun(*args, **kwds)
  File "/work/test/functional/test_framework/coverage.py", line 48, in __call__
    return_val = self.auth_service_proxy_instance.__call__(*args, **kwargs)
  File "/work/test/functional/test_framework/authproxy.py", line 159, in __call__
    raise JSONRPCException(response['error'], status)
test_framework.authproxy.JSONRPCException: The supplied private key does not match the delegation (-8)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 126, in main
    self.run_test()
  File "/work/test/functional/abc_rpc_avalancheproof.py", line 205, in run_test
    delegation,
  File "/work/test/functional/test_framework/util.py", line 137, in assert_raises_rpc_error
    assert try_rpc(code, message, fun, *args, **kwds), "No exception raised"
  File "/work/test/functional/test_framework/util.py", line 156, in try_rpc
    message, e.error['message']))
AssertionError: Expected substring not found in error message:
substring: 'The private key does not match the proof or the delegation'
error message: 'The supplied private key does not match the delegation'.
2021-06-01T09:13:34.768000Z TestFramework (INFO): Stopping nodes
2021-06-01T09:13:35.070000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20210601_091158/abc_rpc_avalancheproof_204
2021-06-01T09:13:35.070000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20210601_091158/abc_rpc_avalancheproof_204/test_framework.log
2021-06-01T09:13:35.070000Z TestFramework (ERROR): 
2021-06-01T09:13:35.070000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20210601_091158/abc_rpc_avalancheproof_204' to consolidate all logs
2021-06-01T09:13:35.070000Z TestFramework (ERROR): 
2021-06-01T09:13:35.070000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2021-06-01T09:13:35.070000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2021-06-01T09:13:35.070000Z TestFramework (ERROR):

Each failure log is accessible here:
Bitcoin ABC functional tests: abc_rpc_avalancheproof.py
Bitcoin ABC functional tests with the next upgrade activated: abc_rpc_avalancheproof.py

deadalnix requested changes to this revision.Jun 1 2021, 15:37
deadalnix added a subscriber: deadalnix.

Back on your queue, CI is broken.

This revision now requires changes to proceed.Jun 1 2021, 15:37

Update an error message in the functional tests to match the new code. This error is now only possible if a delegation is supplied, the privkey can no longer have a mismatch with the proof.

deadalnix requested changes to this revision.Jun 1 2021, 20:14
deadalnix added inline comments.
src/rpc/avalanche.cpp
341 ↗(On Diff #28706)

I don't think this needs to be a unique pointer.

This revision now requires changes to proceed.Jun 1 2021, 20:14