This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Dispute distribution implementation #3282
Merged
Merged
Changes from 1 commit
Commits
Show all changes
67 commits
Select commit
Hold shift + click to select a range
8c83835
Dispute protocol.
eskimor 125dd32
Dispute distribution protocol.
eskimor 2c395e5
Get network requests routed.
eskimor 7c53c69
WIP: Basic dispute sender logic.
eskimor 0bd8713
Basic validator determination logic.
eskimor 608f84c
WIP: Getting things to typecheck.
eskimor a78fbc9
Slightly larger timeout.
eskimor 53f0c15
More typechecking stuff.
eskimor 6abf1f3
Cleanup.
eskimor b541062
Finished most of the sending logic.
eskimor 5883c08
Handle active leaves updates
eskimor 4c4e3a7
Pass sessions in already.
eskimor bd8bb95
Startup dispute sending.
eskimor 4ebe127
Provide incoming decoding facilities
eskimor 95351bd
Relaxed runtime util requirements.
eskimor 863b1d9
Better usability of incoming requests.
eskimor 35d2cad
Add basic receiver functionality.
eskimor da8abac
Cleanup + fixes for sender.
eskimor c997aed
One more sender fix.
eskimor 06770db
Start receiver.
eskimor 2378c7e
Make sure to send responses back.
eskimor 3910cf4
WIP: Exposed authority discovery
eskimor 840a046
Merge branch 'master' into rk-dispute-distribution-impl
eskimor 5b10c78
Make tests pass.
eskimor d2aa4ff
Fully featured receiver.
eskimor da4955d
Decrease cost of `NotAValidator`.
eskimor 1fc9740
Make `RuntimeInfo` LRU cache size configurable.
eskimor 9397e35
Cache more sessions.
eskimor ccbab3f
Fix collator protocol.
eskimor 5db60d3
Disable metrics for now.
eskimor da20774
Make dispute-distribution a proper subsystem.
eskimor f9da3ae
Fix naming.
eskimor 2231dc3
Code style fixes.
eskimor 41c2801
Factored out 4x copied mock function.
eskimor 3e91427
WIP: Tests.
eskimor 8a3da18
Whitespace cleanup.
eskimor 0b188cd
Accessor functions.
eskimor 2637c1b
More testing.
eskimor 3d09d48
More Debug instances.
eskimor def8772
Fix busy loop.
eskimor c7cdca9
Working tests.
eskimor b9f20c2
More tests.
eskimor 6f7da40
Merge branch 'master' into rk-dispute-distribution-impl
eskimor b3c7427
Cleanup.
eskimor c01d8d1
Fix build.
eskimor 4f616d6
Basic receiving test.
eskimor a3ff6ae
Non validator message gets dropped.
eskimor 217bd7e
More receiving tests.
eskimor 26b8b00
Test nested and subsequent imports.
eskimor 5dd7c84
Fix spaces.
eskimor 488fb47
Better formatted imports.
eskimor 92ff4be
Import cleanup.
eskimor 7d5f416
Metrics.
eskimor 04f91e9
Message -> MuxedMessage
eskimor d43fb5f
Message -> MuxedMessage
eskimor dc6d0f1
Merge branch 'master' into rk-dispute-distribution-impl
eskimor fc6a612
More review remarks.
eskimor 2907a53
Add missing metrics.rs.
eskimor 1f7ce88
Fix flaky test.
eskimor cd66550
Dispute coordinator - deliver confirmations.
eskimor fd920a1
Send out `DisputeMessage` on issue local statement.
eskimor 90b46f4
Merge branch 'master' into rk-dispute-distribution-impl
eskimor 210b853
Unwire dispute distribution.
eskimor 58b1bee
Review remarks.
eskimor 59c76c8
Review remarks.
eskimor 3cd91cb
Better docs.
eskimor dedbaa8
Merge branch 'master' into rk-dispute-distribution-impl
eskimor File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add missing metrics.rs.
- Loading branch information
commit 2907a5348c57ef59cf7676446e38ac7eebf7c875
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| // Copyright 2021 Parity Technologies (UK) Ltd. | ||
| // This file is part of Polkadot. | ||
|
|
||
| // Polkadot is free software: you can redistribute it and/or modify | ||
| // it under the terms of the GNU General Public License as published by | ||
| // the Free Software Foundation, either version 3 of the License, or | ||
| // (at your option) any later version. | ||
|
|
||
| // Polkadot is distributed in the hope that it will be useful, | ||
| // but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
| // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| // GNU General Public License for more details. | ||
|
|
||
| // You should have received a copy of the GNU General Public License | ||
| // along with Polkadot. If not, see <http://www.gnu.org/licenses/>. | ||
|
|
||
| use polkadot_node_subsystem_util::metrics::prometheus::{Counter, U64, Registry, PrometheusError, CounterVec, Opts}; | ||
| use polkadot_node_subsystem_util::metrics::prometheus; | ||
| use polkadot_node_subsystem_util::metrics; | ||
|
|
||
| /// Label for success counters. | ||
| pub const SUCCEEDED: &'static str = "succeeded"; | ||
|
|
||
| /// Label for fail counters. | ||
| pub const FAILED: &'static str = "failed"; | ||
|
|
||
| /// Dispute Distribution metrics. | ||
| #[derive(Clone, Default)] | ||
| pub struct Metrics(Option<MetricsInner>); | ||
|
|
||
| #[derive(Clone)] | ||
| struct MetricsInner { | ||
| /// Number of sent dispute requests (succeeded and failed). | ||
| sent_requests: CounterVec<U64>, | ||
|
|
||
| /// Number of requests received. | ||
| /// | ||
| /// This is all requests coming in, regardless of whether they are processed or dropped. | ||
| received_requests: Counter<U64>, | ||
|
|
||
| /// Number of requests for which `ImportStatements` returned. | ||
| /// | ||
| /// We both have success full imports and failed imports here. | ||
| imported_requests: CounterVec<U64>, | ||
| } | ||
|
|
||
| impl Metrics { | ||
| /// Create new dummy metrics, not reporting anything. | ||
| pub fn new_dummy() -> Self { | ||
| Metrics(None) | ||
| } | ||
|
|
||
| /// Increment counter on finished request sending. | ||
| pub fn on_sent_request(&self, label: &'static str) { | ||
| if let Some(metrics) = &self.0 { | ||
| metrics.sent_requests.with_label_values(&[label]).inc() | ||
| } | ||
| } | ||
|
|
||
| /// Increment counter on served chunks. | ||
| pub fn on_received_request(&self) { | ||
| if let Some(metrics) = &self.0 { | ||
| metrics.received_requests.inc() | ||
| } | ||
| } | ||
|
|
||
| /// Statements have been imported. | ||
| pub fn on_imported(&self, label: &'static str) { | ||
| if let Some(metrics) = &self.0 { | ||
| metrics.imported_requests.with_label_values(&[label]).inc() | ||
| } | ||
| } | ||
| } | ||
|
|
||
| impl metrics::Metrics for Metrics { | ||
| fn try_register(registry: &Registry) -> Result<Self, PrometheusError> { | ||
| let metrics = MetricsInner { | ||
| sent_requests: prometheus::register( | ||
| CounterVec::new( | ||
| Opts::new( | ||
| "parachain_dispute_distribution_sent_requests", | ||
| "Total number of sent requests.", | ||
| ), | ||
| &["success"] | ||
| )?, | ||
| registry, | ||
| )?, | ||
| received_requests: prometheus::register( | ||
| Counter::new( | ||
| "parachain_dispute_distribution_received_requests", | ||
| "Total number of received dispute requests.", | ||
| )?, | ||
| registry, | ||
| )?, | ||
| imported_requests: prometheus::register( | ||
| CounterVec::new( | ||
| Opts::new( | ||
| "parachain_dispute_distribution_imported_requests", | ||
| "Total number of imported requests.", | ||
| ), | ||
| &["success"] | ||
| )?, | ||
| registry, | ||
| )?, | ||
| }; | ||
| Ok(Metrics(Some(metrics))) | ||
| } | ||
| } | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.