Skip to content

Commit

Permalink
fix: proper Null tx.To management
Browse files Browse the repository at this point in the history
  • Loading branch information
mortimr committed Oct 31, 2024
1 parent 02af8bc commit e2f5233
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion plugins/pgeth-monitoring/pgeth_monitoring.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ func (me *MonitoringEngine) analyze(ctx context.Context, block *types.Block, sco
// We configure the vm to use our monitoring tracer
gp := new(core.GasPool).AddGas(block.Header().GasLimit)
tr, mt := tracer.NewTracer()
var vmConfig vm.Config = vm.Config{
var vmConfig = vm.Config{
Tracer: tr,
NoBaseFee: false,
EnablePreimageRecording: false,
Expand Down
10 changes: 7 additions & 3 deletions plugins/pgeth-monitoring/pkg/tracer/tracer.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@ func (m *MonitoringTracer) OnTxStart(vm *tracing.VMContext, tx *types.Transactio
usedValue.Set(tx.Value())
}
copy(copyInput, tx.Data())
to := common.Address{}
if tx.To() != nil {
to = *tx.To()
}
m.Action = &Call{
CallType: "initial_call",
TypeValue: "call",
Expand All @@ -54,11 +58,11 @@ func (m *MonitoringTracer) OnTxStart(vm *tracing.VMContext, tx *types.Transactio
ContextValue: common.Address{},
CodeValue: common.Address{},

ForwardedContext: *tx.To(),
ForwardedCode: *tx.To(),
ForwardedContext: to,
ForwardedCode: to,

From: from,
To: *tx.To(),
To: to,
In: copyInput,
InHex: "0x" + hex.EncodeToString(copyInput),
Value: "0x" + usedValue.Text(16),
Expand Down

0 comments on commit e2f5233

Please sign in to comment.