types

package
v0.0.1-pre-alpha.1 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CodeEmptyTransactionError Code = 2

	CodeNewAddressFromBytesError Code = 9

	CodeHexDecodeFromStringError     Code = 11
	CodeInvalidHashLengthError       Code = 12
	CodeEmptyNetworkIDError          Code = 13
	CodeEmptyProposerError           Code = 14
	CodeEmptyTimestampError          Code = 15
	CodeInvalidTransactionCountError Code = 16
	CodeEmptyAccountError            Code = 17
	CodeNilPoolError                 Code = 18
	CodeEmptyNameError               Code = 19
	CodeEmptyAddressError            Code = 20
	CodeInvalidAddressLenError       Code = 21

	CodeInvalidAmountError  Code = 23
	CodeProtoMarshalError   Code = 25
	CodeProtoUnmarshalError Code = 26
	CodeProtoNewAnyError    Code = 27

	CodeDuplicateTransactionError Code = 35

	CodeGetAllValidatorsError Code = 37

	CodeStringToBigIntError Code = 40

	CodeUpdateParamError Code = 88

	CodeInitParamsError         Code = 96
	CodeGetAllFishermenError    Code = 97
	CodeGetAllServiceNodesError Code = 98
	CodeGetAllAppsError         Code = 99

	CodeGetAllPoolsError          Code = 107
	CodeGetAllAccountsError       Code = 108
	CodeGetAllParamsError         Code = 109
	CodeInsufficientAmountError   Code = 41
	CodeNegativeAmountError       Code = 118
	CodeNilQuorumCertificateError Code = 119

	EmptyTransactionError = "the transaction is empty"

	StringToBigIntError = "an error occurred converting the string primitive to big.Int, the conversion was unsuccessful with base 10"

	GetAllValidatorsError = "an error occurred getting all validators from the state"

	InvalidAmountError = "the amount field is invalid; cannot be converted to big.Int"

	InvalidAddressLenError = "the length of the address is not valid"
	EmptyAddressError      = "the address field is empty"
	EmptyNameError         = "the name field is empty"
	NilPoolError           = "the pool is nil"
	EmptyAccountError      = "the account is nil"

	NewAddressFromBytesError     = "unable to convert the raw bytes to a valid address"
	InvalidTransactionCountError = "the total transactions are less than the block transactions"
	EmptyTimestampError          = "the timestamp field is empty"
	EmptyProposerError           = "the proposer field is empty"
	EmptyNetworkIDError          = "the network id field is empty"
	InvalidHashLengthError       = "the length of the hash is not the correct size"
	NilQuorumCertificateError    = "the quorum certificate is nil"

	HexDecodeFromStringError = "an error occurred decoding the string into hex bytes"
	ProtoMarshalError        = "an error occurred marshalling the structure in protobuf"
	ProtoUnmarshalError      = "an error occurred unmarshalling the structure in protobuf"
	ProtoNewAnyError         = "an error occurred creating the protobuf any"

	UpdateParamError = "an error occurred updating the parameter"

	InitParamsError           = "an error occurred initializing the params in genesis"
	GetAllFishermenError      = "an error occurred getting all of the fishermen¬"
	GetAllAppsError           = "an error occurred getting all of the apps"
	GetAllServiceNodesError   = "an error occurred getting all of the service nodes"
	GetAllPoolsError          = "an error occurred getting all of the pools"
	GetAllAccountsError       = "an error occurred getting all of the accounts"
	GetAllParamsError         = "an error occurred getting all of the params"
	DuplicateTransactionError = "the transaction is already found in the mempool"
	InsufficientAmountError   = "the account has insufficient funds to complete the operation"
	NegativeAmountError       = "the amount is negative"
)
View Source
const (
	CodeOK                         Code = 0
	CodeInvalidSignerError         Code = 3
	CodeDecodeMessageError         Code = 4
	CodeUnmarshalTransaction       Code = 5
	CodeUnknownMessageError        Code = 6
	CodeAppHashError               Code = 7
	CodeNewPublicKeyFromBytesError Code = 8

	CodeSignatureVerificationFailedError Code = 10

	CodeInvalidNonceError Code = 22

	CodeProtoFromAnyError     Code = 28
	CodeNewFeeFromStringError Code = 29
	CodeEmptyNonceError       Code = 30
	CodeEmptyPublicKeyError   Code = 31
	CodeEmptySignatureError   Code = 32

	CodeTransactionSignError Code = 36

	CodeInterfaceConversionError Code = 38
	CodeGetAccountAmountError    Code = 39

	CodeAddAccountAmountError             Code = 42
	CodeSetAccountError                   Code = 43
	CodeGetParamError                     Code = 44
	CodeMinimumStakeError                 Code = 45
	CodeEmptyRelayChainError              Code = 46
	CodeEmptyRelayChainsError             Code = 47
	CodeInvalidRelayChainLengthError      Code = 48
	CodeNilOutputAddress                  Code = 49
	CodeInvalidPublicKeyLenError          Code = 50
	CodeEmptyAmountError                  Code = 51
	CodeMaxChainsError                    Code = 52
	CodeInsertError                       Code = 53
	CodeInvalidStatusError                Code = 54
	CodeAddPoolAmountError                Code = 55
	CodeSubPoolAmountError                Code = 56
	CodeGetStatusError                    Code = 57
	CodeSetUnstakingHeightAndStatusError  Code = 58
	CodeGetReadyToUnstakeError            Code = 59
	CodeAlreadyExistsError                Code = 60
	CodeGetExistsError                    Code = 61
	CodeGetLatestHeightError              Code = 62
	CodeDeleteError                       Code = 63
	CodeGetPauseHeightError               Code = 64
	CodeAlreadyPausedError                Code = 65
	CodeSetPauseHeightError               Code = 66
	CodeNotPausedError                    Code = 67
	CodeNotReadyToUnpauseError            Code = 68
	CodeSetStatusPausedBeforeError        Code = 69
	CodeInvalidServiceUrlError            Code = 70
	CodeNotExistsError                    Code = 71
	CodeGetMissedBlocksError              Code = 72
	CodeEmptyHashError                    Code = 73
	CodeInvalidBlockheightError           Code = 74
	CodeUnequalPublicKeysError            Code = 75
	CodeUnequalVoteTypesError             Code = 76
	CodeEqualVotesError                   Code = 77
	CodeUnequalRoundsError                Code = 78
	CodeMaxEvidenceAgeError               Code = 79
	CodeGetValidatorStakedTokensError     Code = 80
	CodeSetValidatorStakedTokensError     Code = 81
	CodeSetPoolAmountError                Code = 82
	CodeGetPoolAmountError                Code = 83
	CodeInvalidProposerCutPercentageError Code = 84
	CodeUnknownParamError                 Code = 85
	CodeUnauthorizedParamChangeError      Code = 86
	CodeInvalidParamValueError            Code = 87

	CodeGetServiceNodesPerSessionAtError Code = 89
	CodeGetBlockHashError                Code = 90
	CodeGetServiceNodeCountError         Code = 91
	CodeEmptyParamKeyError               Code = 92
	CodeEmptyParamValueError             Code = 93
	CodeGetOutputAddressError            Code = 94
	CodeTransactionAlreadyCommittedError Code = 95

	CodeNewPersistenceContextError Code = 100
	CodeGetAppHashError            Code = 101
	CodeNewSavePointError          Code = 102
	CodeRollbackSavePointError     Code = 103
	CodeResetContextError          Code = 104
	CodeCommitContextError         Code = 105
	CodeReleaseContextError        Code = 106

	CodeSetPoolError             Code = 110
	CodeDuplicateSavePointError  Code = 111
	CodeSavePointNotFoundError   Code = 112
	CodeEmptySavePointsError     Code = 113
	CodeInvalidEvidenceTypeError Code = 114
	CodeExportStateError         Code = 115
	CodeUnequalHeightsError      Code = 116
	CodeSetMissedBlocksError     Code = 117

	CodeMissingRequiredArgError    Code = 118 // TODO(derrandz): revisit whether this is needed
	CodeSocketRequestTimedOutError Code = 119
	CodeUndefinedSocketTypeError   Code = 120
	CodePeerHangUpError            Code = 121
	CodeUnexpectedSocketError      Code = 122
	CodePayloadTooBigError         Code = 123
	CodeSocketIOStartFailedError   Code = 124

	GetValidatorStakedTokensError     = "an error occurred getting the validator staked tokens"
	SetValidatorStakedTokensError     = "an error occurred setting the validator staked tokens"
	EqualVotesError                   = "the votes are identical and not equivocating"
	UnequalRoundsError                = "the round numbers are not equal"
	UnequalVoteTypesError             = "the vote types are not equal"
	UnequalPublicKeysError            = "the two public keys are not equal"
	GetMissedBlocksError              = "an error occurred getting the missed blocks field"
	DecodeMessageError                = "unable to decode the message"
	NotExistsError                    = "the actor does not exist in the state"
	InvalidServiceUrlError            = "the service url is not valid"
	NotReadyToUnpauseError            = "the actor isn't ready to unpause as the minimum number of blocks hasn't passed since pausing"
	NotPausedError                    = "the actor is not paused"
	SetPauseHeightError               = "an error occurred setting the pause height"
	AlreadyPausedError                = "the actor is already paused"
	GetPauseHeightError               = "an error occurred getting the pause height"
	UnmarshalTransactionError         = "an error occurred decoding the transaction"
	DeleteError                       = "an error occurred when deleting the actor"
	AlreadyExistsError                = "the actor already exists in the state"
	GetExistsError                    = "an error occurred when checking if already exists"
	GetReadyToUnstakeError            = "an error occurred getting the 'ready to unstake' group"
	GetLatestHeightError              = "an error occurred getting the latest height"
	SetUnstakingHeightAndStatus       = "an error occurred setting the unstaking height and status"
	GetStatusError                    = "an error occurred getting the staking status"
	InvalidStatusError                = "the staking status is not valid"
	InsertError                       = "an error occurred inserting into persistence"
	MaxChainsError                    = "the amount chains exceeds the maximum value"
	InvalidPublicKeyLenError          = "the public key length is not valid"
	EmptyAmountError                  = "the amount field is empty"
	NilOutputAddressError             = "the output address is nil"
	InvalidRelayChainLengthError      = "the relay chain id length is invalid"
	EmptyRelayChainError              = "the relay chain id is empty"
	EmptyRelayChainsError             = "the relay chains are nil or empty"
	MinimumStakeError                 = "an error occurred because the amount specified is less than the minimum stake"
	GetParamError                     = "an error occurred getting the parameter"
	SetAccountError                   = "an error occurred setting the account"
	AddAccountAmountError             = "an error occurred adding the amount to the account balance"
	AddPoolAmountError                = "an error occurred adding to the pool"
	SubPoolAmountError                = "an error occurred subtracting from the pool"
	SetPoolAmountError                = "an error occurred setting the pool amount"
	GetPoolAmountError                = "an error occurred getting the pool amount"
	InvalidSignerError                = "the signer of the message is not a proper candidate"
	GetAccountAmountError             = "an error occurred getting the account amount"
	UnknownMessageError               = "the message type is unrecognized"
	AppHashError                      = "an error occurred generating the apphash"
	InvalidNonceError                 = "the nonce field is invalid; cannot be converted to big.Int"
	NewPublicKeyFromBytesError        = "unable to convert the raw bytes to a valid public key"
	SignatureVerificationFailedError  = "the public key / signature combination is not valid for the msg"
	ProtoFromAnyError                 = "an error occurred getting the structure from the protobuf any"
	NewFeeFromStringError             = "the fee string is unable to be converted to a valid base 10 number"
	EmptyNonceError                   = "the nonce in the transaction is empty"
	EmptyPublicKeyError               = "the public key field is empty"
	EmptySignatureError               = "the signature field is empty"
	TransactionSignError              = "an error occurred signing the transaction"
	InterfaceConversionError          = "an error occurred converting the interface to an expected type: "
	SetStatusPausedBeforeError        = "an error occurred setting the actor status that were paused before"
	EmptyHashError                    = "the hash is empty"
	InvalidBlockHeightError           = "the block height field is not valid"
	MaxEvidenceAgeError               = "the evidence is too old to be processed"
	InvalidProposerCutPercentageError = "the proposer cut percentage is larger than 100"
	UnknownParamError                 = "the param name is not found in the acl"
	UnauthorizedParamChangeError      = "unauthorized param change, the signer must be address: "
	InvalidParamValueError            = "the param value is not the expected type"
	GetBlockHashError                 = "an error occurred getting the block hash"
	GetServiceNodesPerSessionAtError  = "an error occurred getting the service nodes per session for height"
	GetServiceNodeCountError          = "an error occurred getting the service node count"
	EmptyParamKeyError                = "the parameter key is empty"
	EmptyParamValueError              = "the parameter value is empty"
	GetOutputAddressError             = "an error occurred getting the output address using operator"
	TransactionAlreadyCommittedError  = "the transaction is already committed"
	NewSavePointError                 = "an error occurred creating the save point"
	RollbackSavePointError            = "an error occurred rolling back to save point"
	NewPersistenceContextError        = "an error occurred creating the persistence context"
	GetAppHashError                   = "an error occurred getting the apphash"
	ResetContextError                 = "an error occurred resetting the context"
	CommitContextError                = "an error occurred committing the context"
	ReleaseContextError               = "an error occurred releasing the context"
	SetPoolError                      = "an error occurred setting the pool"
	DuplicateSavePointError           = "the save point is duplicated"
	SavePointNotFoundError            = "the save point is not found"
	EmptySavePointsError              = "the save points list in context is empty"
	InvalidEvidenceTypeError          = "the evidence type is not valid"
	ExportStateError                  = "an error occurred exporting the state"
	UnequalHeightsError               = "the heights are not equal"
	SetMissedBlocksError              = "an error occurred setting missed blocks"

	MissingRequiredArgError    = "socket error: missing required argument."
	SocketRequestTimedOutError = "socket error: request timed out while waiting on ACK."
	UndefinedSocketTypeError   = "socket error: undefined given socket type."
	PeerHangUpError            = "socket error: Peer hang up."
	UnexpectedSocketError      = "socket error: Unexpected peer error."
	PayloadTooBigError         = "socket error: payload size is too big. "
	SocketIOStartFailedError   = "socket error: failed to start socket reading/writing (io)"
)
View Source
const (
	ZeroInt       = 0
	HeightNotUsed = 0 // TODO (Andrew) update design, could use -1
	EmptyString   = ""
)

Variables

This section is empty.

Functions

func BigIntLessThan

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

func BigIntToString

func BigIntToString(b *big.Int) string

func ErrMissingRequiredArg

func ErrMissingRequiredArg(value string) error

func ErrPayloadTooBig

func ErrPayloadTooBig(bodyLength, acceptedLength uint) error

func ErrPeerHangUp

func ErrPeerHangUp(err error) error

func ErrSocketIOStartFailed

func ErrSocketIOStartFailed(socketType string) error

func ErrSocketRequestTimedOut

func ErrSocketRequestTimedOut(addr string, nonce uint32) error

func ErrUndefinedSocketType

func ErrUndefinedSocketType(socketType string) error

func ErrUnexpected

func ErrUnexpected(err error) error

func Int64ToBytes

func Int64ToBytes(i int64) []byte

func RandBigInt

func RandBigInt() *big.Int

Types

type Code

type Code float64

type Codec

type Codec interface {
	Marshal(proto.Message) ([]byte, Error)
	Unmarshal([]byte, proto.Message) Error
	ToAny(proto.Message) (*anypb.Any, Error)
	FromAny(*anypb.Any) (proto.Message, Error)
}

func GetCodec

func GetCodec() Codec

type Error

type Error interface {
	Code() Code
	error
}

func EmptyTransactionErr

func EmptyTransactionErr() Error

func ErrAddAccountAmount

func ErrAddAccountAmount(err error) Error

func ErrAddPoolAmount

func ErrAddPoolAmount(name string, err error) Error

func ErrAlreadyExists

func ErrAlreadyExists() Error

func ErrAlreadyPaused

func ErrAlreadyPaused() Error

func ErrAppHash

func ErrAppHash(err error) Error

func ErrCommitContext

func ErrCommitContext(err error) Error

func ErrDecodeMessage

func ErrDecodeMessage() Error

func ErrDelete

func ErrDelete(err error) Error

func ErrDuplicateSavePoint

func ErrDuplicateSavePoint() Error

func ErrDuplicateTransaction

func ErrDuplicateTransaction() Error

func ErrEmptyAccount

func ErrEmptyAccount() Error

func ErrEmptyAddress

func ErrEmptyAddress() Error

func ErrEmptyAmount

func ErrEmptyAmount() Error

func ErrEmptyHash

func ErrEmptyHash() Error

func ErrEmptyName

func ErrEmptyName() Error

func ErrEmptyNetworkID

func ErrEmptyNetworkID() Error

func ErrEmptyNonce

func ErrEmptyNonce() Error

func ErrEmptyParamKey

func ErrEmptyParamKey() Error

func ErrEmptyParamValue

func ErrEmptyParamValue() Error

func ErrEmptyProposer

func ErrEmptyProposer() Error

func ErrEmptyPublicKey

func ErrEmptyPublicKey() Error

func ErrEmptyRelayChain

func ErrEmptyRelayChain() Error

func ErrEmptyRelayChains

func ErrEmptyRelayChains() Error

func ErrEmptySavePoints

func ErrEmptySavePoints() Error

func ErrEmptySignature

func ErrEmptySignature() Error

func ErrEmptyTimestamp

func ErrEmptyTimestamp() Error

func ErrEqualVotes

func ErrEqualVotes() Error

func ErrExportState

func ErrExportState(err error) Error

func ErrGetAccountAmount

func ErrGetAccountAmount(err error) Error

func ErrGetAllAccounts

func ErrGetAllAccounts(err error) Error

func ErrGetAllApps

func ErrGetAllApps(err error) Error

func ErrGetAllFishermen

func ErrGetAllFishermen(err error) Error

func ErrGetAllParams

func ErrGetAllParams(err error) Error

func ErrGetAllPools

func ErrGetAllPools(err error) Error

func ErrGetAllServiceNodes

func ErrGetAllServiceNodes(err error) Error

func ErrGetAllValidators

func ErrGetAllValidators(err error) Error

func ErrGetAppHash

func ErrGetAppHash(err error) Error

func ErrGetBlockHash

func ErrGetBlockHash(err error) Error

func ErrGetExists

func ErrGetExists(err error) Error

func ErrGetLatestHeight

func ErrGetLatestHeight(err error) Error

func ErrGetMissedBlocks

func ErrGetMissedBlocks(err error) Error

func ErrGetOutputAddress

func ErrGetOutputAddress(operator []byte, err error) Error

func ErrGetParam

func ErrGetParam(paramName string, err error) Error

func ErrGetPauseHeight

func ErrGetPauseHeight(err error) Error

func ErrGetPoolAmount

func ErrGetPoolAmount(name string, err error) Error

func ErrGetReadyToUnstake

func ErrGetReadyToUnstake(err error) Error

func ErrGetServiceNodeCount

func ErrGetServiceNodeCount(chain string, height int64, err error) Error

func ErrGetServiceNodesPerSessionAt

func ErrGetServiceNodesPerSessionAt(height int64, err error) Error

func ErrGetStatus

func ErrGetStatus(err error) Error

func ErrGetValidatorStakedTokens

func ErrGetValidatorStakedTokens(err error) Error

func ErrHexDecodeFromString

func ErrHexDecodeFromString(err error) Error

func ErrInitParams

func ErrInitParams(err error) Error

func ErrInsert

func ErrInsert(err error) Error

func ErrInsufficientAmountError

func ErrInsufficientAmountError() Error

func ErrInterfaceConversion

func ErrInterfaceConversion(got interface{}, expected interface{}) Error

func ErrInvalidAddressLen

func ErrInvalidAddressLen(err error) Error

func ErrInvalidAmount

func ErrInvalidAmount() Error

func ErrInvalidBlockHeight

func ErrInvalidBlockHeight() Error

func ErrInvalidEvidenceType

func ErrInvalidEvidenceType() Error

func ErrInvalidHashLength

func ErrInvalidHashLength(err error) Error

func ErrInvalidNonce

func ErrInvalidNonce() Error

func ErrInvalidParamValue

func ErrInvalidParamValue(got, expected interface{}) Error

func ErrInvalidProposerCutPercentage

func ErrInvalidProposerCutPercentage() Error

func ErrInvalidPublicKeylen

func ErrInvalidPublicKeylen(err error) Error

func ErrInvalidRelayChainLength

func ErrInvalidRelayChainLength(got, expected int) Error

func ErrInvalidServiceUrl

func ErrInvalidServiceUrl(reason string) Error

func ErrInvalidSigner

func ErrInvalidSigner() Error

func ErrInvalidStatus

func ErrInvalidStatus(got, expected int) Error

func ErrInvalidTransactionCount

func ErrInvalidTransactionCount() Error

func ErrMaxChains

func ErrMaxChains(maxChains int) Error

func ErrMaxEvidenceAge

func ErrMaxEvidenceAge() Error

func ErrMinimumStake

func ErrMinimumStake() Error

func ErrNegativeAmountError

func ErrNegativeAmountError() Error

func ErrNewAddressFromBytes

func ErrNewAddressFromBytes(err error) Error

func ErrNewFeeFromString

func ErrNewFeeFromString(fee string) Error

func ErrNewPersistenceContext

func ErrNewPersistenceContext(err error) Error

func ErrNewPublicKeyFromBytes

func ErrNewPublicKeyFromBytes(err error) Error

func ErrNewSavePoint

func ErrNewSavePoint(err error) Error

func ErrNilOutputAddress

func ErrNilOutputAddress() Error

func ErrNilPool

func ErrNilPool() Error

func ErrNilQuorumCertificate

func ErrNilQuorumCertificate() Error

func ErrNotExists

func ErrNotExists() Error

func ErrNotPaused

func ErrNotPaused() Error

func ErrNotReadyToUnpause

func ErrNotReadyToUnpause() Error

func ErrProtoFromAny

func ErrProtoFromAny(err error) Error

func ErrProtoMarshal

func ErrProtoMarshal(err error) Error

func ErrProtoNewAny

func ErrProtoNewAny(err error) Error

func ErrProtoUnmarshal

func ErrProtoUnmarshal(err error) Error

func ErrReleaseContext

func ErrReleaseContext(err error) Error

func ErrResetContext

func ErrResetContext(err error) Error

func ErrRollbackSavePoint

func ErrRollbackSavePoint(err error) Error

func ErrSavePointNotFound

func ErrSavePointNotFound() Error

func ErrSetAccountAmount

func ErrSetAccountAmount(err error) Error

func ErrSetMissedBlocks

func ErrSetMissedBlocks(err error) Error

func ErrSetPauseHeight

func ErrSetPauseHeight(err error) Error

func ErrSetPool

func ErrSetPool(name string, err error) Error

func ErrSetPoolAmount

func ErrSetPoolAmount(name string, err error) Error

func ErrSetStatusPausedBefore

func ErrSetStatusPausedBefore(err error, beforeHeight int64) Error

func ErrSetUnstakingHeightAndStatus

func ErrSetUnstakingHeightAndStatus(err error) Error

func ErrSetValidatorStakedTokens

func ErrSetValidatorStakedTokens(err error) Error

func ErrSignatureVerificationFailed

func ErrSignatureVerificationFailed() Error

func ErrStringToBigInt

func ErrStringToBigInt() Error

func ErrSubPoolAmount

func ErrSubPoolAmount(name string, err error) Error

