Skip to content

Commit 7e8e12c

Browse files
committed
Removed get_voting_power_ema_alpha chain ext func, unnecessary use for smart ctx
1 parent 4394ecd commit 7e8e12c

4 files changed

Lines changed: 0 additions & 41 deletions

File tree

chain-extensions/src/lib.rs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -583,18 +583,6 @@ where
583583

584584
Ok(RetVal::Converging(Output::Success as u32))
585585
}
586-
FunctionId::GetVotingPowerEmaAlphaV1 => {
587-
let netuid: NetUid = env
588-
.read_as()
589-
.map_err(|_| DispatchError::Other("Failed to decode input parameters"))?;
590-
591-
let ema_alpha = pallet_subtensor::Pallet::<T>::get_voting_power_ema_alpha(netuid);
592-
593-
env.write_output(&ema_alpha.encode())
594-
.map_err(|_| DispatchError::Other("Failed to write output"))?;
595-
596-
Ok(RetVal::Converging(Output::Success as u32))
597-
}
598586
}
599587
}
600588
}

chain-extensions/src/tests.rs

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1155,30 +1155,3 @@ fn get_voting_power_disable_at_block_returns_value() {
11551155
assert_eq!(disable_at_block, expected_block);
11561156
});
11571157
}
1158-
1159-
#[test]
1160-
fn get_voting_power_ema_alpha_returns_value() {
1161-
mock::new_test_ext(1).execute_with(|| {
1162-
let owner_hotkey = U256::from(9501);
1163-
let owner_coldkey = U256::from(9502);
1164-
let caller = U256::from(9503);
1165-
1166-
let netuid = mock::add_dynamic_network(&owner_hotkey, &owner_coldkey);
1167-
1168-
let expected_alpha: u64 = 500_000_000_000_000_000; // 0.5 in 18 decimal precision
1169-
pallet_subtensor::VotingPowerEmaAlpha::<mock::Test>::insert(netuid, expected_alpha);
1170-
1171-
let mut env = MockEnv::new(
1172-
FunctionId::GetVotingPowerEmaAlphaV1,
1173-
caller,
1174-
netuid.encode(),
1175-
);
1176-
1177-
let ret = SubtensorChainExtension::<mock::Test>::dispatch(&mut env).unwrap();
1178-
assert_success(ret);
1179-
assert!(env.charged_weight().is_none());
1180-
1181-
let ema_alpha: u64 = Decode::decode(&mut &env.output()[..]).unwrap();
1182-
assert_eq!(ema_alpha, expected_alpha);
1183-
});
1184-
}

chain-extensions/src/types.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ pub enum FunctionId {
2525
GetTotalVotingPowerV1 = 17,
2626
IsVotingPowerTrackingEnabledV1 = 18,
2727
GetVotingPowerDisableAtBlockV1 = 19,
28-
GetVotingPowerEmaAlphaV1 = 20,
2928
}
3029

3130
#[derive(PartialEq, Eq, Copy, Clone, Encode, Decode, Debug)]

docs/wasm-contracts.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ Subtensor provides a custom chain extension that allows smart contracts to inter
4848
| 17 | `get_total_voting_power` | Get total voting power across all hotkeys in a subnet | `(NetUid)` | `u64` |
4949
| 18 | `is_voting_power_tracking_enabled` | Check if voting power tracking is enabled for a subnet | `(NetUid)` | `bool` |
5050
| 19 | `get_voting_power_disable_at_block` | Get the block number at which voting power tracking will be disabled | `(NetUid)` | `Option<BlockNumber>` |
51-
| 20 | `get_voting_power_ema_alpha` | Get the EMA alpha value used for voting power calculations | `(NetUid)` | `u32` |
5251

5352
Example usage in your ink! contract:
5453
```rust

0 commit comments

Comments
 (0)