Skip to content

Add VssClient::get_version#61

Open
tankyleo wants to merge 2 commits into
lightningdevkit:mainfrom
tankyleo:2026-05-get-version
Open

Add VssClient::get_version#61
tankyleo wants to merge 2 commits into
lightningdevkit:mainfrom
tankyleo:2026-05-get-version

Conversation

@tankyleo
Copy link
Copy Markdown
Contributor

@tankyleo tankyleo commented May 6, 2026

This new method gets the version of the VSS API served by the server. The method depends on the /version endpoint recently added to the VSS API.

If this method is called against a VSS server that does not serve this endpoint, a VssError::InternalError will be returned. Upstream libraries should then communicate to users that the VSS server they are talking to is not supported.

@ldk-reviews-bot
Copy link
Copy Markdown

ldk-reviews-bot commented May 6, 2026

👋 Thanks for assigning @tnull as a reviewer!
I'll wait for their review and will help manage the review process.
Once they submit their review, I'll check if a second reviewer would be helpful.

@tankyleo tankyleo requested a review from tnull May 6, 2026 02:17
Copy link
Copy Markdown
Contributor

@tnull tnull left a comment

Choose a reason for hiding this comment

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

One comment for now, please feel free to update and re-request review once we discussed the general approach on vss-server.

Comment thread build.rs
#[cfg(genproto)]
fn generate_protos() {
download_file(
"https://raw.githubusercontent.com/lightningdevkit/vss-server/022ee5e92debb60516438af0a369966495bfe595/proto/vss.proto",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

While doing this on the server is fine, here I'd not want to do it until we have a better solution in place. Maybe we should go through with merging repos now that both are rust codebases, or have both depend on a shared vss-proto crate, to ensure version compat?

We now read `vss.proto` from the local repository instead of downloading
it from a specific commit on github.

We will use protocol versioning, tags, and releases to coordinate
clients and servers.
@tankyleo tankyleo force-pushed the 2026-05-get-version branch 2 times, most recently from fdc0eb2 to c8d01d8 Compare May 20, 2026 05:52
We assert that the VSS protocol version matches on all responses
returned from the server, including errors.
@tankyleo tankyleo force-pushed the 2026-05-get-version branch from c8d01d8 to c55fa29 Compare May 20, 2026 05:54
@tankyleo tankyleo requested a review from tnull May 20, 2026 06:00
Comment thread src/error.rs
f,
"The VSS server and client speak different versions of the \
VSS protocol, the server serves version {}, client expects \
{}",
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm, do we need to sanitize this string before printing or bubbling up the error, or are we expecting this to happen at a higher level anyways?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

hmm thank you yes, I'm thinking we keep validation here minimal and just report the mismatch, together with the different header values ? So as to keep Client as lean as possible.

Comment thread src/client.rs

let response = self.client.send_async(http_request).await?;
// Return early in case of version mismatch, this issue must be solved first.
if response.headers.get(PROTOCOL_VERSION_HEADER).map(String::as_str)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Do we need / want to maintain backwards compatibility, i.e., interpret absence of the versioning field as version 0? Or intentionally not?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

If we remain backwards compatible, then we could break the upcoming PaginatedKVStoreAPI, and serve keys not in creation order.

That is why I think the VSS client should reject any VSS servers that don't set the version header.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I'll sleep on it, strict equality may be too restrictive. That being said in the future, we could ship version 2 in vss-server on a different set of endpoints from the existing /getObject etc..., so that a single instances may serve clients on both versions at the same time.

@tankyleo tankyleo requested a review from tnull May 20, 2026 16:44
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