Skip to content
This repository was archived by the owner on Jan 27, 2026. It is now read-only.

Improvement: chainsync asynchronism#340

Closed
gsegatti wants to merge 1 commit into
PrimeIntellect-ai:developfrom
gsegatti:improv/sync
Closed

Improvement: chainsync asynchronism#340
gsegatti wants to merge 1 commit into
PrimeIntellect-ai:developfrom
gsegatti:improv/sync

Conversation

@gsegatti
Copy link
Copy Markdown
Contributor

@JannikSt JannikSt requested a review from Copilot June 11, 2025 10:33
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR improves the asynchronism in the chainsync functionality and related contract interactions by refining error types, enhancing error handling, and introducing concurrent processing for node synchronization.

  • Updated error return types in compute registry and compute pool contracts to include Send + Sync.
  • Enhanced error handling in the compute pool’s is_node_blacklisted function.
  • Refactored chainsync code to perform concurrent node syncing using futures::stream::iter.
  • Added the futures dependency in Cargo.toml.

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

File Description
crates/shared/src/web3/contracts/implementations/compute_registry_contract.rs Updated error return type to enforce thread-safety with Send + Sync.
crates/shared/src/web3/contracts/implementations/compute_pool_contract.rs Improved error handling for node blacklist checks.
crates/discovery/src/chainsync/sync.rs Refactored sync_single_node to use async join and concurrent processing with for_each_concurrent.
crates/discovery/Cargo.toml Included futures dependency to support asynchronous stream operations.
Comments suppressed due to low confidence (3)

crates/shared/src/web3/contracts/implementations/compute_pool_contract.rs:187

  • Consider using a consistent error conversion helper to wrap these string errors with more contextual information.
let first_value = result.first().ok_or("Empty response when checking if node is blacklisted")?;

crates/discovery/src/chainsync/sync.rs:65

  • Consider using the log crate (e.g., error!) for error reporting instead of eprintln, in order to maintain consistent logging throughout the code.
eprintln!("Error retrieving node info: {}", e);

crates/discovery/src/chainsync/sync.rs:110

  • [nitpick] It may be beneficial to include additional context (e.g., node identifier) in the error logs within the concurrent stream to improve debugging clarity.
futures::stream::iter(nodes).for_each_concurrent(10, |node| {

@JannikSt
Copy link
Copy Markdown
Member

JannikSt commented Jul 8, 2025

See other PR for feedback - unfortunately have to close this PR.
Thank you again for your contribution(s)!!

@JannikSt JannikSt closed this Jul 8, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants