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

Asset : Test for PeerIdTooLong #499

Draft
wants to merge 6 commits into
base: develop
Choose a base branch
from

Conversation

zeel991
Copy link
Contributor

@zeel991 zeel991 commented Aug 6, 2024

@zeel991
Copy link
Contributor Author

zeel991 commented Aug 10, 2024

Hello @vatsa287 , The PeerId is created when node_id is converted into byte vector which is later passed in generate_peer_id function which encodes it in UTF8 and decodes it in BASE58 and the decoded variable is wrapped in a struct .
If I have understood it correctly , can you please give me a hint as to how to generate a peer_id greater than MAX_PEER_ID_LENGTH but also keep the node_id less than the MAX_NODE_ID_LENGTH

@vatsa287
Copy link
Member

vatsa287 commented Aug 13, 2024

@zeel991
From my understanding it is not possible to test it by calling the method itself. Instead test for generate_peer_id itself. Check if the produced output is greater than allowed length for a peer id.
The upper bound constants are defined in mock.rs for test usage.

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] Network-Authorization: Add tests for PeerIdTooLong
2 participants