Skip to content

Commit

Permalink
fix initialise() to not be able to initialise with the frozen client
Browse files Browse the repository at this point in the history
Signed-off-by: Jun Kimura <[email protected]>
  • Loading branch information
bluele committed Nov 12, 2024
1 parent 41be5a9 commit c7f469b
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
3 changes: 3 additions & 0 deletions crates/ibc/src/client_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ impl<const SYNC_COMMITTEE_SIZE: usize> Ics2ClientState for ClientState<SYNC_COMM
consensus_state: Any,
) -> Result<Box<dyn Ics02ConsensusState>, ClientError> {
self.validate()?;
if self.is_frozen() {
return Err(Error::CannotInitializeFrozenClient.into());
}
let consensus_state = ConsensusState::try_from(consensus_state)?;
consensus_state.validate()?;
Ok(ConsensusState::into_box(consensus_state))
Expand Down
2 changes: 2 additions & 0 deletions crates/ibc/src/errors.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,8 @@ pub enum Error {
ProtoMissingFieldError(String),
/// unknown message type: `{0}`
UnknownMessageType(String),
/// cannot initialize frozen client
CannotInitializeFrozenClient,
}

impl Error {
Expand Down

0 comments on commit c7f469b

Please sign in to comment.