def do_commit(ctx: Context, prim, args, annots): debug, ctx.debug = ctx.debug, False output = ctx.pop1() assert_stack_type(output, Pair) operations = output.get_element(0) assert_stack_type(operations, List) assert operations.val_type() == Operation, f'expected list of operations' s_type_expr = ctx.get('storage') assert s_type_expr, f'storage type is not initialized' storage = output.get_element(1) assert_expr_equal(s_type_expr, storage.type_expr) storage, big_map_diff = ctx.big_maps.diff(storage) ctx.big_maps.commit(big_map_diff) res = Pair.new(operations, storage) ctx.push(res) ctx.debug = debug return {'kind': 'output', 'operations': operations, 'storage': storage, 'big_map_diff': big_map_diff}
def __cmp__(self, other: 'StackItem') -> int: assert_stack_item(other) assert_expr_equal(self.type_expr, other.type_expr) if self._val > other._val: return 1 elif self._val < other._val: return -1 else: return 0
def _check_allocated(self, val_expr, type_expr, network=None): big_map_id = get_int(val_expr) assert big_map_id >= 0, f'expected an allocated big map (>=0), got {big_map_id}' if big_map_id in self.maps: big_map = self.maps[big_map_id] _ = [ assert_expr_equal(type_expr['args'][i], big_map.type_expr['args'][i]) for i in [0, 1] ] return big_map_id, {'_diff': {}} else: assert network, f'big map #{big_map_id} is not allocated' self.alloc_id = max(self.alloc_id, big_map_id + 1) return big_map_id, {'_diff': {}, '_network': network}
def __eq__(self, other: 'StackItem'): assert_stack_item(other) assert_expr_equal(self.type_expr, other.type_expr) return expr_equal(self.val_expr, other.val_expr)
def assert_ret_type(self, item: StackItem): assert_stack_item(item) assert_expr_equal(self.type_expr['args'][1], item.type_expr)