Skip to content

Conversation

@golddydev
Copy link
Collaborator

@golddydev golddydev commented Oct 24, 2025

Overview

This PR introduces a block VRF (Verifiable Random Function) validation system for Cardano blocks which is implemented as block_vrf_validator module.

Key Changes

1. Ouroboros Module Integration

  • Exposed the ouroboros module in the common crate, making Ouroboros protocol primitives publicly accessible
  • Added TPraos and Praos validation sub modules
  • Implemented VrfValidationErrors for all kinds of errors caused by VRF
  • Added overlay_schedule utilities to check blocks which are produced by genesis keys

2. Epoch Nonces Messaging Infrastructure

  • Introduced EpochNoncesMessage to the CardanoMessage enum for communicating epoch nonces across the system
  • Added EpochNoncesPublisher module to encapsulate the logic for publishing epoch nonces to the message bus
  • Epoch nonces are published after the first block of each epoch

3. Enhanced Nonce Utilities

  • Implemented Display trait for Nonce (shows hex hash or "NeutralNonce")
  • Added utility methods:
    • from_number(u64) - create a nonce from a number
    • neutral() - create a neutral nonce
    • seed_eta() - seed nonce for randomness computation
    • seed_l() - seed nonce for leader computation

4. VRF Validation State Management

  • Added modules/block_vrf_validator/src/state.rs for managing VRF validation state
  • Implemented EpochSnapshots struct to manage a sliding window of three epoch snapshots (mark, set, go)

5. Improved Error Handling

  • Refactored ValidationError::BadVRF to encapsulate VrfValidationError
  • Provides more detailed and structured error information for VRF validation failures

6. Publishing Vrf Validation Status

  • Refactored CardanoMessage::BlockValidation(ValidationStatus) to encapsulate VrfValidationError
  • Added vrf_validation_publisher to block_vrf_validator module to publish Block's Vrf Validation Result with detailed error

NOTE:

I have a few blocks invalidated even they are valid, because of VrfLeaderValueTooBig.
I am looking into active_stakes and total_active_stakes.

@golddydev golddydev requested a review from Copilot October 29, 2025 13:20
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This pull request adds VRF (Verifiable Random Function) validation for Cardano block headers, implementing validation for both TPraos and Praos consensus protocols. This is a significant enhancement to ensure block headers contain valid cryptographic proofs that the block producer was legitimately selected as the slot leader.

Key changes:

  • Introduces a new BlockVrfValidator module to validate VRF proofs in block headers
  • Adds support for genesis delegations to handle overlay schedule validation during the decentralization phase
  • Implements epoch nonces publishing to provide randomness for VRF validation

Reviewed Changes

Copilot reviewed 29 out of 30 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
processes/omnibus/src/main.rs Registers the new BlockVrfValidator module
processes/omnibus/Cargo.toml Adds dependency on block_vrf_validator module
processes/omnibus/.gitignore Ignores blocks directory (likely for testing)
modules/block_vrf_validator/* New module implementing VRF validation logic
modules/epochs_state/* Adds epoch nonces publishing and refactors message publishers
common/src/ouroboros/* New VRF validation logic for TPraos and Praos protocols
common/src/genesis_values.rs Adds genesis delegation data structures
common/src/protocol_params.rs Adds nonce utility methods and Display trait
common/src/messages.rs Adds EpochNoncesMessage for publishing epoch nonces

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@golddydev golddydev marked this pull request as ready for review October 30, 2025 07:52
@golddydev golddydev requested a review from Copilot October 30, 2025 07:52
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 32 out of 33 changed files in this pull request and generated 6 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@golddydev golddydev requested a review from Copilot October 30, 2025 08:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Copilot reviewed 32 out of 33 changed files in this pull request and generated 4 comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@golddydev golddydev requested a review from lowhung October 30, 2025 15:47
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