0xMiden / 0xMiden/protocol

`ProvenBatch::new` should validate invariants

未关闭
#1,691 6 条评论 1 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Rust
星标
132
派生
167
平均合并
1 天 23 小时
30 天内合并 PR
110

描述

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

贡献指南

打开贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。