From 13d8df63f45125c203bfa20d8b4929aa869b17d5 Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Fri, 5 Jun 2026 10:44:41 +0800 Subject: [PATCH] core/types/bal: improve the bal validation (#35110) https://github.com/ethereum/EIPs/commit/cb1364d60e14a24fe1a94d4303661cdbf8c68271 --- core/types/bal/bal_encoding.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/core/types/bal/bal_encoding.go b/core/types/bal/bal_encoding.go index 612d2f8777..522192cee8 100644 --- a/core/types/bal/bal_encoding.go +++ b/core/types/bal/bal_encoding.go @@ -178,6 +178,11 @@ func isStrictlySortedFunc[S ~[]E, E any](x S, cmp func(a, b E) int) bool { // which are ordered ascending by transaction index and contain no duplicate // modifications for a given index. func (e *encodingSlotChanges) validate(maxBALIndex int) error { + // Each SlotChanges entry MUST contain at least one StorageChange. + if len(e.SlotChanges) == 0 { + return errors.New("empty slot changes") + } + // Each storage key MUST appear at most once in storage_changes per account. if !isStrictlySortedFunc(e.SlotChanges, func(a, b encodingStorageWrite) int { return cmp.Compare(a.BlockAccessIndex, b.BlockAccessIndex) }) {