Skip to content

Commit 84b88da

Browse files
authored
Remove sa.Count[Pending|Invalid]Authorizations2 (#8669)
These methods were part of the old rate limits system, and therefore no longer have any callers.
1 parent e30bf45 commit 84b88da

7 files changed

Lines changed: 453 additions & 779 deletions

File tree

mocks/sa.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -311,10 +311,6 @@ func (sa *StorageAuthorityReadOnly) GetOrderForNames(_ context.Context, _ *sapb.
311311
return nil, nil
312312
}
313313

314-
func (sa *StorageAuthorityReadOnly) CountPendingAuthorizations2(ctx context.Context, req *sapb.RegistrationID, _ ...grpc.CallOption) (*sapb.Count, error) {
315-
return &sapb.Count{}, nil
316-
}
317-
318314
func (sa *StorageAuthorityReadOnly) GetValidOrderAuthorizations2(ctx context.Context, req *sapb.GetOrderAuthorizationsRequest, _ ...grpc.CallOption) (*sapb.Authorizations, error) {
319315
return nil, nil
320316
}
@@ -323,10 +319,6 @@ func (sa *StorageAuthorityReadOnly) GetOrderAuthorizations(ctx context.Context,
323319
return nil, nil
324320
}
325321

326-
func (sa *StorageAuthorityReadOnly) CountInvalidAuthorizations2(ctx context.Context, req *sapb.CountInvalidAuthorizationsRequest, _ ...grpc.CallOption) (*sapb.Count, error) {
327-
return &sapb.Count{}, nil
328-
}
329-
330322
func (sa *StorageAuthorityReadOnly) GetValidAuthorizations2(ctx context.Context, req *sapb.GetValidAuthorizationsRequest, _ ...grpc.CallOption) (*sapb.Authorizations, error) {
331323
if req.RegistrationID != 1 && req.RegistrationID != 5 && req.RegistrationID != 4 {
332324
return &sapb.Authorizations{}, nil

sa/proto/sa.pb.go

Lines changed: 453 additions & 480 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 & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,6 @@ import "google/protobuf/duration.proto";
1010

1111
// StorageAuthorityReadOnly exposes only those SA methods which are read-only.
1212
service StorageAuthorityReadOnly {
13-
rpc CountInvalidAuthorizations2(CountInvalidAuthorizationsRequest) returns (Count) {}
14-
rpc CountPendingAuthorizations2(RegistrationID) returns (Count) {}
1513
rpc FQDNSetExists(FQDNSetExistsRequest) returns (Exists) {}
1614
rpc FQDNSetTimestampsForWindow(CountFQDNSetsRequest) returns (Timestamps) {}
1715
rpc GetAuthorization2(AuthorizationID2) returns (core.Authorization) {}
@@ -43,8 +41,6 @@ service StorageAuthorityReadOnly {
4341
// StorageAuthority provides full read/write access to the database.
4442
service StorageAuthority {
4543
// Getters: this list must be identical to the StorageAuthorityReadOnly rpcs.
46-
rpc CountInvalidAuthorizations2(CountInvalidAuthorizationsRequest) returns (Count) {}
47-
rpc CountPendingAuthorizations2(RegistrationID) returns (Count) {}
4844
rpc FQDNSetExists(FQDNSetExistsRequest) returns (Exists) {}
4945
rpc FQDNSetTimestampsForWindow(CountFQDNSetsRequest) returns (Timestamps) {}
5046
rpc GetAuthorization2(AuthorizationID2) returns (core.Authorization) {}

sa/proto/sa_grpc.pb.go

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

sa/sa_test.go

Lines changed: 0 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -2364,40 +2364,6 @@ func TestRehydrateHostPort(t *testing.T) {
23642364
test.AssertError(t, err, "URL field cannot be empty")
23652365
}
23662366

2367-
func TestCountPendingAuthorizations2(t *testing.T) {
2368-
sa, fc := initSA(t)
2369-
2370-
reg := createWorkingRegistration(t, sa)
2371-
expiresA := fc.Now().Add(time.Hour).UTC()
2372-
expiresB := fc.Now().Add(time.Hour * 3).UTC()
2373-
_ = createPendingAuthorization(t, sa, reg.Id, identifier.NewDNS("example.com"), expiresA)
2374-
_ = createPendingAuthorization(t, sa, reg.Id, identifier.NewDNS("example.com"), expiresB)
2375-
2376-
// Registration has two new style pending authorizations
2377-
regID := reg.Id
2378-
count, err := sa.CountPendingAuthorizations2(context.Background(), &sapb.RegistrationID{
2379-
Id: regID,
2380-
})
2381-
test.AssertNotError(t, err, "sa.CountPendingAuthorizations2 failed")
2382-
test.AssertEquals(t, count.Count, int64(2))
2383-
2384-
// Registration has two new style pending authorizations, one of which has expired
2385-
fc.Add(time.Hour * 2)
2386-
count, err = sa.CountPendingAuthorizations2(context.Background(), &sapb.RegistrationID{
2387-
Id: regID,
2388-
})
2389-
test.AssertNotError(t, err, "sa.CountPendingAuthorizations2 failed")
2390-
test.AssertEquals(t, count.Count, int64(1))
2391-
2392-
// Registration with no authorizations should be 0
2393-
noReg := reg.Id + 100
2394-
count, err = sa.CountPendingAuthorizations2(context.Background(), &sapb.RegistrationID{
2395-
Id: noReg,
2396-
})
2397-
test.AssertNotError(t, err, "sa.CountPendingAuthorizations2 failed")
2398-
test.AssertEquals(t, count.Count, int64(0))
2399-
}
2400-
24012367
func TestAuthzModelMapToPB(t *testing.T) {
24022368
baseExpires := time.Now()
24032369
input := map[identifier.ACMEIdentifier]authzModel{
@@ -2554,38 +2520,6 @@ func TestGetOrderAuthorizations(t *testing.T) {
25542520
}
25552521
}
25562522

2557-
func TestCountInvalidAuthorizations2(t *testing.T) {
2558-
sa, fc := initSA(t)
2559-
2560-
fc.Add(time.Hour)
2561-
reg := createWorkingRegistration(t, sa)
2562-
idents := identifier.ACMEIdentifiers{
2563-
identifier.NewDNS("aaa"),
2564-
identifier.NewIP(netip.MustParseAddr("10.10.10.10")),
2565-
}
2566-
for _, ident := range idents {
2567-
// Create two authorizations, one pending, one invalid
2568-
expiresA := fc.Now().Add(time.Hour).UTC()
2569-
expiresB := fc.Now().Add(time.Hour * 3).UTC()
2570-
attemptedAt := fc.Now()
2571-
_ = createFinalizedAuthorization(t, sa, reg.Id, ident, expiresA, "invalid", attemptedAt)
2572-
_ = createPendingAuthorization(t, sa, reg.Id, ident, expiresB)
2573-
2574-
earliest := fc.Now().Add(-time.Hour).UTC()
2575-
latest := fc.Now().Add(time.Hour * 5).UTC()
2576-
count, err := sa.CountInvalidAuthorizations2(context.Background(), &sapb.CountInvalidAuthorizationsRequest{
2577-
RegistrationID: reg.Id,
2578-
Identifier: ident.ToProto(),
2579-
Range: &sapb.Range{
2580-
Earliest: timestamppb.New(earliest),
2581-
Latest: timestamppb.New(latest),
2582-
},
2583-
})
2584-
test.AssertNotError(t, err, "sa.CountInvalidAuthorizations2 failed")
2585-
test.AssertEquals(t, count.Count, int64(1))
2586-
}
2587-
}
2588-
25892523
func TestGetValidAuthorizations2(t *testing.T) {
25902524
sa, fc := initSA(t)
25912525

0 commit comments

Comments
 (0)