diff --git a/libraries/shared/storage/decoder.go b/libraries/shared/storage/decoder.go index de9ef31c1..3abc57a22 100644 --- a/libraries/shared/storage/decoder.go +++ b/libraries/shared/storage/decoder.go @@ -32,6 +32,8 @@ func Decode(diff types.PersistedDiff, metadata types.ValueMetadata) (interface{} switch metadata.Type { case types.Uint256: return decodeInteger(diff.StorageValue.Bytes()), nil + case types.Uint8: + return decodeInteger(diff.StorageValue.Bytes()), nil case types.Uint32: return decodeInteger(diff.StorageValue.Bytes()), nil case types.Uint48: diff --git a/libraries/shared/storage/decoder_test.go b/libraries/shared/storage/decoder_test.go index 9e63605d7..76c07c50d 100644 --- a/libraries/shared/storage/decoder_test.go +++ b/libraries/shared/storage/decoder_test.go @@ -38,6 +38,17 @@ var _ = Describe("Storage decoder", func() { Expect(result).To(Equal(big.NewInt(0).SetBytes(fakeInt.Bytes()).String())) }) + It("decodes uint8", func() { + fakeInt := common.HexToHash("0000000000000000000000000000000000000000000000000000000000000244") + diff := types.PersistedDiff{RawDiff: types.RawDiff{StorageValue: fakeInt}} + metadata := types.ValueMetadata{Type: types.Uint8} + + result, err := storage.Decode(diff, metadata) + + Expect(err).NotTo(HaveOccurred()) + Expect(result).To(Equal(big.NewInt(0).SetBytes(fakeInt.Bytes()).String())) + }) + It("decodes uint128", func() { fakeInt := common.HexToHash("0000000000000000000000000000000000000000000000000000000000011123") diff := types.PersistedDiff{RawDiff: types.RawDiff{StorageValue: fakeInt}} diff --git a/libraries/shared/storage/types/value.go b/libraries/shared/storage/types/value.go index 6bdb01d68..e900de837 100644 --- a/libraries/shared/storage/types/value.go +++ b/libraries/shared/storage/types/value.go @@ -22,6 +22,7 @@ type ValueType int const ( Uint256 ValueType = iota + Uint8 Uint32 Uint48 Uint128