Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extractor: only store contracts if a party is a stakeholder #4586

Merged
merged 3 commits into from Feb 24, 2020

Conversation

gerolf-da
Copy link
Contributor

@gerolf-da gerolf-da commented Feb 18, 2020

CHANGELOG_BEGIN
- [Extractor (experimental)]: Contracts visible to a party without being a stakeholder are not stored anymore.
- [Extractor (experimental)]: Along with the previous change, the column ``contract.witness_parties`` has been renamed to ``contract.stakeholders``.
CHANGELOG_END

Contributes to #3498.

Pull Request Checklist

  • Read and understand the contribution guidelines
  • Include appropriate tests
  • Set a descriptive title and thorough description
  • Add a reference to the issue this PR will solve, if appropriate
  • Include changelog additions in one or more commit message bodies between the CHANGELOG_BEGIN and CHANGELOG_END tags
  • Normal production system change, include purpose of change in description

NOTE: CI is not automatically run on non-members pull-requests for security
reasons. The reviewer will have to comment with /AzurePipelines run to
trigger the build.

CHANGELOG_BEGIN
- [Extractor (experimental)]: Contracts visible to a party without being a stakeholder are not stored anymore.
- [Extractor (experimental)]: Along with the previous change, the column ``contract.witness_parties`` has been renamed to ``contract.stakeholders``.
CHANGELOG_END

Contributes to #3498.
@gerolf-da
Copy link
Contributor Author

Thanks @S11001001. I pushed the fixes.

parties: Set[String],
templateIds: Set[Identifier]): TransactionTree => TransactionTree = {
val shouldKeep: TreeEvent.Kind => Boolean = event =>
(templateIds.isEmpty || containsTemplateId(templateIds.map(asTuple))(event)) &&
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you sure that templateIds.isEmpty does not change the existing behavior?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you moved this check from streamTransactions. So, it is all right.

@@ -42,6 +46,7 @@ class Extractor[T](config: ExtractorConfig, target: T)(
extends StrictLogging {

private val tokenHolder = config.accessTokenFile.map(new TokenHolder(_))
private val parties: Set[String] = config.parties.toSet.map[String, Set[String]](identity)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is probably a way to do it statically, without the iteration, using scalaz.Liskov or scalaz.Leibniz... but I have not fully understood those yet :) so I will leave it for @S11001001 .... but in any case this is a constant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ha... I see the above thread.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, there is widen as suggested by @S11001001 in an earlier comment. But unfortunately it triggers the wartremover Any check. Since it's only a single iteration over the parties it's not a big deal, albeit using widen would be more elegant of course.

@gerolf-da gerolf-da merged commit 8e7a819 into master Feb 24, 2020
@gerolf-da gerolf-da deleted the 3498-extractor-divulged-contracts branch February 24, 2020 07:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants