Skip to content

Commit

Permalink
Merge pull request #143 from input-output-hk/newhoggy/provide-additio…
Browse files Browse the repository at this point in the history
…nal-constraints-in-shelleyBasedEraConstraints

Provide additional constraints in `shelleyBasedEraConstraints`
  • Loading branch information
newhoggy authored Jul 27, 2023
2 parents b3b7474 + f3d05c8 commit b78a171
Show file tree
Hide file tree
Showing 11 changed files with 782 additions and 649 deletions.
4 changes: 3 additions & 1 deletion cardano-api/cardano-api.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ library internal
Cardano.Api.DRepMetadata
Cardano.Api.EraCast
Cardano.Api.Eras
Cardano.Api.Eras.Constraints
Cardano.Api.Eras.Core
Cardano.Api.Error
Cardano.Api.Feature
Cardano.Api.Feature.ConwayEraOnwards
Expand Down Expand Up @@ -160,7 +162,7 @@ library internal
, ouroboros-consensus >= 0.9
, ouroboros-consensus-cardano >= 0.7
, ouroboros-consensus-diffusion >= 0.7
, ouroboros-consensus-protocol >= 0.5
, ouroboros-consensus-protocol >= 0.5.0.4
, ouroboros-network
, ouroboros-network-api
, ouroboros-network-framework
Expand Down
9 changes: 5 additions & 4 deletions cardano-api/internal/Cardano/Api/Block.hs
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ instance Show (Block era) where
)

getBlockTxs :: forall era . Block era -> [Tx era]
getBlockTxs (ByronBlock Consensus.ByronBlock { Consensus.byronBlockRaw }) =
getBlockTxs = \case
ByronBlock Consensus.ByronBlock { Consensus.byronBlockRaw } ->
case byronBlockRaw of
Byron.ABOBBoundary{} -> [] -- no txs in EBBs
Byron.ABOBBlock Byron.ABlock {
Expand All @@ -171,9 +172,9 @@ getBlockTxs (ByronBlock Consensus.ByronBlock { Consensus.byronBlockRaw }) =
Byron.bodyTxPayload = Byron.ATxPayload txs
}
} -> map ByronTx txs
getBlockTxs (ShelleyBlock era Consensus.ShelleyBlock{Consensus.shelleyBlockRaw}) =
withShelleyBasedEraConstraintForConsensus era $
getShelleyBlockTxs era shelleyBlockRaw
ShelleyBlock sbe Consensus.ShelleyBlock{Consensus.shelleyBlockRaw} ->
shelleyBasedEraConstraints sbe $
getShelleyBlockTxs sbe shelleyBlockRaw


getShelleyBlockTxs :: forall era ledgerera blockheader.
Expand Down
15 changes: 8 additions & 7 deletions cardano-api/internal/Cardano/Api/Certificate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -818,11 +818,12 @@ shelleyCertificateConstraints
, Ledger.TxCert (ShelleyLedgerEra era) ~ Ledger.ShelleyTxCert (ShelleyLedgerEra era)
) => a)
-> a
shelleyCertificateConstraints ShelleyToBabbageEraBabbage f = f
shelleyCertificateConstraints ShelleyToBabbageEraAlonzo f = f
shelleyCertificateConstraints ShelleyToBabbageEraMary f = f
shelleyCertificateConstraints ShelleyToBabbageEraAllegra f = f
shelleyCertificateConstraints ShelleyToBabbageEraShelley f = f
shelleyCertificateConstraints = \case
ShelleyToBabbageEraBabbage -> id
ShelleyToBabbageEraAlonzo -> id
ShelleyToBabbageEraMary -> id
ShelleyToBabbageEraAllegra -> id
ShelleyToBabbageEraShelley -> id

conwayCertificateConstraints
:: ConwayEraOnwards era
Expand All @@ -831,5 +832,5 @@ conwayCertificateConstraints
, Ledger.TxCert (ShelleyLedgerEra era) ~ Ledger.ConwayTxCert (ShelleyLedgerEra era)
) => a)
-> a
conwayCertificateConstraints ConwayEraOnwardsConway f = f

conwayCertificateConstraints = \case
ConwayEraOnwardsConway -> id
Loading

0 comments on commit b78a171

Please sign in to comment.