Skip to content

Conversation

@QuantumExplorer
Copy link
Member

@QuantumExplorer QuantumExplorer commented Jan 8, 2026

Issue being fixed or feature implemented

Removed the platform version patching and state migration logic to simplify the codebase and eliminate unused features.

What was done?

  • Deleted the apply_platform_version_patch_and_migrate_state_for_height method and related logic.
  • Removed the migrate_state_for_height function and its references.
  • Eliminated the patch_platform_version module and associated tests.
  • Cleaned up imports and code related to platform version patching.

How Has This Been Tested?

Existing tests were run to ensure that the removal did not introduce any regressions. The codebase compiles successfully.

Breaking Changes

None

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

Summary by CodeRabbit

  • Refactor

    • Removed the legacy platform-version patching subsystem and related state-patching logic.
    • Eliminated state migration routines that ran at specific block heights.
    • Simplified platform initialization to use the current protocol version directly (no patch-based version computation).
    • Removed patched-version tracking from platform state.
  • Tests

    • Removed tests and test modules covering patching and migration scenarios.

✏️ Tip: You can customize this high-level summary in your review settings.

@github-actions github-actions bot added this to the v3.0.0 milestone Jan 8, 2026
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 8, 2026

Warning

Rate limit exceeded

@QuantumExplorer has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 4 minutes and 15 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

📥 Commits

Reviewing files that changed from the base of the PR and between 0ef5b9e and e7b0ffe.

📒 Files selected for processing (1)
  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
📝 Walkthrough

Walkthrough

This PR removes platform version patching and height-based state migration code across the ABCI engine, platform state, and version modules, and deletes related tests and exports; remaining flows use existing protocol-version fields without applying patch-based overrides.

Changes

Cohort / File(s) Summary
Engine Execution Cleanup
packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs
Deleted logic that applied platform-version patches and ran migrations before block processing; now uses the previously computed block_platform_version directly.
Platform Event Handlers
packages/rs-drive-abci/src/execution/platform_events/block_start/mod.rs
Removed pub(in crate::execution) mod migrate_state; and pub(in crate::execution) mod patch_platform; declarations.
State Migration Implementation
packages/rs-drive-abci/src/execution/platform_events/block_start/migrate_state/mod.rs
Removed migrate_state_for_height(...) implementation and its imports/uses.
Patch Application Helper
packages/rs-drive-abci/src/execution/platform_events/block_start/patch_platform.rs
Removed apply_platform_version_patch_and_migrate_state_for_height(...) impl and associated code.
Platform State Patching (impls)
packages/rs-drive-abci/src/platform_types/platform_state/patch_platform_version.rs, packages/rs-drive-abci/src/platform_types/platform_state/mod.rs
Deleted patching implementation, removed PATCHED_PROTOCOL_VERSION tracking, removed patched_platform_version field from PlatformState, and removed module declaration.
Platform State Accessors
packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
Removed PlatformStateV0PrivateMethods trait and patched_platform_version() accessor; current_platform_version now derives directly from current_protocol_version_in_consensus().
Platform Construction
packages/rs-drive-abci/src/platform_types/platform/mod.rs
Changed open_with_client_saved_state signature to take an immutable platform_state; removed logic that computed/patched a platform version via patch helpers and now uses current_protocol_version_in_consensus() directly.
Platform Version API
packages/rs-platform-version/src/version/mod.rs, packages/rs-platform-version/src/version/patches/mod.rs
Removed public patches module export and deleted PatchFn, HeightToPatchRanges, and the PATCHES registry.
Tests — removals & tweaks
packages/rs-drive-abci/tests/strategy_tests/test_cases/mod.rs, packages/rs-drive-abci/tests/strategy_tests/test_cases/patch_platform_tests.rs, packages/rs-drive-abci/tests/strategy_tests/test_cases/upgrade_fork_tests.rs, packages/rs-drive-abci/tests/strategy_tests/test_cases/address_tests.rs
Removed patch_platform_tests module declaration and the entire patch_platform_tests.rs file; pruned/updropped a long epoch/upgrade test and some exports/imports; minor unused-binding rename in address_tests.rs.
PlatformState (serialization/saving conversions)
packages/rs-drive-abci/src/platform_types/platform_state/platform_state_for_saving/v0/mod.rs, .../v1/mod.rs
Removed setting patched_platform_version during conversions from saved states to PlatformState.
Other test import cleanups
packages/rs-dpp/src/state_transition/serialization.rs
Removed three unused test imports.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Poem

🐰 I hopped through code with curious eyes,
Found patchy paths and trimmed the ties.
No migrations now on the trail we tread—
Lighter hops forward, bugs left for dead. 🥕✨

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and accurately describes the main objective of the pull request: removing platform version patching and state migration logic. It is concise, specific, and directly reflects the primary changes made across the codebase.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Fix all issues with AI agents
In @packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs:
- Around line 53-56: The doc comment for current_platform_version still mentions
"or patched if present" but the function no longer checks for patches and simply
returns PlatformVersion::get(self.current_protocol_version_in_consensus());
update the doc comment to accurately describe behavior (e.g., "Get the current
platform version derived from the consensus protocol version") and remove any
mention of patching so the documentation matches the implementation.
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 006b3f4 and 0ef5b9e.

📒 Files selected for processing (5)
  • packages/rs-dpp/src/state_transition/serialization.rs
  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
  • packages/rs-drive-abci/src/platform_types/platform_state/mod.rs
  • packages/rs-drive-abci/src/platform_types/platform_state/platform_state_for_saving/v0/mod.rs
  • packages/rs-drive-abci/src/platform_types/platform_state/platform_state_for_saving/v1/mod.rs
💤 Files with no reviewable changes (4)
  • packages/rs-drive-abci/src/platform_types/platform_state/platform_state_for_saving/v1/mod.rs
  • packages/rs-dpp/src/state_transition/serialization.rs
  • packages/rs-drive-abci/src/platform_types/platform_state/platform_state_for_saving/v0/mod.rs
  • packages/rs-drive-abci/src/platform_types/platform_state/mod.rs
🧰 Additional context used
📓 Path-based instructions (1)
**/*.rs

📄 CodeRabbit inference engine (CLAUDE.md)

**/*.rs: Rust code must pass cargo clippy --workspace linter checks
Rust code must be formatted using cargo fmt --all

**/*.rs: Use 4-space indent for Rust files
Follow rustfmt defaults and keep code clippy-clean for Rust modules
Use snake_case for Rust module names
Use PascalCase for Rust type names
Use SCREAMING_SNAKE_CASE for Rust constants

Files:

  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
🧠 Learnings (9)
📓 Common learnings
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2227
File: packages/rs-drive-abci/src/platform_types/platform_state/mod.rs:141-141
Timestamp: 2024-10-08T13:28:03.529Z
Learning: When converting `PlatformStateV0` to `PlatformStateForSavingV1` in `packages/rs-drive-abci/src/platform_types/platform_state/mod.rs`, only version `0` needs to be handled in the match on `platform_state_for_saving_structure_default` because the changes are retroactive.
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:119-120
Timestamp: 2024-10-06T16:18:07.994Z
Learning: In the `run_block_proposal` function in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, it's acceptable to pass `platform_state` to `perform_events_on_first_block_of_protocol_change`, even if `block_platform_state` has been updated.
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-06T16:17:34.571Z
Learning: In `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, when retrieving `last_block_time_ms`, it's acceptable to use `platform_state` instead of `block_platform_state`, even after updating the protocol version.
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, when retrieving `last_block_time_ms`, it's acceptable to use `platform_state` instead of `block_platform_state`, even after updating the protocol version.
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2257
File: packages/rs-drive-abci/src/mimic/test_quorum.rs:159-164
Timestamp: 2024-11-20T16:16:01.830Z
Learning: QuantumExplorer prefers not to receive auto-generated messages asking to post on social media.
📚 Learning: 2024-10-08T13:28:03.529Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2227
File: packages/rs-drive-abci/src/platform_types/platform_state/mod.rs:141-141
Timestamp: 2024-10-08T13:28:03.529Z
Learning: When converting `PlatformStateV0` to `PlatformStateForSavingV1` in `packages/rs-drive-abci/src/platform_types/platform_state/mod.rs`, only version `0` needs to be handled in the match on `platform_state_for_saving_structure_default` because the changes are retroactive.

Applied to files:

  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
📚 Learning: 2024-10-06T16:17:34.571Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:105-105
Timestamp: 2024-10-06T16:17:34.571Z
Learning: In `run_block_proposal` in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, when retrieving `last_block_time_ms`, it's acceptable to use `platform_state` instead of `block_platform_state`, even after updating the protocol version.

Applied to files:

  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
📚 Learning: 2024-11-20T10:01:50.837Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2257
File: packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs:94-94
Timestamp: 2024-11-20T10:01:50.837Z
Learning: In `packages/rs-drive-abci/src/platform_types/platform_state/v0/old_structures/mod.rs`, when converting with `PublicKey::try_from`, it's acceptable to use `.expect()` to handle potential conversion errors.

Applied to files:

  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
📚 Learning: 2024-10-06T16:18:07.994Z
Learnt from: QuantumExplorer
Repo: dashpay/platform PR: 2215
File: packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs:119-120
Timestamp: 2024-10-06T16:18:07.994Z
Learning: In the `run_block_proposal` function in `packages/rs-drive-abci/src/execution/engine/run_block_proposal/mod.rs`, it's acceptable to pass `platform_state` to `perform_events_on_first_block_of_protocol_change`, even if `block_platform_state` has been updated.

Applied to files:

  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
📚 Learning: 2024-10-03T11:51:06.980Z
Learnt from: shumkov
Repo: dashpay/platform PR: 2201
File: packages/rs-platform-version/src/version/v2.rs:1186-1188
Timestamp: 2024-10-03T11:51:06.980Z
Learning: In the `IdentityTransitionVersions` structure within `packages/rs-platform-version/src/version/v2.rs`, the field `credit_withdrawal` does not need the `identity_` prefix since it is already encompassed within identity state transitions.

Applied to files:

  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
📚 Learning: 2024-10-18T15:39:51.172Z
Learnt from: lklimek
Repo: dashpay/platform PR: 2254
File: packages/rs-sdk/src/sdk.rs:585-585
Timestamp: 2024-10-18T15:39:51.172Z
Learning: The 'platform' project uses Rust version 1.80, so code in 'packages/rs-sdk' can use features available in Rust 1.80, such as the `abs_diff()` method.

Applied to files:

  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
📚 Learning: 2024-10-09T00:22:57.778Z
Learnt from: shumkov
Repo: dashpay/platform PR: 2206
File: packages/rs-drive-abci/tests/strategy_tests/main.rs:1162-1162
Timestamp: 2024-10-09T00:22:57.778Z
Learning: In the Rust test file `packages/rs-drive-abci/tests/strategy_tests/main.rs`, specific protocol versions like `PROTOCOL_VERSION_1` are intentionally used in tests instead of `PROTOCOL_VERSION_LATEST`.

Applied to files:

  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
📚 Learning: 2024-11-22T08:19:14.448Z
Learnt from: shumkov
Repo: dashpay/platform PR: 2345
File: packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs:93-99
Timestamp: 2024-11-22T08:19:14.448Z
Learning: In `packages/rs-drive-abci/src/execution/platform_events/protocol_upgrade/perform_events_on_first_block_of_protocol_change/v0/mod.rs`, the `insert_contract` method requires an owned `BlockInfo`, so cloning `block_info` is necessary when calling it.

Applied to files:

  • packages/rs-drive-abci/src/platform_types/platform_state/accessors.rs
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
  • GitHub Check: Rust packages (drive) / Tests
  • GitHub Check: Rust packages (drive-abci) / Check each feature
  • GitHub Check: Rust packages (wasm-dpp2) / Tests
  • GitHub Check: Rust packages (drive-abci) / Tests
  • GitHub Check: Rust packages (drive-abci) / Linting
  • GitHub Check: Rust packages (dpp) / Check each feature
  • GitHub Check: Build Docker images (Dashmate helper, dashmate-helper, dashmate-helper) / Build Dashmate helper image
  • GitHub Check: Build Docker images (RS-DAPI, rs-dapi, rs-dapi) / Build RS-DAPI image
  • GitHub Check: Build Docker images (Drive, drive, drive-abci, SDK_TEST_DATA=true
    ) / Build Drive image
  • GitHub Check: Build JS packages / Build JS

@QuantumExplorer QuantumExplorer changed the title feat: remove platform version patching and state migration logic feat(platform): remove platform version patching and state migration logic Jan 8, 2026
Copy link
Collaborator

@shumkov shumkov left a comment

Choose a reason for hiding this comment

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

👍

@QuantumExplorer QuantumExplorer merged commit 632b3f1 into v3.0-dev Jan 8, 2026
99 of 101 checks passed
@QuantumExplorer QuantumExplorer deleted the featremove-platform-version-patching branch January 8, 2026 08:07
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.

3 participants