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

Support RPC 0.7.0 #1307

Merged
merged 20 commits into from
Mar 8, 2024
Merged

Support RPC 0.7.0 #1307

merged 20 commits into from
Mar 8, 2024

Conversation

ddoktorski
Copy link
Collaborator

Closes #1281

Initial PR #1282

Introduced changes

  • Replace StarknetBlockCommon with BlockHeader and add PendingBlockHeader to align with the RPC specification
    • Rename parent_block_hash, root -> parent_hash, new_root
    • Use BlockHeader in StarknetBlock, StarknetBlockWithTxHashes and StarknetBlockWithReceipts, the same for respective pending classes
  • Change logic in auto estimation for V3 transactions in the Account class
  • Add FullNodeClient.get_block_with_receipts
  • Increase max_fee/l1_resource_bounds for devnet tests

  • This PR contains breaking changes

@ddoktorski ddoktorski marked this pull request as draft February 29, 2024 18:39
@ddoktorski
Copy link
Collaborator Author

Note: Some tests on network will fail, because the testnet networks don't support Starknet 0.13.1 yet.

@ddoktorski ddoktorski mentioned this pull request Feb 29, 2024
1 task
Copy link

codecov bot commented Feb 29, 2024

Codecov Report

Attention: Patch coverage is 98.51852% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 98.00%. Comparing base (f3e3d3f) to head (0114df5).

Additional details and impacted files
@@               Coverage Diff               @@
##           development    #1307      +/-   ##
===============================================
- Coverage        98.01%   98.00%   -0.02%     
===============================================
  Files               93       93              
  Lines             4592     4658      +66     
===============================================
+ Hits              4501     4565      +64     
- Misses              91       93       +2     
Files Coverage Δ
starknet_py/net/account/account.py 99.59% <100.00%> (ø)
starknet_py/net/client_models.py 99.77% <100.00%> (+0.01%) ⬆️
starknet_py/net/full_node_client.py 99.51% <100.00%> (+0.01%) ⬆️
starknet_py/net/schemas/rpc.py 99.21% <100.00%> (+0.04%) ⬆️
starknet_py/net/schemas/common.py 86.56% <75.00%> (-0.74%) ⬇️

docs/guide/account_and_client.rst Outdated Show resolved Hide resolved
.github/workflows/checks.yml Outdated Show resolved Hide resolved
docs/migration_guide.rst Outdated Show resolved Hide resolved
starknet_py/net/account/account.py Show resolved Hide resolved
starknet_py/tests/e2e/block_test.py Outdated Show resolved Hide resolved
@ddoktorski ddoktorski marked this pull request as ready for review March 8, 2024 13:03
docs/migration_guide.rst Outdated Show resolved Hide resolved
Comment on lines +476 to 504
class PendingBlockHeaderSchema(Schema):
parent_hash = Felt(data_key="parent_hash", required=True)
timestamp = fields.Integer(data_key="timestamp", required=True)
sequencer_address = Felt(data_key="sequencer_address", required=True)
transactions = fields.List(
fields.Nested(TypesOfTransactionsSchema(unknown=EXCLUDE)),
data_key="transactions",
required=True,
l1_gas_price = fields.Nested(
ResourcePriceSchema(), data_key="l1_gas_price", required=True
)
l1_data_gas_price = fields.Nested(
ResourcePriceSchema(), data_key="l1_data_gas_price", required=True
)
l1_da_mode = L1DAModeField(data_key="l1_da_mode", required=True)
starknet_version = fields.String(data_key="starknet_version", required=True)


class BlockHeaderSchema(Schema):
block_hash = Felt(data_key="block_hash", required=True)
parent_hash = Felt(data_key="parent_hash", required=True)
block_number = fields.Integer(data_key="block_number", required=True)
new_root = Felt(data_key="new_root", required=True)
timestamp = fields.Integer(data_key="timestamp", required=True)
sequencer_address = Felt(data_key="sequencer_address", required=True)
l1_gas_price = fields.Nested(
ResourcePriceSchema(), data_key="l1_gas_price", required=True
)
l1_data_gas_price = fields.Nested(
ResourcePriceSchema(), data_key="l1_data_gas_price", required=True
)
l1_da_mode = L1DAModeField(data_key="l1_da_mode", required=True)
starknet_version = fields.String(data_key="starknet_version", required=True)
Copy link
Contributor

Choose a reason for hiding this comment

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

Nit: Would it be reasonable to add an intermediate class to avoid some code duplication?

Copy link
Contributor

Choose a reason for hiding this comment

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

On the other hand, it's "copied" from starknet-spec. IMO it's cleaner when we keep this basic spec class implement explicit

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

We can consider introducing an additional class, such as BlockHeaderCommon in #1231

STARKNET_VERSION: "0.13.0"
RPC_SPEC_VERSION: "0.6.0"
DEVNET_SHA: "1bd447d"
DEVNET_SHA: "c6ffb99"
Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It doesn't make any difference, as there is no relevant changes in the commits following c6ffb99 (only changes to CI and package version).

@@ -1,3 +1,5 @@
# pylint: disable=too-many-lines
Copy link
Contributor

Choose a reason for hiding this comment

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

we could think about splitting this file into the smallest. but in separate task

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Co-authored-by: Maksim Zdobnikau <43750648+DelevoXDG@users.noreply.github.com>
@ddoktorski ddoktorski merged commit 0e1d230 into development Mar 8, 2024
16 checks passed
@ddoktorski ddoktorski deleted the ddoktorski/support-rpc-0.7.0 branch March 8, 2024 15:02
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.

Add support for 0.7.0 RPC version
4 participants