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

breaking: Felt type migration + 0.7.1 RPC update #2126

Merged
merged 31 commits into from
Jul 6, 2024
Merged

breaking: Felt type migration + 0.7.1 RPC update #2126

merged 31 commits into from
Jul 6, 2024

Conversation

kariy
Copy link
Member

@kariy kariy commented Jul 1, 2024

Description

Update of the RPC to be in sync with starknet tools.

Some notable changes:

  • The receipt contains now the block info as a separate field. No more MaybePendingTransactionReceipt. Pending or not pending, the receipt is accessible. Then we can check the block field to access the block status.
  • Execution and Declaration are now V1 and V2 respectively, as new type V3 is now accessible for all of them.
  • Dojo and Cainome have been bumped to the same revision that starkli is using for both starknet and Starknet-crypto.
  • The diff between 0.6.0 and 0.7.1.

Some points to debug:

  • Debug the dependencies to keep having the StarkFelt conversion for FieldElement.
  • Update the block content for new block with receipts.

Starknet 0.7.1 RPC Changes

  • change getTransactionReceipt return type to TXN_RECEIPT_WITH_BLOCK_INFO; the receipt now includes information about its block.
  • add new endpoint getBlockWithReceipts; return block with the tx receipts only (using the old receipt type that doesnt have the block info attached).
  • add data availability fields ( l1_data_gas_price, l1_da_mode ) to the block header (including pending)
  • new fields to the TxFeeInfo; data_gas_consumed and data_gas_price. spec
  • new execution resources fields; data_availability

Update crates to the same version of starknet-rs:

Bump starknet-rs -> 0.11.0 and include the patches specified below if necessary.

[patch.crates-io]
starknet-core = { git = "https://github.com/kariy/starknet-rs", branch = "dojo-patch" }

Patches

  • starknet-types-core

This patch is necessary to de/serialize Felt using non human readable encodings (eg. postcard). The main repo doesn't yet implement it, so we should remove the patch once it is.

dojoengine/types-rs@1943cb9

starknet-types-core = { git = "https://github.com/dojoengine/types-rs", rev = "289e2f0" }
  • starknet-core

This patch is to:

  • enable the std feature on starknet-types-core
  • re-export the entire felt module from starknet-types-core to import the FromStrError type directly from starknet crate instead of having to manually manage difference imports from starknet-types-core.

Remove this patch once the following PR is merged: xJonathanLEI/starknet-rs#615 or similar change is added.

starknet-core = { git = "https://github.com/kariy/starknet-rs", branch = "dojo-patch" }

Copy link

coderabbitai bot commented Jul 1, 2024

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

115 files out of 172 files are above the max files limit of 50. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@kariy kariy mentioned this pull request Jul 1, 2024
17 tasks
@kariy kariy marked this pull request as draft July 1, 2024 18:24
@glihm glihm mentioned this pull request Jul 3, 2024
10 tasks
@kariy kariy marked this pull request as ready for review July 3, 2024 19:21
@kariy kariy changed the title Felt type migration + 0.7.1 RPC update breaking: Felt type migration + 0.7.1 RPC update Jul 3, 2024
Copy link
Member Author

Choose a reason for hiding this comment

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

@neotheprogramist @glihm does changing the serde from decimal to hex break anything here?

Copy link
Collaborator

@glihm glihm Jul 5, 2024

Choose a reason for hiding this comment

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

@neotheprogramist the serialization is mostly used to sent this input into the calldata for the world on settlement layer, correct? If yes, not breaking to have hex instead of decimal.

Copy link

codecov bot commented Jul 5, 2024

Codecov Report

Attention: Patch coverage is 55.64759% with 589 lines in your changes missing coverage. Please review.

Project coverage is 67.78%. Comparing base (ff266df) to head (9c796a2).
Report is 2 commits behind head on main.

Files Patch % Lines
crates/katana/rpc/rpc-types/src/block.rs 5.26% 90 Missing ⚠️
crates/katana/rpc/rpc/src/starknet.rs 9.87% 73 Missing ⚠️
bin/sozo/src/commands/options/account/type.rs 0.00% 53 Missing ⚠️
crates/dojo-types/src/packing.rs 20.00% 48 Missing ⚠️
...na/executor/src/implementation/blockifier/utils.rs 71.28% 29 Missing ⚠️
bin/saya/src/tests.rs 0.00% 28 Missing ⚠️
crates/torii/grpc/src/types/mod.rs 0.00% 27 Missing ⚠️
crates/sozo/ops/src/account.rs 13.63% 19 Missing ⚠️
crates/sozo/ops/src/model.rs 0.00% 17 Missing ⚠️
crates/dojo-types/src/primitive.rs 68.62% 16 Missing ⚠️
... and 49 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2126      +/-   ##
==========================================
- Coverage   68.09%   67.78%   -0.32%     
==========================================
  Files         332      332              
  Lines       41582    41736     +154     
==========================================
- Hits        28316    28289      -27     
- Misses      13266    13447     +181     

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

Copy link
Collaborator

@glihm glihm left a comment

Choose a reason for hiding this comment

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

🚀 amazing rework mate, thanks for that!

@glihm glihm merged commit 4d33374 into main Jul 6, 2024
13 of 15 checks passed
@glihm glihm deleted the migrate-felt branch July 6, 2024 03:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants