[DO NOT MERGE] Kill switch: Proof of concept #516
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR shows some of the implementations I carried out as a proof of concept to test different cases of how the kill switch could interact with aragonOS.
Intro
Currently, smart contracts applications are upgradeable, which means we can extend their functionality or provide bug-fixes if we want. However, upgrades take time, and time could be critical in some scenarios, especially those where we are dealing with serious bugs in production. For now, there is no way to freeze the lifecycle of the instances of an application if there is a critical issue in any of the contracts being involved. That's where the kill switch comes in, we are trying to provide a way to make those upgrades safer and less error prone. A kill switch would allow any DAO to have full control of these critical situations, where an upgrade is required, preventing them from being exposed to severe exploits or attacks.
Concerns
There are some concerns under discussion about how the kill switch should interact with the application:
Assumptions
The following list describes a set of assumptions that were made in order to limit the boundaries of the possible solutions under discussion:
Approach
The main idea is to have a single source of truth to tell whether there is an issues with a smart contract or not. This source should be able to be updated by trusted third parties, e.g. a security partner. Then every DAO will have their own settings to decide how they want to trust said source. This way, we can ensure that every DAO can automatically freeze the execution of an application in case of an issue. But note that this should also allow DAOs to ignore, deny, or provide a custom behavior upon delicate scenarios.
Components
Binary vs Severity
I explored two patterns to show different ways of how the status of a smart contract could be informed and consumed. One of them is just binary, where we simply tell what to do if there is bug. The other is an extension of the last one, being able to specify levels of severity to do so.
Issues Registry
All the examples listed below are based on a registry of issues, called
IssuesRegistry
, that is supposed to provide up-to-date information about the status of an application. This registry should be managed with permissions in order to tell who can update the status of the different applications.Kernel kill switch
The idea here was to override the
Kernel#getApp
method to control all the calls for a specific app.Application kill switch
The idea here was to provide a custom modifier that developers could use to tag specific functions of an app.
The following graph shows the interactions between the different kill-switch flavors as the result of implementing both Kernel and Application level switches mixed with booth binary (boolean) and severity-driven decisions:
Note that all combinations can coexist together.