{"action":"created","comment":{"url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/comments/299734669","pull_request_review_id":257210245,"id":299734669,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI5OTczNDY2OQ==","diff_hunk":"@@ -82,6 +83,94 @@ however, adding a 6-byte padding after the type field was considered\n wasteful: alignment may be achieved by decrypting the message into\n a buffer with 6-bytes of pre-padding.\n \n+\n+## Type-Length-Value Format\n+\n+Throughout the protocol, a TLV (Type-Length-Value) format is used to allow for\n+the backwards-compatible addition of new fields to existing message types.\n+\n+A `tlv_record` represents a single field, encoded in the form:\n+\n+* [`varint`: `type`]\n+* [`varint`: `length`]\n+* [`length`: `value`]\n+\n+A `tlv_stream` is a series of (possibly zero) `tlv_record`s, represented as the\n+concatenation of the encoded `tlv_record`s. When used to extend existing\n+messages, a `tlv_stream` is typically placed after all currently defined fields.\n+\n+The `type` is a varint encoded using the bitcoin CompactSize format. It\n+functions as a message-specific, 64-bit identifier for the `tlv_record`\n+determining how the contents of `value` should be decoded.\n+\n+The `length` is a varint encoded using the bitcoin CompactSize format\n+signaling the size of `value` in bytes.\n+\n+The `value` depends entirely on the `type`, and should be encoded or decoded\n+according to the message-specific format determined by `type`.\n+\n+### Requirements\n+\n+The sending node:\n+ - MUST order `tlv_record`s in a `tlv_stream` by monotonically-increasing `type`.\n+ - MUST minimally encode `type` and `length`.\n+ - SHOULD NOT use redundant, variable-length encodings in a `tlv_record`.\n+\n+The receiving node:","path":"01-messaging.md","position":45,"original_position":45,"commit_id":"779664cd820a76db53f397a20488540b6438e734","original_commit_id":"779664cd820a76db53f397a20488540b6438e734","user":{"login":"Roasbeef","id":998190,"node_id":"MDQ6VXNlcjk5ODE5MA==","avatar_url":"https://avatars3.githubusercontent.com/u/998190?v=4","gravatar_id":"","url":"https://api.github.com/users/Roasbeef","html_url":"https://github.com/Roasbeef","followers_url":"https://api.github.com/users/Roasbeef/followers","following_url":"https://api.github.com/users/Roasbeef/following{/other_user}","gists_url":"https://api.github.com/users/Roasbeef/gists{/gist_id}","starred_url":"https://api.github.com/users/Roasbeef/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Roasbeef/subscriptions","organizations_url":"https://api.github.com/users/Roasbeef/orgs","repos_url":"https://api.github.com/users/Roasbeef/repos","events_url":"https://api.github.com/users/Roasbeef/events{/privacy}","received_events_url":"https://api.github.com/users/Roasbeef/received_events","type":"User","site_admin":false},"body":"I guess this is covered by the \"strictly increasing\" requirement. ","created_at":"2019-07-03T00:25:39Z","updated_at":"2019-07-03T00:25:39Z","html_url":"https://github.com/lightningnetwork/lightning-rfc/pull/607#discussion_r299734669","pull_request_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/607","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/comments/299734669"},"html":{"href":"https://github.com/lightningnetwork/lightning-rfc/pull/607#discussion_r299734669"},"pull_request":{"href":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/607"}},"in_reply_to_id":299734375},"pull_request":{"url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/607","id":277210527,"node_id":"MDExOlB1bGxSZXF1ZXN0Mjc3MjEwNTI3","html_url":"https://github.com/lightningnetwork/lightning-rfc/pull/607","diff_url":"https://github.com/lightningnetwork/lightning-rfc/pull/607.diff","patch_url":"https://github.com/lightningnetwork/lightning-rfc/pull/607.patch","issue_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/issues/607","number":607,"state":"open","locked":false,"title":"BOLT01: TLV proposal","user":{"login":"cfromknecht","id":2013993,"node_id":"MDQ6VXNlcjIwMTM5OTM=","avatar_url":"https://avatars1.githubusercontent.com/u/2013993?v=4","gravatar_id":"","url":"https://api.github.com/users/cfromknecht","html_url":"https://github.com/cfromknecht","followers_url":"https://api.github.com/users/cfromknecht/followers","following_url":"https://api.github.com/users/cfromknecht/following{/other_user}","gists_url":"https://api.github.com/users/cfromknecht/gists{/gist_id}","starred_url":"https://api.github.com/users/cfromknecht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfromknecht/subscriptions","organizations_url":"https://api.github.com/users/cfromknecht/orgs","repos_url":"https://api.github.com/users/cfromknecht/repos","events_url":"https://api.github.com/users/cfromknecht/events{/privacy}","received_events_url":"https://api.github.com/users/cfromknecht/received_events","type":"User","site_admin":false},"body":"~~This proposal outlines a TLV format intended for wire messages. It contains additional considerations for gossip messages that would require maintaining the ability to verify signatures over unknown fields, and the ability to propagate those messages to peers.~~\r\n\r\n~~This proposal makes different tradeoffs from #603 in terms of:~~\r\n - ~~requiring strict canonical encoding~~\r\n - ~~fixed-size length encoding~~\r\n - ~~supporting reserialization of unknown records~~\r\n - ~~using 255 as the sentinel type identifier~~\r\n - ~~removing even/odd requirement from the parsing logic, favoring negotiation via feature bits or application of such constraints external to the fundamental parsing requirements~~\r\n\r\nAfter significant feedback and discussion, the proposal now entails:\r\n - `type` and `length` both use the bitcoin varint format, minimally-encoded\r\n - no repeated fields\r\n - canonical ordering is defined by sorting `type` only\r\n - readers must enforce canonical order\r\n - includes even/odd rule (fail when reading an unknown even type)\r\n - no sentinel value\r\n\r\nThe proposal is meant to encompass a single TLV format for use in wire and onion payloads.\r\n\r\nReference implementation: https://github.com/lightningnetwork/lnd/pull/3061","created_at":"2019-05-09T00:50:18Z","updated_at":"2019-07-03T00:25:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"df95acfc4c6ebf31660aa54c815846578d19b8ec","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1277917320,"node_id":"MDU6TGFiZWwxMjc3OTE3MzIw","url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/labels/Meeting%20Discussion","name":"Meeting Discussion","color":"000000","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/607/commits","review_comments_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/607/comments","review_comment_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/issues/607/comments","statuses_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/statuses/779664cd820a76db53f397a20488540b6438e734","head":{"label":"cfromknecht:tlv","ref":"tlv","sha":"779664cd820a76db53f397a20488540b6438e734","user":{"login":"cfromknecht","id":2013993,"node_id":"MDQ6VXNlcjIwMTM5OTM=","avatar_url":"https://avatars1.githubusercontent.com/u/2013993?v=4","gravatar_id":"","url":"https://api.github.com/users/cfromknecht","html_url":"https://github.com/cfromknecht","followers_url":"https://api.github.com/users/cfromknecht/followers","following_url":"https://api.github.com/users/cfromknecht/following{/other_user}","gists_url":"https://api.github.com/users/cfromknecht/gists{/gist_id}","starred_url":"https://api.github.com/users/cfromknecht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfromknecht/subscriptions","organizations_url":"https://api.github.com/users/cfromknecht/orgs","repos_url":"https://api.github.com/users/cfromknecht/repos","events_url":"https://api.github.com/users/cfromknecht/events{/privacy}","received_events_url":"https://api.github.com/users/cfromknecht/received_events","type":"User","site_admin":false},"repo":{"id":98795004,"node_id":"MDEwOlJlcG9zaXRvcnk5ODc5NTAwNA==","name":"lightning-rfc","full_name":"cfromknecht/lightning-rfc","private":false,"owner":{"login":"cfromknecht","id":2013993,"node_id":"MDQ6VXNlcjIwMTM5OTM=","avatar_url":"https://avatars1.githubusercontent.com/u/2013993?v=4","gravatar_id":"","url":"https://api.github.com/users/cfromknecht","html_url":"https://github.com/cfromknecht","followers_url":"https://api.github.com/users/cfromknecht/followers","following_url":"https://api.github.com/users/cfromknecht/following{/other_user}","gists_url":"https://api.github.com/users/cfromknecht/gists{/gist_id}","starred_url":"https://api.github.com/users/cfromknecht/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cfromknecht/subscriptions","organizations_url":"https://api.github.com/users/cfromknecht/orgs","repos_url":"https://api.github.com/users/cfromknecht/repos","events_url":"https://api.github.com/users/cfromknecht/events{/privacy}","received_events_url":"https://api.github.com/users/cfromknecht/received_events","type":"User","site_admin":false},"html_url":"https://github.com/cfromknecht/lightning-rfc","description":"Lightning Network Specifications","fork":true,"url":"https://api.github.com/repos/cfromknecht/lightning-rfc","forks_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/forks","keys_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/teams","hooks_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/hooks","issue_events_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/issues/events{/number}","events_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/events","assignees_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/assignees{/user}","branches_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/branches{/branch}","tags_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/tags","blobs_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/git/refs{/sha}","trees_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/statuses/{sha}","languages_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/languages","stargazers_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/stargazers","contributors_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/contributors","subscribers_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/subscribers","subscription_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/subscription","commits_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/commits{/sha}","git_commits_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/git/commits{/sha}","comments_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/comments{/number}","issue_comment_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/issues/comments{/number}","contents_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/contents/{+path}","compare_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/merges","archive_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/downloads","issues_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/issues{/number}","pulls_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/pulls{/number}","milestones_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/milestones{/number}","notifications_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/labels{/name}","releases_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/releases{/id}","deployments_url":"https://api.github.com/repos/cfromknecht/lightning-rfc/deployments","created_at":"2017-07-30T12:09:13Z","updated_at":"2019-06-12T22:15:10Z","pushed_at":"2019-07-01T22:45:35Z","git_url":"git://github.com/cfromknecht/lightning-rfc.git","ssh_url":"git@github.com:cfromknecht/lightning-rfc.git","clone_url":"https://github.com/cfromknecht/lightning-rfc.git","svn_url":"https://github.com/cfromknecht/lightning-rfc","homepage":null,"size":1565,"stargazers_count":0,"watchers_count":0,"language":"Shell","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":null,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"lightningnetwork:master","ref":"master","sha":"309e86d471faf90c1f6c531701c16887684badb9","user":{"login":"lightningnetwork","id":13424735,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDI0NzM1","avatar_url":"https://avatars0.githubusercontent.com/u/13424735?v=4","gravatar_id":"","url":"https://api.github.com/users/lightningnetwork","html_url":"https://github.com/lightningnetwork","followers_url":"https://api.github.com/users/lightningnetwork/followers","following_url":"https://api.github.com/users/lightningnetwork/following{/other_user}","gists_url":"https://api.github.com/users/lightningnetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/lightningnetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lightningnetwork/subscriptions","organizations_url":"https://api.github.com/users/lightningnetwork/orgs","repos_url":"https://api.github.com/users/lightningnetwork/repos","events_url":"https://api.github.com/users/lightningnetwork/events{/privacy}","received_events_url":"https://api.github.com/users/lightningnetwork/received_events","type":"Organization","site_admin":false},"repo":{"id":73738971,"node_id":"MDEwOlJlcG9zaXRvcnk3MzczODk3MQ==","name":"lightning-rfc","full_name":"lightningnetwork/lightning-rfc","private":false,"owner":{"login":"lightningnetwork","id":13424735,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEzNDI0NzM1","avatar_url":"https://avatars0.githubusercontent.com/u/13424735?v=4","gravatar_id":"","url":"https://api.github.com/users/lightningnetwork","html_url":"https://github.com/lightningnetwork","followers_url":"https://api.github.com/users/lightningnetwork/followers","following_url":"https://api.github.com/users/lightningnetwork/following{/other_user}","gists_url":"https://api.github.com/users/lightningnetwork/gists{/gist_id}","starred_url":"https://api.github.com/users/lightningnetwork/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lightningnetwork/subscriptions","organizations_url":"https://api.github.com/users/lightningnetwork/orgs","repos_url":"https://api.github.com/users/lightningnetwork/repos","events_url":"https://api.github.com/users/lightningnetwork/events{/privacy}","received_events_url":"https://api.github.com/users/lightningnetwork/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/lightningnetwork/lightning-rfc","description":"Lightning Network Specifications","fork":false,"url":"https://api.github.com/repos/lightningnetwork/lightning-rfc","forks_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/forks","keys_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/teams","hooks_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/hooks","issue_events_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/issues/events{/number}","events_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/events","assignees_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/assignees{/user}","branches_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/branches{/branch}","tags_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/tags","blobs_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/git/refs{/sha}","trees_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/statuses/{sha}","languages_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/languages","stargazers_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/stargazers","contributors_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/contributors","subscribers_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/subscribers","subscription_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/subscription","commits_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/commits{/sha}","git_commits_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/git/commits{/sha}","comments_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/comments{/number}","issue_comment_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/issues/comments{/number}","contents_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/contents/{+path}","compare_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/merges","archive_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/downloads","issues_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/issues{/number}","pulls_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls{/number}","milestones_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/milestones{/number}","notifications_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/labels{/name}","releases_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/releases{/id}","deployments_url":"https://api.github.com/repos/lightningnetwork/lightning-rfc/deployments","created_at":"2016-11-14T19:21:45Z","updated_at":"2019-06-30T09:02:04Z","pushed_at":"2019-07-01T23:19:48Z","git_url":"git://github.com/lightningnetwork/lightning-rfc.git","ssh_url":"git@github.com:lightningnetwork/lightning-rfc.git","clone_url":"https://github.com/lightningnetwork/lightning-rfc.git","svn_url":"https://github.com/lightningnetwork/lightning-rfc","homepage":null,"size":1690,"stargazers_count":998,"watchers_count":998,"language":"Shell","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":250,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":104,"license":null,"forks":250,"open_issues":104,"watchers":998,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/607"},"html":{"href":"https://github.com/lightningnetwork/lightning-rfc/pull/607"},"issue":{"href":"https://api.github.com/repos/lightningnetwork/lightning-rfc/issues/607"},"comments":{"href":"https://api.github.com/repos/lightningnetwork/lightning-rfc/issues/607/comments"},"review_comments":{"href":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/607/comments"},"review_comment":{"href":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lightningnetwork/lightning-rfc/pulls/607/commits"},"statuses":{"href":"https://api.github.com/repos/lightningnetwork/lightning-rfc/statuses/779664cd820a76db53f397a20488540b6438e734"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"Roasbeef"}}