IntersectMBO / cardano-ledger

The ledger implementation and specifications of the Cardano blockchain.
Apache License 2.0
261 stars 157 forks source link

How reference script PlutusV2.txOutReferenceScript corresponds to Babbage era TxOutCompactRefScript? #2922

Closed anton-k closed 2 years ago

anton-k commented 2 years ago

Please can you help me to understand how reference scripts relate from Plutus V2 to cardano-ledger's Babbage Era?

I'm trying to convert Plutus V2 to Babbage Era Tx for testing purposes. The TxOutCompactRefScript expects TxOut to contain the full script as it type goes:

  | TxOutCompactRefScript
       {-# UNPACK #-} !(CompactAddr (Crypto era))
       !(CompactForm (Core.Value era))
       !(Datum era)
       !(Core.Script era)  

So it contains full script and it seems that we don't win in TxSize except that it's in the UTxO set arounnd TX. But when I try to convert from Plutus V2 it has ScriptHash in txOutReferenceScript.

Should I calculate the map of ScriptHash to Script for conversion?

anton-k commented 2 years ago

It seems that PlutusV2 TxOut does not correspond to Babbage era TxOut.

JaredCorduan commented 2 years ago

I'm sorry, I don't understand the question.

trying to convert Plutus V2 to Babbage Era Tx

Are you trying to use a V2 script as a refernce script?

So it contains full script and it seems that we don't win in TxSize except that it's in the UTxO set arounnd TX.

The point of reference scripts is that you can later use them via reference inputs. This way, if you want to use the script multiple times, you only need to pay the cost of putting it in a transaction once. See CIP-33.

PlutusV2 TxOut does not correspond to Babbage era TxOut

What do you mean by a "PlutusV2 TxOut"?

I'm going to close this issue, since we use them to track work in the ledger repo. Questions like this are better asked on our stack exchange..