Skip to content

Commit

Permalink
Add function to execute an action only if it's post bootstrap phase
Browse files Browse the repository at this point in the history
  • Loading branch information
teodanciu committed Apr 29, 2024
1 parent 5b57ff7 commit 475def8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions eras/conway/impl/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@

### `testlib`

* Add `withPostBootstrap` to Conway ImpTest
* Add `withImpStateWithProtVer` to Conway ImpTest
* Add the following utilities. #4273
* to `Conway.ImpTest`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ module Test.Cardano.Ledger.Conway.ImpTest (
currentProposalsShouldContain,
setupDRepWithoutStake,
withImpStateWithProtVer,
whenPostBootstrap,
) where

import Cardano.Crypto.DSIGN (DSIGNAlgorithm (..), Ed25519DSIGN, Signable)
Expand Down Expand Up @@ -162,6 +163,7 @@ import Cardano.Ledger.Crypto (Crypto (..))
import Cardano.Ledger.DRep
import Cardano.Ledger.Keys (KeyHash, KeyRole (..))
import Cardano.Ledger.Plutus.Language (SLanguage (..))
import qualified Cardano.Ledger.Shelley.HardForks as HardForks (bootstrapPhase)
import Cardano.Ledger.Shelley.LedgerState (
IncrementalStake (..),
asTreasuryL,
Expand Down Expand Up @@ -1472,3 +1474,8 @@ majorFollow pv@(ProtVer x _) = case succVersion x of
-- | An illegal ProtVer that skips 3 minor versions
cantFollow :: ProtVer -> ProtVer
cantFollow (ProtVer x y) = ProtVer x (y + 3)

whenPostBootstrap :: EraGov era => ImpTestM era () -> ImpTestM era ()
whenPostBootstrap a = do
pv <- getsNES $ nesEsL . curPParamsEpochStateL . ppProtocolVersionL
unless (HardForks.bootstrapPhase pv) a

0 comments on commit 475def8

Please sign in to comment.