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 摘要。