Skip to content

Code Refactoring #78

Description

@Bhargavasomu

What was wrong?

The whole code base is a bit hard to read and could be structured better.

How can it be fixed?

The code base can be refactored with the following improvements

  • Make seperate classes for Leaf Nodes, Branch Nodes, Extension Nodes which in turn inherit a common class BaseNode. The class BaseNode should contain the following
    • Type of the Node (Leaf or Branch or Extension)
    • List of all the keys contained in the Node - (List of size 1 for Extension and Leaf nodes. List of size 16 for Branch nodes).
    • value contained in the node (If has nothing, then Null)
    • get_all_children method
    • Node Encode and Decode methods
    • parse_node method
  • Common BaseTrie class should be implemented from which the BinaryTrie and the HexaryTrie should be implemented.
  • Changing the test cases correspondingly to the above changes
  • Adding Benchmarks to compare the performance (benchmark architecture similar to py-evm)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions