proto

package
v0.1.12 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 12, 2022 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrDuplicateMsgSigner is thrown when trying to aggregate duplicated signers
	ErrDuplicateMsgSigner = errors.New("can't aggregate messages with similar signers")
)
View Source
var RoundState_name = map[int32]string{
	0: "NotStarted",
	1: "PrePrepare",
	2: "Prepare",
	3: "Commit",
	4: "ChangeRound",
	5: "Decided",
	6: "Stopped",
}
View Source
var RoundState_value = map[string]int32{
	"NotStarted":  0,
	"PrePrepare":  1,
	"Prepare":     2,
	"Commit":      3,
	"ChangeRound": 4,
	"Decided":     5,
	"Stopped":     6,
}

Functions

This section is empty.

Types

type ChangeRoundData

type ChangeRoundData struct {
	PreparedRound        uint64   `protobuf:"varint,1,opt,name=prepared_round,json=preparedRound,proto3" json:"prepared_round,omitempty"`
	PreparedValue        []byte   `protobuf:"bytes,2,opt,name=prepared_value,json=preparedValue,proto3" json:"prepared_value,omitempty"`
	JustificationMsg     *Message `protobuf:"bytes,3,opt,name=justification_msg,json=justificationMsg,proto3" json:"justification_msg,omitempty"`
	JustificationSig     []byte   `protobuf:"bytes,4,opt,name=justification_sig,json=justificationSig,proto3" json:"justification_sig,omitempty"`
	SignerIds            []uint64 `protobuf:"varint,5,rep,packed,name=signer_ids,json=signerIds,proto3" json:"signer_ids,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*ChangeRoundData) Descriptor

func (*ChangeRoundData) Descriptor() ([]byte, []int)

func (*ChangeRoundData) GetJustificationMsg

func (m *ChangeRoundData) GetJustificationMsg() *Message

func (*ChangeRoundData) GetJustificationSig

func (m *ChangeRoundData) GetJustificationSig() []byte

func (*ChangeRoundData) GetPreparedRound

func (m *ChangeRoundData) GetPreparedRound() uint64

func (*ChangeRoundData) GetPreparedValue

func (m *ChangeRoundData) GetPreparedValue() []byte

func (*ChangeRoundData) GetSignerIds

func (m *ChangeRoundData) GetSignerIds() []uint64

func (*ChangeRoundData) ProtoMessage

func (*ChangeRoundData) ProtoMessage()

func (*ChangeRoundData) Reset

func (m *ChangeRoundData) Reset()

func (*ChangeRoundData) String

func (m *ChangeRoundData) String() string

func (*ChangeRoundData) VerifySig

func (d *ChangeRoundData) VerifySig(pk bls.PublicKey) (bool, error)

VerifySig returns true if the justification signed msg verifies against the public key, false otherwise

func (*ChangeRoundData) XXX_DiscardUnknown

func (m *ChangeRoundData) XXX_DiscardUnknown()

func (*ChangeRoundData) XXX_Marshal

func (m *ChangeRoundData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*ChangeRoundData) XXX_Merge

func (m *ChangeRoundData) XXX_Merge(src proto.Message)

func (*ChangeRoundData) XXX_Size

func (m *ChangeRoundData) XXX_Size() int

func (*ChangeRoundData) XXX_Unmarshal

func (m *ChangeRoundData) XXX_Unmarshal(b []byte) error

type InputValue

type InputValue struct {
	// Types that are valid to be assigned to Data:
	//	*InputValue_AttestationData
	//	*InputValue_AggregationData
	//	*InputValue_BeaconBlock
	Data isInputValue_Data `protobuf_oneof:"data"`
	// Types that are valid to be assigned to SignedData:
	//	*InputValue_Attestation
	//	*InputValue_Aggregation
	//	*InputValue_Block
	SignedData           isInputValue_SignedData `protobuf_oneof:"signed_data"`
	XXX_NoUnkeyedLiteral struct{}                `json:"-"`
	XXX_unrecognized     []byte                  `json:"-"`
	XXX_sizecache        int32                   `json:"-"`
}

func (*InputValue) Descriptor

func (*InputValue) Descriptor() ([]byte, []int)

func (*InputValue) GetAggregation

func (*InputValue) GetAggregationData

func (m *InputValue) GetAggregationData() *v1alpha1.AggregateAttestationAndProof

func (*InputValue) GetAttestation

func (m *InputValue) GetAttestation() *v1alpha1.Attestation

func (*InputValue) GetAttestationData

func (m *InputValue) GetAttestationData() *v1alpha1.AttestationData

func (*InputValue) GetBeaconBlock

func (m *InputValue) GetBeaconBlock() *v1alpha1.BeaconBlock

func (*InputValue) GetBlock

func (m *InputValue) GetBlock() *v1alpha1.SignedBeaconBlock

func (*InputValue) GetData

func (m *InputValue) GetData() isInputValue_Data

func (*InputValue) GetSignedData

func (m *InputValue) GetSignedData() isInputValue_SignedData

func (*InputValue) ProtoMessage

func (*InputValue) ProtoMessage()

func (*InputValue) Reset

func (m *InputValue) Reset()

func (*InputValue) String

func (m *InputValue) String() string

func (*InputValue) XXX_DiscardUnknown

func (m *InputValue) XXX_DiscardUnknown()

func (*InputValue) XXX_Marshal

func (m *InputValue) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*InputValue) XXX_Merge

func (m *InputValue) XXX_Merge(src proto.Message)

func (*InputValue) XXX_OneofWrappers

func (*InputValue) XXX_OneofWrappers() []interface{}

XXX_OneofWrappers is for the internal use of the proto package.

func (*InputValue) XXX_Size

func (m *InputValue) XXX_Size() int

func (*InputValue) XXX_Unmarshal

func (m *InputValue) XXX_Unmarshal(b []byte) error

type InputValue_Aggregation

type InputValue_Aggregation struct {
	Aggregation *v1alpha1.SignedAggregateAttestationAndProof `protobuf:"bytes,6,opt,name=aggregation,proto3,oneof"`
}

type InputValue_AggregationData

type InputValue_AggregationData struct {
	AggregationData *v1alpha1.AggregateAttestationAndProof `protobuf:"bytes,3,opt,name=aggregation_data,json=aggregationData,proto3,oneof"`
}

type InputValue_Attestation

type InputValue_Attestation struct {
	Attestation *v1alpha1.Attestation `protobuf:"bytes,5,opt,name=attestation,proto3,oneof"`
}

type InputValue_AttestationData

type InputValue_AttestationData struct {
	AttestationData *v1alpha1.AttestationData `protobuf:"bytes,2,opt,name=attestation_data,json=attestationData,proto3,oneof"`
}

type InputValue_BeaconBlock

type InputValue_BeaconBlock struct {
	BeaconBlock *v1alpha1.BeaconBlock `protobuf:"bytes,4,opt,name=beacon_block,json=beaconBlock,proto3,oneof"`
}

type InputValue_Block

type InputValue_Block struct {
	Block *v1alpha1.SignedBeaconBlock `protobuf:"bytes,7,opt,name=block,proto3,oneof"`
}

type InstanceConfig

type InstanceConfig struct {
	RoundChangeDurationSeconds   float32  `` /* 145-byte string literal not displayed */
	LeaderPreprepareDelaySeconds float32  `` /* 151-byte string literal not displayed */
	XXX_NoUnkeyedLiteral         struct{} `json:"-"`
	XXX_unrecognized             []byte   `json:"-"`
	XXX_sizecache                int32    `json:"-"`
}

func DefaultConsensusParams

func DefaultConsensusParams() *InstanceConfig

DefaultConsensusParams returns the default round change duration time

func (*InstanceConfig) Descriptor

func (*InstanceConfig) Descriptor() ([]byte, []int)

func (*InstanceConfig) GetLeaderPreprepareDelaySeconds added in v0.0.5

func (m *InstanceConfig) GetLeaderPreprepareDelaySeconds() float32

func (*InstanceConfig) GetRoundChangeDurationSeconds added in v0.0.5

func (m *InstanceConfig) GetRoundChangeDurationSeconds() float32

func (*InstanceConfig) ProtoMessage

func (*InstanceConfig) ProtoMessage()

func (*InstanceConfig) Reset

func (m *InstanceConfig) Reset()

func (*InstanceConfig) String

func (m *InstanceConfig) String() string

func (*InstanceConfig) XXX_DiscardUnknown

func (m *InstanceConfig) XXX_DiscardUnknown()

func (*InstanceConfig) XXX_Marshal

func (m *InstanceConfig) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*InstanceConfig) XXX_Merge

func (m *InstanceConfig) XXX_Merge(src proto.Message)

func (*InstanceConfig) XXX_Size

func (m *InstanceConfig) XXX_Size() int

func (*InstanceConfig) XXX_Unmarshal

func (m *InstanceConfig) XXX_Unmarshal(b []byte) error

type Message

type Message struct {
	Type   RoundState `protobuf:"varint,1,opt,name=type,proto3,enum=proto.RoundState" json:"type,omitempty"`
	Round  uint64     `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"`
	Lambda []byte     `protobuf:"bytes,3,opt,name=lambda,proto3" json:"lambda,omitempty"`
	// sequence number is an incremental number for each instance, much like a block number would be in a blockchain
	SeqNumber            uint64   `protobuf:"varint,4,opt,name=seq_number,json=seqNumber,proto3" json:"seq_number,omitempty"`
	Value                []byte   `protobuf:"bytes,5,opt,name=value,proto3" json:"value,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Message) Compare

func (msg *Message) Compare(other *Message) bool

Compare returns true if both messages are equal. DOES NOT compare signatures

func (*Message) Descriptor

func (*Message) Descriptor() ([]byte, []int)

func (*Message) GetLambda

func (m *Message) GetLambda() []byte

func (*Message) GetRound

func (m *Message) GetRound() uint64

func (*Message) GetSeqNumber

func (m *Message) GetSeqNumber() uint64

func (*Message) GetType

func (m *Message) GetType() RoundState

func (*Message) GetValue

func (m *Message) GetValue() []byte

func (*Message) ProtoMessage

func (*Message) ProtoMessage()

func (*Message) Reset

func (m *Message) Reset()

func (*Message) Sign

func (msg *Message) Sign(sk *bls.SecretKey) (*bls.Sign, error)

Sign takes a secret key and signs the Message

func (*Message) SigningRoot

func (msg *Message) SigningRoot() ([]byte, error)

SigningRoot returns a signing root (bytes)

func (*Message) String

func (m *Message) String() string

func (*Message) XXX_DiscardUnknown

func (m *Message) XXX_DiscardUnknown()

func (*Message) XXX_Marshal

func (m *Message) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Message) XXX_Merge

func (m *Message) XXX_Merge(src proto.Message)

func (*Message) XXX_Size

func (m *Message) XXX_Size() int

func (*Message) XXX_Unmarshal

func (m *Message) XXX_Unmarshal(b []byte) error

type Node

type Node struct {
	IbftId               uint64   `protobuf:"varint,1,opt,name=ibft_id,json=ibftId,proto3" json:"ibft_id,omitempty"`
	Pk                   []byte   `protobuf:"bytes,2,opt,name=pk,proto3" json:"pk,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (*Node) Descriptor

func (*Node) Descriptor() ([]byte, []int)

func (*Node) GetIbftId

func (m *Node) GetIbftId() uint64

func (*Node) GetPk

func (m *Node) GetPk() []byte

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) Reset

func (m *Node) Reset()

func (*Node) String

func (m *Node) String() string

func (*Node) XXX_DiscardUnknown

func (m *Node) XXX_DiscardUnknown()

func (*Node) XXX_Marshal

func (m *Node) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*Node) XXX_Merge

func (m *Node) XXX_Merge(src proto.Message)

func (*Node) XXX_Size

func (m *Node) XXX_Size() int

func (*Node) XXX_Unmarshal

func (m *Node) XXX_Unmarshal(b []byte) error

type RoundState

type RoundState int32
const (
	RoundState_NotStarted  RoundState = 0
	RoundState_PrePrepare  RoundState = 1
	RoundState_Prepare     RoundState = 2
	RoundState_Commit      RoundState = 3
	RoundState_ChangeRound RoundState = 4
	RoundState_Decided     RoundState = 5
	RoundState_Stopped     RoundState = 6
)

func (RoundState) EnumDescriptor

func (RoundState) EnumDescriptor() ([]byte, []int)

func (RoundState) String

func (x RoundState) String() string

type SignedMessage

type SignedMessage struct {
	Message              *Message `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	Signature            []byte   `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	SignerIds            []uint64 `protobuf:"varint,3,rep,packed,name=signer_ids,json=signerIds,proto3" json:"signer_ids,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_unrecognized     []byte   `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func AggregateMessages added in v0.1.2

func AggregateMessages(sigs []*SignedMessage) (*SignedMessage, error)

AggregateMessages will aggregate given msgs or return error

func (*SignedMessage) Aggregate

func (msg *SignedMessage) Aggregate(other *SignedMessage) error

Aggregate serialize and aggregates signature and signer ID to signed message

func (*SignedMessage) DeepCopy

func (msg *SignedMessage) DeepCopy() (*SignedMessage, error)

DeepCopy checks marshalling of SignedMessage and returns it

func (*SignedMessage) Descriptor

func (*SignedMessage) Descriptor() ([]byte, []int)

func (*SignedMessage) GetMessage

func (m *SignedMessage) GetMessage() *Message

func (*SignedMessage) GetSignature

func (m *SignedMessage) GetSignature() []byte

func (*SignedMessage) GetSignerIds

func (m *SignedMessage) GetSignerIds() []uint64

func (*SignedMessage) ProtoMessage

func (*SignedMessage) ProtoMessage()

func (*SignedMessage) Reset

func (m *SignedMessage) Reset()

func (*SignedMessage) SignersIDString

func (msg *SignedMessage) SignersIDString() string

SignersIDString returns all KeyManager's Ids as string

func (*SignedMessage) String

func (m *SignedMessage) String() string

func (*SignedMessage) VerifyAggregatedSig

func (msg *SignedMessage) VerifyAggregatedSig(pks []*bls.PublicKey) (bool, error)

VerifyAggregatedSig returns true if the signed msg verifies against the public keys, false if otherwise

func (*SignedMessage) VerifySig

func (msg *SignedMessage) VerifySig(pk *bls.PublicKey) (bool, error)

VerifySig returns true if the justification signed msg verifies against the public key, false if otherwise

func (*SignedMessage) XXX_DiscardUnknown

func (m *SignedMessage) XXX_DiscardUnknown()

func (*SignedMessage) XXX_Marshal

func (m *SignedMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)

func (*SignedMessage) XXX_Merge

func (m *SignedMessage) XXX_Merge(src proto.Message)

func (*SignedMessage) XXX_Size

func (m *SignedMessage) XXX_Size() int

func (*SignedMessage) XXX_Unmarshal

func (m *SignedMessage) XXX_Unmarshal(b []byte) error

type State

type State struct {
	Stage *threadsafe.SafeInt32
	// lambda is an instance unique identifier, much like a block hash in a blockchain
	Lambda *threadsafe.SafeBytes
	// sequence number is an incremental number for each instance, much like a block number would be in a blockchain
	SeqNumber     *threadsafe.SafeUint64
	InputValue    *threadsafe.SafeBytes
	Round         *threadsafe.SafeUint64
	PreparedRound *threadsafe.SafeUint64
	PreparedValue *threadsafe.SafeBytes
}

State holds an iBFT state, thread safe

func (*State) MarshalJSON added in v0.0.14

func (s *State) MarshalJSON() ([]byte, error)

MarshalJSON implements marshaling interface

func (*State) UnmarshalJSON added in v0.0.14

func (s *State) UnmarshalJSON(data []byte) error

UnmarshalJSON implements marshaling interface

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL