Conversation
88bef72 to
598f7db
Compare
8ccfce4 to
65bd36a
Compare
9ae1bbf to
0e12b22
Compare
400f8cf to
0cb5484
Compare
52bc78d to
63cf84d
Compare
d7db4ee to
4f99fe6
Compare
70fd8db to
66a5f32
Compare
66a5f32 to
1a523c5
Compare
2b15a20 to
f708b77
Compare
|
General status update: https://ptb.discordapp.com/channels/411401661714792449/411401661714792451/737147498803757066 |
2132631 to
bde604f
Compare
tests/integration/cli/actions/test_select_client_account_for_staking.py
Outdated
Show resolved
Hide resolved
bb8cc85 to
4f121c3
Compare
e2ae201 to
2f3eeac
Compare
nucypher/blockchain/eth/actors.py
Outdated
| self.is_me = is_me | ||
|
|
||
| self._checksum_address = None # Stake Address | ||
| # self._checksum_address = None # Stake Address # TODO - wait, why? Why are we setting this to None when it may have already been set in an outer method? |
There was a problem hiding this comment.
Did you ever figure this out?
| Base class for Nucypher protocol actors. | ||
| A participant in the cryptological drama (a screenplay, if you like) of NuCypher. | ||
|
|
||
| Characters can represent users, nodes, wallets, offline devices, or other objects of varying levels of abstraction. |
There was a problem hiding this comment.
I... am incredibly opposed to this line. 😂
There was a problem hiding this comment.
I don't know, I just don't agree that a character is accurately described in this line lol.
There was a problem hiding this comment.
Eh? What's inaccurate here?
| assert result | ||
|
|
||
| yield deferToThread(start_lonely_learning_loop) | ||
| # def start_lonely_learning_loop(): |
| @@ -1,6 +1,4 @@ | |||
| version: 2.1 | |||
| orbs: | |||
| codecov: codecov/codecov@1.0.5 | |||
There was a problem hiding this comment.
Are we getting rid of codecov altogether? Os was this just a temporary measure because it was crazy the other day?
| Base class for Nucypher protocol actors. | ||
| A participant in the cryptological drama (a screenplay, if you like) of NuCypher. | ||
|
|
||
| Characters can represent users, nodes, wallets, offline devices, or other objects of varying levels of abstraction. |
| else: | ||
| raise InvalidSignature("Signature for message isn't valid: {}".format(signature_to_use)) | ||
| except (TypeError, AttributeError) as e: | ||
| raise InvalidSignature(f"Unable to verify message from stranger: {stranger}") |
There was a problem hiding this comment.
This block is related to #2203. It's up to you if it requires adding a comment/TODO to signal that.
| target_nodes = [] | ||
| target_hex_match = self.public_keys(DecryptingPower).hex()[1] | ||
| while len(target_nodes) < no_less_than: | ||
| target_nodes = [] |
There was a problem hiding this comment.
| target_nodes = [] |
This line has no effect.
| # Not enough matching nodes. Fine, we'll just publish to the first few. | ||
| try: | ||
| # TODO: This is almost certainly happening in a test. If it does happen in production, it's a bit of a problem. Need to fix #2124 to mitigate. | ||
| target_nodes = list(nodes._nodes.values())[0:6] |
There was a problem hiding this comment.
I think you want to return target_nodes here, right?
| # The good news is that Bob can construct the list easily. | ||
| # And - famous last words incoming - there's no cognizable attack surface. | ||
| # Sure, Bob can mine encrypting keypairs until he gets the set of target Ursulas on which Alice can | ||
| # store a TreasureMap. And then... ???... profit? |
There was a problem hiding this comment.
This algorithm is kind of quirky and I'm not sure it works as the network grows. As far as I understand, the whole point is that Bob recovers roughly the same list of target nodes that Alice selected to store the TMap, correct?
Let's imagine a scenario where initially we have very few nodes. Alice creates a TMap, and since there are few nodes, the algorithm is forced to expand the search boundary a few times. @jMyles plays the Song of Time and we move 1 year to the future, where we have a bigger network; now Bob tries to retrieve the TMap, and since we have more nodes, there's greater probability that there are matches with small search boundaries. This has the effect that some of the initial target nodes are not discovered by Bob.
I don't think however this is a deal-breaker, but perhaps we should open an issue.
There was a problem hiding this comment.
Yes! This is why I questioned the minimization of #2124 in the call yesterday.
There was a problem hiding this comment.
Glad that you already had an issue tracking this :) Let's add a reference here then:
| # store a TreasureMap. And then... ???... profit? | |
| # store a TreasureMap. And then... ???... profit? | |
| # TODO: There's some risk that Bob can't get any of the original target Ursulas - See #2124 |
| work_tracker=work_tracker, | ||
| start_working_now=start_working_now, | ||
| block_until_ready=block_until_ready) | ||
| except (Exception, self.WorkerError): # FIXME |
|
|
||
| if claim_signing_key: | ||
| crypto_power.consume_power_up(SigningPower(pubkey=target_ursula.stamp.as_umbral_pubkey())) | ||
| crypto_power.consume_power_up(SigningPower(public_key=target_ursula.stamp.as_umbral_pubkey())) |
There was a problem hiding this comment.
Interesting. This kwarg was renamed to public_key in June 2019 (8021c71), so this means this line's not tested.
There was a problem hiding this comment.
I guess you can add to the PR description that you're removing codecov from CI and offshoring coverage to sunny Spain, instead.
On second thoughts, let's drop the codecov yanking comment...
There was a problem hiding this comment.
Drop the commit you mean? I'm not sure what to do to fix it. Is codecov serving us? It just gives everything a red x and clogs up the alerts channel.
nucypher/network/nodes.py
Outdated
|
|
||
| learner_deferred = self._learning_task.start(interval=self._SHORT_LEARNING_DELAY, now=now) | ||
| learner_deferred = self._learning_task.start(interval=self._SHORT_LEARNING_DELAY, | ||
| now=now) # TODO: now=now? This block is always False, no? |
There was a problem hiding this comment.
Why your comment? I see several instances where now=False.
There was a problem hiding this comment.
There was a problem hiding this comment.
Yeah, but this is in an else clause of elif now.
nucypher/policy/collections.py
Outdated
| from bytestring_splitter import BytestringSplitter, VariableLengthBytestring, BytestringSplittingError, \ | ||
| BytestringKwargifier | ||
| from constant_sorrow.constants import CFRAG_NOT_RETAINED, NO_DECRYPTION_PERFORMED, NOT_SIGNED | ||
| from constant_sorrow.constants import CFRAG_NOT_RETAINED |
There was a problem hiding this comment.
| from constant_sorrow.constants import CFRAG_NOT_RETAINED |
| from nucypher.characters.lawful import Bob, Character | ||
| from nucypher.crypto.api import keccak_digest, encrypt_and_sign, verify_eip_191 | ||
| from nucypher.crypto.constants import PUBLIC_ADDRESS_LENGTH, KECCAK_DIGEST_LENGTH | ||
| from nucypher.crypto.api import encrypt_and_sign, keccak_digest |
There was a problem hiding this comment.
| from nucypher.crypto.api import encrypt_and_sign, keccak_digest |
| from nucypher.crypto.powers import TransactingPower | ||
| from tests.constants import FEE_RATE_RANGE, INSECURE_DEVELOPMENT_PASSWORD | ||
| from tests.utils.ursula import make_decentralized_ursulas | ||
| from nucypher.crypto.powers import TransactingPower |
There was a problem hiding this comment.
| from nucypher.crypto.powers import TransactingPower |
… at this point. TI merge imminent.
21fce68 to
8dead4d
Compare
7285427 to
546c41d
Compare
A number of old, nagging issues have persisted since the early days of this codebase. A coherent collection of them represents a set of conjoined functionality designed primarily to support development, and specifically the development practices of those days, but create undue complexity for the more mature state of today, particularly in the areas of node discovery, treasure map (or other incidental payload) handling, the logic specific to "firstula" situations, and test logic.
This PR is an attempt to address a large enough subset of these issues to represent a "new normal" for the codebase, without doing so much as to leave readers confused.
What follows is a very high concentration of impact-per-line and issue-days-destroyed.
Faster failing for everyone
It is now much more difficult to accidentally proceed into the logic of any Character's method if that logic will eventually fail because no nodes are available. It is no longer necessary to call
start_learning_loopto achieve failfast functionality. Fixes #2110.Vladimir's comeback
Vladimircan now attempt to store a fraudulentTreasureMapon a targetUrsula. Since we now restrict the size of uploads, this attack might be imagined as splitting up an HD movie into a few thousand small pieces and scattering them across the network.In the course of ensuring that this attack is properly demonstrated and mitigated, all of Vladimir's logic has been refreshed and touched up. This fixes #1075.
Bob's favorite nodes
Where do we store an incidental payload (TreasureMap is the simplest example, but we also want forward-compatibility with others), we do so only on a tiny subset of nodes. These nodes are selected on the basis that the second character in Bob's encrypting trinket matches on of the first few characters of the node's checksum (perhaps soon canonical - see #1995). Fixes #342.
Alice signs maps with her wallet keypair; Ursula verifies against HRAC.
The
do_storelogic for TreasureMaps now includes a check that the map matches a published policy, and that the author of the policy has signed the map. Fixes #429. Fixes #1736.Tests now use "hardcoded teachers" as seed node logic.
This was previously not possible because many tests (and in fact the fixtures) left the
MOCK_KNOWN_URSULAS_CACHEunclean. Now, each test is responsible for this cleanup, and an error is raised by the major fixtures (federated_ursulasandblockchain_ursulas) if the cache is unclean at setup time.New asynchrony patterns
Alice now enacts a Policy using a
NodeEnagementMutex, which performs network operations asynchronously and has two blocking methods - one which returns after five percent completion and another which returns after conclusion.Smaller changes
crosstown_traffic. This fixes node_metadata_exchange basically reinvents parts of remember_node and learn_from_teacher_node #555 and theursula_in_a_houseproblem - though it was never really a problem in the first place; it was a test-specific race condition.Arrangementproposal topropose_arrangementinstead ofconsider_arrangement. Fixes Alice doesn't consider arrangements. She proposes them. #1924.