File tree Expand file tree Collapse file tree 2 files changed +38
-1
lines changed
Expand file tree Collapse file tree 2 files changed +38
-1
lines changed Original file line number Diff line number Diff line change @@ -2453,7 +2453,10 @@ mod dispatches {
24532453
24542454 // Ensure the delegate claim type is not Delegated.
24552455 ensure ! (
2456- !matches!( new_claim_type, RootClaimTypeEnum :: Delegated ) ,
2456+ matches!(
2457+ new_claim_type,
2458+ RootClaimTypeEnum :: Keep | RootClaimTypeEnum :: Swap
2459+ ) ,
24572460 Error :: <T >:: InvalidRootClaimType
24582461 ) ;
24592462
Original file line number Diff line number Diff line change @@ -1620,6 +1620,40 @@ fn test_claim_root_with_set_validator_claim_type() {
16201620 assert_eq ! ( ev_claim_type, new_claim_type) ;
16211621 assert_eq ! ( ev_netuid, netuid) ;
16221622 }
1623+
1624+ // Check possible options
1625+ assert_ok ! ( SubtensorModule :: set_validator_claim_type(
1626+ RuntimeOrigin :: signed( coldkey) ,
1627+ hotkey,
1628+ netuid,
1629+ RootClaimTypeEnum :: Keep
1630+ ) , ) ;
1631+ assert_ok ! ( SubtensorModule :: set_validator_claim_type(
1632+ RuntimeOrigin :: signed( coldkey) ,
1633+ hotkey,
1634+ netuid,
1635+ RootClaimTypeEnum :: Swap
1636+ ) , ) ;
1637+ assert_err ! (
1638+ SubtensorModule :: set_validator_claim_type(
1639+ RuntimeOrigin :: signed( coldkey) ,
1640+ hotkey,
1641+ netuid,
1642+ RootClaimTypeEnum :: Delegated
1643+ ) ,
1644+ Error :: <Test >:: InvalidRootClaimType
1645+ ) ;
1646+ assert_err ! (
1647+ SubtensorModule :: set_validator_claim_type(
1648+ RuntimeOrigin :: signed( coldkey) ,
1649+ hotkey,
1650+ netuid,
1651+ RootClaimTypeEnum :: KeepSubnets {
1652+ subnets: BTreeSet :: from( [ netuid] )
1653+ }
1654+ ) ,
1655+ Error :: <Test >:: InvalidRootClaimType
1656+ ) ;
16231657 } ) ;
16241658}
16251659
You can’t perform that action at this time.
0 commit comments