0xMiden / 0xMiden/protocol

`ProvenBatch::new` should validate invariants

Abierto
#1,691 6 comentarios 1 reacción 0 asignados Ver en GitHub
Lenguaje dominante
Rust
Estrellas
132
Forks
167
Merge medio
1 d 23 h
PR fusionados (30 d)
110

Descripción

### Feature description

Batch invariants are currently checked by `ProposedBatch::new` and _not_ by `ProvenBatch::new`. This means its possible to construct invalid `ProvenBatch`s.

We should improve this by checking these invariant's whenever a `ProvenBatch` can be constructed from unsafe data/types.

We _should_ probably also create an escape hatch `new_unchecked` (or some similar mechanism) that can be used when we _know_ the invariants have already been checked. For example, when transforming a `ProposedBatch` into a `ProvenBatch`. An alternative is to add `ProposedBatch::prove` which would allow this transformation implicitly.

### Why is this feature needed?

`ProvenBatch` will be deserialized from user input meaning it should not be implicitly trusted. This feature _should_ afford deserialized batches the same invariant protection as those created from `ProposedBatch`.

https://github.com/0xMiden/miden-node/pull/1130#discussion_r2253675275

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.