Documentation
¶
Overview ¶
EIP-1559 Ethereum transaction codec for the Filecoin FEVM write path (lantern#45 Stage 3). Decodes a signed raw EIP-1559 tx (0x02-prefixed RLP) into its fields, recovers the sender, and converts it to a Filecoin SignedMessage with a SigTypeDelegated signature — the exact shape MpoolPush / the gossipsub /fil/msgs topic expect.
Ported in shape (NOT by import) from Lotus chain/types/ethtypes, which pulls in filecoin-ffi via the chain build and is therefore unusable here. We support EIP-1559 only: that's what FEVM / curio-core sends. Legacy + EIP-2930 are explicitly rejected.
CGO-free.
Minimal RLP codec for EIP-1559 Ethereum transactions (lantern#45 Stage 3). Ported in shape from go-ethereum / Lotus ethtypes RLP, kept deliberately narrow: we only need to decode/encode the flat structures an EIP-1559 tx uses (byte strings + a single top-level list, with one empty nested list for the access list). No structs, no recursion beyond one level of nesting, no streaming.
CGO-free, no go-ethereum dependency.
Index ¶
- Constants
- func DecodeRLP(data []byte) (interface{}, error)
- func EncodeRLP(val interface{}) ([]byte, error)
- type Eth1559Tx
- func (tx *Eth1559Tx) EncodeSigned() ([]byte, error)
- func (tx *Eth1559Tx) Sender() ([20]byte, error)
- func (tx *Eth1559Tx) SenderFilecoin() (address.Address, error)
- func (tx *Eth1559Tx) SetSignature(sig []byte) error
- func (tx *Eth1559Tx) SigningHash() ([]byte, error)
- func (tx *Eth1559Tx) ToSignedFilecoinMessage() (*types.SignedMessage, error)
- func (tx *Eth1559Tx) TxHash() ([32]byte, error)
Constants ¶
const (
// EIP1559TxType is the type byte prefixing an EIP-1559 tx envelope.
EIP1559TxType = 0x02
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Eth1559Tx ¶
type Eth1559Tx struct {
ChainID uint64
Nonce uint64
To *[20]byte // nil => contract creation (EAM CreateExternal)
Value big.Int
MaxFeePerGas big.Int
MaxPriorityFeePerGas big.Int
GasLimit uint64
Input []byte
// Signature components (set when decoding a signed tx).
V big.Int
R big.Int
S big.Int
}
Eth1559Tx is the decoded form of an EIP-1559 transaction.
func ParseSignedEIP1559 ¶
ParseSignedEIP1559 decodes a signed raw EIP-1559 tx (the bytes a client passes to eth_sendRawTransaction, with or without a 0x prefix already stripped by the caller).
func (*Eth1559Tx) EncodeSigned ¶
EncodeSigned returns the full signed EIP-1559 envelope (type byte || signed RLP) — the bytes a client would pass to eth_sendRawTransaction. Exported so callers (and tests) can construct raw txs without a wallet.
func (*Eth1559Tx) SenderFilecoin ¶
SenderFilecoin returns the sender as its f4/EAM delegated Filecoin address.
func (*Eth1559Tx) SetSignature ¶
SetSignature fills V/R/S from a 65-byte [R||S||V] recoverable signature (the shape go-crypto.Sign returns).
func (*Eth1559Tx) SigningHash ¶
SigningHash exposes the keccak256 hash that must be signed to produce a valid signature for this tx (the preimage ecrecover runs against).
func (*Eth1559Tx) ToSignedFilecoinMessage ¶
func (tx *Eth1559Tx) ToSignedFilecoinMessage() (*types.SignedMessage, error)
ToSignedFilecoinMessage converts the decoded+verified tx into the Filecoin SignedMessage shape MpoolPush expects: an unsigned Message (from = recovered sender) plus a SigTypeDelegated signature carrying the 65-byte r||s||v.