From 242ea9e0e99ffb95a7c94da42e3a1517b0cbe8ce Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Tue, 9 Sep 2025 15:40:17 +0800 Subject: [PATCH] eth/tracers/js: use t.toBig on ctx.GasPrice for js tracing #27903 (#1341) This change fixes a bug in js tracer, where `ctx.GasPrice.toString(16)` returns a number string in base `10`. Co-authored-by: Joe Netti --- eth/tracers/js/goja.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/eth/tracers/js/goja.go b/eth/tracers/js/goja.go index 3cc79e4ee7..3cbefd888f 100644 --- a/eth/tracers/js/goja.go +++ b/eth/tracers/js/goja.go @@ -235,7 +235,12 @@ func (t *jsTracer) CaptureStart(env *vm.EVM, from common.Address, to common.Addr t.ctx["to"] = t.vm.ToValue(to.Bytes()) t.ctx["input"] = t.vm.ToValue(input) t.ctx["gas"] = t.vm.ToValue(t.gasLimit) - t.ctx["gasPrice"] = t.vm.ToValue(env.TxContext.GasPrice) + gasPriceBig, err := t.toBig(t.vm, env.TxContext.GasPrice.String()) + if err != nil { + t.err = err + return + } + t.ctx["gasPrice"] = gasPriceBig valueBig, err := t.toBig(t.vm, value.String()) if err != nil { t.err = err