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

Refactor: starknet_estimateMessageFee #2496

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

hudem1
Copy link
Contributor

@hudem1 hudem1 commented Feb 16, 2025

rpc pkg cleanup according to #2437

Reuse v6 SimulationFlag and MsgFromL1 types for v7 and v8

As i was looking into refactoring starknet_estimateMessageFee endpoint, i just found those 2 types to refactor. I don't know if we really want to refactor those, but i opened a PR in case. Let me know if we don't necessarily want to refactor those

@hudem1 hudem1 changed the title Refactor: Reuse v6 SimulationFlag and MsgFromL1 types for v7 and v8 Refactor: starknet_estimateMessageFee Feb 16, 2025
@hudem1 hudem1 mentioned this pull request Feb 16, 2025
23 tasks
Copy link

codecov bot commented Feb 16, 2025

Codecov Report

Attention: Patch coverage is 66.66667% with 3 lines in your changes missing coverage. Please review.

Project coverage is 73.73%. Comparing base (94071e4) to head (07e8456).

Files with missing lines Patch % Lines
rpc/v8/estimate_fee.go 33.33% 2 Missing ⚠️
rpc/v7/estimate_fee.go 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2496      +/-   ##
==========================================
+ Coverage   73.65%   73.73%   +0.07%     
==========================================
  Files         137      137              
  Lines       16659    16641      -18     
==========================================
  Hits        12271    12271              
+ Misses       3526     3511      -15     
+ Partials      862      859       -3     

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

@hudem1 hudem1 added RPC JSON RPC API Refactor labels Feb 17, 2025
@rianhughes rianhughes self-requested a review February 24, 2025 15:15
@@ -65,9 +66,9 @@ func (f FeeEstimate) MarshalJSON() ([]byte, error) {
*****************************************************/

func (h *Handler) EstimateFee(broadcastedTxns []BroadcastedTransaction,
simulationFlags []SimulationFlag, id BlockID,
simulationFlags []rpcv6.SimulationFlag, id BlockID,
Copy link
Contributor

@rianhughes rianhughes Mar 14, 2025

Choose a reason for hiding this comment

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

Hmm, it looks like this is a bug actually. We allow SKIP_FEE_CHARGE which isn't allowed by the spec.

The spec distinguishes between SIMULATION_FLAG_FOR_ESTIMATE_FEE (starknet_estFee) and SIMULATION_FLAG (starknet_sumTxns). This seems to be the case for all rpc versions. Not a critical bug, but should probably be fixed

@@ -45,9 +46,9 @@ type FeeEstimate struct {
*****************************************************/

func (h *Handler) EstimateFee(broadcastedTxns []BroadcastedTransaction,
simulationFlags []SimulationFlag, id BlockID,
simulationFlags []rpcv6.SimulationFlag, id BlockID,
Copy link
Contributor

Choose a reason for hiding this comment

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

Similar bug here (we accept SKIP_FEE_CHARGE, which isn't allowed by the spec)

@rianhughes
Copy link
Contributor

LGTM, just need to address the starknet_estFee flags bug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Refactor RPC JSON RPC API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants