-
Notifications
You must be signed in to change notification settings - Fork 20
Storage migration for pallet-xcm SafeXcmVersion constant #2422
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
Storage migration for pallet-xcm SafeXcmVersion constant #2422
Conversation
## Summary - add SAFE_XCM_VERSION constant for bridging - migrate pallet-xcm SafeXcmVersion during runtime upgrade - add tests for pre and post upgrade - bump spec_version
AGENTS.md
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This file is useful for testing with OpenAI's Codex, which is enabled as a research preview.
@@ -373,6 +373,14 @@ check-try-runtime-installed: | |||
try-runtime-create-snapshot-paseo-testnet: check-try-runtime-installed | |||
try-runtime create-snapshot --uri wss://0.rpc.testnet.amplica.io:443 testnet-paseo-all-pallets.state | |||
|
|||
try-runtime-create-snapshot-westend-testnet: check-try-runtime-installed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we change the RPC to not include the API key, then we can remove this check. Otherwise, being cautious and not checking in API keys.
|
||
// --- XCM Version --- | ||
#[cfg(feature = "frequency-bridging")] | ||
pub mod xcm_version { | ||
/// The default XCM version considered safe for the network. | ||
/// This is not the latest version, but the one that is considered stable and safe to use. | ||
/// It is used to ensure that the network can handle XCM messages without issues. | ||
pub const SAFE_XCM_VERSION: u32 = 4; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This can probably be moved to an xcm commmon or other, but don't want to step on other refactoring coming in soon.
@@ -17,6 +17,7 @@ | |||
//! Mock runtime for tests. | |||
//! Implements both runtime APIs for fee estimation and getting the messages for transfers. | |||
|
|||
use common_runtime::weights::rocksdb_weights::constants::RocksDbWeight; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updating for migration tests, which were returning 0 weight in all cases.
@@ -0,0 +1,93 @@ | |||
use super::*; | |||
use crate::xcm::tests::mock::{new_test_ext_with_balances, TestRuntime}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This mock runtime is enough to test storage migration for the SafeXcmVersion constant.
Codecov ReportAll modified and coverable lines are covered by tests ✅ 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
Adds a storage migration to initialize the XCM pallet’s SafeXcmVersion
and wires it into the runtime, along with tests and updated build targets for bridging.
- Implements
SetSafeXcmVersion
migration and accompanyingpre_upgrade
/post_upgrade
tests. - Introduces a new
SAFE_XCM_VERSION
constant and bumps the runtime spec versions. - Extends the Makefile with bridging and try-runtime targets, and adjusts startup scripts and test module visibility.
Reviewed Changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
File | Description |
---|---|
scripts/init.sh | Removed the --dev flag when starting frequency for bridging |
runtime/frequency/src/xcm/tests/mod.rs | Made the mock module public so it can be reused in new tests |
runtime/frequency/src/xcm/tests/mock.rs | Added RocksDbWeight import and set DbWeight for TestRuntime |
runtime/frequency/src/migration_tests.rs | New try-runtime migration tests for SafeXcmVersion |
runtime/frequency/src/lib.rs | Added SetSafeXcmVersion migration, updated Executive , bumped spec versions |
runtime/common/src/constants.rs | Defined SAFE_XCM_VERSION constant under frequency-bridging |
Makefile | Added bridging/try-runtime targets and --blocktime flags |
AGENTS.md | New contributor guidelines document |
Comments suppressed due to low confidence (1)
scripts/init.sh:189
- The
--dev
flag was removed, which may change the chain spec used by the node startup—re-add--dev
(or the intended--chain
argument) to ensure the local development environment is launched correctly.
./target/debug/frequency \
@@ -17,6 +17,7 @@ | |||
//! Mock runtime for tests. | |||
//! Implements both runtime APIs for fee estimation and getting the messages for transfers. | |||
|
|||
use common_runtime::weights::rocksdb_weights::constants::RocksDbWeight; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[nitpick] Importing and using production RocksDbWeight
in tests may tie test behavior to real database weights; consider defining a lightweight or stub weight implementation to keep tests deterministic and performant.
Copilot uses AI. Check for mistakes.
echo "Example: ONFINALITY_APIKEY=your-api-key-here make try-runtime-check-migrations-westend-testnet"; \ | ||
exit 1; \ | ||
fi | ||
try-runtime create-snapshot --uri wss://node-7330371704012918784.nv.onfinality.io/ws?apikey=$(ONFINALITY_APIKEY) testnet-paseo-all-pallets.state |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The snapshot filename testnet-paseo-all-pallets.state
appears to be for the Paseo network, not Westend; update it to the appropriate Westend state filename or URI to avoid confusion and ensure correct snapshot usage.
try-runtime create-snapshot --uri wss://node-7330371704012918784.nv.onfinality.io/ws?apikey=$(ONFINALITY_APIKEY) testnet-paseo-all-pallets.state | |
try-runtime create-snapshot --uri wss://node-7330371704012918784.nv.onfinality.io/ws?apikey=$(ONFINALITY_APIKEY) westend-testnet-all-pallets.state |
Copilot uses AI. Check for mistakes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 great!
…chain/frequency into 2401-bridge-storage-migration-needed-for-any-xcm-related-pallet-constants
be6fce7
into
feat/eth-bridging-development
This pull request introduces several changes to support bridging functionality. Key updates include adding new features for bridging pallets, extending Makefile targets for bridging-related builds and checks, and updating documentation and configuration files to reflect these additions.
Discussion
pallet_xcm::on_runtime_upgrade
and tests to correctly setSafeXcmVersion
.build-bridging-westend
,check-bridging
,try-runtime-check-migrations-westend-testnet
, etc.).Closes #2401
Testing
make start-bridging-westend-local
in a terminal.make try-rumtime-check-migrations-local
(pre and post checks) ormake try-runtime-check-migrations-none-local
(checks=none).Checklist