Skip to content

Commit

Permalink
single-pool: remove minimum delegation check
Browse files Browse the repository at this point in the history
this check is an artifact of a previous design. we used to
include the minimum in our pool stake total and burned tokens
when initializing so that it could not be withdrawn. later we
changed to treating it as separate from pool stake entirely.
therefore a post_pool_stake below minimum_delegation is valid
in the case where the first deposit is below 1 sol. this fix
allows such a deposit instead of returning a very frightening
error message
  • Loading branch information
2501babe committed Jan 19, 2024
1 parent 919d563 commit 2cefc84
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ In addition, one program is planned for deployment to Solana Mainnet Beta:

| Program | Version |
| --- | --- |
| [single-pool](https://github.com/solana-labs/solana-program-library/tree/master/single-pool/program) | [1.0.0](https://github.com/solana-labs/solana-program-library/releases/tag/single-pool-v1.0.0) |
| [single-pool](https://github.com/solana-labs/solana-program-library/tree/master/single-pool/program) | [1.0.1](https://github.com/solana-labs/solana-program-library/releases/tag/single-pool-v1.0.1) |

## Audits

Expand Down
2 changes: 1 addition & 1 deletion single-pool/program/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "spl-single-pool"
version = "1.0.0"
version = "1.0.1"
description = "Solana Program Library Single-Validator Stake Pool"
authors = ["Solana Labs Maintainers <maintainers@solanalabs.com>"]
repository = "https://github.com/solana-labs/solana-program-library"
Expand Down
5 changes: 0 additions & 5 deletions single-pool/program/src/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -862,11 +862,6 @@ impl Processor {
.and_then(|amount| amount.checked_sub(pool_stake_meta.rent_exempt_reserve))
.ok_or(SinglePoolError::ArithmeticOverflow)?;

// sanity check: we have not somehow gone below the minimum
if post_pool_stake < minimum_delegation {
return Err(SinglePoolError::UnexpectedMathError.into());
}

// sanity check: the user stake account is empty
if user_stake_info.lamports() != 0 {
return Err(SinglePoolError::UnexpectedMathError.into());
Expand Down

0 comments on commit 2cefc84

Please sign in to comment.