Ejemplo n.º 1
0
    def _create_context(self):
        context = IconScoreContext(IconScoreContextType.INVOKE)

        step_counter_factory = self._create_step_counter_factory()
        step_counter = step_counter_factory.create(context.type)
        step_counter.reset(self.step_limit)

        context.step_counter = step_counter
        context.revision = REVISION_3

        return context
Ejemplo n.º 2
0
def _for_profile_function(range_cnt: int, _create_db_func: callable):
    db = _create_db_func(range_cnt)
    _context = IconScoreContext(IconScoreContextType.DIRECT)
    _context.current_address = db.address
    _context.revision = REVISION
    ContextContainer._push_context(_context)

    array_db = ArrayDB(ARRAY_DB, db, value_type=Address)

    for index in range(range_cnt):
        addr: 'Address' = create_address()
        array_db.put(addr)

    for i in range(range_cnt):
        a = array_db[i]

    ContextContainer._clear_context()