Skip to content
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

Alter stroge visibility #622

Merged
merged 1 commit into from
Mar 17, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 18 additions & 17 deletions xpallets/gateway/common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -556,13 +556,13 @@ pub mod pallet {

#[pallet::storage]
#[pallet::getter(fn trustee_multisig_addr)]
pub type TrusteeMultiSigAddr<T: Config> =
pub(crate) type TrusteeMultiSigAddr<T: Config> =
StorageMap<_, Twox64Concat, Chain, T::AccountId, ValueQuery>;

/// Trustee info config of the corresponding chain.
#[pallet::storage]
#[pallet::getter(fn trustee_info_config_of)]
pub type TrusteeInfoConfigOf<T: Config> =
pub(crate) type TrusteeInfoConfigOf<T: Config> =
StorageMap<_, Twox64Concat, Chain, TrusteeInfoConfig, ValueQuery>;

/// Next Trustee session info number of the chain.
Expand All @@ -573,7 +573,7 @@ pub mod pallet {
/// NOTE: The number can't be modified by users.
#[pallet::storage]
#[pallet::getter(fn trustee_session_info_len)]
pub type TrusteeSessionInfoLen<T: Config> =
pub(crate) type TrusteeSessionInfoLen<T: Config> =
StorageMap<_, Twox64Concat, Chain, u32, ValueQuery, DefaultForTrusteeSessionInfoLen>;

#[pallet::type_value]
Expand All @@ -584,7 +584,7 @@ pub mod pallet {
/// Trustee session info of the corresponding chain and number.
#[pallet::storage]
#[pallet::getter(fn trustee_session_info_of)]
pub type TrusteeSessionInfoOf<T: Config> = StorageDoubleMap<
pub(crate) type TrusteeSessionInfoOf<T: Config> = StorageDoubleMap<
_,
Twox64Concat,
Chain,
Expand All @@ -596,7 +596,7 @@ pub mod pallet {
/// Trustee intention properties of the corresponding account and chain.
#[pallet::storage]
#[pallet::getter(fn trustee_intention_props_of)]
pub type TrusteeIntentionPropertiesOf<T: Config> = StorageDoubleMap<
pub(crate) type TrusteeIntentionPropertiesOf<T: Config> = StorageDoubleMap<
_,
Blake2_128Concat,
T::AccountId,
Expand All @@ -607,12 +607,12 @@ pub mod pallet {

/// The account of the corresponding chain and chain address.
#[pallet::storage]
pub type AddressBindingOf<T: Config> =
pub(crate) type AddressBindingOf<T: Config> =
StorageDoubleMap<_, Twox64Concat, Chain, Blake2_128Concat, ChainAddress, T::AccountId>;

/// The bound address of the corresponding account and chain.
#[pallet::storage]
pub type BoundAddressOf<T: Config> = StorageDoubleMap<
pub(crate) type BoundAddressOf<T: Config> = StorageDoubleMap<
_,
Blake2_128Concat,
T::AccountId,
Expand All @@ -625,14 +625,14 @@ pub mod pallet {
/// The referral account of the corresponding account and chain.
#[pallet::storage]
#[pallet::getter(fn referral_binding_of)]
pub type ReferralBindingOf<T: Config> =
pub(crate) type ReferralBindingOf<T: Config> =
StorageDoubleMap<_, Blake2_128Concat, T::AccountId, Twox64Concat, Chain, T::AccountId>;

/// Each aggregated public key corresponds to a set of trustees used
/// to confirm a set of trustees for processing withdrawals.
#[pallet::storage]
#[pallet::getter(fn agg_pubkey_info)]
pub type AggPubkeyInfo<T: Config> = StorageDoubleMap<
pub(crate) type AggPubkeyInfo<T: Config> = StorageDoubleMap<
_,
Twox64Concat,
Chain,
Expand All @@ -644,11 +644,12 @@ pub mod pallet {

#[pallet::storage]
#[pallet::getter(fn trustee_admin)]
pub type TrusteeAdmin<T: Config> = StorageMap<_, Twox64Concat, Chain, T::AccountId, ValueQuery>;
pub(crate) type TrusteeAdmin<T: Config> =
StorageMap<_, Twox64Concat, Chain, T::AccountId, ValueQuery>;

#[pallet::storage]
#[pallet::getter(fn trustee_admin_multiply)]
pub type TrusteeAdminMultiply<T: Config> =
pub(crate) type TrusteeAdminMultiply<T: Config> =
StorageMap<_, Twox64Concat, Chain, u64, ValueQuery, DefaultForTrusteeAdminMultiply>;

#[pallet::type_value]
Expand All @@ -658,13 +659,13 @@ pub mod pallet {

#[pallet::storage]
#[pallet::getter(fn trustee_sig_record)]
pub type TrusteeSigRecord<T: Config> =
pub(crate) type TrusteeSigRecord<T: Config> =
StorageDoubleMap<_, Twox64Concat, Chain, Twox64Concat, T::AccountId, u64, ValueQuery>;

/// The status of the of the trustee transition
#[pallet::storage]
#[pallet::getter(fn trustee_transition_status)]
pub type TrusteeTransitionStatus<T: Config> =
pub(crate) type TrusteeTransitionStatus<T: Config> =
StorageMap<_, Twox64Concat, Chain, bool, ValueQuery>;

/// Members not participating in trustee elections.
Expand All @@ -673,13 +674,13 @@ pub mod pallet {
/// little black room. Filter out the member in the next trustee election
#[pallet::storage]
#[pallet::getter(fn little_black_house)]
pub type LittleBlackHouse<T: Config> =
pub(crate) type LittleBlackHouse<T: Config> =
StorageMap<_, Twox64Concat, Chain, Vec<T::AccountId>, ValueQuery>;

/// Record the total number of cross-chain assets at the time of each trust exchange
#[pallet::storage]
#[pallet::getter(fn pre_total_supply)]
pub type PreTotalSupply<T: Config> =
pub(crate) type PreTotalSupply<T: Config> =
StorageDoubleMap<_, Twox64Concat, Chain, Twox64Concat, u32, BalanceOf<T>, ValueQuery>;

#[pallet::genesis_config]
Expand Down Expand Up @@ -1032,7 +1033,7 @@ impl<T: Config> Pallet<T> {
}

fn generate_aggpubkey_impl(chain: Chain, session_number: u32) -> DispatchResult {
let trustee_session = T::BitcoinTrusteeSessionProvider::current_trustee_session()?;
let trustee_session = T::BitcoinTrusteeSessionProvider::trustee_session(session_number)?;
let trustees = trustee_session
.trustee_list
.into_iter()
Expand Down Expand Up @@ -1263,7 +1264,7 @@ impl<T: Config> Pallet<T> {
Withdrawal<T::AccountId, BalanceOf<T>, T::BlockNumber>,
WithdrawalLimit<BalanceOf<T>>,
),
> = xpallet_gateway_records::PendingWithdrawals::<T>::iter()
> = xpallet_gateway_records::Pallet::<T>::pending_withdrawal_set()
.map(|(id, record)| {
(
id,
Expand Down
8 changes: 7 additions & 1 deletion xpallets/gateway/records/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ pub mod pallet {
/// Withdraw applications collection, use serial numbers to mark them.
#[pallet::storage]
#[pallet::getter(fn pending_withdrawals)]
pub type PendingWithdrawals<T: Config> =
pub(crate) type PendingWithdrawals<T: Config> =
StorageMap<_, Twox64Concat, WithdrawalRecordId, WithdrawalRecordOf<T>>;

/// The state of withdraw record corresponding to an id.
Expand Down Expand Up @@ -545,6 +545,12 @@ impl<T: Config> Pallet<T> {
xpallet_assets::Pallet::<T>::destroy_reserved_withdrawal(&asset_id, who, value)?;
Ok(())
}

#[inline]
pub fn pending_withdrawal_set(
) -> impl Iterator<Item = (WithdrawalRecordId, WithdrawalRecordOf<T>)> {
PendingWithdrawals::<T>::iter()
}
}

impl<T: Config> Pallet<T> {
Expand Down