From a45ab0a9ed38470e930ad9045f6f9867da52a8cd Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Mon, 9 Sep 2024 20:51:07 +0530 Subject: [PATCH 01/45] initial commit --- pages/home/pyth-token.mdx | 43 ++++++++++++++++++++++++++------------- 1 file changed, 29 insertions(+), 14 deletions(-) diff --git a/pages/home/pyth-token.mdx b/pages/home/pyth-token.mdx index fac25eb9..856db6ae 100644 --- a/pages/home/pyth-token.mdx +++ b/pages/home/pyth-token.mdx @@ -1,23 +1,38 @@ -# What is PYTH? +import { Steps } from "nextra/components"; - PYTH is the governance token of the Pyth Network. +# PYTH Token - PYTH Token holders can access Pyth governance through the convenient staking and governance [frontend](https://staking.pyth.network/). +The Pyth Network, as a distributed system, needs to have a constitution and a clear governance system. - Pyth Network’s governance system allows anyone with PYTH Tokens to participate. Token holders must stake their tokens in the Pyth staking program to vote on community governance proposals. Governance uses a 1:1 coin-voting system, where each staked token confers one vote. +PYTH is the governance token of the Pyth Network, and the [Pyth DAO constitution](https://github.com/pyth-network/governance/blob/main/docs/constitution/pyth-dao-constitution.md) is the governance framework for the Pyth DAO. The constitution outlines the rules and procedures of the Pyth DAO. These rules and procedures are generally enforced through on-chain contracts and the associated parameters, unless specified by the Pyth DAO for actuation off-chain. - Any PYTH Token holder can submit proposals to the Pyth DAO as long as they have 0.25% of the total PYTH tokens staked. +## PYTH Token Staking - A proposal is considered passed if it meets the following conditions at the end of the 7 day voting period: - - More yesses have been cast than nos. - - The "Approval Quorum" has been met. This is a percentage of staked tokens that must have voted yes for the proposal to pass. The threshold can vary depending on the type of proposal. The current thresholds can be found in the "Governances" sections of the [parameters of the DAO](https://app.realms.today/dao/PYTH/params) as "Community Vote Threshold Percentage". It is expressed as a percentage of staked tokens at the start of the voting period for the proposal. +PYTH Token can be staked for Governance and Oracle Integrity. - Proposals are binding on-chain: each proposal has one or more associated instructions that are executed when the proposal passes. Community governance proposals can relate to all of the following: + +### Staking PYTH for Governance - - Determine the size of update fees. - - Determine the reward distribution mechanism for publishers. - - Approve other software updates to on-chain programs across blockchains. - - Determine the price feeds are listed on Pyth and their reference data (e.g., number of decimal places in the price, reference exchanges). - - Choose the publishers that are permissioned to provide data for each price feed +PYTH token holders can participate in Pyth governance through staking and [governance](https://staking.pyth.network/). Token holders use their staked tokens in the Pyth staking program to vote on community governance proposals. + +Governance uses a 1:1 coin-voting system, where each staked token confers one vote. + +Any PYTH Token holder can submit proposals to the Pyth DAO as long as they have **0.25% **of the total PYTH tokens staked. +At the end of the **7 day** voting period, a proposal is passes if it meets the following conditions: + +- More yesses have been cast than nos. +- The "**Approval Quorum**" has been met. \ + **Approval Quorum** is a percentage of staked PYTH tokens that must have voted yes for the proposal to pass. "Community Vote Threshold Percentage" is expressed as percentage of staked tokens at the start of the voting period for the proposal. This percentage threshold can vary depending on the type of proposal. The current threshold can be found in the "Governances" sections of the [parameters of the DAO](https://app.realms.today/dao/PYTH/params). Please note that the scope of community governance proposals may be expanded if the PYTH token holders (or the Pyth DAO) decide so. + +### Staking PYTH for Oracle Integrity + +The Pyth Network is built to give decentralized applications reliable and trustworthy data. The quality of the data it provides is paramount for the functioning of these applications and the overall success of the network. + +Pyth's [Oracle Integrity Staking] (OIS) concentrates the production of quality data in the hands of a limited set of semi-trusted entities to achieve more coverage and lower latency than the competition. The responsibility of Publishers over data quality is not just ethical but also incentivized through economics: + +- **Staking and Slashing:** Publishers can self-stake PYTH tokens as collateral. It also allows other stakers to choose publishers to delegate their PYTH tokens. In the event of data inaccuracies or inconsistencies, a portion of this stake can be slashed as a penalty. This mechanism ensures that publishers have a vested interest in providing accurate data +- **Reputation:** The reputation of data publishers is directly linked to the quality of data they provide. Publishers with a track record of providing accurate data are more likely to be trusted and attract more interest + + From 4ccbeae46ba0690d85ed9c5d12ae55b3ce810f4a Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Tue, 10 Sep 2024 12:41:46 +0530 Subject: [PATCH 02/45] (first example) --- components/StakingCapBar.tsx | 41 +++++++++++++++++++++++ pages/home/pyth-token.mdx | 8 ++--- pages/home/pyth-token/ois/examples.mdx | 45 ++++++++++++++++++++++++++ tsconfig.json | 6 +++- 4 files changed, 95 insertions(+), 5 deletions(-) create mode 100644 components/StakingCapBar.tsx create mode 100644 pages/home/pyth-token/ois/examples.mdx diff --git a/components/StakingCapBar.tsx b/components/StakingCapBar.tsx new file mode 100644 index 00000000..2947743d --- /dev/null +++ b/components/StakingCapBar.tsx @@ -0,0 +1,41 @@ +import React, { useState } from 'react'; + +const StakingCapBar = () => { + const [maxRewardRate, setMaxRewardRate] = useState(10); + + const barWidth = 300; + const barHeight = 30; + + return ( +
+

Example:

+
+ + setMaxRewardRate(Number(e.target.value))} + className="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer" + /> +
+
+
+
+ 0% + 100% +
+
+

Max Reward Rate = {maxRewardRate}%

+
+ ); +}; + +export default StakingCapBar; \ No newline at end of file diff --git a/pages/home/pyth-token.mdx b/pages/home/pyth-token.mdx index 856db6ae..f074e579 100644 --- a/pages/home/pyth-token.mdx +++ b/pages/home/pyth-token.mdx @@ -20,7 +20,7 @@ Governance uses a 1:1 coin-voting system, where each staked token confers one vo Any PYTH Token holder can submit proposals to the Pyth DAO as long as they have **0.25% **of the total PYTH tokens staked. At the end of the **7 day** voting period, a proposal is passes if it meets the following conditions: -- More yesses have been cast than nos. +- **More yesses** have been cast than nos. - The "**Approval Quorum**" has been met. \ **Approval Quorum** is a percentage of staked PYTH tokens that must have voted yes for the proposal to pass. "Community Vote Threshold Percentage" is expressed as percentage of staked tokens at the start of the voting period for the proposal. This percentage threshold can vary depending on the type of proposal. The current threshold can be found in the "Governances" sections of the [parameters of the DAO](https://app.realms.today/dao/PYTH/params). @@ -28,11 +28,11 @@ Please note that the scope of community governance proposals may be expanded if ### Staking PYTH for Oracle Integrity -The Pyth Network is built to give decentralized applications reliable and trustworthy data. The quality of the data it provides is paramount for the functioning of these applications and the overall success of the network. +The Pyth Network is built to provide decentralized applications with reliable and trustworthy data. The quality of the data it provides is paramount for these application's functions and the network's overall success. -Pyth's [Oracle Integrity Staking] (OIS) concentrates the production of quality data in the hands of a limited set of semi-trusted entities to achieve more coverage and lower latency than the competition. The responsibility of Publishers over data quality is not just ethical but also incentivized through economics: +Pyth's [Oracle Integrity Staking] (OIS) concentrates on producing quality data in the hands of a limited set of semi-trusted entities to achieve more coverage and lower latency than the competition. The responsibility of Publishers over data quality is not just ethical but also incentivized through economics: - **Staking and Slashing:** Publishers can self-stake PYTH tokens as collateral. It also allows other stakers to choose publishers to delegate their PYTH tokens. In the event of data inaccuracies or inconsistencies, a portion of this stake can be slashed as a penalty. This mechanism ensures that publishers have a vested interest in providing accurate data -- **Reputation:** The reputation of data publishers is directly linked to the quality of data they provide. Publishers with a track record of providing accurate data are more likely to be trusted and attract more interest +- **Reputation:** The reputation of data publishers is directly linked to the quality of data they provide. Publishers with a track record of providing accurate data are more likely to be trusted and attract more interest. diff --git a/pages/home/pyth-token/ois/examples.mdx b/pages/home/pyth-token/ois/examples.mdx new file mode 100644 index 00000000..04576886 --- /dev/null +++ b/pages/home/pyth-token/ois/examples.mdx @@ -0,0 +1,45 @@ +import StakingCapBar from '@/components/StakingCapBar' + +# Examples(WIP) + + +### Example 1:Only Publisher State + +$$ +\text{Publisher's Stake} \quad{S^p_p} = 100 +$$ + +$$ +\text{Delegator Stake} \quad{S^d_p} = 0 +$$ + +$$ +\text{Total Stake} \quad{S_p} = {S^p_p} + {S^d_p} = 100 +$$ + +$$ +\text{Pool Cap} \quad{C}_p = 500 +$$ + +$$ +\text{Total Amount eligible for Reward} \quad{R_a} = min({S}_p, {C}_p) = min(500, 100) = 100 +$$ + + + + +$$ +\text{Reward Rate} \quad{r} = 10\% +$$ + +$$ +\text{Total Reward} \quad{R_p} = {r} \times {R_a} = 10\% \times 100 = 10 +$$ + +$$ +\text{Publisher Reward} \quad{R^p_p} = {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 +$$ + +$$ +\text{Delegator Reward} \quad{R^d_p} = {r} \times min({S^d_p}, {C}_p) = 10\% \times 0 = 0 +$$ \ No newline at end of file diff --git a/tsconfig.json b/tsconfig.json index 50bcb22f..68ce12fa 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -13,7 +13,11 @@ "moduleResolution": "node", "resolveJsonModule": true, "isolatedModules": true, - "jsx": "preserve" + "jsx": "preserve", + "baseUrl": ".", + "paths": { + "@/components/*": ["components/*"] + } }, "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx"], "exclude": ["node_modules"] From 9896683cc027258de3c192a35baab9a064685e63 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Tue, 10 Sep 2024 12:43:22 +0530 Subject: [PATCH 03/45] fix --- pages/home/pyth-token/ois/examples.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/home/pyth-token/ois/examples.mdx b/pages/home/pyth-token/ois/examples.mdx index 04576886..c2e791e1 100644 --- a/pages/home/pyth-token/ois/examples.mdx +++ b/pages/home/pyth-token/ois/examples.mdx @@ -41,5 +41,5 @@ $$ $$ $$ -\text{Delegator Reward} \quad{R^d_p} = {r} \times min({S^d_p}, {C}_p) = 10\% \times 0 = 0 +\text{Delegator Reward} \quad{R^d_p} = {R_p} - {R^p_p} = 10 - 10 = 0 $$ \ No newline at end of file From 5f069f9d4c1c8ef549a8732e5338d5c28f5560bb Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Tue, 10 Sep 2024 22:13:27 +0530 Subject: [PATCH 04/45] Design principles and implementation of OIS --- components/StakingCapBar.tsx | 15 +++++--- pages/home/pyth-token.mdx | 2 +- pages/home/pyth-token/_meta.json | 1 + .../pyth-token/oracle-integrity-staking.mdx | 35 +++++++++++++++++++ .../examples.mdx | 2 +- 5 files changed, 48 insertions(+), 7 deletions(-) create mode 100644 pages/home/pyth-token/oracle-integrity-staking.mdx rename pages/home/pyth-token/{ois => oracle-integrity-staking}/examples.mdx (90%) diff --git a/components/StakingCapBar.tsx b/components/StakingCapBar.tsx index 2947743d..a6a5f8fd 100644 --- a/components/StakingCapBar.tsx +++ b/components/StakingCapBar.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState } from "react"; const StakingCapBar = () => { const [maxRewardRate, setMaxRewardRate] = useState(10); @@ -10,7 +10,10 @@ const StakingCapBar = () => {

Example:

-
-
@@ -33,9 +36,11 @@ const StakingCapBar = () => { 100%
-

Max Reward Rate = {maxRewardRate}%

+

+ Max Reward Rate = {maxRewardRate}% +

); }; -export default StakingCapBar; \ No newline at end of file +export default StakingCapBar; diff --git a/pages/home/pyth-token.mdx b/pages/home/pyth-token.mdx index f074e579..8e398ac0 100644 --- a/pages/home/pyth-token.mdx +++ b/pages/home/pyth-token.mdx @@ -30,7 +30,7 @@ Please note that the scope of community governance proposals may be expanded if The Pyth Network is built to provide decentralized applications with reliable and trustworthy data. The quality of the data it provides is paramount for these application's functions and the network's overall success. -Pyth's [Oracle Integrity Staking] (OIS) concentrates on producing quality data in the hands of a limited set of semi-trusted entities to achieve more coverage and lower latency than the competition. The responsibility of Publishers over data quality is not just ethical but also incentivized through economics: +Pyth's [Oracle Integrity Staking (OIS)](/home/pyth-token/oracle-integrity-staking) concentrates on producing quality data in the hands of a limited set of semi-trusted entities to achieve more coverage and lower latency than the competition. The responsibility of Publishers over data quality is not just ethical but also incentivized through economics: - **Staking and Slashing:** Publishers can self-stake PYTH tokens as collateral. It also allows other stakers to choose publishers to delegate their PYTH tokens. In the event of data inaccuracies or inconsistencies, a portion of this stake can be slashed as a penalty. This mechanism ensures that publishers have a vested interest in providing accurate data - **Reputation:** The reputation of data publishers is directly linked to the quality of data they provide. Publishers with a track record of providing accurate data are more likely to be trusted and attract more interest. diff --git a/pages/home/pyth-token/_meta.json b/pages/home/pyth-token/_meta.json index 5a14bb39..d39ce06a 100644 --- a/pages/home/pyth-token/_meta.json +++ b/pages/home/pyth-token/_meta.json @@ -1,4 +1,5 @@ { + "oracle-integrity-staking": "Oracle Integrity Staking (OIS)", "pyth-distribution": "PYTH Token Distribution", "pyth-token-addresses": "PYTH Token Contract Addresses" } diff --git a/pages/home/pyth-token/oracle-integrity-staking.mdx b/pages/home/pyth-token/oracle-integrity-staking.mdx new file mode 100644 index 00000000..f53c5091 --- /dev/null +++ b/pages/home/pyth-token/oracle-integrity-staking.mdx @@ -0,0 +1,35 @@ +# Oracle Integrity Staking (OIS) + +This document outlines the design principles and implementation details of the Oracle Integrity Staking (OIS) protocol. + +## Design Principles + +OIS's economic design focuses on awarding and penalizing Stakers over the primary dimension of data accuracy. +Stakers receive rewards from an open-ended pool for helping to ensure data quality. They will also have their stake slashed as a penalty for failing to maintain data accuracy. + +The core design principles behind OIS include the following: + +- Integrity Staking secures all current and future price feeds produced by the Pyth Network. +- Data Publishers are individually responsible for data accuracy. +- Rewards and penalties are proportionate to the stake assigned to each publisher. Delegators share in the risk-reward of the publisher(s) they assign their stake to. +- A higher number of publishers for each price feed contributes positively to the security of such feed. +- Staking for OIS is complementary to Staking for Governance, and eligible $PYTH tokens can be used for both purposes. +- The ability to slash stake in OIS requires **unlocked** \$PYTH tokens, whereas Staking for Governance can use both locked and unlocked $PYTH tokens. +- All parameter related to the OIS protocol are subject to the governance of the Pyth DAO. + +## Implementation + +OIS implements the principle above through the following structure: + +1. OIS is subject to the same 7-day epoch as Governance voting. All parameters used in the OIS protocol are captured at each start of the epoch on Thursdays at 0:00 UTC and remain constant until the end of the epoch. Staking into OIS is also subject to warmup and cooldown period prior and post epoch respectively. + +2. Each publisher is programmatically assigned a staking pool where they can self-stake and to which other stakers can delegate + - The staking pool assigned to each publisher covers all price feeds/symbols they publish. + - Each staking pool has a soft cap. This soft cap dynamically expands and shrinks given the number of symbols published by the assigned publisher. + - Price feeds with a low number of publishers contribute less to the cap's expansion. + - Staking into the pool can exceed the soft cap. However no rewards are paid nor penalties are levied on the excess amount. + - The OIS protocol prioritizes self-stake attributed to the **publisher's stake** when distributing rewards to the publisher's pool. + - All staking pools charge the same delegation fee for stakers who are delating stake to one or many pools. +3. Each pool has a maximum reward rate per epoch, which applies only to the staked amount within the soft cap. +4. The total amount of rewards paid to all pools is bound by the same cap relative to the amount of rewards available to the OIS protocol. +5. Slashing of stake has a hard cap and only impacts pools that assigned to publishers responsible for the poor data quality. Both self-stakers and delegators are also slashed proportionally to their staked amount in the impacted pools. \ No newline at end of file diff --git a/pages/home/pyth-token/ois/examples.mdx b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx similarity index 90% rename from pages/home/pyth-token/ois/examples.mdx rename to pages/home/pyth-token/oracle-integrity-staking/examples.mdx index c2e791e1..1f56dbc3 100644 --- a/pages/home/pyth-token/ois/examples.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx @@ -33,7 +33,7 @@ $$ $$ $$ -\text{Total Reward} \quad{R_p} = {r} \times {R_a} = 10\% \times 100 = 10 +\text{Total Reward} \quad{R_p} = {r} \times {E_p} = 10\% \times 100 = 10 $$ $$ From 1b6da69a26ac5ced8e5319819e46bcf659eca3ad Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Wed, 11 Sep 2024 16:07:47 +0530 Subject: [PATCH 05/45] added math --- components/StakingCapBar.tsx | 98 ++++++++++------- .../pyth-token/oracle-integrity-staking.mdx | 18 +-- .../oracle-integrity-staking/_meta.json | 4 + .../oracle-integrity-staking/examples.mdx | 8 +- .../mathematical-representation.mdx | 104 ++++++++++++++++++ 5 files changed, 181 insertions(+), 51 deletions(-) create mode 100644 pages/home/pyth-token/oracle-integrity-staking/_meta.json create mode 100644 pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx diff --git a/components/StakingCapBar.tsx b/components/StakingCapBar.tsx index a6a5f8fd..8c4cd847 100644 --- a/components/StakingCapBar.tsx +++ b/components/StakingCapBar.tsx @@ -1,46 +1,70 @@ -import React, { useState } from "react"; +import React from "react"; -const StakingCapBar = () => { - const [maxRewardRate, setMaxRewardRate] = useState(10); +interface StakingCapBarProps { + totalLength?: number; + height?: number; + barColor?: string; + secondBarColor?: string; + backgroundColor?: string; + fillPercentage: number; + secondFillPercentage: number; +} - const barWidth = 300; - const barHeight = 30; +export default function StakingCapBar({ + totalLength = 300, + height = 80, + barColor = "bg-blue-500", + secondBarColor = "bg-green-500", + backgroundColor = "bg-gray-200", + fillPercentage, + secondFillPercentage, +}: StakingCapBarProps) { + // Ensure fillPercentages are between 0 and 100 + const clampedFillPercentage = Math.min(100, Math.max(0, fillPercentage)); + const clampedSecondFillPercentage = Math.min( + 100 - clampedFillPercentage, + Math.max(0, secondFillPercentage) + ); return ( -
-

Example:

-
- - setMaxRewardRate(Number(e.target.value))} - className="w-full h-2 bg-gray-200 rounded-lg appearance-none cursor-pointer" - /> -
-
+
+

Staking Cap Bar

+
-
- 0% - 100% + className={`${backgroundColor} rounded overflow-hidden border border-gray-300`} + style={{ height: `${height}px` }} + role="progressbar" + aria-valuenow={clampedFillPercentage + clampedSecondFillPercentage} + aria-valuemin={0} + aria-valuemax={100} + > +
+
+
+
-

- Max Reward Rate = {maxRewardRate}% -

+
+

+ First Fill: {clampedFillPercentage}% +

+

+ Second Fill: {clampedSecondFillPercentage}% +

+

+ Total Fill: {clampedFillPercentage + clampedSecondFillPercentage}% +

+

Total Length: {totalLength}px

