Skip to content

🏗️ Vesting pallet block number provider migration #474

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

Merged

Conversation

dastansam
Copy link
Contributor

@dastansam dastansam commented Mar 21, 2025

This pull request introduces updates to the vesting system, runtime configurations, and testing utilities. The changes include a new vesting migration implementation, adjustments to the relay chain block number handling, and cleanup of deprecated code. Below is a summary of the most important changes:

Vesting System Enhancements:

  • Added a new vesting migration (UncheckedMigrationToV1) to adjust starting blocks and per-block release rates based on the relay chain block number. This migration ensures compatibility with async backing and includes pre- and post-upgrade checks. ([[1]](https://github.com/Polimec/polimec-node/pull/474/files#diff-ea2b22ffeac81f446db7cb39b4e30fc16643687632adcab75288f8ca5f63617cR1-R149), [[2]](https://github.com/Polimec/polimec-node/pull/474/files#diff-63e5609b322bad6be8ef1b127b8161c52602cff85ab9cf67f6b5ac03be68fc3aR21-R22), [[3]](https://github.com/Polimec/polimec-node/pull/474/files#diff-fa44a5ad015c5d189a690374b9164d3a58b7218228b56c151327dd62d143ee1bL190-R193))
  • Removed the old LinearReleaseVestingMigration implementation, which was replaced by the new vesting migration approach. ([runtimes/polimec/src/custom_migrations/linear_release.rsL1-L110](https://github.com/Polimec/polimec-node/pull/474/files#diff-c47feabf076eb45e19f973367310bbee30b1b6c39cec965f9a22c5bb0cdb6d0cL1-L110))

Runtime Configuration Updates:

  • Updated the pallet_vesting::Config to use RelaychainDataProvider<Runtime> as the BlockNumberProvider, aligning block number calculations with the relay chain. ([runtimes/polimec/src/lib.rsL938-R936](https://github.com/Polimec/polimec-node/pull/474/files#diff-fa44a5ad015c5d189a690374b9164d3a58b7218228b56c151327dd62d143ee1bL938-R936))

Testing Improvements:

  • Introduced a utility function set_relay_chain_block_number for setting the relay chain block number in tests, replacing direct calls to PolimecSystem::set_block_number. ([[1]](https://github.com/Polimec/polimec-node/pull/474/files#diff-efc2ea8d587d168e507866db12407b1bddb338abcb020d2a83ed001106f38c8aL17-R45), [[2]](https://github.com/Polimec/polimec-node/pull/474/files#diff-efc2ea8d587d168e507866db12407b1bddb338abcb020d2a83ed001106f38c8aL92-R106), [[3]](https://github.com/Polimec/polimec-node/pull/474/files#diff-efc2ea8d587d168e507866db12407b1bddb338abcb020d2a83ed001106f38c8aL126-R137))
  • Fixed a typo in a test comment for clarity. ([integration-tests/src/tests/vest.rsL104-R115](https://github.com/Polimec/polimec-node/pull/474/files#diff-efc2ea8d587d168e507866db12407b1bddb338abcb020d2a83ed001106f38c8aL104-R115))

Dependency and Code Cleanup:

  • Added sp-io to the workspace and standard dependencies in Cargo.toml to support the new vesting migration logic. ([[1]](https://github.com/Polimec/polimec-node/pull/474/files#diff-098063d62f6a6569d719395ff78cb479908fc67c99289cba0ce85c4a182a088aR77), [[2]](https://github.com/Polimec/polimec-node/pull/474/files#diff-098063d62f6a6569d719395ff78cb479908fc67c99289cba0ce85c4a182a088aR181))
  • Simplified trait bounds in benchmarking by replacing sp_std::fmt::Debug with core::fmt::Debug. ([pallets/funding/src/benchmarking.rsL100-R100](https://github.com/Polimec/polimec-node/pull/474/files#diff-ffb567ea90cf81e3ccb0bf17050102829044c0b8693fe8a0a7c6cf776a588123L100-R100))

Copy link
Contributor Author

dastansam commented Mar 21, 2025

@dastansam dastansam self-assigned this Mar 21, 2025
@dastansam dastansam force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch 3 times, most recently from 4aeec9b to 526d838 Compare March 24, 2025 18:09
@dastansam dastansam force-pushed the 03-21-linear_relaase_pallet_migration branch from a529926 to 84ca86b Compare March 24, 2025 18:09
@dastansam dastansam force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch 2 times, most recently from b348aa7 to 783f62f Compare March 25, 2025 08:47
@dastansam dastansam force-pushed the 03-21-linear_relaase_pallet_migration branch from 84ca86b to ff5663f Compare March 25, 2025 08:47
@dastansam dastansam force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch 2 times, most recently from b73b726 to e78457e Compare March 25, 2025 08:59
@dastansam dastansam marked this pull request as ready for review March 27, 2025 20:33
@dastansam dastansam force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch from e78457e to 7692995 Compare March 27, 2025 20:36
@dastansam dastansam force-pushed the 03-21-linear_relaase_pallet_migration branch 2 times, most recently from fd9083a to 6514ee3 Compare April 2, 2025 06:10
@dastansam dastansam force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch from 7692995 to b69858e Compare April 2, 2025 06:10
@lrazovic lrazovic requested review from lrazovic and Copilot April 3, 2025 09:39
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR migrates the vesting pallet block number provider by adding a new unchecked migration for vesting info. The key changes include adding a new migration call in lib.rs, introducing the vesting migration implementation, and updating the custom migrations module to include vesting.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
runtimes/polimec/src/lib.rs New migration reference added for vesting
runtimes/polimec/src/custom_migrations/vesting.rs New migration implementation for vesting info
runtimes/polimec/src/custom_migrations/mod.rs Updated module exports to include vesting module
Comments suppressed due to low confidence (1)

runtimes/polimec/src/custom_migrations/vesting.rs:25

  • The LOG constant is incorrectly named with 'linear_release::migration::v1'; consider renaming it to better reflect the vesting migration, such as 'vesting::migration::v1'.
const LOG: &str = "linear_release::migration::v1";

@dastansam dastansam force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch 5 times, most recently from 87d78cf to b5c0764 Compare April 7, 2025 20:18
@dastansam dastansam force-pushed the 03-21-linear_relaase_pallet_migration branch from 6514ee3 to 1207e4e Compare April 7, 2025 20:18
@lrazovic lrazovic requested a review from Copilot April 11, 2025 08:28
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 9 out of 9 changed files in this pull request and generated no comments.

Comments suppressed due to low confidence (1)

runtimes/polimec/src/custom_migrations/vesting.rs:125

  • Using assert macros in post_upgrade may cause panics during runtime upgrade verification. Consider returning a DispatchError instead to handle migration mismatches gracefully.
assert_ne!(pre_vesting_info.starting_block(), post_vesting_info.starting_block(), "Starting block not adjusted");

@lrazovic lrazovic force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch from 76dac0d to d41707b Compare April 25, 2025 10:48
@lrazovic lrazovic force-pushed the 03-21-linear_relaase_pallet_migration branch from 79fc906 to 820b987 Compare April 25, 2025 10:48
@lrazovic lrazovic mentioned this pull request Apr 25, 2025
@dastansam dastansam force-pushed the 03-21-linear_relaase_pallet_migration branch from 820b987 to 79fc906 Compare April 29, 2025 13:32
@dastansam dastansam force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch from d41707b to 76dac0d Compare April 29, 2025 13:32
@lrazovic lrazovic force-pushed the 03-21-linear_relaase_pallet_migration branch from 79fc906 to 820b987 Compare April 29, 2025 15:24
@lrazovic lrazovic force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch from 76dac0d to d41707b Compare April 29, 2025 15:24
@dastansam dastansam force-pushed the 03-21-linear_relaase_pallet_migration branch from 820b987 to 79fc906 Compare April 30, 2025 15:25
@dastansam dastansam force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch from d41707b to 76dac0d Compare April 30, 2025 15:25
@lrazovic lrazovic force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch from 76dac0d to d41707b Compare April 30, 2025 15:34
@lrazovic lrazovic force-pushed the 03-21-linear_relaase_pallet_migration branch from 79fc906 to 820b987 Compare April 30, 2025 15:34
@lrazovic lrazovic changed the title Vesting pallet block number provider migration 🏗️ Vesting pallet block number provider migration May 1, 2025
@dastansam dastansam force-pushed the 03-21-linear_relaase_pallet_migration branch from 820b987 to 79fc906 Compare May 1, 2025 15:54
@dastansam dastansam force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch from d41707b to 76dac0d Compare May 1, 2025 15:54
@lrazovic lrazovic force-pushed the 03-21-linear_relaase_pallet_migration branch from 79fc906 to 820b987 Compare May 2, 2025 07:41
@lrazovic lrazovic force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch from 76dac0d to d41707b Compare May 2, 2025 07:41
Copy link
Member

lrazovic commented May 2, 2025

Merge activity

  • May 2, 7:23 AM EDT: A user started a stack merge that includes this pull request via Graphite.
  • May 2, 7:31 AM EDT: Graphite rebased this pull request as part of a merge.
  • May 2, 7:32 AM EDT: @lrazovic merged this pull request with Graphite.

@lrazovic lrazovic changed the base branch from 03-21-linear_relaase_pallet_migration to graphite-base/474 May 2, 2025 11:28
@lrazovic lrazovic changed the base branch from graphite-base/474 to main May 2, 2025 11:30
@lrazovic lrazovic force-pushed the 03-21-vesting_pallet_block_number_provider_migration branch from d41707b to 7272202 Compare May 2, 2025 11:30
@lrazovic lrazovic merged commit 7b599ff into main May 2, 2025
1 check passed
@lrazovic lrazovic deleted the 03-21-vesting_pallet_block_number_provider_migration branch May 2, 2025 11:32
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