Skip to content

Commit

Permalink
fix: fix the logic and data type in fevm tasks (#1232)
Browse files Browse the repository at this point in the history
* Fix the value encoding in transaction

* Fix the logic of receipt

---------

Co-authored-by: Terry <[email protected]>
  • Loading branch information
Terryhung and Terry authored Jun 18, 2023
1 parent 1469217 commit c74c69c
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 7 deletions.
16 changes: 16 additions & 0 deletions lens/util/fevm.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,19 @@ func IsEVMAddress(ctx context.Context, ds tasks.DataSource, addr address.Address
}
return builtin.IsEvmActor(act.Code)
}

func IsEVMMessage(ctx context.Context, ds tasks.DataSource, message *types.Message, tsk types.TipSetKey) bool {
if IsEVMAddress(ctx, ds, message.From, tsk) {
return true
}

if IsEVMAddress(ctx, ds, message.To, tsk) {
return true
}

if message.To == builtin.EthereumAddressManagerActorAddr {
return true
}

return false
}
2 changes: 1 addition & 1 deletion tasks/fevm/receipt/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
if message.Message == nil {
continue
}
if !util.IsEVMAddress(ctx, p.node, message.Message.To, current.Key()) {
if !util.IsEVMMessage(ctx, p.node, message.Message, current.Key()) {
continue
}

Expand Down
5 changes: 1 addition & 4 deletions tasks/fevm/trace/task.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (
"go.opentelemetry.io/otel/attribute"
"golang.org/x/sync/errgroup"

builtintypes "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/lily/lens"
"github.com/filecoin-project/lily/lens/util"
"github.com/filecoin-project/lily/model"
Expand Down Expand Up @@ -109,9 +108,7 @@ 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.IsEVMMessage(ctx, t.node, parentMsg.Message, current.Key()) {
continue
}
transactionHash, err := ethtypes.EthHashFromCid(parentMsg.Cid)
Expand Down
4 changes: 2 additions & 2 deletions tasks/fevm/transaction/tasks.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
if message.Message == nil {
continue
}
if !util.IsEVMAddress(ctx, p.node, message.Message.To, current.Key()) {
if !util.IsEVMMessage(ctx, p.node, message.Message, current.Key()) {
continue
}

Expand Down Expand Up @@ -90,7 +90,7 @@ func (p *Task) ProcessTipSets(ctx context.Context, current *types.TipSet, execut
ChainID: uint64(txn.ChainID),
Nonce: uint64(txn.Nonce),
From: txn.From.String(),
Value: txn.Value.String(),
Value: txn.Value.Int.String(),
Type: uint64(txn.Type),
Input: txn.Input.String(),
Gas: uint64(txn.Gas),
Expand Down

0 comments on commit c74c69c

Please sign in to comment.