{"action":"created","issue":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/18254","repository_url":"https://api.github.com/repos/ethereum/go-ethereum","labels_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/18254/labels{/name}","comments_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/18254/comments","events_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/18254/events","html_url":"https://github.com/ethereum/go-ethereum/issues/18254","id":388419785,"node_id":"MDU6SXNzdWUzODg0MTk3ODU=","number":18254,"title":"Need to throw error when methods are called at future blocks","user":{"login":"danfinlay","id":542863,"node_id":"MDQ6VXNlcjU0Mjg2Mw==","avatar_url":"https://avatars0.githubusercontent.com/u/542863?v=4","gravatar_id":"","url":"https://api.github.com/users/danfinlay","html_url":"https://github.com/danfinlay","followers_url":"https://api.github.com/users/danfinlay/followers","following_url":"https://api.github.com/users/danfinlay/following{/other_user}","gists_url":"https://api.github.com/users/danfinlay/gists{/gist_id}","starred_url":"https://api.github.com/users/danfinlay/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danfinlay/subscriptions","organizations_url":"https://api.github.com/users/danfinlay/orgs","repos_url":"https://api.github.com/users/danfinlay/repos","events_url":"https://api.github.com/users/danfinlay/events{/privacy}","received_events_url":"https://api.github.com/users/danfinlay/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":4,"created_at":"2018-12-06T22:10:32Z","updated_at":"2018-12-07T21:51:57Z","closed_at":null,"author_association":"NONE","body":"#### System information\r\n\r\nGeth version: 1.8.15 (Infura)\r\nOS & Version: Linux\r\nCommit hash : \r\n\r\n#### Expected behaviour\r\n\r\nGeth should throw an error when making a request on a future block.\r\n\r\n#### Actual behaviour\r\n\r\nMany types of request simply return `null` or `0x` when the `block` parameter is an integer for a future unknown block.\r\n\r\nThis is especially troublesome for clients that hit load-balanced geth clusters like Infura, where one request for latest block could return one number, and then suddenly requests at that block height could start returning `null` and `0x`, resulting in inconsistent client app state.\r\n\r\nIn short: This is the cause of many bugs in MetaMask and Dapps building on MetaMask, and probably other similar clients as well, and there is no way for us to detect or work around this issue without a fix in Geth.\r\n\r\n#### Steps to reproduce the behaviour\r\n\r\nThis bug can be reproduced with many methods that we're aware of, and probably many more are possible.\r\n\r\n`getStorageAt` of a known contract (`mkr`) on a future block:\r\n```\r\ncurl 'https://mainnet.infura.io/' -H 'pragma: no-cache' -H 'origin: null' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en,fr;q=0.9,en-US;q=0.8,es;q=0.7' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36' -H 'content-type: application/json' -H 'accept: application/json' -H 'cache-control: no-cache' -H 'authority: mainnet.infura.io' --data-binary '{\"jsonrpc\":\"2.0\",\"id\":914762274,\"method\":\"eth_getStorageAt\",\"params\":[\"0x9f8f72aa9304c8b593d555f12ef6589cc3a579a2\",\"0x0\",\"0x962124\"]}' --compressed\r\n```\r\n\r\nReturns `{\"jsonrpc\":\"2.0\",\"id\":914762274,\"result\":\"0x\"}`, as if the contract were never published.\r\n\r\n`eth_getTransactionCount` of an account with some mined transactions, on a future block:\r\n```\r\ncurl 'https://mainnet.infura.io/' -H 'pragma: no-cache' -H 'origin: null' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en,fr;q=0.9,en-US;q=0.8,es;q=0.7' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36' -H 'content-type: application/json' -H 'accept: application/json' -H 'cache-control: no-cache' -H 'authority: mainnet.infura.io' --data-binary '{\"id\":6972925150872393,\"jsonrpc\":\"2.0\",\"params\":[\"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825\",\"0x885ac5\"],\"method\":\"eth_getTransactionCount\"}' --compressed\r\n```\r\n\r\nReturns `{\"jsonrpc\":\"2.0\",\"id\":6972925150872393,\"result\":null}`, as if there were no error. At least this value can possibly be detected as invalid.\r\n\r\n`eth_getBalance` on an account with some ether, on a future block:\r\n```\r\ncurl 'https://mainnet.infura.io/' -H 'pragma: no-cache' -H 'origin: null' -H 'accept-encoding: gzip, deflate, br' -H 'accept-language: en,fr;q=0.9,en-US;q=0.8,es;q=0.7' -H 'user-agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/66.0.3359.139 Safari/537.36' -H 'content-type: application/json' -H 'accept: application/json' -H 'cache-control: no-cache' -H 'authority: mainnet.infura.io' --data-binary '{\"id\":2366105135518150,\"jsonrpc\":\"2.0\",\"params\":[\"0xfdea65c8e26263f6d9a1b5de9555d2931a33b825\",\"0x885ab5\"],\"method\":\"eth_getBalance\"}' --compressed\r\n```\r\n\r\nReturns `{\"jsonrpc\":\"2.0\",\"id\":2366105135518150,\"result\":null}`, as if there were no error. At least this value can possibly be detected as invalid.\r\n\r\nRelated to #3483."},"comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/issues/comments/445377079","html_url":"https://github.com/ethereum/go-ethereum/issues/18254#issuecomment-445377079","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/18254","id":445377079,"node_id":"MDEyOklzc3VlQ29tbWVudDQ0NTM3NzA3OQ==","user":{"login":"gitcoinbot","id":27903976,"node_id":"MDQ6VXNlcjI3OTAzOTc2","avatar_url":"https://avatars2.githubusercontent.com/u/27903976?v=4","gravatar_id":"","url":"https://api.github.com/users/gitcoinbot","html_url":"https://github.com/gitcoinbot","followers_url":"https://api.github.com/users/gitcoinbot/followers","following_url":"https://api.github.com/users/gitcoinbot/following{/other_user}","gists_url":"https://api.github.com/users/gitcoinbot/gists{/gist_id}","starred_url":"https://api.github.com/users/gitcoinbot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gitcoinbot/subscriptions","organizations_url":"https://api.github.com/users/gitcoinbot/orgs","repos_url":"https://api.github.com/users/gitcoinbot/repos","events_url":"https://api.github.com/users/gitcoinbot/events{/privacy}","received_events_url":"https://api.github.com/users/gitcoinbot/received_events","type":"User","site_admin":false},"created_at":"2018-12-07T21:51:57Z","updated_at":"2018-12-07T21:51:57Z","author_association":"NONE","body":"Issue Status: 1. **Open** 2. Started 3. Submitted 4. Done \n\n<hr>\n\n__Work has been started__.\n\n\nThese users each claimed they can complete the work by 12 months from now.\nPlease review their action plans below:\n\n\n**1) [jorropo](https://gitcoin.co/profile/jorropo) has started work.**\n\nI add an exception of type 4xx and add some unit test to verify.\n\nLearn more [on the Gitcoin Issue Details page](https://gitcoin.co/issue/ethereum/go-ethereum/18254/1920).\n\n"}}
{"actor":{"display_login":"gitcoinbot"}}