Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: align the eth address in fevm trace #1253

Merged
merged 3 commits into from
Aug 21, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 16 additions & 6 deletions tasks/fevm/trace/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ func getEthAddress(addr address.Address) string {
return to.String()
}

func (t *Task) getActorAddress(ctx context.Context, address address.Address, tsk types.TipSetKey) address.Address {
actor, _ := t.node.Actor(ctx, address, tsk)
if actor.Address != nil {
return *actor.Address
}
return address
}

func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, executed *types.TipSet) (model.Persistable, *visormodel.ProcessingReport, error) {
ctx, span := otel.Tracer("").Start(ctx, "ProcessTipSets")
if span.IsRecording() {
Expand Down Expand Up @@ -137,19 +145,21 @@ func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
errs = append(errs, err)
}
}
fromEthAddress := getEthAddress(child.Message.From)
toEthAddress := getEthAddress(child.Message.To)

// Get Actor Address
toAddress := t.getActorAddress(ctx, child.Message.To, current.Key())
fromAddress := t.getActorAddress(ctx, child.Message.From, current.Key())

traceObj := &fevm.FEVMTrace{
Height: int64(parentMsg.Height),
TransactionHash: transactionHash.String(),
MessageStateRoot: parentMsg.StateRoot.String(),
MessageCid: parentMsg.Cid.String(),
TraceCid: getMessageTraceCid(child.Message).String(),
ToFilecoinAddress: child.Message.To.String(),
FromFilecoinAddress: child.Message.From.String(),
From: fromEthAddress,
To: toEthAddress,
FromFilecoinAddress: fromAddress.String(),
ToFilecoinAddress: toAddress.String(),
From: getEthAddress(fromAddress),
To: getEthAddress(toAddress),
Value: child.Message.Value.String(),
ExitCode: int64(child.Receipt.ExitCode),
ActorCode: actorCode,
Expand Down