Only ship disclosure information once in scenario service (#6578)

Currently, the scenario service ships the disclosure information of a
transaction twice. One of the two copies is completely unused. This PR
simply deletes it. I hope this reduces confusion in the future.

CHANGELOG_BEGIN
CHANGELOG_END
This commit is contained in:
Martin Huschenbett 2020-07-02 15:16:21 +02:00 committed by GitHub
parent a2f2880eda
commit 6dc2c9c9b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 1 additions and 29 deletions

View File

@ -398,10 +398,6 @@ message Party {
string party = 1;
}
message NodeAndParties {
NodeId node_id = 1;
repeated Party parties = 2;
}
message Disclosure {
Party party = 1;
int32 since_tx_id = 2;
@ -497,10 +493,6 @@ message Transaction {
repeated NodeId roots = 3;
repeated NodeId nodes = 4;
// Transaction nodes that must be disclosed to individual parties
// to make this transaction valid.
repeated NodeAndParties disclosures = 5;
// If non-empty, the transaction failed due to these failed authorizations.
FailedAuthorizations failed_authorizations = 6;
}

View File

@ -360,20 +360,6 @@ final class Conversions(
.setEffectiveAt(rtx.effectiveAt.micros)
.addAllRoots(rtx.transaction.roots.map(convertNodeId(rtx.transactionId, _)).toSeq.asJava)
.addAllNodes(rtx.transaction.nodes.keys.map(convertNodeId(rtx.transactionId, _)).asJava)
// previously rtx.disclosures returned both global and local implicit disclosures, but this is not the case anymore
// therefore we need to explicitly add the contracts that are divulged directly (via ContractId rather than ScenarioNodeId)
.addAllDisclosures(
(rtx
.disclosures(coidToEventId))
.toSeq
.map {
case (nodeId, parties) =>
proto.NodeAndParties.newBuilder
.setNodeId(convertEventId(nodeId))
.addAllParties(parties.map(convertParty).asJava)
.build
}
.asJava)
.setFailedAuthorizations(convertFailedAuthorizations(rtx.failedAuthorizations))
.build
}

View File

@ -82,13 +82,7 @@ object ScenarioLedger {
explicitDisclosure: Relation[Tx.NodeId, Party],
globalImplicitDisclosure: Relation[ContractId, Party],
failedAuthorizations: FailedAuthorizations,
) {
def disclosures(coidToEventId: ContractId => EventId): Relation[EventId, Party] =
Relation.union(
Relation.mapKeys(explicitDisclosure)(EventId(transactionId, _)),
Relation.mapKeys(globalImplicitDisclosure)(coidToEventId),
)
}
)
object RichTransaction {