From 9c70995cf3ec8ee4d20d66e23ed8ab82a83b25f8 Mon Sep 17 00:00:00 2001 From: lightclient Date: Wed, 26 Feb 2025 11:22:37 -0700 Subject: [PATCH] eth/gasprice: sanity check ratio values --- eth/gasprice/feehistory_test.go | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/eth/gasprice/feehistory_test.go b/eth/gasprice/feehistory_test.go index 241b91b810..d220027e69 100644 --- a/eth/gasprice/feehistory_test.go +++ b/eth/gasprice/feehistory_test.go @@ -84,9 +84,19 @@ func TestFeeHistory(t *testing.T) { if len(ratio) != c.expCount { t.Fatalf("Test case %d: gasUsedRatio array length mismatch, want %d, got %d", i, c.expCount, len(ratio)) } + for _, ratio := range ratio { + if ratio > 1 { + t.Fatalf("Test case %d: gasUsedRatio greater than 1, got %f", i, ratio) + } + } if len(blobRatio) != c.expCount { t.Fatalf("Test case %d: blobGasUsedRatio array length mismatch, want %d, got %d", i, c.expCount, len(blobRatio)) } + for _, ratio := range blobRatio { + if ratio > 1 { + t.Fatalf("Test case %d: blobGasUsedRatio greater than 1, got %f", i, ratio) + } + } if len(blobBaseFee) != len(baseFee) { t.Fatalf("Test case %d: blobBaseFee array length mismatch, want %d, got %d", i, len(baseFee), len(blobBaseFee)) }