Skip to content

Commit

Permalink
Revert bump to ledger and consensus versions.
Browse files Browse the repository at this point in the history
This partially reverts 600f5d2, keeping
only the changes related to updating Plutus and dropping the packages to
move to `plutus-apps`.
  • Loading branch information
nc6 committed Feb 23, 2022
1 parent 75de27d commit 54155a2
Show file tree
Hide file tree
Showing 22 changed files with 265 additions and 179 deletions.
8 changes: 4 additions & 4 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/cardano-ledger
tag: 3df3ca8db4d52952cb750e8859b71f0a371323af
--sha256: 0jacfhqnj76cyjwdxz05h7rqmdasgxp9skd01f5y61xraz746x21
tag: 1a9ec4ae9e0b09d54e49b2a40c4ead37edadcce5
--sha256: 0avzyiqq0m8njd41ck9kpn992yq676b1az9xs77977h7cf85y4wm
subdir:
eras/alonzo/impl
eras/alonzo/test-suite
Expand Down Expand Up @@ -248,8 +248,8 @@ source-repository-package
source-repository-package
type: git
location: https://github.com/input-output-hk/ouroboros-network
tag: 48e498cfea694b89f99fd92ae7a86b9fcd5f29f0
--sha256: 1klgvlfcd1kxgjicws964k2xkxr79xf3vvgkbx4x7cyn4xfng166
tag: 4fac197b6f0d2ff60dc3486c593b68dc00969fbf
--sha256: 1b43vbdsr9m3ry1kgag2p2ixpv54gw7a4vvmndxl6knqg8qbsb8b
subdir:
io-sim
io-classes
Expand Down
2 changes: 1 addition & 1 deletion cardano-api/gen/Gen/Cardano/Api/Typed.hs
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ genTxId :: Gen TxId
genTxId = TxId <$> genShelleyHash

genTxIndex :: Gen TxIx
genTxIndex = TxIx . fromIntegral <$> Gen.word16 Range.constantBounded
genTxIndex = TxIx . fromIntegral <$> Gen.word32 Range.constantBounded

genTxOutValue :: CardanoEra era -> Gen (TxOutValue era)
genTxOutValue era =
Expand Down
2 changes: 1 addition & 1 deletion cardano-api/src/Cardano/Api/Block.hs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ getShelleyBlockTxs :: forall era ledgerera.
ledgerera ~ ShelleyLedgerEra era
=> Consensus.ShelleyBasedEra ledgerera
=> ShelleyBasedEra era
-> Ledger.Block (TPraos.BHeader (Ledger.Crypto ledgerera)) ledgerera
-> Ledger.Block TPraos.BHeader ledgerera
-> [Tx era]
getShelleyBlockTxs era (Ledger.Block _header txs) =
[ ShelleyTx era txinblock
Expand Down
3 changes: 1 addition & 2 deletions cardano-api/src/Cardano/Api/Fees.hs
Original file line number Diff line number Diff line change
Expand Up @@ -457,8 +457,7 @@ instance Error TransactionValidityError where
displayError (TransactionValidityBasicFailure (Alonzo.UnknownTxIns txins)) =
"The transaction contains inputs that are not present in the UTxO: "
<> show (map (renderTxIn . fromShelleyTxIn) $ Set.toList txins)
displayError (TransactionValidityBasicFailure (Alonzo.BadTranslation errmsg)) =
"Error translating the transaction context: " <> show errmsg


-- | Compute the 'ExecutionUnits' needed for each script in the transaction.
--
Expand Down
26 changes: 4 additions & 22 deletions cardano-api/src/Cardano/Api/LedgerEvent.hs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import Cardano.Ledger.Shelley.Rewards
import Cardano.Ledger.Shelley.Rules.Epoch (EpochEvent (PoolReapEvent))
import Cardano.Ledger.Shelley.Rules.Mir (MirEvent (..))
import Cardano.Ledger.Shelley.Rules.NewEpoch
(NewEpochEvent (EpochEvent, MirEvent, DeltaRewardEvent, TotalRewardEvent))
(NewEpochEvent (EpochEvent, MirEvent, RewardEvent))
import Cardano.Ledger.Shelley.Rules.PoolReap (PoolreapEvent (RetiredPools))
import Cardano.Ledger.Shelley.Rules.Tick (TickEvent (NewEpochEvent))
import Control.State.Transition (Event)
Expand All @@ -51,16 +51,13 @@ import Ouroboros.Consensus.Ledger.Basics (AuxLedgerEvent)
import Ouroboros.Consensus.Shelley.Ledger (ShelleyBlock,
ShelleyLedgerEvent (ShelleyLedgerEventTICK))
import Ouroboros.Consensus.TypeFamilyWrappers
import Cardano.Ledger.Shelley.Rules.Rupd (RupdEvent(RupdEvent))

data LedgerEvent
= -- | The given pool is being registered for the first time on chain.
PoolRegistration Certificate
| -- | The given pool already exists and is being re-registered.
PoolReRegistration Certificate
| -- | Incremental rewards are being computed.
IncrementalRewardsDistribution EpochNo (Map StakeCredential (Set (Reward StandardCrypto)))
| -- | Reward distribution has completed.
| -- | Rewards are being distributed.
RewardsDistribution EpochNo (Map StakeCredential (Set (Reward StandardCrypto)))
| -- | MIR are being distributed.
MIRDistribution MIRDistributionDetails
Expand All @@ -79,13 +76,11 @@ instance
Event (Ledger.Core.EraRule "NEWEPOCH" ledgerera) ~ NewEpochEvent ledgerera,
Event (Ledger.Core.EraRule "EPOCH" ledgerera) ~ EpochEvent ledgerera,
Event (Ledger.Core.EraRule "POOLREAP" ledgerera) ~ PoolreapEvent ledgerera,
Event (Ledger.Core.EraRule "MIR" ledgerera) ~ MirEvent ledgerera,
Event (Ledger.Core.EraRule "RUPD" ledgerera) ~ RupdEvent (Crypto ledgerera)
Event (Ledger.Core.EraRule "MIR" ledgerera) ~ MirEvent ledgerera
) =>
ConvertLedgerEvent (ShelleyBlock ledgerera)
where
toLedgerEvent evt = case unwrapLedgerEvent evt of
LEDeltaRewardEvent e m -> Just $ IncrementalRewardsDistribution e m
LERewardEvent e m -> Just $ RewardsDistribution e m
LEMirTransfer rp rt rtt ttr ->
Just $
Expand Down Expand Up @@ -142,20 +137,7 @@ pattern LERewardEvent ::
AuxLedgerEvent (LedgerState (ShelleyBlock ledgerera))
pattern LERewardEvent e m <-
ShelleyLedgerEventTICK
(NewEpochEvent (TotalRewardEvent e (Map.mapKeys fromShelleyStakeCredential -> m)))

pattern LEDeltaRewardEvent ::
( Crypto ledgerera ~ StandardCrypto,
Event (Ledger.Core.EraRule "TICK" ledgerera) ~ TickEvent ledgerera,
Event (Ledger.Core.EraRule "NEWEPOCH" ledgerera) ~ NewEpochEvent ledgerera,
Event (Ledger.Core.EraRule "RUPD" ledgerera) ~ RupdEvent (Crypto ledgerera)
) =>
EpochNo ->
Map StakeCredential (Set (Reward StandardCrypto)) ->
AuxLedgerEvent (LedgerState (ShelleyBlock ledgerera))
pattern LEDeltaRewardEvent e m <-
ShelleyLedgerEventTICK
(NewEpochEvent (DeltaRewardEvent (RupdEvent e (Map.mapKeys fromShelleyStakeCredential -> m))))
(NewEpochEvent (RewardEvent e (Map.mapKeys fromShelleyStakeCredential -> m)))

pattern LEMirTransfer ::
( Crypto ledgerera ~ StandardCrypto,
Expand Down
5 changes: 2 additions & 3 deletions cardano-api/src/Cardano/Api/LedgerState.hs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ import qualified Cardano.Ledger.Crypto as Crypto
import qualified Cardano.Ledger.Era as Ledger
import qualified Cardano.Ledger.Keys as Shelley.Spec
import qualified Cardano.Ledger.Shelley.API as ShelleyAPI
import qualified Cardano.Protocol.TPraos.API as TPraos
import qualified Cardano.Ledger.Shelley.API.Protocol as TPraos
import qualified Cardano.Ledger.Shelley.Genesis as Shelley.Spec
import qualified Cardano.Protocol.TPraos.BHeader as TPraos
import qualified Cardano.Protocol.TPraos.Rules.Tickn as Tick
Expand Down Expand Up @@ -151,7 +151,6 @@ import qualified Ouroboros.Network.Block
import qualified Ouroboros.Network.Protocol.ChainSync.Client as CS
import qualified Ouroboros.Network.Protocol.ChainSync.ClientPipelined as CSP
import Ouroboros.Network.Protocol.ChainSync.PipelineDecision
import qualified Cardano.Protocol.TPraos.Rules.Prtcl as TPraos

data InitialLedgerStateError
= ILSEConfigFile Text
Expand Down Expand Up @@ -1342,7 +1341,7 @@ nextEpochEligibleLeadershipSlots sbe sGen serCurrEpochState ptclState
-- We need the candidate nonce, the previous epoch's last block header hash
-- and the extra entropy from the protocol parameters. We then need to combine them
-- with the (⭒) operator.
let TPraos.PrtclState _ evolvingNonce candidateNonce = TPraos.csProtocol chainDepState
let ShelleyAPI.PrtclState _ evolvingNonce candidateNonce = TPraos.csProtocol chainDepState

when (evolvingNonce == candidateNonce)
$ Left LeaderErrCandidateNonceStillEvolving
Expand Down
Loading

0 comments on commit 54155a2

Please sign in to comment.