Skip to content

Commit

Permalink
remove unused types
Browse files Browse the repository at this point in the history
  • Loading branch information
0o-de-lally committed Oct 4, 2024
1 parent 220e74c commit f7132fb
Show file tree
Hide file tree
Showing 17 changed files with 28 additions and 34 deletions.
File renamed without changes.
File renamed without changes.
File renamed without changes.
14 changes: 6 additions & 8 deletions compatibility/src/legacy_recovery_v6.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
//! recovery
use crate::{
ancestry_legacy::LegacyAncestryResource,
wallet::{CommunityWalletsResourceLegacy, SlowWalletListResource, SlowWalletResource},
};
use anyhow::anyhow;
use diem_types::{
account_state::AccountState,
Expand All @@ -14,6 +10,7 @@ use libra_types::{
core_types::legacy_currency_info::CurrencyInfoResource,
exports::AuthenticationKey,
move_resource::{
ancestry::AncestryResource,
burn::{BurnCounterResource, UserBurnPreferenceResource},
cumulative_deposits::{CumulativeDepositResource, LegacyBalanceResource},
donor_voice::RegistryResource,
Expand All @@ -25,6 +22,7 @@ use libra_types::{
receipts::ReceiptsResource,
validator_universe::ValidatorUniverseResource,
vouch::MyVouchesResource,
wallet::{CommunityWalletsResource, SlowWalletListResource, SlowWalletResource},
},
};
use move_core_types::account_address::AccountAddress;
Expand Down Expand Up @@ -78,13 +76,13 @@ pub struct LegacyRecoveryV6 {
pub val_operator_cfg: Option<ValidatorOperatorConfigResource>,

/// Community wallets associated with the account.
pub comm_wallet: Option<CommunityWalletsResourceLegacy>,
pub comm_wallet: Option<CommunityWalletsResource>,

/// Information about the currency associated with the account.
pub currency_info: Option<CurrencyInfoResource>,

/// Ancestry information of the account in the legacy system.
pub ancestry: Option<LegacyAncestryResource>,
pub ancestry: Option<AncestryResource>,

/// Receipts resource for the account.
pub receipts: Option<ReceiptsResource>,
Expand Down Expand Up @@ -220,10 +218,10 @@ pub fn get_legacy_recovery(account_state: &AccountState) -> anyhow::Result<Legac

// comm_wallet
legacy_recovery.comm_wallet =
account_state.get_move_resource::<CommunityWalletsResourceLegacy>()?;
account_state.get_move_resource::<CommunityWalletsResource>()?;

// ancestry
legacy_recovery.ancestry = account_state.get_move_resource::<LegacyAncestryResource>()?;
legacy_recovery.ancestry = account_state.get_move_resource::<AncestryResource>()?;

// receipts
legacy_recovery.receipts = account_state.get_move_resource::<ReceiptsResource>()?;
Expand Down
4 changes: 0 additions & 4 deletions compatibility/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
//! `legacy-types`
pub mod ancestry_legacy;
pub mod legacy_recovery_v6;
pub mod tx_error;
pub mod validator_config;
pub mod version_five;
pub mod wallet;
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright (c) The Diem Core Contributors
// SPDX-License-Identifier: Apache-2.0
use crate::version_five::{legacy_address_v5::LegacyAddressV5, version_five_safe_serialize};
use crate::version_five::{legacy_address_v5::LegacyAddressV5, safe_serialize_v5};
use move_core_types::identifier::{IdentStr, Identifier};
use serde::{Deserialize, Serialize};
use std::fmt::{Display, Formatter};
Expand All @@ -22,15 +22,15 @@ pub enum TypeTag {
Signer,
Vector(
#[serde(
serialize_with = "version_five_safe_serialize::type_tag_recursive_serialize",
deserialize_with = "version_five_safe_serialize::type_tag_recursive_deserialize"
serialize_with = "safe_serialize_v5::type_tag_recursive_serialize",
deserialize_with = "safe_serialize_v5::type_tag_recursive_deserialize"
)]
Box<TypeTag>,
),
Struct(
#[serde(
serialize_with = "version_five_safe_serialize::type_tag_recursive_serialize",
deserialize_with = "version_five_safe_serialize::type_tag_recursive_deserialize"
serialize_with = "safe_serialize_v5::type_tag_recursive_serialize",
deserialize_with = "safe_serialize_v5::type_tag_recursive_deserialize"
)]
Box<StructTag>,
),
Expand Down
14 changes: 7 additions & 7 deletions compatibility/src/version_five/mod.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
pub mod core_account_v5;
pub mod diem_account_v5;
pub mod legacy_address_v5;
pub mod state_snapshot;
pub mod state_snapshot_v5;
pub mod struct_tag_v5;
mod version_five_account_blob;
mod version_five_balance;
mod version_five_freezing;
mod version_five_hash_value;
mod version_five_language;
mod version_five_safe_serialize;
mod account_blob;
mod balance_v5;
mod freezing_v5;
mod hash_value_v5;
mod language_v5;
mod safe_serialize_v5;
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! read-archive
use crate::version_five::{
version_five_account_blob::AccountStateBlob, version_five_hash_value::HashValue,
account_blob::AccountStateBlob, hash_value_v5::HashValue,
};

use anyhow::{anyhow, Context, Error, Result};
Expand Down Expand Up @@ -106,10 +106,10 @@ pub async fn v5_accounts_from_snapshot_backup(

#[test]
fn test_string() {
use super::version_five_account_blob::AccountStateV5;
use super::struct_tag_v5::StructTagV5;
use super::version_five_freezing::FreezingBit;
use super::version_five_balance::BalanceResource;
use super::account_blob::AccountStateV5;

use super::freezing_v5::FreezingBit;
use super::balance_v5::BalanceResource;

let bytes = b" \0\x03Z|\x96)\xb7\xe5.\x94\xdee\xe6\xa8\x92p\x1f\xe2\x83Q\x18d\x05\xbe\x96\xed#\xf4\xb1%/z\xd4\x03\x06\x1f\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\x05Roles\x06RoleId\0\x08\n\0\0\0\0\0\0\0(\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\x08Receipts\x0cUserReceipts\0\x04\0\0\0\0*\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\x0bDiemAccount\x0bDiemAccount\0\x8d\x01 \x89EP$\xb0\xc9\x15|ja\x03\xaf-\xb4\x98\xf4\xc4\x8f\xd6\xf9\x82\x92\xda3\xb1\x1cHx\xb3m\xde\x1b\x01\xc4\x8f\xd6\xf9\x82\x92\xda3\xb1\x1cHx\xb3m\xde\x1b\x01\xc4\x8f\xd6\xf9\x82\x92\xda3\xb1\x1cHx\xb3m\xde\x1b\x01\0\0\0\0\0\0\0\x18\0\0\0\0\0\0\0\0\xc4\x8f\xd6\xf9\x82\x92\xda3\xb1\x1cHx\xb3m\xde\x1b\0\0\0\0\0\0\0\0\x18\x01\0\0\0\0\0\0\0\xc4\x8f\xd6\xf9\x82\x92\xda3\xb1\x1cHx\xb3m\xde\x1b\0\0\0\0\0\0\0\0-\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\x05Event\x14EventHandleGenerator\0\x18\x02\0\0\0\0\0\0\0\xc4\x8f\xd6\xf9\x82\x92\xda3\xb1\x1cHx\xb3m\xde\x1b.\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\x0fAccountFreezing\x0bFreezingBit\0\x01\0@\x01\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\x0bDiemAccount\x07Balance\x01\x07\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\x01\x03GAS\x03GAS\0\x08@B\x0f\0\0\0\0\0";

Expand Down
2 changes: 1 addition & 1 deletion types/src/move_resource/ancestry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use move_core_types::{
use serde::{Deserialize, Serialize};

/// Struct that represents a AutoPay resource
#[derive(Debug, Serialize, Deserialize)]
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct AncestryResource {
/// A vector representing the ancestry tree of account addresses.
pub tree: Vec<AccountAddress>,
Expand Down
1 change: 1 addition & 0 deletions types/src/move_resource/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,4 @@ pub mod receipts;
pub mod txschedule;
pub mod validator_universe;
pub mod vouch;
pub mod wallet;
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,21 @@ use move_core_types::{
move_resource::{MoveResource, MoveStructType},
};
use serde::{Deserialize, Serialize};
// NOTE: these are legacy structs for v5

/// Struct that represents a CommunityWallet resource
/// TODO: this is incorrect field structure
#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct CommunityWalletsResourceLegacy {
pub struct CommunityWalletsResource {
// List
pub list: Vec<AccountAddress>,
}

impl MoveStructType for CommunityWalletsResourceLegacy {
impl MoveStructType for CommunityWalletsResource {
const MODULE_NAME: &'static IdentStr = ident_str!("community_wallet");
const STRUCT_NAME: &'static IdentStr = ident_str!("CommunityWallet");
}

impl MoveResource for CommunityWalletsResourceLegacy {}
impl MoveResource for CommunityWalletsResource{}

/// Struct that represents a SlowWallet resource
#[derive(Debug, Serialize, Deserialize, Clone)]
Expand Down

0 comments on commit f7132fb

Please sign in to comment.