lib

package
v0.1.14-snapshot Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2025 License: MIT Imports: 45 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// the max possible block size without checking the governance parameter in state
	GlobalMaxBlockSize = int(256 * units.MB)
	// ensures developers are aware of a change to the header size (which is a consensus breaking change)
	ExpectedMaxBlockHeaderSize = 1652
)
View Source
const (
	// GLOBAL CONSTANTS
	UnknownChainId         = uint64(0)            // the default 'unknown' chain id
	CanopyChainId          = uint64(1)            // NOTE: to not break nested-chain recursion, this should not be used except for 'default config/genesis' developer setups
	DAOPoolID              = 2*math.MaxUint16 + 1 // must be above the MaxUint16 * 2 to ensure no 'overlap' with 'chainId + EscrowAddend'
	CanopyMainnetNetworkId = 1                    // the identifier of the 'mainnet' of Canopy
)
View Source
const (
	// FILE NAMES in the 'data directory'
	ConfigFilePath    = "config.json"        // the file path for the node configuration
	ValKeyPath        = "validator_key.json" // the file path for the node's private key
	GenesisFilePath   = "genesis.json"       // the file path for the genesis (first block)
	ProposalsFilePath = "proposals.json"     // the file path for governance proposal voting configuration
	PollsFilePath     = "polls.json"         // the file path for governance 'straw' polling voting and tracking
)
View Source
const (
	FilterOption_Off     FilterOption = 0 // true or false condition
	FilterOption_MustBe               = 1 // condition must be true
	FilterOption_Exclude              = 2 // condition must be false
)

nolint:all

View Source
const (
	NoCode ErrorCode = math.MaxUint32

	// Main Module
	MainModule ErrorModule = "main"

	// Main Module Error Codes
	CodeInvalidAddress              ErrorCode = 1
	CodeJSONMarshal                 ErrorCode = 2
	CodeJSONUnmarshal               ErrorCode = 3
	CodeUnmarshal                   ErrorCode = 4
	CodeMarshal                     ErrorCode = 5
	CodeFromAny                     ErrorCode = 6
	CodeToAny                       ErrorCode = 7
	CodeStringToBytes               ErrorCode = 8
	CodeNilBlock                    ErrorCode = 9
	CodeNilBlockHeader              ErrorCode = 10
	CodeInvalidBlockProposerAddress ErrorCode = 11
	CodeInvalidBlockHash            ErrorCode = 12
	CodeWrongLengthBlockHash        ErrorCode = 13
	CodeNilBlockTime                ErrorCode = 14
	CodeWrongLengthLastBlockHash    ErrorCode = 15
	CodeNilNetworkID                ErrorCode = 16
	CodeWrongLengthStateRoot        ErrorCode = 17
	CodeWrongLengthTxRoot           ErrorCode = 18
	CodeWrongLengthValRoot          ErrorCode = 19
	CodeWrongLengthNextValRoot      ErrorCode = 20
	CodeMerkleTree                  ErrorCode = 21
	CodeUnequalBlockHash            ErrorCode = 22
	CodeNewPubKeyFromBytes          ErrorCode = 23
	CodeNewMultiPubKey              ErrorCode = 24
	CodeWriteFile                   ErrorCode = 25
	CodeReadFile                    ErrorCode = 26
	CodeInvalidArgument             ErrorCode = 27
	CodeNilRewardRecipients         ErrorCode = 28
	CodeNoValidators                ErrorCode = 29
	CodeInvalidResultsHash          ErrorCode = 30
	CodeNonNilBlock                 ErrorCode = 31
	CodeProtoParse                  ErrorCode = 32

	// Consensus Module
	ConsensusModule ErrorModule = "consensus"

	// Consensus Module Error Codes
	CodeDuplicateTransaction            ErrorCode = 1
	CodeWrongHighQCHeight               ErrorCode = 2
	CodeMismatchResultsHash             ErrorCode = 3
	CodeDuplicateProposerMessage        ErrorCode = 4
	CodeDuplicateVote                   ErrorCode = 5
	CodeInvalidSignatureLength          ErrorCode = 6
	CodeInvalidPubKey                   ErrorCode = 7
	CodeEmptyView                       ErrorCode = 8
	CodeUnknownConsensusMessage         ErrorCode = 9
	CodeValidatorNotInSet               ErrorCode = 10
	CodeWrongHeight                     ErrorCode = 11
	CodeWrongBlockHeight                ErrorCode = 12
	CodeWrongPhase                      ErrorCode = 13
	CodePartialSignatureEmpty           ErrorCode = 14
	CodeInvalidPartialSignature         ErrorCode = 15
	CodeMismatchConsBlockHash           ErrorCode = 16
	CodeInvalidProposerPubKey           ErrorCode = 17
	CodeNoMaj23                         ErrorCode = 18
	CodeEmptyAggregateSignature         ErrorCode = 19
	CodeInvalidAggregateSignature       ErrorCode = 20
	CodeInvalidAggregateSignatureLen    ErrorCode = 21
	CodeEmptyAggregateSignatureBitmap   ErrorCode = 22
	CodeInvalidAggregateSignatureBitmap ErrorCode = 23
	CodeMismatchPublicKeys              ErrorCode = 24
	CodeEmptyEvidence                   ErrorCode = 25
	CodeAggregateSignature              ErrorCode = 26
	CodeEmptyQuorumCertificate          ErrorCode = 27
	CodeEvidenceTooOld                  ErrorCode = 28
	CodeMismatchProposals               ErrorCode = 29
	CodeFailedSafeNode                  ErrorCode = 30
	CodeInvalidValidatorIndex           ErrorCode = 31
	CodeUnableToAddSigner               ErrorCode = 32
	CodeEmptyMessage                    ErrorCode = 33
	CodeNotSubscribed                   ErrorCode = 34
	CodeInvalidEvidence                 ErrorCode = 35
	CodeMismatchEvidenceAndHeader       ErrorCode = 36
	CodeInvalidTxTime                   ErrorCode = 37
	CodeInvalidRCBuildHeight            ErrorCode = 38
	CodeExpectedBlockSizeLimit          ErrorCode = 39
	CodeNonNilCertResults               ErrorCode = 40
	CodeInvalidMemo                     ErrorCode = 41
	CodeNilCertResult                   ErrorCode = 42
	CodeNilLockOrder                    ErrorCode = 43
	CodeInvalidBuyerReceiveAddress      ErrorCode = 44
	CodeEmptyTransaction                ErrorCode = 45
	CodeHashSize                        ErrorCode = 46
	CodeInvalidLastQC                   ErrorCode = 47
	CodeMaxPort                         ErrorCode = 48
	CodePanic                           ErrorCode = 49
	CodeInvalidVDF                      ErrorCode = 50
	CodeNoSafeNodeJustification         ErrorCode = 51
	CodeNoSavedBlockOrResults           ErrorCode = 52
	CodeInvalidTxHeight                 ErrorCode = 53
	CodeInvalidSigner                   ErrorCode = 54
	CodeMismatchQcBlockHash             ErrorCode = 55
	CodeMismatchHeaderBlockHash         ErrorCode = 56
	CodeEmptyDoubleSigner               ErrorCode = 57
	CodeNonEquivocatingVote             ErrorCode = 58
	CodeInvalidEvidenceHeights          ErrorCode = 59
	CodeInvalidBuyerSendAddress         ErrorCode = 60
	CodeDuplicateCloseOrder             ErrorCode = 61
	CodeDuplicateResetOrder             ErrorCode = 62
	CodeMismatchCertHeight              ErrorCode = 63
	CodeNewHeight                       ErrorCode = 64
	CodeWrongViewHeight                 ErrorCode = 65
	CodeBadPort                         ErrorCode = 66
	CodeBadPortLowLimit                 ErrorCode = 67

	// State Machine Module
	StateMachineModule ErrorModule = "state_machine"

	// State Machine Module Error Codes
	CodeReadGenesisFile  ErrorCode = 1
	CodeFeeBelowState    ErrorCode = 2
	CodeUnauthorizedTx   ErrorCode = 3
	CodeEmptySignature   ErrorCode = 4
	CodeTxSignBytes      ErrorCode = 5
	CodeInvalidTxMessage ErrorCode = 6

	CodeMaxBlockSize              ErrorCode = 8
	CodeMaxTxSize                 ErrorCode = 9
	CodeRejectProposal            ErrorCode = 10
	CodeInvalidNetAddressLen      ErrorCode = 11
	CodeInvalidSignature          ErrorCode = 12
	CodeAddressEmpty              ErrorCode = 13
	CodeAddressSize               ErrorCode = 14
	CodeRecipientAddressEmpty     ErrorCode = 15
	CodeRecipientAddressSize      ErrorCode = 16
	CodeOutputAddressEmpty        ErrorCode = 17
	CodeOutputAddressSize         ErrorCode = 18
	CodeInvalidAmount             ErrorCode = 19
	CodePubKeyEmpty               ErrorCode = 20
	CodePubKeySize                ErrorCode = 21
	CodeParamKeyEmpty             ErrorCode = 22
	CodeParamValEmpty             ErrorCode = 23
	CodeInvalidSubsidy            ErrorCode = 24
	CodeInvalidOpcode             ErrorCode = 25
	CodeWrongChainId              ErrorCode = 26
	CodeUnknownMsg                ErrorCode = 27
	CodeInsufficientFunds         ErrorCode = 28
	CodeValidatorExists           ErrorCode = 29
	CodeValidatorNotExists        ErrorCode = 30
	CodeValidatorUnstaking        ErrorCode = 31
	CodeValidatorPaused           ErrorCode = 32
	CodeValidatorNotPaused        ErrorCode = 33
	CodeEmptyConsParams           ErrorCode = 34
	CodeEmptyValParams            ErrorCode = 35
	CodeEmptyFeeParams            ErrorCode = 36
	CodeEmptyGovParams            ErrorCode = 37
	CodeUnknownParam              ErrorCode = 38
	CodeUnknownParamType          ErrorCode = 39
	CodeUnknownParamSpace         ErrorCode = 40
	CodeInvalidProposalHash       ErrorCode = 41
	CodeInvalidRLPTx              ErrorCode = 42
	CodeInvalidERC20Tx            ErrorCode = 43
	CodeNonSubsidizedCommittee    ErrorCode = 44
	CodeInvalidNumberOfSamples    ErrorCode = 45
	CodeInvalidCertificateResults ErrorCode = 46
	CodePaymentRecipientsCount    ErrorCode = 47
	CodeInvalidPercentAllocation  ErrorCode = 48
	CodeErrNotEmpty               ErrorCode = 49
	CodeInvalidParam              ErrorCode = 50
	CodeErrFailedTransactions     ErrorCode = 51
	CodeInvalidProtocolVersion    ErrorCode = 52
	CodeInvalidDBKey              ErrorCode = 53
	CodeWrongStoreType            ErrorCode = 54
	CodeUnmarshalGenesis          ErrorCode = 55
	CodeInsufficientSupply        ErrorCode = 56
	CodeUnknownMsgName            ErrorCode = 57
	CodeUnknownPageable           ErrorCode = 58

	CodeInvalidBlockRange        ErrorCode = 60
	CodeInvalidPublicKey         ErrorCode = 61
	CodeInvalidDoubleSignHeights ErrorCode = 62
	CodeInvalidDoubleSigner      ErrorCode = 63
	CodeInvalidNumCommittees     ErrorCode = 64

	CodeValidatorIsADelegate ErrorCode = 66

	CodeInvalidChainId ErrorCode = 68
	CodeWrongNetworkID ErrorCode = 69

	CodeRootHeight               ErrorCode = 71
	CodeInvalidQCCommitteeHeight ErrorCode = 72

	CodeOrderNotFound ErrorCode = 74

	CodeMinimumOrderSize     ErrorCode = 76
	CodeOrderLocked          ErrorCode = 77
	CodeInvalidLockOrder     ErrorCode = 78
	CodeDuplicateLockOrder   ErrorCode = 79
	CodeInvalidBuyerDeadline ErrorCode = 80
	CodeInvalidCloseOrder    ErrorCode = 81

	CodeInvalidCheckpoint        ErrorCode = 83
	CodeInvalidSellOrder         ErrorCode = 84
	CodeStartPollHeight          ErrorCode = 85
	CodeEmptyChainId             ErrorCode = 86
	CodeMismatchCertResults      ErrorCode = 87
	CodeInvalidQCRootChainHeight ErrorCode = 88
	CodeEmptyCertificateResults  ErrorCode = 89
	CodeSlashNonValidator        ErrorCode = 90
	CodeEmptyOrderBook           ErrorCode = 91
	CodeNoSubsidizedCommittees   ErrorCode = 92
	CodeEmptyLotteryWinner       ErrorCode = 93
	CodeStakeBelowMinimum        ErrorCode = 94

	// P2P Module
	P2PModule ErrorModule = "p2p"

	// P2P Module Error Codes
	CodeUnknownP2PMessage       ErrorCode = 1
	CodeFailedRead              ErrorCode = 2
	CodeFailedWrite             ErrorCode = 3
	CodeMaxMessageSize          ErrorCode = 4
	CodePongTimeout             ErrorCode = 5
	CodeBlacklisted             ErrorCode = 6
	CodeErrorGroup              ErrorCode = 7
	CodeConnDecrypt             ErrorCode = 8
	CodeChunkLargerThanMax      ErrorCode = 9
	CodeFailedChallenge         ErrorCode = 10
	CodeFailedDiffieHellman     ErrorCode = 11
	CodeFailedHKDF              ErrorCode = 12
	CodePeerAlreadyExists       ErrorCode = 13
	CodePeerNotFound            ErrorCode = 14
	CodeFailedDial              ErrorCode = 15
	CodeMismatchPeerPublicKey   ErrorCode = 16
	CodeFailedListen            ErrorCode = 17
	CodeInvalidPeerPublicKey    ErrorCode = 18
	CodeSignatureSwap           ErrorCode = 19
	CodeMetaSwap                ErrorCode = 20
	CodeBadStream               ErrorCode = 21
	CodeBannedCountry           ErrorCode = 22
	CodeIPLookup                ErrorCode = 23
	CodeBannedIP                ErrorCode = 24
	CodeNonTCPAddr              ErrorCode = 25
	CodeInvalidNetAddressString ErrorCode = 26
	CodeInvalidNetAddressPubKey ErrorCode = 27
	CodeInvalidStateNetAddress  ErrorCode = 28
	CodeMaxOutbound             ErrorCode = 29
	CodeMaxInbound              ErrorCode = 30
	CodeBannedID                ErrorCode = 31
	CodeIncompatiblePeer        ErrorCode = 32
	CodeInvalidNetAddress       ErrorCode = 33

	StorageModule              ErrorModule = "store"
	CodeOpenDB                 ErrorCode   = 1
	CodeCloseDB                ErrorCode   = 2
	CodeStoreSet               ErrorCode   = 3
	CodeStoreGet               ErrorCode   = 4
	CodeStoreDelete            ErrorCode   = 5
	CodeCommitDB               ErrorCode   = 6
	CodeFlushBatch             ErrorCode   = 7
	CodeInvalidKey             ErrorCode   = 8
	CodeReserveKeyWrite        ErrorCode   = 9
	CodeInvalidMerkleTree      ErrorCode   = 10
	CodeInvalidMerkleTreeProof ErrorCode   = 11
	CodeGarbageCollectDB       ErrorCode   = 12
	CodeSetEntry               ErrorCode   = 13
	CodeReadBytes              ErrorCode   = 14
	CodeIndexBlock             ErrorCode   = 15

	RPCModule             ErrorModule = "rpc"
	CodeMempoolStopSignal ErrorCode   = 1
	CodeInvalidParams     ErrorCode   = 2
	CodeNewFSM            ErrorCode   = 3
	CodeTimeMachine       ErrorCode   = 4
	CodePostRequest       ErrorCode   = 5
	CodeGetRequest        ErrorCode   = 6
	CodeHttpStatus        ErrorCode   = 7
	CodeReadBody          ErrorCode   = 8
	CodeStringToCommittee ErrorCode   = 9
)
View Source
const (
	LogDirectory = "logs"
	LogFileName  = "log"
)
View Source
const (
	DebugLevel int32 = -4
	InfoLevel  int32 = 0
	WarnLevel  int32 = 4
	ErrorLevel int32 = 8

	Reset = iota
	RED
	GREEN
	YELLOW
	BLUE
	GRAY
)
View Source
const (
	TxResultsPageName      = "tx-results-page"      // the name of a page of transactions
	PendingResultsPageName = "pending-results-page" //  the name of a page of mempool pending transactions
	FailedTxsPageName      = "failed-txs-page"      // the name of a page of failed transactions
)
View Source
const (
	MaxAllowedPort = 65535 // maxAllowedPort is the maximum port number allowed.
	MinAllowedPort = 1025  // minAllowedPort is the minimum port number allowed to ensure it avoids commonly reserved system ports.
)
View Source
const (
	// StartingIterationsPerSecond is a 'best-guess' estimate based on 2.3 GHz 8-Core Intel Core i9
	StartingIterationsPerSecond = 550
	// IterationsFixedDecreasePercent is a 'best-guess' iteration reduction when a Stop() is called before finishing
	IterationsFixedDecreasePercent = float64(10)
	// EstimateIterations configures the number of iterations when starting up to 'estimate' the iterations per second
	EstimateIterations = 1 // more iterations  = longer startup time
)
View Source
const (
	BlockResultsPageName = "block-results-page" // BlockResults as a pageable name
)
View Source
const (
	DefaultPort = "9000" // default port when not specified
)

Variables

View Source
var (
	Phase_name = map[int32]string{
		0:  "UNKNOWN",
		1:  "ELECTION",
		2:  "ELECTION_VOTE",
		3:  "PROPOSE",
		4:  "PROPOSE_VOTE",
		5:  "PRECOMMIT",
		6:  "PRECOMMIT_VOTE",
		7:  "COMMIT",
		8:  "COMMIT_PROCESS",
		9:  "ROUND_INTERRUPT",
		10: "PACEMAKER",
	}
	Phase_value = map[string]int32{
		"UNKNOWN":         0,
		"ELECTION":        1,
		"ELECTION_VOTE":   2,
		"PROPOSE":         3,
		"PROPOSE_VOTE":    4,
		"PRECOMMIT":       5,
		"PRECOMMIT_VOTE":  6,
		"COMMIT":          7,
		"COMMIT_PROCESS":  8,
		"ROUND_INTERRUPT": 9,
		"PACEMAKER":       10,
	}
)

Enum value maps for Phase.

View Source
var (
	Topic_name = map[int32]string{
		0: "CONSENSUS",
		1: "BLOCK",
		2: "BLOCK_REQUEST",
		3: "TX",
		4: "PEERS_RESPONSE",
		5: "PEERS_REQUEST",
		6: "INVALID",
	}
	Topic_value = map[string]int32{
		"CONSENSUS":      0,
		"BLOCK":          1,
		"BLOCK_REQUEST":  2,
		"TX":             3,
		"PEERS_RESPONSE": 4,
		"PEERS_REQUEST":  5,
		"INVALID":        6,
	}
)

Enum value maps for Topic.

View Source
var File_block_proto protoreflect.FileDescriptor
View Source
var File_certificate_proto protoreflect.FileDescriptor
View Source
var File_consensus_proto protoreflect.FileDescriptor
View Source
var File_store_proto protoreflect.FileDescriptor
View Source
var File_wrapper_proto protoreflect.FileDescriptor
View Source
var MaxBlockHeaderSize uint64

MaxBlockHeaderSize is a consensus breaking change because it affects how the state machine checks if a block is above the MaxBlockSize as the State Machine is only aware of the txs.

View Source
var RegisteredMessages map[string]MessageI

Messages must be pre-registered for Transaction JSON unmarshalling

View Source
var RegisteredPageables = make(map[string]Pageable)

RegisteredPageables is a global slice of registered pageables for generic unmarshalling

Functions

func Append

func Append(a, b []byte) []byte

Append() is a 'safe append' when the caller wants to re-use the 'a' slice

func AppendWithBuffer

func AppendWithBuffer(buf *[]byte, a, b []byte) []byte

AppendWithBuffer() appends a and b into a fresh []byte using a buffer to reduce allocations. The result is safe to retain and use independently of a/b/buffer.

func BigLess

func BigLess(a *big.Int, b *big.Int) bool

BigLess() compares two big.Int values and returns true if the first is less

func BytesToString

func BytesToString(b []byte) string

BytesToString() converts a byte slice to a hexadecimal string

func BytesToTruncatedString

func BytesToTruncatedString(b []byte) string

BytesToTruncatedString() converts a byte slice to a truncated hexadecimal string

func CatchPanic

func CatchPanic(l LoggerI)

CatchPanic() catches any panic in the function call or child function calls

func ContainsByteSlice

func ContainsByteSlice(list [][]byte, target []byte) (found bool)

ContainsByteSlice() checks to see if the byte slice is within the list

func DecodeLengthPrefixed

func DecodeLengthPrefixed(key []byte) (segments [][]byte)

DecodeLengthPrefixed() decodes a key that is delimited by the length of the segment in a single byte

func DefaultDataDirPath

func DefaultDataDirPath() string

DefaultDataDirPath() is $USERHOME/.canopy

func EqualByteSlices

func EqualByteSlices(a, b [][]byte) bool

EqualByteSlices() performs equality check on two byte slices

func FormatInputIntoSeed

func FormatInputIntoSeed(lastProposerAddresses [][]byte, rootHeight, height, round uint64) []byte

FormatInputIntoSeed() returns the 'seed data' for the VRF function `seed = lastProposerAddresses + height + round`

func JoinLenPrefix

func JoinLenPrefix(toAppend ...[]byte) []byte

JoinLenPrefix() appends the items together separated by a single byte to represent the length of the segment

func MemHash

func MemHash(data []byte) uint64

MemHash is the hash function used by go map, it utilizes available hardware instructions(behaves as aeshash if aes instruction is available). NOTE: The hash seed changes for every process. So, this cannot be used as a persistent hash.

