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

stake-pool: Ceiling all fee calculations (HAL-01) #6153

Merged
merged 1 commit into from
Jan 24, 2024

Conversation

joncinque
Copy link
Contributor

Problem

During deposit and withdrawal functions, if the SOL or pool token amount is small, it is possible the fee calculations floor to zero due to loss of precision, preventing fee collection.

Solution

This scenario is not economically viable, and the cost of fee avoidance would outweigh the benefit of depositing such a small amount to the stake pool, but it's better to fix things up.

The change takes the ceiling of all fee calculations by adding denominator - 1 to the numerator.

@joncinque joncinque requested a review from 2501babe January 19, 2024 12:15
@2501babe
Copy link
Contributor

seems straightforward!

@joncinque joncinque merged commit a17fffe into solana-labs:master Jan 24, 2024
@joncinque joncinque deleted the spceil branch January 24, 2024 11:33
billythedummy pushed a commit to igneous-labs/sanctum-spl-stake-pool that referenced this pull request Feb 9, 2024
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