Skip to content
This repository has been archived by the owner on Oct 31, 2023. It is now read-only.

Commit

Permalink
Revert "Enable json serializer in crossbar router"
Browse files Browse the repository at this point in the history
This reverts commit 51d8a97.

This was introduced in #3926, but it's not needed anymore.
  • Loading branch information
etam committed Sep 10, 2019
1 parent c18f78a commit c9c5088
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 100 deletions.
12 changes: 1 addition & 11 deletions golem/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
Dict,
List,
Optional,
TYPE_CHECKING,
TypeVar,
)

Expand Down Expand Up @@ -56,11 +55,6 @@
from golem.tools.uploadcontroller import UploadController
from golem.tools.remotefs import RemoteFS

if TYPE_CHECKING:
# pylint:disable=unused-import
from golem.rpc.router import SerializerType


F = TypeVar('F', bound=Callable[..., Any])
logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -100,8 +94,7 @@ def __init__(self, # noqa pylint: disable=too-many-arguments
use_talkback: bool = False,
use_docker_manager: bool = True,
geth_address: Optional[str] = None,
password: Optional[str] = None,
crossbar_serializer: 'Optional[SerializerType]' = None,
password: Optional[str] = None
) -> None:

# DO NOT MAKE THIS IMPORT GLOBAL
Expand Down Expand Up @@ -168,8 +161,6 @@ def __init__(self, # noqa pylint: disable=too-many-arguments
if not self.set_password(password):
raise Exception("Password incorrect")

self._crossbar_serializer = crossbar_serializer

def start(self) -> None:
HardwarePresets.initialize(self._datadir)
HardwarePresets.update_config(self._config_desc.hardware_preset_name,
Expand Down Expand Up @@ -295,7 +286,6 @@ def _start_rpc(self) -> Deferred:
host=self._config_desc.rpc_address,
port=self._config_desc.rpc_port,
datadir=self._datadir,
crossbar_serializer=self._crossbar_serializer,
)
self._reactor.addSystemEventTrigger("before", "shutdown", rpc.stop)

Expand Down
20 changes: 5 additions & 15 deletions golem/rpc/router.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,10 @@
logger = logging.getLogger('golem.rpc.crossbar')


@enum.unique
class SerializerType(enum.Enum):
def _generate_next_value_(name, *_): # pylint: disable=no-self-argument
return name

json = enum.auto()
msgpack = enum.auto()


# pylint: disable=too-many-instance-attributes
class CrossbarRouter(object):
serializers = ['msgpack']

@enum.unique
class CrossbarRoles(enum.Enum):
admin = enum.auto()
Expand All @@ -40,8 +33,8 @@ def __init__(self,
port: Optional[int] = CROSSBAR_PORT,
realm: str = CROSSBAR_REALM,
ssl: bool = True,
generate_secrets: bool = False,
crossbar_serializer: Optional[SerializerType] = None) -> None:
generate_secrets: bool = False) -> None:

self.working_dir = os.path.join(datadir, CROSSBAR_DIR)

os.makedirs(self.working_dir, exist_ok=True)
Expand All @@ -58,11 +51,8 @@ def __init__(self,
self.pubkey = None
self.personality_cls = Personality

if crossbar_serializer is None:
crossbar_serializer = SerializerType.msgpack

self.config = self._build_config(address=self.address,
serializers=[crossbar_serializer.name],
serializers=self.serializers,
cert_manager=self.cert_manager)

check_config(self.personality_cls, self.config)
Expand Down
11 changes: 1 addition & 10 deletions golemapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
from golem.core import variables # noqa
from golem.core.common import install_reactor # noqa
from golem.core.simpleenv import get_local_datadir # noqa
from golem.rpc.router import SerializerType # noqa
from golem.rpc import ( # noqa
generate_rpc_certificate,
WORKER_PROCESS_MODULE,
Expand Down Expand Up @@ -107,17 +106,11 @@ def monkey_patched_getLogger(*args, **kwargs):
@click.option('--enable-talkback', is_flag=True, default=None)
@click.option('--hyperdrive-port', type=int, help="Hyperdrive public port")
@click.option('--hyperdrive-rpc-port', type=int, help="Hyperdrive RPC port")
@click.option('--crossbar-serializer', default=None,
type=click.Choice([
SerializerType.msgpack.value,
SerializerType.json.value,
]),
help="Crossbar serializer (default: msgpack)")
def start( # pylint: disable=too-many-arguments, too-many-locals
monitor, concent, datadir, node_address, rpc_address, peer, mainnet,
net, geth_address, password, accept_terms, accept_concent_terms,
accept_all_terms, version, log_level, enable_talkback,
hyperdrive_port, hyperdrive_rpc_port, crossbar_serializer
hyperdrive_port, hyperdrive_rpc_port,
):
if version:
print("GOLEM version: {}".format(golem.__version__))
Expand Down Expand Up @@ -183,8 +176,6 @@ def _start():
concent_variant=ethereum_config.CONCENT_VARIANT,
geth_address=geth_address,
password=password,
crossbar_serializer=(SerializerType(crossbar_serializer)
if crossbar_serializer else None),
)

if accept_terms:
Expand Down
15 changes: 0 additions & 15 deletions scripts/node_integration_tests/nodes/json_serializer.py

This file was deleted.

Empty file.

This file was deleted.

This file was deleted.

2 changes: 0 additions & 2 deletions scripts/node_integration_tests/playbooks/test_config_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

class NodeConfig:
def __init__(self) -> None:
self.additional_args: Dict[str, Any] = {}
self.concent = CONCENT_DISABLED
# if datadir is None it will be automatically created
self.datadir: Optional[str] = None
Expand Down Expand Up @@ -55,7 +54,6 @@ def make_args(self) -> Dict[str, Any]:
args['--hyperdrive-port'] = self.hyperdrive_port
if self.hyperdrive_rpc_port:
args['--hyperdrive-rpc-port'] = self.hyperdrive_rpc_port
args.update(self.additional_args)

return args

Expand Down
12 changes: 4 additions & 8 deletions tests/golem/test_opt_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,7 @@ def test_geth_address_should_be_passed_to_node(self, mock_node, *_):
],
use_monitor=None,
use_talkback=None,
password=None,
crossbar_serializer=None)
password=None)

@patch('golem.node.TransactionSystem')
def test_geth_address_should_be_passed_to_transaction_system(
Expand Down Expand Up @@ -221,8 +220,7 @@ def test_mainnet_should_be_passed_to_node(self, mock_node, *_):
concent_variant=concent_disabled,
use_monitor=None,
use_talkback=None,
password=None,
crossbar_serializer=None)
password=None)

@patch('golem.node.Client')
def test_mainnet_should_be_passed_to_client(self, mock_client, *_):
Expand Down Expand Up @@ -271,8 +269,7 @@ def test_net_testnet_should_be_passed_to_node(self, mock_node, *_):
concent_variant=variables.CONCENT_CHOICES['test'],
use_monitor=None,
use_talkback=None,
password=None,
crossbar_serializer=None,
password=None
)

@patch('golem.node.Node')
Expand Down Expand Up @@ -300,8 +297,7 @@ def test_net_mainnet_should_be_passed_to_node(self, mock_node, *_):
concent_variant=concent_disabled,
use_monitor=None,
use_talkback=None,
password=None,
crossbar_serializer=None)
password=None)

@patch('golem.node.Node')
def test_config_change(self, *_):
Expand Down

0 comments on commit c9c5088

Please sign in to comment.