func NewHexBytesFromString

func NewHexBytesFromString(s string) (HexBytes, ErrorI)

NewHexBytesFromString() converts a hexadecimal string into HexBytes

func NewMempoolIterator

func NewMempoolIterator(p MempoolTxs) *mempoolIterator

NewMempoolIterator() initializes a new iterator for the mempool transactions

func NewTimer

func NewTimer() *time.Timer

NewTimer() creates a 0 value initialized instance of a timer

func NewValidatorSet

func NewValidatorSet(validators *ConsensusValidators) (ValidatorSet, ErrorI)

NewValidatorSet() initializes a ValidatorSet from a given set of consensus validators

func PrintStackTrace

func PrintStackTrace(print bool) (fns []string)

func RandSlice

func RandSlice(byteSize uint64) []byte

RandSlice is a helper to generate a random byte slice of the given size.

func ResetTimer

func ResetTimer(t *time.Timer, d time.Duration)

ResetTimer() stops the existing timer, and resets with the new duration

func StopTimer

func StopTimer(t *time.Timer)

StopTimer() stops the existing timer

func TimeTrack

func TimeTrack(l LoggerI, start time.Time)

TimeTrack() a utility function to benchmark the time of caller function

func TruncateSlice

func TruncateSlice[T any](slice []T, max int) []T

TruncateSlice() safely ensures that a slice doesn't exceed the max size

func Uint64Percentage

func Uint64Percentage(total uint64, percentage uint64) (res uint64)

Uint64Percentage() calculates the percentage of an amount

func Uint64PercentageDiv

func Uint64PercentageDiv(dividend, divisor uint64) (percent uint64)

Uint64PercentageDiv() calculates the percentage from dividend/divisor

func Uint64ReducePercentage

func Uint64ReducePercentage(fullAmount, percentage uint64) (res uint64)

Uint64ReducePercentage() reduces an amount by a specified percentage

func Uint64ToBigFloat

func Uint64ToBigFloat(u uint64) *big.Float

Uint64ToBigFloat() converts a uint64 to a big.Float

func ValidNetURLInput

func ValidNetURLInput(netURL string) bool

ValidNetURLInput() validates the input netURL via regex Allow: - optional tcp:// prefix - valid hostname - valid ip4 and ip6 address - optional port (e.g., :80)

Disallow: - Sub-paths (e.g., /path)

func WeightedPseudorandom

func WeightedPseudorandom(p *PseudorandomParams) (publicKey crypto.PublicKeyI)

WeightedPseudorandom() generates an index for the 'token' that the winner has in their stake

Types

type AggregateSignature

type AggregateSignature struct {

	// signature: is the compacted signature bytes of the aggregate quorum
	Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
	// bitmap: used to efficiently track which signatures from the list of participants are included in the
	// aggregate signature (as only +2/3rds are needed to make it valid. Bit 1 is included Bit 0 is not
	Bitmap []byte `protobuf:"bytes,2,opt,name=bitmap,proto3" json:"bitmap,omitempty"`
	// contains filtered or unexported fields
}

An Aggregate Signature is a single, compact signature created by combining multiple individual signatures from different participants. It allows verification that each participant signed the same message, which saves space and improves efficiency in blockchain and consensus protocols by reducing the need to store or verify multiple separate signatures.

func (*AggregateSignature) Check

func (x *AggregateSignature) Check(sb SignByte, vs ValidatorSet) (isPartialQC bool, err ErrorI)

Check() validates a +2/3 majority of the signature using the payload bytes and the ValidatorSet NOTE: "partialQC" means the signature is valid but does not reach a +2/3 majority

func (*AggregateSignature) CheckBasic

func (x *AggregateSignature) CheckBasic() ErrorI

CheckBasic() validates the basic structure and length of the AggregateSignature

func (*AggregateSignature) Descriptor deprecated

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

Deprecated: Use AggregateSignature.ProtoReflect.Descriptor instead.

func (*AggregateSignature) GetBitmap

func (x *AggregateSignature) GetBitmap() []byte

func (*AggregateSignature) GetDoubleSigners

func (x *AggregateSignature) GetDoubleSigners(y *AggregateSignature, vs ValidatorSet) (doubleSigners [][]byte, err ErrorI)

GetDoubleSigners() compares the signers of two signatures and return who signed both

func (*AggregateSignature) GetNonSigners

func (x *AggregateSignature) GetNonSigners(validatorList *ConsensusValidators) (nonSignerPubKeys [][]byte, nonSignerPercent int, err ErrorI)

GetNonSigners() returns the public keys and corresponding percentage of voting power who are not included in the AggregateSignature

func (*AggregateSignature) GetSignature

func (x *AggregateSignature) GetSignature() []byte

func (*AggregateSignature) GetSigners

func (x *AggregateSignature) GetSigners(vs ValidatorSet) (signers [][]byte, signedPower uint64, err ErrorI)

GetSigners() returns the public keys and corresponding combined voting power of those who signed

func (AggregateSignature) MarshalJSON

func (x AggregateSignature) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json.Marshaller interface

func (*AggregateSignature) ProtoMessage

func (*AggregateSignature) ProtoMessage()

func (*AggregateSignature) ProtoReflect

func (x *AggregateSignature) ProtoReflect() protoreflect.Message

func (*AggregateSignature) Reset

func (x *AggregateSignature) Reset()

func (*AggregateSignature) String

func (x *AggregateSignature) String() string

func (*AggregateSignature) UnmarshalJSON

func (x *AggregateSignature) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() implements the json.Unmarshaler interface

type BFTMetrics

type BFTMetrics struct {
	Height            prometheus.Gauge     // what's the height of this chain?
	Round             prometheus.Gauge     // what's the current BFT round
	Phase             prometheus.Gauge     // what's the current BFT phase
	ElectionTime      prometheus.Histogram // how long did the election phase take?
	ElectionVoteTime  prometheus.Histogram // how long did the election vote phase take?
	ProposeTime       prometheus.Histogram // how long did the propose phase take?
	ProposeVoteTime   prometheus.Histogram // how long did the propose vote phase take?
	PrecommitTime     prometheus.Histogram // how long did the precommit phase take?
	PrecommitVoteTime prometheus.Histogram // how long did the precommit vote phase take?
	CommitTime        prometheus.Histogram // how long did the commit phase take?
	CommitProcessTime prometheus.Histogram // how long did the commit process phase take?
	RootHeight        prometheus.Gauge     // what's the height of the root-chain?
}

BFTMetrics represents the telemetry for the BFT module

type Block

type Block struct {

	// block_header: is the essential summary information of the block
	BlockHeader *BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"blockHeader"` // @gotags: json:"blockHeader"
	// transactions: is the batch of transactions in this block
	Transactions [][]byte `protobuf:"bytes,2,rep,name=transactions,proto3" json:"transactions,omitempty"`
	// contains filtered or unexported fields
}

A block is a batch of transactions and essential header information that marks a unit of committed information in the blockchain. Blocks are linked together in a sequence, creating a secure, verifiable chain of transaction history.

func (*Block) BytesToBlockHash

func (x *Block) BytesToBlockHash(blockBytes []byte) (hash []byte, err ErrorI)

BytesToBlockHash() converts block bytes into a block hash

func (*Block) Check

func (x *Block) Check(networkID, chainId uint64) ErrorI

Check() 'sanity checks' the Block structure

func (*Block) Descriptor deprecated

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

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetBlockHeader

func (x *Block) GetBlockHeader() *BlockHeader

func (*Block) GetTransactions

func (x *Block) GetTransactions() [][]byte

func (*Block) Hash

func (x *Block) Hash() ([]byte, ErrorI)

Hash() computes, sets, and returns the BlockHash

func (Block) MarshalJSON

func (x Block) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json.Marshaller interface

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

func (x *Block) ProtoReflect() protoreflect.Message

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

func (*Block) UnmarshalJSON

func (x *Block) UnmarshalJSON(blockBytes []byte) (err error)

UnmarshalJSON() implements the json.Unmarshaler interface

type BlockHeader

type BlockHeader struct {

	// height: the number of blocks in the blockchain before a specific block, indicating its position in the chain
	// and representing the blockchain's length
	Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	// hash: a unique identifier for a block, generated by applying a cryptographic hash function to the block's contents,
	// ensuring its integrity and connecting it to the previous block in the chain.
	Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"`
	// network_id: a unique identifier used to distinguish different canopy blockchain networks, ensuring that
	// transactions and blocks are only processed within the correct network
	NetworkId uint32 `protobuf:"varint,3,opt,name=network_id,json=networkId,proto3" json:"networkID"` // @gotags: json:"networkID"
	// time: specific time recorded in a block when it is created by the proposer, indicating when the block was proposed
	Time uint64 `protobuf:"varint,4,opt,name=time,proto3" json:"time,omitempty"`
	// num_txs: the count of transactions in the block
	NumTxs uint64 `protobuf:"varint,5,opt,name=num_txs,json=numTxs,proto3" json:"numTxs"` // @gotags: json:"numTxs"
	// total_txs: the count of transactions in the blockchain
	TotalTxs uint64 `protobuf:"varint,6,opt,name=total_txs,json=totalTxs,proto3" json:"totalTxs"` // @gotags: json:"totalTxs"
	// total_vdf_iterations: the total number of verifiable random delay function iterations in the blockchain
	TotalVdfIterations uint64 `protobuf:"varint,7,opt,name=total_vdf_iterations,json=totalVdfIterations,proto3" json:"totalVDFIterations"` // @gotags: json:"totalVDFIterations"
	// last_block_hash: the unique identifier of the previous block, chaining this block to the previous, ensuring the
	// continuity of the blockchain
	LastBlockHash []byte `protobuf:"bytes,8,opt,name=last_block_hash,json=lastBlockHash,proto3" json:"lastBlockHash"` // @gotags: json:"lastBlockHash"
	// state_root: the merkle root of the 'state commit store' representing  the entire state of the blockchain at
	// this height
	StateRoot []byte `protobuf:"bytes,9,opt,name=state_root,json=stateRoot,proto3" json:"stateRoot"` // @gotags: json:"stateRoot"
	// transaction_root: the merkle root of the 'transactions' included in this block
	TransactionRoot []byte `protobuf:"bytes,10,opt,name=transaction_root,json=transactionRoot,proto3" json:"transactionRoot"` // @gotags: json:"transactionRoot"
	// validator_root: the merkle root of the validators that signed the quorum certificate for this height
	// ensuring that the list of validators (who are responsible for proposing and validating blocks) is consistent
	// and tamper-proof, allowing participants to independently verify the integrity of the validator set at any point
	// in the blockchain
	ValidatorRoot []byte `protobuf:"bytes,11,opt,name=validator_root,json=validatorRoot,proto3" json:"validatorRoot"` // @gotags: json:"validatorRoot"
	// next_validator_root: the merkle root of the validators who are responsible for proposing and validating the next
	// block - ensuring smooth transitions between validator sets. This design allows lite-node operations as just with
	// the block_headers a node is able to validate the signers of the entire blockchain
	NextValidatorRoot []byte `protobuf:"bytes,12,opt,name=next_validator_root,json=nextValidatorRoot,proto3" json:"nextValidatorRoot"` // @gotags: json:"nextValidatorRoot"
	// proposer_address: is the short version of the public key of the Validator who proposed this block
	ProposerAddress []byte `protobuf:"bytes,13,opt,name=proposer_address,json=proposerAddress,proto3" json:"proposerAddress"` // @gotags: json:"proposerAddress"
	// vdf: the verifiable delay proof for this block. The VDF serves as a protection mechanism against historical
	// forking attacks
	Vdf *crypto.VDF `protobuf:"bytes,14,opt,name=vdf,proto3" json:"vdf,omitempty"`
	// last_quorum_certificate: The quorum certificate from the previous block is included in the block header to ensure
	// all nodes have the same record of blockchain certificates, preventing discrepancies where the same block
	// could be accepted with different super-majorities of signatures across nodes.
	LastQuorumCertificate *QuorumCertificate `protobuf:"bytes,15,opt,name=last_quorum_certificate,json=lastQuorumCertificate,proto3" json:"lastQuorumCertificate"` // @gotags: json:"lastQuorumCertificate"
	// contains filtered or unexported fields
}

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ A block_header contains essential summary information about a block, like its unique identifier (hash), the previous block’s hash, timestamp, and block height. All of which help secure the block and connect it to the chain.

func (*BlockHeader) Check

func (x *BlockHeader) Check(networkID, chainId uint64) ErrorI

Check() 'sanity checks' the block header

func (*BlockHeader) Descriptor deprecated

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

Deprecated: Use BlockHeader.ProtoReflect.Descriptor instead.

func (*BlockHeader) GetHash

func (x *BlockHeader) GetHash() []byte

func (*BlockHeader) GetHeight

func (x *BlockHeader) GetHeight() uint64

func (*BlockHeader) GetLastBlockHash

func (x *BlockHeader) GetLastBlockHash() []byte

func (*BlockHeader) GetLastQuorumCertificate

func (x *BlockHeader) GetLastQuorumCertificate() *QuorumCertificate

func (*BlockHeader) GetNetworkId

func (x *BlockHeader) GetNetworkId() uint32

func (*BlockHeader) GetNextValidatorRoot

func (x *BlockHeader) GetNextValidatorRoot() []byte

func (*BlockHeader) GetNumTxs

func (x *BlockHeader) GetNumTxs() uint64

func (*BlockHeader) GetProposerAddress

func (x *BlockHeader) GetProposerAddress() []byte

func (*BlockHeader) GetStateRoot

func (x *BlockHeader) GetStateRoot() []byte

func (*BlockHeader) GetTime

func (x *BlockHeader) GetTime() uint64

func (*BlockHeader) GetTotalTxs

func (x *BlockHeader) GetTotalTxs() uint64

func (*BlockHeader) GetTotalVdfIterations

func (x *BlockHeader) GetTotalVdfIterations() uint64

func (*BlockHeader) GetTransactionRoot

func (x *BlockHeader) GetTransactionRoot() []byte

func (*BlockHeader) GetValidatorRoot

func (x *BlockHeader) GetValidatorRoot() []byte

func (*BlockHeader) GetVdf

func (x *BlockHeader) GetVdf() *crypto.VDF

func (BlockHeader) MarshalJSON

func (x BlockHeader) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json.Marshaller interface

func (*BlockHeader) ProtoMessage

func (*BlockHeader) ProtoMessage()

func (*BlockHeader) ProtoReflect

func (x *BlockHeader) ProtoReflect() protoreflect.Message

func (*BlockHeader) Reset

func (x *BlockHeader) Reset()

func (*BlockHeader) SetHash

func (x *BlockHeader) SetHash() ([]byte, ErrorI)

SetHash() computes and sets the BlockHash to BlockHeader.Hash

func (*BlockHeader) String

func (x *BlockHeader) String() string

func (*BlockHeader) UnmarshalJSON

func (x *BlockHeader) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() implements the json.Unmarshaler interface

type BlockMessage

type BlockMessage struct {

	// chain_id: is the unique identifier of the committee associated with this message
	ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// max_height: the maximum height of this blockchain the peer is aware of
	MaxHeight uint64 `protobuf:"varint,2,opt,name=max_height,json=maxHeight,proto3" json:"maxHeight"` // @gotags: json:"maxHeight"
	// total_vdf_iterations: the total number of vdf iterations associated with this blockchain
	// this helps a peer to chose given a choice between two forks as well as verify the integrity of the peer
	TotalVdfIterations uint64 `protobuf:"varint,3,opt,name=total_vdf_iterations,json=totalVdfIterations,proto3" json:"totalVDFIterations"` // @gotags: json:"totalVDFIterations"
	// block_and_certificate: is the actual block and the super-majority signed quorum certificate that justifies it
	BlockAndCertificate *QuorumCertificate `protobuf:"bytes,4,opt,name=BlockAndCertificate,proto3" json:"blockAndCertificate"` // @gotags: json:"blockAndCertificate"
	// timestamp: optional timestamp to help coordinate new height
	Time uint64 `protobuf:"varint,5,opt,name=time,proto3" json:"time,omitempty"`
	// contains filtered or unexported fields
}

BlockMessage is a p2p message payload that is responding to a block request message

func (*BlockMessage) Descriptor deprecated

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

Deprecated: Use BlockMessage.ProtoReflect.Descriptor instead.

func (*BlockMessage) GetBlockAndCertificate

func (x *BlockMessage) GetBlockAndCertificate() *QuorumCertificate

func (*BlockMessage) GetChainId

func (x *BlockMessage) GetChainId() uint64

func (*BlockMessage) GetMaxHeight

func (x *BlockMessage) GetMaxHeight() uint64

func (*BlockMessage) GetTime

func (x *BlockMessage) GetTime() uint64

func (*BlockMessage) GetTotalVdfIterations

func (x *BlockMessage) GetTotalVdfIterations() uint64

func (*BlockMessage) ProtoMessage

func (*BlockMessage) ProtoMessage()

func (*BlockMessage) ProtoReflect

func (x *BlockMessage) ProtoReflect() protoreflect.Message

func (*BlockMessage) Reset

func (x *BlockMessage) Reset()

func (*BlockMessage) String

func (x *BlockMessage) String() string

type BlockMetrics

type BlockMetrics struct {
	BlockProcessingTime prometheus.Histogram // how long does it take for this node to commit a block?
	BlockSize           prometheus.Gauge     // what is the size of the block in bytes?
	BlockNumTxs         prometheus.Gauge     // how many transactions has the node processed?
	LargestTxSize       prometheus.Gauge     // what is the largest tx size in a block?
	BlockVDFIterations  prometheus.Gauge     // how many vdf iterations are included in the block?
	NonSignerPercent    prometheus.Gauge     // what percent of the voting power were non signers
}

BlockMetrics represents telemetry for block health

type BlockRequestMessage

type BlockRequestMessage struct {

	// chain_id: is the unique identifier of the committee associated with this message
	ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// height: the height of the block being requested
	Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height,omitempty"`
	// height_only: signals if this is a max-height only request, no block is expected in the response to this type
	// of message
	HeightOnly bool `protobuf:"varint,3,opt,name=height_only,json=heightOnly,proto3" json:"heightOnly"` // @gotags: json:"heightOnly"
	// contains filtered or unexported fields
}

BlockRequestMessage is a p2p message payload that is requesting a block and/or max_height of the peer

func (*BlockRequestMessage) Descriptor deprecated

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

Deprecated: Use BlockRequestMessage.ProtoReflect.Descriptor instead.

func (*BlockRequestMessage) GetChainId

func (x *BlockRequestMessage) GetChainId() uint64

func (*BlockRequestMessage) GetHeight

func (x *BlockRequestMessage) GetHeight() uint64

func (*BlockRequestMessage) GetHeightOnly

func (x *BlockRequestMessage) GetHeightOnly() bool

func (*BlockRequestMessage) ProtoMessage

func (*BlockRequestMessage) ProtoMessage()

func (*BlockRequestMessage) ProtoReflect

func (x *BlockRequestMessage) ProtoReflect() protoreflect.Message

func (*BlockRequestMessage) Reset

func (x *BlockRequestMessage) Reset()

func (*BlockRequestMessage) String

func (x *BlockRequestMessage) String() string

type BlockResult

type BlockResult struct {

	// block_header: is the essential summary information of the block
	BlockHeader *BlockHeader `protobuf:"bytes,1,opt,name=block_header,json=blockHeader,proto3" json:"blockHeader"` // @gotags: json:"blockHeader"
	// transactions: is a batch of transaction results in this block
	Transactions []*TxResult `protobuf:"bytes,2,rep,name=transactions,proto3" json:"transactions,omitempty"`
	// meta: is non-essential metadata about the processing of this block
	Meta *BlockResultMeta `protobuf:"bytes,3,opt,name=meta,proto3" json:"meta,omitempty"`
	// contains filtered or unexported fields
}

a block_result is a batch of transaction results, essential header information, and non-essential metadata about processing that block. A block result is made by applying a 'block' against a state machine.

func (*BlockResult) Descriptor deprecated

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

Deprecated: Use BlockResult.ProtoReflect.Descriptor instead.

func (*BlockResult) GetBlockHeader

func (x *BlockResult) GetBlockHeader() *BlockHeader

func (*BlockResult) GetMeta

func (x *BlockResult) GetMeta() *BlockResultMeta

func (*BlockResult) GetTransactions

func (x *BlockResult) GetTransactions() []*TxResult

func (*BlockResult) ProtoMessage

func (*BlockResult) ProtoMessage()

func (*BlockResult) ProtoReflect

func (x *BlockResult) ProtoReflect() protoreflect.Message

func (*BlockResult) Reset

func (x *BlockResult) Reset()

func (*BlockResult) String

func (x *BlockResult) String() string

func (*BlockResult) ToBlock

func (x *BlockResult) ToBlock() (*Block, ErrorI)

ToBlock() converts the BlockResult into a Block object

type BlockResultMeta

type BlockResultMeta struct {

	// size: number of bytes in the block
	Size uint64 `protobuf:"varint,1,opt,name=size,proto3" json:"size,omitempty"`
	// took: duration string of the block in milliseconds
	Took uint64 `protobuf:"varint,2,opt,name=took,proto3" json:"took,omitempty"`
	// contains filtered or unexported fields
}

block_result_meta is non-essential information about the processing of a block

func (*BlockResultMeta) Descriptor deprecated

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

Deprecated: Use BlockResultMeta.ProtoReflect.Descriptor instead.

func (*BlockResultMeta) GetSize

func (x *BlockResultMeta) GetSize() uint64

func (*BlockResultMeta) GetTook

func (x *BlockResultMeta) GetTook() uint64

func (*BlockResultMeta) ProtoMessage

func (*BlockResultMeta) ProtoMessage()

func (*BlockResultMeta) ProtoReflect

func (x *BlockResultMeta) ProtoReflect() protoreflect.Message

func (*BlockResultMeta) Reset

func (x *BlockResultMeta) Reset()

func (*BlockResultMeta) String

func (x *BlockResultMeta) String() string

type BlockResults

type BlockResults []*BlockResult

BlockResults is a collection of Blocks containing their TransactionResults and Meta after commitment

func (*BlockResults) New

func (b *BlockResults) New() Pageable

New() Satisfies the pageable interface

type CertificateResult

type CertificateResult struct {

	// reward_recipients: the recipients who are rewarded based on the quorum certificate
	// specifically who the committee agreed to reward from the committee treasury
	RewardRecipients *RewardRecipients `protobuf:"bytes,1,opt,name=reward_recipients,json=rewardRecipients,proto3" json:"rewardRecipients"` // @gotags: json:"rewardRecipients"
	// slash_recipients: the recipients who are penalized (slashed) based on the quorum certificate
	// specifically who the committee agreed to slash due to evidence of bad behavior
	SlashRecipients *SlashRecipients `protobuf:"bytes,2,opt,name=slash_recipients,json=slashRecipients,proto3" json:"slashRecipients"` // @gotags: json:"slashRecipients"
	// orders: contains information regarding the 'buying side' of sell orders
	// including actions like 'buy/reserve order' or 'close/complete order'
	Orders *Orders `protobuf:"bytes,3,opt,name=orders,proto3" json:"orders,omitempty"`
	// checkpoint: contains information from the 3rd party chain in order for Canopy to provide Checkpoint-as-a-Service
	Checkpoint *Checkpoint `protobuf:"bytes,4,opt,name=checkpoint,proto3" json:"checkpoint,omitempty"`
	// retired: signals if the committee wants to shut down and mark itself as 'forever unsubsidized' on the root-chain
	Retired bool `protobuf:"varint,5,opt,name=retired,proto3" json:"retired,omitempty"`
	// contains filtered or unexported fields
}

CertificateResult contains the outcome of a certificate produced by a quorum in consensus

func (*CertificateResult) CheckBasic

func (x *CertificateResult) CheckBasic() (err ErrorI)

CheckBasic() provides basic 'sanity' checks on the CertificateResult structure

func (*CertificateResult) Descriptor deprecated

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

Deprecated: Use CertificateResult.ProtoReflect.Descriptor instead.

func (*CertificateResult) Equals

Equals() compares two certificate results to ensure equality

func (*CertificateResult) GetCheckpoint

func (x *CertificateResult) GetCheckpoint() *Checkpoint

func (*CertificateResult) GetOrders

func (x *CertificateResult) GetOrders() *Orders

func (*CertificateResult) GetRetired

func (x *CertificateResult) GetRetired() bool

func (*CertificateResult) GetRewardRecipients

func (x *CertificateResult) GetRewardRecipients() *RewardRecipients

func (*CertificateResult) GetSlashRecipients

func (x *CertificateResult) GetSlashRecipients() *SlashRecipients

func (*CertificateResult) Hash

func (x *CertificateResult) Hash() []byte

Hash() returns the cryptographic hash of the canonical Sign Bytes of the CertificateResult

func (*CertificateResult) ProtoMessage

func (*CertificateResult) ProtoMessage()

func (*CertificateResult) ProtoReflect

func (x *CertificateResult) ProtoReflect() protoreflect.Message

func (*CertificateResult) Reset

func (x *CertificateResult) Reset()

func (*CertificateResult) String

func (x *CertificateResult) String() string

type Channels

type Channels map[Topic]chan *MessageAndMetadata

Channels are logical communication paths or streams that operate over a single 'multiplexed' network connection

type Checkpoint

type Checkpoint struct {

	// height: the height of the third party chain
	Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	// block_hash: the cryptographic hash of the third party chain block for the height
	BlockHash []byte `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"` // @gotags: json:"blockHash"
	// contains filtered or unexported fields
}

Checkpoint is 3rd party chain information that allows Canopy to provide Checkpointing-as-a-Service for the 3rd party checkpointing is important to prevent `long-range-attacks` in proof of stake blockchains and is currently the secure standard

func (*Checkpoint) CheckBasic

func (x *Checkpoint) CheckBasic() (err ErrorI)

CheckBasic() performs stateless validation on a Checkpoint object

func (*Checkpoint) Descriptor deprecated

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

Deprecated: Use Checkpoint.ProtoReflect.Descriptor instead.

func (*Checkpoint) Equals

func (x *Checkpoint) Equals(y *Checkpoint) bool

Equals() compares two Checkpoints for equality

func (*Checkpoint) GetBlockHash

func (x *Checkpoint) GetBlockHash() []byte

func (*Checkpoint) GetHeight

func (x *Checkpoint) GetHeight() uint64

func (*Checkpoint) ProtoMessage

func (*Checkpoint) ProtoMessage()

func (*Checkpoint) ProtoReflect

func (x *Checkpoint) ProtoReflect() protoreflect.Message

func (*Checkpoint) Reset

func (x *Checkpoint) Reset()

func (*Checkpoint) String

func (x *Checkpoint) String() string

type CloseOrder

type CloseOrder struct {

	// order_id: is the number id that is unique to this committee to identify the order
	OrderId []byte `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"orderID"` // @gotags: json:"orderID"
	// chain_id: is the id of the committee
	ChainId uint64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// close_order: is the tag to represent the intent to embed a close order
	CloseOrder bool `protobuf:"varint,3,opt,name=close_order,json=closeOrder,proto3" json:"closeOrder"` //@gotags: json:"closeOrder"
	// contains filtered or unexported fields
}

CloseOrder is a buyer completing the purchase of an order, often referred to as 'buying' the order

func (*CloseOrder) Descriptor deprecated

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

Deprecated: Use CloseOrder.ProtoReflect.Descriptor instead.

func (*CloseOrder) GetChainId

func (x *CloseOrder) GetChainId() uint64

func (*CloseOrder) GetCloseOrder

func (x *CloseOrder) GetCloseOrder() bool

func (*CloseOrder) GetOrderId

func (x *CloseOrder) GetOrderId() []byte

func (CloseOrder) MarshalJSON

func (x CloseOrder) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json.Marshaller interface for CloseOrder

func (*CloseOrder) ProtoMessage

func (*CloseOrder) ProtoMessage()

func (*CloseOrder) ProtoReflect

func (x *CloseOrder) ProtoReflect() protoreflect.Message

func (*CloseOrder) Reset

func (x *CloseOrder) Reset()

func (*CloseOrder) String

func (x *CloseOrder) String() string

func (*CloseOrder) UnmarshalJSON

func (x *CloseOrder) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() implements the json.Unmarshaler interface for CloseOrder

type CommitID

type CommitID struct {

	// height: the identifier of the commit_id referencing the block height
	Height uint64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
	// root: the merkle root of the SMT state commit store
	Root []byte `protobuf:"bytes,2,opt,name=root,proto3" json:"root,omitempty"`
	// contains filtered or unexported fields
}

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ CommitID is a structure that holds the merkle root for a certain height

func (*CommitID) Descriptor deprecated

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

Deprecated: Use CommitID.ProtoReflect.Descriptor instead.

func (*CommitID) GetHeight

func (x *CommitID) GetHeight() uint64

func (*CommitID) GetRoot

func (x *CommitID) GetRoot() []byte

func (*CommitID) ProtoMessage

func (*CommitID) ProtoMessage()

func (*CommitID) ProtoReflect

func (x *CommitID) ProtoReflect() protoreflect.Message

func (*CommitID) Reset

func (x *CommitID) Reset()

func (*CommitID) String

func (x *CommitID) String() string

type CommitteeData

type CommitteeData struct {

	// chain_id: is the unique identifier of the chain and the committee of Validators responsible for it
	ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// last_updated_height: is the Canopy height included in the most recently processed Certificate Results transaction
	// This protects against historical committee attacks and ensures sequentiality among committees
	LastRootHeightUpdated uint64 `protobuf:"varint,2,opt,name=last_root_height_updated,json=lastRootHeightUpdated,proto3" json:"lastRootHeightUpdated"` // @gotags: json:"lastRootHeightUpdated"
	// last_chain_height_updated: is the 3rd party chain height included in the most recent processed Certificate Results
	// transaction. This protects against reformatting the replay attacks
	LastChainHeightUpdated uint64 `protobuf:"varint,3,opt,name=last_chain_height_updated,json=lastChainHeightUpdated,proto3" json:"lastChainHeightUpdated"` // @gotags: json:"lastChainHeightUpdated"
	// payment_percents: a list of recipients and the percentage of rewards they will receive, distributed at the end of
	// the block
	PaymentPercents []*PaymentPercents `protobuf:"bytes,4,rep,name=payment_percents,json=paymentPercents,proto3" json:"paymentPercents"` // @gotags: json:"paymentPercents"
	// number_of_samples: the total count of processed Certificate Result Transactions, used to dilute reward percentages
	// accurately
	NumberOfSamples uint64 `protobuf:"varint,5,opt,name=number_of_samples,json=numberOfSamples,proto3" json:"numberOfSamples"` // @gotags: json:"numberOfSamples"
	// contains filtered or unexported fields
}

CommitteeData is current status information about the current status of the Committee

func (*CommitteeData) Combine

func (x *CommitteeData) Combine(data *CommitteeData, chainId uint64) (err ErrorI)

Combine() merges the Reward Recipients' Payment Percents of the current Proposal with those of another Proposal such that the Payment Percentages may be equally weighted when performing reward distribution calculations NOTE: merging percents will exceed 100% over multiple samples, but are normalized using the NumberOfSamples field NOTE: if the 'chainId' designation doesn't match the 'self' chainId, the payment percent is ignored

func (*CommitteeData) Descriptor deprecated

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

Deprecated: Use CommitteeData.ProtoReflect.Descriptor instead.

func (*CommitteeData) GetChainId

func (x *CommitteeData) GetChainId() uint64

func (*CommitteeData) GetLastChainHeightUpdated

func (x *CommitteeData) GetLastChainHeightUpdated() uint64

func (*CommitteeData) GetLastRootHeightUpdated

func (x *CommitteeData) GetLastRootHeightUpdated() uint64

func (*CommitteeData) GetNumberOfSamples

func (x *CommitteeData) GetNumberOfSamples() uint64

func (*CommitteeData) GetPaymentPercents

func (x *CommitteeData) GetPaymentPercents() []*PaymentPercents

func (*CommitteeData) ProtoMessage

func (*CommitteeData) ProtoMessage()

func (*CommitteeData) ProtoReflect

func (x *CommitteeData) ProtoReflect() protoreflect.Message

func (*CommitteeData) Reset

func (x *CommitteeData) Reset()

func (*CommitteeData) String

func (x *CommitteeData) String() string

type CommitteesData

type CommitteesData struct {
	List []*CommitteeData `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
	// contains filtered or unexported fields
}

CommitteesData is a list of essential information about the committee

func (*CommitteesData) Descriptor deprecated

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

Deprecated: Use CommitteesData.ProtoReflect.Descriptor instead.

func (*CommitteesData) GetList

func (x *CommitteesData) GetList() []*CommitteeData

func (*CommitteesData) ProtoMessage

func (*CommitteesData) ProtoMessage()

func (*CommitteesData) ProtoReflect

func (x *CommitteesData) ProtoReflect() protoreflect.Message

func (*CommitteesData) Reset

func (x *CommitteesData) Reset()

func (*CommitteesData) String

func (x *CommitteesData) String() string

type Config

type Config struct {
	MainConfig         // main options spanning over all modules
	LoggerConfig       // logger options
	RPCConfig          // rpc API options
	StateMachineConfig // FSM options
	StoreConfig        // persistence options
	P2PConfig          // peer-to-peer options
	ConsensusConfig    // bft options
	MempoolConfig      // mempool options
	MetricsConfig      // telemetry options
}

Config is the structure of the user configuration options for a Canopy node

func DefaultConfig

func DefaultConfig() Config

DefaultConfig() returns a Config with developer set options

func NewConfigFromFile

func NewConfigFromFile(filepath string) (Config, error)

NewConfigFromFile() populates a Config object from a JSON file

func (Config) WriteToFile

func (c Config) WriteToFile(filepath string) error

WriteToFile() saves the Config object to a JSON file

type ConsensusConfig

type ConsensusConfig struct {
	NewHeightTimeoutMs      int `json:"newHeightTimeoutMS"`      // how long (in milliseconds) the replica sleeps before moving to the ELECTION phase
	ElectionTimeoutMS       int `json:"electionTimeoutMS"`       // minus VRF creation time (if Candidate), is how long (in milliseconds) the replica sleeps before moving to ELECTION-VOTE phase
	ElectionVoteTimeoutMS   int `json:"electionVoteTimeoutMS"`   // minus QC validation + vote time, is how long (in milliseconds) the replica sleeps before moving to PROPOSE phase
	ProposeTimeoutMS        int `json:"proposeTimeoutMS"`        // minus Proposal creation time (if Leader), is how long (in milliseconds) the replica sleeps before moving to PROPOSE-VOTE phase
	ProposeVoteTimeoutMS    int `json:"proposeVoteTimeoutMS"`    // minus QC validation + vote time, is how long (in milliseconds) the replica sleeps before moving to PRECOMMIT phase
	PrecommitTimeoutMS      int `json:"precommitTimeoutMS"`      // minus Proposal-QC aggregation time (if Leader), how long (in milliseconds) the replica sleeps before moving to the PRECOMMIT-VOTE phase
	PrecommitVoteTimeoutMS  int `json:"precommitVoteTimeoutMS"`  // minus QC validation + vote time, is how long (in milliseconds) the replica sleeps before moving to COMMIT phase
	CommitTimeoutMS         int `json:"commitTimeoutMS"`         // minus Precommit-QC aggregation time (if Leader), how long (in milliseconds) the replica sleeps before moving to the COMMIT-PROCESS phase
	RoundInterruptTimeoutMS int `json:"roundInterruptTimeoutMS"` // minus gossiping current Round time, how long (in milliseconds) the replica sleeps before moving to PACEMAKER phase
}

ConsensusConfig defines the consensus phase timeouts for bft synchronicity NOTES: - BlockTime = ElectionTimeout + ElectionVoteTimeout + ProposeTimeout + ProposeVoteTimeout + PrecommitTimeout + PrecommitVoteTimeout + CommitTimeout + CommitProcess - async faults may lead to extended block time - social consensus dictates BlockTime for the protocol - being oo fast or too slow can lead to Non-Signing and Consensus failures

func DefaultConsensusConfig

func DefaultConsensusConfig() ConsensusConfig

DefaultConsensusConfig() configures the block time

func (*ConsensusConfig) BlockTimeMS

func (c *ConsensusConfig) BlockTimeMS() int

BlockTimeMS() returns the expected block time in milliseconds

type ConsensusValidator

type ConsensusValidator struct {

	// public_key: the operator's aggregable public key that is used to validate signatures from the operator
	PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"publicKey"` // @gotags: json:"publicKey"
	// voting_power: the weight of this node's vote, typically 1 to 1 matched to staked tokens
	VotingPower uint64 `protobuf:"varint,2,opt,name=voting_power,json=votingPower,proto3" json:"votingPower"` // @gotags: json:"votingPower"
	// net_address: the p2p tcp address of the validator node
	NetAddress string `protobuf:"bytes,3,opt,name=net_address,json=netAddress,proto3" json:"netAddress"` // @gotags: json:"netAddress"
	// contains filtered or unexported fields
}

ConsensusValidator is the bft abstraction of the Validator structure that only contains information relevant to the bft process

func (*ConsensusValidator) Descriptor deprecated

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

Deprecated: Use ConsensusValidator.ProtoReflect.Descriptor instead.

func (*ConsensusValidator) GetNetAddress

func (x *ConsensusValidator) GetNetAddress() string

func (*ConsensusValidator) GetPublicKey

func (x *ConsensusValidator) GetPublicKey() []byte

func (*ConsensusValidator) GetVotingPower

func (x *ConsensusValidator) GetVotingPower() uint64

func (ConsensusValidator) MarshalJSON

func (x ConsensusValidator) MarshalJSON() ([]byte, error)

MarshalJSON() overrides and implements the json.Marshaller interface

func (*ConsensusValidator) ProtoMessage

func (*ConsensusValidator) ProtoMessage()

func (*ConsensusValidator) ProtoReflect

func (x *ConsensusValidator) ProtoReflect() protoreflect.Message

func (*ConsensusValidator) Reset

func (x *ConsensusValidator) Reset()

func (*ConsensusValidator) String

func (x *ConsensusValidator) String() string

func (*ConsensusValidator) UnmarshalJSON

func (x *ConsensusValidator) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() overrides and implements the json.Unmarshaller interface

type ConsensusValidators

type ConsensusValidators struct {

	// validator_set: is the actual list of Validators and their respective
	ValidatorSet []*ConsensusValidator `protobuf:"bytes,1,rep,name=ValidatorSet,proto3" json:"validatorSet"` // @gotags: json:"validatorSet"
	// contains filtered or unexported fields
}

ConsensusValidators is a list of Consensus Validator objects used in the bft process often representing a BFT committee

func (*ConsensusValidators) Descriptor deprecated

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

Deprecated: Use ConsensusValidators.ProtoReflect.Descriptor instead.

func (*ConsensusValidators) GetValidatorSet

func (x *ConsensusValidators) GetValidatorSet() []*ConsensusValidator

func (*ConsensusValidators) ProtoMessage

func (*ConsensusValidators) ProtoMessage()

func (*ConsensusValidators) ProtoReflect

func (x *ConsensusValidators) ProtoReflect() protoreflect.Message

func (*ConsensusValidators) Reset

func (x *ConsensusValidators) Reset()

func (*ConsensusValidators) Root

func (x *ConsensusValidators) Root() ([]byte, ErrorI)

Root() calculates the Merkle root of the ConsensusValidators

func (*ConsensusValidators) String

func (x *ConsensusValidators) String() string

type DeDuplicator

type DeDuplicator[T comparable] struct {
	// contains filtered or unexported fields
}

DeDuplicator is a generic structure that serves as a simple anti-duplication check

func NewDeDuplicator

func NewDeDuplicator[T comparable]() *DeDuplicator[T]

NewDeDuplicator constructs a new object reference to a DeDuplicator

func (*DeDuplicator[T]) Delete

func (d *DeDuplicator[T]) Delete(k T)

Delete() removes the key from the de-duplicator map

func (*DeDuplicator[T]) Found

func (d *DeDuplicator[T]) Found(k T) bool

Found() checks for an existing entry and adds it to the map if it's not present

func (*DeDuplicator[T]) Map

func (d *DeDuplicator[T]) Map() map[T]struct{}

Map() returns the underlying map to the de-duplicator

type DoubleSigner

type DoubleSigner struct {

	// id: the cryptographic identifier of the malicious actor
	// - at the consensus level, this represents the Public_Key of the actor
	// - at the state machine level, this represents the Address of the actor
	Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// heights: the list of heights when the infractions occurred
	Heights []uint64 `protobuf:"varint,2,rep,packed,name=heights,proto3" json:"heights,omitempty"`
	// contains filtered or unexported fields
}

DoubleSigner identifies a validator who has been caught double signing and should be slashed The structure includes the validator's public key and a list of block heights where the double signing occurred

func (*DoubleSigner) AddHeight

func (x *DoubleSigner) AddHeight(height uint64)

AddHeight() adds a height to the DoubleSigner

func (*DoubleSigner) Descriptor deprecated

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

Deprecated: Use DoubleSigner.ProtoReflect.Descriptor instead.

func (*DoubleSigner) Equals

func (x *DoubleSigner) Equals(d *DoubleSigner) bool

Equals() compares this DoubleSigner against the passed DoubleSigner

func (*DoubleSigner) GetHeights

func (x *DoubleSigner) GetHeights() []uint64

func (*DoubleSigner) GetId

func (x *DoubleSigner) GetId() []byte

func (DoubleSigner) MarshalJSON

func (x DoubleSigner) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json.Marshaller interface for double signers

func (*DoubleSigner) ProtoMessage

func (*DoubleSigner) ProtoMessage()

func (*DoubleSigner) ProtoReflect

func (x *DoubleSigner) ProtoReflect() protoreflect.Message

func (*DoubleSigner) Reset

func (x *DoubleSigner) Reset()

func (*DoubleSigner) String

func (x *DoubleSigner) String() string

func (*DoubleSigner) UnmarshalJSON

func (x *DoubleSigner) UnmarshalJSON(jsonBytes []byte) (err error)

MarshalJSON() implements the json.Unmarshaler interface for double signers

type Error

type Error struct {
	ECode   ErrorCode   `json:"code"`   // Error code
	EModule ErrorModule `json:"module"` // Error module
	Msg     string      `json:"msg"`    // Error message
}

func NewError

func NewError(code ErrorCode, module ErrorModule, msg string) *Error

func (*Error) Code

func (p *Error) Code() ErrorCode

Code() returns the associated error code

func (*Error) Error

func (p *Error) Error() string

Error() returns a formatted string including module, code, message, and stack trace

func (*Error) Module

func (p *Error) Module() ErrorModule

Module() returns module field

func (*Error) String

func (p *Error) String() string

String() calls Error()

type ErrorCode

type ErrorCode uint32 // Defines a type for error codes

type ErrorI

type ErrorI interface {
	Code() ErrorCode     // Returns the error code
	Module() ErrorModule // Returns the error module
	error                // Implements the built-in error interface
}

func AddToPort

func AddToPort(portStr string, add uint64) (string, ErrorI)

AddToPort() adds some number to the port ensuring it doesn't exceed the max port

func ErrBadPort

func ErrBadPort() ErrorI

func ErrBadPortLowLimit

func ErrBadPortLowLimit() ErrorI

func ErrDuplicateCloseOrder

func ErrDuplicateCloseOrder() ErrorI

func ErrDuplicateResetOrder

func ErrDuplicateResetOrder() ErrorI

func ErrDuplicateTx

func ErrDuplicateTx(hash string) ErrorI

func ErrEmptyAggregateSignature

func ErrEmptyAggregateSignature() ErrorI

func ErrEmptyChainId

func ErrEmptyChainId() ErrorI

func ErrEmptyDoubleSigner

func ErrEmptyDoubleSigner() ErrorI

