Skip to content

Conversation

@tankyleo
Copy link
Contributor

This is a clone of the ldk-server logger

@ldk-reviews-bot
Copy link

ldk-reviews-bot commented Jan 22, 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 January 22, 2026 08:05
@tankyleo
Copy link
Contributor Author

Based on #86 thought you'd want to take a look tnull given your past debugging sessions against VSS.

tokio::spawn(async move {
if let Err(e) = connection.await {
eprintln!("Connection error: {}", e);
warn!("Connection error: {}", e);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this recoverable? error then?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We can recover using fn ensure_connected if this happens on one of our 10 long-lived connections to the database.

Copy link
Contributor Author

@tankyleo tankyleo Jan 22, 2026

Choose a reason for hiding this comment

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

let me know if you would rather use error here it is true that if this happens during startup we do not recover.

In case we fail during startup we do have the error!("Failed to start postgres backend"); messages at the error level.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I think error would be preferable in this case here, too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Hmm I'm not quite fully onboard yet can you explain further ? Currently I don't want to add an error log after launching the main service loop for something we can recover from.

tokio = { version = "1.38.0", default-features = false, features = ["rt", "macros"] }
native-tls = { version = "0.2.14", default-features = false }
postgres-native-tls = { version = "0.5.2", default-features = false, features = ["runtime"] }
log = "0.4.29"
Copy link
Contributor

Choose a reason for hiding this comment

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

Disable default features?

auth
} else {
println!("No authentication method configured, all storage with the same store id will be commingled.");
warn!("No authentication method configured, all storage with the same store id will be commingled.");
Copy link
Contributor

Choose a reason for hiding this comment

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

I do start to wonder if we should only expose this behind a testing feature or cfg flag?

Copy link
Contributor Author

@tankyleo tankyleo Jan 22, 2026

Choose a reason for hiding this comment

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

Now only available via cargo run --no-default-features --features testing see below

Copy link
Contributor

Choose a reason for hiding this comment

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

Could you expand why a feature is preferable to a cfg flag here? Features are meant to be user-faced, while cfg flag is really more development-oriented, and I'm leaning that NoopAuthorizer is rather the latter, i.e., should only ever be used by us / our unit tests, maybe. Everybody else should even be testing against whatever auth impl they run in production?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for the context switched to the cfg flag below

store: Arc<dyn KvStore>, user_token: String, request: GetObjectRequest,
) -> Result<GetObjectResponse, VssError> {
store.get(user_token, request).await
trace!("handling GetObject request with store_id {}", request.store_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it worth logging truncated key values to give an indication what is being written/read?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I want to be careful with logging what could be sensitive information. Won't the keys all be obfuscated anyway via SorableBuilder in LDK-Node ? If so an operator of vss-server wouldn't get much visibility into what is getting stored.

Copy link
Contributor

Choose a reason for hiding this comment

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

I want to be careful with logging what could be sensitive information. Won't the keys all be obfuscated anyway via SorableBuilder in LDK-Node ?

Yes, they will be obfuscated and hence logging truncated keys should be fine. It will allow to somewhat correlate with the client side if we need to debug something though.

Copy link
Contributor Author

@tankyleo tankyleo Jan 23, 2026

Choose a reason for hiding this comment

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

Sounds good I added the same logging as vss-client below, and chose to log the full keys instead of the truncated keys since these are obfuscated, and want to maintain consistent logs between vss-client and vss-server.

@tankyleo tankyleo self-assigned this Jan 22, 2026
@tankyleo tankyleo moved this to Goal: Merge in Weekly Goals Jan 22, 2026
@tankyleo tankyleo requested a review from tnull January 22, 2026 23:41
@tnull tnull removed their request for review January 23, 2026 08:19
`NoopAuthorizer` is now only accessible via
`RUSTFLAGS="--cfg noop_authorizer" cargo run --no-default-features`.

We want to discourage our users from ever using `NoopAuthorizer`.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Goal: Merge

Development

Successfully merging this pull request may close these issues.

3 participants