`ProvenBatch::new` should validate invariants
- Ngôn ngữ chính
- Rust
- Star
- 132
- Fork
- 167
- Merge trung bình
- 1 ngày 23 giờ
- Pull request đã merge (30 ngày)
- 110
Mô tả
### 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
Hướng dẫn đóng góp
Đánh giá
Issue này chưa được đánh giá.