Skip to content
This repository was archived by the owner on Jan 22, 2025. It is now read-only.

Rpc: Return error if block does not exist#11743

Merged
CriesofCarrots merged 2 commits into
solana-labs:masterfrom
CriesofCarrots:rpc-err-no-block
Aug 20, 2020
Merged

Rpc: Return error if block does not exist#11743
CriesofCarrots merged 2 commits into
solana-labs:masterfrom
CriesofCarrots:rpc-err-no-block

Conversation

@CriesofCarrots
Copy link
Copy Markdown
Contributor

Problem

The endpoints getConfirmedBlock and getBlockTime return success, but null data when a block is not available. This is particularly confusing in the latter case, since getBlockTime also returns null if the block time is not available.

Summary of Changes

Return a JSON-RPC error if block is not available for a slot

Comment thread core/src/rpc_error.rs
data: None,
},
RpcCustomError::BlockNotAvailable { slot } => Self {
code: ErrorCode::ServerError(JSON_RPC_SERVER_ERROR_4),
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@mvines , in #10630 this is JSON_RPC_SERVER_ERROR_3, but it wasn't clear to me why. Let me know if I should revert this change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I think that was just a silent protest against burning server errors. We only have 100 of them, and then the world ends

@CriesofCarrots CriesofCarrots added the automerge Merge this Pull Request automatically once CI passes label Aug 20, 2020
@mergify
Copy link
Copy Markdown
Contributor

mergify Bot commented Aug 20, 2020

automerge label removed due to a CI failure

@mergify mergify Bot removed the automerge Merge this Pull Request automatically once CI passes label Aug 20, 2020
@codecov
Copy link
Copy Markdown

codecov Bot commented Aug 20, 2020

Codecov Report

Merging #11743 into master will increase coverage by 0.0%.
The diff coverage is 85.7%.

@@           Coverage Diff           @@
##           master   #11743   +/-   ##
=======================================
  Coverage    82.0%    82.0%           
=======================================
  Files         330      330           
  Lines       76742    76746    +4     
=======================================
+ Hits        62966    62974    +8     
+ Misses      13776    13772    -4     

@CriesofCarrots CriesofCarrots merged commit 747f8d5 into solana-labs:master Aug 20, 2020
mergify Bot pushed a commit that referenced this pull request Aug 20, 2020
* Return error if block does not exist

* Update docs

(cherry picked from commit 747f8d5)
mergify Bot pushed a commit that referenced this pull request Aug 20, 2020
* Return error if block does not exist

* Update docs

(cherry picked from commit 747f8d5)
mergify Bot added a commit that referenced this pull request Aug 20, 2020
* Return error if block does not exist

* Update docs

(cherry picked from commit 747f8d5)

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
mergify Bot added a commit that referenced this pull request Aug 20, 2020
* Return error if block does not exist

* Update docs

(cherry picked from commit 747f8d5)

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
@CriesofCarrots CriesofCarrots deleted the rpc-err-no-block branch September 1, 2020 19:57
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