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

archive: Fetch body, genesisHash and header #1560

Merged
merged 8 commits into from
Sep 19, 2023
Merged

Conversation

lexnv
Copy link
Contributor

@lexnv lexnv commented Sep 14, 2023

This PR lays the foundation for implementing the archive RPC methods.

The methods implemented by this PR:

  • archive_unstable_body: Fetch the block's body (a vector of hex-encoded scale-encoded extrinsics) from a given block hash
  • archive_unstable_genesisHash: Fetch the genesis hash
  • archive_unstable_header: Fetch the header from a given block hash

Added unit tests for the methods.

This PR is implementing the methods without exposing them to the RPC layer; which are to be exposed by a follow-up PR.

Closes: #1509
Closes: #1514

@paritytech/subxt-team

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv added A0-needs_burnin Pull request needs to be tested on a live validator node before merge. DevOps is notified via matrix I5-enhancement An additional feature request. T3-RPC_API This PR/Issue is related to RPC APIs. D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. labels Sep 14, 2023
@lexnv lexnv self-assigned this Sep 14, 2023
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv changed the title archive: Implement archive_body and archive_genesisHash archive: Fetch body, genesisHash and header Sep 14, 2023
@lexnv lexnv requested review from jsdw and skunert September 14, 2023 10:09
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Copy link
Member

@niklasad1 niklasad1 left a comment

Choose a reason for hiding this comment

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

LGTM

///
/// This method is unstable and subject to change in the future.
#[method(name = "archive_unstable_genesisHash")]
fn archive_unstable_genesis_hash(&self) -> RpcResult<String>;
Copy link
Contributor

Choose a reason for hiding this comment

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

I raised paritytech/json-rpc-interface-spec#101 since I'd have thought we can remove this one :)

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the conclusion there is to keep it still :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep, thanks for raising this. From my perspective, I forgot about the other discussions which removed similar genesis functions. And I would have opted to remove the archive_genesis.

I could see the benefit of this API not necessarily being implemented by nodes (light or full), but also by third-parties which may have access only to the underlying DB.

We'll keep this for now and keep an eye on the genesis discussion

Copy link
Contributor

@jsdw jsdw left a comment

Choose a reason for hiding this comment

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

Looks great to me!

@lexnv lexnv merged commit f3061c1 into master Sep 19, 2023
115 checks passed
@lexnv lexnv deleted the lexnv/archive_body_genesis branch September 19, 2023 11:29
lexnv added a commit that referenced this pull request Sep 28, 2023
This PR implements:
- `archive_unstable_finalized_height`: Get the height of the most recent
finalized block
- `archive_unstable_hash_by_height`: Get the hashes (possible empty) of
blocks from the given height
- `archive_unstable_call`: Call into the runtime of a block

Builds on top of: #1560

### Testing Done
- unit tests for the methods with custom block tree for different
heights / forks

Closes: #1510
Closes: #1513
Closes: #1511

@paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
This PR lays the foundation for implementing the archive RPC methods.

The methods implemented by this PR:
- archive_unstable_body: Fetch the block's body (a vector of hex-encoded
scale-encoded extrinsics) from a given block hash
- archive_unstable_genesisHash: Fetch the genesis hash
- archive_unstable_header: Fetch the header from a given block hash

Added unit tests for the methods.

This PR is implementing the methods without exposing them to the RPC
layer; which are to be exposed by a follow-up PR.

Closes: paritytech#1509 
Closes: paritytech#1514

@paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
bgallois pushed a commit to duniter/duniter-polkadot-sdk that referenced this pull request Mar 25, 2024
This PR implements:
- `archive_unstable_finalized_height`: Get the height of the most recent
finalized block
- `archive_unstable_hash_by_height`: Get the hashes (possible empty) of
blocks from the given height
- `archive_unstable_call`: Call into the runtime of a block

Builds on top of: paritytech#1560

### Testing Done
- unit tests for the methods with custom block tree for different
heights / forks

Closes: paritytech#1510
Closes: paritytech#1513
Closes: paritytech#1511

@paritytech/subxt-team

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Co-authored-by: Sebastian Kunert <skunert49@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A0-needs_burnin Pull request needs to be tested on a live validator node before merge. DevOps is notified via matrix D0-easy Can be fixed primarily by duplicating and adapting code by an intermediate coder. I5-enhancement An additional feature request. T3-RPC_API This PR/Issue is related to RPC APIs.
Projects
None yet
4 participants