Skip to content

Latest commit

 

History

History
145 lines (116 loc) · 1.98 KB

data_structure_zh.md

File metadata and controls

145 lines (116 loc) · 1.98 KB

Overlord 数据结构

类型

type Address = Bytes;

type Signature = Bytes;

type Hash = Bytes;

枚举

pub enum Role {
    Leader = 0,
    Replica = 1,
}

pub enum VoteType {
    Prevote = 0,
    Precommit = 1,
}

pub enum OverlordMsg {
    SignedProposal(SignedProposal),
    SignedVote(SignedVote),
    AggregatedVote(AggregatedVote),
    RichStatus(Status),
}

Proposal

pub struct SignedProposal<T> {
    pub signature: Signature,
    pub proposal: Proposal<T>,
}

pub struct Proposal<T> {
    pub height: u64,
    pub round: u64,
    pub hash: Hash,
    pub content: T,
    pub lock_round: Option<u64>,
    pub lock_votes: Vec<AggregatedVote<T>>,
    pub proposer: Address,
}

Vote

pub struct SignedVote {
    pub signature: Signature,
    pub vote: Vote,
}

pub struct AggregatedVote {
    pub signature: AggregatedSignature,
    pub type: VoteType,
    pub height: u64,
    pub round: u64,
    pub proposal: Hash,
}

pub struct Vote {
    pub height: u64,
    pub round: u64,
    pub type: VoteType,
    pub proposal: Hash,
    pub voter: Address,
}

Commit

pub struct Commit<T> {
    pub height: u64,
    pub proposal: T,
    pub proof: Proof,
}

AggregatedSignature

pub struct AggregatedSignature {
    pub signature: Signature,
    pub address_bitmap: Bytes,
}

Proof

pub struct Proof {
    pub height: u64,
    pub round: u64,
    pub proposal_hash: Hash,
    pub signature: AggregatedSignature,
}

Node

pub struct Node {
    pub address: Address,
    pub propose_weight: u8,
    pub vote_weight: u8,
}

Status

pub struct Status {
    pub height: u64,
    pub interval: u64,
    pub authority_list: Vec<Node>,
}

VerifyResp

pub(crate) struct VerifyResp {
    pub(crate) proposal_hash: Hash,
    pub(crate) is_pass: bool,
}

Feed

pub(crate) struct Feed<T> {
    pub(crate) height: u64,
    pub(crate) proposal: T,
    pub(crate) hash: Hash,
}