Skip to content

Commit

Permalink
Remove allowScriptStakeCredsToEarnRewards hardfork switch
Browse files Browse the repository at this point in the history
since it was verified that removing it creates the same ledger state,
proving the switch unnecessary.
  • Loading branch information
teodanciu committed Nov 28, 2022
1 parent 40f427f commit fcd476b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
9 changes: 0 additions & 9 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/HardForks.hs
Expand Up @@ -6,7 +6,6 @@ module Cardano.Ledger.Shelley.HardForks
( aggregatedRewards,
allowMIRTransfer,
validatePoolRewardAccountNetID,
allowScriptStakeCredsToEarnRewards,
missingScriptsSymmetricDifference,
forgoRewardPrefilter,
allowOutsideForecastTTL,
Expand Down Expand Up @@ -43,14 +42,6 @@ validatePoolRewardAccountNetID ::
Bool
validatePoolRewardAccountNetID pp = pvMajor (getField @"_protocolVersion" pp) > natVersion @4

-- | Starting with protocol version 5, Stake Credentials bound by scripts
-- will be eligibile for staking rewards.
allowScriptStakeCredsToEarnRewards ::
(HasField "_protocolVersion" pp ProtVer) =>
pp ->
Bool
allowScriptStakeCredsToEarnRewards pp = pvMajor (getField @"_protocolVersion" pp) > natVersion @4

-- | Starting with protocol version 7, the UTXO rule predicate failure
-- MissingScriptWitnessesUTXOW will not be used for extraneous scripts
missingScriptsSymmetricDifference ::
Expand Down
8 changes: 3 additions & 5 deletions eras/shelley/impl/src/Cardano/Ledger/Shelley/Rewards.hs
Expand Up @@ -220,14 +220,12 @@ instance CC.Crypto c => FromCBOR (PoolRewardInfo c) where
)

notPoolOwner ::
HasField "_protocolVersion" pp ProtVer =>
pp ->
PoolParams c ->
Credential 'Staking c ->
Bool
notPoolOwner pp pps = \case
notPoolOwner pps = \case
KeyHashObj hk -> hk `Set.notMember` ppOwners pps
ScriptHashObj _ -> HardForks.allowScriptStakeCredsToEarnRewards pp
ScriptHashObj _ -> True

-- | The stake pool member reward calculation
rewardOnePoolMember ::
Expand Down Expand Up @@ -257,7 +255,7 @@ rewardOnePoolMember
rewardInfo
hk
(Coin c) =
if prefilter && notPoolOwner pp (poolPs rewardInfo) hk && r /= Coin 0
if prefilter && notPoolOwner (poolPs rewardInfo) hk && r /= Coin 0
then Just r
else Nothing
where
Expand Down
Expand Up @@ -438,7 +438,7 @@ rewardOnePool
notPoolOwner hk
]
notPoolOwner (KeyHashObj hk) = hk `Set.notMember` ppOwners pool
notPoolOwner (ScriptHashObj _) = HardForks.allowScriptStakeCredsToEarnRewards pp
notPoolOwner (ScriptHashObj _) = True
lReward =
leaderRew
poolR
Expand Down

0 comments on commit fcd476b

Please sign in to comment.