Skip to content

Commit

Permalink
feat(store): remove testing endpoints (0xPolygonMiden#608)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirko-von-Leipzig authored Jan 13, 2025
1 parent ecacf1c commit ef07bbc
Show file tree
Hide file tree
Showing 15 changed files with 5 additions and 436 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
- Standardized protobuf type aliases (#609).
- [BREAKING] Added support for new two `Felt` account ID (#591).
- [BREAKING] Inverted `TransactionInputs.missing_unauthenticated_notes` to `found_missing_notes` (#509).
- [BREAKING] Remove store's `ListXXX` endpoints which were intended for test purposes (#608).

## v0.6.0 (2024-11-05)

Expand Down
6 changes: 0 additions & 6 deletions crates/proto/src/generated/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,6 @@ pub struct GetNoteAuthenticationInfoRequest {
#[prost(message, repeated, tag = "1")]
pub note_ids: ::prost::alloc::vec::Vec<super::digest::Digest>,
}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ListNullifiersRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ListAccountsRequest {}
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ListNotesRequest {}
/// Returns the latest state of an account with the specified ID.
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAccountDetailsRequest {
Expand Down
18 changes: 0 additions & 18 deletions crates/proto/src/generated/responses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,24 +160,6 @@ pub struct GetNoteAuthenticationInfoResponse {
pub proofs: ::core::option::Option<super::note::NoteAuthenticationInfo>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListNullifiersResponse {
/// Lists all nullifiers of the current chain
#[prost(message, repeated, tag = "1")]
pub nullifiers: ::prost::alloc::vec::Vec<super::smt::SmtLeafEntry>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListAccountsResponse {
/// Lists all accounts of the current chain
#[prost(message, repeated, tag = "1")]
pub accounts: ::prost::alloc::vec::Vec<super::account::AccountInfo>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct ListNotesResponse {
/// Lists all notes of the current chain
#[prost(message, repeated, tag = "1")]
pub notes: ::prost::alloc::vec::Vec<super::note::Note>,
}
#[derive(Clone, PartialEq, ::prost::Message)]
pub struct GetAccountDetailsResponse {
/// Account info (with details for public accounts)
#[prost(message, optional, tag = "1")]
Expand Down
230 changes: 0 additions & 230 deletions crates/proto/src/generated/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -388,71 +388,6 @@ pub mod api_client {
.insert(GrpcMethod::new("store.Api", "GetTransactionInputs"));
self.inner.unary(req, path, codec).await
}
pub async fn list_accounts(
&mut self,
request: impl tonic::IntoRequest<super::super::requests::ListAccountsRequest>,
) -> std::result::Result<
tonic::Response<super::super::responses::ListAccountsResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/store.Api/ListAccounts");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("store.Api", "ListAccounts"));
self.inner.unary(req, path, codec).await
}
pub async fn list_notes(
&mut self,
request: impl tonic::IntoRequest<super::super::requests::ListNotesRequest>,
) -> std::result::Result<
tonic::Response<super::super::responses::ListNotesResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/store.Api/ListNotes");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("store.Api", "ListNotes"));
self.inner.unary(req, path, codec).await
}
pub async fn list_nullifiers(
&mut self,
request: impl tonic::IntoRequest<
super::super::requests::ListNullifiersRequest,
>,
) -> std::result::Result<
tonic::Response<super::super::responses::ListNullifiersResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::unknown(
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/store.Api/ListNullifiers");
let mut req = request.into_request();
req.extensions_mut().insert(GrpcMethod::new("store.Api", "ListNullifiers"));
self.inner.unary(req, path, codec).await
}
pub async fn sync_notes(
&mut self,
request: impl tonic::IntoRequest<super::super::requests::SyncNoteRequest>,
Expand Down Expand Up @@ -600,27 +535,6 @@ pub mod api_server {
tonic::Response<super::super::responses::GetTransactionInputsResponse>,
tonic::Status,
>;
async fn list_accounts(
&self,
request: tonic::Request<super::super::requests::ListAccountsRequest>,
) -> std::result::Result<
tonic::Response<super::super::responses::ListAccountsResponse>,
tonic::Status,
>;
async fn list_notes(
&self,
request: tonic::Request<super::super::requests::ListNotesRequest>,
) -> std::result::Result<
tonic::Response<super::super::responses::ListNotesResponse>,
tonic::Status,
>;
async fn list_nullifiers(
&self,
request: tonic::Request<super::super::requests::ListNullifiersRequest>,
) -> std::result::Result<
tonic::Response<super::super::responses::ListNullifiersResponse>,
tonic::Status,
>;
async fn sync_notes(
&self,
request: tonic::Request<super::super::requests::SyncNoteRequest>,
Expand Down Expand Up @@ -1291,150 +1205,6 @@ pub mod api_server {
};
Box::pin(fut)
}
"/store.Api/ListAccounts" => {
#[allow(non_camel_case_types)]
struct ListAccountsSvc<T: Api>(pub Arc<T>);
impl<
T: Api,
> tonic::server::UnaryService<
super::super::requests::ListAccountsRequest,
> for ListAccountsSvc<T> {
type Response = super::super::responses::ListAccountsResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::super::requests::ListAccountsRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Api>::list_accounts(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListAccountsSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/store.Api/ListNotes" => {
#[allow(non_camel_case_types)]
struct ListNotesSvc<T: Api>(pub Arc<T>);
impl<
T: Api,
> tonic::server::UnaryService<
super::super::requests::ListNotesRequest,
> for ListNotesSvc<T> {
type Response = super::super::responses::ListNotesResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::super::requests::ListNotesRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Api>::list_notes(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListNotesSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/store.Api/ListNullifiers" => {
#[allow(non_camel_case_types)]
struct ListNullifiersSvc<T: Api>(pub Arc<T>);
impl<
T: Api,
> tonic::server::UnaryService<
super::super::requests::ListNullifiersRequest,
> for ListNullifiersSvc<T> {
type Response = super::super::responses::ListNullifiersResponse;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<
super::super::requests::ListNullifiersRequest,
>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut = async move {
<T as Api>::list_nullifiers(&inner, request).await
};
Box::pin(fut)
}
}
let accept_compression_encodings = self.accept_compression_encodings;
let send_compression_encodings = self.send_compression_encodings;
let max_decoding_message_size = self.max_decoding_message_size;
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let method = ListNullifiersSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
.apply_compression_config(
accept_compression_encodings,
send_compression_encodings,
)
.apply_max_message_size_config(
max_decoding_message_size,
max_encoding_message_size,
);
let res = grpc.unary(method, req).await;
Ok(res)
};
Box::pin(fut)
}
"/store.Api/SyncNotes" => {
#[allow(non_camel_case_types)]
struct SyncNotesSvc<T: Api>(pub Arc<T>);
Expand Down
6 changes: 0 additions & 6 deletions crates/rpc-proto/proto/requests.proto
Original file line number Diff line number Diff line change
Expand Up @@ -104,12 +104,6 @@ message GetNoteAuthenticationInfoRequest {
repeated digest.Digest note_ids = 1;
}

message ListNullifiersRequest {}

message ListAccountsRequest {}

message ListNotesRequest {}

// Returns the latest state of an account with the specified ID.
message GetAccountDetailsRequest {
// Account ID to get details.
Expand Down
15 changes: 0 additions & 15 deletions crates/rpc-proto/proto/responses.proto
Original file line number Diff line number Diff line change
Expand Up @@ -144,21 +144,6 @@ message GetNoteAuthenticationInfoResponse {
note.NoteAuthenticationInfo proofs = 1;
}

message ListNullifiersResponse {
// Lists all nullifiers of the current chain
repeated smt.SmtLeafEntry nullifiers = 1;
}

message ListAccountsResponse {
// Lists all accounts of the current chain
repeated account.AccountInfo accounts = 1;
}

message ListNotesResponse {
// Lists all notes of the current chain
repeated note.Note notes = 1;
}

message GetAccountDetailsResponse {
// Account info (with details for public accounts)
account.AccountInfo details = 1;
Expand Down
3 changes: 0 additions & 3 deletions crates/rpc-proto/proto/store.proto
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ service Api {
rpc GetNoteAuthenticationInfo(requests.GetNoteAuthenticationInfoRequest) returns (responses.GetNoteAuthenticationInfoResponse) {}
rpc GetNotesById(requests.GetNotesByIdRequest) returns (responses.GetNotesByIdResponse) {}
rpc GetTransactionInputs(requests.GetTransactionInputsRequest) returns (responses.GetTransactionInputsResponse) {}
rpc ListAccounts(requests.ListAccountsRequest) returns (responses.ListAccountsResponse) {}
rpc ListNotes(requests.ListNotesRequest) returns (responses.ListNotesResponse) {}
rpc ListNullifiers(requests.ListNullifiersRequest) returns (responses.ListNullifiersResponse) {}
rpc SyncNotes(requests.SyncNoteRequest) returns (responses.SyncNoteResponse) {}
rpc SyncState(requests.SyncStateRequest) returns (responses.SyncStateResponse) {}
}
38 changes: 0 additions & 38 deletions crates/store/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,44 +157,6 @@ contains excessive notes and nullifiers, client can make additional filtering of
- `nullifiers`: `[NullifierUpdate]` – a list of nullifiers created between `request.block_num + 1` and `response.block_header.block_num`.
- Each `NullifierUpdate` consists of the `nullifier` and `block_num` the block number in which the note corresponding to that nullifier was consumed.

## Methods for testing purposes

### ListNullifiers

Lists all nullifiers of the current chain.

**Parameters**

This request doesn't have any parameters.

**Returns**

- `nullifiers`: `[NullifierLeaf]` – lists of all nullifiers of the current chain.

### ListAccounts

Lists all accounts of the current chain.

**Parameters**

This request doesn't have any parameters.

**Returns**

- `accounts`: `[AccountInfo]` – list of all accounts of the current chain.

### ListNotes

Lists all notes of the current chain.

**Parameters**

This request doesn't have any parameters.

**Returns**

- `notes`: `[Note]` – list of all notes of the current chain.

## License

This project is [MIT licensed](../../LICENSE).
Loading

0 comments on commit ef07bbc

Please sign in to comment.