Skip to content

Commit

Permalink
Merge pull request cosmos#176 from octopus-network/feature/beefy-m2
Browse files Browse the repository at this point in the history
Update unit test
  • Loading branch information
livelybug authored Mar 30, 2022
2 parents 6515624 + a626d39 commit 41291f2
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
12 changes: 9 additions & 3 deletions modules/src/mock/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ use crate::relayer::ics18_relayer::error::Error as Ics18Error;
use crate::signer::Signer;
use crate::timestamp::Timestamp;
use crate::Height;
use crate::clients::ics10_grandpa::{client_state::ClientState, consensus_state::ConsensusState};

pub const DEFAULT_BLOCK_TIME_SECS: u64 = 3;

Expand Down Expand Up @@ -284,7 +285,6 @@ impl MockContext {
Some(MockClientState::new(MockHeader::new(client_state_height)).into()),
MockConsensusState::new(MockHeader::new(cs_height)).into(),
),
ClientType::Grandpa => todo!(),
// If it's a Tendermint client, we need TM states.
ClientType::Tendermint => {
let light_block = HostBlock::generate_tm_block(
Expand All @@ -300,12 +300,16 @@ impl MockContext {
// Return the tuple.
(Some(client_state), consensus_state)
}
ClientType::Grandpa => {
let client_state = AnyClientState::Grandpa(ClientState::default());
let consensus_state = AnyConsensusState::Grandpa(ConsensusState::default());
(Some(client_state), consensus_state)
},
};

let prev_consensus_state = match client_type {
// If it's a mock client, create the corresponding mock states.
ClientType::Mock => MockConsensusState::new(MockHeader::new(prev_cs_height)).into(),
ClientType::Grandpa => todo!(),
// If it's a Tendermint client, we need TM states.
ClientType::Tendermint => {
let light_block = HostBlock::generate_tm_block(
Expand All @@ -315,6 +319,7 @@ impl MockContext {
);
AnyConsensusState::from(light_block)
}
ClientType::Grandpa => AnyConsensusState::Grandpa(ConsensusState::default()),
};

let consensus_states = vec![
Expand Down Expand Up @@ -555,7 +560,8 @@ impl MockContext {

impl Ics26Context for MockContext {}

impl Ics20Context for MockContext {}
impl Ics20Context for MockContext {
}

impl CapabilityReader for MockContext {
fn get_capability(&self, _name: &CapabilityName) -> Result<Capability, Ics05Error> {
Expand Down
4 changes: 3 additions & 1 deletion relayer/src/foreign_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -919,7 +919,9 @@ impl<DstChain: ChainHandle, SrcChain: ChainHandle> ForeignClient<DstChain, SrcCh
}*/

let client_state = match client_state {
// AnyClientState::Mock(client_state) => AnyClientState::Mock(client_state),


AnyClientState::Mock(client_state) => AnyClientState::Mock(client_state),
AnyClientState::Tendermint(client_state) => AnyClientState::Tendermint(client_state),
AnyClientState::Grandpa(client_state) => {
let mut mmr_root_height = client_state.latest_commitment.block_number;
Expand Down

0 comments on commit 41291f2

Please sign in to comment.