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.
This commit is contained in:
CPerezz 2026-01-25 15:35:45 +01:00
parent 85a1e132a9
commit 690e526c30
No known key found for this signature in database
GPG key ID: 62045F34B97177DD

View file

@ -185,7 +185,7 @@ func TestLogSlowBlockEIP7702(t *testing.T) {
} }
block := types.NewBlockWithHeader(header) 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{ stats := &ExecuteStats{
Execution: 500 * time.Millisecond, Execution: 500 * time.Millisecond,
TotalTime: 1200 * time.Millisecond, TotalTime: 1200 * time.Millisecond,
@ -195,7 +195,9 @@ func TestLogSlowBlockEIP7702(t *testing.T) {
CodeLoaded: 20, CodeLoaded: 20,
CodeBytesRead: 4096, CodeBytesRead: 4096,
AccountUpdated: 50, AccountUpdated: 50,
AccountDeleted: 2,
StorageUpdated: 200, StorageUpdated: 200,
StorageDeleted: 7,
CodeUpdated: 5, CodeUpdated: 5,
CodeBytesWrite: 2048, CodeBytesWrite: 2048,
Eip7702DelegationsSet: 3, Eip7702DelegationsSet: 3,
@ -241,6 +243,14 @@ func TestLogSlowBlockEIP7702(t *testing.T) {
if logEntry.StateWrites.Code != 5 { if logEntry.StateWrites.Code != 5 {
t.Errorf("Expected code writes 5, got %d", logEntry.StateWrites.Code) 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. // TestLogSlowBlockThreshold tests that logSlow respects the threshold.