Verify the last decision with VerifyProposal before delivering it during a view change
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
- 52/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
- Lĩnh vực
- backend-api-design, distributed-systems
Hướng nghiên cứu
Start by reading ValidateLastDecision and its callers, validateViewDataMsg and validateNewViewMsg, then check the Verifier documentation in pkg/api and the related cases in viewchanger_test.go. Add coverage for both view change paths with VerifyProposal succeeding and failing; done means rejection delivers nothing, while success still delivers the decision.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Background
On the normal path, a node calls Verifier.VerifyProposal on a proposal when it gets the pre-prepare (View.verifyProposal), before it sends a prepare. A proposal is delivered only after a commit quorum, so every delivered proposal has passed VerifyProposal on that node.
What happens during a view change
A node that is exactly one sequence behind can catch up during a view change, using the LastDecision carried in a ViewData. This happens in two places:
validateViewDataMsg, when the node receives aViewDatadirectly;validateNewViewMsg, for theViewDatamessages inside aNewView.
In both places, when the last decision's sequence is the node's sequence + 1, the node calls ValidateLastDecision and then deliverDecision. ValidateLastDecision checks that:
- the last decision is set and its metadata can be parsed;
- its view is lower than the requested next view;
- there are at least a quorum of signatures from distinct signers, and each one passes
Verifier.VerifyConsenterSig.
VerifyProposal isn't called on this path. So the delivered proposal is checked only as far as VerifyConsenterSig covers it. The API doesn't require VerifyConsenterSig to cover the whole proposal, and in practice it may not. For example, an application might sign the header and metadata, and check that the payload matches the header only in VerifyProposal. In that case, the payload delivered on this path is never checked against the header.
On the NewView path, the signature on each ViewData is verified only after deliverDecision. That is deliberate, because the delivered decision may be a reconfiguration that changes the keys. It also means the quorum signatures are the only check that runs before delivery.
Proposed fix
In ValidateLastDecision, after the signature checks, call verifier.VerifyProposal on the last decision, and return an error if it fails.
- Both callers of
ValidateLastDecisionare on the one-behind path. There, the application state (last committed decision, configuration, verification sequence) is the same as when the proposal was first verified. So a correct decision should passVerifyProposalagain. - Call only
Verifier.VerifyProposal, notView.verifyProposal. The view-specific checks there (view number, decisions in view, blacklist, previous-commit digest) are relative to the current view, and don't hold for a decision made in an earlier view. - Build the proposal once, outside the signature loop.
ValidateLastDecisioncould also return the proposal and signatures, so the two callers don't each rebuild them. VerifyProposalruns at most once per delivery.validateNewViewMsgreturns after the first delivery, and after aViewDatadelivery the node is no longer one behind.- If
VerifyProposalrejects a correct decision, for example because the application's checks depend on time, the node doesn't deliver it and catches up through sync instead. Safety is not affected. - Update the
Verifierdoc inpkg/apito say thatVerifyProposalmay also be called on a proposal that was already decided, before it is delivered.
Tests
- In
viewchanger_test.go, for both theViewDataand theNewViewpaths:- when the last decision is one ahead and
VerifyProposalreturns an error, nothing is delivered and the message is rejected; - when
VerifyProposalsucceeds, the decision is still delivered.
- when the last decision is one ahead and
- Existing view changer tests that mock
Verifierwithout aVerifyProposalexpectation will need one added. - Optionally, make the test app's
VerifyProposalstricter (it accepts any payload today), so that the integration tests exercise this path.
Written by Claude (AI assistant) on behalf of Hagar Meir.
- Ngôn ngữ chính
- Go
- Star
- 110
- Fork
- 41
- Merge trung bình
- 20 giờ 59 phút
- Pull request đã merge (30 ngày)
- 27
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- 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.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của hyperledger/SmartBFT
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
hyperledger/SmartBFT#803 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
hyperledger/SmartBFT#801 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
hyperledger/SmartBFT#799 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
hyperledger/SmartBFT#798 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
enhancement
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
hyperledger/SmartBFT#796 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của hyperledger/SmartBFT
Issue tương tự
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 60/100
slavakurilyak/awesome-ai-agents#1100 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
go_tool_binary: GOMAXPROCS=1 makes a cold builder build 3-4x slowerCó thể đã có người làm @TrapsterDK đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
bazel-contrib/rules_go#4816 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
mark3labs/mcp-go#1397 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 2 ngày
-
fix(tool/internal/setup): clearer errors when loading rule files from OTELC_RULESCó thể đã có người làm @NeoSamyak đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
open-telemetry/opentelemetry-go-compile-instrumentation#1946 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày