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

docs: improve chunk endorsement documentation #12697

Closed
wants to merge 4 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion core/primitives/src/stateless_validation/chunk_endorsement.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ use super::{ChunkProductionKey, SignatureDifferentiator};

/// The endorsement of a chunk by a chunk validator. By providing this, a
/// chunk validator has verified that the chunk state witness is correct.
///
/// # Version History
/// - V1: Deprecated version (no longer used)
/// - V2: Current version with enhanced security features and metadata
#[allow(clippy::large_enum_variant)]
#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize, ProtocolSchema)]
pub enum ChunkEndorsement {
Expand Down Expand Up @@ -96,6 +100,8 @@ impl ChunkEndorsement {
}
}

/// Represents version 2 of chunk endorsement with enhanced security features.
/// Contains both the endorsement data and associated metadata for validation.
#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize, ProtocolSchema)]
pub struct ChunkEndorsementV2 {
// This is the part of the chunk endorsement that signed and included in the block header
Expand All @@ -117,6 +123,8 @@ impl ChunkEndorsementV2 {
}
}

/// Metadata associated with chunk endorsement, used for validation purposes.
/// Contains information about the validator, shard, epoch, and block height.
#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize, ProtocolSchema)]
pub struct ChunkEndorsementMetadata {
account_id: AccountId,
Expand All @@ -125,7 +133,8 @@ pub struct ChunkEndorsementMetadata {
height_created: BlockHeight,
}

/// This is the part of the chunk endorsement that is actually being signed.
/// Core data structure that is signed in the chunk endorsement process.
/// Includes the chunk hash and a signature differentiator for security.
#[derive(Debug, Clone, PartialEq, Eq, BorshSerialize, BorshDeserialize, ProtocolSchema)]
pub struct ChunkEndorsementInner {
chunk_hash: ChunkHash,
Expand Down