+
); -}; - -export default StakingCapBar; +} diff --git a/pages/home/pyth-token/oracle-integrity-staking.mdx b/pages/home/pyth-token/oracle-integrity-staking.mdx index f53c5091..9c04e79f 100644 --- a/pages/home/pyth-token/oracle-integrity-staking.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking.mdx @@ -4,7 +4,7 @@ This document outlines the design principles and implementation details of the O ## Design Principles -OIS's economic design focuses on awarding and penalizing Stakers over the primary dimension of data accuracy. +OIS's economic design focuses on awarding and penalizing Stakers over the primary dimension of data accuracy. Stakers receive rewards from an open-ended pool for helping to ensure data quality. They will also have their stake slashed as a penalty for failing to maintain data accuracy. The core design principles behind OIS include the following: @@ -19,17 +19,17 @@ The core design principles behind OIS include the following: ## Implementation -OIS implements the principle above through the following structure: +OIS implements the principle above through the following structure: 1. OIS is subject to the same 7-day epoch as Governance voting. All parameters used in the OIS protocol are captured at each start of the epoch on Thursdays at 0:00 UTC and remain constant until the end of the epoch. Staking into OIS is also subject to warmup and cooldown period prior and post epoch respectively. 2. Each publisher is programmatically assigned a staking pool where they can self-stake and to which other stakers can delegate - - The staking pool assigned to each publisher covers all price feeds/symbols they publish. - - Each staking pool has a soft cap. This soft cap dynamically expands and shrinks given the number of symbols published by the assigned publisher. - - Price feeds with a low number of publishers contribute less to the cap's expansion. - - Staking into the pool can exceed the soft cap. However no rewards are paid nor penalties are levied on the excess amount. - - The OIS protocol prioritizes self-stake attributed to the **publisher's stake** when distributing rewards to the publisher's pool. - - All staking pools charge the same delegation fee for stakers who are delating stake to one or many pools. + - The staking pool assigned to each publisher covers all price feeds/symbols they publish. + - Each staking pool has a soft cap. This soft cap dynamically expands and shrinks given the number of symbols published by the assigned publisher. + - Price feeds with a low number of publishers contribute less to the cap's expansion. + - Staking into the pool can exceed the soft cap. However no rewards are paid nor penalties are levied on the excess amount. + - The OIS protocol prioritizes self-stake attributed to the **publisher's stake** when distributing rewards to the publisher's pool. + - All staking pools charge the same delegation fee for stakers who are delating stake to one or many pools. 3. Each pool has a maximum reward rate per epoch, which applies only to the staked amount within the soft cap. 4. The total amount of rewards paid to all pools is bound by the same cap relative to the amount of rewards available to the OIS protocol. -5. Slashing of stake has a hard cap and only impacts pools that assigned to publishers responsible for the poor data quality. Both self-stakers and delegators are also slashed proportionally to their staked amount in the impacted pools. \ No newline at end of file +5. Slashing of stake has a hard cap and only impacts pools that assigned to publishers responsible for the poor data quality. Both self-stakers and delegators are also slashed proportionally to their staked amount in the impacted pools. diff --git a/pages/home/pyth-token/oracle-integrity-staking/_meta.json b/pages/home/pyth-token/oracle-integrity-staking/_meta.json new file mode 100644 index 00000000..3e8fa40a --- /dev/null +++ b/pages/home/pyth-token/oracle-integrity-staking/_meta.json @@ -0,0 +1,4 @@ +{ + "mathematical-representation": "Mathematical Representation", + "examples": "Examples" +} diff --git a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx index 1f56dbc3..54571465 100644 --- a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx @@ -1,7 +1,8 @@ -import StakingCapBar from '@/components/StakingCapBar' +import StakingCapBar from "@/components/StakingCapBar"; # Examples(WIP) + ### Example 1:Only Publisher State @@ -25,9 +26,6 @@ $$ \text{Total Amount eligible for Reward} \quad{R_a} = min({S}_p, {C}_p) = min(500, 100) = 100 $$ - - - $$ \text{Reward Rate} \quad{r} = 10\% $$ @@ -42,4 +40,4 @@ $$ $$ \text{Delegator Reward} \quad{R^d_p} = {R_p} - {R^p_p} = 10 - 10 = 0 -$$ \ No newline at end of file +$$ diff --git a/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx b/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx new file mode 100644 index 00000000..d35e0dc5 --- /dev/null +++ b/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx @@ -0,0 +1,104 @@ +# Mathematical Representation + +This section outlines the mathematical representation of the Oracle Integrity Staking (OIS) protocol. + +As explained in the [implementation](./implementation.mdx) section, every publisher is assigned a staking pool where they can self-stake and to which other stakers can delegate. + +## Pool Cap + +The **pool cap** is calculated as follows: + + +$$ +\large{\text{Pool Cap}: {\bold{C_p}} = M \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{\max(n_s, Z)}} +$$ + +Where: + +- $M$ is a constant parameter representing the target stake per symbol. +- $\text{Symbols\_p}$ is the number of symbols published by the publisher $p$. +- $n_s$ is the number of elements in Symbols_p , or $n_s$ = $|\text{Symbols\_p}|$ +- $Z$ is a constant parameter to control cap contribution from symbols with a low number of publishers. + +This formula actually ensures that symbols with a lower number of publishers contribute more to the overall cap, while symbols with a higher number of publishers contribute less. This is because the contribution of each symbol is inversely proportional to the number of publishers (or Z, whichever is larger). + + +## Reward + +The reward $R_p$ paid to each pool is calculated as follows: + +$$ +\large{R_p = y \cdot \min(S_p, C_p)} +$$ + +Where: + +- $y$ is the cap to the rate of rewards for any pool. +- $S_p$ be the stake assigned to the publisher p pool , made of self-staked amount $S^{p}_{p}$ and delegated stake $S^{d}_{p}$ , or $S_{p} = S^{p}_{p} + S^{d}_{p}$. +- $C_p$ be the stake cap for the pool assigned to publisher p. + +The reward is capped at the pool cap, $C_p$, to ensure that publishers and delegators are not over-rewarded. (I don't this this is necessary to mention, but it is a good sanity check) + + +The total amount of rewards paid to all pools is bound the the same cap relative to the amount of rewards available to the OIS protocol. + +$$ +\large{\sum_{p \in \text{Publishers}} R_p \leq y \cdot \min(NumSymbols \cdot M, \sum_{p=1}^{P} S_p)} +$$ + +Where: + +- $NumSymbols$ is the total number of symbols in the system. +- $P$ is the total number of publishers in the system. + + +Whereas the reward component relative to the amount self-staked by the publisher $p$ is defined as: + +$$ +\large{R^{p}_{p} = y \cdot \min(S^p_p, C_p) = R_p - R^d_p} +$$ + +Where: + +- $R^d_p$ is the reward component relative to the amount delegated to the publisher $p$. + + +## Slashing + +Slashing is an important aspect of the OIS protocol to ensure the integrity of the system. + +The slashed amount for each pool is calculated as follows: + +$$ +\large{SL_p = z \cdot S_p = z \cdot (S^{p}_{p} + S^{d}_{p})} +$$ + +Where: + +- $SL_p$ is the slashed amount for the publisher $p$ pool. +- $z$ is the slashing rate. +- $S_p$ is the stake assigned to the publisher $p$ pool , made of self-staked amount $S^{p}_{p}$ and delegated stake $S^{d}_{p}$ , or $S_{p} = S^{p}_{p} + S^{d}_{p}$. + +Here $SL_p$ is uniformly allocated to both the self-staking publisher and delegators in the pool, pro-rata to their respective stake. + + + + +Subsequently, the rewards received by a publisher and delegators into a pool, net of any slashed amounts can be expressed as below: + +$$ +\large{\Pi^p_p = ( R^p_p + f \cdot R^d_p ) - z \cdot S^p_p} +$$ + +$$ +\large{\Pi^d_p = R^d_p - ( f \cdot R^d_p + z \cdot S^d_p )} +$$ + +Where: + +- $\Pi^p_p$ is the net reward received by the publisher $p$ after slashing. +- $\Pi^d_p$ is the net reward received by the delegator $p$ after slashing. +- $f$ is the delegation fee charged by the publisher. +- $z$ is the slashing rate. +- $S^p_p$ is the amount self-staked by the publisher $p$. +- $S^d_p$ is the amount delegated to the publisher $p$. From 48270d1de27c0b574b22ead8925e9c94d97e3ef4 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Wed, 11 Sep 2024 20:11:50 +0530 Subject: [PATCH 06/45] wip-added examples --- components/StakingCapBar.tsx | 98 +++++++-------- .../oracle-integrity-staking/examples.mdx | 119 +++++++++++++++--- .../mathematical-representation.mdx | 2 +- 3 files changed, 145 insertions(+), 74 deletions(-) diff --git a/components/StakingCapBar.tsx b/components/StakingCapBar.tsx index 8c4cd847..a6572c99 100644 --- a/components/StakingCapBar.tsx +++ b/components/StakingCapBar.tsx @@ -1,70 +1,62 @@ -import React from "react"; +import React from "react" interface StakingCapBarProps { - totalLength?: number; - height?: number; - barColor?: string; - secondBarColor?: string; - backgroundColor?: string; - fillPercentage: number; - secondFillPercentage: number; + totalLength?: number + height?: number + fillPercentage: number + secondFillPercentage: number + labelText?: string } export default function StakingCapBar({ totalLength = 300, height = 80, - barColor = "bg-blue-500", - secondBarColor = "bg-green-500", - backgroundColor = "bg-gray-200", fillPercentage, secondFillPercentage, + labelText }: StakingCapBarProps) { // Ensure fillPercentages are between 0 and 100 - const clampedFillPercentage = Math.min(100, Math.max(0, fillPercentage)); - const clampedSecondFillPercentage = Math.min( - 100 - clampedFillPercentage, - Math.max(0, secondFillPercentage) - ); + const clampedFillPercentage = Math.min(100, Math.max(0, fillPercentage)) + const clampedSecondFillPercentage = Math.min(100 - clampedFillPercentage, Math.max(0, secondFillPercentage)) + const totalFillPercentage = clampedFillPercentage + clampedSecondFillPercentage return ( -
-

Staking Cap Bar

-
+
-
-
-
-
-
+
+
+
-
-

- First Fill: {clampedFillPercentage}% -

-

- Second Fill: {clampedSecondFillPercentage}% -

-

- Total Fill: {clampedFillPercentage + clampedSecondFillPercentage}% -

-

Total Length: {totalLength}px

-
+ {labelText && ( +
+ {labelText}: {totalFillPercentage}% +
+ )}
- ); -} + ) +} \ No newline at end of file diff --git a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx index 54571465..cd31f3f8 100644 --- a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx @@ -1,43 +1,122 @@ import StakingCapBar from "@/components/StakingCapBar"; -# Examples(WIP) +# Examples - +This reference page provides examples of various scenarios to illustrate the Mathematical Representations of OIS. -### Example 1:Only Publisher State +NOTE: All the symbols used in the examples are explained in the [Mathematical Representation](/home/pyth-token/oracle-integrity-staking/mathematical-representation) section. -$$ -\text{Publisher's Stake} \quad{S^p_p} = 100 -$$ +## Example 1: Only Publisher Stake -$$ -\text{Delegator Stake} \quad{S^d_p} = 0 -$$ +This example take the case where only the publisher has staked PYTH tokens. $$ -\text{Total Stake} \quad{S_p} = {S^p_p} + {S^d_p} = 100 -$$ +\begin{aligned} +{S^p_p} &= 100 \\ +{S^d_p} &= 0 \\ +{S^p} &= {S^p_p} + {S^d_p} = 100 + 0 = 100 \\ +{C}_p &= 500 \\ +\text{Total Amount eligible for Reward} \quad{R_p} &= min({S}_p, {C}_p) = min(500, 100) = 100 \\ +\text{Reward Rate} \quad{r} &= 10\% \\ -$$ -\text{Pool Cap} \quad{C}_p = 500 +\text{Total Reward} \quad{R_p} &= {r} \times {E_p} = 10\% \times 100 = 10 \\ +\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\ +\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 10 - 10 = 0 \\ +\end{aligned} $$ -$$ -\text{Total Amount eligible for Reward} \quad{R_a} = min({S}_p, {C}_p) = min(500, 100) = 100 -$$ + +# Example 2: Publisher and Delegator Stake + +This example take the case where both the publisher and the delegator have staked PYTH tokens. $$ -\text{Reward Rate} \quad{r} = 10\% +\begin{aligned} +{S^p_p} &= 100 \\ +{S^d_p} &= 100 \\ +{S^p} &= {S^p_p} + {S^d_p} = 100 + 100 = 200 \\ +{C}_p &= 500 \\ +\text{Total Amount eligible for Reward} \quad{R_p} &= min({S}_p, {C}_p) = min(500, 200) = 200 \\ +\text{Reward Rate} \quad{r} &= 10\% \\ +\text{Total Reward} \quad{R_p} &= {r} \times {E_p} = 10\% \times 200 = 20 \\ +\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\ +\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 20 - 10 = 10 \\ +\end{aligned} $$ +# Example 3: Publisher and Delegator Stake more than the Cap + +This example take the case where the combined stake of both the publisher and the delegator is more than the cap. + $$ -\text{Total Reward} \quad{R_p} = {r} \times {E_p} = 10\% \times 100 = 10 +\begin{aligned} +{S^p_p} &= 300 \\ +{S^d_p} &= 300 \\ +{S^p} &= {S^p_p} + {S^d_p} = 300 + 300 = 600 \\ +{C}_p &= 500 \\ +\text{Total Amount eligible for Reward} \quad{R_p} &= min({S}_p, {C}_p) = min(500, 600) = 500 \\ +\text{Reward Rate} \quad{r} &= 10\% \\ +\text{Total Reward} \quad{R_p} &= {r} \times {E_p} = 10\% \times 500 = 50 \\ +\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 300 = 30 \\ +\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 30 = 20 \\ +\end{aligned} $$ + +# Example 4: Introducing Delegator Fees + +This example demonstrates how delegator fees affect the reward distribution between publishers and delegators. + $$ -\text{Publisher Reward} \quad{R^p_p} = {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 +\begin{aligned} +\quad{S^p_p} &= 200 \\ +\quad{S^d_p} &= 300 \\ +\quad{S^p} &= {S^p_p} + {S^d_p} = 200 + 300 = 500 \\ +\quad{C}_p &= 500 \\ +\quad{R_p} &= min({S}_p, {C}_p) = min(500, 500) = 500 \\ +\quad{r} &= 10\% \\ +\quad{f} &= 2\% \\ + +\quad{R_p} &= {r} \times {R_p} = 10\% \times 500 = 50 \\ +\quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 200 = 20 \\ +\quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 20 = 30 \\ +\text{Fee paid by Delegator} \quad{F^d_p} &= {f} \times {R^d_p} = 2\% \times 30 = 0.6 \\ +\text{Final Delegator Reward} \quad{R^d_p} &= {R^d_p} - {F^d_p} = 30 - 0.6 = 29.4 \\ +\text{Total Publisher Reward} \quad{R^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\ +\end{aligned} $$ +In this example, the delegator pays a 2% fee on their rewards to the publisher. This fee is deducted from the delegator's reward and added to the publisher's reward. + + +# Example 5: Slashing event on the pool + +This example demonstrates the impact of a slashing event on the staked PYTH tokens. + $$ -\text{Delegator Reward} \quad{R^d_p} = {R_p} - {R^p_p} = 10 - 10 = 0 +\begin{aligned} +\quad{S^p_p} &= 200 \\ +\quad{S^d_p} &= 300 \\ +\quad{S^p} &= {S^p_p} + {S^d_p} = 200 + 300 = 500 \\ +\quad{C}_p &= 500 \\ +\quad{R_p} &= min({S}_p, {C}_p) = min(500, 500) = 500 \\ +\quad{r} &= 10\% \\ +\quad{f} &= 2\% \\ + +\quad{R_p} &= {r} \times {R_p} = 10\% \times 500 = 50 \\ +\quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 200 = 20 \\ +\quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 20 = 30 \\ +\text{Fee paid by Delegator} \quad{F^d_p} &= {f} \times {R^d_p} = 2\% \times 30 = 0.6 \\ + +\text{Slashed percentage}\quad{z} &= 50\% \\ +\text{Final Delegator Reward} \quad{\Pi^d_p} &= ( R^p_p + f \cdot R^d_p ) - z \cdot S^p_p = (20 + 0.6) - 0.5 \cdot 200 = 20.6 - 100 = -79.4 \\ +\text{Total Publisher Reward} \quad{\Pi^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\ +\end{aligned} $$ + +In this example, the publisher's stake is slashed by 50%. This means that the publisher's stake is reduced to 100 and the delegator's stake remains the same. + + + +{/* */} + diff --git a/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx b/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx index d35e0dc5..bb8d5de7 100644 --- a/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx @@ -97,7 +97,7 @@ $$ Where: - $\Pi^p_p$ is the net reward received by the publisher $p$ after slashing. -- $\Pi^d_p$ is the net reward received by the delegator $p$ after slashing. +- $\Pi^d_p$ is the net reward received by the delegators after slashing. - $f$ is the delegation fee charged by the publisher. - $z$ is the slashing rate. - $S^p_p$ is the amount self-staked by the publisher $p$. From 035583c589d22d07be86f1e6d05043cee220c09d Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Wed, 11 Sep 2024 20:21:14 +0530 Subject: [PATCH 07/45] calculations --- .../home/pyth-token/oracle-integrity-staking/examples.mdx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx index cd31f3f8..e0c08db3 100644 --- a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx @@ -107,10 +107,13 @@ $$ \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 200 = 20 \\ \quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 20 = 30 \\ \text{Fee paid by Delegator} \quad{F^d_p} &= {f} \times {R^d_p} = 2\% \times 30 = 0.6 \\ +\text{Final Delegator Reward} \quad{R^d_p} &= {R^d_p} - {F^d_p} = 30 - 0.6 = 29.4 \\ +\text{Total Publisher Reward} \quad{R^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\ \text{Slashed percentage}\quad{z} &= 50\% \\ -\text{Final Delegator Reward} \quad{\Pi^d_p} &= ( R^p_p + f \cdot R^d_p ) - z \cdot S^p_p = (20 + 0.6) - 0.5 \cdot 200 = 20.6 - 100 = -79.4 \\ -\text{Total Publisher Reward} \quad{\Pi^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\ + +\text{Net Publisher Stake} \quad{\Pi^p_p} = ( R^p_p + f \cdot R^d_p ) - z \cdot S^p_p = (20 + 0.6) - 0.5 \cdot 200 = 20.6 - 100 = -79.4 \\ +\text{Net Deligator Stake} \quad{\Pi^d_p} = R^d_p - ( f \cdot R^d_p + z \cdot S^d_p ) = 30 - ( 0.6 + 0.5 \cdot 300 ) = 30 - 150.6 = -120.6 \\ \end{aligned} $$ From 5e8b8d2b374c7b681a08986600312fcd197ac05d Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 12 Sep 2024 05:31:03 +0530 Subject: [PATCH 08/45] changes --- pages/home/pyth-token/oracle-integrity-staking.mdx | 6 +++--- .../mathematical-representation.mdx | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/home/pyth-token/oracle-integrity-staking.mdx b/pages/home/pyth-token/oracle-integrity-staking.mdx index 9c04e79f..21f36c90 100644 --- a/pages/home/pyth-token/oracle-integrity-staking.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking.mdx @@ -19,17 +19,17 @@ The core design principles behind OIS include the following: ## Implementation -OIS implements the principle above through the following structure: +OIS implements the design principles above through the following structure: 1. OIS is subject to the same 7-day epoch as Governance voting. All parameters used in the OIS protocol are captured at each start of the epoch on Thursdays at 0:00 UTC and remain constant until the end of the epoch. Staking into OIS is also subject to warmup and cooldown period prior and post epoch respectively. 2. Each publisher is programmatically assigned a staking pool where they can self-stake and to which other stakers can delegate - The staking pool assigned to each publisher covers all price feeds/symbols they publish. - Each staking pool has a soft cap. This soft cap dynamically expands and shrinks given the number of symbols published by the assigned publisher. - - Price feeds with a low number of publishers contribute less to the cap's expansion. + - Price feeds with a low number of publishers contribute more to the cap's expansion. - Staking into the pool can exceed the soft cap. However no rewards are paid nor penalties are levied on the excess amount. - The OIS protocol prioritizes self-stake attributed to the **publisher's stake** when distributing rewards to the publisher's pool. - - All staking pools charge the same delegation fee for stakers who are delating stake to one or many pools. + - All staking pools charge the same delegation fee for stakers who are delegating stake to one or many pools. 3. Each pool has a maximum reward rate per epoch, which applies only to the staked amount within the soft cap. 4. The total amount of rewards paid to all pools is bound by the same cap relative to the amount of rewards available to the OIS protocol. 5. Slashing of stake has a hard cap and only impacts pools that assigned to publishers responsible for the poor data quality. Both self-stakers and delegators are also slashed proportionally to their staked amount in the impacted pools. diff --git a/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx b/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx index bb8d5de7..c46078a5 100644 --- a/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx @@ -17,7 +17,7 @@ Where: - $M$ is a constant parameter representing the target stake per symbol. - $\text{Symbols\_p}$ is the number of symbols published by the publisher $p$. -- $n_s$ is the number of elements in Symbols_p , or $n_s$ = $|\text{Symbols\_p}|$ +- $n_s$ be the number of publishers for symbol $s$. - $Z$ is a constant parameter to control cap contribution from symbols with a low number of publishers. This formula actually ensures that symbols with a lower number of publishers contribute more to the overall cap, while symbols with a higher number of publishers contribute less. This is because the contribution of each symbol is inversely proportional to the number of publishers (or Z, whichever is larger). @@ -33,7 +33,7 @@ $$ Where: -- $y$ is the cap to the rate of rewards for any pool. +- $y$ is the yearly cap to the rate of rewards for any pool. - $S_p$ be the stake assigned to the publisher p pool , made of self-staked amount $S^{p}_{p}$ and delegated stake $S^{d}_{p}$ , or $S_{p} = S^{p}_{p} + S^{d}_{p}$. - $C_p$ be the stake cap for the pool assigned to publisher p. From b43df1740ba04bf7bc78ac4a47961be93c3b12ed Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 12 Sep 2024 05:54:57 +0530 Subject: [PATCH 09/45] changes --- .../pyth-token/oracle-integrity-staking/examples.mdx | 8 ++++---- .../mathematical-representation.mdx | 10 +++++----- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx index e0c08db3..180d22f3 100644 --- a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx @@ -110,14 +110,14 @@ $$ \text{Final Delegator Reward} \quad{R^d_p} &= {R^d_p} - {F^d_p} = 30 - 0.6 = 29.4 \\ \text{Total Publisher Reward} \quad{R^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\ -\text{Slashed percentage}\quad{z} &= 50\% \\ +\text{Slashed percentage}\quad{w} &=50\% \\ -\text{Net Publisher Stake} \quad{\Pi^p_p} = ( R^p_p + f \cdot R^d_p ) - z \cdot S^p_p = (20 + 0.6) - 0.5 \cdot 200 = 20.6 - 100 = -79.4 \\ -\text{Net Deligator Stake} \quad{\Pi^d_p} = R^d_p - ( f \cdot R^d_p + z \cdot S^d_p ) = 30 - ( 0.6 + 0.5 \cdot 300 ) = 30 - 150.6 = -120.6 \\ +\text{Net Publisher Stake} \quad{\Pi^p_p} = ( R^p_p + f \cdot R^d_p ) - w \cdot S^p_p = (20 + 0.6) - 0.5 \cdot 200 = 20.6 - 100 = -79.4 \\ +\text{Net Deligator Stake} \quad{\Pi^d_p} = R^d_p - ( f \cdot R^d_p + w \cdot S^d_p ) = 30 - ( 0.6 + 0.5 \cdot 300 ) = 30 - 150.6 = -120.6 \\ \end{aligned} $$ -In this example, the publisher's stake is slashed by 50%. This means that the publisher's stake is reduced to 100 and the delegator's stake remains the same. +In this example, the publisher's stake is slashed by 50%. This means that the publisher's stake is reduced by 79.4 PYTH tokens and the delegator's stake is reduced by 120.6 PYTH tokens. diff --git a/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx b/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx index c46078a5..d7803fb3 100644 --- a/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx @@ -70,13 +70,13 @@ Slashing is an important aspect of the OIS protocol to ensure the integrity of t The slashed amount for each pool is calculated as follows: $$ -\large{SL_p = z \cdot S_p = z \cdot (S^{p}_{p} + S^{d}_{p})} +\large{SL_p = w \cdot S_p = w \cdot (S^{p}_{p} + S^{d}_{p})} $$ Where: - $SL_p$ is the slashed amount for the publisher $p$ pool. -- $z$ is the slashing rate. +- $w$ is the slashing rate. - $S_p$ is the stake assigned to the publisher $p$ pool , made of self-staked amount $S^{p}_{p}$ and delegated stake $S^{d}_{p}$ , or $S_{p} = S^{p}_{p} + S^{d}_{p}$. Here $SL_p$ is uniformly allocated to both the self-staking publisher and delegators in the pool, pro-rata to their respective stake. @@ -87,11 +87,11 @@ Here $SL_p$ is uniformly allocated to both the self-staking publisher and delega Subsequently, the rewards received by a publisher and delegators into a pool, net of any slashed amounts can be expressed as below: $$ -\large{\Pi^p_p = ( R^p_p + f \cdot R^d_p ) - z \cdot S^p_p} +\large{\Pi^p_p = ( R^p_p + f \cdot R^d_p ) - w \cdot S^p_p} $$ $$ -\large{\Pi^d_p = R^d_p - ( f \cdot R^d_p + z \cdot S^d_p )} +\large{\Pi^d_p = R^d_p - ( f \cdot R^d_p + w \cdot S^d_p )} $$ Where: @@ -99,6 +99,6 @@ Where: - $\Pi^p_p$ is the net reward received by the publisher $p$ after slashing. - $\Pi^d_p$ is the net reward received by the delegators after slashing. - $f$ is the delegation fee charged by the publisher. -- $z$ is the slashing rate. +- $w$ is the slashing rate. - $S^p_p$ is the amount self-staked by the publisher $p$. - $S^d_p$ is the amount delegated to the publisher $p$. From dd0632fae924e54df211303928dd79e40a858a08 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 12 Sep 2024 06:04:35 +0530 Subject: [PATCH 10/45] align --- .../oracle-integrity-staking/examples.mdx | 27 ++++++++++++++++--- 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx index 180d22f3..32f7dcbe 100644 --- a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx +++ b/pages/home/pyth-token/oracle-integrity-staking/examples.mdx @@ -109,14 +109,33 @@ $$ \text{Fee paid by Delegator} \quad{F^d_p} &= {f} \times {R^d_p} = 2\% \times 30 = 0.6 \\ \text{Final Delegator Reward} \quad{R^d_p} &= {R^d_p} - {F^d_p} = 30 - 0.6 = 29.4 \\ \text{Total Publisher Reward} \quad{R^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\ - \text{Slashed percentage}\quad{w} &=50\% \\ - -\text{Net Publisher Stake} \quad{\Pi^p_p} = ( R^p_p + f \cdot R^d_p ) - w \cdot S^p_p = (20 + 0.6) - 0.5 \cdot 200 = 20.6 - 100 = -79.4 \\ -\text{Net Deligator Stake} \quad{\Pi^d_p} = R^d_p - ( f \cdot R^d_p + w \cdot S^d_p ) = 30 - ( 0.6 + 0.5 \cdot 300 ) = 30 - 150.6 = -120.6 \\ \end{aligned} $$ + +$$ +\begin{equation} +\begin{split} \text{Net Publisher Stake} \quad{\Pi^p_p} +& = ( R^p_p + f \cdot R^d_p ) - w \cdot S^p_p \\ +& = (20 + 0.6) - 0.5 \cdot 200 \\ +& = 20.6 - 100 \\ +& = -79.4 +\end{split} +\end{equation} +$$ + +$$ +\begin{equation} +\begin{split} \text{Net Deligator Stake} \quad{\Pi^d_p} +& = R^d_p - ( f \cdot R^d_p + w \cdot S^d_p ) \\ +& = 30 - ( 0.6 + 0.5 \cdot 300 ) \\ +& = 30 - 150.6 \\ +& = -120.6 +\end{split} +\end{equation} +$$ + In this example, the publisher's stake is slashed by 50%. This means that the publisher's stake is reduced by 79.4 PYTH tokens and the delegator's stake is reduced by 120.6 PYTH tokens. From 16ba05351e63080741d686056409ff39379a548c Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 12 Sep 2024 14:57:24 +0530 Subject: [PATCH 11/45] added publisher ranking --- pages/home/_meta.json | 1 + .../oracle-integrity-staking.mdx | 0 .../oracle-integrity-staking/_meta.json | 0 .../oracle-integrity-staking/examples.mdx | 0 .../mathematical-representation.mdx | 0 .../publisher-quality-ranking.mdx | 84 +++++++++++++++++++ pages/home/pyth-token/_meta.json | 1 - 7 files changed, 85 insertions(+), 1 deletion(-) rename pages/home/{pyth-token => }/oracle-integrity-staking.mdx (100%) rename pages/home/{pyth-token => }/oracle-integrity-staking/_meta.json (100%) rename pages/home/{pyth-token => }/oracle-integrity-staking/examples.mdx (100%) rename pages/home/{pyth-token => }/oracle-integrity-staking/mathematical-representation.mdx (100%) create mode 100644 pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx diff --git a/pages/home/_meta.json b/pages/home/_meta.json index fa7c78fb..cb30232f 100644 --- a/pages/home/_meta.json +++ b/pages/home/_meta.json @@ -32,6 +32,7 @@ }, "pyth-token": "PYTH Token", + "oracle-integrity-staking": "Oracle Integrity Staking (OIS)", "metrics": "Pyth Metrics", "whitepaper": "Whitepaper", "security": "Security" diff --git a/pages/home/pyth-token/oracle-integrity-staking.mdx b/pages/home/oracle-integrity-staking.mdx similarity index 100% rename from pages/home/pyth-token/oracle-integrity-staking.mdx rename to pages/home/oracle-integrity-staking.mdx diff --git a/pages/home/pyth-token/oracle-integrity-staking/_meta.json b/pages/home/oracle-integrity-staking/_meta.json similarity index 100% rename from pages/home/pyth-token/oracle-integrity-staking/_meta.json rename to pages/home/oracle-integrity-staking/_meta.json diff --git a/pages/home/pyth-token/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx similarity index 100% rename from pages/home/pyth-token/oracle-integrity-staking/examples.mdx rename to pages/home/oracle-integrity-staking/examples.mdx diff --git a/pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx b/pages/home/oracle-integrity-staking/mathematical-representation.mdx similarity index 100% rename from pages/home/pyth-token/oracle-integrity-staking/mathematical-representation.mdx rename to pages/home/oracle-integrity-staking/mathematical-representation.mdx diff --git a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx new file mode 100644 index 00000000..d16221db --- /dev/null +++ b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx @@ -0,0 +1,84 @@ +import { Callout} from "nextra/components"; + +# Publisher Quality Ranking + +This document introduces a quality ranking system to ensure high-quality pricing data on Pythnet. The ranking system will use **three** metrics to evaluate each publisher's performance: +- Uptime (40% weight), +- Price deviation (40% weight), +- Lack of stalled prices (20% weight). + +The ranking will be calculated **monthly** to ensure that only the top-performing publishers remain permissioned for each price feed on Pythnet. + +**Important: Publishers with an uptime of at least 50% from the previous week will be included in the ranking. If a publisher's uptime is less than 50%, then the deviation and the stalled score of the publisher will be 0 to reflect their ineligibility.** + +Publishers in Pythtest conformance who are not publishing on Pythnet and pass this uptime condition will also be ranked together with the Pythnet publishers for each symbol. + +## Metrics Used for Ranking + +The three metrics used for ranking are: + +### Uptime + +This metric measures the percentage of time a publisher is available and actively publishing data. A higher numerical score indicates a higher uptime maintained for the price feed. Score range: 0-1. + +### Price Deviation + +This metric measures deviations that occur between a publishers' price and the aggregate price, normalized by the aggregate confidence interval. A higher numerical score indicates a lower degree of price deviation. Score range: 0-1. + +### Lack of Stalled Prices + +This metric penalizes publishers reporting the same value for the price of an asset for at least 100 consecutive slots because such instances indicate potential data staleness. Publishers with fewer stalled prices will get a higher score. Score range: 0-1. + +## Ranking Algorithm + +Each metric is assigned a weight as mentioned above, and the score for each metric is calculated based on the publisher's performance. +The scores from each metrics are aggregated with respect to their weights to get the final score for each publisher. +The weight distribution is as follows: +- Uptime: 40% +- Price deviation: 40% +- Lack of stalled prices: 20% + +Publishers are then sorted based on their final scores with the highest score indicating the best performance. +As mentioned earlier, the score for each metric range from 0 to 1, where 1 represents the best performance. +Each publisher will also be assigned a rank based on their final scores, where lower ranks are assigned to publishers with higher scores indicating better performance. + +## Metric Calculations + +This section provides a detailed breakdown of how each metric is calculated. + +### Uptime + +Uptime measures a publisher's reliability and availability. If a publisher consistently provides data without interruptions, it indicates a high level of reliability. This is aligned with the current conformance testing/PRP, which checks the publsiher's availability based on price publication within 10 slots. + + +$$ +\text{Score}_{\text{Uptime}} = \frac{\text{Publisher Slot Count}}{\text{Aggregate Slot Count}} +$$ + +Uptime is given **40% weight** in the final ranking. + + +**Reason for Weight:** Uptime is the most critical metric because consistent data availability is fundamental for ensuring a data feed's overall quality and reliability. A publisher that is frequently unable to publish for every set number of slots or unavailable would significantly disrupt the service, hence the high weight of 40%. + + +### Price Deviation + +This metric evaluates the deviations between the publisher's price and the aggregate price, normalized by the aggregate's confidence interval. + +$$ +\text{Penalty}_{\text{Deviation}} = +\frac{1}{N} \sum_{i=1}^{N} \left( \frac{|P_i - A_i|}{{CI}_i} \right)^2 +$$ + +$$ +\text{Score}_{\text{Deviation}} = \frac{{\text{NumPublishers}}-{\text{Rank}}(\text{Penalty}_\text{Deviation}) + 1}{\text{NumPublishers}} +$$ + +Where: +- $N$ is the total number of prices +- $P_i$ is the publisher's price at instance $i$ +- $A_i$ is the aggregate price at instance $i$ +- ${CI}_i$ is the aggregate confidence interval at instance $i$ + +Price deviation is given **40% weight** in the final ranking. + diff --git a/pages/home/pyth-token/_meta.json b/pages/home/pyth-token/_meta.json index d39ce06a..5a14bb39 100644 --- a/pages/home/pyth-token/_meta.json +++ b/pages/home/pyth-token/_meta.json @@ -1,5 +1,4 @@ { - "oracle-integrity-staking": "Oracle Integrity Staking (OIS)", "pyth-distribution": "PYTH Token Distribution", "pyth-token-addresses": "PYTH Token Contract Addresses" } From 486245f426314a11bb749b9b6fd627254ff98614 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 12 Sep 2024 16:04:01 +0530 Subject: [PATCH 12/45] publisher ranking done --- .../publisher-quality-ranking.mdx | 42 +++++++++++++++++-- 1 file changed, 38 insertions(+), 4 deletions(-) diff --git a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx index d16221db..86077286 100644 --- a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx +++ b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx @@ -4,8 +4,8 @@ import { Callout} from "nextra/components"; This document introduces a quality ranking system to ensure high-quality pricing data on Pythnet. The ranking system will use **three** metrics to evaluate each publisher's performance: - Uptime (40% weight), -- Price deviation (40% weight), -- Lack of stalled prices (20% weight). +- Price Deviation (40% weight), +- Lack of Stalled Prices (20% weight). The ranking will be calculated **monthly** to ensure that only the top-performing publishers remain permissioned for each price feed on Pythnet. @@ -13,6 +13,8 @@ The ranking will be calculated **monthly** to ensure that only the top-performin Publishers in Pythtest conformance who are not publishing on Pythnet and pass this uptime condition will also be ranked together with the Pythnet publishers for each symbol. +[Pubslisher Rankings](https://www.pyth.network/publishers/ranking) on the main website shows the updated rank of the publishers. + ## Metrics Used for Ranking The three metrics used for ranking are: @@ -35,8 +37,8 @@ Each metric is assigned a weight as mentioned above, and the score for each metr The scores from each metrics are aggregated with respect to their weights to get the final score for each publisher. The weight distribution is as follows: - Uptime: 40% -- Price deviation: 40% -- Lack of stalled prices: 20% +- Price Deviation: 40% +- Lack of Stalled Prices: 20% Publishers are then sorted based on their final scores with the highest score indicating the best performance. As mentioned earlier, the score for each metric range from 0 to 1, where 1 represents the best performance. @@ -80,5 +82,37 @@ Where: - $A_i$ is the aggregate price at instance $i$ - ${CI}_i$ is the aggregate confidence interval at instance $i$ + +It is calculated similarly to a z-score, where the aggregate price $A_i$ is the mean, and the aggregate confidence interval $CI_i$ is the Standard Deviation. A higher deviation score indicates that the publisher's prices are significantly inconsistent with the aggregate prices, especially when these deviations exceed the confidence interval. The $\text{Score}_{\text{Deviation}}$ is calculated by ranking the $\text{Penalty}_{\text{Deviation}}$ among all publishers and expressing this rank as a percentage of the total number of publishers. + Price deviation is given **40% weight** in the final ranking. +**Reason for Weight:** To maintain trust in the data published on a feed, it is crucial to ensure that reported prices are within a reasonable range of the aggregate price when adjusted for confidence intervals. Significant inconsistencies can undermine confidence in the published data, hence the weight of 40%. + + +### Lack of Stalled Prices + +This metric checks if the publisher is reporting the same price continuously for a specified duration. Repeated prices over an extended period can indicate data staleness or a problem with the data feed. + +$$ +\text{Penalty}_{\text{Stalled}} = \frac{1}{N} \sum_{i=T+1}^{N} \mathbf{1} \left( P_i = P_{i-1} = \cdots = P_{i-T} \right) +$$ + +$$ +\text{Score}_{\text{Stalled}} = \max \text((1 - \text{Penalty}_{\text{Stalled}} \times 10) , 0) +$$ + + +Where: +- $N$ is the total number of slots for the aggregate price. +- $T$ is the duration threshold for staleness in slot. The threshold is $100$ slots (or about $40$ seconds) for all the symbols but can change in the future on a per-symbol basis. +- $P_i$ is the price reported by the publisher at time $i$. +- $\mathbf{1}(\cdot)$ is an indicator function that returns 1 if the condition inside it is true and 0 otherwise. +- $\text{Penalty}_{\text{Stalled}}$ calculates the fraction of time periods where the price remains unchanged for T consecutive intervals. +- $\text{Score}_{\text{Stalled}} $ adjusts the raw stalled penalty multiplied by $10$ to a score out of 1, which penalizes higher staleness rates. It means that if a publisher publishes stalled prices more than 10% of the times, it will get the score of 0. + +This metric is given **20% weight** in the final ranking. + +**Reason for Weight:** Staleness in data can mislead users into thinking the market conditions are unchanged, which can be detrimental in volatile market conditions. While important, measuring data staleness is deemed relatively less critical than evaluating uptime and price accuracy, hence a weight of 20%. + + From 466e9d7efaf116b08cb8f32c2afbd7b4f21bbd82 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Thu, 12 Sep 2024 12:42:35 +0200 Subject: [PATCH 13/45] edits and fixes to examples --- .../oracle-integrity-staking/examples.mdx | 91 ++++++------------- .../mathematical-representation.mdx | 34 +++---- 2 files changed, 41 insertions(+), 84 deletions(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 32f7dcbe..88a59aa8 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -8,7 +8,7 @@ NOTE: All the symbols used in the examples are explained in the [Mathematical Re ## Example 1: Only Publisher Stake -This example take the case where only the publisher has staked PYTH tokens. +This example take the case one pool assigned where the publisher assigned has staked PYTH tokens, while the pool has no tokens delegated to it. $$ \begin{aligned} @@ -16,29 +16,29 @@ $$ {S^d_p} &= 0 \\ {S^p} &= {S^p_p} + {S^d_p} = 100 + 0 = 100 \\ {C}_p &= 500 \\ -\text{Total Amount eligible for Reward} \quad{R_p} &= min({S}_p, {C}_p) = min(500, 100) = 100 \\ -\text{Reward Rate} \quad{r} &= 10\% \\ +\text{Total Amount eligible for Reward} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 100) = 100 \\ +\text{Reward Rate (Yearly)} \quad{r} &= 10\% \\ -\text{Total Reward} \quad{R_p} &= {r} \times {E_p} = 10\% \times 100 = 10 \\ +\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 100 = 10 \\ \text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\ \text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 10 - 10 = 0 \\ \end{aligned} $$ - # Example 2: Publisher and Delegator Stake -This example take the case where both the publisher and the delegator have staked PYTH tokens. +This example take the case where the pool has stake from both the publisher and the delegator. $$ \begin{aligned} {S^p_p} &= 100 \\ {S^d_p} &= 100 \\ -{S^p} &= {S^p_p} + {S^d_p} = 100 + 100 = 200 \\ +{S_p} &= {S^p_p} + {S^d_p} = 100 + 100 = 200 \\ {C}_p &= 500 \\ -\text{Total Amount eligible for Reward} \quad{R_p} &= min({S}_p, {C}_p) = min(500, 200) = 200 \\ -\text{Reward Rate} \quad{r} &= 10\% \\ -\text{Total Reward} \quad{R_p} &= {r} \times {E_p} = 10\% \times 200 = 20 \\ +\text{Total Amount eligible for Reward} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 200) = 200 \\ +\text{Reward Rate (Yearly)} \quad{r} &= 10\% \\ + +\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 200 = 20 \\ \text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\ \text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 20 - 10 = 10 \\ \end{aligned} @@ -46,34 +46,34 @@ $$ # Example 3: Publisher and Delegator Stake more than the Cap -This example take the case where the combined stake of both the publisher and the delegator is more than the cap. +This example take the case where the combined stake of both the publisher and the delegator exceeds the cap. $$ \begin{aligned} {S^p_p} &= 300 \\ {S^d_p} &= 300 \\ -{S^p} &= {S^p_p} + {S^d_p} = 300 + 300 = 600 \\ +{S_p} &= {S^p_p} + {S^d_p} = 300 + 300 = 600 \\ {C}_p &= 500 \\ -\text{Total Amount eligible for Reward} \quad{R_p} &= min({S}_p, {C}_p) = min(500, 600) = 500 \\ -\text{Reward Rate} \quad{r} &= 10\% \\ -\text{Total Reward} \quad{R_p} &= {r} \times {E_p} = 10\% \times 500 = 50 \\ +\text{Total Amount eligible for Reward} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 600) = 500 \\ +\text{Reward Rate (Yearly)} \quad{r} &= 10\% \\ + +\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 500 = 50 \\ \text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 300 = 30 \\ \text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 30 = 20 \\ \end{aligned} $$ - # Example 4: Introducing Delegator Fees -This example demonstrates how delegator fees affect the reward distribution between publishers and delegators. +This example demonstrates how the delegation fee affect the reward distribution between the publisher and the delegator. $$ \begin{aligned} \quad{S^p_p} &= 200 \\ \quad{S^d_p} &= 300 \\ -\quad{S^p} &= {S^p_p} + {S^d_p} = 200 + 300 = 500 \\ +\quad{S_p} &= {S^p_p} + {S^d_p} = 200 + 300 = 500 \\ \quad{C}_p &= 500 \\ -\quad{R_p} &= min({S}_p, {C}_p) = min(500, 500) = 500 \\ +\quad{E_p} &= min({S}_p, {C}_p) = min(500, 500) = 500 \\ \quad{r} &= 10\% \\ \quad{f} &= 2\% \\ @@ -86,59 +86,26 @@ $$ \end{aligned} $$ -In this example, the delegator pays a 2% fee on their rewards to the publisher. This fee is deducted from the delegator's reward and added to the publisher's reward. - +In the example, the delegator pays a 2\% fee on their rewards to the publisher. This fee is deducted from the delegator's reward and added to the publisher's reward. # Example 5: Slashing event on the pool -This example demonstrates the impact of a slashing event on the staked PYTH tokens. +This example demonstrates the impact of a slashing event on the staked PYTH tokens and rewards distributed to both the publisher and the delegator. $$ \begin{aligned} -\quad{S^p_p} &= 200 \\ -\quad{S^d_p} &= 300 \\ -\quad{S^p} &= {S^p_p} + {S^d_p} = 200 + 300 = 500 \\ -\quad{C}_p &= 500 \\ -\quad{R_p} &= min({S}_p, {C}_p) = min(500, 500) = 500 \\ -\quad{r} &= 10\% \\ -\quad{f} &= 2\% \\ - -\quad{R_p} &= {r} \times {R_p} = 10\% \times 500 = 50 \\ -\quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 200 = 20 \\ -\quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 20 = 30 \\ -\text{Fee paid by Delegator} \quad{F^d_p} &= {f} \times {R^d_p} = 2\% \times 30 = 0.6 \\ -\text{Final Delegator Reward} \quad{R^d_p} &= {R^d_p} - {F^d_p} = 30 - 0.6 = 29.4 \\ -\text{Total Publisher Reward} \quad{R^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\ -\text{Slashed percentage}\quad{w} &=50\% \\ -\end{aligned} -$$ +\quad{S^p_p} &= 300 \\ +\quad{S^d_p} &= 200 \\ +\quad{S_p} &= {S^p_p} + {S^d_p} = 300 + 200 = 500 \\ +\text{Maximum slashing rate}\quad{z} &= 5\% \\ -$$ -\begin{equation} -\begin{split} \text{Net Publisher Stake} \quad{\Pi^p_p} -& = ( R^p_p + f \cdot R^d_p ) - w \cdot S^p_p \\ -& = (20 + 0.6) - 0.5 \cdot 200 \\ -& = 20.6 - 100 \\ -& = -79.4 -\end{split} -\end{equation} -$$ +\text{Publisher Stake post slashing}\quad{S^p_p_{ps}} &= (1 - 5\%) \times 300 = 285 \\ +\text{Delegator Stake post slashing}\quad{S^d_p_{ps}} &= (1 - 5\%) \times 200 = 190 \\ -$$ -\begin{equation} -\begin{split} \text{Net Deligator Stake} \quad{\Pi^d_p} -& = R^d_p - ( f \cdot R^d_p + w \cdot S^d_p ) \\ -& = 30 - ( 0.6 + 0.5 \cdot 300 ) \\ -& = 30 - 150.6 \\ -& = -120.6 -\end{split} -\end{equation} +\end{aligned} $$ -In this example, the publisher's stake is slashed by 50%. This means that the publisher's stake is reduced by 79.4 PYTH tokens and the delegator's stake is reduced by 120.6 PYTH tokens. - - +In this example, the stake is uniformly slashed by 5\%, affecting both the publisher and the delegator. Slashing impact the total stake into the pool, regardless of the Cap. {/* */} - diff --git a/pages/home/oracle-integrity-staking/mathematical-representation.mdx b/pages/home/oracle-integrity-staking/mathematical-representation.mdx index d7803fb3..744f522d 100644 --- a/pages/home/oracle-integrity-staking/mathematical-representation.mdx +++ b/pages/home/oracle-integrity-staking/mathematical-representation.mdx @@ -1,14 +1,13 @@ # Mathematical Representation -This section outlines the mathematical representation of the Oracle Integrity Staking (OIS) protocol. +This section outlines the mathematical representation of the Oracle Integrity Staking (OIS) protocol. -As explained in the [implementation](./implementation.mdx) section, every publisher is assigned a staking pool where they can self-stake and to which other stakers can delegate. +As explained in the [implementation](./implementation.mdx) section, every publisher is assigned a staking pool where they can self-stake and to which other stakers can delegate. ## Pool Cap The **pool cap** is calculated as follows: - $$ \large{\text{Pool Cap}: {\bold{C_p}} = M \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{\max(n_s, Z)}} $$ @@ -16,16 +15,15 @@ $$ Where: - $M$ is a constant parameter representing the target stake per symbol. -- $\text{Symbols\_p}$ is the number of symbols published by the publisher $p$. +- $\text{Symbols\_p}$ is the set of symbols published by the publisher $p$. - $n_s$ be the number of publishers for symbol $s$. - $Z$ is a constant parameter to control cap contribution from symbols with a low number of publishers. -This formula actually ensures that symbols with a lower number of publishers contribute more to the overall cap, while symbols with a higher number of publishers contribute less. This is because the contribution of each symbol is inversely proportional to the number of publishers (or Z, whichever is larger). - +This formula ensures that symbols with a lower number of publishers contribute more to the overall cap, while symbols with a higher number of publishers contribute less. This is because the contribution of each symbol is inversely proportional to the number of publishers (or Z, whichever is larger). ## Reward -The reward $R_p$ paid to each pool is calculated as follows: +The reward $R_p$ distributed to each pool is calculated as follows: $$ \large{R_p = y \cdot \min(S_p, C_p)} @@ -33,25 +31,21 @@ $$ Where: -- $y$ is the yearly cap to the rate of rewards for any pool. +- $y$ is the cap to the rate of rewards for any pool - $S_p$ be the stake assigned to the publisher p pool , made of self-staked amount $S^{p}_{p}$ and delegated stake $S^{d}_{p}$ , or $S_{p} = S^{p}_{p} + S^{d}_{p}$. - $C_p$ be the stake cap for the pool assigned to publisher p. -The reward is capped at the pool cap, $C_p$, to ensure that publishers and delegators are not over-rewarded. (I don't this this is necessary to mention, but it is a good sanity check) - - -The total amount of rewards paid to all pools is bound the the same cap relative to the amount of rewards available to the OIS protocol. +The total amount of rewards distributed to all pools is bound the the same cap relative to the amount of rewards available to the OIS protocol. $$ \large{\sum_{p \in \text{Publishers}} R_p \leq y \cdot \min(NumSymbols \cdot M, \sum_{p=1}^{P} S_p)} $$ -Where: +Where: - $NumSymbols$ is the total number of symbols in the system. - $P$ is the total number of publishers in the system. - Whereas the reward component relative to the amount self-staked by the publisher $p$ is defined as: $$ @@ -62,10 +56,9 @@ Where: - $R^d_p$ is the reward component relative to the amount delegated to the publisher $p$. - ## Slashing -Slashing is an important aspect of the OIS protocol to ensure the integrity of the system. +Slashing is an important aspect of the OIS protocol to ensure the integrity of the system. The slashed amount for each pool is calculated as follows: @@ -81,10 +74,7 @@ Where: Here $SL_p$ is uniformly allocated to both the self-staking publisher and delegators in the pool, pro-rata to their respective stake. - - - -Subsequently, the rewards received by a publisher and delegators into a pool, net of any slashed amounts can be expressed as below: +Subsequently, the rewards received by a publisher and delegators into a pool, net of any slashed amounts can be expressed as below: $$ \large{\Pi^p_p = ( R^p_p + f \cdot R^d_p ) - w \cdot S^p_p} @@ -94,11 +84,11 @@ $$ \large{\Pi^d_p = R^d_p - ( f \cdot R^d_p + w \cdot S^d_p )} $$ -Where: +Where: - $\Pi^p_p$ is the net reward received by the publisher $p$ after slashing. - $\Pi^d_p$ is the net reward received by the delegators after slashing. -- $f$ is the delegation fee charged by the publisher. +- $f$ is the delegation fee charged by the pool. - $w$ is the slashing rate. - $S^p_p$ is the amount self-staked by the publisher $p$. - $S^d_p$ is the amount delegated to the publisher $p$. From dfafea879c3fa4a2b37130627f9f4e0790ef220e Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:02:39 +0200 Subject: [PATCH 14/45] minor fix --- pages/home/oracle-integrity-staking/examples.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 88a59aa8..5becd59d 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -100,8 +100,8 @@ $$ \text{Maximum slashing rate}\quad{z} &= 5\% \\ -\text{Publisher Stake post slashing}\quad{S^p_p_{ps}} &= (1 - 5\%) \times 300 = 285 \\ -\text{Delegator Stake post slashing}\quad{S^d_p_{ps}} &= (1 - 5\%) \times 200 = 190 \\ +\text{Publisher Stake post slashing}\quad{S^p_p} &= (1 - 5\%) \times 300 = 285 \\ +\text{Delegator Stake post slashing}\quad{S^d_p} &= (1 - 5\%) \times 200 = 190 \\ \end{aligned} $$ From 25fc2457f8cbb07b1162aaa9837a0e8af14de7e6 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Thu, 12 Sep 2024 13:07:13 +0200 Subject: [PATCH 15/45] minor formatting changes --- pages/home/oracle-integrity-staking/examples.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 5becd59d..a68e5260 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -25,7 +25,7 @@ $$ \end{aligned} $$ -# Example 2: Publisher and Delegator Stake +## Example 2: Publisher and Delegator Stake This example take the case where the pool has stake from both the publisher and the delegator. @@ -44,7 +44,7 @@ $$ \end{aligned} $$ -# Example 3: Publisher and Delegator Stake more than the Cap +## Example 3: Publisher and Delegator Stake more than the Cap This example take the case where the combined stake of both the publisher and the delegator exceeds the cap. @@ -63,7 +63,7 @@ $$ \end{aligned} $$ -# Example 4: Introducing Delegator Fees +## Example 4: Introducing Delegator Fees This example demonstrates how the delegation fee affect the reward distribution between the publisher and the delegator. @@ -88,7 +88,7 @@ $$ In the example, the delegator pays a 2\% fee on their rewards to the publisher. This fee is deducted from the delegator's reward and added to the publisher's reward. -# Example 5: Slashing event on the pool +## Example 5: Slashing event on the pool This example demonstrates the impact of a slashing event on the staked PYTH tokens and rewards distributed to both the publisher and the delegator. From 6eb23c7ba6ef4d283f61d7106b621fd5c1480cad Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 12 Sep 2024 18:41:47 +0530 Subject: [PATCH 16/45] requested changes --- .../home/oracle-integrity-staking/publisher-quality-ranking.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx index 86077286..cb222b52 100644 --- a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx +++ b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx @@ -9,7 +9,7 @@ This document introduces a quality ranking system to ensure high-quality pricing The ranking will be calculated **monthly** to ensure that only the top-performing publishers remain permissioned for each price feed on Pythnet. -**Important: Publishers with an uptime of at least 50% from the previous week will be included in the ranking. If a publisher's uptime is less than 50%, then the deviation and the stalled score of the publisher will be 0 to reflect their ineligibility.** +**Important: Publishers with an uptime of at least 50% will be included in the ranking. If a publisher's uptime is less than 50%, then the deviation and the stalled score of the publisher will be 0 to reflect their ineligibility.** Publishers in Pythtest conformance who are not publishing on Pythnet and pass this uptime condition will also be ranked together with the Pythnet publishers for each symbol. From e24087ca026d81506088f450931c8dd257fe8cd7 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Fri, 13 Sep 2024 06:31:54 +0530 Subject: [PATCH 17/45] tiny chnages --- components/StakingCapBar.tsx | 48 ++++++++++++++----- .../oracle-integrity-staking/examples.mdx | 5 +- 2 files changed, 41 insertions(+), 12 deletions(-) diff --git a/components/StakingCapBar.tsx b/components/StakingCapBar.tsx index a6572c99..1ed4a864 100644 --- a/components/StakingCapBar.tsx +++ b/components/StakingCapBar.tsx @@ -5,7 +5,9 @@ interface StakingCapBarProps { height?: number fillPercentage: number secondFillPercentage: number - labelText?: string + firstFillLabel?: string + secondFillLabel?: string + totalLabel?: string } export default function StakingCapBar({ @@ -13,7 +15,9 @@ export default function StakingCapBar({ height = 80, fillPercentage, secondFillPercentage, - labelText + firstFillLabel, + secondFillLabel, + totalLabel }: StakingCapBarProps) { // Ensure fillPercentages are between 0 and 100 const clampedFillPercentage = Math.min(100, Math.max(0, fillPercentage)) @@ -23,7 +27,7 @@ export default function StakingCapBar({ return (
+ > + {firstFillLabel && ( +
+ {firstFillLabel}: {clampedFillPercentage}% +
+ )} +
+ > + {secondFillLabel && ( +
+ {secondFillLabel}: {clampedSecondFillPercentage}% +
+ )} +
- {labelText && ( -
- {labelText}: {totalFillPercentage}% + {totalLabel && ( +
+ {totalLabel}: {totalFillPercentage}%
)}
diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index a68e5260..751c5cea 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -8,7 +8,8 @@ NOTE: All the symbols used in the examples are explained in the [Mathematical Re ## Example 1: Only Publisher Stake -This example take the case one pool assigned where the publisher assigned has staked PYTH tokens, while the pool has no tokens delegated to it. +This example take the case one pool where the pool has stake from only the publisher. + $$ \begin{aligned} @@ -25,6 +26,8 @@ $$ \end{aligned} $$ + + ## Example 2: Publisher and Delegator Stake This example take the case where the pool has stake from both the publisher and the delegator. From 4c219582e41faae5296d66d3ea66831aeb852bc2 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Fri, 13 Sep 2024 10:32:42 +0530 Subject: [PATCH 18/45] interactive sim --- components/RewardSimulator.tsx | 109 ++++++++++++++++++ components/StakingCapBar.tsx | 30 ++--- package-lock.json | 25 ++++ package.json | 1 + pages/home/oracle-integrity-staking.mdx | 17 +-- .../oracle-integrity-staking/examples.mdx | 14 ++- 6 files changed, 174 insertions(+), 22 deletions(-) create mode 100644 components/RewardSimulator.tsx diff --git a/components/RewardSimulator.tsx b/components/RewardSimulator.tsx new file mode 100644 index 00000000..f43b506a --- /dev/null +++ b/components/RewardSimulator.tsx @@ -0,0 +1,109 @@ +import React, { useState, useEffect } from 'react'; +import 'katex/dist/katex.min.css'; +import Latex from 'react-latex-next'; + +const RewardSimulator: React.FC = () => { + const [publisherStake, setPublisherStake] = useState(200); + const [delegatorStake, setDelegatorStake] = useState(300); + const [maxCap, setMaxCap] = useState(500); + const [delegatorFee, setDelegatorFee] = useState(2); + const [rewardRate, setRewardRate] = useState(10); + + const [publisherReward, setPublisherReward] = useState(0); + const [delegatorReward, setDelegatorReward] = useState(0); + + useEffect(() => { + const calculateRewards = () => { + const totalStake = publisherStake + delegatorStake; + const eligibleAmount = Math.min(totalStake, maxCap); + const totalReward = (rewardRate / 100) * eligibleAmount; + + const publisherRewardBase = (rewardRate / 100) * Math.min(publisherStake, maxCap); + const delegatorRewardBase = totalReward - publisherRewardBase; + + const delegatorFeeAmount = (delegatorFee / 100) * delegatorRewardBase; + + const finalDelegatorReward = delegatorRewardBase - delegatorFeeAmount; + const finalPublisherReward = publisherRewardBase + delegatorFeeAmount; + + setPublisherReward(Number(finalPublisherReward.toFixed(2))); + setDelegatorReward(Number(finalDelegatorReward.toFixed(2))); + }; + + calculateRewards(); +}, [publisherStake, delegatorStake, maxCap, delegatorFee, rewardRate]); + +return ( +
+

Reward Simulator

+
+
+ + setPublisherStake(Number(e.target.value))} + className="w-full p-2 border rounded bg-transparent" + /> +
+
+ + setDelegatorStake(Number(e.target.value))} + className="w-full p-2 border rounded bg-transparent" + /> +
+
+ + setMaxCap(Number(e.target.value))} + className="w-full p-2 border rounded bg-transparent" + /> +
+
+ + setDelegatorFee(Number(e.target.value))} + className="w-full p-2 border rounded bg-transparent" + /> +
+
+ + setRewardRate(Number(e.target.value))} + className="w-full p-2 border rounded bg-transparent" + /> +
+
+
+

Calculated Rewards:

+

+ {`Publisher Reward ($R^p_p$): ${publisherReward}`} +

+

+ {`Delegator Reward ($R^d_p$): ${delegatorReward}`} +

+
+
+); +}; + +export default RewardSimulator; \ No newline at end of file diff --git a/components/StakingCapBar.tsx b/components/StakingCapBar.tsx index 1ed4a864..cad551ff 100644 --- a/components/StakingCapBar.tsx +++ b/components/StakingCapBar.tsx @@ -11,7 +11,7 @@ interface StakingCapBarProps { } export default function StakingCapBar({ - totalLength = 300, + totalLength = 500, height = 80, fillPercentage, secondFillPercentage, @@ -19,7 +19,8 @@ export default function StakingCapBar({ secondFillLabel, totalLabel }: StakingCapBarProps) { - // Ensure fillPercentages are between 0 and 100 + const borderWidth = 4 + const gapWidth = 2 const clampedFillPercentage = Math.min(100, Math.max(0, fillPercentage)) const clampedSecondFillPercentage = Math.min(100 - clampedFillPercentage, Math.max(0, secondFillPercentage)) const totalFillPercentage = clampedFillPercentage + clampedSecondFillPercentage @@ -27,12 +28,13 @@ export default function StakingCapBar({ return (
{firstFillLabel && (
- {firstFillLabel}: {clampedFillPercentage}% + {firstFillLabel}
)}
@@ -62,25 +64,27 @@ export default function StakingCapBar({ className="h-full transition-all duration-300 ease-in-out relative" style={{ width: `${clampedSecondFillPercentage}%`, - backgroundColor: '#7142CF' + backgroundColor: '#f0b6bb' }} > {secondFillLabel && (
- {secondFillLabel}: {clampedSecondFillPercentage}% + {secondFillLabel}
)}
{totalLabel && ( -
- {totalLabel}: {totalFillPercentage}% +
+ {totalLabel}
)}
diff --git a/package-lock.json b/package-lock.json index ef0dff3d..5f21869e 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-gtm-module": "^2.0.11", + "react-latex-next": "^3.0.0", "react-syntax-highlighter": "^15.5.0", "sharp": "^0.33.2", "toml": "^3.0.0", @@ -23264,6 +23265,22 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" }, + "node_modules/react-latex-next": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/react-latex-next/-/react-latex-next-3.0.0.tgz", + "integrity": "sha512-x70f1b1G7TronVigsRgKHKYYVUNfZk/3bciFyYX1lYLQH2y3/TXku3+5Vap8MDbJhtopePSYBsYWS6jhzIdz+g==", + "dependencies": { + "katex": "^0.16.0" + }, + "engines": { + "node": ">=12", + "npm": ">=5" + }, + "peerDependencies": { + "react": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0", + "react-dom": "^15.0.0 || ^16.0.0 || ^17.0.0 || ^18.0.0" + } + }, "node_modules/react-markdown": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.0.1.tgz", @@ -44348,6 +44365,14 @@ "resolved": "https://registry.npmjs.org/react-is/-/react-is-17.0.2.tgz", "integrity": "sha512-w2GsyukL62IJnlaff/nRegPQR94C/XXamvMWmSHRJ4y7Ts/4ocGRmTHvOs8PSE6pB3dWOrD/nueuU5sduBsQ4w==" }, + "react-latex-next": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/react-latex-next/-/react-latex-next-3.0.0.tgz", + "integrity": "sha512-x70f1b1G7TronVigsRgKHKYYVUNfZk/3bciFyYX1lYLQH2y3/TXku3+5Vap8MDbJhtopePSYBsYWS6jhzIdz+g==", + "requires": { + "katex": "^0.16.0" + } + }, "react-markdown": { "version": "9.0.1", "resolved": "https://registry.npmjs.org/react-markdown/-/react-markdown-9.0.1.tgz", diff --git a/package.json b/package.json index 1610aaac..c0f13d21 100644 --- a/package.json +++ b/package.json @@ -29,6 +29,7 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-gtm-module": "^2.0.11", + "react-latex-next": "^3.0.0", "react-syntax-highlighter": "^15.5.0", "sharp": "^0.33.2", "toml": "^3.0.0", diff --git a/pages/home/oracle-integrity-staking.mdx b/pages/home/oracle-integrity-staking.mdx index 21f36c90..26e86755 100644 --- a/pages/home/oracle-integrity-staking.mdx +++ b/pages/home/oracle-integrity-staking.mdx @@ -4,26 +4,27 @@ This document outlines the design principles and implementation details of the O ## Design Principles -OIS's economic design focuses on awarding and penalizing Stakers over the primary dimension of data accuracy. -Stakers receive rewards from an open-ended pool for helping to ensure data quality. They will also have their stake slashed as a penalty for failing to maintain data accuracy. +OIS's economic design focuses on awarding and penalizing stakers over the primary dimension of data accuracy. + +Stakers are incentivized to help maintain data quality by receiving rewards from an open-ended pool. However, they also face the risk of having their stake slashed as a penalty for failing to maintain data accuracy. The core design principles behind OIS include the following: -- Integrity Staking secures all current and future price feeds produced by the Pyth Network. +- Oracle Integrity Staking secures all current and future price feeds produced by the Pyth Network. - Data Publishers are individually responsible for data accuracy. -- Rewards and penalties are proportionate to the stake assigned to each publisher. Delegators share in the risk-reward of the publisher(s) they assign their stake to. +- Rewards and penalties are proportionate to the stake assigned to each publisher. Delegators share the risks and rewards of the publisher(s) to whom they assign their stake. - A higher number of publishers for each price feed contributes positively to the security of such feed. -- Staking for OIS is complementary to Staking for Governance, and eligible $PYTH tokens can be used for both purposes. -- The ability to slash stake in OIS requires **unlocked** \$PYTH tokens, whereas Staking for Governance can use both locked and unlocked $PYTH tokens. +- Staking for **OIS** is complementary to staking for **governance**, and eligible $PYTH tokens can be used for both purposes. +- The ability to slash stake in OIS requires **unlocked** \$PYTH tokens, whereas staking for governance can use both locked and unlocked $PYTH tokens. - All parameter related to the OIS protocol are subject to the governance of the Pyth DAO. ## Implementation OIS implements the design principles above through the following structure: -1. OIS is subject to the same 7-day epoch as Governance voting. All parameters used in the OIS protocol are captured at each start of the epoch on Thursdays at 0:00 UTC and remain constant until the end of the epoch. Staking into OIS is also subject to warmup and cooldown period prior and post epoch respectively. +1. OIS is subject to the same 7-day epoch as governance voting. All parameters used in the OIS protocol are captured at each start of the epoch on Thursdays at 0:00 UTC and remain constant until the end of the epoch. Staking into OIS is also subject to warmup and cooldown period prior and post epoch respectively. -2. Each publisher is programmatically assigned a staking pool where they can self-stake and to which other stakers can delegate +2. Each publisher is programmatically assigned a staking pool where they can self-stake and to which other stakers can delegate. - The staking pool assigned to each publisher covers all price feeds/symbols they publish. - Each staking pool has a soft cap. This soft cap dynamically expands and shrinks given the number of symbols published by the assigned publisher. - Price feeds with a low number of publishers contribute more to the cap's expansion. diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 751c5cea..208a5ccc 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -1,5 +1,6 @@ import StakingCapBar from "@/components/StakingCapBar"; + # Examples This reference page provides examples of various scenarios to illustrate the Mathematical Representations of OIS. @@ -26,7 +27,9 @@ $$ \end{aligned} $$ - +{/*
+ +
*/} ## Example 2: Publisher and Delegator Stake @@ -112,3 +115,12 @@ $$ In this example, the stake is uniformly slashed by 5\%, affecting both the publisher and the delegator. Slashing impact the total stake into the pool, regardless of the Cap. {/* */} + + +## Interactive Reward Simulator + +Use the simulator below to calculate publisher and delegator rewards based on your inputs. + +import RewardSimulator from '@/components/RewardSimulator'; + + \ No newline at end of file From 196eea19669ee42e15e6ff8c2a8857b4e7cd63f9 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Fri, 13 Sep 2024 10:39:38 +0530 Subject: [PATCH 19/45] fix --- pages/home/oracle-integrity-staking/examples.mdx | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 208a5ccc..b95ad25e 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -1,5 +1,5 @@ import StakingCapBar from "@/components/StakingCapBar"; - +import RewardSimulator from '@/components/RewardSimulator'; # Examples @@ -117,10 +117,8 @@ In this example, the stake is uniformly slashed by 5\%, affecting both the publi {/* */} -## Interactive Reward Simulator +## Reward Calculator -Use the simulator below to calculate publisher and delegator rewards based on your inputs. - -import RewardSimulator from '@/components/RewardSimulator'; +Use the calculator below to calculate publisher and delegator rewards based on your inputs. \ No newline at end of file From 8118f504626523cd6ce2ced1b65fcf71da2c43de Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Fri, 13 Sep 2024 12:49:34 +0530 Subject: [PATCH 20/45] pre-commit --- components/RewardSimulator.tsx | 155 +++++++++--------- components/StakingCapBar.tsx | 66 ++++---- .../oracle-integrity-staking/examples.mdx | 12 +- .../publisher-quality-ranking.mdx | 46 +++--- pages/home/pyth-token.mdx | 2 +- 5 files changed, 136 insertions(+), 145 deletions(-) diff --git a/components/RewardSimulator.tsx b/components/RewardSimulator.tsx index f43b506a..96c5e229 100644 --- a/components/RewardSimulator.tsx +++ b/components/RewardSimulator.tsx @@ -1,6 +1,6 @@ -import React, { useState, useEffect } from 'react'; -import 'katex/dist/katex.min.css'; -import Latex from 'react-latex-next'; +import React, { useState, useEffect } from "react"; +import "katex/dist/katex.min.css"; +import Latex from "react-latex-next"; const RewardSimulator: React.FC = () => { const [publisherStake, setPublisherStake] = useState(200); @@ -17,12 +17,13 @@ const RewardSimulator: React.FC = () => { const totalStake = publisherStake + delegatorStake; const eligibleAmount = Math.min(totalStake, maxCap); const totalReward = (rewardRate / 100) * eligibleAmount; - - const publisherRewardBase = (rewardRate / 100) * Math.min(publisherStake, maxCap); + + const publisherRewardBase = + (rewardRate / 100) * Math.min(publisherStake, maxCap); const delegatorRewardBase = totalReward - publisherRewardBase; - + const delegatorFeeAmount = (delegatorFee / 100) * delegatorRewardBase; - + const finalDelegatorReward = delegatorRewardBase - delegatorFeeAmount; const finalPublisherReward = publisherRewardBase + delegatorFeeAmount; @@ -31,79 +32,79 @@ const RewardSimulator: React.FC = () => { }; calculateRewards(); -}, [publisherStake, delegatorStake, maxCap, delegatorFee, rewardRate]); + }, [publisherStake, delegatorStake, maxCap, delegatorFee, rewardRate]); -return ( -
-

Reward Simulator

-
-
- - setPublisherStake(Number(e.target.value))} - className="w-full p-2 border rounded bg-transparent" - /> -
-
- - setDelegatorStake(Number(e.target.value))} - className="w-full p-2 border rounded bg-transparent" - /> + return ( +
+

Reward Simulator

+
+
+ + setPublisherStake(Number(e.target.value))} + className="w-full p-2 border rounded bg-transparent" + /> +
+
+ + setDelegatorStake(Number(e.target.value))} + className="w-full p-2 border rounded bg-transparent" + /> +
+
+ + setMaxCap(Number(e.target.value))} + className="w-full p-2 border rounded bg-transparent" + /> +
+
+ + setDelegatorFee(Number(e.target.value))} + className="w-full p-2 border rounded bg-transparent" + /> +
+
+ + setRewardRate(Number(e.target.value))} + className="w-full p-2 border rounded bg-transparent" + /> +
-
- - setMaxCap(Number(e.target.value))} - className="w-full p-2 border rounded bg-transparent" - /> +
+

Calculated Rewards:

+

+ {`Publisher Reward ($R^p_p$): ${publisherReward}`} +

+

+ {`Delegator Reward ($R^d_p$): ${delegatorReward}`} +

-
- - setDelegatorFee(Number(e.target.value))} - className="w-full p-2 border rounded bg-transparent" - /> -
-
- - setRewardRate(Number(e.target.value))} - className="w-full p-2 border rounded bg-transparent" - /> -
-
-
-

Calculated Rewards:

-

- {`Publisher Reward ($R^p_p$): ${publisherReward}`} -

-

- {`Delegator Reward ($R^d_p$): ${delegatorReward}`} -

-
-); + ); }; -export default RewardSimulator; \ No newline at end of file +export default RewardSimulator; diff --git a/components/StakingCapBar.tsx b/components/StakingCapBar.tsx index cad551ff..c36a6cad 100644 --- a/components/StakingCapBar.tsx +++ b/components/StakingCapBar.tsx @@ -1,13 +1,13 @@ -import React from "react" +import React from "react"; interface StakingCapBarProps { - totalLength?: number - height?: number - fillPercentage: number - secondFillPercentage: number - firstFillLabel?: string - secondFillLabel?: string - totalLabel?: string + totalLength?: number; + height?: number; + fillPercentage: number; + secondFillPercentage: number; + firstFillLabel?: string; + secondFillLabel?: string; + totalLabel?: string; } export default function StakingCapBar({ @@ -17,24 +17,28 @@ export default function StakingCapBar({ secondFillPercentage, firstFillLabel, secondFillLabel, - totalLabel + totalLabel, }: StakingCapBarProps) { - const borderWidth = 4 - const gapWidth = 2 - const clampedFillPercentage = Math.min(100, Math.max(0, fillPercentage)) - const clampedSecondFillPercentage = Math.min(100 - clampedFillPercentage, Math.max(0, secondFillPercentage)) - const totalFillPercentage = clampedFillPercentage + clampedSecondFillPercentage + const borderWidth = 4; + const gapWidth = 2; + const clampedFillPercentage = Math.min(100, Math.max(0, fillPercentage)); + const clampedSecondFillPercentage = Math.min( + 100 - clampedFillPercentage, + Math.max(0, secondFillPercentage) + ); + const totalFillPercentage = + clampedFillPercentage + clampedSecondFillPercentage; return (
-
{firstFillLabel && ( -
{firstFillLabel} @@ -62,16 +66,16 @@ export default function StakingCapBar({
{secondFillLabel && ( -
{secondFillLabel} @@ -81,12 +85,10 @@ export default function StakingCapBar({
{totalLabel && ( -
+
{totalLabel}
)}
- ) -} \ No newline at end of file + ); +} diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index b95ad25e..cb3bc228 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -1,5 +1,5 @@ import StakingCapBar from "@/components/StakingCapBar"; -import RewardSimulator from '@/components/RewardSimulator'; +import RewardSimulator from "@/components/RewardSimulator"; # Examples @@ -11,7 +11,6 @@ NOTE: All the symbols used in the examples are explained in the [Mathematical Re This example take the case one pool where the pool has stake from only the publisher. - $$ \begin{aligned} {S^p_p} &= 100 \\ @@ -27,10 +26,6 @@ $$ \end{aligned} $$ -{/*
- -
*/} - ## Example 2: Publisher and Delegator Stake This example take the case where the pool has stake from both the publisher and the delegator. @@ -114,11 +109,8 @@ $$ In this example, the stake is uniformly slashed by 5\%, affecting both the publisher and the delegator. Slashing impact the total stake into the pool, regardless of the Cap. -{/* */} - - ## Reward Calculator Use the calculator below to calculate publisher and delegator rewards based on your inputs. - \ No newline at end of file + diff --git a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx index cb222b52..d7b1ea9c 100644 --- a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx +++ b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx @@ -1,11 +1,12 @@ -import { Callout} from "nextra/components"; +import { Callout } from "nextra/components"; # Publisher Quality Ranking -This document introduces a quality ranking system to ensure high-quality pricing data on Pythnet. The ranking system will use **three** metrics to evaluate each publisher's performance: -- Uptime (40% weight), -- Price Deviation (40% weight), -- Lack of Stalled Prices (20% weight). +This document introduces a quality ranking system to ensure high-quality pricing data on Pythnet. The ranking system will use **three** metrics to evaluate each publisher's performance: + +- Uptime (40% weight), +- Price Deviation (40% weight), +- Lack of Stalled Prices (20% weight). The ranking will be calculated **monthly** to ensure that only the top-performing publishers remain permissioned for each price feed on Pythnet. @@ -13,7 +14,7 @@ The ranking will be calculated **monthly** to ensure that only the top-performin Publishers in Pythtest conformance who are not publishing on Pythnet and pass this uptime condition will also be ranked together with the Pythnet publishers for each symbol. -[Pubslisher Rankings](https://www.pyth.network/publishers/ranking) on the main website shows the updated rank of the publishers. +Checkout [Pubslisher Rankings](https://www.pyth.network/publishers/ranking) on the main website to see the updated rank of the publishers. ## Metrics Used for Ranking @@ -21,28 +22,29 @@ The three metrics used for ranking are: ### Uptime -This metric measures the percentage of time a publisher is available and actively publishing data. A higher numerical score indicates a higher uptime maintained for the price feed. Score range: 0-1. +This metric measures the percentage of time a publisher is available and actively publishing data. A higher numerical score indicates a higher uptime maintained for the price feed. Score range: **0-1**. ### Price Deviation -This metric measures deviations that occur between a publishers' price and the aggregate price, normalized by the aggregate confidence interval. A higher numerical score indicates a lower degree of price deviation. Score range: 0-1. +This metric measures deviations that occur between a publishers' price and the aggregate price, normalized by the aggregate confidence interval. A higher numerical score indicates a lower degree of price deviation. Score range: **0-1**. ### Lack of Stalled Prices -This metric penalizes publishers reporting the same value for the price of an asset for at least 100 consecutive slots because such instances indicate potential data staleness. Publishers with fewer stalled prices will get a higher score. Score range: 0-1. +This metric penalizes publishers reporting the same value for the price of an asset for at least 100 consecutive slots because such instances indicate potential data staleness. Publishers with fewer stalled prices will get a higher score. Score range: **0-1**. ## Ranking Algorithm -Each metric is assigned a weight as mentioned above, and the score for each metric is calculated based on the publisher's performance. -The scores from each metrics are aggregated with respect to their weights to get the final score for each publisher. +Each metric is assigned a weight as mentioned above, and the score for each metric is calculated based on the publisher's performance. +The scores from each metrics are aggregated with respect to their weights to get the final score for each publisher. The weight distribution is as follows: + - Uptime: 40% - Price Deviation: 40% - Lack of Stalled Prices: 20% Publishers are then sorted based on their final scores with the highest score indicating the best performance. -As mentioned earlier, the score for each metric range from 0 to 1, where 1 represents the best performance. -Each publisher will also be assigned a rank based on their final scores, where lower ranks are assigned to publishers with higher scores indicating better performance. +As mentioned earlier, the score for each metric range from 0 to 1, where 1 represents the best performance. +Each publisher will also be assigned a rank based on their final scores, where lower ranks are assigned to publishers with higher scores indicating better performance. ## Metric Calculations @@ -50,26 +52,23 @@ This section provides a detailed breakdown of how each metric is calculated. ### Uptime -Uptime measures a publisher's reliability and availability. If a publisher consistently provides data without interruptions, it indicates a high level of reliability. This is aligned with the current conformance testing/PRP, which checks the publsiher's availability based on price publication within 10 slots. - +Uptime measures a publisher's reliability and availability. If a publisher consistently provides data without interruptions, it indicates a high level of reliability. This is aligned with the current conformance testing/PRP, which checks the publsiher's availability based on price publication within 10 slots. $$ \text{Score}_{\text{Uptime}} = \frac{\text{Publisher Slot Count}}{\text{Aggregate Slot Count}} $$ -Uptime is given **40% weight** in the final ranking. - +Uptime is given **40% weight** in the final ranking. **Reason for Weight:** Uptime is the most critical metric because consistent data availability is fundamental for ensuring a data feed's overall quality and reliability. A publisher that is frequently unable to publish for every set number of slots or unavailable would significantly disrupt the service, hence the high weight of 40%. - ### Price Deviation This metric evaluates the deviations between the publisher's price and the aggregate price, normalized by the aggregate's confidence interval. $$ \text{Penalty}_{\text{Deviation}} = -\frac{1}{N} \sum_{i=1}^{N} \left( \frac{|P_i - A_i|}{{CI}_i} \right)^2 +\frac{1}{N} \sum_{i=1}^{N} \left( \frac{|P_i - A_i|}{{CI}_i} \right)^2 $$ $$ @@ -77,19 +76,18 @@ $$ $$ Where: + - $N$ is the total number of prices - $P_i$ is the publisher's price at instance $i$ - $A_i$ is the aggregate price at instance $i$ - ${CI}_i$ is the aggregate confidence interval at instance $i$ - It is calculated similarly to a z-score, where the aggregate price $A_i$ is the mean, and the aggregate confidence interval $CI_i$ is the Standard Deviation. A higher deviation score indicates that the publisher's prices are significantly inconsistent with the aggregate prices, especially when these deviations exceed the confidence interval. The $\text{Score}_{\text{Deviation}}$ is calculated by ranking the $\text{Penalty}_{\text{Deviation}}$ among all publishers and expressing this rank as a percentage of the total number of publishers. -Price deviation is given **40% weight** in the final ranking. +Price deviation is given **40% weight** in the final ranking. **Reason for Weight:** To maintain trust in the data published on a feed, it is crucial to ensure that reported prices are within a reasonable range of the aggregate price when adjusted for confidence intervals. Significant inconsistencies can undermine confidence in the published data, hence the weight of 40%. - ### Lack of Stalled Prices This metric checks if the publisher is reporting the same price continuously for a specified duration. Repeated prices over an extended period can indicate data staleness or a problem with the data feed. @@ -102,8 +100,8 @@ $$ \text{Score}_{\text{Stalled}} = \max \text((1 - \text{Penalty}_{\text{Stalled}} \times 10) , 0) $$ - Where: + - $N$ is the total number of slots for the aggregate price. - $T$ is the duration threshold for staleness in slot. The threshold is $100$ slots (or about $40$ seconds) for all the symbols but can change in the future on a per-symbol basis. - $P_i$ is the price reported by the publisher at time $i$. @@ -114,5 +112,3 @@ Where: This metric is given **20% weight** in the final ranking. **Reason for Weight:** Staleness in data can mislead users into thinking the market conditions are unchanged, which can be detrimental in volatile market conditions. While important, measuring data staleness is deemed relatively less critical than evaluating uptime and price accuracy, hence a weight of 20%. - - diff --git a/pages/home/pyth-token.mdx b/pages/home/pyth-token.mdx index 8e398ac0..86989696 100644 --- a/pages/home/pyth-token.mdx +++ b/pages/home/pyth-token.mdx @@ -30,7 +30,7 @@ Please note that the scope of community governance proposals may be expanded if The Pyth Network is built to provide decentralized applications with reliable and trustworthy data. The quality of the data it provides is paramount for these application's functions and the network's overall success. -Pyth's [Oracle Integrity Staking (OIS)](/home/pyth-token/oracle-integrity-staking) concentrates on producing quality data in the hands of a limited set of semi-trusted entities to achieve more coverage and lower latency than the competition. The responsibility of Publishers over data quality is not just ethical but also incentivized through economics: +Pyth's [Oracle Integrity Staking (OIS)](/home/pyth-token/oracle-integrity-staking) concentrates on producing quality data in the hands of a limited set of semi-trusted entities to achieve more coverage and lower latency than the competition. The responsibility of publishers over data quality is not just ethical but also incentivized through economics: - **Staking and Slashing:** Publishers can self-stake PYTH tokens as collateral. It also allows other stakers to choose publishers to delegate their PYTH tokens. In the event of data inaccuracies or inconsistencies, a portion of this stake can be slashed as a penalty. This mechanism ensures that publishers have a vested interest in providing accurate data - **Reputation:** The reputation of data publishers is directly linked to the quality of data they provide. Publishers with a track record of providing accurate data are more likely to be trusted and attract more interest. From 1bef4e18d4c65f1bd7401ecca1b801de7a22157b Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Fri, 13 Sep 2024 10:33:35 +0200 Subject: [PATCH 21/45] initial commit of the slashing rulebook --- pages/home/slashing-rulebook.mdx | 38 ++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 pages/home/slashing-rulebook.mdx diff --git a/pages/home/slashing-rulebook.mdx b/pages/home/slashing-rulebook.mdx new file mode 100644 index 00000000..86989696 --- /dev/null +++ b/pages/home/slashing-rulebook.mdx @@ -0,0 +1,38 @@ +import { Steps } from "nextra/components"; + +# PYTH Token + +The Pyth Network, as a distributed system, needs to have a constitution and a clear governance system. + +PYTH is the governance token of the Pyth Network, and the [Pyth DAO constitution](https://github.com/pyth-network/governance/blob/main/docs/constitution/pyth-dao-constitution.md) is the governance framework for the Pyth DAO. The constitution outlines the rules and procedures of the Pyth DAO. These rules and procedures are generally enforced through on-chain contracts and the associated parameters, unless specified by the Pyth DAO for actuation off-chain. + +## PYTH Token Staking + +PYTH Token can be staked for Governance and Oracle Integrity. + + +### Staking PYTH for Governance + +PYTH token holders can participate in Pyth governance through staking and [governance](https://staking.pyth.network/). Token holders use their staked tokens in the Pyth staking program to vote on community governance proposals. + +Governance uses a 1:1 coin-voting system, where each staked token confers one vote. + +Any PYTH Token holder can submit proposals to the Pyth DAO as long as they have **0.25% **of the total PYTH tokens staked. +At the end of the **7 day** voting period, a proposal is passes if it meets the following conditions: + +- **More yesses** have been cast than nos. +- The "**Approval Quorum**" has been met. \ + **Approval Quorum** is a percentage of staked PYTH tokens that must have voted yes for the proposal to pass. "Community Vote Threshold Percentage" is expressed as percentage of staked tokens at the start of the voting period for the proposal. This percentage threshold can vary depending on the type of proposal. The current threshold can be found in the "Governances" sections of the [parameters of the DAO](https://app.realms.today/dao/PYTH/params). + +Please note that the scope of community governance proposals may be expanded if the PYTH token holders (or the Pyth DAO) decide so. + +### Staking PYTH for Oracle Integrity + +The Pyth Network is built to provide decentralized applications with reliable and trustworthy data. The quality of the data it provides is paramount for these application's functions and the network's overall success. + +Pyth's [Oracle Integrity Staking (OIS)](/home/pyth-token/oracle-integrity-staking) concentrates on producing quality data in the hands of a limited set of semi-trusted entities to achieve more coverage and lower latency than the competition. The responsibility of publishers over data quality is not just ethical but also incentivized through economics: + +- **Staking and Slashing:** Publishers can self-stake PYTH tokens as collateral. It also allows other stakers to choose publishers to delegate their PYTH tokens. In the event of data inaccuracies or inconsistencies, a portion of this stake can be slashed as a penalty. This mechanism ensures that publishers have a vested interest in providing accurate data +- **Reputation:** The reputation of data publishers is directly linked to the quality of data they provide. Publishers with a track record of providing accurate data are more likely to be trusted and attract more interest. + + From b8d9c3e09f50dd503c83f9aed8de51aa621ceed6 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Fri, 13 Sep 2024 10:52:53 +0200 Subject: [PATCH 22/45] adding slashing rulebook --- pages/home/oracle-integrity-staking/_meta.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pages/home/oracle-integrity-staking/_meta.json b/pages/home/oracle-integrity-staking/_meta.json index 3e8fa40a..6133b40e 100644 --- a/pages/home/oracle-integrity-staking/_meta.json +++ b/pages/home/oracle-integrity-staking/_meta.json @@ -1,4 +1,5 @@ { "mathematical-representation": "Mathematical Representation", - "examples": "Examples" + "examples": "Examples", + "slashing-rulebook": "Slashing Rulebook" } From 3accfbced02e9e947b6aa1623c936af0653d6367 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Fri, 13 Sep 2024 11:45:15 +0200 Subject: [PATCH 23/45] Moving slashing rulebook to OIS section --- .../slashing-rulebook.mdx | 106 ++++++++++++++++++ pages/home/slashing-rulebook.mdx | 38 ------- 2 files changed, 106 insertions(+), 38 deletions(-) create mode 100644 pages/home/oracle-integrity-staking/slashing-rulebook.mdx delete mode 100644 pages/home/slashing-rulebook.mdx diff --git a/pages/home/oracle-integrity-staking/slashing-rulebook.mdx b/pages/home/oracle-integrity-staking/slashing-rulebook.mdx new file mode 100644 index 00000000..d252aedb --- /dev/null +++ b/pages/home/oracle-integrity-staking/slashing-rulebook.mdx @@ -0,0 +1,106 @@ +import { Steps } from "nextra/components"; + +# Purpose and Scope + +This Pyth Slashing Rulebook (this ”Rulebook”) outlines the Terms & Conditions for slashing PYTH that has been staked for price feed accuracy on the Pyth network. This document develops the rules that the DAO must adhere to when assessing conditions and amounts of slashing. + +# Staking Publisher Responsibility + +## Upholding Pyth Data quality + +### Role of Data Publishers + +- **Primary Source of Data:** Data publishers are the backbone of Pyth’s Price Feeds. They are the primary source of price data for the various assets that the Pyth Network serves data for +- **Data Collection:** Publishers are responsible for computing price data. This could involve accessing data from exchanges, trading platforms, or other price information sources +- **Data Submission:** Publishers submit their respective measurement of price to the Pyth Network, ensuring a constant stream of accurate and timely information +- **Maintaining Data Quality:** The most crucial role of publishers is ensuring the quality and integrity of the data they provide. This involves: + - **Reliable Sources:** Sourcing data from the necessary sources to produce high quality measurements of price data + - **Data Validation:** Implementing validation processes to verify the accuracy of the data before submission + - **Transparency:** Providing transparency into their data sources and methodologies so that users of the Pyth Network can assess the reliability of the data + - **Timeliness:** Ensuring data is submitted in a timely manner to reflect real-time market conditions + +### Responsibility for Data Quality + +Data publishers have a significant responsibility for maintaining data quality within the Pyth Network. This responsibility is not just ethical, but also incentivized through the network's structure: + +- **Staking and Slashing:** Publishers can stake PYTH tokens as collateral. In the event of data inaccuracies or inconsistencies, a portion of this stake can be slashed as a penalty. This mechanism ensures that publishers are discouraged from providing inaccurate data +- **Reputation:** The reputation of data publishers within the Pyth Network is directly linked to the quality of data they provide. Publishers with a track record of providing accurate data are more likely to rank higher and attract more adoption + +### Importance of Data Quality + +The Pyth Network is designed to provide reliable and trustworthy financial data to decentralized applications and smart contracts. The quality of the data it provides is paramount for the functioning of these applications and the overall success of the network. Therefore, the role of data publishers and their commitment to data quality cannot be overstated. + +## Staking + +Staking through OIS is a program to enhance the security of price feeds produced by publisher on the Pyth Network. + +Per the design of OIS, a pool aligned with a data publisher accepts stake from the moment such publisher declares its stake account through configuration. The additional stake allows such publisher to earn a delegation fee to contribute to the costs of providing data to the Pyth Network. Data publishers compete with one another to increase the number of price feeds they contribute to, and/or increase the quality of data that allows them to be selected to publish and/or enable higher staking cap for the pool each publisher is aligned to. + +# Slashing Conditions + +A data quality issue happens when the aggregated price from Pyth is deemed inaccurate. Such inaccuracy has to fulfil the following criteria: + +- Prevalent prices for the asset(s) in question and related crosses using the most liquid venues at the time of the incident were at least 250 bps away from the price produced by Pyth +- The price deviation have lasted for at least 60 seconds +- Confidence Intervals prints from Pyth do not show an abnormal deviation during the misprint +- The market conditions are normal and the incident is not related to one or many macro events that make the accurate pricing of assets not feasible + +# Slashing Calculation and Distribution + +If slashing event confirmed, the Pythian Council will process calculation and distribution of the slashed stake according to the following: + +- **Stake Slashed** + - capped at 5% of the total amount staked (including the amount delegated) into pools associated with publishers identified as directly responsible for poor data quality. distribution of the slashed amount is uniform amongst publishers and delegator(s) + - In the case the total amount staked by the stakers responsible for the data quality issue is nil, no slashing takes place +- **Loss of Rewards** + - the stakers that may be responsible for the data quality issue forfeit any rewards the epoch following the slashing event +- **Temporary or Permanent Removal:** + - Stakers responsible for more than 4 slashing events per calendar year may be excluded permanently from the network exclusion from the set of stakers and/or publishers + +# Slashing Process + +## Evidence Collection & Analysis + +- The Pythian Council is tasked by the DAO to review the evidence presented by the protocols impacted by the potential Pyth data misprint +- The Pythian Council will review the evidence compares the evidence collected for the potential losses and against historical data +- In the case that the evidence corroborates, the Pythian Council will identify the publishers responsible for the slashing and define a slashable amount, up to 5% of the total amount staked into the pools of the publishers responsible the event + +## Reporting + +- The Pythian Council is responsible to report on with reasonable details on the evidence found that led to the slashing event through [forum.pyth.network](http://forum.pyth.network). Such report should include: + - a recap of the slashing event and evidence collected + - a recap of the impact and the list of stakers impacted + - a recap of the slashing amount +- Such report is deemed definitive and not subject to further discussion in the absence of new evidence + +## Timeline + +- The Pythian Council is responsible for analysing and delivering its conclusions within the same epoch when the potential slashing event happened or during the following epoch at the latest + +## Post Slashing + +- Stakers continue staking with the residual amount post slashing. No forced unstaking happens post slashing +- The Pyth DAO controls the slashed amount upon execution of the slashing + +# Change Process + +The Pyth DAO is responsible for implementing procedures for proposing, reviewing, approving, and adopting changes to the rules, policies, or procedures related to this Rulebook. + +## Change Proposal + +1. **Initiation:** Any interested party in the Pyth DAO may propose a change to this Rulebook through the Pyth DAO Forum via the existing Pyth Improvement Proposal (PIP) process defined in the Pyth Constitution +2. **Submission:** Proposed changes should be submitted through the standard governance system for the Pyth DAO members to vote on +3. **Content:** an Operational PIP for making changes to this Rulebook should include: + - Abstract - that summarises the PIP + - Rationale - that explains why the Pyth community should implement the PIP and how it aligns with community’s mission and values + - Key Terms - a detailed description of the technical and/or commercial terms associated with the PIP + - Implementation Plan - steps envisioned to implement the PIP, including resources needed for each step and timelines. The implementation plan may include binding on-chain actions that will automatically execute when the PIP passes. + +## Review and Approval + +The decision on whether to approve a PIP related to this Rulebook remains with the Pyth DAO. A simple majority is required to approve Operational PIPs that make amendments to this Rulebook and its associated procedures. + +## Implementation + +1. **Effective Date:** Approved changes will become effective from the time they are approved or on the specified date +2. **Transition Period:** If necessary, a transition period may be established to allow the Pyth DAO and the Pythian Council to adjust to the new rules or procedures diff --git a/pages/home/slashing-rulebook.mdx b/pages/home/slashing-rulebook.mdx deleted file mode 100644 index 86989696..00000000 --- a/pages/home/slashing-rulebook.mdx +++ /dev/null @@ -1,38 +0,0 @@ -import { Steps } from "nextra/components"; - -# PYTH Token - -The Pyth Network, as a distributed system, needs to have a constitution and a clear governance system. - -PYTH is the governance token of the Pyth Network, and the [Pyth DAO constitution](https://github.com/pyth-network/governance/blob/main/docs/constitution/pyth-dao-constitution.md) is the governance framework for the Pyth DAO. The constitution outlines the rules and procedures of the Pyth DAO. These rules and procedures are generally enforced through on-chain contracts and the associated parameters, unless specified by the Pyth DAO for actuation off-chain. - -## PYTH Token Staking - -PYTH Token can be staked for Governance and Oracle Integrity. - - -### Staking PYTH for Governance - -PYTH token holders can participate in Pyth governance through staking and [governance](https://staking.pyth.network/). Token holders use their staked tokens in the Pyth staking program to vote on community governance proposals. - -Governance uses a 1:1 coin-voting system, where each staked token confers one vote. - -Any PYTH Token holder can submit proposals to the Pyth DAO as long as they have **0.25% **of the total PYTH tokens staked. -At the end of the **7 day** voting period, a proposal is passes if it meets the following conditions: - -- **More yesses** have been cast than nos. -- The "**Approval Quorum**" has been met. \ - **Approval Quorum** is a percentage of staked PYTH tokens that must have voted yes for the proposal to pass. "Community Vote Threshold Percentage" is expressed as percentage of staked tokens at the start of the voting period for the proposal. This percentage threshold can vary depending on the type of proposal. The current threshold can be found in the "Governances" sections of the [parameters of the DAO](https://app.realms.today/dao/PYTH/params). - -Please note that the scope of community governance proposals may be expanded if the PYTH token holders (or the Pyth DAO) decide so. - -### Staking PYTH for Oracle Integrity - -The Pyth Network is built to provide decentralized applications with reliable and trustworthy data. The quality of the data it provides is paramount for these application's functions and the network's overall success. - -Pyth's [Oracle Integrity Staking (OIS)](/home/pyth-token/oracle-integrity-staking) concentrates on producing quality data in the hands of a limited set of semi-trusted entities to achieve more coverage and lower latency than the competition. The responsibility of publishers over data quality is not just ethical but also incentivized through economics: - -- **Staking and Slashing:** Publishers can self-stake PYTH tokens as collateral. It also allows other stakers to choose publishers to delegate their PYTH tokens. In the event of data inaccuracies or inconsistencies, a portion of this stake can be slashed as a penalty. This mechanism ensures that publishers have a vested interest in providing accurate data -- **Reputation:** The reputation of data publishers is directly linked to the quality of data they provide. Publishers with a track record of providing accurate data are more likely to be trusted and attract more interest. - - From 99f354759ff119d345d806ffb94df8f4133e933e Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Mon, 16 Sep 2024 15:57:22 +0200 Subject: [PATCH 24/45] updates to the rulebook --- .../slashing-rulebook.mdx | 24 ++++++++++--------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/pages/home/oracle-integrity-staking/slashing-rulebook.mdx b/pages/home/oracle-integrity-staking/slashing-rulebook.mdx index d252aedb..67953379 100644 --- a/pages/home/oracle-integrity-staking/slashing-rulebook.mdx +++ b/pages/home/oracle-integrity-staking/slashing-rulebook.mdx @@ -4,8 +4,6 @@ import { Steps } from "nextra/components"; This Pyth Slashing Rulebook (this ”Rulebook”) outlines the Terms & Conditions for slashing PYTH that has been staked for price feed accuracy on the Pyth network. This document develops the rules that the DAO must adhere to when assessing conditions and amounts of slashing. -# Staking Publisher Responsibility - ## Upholding Pyth Data quality ### Role of Data Publishers @@ -36,7 +34,11 @@ Staking through OIS is a program to enhance the security of price feeds produced Per the design of OIS, a pool aligned with a data publisher accepts stake from the moment such publisher declares its stake account through configuration. The additional stake allows such publisher to earn a delegation fee to contribute to the costs of providing data to the Pyth Network. Data publishers compete with one another to increase the number of price feeds they contribute to, and/or increase the quality of data that allows them to be selected to publish and/or enable higher staking cap for the pool each publisher is aligned to. -# Slashing Conditions +## Slashing + +In the event of a Pyth data inaccuracy that can be verified against independent data references, a portion of the stake can be reduced from the pools aligned with the publishers responsible for the erroneous data. + +### Slashing Conditions A data quality issue happens when the aggregated price from Pyth is deemed inaccurate. Such inaccuracy has to fulfil the following criteria: @@ -45,7 +47,7 @@ A data quality issue happens when the aggregated price from Pyth is deemed inacc - Confidence Intervals prints from Pyth do not show an abnormal deviation during the misprint - The market conditions are normal and the incident is not related to one or many macro events that make the accurate pricing of assets not feasible -# Slashing Calculation and Distribution +### Slashing Calculation and Distribution If slashing event confirmed, the Pythian Council will process calculation and distribution of the slashed stake according to the following: @@ -57,15 +59,15 @@ If slashing event confirmed, the Pythian Council will process calculation and di - **Temporary or Permanent Removal:** - Stakers responsible for more than 4 slashing events per calendar year may be excluded permanently from the network exclusion from the set of stakers and/or publishers -# Slashing Process +### Slashing Process -## Evidence Collection & Analysis +#### Evidence Collection & Analysis - The Pythian Council is tasked by the DAO to review the evidence presented by the protocols impacted by the potential Pyth data misprint - The Pythian Council will review the evidence compares the evidence collected for the potential losses and against historical data - In the case that the evidence corroborates, the Pythian Council will identify the publishers responsible for the slashing and define a slashable amount, up to 5% of the total amount staked into the pools of the publishers responsible the event -## Reporting +#### Reporting - The Pythian Council is responsible to report on with reasonable details on the evidence found that led to the slashing event through [forum.pyth.network](http://forum.pyth.network). Such report should include: - a recap of the slashing event and evidence collected @@ -73,11 +75,11 @@ If slashing event confirmed, the Pythian Council will process calculation and di - a recap of the slashing amount - Such report is deemed definitive and not subject to further discussion in the absence of new evidence -## Timeline +#### Timeline - The Pythian Council is responsible for analysing and delivering its conclusions within the same epoch when the potential slashing event happened or during the following epoch at the latest -## Post Slashing +#### Post Slashing - Stakers continue staking with the residual amount post slashing. No forced unstaking happens post slashing - The Pyth DAO controls the slashed amount upon execution of the slashing @@ -96,11 +98,11 @@ The Pyth DAO is responsible for implementing procedures for proposing, reviewing - Key Terms - a detailed description of the technical and/or commercial terms associated with the PIP - Implementation Plan - steps envisioned to implement the PIP, including resources needed for each step and timelines. The implementation plan may include binding on-chain actions that will automatically execute when the PIP passes. -## Review and Approval +### Review and Approval The decision on whether to approve a PIP related to this Rulebook remains with the Pyth DAO. A simple majority is required to approve Operational PIPs that make amendments to this Rulebook and its associated procedures. -## Implementation +### Implementation 1. **Effective Date:** Approved changes will become effective from the time they are approved or on the specified date 2. **Transition Period:** If necessary, a transition period may be established to allow the Pyth DAO and the Pythian Council to adjust to the new rules or procedures From 8e775108f5e25b32fb834c4a5bb6757b75ea6927 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Mon, 16 Sep 2024 16:02:05 +0200 Subject: [PATCH 25/45] formatting --- pages/home/oracle-integrity-staking/slashing-rulebook.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/home/oracle-integrity-staking/slashing-rulebook.mdx b/pages/home/oracle-integrity-staking/slashing-rulebook.mdx index 67953379..00555446 100644 --- a/pages/home/oracle-integrity-staking/slashing-rulebook.mdx +++ b/pages/home/oracle-integrity-staking/slashing-rulebook.mdx @@ -84,11 +84,11 @@ If slashing event confirmed, the Pythian Council will process calculation and di - Stakers continue staking with the residual amount post slashing. No forced unstaking happens post slashing - The Pyth DAO controls the slashed amount upon execution of the slashing -# Change Process +## Change Process The Pyth DAO is responsible for implementing procedures for proposing, reviewing, approving, and adopting changes to the rules, policies, or procedures related to this Rulebook. -## Change Proposal +### Change Proposal 1. **Initiation:** Any interested party in the Pyth DAO may propose a change to this Rulebook through the Pyth DAO Forum via the existing Pyth Improvement Proposal (PIP) process defined in the Pyth Constitution 2. **Submission:** Proposed changes should be submitted through the standard governance system for the Pyth DAO members to vote on From b65bd568968901dac4e1a6d9522470976b85db89 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Tue, 17 Sep 2024 10:40:08 +0800 Subject: [PATCH 26/45] added example 6 --- .../oracle-integrity-staking/examples.mdx | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index cb3bc228..48af906a 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -109,6 +109,62 @@ $$ In this example, the stake is uniformly slashed by 5\%, affecting both the publisher and the delegator. Slashing impact the total stake into the pool, regardless of the Cap. +## Example 6: Increasing the cap of the pool + +This example shows how a publisher can increase the cap of the pool assigned to them. +As described in the [Mathematical Representation](/home/pyth-token/oracle-integrity-staking/mathematical-representation#pool-cap), the cap is caluclated as: + +$$ +\large{{\bold{C_p}} = M \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{\max(n_s, Z)}} +$$ + +In this scenario, let's assume that + +- The constant parameter representing the target stake per symbol $M$ is 100 +- The constant parameter to control cap contribution $Z$ is 5 +- Current symbols published $n_p$ = 5 where for every symbol currently published $n_s$ = 5 + +The cap of the pool is calculated as follows: + +$$ +\begin{aligned} +\quad{C_p} &= M \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{\max(n_s, Z)} \\ +&= 100 \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{\max(5, 5)} \\ +&= 100 \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{5} \\ +&= 100 \cdot 1 = 100 \\ +\end{aligned} +$$ + +Here publisher has 2 options to increase the cap of the pool assigned to it. + +### Option 1: Publish new symbol with low number of publishers + +Assume the publisher decides to publish a new symbol with only 3 publishers, $n_{s_{low}}$ = 3. + +The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing $s_{low}$ (where $n_{s_{low}}$ = 3 + 1 = 4) + +$$ +\begin{aligned} +C_{p_{option1}} &= 100 + 100 \cdot \frac{1}{\max(4, 5)} \\ +&= 100 + 100 \cdot \frac{1}{5} \\ +&= 100 + 20 = 120 +\end{aligned} +$$ + +### Option 2: Publish additional symbols where cap of 32 publishers is not reached + +Assuming there is room to publish 5 more symbols $\{s_6, .., s_{10}\}$ where each have currently 9 publishers ( for i = 6 .. 10 $n_{s_i}$ = 9) + +The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing the additional symbols $\{s_6, .., s_{10}\}$ (where for i = 6 .. 10 $n_{s_i}$ = 10) + +$$ +\begin{aligned} +C_{p_{option2}} &= 100 + 100 \cdot \sum_{s \in \text{\{s\_6,.., s\_{10}\}}} \frac{1}{\max(10, 5)} \\ +&= 100 + 100 \cdot 5 \cdot \frac{1}{10} \\ +&= 100 + 50 = 150 +\end{aligned} +$$ + ## Reward Calculator Use the calculator below to calculate publisher and delegator rewards based on your inputs. From 4a0993b49bd129bf5ad812590d11abeae7c0fdfc Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Tue, 17 Sep 2024 16:32:48 +0800 Subject: [PATCH 27/45] added example 6 --- pages/home/oracle-integrity-staking/examples.mdx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 48af906a..e6774050 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -128,9 +128,9 @@ The cap of the pool is calculated as follows: $$ \begin{aligned} -\quad{C_p} &= M \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{\max(n_s, Z)} \\ -&= 100 \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{\max(5, 5)} \\ -&= 100 \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{5} \\ +\quad{C_p} &= M \cdot \sum_{s \in \text{\{s\_1,.., s\_5\}}} \frac{1}{\max(n_s, Z)} \\ +&= 100 \cdot \sum_{s \in \text{\{s\_1,.., s\_5\}}} \frac{1}{\max(5, 5)} \\ +&= 100 \cdot \sum_{s \in \text{\{s\_1,.., s\_5\}}} \frac{1}{5} \\ &= 100 \cdot 1 = 100 \\ \end{aligned} $$ @@ -159,7 +159,7 @@ The new pool cap would change as the sum of the current cap from the 5 symbols p $$ \begin{aligned} -C_{p_{option2}} &= 100 + 100 \cdot \sum_{s \in \text{\{s\_6,.., s\_{10}\}}} \frac{1}{\max(10, 5)} \\ +C_{p_{option2}} &= 100 + 100 \cdot \sum_{s \in \text{\{s\_1,.., s\_5, s\_6,.., s\_{10}\}}} \frac{1}{\max(10, 5)} \\ &= 100 + 100 \cdot 5 \cdot \frac{1}{10} \\ &= 100 + 50 = 150 \end{aligned} From 064ab69a31eb9734497b9d4174ba7a3c30202eb6 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:02:17 +0200 Subject: [PATCH 28/45] fix formatting --- pages/home/oracle-integrity-staking/examples.mdx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index e6774050..0a0c5f3f 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -122,15 +122,15 @@ In this scenario, let's assume that - The constant parameter representing the target stake per symbol $M$ is 100 - The constant parameter to control cap contribution $Z$ is 5 -- Current symbols published $n_p$ = 5 where for every symbol currently published $n_s$ = 5 +- Current symbols published are $\{$s*{1}$,.., $s*{5}$\}$ where for every symbol currently published $n_s$ = 5 (for i = 1 .. 5 $n_{s_i}$ = 5) The cap of the pool is calculated as follows: $$ \begin{aligned} -\quad{C_p} &= M \cdot \sum_{s \in \text{\{s\_1,.., s\_5\}}} \frac{1}{\max(n_s, Z)} \\ -&= 100 \cdot \sum_{s \in \text{\{s\_1,.., s\_5\}}} \frac{1}{\max(5, 5)} \\ -&= 100 \cdot \sum_{s \in \text{\{s\_1,.., s\_5\}}} \frac{1}{5} \\ +\quad{C_p} &= M \cdot \sum_{s \in \text{\{$s_{1}$,.., $s_{5}$\}}} \frac{1}{\max(n_s, Z)} \\ +&= 100 \cdot \sum_{s \in \text{\{$s_{1}$,.., $s_{5}$\}}} \frac{1}{\max(5, 5)} \\ +&= 100 \cdot \sum_{s \in \text{\{$s_{1}$,.., $s_{5}$\}}} \frac{1}{5} \\ &= 100 \cdot 1 = 100 \\ \end{aligned} $$ @@ -155,11 +155,11 @@ $$ Assuming there is room to publish 5 more symbols $\{s_6, .., s_{10}\}$ where each have currently 9 publishers ( for i = 6 .. 10 $n_{s_i}$ = 9) -The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing the additional symbols $\{s_6, .., s_{10}\}$ (where for i = 6 .. 10 $n_{s_i}$ = 10) +The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing the additional symbols $\{$s*{6}$,.., $s*{10}$\}$ (where for i = 6 .. 10 $n_{s_i}$ = 10) $$ \begin{aligned} -C_{p_{option2}} &= 100 + 100 \cdot \sum_{s \in \text{\{s\_1,.., s\_5, s\_6,.., s\_{10}\}}} \frac{1}{\max(10, 5)} \\ +C_{p_{option2}} &= 100 + 100 \cdot \sum_{s \in \text{\{$s_{6}$,.., $s_{10}$\}}} \frac{1}{\max(10, 5)} \\ &= 100 + 100 \cdot 5 \cdot \frac{1}{10} \\ &= 100 + 50 = 150 \end{aligned} From a70548d8a7ad44ee4ed4f630a139411c7b17d2a4 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:13:46 +0200 Subject: [PATCH 29/45] minor fixes to symbology --- pages/home/oracle-integrity-staking/examples.mdx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 0a0c5f3f..d6abda37 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -122,7 +122,7 @@ In this scenario, let's assume that - The constant parameter representing the target stake per symbol $M$ is 100 - The constant parameter to control cap contribution $Z$ is 5 -- Current symbols published are $\{$s*{1}$,.., $s*{5}$\}$ where for every symbol currently published $n_s$ = 5 (for i = 1 .. 5 $n_{s_i}$ = 5) +- Current symbols published are $\{$s_{1}$,.., $s_{5}$\}$ where for every symbol currently published $n_s$ = 5 (for i = 1 .. 5 $n_{s_i}$ = 5) The cap of the pool is calculated as follows: @@ -155,7 +155,7 @@ $$ Assuming there is room to publish 5 more symbols $\{s_6, .., s_{10}\}$ where each have currently 9 publishers ( for i = 6 .. 10 $n_{s_i}$ = 9) -The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing the additional symbols $\{$s*{6}$,.., $s*{10}$\}$ (where for i = 6 .. 10 $n_{s_i}$ = 10) +The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing the additional symbols $\{$s_{6}$,.., $s_{10}$\}$ (where for i = 6 .. 10 $n_{s_i}$ = 10) $$ \begin{aligned} From 6659f417c9b9cbf1034c3bd6be7e6b29e468acfe Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Tue, 17 Sep 2024 11:19:18 +0200 Subject: [PATCH 30/45] minor fixes to symbology --- pages/home/oracle-integrity-staking/examples.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index d6abda37..5051e3f6 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -153,7 +153,7 @@ $$ ### Option 2: Publish additional symbols where cap of 32 publishers is not reached -Assuming there is room to publish 5 more symbols $\{s_6, .., s_{10}\}$ where each have currently 9 publishers ( for i = 6 .. 10 $n_{s_i}$ = 9) +Assuming there is room to publish 5 more symbols $\{$s_{6}$,.., $s_{10}$\}$ where each have currently 9 publishers ( for i = 6 .. 10 $n_{s_i}$ = 9) The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing the additional symbols $\{$s_{6}$,.., $s_{10}$\}$ (where for i = 6 .. 10 $n_{s_i}$ = 10) From fa0f0fd2de75d26e165805f07d2ea81089734138 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Tue, 17 Sep 2024 19:55:46 +0200 Subject: [PATCH 31/45] minor fixes to symbology --- pages/home/oracle-integrity-staking/examples.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 5051e3f6..b0de8285 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -122,7 +122,7 @@ In this scenario, let's assume that - The constant parameter representing the target stake per symbol $M$ is 100 - The constant parameter to control cap contribution $Z$ is 5 -- Current symbols published are $\{$s_{1}$,.., $s_{5}$\}$ where for every symbol currently published $n_s$ = 5 (for i = 1 .. 5 $n_{s_i}$ = 5) +- Current symbols published are {$s_{1}$,.., $s_{5}$} where for every symbol currently published $n_s$ = 5 (for i = 1 .. 5 $n_{s_i}$ = 5) The cap of the pool is calculated as follows: @@ -153,9 +153,9 @@ $$ ### Option 2: Publish additional symbols where cap of 32 publishers is not reached -Assuming there is room to publish 5 more symbols $\{$s_{6}$,.., $s_{10}$\}$ where each have currently 9 publishers ( for i = 6 .. 10 $n_{s_i}$ = 9) +Assuming there is room to publish 5 more symbols {$s_{6}$,.., $s_{10}$} where each have currently 9 publishers ( for i = 6 .. 10 $n_{s_i}$ = 9) -The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing the additional symbols $\{$s_{6}$,.., $s_{10}$\}$ (where for i = 6 .. 10 $n_{s_i}$ = 10) +The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing the additional symbols {$s_{6}$,.., $s_{10}$} (where for i = 6 .. 10 $n_{s_i}$ = 10) $$ \begin{aligned} From 5f40c422b201eeae2cdf36f36e6e8572394ad760 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Tue, 17 Sep 2024 23:05:43 +0200 Subject: [PATCH 32/45] fixing symbology --- pages/home/oracle-integrity-staking/examples.mdx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index b0de8285..6410ce0a 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -122,7 +122,7 @@ In this scenario, let's assume that - The constant parameter representing the target stake per symbol $M$ is 100 - The constant parameter to control cap contribution $Z$ is 5 -- Current symbols published are {$s_{1}$,.., $s_{5}$} where for every symbol currently published $n_s$ = 5 (for i = 1 .. 5 $n_{s_i}$ = 5) +- Current symbols published are \{$s_{1}$,.., $s_{5}$\} where for every symbol currently published $n_s$ = 5 (for i = 1 .. 5 $n_{s_i}$ = 5) The cap of the pool is calculated as follows: @@ -153,9 +153,9 @@ $$ ### Option 2: Publish additional symbols where cap of 32 publishers is not reached -Assuming there is room to publish 5 more symbols {$s_{6}$,.., $s_{10}$} where each have currently 9 publishers ( for i = 6 .. 10 $n_{s_i}$ = 9) +Assuming there is room to publish 5 more symbols \{$s_{6}$,.., $s_{10}$\} where each have currently 9 publishers ( for i = 6 .. 10 $n_{s_i}$ = 9) -The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing the additional symbols {$s_{6}$,.., $s_{10}$} (where for i = 6 .. 10 $n_{s_i}$ = 10) +The new pool cap would change as the sum of the current cap from the 5 symbols published plus the cap gained from publishing the additional symbols \{$s_{6}$,.., $s_{10}$\} (where for i = 6 .. 10 $n_{s_i}$ = 10) $$ \begin{aligned} From 146f2df99784b4eb36ab25262b2ccc7c3c0e0883 Mon Sep 17 00:00:00 2001 From: Connor Prussin Date: Wed, 18 Sep 2024 02:47:26 -0700 Subject: [PATCH 33/45] Fix staking cap bar issues --- components/StakingCapBar.tsx | 118 ++++++++++++++++------------------- 1 file changed, 53 insertions(+), 65 deletions(-) diff --git a/components/StakingCapBar.tsx b/components/StakingCapBar.tsx index c36a6cad..7228c494 100644 --- a/components/StakingCapBar.tsx +++ b/components/StakingCapBar.tsx @@ -1,4 +1,4 @@ -import React from "react"; +import React, { type ReactNode, useMemo } from "react"; interface StakingCapBarProps { totalLength?: number; @@ -19,76 +19,64 @@ export default function StakingCapBar({ secondFillLabel, totalLabel, }: StakingCapBarProps) { - const borderWidth = 4; - const gapWidth = 2; - const clampedFillPercentage = Math.min(100, Math.max(0, fillPercentage)); - const clampedSecondFillPercentage = Math.min( + const clampedFillPercentage = useMemo(() => Math.min(100, Math.max(0, fillPercentage)), [fillPercentage]); + const clampedSecondFillPercentage = useMemo(() => Math.min( 100 - clampedFillPercentage, Math.max(0, secondFillPercentage) - ); + ), [clampedFillPercentage, secondFillPercentage]); const totalFillPercentage = - clampedFillPercentage + clampedSecondFillPercentage; + useMemo(() => clampedFillPercentage + clampedSecondFillPercentage, [clampedFillPercentage, clampedSecondFillPercentage]); return ( -
-
-
-
- {firstFillLabel && ( -
- {firstFillLabel} -
- )} -
-
- {secondFillLabel && ( -
- {secondFillLabel} -
- )} -
-
+
+ + {firstFillLabel} + + + {secondFillLabel} + +
+ {totalLabel && }
- {totalLabel && ( -
- {totalLabel} -
- )}
); } + +type BarProps = { + fillPercent: number; + children?: ReactNode | undefined; + color: string; +} + +const Bar = ({ fillPercent, children, color }: BarProps) => ( +
+ {children && } +
+); + +const Label = ({ children }: { children: ReactNode }) => ( +
+ {children} +
+); From c99b6455be753650fd8ff9b342c7c4f073ba3bba Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 19 Sep 2024 17:07:34 +0800 Subject: [PATCH 34/45] requested changes --- components/StakingCapBar.tsx | 22 ++++++++++++------- .../oracle-integrity-staking/examples.mdx | 13 +++++++---- 2 files changed, 23 insertions(+), 12 deletions(-) diff --git a/components/StakingCapBar.tsx b/components/StakingCapBar.tsx index 7228c494..4840e260 100644 --- a/components/StakingCapBar.tsx +++ b/components/StakingCapBar.tsx @@ -19,13 +19,19 @@ export default function StakingCapBar({ secondFillLabel, totalLabel, }: StakingCapBarProps) { - const clampedFillPercentage = useMemo(() => Math.min(100, Math.max(0, fillPercentage)), [fillPercentage]); - const clampedSecondFillPercentage = useMemo(() => Math.min( - 100 - clampedFillPercentage, - Math.max(0, secondFillPercentage) - ), [clampedFillPercentage, secondFillPercentage]); - const totalFillPercentage = - useMemo(() => clampedFillPercentage + clampedSecondFillPercentage, [clampedFillPercentage, clampedSecondFillPercentage]); + const clampedFillPercentage = useMemo( + () => Math.min(100, Math.max(0, fillPercentage)), + [fillPercentage] + ); + const clampedSecondFillPercentage = useMemo( + () => + Math.min(100 - clampedFillPercentage, Math.max(0, secondFillPercentage)), + [clampedFillPercentage, secondFillPercentage] + ); + const totalFillPercentage = useMemo( + () => clampedFillPercentage + clampedSecondFillPercentage, + [clampedFillPercentage, clampedSecondFillPercentage] + ); return (
(
Date: Thu, 19 Sep 2024 17:22:07 +0800 Subject: [PATCH 35/45] requested changes --- components/RewardSimulator.tsx | 35 ++++++++++++++----- .../oracle-integrity-staking/examples.mdx | 2 ++ 2 files changed, 29 insertions(+), 8 deletions(-) diff --git a/components/RewardSimulator.tsx b/components/RewardSimulator.tsx index 96c5e229..1f7f04ef 100644 --- a/components/RewardSimulator.tsx +++ b/components/RewardSimulator.tsx @@ -11,6 +11,8 @@ const RewardSimulator: React.FC = () => { const [publisherReward, setPublisherReward] = useState(0); const [delegatorReward, setDelegatorReward] = useState(0); + const [publisherRewardRate, setPublisherRewardRate] = useState(0); + const [delegatorRewardRate, setDelegatorRewardRate] = useState(0); useEffect(() => { const calculateRewards = () => { @@ -29,6 +31,12 @@ const RewardSimulator: React.FC = () => { setPublisherReward(Number(finalPublisherReward.toFixed(2))); setDelegatorReward(Number(finalDelegatorReward.toFixed(2))); + setPublisherRewardRate( + Number(((finalPublisherReward * 100) / publisherStake).toFixed(2)) + ); + setDelegatorRewardRate( + Number(((finalDelegatorReward * 100) / delegatorStake).toFixed(2)) + ); }; calculateRewards(); @@ -94,14 +102,25 @@ const RewardSimulator: React.FC = () => { />
-
-

Calculated Rewards:

-

- {`Publisher Reward ($R^p_p$): ${publisherReward}`} -

-

- {`Delegator Reward ($R^d_p$): ${delegatorReward}`} -

+
+
+

Calculated Rewards:

+

+ {`Publisher Reward ($R^p_p$): ${publisherReward}`} +

+

+ {`Delegator Reward ($R^d_p$): ${delegatorReward}`} +

+
+
+

Calculated Reward Rates:

+

+ {`Publisher Reward Rate ($r^p_p$): ${publisherRewardRate}%`} +

+

+ {`Delegator Reward Rate ($r^d_p$): ${delegatorRewardRate}%`} +

+
); diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 51e2abb1..a43328aa 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -89,6 +89,8 @@ $$ \text{Fee paid by Delegator} \quad{F^d_p} &= {f} \times {R^d_p} = 2\% \times 30 = 0.6 \\ \text{Final Delegator Reward} \quad{R^d_p} &= {R^d_p} - {F^d_p} = 30 - 0.6 = 29.4 \\ \text{Total Publisher Reward} \quad{R^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\ +\text{Effective Publisher Yield Rate} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{20.6}{200} = 10.3\% \\ +\text{Effective Delegator Yield Rate} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{29.4}{300} = 9.8\% \\ \end{aligned} $$ From 9e96d6975cd2ce25841d3d9925884c3921e14c9e Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 19 Sep 2024 14:14:10 -0400 Subject: [PATCH 36/45] Update pages/home/oracle-integrity-staking/examples.mdx Co-authored-by: guibescos <59208140+guibescos@users.noreply.github.com> --- pages/home/oracle-integrity-staking/examples.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index a43328aa..0c987575 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -158,7 +158,7 @@ C_{p_{option1}} &= 100 + 100 \cdot \frac{1}{\max(4, 5)} \\ \end{aligned} $$ -### Option 2: Publish additional symbols where cap of 32 publishers is not reached +### Option 2: Publish additional symbols where the cap of 32 publishers is not reached Assuming there is room to publish 5 more symbols \{$s_{6}$,.., $s_{10}$\} where each have currently 9 publishers ( for i = 6 .. 10 $n_{s_i}$ = 9) From 2b96bbe27d3bb870e90c668afc976e01abb92965 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 19 Sep 2024 14:14:34 -0400 Subject: [PATCH 37/45] Update pages/home/oracle-integrity-staking/examples.mdx Co-authored-by: guibescos <59208140+guibescos@users.noreply.github.com> --- pages/home/oracle-integrity-staking/examples.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 0c987575..71935b3c 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -119,7 +119,7 @@ In this example, the stake is uniformly slashed by 5\%, affecting both the publi ## Example 6: Increasing the cap of the pool This example shows how a publisher can increase the cap of the pool assigned to them. -As described in the [Mathematical Representation](/home/pyth-token/oracle-integrity-staking/mathematical-representation#pool-cap), the cap is caluclated as: +As described in the [Mathematical Representation](/home/pyth-token/oracle-integrity-staking/mathematical-representation#pool-cap), the cap is calculated as: $$ \large{{\bold{C_p}} = M \cdot \sum_{s \in \text{Symbols\_p}} \frac{1}{\max(n_s, Z)}} From 57831e085a0dd254c652e1e72f02f5cb85b3d087 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Thu, 19 Sep 2024 14:14:41 -0400 Subject: [PATCH 38/45] Update pages/home/oracle-integrity-staking/examples.mdx Co-authored-by: guibescos <59208140+guibescos@users.noreply.github.com> --- pages/home/oracle-integrity-staking/examples.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 71935b3c..5e32c918 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -144,7 +144,7 @@ $$ Here publisher has 2 options to increase the cap of the pool assigned to it. -### Option 1: Publish new symbol with low number of publishers +### Option 1: Publish new symbol with a low number of publishers Assume the publisher decides to publish a new symbol with only 3 publishers, $n_{s_{low}}$ = 3. From 81c9b1a40fce4b7cbcdc711a9789e4c58b0a2241 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Fri, 20 Sep 2024 10:46:33 +0800 Subject: [PATCH 39/45] requested changes --- pages/home/oracle-integrity-staking.mdx | 2 +- .../home/oracle-integrity-staking/publisher-quality-ranking.mdx | 2 -- pages/home/oracle-integrity-staking/slashing-rulebook.mdx | 2 -- 3 files changed, 1 insertion(+), 5 deletions(-) diff --git a/pages/home/oracle-integrity-staking.mdx b/pages/home/oracle-integrity-staking.mdx index 26e86755..a88d9ffc 100644 --- a/pages/home/oracle-integrity-staking.mdx +++ b/pages/home/oracle-integrity-staking.mdx @@ -1,6 +1,6 @@ # Oracle Integrity Staking (OIS) -This document outlines the design principles and implementation details of the Oracle Integrity Staking (OIS) protocol. +This document outlines the design principles and implementation details of the [Oracle Integrity Staking (OIS)](https://staking.pyth.network/) protocol. ## Design Principles diff --git a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx index d7b1ea9c..e6710774 100644 --- a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx +++ b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx @@ -1,5 +1,3 @@ -import { Callout } from "nextra/components"; - # Publisher Quality Ranking This document introduces a quality ranking system to ensure high-quality pricing data on Pythnet. The ranking system will use **three** metrics to evaluate each publisher's performance: diff --git a/pages/home/oracle-integrity-staking/slashing-rulebook.mdx b/pages/home/oracle-integrity-staking/slashing-rulebook.mdx index 00555446..bdd7f3fb 100644 --- a/pages/home/oracle-integrity-staking/slashing-rulebook.mdx +++ b/pages/home/oracle-integrity-staking/slashing-rulebook.mdx @@ -1,5 +1,3 @@ -import { Steps } from "nextra/components"; - # Purpose and Scope This Pyth Slashing Rulebook (this ”Rulebook”) outlines the Terms & Conditions for slashing PYTH that has been staked for price feed accuracy on the Pyth network. This document develops the rules that the DAO must adhere to when assessing conditions and amounts of slashing. From e28b451801d0f89967e9c880ff5e84efe53144cd Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Fri, 20 Sep 2024 17:51:09 +0200 Subject: [PATCH 40/45] minor changes --- .../oracle-integrity-staking/examples.mdx | 56 +++++++++---------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/pages/home/oracle-integrity-staking/examples.mdx b/pages/home/oracle-integrity-staking/examples.mdx index 5e32c918..6191889d 100644 --- a/pages/home/oracle-integrity-staking/examples.mdx +++ b/pages/home/oracle-integrity-staking/examples.mdx @@ -16,14 +16,14 @@ $$ {S^d_p} &= 0 \\ {S^p} &= {S^p_p} + {S^d_p} = 100 + 0 = 100 \\ {C}_p &= 500 \\ -\text{Total Amount eligible for Reward} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 100) = 100 \\ -\text{Reward Rate (Yearly)} \quad{r} &= 10\% \\ - -\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 100 = 10 \\ -\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\ -\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 10 - 10 = 0 \\ -\text{Effective Publisher Yield Rate} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{10}{100} = 10\% \\ -\text{Effective Delegator Yield Rate} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{0}{0} = 0\% \\ +\text{Total Amount eligible for Rewards} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 100) = 100 \\ +\text{Annual Rate of Rewards} \quad{r} &= 10\% \\ + +\text{Total Rewards for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 100 = 10 \\ +\text{Publisher Rewards} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\ +\text{Delegator Rewards} \quad{R^d_p} &= {R_p} - {R^p_p} = 10 - 10 = 0 \\ +\text{Effective Publisher APY} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{10}{100} = 10\% \\ +\text{Effective Delegator APY} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{0}{0} = 0\% \\ \end{aligned} $$ @@ -37,14 +37,14 @@ $$ {S^d_p} &= 100 \\ {S_p} &= {S^p_p} + {S^d_p} = 100 + 100 = 200 \\ {C}_p &= 500 \\ -\text{Total Amount eligible for Reward} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 200) = 200 \\ -\text{Reward Rate (Yearly)} \quad{r} &= 10\% \\ - -\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 200 = 20 \\ -\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\ -\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 20 - 10 = 10 \\ -\text{Effective Publisher Yield Rate} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{10}{100} = 10\% \\ -\text{Effective Delegator Yield Rate} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{10}{100} = 10\% \\ +\text{Total Amount eligible for Rewards} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 200) = 200 \\ +\text{Annual Rate of Rewards} \quad{r} &= 10\% \\ + +\text{Total Rewards for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 200 = 20 \\ +\text{Publisher Rewards} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 100 = 10 \\ +\text{Delegator Rewards} \quad{R^d_p} &= {R_p} - {R^p_p} = 20 - 10 = 10 \\ +\text{Effective Publisher APY} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{10}{100} = 10\% \\ +\text{Effective Delegator APY} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{10}{100} = 10\% \\ \end{aligned} $$ @@ -58,14 +58,14 @@ $$ {S^d_p} &= 300 \\ {S_p} &= {S^p_p} + {S^d_p} = 300 + 300 = 600 \\ {C}_p &= 500 \\ -\text{Total Amount eligible for Reward} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 600) = 500 \\ -\text{Reward Rate (Yearly)} \quad{r} &= 10\% \\ - -\text{Total Reward for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 500 = 50 \\ -\text{Publisher Reward} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 300 = 30 \\ -\text{Delegator Reward} \quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 30 = 20 \\ -\text{Effective Publisher Yield Rate} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{30}{300} = 10\% \\ -\text{Effective Delegator Yield Rate} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{20}{300} = 6.67\% \\ +\text{Total Amount eligible for Rewards} \quad{E_p} &= min({S}_p, {C}_p) = min(500, 600) = 500 \\ +\text{Annual Rate of Rewards} \quad{r} &= 10\% \\ + +\text{Total Rewards for one year} \quad{R_p} &= {r} \times {E_p} = 10\% \times 500 = 50 \\ +\text{Publisher Rewards} \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 300 = 30 \\ +\text{Delegator Rewards} \quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 30 = 20 \\ +\text{Effective Publisher APY} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{30}{300} = 10\% \\ +\text{Effective Delegator APY} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{20}{300} = 6.67\% \\ \end{aligned} $$ @@ -87,10 +87,10 @@ $$ \quad{R^p_p} &= {r} \times min({S^p_p}, {C}_p) = 10\% \times 200 = 20 \\ \quad{R^d_p} &= {R_p} - {R^p_p} = 50 - 20 = 30 \\ \text{Fee paid by Delegator} \quad{F^d_p} &= {f} \times {R^d_p} = 2\% \times 30 = 0.6 \\ -\text{Final Delegator Reward} \quad{R^d_p} &= {R^d_p} - {F^d_p} = 30 - 0.6 = 29.4 \\ -\text{Total Publisher Reward} \quad{R^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\ -\text{Effective Publisher Yield Rate} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{20.6}{200} = 10.3\% \\ -\text{Effective Delegator Yield Rate} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{29.4}{300} = 9.8\% \\ +\text{Final Delegator Rewards} \quad{R^d_p} &= {R^d_p} - {F^d_p} = 30 - 0.6 = 29.4 \\ +\text{Total Publisher Rewards} \quad{R^p_p} &= {R^p_p} + {F^d_p} = 20 + 0.6 = 20.6 \\ +\text{Effective Publisher APY} \quad{r^p_p} &= \frac{R^p_p}{S^p_p} = \frac{20.6}{200} = 10.3\% \\ +\text{Effective Delegator APY} \quad{r^d_p} &= \frac{R^d_p}{S^d_p} = \frac{29.4}{300} = 9.8\% \\ \end{aligned} $$ From 4036c32918b074c436c394952b79ba11f7a9864d Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Fri, 20 Sep 2024 22:47:27 -0400 Subject: [PATCH 41/45] Update pages/home/oracle-integrity-staking/mathematical-representation.mdx Co-authored-by: guibescos <59208140+guibescos@users.noreply.github.com> --- .../oracle-integrity-staking/mathematical-representation.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/home/oracle-integrity-staking/mathematical-representation.mdx b/pages/home/oracle-integrity-staking/mathematical-representation.mdx index 744f522d..dece9f44 100644 --- a/pages/home/oracle-integrity-staking/mathematical-representation.mdx +++ b/pages/home/oracle-integrity-staking/mathematical-representation.mdx @@ -35,7 +35,7 @@ Where: - $S_p$ be the stake assigned to the publisher p pool , made of self-staked amount $S^{p}_{p}$ and delegated stake $S^{d}_{p}$ , or $S_{p} = S^{p}_{p} + S^{d}_{p}$. - $C_p$ be the stake cap for the pool assigned to publisher p. -The total amount of rewards distributed to all pools is bound the the same cap relative to the amount of rewards available to the OIS protocol. +The total amount of rewards distributed to all pools is bound by the same cap relative to the amount of rewards available to the OIS protocol. $$ \large{\sum_{p \in \text{Publishers}} R_p \leq y \cdot \min(NumSymbols \cdot M, \sum_{p=1}^{P} S_p)} From 5535be967dbeaa9affa013a6e7b91e6cf5f76c32 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Sat, 21 Sep 2024 11:12:24 +0800 Subject: [PATCH 42/45] requested changes --- pages/home/oracle-integrity-staking.mdx | 2 +- .../oracle-integrity-staking/mathematical-representation.mdx | 4 ++-- .../oracle-integrity-staking/publisher-quality-ranking.mdx | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pages/home/oracle-integrity-staking.mdx b/pages/home/oracle-integrity-staking.mdx index a88d9ffc..ef03d576 100644 --- a/pages/home/oracle-integrity-staking.mdx +++ b/pages/home/oracle-integrity-staking.mdx @@ -28,7 +28,7 @@ OIS implements the design principles above through the following structure: - The staking pool assigned to each publisher covers all price feeds/symbols they publish. - Each staking pool has a soft cap. This soft cap dynamically expands and shrinks given the number of symbols published by the assigned publisher. - Price feeds with a low number of publishers contribute more to the cap's expansion. - - Staking into the pool can exceed the soft cap. However no rewards are paid nor penalties are levied on the excess amount. + - Staking into the pool can exceed the soft cap. However no rewards are paid for the excess amount. On the contrary, the excess amount is subject to the penalty if the assigned publisher's data is inaccurate. - The OIS protocol prioritizes self-stake attributed to the **publisher's stake** when distributing rewards to the publisher's pool. - All staking pools charge the same delegation fee for stakers who are delegating stake to one or many pools. 3. Each pool has a maximum reward rate per epoch, which applies only to the staked amount within the soft cap. diff --git a/pages/home/oracle-integrity-staking/mathematical-representation.mdx b/pages/home/oracle-integrity-staking/mathematical-representation.mdx index dece9f44..54bca5c1 100644 --- a/pages/home/oracle-integrity-staking/mathematical-representation.mdx +++ b/pages/home/oracle-integrity-staking/mathematical-representation.mdx @@ -38,12 +38,12 @@ Where: The total amount of rewards distributed to all pools is bound by the same cap relative to the amount of rewards available to the OIS protocol. $$ -\large{\sum_{p \in \text{Publishers}} R_p \leq y \cdot \min(NumSymbols \cdot M, \sum_{p=1}^{P} S_p)} +\large{\sum_{p \in \text{Publishers}} R_p \leq y \cdot \min(N \cdot M, \sum_{p=1}^{P} S_p)} $$ Where: -- $NumSymbols$ is the total number of symbols in the system. +- $N$ is the total number of symbols in the system. - $P$ is the total number of publishers in the system. Whereas the reward component relative to the amount self-staked by the publisher $p$ is defined as: diff --git a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx index e6710774..4f7a3347 100644 --- a/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx +++ b/pages/home/oracle-integrity-staking/publisher-quality-ranking.mdx @@ -12,7 +12,7 @@ The ranking will be calculated **monthly** to ensure that only the top-performin Publishers in Pythtest conformance who are not publishing on Pythnet and pass this uptime condition will also be ranked together with the Pythnet publishers for each symbol. -Checkout [Pubslisher Rankings](https://www.pyth.network/publishers/ranking) on the main website to see the updated rank of the publishers. +Checkout [Publisher Rankings](https://www.pyth.network/publishers/ranking) on the main website to see the updated rank of the publishers. ## Metrics Used for Ranking From 06981c9e2eb1538f2d721f55e0cc30399aebbf44 Mon Sep 17 00:00:00 2001 From: Aditya Arora Date: Sat, 21 Sep 2024 13:57:42 +0800 Subject: [PATCH 43/45] nits --- .../mathematical-representation.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pages/home/oracle-integrity-staking/mathematical-representation.mdx b/pages/home/oracle-integrity-staking/mathematical-representation.mdx index 54bca5c1..8879978e 100644 --- a/pages/home/oracle-integrity-staking/mathematical-representation.mdx +++ b/pages/home/oracle-integrity-staking/mathematical-representation.mdx @@ -26,7 +26,7 @@ This formula ensures that symbols with a lower number of publishers contribute m The reward $R_p$ distributed to each pool is calculated as follows: $$ -\large{R_p = y \cdot \min(S_p, C_p)} +\large{\bold{R_p} = y \cdot \min(S_p, C_p)} $$ Where: @@ -49,7 +49,7 @@ Where: Whereas the reward component relative to the amount self-staked by the publisher $p$ is defined as: $$ -\large{R^{p}_{p} = y \cdot \min(S^p_p, C_p) = R_p - R^d_p} +\large{\bold{R^{p}_{p}} = y \cdot \min(S^p_p, C_p) = R_p - R^d_p} $$ Where: @@ -63,7 +63,7 @@ Slashing is an important aspect of the OIS protocol to ensure the integrity of t The slashed amount for each pool is calculated as follows: $$ -\large{SL_p = w \cdot S_p = w \cdot (S^{p}_{p} + S^{d}_{p})} +\large{\bold{SL_p} = w \cdot S_p = w \cdot (S^{p}_{p} + S^{d}_{p})} $$ Where: @@ -77,11 +77,11 @@ Here $SL_p$ is uniformly allocated to both the self-staking publisher and delega Subsequently, the rewards received by a publisher and delegators into a pool, net of any slashed amounts can be expressed as below: $$ -\large{\Pi^p_p = ( R^p_p + f \cdot R^d_p ) - w \cdot S^p_p} +\large{\bold{\Pi^p_p} = ( R^p_p + f \cdot R^d_p ) - w \cdot S^p_p} $$ $$ -\large{\Pi^d_p = R^d_p - ( f \cdot R^d_p + w \cdot S^d_p )} +\large{\bold{\Pi^d_p} = R^d_p - ( f \cdot R^d_p + w \cdot S^d_p )} $$ Where: From 34908e8de3cde407a0b1241a59b6844d7cc9bdf8 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Sat, 21 Sep 2024 08:16:46 +0200 Subject: [PATCH 44/45] minor change --- pages/home/oracle-integrity-staking.mdx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/home/oracle-integrity-staking.mdx b/pages/home/oracle-integrity-staking.mdx index ef03d576..43991c3f 100644 --- a/pages/home/oracle-integrity-staking.mdx +++ b/pages/home/oracle-integrity-staking.mdx @@ -33,4 +33,4 @@ OIS implements the design principles above through the following structure: - All staking pools charge the same delegation fee for stakers who are delegating stake to one or many pools. 3. Each pool has a maximum reward rate per epoch, which applies only to the staked amount within the soft cap. 4. The total amount of rewards paid to all pools is bound by the same cap relative to the amount of rewards available to the OIS protocol. -5. Slashing of stake has a hard cap and only impacts pools that assigned to publishers responsible for the poor data quality. Both self-stakers and delegators are also slashed proportionally to their staked amount in the impacted pools. +5. Slashing of stake has a hard percentage cap and only impacts pools that assigned to publishers responsible for the poor data quality. Both self-stakers and delegators are also slashed proportionally to their staked amount in the impacted pools. From d4dd31d9136e6f2bea22b4159f5dc76a94d7b484 Mon Sep 17 00:00:00 2001 From: yj <47570215+YaserJazouane@users.noreply.github.com> Date: Sat, 21 Sep 2024 08:25:02 +0200 Subject: [PATCH 45/45] minor changes --- pages/home/oracle-integrity-staking/slashing-rulebook.mdx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/pages/home/oracle-integrity-staking/slashing-rulebook.mdx b/pages/home/oracle-integrity-staking/slashing-rulebook.mdx index bdd7f3fb..52928773 100644 --- a/pages/home/oracle-integrity-staking/slashing-rulebook.mdx +++ b/pages/home/oracle-integrity-staking/slashing-rulebook.mdx @@ -30,7 +30,7 @@ The Pyth Network is designed to provide reliable and trustworthy financial data Staking through OIS is a program to enhance the security of price feeds produced by publisher on the Pyth Network. -Per the design of OIS, a pool aligned with a data publisher accepts stake from the moment such publisher declares its stake account through configuration. The additional stake allows such publisher to earn a delegation fee to contribute to the costs of providing data to the Pyth Network. Data publishers compete with one another to increase the number of price feeds they contribute to, and/or increase the quality of data that allows them to be selected to publish and/or enable higher staking cap for the pool each publisher is aligned to. +Per the design of OIS, a pool aligned with a data publisher accepts stake from the publisher itself and from delegators. The additional stake allows such publisher to earn a delegation fee to contribute to the costs of providing data to the Pyth Network. Data publishers compete with one another to increase the number of price feeds they contribute to, and/or increase the quality of data that allows them to be selected to publish and/or enable higher staking cap for the pool each publisher is aligned to. ## Slashing @@ -52,8 +52,6 @@ If slashing event confirmed, the Pythian Council will process calculation and di - **Stake Slashed** - capped at 5% of the total amount staked (including the amount delegated) into pools associated with publishers identified as directly responsible for poor data quality. distribution of the slashed amount is uniform amongst publishers and delegator(s) - In the case the total amount staked by the stakers responsible for the data quality issue is nil, no slashing takes place -- **Loss of Rewards** - - the stakers that may be responsible for the data quality issue forfeit any rewards the epoch following the slashing event - **Temporary or Permanent Removal:** - Stakers responsible for more than 4 slashing events per calendar year may be excluded permanently from the network exclusion from the set of stakers and/or publishers