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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: cleanup build warnings #4

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions openbazaar-lib/src/network.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::open_bazaar_api::open_bazaar_api_client::OpenBazaarApiClient;
use crate::open_bazaar_api::{NodeAddressType, NodeLocationRequest};
use tokio::runtime::Runtime;
use tonic::transport::Channel;
use tonic::{Request, Response, Status};
use tonic::{Request, Status};

#[derive(Debug, thiserror::Error)]
pub enum NetError {
Expand Down
6 changes: 2 additions & 4 deletions openbazaar-server/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ use crate::network::Client;
use crate::openbazaar::open_bazaar_rpc_server::OpenBazaarRpc;
use crate::openbazaar::GetPeerIdRequest;
use crate::openbazaar::GetPeerIdResponse;
use crate::openbazaar::HashType;
use crate::openbazaar::SaveMessageRequest;
use crate::openbazaar::SetProfileResponse;
use crate::openbazaar::{
Expand All @@ -17,7 +16,6 @@ use crate::profile::Profile;
use crate::profile::ProfileData;
use sha3::{Digest, Sha3_256};
use tonic::{Request, Response, Status};
use tracing::log::trace;
use tracing::{event, instrument, Level};

#[derive(Debug)]
Expand Down Expand Up @@ -183,14 +181,14 @@ impl<T: DB + Sync + Send + 'static> OpenBazaarRpc for OpenBazaarRpcService<T> {

let pd = content.clone().profile;

let responseProfile = ProfileMessage {
let response_profile = ProfileMessage {
id: pd.id,
name: pd.name,
email: pd.email,
};

let response = GetProfileResponse {
profile: Some(responseProfile),
profile: Some(response_profile),
};

Ok(Response::new(response))
Expand Down
8 changes: 4 additions & 4 deletions openbazaar-server/src/crypto.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use bdk::keys::bip39::{Language, Mnemonic};

use libp2p::core::identity::ed25519;
use libp2p::identity::ed25519;
// use libp2p::core::identity::ed25519;
use std::str::FromStr;

pub fn generate_mnemonic() -> String {
Expand All @@ -20,8 +21,7 @@ pub fn generate_keypair_from_mnemonic(
seed.copy_from_slice(&seed_64_bytes[0..32]);

let sk = ed25519::SecretKey::from_bytes(seed).expect("not the right amount of bytes");
let keypair: libp2p::identity::Keypair =
libp2p::identity::Keypair::Ed25519(ed25519::Keypair::from(sk));
let keypair = ed25519::Keypair::try_from(sk)?;

Ok(keypair)
Ok(keypair.into())
}
3 changes: 1 addition & 2 deletions openbazaar-server/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,7 @@ impl DB for OpenBazaarDb {
}

async fn set_profile(&self, profile: &Profile) -> anyhow::Result<()> {
let profile = self
.db
self.db
.insert(b"profile", bincode::serialize(profile).unwrap())?;
Ok(())
}
Expand Down
3 changes: 1 addition & 2 deletions openbazaar-server/src/network.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,8 +370,7 @@ impl EventLoop {
SwarmEvent::Behaviour(ComposedEvent::Kademlia(
KademliaEvent::OutboundQueryProgressed {
id,
result:
QueryResult::GetRecord(Err(GetRecordError::NotFound { key, closest_peers })),
result: QueryResult::GetRecord(Err(GetRecordError::NotFound { .. })),
..
},
)) => {
Expand Down
12 changes: 6 additions & 6 deletions openbazaar-server/src/wallet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ use bdk::keys::{DerivableKey, ExtendedKey};
use bdk::template::Bip84;
use bdk::wallet::AddressIndex;
use bdk::Wallet;
use bdk_esplora::{esplora_client, EsploraExt};
// use bdk_esplora::{esplora_client, EsploraExt};
use bdk_file_store::KeychainStore;
use std::collections::BTreeMap;
use std::io::Write;
// use std::collections::BTreeMap;
// use std::io::Write;

const SEND_AMOUNT: u64 = 5000;
const STOP_GAP: usize = 50;
const PARALLEL_REQUESTS: usize = 5;
// const SEND_AMOUNT: u64 = 5000;
// const STOP_GAP: usize = 50;
// const PARALLEL_REQUESTS: usize = 5;

pub fn fire_up_wallet(mnemonic_words: String, data_dir: String) {
let network = Network::Testnet;
Expand Down
18 changes: 3 additions & 15 deletions openbazaar-server/src/webserver.rs
Original file line number Diff line number Diff line change
@@ -1,21 +1,8 @@
use async_trait::async_trait;
use axum::extract::FromRequest;
use axum::http::request::Parts;
use axum::http::Request as HttpRequest;
use axum::http::Request;
use axum::{
extract::{Extension, FromRequestParts, Path},
http::{Response, StatusCode},
response::Html,
routing::get,
Router,
};
use axum_macros::debug_handler;
use serde::{Deserialize, Serialize};
use axum::{extract::FromRequestParts, http::StatusCode, routing::get, Router};
use std::convert::Infallible;
use std::io::Error;
use std::sync::Arc;
use thiserror::Error;
use tower_http::cors::{Any, CorsLayer};

struct AppUser {
Expand All @@ -38,7 +25,8 @@ where
}

pub async fn start_webserver(addr: String) -> Result<(), Error> {
let cors = CorsLayer::new().allow_origin(Any);
// fixme: cors is unused for now.
let _cors = CorsLayer::new().allow_origin(Any);

let app = Router::new()
.route("/", get(root))
Expand Down