18
18
19
19
use crate :: setup:: * ;
20
20
21
- use frame_support:: { dispatch:: GetDispatchInfo , traits:: StorePreimage } ;
21
+ use frame_support:: {
22
+ dispatch:: GetDispatchInfo ,
23
+ traits:: { Currency , StorePreimage } ,
24
+ } ;
22
25
use parity_scale_codec:: Encode ;
23
26
use sp_runtime:: traits:: { BlakeTwo256 , Hash } ;
24
27
@@ -31,7 +34,7 @@ fn external_proposals_work() {
31
34
let remark_call_bounded = Preimage :: bound ( remark_call) . unwrap ( ) ;
32
35
33
36
let external_propose_call =
34
- RuntimeCall :: Democracy ( pallet_democracy:: Call :: external_propose {
37
+ RuntimeCall :: Democracy ( pallet_democracy:: Call :: external_propose_majority {
35
38
proposal : remark_call_bounded. clone ( ) ,
36
39
} ) ;
37
40
let external_propose_call_hash = BlakeTwo256 :: hash_of ( & external_propose_call) ;
@@ -79,26 +82,26 @@ fn external_proposals_work() {
79
82
let fast_track_call_hash = BlakeTwo256 :: hash_of ( & fast_track_call) ;
80
83
81
84
// Tech committee should be able to fast-track external proposals
82
- assert_ok ! ( Council :: propose(
85
+ assert_ok ! ( TechnicalCommittee :: propose(
83
86
RuntimeOrigin :: signed( ALICE . clone( ) ) ,
84
87
2 ,
85
88
Box :: new( fast_track_call. clone( ) ) ,
86
89
fast_track_call. encode( ) . len( ) as u32
87
90
) ) ;
88
91
89
- for signer in & [ BOB , CAT ] {
90
- assert_ok ! ( Council :: vote(
92
+ for signer in & [ ALICE , BOB , CAT ] {
93
+ assert_ok ! ( TechnicalCommittee :: vote(
91
94
RuntimeOrigin :: signed( signer. clone( ) ) ,
92
95
fast_track_call_hash,
93
- 1 ,
96
+ 0 ,
94
97
true
95
98
) ) ;
96
99
}
97
100
98
- assert_ok ! ( Council :: close(
101
+ assert_ok ! ( TechnicalCommittee :: close(
99
102
RuntimeOrigin :: signed( ALICE . clone( ) ) ,
100
103
fast_track_call_hash,
101
- 1 ,
104
+ 0 ,
102
105
fast_track_call. get_dispatch_info( ) . weight,
103
106
fast_track_call. encode( ) . len( ) as u32 ,
104
107
) ) ;
@@ -113,3 +116,54 @@ fn external_proposals_work() {
113
116
) ;
114
117
} )
115
118
}
119
+
120
+ #[ test]
121
+ fn community_council_can_execute_dapp_staking_calls ( ) {
122
+ new_test_ext ( ) . execute_with ( || {
123
+ // Fund the proxy account
124
+ let proxy_account = <Runtime as pallet_collective_proxy:: Config >:: ProxyAccountId :: get ( ) ;
125
+ let lock_amount = 10_000_000_000_000_000_000_000 ;
126
+ Balances :: make_free_balance_be ( & proxy_account, lock_amount) ;
127
+
128
+ // Prepare the wrapped dApp staking lock call
129
+ let lock_call = RuntimeCall :: DappStaking ( pallet_dapp_staking_v3:: Call :: lock {
130
+ amount : lock_amount,
131
+ } ) ;
132
+ let collective_proxy_call =
133
+ RuntimeCall :: CollectiveProxy ( pallet_collective_proxy:: Call :: execute_call {
134
+ call : Box :: new ( lock_call) ,
135
+ } ) ;
136
+ let collective_proxy_call_hash = BlakeTwo256 :: hash_of ( & collective_proxy_call) ;
137
+
138
+ // Community council should be able to execute dApp staking calls
139
+ assert_ok ! ( CommunityCouncil :: propose(
140
+ RuntimeOrigin :: signed( ALICE . clone( ) ) ,
141
+ 2 ,
142
+ Box :: new( collective_proxy_call. clone( ) ) ,
143
+ collective_proxy_call. encode( ) . len( ) as u32
144
+ ) ) ;
145
+
146
+ for signer in & [ BOB , CAT ] {
147
+ assert_ok ! ( CommunityCouncil :: vote(
148
+ RuntimeOrigin :: signed( signer. clone( ) ) ,
149
+ collective_proxy_call_hash,
150
+ 0 ,
151
+ true
152
+ ) ) ;
153
+ }
154
+
155
+ assert_ok ! ( CommunityCouncil :: close(
156
+ RuntimeOrigin :: signed( ALICE . clone( ) ) ,
157
+ collective_proxy_call_hash,
158
+ 0 ,
159
+ collective_proxy_call. get_dispatch_info( ) . weight,
160
+ collective_proxy_call. encode( ) . len( ) as u32 ,
161
+ ) ) ;
162
+
163
+ // Check that the lock was successful
164
+ assert_eq ! (
165
+ pallet_dapp_staking_v3:: Ledger :: <Runtime >:: get( & proxy_account) . locked,
166
+ lock_amount
167
+ ) ;
168
+ } )
169
+ }
0 commit comments