• Kirill Smelkov's avatar
    go/neo/neonet: Increase signal/noise in dump of packets with decode problems · dacce3d1
    Kirill Smelkov authored
    We recently hit "decode: buffer overflow" errors due to mismatch in
    between NEO/go and NEO/py (see previous patch). With dumpio=true that
    problem was showing itself as
    
        127.0.0.1:50624 > 127.0.0.1:41863: .5 GetObject &{0000000000000000 ffffffffffffffff 0285cbac258bf266}
        127.0.0.1:50624 < 127.0.0.1:41863: .5 (proto.Error) decode: buffer overflow; #24 [24]: 00 00 00 03 00 00 00 10 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 Error ACK ;  [24]tail: 00 00 00 03 00 00 00 10 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
            xtesting.go:306: load 0285cbac258bf265:0000000000000000: returned err unexpected:
                have: neo://1@127.0.0.1:24078: load 0285cbac258bf265:0000000000000000: 127.0.0.1:50624 - 127.0.0.1:41863 .5: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:24078: load 0285cbac258bf265:0000000000000000: 0000000000000000: object was not yet created
    
    Here after printing error and dumping all bytes from packet payload, it
    was printing again message type, message value from to-be-decoded place
    (which is zero-initialized) and data bytes again.
    -> Fix it not to print anything after dump of payload data:
    
        127.0.0.1:60518 > 127.0.0.1:46719: .5 GetObject &{0000000000000000 ffffffffffffffff 0285cbac258bf266}
        127.0.0.1:60518 < 127.0.0.1:46719: .5 (Error) decode: buffer overflow; #24 [24]: 00 00 00 03 00 00 00 10 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30 30
            xtesting.go:306: load 0285cbac258bf265:0000000000000000: returned err unexpected:
                have: neo://1@127.0.0.1:27853: load 0285cbac258bf265:0000000000000000: 127.0.0.1:60518 - 127.0.0.1:46719 .5: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:27853: load 0285cbac258bf265:0000000000000000: 0000000000000000: object was not yet created
    dacce3d1
pkt.go 3.54 KB