Skip to content

Commit

Permalink
Remove TranslateEra instances for ShelleyGenesis
Browse files Browse the repository at this point in the history
  • Loading branch information
bartfrenk committed Dec 1, 2022
1 parent 8f0ad2b commit 20cd6ec
Show file tree
Hide file tree
Showing 6 changed files with 0 additions and 111 deletions.
22 changes: 0 additions & 22 deletions eras/alonzo/impl/src/Cardano/Ledger/Alonzo/Translation.hs
Expand Up @@ -28,7 +28,6 @@ import Cardano.Ledger.Mary (MaryEra)
import Cardano.Ledger.Shelley.API
( EpochState (..),
NewEpochState (..),
ShelleyGenesis,
StrictMaybe (..),
)
import qualified Cardano.Ledger.Shelley.API as API
Expand Down Expand Up @@ -69,27 +68,6 @@ instance Crypto c => TranslateEra (AlonzoEra c) NewEpochState where
stashedAVVMAddresses = ()
}

instance Crypto c => TranslateEra (AlonzoEra c) ShelleyGenesis where
translateEra ctxt genesis =
return
API.ShelleyGenesis
{ API.sgSystemStart = API.sgSystemStart genesis,
API.sgNetworkMagic = API.sgNetworkMagic genesis,
API.sgNetworkId = API.sgNetworkId genesis,
API.sgActiveSlotsCoeff = API.sgActiveSlotsCoeff genesis,
API.sgSecurityParam = API.sgSecurityParam genesis,
API.sgEpochLength = API.sgEpochLength genesis,
API.sgSlotsPerKESPeriod = API.sgSlotsPerKESPeriod genesis,
API.sgMaxKESEvolutions = API.sgMaxKESEvolutions genesis,
API.sgSlotLength = API.sgSlotLength genesis,
API.sgUpdateQuorum = API.sgUpdateQuorum genesis,
API.sgMaxLovelaceSupply = API.sgMaxLovelaceSupply genesis,
API.sgProtocolParams = translateEra' ctxt (API.sgProtocolParams genesis),
API.sgGenDelegs = API.sgGenDelegs genesis,
API.sgInitialFunds = API.sgInitialFunds genesis,
API.sgStaking = API.sgStaking genesis
}

newtype Tx era = Tx {unTx :: Core.Tx era}

instance
Expand Down
22 changes: 0 additions & 22 deletions eras/babbage/impl/src/Cardano/Ledger/Babbage/Translation.hs
Expand Up @@ -34,7 +34,6 @@ import Cardano.Ledger.HKD (HKDFunctor (..))
import Cardano.Ledger.Shelley.API
( EpochState (..),
NewEpochState (..),
ShelleyGenesis,
StrictMaybe (..),
)
import qualified Cardano.Ledger.Shelley.API as API
Expand Down Expand Up @@ -77,27 +76,6 @@ instance
stashedAVVMAddresses = ()
}

instance Crypto c => TranslateEra (BabbageEra c) ShelleyGenesis where
translateEra ctxt genesis =
pure
API.ShelleyGenesis
{ API.sgSystemStart = API.sgSystemStart genesis,
API.sgNetworkMagic = API.sgNetworkMagic genesis,
API.sgNetworkId = API.sgNetworkId genesis,
API.sgActiveSlotsCoeff = API.sgActiveSlotsCoeff genesis,
API.sgSecurityParam = API.sgSecurityParam genesis,
API.sgEpochLength = API.sgEpochLength genesis,
API.sgSlotsPerKESPeriod = API.sgSlotsPerKESPeriod genesis,
API.sgMaxKESEvolutions = API.sgMaxKESEvolutions genesis,
API.sgSlotLength = API.sgSlotLength genesis,
API.sgUpdateQuorum = API.sgUpdateQuorum genesis,
API.sgMaxLovelaceSupply = API.sgMaxLovelaceSupply genesis,
API.sgProtocolParams = translateEra' ctxt (API.sgProtocolParams genesis),
API.sgGenDelegs = API.sgGenDelegs genesis,
API.sgInitialFunds = API.sgInitialFunds genesis,
API.sgStaking = API.sgStaking genesis
}

newtype Tx era = Tx {unTx :: Core.Tx era}

instance
Expand Down
22 changes: 0 additions & 22 deletions eras/conway/impl/src/Cardano/Ledger/Conway/Translation.hs
Expand Up @@ -36,7 +36,6 @@ import Cardano.Ledger.Shelley.API
DState (..),
EpochState (..),
NewEpochState (..),
ShelleyGenesis,
StrictMaybe (..),
)
import qualified Cardano.Ledger.Shelley.API as API
Expand Down Expand Up @@ -77,27 +76,6 @@ instance Crypto c => TranslateEra (ConwayEra c) NewEpochState where
stashedAVVMAddresses = ()
}

