types

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2026 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrMsgEventAlreadyProcessed = "event already processed"
	ErrMsgOldEventsNotAllowed   = "old events are not allowed"

	ErrMsgSideTxRejected = "sideTx didn't get yes votes"

	ErrMsgValidationFailed = "failed to validate msg"

	ErrMsgFailedToFetchValidator   = "failed to fetch validator from store"
	ErrMsgFailedToGetValidatorSet  = "failed to get validator set"
	ErrMsgValidatorAlreadyExists   = "validator has been a validator before, hence cannot join with same id"
	ErrMsgNoProposerInValidatorSet = "no proposer in validator set"
	ErrMsgInvalidProposerInMsg     = "invalid proposer in msg"
	ErrMsgInvalidProposerAddress   = "invalid proposer address"

	ErrMsgNonceMismatch = "nonce in message doesn't match with nonce in log"
	ErrMsgIDMismatch    = "id in message doesn't match with id in log"

	ErrMsgUnableToSetSequence = "unable to set the sequence"

	ErrMsgBlocksNotInContinuity = "blocks not in continuity"
	ErrMsgBlockNumberMismatch   = "blockNumber in message doesn't match blockNumber in receipt"

	ErrMsgPubKeyFirstByteMismatch = "public key first byte mismatch"
	ErrMsgInvalidPubKey           = "public key is invalid"

	ErrMsgConvertSignerToBytes         = "error in converting signer address to bytes"
	ErrMsgConvertEventLogSignerToBytes = "error in converting event log signer address to bytes"
	ErrMsgConvertHexToBytes            = "error in converting hex address to bytes"

	ErrMsgFailedToFetchParams              = "error in fetching params from store"
	ErrMsgFailedToGetChainParams           = "failed to get chain params"
	ErrMsgFailedToGetChainManagerParams    = "failed to get chain manager params"
	ErrMsgErrorInGettingChainManagerParams = "error in getting chain manager params"

	ErrMsgErrorFetchingLog = "error fetching log from txHash"

	ErrMsgInvalidAmount  = "invalid amount for validator"
	ErrMsgAmountMismatch = "amount in message doesn't match Amount in event logs"

	ErrAlertVoteExtensionRejected                     = "alert, vote extension rejected. This should not happen; the validator could be malicious!"
	ErrAlertNonRpVoteExtensionRejected                = "alert, non-rp vote extension rejected. This should not happen; the validator could be malicious!"
	ErrAlertMilestonePropositionVoteExtensionRejected = "alert, milestone proposition vote extension rejected. This should not happen; the validator could be malicious!"
)
View Source
const (
	AttributeKeyTxHash       = "txhash"
	AttributeKeyTxLogIndex   = "tx-log-index"
	AttributeKeySideTxResult = "side-tx-result"
	EventTypeFeeTransfer     = "fee-transfer"
	AttributeKeyProposer     = "proposer"
	AttributeKeyDenom        = "denom"
	AttributeKeyAmount       = "amount"
)
View Source
const (
	// LogKeyError is the standard attribute key for error logging
	LogKeyError = "error"

	// LogKeySequence is used for logging sequence IDs in event processing
	LogKeySequence = "sequence"

	LogKeyValidatorID    = "validatorId"
	LogKeyValidatorNonce = "validatorNonce"

	LogKeyMsgNonce       = "msgNonce"
	LogKeyMsgBlockNumber = "msgBlockNumber"
	LogKeyMsgID          = "msgId"

	LogKeyLogIndex    = "logIndex"
	LogKeyBlockNumber = "blockNumber"

	LogKeyReceiptBlockNumber = "receiptBlockNumber"
	LogKeyNonceFromTx        = "nonceFromTx"
	LogKeyValidatorIdFromTx  = "validatorIdFromTx"

	LogKeyMsgAmount       = "msgAmount"
	LogKeyNewAmount       = "newAmount"
	LogKeyAmountFromEvent = "amountFromEvent"

	LogKeyProposer = "proposer"
	LogKeySigner   = "signer"
)
View Source
const (
	// DefaultLogIndexUnit is the default tx hash and log index unit (used to calculate sequence ID)
	DefaultLogIndexUnit = 100000
)

Variables

View Source
var (
	ErrInvalidLengthDividendAccount        = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowDividendAccount          = fmt.Errorf("proto: integer overflow")
	ErrUnexpectedEndOfGroupDividendAccount = fmt.Errorf("proto: unexpected end of group")
)

Functions

func AppendBytes32

func AppendBytes32(data ...[]byte) []byte

func GetAccountProof

func GetAccountProof(dividendAccounts []DividendAccount, userAddr string) ([]byte, uint64, error)

GetAccountProof returns proof of dividend Account

func GetAccountRootHash

func GetAccountRootHash(dividendAccounts []DividendAccount) ([]byte, error)

GetAccountRootHash returns rootHash of Validator Account State Tree

func GetAccountTree

func GetAccountTree(dividendAccounts []DividendAccount) (*merkletree.MerkleTree, error)

GetAccountTree returns rootHash of Validator Account State Tree

func VerifyAccountProof

func VerifyAccountProof(dividendAccounts []DividendAccount, userAddr, proofToVerify string) (bool, error)

VerifyAccountProof returns proof of dividend Account

Types

type DividendAccount

type DividendAccount struct {
	// Address of the user who owns this dividend account.
	User string `protobuf:"bytes,1,opt,name=user,proto3" json:"user,omitempty"`
	// Total amount of fees accumulated in this account.
	FeeAmount string `protobuf:"bytes,2,opt,name=fee_amount,json=feeAmount,proto3" json:"fee_amount,omitempty"`
}

DividendAccount contains the burned fees for a user. Tracks accumulated fees that can be withdrawn by validators.

func SortDividendAccountByAddress

func SortDividendAccountByAddress(dividendAccounts []DividendAccount) ([]DividendAccount, error)

SortDividendAccountByAddress sorts DividendAccounts by address

func (DividendAccount) CalculateHash

func (da DividendAccount) CalculateHash() ([]byte, error)

CalculateHash hashes the values of a DividendAccount

func (*DividendAccount) Descriptor

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

func (*DividendAccount) Equal

func (this *DividendAccount) Equal(that interface{}) bool

func (DividendAccount) Equals

func (da DividendAccount) Equals(other merkletree.Content) (bool, error)

func (*DividendAccount) GetFeeAmount

func (m *DividendAccount) GetFeeAmount() string

func (*DividendAccount) GetUser

func (m *DividendAccount) GetUser() string

func (*DividendAccount) Marshal

func (m *DividendAccount) Marshal() (dAtA []byte, err error)

func (*DividendAccount) MarshalTo

func (m *DividendAccount) MarshalTo(dAtA []byte) (int, error)

func (*DividendAccount) MarshalToSizedBuffer

func (m *DividendAccount) MarshalToSizedBuffer(dAtA []byte) (int, error)

func (*DividendAccount) ProtoMessage

func (*DividendAccount) ProtoMessage()

func (*DividendAccount) Reset

func (m *DividendAccount) Reset()

func (*DividendAccount) Size

func (m *DividendAccount) Size() (n int)

func (*DividendAccount) String

func (m *DividendAccount) String() string

func (*DividendAccount) Unmarshal

func (m *DividendAccount) Unmarshal(dAtA []byte) error

func (*DividendAccount) XXX_DiscardUnknown

func (m *DividendAccount) XXX_DiscardUnknown()

func (*DividendAccount) XXX_Marshal

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

func (*DividendAccount) XXX_Merge

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

func (*DividendAccount) XXX_Size

func (m *DividendAccount) XXX_Size() int

func (*DividendAccount) XXX_Unmarshal

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

Directories

Path Synopsis
Package rest provides HTTP types and primitives for REST requests validation and response handling.
Package rest provides HTTP types and primitives for REST requests validation and response handling.

Jump to

Keyboard shortcuts

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