Skip to content

Commit

Permalink
pr: fix merge conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
brooksprumo authored and willhickey committed Sep 27, 2024
1 parent 0c46929 commit adc79cb
Show file tree
Hide file tree
Showing 6 changed files with 5 additions and 89 deletions.
1 change: 0 additions & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

19 changes: 0 additions & 19 deletions accounts-db/src/accounts_hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1236,25 +1236,6 @@ pub struct AccountHash(pub Hash);
// This also ensures there are no padding bytes, which is required to safely implement Pod
const _: () = assert!(std::mem::size_of::<AccountHash>() == std::mem::size_of::<Hash>());

<<<<<<< HEAD
=======
/// The AccountHash for a zero-lamport account
pub const ZERO_LAMPORT_ACCOUNT_HASH: AccountHash =
AccountHash(Hash::new_from_array([0; HASH_BYTES]));

/// Lattice hash of an account
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct AccountLtHash(pub LtHash);

/// The AccountLtHash for a zero-lamport account
pub const ZERO_LAMPORT_ACCOUNT_LT_HASH: AccountLtHash =
AccountLtHash(LtHash([0; LtHash::NUM_ELEMENTS]));

/// Lattice hash of all accounts
#[derive(Debug, Clone, Eq, PartialEq)]
pub struct AccountsLtHash(pub LtHash);

>>>>>>> 690fad08d4 (Supports deserializing accounts lt hash in snapshots (#2994))
/// Hash of accounts
#[derive(Debug, Copy, Clone, Eq, PartialEq)]
pub enum AccountsHashKind {
Expand Down
1 change: 0 additions & 1 deletion programs/sbf/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion runtime/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,6 @@ solana-cost-model = { workspace = true }
solana-frozen-abi = { workspace = true, optional = true }
solana-frozen-abi-macro = { workspace = true, optional = true }
solana-inline-spl = { workspace = true }
solana-lattice-hash = { workspace = true }
solana-loader-v4-program = { workspace = true }
solana-measure = { workspace = true }
solana-metrics = { workspace = true }
Expand Down
57 changes: 4 additions & 53 deletions runtime/src/serde_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -384,48 +384,6 @@ where
deserialize_from::<_, _>(stream)
}

<<<<<<< HEAD
=======
/// Extra fields that are deserialized from the end of snapshots.
///
/// Note that this struct's fields should stay synced with the fields in
/// ExtraFieldsToSerialize with the exception that new "extra fields" should be
/// added to this struct a minor release before they are added to the serialize
/// struct.
#[cfg_attr(feature = "frozen-abi", derive(AbiExample))]
#[cfg_attr(feature = "dev-context-only-utils", derive(PartialEq))]
#[derive(Clone, Debug, Deserialize)]
struct ExtraFieldsToDeserialize {
#[serde(deserialize_with = "default_on_eof")]
lamports_per_signature: u64,
#[serde(deserialize_with = "default_on_eof")]
incremental_snapshot_persistence: Option<BankIncrementalSnapshotPersistence>,
#[serde(deserialize_with = "default_on_eof")]
epoch_accounts_hash: Option<Hash>,
#[serde(deserialize_with = "default_on_eof")]
versioned_epoch_stakes: HashMap<u64, VersionedEpochStakes>,
#[serde(deserialize_with = "default_on_eof")]
#[allow(dead_code)]
accounts_lt_hash: Option<SerdeAccountsLtHash>,
}

/// Extra fields that are serialized at the end of snapshots.
///
/// Note that this struct's fields should stay synced with the fields in
/// ExtraFieldsToDeserialize with the exception that new "extra fields" should
/// be added to the deserialize struct a minor release before they are added to
/// this one.
#[cfg_attr(feature = "frozen-abi", derive(AbiExample))]
#[cfg_attr(feature = "dev-context-only-utils", derive(Default, PartialEq))]
#[derive(Debug, Serialize)]
pub struct ExtraFieldsToSerialize<'a> {
pub lamports_per_signature: u64,
pub incremental_snapshot_persistence: Option<&'a BankIncrementalSnapshotPersistence>,
pub epoch_accounts_hash: Option<EpochAccountsHash>,
pub versioned_epoch_stakes: HashMap<u64, VersionedEpochStakes>,
}

>>>>>>> 690fad08d4 (Supports deserializing accounts lt hash in snapshots (#2994))
fn deserialize_bank_fields<R>(
mut stream: &mut BufReader<R>,
) -> Result<
Expand All @@ -442,18 +400,7 @@ where
deserialize_from::<_, DeserializableVersionedBank>(&mut stream)?.into();
let accounts_db_fields = deserialize_accounts_db_fields(stream)?;
// Process extra fields
<<<<<<< HEAD
let lamports_per_signature = ignore_eof_error(deserialize_from(&mut stream))?;
=======
let ExtraFieldsToDeserialize {
lamports_per_signature,
incremental_snapshot_persistence,
epoch_accounts_hash,
versioned_epoch_stakes,
accounts_lt_hash: _,
} = extra_fields;

>>>>>>> 690fad08d4 (Supports deserializing accounts lt hash in snapshots (#2994))
bank_fields.fee_rate_governor = bank_fields
.fee_rate_governor
.clone_with_lamports_per_signature(lamports_per_signature);
Expand All @@ -474,6 +421,10 @@ where
.map(|(epoch, versioned_epoch_stakes)| (epoch, versioned_epoch_stakes.into())),
);

// This field is only deserialized (and ignored) in this version.
let _accounts_lt_hash: Option<SerdeAccountsLtHash> =
ignore_eof_error(deserialize_from(&mut stream))?;

Ok((bank_fields, accounts_db_fields))
}

Expand Down
15 changes: 1 addition & 14 deletions runtime/src/serde_snapshot/types.rs
Original file line number Diff line number Diff line change
@@ -1,22 +1,9 @@
use {solana_accounts_db::accounts_hash::AccountsLtHash, solana_lattice_hash::lt_hash::LtHash};

/// Snapshot serde-safe AccountsLtHash
#[cfg_attr(feature = "frozen-abi", derive(AbiExample))]
#[serde_with::serde_as]
#[derive(Debug, Serialize, Deserialize, Clone, PartialEq, Eq)]
pub struct SerdeAccountsLtHash(
// serde only has array support up to 32 elements; anything larger needs to be handled manually
// see https://github.com/serde-rs/serde/issues/1937 for more information
#[serde_as(as = "[_; LtHash::NUM_ELEMENTS]")] pub [u16; LtHash::NUM_ELEMENTS],
#[serde_as(as = "[_; 1024]")] pub [u16; 1024],
);

impl From<SerdeAccountsLtHash> for AccountsLtHash {
fn from(accounts_lt_hash: SerdeAccountsLtHash) -> Self {
Self(LtHash(accounts_lt_hash.0))
}
}
impl From<AccountsLtHash> for SerdeAccountsLtHash {
fn from(accounts_lt_hash: AccountsLtHash) -> Self {
Self(accounts_lt_hash.0 .0)
}
}

0 comments on commit adc79cb

Please sign in to comment.