Skip to content

Commit 20d8c99

Browse files
authored
Change embedded version naming on proto types (#329)
...V0_0_2 -> ...V002 See naming: https://protobuf.dev/programming-guides/style/#identifier We were initially using this to avoid collisions, but those are academic/theoretical and we can work around them. Additionally we now can identify collisions at the proto spec level rather than at generation time. Signed-off-by: Appu Goundan <appu@google.com>
1 parent 349e76e commit 20d8c99

File tree

18 files changed

+229
-229
lines changed

18 files changed

+229
-229
lines changed

api/proto/dsse.proto

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,16 @@ import "verifier.proto";
2323

2424
option go_package = "github.com/sigstore/rekor-tiles/pkg/generated/protobuf";
2525

26-
// A request to add a DSSE entry to the log
27-
message DSSERequestV0_0_2 {
26+
// A request to add a DSSE v0.0.2 entry to the log
27+
message DSSERequestV002 {
2828
// A DSSE envelope
2929
io.intoto.Envelope envelope = 1 [(google.api.field_behavior) = REQUIRED];
3030
// All necessary verification material to verify all signatures embedded in the envelope
3131
repeated Verifier verifiers = 2 [(google.api.field_behavior) = REQUIRED];
3232
}
3333

3434

35-
message DSSELogEntryV0_0_2 {
35+
message DSSELogEntryV002 {
3636
// The hash of the DSSE payload
3737
dev.sigstore.common.v1.HashOutput payloadHash = 1 [(google.api.field_behavior) = REQUIRED];
3838
// Signatures and their associated verification material used to verify the payload

api/proto/entry.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ message Entry {
3737
// Spec contains one of the Rekor entry types.
3838
message Spec {
3939
oneof spec {
40-
HashedRekordLogEntryV0_0_2 hashed_rekord_v0_0_2 = 1 [(google.api.field_behavior) = REQUIRED];
41-
DSSELogEntryV0_0_2 dsse_v0_0_2 = 2 [(google.api.field_behavior) = REQUIRED];
40+
HashedRekordLogEntryV002 hashed_rekord_v002 = 1 [(google.api.field_behavior) = REQUIRED];
41+
DSSELogEntryV002 dsse_v002 = 2 [(google.api.field_behavior) = REQUIRED];
4242
}
4343
}

api/proto/hashedrekord.proto

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ import "verifier.proto";
2222

2323
option go_package = "github.com/sigstore/rekor-tiles/pkg/generated/protobuf";
2424

25-
// A request to add a hashedrekord to the log
26-
message HashedRekordRequestV0_0_2 {
25+
// A request to add a hashedrekord v0.0.2 to the log
26+
message HashedRekordRequestV002 {
2727
// The hashed data
2828
bytes digest = 1 [(google.api.field_behavior) = REQUIRED];
2929
// A single signature over the hashed data with the verifier needed to validate it
3030
Signature signature = 2 [(google.api.field_behavior) = REQUIRED];
3131
}
3232

33-
message HashedRekordLogEntryV0_0_2 {
33+
message HashedRekordLogEntryV002 {
3434
// The hashed data
3535
dev.sigstore.common.v1.HashOutput data = 1 [(google.api.field_behavior) = REQUIRED];
3636
// A single signature over the hashed data with the verifier needed to validate it
3737
Signature signature = 2 [(google.api.field_behavior) = REQUIRED];
38-
}
38+
}

api/proto/rekor_service.proto

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,8 @@ service Rekor {
6161
// Create a new HashedRekord or DSSE
6262
message CreateEntryRequest {
6363
oneof spec {
64-
HashedRekordRequestV0_0_2 hashed_rekord_request_v0_0_2 = 1 [(google.api.field_behavior) = REQUIRED];
65-
DSSERequestV0_0_2 dsse_request_v0_0_2 = 2 [(google.api.field_behavior) = REQUIRED];
64+
HashedRekordRequestV002 hashed_rekord_request_v002 = 1 [(google.api.field_behavior) = REQUIRED];
65+
DSSERequestV002 dsse_request_v002 = 2 [(google.api.field_behavior) = REQUIRED];
6666
}
6767
}
6868

docs/openapi/rekor_service.swagger.json

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

pkg/client/write/write.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,27 +119,27 @@ func (w *writeClient) Add(ctx context.Context, entry any) (*pbs.TransparencyLogE
119119

120120
func createRequest(entry any) (*pb.CreateEntryRequest, error) {
121121
switch e := entry.(type) {
122-
case *pb.HashedRekordRequestV0_0_2:
122+
case *pb.HashedRekordRequestV002:
123123
return createHashedRekordRequest(e), nil
124-
case *pb.DSSERequestV0_0_2:
124+
case *pb.DSSERequestV002:
125125
return createDSSERequest(e), nil
126126
default:
127127
return nil, fmt.Errorf("unsupported entry type: %T", entry)
128128
}
129129
}
130130

131-
func createHashedRekordRequest(h *pb.HashedRekordRequestV0_0_2) *pb.CreateEntryRequest {
131+
func createHashedRekordRequest(h *pb.HashedRekordRequestV002) *pb.CreateEntryRequest {
132132
return &pb.CreateEntryRequest{
133-
Spec: &pb.CreateEntryRequest_HashedRekordRequestV0_0_2{
134-
HashedRekordRequestV0_0_2: h,
133+
Spec: &pb.CreateEntryRequest_HashedRekordRequestV002{
134+
HashedRekordRequestV002: h,
135135
},
136136
}
137137
}
138138

139-
func createDSSERequest(d *pb.DSSERequestV0_0_2) *pb.CreateEntryRequest {
139+
func createDSSERequest(d *pb.DSSERequestV002) *pb.CreateEntryRequest {
140140
return &pb.CreateEntryRequest{
141-
Spec: &pb.CreateEntryRequest_DsseRequestV0_0_2{
142-
DsseRequestV0_0_2: d,
141+
Spec: &pb.CreateEntryRequest_DsseRequestV002{
142+
DsseRequestV002: d,
143143
},
144144
}
145145
}

pkg/client/write/write_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ func TestAdd(t *testing.T) {
123123
}{
124124
{
125125
name: "valid hashedrekord",
126-
entry: &pb.HashedRekordRequestV0_0_2{
126+
entry: &pb.HashedRekordRequestV002{
127127
Signature: &pb.Signature{
128128
Content: []byte("sign"),
129129
Verifier: &pb.Verifier{
@@ -157,7 +157,7 @@ func TestAdd(t *testing.T) {
157157
},
158158
{
159159
name: "valid dsse",
160-
entry: &pb.DSSERequestV0_0_2{
160+
entry: &pb.DSSERequestV002{
161161
Envelope: &dsse.Envelope{
162162
Payload: []byte("some payload"),
163163
PayloadType: "",
@@ -204,7 +204,7 @@ func TestAdd(t *testing.T) {
204204
},
205205
{
206206
name: "server error",
207-
entry: &pb.DSSERequestV0_0_2{
207+
entry: &pb.DSSERequestV002{
208208
Envelope: &dsse.Envelope{
209209
Payload: []byte("some payload"),
210210
PayloadType: "",
@@ -232,7 +232,7 @@ func TestAdd(t *testing.T) {
232232
},
233233
{
234234
name: "unexpected response body from server",
235-
entry: &pb.DSSERequestV0_0_2{
235+
entry: &pb.DSSERequestV002{
236236
Envelope: &dsse.Envelope{
237237
Payload: []byte("some payload"),
238238
PayloadType: "",
@@ -260,7 +260,7 @@ func TestAdd(t *testing.T) {
260260
},
261261
{
262262
name: "invalid checkpoint",
263-
entry: &pb.DSSERequestV0_0_2{
263+
entry: &pb.DSSERequestV002{
264264
Envelope: &dsse.Envelope{
265265
Payload: []byte("some payload"),
266266
PayloadType: "",
@@ -301,7 +301,7 @@ func TestAdd(t *testing.T) {
301301
},
302302
{
303303
name: "invalid inclusion proof",
304-
entry: &pb.DSSERequestV0_0_2{
304+
entry: &pb.DSSERequestV002{
305305
Envelope: &dsse.Envelope{
306306
Payload: []byte("some payload"),
307307
PayloadType: "",

pkg/generated/protobuf/dsse.pb.go

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

0 commit comments

Comments
 (0)