Skip to content

refactor(metadata): pre-refactors for migrating feature states to static metadata [part 3/12] #1016

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

Merged
merged 1 commit into from
Aug 27, 2024

Conversation

glevco
Copy link
Contributor

@glevco glevco commented May 3, 2024

Depends on #1014


Motivation

Continuing with the static metadata refactor introduced in PRs #1013 and #1014, the next step is to move the feature_states attribute from metadata to static metadata.

This was initially implemented in PR #1015, which turned out to be too large, so it was divided into 3 PRs: this one, #1017, and #1018. The latter is the one that actually moves the feature_states attribute, and the first two PRs perform simple refactors that were either necessary or small improvements.

Therefore, this PR simply performs some pre-refactors to debloat the main PR.

Acceptance Criteria

  • IMPORTANT: move verify_aux_pow() verification from verify_without_storage() to verify().
  • Rename FeatureService.get_bits_description() to get_feature_infos(), and FeatureDescription to FeatureInfo.
  • Change FeatureService._get_ancestor_at_height() to assert that a block exists in the height index when it must.
  • Update the FeatureState enum to be a unique string enum, like Feature (this will be important for serialization), and implement is_active().
  • Change static metadata dataclasses to BaseModels instead, which will be necessary for (de)serialization.
  • Other smaller improvements.

Checklist

  • If you are requesting a merge into master, confirm this code is production-ready and can be included in future releases as soon as it gets merged

@glevco glevco added the refactor label May 3, 2024
@glevco glevco self-assigned this May 3, 2024
@glevco glevco force-pushed the refactor/metadata/clean-up-refactors-3 branch 9 times, most recently from 8ca2d7a to 4fcfecc Compare May 3, 2024 17:47
@glevco glevco changed the title wip refactor(metadata): pre-refactors for migrating feature states to static metadata May 3, 2024
@glevco glevco force-pushed the refactor/metadata/clean-up-refactors-3 branch 4 times, most recently from dafeaf5 to b560a03 Compare May 3, 2024 18:20
@glevco glevco changed the title refactor(metadata): pre-refactors for migrating feature states to static metadata refactor(metadata): pre-refactors for migrating feature states to static metadata [part 3a] May 3, 2024
@glevco glevco changed the title refactor(metadata): pre-refactors for migrating feature states to static metadata [part 3a] refactor(metadata): pre-refactors for migrating feature states to static metadata [part 3] May 3, 2024
Copy link

codecov bot commented May 3, 2024

Codecov Report

Attention: Patch coverage is 92.50000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 84.59%. Comparing base (da32f80) to head (112d6dc).

Files Patch % Lines
hathor/feature_activation/model/feature_state.py 80.00% 1 Missing ⚠️
hathor/transaction/storage/rocksdb_storage.py 50.00% 1 Missing ⚠️
hathor/verification/block_verifier.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1016      +/-   ##
==========================================
- Coverage   84.62%   84.59%   -0.04%     
==========================================
  Files         317      317              
  Lines       24150    24150              
  Branches     3665     3662       -3     
==========================================
- Hits        20438    20429       -9     
- Misses       3006     3011       +5     
- Partials      706      710       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@glevco glevco marked this pull request as ready for review May 3, 2024 20:51
@glevco glevco requested review from jansegre and msbrogli as code owners May 3, 2024 20:51
@glevco glevco force-pushed the refactor/metadata/migrate-static-metadata-2 branch from 9e960f7 to a43cb95 Compare May 3, 2024 21:40
@glevco glevco force-pushed the refactor/metadata/clean-up-refactors-3 branch from b560a03 to 3381848 Compare May 3, 2024 21:40
@glevco glevco force-pushed the refactor/metadata/migrate-static-metadata-2 branch 2 times, most recently from bd946c3 to d76939e Compare May 10, 2024 01:51
@glevco glevco force-pushed the refactor/metadata/clean-up-refactors-3 branch from 1d39805 to 00b7ce1 Compare August 16, 2024 18:01
@glevco glevco force-pushed the refactor/metadata/migrate-static-metadata-2 branch 2 times, most recently from 7e7fdc8 to 31f9b03 Compare August 19, 2024 16:27
@glevco glevco force-pushed the refactor/metadata/clean-up-refactors-3 branch from 00b7ce1 to 9e9b5a5 Compare August 19, 2024 16:29
@glevco glevco force-pushed the refactor/metadata/migrate-static-metadata-2 branch 2 times, most recently from a4e34f1 to 8d4f344 Compare August 19, 2024 19:08
@glevco glevco force-pushed the refactor/metadata/clean-up-refactors-3 branch 2 times, most recently from 069f959 to a95006a Compare August 19, 2024 19:46
@glevco glevco force-pushed the refactor/metadata/migrate-static-metadata-2 branch 8 times, most recently from fcbcac1 to 701b787 Compare August 22, 2024 16:35
Base automatically changed from refactor/metadata/migrate-static-metadata-2 to master August 22, 2024 17:30
@glevco glevco force-pushed the refactor/metadata/clean-up-refactors-3 branch from a95006a to 58fdabf Compare August 22, 2024 17:35
Copy link

github-actions bot commented Aug 22, 2024

🐰Bencher

ReportFri, August 23, 2024 at 21:40:23 UTC
Projecthathor-core
Branchrefactor/metadata/clean-up-refactors-3
Testbedubuntu-22.04
Click to view all benchmark results
BenchmarkLatencyLatency Results
nanoseconds (ns) | (Δ%)
Latency Lower Boundary
nanoseconds (ns) | (%)
Latency Upper Boundary
nanoseconds (ns) | (%)
sync-v2 (up to 20000 blocks)✅ (view plot)101,529,965,611.26 (-0.90%)92,204,136,196.06 (90.81%)112,693,944,239.63 (90.09%)

Bencher - Continuous Benchmarking
View Public Perf Page
Docs | Repo | Chat | Help

@glevco glevco force-pushed the refactor/metadata/clean-up-refactors-3 branch from 58fdabf to 112d6dc Compare August 23, 2024 21:37
@glevco glevco merged commit 5bb5dba into master Aug 27, 2024
13 checks passed
@glevco glevco deleted the refactor/metadata/clean-up-refactors-3 branch August 27, 2024 14:23
@jansegre jansegre mentioned this pull request Oct 4, 2024
2 tasks
@jansegre jansegre mentioned this pull request Dec 11, 2024
2 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants