-
Notifications
You must be signed in to change notification settings - Fork 55
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: Enable pausing deposits and fills unilaterally #212
Conversation
Useful for upgrades
This generally looks good to me. I can't think of any reason why we'd want to disable only fills on a specific chain, so I'm tempted to propose that we have "pauseDeposits" and "pause" (all). The reason for this is that in the event that we had some kind of emergency, it'd be a little bit painful to do 2x transactions per Spoke Pool. An alternative could be to just implement a separate method to pause both deposits and fills in a single txn. That's probably safer. wdyt? |
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!
How do you think we should think about merging PRs like this, where we aren't sure if they're going to get into the next audit? Should we avoid merging until we are sure this is the code that will be deployed in the upgrade?
Hm, why wouldn't this get into next audit? |
@nicholaspai just prioritization! I think it's still unclear exactly what the prioritization will look like. Do you think we should definitely prioritize this feature over the others we've discussed for the audit? |
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 the SpokePool upgrades are the highest priority and this would be a subset of that feature, so I do think its worth adding? |
contracts/SpokePool.sol
Outdated
|
||
function pauseFills(bool pause) public override onlyAdmin nonReentrant { | ||
pausedFills = pause; | ||
emit PausedFills(pausedDeposits); |
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 event here looks incorrect - should emit the value of pausedFills instead of pausedDeposits.
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.
great catch
contracts/SpokePool.sol
Outdated
@@ -317,7 +348,7 @@ abstract contract SpokePool is SpokePoolInterface, Testable, Lockable, MultiCall | |||
uint64 newRelayerFeePct, | |||
uint32 depositId, | |||
bytes memory depositorSignature | |||
) public override nonReentrant { | |||
) public override nonReentrant unpausedDeposits { |
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.
Is it desirable to make speedups subject to deposits not being paused?
As I see it, the point of pausing deposits is to stop additional funds from entering the Spoke Pool. In the case of a speedup, the funds are already there, and are presumably stuck because the deposit was never filled on the destination chain.
Additionally, as far as I can see, the only side-effect of a speedup is that the Spoke Pool emits another event. It's up to the bots as to whether they accept a speedup event, and it will implicitly be conditional on fills being enabled on the destination chain anyway.
Based on the above, I feel like we should not apply this modifier to speedUpDeposit(). wdyt?
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.
hmm I think its a bit easier to reason about from the bot's perspective of all deposit related events stop once a contract is paused, even though its philosophically ok to not pause speed ups. I was thinking pausing deposits and fills is more of a bot convenience so the owner of the contracts can effectively downgrade a contract by stopping all of its events
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.
Fair enough - I can definitely see the argument for keeping it simple.
There is a theoretical possibility for the edge case I described, and an annoying scenario would be that we have a number of underpriced deposits that are suddenly marooned in the Spoke Pool. In this case we'd need to either unpause to allow speedups to be submitted, or just take the hit and fill these relays at a discount. In theory the relayerFeePct could be very very low.
It's a theoretical possibility, and probably unlikely to be a reality. As long as we're OK with the possibility of it arising then I have no additional input on this one :)
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.
hmmm ok that's a valid concern, i don't love the idea that someone will try to use the speedup signatures to replay attack but I guess its not really an attack since they could have chosen to call speedUp
on either the old or the new spoke pool at the same cost with no extra benefit
contracts/SpokePool.sol
Outdated
event PausedDeposits(bool indexed isPaused); | ||
event PausedFills(bool indexed isPaused); |
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.
Minor: Do these need to be indexed? I imagine that there will be so few of them that there's not much advantage to filtering on the "paused" state.
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.
+1
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 once @pxrl's comments are addressed!
Tbh, I don't think it's a big deal to go ahead and merge even if we later decide to drop this feature, as it would just be a simple git revert. We have an upcoming meeting to figure this out, but regardless, LGTM, as that shouldn't hold this PR up IMO. |
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!
Useful for upgrades