Skip to content

Conversation

@zeme-wana
Copy link
Collaborator

@zeme-wana zeme-wana commented Sep 4, 2025

Vendor the flat library in plutus:

  • Original sources kept as-is except for:
  • Removed benchmarks folder
  • Removed DocTest test-suite
  • Changed cabal-version: 3.0 in flat.cabal
  • Added default-extensions: ImportQualifiedPost to flat.cabal and applied stylish-haskell
  • Replaced instances of import Data.ByteString.Internal.memcpy with import Foreign.Marshal.Utils (copyBytes) as per deprecation errors.
  • Original PlutusCore.Flat module in plutus-core has been renamed to PlutusCore.FlatInstances

@github-actions
Copy link
Contributor

github-actions bot commented Sep 4, 2025

PR Preview Action v1.6.2

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

Built to branch gh-pages at 2025-09-15 20:55 UTC.
Preview will be ready when the GitHub Pages deployment is complete.

@zeme-wana zeme-wana added the No Changelog Required Add this to skip the Changelog Check label Sep 4, 2025
@zeme-wana zeme-wana changed the title Vendor the flat package: use a custom fork instead of the official from hackage Vendor the flat package Sep 8, 2025
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 all looks OK, and it appears to work as it should. I'm not familiar with licensing issues and the details of how one deals with incorporating someone else's code into the codebase though, so we should probabaly get someone else to review it too.

cabal.project Outdated
plutus-benchmark
plutus-conformance
plutus-core
plutus-core/flat
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this mean that references to flat in the .cabal files will get our version now? I'm not sure how things get resolved if there are multiple libraries with the same name floating about.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes. Cabal first resolves flat via cabal.project's packages and S.R.P stanzas and if that fails it looks into hackage and CHaP

@@ -0,0 +1,30 @@
Copyright (c) 2016, Pasqualino `Titto` Assini
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if we should remove this license if we're going to start modifying the code. Maybe there's some company policy about this kind of situation? I see that the license does say that we're supposed to retain it, but what happens if we change the source code?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The license says that ridistribution is permitted so long as the original LICENSE file is retained, AFAIU.
But we should get a second opinion.

@@ -0,0 +1,171 @@
cabal-version: 3.0
Copy link
Contributor

Choose a reason for hiding this comment

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

The flat code is independent of the rest of the Plutus code at the moment. I wonder if we should put it in a separate package, like plutus-flat or something. I don't know if that would be sensible or not, but it seems like the sort of thing that people mighr have an opinion about.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

A top-level plutus-flat folder is just as good, probably even a better idea.
We should vote: who's in favour of a top-level plutus-flat as opposed to plutus-core/flat? React with 👍 @IntersectMBO/plutus-core-maintainers

Copy link
Contributor

Choose a reason for hiding this comment

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

Without having a strong preference I'd chose plutus-core/flat since we already keep other libs like satint there and plutus-core package serves as a namespace. But top level isn't bad too.

Copy link
Contributor

@ana-pantilie ana-pantilie Sep 9, 2025

Choose a reason for hiding this comment

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

Why are the other libs like satint in plutus-core instead of separate packages?

Copy link
Member

Choose a reason for hiding this comment

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

Top-level with its own .cabal file is better - so that it is just a mirror of the original project's repository. Easier to upstream changes this way.

Why are the other libs like satint in plutus-core instead of separate packages?

Is satint a vendored library? Seems not?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think I lean slightly towards putting it at the top level because it'd be a bit easier to work on, but it's not a big deal.

Copy link
Contributor

Choose a reason for hiding this comment

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

Top-level with its own .cabal file is better - so that it is just a mirror of the original project's repository. Easier to upstream changes this way.

I agree with this.

, extra
, filepath
, flat ^>=0.6
, flat
Copy link
Member

Choose a reason for hiding this comment

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

plutus-core:flat?

@zeme-wana zeme-wana merged commit ed21af4 into master Sep 16, 2025
6 checks passed
@zeme-wana zeme-wana deleted the vendor-flat branch September 16, 2025 05:01
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.

6 participants