Skip to content
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

Unilateral pause implementation #402

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft

Unilateral pause implementation #402

wants to merge 2 commits into from

Conversation

mdulin2
Copy link
Collaborator

@mdulin2 mdulin2 commented Apr 11, 2024

From the Spearbit audit, we noticed that some edits would brick in-flight calls. So, we created a mechanism, alongside proper administration, that should solve this problem.

There is now a way to pause all inbound or all outbound txs. This allows for outbound txs to be paused during a potentially bricking update for in-flight Txs but allow incoming calls. After a certain amount of time that we're confident all Txs have made it, we can change the settings.

Currently, the inboundPause and outboundPause are on all functions where pause is on.

The functions that must be paused in order to update, it's more complicated. I identified that setPeer, removeTransceiver and setThreshold all have the capability to break in flights txs. So, these are the only ones that must be outbound paused in order to allow for updates. There is currently no strict time enforcement on this - it's the job of the manager to know this.

Open questions

  • What needs to be changed in the deployment and maintenance scripts?
  • Are there more functions that should be restricted? I thought that the changing of a transceiver peer on the Wormhole transceiver was another case where this could be useful.
  • Should this feature be done globally or per chain? Right now, it's setup per chain.

Maxwell Dulin added 2 commits April 11, 2024 13:09
* Added new structure with dynamic storage slots for the storage of it.

* Getter for the struct.

* Setter for setting each of the inbound and outbound calls

* Added modifiers for functions that cannot be executed while paused and for functions that can ONLY be executed while paused.
Copy link
Collaborator

@djb15 djb15 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think generally this makes sense and does what we discussed. Having read the code, unless I'm misunderstanding, I still think this relies quite a lot on documentation for operators on how to coordinate these pausing transactions across chain, do you agree?

If this approach needs documentation and specific instructions for operators too, do you think this sufficiently solves a problem for the added complexity?

}

modifier outboundWhenPaused() {
if (_getUnilateralPauseStorage().outbound == false) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit pick but prefer ! vs == false

external
nonReentrant
whenNotPaused
inboundNotPaused
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can safely complete here without pausing on inbound transfers? Or do you think it's better to be aggressive on the pausing here?

@@ -372,7 +419,7 @@ abstract contract ManagerBase is
}

/// @inheritdoc IManagerBase
function setThreshold(uint8 threshold) external onlyOwner {
function setThreshold(uint8 threshold) external onlyOwner outboundWhenPaused {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't the threshold of the local chain more concerned around receiving inbound messages? For example a deployment may want to change the threshold on one chain only, and they would only have to pause the outbound transfer of that chain, not every other chain that sends to it?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants