Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

QIP-0011.md: Initial commit of Quai-Qi Conversion Controller #32

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

kiltsonfire
Copy link
Contributor

No description provided.

qip-0011.md Outdated Show resolved Hide resolved
qip-0011.md Outdated Show resolved Hide resolved
qip-0011.md Outdated Show resolved Hide resolved
qip-0011.md Outdated Show resolved Hide resolved
Copy link
Contributor

@wizeguyy wizeguyy left a comment

Choose a reason for hiding this comment

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

I left a few comments, but there are a lot of LaTeX formatting issues which makes it hard to scrutinize the math. I'll take a look again once those are fixed

@kiltsonfire kiltsonfire force-pushed the quaiqi branch 8 times, most recently from 575f93a to 78704b4 Compare February 23, 2024 22:00
means that when there are equivalent value conversion flows from quai to qi
and qi to quai for conversions, the exchange rate controller has found the
market equilibrium exchange rate for Qi and Quai. When the miners are choosing
rewards in Qu and rewards in quai for mining a block at an equivalent frequency,
Copy link
Contributor

Choose a reason for hiding this comment

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

Qu*

The projected GPU efficiency is introduced to help Qi be more strictly reflective of the electricity
cost component in mining. This will help Qi maintain a more stable purchasing power compared
to having a reward function that does not adjust with GPU efficiency. Again the primary goal
being to have a low enough volotility in the change in purchasing power to allow goods and
Copy link
Contributor

Choose a reason for hiding this comment

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

volatility*

of the controller will be to maintain equivalent aggregate demand for Qi and Quai. The hash equivalent value
needs to be updated with each step. The $\bar{R}_{hash}$ will be computed as follows:

$$ \bar{R}\_{hash} = \sum_{l=n-m}^{n} \frac{D_{quai,l} - D_{qi,l}}{D_{quai,l} + D_{qi,l}} $$
Copy link
Contributor

Choose a reason for hiding this comment

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

this sum is not rendering properly, n should be above the summation symbol

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know how to fix this


$$ \bar{R}\_{mined} = \frac{\sum_{l=n-m}^n M_{choice,i,j,l}}{m} $$

where $n$ is the block number, $m = 50$ is the depth over which the average is taken. This will create an output which ranges from 0 to 1. The controller for calulating the $k_{quai,reward}(\bar{R}_{mined})$ will take the form of:
Copy link
Contributor

Choose a reason for hiding this comment

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

is it 50 or hundered, you say 100 in the above paragraph

$$

Based on the launch date of quai this function will need to be adjusted to account
for both the start date as well as the conversion between block number and year.
Copy link
Contributor

Choose a reason for hiding this comment

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

How do we use this extracted data to determine ϵ ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I derived the function that has an input in years, we need to convert that to an input in blocks. Then given t0 + n you can get a relative efficiency.

Copy link
Contributor

@wizeguyy wizeguyy Feb 27, 2024

Choose a reason for hiding this comment

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

So you are saying ϵ is the discrete form of f ( x ) ? IMO it would be helpful to put that in the spec, so that readers can connect the dots.

### Exchange Rate Controller ###

The exchange rate controller input will be the simple moving average of the
aggregate hash equivalent demand, $\bar{R}\_{hash}$ for Qi, $D_{qi}$, and Quai, $D_{quai}$ over a period of 100 prime blocks. The setpoint
Copy link
Contributor

@wizeguyy wizeguyy Feb 26, 2024

Choose a reason for hiding this comment

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

What are D q i and D q u a i ?

Copy link
Contributor Author

@kiltsonfire kiltsonfire Feb 26, 2024

Choose a reason for hiding this comment

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

The demand for converting to Qi and the demand for converting to Quai measured in hash.

Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to put that in the spec.

of the controller will be to maintain equivalent aggregate demand for Qi and Quai. The hash equivalent value
needs to be updated with each step. The $\bar{R}_{hash}$ will be computed as follows:

