0xMiden / 0xMiden/protocol

`ProvenBatch::new` should validate invariants

Aberta
#1,691 6 comentários 1 reação 0 responsáveis Ver no GitHub
Linguagem predominante
Rust
Estrelas
132
Forks
167
Merge médio
1d 23h
PRs com merge (30d)
110

Descrição

### 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

Guia de contribuição

Abrir o guia de contribuição

Avaliação

Esta issue ainda não foi avaliada.

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.