core: lock down state.ReadDurations.Add merge primitive

This commit is contained in:
CPerezz 2026-05-01 00:49:43 +02:00
parent 8797d1af8e
commit 63660b25d8
No known key found for this signature in database
GPG key ID: 62045F34B97177DD

View file

@ -26,6 +26,18 @@ import (
"github.com/ethereum/go-ethereum/core/types"
)
// TestReadDurationsAdd locks down the read-duration merge primitive used to
// aggregate per-tx, pre-tx and post-tx reads in the BAL parallel path.
func TestReadDurationsAdd(t *testing.T) {
a := state.ReadDurations{Account: 1 * time.Millisecond, Storage: 2 * time.Millisecond, Code: 3 * time.Millisecond}
b := state.ReadDurations{Account: 10 * time.Millisecond, Storage: 20 * time.Millisecond, Code: 30 * time.Millisecond}
a.Add(b)
want := state.ReadDurations{Account: 11 * time.Millisecond, Storage: 22 * time.Millisecond, Code: 33 * time.Millisecond}
if a != want {
t.Fatalf("Add mismatch: got %+v, want %+v", a, want)
}
}
// TestStateCountsAdd locks down the count merge primitive used to aggregate
// per-tx, pre-tx and post-tx counters in the BAL parallel path.
func TestStateCountsAdd(t *testing.T) {