From 12234de2308644da1a326965a012106dc7c98f64 Mon Sep 17 00:00:00 2001 From: Kishan Sagathiya Date: Fri, 2 Feb 2024 18:58:25 +0530 Subject: [PATCH] fix: don't panic if we fail to convert hex to bytes (#3734) --- 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),