Ensure blocks do not exceed the max accounts data size during Replay Stage (backport #23422) (#23589)
* Ensure blocks do not exceed the max accounts data size during Replay Stage (#23422)
(cherry picked from commit 3c6840050c
)
# Conflicts:
# runtime/src/bank.rs
* fix conflicts
Co-authored-by: Brooks Prumo <brooks@solana.com>
This commit is contained in:
@ -79,7 +79,7 @@ impl AccountsDataMeter {
|
||||
/// return an error and *do not* consume more accounts data space.
|
||||
pub fn consume(&mut self, amount: i64) -> Result<(), InstructionError> {
|
||||
if amount > self.remaining() as i64 {
|
||||
return Err(InstructionError::AccountsDataBudgetExceeded);
|
||||
return Err(InstructionError::MaxAccountsDataSizeExceeded);
|
||||
}
|
||||
self.consume_unchecked(amount);
|
||||
Ok(())
|
||||
|
@ -1918,7 +1918,7 @@ mod tests {
|
||||
assert!(result.is_err());
|
||||
assert!(matches!(
|
||||
result,
|
||||
Err(solana_sdk::instruction::InstructionError::AccountsDataBudgetExceeded)
|
||||
Err(solana_sdk::instruction::InstructionError::MaxAccountsDataSizeExceeded)
|
||||
));
|
||||
assert_eq!(invoke_context.accounts_data_meter.remaining(), 0);
|
||||
}
|
||||
|
Reference in New Issue
Block a user