Skip to content

Move caseList and caseData to the end of the flat encoding #7128

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

Merged
merged 3 commits into from
May 31, 2025

Conversation

kwxm
Copy link
Contributor

@kwxm kwxm commented May 30, 2025

Fixes https://github.com/IntersectMBO/plutus-private/issues/1613.

It seems that we may decide not to release the caseList and caseData builtins. This PR moves them to the very end of the flat encoding (tags 126 and 127) and adjusts the tags for dropList and the array builtins (which we're definitely going to release) to fill the gap. The point of this is to make the changes as early as possible to stabilise the encoding before anything gets released and to make it easier to remove caseList and caseData if we decide to do so (which will involve further changes to the implementation and specification).

@kwxm kwxm temporarily deployed to github-pages May 30, 2025 19:04 — with GitHub Actions Inactive
| DropList
-- Arrays
| LengthOfArray
| ListToArray
| IndexArray
-- Case
| CaseList
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the order of constructors here matter?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the order of constructors here matter?

No, I don't think so. The main thing that should never change after deployment is the flat tag. I think there are some things (tests etc) that iterate over the enumeration of all the builtins, so rearranging the constructors may alter the order that things happen in. I just moved these to the end to make them easy to find.

LengthOfArray -> 91
ListToArray -> 92
IndexArray -> 93
CaseList -> 126
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a max bound for the tag number?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a max bound for the tag number?

Currently 127 (it uses 7 bits in the flat encoding). We've discussed what to do if we ever have more than 128 builtins and I think one possibility was to add a new AST contructor for a second lot of builtins, possibly using 8 or 9 bits to provide plenty of room. Maybe a new language version where we keep the AST the same but increase the number of bits builtins get in flat is possible as well.

@kwxm kwxm merged commit 431b017 into master May 31, 2025
7 checks passed
@kwxm kwxm deleted the kwxm/builtins/deprecate-caseList-caseData branch May 31, 2025 05:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants