Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in / Register
  • N neoppod
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 0
    • Issues 0
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Levin Zimmermann
  • neoppod
  • Repository

Switch branch/tag
  • neoppod
  • go
  • neo
  • proto
  • proto.go
Find file BlameHistoryPermalink
  • Kirill Smelkov's avatar
    fixup! proto.NotPrimaryMaster: Fix .Primary data type (2) · 43c19d59
    Kirill Smelkov authored Aug 01, 2023
    Change .Promary type from int8 back to int32.
    
    5d93e434 says that .Primary type is not NodeID. That is true, but
    changing it to int8 was a mistake:
    
    1. PSignedNull is explicitly defined to come with '!l' struct code, which
       according to https://docs.python.org/3/library/struct.html#module-struct
       comes as 4-bytes integer on the wire:
    
       https://lab.nexedi.com/nexedi/neoppod/blob/v1.12-13-gf2ea4be2/neo/lib/protocol.py#L560-562
    
    2. verifying this via serializing NotPrimaryMaster on NEO/py also
       confirms that .Primary occupies 4 bytes, not one:
    
       In [1]: from neo.lib.protocol import NotPrimaryMaster
    
       In [2]: NotPrimaryMaster(0x01020304, [('m111', 111), ('m222', 222)])._body
       Out[2]: '\x01\x02\x03\x04\x00\x00\x00\x02\x00\x00\x00\x04m111\x00o\x00\x00\x00\x04m222\x00\xde'
                ^^^^^^^^^^^^^^^^
                NOTE  NOTE  NOTE
    
    -> change .Primary type back to being 4-bytes integer, but to int32
    instead of NodeID because, as 5d93e434 correctly says, .Primary comes as
    array index, not a node ID. The following place of NEO/py code
    explicitly confirms this:
    
    https://lab.nexedi.com/nexedi/neoppod/blob/v1.12-13-gf2ea4be2/neo/master/handlers/identification.py#L155-159
    
    Add corresponding test.
    43c19d59

Replace proto.go

Attach a file by drag & drop or click to upload


Cancel
GitLab will create a branch in your fork and start a merge request.
GitLab Nexedi Edition | About GitLab | About Nexedi | 沪ICP备2021021310号-2 | 沪ICP备2021021310号-7