Skip to content

Commit defaab1

Browse files
feat(permission0): implement curator re-delegation (#128)
This change finished CHAIN-105 by implementing the same re-delegation system for curator scopes.
1 parent 0982df8 commit defaab1

57 files changed

Lines changed: 469 additions & 508 deletions

Some content is hidden

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

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ resolver = "2"
1313

1414
[workspace.package]
1515
authors = ["Renlabs <contact@renlabs.dev>"]
16-
edition = "2021"
16+
edition = "2024"
1717

1818
[workspace.lints.clippy]
1919
all = "deny"

node/src/chain_spec.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ use polkadot_sdk::{
1919
sc_service::{ChainType, Properties},
2020
*,
2121
};
22-
use serde_json::{json, Value};
22+
use serde_json::{Value, json};
2323
use torus_runtime::WASM_BINARY;
2424

2525
/// This is a specialization of the general Substrate ChainSpec type.
@@ -53,8 +53,8 @@ fn testnet_genesis() -> Value {
5353
sp_keyring::{Ed25519Keyring, Sr25519Keyring},
5454
};
5555
use torus_runtime::{
56-
interface::{Balance, MinimumBalance},
5756
BalancesConfig, SudoConfig,
57+
interface::{Balance, MinimumBalance},
5858
};
5959

6060
let endowment = <MinimumBalance as Get<Balance>>::get().max(1) * 1000;

node/src/cli/eth.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use futures::{future, prelude::*};
1414
use polkadot_sdk::{
1515
sc_client_api::BlockchainEvents,
1616
sc_network_sync::SyncingService,
17-
sc_service::{error::Error as ServiceError, Configuration, TaskManager},
17+
sc_service::{Configuration, TaskManager, error::Error as ServiceError},
1818
};
1919
use torus_runtime::opaque::Block;
2020

node/src/command.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
// See the License for the specific language governing permissions and
1616
// limitations under the License.
1717

18-
use benchmarking::{inherent_benchmark_data, RemarkBuilder, TransferKeepAliveBuilder};
18+
use benchmarking::{RemarkBuilder, TransferKeepAliveBuilder, inherent_benchmark_data};
1919
use frame_benchmarking_cli::{BenchmarkCmd, ExtrinsicFactory, SUBSTRATE_REFERENCE_HARDWARE};
2020
use futures::TryFutureExt;
2121
use polkadot_sdk::{sc_cli::SubstrateCli, sc_service::PartialComponents, *};

node/src/rpc.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,8 @@ use pallet_torus0_rpc::{Torus0ApiServer, Torus0Rpc};
3232
use polkadot_sdk::{
3333
pallet_transaction_payment_rpc::{TransactionPayment, TransactionPaymentApiServer},
3434
sc_consensus_manual_seal::{
35-
rpc::{ManualSeal, ManualSealApiServer},
3635
EngineCommand,
36+
rpc::{ManualSeal, ManualSealApiServer},
3737
},
3838
sc_rpc::SubscriptionTaskExecutor,
3939
sc_transaction_pool::ChainApi,

node/src/rpc/eth.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,9 @@ where
9393
CIDP: CreateInherentDataProviders<Block, ()> + Send + 'static,
9494
{
9595
use fc_rpc::{
96-
pending::AuraConsensusDataProvider, Debug, DebugApiServer, Eth, EthApiServer, EthDevSigner,
97-
EthFilter, EthFilterApiServer, EthPubSub, EthPubSubApiServer, EthSigner, Net, NetApiServer,
98-
TxPool, TxPoolApiServer, Web3, Web3ApiServer,
96+
Debug, DebugApiServer, Eth, EthApiServer, EthDevSigner, EthFilter, EthFilterApiServer,
97+
EthPubSub, EthPubSubApiServer, EthSigner, Net, NetApiServer, TxPool, TxPoolApiServer, Web3,
98+
Web3ApiServer, pending::AuraConsensusDataProvider,
9999
};
100100

101101
let EthDeps {

node/src/service.rs

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ use polkadot_sdk::{
2424
sc_client_api::{Backend, BlockBackend},
2525
sc_executor::WasmExecutor,
2626
sc_network_sync::strategy::warp::WarpSyncProvider,
27-
sc_service::{error::Error as ServiceError, Configuration, TaskManager, WarpSyncConfig},
27+
sc_service::{Configuration, TaskManager, WarpSyncConfig, error::Error as ServiceError},
2828
sc_telemetry::{Telemetry, TelemetryHandle, TelemetryWorker},
2929
sc_transaction_pool_api::OffchainTransactionPoolFactory,
3030
sp_consensus_aura::sr25519::AuthorityPair,
@@ -34,11 +34,11 @@ use polkadot_sdk::{
3434
use torus_runtime::{apis::RuntimeApi, configs::eth::TransactionConverter, opaque::Block};
3535

3636
use crate::cli::{
37+
Consensus,
3738
eth::{
38-
db_config_dir, new_frontier_partial, spawn_frontier_tasks, EthConfiguration,
39-
FrontierPartialComponents,
39+
EthConfiguration, FrontierPartialComponents, db_config_dir, new_frontier_partial,
40+
spawn_frontier_tasks,
4041
},
41-
Consensus,
4242
};
4343

4444
type HostFunctions = sp_io::SubstrateHostFunctions;
@@ -165,9 +165,8 @@ type AuraData = Pin<
165165

166166
fn aura_data_provider(
167167
slot_duration: sp_consensus_aura::SlotDuration,
168-
eth_config: &EthConfiguration,
168+
target_gas_price: u64,
169169
) -> impl Fn(sp_core::H256, ()) -> AuraData {
170-
let target_gas_price = eth_config.target_gas_price;
171170
move |_, ()| {
172171
Box::pin(async move {
173172
let timestamp = sp_timestamp::InherentDataProvider::from_system_time();
@@ -198,7 +197,10 @@ fn build_aura_grandpa_import_queue(
198197
block_import: grandpa_block_import.clone(),
199198
justification_import: Some(Box::new(grandpa_block_import.clone())),
200199
client,
201-
create_inherent_data_providers: aura_data_provider(slot_duration, eth_config),
200+
create_inherent_data_providers: aura_data_provider(
201+
slot_duration,
202+
eth_config.target_gas_price,
203+
),
202204
spawner: &task_manager.spawn_essential_handle(),
203205
registry: config.prometheus_registry(),
204206
check_for_equivocation: Default::default(),
@@ -350,7 +352,10 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
350352
proposer_factory: proposer,
351353
sync_oracle: sync_service.clone(),
352354
justification_sync_link: sync_service.clone(),
353-
create_inherent_data_providers: aura_data_provider(slot_duration, &eth_config),
355+
create_inherent_data_providers: aura_data_provider(
356+
slot_duration,
357+
eth_config.target_gas_price,
358+
),
354359
force_authoring: config.force_authoring,
355360
backoff_authoring_blocks: Option::<()>::None,
356361
keystore: keystore_container.keystore(),
@@ -550,7 +555,7 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
550555
forced_parent_hashes: None,
551556
pending_create_inherent_data_providers: aura_data_provider(
552557
slot_duration,
553-
&eth_config,
558+
eth_config.target_gas_price,
554559
),
555560
};
556561

@@ -578,7 +583,7 @@ pub async fn new_full<Network: sc_network::NetworkBackend<Block, <Block as Block
578583
tx_handler_controller,
579584
sync_service: sync_service.clone(),
580585
config,
581-
telemetry: telemetry.as_mut(),
586+
telemetry: Option::as_mut(&mut telemetry),
582587
})?;
583588

584589
spawn_frontier_tasks(

pallets/emission0/src/distribute.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ use pallet_permission0_api::Permission0EmissionApi;
33
use pallet_torus0_api::Torus0Api;
44
use polkadot_sdk::{
55
frame_support::{
6+
DebugNoBound,
67
dispatch::DispatchResult,
78
storage::with_storage_layer,
89
traits::{Currency, Imbalance},
9-
DebugNoBound,
1010
},
1111
polkadot_sdk_frame::prelude::BlockNumberFor,
1212
sp_core::Get,
1313
sp_runtime::{
14-
traits::Saturating, ArithmeticError, DispatchError, FixedU128, Percent, Perquintill,
14+
ArithmeticError, DispatchError, FixedU128, Percent, Perquintill, traits::Saturating,
1515
},
1616
sp_std::{
1717
borrow::Cow,

pallets/emission0/src/distribute/math.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
#[cfg(not(feature = "std"))]
44
use num_traits::float::FloatCore;
55
use polkadot_sdk::{
6-
sp_runtime::{traits::Saturating, FixedPointNumber, FixedU128},
6+
sp_runtime::{FixedPointNumber, FixedU128, traits::Saturating},
77
sp_std::vec,
88
sp_std::vec::Vec,
99
};

pallets/emission0/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ pub(crate) use ext::*;
77
pub use pallet::*;
88
use pallet_emission0_api::Emission0Api;
99
use polkadot_sdk::{
10-
frame_support::{dispatch::DispatchResult, pallet_prelude::*, DefaultNoBound},
10+
frame_support::{DefaultNoBound, dispatch::DispatchResult, pallet_prelude::*},
1111
frame_system,
1212
frame_system::pallet_prelude::OriginFor,
1313
polkadot_sdk_frame::{self as frame, traits::Currency},

0 commit comments

Comments
 (0)