Skip to content

Commit 7bd0124

Browse files
TerryhungTerry
andauthored
fix: logic error and remove useless function call (#1227)
* Fix logic error and remove useless function call * Refine the condition statement --------- Co-authored-by: Terry <[email protected]>
1 parent b907a50 commit 7bd0124

File tree

1 file changed

+5
-17
lines changed

1 file changed

+5
-17
lines changed

tasks/fevm/trace/task.go

Lines changed: 5 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ package fevmtrace
22

33
import (
44
"context"
5-
"encoding/base64"
65
"fmt"
76

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

111110
for _, parentMsg := range mex {
112111
// Only handle EVM related message
113-
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) {
112+
if !util.IsEVMAddress(ctx, t.node, parentMsg.Message.From, current.Key()) &&
113+
!util.IsEVMAddress(ctx, t.node, parentMsg.Message.To, current.Key()) &&
114+
parentMsg.Message.To != builtintypes.EthereumAddressManagerActorAddr {
114115
continue
115116
}
116-
messageHash, err := ethtypes.EthHashFromCid(parentMsg.Cid)
117+
transactionHash, err := ethtypes.EthHashFromCid(parentMsg.Cid)
117118
if err != nil {
118119
log.Errorf("Error at finding hash: [cid: %v] err: %v", parentMsg.Cid, err)
119120
errs = append(errs, err)
120121
continue
121122
}
122-
transaction, err := t.node.EthGetTransactionByHash(ctx, &messageHash)
123-
if err != nil {
124-
log.Errorf("Error at getting transaction: [hash: %v] err: %v", messageHash, err)
125-
errs = append(errs, err)
126-
continue
127-
}
128-
129-
if transaction == nil {
130-
continue
131-
}
132-
133-
log.Infof("message: %v, %v", parentMsg.Cid, base64.StdEncoding.EncodeToString(parentMsg.Message.Params))
134-
135123
for _, child := range util.GetChildMessagesOf(parentMsg) {
136124
toCode, _ := getActorCode(ctx, child.Message.To)
137125

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

145133
traceObj := &fevm.FEVMTrace{
146134
Height: int64(parentMsg.Height),
147-
TransactionHash: transaction.Hash.String(),
135+
TransactionHash: transactionHash.String(),
148136
MessageStateRoot: parentMsg.StateRoot.String(),
149137
MessageCid: parentMsg.Cid.String(),
150138
TraceCid: getMessageTraceCid(child.Message).String(),

0 commit comments

Comments
 (0)