Handling reference block on transaction execution
- Ngôn ngữ chính
- Rust
- Star
- 78
- Fork
- 129
- Merge trung bình
- 4 ngày 14 giờ
- Pull request đã merge (30 ngày)
- 52
Mô tả
After https://github.com/0xMiden/miden-client/pull/2100, the client only tracks the MMR peaks for the current sync height.
As mentioned [here](https://github.com/0xMiden/miden-client/pull/2100#discussion_r3157271113), I think there could be a problem with how we handle the `ref_block` on transaction execution.
`Client::execute_transaction` uses the current sync height as `ref_block` and passes it to the executor. The executor then builds the partial MMR through the data store. Since the client only stores peaks at the latest sync height, the MMR could not be consistent with the `ref_block`. If a concurrent `sync_state` advanced the chain between the caller capturing `ref_block` and the data store reading the peaks, the execution would fail.
I think there are two options here:
1. Assume a sync never runs during transaction execution. This would allow us to simplify the existing code by assuming the sync height is always the same during execution. It need to be documented (and ideally enforced).
2. Track historical peaks on the store. Allow `blockchain_checkpoint` to hold one row per chain tip we've seen, and look up peaks by `ref_block`. Since the client only accesses sync heigh, we only need to store the peaks for blocks that were added as chain tip, not for all intermediate blocks.
I think option 2 makes more sense and is probably the safest.
Hướng dẫn đóng góp
Hướng nghiên cứu
Xem xét phương thức `Client::execute_transaction` và cách nó sử dụng chiều cao đồng bộ hiện tại làm `ref_block`. Kiểm tra logic xây dựng MMR của trình thực thi thông qua kho dữ liệu. Xem lại bộ nhớ `blockchain_checkpoint` để hiểu cách các đỉnh được theo dõi. Mục tiêu là đảm bảo tính nhất quán của MMR với `ref_block` trong quá trình đồng bộ trạng thái đồng thời.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- rust
- Lĩnh vực
- backend, blockchain
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Khá rõ ràng
- Mức phù hợp với người mới
- 35/100