Skip to content

Commit 6d9adec

Browse files
committed
Resolve conflicts
2 parents 126f780 + fd96f59 commit 6d9adec

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+6965
-3638
lines changed

.github/workflows/benchmark-weights.yml

Whitespace-only changes.

Cargo.lock

Lines changed: 729 additions & 1161 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,6 @@ substrate-prometheus-endpoint = { workspace = true }
9595
fc-storage = { workspace = true }
9696
fc-db = { workspace = true }
9797
fc-consensus = { workspace = true }
98-
fp-dynamic-fee = { workspace = true }
9998
fc-api = { workspace = true }
10099
fc-rpc = { workspace = true }
101100
fc-rpc-core = { workspace = true }

node/src/ethereum.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,6 @@ pub struct EthConfiguration {
5656
#[arg(long)]
5757
pub enable_dev_signer: bool,
5858

59-
/// The dynamic-fee pallet target gas price set by block author
60-
#[arg(long, default_value = "1")]
61-
pub target_gas_price: u64,
62-
6359
/// Maximum allowed gas limit will be `block.gas_limit * execute_gas_limit_multiplier`
6460
/// when using eth_call/eth_estimateGas.
6561
#[arg(long, default_value = "10")]

node/src/service.rs

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ use sp_api::ProvideRuntimeApi;
1919
use sp_block_builder::BlockBuilder as BlockBuilderApi;
2020
use sp_consensus::Error as ConsensusError;
2121
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
22-
use sp_core::U256;
2322
use sp_runtime::traits::{Block as BlockT, Header, NumberFor};
2423
use std::{cell::RefCell, path::Path};
2524
use std::{marker::PhantomData, sync::Arc, time::Duration};
@@ -279,7 +278,7 @@ where
279278
pub fn build_aura_grandpa_import_queue(
280279
client: Arc<FullClient>,
281280
config: &Configuration,
282-
eth_config: &EthConfiguration,
281+
_eth_config: &EthConfiguration,
283282
task_manager: &TaskManager,
284283
telemetry: Option<TelemetryHandle>,
285284
grandpa_block_import: GrandpaBlockImport,
@@ -294,16 +293,14 @@ where
294293
);
295294

296295
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
297-
let target_gas_price = eth_config.target_gas_price;
298296
let create_inherent_data_providers = move |_, ()| async move {
299297
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
300298
let slot =
301299
sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
302300
*timestamp,
303301
slot_duration,
304302
);
305-
let dynamic_fee = fp_dynamic_fee::InherentDataProvider(U256::from(target_gas_price));
306-
Ok((slot, timestamp, dynamic_fee))
303+
Ok((slot, timestamp))
307304
};
308305

309306
let import_queue = sc_consensus_aura::import_queue::<AuraPair, _, _, _, _, _>(
@@ -521,7 +518,6 @@ where
521518
));
522519

523520
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
524-
let target_gas_price = eth_config.target_gas_price;
525521
let pending_create_inherent_data_providers = move |_, ()| async move {
526522
let current = sp_timestamp::InherentDataProvider::from_system_time();
527523
let next_slot = current
@@ -533,8 +529,7 @@ where
533529
*timestamp,
534530
slot_duration,
535531
);
536-
let dynamic_fee = fp_dynamic_fee::InherentDataProvider(U256::from(target_gas_price));
537-
Ok((slot, timestamp, dynamic_fee))
532+
Ok((slot, timestamp))
538533
};
539534

540535
Box::new(move |subscription_task_executor| {
@@ -613,7 +608,6 @@ where
613608
// manual-seal authorship
614609
if let Some(sealing) = sealing {
615610
run_manual_seal_authorship(
616-
&eth_config,
617611
sealing,
618612
client,
619613
transaction_pool,
@@ -639,15 +633,13 @@ where
639633
);
640634

641635
let slot_duration = sc_consensus_aura::slot_duration(&*client)?;
642-
let target_gas_price = eth_config.target_gas_price;
643636
let create_inherent_data_providers = move |_, ()| async move {
644637
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
645638
let slot = sp_consensus_aura::inherents::InherentDataProvider::from_timestamp_and_slot_duration(
646639
*timestamp,
647640
slot_duration,
648641
);
649-
let dynamic_fee = fp_dynamic_fee::InherentDataProvider(U256::from(target_gas_price));
650-
Ok((slot, timestamp, dynamic_fee))
642+
Ok((slot, timestamp))
651643
};
652644

653645
let aura = sc_consensus_aura::start_aura::<AuraPair, _, _, _, _, _, _, _, _, _, _>(
@@ -770,7 +762,6 @@ pub fn new_chain_ops(
770762

771763
#[allow(clippy::too_many_arguments)]
772764
fn run_manual_seal_authorship(
773-
eth_config: &EthConfiguration,
774765
sealing: Sealing,
775766
client: Arc<FullClient>,
776767
transaction_pool: Arc<FullPool<Block, FullClient>>,
@@ -820,12 +811,8 @@ fn run_manual_seal_authorship(
820811
}
821812
}
822813

823-
let target_gas_price = eth_config.target_gas_price;
824-
let create_inherent_data_providers = move |_, ()| async move {
825-
let timestamp = MockTimestampInherentDataProvider;
826-
let dynamic_fee = fp_dynamic_fee::InherentDataProvider(U256::from(target_gas_price));
827-
Ok((timestamp, dynamic_fee))
828-
};
814+
let create_inherent_data_providers =
815+
move |_, ()| async move { Ok(MockTimestampInherentDataProvider) };
829816

830817
let manual_seal = match sealing {
831818
Sealing::Manual => future::Either::Left(sc_consensus_manual_seal::run_manual_seal(

pallets/admin-utils/src/lib.rs

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1287,6 +1287,26 @@ pub mod pallet {
12871287
ensure_root(origin)?;
12881288
T::Grandpa::schedule_change(next_authorities, in_blocks, forced)
12891289
}
1290+
1291+
/// Enables or disables Liquid Alpha for a given subnet.
1292+
///
1293+
/// # Parameters
1294+
/// - `origin`: The origin of the call, which must be the root account or subnet owner.
1295+
/// - `netuid`: The unique identifier for the subnet.
1296+
/// - `enabled`: A boolean flag to enable or disable Liquid Alpha.
1297+
///
1298+
/// # Weight
1299+
/// This function has a fixed weight of 0 and is classified as an operational transaction that does not incur any fees.
1300+
#[pallet::call_index(61)]
1301+
#[pallet::weight((0, DispatchClass::Operational, Pays::No))]
1302+
pub fn sudo_set_toggle_transfer(
1303+
origin: OriginFor<T>,
1304+
netuid: u16,
1305+
toggle: bool,
1306+
) -> DispatchResult {
1307+
pallet_subtensor::Pallet::<T>::ensure_subnet_owner_or_root(origin, netuid)?;
1308+
pallet_subtensor::Pallet::<T>::toggle_transfer(netuid, toggle)
1309+
}
12901310
}
12911311
}
12921312

pallets/admin-utils/src/tests/mock.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ parameter_types! {
100100
pub const InitialTxDelegateTakeRateLimit: u64 = 0; // Disable rate limit for testing
101101
pub const InitialTxChildKeyTakeRateLimit: u64 = 0; // Disable rate limit for testing
102102
pub const InitialBurn: u64 = 0;
103-
pub const InitialMinBurn: u64 = 0;
103+
pub const InitialMinBurn: u64 = 500_000;
104104
pub const InitialMaxBurn: u64 = 1_000_000_000;
105105
pub const InitialValidatorPruneLen: u64 = 0;
106106
pub const InitialScalingLawPower: u16 = 50;

pallets/collective/src/benchmarking.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ benchmarks_instance_pallet! {
315315
// Whitelist voter account from further DB operations.
316316
let voter_key = frame_system::Account::<T>::hashed_key_for(&voter);
317317
frame_benchmarking::benchmarking::add_to_whitelist(voter_key.into());
318-
}: close(SystemOrigin::Signed(voter), last_hash, index, Weight::MAX, bytes_in_storage)
318+
}: close(SystemOrigin::Root, last_hash, index, Weight::MAX, bytes_in_storage)
319319
verify {
320320
// The last proposal is removed.
321321
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
@@ -393,7 +393,7 @@ benchmarks_instance_pallet! {
393393
index, approve,
394394
)?;
395395

396-
}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::MAX, bytes_in_storage)
396+
}: close(SystemOrigin::Root, last_hash, index, Weight::MAX, bytes_in_storage)
397397
verify {
398398
// The last proposal is removed.
399399
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
@@ -473,7 +473,7 @@ benchmarks_instance_pallet! {
473473
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
474474

475475
// Prime nay will close it as disapproved
476-
}: close(SystemOrigin::Signed(caller), last_hash, index, Weight::MAX, bytes_in_storage)
476+
}: close(SystemOrigin::Root, last_hash, index, Weight::MAX, bytes_in_storage)
477477
verify {
478478
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
479479
assert_last_event::<T, I>(Event::Disapproved { proposal_hash: last_hash }.into());
@@ -542,7 +542,7 @@ benchmarks_instance_pallet! {
542542
assert_eq!(Collective::<T, I>::proposals().len(), p as usize);
543543

544544
// Prime aye will close it as approved
545-
}: close(SystemOrigin::Signed(caller), last_hash, p - 1, Weight::MAX, bytes_in_storage)
545+
}: close(SystemOrigin::Root, last_hash, p - 1, Weight::MAX, bytes_in_storage)
546546
verify {
547547
assert_eq!(Collective::<T, I>::proposals().len(), (p - 1) as usize);
548548
assert_last_event::<T, I>(Event::Executed { proposal_hash: last_hash, result: Ok(()) }.into());

pallets/collective/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ pub mod pallet {
666666
proposal_weight_bound: Weight,
667667
#[pallet::compact] length_bound: u32,
668668
) -> DispatchResultWithPostInfo {
669-
let _ = ensure_signed(origin)?;
669+
ensure_root(origin)?;
670670

671671
Self::do_close(proposal_hash, index, proposal_weight_bound, length_bound)
672672
}

pallets/collective/src/tests.rs

Lines changed: 20 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ fn close_works() {
299299
System::set_block_number(3);
300300
assert_noop!(
301301
Collective::close(
302-
RuntimeOrigin::signed(4),
302+
RuntimeOrigin::root(),
303303
hash,
304304
0,
305305
proposal_weight,
@@ -310,7 +310,7 @@ fn close_works() {
310310

311311
System::set_block_number(4);
312312
assert_ok!(Collective::close(
313-
RuntimeOrigin::signed(4),
313+
RuntimeOrigin::root(),
314314
hash,
315315
0,
316316
proposal_weight,
@@ -370,7 +370,7 @@ fn proposal_weight_limit_works_on_approve() {
370370
System::set_block_number(4);
371371
assert_noop!(
372372
Collective::close(
373-
RuntimeOrigin::signed(4),
373+
RuntimeOrigin::root(),
374374
hash,
375375
0,
376376
proposal_weight - Weight::from_parts(100, 0),
@@ -379,7 +379,7 @@ fn proposal_weight_limit_works_on_approve() {
379379
Error::<Test, Instance1>::ProposalWeightLessThanDispatchCallWeight
380380
);
381381
assert_ok!(Collective::close(
382-
RuntimeOrigin::signed(4),
382+
RuntimeOrigin::root(),
383383
hash,
384384
0,
385385
proposal_weight,
@@ -409,7 +409,7 @@ fn proposal_weight_limit_ignored_on_disapprove() {
409409
// No votes, this proposal wont pass
410410
System::set_block_number(4);
411411
assert_ok!(Collective::close(
412-
RuntimeOrigin::signed(4),
412+
RuntimeOrigin::root(),
413413
hash,
414414
0,
415415
proposal_weight - Weight::from_parts(100, 0),
@@ -442,7 +442,7 @@ fn close_with_prime_works() {
442442

443443
System::set_block_number(4);
444444
assert_ok!(Collective::close(
445-
RuntimeOrigin::signed(4),
445+
RuntimeOrigin::root(),
446446
hash,
447447
0,
448448
proposal_weight,
@@ -502,7 +502,7 @@ fn close_with_voting_prime_works() {
502502

503503
System::set_block_number(4);
504504
assert_ok!(Collective::close(
505-
RuntimeOrigin::signed(4),
505+
RuntimeOrigin::root(),
506506
hash,
507507
0,
508508
proposal_weight,
@@ -583,7 +583,7 @@ fn close_with_no_prime_but_majority_works() {
583583

584584
System::set_block_number(4);
585585
assert_ok!(CollectiveMajority::close(
586-
RuntimeOrigin::signed(4),
586+
RuntimeOrigin::root(),
587587
hash,
588588
0,
589589
proposal_weight,
@@ -1109,7 +1109,7 @@ fn motions_all_first_vote_free_works() {
11091109

11101110
let proposal_weight = proposal.get_dispatch_info().weight;
11111111
let close_rval: DispatchResultWithPostInfo = Collective::close(
1112-
RuntimeOrigin::signed(2),
1112+
RuntimeOrigin::root(),
11131113
hash,
11141114
0,
11151115
proposal_weight,
@@ -1120,7 +1120,7 @@ fn motions_all_first_vote_free_works() {
11201120
// Trying to close the proposal, which is already closed
11211121
// Error: "ProposalNotExists" with Pays::Yes.
11221122
let close_rval: DispatchResultWithPostInfo = Collective::close(
1123-
RuntimeOrigin::signed(2),
1123+
RuntimeOrigin::root(),
11241124
hash,
11251125
0,
11261126
proposal_weight,
@@ -1148,7 +1148,7 @@ fn motions_reproposing_disapproved_works() {
11481148
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 0, false));
11491149

11501150
assert_ok!(Collective::close(
1151-
RuntimeOrigin::signed(2),
1151+
RuntimeOrigin::root(),
11521152
hash,
11531153
0,
11541154
proposal_weight,
@@ -1186,7 +1186,7 @@ fn motions_approval_with_enough_votes_and_lower_voting_threshold_works() {
11861186
assert_ok!(Collective::vote(RuntimeOrigin::signed(1), hash, 0, true));
11871187
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 0, true));
11881188
assert_ok!(Collective::close(
1189-
RuntimeOrigin::signed(2),
1189+
RuntimeOrigin::root(),
11901190
hash,
11911191
0,
11921192
proposal_weight,
@@ -1243,7 +1243,7 @@ fn motions_approval_with_enough_votes_and_lower_voting_threshold_works() {
12431243
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 1, true));
12441244
assert_ok!(Collective::vote(RuntimeOrigin::signed(3), hash, 1, true));
12451245
assert_ok!(Collective::close(
1246-
RuntimeOrigin::signed(2),
1246+
RuntimeOrigin::root(),
12471247
hash,
12481248
1,
12491249
proposal_weight,
@@ -1315,7 +1315,7 @@ fn motions_disapproval_works() {
13151315
assert_ok!(Collective::vote(RuntimeOrigin::signed(1), hash, 0, false));
13161316
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 0, false));
13171317
assert_ok!(Collective::close(
1318-
RuntimeOrigin::signed(2),
1318+
RuntimeOrigin::root(),
13191319
hash,
13201320
0,
13211321
proposal_weight,
@@ -1374,7 +1374,7 @@ fn motions_approval_works() {
13741374
assert_ok!(Collective::vote(RuntimeOrigin::signed(1), hash, 0, true));
13751375
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 0, true));
13761376
assert_ok!(Collective::close(
1377-
RuntimeOrigin::signed(2),
1377+
RuntimeOrigin::root(),
13781378
hash,
13791379
0,
13801380
proposal_weight,
@@ -1448,7 +1448,7 @@ fn motion_with_no_votes_closes_with_disapproval() {
14481448
// an approving or disapproving simple majority due to the lack of votes.
14491449
assert_noop!(
14501450
Collective::close(
1451-
RuntimeOrigin::signed(2),
1451+
RuntimeOrigin::root(),
14521452
hash,
14531453
0,
14541454
proposal_weight,
@@ -1462,7 +1462,7 @@ fn motion_with_no_votes_closes_with_disapproval() {
14621462
System::set_block_number(closing_block);
14631463
// we can successfully close the motion.
14641464
assert_ok!(Collective::close(
1465-
RuntimeOrigin::signed(2),
1465+
RuntimeOrigin::root(),
14661466
hash,
14671467
0,
14681468
proposal_weight,
@@ -1507,25 +1507,19 @@ fn close_disapprove_does_not_care_about_weight_or_len() {
15071507
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 0, true));
15081508
// It will not close with bad weight/len information
15091509
assert_noop!(
1510-
Collective::close(RuntimeOrigin::signed(2), hash, 0, Weight::zero(), 0),
1510+
Collective::close(RuntimeOrigin::root(), hash, 0, Weight::zero(), 0),
15111511
Error::<Test, Instance1>::ProposalLengthBoundLessThanProposalLength,
15121512
);
15131513
assert_noop!(
1514-
Collective::close(
1515-
RuntimeOrigin::signed(2),
1516-
hash,
1517-
0,
1518-
Weight::zero(),
1519-
proposal_len
1520-
),
1514+
Collective::close(RuntimeOrigin::root(), hash, 0, Weight::zero(), proposal_len),
15211515
Error::<Test, Instance1>::ProposalWeightLessThanDispatchCallWeight,
15221516
);
15231517
// Now we make the proposal fail
15241518
assert_ok!(Collective::vote(RuntimeOrigin::signed(1), hash, 0, false));
15251519
assert_ok!(Collective::vote(RuntimeOrigin::signed(2), hash, 0, false));
15261520
// It can close even if the weight/len information is bad
15271521
assert_ok!(Collective::close(
1528-
RuntimeOrigin::signed(2),
1522+
RuntimeOrigin::root(),
15291523
hash,
15301524
0,
15311525
Weight::zero(),

0 commit comments

Comments
 (0)