{"action":"created","comment":{"url":"https://api.github.com/repos/paritytech/parity/pulls/comments/129270931","pull_request_review_id":52025372,"id":129270931,"diff_hunk":"@@ -391,9 +434,11 @@ fn light_new<T: AsRef<Path>>(cache_dir: T, block_number: u64) -> Light {\n \tassert!(cache_size % NODE_BYTES == 0, \"Unaligned cache size\");\n \tlet num_nodes = cache_size / NODE_BYTES;\n \n-\tlet mut nodes = Vec::with_capacity(num_nodes);\n-\tnodes.resize(num_nodes, Node::default());\n+\tlet mut nodes: Vec<Node> = Vec::with_capacity(num_nodes);\n \tunsafe {\n+\t\t// Use uninit instead of unnecessarily writing `size_of::<Node>() * num_nodes` 0s\n+\t\tnodes.set_len(num_nodes);","path":"ethash/src/compute.rs","position":185,"original_position":185,"commit_id":"540ee23b7560014e008c176aa36c6133976f7b62","original_commit_id":"540ee23b7560014e008c176aa36c6133976f7b62","user":{"login":"rphmeier","id":10121380,"avatar_url":"https://avatars1.githubusercontent.com/u/10121380?v=4","gravatar_id":"","url":"https://api.github.com/users/rphmeier","html_url":"https://github.com/rphmeier","followers_url":"https://api.github.com/users/rphmeier/followers","following_url":"https://api.github.com/users/rphmeier/following{/other_user}","gists_url":"https://api.github.com/users/rphmeier/gists{/gist_id}","starred_url":"https://api.github.com/users/rphmeier/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rphmeier/subscriptions","organizations_url":"https://api.github.com/users/rphmeier/orgs","repos_url":"https://api.github.com/users/rphmeier/repos","events_url":"https://api.github.com/users/rphmeier/events{/privacy}","received_events_url":"https://api.github.com/users/rphmeier/received_events","type":"User","site_admin":false},"body":"the loop that sets the `bytes` of each node to the hash of the previous' will be broken now if `nodes[0].bytes` is anything but default.","created_at":"2017-07-25T10:43:23Z","updated_at":"2017-07-25T10:43:23Z","html_url":"https://github.com/paritytech/parity/pull/6140#discussion_r129270931","pull_request_url":"https://api.github.com/repos/paritytech/parity/pulls/6140","_links":{"self":{"href":"https://api.github.com/repos/paritytech/parity/pulls/comments/129270931"},"html":{"href":"https://github.com/paritytech/parity/pull/6140#discussion_r129270931"},"pull_request":{"href":"https://api.github.com/repos/paritytech/parity/pulls/6140"}}},"pull_request":{"url":"https://api.github.com/repos/paritytech/parity/pulls/6140","id":132232518,"html_url":"https://github.com/paritytech/parity/pull/6140","diff_url":"https://github.com/paritytech/parity/pull/6140.diff","patch_url":"https://github.com/paritytech/parity/pull/6140.patch","issue_url":"https://api.github.com/repos/paritytech/parity/issues/6140","number":6140,"state":"open","locked":false,"title":"Fix unsoundness in ethash's unsafe code","user":{"login":"Vurich","id":29733394,"avatar_url":"https://avatars0.githubusercontent.com/u/29733394?v=4","gravatar_id":"","url":"https://api.github.com/users/Vurich","html_url":"https://github.com/Vurich","followers_url":"https://api.github.com/users/Vurich/followers","following_url":"https://api.github.com/users/Vurich/following{/other_user}","gists_url":"https://api.github.com/users/Vurich/gists{/gist_id}","starred_url":"https://api.github.com/users/Vurich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vurich/subscriptions","organizations_url":"https://api.github.com/users/Vurich/orgs","repos_url":"https://api.github.com/users/Vurich/repos","events_url":"https://api.github.com/users/Vurich/events{/privacy}","received_events_url":"https://api.github.com/users/Vurich/received_events","type":"User","site_admin":false},"body":"`some_vec.resize(n, mem::uninitialized())` is unsound since `resize` reads the value it is passed. Since it just writes it to the allocated block, this will currently (probably) just lead to LLVM optimising only the copies out and leaving the `self.len = n`, making this call equivalent to `set_len`. Since theoretically LLVM could do anything with these reads using `set_len` is more correct. This also relies on `resize` not, for example, branching on the passed value.\r\n\r\nAdditionally, reading beyond the end of an `&mut [T; N]` is unsound, although there is data there in this case. This is less likely to cause issues but if we're going to use unsafety it'd be better to keep it sound. I think that the Rust team is within rights to take advantage of this as an optimisation opportunity (which would, of course, make this problematic), but I don't know.","created_at":"2017-07-25T09:15:52Z","updated_at":"2017-07-25T10:43:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c63c7bbfc98d2b8dcc49e4ef4e9b76ac19ac9547","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/paritytech/parity/pulls/6140/commits","review_comments_url":"https://api.github.com/repos/paritytech/parity/pulls/6140/comments","review_comment_url":"https://api.github.com/repos/paritytech/parity/pulls/comments{/number}","comments_url":"https://api.github.com/repos/paritytech/parity/issues/6140/comments","statuses_url":"https://api.github.com/repos/paritytech/parity/statuses/540ee23b7560014e008c176aa36c6133976f7b62","head":{"label":"Vurich:fix-unsafety","ref":"fix-unsafety","sha":"540ee23b7560014e008c176aa36c6133976f7b62","user":{"login":"Vurich","id":29733394,"avatar_url":"https://avatars0.githubusercontent.com/u/29733394?v=4","gravatar_id":"","url":"https://api.github.com/users/Vurich","html_url":"https://github.com/Vurich","followers_url":"https://api.github.com/users/Vurich/followers","following_url":"https://api.github.com/users/Vurich/following{/other_user}","gists_url":"https://api.github.com/users/Vurich/gists{/gist_id}","starred_url":"https://api.github.com/users/Vurich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vurich/subscriptions","organizations_url":"https://api.github.com/users/Vurich/orgs","repos_url":"https://api.github.com/users/Vurich/repos","events_url":"https://api.github.com/users/Vurich/events{/privacy}","received_events_url":"https://api.github.com/users/Vurich/received_events","type":"User","site_admin":false},"repo":{"id":95567107,"name":"parity","full_name":"Vurich/parity","owner":{"login":"Vurich","id":29733394,"avatar_url":"https://avatars0.githubusercontent.com/u/29733394?v=4","gravatar_id":"","url":"https://api.github.com/users/Vurich","html_url":"https://github.com/Vurich","followers_url":"https://api.github.com/users/Vurich/followers","following_url":"https://api.github.com/users/Vurich/following{/other_user}","gists_url":"https://api.github.com/users/Vurich/gists{/gist_id}","starred_url":"https://api.github.com/users/Vurich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Vurich/subscriptions","organizations_url":"https://api.github.com/users/Vurich/orgs","repos_url":"https://api.github.com/users/Vurich/repos","events_url":"https://api.github.com/users/Vurich/events{/privacy}","received_events_url":"https://api.github.com/users/Vurich/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Vurich/parity","description":"Fast, light, robust Ethereum implementation","fork":true,"url":"https://api.github.com/repos/Vurich/parity","forks_url":"https://api.github.com/repos/Vurich/parity/forks","keys_url":"https://api.github.com/repos/Vurich/parity/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Vurich/parity/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Vurich/parity/teams","hooks_url":"https://api.github.com/repos/Vurich/parity/hooks","issue_events_url":"https://api.github.com/repos/Vurich/parity/issues/events{/number}","events_url":"https://api.github.com/repos/Vurich/parity/events","assignees_url":"https://api.github.com/repos/Vurich/parity/assignees{/user}","branches_url":"https://api.github.com/repos/Vurich/parity/branches{/branch}","tags_url":"https://api.github.com/repos/Vurich/parity/tags","blobs_url":"https://api.github.com/repos/Vurich/parity/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Vurich/parity/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Vurich/parity/git/refs{/sha}","trees_url":"https://api.github.com/repos/Vurich/parity/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Vurich/parity/statuses/{sha}","languages_url":"https://api.github.com/repos/Vurich/parity/languages","stargazers_url":"https://api.github.com/repos/Vurich/parity/stargazers","contributors_url":"https://api.github.com/repos/Vurich/parity/contributors","subscribers_url":"https://api.github.com/repos/Vurich/parity/subscribers","subscription_url":"https://api.github.com/repos/Vurich/parity/subscription","commits_url":"https://api.github.com/repos/Vurich/parity/commits{/sha}","git_commits_url":"https://api.github.com/repos/Vurich/parity/git/commits{/sha}","comments_url":"https://api.github.com/repos/Vurich/parity/comments{/number}","issue_comment_url":"https://api.github.com/repos/Vurich/parity/issues/comments{/number}","contents_url":"https://api.github.com/repos/Vurich/parity/contents/{+path}","compare_url":"https://api.github.com/repos/Vurich/parity/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Vurich/parity/merges","archive_url":"https://api.github.com/repos/Vurich/parity/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Vurich/parity/downloads","issues_url":"https://api.github.com/repos/Vurich/parity/issues{/number}","pulls_url":"https://api.github.com/repos/Vurich/parity/pulls{/number}","milestones_url":"https://api.github.com/repos/Vurich/parity/milestones{/number}","notifications_url":"https://api.github.com/repos/Vurich/parity/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Vurich/parity/labels{/name}","releases_url":"https://api.github.com/repos/Vurich/parity/releases{/id}","deployments_url":"https://api.github.com/repos/Vurich/parity/deployments","created_at":"2017-06-27T14:26:42Z","updated_at":"2017-06-27T14:26:50Z","pushed_at":"2017-07-25T09:09:56Z","git_url":"git://github.com/Vurich/parity.git","ssh_url":"git@github.com:Vurich/parity.git","clone_url":"https://github.com/Vurich/parity.git","svn_url":"https://github.com/Vurich/parity","homepage":"","size":99350,"stargazers_count":0,"watchers_count":0,"language":"Rust","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"paritytech:master","ref":"master","sha":"aa09cb266d8106436eaa2afa13aa5963fc6378d9","user":{"login":"paritytech","id":14176906,"avatar_url":"https://avatars2.githubusercontent.com/u/14176906?v=4","gravatar_id":"","url":"https://api.github.com/users/paritytech","html_url":"https://github.com/paritytech","followers_url":"https://api.github.com/users/paritytech/followers","following_url":"https://api.github.com/users/paritytech/following{/other_user}","gists_url":"https://api.github.com/users/paritytech/gists{/gist_id}","starred_url":"https://api.github.com/users/paritytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritytech/subscriptions","organizations_url":"https://api.github.com/users/paritytech/orgs","repos_url":"https://api.github.com/users/paritytech/repos","events_url":"https://api.github.com/users/paritytech/events{/privacy}","received_events_url":"https://api.github.com/users/paritytech/received_events","type":"Organization","site_admin":false},"repo":{"id":46714939,"name":"parity","full_name":"paritytech/parity","owner":{"login":"paritytech","id":14176906,"avatar_url":"https://avatars2.githubusercontent.com/u/14176906?v=4","gravatar_id":"","url":"https://api.github.com/users/paritytech","html_url":"https://github.com/paritytech","followers_url":"https://api.github.com/users/paritytech/followers","following_url":"https://api.github.com/users/paritytech/following{/other_user}","gists_url":"https://api.github.com/users/paritytech/gists{/gist_id}","starred_url":"https://api.github.com/users/paritytech/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paritytech/subscriptions","organizations_url":"https://api.github.com/users/paritytech/orgs","repos_url":"https://api.github.com/users/paritytech/repos","events_url":"https://api.github.com/users/paritytech/events{/privacy}","received_events_url":"https://api.github.com/users/paritytech/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/paritytech/parity","description":"Fast, light, robust Ethereum implementation","fork":false,"url":"https://api.github.com/repos/paritytech/parity","forks_url":"https://api.github.com/repos/paritytech/parity/forks","keys_url":"https://api.github.com/repos/paritytech/parity/keys{/key_id}","collaborators_url":"https://api.github.com/repos/paritytech/parity/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/paritytech/parity/teams","hooks_url":"https://api.github.com/repos/paritytech/parity/hooks","issue_events_url":"https://api.github.com/repos/paritytech/parity/issues/events{/number}","events_url":"https://api.github.com/repos/paritytech/parity/events","assignees_url":"https://api.github.com/repos/paritytech/parity/assignees{/user}","branches_url":"https://api.github.com/repos/paritytech/parity/branches{/branch}","tags_url":"https://api.github.com/repos/paritytech/parity/tags","blobs_url":"https://api.github.com/repos/paritytech/parity/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/paritytech/parity/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/paritytech/parity/git/refs{/sha}","trees_url":"https://api.github.com/repos/paritytech/parity/git/trees{/sha}","statuses_url":"https://api.github.com/repos/paritytech/parity/statuses/{sha}","languages_url":"https://api.github.com/repos/paritytech/parity/languages","stargazers_url":"https://api.github.com/repos/paritytech/parity/stargazers","contributors_url":"https://api.github.com/repos/paritytech/parity/contributors","subscribers_url":"https://api.github.com/repos/paritytech/parity/subscribers","subscription_url":"https://api.github.com/repos/paritytech/parity/subscription","commits_url":"https://api.github.com/repos/paritytech/parity/commits{/sha}","git_commits_url":"https://api.github.com/repos/paritytech/parity/git/commits{/sha}","comments_url":"https://api.github.com/repos/paritytech/parity/comments{/number}","issue_comment_url":"https://api.github.com/repos/paritytech/parity/issues/comments{/number}","contents_url":"https://api.github.com/repos/paritytech/parity/contents/{+path}","compare_url":"https://api.github.com/repos/paritytech/parity/compare/{base}...{head}","merges_url":"https://api.github.com/repos/paritytech/parity/merges","archive_url":"https://api.github.com/repos/paritytech/parity/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/paritytech/parity/downloads","issues_url":"https://api.github.com/repos/paritytech/parity/issues{/number}","pulls_url":"https://api.github.com/repos/paritytech/parity/pulls{/number}","milestones_url":"https://api.github.com/repos/paritytech/parity/milestones{/number}","notifications_url":"https://api.github.com/repos/paritytech/parity/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/paritytech/parity/labels{/name}","releases_url":"https://api.github.com/repos/paritytech/parity/releases{/id}","deployments_url":"https://api.github.com/repos/paritytech/parity/deployments","created_at":"2015-11-23T11:07:32Z","updated_at":"2017-07-25T10:28:05Z","pushed_at":"2017-07-25T10:33:26Z","git_url":"git://github.com/paritytech/parity.git","ssh_url":"git@github.com:paritytech/parity.git","clone_url":"https://github.com/paritytech/parity.git","svn_url":"https://github.com/paritytech/parity","homepage":"","size":99959,"stargazers_count":1677,"watchers_count":1677,"language":"Rust","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":342,"mirror_url":null,"open_issues_count":361,"forks":342,"open_issues":361,"watchers":1677,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/paritytech/parity/pulls/6140"},"html":{"href":"https://github.com/paritytech/parity/pull/6140"},"issue":{"href":"https://api.github.com/repos/paritytech/parity/issues/6140"},"comments":{"href":"https://api.github.com/repos/paritytech/parity/issues/6140/comments"},"review_comments":{"href":"https://api.github.com/repos/paritytech/parity/pulls/6140/comments"},"review_comment":{"href":"https://api.github.com/repos/paritytech/parity/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/paritytech/parity/pulls/6140/commits"},"statuses":{"href":"https://api.github.com/repos/paritytech/parity/statuses/540ee23b7560014e008c176aa36c6133976f7b62"}}}}
{"actor":{"display_login":"rphmeier"}}