-
Notifications
You must be signed in to change notification settings - Fork 930
Data column custody info #7648
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
Data column custody info #7648
Changes from 6 commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
d1e8ec3
Add data column custody info db record and logic
eserilev d0c2b7a
Merge branch 'unstable' into data-column-custody-info
eserilev 9e0a791
small refactor and merge conflicts
eserilev 678e882
update comments
eserilev f54f2e1
Merge branch 'unstable' of https://github.com/sigp/lighthouse into da…
eserilev ce16855
Add migration and make custody info earliest slot an Option
eserilev 445c80f
fix test'
eserilev 78e33e0
Add metadata assert
eserilev 59b1520
Add metadata assert
eserilev 7f936e3
add additional test, make sure we're adding datacolumn custody info t…
eserilev 725d98e
effective epoch
eserilev ce7431b
remove mut
eserilev ddb7062
clean-up earliest avail slot logic
eserilev 71a5b0f
update comment
eserilev 2459e61
Merge branch 'unstable' into data-column-custody-info
eserilev 0f2fc7d
small refactor
eserilev dc04308
effective epoch
eserilev d06627e
Merge branch 'data-column-custody-info' of https://github.com/eserile…
eserilev 53b1be3
fix test
eserilev 996c140
fix
eserilev a13bb65
Drop update data custody info condition
jimmygchen f7f0d4a
Merge branch 'unstable' into data-column-custody-info
jimmygchen 5725bd4
Fix beacon chain tests.
jimmygchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
39 changes: 9 additions & 30 deletions
39
beacon_node/beacon_chain/src/schema_change/migration_schema_v27.rs
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,47 +1,26 @@ | ||
| use crate::BeaconChainTypes; | ||
| use ssz::Encode; | ||
| use std::sync::Arc; | ||
| use store::metadata::DataColumnCustodyInfo; | ||
| use store::metadata::DATA_COLUMN_CUSTODY_INFO_KEY; | ||
| use store::{DBColumn, Error, HotColdDB, KeyValueStoreOp}; | ||
| use tracing::info; | ||
| use store::{metadata::SchemaVersion, Error, HotColdDB}; | ||
|
|
||
| /// Add `DataColumnCustodyInfo` entry to v27. | ||
| pub fn upgrade_to_v27<T: BeaconChainTypes>( | ||
| db: Arc<HotColdDB<T::EthSpec, T::HotStore, T::ColdStore>>, | ||
| ) -> Result<Vec<KeyValueStoreOp>, Error> { | ||
| let ops = if db.spec.is_peer_das_scheduled() { | ||
| info!("Adding `DataColumnCustodyInfo` to the db"); | ||
| let data_column_custody_info = DataColumnCustodyInfo { | ||
| earliest_data_column_slot: None, | ||
| }; | ||
| vec![KeyValueStoreOp::PutKeyValue( | ||
| DBColumn::BeaconDataColumnCustodyInfo, | ||
| DATA_COLUMN_CUSTODY_INFO_KEY.as_slice().to_vec(), | ||
| data_column_custody_info.as_ssz_bytes(), | ||
| )] | ||
| } else { | ||
| // Delete it from the db if PeerDAS hasn't been scheduled | ||
| vec![KeyValueStoreOp::DeleteKey( | ||
| DBColumn::BeaconDataColumnCustodyInfo, | ||
| DATA_COLUMN_CUSTODY_INFO_KEY.as_slice().to_vec(), | ||
| )] | ||
| }; | ||
| ) -> Result<(), Error> { | ||
| if db.spec.is_peer_das_scheduled() { | ||
| db.put_data_column_custody_info(None)?; | ||
| db.store_schema_version_atomically(SchemaVersion(27), vec![])?; | ||
| } | ||
|
|
||
| Ok(ops) | ||
| Ok(()) | ||
| } | ||
|
|
||
| pub fn downgrade_from_v27<T: BeaconChainTypes>( | ||
| db: Arc<HotColdDB<T::EthSpec, T::HotStore, T::ColdStore>>, | ||
| ) -> Result<Vec<KeyValueStoreOp>, Error> { | ||
| ) -> Result<(), Error> { | ||
| if db.spec.is_peer_das_scheduled() { | ||
| return Err(Error::MigrationError( | ||
| "Cannot downgrade from v27 if peerDAS is scheduled".to_string(), | ||
| )); | ||
jimmygchen marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| let ops = vec![KeyValueStoreOp::DeleteKey( | ||
| DBColumn::BeaconDataColumnCustodyInfo, | ||
| DATA_COLUMN_CUSTODY_INFO_KEY.as_slice().to_vec(), | ||
| )]; | ||
| Ok(ops) | ||
| Ok(()) | ||
| } | ||
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
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
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
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
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
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.