Skip to content
This repository was archived by the owner on Sep 15, 2020. It is now read-only.
This repository was archived by the owner on Sep 15, 2020. It is now read-only.

const in node.go is fragile to reordering #713

Open

Description

@thedavidmeister

Noticed in #698

git__ ___go_src_github_com_holochain_holochain-proto

In node.go the constants are grouped by purpose, e.g. "DHT messages", "Validate messages", etc.

But the value of the constants is determined by their ordering.

For example, adding MIGRATE_REQUEST before PUT_REQUEST causes tests to fail due to PUT_REQUEST changing from 2 to 3.

Most of the constants have no tests ensuring their value, so a change of order can accidentally revalue some or all the constants.

These constants should ideally not be changing across versions.

Activity

  1. zippy commented on May 21, 2018

    @zippy
    Member

    Yes, this is true. They get a sequence value from the iota, and they actually are very sensitive because they implicitly part of the line protocol as remote nodes use the values to figure out which network action is meant. In a way the current tests which use "%v" to print out the values of a packet actually do test this correctly in that they make your code break if you change the ordering. They just don't do so explicitly so that you know what happened.

  2. thedavidmeister commented on May 21, 2018

    @thedavidmeister
    ContributorAuthor

    there are explicit tests in #698 at least for these consts

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions

      ⌂ 换网址