Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

General Message Queue Pallet #12485

Merged
merged 128 commits into from
Dec 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
206a7af
The message queue
gavofyork Oct 12, 2022
f0bdf13
Make fully generic
gavofyork Oct 12, 2022
236804a
Refactor
gavofyork Oct 12, 2022
2d8ff13
Docs
gavofyork Oct 12, 2022
afcf587
Refactor
gavofyork Oct 12, 2022
c8c82e0
Use iter not slice
gavofyork Oct 12, 2022
5e48ae3
Per-origin queues
gavofyork Oct 12, 2022
2e5bff8
Multi-queue processing
gavofyork Oct 12, 2022
3839045
Introduce MaxReady
gavofyork Oct 25, 2022
2bfe229
Remove MaxReady in favour of ready ring
gavofyork Oct 27, 2022
283366b
Cleanups
gavofyork Oct 27, 2022
76a5c81
ReadyRing and tests
gavofyork Oct 27, 2022
ef3faaf
Stale page reaping
gavofyork Oct 29, 2022
8fa3619
Merge remote-tracking branch 'origin/master' into gav-message-queue
ggwpez Oct 29, 2022
975c903
from_components -> from_parts
ggwpez Oct 29, 2022
fd19a63
Move WeightCounter to sp_weights
ggwpez Oct 29, 2022
58c6c02
Add MockedWeightInfo
ggwpez Oct 29, 2022
560f994
Deploy to kitchensink
ggwpez Oct 29, 2022
56d0003
Use WeightCounter
ggwpez Oct 29, 2022
4371fa2
Small fixes and logging
ggwpez Oct 29, 2022
7db583f
Add service_page
ggwpez Oct 30, 2022
84ce78e
Typo
ggwpez Oct 30, 2022
5bded12
Move service_page below service_queue
ggwpez Oct 30, 2022
77f375f
Add service_message
ggwpez Oct 30, 2022
04d1698
Use correct weight function
ggwpez Oct 30, 2022
16b4a8f
Overweight execution
gavofyork Nov 1, 2022
9c52b8a
Merge branch 'gav-message-queue' of github.com:paritytech/substrate i…
gavofyork Nov 1, 2022
522fd65
Refactor
gavofyork Nov 2, 2022
250a678
Missing file
gavofyork Nov 2, 2022
126a3ad
Fix WeightCounter usage in scheduler
ggwpez Nov 2, 2022
4a03e25
Fix peek_index
ggwpez Nov 2, 2022
91b694d
Add tests and bench service_page_item
ggwpez Nov 2, 2022
fa78eba
Merge remote-tracking branch 'origin/gav-message-queue' into gav-mess…
ggwpez Nov 2, 2022
702fc99
Add debug_info
ggwpez Nov 4, 2022
06d4916
Add no-progress check to service_queues
ggwpez Nov 4, 2022
3364491
Add more benches
ggwpez Nov 4, 2022
c991ff5
Bound from_message and try_append_message
ggwpez Nov 4, 2022
496188d
Add PageReaped event
ggwpez Nov 4, 2022
ae42857
Rename BookStateOf and BookStateFor
ggwpez Nov 4, 2022
6950ba1
Update tests and remove logging
ggwpez Nov 4, 2022
44286af
Remove redundant per-message origins; add footprint() and sweep_queue()
gavofyork Nov 7, 2022
3b69fa4
Move testing stuff to mock.rs
ggwpez Nov 7, 2022
9669c06
Add integration test
ggwpez Nov 7, 2022
e8e2726
Fix no-progress check
ggwpez Nov 7, 2022
6f1af35
Fix debug_info
ggwpez Nov 7, 2022
a3ed0b3
Merge remote-tracking branch 'origin/gav-message-queue' into gav-mess…
ggwpez Nov 7, 2022
b52cd25
Fixup merge and tests
ggwpez Nov 7, 2022
cf39c9a
Fix footprint tracking
gavofyork Nov 10, 2022
2f46318
Introduce
gavofyork Nov 11, 2022
0fabd9c
Formatting
gavofyork Nov 11, 2022
74d5fb3
OverweightEnqueued event, auto-servicing config item
gavofyork Nov 12, 2022
3959364
Update tests and benchmarks
ggwpez Nov 13, 2022
674563d
Clippy
ggwpez Nov 13, 2022
c5c3589
Add tests
ggwpez Nov 13, 2022
d8ee5d7
Merge remote-tracking branch 'origin/master' into gav-message-queue
gavofyork Nov 14, 2022
e554362
Provide change handler
gavofyork Nov 14, 2022
25d2c06
Add missing BookStateFor::insert and call QueueChangeHandler
ggwpez Nov 15, 2022
22fe899
Docs
ggwpez Nov 15, 2022
e650ae8
Update benchmarks and weights
ggwpez Nov 15, 2022
a1917e2
More tests...
ggwpez Nov 15, 2022
c99f26d
Use weight metering functions
ggwpez Nov 15, 2022
7bbb863
weightInfo::process_message_payload is gone
ggwpez Nov 15, 2022
ba2f2fe
Merge remote-tracking branch 'origin/master' into gav-message-queue
ggwpez Nov 15, 2022
1b114dc
Add defensive_saturating_accrue
ggwpez Nov 15, 2022
efdbc3a
Rename WeightCounter to WeightMeter
ggwpez Nov 15, 2022
5059afa
Test on_initialize
ggwpez Nov 15, 2022
4e55aa1
Add module docs
ggwpez Nov 21, 2022
3f7031c
Merge remote-tracking branch 'origin/master' into gav-message-queue
ggwpez Nov 21, 2022
a27593e
Remove origin from MaxMessageLen
ggwpez Nov 21, 2022
ce8f656
Add BoundedVec::as_slice
ggwpez Nov 21, 2022
6506430
Test Page::{from_message, try_append_message}
ggwpez Nov 21, 2022
0edd21d
Fixup docs
ggwpez Nov 22, 2022
0ba2bb8
Docs
gavofyork Nov 22, 2022
73c7e49
Do nothing in sweep_queue if the queue does not exist
ggwpez Nov 22, 2022
4717fc3
Test ring (un)knitting
ggwpez Nov 22, 2022
a6ead94
Upgrade stress-test
ggwpez Nov 22, 2022
bcee3f7
More tests...
ggwpez Nov 22, 2022
8277caf
Beauty fixes
ggwpez Nov 22, 2022
89fa01f
Merge remote-tracking branch 'origin/master' into gav-message-queue
ggwpez Nov 22, 2022
2961ccf
clippy
ggwpez Nov 22, 2022
b593d7b
Rename BoundedVec::as_slice to as_bounded_slice
ggwpez Nov 22, 2022
3524b68
Fix imports
ggwpez Nov 22, 2022
4e81171
Remove ReadyRing struct
ggwpez Nov 23, 2022
1653fba
Beauty fixes
ggwpez Nov 23, 2022
b7b9f26
Fix stale page watermark
ggwpez Nov 23, 2022
5a377f6
Cleanup
ggwpez Nov 23, 2022
bdf63cc
Fix test feature and clippy
ggwpez Nov 23, 2022
09dc712
QueueChanged handler is called correctly
ggwpez Nov 24, 2022
a6063ed
Update benches
ggwpez Nov 24, 2022
1f102a9
Abstract testing functions
ggwpez Nov 24, 2022
f10a302
More tests
ggwpez Nov 24, 2022
b4c31eb
Cleanup
ggwpez Nov 24, 2022
7cb2e51
Clippy
ggwpez Nov 24, 2022
b1e139b
fmt
ggwpez Nov 24, 2022
eb209e2
Simplify tests
ggwpez Nov 24, 2022
d319aad
Make stuff compile
ggwpez Nov 24, 2022
5654425
Merge remote-tracking branch 'origin/master' into gav-message-queue
ggwpez Nov 24, 2022
d2d2640
Merge remote-tracking branch 'origin/master' into gav-message-queue
Nov 25, 2022
136a521
Extend overweight execution benchmark
ggwpez Nov 28, 2022
8cafb2c
Remove TODOs
ggwpez Nov 28, 2022
02e2a7c
Test service queue with faulty MessageProcessor
ggwpez Nov 28, 2022
f5b60c1
Merge remote-tracking branch 'origin/master' into gav-message-queue
ggwpez Nov 28, 2022
42636e5
fmt
ggwpez Nov 28, 2022
71152a8
Update pallet ui tests to 1.65
ggwpez Nov 28, 2022
567ccb2
More docs
ggwpez Nov 28, 2022
48c338c
Review doc fixes
ggwpez Nov 30, 2022
281da1f
Merge remote-tracking branch 'origin/master' into gav-message-queue
ggwpez Nov 30, 2022
5652c2b
Merge remote-tracking branch 'origin/master' into gav-message-queue
Nov 30, 2022
617b0c9
Add weight_limit to extrinsic weight of execute_overweight
KiChjang Dec 2, 2022
3fb292d
Merge remote-tracking branch 'origin/master' into gav-message-queue
Dec 5, 2022
15ad9e8
Correctly return unused weight
KiChjang Dec 6, 2022
ba0999e
Return actual weight consumed in do_execute_overweight
KiChjang Dec 6, 2022
3cb51c1
Review fixes
ggwpez Dec 8, 2022
e6d3bb5
Merge remote-tracking branch 'origin/master' into gav-message-queue
ggwpez Dec 8, 2022
ad80875
Set version 7.0.0-dev
ggwpez Dec 8, 2022
25e3ae6
Make it compile
ggwpez Dec 8, 2022
eb1c0db
Switch message_size to u64
ggwpez Dec 8, 2022
3b0bf6a
Switch message_count to u64
ggwpez Dec 8, 2022
5013e86
Fix benchmarks
ggwpez Dec 8, 2022
865f493
Make CI green
ggwpez Dec 8, 2022
281f61e
Merge branch 'gav-message-queue' of github.com:paritytech/substrate i…
gavofyork Dec 8, 2022
b291e5d
Docs
gavofyork Dec 8, 2022
41fdf07
Update tests
ggwpez Dec 8, 2022
e0e32a2
Merge branch 'master' of https://github.com/paritytech/substrate into…
Dec 8, 2022
be6d5c9
".git/.scripts/bench-bot.sh" pallet dev pallet_message_queue
Dec 8, 2022
f08e055
Dont mention README.md in the Cargo.toml
ggwpez Dec 9, 2022
b4feb05
Remove reference to readme
gavofyork Dec 9, 2022
93010af
Merge branch 'gav-message-queue' of github.com:paritytech/substrate i…
gavofyork Dec 9, 2022
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
40 changes: 32 additions & 8 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ members = [
"frame/offences/benchmarking",
"frame/preimage",
"frame/proxy",
"frame/message-queue",
"frame/nomination-pools",
"frame/nomination-pools/fuzzer",
"frame/nomination-pools/benchmarking",
Expand Down
4 changes: 4 additions & 0 deletions bin/node/runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ pallet-indices = { version = "4.0.0-dev", default-features = false, path = "../.
pallet-identity = { version = "4.0.0-dev", default-features = false, path = "../../../frame/identity" }
pallet-lottery = { version = "4.0.0-dev", default-features = false, path = "../../../frame/lottery" }
pallet-membership = { version = "4.0.0-dev", default-features = false, path = "../../../frame/membership" }
pallet-message-queue = { version = "7.0.0-dev", default-features = false, path = "../../../frame/message-queue" }
pallet-mmr = { version = "4.0.0-dev", default-features = false, path = "../../../frame/merkle-mountain-range" }
pallet-multisig = { version = "4.0.0-dev", default-features = false, path = "../../../frame/multisig" }
pallet-nomination-pools = { version = "1.0.0", default-features = false, path = "../../../frame/nomination-pools"}
Expand Down Expand Up @@ -150,6 +151,7 @@ std = [
"sp-inherents/std",
"pallet-lottery/std",
"pallet-membership/std",
"pallet-message-queue/std",
"pallet-mmr/std",
"pallet-multisig/std",
"pallet-nomination-pools/std",
Expand Down Expand Up @@ -229,6 +231,7 @@ runtime-benchmarks = [
"pallet-indices/runtime-benchmarks",
"pallet-lottery/runtime-benchmarks",
"pallet-membership/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-mmr/runtime-benchmarks",
"pallet-multisig/runtime-benchmarks",
"pallet-nomination-pools-benchmarking/runtime-benchmarks",
Expand Down Expand Up @@ -282,6 +285,7 @@ try-runtime = [
"pallet-identity/try-runtime",
"pallet-lottery/try-runtime",
"pallet-membership/try-runtime",
"pallet-message-queue/try-runtime",
"pallet-mmr/try-runtime",
"pallet-multisig/try-runtime",
"pallet-nomination-pools/try-runtime",
Expand Down
21 changes: 21 additions & 0 deletions bin/node/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1135,6 +1135,25 @@ impl pallet_bounties::Config for Runtime {
type ChildBountyManager = ChildBounties;
}

parameter_types! {
/// Allocate at most 20% of each block for message processing.
///
/// Is set to 20% since the scheduler can already consume a maximum of 80%.
pub MessageQueueServiceWeight: Option<Weight> = Some(Perbill::from_percent(20) * RuntimeBlockWeights::get().max_block);
}

impl pallet_message_queue::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type WeightInfo = ();
/// NOTE: Always set this to `NoopMessageProcessor` for benchmarking.
type MessageProcessor = pallet_message_queue::mock_helpers::NoopMessageProcessor;
type Size = u32;
type QueueChangeHandler = ();
type HeapSize = ConstU32<{ 64 * 1024 }>;
type MaxStale = ConstU32<128>;
type ServiceWeight = MessageQueueServiceWeight;
}

parameter_types! {
pub const ChildBountyValueMinimum: Balance = 1 * DOLLARS;
}
Expand Down Expand Up @@ -1699,6 +1718,7 @@ construct_runtime!(
RankedPolls: pallet_referenda::<Instance2>,
RankedCollective: pallet_ranked_collective,
FastUnstake: pallet_fast_unstake,
MessageQueue: pallet_message_queue,
}
);

Expand Down Expand Up @@ -1793,6 +1813,7 @@ mod benches {
[pallet_indices, Indices]
[pallet_lottery, Lottery]
[pallet_membership, TechnicalMembership]
[pallet_message_queue, MessageQueue]
[pallet_mmr, Mmr]
[pallet_multisig, Multisig]
[pallet_nomination_pools, NominationPoolsBench::<Runtime>]
Expand Down
53 changes: 53 additions & 0 deletions frame/message-queue/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
[package]
authors = ["Parity Technologies <admin@parity.io>"]
edition = "2021"
name = "pallet-message-queue"
version = "7.0.0-dev"
license = "Apache-2.0"
ggwpez marked this conversation as resolved.
Show resolved Hide resolved
homepage = "https://substrate.io"
repository = "https://github.com/paritytech/substrate/"
description = "FRAME pallet to queue and process messages"

[dependencies]
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
scale-info = { version = "2.1.2", default-features = false, features = ["derive"] }
serde = { version = "1.0.137", optional = true, features = ["derive"] }
log = { version = "0.4.17", default-features = false }

sp-core = { version = "7.0.0", default-features = false, path = "../../primitives/core" }
sp-io = { version = "7.0.0", default-features = false, path = "../../primitives/io" }
sp-runtime = { version = "7.0.0", default-features = false, path = "../../primitives/runtime" }
sp-std = { version = "5.0.0", default-features = false, path = "../../primitives/std" }
sp-arithmetic = { version = "6.0.0", default-features = false, path = "../../primitives/arithmetic" }
sp-weights = { version = "4.0.0", default-features = false, path = "../../primitives/weights" }

frame-benchmarking = { version = "4.0.0-dev", default-features = false, optional = true, path = "../benchmarking" }
frame-support = { version = "4.0.0-dev", default-features = false, path = "../support" }
frame-system = { version = "4.0.0-dev", default-features = false, path = "../system" }

[dev-dependencies]
sp-tracing = { version = "6.0.0", path = "../../primitives/tracing" }
rand = "0.8.5"
rand_distr = "0.4.3"

[features]
default = ["std"]
std = [
"codec/std",
"scale-info/std",
"sp-core/std",
"sp-io/std",
"sp-runtime/std",
"sp-std/std",
"sp-arithmetic/std",
"sp-weights/std",
"frame-benchmarking?/std",
"frame-support/std",
"frame-system/std",
]
runtime-benchmarks = [
"frame-benchmarking/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
]
try-runtime = ["frame-support/try-runtime"]
Loading