示例#1
0
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,))
示例#2
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')
示例#3
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')
示例#4
0
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_canonical_head_hash = async_method('get_canonical_head_hash')
    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_get_canonical_block_header_by_number = async_method(
        'get_canonical_block_header_by_number')
    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')
    coro_get_block_transactions = async_method('get_block_transactions')
    coro_get_block_uncles = async_method('get_block_uncles')
    coro_get_receipts = async_method('get_receipts')
    coro_get_chain_wallet_address_for_block_hash = async_method(
        'get_chain_wallet_address_for_block_hash')
    coro_min_gas_system_initialization_required = async_method(
        'min_gas_system_initialization_required')
    coro_load_historical_network_tpc_capability = async_method(
        'load_historical_network_tpc_capability')
    coro_load_historical_minimum_gas_price = async_method(
        'load_historical_minimum_gas_price')
    coro_save_historical_minimum_gas_price = async_method(
        'save_historical_minimum_gas_price')
    coro_save_historical_network_tpc_capability = async_method(
        'save_historical_network_tpc_capability')
    coro_load_historical_tx_per_centisecond = async_method(
        'load_historical_tx_per_centisecond')
    coro_get_required_block_min_gas_price = async_method(
        'get_required_block_min_gas_price')
    coro_initialize_historical_minimum_gas_price_at_genesis = async_method(
        'initialize_historical_minimum_gas_price_at_genesis')
    coro_get_latest_reward_block_number = async_method(
        'get_latest_reward_block_number')
    coro_get_all_block_hashes_on_chain = async_method(
        'get_all_block_hashes_on_chain')
    coro_get_all_block_hashes_on_chain_by_head_block_hash = async_method(
        'get_all_block_hashes_on_chain_by_head_block_hash')
    coro_get_block_stake_from_children = async_method(
        'get_block_stake_from_children')
    coro_get_mature_stake = async_method('get_mature_stake')
    coro_get_unprocessed_block_hash_by_block_number = async_method(
        'get_unprocessed_block_hash_by_block_number')
    coro_get_unprocessed_block_header_by_block_number = async_method(
        'get_unprocessed_block_header_by_block_number')
    coro_propogate_historical_min_gas_price_parameters_to_present = async_method(
        'propogate_historical_min_gas_price_parameters_to_present')

    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')
    get_chain_wallet_address_for_block_hash = sync_method(
        'get_chain_wallet_address_for_block_hash')
    min_gas_system_initialization_required = sync_method(
        'min_gas_system_initialization_required')
    load_historical_network_tpc_capability = sync_method(
        'load_historical_network_tpc_capability')
    load_historical_minimum_gas_price = sync_method(
        'load_historical_minimum_gas_price')
    save_historical_minimum_gas_price = sync_method(
        'save_historical_minimum_gas_price')
    save_historical_network_tpc_capability = sync_method(
        'save_historical_network_tpc_capability')
    load_historical_tx_per_centisecond = sync_method(
        'load_historical_tx_per_centisecond')
    get_required_block_min_gas_price = sync_method(
        'get_required_block_min_gas_price')
    initialize_historical_minimum_gas_price_at_genesis = sync_method(
        'initialize_historical_minimum_gas_price_at_genesis')
    get_latest_reward_block_number = sync_method(
        'get_latest_reward_block_number')
    get_canonical_block_header_by_number = sync_method(
        'get_canonical_block_header_by_number')

    get_all_block_hashes_on_chain = sync_method(
        'get_all_block_hashes_on_chain')

    get_block_stake_from_children = sync_method(
        'get_block_stake_from_children')
    get_mature_stake = sync_method('get_mature_stake')
    get_unprocessed_block_hash_by_block_number = sync_method(
        'get_unprocessed_block_hash_by_block_number')
    get_unprocessed_block_header_by_block_number = sync_method(
        'get_unprocessed_block_header_by_block_number')
