-
Notifications
You must be signed in to change notification settings - Fork 27
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
R3SOL-368 Move ledger flow code from components into a new library #6353
R3SOL-368 Move ledger flow code from components into a new library #6353
Conversation
ac9b06e
to
c36fb62
Compare
Jenkins build for PR 6353 build 62 Build Successful: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do all those impl packages now need package-info files? Exporting an impl is usually a smell...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I don't export these then I get the following error (so it looks like the exports are needed by the ledger flow tests):
> Task :components:ledger:ledger-utxo-flow:resolve FAILED
Resolution failed. Capabilities satisfying the following requirements could not be found:
[<<INITIAL>>]
⇒ osgi.identity: (osgi.identity=ledger-utxo-flow-tests)
⇒ [ledger-utxo-flow-tests version=5.3.0.0-SNAPSHOT]
⇒ osgi.wiring.package: (osgi.wiring.package=net.corda.ledger.lib.utxo.flow.impl.timewindow)
These were exported in their original location (except libs/ledger-lib-utxo-flow/src/main/java/net/corda/ledger/lib/utxo/flow/impl/transaction/factory/impl/package-info.java
I'll try and work out why I needed to export that).
For example:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
iirc, when we exported an impl it was to get an integration test to work or something like that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can't get the tests to resolve without libs/ledger-lib-utxo-flow/src/main/java/net/corda/ledger/lib/utxo/flow/impl/transaction/factory/impl/package-info.java
(as well).
Nothing has jumped out to me as being wrong when i reviewed the diff, will take a closer look though. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gradle configuration changes LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks ok to me, just the one question...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question - shouldn't the OsgiImpl be in a different module, so that we can pull in the non-OSGi version to the new project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We discussed this offline but concluded the annotations are Okay as corda-dlt will ignore them and do not use OSGi for dependancy injection.
…ib' into WillV/R3SOL-368-Extract-Ledger-Lib # Conflicts: # libs/application/application-impl/build.gradle
Remember to target the feature branch. |
The base branch was changed.
…lV/R3SOL-368-Extract-Ledger-Lib
…lV/R3SOL-368-Extract-Ledger-Lib
@@ -39,6 +38,7 @@ import java.net.http.HttpResponse | |||
import java.time.Duration | |||
import java.time.Instant | |||
import java.util.UUID | |||
import net.corda.crypto.core.avro.toAvro |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
how'd this pass detekt with this import here 🤔
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe detekt isn't running in the smokeTest dir.
fun AvroSecureHash.toCorda(): SecureHash = | ||
SecureHashImpl(this.algorithm, this.bytes.array()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't it be possible to have the toAvro/toCorda functions defined somewhere and reuse them? They seem to be defined an awful lot of times...
Maybe not one central place, but even reducing the numbers would be good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some got missed during refactoring. I fixed this now.
@@ -22,6 +22,7 @@ import org.osgi.service.component.annotations.ReferenceScope.PROTOTYPE_REQUIRED | |||
import org.osgi.service.component.annotations.ServiceScope | |||
import java.io.InputStream | |||
|
|||
// I think the merkle tree code only has a dep on other crypto modules for this and secure hash impl |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this comment stay here? That looks like a note for work in progress?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've removed this.
fun AvroSecureHash.toCorda(): SecureHash = | ||
SecureHashImpl(this.algorithm, this.bytes.array()) | ||
|
||
fun SecureHash.toAvro(): AvroSecureHash = | ||
AvroSecureHash(this.algorithm, ByteBuffer.wrap(bytes)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So you've got a central definition here, why not use that everywhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this now.
description 'Common crypto implementation' | ||
|
||
dependencies { | ||
// compileOnly "org.osgi:org.osgi.service.component.annotations" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove commented out stuff, please!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is fixed.
@@ -110,7 +111,7 @@ fun SignatureSpec.toWire(serializer: AlgorithmParameterSpecEncodingService): Cry | |||
else -> CryptoSignatureSpec(signatureName, null, null) | |||
}.also { | |||
CordaMetrics.Metric.Crypto.SignatureSpecTimer.builder() | |||
.withTag(CordaMetrics.Tag.OperationName, TO_WIRE_OPERATION_NAME) | |||
.withTag(CordaMetrics.Tag.OperationName, net.corda.crypto.impl.utils.TO_WIRE_OPERATION_NAME) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the fully qualified name required here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I fixed this. I think Intelij sometimes does this on refactor.
|
||
implementation project(':libs:ledger:ledger-common-data') | ||
implementation project(':libs:crypto:crypto-core') | ||
implementation project(':libs:serialization:serialization-amqp-api') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we depend on this in the new project? If yes, then AMQP would not be a comfortable dependency...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is just amqp-api
. So I think it's Okay.
./gradlew :libs:serialization:serialization-amqp-api:dependencies --configuration runTimeClassPath
runtimeClasspath - Runtime classpath of null/main.
+--- net.corda:corda-api:5.3.0.16-beta+ -> 5.3.0.16-beta-1729750087895
| +--- net.corda:corda-application:5.3.0.16-beta-1729750087895 (c)
| +--- org.jetbrains.kotlin:kotlin-osgi-bundle:1.8.21 (c)
| +--- javax.persistence:javax.persistence-api:2.2 (c)
| +--- net.corda:corda-base:5.3.0.16-beta-1729750087895 (c)
| +--- net.corda:corda-crypto:5.3.0.16-beta-1729750087895 (c)
| +--- net.corda:corda-membership:5.3.0.16-beta-1729750087895 (c)
| +--- net.corda:corda-serialization:5.3.0.16-beta-1729750087895 (c)
| \--- org.slf4j:slf4j-api:2.0.13 (c)
+--- net.corda:corda-application -> 5.3.0.16-beta-1729750087895
| +--- javax.persistence:javax.persistence-api:2.2
| +--- net.corda:corda-api:5.3.0.16-beta-1729750087895 (*)
| +--- net.corda:corda-base:5.3.0.16-beta-1729750087895
| | +--- net.corda:corda-api:5.3.0.16-beta-1729750087895 (*)
| | \--- org.slf4j:slf4j-api:2.0.13
| +--- net.corda:corda-crypto:5.3.0.16-beta-1729750087895
| | +--- org.slf4j:slf4j-api:2.0.13
| | +--- net.corda:corda-api:5.3.0.16-beta-1729750087895 (*)
| | \--- net.corda:corda-base:5.3.0.16-beta-1729750087895 (*)
| +--- net.corda:corda-membership:5.3.0.16-beta-1729750087895
| | +--- net.corda:corda-api:5.3.0.16-beta-1729750087895 (*)
| | \--- net.corda:corda-base:5.3.0.16-beta-1729750087895 (*)
| \--- net.corda:corda-serialization:5.3.0.16-beta-1729750087895
| +--- net.corda:corda-api:5.3.0.16-beta-1729750087895 (*)
| \--- net.corda:corda-base:5.3.0.16-beta-1729750087895 (*)
\--- org.jetbrains.kotlin:kotlin-osgi-bundle:1.8.21
Only serialization-amqp
depends on proton-j.
…ib' into WillV/R3SOL-368-Extract-Ledger-Lib
|
Put ledger flow code into a new library. Uncoupled the new libraries dependencies and transitive dependencies from the avro schema. Pulling out code where needed into new modules (if there isn't a sensible place).