Skip to content

Commit

Permalink
fix: address suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
tomyrd committed Jul 26, 2024
1 parent 04c5890 commit a1b32b7
Show file tree
Hide file tree
Showing 12 changed files with 85 additions and 82 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

### Enhancements

- Added `CheckNullifiersByPrefix` endpoint (#419).
- [BREAKING] Configuration files with unknown properties are now rejected (#401).
- [BREAKING] Removed redundant node configuration properties (#401).
- Improve type safety of the transaction inputs nullifier mapping (#406).
- Embed the faucet's static website resources (#411).
- Added warning on CI for `CHANGELOG.md` (#413).
- Added `CheckNullifiersByPrefix` endpoint (#419).

## 0.4.0 (2024-07-04)

Expand Down
2 changes: 1 addition & 1 deletion crates/proto/src/generated/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ pub struct CheckNullifiersResponse {
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct CheckNullifiersByPrefixResponse {
/// List of nullifiers matching the 16-bit prefixes specified in the request.
/// List of nullifiers matching the prefixes specified in the request.
#[prost(message, repeated, tag = "1")]
pub nullifiers: ::prost::alloc::vec::Vec<NullifierUpdate>,
}
Expand Down
74 changes: 37 additions & 37 deletions crates/proto/src/generated/rpc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,13 +84,13 @@ pub mod api_client {
self.inner = self.inner.max_encoding_message_size(limit);
self
}
pub async fn check_nullifiers_by_prefix(
pub async fn check_nullifiers(
&mut self,
request: impl tonic::IntoRequest<
super::super::requests::CheckNullifiersByPrefixRequest,
super::super::requests::CheckNullifiersRequest,
>,
) -> std::result::Result<
tonic::Response<super::super::responses::CheckNullifiersByPrefixResponse>,
tonic::Response<super::super::responses::CheckNullifiersResponse>,
tonic::Status,
> {
self.inner
Expand All @@ -103,21 +103,18 @@ pub mod api_client {
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/rpc.Api/CheckNullifiersByPrefix",
);
let path = http::uri::PathAndQuery::from_static("/rpc.Api/CheckNullifiers");
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("rpc.Api", "CheckNullifiersByPrefix"));
req.extensions_mut().insert(GrpcMethod::new("rpc.Api", "CheckNullifiers"));
self.inner.unary(req, path, codec).await
}
pub async fn check_nullifiers(
pub async fn check_nullifiers_by_prefix(
&mut self,
request: impl tonic::IntoRequest<
super::super::requests::CheckNullifiersRequest,
super::super::requests::CheckNullifiersByPrefixRequest,
>,
) -> std::result::Result<
tonic::Response<super::super::responses::CheckNullifiersResponse>,
tonic::Response<super::super::responses::CheckNullifiersByPrefixResponse>,
tonic::Status,
> {
self.inner
Expand All @@ -130,9 +127,12 @@ pub mod api_client {
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/rpc.Api/CheckNullifiers");
let path = http::uri::PathAndQuery::from_static(
"/rpc.Api/CheckNullifiersByPrefix",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("rpc.Api", "CheckNullifiers"));
req.extensions_mut()
.insert(GrpcMethod::new("rpc.Api", "CheckNullifiersByPrefix"));
self.inner.unary(req, path, codec).await
}
pub async fn get_account_details(
Expand Down Expand Up @@ -292,6 +292,13 @@ pub mod api_server {
/// Generated trait containing gRPC methods that should be implemented for use with ApiServer.
#[async_trait]
pub trait Api: Send + Sync + 'static {
async fn check_nullifiers(
&self,
request: tonic::Request<super::super::requests::CheckNullifiersRequest>,
) -> std::result::Result<
tonic::Response<super::super::responses::CheckNullifiersResponse>,
tonic::Status,
>;
async fn check_nullifiers_by_prefix(
&self,
request: tonic::Request<
Expand All @@ -301,13 +308,6 @@ pub mod api_server {
tonic::Response<super::super::responses::CheckNullifiersByPrefixResponse>,
tonic::Status,
>;
async fn check_nullifiers(
&self,
request: tonic::Request<super::super::requests::CheckNullifiersRequest>,
) -> std::result::Result<
tonic::Response<super::super::responses::CheckNullifiersResponse>,
tonic::Status,
>;
async fn get_account_details(
&self,
request: tonic::Request<super::super::requests::GetAccountDetailsRequest>,
Expand Down Expand Up @@ -434,29 +434,28 @@ pub mod api_server {
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/rpc.Api/CheckNullifiersByPrefix" => {
"/rpc.Api/CheckNullifiers" => {
#[allow(non_camel_case_types)]
struct CheckNullifiersByPrefixSvc<T: Api>(pub Arc<T>);
struct CheckNullifiersSvc<T: Api>(pub Arc<T>);
impl<
T: Api,
> tonic::server::UnaryService<
super::super::requests::CheckNullifiersByPrefixRequest,
> for CheckNullifiersByPrefixSvc<T> {
type Response = super::super::responses::CheckNullifiersByPrefixResponse;
super::super::requests::CheckNullifiersRequest,
> for CheckNullifiersSvc<T> {
type Response = super::super::responses::CheckNullifiersResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::super::requests::CheckNullifiersByPrefixRequest,
super::super::requests::CheckNullifiersRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Api>::check_nullifiers_by_prefix(&inner, request)
.await
<T as Api>::check_nullifiers(&inner, request).await
};
Box::pin(fut)
}
Expand All @@ -468,7 +467,7 @@ pub mod api_server {
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = CheckNullifiersByPrefixSvc(inner);
let method = CheckNullifiersSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
Expand All @@ -484,28 +483,29 @@ pub mod api_server {
};
Box::pin(fut)
}
"/rpc.Api/CheckNullifiers" => {
"/rpc.Api/CheckNullifiersByPrefix" => {
#[allow(non_camel_case_types)]
struct CheckNullifiersSvc<T: Api>(pub Arc<T>);
struct CheckNullifiersByPrefixSvc<T: Api>(pub Arc<T>);
impl<
T: Api,
> tonic::server::UnaryService<
super::super::requests::CheckNullifiersRequest,
> for CheckNullifiersSvc<T> {
type Response = super::super::responses::CheckNullifiersResponse;
super::super::requests::CheckNullifiersByPrefixRequest,
> for CheckNullifiersByPrefixSvc<T> {
type Response = super::super::responses::CheckNullifiersByPrefixResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::super::requests::CheckNullifiersRequest,
super::super::requests::CheckNullifiersByPrefixRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Api>::check_nullifiers(&inner, request).await
<T as Api>::check_nullifiers_by_prefix(&inner, request)
.await
};
Box::pin(fut)
}
Expand All @@ -517,7 +517,7 @@ pub mod api_server {
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = CheckNullifiersSvc(inner);
let method = CheckNullifiersByPrefixSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
Expand Down
70 changes: 35 additions & 35 deletions crates/proto/src/generated/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,13 +106,13 @@ pub mod api_client {
req.extensions_mut().insert(GrpcMethod::new("store.Api", "ApplyBlock"));
self.inner.unary(req, path, codec).await
}
pub async fn check_nullifiers_by_prefix(
pub async fn check_nullifiers(
&mut self,
request: impl tonic::IntoRequest<
super::super::requests::CheckNullifiersByPrefixRequest,
super::super::requests::CheckNullifiersRequest,
>,
) -> std::result::Result<
tonic::Response<super::super::responses::CheckNullifiersByPrefixResponse>,
tonic::Response<super::super::responses::CheckNullifiersResponse>,
tonic::Status,
> {
self.inner
Expand All @@ -126,20 +126,19 @@ pub mod api_client {
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/store.Api/CheckNullifiersByPrefix",
"/store.Api/CheckNullifiers",
);
let mut req = request.into_request();
req.extensions_mut()
.insert(GrpcMethod::new("store.Api", "CheckNullifiersByPrefix"));
req.extensions_mut().insert(GrpcMethod::new("store.Api", "CheckNullifiers"));
self.inner.unary(req, path, codec).await
}
pub async fn check_nullifiers(
pub async fn check_nullifiers_by_prefix(
&mut self,
request: impl tonic::IntoRequest<
super::super::requests::CheckNullifiersRequest,
super::super::requests::CheckNullifiersByPrefixRequest,
>,
) -> std::result::Result<
tonic::Response<super::super::responses::CheckNullifiersResponse>,
tonic::Response<super::super::responses::CheckNullifiersByPrefixResponse>,
tonic::Status,
> {
self.inner
Expand All @@ -153,10 +152,11 @@ pub mod api_client {
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static(
"/store.Api/CheckNullifiers",
"/store.Api/CheckNullifiersByPrefix",
);
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("store.Api", "CheckNullifiers"));
req.extensions_mut()
.insert(GrpcMethod::new("store.Api", "CheckNullifiersByPrefix"));
self.inner.unary(req, path, codec).await
}
pub async fn get_account_details(
Expand Down Expand Up @@ -419,6 +419,13 @@ pub mod api_server {
tonic::Response<super::super::responses::ApplyBlockResponse>,
tonic::Status,
>;
async fn check_nullifiers(
&self,
request: tonic::Request<super::super::requests::CheckNullifiersRequest>,
) -> std::result::Result<
tonic::Response<super::super::responses::CheckNullifiersResponse>,
tonic::Status,
>;
async fn check_nullifiers_by_prefix(
&self,
request: tonic::Request<
Expand All @@ -428,13 +435,6 @@ pub mod api_server {
tonic::Response<super::super::responses::CheckNullifiersByPrefixResponse>,
tonic::Status,
>;
async fn check_nullifiers(
&self,
request: tonic::Request<super::super::requests::CheckNullifiersRequest>,
) -> std::result::Result<
tonic::Response<super::super::responses::CheckNullifiersResponse>,
tonic::Status,
>;
async fn get_account_details(
&self,
request: tonic::Request<super::super::requests::GetAccountDetailsRequest>,
Expand Down Expand Up @@ -636,29 +636,28 @@ pub mod api_server {
};
Box::pin(fut)
}
"/store.Api/CheckNullifiersByPrefix" => {
"/store.Api/CheckNullifiers" => {
#[allow(non_camel_case_types)]
struct CheckNullifiersByPrefixSvc<T: Api>(pub Arc<T>);
struct CheckNullifiersSvc<T: Api>(pub Arc<T>);
impl<
T: Api,
> tonic::server::UnaryService<
super::super::requests::CheckNullifiersByPrefixRequest,
> for CheckNullifiersByPrefixSvc<T> {
type Response = super::super::responses::CheckNullifiersByPrefixResponse;
super::super::requests::CheckNullifiersRequest,
> for CheckNullifiersSvc<T> {
type Response = super::super::responses::CheckNullifiersResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::super::requests::CheckNullifiersByPrefixRequest,
super::super::requests::CheckNullifiersRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Api>::check_nullifiers_by_prefix(&inner, request)
.await
<T as Api>::check_nullifiers(&inner, request).await
};
Box::pin(fut)
}
Expand All @@ -670,7 +669,7 @@ pub mod api_server {
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = CheckNullifiersByPrefixSvc(inner);
let method = CheckNullifiersSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
Expand All @@ -686,28 +685,29 @@ pub mod api_server {
};
Box::pin(fut)
}
"/store.Api/CheckNullifiers" => {
"/store.Api/CheckNullifiersByPrefix" => {
#[allow(non_camel_case_types)]
struct CheckNullifiersSvc<T: Api>(pub Arc<T>);
struct CheckNullifiersByPrefixSvc<T: Api>(pub Arc<T>);
impl<
T: Api,
> tonic::server::UnaryService<
super::super::requests::CheckNullifiersRequest,
> for CheckNullifiersSvc<T> {
type Response = super::super::responses::CheckNullifiersResponse;
super::super::requests::CheckNullifiersByPrefixRequest,
> for CheckNullifiersByPrefixSvc<T> {
type Response = super::super::responses::CheckNullifiersByPrefixResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::super::requests::CheckNullifiersRequest,
super::super::requests::CheckNullifiersByPrefixRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Api>::check_nullifiers(&inner, request).await
<T as Api>::check_nullifiers_by_prefix(&inner, request)
.await
};
Box::pin(fut)
}
Expand All @@ -719,7 +719,7 @@ pub mod api_server {
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = CheckNullifiersSvc(inner);
let method = CheckNullifiersByPrefixSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-proto/proto/responses.proto
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ message CheckNullifiersResponse {
}

message CheckNullifiersByPrefixResponse {
// List of nullifiers matching the 16-bit prefixes specified in the request.
// List of nullifiers matching the prefixes specified in the request.
repeated NullifierUpdate nullifiers = 1;
}

Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-proto/proto/rpc.proto
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import "requests.proto";
import "responses.proto";

service Api {
rpc CheckNullifiersByPrefix(requests.CheckNullifiersByPrefixRequest) returns (responses.CheckNullifiersByPrefixResponse) {}
rpc CheckNullifiers(requests.CheckNullifiersRequest) returns (responses.CheckNullifiersResponse) {}
rpc CheckNullifiersByPrefix(requests.CheckNullifiersByPrefixRequest) returns (responses.CheckNullifiersByPrefixResponse) {}
rpc GetAccountDetails(requests.GetAccountDetailsRequest) returns (responses.GetAccountDetailsResponse) {}
rpc GetBlockByNumber(requests.GetBlockByNumberRequest) returns (responses.GetBlockByNumberResponse) {}
rpc GetBlockHeaderByNumber(requests.GetBlockHeaderByNumberRequest) returns (responses.GetBlockHeaderByNumberResponse) {}
Expand Down
Loading

0 comments on commit a1b32b7

Please sign in to comment.