instance Crypto c => TranslateEra (ConwayEra c) ShelleyGenesis where
translateEra ctxt genesis =
pure
API.ShelleyGenesis
{ API.sgSystemStart = API.sgSystemStart genesis,
API.sgNetworkMagic = API.sgNetworkMagic genesis,
API.sgNetworkId = API.sgNetworkId genesis,
API.sgActiveSlotsCoeff = API.sgActiveSlotsCoeff genesis,
API.sgSecurityParam = API.sgSecurityParam genesis,
API.sgEpochLength = API.sgEpochLength genesis,
API.sgSlotsPerKESPeriod = API.sgSlotsPerKESPeriod genesis,
API.sgMaxKESEvolutions = API.sgMaxKESEvolutions genesis,
API.sgSlotLength = API.sgSlotLength genesis,
API.sgUpdateQuorum = API.sgUpdateQuorum genesis,
API.sgMaxLovelaceSupply = API.sgMaxLovelaceSupply genesis,
API.sgProtocolParams = translateEra' ctxt (API.sgProtocolParams genesis),
API.sgGenDelegs = API.sgGenDelegs genesis,
API.sgInitialFunds = API.sgInitialFunds genesis,
API.sgStaking = API.sgStaking genesis
}

newtype Tx era = Tx {unTx :: Core.Tx era}

instance
Expand Down
21 changes: 0 additions & 21 deletions eras/shelley-ma/impl/src/Cardano/Ledger/Allegra/Translation.hs
Expand Up @@ -74,27 +74,6 @@ instance forall c. Crypto c => TranslateEra (AllegraEra c) ShelleyTx where
type TranslationError (AllegraEra c) ShelleyTx = DecoderError
translateEra _ctx = translateEraThroughCBOR "ShelleyTx"

instance Crypto c => TranslateEra (AllegraEra c) ShelleyGenesis where
translateEra ctxt genesis =
return
ShelleyGenesis
{ sgSystemStart = sgSystemStart genesis,
sgNetworkMagic = sgNetworkMagic genesis,
sgNetworkId = sgNetworkId genesis,
sgActiveSlotsCoeff = sgActiveSlotsCoeff genesis,
sgSecurityParam = sgSecurityParam genesis,
sgEpochLength = sgEpochLength genesis,
sgSlotsPerKESPeriod = sgSlotsPerKESPeriod genesis,
sgMaxKESEvolutions = sgMaxKESEvolutions genesis,
sgSlotLength = sgSlotLength genesis,
sgUpdateQuorum = sgUpdateQuorum genesis,
sgMaxLovelaceSupply = sgMaxLovelaceSupply genesis,
sgProtocolParams = translateEra' ctxt (sgProtocolParams genesis),
sgGenDelegs = sgGenDelegs genesis,
sgInitialFunds = sgInitialFunds genesis,
sgStaking = sgStaking genesis
}

--------------------------------------------------------------------------------
-- Auxiliary instances and functions
--------------------------------------------------------------------------------
Expand Down
23 changes: 0 additions & 23 deletions eras/shelley-ma/impl/src/Cardano/Ledger/Mary/Translation.hs
Expand Up @@ -65,29 +65,6 @@ instance Crypto c => TranslateEra (MaryEra c) ShelleyTx where
type TranslationError (MaryEra c) ShelleyTx = DecoderError
translateEra _ctx = translateEraThroughCBOR "ShelleyTx"

-- TODO when a genesis has been introduced for Mary, this instance can be
-- removed.
instance Crypto c => TranslateEra (MaryEra c) ShelleyGenesis where
translateEra ctxt genesis =
return
ShelleyGenesis
{ sgSystemStart = sgSystemStart genesis,
sgNetworkMagic = sgNetworkMagic genesis,
sgNetworkId = sgNetworkId genesis,
sgActiveSlotsCoeff = sgActiveSlotsCoeff genesis,
sgSecurityParam = sgSecurityParam genesis,
sgEpochLength = sgEpochLength genesis,
sgSlotsPerKESPeriod = sgSlotsPerKESPeriod genesis,
sgMaxKESEvolutions = sgMaxKESEvolutions genesis,
sgSlotLength = sgSlotLength genesis,
sgUpdateQuorum = sgUpdateQuorum genesis,
sgMaxLovelaceSupply = sgMaxLovelaceSupply genesis,
sgProtocolParams = translateEra' ctxt (sgProtocolParams genesis),
sgGenDelegs = sgGenDelegs genesis,
sgInitialFunds = sgInitialFunds genesis,
sgStaking = sgStaking genesis
}

--------------------------------------------------------------------------------
-- Auxiliary instances and functions
--------------------------------------------------------------------------------
Expand Down
Expand Up @@ -41,7 +41,6 @@ allegraTranslationTests =
testGroup
"Allegra translation binary compatibiliby tests"
[ testProperty "Tx compatibility" (testTranslation @S.ShelleyTx),
testProperty "ShelleyGenesis compatibility" (testTranslation @S.ShelleyGenesis),
testProperty "ProposedPPUpdates compatibility" (testTranslation @S.ProposedPPUpdates),
testProperty "PPUPState compatibility" (testTranslation @S.PPUPState),
testProperty "TxOut compatibility" (testTranslation @S.ShelleyTxOut),
Expand Down

0 comments on commit 20cd6ec

Please sign in to comment.