Skip to content
This repository was archived by the owner on Feb 28, 2021. It is now read-only.
Merged
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,657 changes: 926 additions & 731 deletions Cargo.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ url = "1.7"

[dependencies.sp-core]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"
18 changes: 9 additions & 9 deletions client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,39 +27,39 @@ url = "1.7"

[dependencies.frame-system]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.frame-support]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-core]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-runtime]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-io]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sc-rpc-api]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-rpc]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-state-machine]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-transaction-pool]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dev-dependencies]
async-std = { version = "1.4", features = ["attributes"] }
Expand Down
11 changes: 2 additions & 9 deletions client/src/backend/remote_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,7 @@ impl RemoteNode {
None => return Err(Error::from("watch_extrinsic stream terminated")),
Some(tx_status) => match tx_status {
TxStatus::Future | TxStatus::Ready | TxStatus::Broadcast(_) => (),
TxStatus::InBlock(_block_hash) => {
return Err("Invalid tx status \"InBlock\"".into())
}
TxStatus::Usurped(_) => return Err("Extrinsic Usurped".into()),
TxStatus::Dropped => return Err("Extrinsic Dropped".into()),
TxStatus::Invalid => return Err("Extrinsic Invalid".into()),
other => return Err(format!("Invalid TxStatus: {:?}", other).into()),
},
}

Expand All @@ -125,9 +120,7 @@ impl RemoteNode {
Some(tx_status) => match tx_status {
TxStatus::Future | TxStatus::Ready | TxStatus::Broadcast(_) => continue,
TxStatus::InBlock(block_hash) => return Ok(block_hash),
TxStatus::Usurped(_) => return Err("Extrinsic Usurped".into()),
TxStatus::Dropped => return Err("Extrinsic Dropped".into()),
TxStatus::Invalid => return Err("Extrinsic Invalid".into()),
other => return Err(format!("Invalid TxStatus: {:?}", other).into()),
},
}
}
Expand Down
14 changes: 8 additions & 6 deletions client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ use parity_scale_codec::{Decode, FullCodec};

use frame_support::storage::generator::{StorageMap, StorageValue};
use frame_support::storage::StoragePrefixedMap;
use radicle_registry_runtime::{balances, registry, registry::DecodeKey, Runtime};
use radicle_registry_runtime::{registry, registry::DecodeKey, system, Runtime};

mod backend;
mod error;
Expand Down Expand Up @@ -215,15 +215,17 @@ impl ClientT for Client {
&self,
account_id: &AccountId,
) -> Result<state::AccountTransactionIndex, Error> {
self.fetch_map_value::<frame_system::AccountNonce<Runtime>, _, _>(*account_id)
.await
let account_info = self
.fetch_map_value::<frame_system::Account<Runtime>, _, _>(*account_id)
.await?;
Ok(account_info.nonce)
}

async fn free_balance(&self, account_id: &AccountId) -> Result<state::AccountBalance, Error> {
let account_data = self
.fetch_map_value::<balances::Account<Runtime>, _, _>(account_id.clone())
let account_info = self
.fetch_map_value::<system::Account<Runtime>, _, _>(account_id.clone())
.await?;
Ok(account_data.free)
Ok(account_info.data.free)
}

async fn get_org(&self, id: OrgId) -> Result<Option<Org>, Error> {
Expand Down
6 changes: 3 additions & 3 deletions client/src/message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
//! Defines [Message] trait and implementations for all messages in `radicle_registry_core::messages`.

use radicle_registry_core::*;
use radicle_registry_runtime::{registry, Call as RuntimeCall, Event};
use radicle_registry_runtime::{registry, Call as RuntimeCall, Event, Runtime};
use sp_runtime::DispatchError;

pub use radicle_registry_core::message::*;
Expand Down Expand Up @@ -216,8 +216,8 @@ impl Message for message::TransferFromOrg {
fn get_dispatch_result(events: &[Event]) -> Result<Result<(), DispatchError>, EventParseError> {
find_event(events, "System", |event| match event {
Event::system(system_event) => match system_event {
frame_system::Event::ExtrinsicSuccess(_) => Some(Ok(())),
frame_system::Event::ExtrinsicFailed(ref dispatch_error, _) => {
frame_system::Event::<Runtime>::ExtrinsicSuccess(_) => Some(Ok(())),
frame_system::Event::<Runtime>::ExtrinsicFailed(ref dispatch_error, _) => {
Some(Err(*dispatch_error))
}
_ => None,
Expand Down
4 changes: 2 additions & 2 deletions client/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ mod test {
use radicle_registry_runtime::{GenesisConfig, Runtime};
use sp_core::H256;
use sp_runtime::traits::{Checkable, IdentityLookup};
use sp_runtime::BuildStorage as _;
use sp_runtime::{BuildStorage as _, Perbill};

#[test]
/// Assert that extrinsics created with [create_and_sign] are validated by the runtime.
Expand All @@ -170,7 +170,7 @@ mod test {

let xt = signed_extrinsic(
&key_pair,
frame_system::Call::fill_block().into(),
frame_system::Call::fill_block(Perbill::from_parts(0)).into(),
TransactionExtra {
nonce: 0,
genesis_hash,
Expand Down
4 changes: 2 additions & 2 deletions core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ version = "1.0.0"

[dependencies.sp-core]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"
default-features = false

[dependencies.sp-runtime]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"
default-features = false
30 changes: 15 additions & 15 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -36,60 +36,60 @@ version = "3.1.3"

[dependencies.sc-basic-authorship]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-inherents]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sc-network]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-core]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-io]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sc-cli]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sc-client]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sc-consensus-pow]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sc-executor]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sc-service]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sc-transaction-pool]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-transaction-pool]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-consensus]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-consensus-pow]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"

