mirror of
https://github.com/serai-dex/serai.git
synced 2025-12-10 05:09:22 +00:00
Implement tendermint_machine::Block for Substrate Blocks
Unfortunately, this immediately makes Tendermint machine capable of deployment as crate since it uses a git reference. In the future, a Cargo.toml patch section for serai/substrate should be investigated. This is being done regardless as it's the quickest way forward and this is for Serai.
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@@ -8774,6 +8774,7 @@ version = "0.1.0"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"async-trait",
|
"async-trait",
|
||||||
"parity-scale-codec",
|
"parity-scale-codec",
|
||||||
|
"sp-runtime",
|
||||||
"tokio",
|
"tokio",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|||||||
@@ -25,7 +25,7 @@ sp-api = { git = "https://github.com/serai-dex/substrate" }
|
|||||||
sp-consensus = { git = "https://github.com/serai-dex/substrate" }
|
sp-consensus = { git = "https://github.com/serai-dex/substrate" }
|
||||||
sc-consensus = { git = "https://github.com/serai-dex/substrate" }
|
sc-consensus = { git = "https://github.com/serai-dex/substrate" }
|
||||||
|
|
||||||
tendermint-machine = { path = "../tendermint" }
|
tendermint-machine = { path = "../tendermint", features = ["substrate"] }
|
||||||
|
|
||||||
# --
|
# --
|
||||||
|
|
||||||
|
|||||||
@@ -12,3 +12,8 @@ parity-scale-codec = { version = "3.2", features = ["derive"] }
|
|||||||
|
|
||||||
async-trait = "0.1"
|
async-trait = "0.1"
|
||||||
tokio = { version = "1", features = ["macros", "sync", "time", "rt"] }
|
tokio = { version = "1", features = ["macros", "sync", "time", "rt"] }
|
||||||
|
|
||||||
|
sp-runtime = { git = "https://github.com/serai-dex/substrate", optional = true }
|
||||||
|
|
||||||
|
[features]
|
||||||
|
substrate = ["sp-runtime"]
|
||||||
|
|||||||
@@ -112,6 +112,14 @@ pub trait Block: Send + Sync + Clone + PartialEq + Debug + Encode + Decode {
|
|||||||
fn id(&self) -> Self::Id;
|
fn id(&self) -> Self::Id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(feature = "substrate")]
|
||||||
|
impl<B: sp_runtime::traits::Block> Block for B {
|
||||||
|
type Id = B::Hash;
|
||||||
|
fn id(&self) -> B::Hash {
|
||||||
|
self.hash()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// Trait representing the distributed system Tendermint is providing consensus over.
|
/// Trait representing the distributed system Tendermint is providing consensus over.
|
||||||
#[async_trait::async_trait]
|
#[async_trait::async_trait]
|
||||||
pub trait Network: Send + Sync {
|
pub trait Network: Send + Sync {
|
||||||
|
|||||||
Reference in New Issue
Block a user