-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Fix deserialization of authorizations with multiple transitions #2479
base: staging
Are you sure you want to change the base?
Conversation
Great find!
Yes please. You can see some recent examples of adjusted tests in |
@vicsn this is good for another pass! added unit tests |
// Ensure the requests and transitions are in order. | ||
for (index, (request, transition)) in requests.iter().zip_eq(&transitions).enumerate() { | ||
for (index, (request, transition)) in requests_deque.iter().zip_eq(&transitions).enumerate() { |
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'm not yet familiar with the full context behind this change (it's rather odd these are not ordered the same way by default) but just looking at the rust, you could probably do something like this to avoid building a second VecDeque
and calling clone
, pop
and insert
:
for (index, (request, transition)) in requests_deque.iter().zip_eq(&transitions).enumerate() { | |
for (index, (request, transition)) in requests.iter().skip(1).chain(requests.iter().take(1)).zip_eq(&transitions).enumerate() { |
@niklaslong thanks for the feedback! it's been addressed. |
Motivation
When deserializing an
Authorization
from string a call stack that included multiple transitions, the structural assertion logic would erroneously fail. This PR fixes the assertion logic but does not change the underlying structure/order of theAuthorization
fields.Test Plan
Added two unit tests for authorization deserializations:
synthesizer/process/src/stack/authorization/mod.rs
synthesizer/src/vm/mod.rs
I'm happy to relocate the latter to
authorization/mod.rs
but stuck it invm/mod.rs
since it needs to deploy two programs to the test VM.Related PRs
none