@@ -557,14 +557,14 @@ func DeserializeNode(serialized []byte, depth int) (BinaryNode, error) {
557557 }
558558}
559559
560- // VerkleTrie is a wrapper around VerkleNode that implements the trie.Trie
560+ // BinaryTrie is a wrapper around VerkleNode that implements the trie.Trie
561561// interface so that Verkle trees can be reused verbatim.
562- type VerkleTrie struct {
562+ type BinaryTrie struct {
563563 root BinaryNode
564564 db * Database
565565}
566566
567- func (vt * VerkleTrie ) ToDot () string {
567+ func (vt * BinaryTrie ) ToDot () string {
568568 vt .root .Commit ()
569569 return vt .root .toDot ("" , "" )
570570}
@@ -586,14 +586,14 @@ func (n *InternalNode) toDot(parent, path string) string {
586586 return ret
587587}
588588
589- func NewVerkleTrie (root BinaryNode , db * Database , ended bool ) * VerkleTrie {
590- return & VerkleTrie {
589+ func NewVerkleTrie (root BinaryNode , db * Database , ended bool ) * BinaryTrie {
590+ return & BinaryTrie {
591591 root : root ,
592592 db : db ,
593593 }
594594}
595595
596- func (trie * VerkleTrie ) FlatdbNodeResolver (path []byte ) ([]byte , error ) {
596+ func (trie * BinaryTrie ) FlatdbNodeResolver (path []byte ) ([]byte , error ) {
597597 return trie .db .diskdb .Get (append (FlatDBVerkleNodeKeyPrefix , path ... ))
598598}
599599
@@ -614,24 +614,24 @@ var (
614614
615615// GetKey returns the sha3 preimage of a hashed key that was previously used
616616// to store a value.
617- func (trie * VerkleTrie ) GetKey (key []byte ) []byte {
617+ func (trie * BinaryTrie ) GetKey (key []byte ) []byte {
618618 return key
619619}
620620
621621// Get returns the value for key stored in the trie. The value bytes must
622622// not be modified by the caller. If a node was not found in the database, a
623623// trie.MissingNodeError is returned.
624- func (trie * VerkleTrie ) GetStorage (addr common.Address , key []byte ) ([]byte , error ) {
624+ func (trie * BinaryTrie ) GetStorage (addr common.Address , key []byte ) ([]byte , error ) {
625625 return trie .root .Get (utils .GetTreeKey (addr , key ), trie .FlatdbNodeResolver )
626626}
627627
628628// GetWithHashedKey returns the value, assuming that the key has already
629629// been hashed.
630- func (trie * VerkleTrie ) GetWithHashedKey (key []byte ) ([]byte , error ) {
630+ func (trie * BinaryTrie ) GetWithHashedKey (key []byte ) ([]byte , error ) {
631631 return trie .root .Get (key , trie .FlatdbNodeResolver )
632632}
633633
634- func (t * VerkleTrie ) GetAccount (addr common.Address ) (* types.StateAccount , error ) {
634+ func (t * BinaryTrie ) GetAccount (addr common.Address ) (* types.StateAccount , error ) {
635635 acc := & types.StateAccount {}
636636 versionkey := utils .GetTreeKey (addr , zero [:])
637637 var (
@@ -685,7 +685,7 @@ func (t *VerkleTrie) GetAccount(addr common.Address) (*types.StateAccount, error
685685
686686var zero [32 ]byte
687687
688- func (t * VerkleTrie ) UpdateAccount (addr common.Address , acc * types.StateAccount , codeLen int ) error {
688+ func (t * BinaryTrie ) UpdateAccount (addr common.Address , acc * types.StateAccount , codeLen int ) error {
689689 var (
690690 err error
691691 basicData [32 ]byte
@@ -712,7 +712,7 @@ func (t *VerkleTrie) UpdateAccount(addr common.Address, acc *types.StateAccount,
712712 return err
713713}
714714
715- func (trie * VerkleTrie ) UpdateStem (key []byte , values [][]byte ) error {
715+ func (trie * BinaryTrie ) UpdateStem (key []byte , values [][]byte ) error {
716716 var err error
717717 trie .root , err = trie .root .InsertValuesAtStem (key , values , trie .FlatdbNodeResolver , 0 )
718718 return err
@@ -722,7 +722,7 @@ func (trie *VerkleTrie) UpdateStem(key []byte, values [][]byte) error {
722722// existing value is deleted from the trie. The value bytes must not be modified
723723// by the caller while they are stored in the trie. If a node was not found in the
724724// database, a trie.MissingNodeError is returned.
725- func (trie * VerkleTrie ) UpdateStorage (address common.Address , key , value []byte ) error {
725+ func (trie * BinaryTrie ) UpdateStorage (address common.Address , key , value []byte ) error {
726726 k := utils .GetTreeKeyStorageSlot (address , key )
727727 var v [32 ]byte
728728 if len (value ) >= 32 {
@@ -738,13 +738,13 @@ func (trie *VerkleTrie) UpdateStorage(address common.Address, key, value []byte)
738738 return nil
739739}
740740
741- func (t * VerkleTrie ) DeleteAccount (addr common.Address ) error {
741+ func (t * BinaryTrie ) DeleteAccount (addr common.Address ) error {
742742 return nil
743743}
744744
745745// Delete removes any existing value for key from the trie. If a node was not
746746// found in the database, a trie.MissingNodeError is returned.
747- func (trie * VerkleTrie ) DeleteStorage (addr common.Address , key []byte ) error {
747+ func (trie * BinaryTrie ) DeleteStorage (addr common.Address , key []byte ) error {
748748 k := utils .GetTreeKey (addr , key )
749749 var zero [32 ]byte
750750 root , err := trie .root .Insert (k , zero [:], trie .FlatdbNodeResolver )
@@ -757,13 +757,13 @@ func (trie *VerkleTrie) DeleteStorage(addr common.Address, key []byte) error {
757757
758758// Hash returns the root hash of the trie. It does not write to the database and
759759// can be used even if the trie doesn't have one.
760- func (trie * VerkleTrie ) Hash () common.Hash {
760+ func (trie * BinaryTrie ) Hash () common.Hash {
761761 return trie .root .Commit ()
762762}
763763
764764// Commit writes all nodes to the trie's memory database, tracking the internal
765765// and external (for account tries) references.
766- func (trie * VerkleTrie ) Commit (_ bool ) (common.Hash , * trienode.NodeSet , error ) {
766+ func (trie * BinaryTrie ) Commit (_ bool ) (common.Hash , * trienode.NodeSet , error ) {
767767 root := trie .root .(* InternalNode )
768768 nodeset := trienode .NewNodeSet (common.Hash {})
769769
@@ -781,7 +781,7 @@ func (trie *VerkleTrie) Commit(_ bool) (common.Hash, *trienode.NodeSet, error) {
781781
782782// NodeIterator returns an iterator that returns nodes of the trie. Iteration
783783// starts at the key after the given start key.
784- func (trie * VerkleTrie ) NodeIterator (startKey []byte ) (NodeIterator , error ) {
784+ func (trie * BinaryTrie ) NodeIterator (startKey []byte ) (NodeIterator , error ) {
785785 return newVerkleNodeIterator (trie , nil )
786786}
787787
@@ -792,18 +792,18 @@ func (trie *VerkleTrie) NodeIterator(startKey []byte) (NodeIterator, error) {
792792// If the trie does not contain a value for key, the returned proof contains all
793793// nodes of the longest existing prefix of the key (at least the root), ending
794794// with the node that proves the absence of the key.
795- func (trie * VerkleTrie ) Prove (key []byte , proofDb ethdb.KeyValueWriter ) error {
795+ func (trie * BinaryTrie ) Prove (key []byte , proofDb ethdb.KeyValueWriter ) error {
796796 panic ("not implemented" )
797797}
798798
799- func (trie * VerkleTrie ) Copy () * VerkleTrie {
800- return & VerkleTrie {
799+ func (trie * BinaryTrie ) Copy () * BinaryTrie {
800+ return & BinaryTrie {
801801 root : trie .root .Copy (),
802802 db : trie .db ,
803803 }
804804}
805805
806- func (trie * VerkleTrie ) IsVerkle () bool {
806+ func (trie * BinaryTrie ) IsVerkle () bool {
807807 return true
808808}
809809
@@ -815,7 +815,7 @@ func SerializeProof(proof *verkle.VerkleProof) (*verkle.VerkleProof, verkle.Stat
815815 return nil , nil , nil
816816}
817817
818- func ProveAndSerialize (pretrie , posttrie * VerkleTrie , keys [][]byte , resolver NodeResolverFn ) (* verkle.VerkleProof , verkle.StateDiff , error ) {
818+ func ProveAndSerialize (pretrie , posttrie * BinaryTrie , keys [][]byte , resolver NodeResolverFn ) (* verkle.VerkleProof , verkle.StateDiff , error ) {
819819 var postroot BinaryNode
820820 if posttrie != nil {
821821 postroot = posttrie .root
@@ -896,16 +896,16 @@ func ChunkifyCode(code []byte) ChunkedCode {
896896 return chunks
897897}
898898
899- func (t * VerkleTrie ) SetStorageRootConversion (addr common.Address , root common.Hash ) {
899+ func (t * BinaryTrie ) SetStorageRootConversion (addr common.Address , root common.Hash ) {
900900 t .db .SetStorageRootConversion (addr , root )
901901}
902902
903- func (t * VerkleTrie ) ClearStrorageRootConversion (addr common.Address ) {
903+ func (t * BinaryTrie ) ClearStrorageRootConversion (addr common.Address ) {
904904 t .db .ClearStorageRootConversion (addr )
905905}
906906
907907// Note: the basic data leaf needs to have been previously created for this to work
908- func (t * VerkleTrie ) UpdateContractCode (addr common.Address , codeHash common.Hash , code []byte ) error {
908+ func (t * BinaryTrie ) UpdateContractCode (addr common.Address , codeHash common.Hash , code []byte ) error {
909909 var (
910910 chunks = ChunkifyCode (code )
911911 values [][]byte
0 commit comments