-
Notifications
You must be signed in to change notification settings - Fork 181
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
base: main
Are you sure you want to change the base?
RPC update - add l2 gas #2335
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2335 +/- ##
==========================================
+ Coverage 74.42% 74.75% +0.33%
==========================================
Files 110 110
Lines 11771 11818 +47
==========================================
+ Hits 8760 8834 +74
+ Misses 2329 2306 -23
+ Partials 682 678 -4 ☔ View full report in Codecov by Sentry. |
if b.L1GasPrice != nil { | ||
return b.L1GasPrice.PriceInFri | ||
} | ||
return b.GasPriceFRI | ||
} | ||
|
||
// TODO: Fix when we have l2 gas price |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what did you mean by that?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now the feeder gateway doesn't send this field. It can be removed once we have it from the FGW and have field validation in the proto fields.
0b11ce6
to
49278bf
Compare
bfeb90f
to
5bf7f2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// Amount of WEI charged per Gas spent on L1 | ||
L1GasPriceETH *felt.Felt | ||
// Amount of STRK charged per Gas spent on L2 | ||
L2GasPriceETH *felt.Felt |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unfortunately it's not as simple as that. When we encode structures into bytes encoder it stores field names alongside their values so if we rename it here we receive nil in these fields even if our db is up to date.
@IronGauntlets please confirm
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can it be fixed with tags?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've checked on block №800:
"l1_gas_price": {
"price_in_fri": "0x0",
- "price_in_wei": "0x476b2446"
+ "price_in_wei": null
},
@kirugan you are right
return nil, httpHeader, err | ||
} | ||
|
||
return utils.Map(result, func(tx SimulatedTransaction) FeeEstimateV0_7 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can pass function name (=pointer) like:
return utils.Map(result, FeeEstimateToV0_7)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think so, feeEstimateToV0_7
adapts FeeEstimate
, not SimulatedTransaction
.
return utils.Map(result, feeEstimateToV0_7)
requires changes in feeEstimateToV0_7
.
5faca91
to
dfa0789
Compare
Fix #2323
Fix #2324
Fix #2334
Implement RPC changes regarding
l2_gas
Core Data Structures and Adaptation Functions:
core/block.go
: Updated theHeader
struct to includeL1GasPriceETH
,L2GasPriceETH
,L1GasPriceSTRK
, andL2GasPriceSTRK
fields, replacing the previousGasPrice
andGasPriceSTRK
fields. [1] [2]adapters/p2p2core/block.go
: Updated theAdaptBlockHeader
function to include the new L1 and L2 gas price fields.adapters/sn2core/sn2core.go
: Adjusted theAdaptBlock
function to handle the new gas price fields.RPC:
rpc/block.go
: Updated theBlockHeader
struct andadaptBlockHeader
function to include L2 gas prices. [1] [2]rpc/estimate_fee.go
: Introduced a newFeeEstimate
struct to handle L1 and L2 gas prices and added a versionedEstimateFeeV0_7
function for backward compatibility. [1] [2] [3]Test Cases:
adapters/sn2core/sn2core_test.go
: Updated test cases to assert the new gas price fields.rpc/block_test.go
: Added assertions for L2 gas prices in the relevant test cases. [1] [2] [3]rpc/estimate_fee_test.go
: Included tests for the newEstimateFeeV0_7
function.rpc/events_test.go
: Updated expected JSON responses to include L2 gas prices. [1] [2]