metadata

package
v0.0.0-...-5d05a64 Latest Latest
Warning

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

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetBlockBucketName

func GetBlockBucketName(blockHeaderHash common.Hash) []byte

func GetBlockMetaDataKey

func GetBlockMetaDataKey(headerHash common.Hash) []byte

func GetBlockReceiptsKey

func GetBlockReceiptsKey(headerHash common.Hash, blockNumber uint64, isProtocolTxReceipt bool) []byte

func GetDataByBucket

func GetDataByBucket(db *db.DB, key []byte, headerHash common.Hash, finalizedHeaderHash common.Hash) ([]byte, error)

func GetEpochBlockHashesKey

func GetEpochBlockHashesKey(epoch uint64) []byte

func GetEpochMetaDataKey

func GetEpochMetaDataKey(epoch uint64, prevSlotLastBlockHeaderHash common.Hash) []byte

func GetMainChainMetaDataKey

func GetMainChainMetaDataKey() []byte

func GetProtocolTransactionMetaDataKey

func GetProtocolTransactionMetaDataKey(txHash common.Hash) []byte

func GetSlaveMetaDataKey

func GetSlaveMetaDataKey(address []byte, slavePK []byte) []byte

func GetTransactionMetaDataKey

func GetTransactionMetaDataKey(txHash common.Hash) []byte

Types

type BlockMetaData

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

func GetBlockMetaData

func GetBlockMetaData(d *db.DB, headerHash common.Hash) (*BlockMetaData, error)

func NewBlockMetaData

func NewBlockMetaData(parentHeaderHash common.Hash, headerHash common.Hash,
	slotNumber uint64, totalStakeAmount []byte, trieRoot common.Hash) *BlockMetaData

func (*BlockMetaData) AddChildHeaderHash

func (bm *BlockMetaData) AddChildHeaderHash(headerHash common.Hash)

func (*BlockMetaData) ChildHeaderHashes

func (bm *BlockMetaData) ChildHeaderHashes() [][]byte

func (*BlockMetaData) Commit

func (bm *BlockMetaData) Commit(b *bbolt.Bucket) error

func (*BlockMetaData) DeSerialize

func (bm *BlockMetaData) DeSerialize(data []byte) error

func (*BlockMetaData) Epoch

func (bm *BlockMetaData) Epoch() uint64

func (*BlockMetaData) FinalizedChildHeaderHash

func (bm *BlockMetaData) FinalizedChildHeaderHash() []byte

func (*BlockMetaData) HeaderHash

func (bm *BlockMetaData) HeaderHash() common.Hash

func (*BlockMetaData) ParentHeaderHash

func (bm *BlockMetaData) ParentHeaderHash() common.Hash

func (*BlockMetaData) Serialize

func (bm *BlockMetaData) Serialize() ([]byte, error)

func (*BlockMetaData) SlotNumber

func (bm *BlockMetaData) SlotNumber() uint64

func (*BlockMetaData) TotalStakeAmount

func (bm *BlockMetaData) TotalStakeAmount() []byte

func (*BlockMetaData) TrieRoot

func (bm *BlockMetaData) TrieRoot() common.Hash

func (*BlockMetaData) UpdateFinalizedChildHeaderHash

func (bm *BlockMetaData) UpdateFinalizedChildHeaderHash(finalizedChildHeaderHash common.Hash)

type BlockReceipts

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

func GetBlockReceipts

func GetBlockReceipts(d *db.DB, headerHash common.Hash, blockNumber uint64, isProtocolTxReceipt bool) (*BlockReceipts, error)

func NewBlockReceipts

func NewBlockReceipts(receipts []byte) *BlockReceipts

func (*BlockReceipts) DeSerialize

func (b *BlockReceipts) DeSerialize(data []byte) error

func (*BlockReceipts) Receipts

func (b *BlockReceipts) Receipts() []byte

func (*BlockReceipts) Serialize

func (b *BlockReceipts) Serialize() ([]byte, error)

type EpochBlockHashes

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

func GetEpochBlockHashes

func GetEpochBlockHashes(d *db.DB,
	epoch uint64) (*EpochBlockHashes, error)

func NewEpochBlockHashes

func NewEpochBlockHashes(epoch uint64) *EpochBlockHashes

func (*EpochBlockHashes) AddHeaderHashBySlotNumber

func (e *EpochBlockHashes) AddHeaderHashBySlotNumber(headerHash common.Hash,
	slotNumber uint64) error

func (*EpochBlockHashes) BlockHashesBySlotNumber

func (e *EpochBlockHashes) BlockHashesBySlotNumber() []*protos.BlockHashesBySlotNumber

func (*EpochBlockHashes) Commit

func (e *EpochBlockHashes) Commit(b *bbolt.Bucket) error

func (*EpochBlockHashes) DeSerialize

func (e *EpochBlockHashes) DeSerialize(data []byte) error

func (*EpochBlockHashes) Epoch

func (e *EpochBlockHashes) Epoch() uint64

func (*EpochBlockHashes) PBData

func (*EpochBlockHashes) Serialize

func (e *EpochBlockHashes) Serialize() ([]byte, error)

type EpochMetaData

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

func GetEpochMetaData

func GetEpochMetaData(db *db.DB, currentBlockSlotNumber uint64, parentHeaderHash common.Hash) (*EpochMetaData, error)

func NewEpochMetaData

func NewEpochMetaData(epoch uint64, prevSlotLastBlockHeaderHash common.Hash,
	validators [][]byte) *EpochMetaData

func (*EpochMetaData) AddTotalStakeAmountFound

func (e *EpochMetaData) AddTotalStakeAmountFound(amount uint64)

func (*EpochMetaData) AddValidators

func (e *EpochMetaData) AddValidators(dilithiumPK []byte)

func (*EpochMetaData) AllotSlots

func (e *EpochMetaData) AllotSlots(randomSeed int64, epoch uint64, prevSlotLastBlockHeaderHash common.Hash)

func (*EpochMetaData) Commit

func (e *EpochMetaData) Commit(b *bbolt.Bucket) error

func (*EpochMetaData) DeSerialize

func (e *EpochMetaData) DeSerialize(data []byte) error

func (*EpochMetaData) Epoch

func (e *EpochMetaData) Epoch() uint64

func (*EpochMetaData) PBData

func (e *EpochMetaData) PBData() *protos.EpochMetaData

func (*EpochMetaData) PrevSlotLastBlockHeaderHash

func (e *EpochMetaData) PrevSlotLastBlockHeaderHash() common.Hash

func (*EpochMetaData) RemoveValidators

func (e *EpochMetaData) RemoveValidators(dilithiumPK []byte)

func (*EpochMetaData) Serialize

func (e *EpochMetaData) Serialize() ([]byte, error)

func (*EpochMetaData) SlotInfo

func (e *EpochMetaData) SlotInfo() []*protos.SlotInfo

func (*EpochMetaData) TotalStakeAmountAlloted

func (e *EpochMetaData) TotalStakeAmountAlloted() uint64

func (*EpochMetaData) TotalStakeAmountFound

func (e *EpochMetaData) TotalStakeAmountFound() uint64

func (*EpochMetaData) UpdatePrevEpochStakeData

func (e *EpochMetaData) UpdatePrevEpochStakeData(totalStakeAmountFound uint64, totalStakeAmountAlloted uint64)

func (*EpochMetaData) Validators

func (e *EpochMetaData) Validators() [][]byte

type MainChainMetaData

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

func GetMainChainMetaData

func GetMainChainMetaData(d *db.DB) (*MainChainMetaData, error)

func NewMainChainMetaData

func NewMainChainMetaData(finalizedBlockHeaderHash common.Hash, finalizedBlockSlotNumber uint64,
	lastBlockHeaderHash common.Hash, lastBlockSlotNumber uint64) *MainChainMetaData

func (*MainChainMetaData) Commit

func (m *MainChainMetaData) Commit(b *bbolt.Bucket) error

func (*MainChainMetaData) DeSerialize

func (m *MainChainMetaData) DeSerialize(data []byte) error

func (*MainChainMetaData) FinalizedBlockHeaderHash

func (m *MainChainMetaData) FinalizedBlockHeaderHash() common.Hash

func (*MainChainMetaData) FinalizedBlockSlotNumber

func (m *MainChainMetaData) FinalizedBlockSlotNumber() uint64

func (*MainChainMetaData) LastBlockHeaderHash

func (m *MainChainMetaData) LastBlockHeaderHash() common.Hash

func (*MainChainMetaData) LastBlockSlotNumber

func (m *MainChainMetaData) LastBlockSlotNumber() uint64

func (*MainChainMetaData) Serialize

func (m *MainChainMetaData) Serialize() ([]byte, error)

func (*MainChainMetaData) UpdateFinalizedBlockData

func (m *MainChainMetaData) UpdateFinalizedBlockData(finalizedBlockHeaderHash common.Hash,
	finalizedBlockSlotNumber uint64)

func (*MainChainMetaData) UpdateLastBlockData

func (m *MainChainMetaData) UpdateLastBlockData(lastBlockHeaderHash common.Hash,
	lastBlockSlotNumber uint64)

type PeerData

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

func NewPeerData

func NewPeerData() (*PeerData, error)

func (*PeerData) AddConnectedPeers

func (p *PeerData) AddConnectedPeers(multiAddr string) error

func (*PeerData) AddDisconnectedPeers

func (p *PeerData) AddDisconnectedPeers(multiAddr string) error

func (*PeerData) ConnectedPeers

func (p *PeerData) ConnectedPeers() []*PeerInfo

func (*PeerData) DisconnectedPeers

func (p *PeerData) DisconnectedPeers() []*PeerInfo

func (*PeerData) IsPeerInList

func (p *PeerData) IsPeerInList(multiAddr string) bool

func (*PeerData) Load

func (p *PeerData) Load() error

func (*PeerData) PeerList

func (p *PeerData) PeerList() []string

func (*PeerData) RemovePeer

func (p *PeerData) RemovePeer(multiAddr string) error

func (*PeerData) Save

func (p *PeerData) Save() error

type PeerInfo

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

func NewPeerInfo

func NewPeerInfo(multiAddr string,
	timestamp uint64) *PeerInfo

func (*PeerInfo) IP

func (p *PeerInfo) IP() string

func (*PeerInfo) Identity

func (p *PeerInfo) Identity() string

func (*PeerInfo) IsSame

func (p *PeerInfo) IsSame(p1 *PeerInfo) bool

func (*PeerInfo) MultiAddr

func (p *PeerInfo) MultiAddr() string

func (*PeerInfo) Timestamp

func (p *PeerInfo) Timestamp() uint64

type ProtocolTransactionMetaData

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

func GetProtocolTransactionMetaData

func GetProtocolTransactionMetaData(d *db.DB, txHash common.Hash) (*ProtocolTransactionMetaData, error)

func NewProtocolTransactionMetaData

func NewProtocolTransactionMetaData(blockHash common.Hash, blockNumber uint64,
	index uint64, tx *protos.ProtocolTransaction) *ProtocolTransactionMetaData

func (*ProtocolTransactionMetaData) BlockHash

func (t *ProtocolTransactionMetaData) BlockHash() common.Hash

func (*ProtocolTransactionMetaData) BlockNumber

func (t *ProtocolTransactionMetaData) BlockNumber() uint64

func (*ProtocolTransactionMetaData) Commit

func (*ProtocolTransactionMetaData) DeSerialize

func (t *ProtocolTransactionMetaData) DeSerialize(data []byte) error

func (*ProtocolTransactionMetaData) Index

func (*ProtocolTransactionMetaData) Serialize

func (t *ProtocolTransactionMetaData) Serialize() ([]byte, error)

func (*ProtocolTransactionMetaData) Transaction

type SlaveMetaData

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

func GetSlaveMetaData

func GetSlaveMetaData(db *db.DB, address []byte, slavePK []byte,
	headerHash common.Hash, finalizedHeaderHash common.Hash) (*SlaveMetaData, error)

func NewSlaveMetaData

func NewSlaveMetaData(txHash []byte, address []byte, slavePK []byte) *SlaveMetaData

func (*SlaveMetaData) Address

func (s *SlaveMetaData) Address() []byte

func (*SlaveMetaData) Commit

func (s *SlaveMetaData) Commit(b *bbolt.Bucket) error

func (*SlaveMetaData) DeSerialize

func (s *SlaveMetaData) DeSerialize(data []byte) error

func (*SlaveMetaData) Serialize

func (s *SlaveMetaData) Serialize() ([]byte, error)

func (*SlaveMetaData) SlavePK

func (s *SlaveMetaData) SlavePK() []byte

func (*SlaveMetaData) TxHash

func (s *SlaveMetaData) TxHash() []byte

type SlotValidatorsMetaData

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

SlotValidatorsMetaData metadata is not stored into DB, as we generate this based on validators data already stored by epoch.go in the DB.

func NewSlotValidatorsMetaData

func NewSlotValidatorsMetaData(slotNumber uint64, epochMetaData *EpochMetaData) *SlotValidatorsMetaData

func (*SlotValidatorsMetaData) GetSlotLeaderPK

func (s *SlotValidatorsMetaData) GetSlotLeaderPK() []byte

func (*SlotValidatorsMetaData) GetValidatorType

func (s *SlotValidatorsMetaData) GetValidatorType(dilithiumPK []byte) (uint8, bool)

func (*SlotValidatorsMetaData) GetValidatorsType

func (s *SlotValidatorsMetaData) GetValidatorsType() map[string]uint8

func (*SlotValidatorsMetaData) IsAttestor

func (s *SlotValidatorsMetaData) IsAttestor(dilithiumPK string) bool

func (*SlotValidatorsMetaData) IsSlotLeader

func (s *SlotValidatorsMetaData) IsSlotLeader(dilithiumPK string) bool

type TransactionMetaData

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

func GetTransactionMetaData

func GetTransactionMetaData(d *db.DB, txHash common.Hash) (*TransactionMetaData, error)

func NewTransactionMetaData

func NewTransactionMetaData(blockHash common.Hash, blockNumber uint64,
	index uint64, tx *protos.Transaction) *TransactionMetaData

func (*TransactionMetaData) BlockHash

func (t *TransactionMetaData) BlockHash() common.Hash

func (*TransactionMetaData) BlockNumber

func (t *TransactionMetaData) BlockNumber() uint64

func (*TransactionMetaData) Commit

func (t *TransactionMetaData) Commit(b *bbolt.Bucket) error

func (*TransactionMetaData) DeSerialize

func (t *TransactionMetaData) DeSerialize(data []byte) error

func (*TransactionMetaData) Index

func (t *TransactionMetaData) Index() uint64

func (*TransactionMetaData) Serialize

func (t *TransactionMetaData) Serialize() ([]byte, error)

func (*TransactionMetaData) Transaction

func (t *TransactionMetaData) Transaction() *protos.Transaction

Jump to

Keyboard shortcuts

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