SIP-25: Decouple Gas Limiter from Oracle
Author | |
---|---|
Discussions-To | https://discord.gg/3uJ5rAy |
Status | Implemented |
Created | 2019-10-29 |
Simple Summary
Allow the control of setting the gasPriceLimit
to be detached from the centralized SNX oracle
.
Abstract
The current gasPriceLimit
in Synthetix can only be changed by the central SNX Oracle. This proposal is to change this access to a separate address, controlled by a setter only callable by the owner
.
Motivation
Due to the way Ethereum handles nonces, all transactions from a single account have to be mined in (nonce-based) order, one at a time. Thus any invocation of the setGasPriceLimit()
function has to be mined before a price update can be mined on-chain. This creates an unnecessary delay in serving timely oracle updates.
Specification
In Synthetix.sol
:
- Add a new public
address
property onSynthetix
calledgasLimitOracle
- Add a new
onlyOwner
setter function to mutate thesetGasLimitOracle
calledsetGasLimitOracle
- Modify
setGasPriceLimit()
, removing theonlyOracle
modifier and adding arequire(msg.sender == gasLimitOracle)
Rationale
I propose modifying Synthetix.sol
rather than moving the limiter into ExchangeRates
and thus requiring a change of that contract as well. Further, I propose using a require
rather than a modifier for the setGasPriceLimit
function, to reduce gas usage on the already very large Synthetix
contract.
Test Cases
https://github.com/Synthetixio/synthetix/blob/v2.12.2/test/Synthetix.js#L2611
Implementation
https://github.com/Synthetixio/synthetix/blob/v2.12.2/contracts/Synthetix.sol#L158
The implementations must be completed before any SIP is given status "Implemented", but it need not be completed before the SIP is "Approved". While there is merit to the approach of reaching consensus on the specification and rationale before writing code, the principle of "rough consensus and running code" is still useful when it comes to resolving many discussions of API details.
Copyright
Copyright and related rights waived via CC0.