diff --git a/beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs b/beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs index 737fcd0a93..5054c568bd 100644 --- a/beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs +++ b/beacon_node/beacon_chain/src/schema_change/migration_schema_v20.rs @@ -3,6 +3,7 @@ use operation_pool::{ PersistedOperationPool, PersistedOperationPoolV15, PersistedOperationPoolV20, }; use slog::{debug, info, Logger}; +use ssz::Encode; use std::sync::Arc; use store::{Error, HotColdDB, KeyValueStoreOp, StoreItem}; use types::Attestation; @@ -11,6 +12,7 @@ pub fn upgrade_to_v20( db: Arc>, log: Logger, ) -> Result, Error> { + info!(log, "Upgrading from v19 to v20"); // Load a V15 op pool and transform it to V20. let Some(PersistedOperationPoolV15:: { attestations_v15, @@ -36,7 +38,7 @@ pub fn upgrade_to_v20( .map(|slashing| slashing.into()) .collect(); - let v20 = PersistedOperationPool::V20(PersistedOperationPoolV20 { + let v20 = PersistedOperationPoolV20 { attestations, sync_contributions, attester_slashings, @@ -44,14 +46,20 @@ pub fn upgrade_to_v20( voluntary_exits, bls_to_execution_changes, capella_bls_change_broadcast_indices, - }); - Ok(vec![v20.as_kv_store_op(OP_POOL_DB_KEY)]) + }; + let v20_bytes = v20.as_ssz_bytes(); + let wrapped = PersistedOperationPool::V20(v20); + let wrapped_bytes = wrapped.as_ssz_bytes(); + assert_eq!(v20_bytes.len(), wrapped_bytes.len()); + assert_eq!(v20_bytes, wrapped_bytes); + Ok(vec![wrapped.as_kv_store_op(OP_POOL_DB_KEY)]) } pub fn downgrade_from_v20( db: Arc>, log: Logger, ) -> Result, Error> { + info!(log, "Downgrading from v20 to v19"); // Load a V20 op pool and transform it to V15. let Some(PersistedOperationPoolV20:: { attestations, diff --git a/beacon_node/operation_pool/src/persistence.rs b/beacon_node/operation_pool/src/persistence.rs index 79509e5f6c..42f1cf078b 100644 --- a/beacon_node/operation_pool/src/persistence.rs +++ b/beacon_node/operation_pool/src/persistence.rs @@ -246,7 +246,7 @@ impl StoreItem for PersistedOperationPoolV20 { } } -/// Deserialization for `PersistedOperationPool` defaults to `PersistedOperationPool::V12`. +/// Deserialization for `PersistedOperationPool` defaults to `PersistedOperationPool::V20`. impl StoreItem for PersistedOperationPool { fn db_column() -> DBColumn { DBColumn::OpPool