From eef89f1c0214aa93cf26aa2fe7ed3971027fe3eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?P=C3=A9ter=20Szil=C3=A1gyi?= Date: Tue, 6 Jul 2021 12:38:52 +0300 Subject: [PATCH] core/types: sanity check the basefee length inside a header --- core/types/block.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/types/block.go b/core/types/block.go index d189c86c2b01..360f1eb47c2b 100644 --- a/core/types/block.go +++ b/core/types/block.go @@ -129,6 +129,11 @@ func (h *Header) SanityCheck() error { if eLen := len(h.Extra); eLen > 100*1024 { return fmt.Errorf("too large block extradata: size %d", eLen) } + if h.BaseFee != nil { + if bfLen := h.BaseFee.BitLen(); bfLen > 256 { + return fmt.Errorf("too large base fee: bitlen %d", bfLen) + } + } return nil }