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

More API updates for the Allegra and Mary eras #2111

Merged
merged 31 commits into from
Nov 25, 2020

Commits on Nov 21, 2020

  1. Generalise toShelleyStakeAddr to work for any ledger era

    Will be needed for constructing txs in later ledger eras.
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    fc87d88 View commit details
    Browse the repository at this point in the history
  2. Move and generalise toShelley{Metadata,MetadataHash} functions

    Move them into the TxMetadata module and generalise
    toShelleyMetadataHash to work over all ledger eras.
    
    Will be needed for creating txs in later ledger eras.
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    12fd233 View commit details
    Browse the repository at this point in the history
  3. Generalise toShelleyWithdrawal over all ledger eras

    Will be needed for making txs for later ledger eras.
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    b10061d View commit details
    Browse the repository at this point in the history
  4. Move toShelleyUpdate to the ProtocolParameters module

    Not yet generalised over ledger eras.
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    1d32e24 View commit details
    Browse the repository at this point in the history
  5. Change type of Praos extra entropy update parameter

    We would like the ProtocolParametersUpdate type to be able to be
    converted both to and from the equivalent underlying ledger type. We
    would like this for a couple reasons:
    1. so that we can use this same type later for programs that analyse
       the blockchain and want to see the content of update proposals;
    2. so we can switch UpdateProposal to use the representation of the
       surface API types, while still using the on-chain format for the
       binary serialisation. This requires converting in both directions.
    
    We want to do 2. now because we want a single era-independent
    representation for update proposals, and to convert into the
    era-dependent ledger types on-demand when we make a transaction.
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    3225463 View commit details
    Browse the repository at this point in the history
  6. Add functions to convert from Shelley update proposal types

    So we now have conversions in both directions.
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    dfdb712 View commit details
    Browse the repository at this point in the history
  7. Change representation of UpdateProposal to use the API types

    Switch the UpdateProposal to use the representation of the surface API
    types.
    
    We stick to the existing on-chain binary serialisation format.
    
    We want to do this now to add support for more ledger eras. We want a
    single era-independent representation for update proposals, and to
    convert into the era-dependent ledger types on-demand when we make a
    transaction for a specific era.
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    73a6ebf View commit details
    Browse the repository at this point in the history
  8. Export UpdateProposal and protocol params from the API

    The protocol params should always have been exported since it is a API
    surface type. The UpdateProposal repreentation can now be public since
    it now uses the API surface types too.
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    9fff1ad View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    e9b2245 View commit details
    Browse the repository at this point in the history
  10. Change the API's stake pool metadata URL type to match ledger type

    Use Text instead of URI. We will want to allow conversion in both
    directions which means we cannot be more restrictive than the ledger's
    validity rules.
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    e29ce3c View commit details
    Browse the repository at this point in the history
  11. Add a fromShelleyPoolParams to allow conversion both ways

    We'll use this next to change the representation of certificates
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    92b8158 View commit details
    Browse the repository at this point in the history
  12. Add to/fromShelleyCertificate conversion functions

    We will switch the representation shortly and so these conversion
    functions will become non-trivial.
    dcoutts committed Nov 21, 2020
    Configuration menu
    Copy the full SHA
    1354aa3 View commit details
    Browse the repository at this point in the history

Commits on Nov 22, 2020

  1. Change certificate representation to use surface types

    This will make it easier to convert from a common era-independent type
    into ledger era-dependent types.
    
    We still use the same on-chain binary format.
    dcoutts committed Nov 22, 2020
    Configuration menu
    Copy the full SHA
    c026892 View commit details
    Browse the repository at this point in the history
  2. Generalise the toShelley*Credential functions for all eras

    Needed both directly and to be able to generalise other such
    conversion functions.
    dcoutts committed Nov 22, 2020
    Configuration menu
    Copy the full SHA
    e85ad6e View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    eb6ea84 View commit details
    Browse the repository at this point in the history

Commits on Nov 23, 2020

  1. Configuration menu
    Copy the full SHA
    f095db2 View commit details
    Browse the repository at this point in the history
  2. Use single Eq, Show and HasTypeProxy instance for TxBody

    Replace per-era instances with a single era-paramaterised instance.
    This will be simpler as we add more eras.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    7a9cd1f View commit details
    Browse the repository at this point in the history
  3. Use single SerialiseAsCBOR and HasTextEnvelope instance for TxBody

    Replace per-era instances with a single era-paramaterised instance.
    This will be simpler as we add more eras.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    afa2961 View commit details
    Browse the repository at this point in the history
  4. Initial step to generalise makeShelleyTransaction over other eras

    Generalise over the IsShelleyBasedEra class.
    
    The Allegra and Mary cases remain to do.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    580e50c View commit details
    Browse the repository at this point in the history
  5. Switch TxBody from Shelley-specific type to era-dependent

    Switch from the Shelley.TxBody concrete type, to using the Ledger.TxBody
    type family. The type family has different representations for different
    eras.
    
    For this step the specific era remains the same, so there are no other
    changes. The next step will be to cover multiple eras, at which point we
    will take advantage of the different tx body representations for each
    era.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    630f02d View commit details
    Browse the repository at this point in the history
  6. Generalise the ShelleyTxBody representation over multiple eras

    The 'ShelleyBasedEra' GADT tells us what era we are in.
    
    The 'ShelleyLedgerEra' type family maps that to the era type from the
    ledger lib.
    
    The 'Ledger.TxBody' type family maps that to a specific tx body type,
    which is different for each Shelley-based era.
    
    Due to this use of GADTs We now need custom Eq and Show instances.
    
    Do the minimal changes elsewhere, inserting error cases to fill in next.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    67b78cf View commit details
    Browse the repository at this point in the history
  7. Generalise several tx and witness functions over eras

    This is partial in that we generalise the type, but the Allegra and Mary
    cases are error TODOs for now. This is still helpful to allow downstream
    code to type check at other eras.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    134403f View commit details
    Browse the repository at this point in the history
  8. Extend TxBody serialisation to the Allegra and Mary eras

    All the Shelley-based eras are supported with one overloaded
    implementation used at different types.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    b54ad58 View commit details
    Browse the repository at this point in the history
  9. Partially fill in makeShelleyTransaction for the Allegra & Mary eras

    Still TODOs for validity intervals and minting.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    49edfcb View commit details
    Browse the repository at this point in the history
  10. Add to/fromShelleyScriptHash and use them

    We sort-of already had implementations of these in the impl of
    to/fromShelleyAddress functions. Pull them out to top level functions
    and put them next to the definition of the ScriptHash type.
    
    We'll reuse these new functions in the next patch.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    ea18858 View commit details
    Browse the repository at this point in the history
  11. Add to/fromMaryValue for converting the Value type

    To/from the equivalent ledger library type. The ledger representation is
    a pair of the lovelace value and a nested map of the non-ada assets.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    4b476ce View commit details
    Browse the repository at this point in the history
  12. Cover the multi-asset case in toShelleyTxOut

    Now that we have toMaryValue
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    f6db51c View commit details
    Browse the repository at this point in the history
  13. Adjust the sort order of Value entries

    Order the ada case first.
    dcoutts committed Nov 23, 2020
    Configuration menu
    Copy the full SHA
    844dde7 View commit details
    Browse the repository at this point in the history

Commits on Nov 24, 2020

  1. Move toByronLovelace and TxIn/TxOut declarations

    Move toByronLovelace to the Value module, and split the TxBody module
    section on TxIn and TxOut so they're in separate sections.
    
    We're about to add a bunch more sections for types used in the body.
    dcoutts committed Nov 24, 2020
    Configuration menu
    Copy the full SHA
    eaa770e View commit details
    Browse the repository at this point in the history
  2. Move TxOutValue and MintValue types to TxBody module

    Move the TxOutValue, MintValue and related functions from the Value
    module to the TxBody module.
    
    We're going to end up with a whole bunch of these era-dependent field
    types for the tx body and it makes most sense to keep them all together
    in one module.
    dcoutts committed Nov 24, 2020
    Configuration menu
    Copy the full SHA
    dde3664 View commit details
    Browse the repository at this point in the history
  3. Make hlint suggestions

    intricate committed Nov 24, 2020
    Configuration menu
    Copy the full SHA
    ee54b49 View commit details
    Browse the repository at this point in the history