$$ \bar{R}\_{hash} = \sum_{l=n-m}^{n} \frac{D_{quai,l} - D_{qi,l}}{D_{quai,l} + D_{qi,l}} $$
Copy link
Contributor

@wizeguyy wizeguyy Feb 26, 2024

Choose a reason for hiding this comment

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

Why use an inefficient FIR design (lots of memory and subsequent computations) instead of an IIR design (no memory and only a single iterative computation, just like the DAA, the gas limit filter, or any of the QIP10 filters)?

Copy link
Contributor Author

@kiltsonfire kiltsonfire Feb 26, 2024

Choose a reason for hiding this comment

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

Its not stable. Notice that the converted values are being recomputed to the relative hash at the current rate rather than converted them in each step and taking the average that incorporates the previous unadjusted rate.

Copy link
Contributor

@wizeguyy wizeguyy Feb 27, 2024

Choose a reason for hiding this comment

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

Which values are getting recomputed? Are you saying D q u a i , i and D q i , i for a given i will differ over time? I would expect that the demand at block i is the same forever after block i has been accepted.

What I propose is this:
R ¯ [ n ] = α R [ n 1 ] + ( 1 α ) R [ n ] , where R [ n ] = D q u a i [ n ] D q i [ n ] D q u a i [ n ] + D q i [ n ]

How does that result in instability? α can be selected to give practically equivalent characteristics to your 100 tap FIR filter, but only requiring a single tap in the IIR form.

Even your PI controller below is implemented as an IIR. Implementation would be a lot simpler for the final form of the controller to be a cascade of two first order IIR filters


where $n$ is the block number, $m= 100$ is the depth over which the average is taken. This will create an output that ranges from -1 to 1. This will be the input on which the controller operates. The controller for computing $k_{quai,exchange}(\bar{R}_{hash})$ will take the following form:

$$ k_{quai,exchange}(\bar{R}\_{hash}) = k_{quai,exchange}(\bar{R}\_{hash}) + k_{quai}(\bar{R}\_{hash}) * (P * \bar{R}\_{hash} + I * \sum_{l=n-m}^{n} \bar{R}\_{hash}) $$
Copy link
Contributor

Choose a reason for hiding this comment

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

This equation is infinitely recursive:

k ( R ¯ h a s h ) = k ( R ¯ h a s h ) + f ( R ¯ h a s h )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

need to add n and n-1

Copy link
Contributor

Choose a reason for hiding this comment

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

I think the index is actually on R ¯ h a s h , i.e. R ¯ h a s h [ n ]


$$ k_{quai,exchange}(\bar{R}\_{hash}) = k_{quai,exchange}(\bar{R}\_{hash}) + k_{quai}(\bar{R}\_{hash}) * (P * \bar{R}\_{hash} + I * \sum_{l=n-m}^{n} \bar{R}\_{hash}) $$

The values for $P_{exchange}$ and $I_{exchange}$ should be chosen to create stable controllers over order of magnitude changes in difficulty.
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you provide selections for P & I , as well as rationale to support those selections?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No. These are independent and are set based on aggregate system parameters and initial difficulties as well as desired system response.

But I think that the calibrated parameter for the controller is outside the scope of the controller definition.


where $n$ is the block number, $m = 50$ is the depth over which the average is taken. This will create an output which ranges from 0 to 1. The controller for calulating the $k_{quai,reward}(\bar{R}_{mined})$ will take the form of:

$$ k_{quai,mined}(\bar{R}\_{mined}) = k_{quai,mined}(\bar{R}\_{mined}) + k_{quai}(\bar{R}\_{mined}) * (P * \bar{R}\_{mined} + I * \sum_{l=n-m}^{n} \bar{R}\_{mined}) $$
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe you mean to apply the P component to R , not R ¯

Copy link
Contributor

@wizeguyy wizeguyy Feb 27, 2024

Choose a reason for hiding this comment

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

same goes for the exchange control equation above, also

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants