Skip to content

Commit

Permalink
Update dependecies (paritytech#2277) (paritytech#2281)
Browse files Browse the repository at this point in the history
* cargo update -p parachain-info

* flush

* it compiles

* clippy

* temporary add more logging to cargo deny

* Revert "temporary add more logging to cargo deny"

This reverts commit 20daa88bca6d9a01dbe933579b1d57ae5c3a7bd8.

* list installed Rust binaries before running cargo deny

* changed prev commit

* once again

* try cargo update?

* post-update fixes (nothing important)
  • Loading branch information
svyatonik authored and serban300 committed Apr 9, 2024
1 parent 1fb2f4e commit 70d5fdc
Show file tree
Hide file tree
Showing 69 changed files with 409 additions and 486 deletions.
5 changes: 4 additions & 1 deletion bridges/bin/millau/node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ repository = "https://github.com/paritytech/parity-bridges-common/"
license = "GPL-3.0-or-later WITH Classpath-exception-2.0"

[dependencies]
clap = { version = "4.2.7", features = ["derive"] }
clap = { version = "4.3.12", features = ["derive"] }
futures = "0.3.28"
jsonrpsee = { version = "0.16.2", features = ["server"] }
serde_json = "1.0.96"

Expand Down Expand Up @@ -37,10 +38,12 @@ sc-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch
sc-consensus-grandpa-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-keystore = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-network = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-offchain = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-rpc = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-service = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-telemetry = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool = { git = "https://github.com/paritytech/substrate", branch = "master" }
sc-transaction-pool-api = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "master" }
sp-consensus-grandpa = { git = "https://github.com/paritytech/substrate", branch = "master" }
Expand Down
14 changes: 8 additions & 6 deletions bridges/bin/millau/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@

use millau_runtime::{
AccountId, AuraConfig, BalancesConfig, BeefyConfig, BridgeRialtoMessagesConfig,
BridgeRialtoParachainMessagesConfig, BridgeWestendGrandpaConfig, GenesisConfig, GrandpaConfig,
SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig, WASM_BINARY,
BridgeRialtoParachainMessagesConfig, BridgeWestendGrandpaConfig, GrandpaConfig,
RuntimeGenesisConfig, SessionConfig, SessionKeys, Signature, SudoConfig, SystemConfig,
WASM_BINARY,
};
use sp_consensus_aura::sr25519::AuthorityId as AuraId;
use sp_consensus_beefy::crypto::AuthorityId as BeefyId;
Expand All @@ -41,7 +42,7 @@ const RIALTO_MESSAGES_PALLET_OWNER: &str = "Rialto.MessagesOwner";
const RIALTO_PARACHAIN_MESSAGES_PALLET_OWNER: &str = "RialtoParachain.MessagesOwner";

/// Specialized `ChainSpec`. This is a specialization of the general Substrate ChainSpec type.
pub type ChainSpec = sc_service::GenericChainSpec<GenesisConfig>;
pub type ChainSpec = sc_service::GenericChainSpec<RuntimeGenesisConfig>;

/// The chain specification option. This is expected to come in from the CLI and
/// is little more than one of a number of alternatives which can easily be converted
Expand Down Expand Up @@ -193,17 +194,18 @@ fn testnet_genesis(
root_key: AccountId,
endowed_accounts: Vec<AccountId>,
_enable_println: bool,
) -> GenesisConfig {
GenesisConfig {
) -> RuntimeGenesisConfig {
RuntimeGenesisConfig {
system: SystemConfig {
code: WASM_BINARY.expect("Millau development WASM not available").to_vec(),
..Default::default()
},
balances: BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 50)).collect(),
},
aura: AuraConfig { authorities: Vec::new() },
beefy: BeefyConfig::default(),
grandpa: GrandpaConfig { authorities: Vec::new() },
grandpa: GrandpaConfig { authorities: Vec::new(), ..Default::default() },
sudo: SudoConfig { key: Some(root_key) },
session: SessionConfig {
keys: initial_authorities
Expand Down
9 changes: 2 additions & 7 deletions bridges/bin/millau/node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ use crate::{
};
use frame_benchmarking_cli::BenchmarkCmd;
use millau_runtime::{Block, RuntimeApi};
use sc_cli::{ChainSpec, RuntimeVersion, SubstrateCli};
use sc_cli::SubstrateCli;
use sc_service::PartialComponents;

impl SubstrateCli for Cli {
Expand Down Expand Up @@ -53,10 +53,6 @@ impl SubstrateCli for Cli {
"millau-bridge-node".into()
}

fn native_runtime_version(_: &Box<dyn ChainSpec>) -> &'static RuntimeVersion {
&millau_runtime::VERSION
}

fn load_spec(&self, id: &str) -> Result<Box<dyn sc_service::ChainSpec>, String> {
Ok(Box::new(
match id {
Expand All @@ -83,8 +79,7 @@ pub fn run() -> sc_cli::Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) =>
if cfg!(feature = "runtime-benchmarks") {
runner
.sync_run(|config| cmd.run::<Block, service::ExecutorDispatch>(config))
runner.sync_run(|config| cmd.run::<Block, ()>(config))
} else {
println!(
"Benchmarking wasn't enabled when building the node. \
Expand Down
48 changes: 37 additions & 11 deletions bridges/bin/millau/node/src/service.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@

use jsonrpsee::RpcModule;
use millau_runtime::{self, opaque::Block, RuntimeApi};
use sc_client_api::BlockBackend;
use sc_client_api::{Backend, BlockBackend};
use sc_consensus_aura::{CompatibilityMode, ImportQueueParams, SlotProportion, StartAuraParams};
use sc_consensus_grandpa::SharedVoterState;
pub use sc_executor::NativeElseWasmExecutor;
use sc_executor::{HeapAllocStrategy, WasmExecutor, DEFAULT_HEAP_ALLOC_STRATEGY};
use sc_service::{error::Error as ServiceError, Configuration, TaskManager};
use sc_telemetry::{Telemetry, TelemetryWorker};
use sc_transaction_pool_api::OffchainTransactionPoolFactory;
use sp_consensus_aura::sr25519::AuthorityPair as AuraPair;
use std::{sync::Arc, time::Duration};

Expand Down Expand Up @@ -127,6 +128,7 @@ pub fn new_partial(

let (grandpa_block_import, grandpa_link) = sc_consensus_grandpa::block_import(
client.clone(),
512,
&client,
select_chain.clone(),
telemetry.as_ref().map(|x| x.handle()),
Expand Down Expand Up @@ -223,6 +225,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
);
net_config.add_request_response_protocol(beefy_req_resp_cfg);

let role = config.role.clone();
let warp_sync = Arc::new(sc_consensus_grandpa::warp_proof::NetworkProvider::new(
backend.clone(),
grandpa_link.shared_authority_set().clone(),
Expand All @@ -242,15 +245,28 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
})?;

if config.offchain_worker.enabled {
sc_service::build_offchain_workers(
&config,
task_manager.spawn_handle(),
client.clone(),
network.clone(),
use futures::FutureExt;

task_manager.spawn_handle().spawn(
"offchain-workers-runner",
"offchain-work",
sc_offchain::OffchainWorkers::new(sc_offchain::OffchainWorkerOptions {
runtime_api_provider: client.clone(),
keystore: Some(keystore_container.keystore()),
offchain_db: backend.offchain_storage(),
transaction_pool: Some(OffchainTransactionPoolFactory::new(
transaction_pool.clone(),
)),
network_provider: network.clone(),
is_validator: role.is_authority(),
enable_http_requests: false,
custom_extensions: move |_| vec![],
})
.run(client.clone(), task_manager.spawn_handle())
.boxed(),
);
}

let role = config.role.clone();
let force_authoring = config.force_authoring;
let backoff_authoring_blocks: Option<()> = None;
let name = config.network.node_name.clone();
Expand All @@ -277,7 +293,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
let shared_voter_state = shared_voter_state.clone();

let finality_proof_provider = GrandpaFinalityProofProvider::new_for_service(
backend,
backend.clone(),
Some(shared_authority_set.clone()),
);

Expand Down Expand Up @@ -308,7 +324,16 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
.into_rpc(),
)
.map_err(map_err)?;
io.merge(Mmr::new(client.clone()).into_rpc()).map_err(map_err)?;
io.merge(
Mmr::new(
client.clone(),
backend
.offchain_storage()
.ok_or("Backend doesn't provide the required offchain storage")?,
)
.into_rpc(),
)
.map_err(map_err)?;
Ok(io)
})
};
Expand All @@ -332,7 +357,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
let proposer_factory = sc_basic_authorship::ProposerFactory::new(
task_manager.spawn_handle(),
client.clone(),
transaction_pool,
transaction_pool.clone(),
prometheus_registry.as_ref(),
telemetry.as_ref().map(|x| x.handle()),
);
Expand Down Expand Up @@ -411,7 +436,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
let grandpa_config = sc_consensus_grandpa::Config {
// FIXME #1578 make this available through chainspec
gossip_duration: Duration::from_millis(333),
justification_period: 512,
justification_generation_period: 512,
name: Some(name),
observer_enabled: false,
keystore,
Expand All @@ -436,6 +461,7 @@ pub fn new_full(config: Configuration) -> Result<TaskManager, ServiceError> {
prometheus_registry,
shared_voter_state,
telemetry: telemetry.as_ref().map(|x| x.handle()),
offchain_tx_pool_factory: OffchainTransactionPoolFactory::new(transaction_pool),
};

// the GRANDPA voter task is considered infallible, i.e.
Expand Down
32 changes: 15 additions & 17 deletions bridges/bin/millau/runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,8 @@ pub use frame_support::{
dispatch::DispatchClass,
parameter_types,
traits::{
ConstU32, ConstU64, ConstU8, Currency, ExistenceRequirement, Imbalance, KeyOwnerProofSystem,
ConstBool, ConstU32, ConstU64, ConstU8, Currency, ExistenceRequirement, Imbalance,
KeyOwnerProofSystem,
},
weights::{
constants::WEIGHT_REF_TIME_PER_SECOND, ConstantMultiplier, IdentityFee, RuntimeDbWeight,
Expand Down Expand Up @@ -111,8 +112,8 @@ pub type AccountIndex = u32;
/// Balance of an account.
pub type Balance = bp_millau::Balance;

/// Index of a transaction in the chain.
pub type Index = bp_millau::Index;
/// Nonce of a transaction in the chain.
pub type Nonce = bp_millau::Nonce;

/// A hash of some data used by the chain.
pub type Hash = bp_millau::Hash;
Expand Down Expand Up @@ -184,15 +185,13 @@ impl frame_system::Config for Runtime {
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = IdentityLookup<AccountId>;
/// The index type for storing how many extrinsics an account has signed.
type Index = Index;
/// The index type for blocks.
type BlockNumber = BlockNumber;
type Nonce = Nonce;
/// The type for hashing blocks and tries.
type Hash = Hash;
/// The hashing algorithm used.
type Hashing = Hashing;
/// The header type.
type Header = generic::Header<BlockNumber, Hashing>;
type Block = Block;
/// The ubiquitous event type.
type RuntimeEvent = RuntimeEvent;
/// The ubiquitous origin type.
Expand Down Expand Up @@ -229,6 +228,7 @@ impl pallet_aura::Config for Runtime {
type AuthorityId = AuraId;
type MaxAuthorities = ConstU32<10>;
type DisabledValidators = ();
type AllowMultipleBlocksPerSlot = ConstBool<false>;
}

impl pallet_beefy::Config for Runtime {
Expand All @@ -239,6 +239,7 @@ impl pallet_beefy::Config for Runtime {
type WeightInfo = ();
type KeyOwnerProof = sp_core::Void;
type EquivocationReportSystem = ();
type MaxNominators = ConstU32<256>;
}

impl pallet_grandpa::Config for Runtime {
Expand All @@ -249,6 +250,7 @@ impl pallet_grandpa::Config for Runtime {
type MaxSetIdSessionEntries = ConstU64<0>;
type KeyOwnerProof = sp_core::Void;
type EquivocationReportSystem = ();
type MaxNominators = ConstU32<256>;
}

/// MMR helper types.
Expand Down Expand Up @@ -542,12 +544,8 @@ impl pallet_utility::Config for Runtime {
}

construct_runtime!(
pub enum Runtime where
Block = Block,
NodeBlock = opaque::Block,
UncheckedExtrinsic = UncheckedExtrinsic
{
System: frame_system::{Pallet, Call, Config, Storage, Event<T>},
pub enum Runtime {
System: frame_system::{Pallet, Call, Config<T>, Storage, Event<T>},
Sudo: pallet_sudo::{Pallet, Call, Config<T>, Storage, Event<T>},
Utility: pallet_utility,

Expand All @@ -560,7 +558,7 @@ construct_runtime!(

// Consensus support.
Session: pallet_session::{Pallet, Call, Storage, Event, Config<T>},
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config, Event},
Grandpa: pallet_grandpa::{Pallet, Call, Storage, Config<T>, Event},
ShiftSessionManager: pallet_shift_session_manager::{Pallet},

// BEEFY Bridges support.
Expand All @@ -582,7 +580,7 @@ construct_runtime!(
BridgeRialtoParachainMessages: pallet_bridge_messages::<Instance1>::{Pallet, Call, Storage, Event<T>, Config<T>},

// Pallet for sending XCM.
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config} = 99,
XcmPallet: pallet_xcm::{Pallet, Call, Storage, Event<T>, Origin, Config<T>} = 99,
}
);

Expand Down Expand Up @@ -708,8 +706,8 @@ impl_runtime_apis! {
}
}

impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Index> for Runtime {
fn account_nonce(account: AccountId) -> Index {
impl frame_system_rpc_runtime_api::AccountNonceApi<Block, AccountId, Nonce> for Runtime {
fn account_nonce(account: AccountId) -> Nonce {
System::account_nonce(account)
}
}
Expand Down
5 changes: 4 additions & 1 deletion bridges/bin/millau/runtime/src/xcm_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ pub type Barrier = (
pub type OnMillauBlobDispatcher = xcm_builder::BridgeBlobDispatcher<
crate::xcm_config::XcmRouter,
crate::xcm_config::UniversalLocation,
(),
>;

/// XCM weigher type.
Expand Down Expand Up @@ -141,6 +142,7 @@ impl xcm_executor::Config for XcmConfig {
type UniversalAliases = Nothing;
type CallDispatcher = RuntimeCall;
type SafeCallFilter = Everything;
type Aliasers = Nothing;
}

/// Type to convert an `Origin` type value into a `MultiLocation` value which represents an interior
Expand Down Expand Up @@ -247,11 +249,12 @@ mod tests {
use bridge_runtime_common::messages_xcm_extension::XcmBlobMessageDispatchResult;
use codec::Encode;
use pallet_bridge_messages::OutboundLanes;
use sp_runtime::BuildStorage;
use xcm_executor::XcmExecutor;

fn new_test_ext() -> sp_io::TestExternalities {
sp_io::TestExternalities::new(
frame_system::GenesisConfig::default().build_storage::<Runtime>().unwrap(),
frame_system::GenesisConfig::<Runtime>::default().build_storage().unwrap(),
)
}

Expand Down
12 changes: 8 additions & 4 deletions bridges/bin/rialto-parachain/node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const MILLAU_MESSAGES_PALLET_OWNER: &str = "Millau.MessagesOwner";

/// Specialized `ChainSpec` for the normal parachain runtime.
pub type ChainSpec =
sc_service::GenericChainSpec<rialto_parachain_runtime::GenesisConfig, Extensions>;
sc_service::GenericChainSpec<rialto_parachain_runtime::RuntimeGenesisConfig, Extensions>;

/// Helper function to generate a crypto pair from seed
pub fn get_from_seed<TPublic: Public>(seed: &str) -> <TPublic::Pair as Pair>::Public {
Expand Down Expand Up @@ -176,18 +176,22 @@ fn testnet_genesis(
initial_authorities: Vec<AuraId>,
endowed_accounts: Vec<AccountId>,
id: ParaId,
) -> rialto_parachain_runtime::GenesisConfig {
rialto_parachain_runtime::GenesisConfig {
) -> rialto_parachain_runtime::RuntimeGenesisConfig {
rialto_parachain_runtime::RuntimeGenesisConfig {
system: rialto_parachain_runtime::SystemConfig {
code: rialto_parachain_runtime::WASM_BINARY
.expect("WASM binary was not build, please build it!")
.to_vec(),
..Default::default()
},
balances: rialto_parachain_runtime::BalancesConfig {
balances: endowed_accounts.iter().cloned().map(|k| (k, 1 << 60)).collect(),
},
sudo: rialto_parachain_runtime::SudoConfig { key: Some(root_key) },
parachain_info: rialto_parachain_runtime::ParachainInfoConfig { parachain_id: id },
parachain_info: rialto_parachain_runtime::ParachainInfoConfig {
parachain_id: id,
..Default::default()
},
aura: rialto_parachain_runtime::AuraConfig { authorities: initial_authorities },
aura_ext: Default::default(),
bridge_millau_messages: BridgeMillauMessagesConfig {
Expand Down

0 comments on commit 70d5fdc

Please sign in to comment.