SIP-57: Permanent Read-only Proxy for Address Resolver
Author | |
---|---|
Status | Implemented |
Type | Governance |
Network | Ethereum |
Implementor | TBD |
Release | TBD |
Created | 2020-05-08 |
Simple Summary
A permanent read-only proxy to the latest AddressResolver instance.
Abstract
Create and maintain a read-only proxy to the latest AddressResolver
instance. Third party contracts can then reference this proxy in their code and rest assured that thier code will work with future versions of the AddressResolver
.
Motivation
Synthetix is a protocol that iterates fairly frequently. Yet we want to provide an immutable avenue for that third party contracts to connect with our infrastructure, even after upgrades.
Specification
To create a minimal version of Proxy
, called ReadProxy
, that forwards non-mutable calls to the underlying target
and returns its results (transacting to mutated functions will fail).
The owner of this ReadProxy
will be the ProtocolDAO
and is the only one that can change the target
of this proxy. The target
will change only when a new version of the contract is released.
The ReadProxy
will conform to the current IAddressResolver
interface, which is:
interface IAddressResolver {
function getAddress(bytes32 name) external view returns (address);
// Note ⚠️⚠️⚠️: This is coming in the Altair (v2.22) release of Synthetix
function getSynth(bytes32 key) external view returns (address);
function requireAndGetAddress(bytes32 name, string calldata reason) external view returns (address);
}
Rationale
While we could simply reuse the Proxy
contract, it's much more powerful than is necessary here, so we propose a simpler and safer read-only version of the proxy for this instance.
Test Cases
- When any view function from
AddressResolver
is invoked on thisReadProxy
instance, it forwards the request to theAddressResolver
and returns its response - When any mutative function call (other than what is in the
ReadProxy
's ABI directly) is attempted, the transaction will fail - When the
target
ofReadProxy
changes, it emits aTargetUpdated
event.
Implementation
See commit b015b8f5 and corresponding PR #512
Configurable Values (Via SCCP)
(None)
Copyright
Copyright and related rights waived via CC0.