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

fix: improving minting flow #674

Merged
merged 7 commits into from
May 17, 2024
Merged

fix: improving minting flow #674

merged 7 commits into from
May 17, 2024

Conversation

cdummett
Copy link
Collaborator

@cdummett cdummett commented May 16, 2024

Summary

Current minting method is flaky as there is no guarantee the balance after minting will be greater than the balance before minting, even if the mint is successful. This is as minting directly from the faucet or through transfers requires blocks to be forwarded in which funds can flow out for reasons independent of any flows in.

Instead...

  • we can faucet to the treasury when needed as the treasury balance should be fairly static (i.e. no flows out other than top-up transfers).
  • and top-up parties through transfers but crucially check the status of the transfer rather than the account balance.

New minting flow is as follows….

  1. Check treasury has enough funds to cover the full “top up” transfer, if not iteratively...
    1. Faucet maximum funds directly to the treasury.
    2. If funds never arrived raise error.
  2. Make an internal “top up” transfer from the treasury to the party with a unique reference. Then..
    1. Forward a block
    2. Wait for synchronisation
    3. Query transfers, checking if transfer is successful. Note we do not care if the balance increased, only that the top up was successful.
    4. If the transfer was rejected raise error.
  3. If transfer never appeared raise error.

@cdummett cdummett self-assigned this May 16, 2024
@cdummett cdummett requested a review from a team as a code owner May 16, 2024 15:26
@cdummett cdummett force-pushed the fix/improve-minting branch from c23c0ec to 7997517 Compare May 16, 2024 15:27
@cdummett cdummett requested a review from TomMcL May 16, 2024 15:47
TomMcL
TomMcL previously approved these changes May 16, 2024
@cdummett cdummett force-pushed the fix/improve-minting branch from 35bae2e to 73d9a4b Compare May 17, 2024 09:39
@cdummett cdummett requested a review from TomMcL May 17, 2024 10:49
@cdummett cdummett merged commit 6f64a25 into develop May 17, 2024
7 of 8 checks passed
@cdummett cdummett deleted the fix/improve-minting branch May 17, 2024 11:21
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.

2 participants