From b127f8c780e05c680831430093b49f47488570b6 Mon Sep 17 00:00:00 2001 From: Weixie Cui Date: Wed, 15 Jul 2026 20:00:00 +0800 Subject: [PATCH] eth/tracers/logger: respect log limit in OnEnter and OnExit OnOpcode already stopped emitting after cfg.Limit bytes were written, but call frame enter/exit events could still be encoded. Apply the same limit check to OnEnter and OnExit. --- eth/tracers/logger/logger_json.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/eth/tracers/logger/logger_json.go b/eth/tracers/logger/logger_json.go index 530f21b534..f5009dc5b5 100644 --- a/eth/tracers/logger/logger_json.go +++ b/eth/tracers/logger/logger_json.go @@ -145,6 +145,9 @@ func (l *jsonLogger) onSystemCallStart() { // OnEnter is not enabled by default. func (l *jsonLogger) OnEnter(depth int, typ byte, from common.Address, to common.Address, input []byte, gas uint64, value *big.Int) { + if l.cfg.Limit != 0 && l.written.n > l.cfg.Limit { + return + } frame := callFrame{ op: vm.OpCode(typ), From: from, @@ -159,6 +162,9 @@ func (l *jsonLogger) OnEnter(depth int, typ byte, from common.Address, to common } func (l *jsonLogger) OnExit(depth int, output []byte, gasUsed uint64, err error, reverted bool) { + if l.cfg.Limit != 0 && l.written.n > l.cfg.Limit { + return + } type endLog struct { Output string `json:"output"` GasUsed math.HexOrDecimal64 `json:"gasUsed"`