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.
The allowlist contract replaces the Threshold
TokenStaking
contract and is as an outcome of TIP-092 and TIP-100 governance decisions. Staking tokens is no longer required to operate nodes. Beta stakers are selected by the DAO and operate the network based on the allowlist maintained by the DAO. The contract will be integrated with theWalletRegistry
and replace calls toTokenStaking
.I have been experimenting with various approaches, and the most extreme one was to remove most of the
EcdsaAuthorization
logic as well as allTokenStaking.seize
calls. This would have cascading effects on tBTC Bridge contracts as they rely onWalletRegistry.seize
. That would also require implementing weight decrease delays in theAllowlist,
so essentially doing work that is already done inWalletRegistry
. Considering the pros and cons, I decided on the least invasive option. TheWalletRegistry
still thinks in terms of stake authorization, but everything is based on the staking provider's weight as set in theAllowlist
, and weight decrease delays are enforced by the existing mechanism inEcdsaAuthorization
. Theseize
function does nothing except of emitting an event about detecting beta staker misbehavior.To be done
Deployment script
We need to capture all existing beta stakers along with their current authorizations and initialize the
Allowlist
contract. We can do it by either replicating the existing weights or giving them all the same weight.Integrate with
WalletRegistry
and testsThere are two approaches to achieve it. The first one is to get rid of all references to
TokenStaking
from tests and update them to work withAllowlist
. Another approach is to let them work withTokenStaking
but introduce another integration test for those two contracts. In this option, we could use inWalletRegistry
something like:Note that the
WalletRegistry
is close to the maximum allowed contract size and - surprise! - adding the logic above makes it exceed the allowed size. This could potentially be alleviated by removing some of the functionality. For example, in thechallengeDkgResult
function we have a try catch as well as a call todkg.requireChallengeExtraGas()
. This could potentially be eliminated as a no-opseize
inAllowlist
is guaranteed to always succeed. Also, post EIP-7702, therequire(msg.sender == tx.origin, "Not EOA")
check is no longer guaranteed to work as expected.