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

Blueprint issues - placeholder #422

Open
nemo83 opened this issue Sep 3, 2024 · 3 comments
Open

Blueprint issues - placeholder #422

nemo83 opened this issue Sep 3, 2024 · 3 comments
Assignees

Comments

@nemo83
Copy link
Contributor

nemo83 commented Sep 3, 2024

Hey,

I've started to play around w/ the Blueprint annotation and I'm gonna use this ticket to triage ideas/issues

  1. Just noticed that int is used for Aiken's Int type which from the docs is Aiken's only number type is an arbitrary sized integer. This means there is no underflow or overflow.. I think this should be at least a long or better a BigInteger. EDIT, this break in fact POSIXTime => https://preprod.cexplorer.io/datum/db864f402bd7aadf9919522cfb201fbc4f164bcdf705e998253d42db9e8a3211 there's a negative number that should be the time
  2. Replace snake notation w/ camelCase
  3. Blueprint class generation breaks for https://github.com/easy1staking-com/cardano-recurring-payment (I'd be happy to debug if you point me to a test or something, gradle swallows the error and just ... crashes.)

Note on issue (3)

It looks like the following container classes are not supported:

  1. Tuple
  2. Option

Once I remove all the references, the blueprint compiles no problem

@satran004
Copy link
Member

Thanks @nemo83 for tying this out .

Let me run a quick test with your plutus.json, and I will update you here.

I agree that:

  1. int should be converted to BigInteger
  2. snake_case should be converted to camelCase

For debugging, you can find the annotation processor implementation inside the annotation-processor module. There are many test plutus.json files. you can copy your plutus.json to the test or it package and try it.

@satran004 satran004 added bug Something isn't working Need to verify and removed bug Something isn't working labels Sep 5, 2024
@satran004 satran004 self-assigned this Sep 11, 2024
@satran004
Copy link
Member

@nemo83 This PR fixes BigInteger issue #433

While BigInteger will be the default option, we can later plan to enhance the @Blueprint annotation with additional metadata to select the appropriate Java integer type (BigInteger, Integer, int) based on the application's requirements.

@nemo83
Copy link
Contributor Author

nemo83 commented Sep 12, 2024

Thanks for all the fixes, enhancing @Blueprint makes sense, but imho is low prio. Offchain code is cheap.

WRT to Option and Tuple

  • Option: After talking w/ ktorz he mentioned that Option is a sum-type of object, technically we could forget w/ have native Option in java, and just do the same we do w/ any other sum-type(s)
  • Tuple, blueprint is a list of lists, I think as an immediate solution this could be okay. Alternatively just implement two pojos (which CCL already have) of Tuple and Triple, nothing more coz at that point a proper container object would be recommended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants