Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge masterkey module and component #6385

Merged
merged 4 commits into from
Sep 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion experiment/popularity_community/initial_filling.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
from ipv8_service import IPv8
from tribler_core.components.ipv8 import Ipv8Component
from tribler_core.components.libtorrent import LibtorrentComponent
from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent
from tribler_core.components.popularity import PopularityComponent
from tribler_core.components.restapi import RESTComponent
Expand Down
2 changes: 1 addition & 1 deletion experiment/tunnel_community/hidden_peer_discovery.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

from ipv8.taskmanager import TaskManager
from tribler_core.components.ipv8 import Ipv8Component
from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.restapi import RESTComponent
from tribler_core.components.tunnels import TunnelsComponent
from tribler_core.config.tribler_config import TriblerConfig
Expand Down
2 changes: 1 addition & 1 deletion experiment/tunnel_community/speed_test_exit.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from ipv8.messaging.anonymization.utils import run_speed_test
from ipv8.taskmanager import TaskManager
from tribler_core.components.ipv8 import Ipv8Component
from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.restapi import RESTComponent
from tribler_core.components.tunnels import TunnelsComponent
from tribler_core.config.tribler_config import TriblerConfig
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent
from tribler_core.components.base import Session
from tribler_core.components.ipv8 import Ipv8Component
from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.restapi import RESTComponent
from tribler_core.restapi.rest_manager import RESTManager

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tribler_core.components.base import Session
from tribler_core.components.gigachannel.gigachannel_component import GigaChannelComponent
from tribler_core.components.ipv8 import Ipv8Component
from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent
from tribler_core.components.restapi import RESTComponent
from tribler_core.restapi.rest_manager import RESTManager
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from tribler_core.components.base import Session
from tribler_core.components.gigachannel_manager.gigachannel_manager_component import GigachannelManagerComponent
from tribler_core.components.libtorrent import LibtorrentComponent
from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent
from tribler_core.components.restapi import RESTComponent
from tribler_core.components.socks_configurator import SocksServersComponent
Expand Down
4 changes: 1 addition & 3 deletions src/tribler-core/tribler_core/components/ipv8.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,8 @@
from ipv8.peerdiscovery.community import DiscoveryCommunity, PeriodicSimilarity
from ipv8.peerdiscovery.discovery import RandomWalk
from ipv8.taskmanager import TaskManager

from ipv8_service import IPv8

from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.restapi import RestfulComponent

INFINITE = -1
Expand Down
2 changes: 1 addition & 1 deletion src/tribler-core/tribler_core/components/libtorrent.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from tribler_common.simpledefs import STATE_CHECKPOINTS_LOADED, STATE_LOAD_CHECKPOINTS, STATE_START_LIBTORRENT

from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.restapi import RestfulComponent
from tribler_core.components.socks_configurator import SocksServersComponent
from tribler_core.components.upgrade import UpgradeComponent
Expand Down
Empty file.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import tribler_core.utilities.permid as permid_module
import tribler_core.components.masterkey.permid as permid_module
from ipv8.keyvault.private.libnaclkey import LibNaCLSK
from tribler_core.components.base import Component

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import pytest

from tribler_core.components.base import Session
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent


@pytest.mark.asyncio
async def test_masterkey_component(tribler_config):
session = Session(tribler_config, [MasterKeyComponent()])
with session:
comp = MasterKeyComponent.instance()
await session.start()

assert comp.keypair

await session.shutdown()
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from tribler_common.simpledefs import NTFY, STATEDIR_DB_DIR

from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.metadata_store.db.store import MetadataStore
from tribler_core.components.metadata_store.utils import generate_test_channels
from tribler_core.components.restapi import RestfulComponent
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import pytest

from tribler_core.components.base import Session
from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent
from tribler_core.components.restapi import RESTComponent
from tribler_core.restapi.rest_manager import RESTManager
Expand Down
2 changes: 1 addition & 1 deletion src/tribler-core/tribler_core/components/reporter.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from tribler_common.sentry_reporter.sentry_reporter import SentryReporter
from tribler_core.components.base import Component
from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.utilities.unicode import hexlify


Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
from unittest.mock import patch

import pytest

from tribler_core.components.bandwidth_accounting.bandwidth_accounting_component import BandwidthAccountingComponent
from tribler_core.components.base import Session, SessionError
from tribler_core.components.ipv8 import Ipv8Component
from tribler_core.components.libtorrent import LibtorrentComponent
from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent
from tribler_core.components.payout import PayoutComponent
from tribler_core.components.popularity import PopularityComponent
Expand All @@ -19,7 +17,6 @@
from tribler_core.components.upgrade import UpgradeComponent
from tribler_core.components.version_check import VersionCheckComponent
from tribler_core.components.watch_folder import WatchFolderComponent
from tribler_core.restapi.rest_manager import RESTManager

pytestmark = pytest.mark.asyncio

Expand Down Expand Up @@ -50,18 +47,6 @@ def test_session_context_manager(loop, tribler_config):
Session.current()


async def test_masterkey_component(tribler_config):
session = Session(tribler_config, [MasterKeyComponent()])
with session:
await session.start()

comp = MasterKeyComponent.instance()
assert comp.started.is_set() and not comp.failed
assert comp.keypair

await session.shutdown()


async def test_ipv8_component(tribler_config):
tribler_config.ipv8.enabled = True
components = [MasterKeyComponent(), RESTComponent(), Ipv8Component()]
Expand Down
2 changes: 1 addition & 1 deletion src/tribler-core/tribler_core/components/upgrade.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from tribler_common.simpledefs import STATE_UPGRADING_READABLE

from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.restapi import RestfulComponent
from tribler_core.upgrade.upgrade import TriblerUpgrader

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
from pydantic import BaseSettings, Extra

from tribler_core.components.bandwidth_accounting.settings import BandwidthAccountingSettings
from tribler_core.modules.libtorrent.settings import DownloadDefaultsSettings, LibtorrentSettings
from tribler_core.components.gigachannel.community.settings import ChantSettings
from tribler_core.components.masterkey.settings import BootstrapSettings, DHTSettings, DiscoveryCommunitySettings, \
Ipv8Settings, \
TrustchainSettings, WatchFolderSettings
from tribler_core.modules.libtorrent.settings import DownloadDefaultsSettings, LibtorrentSettings
from tribler_core.modules.popularity.settings import PopularityCommunitySettings
from tribler_core.modules.remote_query_community.settings import RemoteQueryCommunitySettings
from tribler_core.modules.resource_monitor.settings import ResourceMonitorSettings
from tribler_core.modules.settings import BootstrapSettings, DHTSettings, DiscoveryCommunitySettings, Ipv8Settings, \
TrustchainSettings, WatchFolderSettings
from tribler_core.modules.torrent_checker.settings import TorrentCheckerSettings
from tribler_core.modules.tunnel.community.settings import TunnelCommunitySettings
from tribler_core.restapi.settings import APISettings
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import pytest

from tribler_common.network_utils import NetworkUtils
from tribler_core.modules.settings import Ipv8Settings
from tribler_core.components.masterkey.settings import Ipv8Settings


@pytest.mark.asyncio
Expand Down
2 changes: 1 addition & 1 deletion src/tribler-core/tribler_core/start_core.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
from tribler_core.components.gigachannel_manager.gigachannel_manager_component import GigachannelManagerComponent
from tribler_core.components.ipv8 import Ipv8Component
from tribler_core.components.libtorrent import LibtorrentComponent
from tribler_core.components.masterkey import MasterKeyComponent
from tribler_core.components.masterkey.masterkey_component import MasterKeyComponent
from tribler_core.components.metadata_store.metadata_store_component import MetadataStoreComponent
from tribler_core.components.payout import PayoutComponent
from tribler_core.components.popularity import PopularityComponent
Expand Down
2 changes: 1 addition & 1 deletion src/tribler-core/tribler_core/tests/test_permid.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

from ipv8.keyvault.private.libnaclkey import LibNaCLSK

from tribler_core.utilities import permid
from tribler_core.components.masterkey import permid


def test_save_load_keypair_pubkey_trustchain(tmpdir):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from tribler_common.simpledefs import NTFY

import tribler_core.utilities.permid as permid_module
import tribler_core.components.masterkey.permid as permid_module
from tribler_core.components.bandwidth_accounting.db.database import BandwidthDatabase
from tribler_core.components.metadata_store.db.orm_bindings.channel_metadata import CHANNEL_DIR_NAME_LENGTH
from tribler_core.components.metadata_store.db.store import CURRENT_DB_VERSION, MetadataStore
Expand Down