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

CORE-18698 Store and find filtered transactions in the database #5485

Merged
merged 38 commits into from
Feb 2, 2024

Conversation

nkovacsx
Copy link
Contributor

@nkovacsx nkovacsx commented Jan 22, 2024

This PR contains the following changes:

  • Move FilteredTransaction and FilteredTransactionFactory and their implementations to a separate module called ledger-filtered-transaction-api and ledger-filtered-transaction. This is needed because the common flow module didn't allow us to use these in the persistence worker.
  • Compile and test changes related to this new module
  • A new interface called MerkleProofInternal which has a merge function on it so we don't have to use MerkleProofImpl everywhere.
  • A new interface called UtxoFilteredTransactionInternal so we can access the its FilteredTransaction.
  • FilteredTransaction now exposes privacySalt
  • Remove previously public API related to Merkle Proofs from the UtxoLedgerPersistenceService
  • New functions called persistFilteredTransactions and findFilteredTransactions on the UtxoPersistenceService API (persistence worker side)

Draft PR for the requests that I used for testing:
corda/corda-api#1456
#5490

@nkovacsx nkovacsx requested review from a team as code owners January 22, 2024 18:28
@blsemo
Copy link
Contributor

blsemo commented Jan 23, 2024

I was wondering whether we need new modules for filtered transactions? Couldn't they be moved into libs/ledger/ledger-utxo-data? We tend to have too many modules which causes gradle slowness and OSGi overhead...

@nkovacsx nkovacsx requested a review from jennyang-r3 January 24, 2024 10:29
@dickon
Copy link
Contributor

dickon commented Jan 25, 2024

I think we should split out moving the code around and get that merged first so it's easier to read the behaviour changes.

AND utmp.group_idx = :groupIndex"""
WHERE utmp.transaction_id IN (:transactionIds)
AND utc.leaf_idx IN (
SELECT utmpl.leaf_index
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you get input from @ifrankrui on the best way to write those queries?

libs/crypto/cipher-suite/build.gradle Outdated Show resolved Hide resolved
dickon added a commit that referenced this pull request Jan 26, 2024
…o ledger-common-flow (#5526)

In prepration for using FilteredTransaciton from UtxoLedgerService move the interface and add a stub.

Refactoring broken out from #5485.
dickon added a commit that referenced this pull request Jan 26, 2024
… ledger libs (#5528)

Move filtered transactions implementation to libs. This is in preparation for using filtered transactions more widely.
Refactoring broken out from #5485.
…me-os into nandor/CORE-18698/persist-and-find-ftx

# Conflicts:
#	gradle.properties
@corda-jenkins-ci02
Copy link
Contributor

corda-jenkins-ci02 bot commented Feb 1, 2024

Jenkins build for PR 5485 build 32

Build Successful:
Jar artifact version produced by this PR: 5.2.0.0-alpha-1706883968777
Helm chart version produced by this PR: 5.2.0-alpha.1706883968777
Helm chart pushed to: oci://corda-os-docker-dev.software.r3.com/helm-charts/pr-5485/corda

…me-os into nandor/CORE-18698/persist-and-find-ftx

# Conflicts:
#	components/ledger/ledger-persistence/src/main/kotlin/net/corda/ledger/persistence/utxo/UtxoPersistenceService.kt
#	components/ledger/ledger-utxo-flow/src/main/kotlin/net/corda/ledger/utxo/flow/impl/persistence/UtxoLedgerPersistenceService.kt
#	components/ledger/ledger-utxo-flow/src/main/kotlin/net/corda/ledger/utxo/flow/impl/persistence/UtxoLedgerPersistenceServiceImpl.kt
rick-r3
rick-r3 previously approved these changes Feb 2, 2024
vlajos
vlajos previously approved these changes Feb 2, 2024
Copy link
Contributor

@vlajos vlajos left a comment

Choose a reason for hiding this comment

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

I added a few small things potentially for a later PR.

listOf(0, 1),
emptyList()
persistenceService.persistFilteredTransactions(
mapOf(filteredTransactionToStore to emptyList()),
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be good to verify the signature persistence's execution path.
But that can happen in a separate PR/ticket.

signedTransaction.wireTransaction,
componentGroupFilterParameters = listOf(
ComponentGroupFilterParameters.AuditProof(
0,
Copy link
Contributor

Choose a reason for hiding this comment

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

UtxoComponentGroup.OUTPUTS_INFO.ordinal would be a bit nicer instead of the constant.
Or potentially using the LedgerService.filterSignedTransaction to replace the creation steps. (if that works in integration tests.)

)

// 6. Map the transaction id to the filtered transaction object and signatures
filteredTransaction.id.toString() to Pair(filteredTransaction, ftxDto.signatures)
Copy link
Contributor

Choose a reason for hiding this comment

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

transactionId is already the same in string.

import net.corda.v5.crypto.extensions.merkle.MerkleTreeHashDigestProvider
import net.corda.v5.crypto.merkle.HashDigestConstants
import net.corda.v5.ledger.common.transaction.TransactionMetadata
import java.util.*
Copy link
Contributor

Choose a reason for hiding this comment

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

Is detekt OK with wildcard import?

rick-r3
rick-r3 previously approved these changes Feb 2, 2024
Copy link
Contributor

@rick-r3 rick-r3 left a comment

Choose a reason for hiding this comment

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

Re-approve

@nkovacsx nkovacsx removed the request for review from a team February 2, 2024 11:55
gradle.properties Outdated Show resolved Hide resolved
mbrkic-r3
mbrkic-r3 previously approved these changes Feb 2, 2024
Copy link
Contributor

@mbrkic-r3 mbrkic-r3 left a comment

Choose a reason for hiding this comment

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

LGTM (flow related code)

@nkovacsx nkovacsx dismissed stale reviews from mbrkic-r3, rick-r3, and vlajos via 9ff3f24 February 2, 2024 14:25
@nkovacsx nkovacsx requested a review from a team as a code owner February 2, 2024 14:25
Copy link

sonarqubecloud bot commented Feb 2, 2024

Quality Gate Passed Quality Gate passed

The SonarCloud Quality Gate passed, but some issues were introduced.

2 New issues
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

Copy link
Contributor

@wzur-r3 wzur-r3 left a comment

Choose a reason for hiding this comment

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

LGTM

@nkovacsx nkovacsx merged commit 2352f31 into release/os/5.2 Feb 2, 2024
4 checks passed
@nkovacsx nkovacsx deleted the nandor/CORE-18698/persist-and-find-ftx branch February 2, 2024 15:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants