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

Filling in more Alonzo API extensions for the Tx and TxBody #2738

Merged
merged 8 commits into from
May 28, 2021

Commits on May 27, 2021

  1. Add TxBodyRedeemers to the TxBody

    This is a further step along the path to Alonzo support in the API.
    
    The TxBody's ShelleyTxBody constructor holds all the info that goes with
    the tx body. This includes scripts and aux data. For Alonzo it now also
    has to include the script data, which the ledger calls the redeemers.
    This is a big mapping of each use of a script to the script redeemer
    data and execution units.
    
    This patch adds it to the TxBody but does not yet do the main
    conversion step of constructing the redeemer pointer mapping.
    dcoutts committed May 27, 2021
    Configuration menu
    Copy the full SHA
    cf059f7 View commit details
    Browse the repository at this point in the history
  2. Build the Alonzo redeemer pointer mapping

    Based on the script witnesses used within the tx body.
    
    Co-authored-by: Jordan Millar <jordan.millar@iohk.io>
    dcoutts and Jimbo4350 committed May 27, 2021
    Configuration menu
    Copy the full SHA
    6ba64b9 View commit details
    Browse the repository at this point in the history
  3. Make getTransactionBodyContent total and add TxBody pattern

    The getTransactionBodyContent function and the functions it was calling
    were doing unnecessary checks that made them partial. We do not need to
    validate when converting from a ledger transaction, only when building
    one. By eliminating unnecessary checks and making this pure we can now
    introduce a TxBody pattern that lets one get at the TxBodyContent. This
    makes for a nicer API.
    
    Also eliminate a couple deprecated functions that will be awkward to
    update for new features, and are no longer used.
    dcoutts committed May 27, 2021
    Configuration menu
    Copy the full SHA
    c824892 View commit details
    Browse the repository at this point in the history
  4. Add toLedgerPParams conversion function

    It will be needed for the Alonzo tx construction.
    
    Co-authored-by: Duncan Coutts <duncan@well-typed.com>
    Jimbo4350 and dcoutts committed May 27, 2021
    Configuration menu
    Copy the full SHA
    3e92a37 View commit details
    Browse the repository at this point in the history
  5. Add optional ProtocolParameters to the TxBodyContent

    Needed to construct the hash of the script-relevant protocol params and
    the redeemers.
    
    It is only supplied when building the transaction and is not available
    when viewing it.
    dcoutts committed May 27, 2021
    Configuration menu
    Copy the full SHA
    a4222e7 View commit details
    Browse the repository at this point in the history
  6. Fill in network magic in Alonzo tx body construction

    For now always fill it in with Nothing. This is a rarely used feature
    that we can complete at the end.
    
    It is a bit annoying however: it needs a Shelley network identifier,
    which is not the same as the API NetworkId type, since that also
    contains the NetworkMagic. That means we cannot use that type since we
    would not be able to round-trip it to/from a ledger transaction.
    
    So this will need some extension and/or refactoring of the NetworkId
    type and utils.
    
    Co-authored-by: Duncan Coutts <duncan@well-typed.com>
    Jimbo4350 and dcoutts committed May 27, 2021
    Configuration menu
    Copy the full SHA
    a7280d8 View commit details
    Browse the repository at this point in the history
  7. Add TxExtraKeyWitnesses to TxBodyContent

    These specify that extra key witnesses are required, and this fact is
    visible to Plutus scripts. It thereby provides a mechaism for Plutus
    scripts to check that the transaction has been signed by a particular
    key.
    
    Co-authored-by: Duncan Coutts <duncan@well-typed.com>
    Jimbo4350 and dcoutts committed May 27, 2021
    Configuration menu
    Copy the full SHA
    ecfaa63 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    6544ca8 View commit details
    Browse the repository at this point in the history