[dependencies.sp-runtime]
git = "https://github.com/paritytech/substrate"
rev = "09abd3b436ea568a47ec4fc47f933728d8cf466b"
rev = "9fa8589d9b8cfe8716e9e4c48f9e3f238c1e502f"
9 changes: 5 additions & 4 deletions node/src/chain_spec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,12 @@ use crate::pow::config::Config as PowAlgConfig;
use radicle_registry_runtime::{
AccountId, BalancesConfig, GenesisConfig, SudoConfig, SystemConfig, WASM_BINARY,
};
use sc_service::GenericChainSpec;
use sp_core::{Pair, Public};
use std::convert::TryFrom;

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

/// Possible chains.
///
Expand All @@ -49,7 +50,7 @@ impl Chain {
}

pub fn dev() -> ChainSpec {
ChainSpec::from_genesis(
GenericChainSpec::from_genesis(
"Development, isolated node",
"dev",
dev_genesis_config,
Expand Down Expand Up @@ -87,7 +88,7 @@ fn dev_genesis_config() -> GenesisConfig {
}

pub fn devnet() -> ChainSpec {
ChainSpec::from_genesis(
GenericChainSpec::from_genesis(
"devnet",
"devnet",
devnet_genesis_config,
Expand All @@ -106,7 +107,7 @@ pub fn devnet() -> ChainSpec {
}

pub fn local_devnet() -> ChainSpec {
ChainSpec::from_genesis(
GenericChainSpec::from_genesis(
"local devnet, isolated on one machine",
"local-devnet",
devnet_genesis_config,
Expand Down
34 changes: 15 additions & 19 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,36 +13,32 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use sc_cli::{error, VersionInfo};
use sc_cli::VersionInfo;

use crate::cli;
use crate::service;

/// Parse and run command line arguments
pub fn run(version: VersionInfo) -> error::Result<()> {
pub fn run(version: VersionInfo) -> sc_cli::Result<()> {
crate::logger::init();

let args = cli::Arguments::from_args(&version);
let config = sc_service::Configuration::new(&version);
let mut config = sc_service::Configuration::from_version(&version);

let chain_spec = args.chain.spec();
let spec_factory = |_: &str| Ok(Some(chain_spec));
let spec_factory = |_: &str| Ok(Box::new(chain_spec) as Box<_>);

match args.subcommand {
Some(subcommand) => sc_cli::run_subcommand(
config,
subcommand,
spec_factory,
|config: _| Ok(new_full_start!(config).0),
&version,
),
None => sc_cli::run(
config,
args.run_cmd(),
service::new_light,
service::new_full,
spec_factory,
&version,
),
Some(subcommand) => {
subcommand.init(&version)?;
subcommand.update_config(&mut config, spec_factory, &version)?;
subcommand.run(config, |config: _| Ok(new_full_start!(config).0))
}
None => {
let run_cmd = args.run_cmd();
run_cmd.init(&version)?;
run_cmd.update_config(&mut config, spec_factory, &version)?;
run_cmd.run(config, service::new_light, service::new_full, &version)
}
}
}
4 changes: 1 addition & 3 deletions node/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,8 @@ mod command;
mod logger;
mod pow;

pub use sc_cli::{error, VersionInfo};

fn main() {
let version = VersionInfo {
let version = sc_cli::VersionInfo {
name: "Radicle Registry Node",
commit: "<none>",
// commit: env!("VERGEN_SHA_SHORT"),
Expand Down
4 changes: 2 additions & 2 deletions node/src/pow/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,10 @@ impl Config {
const PROPERTY_KEY: &'static str = "pow_alg";
}

impl<'a, T> TryFrom<&'a Configuration<T>> for Config {
impl<'a> TryFrom<&'a Configuration> for Config {
type Error = &'static str;

fn try_from(config: &'a Configuration<T>) -> Result<Self, Self::Error> {
fn try_from(config: &'a Configuration) -> Result<Self, Self::Error> {
config
.chain_spec
.as_ref()
Expand Down
Loading