Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RPC update - add l2 gas #2335

Merged
merged 34 commits into from
Jan 22, 2025
Merged

RPC update - add l2 gas #2335

merged 34 commits into from
Jan 22, 2025

Conversation

AnkushinDaniil
Copy link
Contributor

@AnkushinDaniil AnkushinDaniil commented Dec 18, 2024

Fix #2323
Fix #2324
Fix #2334

This pull request includes significant changes to the gas price handling in various parts of the codebase. The primary focus is on introducing support for L2 gas prices and renaming existing gas price fields for clarity. The most important changes are grouped by theme and summarized below.

Gas Price Handling Enhancements:

Test Updates:

Core Data Structures:

  • core/block.go: Updated the Header struct to include L2 gas prices and renamed existing gas price fields.
  • core/receipt.go: Added an L2 gas field to the GasConsumed struct.
  • core/transaction.go: Added an L2 gas field to the DataAvailability struct.

These changes ensure that the codebase can handle both L1 and L2 gas prices, providing more granular control and clarity.

Core Data Structures and Adaptation Functions:

  • core/block.go: Updated the Header struct to include L1GasPriceETH, L2GasPriceETH, L1GasPriceSTRK, and L2GasPriceSTRK fields, replacing the previous GasPrice and GasPriceSTRK fields. [1] [2]
  • adapters/p2p2core/block.go: Updated the AdaptBlockHeader function to include the new L1 and L2 gas price fields.
  • adapters/sn2core/sn2core.go: Adjusted the AdaptBlock function to handle the new gas price fields.

RPC:

  • rpc/block.go: Updated the BlockHeader struct and adaptBlockHeader function to include L2 gas prices. [1] [2]
  • rpc/estimate_fee.go: Introduced a new FeeEstimate struct to handle L1 and L2 gas prices and added a versioned EstimateFeeV0_7 function for backward compatibility. [1] [2] [3]

Test Cases:

Copy link

codecov bot commented Dec 18, 2024

Codecov Report

Attention: Patch coverage is 76.47059% with 24 lines in your changes missing coverage. Please review.

Project coverage is 74.88%. Comparing base (e3acc28) to head (9ab791d).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
rpc/estimate_fee.go 51.85% 12 Missing and 1 partial ⚠️
rpc/block.go 60.00% 4 Missing and 2 partials ⚠️
rpc/simulation.go 82.14% 5 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2335      +/-   ##
==========================================
+ Coverage   74.65%   74.88%   +0.22%     
==========================================
  Files         111      111              
  Lines       12123    12171      +48     
==========================================
+ Hits         9051     9114      +63     
+ Misses       2372     2356      -16     
- Partials      700      701       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

starknet/block.go Outdated Show resolved Hide resolved
@AnkushinDaniil AnkushinDaniil added the RPC JSON RPC API label Dec 20, 2024
@AnkushinDaniil AnkushinDaniil changed the title Daniil/update rpc RPC update - add l2 gas Dec 20, 2024
@AnkushinDaniil AnkushinDaniil added the go Pull requests that update Go code label Dec 20, 2024
rpc/estimate_fee.go Outdated Show resolved Hide resolved
rpc/block.go Outdated Show resolved Hide resolved
Copy link
Contributor

@weiihann weiihann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

core/block.go Outdated Show resolved Hide resolved
rpc/estimate_fee.go Outdated Show resolved Hide resolved
@AnkushinDaniil AnkushinDaniil force-pushed the daniil/update-rpc branch 2 times, most recently from dfa0789 to eed5b3e Compare December 26, 2024 07:55
@AnkushinDaniil AnkushinDaniil force-pushed the daniil/update-rpc branch 4 times, most recently from 968275a to c1abd7a Compare January 13, 2025 18:49
Copy link
Contributor

@rodrigo-pino rodrigo-pino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Half review. Will continue tomorrow

core/felt/felt.go Outdated Show resolved Hide resolved
adapters/core2p2p/block.go Outdated Show resolved Hide resolved
rpc/block.go Outdated Show resolved Hide resolved
@AnkushinDaniil AnkushinDaniil force-pushed the daniil/update-rpc branch 3 times, most recently from 6dcb2f5 to b1a4fbe Compare January 16, 2025 15:09
@AnkushinDaniil AnkushinDaniil requested review from rodrigo-pino and removed request for kirugan January 22, 2025 10:43
@AnkushinDaniil AnkushinDaniil merged commit b45cae5 into main Jan 22, 2025
14 checks passed
@AnkushinDaniil AnkushinDaniil deleted the daniil/update-rpc branch January 22, 2025 12:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
go Pull requests that update Go code RPC JSON RPC API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RPC08 - Execution_resources changes RPC08 - Fee_estimate changes RPC08 - Block header now contains l2_gas
4 participants