Skip to content

Conversation

@zliu41
Copy link
Member

@zliu41 zliu41 commented Sep 13, 2025

As titled

@zliu41 zliu41 requested review from a team and kwxm September 13, 2025 01:23
@zliu41 zliu41 added the No Changelog Required Add this to skip the Changelog Check label Sep 13, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Sep 13, 2025

Execution Budget Golden Diff

ddc2711 (master) vs 9749d6f

output

plutus-benchmark/cardano-loans/test/9.6/main.eval.golden

Metric Old New Δ%
Term Size 7_446 7_443 -0.04%
Flat Size 8_702 8_699 -0.03%

This comment will get updated when changes are made.

go 89 = pure LengthOfArray
go 90 = pure ListToArray
go 91 = pure IndexArray
go 94 = pure InsertCoin
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the gap between 94 and 97? Are we expecting it to be filled by some more Value-related functions?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes. I will add them in the order written in the CIP.

Copy link
Contributor

@kwxm kwxm left a comment

Choose a reason for hiding this comment

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

This looks fine. The process of adding new built-in functions and types to plutus-tx is a bit boilerplatey, so I wonder if it would be worth having a document or chekclist saying exactly what you have to do. We've got such things for plutus-core and plutus-ledger-api but there's a gap for plutus-tx.

I got a bit worried whether there was a danger of confusion with the Value type (and the other version here) in plutus-ledger-api, but I don't think we ever have to talk about built-in types there so maybe it doesn't matter.

{-# INLINE insertCoinDenotation #-}
in makeBuiltinMeaning
insertCoinDenotation
(runCostingFunFourArguments . unimplementedCostingFun)
Copy link
Contributor

Choose a reason for hiding this comment

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

This will be the first four-argument builtin. Luckily the basic infrastructure for four-argument costing functions is already in place, but we'll probably have to extend this type and related functions to deal with insertValue. We probably don't want to do that until the final implementation of the Value type is decided though, although if that decision depends on costs we might have to add costing machinery for the different candidates.

Copy link
Member Author

Choose a reason for hiding this comment

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

This will be a four argument builtin regardless of the underlying implementation.

Copy link
Contributor

@kwxm kwxm Sep 13, 2025

Choose a reason for hiding this comment

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

This will be a four argument builtin regardless of the underlying implementation.

Yes, but we'll have to add an extra constructor here and code to handle it here (and maybe elsewhere as well), and exactly what we add will depend on how the implementation behaves. It's probaby not a big deal, but we won't be able to re-use any existing code.

@zliu41
Copy link
Member Author

zliu41 commented Sep 13, 2025

I got a bit worried whether there was a danger of confusion with the Value type (and the other version here) in plutus-ledger-api

The non-built-in Value type will be gone in the near future.

@kwxm
Copy link
Contributor

kwxm commented Sep 13, 2025

This looks fine.

I spoke too soon! There are some failing tests in cardano-constitution-test. I think that's just UPLC code getting rearranged though.

[Never mind: I think you fixed that when I was typing.]

@kwxm
Copy link
Contributor

kwxm commented Sep 13, 2025

I got a bit worried whether there was a danger of confusion with the Value type (and the other version here) in plutus-ledger-api

The non-built-in Value type will be gone in the near future.

Will we not need that for old scripts?

@zliu41
Copy link
Member Author

zliu41 commented Sep 13, 2025

Will we not need that for old scripts?

You are right, we do. Then we should rename it to avoid the confusion (PoorMan'sValue? 😄 )

@github-actions
Copy link
Contributor

github-actions bot commented Sep 13, 2025

PR Preview Action v1.6.2

🚀 View preview at
https://IntersectMBO.github.io/plutus/pr-preview/pr-7334/

Built to branch gh-pages at 2025-09-13 07:22 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@zliu41 zliu41 merged commit 33dee5f into master Sep 13, 2025
6 checks passed
@zliu41 zliu41 deleted the zliu41/defaultfun-insert branch September 13, 2025 15:41
Unisay pushed a commit that referenced this pull request Oct 1, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

No Changelog Required Add this to skip the Changelog Check

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants