Merge pull request #10151 from filecoin-project/maciej/1614

Eth JSON-RPC: from in eth_getTransactionByHash is not correctly popul…
This commit is contained in:
Maciej Witowski 2023-01-31 20:30:33 +01:00 committed by GitHub
commit 27465e5faf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 1 deletions

View File

@ -83,6 +83,11 @@ func TestValueTransferValidSignature(t *testing.T) {
// Success. // Success.
require.EqualValues(t, ethtypes.EthUint64(0x1), receipt.Status) 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) { func TestLegacyTransaction(t *testing.T) {

View File

@ -1569,8 +1569,15 @@ func newEthTxFromSignedMessage(ctx context.Context, smsg *types.SignedMessage, s
tx.Hash, err = tx.TxHash() tx.Hash, err = tx.TxHash()
if err != nil { 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 } else if smsg.Signature.Type == crypto.SigTypeSecp256k1 { // Secp Filecoin Message
tx = ethTxFromNativeMessage(ctx, smsg.VMMessage(), sa) tx = ethTxFromNativeMessage(ctx, smsg.VMMessage(), sa)
tx.Hash, err = ethtypes.EthHashFromCid(smsg.Cid()) tx.Hash, err = ethtypes.EthHashFromCid(smsg.Cid())