Summary
Generate transaction receipts after execution. Receipts contain the status, cumulative gas used, logs, and bloom filter — required for block validation and event querying.
Specification
Receipt struct:
%Receipt{
status: 0 | 1, # 0 = failure, 1 = success
cumulative_gas_used: non_neg_integer(),
logs: [log_entry()],
logs_bloom: <<_::2048>> # 256-byte bloom filter
}
Encoding
- Legacy tx receipts:
RLP.encode([status, cumulative_gas, bloom, logs])
- Typed tx receipts:
tx_type ++ RLP.encode([status, cumulative_gas, bloom, logs])
Implementation Guide
- Create
lib/eevm/receipt.ex with the Receipt struct
- Generate receipt from
TransactionResult — status from execution result, logs from MachineState, bloom via EEVM.Bloom
- Add
encode/1 for RLP encoding (both legacy and typed)
- Cumulative gas is the sum of gas used by all txs in the block up to and including this one — tracked at the block level
- Tests: receipt from successful tx, receipt from reverted tx, receipt encoding, bloom filter matches logs
Acceptance Criteria
Reference
- Yellow Paper §4.3.1 (Receipt)
- EIP-2718 (Typed receipts)
Summary
Generate transaction receipts after execution. Receipts contain the status, cumulative gas used, logs, and bloom filter — required for block validation and event querying.
Specification
Receipt struct:
Encoding
RLP.encode([status, cumulative_gas, bloom, logs])tx_type ++ RLP.encode([status, cumulative_gas, bloom, logs])Implementation Guide
lib/eevm/receipt.exwith the Receipt structTransactionResult— status from execution result, logs from MachineState, bloom viaEEVM.Bloomencode/1for RLP encoding (both legacy and typed)Acceptance Criteria
Reference