Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a new GetFuturePParams query #1251

Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
### Breaking

- Add `GetFuturePParams` query.
Binary file not shown.
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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.

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

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.

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

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.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
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.

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.

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.

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.

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.
Binary file not shown.

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

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.

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

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.
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.

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

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.

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.

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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.

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

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

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.

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.

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.

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

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ module Ouroboros.Consensus.Cardano.Node (
, pattern CardanoNodeToClientVersion11
, pattern CardanoNodeToClientVersion12
, pattern CardanoNodeToClientVersion13
, pattern CardanoNodeToClientVersion14
, pattern CardanoNodeToClientVersion2
, pattern CardanoNodeToClientVersion3
, pattern CardanoNodeToClientVersion4
Expand Down Expand Up @@ -474,6 +475,23 @@ pattern CardanoNodeToClientVersion13 =
:* Nil
)

-- | The hard fork enabled, and the Shelley, Allegra, Mary, Alonzo and Babbage
-- and Conway eras enabled, using 'ShelleyNodeToClientVersion10' for the
-- Shelley-based eras.
pattern CardanoNodeToClientVersion14 :: BlockNodeToClientVersion (CardanoBlock c)
pattern CardanoNodeToClientVersion14 =
HardForkNodeToClientEnabled
HardForkSpecificNodeToClientVersion3
( EraNodeToClientEnabled ByronNodeToClientVersion1
:* EraNodeToClientEnabled ShelleyNodeToClientVersion10
:* EraNodeToClientEnabled ShelleyNodeToClientVersion10
:* EraNodeToClientEnabled ShelleyNodeToClientVersion10
:* EraNodeToClientEnabled ShelleyNodeToClientVersion10
:* EraNodeToClientEnabled ShelleyNodeToClientVersion10
:* EraNodeToClientEnabled ShelleyNodeToClientVersion10
:* Nil
)

instance CardanoHardForkConstraints c
=> SupportedNetworkProtocolVersion (CardanoBlock c) where
supportedNodeToNodeVersions _ = Map.fromList $
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ data ShelleyNodeToClientVersion =

-- | New queries introduced: GetProposals, GetRatifyState
| ShelleyNodeToClientVersion9

-- | New queries introduced: GetFuturePParams
| ShelleyNodeToClientVersion10
deriving (Show, Eq, Ord, Enum, Bounded)

instance HasNetworkProtocolVersion (ShelleyBlock proto era) where
Expand All @@ -62,7 +65,7 @@ instance SupportedNetworkProtocolVersion (ShelleyBlock proto era) where
, (NodeToClientV_15, ShelleyNodeToClientVersion7)
, (NodeToClientV_16, ShelleyNodeToClientVersion8)
, (NodeToClientV_17, ShelleyNodeToClientVersion9)
-- , (NodeToClientV_18, ShelleyNodeToClientVersion10)
, (NodeToClientV_18, ShelleyNodeToClientVersion10)
]

latestReleasedNodeVersion = latestReleasedNodeVersionDefault
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,9 @@ data instance BlockQuery (ShelleyBlock proto era) :: Type -> Type where
:: CG.ConwayEraGov era
=> BlockQuery (ShelleyBlock proto era) (CG.RatifyState era)

GetFuturePParams
:: BlockQuery (ShelleyBlock proto era) (Maybe (LC.PParams era))

-- WARNING: please add new queries to the end of the list and stick to this
-- order in all other pattern matches on queries. This helps in particular
-- with the en/decoders, as we want the CBOR tags to be ordered.
Expand Down Expand Up @@ -468,6 +471,8 @@ instance (ShelleyCompatible proto era, ProtoCrypto proto ~ crypto)
SL.queryProposals st gids
GetRatifyState ->
SL.queryRatifyState st
GetFuturePParams ->
SL.queryFuturePParams st
where
lcfg = configLedger $ getExtLedgerCfg cfg
globals = shelleyLedgerGlobals lcfg
Expand Down Expand Up @@ -627,6 +632,8 @@ instance SameDepIndex (BlockQuery (ShelleyBlock proto era)) where
sameDepIndex GetProposals{} _ = Nothing
sameDepIndex GetRatifyState{} GetRatifyState{} = Just Refl
sameDepIndex GetRatifyState{} _ = Nothing
sameDepIndex GetFuturePParams{} GetFuturePParams{} = Just Refl
sameDepIndex GetFuturePParams{} _ = Nothing

