sdk.Int
marshaling of empty instance is always 0 instead of "<nil>"
#9629
Open
Description
opened on Jul 5, 2021
Summary of Bug
Marshaling of an empty sdk.Int
always populates the big.Int
value to zero. This is unexpected from applications as the encoding of a nil
value for big.Int
should be "<nil>"
.
// MarshalText implements the encoding.TextMarshaler interface.
func (x *Int) MarshalText() (text []byte, err error) {
if x == nil {
return []byte("<nil>"), nil
}
return x.abs.itoa(x.neg, 10), nil
}
Version
v0.43.0-rc0
Steps to Reproduce
- create an empty
sdk.Int
instance and callMarshal
For Admin Use
- Not duplicate issue
- Appropriate labels applied
- Appropriate contributors tagged
- Contributor assigned/self-assigned
Metadata
Assignees
Type
Projects
Status
📋 Backlog
Activity