-
Notifications
You must be signed in to change notification settings - Fork 12
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
Adopt dynamic trait object upcasting once released in Rust #284
Comments
Hi, Wodann, thanks for the hard work. I'm very interested in what you're doing, but I can't understand your code of rust. Can you explain a little bit about what problem you are solving or share relevant information for learning. Thank you very much. |
Thank you! 🙏 As we allow runtime polymorphism for our blockchains, state, and blocks (local vs remote), we need to use dynamic trait objects. We're using super-traits in our codebase to specify the complete set of traits that such a runtime polymorphic object needs. However, some of our dependencies, in particular revm need a subset of traits. Currently, upcasting of a super-trait dynamic object to the sub-trait is not supported in Rust. However, a correction of the memory layout that would add support for this is in the works. It was supposed to be released with Rust v1.76.0, but issues were discovered and the feature removed. This task is meant to remove unnecessary usages of the super-trait dynamic object when it suffices to only support the sub-trait |
Thanks for the detaied explanation. @Wodann |
Rust has historically not been natively capable of upcasting dynamic trait objects to sub-traits. Work has been culminating to a beta that we expect should be released in the upcoming year.
To circumvent this limitation in Rust, EDR uses super-traits throughout the codebase, while we would like to be more restrictive. Once it's possible to upcast a super-trait to it sub-trait, we should restrict function signatures to the sub-traits
Definition of Done
Wherever possible, limit usages of
SyncBlockchain
,SyncBlock
,SyncState
,SyncLogger
, andSyncInspector
in function signatures to their sub-traitsThe text was updated successfully, but these errors were encountered: