Repository navigation
Create an era with a dummy update payload based on Shelley #153
Description
This era should be equal to Shelley, but without the update payload in the blocks. The rules should be changed accordingly. This era should be a package inside https://github.com/input-output-hk/cardano-ledger-specs
This task is important in preparation for the addition of the new update payload. It allows us to identify the places we need to change to incorporate the new update payload.
Subtasks:
- Identify the places in the ledger spec where the update logic is executed.
- Parametrize the update logic in the Shelley rules.
- Parametrize the update state in the ledger state.
- Parametrize the
votedValuefunction. - Parametrize the
updatePpupfunction.
- Revisit/improve parametrization of the update logic in the Shelley rules.
- Incorporate the notion of an era mapping. See Drop injectivity requirement for PredicateFailure IntersectMBO/cardano-ledger#2070 and Use an EraMap to specify rules for the era. IntersectMBO/cardano-ledger#2060
- Hide Shelley epoch-change update logic behind (the new) UPEC rule. See Hide the Shelley update-epoch transition logic behind a UPEC rule. IntersectMBO/cardano-ledger#2064
- Add
Defaultinstances for initial STS states. See Add Default instances for some Shelley states IntersectMBO/cardano-ledger#2096 - Abstract away the update state (this was done here Abstract the update concern from Shelley IntersectMBO/cardano-ledger#2041 but it needs to be revisited to incorporate the improvements above. All we need to do is to use the abstract update state defined in this PR). See Abstract away the update state IntersectMBO/cardano-ledger#2103
- Create a new era based on Shelley:
- Its update payload should be some simple type we can use to test the client (dummy update payload). This payload will not be processed.
- The new era will not contain any update logic, but it will accept the new update payload type and do nothing (no ledger state change).
- Add a mode to the node for the Priviledge prototype. See https://input-output-hk.github.io/cardano-node/cardano-api/Cardano-Api-Modes.html
- Define an update interface to ledger for consensus https://github.com/input-output-hk/ouroboros-network/issues/2890. Cancelled: we were able to workaround this. See section below for more details.
- Adapt cardano-cli so that:
- it understands the new era
- it accepts the new era update payload, and pass this to the node (this will have no effect in the ledger, but we need to make sure the ledger update rules get called).
DOD:
- Consensus tests for the new era pass.
- A modified version of the test script defined in Automate Shelley testnet build and deployment #151 is run with the new era. We must at least:
- run three stakepools
- each stakepool submits an transaction with the dummy update payload
Working around consensus issue #2890
The problem I ran into is that the ShelleyBasedEra class was too restrictive in the instances that it allow: in particular it required that the update state of the era was equal to the Shelley update state:
src/Ouroboros/Consensus/Shelley/Eras.hs:104:10: error:
• Couldn't match type ‘Cardano.Ledger.Pivo.Update.State
(PivoEra c)’
with ‘SL.PPUPState (PivoEra c)’
arising from the superclasses of an instance declaration
• In the instance declaration for ‘ShelleyBasedEra (PivoEra c)’
|
104 | instance SL.PraosCrypto c => ShelleyBasedEra (PivoEra c) where
-- TODO Currently we include some constraints on the update state which are
-- needed to determine the hard fork point. In the future this should be
-- replaced with an appropriate API - see
-- https://github.com/input-output-hk/ouroboros-network/issues/2890
class ( SL.ShelleyBasedEra era
, State (LC.EraRule "PPUP" era) ~ SL.PPUPState era
, Default (State (LC.EraRule "PPUP" era))
) => ShelleyBasedEra era whereTo workaround this we removed the State constraint from the ShelleyBasedEra class, and added instances for the Shelley, Allegra, Mary and Pivo (i.e. the new Priviledge era). Using @edsko 's explanation, this was the approach taken in a nutshell:
class Show a where
show :: a -> String
-- bad instance: pretends to be polymorphic, but isn't
instance a ~ Int => Show a where
show = ..
-- instead, make this a function:
defaultShow :: a ~ Int => a -> String
defaultShow = ...
-- use it to define the instance that are required
instance Show Shelley where
show = defaultShow
instance Show Joseph where
show = defaultShow
instance Show LittleJesus where
show = defaultShow
-- so that you are free to define a /different/ instance
instance Show Damian where
show = actuallyDoingSomethingDifferentTasks not completed
The following tasks are not essential to completing the integration. We would have liked to finish them, but in light of the time it took to integrate a custom era end to end we decided to skip them to meet the April deadline.
- Adapt the test script so that all nodes submit update payload for the new era. We will do this when the integration is complete. In the meantime we will be running scripts to test that the integration works.
- Investigate if it is possible to start a testnet from any epoch, with a predefined set of stakepools, and without needing BTF nodes. Update: it seems it is possible, but we have to do try this in the testnet ourselves:
- See this PR: Allow skipping a prefix of the eras in Cardano mode IntersectMBO/ouroboros-network#2811 about starting a testnet in a certain era.
- See the following fields in the Shelley Genesis config about a starting with a predefined set of stakepools.
- Find out which consensus tests the new era should run. We should focus on the tests that only involve the new era, and then write the hardfork tests of the new era.
Activity
[-]Create an era without update payload from Shelley[/-][+]Create an era with a dummy update payload based Shelley[/+][-]Create an era with a dummy update payload based Shelley[/-][+]Create an era with a dummy update payload based on Shelley[/+]