Skip to content

crypto/noise: Show peerIDs that fail to decode #392

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

Merged
merged 9 commits into from
May 26, 2025
Merged

Conversation

lexnv
Copy link
Collaborator

@lexnv lexnv commented May 14, 2025

This PR enriches the errors coming from the crypto/noise decryption by providing peer IDs.

This is useful for debugging:

lexnv and others added 8 commits May 14, 2025 13:12
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
lexnv added a commit that referenced this pull request May 23, 2025
Squashed commit of the following:

commit b2ad17b
Merge: a6a3521 276b190
Author: Alexandru Vasile <60601340+lexnv@users.noreply.github.com>
Date:   Fri May 23 12:35:26 2025 +0300

    Merge branch 'master' into lexnv/crypto-noise-err

commit a6a3521
Author: Alexandru Vasile <alexandru.vasile@parity.io>
Date:   Fri May 23 08:55:11 2025 +0000

    tests: Fix build warnings

    Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

commit e0f9040
Author: Alexandru Vasile <alexandru.vasile@parity.io>
Date:   Fri May 23 08:50:21 2025 +0000

    crypto/noise: Add transport type websocket to tests

    Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

commit a1978f6
Author: Alexandru Vasile <alexandru.vasile@parity.io>
Date:   Thu May 22 16:06:08 2025 +0000

    crypto/noise: Enhance all logs with connection type and peerID

    Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

commit 74ee607
Author: Alexandru Vasile <alexandru.vasile@parity.io>
Date:   Thu May 22 15:54:05 2025 +0000

    crypto/noise: Add packet info to warnings

    Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

commit 43cb2db
Author: Alexandru Vasile <alexandru.vasile@parity.io>
Date:   Wed May 14 13:23:44 2025 +0000

    crypto/noise: Add peerID to both failures

    Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

commit 3bd9085
Author: Alexandru Vasile <alexandru.vasile@parity.io>
Date:   Wed May 14 13:13:54 2025 +0000

    crypto/noise: Add extra debug messages

    Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

commit ca2919a
Author: Alexandru Vasile <alexandru.vasile@parity.io>
Date:   Wed May 14 13:12:17 2025 +0000

    crypto/noise: Show peerIDs that fail to decode

    Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Copy link

@sistemd sistemd left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Collaborator

@dmitry-markin dmitry-markin left a comment

Choose a reason for hiding this comment

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

IMO this should be a temporary fix in a custom branch if this is needed for debugging. We shouldn't print raw data from the remote if it's malformed/malicious

@lexnv
Copy link
Collaborator Author

lexnv commented May 26, 2025

IMO this should be a temporary fix in a custom branch if this is needed for debugging. We shouldn't print raw data from the remote if it's malformed/malicious

This should only print internal counters and lengths (like expected frame size and buffer length received over the wire, which already happened for trace logs). Ideally, the errors coming from this component should go away once Kusama updates to the upcoming release

I'll expect the following error to pop up in the meanwhile. I'd still like to see if we get different types of errors (edge-cases we might have missed), other than:

failed to decrypt message ty=WebSocket peer=PeerId("..") buf_len=12 frame_size=28 error=Decrypt

@lexnv lexnv merged commit b3fd2c2 into master May 26, 2025
8 checks passed
@lexnv lexnv deleted the lexnv/crypto-noise-err branch May 26, 2025 10:49
lexnv added a commit that referenced this pull request May 26, 2025
## [0.9.5] - 2025-05-26

This release primarily focuses on strengthening the stability of the
websocket transport. We've resolved an issue where higher-level
buffering was causing the Noise protocol to fail when decoding messages.

We've also significantly improved connectivity between litep2p and
Smoldot (the Substrate-based light client). Empty frames are now handled
correctly, preventing handshake timeouts and ensuring smoother
communication.

Finally, we've carried out several dependency updates to keep the
library current with the latest versions of its underlying components.

### Fixed

- substream/fix: Allow empty payloads with 0-length frame
([#395](#395))
- websocket: Fix connection stability on decrypt messages
([#393](#393))

### Changed

- crypto/noise: Show peerIDs that fail to decode
([#392](#392))
- cargo: Bump yamux to 0.13.5 and tokio to 1.45.0
([#396](#396))
- ci: Enforce and apply clippy rules
([#388](#388))
- build(deps): bump ring from 0.16.20 to 0.17.14
([#389](#389))
- Update hickory-resolver 0.24.2 -> 0.25.2
([#386](#386))

cc @paritytech/networking

---------

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
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.

4 participants