Skip to content
This repository was archived by the owner on Feb 28, 2021. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1,788 changes: 1,102 additions & 686 deletions Cargo.lock

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,26 @@ log = "0.4"
parity-scale-codec = "1.0"
tokio = "0.1"

[dependencies.paint-system]
[dependencies.frame-system]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"

[dependencies.paint-support]
[dependencies.frame-support]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"

[dependencies.paint-transaction-payment]
[dependencies.pallet-transaction-payment]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"

[dependencies.substrate-primitives]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"

[dependencies.sr-primitives]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"

[dependencies.sr-io]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"
8 changes: 4 additions & 4 deletions client/src/base.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use frame_support::storage::generator::{StorageMap, StorageValue};
use futures01::future::Future;
use paint_support::storage::generator::{StorageMap, StorageValue};
use parity_scale_codec::FullCodec;
use sr_primitives::traits::Hash as _;
use substrate_primitives::ed25519;
Expand Down Expand Up @@ -48,9 +48,9 @@ impl Client {

pub fn fetch_map_value<S: StorageMap<Key, Value>, Key: FullCodec, Value: FullCodec>(
&self,
key: Key,
k: Key,
) -> impl Future<Item = S::Query, Error = Error> {
let key = StorageKey(Vec::from(S::storage_map_final_key(key).as_ref()));
let key = StorageKey(S::storage_map_final_key(k));
self.subxt_client
.fetch::<Value>(key)
.map(S::from_optional_value_to_query)
Expand Down Expand Up @@ -134,7 +134,7 @@ fn extract_events(block: OpaqueBlock, ext_success: ExtrinsicSuccess) -> Option<V
.events
.iter()
.filter_map(|event_record| match event_record.phase {
paint_system::Phase::ApplyExtrinsic(i) if i == xt_index as u32 => {
frame_system::Phase::ApplyExtrinsic(i) if i == xt_index as u32 => {
Some(event_record.event.clone())
}
_ => None,
Expand Down
10 changes: 6 additions & 4 deletions client/src/call.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,19 @@ impl Call for registry::TransferFromProjectParams {

/// Extract the dispatch result of an extrinsic from the extrinsic events.
///
/// Looks for the [paint_system::Event] in the list of events and returns the inner result based on
/// Looks for the [frame_system::Event] in the list of events and returns the inner result based on
/// the event.
///
/// Returns an outer [EventParseError] if no [paint_system::Event] was present in `events`.
/// Returns an outer [EventParseError] if no [frame_system::Event] was present in `events`.
///
/// Because of an issue with substrate the `message` field of [DispatchError] will always be `None`
fn get_dispatch_result(events: &[Event]) -> Result<Result<(), DispatchError>, EventParseError> {
find_event(events, "System", |event| match event {
Event::system(system_event) => match system_event {
paint_system::Event::ExtrinsicSuccess => Some(Ok(())),
paint_system::Event::ExtrinsicFailed(ref dispatch_error) => Some(Err(*dispatch_error)),
frame_system::Event::ExtrinsicSuccess(_) => Some(Ok(())),
frame_system::Event::ExtrinsicFailed(ref dispatch_error, _) => {
Some(Err(*dispatch_error))
}
},
_ => None,
})
Expand Down
22 changes: 11 additions & 11 deletions client/src/extrinsic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,12 @@ fn transaction_extra_to_runtime_extra(
SignedExtra,
<SignedExtra as SignedExtension>::AdditionalSigned,
) {
let check_version = paint_system::CheckVersion::new();
let check_genesis = paint_system::CheckGenesis::new();
let check_era = paint_system::CheckEra::from(Era::Immortal);
let check_nonce = paint_system::CheckNonce::from(extra.nonce);
let check_weight = paint_system::CheckWeight::new();
let charge_transaction_payment = paint_transaction_payment::ChargeTransactionPayment::from(0);
let check_version = frame_system::CheckVersion::new();
let check_genesis = frame_system::CheckGenesis::new();
let check_era = frame_system::CheckEra::from(Era::Immortal);
let check_nonce = frame_system::CheckNonce::from(extra.nonce);
let check_weight = frame_system::CheckWeight::new();
let charge_transaction_payment = pallet_transaction_payment::ChargeTransactionPayment::from(0);

let additional_signed = (
check_version
Expand Down Expand Up @@ -94,15 +94,15 @@ mod test {
/// Assert that extrinsics created with [create_and_sign] are validated by the runtime.
fn check_extrinsic() {
let genesis_config = GenesisConfig {
paint_aura: None,
paint_balances: None,
paint_sudo: None,
pallet_aura: None,
pallet_balances: None,
pallet_sudo: None,
system: None,
};
let mut test_ext = sr_io::TestExternalities::new(genesis_config.build_storage().unwrap());
let (key_pair, _) = ed25519::Pair::generate();

type System = paint_system::Module<Runtime>;
type System = frame_system::Module<Runtime>;
let genesis_hash = test_ext.execute_with(|| {
System::initialize(
&1,
Expand All @@ -115,7 +115,7 @@ mod test {

let xt = signed_extrinsic(
&key_pair,
paint_system::Call::fill_block().into(),
frame_system::Call::fill_block().into(),
0,
genesis_hash,
);
Expand Down
18 changes: 9 additions & 9 deletions client/src/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use futures01::{future, prelude::*};
use std::sync::{Arc, Mutex};

use paint_support::storage::generator::{StorageMap, StorageValue};
use frame_support::storage::generator::{StorageMap, StorageValue};
use parity_scale_codec::{Decode, FullCodec};
use sr_primitives::{traits::Hash as _, BuildStorage as _};

Expand Down Expand Up @@ -31,8 +31,8 @@ pub struct MemoryClient {
impl MemoryClient {
pub fn new() -> Self {
let genesis_config = GenesisConfig {
paint_aura: None,
paint_balances: Some(BalancesConfig {
pallet_aura: None,
pallet_balances: Some(BalancesConfig {
balances: vec![(
ed25519::Pair::from_string("//Alice", None)
.unwrap()
Expand All @@ -41,18 +41,18 @@ impl MemoryClient {
)],
vesting: vec![],
}),
paint_sudo: None,
pallet_sudo: None,
system: None,
};
let mut test_ext = sr_io::TestExternalities::new(genesis_config.build_storage().unwrap());
let genesis_hash = test_ext.execute_with(|| {
paint_system::Module::<Runtime>::initialize(
frame_system::Module::<Runtime>::initialize(
&1,
&[0u8; 32].into(),
&[0u8; 32].into(),
&Default::default(),
);
paint_system::Module::<Runtime>::block_hash(0)
frame_system::Module::<Runtime>::block_hash(0)
});
MemoryClient {
test_ext: Arc::new(Mutex::new(test_ext)),
Expand Down Expand Up @@ -113,9 +113,9 @@ impl Client for MemoryClient {
let tx_hash = Hashing::hash_of(&extrinsic);
let test_ext = &mut client.test_ext.lock().unwrap();
let events = test_ext.execute_with(move || {
let event_start_index = paint_system::Module::<Runtime>::event_count();
let event_start_index = frame_system::Module::<Runtime>::event_count();
let _apply_outcome = Executive::apply_extrinsic(extrinsic).unwrap();
paint_system::Module::<Runtime>::events()
frame_system::Module::<Runtime>::events()
.into_iter()
.skip(event_start_index as usize)
.map(|event_record| event_record.event)
Expand All @@ -135,7 +135,7 @@ impl Client for MemoryClient {
fn get_transaction_extra(&self, account_id: &AccountId) -> Response<TransactionExtra, Error> {
let test_ext = &mut self.test_ext.lock().unwrap();
let nonce =
test_ext.execute_with(|| paint_system::Module::<Runtime>::account_nonce(account_id));
test_ext.execute_with(|| frame_system::Module::<Runtime>::account_nonce(account_id));
Box::new(future::ok(TransactionExtra {
nonce,
genesis_hash: self.genesis_hash,
Expand Down
39 changes: 25 additions & 14 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ version = "0.1.0"
[dependencies]
derive_more = "0.15.0"
exit-future = "0.1.4"
futures = "0.1.29"
futures01 = { package = "futures", version = "0.1.29" }
futures03 = { package = "futures", version = "0.3.1", features = ["compat"] }
log = "0.4.8"
parking_lot = "0.9.0"
tokio = "0.1.22"
Expand All @@ -26,55 +27,65 @@ path = "../runtime"

[dependencies.aura]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"
package = "substrate-consensus-aura"

[dependencies.aura-primitives]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"
package = "substrate-consensus-aura-primitives"

[dependencies.basic-authorship]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"
package = "substrate-basic-authorship"

[dependencies.inherents]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"
package = "substrate-inherents"

[dependencies.network]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"
package = "substrate-network"

[dependencies.primitives]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"
package = "substrate-primitives"

[dependencies.sr-io]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"

[dependencies.substrate-cli]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"

[dependencies.substrate-client]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"

[dependencies.substrate-executor]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"

[dependencies.substrate-service]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"

[dependencies.transaction-pool]
git = "https://github.com/paritytech/substrate"
rev = "dc4a8329b9c47790c25429a5df272b3648275c1b"
package = "substrate-transaction-pool"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"
package = "sc-transaction-pool"

[dependencies.consensus-common]
git = "https://github.com/paritytech/substrate"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"
package = "substrate-consensus-common"

[dependencies.txpool-api]
git = "https://github.com/paritytech/substrate"
rev = "b9e7f09a675b5625cc8b156848d976592e07a409"
package = "sc-transaction-graph"
6 changes: 3 additions & 3 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,15 @@ fn dev_genesis_config() -> GenesisConfig {
code: WASM_BINARY.to_vec(),
changes_trie_config: Default::default(),
}),
paint_balances: Some(BalancesConfig {
pallet_balances: Some(BalancesConfig {
balances: endowed_accounts
.iter()
.cloned()
.map(|k| (k, 1 << 60))
.collect(),
vesting: vec![],
}),
paint_sudo: Some(SudoConfig { key: root_key }),
paint_aura: Some(AuraConfig { authorities }),
pallet_sudo: Some(SudoConfig { key: root_key }),
pallet_aura: Some(AuraConfig { authorities }),
}
}
31 changes: 20 additions & 11 deletions node/src/cli.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
use crate::chain_spec;
use crate::service;
use aura_primitives::sr25519::AuthorityPair as AuraPair;
use futures::{future, sync::oneshot, Future};
use futures03::{
channel::oneshot,
compat::Future01CompatExt,
future::{select, Map},
FutureExt, TryFutureExt,
};
use log::info;
use std::cell::RefCell;
pub use substrate_cli::{error, IntoExit, VersionInfo};
Expand Down Expand Up @@ -81,36 +86,40 @@ where
T: AbstractService,
E: IntoExit,
{
let (exit_send, exit) = exit_future::signal();
let (exit_send, exit) = oneshot::channel();

let informant = informant::build(&service);
runtime.executor().spawn(exit.until(informant).map(|_| ()));
let future = select(exit, informant).map(|_| Ok(())).compat();

runtime.executor().spawn(future);

// we eagerly drop the service so that the internal exit future is fired,
// but we need to keep holding a reference to the global telemetry guard
let _telemetry = service.telemetry();

let service_res = {
let exit = e
.into_exit()
.map_err(|_| error::Error::Other("Exit future failed.".into()));
let service = service.map_err(error::Error::Service);
let select = service.select(exit).map(|_| ()).map_err(|(err, _)| err);
let exit = e.into_exit();
let service = service.map_err(error::Error::Service).compat();
let select = select(service, exit).map(|_| Ok(())).compat();
runtime.block_on(select)
};

exit_send.fire();
let _ = exit_send.send(());

// TODO [andre]: timeout this future #1318
use futures01::Future;
let _ = runtime.shutdown_on_idle().wait();

service_res
}

type Fut = oneshot::Receiver<()>;
type Func = fn(Result<(), oneshot::Canceled>) -> ();

// handles ctrl-c
pub struct Exit;
impl IntoExit for Exit {
type Exit = future::MapErr<oneshot::Receiver<()>, fn(oneshot::Canceled) -> ()>;
type Exit = Map<Fut, Func>;
fn into_exit(self) -> Self::Exit {
// can't use signal directly here because CtrlC takes only `Fn`.
let (exit_send, exit) = oneshot::channel();
Expand All @@ -127,6 +136,6 @@ impl IntoExit for Exit {
})
.expect("Error setting Ctrl-C handler");

exit.map_err(drop)
exit.map(drop)
}
}
4 changes: 2 additions & 2 deletions node/src/service.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Service and ServiceFactory implementation. Specialized wrapper over substrate service.

use aura_primitives::sr25519::AuthorityPair as AuraPair;
use futures::prelude::*;
use futures01::prelude::*;
use inherents::InherentDataProviders;
use network::construct_simple_protocol;
use radicle_registry_runtime::{self, opaque::Block, GenesisConfig, RuntimeApi};
Expand Down Expand Up @@ -98,7 +98,7 @@ pub fn new_full<C: Send + Default + 'static>(
client.clone(),
proposer,
service.network(),
inherent_data_providers.clone(),
inherent_data_providers,
force_authoring,
service.keystore(),
)?;
Expand Down
Loading