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

FPI: foreign account data loader #896

Merged
merged 26 commits into from
Oct 15, 2024
Merged
Show file tree
Hide file tree
Changes from 24 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
ec39abb
refactor: move new acct code hash to bookkeeping, update acct layout
Fumuran Sep 18, 2024
eaa0465
refactor: update names of constants, move storage slot info to even p…
Fumuran Sep 18, 2024
e865dac
refactor: move new acct code hash to bookkeeping, update acct layout
Fumuran Sep 18, 2024
a1d5eef
refactor: update names of constants, move storage slot info to even p…
Fumuran Sep 18, 2024
16ca9be
feat: impl execute_foreign_procedure tx proc
Fumuran Sep 19, 2024
1a1e711
refactor: update proc name, update proc comments
Fumuran Sep 20, 2024
0eb5df1
refactor: remove assert_native_account from api, small improvements
Fumuran Sep 23, 2024
a11c183
refactor: update api proc docs, add error code, add native account ch…
Fumuran Sep 24, 2024
02ba7d0
feat: impl foreign account data loader
Fumuran Sep 24, 2024
4f808d8
Merge branch 'next' into andrew-fpi-foreign-account-loader
Fumuran Sep 24, 2024
7ba702f
refactor: move validate procs from prologue to memory
Fumuran Sep 25, 2024
8013cf6
test: impl basic test, fix some bugs
Fumuran Sep 25, 2024
1972405
chore: update changelog, fix clippy errors
Fumuran Sep 25, 2024
b8baef7
test: implement main tests for execute_foreign_procedure, fix some bugs
Fumuran Sep 30, 2024
466910a
Merge branch 'next' into andrew-fpi-foreign-account-loader
Fumuran Sep 30, 2024
869e968
chore: fix fmt
Fumuran Sep 30, 2024
3c1582d
Merge branch 'next' into andrew-fpi-foreign-account-loader
Fumuran Oct 2, 2024
5a31101
refactor: add native id check, move helper procs to account.masm
Fumuran Oct 3, 2024
5acc13c
Merge branch 'next' into andrew-fpi-foreign-account-loader
Fumuran Oct 7, 2024
8331830
feat: implement verification of foreign account
Fumuran Oct 8, 2024
1408dfe
Merge branch 'next' into andrew-fpi-foreign-account-loader
Fumuran Oct 8, 2024
075bcb0
chore: fix formatting
Fumuran Oct 8, 2024
9f29675
refactor: skip formatting for tx_kernel_errors file
Fumuran Oct 9, 2024
d293ca0
chore: small fixes
Fumuran Oct 10, 2024
1ffdd3d
refactor: improve doc comments, other small fixes
Fumuran Oct 12, 2024
2fefa6d
chore: update constant name
Fumuran Oct 13, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
- Added `AccountStorageHeader` (#876).
- Implemented generation of transaction kernel procedure hashes in build.rs (#887).
- [BREAKING] `send_asset` procedure was removed from the basic wallet (#829).
- Implemented ability to invoke procedures against the foreign account (#882, #890, #896).
- [BREAKING] Updated limits, introduced additional limits (#889).
- Introduced `AccountDelta` maximum size limit of 32 KiB (#889).
- [BREAKING] Moved `MAX_NUM_FOREIGN_ACCOUNTS` into `miden-objects` (#904).
Expand Down
83 changes: 54 additions & 29 deletions bin/tx-prover/src/server/generated/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ pub struct ProveTransactionResponse {
/// Generated client implementations.
pub mod api_client {
#![allow(unused_variables, dead_code, missing_docs, clippy::let_unit_value)]
use tonic::codegen::{http::Uri, *};
use tonic::codegen::*;
use tonic::codegen::http::Uri;
#[derive(Debug, Clone)]
pub struct ApiClient<T> {
inner: tonic::client::Grpc<T>,
Expand Down Expand Up @@ -45,7 +46,10 @@ pub mod api_client {
let inner = tonic::client::Grpc::with_origin(inner, origin);
Self { inner }
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> ApiClient<InterceptedService<T, F>>
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> ApiClient<InterceptedService<T, F>>
where
F: tonic::service::Interceptor,
T::ResponseBody: Default,
Expand All @@ -55,8 +59,9 @@ pub mod api_client {
<T as tonic::client::GrpcService<tonic::body::BoxBody>>::ResponseBody,
>,
>,
<T as tonic::codegen::Service<http::Request<tonic::body::BoxBody>>>::Error:
Into<StdError> + Send + Sync,
<T as tonic::codegen::Service<
http::Request<tonic::body::BoxBody>,
>>::Error: Into<StdError> + Send + Sync,
{
ApiClient::new(InterceptedService::new(inner, interceptor))
}
Expand Down Expand Up @@ -94,14 +99,19 @@ pub mod api_client {
pub async fn prove_transaction(
&mut self,
request: impl tonic::IntoRequest<super::ProveTransactionRequest>,
) -> std::result::Result<tonic::Response<super::ProveTransactionResponse>, tonic::Status>
{
self.inner.ready().await.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
) -> std::result::Result<
tonic::Response<super::ProveTransactionResponse>,
tonic::Status,
> {
self.inner
.ready()
.await
.map_err(|e| {
tonic::Status::new(
tonic::Code::Unknown,
format!("Service was not ready: {}", e.into()),
)
})?;
let codec = tonic::codec::ProstCodec::default();
let path = http::uri::PathAndQuery::from_static("/api.Api/ProveTransaction");
let mut req = request.into_request();
Expand All @@ -120,7 +130,10 @@ pub mod api_server {
async fn prove_transaction(
&self,
request: tonic::Request<super::ProveTransactionRequest>,
) -> std::result::Result<tonic::Response<super::ProveTransactionResponse>, tonic::Status>;
) -> std::result::Result<
tonic::Response<super::ProveTransactionResponse>,
tonic::Status,
>;
}
#[derive(Debug)]
pub struct ApiServer<T: Api> {
Expand All @@ -145,7 +158,10 @@ pub mod api_server {
max_encoding_message_size: None,
}
}
pub fn with_interceptor<F>(inner: T, interceptor: F) -> InterceptedService<Self, F>
pub fn with_interceptor<F>(
inner: T,
interceptor: F,
) -> InterceptedService<Self, F>
where
F: tonic::service::Interceptor,
{
Expand Down Expand Up @@ -201,18 +217,23 @@ pub mod api_server {
"/api.Api/ProveTransaction" => {
#[allow(non_camel_case_types)]
struct ProveTransactionSvc<T: Api>(pub Arc<T>);
impl<T: Api> tonic::server::UnaryService<super::ProveTransactionRequest>
for ProveTransactionSvc<T>
{
impl<
T: Api,
> tonic::server::UnaryService<super::ProveTransactionRequest>
for ProveTransactionSvc<T> {
type Response = super::ProveTransactionResponse;
type Future = BoxFuture<tonic::Response<Self::Response>, tonic::Status>;
type Future = BoxFuture<
tonic::Response<Self::Response>,
tonic::Status,
>;
fn call(
&mut self,
request: tonic::Request<super::ProveTransactionRequest>,
) -> Self::Future {
let inner = Arc::clone(&self.0);
let fut =
async move { <T as Api>::prove_transaction(&inner, request).await };
let fut = async move {
<T as Api>::prove_transaction(&inner, request).await
};
Box::pin(fut)
}
}
Expand All @@ -238,15 +259,19 @@ pub mod api_server {
Ok(res)
};
Box::pin(fut)
},
_ => Box::pin(async move {
Ok(http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap())
}),
}
_ => {
Box::pin(async move {
Ok(
http::Response::builder()
.status(200)
.header("grpc-status", "12")
.header("content-type", "application/grpc")
.body(empty_body())
.unwrap(),
)
})
}
}
}
}
Expand Down
1 change: 1 addition & 0 deletions bin/tx-prover/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ use tokio::{net::TcpListener, sync::Mutex};
use tonic::{Request, Response, Status};
use tracing::info;

#[rustfmt::skip]
pub mod generated;

pub struct Rpc {
Expand Down
Loading
Loading