• Kirill Smelkov's avatar
    fixup! go/neo/proto: Switch enum encoding from int32 to int8 · 05463172
    Kirill Smelkov authored
    In commit 5f13cc85 I changed enum encodings from int32 to int8, but did
    not noticed that NEO/py commit 52db5607 ("protocol: a single byte is
    more than enough to encode enums") despite specified intent and
    ErrorCodes being marked with @Enum, changed encoding only for fields
    that are marked as PEnum in structures. In NEO/py the Error.code field
    is still marked as PNumber which encodes as 32-bit integer on the wire.
    -> Fix it back.
    
    With recent xtesting.DrvTestLoad update this error was manifesting itself as (on @t branch):
    
    --- FAIL: TestLoad (2.08s)
        --- FAIL: TestLoad/py (2.07s)
            xtesting.go:306: load 0285cbac258bf265:0000000000000000: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 0285cbac258bf265:0000000000000000: 127.0.0.1:42288 - 127.0.0.1:37109 .5: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 0285cbac258bf265:0000000000000000: 0000000000000000: object was not yet created
            xtesting.go:306: load 0285cbac3d0369e5:0000000000000001: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 0285cbac3d0369e5:0000000000000001: 127.0.0.1:42288 - 127.0.0.1:37109 .13: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 0285cbac3d0369e5:0000000000000001: 0000000000000001: object was not yet created
            xtesting.go:306: load 0285cbac41b4e832:0000000000000002: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 0285cbac41b4e832:0000000000000002: 127.0.0.1:42288 - 127.0.0.1:37109 .21: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 0285cbac41b4e832:0000000000000002: 0000000000000002: object was not yet created
            xtesting.go:306: load 0285cbac4666667f:0000000000000003: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 0285cbac4666667f:0000000000000003: 127.0.0.1:42288 - 127.0.0.1:37109 .29: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 0285cbac4666667f:0000000000000003: 0000000000000003: object was not yet created
            xtesting.go:306: load 0285cbac4fc96318:0000000000000004: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 0285cbac4fc96318:0000000000000004: 127.0.0.1:42288 - 127.0.0.1:37109 .41: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 0285cbac4fc96318:0000000000000004: 0000000000000004: object was not yet created
            xtesting.go:306: load 0285cbac547ae165:0000000000000005: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 0285cbac547ae165:0000000000000005: 127.0.0.1:42288 - 127.0.0.1:37109 .49: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 0285cbac547ae165:0000000000000005: 0000000000000005: object was not yet created
            xtesting.go:306: load 0285cbac628f5c4b:0000000000000006: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 0285cbac628f5c4b:0000000000000006: 127.0.0.1:42288 - 127.0.0.1:37109 .65: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 0285cbac628f5c4b:0000000000000006: 0000000000000006: object was not yet created
            xtesting.go:306: load 0285cbaca444447f:0000000000000007: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 0285cbaca444447f:0000000000000007: 127.0.0.1:42288 - 127.0.0.1:37109 .125: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 0285cbaca444447f:0000000000000007: 0000000000000007: object was not yet created
            xtesting.go:306: load 0285cbacbbbbbbff:0000000000000008: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 0285cbacbbbbbbff:0000000000000008: 127.0.0.1:42288 - 127.0.0.1:37109 .149: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 0285cbacbbbbbbff:0000000000000008: 0000000000000008: object was not yet created
            xtesting.go:306: load 0285cbad80da7498:0000000000000009: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 0285cbad80da7498:0000000000000009: 127.0.0.1:42288 - 127.0.0.1:37109 .269: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 0285cbad80da7498:0000000000000009: 0000000000000009: object was not yet created
            xtesting.go:331: load 7fffffffffffffff:000000000000000a: returned err unexpected:
                have: neo://1@127.0.0.1:32731: load 7fffffffffffffff:000000000000000a: 127.0.0.1:42288 - 127.0.0.1:37109 .295: decode: decode: buffer overflow
                want: neo://1@127.0.0.1:32731: load 7fffffffffffffff:000000000000000a: 000000000000000a: no such object
    05463172
zproto-marshal.go 98.1 KB