Skip to content

Commit

Permalink
use existing constants
Browse files Browse the repository at this point in the history
  • Loading branch information
rnbguy committed Apr 19, 2024
1 parent 6542a23 commit 3337f65
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ibc-core/ics24-host/types/src/validate.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use ibc_primitives::prelude::*;

use crate::error::IdentifierError as Error;
use crate::identifiers::{ChannelId, ConnectionId};

const VALID_SPECIAL_CHARS: &str = "._+-#[]<>";

Expand Down Expand Up @@ -115,7 +116,7 @@ pub fn validate_client_identifier(id: &str) -> Result<(), Error> {
pub fn validate_connection_identifier(id: &str) -> Result<(), Error> {
validate_identifier_chars(id)?;
validate_identifier_length(id, 10, 64)?;
validate_named_u64_index(id, "connection")?;
validate_named_u64_index(id, ConnectionId::prefix())?;
Ok(())
}

Expand All @@ -135,7 +136,7 @@ pub fn validate_port_identifier(id: &str) -> Result<(), Error> {
pub fn validate_channel_identifier(id: &str) -> Result<(), Error> {
validate_identifier_chars(id)?;
validate_identifier_length(id, 8, 64)?;
validate_named_u64_index(id, "channel")?;
validate_named_u64_index(id, ChannelId::prefix())?;
Ok(())
}

Expand Down

0 comments on commit 3337f65

Please sign in to comment.