MCPcopy
hub / github.com/ethereum/EIPs / gti_height

Function gti_height

assets/eip-7745/binary_tree.py:117–127  ·  view source on GitHub ↗

Returns the height of a generalized tree index. The height of the root node is zero, all other nodes have the height of their parent plus one.

(index: U256)

Source from the content-addressed store, hash-verified

115
116
117def gti_height(index: U256) -> Uint:
118 """
119 Returns the height of a generalized tree index. The height of the root node
120 is zero, all other nodes have the height of their parent plus one.
121 """
122 # TODO: more efficient implementation?
123 height = Uint(0)
124 while index > GTI_ROOT:
125 height += 1
126 index >>= 1
127 return height
128
129
130def gti_vector(root: U256, index, height: Uint) -> U256:

Callers 10

gti_mergeFunction · 0.85
gti_split_belowFunction · 0.85
gti_split_aboveFunction · 0.85
log_index_empty_nodeFunction · 0.85
epoch_tree_empty_nodeFunction · 0.85
prog_list_empty_nodeFunction · 0.85
index_entry_empty_nodeFunction · 0.85
log_entry_empty_nodeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected