Conversation
paulbrauner-da
left a comment
There was a problem hiding this comment.
Nice! Shorter than I expected.
| -- If we get an error about --ide-ledger-protocol-version, forward it by itself, as we're depending | ||
| -- on the script service for parsing errors to avoid duplication of protocol versions | ||
| -- We clean up the error a bit to re-point it to script-service.protocol-version |
There was a problem hiding this comment.
Wouldn't it be simpler to validate the pv on the client side and thus assume that the script service will always parse it? This would remove this complex parsing logic and we could just printStderr as before. I realize that's some code duplication between the client and the server that could get out of sync, but we could maybe add a test to prevent this.
There was a problem hiding this comment.
The issue is its one more place we need to update the latest protocol version as well, but this approach its a "one and done"
sdk/compiler/script-service/client/src/DA/Daml/LF/ScriptServiceClient.hs
Outdated
Show resolved
Hide resolved
| -- | ||
| -- This is semantically equivalent to calling `query` | ||
| -- and filtering on the client side. | ||
| queryNContractKey : forall t k p. HasCallStack => (TemplateKey t k, IsParties p) => p -> k -> Int -> Script [(ContractId t, t)] |
There was a problem hiding this comment.
As discussed, we need to think about the naming. The name you've chosen doesn't clash with queryNByKey because there's no "by" (also I'm not sure the other one has N in the name). But it's pretty close. On the other hand, this is consistent with the queryContractKey name that we can't change because GS is using it already.
@remyhaemmerle-da, any opinion?
| parties : [Party] | ||
| tplId : TemplateTypeRep | ||
| contractKey : AnyContractKey | ||
| limit : Int |
There was a problem hiding this comment.
Since we're anyway fetching everything and because this is only meant to be used for testing, I wonder if we need the limit. Let's discuss tomorrow.
| v: ExtendedValue, | ||
| lookupContractKeyType: Identifier => Either[String, Type], | ||
| legacyAnyContractKey: Boolean, | ||
| legacyAnyContractKey: Boolean = false, |
There was a problem hiding this comment.
What introduces the need to assign it a default value?
There was a problem hiding this comment.
The parser for queryNContractKeys never needs legacyAnyContractKey, so I omit the argument.
562cb6d to
a5249e1
Compare
There was a problem hiding this comment.
This is the original test file, renamed to WithKeys.
The MultiTest is a copy of this with all key tests removed
There was a problem hiding this comment.
This is the original test file, renamed to WithKeys.
The ScriptTest is a copy of this with all key tests removed
There was a problem hiding this comment.
Single "Stable" is actually latest PV, which is currently PV34 (no key support)
I've added a test specifically for PV35
| -- TODO: | ||
| -- Exception semantics with keys have changed significantly, this test needs to be re-thought. | ||
| -- Consider cases like fetch/queryby keys in a rollback, as well as non-consuming exercise by key | ||
|
|
There was a problem hiding this comment.
See here
There was a problem hiding this comment.
This tested mustFail using duplicate keys. I've deleted it for now, perhaps we should add back a version that fails using a different error.
| {-# OPTIONS_GHC -Wno-x-exceptions #-} | ||
|
|
||
| -- @IDE-PV V34 | ||
|
|
There was a problem hiding this comment.
We might want a version of this file for PV35, that avoids rollbacks
There was a problem hiding this comment.
All changes here are to allow different PVs in the IDE ledger per test.
We need a separate script service per PV, as we do for build options (which Jasper added some time back). I've extended his logic to also account for PV
| -- Copyright (c) 2025 Digital Asset (Switzerland) GmbH and/or its affiliates. All rights reserved. | ||
| -- SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| -- TODO: This test is disabled as it requires PV34, refactoring the upgrade test suite to allow PV34 would be too much effort for now |
There was a problem hiding this comment.
See here, unsure what we want to do. Do we want the suite to cover PV34?
There was a problem hiding this comment.
Diff is being bad here, I didn't delete these tests, they're just in PV34 now.
| # Disabled as template uses keys and rollbacks, which is no longer permitted | ||
| # TODO: Remove/refactor this template and re-enable the test |
There was a problem hiding this comment.
See here
| jarPath: Path = CantonRunner.cantonPath, | ||
| authSecret: Option[String] = None, | ||
| devMode: Boolean = false, | ||
| protocolVersion: String = "latest", |
There was a problem hiding this comment.
Maybe its worth changing the string to a trait, containing say "dev", "latest" and "explicit(ver: String)"?
There was a problem hiding this comment.
Now every test in our security evidence is disabled 🙃
Needs canton with changes from this PR to pass
New script primitive awaiting naming discussion