Skip to content

Commit

Permalink
fuck phantom data
Browse files Browse the repository at this point in the history
  • Loading branch information
Supremesource committed Dec 2, 2024
1 parent 755f787 commit b761321
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
2 changes: 1 addition & 1 deletion pallets/subnet_emission/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ pub mod pallet {
swap_storages: {
optional: { },
required: {
Weights: Vec<(u16, u16)> = |_: PhantomData<T>| Vec::<(u16, u16)>::new(),
Weights: Vec<(u16, u16)> = Vec::<(u16, u16)>::new(),
}
},
key_storages: { },
Expand Down
30 changes: 15 additions & 15 deletions pallets/subspace/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,27 +152,27 @@ pub mod pallet {
define_module_includes!(
// Put here every module-related storage map that has netuid as a key and holds a vector of values. The vector has to be indexed by the module uid.
vectors: {
Active: bool = |_: PhantomData<T>| false,
Consensus: u64 = |_: PhantomData<T>| 0,
Emission: u64 = |_: PhantomData<T>| 0,
Incentive: u64 = |_: PhantomData<T>| 0,
Dividends: u64 = |_: PhantomData<T>| 0,
LastUpdate: u64 = |_: PhantomData<T>| Pallet::<T>::get_current_block_number(),
Rank: u64 = |_: PhantomData<T>| 0,
Trust: u64 = |_: PhantomData<T>| 0,
ValidatorPermits: bool = |_: PhantomData<T>| false,
ValidatorTrust: u64 = |_: PhantomData<T>| 0,
PruningScores: u16 = |_: PhantomData<T>| 0,
Active: bool = false,
Consensus: u64 = 0,
Emission: u64 = 0,
Incentive: u64 = 0,
Dividends: u64 = 0,
LastUpdate: u64 = Pallet::<T>::get_current_block_number(),
Rank: u64 = 0,
Trust: u64 = 0,
ValidatorPermits: bool = false,
ValidatorTrust: u64 = 0,
PruningScores: u16 = 0,
},
// Put here every module-related double map, where the first key is netuid, second key is module uid. These storages holds some value for each module ie. name, address, etc.
swap_storages: {
optional: {
},
required: {
RegistrationBlock: u64 = |_: PhantomData<T>| Pallet::<T>::get_current_block_number(),
Address: Vec<u8> = |_: PhantomData<T>| Vec::<u8>::new(),
Name: Vec<u8> = |_: PhantomData<T>| Vec::<u8>::new(),
Bonds: Vec<(u16, u16)> = |_: PhantomData<T>| Vec::<(u16, u16)>::new(),
RegistrationBlock: u64 = Pallet::<T>::get_current_block_number(),
Address: Vec<u8> = Vec::<u8>::new(),
Name: Vec<u8> = Vec::<u8>::new(),
Bonds: Vec<(u16, u16)> = Vec::<(u16, u16)>::new(),
}
},
// Specifically for uids and keys
Expand Down
6 changes: 3 additions & 3 deletions pallets/subspace/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ macro_rules! define_module_includes {
Self::$vec => {
let mut vec = $vec::<T>::get(netuid);
$(
vec.push($vec_default(PhantomData::<T>));
vec.push($vec_default);
)?
$vec::<T>::insert(netuid, vec);
Ok(())
Expand Down Expand Up @@ -242,13 +242,13 @@ macro_rules! define_module_includes {
match self {
$(
Self::$opt_swap => {
$($opt_swap::<T>::insert(netuid, uid, $opt_default(PhantomData::<T>));)?
$($opt_swap::<T>::insert(netuid, uid, $opt_default);)?
Ok(())
},
)*
$(
Self::$req_swap => {
$($req_swap::<T>::insert(netuid, uid, $req_default(PhantomData::<T>));)?
$($req_swap::<T>::insert(netuid, uid, $req_default);)?
Ok(())
},
)*
Expand Down

0 comments on commit b761321

Please sign in to comment.