# Sifchain Validator Subsystem
##
This Validator subsystem serving the Sifchain economy is separated from the system economy where possible, with interactions with system economy clearly delineated. Importantly, the only interaction with the Liquidity Provider subsystem occurs through the quantity of stock in the Circulating Supply state. The system economy layer has control over the Validator subsystem through the Minting Policy and its parameters.
## Stock and Flow Diagram
Static version as of October 9:

## Token States
Partitioning of Token Stocks as state variables in the Sifchain economy. For any given valid state, there is an 'expected' payout that can be calculated as portions of held positions, that are compositions of system level variables. First, each position type is considered:
| Name | Description | Initial Quantity | Dynamic Characteristic | Symbol |
|----|----|----|----|----|
| Total Rowan | All Rowan | Summation of Initial States | Increasing subject to other token states | $\mathbf{S}$ |
| Circulating Supply | Slack Variable | Difference from all other token states | Subject to other token states | $\mathbf{S_C}$ |
| Validator Stake | Locked in stake by Validators | v Validators at launch x s stake | Subject to actions of Validators and Staking Policy | $\mathbf{S_V}$ |
## Stateful Parameters
| Name | Description | Initial Quantity | Dynamic Characteristic | Symbol |
|----|----|----|----|----|
| Inflation |Inflation | Summation of Initial States | Increasing subject to other token states | $I$ |
| Annual Provisions | Expected block rewards over a year, however only used at each block | Subject to Inflation and Block Time | Subject to updates on Inflation and Blocks per Year | $\mathsf{A}$ |
## Parameter Metrics
| Name | Description | Initial Quantity | Dynamic Characteristic | Symbol |
|----|----|----|----|----|
| Blocks Per Year | Expected quantity | 31,536,000 / Estimated block time in seconds | Able to be updated on upon update | $\beta$ |
| Inflation Max | Maximum Inflation Rate | Upped Bound | Not expected to change | $I_{max}$ |
| Inflation Min | Minimum Inflation Rate | Lower Bound | Not expected to change | $I_{min}$ |
| Inflation Rate Change |Bound on movement of Inflation Rate |$I_{max}- I_{min}$ | Not expected to change | $\Delta{I_{max}}$ |
| Goal Bonded | Desired Percent of bonded tokens to circulating supply | Assume to be 66% |Ratio of Validator Economy Tokens | $\gamma_v$ |
| Bonded Ratio | Actual Percent of bonded tokens | To be Determined | Subject to actions of entire economy, expected to change every block | $\rho_v$ |
## Mechanism Difference Equations
### Minting
Assume cosmos SDK minting, with the State holding two variables:
```type Minter struct {
Inflation sdk.Dec // current annual inflation rate
AnnualProvisions sdk.Dec // current annual exptected provisions
}
```
Computation of the State is aided with the following parameters:
```type Params struct {
MintDenom string // type of coin to mint
InflationRateChange sdk.Dec // maximum annual change in inflation rate
InflationMax sdk.Dec // maximum inflation rate
InflationMin sdk.Dec // minimum inflation rate
GoalBonded sdk.Dec // goal of percent bonded atoms
BlocksPerYear uint64 // expected blocks per year
}
```
The State Update to **Inflation** is recalculated each hour in current implementation (ability to increase frequency to block frequency):
```
NextInflationRate(params Params, bondedRatio sdk.Dec) (inflation sdk.Dec) {
inflationRateChangePerYear = (1 - bondedRatio/params.GoalBonded) * params.InflationRateChange
inflationRateChange = inflationRateChangePerYear/blocksPerYr
// increase the new annual inflation for this next cycle
inflation += inflationRateChange
if inflation > params.InflationMax {
inflation = params.InflationMax
}
if inflation < params.InflationMin {
inflation = params.InflationMin
}
return inflation
}
```
Updates to the **Inflation**, ${I}$, occur via an update to the change in inflation, $\Delta{I^+}$. The change in inflation is computed with the following update equation:
$$\Delta{I^+} = \frac{(1-\frac{\rho_v}{\gamma_v}) \cdot \Delta{I_{max}}}{\beta}$$
This update to the inflation rate occurs as an error term on the deviation of the percent of supply bonded in stake from that of the desired goal percentage for the system. This adjustment is limited by the maximum allowable change in annual inflation rate, $\Delta{I_{max}}$.
The new inflation rate, $I^+$, is then updated accordingly:
$$I^+ = {I} +\Delta{I^+}$$
where $I^+$ is subject to upper and lower limits, $I_{max}$ and $I_{min}$, respectively. Thus, $I^+$ will remain in the range:
$$I_{min} \leq I^+ \leq I_{max}$$
The set of ratios, $\overrightarrow \rho$, is defined as its portion of the supply with the respect to the total supply
$$\overrightarrow \rho = \left\{{\rho_v}, {\rho_l}, {\rho_t}, {\rho_c} ...\right\} $$
**Assume** Thus, `bondedRatio`, $\rho_v$, is computed as:
$$\rho_v = \frac{\mathbf{S_V}}{\mathbf{S}}$$
The input to the control system is the observed current state of the system, represented by vector $\overrightarrow \rho$.
- The observed supply in Validator Subsystem ${\rho_v}$
- The observed supply in Liquidity Provider Subsystem ${\rho_l}$
- The observed supply in Team Subsystem ${\rho_t}$
- The observed supply in Circulating Economy ${\rho_c}$
Via comment ALT definition:
:::warning
$$\rho_v = \frac{\mathbf{S_V}}{\mathbf{S_C}}$$
:::
:::info
If the ratio supply staked in validation to the circulating supply desired, then it can be obtained according to its $\rho$ components:
$$ \frac{\mathbf{S_v}}{\mathbf{S_c}} = \frac{\rho_v}{\rho_c}$$
:::
<!-- ^ NEED REFERENCE HOWEVER -->
**IMPORTANT:** This is the inclusion of the Sifchain system economy into the validation susbsytem.
**Assume** `BlocksPerYear`, $\beta$, is static and computed as:
$$\beta = \frac{31,536,000}{\mathbf{T_{avg-est}}}$$
<!-- ^ NEED REFERENCE HOWEVER FOR METHOD TO UPDATE block frequency $\beta$ -->
**IMPORTANT:** This is the inclusion of time into the validation susbsytem.
Then the **AnnualProvisions** State, $\mathsf{A}$, is updated with the new **Inflation**, ${I}$, according to:
```
NextAnnualProvisions(params Params, totalSupply sdk.Dec) (provisions sdk.Dec) {
return Inflation * totalSupply
```
$$\mathsf{A} = {I} \cdot \mathbf{S}$$
:::warning
If using ALT definition: minting from S (total) though ${\mathbf{S_V}}$ and ${\mathbf{S_C}}$ are used in the target
:::
Then, the block reward is computed for that block:
```
BlockProvision(params Params) sdk.Coin {
provisionAmt = AnnualProvisions/ params.BlocksPerYear
return sdk.NewCoin(params.MintDenom, provisionAmt.Truncate())
```
$$\Delta{\mathbf{B}} = \frac{\mathsf{A}}{\beta} $$
We can represent flows (change) as:
$$ \mathbf{b} = \Delta{\mathbf{B}}$$
The total Rowan is updated as:
$$\mathbf{S^+} = \mathbf{S} + \mathbf{b} $$
And these Rowan are deposited in the account of Validator's wallet, effectively being introduced into circulating supply:
$$\mathbf{S_C^+} = \mathbf{S_C} + \mathbf{b} $$
### Minting Parameterization
The goal of this section is to characterize the minting mechanism that allows for a control policy to be implemented upon on it. Importantly, this characterization must be specified in a way to co-exist with the liquidity pool subsystem.
| Name | Domain | Symbol | Notes |
|----|----|----|----|----|
| Blocks Per Year | $D = \mathbb{Z}^+$ | $\beta$ |31,536,000 / Estimated block time in seconds |
| Inflation Max | $D = (0,1]$ |$I_{max}$ |Upped Bound on Inflation Rate |
| Inflation Min | $D = [0,1)$ |$I_{min}$ | Lower Bound on Inflation Rate |
| Inflation Rate Change |$D = (0,1)$ |$\Delta{I_{max}}$ | Bound on movement of Inflation Rate Assume: $\Delta{I_{max}} = I_{max}- I_{min}$|
| Goal Bonded | $D = (0,1)$ | $\gamma_v$ |Desired Ratio of Validator Economy Tokens |
| Bonded Ratio | $D = (0,1)$ | $\rho_v$ |Actual Percent of bonded tokens |
| Validator Control Parameter | $D = [0,1]$ | $\lambda_v$ |Validator Component of $\overrightarrow{\lambda}$ |
Control parameter, $\overrightarrow{\lambda}$ is defined as the set of components:
$$\overrightarrow{\lambda} = \{\lambda_v, \lambda_l,...,\lambda_c,\lambda_t\}$$
where $\lambda_v$ will provide an update (exert influence) to the goal bonded ratio, $\gamma_v^+$. $\gamma_v^+$ is one of a set defined of ratios of total supply, where:
$$\overrightarrow{\gamma} = \{\gamma_v, \gamma_l,...,\gamma_c,\gamma_t\}$$
It is expected that only the validator and liquidity pool component of these parameters would be employed. However, this framework allows for the ability to control other subsets of supply tokens if they are not purely dependent upon $\mathbf{S_V}$ and $\mathbf{S_L}$.
Substituting the partitioned framework set of equations in the Minting Mechanism for the determination of block rewards:
$$\mathbf{b} =\frac{(I + \frac{(1-\frac{\rho_v}{\gamma_v}) \cdot \Delta{I_{max}}}{\beta}) \cdot \mathbf{S}}{\beta}$$
Substituting $\rho_v$ with $\frac{\mathbf{S_V}}{\mathbf{S}}$:
$$\mathbf{b} =\frac{(I + \frac{(1-\frac{\frac{\mathbf{S_V}}{\mathbf{S}}}{\gamma_v}) \cdot \Delta{I_{max}}}{\beta}) \cdot \mathbf{S}}{\beta}$$
:::warning
$$\mathbf{b} =\frac{(I + \frac{(1-\frac{\frac{\mathbf{S_V}}{\mathbf{S_C}}}{\gamma_v}) \cdot \Delta{I_{max}}}{\beta}) \cdot \mathbf{S}}{\beta}$$
:::
Distributing and separating terms:
$$\mathbf{b} =\frac{I \cdot\mathbf{S}}{\beta}+ \frac{ \Delta{I_{max}} \cdot {\gamma_v} \cdot \mathbf{S}}{\beta^2} - \frac{\Delta{I_{max}} \cdot \mathbf{S_v} }{\beta^2}$$
:::warning
$$\mathbf{b} =\frac{I \cdot\mathbf{S}}{\beta}+ \frac{ \Delta{I_{max}} \cdot {\gamma_v} \cdot \mathbf{S}}{\beta^2} - \frac{\Delta{I_{max}} \cdot \mathbf{S}\cdot \frac{\mathbf{S_v}}{\mathbf{S_c}} }{\beta^2}$$
:::
The first term represents the current inflation mechanism. The summation of the second and third terms provides the update to the minting mechanism. When the amount in staking is less than the goal, the second term outweighs the third term, the summation i positive and block rewards are increased. When the amount in staking is more than the goal, the third term outweighs the second term, the summation is negative and block rewards are decreased.
Introducing the system control parameter $\lambda$ into the minting mechanism:
$$\mathbf{b}(\lambda_v)=\frac{I \cdot\mathbf{S}}{\beta}+ \lambda_v \cdot \left[ \frac{ \Delta{I_{max}} \cdot {\gamma_v} \cdot \mathbf{S}}{\beta^2} - \frac{\Delta{I_{max}} \cdot \mathbf{S_v} }{\beta^2} \right] $$
:::warning
$$\mathbf{b}(\lambda_v)=\frac{I \cdot\mathbf{S}}{\beta}+ \lambda_v \cdot \left[ \frac{ \Delta{I_{max}} \cdot {\gamma_v} \cdot \mathbf{S}}{\beta^2} - \frac{\Delta{I_{max}} \cdot \mathbf{S}\cdot \frac{\mathbf{S_v}}{\mathbf{S_c}} }{\beta^2} \right] $$
:::
where a $\lambda_v$ value of 0, will exert no new influence on the mechanism and minting would continue at the same rate as in the prvious block. A $\lambda_v$ value of 1 would exert the full influence of the update to the minting rate, while still metered with respect to the difference between goal and desired ratios of validator tokens to supply, as well as the limits on $I$, specifically: $\Delta{I_{max}}$, $I_{max}$, and $I_{min}$.
### Staking
A delegated proof of stake protocol exists, where the top $v$ validators are selected at each block.
A validator at any given time is considered to be in one of three states:
1. Bonded
1. Unbonding
1. Unbonded
Bonded validators are the elements $v$ validators in the set that are chosen for that particular block. Only these validators are eligible for rewards.
The unbonding state provides validators with a transition period for validators not chosen for validation, whether due to not enough power or a slashing offense. Unbonded tokens exert a pressure on the bonded validators, quantifying the momentum of the validator subsystem. Tokens that are in the unbonded pool of tokens are not eligible for rewards. Therefore, the unbonded pool of tokens are not participating in the validator economy.
$$ \mathbf{s^i_{unbonded}} \subset S_{C} $$ where $$i \notin v$$
<!-- Pre-mined, or incentive policy to attract validators at start? -->
Newly staked funds arrive from circulating supply, regardless of whether the funds were previously in a liquidity pool:
$$ \mathbf{S_V^+} = \mathbf{S_C} - \mathbf{s_{v}}$$
### Slashing
Validators committing a slashable offense have their stake removed by a slash factor, $\sigma$. The rate of slash depends on the offense and state of the validator. Also the offense may result in the validator being jailed.
Slashing Percentages based on a small set of offenses and validator states with corresponding rates:
$$\mathbf{s_{slash}^i} = \sigma_i \cdot \mathbf{S_V^i}$$
For a given block across all slashed vaildators:
$$\mathbf{s_{slash}} = \sum^i\sigma_i \cdot \mathbf{S_V^i}$$
Slashed funds are removed from stake:
$$ \mathbf{S_V^+} = \mathbf{S_V} - \mathbf{s_{slash}}$$
Slashed funds are burned:
$$ \mathbf{S^+} = \mathbf{S} - \mathbf{s_{slash}}$$
### Delegators
Delegators are considered to be a secondary set of actors in the validator subsystem economy. Delegators earn shares of claims to rewards with their delgated stake tokens. Delegators are incurring slashing risk if they choose an untrustworthy validator.
Delegated tokens are treated as bonded tokens and eligible for block rewards in the same exact manner that as if it were the validator putting up its own stake, from the point of view of the minting mechanism.
Validators may charge a commission fee to delegators. This again is a secondary flow for participation in the validator economy. Where essentially a slightly greater than proportional block rewards are flowing to the validator with respect to the delegator.
Delegators will choose to participate in this action where their portion of block rewards less commission fees is greater than a competing choice of action (provide liquidity) with their tokens.
Validators will continue to participate in this economy when their portion of rewards and commission fees less their operational costs is more profitable than a competing choice.
<!-- 5. Describe value for delegators (portion of rewards - commission fee)
6. Describe value for validators (portion of rewards + commission fees - operational costs) -->