penumbra icon indicating copy to clipboard operation
penumbra copied to clipboard

Add protos for TCT crate structs

Open grod220 opened this issue 10 months ago • 2 comments

The TCT crate has a few important structs that do not have protobuf equivalents. The one the web repo uses the most is Updates and all of its fields: https://github.com/penumbra-zone/penumbra/blob/6897901b37f5c72d4b5c593167f0e0b933dd2eb5/crates/crypto/tct/src/storage.rs#L279-L290

Without protobuf equivalents, we don't have types in the web repo for these entities. So we type them ourselves w/ zod. It is a runtime validation and not fully extensive (kinda our best effort). Also, it will not stay in sync if things change with those structs.

Proposed solution

Add protos and attributes for these (likely needs the impls too?)

#[serde(into = "pb::TctUpdates", try_from = "pb::TctUpdates")]
pub struct Updates {
...

This way, our bufbuild tooling will automatically spit out the Typescript types that other codebases can use for their block processing.

grod220 avatar Mar 27 '24 17:03 grod220