forked from sigp/lighthouse
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
24a5c16
commit 24c6273
Showing
20 changed files
with
118 additions
and
92 deletions.
There are no files selected for viewing
This file contains 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 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: 20 additions & 19 deletions
39
beacon_node/beacon_chain/src/schema_change/migration_schema_v9.rs
This file contains 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,29 +1,30 @@ | ||
use std::collections::HashMap; | ||
use crate::persisted_fork_choice::PersistedForkChoiceV8; | ||
use crate::schema_change::{ | ||
types::{SszContainerV7, SszContainerV9}, | ||
StoreError, | ||
}; | ||
use proto_array::core::SszContainer; | ||
use proto_array::ProtoArrayForkChoice; | ||
use ssz::{Decode, Encode}; | ||
use crate::beacon_fork_choice_store::PersistedForkChoiceStoreV8; | ||
use crate::persisted_fork_choice::PersistedForkChoiceV8; | ||
use crate::schema_change::{StoreError, types::{SszContainerV6, SszContainerV7, SszContainerV9}}; | ||
|
||
pub fn update_fork_choice( | ||
mut fork_choice: PersistedForkChoiceV8, | ||
) -> Result<PersistedForkChoiceV8, StoreError> { | ||
let ssz_container_v7 = | ||
SszContainerV7::from_ssz_bytes(&fork_choice.fork_choice.proto_array_bytes) | ||
.map_err(|e| { | ||
StoreError::SchemaMigrationError(format!( | ||
"Failed to decode ProtoArrayForkChoice during schema migration: {:?}", | ||
e | ||
)) | ||
})?; | ||
let ssz_container_v7 = SszContainerV7::from_ssz_bytes( | ||
&fork_choice.fork_choice.proto_array_bytes, | ||
) | ||
.map_err(|e| { | ||
StoreError::SchemaMigrationError(format!( | ||
"Failed to decode ProtoArrayForkChoice during schema migration: {:?}", | ||
e | ||
)) | ||
})?; | ||
|
||
// These transformations instantiate `node.unrealized_justified_checkpoint` and | ||
// `node.unrealized_finalized_checkpoint` to `None`. | ||
let ssz_container_v9: SszContainerV9 = ssz_container_v7.into(); | ||
let ssz_container: SszContainer = ssz_container_v9.into(); | ||
// These transformations instantiate `node.unrealized_justified_checkpoint` and | ||
// `node.unrealized_finalized_checkpoint` to `None`. | ||
let ssz_container_v9: SszContainerV9 = ssz_container_v7.into(); | ||
let ssz_container: SszContainer = ssz_container_v9.into(); | ||
|
||
fork_choice.fork_choice.proto_array_bytes = ssz_container.as_ssz_bytes(); | ||
fork_choice.fork_choice.proto_array_bytes = ssz_container.as_ssz_bytes(); | ||
|
||
Ok(fork_choice) | ||
Ok(fork_choice) | ||
} |
This file contains 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 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 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 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 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 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 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 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 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 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
4 changes: 2 additions & 2 deletions
4
consensus/state_processing/src/per_epoch_processing/epoch_processing_summary.rs
This file contains 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 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 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.