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

core: Remove contactsPresent from Registration #7952

Merged
merged 1 commit into from
Jan 26, 2025
Merged
Show file tree
Hide file tree
Changes from all 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
155 changes: 72 additions & 83 deletions core/proto/core.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion core/proto/core.proto
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ message Registration {
int64 id = 1;
bytes key = 2;
repeated string contact = 3;
bool contactsPresent = 4;
reserved 4; // Previously contactsPresent
string agreement = 5;
reserved 6; // Previously initialIP
reserved 7; // Previously createdAtNS
Expand Down
17 changes: 6 additions & 11 deletions grpc/pb-marshalling.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,10 +225,6 @@ func RegistrationToPB(reg core.Registration) (*corepb.Registration, error) {
return nil, err
}
var contacts []string
// Since the default value of corepb.Registration.Contact is a slice
// we need a indicator as to if the value is actually important on
// the other side (pb -> reg).
contactsPresent := reg.Contact != nil
if reg.Contact != nil {
contacts = *reg.Contact
}
Expand All @@ -241,13 +237,12 @@ func RegistrationToPB(reg core.Registration) (*corepb.Registration, error) {
}

return &corepb.Registration{
Id: reg.ID,
Key: keyBytes,
Contact: contacts,
ContactsPresent: contactsPresent,
Agreement: reg.Agreement,
CreatedAt: createdAt,
Status: string(reg.Status),
Id: reg.ID,
Key: keyBytes,
Contact: contacts,
Agreement: reg.Agreement,
CreatedAt: createdAt,
Status: string(reg.Status),
}, nil
}

Expand Down
33 changes: 15 additions & 18 deletions mocks/sa.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,12 +74,11 @@ func (sa *StorageAuthorityReadOnly) GetRegistration(_ context.Context, req *sapb
}

goodReg := &corepb.Registration{
Id: req.Id,
Key: []byte(test1KeyPublicJSON),
Agreement: agreementURL,
Contact: []string{"mailto:[email protected]"},
ContactsPresent: true,
Status: string(core.StatusValid),
Id: req.Id,
Key: []byte(test1KeyPublicJSON),
Agreement: agreementURL,
Contact: []string{"mailto:[email protected]"},
Status: string(core.StatusValid),
}

// Return a populated registration with contacts for ID == 1 or ID == 5
Expand Down Expand Up @@ -136,12 +135,11 @@ func (sa *StorageAuthorityReadOnly) GetRegistrationByKey(_ context.Context, req

if bytes.Equal(req.Jwk, []byte(test1KeyPublicJSON)) {
return &corepb.Registration{
Id: 1,
Key: req.Jwk,
Agreement: agreementURL,
Contact: contacts,
ContactsPresent: true,
Status: string(core.StatusValid),
Id: 1,
Key: req.Jwk,
Agreement: agreementURL,
Contact: contacts,
Status: string(core.StatusValid),
}, nil
}

Expand Down Expand Up @@ -171,12 +169,11 @@ func (sa *StorageAuthorityReadOnly) GetRegistrationByKey(_ context.Context, req
if bytes.Equal(req.Jwk, []byte(test3KeyPublicJSON)) {
// deactivated registration
return &corepb.Registration{
Id: 2,
Key: req.Jwk,
Agreement: agreementURL,
Contact: contacts,
ContactsPresent: true,
Status: string(core.StatusDeactivated),
Id: 2,
Key: req.Jwk,
Agreement: agreementURL,
Contact: contacts,
Status: string(core.StatusDeactivated),
}, nil
}

Expand Down
Loading
Loading