diff --git a/dig/dig.go b/dig/dig.go index 2c1c0fa..c31fbe0 100644 --- a/dig/dig.go +++ b/dig/dig.go @@ -1103,6 +1103,11 @@ func dbtype(abitype string, d []byte) any { return false case abitype == "string": return string(d) + case abitype == "bytes": + if len(d) == 0 { + return []byte{} + } + return d default: return d } diff --git a/dig/dig_test.go b/dig/dig_test.go index 4a44228..e21f58a 100644 --- a/dig/dig_test.go +++ b/dig/dig_test.go @@ -349,6 +349,12 @@ func TestDBType(t *testing.T) { &negInt{uint256.NewInt(0).Neg(uint256.NewInt(1))}, reflect.Ptr, }, + { + "bytes", + nil, + []byte{}, + reflect.Slice, + }, } for _, tc := range cases { got := dbtype(tc.abitype, tc.input) diff --git a/indexsupply.com/shovel/docs/index.md b/indexsupply.com/shovel/docs/index.md index 9de238b..ba1b183 100644 --- a/indexsupply.com/shovel/docs/index.md +++ b/indexsupply.com/shovel/docs/index.md @@ -104,6 +104,7 @@ The following resources are automatically deployed on a main commit: On main but not yet associated with a new version tag. +- empty decoded bytes are stored as an empty byte array instead of NULL - accept multiple URLs per source for redundancy - fix db encoding for negative int{..256} values - fix `error="getting receipts: no rpc error but empty result"`