예제 #1
0
class ChainProxy(BaseProxy):
    coro_import_block = async_method('import_block')
    coro_validate_chain = async_method('validate_chain')
    get_vm_configuration = sync_method('get_vm_configuration')
    get_vm_class = sync_method('get_vm_class')
    get_vm_class_for_block_number = sync_method(
        'get_vm_class_for_block_number')
예제 #2
0
class DBProxy(BaseProxy):
    _exposed_ = (
        '__contains__',
        '__delitem__',
        '__getitem__',
        '__setitem__',
        'atomic_batch',
        'coro_set',
        'coro_exists',
        'delete',
        'exists',
        'get',
        'set',
    )
    coro_set = async_method('set')
    coro_exists = async_method('exists')

    def get(self, key: bytes) -> bytes:
        return self._callmethod('get', (key, ))

    def __getitem__(self, key: bytes) -> bytes:
        return self._callmethod('__getitem__', (key, ))

    def set(self, key: bytes, value: bytes) -> None:
        return self._callmethod('set', (key, value))

    def __setitem__(self, key: bytes, value: bytes) -> None:
        return self._callmethod('__setitem__', (key, value))

    def delete(self, key: bytes) -> None:
        return self._callmethod('delete', (key, ))

    def __delitem__(self, key: bytes) -> None:
        return self._callmethod('__delitem__', (key, ))

    def exists(self, key: bytes) -> bool:
        return self._callmethod('exists', (key, ))

    def __contains__(self, key: bytes) -> bool:
        return self._callmethod('__contains__', (key, ))

    @contextmanager
    def atomic_batch(self) -> Generator['AtomicDBWriteBatch', None, None]:
        with AtomicDBWriteBatch._commit_unless_raises(self) as readable_batch:
            yield readable_batch
예제 #3
0
class AsyncHeaderChainProxy(BaseProxy, BaseAsyncHeaderChain, BaseHeaderChain):
    @classmethod
    def from_genesis_header(cls,
                            basedb: BaseDB,
                            genesis_header: BlockHeader) -> 'BaseHeaderChain':
        raise NotImplementedError("Chain classes must implement this method")

    @classmethod
    def get_headerdb_class(cls) -> BaseDB:
        raise NotImplementedError("Chain classes must implement this method")

    coro_get_block_header_by_hash = async_method('get_block_header_by_hash')
    coro_get_canonical_block_header_by_number = async_method('get_canonical_block_header_by_number')
    coro_get_canonical_head = async_method('get_canonical_head')
    coro_import_header = async_method('import_header')
    coro_header_exists = async_method('header_exists')

    get_block_header_by_hash = sync_method('get_block_header_by_hash')
    get_canonical_block_header_by_number = sync_method('get_canonical_block_header_by_number')
    get_canonical_head = sync_method('get_canonical_head')
    import_header = sync_method('import_header')
    header_exists = sync_method('header_exists')
예제 #4
0
파일: base.py 프로젝트: Kong-F/EVMFuzzer
class DBProxy(BaseProxy):
    _exposed_ = (
        '__contains__',
        '__delitem__',
        '__getitem__',
        '__setitem__',
        'delete',
        'exists',
        'get',
        'set',
        'coro_set',
        'coro_exists',
    )
    coro_set = async_method('set')
    coro_exists = async_method('exists')

    def get(self, key: bytes) -> bytes:
        return self._callmethod('get', (key,))

    def __getitem__(self, key: bytes) -> bytes:
        return self._callmethod('__getitem__', (key,))

    def set(self, key: bytes, value: bytes) -> None:
        return self._callmethod('set', (key, value))

    def __setitem__(self, key: bytes, value: bytes) -> None:
        return self._callmethod('__setitem__', (key, value))

    def delete(self, key: bytes) -> None:
        return self._callmethod('delete', (key,))

    def __delitem__(self, key: bytes) -> None:
        return self._callmethod('__delitem__', (key,))

    def exists(self, key: bytes) -> bool:
        return self._callmethod('exists', (key,))

    def __contains__(self, key: bytes) -> bool:
        return self._callmethod('__contains__', (key,))
예제 #5
0
파일: chain.py 프로젝트: yjmyzz/py-evm
class ChainDBProxy(BaseProxy):
    coro_get_block_header_by_hash = async_method('get_block_header_by_hash')
    coro_get_canonical_head = async_method('get_canonical_head')
    coro_get_score = async_method('get_score')
    coro_header_exists = async_method('header_exists')
    coro_get_canonical_block_hash = async_method('get_canonical_block_hash')
    coro_persist_header = async_method('persist_header')
    coro_persist_uncles = async_method('persist_uncles')
    coro_persist_trie_data_dict = async_method('persist_trie_data_dict')

    get_block_header_by_hash = sync_method('get_block_header_by_hash')
    get_canonical_head = sync_method('get_canonical_head')
    get_score = sync_method('get_score')
    header_exists = sync_method('header_exists')
    get_canonical_block_hash = sync_method('get_canonical_block_hash')
    persist_header = sync_method('persist_header')
    persist_uncles = sync_method('persist_uncles')
    persist_trie_data_dict = sync_method('persist_trie_data_dict')
예제 #6
0
class AsyncHeaderDBProxy(BaseProxy, BaseAsyncHeaderDB, BaseHeaderDB):
    coro_get_block_header_by_hash = async_method('get_block_header_by_hash')
    coro_get_canonical_block_hash = async_method('get_canonical_block_hash')
    coro_get_canonical_block_header_by_number = async_method(
        'get_canonical_block_header_by_number')
    coro_get_canonical_head = async_method('get_canonical_head')
    coro_get_score = async_method('get_score')
    coro_header_exists = async_method('header_exists')
    coro_get_canonical_block_hash = async_method('get_canonical_block_hash')
    coro_persist_header = async_method('persist_header')
    coro_persist_header_chain = async_method('persist_header_chain')

    get_block_header_by_hash = sync_method('get_block_header_by_hash')
    get_canonical_block_hash = sync_method('get_canonical_block_hash')
    get_canonical_block_header_by_number = sync_method(
        'get_canonical_block_header_by_number')
    get_canonical_head = sync_method('get_canonical_head')
    get_score = sync_method('get_score')
    header_exists = sync_method('header_exists')
    get_canonical_block_hash = sync_method('get_canonical_block_hash')
    persist_header = sync_method('persist_header')
    persist_header_chain = sync_method('persist_header_chain')
예제 #7
0
파일: __init__.py 프로젝트: FLYChain/py-evm
class ChainProxy(BaseProxy):
    coro_import_block = async_method('import_block')
예제 #8
0
파일: __init__.py 프로젝트: tuxxy/py-evm
class ChainProxy(BaseProxy):
    coro_import_block = async_method('import_block')
    get_vm_configuration = sync_method('get_vm_configuration')