func ErrEmptyEvidence

func ErrEmptyEvidence() ErrorI

func ErrEmptyLotteryWinner

func ErrEmptyLotteryWinner() ErrorI

func ErrEmptyMessage

func ErrEmptyMessage() ErrorI

func ErrEmptyOrderBook

func ErrEmptyOrderBook() ErrorI

func ErrEmptyQuorumCertificate

func ErrEmptyQuorumCertificate() ErrorI

func ErrEmptySignature

func ErrEmptySignature() ErrorI

func ErrEmptySignerBitmap

func ErrEmptySignerBitmap() ErrorI

func ErrEmptyTransaction

func ErrEmptyTransaction() ErrorI

func ErrEmptyView

func ErrEmptyView() ErrorI

func ErrEvidenceTooOld

func ErrEvidenceTooOld() ErrorI

func ErrExpectedMaxBlockSize

func ErrExpectedMaxBlockSize() ErrorI

func ErrFailedTransactions

func ErrFailedTransactions() ErrorI

func ErrFromAny

func ErrFromAny(err error) ErrorI

func ErrGetRequest

func ErrGetRequest(err error) ErrorI

func ErrHashSize

func ErrHashSize() ErrorI

func ErrHttpStatus

func ErrHttpStatus(status string, statusCode int, body []byte) ErrorI

func ErrInvalidAddress

func ErrInvalidAddress() ErrorI

func ErrInvalidAggrSignature

func ErrInvalidAggrSignature() ErrorI

func ErrInvalidAggrSignatureLength

func ErrInvalidAggrSignatureLength() ErrorI

func ErrInvalidArgument

func ErrInvalidArgument() ErrorI

func ErrInvalidBlockHash

func ErrInvalidBlockHash() ErrorI

func ErrInvalidBlockProposerAddress

func ErrInvalidBlockProposerAddress() ErrorI

func ErrInvalidBuyerReceiveAddress

func ErrInvalidBuyerReceiveAddress() ErrorI

func ErrInvalidBuyerSendAddress

func ErrInvalidBuyerSendAddress() ErrorI

func ErrInvalidDoubleSignHeights

func ErrInvalidDoubleSignHeights() ErrorI

func ErrInvalidDoubleSigner

func ErrInvalidDoubleSigner() ErrorI

func ErrInvalidEvidence

func ErrInvalidEvidence() ErrorI

func ErrInvalidEvidenceHeights

func ErrInvalidEvidenceHeights() ErrorI

func ErrInvalidLastQuorumCertificate

func ErrInvalidLastQuorumCertificate() ErrorI

func ErrInvalidMemo

func ErrInvalidMemo() ErrorI

func ErrInvalidMessageCast

func ErrInvalidMessageCast() ErrorI

func ErrInvalidNetAddrString

func ErrInvalidNetAddrString(s string) ErrorI

func ErrInvalidNetAddress

func ErrInvalidNetAddress(s string) ErrorI

func ErrInvalidNetAddressPubKey

func ErrInvalidNetAddressPubKey(s string) ErrorI

func ErrInvalidParams

func ErrInvalidParams(err error) ErrorI

func ErrInvalidPercentAllocation

func ErrInvalidPercentAllocation() ErrorI

func ErrInvalidProposerPubKey

func ErrInvalidProposerPubKey(expected []byte) ErrorI

func ErrInvalidQCCommitteeHeight

func ErrInvalidQCCommitteeHeight() ErrorI

func ErrInvalidQCRootChainHeight

func ErrInvalidQCRootChainHeight() ErrorI

func ErrInvalidRCBuildHeight

func ErrInvalidRCBuildHeight() ErrorI

func ErrInvalidResultsHash

func ErrInvalidResultsHash() ErrorI

func ErrInvalidSigner

func ErrInvalidSigner() ErrorI

func ErrInvalidSignerBitmap

func ErrInvalidSignerBitmap(err error) ErrorI

func ErrInvalidStateNetAddress

func ErrInvalidStateNetAddress(s string) ErrorI

func ErrInvalidTxHeight

func ErrInvalidTxHeight() ErrorI

func ErrInvalidTxTime

func ErrInvalidTxTime() ErrorI

func ErrInvalidVDF

func ErrInvalidVDF() ErrorI

func ErrInvalidValidatorIndex

func ErrInvalidValidatorIndex() ErrorI

func ErrJSONMarshal

func ErrJSONMarshal(err error) ErrorI

func ErrJSONUnmarshal

func ErrJSONUnmarshal(err error) ErrorI

func ErrMarshal

func ErrMarshal(err error) ErrorI

func ErrMaxPort

func ErrMaxPort() ErrorI

func ErrMaxTxSize

func ErrMaxTxSize() ErrorI

func ErrMempoolStopSignal

func ErrMempoolStopSignal() ErrorI

func ErrMerkleTree

func ErrMerkleTree(err error) ErrorI

func ErrMismatchCertBlockHeight

func ErrMismatchCertBlockHeight(got, wanted uint64) ErrorI

func ErrMismatchConsBlockHash

func ErrMismatchConsBlockHash() ErrorI

func ErrMismatchEvidenceAndHeader

func ErrMismatchEvidenceAndHeader() ErrorI

func ErrMismatchHeaderBlockHash

func ErrMismatchHeaderBlockHash() ErrorI

func ErrMismatchQCBlockHash

func ErrMismatchQCBlockHash() ErrorI

func ErrMismatchResultsHash

func ErrMismatchResultsHash() ErrorI

func ErrNewHeight

func ErrNewHeight() ErrorI

func ErrNewMultiPubKey

func ErrNewMultiPubKey(err error) ErrorI

func ErrNewStore

func ErrNewStore(err error) ErrorI

func ErrNilBlock

func ErrNilBlock() ErrorI

func ErrNilBlockHeader

func ErrNilBlockHeader() ErrorI

func ErrNilBlockTime

func ErrNilBlockTime() ErrorI

func ErrNilCertResults

func ErrNilCertResults() ErrorI

func ErrNilLockOrder

func ErrNilLockOrder() ErrorI

func ErrNilNetworkID

func ErrNilNetworkID() ErrorI

func ErrNilRewardRecipients

func ErrNilRewardRecipients() ErrorI

func ErrNoMaj23

func ErrNoMaj23() ErrorI

func ErrNoSavedBlockOrResults

func ErrNoSavedBlockOrResults() ErrorI

func ErrNoSubsidizedCommittees

func ErrNoSubsidizedCommittees(chainId uint64) ErrorI

func ErrNoValidators

func ErrNoValidators() ErrorI

func ErrNonEquivocatingVote

func ErrNonEquivocatingVote() ErrorI

func ErrNonNilBlock

func ErrNonNilBlock() ErrorI

func ErrNonNilCertResults

func ErrNonNilCertResults() ErrorI

func ErrNotSubscribed

func ErrNotSubscribed() ErrorI

func ErrOrderLocked

func ErrOrderLocked() ErrorI

func ErrOrderNotFound

func ErrOrderNotFound() ErrorI

func ErrPanic

func ErrPanic() ErrorI

func ErrPaymentRecipientsCount

func ErrPaymentRecipientsCount() ErrorI

func ErrPostRequest

func ErrPostRequest(err error) ErrorI

func ErrProtoParse

func ErrProtoParse(err error) ErrorI

func ErrPubKeyFromBytes

func ErrPubKeyFromBytes(err error) ErrorI

func ErrReadBody

func ErrReadBody(err error) ErrorI

func ErrReadFile

func ErrReadFile(err error) ErrorI

func ErrStringToBytes

func ErrStringToBytes(err error) ErrorI

func ErrStringToCommittee

func ErrStringToCommittee(s string) ErrorI

func ErrTimeMachine

func ErrTimeMachine(err error) ErrorI

func ErrToAny

func ErrToAny(err error) ErrorI

func ErrUnequalBlockHash

func ErrUnequalBlockHash() ErrorI

func ErrUnknownMessageName

func ErrUnknownMessageName(s string) ErrorI

func ErrUnknownPageable

func ErrUnknownPageable(s string) ErrorI

func ErrUnmarshal

func ErrUnmarshal(err error) ErrorI

func ErrValidatorNotInSet

func ErrValidatorNotInSet(publicKey []byte) ErrorI

func ErrWriteFile

func ErrWriteFile(err error) ErrorI

func ErrWrongBlockHeight

func ErrWrongBlockHeight(got, wanted uint64) ErrorI

func ErrWrongCertHeight

func ErrWrongCertHeight(got, wanted uint64) ErrorI

func ErrWrongChainId

func ErrWrongChainId() ErrorI

func ErrWrongHighQCHeight

func ErrWrongHighQCHeight() ErrorI

func ErrWrongHighQCRootHeight

func ErrWrongHighQCRootHeight() ErrorI

func ErrWrongLengthBlockHash

func ErrWrongLengthBlockHash() ErrorI

func ErrWrongLengthLastBlockHash

func ErrWrongLengthLastBlockHash() ErrorI

func ErrWrongLengthNextValidatorRoot

func ErrWrongLengthNextValidatorRoot() ErrorI

func ErrWrongLengthStateRoot

func ErrWrongLengthStateRoot() ErrorI

func ErrWrongLengthTransactionRoot

func ErrWrongLengthTransactionRoot() ErrorI

func ErrWrongLengthValidatorRoot

func ErrWrongLengthValidatorRoot() ErrorI

func ErrWrongNetworkID

func ErrWrongNetworkID() ErrorI

func ErrWrongPhase

func ErrWrongPhase() ErrorI

func ErrWrongRootHeight

func ErrWrongRootHeight() ErrorI

func ErrWrongViewHeight

func ErrWrongViewHeight(got, wanted uint64) ErrorI

func FromAny

func FromAny(any *anypb.Any) (proto.Message, ErrorI)

FromAny() converts an anypb.Any type back into a proto.Message

func Marshal

func Marshal(message any) ([]byte, ErrorI)

Marshal() serializes a proto.Message into a byte slice

func MarshalJSON

func MarshalJSON(message any) ([]byte, ErrorI)

MarshalJSON() serializes a message into a JSON byte slice

func MarshalJSONIndent

func MarshalJSONIndent(message any) ([]byte, ErrorI)

MarshalJSONIndent() serializes a message into an indented JSON byte slice

func MarshalJSONIndentString

func MarshalJSONIndentString(message any) (string, ErrorI)

MarshalJSONIndentString() serializes a message into an indented JSON string

func MerkleTree

func MerkleTree(items [][]byte) (root []byte, tree [][]byte, err ErrorI)

MerkleTree() generates a Merkle tree and its root from a list of items

func NewAny

func NewAny(message proto.Message) (*anypb.Any, ErrorI)

NewAny() converts a proto.Message into an anypb.Any type

func NewJSONFromFile

func NewJSONFromFile(o any, dataDirPath, filePath string) ErrorI

NewJSONFromFile() reads a json file into an object

func PublicKeyFromBytes

func PublicKeyFromBytes(pubKey []byte) (crypto.PublicKeyI, ErrorI)

PublicKeyFromBytes() converts a byte slice into a BLS public key

func ResolveAndReplacePort

func ResolveAndReplacePort(netAddress *string, chainId uint64) (error ErrorI)

ResolveAndReplacePort resolves the appropriate port and replaces the port in the net address

func ResolvePort

func ResolvePort(oldPort string, chainId uint64) (string, ErrorI)

ResolvePort() executes a network wide protocol for determining what the p2p port of the peer is This is useful to allow 1 URL in state to expand to many routing paths for nested-chains Example: ResolvePort(CHAIN-ID = 2) with original port 9000 returns 9002

func SaveJSONToFile

func SaveJSONToFile(j any, dataDirPath, filePath string) (err ErrorI)

SaveJSONToFile() saves a json object to a file

func StringToBytes

func StringToBytes(s string) ([]byte, ErrorI)

StringToBytes() converts a hexadecimal string back into a byte slice

func Unmarshal

func Unmarshal(protoBytes []byte, ptr any) ErrorI

Unmarshal() deserializes a byte slice into a proto.Message

func UnmarshalJSON

func UnmarshalJSON(jsonBytes []byte, ptr any) ErrorI

UnmarshalJSON() deserializes a JSON byte slice into the specified object

type ErrorModule

type ErrorModule string // Defines a type for error modules

type FSMMetrics

type FSMMetrics struct {
	ValidatorStatus            *prometheus.GaugeVec // what's the status of this validator?
	ValidatorType              *prometheus.GaugeVec // what's the type of this validator?
	ValidatorCompounding       *prometheus.GaugeVec // is this validator compounding?
	ValidatorStakeAmount       *prometheus.GaugeVec // what's the stake amount of this validator
	ValidatorBlockProducer     *prometheus.GaugeVec // was this validator a block producer? // TODO duplicate of canopy_proposer_count
	ValidatorNonSigner         *prometheus.GaugeVec // was this validator a non signer?
	ValidatorNonSignerCount    *prometheus.GaugeVec // was any validator a non signer?
	ValidatorDoubleSigner      *prometheus.GaugeVec // was this validator a double signer?
	ValidatorDoubleSignerCount *prometheus.GaugeVec // was any validator a double signer?
}

FSMMetrics represents the telemetry of the FSM module for the node's address

type FailedTx

type FailedTx struct {
	Transaction *Transaction `json:"transaction,omitempty"` // the transaction object that failed
	Hash        string       `json:"txHash,omitempty"`      // the hash of the transaction object
	Address     string       `json:"address,omitempty"`     // the address that sent the transaction
	Error       error        `json:"error,omitempty"`       // the error that occurred
	// contains filtered or unexported fields
}

FailedTx contains a failed transaction and its error

func NewFailedTx

func NewFailedTx(txBytes []byte, txErr error) *FailedTx

NewFailedTx() attempts to create a new failed transaction from bytes

func (*FailedTx) GetBytes

func (f *FailedTx) GetBytes() []byte

GetBytes() returns the raw tx bytes for the failed tx

type FailedTxCache

type FailedTxCache struct {
	// contains filtered or unexported fields
}

FailedTxCache is a cache of failed transactions that is used to inform the user of the failure

func NewFailedTxCache

func NewFailedTxCache(disallowedMessageTypes ...string) (cache *FailedTxCache)

NewFailedTxCache returns a new FailedTxCache

func (*FailedTxCache) Add

func (f *FailedTxCache) Add(failed *FailedTx) (added bool)

Add() adds a failed transaction with its error to the cache

func (*FailedTxCache) Get

func (f *FailedTxCache) Get(txHash string) (failedTx *FailedTx, found bool)

Get() returns the failed transaction associated with its hash

func (*FailedTxCache) GetFailedForAddress

func (f *FailedTxCache) GetFailedForAddress(address string) (failedTxs []*FailedTx)

GetFailedForAddress() returns all the failed transactions in the cache for a given address

func (*FailedTxCache) Remove

func (f *FailedTxCache) Remove(txHashes ...string)

Remove() removes a transaction hash from the cache

func (*FailedTxCache) StartCleanService

func (f *FailedTxCache) StartCleanService()

StartCleanService() periodically removes transactions from the cache that are older than 5 minutes

type FailedTxs

type FailedTxs []*FailedTx // a list of failed transactions

func (*FailedTxs) Len

func (t *FailedTxs) Len() int

implement pageable interface

func (*FailedTxs) New

func (t *FailedTxs) New() Pageable

type FeeMempool

type FeeMempool struct {
	// contains filtered or unexported fields
}

FeeMempool is a Mempool implementation that prioritizes transactions with the highest fees

func (*FeeMempool) AddTransactions

func (f *FeeMempool) AddTransactions(txs ...[]byte) (err ErrorI)

AddTransaction() inserts a new unconfirmed Transaction to the Pool and returns if this addition requires a recheck of the Mempool due to dropping or re-ordering of the Transactions

func (*FeeMempool) Clear

func (f *FeeMempool) Clear()

Clear() empties the mempool and resets its state

func (*FeeMempool) Contains

func (f *FeeMempool) Contains(txHash string) (contains bool)

Contains() checks if a transaction with the given hash exists in the mempool

func (*FeeMempool) DeleteTransaction

func (f *FeeMempool) DeleteTransaction(tx ...[]byte)

DeleteTransaction() removes the specified transaction from the mempool

func (*FeeMempool) GetTransactions

func (f *FeeMempool) GetTransactions(maxBytes uint64) (txs [][]byte)

GetTransactions() returns a list of the Transactions from the pool up to 'max collective Transaction bytes'

func (*FeeMempool) Iterator

func (f *FeeMempool) Iterator() IteratorI

Iterator() creates a new iterator for traversing the transactions in the mempool

func (*FeeMempool) TxCount

func (f *FeeMempool) TxCount() int

TxCount() returns the current number of transactions in the mempool

func (*FeeMempool) TxsBytes

func (f *FeeMempool) TxsBytes() int

TxsBytes() returns the total size in bytes of all transactions in the mempool

type FilterOption

type FilterOption int

FilterOption symbolizes 'condition must be true (yes)' 'condition must be false (no)' or 'filter off (both)' for filters

type HeightResult

type HeightResult struct {
	Height uint64 `json:"height"`
}

HeightResult is the structure to return the height

type HexBytes

type HexBytes []byte

HexBytes represents a byte slice that can be marshaled and unmarshalled as hex strings

func (HexBytes) MarshalJSON

func (x HexBytes) MarshalJSON() ([]byte, error)

MarshalJSON() serializes the HexBytes to a JSON byte slice

func (HexBytes) String

func (x HexBytes) String() string

String() returns the HexBytes as a hexadecimal string

func (*HexBytes) UnmarshalJSON

func (x *HexBytes) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() deserializes a JSON byte slice into HexBytes

type IteratorI

type IteratorI interface {
	Valid() bool           // if the item the iterator is pointing at is valid
	Next()                 // move to next item
	Key() (key []byte)     // retrieve key
	Value() (value []byte) // retrieve value
	Close()                // close the iterator when done, ensuring proper resource management
}

IteratorI defines an interface for iterating over key-value pairs in a data store

type LockOrder

type LockOrder struct {

	// order_id: is the number id that is unique to this committee to identify the order
	OrderId []byte `protobuf:"bytes,1,opt,name=order_id,json=orderId,proto3" json:"orderID"` // @gotags: json:"orderID"
	// chain_id: is the id of the committee
	ChainId uint64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// buyer_receive_address: the Canopy address where the tokens may be received
	BuyerReceiveAddress []byte `protobuf:"bytes,3,opt,name=buyer_receive_address,json=buyerReceiveAddress,proto3" json:"buyerReceiveAddress"` // @gotags: json:"buyerReceiveAddress"
	// buyer_send_address: the 'counter asset' address where the tokens will be sent from
	BuyerSendAddress []byte `protobuf:"bytes,4,opt,name=buyer_send_address,json=buyerSendAddress,proto3" json:"buyerSendAddress"` // @gotags: json:"buyerSendAddress"
	// buyer_chain_deadline: the 'counter asset' chain height at which the buyer must send the 'counter asset' by
	// or the 'intent to buy' will be voided
	BuyerChainDeadline uint64 `protobuf:"varint,5,opt,name=buyer_chain_deadline,json=buyerChainDeadline,proto3" json:"buyerChainDeadline"` // @gotags: json:"buyerChainDeadline"
	// contains filtered or unexported fields
}

LockOrder is a buyer expressing an intent to purchase an order, often referred to as 'claiming' the order

func (*LockOrder) Descriptor deprecated

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

Deprecated: Use LockOrder.ProtoReflect.Descriptor instead.

func (*LockOrder) Equals

func (x *LockOrder) Equals(y *LockOrder) bool

Equals() compares two LockOrders for equality

func (*LockOrder) GetBuyerChainDeadline

func (x *LockOrder) GetBuyerChainDeadline() uint64

func (*LockOrder) GetBuyerReceiveAddress

func (x *LockOrder) GetBuyerReceiveAddress() []byte

func (*LockOrder) GetBuyerSendAddress

func (x *LockOrder) GetBuyerSendAddress() []byte

func (*LockOrder) GetChainId

func (x *LockOrder) GetChainId() uint64

func (*LockOrder) GetOrderId

func (x *LockOrder) GetOrderId() []byte

func (LockOrder) MarshalJSON

func (x LockOrder) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json.Marshaller interface for LockOrder

func (*LockOrder) ProtoMessage

func (*LockOrder) ProtoMessage()

func (*LockOrder) ProtoReflect

func (x *LockOrder) ProtoReflect() protoreflect.Message

func (*LockOrder) Reset

func (x *LockOrder) Reset()

func (*LockOrder) String

func (x *LockOrder) String() string

func (*LockOrder) UnmarshalJSON

func (x *LockOrder) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() implements the json.Unmarshaler interface for LockOrder

type Logger

type Logger struct {
	// contains filtered or unexported fields
}

Logger is the concrete implementation of LoggerI, managing log output based on configuration

func (*Logger) Debug

func (l *Logger) Debug(msg string)

Debug() logs a message at the Debug level with blue color

func (*Logger) Debugf

func (l *Logger) Debugf(format string, args ...any)

Debugf() logs a formatted message at the Debug level with blue color

func (*Logger) Error

func (l *Logger) Error(msg string)

Error() logs a message at the Error level with red color

func (*Logger) Errorf

func (l *Logger) Errorf(format string, args ...any)

Errorf() logs a formatted message at the Error level with red color

func (*Logger) Fatal

func (l *Logger) Fatal(msg string)

Fatal() logs an error message and terminates the program

func (*Logger) Fatalf

func (l *Logger) Fatalf(format string, args ...any)

Fatalf() logs a formatted error message and terminates the program

func (*Logger) Info

func (l *Logger) Info(msg string)

Info() logs a message at the Info level with green color

func (*Logger) Infof

func (l *Logger) Infof(format string, args ...any)

Infof() logs a formatted message at the Info level with green color

func (*Logger) Print

func (l *Logger) Print(msg string)

Print() logs a message without any specific log level or color

func (*Logger) Printf

func (l *Logger) Printf(format string, args ...any)

