Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
Add licende headers and fix some grumbles
Browse files Browse the repository at this point in the history
  • Loading branch information
chevdor committed Jun 6, 2022
1 parent c1b507a commit 713f1ba
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 3 deletions.
22 changes: 21 additions & 1 deletion utils/staking-miner/src/info.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,31 @@
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Polkadot 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.

// Polkadot 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 Polkadot. If not, see <http://www.gnu.org/licenses/>.

use sp_version::RuntimeVersion;

#[derive(Debug, serde::Serialize)]
pub(crate) struct Info {
pub spec_name: String,
pub spec_version: u32,
}

impl Info {
pub fn new(spec_name: String, spec_version: u32) -> Self {
pub fn new(runtime_version: &RuntimeVersion) -> Self {
let spec_name = runtime_version.spec_name.to_string();
let spec_version = runtime_version.spec_version;
Self { spec_name, spec_version }
}
}
4 changes: 2 additions & 2 deletions utils/staking-miner/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -535,8 +535,8 @@ async fn main() {
}),
Command::Info(_info_opts) => {
let runtime_version: RuntimeVersion = rpc.runtime_version(None).await.expect("runtime_version infallible; qed.");
let info = Info::new(runtime_version.spec_name.to_string(), runtime_version.spec_version);
let info = serde_json::to_string_pretty(&info).expect("Failed serializing infos");
let info = Info::new(&runtime_version);
let info = serde_json::to_string_pretty(&info).expect("crap");
println!("{}", info);
Ok(())
}
Expand Down
16 changes: 16 additions & 0 deletions utils/staking-miner/src/opts.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
// Copyright 2021 Parity Technologies (UK) Ltd.
// This file is part of Polkadot.

// Polkadot 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.

// Polkadot 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 Polkadot. If not, see <http://www.gnu.org/licenses/>.

use crate::prelude::*;
use clap::Parser;
use sp_runtime::Perbill;
Expand Down

0 comments on commit 713f1ba

Please sign in to comment.