{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/py-evm/pulls/comments/190946585","pull_request_review_id":123437201,"id":190946585,"diff_hunk":"@@ -9,39 +12,71 @@\n from p2p.service import (\n     BaseService,\n     EmptyService,\n+    ServiceContext,\n+)\n+from trinity.chains import (\n+    ChainProxy,\n+)\n+from trinity.chains.header import (\n+    AsyncHeaderChainProxy,\n )\n+from trinity.db.chain import ChainDBProxy\n+from trinity.db.base import DBProxy\n+from trinity.db.header import AsyncHeaderDBProxy\n from trinity.rpc.main import (\n     RPCServer,\n )\n from trinity.rpc.ipc import (\n     IPCServer,\n )\n+from trinity.config import (\n+    ChainConfig,\n+)\n \n \n class Node(BaseService):\n     \"\"\"\n     Create usable nodes by adding subclasses that define the following\n-    unset attributes...\n+    unset attributes.\n     \"\"\"\n-\n     chain_class: Type[BaseChain] = None\n-    peer_chain_class: Type[BaseService] = None\n \n-    def __init__(\n-            self,\n-            headerdb: BaseHeaderDB,\n-            peer_pool,\n-            jsonrpc_ipc_path: Path = None):\n+    def __init__(self, chain_config: ChainConfig) -> None:\n         super().__init__()\n-        self._headerdb = headerdb\n-        self._jsonrpc_ipc_path = jsonrpc_ipc_path\n-        self._peer_pool = peer_pool\n-        self._peer_chain = self.peer_chain_class(headerdb, peer_pool)\n+\n+        self._db_manager = create_db_manager(chain_config.database_ipc_path)\n+        self._db_manager.connect()  # type: ignore\n+        self._headerdb = self._db_manager.get_headerdb()  # type: ignore\n+\n+        self._jsonrpc_ipc_path: Path = chain_config.jsonrpc_ipc_path\n+        self._auxiliary_services = ServiceContext()\n \n     @abstractmethod\n     def get_chain(self) -> BaseChain:\n         raise NotImplementedError(\"Node classes must implement this method\")\n \n+    @abstractmethod\n+    def get_p2p_server(self) -> BaseService:\n+        \"\"\"\n+        This is the main service that will be run, when calling :meth:`run`.\n+        It's typically responsible for syncing the chain, with peer connections.","path":"trinity/nodes/base.py","position":73,"original_position":73,"commit_id":"727c7c21836a78ed49acd938a1fcb3e2a39dee14","original_commit_id":"727c7c21836a78ed49acd938a1fcb3e2a39dee14","user":{"login":"carver","id":205327,"avatar_url":"https://avatars0.githubusercontent.com/u/205327?v=4","gravatar_id":"","url":"https://api.github.com/users/carver","html_url":"https://github.com/carver","followers_url":"https://api.github.com/users/carver/followers","following_url":"https://api.github.com/users/carver/following{/other_user}","gists_url":"https://api.github.com/users/carver/gists{/gist_id}","starred_url":"https://api.github.com/users/carver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carver/subscriptions","organizations_url":"https://api.github.com/users/carver/orgs","repos_url":"https://api.github.com/users/carver/repos","events_url":"https://api.github.com/users/carver/events{/privacy}","received_events_url":"https://api.github.com/users/carver/received_events","type":"User","site_admin":false},"body":"I think it makes sense for there to be an orchestration service in p2p (like `Server`) that manages the several services it needs to run. But I also think it makes sense to have an umbrella orchestration service in trinity (like `Node`), which manages several services (including `Server`). My instinct is that some services should not be managed inside p2p, but I think we already have one example: the RPC server.\r\n\r\nBut... there are some things handled in `Node` right now that could/should be pushed into `Server` (especially the light node, which explicitly manages the peer pool, at the moment).","created_at":"2018-05-25T16:29:59Z","updated_at":"2018-05-25T16:30:00Z","html_url":"https://github.com/ethereum/py-evm/pull/754#discussion_r190946585","pull_request_url":"https://api.github.com/repos/ethereum/py-evm/pulls/754","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/ethereum/py-evm/pulls/comments/190946585"},"html":{"href":"https://github.com/ethereum/py-evm/pull/754#discussion_r190946585"},"pull_request":{"href":"https://api.github.com/repos/ethereum/py-evm/pulls/754"}},"in_reply_to_id":190818456},"pull_request":{"url":"https://api.github.com/repos/ethereum/py-evm/pulls/754","id":189833682,"html_url":"https://github.com/ethereum/py-evm/pull/754","diff_url":"https://github.com/ethereum/py-evm/pull/754.diff","patch_url":"https://github.com/ethereum/py-evm/pull/754.patch","issue_url":"https://api.github.com/repos/ethereum/py-evm/issues/754","number":754,"state":"open","locked":false,"title":"json-rpc support for full node","user":{"login":"carver","id":205327,"avatar_url":"https://avatars0.githubusercontent.com/u/205327?v=4","gravatar_id":"","url":"https://api.github.com/users/carver","html_url":"https://github.com/carver","followers_url":"https://api.github.com/users/carver/followers","following_url":"https://api.github.com/users/carver/following{/other_user}","gists_url":"https://api.github.com/users/carver/gists{/gist_id}","starred_url":"https://api.github.com/users/carver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carver/subscriptions","organizations_url":"https://api.github.com/users/carver/orgs","repos_url":"https://api.github.com/users/carver/repos","events_url":"https://api.github.com/users/carver/events{/privacy}","received_events_url":"https://api.github.com/users/carver/received_events","type":"User","site_admin":false},"body":"### What was wrong?\r\n\r\nlight and full nodes had some duplicate implementations, and the full node did not support requests over RPC\r\n\r\n### How was it fixed?\r\n\r\nNot done, but:\r\n\r\n- unify the light and full node launch code some more\r\n- launch the RPC server with the full node (reusing the same logic from the base node implementation)\r\n\r\nSome open issues:\r\n\r\n- shutdown is still ugly on the full node\r\n- had to stop using process pool as the default executor, because I couldn't get it to respect the signal handler (also GvR said it was probably a bad idea)\r\n- Directly initialized the Chain for use with the RPC server. Is that a bad idea? The `ChainProxy` didn't really support anything I needed.\r\n- probably linting and testing, I was only testing at the shell\r\n\r\n#### Cute Animal Picture\r\n\r\n![put a cute animal picture link inside the parentheses](https://scontent.fsnc1-1.fna.fbcdn.net/v/t1.0-9/22046491_1377809865668721_4139365722380619941_n.jpg?_nc_cat=0&oh=51f64138f8b9e24778559d3e431594c0&oe=5B79146A)\r\n","created_at":"2018-05-23T01:27:30Z","updated_at":"2018-05-25T16:30:00Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55c464e137dd1ef60bbe455d3115ed9138089022","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/ethereum/py-evm/pulls/754/commits","review_comments_url":"https://api.github.com/repos/ethereum/py-evm/pulls/754/comments","review_comment_url":"https://api.github.com/repos/ethereum/py-evm/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethereum/py-evm/issues/754/comments","statuses_url":"https://api.github.com/repos/ethereum/py-evm/statuses/727c7c21836a78ed49acd938a1fcb3e2a39dee14","head":{"label":"carver:ipc-full-client","ref":"ipc-full-client","sha":"727c7c21836a78ed49acd938a1fcb3e2a39dee14","user":{"login":"carver","id":205327,"avatar_url":"https://avatars0.githubusercontent.com/u/205327?v=4","gravatar_id":"","url":"https://api.github.com/users/carver","html_url":"https://github.com/carver","followers_url":"https://api.github.com/users/carver/followers","following_url":"https://api.github.com/users/carver/following{/other_user}","gists_url":"https://api.github.com/users/carver/gists{/gist_id}","starred_url":"https://api.github.com/users/carver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carver/subscriptions","organizations_url":"https://api.github.com/users/carver/orgs","repos_url":"https://api.github.com/users/carver/repos","events_url":"https://api.github.com/users/carver/events{/privacy}","received_events_url":"https://api.github.com/users/carver/received_events","type":"User","site_admin":false},"repo":{"id":111029002,"name":"py-evm","full_name":"carver/py-evm","owner":{"login":"carver","id":205327,"avatar_url":"https://avatars0.githubusercontent.com/u/205327?v=4","gravatar_id":"","url":"https://api.github.com/users/carver","html_url":"https://github.com/carver","followers_url":"https://api.github.com/users/carver/followers","following_url":"https://api.github.com/users/carver/following{/other_user}","gists_url":"https://api.github.com/users/carver/gists{/gist_id}","starred_url":"https://api.github.com/users/carver/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carver/subscriptions","organizations_url":"https://api.github.com/users/carver/orgs","repos_url":"https://api.github.com/users/carver/repos","events_url":"https://api.github.com/users/carver/events{/privacy}","received_events_url":"https://api.github.com/users/carver/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/carver/py-evm","description":"A Python implementation of the Ethereum Virtual Machine","fork":true,"url":"https://api.github.com/repos/carver/py-evm","forks_url":"https://api.github.com/repos/carver/py-evm/forks","keys_url":"https://api.github.com/repos/carver/py-evm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/carver/py-evm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/carver/py-evm/teams","hooks_url":"https://api.github.com/repos/carver/py-evm/hooks","issue_events_url":"https://api.github.com/repos/carver/py-evm/issues/events{/number}","events_url":"https://api.github.com/repos/carver/py-evm/events","assignees_url":"https://api.github.com/repos/carver/py-evm/assignees{/user}","branches_url":"https://api.github.com/repos/carver/py-evm/branches{/branch}","tags_url":"https://api.github.com/repos/carver/py-evm/tags","blobs_url":"https://api.github.com/repos/carver/py-evm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/carver/py-evm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/carver/py-evm/git/refs{/sha}","trees_url":"https://api.github.com/repos/carver/py-evm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/carver/py-evm/statuses/{sha}","languages_url":"https://api.github.com/repos/carver/py-evm/languages","stargazers_url":"https://api.github.com/repos/carver/py-evm/stargazers","contributors_url":"https://api.github.com/repos/carver/py-evm/contributors","subscribers_url":"https://api.github.com/repos/carver/py-evm/subscribers","subscription_url":"https://api.github.com/repos/carver/py-evm/subscription","commits_url":"https://api.github.com/repos/carver/py-evm/commits{/sha}","git_commits_url":"https://api.github.com/repos/carver/py-evm/git/commits{/sha}","comments_url":"https://api.github.com/repos/carver/py-evm/comments{/number}","issue_comment_url":"https://api.github.com/repos/carver/py-evm/issues/comments{/number}","contents_url":"https://api.github.com/repos/carver/py-evm/contents/{+path}","compare_url":"https://api.github.com/repos/carver/py-evm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/carver/py-evm/merges","archive_url":"https://api.github.com/repos/carver/py-evm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/carver/py-evm/downloads","issues_url":"https://api.github.com/repos/carver/py-evm/issues{/number}","pulls_url":"https://api.github.com/repos/carver/py-evm/pulls{/number}","milestones_url":"https://api.github.com/repos/carver/py-evm/milestones{/number}","notifications_url":"https://api.github.com/repos/carver/py-evm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/carver/py-evm/labels{/name}","releases_url":"https://api.github.com/repos/carver/py-evm/releases{/id}","deployments_url":"https://api.github.com/repos/carver/py-evm/deployments","created_at":"2017-11-16T22:23:49Z","updated_at":"2017-11-16T22:23:51Z","pushed_at":"2018-05-24T22:36:59Z","git_url":"git://github.com/carver/py-evm.git","ssh_url":"git@github.com:carver/py-evm.git","clone_url":"https://github.com/carver/py-evm.git","svn_url":"https://github.com/carver/py-evm","homepage":"","size":3394,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"ethereum:master","ref":"master","sha":"7f33392e92d1bd0a56b24fdec210d077449d3533","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars3.githubusercontent.com/u/6250754?v=4","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"repo":{"id":77478378,"name":"py-evm","full_name":"ethereum/py-evm","owner":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars3.githubusercontent.com/u/6250754?v=4","gravatar_id":"","url":"https://api.github.com/users/ethereum","html_url":"https://github.com/ethereum","followers_url":"https://api.github.com/users/ethereum/followers","following_url":"https://api.github.com/users/ethereum/following{/other_user}","gists_url":"https://api.github.com/users/ethereum/gists{/gist_id}","starred_url":"https://api.github.com/users/ethereum/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ethereum/subscriptions","organizations_url":"https://api.github.com/users/ethereum/orgs","repos_url":"https://api.github.com/users/ethereum/repos","events_url":"https://api.github.com/users/ethereum/events{/privacy}","received_events_url":"https://api.github.com/users/ethereum/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ethereum/py-evm","description":"A Python implementation of the Ethereum Virtual Machine","fork":false,"url":"https://api.github.com/repos/ethereum/py-evm","forks_url":"https://api.github.com/repos/ethereum/py-evm/forks","keys_url":"https://api.github.com/repos/ethereum/py-evm/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/py-evm/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/py-evm/teams","hooks_url":"https://api.github.com/repos/ethereum/py-evm/hooks","issue_events_url":"https://api.github.com/repos/ethereum/py-evm/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/py-evm/events","assignees_url":"https://api.github.com/repos/ethereum/py-evm/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/py-evm/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/py-evm/tags","blobs_url":"https://api.github.com/repos/ethereum/py-evm/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/py-evm/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/py-evm/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/py-evm/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/py-evm/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/py-evm/languages","stargazers_url":"https://api.github.com/repos/ethereum/py-evm/stargazers","contributors_url":"https://api.github.com/repos/ethereum/py-evm/contributors","subscribers_url":"https://api.github.com/repos/ethereum/py-evm/subscribers","subscription_url":"https://api.github.com/repos/ethereum/py-evm/subscription","commits_url":"https://api.github.com/repos/ethereum/py-evm/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/py-evm/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/py-evm/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/py-evm/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethereum/py-evm/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/py-evm/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/py-evm/merges","archive_url":"https://api.github.com/repos/ethereum/py-evm/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/py-evm/downloads","issues_url":"https://api.github.com/repos/ethereum/py-evm/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/py-evm/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/py-evm/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/py-evm/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/py-evm/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/py-evm/releases{/id}","deployments_url":"https://api.github.com/repos/ethereum/py-evm/deployments","created_at":"2016-12-27T19:36:00Z","updated_at":"2018-05-25T10:04:26Z","pushed_at":"2018-05-25T13:40:38Z","git_url":"git://github.com/ethereum/py-evm.git","ssh_url":"git@github.com:ethereum/py-evm.git","clone_url":"https://github.com/ethereum/py-evm.git","svn_url":"https://github.com/ethereum/py-evm","homepage":"http://py-evm.readthedocs.io/en/latest/","size":3416,"stargazers_count":460,"watchers_count":460,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":187,"mirror_url":null,"archived":false,"open_issues_count":102,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":187,"open_issues":102,"watchers":460,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/py-evm/pulls/754"},"html":{"href":"https://github.com/ethereum/py-evm/pull/754"},"issue":{"href":"https://api.github.com/repos/ethereum/py-evm/issues/754"},"comments":{"href":"https://api.github.com/repos/ethereum/py-evm/issues/754/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/py-evm/pulls/754/comments"},"review_comment":{"href":"https://api.github.com/repos/ethereum/py-evm/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethereum/py-evm/pulls/754/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/py-evm/statuses/727c7c21836a78ed49acd938a1fcb3e2a39dee14"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"carver"}}