Printf() logs a formatted message without any specific log level or color

func (*Logger) Warn

func (l *Logger) Warn(msg string)

Warn() logs a message at the Warn level with yellow color

func (*Logger) Warnf

func (l *Logger) Warnf(format string, args ...any)

Warnf() logs a formatted message at the Warn level with yellow color

type LoggerConfig

type LoggerConfig struct {
	Level      int32 `json:"level"`         // logging level
	Structured bool  `json:"logStructured"` // output structured logging for observability tooling
	JSON       bool  `json:"logJSON"`       // output JSON formatted logs, only works if structured logging is enabled
	Out        io.Writer
}

LoggerConfig holds configuration settings for the logger, including logging level and output writer

type LoggerI

type LoggerI interface {
	Debug(msg string)
	Info(msg string)
	Warn(msg string)
	Error(msg string)
	Fatal(msg string)
	Print(msg string)
	Debugf(format string, args ...any)
	Infof(format string, args ...any)
	Warnf(format string, args ...any)
	Errorf(format string, args ...any)
	Fatalf(format string, args ...any)
	Printf(format string, args ...any)
}

LoggerI defines the interface for various logging levels and formatted output

func NewDefaultLogger

func NewDefaultLogger() LoggerI

NewDefaultLogger() creates a Logger with default settings, logging at the Debug level to stdout

func NewLogger

func NewLogger(config LoggerConfig, dataDirPath ...string) LoggerI

NewLogger() creates a new Logger instance with the specified configuration and optional data directory path

func NewNullLogger

func NewNullLogger() LoggerI

NewNullLogger() creates a Logger that discards all log output

type LotteryWinner

type LotteryWinner struct {

	// winner: the 20 byte address of the selected actor
	Winner []byte `protobuf:"bytes,1,opt,name=winner,proto3" json:"winner"` // @gotags: json:"winner"
	// cut: the percent cut of the rewards
	Cut uint64 `protobuf:"varint,2,opt,name=cut,proto3" json:"cut,omitempty"` // @gotags json:"cut"
	// contains filtered or unexported fields
}

LotteryWinner is a structure that holds the subject of a pseudorandom selection and their % cut of the reward This is used for delegation + sub-delegation + sub-validator earnings

func (*LotteryWinner) Descriptor deprecated

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

Deprecated: Use LotteryWinner.ProtoReflect.Descriptor instead.

func (*LotteryWinner) GetCut

func (x *LotteryWinner) GetCut() uint64

func (*LotteryWinner) GetWinner

func (x *LotteryWinner) GetWinner() []byte

func (*LotteryWinner) MarshalJSON

func (x *LotteryWinner) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json marshaller for 'LotteryWinner'

func (*LotteryWinner) ProtoMessage

func (*LotteryWinner) ProtoMessage()

func (*LotteryWinner) ProtoReflect

func (x *LotteryWinner) ProtoReflect() protoreflect.Message

func (*LotteryWinner) Reset

func (x *LotteryWinner) Reset()

func (*LotteryWinner) String

func (x *LotteryWinner) String() string

func (*LotteryWinner) UnmarshalJSON

func (x *LotteryWinner) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON() implements the json unmarshaler for 'LotteryWinner'

type MainConfig

type MainConfig struct {
	LogLevel   string      `json:"logLevel"`   // any level includes the levels above it: debug < info < warning < error
	ChainId    uint64      `json:"chainId"`    // the identifier of this particular chain within a single 'network id'
	SleepUntil uint64      `json:"sleepUntil"` // allows coordinated 'wake-ups' for genesis or chain halt events
	RootChain  []RootChain `json:"rootChain"`  // a list of the root chain(s) a node could connect to as dictated by the governance parameter 'RootChainId'
	RunVDF     bool        `json:"runVDF"`     // whether the node should run a Verifiable Delay Function to help secure the network against Long-Range-Attacks
	Headless   bool        `json:"headless"`   // turn off the web wallet and block explorer 'web' front ends
	AutoUpdate bool        `json:"autoUpdate"` // check for new versions of software each X time
}

func DefaultMainConfig

func DefaultMainConfig() MainConfig

DefaultMainConfig() sets log level to 'info'

func (*MainConfig) GetLogLevel

func (m *MainConfig) GetLogLevel() int32

GetLogLevel() parses the log string in the config file into a LogLevel Enum

type Mempool

type Mempool interface {
	Contains(txHash string) bool               // whether the mempool has this transaction already (de-duplicated by hash)
	AddTransactions(tx ...[]byte) (err ErrorI) // insert new unconfirmed transaction
	DeleteTransaction(tx ...[]byte)            // delete unconfirmed transaction
	GetTransactions(maxBytes uint64) [][]byte  // retrieve transactions from the highest fee to lowest

	Clear()              // reset the entire store
	TxCount() int        // number of Transactions in the pool
	TxsBytes() int       // collective number of bytes in the pool
	Iterator() IteratorI // loop through each transaction in the pool
}

Mempool interface is a model for a pre-block, in-memory, Transaction store

func NewMempool

func NewMempool(config MempoolConfig) Mempool

NewMempool() creates a new FeeMempool instance of a Mempool

type MempoolConfig

type MempoolConfig struct {
	MaxTotalBytes              uint64 `json:"maxTotalBytes"`              // maximum collective bytes in the pool
	MaxTransactionCount        uint32 `json:"maxTransactionCount"`        // max number of Transactions
	IndividualMaxTxSize        uint32 `json:"individualMaxTxSize"`        // max bytes of a single Transaction
	DropPercentage             int    `json:"dropPercentage"`             // percentage that is dropped from the bottom of the queue if limits are reached
	LazyMempoolCheckFrequencyS int    `json:"lazyMempoolCheckFrequencyS"` // how often the mempool is checked for new transactions besides the mandatory (after Commit) (0) for none
}

MempoolConfig is the user configuration of the unconfirmed transaction pool

func DefaultMempoolConfig

func DefaultMempoolConfig() MempoolConfig

DefaultMempoolConfig() returns the developer created Mempool options

type MempoolMetrics

type MempoolMetrics struct {
	MempoolSize    prometheus.Gauge // how many bytes are in the mempool?
	MempoolTxCount prometheus.Gauge // how many transactions are in the mempool?
}

MempoolMetrics represents the telemetry of the memory pool of pending transactions

type MempoolTx

type MempoolTx struct {
	Tx  []byte // transaction bytes
	Fee uint64 // fee associated with the transaction
}

MempoolTx is a wrapper over Transaction bytes that maintains the fee associated with the bytes

type MempoolTxs

type MempoolTxs struct {
	// contains filtered or unexported fields
}

MempoolTxs is a list of MempoolTxs with a count

type MessageAndMetadata

type MessageAndMetadata struct {
	Message []byte    // the (proto) payload of the message
	Sender  *PeerInfo // the sender information
}

MessageAndMetadata is a wrapper over a P2P message with information about the sender

type MessageCache

type MessageCache struct {
	// contains filtered or unexported fields
}

MessageCache is a simple p2p message de-duplicator that protects redundancy in the p2p network

func NewMessageCache

func NewMessageCache() *MessageCache

NewMessageCache() initializes and returns a new MessageCache instance

func (*MessageCache) Add

func (c *MessageCache) Add(msg *MessageAndMetadata) (ok bool)

Add inserts a new message into the cache if it doesn't already exist It removes the oldest message if the cache is full

type MessageI

type MessageI interface {
	proto.Message

	New() MessageI     // new instance of the message type
	Name() string      // name of the message
	Check() ErrorI     // stateless validation of the message
	Recipient() []byte // for transaction indexing by recipient
	json.Marshaler     // json encoding
	json.Unmarshaler   // json decoding
}

MessageI is the model of a message object (send, stake, edit-stake, etc.)

type Metrics

type Metrics struct {
	NodeMetrics    // general telemetry about the node
	BlockMetrics   // block telemetry
	PeerMetrics    // peer telemetry
	BFTMetrics     // bft telemetry
	FSMMetrics     // fsm telemetry
	StoreMetrics   // persistence telemetry
	MempoolMetrics // tx memory pool telemetry
	// contains filtered or unexported fields
}

Metrics represents a server that exposes Prometheus metrics

func NewMetricsServer

func NewMetricsServer(nodeAddress crypto.AddressI, chainID float64, softwareVersion string, config MetricsConfig, logger LoggerI) *Metrics

NewMetricsServer() creates a new telemetry server

func (*Metrics) SetStartupBlock

func (m *Metrics) SetStartupBlock(blockHeight uint64)

SetStartupBlock() sets the block height when the node first completed syncing after startup

func (*Metrics) Start

func (m *Metrics) Start()

Start() starts the telemetry server

func (*Metrics) Stop

func (m *Metrics) Stop()

Stop() gracefully stops the telemetry server

func (*Metrics) UpdateAccount

func (m *Metrics) UpdateAccount(address string, balance uint64)

UpdateAccount() updates the account balance of the node

func (*Metrics) UpdateBFTMetrics

func (m *Metrics) UpdateBFTMetrics(height, rootHeight, round uint64, phase Phase, phaseStartTime time.Time)

UpdateBFTMetrics() is a setter for the BFT metrics

func (*Metrics) UpdateBlockMetrics

func (m *Metrics) UpdateBlockMetrics(proposerAddress []byte, blockSize, txCount, vdfIterations uint64, duration time.Duration)

UpdateBlockMetrics() updates the metrics about the last block

func (*Metrics) UpdateGetRootChainInfo

func (m *Metrics) UpdateGetRootChainInfo(startTime time.Time)

UpdateGetRootChainInfo() updates the time it took to execute a fsm.GetRootChainInfo() call

func (*Metrics) UpdateLargestTxSize

func (m *Metrics) UpdateLargestTxSize(size uint64)

UpdateLargestTxSize() updates the largest size tx included in a block

func (*Metrics) UpdateMempoolMetrics

func (m *Metrics) UpdateMempoolMetrics(txCount, size int)

UpdateMempoolMetrics() updates mempool telemetry

func (*Metrics) UpdateNodeMetrics

func (m *Metrics) UpdateNodeMetrics(isSyncing bool)

UpdateNodeMetrics updates the node syncing status

func (*Metrics) UpdateNonSignerPercent

func (m *Metrics) UpdateNonSignerPercent(as *AggregateSignature, set ValidatorSet)

UpdateNonSignerPercent() updates the percent of the non-signers for a block

func (*Metrics) UpdatePeerMetrics

func (m *Metrics) UpdatePeerMetrics(total, inbound, outbound int)

UpdatePeerMetrics() is a setter for the peer metrics

func (*Metrics) UpdateStoreMetrics

func (m *Metrics) UpdateStoreMetrics(size, entries int64, startTime time.Time, startFlushTime time.Time)

UpdateStoreMetrics() updates the store telemetry

func (*Metrics) UpdateValidator

func (m *Metrics) UpdateValidator(address string, stakeAmount uint64, unstaking, paused, delegate, compounding, isProducer bool,
	nonSigners map[string]uint64, doubleSigners []crypto.AddressI)

UpdateValidator() updates the validator metrics for prometheus

type MetricsConfig

type MetricsConfig struct {
	MetricsEnabled    bool   `json:"metricsEnabled"`    // if the metrics are enabled
	PrometheusAddress string `json:"prometheusAddress"` // the address of the server
}

MetricsConfig represents the configuration for the metrics server

func DefaultMetricsConfig

func DefaultMetricsConfig() MetricsConfig

DefaultMetricsConfig() returns the default metrics configuration

type NewHeightTracker

type NewHeightTracker struct {
	Peers  map[string]struct{} // peers (peer + height) that claimed new height with a valid block
	Blocks map[string]uint64   // pre-validated blocks showing new height
	// contains filtered or unexported fields
}

NewHeightTracker() detects if a node has fallen out of sync based on peer info

func NewBlockTracker

func NewBlockTracker(syncCB func(), l LoggerI) (n *NewHeightTracker)

NewBlockTracker() constructs a NewHeightTracker

func (*NewHeightTracker) Add

func (n *NewHeightTracker) Add(sender, message []byte, height uint64, peerCount int) (outOfSync bool)

Add() records a 'new height' for a sender and height

func (*NewHeightTracker) AddIfHas

func (n *NewHeightTracker) AddIfHas(sender, message []byte, peerCount int) (outOfSync bool)

AddIfHas() records a 'new height' for a sender and height only if it already contains this block

func (*NewHeightTracker) Reset

func (n *NewHeightTracker) Reset()

Reset() resets the new height tracker

type Node

type Node struct {

	// Value: is the cryptographic hash of the data included in the database
	// the ValueHash is included in the parent hash
	Value []byte `protobuf:"bytes,1,opt,name=Value,proto3" json:"value"` // @gotags: json:"value"
	// LeftChildKey: is the key for the left child node. Nil means no child
	LeftChildKey []byte `protobuf:"bytes,2,opt,name=LeftChildKey,proto3" json:"leftChildKey"` // @gotags: json:"leftChildKey"
	// RightChildKey: is the key for the right child node. Nil means no child
	RightChildKey []byte `protobuf:"bytes,3,opt,name=RightChildKey,proto3" json:"RightChildKey,omitempty"`
	// Key: used for merkle proof generation and verification. It is the compact
	// representation of the node's key bit sequences
	Key []byte `protobuf:"bytes,4,opt,name=Key,proto3" json:"Key,omitempty"`
	// Bitmask: Used for Merkle proof generation and verification. Indicates
	// whether each hash requires the left or right sibling, where 0
	// represents a left sibling and 1 represents a right sibling
	Bitmask int32 `protobuf:"varint,5,opt,name=Bitmask,proto3" json:"Bitmask,omitempty"`
	// contains filtered or unexported fields
}

Node represents a single element in a sparse Merkle tree It stores the cryptographic hash of data and the structural information required to traverse and reconstruct the tree

func (*Node) Descriptor deprecated

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

Deprecated: Use Node.ProtoReflect.Descriptor instead.

func (*Node) GetBitmask

func (x *Node) GetBitmask() int32

func (*Node) GetKey

func (x *Node) GetKey() []byte

func (*Node) GetLeftChildKey

func (x *Node) GetLeftChildKey() []byte

func (*Node) GetRightChildKey

func (x *Node) GetRightChildKey() []byte

func (*Node) GetValue

func (x *Node) GetValue() []byte

func (*Node) ProtoMessage

func (*Node) ProtoMessage()

func (*Node) ProtoReflect

func (x *Node) ProtoReflect() protoreflect.Message

func (*Node) Reset

func (x *Node) Reset()

func (*Node) String

func (x *Node) String() string

type NodeMetrics

type NodeMetrics struct {
	NodeStatus       prometheus.Gauge     // is the node alive?
	SyncingStatus    prometheus.Gauge     // is the node syncing?
	GetRootChainInfo prometheus.Histogram // how long does the 'GetRootChainInfo' call take?
	AccountBalance   *prometheus.GaugeVec // what's the balance of this node's account?
	ProposerCount    prometheus.Counter   // how many times did this node propose the block?
	ChainId          prometheus.Gauge     // what chain id is this node running on?
	SoftwareVersion  *prometheus.GaugeVec // what software version is this node running?
	StartupBlock     prometheus.Gauge     // the block height when node first completed syncing (set only once)
}

NodeMetrics represents general telemetry for the node's health

type OrderBook

type OrderBook struct {

	// chain_id: the unique identifier of the 'counter asset' committee
	ChainId uint64 `protobuf:"varint,1,opt,name=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// orders: the actual list of sell orders
	Orders []*SellOrder `protobuf:"bytes,2,rep,name=orders,proto3" json:"orders,omitempty"`
	// contains filtered or unexported fields
}

OrderBook: a list of sell orders associated with a particular committee held in the blockchain state

func (*OrderBook) Descriptor deprecated

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

Deprecated: Use OrderBook.ProtoReflect.Descriptor instead.

func (*OrderBook) GetChainId

func (x *OrderBook) GetChainId() uint64

func (*OrderBook) GetOrder

func (x *OrderBook) GetOrder(orderId []byte) (order *SellOrder, err ErrorI)

GetOrder() retrieves a sell order from the OrderBook

func (*OrderBook) GetOrders

func (x *OrderBook) GetOrders() []*SellOrder

func (*OrderBook) ProtoMessage

func (*OrderBook) ProtoMessage()

func (*OrderBook) ProtoReflect

func (x *OrderBook) ProtoReflect() protoreflect.Message

func (*OrderBook) Reset

func (x *OrderBook) Reset()

func (*OrderBook) String

func (x *OrderBook) String() string

type OrderBooks

type OrderBooks struct {

	// OrderBooks: the actual list of order book objects
	OrderBooks []*OrderBook `protobuf:"bytes,1,rep,name=OrderBooks,proto3" json:"orderBooks"` // @gotags: json:"orderBooks"
	// contains filtered or unexported fields
}

OrderBooks: is a list of order book objects held in the blockchain state

func (*OrderBooks) Descriptor deprecated

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

Deprecated: Use OrderBooks.ProtoReflect.Descriptor instead.

func (*OrderBooks) GetOrderBooks

func (x *OrderBooks) GetOrderBooks() []*OrderBook

func (OrderBooks) MarshalJSON

func (x OrderBooks) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for the OrderBooks object

func (*OrderBooks) ProtoMessage

func (*OrderBooks) ProtoMessage()

func (*OrderBooks) ProtoReflect

func (x *OrderBooks) ProtoReflect() protoreflect.Message

func (*OrderBooks) Reset

func (x *OrderBooks) Reset()

func (*OrderBooks) String

func (x *OrderBooks) String() string

func (*OrderBooks) UnmarshalJSON

func (x *OrderBooks) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for the OrderBooks object

type Orders

type Orders struct {

	// lock_orders: a list of actions where a buyer expresses an intent to purchase an order,
	// often referred to as 'claiming' the order
	LockOrders []*LockOrder `protobuf:"bytes,1,rep,name=lock_orders,json=lockOrders,proto3" json:"lockOrders"` // @gotags: json:"lockOrders"
	// reset_orders: a list of orders where no funds were sent before the deadline,
	// signaling to Canopy to 'un-claim' the order
	ResetOrders [][]byte `protobuf:"bytes,2,rep,name=reset_orders,json=resetOrders,proto3" json:"resetOrders"` // @gotags: json:"resetOrders"
	// close_orders: a list of orders where funds were sent,
	// signaling Canopy to transfer escrowed tokens to the buyer's Canopy address
	CloseOrders [][]byte `protobuf:"bytes,3,rep,name=close_orders,json=closeOrders,proto3" json:"closeOrders"` // @gotags: json:"closeOrders"
	// contains filtered or unexported fields
}

Orders: tracks actions related to 'buyer side' activities for sell orders The committee monitors the 3rd party chain for actions such as intent to buy, funds sent, and funds not sent, and communicates these states to the Canopy chain

func (*Orders) CheckBasic

func (x *Orders) CheckBasic() (err ErrorI)

CheckBasic() performs stateless validation on an Orders object

func (*Orders) Descriptor deprecated

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

Deprecated: Use Orders.ProtoReflect.Descriptor instead.

func (*Orders) Equals

func (x *Orders) Equals(y *Orders) bool

Equals() compares two Orders for equality

func (*Orders) GetCloseOrders

func (x *Orders) GetCloseOrders() [][]byte

func (*Orders) GetLockOrders

func (x *Orders) GetLockOrders() []*LockOrder

func (*Orders) GetResetOrders

func (x *Orders) GetResetOrders() [][]byte

func (*Orders) ProtoMessage

func (*Orders) ProtoMessage()

func (*Orders) ProtoReflect

func (x *Orders) ProtoReflect() protoreflect.Message

func (*Orders) Reset

func (x *Orders) Reset()

func (*Orders) String

func (x *Orders) String() string

type P2PConfig

type P2PConfig struct {
	NetworkID           uint64   `json:"networkID"`           // the ID for the peering network
	ListenAddress       string   `json:"listenAddress"`       // listen for incoming connection
	ExternalAddress     string   `json:"externalAddress"`     // advertise for external dialing
	MaxInbound          int      `json:"maxInbound"`          // max inbound peers
	MaxOutbound         int      `json:"maxOutbound"`         // max outbound peers
	TrustedPeerIDs      []string `json:"trustedPeerIDs"`      // trusted public keys
	DialPeers           []string `json:"dialPeers"`           // peers to consistently dial until expo-backoff fails (format pubkey@ip:port)
	BannedPeerIDs       []string `json:"bannedPeersIDs"`      // banned public keys
	BannedIPs           []string `json:"bannedIPs"`           // banned IPs
	MinimumPeersToStart int      `json:"minimumPeersToStart"` // the minimum connections required to start consensus
}

P2PConfig defines peering compatibility and limits as well as actions on specific peering IPs / IDs

func DefaultP2PConfig

func DefaultP2PConfig() P2PConfig

type Page

type Page struct {
	PageParams          // the input parameters for the page
	Results    Pageable `json:"results"`    // the actual returned array of items
	Type       string   `json:"type"`       // the type of the page
	Count      int      `json:"count"`      // count of items included in the page
	TotalPages int      `json:"totalPages"` // number of pages that exist based on these page parameters
	TotalCount int      `json:"totalCount"` // count of items that exist
}

Page is a pagination wrapper over a slice of data

func NewPage

func NewPage(p PageParams, pageType string) *Page

NewPage() returns a new instance of the Page object from the params and pageType Load() or LoadArray() is the likely next function call

func (*Page) Load

func (p *Page) Load(storePrefix []byte, reverse bool, results Pageable, db RStoreI, callback func(k, v []byte) ErrorI) (err ErrorI)

Load() fills a page from an IteratorI

func (*Page) LoadArray

func (p *Page) LoadArray(slice any, results Pageable, callback func(item any) ErrorI) (err ErrorI)

LoadArray() fills a page from a slice

func (*Page) UnmarshalJSON

func (p *Page) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() overrides the unmarshalling logic of the Page for generic structure assignment (registered pageables) and custom formatting

type PageParams

type PageParams struct {
	PageNumber int `json:"pageNumber"`
	PerPage    int `json:"perPage"`
}

PageParams are the input parameters to calculate the proper page

type Pageable

type Pageable interface{ New() Pageable }

Pageable() is a simple interface that represents Page structures

type PaymentPercents

type PaymentPercents struct {

	// address: the address where the tokens will be received
	Address []byte `protobuf:"bytes,1,opt,name=address,proto3" json:"address,omitempty"`
	// percent: the dilutable share of the committee treasury pool
	Percent uint64 `protobuf:"varint,2,opt,name=percent,proto3" json:"percent,omitempty"`
	// chain_id: the chain_id where the payment is distributed
	ChainId uint64 `protobuf:"varint,3,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	// contains filtered or unexported fields
}

