Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
324 commits
Select commit Hold shift + click to select a range
79d697b
Fix tests
gztensor Dec 16, 2025
ac1b1c8
add prod_or_fast
l0r1s Dec 16, 2025
c9aedf6
Use Sam's bigmath crate for exponentiation
gztensor Dec 17, 2025
1bc3092
Adjust fuzzy epsilon
gztensor Dec 17, 2025
81eab8e
Use rayon for fuzzy testing
gztensor Dec 17, 2025
8bdafa7
Cleanup full vs limited range testing
gztensor Dec 17, 2025
9dba44e
fix typo
basfroman Dec 18, 2025
82ca17b
Merge branch 'devnet-ready' into rework-coldkey-swap
basfroman Dec 18, 2025
b91ca21
Update bigmath, debug current_price, implement adjust_protocol_liquid…
gztensor Dec 18, 2025
f3daa79
Implement delta_in and tests
gztensor Dec 18, 2025
ef71b3c
Merge devnet-ready
gztensor Dec 18, 2025
e3d4585
update comment
l0r1s Dec 19, 2025
3706c1d
Merge branch 'devnet-ready' into rework-coldkey-swap
l0r1s Dec 19, 2025
be0e7dd
bump spec version
l0r1s Dec 19, 2025
0fe9842
Update bigmath, add testcases
gztensor Dec 19, 2025
921ace4
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Dec 22, 2025
9292044
Basic swap works
gztensor Dec 22, 2025
30be6ea
Swap tests in progress
gztensor Dec 22, 2025
9de9f7c
allow for reannouncement in tx ext
l0r1s Dec 23, 2025
22019e3
Fix test_clear_protocol_liquidity_green_path
gztensor Dec 23, 2025
9c9b646
Fix test_claim_root_with_run_coinbase
gztensor Dec 23, 2025
a27f1b5
Add swap initialization to interface
gztensor Dec 23, 2025
afa0d45
Fix test_coinbase_subnet_terms_with_alpha_in_gt_alpha_emission
gztensor Dec 24, 2025
243df1e
Fix test_mining_emission_distribution_with_no_root_sell
gztensor Dec 24, 2025
d2f9e2b
Fix test_mining_emission_distribution_with_root_sell
gztensor Dec 24, 2025
96402fd
Fix test_pending_emission_start_call_not_done
gztensor Dec 24, 2025
6c55c7b
Remove non-zero delta-out requirement for zero delta-in. Fix test_mig…
gztensor Dec 24, 2025
b8d5ffe
Fix test_add_stake_insufficient_liquidity_one_side_ok
gztensor Dec 26, 2025
1c663f1
Fix dissolve_clears_all_per_subnet_storages
gztensor Dec 26, 2025
25a9e5d
Fix test_large_swap, improve error messaging
gztensor Dec 26, 2025
213a984
Fix test_add_stake_limit_fill_or_kill
gztensor Dec 26, 2025
b755f0e
Fix test_max_amount_add_dynamic
gztensor Dec 26, 2025
26cca0b
Fix test_max_amount_move_dynamic_dynamic
gztensor Dec 26, 2025
7c51712
Re-enable balancer math test cases
gztensor Dec 26, 2025
6ce98e2
Fix test_max_amount_move_dynamic_stable
gztensor Dec 29, 2025
483dcd4
Fix test_max_amount_move_stable_dynamic
gztensor Dec 29, 2025
3f152bf
Fix test_max_amount_remove_dynamic
gztensor Dec 29, 2025
fb9d494
Fix test_stake_into_subnet_low_amount
gztensor Dec 29, 2025
72262b2
Fix test_swap_fees_tao_correctness
gztensor Dec 29, 2025
5fdc9f9
Refactor: Rename ReserveWeights to Balancer
gztensor Dec 29, 2025
1cc1921
Fix test_claim_root_coinbase_distribution
gztensor Dec 30, 2025
be6fd6f
Fix test_adjust_protocol_liquidity_happy
gztensor Dec 30, 2025
1540d30
Disable add_liquidity tests, fix test_swap_initialization
gztensor Dec 30, 2025
e75ee3a
Update bigmath, cleanup balancer math, add missing balancer tests
gztensor Jan 2, 2026
e7b878c
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Jan 2, 2026
2b5b7dc
auto-update benchmark weights
github-actions[bot] Jan 5, 2026
49accc1
Remove provided reserve maps, add liquidity calculation method to bal…
gztensor Jan 5, 2026
c4e21e7
Add test for CurrentLiquidity initialization
gztensor Jan 5, 2026
f97e56c
Fix exponentiation in liquidity calculation
gztensor Jan 6, 2026
7634aee
Update to most recent bigmath
gztensor Jan 7, 2026
0bd3c78
local
sam0x17 Jan 7, 2026
9fed25e
Collect protocol fees in adjust_protocol_liquidity and add to reserves
gztensor Jan 8, 2026
ca466df
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Jan 8, 2026
71995f0
fix
sam0x17 Jan 8, 2026
cf5f277
Merge remote-tracking branch 'origin/feat/balancer_swap' into feat/ba…
sam0x17 Jan 8, 2026
b2744c8
Remove todo() macros from position.rs file
gztensor Jan 8, 2026
1dd3e67
Address a todo in test_remove_stake_edge_alpha
gztensor Jan 8, 2026
56c001e
Remove todo macros from liquidity extrinsics, make them return error
gztensor Jan 8, 2026
c2bbe99
Fix clippy (all except SafeInt)
gztensor Jan 8, 2026
244fbfc
Add more test cases for test_convert_deltas, correct order of swap in…
gztensor Jan 9, 2026
8d19821
Disable add/remove/modify liquidity benchmarks
gztensor Jan 9, 2026
80e9cec
Add reminders to removed benchmarks
gztensor Jan 9, 2026
fbb015c
Fix custom lints
gztensor Jan 9, 2026
65bb1c2
Fix zepter ci
gztensor Jan 9, 2026
98e2429
simplify pallet_shield config
l0r1s Jan 9, 2026
31ac0ad
added pallet_shield to subtensor mock
l0r1s Jan 9, 2026
df326fb
allow mev transaction to go through while ongoing swap
l0r1s Jan 9, 2026
7d466f1
fix benchmarks bounds
l0r1s Jan 9, 2026
fb050fd
fix zepter
l0r1s Jan 9, 2026
87fa1dc
Fix benchmarks
gztensor Jan 9, 2026
44c5111
Merge branch 'devnet-ready' into rework-coldkey-swap
l0r1s Jan 9, 2026
3a913e0
fix precompiles bounds
l0r1s Jan 9, 2026
c160f7b
fix zepter
l0r1s Jan 9, 2026
b021c56
Fix remove_stake_full_limit
gztensor Jan 9, 2026
b1067d4
fix js test
l0r1s Jan 10, 2026
6723152
Add clippy ignore for SafeInt division
gztensor Jan 12, 2026
8d48806
Add tests for palswap initialization with price in migration
gztensor Jan 12, 2026
55f9bba
Fix price initialization
gztensor Jan 12, 2026
485949d
Fix remove_stake_full_limit benchmark
gztensor Jan 12, 2026
9f5ca77
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Jan 12, 2026
b4ecbc3
Fix remove_stake_full_limit benchmark
gztensor Jan 12, 2026
860f9eb
Remove unused function get_dynamic_tao_emission and the related test
gztensor Jan 15, 2026
dc47def
Cleanup unused imports
gztensor Jan 15, 2026
023e0a8
add migration to hook
l0r1s Jan 15, 2026
f948079
Merge branch 'devnet-ready' into rework-coldkey-swap
l0r1s Jan 15, 2026
3b18a2e
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Jan 15, 2026
a3756d9
Add R&D tests for exp_scaled
gztensor Jan 15, 2026
06c2f71
Fix typo
gztensor Jan 16, 2026
3143a79
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Jan 16, 2026
34029fb
Merge branch 'devnet-ready' into rework-coldkey-swap
l0r1s Jan 19, 2026
c6b55ed
check migration ran
l0r1s Jan 19, 2026
aec9bdd
ensure swap cost is charged correctly + fix tests
l0r1s Jan 19, 2026
6c6b855
fix naming left_over -> ed
l0r1s Jan 19, 2026
903848b
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Jan 19, 2026
b826b2a
Merge branch 'devnet-ready' into feat/settable-max-mech-count
gztensor Jan 19, 2026
a512875
Fix extrinsic index
gztensor Jan 19, 2026
834f14c
Reapply "Voting Power EMA"
ppolewicz Jan 19, 2026
d5d985f
Use AlphaCurrency type for stake in EpochTerms
ppolewicz Jan 19, 2026
cb74680
auto-update benchmark weights
github-actions[bot] Jan 20, 2026
550ce8d
fmt
JohnReedV Jan 20, 2026
7f8fdd5
fix voting power ema alpha check
open-junius Jan 20, 2026
4864909
fix high network registration fee
open-junius Jan 20, 2026
b2869b6
reset as default value
open-junius Jan 20, 2026
6cf5808
set as default value for last lock cost
open-junius Jan 20, 2026
0dece67
remove reannouncement delay + fix tests
l0r1s Jan 20, 2026
09d4dbd
remove deadcode
l0r1s Jan 20, 2026
f7c7731
added test for no cost root swap
l0r1s Jan 20, 2026
340de89
fix call index
l0r1s Jan 20, 2026
ae8b5f2
remove unused param
l0r1s Jan 20, 2026
cafad6b
check old ck is cleared by root call
l0r1s Jan 20, 2026
fb5f1b9
fix benchmark import
l0r1s Jan 20, 2026
09ae2f1
clippy
l0r1s Jan 20, 2026
6a1d7c2
cargo fmt
l0r1s Jan 20, 2026
138e892
Update base call filter
shamil-gadelshin Jan 20, 2026
898b79a
Merge branch 'devnet-ready' into rework-coldkey-swap
l0r1s Jan 20, 2026
703245a
bump spec version
l0r1s Jan 20, 2026
d1f4f3e
Merge pull request #2360 from opentensor/fix-voting-power-ema-alpha-c…
ppolewicz Jan 20, 2026
3a3379f
bump spec
JohnReedV Jan 20, 2026
3455b1b
fix benchmarks
l0r1s Jan 20, 2026
9426cc5
restore reannouncement logic
l0r1s Jan 21, 2026
566efcd
add coldkey swap dispute logic and tests
l0r1s Jan 21, 2026
2f8b1e8
restore contract-tests package json
l0r1s Jan 21, 2026
0d9c549
Merge branch 'devnet-ready' into rework-coldkey-swap
l0r1s Jan 21, 2026
8b7c1ad
bump spec version
l0r1s Jan 22, 2026
89c6e15
auto-update benchmark weights
github-actions[bot] Jan 22, 2026
1af61f8
fix event emitting for reset_coldkey_swap
l0r1s Jan 22, 2026
9c11f2e
cargo clippy
l0r1s Jan 22, 2026
def22e2
auto-update benchmark weights
github-actions[bot] Jan 22, 2026
82c1fe7
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Jan 22, 2026
682a4a9
Fix merge issue
gztensor Jan 22, 2026
7fdb0bf
Bump spec version
gztensor Jan 22, 2026
2f71370
Merge branch 'devnet-ready' into inner-calls
shamil-gadelshin Jan 23, 2026
5a1ad2c
Bump spec version
shamil-gadelshin Jan 23, 2026
7da419b
move tx extension to own module
l0r1s Jan 23, 2026
63ff1c1
fix types
l0r1s Jan 23, 2026
3d4ae5f
move check ck swap to its own tx ext and handle proxies
l0r1s Jan 23, 2026
7bbfbda
embed check coldkey swap tests
l0r1s Jan 23, 2026
15fab27
fix weight zero
l0r1s Jan 23, 2026
989f668
fix bounds
l0r1s Jan 23, 2026
a07cdb2
commit Cargo.lock
l0r1s Jan 23, 2026
639994d
commit Cargo.lock
l0r1s Jan 23, 2026
9f3cab5
auto-update benchmark weights
github-actions[bot] Jan 24, 2026
bfc5d4e
allow dispute to go through
l0r1s Jan 24, 2026
2651ec1
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Jan 26, 2026
3526657
Fix add_liquidity signature
gztensor Jan 26, 2026
77aa4b6
Add logging for errors in disable_lp
gztensor Jan 26, 2026
392d2d7
Merge branch 'devnet-ready' into voting-power-feature-2
ppolewicz Jan 27, 2026
34bc012
integration test zero code precompile
open-junius Jan 28, 2026
a19b44a
Merge pull request #2251 from opentensor/rework-coldkey-swap
sam0x17 Jan 28, 2026
b0d9c98
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Jan 28, 2026
ee32e1e
Merge branch 'devnet-ready' into chore/remove-unused-get_dynamic_tao_…
gztensor Jan 28, 2026
92c59b1
Merge branch 'devnet-ready' into feat/settable-max-mech-count
gztensor Jan 28, 2026
01c12d3
Spec bump
gztensor Jan 28, 2026
5d6819c
Introduce subnet_buyback()
shamil-gadelshin Jan 28, 2026
4f20dad
Add benchmark
shamil-gadelshin Jan 29, 2026
0f13af6
added scripts for local deps
l0r1s Jan 29, 2026
9319e91
Add rate limit
shamil-gadelshin Jan 29, 2026
8b30ccd
Boost priority of subnet_buyback()
shamil-gadelshin Jan 29, 2026
08dd4e4
Merge pull request #2380 from opentensor/update-deps-script
sam0x17 Jan 29, 2026
ee23d6e
Merge pull request #2364 from opentensor/inner-calls
sam0x17 Jan 29, 2026
6b74621
Merge remote-tracking branch 'origin/main' into devnet-ready
sam0x17 Jan 29, 2026
115c289
Merge pull request #2368 from opentensor/initialize-pending-block
sam0x17 Jan 29, 2026
96f2724
Merge branch 'devnet-ready' into voting-power-feature-2
ppolewicz Jan 29, 2026
e1ada50
Add get_base_needed_for_quote method to balancer (for alpha fees)
gztensor Jan 29, 2026
9f95642
Merge branch 'devnet-ready' into subnet_buyback
shamil-gadelshin Jan 30, 2026
b74cd90
Fix merge
shamil-gadelshin Jan 30, 2026
fb2313f
Add subnet owner check in tx extention for subnet_buyback
shamil-gadelshin Jan 30, 2026
0989ba2
add precompile wrapper test
open-junius Jan 30, 2026
a6d12c8
merge with denvet-ready
open-junius Jan 30, 2026
f906734
revert lock file
open-junius Jan 30, 2026
6f1b568
Merge pull request #2358 from opentensor/voting-power-feature-2
sam0x17 Jan 30, 2026
42083cb
test is ok
open-junius Feb 2, 2026
0a83c42
format code
open-junius Feb 2, 2026
672b993
Merge branch 'devnet-ready' into subnet_buyback
shamil-gadelshin Feb 2, 2026
57caa89
Add SubnetBuyback event
shamil-gadelshin Feb 2, 2026
6ec23e8
Bump spec version
shamil-gadelshin Feb 2, 2026
6a23875
Merge branch 'devnet-ready' into integration-test-zero-code-precompile
open-junius Feb 2, 2026
a72d9f5
auto-update benchmark weights
github-actions[bot] Feb 2, 2026
84dc940
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Feb 2, 2026
0729e36
Spec bump
gztensor Feb 2, 2026
1971baa
Merge devnet-ready
gztensor Feb 2, 2026
1087711
Spec bump
gztensor Feb 2, 2026
0d2e46a
Merge branch 'devnet-ready' into feat/settable-max-mech-count
gztensor Feb 2, 2026
18035dc
Spec bump
gztensor Feb 2, 2026
a68189d
Balancer documentation
gztensor Feb 2, 2026
2a6e807
More balancer docs
gztensor Feb 2, 2026
d07405a
bump version
open-junius Feb 3, 2026
a3ff015
Merge remote-tracking branch 'origin/main' into devnet-ready
sam0x17 Feb 3, 2026
a67c9e7
Add current_alpha_price_all swap RPC, add slippage to sim_swap_tao_fo…
gztensor Feb 3, 2026
6b523e5
Merge branch 'devnet-ready' into feat/settable-max-mech-count
gztensor Feb 3, 2026
fb0017f
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Feb 3, 2026
fb25875
Merge branch 'devnet-ready' into chore/remove-unused-get_dynamic_tao_…
gztensor Feb 3, 2026
119d64b
Fix try-runtime build
gztensor Feb 3, 2026
1826798
Merge pull request #2183 from opentensor/feat/settable-max-mech-count
sam0x17 Feb 3, 2026
f1b090d
Remove unused user liquidity code
gztensor Feb 3, 2026
7e8dc3a
Cleanup test_claim_root_coinbase_distribution test
gztensor Feb 3, 2026
4e21da2
More user liquidity cleanup
gztensor Feb 3, 2026
a8579be
Add freeze struct to TickIndex and PositionId
gztensor Feb 3, 2026
a5ac9a3
fix conflict
open-junius Feb 4, 2026
a4dd2fd
add transaction replacement test case
open-junius Feb 4, 2026
6faf9ac
bump version
open-junius Feb 4, 2026
81cb079
catch error with wrong nonce
open-junius Feb 4, 2026
96a5583
less sleep
open-junius Feb 4, 2026
33f8e14
Merge pull request #2346 from opentensor/chore/remove-unused-get_dyna…
sam0x17 Feb 4, 2026
8a0ea39
raise fee on `set_pending_childkey_cooldown`
JohnReedV Feb 4, 2026
4c0f1f1
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Feb 4, 2026
ab43e6b
Fix build errors
gztensor Feb 4, 2026
a2d8fc9
Merge branch 'devnet-ready' into subnet_buyback
shamil-gadelshin Feb 4, 2026
62d735b
Merge pull request #2393 from opentensor/raise-fee-set-pending-childk…
sam0x17 Feb 4, 2026
7809143
Merge remote-tracking branch 'origin/devnet-ready' into feat/balancer…
sam0x17 Feb 4, 2026
24d232b
Fix sudo_set_max_allowed_uids benchmark
gztensor Feb 4, 2026
e6123ab
Merge pull request #2381 from opentensor/subnet_buyback
sam0x17 Feb 4, 2026
6f69220
Merge pull request #2391 from opentensor/transaction-replace-test
open-junius Feb 5, 2026
822452f
Merge pull request #2377 from opentensor/integration-test-zero-code-p…
open-junius Feb 5, 2026
def5b9d
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Feb 5, 2026
77b60d4
Merge pull request #2395 from opentensor/fix/benchmark_sudo_set_max_a…
sam0x17 Feb 5, 2026
db99fd4
Rename subnet_buyback to add_stake_burn
shamil-gadelshin Feb 6, 2026
8a92129
auto-update benchmark weights
github-actions[bot] Feb 6, 2026
b8559b0
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Feb 6, 2026
c8b352f
Fix subnet_buyback benchmark
gztensor Feb 6, 2026
a5ec868
Merge pull request #2406 from opentensor/add-stake-and-burn
sam0x17 Feb 11, 2026
46350eb
Add precompile integration tests
ales-otf Feb 11, 2026
88f37e6
Bump spec version
ales-otf Feb 11, 2026
4035d86
auto-update benchmark weights
github-actions[bot] Feb 12, 2026
2ad028c
Merge branch 'devnet-ready' into refactoring/precompile-integration-t…
ales-otf Feb 12, 2026
5bdbd93
Merge branch 'devnet-ready' into feat/balancer_swap
gztensor Feb 12, 2026
c09f6a6
Spec bump
gztensor Feb 12, 2026
e859f2f
Update subtensor pallet weights
gztensor Feb 12, 2026
30cccbb
Merge pull request #2290 from opentensor/feat/balancer_swap
gztensor Feb 12, 2026
0f2ce6e
Resolve git conflicts
ales-otf Feb 13, 2026
f30e039
Bump spec version
ales-otf Feb 13, 2026
3935a18
Merge pull request #2418 from opentensor/refactoring/precompile-integ…
ales-otf Feb 13, 2026
2208d29
Increaase tx fees 10x, increase swap fees to 1%, forward tx fees to b…
gztensor Feb 13, 2026
f6e2f43
Move AuthorshipProvider to subtensor pallet, forward swap fees to blo…
gztensor Feb 13, 2026
bd0d98f
Add block builder fee test
gztensor Feb 16, 2026
e33246a
Fix broken staking tests
gztensor Feb 16, 2026
3300b1f
fmt
gztensor Feb 16, 2026
280a880
Fix tx weights
gztensor Feb 17, 2026
426cbcf
Merge branch 'main' into main-into-devnet-ready-17-02-2026
l0r1s Feb 17, 2026
e9baff0
bump spec version
l0r1s Feb 17, 2026
b942cf0
fix precompile test
l0r1s Feb 17, 2026
0b346d2
Unstake block builders alpha
gztensor Feb 17, 2026
633ca17
Merge pull request #2429 from opentensor/main-into-devnet-ready-17-02…
sam0x17 Feb 17, 2026
b7ce784
Merge branch 'devnet-ready' into feat/tx-fees-swap-fees-go-to-block-b…
gztensor Feb 17, 2026
fc31ca5
Set fee split as 1:4
gztensor Feb 17, 2026
d1bc5cd
Set fee split 100% to block builder
gztensor Feb 18, 2026
d147ebd
Merge pull request #2426 from opentensor/feat/tx-fees-swap-fees-go-to…
sam0x17 Feb 18, 2026
82be06e
fix operationals
l0r1s Feb 18, 2026
56feddc
bump spec version
l0r1s Feb 18, 2026
a987de9
Merge pull request #2443 from opentensor/fix-operationals
sam0x17 Feb 18, 2026
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
254 changes: 243 additions & 11 deletions Cargo.lock

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pallet-subtensor-swap-runtime-api = { path = "pallets/swap/runtime-api", default
pallet-subtensor-swap-rpc = { path = "pallets/swap/rpc", default-features = false }
procedural-fork = { path = "support/procedural-fork", default-features = false }
safe-math = { path = "primitives/safe-math", default-features = false }
safe-bigmath = { package = "safe-bigmath", default-features = false, git = "https://github.com/sam0x17/safe-bigmath" }
share-pool = { path = "primitives/share-pool", default-features = false }
subtensor-macros = { path = "support/macros", default-features = false }
subtensor-custom-rpc = { default-features = false, path = "pallets/subtensor/rpc" }
Expand Down
4 changes: 2 additions & 2 deletions chain-extensions/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ use pallet_subtensor_proxy as pallet_proxy;
use pallet_subtensor_proxy::WeightInfo;
use sp_runtime::{DispatchError, Weight, traits::StaticLookup};
use sp_std::marker::PhantomData;
use substrate_fixed::types::U96F32;
use substrate_fixed::types::U64F64;
use subtensor_runtime_common::{AlphaCurrency, NetUid, ProxyType, TaoCurrency};
use subtensor_swap_interface::SwapHandler;

Expand Down Expand Up @@ -520,7 +520,7 @@ where
netuid.into(),
);

let price = current_alpha_price.saturating_mul(U96F32::from_num(1_000_000_000));
let price = current_alpha_price.saturating_mul(U64F64::from_num(1_000_000_000));
let price: u64 = price.saturating_to_num();

let encoded_result = price.encode();
Expand Down
22 changes: 14 additions & 8 deletions chain-extensions/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ use sp_runtime::{
traits::{BlakeTwo256, Convert, IdentityLookup},
};
use sp_std::{cell::RefCell, cmp::Ordering, sync::OnceLock};
use subtensor_runtime_common::{AlphaCurrency, NetUid, TaoCurrency};
use subtensor_runtime_common::{AlphaCurrency, AuthorshipInfo, NetUid, TaoCurrency};

type Block = frame_system::mocking::MockBlock<Test>;

Expand Down Expand Up @@ -262,6 +262,14 @@ parameter_types! {
pub const AnnouncementDepositFactor: Balance = 1;
}

pub struct MockAuthorshipProvider;

impl AuthorshipInfo<U256> for MockAuthorshipProvider {
fn author() -> Option<U256> {
Some(U256::from(12345u64))
}
}

parameter_types! {
pub const InitialMinAllowedWeights: u16 = 0;
pub const InitialEmissionValue: u16 = 0;
Expand Down Expand Up @@ -325,9 +333,8 @@ parameter_types! {
pub const InitialAlphaLow: u16 = 45875; // Represents 0.7 as per the production default
pub const InitialLiquidAlphaOn: bool = false; // Default value for LiquidAlphaOn
pub const InitialYuma3On: bool = false; // Default value for Yuma3On
// pub const InitialNetworkMaxStake: u64 = u64::MAX; // (DEPRECATED)
pub const InitialColdkeySwapScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // Default as 5 days
pub const InitialColdkeySwapRescheduleDuration: u64 = 24 * 60 * 60 / 12; // Default as 1 day
pub const InitialColdkeySwapAnnouncementDelay: u64 = 50;
pub const InitialColdkeySwapReannouncementDelay: u64 = 10;
pub const InitialDissolveNetworkScheduleDuration: u64 = 5 * 24 * 60 * 60 / 12; // Default as 5 days
pub const InitialTaoWeight: u64 = 0; // 100% global weight.
pub const InitialEmaPriceHalvingPeriod: u64 = 201_600_u64; // 4 weeks
Expand Down Expand Up @@ -397,8 +404,8 @@ impl pallet_subtensor::Config for Test {
type LiquidAlphaOn = InitialLiquidAlphaOn;
type Yuma3On = InitialYuma3On;
type Preimages = Preimage;
type InitialColdkeySwapScheduleDuration = InitialColdkeySwapScheduleDuration;
type InitialColdkeySwapRescheduleDuration = InitialColdkeySwapRescheduleDuration;
type InitialColdkeySwapAnnouncementDelay = InitialColdkeySwapAnnouncementDelay;
type InitialColdkeySwapReannouncementDelay = InitialColdkeySwapReannouncementDelay;
type InitialDissolveNetworkScheduleDuration = InitialDissolveNetworkScheduleDuration;
type InitialTaoWeight = InitialTaoWeight;
type InitialEmaPriceHalvingPeriod = InitialEmaPriceHalvingPeriod;
Expand All @@ -412,13 +419,13 @@ impl pallet_subtensor::Config for Test {
type MaxImmuneUidsPercentage = MaxImmuneUidsPercentage;
type CommitmentsInterface = CommitmentsI;
type EvmKeyAssociateRateLimit = EvmKeyAssociateRateLimit;
type AuthorshipProvider = MockAuthorshipProvider;
}

// Swap-related parameter types
parameter_types! {
pub const SwapProtocolId: PalletId = PalletId(*b"ten/swap");
pub const SwapMaxFeeRate: u16 = 10000; // 15.26%
pub const SwapMaxPositions: u32 = 100;
pub const SwapMinimumLiquidity: u64 = 1_000;
pub const SwapMinimumReserve: NonZeroU64 = NonZeroU64::new(100).unwrap();
}
Expand All @@ -430,7 +437,6 @@ impl pallet_subtensor_swap::Config for Test {
type TaoReserve = TaoCurrencyReserve<Self>;
type AlphaReserve = AlphaCurrencyReserve<Self>;
type MaxFeeRate = SwapMaxFeeRate;
type MaxPositions = SwapMaxPositions;
type MinimumLiquidity = SwapMinimumLiquidity;
type MinimumReserve = SwapMinimumReserve;
type WeightInfo = ();
Expand Down
4 changes: 2 additions & 2 deletions chain-extensions/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use pallet_subtensor::DefaultMinStake;
use sp_core::Get;
use sp_core::U256;
use sp_runtime::DispatchError;
use substrate_fixed::types::U96F32;
use substrate_fixed::types::U64F64;
use subtensor_runtime_common::{AlphaCurrency, Currency as CurrencyTrait, NetUid, TaoCurrency};
use subtensor_swap_interface::SwapHandler;

Expand Down Expand Up @@ -985,7 +985,7 @@ fn get_alpha_price_returns_encoded_price() {
<pallet_subtensor_swap::Pallet<mock::Test> as SwapHandler>::current_alpha_price(
netuid.into(),
);
let expected_price_scaled = expected_price.saturating_mul(U96F32::from_num(1_000_000_000));
let expected_price_scaled = expected_price.saturating_mul(U64F64::from_num(1_000_000_000));
let expected_price_u64: u64 = expected_price_scaled.saturating_to_num();

let mut env = MockEnv::new(FunctionId::GetAlphaPriceV1, caller, netuid.encode());
Expand Down
6 changes: 6 additions & 0 deletions common/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ pub trait BalanceOps<AccountId> {
) -> Result<AlphaCurrency, DispatchError>;
}

/// Allows to query the current block author
pub trait AuthorshipInfo<AccountId> {
/// Return the current block author
fn author() -> Option<AccountId>;
}

pub mod time {
use super::*;

Expand Down
Loading
Loading