Page MenuHomePhabricator

[Chronik] Add avalanche support
ClosedPublic

Authored by tobias_ruck on Apr 8 2023, 09:16.

Details

Reviewers
Fabien
Group Reviewers
Restricted Project
Commits
rABCe2ee25472045: [Chronik] Add avalanche support
Summary

Add is_final to BlockInfo and BlockMetadata, signifying whether the block has been finalized by Avalanche. Encapsulate the state in an Avalanche struct in the indexer, which would also allow us to store the state of finalized transactions.

We store the height of the last finalized block in the indexer (in RAM), and update the height on BlockFinalized from CValidationInterface.

Nomenclature: is_final instead of is_finalized, to be in line with the isfinalblock RPC.

We assume that disconnects are either on non-finalized blocks or on the last finalized block.

Depends on D13693.

Test Plan

ninja && ./test/functional/test_runner.py chronik_avalanche

Diff Detail

Event Timeline

test/functional/chronik_avalanche.py
93 ↗(On Diff #39419)

@Fabien why does the node get stuck here?

Tail of the build log:

test tx::txid::tests::test_try_from_slice ... ok
test tx::txid::tests::test_parse_fail ... ok

test result: ok. 16 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

   Doc-tests bitcoinsuite-core

running 47 tests
test src/hash.rs - hash::Hashed::Array (line 60) ... ok
test src/hash.rs - hash::Hashed::SIZE (line 47) ... ok
test src/hash.rs - hash::Hashed::as_le_bytes (line 83) ... ok
test src/block/block_hash.rs - block::block_hash::BlockHash::to_vec (line 46) ... ok
test src/hash.rs - hash::Hashed::from_be_bytes (line 93) ... ok
test src/hash.rs - hash::Hashed::from_le_bytes (line 73) ... ok
test src/hash.rs - hash::Hashed::hex_be (line 160) ... ok
test src/hash.rs - hash::Hashed::from_be_slice (line 234) ... ok
test src/hash.rs - hash::Hashed::from_be_hex (line 288) ... ok
test src/block/block_hash.rs - block::block_hash::BlockHash::to_bytes (line 31) ... ok
test src/hash.rs - hash::Hashed::from_le_hex (line 259) ... ok
test src/hash.rs - hash::Hashed::from_le_slice (line 212) ... ok
test src/hash.rs - hash::Hashed::hex_le (line 138) ... ok
test src/hash.rs - hash::Hashed::to_be_bytes (line 120) ... ok
test src/hash.rs - hash::Hashed::to_be_vec (line 195) ... ok
test src/script/opcode.rs - script::opcode::Opcode::number (line 58) ... ok
test src/hash.rs - hash::Hashed::to_le_bytes (line 108) ... ok
test src/script/opcode.rs - script::opcode::opcode_number_to_name (line 69) ... ok
test src/hash.rs - hash::Hashed::to_le_vec (line 178) ... ok
test src/script/pubkey.rs - script::pubkey::PubKey::hex (line 57) ... ok
test src/script/pubkey.rs - script::pubkey::PubKey::as_slice (line 37) ... ok
test src/script/pubkey.rs - script::pubkey::PubKey::array (line 47) ... ok
test src/script/pubkey.rs - script::pubkey::PubKey (line 13) ... ok
test src/script/pubkey_variant.rs - script::pubkey_variant::PubKeyVariant (line 14) ... ok
test src/script/script.rs - script::script::Script::bytecode (line 117) ... ok
test src/script/script.rs - script::script::Script::hex (line 139) ... ok
test src/script/script.rs - script::script::Script::is_opreturn (line 150) ... ok
test src/script/script.rs - script::script::Script::p2pk (line 67) ... ok
test src/script/script.rs - script::script::Script::p2pk_uncompressed (line 89) ... ok
test src/script/script.rs - script::script::Script::p2pkh (line 27) ... ok
test src/script/script.rs - script::script::Script::p2sh (line 47) ... ok
test src/script/script_mut.rs - script::script_mut::ScriptMut::with_capacity (line 14) ... ok
test src/script/script.rs - script::script::Script::to_vec (line 128) ... ok
test src/script/script_mut.rs - script::script_mut::ScriptMut::freeze (line 52) ... ok
test src/script/script_mut.rs - script::script_mut::ScriptMut::put_opcodes (line 25) ... ok
test src/script/script_mut.rs - script::script_mut::ScriptMut::put_bytecode (line 41) ... ok
test src/tx/tx.rs - tx::tx::Tx (line 29) - compile fail ... ok
test src/script/variant.rs - script::variant::ScriptVariant::from_type_and_payload (line 94) ... ok
test src/script/uncompressed_pubkey.rs - script::uncompressed_pubkey::UncompressedPubKey::as_slice (line 40) ... ok
test src/script/uncompressed_pubkey.rs - script::uncompressed_pubkey::UncompressedPubKey (line 13) ... ok
test src/script/uncompressed_pubkey.rs - script::uncompressed_pubkey::UncompressedPubKey::array (line 50) ... ok
test src/tx/txid.rs - tx::txid::TxId::to_bytes (line 31) ... ok
test src/script/uncompressed_pubkey.rs - script::uncompressed_pubkey::UncompressedPubKey::hex (line 60) ... ok
test src/tx/txid.rs - tx::txid::TxId::as_bytes (line 46) ... ok
test src/tx/txid.rs - tx::txid::TxId::to_vec (line 61) ... ok
test src/script/variant.rs - script::variant::ScriptVariant::to_script (line 108) ... ok
test src/tx/tx.rs - tx::tx::Tx (line 9) ... ok

test result: ok. 47 passed; 0 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.36s

ninja: build stopped: cannot make progress due to previous errors.
Build build-chronik failed with exit code 1
The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.

Failed tests logs:

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

------- Stdout: -------
2023-04-08T09:27:43.319000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20230408_092018/chronik_avalanche_224
2023-04-08T09:27:43.572000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 512, in start_nodes
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 311, 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 "/work/test/functional/test_framework/test_framework.py", line 136, in main
    self.setup()
  File "/work/test/functional/test_framework/test_framework.py", line 276, in setup
    self.setup_network()
  File "/work/test/functional/test_framework/test_framework.py", line 380, in setup_network
    self.setup_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 405, in setup_nodes
    self.start_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 515, in start_nodes
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized
2023-04-08T09:27:43.623000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/chronik_avalanche.py", line 98, in <module>
    AvalancheTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 160, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 291, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized

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

Failed tests logs:

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

------- Stdout: -------
2023-04-08T09:28:55.518000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230408_092404/chronik_avalanche_224
2023-04-08T09:28:55.771000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 512, in start_nodes
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 311, 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 "/work/test/functional/test_framework/test_framework.py", line 136, in main
    self.setup()
  File "/work/test/functional/test_framework/test_framework.py", line 276, in setup
    self.setup_network()
  File "/work/test/functional/test_framework/test_framework.py", line 380, in setup_network
    self.setup_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 405, in setup_nodes
    self.start_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 515, in start_nodes
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized
2023-04-08T09:28:55.825000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/chronik_avalanche.py", line 98, in <module>
    AvalancheTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 160, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 291, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized
====== Bitcoin ABC functional tests with the next upgrade activated: chronik_avalanche.py ======

------- Stdout: -------
2023-04-08T09:33:24.979000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230408_092858/chronik_avalanche_224
2023-04-08T09:33:25.232000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 512, in start_nodes
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 311, 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 "/work/test/functional/test_framework/test_framework.py", line 136, in main
    self.setup()
  File "/work/test/functional/test_framework/test_framework.py", line 276, in setup
    self.setup_network()
  File "/work/test/functional/test_framework/test_framework.py", line 380, in setup_network
    self.setup_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 405, in setup_nodes
    self.start_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 515, in start_nodes
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized
2023-04-08T09:33:25.286000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/chronik_avalanche.py", line 98, in <module>
    AvalancheTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 160, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 291, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized

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

move last finalized height to memory

Failed tests logs:

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

------- Stdout: -------
2023-04-08T10:16:21.590000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-without-wallet/test/tmp/test_runner_₿₵_  _20230408_101350/chronik_avalanche_224
2023-04-08T10:16:21.842000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 512, in start_nodes
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 311, 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 "/work/test/functional/test_framework/test_framework.py", line 136, in main
    self.setup()
  File "/work/test/functional/test_framework/test_framework.py", line 276, in setup
    self.setup_network()
  File "/work/test/functional/test_framework/test_framework.py", line 380, in setup_network
    self.setup_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 405, in setup_nodes
    self.start_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 515, in start_nodes
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized
2023-04-08T10:16:21.893000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/chronik_avalanche.py", line 107, in <module>
    AvalancheTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 160, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 291, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized

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

Failed tests logs:

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

------- Stdout: -------
2023-04-08T10:22:52.909000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-debug/test/tmp/test_runner_₿₵_  _20230408_101531/chronik_avalanche_224
2023-04-08T10:22:53.161000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 512, in start_nodes
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 311, 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 "/work/test/functional/test_framework/test_framework.py", line 136, in main
    self.setup()
  File "/work/test/functional/test_framework/test_framework.py", line 276, in setup
    self.setup_network()
  File "/work/test/functional/test_framework/test_framework.py", line 380, in setup_network
    self.setup_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 405, in setup_nodes
    self.start_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 515, in start_nodes
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized
2023-04-08T10:22:53.212000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/chronik_avalanche.py", line 107, in <module>
    AvalancheTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 160, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 291, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized

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

Failed tests logs:

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

------- Stdout: -------
2023-04-08T10:18:52.240000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230408_101420/chronik_avalanche_224
2023-04-08T10:18:52.492000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 512, in start_nodes
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 311, 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 "/work/test/functional/test_framework/test_framework.py", line 136, in main
    self.setup()
  File "/work/test/functional/test_framework/test_framework.py", line 276, in setup
    self.setup_network()
  File "/work/test/functional/test_framework/test_framework.py", line 380, in setup_network
    self.setup_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 405, in setup_nodes
    self.start_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 515, in start_nodes
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized
2023-04-08T10:18:52.546000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/chronik_avalanche.py", line 107, in <module>
    AvalancheTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 160, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 291, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized
====== Bitcoin ABC functional tests with the next upgrade activated: chronik_avalanche.py ======

------- Stdout: -------
2023-04-08T10:23:08.341000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-diff/test/tmp/test_runner_₿₵_  _20230408_101859/chronik_avalanche_224
2023-04-08T10:23:08.594000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 512, in start_nodes
    node.wait_for_rpc_connection()
  File "/work/test/functional/test_framework/test_node.py", line 311, 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 "/work/test/functional/test_framework/test_framework.py", line 136, in main
    self.setup()
  File "/work/test/functional/test_framework/test_framework.py", line 276, in setup
    self.setup_network()
  File "/work/test/functional/test_framework/test_framework.py", line 380, in setup_network
    self.setup_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 405, in setup_nodes
    self.start_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 515, in start_nodes
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized
2023-04-08T10:23:08.644000Z TestFramework (INFO): Stopping nodes
[node 0] Cleaning up leftover process
------- Stderr: -------
Traceback (most recent call last):
  File "/work/test/functional/chronik_avalanche.py", line 107, in <module>
    AvalancheTest().main()
  File "/work/test/functional/test_framework/test_framework.py", line 160, in main
    exit_code = self.shutdown()
  File "/work/test/functional/test_framework/test_framework.py", line 291, in shutdown
    self.stop_nodes()
  File "/work/test/functional/test_framework/test_framework.py", line 531, in stop_nodes
    node.stop_node(wait=wait, wait_until_stopped=False)
  File "/work/test/functional/test_framework/test_node.py", line 454, in stop_node
    self.stop(wait=wait)
  File "/work/test/functional/test_framework/test_node.py", line 236, in __getattr__
    assert self.rpc is not None, self._node_msg(
AssertionError: [node 0] Error: RPC not initialized

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

reconsider still doesn't seem to work

Failed tests logs:

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

------- Stdout: -------
2023-04-08T11:24:42.026000Z TestFramework (INFO): Initializing test directory /work/abc-ci-builds/build-chronik/test/tmp/test_runner_₿₵_  _20230408_111950/chronik_avalanche_224
2023-04-08T11:25:58.940000Z TestFramework.utils (ERROR): wait_until() failed. Predicate: ''''
        self.wait_until(lambda: has_finalized_tip(tip))
'''
2023-04-08T11:25:58.940000Z TestFramework (ERROR): Assertion failed
Traceback (most recent call last):
  File "/work/test/functional/test_framework/test_framework.py", line 137, in main
    self.run_test()
  File "/work/test/functional/chronik_avalanche.py", line 106, in run_test
    self.wait_until(lambda: has_finalized_tip(tip))
  File "/work/test/functional/test_framework/test_framework.py", line 709, in wait_until
    return wait_until_helper(test_function, timeout=timeout,
  File "/work/test/functional/test_framework/util.py", line 286, in wait_until_helper
    raise AssertionError(
AssertionError: Predicate ''''
        self.wait_until(lambda: has_finalized_tip(tip))
''' not true after 60.0 seconds
2023-04-08T11:25:58.991000Z TestFramework (INFO): Stopping nodes
2023-04-08T11:25:59.093000Z TestFramework (WARNING): Not cleaning up dir /work/abc-ci-builds/build-chronik/test/tmp/test_runner_₿₵_  _20230408_111950/chronik_avalanche_224
2023-04-08T11:25:59.093000Z TestFramework (ERROR): Test failed. Test logging available at /work/abc-ci-builds/build-chronik/test/tmp/test_runner_₿₵_  _20230408_111950/chronik_avalanche_224/test_framework.log
2023-04-08T11:25:59.094000Z TestFramework (ERROR): 
2023-04-08T11:25:59.094000Z TestFramework (ERROR): Hint: Call /work/test/functional/combine_logs.py '/work/abc-ci-builds/build-chronik/test/tmp/test_runner_₿₵_  _20230408_111950/chronik_avalanche_224' to consolidate all logs
2023-04-08T11:25:59.094000Z TestFramework (ERROR): 
2023-04-08T11:25:59.095000Z TestFramework (ERROR): If this failure happened unexpectedly or intermittently, please file a bug and provide a link or upload of the combined log.
2023-04-08T11:25:59.095000Z TestFramework (ERROR): https://github.com/Bitcoin-ABC/bitcoin-abc/issues
2023-04-08T11:25:59.095000Z TestFramework (ERROR):

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

Add Avalanche struct, fix + improve tests

Fabien requested changes to this revision.Apr 9 2023, 11:50

You can easily test this assumption:

We assume that disconnects are either on non-finalized blocks or on the last finalized block.

That would give more confidence in the current logic

chronik/chronik-indexer/src/avalanche.rs
14

This made me look at the code and notice that we return false on the genesis block is there was no finalization happening yet. Not that it really matters but I was curious

This revision now requires changes to proceed.Apr 9 2023, 11:50

WIP, invalidate multiple finalized blocks in a row

rebase on D13687, so we don't have to manually wait after invalidateblock/reconsiderblock

The build failed due to an unexpected infrastructure outage. The administrators have been notified to investigate. Sorry for the inconvenience.

Fix build by rebasing D13687 onto master

Fabien requested changes to this revision.Apr 12 2023, 19:24
Fabien added inline comments.
chronik/chronik-indexer/src/indexer.rs
132 ↗(On Diff #39641)

That's duplicated ?

chronik/chronik-indexer/src/query/txs.rs
49 ↗(On Diff #39641)

That's an unrelated change

This revision now requires changes to proceed.Apr 12 2023, 19:24
test/functional/chronik_avalanche.py
58 ↗(On Diff #39641)

You can now use can_find_inv_in_poll from avatools

test/functional/chronik_avalanche.py
51 ↗(On Diff #39641)

remove the timeout

test/functional/chronik_avalanche.py
51 ↗(On Diff #39641)

Good catch

Use can_find_inv_in_poll, remove some unnecessary stuff

This revision is now accepted and ready to land.Apr 13 2023, 08:35
This revision was automatically updated to reflect the committed changes.