Skip to content
This repository was archived by the owner on Jun 26, 2023. It is now read-only.
This repository was archived by the owner on Jun 26, 2023. It is now read-only.

Create an era with a dummy update payload based on Shelley #153

Closed

Description

@dnadales

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:

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 where

To 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 = actuallyDoingSomethingDifferent

Tasks 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:
  • 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

  1. changed the title [-]Create an era without update payload from Shelley[/-] [+]Create an era with a dummy update payload based Shelley[/+] on Feb 12, 2021
  2. changed the title [-]Create an era with a dummy update payload based Shelley[/-] [+]Create an era with a dummy update payload based on Shelley[/+] on Feb 12, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions