This repository was archived by the owner on Nov 15, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
RPCs for versioning #175
Merged
Merged
RPCs for versioning #175
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5a61b67
RPCs for versioning.
gavofyork d443f30
Merge remote-tracking branch 'origin/master' into gav-version-rpc
gavofyork d580278
Build fix for bad merge.
gavofyork e1ab201
Add system_name RPC
gavofyork 471e6d0
Fix tests.
gavofyork 708c08a
Fix demo build.
gavofyork d1fb5a7
Remove BadFormat.
gavofyork File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[package] | ||
name = "polkadot-cli" | ||
version = "0.1.0" | ||
version = "0.2.0" | ||
authors = ["Parity Technologies <[email protected]>"] | ||
description = "Polkadot node implementation in Rust." | ||
|
||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -45,3 +45,4 @@ pub mod author; | |
pub mod chain; | ||
pub mod metadata; | ||
pub mod state; | ||
pub mod system; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
// Copyright 2017 Parity Technologies (UK) Ltd. | ||
// This file is part of Substrate. | ||
|
||
// Substrate is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Substrate is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! System RPC module errors. | ||
|
||
use rpc; | ||
|
||
error_chain! { | ||
errors { | ||
/// Not implemented yet | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Don't think the errors are needed at all. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i removed |
||
Unimplemented { | ||
description("not yet implemented"), | ||
display("Method Not Implemented"), | ||
} | ||
} | ||
} | ||
|
||
impl From<Error> for rpc::Error { | ||
fn from(e: Error) -> Self { | ||
match e { | ||
Error(ErrorKind::Unimplemented, _) => rpc::Error { | ||
code: rpc::ErrorCode::ServerError(-1), | ||
message: "Not implemented yet".into(), | ||
data: None, | ||
}, | ||
_ => rpc::Error::internal_error(), | ||
} | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Copyright 2017 Parity Technologies (UK) Ltd. | ||
// This file is part of Substrate. | ||
|
||
// Substrate is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Substrate is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
//! Substrate system API. | ||
|
||
pub mod error; | ||
|
||
#[cfg(test)] | ||
mod tests; | ||
|
||
use self::error::Result; | ||
|
||
build_rpc_trait! { | ||
/// Substrate system RPC API | ||
pub trait SystemApi { | ||
/// Get the node's implementation name. Plain old string. | ||
#[rpc(name = "system_name")] | ||
fn system_name(&self) -> Result<String>; | ||
|
||
/// Get the node implementation's version. Should be a semver string. | ||
#[rpc(name = "system_version")] | ||
fn system_version(&self) -> Result<String>; | ||
|
||
/// Get the chain's type. Given as a string identifier. | ||
#[rpc(name = "system_chain")] | ||
fn system_chain(&self) -> Result<String>; | ||
} | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// Copyright 2017 Parity Technologies (UK) Ltd. | ||
// This file is part of Substrate. | ||
|
||
// Substrate is free software: you can redistribute it and/or modify | ||
// it under the terms of the GNU General Public License as published by | ||
// the Free Software Foundation, either version 3 of the License, or | ||
// (at your option) any later version. | ||
|
||
// Substrate is distributed in the hope that it will be useful, | ||
// but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
// GNU General Public License for more details. | ||
|
||
// You should have received a copy of the GNU General Public License | ||
// along with Substrate. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
use super::*; | ||
use super::error::*; | ||
|
||
impl SystemApi for () { | ||
fn system_name(&self) -> Result<String> { | ||
Ok("testclient".into()) | ||
} | ||
fn system_version(&self) -> Result<String> { | ||
Ok("0.2.0".into()) | ||
} | ||
fn system_chain(&self) -> Result<String> { | ||
Ok("testchain".into()) | ||
} | ||
} | ||
|
||
#[test] | ||
fn system_name_works() { | ||
assert_eq!( | ||
SystemApi::system_name(&()).unwrap(), | ||
"testclient".to_owned() | ||
); | ||
} | ||
|
||
#[test] | ||
fn system_version_works() { | ||
assert_eq!( | ||
SystemApi::system_version(&()).unwrap(), | ||
"0.2.0".to_owned() | ||
); | ||
} | ||
|
||
#[test] | ||
fn system_chain_works() { | ||
assert_eq!( | ||
SystemApi::system_chain(&()).unwrap(), | ||
"testchain".to_owned() | ||
); | ||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can't that be derived?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sadly not since the
transaction_pool::Options
doesn't deriveClone
and it's in a different repo so can't be fixed in this PR.