{"action":"created","comment":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/40805746","id":40805746,"diff_hunk":"@@ -27,89 +26,116 @@ import (\n \t\"github.com/ethereum/go-ethereum/rlp\"\n )\n \n+// Receipt represents the results of a transaction.\n type Receipt struct {\n+\t// Consensus fields\n \tPostState         []byte\n \tCumulativeGasUsed *big.Int\n \tBloom             Bloom\n-\tTxHash            common.Hash\n-\tContractAddress   common.Address\n-\tlogs              state.Logs\n-\tGasUsed           *big.Int\n+\tLogs              state.Logs\n+\n+\t// Implementation fields\n+\tTxHash          common.Hash\n+\tContractAddress common.Address\n+\tGasUsed         *big.Int\n }\n \n+// NewReceipt creates a barebone transaction receipt, copying the init fields.\n func NewReceipt(root []byte, cumalativeGasUsed *big.Int) *Receipt {\n \treturn &Receipt{PostState: common.CopyBytes(root), CumulativeGasUsed: new(big.Int).Set(cumalativeGasUsed)}\n }\n \n-func (self *Receipt) SetLogs(logs state.Logs) {\n-\tself.logs = logs\n-}\n-\n-func (self *Receipt) Logs() state.Logs {\n-\treturn self.logs\n-}\n-\n-func (self *Receipt) EncodeRLP(w io.Writer) error {\n-\treturn rlp.Encode(w, []interface{}{self.PostState, self.CumulativeGasUsed, self.Bloom, self.logs})\n+// EncodeRLP implements rlp.Encoder, and flattens the consensus fields of a receipt\n+// into an RLP stream.\n+func (r *Receipt) EncodeRLP(w io.Writer) error {\n+\treturn rlp.Encode(w, []interface{}{r.PostState, r.CumulativeGasUsed, r.Bloom, r.Logs})\n }\n \n-func (self *Receipt) DecodeRLP(s *rlp.Stream) error {\n-\tvar r struct {\n+// DecodeRLP implements rlp.Decoder, and loads the consensus fields of a receipt\n+// from an RLP stream.\n+func (r *Receipt) DecodeRLP(s *rlp.Stream) error {\n+\tvar receipt struct {\n \t\tPostState         []byte\n \t\tCumulativeGasUsed *big.Int\n \t\tBloom             Bloom\n-\t\tTxHash            common.Hash\n-\t\tContractAddress   common.Address\n \t\tLogs              state.Logs\n-\t\tGasUsed           *big.Int\n \t}\n-\tif err := s.Decode(&r); err != nil {\n+\tif err := s.Decode(&receipt); err != nil {\n \t\treturn err\n \t}\n-\tself.PostState, self.CumulativeGasUsed, self.Bloom, self.TxHash, self.ContractAddress, self.logs, self.GasUsed = r.PostState, r.CumulativeGasUsed, r.Bloom, r.TxHash, r.ContractAddress, r.Logs, r.GasUsed\n-\n+\tr.PostState, r.CumulativeGasUsed, r.Bloom, r.Logs = receipt.PostState, receipt.CumulativeGasUsed, receipt.Bloom, receipt.Logs\n \treturn nil\n }\n \n-type ReceiptForStorage Receipt\n-\n-func (self *ReceiptForStorage) EncodeRLP(w io.Writer) error {\n-\tstorageLogs := make([]*state.LogForStorage, len(self.logs))\n-\tfor i, log := range self.logs {\n-\t\tstorageLogs[i] = (*state.LogForStorage)(log)\n-\t}\n-\treturn rlp.Encode(w, []interface{}{self.PostState, self.CumulativeGasUsed, self.Bloom, self.TxHash, self.ContractAddress, storageLogs, self.GasUsed})\n-}\n-\n-func (self *Receipt) RlpEncode() []byte {\n-\tbytes, err := rlp.EncodeToBytes(self)\n+// RlpEncode implements common.RlpEncode required for SHA derivation.\n+func (r *Receipt) RlpEncode() []byte {\n+\tbytes, err := rlp.EncodeToBytes(r)\n \tif err != nil {\n-\t\tfmt.Println(\"TMP -- RECEIPT ENCODE ERROR\", err)\n+\t\tpanic(err)\n \t}\n \treturn bytes\n }\n \n-func (self *Receipt) Cmp(other *Receipt) bool {\n-\tif bytes.Compare(self.PostState, other.PostState) != 0 {\n-\t\treturn false\n-\t}\n+// String implements the Stringer interface.\n+func (r *Receipt) String() string {\n+\treturn fmt.Sprintf(\"receipt{med=%x cgas=%v bloom=%x logs=%v}\", r.PostState, r.CumulativeGasUsed, r.Bloom, r.Logs)","path":"core/types/receipt.go","position":103,"original_position":103,"commit_id":"f6ec4aa02ddcde3c1009805b08aa3456462d91d2","original_commit_id":"f6ec4aa02ddcde3c1009805b08aa3456462d91d2","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":"Would ```:``` be more canonical than ```=``` as it's closer to Go syntax?","created_at":"2015-09-30T15:08:48Z","updated_at":"2015-09-30T15:08:48Z","html_url":"https://github.com/ethereum/go-ethereum/pull/1857#discussion_r40805746","pull_request_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1857","_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/comments/40805746"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/1857#discussion_r40805746"},"pull_request":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1857"}}},"pull_request":{"url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1857","id":46301752,"html_url":"https://github.com/ethereum/go-ethereum/pull/1857","diff_url":"https://github.com/ethereum/go-ethereum/pull/1857.diff","patch_url":"https://github.com/ethereum/go-ethereum/pull/1857.patch","issue_url":"https://api.github.com/repos/ethereum/go-ethereum/issues/1857","number":1857,"state":"open","locked":false,"title":"core: differentiate receipt concensus and storage decoding","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":"This PR contains the necessary modifications to make Receipts and Logs transferable over the network. Previously the decoders always expected a full storage version, which obviously won't happen over the network, so we need to explicitly decode database contents as storage receipts/logs, and leave the plain receipts/logs to decode as only the consensus fields.","created_at":"2015-09-29T16:40:31Z","updated_at":"2015-09-30T15:08:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6a7b282d5787a474afb2d9d19205b0669c5b9b81","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1857/commits","review_comments_url":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1857/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/1857/comments","statuses_url":"https://api.github.com/repos/ethereum/go-ethereum/statuses/f6ec4aa02ddcde3c1009805b08aa3456462d91d2","head":{"label":"karalabe:differentiate-consensus-storage-encoding","ref":"differentiate-consensus-storage-encoding","sha":"f6ec4aa02ddcde3c1009805b08aa3456462d91d2","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},"repo":{"id":33668567,"name":"go-ethereum","full_name":"karalabe/go-ethereum","owner":{"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},"private":false,"html_url":"https://github.com/karalabe/go-ethereum","description":"Jeffrey Wilcke's Go implementation of the Ethereum y/w paper","fork":true,"url":"https://api.github.com/repos/karalabe/go-ethereum","forks_url":"https://api.github.com/repos/karalabe/go-ethereum/forks","keys_url":"https://api.github.com/repos/karalabe/go-ethereum/keys{/key_id}","collaborators_url":"https://api.github.com/repos/karalabe/go-ethereum/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/karalabe/go-ethereum/teams","hooks_url":"https://api.github.com/repos/karalabe/go-ethereum/hooks","issue_events_url":"https://api.github.com/repos/karalabe/go-ethereum/issues/events{/number}","events_url":"https://api.github.com/repos/karalabe/go-ethereum/events","assignees_url":"https://api.github.com/repos/karalabe/go-ethereum/assignees{/user}","branches_url":"https://api.github.com/repos/karalabe/go-ethereum/branches{/branch}","tags_url":"https://api.github.com/repos/karalabe/go-ethereum/tags","blobs_url":"https://api.github.com/repos/karalabe/go-ethereum/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/karalabe/go-ethereum/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/karalabe/go-ethereum/git/refs{/sha}","trees_url":"https://api.github.com/repos/karalabe/go-ethereum/git/trees{/sha}","statuses_url":"https://api.github.com/repos/karalabe/go-ethereum/statuses/{sha}","languages_url":"https://api.github.com/repos/karalabe/go-ethereum/languages","stargazers_url":"https://api.github.com/repos/karalabe/go-ethereum/stargazers","contributors_url":"https://api.github.com/repos/karalabe/go-ethereum/contributors","subscribers_url":"https://api.github.com/repos/karalabe/go-ethereum/subscribers","subscription_url":"https://api.github.com/repos/karalabe/go-ethereum/subscription","commits_url":"https://api.github.com/repos/karalabe/go-ethereum/commits{/sha}","git_commits_url":"https://api.github.com/repos/karalabe/go-ethereum/git/commits{/sha}","comments_url":"https://api.github.com/repos/karalabe/go-ethereum/comments{/number}","issue_comment_url":"https://api.github.com/repos/karalabe/go-ethereum/issues/comments{/number}","contents_url":"https://api.github.com/repos/karalabe/go-ethereum/contents/{+path}","compare_url":"https://api.github.com/repos/karalabe/go-ethereum/compare/{base}...{head}","merges_url":"https://api.github.com/repos/karalabe/go-ethereum/merges","archive_url":"https://api.github.com/repos/karalabe/go-ethereum/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/karalabe/go-ethereum/downloads","issues_url":"https://api.github.com/repos/karalabe/go-ethereum/issues{/number}","pulls_url":"https://api.github.com/repos/karalabe/go-ethereum/pulls{/number}","milestones_url":"https://api.github.com/repos/karalabe/go-ethereum/milestones{/number}","notifications_url":"https://api.github.com/repos/karalabe/go-ethereum/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/karalabe/go-ethereum/labels{/name}","releases_url":"https://api.github.com/repos/karalabe/go-ethereum/releases{/id}","created_at":"2015-04-09T12:51:45Z","updated_at":"2015-04-17T13:40:48Z","pushed_at":"2015-09-29T16:38:53Z","git_url":"git://github.com/karalabe/go-ethereum.git","ssh_url":"git@github.com:karalabe/go-ethereum.git","clone_url":"https://github.com/karalabe/go-ethereum.git","svn_url":"https://github.com/karalabe/go-ethereum","homepage":"","size":49389,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"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":"develop"}},"base":{"label":"ethereum:develop","ref":"develop","sha":"9b94076717dfc65bda1470eecd6f61a0323f9bac","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}","created_at":"2013-12-26T13:05:46Z","updated_at":"2015-09-29T22:18:29Z","pushed_at":"2015-09-30T14:23:12Z","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":82325,"stargazers_count":650,"watchers_count":650,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":225,"mirror_url":null,"open_issues_count":110,"forks":225,"open_issues":110,"watchers":650,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1857"},"html":{"href":"https://github.com/ethereum/go-ethereum/pull/1857"},"issue":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/1857"},"comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/issues/1857/comments"},"review_comments":{"href":"https://api.github.com/repos/ethereum/go-ethereum/pulls/1857/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/1857/commits"},"statuses":{"href":"https://api.github.com/repos/ethereum/go-ethereum/statuses/f6ec4aa02ddcde3c1009805b08aa3456462d91d2"}}}}