{"action":"created","comment":{"url":"https://api.github.com/repos/icon-project/icon-service/pulls/comments/231116663","pull_request_review_id":171914447,"id":231116663,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMTExNjY2Mw==","diff_hunk":"@@ -310,15 +321,59 @@ def invoke(self,\n                 block_result.append(tx_result)\n                 context.block_batch.update(context.tx_batch)\n                 context.tx_batch.clear()\n+                tx_precommit_flag = self._generate_precommit_flag(tx_result)\n+                self._update_step_properties_if_necessary(context, tx_precommit_flag)\n+                precommit_flag |= tx_precommit_flag\n \n         # Save precommit data\n         # It will be written to levelDB on commit\n         precommit_data = PrecommitData(\n-            context.block_batch, block_result, context.new_icon_score_mapper)\n+            context.block_batch, block_result, context.new_icon_score_mapper, precommit_flag)\n         self._precommit_data_manager.push(precommit_data)\n \n         return block_result, precommit_data.state_root_hash\n \n+    @staticmethod\n+    def _generate_precommit_flag(tx_result) -> PrecommitFlag:\n+        \"\"\"\n+        Generates pre-commit flag related in STEP properties from the transaction result\n+\n+        :param tx_result: transaction result\n+        :return: pre-commit flag related in STEP properties\n+        \"\"\"\n+        precommit_flag = PrecommitFlag.NONE\n+\n+        if tx_result.to == GOVERNANCE_SCORE_ADDRESS and \\\n+                tx_result.status == TransactionResult.SUCCESS:\n+            precommit_flag = PrecommitFlag.STEP_ALL_CHANGED\n+\n+        return precommit_flag\n+\n+    def _update_step_properties_if_necessary(self, context, precommit_flag):\n+        \"\"\"\n+        Updates step properties to the step counter if the pre-commit flag is set\n+\n+        :param context: current context\n+        :param precommit_flag: pre-commit flag\n+        \"\"\"\n+        if precommit_flag & PrecommitFlag.STEP_ALL_CHANGED == PrecommitFlag.NONE:\n+            return\n+\n+        try:\n+            self._push_context(context)\n+            governance_score = self._get_governance_score(context)\n+\n+            step_price = self._get_step_price_from_governance(context, governance_score)","path":"iconservice/icon_service_engine.py","position":188,"original_position":188,"commit_id":"57a2d3e787a7251e8aa490a2a1ab94e2826c16de","original_commit_id":"57a2d3e787a7251e8aa490a2a1ab94e2826c16de","user":{"login":"goldworm-icon","id":38339220,"node_id":"MDQ6VXNlcjM4MzM5MjIw","avatar_url":"https://avatars2.githubusercontent.com/u/38339220?v=4","gravatar_id":"","url":"https://api.github.com/users/goldworm-icon","html_url":"https://github.com/goldworm-icon","followers_url":"https://api.github.com/users/goldworm-icon/followers","following_url":"https://api.github.com/users/goldworm-icon/following{/other_user}","gists_url":"https://api.github.com/users/goldworm-icon/gists{/gist_id}","starred_url":"https://api.github.com/users/goldworm-icon/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/goldworm-icon/subscriptions","organizations_url":"https://api.github.com/users/goldworm-icon/orgs","repos_url":"https://api.github.com/users/goldworm-icon/repos","events_url":"https://api.github.com/users/goldworm-icon/events{/privacy}","received_events_url":"https://api.github.com/users/goldworm-icon/received_events","type":"User","site_admin":false},"body":"```suggestion\r\n            step_price: int = self._get_step_price_from_governance(context, governance_score)\r\n```","created_at":"2018-11-06T13:15:20Z","updated_at":"2018-11-06T13:38:46Z","html_url":"https://github.com/icon-project/icon-service/pull/33#discussion_r231116663","pull_request_url":"https://api.github.com/repos/icon-project/icon-service/pulls/33","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/icon-project/icon-service/pulls/comments/231116663"},"html":{"href":"https://github.com/icon-project/icon-service/pull/33#discussion_r231116663"},"pull_request":{"href":"https://api.github.com/repos/icon-project/icon-service/pulls/33"}}},"pull_request":{"url":"https://api.github.com/repos/icon-project/icon-service/pulls/33","id":228341757,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI4MzQxNzU3","html_url":"https://github.com/icon-project/icon-service/pull/33","diff_url":"https://github.com/icon-project/icon-service/pull/33.diff","patch_url":"https://github.com/icon-project/icon-service/pull/33.patch","issue_url":"https://api.github.com/repos/icon-project/icon-service/issues/33","number":33,"state":"open","locked":false,"title":"improve managing STEP counter factory","user":{"login":"whylee259","id":2441640,"node_id":"MDQ6VXNlcjI0NDE2NDA=","avatar_url":"https://avatars2.githubusercontent.com/u/2441640?v=4","gravatar_id":"","url":"https://api.github.com/users/whylee259","html_url":"https://github.com/whylee259","followers_url":"https://api.github.com/users/whylee259/followers","following_url":"https://api.github.com/users/whylee259/following{/other_user}","gists_url":"https://api.github.com/users/whylee259/gists{/gist_id}","starred_url":"https://api.github.com/users/whylee259/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/whylee259/subscriptions","organizations_url":"https://api.github.com/users/whylee259/orgs","repos_url":"https://api.github.com/users/whylee259/repos","events_url":"https://api.github.com/users/whylee259/events{/privacy}","received_events_url":"https://api.github.com/users/whylee259/received_events","type":"User","site_admin":false},"body":"- Puts `theading.lock` into `IconScoreStepFactory` \r\n- Reduce setting of the STEP properties(step price, step costs, max step limit) to `IconScoreStepFactory`\r\n- IconScoreStepCounter holds copies of STEP properties in a context","created_at":"2018-11-05T12:50:58Z","updated_at":"2018-11-06T13:38:45Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a6c85790b17a4d5d7028c99e25a29509ecb81c45","assignee":null,"assignees":[],"requested_reviewers":[{"login":"sink772","id":1100500,"node_id":"MDQ6VXNlcjExMDA1MDA=","avatar_url":"https://avatars2.githubusercontent.com/u/1100500?v=4","gravatar_id":"","url":"https://api.github.com/users/sink772","html_url":"https://github.com/sink772","followers_url":"https://api.github.com/users/sink772/followers","following_url":"https://api.github.com/users/sink772/following{/other_user}","gists_url":"https://api.github.com/users/sink772/gists{/gist_id}","starred_url":"https://api.github.com/users/sink772/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sink772/subscriptions","organizations_url":"https://api.github.com/users/sink772/orgs","repos_url":"https://api.github.com/users/sink772/repos","events_url":"https://api.github.com/users/sink772/events{/privacy}","received_events_url":"https://api.github.com/users/sink772/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/icon-project/icon-service/pulls/33/commits","review_comments_url":"https://api.github.com/repos/icon-project/icon-service/pulls/33/comments","review_comment_url":"https://api.github.com/repos/icon-project/icon-service/pulls/comments{/number}","comments_url":"https://api.github.com/repos/icon-project/icon-service/issues/33/comments","statuses_url":"https://api.github.com/repos/icon-project/icon-service/statuses/57a2d3e787a7251e8aa490a2a1ab94e2826c16de","head":{"label":"icon-project:improve-managing-step-counter-factory","ref":"improve-managing-step-counter-factory","sha":"57a2d3e787a7251e8aa490a2a1ab94e2826c16de","user":{"login":"icon-project","id":36242910,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MjQyOTEw","avatar_url":"https://avatars1.githubusercontent.com/u/36242910?v=4","gravatar_id":"","url":"https://api.github.com/users/icon-project","html_url":"https://github.com/icon-project","followers_url":"https://api.github.com/users/icon-project/followers","following_url":"https://api.github.com/users/icon-project/following{/other_user}","gists_url":"https://api.github.com/users/icon-project/gists{/gist_id}","starred_url":"https://api.github.com/users/icon-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icon-project/subscriptions","organizations_url":"https://api.github.com/users/icon-project/orgs","repos_url":"https://api.github.com/users/icon-project/repos","events_url":"https://api.github.com/users/icon-project/events{/privacy}","received_events_url":"https://api.github.com/users/icon-project/received_events","type":"Organization","site_admin":false},"repo":{"id":145930514,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU5MzA1MTQ=","name":"icon-service","full_name":"icon-project/icon-service","private":false,"owner":{"login":"icon-project","id":36242910,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MjQyOTEw","avatar_url":"https://avatars1.githubusercontent.com/u/36242910?v=4","gravatar_id":"","url":"https://api.github.com/users/icon-project","html_url":"https://github.com/icon-project","followers_url":"https://api.github.com/users/icon-project/followers","following_url":"https://api.github.com/users/icon-project/following{/other_user}","gists_url":"https://api.github.com/users/icon-project/gists{/gist_id}","starred_url":"https://api.github.com/users/icon-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icon-project/subscriptions","organizations_url":"https://api.github.com/users/icon-project/orgs","repos_url":"https://api.github.com/users/icon-project/repos","events_url":"https://api.github.com/users/icon-project/events{/privacy}","received_events_url":"https://api.github.com/users/icon-project/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/icon-project/icon-service","description":"ICON Service for Python","fork":false,"url":"https://api.github.com/repos/icon-project/icon-service","forks_url":"https://api.github.com/repos/icon-project/icon-service/forks","keys_url":"https://api.github.com/repos/icon-project/icon-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/icon-project/icon-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/icon-project/icon-service/teams","hooks_url":"https://api.github.com/repos/icon-project/icon-service/hooks","issue_events_url":"https://api.github.com/repos/icon-project/icon-service/issues/events{/number}","events_url":"https://api.github.com/repos/icon-project/icon-service/events","assignees_url":"https://api.github.com/repos/icon-project/icon-service/assignees{/user}","branches_url":"https://api.github.com/repos/icon-project/icon-service/branches{/branch}","tags_url":"https://api.github.com/repos/icon-project/icon-service/tags","blobs_url":"https://api.github.com/repos/icon-project/icon-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/icon-project/icon-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/icon-project/icon-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/icon-project/icon-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/icon-project/icon-service/statuses/{sha}","languages_url":"https://api.github.com/repos/icon-project/icon-service/languages","stargazers_url":"https://api.github.com/repos/icon-project/icon-service/stargazers","contributors_url":"https://api.github.com/repos/icon-project/icon-service/contributors","subscribers_url":"https://api.github.com/repos/icon-project/icon-service/subscribers","subscription_url":"https://api.github.com/repos/icon-project/icon-service/subscription","commits_url":"https://api.github.com/repos/icon-project/icon-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/icon-project/icon-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/icon-project/icon-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/icon-project/icon-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/icon-project/icon-service/contents/{+path}","compare_url":"https://api.github.com/repos/icon-project/icon-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/icon-project/icon-service/merges","archive_url":"https://api.github.com/repos/icon-project/icon-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/icon-project/icon-service/downloads","issues_url":"https://api.github.com/repos/icon-project/icon-service/issues{/number}","pulls_url":"https://api.github.com/repos/icon-project/icon-service/pulls{/number}","milestones_url":"https://api.github.com/repos/icon-project/icon-service/milestones{/number}","notifications_url":"https://api.github.com/repos/icon-project/icon-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/icon-project/icon-service/labels{/name}","releases_url":"https://api.github.com/repos/icon-project/icon-service/releases{/id}","deployments_url":"https://api.github.com/repos/icon-project/icon-service/deployments","created_at":"2018-08-24T02:13:20Z","updated_at":"2018-11-06T08:33:35Z","pushed_at":"2018-11-06T13:01:22Z","git_url":"git://github.com/icon-project/icon-service.git","ssh_url":"git@github.com:icon-project/icon-service.git","clone_url":"https://github.com/icon-project/icon-service.git","svn_url":"https://github.com/icon-project/icon-service","homepage":"","size":3546,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":4,"open_issues":4,"watchers":13,"default_branch":"develop"}},"base":{"label":"icon-project:develop","ref":"develop","sha":"f0c0ff1db8c0695c0304d4beb1ebc661c6296d21","user":{"login":"icon-project","id":36242910,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MjQyOTEw","avatar_url":"https://avatars1.githubusercontent.com/u/36242910?v=4","gravatar_id":"","url":"https://api.github.com/users/icon-project","html_url":"https://github.com/icon-project","followers_url":"https://api.github.com/users/icon-project/followers","following_url":"https://api.github.com/users/icon-project/following{/other_user}","gists_url":"https://api.github.com/users/icon-project/gists{/gist_id}","starred_url":"https://api.github.com/users/icon-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icon-project/subscriptions","organizations_url":"https://api.github.com/users/icon-project/orgs","repos_url":"https://api.github.com/users/icon-project/repos","events_url":"https://api.github.com/users/icon-project/events{/privacy}","received_events_url":"https://api.github.com/users/icon-project/received_events","type":"Organization","site_admin":false},"repo":{"id":145930514,"node_id":"MDEwOlJlcG9zaXRvcnkxNDU5MzA1MTQ=","name":"icon-service","full_name":"icon-project/icon-service","private":false,"owner":{"login":"icon-project","id":36242910,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM2MjQyOTEw","avatar_url":"https://avatars1.githubusercontent.com/u/36242910?v=4","gravatar_id":"","url":"https://api.github.com/users/icon-project","html_url":"https://github.com/icon-project","followers_url":"https://api.github.com/users/icon-project/followers","following_url":"https://api.github.com/users/icon-project/following{/other_user}","gists_url":"https://api.github.com/users/icon-project/gists{/gist_id}","starred_url":"https://api.github.com/users/icon-project/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/icon-project/subscriptions","organizations_url":"https://api.github.com/users/icon-project/orgs","repos_url":"https://api.github.com/users/icon-project/repos","events_url":"https://api.github.com/users/icon-project/events{/privacy}","received_events_url":"https://api.github.com/users/icon-project/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/icon-project/icon-service","description":"ICON Service for Python","fork":false,"url":"https://api.github.com/repos/icon-project/icon-service","forks_url":"https://api.github.com/repos/icon-project/icon-service/forks","keys_url":"https://api.github.com/repos/icon-project/icon-service/keys{/key_id}","collaborators_url":"https://api.github.com/repos/icon-project/icon-service/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/icon-project/icon-service/teams","hooks_url":"https://api.github.com/repos/icon-project/icon-service/hooks","issue_events_url":"https://api.github.com/repos/icon-project/icon-service/issues/events{/number}","events_url":"https://api.github.com/repos/icon-project/icon-service/events","assignees_url":"https://api.github.com/repos/icon-project/icon-service/assignees{/user}","branches_url":"https://api.github.com/repos/icon-project/icon-service/branches{/branch}","tags_url":"https://api.github.com/repos/icon-project/icon-service/tags","blobs_url":"https://api.github.com/repos/icon-project/icon-service/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/icon-project/icon-service/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/icon-project/icon-service/git/refs{/sha}","trees_url":"https://api.github.com/repos/icon-project/icon-service/git/trees{/sha}","statuses_url":"https://api.github.com/repos/icon-project/icon-service/statuses/{sha}","languages_url":"https://api.github.com/repos/icon-project/icon-service/languages","stargazers_url":"https://api.github.com/repos/icon-project/icon-service/stargazers","contributors_url":"https://api.github.com/repos/icon-project/icon-service/contributors","subscribers_url":"https://api.github.com/repos/icon-project/icon-service/subscribers","subscription_url":"https://api.github.com/repos/icon-project/icon-service/subscription","commits_url":"https://api.github.com/repos/icon-project/icon-service/commits{/sha}","git_commits_url":"https://api.github.com/repos/icon-project/icon-service/git/commits{/sha}","comments_url":"https://api.github.com/repos/icon-project/icon-service/comments{/number}","issue_comment_url":"https://api.github.com/repos/icon-project/icon-service/issues/comments{/number}","contents_url":"https://api.github.com/repos/icon-project/icon-service/contents/{+path}","compare_url":"https://api.github.com/repos/icon-project/icon-service/compare/{base}...{head}","merges_url":"https://api.github.com/repos/icon-project/icon-service/merges","archive_url":"https://api.github.com/repos/icon-project/icon-service/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/icon-project/icon-service/downloads","issues_url":"https://api.github.com/repos/icon-project/icon-service/issues{/number}","pulls_url":"https://api.github.com/repos/icon-project/icon-service/pulls{/number}","milestones_url":"https://api.github.com/repos/icon-project/icon-service/milestones{/number}","notifications_url":"https://api.github.com/repos/icon-project/icon-service/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/icon-project/icon-service/labels{/name}","releases_url":"https://api.github.com/repos/icon-project/icon-service/releases{/id}","deployments_url":"https://api.github.com/repos/icon-project/icon-service/deployments","created_at":"2018-08-24T02:13:20Z","updated_at":"2018-11-06T08:33:35Z","pushed_at":"2018-11-06T13:01:22Z","git_url":"git://github.com/icon-project/icon-service.git","ssh_url":"git@github.com:icon-project/icon-service.git","clone_url":"https://github.com/icon-project/icon-service.git","svn_url":"https://github.com/icon-project/icon-service","homepage":"","size":3546,"stargazers_count":13,"watchers_count":13,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":4,"license":null,"forks":4,"open_issues":4,"watchers":13,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/icon-project/icon-service/pulls/33"},"html":{"href":"https://github.com/icon-project/icon-service/pull/33"},"issue":{"href":"https://api.github.com/repos/icon-project/icon-service/issues/33"},"comments":{"href":"https://api.github.com/repos/icon-project/icon-service/issues/33/comments"},"review_comments":{"href":"https://api.github.com/repos/icon-project/icon-service/pulls/33/comments"},"review_comment":{"href":"https://api.github.com/repos/icon-project/icon-service/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/icon-project/icon-service/pulls/33/commits"},"statuses":{"href":"https://api.github.com/repos/icon-project/icon-service/statuses/57a2d3e787a7251e8aa490a2a1ab94e2826c16de"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"goldworm-icon"}}