Skip to content

Commit

Permalink
fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
yito88 committed Apr 29, 2024
1 parent 16f61c7 commit e646198
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
3 changes: 3 additions & 0 deletions crates/core/src/ibc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,9 @@ impl TryFrom<RawIbcEvent> for IbcEvent {
/// Returns the trace path and the token string if the denom is an IBC
/// denom.
pub fn is_ibc_denom(denom: impl AsRef<str>) -> Option<(TracePath, String)> {
if is_nft_trace(denom.as_ref()).is_some() {
return None;
}
let prefixed_denom = PrefixedDenom::from_str(denom.as_ref()).ok()?;
if prefixed_denom.trace_path.is_empty() {
return None;
Expand Down
25 changes: 24 additions & 1 deletion crates/namada/src/ledger/native_vp/ibc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -867,7 +867,30 @@ mod tests {
let client_counter_key = client_counter_key();
increment_counter(&mut state, &client_counter_key);
keys_changed.insert(client_counter_key);

// client update time
let client_update_time_key = client_update_timestamp_key(&client_id);
let time = StateRead::get_block_header(&state, None)
.unwrap()
.0
.unwrap()
.time;
let bytes = TmTime::try_from(time).unwrap().encode_vec();
state
.write_log_mut()
.write(&client_update_time_key, bytes)
.expect("write failed");
keys_changed.insert(client_update_time_key);
// client update height
let client_update_height_key = client_update_height_key(&client_id);
let host_height = state.in_mem().get_block_height().0;
let host_height =
Height::new(0, host_height.0).expect("invalid height");
state
.write_log_mut()
.write(&client_update_height_key, host_height.encode_vec())
.expect("write failed");
keys_changed.insert(client_update_height_key);
// event
let event = RawIbcEvent::CreateClient(CreateClient::new(
client_id,
client_type(),
Expand Down

0 comments on commit e646198

Please sign in to comment.