Skip to content

Staking V3#1611

Merged
aurexav merged 21 commits intomainfrom
xavier/staking-v3
Nov 12, 2024
Merged

Staking V3#1611
aurexav merged 21 commits intomainfrom
xavier/staking-v3

Conversation

@aurexav
Copy link
Member

@aurexav aurexav commented Oct 16, 2024

  • Remove all unused storage
  • Simplify election & reward logic
  • Use on_idle to distribute reward in background
  • Use on_idle to migrate un-migrated accounts in background
  • Benchmark
  • Migration

Closes:

@aurexav aurexav marked this pull request as draft October 16, 2024 09:32
@aurexav aurexav marked this pull request as ready for review October 21, 2024 04:48
@boundless-forest boundless-forest self-requested a review October 21, 2024 05:08
@aurexav aurexav added Bk-Storage [Break] This changes Storage; next release should be major. Bk-API [Break] This changes API; next release should be major. S-Need Audit PR contains changes to fund-managing logic that should be properly reviewed and externally audited C-Pallet [Component] Something about pallet C-Runtime [Component] Something about runtime labels Oct 21, 2024
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@aurexav aurexav mentioned this pull request Oct 22, 2024
* Account migration adaptation

Signed-off-by: Xavier Lau <x@acg.box>

* Limit tasks

---------

Signed-off-by: Xavier Lau <x@acg.box>
@aurexav aurexav added S-Audited [Security] Audited and removed S-Need Audit PR contains changes to fund-managing logic that should be properly reviewed and externally audited labels Oct 30, 2024
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

Signed-off-by: Xavier Lau <x@acg.box>
@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions

This comment has been minimized.

@github-actions
Copy link

Check 298afe2 darwinia-dev

Check runtime version

Check runtime storage

@github-actions
Copy link

Check 298afe2 crab-dev

Check runtime version

Check runtime storage

@github-actions
Copy link

Check 298afe2 koi-dev

Check runtime version

RuntimeVersion {
    spec_name: "Darwinia Koi",
    impl_name: "DarwiniaOfficialRust",
    authoring_version: 0,
-   spec_version: 6710,
+   spec_version: 6720,
    impl_version: 0,
    transaction_version: 0,
    state_version: 0,
}

Check runtime storage

