chore: switch back protocol dep to git next#2282
Conversation
|
Thanks! Will begin reviewing. There are a handful of open PRs that I would like to squeeze in before merging this one. |
No hurries, I'm also planning on taking a look soon. Thanks! |
igamigo
left a comment
There was a problem hiding this comment.
Not a full review, but I got through most of the non-test code
…rotocol # Conflicts: # crates/rpc/src/server/api/submit_proven_tx_batch.rs
igamigo
left a comment
There was a problem hiding this comment.
LGTM, thanks! I left some comments, most of which are quite minor. I think the only real question I have is related to how we fetch (and potentially reconstruct to insert to cache) the account vault details.
| .expect("wallet tx only writes existing value slots"); | ||
| } | ||
| let new_nonce = wallet.nonce() + account_delta.nonce_delta(); | ||
| let new_nonce = account_patch.final_nonce().unwrap_or_else(|| wallet.nonce()); |
There was a problem hiding this comment.
I think we could expect() here, instead of defaulting to the preivous nonce. If the transaction succeeded, the nonce should have been updated and if it's not, it'd be signaling a problem.
There was a problem hiding this comment.
Marking as resolved as it was superseeded by the other comment
There was a problem hiding this comment.
Actually looking at this could we not do wallet.apply_patch() directly?
| storage_update: Option<(BenchmarkStorageUpdate, usize)>, | ||
| ) -> AccountDelta { | ||
| let mut vault_delta = AccountVaultDelta::default(); | ||
| ) -> AccountPatch { |
There was a problem hiding this comment.
I think we can do AccountPatch::try_from here
There was a problem hiding this comment.
I'm not sure I'm following correctly, but building an AccountPatch from the received Account would imply converting the full account into a patch (note that it also requires cloning it), when in reality we only want to create a patch with a subset of its vault/storage, only the modified ones.
| }, | ||
| #[error("transaction proof verification failed")] | ||
| ProofVerificationFailed(#[from] miden_tx::TransactionVerifierError), | ||
| ProofVerificationFailed(#[from] miden_protocol::errors::TransactionVerifierError), |
There was a problem hiding this comment.
nit: We can import the TransactionVerifierError
There was a problem hiding this comment.
Added the error as an import in 05e49d5
|
|
||
| /// Process wallet assets and return them as a fungible asset delta. Track the negative adjustments | ||
| /// for the respective faucets. | ||
| fn prepare_fungible_asset_update( |
There was a problem hiding this comment.
I could be wrong but it seems some of this setup could potentially be simplified with the delta to patch migration
| self.forest | ||
| .write() | ||
| .await | ||
| .cache_vault_keys(assets.iter().map(miden_protocol::asset::Asset::vault_key)); |
There was a problem hiding this comment.
I think we may only want to cache here if the details are not in the "too many entries" category (this is what the storage map flow does, AFAIK)
There was a problem hiding this comment.
Overall though, I may be missing something but these functions (both the new one and the previously-existing one related to storage maps) seem to be doing unnecessary work: they may be reading the whole set of key/values to just return LimitExceeded. cc @Mirko-von-Leipzig
There was a problem hiding this comment.
Somewhat addressed in 4d249bc
The query now runs with a LIMIT of AccountVaultDetails::MAX_RETURN_ENTRIES + 1 so then we can simply check with:
if assets.len() > AccountVaultDetails::MAX_RETURN_ENTRIES {
return Ok(AccountVaultDetails::LimitExceeded);
}This way we prevent fetching an excesive amount of entries in cases we now we will end up returning that enum variant.
SantiagoPittella
left a comment
There was a problem hiding this comment.
It's looking good in general. Added some nits. Also lets ensure addressing Ignacio's comments + a search of "delta" throughout the repository since I think there are a couple places that still reference the old name
| // build_rs::output::rerun_if_changed("./proto"); | ||
| // build_rs::output::rerun_if_changed("Cargo.toml"); |
There was a problem hiding this comment.
Is the removal of these intentional?
There was a problem hiding this comment.
Reverted in 315edbd, see the other comment for details.
kkovaacs
left a comment
There was a problem hiding this comment.
Looks good to me, thank you!
Summary
Switch back miden protocol dependency from crates.io to github's
nextbranch. Unsure if this is something to have addressed now, the main goal of the PR is to apply most recent changes of protocol as soon as possible on the miden-client.Changelog
Most notable changes are
Deltastorages being replaced byPatch, and the removal of thefeefield from transactions (to be replaced by batched fees).