Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update toolchain and fix clippy #4212

Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ on:
name: CI

env:
toolchain: nightly-2021-11-20
toolchain: nightly-2022-05-01
CARGO_HTTP_MULTIPLEXING: false
CARGO_TERM_COLOR: always
PROTOC: protoc
Expand Down
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion applications/tari_app_utilities/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ tari_common_types = { path = "../../base_layer/common_types" }
tari_p2p = { path = "../../base_layer/p2p", features = ["auto-update"] }
tari_utilities = { git = "https://github.com/tari-project/tari_utilities.git", tag = "v0.4.3" }

clap = { version = "3.1.1", features = ["derive", "env"] }
clap = { version = "3.2.0", features = ["derive", "env"] }
config = { version = "0.13.0" }
futures = { version = "^0.3.16", default-features = false, features = ["alloc"] }
dirs-next = "1.0.2"
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_base_node/src/commands/cli_loop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ impl CliLoop {
}
}

fn is_interrupted(&mut self, event: Option<Result<Event, io::Error>>) -> bool {
fn is_interrupted(&self, event: Option<Result<Event, io::Error>>) -> bool {
if let Some(Ok(Event::Key(key))) = event {
match key {
KeyEvent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,12 +309,11 @@ pub(crate) async fn inner_asset_wallets_get_latest_address(
let addresses = db
.addresses()
.find_by_asset_and_wallet(asset_id, wallet_id, &tx)?;
Ok(
addresses
.into_iter()
.last()
.ok_or_else(|| Status::not_found("Address".to_string()))?,
)

addresses
.into_iter()
.last()
.ok_or_else(|| Status::not_found("Address".to_string()))
}

pub(crate) async fn inner_asset_wallets_send_to(
Expand All @@ -329,7 +328,6 @@ pub(crate) async fn inner_asset_wallets_send_to(
.ok_or_else(Status::unauthorized)?;
let asset_public_key = PublicKey::from_hex(&asset_public_key)?;
let to_public_key = PublicKey::from_hex(&to_address)?;
let args;
let db = state.create_db().await?;

let tx = db.create_transaction()?;
Expand All @@ -346,7 +344,7 @@ pub(crate) async fn inner_asset_wallets_send_to(
.public_key
.as_bytes(),
);
args = tip002::TransferRequest {
let args = tip002::TransferRequest {
to: Vec::from(to_public_key.as_bytes()),
amount,
from: from_address.clone(),
Expand Down
14 changes: 6 additions & 8 deletions applications/tari_console_wallet/src/grpc/wallet_grpc_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -203,11 +203,10 @@ impl wallet_server::Wallet for WalletGrpcServer {

async fn get_balance(&self, _request: Request<GetBalanceRequest>) -> Result<Response<GetBalanceResponse>, Status> {
let mut output_service = self.get_output_manager_service();
let balance;
match output_service.get_balance().await {
Ok(b) => balance = b,
let balance = match output_service.get_balance().await {
Ok(b) => b,
Err(e) => return Err(Status::not_found(format!("GetBalance error! {}", e))),
}
};
Ok(Response::new(GetBalanceResponse {
available_balance: balance.available_balance.0,
pending_incoming_balance: balance.pending_incoming_balance.0,
Expand All @@ -220,11 +219,10 @@ impl wallet_server::Wallet for WalletGrpcServer {
_: Request<tari_rpc::Empty>,
) -> Result<Response<GetUnspentAmountsResponse>, Status> {
let mut output_service = self.get_output_manager_service();
let unspent_amounts;
match output_service.get_unspent_outputs().await {
Ok(uo) => unspent_amounts = uo,
let unspent_amounts = match output_service.get_unspent_outputs().await {
Ok(uo) => uo,
Err(e) => return Err(Status::not_found(format!("GetUnspentAmounts error! {}", e))),
}
};
Ok(Response::new(GetUnspentAmountsResponse {
amount: unspent_amounts
.into_iter()
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_console_wallet/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ fn main_inner() -> Result<(), ExitError> {
let password = cli
.password
.as_ref()
.or_else(|| config.wallet.password.as_ref())
.or(config.wallet.password.as_ref())
.map(|s| s.to_owned());

if password.is_none() {
Expand Down
17 changes: 8 additions & 9 deletions applications/tari_console_wallet/src/ui/components/menu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,15 +42,14 @@ impl<B: Backend> Component<B> for Menu {
Span::styled(" Version: ", Style::default().fg(Color::White)),
Span::styled(consts::APP_VERSION_NUMBER, Style::default().fg(Color::Magenta)),
Span::raw(" "),
/* In the event this is needed in future, should be put into its' own span
* match cfg!(feature = "avx2") {
* true => Span::styled("Avx2", Style::default().fg(Color::LightGreen)),
* false => Span::styled(
* "Avx2",
* Style::default().fg(Color::LightRed).add_modifier(Modifier::CROSSED_OUT),
* ),
* },
*/
// In the event this is needed in future, should be put into its' own span
// match cfg!(feature = "avx2") {
// true => Span::styled("Avx2", Style::default().fg(Color::LightGreen)),
// false => Span::styled(
// "Avx2",
// Style::default().fg(Color::LightRed).add_modifier(Modifier::CROSSED_OUT),
// ),
// },
]);

let network = Spans::from(vec![
Expand Down
14 changes: 6 additions & 8 deletions applications/tari_merge_mining_proxy/src/proxy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -426,11 +426,11 @@ impl InnerService {

let new_block_protocol = BlockTemplateProtocol::new(&mut grpc_client, &mut grpc_wallet_client);

let seed_hash = FixedByteArray::from_hex(&monerod_resp["result"]["seed_hash"].to_string().replace("\"", ""))
let seed_hash = FixedByteArray::from_hex(&monerod_resp["result"]["seed_hash"].to_string().replace('\"', ""))
.map_err(|err| MmProxyError::InvalidMonerodResponse(format!("seed hash hex is invalid: {}", err)))?;
let blocktemplate_blob = monerod_resp["result"]["blocktemplate_blob"]
.to_string()
.replace("\"", "");
.replace('\"', "");
let difficulty = monerod_resp["result"]["difficulty"].as_u64().unwrap_or_default();
let monero_mining_data = MoneroMiningData {
seed_hash,
Expand Down Expand Up @@ -703,11 +703,9 @@ impl InnerService {
);
}

let json_response;

// If the request is a block submission and we are not submitting blocks
// to the origin (self-select mode, see next comment for a full explanation)
if submit_block && !self.config.submit_to_origin {
let json_response = if submit_block && !self.config.submit_to_origin {
debug!(
target: LOG_TARGET,
"[monerod] skip: Proxy configured for self-select mode. Pool will submit to MoneroD, submitting to \
Expand All @@ -730,16 +728,16 @@ impl InnerService {
// NB!: This is by design, do not change this without understanding
// it's implications.
let accept_response = json_rpc::default_block_accept_response(json["id"].as_i64());
json_response =
convert_json_to_hyper_json_response(accept_response, StatusCode::OK, monerod_uri.clone()).await?;

convert_json_to_hyper_json_response(accept_response, StatusCode::OK, monerod_uri.clone()).await?
} else {
let resp = builder
// This is a cheap clone of the request body
.body(body)
.send()
.await
.map_err(MmProxyError::MonerodRequestFailed)?;
json_response = convert_reqwest_response_to_hyper_json_response(resp).await?
convert_reqwest_response_to_hyper_json_response(resp).await?
};

let rpc_status = if json_response.body()["error"].is_null() {
Expand Down
2 changes: 1 addition & 1 deletion applications/tari_validator_node/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ tari_common_types = { path = "../../base_layer/common_types" }
anyhow = "1.0.53"
async-trait = "0.1.50"
blake2 = "0.9.2"
clap = { version = "3.1.8", features = ["env"] }
clap = { version = "3.2.5", features = ["env"] }
config = "0.13.0"
digest = "0.9.0"
futures = { version = "^0.3.1" }
Expand Down
10 changes: 5 additions & 5 deletions applications/tari_validator_node/src/p2p/rpc/service_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@ where
.map_err(|_| RpcStatus::bad_request("Invalid template_id"))?,
request.method.clone(),
request.args.clone(),
/* TokenId(request.token_id.clone()),
* TODO: put signature in here
* ComSig::default()
* create_com_sig_from_bytes(&request.signature)
* .map_err(|err| Status::invalid_argument("signature was not a valid comsig"))?, */
// TokenId(request.token_id.clone()),
// TODO: put signature in here
// ComSig::default()
// create_com_sig_from_bytes(&request.signature)
// .map_err(|err| Status::invalid_argument("signature was not a valid comsig"))?,
);
debug!(target: LOG_TARGET, "Submitting instruction {} to mempool", instruction);
let mut mempool_service = self.mempool_service.clone();
Expand Down
6 changes: 3 additions & 3 deletions base_layer/common_types/src/transaction.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use thiserror::Error;

pub use crate::tx_id::TxId;

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum TransactionStatus {
/// This transaction has been completed between the parties but has not been broadcast to the base layer network.
Completed,
Expand Down Expand Up @@ -99,7 +99,7 @@ impl Display for TransactionStatus {
}
}

#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[derive(Debug, Clone, PartialEq, Eq, Serialize, Deserialize)]
pub enum ImportStatus {
/// This transaction import status is used when importing a spendable UTXO
Imported,
Expand Down Expand Up @@ -134,7 +134,7 @@ impl TryFrom<TransactionStatus> for ImportStatus {
}
}

#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq, Eq)]
pub enum TransactionDirection {
Inbound,
Outbound,
Expand Down
4 changes: 2 additions & 2 deletions base_layer/common_types/src/types/bullet_rangeproofs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ impl ByteArray for BulletRangeProof {
}

fn from_vec(v: &Vec<u8>) -> Result<Self, ByteArrayError> {
Ok(BulletRangeProof { 0: v.clone() })
Ok(BulletRangeProof(v.clone()))
}

fn from_bytes(bytes: &[u8]) -> Result<Self, ByteArrayError> {
Ok(BulletRangeProof { 0: bytes.to_vec() })
Ok(BulletRangeProof(bytes.to_vec()))
}

fn as_bytes(&self) -> &[u8] {
Expand Down
4 changes: 2 additions & 2 deletions base_layer/core/src/base_node/proto/wallet_rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ pub struct TxSubmissionResponse {
pub is_synced: bool,
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum TxSubmissionRejectionReason {
None,
AlreadyMined,
Expand Down Expand Up @@ -139,7 +139,7 @@ pub struct TxQueryBatchResponse {
pub block_height: u64,
}

#[derive(Clone, Debug, PartialEq, Serialize, Deserialize)]
#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub enum TxLocation {
NotStored,
InMempool,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl<E: std::error::Error> From<E> for StateEvent {
/// blockchain the local node is. It can either be very far behind (`LaggingBehindHorizon`), in which case we will just
/// synchronise against the pruning horizon; we're somewhat behind (`Lagging`) and need to download the missing
/// blocks to catch up, or we are `UpToDate`.
#[derive(Debug, Clone, PartialEq)]
#[derive(Debug, Clone, PartialEq, Eq)]
pub enum SyncStatus {
// We are behind the chain tip.
Lagging {
Expand Down Expand Up @@ -252,7 +252,7 @@ impl Display for StatusInfo {
}

/// This struct contains info that is use full for external viewing of state info
#[derive(Clone, Debug, PartialEq)]
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct BlockSyncInfo {
pub tip_height: u64,
pub local_height: u64,
Expand Down
Loading