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

chore: upgrade token distribution #103

Merged
merged 10 commits into from
Sep 30, 2024
Merged

Conversation

RafilxTenfen
Copy link
Contributor

@RafilxTenfen RafilxTenfen commented Sep 27, 2024

  • Update upgrade name from signet-launch to v1
  • A new file with data for token distribution to run during the upgrade. Expected template:
{
  "token_distribution": [
    {
      "address_sender": "bbn14d97wthm9fqvvdd96ax8lnfppwknndxztevs7k",
      "address_receiver": "bbn13t5cnqj6t0p4xa40cwhmgv4wju0zl6g8slk8rz",
      "amount": 100000
    },
    ...
  ]
}
  • New function from test suite to run before the upgrade type PreUpgradeFunc func([]*chain.Config)

@RafilxTenfen RafilxTenfen self-assigned this Sep 27, 2024
@RafilxTenfen RafilxTenfen marked this pull request as ready for review September 27, 2024 15:10
@RafilxTenfen RafilxTenfen requested a review from a team as a code owner September 27, 2024 15:10
@RafilxTenfen RafilxTenfen requested review from gitferry and KonradStaniec and removed request for a team September 27, 2024 15:10
@RafilxTenfen RafilxTenfen requested review from Lazar955 and a team September 27, 2024 15:40

amount := sdk.NewCoin(appparams.BaseCoinUnit, sdkmath.NewInt(td.Amount))
if err := bankK.SendCoins(ctx, sender, receiver, sdk.NewCoins(amount)); err != nil {
return err
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just few quesation for better understanding:

  • what happens if this returns and error ? does upgrade stop ?
  • I imagine bankK.SendCoins does all necessary validation if sender have enough coins etc?

I am just thinking of the scenario if by mistake we have some invalid account as sender and what will happen then. I imagine upgrade will happen on chain which is priavate yet and it will fails, so we will be able easily to re-do it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, if it fails it is going to panic and stop the upgrade
The upgrade is called during PreBlocker I expect that the context is handled with commit and rollback in case of failures, but in our case, since it is all private we will be able to run it again

app/upgrades/signetlaunch/upgrades_test.go Outdated Show resolved Hide resolved
@RafilxTenfen RafilxTenfen merged commit c11bbb3 into main Sep 30, 2024
17 checks passed
@maurolacy maurolacy deleted the rafilx/upgrade-token-distribution branch October 4, 2024 04: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