Chore: update miden-protocol#2095
Conversation
13a8bfe to
4ce77a3
Compare
4ce77a3 to
fbd4960
Compare
igamigo
left a comment
There was a problem hiding this comment.
Mostly looks good, leaving some comments
| let counter_account = AccountBuilder::new(init_seed) | ||
| .account_type(AccountType::RegularAccountUpdatableCode) | ||
| .storage_mode(AccountStorageMode::Network) | ||
| .storage_mode(AccountStorageMode::Public) | ||
| .with_component(account_code) | ||
| .with_auth_component(incr_nonce_auth) | ||
| .build()?; |
There was a problem hiding this comment.
Not sure but I think we will need to add the NetworkNoteAllowList component here. But I think we can fix the network monitor separately if necessary cc @SantiagoPittella
There was a problem hiding this comment.
Yes to both, we will need that and I can tackle it in another PR.
| // Only treat full-state creations as network if the storage carries the | ||
| // standardized `NetworkAccountNoteAllowlist` slot. | ||
| let account = Account::try_from(update) | ||
| .expect("Account should be derivable by full state AccountDelta"); | ||
| if account.is_public() | ||
| && NetworkAccountNoteAllowlist::try_from(account.storage()).is_ok() | ||
| { | ||
| Some(NetworkAccountEffect::Created(account)) | ||
| } else { | ||
| None | ||
| } |
There was a problem hiding this comment.
I think there's the NetworkAccount wrapper we can use here
| AccountUpdateDetails::Delta(update) => { | ||
| // Partial updates carry no storage we can inspect here. Forward them as updates and | ||
| // let the coordinator's actor registry filter to known network accounts. | ||
| Some(NetworkAccountEffect::Updated(update.clone())) | ||
| }, |
There was a problem hiding this comment.
Seems like, from an account delta, we can no longer know whether it belongs to a network account. Is this right @PhilippGackstatter? Then this will likely need some refactoring on the NTX builder side because I think we expect to have the account in the builder if we receive a delta. But I think some of this was being refactored anyway (cc @Mirko-von-Leipzig @SantiagoPittella)
There was a problem hiding this comment.
Hmm, the block subscription approach will use partial accounts
| && let Ok(account) = Account::try_from(delta) | ||
| && account.is_public() | ||
| && NetworkAccountNoteAllowlist::try_from(account.storage()).is_ok() |
There was a problem hiding this comment.
Similarly here we should be able to use tjhe NetworkAccount wrapper
| let response = self | ||
| .store | ||
| .clone() | ||
| .are_network_accounts(tonic::Request::new(proto::account::AccountIdList { | ||
| account_ids: vec![tx.account_id().into()], | ||
| })) | ||
| .await | ||
| .map_err(|err| { | ||
| Status::internal(format!("network-account classification failed: {err}")) | ||
| })?; |
There was a problem hiding this comment.
We probably want to cache new account IDs that belong to network accounts in memory as a future enhancement here
| .map_err(DatabaseError::from) | ||
| } | ||
|
|
||
| /// Returns the subset of `account_ids` whose latest committed state is a network account. |
There was a problem hiding this comment.
I think for now we can assume that network accounts will either be network accounts forever or not (because right now changing account code and adding/removing components is not supported).
| if account.is_public() | ||
| && NetworkAccountNoteAllowlist::try_from(account.storage()).is_ok() |
There was a problem hiding this comment.
Here too we should be able to use hte NetworkAccount wrapper
| StorageMode::Network => AccountStorageMode::Network, | ||
| // Network accounts must be public in the new protocol model; the network-ness is | ||
| // determined by the standardized `NetworkAccountNoteAllowlist` slot in storage. | ||
| StorageMode::Network | StorageMode::Public => AccountStorageMode::Public, |
There was a problem hiding this comment.
We can probably remove the Network storage mode?
# Conflicts: # crates/rpc/src/tests.rs
No description provided.