Documentation ¶
Overview ¶
Package trie_blake2b_20 implements trie.CommitmentModel based on blake2b 32-byte hashing
Index ¶
- Constants
- Variables
- func CommitToDataRaw(data []byte, sz HashSize) []byte
- func HashTheVector(hashes [][]byte, arity trie.PathArity, sz HashSize) []byte
- type CommitmentModel
- func (m *CommitmentModel) CalcNodeCommitment(par *trie.NodeData) trie.VCommitment
- func (m *CommitmentModel) CommitToData(data []byte) trie.TCommitment
- func (m *CommitmentModel) Description() string
- func (m *CommitmentModel) EqualCommitments(c1, c2 trie.Serializable) bool
- func (m *CommitmentModel) ForceStoreTerminalWithNode(c trie.TCommitment) bool
- func (m *CommitmentModel) HashSize() HashSize
- func (m *CommitmentModel) NewTerminalCommitment() trie.TCommitment
- func (m *CommitmentModel) NewVectorCommitment() trie.VCommitment
- func (m *CommitmentModel) PathArity() trie.PathArity
- func (m *CommitmentModel) Proof(key []byte, tr trie.NodeStore) *Proof
- func (m *CommitmentModel) ShortName() string
- func (m *CommitmentModel) UpdateNodeCommitment(mutate *trie.NodeData, childUpdates map[byte]trie.VCommitment, _ bool, ...)
- type HashSize
- type Proof
- type ProofElement
Constants ¶
const ( HashSize160 = HashSize(20) HashSize256 = HashSize(32) )
Variables ¶
var AllHashSize = []HashSize{HashSize160, HashSize256}
Functions ¶
func CommitToDataRaw ¶
CommitToDataRaw commits to data
Types ¶
type CommitmentModel ¶
type CommitmentModel struct {
// contains filtered or unexported fields
}
CommitmentModel provides commitment model implementation for the 256+ trie
func New ¶
func New(arity trie.PathArity, hashSize HashSize, valueSizeOptimizationThreshold ...int) *CommitmentModel
New creates new CommitmentModel. Parameter valueSizeOptimizationThreshold means that for terminal commitments to values longer than threshold, the terminal commitments will always be stored with the trie node, i.e. ForceStoreTerminalWithNode will return true. For terminal commitments of this or smaller size, the choice depends on the trie setup Default valueSizeOptimizationThreshold = 0, which means that by default all values are stored in the node. If valueSizeOptimizationThreshold > 0 valueStore must be specified in the trie parameters Reasonable value of valueSizeOptimizationThreshold, allows significantly optimize trie storage without requiring hashing big data each time
func (*CommitmentModel) CalcNodeCommitment ¶
func (m *CommitmentModel) CalcNodeCommitment(par *trie.NodeData) trie.VCommitment
CalcNodeCommitment computes commitment of the node. It is suboptimal in KZG trie. Used in computing root commitment
func (*CommitmentModel) CommitToData ¶
func (m *CommitmentModel) CommitToData(data []byte) trie.TCommitment
func (*CommitmentModel) Description ¶
func (m *CommitmentModel) Description() string
func (*CommitmentModel) EqualCommitments ¶
func (m *CommitmentModel) EqualCommitments(c1, c2 trie.Serializable) bool
func (*CommitmentModel) ForceStoreTerminalWithNode ¶
func (m *CommitmentModel) ForceStoreTerminalWithNode(c trie.TCommitment) bool
func (*CommitmentModel) HashSize ¶
func (m *CommitmentModel) HashSize() HashSize
func (*CommitmentModel) NewTerminalCommitment ¶
func (m *CommitmentModel) NewTerminalCommitment() trie.TCommitment
NewTerminalCommitment creates empty terminal commitment
func (*CommitmentModel) NewVectorCommitment ¶
func (m *CommitmentModel) NewVectorCommitment() trie.VCommitment
NewVectorCommitment create empty vector commitment
func (*CommitmentModel) PathArity ¶
func (m *CommitmentModel) PathArity() trie.PathArity
func (*CommitmentModel) Proof ¶
func (m *CommitmentModel) Proof(key []byte, tr trie.NodeStore) *Proof
Proof converts generic proof path to the Merkle proof path
func (*CommitmentModel) ShortName ¶
func (m *CommitmentModel) ShortName() string
func (*CommitmentModel) UpdateNodeCommitment ¶
func (m *CommitmentModel) UpdateNodeCommitment(mutate *trie.NodeData, childUpdates map[byte]trie.VCommitment, _ bool, newTerminalUpdate trie.TCommitment, update *trie.VCommitment)
UpdateNodeCommitment computes update to the node data and, optionally, updates existing commitment In blake2b implementation delta it just means computing the hash of data
type Proof ¶
type Proof struct { PathArity trie.PathArity HashSize HashSize Key []byte Path []*ProofElement }
Proof blake2b 20 byte model-specific proof of inclusion