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

Stub out getBlocksSince and getBlock methods #6853

Merged
merged 4 commits into from
Nov 11, 2019

Conversation

CriesofCarrots
Copy link
Contributor

@CriesofCarrots CriesofCarrots commented Nov 9, 2019

Problem

Solana users need a way to introspect particular blocks on the ledger via a request/response workflow.

Summary of Changes

  • Add getBlocksSince rpc method to return the chain of rooted slots from a particular slot until the current root. This method is complete and returning real data.
  • Add getBlock rpc method stub; currently returns a batch of test transaction tuples (Transaction, transaction::Result) to demonstrate message format and a couple TransactionErrors. Transaction count == slot, and transaction keys are derived deterministically to allow testers to track the pubkeys across slots. (Most of this code, incl make_test_transactions() will be removed as part of item Research PoS implementations #3 below)

Follow-up work:

  • Plumb methods into solana-web3.js
  • Add persistent Transaction-status store to ledger
  • Parse get_slot_entries from blocktree to return real data from getBlock
  • Flesh out unit tests in rpc.rs vis-a-vis real data
  • Update jsonrpc-api.md to document the new methods

@CriesofCarrots CriesofCarrots requested a review from mvines November 9, 2019 15:01
@CriesofCarrots CriesofCarrots changed the title Stub out Stub out getBlocksSince and getBlock methods Nov 9, 2019
@codecov
Copy link

codecov bot commented Nov 9, 2019

Codecov Report

Merging #6853 into master will increase coverage by 17.1%.
The diff coverage is 45.3%.

@@            Coverage Diff            @@
##           master   #6853      +/-   ##
=========================================
+ Coverage    62.7%   79.8%   +17.1%     
=========================================
  Files         219     219              
  Lines       53718   42211   -11507     
=========================================
+ Hits        33704   33719      +15     
+ Misses      20014    8492   -11522

mvines
mvines previously approved these changes Nov 11, 2019
Copy link
Member

@mvines mvines left a comment

Choose a reason for hiding this comment

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

lgtm!

I assume updating the JSON RPC API doc is another follow-up item

}

pub fn get_block(&self, slot: Slot) -> Result<Vec<(Transaction, transaction::Result<()>)>> {
Ok(make_test_transactions(slot))
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just add a comment here saying this method is not fully implemented yet.

@mergify mergify bot dismissed mvines’s stale review November 11, 2019 17:40

Pull request has been modified.

@CriesofCarrots
Copy link
Contributor Author

I assume updating the JSON RPC API doc is another follow-up item

Added to follow-up work, and created an issue for tracking after this PR is closed.

@CriesofCarrots CriesofCarrots merged commit cc6e1ea into solana-labs:master Nov 11, 2019
@CriesofCarrots CriesofCarrots deleted the get-block-rpcs branch January 15, 2020 01:00
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