daml icon indicating copy to clipboard operation
daml copied to clipboard

ExerciseByKey command issue with upgraded keys

Open paulbrauner-da opened this issue 1 year ago • 1 comments

ExerciseByKey command nodes don't store the upgraded key. This leads to re-intepretation errors.

exerciseCmdKeyUnchanged : Test
exerciseCmdKeyUnchanged = test $ do
  a <- allocateParty "alice"
  cid <- a `submit` createExactCmd (V1.UnchangedKey a 1)
  res <- a `submit` exerciseByKeyExactCmd @V2.UnchangedKey (V2.UnchangedKeyKey a 1) V2.UnchangedKeyCall
  res === "V2"

Fails with

│  Preprocessing(                                                                                                                                                                                                                                                                 │
│    TypeMismatch(                                                                                                                                                                                                                                                                │
│      TTyCon(Identifier("f16528e38f4dad82de8c92f2ab7ec3ed6810e5630f5a0dac915e4476c572deb6", QualifiedName(UpgradedContractKeys, UpgradedKeyKey))),                                                                                                                               │
│      ValueRecord(None, ImmArray((None,ValueParty(party-16780f11-e4e6-4817-8a99-3b891d022d19::1220072f530858469e83cf46f8015492a98a683f5df9761a790247a98f3dd8849651)),(None,ValueInt64(1)))),                                                                                     │
│      "Expecting 3 field for record f16528e38f4dad82de8c92f2ab7ec3ed6810e5630f5a0dac915e4476c572deb6:UpgradedContractKeys:UpgradedKeyKey, but got 2"                                                                                                                             │
│    )                                                                                                                                                                                                                                                                            │
│  ),                                                                                                                                                                                                                                                                             │
│  ViewHash(SHA-256:2f239a71d77b...)                                                                                                                                                                                                                                              │
│) err-context:{location=ConfirmationResponseFactory.scala:204, requestId=RequestId(2024-08-14T12:01:48.331102Z)}  

In ModelConformanceChecker.

paulbrauner-da avatar Aug 14 '24 12:08 paulbrauner-da

Still needs to be fixed for 3.x 2.x's solution was a hack, a proper solution is needed for 3.x so we can't just forwardport

dylant-da avatar Aug 20 '24 12:08 dylant-da

Part of NUCK design.

paulbrauner-da avatar Jul 01 '25 13:07 paulbrauner-da