daml icon indicating copy to clipboard operation
daml copied to clipboard

Wrong choice resolution from two interfaces implementing a choice with the same name

Open GeorgSchneider opened this issue 3 years ago • 1 comments
trafficstars

Affected Daml version

2.4.0-snapshot.20220712.10212.0.0bf28176

Bug description

When a template implements two interfaces that define a choice with the same name, it can happen that the wrong one is executed. I've attached a minimal repro. If you run daml start the debug output of the script reads:

[DA.Internal.Prelude:555]: ViewB {num = asdf}

which is clearly wrong as type ViewB is defined as:

data ViewB = ViewB
  with
    num : Int
  deriving (Eq, Show)

It looks like instead of B.GetView the A.GetView choice is returned and the result is somehow coerced into a ViewB.

Note that in Daml Studio the correct debug output is displayed, so not sure if this is a Canton-specific issue or not.

To reproduce

  • Extract test1.tar.gz using tar -xzvf test1.tar.gz
  • Run daml start

Expected behavior

I would expect this to be returned:

[DA.Internal.Prelude:555]: ViewB {num = 42}

Additional context

I couldn't test this with the latest snapshot 2.4.0-snapshot.20220801.10312.0.d2c7be9d as I was getting the following error when running daml start, and didn't know how to get around it:

2022-08-07 15:30:56,504 [canton-env-execution-context-25] ERROR c.d.c.p.p.TransactionProcessingSteps:participant=sandbox/domain=local tid:1ab44a9de3153b74cca9cbcd1e62749a - COMMAND_INJECTION_FAILURE(4,1ab44a9d): Command failed with an exception err-context:{location=TransactionProcessingSteps.scala:401} 
com.digitalasset.canton.data.ActionDescription$InvalidActionDescription: Protocol version is equivalent to 2.0.0 but interface id is supported since protocol version 2147483647.0.0-DEV

GeorgSchneider avatar Aug 07 '22 13:08 GeorgSchneider

I understand that Canton support for this is WIP, I'll leave it to the team to close this or not

GeorgSchneider avatar Aug 08 '22 10:08 GeorgSchneider