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

[Bug]: Inconsistent annual-provisions values between v1 and v2 with --height flag #22302

Closed
akhilkumarpilli opened this issue Oct 17, 2024 · 2 comments · Fixed by #22435
Closed
Assignees
Labels
C:server/v2 Issues related to server/v2 T:Bug

Comments

@akhilkumarpilli
Copy link
Contributor

Description

There is an inconsistency in the annual-provisions values returned by v1 and v2 when querying with the --height flag. Specifically, when querying at initial block (height=1), v1 returns the expected provision values, while v2 returns 0.000000000000000000. This behavior should be consistent between both versions.

Steps to Reproduce

  1. Use the --height flag to query annual-provisions on both v1 and v2 for the same block height.
  2. Compare the returned values.

Example:

# Query using simd (v1) with height flag
$ simd q mint annual-provisions -o json --height 1
{
  "annual_provisions": "25000000.000000000000000000"
}
# Query using simdv2 (v2) with the same height flag
$ simdv2 q mint annual-provisions -o json --height 1
{
  "annual_provisions": "0.000000000000000000"
}

# Query using simdv2 (v2) with height 2 for comparison
$ simdv2 q mint annual-provisions -o json --height 2
{
  "annual_provisions": "25000000.000000000000000000"
}

Additional Context

It might be an issue with committing the state at genesis in v2, where height 1 is committed as an empty block.

@github-project-automation github-project-automation bot moved this to 📋 Backlog in Cosmos-SDK Oct 17, 2024
@akhilkumarpilli akhilkumarpilli added the C:server/v2 Issues related to server/v2 label Oct 17, 2024
@julienrbrt julienrbrt self-assigned this Oct 17, 2024
@julienrbrt
Copy link
Member

I'll be looking into this today 👍

@kocubinski
Copy link
Member

the v2 genesis flow is definitely confusing, but it doesn't seem to be the cause here. Here's my RCA after a couple hours of debugging:

in app/v1 this line from x/mint (via x/epochs BeginBlock) in BeforeEpochStart is called during the block 1 state transition:

return am.keeper.Minter.Set(ctx, minter)

This line never gets executed in in app/v2 in block 1 (or ever as far as I can tell), so minter.AnnualProvisions is never mutated until MintFn is called in block 2:

minter.Inflation = ic(ctx, *minter, params, bondedRatio)
minter.AnnualProvisions = minter.NextAnnualProvisions(params, stakingTokenSupply)

So the root cause seems to be x/epoch BeginBlockers not be called in app/v2. Hope this helps.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C:server/v2 Issues related to server/v2 T:Bug
Projects
Status: 🥳 Done
Development

Successfully merging a pull request may close this issue.

4 participants