{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/56366631","id":56366631,"diff_hunk":"@@ -245,10 +251,34 @@ func (self *StateObject) Value() *big.Int {\n \tpanic(\"Value on StateObject should never be called\")\n }\n \n+func (self *StateObject) ForEachStorage(full bool, cb func(key, value common.Hash) bool) {\n+\t// When iterating over the storage check the cache first\n+\tfor h, sv := range self.storage {\n+\t\tif sv.dirty || full {\n+\t\t\tcb(h, sv.value)\n+\t\t}\n+\t}\n+\n+\t// if full storage retrieval is disabled abort here\n+\tif !full {\n+\t\treturn\n+\t}\n+\n+\tit := self.trie.Iterator()\n+\tfor it.Next() {\n+\t\t// ignore cached values\n+\t\tkey := common.BytesToHash(self.trie.GetKey(it.Key))\n+\t\tif _, ok := self.storage[key]; !ok {\n+\t\t\tcb(key, common.BytesToHash(it.Value))\n+\t\t}\n+\t}\n+}","path":"core/state/state_object.go","position":100,"original_position":100,"commit_id":"1f44e5e5d2fbda5d73ef7ce69354f3f5d3bff285","original_commit_id":"1f44e5e5d2fbda5d73ef7ce69354f3f5d3bff285","user":{"login":"karalabe","id":129561,"avatar_url":"https://avatars.githubusercontent.com/u/129561?v=3","gravatar_id":"","url":"https://api.github.com/users/karalabe","html_url":"https://github.com/karalabe","followers_url":"https://api.github.com/users/karalabe/followers","following_url":"https://api.github.com/users/karalabe/following{/other_user}","gists_url":"https://api.github.com/users/karalabe/gists{/gist_id}","starred_url":"https://api.github.com/users/karalabe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/karalabe/subscriptions","organizations_url":"https://api.github.com/users/karalabe/orgs","repos_url":"https://api.github.com/users/karalabe/repos","events_url":"https://api.github.com/users/karalabe/events{/privacy}","received_events_url":"https://api.github.com/users/karalabe/received_events","type":"User","site_admin":false},"body":"Hmm, this method will return duplicates if full is requested for both modified as well as requested keys. Shouldn't there rather be two separate sections?\r\n\r\n```go\r\nif !full {\r\n\tfor h, sv := range self.storage {\r\n \t\tif sv.dirty {\r\n \t\t\tcb(h, sv.value)\r\n \t\t}\r\n\t}\r\n\treturn\r\n}\r\nit := self.trie.Iterator()\r\n\tfor it.Next() {\r\n\t\t// ignore cached values\r\n\t\tkey := common.BytesToHash(self.trie.GetKey(it.Key))\r\n\t\tif _, ok := self.storage[key]; !ok {\r\n\t\t\tcb(key, common.BytesToHash(it.Value))\r\n\t\t}\r\n\t}\r\n```","created_at":"2016-03-16T16:31:49Z","updated_at":"2016-03-16T16:31:49Z","html_url":"https://github.com/ethereum/go-ethereum/pull/2141#discussion_r56366631","pull_request_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2141","_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/56366631"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/2141#discussion_r56366631"},"pull_request":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2141"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2141","id":56756445,"html_url":"https://github.com/ethereum/go-ethereum/pull/2141","diff_url":"https://github.com/ethereum/go-ethereum/pull/2141.diff","patch_url":"https://github.com/ethereum/go-ethereum/pull/2141.patch","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/2141","number":2141,"state":"open","locked":false,"title":"core, core/vm, tests: changed the initialisation behaviour of the EVM","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":"### Refactor EVM initialisation \r\n\r\n* The EVM was previously initialised and created for every `CALL`, `CALLCODE`,\r\n`DELEGATECALL` and `CREATE`. This PR changes this behaviour so that the same\r\nEVM can be used through the session and beyond as long as the\r\nEnvironment sticks around.\r\n* Renamed `Vm` to `EVM`\r\n* Additionally this removes the global EVM jump table and initialises a new jump table for each new instance of the EVM, removes the global `Debug` variable from package `core/vm` and includes a new `vm.Config` option which is passed to the `EVM` initialiser.\r\n* Changed structured logging to include the following configuration options:\r\n    * Disable storage capture\r\n    * Disable memory capture\r\n    * Disable stack capture\r\n    * Switch between full storage capture or changed values capture \r\n\r\n### Debugging options\r\n\r\nRefactored `eth/api` debug slightly:\r\n\r\n* Renamed `debug.replayTransaction` to `debug.transaction`\r\n* Changed `debug.transaction` and removed stack, storage & memory capture size and added a logger option object (see above):\r\n```\r\n{disableStorage: bool, disableMemory: bool, disableStack: bool, fullStorage: bool}\r\n```\r\n* Adds the following block debugging methods `debug.`(`block(rlp)`, `blockFromFile(fileName)`, `blockFromNumber(number)`, `blockFromHash(hash)`)","created_at":"2016-01-21T14:31:36Z","updated_at":"2016-03-16T16:31:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a21a3e19b8f62b2441e8084e3d5a2c65ab5e77b3","assignee":null,"milestone":{"url":"https://api.github.com/repos/ethereum/go-ethereum/milestones/20","html_url":"https://github.com/ethereum/go-ethereum/milestones/1.4.0","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/milestones/20/labels","id":1299388,"number":20,"title":"1.4.0","description":"","creator":{"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},"open_issues":37,"closed_issues":89,"state":"open","created_at":"2015-09-10T13:53:50Z","updated_at":"2016-03-16T11:12:46Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2141/commits","review_comments_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2141/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/2141/comments","statuses_url":"https://api.github.com/repos/ethereum/go-ethereum/statuses/1f44e5e5d2fbda5d73ef7ce69354f3f5d3bff285","head":{"label":"obscuren:evm-init","ref":"evm-init","sha":"1f44e5e5d2fbda5d73ef7ce69354f3f5d3bff285","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}","deployments_url":"https://api.github.com/repos/obscuren/go-ethereum/deployments","created_at":"2015-04-20T19:55:44Z","updated_at":"2016-02-28T22:01:00Z","pushed_at":"2016-03-16T12:59:23Z","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":54011,"stargazers_count":1,"watchers_count":1,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1,"mirror_url":null,"open_issues_count":3,"forks":1,"open_issues":3,"watchers":1,"default_branch":"develop"}},"base":{"label":"ethereum:develop","ref":"develop","sha":"2855a93ede6e9437d05a82c2397d48744621db9b","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":"Official golang implementation of the Ethereum protocol","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}","deployments_url":"https://api.github.com/repos/ethereum/go-ethereum/deployments","created_at":"2013-12-26T13:05:46Z","updated_at":"2016-03-16T16:07:43Z","pushed_at":"2016-03-16T16:30: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":"http://ethereum.github.io/go-ethereum/","size":155382,"stargazers_count":1175,"watchers_count":1175,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":385,"mirror_url":null,"open_issues_count":197,"forks":385,"open_issues":197,"watchers":1175,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2141"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/2141"},"issue":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/2141"},"comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/2141/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/2141/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/2141/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/go-ethereum/statuses/1f44e5e5d2fbda5d73ef7ce69354f3f5d3bff285"}}}}