Documentation
¶
Index ¶
- Constants
- func ComputeKZGProof(tc *TreeConfig, poly []bls.Fr, z, y *bls.Fr) *bls.G1Point
- func MakeVerkleProofOneLeaf(root VerkleNode, key []byte) (d *bls.G1Point, y *bls.Fr, sigma *bls.G1Point)
- func VerifyVerkleProof(ks *kzg.KZGSettings, d, sigma *bls.G1Point, y *bls.Fr, ...) bool
- type Empty
- func (e Empty) ComputeCommitment() *bls.G1Point
- func (e Empty) Copy() VerkleNode
- func (e Empty) Delete(k []byte) error
- func (e Empty) Get(k []byte, _ NodeResolverFn) ([]byte, error)
- func (e Empty) GetCommitment() *bls.G1Point
- func (e Empty) GetCommitmentsAlongPath(key []byte) ([]*bls.G1Point, []*bls.Fr, []*bls.Fr, [][]bls.Fr)
- func (e Empty) Hash() common.Hash
- func (e Empty) Insert(k []byte, value []byte) error
- func (e Empty) InsertOrdered(key []byte, value []byte, _ chan FlushableNode) error
- func (e Empty) Serialize() ([]byte, error)
- type FlushableNode
- type HashedNode
- func (n *HashedNode) ComputeCommitment() *bls.G1Point
- func (n *HashedNode) Copy() VerkleNode
- func (n *HashedNode) Delete(k []byte) error
- func (n *HashedNode) Get(k []byte, _ NodeResolverFn) ([]byte, error)
- func (n *HashedNode) GetCommitment() *bls.G1Point
- func (n *HashedNode) GetCommitmentsAlongPath(key []byte) ([]*bls.G1Point, []*bls.Fr, []*bls.Fr, [][]bls.Fr)
- func (n *HashedNode) Hash() common.Hash
- func (n *HashedNode) Insert(k []byte, value []byte) error
- func (n *HashedNode) InsertOrdered(key []byte, value []byte, _ chan FlushableNode) error
- func (n *HashedNode) Serialize() ([]byte, error)
- type InternalNode
- func (n *InternalNode) Children() []VerkleNode
- func (n *InternalNode) ComputeCommitment() *bls.G1Point
- func (n *InternalNode) Copy() VerkleNode
- func (n *InternalNode) Delete(key []byte) error
- func (n *InternalNode) Depth() int
- func (n *InternalNode) Flush(flush chan FlushableNode)
- func (n *InternalNode) Get(k []byte, getter NodeResolverFn) ([]byte, error)
- func (n *InternalNode) GetCommitment() *bls.G1Point
- func (n *InternalNode) GetCommitmentsAlongPath(key []byte) ([]*bls.G1Point, []*bls.Fr, []*bls.Fr, [][]bls.Fr)
- func (n *InternalNode) Hash() common.Hash
- func (n *InternalNode) Insert(key []byte, value []byte) error
- func (n *InternalNode) InsertOrdered(key []byte, value []byte, flush chan FlushableNode) error
- func (n *InternalNode) Serialize() ([]byte, error)
- func (n *InternalNode) SetChild(i int, c VerkleNode) error
- func (n *InternalNode) SetDepth(depth int)
- func (n *InternalNode) Width() int
- type LeafNode
- func (n *LeafNode) ComputeCommitment() *bls.G1Point
- func (n *LeafNode) Copy() VerkleNode
- func (n *LeafNode) Delete(k []byte) error
- func (n *LeafNode) Get(k []byte, _ NodeResolverFn) ([]byte, error)
- func (n *LeafNode) GetCommitment() *bls.G1Point
- func (n *LeafNode) GetCommitmentsAlongPath(key []byte) ([]*bls.G1Point, []*bls.Fr, []*bls.Fr, [][]bls.Fr)
- func (n *LeafNode) Hash() common.Hash
- func (n *LeafNode) Insert(k []byte, value []byte) error
- func (n *LeafNode) InsertOrdered(key []byte, value []byte, flush chan FlushableNode) error
- func (n *LeafNode) Serialize() ([]byte, error)
- type NodeResolverFn
- type TreeConfig
- type VerkleNode
Constants ¶
const ErrInvalidNodeEncoding = "invalid node encoding"
Variables ¶
This section is empty.
Functions ¶
func ComputeKZGProof ¶
func MakeVerkleProofOneLeaf ¶
func VerifyVerkleProof ¶
Types ¶
type Empty ¶
type Empty struct{}
func (Empty) ComputeCommitment ¶
func (Empty) Copy ¶
func (e Empty) Copy() VerkleNode
func (Empty) GetCommitment ¶
func (Empty) GetCommitmentsAlongPath ¶
func (Empty) InsertOrdered ¶
func (e Empty) InsertOrdered(key []byte, value []byte, _ chan FlushableNode) error
type FlushableNode ¶
type FlushableNode struct {
Hash [32]byte
Node VerkleNode
}
FlushableNode is a tuple of a node and its hash, to be passed to a consumer (e.g. the routine responsible for saving it to the db) once the node is no longer used by the tree.
type HashedNode ¶
type HashedNode struct {
// contains filtered or unexported fields
}
func (*HashedNode) ComputeCommitment ¶
func (n *HashedNode) ComputeCommitment() *bls.G1Point
func (*HashedNode) Copy ¶
func (n *HashedNode) Copy() VerkleNode
func (*HashedNode) Delete ¶
func (n *HashedNode) Delete(k []byte) error
func (*HashedNode) Get ¶
func (n *HashedNode) Get(k []byte, _ NodeResolverFn) ([]byte, error)
func (*HashedNode) GetCommitment ¶
func (n *HashedNode) GetCommitment() *bls.G1Point
func (*HashedNode) GetCommitmentsAlongPath ¶
func (*HashedNode) Hash ¶
func (n *HashedNode) Hash() common.Hash
func (*HashedNode) InsertOrdered ¶
func (n *HashedNode) InsertOrdered(key []byte, value []byte, _ chan FlushableNode) error
func (*HashedNode) Serialize ¶
func (n *HashedNode) Serialize() ([]byte, error)
type InternalNode ¶
type InternalNode struct {
// contains filtered or unexported fields
}
Represents an internal node at any level
func (*InternalNode) Children ¶
func (n *InternalNode) Children() []VerkleNode
func (*InternalNode) ComputeCommitment ¶
func (n *InternalNode) ComputeCommitment() *bls.G1Point
func (*InternalNode) Copy ¶
func (n *InternalNode) Copy() VerkleNode
func (*InternalNode) Delete ¶
func (n *InternalNode) Delete(key []byte) error
func (*InternalNode) Depth ¶
func (n *InternalNode) Depth() int
func (*InternalNode) Flush ¶
func (n *InternalNode) Flush(flush chan FlushableNode)
Flush hashes the children of an internal node and replaces them with HashedNode. It also sends the current node on the flush channel.
func (*InternalNode) Get ¶
func (n *InternalNode) Get(k []byte, getter NodeResolverFn) ([]byte, error)
func (*InternalNode) GetCommitment ¶
func (n *InternalNode) GetCommitment() *bls.G1Point
func (*InternalNode) GetCommitmentsAlongPath ¶
func (*InternalNode) Hash ¶
func (n *InternalNode) Hash() common.Hash
func (*InternalNode) InsertOrdered ¶
func (n *InternalNode) InsertOrdered(key []byte, value []byte, flush chan FlushableNode) error
func (*InternalNode) Serialize ¶
func (n *InternalNode) Serialize() ([]byte, error)
func (*InternalNode) SetChild ¶
func (n *InternalNode) SetChild(i int, c VerkleNode) error
func (*InternalNode) SetDepth ¶
func (n *InternalNode) SetDepth(depth int)
func (*InternalNode) Width ¶
func (n *InternalNode) Width() int
type LeafNode ¶
type LeafNode struct {
// contains filtered or unexported fields
}
func (*LeafNode) ComputeCommitment ¶
func (*LeafNode) Copy ¶
func (n *LeafNode) Copy() VerkleNode
func (*LeafNode) GetCommitment ¶
func (*LeafNode) GetCommitmentsAlongPath ¶
func (*LeafNode) InsertOrdered ¶
func (n *LeafNode) InsertOrdered(key []byte, value []byte, flush chan FlushableNode) error
type NodeResolverFn ¶
type TreeConfig ¶
type TreeConfig struct {
// contains filtered or unexported fields
}
func GetTreeConfig ¶
func GetTreeConfig(width int) *TreeConfig
type VerkleNode ¶
type VerkleNode interface {
// Insert or Update value `v` at key `k`
Insert(k []byte, v []byte) error
// Insert "à la" Stacktrie. Same thing as insert, except that
// values are expected to be ordered, and the commitments and
// hashes for each subtrie are computed online, as soon as it
// is clear that no more values will be inserted in there.
InsertOrdered([]byte, []byte, chan FlushableNode) error
// Delete a leaf with the given key
Delete([]byte) error
// Get value at a given key
Get([]byte, NodeResolverFn) ([]byte, error)
// Hash of the current node
Hash() common.Hash
// ComputeCommitment computes the commitment of the node
ComputeCommitment() *bls.G1Point
// GetCommitment retrieves the (previously computed)
// commitment of a node.
GetCommitment() *bls.G1Point
// GetCommitmentAlongPath follows the path that one key
// traces through the tree, and collects the various
// elements needed to build a proof. The order of elements
// is from the bottom of the tree, up to the root.
GetCommitmentsAlongPath([]byte) ([]*bls.G1Point, []*bls.Fr, []*bls.Fr, [][]bls.Fr)
// Serialize encodes the node to RLP.
Serialize() ([]byte, error)
// Copy a node and its children
Copy() VerkleNode
}