Beacon API: resolve state roots and the genesis id, and serve states/{state_id}/root

Đang mở
#857 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 6 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
42/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
rust
Lĩnh vực
api

Hướng nghiên cứu

Start with docs/spec_deviations.md ("block_id cannot name genesis...") and docs/rpc.md to see the current contract, then read the store that keys states by block root and the Table::BlockRoots anchor logic, since the new state-root index has to be written at import and pruned alongside States/StateDiffs. Find the existing debug beacon states handler to add the 0x state-root and anchor-at-slot-0 genesis resolution, then add the GET /eth/v1/beacon/states/{state_id}/root route next to the other state routes. Done means both ids resolve for locally built devnets, the 404 stays for checkpoint-synced directories, and both docs pages and the rpc.md heading list are updated.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Problem. Three of ethereum-package's tools load beacon states by state root or by genesis, and ethlambda refuses both. These findings come from reading each tool's source against main (b2722cfd); nothing was run.

  • checkpointz (the package runs it in full mode): it downloads the finalized bundle's state with GET /eth/v2/debug/beacon/states/0x<state_root>, gets a 404, and never serves a checkpoint. So no node can checkpoint-sync from it. It also asks for block genesis every 15 s and logs "invalid genesis block".
  • dora: it loads every state with 0x<state_root> or genesis. Blocks are indexed, but nothing derived from a state is: the validator set, the duties, epoch participation and the validator pages are all missing.
  • tracoor: it captures no states. Its first call, GET /eth/v1/beacon/states/{slot}/root, is not served. With that route it would then ask for the state by state root, which is refused too.

Both refusals are deliberate (docs/spec_deviations.md, "block_id cannot name genesis, and state_id cannot be a state root"):

  • states are keyed by block root, with no reverse index;
  • Table::BlockRoots starts above the store's anchor, and a checkpoint-synced directory has no genesis block anyway.

Fix.

  • Index state root to block root for the states the store holds, written at import and pruned with States/StateDiffs. Resolve a 0x state_id through it.
  • Serve GET /eth/v1/beacon/states/{state_id}/root.
  • Resolve genesis, on either id, when the store's anchor is at slot 0: that anchor is the genesis block and state, as on every devnet that starts from its own genesis.ssz. Keep the 404 for a checkpoint-synced directory.
  • Update docs/spec_deviations.md and docs/rpc.md. The rpc.md heading "Accepted ids, and three that are refused" lists only two.
Ngôn ngữ chính
Rust
Star
86
Fork
34
Merge trung bình
9 ngày 20 giờ
Pull request đã merge (30 ngày)
77

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của lambdaclass/ethlambda

Tất cả issue của lambdaclass/ethlambda

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.