Skip to content

Commit

Permalink
use default call instead of build
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed Sep 20, 2024
1 parent 845e59e commit cbadac8
Show file tree
Hide file tree
Showing 12 changed files with 75 additions and 75 deletions.
12 changes: 6 additions & 6 deletions ibc-testkit/src/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ where
HostClientState<H>: ClientStateValidation<MockIbcStore<S>>,
{
fn default() -> Self {
dummy_store_generic_test_context().build()
dummy_store_generic_test_context().call()
}
}

Expand Down Expand Up @@ -532,33 +532,33 @@ mod tests {
name: "Empty history, small pruning window".to_string(),
ctx: dummy_store_generic_test_context()
.latest_height(Height::new(cv, 1).expect("Never fails"))
.build(),
.call(),
},
Test {
name: "Large pruning window".to_string(),
ctx: dummy_store_generic_test_context()
.latest_height(Height::new(cv, 2).expect("Never fails"))
.build(),
.call(),
},
Test {
name: "Small pruning window".to_string(),
ctx: dummy_store_generic_test_context()
.latest_height(Height::new(cv, 30).expect("Never fails"))
.build(),
.call(),
},
Test {
name: "Small pruning window, small starting height".to_string(),
ctx: dummy_store_generic_test_context()
.latest_height(Height::new(cv, 2).expect("Never fails"))
.build(),
.call(),
},
// This is disabled, as now we generate all the blocks till latest_height
// Generating 2000 Tendermint blocks is slow.
// Test {
// name: "Large pruning window, large starting height".to_string(),
// ctx: dummy_store_generic_test_context()
// .latest_height(Height::new(cv, 2000).expect("Never fails"))
// .build(),
// .call(),
// },
];

Expand Down
4 changes: 2 additions & 2 deletions ibc-testkit/src/fixtures/applications/transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use ibc::core::primitives::Signer;
use crate::fixtures::core::signer::dummy_account_id;

/// Returns a dummy [`MsgTransfer`], for testing purposes only!
#[builder(finish_fn = build)]
#[builder]
pub fn dummy_msg_transfer(
#[builder(start_fn)] packet_data: PacketData,
#[builder(default = PortId::transfer())] port_id_on_a: PortId,
Expand Down Expand Up @@ -44,7 +44,7 @@ pub fn extract_transfer_packet(msg: &MsgTransfer, sequence: Sequence) -> Packet
}

/// Returns a dummy [`PacketData`], for testing purposes only!
#[builder(finish_fn = build)]
#[builder]
pub fn dummy_packet_data(
#[builder(start_fn)] token: PrefixedCoin,
#[builder(default = dummy_account_id())] sender: Signer,
Expand Down
2 changes: 1 addition & 1 deletion ibc-testkit/src/fixtures/core/channel/packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use ibc::core::host::types::identifiers::{ChannelId, PortId, Sequence};
use ibc::core::primitives::prelude::*;

/// Returns a dummy [`Packet`], for testing purposes only!
#[builder(finish_fn = build)]
#[builder]
pub fn dummy_packet(
#[builder(default = Sequence::from(0))] seq_on_a: Sequence,
#[builder(default = PortId::transfer())] port_id_on_a: PortId,
Expand Down
2 changes: 1 addition & 1 deletion ibc-testkit/src/fixtures/core/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ use crate::testapp::ibc::core::types::{MockIbcStore, DEFAULT_BLOCK_TIME_SECS};
use crate::utils::year_2023;

/// Returns a dummy [`StoreGenericTestContext`], for testing purposes only!
#[builder(finish_fn = build)]
#[builder]
pub fn dummy_store_generic_test_context<S, H>(
#[builder(default)] host: H,
#[builder(default = Duration::from_secs(DEFAULT_BLOCK_TIME_SECS))] block_time: Duration,
Expand Down
2 changes: 1 addition & 1 deletion ibc-testkit/src/relayer/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ where
ctx_b: &TestContext<B>,
signer: Signer,
) -> ClientId {
let light_client_of_b = dummy_light_client(ctx_b).build();
let light_client_of_b = dummy_light_client(ctx_b).call();

let msg_for_a = MsgEnvelope::Client(ClientMsg::CreateClient(MsgCreateClient {
client_state: light_client_of_b.client_state.into(),
Expand Down
10 changes: 5 additions & 5 deletions ibc-testkit/src/testapp/ibc/core/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ mod tests {
let module_id = ModuleId::new(module_id.to_string());
let m = router.get_route_mut(&module_id).expect("Never fails");

let packet = dummy_packet().build();
let packet = dummy_packet().call();

let result = m.on_recv_packet_execute(&packet, &dummy_bech32_account().into());
(module_id, result)
Expand All @@ -459,7 +459,7 @@ where
{
fn default() -> Self {
let context = TestContext::<H>::default();
dummy_light_client(&context).build()
dummy_light_client(&context).call()

Check warning on line 462 in ibc-testkit/src/testapp/ibc/core/types.rs

View check run for this annotation

Codecov / codecov/patch

ibc-testkit/src/testapp/ibc/core/types.rs#L462

Added line #L462 was not covered by tests
}
}

Expand All @@ -471,12 +471,12 @@ where
pub fn with_latest_height(height: Height) -> Self {
let context: TestContext<_> = dummy_store_generic_test_context()
.latest_height(height)
.build();
dummy_light_client(&context).build()
.call();
dummy_light_client(&context).call()
}
}

#[builder(finish_fn = build)]
#[builder]
pub fn dummy_light_client<H>(
#[builder(start_fn)] context: &TestContext<H>,
#[builder(default, into)] consensus_heights: Vec<Height>,
Expand Down
4 changes: 2 additions & 2 deletions tests-integration/tests/core/ics02_client/create_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,10 @@ fn test_tm_create_client_proof_verification_ok() {

let ctx_tm: TendermintContext = dummy_store_generic_test_context()
.latest_height(client_height)
.build();
.call();

let ctx_mk =
MockContext::default().with_light_client(&client_id, dummy_light_client(&ctx_tm).build());
MockContext::default().with_light_client(&client_id, dummy_light_client(&ctx_tm).call());

let client_validation_ctx_mk = ctx_mk.ibc_store().get_client_validation_context();

Expand Down
4 changes: 2 additions & 2 deletions tests-integration/tests/core/ics02_client/recover_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,13 @@ fn setup_client_recovery_fixture(

let mut ctx_a: TendermintContext = dummy_store_generic_test_context()
.latest_timestamp(latest_timestamp)
.build();
.call();

// create a ctx_b
let ctx_b: MockContext = dummy_store_generic_test_context()
.latest_height(substitute_height)
.latest_timestamp(latest_timestamp)
.build();
.call();

let signer = dummy_account_id();

Expand Down
Loading

0 comments on commit cbadac8

Please sign in to comment.