Skip to content
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

pallet-child-bounties index child bounty by parent bounty #6255

Merged
merged 41 commits into from
Nov 6, 2024

Conversation

davidk-pt
Copy link
Contributor

@davidk-pt davidk-pt commented Oct 28, 2024

Resolves #5929

Migrates ChildBountyDescriptions to be indexed instead of unique child bounty id unique per all child bounties in the pallet to be unique per every parent bounty.

Migrates (ParentBounty, ChildBounty) keys inside ChildBounties storage item to use new ChildBounty ids starting from 0.

@paritytech/frame-coders

polkadot/runtime/rococo/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/child-bounties/src/lib.rs Show resolved Hide resolved
substrate/frame/child-bounties/src/lib.rs Show resolved Hide resolved
substrate/frame/child-bounties/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/child-bounties/src/migration.rs Outdated Show resolved Hide resolved
substrate/frame/child-bounties/src/migration.rs Outdated Show resolved Hide resolved
@muharem
Copy link
Contributor

muharem commented Oct 30, 2024

@joepetrowski it seems like we have to update the ids of the active child bounties. if this has too big impact, we can make child_id = total_child_count + total_child_count_per_parent. but I would prefer to not do it, to not leave this legacy.

changing chain bounty id, also means changed account ids. but the account ids should change anyway. or we need to have two different ways of deriving account ids depending on child bounty id > SOME_ID.

@davidk-pt
Copy link
Contributor Author

davidk-pt commented Nov 4, 2024

Tried migration on kusama

Details
[2024-11-04T10:42:54Z INFO  frame_support::migrations] 🚚 Pallet "ChildBounties" VersionedMigration migrating storage version from 0 to 1.
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Migrating 23 child bounties
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 20 child bounty id 1430->0
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 20 child bounty id 1452->1
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 20 child bounty id 1416->2
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 20 child bounty id 1440->3
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1183->0
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1311->1
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1043->2
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1301->3
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1472->4
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1473->5
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1474->6
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1310->7
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1309->8
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1475->9
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1312->10
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1463->0
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1465->1
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1178->2
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1296->3
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1095->4
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1467->5
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1027->6
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1306->7
[2024-11-04T10:42:54Z INFO  runtime::child-bounties] Migration done, reads: 46, writes: 115
...
[2024-11-04T10:42:54Z WARN  frame_support::migrations] 🚚 Pallet "ChildBounties" VersionedMigration migration 0->1 can be removed; on-chain is already at StorageVersion(1).
[2024-11-04T10:43:00Z INFO  runtime::executive] ✅ Entire runtime state decodes without error. 209472151 bytes total.
[2024-11-04T10:43:00Z INFO  try-runtime::cli] PoV size (zstd-compressed compact proof): 45.1 KB. For parachains, it's your responsibility to verify that a PoV of this size fits within any relaychain constraints.
[2024-11-04T10:43:00Z INFO  try-runtime::cli] Consumed ref_time: 0.01638997s (0.82% of max 2s)
[2024-11-04T10:43:00Z INFO  try-runtime::cli] ✅ No weight safety issues detected. Please note this does not guarantee a successful runtime upgrade. Always test your runtime upgrade with recent state, and ensure that the weight usage of your migrations will not drastically differ between testing and actual on-chain execution.

@davidk-pt
Copy link
Contributor Author

davidk-pt commented Nov 4, 2024

Tried migration on polkadot

Details
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Migrating 76 child bounties
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 37 child bounty id 1995->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 37 child bounty id 2007->1
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 37 child bounty id 1039->2
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 33 child bounty id 2128->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 33 child bounty id 2127->1
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1169->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 43 child bounty id 2310->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 43 child bounty id 2309->1
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2188->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1426->1
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2190->2
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1657->3
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2197->4
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1662->5
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2186->6
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2196->7
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1851->8
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1001->9
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2195->10
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1860->11
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1855->12
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1158->13
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 24 child bounty id 2237->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 24 child bounty id 1732->1
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 24 child bounty id 1431->2
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 24 child bounty id 1966->3
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 24 child bounty id 1972->4
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 22 child bounty id 2260->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2010->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2286->1
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2287->2
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2135->3
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2295->4
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2291->5
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2276->6
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2301->7
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2282->8
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2288->9
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2292->10
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2302->11
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2307->12
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2096->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2098->1
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1911->2
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1905->3
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1880->4
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2082->5
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2083->6
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1916->7
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2113->8
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1882->9
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2072->10
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1915->11
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2114->12
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1896->13
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2115->14
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1906->15
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1881->16
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2112->17
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1903->18
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1867->19
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2107->20
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2091->21
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1874->22
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2101->23
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1914->24
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2074->25
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 2158->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 1704->1
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 2273->2
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 1845->3
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 1835->4
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 2270->5
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 1776->6
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 2144->7
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Remapped parent bounty 50 child bounty id 2245->0
[2024-11-04T10:45:27Z INFO  runtime::child-bounties] Migration done, reads: 152, writes: 380
...
[2024-11-04T10:45:28Z WARN  frame_support::migrations] 🚚 Pallet "ChildBounties" VersionedMigration migration 0->1 can be removed; on-chain is already at StorageVersion(1).
[2024-11-04T10:45:41Z INFO  runtime::executive] ✅ Entire runtime state decodes without error. 341111730 bytes total.
[2024-11-04T10:45:43Z INFO  try-runtime::cli] PoV size (zstd-compressed compact proof): 206.5 KB. For parachains, it's your responsibility to verify that a PoV of this size fits within any relaychain constraints.
[2024-11-04T10:45:43Z INFO  try-runtime::cli] Consumed ref_time: 0.84111315s (42.06% of max 2s)
[2024-11-04T10:45:43Z INFO  try-runtime::cli] ✅ No weight safety issues detected. Please note this does not guarantee a successful runtime upgrade. Always test your runtime upgrade with recent state, and ensure that the weight usage of your migrations will not drastically differ between testing and actual on-chain execution.

@davidk-pt
Copy link
Contributor Author

After running migrations on kusama/polkadot, they're migrated in non deterministic order, maybe we wan't to order migrations vector first before processing it? At least this way new reassigned child bounty ids will preserve previous order

@muharem @joepetrowski

@davidk-pt
Copy link
Contributor Author

davidk-pt commented Nov 4, 2024

Kusama migration after sorting

Details
[2024-11-04T10:54:00Z INFO  frame_support::migrations] 🚚 Pallet "ChildBounties" VersionedMigration migrating storage version from 0 to 1.
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Migrating 23 child bounties
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1043->0
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1183->1
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1301->2
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1309->3
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1310->4
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1311->5
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1312->6
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1472->7
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1473->8
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1474->9
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1475->10
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 20 child bounty id 1416->0
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 20 child bounty id 1430->1
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 20 child bounty id 1440->2
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 20 child bounty id 1452->3
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1027->0
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1095->1
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1178->2
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1296->3
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1306->4
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1463->5
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1465->6
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Remapped parent bounty 25 child bounty id 1467->7
[2024-11-04T10:54:00Z INFO  runtime::child-bounties] Migration done, reads: 46, writes: 115

@davidk-pt
Copy link
Contributor Author

davidk-pt commented Nov 4, 2024

Polkadot migration after sorting keys

Details
[2024-11-04T10:54:59Z INFO  frame_support::migrations] 🚚 Pallet "ChildBounties" VersionedMigration migrating storage version from 0 to 1.
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Migrating 76 child bounties
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2010->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2135->1
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2276->2
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2282->3
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2286->4
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2287->5
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2288->6
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2291->7
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2292->8
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2295->9
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2301->10
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2302->11
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 11 child bounty id 2307->12
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 19 child bounty id 1169->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 22 child bounty id 2260->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 24 child bounty id 1431->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 24 child bounty id 1732->1
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 24 child bounty id 1966->2
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 24 child bounty id 1972->3
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 24 child bounty id 2237->4
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1001->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1158->1
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1426->2
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1657->3
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1662->4
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1851->5
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1855->6
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 1860->7
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2186->8
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2188->9
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2190->10
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2195->11
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2196->12
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 31 child bounty id 2197->13
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1867->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1874->1
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1880->2
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1881->3
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1882->4
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1896->5
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1903->6
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1905->7
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1906->8
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1911->9
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1914->10
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1915->11
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 1916->12
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2072->13
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2074->14
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2082->15
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2083->16
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2091->17
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2096->18
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2098->19
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2101->20
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2107->21
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2112->22
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2113->23
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2114->24
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 32 child bounty id 2115->25
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 33 child bounty id 2127->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 33 child bounty id 2128->1
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 37 child bounty id 1039->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 37 child bounty id 1995->1
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 37 child bounty id 2007->2
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 1704->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 1776->1
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 1835->2
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 1845->3
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 2144->4
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 2158->5
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 2270->6
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 42 child bounty id 2273->7
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 43 child bounty id 2309->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 43 child bounty id 2310->1
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Remapped parent bounty 50 child bounty id 2245->0
[2024-11-04T10:54:59Z INFO  runtime::child-bounties] Migration done, reads: 152, writes: 380
[2024-11-04T10:54:59Z INFO  pallet_child_bounties::migration::v1] old child bounty descriptions: 76

@davidk-pt davidk-pt changed the title WIP: Main implementation of child bounty index by parent bounty pallet-child-bounties index child bounty by parent bounty Nov 4, 2024
@davidk-pt davidk-pt marked this pull request as ready for review November 4, 2024 11:05
@davidk-pt davidk-pt requested a review from a team as a code owner November 4, 2024 11:05
@davidk-pt davidk-pt added the T1-FRAME This PR/Issue is related to core FRAME, the framework. label Nov 4, 2024
@muharem
Copy link
Contributor

muharem commented Nov 4, 2024

After running migrations on kusama/polkadot, they're migrated in non deterministic order, maybe we wan't to order migrations vector first before processing it? At least this way new reassigned child bounty ids will preserve previous order

@muharem @joepetrowski

yes, we want he previous order

Copy link
Member

@ggwpez ggwpez left a comment

Choose a reason for hiding this comment

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

Looks very good. Maybe you can also write a small test for this, but i see that it has to merge by tomorrow to do into the release 😅

substrate/frame/child-bounties/src/lib.rs Show resolved Hide resolved
#[pallet::storage]
pub type ChildBountyDescriptions<T: Config> =
StorageMap<_, Twox64Concat, BountyIndex, BoundedVec<u8, T::MaximumReasonLength>>;
pub type ChildBountyDescriptionsV1<T: Config> = StorageDoubleMap<
Copy link
Member

Choose a reason for hiding this comment

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

I see this a bit as an experiment. Lets see if this actually helps block explorers, since we never did it like this.
Normally we just replace the definition 🙈

substrate/frame/child-bounties/src/lib.rs Outdated Show resolved Hide resolved
substrate/frame/child-bounties/src/lib.rs Show resolved Hide resolved
substrate/frame/child-bounties/src/lib.rs Show resolved Hide resolved
Pallet<T>,
Twox64Concat,
BountyIndex,
BoundedVec<u8, <T as pallet_bounties::Config>::MaximumReasonLength>,
Copy link
Member

Choose a reason for hiding this comment

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

I think it should be fine to use aWeakBoundedVec here, just in case when someone decreases MaximumReasonLength at the same time as applying the migration. Their encodings should be identical.

@muharem
Copy link
Contributor

muharem commented Nov 5, 2024

Looks very good. Maybe you can also write a small test for this, but i see that it has to merge by tomorrow to do into the release 😅

I updated tests to use U256 and added an integrity test for account id derivation

muharem and others added 2 commits November 5, 2024 21:49
@muharem muharem added this pull request to the merge queue Nov 5, 2024
doc:
- audience: Runtime Dev
description: |
Index child bounties by their parent bounty, ensuring that their indexes are independent of
Copy link
Contributor

@xlc xlc Nov 6, 2024

Choose a reason for hiding this comment

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

IMO the description isn't super clear. Say a opensquare team member looking at this, how do they suppose to know what exactly they need to do without actually read all the code in this PR?

Copy link
Contributor

Choose a reason for hiding this comment

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

updated

@muharem muharem removed this pull request from the merge queue due to a manual request Nov 6, 2024
Copy link
Contributor

@xlc xlc left a comment

Choose a reason for hiding this comment

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

before upgrades, someone need to check there are no ongoing bounty topup proposal

@@ -716,7 +752,7 @@ pub mod pallet {
});

// Remove the child-bounty description.
ChildBountyDescriptions::<T>::remove(child_bounty_id);
ChildBountyDescriptionsV1::<T>::remove(parent_bounty_id, child_bounty_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

do we not need to remove from old description?

@xlc
Copy link
Contributor

xlc commented Nov 6, 2024

I am a bit unsure about this. Yes it fixes a problem. But it did not fix all the problems yet introducing a breaking change. I personally prefer fix all the problems at once to minimize number of breaking changes we need to make.

@muharem
Copy link
Contributor

muharem commented Nov 6, 2024

I am a bit unsure about this. Yes it fixes a problem. But it did not fix all the problems yet introducing a breaking change. I personally prefer fix all the problems at once to minimize number of breaking changes we need to make.

the only problem that is left is bounty proposals with different asset kinds. we plan to implement it with XCM. but we wont make it to the next polkadot-sdk release which will be cut tomorrow. this is why I wanna merge this now. The bounty::approve_with_curator call is already in master. I believe these changes will be helpful.

@muharem muharem added this pull request to the merge queue Nov 6, 2024
Merged via the queue into master with commit a479161 Nov 6, 2024
195 of 197 checks passed
@muharem muharem deleted the davidk/index-child-bounties-by-parent-bounty branch November 6, 2024 02:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T1-FRAME This PR/Issue is related to core FRAME, the framework.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Child Bounty Pallet: chain bounty index grouped by parent bounty
4 participants