Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Ethermint with better EVM logs
Browse files Browse the repository at this point in the history
  • Loading branch information
luckychess committed Mar 5, 2024
1 parent 9d31850 commit 1ba67f0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions x/evm/keeper/msg_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ func (k *Keeper) EthereumTx(goCtx context.Context, msg *types.MsgEthereumTx) (*t
labels = append(labels, telemetry.NewLabel("execution", "call"))
}

k.Logger(ctx).Info("incoming", "tx", msg.Hash)

response, err := k.ApplyTransaction(ctx, msg)
if err != nil {
return nil, errorsmod.Wrap(err, "failed to apply transaction")
Expand Down
14 changes: 8 additions & 6 deletions x/evm/keeper/state_transition.go
Original file line number Diff line number Diff line change
Expand Up @@ -179,10 +179,18 @@ func (k *Keeper) ApplyTransaction(ctx sdk.Context, msgEth *types.MsgEthereumTx)

// pass true to commit the StateDB
res, err := k.ApplyMessageWithConfig(tmpCtx, msg, nil, true, cfg, txConfig)
if err != nil {
k.Logger(ctx).Error("error", "err", err)
}
if err != nil {
return nil, errorsmod.Wrap(err, "failed to apply ethereum core message")
}

if res.VmError != "" {
k.Logger(ctx).Error("vmerror", "vmerr", res.VmError)
}
k.Logger(ctx).Info("tx hash", "hash", res.Hash)

logs := types.LogsToEthereum(res.Logs)

// Compute block bloom filter
Expand Down Expand Up @@ -376,7 +384,6 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context,
stateDB.SetNonce(sender.Address(), msg.Nonce()+1)
} else {
ret, leftoverGas, vmErr = evm.Call(sender, *msg.To(), msg.Data(), leftoverGas, msg.Value())
k.Logger(ctx).Error("raw error", "error", vmErr)
}

refundQuotient := params.RefundQuotient
Expand Down Expand Up @@ -424,11 +431,6 @@ func (k *Keeper) ApplyMessageWithConfig(ctx sdk.Context,

logs := types.NewLogsFromEth(stateDB.Logs())

k.Logger(ctx).Info("tx hash", "hash", txConfig.TxHash.Hex())
for _, l := range logs {
k.Logger(ctx).Info("logs", "log", l)
}

return &types.MsgEthereumTxResponse{
GasUsed: gasUsed,
VmError: vmError,
Expand Down

0 comments on commit 1ba67f0

Please sign in to comment.