Skip to content

Enhance mostcommonreply #7

Description

@sh-rn

Currently, XRouter Go parses service nodes' responses using mostcommonreply in order to provide a basic form of “consensus” to users.

Example:

} else {

While this is useful, mostcommonreply conceals aspects material to the security of an XRouter proof. For example, it does not reveal the following:

  • how strong the majority view is
  • whether divergent views are all identical (e.g. in the case of a fork)
  • whether divergent views are diverse (e.g. malicious or misconfigured snodes)

Intended behaviour:

For each response, return the following:

  • mostCommonReply as currently implemented
  • majorityStrength - the strength of the majority view (percentage)
  • divergentReplies the number of nonidentical divergent views (note: this not the number of service nodes that respond with divergent views)

For divergentReplies, XRouter should do roughly the following

  1. hash the response
  2. check whether every hash is identical
  3. if at least 1 hash is nonidentical, then count the number of unique hashes
  4. if the count =1 then there are no divergent views. Return 0.
  5. if the count =2 then there is one view that diverges from the majority. Return 1.
  6. Append to divergentReplies the actual number of hashes counted per unique response, and the responses themselves.

The divergentReplies response could be something like this

"divergentReplies":"15",
"mostCommonReplyCount":"12",
"mostCommonReply":[insert actual response here],
"divergentReply1Count":"2",
"divergentReply1":[insert actual response here],
"divergentReply2Count":"1",
"divergentReply2":[insert actual response here]
}```

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status
    QA

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions