Skip to content

Conversation

@squirer
Copy link
Contributor

@squirer squirer commented Dec 4, 2025

Purpose

Create the Verify presentation API initial flow

Changes

_Describe the changes that were needed.

Checklist

  • My code follows the style of this project.
  • The code compiles without warnings.
  • I have performed a self-review of the changes.
  • I have documented my code, in particular the intent of the
    hard-to-understand areas.
  • (If necessary) I have updated the CHANGELOG.

@squirer squirer changed the base branch from main to feature/RUN-36-credential-verification-service December 4, 2025 15:27
@squirer squirer marked this pull request as ready for review December 5, 2025 15:46
};
Ok(Json(verify_presentation_response))
}
Err(e) => Err(ServerError::PresentationVerifificationFailed(e)),
Copy link
Member

Choose a reason for hiding this comment

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

Can we similar to the other endpoint, check if there is an account nonce mismatch. If that is the case, refresh the nonce in the state and re-submit the tx.


match presentation_verification_data_result {
Ok(presentation_verification_data) => {
let result = match presentation_verification_data.verification_result {
Copy link
Member

Choose a reason for hiding this comment

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

The account nonce needs to be updated in the state. Otherwise the next tx sent by the service will fail.

tracing::error!("Presentaion Verification Failed: {error}.");
(
StatusCode::BAD_REQUEST,
Json("Presentation failed its verification.".to_string()),
Copy link
Member

Choose a reason for hiding this comment

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

I think it would be good to let the user know why the verification failed in a bad_request case but not in the internal_error case.

}
// TODO - here needs to be expanded with some code reasoning probably. Blanket 400 for now
ServerError::PresentationVerifificationFailed(error) => {
tracing::error!("Presentaion Verification Failed: {error}.");
Copy link
Member

@DOBEN DOBEN Dec 5, 2025

Choose a reason for hiding this comment

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

If it is bad request, then nothing is wrong with our service, so I would only warn in that case.

Suggested change
tracing::error!("Presentaion Verification Failed: {error}.");
tracing::warn!("Presentaion Verification Failed: {error}.");

As you TODO already mentions, we should distinguish between some internal_errors and bad_request errors here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Im not sure I agree with the warning level here, maybe I need more convincing...If we reach a case where there is a VerifyError occurring for some presentation that is being verified, it feels more like an error than a warning and the reason I say this is because the VerifyError enum lists out a bunch of cases that should for the most part never happen right?

Like in the happy path flow if the user has created and proven their Verification Request and created a valid Verifiable Presentation, then getting to this point is likely something that should be announced as an ERROR log in which case something needs a bit further investigating/tuning.

This is my gut feeling, and I set BAD_REQUEST as I think we need to define the error structure we want with codes and descriptions before handling case by case.

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