pub struct CreateProposalRequest {
pub name: String,
pub payload: Vec<u8>,
pub proposal_owner: Vec<u8>,
pub expected_voters_count: u32,
pub expiration_timestamp: u64,
pub liveness_criteria_yes: bool,
}Expand description
Parameters for creating a new proposal.
All fields are validated on construction via CreateProposalRequest::new.
The expiration_timestamp is a relative duration in seconds that gets converted
to an absolute timestamp when the proposal is created.
Fields§
§name: StringA short name for the proposal (e.g., “Upgrade to v2”).
payload: Vec<u8>Additional details about what’s being voted on.
proposal_owner: Vec<u8>The address (public key bytes) of whoever created this proposal.
expected_voters_count: u32How many people are expected to vote (used to calculate consensus threshold).
expiration_timestamp: u64The timestamp at which the proposal becomes outdated.
liveness_criteria_yes: boolWhat happens if votes are tied: true means YES wins, false means NO wins.
Implementations§
Source§impl CreateProposalRequest
impl CreateProposalRequest
Sourcepub fn new(
name: String,
payload: Vec<u8>,
proposal_owner: Vec<u8>,
expected_voters_count: u32,
expiration_timestamp: u64,
liveness_criteria_yes: bool,
) -> Result<Self, ConsensusError>
pub fn new( name: String, payload: Vec<u8>, proposal_owner: Vec<u8>, expected_voters_count: u32, expiration_timestamp: u64, liveness_criteria_yes: bool, ) -> Result<Self, ConsensusError>
Create a new proposal request with validation.
Sourcepub fn into_proposal(self) -> Result<Proposal, ConsensusError>
pub fn into_proposal(self) -> Result<Proposal, ConsensusError>
Convert this request into an actual proposal.
Generates a unique proposal ID and sets the creation timestamp. The proposal starts with round 1 and no votes.
Trait Implementations§
Source§impl Clone for CreateProposalRequest
impl Clone for CreateProposalRequest
Source§fn clone(&self) -> CreateProposalRequest
fn clone(&self) -> CreateProposalRequest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CreateProposalRequest
impl RefUnwindSafe for CreateProposalRequest
impl Send for CreateProposalRequest
impl Sync for CreateProposalRequest
impl Unpin for CreateProposalRequest
impl UnwindSafe for CreateProposalRequest
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more