[In-memory fan-out] Handle null submitters in getTransactionLogUpdates (#10248)

* [In-memory fan-out] Handle `null` submitters in getTransactionLogUpdates

CHANGELOG_BEGIN
CHANGELOG_END

* Address review comments
This commit is contained in:
tudor-da 2021-07-13 14:11:27 +02:00 committed by GitHub
parent 584169a2cc
commit de7a08fa7b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 3 deletions

View File

@ -866,7 +866,7 @@ private[backend] trait CommonStorageBackend[DB_BATCH] extends StorageBackend[DB_
int("create_argument_compression").? ~
array[String]("tree_event_witnesses") ~
array[String]("flat_event_witnesses") ~
array[String]("submitters") ~
array[String]("submitters").? ~
str("exercise_choice").? ~
binaryStream("exercise_argument").? ~
int("exercise_argument_compression").? ~
@ -900,7 +900,7 @@ private[backend] trait CommonStorageBackend[DB_BATCH] extends StorageBackend[DB_
createArgumentCompression,
treeEventWitnesses.toSet,
flatEventWitnesses.toSet,
submitters.toSet,
submitters.map(_.toSet).getOrElse(Set.empty),
exerciseChoice,
exerciseArgument,
exerciseArgumentCompression,

View File

@ -292,6 +292,11 @@ private[dao] trait JdbcLedgerDaoSuite extends JdbcLedgerDaoBackend {
)
}
protected final def noSubmitterInfo(
transaction: LedgerEntry.Transaction
): LedgerEntry.Transaction =
transaction.copy(commandId = None, actAs = List.empty, applicationId = None)
protected final def fromTransaction(
transaction: CommittedTransaction,
actAs: List[Party] = List(alice),

View File

@ -7,6 +7,7 @@ import java.util.concurrent.atomic.AtomicLong
import akka.NotUsed
import akka.stream.scaladsl.{Sink, Source}
import com.daml.ledger
import com.daml.ledger.participant.state.v1.Offset
import com.daml.lf.ledger.EventId
import com.daml.lf.transaction.Node
@ -50,7 +51,8 @@ private[dao] trait JdbcLedgerDaoTransactionLogUpdatesSpec
it should "return the correct transaction log updates" in {
for {
from <- ledgerDao.lookupLedgerEndOffsetAndSequentialId()
(offset1, t1) <- store(singleCreate)
(createOffset, createTx) = singleCreate
(offset1, t1) <- store(createOffset -> noSubmitterInfo(createTx))
(offset2, t2) <- store(txCreateContractWithKey(alice, "some-key"))
(offset3, t3) <- store(
singleExercise(
@ -124,6 +126,10 @@ private[dao] trait JdbcLedgerDaoTransactionLogUpdatesSpec
actualEventsById.get(expectedEventId)
actualCreated.contractId shouldBe nodeCreate.coid
actualCreated.templateId shouldBe nodeCreate.templateId
actualCreated.submitters should contain theSameElementsAs expected.actAs
.map(_.toString)
.toSet
ledger.CommandId.fromString(actualCreated.commandId).toOption shouldBe expected.commandId
actualCreated.treeEventWitnesses shouldBe nodeCreate.informeesOfNode
actualCreated.flatEventWitnesses shouldBe nodeCreate.stakeholders
actualCreated.createSignatories shouldBe nodeCreate.signatories
@ -139,6 +145,12 @@ private[dao] trait JdbcLedgerDaoTransactionLogUpdatesSpec
actualExercised.contractId shouldBe nodeExercises.targetCoid
actualExercised.templateId shouldBe nodeExercises.templateId
actualExercised.submitters should contain theSameElementsAs expected.actAs
.map(_.toString)
.toSet
ledger.CommandId
.fromString(actualExercised.commandId)
.toOption shouldBe expected.commandId
if (actualExercised.consuming)
actualExercised.flatEventWitnesses shouldBe nodeExercises.stakeholders
else