Extension

📖 Definition:

An Extension Node in the MPT is designed to represent a shared path segment within the trie. Unlike the Leaf Node, it does not store actual data values. Instead, it serves to optimize and reduce the depth of the trie by consolidating shared paths.

📌 Key Characteristics:

  1. Path Consolidator: An Extension Node is essentially a pathway shortener. By capturing shared segments of keys in the trie, it reduces the depth and complexity of the tree structure.

  2. Single Child: Unlike Leaf Nodes, an Extension Node points to one child node, which could either be another Extension Node, a Leaf Node, or a branching node.

🛠️ Structure:

To depict the Extension Node in Go, we've structured it as:

type ExtensionNode struct {
	Path  []nibble.Nibble
	Node  Node
	Dirty bool
}
  • Path: Captures the shared segment of the path, represented as nibbles

  • Node: Holds a reference to its single child node

  • Dirty: A boolean flag indicating if modifications have been made to the node since the last commit

Last updated