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

Adjust Polkadot inflation with auctions (once enabled) #8174

Open
jacogr opened this issue Sep 27, 2022 · 6 comments · May be fixed by #8400
Open

Adjust Polkadot inflation with auctions (once enabled) #8174

jacogr opened this issue Sep 27, 2022 · 6 comments · May be fixed by #8400

Comments

@jacogr
Copy link
Member

jacogr commented Sep 27, 2022

See paritytech/polkadot#5872

@kianenigma
Copy link

and how is this number being computed? the comment I see from Gav when he first changed the inflation rate logic says:

// 30% reserved for up to 60 slots.
let auction_proportion = Perquintill::from_rational(auctioned_slots.min(60), 200u64);

// Therefore the ideal amount at stake (as a percentage of total issuance) is 75% less the
// amount that we expect to be taken up with auctions.
let ideal_stake = Perquintill::from_percent(75).saturating_sub(auction_proportion);

So with 41 parachains, Kusama's ideal stake should be 75 - ~20 = 55%.

@kianenigma
Copy link

okay, I guess the issue is that auctions::auctionCounter is mistakenly used (54), and it is wrong. From where is the apps getting the right number of "active parachains" (41, not 54)?

@jacogr
Copy link
Member Author

jacogr commented Sep 29, 2022

Using auctionCounter is correct, also as per the Rust codebase.

The discrepancy is most-probably related to this - https://github.com/paritytech/polkadot/blob/816cb64ea16102c6c79f6be2a917d832d98df757/runtime/kusama/src/lib.rs#L526-L527

The param config is literally 30% as per the comment as opposed to using 200u6 as the divisor.

Suggestion for the calcs here are always appreciated (probably not this issue, since it related to functionality adjustment, not "it doesn't quite line up") -

  • calcs -
    function calcInflation (api: ApiPromise, totalStaked: BN, totalIssuance: BN, numAuctions: BN): Inflation {
    const { auctionAdjust, auctionMax, falloff, maxInflation, minInflation, stakeTarget } = getInflationParams(api);
    const stakedFraction = totalStaked.isZero() || totalIssuance.isZero()
    ? 0
    : totalStaked.mul(BN_MILLION).div(totalIssuance).toNumber() / BN_MILLION.toNumber();
    const idealStake = stakeTarget - (Math.min(auctionMax, numAuctions.toNumber()) * auctionAdjust);
    const idealInterest = maxInflation / idealStake;
    const inflation = 100 * (minInflation + (
    stakedFraction <= idealStake
    ? (stakedFraction * (idealInterest - (minInflation / idealStake)))
    : (((idealInterest * idealStake) - minInflation) * Math.pow(2, (idealStake - stakedFraction) / falloff))
    ));
    return {
    idealInterest,
    idealStake,
    inflation,
    stakedFraction,
    stakedReturn: stakedFraction
    ? (inflation / stakedFraction)
    : 0
    };
    }
  • params -
    [KUSAMA_GENESIS]: { ...DEFAULT_PARAMS, auctionAdjust: (0.3 / 60), auctionMax: 60, stakeTarget: 0.75 },

@jacogr jacogr linked a pull request Nov 23, 2022 that will close this issue
2 tasks
@kianenigma
Copy link

Any updates on this? it has caused some confusion here and there.

@TarikGul
Copy link
Member

TarikGul commented Apr 5, 2024

As a suggestion by Alex Birdo, probably best to just remove the confusion by removing the text for now then, we can add it back in when corrected.

@kianenigma
Copy link

Yes, happy to see this removed.

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 a pull request may close this issue.

3 participants