You Sign Me (Geth EIP-191 "E" Support); Controller, CLI Bug Fixes#1031
You Sign Me (Geth EIP-191 "E" Support); Controller, CLI Bug Fixes#1031KPrasch merged 23 commits intonucypher:hawksbeardfrom
Conversation
Codecov Report
@@ Coverage Diff @@
## hawksbeard #1031 +/- ##
===============================================
+ Coverage 72.88% 83.03% +10.14%
===============================================
Files 67 67
Lines 8642 8658 +16
===============================================
+ Hits 6299 7189 +890
+ Misses 2343 1469 -874
Continue to review full report at Codecov.
|
… strings in EthereumTester and Parity.
…nal test bug fixes, found missing assertions.
…ke Ursula display name a class attr
…ockchain-alice node discovery test.
…n CI until a better solution is found.
…e in reward integration cli test.
| client_kwargs = { | ||
| 'node_technology': node_technology, | ||
| 'version': client_data[1], | ||
| 'backend': client_data[-1], |
| raise NotImplementedError | ||
|
|
||
| def unlockAccount(self, address, password): | ||
| def unlock_account(self, address, password) -> bool: |
There was a problem hiding this comment.
I like this convention of using underscore_methods to make them obviously distinct from w3 calls
|
|
||
| def __repr__(self): | ||
| r = "({})⇀{}↽ ({})" | ||
| r = self._display_name_template |
|
|
||
| def derive_policy_encrypting_key(self, label: bytes) -> dict: | ||
| policy_encrypting_key = self.character.get_policy_pubkey_from_label(label) | ||
| policy_encrypting_key = self.character.get_policy_encrypting_key_from_label(label) |
There was a problem hiding this comment.
these name changes make it much clearer to me what is going on here!
💯
| 'bob_encrypting_key': bob_encrypting_key, | ||
| 'bob_verifying_key': bob_verifying_key, | ||
| 'label': b64encode(label.encode()).decode(), | ||
| 'label': label, |
| """ | ||
| return keccak_digest(bytes(self._verifying_key) + bytes(self._hrac)).hex() | ||
| _id = keccak_digest(bytes(self._verifying_key) + bytes(self._hrac)).hex() | ||
| return _id |
vepkenez
left a comment
There was a problem hiding this comment.
No new features, tons of cleanup and readability improvements.
Awesome.
| # Needed for on-chain verification | ||
| if not self.federated_only: | ||
| self.blockchain = blockchain or Blockchain.connect() | ||
| self.miner_agent = MinerAgent(blockchain=blockchain) |
There was a problem hiding this comment.
This logic is somewhat weird, since all characters, even Enrico will get a miner agent. But for the moment I guess it's OK!
Perhaps a TODO?
| raise InvalidSignature("Signature for message isn't valid: {}".format(signature_to_use)) | ||
| else: | ||
| raise self.InvalidSignature("No signature provided -- signature presumed invalid.") | ||
| raise InvalidSignature("No signature provided -- signature presumed invalid.") |
There was a problem hiding this comment.
Why are we changing here the type of InvalidSignature? Previous one was our own, and now it's the one from the cryptography, even if the Signature is ours.
| signature=message_kit.signature, | ||
| decrypt=True, | ||
| label=label | ||
| )] |
There was a problem hiding this comment.
Why are we returning here a list of cleartexts, when message_kit always corresponds to a single message?
I know that Bob.retrieve() returns a list of cleartexts, but only because it's associated to WorkOrders, which may have more than one capsule (although currently they don't).
This may not be an issue to solve here, but perhaps we should consider a better API for retrieve/decrypt methods: it doesn't make any sense to have methods that accept only a single capsule, but that output a list of cleartexts (of length 1). Either we make the input also a list, or we return the only cleartext.
There was a problem hiding this comment.
That's true: some hackathon participants wondered about the same thing
| 'bob_encrypting_key': bob_encrypting_key, | ||
| 'bob_verifying_key': bob_verifying_key, | ||
| 'label': b64encode(label.encode()).decode(), | ||
| 'label': label, |
| # TODO 341 - what if we already have this TreasureMap? | ||
| this_node.treasure_maps[keccak_digest(binascii.unhexlify(treasure_map_id))] = treasure_map | ||
| treasure_map_index = bytes.fromhex(treasure_map_id) | ||
| this_node.treasure_maps[treasure_map_index] = treasure_map |
| checksum_public_address=testerchain.alice_account, | ||
| network_middleware=MockRestMiddleware(), | ||
| known_nodes=blockchain_ursulas, | ||
| known_nodes=blockchain_ursulas[:-1], # TODO: 1035 |
Co-Authored-By: David Núñez <david@nucypher.com>
w3.eth.signin NuCypher client abstractions