-
Notifications
You must be signed in to change notification settings - Fork 158
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
StackOutputs
: introduce pop_*()
methods
#1146
Conversation
I agree with the general sentiment of making it easier to access data from miden-vm/processor/src/stack/mod.rs Lines 155 to 179 in c097af7
|
@frisitano I added an alternative iterator-based implementation that doesn't require mutating let stack_outputs = StackOutputs::default();
let mut iter = stack_outputs.iter();
let root_1 = iter.next_digest()?;
let root_2 = iter.next_digest()?; In pub trait StackOutputsIteratorHeader {
fn next_header(&mut self) -> Option<BlockHeader>;
}
impl<I> StackOutputsIteratorHeader for I
where
I: StackOutputsIteratorDigest
{
fn next_header(&mut self) -> Option<BlockHeader> {
// ...
let account_root: Digest = iter.next_digest()?;
// ...
let block_num: Felt = iter.next()?;
// ...
}
} Converted PR to draft since one of the two alternatives would need to be removed. |
I think I still favour the public accessor methods that I referenced above over the iterator method. The reason I think this would be preferable is because we can have some centrally defined constants that define how to interpret the Additionally I don't think it should be the responsibility of |
The main issue I'm trying to solve is here in the block builder's component of the block producer. The problems I see:
This PR solves these problems by making the
That's fair; I agree that I should have made the method
This is a good point. If I understand your concerns correctly, I believe the following API would solve both our problems:
An adjustment I'd make to these constants is I would have them be indices in " What do you think? |
Of relevance to your work here I would point you to the
I agree with the sentiment here.
Yes this API is what I had in mind - somewhat similar to the
I think this is a good idea, it makes the API more flexible! I wonder why this wasn't done for the |
Oh yes, definitely. This would replace the
Opened #1153 I will implement an API along the lines of what was described here instead of what's currently in this PR. |
Closing in favor of #1155 |
This PR introduces methods to pop common types off
StackOutputs
.The main benefits are:
pop_digest()
StackOutputs
to pop their own typesFor example, in
miden-base
, we should add: