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

Get rid of store adapter in signer #2126

Merged
merged 14 commits into from
Nov 21, 2024

Conversation

sfauvel
Copy link
Collaborator

@sfauvel sfauvel commented Nov 18, 2024

Content

Replace the store using the legacy store adapter and replace them with a repository implementation in the Signer.

This PR includes:

  • a refactoring of ConnectionBuilder to be able to execute partial migrations.
  • the creation of protocol_initializer_repository et stake_pool_store and associated queries and records.
  • tests on data migration from adapter table to the new structure.
  • the removal of all references to ̀adapter` module
  • the creation of a tests module in database to test repository behavior

Warning

The migration number for signed_beacon was fixed (4 instead of 31). That need to manually update db_version just before merging this PR.

Pre-submit checklist

  • Branch
    • Tests are provided (if possible)
    • Crates versions are updated (if relevant)
    • CHANGELOG file is updated (if relevant)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
  • PR
    • No clippy warnings in the CI
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested
  • Documentation
    • Update README file (if relevant)
    • Update documentation website (if relevant)
    • Add dev blog post (if relevant)

Comments

  • To test migration, a FakeAdapter was created to initialize database like the StoreAdapter did but without depending on it.
  • The 'map-err' has been removed from the 'stake' compared to what is in the aggregator to remove the dependency on adapter module.

Issue(s)

Relates to #2118

@sfauvel sfauvel force-pushed the sfa/2118/get_rid_of_store_adpater_in_signer branch 3 times, most recently from 970f71a to 2294bd7 Compare November 18, 2024 14:58
Copy link

github-actions bot commented Nov 18, 2024

Test Results

    4 files  ±0     51 suites  ±0   11m 38s ⏱️ -19s
1 455 tests +9  1 455 ✅ +9  0 💤 ±0  0 ❌ ±0 
1 666 runs  +9  1 666 ✅ +9  0 💤 ±0  0 ❌ ±0 

Results for commit a14746c. ± Comparison against base commit 0b8564c.

This pull request removes 12 and adds 21 tests. Note that renamed tests count towards both.
mithril-signer ‑ store::protocol_initializer_store::tests::check_retention_limit
mithril-signer ‑ store::protocol_initializer_store::tests::get_protocol_initializer_for_empty_epoch
mithril-signer ‑ store::protocol_initializer_store::tests::get_protocol_initializer_for_existing_epoch
mithril-signer ‑ store::protocol_initializer_store::tests::save_key_in_empty_store
mithril-signer ‑ store::protocol_initializer_store::tests::update_protocol_initializer_in_store
mithril-signer ‑ store::stake_store::tests::check_retention_limit
mithril-signer ‑ store::stake_store::tests::get_stakes_for_empty_epoch
mithril-signer ‑ store::stake_store::tests::get_stakes_for_existing_epoch
mithril-signer ‑ store::stake_store::tests::retrieve_returns_stake_distribution
mithril-signer ‑ store::stake_store::tests::retrieve_with_no_stakes_returns_none
…
mithril-persistence ‑ sqlite::connection_builder::tests::test_apply_a_partial_migrations
mithril-signer ‑ database::query::stake_pool::delete_stake_pool::tests::test_prune_below_epoch_threshold
mithril-signer ‑ database::query::stake_pool::get_stake_pool::tests::test_query_sorts_the_return_stake_pool_by_epoch_stack_and_stake_pool_id
mithril-signer ‑ database::query::stake_pool::insert_or_replace_stake_pool::tests::test_update_stakes
mithril-signer ‑ database::tests::protocol_initializer::migration::should_migrate_data_from_adapter
mithril-signer ‑ database::tests::protocol_initializer::pruning::prune_epoch_older_than_threshold
mithril-signer ‑ database::tests::protocol_initializer::pruning::without_threshold_nothing_is_pruned
mithril-signer ‑ database::tests::protocol_initializer::request::get_last_protocol_initializer_return_all_when_too_few_records
mithril-signer ‑ database::tests::protocol_initializer::request::get_last_protocol_initializer_return_last_one_first
mithril-signer ‑ database::tests::protocol_initializer::request::get_protocol_initializer_for_empty_epoch
…

♻️ This comment has been updated with latest results.

@sfauvel sfauvel force-pushed the sfa/2118/get_rid_of_store_adpater_in_signer branch 2 times, most recently from 844ce98 to b8f8dad Compare November 18, 2024 16:01
@sfauvel sfauvel marked this pull request as ready for review November 18, 2024 16:06
@sfauvel sfauvel changed the title Sfa/2118/get rid of store adpater in signer Get rid of store adpater in signer Nov 18, 2024
@sfauvel sfauvel changed the title Get rid of store adpater in signer Get rid of store adapter in signer Nov 18, 2024
Copy link
Collaborator

@dlachaume dlachaume left a comment

Choose a reason for hiding this comment

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

LGTM 👍

Copy link
Member

@jpraynaud jpraynaud left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@sfauvel sfauvel force-pushed the sfa/2118/get_rid_of_store_adpater_in_signer branch 2 times, most recently from 75ce762 to 4beb241 Compare November 20, 2024 14:44
@sfauvel sfauvel force-pushed the sfa/2118/get_rid_of_store_adpater_in_signer branch from c81f7da to a14746c Compare November 21, 2024 09:49
@sfauvel sfauvel merged commit 3b7b365 into main Nov 21, 2024
47 checks passed
@sfauvel sfauvel deleted the sfa/2118/get_rid_of_store_adpater_in_signer branch November 21, 2024 10:25
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.

4 participants