Show / Hide Table of Contents

Class Proposal

Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.

Inheritance
Object
Proposal
Implements
IEquatable<Proposal>
Inherited Members
Object.Equals(Object, Object)
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Libplanet.Consensus
Assembly: Libplanet.dll
Syntax
public class Proposal : IEquatable<Proposal>

Constructors

| Improve this Doc View Source

Proposal(Dictionary)

Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.

Declaration
public Proposal(Dictionary encoded)
Parameters
Type Name Description
Bencodex.Types.Dictionary encoded
| Improve this Doc View Source

Proposal(ProposalMetadata, ImmutableArray<Byte>)

Instantiates a Proposal with given proposalMetadata and its signature.

Declaration
public Proposal(ProposalMetadata proposalMetadata, ImmutableArray<byte> signature)
Parameters
Type Name Description
ProposalMetadata proposalMetadata

A ProposalMetadata to propose.

ImmutableArray<Byte> signature

A signature signed with proposalMetadata.

Exceptions
Type Condition
ArgumentNullException

Thrown if given signature is empty.

ArgumentException

Thrown if given signature is invalid and cannot be verified with proposalMetadata.

| Improve this Doc View Source

Proposal(Byte[])

Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.

Declaration
public Proposal(byte[] marshaled)
Parameters
Type Name Description
Byte[] marshaled

Properties

| Improve this Doc View Source

BlockHash

The BlockHash of MarshaledBlock. This is automatically derived from MarshaledBlock.

Declaration
public BlockHash BlockHash { get; }
Property Value
Type Description
BlockHash
| Improve this Doc View Source

ByteArray

Byte encoded Proposal data.

Declaration
public ImmutableArray<byte> ByteArray { get; }
Property Value
Type Description
ImmutableArray<Byte>
| Improve this Doc View Source

Encoded

A Bencodex-encoded value of Proposal.

Declaration
[JsonIgnore]
public Dictionary Encoded { get; }
Property Value
Type Description
Bencodex.Types.Dictionary
| Improve this Doc View Source

Height

A height of given proposal values.

Declaration
public long Height { get; }
Property Value
Type Description
Int64
| Improve this Doc View Source

MarshaledBlock

A marshaled bencodex-encoded Byte array of block.

Declaration
public byte[] MarshaledBlock { get; }
Property Value
Type Description
Byte[]
| Improve this Doc View Source

Round

A round of given proposal values.

Declaration
public int Round { get; }
Property Value
Type Description
Int32
| Improve this Doc View Source

Signature

A signature that signed with ProposalMetadata.

Declaration
public ImmutableArray<byte> Signature { get; }
Property Value
Type Description
ImmutableArray<Byte>
| Improve this Doc View Source

Timestamp

The time at which the proposal took place.

Declaration
public DateTimeOffset Timestamp { get; }
Property Value
Type Description
DateTimeOffset
| Improve this Doc View Source

ValidatorPublicKey

A PublicKey of proposing validator.

Declaration
public PublicKey ValidatorPublicKey { get; }
Property Value
Type Description
PublicKey
| Improve this Doc View Source

ValidRound

a latest valid round at the moment of given proposal.

Declaration
public int ValidRound { get; }
Property Value
Type Description
Int32

Methods

| Improve this Doc View Source

Equals(Proposal)

Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.

Declaration
[Pure]
public bool Equals(Proposal other)
Parameters
Type Name Description
Proposal other
Returns
Type Description
Boolean
| Improve this Doc View Source

Equals(Object)

Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.

Declaration
[Pure]
public override bool Equals(object obj)
Parameters
Type Name Description
Object obj
Returns
Type Description
Boolean
Overrides
Object.Equals(Object)
| Improve this Doc View Source

GetHashCode()

Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.

Declaration
[Pure]
public override int GetHashCode()
Returns
Type Description
Int32
Overrides
Object.GetHashCode()
| Improve this Doc View Source

ToByteArray()

Represents a Proposal from a validator for consensus. It contains an essential information ProposalMetadata to propose a block for a consensus in a height and a round, and its signature to verify. The signature is verified in constructor, so the instance of Proposal should be valid.

Declaration
public byte[] ToByteArray()
Returns
Type Description
Byte[]
| Improve this Doc View Source

Verify()

Verifies whether the ProposalMetadata is properly signed by Validator.

Declaration
[Pure]
public bool Verify()
Returns
Type Description
Boolean

true if the Signature is not empty and is a valid signature signed by Validator.

Implements

System.IEquatable<T>
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2018–2023 Planetarium