IntersectMBO / plutus-apps

The Plutus application platform
Apache License 2.0
306 stars 214 forks source link

`TxId` means two different things. #443

Open zmrocze opened 2 years ago

zmrocze commented 2 years ago

Summary

TxId from plutus-ledger-api-0.1.0.0 can be at least two different things, according to usages in plutus-apps:

One can get the first using txId exported from plutus-ledger.

The second is for example what is visible inside TxInfo context of a plutus validation script.

Then there is getCardanoTxId or getCardanoApiTxId which act on These Plutus.V1.Ledger.Tx.Tx Cardano.Api.Tx (more or less) by applying one or the other hashing function (double-sha256 of the Plutus.Tx for Both). It is used for example in Tutorial.Escrow.

Steps to reproduce the behavior

No response.

Actual Result

There are no clear invariants of TxId.

Expected Result

Is this expected? I can't asses if this is problematic, but certainly looks so.

Describe the approach you would take to fix this

No response

System info

Plutus-0.1.0.0 Plutus-apps: fdb0eec47

koslambrou commented 2 years ago

Good point. We only use txId in plutus-ledger for the emulator (testing plutus contracts). This function shouldn't be used with transaction that are going to be submitted in the real blockchain.

Eventually, Plutus.Tx and txId will be deleted and replace with Cardano.Api.Tx types.