Skip to content

Commit

Permalink
Merge pull request #10151 from filecoin-project/maciej/1614
Browse files Browse the repository at this point in the history
Eth JSON-RPC: from in eth_getTransactionByHash is not correctly popul…
  • Loading branch information
maciejwitowski authored Jan 31, 2023
2 parents dc5f865 + 99b879d commit 27465e5
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
5 changes: 5 additions & 0 deletions itests/eth_transactions_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ func TestValueTransferValidSignature(t *testing.T) {

// Success.
require.EqualValues(t, ethtypes.EthUint64(0x1), receipt.Status)

ethTx, err := client.EthGetTransactionByHash(ctx, &hash)
require.Nil(t, err)
require.EqualValues(t, ethAddr, ethTx.From)

}

func TestLegacyTransaction(t *testing.T) {
Expand Down
9 changes: 8 additions & 1 deletion node/impl/full/eth.go
Original file line number Diff line number Diff line change
Expand Up @@ -1569,8 +1569,15 @@ func newEthTxFromSignedMessage(ctx context.Context, smsg *types.SignedMessage, s

tx.Hash, err = tx.TxHash()
if err != nil {
return ethtypes.EthTx{}, err
return ethtypes.EthTx{}, xerrors.Errorf("failed to calculate hash for ethTx: %w", err)
}

fromAddr, err := lookupEthAddress(ctx, smsg.Message.From, sa)
if err != nil {
return ethtypes.EthTx{}, xerrors.Errorf("failed to resolve Ethereum address: %w", err)
}

tx.From = fromAddr
} else if smsg.Signature.Type == crypto.SigTypeSecp256k1 { // Secp Filecoin Message
tx = ethTxFromNativeMessage(ctx, smsg.VMMessage(), sa)
tx.Hash, err = ethtypes.EthHashFromCid(smsg.Cid())
Expand Down

0 comments on commit 27465e5

Please sign in to comment.