Skip to content

Commit

Permalink
chore: update dependencies (#476)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mirko-von-Leipzig authored Sep 1, 2024
1 parent 7180c57 commit 8dc465e
Show file tree
Hide file tree
Showing 25 changed files with 243 additions and 252 deletions.
243 changes: 144 additions & 99 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ miden-objects = { version = "0.5" }
miden-processor = { version = "0.10" }
miden-stdlib = { version = "0.10", default-features = false }
miden-tx = { version = "0.5" }
prost = { version = "0.13" }
thiserror = { version = "1.0" }
tonic = { version = "0.11" }
tonic = { version = "0.12" }
tracing = { version = "0.1" }
tracing-subscriber = { version = "0.3", features = ["fmt", "json", "env-filter"] }
1 change: 0 additions & 1 deletion crates/block-producer/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ miden-lib = { workspace = true, features = ["testing"] }
miden-node-test-macro = { path = "../test-macro" }
miden-objects = { workspace = true, features = ["testing"] }
miden-tx = { workspace = true, features = ["testing"] }
once_cell = { version = "1.18" }
rand_chacha = { version = "0.3", default-features = false }
tokio = { version = "1.38", features = ["test-util"] }
winterfell = { version = "0.9" }
7 changes: 3 additions & 4 deletions crates/block-producer/src/test_utils/account.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
use std::{collections::HashMap, ops::Not};
use std::{collections::HashMap, ops::Not, sync::LazyLock};

use miden_objects::{
accounts::{get_account_seed, AccountStorageType, AccountType},
Hasher,
};
use once_cell::sync::Lazy;

use super::*;

pub static MOCK_ACCOUNTS: Lazy<std::sync::Mutex<HashMap<u32, (AccountId, Digest)>>> =
Lazy::new(Default::default);
pub static MOCK_ACCOUNTS: LazyLock<std::sync::Mutex<HashMap<u32, (AccountId, Digest)>>> =
LazyLock::new(Default::default);

/// A mock representation fo private accounts. An account starts in state `states[0]`, is modified
/// to state `states[1]`, and so on.
Expand Down
10 changes: 5 additions & 5 deletions crates/proto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ repository.workspace = true
hex = { version = "0.4" }
miden-node-utils = { workspace = true }
miden-objects = { workspace = true }
prost = { version = "0.12" }
prost = { workspace = true }
thiserror = { workspace = true }
tonic = { workspace = true }

Expand All @@ -24,7 +24,7 @@ proptest = { version = "1.5" }

[build-dependencies]
miette = { version = "7.2", features = ["fancy"] }
prost = { version = "0.12" }
prost-build = { version = "0.12" }
protox = { version = "0.6" }
tonic-build = { version = "0.11" }
prost = { workspace = true }
prost-build = { version = "0.13" }
protox = { version = "0.7" }
tonic-build = { version = "0.12" }
2 changes: 1 addition & 1 deletion crates/proto/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::{
};

use miette::IntoDiagnostic;
use prost::Message;
use protox::prost::Message;

/// Generates Rust protobuf bindings from .proto files in the root directory.
///
Expand Down
1 change: 0 additions & 1 deletion crates/proto/src/domain/accounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,6 @@ impl TryFrom<AccountTransactionInputRecord> for AccountState {
fn try_from(from: AccountTransactionInputRecord) -> Result<Self, Self::Error> {
let account_id = from
.account_id
.clone()
.ok_or(AccountTransactionInputRecord::missing_field(stringify!(account_id)))?
.try_into()?;

Expand Down
2 changes: 1 addition & 1 deletion crates/proto/src/domain/blocks.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl TryFrom<&block::BlockHeader> for BlockHeader {
type Error = ConversionError;

fn try_from(value: &block::BlockHeader) -> Result<Self, Self::Error> {
value.clone().try_into()
value.try_into()
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/proto/src/domain/digest.rs
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,15 @@ impl TryFrom<&digest::Digest> for [Felt; 4] {
type Error = ConversionError;

fn try_from(value: &digest::Digest) -> Result<Self, Self::Error> {
value.clone().try_into()
value.try_into()
}
}

impl TryFrom<&digest::Digest> for Digest {
type Error = ConversionError;

fn try_from(value: &digest::Digest) -> Result<Self, Self::Error> {
value.clone().try_into()
value.try_into()
}
}

Expand Down
4 changes: 2 additions & 2 deletions crates/proto/src/generated/account.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[prost(skip_debug)]
pub struct AccountId {
/// A miden account is defined with a little bit of proof-of-work, the id itself is defined as
Expand All @@ -10,7 +10,7 @@ pub struct AccountId {
pub id: u64,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AccountSummary {
#[prost(message, optional, tag = "1")]
pub account_id: ::core::option::Option<AccountId>,
Expand Down
2 changes: 1 addition & 1 deletion crates/proto/src/generated/block.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct BlockHeader {
/// specifies the version of the protocol.
#[prost(uint32, tag = "1")]
Expand Down
47 changes: 19 additions & 28 deletions crates/proto/src/generated/block_producer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ pub mod api_client {
where
T: tonic::client::GrpcService<tonic::body::BoxBody>,
T::Error: Into<StdError>,
T::ResponseBody: Body<Data = Bytes> + Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + Send,
T::ResponseBody: Body<Data = Bytes> + std::marker::Send + 'static,
<T::ResponseBody as Body>::Error: Into<StdError> + std::marker::Send,
{
pub fn new(inner: T) -> Self {
let inner = tonic::client::Grpc::new(inner);
Expand All @@ -49,7 +49,7 @@ pub mod api_client {
>,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
>>::Error: Into<StdError> + std::marker::Send + std::marker::Sync,
{
ApiClient::new(InterceptedService::new(inner, interceptor))
}
Expand Down Expand Up @@ -121,7 +121,7 @@ pub mod api_server {
use tonic::codegen::*;
/// Generated trait containing gRPC methods that should be implemented for use with ApiServer.
#[async_trait]
pub trait Api: Send + Sync + 'static {
pub trait Api: std::marker::Send + std::marker::Sync + 'static {
async fn submit_proven_transaction(
&self,
request: tonic::Request<
Expand All @@ -133,20 +133,18 @@ pub mod api_server {
>;
}
#[derive(Debug)]
pub struct ApiServer<T: Api> {
inner: _Inner<T>,
pub struct ApiServer<T> {
inner: Arc<T>,
accept_compression_encodings: EnabledCompressionEncodings,
send_compression_encodings: EnabledCompressionEncodings,
max_decoding_message_size: Option<usize>,
max_encoding_message_size: Option<usize>,
}
struct _Inner<T>(Arc<T>);
impl<T: Api> ApiServer<T> {
impl<T> ApiServer<T> {
pub fn new(inner: T) -> Self {
Self::from_arc(Arc::new(inner))
}
pub fn from_arc(inner: Arc<T>) -> Self {
let inner = _Inner(inner);
Self {
inner,
accept_compression_encodings: Default::default(),
Expand Down Expand Up @@ -196,8 +194,8 @@ pub mod api_server {
impl<T, B> tonic::codegen::Service<http::Request<B>> for ApiServer<T>
where
T: Api,
B: Body + Send + 'static,
B::Error: Into<StdError> + Send + 'static,
B: Body + std::marker::Send + 'static,
B::Error: Into<StdError> + std::marker::Send + 'static,
{
type Response = http::Response<tonic::body::BoxBody>;
type Error = std::convert::Infallible;
Expand All @@ -209,7 +207,6 @@ pub mod api_server {
Poll::Ready(Ok(()))
}
fn call(&mut self, req: http::Request<B>) -> Self::Future {
let inner = self.inner.clone();
match req.uri().path() {
"/block_producer.Api/SubmitProvenTransaction" => {
#[allow(non_camel_case_types)]
Expand Down Expand Up @@ -243,7 +240,6 @@ pub mod api_server {
let max_encoding_message_size = self.max_encoding_message_size;
let inner = self.inner.clone();
let fut = async move {
let inner = inner.0;
let method = SubmitProvenTransactionSvc(inner);
let codec = tonic::codec::ProstCodec::default();
let mut grpc = tonic::server::Grpc::new(codec)
Expand All @@ -265,8 +261,11 @@ pub mod api_server {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.header("grpc-status", tonic::Code::Unimplemented as i32)
.header(
http::header::CONTENT_TYPE,
tonic::metadata::GRPC_CONTENT_TYPE,
)
.body(empty_body())
.unwrap(),
)
Expand All @@ -275,7 +274,7 @@ pub mod api_server {
}
}
}
impl<T: Api> Clone for ApiServer<T> {
impl<T> Clone for ApiServer<T> {
fn clone(&self) -> Self {
let inner = self.inner.clone();
Self {
Expand All @@ -287,17 +286,9 @@ pub mod api_server {
}
}
}
impl<T: Api> Clone for _Inner<T> {
fn clone(&self) -> Self {
Self(Arc::clone(&self.0))
}
}
impl<T: std::fmt::Debug> std::fmt::Debug for _Inner<T> {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{:?}", self.0)
}
}
impl<T: Api> tonic::server::NamedService for ApiServer<T> {
const NAME: &'static str = "block_producer.Api";
/// Generated gRPC service name
pub const SERVICE_NAME: &str = "block_producer.Api";
impl<T> tonic::server::NamedService for ApiServer<T> {
const NAME: &'static str = SERVICE_NAME;
}
}
2 changes: 1 addition & 1 deletion crates/proto/src/generated/digest.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// This file is @generated by prost-build.
/// A hash digest, the result of a hash function.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
#[prost(skip_debug)]
pub struct Digest {
#[prost(fixed64, tag = "1")]
Expand Down
2 changes: 1 addition & 1 deletion crates/proto/src/generated/note.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NoteMetadata {
#[prost(message, optional, tag = "1")]
pub sender: ::core::option::Option<super::account::AccountId>,
Expand Down
14 changes: 7 additions & 7 deletions crates/proto/src/generated/requests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub struct CheckNullifiersRequest {
///
/// The Merkle path is an MMR proof for the block's leaf, based on the current chain length.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetBlockHeaderByNumberRequest {
/// The block number of the target block.
///
Expand Down Expand Up @@ -127,24 +127,24 @@ pub struct GetNoteAuthenticationInfoRequest {
pub note_ids: ::prost::alloc::vec::Vec<super::digest::Digest>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ListNullifiersRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ListAccountsRequest {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ListNotesRequest {}
/// Returns the latest state of an account with the specified ID.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetAccountDetailsRequest {
/// Account ID to get details.
#[prost(message, optional, tag = "1")]
pub account_id: ::core::option::Option<super::account::AccountId>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetBlockByNumberRequest {
/// The block number of the target block.
#[prost(fixed32, tag = "1")]
Expand All @@ -153,7 +153,7 @@ pub struct GetBlockByNumberRequest {
/// Returns delta of the account states in the range from `from_block_num` (exclusive) to
/// `to_block_num` (inclusive).
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct GetAccountStateDeltaRequest {
/// ID of the account for which the delta is requested.
#[prost(message, optional, tag = "1")]
Expand Down
10 changes: 5 additions & 5 deletions crates/proto/src/generated/responses.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// This file is @generated by prost-build.
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct ApplyBlockResponse {}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
Expand Down Expand Up @@ -30,7 +30,7 @@ pub struct GetBlockHeaderByNumberResponse {
pub chain_length: ::core::option::Option<u32>,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NullifierUpdate {
#[prost(message, optional, tag = "1")]
pub nullifier: ::core::option::Option<super::digest::Digest>,
Expand Down Expand Up @@ -125,7 +125,7 @@ pub struct GetBlockInputsResponse {
}
/// An account returned as a response to the GetTransactionInputs
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct AccountTransactionInputRecord {
#[prost(message, optional, tag = "1")]
pub account_id: ::core::option::Option<super::account::AccountId>,
Expand All @@ -135,7 +135,7 @@ pub struct AccountTransactionInputRecord {
}
/// A nullifier returned as a response to the GetTransactionInputs
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct NullifierTransactionInputRecord {
#[prost(message, optional, tag = "1")]
pub nullifier: ::core::option::Option<super::digest::Digest>,
Expand All @@ -156,7 +156,7 @@ pub struct GetTransactionInputsResponse {
pub block_height: u32,
}
#[allow(clippy::derive_partial_eq_without_eq)]
#[derive(Clone, PartialEq, ::prost::Message)]
#[derive(Clone, Copy, PartialEq, ::prost::Message)]
pub struct SubmitProvenTransactionResponse {
/// The node's current block height
#[prost(fixed32, tag = "1")]
Expand Down
Loading

0 comments on commit 8dc465e

Please sign in to comment.