Documentation ¶
Index ¶
- Constants
- type API
- func (p *API) StateAddEnr(enr string) (bool, error)
- func (p *API) StateDeleteEnr(nodeId string) (bool, error)
- func (p *API) StateFindContent(enr string, contentKey string) (interface{}, error)
- func (p *API) StateFindNodes(enr string, distances []uint) ([]string, error)
- func (p *API) StateGetContent(contentKeyHex string) (*portalwire.ContentInfo, error)
- func (p *API) StateGetEnr(nodeId string) (string, error)
- func (p *API) StateGossip(contentKeyHex, contentHex string) (int, error)
- func (p *API) StateLocalContent(contentKeyHex string) (string, error)
- func (p *API) StateLookupEnr(nodeId string) (string, error)
- func (p *API) StateOffer(enr string, contentItems [][2]string) (string, error)
- func (p *API) StatePing(enr string) (*portalwire.PortalPongResp, error)
- func (p *API) StateRecursiveFindNodes(nodeId string) ([]string, error)
- func (p *API) StateRoutingTableInfo() *portalwire.RoutingTableInfo
- func (p *API) StateStore(contentKeyHex string, contextHex string) (bool, error)
- func (p *API) StateTraceGetContent(contentKeyHex string) (*portalwire.TraceContentResult, error)
- type AccountTrieNodeKey
- func (a *AccountTrieNodeKey) ByteLength(spec *common.Spec) uint64
- func (a *AccountTrieNodeKey) Deserialize(dr *codec.DecodingReader) error
- func (a *AccountTrieNodeKey) FixedLength(spec *common.Spec) uint64
- func (a *AccountTrieNodeKey) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root
- func (a *AccountTrieNodeKey) Serialize(w *codec.EncodingWriter) error
- type AccountTrieNodeWithProof
- func (a *AccountTrieNodeWithProof) ByteLength() uint64
- func (a *AccountTrieNodeWithProof) Deserialize(dr *codec.DecodingReader) error
- func (a *AccountTrieNodeWithProof) FixedLength() uint64
- func (a *AccountTrieNodeWithProof) HashTreeRoot(hFn tree.HashFn) common.Root
- func (a *AccountTrieNodeWithProof) Serialize(w *codec.EncodingWriter) error
- type ContractByteCode
- func (t ContractByteCode) ByteLength() (out uint64)
- func (t *ContractByteCode) Deserialize(dr *codec.DecodingReader) error
- func (t *ContractByteCode) FixedLength() uint64
- func (t ContractByteCode) HashTreeRoot(hFn tree.HashFn) tree.Root
- func (t ContractByteCode) Serialize(w *codec.EncodingWriter) error
- type ContractBytecodeContainer
- func (t ContractBytecodeContainer) ByteLength() (out uint64)
- func (t *ContractBytecodeContainer) Deserialize(dr *codec.DecodingReader) error
- func (t *ContractBytecodeContainer) FixedLength() uint64
- func (t ContractBytecodeContainer) HashTreeRoot(hFn tree.HashFn) tree.Root
- func (t ContractBytecodeContainer) Serialize(w *codec.EncodingWriter) error
- type ContractBytecodeKey
- func (c *ContractBytecodeKey) ByteLength(spec *common.Spec) uint64
- func (c *ContractBytecodeKey) Deserialize(dr *codec.DecodingReader) error
- func (c *ContractBytecodeKey) FixedLength(spec *common.Spec) uint64
- func (c *ContractBytecodeKey) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root
- func (c *ContractBytecodeKey) Serialize(w *codec.EncodingWriter) error
- type ContractBytecodeWithProof
- func (c *ContractBytecodeWithProof) ByteLength() uint64
- func (c *ContractBytecodeWithProof) Deserialize(dr *codec.DecodingReader) error
- func (c *ContractBytecodeWithProof) FixedLength() uint64
- func (c *ContractBytecodeWithProof) HashTreeRoot(hFn tree.HashFn) common.Root
- func (c *ContractBytecodeWithProof) Serialize(w *codec.EncodingWriter) error
- type ContractStorageTrieNodeKey
- func (c *ContractStorageTrieNodeKey) ByteLength(spec *common.Spec) uint64
- func (c *ContractStorageTrieNodeKey) Deserialize(dr *codec.DecodingReader) error
- func (c *ContractStorageTrieNodeKey) FixedLength(spec *common.Spec) uint64
- func (c *ContractStorageTrieNodeKey) HashTreeRoot(spec *common.Spec, hFn tree.HashFn) common.Root
- func (c *ContractStorageTrieNodeKey) Serialize(w *codec.EncodingWriter) error
- type ContractStorageTrieNodeWithProof
- func (c *ContractStorageTrieNodeWithProof) ByteLength() uint64
- func (c *ContractStorageTrieNodeWithProof) Deserialize(dr *codec.DecodingReader) error
- func (c *ContractStorageTrieNodeWithProof) FixedLength() uint64
- func (c *ContractStorageTrieNodeWithProof) HashTreeRoot(hFn tree.HashFn) common.Root
- func (c *ContractStorageTrieNodeWithProof) Serialize(w *codec.EncodingWriter) error
- type EncodedTrieNode
- func (e EncodedTrieNode) ByteLength() (out uint64)
- func (e *EncodedTrieNode) Deserialize(dr *codec.DecodingReader) error
- func (e *EncodedTrieNode) FixedLength() uint64
- func (e EncodedTrieNode) HashTreeRoot(hFn tree.HashFn) tree.Root
- func (e *EncodedTrieNode) NodeHash() common.Bytes32
- func (e EncodedTrieNode) Serialize(w *codec.EncodingWriter) error
- type Network
- type Nibbles
- type Storage
- type TrieNode
- type TrieProof
Constants ¶
View Source
const ( AccountTrieNodeType byte = 0x20 ContractStorageTrieNodeType byte = 0x21 ContractByteCodeType byte = 0x22 )
View Source
const MaxContractBytecodeLength = 32768
View Source
const MaxTrieNodeLength = 1024
View Source
const MaxTrieProofLength = 65
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type API ¶
type API struct {
*portalwire.PortalProtocolAPI
}
func NewStateNetworkAPI ¶
func NewStateNetworkAPI(portalProtocolAPI *portalwire.PortalProtocolAPI) *API
func (*API) StateFindContent ¶
func (*API) StateFindNodes ¶
func (*API) StateGetContent ¶
func (p *API) StateGetContent(contentKeyHex string) (*portalwire.ContentInfo, error)
func (*API) StateLocalContent ¶
func (*API) StateOffer ¶
func (*API) StatePing ¶
func (p *API) StatePing(enr string) (*portalwire.PortalPongResp, error)
func (*API) StateRecursiveFindNodes ¶
func (*API) StateRoutingTableInfo ¶
func (p *API) StateRoutingTableInfo() *portalwire.RoutingTableInfo
func (*API) StateStore ¶
func (*API) StateTraceGetContent ¶
func (p *API) StateTraceGetContent(contentKeyHex string) (*portalwire.TraceContentResult, error)
type AccountTrieNodeKey ¶
AccountTrieNodeKey test data from https://github.com/ethereum/portal-network-specs/blob/master/state/state-network-test-vectors.md
func (*AccountTrieNodeKey) ByteLength ¶
func (a *AccountTrieNodeKey) ByteLength(spec *common.Spec) uint64
func (*AccountTrieNodeKey) Deserialize ¶
func (a *AccountTrieNodeKey) Deserialize(dr *codec.DecodingReader) error
func (*AccountTrieNodeKey) FixedLength ¶
func (a *AccountTrieNodeKey) FixedLength(spec *common.Spec) uint64
func (*AccountTrieNodeKey) HashTreeRoot ¶
func (*AccountTrieNodeKey) Serialize ¶
func (a *AccountTrieNodeKey) Serialize(w *codec.EncodingWriter) error
type AccountTrieNodeWithProof ¶
type AccountTrieNodeWithProof struct { /// An proof for the account trie node. Proof TrieProof /// A block at which the proof is anchored. BlockHash common.Bytes32 }
AccountTrieNodeWithProof A content value type, used when offering a trie node from the account trie.
func (*AccountTrieNodeWithProof) ByteLength ¶
func (a *AccountTrieNodeWithProof) ByteLength() uint64
func (*AccountTrieNodeWithProof) Deserialize ¶
func (a *AccountTrieNodeWithProof) Deserialize(dr *codec.DecodingReader) error
func (*AccountTrieNodeWithProof) FixedLength ¶
func (a *AccountTrieNodeWithProof) FixedLength() uint64
func (*AccountTrieNodeWithProof) HashTreeRoot ¶
func (a *AccountTrieNodeWithProof) HashTreeRoot(hFn tree.HashFn) common.Root
func (*AccountTrieNodeWithProof) Serialize ¶
func (a *AccountTrieNodeWithProof) Serialize(w *codec.EncodingWriter) error
type ContractByteCode ¶
type ContractByteCode []byte
func (ContractByteCode) ByteLength ¶
func (t ContractByteCode) ByteLength() (out uint64)
func (*ContractByteCode) Deserialize ¶
func (t *ContractByteCode) Deserialize(dr *codec.DecodingReader) error
func (*ContractByteCode) FixedLength ¶
func (t *ContractByteCode) FixedLength() uint64
func (ContractByteCode) HashTreeRoot ¶
func (t ContractByteCode) HashTreeRoot(hFn tree.HashFn) tree.Root
func (ContractByteCode) Serialize ¶
func (t ContractByteCode) Serialize(w *codec.EncodingWriter) error
type ContractBytecodeContainer ¶
type ContractBytecodeContainer struct {
Code ContractByteCode
}
ContractBytecodeContainer A content value type, used when retrieving contract's bytecode.
func (ContractBytecodeContainer) ByteLength ¶
func (t ContractBytecodeContainer) ByteLength() (out uint64)
func (*ContractBytecodeContainer) Deserialize ¶
func (t *ContractBytecodeContainer) Deserialize(dr *codec.DecodingReader) error
func (*ContractBytecodeContainer) FixedLength ¶
func (t *ContractBytecodeContainer) FixedLength() uint64
func (ContractBytecodeContainer) HashTreeRoot ¶
func (t ContractBytecodeContainer) HashTreeRoot(hFn tree.HashFn) tree.Root
func (ContractBytecodeContainer) Serialize ¶
func (t ContractBytecodeContainer) Serialize(w *codec.EncodingWriter) error
type ContractBytecodeKey ¶
func (*ContractBytecodeKey) ByteLength ¶
func (c *ContractBytecodeKey) ByteLength(spec *common.Spec) uint64
func (*ContractBytecodeKey) Deserialize ¶
func (c *ContractBytecodeKey) Deserialize(dr *codec.DecodingReader) error
func (*ContractBytecodeKey) FixedLength ¶
func (c *ContractBytecodeKey) FixedLength(spec *common.Spec) uint64
func (*ContractBytecodeKey) HashTreeRoot ¶
func (*ContractBytecodeKey) Serialize ¶
func (c *ContractBytecodeKey) Serialize(w *codec.EncodingWriter) error
type ContractBytecodeWithProof ¶
type ContractBytecodeWithProof struct { // A contract's bytecode. Code ContractByteCode // A proof for the account state of the corresponding contract. AccountProof TrieProof // A block at which the proof is anchored. BlockHash common.Bytes32 }
ContractBytecodeWithProof A content value type, used when offering contract's bytecode.
func (*ContractBytecodeWithProof) ByteLength ¶
func (c *ContractBytecodeWithProof) ByteLength() uint64
func (*ContractBytecodeWithProof) Deserialize ¶
func (c *ContractBytecodeWithProof) Deserialize(dr *codec.DecodingReader) error
func (*ContractBytecodeWithProof) FixedLength ¶
func (c *ContractBytecodeWithProof) FixedLength() uint64
func (*ContractBytecodeWithProof) HashTreeRoot ¶
func (c *ContractBytecodeWithProof) HashTreeRoot(hFn tree.HashFn) common.Root
func (*ContractBytecodeWithProof) Serialize ¶
func (c *ContractBytecodeWithProof) Serialize(w *codec.EncodingWriter) error
type ContractStorageTrieNodeKey ¶
type ContractStorageTrieNodeKey struct { AddressHash common.Bytes32 Path Nibbles NodeHash common.Bytes32 }
func (*ContractStorageTrieNodeKey) ByteLength ¶
func (c *ContractStorageTrieNodeKey) ByteLength(spec *common.Spec) uint64
func (*ContractStorageTrieNodeKey) Deserialize ¶
func (c *ContractStorageTrieNodeKey) Deserialize(dr *codec.DecodingReader) error
func (*ContractStorageTrieNodeKey) FixedLength ¶
func (c *ContractStorageTrieNodeKey) FixedLength(spec *common.Spec) uint64
func (*ContractStorageTrieNodeKey) HashTreeRoot ¶
func (*ContractStorageTrieNodeKey) Serialize ¶
func (c *ContractStorageTrieNodeKey) Serialize(w *codec.EncodingWriter) error
type ContractStorageTrieNodeWithProof ¶
type ContractStorageTrieNodeWithProof struct { // A proof for the contract storage trie node. StorageProof TrieProof // A proof for the account state. AccountProof TrieProof // A block at which the proof is anchored. BlockHash common.Bytes32 }
ContractStorageTrieNodeWithProof A content value type, used when offering a trie node from the contract storage trie.
func (*ContractStorageTrieNodeWithProof) ByteLength ¶
func (c *ContractStorageTrieNodeWithProof) ByteLength() uint64
func (*ContractStorageTrieNodeWithProof) Deserialize ¶
func (c *ContractStorageTrieNodeWithProof) Deserialize(dr *codec.DecodingReader) error
func (*ContractStorageTrieNodeWithProof) FixedLength ¶
func (c *ContractStorageTrieNodeWithProof) FixedLength() uint64
func (*ContractStorageTrieNodeWithProof) HashTreeRoot ¶
func (c *ContractStorageTrieNodeWithProof) HashTreeRoot(hFn tree.HashFn) common.Root
func (*ContractStorageTrieNodeWithProof) Serialize ¶
func (c *ContractStorageTrieNodeWithProof) Serialize(w *codec.EncodingWriter) error
type EncodedTrieNode ¶
type EncodedTrieNode []byte
func (EncodedTrieNode) ByteLength ¶
func (e EncodedTrieNode) ByteLength() (out uint64)
func (*EncodedTrieNode) Deserialize ¶
func (e *EncodedTrieNode) Deserialize(dr *codec.DecodingReader) error
func (*EncodedTrieNode) FixedLength ¶
func (e *EncodedTrieNode) FixedLength() uint64
func (EncodedTrieNode) HashTreeRoot ¶
func (e EncodedTrieNode) HashTreeRoot(hFn tree.HashFn) tree.Root
func (*EncodedTrieNode) NodeHash ¶
func (e *EncodedTrieNode) NodeHash() common.Bytes32
func (EncodedTrieNode) Serialize ¶
func (e EncodedTrieNode) Serialize(w *codec.EncodingWriter) error
type Network ¶
type Network struct {
// contains filtered or unexported fields
}
func NewStateNetwork ¶
func NewStateNetwork(portalProtocol *portalwire.PortalProtocol, client *rpc.Client) *Network
type Nibbles ¶
type Nibbles struct {
Nibbles []byte
}
func FromUnpackedNibbles ¶
func (*Nibbles) ByteLength ¶
func (*Nibbles) Deserialize ¶
func (n *Nibbles) Deserialize(dr *codec.DecodingReader) error
func (*Nibbles) FixedLength ¶
type Storage ¶
type Storage struct {
// contains filtered or unexported fields
}
func NewStateStorage ¶
func NewStateStorage(store storage.ContentStorage, db *pebble.DB) *Storage
type TrieNode ¶
type TrieNode struct {
Node EncodedTrieNode
}
TrieNode A content value type, used when retrieving a trie node.
func (TrieNode) ByteLength ¶
func (*TrieNode) Deserialize ¶
func (t *TrieNode) Deserialize(dr *codec.DecodingReader) error
func (*TrieNode) FixedLength ¶
type TrieProof ¶
type TrieProof []EncodedTrieNode
func (TrieProof) ByteLength ¶
func (*TrieProof) Deserialize ¶
func (r *TrieProof) Deserialize(dr *codec.DecodingReader) error
func (*TrieProof) FixedLength ¶
Click to show internal directories.
Click to hide internal directories.