PaymentPercents represents the distribution of rewards to recipients from the committee treasury pool Each recipient is identified by their address and the percentage of the reward they will receive Percents are diluted based on how many samples are in the Committee Data

func (*PaymentPercents) Descriptor deprecated

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

Deprecated: Use PaymentPercents.ProtoReflect.Descriptor instead.

func (*PaymentPercents) GetAddress

func (x *PaymentPercents) GetAddress() []byte

func (*PaymentPercents) GetChainId

func (x *PaymentPercents) GetChainId() uint64

func (*PaymentPercents) GetPercent

func (x *PaymentPercents) GetPercent() uint64

func (PaymentPercents) MarshalJSON

func (x PaymentPercents) MarshalJSON() ([]byte, error)

MarshalJSON() satisfies the json.Marshaller interface

func (*PaymentPercents) ProtoMessage

func (*PaymentPercents) ProtoMessage()

func (*PaymentPercents) ProtoReflect

func (x *PaymentPercents) ProtoReflect() protoreflect.Message

func (*PaymentPercents) Reset

func (x *PaymentPercents) Reset()

func (*PaymentPercents) String

func (x *PaymentPercents) String() string

func (*PaymentPercents) UnmarshalJSON

func (x *PaymentPercents) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() satisfies the json.Unmarshaler interface

type PeerAddress

type PeerAddress struct {

	// public_key: the peer's public key used for cryptographic identity
	PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"publicKey"` // @gotags: json:"publicKey"
	// net_address: the tcp network address of the peer Ex. tcp://8.8.8.8:8080 or 8.8.8.8:8080
	NetAddress string `protobuf:"bytes,2,opt,name=net_address,json=netAddress,proto3" json:"netAddress"` // @gotags: json:"netAddress"
	// peer_meta: additional metadata about the peer, such as the network ID and chains it supports
	PeerMeta *PeerMeta `protobuf:"bytes,3,opt,name=peer_meta,json=peerMeta,proto3" json:"peerMeta"` // @gotags: json:"peerMeta"
	// contains filtered or unexported fields
}

PeerAddress holds the details of the peer's network address and public key

func (*PeerAddress) Copy

func (x *PeerAddress) Copy() *PeerAddress

Copy() returns a deep clone of the PeerAddress

func (*PeerAddress) Descriptor deprecated

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

Deprecated: Use PeerAddress.ProtoReflect.Descriptor instead.

func (*PeerAddress) Equals

func (x *PeerAddress) Equals(y *PeerAddress) bool

Equals() compares the equality of two peer addresses

func (*PeerAddress) FromString

func (x *PeerAddress) FromString(stringFromConfig string) (e ErrorI)

FromString() creates a new PeerAddress object from string (without meta) Peer String example: <some-public-key>@<some-net-address>

func (*PeerAddress) GetNetAddress

func (x *PeerAddress) GetNetAddress() string

func (*PeerAddress) GetPeerMeta

func (x *PeerAddress) GetPeerMeta() *PeerMeta

func (*PeerAddress) GetPublicKey

func (x *PeerAddress) GetPublicKey() []byte

func (*PeerAddress) HasChain

func (x *PeerAddress) HasChain(id uint64) bool

HasChain() returns if the PeerAddress's PeerMeta has this chain

func (PeerAddress) MarshalJSON

func (x PeerAddress) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaller interface for PeerAddress

func (*PeerAddress) ProtoMessage

func (*PeerAddress) ProtoMessage()

func (*PeerAddress) ProtoReflect

func (x *PeerAddress) ProtoReflect() protoreflect.Message

func (*PeerAddress) Reset

func (x *PeerAddress) Reset()

func (*PeerAddress) String

func (x *PeerAddress) String() string

func (*PeerAddress) UnmarshalJSON

func (x *PeerAddress) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON satisfies the json.Unmarshlaer interface for PeerAddress

type PeerInfo

type PeerInfo struct {

	// Address: the address information of the peer, including its public key and network address
	Address *PeerAddress `protobuf:"bytes,1,opt,name=Address,proto3" json:"address"` // @gotags: json:"address"
	// is_outbound: indicates whether the connection to the peer was initiated by this node (true if outbound)
	IsOutbound bool `protobuf:"varint,2,opt,name=is_outbound,json=isOutbound,proto3" json:"isOutbound"` // @gotags: json:"isOutbound"
	// is_must_connect: indicates whether this peer is a required connection that the node must connect to
	IsMustConnect bool `protobuf:"varint,3,opt,name=is_must_connect,json=isMustConnect,proto3" json:"isMustConnect"` // @gotags: json:"isMustConnect"
	// is_trusted: marks whether this peer is configured as trusted
	IsTrusted bool `protobuf:"varint,4,opt,name=is_trusted,json=isTrusted,proto3" json:"isTrusted"` // @gotags: json:"isTrusted"
	// reputation: a numerical score representing the peer's reputation to this local node
	Reputation int32 `protobuf:"varint,5,opt,name=reputation,proto3" json:"reputation,omitempty"`
	// contains filtered or unexported fields
}

PeerInfo contains peering information about a peer node, like its address, connection type, trust level, and reputation

func (*PeerInfo) Copy

func (x *PeerInfo) Copy() *PeerInfo

Copy() returns a reference to a clone of the PeerInfo

func (*PeerInfo) Descriptor deprecated

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

Deprecated: Use PeerInfo.ProtoReflect.Descriptor instead.

func (*PeerInfo) GetAddress

func (x *PeerInfo) GetAddress() *PeerAddress

func (*PeerInfo) GetIsMustConnect

func (x *PeerInfo) GetIsMustConnect() bool

func (*PeerInfo) GetIsOutbound

func (x *PeerInfo) GetIsOutbound() bool

func (*PeerInfo) GetIsTrusted

func (x *PeerInfo) GetIsTrusted() bool

func (*PeerInfo) GetReputation

func (x *PeerInfo) GetReputation() int32

func (*PeerInfo) HasChain

func (x *PeerInfo) HasChain(id uint64) bool

HasChain() returns if the PeerInfo has a chain under the PeerAddresses' PeerMeta

func (PeerInfo) MarshalJSON

func (x PeerInfo) MarshalJSON() ([]byte, error)

MarshalJSON satisfies the json.Marshaller interface for PeerInfo

func (*PeerInfo) ProtoMessage

func (*PeerInfo) ProtoMessage()

func (*PeerInfo) ProtoReflect

func (x *PeerInfo) ProtoReflect() protoreflect.Message

func (*PeerInfo) Reset

func (x *PeerInfo) Reset()

func (*PeerInfo) String

func (x *PeerInfo) String() string

type PeerMeta

type PeerMeta struct {

	// network_id: the identifier for the network the peer is part of
	// this ensures no conflicts among different peering networks (mainnet, testnet, etc.)
	NetworkId uint64 `protobuf:"varint,1,opt,name=network_id,json=networkId,proto3" json:"networkID"` // @gotags: json:"networkID"
	// chain_id the chain identifiers that the peer supports and/or participates in
	ChainId uint64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// signature: a cryptographic signature to verify the authenticity of the peer's metadata
	Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

PeerMeta contains additional metadata about a peer, including supported networks and chains

func (*PeerMeta) Copy

func (x *PeerMeta) Copy() *PeerMeta

Copy() returns a reference to a clone of the PeerMeta

func (*PeerMeta) Descriptor deprecated

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

Deprecated: Use PeerMeta.ProtoReflect.Descriptor instead.

func (*PeerMeta) Equals

func (x *PeerMeta) Equals(y *PeerMeta) bool

Equals() compares the equality of two peer metas

func (*PeerMeta) GetChainId

func (x *PeerMeta) GetChainId() uint64

func (*PeerMeta) GetNetworkId

func (x *PeerMeta) GetNetworkId() uint64

func (*PeerMeta) GetSignature

func (x *PeerMeta) GetSignature() []byte

func (*PeerMeta) ProtoMessage

func (*PeerMeta) ProtoMessage()

func (*PeerMeta) ProtoReflect

func (x *PeerMeta) ProtoReflect() protoreflect.Message

func (*PeerMeta) Reset

func (x *PeerMeta) Reset()

func (*PeerMeta) Sign

func (x *PeerMeta) Sign(key crypto.PrivateKeyI) *PeerMeta

Sign() adds a digital signature to the PeerMeta for remote public key verification

func (*PeerMeta) SignBytes

func (x *PeerMeta) SignBytes() (signBytes []byte)

SignBytes() returns the canonical byte representation used to digitally sign the bytes

func (*PeerMeta) String

func (x *PeerMeta) String() string

type PeerMetrics

type PeerMetrics struct {
	TotalPeers    prometheus.Gauge // number of peers
	InboundPeers  prometheus.Gauge // number of peers that dialed this node
	OutboundPeers prometheus.Gauge // number of peers that this node dialed
}

PeerMetrics represents the telemetry for the P2P module

type Phase

type Phase int32

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ Phase is the smallest unit in the consensus process. Each round consists of multiple phases, and these phases are executed sequentially to achieve consensus on the next block.

const (
	// unknown: is an unidentified phase that is likely an error
	Phase_UNKNOWN Phase = 0
	// election:
	// Each replica runs a Verifiable Random Function (VRF); if selected as a candidate,
	// the replica sends its VRF output to the other replicas.
	Phase_ELECTION Phase = 1
	// election_vote:
	// Each replica sends ELECTION votes (signature) for the leader based on the lowest VRF value
	// if no candidates exist, the process falls back to a stake-weighted-pseudorandom selection.
	Phase_ELECTION_VOTE Phase = 2
	// propose:
	// The leader collects ELECTION_VOTEs from +2/3 of the replicas, each including the lock, evidence, and signature
	// from the sender. If a valid lock exists for the current height and meets the SAFE NODE PREDICATE, the leader uses
	// that block as the proposal block. If no valid lock is found, the leader creates a new block to extend the
	// blockchain. The leader then sends the new proposal (block, results, evidence) attaching the +2/3 signatures from
	// ELECTION_VOTE to justify themselves as the Leader.
	Phase_PROPOSE Phase = 3
	// propose_vote:
	// Each replica validates the PROPOSE msg by verifying the aggregate signature, applying the proposal block against
	// their state machine, and checking the header and results against what they produced. If valid, the replica sends
	// a vote (signature) to the leader. Each vote vouches that the leader's proposal as valid
	Phase_PROPOSE_VOTE Phase = 4
	// precommit:
	// The leader collects PROPOSE_VOTEs from +2/3 of the replicas, each including a signature from the sender.
	// The leader sends a PRECOMMIT message attaching +2/3 signatures from the PROPOSE_VOTE messages, justifying
	// that +2/3 of the quorum believes the proposal is valid.
	Phase_PRECOMMIT Phase = 5
	// precommit_vote:
	// Each replica validates the PRECOMMIT msg by verifying the aggregate signature. If valid, the replica sends a vote
	// to the leader. Each vote vouches that the replica has seen evidence that +2/3 of the quorum believe the proposal
	// is valid.
	Phase_PRECOMMIT_VOTE Phase = 6
	// commit:
	// The leader collects PRECOMMIT_VOTEs from +2/3 from the replicas, each including a signature from the sender.
	// The leader sends a COMMIT message attaching +2/3 signatures from the PRECOMMIT_VOTE messages, justifying that
	// +2/3 of the quorum agree that a super-majority think the proposal is valid.
	Phase_COMMIT Phase = 7
	// commit_process:
	// Each replica validates the COMMIT msg by verifying the aggregate signature. If valid, the replica commits the
	// block to finality, and resets the bft for the next height.
	Phase_COMMIT_PROCESS Phase = 8
	// round_interrupt:
	// A failure in the bft cycle caused a premature exit in the round. This results in a new round and an extended sleep
	// time between phases to help alleviate any 'non-voter' issues. During this phase, each replica sends its View to
	// all other replicas to alleviate round synchronous issues.
	Phase_ROUND_INTERRUPT Phase = 9
	// pacemaker:
	// This phase follows ROUND_INTERRUPT, each replica calculates the highest round a super-majority has seen and jumps
	// to it to assist in 'round out of sync' issues.
	Phase_PACEMAKER Phase = 10
)

func (Phase) Descriptor

func (Phase) Descriptor() protoreflect.EnumDescriptor

func (Phase) Enum

func (x Phase) Enum() *Phase

func (Phase) EnumDescriptor deprecated

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

Deprecated: Use Phase.Descriptor instead.

func (Phase) MarshalJSON

func (x Phase) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json.Marshaller interface

func (Phase) Number

func (x Phase) Number() protoreflect.EnumNumber

func (Phase) String

func (x Phase) String() string

func (Phase) Type

func (Phase) Type() protoreflect.EnumType

func (*Phase) UnmarshalJSON

func (x *Phase) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() implements the json.Unmarshaler interface

type Proposers

type Proposers struct {

	// addresses: is the list of addresses (short version of public keys)
	Addresses [][]byte `protobuf:"bytes,1,rep,name=addresses,proto3" json:"addresses,omitempty"`
	// contains filtered or unexported fields
}

Proposers is a list of addresses that represent the previous proposers

func (*Proposers) Descriptor deprecated

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

Deprecated: Use Proposers.ProtoReflect.Descriptor instead.

func (*Proposers) GetAddresses

func (x *Proposers) GetAddresses() [][]byte

func (Proposers) MarshalJSON

func (x Proposers) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json.Marshaller interface for Proposers

func (*Proposers) ProtoMessage

func (*Proposers) ProtoMessage()

func (*Proposers) ProtoReflect

func (x *Proposers) ProtoReflect() protoreflect.Message

func (*Proposers) Reset

func (x *Proposers) Reset()

func (*Proposers) String

func (x *Proposers) String() string

func (*Proposers) UnmarshalJSON

func (x *Proposers) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() implements the json.Unmarshaler interface for Proposers

type ProveStoreI

type ProveStoreI interface {
	GetProof(key []byte) (proof []*Node, err ErrorI) // Get gets the bytes for a compact merkle proof
	VerifyProof(key, value []byte, validateMembership bool,
		root []byte, proof []*Node) (valid bool, err ErrorI) // VerifyProof validates the merkle proof
}

ProveStoreI defines an interface

type PseudorandomParams

type PseudorandomParams struct {
	*SortitionData                      // seed data the peer used for sortition
	ValidatorSet   *ConsensusValidators // the set of validators
}

PseudorandomParams are the input params to run the Stake-Weighted-Pseudorandom fallback leader selection algorithm

type QuorumCertificate

type QuorumCertificate struct {

	// header: is the view of the quorum certificate
	Header *View `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	// results: is the certificate result that Canopy uses to process payments, evidence, swaps, and checkpoints
	Results *CertificateResult `protobuf:"bytes,2,opt,name=results,proto3" json:"results,omitempty"`
	// results_hash: is the cryptographic integrity bytes for results, results hash may be used to confirm the validator
	// quorum signed off on the results
	ResultsHash []byte `protobuf:"bytes,3,opt,name=results_hash,json=resultsHash,proto3" json:"resultHash"` // @gotags: json:"resultHash"
	// block: the proposed block to be added to the blockchain
	Block []byte `protobuf:"bytes,4,opt,name=block,proto3" json:"block,omitempty"`
	// block_hash: is the cryptographic integrity bytes for block, block hash may be used to confirm the validator quorum
	// signed off on the block
	BlockHash []byte `protobuf:"bytes,5,opt,name=block_hash,json=blockHash,proto3" json:"blockHash"` // @gotags: json:"blockHash"
	// proposer_key: is the public key of the block proposer
	ProposerKey []byte `protobuf:"bytes,6,opt,name=proposer_key,json=proposerKey,proto3" json:"proposerKey"` // @gotags: json:"proposerKey"
	// (aggregate) signature: the compact signature created by combining multiple individual signatures from replica
	// validators. This signature serves as a justification that a super-majority quorum signed off on the certificate
	Signature *AggregateSignature `protobuf:"bytes,7,opt,name=signature,proto3" json:"signature,omitempty"` // aggregate signature from the current proposer message
	// contains filtered or unexported fields
}

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ A QuorumCertificate is a collection of signatures from a super-majority of validators that confirms consensus on a particular block and results. It serves as proof that enough validators have agreed on the block & result’s validity, ensuring its acceptance and security in the blockchain.

func (*QuorumCertificate) Check

func (x *QuorumCertificate) Check(vs ValidatorSet, maxBlockSize int, view *View, enforceHeights bool) (isPartialQC bool, error ErrorI)

Check() validates the QC by cross-checking the aggregate signature against the ValidatorSet isPartialQC means a valid aggregate signature, but not enough signers for +2/3 majority

func (*QuorumCertificate) CheckBasic

func (x *QuorumCertificate) CheckBasic() ErrorI

CheckBasic() performs 'sanity' checks on the Quorum Certificate structure

func (*QuorumCertificate) CheckHighQC

func (x *QuorumCertificate) CheckHighQC(maxBlockSize int, view *View, lastRootHeightUpdated uint64, vs ValidatorSet) ErrorI

CheckHighQC() performs validation on the special `HighQC` (justify unlock QC)

func (*QuorumCertificate) CheckProposalBasic

func (x *QuorumCertificate) CheckProposalBasic(height, networkId, chainId uint64) (block *Block, err ErrorI)

CheckProposalBasic() does a basic validity check on the proposal inside the QC and returns the block structure

func (*QuorumCertificate) Descriptor deprecated

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

Deprecated: Use QuorumCertificate.ProtoReflect.Descriptor instead.

func (*QuorumCertificate) EqualPayloads

func (x *QuorumCertificate) EqualPayloads(compare *QuorumCertificate) bool

EqualPayloads() compares the payloads only of two certs (can have different signatures)

func (*QuorumCertificate) GetBlock

func (x *QuorumCertificate) GetBlock() []byte

func (*QuorumCertificate) GetBlockHash

func (x *QuorumCertificate) GetBlockHash() []byte

func (*QuorumCertificate) GetHeader

func (x *QuorumCertificate) GetHeader() *View

func (*QuorumCertificate) GetNonSigners

func (x *QuorumCertificate) GetNonSigners(vs *ConsensusValidators) (nonSignerPubKeys [][]byte, nonSignerPercent int, err ErrorI)

GetNonSigners() returns the public keys and the percentage (of voting power out of total) of those who did not sign the QC

func (*QuorumCertificate) GetProposerKey

func (x *QuorumCertificate) GetProposerKey() []byte

func (*QuorumCertificate) GetResults

func (x *QuorumCertificate) GetResults() *CertificateResult

func (*QuorumCertificate) GetResultsHash

func (x *QuorumCertificate) GetResultsHash() []byte

func (*QuorumCertificate) GetSignature

func (x *QuorumCertificate) GetSignature() *AggregateSignature

func (QuorumCertificate) MarshalJSON

func (x QuorumCertificate) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json.Marshaller interface

func (*QuorumCertificate) ProtoMessage

func (*QuorumCertificate) ProtoMessage()

func (*QuorumCertificate) ProtoReflect

func (x *QuorumCertificate) ProtoReflect() protoreflect.Message

func (*QuorumCertificate) Reset

func (x *QuorumCertificate) Reset()

func (*QuorumCertificate) SignBytes

func (x *QuorumCertificate) SignBytes() (signBytes []byte)

SignBytes() returns the canonical byte representation used to digitally sign the bytes of the structure

func (*QuorumCertificate) String

func (x *QuorumCertificate) String() string

func (*QuorumCertificate) UnmarshalJSON

func (x *QuorumCertificate) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() implements the json.Unmarshaler interface

type RCManagerI

type RCManagerI interface {
	Publish(chainId uint64, info *RootChainInfo)                                              // publish the root chain info to nested chain listeners
	ChainIds() []uint64                                                                       // get the list of chain ids of the nested chain subscribers
	GetHeight(rootChainId uint64) uint64                                                      // get the height of the root chain
	GetRootChainInfo(rootChainId, chainId uint64) (rootChainInfo *RootChainInfo, err ErrorI)  // get root-chain info 'on-demand'
	GetValidatorSet(rootChainId, height, id uint64) (ValidatorSet, ErrorI)                    // get the validator set for a chain id using the RPC API
	GetLotteryWinner(rootChainId, height, id uint64) (p *LotteryWinner, err ErrorI)           // get the delegate 'lottery winner' for a chain id
	GetOrders(rootChainId, rootHeight, id uint64) (*OrderBook, ErrorI)                        // get the order book for a specific 'chain id'
	GetOrder(rootChainId, height uint64, orderId string, chainId uint64) (*SellOrder, ErrorI) // get a specific order from the order book
	IsValidDoubleSigner(rootChainId, height uint64, address string) (p *bool, err ErrorI)     // check if a double signer is valid for an address for a specific 'double sign height'
	GetMinimumEvidenceHeight(rootChainId, rootHeight uint64) (*uint64, ErrorI)                // load the minimum height that evidence is valid
	GetCheckpoint(rootChainId, height, id uint64) (blockHash HexBytes, i ErrorI)              // get a checkpoint at a height and chain id combination
	Transaction(rootChainId uint64, tx TransactionI) (hash *string, err ErrorI)               // submit a transaction to the 'root chain'
}

RootChainClient executes 'on-demand' calls to the root-chain

type RIndexerI

type RIndexerI interface {
	GetTxByHash(hash []byte) (*TxResult, ErrorI)                                                  // get the tx by the Transaction hash
	GetTxsByHeight(height uint64, newestToOldest bool, p PageParams) (*Page, ErrorI)              // get Transactions for a height
	GetTxsBySender(address crypto.AddressI, newestToOldest bool, p PageParams) (*Page, ErrorI)    // get Transactions for a sender
	GetTxsByRecipient(address crypto.AddressI, newestToOldest bool, p PageParams) (*Page, ErrorI) // get Transactions for a recipient
	GetBlockByHash(hash []byte) (*BlockResult, ErrorI)                                            // get a block by hash
	GetBlockByHeight(height uint64) (*BlockResult, ErrorI)                                        // get a block by height
	GetBlockHeaderByHeight(height uint64) (*BlockResult, ErrorI)                                  // get a block by height without transactions
	GetBlocks(p PageParams) (*Page, ErrorI)                                                       // get a page of blocks within the page params
	GetQCByHeight(height uint64) (*QuorumCertificate, ErrorI)                                     // get certificate for a height
	GetDoubleSigners() ([]*DoubleSigner, ErrorI)                                                  // all double signers in the indexer
	IsValidDoubleSigner(address []byte, height uint64) (bool, ErrorI)                             // get if the DoubleSigner is already set for a height
	GetCheckpoint(chainId, height uint64) (blockHash HexBytes, err ErrorI)                        // get the checkpoint block hash for a certain committee and height combination
	GetMostRecentCheckpoint(chainId uint64) (checkpoint *Checkpoint, err ErrorI)                  // get the most recent checkpoint for a committee
	GetAllCheckpoints(chainId uint64) (checkpoints []*Checkpoint, err ErrorI)                     // export all checkpoints for a committee
}

RIndexerI defines the read interface for the indexing operations

type RPCConfig

type RPCConfig struct {
	WalletPort   string `json:"walletPort"`   // the port where the web wallet is hosted
	ExplorerPort string `json:"explorerPort"` // the port where the block explorer is hosted
	RPCPort      string `json:"rpcPort"`      // the port where the rpc server is hosted
	AdminPort    string `json:"adminPort"`    // the port where the admin rpc server is hosted
	RPCUrl       string `json:"rpcURL"`       // the url where the rpc server is hosted
	AdminRPCUrl  string `json:"adminRPCUrl"`  // the url where the admin rpc server is hosted
	TimeoutS     int    `json:"timeoutS"`     // the rpc request timeout in seconds
}

func DefaultRPCConfig

func DefaultRPCConfig() RPCConfig

DefaultRPCConfig() sets rpc url to localhost and sets wallet, explorer, rpc, and admin ports from [50000-50003]

type RStoreI

type RStoreI interface {
	Get(key []byte) ([]byte, ErrorI)               // access value bytes using key bytes
	Iterator(prefix []byte) (IteratorI, ErrorI)    // iterate through the data one KV pair at a time in lexicographical order
	RevIterator(prefix []byte) (IteratorI, ErrorI) // iterate through the date on KV pair at a time in reverse lexicographical order
}

WStoreI defines an interface for basic read operations

type RWIndexerI

type RWIndexerI interface {
	WIndexerI
	RIndexerI
}

RWIndexerI defines the Read/Write interface for indexing operations

type RWStoreI

type RWStoreI interface {
	RStoreI
	WStoreI
}

RWStoreI defines the Read/Write interface for basic db CRUD operations

type ReadOnlyStoreI

type ReadOnlyStoreI interface {
	ProveStoreI
	RStoreI
	RIndexerI
}

ReadOnlyStoreI defines a Read-Only interface for accessing the blockchain storage including membership and non-membership proofs

type Retry

type Retry struct {
	// contains filtered or unexported fields
}

Retry is a simple exponential backoff retry structure in the form of doubling the timeout

func NewRetry

func NewRetry(waitTimeMS, maxLoops uint64) *Retry

NewRetry() constructs a new Retry given parameters

func (*Retry) WaitAndDoRetry

func (r *Retry) WaitAndDoRetry() bool

WaitAndDoRetry() sleeps the appropriate time and returns false if maxed out retry

type RewardRecipients

type RewardRecipients struct {

	// payment_percents: the percentage of rewards allocated to each recipient
	PaymentPercents []*PaymentPercents `protobuf:"bytes,1,rep,name=payment_percents,json=paymentPercents,proto3" json:"paymentPercents"` // @gotags: json:"paymentPercents"
	// number_of_samples: (internal processing only) the number of samples used to determine reward distribution
	NumberOfSamples uint64 `protobuf:"varint,2,opt,name=number_of_samples,json=numberOfSamples,proto3" json:"numberOfSamples"` // @gotags: json:"numberOfSamples"
	// contains filtered or unexported fields
}

RewardRecipients is the list of recipients who will receive rewards from the committee's treasury pool, based on decisions confirmed in a Quorum Certificate

func (*RewardRecipients) CheckBasic

func (x *RewardRecipients) CheckBasic() (err ErrorI)

CheckBasic() performs a basic 'sanity check' on the structure

func (*RewardRecipients) Descriptor deprecated

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

Deprecated: Use RewardRecipients.ProtoReflect.Descriptor instead.

func (*RewardRecipients) Equals

func (x *RewardRecipients) Equals(y *RewardRecipients) bool

Equals() compares two RewardRecipients for equality

func (*RewardRecipients) GetNumberOfSamples

func (x *RewardRecipients) GetNumberOfSamples() uint64

func (*RewardRecipients) GetPaymentPercents

func (x *RewardRecipients) GetPaymentPercents() []*PaymentPercents

func (RewardRecipients) MarshalJSON

func (x RewardRecipients) MarshalJSON() ([]byte, error)

MarshalJSON() satisfies the json.Marshaller interface

func (*RewardRecipients) ProtoMessage

func (*RewardRecipients) ProtoMessage()

func (*RewardRecipients) ProtoReflect

func (x *RewardRecipients) ProtoReflect() protoreflect.Message

func (*RewardRecipients) Reset

func (x *RewardRecipients) Reset()

func (*RewardRecipients) String

func (x *RewardRecipients) String() string

func (*RewardRecipients) UnmarshalJSON

func (x *RewardRecipients) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() satisfies the json.Unmarshaler interface

type RootChain

type RootChain struct {
	ChainId uint64 `json:"chainId"` // used if the governance parameter RootChainId == ChainId
	Url     string `json:"url"`     // the url to the 'root chain' rpc
}

RootChain defines a rpc url to a possible 'root chain' which is used if the governance parameter RootChainId == ChainId

type RootChainInfo

type RootChainInfo struct {

	// root_chain_id: the chain id of the root chain
	RootChainId uint64 `protobuf:"varint,1,opt,name=root_chain_id,json=rootChainId,proto3" json:"rootChainId"` // @gotags: json:"rootChainId"
	// height: the block height of the root chain
	Height uint64 `protobuf:"varint,2,opt,name=height,proto3" json:"height"` // @gotags: json:"height"
	// validator_set: the current validator set
	ValidatorSet *ConsensusValidators `protobuf:"bytes,3,opt,name=validator_set,json=validatorSet,proto3" json:"validatorSet"` // @gotags: json:"validatorSet"
	// last_validator_set: the validator set of the previous height
	LastValidatorSet *ConsensusValidators `protobuf:"bytes,4,opt,name=last_validator_set,json=lastValidatorSet,proto3" json:"lastValidatorSet"` // @gotags: json:"lastValidatorSet"
	// lottery_winner: the selected delegate/pseudo-validator who receives rewards
	LotteryWinner *LotteryWinner `protobuf:"bytes,5,opt,name=lottery_winner,json=lotteryWinner,proto3" json:"lotteryWinner"` // @gotags: json:"lotteryWinner"
	// orders: the swap order book from the 'root chain' for the 'nested chain'
	Orders *OrderBook `protobuf:"bytes,6,opt,name=orders,proto3" json:"orders"` // @gotags: json:"orders"
	// timestamp: a timestamp of when the notification should cause a reset
	Timestamp uint64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

RootChainInfo maintains root-chain data needed for consensus

func (*RootChainInfo) Descriptor deprecated

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

Deprecated: Use RootChainInfo.ProtoReflect.Descriptor instead.

func (*RootChainInfo) GetHeight

func (x *RootChainInfo) GetHeight() uint64

func (*RootChainInfo) GetLastValidatorSet

func (x *RootChainInfo) GetLastValidatorSet() *ConsensusValidators

func (*RootChainInfo) GetLotteryWinner

func (x *RootChainInfo) GetLotteryWinner() *LotteryWinner

func (*RootChainInfo) GetOrders

func (x *RootChainInfo) GetOrders() *OrderBook

func (*RootChainInfo) GetRootChainId

func (x *RootChainInfo) GetRootChainId() uint64

func (*RootChainInfo) GetTimestamp

func (x *RootChainInfo) GetTimestamp() uint64

func (*RootChainInfo) GetValidatorSet

func (x *RootChainInfo) GetValidatorSet() *ConsensusValidators

func (*RootChainInfo) ProtoMessage

func (*RootChainInfo) ProtoMessage()

func (*RootChainInfo) ProtoReflect

func (x *RootChainInfo) ProtoReflect() protoreflect.Message

func (*RootChainInfo) Reset

func (x *RootChainInfo) Reset()

func (*RootChainInfo) String

func (x *RootChainInfo) String() string

type SellOrder

type SellOrder struct {

	// id: the unique identifier of the order
	Id []byte `protobuf:"bytes,1,opt,name=Id,proto3" json:"id"` // @gotags: json:"id"
	// committee: the id of the committee that is in-charge of escrow for the swap
	Committee uint64 `protobuf:"varint,2,opt,name=Committee,proto3" json:"committee"` // @gotags: json:"committee"
	// data: a generic data field which can allow a committee to execute specific functionality for the swap
	Data []byte `protobuf:"bytes,3,opt,name=Data,proto3" json:"data"` // @gotags: json:"data"
	// amount_for_sale: amount of CNPY for sale
	AmountForSale uint64 `protobuf:"varint,4,opt,name=AmountForSale,proto3" json:"amountForSale"` // @gotags: json:"amountForSale"
	// requested_amount: amount of 'counter-asset' to receive
	RequestedAmount uint64 `protobuf:"varint,5,opt,name=RequestedAmount,proto3" json:"requestedAmount"` // @gotags: json:"requestedAmount"
	// seller_receive_address: the external chain address to receive the 'counter-asset'
	SellerReceiveAddress []byte `protobuf:"bytes,6,opt,name=SellerReceiveAddress,proto3" json:"sellerReceiveAddress"` // @gotags: json:"sellerReceiveAddress"
	// buyer_send_address: the address the buyer will be transferring the funds from
	BuyerSendAddress []byte `protobuf:"bytes,7,opt,name=BuyerSendAddress,proto3" json:"buyerSendAddress"` // @gotags: json:"buyerSendAddress"
	// buyer_receive_address: the buyer Canopy address to receive the CNPY
	BuyerReceiveAddress []byte `protobuf:"bytes,8,opt,name=BuyerReceiveAddress,proto3" json:"buyerReceiveAddress"` // @gotags: json:"buyerReceiveAddress"
	// buyer_chain_deadline: the external chain height deadline to send the 'tokens' to SellerReceiveAddress
	BuyerChainDeadline uint64 `protobuf:"varint,9,opt,name=BuyerChainDeadline,proto3" json:"buyerChainDeadline"` // @gotags: json:"buyerChainDeadline"
	// sellers_send_address: the signing address of seller who is selling the CNPY
	SellersSendAddress []byte `protobuf:"bytes,10,opt,name=SellersSendAddress,proto3" json:"sellersSendAddress"` // @gotags: json:"sellersSendAddress"
	// contains filtered or unexported fields
}

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ SWAP PROTOCOL: Facilitates a token swap between Bob (with Token A) and Alice (with Token B). The committee oversees the process while controlling Blockchain A and observing Blockchain B.

  1. Bob creates a 'SellOrder' with the amount of "Token A" he wants to sell, the 'exchange rate', and his 'Token B address'. Token A is escrowed in a committee-controlled address. Bob can reverse this order by submitting a transaction on Blockchain A.

  2. Alice accepts Bob's offer by sending a transaction on Blockchain B, referencing Bob’s offer hash and providing her 'Token A address' in the memo field.

  3. The committee updates the recipient of Bob’s sell order to Alice’s "Token A" address, verifying that Alice has enough "aged Token B" in her Blockchain B address.

4. Alice sends "Token B" to Bob, with a memo linking to the 'Request to Sell'.

5. The committee witnesses Alice’s transaction and releases Bob’s "Token A" to Alice.

  1. If Alice does not send "Token B" within N Blockchain B blocks, the committee resets Bob’s 'Request to Sell' recipient.

SellOrder is a structure that holds relevant data to complete a token swap. It's created by a 'request to sell' then populated by an 'intent to buy', and finally closed when the committee witnesses the transfer of funds.

func (*SellOrder) Descriptor deprecated

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

Deprecated: Use SellOrder.ProtoReflect.Descriptor instead.

func (*SellOrder) Empty

func (x *SellOrder) Empty() bool

Empty() indicates whether the sell order is null

func (*SellOrder) GetAmountForSale

func (x *SellOrder) GetAmountForSale() uint64

func (*SellOrder) GetBuyerChainDeadline

func (x *SellOrder) GetBuyerChainDeadline() uint64

func (*SellOrder) GetBuyerReceiveAddress

func (x *SellOrder) GetBuyerReceiveAddress() []byte

func (*SellOrder) GetBuyerSendAddress

func (x *SellOrder) GetBuyerSendAddress() []byte

func (*SellOrder) GetCommittee

func (x *SellOrder) GetCommittee() uint64

func (*SellOrder) GetData

func (x *SellOrder) GetData() []byte

func (*SellOrder) GetId

func (x *SellOrder) GetId() []byte

func (*SellOrder) GetRequestedAmount

func (x *SellOrder) GetRequestedAmount() uint64

func (*SellOrder) GetSellerReceiveAddress

func (x *SellOrder) GetSellerReceiveAddress() []byte

func (*SellOrder) GetSellersSendAddress

func (x *SellOrder) GetSellersSendAddress() []byte

func (SellOrder) MarshalJSON

func (x SellOrder) MarshalJSON() ([]byte, error)

MarshalJSON() is the json.Marshaller implementation for the SellOrder object

func (*SellOrder) ProtoMessage

func (*SellOrder) ProtoMessage()

func (*SellOrder) ProtoReflect

func (x *SellOrder) ProtoReflect() protoreflect.Message

func (*SellOrder) Reset

func (x *SellOrder) Reset()

func (*SellOrder) String

func (x *SellOrder) String() string

func (*SellOrder) UnmarshalJSON

func (x *SellOrder) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() is the json.Unmarshaler implementation for the SellOrder object

type SignByte

type SignByte interface{ SignBytes() []byte }

SignByte is a object that returns canonical bytes to sign

type Signable

type Signable interface {
	proto.Message
	Sign(p crypto.PrivateKeyI) ErrorI
}

Signable is a proto.Message that can be signed using a crypto.PrivateKey

type Signature

type Signature struct {

	// public_key: is a cryptographic code shared openly, used to verify digital signatures
	PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"publicKey"` // @gotags: json:"publicKey"
	// signature: the bytes of the signature output from a private key which may be verified with the message and public
	Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"`
	// contains filtered or unexported fields
}

A Signature is a digital signature is a cryptographic "fingerprint" created with a private key, allowing others to verify the authenticity and integrity of a message using the corresponding public key

func (*Signature) Copy

func (x *Signature) Copy() *Signature

Copy() returns a deep clone of the Signature object

func (*Signature) Descriptor deprecated

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

Deprecated: Use Signature.ProtoReflect.Descriptor instead.

func (*Signature) GetPublicKey

func (x *Signature) GetPublicKey() []byte

func (*Signature) GetSignature

func (x *Signature) GetSignature() []byte

func (Signature) MarshalJSON

func (x Signature) MarshalJSON() ([]byte, error)

MarshalJSON() satisfies the json.Marshaller interface

func (*Signature) ProtoMessage

func (*Signature) ProtoMessage()

func (*Signature) ProtoReflect

func (x *Signature) ProtoReflect() protoreflect.Message

func (*Signature) Reset

func (x *Signature) Reset()

func (*Signature) String

func (x *Signature) String() string

func (*Signature) UnmarshalJSON

func (x *Signature) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() satisfies the json.Unmarshaler interface

type SignatureI

type SignatureI interface {
	proto.Message
	GetPublicKey() []byte
	GetSignature() []byte
}

SignatureI is the model of a signature object (a signature and public key bytes pair)

type SimpleLimiter

type SimpleLimiter struct {
	// contains filtered or unexported fields
}

SimpleLimiter ensures the number of requests don't exceed a total limit and a limit per requester during a timeframe

func NewLimiter

func NewLimiter(maxPerRequester, maxRequests, resetWindowS int, topic string, log LoggerI) *SimpleLimiter

NewLimiter() returns a new instance of SimpleLimiter with - max requests per requester - max total requests - how often to reset the limiter

func (*SimpleLimiter) NewRequest

func (l *SimpleLimiter) NewRequest(requester string) (requesterBlock, totalBlock bool)

NewRequest() processes a new request and checks if the requester or total requests should be blocked

func (*SimpleLimiter) Reset

func (l *SimpleLimiter) Reset()

Reset() clears the requests and resets the total request count

func (*SimpleLimiter) TimeToReset

func (l *SimpleLimiter) TimeToReset() <-chan time.Time

TimeToReset() returns the channel that signals when the limiter may be reset This channel is called by the time.Ticker() set in NewLimiter

type SlashRecipients

type SlashRecipients struct {

	// double_signers: a list of actors who the committee agreed double-signed based on evidence
	DoubleSigners []*DoubleSigner `protobuf:"bytes,1,rep,name=double_signers,json=doubleSigners,proto3" json:"doubleSigners"` // @gotags: json:"doubleSigners"
	// contains filtered or unexported fields
}

SlashRecipients is the list of recipients who are penalized based on misbehavior, like double signing or bad proposing based on a committee agreement confirmed in a Quorum Certificate

func (*SlashRecipients) CheckBasic

func (x *SlashRecipients) CheckBasic() (err ErrorI)

CheckBasic() validates the ProposalMeta structure

func (*SlashRecipients) Descriptor deprecated

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

Deprecated: Use SlashRecipients.ProtoReflect.Descriptor instead.

func (*SlashRecipients) Equals

func (x *SlashRecipients) Equals(y *SlashRecipients) bool

Equals() compares two SlashRecipients for equality

func (*SlashRecipients) GetDoubleSigners

func (x *SlashRecipients) GetDoubleSigners() []*DoubleSigner

func (SlashRecipients) MarshalJSON

func (x SlashRecipients) MarshalJSON() ([]byte, error)

MarshalJSON() satisfies the json.Marshaller interface

func (*SlashRecipients) ProtoMessage

func (*SlashRecipients) ProtoMessage()

func (*SlashRecipients) ProtoReflect

func (x *SlashRecipients) ProtoReflect() protoreflect.Message

func (*SlashRecipients) Reset

func (x *SlashRecipients) Reset()

func (*SlashRecipients) String

func (x *SlashRecipients) String() string

func (*SlashRecipients) UnmarshalJSON

func (x *SlashRecipients) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() satisfies the json.Unmarshaler interface

type SortitionData

type SortitionData struct {
	LastProposerAddresses [][]byte // the last N proposers addresses prevents any grinding attacks
	RootHeight            uint64   // the height of the root (optional) ensures leader rotation in a chain halt
	Height                uint64   // the height ensures unique proposer selection for each height
	Round                 uint64   // the round ensures unique proposer selection for each round
	TotalValidators       uint64   // the count of validators in the set
	TotalPower            uint64   // the total power of all validators in the set
	VotingPower           uint64   // the amount of voting power the node has
}

SortitionData is the seed data for the IsCandidate and VRF functions

type StateMachineConfig

type StateMachineConfig struct{}

StateMachineConfig is an empty placeholder

func DefaultStateMachineConfig

func DefaultStateMachineConfig() StateMachineConfig

DefaultStateMachineConfig returns an empty object

type StoreConfig

type StoreConfig struct {
	DataDirPath    string `json:"dataDirPath"`    // path of the designated folder where the application stores its data
	DBName         string `json:"dbName"`         // name of the database
	IndexByAccount bool   `json:"indexByAccount"` // index transactions by account
	InMemory       bool   `json:"inMemory"`       // non-disk database, only for testing
	// recommended range: 500-2000 for optimal performance. Values below 500 increase disk I/O
	// by several orders of magnitude, reducing performance and accelerating disk degradation during
	// sync. Lower values also increase the risk of data loss due to a pebble issue where batches are
	// returned before commit completion when compaction runs concurrently with commits.
	LSSCompactionInterval uint64 `json:"lssCompactionInterval"` // interval for compacting latest store data
}

StoreConfig is user configurations for the key value database

func DefaultStoreConfig

func DefaultStoreConfig() StoreConfig

DefaultStoreConfig() returns the developer recommended store configuration

type StoreI

type StoreI interface {
	RWStoreI                                     // reading and writing
	ProveStoreI                                  // proving membership / non-membership
	RWIndexerI                                   // reading and writing indexer
	NewTxn() StoreI                              // wrap the store in a discardable nested store
	Root() ([]byte, ErrorI)                      // get the merkle root from the store
	DB() *pebble.DB                              // retrieve the underlying pebble db
	Version() uint64                             // access the height of the store
	Copy() (StoreI, ErrorI)                      // make a clone of the store
	NewReadOnly(version uint64) (StoreI, ErrorI) // historical read only version of the store
	Commit() (root []byte, err ErrorI)           // save the store and increment the height
	Discard()                                    // discard the underlying writer
	Reset()                                      // reset the underlying writer
	Close() ErrorI                               // gracefully stop the database
	Flush() ErrorI                               // flush all operations to the underlying 'writer' without committing
	IncreaseVersion()                            // increment the version of the store
}

StoreI defines the interface for interacting with blockchain storage

type StoreMetrics

type StoreMetrics struct {
	DBPartitionTime      prometheus.Histogram // how long does the db partition take?
	DBFlushPartitionTime prometheus.Histogram // how long does the db partition flush take?
	DBPartitionEntries   prometheus.Gauge     // how many entries in the partition batch?
	DBPartitionSize      prometheus.Gauge     // how big is the partition batch?
	DBCommitTime         prometheus.Histogram // how long does the db commit take?
	DBCommitEntries      prometheus.Gauge     // how many entries in the commit batch?
	DBCommitSize         prometheus.Gauge     // how big is the commit batch?
}

StoreMetrics represents the telemetry of the 'store' package

type StringWrapper

type StringWrapper struct {

	// value: the underlying string value
	Value string `protobuf:"bytes,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _

StringWrapper is a protobuf wrapper around a string primitive

func (*StringWrapper) Descriptor deprecated

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

Deprecated: Use StringWrapper.ProtoReflect.Descriptor instead.

func (*StringWrapper) GetValue

func (x *StringWrapper) GetValue() string

func (*StringWrapper) ProtoMessage

func (*StringWrapper) ProtoMessage()

func (*StringWrapper) ProtoReflect

func (x *StringWrapper) ProtoReflect() protoreflect.Message

func (*StringWrapper) Reset

func (x *StringWrapper) Reset()

func (*StringWrapper) String

func (x *StringWrapper) String() string

type Topic

type Topic int32

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ Topic: an identifier used to organize and manage different streams of data within a single communication channel It allows multiple, independent message streams to be handled simultaneously over the same connection It's ordered by stream priority IMPORTANT: if adding a new topic remember to also add it to the select statement in startSendService() in p2p/conn.go

const (
	// CONSENSUS: topic for the BFT process
	Topic_CONSENSUS Topic = 0
	// BLOCK: topic for an inbound block and certificate
	Topic_BLOCK Topic = 1
	// BLOCK_REQUEST: topic for a peer requesting a certain block and certificate
	Topic_BLOCK_REQUEST Topic = 2
	// TX: topic for an inbound transaction
	Topic_TX Topic = 3
	// PEERS_RESPONSE: topic for a response to a peer exchange request
	Topic_PEERS_RESPONSE Topic = 4
	// PEERS_REQUEST: topic a peer requesting an exchange of book peers
	Topic_PEERS_REQUEST Topic = 5
	// INVALID: topic to mark the exclusive end of valid topics
	Topic_INVALID Topic = 6
)

func (Topic) Descriptor

func (Topic) Descriptor() protoreflect.EnumDescriptor

func (Topic) Enum

func (x Topic) Enum() *Topic

func (Topic) EnumDescriptor deprecated

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

Deprecated: Use Topic.Descriptor instead.

func (Topic) Number

func (x Topic) Number() protoreflect.EnumNumber

func (Topic) String

func (x Topic) String() string

func (Topic) Type

func (Topic) Type() protoreflect.EnumType

type Transaction

type Transaction struct {

	// message_type: The type of the transaction like 'send' or 'stake'
	MessageType string `protobuf:"bytes,1,opt,name=message_type,json=messageType,proto3" json:"messageType"` // @gotags: json:"messageType"
	// msg: The actual transaction message payload, which is encapsulated in a generic message format
	Msg *anypb.Any `protobuf:"bytes,2,opt,name=msg,proto3" json:"msg,omitempty"`
	// signature: The cryptographic signature used to verify the authenticity of the transaction
	Signature *Signature `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
	// created_height: The height when the transaction was created - allows 'safe pruning'
	CreatedHeight uint64 `protobuf:"varint,4,opt,name=created_height,json=createdHeight,proto3" json:"createdHeight"` // @gotags: json:"createdHeight"
	// time: The timestamp when the transaction was created - used as temporal entropy to prevent hash collisions in txs
	Time uint64 `protobuf:"varint,5,opt,name=time,proto3" json:"time,omitempty"`
	// fee: The fee associated with processing the transaction
	Fee uint64 `protobuf:"varint,6,opt,name=fee,proto3" json:"fee,omitempty"`
	// memo: An optional message or note attached to the transaction
	Memo string `protobuf:"bytes,7,opt,name=memo,proto3" json:"memo,omitempty"`
	// network_id: The identity of the network the transaction is intended for
	NetworkId uint64 `protobuf:"varint,8,opt,name=network_id,json=networkId,proto3" json:"networkID"` // @gotags: json:"networkID"
	// chain_id: The identity of the committee the transaction is intended for
	ChainId uint64 `protobuf:"varint,9,opt,name=chain_id,json=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// contains filtered or unexported fields
}

***************************************************************************************************** This file is auto-generated from source files in `/lib/.proto/*` using Protocol Buffers (protobuf)

Protobuf is a language-neutral, platform-neutral serialization format. It allows users to define objects in a way that’s both efficient to store and fast to transmit over the network. These definitions are compiled into code that *enables different systems and programming languages to communicate in a byte-perfect manner*

To update these structures, make changes to the source .proto files, then recompile to regenerate this file. These auto-generated files are easily recognized by checking for a `.pb.go` ending ***************************************************************************************************** _ _ _ Transaction represents a request or action submitted to the network like transfer assets or perform other operations within the blockchain system

func (*Transaction) CheckBasic

func (x *Transaction) CheckBasic() ErrorI

CheckBasic() is a stateless validation function for a Transaction object

func (*Transaction) Descriptor deprecated

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

Deprecated: Use Transaction.ProtoReflect.Descriptor instead.

func (*Transaction) GetChainId

func (x *Transaction) GetChainId() uint64

func (*Transaction) GetCreatedHeight

func (x *Transaction) GetCreatedHeight() uint64

func (*Transaction) GetFee

func (x *Transaction) GetFee() uint64

func (*Transaction) GetHash

func (x *Transaction) GetHash() ([]byte, ErrorI)

GetHash() returns the cryptographic hash of the Transaction

func (*Transaction) GetMemo

func (x *Transaction) GetMemo() string

func (*Transaction) GetMessageType

func (x *Transaction) GetMessageType() string

func (*Transaction) GetMsg

func (x *Transaction) GetMsg() *anypb.Any

func (*Transaction) GetNetworkId

func (x *Transaction) GetNetworkId() uint64

func (*Transaction) GetSig

func (x *Transaction) GetSig() SignatureI

GetSig() accessor for signature field (do not delete: needed to satisfy TransactionI)

func (*Transaction) GetSignBytes

func (x *Transaction) GetSignBytes() ([]byte, ErrorI)

GetSignBytes() returns the canonical byte representation of the Transaction for signing and signature verification

func (*Transaction) GetSignature

func (x *Transaction) GetSignature() *Signature

func (*Transaction) GetTime

func (x *Transaction) GetTime() uint64

func (Transaction) MarshalJSON

func (x Transaction) MarshalJSON() (jsonBytes []byte, err error)

MarshalJSON() implements the json.Marshaller interface for the Transaction type

func (*Transaction) ProtoMessage

func (*Transaction) ProtoMessage()

func (*Transaction) ProtoReflect

func (x *Transaction) ProtoReflect() protoreflect.Message

func (*Transaction) Reset

func (x *Transaction) Reset()

func (*Transaction) Sign

func (x *Transaction) Sign(pk crypto.PrivateKeyI) (err ErrorI)

Sign() executes a digital signature on the transaction

func (*Transaction) String

func (x *Transaction) String() string

func (*Transaction) UnmarshalJSON

func (x *Transaction) UnmarshalJSON(jsonBytes []byte) (err error)

MarshalJSON() implements the json.Unmarshaler interface for the Transaction type

type TransactionI

type TransactionI interface {
	proto.Message
	GetMsg() *anypb.Any             // message payload (send, stake, edit-stake, etc.)
	GetSig() SignatureI             // digital signature allowing public key verification
	GetTime() uint64                // a stateless - prune friendly, replay attack / hash collision defense (opposed to sequence)
	GetSignBytes() ([]byte, ErrorI) // the canonical form the bytes were signed in
	GetHash() ([]byte, ErrorI)      // the computed cryptographic hash of the transaction bytes
	GetMemo() string                // an optional 100 character descriptive string - these are often used for polling
}

TransactionI is the model of a transaction object (a record of an action or event)

type TxMessage

type TxMessage struct {

	// chain_id: is the unique identifier of the committee associated with this message
	ChainId uint64 `protobuf:"varint,1,opt,name=chain_id,json=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// txs: is the bytes of the transactions that may be unmarshalled into a Transaction object
	Txs [][]byte `protobuf:"bytes,2,rep,name=txs,proto3" json:"txs,omitempty"`
	// contains filtered or unexported fields
}

TxMessage is a p2p message payload that is an inbound transaction to be processed by the blockchain's FSM and saved in that chains mempool

func (*TxMessage) Descriptor deprecated

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

Deprecated: Use TxMessage.ProtoReflect.Descriptor instead.

func (*TxMessage) GetChainId

func (x *TxMessage) GetChainId() uint64

func (*TxMessage) GetTxs

func (x *TxMessage) GetTxs() [][]byte

func (*TxMessage) ProtoMessage

func (*TxMessage) ProtoMessage()

func (*TxMessage) ProtoReflect

func (x *TxMessage) ProtoReflect() protoreflect.Message

func (*TxMessage) Reset

func (x *TxMessage) Reset()

func (*TxMessage) String

func (x *TxMessage) String() string

type TxResult

type TxResult struct {

	// sender: The address of the user sending the transaction
	Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"`
	// recipient: The address of the user receiving the transaction
	Recipient []byte `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"`
	// message_type: The type of the transaction like 'send' or 'stake'
	MessageType string `protobuf:"bytes,3,opt,name=message_type,json=messageType,proto3" json:"messageType"` // @gotags: json:"messageType"
	// height: The block height at which the transaction was included
	Height uint64 `protobuf:"varint,4,opt,name=height,proto3" json:"height,omitempty"`
	// index: The position of the transaction within the block
	Index uint64 `protobuf:"varint,5,opt,name=index,proto3" json:"index,omitempty"`
	// transaction: The original transaction object
	Transaction *Transaction `protobuf:"bytes,6,opt,name=transaction,proto3" json:"transaction,omitempty"`
	// tx_hash: The unique hash that identifies the transaction
	TxHash string `protobuf:"bytes,7,opt,name=tx_hash,json=txHash,proto3" json:"txHash"` // @gotags: json:"txHash"
	// contains filtered or unexported fields
}

TxResult represents the result of a processed transaction, including information about the sender, recipient, transaction hash, and the associated block height and index.

func (*TxResult) Descriptor deprecated

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

Deprecated: Use TxResult.ProtoReflect.Descriptor instead.

func (*TxResult) GetHeight

func (x *TxResult) GetHeight() uint64

func (*TxResult) GetIndex

func (x *TxResult) GetIndex() uint64

func (*TxResult) GetMessageType

func (x *TxResult) GetMessageType() string

func (*TxResult) GetRecipient

func (x *TxResult) GetRecipient() []byte

func (*TxResult) GetSender

func (x *TxResult) GetSender() []byte

func (*TxResult) GetTransaction

func (x *TxResult) GetTransaction() *Transaction

func (*TxResult) GetTx

func (x *TxResult) GetTx() TransactionI

GetTx() is an accessor for the Transaction field

func (*TxResult) GetTxHash

func (x *TxResult) GetTxHash() string

func (TxResult) MarshalJSON

func (x TxResult) MarshalJSON() ([]byte, error)

MarshalJSON() satisfies the json.Marshaller interface

func (*TxResult) ProtoMessage

func (*TxResult) ProtoMessage()

func (*TxResult) ProtoReflect

func (x *TxResult) ProtoReflect() protoreflect.Message

func (*TxResult) Reset

func (x *TxResult) Reset()

func (*TxResult) String

func (x *TxResult) String() string

func (*TxResult) UnmarshalJSON

func (x *TxResult) UnmarshalJSON(jsonBytes []byte) (err error)

UnmarshalJSON() satisfies the json.Unmarshaler interface

type TxResultI

type TxResultI interface {
	proto.Message
	GetSender() []byte      // the sender of the transaction
	GetRecipient() []byte   // the receiver of the transaction (i.e. the recipient of a 'send' transaction; empty of not applicable)
	GetMessageType() string // the type of message the transaction contains
	GetHeight() uint64      // the block number the transaction is included in
	GetIndex() uint64       // the index of the transaction in the block
	GetTxHash() string      // the cryptographic hash of the transaction
	GetTx() TransactionI
}

TxResultI is the model of a completed transaction object after execution

type TxResults

type TxResults []*TxResult

func (*TxResults) Len

func (t *TxResults) Len() int

func (*TxResults) New

func (t *TxResults) New() Pageable

type UInt64Wrapper

type UInt64Wrapper struct {

	// value: the underlying uint64 value
	Value uint64 `protobuf:"varint,1,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

UInt64Wrapper is a protobuf wrapper around a string primitive

func (*UInt64Wrapper) Descriptor deprecated

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

Deprecated: Use UInt64Wrapper.ProtoReflect.Descriptor instead.

func (*UInt64Wrapper) GetValue

func (x *UInt64Wrapper) GetValue() uint64

func (*UInt64Wrapper) ProtoMessage

func (*UInt64Wrapper) ProtoMessage()

func (*UInt64Wrapper) ProtoReflect

func (x *UInt64Wrapper) ProtoReflect() protoreflect.Message

func (*UInt64Wrapper) Reset

func (x *UInt64Wrapper) Reset()

func (*UInt64Wrapper) String

func (x *UInt64Wrapper) String() string

type VDFService

type VDFService struct {
	TargetTime time.Duration // the desired completion time of a VDF run, overages are expected, so add 'breathing room'
	Iterations int           // number of iterations the VDF will currently Run()
	Results    crypto.VDF    // the results from the previous VDF run
	// contains filtered or unexported fields
}

VDFService is a structure that wraps Verifiable Delay Functionality Verifiable Delay Function (VDF) is a cryptographic algorithm that requires a specific, non-parallelizable amount of time to compute, while its result can be quickly and easily verified Here's how it works:

  • VDFService.Run() runs the VDF for a pre-defined number of iterations
  • There's two paths: Success and Interrupt, either path results in an adjustment in the number of iterations based on ProcessingTime (how long it took) vs TargetTime (the desired completion time)
  • - The success path is a non-interrupted VDF run. This run results in a populated VDFResults object
  • - The interrupt path is a premature exit VDF run that has an empty VDFResults object

The VDF is designed to handle a single call to Run() always followed by a single call to Finish()

func NewVDFService

func NewVDFService(targetTime time.Duration, log LoggerI) (vdf *VDFService)

NewVDFService() creates a new instance of the VDF service

func (*VDFService) Finish

func (vdf *VDFService) Finish() (results *crypto.VDF)

Finish() signals the service to complete and returns the output - already running signals a stop in the running thread and returns - not running returns

func (*VDFService) Run

func (vdf *VDFService) Run(seed []byte)

Run() *blocking call*: generates a VDF proof using the current params state of the VDF Service object The design is to save the results

func (*VDFService) VerifyVDF

func (vdf *VDFService) VerifyVDF(seed []byte, results *crypto.VDF) bool

VerifyVDF() verifies the VDF using the seed, the proof, and the number of iterations

type ValidatorFilters

type ValidatorFilters struct {
	Unstaking FilterOption `json:"unstaking"` // validators are currently unstaking
	Paused    FilterOption `json:"paused"`    // validators are currently paused
	Delegate  FilterOption `json:"delegate"`  // validators are set as delegates
	Committee uint64       `json:"committee"` // validators are staked for this chain id (committee id)
}

ValidatorFilters are used to filter types of validators from a ValidatorPage

func (ValidatorFilters) On

func (v ValidatorFilters) On() bool

On() returns whether there exists any filters

type ValidatorSet

type ValidatorSet struct {
	ValidatorSet  *ConsensusValidators   // a list of validators participating in the consensus process
	MultiKey      crypto.MultiPublicKeyI // a composite public key derived from the individual public keys of all validators, used for verifying multi-signatures
	TotalPower    uint64                 // the aggregate voting power of all validators in the set, reflecting their influence on the consensus
	MinimumMaj23  uint64                 // the minimum voting power threshold required to achieve a two-thirds majority (2f+1), essential for consensus decisions
	NumValidators uint64                 // the total number of validators in the set, indicating the size of the validator pool
}

ValidatorSet represents a collection of validators responsible for consensus It facilitates the creation and validation of +2/3 Majority agreements using multi-signatures

func (*ValidatorSet) GetValidator

func (vs *ValidatorSet) GetValidator(publicKey []byte) (val *ConsensusValidator, err ErrorI)

GetValidator() retrieves a validator from the ValidatorSet using the public key

func (*ValidatorSet) GetValidatorAndIdx

func (vs *ValidatorSet) GetValidatorAndIdx(targetPublicKey []byte) (val *ConsensusValidator, idx int, err ErrorI)

GetValidatorAndIdx() retrieves a validator and its index in the ValidatorSet using the public key

type View

type View struct {

	// the unique identifier of the blockchain network
	NetworkId uint64 `protobuf:"varint,1,opt,name=network_id,json=networkId,proto3" json:"networkID"` // @gotags: json:"networkID"
	// the unique identifier of the committee within the blockchain network
	ChainId uint64 `protobuf:"varint,2,opt,name=chain_id,json=chainId,proto3" json:"chainID"` // @gotags: json:"chainID"
	// the height or number of committed blocks in the blockchain
	Height uint64 `protobuf:"varint,3,opt,name=height,proto3" json:"height,omitempty"`
	// the root blockchain height also the height that the committee validator set may be verified
	RootHeight uint64 `protobuf:"varint,4,opt,name=root_height,json=rootHeight,proto3" json:"rootHeight"` // @gotags: json:"rootHeight"
	// each height consists of one or more `rounds` which is a step within the consensus protocol where
	// a new Proposer is selected to lead the validators to agree on the next block if they fail, the
	// round is incremented, more time is granted for consensus timeouts, and the cycle starts over
	Round uint64 `protobuf:"varint,5,opt,name=round,proto3" json:"round,omitempty"`
	// represents the smallest unit in the consensus process. Each round consists of multiple phases, and these phases are
	// executed sequentially to achieve consensus on the next block.
	// ELECTION->ELECTION-VOTE->PROPOSE->PROPOSE-VOTE->PRECOMMIT->PRECOMMIT-VOTE->COMMIT->COMMIT-PROCESS
	Phase Phase `protobuf:"varint,6,opt,name=phase,proto3,enum=types.Phase" json:"phase,omitempty"`
	// contains filtered or unexported fields
}

A View is a specific point in the consensus process; think of it like a snapshot of the consensus process at a certain point in time. A View comprises of:

1) Network ID and chain id: These identifiers uniquely define the BFT instance, distinguishing different networks and the committees within them

2) Height and Canopy Height: For each BFT instance, the height increases with every new block produced, and the canopy height when a canopy block is produced.

3) Round: Each height comprises of 1 or more rounds. A round increments when no block is produced but resets to zero at a new height.

3) Phase: Each round consists of a fixed number of phases. Phases progress within the round and either end with the successful production of a block or quit prematurely due to an error.

func (*View) Check

func (x *View) Check(view *View, enforceHeights bool) ErrorI

Check() checks the validity of the view and optionally enforce *heights* (plugin height and committee height)

func (*View) CheckBasic

func (x *View) CheckBasic() (err ErrorI)

func (*View) Copy

func (x *View) Copy() *View

Copy() returns a reference to a clone of the View

func (*View) Descriptor deprecated

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

Deprecated: Use View.ProtoReflect.Descriptor instead.

func (*View) Equals

func (x *View) Equals(v *View) bool

Equals() returns true if this view is equal to the parameter view nil views are always false

func (*View) GetChainId

func (x *View) GetChainId() uint64

func (*View) GetHeight

func (x *View) GetHeight() uint64

func (*View) GetNetworkId

func (x *View) GetNetworkId() uint64

func (*View) GetPhase

func (x *View) GetPhase() Phase

func (*View) GetRootHeight

func (x *View) GetRootHeight() uint64

func (*View) GetRound

func (x *View) GetRound() uint64

func (*View) Less

func (x *View) Less(v *View) bool

Less() returns true if this View is less than the parameter View

func (View) MarshalJSON

func (x View) MarshalJSON() ([]byte, error)

MarshalJSON() implements the json.Marshaller interface

func (*View) ProtoMessage

func (*View) ProtoMessage()

func (*View) ProtoReflect

func (x *View) ProtoReflect() protoreflect.Message

func (*View) Reset

func (x *View) Reset()

func (*View) String

func (x *View) String() string

func (*View) ToString

func (x *View) ToString() string

ToString() returns the log string format of View

func (*View) UnmarshalJSON

func (x *View) UnmarshalJSON(jsonBytes []byte) (err error)

MarshalJSON() implements the json.Marshaller interface

type WIndexerI

type WIndexerI interface {
	IndexQC(qc *QuorumCertificate) ErrorI                          // save a quorum certificate by height
	IndexTx(result *TxResult) ErrorI                               // save a tx by hash, height.index, sender, and recipient
	IndexBlock(b *BlockResult) ErrorI                              // save a block by hash and height
	IndexDoubleSigner(address []byte, height uint64) ErrorI        // save a double signer for a height
	IndexCheckpoint(chainId uint64, checkpoint *Checkpoint) ErrorI // save a checkpoint for a committee chain
	DeleteTxsForHeight(height uint64) ErrorI                       // deletes all transactions for a height
	DeleteBlockForHeight(height uint64) ErrorI                     // deletes a block and transaction data for a height
	DeleteQCForHeight(height uint64) ErrorI                        // deletes a certificate for a height
}

WIndexerI defines the write interface for the indexing operations

type WStoreI

type WStoreI interface {
	Set(key, value []byte) ErrorI // set value bytes referenced by key bytes
	Delete(key []byte) ErrorI
}

WStoreI defines an interface for basic write operations

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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