As for creates, these tests somewhat ignore ordering on on-cachable
errors relative to each other since those only change error messages.
changelog_begin
changelog_end
* Clarify unhandled exception error message
The previous error doesn’t make it clear that this is an exception in
user code rather than a Scala exception in our code.
Daml-lf exception would technically be more correct but I don’t think
it’s helpful here so I went with Daml exception.
changelog_begin
changelog_end
* adjust ledger api test tool
changelog_begin
changelog_end
* Update test assertions
changelog_begin
changelog_end
* fix another assertion
changelog_begin
changelog_end
Following #12338 which merges the two implementations of the
structural record projection introduced by #7740, this PR merges the two
implementations of the structural record introduced by #7742.
However, this PR does not try to cache the field index as it is done
1- unlike what it is suggested by commit message of #7742, the update
has a linear complexity anyway, as it has to copy the whole struct.
2- the compiler does not produce any structural record updates
As result the PR is basically a revert of #7742.
CHANGELOG_BEGIN
CHANGELOG_END
Currently we have two implementations for the projection of structural
record.
1- The first implementation takes as parameter the index of the
projected field and is therefore constant. This implementations is
used when the type checking is enable, as the index cannot be directly
inferred from the AST and must hence be filled in by the DAML-LF type
checker.
2- The second implementation takes as parameter the name of the
projected field and is therefore logarithmic as the field must be
lookup by binary search at each call. This version is used when the
type checking is disable as the index cannot be inferred without type
inference.
In this PR, we modify the second implementation so it cache the index
at the first call, hence avoiding the recomputation during further
calls. In this way we reach an amortized constant complexity. The
first implementation is decommissioned in benefit of the second one.
The advantages of this approach are:
- We have a unique implementation of the projection, so the behavior
of a program is the same whenever the type checking is on or off.
- The AST for structural projection is immutable.
Benchmarks show no performance differences when the type checking is on.
Based on an idea by @sofiafaro-da.
CHANGELOG_BEGIN
CHANGELOG_END
New year, new copyright, new expected unknown issues with various files
that won't be covered by the script and/or will be but shouldn't change.
I'll do the details on Jan 1, but would appreciate this being
preapproved so I can actually get it merged by then.
CHANGELOG_BEGIN
CHANGELOG_END
* Remove Extractor
Extractor is being removed after a long time being in Labs status.
This should improve the flakiness on CI.
🔥
changelog_begin
Extractor has been removed from the SDK
changelog_end
* Remove Extractor documentation
* Remove Extractor from CODEOWNERS
* Remove Extractor references in Daml-LF build files
* Remove Extractor references in the Daml SDK assistant
* Remove Extractor from the SDK
* Remove Extractor reference from CONTRIBUTING.md
* Escape daml-lf tracelog messages
Currently veracode complains because this allows for clrf
injection (injecting newlines to make user input look like separate
log statements).
With this change
```
debug "abc"
debug "eaiu\neaiu"
debug "def"
debugRaw "abc
```
is logged as
```
[DA.Internal.Prelude:555]: \"abc\"
[DA.Internal.Prelude:555]: \"eaiu\neaiu\"
[DA.Internal.Prelude:555]: \"def\"
[DA.Internal.Prelude:555]: abc
```
You can debate whether we should escape the quotes are necessary but
90% of the reason why people add them is because they call `debug` on
strings when they should be using `debugRaw` so this seems fine to me.
changelog_begin
changelog_end
* fix tests
changelog_begin
changelog_end
as it is normally caught in the interpreter loop. In particular the
caller of the engine should not have to catch such an error.
CHANGELOG_BEGIN
CHANGELOG_END
* Update TODOs to outdated issues.
In particular update a lot of defunct interface TODOs to the LF 1.15
issue (or add the LF 1.15 issue if it's also relevant).
changelog_begin
changelog_end
* typo
* remove numeric/bignumeric todo
* scalafmt!!
* drop choice observer TODO
changelog_begin
changelog_end
add runtime check in freeVars: determination that a variable is-free using levels instead of indexes
remove DB-indexes and runtime check; simplify freeVars computation in closure-conversion
As mentioned in the comment, I view these tests as a way to guard us
against bricking ledgers on upgrades so they somewhat deliberately
ignore ordering of non-cachable errors relative to each other since
those only change error messages.
changelog_begin
changelog_end
This is part of #11691
This PR allows to limits:
- the number of signatories,
- the number of observers,
- the number of controllers,
- the number of inputContracts,
CHANGELOG_BEGIN
CHANGELOG_END
* Add skeleton for trace-based LF evaluation tests
The recent issues around wrong ordering of contract id typechecks got
me thinking about this again so I wanted to hack up a PR of how we can
test evaluation order sensibly directly at the LF level.
This is only testing a single create but I first wanted to see if we
agree that this is a sensible approach using a simple example.
If we agree that this is a sensible approach, I’d suggest to extend
those tests later in separate PRs to make them exhaustive.
changelog_begin
changelog_end
* cleanup
changelog_begin
changelog_end
* Adding missing stack-safety testcase for SEScopeExcerise.
changelog_begin
changelog_end
* run all testcases at depth of 10,000. This is plenty deep enough to ensure stack-safety
* recode free-vars computation to be stack-safe. and test
* Drop support for Daml-LF party literals from the Scala side
This PR enforces that forbidPartyLiterals is always `true` and drops
the corresponding literals from the AST. Haskell side is in #11930fixes#11581
changelog_begin
changelog_end
* Update daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/ComparisonSBuiltinTest.scala
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Revert "Update daml-lf/interpreter/src/test/scala/com/digitalasset/daml/lf/speedy/ComparisonSBuiltinTest.scala"
This reverts commit 55e542ce4e3a7fd15544ee703de3277ffc309b17.
Co-authored-by: Remy <remy.haemmerle@daml.com>
* Use Absolute-indexes as keys for the Env-mapping during closure-conversion.
Do runtime check to confirm behaviour matches the existing Relative-indexes.
changelog_begin
changelog_end
* remove quadratic shift!
remove (dev)pretty-print code
remove relative-index keys from Env-mapping
remove runtime *diff* check
increase depth for stack-safety tests
* improve/simplify indexing calculation for Env-keys
* Add type rep argument for interface exercises.
(Still WIP.)
Part of #11703. Fixes the order in which errors are raised ("wrong type"
takes priority over "does not implement interface"). This PR also simplifies
ExerciseInterface by making the guard mandatory, otherwise there's too
many variations. We can revisit that later if we want.
changelog_begin
changelog_end
* haskell side
* dont throw exception in checkTemplateId
* scalafmt
* evidence security
* fix TypingSpec test
* SExpr1.SELocS - carry relBad/absGood - abs unused so far
* compute/pass SELocS.abs in ClosureConversion, and check in Anf that it matches the reconstructed value
CHANGELOG_BEGIN
CHANGELOG_END
* Remove relative stack locations. Rename as SELocAbsoluteS. Simplify Anf. Remove shiftLoc in ClosureConversion.
* Prevent wrongly typed fetch by interface.
When doing a "fetch by interface" command with a known template id,
error out with a WronglyTypedContract if the fetched contract has
a different template id. This doesn't affect daml, only affects
replays, so it's rather minor. I also enabled the engine test that
caught this.
Part of #11703, follow up to #11836.
changelog_begin
changelog_end
* strengthen test output checks
* Add a guard when exercising by interface.
This fixes part of #11703, when exercising an inherited choice by
interface and you know the template id, via the command preprocessor.
It does this by inserting a "guard" in between the interface fetch and
the exercise body. The guard is a function Interface -> Bool, which
is general enough to check the template id, without complicating too
much in speedy. And can be generalized in the future to check more,
like signatories, etc.
I added the guard as an optional argument to UExerciseByInterface.
This isn't hooked up to the protobuf AST yet (or Haskell side for
that matter) -- but I'll do it in the next PR! For now you can invoke
the guarded exercise via the command preprocessor, so I can enable the
approprate engine tests. (There's still some failing fetch tests left,
but I decided to leave this for later. Fetch can be a lot simpler than
guarded choices, since you always add a fetch node. No need for fancy
continuations.)
changelog_begin
changelog_end
* scalafmt
* Feedback and fix matches
* Update comments, we are always going to abort the transaction
* Raise WronglyTypedContract in SBGuardTemplateId.
* rebase and fix parser
* restore ANF
* scalafmt
ClosureConversion -> Suffix with "Old"
CHANGELOG_BEGIN
CHANGELOG_END
ClosureConversion old-vs-new diff check
ClosureConversionNew, first cut. All tests in SBuiltinTest work.
In addition we change some Array --> List in SExpr1 (for human pp).
And we throw away ClosureConversionDup.
adapt AnfTest from Array to List change for SExpr1
all tests pass in daml-lf/interpreter
remove SExpr0.SELet1General
reorder things
testing for stack-safety of closure conversion
file/class renames
improve naming
pass cont as sep arg to commit (move out of Up/Down)
comment stack-safe closure conversion
fix bug: failed to use env1
fix 2x unmoored doc comment
comment stack safety testing
Remove old closure-conversion code & diff-check between old/new.
loose StackSafe suffix on ClosureConversion class/file
rename StackSafetyTest.scala to ClosureConversionTest.scala
prefer "sealed abstract class" to "sealed trait"
fvs.zipWithIndex --> fvs.view.zipWithIndex
(SExpr1) SEAppGeneral -> SEApp; prefer List to Array in SEApp/SECase
prefer xs.toArray to Array(xs: _*)
access SExpr0 via "source."
two more .view
improve comment and fix typo
link to Issue
switch to a continuation stack; avoids nesting in the Cont type
- rename non-default builders `apply` to `build`
* avoid confusing both
* make explicit the build can crash
- make interfaceId and templateId fields consitent
- use when possible named arguments
- check for non-repetition of inherited choices
CHANGELOG_BEGIN
CHANGELOG_END
We revert #11626, and just change the way transaction version is
computed:
- As before, Node version is calculated from the
package of the template ID action.
- Transaction version is the max of the version of all the nodes,
instead of the root nodes.
CHANGELOG_BEGIN
CHANGELOG_END
I’ve kept the infrastructure for versioned_scala_deps around because
I’m optimistic and hope that eventually we’ll do another Scala upgrade.
changelog_begin
changelog_end
* interfaces: Preserve by_interface data for create.
Part of #10915
This was a lot more involved than fetch or exercise. The first issue is
that we need to preserve the interface id into speedy, so it needs a
separate primitive ("experimental" won't cut it). Second, because
speedy's create requires the template definition, and now the interface
id as well, we basically need to compile a separate version of "create"
for each interface that a template implements, hence the separate
`CreateByInterfaceDefRef(templateId, ifaceId)`.
changelog_begin
changelog_end
* scalafmt and refactoring
* fixx merge conflict
* fix silly mistakes
* Refactor speedy to distinuish SExpr types before/after ANF compilation phase
CHANGELOG_BEGIN
CHANGELOG_END
* remove commment/marker left in error
* make SExpr0 private to speedy
* reinstate (non-pp) print of original expression in AnfTest faiure
* avoid use of s./t. prefixes for expressions in SBuiltin; add 3 TODO markers
* inline "runtime" apply methods of SDefinitionRef into sole caller: SBCallInterface
* avoid use of t. prefix in SExpr0
* change s./t. prefix to source./target.
* add comment to summarize differences between SExpr0 and SExpr
Following up #10827 and #10921, we drop type parameter to
KeyWithMaintainers, and use the `Versioned` wrapper introduced in
CHANGELOG_BEGIN
CHANGELOG_END