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

[FR] - Misleading unsafeHashableScriptData #474

Open
jonathangenlambda opened this issue Mar 8, 2024 · 10 comments
Open

[FR] - Misleading unsafeHashableScriptData #474

jonathangenlambda opened this issue Mar 8, 2024 · 10 comments
Labels

Comments

@jonathangenlambda
Copy link

jonathangenlambda commented Mar 8, 2024

External

Area
Other HashableScriptData

Describe the feature you'd like
We have been successfully using unsafeHashableScriptData however its description recommends NOT to use it:

Warning: Creating HashableScriptData from a ScriptData value pretty much guarantees the original bytes used to create the value will be different if we serialize again. Do not use this.

However it is unclear how to construct a ScriptRedeemer from ScriptData if we shouldn't use unsafeHashableScriptData - in general, if usage of unsafeHashableScriptData is discouraged, it is unclear how to go from ScriptData to HashableScriptData.

Please either change the description of unsafeHashableScriptData or provide other (safe?) means going from ScriptData to HashableScriptData.

Copy link

github-actions bot commented Apr 8, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label Apr 8, 2024
@smelc smelc removed the Stale label Apr 8, 2024
Copy link

github-actions bot commented May 9, 2024

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label May 9, 2024
@carbolymer carbolymer removed the Stale label May 12, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label Jul 14, 2024
@smelc smelc removed the Stale label Jul 15, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label Aug 15, 2024
@smelc smelc removed the Stale label Aug 19, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label Sep 19, 2024
@smelc smelc removed the Stale label Sep 19, 2024
@Swordlash
Copy link
Contributor

Swordlash commented Sep 23, 2024

You can use fromAlonzoData in this way:

import qualified Cardano.Ledger.Plutus.Data as LPD
import qualified PlutusLedgerApi.V1                as PV1
import qualified Cardano.Api.Shelley               as C

toHashableScriptData = C.fromAlonzoData . LPD.Data @ledgerEra . PV1.toData

@Swordlash
Copy link
Contributor

But I don't think it matters if you're creating the data from scratch (programatically) rather than by deserialisation from a bytestring.

Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label Oct 24, 2024
@smelc smelc removed the Stale label Oct 28, 2024
Copy link

This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 120 days.

@github-actions github-actions bot added the Stale label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants