Skip to content

Use structured proto types for Hash, Signature, and ContentAddress #1726

Merged
Ericson2314 merged 1 commit into
NixOS:masterfrom
obsidiansystems:more-structured-proto
May 10, 2026
Merged

Use structured proto types for Hash, Signature, and ContentAddress #1726
Ericson2314 merged 1 commit into
NixOS:masterfrom
obsidiansystems:more-structured-proto

Conversation

@Ericson2314
Copy link
Copy Markdown
Member

Replace stringly-typed fields in store.proto with proper message types:

  • Hash — algorithm enum + raw digest bytes
  • Signature — key name + signature string
  • ContentAddress — method enum + hash

UnkeyedValidPathInfo.nar_hash is now Hash (not string),
signatures is repeated Signature (not repeated string),
ca is optional ContentAddress (not optional string).
UnkeyedNarInfo.file_hash/file_size renamed to
download_hash/download_size with proper Hash type.

All From/TryFrom impls use & for harmonia→proto direction
(no need to consume the source) and by-value for proto→harmonia
(proto types are consumed). Round-trip tests cover every layer.

@Ericson2314 Ericson2314 enabled auto-merge May 10, 2026 21:16
Replace stringly-typed fields in `store.proto` with proper message types:

- `Hash` — algorithm enum + raw digest bytes
- `Signature` — key name + signature string
- `ContentAddress` — method enum + hash

`UnkeyedValidPathInfo.nar_hash` is now `Hash` (not string),
`signatures` is `repeated Signature` (not `repeated string`),
`ca` is `optional ContentAddress` (not `optional string`).
`UnkeyedNarInfo.file_hash`/`file_size` renamed to
`download_hash`/`download_size` with proper `Hash` type.

All `From`/`TryFrom` impls use `&` for harmonia→proto direction
(no need to consume the source) and by-value for proto→harmonia
(proto types are consumed). Round-trip tests cover every layer.
@Ericson2314 Ericson2314 force-pushed the more-structured-proto branch from 27f4f8b to ac3bf83 Compare May 10, 2026 21:21
@Ericson2314 Ericson2314 added this pull request to the merge queue May 10, 2026
Merged via the queue into NixOS:master with commit 2d82259 May 10, 2026
3 of 4 checks passed
@Ericson2314 Ericson2314 deleted the more-structured-proto branch May 10, 2026 22:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant