-
Notifications
You must be signed in to change notification settings - Fork 277
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
feat(alloy-provider): add abstraction for NonceFiller
behavior
#1108
feat(alloy-provider): add abstraction for NonceFiller
behavior
#1108
Conversation
05bc210
to
cae075d
Compare
Good point on the re-org resistance. An alternative solution could be to have a function a user can call to refetch the nonce, overwriting the cache entry. Assuming they have a system that is re-org aware they can simply call this function. |
Even if we indicate whether to fetch nonce from the rpc when sending the rpc request, it will still be inconvenient since you won't be able to fully customize the behavior as you wish. |
Could you expand on that? What kind of behavior would you be customizing that is not covered by my proposed approach? |
@zerosnacks this will help implement any behavior, but on the caller side you will need to pass a boolean value or use some wrapper, which seems inconvenient on the caller side. We will also need wrappers for providers, alloy::contract, etc. |
Also consider that you can't just get a NonceFiller instance and indicate it to fetch rpc, since it might be wrapped with JoinFill. So you'll have to invent some mechanism to interact with the NonceFiller via interior mutability. |
cc @onbjerg / @prestwich curious to hear your thoughts on this proposal / approach |
It makes sense to have other types of nonce management strategies. You can already do this using a custom filler, but this simplifies implementing a new nonce strategy somewhat, so I think this is ok. Noting that this is a breaking change, though cc @mattsse |
Hi, can someone take a look at the PR? |
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.
sorry for the delay @StackOverflowExcept1on ,
supportive, but have some nits and suggestions
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.
lgtm
Motivation
Resolves #1073
Solution
I added
trait NonceManager
and two implementations:SimpleNonceManager
andCachedNonceManager
to allow the user to choose the behavior of nonces filling. In the recommended fillers, I also changed the implementation fromCachedNonceManager
toSimpleNonceManager
to make the recommended fillers more resilient to chain reorganizations. The issue was described in more detail in #1073 (comment).PR Checklist