Documentation ¶
Index ¶
- func GenKeys(n int) []*kvpair
- func GenKeysISCP(total, numSC int) []*kvpair
- func HasAllKeys(st *State, kvpairs []*kvpair) bool
- func NewSimpleKVStore() *kvStoreSimple
- func PrintSizeDistrib(t *testing.T, distrib map[int]int)
- func RandomizeKeys(pairs []*kvpair) []*kvpair
- func UpdateKeys(st *State, pairs []*kvpair) kyber.Point
- func VerifyProof(ts *kzg.TrustedSetup, proof *Proof) error
- type KVStore
- type Node
- type Proof
- type ProofElement
- type State
- func (st *State) Check(ts *kzg.TrustedSetup) bool
- func (st *State) FlushCaches()
- func (st *State) GetNode(key []byte) (*Node, bool)
- func (st *State) GetValue(key []byte) ([]byte, bool)
- func (st *State) NewNode(key []byte) (*Node, error)
- func (st *State) NodeFromBytes(data []byte) (*Node, error)
- func (st *State) Prove(key []byte) (*Proof, bool)
- func (st *State) ProveStr(key string) (*Proof, bool)
- func (st *State) RootCommitment(ret ...kyber.Point) kyber.Point
- func (st *State) StoreNode(key []byte, node *Node)
- func (st *State) StoreValue(key, value []byte)
- func (st *State) StringTrie() string
- func (st *State) Update(key, value []byte)
- func (st *State) UpdateStr(key, value string)
- type StatsKVStore
- type StatsTrie
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenKeysISCP ¶
func GenKeysISCP(total, numSC int) []*kvpair
func HasAllKeys ¶
func NewSimpleKVStore ¶
func NewSimpleKVStore() *kvStoreSimple
func RandomizeKeys ¶
func RandomizeKeys(pairs []*kvpair) []*kvpair
func UpdateKeys ¶
func UpdateKeys(st *State, pairs []*kvpair) kyber.Point
func VerifyProof ¶
func VerifyProof(ts *kzg.TrustedSetup, proof *Proof) error
Types ¶
type KVStore ¶
type KVStore interface { Set(k []byte, v []byte) Del(k []byte) Get(k []byte) ([]byte, bool) Has(k []byte) bool Partition(prefix string) KVStore Keys() []string Size() int }
KVStore abstract interface only used in this trie implementation
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node is a node of the 257-ary verkle trie
func (*Node) Commit ¶
func (n *Node) Commit(ts *kzg.TrustedSetup) kyber.Point
Commit calculates commitment of the node from child commitments
func (*Node) Vector ¶
func (n *Node) Vector(ts *kzg.TrustedSetup, ret *[257]kyber.Scalar)
Vector extracts vector from the node
type Proof ¶
type Proof struct { Key []byte Value []byte Path []*ProofElement }
func (*Proof) IsProofOfAbsence ¶
func (*Proof) RootCommitment ¶
func (pr *Proof) RootCommitment(ret kyber.Point)
type ProofElement ¶
type ProofElement struct { C kyber.Point // vector (node) commitment Index int Proof kyber.Point }
type State ¶
type State struct {
// contains filtered or unexported fields
}
State represents kv store plus trie
func NewState ¶
func NewState(ts *kzg.TrustedSetup) *State
func (*State) Check ¶
func (st *State) Check(ts *kzg.TrustedSetup) bool
Check checks consistency with the provided trusted setup The trie always has to contain proof of binary data of the trusted setup present at nil key
func (*State) FlushCaches ¶
func (st *State) FlushCaches()
func (*State) NodeFromBytes ¶
NodeFromBytes
func (*State) Prove ¶
Prove return a valid proof. If the key is present in the state, it contains the proof of presence of it in the key If the key is absent, the field Value == nil and the proof is a prove of commitment to 0 value in the last element of the path
func (*State) RootCommitment ¶
func (st *State) RootCommitment(ret ...kyber.Point) kyber.Point
func (*State) StoreValue ¶
func (*State) StringTrie ¶
type StatsKVStore ¶
func GetStatsKVStore ¶
func GetStatsKVStore(kvs KVStore) *StatsKVStore
Click to show internal directories.
Click to hide internal directories.