Commit Graph

1919 Commits

Author SHA1 Message Date
Dan Newton
fc265ee472 CORDA-3018 Whitelisting attachments by public key - relax signer restrictions (#5358)
* CORDA-3018 Allow loading an untrusted contract jar if another attachment exists that was signed with the same keys and uploaded by a trusted uploader

`TransactionUtils.isAttachmentTrusted` requirements have been relaxed
to allow an untrusted attachment to be loaded as long as another
attachment exists that is signed by the same keys and was uploaded
by a trusted uploader.

The requirement of containing the same contract classes has been
removed. Therefore the contents of the existing trusted attachment
no longer matters.

* CORDA-3018 Allow a subset/intersection of signers in `isAttachmentTrusted`

Allow a subset/intersection of signers to satisfy the signer
requirements of `isAttachmentTrusted`. This allows an "untrusted"
attachment that is signed by one or more keys to be "trusted" as long
as another trusted attachment already exists that is signed by at least
one of the "untrusted" attachments signers.

A cache of trusted and untrusted public keys is now held (replacing the
previous cache of `List<PublicKey>`.

Tests have been added to `NodeAttachmentServiceTest` to confirm that
an attachment query using an `EQUAL` statement will actually return
attachments that are signed by any of the keys passed into the query.

Confirming this allowed an `EQUAL` query to satisfy the search that
had to be done as part of this change.

`MockAttachmentStorage`'s query criteria was updated to better match
the real `NodeAttachmentService` implementation.

* CORDA-3018 Update cache name and kdoc on `isAttachmentTrusted`

* CORDA-3018 Verify that chains of trust do not occur

* CORDA-3018 Switch keys around to improve chain of trust tests
2019-08-08 09:33:45 +01:00
James Higgs
44428b6048 ENT-3801 Backport to OS (#5355)
* [ENT-3801] Store transactions in the database during transaction resolution (#2305)

* ENT-3801: Store downloaded txns as part of the backchain resolution into the db rather than the checkpoint

It's very inefficient to store the downloaded backchain in the checkpoint as more of it downloaded. Instead, if a threshold is reached (which currently defaults at 0) then the backchain is stored in the transactions table as unverified. A new is_verified column has been added to track this. Initially testing on the OS codebase has been very promising but unfortunately this current code is not quite ready. I had to quickly port it to ENT as this is meant to be an ENT-only optimisation.

To that effect, there is a TransactionResolver abstraction with two implementations: an in-memory one which has the old behaviour, and which will be the behaviour for OS, and a db one.

DBTransactionStorage hasn't been fully updated and I had to comment out the optimistic path for now.

Most of these changes will need to be ported to OS to keep the merge conflicts in check, but obviously not DbTransactionsResolver and the "is_verified" changes in DBTransactionStorage. DBTransactionStorage does have other refactoring which will make sense to port though.

* [ENT-3801] Start work on allowing modifications in AppendOnlyPersistentMap

* [ENT-3801] Add transaction resolver tests

* [ENT-3801] Adjust suspendable annotations

* [ENT-3801] Fix the ResolveTransactionFlow tests

* [ENT-3801] Update ResolveTransactionsFlow tests

* [ENT-3801] Add a liquibase migration script for isVerified

* [ENT-3801] Ensure the migration runs in the correct place

* [ENT-3801] Handle resolution of already present transactions

* [ENT-3801] Fix compile error in performance test app

* [ENT-3801] Logging and comment updates, plus a test case

* [ENT-3801] Add a notary change resolution test

* [ENT-3801] Add a contract upgrade transaction test

* [ENT-3801] Change new column to be a character based status

* [ENT-3801] Migration script type change

* [ENT-3801] Address first round of review comments

* [ENT-3801] Update variable names in AppendOnlyPersistentMap

* [ENT-3801] Another variable name clarification

* [ENT-3801] Fix missing name changes

* [ENT-3801] Make the signature list immutable when constructing cache value

* [ENT-3801] Add a locking strategy for unverified transactions

* [ENT-3801] Address tidying up review comments

* [ENT-3801] First attempt at ensuring locks are released after commit

* [ENT-3801] Remove references to old cache name

* [ENT-3801] Update locking logic

* [ENT-3801] Fix potential deadlock with read/write transaction locks

* [ENT-3801] Remove read locks, and ensure minimal extra suspends

* [ENT-3801] Fix build issues in tests

* [ENT-3801] Use the correct clock when calculating sleep durations

* [ENT-3801] Add a pessimism flag for writing verified transactions

* [ENT-3801] Change logging statement to debug

(cherry picked from commit 8ab6a55e17)

* [NOTICK] Fix up imports for some changed files

* [NOTICK] Fix transaction resolution tests

* [NOTICK] Reinstate the DBTransactionsResolver

* [NOTICK] Add the topological sort back to recordTransactions

* [NOTICK] Adjust test case to remove dependency on query ordering

* [NOTICK] Make test code match that in ENT
2019-08-07 16:49:49 +01:00
Chris Rankin
813ff39eaa CORDA-3127: Move evaluationDependsOn() from core to core-tests. (#5349)
* CORDA-3127: Move evaluationDependsOn() from core to core-tests.

* Increase JVM memory for node unit tests to 3G.
2019-08-02 09:05:19 +01:00
Chris Rankin
d1289ec379 CORDA-2871: Restore CompositeKey support to core-deterministic. (#5333)
* CORDA-2871: Restore CompositeKey support to core-deterministic.

* Delete empty CordaSecurityProviderKt class from api-current.
2019-07-30 17:53:33 +01:00
LankyDan
9bf26c20e0 CORDA-2920 Hash to Signature Constraint automatic propagation
Allow Hash Constraints to propagate to Signature Constraints. When
propagating, the new jar is added to the transaction instead of the
original contract attachment (jar).

The following requirements must be met to do so:
- System property "net.corda.node.disableHashConstraints" must be set
  to `true`
- The min platform version must be 4 or greater
- There must be an input state with a hash constraint
- There must be no output states with a hash constraint
- The new jar must be signed

If these requirements are not met, the original Hash
Constraint will be kept and the contract attachment related to it is
also used.

This transition is done at the start of `handleContract` as it is not
the normal path a transition would follow. It is considered a backdoor
and should be treated separately from the rest of the attachment and
constraint logic. Furthermore, it will only work in private network
since all nodes must set the special `disableHashConstraints` flag.
2019-07-29 12:58:58 +02:00
Shams Asari
49cda57c81
AppendOnlyPersistentMapBase.allPersisted no longer loads everything into memory at once (#5286)
As a general purpose API, allPersisted should not be loading the entire contents of the database table into memory. Instead now it returns a Stream for processing of elements.
2019-07-10 18:09:02 +01:00
Christian Sailer
687fa81894 ETO-39 Move core tests (#5255)
* Moved core.flows and core.contract tests

* move internal tests

* move node, schemas and serialization tests

* Move transactions tests

* Move test access helper into test package

* Move remaining tests, and create access helpers to test internals.

* Fix test dependencies.

* Delete some cruft that flagged up on the API checker

* Add readme explaing where tests need to go.

* fix typo
2019-07-09 10:09:21 +01:00
gwr3com
933330bc4c CORDA-3028: Add Node Diagnostics Info RPC Call (#5271)
* CORDA-3028: Add Node Diagnostics Info RPC Call - Initial commit

* CORDA-3028: Add Node Diagnostics Info RPC Call - Changes after code review

* CORDA-3028: Add Node Diagnostics Info RPC Call - Additional code review update and documentation

* CORDA-3028: Add Node Diagnostics Info RPC Call - Additional changes to documentation

* CORDA-3028: Add Node Diagnostics Info RPC Call - Another change to documentation

* CORDA-3028: Add Node Diagnostics Info RPC Call - More changes to documentation

* CORDA-3028: Add Node Diagnostics Info RPC Call - Comment change
2019-07-08 14:43:50 +01:00
James Higgs
075f68f179 [CORDA-2086] Allow transactions to be re-recorded using StatesToRecord.ALL_VISIBLE (#5184) 2019-07-04 14:00:42 +01:00
Manoj
44835bd17c CORDA-2914: Allow certificate directory to be a symlink (#5102) 2019-07-03 10:39:40 +01:00
Stefano Franz
88894bc592
add a shared memory port allocator to allow multiple processes to sha… (#5223)
* add a shared memory port allocator to allow multiple processes to share a single allocation pool

* remove dangerous reset function on port allocator

* set forkCount = 2 in node integration test

* only allow one build of a cordapp at any given time for Driver tests

* make all portallocation requests use same starting point

* globally set forks to 6

* tweak forking parameters to allow parallel builds

* tweak unit test parallelism

* 2 workers for integrationTest

* some more tweaks for parallel builds

* some more tweaks for parallel builds

* seems that 49K is not the start of ephemeral ports on all kernels

* tweak parallel settings

* try fix RPC shutdown test in parallel env

* add some logging for RPC shutdown test

* added some logging around PortAllocation tests - try figure out where they are getting stuck

* added some logging around PortAllocation tests - try figure out where they are getting stuck

* fix api-scanner tests

* minimize api changes

* revert to complying with existing API

* add the AtomicInteger for api compatibility reasons

* make sizing script executable

* address review comments pt1

* address review comments pt2

* fix compile errors after review comments

* return to using home dir as temp dir seemed to interact badly with gradle
2019-07-02 18:38:33 +00:00
Shams Asari
2e02968c63
ENT-3496: dumpCheckpoints shell command (#5171)
Dumps all the node's checkpoints as JSON into a single zip file in the node's directory. The output contains:

* All the fields for the top-level flow
* The current sub-flow call stack, along with the current progress tracker step for each sub-flow
* The event that suspended the flow, which if it's a send or sendAndReceive will show the payload that was sent
* Low level information on the active sessions with other peers
2019-06-26 15:31:02 +01:00
Shams Asari
99bc614b7c Merge remote-tracking branch 'origin/feature/CID-878-non_party_flow_sessions' into shams-merge-cid-878 2019-06-21 16:46:41 +01:00
Shams Asari
76eec9aa8b
CORDA-3033: Introducing Destination interface for initiating flows with (#5242)
Party and AnonymousParty have been retrofitted to implement this interface and are currently the only supported types. A new FlowLogic.initiateFlow(Destination) method overload to easily support the addition of new destination types in future versions.
2019-06-21 16:39:56 +01:00
James Brown
ae877f87ba ENT-3142: net-params signing tool: include certificate path in signature (#5165) 2019-06-21 16:39:33 +01:00
Shams Asari
4e835d5483
CORDA-2333: Updated the majority of the dependencies that were out of date (#5235)
Some where not touched, including the crypto ones, libraries related to messaging and Kotlin.
2019-06-20 16:19:16 +01:00
Shams Asari
f0f05df9f4 Merge branch 'master' into feature/CID-878-non_party_flow_sessions
# Conflicts:
#	core/src/test/kotlin/net/corda/core/flows/CollectSignaturesFlowTests.kt
2019-06-18 13:14:55 +01:00
Stefano Franz
f9c034aa7c CORDA-3000: Allow AbstractParty to initiate flow (#5219) 2019-06-18 13:13:09 +01:00
Chris Rankin
632a3f4a7a CORDA-3015: Add StatePointer classes to corda-core-deterministic. (#5227) 2019-06-17 18:05:59 +01:00
Shams Asari
2152961d46
CORDA-2333: Dependency update pass for tests and demos (#5211) 2019-06-13 10:15:13 +01:00
Michal Kit
d72ec57c1c CORDA-2974 Fixing x500Prinicipal matching (#5186) 2019-06-11 16:07:52 +01:00
Shams Asari
d685c2154b
ENT-3489: Removing unnecessary @CordaSerializable annotation from exceptions (#5209) 2019-06-11 11:51:30 +01:00
LankyDan
a60d657c7c ENT-3496 Check in InternalCordaRPCOps that somehow got missed... 2019-06-11 09:20:36 +01:00
LankyDan
31a0c077b8 ENT-3496 Move dumpCheckpoints to the new InternalCordaRPCOps interface
To prevent making `dumpCheckpoints` part of the public API a new
interface, `InternalCordaRPCOps` has been created and the function
has been moved there. `InternalCordaRPCOps` inherits from
`CordaRPCOps`.

`CordaRPCOpsImpl` now implements `InternalCordaRPCOps`.

`RunShellCommand` and `StringToMethodCallParser` required additional
changes due to issues handling inherited functions. This has only been
raised now due to `InternalCordaRPCOps` inheriting from `CordaRPCOps`.

Many classes have had references to `CordaRPCOps` changed to
`InternalCordaRPCOps`.
2019-06-10 16:15:03 +01:00
josecoll
06db5973d5
Reduce test execution times by explicitly configure quasar package exclusions (#5161)
* Reduce test execution times by explicitly configure quasar package exclusions (using new quasar util extension introduced in Corda gradle plugins 5.0.1-SNAPSHOT).

* Remove SNAPSHOT from Corda gradle plugins version identifier.

* Incorporating PR review feedback from CR.

* Minor consolidation clean-up.

* Minor consolidation clean-up.

* Minor consolidation clean-up.
2019-05-30 10:09:11 +01:00
Tudor Malene
a4cd859282 Improve performance of the no-overlap check 2019-05-28 17:49:39 +02:00
Shams Asari
5619debf18 ENT-3496: dumpCheckpoints RPC
Dumps all the node's checkpoints as JSON into a single zip file in the node's directory. The output contains:

* All the fields for the top-level flow
* The current sub-flow call stack, along with the current progress tracker step for each sub-flow
* The event that suspended the flow, which if it's a send or sendAndReceive will show the payload that was sent
* Low level information on the active sessions with other peers
2019-05-24 17:28:36 +01:00
Shams Asari
71c316ca5a
CORDA-2954: Upgrade to common-lang3 (#5152)
Utilised Fields.getAllFieldsList where we were doing the equivalent
2019-05-21 17:48:32 +01:00
josecoll
0263650a5f
Revert "Merge pull request #5145 from corda/jdk11-migration-gradle5-upgrade" (#5146)
This reverts commit f46377556c, reversing
changes made to ba675e73b9.
2019-05-20 16:16:49 +01:00
josecoll
1a70646d02 Temporary remove Kotlin JUnit test that requires module directives to access private packages (sun.security.util, sun.security.x509)
Awaiting Kotlion compiler support: https://youtrack.jetbrains.com/issue/KT-20740
2019-05-20 15:08:27 +01:00
josecoll
877cbb1815 EXPERIMENTAL: tweaks and attempts to set module directives (with/without using gradle module plugin) 2019-05-20 15:08:27 +01:00
josecoll
cfd2661385 Move Java unit test into kotlin package to prevent ASM compilation/classloading error (REVISIT)
* What went wrong:
Execution failed for task ':core:test'.
> failed to read class file /Users/josecoll/IdeaProjects/corda-jdk11/core/build/classes/java/test/net/corda/core/flows/FlowsInJavaTest$PrimitiveReceiveFlow.class
2019-05-20 15:08:27 +01:00
josecoll
804f8dc17b Update Java Version checking. 2019-05-20 15:08:27 +01:00
josecoll
41b7916332 Move test Java schemas to Kotlin as they are used only by Kotlin JUnit test (was causing ASM compilation failure). 2019-05-20 15:08:27 +01:00
josecoll
7afd1e8b25 Move test Java schemas to Kotlin as they are used only by Kotlin JUnit test (was causing ASM compilation failure). 2019-05-20 15:08:27 +01:00
josecoll
a56ef580b2 Temp remove usage of java modularity plugin. 2019-05-20 15:08:27 +01:00
josecoll
594fca9d3f Add explicit reference to JAXB. 2019-05-20 15:08:27 +01:00
josecoll
ba675e73b9
CORDA-2893 Upgrade Corda to use Gradle 5.4.1 (Take 2) (#5137)
Upgrade Corda to use Gradle 5.4.1
2019-05-20 14:26:42 +01:00
Chris Rankin
b9f7c1a08a CORDA-2893, ENT-3422: Tweak JUnit 5 configurations to keep vintage engine off compile classpaths. (#5138)
* Tweak JUnit 5 configurations to keep vintage engine off compile classpaths.

* Configure Gradle tests to use JUnit 5.
2019-05-20 11:57:56 +01:00
josecoll
0eab42b63e
Revert "CORDA-2893 Upgrade Corda to use Gradle 5.x (#5063)" (#5135)
This reverts commit 88babefd89.
2019-05-17 11:11:05 +01:00
josecoll
88babefd89
CORDA-2893 Upgrade Corda to use Gradle 5.x (#5063)
* Upgrade gradle wrapper to Gradle 5.0

* Upgrade to use locally deployed version of Capsule plugin (using Gradle 5.0)

* Upgrade to use Corda Gradle Plugins 5.x (inclusive of Gradle 5.0 compatibility fixes)

* Fix compile-time problems resolving log4j packages.

* Update to use Artifactory deployed version of Capsule plugin (using Gradle 5.0)

* Upgrade to use Gradle 4.2.1 (excluding default memory setting change: command line client now starts with 64MB of heap instead of 1GB.)

* Added explicit compile-time dependency on 'de.jensd:fontawesomefx-commons:8.13' (compile-time error in tools:explorer without)

* Update "wrapper" gradleVersion to 5.4.1

* Update Capsule plugin version label to reference R3 forked build.

* Commit all gradle upgrade changes following: ./gradlew wrapper --gradle-version 5.4.1

* Increase maximum heap memory for Test tasks to 1GB, and upgrade build-scan plugin to 2.2.1.

* Increase Test tasks' maximum memory to 1.5GB - what could go wrong?

* Up maxHeapSize to 2g for gradle test runner (global setting).

* Added explicit compile-time dependency on 'de.jensd:fontawesomefx-commons:8.13' (compile-time error in tools:demobench without)

* Added forkEvery for node Unit tests.

* Up :node test task 'forkEvery' to 10.

* TC test execution tuning (:core, :node => forkEvery 10, default JVM heap size)

* TC test execution tuning (bump JVM heap size up to 1g for :node)

* TC test execution tuning (bump JVM heap size up to 1.5g for :node)

* TC test execution tuning (re-instate global JVM heap size of 1Gb)

* TC test execution tuning (re-instate JVM heap size of 2Gb for :node)

* Update Corda Gradle plugins to 5.0.0

* Updated plugin resolution order + renamed artifactory URL to use "software.r3.com"

* Reorder plugin resolution such that mavenlocal() is always queried first.
2019-05-17 10:36:21 +01:00
Dominic Fox
0b63157a4b ENT-3422 Add JUnit 5 dependencies to all projects (#5084)
* ENT-3422 Add JUnit 5 dependencies to all projects

* Remove explicit junit 4 imports where not needed

* Minor PR fixes

* Limit import scope
2019-05-15 16:40:12 +01:00
Dan Newton
6769b00ed5 CORDA-2892 Add a TransactionBuilder.addOutputState overload (#5104)
To allow better usage in Java, a new `addOutputState` overload has
been added.
2019-05-08 10:56:05 +01:00
Vardan Nadkarni
5a3073aeb1 Corrected a comment to use SchedulableState instead of QueryableState 2019-05-08 11:48:55 +02:00
JamesHR3
b4e96778bf [CORDA-2517] Whitelist attachments signed by keys that already sign existing trusted attachments (#5068)
This allows a different signed version of the same CorDapp to be automatically trusted.

This reverts "[CORDA-2575] Allow users to whitelist attachments by public key config (#5035)"
2019-05-07 12:55:27 +01:00
Tudor Malene
25f335861b Fix ClassNotFound handling (#5078) 2019-05-02 18:03:02 +01:00
Dan Newton
cb85dd1e92 CORDA-2477 Improve Signature Constraints documentation (#5041)
The Signature Constraint documentation in `api-contract-constraints`
was very limited and referred to the design doc for most information.
Information was extracted from the design doc and added to the main
documentation.
2019-04-30 11:50:12 +01:00
Dan Newton
6662d205f8 CORDA-2280 Automatic propagation of whitelisted to Signature Constraints (#5053)
If a single whitelisted constraint is being used by input states and the version of the cordapp changes + is signed, then the constraint will transition to a signature constraint.
2019-04-29 17:37:57 +01:00
JamesHR3
7a7c471ebf [CORDA-2575] Allow users to whitelist attachments by public key config (#5035) 2019-04-25 16:55:43 +01:00
Mario Schlipf
4607b0c151 CORDA-2817 Remove CORDA_VERSION_THAT_INTRODUCED_FLATTENED_COMMANDS as commands are not flattened anymore (#5056) 2019-04-25 16:54:56 +01:00