mirror of
https://github.com/filecoin-project/lotus.git
synced 2025-08-26 02:38:58 +08:00
feat: ETH compatibility in Filecoin : Support Homestead and EIP-155 Ethereum transactions("legacy" transactions) in Filecoin (#11969)
* poc for eth legacy tx * print statements * finished * tests work * remove print statements * Remove all print statements * remove extraneous changes * cleaned up code and interface * run make jen * dont duplicate signature * go mod tidy and remove prints * clean up tests * test for conversion * changes as per review * more unit tests for legacy txns * Apply suggestions from code review Co-authored-by: Rod Vagg <rod@vagg.org> * address review comments from Rodd * changes as per zen's 2nd review * go mod tidy * feat: ETH compatibility in Filecoin : Support EIP-155 Ethereum transactions in Filecoin (#11970) * itests passing for 155 tx * first working version for EIP-155 transactions * green itest * add docs * tests * remove print stmt * remove print stmt * validate signature * changes as per zen's review * correct signature verification * gate tx by Network Version * handle arajsek review * fix imports order * fix lint * dont lock in mpool for network gating ETH messages * sender can be an ID address --------- Co-authored-by: Rod Vagg <rod@vagg.org>
This commit is contained in:
@ -294,14 +294,16 @@ func (a *EthModule) EthGetTransactionByHashLimited(ctx context.Context, txHash *
|
||||
// This should be "fine" as anyone using an "Ethereum-centric" block
|
||||
// explorer shouldn't care about seeing pending messages from native
|
||||
// accounts.
|
||||
tx, err := ethtypes.EthTxFromSignedEthMessage(p)
|
||||
ethtx, err := ethtypes.EthTransactionFromSignedFilecoinMessage(p)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not convert Filecoin message into tx: %w", err)
|
||||
}
|
||||
tx.Hash, err = tx.TxHash()
|
||||
|
||||
tx, err := ethtx.ToEthTx(p)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not compute tx hash for eth txn: %w", err)
|
||||
return nil, fmt.Errorf("could not convert Eth transaction to EthTx: %w", err)
|
||||
}
|
||||
|
||||
return &tx, nil
|
||||
}
|
||||
}
|
||||
@ -817,12 +819,12 @@ func (a *EthModule) EthGasPrice(ctx context.Context) (ethtypes.EthBigInt, error)
|
||||
}
|
||||
|
||||
func (a *EthModule) EthSendRawTransaction(ctx context.Context, rawTx ethtypes.EthBytes) (ethtypes.EthHash, error) {
|
||||
txArgs, err := ethtypes.ParseEthTxArgs(rawTx)
|
||||
txArgs, err := ethtypes.ParseEthTransaction(rawTx)
|
||||
if err != nil {
|
||||
return ethtypes.EmptyEthHash, err
|
||||
}
|
||||
|
||||
smsg, err := txArgs.ToSignedMessage()
|
||||
smsg, err := ethtypes.ToSignedFilecoinMessage(txArgs)
|
||||
if err != nil {
|
||||
return ethtypes.EmptyEthHash, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user