deriving instance Eq (BlockQuery (ShelleyBlock proto era) result)
deriving instance Show (BlockQuery (ShelleyBlock proto era) result)
Expand Down Expand Up @@ -666,6 +673,7 @@ instance ShelleyCompatible proto era => ShowQuery (BlockQuery (ShelleyBlock prot
GetSPOStakeDistr {} -> show
GetProposals {} -> show
GetRatifyState {} -> show
GetFuturePParams {} -> show

-- | Is the given query supported by the given 'ShelleyNodeToClientVersion'?
querySupportedVersion :: BlockQuery (ShelleyBlock proto era) result -> ShelleyNodeToClientVersion -> Bool
Expand Down Expand Up @@ -703,18 +711,20 @@ querySupportedVersion = \case
GetSPOStakeDistr {} -> (>= v8)
GetProposals {} -> (>= v9)
GetRatifyState {} -> (>= v9)
GetFuturePParams {} -> (>= v10)
-- WARNING: when adding a new query, a new @ShelleyNodeToClientVersionX@
-- must be added. See #2830 for a template on how to do this.
where
v1 = ShelleyNodeToClientVersion1
v2 = ShelleyNodeToClientVersion2
v3 = ShelleyNodeToClientVersion3
v4 = ShelleyNodeToClientVersion4
v5 = ShelleyNodeToClientVersion5
v6 = ShelleyNodeToClientVersion6
v7 = ShelleyNodeToClientVersion7
v8 = ShelleyNodeToClientVersion8
v9 = ShelleyNodeToClientVersion9
v1 = ShelleyNodeToClientVersion1
v2 = ShelleyNodeToClientVersion2
v3 = ShelleyNodeToClientVersion3
v4 = ShelleyNodeToClientVersion4
v5 = ShelleyNodeToClientVersion5
v6 = ShelleyNodeToClientVersion6
v7 = ShelleyNodeToClientVersion7
v8 = ShelleyNodeToClientVersion8
v9 = ShelleyNodeToClientVersion9
v10 = ShelleyNodeToClientVersion10

{-------------------------------------------------------------------------------
Auxiliary
Expand Down Expand Up @@ -833,6 +843,8 @@ encodeShelleyQuery query = case query of
CBOR.encodeListLen 2 <> CBOR.encodeWord8 31 <> LC.toEraCBOR @era gids
GetRatifyState ->
CBOR.encodeListLen 1 <> CBOR.encodeWord8 32
GetFuturePParams ->
CBOR.encodeListLen 1 <> CBOR.encodeWord8 33

decodeShelleyQuery ::
forall era proto. ShelleyBasedEra era
Expand Down Expand Up @@ -893,6 +905,7 @@ decodeShelleyQuery = do
(2, 30) -> requireCG $ SomeSecond . GetSPOStakeDistr <$> LC.fromEraCBOR @era
(2, 31) -> requireCG $ SomeSecond . GetProposals <$> LC.fromEraCBOR @era
(1, 32) -> requireCG $ return $ SomeSecond GetRatifyState
(1, 33) -> requireCG $ return $ SomeSecond GetFuturePParams
_ -> failmsg "invalid"

encodeShelleyResult ::
Expand Down Expand Up @@ -933,6 +946,7 @@ encodeShelleyResult v query = case query of
GetSPOStakeDistr {} -> LC.toEraCBOR @era
GetProposals {} -> LC.toEraCBOR @era
GetRatifyState {} -> LC.toEraCBOR @era
GetFuturePParams {} -> LC.toEraCBOR @era

decodeShelleyResult ::
forall proto era result. ShelleyCompatible proto era
Expand Down Expand Up @@ -973,6 +987,7 @@ decodeShelleyResult v query = case query of
GetSPOStakeDistr {} -> LC.fromEraCBOR @era
GetProposals {} -> LC.fromEraCBOR @era
GetRatifyState {} -> LC.fromEraCBOR @era
GetFuturePParams {} -> LC.fromEraCBOR @era

currentPParamsEnDecoding ::
forall era s.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ instance CardanoHardForkConstraints c
CardanoNodeToClientVersion11 -> "CardanoNodeToClientVersion11"
CardanoNodeToClientVersion12 -> "CardanoNodeToClientVersion12"
CardanoNodeToClientVersion13 -> "CardanoNodeToClientVersion13"
CardanoNodeToClientVersion14 -> "CardanoNodeToClientVersion14"
_ -> error $ "Unknown version: " <> show blockVersion
Loading