Skip to content

Commit

Permalink
fix: logic error and remove useless function call (#1227)
Browse files Browse the repository at this point in the history
* Fix logic error and remove useless function call

* Refine the condition statement

---------

Co-authored-by: Terry <[email protected]>
  • Loading branch information
Terryhung and Terry authored Jun 9, 2023
1 parent b907a50 commit 7bd0124
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions tasks/fevm/trace/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package fevmtrace

import (
"context"
"encoding/base64"
"fmt"

"github.com/filecoin-project/go-address"
Expand Down Expand Up @@ -110,28 +109,17 @@ func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut

for _, parentMsg := range mex {
// Only handle EVM related message
if !util.IsEVMAddress(ctx, t.node, parentMsg.Message.From, current.Key()) && !util.IsEVMAddress(ctx, t.node, parentMsg.Message.To, current.Key()) && !(parentMsg.Message.To != builtintypes.EthereumAddressManagerActorAddr) {
if !util.IsEVMAddress(ctx, t.node, parentMsg.Message.From, current.Key()) &&
!util.IsEVMAddress(ctx, t.node, parentMsg.Message.To, current.Key()) &&
parentMsg.Message.To != builtintypes.EthereumAddressManagerActorAddr {
continue
}
messageHash, err := ethtypes.EthHashFromCid(parentMsg.Cid)
transactionHash, err := ethtypes.EthHashFromCid(parentMsg.Cid)
if err != nil {
log.Errorf("Error at finding hash: [cid: %v] err: %v", parentMsg.Cid, err)
errs = append(errs, err)
continue
}
transaction, err := t.node.EthGetTransactionByHash(ctx, &messageHash)
if err != nil {
log.Errorf("Error at getting transaction: [hash: %v] err: %v", messageHash, err)
errs = append(errs, err)
continue
}

if transaction == nil {
continue
}

log.Infof("message: %v, %v", parentMsg.Cid, base64.StdEncoding.EncodeToString(parentMsg.Message.Params))

for _, child := range util.GetChildMessagesOf(parentMsg) {
toCode, _ := getActorCode(ctx, child.Message.To)

Expand All @@ -144,7 +132,7 @@ func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut

traceObj := &fevm.FEVMTrace{
Height: int64(parentMsg.Height),
TransactionHash: transaction.Hash.String(),
TransactionHash: transactionHash.String(),
MessageStateRoot: parentMsg.StateRoot.String(),
MessageCid: parentMsg.Cid.String(),
TraceCid: getMessageTraceCid(child.Message).String(),
Expand Down

0 comments on commit 7bd0124

Please sign in to comment.