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

Share claims with gossiped peers #12

Merged
merged 5 commits into from
Apr 17, 2018
Merged

Conversation

azul
Copy link
Member

@azul azul commented Apr 16, 2018

use gossiped cc info to share claims in replies

We achieve this by registering peers based on gossip.
However currently this will overwrite their cc info without
checking for consistency. (#13)

fixes #7
fixes #8

azul added 3 commits April 13, 2018 09:49
This way recipients of gossip can also look up the other
recipients chains and share claims with them right away.
register_peer will store the peers cc info so we can share
claims with them later.
add_claim now expects a reader argument with the addr of
the reader

This way we have high level functions in the plugin hooks
and push the implementation details of how we store the
info about peer claim chains down to helper functions

In order to keep the old tests in test_plugin that work
without the autocrypt specific semantics we allow handing
in the public key in register_peer rather than looking
it up from the peers claim chain.

This also allows us to still run these tests based on
dicts as stores.
We achieve this by registering peers based on gossip.
However currently this will overwrite their cc info without
checking for consistency.
@azul
Copy link
Member Author

azul commented Apr 16, 2018

tests are failing because this depends on hpk42/muacrypt#66

azul added 2 commits April 16, 2018 11:38
We had two equivalent uses of read_claim:
cc1.read_claim(asdf, chain=cc2)
cc2.read_claim(asdf, reader=cc1)

Besides being confusing in itself it also requires entire
chains as the reader so we can do reader.params.
This is inconsistent with our usage of reader in add_claim
which requires the readers addr and the reader being registered.
This way we can share all claims with a peer in one go
@azul
Copy link
Member Author

azul commented Apr 17, 2018

Interesting... the push test seem to be failing because of issues with claim integrity:

    def test_claim_headers_in_encrypted_mail(account_maker):
        acc1, acc2 = account_maker(), account_maker()
        send_mail(acc1, acc2)
    
>       dec_msg = send_encrypted_mail(acc2, acc1)[1].dec_msg
tests/test_functional.py:25: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
tests/test_functional.py:96: in send_encrypted_mail
    enc_msg = sender.encrypt_mime(msg, [r.addr for r in recipients]).enc_msg
.tox/py27/src/muacrypt/muacrypt/account.py:436: in encrypt_mime
    _account=self,
.tox/py27/local/lib/python2.7/site-packages/pluggy/__init__.py:617: in __call__
    return self._hookexec(self, self._nonwrappers + self._wrappers, kwargs)
.tox/py27/local/lib/python2.7/site-packages/pluggy/__init__.py:222: in _hookexec
    return self._inner_hookexec(hook, methods, kwargs)
.tox/py27/local/lib/python2.7/site-packages/pluggy/__init__.py:216: in <lambda>
    firstresult=hook.spec_opts.get('firstresult'),
.tox/py27/local/lib/python2.7/site-packages/muacryptcc/plugin.py:71: in process_before_encryption
    self.commit_to_chain()
.tox/py27/local/lib/python2.7/site-packages/muacryptcc/plugin.py:144: in commit_to_chain
    self.head = self.state.commit(chain)
.tox/py27/src/claimchain/claimchain/state.py:129: in commit
    tree = _build_tree(tree_store, enc_items_map)
.tox/py27/src/claimchain/claimchain/utils/profiling.py:37: in wrapped
    return func(*args, **kwargs)
.tox/py27/src/claimchain/claimchain/state.py:68: in _build_tree
    store = ObjectStore(store)
.tox/py27/src/claimchain/claimchain/utils/wrappers.py:38: in __init__
    _check_hash(lookup_key, value)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
key = '\x89\xa0\x02\xef\x16\x12!\xa5\xee\xcf\xdd\xaac\xae6\xff\xb1K!)\xa4\xafgj\xa3\x82\x92\x1e\xc1n\xa5\xf2'
value = <hippiehug.Chain.Block instance at 0x7fe1ef02d518>
    def _check_hash(key, value):
        if value.hid != key:
>           raise ValueError('Hash of the value is not the lookup key')
E           ValueError: Hash of the value is not the lookup key

We saw similar issues before gdanezis/rousseau-chain#5

@azul
Copy link
Member Author

azul commented Apr 17, 2018

Looks like that failure is non deterministic too.

@hpk42
Copy link
Collaborator

hpk42 commented Apr 17, 2018

looks good!

@hpk42 hpk42 merged commit e107b00 into master Apr 17, 2018
@hpk42 hpk42 deleted the share-claims-with-gossiped-peers branch April 17, 2018 12:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants