Skip to content
This repository has been archived by the owner on Dec 15, 2023. It is now read-only.

Allow RPC calls using block hash or number of latest block #313

Merged
merged 16 commits into from
Oct 21, 2022

Conversation

cptartur
Copy link
Contributor

@cptartur cptartur commented Oct 20, 2022

Usage related changes

  • Currently, in many places in the RPC, it is required that the users uses "latest" as block hash/number. With this PR it is also possible to use a block_hash or block_number if they belong to the latest block.
  • This PR allows making calls with block tag "pending" block, though it is still treated as a "latest" block (up to discussion if this should be included).
  • Changed fixtures using pytest.mark.parametrize usages with indirect=True, to parametrized fixtures.

Development related changes

None

Checklist:

  • Applied formatting - ./scripts/format.sh
  • No linter errors - ./scripts/lint.sh
  • Performed code self-review
  • Rebased to the last commit of the target branch (or merged it into my branch)
  • Documented the changes
  • Linked the issues which this PR resolves
  • Updated the tests
  • All tests are passing

Copy link
Collaborator

@FabijanC FabijanC left a comment

Choose a reason for hiding this comment

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

Thanks for the contribution!

  1. Accepted block IDs can be documented in page/docs/guide/json-rpc-api.md.
  2. Currently only "latest" is tested. Shouldn't providing "pending" also be tested?

starknet_devnet/blueprints/rpc/utils.py Outdated Show resolved Hide resolved
starknet_devnet/blueprints/rpc/utils.py Show resolved Hide resolved
starknet_devnet/blueprints/rpc/utils.py Outdated Show resolved Hide resolved
starknet_devnet/blueprints/rpc/utils.py Outdated Show resolved Hide resolved
@cptartur
Copy link
Contributor Author

  1. Will be added
  2. I wasn't sure if we want to include "pending", for me it seems like a logical addition since "pending" is supported in gateway as far as I know. I'll extend the test to cover pending block.

@cptartur
Copy link
Contributor Author

Addressed the comments. I've also unchecked "tests are passing" because test/test_postman.py::test_postman suddenly stopped working. I suspect it's a problem with some local configuration on my end so if tests could be run on your end we could verify that.

Copy link
Collaborator

@FabijanC FabijanC left a comment

Choose a reason for hiding this comment

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

Cloned your fork, postman test is passing.

page/docs/guide/json-rpc-api.md Outdated Show resolved Hide resolved
page/docs/guide/json-rpc-api.md Outdated Show resolved Hide resolved
test/rpc/test_rpc_call.py Outdated Show resolved Hide resolved
@FabijanC FabijanC changed the title Allow making RPC calls using block hash or number of a latest block Allow RPC calls using block hash or number of latest block Oct 21, 2022
@FabijanC FabijanC merged commit 715612b into 0xSpaceShard:master Oct 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants