Skip to content

Commit d0562e0

Browse files
committed
refactor(ibc-testkit): remove Default from client_state initialization
1 parent 04ae141 commit d0562e0

File tree

7 files changed

+16
-16
lines changed

7 files changed

+16
-16
lines changed

ibc-testkit/src/fixtures/clients/tendermint.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ pub fn dummy_tm_client_state_from_header(tm_header: TmHeader) -> TmClientState {
3131
Duration::from_secs(128000),
3232
Duration::from_millis(3000),
3333
Height::new(chain_id.revision_number(), u64::from(tm_header.height)).expect("Never fails"),
34-
Default::default(),
35-
Default::default(),
34+
ProofSpecs::cosmos(),
35+
Vec::new(),
3636
AllowUpdate {
3737
after_expiry: false,
3838
after_misbehaviour: false,
@@ -56,8 +56,8 @@ pub fn dummy_raw_tm_client_state(frozen_height: RawHeight) -> RawTmClientState {
5656
unbonding_period: Some(Duration::from_secs(128000).into()),
5757
max_clock_drift: Some(Duration::from_millis(3000).into()),
5858
latest_height: Some(Height::new(0, 10).expect("Never fails").into()),
59-
proof_specs: ProofSpecs::default().into(),
60-
upgrade_path: Default::default(),
59+
proof_specs: ProofSpecs::cosmos().into(),
60+
upgrade_path: Vec::new(),
6161
frozen_height: Some(frozen_height),
6262
allow_update_after_expiry: false,
6363
allow_update_after_misbehaviour: false,
@@ -67,7 +67,7 @@ pub fn dummy_raw_tm_client_state(frozen_height: RawHeight) -> RawTmClientState {
6767
#[derive(typed_builder::TypedBuilder, Debug)]
6868
pub struct ClientStateConfig {
6969
pub chain_id: ChainId,
70-
#[builder(default)]
70+
#[builder(default = TrustThreshold::ONE_THIRD)]
7171
pub trust_level: TrustThreshold,
7272
#[builder(default = Duration::from_secs(64000))]
7373
pub trusting_period: Duration,
@@ -76,7 +76,7 @@ pub struct ClientStateConfig {
7676
#[builder(default = Duration::from_millis(3000))]
7777
max_clock_drift: Duration,
7878
pub latest_height: Height,
79-
#[builder(default)]
79+
#[builder(default = ProofSpecs::cosmos())]
8080
pub proof_specs: ProofSpecs,
8181
#[builder(default)]
8282
pub upgrade_path: Vec<String>,

ibc-testkit/src/fixtures/core/channel/packet.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ mod tests {
267267
let ibc_event = IbcEvent::SendPacket(SendPacket::new(
268268
packet,
269269
Order::Unordered,
270-
ConnectionId::default(),
270+
ConnectionId::new(0),
271271
));
272272
let _ = tendermint::abci::Event::try_from(ibc_event);
273273
}

ibc-testkit/src/fixtures/core/connection/conn_open_ack.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use ibc::core::client::types::proto::v1::Height as RawHeight;
22
use ibc::core::client::types::Height;
33
use ibc::core::connection::types::msgs::MsgConnectionOpenAck;
44
use ibc::core::connection::types::proto::v1::MsgConnectionOpenAck as RawMsgConnectionOpenAck;
5-
use ibc::core::connection::types::version::Version;
5+
use ibc::core::connection::types::version::get_compatible_versions;
66
use ibc::core::host::types::identifiers::ConnectionId;
77
use ibc::core::primitives::prelude::*;
88

@@ -38,7 +38,7 @@ pub fn dummy_raw_msg_conn_open_ack(
3838
}),
3939
client_state: Some(MockClientState::new(MockHeader::new(client_state_height)).into()),
4040
proof_client: dummy_proof(),
41-
version: Some(Version::default().into()),
41+
version: Some(get_compatible_versions()[0].into()),
4242
signer: dummy_bech32_account(),
4343
host_consensus_state_proof: vec![],
4444
}

ibc-testkit/src/fixtures/core/connection/conn_open_init.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use ibc::core::connection::types::msgs::MsgConnectionOpenInit;
22
use ibc::core::connection::types::proto::v1::{
33
MsgConnectionOpenInit as RawMsgConnectionOpenInit, Version as RawVersion,
44
};
5-
use ibc::core::connection::types::version::Version;
5+
use ibc::core::connection::types::version::{get_compatible_versions, Version};
66
use ibc::core::connection::types::Counterparty;
77
use ibc::core::host::types::identifiers::ClientId;
88
use ibc::core::primitives::prelude::*;
@@ -71,9 +71,9 @@ pub fn msg_conn_open_with_version(
7171
/// Returns a dummy `RawMsgConnectionOpenInit`, for testing purposes only!
7272
pub fn dummy_raw_msg_conn_open_init() -> RawMsgConnectionOpenInit {
7373
RawMsgConnectionOpenInit {
74-
client_id: ClientId::default().to_string(),
74+
client_id: ClientId::from("07-tendermint-0").to_string(),
7575
counterparty: Some(dummy_raw_counterparty_conn(None)),
76-
version: Some(Version::default().into()),
76+
version: Some(get_compatible_versions()[0].into()),
7777
delay_period: 0,
7878
signer: dummy_bech32_account(),
7979
}

ibc-testkit/src/fixtures/core/connection/conn_open_try.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@ pub fn dummy_raw_msg_conn_open_try(
4040

4141
#[allow(deprecated)]
4242
RawMsgConnectionOpenTry {
43-
client_id: ClientId::default().to_string(),
44-
previous_connection_id: ConnectionId::default().to_string(),
43+
client_id: ClientId::from("07-tendermint-0").to_string(),
44+
previous_connection_id: ConnectionId::new(0).to_string(),
4545
client_state: Some(MockClientState::new(MockHeader::new(client_state_height)).into()),
4646
counterparty: Some(dummy_raw_counterparty_conn(Some(0))),
4747
delay_period: 0,

ibc-testkit/src/fixtures/core/connection/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ pub fn dummy_raw_counterparty_conn(conn_id: Option<u64>) -> RawCounterparty {
4242
None => "".to_string(),
4343
};
4444
RawCounterparty {
45-
client_id: ClientId::default().to_string(),
45+
client_id: ClientId::from("07-tendermint-0").to_string(),
4646
connection_id,
4747
prefix: Some(MerklePrefix {
4848
key_prefix: b"ibc".to_vec(),

ibc-testkit/tests/core/ics02_client/update_client.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -678,7 +678,7 @@ fn test_update_synthetic_tendermint_client_duplicate_ok() {
678678
.into(),
679679
),
680680
proof_specs: ProofSpecs::default().into(),
681-
upgrade_path: Default::default(),
681+
upgrade_path: Vec::new(),
682682
frozen_height: Some(RawHeight {
683683
revision_number: 0,
684684
revision_height: 0,

0 commit comments

Comments
 (0)