Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tests: Add test for InvalidIdentifierLength #322

Merged
merged 1 commit into from
Feb 13, 2024
Merged

Conversation

vatsa287
Copy link
Member

@vatsa287 vatsa287 commented Feb 8, 2024

This PR implements test-case for error-code InvalidIdentifierLength for chain-space pallet.
When Identifier Length < 2 or Identifier Length > 49.

Fixes: #280
Signed-off-by: Shree Vatsa N vatsa@dhiway.com

[TODO: For this to pass (currently fails even length is below 49) have to change error codes emitted in primitives/identifier]

Fixes: dhiway#280
Signed-off-by: Shreeevatsa N <vatsa@dhiway.com>
@@ -190,7 +190,7 @@ impl Ss58Identifier {
Ok(Self(
Vec::<u8>::from(v.to_base58())
.try_into()
.map_err(|_| IdentifierError::InvalidIdentifierLength)?,
.map_err(|_| IdentifierError::InvalidIdentifier)?,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is being triggered even when vector length is set to 40.
Ideally should be returned OK()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vatsa287 open a separate issue for this, and lets move ahead with merging this testcase, which checks for IdentifierLength.

@amarts amarts merged commit b4c24a1 into dhiway:develop Feb 13, 2024
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[C4GT] Chain-Space: Add tests for InvalidIdentifierLength
2 participants