-
Notifications
You must be signed in to change notification settings - Fork 21.3k
Closed
Labels
Description
System information
Geth version: all
CL client & version: all
OS & Version: all
Expected behaviour
rlp.Encode should return error when trying to encode a struct whose output will result in errors when decoding.
Actual behaviour
I've found at least two cases demonstrating the issue:
(1) A struct with a pointer to a (non-optional, non-nil tagged) byte array encodes without error even when the pointer value is nil, but decoding that output results in error.
(2) A struct with more than one optional-tagged pointer encodes without error when one optional pointer is nil while a later one is non-nil, but decoding that output results in error.
Steps to reproduce the behaviour
See the test cases I added in the branch below. Two of the encoding tests corresponding to the cases above should probably return error but don't.