blockchain-etl / ethereum-etl

Python scripts for ETL (extract, transform and load) jobs for Ethereum blocks, transactions, ERC20 / ERC721 tokens, transfers, receipts, logs, contracts, internal transactions. Data is available in Google BigQuery https://goo.gl/oY5BCQ
https://t.me/BlockchainETL
MIT License
2.87k stars 812 forks source link

Add Optimism / OP Stack Transaction Receipt Fields #446

Closed MSilb7 closed 11 months ago

MSilb7 commented 1 year ago

This adds in fields in the Optimism transaction receipt, used for calculating transaction gas fees and expected L1 data usage. These changes will apply for OP Mainnet as well as other OP Stack chains (i.e. Base).

l1_fee: The total amount of ETH paid in a user's transaction for the L1 data fee l1_gas_used: The amount of gas that the calldata (input data) and overhead of a transaction used. l1_gas_price: The price for L1 gas charged for a transaction. l1_fee_scalar: The fee scalar applied to l1_gas_used.

For more information see: Optimism Docs - Transaction Fees on L2

Definitely let me know if there's a better spot to make these adds!

MSilb7 commented 1 year ago

Hi, wondering if there's any insight in to why the test is failing?

medvedev1088 commented 1 year ago

There was an issue with urllib3 version. After fixing it https://github.com/blockchain-etl/ethereum-etl/pull/447 there are still failed tests e.g. new columns need to be added in the tests https://github.com/blockchain-etl/ethereum-etl/blob/develop/tests/resources/test_export_receipts_job/receipts_with_logs/expected_receipts.csv

MSilb7 commented 1 year ago

There was an issue with urllib3 version. After fixing it #447 there are still failed tests e.g. new columns need to be added in the tests https://github.com/blockchain-etl/ethereum-etl/blob/develop/tests/resources/test_export_receipts_job/receipts_with_logs/expected_receipts.csv

Got it, made the updates!

To clarify, these are OP Stack Chain - specific fields, so hopefully it's not too annoying for people pulling other chains.

MSilb7 commented 1 year ago

Added the fields to the streaming functions.

A note that once this gets merged, we also need to update the schema here: https://github.com/blockchain-etl/ethereum-etl-postgres

MSilb7 commented 1 year ago

~One remaining thing I'm trying to track down.~

~In streaming, receipt_l1_fee, receipt_l1_gas_used, etc are coming through as null. They return values on non-streaming receipt exports.~

Edit: never mind this was an issue due to my local package being inconsistent. All good!

MSilb7 commented 1 year ago

Hi @medvedev1088 - bumping this! May be useful now that Zora's chain is live as well.

medvedev1088 commented 1 year ago

@MSilb7 sorry for the delay. I'll try to test and merge it on the weekend

medvedev1088 commented 11 months ago

Included in version 2.3.0 https://pypi.org/project/ethereum-etl/2.3.0/