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
+4,039
−406
Merged
Changes from 13 commits
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
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
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
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
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,35 @@ | ||
| [package] | ||
| name = "polkadot-dispute-distribution" | ||
| version = "0.1.0" | ||
| authors = ["Parity Technologies <[email protected]>"] | ||
| edition = "2018" | ||
|
|
||
| [dependencies] | ||
| futures = "0.3.15" | ||
| tracing = "0.1.26" | ||
| parity-scale-codec = { version = "2.0.0", features = ["std"] } | ||
| polkadot-primitives = { path = "../../../primitives" } | ||
| polkadot-erasure-coding = { path = "../../../erasure-coding" } | ||
| polkadot-subsystem = { package = "polkadot-node-subsystem", path = "../../subsystem" } | ||
| polkadot-node-network-protocol = { path = "../../network/protocol" } | ||
| polkadot-node-subsystem-util = { path = "../../subsystem-util" } | ||
| polkadot-node-primitives = { path = "../../primitives" } | ||
| polkadot-node-core-runtime-api = { path = "../../core/runtime-api" } | ||
| sp-application-crypto = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["std"] } | ||
| sp-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| thiserror = "1.0.23" | ||
| rand = "0.8.3" | ||
| lru = "0.6.5" | ||
|
|
||
| [dev-dependencies] | ||
| polkadot-subsystem-testhelpers = { package = "polkadot-node-subsystem-test-helpers", path = "../../subsystem-test-helpers" } | ||
| sp-core = { git = "https://github.com/paritytech/substrate", branch = "master", features = ["std"] } | ||
| sp-keyring = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sp-tracing = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| sc-network = {git = "https://github.com/paritytech/substrate", branch = "master" } | ||
| futures-timer = "3.0.2" | ||
| assert_matches = "1.4.0" | ||
| maplit = "1.0" | ||
| smallvec = "1.6.1" |
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,104 @@ | ||
| // 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/>. | ||
| // | ||
|
|
||
| //! Error handling related code and Error/Result definitions. | ||
|
|
||
| use thiserror::Error; | ||
|
|
||
| use polkadot_node_subsystem_util::{Fault, runtime, unwrap_non_fatal}; | ||
| use polkadot_subsystem::SubsystemError; | ||
|
|
||
| use crate::LOG_TARGET; | ||
| use crate::sender; | ||
|
|
||
| #[derive(Debug, Error)] | ||
| #[error(transparent)] | ||
| pub struct Error(pub Fault<NonFatal, Fatal>); | ||
eskimor marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| impl From<NonFatal> for Error { | ||
| fn from(e: NonFatal) -> Self { | ||
| Self(Fault::from_non_fatal(e)) | ||
| } | ||
| } | ||
|
|
||
| impl From<Fatal> for Error { | ||
| fn from(f: Fatal) -> Self { | ||
| Self(Fault::from_fatal(f)) | ||
| } | ||
| } | ||
|
|
||
| impl From<sender::Error> for Error { | ||
| fn from(e: sender::Error) -> Self { | ||
| match e.0 { | ||
| Fault::Fatal(f) => Self(Fault::Fatal(Fatal::Sender(f))), | ||
| Fault::Err(nf) => Self(Fault::Err(NonFatal::Sender(nf))), | ||
| } | ||
| } | ||
| } | ||
|
|
||
| /// Fatal errors of this subsystem. | ||
| #[derive(Debug, Error)] | ||
| pub enum Fatal { | ||
|
|
||
| /// Receiving subsystem message from overseer failed. | ||
| #[error("Receiving message from overseer failed")] | ||
| SubsystemReceive(#[source] SubsystemError), | ||
|
|
||
| /// Spawning a running task failed. | ||
| #[error("Spawning subsystem task failed")] | ||
| SpawnTask(#[source] SubsystemError), | ||
|
|
||
| /// DisputeSender mpsc receiver exhausted. | ||
| #[error("Erasure chunk requester stream exhausted")] | ||
| SenderExhausted, | ||
|
|
||
| #[error("Receive channel closed")] | ||
| IncomingMessageChannel(#[source] SubsystemError), | ||
|
|
||
| /// Errors coming from runtime::Runtime. | ||
| #[error("Error while accessing runtime information")] | ||
| Runtime(#[from] #[source] runtime::Fatal), | ||
|
|
||
| /// Errors coming from DisputeSender | ||
| #[error("Error while accessing runtime information")] | ||
| Sender(#[from] #[source] sender::Fatal), | ||
| } | ||
|
|
||
| /// Non-fatal errors of this subsystem. | ||
| #[derive(Debug, Error)] | ||
| pub enum NonFatal { | ||
| /// Errors coming from DisputeSender | ||
| #[error("Error while accessing runtime information")] | ||
| Sender(#[from] #[source] sender::NonFatal), | ||
| } | ||
|
|
||
| pub type Result<T> = std::result::Result<T, Error>; | ||
|
|
||
| pub type FatalResult<T> = std::result::Result<T, Fatal>; | ||
|
|
||
| /// Utility for eating top level errors and log them. | ||
| /// | ||
| /// We basically always want to try and continue on error. This utility function is meant to | ||
| /// consume top-level errors by simply logging them | ||
| pub fn log_error(result: Result<()>, ctx: &'static str) | ||
| -> std::result::Result<(), Fatal> | ||
| { | ||
| if let Some(error) = unwrap_non_fatal(result.map_err(|e| e.0))? { | ||
| tracing::warn!(target: LOG_TARGET, error = ?error, ctx); | ||
| } | ||
| Ok(()) | ||
| } | ||
Oops, something went wrong.
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.