-
Notifications
You must be signed in to change notification settings - Fork 4.6k
SDK: refactor Signer
and Signers
traits
#34984
Conversation
Sorry for the lateness on the review: this comes in at a great time, since we're planning on moving to 2.0 and removing old stuff anyway, so we should be able to accept the breaking change of removing the blanket The change looks good, and I'll be so happy to avoid having to write Can you rebase your branch to see what breaks downstream? |
Just merged master into this branch. Building takes too long on my machine so I'm just using the CI checks to see what breaks haha |
We much prefer rebases to merge commits. |
…ox::new(read_keypair_file().unwrap()), Presigner::new\((.*?)\).into\(\) -> Box::new(Presigner::new())
7e6cc0d
to
a06d874
Compare
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.
The changes look good to me! I'm very pleasantly surprised that this just works ™️ for the downstream builds. I think we use Arc<&dyn Signer>
everywhere in those projects.
Higher-rank trait bounds always confuse me, so I tried to make this work without a higher-rank trait bound, but it seems like we need it in this case since all of the functions are implemented on &self
, which means we need some higher bound on the lifetime of the self reference.
What's really nice about this implementation is that it's bound to IntoIterator
, which is typically much easier to use than Iterator
, and yet it doesn't consume the underlying object, so I can call any of the functions, like sign_message
, multiple times, with the same Vec[&dyn Signer]
.
Anyway, great work!
Problem
See #34983
Summary of Changes
From
blanket impl forSigner
?Sized
trait bound to blanket impl forSigner
forBox<dyn Signer>
Deref
blanket impl forSigner
Signers
to blanket impl for all types where their references implsIntoIterator
yieldingSigner
refsFixes #34983
Fixes #13670