Skip to content

Commit 05bdf5b

Browse files
authored
fix: align the eth address in fevm trace (#1253)
* Fix the ethaddress in fevm trace * Refine the function usage * refactor the get actor function
1 parent f77dccc commit 05bdf5b

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tasks/fevm/trace/task.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,14 @@ func getEthAddress(addr address.Address) string {
5454
return to.String()
5555
}
5656

57+
func (t *Task) getActorAddress(ctx context.Context, address address.Address, tsk types.TipSetKey) address.Address {
58+
actor, _ := t.node.Actor(ctx, address, tsk)
59+
if actor.Address != nil {
60+
return *actor.Address
61+
}
62+
return address
63+
}
64+
5765
func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, executed *types.TipSet) (model.Persistable, *visormodel.ProcessingReport, error) {
5866
ctx, span := otel.Tracer("").Start(ctx, "ProcessTipSets")
5967
if span.IsRecording() {
@@ -137,19 +145,21 @@ func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
137145
errs = append(errs, err)
138146
}
139147
}
140-
fromEthAddress := getEthAddress(child.Message.From)
141-
toEthAddress := getEthAddress(child.Message.To)
148+
149+
// Get Actor Address
150+
toAddress := t.getActorAddress(ctx, child.Message.To, current.Key())
151+
fromAddress := t.getActorAddress(ctx, child.Message.From, current.Key())
142152

143153
traceObj := &fevm.FEVMTrace{
144154
Height: int64(parentMsg.Height),
145155
TransactionHash: transactionHash.String(),
146156
MessageStateRoot: parentMsg.StateRoot.String(),
147157
MessageCid: parentMsg.Cid.String(),
148158
TraceCid: getMessageTraceCid(child.Message).String(),
149-
ToFilecoinAddress: child.Message.To.String(),
150-
FromFilecoinAddress: child.Message.From.String(),
151-
From: fromEthAddress,
152-
To: toEthAddress,
159+
FromFilecoinAddress: fromAddress.String(),
160+
ToFilecoinAddress: toAddress.String(),
161+
From: getEthAddress(fromAddress),
162+
To: getEthAddress(toAddress),
153163
Value: child.Message.Value.String(),
154164
ExitCode: int64(child.Receipt.ExitCode),
155165
ActorCode: actorCode,

0 commit comments

Comments
 (0)