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

Handle staking limits in tBTC Depositor contract #228

Closed
wants to merge 3 commits into from

Conversation

nkuba
Copy link
Member

@nkuba nkuba commented Feb 8, 2024

This PR enhances #91.

nkuba added 3 commits February 8, 2024 15:04
The staking flow in the dApp is asynchronous and there is a short period
of time between a deposit funding transaction is made on Bitcoin chain
and revealed to this contract.This limit is used to gain better control
on the stakes queue, and reduce a risk of concurrent stake requests
made in the dApp being blocked by another big deposit.
stBTC contract introduces limits for total deposits amount. Due to
asynchronous manner of the staking flow, this contract needs to track
balance of pending stake requests to ensure new stake request are
not initialized if they won't be able to finalize.
Amounts are gross deposit amounts in satoshi precision. It
means, the value from Bitcoin funding transaction is used, including
the fees taken by tBTC or Acre protocols.
The function should be used by dApp to validate maximum possible amount
of the stake request.
It takes into account limit set in the stBTC contract, maximum single
stake limit and balance of pending stakes.

The `initializeStakeRequest` function is not enforcing this
limit, not to block the reveal deposit operation of the concurrent
deposits made in the dApp in the short window between limit check,
submission of Bitcoin funding transaction and stake request
initialization.
In case of an unfortunate coincidence of concurrent deposit request
reaching the limit, the Acre protocol will work towards stake request
finalization by raising the limit to let the queued stake request in.
@nkuba
Copy link
Member Author

nkuba commented Feb 16, 2024

Closing in favor of #253.

@nkuba nkuba closed this Feb 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant