cardano-ledger icon indicating copy to clipboard operation
cardano-ledger copied to clipboard

`∆r` in `RewardUpdate` can be positive, which may cause issues with serialization

Open WhatisRT opened this issue 1 year ago • 0 comments

@bwbush looked into the reserves recently, and discovered that createRUpd can in fact create a positive value for the reserves. The easiest way to see this is to assume that the rewards pot is empty, so Δr₁ = 0, but R can still be any positive number, so Δr₂ can still be positive (which happens is stake isn't distributed perfectly). This means there are two problems:

  • The Shelley spec claims this is impossible: 'this will be a negative value', right after Fig. 49.
  • The serialization seems to assume that this is impossible: https://github.com/IntersectMBO/cardano-ledger/blob/master/eras/shelley/impl/src/Cardano/Ledger/Shelley/RewardUpdate.hs#L123

I don't know if the second item can potentially cause any issues on mainnet, but even if, it's not going to until the reserves are pretty empty. However, it might be possible to observe some problems on testnets.

WhatisRT avatar Nov 21 '24 17:11 WhatisRT