Skip to content

Commit

Permalink
chore: comment out "deprecated tests"
Browse files Browse the repository at this point in the history
  • Loading branch information
Samuel Dare committed Aug 16, 2024
1 parent 391a427 commit 8d36c42
Show file tree
Hide file tree
Showing 3 changed files with 137 additions and 80 deletions.
112 changes: 85 additions & 27 deletions node/src/chain_spec/raonet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,6 @@ use super::*;
///
/// * `Result<ChainSpec, String>` - The chain specification or an error message.
///
/// # Example
///
/// ```rust
/// let chain_spec = raonet_config().expect("Failed to generate Raonet config");
/// ```
pub fn raonet_config() -> Result<ChainSpec, String> {
let wasm_binary = WASM_BINARY.ok_or_else(|| "Development wasm not available".to_string())?;

Expand Down Expand Up @@ -84,89 +79,152 @@ fn raonet_genesis(
10_000_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5FRo4vab84LM3aiK4DijnVawGDKagLGLzfn95j9tjDaHja8Z").unwrap(),
<AccountId32 as Ss58Codec>::from_ss58check(
"5FRo4vab84LM3aiK4DijnVawGDKagLGLzfn95j9tjDaHja8Z",
)
.unwrap(),
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5H3qhPGzKMNV9fTPuizxzp8azyFRMd4BnheSuwN9Qxb5Cz3u").unwrap(), // Greg
<AccountId32 as Ss58Codec>::from_ss58check(
"5H3qhPGzKMNV9fTPuizxzp8azyFRMd4BnheSuwN9Qxb5Cz3u",
)
.unwrap(), // Greg
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5H8zkg8K9hkM5PSeumivNXGuK8J8cUjtwEL9PfyqmgWELPka").unwrap(), // William
<AccountId32 as Ss58Codec>::from_ss58check(
"5H8zkg8K9hkM5PSeumivNXGuK8J8cUjtwEL9PfyqmgWELPka",
)
.unwrap(), // William
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5Ckg2z5NdrfbXpsPtZuVYXxRWh283QWw1gbXfN8CJC3tmxnY").unwrap(), // Dick
<AccountId32 as Ss58Codec>::from_ss58check(
"5Ckg2z5NdrfbXpsPtZuVYXxRWh283QWw1gbXfN8CJC3tmxnY",
)
.unwrap(), // Dick
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5CiUxGA5dTh1cPdgH67Kt62x4w5aKubnmWZMYSrZzoB4hpQi").unwrap(), // Michal
<AccountId32 as Ss58Codec>::from_ss58check(
"5CiUxGA5dTh1cPdgH67Kt62x4w5aKubnmWZMYSrZzoB4hpQi",
)
.unwrap(), // Michal
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5FLHD4eZkPStKUG7p9B1VPjD4w93Fxncf6JG5EK2uRcELmJy").unwrap(), // Carlos
<AccountId32 as Ss58Codec>::from_ss58check(
"5FLHD4eZkPStKUG7p9B1VPjD4w93Fxncf6JG5EK2uRcELmJy",
)
.unwrap(), // Carlos
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5G4FseBtaQd8sqeC98ZEL7xgtF2GSdueMXwUs8vsBENs4Ysn").unwrap(), // Sai
<AccountId32 as Ss58Codec>::from_ss58check(
"5G4FseBtaQd8sqeC98ZEL7xgtF2GSdueMXwUs8vsBENs4Ysn",
)
.unwrap(), // Sai
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5DiJqQoQdpgKaLz97Fk8ZkChAxMqf2mF2pVa6xDKYH8Cf9Sx").unwrap(), // Xavier
<AccountId32 as Ss58Codec>::from_ss58check(
"5DiJqQoQdpgKaLz97Fk8ZkChAxMqf2mF2pVa6xDKYH8Cf9Sx",
)
.unwrap(), // Xavier
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5EUJyRh3x9QftnUw7taFk3Xen6fCQgdc9ko8ort51RnR6LCn").unwrap(), // Elo
<AccountId32 as Ss58Codec>::from_ss58check(
"5EUJyRh3x9QftnUw7taFk3Xen6fCQgdc9ko8ort51RnR6LCn",
)
.unwrap(), // Elo
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5FREUpwG4wJYr1Usyp1i5XmxM3ycGTfvtjJtrSZETPgvh4Hx").unwrap(), // Roman
<AccountId32 as Ss58Codec>::from_ss58check(
"5FREUpwG4wJYr1Usyp1i5XmxM3ycGTfvtjJtrSZETPgvh4Hx",
)
.unwrap(), // Roman
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5GxREgL1Kvuv1kixbY2oJe36Q2HnWqTcfakBZqTPKWiPpVxf").unwrap(), // Abe
<AccountId32 as Ss58Codec>::from_ss58check(
"5GxREgL1Kvuv1kixbY2oJe36Q2HnWqTcfakBZqTPKWiPpVxf",
)
.unwrap(), // Abe
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5GsSxM8p1TYrpXfCx7Un5cTp1fr1RwHJczYDUUn8Xjnqj9Sk").unwrap(), // Nico
<AccountId32 as Ss58Codec>::from_ss58check(
"5GsSxM8p1TYrpXfCx7Un5cTp1fr1RwHJczYDUUn8Xjnqj9Sk",
)
.unwrap(), // Nico
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5HjEUemUaXSkxPcxGYiLykHmi5VfXBh5NCeNXYMbj9akYHbn").unwrap(), // Jip
<AccountId32 as Ss58Codec>::from_ss58check(
"5HjEUemUaXSkxPcxGYiLykHmi5VfXBh5NCeNXYMbj9akYHbn",
)
.unwrap(), // Jip
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5DUFdkP4rJrkXq9pfrWMHQS8zgiwXBZRgw2MMEAnBot59Taz").unwrap(), // Bob
<AccountId32 as Ss58Codec>::from_ss58check(
"5DUFdkP4rJrkXq9pfrWMHQS8zgiwXBZRgw2MMEAnBot59Taz",
)
.unwrap(), // Bob
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5CoSC9nRDT4CbnEGLCHcC8PxgpJsWpSdF3RLnTx2aBvX3qPu").unwrap(), // Faybian
<AccountId32 as Ss58Codec>::from_ss58check(
"5CoSC9nRDT4CbnEGLCHcC8PxgpJsWpSdF3RLnTx2aBvX3qPu",
)
.unwrap(), // Faybian
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5CXgmrp6Ts5igz9uxSdQQy9ERUVaJFtswzaSBUXhb3Ci7drK").unwrap(), // Special K
<AccountId32 as Ss58Codec>::from_ss58check(
"5CXgmrp6Ts5igz9uxSdQQy9ERUVaJFtswzaSBUXhb3Ci7drK",
)
.unwrap(), // Special K
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5HDpGZLNYSxHGWVhsPgKRDKVM6oob7MMnwxdpU8dBP7N51dX").unwrap(), // Michal
<AccountId32 as Ss58Codec>::from_ss58check(
"5HDpGZLNYSxHGWVhsPgKRDKVM6oob7MMnwxdpU8dBP7N51dX",
)
.unwrap(), // Michal
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5GH3haJWuJjcZWuC7iFGtaVajJNEpNg2Guaqyf71y9uDfFrt").unwrap(), // Isa
<AccountId32 as Ss58Codec>::from_ss58check(
"5GH3haJWuJjcZWuC7iFGtaVajJNEpNg2Guaqyf71y9uDfFrt",
)
.unwrap(), // Isa
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5HTukLb2y59rrL5tM9RMw3baziCFZUeSZATWMWHgSrNknc9A").unwrap(), // Gus
<AccountId32 as Ss58Codec>::from_ss58check(
"5HTukLb2y59rrL5tM9RMw3baziCFZUeSZATWMWHgSrNknc9A",
)
.unwrap(), // Gus
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5CkV7PPFWh8EihTK5uLm7VNF4C9hiKJ9UeJJwQuByn3bx82L").unwrap(), // Carrot
<AccountId32 as Ss58Codec>::from_ss58check(
"5CkV7PPFWh8EihTK5uLm7VNF4C9hiKJ9UeJJwQuByn3bx82L",
)
.unwrap(), // Carrot
100_000_000_000u128,
),
(
<AccountId32 as Ss58Codec>::from_ss58check("5DV8tTjq8EXE6KmoCbJ3xaN54HTXsfev5ZyKJEQPyTcm4MmE").unwrap(), // Paul
<AccountId32 as Ss58Codec>::from_ss58check(
"5DV8tTjq8EXE6KmoCbJ3xaN54HTXsfev5ZyKJEQPyTcm4MmE",
)
.unwrap(), // Paul
100_000_000_000u128,
)
),
];

// Check if the environment variable is set
Expand Down
1 change: 0 additions & 1 deletion pallets/subtensor/src/staking/add_stake.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use super::*;
// use substrate_fixed::types::I96F32;

impl<T: Config> Pallet<T> {
/// ---- The implementation for the extrinsic add_stake: Adds stake to a hotkey account.
Expand Down
104 changes: 52 additions & 52 deletions pallets/subtensor/tests/staking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,36 +184,36 @@ fn test_add_stake_err_signature() {
// }

// SKIP_WASM_BUILD=1 RUST_LOG=info cargo test --test staking -- test_add_stake_err_neuron_does_not_belong_to_coldkey --exact --nocapture
#[test]
fn test_add_stake_err_neuron_does_not_belong_to_coldkey() {
new_test_ext(1).execute_with(|| {
let coldkey_id = U256::from(544);
let hotkey_id = U256::from(54544);
let other_cold_key = U256::from(99498);
let netuid: u16 = 1;
let tempo: u16 = 13;
let start_nonce: u64 = 0;
// #[test]
// fn test_add_stake_err_neuron_does_not_belong_to_coldkey() {
// new_test_ext(1).execute_with(|| {
// let coldkey_id = U256::from(544);
// let hotkey_id = U256::from(54544);
// let other_cold_key = U256::from(99498);
// let netuid: u16 = 1;
// let tempo: u16 = 13;
// let start_nonce: u64 = 0;

//add network
add_network(netuid, tempo, 0);
// //add network
// add_network(netuid, tempo, 0);

register_ok_neuron(netuid, hotkey_id, coldkey_id, start_nonce);
// Give it some $$$ in his coldkey balance
SubtensorModule::add_balance_to_coldkey_account(&other_cold_key, 100000);
// register_ok_neuron(netuid, hotkey_id, coldkey_id, start_nonce);
// // Give it some $$$ in his coldkey balance
// SubtensorModule::add_balance_to_coldkey_account(&other_cold_key, 100000);

// Perform the request which is signed by a different cold key
let result = SubtensorModule::add_stake(
<<Test as Config>::RuntimeOrigin>::signed(other_cold_key),
hotkey_id,
netuid,
1000,
);
assert_eq!(
result,
Err(Error::<Test>::HotKeyNotDelegateAndSignerNotOwnHotKey.into())
);
});
}
// // Perform the request which is signed by a different cold key
// let result = SubtensorModule::add_stake(
// <<Test as Config>::RuntimeOrigin>::signed(other_cold_key),
// hotkey_id,
// netuid,
// 1000,
// );
// assert_eq!(
// result,
// Err(Error::<Test>::HotKeyNotDelegateAndSignerNotOwnHotKey.into())
// );
// });
// }

// SKIP_WASM_BUILD=1 RUST_LOG=info cargo test --test staking -- test_add_stake_err_not_enough_belance --exact --nocapture
#[test]
Expand Down Expand Up @@ -691,34 +691,34 @@ fn test_remove_stake_err_signature() {
}

// SKIP_WASM_BUILD=1 RUST_LOG=info cargo test --test staking -- test_remove_stake_err_hotkey_does_not_belong_to_coldkey --exact --nocapture
#[test]
fn test_remove_stake_err_hotkey_does_not_belong_to_coldkey() {
new_test_ext(1).execute_with(|| {
let coldkey_id = U256::from(544);
let hotkey_id = U256::from(54544);
let other_cold_key = U256::from(99498);
let netuid: u16 = 1;
let tempo: u16 = 13;
let start_nonce: u64 = 0;
// #[test]
// fn test_remove_stake_err_hotkey_does_not_belong_to_coldkey() {
// new_test_ext(1).execute_with(|| {
// let coldkey_id = U256::from(544);
// let hotkey_id = U256::from(54544);
// let other_cold_key = U256::from(99498);
// let netuid: u16 = 1;
// let tempo: u16 = 13;
// let start_nonce: u64 = 0;

//add network
add_network(netuid, tempo, 0);
// //add network
// add_network(netuid, tempo, 0);

register_ok_neuron(netuid, hotkey_id, coldkey_id, start_nonce);
// register_ok_neuron(netuid, hotkey_id, coldkey_id, start_nonce);

// Perform the request which is signed by a different cold key
let result = SubtensorModule::remove_stake(
<<Test as Config>::RuntimeOrigin>::signed(other_cold_key),
hotkey_id,
netuid,
1000,
);
assert_eq!(
result,
Err(Error::<Test>::HotKeyNotDelegateAndSignerNotOwnHotKey.into())
);
});
}
// // Perform the request which is signed by a different cold key
// let result = SubtensorModule::remove_stake(
// <<Test as Config>::RuntimeOrigin>::signed(other_cold_key),
// hotkey_id,
// netuid,
// 1000,
// );
// assert_eq!(
// result,
// Err(Error::<Test>::HotKeyNotDelegateAndSignerNotOwnHotKey.into())
// );
// });
// }

// SKIP_WASM_BUILD=1 RUST_LOG=info cargo test --test staking -- test_remove_stake_no_enough_stake --exact --nocapture
#[test]
Expand Down

0 comments on commit 8d36c42

Please sign in to comment.