Skip to content

Reuse one SubxtChainClient struct that implements all chain client traits in provider-node#159

Open
franciscoaguirre wants to merge 3 commits into
devfrom
reuse-subxt-client
Open

Reuse one SubxtChainClient struct that implements all chain client traits in provider-node#159
franciscoaguirre wants to merge 3 commits into
devfrom
reuse-subxt-client

Conversation

@franciscoaguirre

Copy link
Copy Markdown
Collaborator

Keeps the separation of the interfaces but deduplicates code

bucket_ids.push(bucket_id);
}

if entry_count > 0 {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

hmm, why not use just bucket_ids.len() here?

entry_count is confusing, it is incremented at the beginning between various continue;, so it is not obvious what entry_count means - success, correct, all, partial?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I moved this exactly as it was before in order to not change the behavior in any way. I'll make follow-up PRs simplifying the functions themselves

@bkontur

bkontur commented Jun 11, 2026

Copy link
Copy Markdown
Collaborator

@franciscoaguirre please, check also this comment: https://github.com/paritytech/web3-storage/pull/147/changes#r3394340663 - we should check and refactor all the OnlineConfig usages

@franciscoaguirre

Copy link
Copy Markdown
Collaborator Author

@bkontur I wanted to keep this PR small and just do this one refactor but I can create a PR on top that tries to reuse client instantiation

Comment thread provider-node/src/lib.rs
/// Provider account ID (SS58 encoded)
pub provider_id: String,
/// Signing keypair (optional, for dev/testing)
pub keypair: Option<sr25519::Pair>,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Question: Why do we use sp_core::sr25519::Pair here but in challenge_responder, agreemeent_coordinator, replica_sync_coordinator use subxt_signer::sr25519::Keypair ?

I believe we can refactor all to use subxt_signer::sr25519::Keypair so that there will not pub async fn connect(chain_ws_url: &str, seed: &str) or pub async fn connect(chain_ws_url: &str, keypair: &sr25519::Pair)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants