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

Sprouts and mature nodes need a single attribute for the value of "domain" #2356

Closed
derekpierre opened this issue Oct 13, 2020 · 1 comment · Fixed by #2423
Closed

Sprouts and mature nodes need a single attribute for the value of "domain" #2356

derekpierre opened this issue Oct 13, 2020 · 1 comment · Fixed by #2423
Assignees
Labels
Bug 🐛 Broken functionality

Comments

@derekpierre
Copy link
Member

The following occurs on the network status monitor which uses forgetful node storage:

File "/Users/derek/Documents/Github/repos/monitor/nucypher-monitor/monitor/crawler.py", line 328, in learn_from_teacher_node
    new_nodes = super().learn_from_teacher_node(*args, **kwargs)
  File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/nucypher/network/nodes.py", line 764, in learn_from_teacher_node
    remembered_seednodes = self.load_seednodes(record_fleet_state=False)
  File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/nucypher/network/nodes.py", line 339, in load_seednodes
    nodes_restored_from_storage = self.read_nodes_from_storage() if read_storage else []
  File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/nucypher/network/nodes.py", line 353, in read_nodes_from_storage
    node_domain = node.domain.decode('utf-8')
builtins.AttributeError: 'Ursula' object has no attribute 'domain'

Discord conversation:

derek09/29/2020
@dnunez it's forgetful. It's the monitor's SQLiteForgetfulStorage

dnunez09/29/2020
Right.... So that must be it
The type of nodes that storages fetch are different. That's actually not a good API...

...

dnunez09/30/2020
@jMyles @derek the thing is that sprouts have domain but matured nodes don't, as they use it to construct the serving_domain attribute. Maybe we should simplify that and just have domain ?

jMyles09/30/2020
Absolutely.
For a primordial variant of a polymorhpic class to have an attribute that is not either an attribute or a method on a commensurate evolved variant is an antipattern.
In my opinion.

derek09/30/2020
:thumbsup: Agreed!
@derekpierre derekpierre added the Bug 🐛 Broken functionality label Oct 13, 2020
@derekpierre derekpierre modified the milestones: Before activating StakersEscrow, Mainnet Month 1 Oct 13, 2020
@derekpierre
Copy link
Member Author

@cygnusv running into the related problem with the status monitor using nucypher 3.0.0b4. Instead of domain it is now learning_domain.

  File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/nucypher/cli/options.py", line 163, in wrapper
    return func(**kwargs)
  File "/Users/derek/Documents/Github/repos/monitor/nucypher-monitor/monitor/cli/main.py", line 96, in crawl
    influx_port=influx_port)
  File "/Users/derek/Documents/Github/repos/monitor/nucypher-monitor/monitor/crawler.py", line 261, in __init__
    *args, **kwargs)
  File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/nucypher/network/nodes.py", line 251, in __init__
    self.remember_node(node, eager=True)
  File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/nucypher/network/nodes.py", line 393, in remember_node
    self.node_storage.store_node_metadata(node=node)
  File "/Users/derek/Documents/Github/repos/monitor/nucypher-monitor/monitor/crawler.py", line 58, in store_node_metadata
    self.__write_node_metadata(node)
  File "/Users/derek/Documents/Github/repos/monitor/nucypher-monitor/monitor/crawler.py", line 98, in __write_node_metadata
    node_dict = node.node_details(node=node)
  File "/Users/derek/.local/share/virtualenvs/nucypher-monitor-3hnjUmmD/lib/python3.7/site-packages/nucypher/network/nodes.py", line 1385, in node_details
    "domain": node.learning_domain,
AttributeError: 'Ursula' object has no attribute 'learning_domain'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug 🐛 Broken functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants