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

gossip: deserialization error #148

Open
dnut opened this issue May 29, 2024 · 2 comments
Open

gossip: deserialization error #148

dnut opened this issue May 29, 2024 · 2 comments
Labels
bug Something isn't working

Comments

@dnut
Copy link
Contributor

dnut commented May 29, 2024

Description

I occasionally see this error running sig on testnet:

failed to deserialize field rpc_pubsub
failed to deserialize field data
failed to deserialize field 1
time=2024-05-29T23:42:35Z level=error  gossip: packet_verify: failed to deserialize

How to Reproduce the Bug

zig build run -- -l info validator --entrypoint entrypoint.testnet.solana.com:8001 --entrypoint entrypoint2.testnet.solana.com:8001 --entrypoint entrypoint3.testnet.solana.com:8001

Additional Context

No response

@dnut dnut added the bug Something isn't working label May 29, 2024
@InKryption
Copy link
Contributor

InKryption commented Jun 3, 2024

I think I've tracked this down to this specific field in this hierarchy:

  • GossipMessage
    • PullRequest: struct { GossipPullFilter, SignedGossipData }
      • @"1": SignedGossipData
        • data: GossipData
          • LegacyContactInfo: LegacyContactInfo
            • rpc_pubsup: SockAddr

With the source being here:

sig/src/gossip/service.zig

Lines 393 to 402 in 6e0ecb7

for (@as([]const Packet, self.packet_batch.items)) |*packet| {
var message = bincode.readFromSlice(
self.allocator,
GossipMessage,
packet.data[0..packet.size],
bincode.Params.standard,
) catch {
self.logger.errf("gossip: packet_verify: failed to deserialize", .{});
continue;
};

Through some testing, I specifically observed this sequence of bytes on two separate occasions being placed where the tag/discriminant of the SockAddr union is expected to be, causing the failure:

7, 0, 106, 7

It looks like it might be a direct IPv4 address?

Update: making the rpc_pubsup field into a SockAddrV4 causes other pull requests to fail, and more of them, during the signature verification instead of the deserialization.

@InKryption
Copy link
Contributor

Just want to note this down so I don't forget it: our self-hosted bincode library doesn't respect the varint encoding mode for the enum discriminant of tagged unions (/rust enums), not while encoding nor decoding them. I have a small suspicion this might be related, and will test when I get a chance.

@dnut dnut added this to Sig Oct 11, 2024
@dnut dnut moved this to 📋 Backlog in Sig Oct 11, 2024
@0xNineteen 0xNineteen changed the title gossip deserialization error gossip: deserialization error Nov 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants