Commit Graph

130 Commits

Author SHA1 Message Date
Adel El-Beik
0322b8c6ce
ENT-12491: Commands were being deserialized in captured serialisation… (#7887)
* ENT-12491: Commands were being deserialized in captured serialisation context which did not include the serialisation context with attachments class loader. Now make the deserialisation lazy.

* ENT-12491: Disable carpenter in the external verifier.
2024-12-02 21:48:50 +00:00
Adel El-Beik
4c25e674b8 ENT-12402: In external verifier pass the rotated keys to attachment cache loader cache so that LedgerTransaction picks it up. 2024-11-07 11:31:57 +00:00
Rick Parker
436eca1524
ENT-12366 ExternalVerifier no longer needs legacy contracts folder, and can derive everything it needs from attachments. (#7866)
* ENT-12366 ExternalVerifier no longer needs legacy contracts folder, and can derive everything it needs from attachments.

* ENT-12366 Fix compiler warnings

* Revert "ENT-12366 Fix compiler warnings"

This reverts commit 4e884a5519.

* ENT-12366 Attempt to appease warnings in both 1.2 and 1.9 compilers
2024-11-01 16:27:36 +00:00
Adel El-Beik
33cf48e04b
ENT-12366: External verifier now sets appclassloader to legacy contra… (#7855)
* ENT-12366: External verifier now sets appclassloader to legacy contracts directory instead of the cordapps directory.
* ENT-12366: Now check legacy-contracts exists before start external verifier.
2024-10-28 15:28:50 +00:00
Adel El-Beik
6f4ec5d9e5
ENT-11975: Contract key rotation (#7806)
ENT-11975: Contract key rotation implementation.
2024-10-02 12:53:11 +01:00
Adel El-Beik
6c4b8fdf23
ENT-11657: Upgrade artemis. (#7707)
* ENT-11657: Upgraded artemis.

* ENT-11657: Reverted dependencies task leftin.

* ENT-11657: Upgraded log4j and slf4j.
2024-04-03 11:15:00 +01:00
Shams Asari
62819f27f0 ENT-11126: Use UNIX domain socket for communication with external verifier
These have the advantage of being more secure as only the current user has access to them and faster than local TCP as it avoids the entire TCP stack.
2024-03-26 11:04:04 +00:00
Shams Asari
b3265314ce ENT-11445: Support legacy contract CorDapp dependencies
The `TransactionBuilder` has been updated to look for any missing dependencies to legacy contract attachments, in the same way it does for missing dependencies for CorDapps in the "cordapps" directory,

Since `TransactionBuilder` does verification on the `WireTransaction` and not a `SignedTransaction`, much of the verification logic in `SignedTransaction` had to moved to `WireTransaction` to allow the external verifier to be involved. The external verifier receives a `CoreTransaction` to verify instead of a `SignedTransaction`. `SignedTransaction.verify` does the signature checks first in-process, before then delegating the reset of the verification to the `CoreTransaction`.

A legacy contract dependency is defined as an attachment containing the missing class which isn't also a non-legacy Cordapp (i.e. a CorDapp which isn't in the "cordapp" directory).
2024-03-13 10:58:11 +00:00
Shams Asari
200333b198 ENT-11355: Backwards compatibility with older nodes via new attachments component group 2024-02-19 17:19:49 +00:00
Chris Cochrane
c7514e1c60
ENT-11443 Function sig changes to support removing enterprise compiler warnings (#7671) 2024-02-07 14:46:18 +00:00
Shams Asari
f30ba33929 ENT-11255: Scan attachments to determine if they are Kotlin 1.2 or later
The node now sends a transaction to the verifier if any of its attachments were compiled with Kotlin 1.2 (the net.corda.node.verification.external system property has been removed). It uses kotlinx-metadata to read the Kotlin metadata in the attachment to determine this. For now this scanning is done each time the attachment is loaded from the database.

The existing external verification integration tests were converted into smoke tests so that 4.11 nodes could be involved. This required various improvements to NodeProcess.Factory. A new JAVA_8_HOME environment variable, pointing to JDK 8, is required to run these tests.

There is still some follow-up work that needs to be done:

Sending transactions from a 4.11 node to a 4.12 node works, but not the other way round. A new WireTransaction component group needs to be introduced for storing 4.12 attachments so that they can be safely ignored by 4.11 nodes, and the 4.12 node needs to be able to load both 4.11 and 4.12 versions of the same contracts CorDapp so that they can be both attached to the transaction.
Even though attachments are cached when retrieved from the database, the Kotlin metadata version should be stored in the attachments db table, rather than being scanned each time.
Finally, VerificationService was refactored into NodeVerificationSupport and can be passed into SignedTransaction.verifyInternal, instead of needing the much heavier VerifyingServiceHub. This makes it easier for internal tools to verify transactions and spawn the verifier if necessary.
2024-01-22 11:31:51 +00:00
Shams Asari
2e63ca6264
ENT-11065: Remove the need for JVM flags in client code (#7635) 2024-01-03 11:22:03 +00:00
Shams Asari
406f7ff292
ENT-11056: Compile the external verifier using Kotlin 1.2 (#7622)
This requires Kotlin 1.2 versions of core and serialization (core-1.2 and serialization-1.2 respectively), which are just "shell" modules and which compile the existing source code with Kotlin 1.2. The 1.2 plugin does not work with the current version of Gradle and so the 1.2 compiler has to be called directly.

Now with two versions of Kotlin in the code base, each module needs to have its version manually specified to ensure a clean separation. Otherwise, the default Kotlin version can override 1.2 when needed.

Some of the code was tidied-up or improved to enable it to be cross-compiled. For post-1.2 APIs being used, they have been copied into core-1.2 with the same method signatures. OpenTelemetryComponent was moved to node-api, along with the dependency, to avoid also having a 1.2 version for the opentelemetry module.
2024-01-02 17:02:20 +00:00
Shams Asari
e2bcd0499e ENT-11263: Remove TooGenericExceptionCaught detekt rule 2023-12-07 13:36:21 +00:00
Shams Asari
11d0054fcc
ENT-11055: Basic external verification (#7545)
* ENT-11055: Basic external verification

Introduction of the external transaction verifier, a separate JVM process for verifying `SignedTransaction`s. The end goal is for this verifier to be built with Kotlin 1.2 so that it creates a compatible verification environment for transactions with 4.11 contracts. For now however the verifier is built against Kotlin 1.8, same as the node.

External verification is enabled when the the system property `net.corda.node.verification.external` is set to `true`. When enabled, all verification requests made via `SignedTransaction.verify` are sent to the external verifier, regardless of the transaction content. It will do the vast bulk of the verification and then send the result back, namely if an exception occurred. If it did, then it's re-thrown in the node.

The external verifier is a stateless process, with no connection to the node's database. All transaction resolution information needed to create the relevant ledger transaction object are made to the node, which waits in a loop servicing these requests until it receives the result. The verifier Jar is embedded in the Corda node Jar, and is extracted and run when needed for the first time. The node opens up a local port for the verifier to communicate with, which is specified to the verifier in the process command line. This all means there is no extra configuration or deployment required to support external verification.

The existing code had some initial attempts and abstractions to support a future external verification feature. However,
they were either incorrect or didn't quite fit. One such example was `TransactionVerifierService`. It incorrectly operated on the `LedgerTransaction` level, which doesn't work since the transaction needs to be first serialised. Instead a new abstraction, `VerificationSupport` has been introduced, which represents all the operations needed to resolve and verify a `SignedTransaction`, essentially replacing `ServicesForResolution` (a lot of the changes are due to this). The external verifier implements this with a simple RPC mechanism, whilst the node needed a new (internal) `ServiceHub` abstraction, `VerifyingServiceHub`. `ServicesForResolution` hasn't been deleted since it's public API, however all classes implementing it must also implement `VerifyingServiceHub`. This is possible to do without breaking compatibility since `ServicesForResolution` is annotated with  `@DoNotImplement`.

Changes to `api-current.txt` were made due to the removal of `TransactionVerifierService`, which was clearly indicated as an internal class, and returning `TransactionBuilder.toLedgerTransactionWithContext` back to an internal method.

* Address review comments

* One bulk load states method

* Merge fix
2023-12-07 11:29:27 +00:00
Tudor Malene
88c5ab8870 Feature/corda 1219/remove out of process verifier (#2820) 2018-03-15 09:57:59 +00:00
Anthony Keenan
577033441a
[CORDA-1035] Testing api KDoc Updates (#2584)
* Testing api KDoc Updates

* Update after code review

* Update api-current

* Revert changes to compiler.xml

* Made comment changes from review

* Fixing merge conflict

* Don't expose net.corda.node through test API (first pass)

* Fixing merge conflicts

* Update api-current

* Addressing review commits

* Fix exposure of internal implementation of MessageHandlerRegistration

* Make InProcess expose ServiceHub instead of internal StartedNodeServices

* Move InternalMockMessaginService interface to internal namespace

* Move MOCK_VERSION_INFO to internal namespace to avoid exposing VersionInfo

* Don't expose WritableTransactionStorage via testing api

* Create public VerifierType enum

* Update api-current and modify check-api-changes to check for net.corda.node exposures

* Fix merge conflicts

* Fixing another merge conflict

* Fix accidentally broken unit tests

* Make getInternalServices a property

* Fix failing unit tests

* Add todo to check-api-changes

* Fix rpc sender thread busy looping

* Fix tests

* Fixing tests

* Address mike's comments

* Fixing tests

* Make random port allocation internal

* Update api
2018-02-28 13:26:49 +00:00
Christian Sailer
a483e7e8ce
CORDA-1096 - Performance when loading multiple states from the vault (#2614)
* CORDA-1096 - Performance when loading multiple states from the vault (#2609)

* Provide efficient `loadStates()` implementation

* Replace loops using `loadState` with calls to `loadStates`

* Replace `map`/`flatMap` with just a single `flatMap`
2018-02-26 09:37:32 +00:00
Michele Sollecito
5be0e4b39e
[CORDA-941]: Add NetworkParameters contract implementation whitelist. (#2580) 2018-02-23 14:29:02 +00:00
Shams Asari
71c94f8a9d
Reversing the introduction of GlobalProperties (by CORDA-961), and added NetworkParameters to ServicesForResolution instead. (#2563)
Also, replaced the maxTransactionSize parameter of the driver and MockNetwork with NetworkParameters.
2018-02-19 12:23:59 +00:00
Maksymilian Pawlak
b91dd43a83
Test driver default parameters removal (#2519)
* Removed long parameter list in test driver, replaced with DriverParameters object
2018-02-13 13:15:05 +00:00
Anthony Keenan
7b65b7971a
CORDA-939 - Don't expose StartedNode and AbstractNode as part of public test api (#2472)
* Don't expose StartedNode via Node Driver

* Dont expose StartedNode/Abstract Node via MockNetwork

* Remove internal var from constructor as it doesn't hide from public api and change to internal initialisation method

* Update api

* Rename MockNode to StartedMockNode to avoid confusion
Update documentation
Update api-current.txt

* Fix typo

* Fix test failure

* Modify flow tests to use internal mock network and remove additional internal exposures from StartedMockNode

* Fix api-current

* Change InProcess and OutOfProcess to interfaces

* Explicitly declare MockNetwork parameters
Dont expose StateMachineManager
Move affected tests to use internal mock network

* Fix api-current

* Changes requested via review

* Fix IRS Demo address

* Fix api

* Remove internal attribute from classes in internal package

* Remove accidentally added code

* Move useHttps into NodeHandleInternal

* Remove duplicated code

* Update api-current

* Make webAddress internal on NodeHandle

* Make sure parameters in public api are explicitly specified

* Use correct address in IRS Demo

* Get webaddress from webserver handle

* Update api-current
2018-02-12 10:09:59 +00:00
Patrick Kuo
c8cf46c657
CORDA-961 Wire up and enforce max transaction size (#2465)
* wire up and enforce max transaction size

* fixup after rebase
moved network parameter from AbstractNode to NodeProperties

* removed TODO

* fix broken import

* address PR issues

* remove API breaking change
address PR issue

* added max transaction size to driver and mock network.
address PR issues

* fix failing test

* added TODO

* fix verifier test

* fix spring driver build error
2018-02-09 14:48:45 +00:00
Andrzej Cichocki
1902a4f11e
CORDA-973 Refactoring for serialization compression support (#2466)
* Use constant for empty byte array
* Less byte array copying
* Fix InputStreamSerializer trailing garbage
* More OO kryo streams
* Introduce SerializationMagic
* Introduce non-copying slice on ByteSequence
2018-02-09 11:54:07 +00:00
Andrzej Cichocki
1fc646cfa8 CORDA-716 Move test-utils and node-driver to stable API section in docs (#2335)
* Move test-utils and node-driver to stable section.

* Move FlowStackSnapshotFactory to testing.services package & update docs

* Move SerializationTestHelpers to testing.core package

* Move TestConstants.kt to core namespace

* Move Expect.kt to core namespace

* Move CoreTestUtils to core.TestUtils - rename class and update imports

* Added some clarification to documents after re-reading them

* Added static imports

* Removing unused import

* Fix merge conflict

* Fixing merge conflict
2018-01-22 11:28:41 +00:00
Shams Asari
730fec2eb4
Internal driver now also does the registration for the notaries. (#2304)
Using the --just-generate-node-info flag for the notary nodes so that their identities can be submitted to the network map server, which does the network parameters generation.
2018-01-02 15:12:30 +00:00
Alberto Arri
6db0490750
Fix node integration tests. (#2233)
* Add tests for node registration and communication
2017-12-21 11:48:00 +00:00
Andrzej Cichocki
c3b9955344
CORDA-716 Fix split packages in testing (#2232) 2017-12-12 19:37:01 +00:00
Andrzej Cichocki
905c8252a6
CORDA-654 Remaining key constants (#2226) 2017-12-12 18:03:06 +00:00
Shams Asari
6d6393d984 Merge branch 'feature-network-parameters' into shams-merge-feature-network-parameters 2017-12-11 21:10:34 +00:00
Katelyn Baker
4b5c60637c
Merge pull request #2017 from corda/kat/feature/enableAMQP
CORDA-780 - Enable AMQP for P2P and Storage Contexts
2017-12-11 11:37:16 +00:00
Shams Asari
249d8d1ac7 Further merge fixes 2017-12-11 10:42:50 +00:00
Shams Asari
d6054e4b4f Merge branch 'master' into shams-master-merge-081217
# Conflicts:
#	node/src/main/kotlin/net/corda/node/services/config/NodeConfiguration.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/driver/Driver.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/internal/DriverDSLImpl.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/internal/RPCDriver.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/internal/demorun/DemoRunner.kt
#	verifier/src/integration-test/kotlin/net/corda/verifier/VerifierDriver.kt
2017-12-11 10:23:16 +00:00
Shams Asari
41bfd7a971 Merge fixes 2017-12-10 20:15:33 +00:00
josecoll
4762569200
CORDA-822 - JMX Jolokia instrumentation (#2197)
* JMX Jolokia instrumentation WIP (driverDSL, webserver, cordformation, hibernate statistics, access policy config file hardening)

* Cordformation changes to support jolokia agent instrumentation at JVM startup.

* Minor updates to reflect usage of Jolokia 1.3.7 (which uses slightly different .war naming)

* Use relative path reference in -javaagent to prevent problem with long path names with spaces.

* Fixed incorrect regex pattern and added assertion to test.

* Enable JMX monitoring.

* Reporting of Hibernate JMX statistics is configurable (by default, only switched on in devMode)

* Make Artemis JMX enablement configurable.

* Re-instate banning of java serialization.

* Improve JUnit.

* Fixes following rebase from master.

* Re-instated correct regex for picking up Jolokia agent jar.

* Fixed broken integration test.

* Updated documentation

* Updated following PR review feedback.

* Fixed compilation error caused by change in DriverDSL argument type.

* Fixed compilation error caused by change in DriverDSL argument type.

* Fail fast if jolokia-agent-jvm.jar is not located.

* Applied changes in cordformation following review feedback from CA.
2017-12-08 16:27:12 +00:00
Shams Asari
65ff931f53 Merge branch 'master' into shams-master-merge-081217
# Conflicts:
#	node-api/src/main/kotlin/net/corda/nodeapi/internal/crypto/KeyStoreWrapper.kt
#	node/src/main/kotlin/net/corda/node/internal/AbstractNode.kt
#	node/src/main/kotlin/net/corda/node/services/config/ConfigUtilities.kt
#	node/src/test/kotlin/net/corda/node/services/identity/InMemoryIdentityServiceTests.kt
#	node/src/test/kotlin/net/corda/node/services/identity/PersistentIdentityServiceTests.kt
#	samples/irs-demo/src/integration-test/kotlin/net/corda/test/spring/SpringDriver.kt
#	testing/node-driver/src/integration-test/kotlin/net/corda/testing/driver/DriverTests.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/driver/Driver.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/driver/DriverDSL.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/internal/DriverDSLImpl.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/internal/NodeBasedTest.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/internal/RPCDriver.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/internal/demorun/DemoRunner.kt
#	testing/test-utils/src/main/kotlin/net/corda/testing/CoreTestUtils.kt
#	verifier/src/integration-test/kotlin/net/corda/verifier/VerifierDriver.kt
2017-12-08 16:03:16 +00:00
Shams Asari
db9eb8a63f Preliminary work to make merge with master manageable 2017-12-08 13:39:05 +00:00
Katelyn Baker
81eb0c1898 CORDA-780 / CORDA-786 - Enable AMQP for P2P and Storage Contexts
Add plugable mechanism for CorDapps such that they can add their own
custom serializers
2017-12-07 21:13:59 +00:00
Shams Asari
89256a7f16 Moved the CZ URL and node registration logic of the driver to be more internal, not available through the standard driver call, as these are not testing features for an app dev.
Also cleanup up some of the related tests.
2017-12-06 12:32:41 +00:00
Shams Asari
8461837f1a Cleaned up Driver.kt so that only the relevant bits are exposed as public API 2017-12-05 23:52:15 +00:00
Shams Asari
6a1aa59e3e Merge branch 'master' into shams-merge-master-041217
# Conflicts:
#	node/src/integration-test/kotlin/net/corda/node/services/DistributedServiceTests.kt
#	samples/bank-of-corda-demo/src/main/kotlin/net/corda/bank/BankOfCordaCordform.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/NodeTestUtils.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/driver/Driver.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/internal/NodeBasedTest.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/node/MockNode.kt
#	testing/node-driver/src/main/kotlin/net/corda/testing/node/NotarySpec.kt
#	verifier/src/integration-test/kotlin/net/corda/verifier/VerifierDriver.kt
2017-12-04 13:39:32 +00:00
Alberto Arri
acd2281b20
ENT-1125 bootstrap root certificate (#2151)
* ENT-1125 make nodes check that the returned signed certificate from Doorman has the expected root
2017-12-04 12:53:22 +00:00
Shams Asari
5264072752 Renamed n.c.nodeapi.config to n.c.nodeapi.internal.config as that config code is not public API. For the same reason, also moved User into the same internal package. 2017-12-03 17:20:30 +00:00
Patrick Kuo
cc1fba641e
Integration test for http network map service (#2078)
* make node info file copying optional by setting "compatabilityZoneURL" in driver
integration test for node using http network map using driver
some bug fixes

* rebase to feature branch and fixup

* add initialRegistration flag to driver

* remove useFileBaseNetworkMap flag, add network map server to DriverTest

* remove useFileBaseNetworkMap flag, add network map server to DriverTest

* use PortAllocation.Incremental instead of random

* * use PortAllocation.Incremental instead of random
* fix NodeInfoWatcher thread leak issue

* reset scheduler before create notary

* move port allocation out of companion object

* move port allocation out of companion object

* make node info file copier lateinit to avoid observable thread pool get created on init
2017-11-28 13:58:48 +00:00
Shams Asari
5cf7ecd9ed Merge branch 'master' into feature-network-parameters
# Conflicts:
#	testing/node-driver/src/main/kotlin/net/corda/testing/driver/Driver.kt
2017-11-21 15:01:52 +00:00
Alberto Arri
a13dbcaa5d
ENT-1069 Allow for nodes to be started in registration mode (#2065)
* ENT-1069 Allow for nodes to be started in registration mode
2017-11-21 09:59:56 +00:00
Andrzej Cichocki
f26aa33553
Introduce contextLogger (#2085)
* Revert with comment, probably lazy for a reason.
2017-11-20 11:31:08 +00:00
Andrzej Cichocki
039cacae76
CORDA-787 Remove unused class (#2049)
* and refactor a superclass that isn't really one
* move it to internal
* misc refactorings
2017-11-17 12:24:55 +00:00
Shams Asari
2fe41715cc On exit, the driver will automaticallly shutdown any nodes which weren't waited for.
The motivation for this came with the recent change that a default notary is started by the driver, which if ignored will leak the notary process.

Also, waitForAllNodesToFinish() has been replaced by a driver parameter.
2017-11-14 20:20:00 +00:00
Andrzej Cichocki
2d997b1fa7
Retire verifierDriver serialization init. (#2026) 2017-11-14 10:45:36 +00:00