@@ -54,8 +54,9 @@ pub enum SinglePoolError {
5454
5555 // 10
5656 /// Not enough stake to cover the provided quantity of pool tokens.
57- /// (Generally this should not happen absent user error, but may if the
58- /// minimum delegation increases beyond 1 sol.)
57+ /// This typically means the value exists in the pool as activating stake,
58+ /// and an epoch is required for it to become available. Otherwise, it means
59+ /// active stake in the on-ramp must be moved via `ReplenishPool`.
5960 #[ error( "WithdrawalTooLarge" ) ]
6061 WithdrawalTooLarge ,
6162 /// Required signature is missing.
@@ -105,6 +106,10 @@ pub enum SinglePoolError {
105106 /// is in an exceptional state, or because the on-ramp account should be refreshed.
106107 #[ error( "ReplenishRequired" ) ]
107108 ReplenishRequired ,
109+ /// Withdrawal would render the pool stake account impossible to redelegate.
110+ /// This can only occur if the Stake Program minimum delegation increases above 1sol.
111+ #[ error( "WithdrawalViolatesPoolRequirements" ) ]
112+ WithdrawalViolatesPoolRequirements ,
108113}
109114impl From < SinglePoolError > for ProgramError {
110115 fn from ( e : SinglePoolError ) -> Self {
@@ -137,8 +142,9 @@ impl ToStr for SinglePoolError {
137142 "Error: Not enough pool tokens provided to withdraw stake worth one lamport." ,
138143 SinglePoolError :: WithdrawalTooLarge =>
139144 "Error: Not enough stake to cover the provided quantity of pool tokens. \
140- (Generally this should not happen absent user error, but may if the minimum delegation increases \
141- beyond 1 sol.)",
145+ This typically means the value exists in the pool as activating stake, \
146+ and an epoch is required for it to become available. Otherwise, it means \
147+ active stake in the onramp must be moved via `ReplenishPool`.",
142148 SinglePoolError :: SignatureMissing => "Error: Required signature is missing." ,
143149 SinglePoolError :: WrongStakeState => "Error: Stake account is not in the state expected by the program." ,
144150 SinglePoolError :: ArithmeticOverflow => "Error: Unsigned subtraction crossed the zero." ,
@@ -157,11 +163,14 @@ impl ToStr for SinglePoolError {
157163 SinglePoolError :: InvalidPoolOnRampAccount =>
158164 "Error: Provided pool onramp account does not match address derived from the pool account." ,
159165 SinglePoolError :: OnRampDoesntExist =>
160- "The onramp account for this pool does not exist; you must call `InitializePoolOnRamp` \
166+ "Error: The onramp account for this pool does not exist; you must call `InitializePoolOnRamp` \
161167 before you can perform this operation.",
162168 SinglePoolError :: ReplenishRequired =>
163169 "Error: The present operation requires a `ReplenishPool` call, either because the pool stake account \
164170 is in an exceptional state, or because the on-ramp account should be refreshed.",
171+ SinglePoolError :: WithdrawalViolatesPoolRequirements =>
172+ "Error: Withdrawal would render the pool stake account impossible to redelegate. \
173+ This can only occur if the Stake Program minimum delegation increases above 1 sol.",
165174 }
166175 }
167176}
0 commit comments