rpc: turn off getStakeActivation epoch parameter (#33156)

* Return error on past-epoch parameter

* Update docs
This commit is contained in:
Tyera 2023-09-05 16:52:49 -06:00 committed by GitHub
parent 05622c17da
commit 17b1b5646d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 7 deletions

View File

@ -41,6 +41,7 @@ Configuration object containing the following fields:
<Field name="epoch" type="u64" optional={true}>
epoch for which to calculate activation details. If parameter not provided,
defaults to current epoch.
**DEPRECATED**, inputs other than the current epoch return an error.
</Field>
</Parameter>

View File

@ -1719,14 +1719,10 @@ impl JsonRpcRequestProcessor {
min_context_slot: config.min_context_slot,
})?;
let epoch = config.epoch.unwrap_or_else(|| bank.epoch());
if bank.epoch().saturating_sub(epoch) > solana_sdk::stake_history::MAX_ENTRIES as u64 {
if epoch != bank.epoch() {
return Err(Error::invalid_params(format!(
"Invalid param: epoch {epoch:?} is too far in the past"
)));
}
if epoch > bank.epoch() {
return Err(Error::invalid_params(format!(
"Invalid param: epoch {epoch:?} has not yet started"
"Invalid param: epoch {epoch:?}. Only the current epoch ({:?}) is supported",
bank.epoch()
)));
}