Skip to content
This repository has been archived by the owner on Dec 12, 2024. It is now read-only.

fixing namespace seeding issue #241

Merged
merged 7 commits into from
Jan 9, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/service/credential/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ func (s Service) CreateCredential(request CreateCredentialRequest) (*CreateCrede
func getStatusListCredential(s Service, issuerID string, schemaID string) (*credential.VerifiableCredential, error) {
storedStatusListCreds, err := s.storage.GetStatusListCredentialsByIssuerAndSchema(issuerID, schemaID)
if err != nil {
return nil, util.LoggingNewErrorf("problem with getting status list credential for issuer: %s schema: %s", issuerID, schemaID)
logrus.Warnf("problem with getting status list credential for issuer: %s schema: %s. Continuing because this could be first time accessing this pair...", issuerID, schemaID)
Copy link
Member

Choose a reason for hiding this comment

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

logrus.WithError(err).Warnf(...

}

// This should never happen, there should always be only 1 status list credential per <issuer,schema> pair
Expand Down
19 changes: 0 additions & 19 deletions pkg/service/credential/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,25 +78,6 @@ func NewCredentialStorage(db storage.ServiceStorage) (*Storage, error) {
return nil, errors.New("bolt db reference is nil")
}

// TODO: (Neal) there is a current bug with our Bolt implementation where if we do a GET without anything in the db it will throw an error
// Doing initial writes and then deleting will "warm up" our database and when we do a GET after that it will not crash and return empty list
// https://github.com/TBD54566975/ssi-service/issues/176
if err := db.Write(credentialNamespace, fakeKey, nil); err != nil {
return nil, util.LoggingErrorMsg(err, "problem writing status initial write to db")

}
if err := db.Delete(credentialNamespace, fakeKey); err != nil {
return nil, util.LoggingErrorMsg(err, "problem with initial delete to db")
}

if err := db.Write(statusListCredentialNamespace, fakeKey, nil); err != nil {
return nil, util.LoggingErrorMsg(err, "problem writing status initial write to db")
}

if err := db.Delete(statusListCredentialNamespace, fakeKey); err != nil {
return nil, util.LoggingErrorMsg(err, "problem with initial delete to db")
}

Comment on lines -81 to -99
Copy link
Contributor

Choose a reason for hiding this comment

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

😍

randUniqueList := randomUniqueNum(bitStringLength)
uniqueNumBytes, err := json.Marshal(randUniqueList)
if err != nil {
Expand Down