func ErrTransactionAlreadyCommitted

func ErrTransactionAlreadyCommitted() Error

func ErrTransactionSign

func ErrTransactionSign(err error) Error

func ErrUnauthorizedParamChange

func ErrUnauthorizedParamChange(owner []byte) Error

func ErrUnequalHeights

func ErrUnequalHeights() Error

func ErrUnequalPublicKeys

func ErrUnequalPublicKeys() Error

func ErrUnequalRounds

func ErrUnequalRounds() Error

func ErrUnequalVoteTypes

func ErrUnequalVoteTypes() Error

func ErrUnknownMessage

func ErrUnknownMessage(msg interface{}) Error

func ErrUnknownParam

func ErrUnknownParam(paramName string) Error

func ErrUnmarshalTransaction

func ErrUnmarshalTransaction(err error) Error

func ErrUpdateParam

func ErrUpdateParam(err error) Error

func NewError

func NewError(code Code, msg string) Error

func StringToBigInt

func StringToBigInt(s string) (*big.Int, Error)

type FIFOMempool

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

func (*FIFOMempool) AddTransaction

func (f *FIFOMempool) AddTransaction(tx []byte) Error

func (*FIFOMempool) Clear

func (f *FIFOMempool) Clear()

func (*FIFOMempool) Contains

func (f *FIFOMempool) Contains(hash string) bool

func (*FIFOMempool) DeleteTransaction

func (f *FIFOMempool) DeleteTransaction(tx []byte) Error

func (*FIFOMempool) PopTransaction

func (f *FIFOMempool) PopTransaction() ([]byte, Error)

func (*FIFOMempool) Size

func (f *FIFOMempool) Size() int

func (*FIFOMempool) TxsBytes

func (f *FIFOMempool) TxsBytes() int

type Mempool

type Mempool interface {
	Contains(hash string) bool
	AddTransaction(tx []byte) Error
	DeleteTransaction(tx []byte) Error

	Clear()
	Size() int
	TxsBytes() int
	PopTransaction() (tx []byte, err Error)
}

func NewMempool

func NewMempool(maxTransactionBytes int, maxTransactions int) Mempool

type ProtoCodec

type ProtoCodec struct{}

func (*ProtoCodec) FromAny

func (p *ProtoCodec) FromAny(any *anypb.Any) (proto.Message, Error)

func (*ProtoCodec) Marshal

func (p *ProtoCodec) Marshal(message proto.Message) ([]byte, Error)

func (*ProtoCodec) ToAny

func (p *ProtoCodec) ToAny(message proto.Message) (*anypb.Any, Error)

func (*ProtoCodec) Unmarshal

func (p *ProtoCodec) Unmarshal(bz []byte, message proto.Message) Error

type StdErr

type StdErr struct {
	CodeError Code
	// contains filtered or unexported fields
}

func (StdErr) Code

func (se StdErr) Code() Code

func (StdErr) Error

func (se StdErr) Error() string

type ValMap

type ValMap map[string]*Validator

The key is a hex encoded representation of the validator byte address. TODO(discuss): Should there be a type for a stringified version of `Address`?

func ValidatorListToMap

func ValidatorListToMap(validators []*Validator) (m ValMap)

Mapping a validator from ID to the struct can make different parts of the consensus business logic easier & faster.

type Validator

type Validator struct {
	Address   cryptoPocket.Address          `json:"address"`
	PublicKey cryptoPocket.Ed25519PublicKey `json:"public_key"`
	Jailed    bool                          `json:"jailed"` // TODO(olshansky): Integrate with utility to update this.
	UPokt     uint64                        `json:"upokt"`  // TODO(olshansky): Integrate with utility to update this.
	Host      string                        `json:"host"`
	Port      uint32                        `json:"port"`
	DebugPort uint32                        `json:"debug_port"`
	Chains    []string                      `json:"chains"` // TODO(olshansky): Integrate with utility to update this.
}

func (*Validator) Validate

func (v *Validator) Validate() error

TODO(olshansky): Add proper validator configuration validation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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