From 1abfb07782d480ab565542e4c4ca846bb50bf996 Mon Sep 17 00:00:00 2001 From: jsvisa Date: Thu, 4 Sep 2025 20:25:52 +0800 Subject: [PATCH] fix --- core/state/state_sizer.go | 4 ++-- core/state/state_sizer_test.go | 6 +++--- eth/api_debug.go | 24 ++++++++++++------------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/core/state/state_sizer.go b/core/state/state_sizer.go index a66e4d3a25..784d8f8e11 100644 --- a/core/state/state_sizer.go +++ b/core/state/state_sizer.go @@ -535,7 +535,7 @@ func (t *SizeTracker) iterateTable(closed chan struct{}, prefix []byte, name str iter := t.db.NewIterator(prefix, nil) defer iter.Release() - log.Info("Iterating state", "category", name) + log.Debug("Iterating state", "category", name) for iter.Next() { count++ bytes += int64(len(iter.Key()) + len(iter.Value())) @@ -557,7 +557,7 @@ func (t *SizeTracker) iterateTable(closed chan struct{}, prefix []byte, name str log.Error("Iterator error", "category", name, "err", err) return 0, 0, err } - log.Info("Finished state iteration", "category", name, "count", count, "size", common.StorageSize(bytes), "elapsed", common.PrettyDuration(time.Since(start))) + log.Debug("Finished state iteration", "category", name, "count", count, "size", common.StorageSize(bytes), "elapsed", common.PrettyDuration(time.Since(start))) return count, bytes, nil } diff --git a/core/state/state_sizer_test.go b/core/state/state_sizer_test.go index ef0f9bd076..756744d166 100644 --- a/core/state/state_sizer_test.go +++ b/core/state/state_sizer_test.go @@ -62,7 +62,7 @@ func TestSizeTracker(t *testing.T) { state.AddBalance(addr2, uint256.NewInt(2000), tracing.BalanceChangeUnspecified) state.SetNonce(addr2, 2, tracing.NonceChangeUnspecified) - state.SetCode(addr2, []byte{0x60, 0x80, 0x60, 0x40, 0x52}) + state.SetCode(addr2, []byte{0x60, 0x80, 0x60, 0x40, 0x52}, tracing.CodeChangeUnspecified) state.AddBalance(addr3, uint256.NewInt(3000), tracing.BalanceChangeUnspecified) state.SetNonce(addr3, 3, tracing.NonceChangeUnspecified) @@ -92,7 +92,7 @@ func TestSizeTracker(t *testing.T) { } if i%3 == 0 { - newState.SetCode(testAddr, []byte{byte(i), 0x60, 0x80, byte(i + 1), 0x52}) + newState.SetCode(testAddr, []byte{byte(i), 0x60, 0x80, byte(i + 1), 0x52}, tracing.CodeChangeUnspecified) } root, _, err := newState.CommitWithUpdate(blockNum, true, false) @@ -160,7 +160,7 @@ func TestSizeTracker(t *testing.T) { } if i%3 == 0 { - newState.SetCode(testAddr, []byte{byte(i), 0x60, 0x80, byte(i + 1), 0x52}) + newState.SetCode(testAddr, []byte{byte(i), 0x60, 0x80, byte(i + 1), 0x52}, tracing.CodeChangeUnspecified) } root, update, err := newState.CommitWithUpdate(blockNum, true, false) diff --git a/eth/api_debug.go b/eth/api_debug.go index 9ce29bc880..3ea6aaeb9e 100644 --- a/eth/api_debug.go +++ b/eth/api_debug.go @@ -458,17 +458,17 @@ func (api *DebugAPI) StateSize() (interface{}, error) { } return map[string]interface{}{ - "stateRoot": stats.StateRoot, - "blockNumber": hexutil.Uint64(stats.BlockNumber), - "accounts": hexutil.Uint64(stats.Accounts), - "accountBytes": hexutil.Uint64(stats.AccountBytes), - "storages": hexutil.Uint64(stats.Storages), - "storageBytes": hexutil.Uint64(stats.StorageBytes), - "accountTrienodes": hexutil.Uint64(stats.AccountTrienodes), - "accountTrienodeBytes": hexutil.Uint64(stats.AccountTrienodeBytes), - "storageTrienodes": hexutil.Uint64(stats.StorageTrienodes), - "storageTrienodeBytes": hexutil.Uint64(stats.StorageTrienodeBytes), - "contractCodes": hexutil.Uint64(stats.ContractCodes), - "contractCodeBytes": hexutil.Uint64(stats.ContractCodeBytes), + "stateRoot": stats.StateRoot, + "blockNumber": hexutil.Uint64(stats.BlockNumber), + "accounts": hexutil.Uint64(stats.Accounts), + "accountBytes": hexutil.Uint64(stats.AccountBytes), + "storages": hexutil.Uint64(stats.Storages), + "storageBytes": hexutil.Uint64(stats.StorageBytes), + "accountTrienodes": hexutil.Uint64(stats.AccountTrienodes), + "accountTrienodeBytes": hexutil.Uint64(stats.AccountTrienodeBytes), + "storageTrienodes": hexutil.Uint64(stats.StorageTrienodes), + "storageTrienodeBytes": hexutil.Uint64(stats.StorageTrienodeBytes), + "contractCodes": hexutil.Uint64(stats.ContractCodes), + "contractCodeBytes": hexutil.Uint64(stats.ContractCodeBytes), }, nil }