Skip to content

Improving restoration of store nodes metadata#2265

Merged
cygnusv merged 10 commits intonucypher:blue-oyster-mushroomsfrom
cygnusv:fistro
Sep 22, 2020
Merged

Improving restoration of store nodes metadata#2265
cygnusv merged 10 commits intonucypher:blue-oyster-mushroomsfrom
cygnusv:fistro

Conversation

@cygnusv
Copy link
Member

@cygnusv cygnusv commented Sep 17, 2020

This PR demonstrates that currently it's possible to learn about nodes from a different domain when they are recovered from storage, which can happen for example when a staker reuses the configuration from a testnet. It then fixes it by introducing a simple domain check when restoring nodes from disk, ignoring nodes that don't belong to current domain.

Closes #1843
Closes #1623

@cygnusv cygnusv marked this pull request as ready for review September 20, 2020 17:00
@cygnusv cygnusv changed the title [WIP] Improving restoration of store nodes metadata Improving restoration of store nodes metadata Sep 20, 2020
@KPrasch
Copy link
Member

KPrasch commented Sep 21, 2020

Needs rebase over upstream/blue-oyster-mushrooms to resolve conflicts.

uris.extend(hardcoded_uris)

return uris
# TODO: This module seems unused
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 - This was originally intended to be a dehydration method for CLI and API actions, like loading up a collection of stranger-Ursulas before having instantiated yourself. I recall discussing with @jMyles recently about this. Perhaps it's been integrated via TI?

#
#
#
# def aggregate_seednode_uris(domains: set, highest_priority: Optional[List[str]] = None) -> List[str]:
Copy link
Member

@KPrasch KPrasch Sep 21, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This function in particular is very cooluseful, IMO. I'd like to preserve the functionality instead of deprecate it.

# uris = highest_priority or list()
# for domain in domains:
#
# # 2 - Static nodes from JSON file
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:-(

if self._actual_rest_app is None:
self._actual_rest_app, _datastore = make_rest_app(db_filepath=tempfile.mkdtemp(),
this_node=self.this_node,
serving_domains=(None,))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks goodness this was cleaned up. 😆

@cygnusv cygnusv force-pushed the blue-oyster-mushrooms branch from cf8913f to 395135f Compare September 22, 2020 07:56
Co-authored-by: Derek Pierre <derek.pierre@gmail.com>
Copy link
Member

@derekpierre derekpierre left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎸


# Metadata
self.__temp_metadata_dir = tempfile.mkdtemp(prefix="nucypher-tmp-nodes-")
self.__temp_metadata_dir = str(Path(self.__temp_root_dir) / "metadata")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤩

@cygnusv cygnusv merged commit 5049b40 into nucypher:blue-oyster-mushrooms Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants