SIP 16: Improved Upgrades - Utilise Proxies internally Source

AuthorClinton Ennis, Jackson Chan
Discussions-Tohttps://discord.gg/CDTvjHY
StatusImplemented
Created2019-08-25

Simple Summary

Synthetix upgrades take too long as the owner needs to make call upto 60 calls to configure the system.

Abstract

Most of these calls are setSynthetix and setFeePool on all of the Synths. We propose to point the Synths to the Synthetix Proxy and FeePool Proxy.

Motivation

This would reduce the amount of time the system is offline. Making upgrades a lot faster, cheaper (gas) and minimize the impact on users with reduced downtime.

UPDATE: Since this requires redeploying all the Synths. We propose to also add redeploying all of the Synth Proxies with all the new ProxyERC20.sol to be able to support DEX integrations with all Synths. Currently only SNX and sETH have been updated to support the new ProxyERC20.sol for uniswap and Kyber integration.

Specification

Old Implmentation:

Points directly to the underlying contract and needs to be set on each Synth each release. This is a growing number of calls as we add new synths. Currently 23 and more to come.

bool isSynthetix = msg.sender == address(synthetix);
bool isFeePool = msg.sender == address(feePool);

New Implmentation:

Utilizes the Proxy which should only be set once and rarley changed. This will however cost more gas for looking up the address.

bool isSynthetix = msg.sender == address(Proxy(synthetixProxy).target());
bool isFeePool = msg.sender == address(Proxy(feePoolProxy).target());

Rationale

Test Cases

https://github.com/Synthetixio/synthetix/blob/master/test/Synth.js https://github.com/Synthetixio/synthetix/blob/master/test/ProxyERC20.js

Implementation

https://github.com/Synthetixio/synthetix/blob/master/contracts/Synth.sol https://github.com/Synthetixio/synthetix/blob/master/contracts/ProxyERC20.sol

Copyright and related rights waived via CC0.