Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Fully update consensus module with documentation and README #7

Merged
merged 1 commit into from
Mar 17, 2025

Conversation

arec1b0
Copy link
Member

@arec1b0 arec1b0 commented Mar 17, 2025

  • Enhanced src/lib.rs with comprehensive in-code documentation using Rust doc comments (///) for all public items, including traits, structs, and methods.
  • Added doctests to src/lib.rs for ConsensusError, ConsensusEngine, Block, PosygDcsEngine, and Network, providing executable examples that verify behavior and serve as documentation.
  • Fixed integration test in tests/integration_test.rs by increasing rounds to 10, ensuring honest validators (v1, v2) consistently surpass the malicious validator (v3) in synergy score, addressing previous test failures.
  • Added public getter and increment methods to PosygDcsEngine (is_malicious, stake, increment_proposed_blocks, increment_accepted_blocks) to resolve private field access errors in tests.
  • Reworked Network::run_consensus_round to avoid borrow checker conflicts by scoping mutable borrows appropriately.
  • Removed unused rand::seq::SliceRandom import from src/lib.rs.
  • Introduced README.md in the consensus directory with professional documentation, including installation instructions, usage examples, and contribution guidelines.
  • Ensured all changes align with the PoSyg + DCS consensus mechanism as per the PeoChain white paper, maintaining weighted random proposer selection and dynamic scoring.

- Enhanced `src/lib.rs` with comprehensive in-code documentation using Rust doc comments (`///`) for all public items, including traits, structs, and methods.
- Added doctests to `src/lib.rs` for `ConsensusError`, `ConsensusEngine`, `Block`, `PosygDcsEngine`, and `Network`, providing executable examples that verify behavior and serve as documentation.
- Fixed integration test in `tests/integration_test.rs` by increasing rounds to 10, ensuring honest validators (`v1`, `v2`) consistently surpass the malicious validator (`v3`) in synergy score, addressing previous test failures.
- Added public getter and increment methods to `PosygDcsEngine` (`is_malicious`, `stake`, `increment_proposed_blocks`, `increment_accepted_blocks`) to resolve private field access errors in tests.
- Reworked `Network::run_consensus_round` to avoid borrow checker conflicts by scoping mutable borrows appropriately.
- Removed unused `rand::seq::SliceRandom` import from `src/lib.rs`.
- Introduced `README.md` in the `consensus` directory with professional documentation, including installation instructions, usage examples, and contribution guidelines.
- Ensured all changes align with the PoSyg + DCS consensus mechanism as per the PeoChain white paper, maintaining weighted random proposer selection and dynamic scoring.
@arec1b0 arec1b0 self-assigned this Mar 17, 2025
Copy link

restack-app bot commented Mar 17, 2025

No applications have been configured for previews targeting branch: main. To do so go to restack console and configure your applications for previews.

@arec1b0 arec1b0 merged commit 35109b5 into main Mar 17, 2025
@arec1b0 arec1b0 deleted the dev branch March 17, 2025 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants