SIP-131: Revoke the "ALL" approval, if set, when withdrawing other approvals.

Author
Discussions-Tohttps://research.synthetix.io/t/sip-toggle-off-the-all-approval-if-set-when-withdrawing-other-delegate-approvals/373
StatusRejected
Created2021-03-29

Simple Summary

Revoke the "ALL" approval, if set, when withdrawing other delegate approvals.

Abstract

Toggle off the "ALL" approval, if set, when withdrawing other delegate approvals. This will reduce the number of transactions required to downgrade from the "ALL" powers state to a more fine-grained configuration.

Motivation

Currently, the DelegateApprovals contract withdrawal method calls are no-op, if the "ALL" approval is already set. This is because the "ALL" approval type overrides the other approval types. This SIP proposes that that "ALL" approval, if set, should also be withdrawn when withdrawing other approvals, to correctly effect the change.

Specification

Overview

Add logic to the DelegateApprovals contract withdrawal methods, to revoke the "ALL" approval if set.

Technical Specification

Implemented at https://github.com/Synthetixio/synthetix/pull/1181

Test Cases

The following testcase should confirm the contract change.

Old contract

  • In the old DelegateApprovals contract, create a new "ALL" power approval with the approveAllDelegatePowers method.
  • Ensure running canBurnFor returns true.
  • In a new tx, try withdrawing the "BURN" power with the removeBurnOnBehalf method.
  • Ensure running canBurnFor still returns true.

New contract

  • Deploy the updated version of the DelegateApprovals contract.
  • Create a new "ALL" power approval with the approveAllDelegatePowers method.
  • Ensure running canBurnFor returns true.
  • In a new tx, withdrawal the "BURN" power with the removeBurnOnBehalf method.
  • Ensure running canBurnFor now returns false.

Configurable Values (Via SCCP)

N/A

Copyright and related rights waived via CC0.