-
Notifications
You must be signed in to change notification settings - Fork 35
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
docs: Introduce top-level module docs for Rust client crate #683
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, it is really nice to have.
I left some comments about typos.
…into igamigo-top-level-docs
…Miden/miden-client into igamigo-top-level-docs
…into igamigo-top-level-docs
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looks good. Not a full review, but I left some comments inline.
crates/rust-client/src/store/note_record/input_note_record/mod.rs
Outdated
Show resolved
Hide resolved
...rust-client/src/store/note_record/input_note_record/states/consumed_unauthenticated_local.rs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you! I left some more comments inline - most are pretty minor.
One other comment: I noticed that assets
module is still using plural rather than singular name. We should probably rename it to just asset
.
crates/rust-client/src/store/note_record/input_note_record/states/mod.rs
Outdated
Show resolved
Hide resolved
I think I got all suggestions in. One thing (only very marginally related to this) is that currently both |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you! Looks good. I left a few more comments inline. Also, the comment about asset
vs assets
from #683 (review) still needs to be addressed.
One thing (only very marginally related to this) is that currently both
web-tonic
andtonic
features imply most of the same dependencies (tonic
,prost
,hex
). I think this was because of the assumption that one of them would always be enabled. We could take theoptional = true
so it can be compiled with no features without errors. Otherwise, because thedomain
module ends up referencing RPC structs and these haveprost
types, it fails to compile unless one of those features is active (which I think you suggested we might want anyway but I think I'd prefer it to work anyway).
This makes sense - but we could also do it in a different PR.
docs/library.md
Outdated
let client: Client<RpoRandomCoin> = { | ||
// Create the SQLite store from the client configuration. | ||
let sqlite_store = SqliteStore::new("path/to/store".try_into()?).await?; | ||
let store = Arc::new(sqlite_store); | ||
// Generate a random seed for the RpoRandomCoin. | ||
let mut rng = rand::thread_rng(); | ||
let coin_seed: [u64; 4] = rng.gen(); | ||
// Initialize the random coin using the generated seed. | ||
let rng = RpoRandomCoin::new(coin_seed.map(Felt::new)); | ||
// Create a store authenticator with the store and random coin. | ||
let authenticator = StoreAuthenticator::new_with_rng(store.clone(), rng); | ||
// Instantiate the client using a Tonic RPC client | ||
let endpoint = Endpoint::new("https".into(), "localhost".into(), Some(57291)); | ||
Client::new( | ||
Box::new(TonicRpcClient::new(endpoint, 10_000)), | ||
rng, | ||
store, | ||
Arc::new(authenticator), | ||
false, // Set to true for debug mode, if needed. | ||
) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: we can probably reduce the indentation here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the indentation here can still be reduced.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! Thank you! I left just one small nit inline.
docs/library.md
Outdated
let client: Client<RpoRandomCoin> = { | ||
// Create the SQLite store from the client configuration. | ||
let sqlite_store = SqliteStore::new("path/to/store".try_into()?).await?; | ||
let store = Arc::new(sqlite_store); | ||
// Generate a random seed for the RpoRandomCoin. | ||
let mut rng = rand::thread_rng(); | ||
let coin_seed: [u64; 4] = rng.gen(); | ||
// Initialize the random coin using the generated seed. | ||
let rng = RpoRandomCoin::new(coin_seed.map(Felt::new)); | ||
// Create a store authenticator with the store and random coin. | ||
let authenticator = StoreAuthenticator::new_with_rng(store.clone(), rng); | ||
// Instantiate the client using a Tonic RPC client | ||
let endpoint = Endpoint::new("https".into(), "localhost".into(), Some(57291)); | ||
Client::new( | ||
Box::new(TonicRpcClient::new(endpoint, 10_000)), | ||
rng, | ||
store, | ||
Arc::new(authenticator), | ||
false, // Set to true for debug mode, if needed. | ||
) | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the indentation here can still be reduced.
Best way to test this might be to pull the branch and
cargo doc --features tonic,sqlite
and browse the outputCloses #453