示例#5
0
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_canonical_head_hash = async_method('get_canonical_head_hash')
    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_get_canonical_block_header_by_number = async_method('get_canonical_block_header_by_number')
    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')
    coro_get_block_transactions = async_method('get_block_transactions')
    coro_get_block_uncles = async_method('get_block_uncles')
    coro_get_receipts = async_method('get_receipts')
    coro_get_chain_wallet_address_for_block_hash = async_method('get_chain_wallet_address_for_block_hash')
    coro_get_latest_reward_block_number = async_method('get_latest_reward_block_number')
    coro_get_all_block_hashes_on_chain = async_method('get_all_block_hashes_on_chain')
    coro_get_all_block_hashes_on_chain_by_head_block_hash = async_method('get_all_block_hashes_on_chain_by_head_block_hash')
    coro_get_block_stake_from_children = async_method('get_block_stake_from_children')
    coro_get_mature_stake = async_method('get_mature_stake')
    coro_get_unprocessed_block_hash_by_block_number = async_method('get_unprocessed_block_hash_by_block_number')
    coro_get_unprocessed_block_header_by_block_number = async_method('get_unprocessed_block_header_by_block_number')




    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')
    get_chain_wallet_address_for_block_hash = sync_method('get_chain_wallet_address_for_block_hash')

    get_latest_reward_block_number = sync_method('get_latest_reward_block_number')
    get_canonical_block_header_by_number = sync_method('get_canonical_block_header_by_number')

    get_all_block_hashes_on_chain = sync_method('get_all_block_hashes_on_chain')

    get_block_stake_from_children = sync_method('get_block_stake_from_children')
    get_mature_stake = sync_method('get_mature_stake')
    get_unprocessed_block_hash_by_block_number = sync_method('get_unprocessed_block_hash_by_block_number')
    get_unprocessed_block_header_by_block_number = sync_method('get_unprocessed_block_header_by_block_number')
class ChainHeadDBProxy(BaseProxy):

    coro_get_historical_root_hashes = async_method('get_historical_root_hashes')
    coro_get_historical_root_hash = async_method('get_historical_root_hash')
    coro_set_current_syncing_info = async_method('set_current_syncing_info')
    coro_get_current_syncing_info = async_method('get_current_syncing_info')
    coro_get_next_head_block_hash = async_method('get_next_head_block_hash')
    coro_get_head_block_hashes_list = async_method('get_head_block_hashes_list')
    coro_set_current_syncing_last_chain = async_method('set_current_syncing_last_chain')
    coro_get_latest_timestamp = async_method('get_latest_timestamp')
    coro_get_next_n_head_block_hashes = async_method('get_next_n_head_block_hashes')
    #coro_get_last_complete_historical_root_hash = async_method('get_last_complete_historical_root_hash')
    coro_get_root_hash = async_method('get_root_hash')
    coro_save_single_historical_root_hash = async_method('save_single_historical_root_hash')
    coro_get_dense_historical_root_hashes = async_method('get_dense_historical_root_hashes')
    coro_get_head_block_hashes_by_idx_list = async_method('get_head_block_hashes_by_idx_list')
    # coro_initialize_historical_root_hashes = async_method('initialize_historical_root_hashes')


    coro_get_latest_historical_root_hash = async_method('get_latest_historical_root_hash')
    coro_get_chain_head_hash = async_method('get_chain_head_hash')
    coro_load_chronological_block_window = async_method('load_chronological_block_window')



    get_historical_root_hashes = sync_method('get_historical_root_hashes')
    set_current_syncing_info = sync_method('set_current_syncing_info')
    get_current_syncing_info = sync_method('get_current_syncing_info')
    get_next_head_block_hash = sync_method('get_next_head_block_hash')
    get_head_block_hashes_list = sync_method('get_head_block_hashes_list')
    set_current_syncing_last_chain = sync_method('set_current_syncing_last_chain')
    get_latest_timestamp = sync_method('get_latest_timestamp')
    get_next_n_head_block_hashes = sync_method('get_next_n_head_block_hashes')
    #get_last_complete_historical_root_hash = sync_method('get_last_complete_historical_root_hash')
    get_root_hash = sync_method('get_root_hash')
    save_single_historical_root_hash = sync_method('save_single_historical_root_hash')
    get_historical_root_hash = sync_method('get_historical_root_hash')
    load_saved_root_hash = sync_method('load_saved_root_hash')
    get_latest_historical_root_hash = sync_method('get_latest_historical_root_hash')
    get_chain_head_hash = sync_method('get_chain_head_hash')
    load_chronological_block_window = sync_method('load_chronological_block_window')
    get_dense_historical_root_hashes = sync_method('get_dense_historical_root_hashes')
    get_head_block_hashes_by_idx_list = sync_method('get_head_block_hashes_by_idx_list')
    get_saved_root_hash  = sync_method('get_saved_root_hash')
