From 0d1f434bdf3e09768334eb6af6e25512a3ba03ac Mon Sep 17 00:00:00 2001 From: Arya Date: Thu, 6 Jun 2024 23:38:56 -0400 Subject: [PATCH] adds TODOs for testing --- zebra-rpc/src/sync.rs | 2 +- zebrad/tests/acceptance.rs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/zebra-rpc/src/sync.rs b/zebra-rpc/src/sync.rs index 96b31d49c00..8c7c6c5a4e3 100644 --- a/zebra-rpc/src/sync.rs +++ b/zebra-rpc/src/sync.rs @@ -25,7 +25,7 @@ use crate::{ /// How long to wait between calls to `getbestblockhash` when it returns an error or the block hash /// of the current chain tip in the process that's syncing blocks from Zebra. -const POLL_DELAY: Duration = Duration::from_millis(100); +const POLL_DELAY: Duration = Duration::from_millis(200); /// Syncs non-finalized blocks in the best chain from a trusted Zebra node's RPC methods. #[derive(Debug)] diff --git a/zebrad/tests/acceptance.rs b/zebrad/tests/acceptance.rs index 6994b3bf05d..594b35d1646 100644 --- a/zebrad/tests/acceptance.rs +++ b/zebrad/tests/acceptance.rs @@ -3198,7 +3198,14 @@ async fn trusted_chain_sync_handles_forks_correctly() -> Result<()> { .await? .map_err(|err| eyre!(err))?; - // Submit some blocks on the best chain + // TODO: + // - Submit blocks while checking that `ChainTipChange` shows the chain growing before submitting the next block + // - Submit several blocks before checking that `ChainTipChange` has the latest block hash and is a `TipAction::Reset` + // - Check that `getblock` RPC returns the same block as the read state for every height + // - Submit more blocks with an older block template (and a different nonce so the hash is different) to trigger a chain reorg + // - Check that `ChainTipChange` isn't being updated until the best chain changes + // - Check that the first `ChainTipChange` `TipAction` is a `TipAction::Reset` + // - Check that `getblock` RPC returns the same block as the read state for every height child.kill(false)?; let output = child.wait_with_output()?; @@ -3208,5 +3215,10 @@ async fn trusted_chain_sync_handles_forks_correctly() -> Result<()> { output.assert_failure()?; + // TODO: + // - Start another Zebra testchild on Testnet or Mainnet + // - Wait for it to start syncing blocks from the network + // - Check that `LatestChainTip` is being updated with the newly synced finalized blocks + Ok(()) }