Skip to content

Commit 6fbf929

Browse files
committed
Revert "Fix block subscription issues when forking"
This reverts commit 9475b5e.
1 parent 9475b5e commit 6fbf929

File tree

1 file changed

+12
-25
lines changed
  • crates/anvil-polkadot/src/api_server

1 file changed

+12
-25
lines changed

crates/anvil-polkadot/src/api_server/server.rs

Lines changed: 12 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1967,7 +1967,6 @@ async fn create_revive_rpc_client(
19671967
block_provider.clone(),
19681968
task_spawn_handle.clone(),
19691969
keep_latest_n_blocks,
1970-
in_fork_mode,
19711970
)
19721971
.await
19731972
{
@@ -1994,7 +1993,6 @@ async fn create_revive_rpc_client(
19941993
block_provider,
19951994
task_spawn_handle,
19961995
keep_latest_n_blocks,
1997-
in_fork_mode,
19981996
)
19991997
.await
20001998
.map(Some)
@@ -2007,7 +2005,6 @@ async fn create_revive_client_impl(
20072005
block_provider: SubxtBlockInfoProvider,
20082006
task_spawn_handle: SpawnTaskHandle,
20092007
keep_latest_n_blocks: Option<usize>,
2010-
in_fork_mode: bool,
20112008
) -> Result<EthRpcClient> {
20122009
let pool = SqlitePoolOptions::new()
20132010
.max_connections(1)
@@ -2041,28 +2038,18 @@ async fn create_revive_client_impl(
20412038

20422039
// Capacity is chosen using random.org
20432040
eth_rpc_client.set_block_notifier(Some(tokio::sync::broadcast::channel::<H256>(50).0));
2044-
2045-
// In fork mode, skip block subscription to avoid ReceiptDataNotFound errors
2046-
// when processing blocks from the remote chain. In fork mode, we create our own
2047-
// local blocks using manual-seal, and don't need to subscribe to remote blocks.
2048-
if !in_fork_mode {
2049-
let eth_rpc_client_clone = eth_rpc_client.clone();
2050-
task_spawn_handle.spawn("block-subscription", "None", async move {
2051-
let eth_rpc_client = eth_rpc_client_clone;
2052-
let best_future =
2053-
eth_rpc_client.subscribe_and_cache_new_blocks(SubscriptionType::BestBlocks);
2054-
let finalized_future =
2055-
eth_rpc_client.subscribe_and_cache_new_blocks(SubscriptionType::FinalizedBlocks);
2056-
let res = tokio::try_join!(best_future, finalized_future).map(|_| ());
2057-
if let Err(err) = res {
2058-
panic!("Block subscription task failed: {err:?}")
2059-
}
2060-
});
2061-
} else {
2062-
tracing::info!(
2063-
"Skipping block subscription in fork mode - blocks will be created locally via manual-seal"
2064-
);
2065-
}
2041+
let eth_rpc_client_clone = eth_rpc_client.clone();
2042+
task_spawn_handle.spawn("block-subscription", "None", async move {
2043+
let eth_rpc_client = eth_rpc_client_clone;
2044+
let best_future =
2045+
eth_rpc_client.subscribe_and_cache_new_blocks(SubscriptionType::BestBlocks);
2046+
let finalized_future =
2047+
eth_rpc_client.subscribe_and_cache_new_blocks(SubscriptionType::FinalizedBlocks);
2048+
let res = tokio::try_join!(best_future, finalized_future).map(|_| ());
2049+
if let Err(err) = res {
2050+
panic!("Block subscription task failed: {err:?}")
2051+
}
2052+
});
20662053

20672054
Ok(eth_rpc_client)
20682055
}

0 commit comments

Comments
 (0)