Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add DSN client to subspace-gateway binary #3137

Merged
merged 5 commits into from
Oct 21, 2024
Merged

Add DSN client to subspace-gateway binary #3137

merged 5 commits into from
Oct 21, 2024

Conversation

teor2345
Copy link
Contributor

@teor2345 teor2345 commented Oct 17, 2024

This PR adds a DSN client implementation to the subspace-gateway binary.

Code contributor checklist:

@teor2345 teor2345 added the enhancement New feature or request label Oct 17, 2024
@teor2345 teor2345 self-assigned this Oct 17, 2024
Base automatically changed from sub-gateway to main October 17, 2024 07:43
@nazar-pc

This comment was marked as resolved.

@teor2345

This comment was marked as resolved.

@nazar-pc

This comment was marked as resolved.

@teor2345
Copy link
Contributor Author

teor2345 commented Oct 20, 2024

Yeah, that defines the network you're connecting to in order to not pull pieces from the wrong network by accident. Farmer connects to node's RPC to retrieve that information alongside many other things. I think you'll need to do something similar because for piece verification purposes you'll also need segment commitments, which I think would be the easiest to get from the node rather than from DSN every time you restart.

That makes sense. !I might hard code some values in this PR just to make sure everything is working, and to get the RPC server merged. Then in my next PR I’ll fetch the genesis hash and segment commitments from the node, and implement piece verification.

Edit: It was easier just to implement the RPC client.

@teor2345
Copy link
Contributor Author

Alright, that should work as expected. I'll go rebase the RPC PR now.

Copy link
Member

@nazar-pc nazar-pc left a comment

Choose a reason for hiding this comment

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

No blockers, just a few suggestions

Comment on lines +21 to +27
impl RpcNodeClient {
/// Create a new instance of [`NodeClient`].
pub async fn new(url: &str) -> Result<Self, JsonError> {
let client = Arc::new(WsClientBuilder::default().build(url).await?);
Ok(Self { client })
}
}
Copy link
Member

Choose a reason for hiding this comment

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

This is fine for now, but it is a hack. I think we'll need a separate RPC for these purposes.

crates/subspace-gateway/src/commands/run.rs Show resolved Hide resolved
@teor2345 teor2345 added this pull request to the merge queue Oct 21, 2024
Copy link
Member

@shamil-gadelshin shamil-gadelshin left a comment

Choose a reason for hiding this comment

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

Makes sense overall. I suggested adding a parameter to the DSN config.

/// Configuration for network stack
#[derive(Debug, Parser)]
pub(crate) struct NetworkArgs {
/// WebSocket RPC URL of the Subspace node to connect to.
Copy link
Member

Choose a reason for hiding this comment

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

listen-on is always helpful for local debugging as well as for setting up some cloud infrastructure. I'd add this parameter.

Merged via the queue into main with commit bfd967e Oct 21, 2024
10 checks passed
@teor2345 teor2345 deleted the gateway-dsn branch October 21, 2024 10:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants