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

Extend Cardano.Api.ProtocolParameters with Alonzo params #2699

Merged
merged 3 commits into from
May 21, 2021

Conversation

dcoutts
Copy link
Contributor

@dcoutts dcoutts commented May 14, 2021

  • Add PlutusScriptV1 constructor in the existing PlutusScriptVersion type which previously had no constructors at all.
  • Add API types for execution units, prices and cost models
  • Extend the ProtocolParameters with Alonzo era ones, both ProtocolParameters and ProtocolParametersUpdate.

@dcoutts
Copy link
Contributor Author

dcoutts commented May 14, 2021

Note that this extends the branch for PR #2657 so ignore the first 3 commits, and this will need to be rebased after that goes in.

This PR is a rebased and tidied up version of PR #2634 by @Jimbo4350. If we're happy with this one we can close the original. (I opened it as a new one entirely since it's actually substantially different so I didn't want to just force push over the top.)

-- | Cost in ada per word of UTxO storage.
--
-- /Introduced in Alonzo/
protocolParamUTxOCostPerWord :: Maybe Lovelace,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dcoutts

Does "word" in this context refer to the size of a Data.Word?

(I notice that we still use "byte" elsewhere, for example, in txFeePerByte, so I'm guessing the differentiation is deliberate in some way.)

Apologies for the drive-by comment, the PR title piqued my interest and decided to have a look. 😄

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In Alonzo, the protocol parameter minUTxOValue is deprecated, and replaced by adaPerUTxOWord.
This specifies directly the deposit required for storing bytes of data on the ledger in the form of
UTxO entries

It's not clear to me that word means byte, but I think so.

maryProtVer =
ProtVer 4 0
if npcTestEnableUnstableEras
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this to enable testing of a hardfork to Alonzo before consensus has merged their changes?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. Though I've now moved this patch into this PR instead: #2400

Copy link
Contributor

@cblp cblp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but somebody else should approve

@dcoutts dcoutts force-pushed the dcoutts/alonzo-protocol-parameters-integration branch 3 times, most recently from e7e87e0 to 3f94692 Compare May 17, 2021 00:58
@dcoutts
Copy link
Contributor Author

dcoutts commented May 17, 2021

Rebased on top of #2649 since this order makes more sense. Only the last three commits are part of this PR proper. All the previous commits are from #2657 and #2649 that this builds on.

dcoutts and others added 2 commits May 21, 2021 09:57
Needed for using Plutus script witnesses and for protocol parameters.

Co-authored-by: Jordan Millar <jordan.millar@iohk.io>
And make it an instance of To/FromJSONKey. We will use this type in the
protocol params to index the per-language cost models and prices.
displayError (ScriptDecodeTextEnvelopeError err) =
"Error decoding script: " ++ displayError err
displayError (ScriptDecodeSimpleScriptError err) =
"Syncax error in script: " ++ displayError err
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo Syncax

Both ProtocolParameters and ProtocolParametersUpdate.

We use AnyPlutusScriptVersion as the map key for the per-language cost
models and prices.

Conversion functions not yet extended.

Co-authored-by: Jordan Millar <jordan.millar@iohk.io>
@newhoggy newhoggy force-pushed the dcoutts/alonzo-protocol-parameters-integration branch from 9d89996 to 91b3d6c Compare May 21, 2021 00:11
@newhoggy newhoggy self-requested a review May 21, 2021 00:56
Copy link
Contributor

@newhoggy newhoggy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@newhoggy
Copy link
Contributor

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented May 21, 2021

@iohk-bors iohk-bors bot merged commit 996e409 into master May 21, 2021
@iohk-bors iohk-bors bot deleted the dcoutts/alonzo-protocol-parameters-integration branch May 21, 2021 01:08
iohk-bors bot added a commit that referenced this pull request May 24, 2021
2642: Update Cardano.Api.Tx in preparation for Alonzo r=dcoutts a=Jimbo4350

Depends on: 
1. #2657
2. #2400 
3. #2699
4. #2649

Co-authored-by: John Ky <john.ky@iohk.io>
Co-authored-by: Duncan Coutts <duncan@well-typed.com>
Co-authored-by: Jordan Millar <jordan.millar@iohk.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants