Skip to content

Commit

Permalink
Last riff on Mock Context cleanup (#310)
Browse files Browse the repository at this point in the history
* Cleaning up ICS26 tests with global mock context & better coverage.

* ICS26 adapted (ICS18 and general cleanup left todo)

* ICS18 context mock cleanup done.

* Nuked inter-dependent mock contexts

* Housekeeping, last bits.

* Nuked Chain* traits and unused types.

* Addressing Anca's comments from prior PR

* Ressurect is_epoch_format

* Simplify MockContext construction.

* Added mock context validation. Better constructor for ChainId.

* Fixed a few of Anca's comments

* Reintroduced max_history_size in MockContext constructor

* Missing test case for conn_open_try

* Fix host_header arithmetic, added tests for mock context.

* Consistent Height construction. Fixed old comments & error messages
  • Loading branch information
adizere authored Oct 20, 2020
1 parent 750a87b commit f0feb0c
Show file tree
Hide file tree
Showing 36 changed files with 606 additions and 1,002 deletions.
44 changes: 0 additions & 44 deletions modules/src/context.rs

This file was deleted.

201 changes: 0 additions & 201 deletions modules/src/context_mock.rs

This file was deleted.

11 changes: 6 additions & 5 deletions modules/src/ics02_client/client_def.rs
Original file line number Diff line number Diff line change
Expand Up @@ -485,9 +485,10 @@ impl ClientDef for AnyClient {
#[cfg(test)]
mod tests {
use crate::ics02_client::client_def::AnyClientState;
use crate::ics02_client::height::{chain_version, Height};
use crate::ics02_client::height::Height;
use crate::ics07_tendermint::client_state::ClientState;
use crate::ics07_tendermint::header::test_util::get_dummy_header;
use crate::ics24_host::identifier::ChainId;
use prost_types::Any;
use std::convert::TryFrom;
use std::time::Duration;
Expand All @@ -500,10 +501,10 @@ mod tests {
trusting_period: Duration::from_secs(64000),
unbonding_period: Duration::from_secs(128000),
max_clock_drift: Duration::from_millis(3000),
latest_height: Height {
version_number: chain_version(tm_header.signed_header.header.chain_id.to_string()),
version_height: u64::from(tm_header.signed_header.header.height),
},
latest_height: Height::new(
ChainId::chain_version(tm_header.signed_header.header.chain_id.to_string()),
u64::from(tm_header.signed_header.header.height),
),
frozen_height: Height::zero(),
allow_update_after_expiry: false,
allow_update_after_misbehaviour: false,
Expand Down
Loading

0 comments on commit f0feb0c

Please sign in to comment.