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

Remove hardcoded values in estimate_fee test #1526

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

Conversation

fishseabowl
Copy link
Contributor

Pull Request type

Please add the labels corresponding to the type of changes your PR introduces:

  • Testing

What is the current behavior?

Resolves: #1368

What is the new behavior?

Replace hardcoded value in estimate_fee test with actual fee

Does this introduce a breaking change?

Other information

let invoke_transaction_2 =
BroadcastedTransaction::Invoke(BroadcastedInvokeTransaction { nonce: FieldElement::ONE, ..tx });

let simulations = rpc
Copy link
Collaborator

Choose a reason for hiding this comment

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

can we execute it instead of doing the simulation? i think that would be a better test, wdyt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@apoorvsadana Thank you for your comment. Could you please clarify how to check the actual fee after execution? Additionally, does "executing it" refer to calling JsonRpcClient.add_invoke_transaction? Thanks

Copy link
Collaborator

Choose a reason for hiding this comment

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

You can fetch the receipt to get the actual_fee. Yes, you need to call add_invoke_transaction

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@apoorvsadana, Thank you for your help. do you know how long we should wait until MaybePendingTransactionReceipt gets the Receipt value?

In my local machine, waiting for 20 seconds works fine, estimate_fee equals actual_fee(0xf0).

However, in the rpc-tests, it fails. After I changed wait time to 200 seconds, it still failed.

In another case, after adding PendingReceipt to match arm, it fails in rpc-tests because PendingReceipt.actual_fee(0xdc) is slightly smaller than Receipt.actual_fee(0xf0).

It looks like there is no validate, the fee should be 0xd2(210), if validate is skipped, the fee should be 0xdc(220), with signature, the fee should be 0xf0(240).

@tdelabro
Copy link
Collaborator

blocked by #1573

We are going to wait a bit before rebasing and merging this one, okay?

@tdelabro tdelabro added the stuck Stuck because of some external factor label Apr 30, 2024
@fishseabowl
Copy link
Contributor Author

@apoorvsadana Could you help to review this PR? Thanks

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 31.22%. Comparing base (2e2d580) to head (583ff0f).
Report is 235 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1526      +/-   ##
==========================================
- Coverage   40.71%   31.22%   -9.49%     
==========================================
  Files          96       89       -7     
  Lines       11069     9190    -1879     
  Branches    11069     9190    -1879     
==========================================
- Hits         4507     2870    -1637     
+ Misses       6050     5855     -195     
+ Partials      512      465      -47     

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stuck Stuck because of some external factor
Projects
None yet
Development

Successfully merging this pull request may close these issues.

dev: Better estimate fee test
3 participants