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

conway.cddl costmdls clarification #4383

Closed
rooooooooob opened this issue Jun 4, 2024 · 1 comment
Closed

conway.cddl costmdls clarification #4383

rooooooooob opened this issue Jun 4, 2024 · 1 comment
Assignees

Comments

@rooooooooob
Copy link

Slightly pedantic but as of #4284 the definition was changed to:

costmdls =
  { ? 0 : [ int64 ] ; Plutus v1
  , ? 1 : [ int64 ] ; Plutus v2
  , ? 2 : [ int64 ] ; Plutus v3
  , ? 3 : [ int64 ] ; Any 8-bit unsigned number can be used as a key.
  }

Is this meant to be [ * int64]? Or [ 166* int64] (etc)? Currently it's saying there are exactly 1 element per array as per the CDDL RFC but that's obviously not the intention.

Is that 3 key meant to just be a comment or suggestion for all others keys being allowed with zero restrictions e.g. * uint => [* int64]?

I'm mostly wanting to know about that old comment (e.g. ? 0 : [ 166* int ] ; Plutus v1, only 166 integers are used, but more are accepted (and ignored)) holds true and we need to accept but ignore elements after or not, but that those minimums still need to be checked. And if that ignoring has any bearing on costmodel's language view encoding computation since that hashes cost models' cost array inside a serialized CBOR structure. As far as I understand this is canonical CBOR (besides the plutus v1 difference) so not directly taking it out of the cost models on-chain serialization.

The previous eras' .cddl specs still maintain their bounds (babbage.cddl/alonzo.cddl)

    ? 0 : [ 166*166 int64 ] ; Plutus v1
  , ? 1 : [ 175*175 int64 ] ; Plutus v2
@teodanciu teodanciu self-assigned this Jun 5, 2024
@teodanciu
Copy link
Contributor

@rooooooooob, thank you for pointing out the error. I have now fixed the cddl to be:

costmdls =
  { ? 0 : [ * int64 ] ; Plutus v1
  , ? 1 : [ * int64 ] ; Plutus v2
  , ? 2 : [ * int64 ] ; Plutus v3
  , * 3 .. maxWord8 => [ * int64 ] ; Any 8-bit unsigned number can be used as a key
  }

which is correct and more precise than what we had before.

With regards to your last question, I don't understand everything you are asking (particularly towards the end), but I can start by saying that the Conway deserialization of costmodels does not check the number of values in the list, because the Plutus function that we are passing this list to (namely mkEvaluationContext) no longer expects the exact number of values for each language.
So there is no checking, ignoring or otherwise modification of the list based on these numbers.
If this does not answer everything you wanted to know, could you please explain more about what is unclear?
Thanks!

rooooooooob added a commit to dcSpark/cardano-multiplatform-lib that referenced this issue Jun 17, 2024
Due to changes here: IntersectMBO/cardano-ledger#4284
Clarification here: IntersectMBO/cardano-ledger#4383

Allows non-Plutus languages according to the spec and changes to an
indexable map type.
rooooooooob added a commit to dcSpark/cardano-multiplatform-lib that referenced this issue Jun 18, 2024
Due to changes here: IntersectMBO/cardano-ledger#4284
Clarification here: IntersectMBO/cardano-ledger#4383

Allows non-Plutus languages according to the spec and changes to an
indexable map type.
rooooooooob added a commit to dcSpark/cardano-multiplatform-lib that referenced this issue Jul 23, 2024
Due to changes here: IntersectMBO/cardano-ledger#4284
Clarification here: IntersectMBO/cardano-ledger#4383

Allows non-Plutus languages according to the spec and changes to an
indexable map type.
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

No branches or pull requests

2 participants