Skip to content

Commit c74c69c

Browse files
TerryhungTerry
andauthored
fix: fix the logic and data type in fevm tasks (#1232)
* Fix the value encoding in transaction * Fix the logic of receipt --------- Co-authored-by: Terry <[email protected]>
1 parent 1469217 commit c74c69c

File tree

4 files changed

+20
-7
lines changed

4 files changed

+20
-7
lines changed

lens/util/fevm.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,19 @@ func IsEVMAddress(ctx context.Context, ds tasks.DataSource, addr address.Address
2222
}
2323
return builtin.IsEvmActor(act.Code)
2424
}
25+
26+
func IsEVMMessage(ctx context.Context, ds tasks.DataSource, message *types.Message, tsk types.TipSetKey) bool {
27+
if IsEVMAddress(ctx, ds, message.From, tsk) {
28+
return true
29+
}
30+
31+
if IsEVMAddress(ctx, ds, message.To, tsk) {
32+
return true
33+
}
34+
35+
if message.To == builtin.EthereumAddressManagerActorAddr {
36+
return true
37+
}
38+
39+
return false
40+
}

tasks/fevm/receipt/tasks.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
6464
if message.Message == nil {
6565
continue
6666
}
67-
if !util.IsEVMAddress(ctx, p.node, message.Message.To, current.Key()) {
67+
if !util.IsEVMMessage(ctx, p.node, message.Message, current.Key()) {
6868
continue
6969
}
7070

tasks/fevm/trace/task.go

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
"go.opentelemetry.io/otel/attribute"
1414
"golang.org/x/sync/errgroup"
1515

16-
builtintypes "github.com/filecoin-project/go-state-types/builtin"
1716
"github.com/filecoin-project/lily/lens"
1817
"github.com/filecoin-project/lily/lens/util"
1918
"github.com/filecoin-project/lily/model"
@@ -109,9 +108,7 @@ func (t *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
109108

110109
for _, parentMsg := range mex {
111110
// Only handle EVM related message
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 {
111+
if !util.IsEVMMessage(ctx, t.node, parentMsg.Message, current.Key()) {
115112
continue
116113
}
117114
transactionHash, err := ethtypes.EthHashFromCid(parentMsg.Cid)

tasks/fevm/transaction/tasks.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
6262
if message.Message == nil {
6363
continue
6464
}
65-
if !util.IsEVMAddress(ctx, p.node, message.Message.To, current.Key()) {
65+
if !util.IsEVMMessage(ctx, p.node, message.Message, current.Key()) {
6666
continue
6767
}
6868

@@ -90,7 +90,7 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
9090
ChainID: uint64(txn.ChainID),
9191
Nonce: uint64(txn.Nonce),
9292
From: txn.From.String(),
93-
Value: txn.Value.String(),
93+
Value: txn.Value.Int.String(),
9494
Type: uint64(txn.Type),
9595
Input: txn.Input.String(),
9696
Gas: uint64(txn.Gas),

0 commit comments

Comments
 (0)