From 441d1c1a3ce146dedca37e107c417c60123007ff Mon Sep 17 00:00:00 2001 From: Kishan Mohanbhai Sagathiya Date: Thu, 1 Feb 2024 16:03:53 +0530 Subject: [PATCH] fix: don't panic if we fail to convert hex to bytes --- dot/state/storage_notify.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/dot/state/storage_notify.go b/dot/state/storage_notify.go index 45cf810f06..e7449e4ab9 100644 --- a/dot/state/storage_notify.go +++ b/dot/state/storage_notify.go @@ -111,7 +111,11 @@ func (s *StorageState) notifyObserver(root common.Hash, o Observer) error { } else { // filter result to include only interested keys for k, cachedValue := range o.GetFilter() { - value := t.Get(common.MustHexToBytes(k)) + bytes, err := common.HexToBytes(k) + if err != nil { + return fmt.Errorf("failed to convert hex to bytes: %s", err) + } + value := t.Get(bytes) if !reflect.DeepEqual(cachedValue, value) { kv := &KeyValue{ Key: common.MustHexToBytes(k),