Increasing performance of discovery, verification, metadata validation, and fleet state operations.#1451
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1451 +/- ##
==========================================
- Coverage 84.02% 80.28% -3.75%
==========================================
Files 72 72
Lines 11194 11241 +47
==========================================
- Hits 9406 9025 -381
- Misses 1788 2216 +428
Continue to review full report at Codecov.
|
b20d28e to
294b628
Compare
| # Whoops, we got an Alice, Bob, or someone... | ||
| raise self.NotATeacher(f"{node.__class__.__name__} does not have a certificate and cannot be remembered.") | ||
| # Probably a sprout. | ||
| try: |
There was a problem hiding this comment.
I wonder if it's easier to do it not at try/except but by overriding __getattr__, so that we grow it once we first access the certificate (or maybe something else, too).
Or is it too implicit?
There was a problem hiding this comment.
Yeah, this occurred to me. I thought it was too dramatic and perhaps a premature optimization. I am trying to be somewhat reserved in this PR. But jeez man, if you thought of it independently, that's pretty solid evidence that it's a good idea.
I think if we do it, let's do it all the way down in the bytestring-splitter project.
| # If we're federated only, we assume that all other nodes in our domain are as well. | ||
| node_class.set_federated_mode(federated_only) | ||
| else: | ||
| # What an awful hack. The last convulsions of #466. |
There was a problem hiding this comment.
What's the alternative? Is there an issue for this?
There was a problem hiding this comment.
As far as I'm concerned, #466 is the issue. Do you think there's a need for a distinct one?
nucypher/characters/base.py
Outdated
|
|
||
| def __init__(self, | ||
| domains: Set = None, | ||
| node_class: object = None, |
There was a problem hiding this comment.
Might just be personal preference, but this would be clearer to me if it was known_node_class.
| filepath = mature_node._cert_store_function(certificate=mature_node.certificate) | ||
| mature_node.certificate_filepath = filepath | ||
|
|
||
| self.__class__ = mature_node.__class__ |
There was a problem hiding this comment.
Too much for you?
I mean, I know that polymorphism and meta programming are often lumped in with more magic techniques, but I think there's something elegant about changing the class of the object in place.
| network_middleware=network_middleware) | ||
|
|
||
| except NodeSeemsToBeDown: # TODO: #355 Also catch InvalidNode here? | ||
| except NodeSeemsToBeDown as e: # TODO: #355 Also catch InvalidNode here? |
There was a problem hiding this comment.
That's e for a debugger, right?
There was a problem hiding this comment.
Ahh yes. It can go if you want, but it's an awfully useful place to have one if you're using a debugger.
…ed warning) otherwise.
…important that is.
… it's a demo or something).
…thing terribly interesting about nucypher#1554.

New Node Discovery Stuff
The quickest summary is: Node discovery and validation now happens in three phases - nodes are no longer instantiated en mass when discovery first begins. As such, It is no longer possible to accidentally use an unverified node for discovery, arrangement, and service operations, as any unverified nodes are verified at the time they are used. Discovery of 4,000 nodes now takes no longer than 6 seconds; this time is asserted in a test.
federated_onlyMixed operating modes are no longer possible on an automatic basis. It's of course possible to use the Python API to manually construct a Policy using a mixture of operating modes, but it must be done manually.
federated_onlyis removed as a kwarg in many methods.Ursula) indicating whether instances will assume to be federated.Introducing
NodeSproutA NodeSprout is a thin wrapper around the dict that is produced when splitting the bytes representing a Node, but without instantiating each constituent object.
Advanced substantially but not quite closed:
federated_onlys can be pulled.Remaining major issues:
Newly opened: