Documentation ¶
Overview ¶
Code generated by fastssz. DO NOT EDIT. Hash: 61b113382a0931d2f239bb8712b2c09846d541b565494645b8d12d572b8b3dfb Version: 0.1.3
Index ¶
- Constants
- Variables
- func DecodeBlockHeader(headerBytes []byte) (*types.Header, error)
- func DecodePortalBlockBodyBytes(bodyBytes []byte) (*types.Body, error)
- func EncodeBlockBody(body *types.Body) ([]byte, error)
- func EncodeReceipts(receipts []*types.Receipt) ([]byte, error)
- func FromBlockBodyLegacy(b *BlockBodyLegacy) (*types.Body, error)
- func FromPortalBlockBodyShanghai(b *PortalBlockBodyShanghai) (*types.Body, error)
- func FromPortalReceipts(r *PortalReceipts) ([]*types.Receipt, error)
- func GetEpochIndex(blockNumber uint64) uint64
- func GetEpochIndexByHeader(header types.Header) uint64
- func GetHeaderRecordIndex(blockNumber uint64) uint64
- func GetHeaderRecordIndexByHeader(header types.Header) uint64
- func MixInLength(root [32]byte, length uint64) []byte
- func NewDB(dataDir string, network string) (*sql.DB, error)
- func NewHistoryStorage(config storage2.PortalStorageConfig) (storage2.ContentStorage, error)
- func ValidateBlockBodyBytes(bodyBytes []byte, header *types.Header) (*types.Body, error)
- func ValidateBlockHeaderBytes(headerBytes []byte, blockHash []byte) (*types.Header, error)
- func ValidatePortalReceiptsBytes(receiptBytes, receiptsRoot []byte) ([]*types.Receipt, error)
- type API
- func (p *API) HistoryAddEnr(enr string) (bool, error)
- func (p *API) HistoryDeleteEnr(nodeId string) (bool, error)
- func (p *API) HistoryFindContent(enr string, contentKey string) (interface{}, error)
- func (p *API) HistoryFindNodes(enr string, distances []uint) ([]string, error)
- func (p *API) HistoryGetContent(contentKeyHex string) (*portalwire.ContentInfo, error)
- func (p *API) HistoryGetEnr(nodeId string) (string, error)
- func (p *API) HistoryGossip(contentKeyHex, contentHex string) (int, error)
- func (p *API) HistoryLocalContent(contentKeyHex string) (string, error)
- func (p *API) HistoryLookupEnr(nodeId string) (string, error)
- func (p *API) HistoryOffer(enr string, contentItems [][2]string) (string, error)
- func (p *API) HistoryPing(enr string) (*portalwire.PortalPongResp, error)
- func (p *API) HistoryRecursiveFindNodes(nodeId string) ([]string, error)
- func (p *API) HistoryRoutingTableInfo() *portalwire.RoutingTableInfo
- func (p *API) HistoryStore(contentKeyHex string, contextHex string) (bool, error)
- func (p *API) HistoryTraceGetContent(contentKeyHex string) (*portalwire.TraceContentResult, error)
- type Accumulator
- type AccumulatorProof
- type BeaconBlockBodyProof
- func (b BeaconBlockBodyProof) ByteLength() (out uint64)
- func (b *BeaconBlockBodyProof) Deserialize(dr *codec.DecodingReader) error
- func (b BeaconBlockBodyProof) FixedLength() uint64
- func (b *BeaconBlockBodyProof) HashTreeRoot(hFn tree.HashFn) common.Root
- func (b *BeaconBlockBodyProof) Serialize(w *codec.EncodingWriter) error
- type BeaconBlockHeaderProof
- func (b BeaconBlockHeaderProof) ByteLength() (out uint64)
- func (b *BeaconBlockHeaderProof) Deserialize(dr *codec.DecodingReader) error
- func (b BeaconBlockHeaderProof) FixedLength() uint64
- func (b *BeaconBlockHeaderProof) HashTreeRoot(hFn tree.HashFn) common.Root
- func (b *BeaconBlockHeaderProof) Serialize(w *codec.EncodingWriter) error
- type BlockBodyLegacy
- func (b *BlockBodyLegacy) GetTree() (*ssz.Node, error)
- func (b *BlockBodyLegacy) HashTreeRoot() ([32]byte, error)
- func (b *BlockBodyLegacy) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (b *BlockBodyLegacy) MarshalSSZ() ([]byte, error)
- func (b *BlockBodyLegacy) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (b *BlockBodyLegacy) SizeSSZ() (size int)
- func (b *BlockBodyLegacy) UnmarshalSSZ(buf []byte) error
- type BlockEpochData
- type BlockHeaderProof
- func (p *BlockHeaderProof) HashTreeRootWith(_ ssz.HashWalker) (err error)
- func (p *BlockHeaderProof) MarshalSSZ() ([]byte, error)
- func (p *BlockHeaderProof) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (p *BlockHeaderProof) SizeSSZ() (size int)
- func (p *BlockHeaderProof) UnmarshalSSZ(buf []byte) (err error)
- type BlockHeaderProofType
- type BlockHeaderWithProof
- func (b *BlockHeaderWithProof) GetTree() (*ssz.Node, error)
- func (b *BlockHeaderWithProof) HashTreeRoot() ([32]byte, error)
- func (b *BlockHeaderWithProof) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (b *BlockHeaderWithProof) MarshalSSZ() ([]byte, error)
- func (b *BlockHeaderWithProof) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (b *BlockHeaderWithProof) SizeSSZ() (size int)
- func (b *BlockHeaderWithProof) UnmarshalSSZ(buf []byte) error
- type BlockNumberKey
- type ContentKey
- type ContentStorage
- func (p *ContentStorage) Close() error
- func (p *ContentStorage) ContentCount() (uint64, error)
- func (p *ContentStorage) ContentSize() (uint64, error)
- func (p *ContentStorage) EstimateNewRadius(currentRadius *uint256.Int) (*uint256.Int, error)
- func (p *ContentStorage) ForcePrune(radius *uint256.Int) error
- func (p *ContentStorage) Get(contentKey []byte, contentId []byte) ([]byte, error)
- func (p *ContentStorage) GetLargestDistance() (*uint256.Int, error)
- func (p *ContentStorage) Put(contentKey []byte, contentId []byte, content []byte) error
- func (p *ContentStorage) Radius() *uint256.Int
- func (p *ContentStorage) ReclaimSpace() error
- func (p *ContentStorage) Size() (uint64, error)
- func (p *ContentStorage) SizeByKey(contentId []byte) (uint64, error)
- func (p *ContentStorage) SizeByKeys(ids [][]byte) (uint64, error)
- func (p *ContentStorage) SizeOutRadius(radius *uint256.Int) (uint64, error)
- func (p *ContentStorage) UnusedSize() (uint64, error)
- func (p *ContentStorage) UsedSize() (uint64, error)
- type ContentType
- type EpochAccumulator
- func (e *EpochAccumulator) GetTree() (*ssz.Node, error)
- func (e *EpochAccumulator) HashTreeRoot() ([32]byte, error)
- func (e *EpochAccumulator) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (e *EpochAccumulator) MarshalSSZ() ([]byte, error)
- func (e *EpochAccumulator) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (e *EpochAccumulator) SizeSSZ() (size int)
- func (e *EpochAccumulator) UnmarshalSSZ(buf []byte) error
- type HeaderRecord
- func (h *HeaderRecord) GetTree() (*ssz.Node, error)
- func (h *HeaderRecord) HashTreeRoot() ([32]byte, error)
- func (h *HeaderRecord) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (h *HeaderRecord) MarshalSSZ() ([]byte, error)
- func (h *HeaderRecord) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (h *HeaderRecord) SizeSSZ() (size int)
- func (h *HeaderRecord) UnmarshalSSZ(buf []byte) error
- type HistoricalRoots
- func (h HistoricalRoots) ByteLength(spec *common.Spec) uint64
- func (h *HistoricalRoots) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error
- func (h *HistoricalRoots) FixedLength(_ *common.Spec) uint64
- func (h HistoricalRoots) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root
- func (h HistoricalRoots) Serialize(spec *common.Spec, w *codec.EncodingWriter) error
- type HistoricalRootsAccumulator
- type HistoricalRootsBlockProof
- func (h *HistoricalRootsBlockProof) ByteLength(spec *common.Spec) uint64
- func (h *HistoricalRootsBlockProof) Deserialize(dr *codec.DecodingReader) error
- func (h *HistoricalRootsBlockProof) FixedLength(spec *common.Spec) uint64
- func (h *HistoricalRootsBlockProof) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root
- func (h *HistoricalRootsBlockProof) Serialize(w *codec.EncodingWriter) error
- type HistoricalRootsProof
- func (b HistoricalRootsProof) ByteLength() (out uint64)
- func (b *HistoricalRootsProof) Deserialize(dr *codec.DecodingReader) error
- func (b HistoricalRootsProof) FixedLength() uint64
- func (b *HistoricalRootsProof) HashTreeRoot(hFn tree.HashFn) common.Root
- func (b *HistoricalRootsProof) Serialize(w *codec.EncodingWriter) error
- type MasterAccumulator
- func (f MasterAccumulator) Contains(epochHash []byte) bool
- func (f MasterAccumulator) GetBlockEpochDataForBlockNumber(blockNumber uint64) BlockEpochData
- func (m *MasterAccumulator) GetTree() (*ssz.Node, error)
- func (m *MasterAccumulator) HashTreeRoot() ([32]byte, error)
- func (m *MasterAccumulator) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (m *MasterAccumulator) MarshalSSZ() ([]byte, error)
- func (m *MasterAccumulator) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (m *MasterAccumulator) SizeSSZ() (size int)
- func (m *MasterAccumulator) UnmarshalSSZ(buf []byte) error
- func (f MasterAccumulator) VerifyAccumulatorProof(header types.Header, proof AccumulatorProof) (bool, error)
- func (f MasterAccumulator) VerifyHeader(header types.Header, headerProof BlockHeaderProof) (bool, error)
- type Network
- type PortalBlockBodyShanghai
- func (p *PortalBlockBodyShanghai) GetTree() (*ssz.Node, error)
- func (p *PortalBlockBodyShanghai) HashTreeRoot() ([32]byte, error)
- func (p *PortalBlockBodyShanghai) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (p *PortalBlockBodyShanghai) MarshalSSZ() ([]byte, error)
- func (p *PortalBlockBodyShanghai) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (p *PortalBlockBodyShanghai) SizeSSZ() (size int)
- func (p *PortalBlockBodyShanghai) UnmarshalSSZ(buf []byte) error
- type PortalReceipts
- func (p *PortalReceipts) GetTree() (*ssz.Node, error)
- func (p *PortalReceipts) HashTreeRoot() ([32]byte, error)
- func (p *PortalReceipts) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (p *PortalReceipts) MarshalSSZ() ([]byte, error)
- func (p *PortalReceipts) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (p *PortalReceipts) SizeSSZ() (size int)
- func (p *PortalReceipts) UnmarshalSSZ(buf []byte) error
- type PutResult
- type SSZProof
- func (s *SSZProof) GetTree() (*ssz.Node, error)
- func (s *SSZProof) HashTreeRoot() ([32]byte, error)
- func (s *SSZProof) HashTreeRootWith(hh ssz.HashWalker) (err error)
- func (s *SSZProof) MarshalSSZ() ([]byte, error)
- func (s *SSZProof) MarshalSSZTo(buf []byte) (dst []byte, err error)
- func (s *SSZProof) SizeSSZ() (size int)
- func (s *SSZProof) UnmarshalSSZ(buf []byte) error
Constants ¶
const (
XorFindFarthestQuery = `SELECT
xor(key, (?1)) as distance
FROM kvstore
ORDER BY distance DESC`
)
Variables ¶
var ( ErrNotPreMergeHeader = errors.New("must be pre merge header") ErrPreMergeHeaderMustWithProof = errors.New("pre merge header must has accumulator proof") )
var ( ErrWithdrawalHashIsNotEqual = errors.New("withdrawals hash is not equal") ErrTxHashIsNotEqual = errors.New("tx hash is not equal") ErrUnclesHashIsNotEqual = errors.New("uncles hash is not equal") ErrReceiptsHashIsNotEqual = errors.New("receipts hash is not equal") ErrContentOutOfRange = errors.New("content out of range") ErrHeaderWithProofIsInvalid = errors.New("header proof is invalid") ErrInvalidBlockHash = errors.New("invalid block hash") ErrInvalidBlockNumber = errors.New("invalid block number") )
Functions ¶
func EncodeBlockBody ¶
EncodeBlockBody encode types.Body to ssz bytes
func FromBlockBodyLegacy ¶
func FromBlockBodyLegacy(b *BlockBodyLegacy) (*types.Body, error)
FromBlockBodyLegacy convert BlockBodyLegacy to types.Body
func FromPortalBlockBodyShanghai ¶
func FromPortalBlockBodyShanghai(b *PortalBlockBodyShanghai) (*types.Body, error)
FromPortalBlockBodyShanghai convert PortalBlockBodyShanghai to types.Body
func FromPortalReceipts ¶
func FromPortalReceipts(r *PortalReceipts) ([]*types.Receipt, error)
FromPortalReceipts convert PortalReceipts to types.Receipt
func GetEpochIndex ¶
func GetEpochIndexByHeader ¶
func GetHeaderRecordIndex ¶
func MixInLength ¶
func NewHistoryStorage ¶
func NewHistoryStorage(config storage2.PortalStorageConfig) (storage2.ContentStorage, error)
func ValidateBlockBodyBytes ¶
Types ¶
type API ¶
type API struct {
*portalwire.PortalProtocolAPI
}
func NewHistoryNetworkAPI ¶
func NewHistoryNetworkAPI(historyAPI *portalwire.PortalProtocolAPI) *API
func (*API) HistoryFindContent ¶
func (*API) HistoryFindNodes ¶
func (*API) HistoryGetContent ¶
func (p *API) HistoryGetContent(contentKeyHex string) (*portalwire.ContentInfo, error)
func (*API) HistoryGossip ¶
func (*API) HistoryLocalContent ¶
func (*API) HistoryOffer ¶
func (*API) HistoryPing ¶
func (p *API) HistoryPing(enr string) (*portalwire.PortalPongResp, error)
func (*API) HistoryRecursiveFindNodes ¶
func (*API) HistoryRoutingTableInfo ¶
func (p *API) HistoryRoutingTableInfo() *portalwire.RoutingTableInfo
func (*API) HistoryStore ¶
func (*API) HistoryTraceGetContent ¶
func (p *API) HistoryTraceGetContent(contentKeyHex string) (*portalwire.TraceContentResult, error)
type Accumulator ¶
type Accumulator struct {
// contains filtered or unexported fields
}
func NewAccumulator ¶
func NewAccumulator() *Accumulator
func (*Accumulator) Finish ¶
func (a *Accumulator) Finish() (*MasterAccumulator, error)
type AccumulatorProof ¶
type AccumulatorProof [][]byte
func BuildProof ¶
func BuildProof(header types.Header, epochAccumulator EpochAccumulator) (AccumulatorProof, error)
type BeaconBlockBodyProof ¶
func (BeaconBlockBodyProof) ByteLength ¶
func (b BeaconBlockBodyProof) ByteLength() (out uint64)
func (*BeaconBlockBodyProof) Deserialize ¶
func (b *BeaconBlockBodyProof) Deserialize(dr *codec.DecodingReader) error
func (BeaconBlockBodyProof) FixedLength ¶
func (b BeaconBlockBodyProof) FixedLength() uint64
func (*BeaconBlockBodyProof) HashTreeRoot ¶
func (b *BeaconBlockBodyProof) HashTreeRoot(hFn tree.HashFn) common.Root
func (*BeaconBlockBodyProof) Serialize ¶
func (b *BeaconBlockBodyProof) Serialize(w *codec.EncodingWriter) error
type BeaconBlockHeaderProof ¶
func (BeaconBlockHeaderProof) ByteLength ¶
func (b BeaconBlockHeaderProof) ByteLength() (out uint64)
func (*BeaconBlockHeaderProof) Deserialize ¶
func (b *BeaconBlockHeaderProof) Deserialize(dr *codec.DecodingReader) error
func (BeaconBlockHeaderProof) FixedLength ¶
func (b BeaconBlockHeaderProof) FixedLength() uint64
func (*BeaconBlockHeaderProof) HashTreeRoot ¶
func (b *BeaconBlockHeaderProof) HashTreeRoot(hFn tree.HashFn) common.Root
func (*BeaconBlockHeaderProof) Serialize ¶
func (b *BeaconBlockHeaderProof) Serialize(w *codec.EncodingWriter) error
type BlockBodyLegacy ¶
type BlockBodyLegacy struct { Transactions [][]byte `ssz-max:"16384,16777216"` Uncles []byte `ssz-max:"131072"` }
func (*BlockBodyLegacy) GetTree ¶
func (b *BlockBodyLegacy) GetTree() (*ssz.Node, error)
GetTree ssz hashes the BlockBodyLegacy object
func (*BlockBodyLegacy) HashTreeRoot ¶
func (b *BlockBodyLegacy) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the BlockBodyLegacy object
func (*BlockBodyLegacy) HashTreeRootWith ¶
func (b *BlockBodyLegacy) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the BlockBodyLegacy object with a hasher
func (*BlockBodyLegacy) MarshalSSZ ¶
func (b *BlockBodyLegacy) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the BlockBodyLegacy object
func (*BlockBodyLegacy) MarshalSSZTo ¶
func (b *BlockBodyLegacy) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the BlockBodyLegacy object to a target array
func (*BlockBodyLegacy) SizeSSZ ¶
func (b *BlockBodyLegacy) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the BlockBodyLegacy object
func (*BlockBodyLegacy) UnmarshalSSZ ¶
func (b *BlockBodyLegacy) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the BlockBodyLegacy object
type BlockEpochData ¶
type BlockEpochData struct {
// contains filtered or unexported fields
}
type BlockHeaderProof ¶
type BlockHeaderProof struct { Selector BlockHeaderProofType Proof [][]byte `ssz-size:"15,32"` }
BlockHeaderProof is a ssz union type Union[None, AccumulatorProof]
func (*BlockHeaderProof) HashTreeRootWith ¶
func (p *BlockHeaderProof) HashTreeRootWith(_ ssz.HashWalker) (err error)
func (*BlockHeaderProof) MarshalSSZ ¶
func (p *BlockHeaderProof) MarshalSSZ() ([]byte, error)
func (*BlockHeaderProof) MarshalSSZTo ¶
func (p *BlockHeaderProof) MarshalSSZTo(buf []byte) (dst []byte, err error)
func (*BlockHeaderProof) SizeSSZ ¶
func (p *BlockHeaderProof) SizeSSZ() (size int)
func (*BlockHeaderProof) UnmarshalSSZ ¶
func (p *BlockHeaderProof) UnmarshalSSZ(buf []byte) (err error)
type BlockHeaderProofType ¶
type BlockHeaderProofType uint8
type BlockHeaderWithProof ¶
type BlockHeaderWithProof struct { Header []byte `ssz-max:"8192"` Proof *BlockHeaderProof `ssz-max:"512"` }
func BuildHeaderWithProof ¶
func BuildHeaderWithProof(header types.Header, epochAccumulator EpochAccumulator) (*BlockHeaderWithProof, error)
func DecodeBlockHeaderWithProof ¶
func DecodeBlockHeaderWithProof(content []byte) (*BlockHeaderWithProof, error)
func (*BlockHeaderWithProof) GetTree ¶
func (b *BlockHeaderWithProof) GetTree() (*ssz.Node, error)
GetTree ssz hashes the BlockHeaderWithProof object
func (*BlockHeaderWithProof) HashTreeRoot ¶
func (b *BlockHeaderWithProof) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the BlockHeaderWithProof object
func (*BlockHeaderWithProof) HashTreeRootWith ¶
func (b *BlockHeaderWithProof) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the BlockHeaderWithProof object with a hasher
func (*BlockHeaderWithProof) MarshalSSZ ¶
func (b *BlockHeaderWithProof) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the BlockHeaderWithProof object
func (*BlockHeaderWithProof) MarshalSSZTo ¶
func (b *BlockHeaderWithProof) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the BlockHeaderWithProof object to a target array
func (*BlockHeaderWithProof) SizeSSZ ¶
func (b *BlockHeaderWithProof) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the BlockHeaderWithProof object
func (*BlockHeaderWithProof) UnmarshalSSZ ¶
func (b *BlockHeaderWithProof) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the BlockHeaderWithProof object
type BlockNumberKey ¶
type BlockNumberKey view.Uint64View
type ContentKey ¶
type ContentKey struct {
// contains filtered or unexported fields
}
type ContentStorage ¶
type ContentStorage struct {
// contains filtered or unexported fields
}
func (*ContentStorage) Close ¶
func (p *ContentStorage) Close() error
func (*ContentStorage) ContentCount ¶
func (p *ContentStorage) ContentCount() (uint64, error)
ContentCount return the total content count
func (*ContentStorage) ContentSize ¶
func (p *ContentStorage) ContentSize() (uint64, error)
func (*ContentStorage) EstimateNewRadius ¶
EstimateNewRadius calculates an estimated new radius based on the current radius, used size, and storage capacity. The method takes the currentRadius as input and returns the estimated new radius and an error (if any). It calculates the size ratio of usedSize to storageCapacityInBytes and adjusts the currentRadius accordingly. If the size ratio is greater than 0, it performs the adjustment; otherwise, it returns the currentRadius unchanged. The method returns an error if there is any issue in determining the used size.
func (*ContentStorage) ForcePrune ¶
func (p *ContentStorage) ForcePrune(radius *uint256.Int) error
ForcePrune delete the content which distance is further than the given radius
func (*ContentStorage) Get ¶
func (p *ContentStorage) Get(contentKey []byte, contentId []byte) ([]byte, error)
Get the content according to the contentId
func (*ContentStorage) GetLargestDistance ¶
func (p *ContentStorage) GetLargestDistance() (*uint256.Int, error)
GetLargestDistance find the largest distance
func (*ContentStorage) Put ¶
func (p *ContentStorage) Put(contentKey []byte, contentId []byte, content []byte) error
func (*ContentStorage) Radius ¶
func (p *ContentStorage) Radius() *uint256.Int
func (*ContentStorage) ReclaimSpace ¶
func (p *ContentStorage) ReclaimSpace() error
ReclaimSpace reclaims space in the ContentStorage's SQLite database by performing a VACUUM operation. It returns an error if the VACUUM operation encounters any issues.
func (*ContentStorage) Size ¶
func (p *ContentStorage) Size() (uint64, error)
Size get database size, content size and similar
func (*ContentStorage) SizeByKey ¶
func (p *ContentStorage) SizeByKey(contentId []byte) (uint64, error)
func (*ContentStorage) SizeByKeys ¶
func (p *ContentStorage) SizeByKeys(ids [][]byte) (uint64, error)
func (*ContentStorage) SizeOutRadius ¶
func (p *ContentStorage) SizeOutRadius(radius *uint256.Int) (uint64, error)
func (*ContentStorage) UnusedSize ¶
func (p *ContentStorage) UnusedSize() (uint64, error)
func (*ContentStorage) UsedSize ¶
func (p *ContentStorage) UsedSize() (uint64, error)
UsedSize = Size - UnusedSize
type ContentType ¶
type ContentType byte
const ( BlockHeaderType ContentType = 0x00 BlockBodyType ContentType = 0x01 ReceiptsType ContentType = 0x02 BlockHeaderNumberType ContentType = 0x03 )
type EpochAccumulator ¶
type EpochAccumulator struct {
HeaderRecords [][]byte `ssz-size:"8192,64"`
}
func (*EpochAccumulator) GetTree ¶
func (e *EpochAccumulator) GetTree() (*ssz.Node, error)
GetTree ssz hashes the EpochAccumulator object
func (*EpochAccumulator) HashTreeRoot ¶
func (e *EpochAccumulator) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the EpochAccumulator object
func (*EpochAccumulator) HashTreeRootWith ¶
func (e *EpochAccumulator) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the EpochAccumulator object with a hasher
func (*EpochAccumulator) MarshalSSZ ¶
func (e *EpochAccumulator) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the EpochAccumulator object
func (*EpochAccumulator) MarshalSSZTo ¶
func (e *EpochAccumulator) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the EpochAccumulator object to a target array
func (*EpochAccumulator) SizeSSZ ¶
func (e *EpochAccumulator) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the EpochAccumulator object
func (*EpochAccumulator) UnmarshalSSZ ¶
func (e *EpochAccumulator) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the EpochAccumulator object
type HeaderRecord ¶
type HeaderRecord struct { BlockHash []byte `ssz-size:"32"` TotalDifficulty []byte `ssz-size:"32"` }
func (*HeaderRecord) GetTree ¶
func (h *HeaderRecord) GetTree() (*ssz.Node, error)
GetTree ssz hashes the HeaderRecord object
func (*HeaderRecord) HashTreeRoot ¶
func (h *HeaderRecord) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the HeaderRecord object
func (*HeaderRecord) HashTreeRootWith ¶
func (h *HeaderRecord) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the HeaderRecord object with a hasher
func (*HeaderRecord) MarshalSSZ ¶
func (h *HeaderRecord) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the HeaderRecord object
func (*HeaderRecord) MarshalSSZTo ¶
func (h *HeaderRecord) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the HeaderRecord object to a target array
func (*HeaderRecord) SizeSSZ ¶
func (h *HeaderRecord) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the HeaderRecord object
func (*HeaderRecord) UnmarshalSSZ ¶
func (h *HeaderRecord) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the HeaderRecord object
type HistoricalRoots ¶
func (HistoricalRoots) ByteLength ¶
func (h HistoricalRoots) ByteLength(spec *common.Spec) uint64
func (*HistoricalRoots) Deserialize ¶
func (h *HistoricalRoots) Deserialize(spec *common.Spec, dr *codec.DecodingReader) error
func (*HistoricalRoots) FixedLength ¶
func (h *HistoricalRoots) FixedLength(_ *common.Spec) uint64
func (HistoricalRoots) HashTreeRoot ¶
func (HistoricalRoots) Serialize ¶
func (h HistoricalRoots) Serialize(spec *common.Spec, w *codec.EncodingWriter) error
type HistoricalRootsAccumulator ¶
type HistoricalRootsAccumulator struct {
HistoricalRoots HistoricalRoots
}
func NewHistoricalRootsAccumulator ¶
func NewHistoricalRootsAccumulator(spec *common.Spec) (HistoricalRootsAccumulator, error)
func (HistoricalRootsAccumulator) VerifyPostMergePreCapellaHeader ¶
func (h HistoricalRootsAccumulator) VerifyPostMergePreCapellaHeader(blockNumber uint64, headerHash common.Root, proof *HistoricalRootsBlockProof) error
type HistoricalRootsBlockProof ¶
type HistoricalRootsBlockProof struct { BeaconBlockBodyProof BeaconBlockBodyProof `yaml:"beacon_block_body_proof" json:"beacon_block_body_proof"` BeaconBlockBodyRoot common.Root `yaml:"beacon_block_body_root" json:"beacon_block_body_root"` BeaconBlockHeaderProof BeaconBlockHeaderProof `yaml:"beacon_block_header_proof" json:"beacon_block_header_proof"` BeaconBlockHeaderRoot common.Root `yaml:"beacon_block_header_root" json:"beacon_block_header_root"` HistoricalRootsProof HistoricalRootsProof `yaml:"historical_roots_proof" json:"historical_roots_proof"` Slot common.Slot `yaml:"slot" json:"slot"` }
func (*HistoricalRootsBlockProof) ByteLength ¶
func (h *HistoricalRootsBlockProof) ByteLength(spec *common.Spec) uint64
func (*HistoricalRootsBlockProof) Deserialize ¶
func (h *HistoricalRootsBlockProof) Deserialize(dr *codec.DecodingReader) error
func (*HistoricalRootsBlockProof) FixedLength ¶
func (h *HistoricalRootsBlockProof) FixedLength(spec *common.Spec) uint64
func (*HistoricalRootsBlockProof) HashTreeRoot ¶
func (*HistoricalRootsBlockProof) Serialize ¶
func (h *HistoricalRootsBlockProof) Serialize(w *codec.EncodingWriter) error
type HistoricalRootsProof ¶
func (HistoricalRootsProof) ByteLength ¶
func (b HistoricalRootsProof) ByteLength() (out uint64)
func (*HistoricalRootsProof) Deserialize ¶
func (b *HistoricalRootsProof) Deserialize(dr *codec.DecodingReader) error
func (HistoricalRootsProof) FixedLength ¶
func (b HistoricalRootsProof) FixedLength() uint64
func (*HistoricalRootsProof) HashTreeRoot ¶
func (b *HistoricalRootsProof) HashTreeRoot(hFn tree.HashFn) common.Root
func (*HistoricalRootsProof) Serialize ¶
func (b *HistoricalRootsProof) Serialize(w *codec.EncodingWriter) error
type MasterAccumulator ¶
type MasterAccumulator struct {
HistoricalEpochs [][]byte `ssz-max:"1897,32" ssz-size:"?,32"`
}
func NewMasterAccumulator ¶
func NewMasterAccumulator() (MasterAccumulator, error)
func (MasterAccumulator) Contains ¶
func (f MasterAccumulator) Contains(epochHash []byte) bool
func (MasterAccumulator) GetBlockEpochDataForBlockNumber ¶
func (f MasterAccumulator) GetBlockEpochDataForBlockNumber(blockNumber uint64) BlockEpochData
func (*MasterAccumulator) GetTree ¶
func (m *MasterAccumulator) GetTree() (*ssz.Node, error)
GetTree ssz hashes the MasterAccumulator object
func (*MasterAccumulator) HashTreeRoot ¶
func (m *MasterAccumulator) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the MasterAccumulator object
func (*MasterAccumulator) HashTreeRootWith ¶
func (m *MasterAccumulator) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the MasterAccumulator object with a hasher
func (*MasterAccumulator) MarshalSSZ ¶
func (m *MasterAccumulator) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the MasterAccumulator object
func (*MasterAccumulator) MarshalSSZTo ¶
func (m *MasterAccumulator) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the MasterAccumulator object to a target array
func (*MasterAccumulator) SizeSSZ ¶
func (m *MasterAccumulator) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the MasterAccumulator object
func (*MasterAccumulator) UnmarshalSSZ ¶
func (m *MasterAccumulator) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the MasterAccumulator object
func (MasterAccumulator) VerifyAccumulatorProof ¶
func (f MasterAccumulator) VerifyAccumulatorProof(header types.Header, proof AccumulatorProof) (bool, error)
func (MasterAccumulator) VerifyHeader ¶
func (f MasterAccumulator) VerifyHeader(header types.Header, headerProof BlockHeaderProof) (bool, error)
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
func NewHistoryNetwork ¶
func NewHistoryNetwork(portalProtocol *portalwire.PortalProtocol, accu *MasterAccumulator) *Network
func (*Network) GetBlockBody ¶
func (*Network) GetBlockHeader ¶
func (*Network) GetReceipts ¶
type PortalBlockBodyShanghai ¶
type PortalBlockBodyShanghai struct { Transactions [][]byte `ssz-max:"16384,16777216"` Uncles []byte `ssz-max:"131072"` Withdrawals [][]byte `ssz-max:"16,192"` }
func (*PortalBlockBodyShanghai) GetTree ¶
func (p *PortalBlockBodyShanghai) GetTree() (*ssz.Node, error)
GetTree ssz hashes the PortalBlockBodyShanghai object
func (*PortalBlockBodyShanghai) HashTreeRoot ¶
func (p *PortalBlockBodyShanghai) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the PortalBlockBodyShanghai object
func (*PortalBlockBodyShanghai) HashTreeRootWith ¶
func (p *PortalBlockBodyShanghai) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the PortalBlockBodyShanghai object with a hasher
func (*PortalBlockBodyShanghai) MarshalSSZ ¶
func (p *PortalBlockBodyShanghai) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the PortalBlockBodyShanghai object
func (*PortalBlockBodyShanghai) MarshalSSZTo ¶
func (p *PortalBlockBodyShanghai) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the PortalBlockBodyShanghai object to a target array
func (*PortalBlockBodyShanghai) SizeSSZ ¶
func (p *PortalBlockBodyShanghai) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the PortalBlockBodyShanghai object
func (*PortalBlockBodyShanghai) UnmarshalSSZ ¶
func (p *PortalBlockBodyShanghai) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the PortalBlockBodyShanghai object
type PortalReceipts ¶
type PortalReceipts struct {
Receipts [][]byte `ssz-max:"16384,134217728"`
}
func ToPortalReceipts ¶
func ToPortalReceipts(receipts []*types.Receipt) (*PortalReceipts, error)
ToPortalReceipts convert types.Receipt to PortalReceipts
func (*PortalReceipts) GetTree ¶
func (p *PortalReceipts) GetTree() (*ssz.Node, error)
GetTree ssz hashes the PortalReceipts object
func (*PortalReceipts) HashTreeRoot ¶
func (p *PortalReceipts) HashTreeRoot() ([32]byte, error)
HashTreeRoot ssz hashes the PortalReceipts object
func (*PortalReceipts) HashTreeRootWith ¶
func (p *PortalReceipts) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the PortalReceipts object with a hasher
func (*PortalReceipts) MarshalSSZ ¶
func (p *PortalReceipts) MarshalSSZ() ([]byte, error)
MarshalSSZ ssz marshals the PortalReceipts object
func (*PortalReceipts) MarshalSSZTo ¶
func (p *PortalReceipts) MarshalSSZTo(buf []byte) (dst []byte, err error)
MarshalSSZTo ssz marshals the PortalReceipts object to a target array
func (*PortalReceipts) SizeSSZ ¶
func (p *PortalReceipts) SizeSSZ() (size int)
SizeSSZ returns the ssz encoded size in bytes for the PortalReceipts object
func (*PortalReceipts) UnmarshalSSZ ¶
func (p *PortalReceipts) UnmarshalSSZ(buf []byte) error
UnmarshalSSZ ssz unmarshals the PortalReceipts object
type PutResult ¶
type PutResult struct {
// contains filtered or unexported fields
}
func (*PutResult) PrunedCount ¶
type SSZProof ¶
type SSZProof struct { Leaf []byte `ssz-size:"32"` Witnesses [][]byte `ssz-max:"65536,32" ssz-size:"?,32"` }
func (*SSZProof) HashTreeRoot ¶
HashTreeRoot ssz hashes the SSZProof object
func (*SSZProof) HashTreeRootWith ¶
func (s *SSZProof) HashTreeRootWith(hh ssz.HashWalker) (err error)
HashTreeRootWith ssz hashes the SSZProof object with a hasher
func (*SSZProof) MarshalSSZ ¶
MarshalSSZ ssz marshals the SSZProof object
func (*SSZProof) MarshalSSZTo ¶
MarshalSSZTo ssz marshals the SSZProof object to a target array
func (*SSZProof) UnmarshalSSZ ¶
UnmarshalSSZ ssz unmarshals the SSZProof object