Skip to content

Conversation

@sohang3112
Copy link

@sohang3112 sohang3112 commented Nov 28, 2025

avoid seperate head, tail calls in Builtins.unsafeUncons. No Changelog Required. Fixes #7459

Pre-submit checklist:

  • Branch
    • Tests are provided (if possible)
    • Commit sequence broadly makes sense
    • Key commits have useful messages
    • Changelog fragments have been written (if appropriate)
    • Relevant tickets are mentioned in commit messages
    • Formatting, PNG optimization, etc. are updated
  • PR
    • (For external contributions) Corresponding issue exists and is linked in the description
    • Targeting master unless this is a cherry-pick backport
    • Self-reviewed the diff
    • Useful pull request description
    • Reviewer requested

@sohang3112
Copy link
Author

@ana-pantilie Can you review this PR please? Or if someone else would be correct reviewer, let me know - not sure who to tag here.

@sohang3112
Copy link
Author

Also I'm not sure why ci/eval action is failing with timeout, seems to be some issue with Github CI itself maybe:

'nix flake metadata' returned signal -1:
unpacking 'github:IntersectMBO/plutus/8c12795478d0bf9842a74fabab96c1704a14633e' into the Git cache...
timeout

@ana-pantilie
Copy link
Contributor

@sohang3112 I've tagged @SeungheonOh as the reviewer and I've approved the GitHub Workflows to run.

@sohang3112
Copy link
Author

@SeungheonOh Please review this PR. Also re the failing CI checks:

  • Changelog action failed, it says to apply label "No Changelog Required" but I don't seem to have permission to apply label to issue as I am external contributor to this repo. Please apply label "No Changelog Required" to this issue on your end.
  • ci/eval is failing with timeout. It's totally unrelated to code and may be some bug in Github Action itself, please check:
'nix flake metadata' returned signal -1:
unpacking 'github:IntersectMBO/plutus/8c12795478d0bf9842a74fabab96c1704a14633e' into the Git cache...
timeout

@sohang3112
Copy link
Author

sohang3112 commented Dec 3, 2025

image

@ana-pantilie ci/eval action got stuck initially at "Awaiting approval from a maintainer" and then timed out after a few minutes. Do you know what is the fix for this - can you provide whatever approvals are necessary here?

@SeungheonOh
Copy link
Collaborator

Hi, my apologies for delay.

This PR doesn't do what I described in the issue. This reuses PlutusTx.Builtins.Internal.caseList' which will generate

--pseudo plc
case <list>
  <cons branch : x -> list x -> r>
  <nil branch : r>

For this, since we are casing the cons case only, instead of generating case with both cons branch and nil branch, it can omit nil branch and do something like

case <list>
  <cons branch : x -> list x -> r>

which will fail if empty list is given.

To accomplish this, one need to add new builtin to PlutusTx.Builtins.Internal and add support to the added builtin in PlutusTx.Plugin.Builtins. Check how it's done for caseList'.

@sohang3112
Copy link
Author

@SeungheonOh As per your feedback, I have created a new builtin unsafeCaseList' in PlutusTX.Builtins.Internal and used it to define Builtins.unsafeCons. Please review whether it is correct now.

@ana-pantilie
Copy link
Contributor

Hi @sohang3112, thanks for your contribution but please be patient, Seungheon is on PTO so he'll answer when he gets back.

@SeungheonOh
Copy link
Collaborator

Hi, thanks for the change. This is a correct direction; however this won't actually compile because it doesn't provide accompanying definition in PlutusTx.Plugin.Builtins.

Also please add a test case.

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.

Make Builtins.unsafeUncons use builtin list casing

3 participants