Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Prev Previous commit
cargo fmt
  • Loading branch information
eskimor committed Aug 18, 2021
commit 72b24cd77e5bfac5952f889bb2f6068ee7fa6ec9
50 changes: 14 additions & 36 deletions node/core/dispute-coordinator/src/dummy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,18 +16,14 @@

//! Implements the dispute coordinator subsystem (dummy implementation).

use std::{
sync::Arc,
};
use std::sync::Arc;

use polkadot_node_subsystem::{
errors::{ChainApiError, RuntimeApiError},
messages::DisputeCoordinatorMessage,
overseer, FromOverseer, OverseerSignal, SpawnedSubsystem, SubsystemContext, SubsystemError,
};
use polkadot_primitives::v1::{
BlockNumber,
};
use polkadot_primitives::v1::BlockNumber;

use futures::{channel::oneshot, prelude::*};
use kvdb::KeyValueDB;
Expand All @@ -40,11 +36,9 @@ const LOG_TARGET: &str = "parachain::dispute-coordinator";
type Timestamp = u64;

#[derive(Eq, PartialEq)]
enum Participation {
}
enum Participation {}

struct State {
}
struct State {}

/// Configuration for the dispute coordinator subsystem.
#[derive(Debug, Clone, Copy)]
Expand All @@ -54,13 +48,12 @@ pub struct Config {
}

/// An implementation of the dispute coordinator subsystem.
pub struct DisputeCoordinatorSubsystem {
}
pub struct DisputeCoordinatorSubsystem {}

impl DisputeCoordinatorSubsystem {
/// Create a new instance of the subsystem.
pub fn new(_: Arc<dyn KeyValueDB>, _: Config, _: Arc<LocalKeystore>) -> Self {
DisputeCoordinatorSubsystem { }
DisputeCoordinatorSubsystem {}
}
}

Expand Down Expand Up @@ -179,10 +172,8 @@ impl DisputeStatus {
}
}

async fn run<Context>(
subsystem: DisputeCoordinatorSubsystem,
mut ctx: Context,
) where
async fn run<Context>(subsystem: DisputeCoordinatorSubsystem, mut ctx: Context)
where
Context: overseer::SubsystemContext<Message = DisputeCoordinatorMessage>,
Context: SubsystemContext<Message = DisputeCoordinatorMessage>,
{
Expand Down Expand Up @@ -212,30 +203,25 @@ where
Context: overseer::SubsystemContext<Message = DisputeCoordinatorMessage>,
Context: SubsystemContext<Message = DisputeCoordinatorMessage>,
{
let mut state = State {
};
let mut state = State {};

loop {
match ctx.recv().await? {
FromOverseer::Signal(OverseerSignal::Conclude) => return Ok(()),
FromOverseer::Signal(OverseerSignal::ActiveLeaves(_)) => {},
FromOverseer::Signal(OverseerSignal::BlockFinalized(_, _)) => {},
FromOverseer::Communication { msg } =>
handle_incoming(ctx, &mut state, msg).await?,
FromOverseer::Communication { msg } => handle_incoming(ctx, &mut state, msg).await?,
}
}
}


async fn handle_incoming(
_: &mut impl SubsystemContext,
_: &mut State,
message: DisputeCoordinatorMessage,
) -> Result<(), Error> {
match message {
DisputeCoordinatorMessage::ImportStatements {
..
} => { /* just drop confirmation */ },
DisputeCoordinatorMessage::ImportStatements { .. } => { /* just drop confirmation */ },
DisputeCoordinatorMessage::RecentDisputes(tx) => {
let _ = tx.send(Vec::new());
},
Expand All @@ -245,19 +231,13 @@ async fn handle_incoming(
DisputeCoordinatorMessage::QueryCandidateVotes(_, tx) => {
let _ = tx.send(Vec::new());
},
DisputeCoordinatorMessage::IssueLocalStatement(
_,
_,
_,
_,
) => { },
DisputeCoordinatorMessage::IssueLocalStatement(_, _, _, _) => {},
DisputeCoordinatorMessage::DetermineUndisputedChain {
base_number,
block_descriptions,
tx,
} => {
let undisputed_chain =
block_descriptions
let undisputed_chain = block_descriptions
.last()
.map(|e| (base_number + block_descriptions.len() as BlockNumber, e.block_hash));

Expand All @@ -269,6 +249,4 @@ async fn handle_incoming(
}

#[derive(Debug, thiserror::Error)]
enum DisputeMessageCreationError {
}

enum DisputeMessageCreationError {}
7 changes: 5 additions & 2 deletions node/core/dispute-coordinator/src/real/db/v1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,11 @@ use kvdb::{DBTransaction, KeyValueDB};
use parity_scale_codec::{Decode, Encode};

use crate::{
real::backend::{Backend, BackendWriteOp, OverlayedBackend},
DisputeStatus, real::DISPUTE_WINDOW,
real::{
backend::{Backend, BackendWriteOp, OverlayedBackend},
DISPUTE_WINDOW,
},
DisputeStatus,
};

const RECENT_DISPUTES_KEY: &[u8; 15] = b"recent-disputes";
Expand Down