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

attestation: add name to Validator as unique identifier #1095

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jmxnzo
Copy link
Contributor

@jmxnzo jmxnzo commented Dec 19, 2024

This PR is a follow-up on #1027 and aims to enhance the logging of the different validation processes on the coordinator to reach better readability of the logs.

  • Name was introduced as unique identifier in Validator struct and mapping to manifest.json, following the naming convention:
    <attestation>-<reference-values-index>[-<product>]
    The index corresponds to the position of the reference value separated by attestation type in manifest.json.
  • It was ensured that if all validators fail, the joined error message is printed and the formatting was reworked for readability.
  • Single validation failures are printed on DEBUG only instead of ERROR level using the validator name and nonce.

@jmxnzo jmxnzo added the no changelog PRs not listed in the release notes label Dec 19, 2024
@jmxnzo jmxnzo force-pushed the logging/attestation-jla branch from c5805b5 to dde0de0 Compare December 20, 2024 09:22
@jmxnzo jmxnzo changed the title attestation: add name to Validator as unique identifier and attestation: add name to Validator as unique identifier Dec 20, 2024
@jmxnzo jmxnzo force-pushed the logging/attestation-jla branch from dde0de0 to e243f98 Compare December 20, 2024 09:52
@jmxnzo
Copy link
Contributor Author

jmxnzo commented Dec 20, 2024

Wait for merge of #1082

@jmxnzo jmxnzo force-pushed the logging/attestation-jla branch from e243f98 to 98e66b7 Compare December 20, 2024 10:01
@jmxnzo jmxnzo marked this pull request as ready for review December 20, 2024 10:03
@jmxnzo jmxnzo requested a review from burgerdev as a code owner December 20, 2024 10:03
coordinator/internal/authority/credentials.go Outdated Show resolved Hide resolved
coordinator/internal/authority/credentials.go Outdated Show resolved Hide resolved
internal/atls/atls.go Outdated Show resolved Hide resolved
internal/atls/atls.go Outdated Show resolved Hide resolved
internal/attestation/snp/validator.go Outdated Show resolved Hide resolved
sdk/common.go Outdated Show resolved Hide resolved
@jmxnzo jmxnzo requested a review from burgerdev December 23, 2024 13:24
@@ -248,7 +250,7 @@ func verifyEmbeddedReport(validators []Validator, cert *x509.Certificate, peerPu
return nil
}
// Otherwise, we'll keep track of the error and continue with the next validator.
retErr = errors.Join(retErr, fmt.Errorf("validator %s failed: %w", validator.OID(), validationErr))
retErr = errors.Join(retErr, fmt.Errorf(" validator %s failed: %w ||", validator.String(), validationErr))
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
retErr = errors.Join(retErr, fmt.Errorf(" validator %s failed: %w ||", validator.String(), validationErr))
retErr = errors.Join(retErr, fmt.Errorf(" validator %s failed: %w", validator.String(), validationErr))

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Imo, the double dash serves better readability of the joined error, because we have no specific formatting implemented for now. But i can drop this, if it seems unnecessary.

Copy link
Member

Choose a reason for hiding this comment

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

errors are already joined using newlines: https://cs.opensource.google/go/go/+/refs/tags/go1.23.4:src/errors/join.go;l=52-54
adding custom formatting here isn't idiomatic

@@ -260,6 +262,11 @@ func verifyEmbeddedReport(validators []Validator, cert *x509.Certificate, peerPu
return ErrNoMatchingValidators
}

// The joined error should reveal the atls nonce once to maintain readability.
if retErr != nil {
retErr = fmt.Errorf("AtlsConnectionNonce: %s || %w", hex.EncodeToString(nonce), retErr)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
retErr = fmt.Errorf("AtlsConnectionNonce: %s || %w", hex.EncodeToString(nonce), retErr)
retErr = fmt.Errorf("with AtlsConnectionNonce %s: %w", hex.EncodeToString(nonce), retErr)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no changelog PRs not listed in the release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants