F3 participation lease API has drifted from Lotus: lotus-miner cannot decode or renew its lease

Đang mở
#7,847 2 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 1 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
46/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
go, rust

Hướng nghiên cứu

Start with the F3 lease handlers and types in src/rpc/methods/f3.rs and src/rpc/methods/f3/types.rs; compare their behavior with the linked Lotus lease implementation and error codes. Add the requested lease rule tests and JSON snapshot, then check that the ticket and participation replies match the expected network name, remaining term, renewal rules, and error codes.

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

Mô tả

Type: Bug

[!WARNING]
Below is issue is filled using AI, It is verified partially so read carefully and make sure to verify it before making any changes.

Describe the bug

lotus-miner (and Curio, which uses the same three calls) takes part in F3 by holding a short lease on a node. The node then signs F3 votes with the miner's worker key. Forest's lease API (Filecoin.F3GetOrRenewParticipationTicket and Filecoin.F3Participate) does not behave like Lotus v1.38.1 in four ways:

Lotus v1.38.1 Forest main What the miner sees
1 The lease's Network is the F3 manifest network name, a JSON string (api_full.go) It is Forest's chain enum, sent as {"type":"calibnet"} (types.rs, NetworkChain) It cannot decode any F3Participate reply
2 F3Participate returns the lease as of now: FromInstance is the current instance, ValidityTerm the instances left (participation_lease.go) It returns the lease as submitted (f3.rs) It never sees "2 instances left", so it does not renew before the lease ends
3 A new ticket is refused only when the previous one is still live and came from another node (participation_lease.go) It is refused for any previous ticket from another node or network, expired or not (types.rs) A miner that moves to Forest from another node gets no ticket until it restarts
4 Failures carry codes 4 to 9 (api_errors.go) Every failure is -32603 It takes its generic retry path, and it polls a node that has F3 off forever

How the lease works

  • The miner asks for a ticket: "miner M, from the current instance, for 5 instances".
  • It calls F3Participate(ticket). While the lease is live (current instance <= from + term) the node signs for M.
  • It calls F3Participate again with the same ticket every 15 to 45 s. The answer says how many instances are left. At 2 or fewer it gets a new ticket (participation.go), so two leases overlap and there is no gap.
  • It compares the lease's Network with F3GetManifest().NetworkName and asks for a new ticket when they differ (participation.go).
  • It picks its next step from the error code (participation.go).

What happens today

Measured with Lotus v1.38.1's own participation loop and RPC client against Forest's handlers. The F3 sidecar was replaced by a stub that serves the manifest and an instance counter.

  • At one instance per 30 s the node holds a lease for the miner 88% of the time, with a 10 to 35 s hole about every 3 minutes.
    It works at all only because Forest stores the lease before it answers and lotus-miner retries the unreadable reply for 188 s before it asks for a new ticket, while a lease lasts 180 s.
  • With shorter instances the share drops: 45% at one instance per 15 s (F3 catching up) and 13% at one per 4 s (a devnet).
  • In 25 minutes the miner reads 0 of 63 F3Participate replies and logs 119 WARN and ERROR lines.
  • After a move from a Lotus node the miner gets no lease (watched for 15 minutes).
  • With F3 off on the node the miner polls once a minute forever. Given code 4, which is what Lotus answers, it logs
    Cannot participate in F3 as it is disabled. and stops.

With the four points fixed the same runs give 100% and the same calls as against Lotus's own leaser.

Log output

lotus-miner v1.38.1 against Forest main
WARN   rpc  [email protected]/client.go:718  unmarshaling failed  {"message": "{\"Network\":{\"type\":\"calibnet\"},\"Issuer\":\"…\",\"MinerID\":1000,\"FromInstance\":1000,\"ValidityTerm\":5}"}
ERROR  f3   lf3/participation.go:203  Unexpected error while attempting F3 participation. Retrying after backoff  {"err": "RPC client error: unmarshaling result: json: cannot unmarshal object into Go struct field F3ParticipationLease.Network of type gpbft.NetworkName"}
ERROR  f3   lf3/participation.go:200  Too many failures while attempting to check F3  progress. Restarting participation.  {"err": "RPC error (-32603): the ticket has been expired"}

To reproduce

  1. Run a Forest node with the F3 sidecar enabled.
  2. Call Filecoin.F3GetOrRenewParticipationTicket with ["<miner ID address>", null, 5].
  3. Call Filecoin.F3Participate with ["<the ticket>"] and look at Network in the result. Call it again a few instances later: FromInstance and ValidityTerm have not moved.

Or point lotus-miner v1.38.1 at the node and read its log.

Expected behaviour

The same as against a Lotus node:

  • The ticket and the lease carry the F3 manifest network name, and the lease JSON has it as a string.
  • F3Participate returns FromInstance as the current instance and ValidityTerm as the instances left.
  • F3GetOrRenewParticipationTicket issues a new ticket when the previous one has expired or is for another F3 network, and
    refuses only a live ticket from another node.
  • Failures use Lotus's codes 4 to 9 and messages, and with F3 off both methods answer code 4.
  • A JSON snapshot of the lease and unit tests for the lease rules, because nothing compares this with Lotus today.

Environment

  • Forest main v0.39.0.
  • Lotus and lotus-miner v1.38.1.

Other information and links

  • Found while working on #7669.
  • History: Forest ported the ticket API in #4920 (2024-10-23, for #4861) from Lotus master of that week. Two days later Lotus
    changed the contract in filecoin-project/lotus#12640: the miner polls by calling F3Participate again and the node returns
    the lease as of now. Forest did not follow. Points 1, 3 and 4 have differed since the port.
  • Why it went unseen: api compare only checks that the ticket is bytes and does not compare F3Participate
    (api_compare_tests.rs), both methods are on the snapshot ignore list, and the devnet that signs F3 messages makes the miner a permanent participant instead of using a lease
    (docker-compose.yml).
  • Not part of this issue; each could be its own:
    • An end-to-end check: F3 on in scripts/devnet-forest-miner and a miner test that the lease is held and certificates advance.
    • Filecoin.F3GetPowerTableByInstance, Lotus's name, answers "Method not found"; Forest registers Filecoin.F3GetF3PowerTableByInstance.
    • With F3 off, the other Filecoin.F3* methods answer a transport error where Lotus answers code 4.
Ngôn ngữ chính
Rust
Star
700
Fork
201
Merge trung bình
1 ngày 17 giờ
Pull request đã merge (30 ngày)
65

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 ChainSafe/forest

Tất cả issue của ChainSafe/forest

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.