This commit is contained in:
jsvisa 2025-09-04 20:25:52 +08:00 committed by Gary Rong
parent 0b13632ae2
commit 1abfb07782
3 changed files with 17 additions and 17 deletions

View file

@ -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
}

View file

@ -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)

View file

@ -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
}