Skip to content

Commit c76c779

Browse files
authored
fix ismp book link (#73)
1 parent b5a859a commit c76c779

File tree

2 files changed

+29
-20
lines changed

2 files changed

+29
-20
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ This repo holds all the required components substrate runtimes need to interoper
2020

2121
## Documentation
2222

23-
Installation and integration guides can be found in the [book](https://substrate-ismp.polytope.technology).
23+
Installation and integration guides can be found in the [book](https://ismp.polytope.technology).
2424

2525
## Testing and Testing Guide
2626

grandpa/src/consensus.rs

+28-19
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ use core::marker::PhantomData;
1919
use finality_grandpa::Chain;
2020
use ismp::{
2121
consensus::{
22-
ConsensusClient, ConsensusStateId, StateCommitment, StateMachineClient, VerifiedCommitments,
22+
ConsensusClient, ConsensusClientId, ConsensusStateId, StateCommitment, StateMachineClient,
23+
VerifiedCommitments,
2324
},
2425
error::Error,
2526
host::{IsmpHost, StateMachine},
@@ -37,20 +38,26 @@ use verifier::{
3738
verify_grandpa_finality_proof, verify_parachain_headers_with_grandpa_finality_proof,
3839
};
3940

40-
pub const POLKADOT_CONSENSUS_STATE_ID: [u8; 8] = *b"polkadot";
41-
pub const KUSAMA_CONSENSUS_STATE_ID: [u8; 8] = *b"_kusama_";
41+
/// [`ConsensusStateId`] for the polkadot relay chain
42+
pub const POLKADOT_CONSENSUS_STATE_ID: ConsensusStateId = *b"polk";
4243

43-
pub struct GrandpaConsensusClient<T, H>(PhantomData<(T, H)>);
44+
/// [`ConsensusStateId`] for the kusama relay chain
45+
pub const KUSAMA_CONSENSUS_STATE_ID: ConsensusStateId = *b"sama";
4446

45-
impl<T, H> Default for GrandpaConsensusClient<T, H> {
47+
/// [`ConsensusClientId`] for GRANDPA consensus
48+
pub const GRANDPA_CONSENSUS_ID: ConsensusClientId = *b"GRAN";
49+
50+
pub struct GrandpaConsensusClient<T>(PhantomData<T>);
51+
52+
impl<T> Default for GrandpaConsensusClient<T> {
4653
fn default() -> Self {
4754
Self(PhantomData)
4855
}
4956
}
5057

51-
impl<T, H> ConsensusClient for GrandpaConsensusClient<T, H>
58+
impl<T> ConsensusClient for GrandpaConsensusClient<T>
5259
where
53-
H: Header<Hash = H256, Number = u32>,
60+
T::Header: Header<Hash = H256, Number = u32>,
5461
T: pallet_ismp::Config + super::Config,
5562
T::BlockNumber: Into<u32>,
5663
T::Hash: From<H256>,
@@ -197,15 +204,15 @@ where
197204
))
198205
})?;
199206

200-
let first_proof: FinalityProof<H> =
201-
codec::Decode::decode(&mut &proof_1[..]).map_err(|e| {
207+
let first_proof: FinalityProof<T::Header> = codec::Decode::decode(&mut &proof_1[..])
208+
.map_err(|e| {
202209
Error::ImplementationSpecific(format!(
203210
"Cannot decode first finality proof from proof_1 bytes: {e:?}",
204211
))
205212
})?;
206213

207-
let second_proof: FinalityProof<H> =
208-
codec::Decode::decode(&mut &proof_2[..]).map_err(|e| {
214+
let second_proof: FinalityProof<T::Header> = codec::Decode::decode(&mut &proof_2[..])
215+
.map_err(|e| {
209216
Error::ImplementationSpecific(format!(
210217
"Cannot decode second finality proof from proof_2 bytes: {e:?}",
211218
))
@@ -217,13 +224,13 @@ where
217224
)))
218225
}
219226

220-
let first_headers = AncestryChain::<H>::new(&first_proof.unknown_headers);
227+
let first_headers = AncestryChain::<T::Header>::new(&first_proof.unknown_headers);
221228
let first_target =
222229
first_proof.unknown_headers.iter().max_by_key(|h| *h.number()).ok_or_else(|| {
223230
Error::ImplementationSpecific(format!("Unknown headers can't be empty!"))
224231
})?;
225232

226-
let second_headers = AncestryChain::<H>::new(&second_proof.unknown_headers);
233+
let second_headers = AncestryChain::<T::Header>::new(&second_proof.unknown_headers);
227234
let second_target =
228235
second_proof.unknown_headers.iter().max_by_key(|h| *h.number()).ok_or_else(|| {
229236
Error::ImplementationSpecific(format!("Unknown headers can't be empty!"))
@@ -261,14 +268,16 @@ where
261268
}
262269

263270
let first_justification =
264-
GrandpaJustification::<H>::decode(&mut &first_proof.justification[..]).map_err(
265-
|_| Error::ImplementationSpecific(format!("Could not decode first justification")),
266-
)?;
271+
GrandpaJustification::<T::Header>::decode(&mut &first_proof.justification[..])
272+
.map_err(|_| {
273+
Error::ImplementationSpecific(format!("Could not decode first justification"))
274+
})?;
267275

268276
let second_justification =
269-
GrandpaJustification::<H>::decode(&mut &second_proof.justification[..]).map_err(
270-
|_| Error::ImplementationSpecific(format!("Could not decode second justification")),
271-
)?;
277+
GrandpaJustification::<T::Header>::decode(&mut &second_proof.justification[..])
278+
.map_err(|_| {
279+
Error::ImplementationSpecific(format!("Could not decode second justification"))
280+
})?;
272281

273282
if first_proof.block != first_justification.commit.target_hash ||
274283
second_proof.block != second_justification.commit.target_hash

0 commit comments

Comments
 (0)