# Granada: New equation to determine block level of balance snapshots

**URL:** https://forum.tezosagora.org/t/granada-new-equation-to-determine-block-level-of-balance-snapshots/3504
**Category:** Project Updates
**Created:** [July 25, 2021, 4:47am UTC](https://forum.tezosagora.org/t/granada-new-equation-to-determine-block-level-of-balance-snapshots/3504 "2021-07-25T04:47:41Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![\_Tezzigator](https://forum.tezosagora.org/user_avatar/forum.tezosagora.org/_tezzigator/32/979_2.png) [@\_Tezzigator](https://forum.tezosagora.org/u/_Tezzigator)
#### Post date: [July 25, 2021, 4:47am UTC](https://forum.tezosagora.org/t/granada-new-equation-to-determine-block-level-of-balance-snapshots/3504/1 "2021-07-25T04:47:41Z")

</div>

Soon we will have 2 major context “constants” that will change. blocks per cycle (4096 to 8192) and blocks per snapshot (256 to 512).

This will require payout mechanisms to retool how they determine the level of the roll\_snapshot used for rights calculation. Here is my first stab at it, all my testing so far seems to indicate I’ve got it but would like some feedback

```auto
  # assuming we already have the value (0 - 15) of roll_snapshot, an we need to find its level
  if cycle > (granadaStartCycle + 6):
    snapLevel = (4096*granadaStartCycle) + ((cycle-granadaStartCycle)*8192) + ((snapNum + 1) * 512)
  else:
    snapLevel = ((cycle - 5 - 2) * 4096) + ((snapNum + 1) * 256)

```

---

<div class="post-metadata">

### Author: ![krixt](https://forum.tezosagora.org/letter_avatar_proxy/v4/letter/k/858c86/32.png) [@krixt](https://forum.tezosagora.org/u/krixt)
#### Post date: [August 5, 2021, 1:05am UTC](https://forum.tezosagora.org/t/granada-new-equation-to-determine-block-level-of-balance-snapshots/3504/2 "2021-08-05T01:05:19Z")

</div>

Where do you calculate `granadaStartCycle`? Is this another provided constant somewhere or must literally figure this out as static calculation?

---

<div class="post-metadata">

### Author: ![\_Tezzigator](https://forum.tezosagora.org/user_avatar/forum.tezosagora.org/_tezzigator/32/979_2.png) [@\_Tezzigator](https://forum.tezosagora.org/u/_Tezzigator)
#### Post date: [August 5, 2021, 2:58am UTC](https://forum.tezosagora.org/t/granada-new-equation-to-determine-block-level-of-balance-snapshots/3504/3 "2021-08-05T02:58:08Z")

</div>

granada starts at 388.  
please someone let us know if what I have is sound

---

<div class="post-metadata">

### Author: ![\_Tezzigator](https://forum.tezosagora.org/user_avatar/forum.tezosagora.org/_tezzigator/32/979_2.png) [@\_Tezzigator](https://forum.tezosagora.org/u/_Tezzigator)
#### Post date: [August 14, 2021, 5:37pm UTC](https://forum.tezosagora.org/t/granada-new-equation-to-determine-block-level-of-balance-snapshots/3504/4 "2021-08-14T17:37:51Z")

</div>

Nothing? I cant believe this isn’t interesting at all… in about 4 cycles (by my count) the process to calculate a cycle’s rights-determining snapshot level will drastically change. seems that people would be talking about it?

---

<div class="post-metadata">

### Author: ![\_Tezzigator](https://forum.tezosagora.org/user_avatar/forum.tezosagora.org/_tezzigator/32/979_2.png) [@\_Tezzigator](https://forum.tezosagora.org/u/_Tezzigator)
#### Post date: [August 22, 2021, 6:41pm UTC](https://forum.tezosagora.org/t/granada-new-equation-to-determine-block-level-of-balance-snapshots/3504/5 "2021-08-22T18:41:53Z")

</div>

OK I think that up in the OP there is wrong, I think this is correct:

```auto
  if cycle > (granadaStartCycle + 6):
    snapLevel = (4096*granadaStartCycle) + ((cycle-granadaStartCycle - 7)*8192) + ((snapNum + 1) * 512)
  else:
    snapLevel = ((cycle - 5 - 2) * 4096) + ((snapNum + 1) * 256)

```

At least this formula gives results that agree with TZStats as far as the snapshots for cycles \> 394 (Cycle 395’s snapshot is the first cycle that has its shapshot in a granada cycle. For 395 its the very first granada cycle (388) that has its snapshot )
