Page MenuHomePhabricator

[avalanche] register local proof at first tip update
ClosedPublic

Authored by PiRK on Jul 6 2021, 14:21.

Details

Summary

Since we can now store proofs as orphans, it is possible to register the local proof before IBD is finished. When the blocks containing the stakes are known, the proof will be unorphaned.

Add a test for a node started with an orphan proof.

Test Plan

ninja all check-all

Event Timeline

@bot build-tsan build-win64 build-without-cli build-without-bip70 build-without-wallet build-without-zmq build-debug build-linux32

rebase, no changes.

Yesterday I had rare intermittent failures in various non-avalanche functional tests, but today, after starting from a fresh build folder, I can't reproduce the issue.

nevermind. I insisted and managed to reproduce the issue: for i in {1..10}; do ninja && ninja check-functional; done

5 tests failing out of 10 runs. Never the same one. The failure seems happen when the node is started, which makes sense as we add code at the end of Init.

FailedToStartError
stdout:
2021-07-07T12:30:32.209000Z TestFramework (INFO): Initializing test directory /home/pierre/dev/bitcoin-abc/build/test/tmp/test_runner_₿₵_🏃_20210707_142847/rpc_deriveaddresses_526
2021-07-07T12:30:32.471000Z TestFramework (ERROR): Unexpected exception caught during testing
Traceback (most recent call last):
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_framework.py", line 482, in start_nodes
    node.wait_for_rpc_connection()
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_node.py", line 296, in wait_for_rpc_connection
    raise FailedToStartError(self._node_msg(
test_framework.test_node.FailedToStartError: [node 0] bitcoind exited with status 1 during initialization

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_framework.py", line 126, in main
    self.setup()
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_framework.py", line 258, in setup
    self.setup_network()
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_framework.py", line 359, in setup_network
    self.setup_nodes()
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_framework.py", line 384, in setup_nodes
    self.start_nodes()
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_framework.py", line 485, in start_nodes
    self.stop_nodes()
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_framework.py", line 501, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_node.py", line 413, in stop_node
    self.stop(wait=wait)
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_node.py", line 727, in __call__
    return self.cli.send_cli(self.command, *args, **kwargs)
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_node.py", line 799, in send_cli
    raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command '/home/pierre/dev/bitcoin-abc/build/src/bitcoin-cli' returned non-zero exit status 1.
2021-07-07T12:30:32.521000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process

stderr:
Traceback (most recent call last):
  File "/home/pierre/dev/bitcoin-abc/test/functional/rpc_deriveaddresses.py", line 109, in <module>
    DeriveaddressesTest().main()
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_framework.py", line 147, in main
    exit_code = self.shutdown()
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_framework.py", line 273, in shutdown
    self.stop_nodes()
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_framework.py", line 501, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_node.py", line 413, in stop_node
    self.stop(wait=wait)
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_node.py", line 727, in __call__
    return self.cli.send_cli(self.command, *args, **kwargs)
  File "/home/pierre/dev/bitcoin-abc/test/functional/test_framework/test_node.py", line 799, in send_cli
    raise subprocess.CalledProcessError(
subprocess.CalledProcessError: Command '/home/pierre/dev/bitcoin-abc/build/src/bitcoin-cli' returned non-zero exit status 1.

remove unneccessary branches

PiRK published this revision for review.Jul 8 2021, 13:52

We have established that the failures I'm seeing are unrelated to this diff, as I can reproduce them on master.
It is most likely a port collision with some other daemon running on my machine.

deadalnix added inline comments.
src/init.cpp
3023 ↗(On Diff #29101)

That error message is not clear enough. Why is the checking happens there anyways?

PiRK planned changes to this revision.Jul 8 2021, 20:45

Need to work on the error message and if possible figure out how to not duplicate all the stateless proof verification tests again (already done in Processor::MakeProcessor)

PiRK retitled this revision from register local proof in init to register local proof at first chaintip update.
PiRK edited the summary of this revision. (Show Details)

register the proof at tip update rather than init, like before. We just no longer to need to wait for IBD to finish. And we don't need a flag, as we can just call registerProof which returns immediateley if the proof exists.

PiRK retitled this revision from register local proof at first chaintip update to [avalanche] register local proof at first tip update.
PiRK edited the summary of this revision. (Show Details)

merge D9762 and D9742

Fabien requested changes to this revision.Jul 12 2021, 09:25
Fabien added a subscriber: Fabien.
Fabien added inline comments.
test/functional/abc_rpc_avalancheproof.py
138 ↗(On Diff #29133)

You need to sync the nodes (self.sync_all()) but I don't think the generate does anything useful here

This revision now requires changes to proceed.Jul 12 2021, 09:25

sync the nodes with sync_all

This revision is now accepted and ready to land.Jul 13 2021, 06:07