refactor(metadata): migrate feature states to static metadata [part 5/12]#1018
Open
refactor(metadata): migrate feature states to static metadata [part 5/12]#1018
Conversation
9a24389 to
2765de7
Compare
This was referenced May 3, 2024
d104751 to
d009d7b
Compare
Merged
1 task
2765de7 to
099613d
Compare
1 task
d009d7b to
4004509
Compare
e27a1dc to
ee046ce
Compare
70c231e to
34a9630
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1018 +/- ##
==========================================
+ Coverage 84.42% 84.44% +0.01%
==========================================
Files 317 318 +1
Lines 24303 24237 -66
Branches 3698 3687 -11
==========================================
- Hits 20519 20467 -52
+ Misses 3070 3050 -20
- Partials 714 720 +6 ☔ View full report in Codecov by Sentry. |
1 task
67120ee to
1303641
Compare
4004509 to
410212e
Compare
1303641 to
5fa770f
Compare
410212e to
1de39c3
Compare
5fa770f to
052ae17
Compare
41536ed to
1bb6e2d
Compare
bd8f15b to
c1f6ea6
Compare
ad55a26 to
f3bf80d
Compare
c1f6ea6 to
337c665
Compare
b2437ce to
ca910a0
Compare
337c665 to
30ad6a7
Compare
ca910a0 to
a904b3f
Compare
30ad6a7 to
a1b267e
Compare
a904b3f to
3659269
Compare
a1b267e to
255b9e7
Compare
3659269 to
e05cca1
Compare
255b9e7 to
6f86959
Compare
e05cca1 to
35e636b
Compare
6f86959 to
927d482
Compare
Base automatically changed from
refactor/metadata/clean-up-refactors-4
to
master
August 27, 2024 15:14
35e636b to
25f5e2d
Compare
|
| Branch | refactor/metadata/migrate-feature-states-5 |
| Testbed | ubuntu-22.04 |
Click to view all benchmark results
| Benchmark | Latency | Benchmark Result nanoseconds (ns) (Result Δ%) | Lower Boundary nanoseconds (ns) (Limit %) | Upper Boundary nanoseconds (ns) (Limit %) |
|---|---|---|---|---|
| sync-v2 (up to 20000 blocks) | 📈 view plot 🚷 view threshold | 101,462,798,848.64 (-0.48%) | 91,760,403,941.47 (90.44%) | 112,151,604,817.35 (90.47%) |
jansegre
approved these changes
Sep 3, 2024
25f5e2d to
cd6a4ac
Compare
cd6a4ac to
7ceced8
Compare
7ceced8 to
5d1e870
Compare
5d1e870 to
db94b36
Compare
1 task
Contributor
Author
|
I'm putting this PR on hold for now, and instead PR #1146 will revert related changes, keeping feature states in "normal" metadata, and not moving it to static metadata. See the new PR's description for motivation. |
eb416fa to
21d7909
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on #1017
Motivation
Continuing with the static metadata refactor introduced in PRs #1013 and #1014, the next step is to move the
feature_statesattribute from metadata to static metadata. This PR implements this, finishing the static metadata refactor.This results in very beneficial changes for Feature Activation, because now feature states are only calculated once when a block is received and then persisted in static metadata, meaning we don't have to deal with complications introduced by mutable states.
For instance, in order to get the state of a feature for a block before this PR, we would need to call
feature_service.get_state()and it would either get it from the cache (in metadata) or recalculate it. Now, since an attribute is permanently available instatic_metadata, retrieving feature states becomes as simple as accessing a property, which is guaranteed to always exist, incurring no performance penalties and preventing the need to inject theFeatureServicesingleton everywhere. In fact,FeatureServiceis no longer a singleton, and instead just a pure "calculator" (we may change its name in a separate PR).This allowed us to simplify and clean up a lot of related code, and also naturally removed the
FeatureServicedependency from block verification — which was the final goal of the PRs in this sequence up to this point, for the Multiprocess Verification project.Another great earned benefit is, now that
feature_statesare always guaranteed to be calculated for all blocks, we can change the algorithm to use parent blocks to retrieve the previous state, instead of previous boundary blocks. This also allowed us to remove theget_ancestor_at_height()method.Acceptance Criteria
feature_statesattribute from metadata to static metadata.FeatureServiceconvenience methods to static metadata.FeatureServicesingleton as it's no longer needed and update usages.FeatureServiceso it no longer relies on stateful metadata, and instead becomes a pure functioncalculate_feature_state()by using parent blocks instead of previous boundary blocks.BitSignalingServiceto automatically enable support duringMUST_SIGNALviaPubSub, instead of viaFeatureService.Checklist
master, confirm this code is production-ready and can be included in future releases as soon as it gets merged