Commit Graph

636 Commits

Author SHA1 Message Date
James Higgs
101d978050 [CORDA-3149] Update cache to check node identity keys in identity table (#5371) 2019-08-19 20:03:51 +01:00
Shams Asari
69d1b4e4e5
CORDA-3138: Removed InMemoryTransactionsResolver as it's not needed and other resolution cleanup (#5370) 2019-08-16 12:34:25 +01:00
James Higgs
72ac722451 [CORDA-3130] Add a cache for looking up external UUIDs from public keys (#5357) 2019-08-14 13:24:56 +01:00
Viktor Kolomeyko
6db3ded032 CORDA-3139: Cater for port already bound scenario during port allocation (#5361)
* CORDA-3139: Cater for port already bound scenario during port allocation

Also moved `SharedMemoryIncremental` into a separate file as it getting bigger
and improved readability of logic and added some logging.

* CORDA-3139: Fix the unit test

* CORDA-3139: Improve logging when failing

* CORDA-3139: Improve stability of the test
2019-08-12 10:38:15 +01:00
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
josecoll
b4749eb8f9
CORDA-2991 (Cont): set node info polling interval to 1 second in DriverDSL Node Startup (#5285)
* Fix test execution flakiness on fast hardware: set node info polling interval to 1 second in DriverDSL Node Startup (was only being set to 1 sec in Node Registration). Follow-up to https://github.com/corda/corda/pull/5240

* Diagnostics: add additional logging to NodeInfoFilersCopier.

* Diagnostics: add additional logging to NodeInfoWatcher

* Downgrade logging level severity to debug.

* Make atomic counter unique across instances.
2019-07-17 14:48:46 +01:00
Matthijs van den Bos
af44dfa309 Fix API stability issue 2019-07-17 13:24:04 +02:00
Matthijs van den Bos
164079e3a2 Maintain API stability for MockNetworkNotarySpec constructor 2019-07-17 13:24:04 +02:00
Matthijs van den Bos
100457afc0 Add MockNet support for custom Notary class 2019-07-17 13:24:04 +02:00
Stefano Franz
359552f30c disable multiprocess port allocation test on windows due to it being unable to handle long command lines (#5273) 2019-07-10 13:52:46 +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
Dominic Fox
14a20654bd CORDA-2991 shorten poll intervals for node info file propagation (#5240)
* CORDA-2991 shorten poll intervals for node info file propagation

* Relax minimum poll time constraint

* Relax, not comment out, minimum poll time constraint

* Correct error message
2019-07-03 15:00:55 +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
fowlerrr
ffe328c604 CORDA-2720: Refactor NodeConfiguration out of NodeRegistrationHelper (#5181) 2019-06-27 16:56:03 +01:00
Stefan Iliev
d1e7850dd1 CORDA-2176 - test that logging is not broken. (#5224)
* Initial commit with a test that can detect a logger that isn't initialised with by lazy that gets called during startup.

* Test improvement. Test fix for api stability.

* Added explanatory comment for the test.

* Changes according to PR review. Added empty file check to make test more robust.
2019-06-25 14:35:39 +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
Dominic Fox
f01f8a129e ENT-3444 create test-db module (#5093)
* ENT-3444 define RequiresDB annotation and junit5 extension

* Move to internal

* info to trace

* Limit exposure of gradle imports

* Enable annotation inheritance, and multiple SQL scripts per class or method

* Get the test context class globally for all groups

* usingRemoteDatabase flag
2019-06-18 10:57:20 +01:00
Shams Asari
df19b444dd
CORDA-2333: Reverting jersey and mockito as it currently causes issues with ENT (#5228) 2019-06-17 19:27:35 +01:00
Shams Asari
2152961d46
CORDA-2333: Dependency update pass for tests and demos (#5211) 2019-06-13 10:15:13 +01:00
Shams Asari
8480d49e7e
CORDA-2333: Bumped ClassGraph version to latest (#5214) 2019-06-12 13:27:51 +01:00
Rick Parker
0c0101948b
CORDA-2981 Disable slow consumers for RPC since it doesn't work. (#5194)
* CORDA-2981 Disable slow consumers for RPC since it doesn't work.
2019-06-05 11:47:38 +01:00
Tudor Malene
a4cd859282 Improve performance of the no-overlap check 2019-05-28 17:49:39 +02:00
Rick Parker
d6ac4e2393
CORDA-2838 Set Artemis memory config. (#5011)
* CORDA-2838 Set Artemis memory config.

* CORDA-2838 Cannot have page size larger than max size.

* CORDA-2838 Use real slow consumers.  Need to see if the old config settings can work with a global limit to avoid this.
2019-05-23 14:30:11 +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
a7966e6176 Fix attempt to access boot classpath from runtimeMXBean (in JDK9+) 2019-05-20 15:09:36 +01:00
josecoll
2595dacd7e Fix quasar path for run-time agent instrumentation. 2019-05-20 15:09:36 +01:00
josecoll
077a2f5af6 Remove usage of deprecated URLClassloader (re-coded without scanning and pattern matching on run-time classpath URLs) 2019-05-20 15:09:36 +01:00
josecoll
2f3900140c Move Java unit test into kotlin package to prevent ASM compilation/classloading error (REVISIT) 2019-05-20 15:08:27 +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
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
James Brown
ee3befcc6e ENT-3543 Update okhttp dependency (#5089) 2019-05-15 10:54:44 +01:00
Dimos Raptis
a468bee0ed [CORDA-2473] - Remove AMQP system property (#5112) 2019-05-14 13:22:22 +01: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
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
JamesHR3
7a7c471ebf [CORDA-2575] Allow users to whitelist attachments by public key config (#5035) 2019-04-25 16:55:43 +01:00
Tudor Malene
6771386b4b CORDA-2743 - utilities and test to show rpc operations that support disconnects (#5009) 2019-04-12 14:03:38 +01:00
Adel El-Beik
367c98ec7c ENT-3482: Move BC crypto service implementation to node api. (#5008)
* ENT-3482: Move BC crypto service implementation to node api.

* ENT-3482: Added missing unit test.
2019-04-12 11:35:12 +01:00
Stefan Iliev
e4615f7f47 CORDA-2586 explorer exception handling (#4957)
* Initial version of new(old) dialog that won't print a stacktrace for rpc exceptions.

* Decoupled CordaVersionProvider. Moved common files to common-logging to lower dependencies on the node explorer.

* Removed unused import and duplicate documentation comment.

* Moved error code rewrite policy in the new common/logging module according to PR review.

* Removed extra line.

* Updated log4j configurations with new package name where logging policies will be contained.

* Included common-logging module with cliutils.
2019-04-09 19:14:37 +00:00
Dominic Fox
c2ad64ccde CORDA-2802 use eventually to wait (#4932)
* CORDA-2802 use eventually to wait

* Catch Exception, not Throwable
2019-03-26 16:01:06 +00:00
Jonathan Locke
dc179d4ea1 ENT-3057: Log hibernate warns and errors in different log (#4889)
* ENT-3057: Log hibernate warns and errors in different log

If a hibernate error occurs (deadlock, for example) that would cause a flow to be sent to the hospital, hibernate logs the warnings and errors before we do. This results in duplication in the logs, and pollutes the log. To solve this, we create a new log appender named diagnostic-{node-name}.log and log any org.hibernate messages of warn and above to that file. This way, messages are not lost, which means that the information can be retrieved if need be.

* Corrected indentation of comment (changed tab to space)

* Updated node-administration document to mention diagnostic logging change

* Fixed integration test. It was breaking because it was fetching the first log file in the folder, assuming there would be only one. This assumption is now invalid because the diagnostic log file that was introduced. Two tests were found that used similar logic to find a log file to examine, hence both were corrected to look for log files beginning with "node"

* Updated documentation as per review comments.
2019-03-18 17:08:13 +00:00
Chris Rankin
1fc8e1d7ae CORDA-2759: Use GlobalTestPortAllocation for Node's integration tests. (#4899) 2019-03-18 14:48:13 +00:00
Chris Rankin
92308021bf CORDA-2629: Configure smoke-test nodes to have validating notaries. (#4881) 2019-03-12 18:32:07 +00:00
Chris Rankin
ea263b3e54 CORDA-2569: Add "flow kill <ID>" command to Corda's shell. (#4861)
* CORDA-2569: Add "flow kill <ID>" command to Corda's shell.

* Add testing and documentation for RPC killFlow operation.
2019-03-08 16:39:22 +00:00
Shams Asari
96b23eea6f
ENT-3266: Do not attempt to overrwite an existing CorDapp jar in tests (#1906) (#4858)
There's a bug with the ServiceLoader which leaks a file handle to the app jar on shutdown. This causes an issue if a mock node is restarted in Windows. To avoid the problem completely we no longer overwrite any existing jars, as the jar to be copied will be same anyway.

(cherry picked from commit 0038a86481)
2019-03-07 11:40:43 +00:00
Andrius Dagys
9d04eccc8a CORDA-2668 - TestCordapp – minor refactoring in jar building (#4805) 2019-02-22 18:26:40 +00:00
Andrius Dagys
b52c7a09a3 CORDA-2668 - TestCordapp – use Gradle tooling API for builds (#4794)
TestCordapp – disable daemon on internal gradle process

The TestCordappImpl runs gradle to build cordapp jars required for tests.
The started gradle process reuses a Gradle daemon that's potentially already
used for running the tests causing the JVM to die with SIGBUS.
2019-02-22 16:48:28 +00:00
JamesHR3
efabab35c4 [CORDA-2636] Ensure states created with contract upgrades can be migrated (#4786)
* Ensure states created with contract upgrades can be migrated

* Remove line from api-current.txt representing an uncallable constructor
2019-02-19 09:48:39 +00:00
Tudor Malene
3d362e066c CORDA-2595 - check that all attachments are trusted before loading (#4763)
CORDA-2595 - Fix test and api.

CORDA-2595 add test

CORDA-2595 fix tests

CORDA-2595 fix test and address code review comments

CORDA-2595 address code review comments
2019-02-15 17:33:14 +00:00