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

No instance for ‘PlutusTx.Eq.Eq ScriptPurpose’ arising from a use of ‘lookup’ #6273

Closed
zlonast opened this issue Jul 1, 2024 · 5 comments
Labels
bug status: needs triage GH issues that requires triage

Comments

@zlonast
Copy link

zlonast commented Jul 1, 2024

Summary

Сan you tell me where I'm wrong in my wishes?
I want to do lookup (Rewarding sc) (txInfoRedeemers $ scriptContextTxInfo ctx), but in pr 6173 delete instance for PlutusTx.Eq.Eq ScriptPurpose

Steps to reproduce the behavior

add line to plutuscript lookup (Rewarding $ ScriptCredential $ ScriptHash hash) (txInfoRedeemers $ scriptContextTxInfo ctx)

Actual Result

error

Expected Result

no errors

Describe the approach you would take to fix this

Bring back the behavior that was there before?

System info

os: Ubuntu 22.04.3
plutus-core: 1.30

@zlonast zlonast added the bug label Jul 1, 2024
@github-actions github-actions bot added the status: needs triage GH issues that requires triage label Jul 1, 2024
@effectfully
Copy link
Contributor

@ana-pantilie you're probably equipped best to answer this one.

@ana-pantilie
Copy link
Contributor

ScriptPurpose doesn't have an Eq instance anymore because in the case of Proposing scripts we would need to be able to compare Maps, which we decided we cannot do efficiently. @zlonast can you use Foldable.find instead?

@zlonast
Copy link
Author

zlonast commented Jul 9, 2024

Do I understand correctly that you are suggesting something like that? @ana-pantilie

{-# INLINABLE eqCredential #-}
eqCredential :: Credential -> ScriptPurpose -> Bool
eqCredential a (Rewarding b) = a PlutusTx.== b
eqCredential _ _ = Haskell.False
find (eqCredential sc) (keys $ txInfoRedeemers $ scriptContextTxInfo ctx)

@ana-pantilie
Copy link
Contributor

@zlonast yes that's what I was thinking of.

@effectfully
Copy link
Contributor

Sounds like there's a reasonable workaround and we aren't going to do anything about the issue otherwise, hence I'm closing it. Do feel free to reopen if you feel otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug status: needs triage GH issues that requires triage
Projects
None yet
Development

No branches or pull requests

3 participants