Pallet DarwiniaStaking
+ Entry: StorageEntryMetadata { name: "AuthoredBlockCount", modifier: Default, ty: Plain(UntrackedSymbol { id: 371, marker: PhantomData<fn() -> core::any::TypeId> }), default: [0, 0, 0, 0, 0], docs: [" Number of blocks authored by the collator within current session."] }
- Entry: StorageEntryMetadata { name: "AuthoredBlocksCount", modifier: Default, ty: Plain(UntrackedSymbol { id: 377, marker: PhantomData<fn() -> core::any::TypeId> }), default: [0, 0, 0, 0, 0], docs: [" Number of blocks authored by the collator within current session."] }
- Entry: StorageEntryMetadata { name: "CacheStates", modifier: Default, ty: Plain(UntrackedSymbol { id: 372, marker: PhantomData<fn() -> core::any::TypeId> }), default: [0, 1, 2], docs: [" Collator/Exposure cache states.", "", " To avoid extra DB RWs during new session, such as:", " ```nocompile", " previous = current;", " current = next;", " next = elect();", " ```", "", " Now, with data:", " ```nocompile", " cache1 == previous;", " cache2 == current;", " cache3 == next;", " ```", " Just need to shift the marker and write the storage map once:", " ```nocompile", " mark(cache3, current);", " mark(cache2, previous);", " mark(cache1, next);", " cache1 = elect();", " ```"] }
- Entry: StorageEntryMetadata { name: "Collators", modifier: Optional, ty: Map { hashers: [Twox64Concat], key: UntrackedSymbol { id: 0, marker: PhantomData<fn() -> core::any::TypeId> }, value: UntrackedSymbol { id: 42, marker: PhantomData<fn() -> core::any::TypeId> } }, default: [0], docs: [" The map from (wannabe) collator to the preferences of that collator."] }
- Entry: StorageEntryMetadata { name: "CollatorsCache0", modifier: Default, ty: Plain(UntrackedSymbol { id: 74, marker: PhantomData<fn() -> core::any::TypeId> }), default: [0], docs: [" Exposure cache 0."] }
- Entry: StorageEntryMetadata { name: "CollatorsCache1", modifier: Default, ty: Plain(UntrackedSymbol { id: 74, marker: PhantomData<fn() -> core::any::TypeId> }), default: [0], docs: [" Exposure cache 1."] }
- Entry: StorageEntryMetadata { name: "CollatorsCache2", modifier: Default, ty: Plain(UntrackedSymbol { id: 74, marker: PhantomData<fn() -> core::any::TypeId> }), default: [0], docs: [" Exposure cache 2."] }
- Entry: StorageEntryMetadata { name: "ExposureCache0", modifier: Optional, ty: Map { hashers: [Twox64Concat], key: UntrackedSymbol { id: 0, marker: PhantomData<fn() -> core::any::TypeId> }, value: UntrackedSymbol { id: 374, marker: PhantomData<fn() -> core::any::TypeId> } }, default: [0], docs: [" Exposure cache 0."] }
- Entry: StorageEntryMetadata { name: "ExposureCache1", modifier: Optional, ty: Map { hashers: [Twox64Concat], key: UntrackedSymbol { id: 0, marker: PhantomData<fn() -> core::any::TypeId> }, value: UntrackedSymbol { id: 374, marker: PhantomData<fn() -> core::any::TypeId> } }, default: [0], docs: [" Exposure cache 1."] }
- Entry: StorageEntryMetadata { name: "ExposureCache2", modifier: Optional, ty: Map { hashers: [Twox64Concat], key: UntrackedSymbol { id: 0, marker: PhantomData<fn() -> core::any::TypeId> }, value: UntrackedSymbol { id: 374, marker: PhantomData<fn() -> core::any::TypeId> } }, default: [0], docs: [" Exposure cache 2."] }
+ Entry: StorageEntryMetadata { name: "Ledgers", modifier: Optional, ty: Map { hashers: [Blake2_128Concat], key: UntrackedSymbol { id: 0, marker: PhantomData<fn() -> core::any::TypeId> }, value: UntrackedSymbol { id: 369, marker: PhantomData<fn() -> core::any::TypeId> } }, default: [0], docs: [" All staking ledgers."] }
- Entry: StorageEntryMetadata { name: "Ledgers", modifier: Optional, ty: Map { hashers: [Blake2_128Concat], key: UntrackedSymbol { id: 0, marker: PhantomData<fn() -> core::any::TypeId> }, value: UntrackedSymbol { id: 370, marker: PhantomData<fn() -> core::any::TypeId> } }, default: [0], docs: [" All staking ledgers."] }
- Entry: StorageEntryMetadata { name: "MigrationStartPoint", modifier: Default, ty: Plain(UntrackedSymbol { id: 6, marker: PhantomData<fn() -> core::any::TypeId> }), default: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], docs: [" Migration start point."] }
- Entry: StorageEntryMetadata { name: "Nominators", modifier: Optional, ty: Map { hashers: [Twox64Concat], key: UntrackedSymbol { id: 0, marker: PhantomData<fn() -> core::any::TypeId> }, value: UntrackedSymbol { id: 0, marker: PhantomData<fn() -> core::any::TypeId> } }, default: [0], docs: [" The map from nominator to their nomination preferences, namely the collator that", " they wish to support."] }
- Entry: StorageEntryMetadata { name: "RateLimit", modifier: Default, ty: Plain(UntrackedSymbol { id: 6, marker: PhantomData<fn() -> core::any::TypeId> }), default: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], docs: [" Rate limit.", "", " The maximum amount of RING that can be staked or unstaked in one session."] }
- Entry: StorageEntryMetadata { name: "RateLimitState", modifier: Default, ty: Plain(UntrackedSymbol { id: 381, marker: PhantomData<fn() -> core::any::TypeId> }), default: [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], docs: [" Rate limit state.", "", " Tracks the rate limit state in a session."] }

@aurexav aurexav merged commit e9e1155 into main Nov 12, 2024
@aurexav aurexav deleted the xavier/staking-v3 branch November 12, 2024 06:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bk-API [Break] This changes API; next release should be major. Bk-Storage [Break] This changes Storage; next release should be major. C-Pallet [Component] Something about pallet C-Runtime [Component] Something about runtime S-Audited [Security] Audited

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants