Skip to content

Commit

Permalink
cardano-testnet: rename fields of ShelleyTestnetOptions, to be consis…
Browse files Browse the repository at this point in the history
…tent with new name
  • Loading branch information
smelc committed Sep 16, 2024
1 parent 3b168a0 commit c6fb979
Show file tree
Hide file tree
Showing 20 changed files with 39 additions and 39 deletions.
6 changes: 3 additions & 3 deletions cardano-testnet/src/Parsers/Cardano.hs
Original file line number Diff line number Diff line change
Expand Up @@ -110,23 +110,23 @@ pGenesisOptions =
<> OA.help "Epoch length, in number of slots"
<> OA.metavar "SLOTS"
<> OA.showDefault
<> OA.value (shelleyEpochLength def)
<> OA.value (genesisEpochLength def)
)
pSlotLength =
OA.option auto
( OA.long "slot-length"
<> OA.help "Slot length"
<> OA.metavar "SECONDS"
<> OA.showDefault
<> OA.value (shelleySlotLength def)
<> OA.value (genesisSlotLength def)
)
pActiveSlotCoeffs =
OA.option auto
( OA.long "active-slots-coeff"
<> OA.help "Active slots co-efficient"
<> OA.metavar "DOUBLE"
<> OA.showDefault
<> OA.value (shelleyActiveSlotsCoeff def)
<> OA.value (genesisActiveSlotsCoeff def)
)

cmdCardano :: EnvCli -> Mod CommandFields CardanoTestnetCliOptions
Expand Down
10 changes: 5 additions & 5 deletions cardano-testnet/src/Testnet/Defaults.hs
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,13 @@ defaultShelleyGenesis
-> Api.ShelleyGenesis StandardCrypto
defaultShelleyGenesis asbe startTime maxSupply options = do
let GenesisOptions
{ shelleyTestnetMagic = magic
, shelleySlotLength = slotLength
, shelleyEpochLength = epochLength
, shelleyActiveSlotsCoeff
{ genesisTestnetMagic = magic
, genesisSlotLength = slotLength
, genesisEpochLength = epochLength
, genesisActiveSlotsCoeff
} = options
-- f
activeSlotsCoeff = round (shelleyActiveSlotsCoeff * 100) % 100
activeSlotsCoeff = round (genesisActiveSlotsCoeff * 100) % 100
-- make security param k satisfy: epochLength = 10 * k / f
-- TODO: find out why this actually degrates network stability - turned off for now
-- securityParam = ceiling $ fromIntegral epochLength * cardanoActiveSlotsCoeff / 10
Expand Down
16 changes: 8 additions & 8 deletions cardano-testnet/src/Testnet/Start/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -78,18 +78,18 @@ instance Default CardanoTestnetOptions where

-- | Options that are implemented by writing fields in the Shelley genesis file.
data GenesisOptions = GenesisOptions
{ shelleyTestnetMagic :: Int -- TODO Use the NetworkMagic type from API
, shelleyEpochLength :: Int -- ^ An epoch's duration, in number of slots
, shelleySlotLength :: Double -- ^ Slot length, in seconds
, shelleyActiveSlotsCoeff :: Double
{ genesisTestnetMagic :: Int -- TODO Use the NetworkMagic type from API
, genesisEpochLength :: Int -- ^ An epoch's duration, in number of slots
, genesisSlotLength :: Double -- ^ Slot length, in seconds
, genesisActiveSlotsCoeff :: Double
} deriving (Eq, Show)

instance Default GenesisOptions where
def = GenesisOptions
{ shelleyTestnetMagic = 42
, shelleyEpochLength = 500
, shelleySlotLength = 0.1
, shelleyActiveSlotsCoeff = 0.05
{ genesisTestnetMagic = 42
, genesisEpochLength = 500
, genesisSlotLength = 0.1
, genesisActiveSlotsCoeff = 0.05
}

-- | Specify a BFT node (Pre-Babbage era only) or an SPO (Shelley era onwards only)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ hprop_cli_queries = integrationWorkspace "cli-queries" $ \tempAbsBasePath' -> H.
eraName = eraToString era
fastTestnetOptions = def { cardanoNodeEra = asbe }
shelleyOptions = def
{ shelleyEpochLength = 100
{ genesisEpochLength = 100
-- We change slotCoeff because epochLength must be equal to:
-- securityParam * 10 / slotCoeff
, shelleyActiveSlotsCoeff = 0.5
, genesisActiveSlotsCoeff = 0.5
}

TestnetRuntime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ hprop_constitutional_committee_add_new = integrationWorkspace "constitutional-co
{ cardanoNodeEra = AnyShelleyBasedEra sbe
, cardanoNumDReps = nDrepVotes
}
shelleyOptions = def { shelleyEpochLength = 200 }
shelleyOptions = def { genesisEpochLength = 200 }

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ hprop_check_drep_activity = integrationWorkspace "test-activity" $ \tempAbsBaseP
{ cardanoNodeEra = AnyShelleyBasedEra sbe
, cardanoNumDReps = 1
}
shelleyOptions = def { shelleyEpochLength = 200 }
shelleyOptions = def { genesisEpochLength = 200 }

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ hprop_ledger_events_drep_deposits = integrationWorkspace "drep-deposits" $ \temp
{ cardanoNodeEra = AnyShelleyBasedEra sbe
, cardanoNumDReps = 0
}
shelleyOptions = def { shelleyEpochLength = 100 }
shelleyOptions = def { genesisEpochLength = 100 }

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ hprop_drep_retirement = integrationRetryWorkspace 2 "drep-retirement" $ \tempAbs

let cardanoNodeEra = AnyShelleyBasedEra sbe
fastTestnetOptions = def { cardanoNodeEra }
shelleyOptions = def { shelleyEpochLength = 50 } -- 50 * (1/10s) length, i.e. 5 seconds
shelleyOptions = def { genesisEpochLength = 50 } -- 50 * (1/10s) length, i.e. 5 seconds

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ hprop_check_gov_action_timeout = integrationWorkspace "gov-action-timeout" $ \te
sbe = conwayEraOnwardsToShelleyBasedEra ceo
asbe = AnyShelleyBasedEra sbe
fastTestnetOptions = def { cardanoNodeEra = asbe }
shelleyOptions = def { shelleyEpochLength = 200 }
shelleyOptions = def { genesisEpochLength = 200 }

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ hprop_ledger_events_info_action = integrationRetryWorkspace 0 "info-hash" $ \tem
sbe = conwayEraOnwardsToShelleyBasedEra ceo
asbe = AnyShelleyBasedEra sbe
fastTestnetOptions = def { cardanoNodeEra = asbe }
shelleyOptions = def { shelleyEpochLength = 200 }
shelleyOptions = def { genesisEpochLength = 200 }

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ hprop_gov_no_confidence = integrationWorkspace "no-confidence" $ \tempAbsBasePat
era = toCardanoEra sbe
cEra = AnyCardanoEra era
fastTestnetOptions = def { cardanoNodeEra = asbe }
shelleyOptions = def { shelleyEpochLength = 200 }
shelleyOptions = def { genesisEpochLength = 200 }

execConfigOffline <- H.mkExecConfigOffline tempBaseAbsPath

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ hprop_check_pparam_fails_spo = integrationWorkspace "test-pparam-spo" $ \tempAbs
sbe = conwayEraOnwardsToShelleyBasedEra ceo
asbe = AnyShelleyBasedEra sbe
fastTestnetOptions = def { cardanoNodeEra = asbe }
shelleyOptions = def { shelleyEpochLength = 200 }
shelleyOptions = def { genesisEpochLength = 200 }

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ hprop_check_predefined_abstain_drep = H.integrationWorkspace "test-activity" $ \
{ cardanoNodeEra = AnyShelleyBasedEra sbe
, cardanoNumDReps = 3
}
shelleyOptions = def { shelleyEpochLength = 200 }
shelleyOptions = def { genesisEpochLength = 200 }

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ hprop_ledger_events_propose_new_constitution = integrationWorkspace "propose-new
{ cardanoNodeEra = AnyShelleyBasedEra sbe
, cardanoNumDReps = numVotes
}
shelleyOptions = def { shelleyEpochLength = 200 }
shelleyOptions = def { genesisEpochLength = 200 }

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ hprop_ledger_events_propose_new_constitution_spo = integrationWorkspace "propose
era = toCardanoEra sbe
cEra = AnyCardanoEra era
fastTestnetOptions = def { cardanoNodeEra = AnyShelleyBasedEra sbe }
shelleyOptions = def { shelleyEpochLength = 100 }
shelleyOptions = def { genesisEpochLength = 100 }

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ hprop_ledger_events_treasury_donation = integrationWorkspace "treasury-donation"
let ceo = ConwayEraOnwardsConway
sbe = conwayEraOnwardsToShelleyBasedEra ceo
fastTestnetOptions = def { cardanoNodeEra = AnyShelleyBasedEra sbe }
shelleyOptions = def { shelleyEpochLength = 100 }
shelleyOptions = def { genesisEpochLength = 100 }

TestnetRuntime
{ testnetMagic
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ prop_check_if_treasury_is_growing = integrationRetryWorkspace 0 "growing-treasur
let era = ConwayEra
sbe = ShelleyBasedEraConway
options = def { cardanoNodeEra = AnyShelleyBasedEra sbe } -- TODO: We should only support the latest era and the upcoming era
shelleyOptions = def { shelleyEpochLength = 100
, shelleyActiveSlotsCoeff = 0.3
shelleyOptions = def { genesisEpochLength = 100
, genesisActiveSlotsCoeff = 0.3
}

TestnetRuntime{testnetMagic, configurationFile, poolNodes} <- cardanoTestnetDefault options shelleyOptions conf
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,8 @@ hprop_ledger_events_treasury_withdrawal = integrationRetryWorkspace 1 "treasury
eraName = eraToString era

fastTestnetOptions = def { cardanoNodeEra = AnyShelleyBasedEra sbe }
shelleyOptions = def { shelleyEpochLength = 200
, shelleyActiveSlotsCoeff = 0.3
shelleyOptions = def { genesisEpochLength = 200
, genesisActiveSlotsCoeff = 0.3
}

TestnetRuntime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -202,8 +202,8 @@ hprop_shutdownOnSlotSynced = integrationRetryWorkspace 2 "shutdown-on-slot-synce
]
}
shelleyOptions = def
{ shelleyEpochLength = 300
, shelleySlotLength = slotLen
{ genesisEpochLength = 300
, genesisSlotLength = slotLen
}
testnetRuntime <- cardanoTestnetDefault fastTestnetOptions shelleyOptions conf
let allNodes' = poolNodes testnetRuntime
Expand Down Expand Up @@ -244,7 +244,7 @@ hprop_shutdownOnSigint = integrationRetryWorkspace 2 "shutdown-on-sigint" $ \tem
conf <- mkConf tempAbsBasePath'

let fastTestnetOptions = def
shelleyOptions = def { shelleyEpochLength = 300 }
shelleyOptions = def { genesisEpochLength = 300 }
testnetRuntime
<- cardanoTestnetDefault fastTestnetOptions shelleyOptions conf
node@NodeRuntime{nodeProcessHandle} <- H.headM $ poolRuntime <$> poolNodes testnetRuntime
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ hprop_ledger_events_sanity_check = integrationWorkspace "ledger-events-sanity-ch

let fastTestnetOptions = def
shelleyOptions = def
{ shelleyEpochLength = 100
, shelleySlotLength = 0.1
{ genesisEpochLength = 100
, genesisSlotLength = 0.1
}

TestnetRuntime{configurationFile, poolNodes}
Expand Down

0 comments on commit c6fb979

Please sign in to comment.