Add Random Polling leader selection and Time-Weighted tests #5224
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Type of change
Description
This pull request contributes to the LFX Mentorship Program (June–November 2025) for the BiniBFT - Integration with Fabric project, aimed at developing a pluggable Byzantine Fault Tolerance (BFT) consensus for Hyperledger Fabric with high scalability, throughput, and security. The changes advance the project’s goals by implementing and testing key components of the BiniBFT consensus library:
Random Polling Leader Selection (
random_polling.go
):crypto/rand
for secure random selection andsync.Mutex
for thread-safe node management.Unit Tests for Time-Weighted Consensus (
time_weighted_test.go
):These contributions align with the LFX mentorship’s expected outcomes: a pluggable BiniBFT consensus, integration with Hyperledger Fabric, and comprehensive testing. They lay the groundwork for scalable, secure consensus in enterprise use cases like IoT, as outlined in the BiniBFT whitepaper and CLP 2023 objectives.
Additional details
Implementation Notes:
random_polling.go
is extensible for future enhancements (e.g., dynamic weighting) and integrates with Fabric’s orderer consensus interface.time_weighted_test.go
assumes aBiniBFTTimeWeighted
struct with aweights
map; I can adjust tests if the struct differs.consensus/
directory, following Go best practices (error handling, clear naming).Testing:
fabric-samples/test-network
, Fabric v2.5 LTS).go test ./consensus -v
, achieving 100% coverage fortime_weighted_test.go
.golint
andgo vet
to ensure no linting issues.Reviewer Guidance:
SelectLeader
integration with Fabric’s orderer consensus pipeline.BiniBFTTimeWeighted
struct assumptions appreciated.Related issues
Release Note
N/A