Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[x/staking/LSM] reporting on rounding and truncation precision for tokenized shares #22793

Open
MSalopek opened this issue Dec 6, 2024 · 0 comments
Labels
needs-triage Issue that needs to be triaged

Comments

@MSalopek
Copy link
Contributor

MSalopek commented Dec 6, 2024

This is a short follow-up on the state of the LSM module after a series of audits is drawing to a close.

Findings are only relevant to cosmos-sdk v0.50.x-lsm releases used on the Cosmos Hub.

While no significant issues were found, some smaller issues were already fixed and will be part of the next cosmos-sdk-lsm release.

For posterity, we're posting 2 informational findings that could inform future decisions around the x/staking modifications to support LSM that were first introduced in gaiad v12.0.0.

Informational finding 1

The difference in calculated total amount of liquid staked tokens and the reported total amount of liquid staked tokens (obtained by calling stakingKeeper.GetTotalLiquidStakedTokens()) was established and its impact was studied.

It was discovered that the difference is around 3000 uatom [0.003 atom], while the total amount of liquid staked tokens is around 7 400 000 000 000 uatom [7.4 M atom]

The impact on the system is insignificant and consistent with expected rounding errors while truncating decimals to integers for accounting purposes.

Action point

For completenes, it should be checked if there is an impact on the system while the total amount of liquid staked tokens approaches zero (i.e. check if the total liquid staked tokens can fall below 0 and if it would halt the chain or not). This might come into play if the LSM changes would get phased out and a state migration is in progress.

Informational finding 2

Identyfying delegations coming from liquid staking accounts (DelegatorIsLiquidStaker check) uses as simplistic check to determine the type of account.

Simply checking if the account address bytes slice is 32 bytes long is too simplistic and it may potentially interfere with other module accounts that have the same account address bytes slice length.

Further investigation is needed to identify if this issue actually ever manifests in a way that could impact users, modules or the system as a whole.

The total liquid staking cap is 25% while the current total liquid staked ATOM (at the time of writing) is ~3%. There should be no immediate risk to the system.

@github-actions github-actions bot added the needs-triage Issue that needs to be triaged label Dec 6, 2024
@github-project-automation github-project-automation bot moved this to 📋 Backlog in Cosmos-SDK Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-triage Issue that needs to be triaged
Projects
Status: 📋 Backlog
Development

No branches or pull requests

1 participant