Skip to content

[Staking] Validator gating #1121

@raulk

Description

@raulk

Goals

Introduce the ability to intercept staking, unstaking, and explicit validator membership adjustments (federated membership) to allow or deny the action, according to a user-defined policy.

Proposed solution

  1. Introduce an IValidatorGater standard interface that can be implemented by any contract.
  2. At subnet creation time, add a new parameter to set the address of the gater contract.
  3. If a non-zero address, every action to stake, unstake, and set explicit power should call this contract to determine if the action is allowed or denied. (Callback style).
  4. This should happen at all lifecycle stages of the subnet, whether the subnet is in pre-activation or activated.
  5. The gater should be allowed to call back to the subnet actor or the gateway, e.g. to query the current power table, or else. So reentrancy for read-only operations is fine.

IValidatorGater interface

interface IValidatorGater {
    function interceptStake(SubnetID id, address validator, uint256 amount) returns (bool);

    function interceptUnstake(SubnetID id, address validator, uint256 amount) returns (bool);

    function interceptSetPower(SubnetID id, address validator, uint256 newPower) returns (bool);
}

Implementations

This flexible interface can back any implementation, e.g.:

  • An ACL list.
  • A policy that checks if a given validator is a Filecoin SP, a token holder, an NFT holder, etc.
  • A time-based policy that enables validators to join or leave at specific times.
  • etc.

Metadata

Metadata

Assignees

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions