Skip to content

Commit

Permalink
Only ship disclosure information once in scenario service
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
hurryabit committed Jul 2, 2020
1 parent 3296f56 commit ffbbd0d
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 29 deletions.
8 changes: 0 additions & 8 deletions compiler/scenario-service/protos/scenario_service.proto
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {

Expand Down

0 comments on commit ffbbd0d

Please sign in to comment.