Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

privx_findOnChainPrivacyGroup returns incorrect results #380

Open
akuanti opened this issue Apr 6, 2020 · 2 comments
Open

privx_findOnChainPrivacyGroup returns incorrect results #380

akuanti opened this issue Apr 6, 2020 · 2 comments
Labels

Comments

@akuanti
Copy link

akuanti commented Apr 6, 2020

Instead of returning the privacy groups with the given member, it seems to return all privacy groups including the given member.

Steps to Reproduce (Bug)

  1. Create an on-chain privacy group with members [A]
  2. Create another on-chain privacy group with members [A, B]
  3. Call privx_findOnChainPrivacyGroup with members [A] from member A
  4. Call privx_findOnChainPrivacyGroup with members [A] from member B

Expected behavior:
3. should return a single privacy group with members [A]
4. should return an empty list []

Actual behavior:
3. returns both the group with members [A] and the group with members [A, B]
4. returns the group with members [A, B]

Versions (Add all that apply)

  • Software version: besu/v1.4.2/osx-x86_64/oracle_openjdk-java-13
  • Java version:
    openjdk version "13.0.2" 2020-01-14
    OpenJDK Runtime Environment (build 13.0.2+8)
    OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)
  • Kernel Version: Darwin computer.local 18.7.0 Darwin Kernel Version 18.7.0: Thu Jan 23 06:52:12 PST 2020; root:xnu-4903.278.25~1/RELEASE_X86_64 x86_64

Additional Information

Test script output

creating group with members [ 'GGilEkXLaQ9yhhtbpBT03Me9iYa7U/mWXxrJhnbl1XY=' ] noZJxd7qhBHm7zq0wpvNGbQ9l9gl2YING52O2f85nEU=
Waiting for transaction to be mined ...
0x73beb851693086d04497d303e81eaeecb037c03d5032dd038de032cbf8e857a6
creating group with members [ 'GGilEkXLaQ9yhhtbpBT03Me9iYa7U/mWXxrJhnbl1XY=',
  'KkOjNLmCI6r+mICrC6l+XuEDjFEzQllaMQMpWLl4y1s=' ] j4OLTazWAEpUN4QgWjZ3bJbBbwpvvInAJmmVhEvOa2s=
Waiting for transaction to be mined ...
0x703205056e3622003beff9916cfcf07c17d549949728168d00b4cdb9aaa65c48

Finding privacy groups
-- find with single member
from node 1:

>>> { jsonrpc: '2.0',
  method: 'privx_findOnChainPrivacyGroup',
  params: [ [ 'GGilEkXLaQ9yhhtbpBT03Me9iYa7U/mWXxrJhnbl1XY=' ] ],
  id: 1 }
<<< [ { privacyGroupId: 'j4OLTazWAEpUN4QgWjZ3bJbBbwpvvInAJmmVhEvOa2s=',
    name: '',
    description: '',
    type: 'ONCHAIN',
    members:
     [ 'GGilEkXLaQ9yhhtbpBT03Me9iYa7U/mWXxrJhnbl1XY=',
       'KkOjNLmCI6r+mICrC6l+XuEDjFEzQllaMQMpWLl4y1s=' ] },
  { privacyGroupId: 'noZJxd7qhBHm7zq0wpvNGbQ9l9gl2YING52O2f85nEU=',
    name: '',
    description: '',
    type: 'ONCHAIN',
    members: [ 'GGilEkXLaQ9yhhtbpBT03Me9iYa7U/mWXxrJhnbl1XY=' ] } ]

from node 2:

>>> { jsonrpc: '2.0',
  method: 'privx_findOnChainPrivacyGroup',
  params: [ [ 'GGilEkXLaQ9yhhtbpBT03Me9iYa7U/mWXxrJhnbl1XY=' ] ],
  id: 1 }
<<< [ { privacyGroupId: 'j4OLTazWAEpUN4QgWjZ3bJbBbwpvvInAJmmVhEvOa2s=',
    name: '',
    description: '',
    type: 'ONCHAIN',
    members:
     [ 'GGilEkXLaQ9yhhtbpBT03Me9iYa7U/mWXxrJhnbl1XY=',
       'KkOjNLmCI6r+mICrC6l+XuEDjFEzQllaMQMpWLl4y1s=' ] } ]

-- find with both members
from node 1:

>>> { jsonrpc: '2.0',
  method: 'privx_findOnChainPrivacyGroup',
  params:
   [ [ 'GGilEkXLaQ9yhhtbpBT03Me9iYa7U/mWXxrJhnbl1XY=',
       'KkOjNLmCI6r+mICrC6l+XuEDjFEzQllaMQMpWLl4y1s=' ] ],
  id: 1 }
<<< [ { privacyGroupId: 'j4OLTazWAEpUN4QgWjZ3bJbBbwpvvInAJmmVhEvOa2s=',
    name: '',
    description: '',
    type: 'ONCHAIN',
    members:
     [ 'GGilEkXLaQ9yhhtbpBT03Me9iYa7U/mWXxrJhnbl1XY=',
       'KkOjNLmCI6r+mICrC6l+XuEDjFEzQllaMQMpWLl4y1s=' ] } ]

@akuanti
Copy link
Author

akuanti commented Apr 14, 2020

This appears to be intended behavior. On-chain and off-chain privacy groups have different behavior.

For off-chain groups, find returns the visible groups that have exactly the specified members, or the empty list.

For on-chain groups, find returns the visible groups filtered by the specified list of members. Passing the empty list does no filtering, and returns all the groups the node's Orion public key belongs to. Passing a list with keys [A, B] filters this list for groups containing all the specified members.
If groups [A], [A,B], and [B] exist, then

  • find(A, []) -> [A], [A, B] (no filter)
  • find(A, [A]) -> [A], [A, B] (groups containing A, equivalent to no filter)
  • find(A, [B]) -> [A, B] (groups containing B)
  • find(A, [A, B]) -> [A, B] (groups containing A and B)
  • find(B, []) -> [B], [A, B] (no filter)
  • find(B, [A]) -> [A, B] (groups containing A)
  • find(B, [B]) -> [B], [A, B] (groups containing B, equivalent to no filter)
  • find(B, [A, B]) -> [A, B] (groups containing A and B)
  • find(C, *) -> [] (no filter)

@MadelineMurray
Copy link
Contributor

I'm going to move this to a docs ticket so we can make this expected behaviour clear.

@MadelineMurray MadelineMurray transferred this issue from hyperledger/besu May 25, 2020
@MadelineMurray MadelineMurray self-assigned this May 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants