Skip to content

🐛 Correct Async Backing migrations #479

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
merged 1 commit into from
May 2, 2025

Conversation

lrazovic
Copy link
Member

@lrazovic lrazovic commented Apr 30, 2025

Dependency Updates:

  • Updated multiple dependencies in Cargo.toml files to stable2412-5 version.

Code Refactoring:

  • Refactored the Vesting storage definition in pallets/linear-release/src/lib.rs to use a type alias (EntriesOf<T>) for better readability and maintainability. [1] [2]
  • Removed unused imports and redundant features such as parachains-common references in various files, simplifying the codebase. [1] [2] [3] [4]

Test Enhancements:

  • Enhanced migration test cases in pallets/funding/src/migrations/vesting_info.rs to include assertions for database weight and migration entry counts, ensuring correctness and performance validation. [1] [2]
  • Adjusted test logic in pallets/funding/src/tests/runtime_api.rs to fix expected index values during vesting schedule merging operations.

Runtime and Benchmark Adjustments:

  • Updated runtime benchmarks and feature configurations in several Cargo.toml files to align with the updated dependencies and removed deprecated entries. [1] [2] [3]

Performance Tweaks:

  • Increased the authoring_duration in nodes/parachain/src/service.rs from 500ms to 2000ms to optimize block authoring performance if asynchronous backing is enabled.

@lrazovic lrazovic mentioned this pull request Apr 30, 2025
@lrazovic lrazovic force-pushed the 04-30-fix_correct_the_migrations branch 2 times, most recently from 5bd4239 to 2c5af4f Compare April 30, 2025 08:18
@lrazovic lrazovic force-pushed the 04-30-fix_correct_the_migrations branch from 2c5af4f to b535912 Compare April 30, 2025 08:54
Copy link
Contributor

@dastansam dastansam left a comment

Choose a reason for hiding this comment

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

not sure about fetching block number for every translate

@lrazovic lrazovic force-pushed the 04-30-fix_correct_the_migrations branch from b535912 to e97975e Compare April 30, 2025 09:23
Copy link
Contributor

@dastansam dastansam left a comment

Choose a reason for hiding this comment

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

lgtm

@lrazovic lrazovic force-pushed the 04-30-fix_correct_the_migrations branch from e97975e to 2f78c33 Compare April 30, 2025 09:46
@dastansam dastansam force-pushed the 04-25-allow_transact branch from cd5c5d0 to f87b89e Compare April 30, 2025 15:25
@dastansam dastansam force-pushed the 04-30-fix_correct_the_migrations branch from 2f78c33 to 575b593 Compare April 30, 2025 15:25
@lrazovic lrazovic force-pushed the 04-30-fix_correct_the_migrations branch from 575b593 to 7b6e10d Compare April 30, 2025 15:34
@lrazovic lrazovic force-pushed the 04-25-allow_transact branch from f87b89e to cd5c5d0 Compare April 30, 2025 15:34
@lrazovic lrazovic force-pushed the 04-30-fix_correct_the_migrations branch 3 times, most recently from 61c9a2b to be3bbd9 Compare May 1, 2025 11:48
@lrazovic lrazovic force-pushed the 04-25-allow_transact branch from cd5c5d0 to 9c675e8 Compare May 1, 2025 13:21
@lrazovic lrazovic force-pushed the 04-30-fix_correct_the_migrations branch from be3bbd9 to 8ee104c Compare May 1, 2025 13:21
@lrazovic lrazovic marked this pull request as ready for review May 1, 2025 13:23
Copy link

graphite-app bot commented May 1, 2025

Graphite Automations

"Auto-assign PRs to author" took an action on this PR • (05/01/25)

1 assignee was added to this PR based on Juan Ignacio Rios's automation.

@lrazovic lrazovic force-pushed the 04-25-allow_transact branch from 9c675e8 to f61bdd5 Compare May 1, 2025 13:53
@lrazovic lrazovic force-pushed the 04-30-fix_correct_the_migrations branch from 8ee104c to 296dcb6 Compare May 1, 2025 13:53
@lrazovic lrazovic requested a review from Copilot May 1, 2025 14:27
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 pull request fixes migration-related issues and adjusts various configuration parameters to correctly reflect runtime expectations. Key changes include renaming and updating migration types in the polimec runtime, modifying on-chain weight calculations and migration logic in vesting and linear-release modules, and adjusting benchmark and slot duration settings in Cargo.toml and mock configurations.

Reviewed Changes

Copilot reviewed 27 out of 27 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
runtimes/polimec/src/lib.rs Updated imports/constants and renamed the custom migration type for vesting to AsyncBacking.
runtimes/polimec/src/custom_migrations/vesting.rs Renamed migration type and refined per_block and weight calculation logic using checked_div and ensure!
pallets/parachain-staking/src/mock.rs Adjusted SlotDuration from 12,000 ms to 6,000 ms.
pallets/linear-release/src/migrations.rs & tests Updated migration logic from multiplying to division in per_block adjustments and adjusted tests.
pallets/funding/src/tests/runtime_api.rs Changed expected merge candidate indices in vesting schedule merge tests.
Various Cargo.toml files and integration tests Updated dependency versions and removed duplicate runtime benchmarks.
nodes/parachain/src/service.rs Increased authoring_duration from 500ms to 2000ms for consensus service parameters.
Comments suppressed due to low confidence (2)

runtimes/polimec/src/lib.rs:198

  • The migration type has been renamed from UncheckedMigrationToV1 to UncheckedMigrationToAsyncBacking. Please update the associated documentation and comments to reflect this change consistently.
super::custom_migrations::vesting::v1::UncheckedMigrationToAsyncBacking<Runtime>,

pallets/funding/src/tests/runtime_api.rs:440

  • The expected vesting schedule merge indices have changed from (0, 1) to (1, 2). Please verify that this adjustment aligns with the intended business logic and update any related documentation or tests if necessary.
assert_eq!((idx_1, idx_2), (1, 2));

@@ -95,7 +110,7 @@ pub mod v1 {

sp_io::storage::set(VESTING_ASYNC_BACKED_KEY, &().encode()[..]);

Copy link
Preview

Copilot AI May 1, 2025

Choose a reason for hiding this comment

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

The additional increments added to items in the DB weight calculation should be clearly documented. Please consider adding a comment explaining why 1 and 2 are added respectively to the read and write counts.

Suggested change
// Add 1 to the read count to account for the read operation on `VESTING_ASYNC_BACKED_KEY`.
// Add 2 to the write count to account for the write operation on `VESTING_ASYNC_BACKED_KEY`
// and any additional writes performed during the migration.

Copilot uses AI. Check for mistakes.

@@ -95,7 +95,7 @@ impl pallet_aura::Config for Test {
type AuthorityId = AuthorityId;
type DisabledValidators = ();
type MaxAuthorities = MaxCollatorCandidates;
Copy link
Preview

Copilot AI May 1, 2025

Choose a reason for hiding this comment

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

The slot duration was reduced from 12,000 to 6,000 ms. Please ensure that this change is intentional and update the documentation to reflect the new expected block production rate.

Suggested change
type MaxAuthorities = MaxCollatorCandidates;
type MaxAuthorities = MaxCollatorCandidates;
// SlotDuration determines the time interval (in milliseconds) between block production attempts.
// The value was changed from 12,000 ms to 6,000 ms to increase the block production rate.
// Ensure this change is intentional and update related documentation accordingly.

Copilot uses AI. Check for mistakes.

@lrazovic lrazovic changed the title fix: correct the migrations 🐛 Correct Async Backing migrations May 1, 2025
@dastansam dastansam force-pushed the 04-30-fix_correct_the_migrations branch from 296dcb6 to 91aa6fe Compare May 1, 2025 15:54
@dastansam dastansam force-pushed the 04-25-allow_transact branch from f61bdd5 to 9d1634a Compare May 1, 2025 15:54
@lrazovic lrazovic force-pushed the 04-25-allow_transact branch from 9d1634a to f61bdd5 Compare May 2, 2025 07:41
@lrazovic lrazovic force-pushed the 04-30-fix_correct_the_migrations branch from 91aa6fe to 296dcb6 Compare May 2, 2025 07:41
Copy link
Member Author

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:37 AM EDT: Graphite rebased this pull request as part of a merge.
  • May 2, 7:38 AM EDT: @lrazovic merged this pull request with Graphite.

@lrazovic lrazovic changed the base branch from 04-25-allow_transact to graphite-base/479 May 2, 2025 11:35
@lrazovic lrazovic changed the base branch from graphite-base/479 to main May 2, 2025 11:36
@lrazovic lrazovic force-pushed the 04-30-fix_correct_the_migrations branch from 296dcb6 to b1fe16c Compare May 2, 2025 11:37
@lrazovic lrazovic merged commit b8ecbf7 into main May 2, 2025
1 check passed
@lrazovic lrazovic deleted the 04-30-fix_correct_the_migrations branch May 2, 2025 11:38
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