示例#7
0
class ChainProxy(BaseProxy):
    coro_import_block = async_method('import_block')
    coro_import_chain = async_method('import_chain')

    coro_get_all_chronological_blocks_for_window = async_method(
        'get_all_chronological_blocks_for_window')
    coro_import_chronological_block_window = async_method(
        'import_chronological_block_window')
    coro_update_current_network_tpc_capability = async_method(
        'update_current_network_tpc_capability')
    coro_get_local_tpc_cap = async_method('get_local_tpc_cap')
    coro_re_initialize_historical_minimum_gas_price_at_genesis = async_method(
        're_initialize_historical_minimum_gas_price_at_genesis')
    coro_import_current_queue_block_with_reward = async_method(
        'import_current_queue_block_with_reward')
    coro_get_receipts = async_method('get_receipts')
    coro_get_block_by_hash = async_method('get_block_by_hash')
    coro_get_block_by_header = async_method('get_block_by_header')
    coro_get_block_by_number = async_method('get_block_by_number')
    coro_get_blocks_on_chain = async_method('get_blocks_on_chain')
    coro_get_all_blocks_on_chain = async_method('get_all_blocks_on_chain')
    coro_get_all_blocks_on_chain_by_head_block_hash = async_method(
        'get_all_blocks_on_chain_by_head_block_hash')
    coro_get_blocks_on_chain_up_to_block_hash = async_method(
        'get_blocks_on_chain_up_to_block_hash')
    coro_try_to_rebuild_chronological_chain_from_historical_root_hashes = async_method(
        'try_to_rebuild_chronological_chain_from_historical_root_hashes')

    coro_get_mature_stake = async_method('get_mature_stake')

    coro_initialize_historical_root_hashes_and_chronological_blocks = async_method(
        'initialize_historical_root_hashes_and_chronological_blocks')

    import_block = sync_method('import_block')
    import_chain = sync_method('import_chain')

    get_vm = sync_method('get_vm')
    get_all_chronological_blocks_for_window = sync_method(
        'get_all_chronological_blocks_for_window')
    import_chronological_block_window = sync_method(
        'import_chronological_block_window')
    update_current_network_tpc_capability = sync_method(
        'update_current_network_tpc_capability')
    get_local_tpc_cap = sync_method('get_local_tpc_cap')
    validate_block_specification = sync_method('validate_block_specification')
    re_initialize_historical_minimum_gas_price_at_genesis = sync_method(
        're_initialize_historical_minimum_gas_price_at_genesis')
    get_new_block_hash_to_test_peer_node_health = sync_method(
        'get_new_block_hash_to_test_peer_node_health')
    get_genesis_block_hash = sync_method('get_genesis_block_hash')
    get_genesis_wallet_address = sync_method('get_genesis_wallet_address')

    get_receipts = sync_method('get_genesis_wallet_address')

    get_vm_configuration = sync_method('get_vm_configuration')
    get_vm_class = sync_method('get_vm_class')
    get_vm_class_for_timestamp = sync_method('get_vm_class_for_block_number')

    import_block_with_profiler = sync_method('import_block_with_profiler')

    get_current_peer_node_health = sync_method('get_current_peer_node_health')