Skip to content

improve(perpetual): Modify ConfigStore constraints and params#2260

Merged
nicholaspai merged 17 commits intomasterfrom
npai/2259
Dec 5, 2020
Merged

improve(perpetual): Modify ConfigStore constraints and params#2260
nicholaspai merged 17 commits intomasterfrom
npai/2259

Conversation

@nicholaspai
Copy link
Copy Markdown
Member

@nicholaspai nicholaspai commented Dec 3, 2020

Signed-off-by: Nick Pai npai.nyc@gmail.com

Motivation

#2259 This enhances the Perpetual's economic security by allowing the Perpetual contract deployer to set funding rate bounds via timelock.

Changes:

  • Adds config params to limit the range of possible funding rates to propose. This bounds a dishonest proposer's PfC
  • Remove bounds from proposer bound, which can be changed to limit a proposer's PfC based on the funding rate.
  • Remove future time limit from proposer timestamp, OptimisticOracles must be in the past starting with fix(optimistic-oracle): add future time require to optimistic oracle #2267

Issue(s)

Fixes #2259

Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Comment thread packages/core/contracts/financial-templates/common/FundingRateApplier.sol Outdated
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
@coveralls
Copy link
Copy Markdown

coveralls commented Dec 3, 2020

Coverage Status

Coverage remained the same at 93.201% when pulling ab3a9c7 on npai/2259 into 1c08573 on master.

Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Comment thread packages/core/contracts/financial-templates/common/FundingRateApplier.sol Outdated
Comment thread packages/core/test/financial-templates/common/FundingRateApplier.js
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Copy link
Copy Markdown
Member

@chrismaree chrismaree left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! clean, well commented and overall a good PR.

Comment thread packages/core/contracts/financial-templates/common/FundingRateApplier.sol Outdated
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Comment thread packages/core/contracts/financial-templates/perpetual-multiparty/ConfigStore.sol Outdated
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Comment thread packages/core/contracts/financial-templates/perpetual-multiparty/ConfigStore.sol Outdated
Signed-off-by: Nick Pai <npai.nyc@gmail.com>
Comment thread packages/core/contracts/financial-templates/common/FundingRateApplier.sol Outdated
@nicholaspai nicholaspai changed the title improve(perpetual): Constrain funding rate range, remove proposal bond range improve(perpetual): Modify ConfigStore constraints and params Dec 4, 2020
…Applier.sol

Co-authored-by: Matt Rice <matthewcrice32@gmail.com>
await didContractThrow(fundingRateApplier.proposeNewRate(newRate, currentTime + proposalTimeFutureLimit + 1))
);
await fundingRateApplier.proposeNewRate(newRate, currentTime + proposalTimeFutureLimit);
assert(await didContractThrow(fundingRateApplier.proposeNewRate(newRate, currentTime + 1)));
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test will fail until #2267 is merged

@nicholaspai nicholaspai merged commit 8d84c37 into master Dec 5, 2020
@nicholaspai nicholaspai deleted the npai/2259 branch December 5, 2020 02:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Perpetual should constrain funding rate range read from OO and not constrain proposal bond

5 participants