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

Alonzo UTXOW examples #2215

Merged
merged 2 commits into from
Apr 21, 2021
Merged

Alonzo UTXOW examples #2215

merged 2 commits into from
Apr 21, 2021

Conversation

JaredCorduan
Copy link
Contributor

@JaredCorduan JaredCorduan commented Apr 1, 2021

This introduces the first 8 unit tests / examples for Alonzo: a failing and a succeeding transaction for each of: Spend, Cert, Rewrd, and Mint. Using the real Plutus interpreter!

@JaredCorduan JaredCorduan force-pushed the jc/utxow-examples branch 2 times, most recently from 388efd8 to 42a4fcc Compare April 2, 2021 20:28
@JaredCorduan JaredCorduan force-pushed the jc/utxow-examples branch 4 times, most recently from 1de11a7 to d227aa9 Compare April 19, 2021 17:52
@JaredCorduan JaredCorduan marked this pull request as ready for review April 19, 2021 17:58
toData (Context _ _) = undefined
-- toData will be implemented in the Plutus library,
-- this is just a FakePlutus hack.
toData (Context _ _) = I 0
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is handled correctly in #2242

transCostModel :: CostModel -> P.CostModel
transCostModel (CostModel mp) =
case P.validateAndCreateCostModel mp of
Nothing -> P.defaultCostModel -- TODO validation should be before this
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is definitely not what we want in the long term. We need a plan for where and how to handle the cost model validation on the ledger side, which is probably our next priority.

@polinavino
Copy link
Contributor

These examples are great! We will sort out the cost model validation soon, I assume in a separate PR?

@JaredCorduan
Copy link
Contributor Author

These examples are great! We will sort out the cost model validation soon, I assume in a separate PR?

yep, that's my plan.

Copy link
Contributor

@TimSheard TimSheard left a comment

Choose a reason for hiding this comment

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

Every thing looks fine to me.

Comment on lines 145 to 151
( Show (Core.Value era)
( Era era,
Show (Core.Value era)
) =>
Show (TxOut era)
where
show = error "Not yet implemented"
show (TxOut addr vl dh) =
"TxOut (" <> show addr <> " " <> show vl <> " " <> show dh <> ")"
Copy link
Contributor

Choose a reason for hiding this comment

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

This is going to clash with master. I don't think i matters what version we choose.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I like what is in master better, I'll rebase, thanks!

Comment on lines +55 to +60
import qualified Plutus.V1.Ledger.Api as P
( EvaluationError (..),
ExBudget (..),
VerboseMode (..),
evaluateScriptRestricting,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we be using runPLCScript (defined in TxInfo.hs, which is defined in terms of this function) as that is how the specification is written. I guess, from that function we don't very interesting information about why scripts fail.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yea, that is just used for a sanity check of a unit test, that we can call plutus directly as expected.

@JaredCorduan JaredCorduan merged commit d40e335 into master Apr 21, 2021
@iohk-bors iohk-bors bot deleted the jc/utxow-examples branch April 21, 2021 00:57
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.

3 participants