Skip to content
This repository was archived by the owner on Nov 15, 2023. It is now read-only.
Closed
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
6 changes: 4 additions & 2 deletions runtime/common/src/attestations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,10 +96,12 @@ decl_storage! {
trait Store for Module<T: Trait> as Attestations {
/// A mapping from modular block number (n % AttestationPeriod)
/// to session index and the list of candidate hashes.
pub RecentParaBlocks: map T::BlockNumber => Option<IncludedBlocks<T>>;
pub RecentParaBlocks: map hasher(blake2_256) T::BlockNumber => Option<IncludedBlocks<T>>;

/// Attestations on a recent parachain block.
pub ParaBlockAttestations: double_map T::BlockNumber, hasher(blake2_128) Hash => Option<BlockAttestations<T>>;
pub ParaBlockAttestations:
double_map hasher(blake2_256) T::BlockNumber, hasher(blake2_128) Hash
=> Option<BlockAttestations<T>>;

// Did we already have more attestations included in this block?
DidUpdate: bool;
Expand Down
6 changes: 4 additions & 2 deletions runtime/common/src/claims.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,17 @@ decl_storage! {
trait Store for Module<T: Trait> as Claims {
Claims get(claims) build(|config: &GenesisConfig<T>| {
config.claims.iter().map(|(a, b)| (a.clone(), b.clone())).collect::<Vec<_>>()
}): map EthereumAddress => Option<BalanceOf<T>>;
}): map hasher(blake2_256) EthereumAddress => Option<BalanceOf<T>>;
Total get(total) build(|config: &GenesisConfig<T>| {
config.claims.iter().fold(Zero::zero(), |acc: BalanceOf<T>, &(_, n)| acc + n)
}): BalanceOf<T>;
/// Vesting schedule for a claim.
/// First balance is the total amount that should be held for vesting.
/// Second balance is how much should be unlocked per block.
/// The block number is when the vesting should start.
Vesting get(vesting) config(): map EthereumAddress => Option<(BalanceOf<T>, BalanceOf<T>, T::BlockNumber)>;
Vesting get(vesting) config():
map hasher(blake2_256) EthereumAddress
=> Option<(BalanceOf<T>, BalanceOf<T>, T::BlockNumber)>;
}
add_extra_genesis {
config(claims): Vec<(EthereumAddress, BalanceOf<T>)>;
Expand Down
3 changes: 2 additions & 1 deletion runtime/common/src/crowdfund.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,8 @@ decl_storage! {
trait Store for Module<T: Trait> as Crowdfund {
/// Info on all of the funds.
Funds get(funds):
map FundIndex => Option<FundInfo<T::AccountId, BalanceOf<T>, T::Hash, T::BlockNumber>>;
map hasher(blake2_256) FundIndex
=> Option<FundInfo<T::AccountId, BalanceOf<T>, T::Hash, T::BlockNumber>>;

/// The total number of funds that have so far been allocated.
FundCount get(fund_count): FundIndex;
Expand Down
13 changes: 7 additions & 6 deletions runtime/common/src/parachains.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,27 +158,28 @@ decl_storage! {
/// All authorities' keys at the moment.
pub Authorities get(authorities): Vec<ValidatorId>;
/// The parachains registered at present.
pub Code get(parachain_code): map ParaId => Option<Vec<u8>>;
pub Code get(parachain_code): map hasher(blake2_256) ParaId => Option<Vec<u8>>;
/// The heads of the parachains registered at present.
pub Heads get(parachain_head): map ParaId => Option<Vec<u8>>;
pub Heads get(parachain_head): map hasher(blake2_256) ParaId => Option<Vec<u8>>;
/// The watermark heights of the parachains registered at present.
/// For every parachain, this is the block height from which all messages targeting
/// that parachain have been processed. Can be `None` only if the parachain doesn't exist.
pub Watermarks get(watermark): map ParaId => Option<T::BlockNumber>;
pub Watermarks get(watermark): map hasher(blake2_256) ParaId => Option<T::BlockNumber>;

/// Unrouted ingress. Maps (BlockNumber, to_chain) pairs to [(from_chain, egress_root)].
///
/// There may be an entry under (i, p) in this map for every i between the parachain's
/// watermark and the current block.
pub UnroutedIngress: map (T::BlockNumber, ParaId) => Option<Vec<(ParaId, Hash)>>;
pub UnroutedIngress:
map hasher(blake2_256) (T::BlockNumber, ParaId) => Option<Vec<(ParaId, Hash)>>;

/// Messages ready to be dispatched onto the relay chain. It is subject to
/// `MAX_MESSAGE_COUNT` and `WATERMARK_MESSAGE_SIZE`.
pub RelayDispatchQueue: map ParaId => Vec<UpwardMessage>;
pub RelayDispatchQueue: map hasher(blake2_256) ParaId => Vec<UpwardMessage>;
/// Size of the dispatch queues. Separated from actual data in order to avoid costly
/// decoding when checking receipt validity. First item in tuple is the count of messages
/// second if the total length (in bytes) of the message payloads.
pub RelayDispatchQueueSize: map ParaId => (u32, u32);
pub RelayDispatchQueueSize: map hasher(blake2_256) ParaId => (u32, u32);
/// The ordered list of ParaIds that have a `RelayDispatchQueue` entry.
NeedsDispatch: Vec<ParaId>;

Expand Down
6 changes: 3 additions & 3 deletions runtime/common/src/registrar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,16 @@ decl_storage! {
NextFreeId: ParaId = LOWEST_USER_ID;

/// Pending swap operations.
PendingSwap: map ParaId => Option<ParaId>;
PendingSwap: map hasher(blake2_256) ParaId => Option<ParaId>;

/// Map of all registered parathreads/chains.
Paras get(paras): map ParaId => Option<ParaInfo>;
Paras get(paras): map hasher(blake2_256) ParaId => Option<ParaInfo>;

/// The current queue for parathreads that should be retried.
RetryQueue get(retry_queue): Vec<Vec<(ParaId, CollatorId)>>;

/// Users who have paid a parathread's deposit
Debtors: map ParaId => T::AccountId;
Debtors: map hasher(blake2_256) ParaId => T::AccountId;
}
add_extra_genesis {
config(parachains): Vec<(ParaId, Vec<u8>, Vec<u8>)>;
Expand Down
14 changes: 8 additions & 6 deletions runtime/common/src/slots.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ decl_storage! {
/// If a parachain doesn't exist *yet* but is scheduled to exist in the future, then it
/// will be left-padded with one or more zeroes to denote the fact that nothing is held on
/// deposit for the non-existent chain currently, but is held at some point in the future.
pub Deposits get(deposits): map ParaId => Vec<BalanceOf<T>>;
pub Deposits get(deposits): map hasher(blake2_256) ParaId => Vec<BalanceOf<T>>;

/// Information relating to the current auction, if there is one.
///
Expand All @@ -158,26 +158,28 @@ decl_storage! {
/// The winning bids for each of the 10 ranges at each block in the final Ending Period of
/// the current auction. The map's key is the 0-based index into the Ending Period. The
/// first block of the ending period is 0; the last is `EndingPeriod - 1`.
pub Winning get(winning): map T::BlockNumber => Option<WinningData<T>>;
pub Winning get(winning): map hasher(blake2_256) T::BlockNumber => Option<WinningData<T>>;

/// Amounts currently reserved in the accounts of the bidders currently winning
/// (sub-)ranges.
pub ReservedAmounts get(reserved_amounts): map Bidder<T::AccountId> => Option<BalanceOf<T>>;
pub ReservedAmounts get(reserved_amounts):
map hasher(blake2_256) Bidder<T::AccountId> => Option<BalanceOf<T>>;

/// The set of Para IDs that have won and need to be on-boarded at an upcoming lease-period.
/// This is cleared out on the first block of the lease period.
pub OnboardQueue get(onboard_queue): map LeasePeriodOf<T> => Vec<ParaId>;
pub OnboardQueue get(onboard_queue): map hasher(blake2_256) LeasePeriodOf<T> => Vec<ParaId>;

/// The actual on-boarding information. Only exists when one of the following is true:
/// - It is before the lease period that the parachain should be on-boarded.
/// - The full on-boarding information has not yet been provided and the parachain is not
/// yet due to be off-boarded.
pub Onboarding get(onboarding): map ParaId =>
pub Onboarding get(onboarding):
map hasher(blake2_256) ParaId =>
Option<(LeasePeriodOf<T>, IncomingParachain<T::AccountId, T::Hash>)>;

/// Off-boarding account; currency held on deposit for the parachain gets placed here if the
/// parachain gets off-boarded; i.e. its lease period is up and it isn't renewed.
pub Offboarding get(offboarding): map ParaId => T::AccountId;
pub Offboarding get(offboarding): map hasher(blake2_256) ParaId => T::AccountId;
}
}

Expand Down