From 5a3fa47b95359b91a1097609b3887369ddd71d2c Mon Sep 17 00:00:00 2001 From: Evgeniy Stratonikov Date: Fri, 5 Mar 2021 18:09:05 +0300 Subject: [PATCH] encoding: panic on nil slice After `state.StorageItem` became a slice of bytes we no longer panic on accessing `si.Value`. This helps to ensure that nothing was broken. Providing `nil` to `FromBytes` is probably an error anyway. --- pkg/encoding/bigint/bigint.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/pkg/encoding/bigint/bigint.go b/pkg/encoding/bigint/bigint.go index 9b77fae65..ed562821d 100644 --- a/pkg/encoding/bigint/bigint.go +++ b/pkg/encoding/bigint/bigint.go @@ -19,6 +19,9 @@ func FromBytes(data []byte) *big.Int { n := new(big.Int) size := len(data) if size == 0 { + if data == nil { + panic("nil slice provided to `FromBytes`") + } return big.NewInt(0) }