-
Notifications
You must be signed in to change notification settings - Fork 303
chore: Add Send + Sync supertraits to SourceManager trait #1858
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
Closed
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
ea4c6c4
Add Send + Sync supertraits to SourceManager trait
sergerad 2f3cdd5
Update changelog
sergerad a3f1df4
Revert "Add Send + Sync supertraits to SourceManager trait"
sergerad fe96f77
SourceManagerSync
sergerad 39f9a50
Fixes
sergerad 5f87e70
Mv sync
sergerad 6df3b98
Update changelog
sergerad 6accc44
Lint
sergerad File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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 know you didn't change this as part of your PR, so this isn't critiquing your PR, but the change that clearly snuck by me at some point.
I somehow missed that the
Assemblerwas made to require aSend + Syncimpl. IMO the assembler should be made generic over this, and type aliases used for ergonomics if needed. Again, the vast majority (all?)Assembleruses aren't going to be in multi-threaded contexts, and it appears that we're primarily doing this so that we can thread theSourceManagerimpl through to somewhere via theAssembler(hence thesource_managermethod), and that somewhere needs the impl to beSend + Sync. That just feels totally backwards to me tbh.A lot of this appears to be justified using the needs of the client, but rather than solving that complexity there, we're pushing it down into
miden-core(and thus forcing all downstream crates which depend on it to deal with the effects of such changes as well). I really strongly disagree with the approach of making things inmiden-corebe biased to specific implementation details - things in this crate should almost universally prefer to punt those sorts of concerns/choices downstream.@plafer Maybe you have more insight into this? It's not something I think we need to change in this PR, but I'd very much like to change
Assemblerto support bothSyncand non-Syncuses, since as it stands now this effectively makes non-Syncimpls ofSourceManagerborderline useless, even though that is by far the most common context in which they would be used.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.
This was requested by @PhilippGackstatter here, and implemented in #1834. My thinking was: making it
Send + Syncwill unblockmiden-base, and all we're losing is maybe a bit of performance (due to e.g. internal mutexes) on the source manager, which is acceptable. And theDefaultSourceManagerwas alreadySend + Sync, so we would literally see no penalty in the current implementation.I'm all for a cleaner approach if you (eventually) want to propose one, but honestly I just didn't spend too much time thinking about it.
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 think that is all fair for
Syncbut notSend. We simply have no solution downstream if this trait object is notSend.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.
Sure, sounds good!
On the surface I think that rationale is fine, and ultimately some fix was needed to unblock
miden-base, so the simpler one was the quickest way to facilitate that. The thing is that the quick fix was also a breaking change, and so far as I can recall, nobody checked with me if that would break things in the compiler. This has been a recurring problem, so I'm probably extra sensitive to it at this point. I guess my point is, we have to start being a lot more wary of changes that remove functionality - we simply have too many downstream dependents on these core crates to be making changes without careful evaluation of the consequences.I'm not mad, I'm just disappointed 😛