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

BBODY examples #2259

Merged
merged 3 commits into from
May 5, 2021
Merged

BBODY examples #2259

merged 3 commits into from
May 5, 2021

Conversation

JaredCorduan
Copy link
Contributor

@JaredCorduan JaredCorduan commented Apr 26, 2021

This PR makes an BBODY example by packing the 8 transactions from the UTXOW examples into a single block. This is the top-most rule changed in the Alonzo era.

This involved a bit of reorganizing the UTXOW examples.

Additionally, I changed the collectTwoPhaseScriptInputs function to supply Plutus data in this order: datum, redeemer, context. See #2248 (comment).

I also removed the unused function collectNNScriptInputs which was previously replaced by collectTwoPhaseScriptInputs.

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.

Just a few cosmetic changes. Looks good to me.

Comment on lines 87 to 90

initBBodyState :: BbodyState A
initBBodyState = BbodyState (LedgerState UTXOW.initUtxoSt dpstate) (BlocksMade mempty)

Copy link
Contributor

Choose a reason for hiding this comment

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

call this initialBBodyState, initBBody state sounds like a noun, so I expect it to be a function.

Comment on lines 100 to 116
BHBody
{ bheaderBlockNo = BlockNo 0,
bheaderSlotNo = SlotNo 0,
bheaderPrev = GenesisHash,
bheaderVk = vKey coldKeys,
bheaderVrfVk = vvrf,
bheaderEta = coerce $ evalCertified () nonceNonce svrf,
bheaderL = coerce $ evalCertified () leaderNonce svrf,
bsize = fromIntegral $ bBodySize txs,
bhash = hashTxSeq txs,
bheaderOCert =
OCert
vkes
0
(KESPeriod 0)
(signedDSIGN @C_Crypto (sKey coldKeys) (OCertSignable vkes 0 (KESPeriod 0))),
bprotver = ProtVer 5 0
Copy link
Contributor

Choose a reason for hiding this comment

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

Should this part, making the BHBody be a function that is reusable? Seems it is a function of txs.

Comment on lines 168 to 174

-- | We always expect the alwaysFailsOutput to remain in the UTxO map.
-- Each of the eight example transactions below will consume one of the
-- feeInputs, given by feeInputs.
-- The transaction where IsValidating is True will create a transaction output.
-- Additionally, the alwaysFailsOutput will be consumed in the IsSpend case.
expectedUTxO :: Expect -> Natural -> UTxO A
Copy link
Contributor

Choose a reason for hiding this comment

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

Add to the comments how this should be used. The comments tells what it does, not how one should use it.

Jared Corduan added 3 commits May 5, 2021 10:57
The function was replaced by collectTwoPhaseScriptInputs a while ago,
 but the old function was never removed.
@JaredCorduan JaredCorduan merged commit 9ac75ad into master May 5, 2021
@iohk-bors iohk-bors bot deleted the jc/bbody-examples branch May 5, 2021 15:29
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.

2 participants