-
Notifications
You must be signed in to change notification settings - Fork 39
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
Connect 4 nodes in block-producer, and create miden-node
binary
#85
Conversation
miden-node
binary
block-producer/src/server/api.rs
Outdated
.map(|(account_id, account_hash)| AccountUpdate { | ||
account_id: Some((*account_id).into()), | ||
account_hash: Some(account_hash.into()), | ||
}) |
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.
suggestions:
- add
impl From<Account> for AccountUpdate
as a conversion. - use
convert
should make the code a bit cleaner
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.
changed all of them to use convert
, and created #99 to address the clone
s
let nullifiers = { | ||
let mut nullifiers = Vec::new(); | ||
|
||
for nullifier_record in response.nullifiers { | ||
let nullifier = nullifier_record | ||
.nullifier | ||
.ok_or(TxInputsError::MalformedResponse( | ||
"nullifier record contains empty nullifier".to_string(), | ||
))? | ||
.try_into()?; | ||
|
||
// `block_num` is nonzero if already consumed; 0 otherwise | ||
nullifiers.push((nullifier, nullifier_record.block_num != 0)) | ||
} | ||
|
||
nullifiers.into_iter().collect() | ||
}; |
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.
maybe this can be replaced with try_convert
?
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 cannot use try_convert
because I cannot implement TryFrom<NullifierTransactionInputRecord> for (RpoDigest, bool)
where Error = TxInputsError
, since TxInputsError
lives in miden-node-block-producer
(and our conversion code lives in miden-node-proto
).
Related: #74 (comment)
c6cc90c
to
7b1e2e3
Compare
This reverts commit 38c19ce.
`deadpool`'s method `interact` is blocking, it waits for the closure to complete its execution before returning. This causes a deadlock, because of the way state synchronization is performed in the store server. In the store, the transaction is opened and data is written to the WAL file, but not immedially committed. Before comiting the data, the in-memory datastructures prevent read operations. This meanst the server has to acquire the exclusive write lock. This operation demands concurrency and synchronization among the DB and state components. This required a change from a blocking to a concurrent API. `deadpool` doesn't seem to have a native concurrent API, so a async task was used instead. `tokio` does not support scoped tasks, so thread local state can not be used across tasks, for this reason all the data was modified from being borrowed to being owned, so that the data can be moved in to the async task.
…ode into plafer-start-node
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 a few comments inline - most of them are pretty small.
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 minor nit inline.
block-producer/src/lib.rs
Outdated
/// The depth of the SMT for created notes | ||
pub(crate) const CREATED_NOTES_SMT_DEPTH: u8 = 13; | ||
|
||
/// The maximum number of created notes per batch. | ||
/// | ||
/// The created notes tree uses an extra depth to store the 2 components of `NoteEnvelope`. | ||
/// That is, conceptually, notes sit at depth 12; where in reality, depth 12 contains the | ||
/// hash of level 13, where both the `note_hash()` and metadata are stored (one per node). | ||
pub(crate) const MAX_NUM_CREATED_NOTES_PER_BATCH: usize = | ||
2_usize.pow((CREATED_NOTES_SMT_DEPTH - 1) as u32); | ||
|
||
/// The number of transactions per batch | ||
pub(crate) const SERVER_BATCH_SIZE: usize = 2; | ||
|
||
/// The frequency at which blocks are produced | ||
pub(crate) const SERVER_BLOCK_FREQUENCY: Duration = Duration::from_secs(10); | ||
|
||
/// The frequency at which batches are built | ||
pub(crate) const SERVER_BUILD_BATCH_FREQUENCY: Duration = Duration::from_secs(2); | ||
|
||
/// Maximum number of batches per block | ||
pub(crate) const SERVER_MAX_BATCHES_PER_BLOCK: usize = 4; |
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: since these are now in lib.rs
, I think we should be able to get rid of pub(crate)
modifier.
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.
done
Closes #17
Closes #42
Noteworthy changes/decisions:
BlockHeader
as the "genesis header"