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

Efficient pool info parsing #80

Merged
merged 9 commits into from
Jul 19, 2023
Merged

Conversation

dimkarakostas
Copy link
Member

Depends on #79

@dimkarakostas dimkarakostas force-pushed the efficient_pool_info_parsing branch from dd22c85 to d2a5a52 Compare July 19, 2023 08:43
@dimkarakostas dimkarakostas changed the title Efficient pool info parsing [WIP] Efficient pool info parsing Jul 19, 2023
@dimkarakostas dimkarakostas force-pushed the efficient_pool_info_parsing branch from 9a95c9e to 6255b8c Compare July 19, 2023 09:53
@dimkarakostas dimkarakostas changed the title [WIP] Efficient pool info parsing Efficient pool info parsing Jul 19, 2023
@dimkarakostas dimkarakostas force-pushed the efficient_pool_info_parsing branch from 6255b8c to 90ba9f5 Compare July 19, 2023 10:00
for info in coinbase_tags.values():
known_entities.add(info['name'])
except FileNotFoundError:
coinbase_tags = {}
Copy link
Member

Choose a reason for hiding this comment

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

Is this needed? We could just use pass if we don't want anything to happen in case of an exception

for cluster in clusters.keys():
known_entities.add(cluster)
except FileNotFoundError:
clusters = {}
Copy link
Member

Choose a reason for hiding this comment

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

Same as L78

for address_info in pool_addresses.values():
known_entities.add(address_info['name'])
except FileNotFoundError:
pool_addresses = {}
Copy link
Member

Choose a reason for hiding this comment

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

Same as L78 and L86

"""
try:
with open(HELPERS_DIR / f'pool_information/coinbase_tags/{project_name}.json') as f:
pool_data = json.load(f)
Copy link
Member

Choose a reason for hiding this comment

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

not important but pool_tags would be a more suitable name for this variable

@@ -44,8 +44,23 @@ def test_map(setup_and_cleanup):
pool_info_dir, test_input_dir, test_output_dir = setup_and_cleanup
project = 'sample_bitcoin'

shutil.copy2(str(pool_info_dir / 'bitcoin.json'),
str(pool_info_dir / f'{project}.json')) # Create a temp pool info file for sample
try:
Copy link
Member

Choose a reason for hiding this comment

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

I don't think it's good practice to use try-except blocks in tests, but I also don't mind leaving these for now as long as we update them when we refactor tests more broadly, e.g. for #53

@@ -17,45 +17,57 @@ coinbase addresses, so it doesn't perform any extra processing on the raw data.

## Pool Information

To assist the mapping process, the directory `helpers/pool_information/` contains files named `<project_name>.json`, with
relevant pool information, structured as follows:
To assist the mapping process, the directory `helpers/pool_information/` contains
Copy link
Member

Choose a reason for hiding this comment

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

trailing sentence

docs/mappings.md Outdated
There exist three subdirectories. In each subdirectory there exists a file for
the corresponding ledger data, if such data exists.

`coinbase_tags` defines information about pools and miners. Each key
Copy link
Member

Choose a reason for hiding this comment

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

I would say information about "block creators" as it is captures more systems. We can keep pools and miners as examples in brackets.

@dimkarakostas dimkarakostas force-pushed the efficient_pool_info_parsing branch from 1e1c6fe to 23813c4 Compare July 19, 2023 11:09
@LadyChristina LadyChristina self-requested a review July 19, 2023 11:18
Copy link
Member

@LadyChristina LadyChristina left a comment

Choose a reason for hiding this comment

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

LGTM

@LadyChristina LadyChristina merged commit d6b1452 into main Jul 19, 2023
@LadyChristina LadyChristina deleted the efficient_pool_info_parsing branch July 19, 2023 11:19
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.

2 participants