diff --git a/internal/trie/node/decode.go b/internal/trie/node/decode.go index fc1f355062..c5d42c7948 100644 --- a/internal/trie/node/decode.go +++ b/internal/trie/node/decode.go @@ -13,11 +13,11 @@ import ( ) var ( - // ErrDecodeValue is defined since no sentinel error is defined + // ErrDecodeStorageValue is defined since no sentinel error is defined // in the scale package. // TODO remove once the following issue is done: // https://github.com/ChainSafe/gossamer/issues/2631 . - ErrDecodeValue = errors.New("cannot decode value") + ErrDecodeStorageValue = errors.New("cannot decode value") ErrReadChildrenBitmap = errors.New("cannot read children bitmap") // ErrDecodeChildHash is defined since no sentinel error is defined // in the scale package. @@ -85,7 +85,7 @@ func decodeBranch(reader io.Reader, variant byte, partialKeyLength uint16) ( if variant == branchWithValueVariant.bits { err := sd.Decode(&node.StorageValue) if err != nil { - return nil, fmt.Errorf("%w: %s", ErrDecodeValue, err) + return nil, fmt.Errorf("%w: %s", ErrDecodeStorageValue, err) } } @@ -135,7 +135,7 @@ func decodeLeaf(reader io.Reader, partialKeyLength uint16) (node *Node, err erro var value []byte err = sd.Decode(&value) if err != nil && !errors.Is(err, io.EOF) { - return nil, fmt.Errorf("%w: %s", ErrDecodeValue, err) + return nil, fmt.Errorf("%w: %s", ErrDecodeStorageValue, err) } if len(value) > 0 { diff --git a/internal/trie/node/decode_test.go b/internal/trie/node/decode_test.go index 102e17253d..8c2c37e105 100644 --- a/internal/trie/node/decode_test.go +++ b/internal/trie/node/decode_test.go @@ -198,7 +198,7 @@ func Test_decodeBranch(t *testing.T) { ), variant: branchWithValueVariant.bits, partialKeyLength: 1, - errWrapped: ErrDecodeValue, + errWrapped: ErrDecodeStorageValue, errMessage: "cannot decode value: reading byte: EOF", }, "success for branch with value": { @@ -324,7 +324,7 @@ func Test_decodeLeaf(t *testing.T) { }), variant: leafVariant.bits, partialKeyLength: 1, - errWrapped: ErrDecodeValue, + errWrapped: ErrDecodeStorageValue, errMessage: "cannot decode value: unknown prefix for compact uint: 255", }, "missing value data": {