1. 18 Jan, 2021 12 commits
  2. 15 Jan, 2021 28 commits
    • Kirill Smelkov's avatar
      Merge branch 'master' into t · 29cd458b
      Kirill Smelkov authored
      * master: (25 commits)
        go/neo/neonet: Teach Dial to autodetect server encoding
        go/neo/neonet: MessagePack support for link layer (draft)
        go/neo/proto: Cosmetics
        go/neo/proto: MessagePack support for messages (draft)
        go/neo/internal/msgpack: New package with runtime support for MessagePack
        go/neo/proto: protogen: Prepare to generate code for struct heads
        go/neo/proto: protogen: Factor-out handling of slice and map heads into common place
        go/neo/proto: protogen: Fix naming thinko in decoderN.genBuf
        go/neo/proto: Introduce Encoding
        go/neo/proto: Unexport Msg.NEOMsg{Encode,Decode}
        go/neo/proto: Kill outdated TODO
        go/neo/proto: Unexport Msg.NEOMsgCode
        go/neo/proto: protogen: Reuse sizer for typeSizeFixed
        go/neo/proto: protogen: Load zodb.Tid and zodb.Oid types
        go/neo/proto: protogen: Factor-out code to lookup object for <pkg>.<name> into common function
        go/neo/proto: protogen: Clarify criteria to detect []byte
        go/neo/proto: protogen: Fix it not to silently skip a pointer field
        go/neo/proto: AddrString: Also treat lonet networks as having addr in host:port form
        go/neo/neonet: Adjust pktAlloc to always allocate pktBuf with cap >= PktHeaderSize
        go/neo/neonet: Factor-out decode of packet header into pktHeadDecode
        ...
      29cd458b
    • Kirill Smelkov's avatar
      . · 91855c03
      Kirill Smelkov authored
      91855c03
    • Kirill Smelkov's avatar
      go/neo/neonet: Teach Dial to autodetect server encoding · ce89d01a
      Kirill Smelkov authored
      NEO/go server accepts preferred encoding of client from start, but
      NEO/py server implements either N or M encoding and disconnects client
      silently if handshake is not exactly what is expected.
      
      However we can teach Dial to retry with different preferred options and
      this way when connection to a NEO/py server, it will essentially
      autodetect which encoding is used and accepted by remote peer.
      ce89d01a
    • Kirill Smelkov's avatar
      X unexport neonet.DialEncTryOrder · 99ea2b93
      Kirill Smelkov authored
      99ea2b93
    • Kirill Smelkov's avatar
      go/neo/neonet: MessagePack support for link layer (draft) · 7f1d0c39
      Kirill Smelkov authored
      This patch adds support for serializing packet frames with M encoding on
      the wire. To do so it follows rules defined in
      
          	nexedi/neoppod@9d0bf97a
          	( nexedi/neoppod!11 )
      
      Server handshake is reworked to autodetect client's preferred encoding.
      Client always prefers 'N' for now.
      7f1d0c39
    • Kirill Smelkov's avatar
      X move handshake do to neonet · c3fb22a4
      Kirill Smelkov authored
      c3fb22a4
    • Kirill Smelkov's avatar
      . · fad6baf1
      Kirill Smelkov authored
      fad6baf1
    • Kirill Smelkov's avatar
      9ae505ad
    • Kirill Smelkov's avatar
      go/neo/proto: Cosmetics · a1ef272f
      Kirill Smelkov authored
      a1ef272f
    • Kirill Smelkov's avatar
      . · e1c25b29
      Kirill Smelkov authored
      e1c25b29
    • Kirill Smelkov's avatar
      . · 0e028e1c
      Kirill Smelkov authored
      0e028e1c
    • Kirill Smelkov's avatar
      go/neo/proto: MessagePack support for messages (draft) · e8143557
      Kirill Smelkov authored
      This patch adds proto.Encoding('M') and teaches it to encode/decode
      messages via MessagePack by the rules defined in
      
      	nexedi/neoppod@9d0bf97a
      	( nexedi/neoppod!11 )
      
      It only adds support for messages serialization, without changing
      proto.go to match changes in e.g. enums reordering, and without adding
      support for MessagePack at link layer in neonet.
      
      M-encoding was only tested for NEO/go-NEO/go, and was not yet tested for
      NEO/go-NEO/py interoperation. There will be likely small mistakes
      discovered on my side that should be hopefully easy to fix step by step
      once we get to that phase.
      e8143557
    • Kirill Smelkov's avatar
      go/neo/internal/msgpack: New package with runtime support for MessagePack · a8249bd9
      Kirill Smelkov authored
      It complements github.com/tinylib/msgp with things that neo/proto needs
      to encode/decode messages.
      a8249bd9
    • Kirill Smelkov's avatar
      go/neo/proto: protogen: Prepare to generate code for struct heads · 2c1cb10d
      Kirill Smelkov authored
      It is noop for 'N' encoding, but will be non-empty for MessagePack.
      2c1cb10d
    • Kirill Smelkov's avatar
      go/neo/proto: protogen: Factor-out handling of slice and map heads into common place · 6e705e4e
      Kirill Smelkov authored
      genSliceHead and genMapHead will be reused for MsgPack encoding.
      Changes in generated code are mostly due to move of where things are
      typecasted to e.g. uint32 without any change in semantic.
      6e705e4e
    • Kirill Smelkov's avatar
      go/neo/proto: protogen: Fix naming thinko in decoderN.genBuf · 1bb595cf
      Kirill Smelkov authored
      For decode-family of functions protogen.go sticks to convention to name
      target variable to where to assign the result as "assignto", not "path".
      
      No change in generated code.
      1bb595cf
    • Kirill Smelkov's avatar
      go/neo/proto: Introduce Encoding · c0d54d50
      Kirill Smelkov authored
      Encoding specifies a way to encode/decode NEO messages and packets.
      Current way of how messages were encoded is called to be 'N' encoding.
      
      This patch:
      
      - adds proto.Encoding type
      - changes MsgEncode and MsgDecode to be methods of Encoding
      - renames thigs that are specific to 'N' encoding to have 'N' suffix
      - changes tests to run a testcase agains vector of provided encodings.
        That vector is currently only ['N'].
      c0d54d50
    • Kirill Smelkov's avatar
      . · 1b224d8b
      Kirill Smelkov authored
      1b224d8b
    • Kirill Smelkov's avatar
      go/neo/proto: Unexport Msg.NEOMsg{Encode,Decode} · 39545b9c
      Kirill Smelkov authored
      And provide only single top-level entry-points to encode/decode
      messages. As of now the entry points are just plain forwarding, but with
      introducing of msgpack and encodings, they will take into account
      through which encoding a message has to be encoded/decoded.
      39545b9c
    • Kirill Smelkov's avatar
      go/neo/proto: Kill outdated TODO · aa16f0f2
      Kirill Smelkov authored
      - Regrouping messages would change their message codes, thus introducing
        backward compatibility breakage.
      
      - The protocol itself is currently kind-of documented in separate
        document here:
      
        https://neo.nexedi.com/P-NEO-Protocol.Specification.2019?portal_skin=CI_slideshow
      aa16f0f2
    • Kirill Smelkov's avatar
      go/neo/proto: Unexport Msg.NEOMsgCode · ea797d9e
      Kirill Smelkov authored
      It is internal detail that ideally should not get outside of proto
      package. Don't clutter documentation of all messages with it.
      
      -> For now access message code via proto.MsgCode(msg) from outside.
      ea797d9e
    • Kirill Smelkov's avatar
      . · 1e468ff0
      Kirill Smelkov authored
      1e468ff0
    • Kirill Smelkov's avatar
      . · 48d45970
      Kirill Smelkov authored
      48d45970
    • Kirill Smelkov's avatar
      . · 2e89e301
      Kirill Smelkov authored
      2e89e301
    • Kirill Smelkov's avatar
      . · e49e8544
      Kirill Smelkov authored
      e49e8544
    • Kirill Smelkov's avatar
      . · 2571af8d
      Kirill Smelkov authored
      2571af8d
    • Kirill Smelkov's avatar
      . · bee7e8f5
      Kirill Smelkov authored
      bee7e8f5
    • Kirill Smelkov's avatar
      go/neo/proto: protogen: Reuse sizer for typeSizeFixed · e7a58934
      Kirill Smelkov authored
      Generating code through sizer can already give answer if a type is fixed
      size or not. And in practice we don't care at all if it will be a bit
      slower compared to previous explicit type switch.
      
      For current code it is just a small cleanup, and it will be handy to
      support messagepack encoding as well.
      
      No change in generated code.
      e7a58934