• Levin Zimmermann's avatar
    go/neo/proto/msgpack: Fix {en,de}coding of unset IdTime · 2526a284
    Levin Zimmermann authored
    The data type of IdTime is 'Optional[float]' [1], [2]. Before this patch the
    msgpack decoder, encoder and sizer could only proceed 'IdTime' in case its data
    type was 'float'. Now they also support an IdTime with value NIL.
    
    Without this patch, NEO/go client tests fail [3].
    
    [1] See here, the fifth argument is IdTime:
    
        https://lab.nexedi.com/nexedi/neoppod/-/blob/3ddb6663/neo/master/handlers/identification.py#L26-27
    
        This is found to be 'Optional[float]':
    
        https://lab.nexedi.com/nexedi/neoppod/-/blob/3ddb6663/neo/tests/protocol#L98
    
    [2] This seems to be true for both, pre-msgpack and post-msgpack
        protocol, because in the pre-msgpack NEO/go there is already this
        note:
    
        https://lab.nexedi.com/kirr/neo/-/blob/1ad088c8/go/neo/proto/proto.go#L352-357
    
    [3] When running NEO/go client tests without this patch, we can see in the NEO/go log file:
    
    ```
    I0820 13:05:23.813992 1138432 connect.go:115] C?: talk master(127.0.0.1:29203): dial 127.0.0.1:29203 (MASTER): [
    I0820 13:05:23.816456 1138432 connect.go:122] C?: talk master(127.0.0.1:29203): dial 127.0.0.1:29203 (MASTER): dialed ok; requesting identification...
    I0820 13:05:23.817337 1138432 connect.go:180] C?: talk master(127.0.0.1:29203): dial 127.0.0.1:29203 (MASTER): identification accepted
    I0820 13:05:23.817346 1138432 connect.go:181] C?: talk master(127.0.0.1:29203): dial 127.0.0.1:29203 (MASTER): ]
    I0820 13:05:23.817369 1138432 mastered.go:187] C?: talk M1: [
    I0820 13:05:23.817401 1138432 mastered.go:195] C?: talk M1: ] (after identification: expect nodeTab: 127.0.0.1:41678 - 127.0.0.1:29203 .0: decode: decode: M: NotifyNodeInformation.IdTime: msgp: attempted to decode type "nil" with method for "float64")
    W0820 13:05:23.817429 1138432 mastered.go:127] C?: talk master(127.0.0.1:29203): C?: talk M1: after identification: expect nodeTab: 127.0.0.1:41678 - 127.0.0.1:29203 .0: decode: decode: M: NotifyNodeInformation.IdTime: msgp: attempted to decode type "nil" with method for "float64"
    ```
    2526a284
msgpack_test.go 6 KB