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

test: add infrastructure for RPC testing with real VM #2620

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

Conversation

AnkushinDaniil
Copy link
Contributor

@AnkushinDaniil AnkushinDaniil commented Mar 7, 2025

This PR introduces infrastructure for testing RPC endpoints using the real VM instead of mocks.

  • Add Cairo contracts for testing:
    • Universal deployer
    • Account contract
    • ERC20 token contract
    • Contract for binary search testing
  • Implement test_blockchain for creating a blockchain with predeployed contracts and preset balances
  • Add tests for starknet_estimateFee using real VM execution

@AnkushinDaniil AnkushinDaniil added the Test Any feature which requires more tests label Mar 7, 2025
Copy link

codecov bot commented Mar 7, 2025

Codecov Report

Attention: Patch coverage is 94.27313% with 13 lines in your changes missing coverage. Please review.

Project coverage is 75.49%. Comparing base (93b96c7) to head (f79b7ae).

Files with missing lines Patch % Lines
core/test_state.go 55.00% 6 Missing and 3 partials ⚠️
core/state.go 63.63% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2620      +/-   ##
==========================================
+ Coverage   75.14%   75.49%   +0.35%     
==========================================
  Files         140      142       +2     
  Lines       16815    17036     +221     
==========================================
+ Hits        12635    12862     +227     
+ Misses       3347     3333      -14     
- Partials      833      841       +8     

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

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

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.

I think this PR represents a good approximation of what we want to do. There are only two things which I think shouldn't go in:

  1. All contract defintion shouldn't depend on Scarb
  2. All contracts shouldn't be under the same Scarb project umbrella

Now, other minor thing, every compilation artifact which is not a .json or a .sierra should be deleted, unless they hinder the program.

@AnkushinDaniil AnkushinDaniil marked this pull request as draft March 7, 2025 19:02
@AnkushinDaniil AnkushinDaniil marked this pull request as ready for review March 12, 2025 06:39
@AnkushinDaniil AnkushinDaniil force-pushed the daniil/add-vm-test branch 2 times, most recently from 7493a83 to 5f1a572 Compare March 12, 2025 09:59
Comment on lines +263 to +265
maxAddr, ok := new(big.Int).SetString("0x7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00", 0)
require.True(t, ok)
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are you using BigInt here, can the maximum address be bigger than a felt?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I use it for the Rem method

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Test Any feature which requires more tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants