Commit Graph

125 Commits

Author SHA1 Message Date
Dan Newton
cd73161513 CORDA-2870 improve error messages for non composable types (#5120)
* CORDA-2870 Add `reason` and `remedy` to `LocalTypeInformation.NonComposable`

When creating `LocalTypeInformation.NonComposable` pass in the `reason`
a type was not composable and the `remedy` to fix it. This required
changes in `LocalTypeInformationBuilder` to pass in this extra
information so that it can be used later.

The message that the `ObjectSerializer` includes in its
`NotSerializableException` now includes the extra information about the
non composable type.

* CORDA-2870 Include custom serializers in serialization error message

In `ObjectSerializer`, when a serialization exception is thrown,
include the registered custom serializers + their classloaders as part
of the error message.

This required making properties on `CustomSerializerRegistry` and
`LocalSerializerFactory` public.

Tidy up `LocalTypeInformationBuilder` error message text for
transitive non-composable types.

* CORDA-2870 Tidy up error thrown for unserializable objects

Fix `DeserializeSimpleTypesTests` and tidy up the code in
`ObjectSerializer` a bit.

* CORDA-2870 Remove non-composable warning logs in `LocalTypeInformationBuilder`

The flag `warnIfNonComposable` and its corresponding log lines are not
needed now that the non-composable error messages contain a lot of
information in them.

The `warnIfNonComposable` flag is now incorrect and has been renamed to
`validateProperties` and the function `suppressWarningsAnd` has been
changed to `suppressValidation`.

`propertyDescriptors` has also had its input boolean changed to
`validateProperties` to better represent what it is doing.

* CORDA-2870 Remove need for casting by moving variable to interface

Expose `customSerializerNames` in `LocalSerializerFactory` and
`CustomSerializerFactory`.
2019-05-16 10:05:49 +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
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
Tudor Malene
25f335861b Fix ClassNotFound handling (#5078) 2019-05-02 18:03:02 +01:00
JamesHR3
7a7c471ebf [CORDA-2575] Allow users to whitelist attachments by public key config (#5035) 2019-04-25 16:55:43 +01:00
Dominic Fox
a416d5025f CORDA-2860 relax property type checking (#5028)
* CORDA-2860 relax property type checking

* Remove redundant check

* Unit test

* Comment linking ticket to test

* More descriptive comment

* Fix test that was broken by jacocoData field being silently added to class

* Revert to previous behaviour around opaques, suppress validation
2019-04-17 16:14:24 +00:00
Dominic Fox
2e97eaee0d CORDA-2848 relax fingerprinter strictness (#5001)
* CORDA-2848 relax fingerprinter strictness

* Unit test for non-serializable type parameter case
2019-04-11 15:42:56 +01:00
JamesHR3
9963a6609f CORDA-2633 Restructure evolution serialization errors to print reason first (#4978) 2019-04-08 17:04:02 +01:00
josecoll
add380b135
Merge pull request #4963 from corda/colljos-backport-secfix-serializer
(BACKPORT) ENT-3121 restrict custom serializers
2019-03-29 16:51:44 +00:00
Dominic Fox
c04a448bf3 CORDA-2782 allow un-whitelisted Comparable (#4940) 2019-03-29 15:24:08 +00:00
josecoll
864efe38d1 ENT-3440 Allow custom serializers that extend CordaThrowable. 2019-03-29 14:50:31 +00:00
Dominic Fox
17e7cd3abc ENT-3121 - restrict custom serializers (#1852)
* Tests for custom registry restrictions

* ENT-3121 restrict custom serialisation

* Remove redundant code

* Only count declared annotations

* Check annotation on superclasses, remove annotation from ByteArray

* Forbid custom serialization of primitive types

* Remove @CordaSerializable from another class that is always handled by custom serialisation

* Add log warnings to aid diagnosis of custom serialization issues

* Remove another annotation

* Remove another annotation

* Remove another annotation

* Remove another annotation

* Fixup api-current

* Fixup api-current

* KDocs on exceptions
2019-03-29 14:48:07 +00:00
Jonathan Locke
3e4a5976d8 Revert "CORDA-2782 Add Comparable to default whitelist for vault query criteria using comparables (#4920)"
This reverts commit 12e7897316.
2019-03-26 12:18:45 +01:00
josecoll
12e7897316
CORDA-2782 Add Comparable to default whitelist for vault query criteria using comparables (#4920)
* CORDA-2782 Add Comparable to default whitelist for vault query criteria using comparables

* Commit the java.lang.Comparable type.

* Fix broken unit test in serialization-deterministic
2019-03-25 11:59:39 +00:00
Dominic Fox
345a76d1cd CORDA-2742 treat boxed types as assignable from primitives (#4890) 2019-03-15 15:16:14 +00:00
Katelyn Baker
cfccfd075e
CORDA-2688 - Add Serialization Context option for no carpenting (#4849)
* CORDA-2688 - Add Serialization Context option for no carpenting

Can be used by the attachment class loader - Serialization Framework
will still consume all Exceptions and throw a NotSerializableException

* Fix tests
2019-03-04 17:44:56 +00:00
Dominic Fox
0984e87c5e CORDA-1947 - Regenerate test data and unignore test (#4838)
* CORDA-1947 Regenerate test data and unignore test

* Formatting
2019-03-04 13:45:14 +00:00
James Higgs
b52fdf0e0f Port the improved error message introduced in ENT-3068 to OS 2019-02-28 14:29:41 +01:00
Dominic Fox
6d5ccfaeac Explanatory comment on test 2019-02-27 13:12:32 +01:00
Dominic Fox
2173228b27 Unit test covering https://r3-cev.atlassian.net/browse/CORDA-2674 2019-02-27 13:12:32 +01:00
Dominic Fox
74c5b8d127 CORDA-2674 observe the true type of an atomic type 2019-02-27 13:12:32 +01: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
Dominic Fox
444ebb741b Test for non-strict factory behaviour 2019-02-14 09:59:22 +01:00
Dominic Fox
fac9b5368f Prevent non-null values from being discarded 2019-02-14 09:59:22 +01:00
Mike Hearn
02645f7b9e Rework package namespace ownership check to verify every package of every class file.
Previous implementation was in LedgerTransaction and focused only on contract classes,
but every package matters.

Also fixes some exception types and does misc refactorings.
2019-02-11 17:10:50 +01:00
Chris Rankin
329caa20b7
CORDA-2564: Ensure that corda-serialization uses @JvmDefault for interfaces. (#4725) 2019-02-08 17:20:40 +00:00
Rick Parker
7dc7313fb7
ENT-3000 Start pooling classpath scanning and related fixes (#4664)
* Start pooling classpath scanning

Quickly patch synchronisation of attachment class loader cache.  Needs a revisit but more complicated due to DJVM.

Annotate away for DJVM

Take ClassGraph utils into their own file so we can exclude for DJVM

Clean up a little

* Daemonize the threads

* Seems to be some concurrency problems with use of ClassGraph.  Using a mutex for now to work around.
2019-01-30 10:35:20 +00:00
Dominic Fox
d540aa5b17
ENT-2977 resolve custom serializers earlier (#4609)
* ENT-2977 resolve custom serializers earlier

* Remove unnecessary import

* Cache hot serialisation paths

* Remove blank line
2019-01-24 11:31:51 +00:00
Rick Parker
197a13611d
ENT-2967 Fix up use of various JDK performance contention points (#4608)
* ENT-2967 Various JDK contention points

* Move new private method to bottom of class.
2019-01-22 11:19:51 +00:00
Dimos Raptis
e5d00cf85e
Remove unneeded SerializationEnvironmentRule from amqp test (#4604) 2019-01-21 12:06:21 +00:00
Shams Asari
f592025273 Regen isolated jar to fix failing test(s) (#4583)
https://github.com/corda/corda/pull/4541 removed TransactionBuilder c'tor (which was introduced post-V3) which the frozen isolated jar was using
2019-01-15 14:56:57 +00:00
Michele Sollecito
05ffb3d101
CORDA-2403: Flagged API issues between 4.0 and 3.3. (#4541) 2019-01-15 14:27:29 +00:00
Shams Asari
3b8347e150
Fixed AttachmentLoadingTests (#4565)
There were two issues:
* The original "sealing violation: can't seal package net.corda.nodeapi" issue was due to the isolated CorDapp containing some code in the net.corda.nodeapi namespace. This has been moved to the isolated namespace.
* The test was not correctly creating the second transaction with the dummy command
2019-01-14 14:32:14 +00:00
Dimos Raptis
5b34020e59 [CORDA-2390] - Add whitelists and custom serializers from cordapps to serialization … (#4551)
* Add whitelists and custom serializers from cordapps to serialization context

* Remove changes in TransactionBuilder, add caching

* Add whitelists and custom serializers from cordapps to serialization context

* Remove changes in TransactionBuilder, add caching

* Address comments

* Increase node memory for SIMM integration test

* Cache only serialization context

* Increase integ test timeout

* Fix API breakage

* Increase max heap size for web server integ test

* Move classloading utils from separate module to core.internal

* Adjust heap size for more integ tests

* Increase time window for IRS demo transactions

* Fix determinator

* Add parameter in core-deterministic

* Stub out class-loading method for DJVM
2019-01-13 20:15:05 +00:00
josecoll
e32ead0548
CORDA-2413 Improve exception handling and recovery for untrusted contract attachments (#4543)
* Improve exception handling and recovery for untrusted contract attachments.

* Fix broken JUnit.

* Fixed incorrect Exception description.

* Additional clarification on flow processing.

* Reasoning and future deterministic JVM clarification.

* Note::

* UntrustedAttachmentException.
2019-01-11 13:23:51 +00:00
Lorenz aka Lolo Hänggi
ef1462ee5e documentation adapted for OptionSerializer (#4522) 2019-01-08 11:07:59 +00:00
Florian Friemel
a1a5a429cb
[CORDA-2364] Make the class carpenter for RPC lenient by default. (#4467) 2019-01-02 17:18:31 +00:00
Shams Asari
b4c3fa1948
Fixed incorrect attachment loading integration test (#4453)
* Fixed incorrect attachment loading integration test

`AttachmentLoadingTests.test that attachments retrieved over the network are not used for code` was a false-positive - it was incorrect on multiple levels. Fixing it required updating the finance:isolated CorDapp, at which point it was given the new MANIFEST metadata for V4, and moved out of the net.corda.finance namespace to avoid package sealing issues.

The new test exposed a bug in the LedgerTransaction verification logic. This was cleaned up as it was too easy to verify on the wrong instance.
2018-12-31 15:02:11 +00:00
Shams Asari
830959c9f7
CORDA-2345: Simplified TestCordapp to make it inline with the recent CorDapp versioning changes (#4434)
TestCordapp has now two implementations to clearly separate the two use cases it has in the Corda repo:

* TestCordappImpl which implements the revised public API of TestCordapp; namely that a TestCordapp instance references a real CorDapp jar on the classpath. This is either an external dependency jar in which case it’s taken as is and given to the node, or it’s a local gradle project in which case it’s compiled using the gradle “jar” task to generate the CorDapp jar. This approach means the jar has all the original CorDapp versioning information, which is important that it’s correct when testing. To this end, TestCordapp only needs to expose the ability to specify the app’s config. All the remaining properties have moved to CustomCordapp.

* CustomCordapp for creating arbitrary custom CorDapps, including specifying the jar’s MANIFEST values. This is internal API and only used for testing the platform. Technically this shouldn’t implement TestCordapp but does so to reduce the complexity of the driver and mock network.
2018-12-20 09:49:58 +00:00
Dominic Fox
9d8618224a
CORDA-2352 Be more lenient with setter property signature validation (#4442) 2018-12-19 17:17:01 +00:00
Florian Friemel
466bff4121
Revert "[CORDA-2330] Turn on lenient mode in rpc serialization context. (#4409)" (#4439)
This reverts commit 58b0cdaef7.
2018-12-19 13:18:36 +00:00
Florian Friemel
58b0cdaef7
[CORDA-2330] Turn on lenient mode in rpc serialization context. (#4409) 2018-12-17 15:33:25 +00:00
Dominic Fox
c1d005ff21
CORDA-2318 resolve type variables recursively (#4414)
* Resolve type variables recursively

* Clarify test

* Formatting
2018-12-17 09:40:09 +00:00
Dominic Fox
858301abae
CORDA-2318 resolve nested type params (#4405)
* Test nested generics case

* Recursively resolve type parameters

* Comment and ensure type variables are resolved

* Only upper-bounding needs to be done recursively
2018-12-13 10:11:43 +00:00
Dominic Fox
ed3bc27501
CORDA-2313 Add test for (de-)evolution where new parameter is of unknown type (#4406) 2018-12-12 16:17:20 +00:00
Rick Parker
85102fa0e5
ENT-2848 Put some caching back into serialization transforms lookup. (#4397)
* Attempt to put some caching back into transforms lookup.

Cleanup for PR after testing.

* Match spacing in OS.

* Avoid checking two caches.
2018-12-11 13:47:06 +00:00
Dominic Fox
c554b33ff6 CORDA-2227 Emit java.lang.Object, not *, in TypeNotation (#4387) 2018-12-07 21:57:10 +00:00
Shams Asari
b020e602ba
Fingerprint for Exception class reverted to V3 (fixes CORDA-2227 & CORDA-2292) (#4386) 2018-12-07 18:57:51 +00:00
Dominic Fox
6d9f03795e
CORDA-2227 Change ? to java.lang.Object in type notation for Any (#4380)
* Change ? to * in type notation for Any

* Strings are atomic

* Revert test
2018-12-07 13:34:05 +00:00