Browse Source

BOLT: update bolt quotes now that TLVs are not experimental.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
travis-debug
Rusty Russell 5 years ago
parent
commit
0da074cad3
  1. 4
      common/test/run-bigsize.c
  2. 4
      wire/fromwire.c
  3. 24
      wire/test/run-tlvstream.c
  4. 20
      wire/tlvstream.c

4
common/test/run-bigsize.c

@ -17,7 +17,7 @@ const void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
{ fprintf(stderr, "fromwire_fail called!\n"); abort(); } { fprintf(stderr, "fromwire_fail called!\n"); abort(); }
/* AUTOGENERATED MOCKS END */ /* AUTOGENERATED MOCKS END */
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* *
* A correct implementation should pass against these test vectors: * A correct implementation should pass against these test vectors:
* ```json * ```json
@ -155,7 +155,7 @@ static void test_decode(const char *json, const jsmntok_t toks[])
} }
} }
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* *
* A correct implementation should pass against the following test vectors: * A correct implementation should pass against the following test vectors:
* ```json * ```json

4
wire/fromwire.c

@ -101,7 +101,7 @@ static u64 fromwire_tlv_uint(const u8 **cursor, size_t *max, size_t maxlen)
assert(maxlen <= sizeof(bytes)); assert(maxlen <= sizeof(bytes));
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* *
* - if `length` is not exactly equal to that required for the * - if `length` is not exactly equal to that required for the
* known encoding for `type`: * known encoding for `type`:
@ -117,7 +117,7 @@ static u64 fromwire_tlv_uint(const u8 **cursor, size_t *max, size_t maxlen)
memset(bytes, 0, sizeof(bytes)); memset(bytes, 0, sizeof(bytes));
fromwire(cursor, max, bytes + sizeof(bytes) - length, length); fromwire(cursor, max, bytes + sizeof(bytes) - length, length);
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* - if variable-length fields within the known encoding for `type` are * - if variable-length fields within the known encoding for `type` are
* not minimal: * not minimal:
* - MUST fail to parse the `tlv_stream`. * - MUST fail to parse the `tlv_stream`.

24
wire/test/run-tlvstream.c

@ -91,7 +91,7 @@ static struct invalid_stream invalid_streams_either[] = {
{ "ff0100000000000002 00", "unknown even type." }, { "ff0100000000000002 00", "unknown even type." },
}; };
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* *
* The following TLV streams in namespace `n1` should trigger a decoding * The following TLV streams in namespace `n1` should trigger a decoding
failure: failure:
@ -180,7 +180,7 @@ static struct invalid_stream invalid_streams_n1[] = {
{ "00 00", "unknown even field for `n1`s namespace." }, { "00 00", "unknown even field for `n1`s namespace." },
}; };
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
### TLV Stream Decoding Failure ### TLV Stream Decoding Failure
Any appending of an invalid stream to a valid stream should trigger Any appending of an invalid stream to a valid stream should trigger
@ -193,16 +193,16 @@ In addition, the following TLV streams in namespace `n1` should
trigger a decoding failure: trigger a decoding failure:
1. Invalid stream: 0x02 08 0000000000000226 01 01 2a 1. Invalid stream: 0x02 08 0000000000000226 01 01 2a
2. Reason: valid tlv records but invalid ordering 2. Reason: valid TLV records but invalid ordering
1. Invalid stream: 0x02 08 0000000000000231 02 08 0000000000000451 1. Invalid stream: 0x02 08 0000000000000231 02 08 0000000000000451
2. Reason: duplicate tlv type 2. Reason: duplicate TLV type
1. Invalid stream: 0x1f 00 0f 01 2a 1. Invalid stream: 0x1f 00 0f 01 2a
2. Reason: valid (ignored) tlv records but invalid ordering 2. Reason: valid (ignored) TLV records but invalid ordering
1. Invalid stream: 0x1f 00 1f 01 2a 1. Invalid stream: 0x1f 00 1f 01 2a
2. Reason: duplicate tlv type (ignored) 2. Reason: duplicate TLV type (ignored)
*/ */
static struct invalid_stream invalid_streams_n1_combo[] = { static struct invalid_stream invalid_streams_n1_combo[] = {
{ "02 08 0000000000000226 01 01 2a", "valid tlv records but invalid ordering" }, { "02 08 0000000000000226 01 01 2a", "valid tlv records but invalid ordering" },
@ -211,18 +211,18 @@ static struct invalid_stream invalid_streams_n1_combo[] = {
{ "1f 00 1f 01 2a", "duplicate tlv type (ignored)" } { "1f 00 1f 01 2a", "duplicate tlv type (ignored)" }
}; };
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
The following TLV stream in namespace `n2` should trigger a decoding The following TLV stream in namespace `n2` should trigger a decoding
failure: failure:
1. Invalid stream: 0xffffffffffffffffff 00 00 00 1. Invalid stream: 0xffffffffffffffffff 00 00 00
2. Reason: valid tlv records but invalid ordering 2. Reason: valid TLV records but invalid ordering
*/ */
static struct invalid_stream invalid_streams_n2_combo[] = { static struct invalid_stream invalid_streams_n2_combo[] = {
{ "ffffffffffffffffff 00 00 00", "valid tlv records but invalid ordering" }, { "ffffffffffffffffff 00 00 00", "valid TLV records but invalid ordering" },
}; };
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* *
### TLV Decoding Successes ### TLV Decoding Successes
@ -534,7 +534,7 @@ int main(void)
assert(memeq(p2, tal_count(p2), orig_p, tal_count(orig_p))); assert(memeq(p2, tal_count(p2), orig_p, tal_count(orig_p)));
} }
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* *
* Any appending of an invalid stream to a valid stream should trigger * Any appending of an invalid stream to a valid stream should trigger
* a decoding failure. * a decoding failure.
@ -596,7 +596,7 @@ int main(void)
} }
} }
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* *
* Any appending of a higher-numbered valid stream to a lower-numbered * Any appending of a higher-numbered valid stream to a lower-numbered
* valid stream should not trigger a decoding failure. * valid stream should not trigger a decoding failure.

20
wire/tlvstream.c

@ -27,7 +27,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
/* prev_type points to prev_type_store after first iter. */ /* prev_type points to prev_type_store after first iter. */
u64 prev_type_store, *prev_type = NULL; u64 prev_type_store, *prev_type = NULL;
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* *
* The receiving node: * The receiving node:
* - if zero bytes remain before parsing a `type`: * - if zero bytes remain before parsing a `type`:
@ -37,7 +37,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
u64 type, length; u64 type, length;
const struct tlv_record_type *rtype; const struct tlv_record_type *rtype;
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* *
* A `varint` is a variable-length, unsigned integer encoding * A `varint` is a variable-length, unsigned integer encoding
* using the [BigSize](#appendix-a-bigsize-test-vectors) * using the [BigSize](#appendix-a-bigsize-test-vectors)
@ -45,7 +45,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
*/ */
type = fromwire_bigsize(cursor, max); type = fromwire_bigsize(cursor, max);
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* - if a `type` or `length` is not minimally encoded: * - if a `type` or `length` is not minimally encoded:
* - MUST fail to parse the `tlv_stream`. * - MUST fail to parse the `tlv_stream`.
*/ */
@ -55,7 +55,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
} }
length = fromwire_bigsize(cursor, max); length = fromwire_bigsize(cursor, max);
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* - if a `type` or `length` is not minimally encoded: * - if a `type` or `length` is not minimally encoded:
* - MUST fail to parse the `tlv_stream`. * - MUST fail to parse the `tlv_stream`.
*/ */
@ -64,7 +64,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
goto fail; goto fail;
} }
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* - if `length` exceeds the number of bytes remaining in the * - if `length` exceeds the number of bytes remaining in the
* message: * message:
* - MUST fail to parse the `tlv_stream`. * - MUST fail to parse the `tlv_stream`.
@ -74,7 +74,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
goto fail; goto fail;
} }
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* - if decoded `type`s are not monotonically-increasing: * - if decoded `type`s are not monotonically-increasing:
* - MUST fail to parse the `tlv_stream`. * - MUST fail to parse the `tlv_stream`.
*/ */
@ -86,7 +86,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
goto fail; goto fail;
} }
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* - if `type` is known: * - if `type` is known:
* - MUST decode the next `length` bytes using the known * - MUST decode the next `length` bytes using the known
* encoding for `type`. * encoding for `type`.
@ -100,7 +100,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
if (!*cursor) if (!*cursor)
goto fail; goto fail;
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* - if `length` is not exactly equal to that required * - if `length` is not exactly equal to that required
* for the known encoding for `type`: * for the known encoding for `type`:
* - MUST fail to parse the `tlv_stream`. * - MUST fail to parse the `tlv_stream`.
@ -113,7 +113,7 @@ bool fromwire_tlvs(const u8 **cursor, size_t *max,
/* We've read bytes in ->fromwire, so update max */ /* We've read bytes in ->fromwire, so update max */
*max -= length; *max -= length;
} else { } else {
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* - otherwise, if `type` is unknown: * - otherwise, if `type` is unknown:
* - if `type` is even: * - if `type` is even:
* - MUST fail to parse the `tlv_stream`. * - MUST fail to parse the `tlv_stream`.
@ -154,7 +154,7 @@ void towire_tlvs(u8 **pptr,
if (!val) if (!val)
continue; continue;
/* BOLT-EXPERIMENTAL #1: /* BOLT #1:
* *
* The sending node: * The sending node:
... ...

Loading…
Cancel
Save