Commit Graph

18 Commits

Author SHA1 Message Date
Felix Lange 8deec2e45a
rlp: fixes for two corner cases and documentation (#19527)
These changes fix two corner cases related to internal handling of types
in package rlp: The "tail" struct tag can only be applied to the last field.
The check for this was wrong and didn't allow for private fields after the
field with the tag. Unsupported types (e.g. structs containing int) which
implement either the Encoder or Decoder interface but not both 
couldn't be encoded/decoded.

Also fixes #19367
2019-05-14 15:09:56 +02:00
Felix Lange eee96a5bb7 rlp: add support for "-" struct tag 2017-03-07 12:45:12 +01:00
Felix Lange bb07ce3eed rlp: add "tail" struct tag 2016-02-19 11:14:29 +01:00
Felix Lange 24bb68e7cf rlp: add RawValue 2015-09-10 19:41:51 +02:00
Felix Lange ac32f52ca6 rlp: fix encReader returning nil buffers to the pool
The bug can cause crashes if Read is called after EOF has been returned.
No code performs such calls right now, but hitting the bug gets more
likely as rlp.EncodeToReader gets used in more places.
2015-09-10 19:12:32 +02:00
Péter Szilágyi 1d2420323c rlp: add support for boolean encoding/decoding 2015-08-13 12:05:39 +03:00
Felix Lange bfbcfbe4a9 all: fix license headers one more time
I forgot to update one instance of "go-ethereum" in commit 3f047be5a.
2015-07-23 18:35:11 +02:00
Felix Lange 3f047be5aa all: update license headers to distiguish GPL/LGPL
All code outside of cmd/ is licensed as LGPL. The headers
now reflect this by calling the whole work "the go-ethereum library".
2015-07-22 18:51:45 +02:00
Felix Lange ea54283b30 all: update license information 2015-07-07 14:12:44 +02:00
Felix Lange a0566c1058 rlp: remove Flat 2015-06-29 18:51:47 +02:00
Felix Lange 181a21c67c rlp: encode nil array pointers as empty list or string 2015-03-25 16:46:29 +01:00
Felix Lange 965c9babe3 rlp: fix encoding of one element strings and byte slices
The encoder was missing a special case for one element strings whose
element is below 0x7f. Such strings must be encoded as a single byte
without a string header.
2015-03-19 12:15:43 +01:00
Felix Lange cb009a5c4d rlp: don't panic for nil *big.Int
All other pointer types can handle nil just fine.
2015-03-17 23:49:49 +01:00
obscuren 76fa75b394 wip 2015-02-13 15:35:54 +01:00
Felix Lange b94f85de22 rlp: add Flat 2015-02-11 19:28:56 +01:00
Felix Lange 8c3095faf0 rlp: fix encoding of arrays with byte element type 2015-02-06 00:00:36 +01:00
Felix Lange fc92abec2c rlp: allow encoding non-empty interface values
This needs to be supported because []someInterface does occur sometimes.

Funny enough, the fix involves changes to the decoder. makeDecoder
cannot return an error for non-empty interfaces anymore because the type
cache builds both decoder and writer. Do the check at 'runtime' instead.
2015-01-15 23:35:26 +01:00
Felix Lange 552f5b2693 rlp: add functions for encoding
I'm reasonably confident that the encoding matches the output of
ethutil.Encode for values that it supports. Some of the tests have been
adpated from the Ethereum testing repository.

There are still TODOs in the code.
2015-01-15 11:00:19 +01:00