def fetch_store

stelliferous@0.0.2.0 · proofs/storage_readback.bend:49

import stelliferous@0.0.2.0/proofs/storage_readback.bend as StorageReadback
import Base
import stelliferous@0.0.2.0/proofs/storage_tree_model.bend as Tree

49def fetch_store(~Element: Data,tree: Tree.Tree<Element>,+capacity: U32,+index: U32,+value: Element) ->
50  {Tree.fetch(Element,Tree.store(Element,tree,capacity,index,value),capacity,index) == value : Element}:
51  match tree:
52    case Tree.Leaf{old}: {==}
53    case Tree.Node{+left,+right}:
54      fetch_node(~Element,left,right,capacity,index,value,U32.is_lt(index,U32.shr(capacity)),{==},
55        fetch_store(~Element,left,U32.shr(capacity),index,value),fetch_store(~Element,right,U32.shr(capacity),(index - U32.shr(capacity) : U32),value))

Uses (8)

Used by (1)