Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
281 changes: 281 additions & 0 deletions .substrate-mcp/polkadot-upgrade/stable2506/TRACKING.md

Large diffs are not rendered by default.

141 changes: 141 additions & 0 deletions .substrate-mcp/polkadot-upgrade/stable2506/pr_3811.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
# PR #3811 Analysis: Implicit chill when full unbonding in pallet_staking

## PR Information
- **PR Doc**: [pr_3811.prdoc](/Users/manuelmauro/.substrate-mcp/moonbeam/releases/stable2506/pr-docs/pr_3811.prdoc)
- **GitHub PR**: [#3811](https://github.com/paritytech/polkadot-sdk/pull/3811)
- **PR Title**: Full Unbond in Staking
- **PR Labels**: T2-pallets
- **Affected Crate**: pallet-staking (minor bump)

## Impact Assessment
- **Initial Sentiment**: INHERITED
- **Confidence Level**: HIGH

## Summary
This PR modifies the `unbond` extrinsic in `pallet-staking` to automatically chill validators/nominators when they unbond their entire stake. This is a behavioral improvement that eliminates the need for users to make separate `chill` and `unbond` calls when fully exiting staking.

## Analysis

### Affected Components
- **Relay Chain (Polkadot/Kusama/Westend)**: pallet-staking behavior change
- **Moonbeam Runtime**: No direct impact (does not use pallet-staking)
- **Relay Encoder System**: Used for encoding XCM staking calls to relay chains

### Changes Detected in polkadot-sdk

**From PR #3811**:

1. **substrate/frame/staking/src/pallet/mod.rs**:
- Modified `unbond` extrinsic to include implicit chill weight calculation
- Updated documentation: "The stash may be chilled if the ledger total amount falls to 0 after unbonding"
- Refactored to use new `do_unbond()` helper function

2. **substrate/frame/staking/src/pallet/impls.rs**:
- New `do_unbond()` internal function extracts unbonding logic
- Implicit chill now occurs when `unbond_value >= ledger.total`
- Automatically removes validator/nominator from active set when fully unbonding

3. **substrate/frame/staking/src/tests.rs**:
- New test `unbond_with_chill_works()` validates implicit chilling behavior
- Other tests updated to remove explicit chill calls before full unbond

### Project Impact

**Moonbeam's Relay Encoder Usage**:

Moonbeam provides relay staking functionality through:
- `/Users/manuelmauro/Workspace/moonbeam/runtime/relay-encoder/src/polkadot.rs:L51` - `Unbond` enum variant
- `/Users/manuelmauro/Workspace/moonbeam/runtime/relay-encoder/src/kusama.rs:L50` - `Unbond` enum variant
- `/Users/manuelmauro/Workspace/moonbeam/runtime/relay-encoder/src/westend.rs:L51` - `Unbond` enum variant
- `/Users/manuelmauro/Workspace/moonbeam/precompiles/relay-encoder/src/lib.rs:L103-123` - `encode_unbond()` function

**No Code Changes Required**:
- The `unbond` extrinsic signature is unchanged (still takes a single `value` parameter)
- Moonbeam's encoding functions continue to work identically
- The behavioral change occurs entirely on the relay chain after the encoded call is executed

**User Experience Improvement**:
- Users staking via Moonbeam's relay encoder who fully unbond will now automatically be chilled
- Previously required: `encode_chill()` + `encode_unbond(full_amount)`
- Now automatic: `encode_unbond(full_amount)` handles both operations
- Backward compatible: partial unbonds continue to work as before

## Evidence & References

### From PR (polkadot-sdk)

**API Signature (unchanged)**:
```rust
// substrate/frame/staking/src/pallet/mod.rs
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::unbond() + T::WeightInfo::chill())]
pub fn unbond(origin: OriginFor<T>, #[pallet::compact] value: BalanceOf<T>) -> DispatchResult
```

**New Behavior**:
```rust
// substrate/frame/staking/src/pallet/impls.rs (new do_unbond function)
// If unbonding the full amount, automatically chill the stash
if unbond_value >= ledger.total {
Self::chill_stash(&stash)?;
}
```

### From Project (moonbeam)

**Encoding Functions (no changes needed)**:
```rust
// /Users/manuelmauro/Workspace/moonbeam/runtime/relay-encoder/src/polkadot.rs:L137-138
xcm_primitives::AvailableStakeCalls::Unbond(a) => {
RelayCall::Stake(StakeCall::Unbond(a)).encode()
}
```

**Precompile Interface (no changes needed)**:
```rust
// /Users/manuelmauro/Workspace/moonbeam/precompiles/relay-encoder/src/lib.rs:L103-123
#[precompile::public("encodeUnbond(uint256)")]
fn encode_unbond(handle: &mut impl PrecompileHandle, amount: U256) -> EvmResult<UnboundedBytes> {
let relay_amount = u256_to_relay_amount(amount)?;
let encoded = pallet_xcm_transactor::Pallet::<Runtime>::encode_call(
AvailableStakeCalls::Unbond(relay_amount),
).as_slice().into();
Ok(encoded)
}
```

## Migration Guide

**No migration required** - this change is automatically inherited through dependency updates.

### Optional Documentation Updates

While no code changes are needed, consider updating user-facing documentation:

1. **Relay Encoder Documentation**: Clarify that `encode_unbond()` with full bonded amount now automatically chills the validator/nominator
2. **Staking Guides**: Update any guides that instruct users to call `chill` before fully unbonding
3. **API Documentation**: Note the improved UX where full unbond operations no longer require separate chill calls

### Testing Recommendations

1. Verify that full unbond operations via XCM correctly chill validators on relay chains
2. Test that partial unbond operations continue to work as expected (no chill)
3. Confirm weight calculations remain accurate with the implicit chill operation

## Additional Context

**Why This is INHERITED**:
- No API changes requiring code modifications in Moonbeam
- Behavioral improvement happens on relay chain (Polkadot/Kusama/Westend)
- Moonbeam's relay encoder is a pass-through mechanism
- Change is backward compatible and improves UX for end users
- Automatically received through polkadot-sdk dependency update

**User Benefit**:
- Simplifies the unstaking process for users
- Reduces transaction costs (fewer extrinsics needed)
- Eliminates potential user confusion about needing to chill before unbonding

## Conclusion

PR #3811 introduces a behavioral improvement to relay chain staking that Moonbeam automatically benefits from without requiring any code changes. The relay encoder functionality continues to work identically, while users gain improved UX through implicit chilling during full unbond operations.
226 changes: 226 additions & 0 deletions .substrate-mcp/polkadot-upgrade/stable2506/pr_5620.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,226 @@
# PR #5620 Impact Analysis: New NFT Traits

## Executive Summary

**Impact Level: NONE**

PR #5620 introduces new NFT trait abstractions in `frame-support` and implements them for `pallet-uniques`. This is a purely additive change that has **no impact** on Moonbeam as the project does not use NFT-related functionality from Substrate.

## PR Overview

**Title:** New NFT traits: granular and abstract interface

**Labels:** T1-FRAME

**Affected Crates:**
- `frame-support` (minor bump)
- `pallet-uniques` (minor bump)

**Description:**
This PR introduces a new `asset_ops` module within `frame_support::traits::tokens` that provides granular, abstract trait interfaces for NFT operations. The new abstractions support both general and XCM contexts while addressing limitations in existing v1 and v2 nonfungible traits.

### Key Changes

1. **New Module:** Added `frame_support::traits::tokens::asset_ops` with operations:
- `Create` - Create new NFT collections/items
- `Inspect` - Query NFT state
- `UpdateValue` - Modify NFT attributes
- `Destroy` - Remove NFTs
- `Stash` - Temporary NFT storage
- `Restore` - Recover stashed NFTs

2. **Strategy Pattern:** Multiple implementations of the same operation with helpers like `CheckState`, `CheckOrigin`, `ChangeOwnerFrom`, `Owned`, `WithConfig`

3. **Naming Improvements:**
- `Unchecked` → `NoParams` for clarity
- `Update` → `UpdateValue`
- `IsConfigValue` → `ConfigValueMarker`

4. **Implementation:** Applied new traits to `pallet-uniques` for collections and items

### Compatibility Notes

This is an **additive change** - introduces new traits without modifying existing v1/v2 nonfungible interfaces. No breaking changes to existing code.

## Impact Analysis

### Moonbeam NFT/Asset Usage

**Finding: Moonbeam does NOT use NFT-related Substrate functionality**

Evidence from codebase search:

```bash
# Search for pallet-uniques
grep -r "pallet-uniques\|pallet_uniques" .
# Result: No files found

# Search for NFT traits usage
grep -r "nonfungible\|nonfungibles\|asset_ops" .
# Result: No matches found

# Search for NFT/nft keywords in dependencies
grep -r "nft\|NFT" **/Cargo.toml
# Result: No files found
```

### Runtime Configuration Analysis

Examined all three Moonbeam runtime variants:
- `/Users/manuelmauro/Workspace/moonbeam/runtime/moonbeam/src/lib.rs` (Polkadot)
- `/Users/manuelmauro/Workspace/moonbeam/runtime/moonriver/src/lib.rs` (Kusama)
- `/Users/manuelmauro/Workspace/moonbeam/runtime/moonbase/src/lib.rs` (Westend)

**None include `pallet-uniques` or any NFT-related pallets in `construct_runtime!`**

Moonbeam's runtime pallets focus on:
- EVM compatibility (pallet-evm, pallet-ethereum)
- Parachain functionality (ParachainSystem, XcmpQueue, PolkadotXcm)
- Staking (ParachainStaking)
- Governance (Referenda, ConvictionVoting, Treasury)
- Foreign assets (EvmForeignAssets)

### Custom Pallet Analysis

Examined Moonbeam's custom pallets:
```
/Users/manuelmauro/Workspace/moonbeam/pallets/
├── parachain-staking
├── crowdloan-rewards
├── moonbeam-foreign-assets
├── moonbeam-orbiters
├── moonbeam-lazy-migrations
├── xcm-transactor
├── xcm-weight-trader
├── ethereum-xcm
├── erc20-xcm-bridge
├── proxy-genesis-companion
└── precompile-benchmarks
```

**No custom pallets use NFT traits** - verified via:
```bash
grep -r "nonfungible\|asset_ops\|tokens::nft" /Users/manuelmauro/Workspace/moonbeam/pallets/
# Result: No files found
```

### frame-support Token Trait Usage

While Moonbeam extensively uses `frame-support`, token trait usage is limited to **fungible tokens only**:

**File:** `/Users/manuelmauro/Workspace/moonbeam/runtime/common/src/deal_with_fees.rs`
```rust
use frame_support::traits::tokens::imbalance::ResolveTo;
```

**File:** `/Users/manuelmauro/Workspace/moonbeam/precompiles/collective/src/mock.rs`
```rust
use frame_support::traits::tokens::{PayFromAccount, UnityAssetBalanceConversion};
```

**File:** `/Users/manuelmauro/Workspace/moonbeam/runtime/common/src/impl_multiasset_paymaster.rs`
```rust
fn check_payment(_id: Self::Id) -> frame_support::traits::tokens::PaymentStatus {
frame_support::traits::tokens::PaymentStatus::Success
}
```

All usage relates to:
- `fungible::*` traits
- `imbalance::*` traits
- Payment and balance conversion utilities

**No usage of `nonfungible` or `nonfungibles` traits found anywhere in the codebase.**

### Dependency Analysis

**File:** `/Users/manuelmauro/Workspace/moonbeam/Cargo.toml`
```toml
frame-support = {
git = "https://github.com/moonbeam-foundation/polkadot-sdk",
branch = "moonbeam-polkadot-stable2503",
default-features = false
}
```

While `frame-support` is a workspace dependency used throughout Moonbeam (40+ references across pallets, precompiles, and runtimes), the minor version bump for NFT functionality is:
- **Additive only** - new traits in new module
- **Non-breaking** - existing v1/v2 traits unchanged
- **No migration required** - doesn't affect existing code

## Technical Details

### Changed Substrate Components

| Component | Change Type | Moonbeam Usage |
|-----------|-------------|----------------|
| `frame_support::traits::tokens::asset_ops` | New module | Not used |
| `pallet-uniques` | Implementation update | Not included in runtime |
| NFT trait interfaces | New traits added | Not referenced |

### API Changes

**New Public APIs (not used by Moonbeam):**
- `asset_ops::Create` trait
- `asset_ops::Inspect` trait
- `asset_ops::UpdateValue` trait
- `asset_ops::Destroy` trait
- `asset_ops::Stash` trait
- `asset_ops::Restore` trait

**No existing APIs modified** - this is purely additive.

## Risk Assessment

### Breaking Changes
**NONE** - This PR is explicitly additive and maintains backward compatibility.

### Build Impact
**NONE** - No compilation changes expected:
- Moonbeam doesn't import affected modules
- No trait bound changes in used components
- Minor version bump is purely additive

### Runtime Impact
**NONE** - No runtime changes required:
- No storage migrations needed
- No pallet configuration changes
- No genesis configuration updates

### Migration Requirements
**NONE** - No action required.

## Recommendations

### Immediate Actions
**No action required** - This PR can be safely included in the stable2506 upgrade without any modifications to Moonbeam code.

### Future Considerations

1. **If Moonbeam decides to add NFT functionality in the future:**
- Consider using the new `asset_ops` traits for granular control
- Evaluate `pallet-uniques` vs `pallet-nfts` for NFT collections
- New traits provide better XCM integration for cross-chain NFTs

2. **For developers building on Moonbeam:**
- NFT functionality is typically implemented via ERC-721/ERC-1155 on the EVM side
- Substrate-native NFT pallets are not currently part of Moonbeam's architecture
- This maintains focus on Ethereum compatibility

## Conclusion

PR #5620 introduces valuable new NFT trait abstractions for the Substrate ecosystem but has **zero impact** on Moonbeam. The changes are:

✅ Additive only (no breaking changes)
✅ In components Moonbeam doesn't use (pallet-uniques)
✅ In trait modules Moonbeam doesn't import (nonfungible traits)
✅ Compatible with Moonbeam's EVM-first architecture

**Verdict:** Safe to include in stable2506 upgrade with no code changes required.

---

**Analysis Date:** 2025-10-22
**Analyzed By:** Claude Code
**Moonbeam Branch:** master (commit d67d222bb3)
**Target Upgrade:** stable2506
Loading
Loading