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

Nomos http API #476

Merged
merged 75 commits into from
Nov 1, 2023
Merged

Nomos http API #476

merged 75 commits into from
Nov 1, 2023

Conversation

al8n
Copy link
Contributor

@al8n al8n commented Oct 24, 2023

Finish information related API

Base automatically changed from metrics-api to master October 31, 2023 09:20
* add da_blob for new http api
* add storage api for new http backend
* Add mempool add apis
@danielSanchezQ
Copy link
Collaborator

@al8n , usually you need to merge from the bottom up. Not the other way around. This PR was ready to be merged yesterday already.

Comment on lines 80 to 91
.route("/cl/metrics", routing::get(cl_metrics::<ClTransaction>))
.route("/cl/status", routing::post(cl_status::<ClTransaction>))
.route("/da/blobs", routing::post(da_blobs))
.route("/cl/metrics", routing::get(cl_metrics::<T>))
.route("/cl/status", routing::post(cl_status::<T>))
.route("/carnot/info", routing::get(carnot_info::<T, S, SIZE>))
.route("/network/info", routing::get(libp2p_info))
.route("/storage/block", routing::post(block::<S, T>))
.route("/mempool/add/tx", routing::post(add_tx::<T>))
.route("/mempool/add/cert", routing::post(add_cert))
.with_state(self.settings.handle);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we have all this here now? this was merged right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I merged other approved PR to this PR, this PR has not been merged.

@danielSanchezQ danielSanchezQ changed the title Info api Nomos http API Nov 1, 2023
Comment on lines 1 to 18
use std::{fmt::Debug, hash::Hash, net::SocketAddr, sync::Arc};
use std::{fmt::Debug, hash::Hash, net::SocketAddr};

use axum::{extract::State, response::IntoResponse, routing, Json, Router, Server};
use full_replication::Blob;
use hyper::StatusCode;
use axum::{extract::State, response::Response, routing, Json, Router, Server};
use consensus_engine::BlockId;
use full_replication::{Blob, Certificate};
use nomos_core::{da::blob, tx::Transaction};
use nomos_mempool::{openapi::Status, MempoolMetrics};
use nomos_mempool::{network::adapters::libp2p::Libp2pAdapter, openapi::Status, MempoolMetrics};
use nomos_network::backends::libp2p::Libp2p;
use nomos_storage::backends::StorageSerde;
use overwatch_rs::overwatch::handle::OverwatchHandle;
use serde::{Deserialize, Serialize};
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use utoipa::OpenApi;
use utoipa_swagger_ui::SwaggerUi;

use crate::{
http::{cl::*, da::*},
http::{cl, consensus, da, libp2p, mempool, storage},
Backend,
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick. All imports are mixed. We should try to separate in blocks:

// std

// crates

// internal

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I am a little bit confused here, do you mean we should treat nomos* as internal crates? Otherwise, it seems imports are already in the std - crates - internal format.

use std::{fmt::Debug, hash::Hash, net::SocketAddr};

use axum::{extract::State, response::Response, routing, Json, Router, Server};
use consensus_engine::BlockId;
use full_replication::{Blob, Certificate};
use nomos_core::{da::blob, tx::Transaction};
use nomos_mempool::{network::adapters::libp2p::Libp2pAdapter, openapi::Status, MempoolMetrics};
use nomos_network::backends::libp2p::Libp2p;
use nomos_storage::backends::StorageSerde;
use overwatch_rs::overwatch::handle::OverwatchHandle;
use serde::{de::DeserializeOwned, Deserialize, Serialize};
use utoipa::OpenApi;
use utoipa_swagger_ui::SwaggerUi;

use crate::{
    http::{cl, consensus, da, libp2p, mempool, storage},
    Backend,
};

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, anything internally related to the project I think is better in internal:

  • consensus_engine
  • nomos_core
  • nomos_mempool
    etc

Overwatch can be kept in crates 👍

@al8n al8n merged commit ba90ed1 into master Nov 1, 2023
7 checks passed
@al8n al8n deleted the info-api branch November 1, 2023 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants