{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/38968651","id":38968651,"diff_hunk":"@@ -0,0 +1,133 @@\n+// Copyright 2014 The go-ethereum Authors\n+// This file is part of the go-ethereum library.\n+//\n+// The go-ethereum library is free software: you can redistribute it and/or modify\n+// it under the terms of the GNU Lesser General Public License as published by\n+// the Free Software Foundation, either version 3 of the License, or\n+// (at your option) any later version.\n+//\n+// The go-ethereum library is distributed in the hope that it will be useful,\n+// but WITHOUT ANY WARRANTY; without even the implied warranty of\n+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n+// GNU Lesser General Public License for more details.\n+//\n+// You should have received a copy of the GNU Lesser General Public License\n+// along with the go-ethereum library. If not, see <http://www.gnu.org/licenses/>.\n+\n+// package filters implements an ethereum filtering system for block,\n+// transactions and log events.\n+package filters\n+\n+import (\n+\t\"sync\"\n+\n+\t\"github.com/ethereum/go-ethereum/core\"\n+\t\"github.com/ethereum/go-ethereum/core/vm\"\n+\t\"github.com/ethereum/go-ethereum/event\"\n+)\n+\n+// FilterSystem manages filters that filter specific events such as\n+// block, transaction and log events. The Filtering system can be used to listen\n+// for specific LOG events fires by the EVM (Ethereum Virtual Machine).","path":"eth/filters/filter_system.go","position":31,"original_position":31,"commit_id":"800b2b2833b98281d04c27e4818bc9d2e3d8e39d","original_commit_id":"800b2b2833b98281d04c27e4818bc9d2e3d8e39d","user":{"login":"Gustav-Simonsson","id":293096,"avatar_url":"https://avatars.githubusercontent.com/u/293096?v=3","gravatar_id":"","url":"https://api.github.com/users/Gustav-Simonsson","html_url":"https://github.com/Gustav-Simonsson","followers_url":"https://api.github.com/users/Gustav-Simonsson/followers","following_url":"https://api.github.com/users/Gustav-Simonsson/following{/other_user}","gists_url":"https://api.github.com/users/Gustav-Simonsson/gists{/gist_id}","starred_url":"https://api.github.com/users/Gustav-Simonsson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Gustav-Simonsson/subscriptions","organizations_url":"https://api.github.com/users/Gustav-Simonsson/orgs","repos_url":"https://api.github.com/users/Gustav-Simonsson/repos","events_url":"https://api.github.com/users/Gustav-Simonsson/events{/privacy}","received_events_url":"https://api.github.com/users/Gustav-Simonsson/received_events","type":"User","site_admin":false},"body":"fired","created_at":"2015-09-08T19:26:49Z","updated_at":"2015-09-08T19:26:49Z","html_url":"https://github.com/ethereum/go-ethereum/pull/1756#discussion_r38968651","pull_request_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1756","_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/38968651"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/1756#discussion_r38968651"},"pull_request":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1756"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1756","id":43935349,"html_url":"https://github.com/ethereum/go-ethereum/pull/1756","diff_url":"https://github.com/ethereum/go-ethereum/pull/1756.diff","patch_url":"https://github.com/ethereum/go-ethereum/pull/1756.patch","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1756","number":1756,"state":"open","locked":false,"title":"core, core/vm: refactor","user":{"login":"obscuren","id":6264126,"avatar_url":"https://avatars.githubusercontent.com/u/6264126?v=3","gravatar_id":"","url":"https://api.github.com/users/obscuren","html_url":"https://github.com/obscuren","followers_url":"https://api.github.com/users/obscuren/followers","following_url":"https://api.github.com/users/obscuren/following{/other_user}","gists_url":"https://api.github.com/users/obscuren/gists{/gist_id}","starred_url":"https://api.github.com/users/obscuren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obscuren/subscriptions","organizations_url":"https://api.github.com/users/obscuren/orgs","repos_url":"https://api.github.com/users/obscuren/repos","events_url":"https://api.github.com/users/obscuren/events{/privacy}","received_events_url":"https://api.github.com/users/obscuren/received_events","type":"User","site_admin":false},"body":"This PR will address the necessary changes for robuster and cleaner `core`\r\npackage. This PR will change the following packages: `core`, `core/vm` & \r\n`tests`.\r\n\r\n## Topics\r\n\r\nThe following topics will see refactoring:\r\n\r\n* `core`\r\n* `core/vm`\r\n\r\nMany of the `core` objects are used to modify **state** and many of them stack\r\nto complete modifications. The `core/vm` lacks in documentation and suffers from\r\ncode duplication due to the new JIT-VM.\r\n\r\n## Tasks\r\n\r\n- [x] Filter\r\n- [x] Execution object\r\n- [x] VM Database model\r\n- [x] Cleanup byte code vm\r\n- [x] Context => Contract\r\n- [x] State transition changes\r\n- [x] Remove checkpointing\r\n- [x] ChainManager => BlockChain\r\n- [x] VM documentation\r\n- [x] VM var cleanup\r\n\r\n## Changes\r\n\r\nThe `core.Filter` object and methods no longer use unexported core functionality\r\nand can therefor be moved to the `eth/filters` package. Remove the\r\n`core.Backend` dependency from the `core.Filter` objects by adding the following\r\n`core` method:\r\n\r\n* `core.GetCurrentBlock(db common.Database)` returns the current cononical HEAD of the chain\r\n\r\nand remove the dependency on the block manager by directly using\r\n`core.GetBlockReceipts`. These changes require the `core.NewFilter` to take a\r\n`common.Database` argument instead of `core.Backend`.\r\n\r\nInside `core/vm` `vm.Transact` needs to be moved to the `core` package. From a\r\nVM point of view \"transacting\" shouldn't exist. The VM shouldn't handle core\r\ntasks.\r\n\r\nThe `core/vm` depends on the `core/state` packages for handling state changes.\r\nAn interface needs to be created that can handle this instead (`vm.Database`)\r\nconsisting of the following methods:\r\n\r\n```go\r\ntype Database interface {\r\n\tGetAccount(common.Address) Account\r\n\tCreateAccount(common.Address) Account\r\n\r\n\tAddBalance(common.Address, *big.Int)\r\n\tGetBalance(common.Address) *big.Int\r\n\r\n\tGetNonce(common.Address) uint64\r\n\tSetNonce(common.Address, uint64)\r\n\r\n\tGetCode(common.Address) []byte\r\n\tSetCode(common.Address, []byte)\r\n\r\n\tRefund(*big.Int)\r\n\tRefunds() *big.Int\r\n\r\n\tGetState(common.Address, common.Hash) common.Hash\r\n\tSetState(common.Address, common.Hash, common.Hash)\r\n\r\n\tDelete(common.Address) bool\r\n\tExist(common.Address) bool\r\n\tIsDeleted(common.Address) bool\r\n}\r\n```\r\n\r\nThis will remove the dependency on the `core/state` packages.\r\n\r\nSome parts of the core depends on the `vm.Environment` for retrieving the\r\nstatedb. Now that `State` has been removed from the environment we can no longer\r\ndepend on it (and shouldn't).\r\n\r\nWhen a new object (e.g. account) is create - therefor creating a new instance of\r\nthe VM - upon returning the VM shouldn't be responsible for any state\r\nmodefication. Currently the VM is responsible for checking the error code and\r\nsetting the code if it's successful. This should be handled in the core instead\r\n(i.e. `core.Execution`).\r\n\r\nCleanup up the VM to use the same type code as the JIT-VM this in order to\r\nfurther reduce code duplication and reduce maintainability of the code and bugs\r\nthat would otherwise be required to be fixed in 2 places. By moving to the JIT\r\nspecific instructions it should optimise VM byte code execution by a small\r\nfactor.\r\n\r\nExtend the documentation of `core/vm`\r\n\r\n* Context method and objects\r\n* Common functions, variables and constants\r\n* Precompiled contracts functions\r\n* Memory methods and object\r\n* Stack method and object\r\n\r\nCleanup `core/vm/common.go` and remove unused variables/old variables.\r\n\r\nThe `vm.Context` object, while previous handling more than just contract\r\nrelated tasks should be renamed to `vm.Contract`. This is much more in line with\r\nwith it actual tasks and its purpose.\r\n\r\n`core` should reduce the amount of objects required to modify **state**. This\r\nshould make it much easier to be re-used and will remove some of the requirement\r\nto use the full **ethereum stack**:\r\n\r\n* `core.Execution` => `core.Create`\r\n* `core.Execution` => `core.Call`\r\n* `core.ApplyMessage` => `core.ApplyTransaction`\r\n\r\nThe `core.ApplyMessage` should be the initialiser of the `core.StateTransition`\r\nobject and the `core.NewStateTranstion` method should be removed. No pointer are\r\nrequired and no dynamic memory allocation is required this way. No pointer will\r\nbe escaped.\r\n\r\nWith the merging of the databases we can safely remove the checkpointing from\r\nthe chain manager.\r\n\r\nThe `core.ChainManager` object should be renamed to `core.BlockChain` to better\r\nreflect the meaning of the object itself.","created_at":"2015-09-01T22:39:29Z","updated_at":"2015-09-08T19:26:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c327d26ecd68fe8741d549977ef0989bb28d0893","assignee":{"login":"obscuren","id":6264126,"avatar_url":"https://avatars.githubusercontent.com/u/6264126?v=3","gravatar_id":"","url":"https://api.github.com/users/obscuren","html_url":"https://github.com/obscuren","followers_url":"https://api.github.com/users/obscuren/followers","following_url":"https://api.github.com/users/obscuren/following{/other_user}","gists_url":"https://api.github.com/users/obscuren/gists{/gist_id}","starred_url":"https://api.github.com/users/obscuren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obscuren/subscriptions","organizations_url":"https://api.github.com/users/obscuren/orgs","repos_url":"https://api.github.com/users/obscuren/repos","events_url":"https://api.github.com/users/obscuren/events{/privacy}","received_events_url":"https://api.github.com/users/obscuren/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1756/commits","review_comments_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1756/comments","review_comment_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1756/comments","statuses_url":"https://api.github.com/repos/ethereum/go-ethereum/statuses/800b2b2833b98281d04c27e4818bc9d2e3d8e39d","head":{"label":"obscuren:core-refactor","ref":"core-refactor","sha":"800b2b2833b98281d04c27e4818bc9d2e3d8e39d","user":{"login":"obscuren","id":6264126,"avatar_url":"https://avatars.githubusercontent.com/u/6264126?v=3","gravatar_id":"","url":"https://api.github.com/users/obscuren","html_url":"https://github.com/obscuren","followers_url":"https://api.github.com/users/obscuren/followers","following_url":"https://api.github.com/users/obscuren/following{/other_user}","gists_url":"https://api.github.com/users/obscuren/gists{/gist_id}","starred_url":"https://api.github.com/users/obscuren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obscuren/subscriptions","organizations_url":"https://api.github.com/users/obscuren/orgs","repos_url":"https://api.github.com/users/obscuren/repos","events_url":"https://api.github.com/users/obscuren/events{/privacy}","received_events_url":"https://api.github.com/users/obscuren/received_events","type":"User","site_admin":false},"repo":{"id":34282926,"name":"go-ethereum","full_name":"obscuren/go-ethereum","owner":{"login":"obscuren","id":6264126,"avatar_url":"https://avatars.githubusercontent.com/u/6264126?v=3","gravatar_id":"","url":"https://api.github.com/users/obscuren","html_url":"https://github.com/obscuren","followers_url":"https://api.github.com/users/obscuren/followers","following_url":"https://api.github.com/users/obscuren/following{/other_user}","gists_url":"https://api.github.com/users/obscuren/gists{/gist_id}","starred_url":"https://api.github.com/users/obscuren/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/obscuren/subscriptions","organizations_url":"https://api.github.com/users/obscuren/orgs","repos_url":"https://api.github.com/users/obscuren/repos","events_url":"https://api.github.com/users/obscuren/events{/privacy}","received_events_url":"https://api.github.com/users/obscuren/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/obscuren/go-ethereum","description":"Jeffrey Wilcke's Go implementation of the Ethereum y/w paper","fork":true,"url":"https://api.github.com/repos/obscuren/go-ethereum","forks_url":"https://api.github.com/repos/obscuren/go-ethereum/forks","keys_url":"https://api.github.com/repos/obscuren/go-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/obscuren/go-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/obscuren/go-ethereum/teams","hooks_url":"https://api.github.com/repos/obscuren/go-ethereum/hooks","issue_events_url":"https://api.github.com/repos/obscuren/go-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/obscuren/go-ethereum/events","assignees_url":"https://api.github.com/repos/obscuren/go-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/obscuren/go-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/obscuren/go-ethereum/tags","blobs_url":"https://api.github.com/repos/obscuren/go-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/obscuren/go-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/obscuren/go-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/obscuren/go-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/obscuren/go-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/obscuren/go-ethereum/languages","stargazers_url":"https://api.github.com/repos/obscuren/go-ethereum/stargazers","contributors_url":"https://api.github.com/repos/obscuren/go-ethereum/contributors","subscribers_url":"https://api.github.com/repos/obscuren/go-ethereum/subscribers","subscription_url":"https://api.github.com/repos/obscuren/go-ethereum/subscription","commits_url":"https://api.github.com/repos/obscuren/go-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/obscuren/go-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/obscuren/go-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/obscuren/go-ethereum/issues/comments{/number}","contents_url":"https://api.github.com/repos/obscuren/go-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/obscuren/go-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/obscuren/go-ethereum/merges","archive_url":"https://api.github.com/repos/obscuren/go-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/obscuren/go-ethereum/downloads","issues_url":"https://api.github.com/repos/obscuren/go-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/obscuren/go-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/obscuren/go-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/obscuren/go-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/obscuren/go-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/obscuren/go-ethereum/releases{/id}","created_at":"2015-04-20T19:55:44Z","updated_at":"2015-05-19T15:03:00Z","pushed_at":"2015-09-06T13:47:10Z","git_url":"git://github.com/obscuren/go-ethereum.git","ssh_url":"git@github.com:obscuren/go-ethereum.git","clone_url":"https://github.com/obscuren/go-ethereum.git","svn_url":"https://github.com/obscuren/go-ethereum","homepage":"","size":49231,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":1,"default_branch":"develop"}},"base":{"label":"ethereum:develop","ref":"develop","sha":"e2d7c1a52303ebdd8c2956badad5e600bf93ff33","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","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":15452919,"name":"go-ethereum","full_name":"ethereum/go-ethereum","owner":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars.githubusercontent.com/u/6250754?v=3","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/go-ethereum","description":"Jeffrey Wilcke's Go implementation of the Ethereum y/w paper","fork":false,"url":"https://api.github.com/repos/ethereum/go-ethereum","forks_url":"https://api.github.com/repos/ethereum/go-ethereum/forks","keys_url":"https://api.github.com/repos/ethereum/go-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ethereum/go-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ethereum/go-ethereum/teams","hooks_url":"https://api.github.com/repos/ethereum/go-ethereum/hooks","issue_events_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/ethereum/go-ethereum/events","assignees_url":"https://api.github.com/repos/ethereum/go-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/ethereum/go-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/ethereum/go-ethereum/tags","blobs_url":"https://api.github.com/repos/ethereum/go-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ethereum/go-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ethereum/go-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/ethereum/go-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ethereum/go-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/ethereum/go-ethereum/languages","stargazers_url":"https://api.github.com/repos/ethereum/go-ethereum/stargazers","contributors_url":"https://api.github.com/repos/ethereum/go-ethereum/contributors","subscribers_url":"https://api.github.com/repos/ethereum/go-ethereum/subscribers","subscription_url":"https://api.github.com/repos/ethereum/go-ethereum/subscription","commits_url":"https://api.github.com/repos/ethereum/go-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/ethereum/go-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/comments{/number}","contents_url":"https://api.github.com/repos/ethereum/go-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/ethereum/go-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ethereum/go-ethereum/merges","archive_url":"https://api.github.com/repos/ethereum/go-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ethereum/go-ethereum/downloads","issues_url":"https://api.github.com/repos/ethereum/go-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/ethereum/go-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/ethereum/go-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/ethereum/go-ethereum/releases{/id}","created_at":"2013-12-26T13:05:46Z","updated_at":"2015-09-08T19:05:14Z","pushed_at":"2015-09-08T15:55:41Z","git_url":"git://github.com/ethereum/go-ethereum.git","ssh_url":"git@github.com:ethereum/go-ethereum.git","clone_url":"https://github.com/ethereum/go-ethereum.git","svn_url":"https://github.com/ethereum/go-ethereum","homepage":"","size":81724,"stargazers_count":621,"watchers_count":621,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":207,"mirror_url":null,"open_issues_count":154,"forks":207,"open_issues":154,"watchers":621,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1756"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/1756"},"issue":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/1756"},"comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/1756/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1756/comments"},"review_comment":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1756/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/go-ethereum/statuses/800b2b2833b98281d04c27e4818bc9d2e3d8e39d"}}}}