From 690e526c3084acba44fe1cef20619383c3a120b9 Mon Sep 17 00:00:00 2001 From: CPerezz Date: Sun, 25 Jan 2026 15:35:45 +0100 Subject: [PATCH] core: add accounts_deleted and storage_slots_deleted metrics Add deletion metrics to slow block JSON output: - accounts_deleted: count of accounts destroyed (SELFDESTRUCT) - storage_slots_deleted: count of storage slots set to zero These metrics align with the cross-client test vectors for standardized execution metrics. --- core/blockchain_stats_test.go | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/core/blockchain_stats_test.go b/core/blockchain_stats_test.go index 580c472918..7e7663d37b 100644 --- a/core/blockchain_stats_test.go +++ b/core/blockchain_stats_test.go @@ -185,7 +185,7 @@ func TestLogSlowBlockEIP7702(t *testing.T) { } block := types.NewBlockWithHeader(header) - // Create test stats with EIP-7702 delegation data + // Create test stats with EIP-7702 delegation data and deletion metrics stats := &ExecuteStats{ Execution: 500 * time.Millisecond, TotalTime: 1200 * time.Millisecond, @@ -195,7 +195,9 @@ func TestLogSlowBlockEIP7702(t *testing.T) { CodeLoaded: 20, CodeBytesRead: 4096, AccountUpdated: 50, + AccountDeleted: 2, StorageUpdated: 200, + StorageDeleted: 7, CodeUpdated: 5, CodeBytesWrite: 2048, Eip7702DelegationsSet: 3, @@ -241,6 +243,14 @@ func TestLogSlowBlockEIP7702(t *testing.T) { if logEntry.StateWrites.Code != 5 { t.Errorf("Expected code writes 5, got %d", logEntry.StateWrites.Code) } + + // Verify deletion metrics + if logEntry.StateWrites.AccountsDeleted != 2 { + t.Errorf("Expected accounts_deleted 2, got %d", logEntry.StateWrites.AccountsDeleted) + } + if logEntry.StateWrites.StorageSlotsDeleted != 7 { + t.Errorf("Expected storage_slots_deleted 7, got %d", logEntry.StateWrites.StorageSlotsDeleted) + } } // TestLogSlowBlockThreshold tests that logSlow respects the threshold.