Commit Graph

9 Commits

Author SHA1 Message Date
Felix Lange
b4547a560b common/hexutil: add UnmarshalFixedUnprefixedText 2017-03-23 15:58:42 +01:00
Felix Lange
280f08be84 common/hexutil: ensure negative big.Int is encoded sensibly
Restricting encoding is silly.
2017-03-02 14:05:46 +01:00
Felix Lange
d304da3803 common/hexutil: implement TextMarshaler, TextUnmarshaler
This commit makes the wrapper types more generally applicable.
encoding.TextMarshaler is supported by most codec implementations (e.g.
for yaml).

The tests now ensure that package json actually recognizes the custom
marshaler implementation irrespective of how it is implemented.

The Uint type has new tests, too. These are tricky because uint size
depends on the CPU word size. Turns out that there was one incorrect
case where decoding returned ErrUint64Range instead of ErrUintRange.
2017-03-02 14:05:46 +01:00
Felix Lange
357d00cdb1 common/hexutil: don't leak encoding/hex errors in Decode
All other functions return errors from package hexutil, ensure that
Decode does too.
2017-03-02 14:05:46 +01:00
Felix Lange
f3b7dcc5bd common/hexutil: reject big integer inputs > 256 bits
This follows the change to common/math big integer parsing in PR #3699.
2017-03-02 14:05:46 +01:00
Felix Lange
51f6b6d33f common/hexutil: fix EncodeBig, Big.MarshalJSON
The code was too clever and failed to include zeros on a big.Word
boundary.
2017-01-16 10:32:40 +01:00
Felix Lange
01f6f2d741 common/hexutil: allow empty strings when decoding JSON (#3559) 2017-01-13 09:45:40 +01:00
Felix Lange
318ad3c1e4 common/hexutil: fix Test{Decode,Unmarshal}Uint64 on 32bit arch (#3363) 2016-11-28 13:55:56 +01:00
Felix Lange
ec75953f50 common/hexutil: new package for 0x hex encoding
The new package is purpose-built to handle the encoding consumed and
produced by the RPC API.
2016-11-28 11:22:52 +01:00