X Tutup
Skip to content

Commit f9fd977

Browse files
authored
Remove SerialExists. (letsencrypt#4976)
It no longer... exists. Fixes letsencrypt#4943
1 parent 4ba537f commit f9fd977

File tree

7 files changed

+48
-149
lines changed

7 files changed

+48
-149
lines changed

core/interfaces.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,6 @@ type StorageGetter interface {
134134
GetValidOrderAuthorizations2(ctx context.Context, req *sapb.GetValidOrderAuthorizationsRequest) (*sapb.Authorizations, error)
135135
CountInvalidAuthorizations2(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest) (*sapb.Count, error)
136136
GetValidAuthorizations2(ctx context.Context, req *sapb.GetValidAuthorizationsRequest) (*sapb.Authorizations, error)
137-
SerialExists(ctx context.Context, req *sapb.Serial) (*sapb.Exists, error)
138137
KeyBlocked(ctx context.Context, req *sapb.KeyBlockedRequest) (*sapb.Exists, error)
139138
}
140139

grpc/sa-wrappers.go

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -478,17 +478,6 @@ func (sas StorageAuthorityClientWrapper) DeactivateAuthorization2(ctx context.Co
478478
return nil, err
479479
}
480480

481-
func (sas StorageAuthorityClientWrapper) SerialExists(ctx context.Context, req *sapb.Serial) (*sapb.Exists, error) {
482-
res, err := sas.inner.SerialExists(ctx, req)
483-
if err != nil {
484-
return nil, err
485-
}
486-
if res == nil || res.Exists == nil {
487-
return nil, errIncompleteResponse
488-
}
489-
return res, nil
490-
}
491-
492481
func (sac StorageAuthorityClientWrapper) AddBlockedKey(ctx context.Context, req *sapb.AddBlockedKeyRequest) (*corepb.Empty, error) {
493482
// All return checking is done at the call site
494483
return sac.inner.AddBlockedKey(ctx, req)
@@ -892,13 +881,6 @@ func (sas StorageAuthorityServerWrapper) DeactivateAuthorization2(ctx context.Co
892881
return sas.inner.DeactivateAuthorization2(ctx, req)
893882
}
894883

895-
func (sas StorageAuthorityServerWrapper) SerialExists(ctx context.Context, req *sapb.Serial) (*sapb.Exists, error) {
896-
if req == nil || req.Serial == nil {
897-
return nil, errIncompleteRequest
898-
}
899-
return sas.inner.SerialExists(ctx, req)
900-
}
901-
902884
func (sas StorageAuthorityServerWrapper) AddBlockedKey(ctx context.Context, req *sapb.AddBlockedKeyRequest) (*corepb.Empty, error) {
903885
// All request checking is done in the method
904886
return sas.inner.AddBlockedKey(ctx, req)

mocks/mocks.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -641,10 +641,6 @@ func (sa *StorageAuthority) GetPendingAuthorization2(ctx context.Context, req *s
641641
return nil, nil
642642
}
643643

644-
func (sa *StorageAuthority) SerialExists(ctx context.Context, req *sapb.Serial) (*sapb.Exists, error) {
645-
return nil, nil
646-
}
647-
648644
var (
649645
authzIdValid = int64(1)
650646
authzIdPending = int64(2)

sa/proto/sa.pb.go

Lines changed: 48 additions & 88 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

sa/proto/sa.proto

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ service StorageAuthority {
4646
rpc NewAuthorizations2(AddPendingAuthorizationsRequest) returns (Authorization2IDs) {}
4747
rpc FinalizeAuthorization2(FinalizeAuthorizationRequest) returns (core.Empty) {}
4848
rpc DeactivateAuthorization2(AuthorizationID2) returns (core.Empty) {}
49-
rpc SerialExists(Serial) returns (Exists) {}
5049
rpc AddBlockedKey(AddBlockedKeyRequest) returns (core.Empty) {}
5150
}
5251

sa/sa.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1744,20 +1744,6 @@ func (ssa *SQLStorageAuthority) GetValidAuthorizations2(ctx context.Context, req
17441744
return authzModelMapToPB(authzMap)
17451745
}
17461746

1747-
// SerialExists returns a bool indicating whether the provided serial
1748-
// exists in the serial table. This is currently only used to determine
1749-
// if a serial passed to ca.GenerateOCSP is one which we have previously
1750-
// generated a certificate for.
1751-
func (ssa *SQLStorageAuthority) SerialExists(ctx context.Context, req *sapb.Serial) (*sapb.Exists, error) {
1752-
err := ssa.dbMap.SelectOne(&recordedSerialModel{}, "SELECT * FROM serials WHERE serial = ?", req.Serial)
1753-
isNoRowsErr := db.IsNoRows(err)
1754-
if err != nil && !isNoRowsErr {
1755-
return nil, err
1756-
}
1757-
exists := !isNoRowsErr
1758-
return &sapb.Exists{Exists: &exists}, nil
1759-
}
1760-
17611747
func addKeyHash(db db.Inserter, cert *x509.Certificate) error {
17621748
if cert.RawSubjectPublicKeyInfo == nil {
17631749
return errors.New("certificate has a nil RawSubjectPublicKeyInfo")

sa/sa_test.go

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -2225,29 +2225,6 @@ func TestGetOrderExpired(t *testing.T) {
22252225
test.Assert(t, berrors.Is(err, berrors.NotFound), "GetOrder error wasn't of type NotFound")
22262226
}
22272227

2228-
func TestSerialExists(t *testing.T) {
2229-
sa, _, cleanUp := initSA(t)
2230-
defer cleanUp()
2231-
reg := satest.CreateWorkingRegistration(t, sa)
2232-
2233-
serial := "asd"
2234-
resp, err := sa.SerialExists(context.Background(), &sapb.Serial{Serial: &serial})
2235-
test.AssertNotError(t, err, "SerialExists failed")
2236-
test.AssertEquals(t, *resp.Exists, false)
2237-
2238-
zero := int64(0)
2239-
_, err = sa.AddSerial(context.Background(), &sapb.AddSerialRequest{
2240-
RegID: &reg.ID,
2241-
Serial: &serial,
2242-
Created: &zero,
2243-
Expires: &zero,
2244-
})
2245-
test.AssertNotError(t, err, "AddSerial failed")
2246-
resp, err = sa.SerialExists(context.Background(), &sapb.Serial{Serial: &serial})
2247-
test.AssertNotError(t, err, "SerialExists failed")
2248-
test.AssertEquals(t, *resp.Exists, true)
2249-
}
2250-
22512228
func TestBlockedKey(t *testing.T) {
22522229
sa, _, cleanUp := initSA(t)
22532230
defer cleanUp()

0 commit comments

Comments
 (0)
X Tutup