Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ allow-newer:
source-repository-package
type: git
location: https://github.com/IntersectMBO/cardano-ledger
tag: 640fb66d27ac202764de0dda76621c6d57852ba9
--sha256: sha256-2vOUUvY19Emx5UpHNHZnIaWoqI5g3kPgjFQJGm9mVmk=
tag: af31396b2c19e4b8adf7d1155309500a22870e63
--sha256: sha256-HCC+FOGgyLwoBq4Nd8RCs9e3kbbmlhgdEvDXOZeY0BE=
subdir:
eras/allegra/impl
eras/alonzo/impl
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
### Patch

- Use the new `queryPoolState` ledger state query from ledger instead of extracting it from `NewEpochState`.

### Breaking

- `Tx Size` is now a `Word32` instead of an `Integer`, therefore `maxTxSizeUTxO` changed to expect `Word32`s.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file modified ouroboros-consensus-cardano/golden/cardano/disk/Block_Dijkstra
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -388,19 +388,19 @@ txInBlockSize ::
txInBlockSize st (ShelleyTx _txid tx') =
validateMaybe (maxTxSizeUTxO txsz limit) $ do
guard $ txsz <= limit
Just $ IgnoringOverflow $ ByteSize32 $ fromIntegral txsz + perTxOverhead
Just $ IgnoringOverflow $ ByteSize32 $ txsz + perTxOverhead
where
txsz = tx' ^. sizeTxF

pparams = getPParams $ tickedShelleyLedgerState st
limit = fromIntegral (pparams ^. L.ppMaxTxSizeL) :: Integer
limit = pparams ^. L.ppMaxTxSizeL

class MaxTxSizeUTxO era where
maxTxSizeUTxO ::
-- | Actual transaction size
Integer ->
Word32 ->
-- | Maximum transaction size
Integer ->
Word32 ->
SL.ApplyTxError era

instance MaxTxSizeUTxO ShelleyEra where
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

module Ouroboros.Consensus.Shelley.Ledger.PeerSelection () where

import qualified Cardano.Ledger.Api.State.Query as SL
import Cardano.Ledger.BaseTypes
import qualified Cardano.Ledger.Keys as SL
import qualified Cardano.Ledger.Shelley.API as SL
Expand Down Expand Up @@ -50,14 +51,15 @@ instance SL.EraCertState era => LedgerSupportsPeerSelection (ShelleyBlock proto
, poolParams ::
Map (SL.KeyHash 'SL.StakePool) SL.PoolParams
(futurePoolParams, poolParams) =
(SL.psFutureStakePoolParams pstate, SL.psStakePoolParams pstate)
(SL.qpsrFutureStakePoolParams pstate, SL.qpsrStakePoolParams pstate)
where
pstate :: SL.PState era
pstate :: SL.QueryPoolStateResult
pstate =
view SL.certPStateL
. SL.lsCertState
. SL.esLState
. SL.nesEs
SL.mkQueryPoolStateResult id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is incorrect:

  1. It is wrong to use a ledger state query for logic that is not related to ledger state queries.
  2. Doing this conversion from StakePoolState to PoolParams requires iteration over all stake pools that we have in the system for no reason. StakePoolState has all the things and more that we need here.

Please, switch from using PoolParams to using StakePoolState in this module

$ view SL.certPStateL
. SL.lsCertState
. SL.esLState
. SL.nesEs
$ shelleyLedgerState

relayToLedgerRelayAccessPoint :: SL.StakePoolRelay -> Maybe LedgerRelayAccessPoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ data instance BlockQuery (ShelleyBlock proto era) fp result where
BlockQuery
(ShelleyBlock proto era)
QFNoTables
(SL.PState era)
SL.QueryPoolStateResult
GetStakeSnapshots ::
Maybe (Set (SL.KeyHash 'SL.StakePool)) ->
BlockQuery
Expand Down Expand Up @@ -425,22 +425,11 @@ instance
GetStakePools ->
SL.getPools st
GetStakePoolParams poolids ->
SL.getPoolParameters st poolids
SL.queryPoolParameters st poolids
GetRewardInfoPools ->
SL.getRewardInfoPools globals st
GetPoolState mPoolIds ->
let certPState = view SL.certPStateL . SL.lsCertState . SL.esLState . SL.nesEs $ st
in case mPoolIds of
Just poolIds ->
SL.PState
{ SL.psStakePoolParams =
Map.restrictKeys (SL.psStakePoolParams certPState) poolIds
, SL.psFutureStakePoolParams =
Map.restrictKeys (SL.psFutureStakePoolParams certPState) poolIds
, SL.psRetiring = Map.restrictKeys (SL.psRetiring certPState) poolIds
, SL.psDeposits = Map.restrictKeys (SL.psDeposits certPState) poolIds
}
Nothing -> certPState
SL.queryPoolState st mPoolIds
GetStakeSnapshots mPoolIds ->
let SL.SnapShots
{ SL.ssStakeMark
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import Data.Maybe (catMaybes, maybeToList)
import Data.Maybe.Strict
import Data.Monoid (Sum (..))
import Data.Sequence.Strict (StrictSeq)
import Data.Word (Word64)
import Data.Word (Word32, Word64)
import Lens.Micro ((^.))
import Lens.Micro.Extras (view)
import Ouroboros.Consensus.Node.ProtocolInfo
Expand Down Expand Up @@ -70,7 +70,7 @@ instance
blockTxSizes blk = case Shelley.shelleyBlockRaw blk of
SL.Block _ body ->
toList $
fmap (fromIntegral @Integer @SizeInBytes . view Core.sizeTxF) (body ^. Core.txSeqBlockBodyL)
fmap (fromIntegral @Word32 @SizeInBytes . view Core.sizeTxF) (body ^. Core.txSeqBlockBodyL)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to go through fromIntegral:

Suggested change
fmap (fromIntegral @Word32 @SizeInBytes . view Core.sizeTxF) (body ^. Core.txSeqBlockBodyL)
fmap (SizeInBytes . view Core.sizeTxF) (body ^. Core.txSeqBlockBodyL)


knownEBBs = const Map.empty

Expand Down
Loading