{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/119981090","pull_request_review_id":41914856,"id":119981090,"diff_hunk":"@@ -128,9 +144,197 @@ type dataCopy struct{}\n //\n // This method does not require any overflow checking as the input size gas costs\n // required for anything significant is so high it's impossible to pay for.\n-func (c *dataCopy) RequiredGas(inputSize int) uint64 {\n-\treturn uint64(inputSize+31)/32*params.IdentityWordGas + params.IdentityGas\n+func (c *dataCopy) RequiredGas(input []byte) uint64 {\n+\treturn uint64(len(input)+31)/32*params.IdentityWordGas + params.IdentityGas\n+}\n+func (c *dataCopy) Run(in []byte) ([]byte, error) {\n+\treturn in, nil\n }\n-func (c *dataCopy) Run(in []byte) []byte {\n-\treturn in\n+\n+// bigModexp implements a native big integer exponential modular operation.\n+type bigModexp struct{}\n+\n+// RequiredGas returns the gas required to execute the pre-compiled contract.\n+//\n+// This method does not require any overflow checking as the input size gas costs\n+// required for anything significant is so high it's impossible to pay for.\n+func (c *bigModexp) RequiredGas(input []byte) uint64 {\n+\t// TODO reword required gas to have error reporting and convert arithmetic\n+\t// to uint64.\n+\tif len(input) < 3*32 {\n+\t\tinput = append(input, make([]byte, 3*32-len(input))...)\n+\t}\n+\tvar (\n+\t\tbaseLen = new(big.Int).SetBytes(input[:31])\n+\t\texpLen  = math.BigMax(new(big.Int).SetBytes(input[32:64]), big.NewInt(1))\n+\t\tmodLen  = new(big.Int).SetBytes(input[65:97])\n+\t)\n+\tx := new(big.Int).Set(math.BigMax(baseLen, modLen))\n+\tx.Mul(x, x)\n+\tx.Mul(x, expLen)\n+\tx.Div(x, new(big.Int).SetUint64(params.QuadCoeffDiv))\n+\n+\treturn x.Uint64()\n+}\n+\n+func (c *bigModexp) Run(input []byte) ([]byte, error) {\n+\tif len(input) < 3*32 {\n+\t\tinput = append(input, make([]byte, 3*32-len(input))...)\n+\t}\n+\t// why 32-byte? These values won't fit anyway\n+\tvar (\n+\t\tbaseLen = new(big.Int).SetBytes(input[:32]).Uint64()\n+\t\texpLen  = new(big.Int).SetBytes(input[32:64]).Uint64()\n+\t\tmodLen  = new(big.Int).SetBytes(input[64:96]).Uint64()\n+\t)\n+\n+\tinput = input[96:]\n+\tif uint64(len(input)) < baseLen {\n+\t\tinput = append(input, make([]byte, baseLen-uint64(len(input)))...)\n+\t}\n+\tbase := new(big.Int).SetBytes(input[:baseLen])\n+\n+\tinput = input[baseLen:]\n+\tif uint64(len(input)) < expLen {\n+\t\tinput = append(input, make([]byte, expLen-uint64(len(input)))...)\n+\t}\n+\texp := new(big.Int).SetBytes(input[:expLen])\n+\n+\tinput = input[expLen:]\n+\tif uint64(len(input)) < modLen {\n+\t\tinput = append(input, make([]byte, modLen-uint64(len(input)))...)\n+\t}\n+\tmod := new(big.Int).SetBytes(input[:modLen])\n+\n+\treturn base.Exp(base, exp, mod).Bytes(), nil\n+}\n+\n+type bn256Add struct{}\n+\n+// RequiredGas returns the gas required to execute the pre-compiled contract.\n+//\n+// This method does not require any overflow checking as the input size gas costs\n+// required for anything significant is so high it's impossible to pay for.\n+func (c *bn256Add) RequiredGas(input []byte) uint64 {\n+\treturn 0 // TODO\n+}\n+\n+func (c *bn256Add) Run(in []byte) ([]byte, error) {\n+\tif len(in) != 96 {","path":"core/vm/contracts.go","position":104,"original_position":217,"commit_id":"046fc67f6b54a67e57e90c63ef4ebd89bc3d8ac8","original_commit_id":"8042bbe804a02cde0f5e18c0913934d7b7bf5c8a","user":{"login":"obscuren","id":6264126,"avatar_url":"https://avatars1.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":"I believe when I wrote this it was still up for debate, including changing the semantics of CALLDATALOAD (i.e. that it should throw)","created_at":"2017-06-03T06:57:46Z","updated_at":"2017-06-03T06:57:46Z","html_url":"https://github.com/ethereum/go-ethereum/pull/14337#discussion_r119981090","pull_request_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/14337","_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/119981090"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/14337#discussion_r119981090"},"pull_request":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/14337"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/14337","id":116052070,"html_url":"https://github.com/ethereum/go-ethereum/pull/14337","diff_url":"https://github.com/ethereum/go-ethereum/pull/14337.diff","patch_url":"https://github.com/ethereum/go-ethereum/pull/14337.patch","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/14337","number":14337,"state":"open","locked":false,"title":"consensus, core/*: metropolis features","user":{"login":"obscuren","id":6264126,"avatar_url":"https://avatars1.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":"Review https://github.com/ethereum/go-ethereum/pull/14336 first","created_at":"2017-04-16T07:55:38Z","updated_at":"2017-06-03T06:57:46Z","closed_at":null,"merged_at":null,"merge_commit_sha":"47a5c75964a5e3e93c5dabdf7ceb69c187dee659","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":{"url":"https://api.github.com/repos/ethereum/go-ethereum/milestones/51","html_url":"https://github.com/ethereum/go-ethereum/milestone/51","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/milestones/51/labels","id":2555765,"number":51,"title":"1.6.4","description":"","creator":{"login":"karalabe","id":129561,"avatar_url":"https://avatars1.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},"open_issues":8,"closed_issues":1,"state":"open","created_at":"2017-06-01T09:54:15Z","updated_at":"2017-06-01T10:52:19Z","due_on":"2017-06-12T07:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/14337/commits","review_comments_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/14337/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/14337/comments","statuses_url":"https://api.github.com/repos/ethereum/go-ethereum/statuses/046fc67f6b54a67e57e90c63ef4ebd89bc3d8ac8","head":{"label":"obscuren:metropolis-finalisation","ref":"metropolis-finalisation","sha":"046fc67f6b54a67e57e90c63ef4ebd89bc3d8ac8","user":{"login":"obscuren","id":6264126,"avatar_url":"https://avatars1.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://avatars1.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-10-27T11:03:42Z","pushed_at":"2017-05-29T07:11:49Z","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":74556,"stargazers_count":4,"watchers_count":4,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":2,"mirror_url":null,"open_issues_count":2,"forks":2,"open_issues":2,"watchers":4,"default_branch":"master"}},"base":{"label":"ethereum:master","ref":"master","sha":"cb809c03da18bf45f961a931dfd4c765de144e66","user":{"login":"ethereum","id":6250754,"avatar_url":"https://avatars0.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://avatars0.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 Go 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":"2017-06-03T03:53:13Z","pushed_at":"2017-06-02T09:15:57Z","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":"https://geth.ethereum.org","size":86324,"stargazers_count":4448,"watchers_count":4448,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":1458,"mirror_url":null,"open_issues_count":364,"forks":1458,"open_issues":364,"watchers":4448,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/14337"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/14337"},"issue":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/14337"},"comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/14337/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/14337/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/14337/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/go-ethereum/statuses/046fc67f6b54a67e57e90c63ef4ebd89bc3d8ac8"}}}}
{"actor":{"display_login":"obscuren"}}