Commit Graph

164 Commits

Author SHA1 Message Date
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
Michele Sollecito
7b65ab3410
Fixed master. (#4375) 2018-12-06 11:59:25 +00:00
szymonsztuka
d2d13c1dfc
Attachment query with contract version, related to CORDA-2150, CORDA-2157 (#4357)
TransactionBuilder loads attachment using attachment storage instead of CordappLoader,
contract class version is now Integer (format and stored in db as Integer).
2018-12-06 11:28:53 +00:00
josecoll
63e326aedb
CORDA-2157 - Hash to Signature constraints migration V2 (#4261)
* Hash to signature constraints migration #1

* After rebase from Attachments Classloader commit.

* Simplified implementation without CZ whitelisting and relaxing the no-overlap rule slightly.

* Further simplification.

* Detailed implementation.

* Use fully loaded Cash contract jar for hash to signature constraints migration test.
Additional debug logging.

* Minor cleanup.

* Address PR review feedback.

* Minor fix.

* Fixes following rebase from master.

* Implemented `calculateEntriesHashes` to improve classloader validation performance.

* Address minor PR review comments.

* Added integration tests and some minor fixes.

* Minor fixes following rebase from master.

* Updates and fixes following integration testing.

* Added changelog entry.

* Fix broken unit tests.

* Fix compilation errors in DriverDSL tests after rebase from master.

* Minor fix to test cordapp jar signing using explicit keystore.

* Run hash-to-signature constraints integration test out of process using a non-validating notary.

* Address PR review feedback: contract version from database + other minor changes.

* Address final PR review feedback: remove signed attachment field from attachmentWithContext

* Resolve conflicts following rebase from master.

* Fix failing junit test.

* Fix Kryo serialization error (forgot to write new `version` identifier field)

* Removed redundant query carried over from previous commit.

* Added documentation.

* Fix test case where explicit Hash Constraint input and Signature Constraint output explicitly configured.

* Addressing PR review comments from SA.

* AttachmentQueryCriteria API: added wither methods and Java Unit tests.

* Fixed compilation error caused by Unit tests being in wrong module.

* Added @CordaInternal to canBeTransitionedFrom function.

* Minimized AttachmentClassloader overlap duplicates checking.

* Moved JarSignatureTestUtils and ContractJarTestUtils to internal pending clean-up and documentation before public release.

* Minor fix following rebase from master.

* Removed redundant checkNotNull(networkParameters) checks now that these are always passed into the main (non-deprecated) constructor.

* Remove capitalization.
2018-12-04 18:45:29 +00:00
Dominic Fox
36c5b0cbae
CORDA-2264 enable appending enum constants (#4347)
* CORDA-2264 enable appending enum constants

* Remove paths B and C, rename test
2018-12-04 11:27:43 +00:00
Dominic Fox
c2986ca31d
CORDA-1497 replace missing validation (#4349) 2018-12-04 10:11:07 +00:00
Dominic Fox
be16603edf
CORDA-1497 enum evolution (#4343)
* Get enum transforms during type info building

* Eliminate transforms cache

* Allow combined renaming and defaulting for enums

* Comments and moving build method to EnumTransforms

* Force validation on EnumTransforms creation

* Remove commented code

* Cope with multiple renames
2018-12-03 13:44:23 +00:00
Dominic Fox
da6059d29d
CORDA-2284 Normalise constructor-paired property name to constructor parameter name (#4339) 2018-12-03 13:02:07 +00:00
Tudor Malene
66e097b58d
CORDA-2147 Use serialization strict mode during transaction verification. (#4312)
* CORDA-2147 Use serialization strict mode during transaction verification.

* CORDA-2147 Address code review comments.

* CORDA-2147 Fix compilation error.
2018-11-30 09:44:41 +00:00
Dominic Fox
488f11e2e6
CORDA-2263 evolve types with calculated properties (#4314)
* CORDA-2263 evolve types with calculated properties

* Push handling of computed properties into builders

* Set isAccessible to true prior to calling

* Type information captures Java constructor, not Kotlin wrapper
2018-11-29 15:54:30 +00:00
Dominic Fox
34f581854b
CORDA-2266 match old fingerprinter on Any type (#4319)
* CORDA-2266 treat Top differently from Unknown, to match old fingerprinter

* Add unit test covering the bug
2018-11-29 09:41:03 +00:00
Dominic Fox
68145e16de
CORDA-2255 suppress warnings on read-only properties (#4307)
* CORDA-2255 suppress warnings on read-only properties

* Avoid creating copies of LocalTypeInformationBuilder

* Disambiguate complex elvis expression
2018-11-28 16:39:54 +00:00
Tudor Malene
06ebb97a31
Fix cache races. (#4311) 2018-11-27 16:36:02 +00:00
Tudor Malene
e4c1db4db6
CORDA-2248 Remove spring boot hack. (#4305)
* CORDA-2248 Remove spring boot hack.
2018-11-27 13:39:54 +00:00
Dominic Fox
c533e0ab0c CORDA-2255 reduce noise from serialisation warnings (#4299)
Suppress warnings when constructing NonConstructible types that are wrapped by Opaque, and reduce warning level to info. Construct wrapped LocalTypeInformation for Opaque types immediately, rather than deferring with a thunk.
2018-11-26 20:28:18 +00:00
Dominic Fox
766681c0e7
Avoid constructing a lookup/builder if the type is already cached (#4294) 2018-11-26 13:48:32 +00:00
Dominic Fox
81905c67ea CORDA-1825 user-friendly error when serializing non-composable types (#4290)
* CORDA-1825 user-friendly error when trying to serialize non-composable type

* Tests for @CordaSerializable
2018-11-25 11:25:31 +00:00
Tudor Malene
4c8dabc288
ENT-2506 restore the attachment party signers (#4255)
* ENT-2506 restore the attachment party signers

* ENT-2506 restore the attachment party signers

* ENT-2506 restore the attachment party signers

* ENT-2675 Address code review changes.

* ENT-2675 Address code review changes.
2018-11-22 18:35:30 +00:00
Dominic Fox
2c6bce3e5d
CORDA-2099 serialisation rewrite (#4257)
* Type model first draft

* Introduce TypeIdentifier

* Attempting to retrofit fingerprinter with type model

* Complete retrofitting typemodel to fingerprinter

* Ensure component types are resolved correctly

* Fixes and tests

* Move resolveAgainst to TypeIdentifier

* Remote type modelling and reflection

* Convert TypeIdentifiers back into types

* Translate AMQP type strings to type identifiers

* Start replacing DeserializedParameterizedType

* Start roundtripping types through AMQP serialization

* Comments on type modelling fingerprinter

* kdocs and interface reorganisation

* Lots and lots of kdocs, bugfix for cyclic references

* Separate SerializerFactory construction from concrete implementation

* Fewer build methods

* Method naming that doesn't fatally confuse determinisation

* Extract SerializerFactory interface

* Reset to master's version of compiler.xml

* Un-ignore flickering test

* Enums don't have superclasses

* Break out custom serializer registry

* Refactor to separate remote and local serializer factories

* Shrink interfaces

* Further interface narrowing

* Fingerprinting local type model

* LocalSerializerFactory uses LocalTypeInformation

* Resolve wildcards to their upper bounds

* Actually cache custom serializers

* Fix various bugs

* Remove print statements

* There are no cycles in type identifiers

* Drive class carpentry from RemoteTypeInformation

* Refactor and comment

* Comments

* Comments and pretty-printer extraction

* Format long methods with braces

* Serialise composable types using LocalTypeInformation

* Warnings if a type is non-composable

* Rename lookup -> findOrBuild

* Evolution serialisation (no enums yet)

* Eliminate old ObjectSerializer and evolver

* Enum evolution

* Opacity claims types less greedily

* Fix type notation and type erasure bug

* Clean up unused code paths

* Delete unused codepaths

* Move whitelist based type model configuration to own file

* Move opaque type list

* Make all evolution serialisers in one go when schema received

* Minor tweaks

* Commenting and tidying

* Comments

* Rebase against master

* Make flag for controlling evolution behaviour visible

* propertiesOrEmptyMap

* Restore error messages

* Test for CORDA-4107

* PR fixes

* Patch cycles in remote type information after creation

* Fix line breaks in unit test on Windows

* This time for sure

* EvolutionSerializerFactoryTests

* Fix some pretty-printing issues, and a carpenter bug

* PR fixes

* Clarify evolution constructor ordering

* Remote TODO comment, which has been moved to a JIRA story
2018-11-22 11:44:40 +00:00
Dominic Fox
227f5c7e7c
Fix unit test failure due to Windows end-of-line characters (#4271) 2018-11-21 15:56:56 +00:00
Dominic Fox
ddf45f4e07
CORDA-2099: define local type model (#4118)
* CORDA-2099 define LocalTypeInformation and related data types and functions

* Enums don't have superclasses

* Separate ACollection from AMap

* Remove spurious import

* Small fixes, slightly improved testing

* Log warnings if types that we expect to be able to serialise are non-composable

* Rename lookup -> findOrBuild

* Pull changes from working branch

* Missing files needed for unit test

* Pull in whitelist-based type model configuration

* Move opaque type list across

* Remote duplicate declaration

* Restore fixes from other PR
2018-11-19 16:07:01 +00:00
Tudor Malene
2d043828a0
CORDA-2083 verify transaction in AttachmentsClassloader (#4188)
CORDA-2083 fix tests

CORDA-2083 fix tests

CORDA-2083 fix tests

CORDA-2083 fix tests

CORDA-2083 fix tests

CORDA-2083 fix tests

CORDA-2083 fix tests

CORDA-2083 add support for explicit upgrade transactions

CORDA-2083 cleanup

CORDA-2083 cleanup

CORDA-2083 More cleanup

CORDA-2083 More cleanup

CORDA-2083 Clean up tests

CORDA-2083 Address code review comments

CORDA-2083 Fix merge

CORDA-2083 Fix merge

CORDA-2083 Address code review comments

revert file

CORDA-2083 Fix test

CORDA-2083 Add test

CORDA-2083 cleanup

CORDA-2083 Fix test

CORDA-2083 Address code review comments.

CORDA-2083 Remove unused functions.

CORDA-2083 Address code review comments.

CORDA-2083 Address code review comments.

CORDA-2083 Address code review comments.

CORDA-2083 Address code review comments.

CORDA-2083 Address code review comments.
2018-11-19 13:42:12 +00:00
Mike Hearn
38a4737764 Small tweaks useful for the experimental C++ support. 2018-11-19 12:37:31 +00:00
Mike Hearn
a867e7cb8b Bugfix: make decimal64 amqp type work (nothing uses it today) 2018-11-19 12:37:31 +00:00
Dominic Fox
f66944cac5
CORDA-2099 remote type model (#4179)
* CORDA-2099 create remote type model

* Comments

* Test the class-carpenting type loader

* Comment on cache usage

* Pull changes from main serialisation branch

* Add missing file

* Minor tweaks
2018-11-19 11:03:32 +00:00
Stefano Franz
8f463c46a9 Add message to uses of require(...) (#4192) 2018-11-16 17:13:55 +00:00
Michele Sollecito
dc62b20c5d
[CORDA-1879]: Ensure Node dies on unrecoverable errors. (#4213) 2018-11-12 15:56:04 +00:00
Dominic Fox
f3b372d31d
CORDA-2099 make serializer factory interface (#4137)
* Separate SerializerFactory construction from concrete implementation

* Fewer build methods

* Method naming that doesn't fatally confuse determinisation

* Extract SerializerFactory interface

* Reset to master's version of compiler.xml

* Un-ignore flickering test

* Remove unnecessary build method

* Whitespace

* Unused import

* Change build method

* Formatting fixes

* Fix test
2018-11-07 13:48:45 +00:00
Rick Parker
13815d252e
ENT-2659 Eliminate lots of contention in serialization (#4120)
* Remove most contentious bit of mutex in the codebase
Fix up SerializerFactory
Make getSerializerFactory() non-blocking
Workaround for DJVM issues

* Some clean up and also de-contend the RPC client.

* Fix up attachment class loader code.

* Bug fix
2018-10-30 15:26:46 +00:00
Tudor Malene
391c6bf66f
Feature/corda 1947/add package ownership (#4097)
* Upgrade hibernate and fix tests

CORDA-1947 Address code review changes

CORDA-1947 Address code review changes

(cherry picked from commit ab98c03d1a)

* ENT-2506 Changes signers field type

ENT-2506 Clean up some docs

ENT-2506 Fix tests and api

ENT-2506 Fix compilation error

ENT-2506 Fix compilation error

(cherry picked from commit 32f279a243)

* CORDA-1947 added packageOwnership parameter

CORDA-1947 add signers field to DbAttachment. Add check when importing attachments

CORDA-1947 add signers field to DbAttachment. Add check when importing attachments

CORDA-1947 add tests

CORDA-1947 fix comment

CORDA-1947 Fix test

CORDA-1947 fix serialiser

CORDA-1947 fix tests

CORDA-1947 fix tests

CORDA-1947 fix serialiser

CORDA-1947 Address code review changes

CORDA-1947 Address code review changes

CORDA-1947 Revert test fixes

CORDA-1947 address code review comments

CORDA-1947 move verification logic to LedgerTransaction.verify

CORDA-1947 fix test

CORDA-1947 fix tests

CORDA-1947 fix tests

CORDA-1947 address code review comments

CORDA-1947 address code review comments

(cherry picked from commit 86bc0d9606)

CORDA-1947 fix merge
2018-10-22 15:00:08 +01:00
szymonsztuka
3a8fd51a08
ENT-2608 - Fix deserialization of evolution (#4096)
Fix deserialization could mix together the object trees of two threads when passing through evolution (ENT-2608).
2018-10-19 20:30:08 +01:00
Dominic Fox
73a4953ae9
CORDA-2099: Define TypeIdentifier (#4081)
* Corda-2099: Define TypeIdentifier

* Comments, naming and formatting tweaks
2018-10-19 15:53:47 +01:00
Rick Parker
55731ef816
ENT-2431 Tidy up buildNamed and CacheFactory 2018-10-18 10:38:43 +01:00
Shams Asari
aced03df54
CORDA-1274: Migrated usage of FastClasspathScanner to ClassGraph (#4060)
FastClasspathScanner was renamed to ClassGraph for the version 4 release
2018-10-11 19:50:26 +01:00
Dominic Fox
b6f2532ce6
Corda 1922 serialize states with calculated values (#3938)
* Introduce SerializeForCarpenter annotation

* Apply SerializableComputedProperty annotation to Cash.exitKeys, fix bugs

* info -> trace

* Remove annotation from FungibleAsset, as we do not know whether all implementing classes will provide the property as a calculated value

* Remove redundant import

* Explicit lambda params

* Restore explicit import for Enum valueOf

* Moving and rescoping

* More meaningful error message

* Add java test and documentation

* Fix accidentally broken unit test

* Ignore superclass annotation if property not calculated in implementing class

* Exclude calculated properties from Jackson serialisation

* Fix broken test
2018-10-09 14:54:31 +01:00
Dominic Fox
d9ea19855f
CORDA-2006: Simplify checkpoint serialization (#4042)
* CORDA-2006: Simplify checkpoint serialization

* Supply rule to KryoTest
2018-10-08 13:39:28 +01:00
Dominic Fox
98c92ef16f
CORDA-1391: Separate out Checkpoint serialization (#3922)
* Separate out Checkpoint serialization

* Update kdocs

* Rename checkpoint serialization extension methods

* Fix bungled rename

* Limit API changes

* Simplify CheckpointSerializationFactory

* Add CheckpointSerializationScheme to API checker

* CheckpointSerializationScheme should not be implemented

* Move checkpoint serialisation to internal package

* Remove CheckpointSerializationScheme from api-current

* Quarantine internal classes

* Remove checkpoint context from public API

* Remove checkpoint context from public API

* Fix test failures

* Completely decouple SerializationTestHelpers and CheckpointSerializationTestHelpers

* Remove CHECKPOINT use case

* Remove stray reference to checkpoint use case

* Fix broken test
2018-09-19 14:23:29 +01:00
Shams Asari
ca5d88e65a
Minor changes made in ENT which should have been ported over (#3932) 2018-09-12 11:26:37 +01:00
Dominic Fox
0f36e22314
Corda-1869 serialisation refactor (#3780)
* Pull out and tidy type parameter inference

* Contain null proliferation

* Extract fingerprinter state

* SerializerFingerPrinter is always initialised with a SerializerFactory

* Move non-recursive state transition functions into state

* Move all state transition functions into state

* Simplify and optimise with mutable state

* Move TypeParameterUtils back into internal.amqp

* Clarify behaviour of constructorForDeserialisation

* constructorForDeserialization no longer returns null

* Capture field properties

* Narrow PropertyDescriptor

* Use map rather than apply on a mutable list

* Remove printStackTrace added for debugging

* CORDA-1869 minor tweaks

* Use groupingBy to avoid creating an intermediate map

* Convert some functional origami to plain old for-loops

* Eliminate nested lambda to unbreak pre-serialisation

* Use EnumMap for map of Enums
2018-08-30 10:18:02 +01:00
Dominic Fox
4337537791
CORDA-1945: properly support double-width interp stack slots in superclasses when synthesising (#3859)
* Fix for CORDA-1945

* Revert irrelevant style change
2018-08-29 17:43:17 +01:00
Christian Sailer
bc330bd989
ENT-2414 Named caches (#3848)
* Add named caches and apply to NonInvalidingUnboundCache and all usages.

* Add named caches and apply to NonInvalidingCache and all usages.

* Add named caches and apply to NonInvalidingWeightBasedCache and all usages.

* Move NamedCache to core/internal

* Remove type `NamedCache` and `NamedLoadingCache`

* Suppressed 'name not used' warning, added comment, and fixed generic parameters on the buildNamed functions.

* Use `buildNamed` in all caffeine instances in production code. Not using it for caches that are created in test code.

* Add checks for the cache name

* Formatting

* Minor code review revisions
2018-08-24 17:17:22 +01:00
Mike Hearn
fd8c2e4dab Provide the exception class name and not just the message when there's an internal deserialisation fault. 2018-08-23 13:30:03 +02:00
Mike Hearn
b3433c2a46 Minor: reformat SerializerFactory.kt 2018-08-23 13:12:18 +02:00
Rick Parker
1d05c16942
ENT-2439 Fix compression in serialization (#3825)
* ENT-2439 Fix compression in serialization
2018-08-22 10:37:18 +01:00
Katelyn Baker
e871b83464
CORDA-1672 - Enable better user-helpful error messages (#3445)
* CORDA-1672 - Enable better user-helpful error messages

The issue is that the error reporting framework in the serializer is
targeted at developers in the node. However, because we pass exceptions
to users over RPC those error messages aren't always helpful.

Keep an internal exception that tracks debug useful information and log
that just before any exception escapes the framework and allow for
specific user "problem mitigation" issues to be set.

* wip

* update remaining excepions
2018-07-27 10:56:17 +01:00
Shams Asari
d4f0e0f8e0
Ordered starting of node components and clear dependencies between them (#3664)
Moved start up logic of the various node components out of their c’tors and into “start” methods, which are called from Node.start(). The components themselves are created in the Node’s c’tor with minimal initialisation logic.

Certain things are not immediately available at construction time, which are instead given to the components at start time in an orderly fashion:

* Certs from the node’s key store and trust store
* The network parameters, and thus access to things like maxMessageSize and the contracts whitelist
* A running database - several components were doing database stuff their c’tors
* The node’s NodeInfo, and thus access to things like identities and addresses

The messaging service couldn’t be created in the Node’s c’tor due to initialisation issues with MockNode. This should be fixed in a later commit.
2018-07-24 16:13:21 +01:00
Michele Sollecito
abc1d99eaa
[CORDA-1799]: Avoid generating test CorDapp JARs from each out of process node started by the driver (#3641) 2018-07-23 11:18:11 +01:00
Viktor Kolomeyko
7e3687c306
CORDA-1820: Reduce amount of logging/lookup performed by SerializerFactory.findCustomSerializer() (#3633)
* CORDA-1820: Reduce amount of logging/lookup performed by SerializerFactory.findCustomSerializer()

* CORDA-1820: Changes to make DJVM work.
2018-07-17 21:04:04 +01:00
Stefano Franz
829be5dfb6
CORDA-1747 fix issue around RPC return of generic objects (#3625)
* fix issue around RPC return of generic objects

* address review comments
2018-07-17 12:19:06 +01:00
Rick Parker
ed25d8f1be
ENT-1565 Upgrade Artemis version to latest. (#3557)
* ENT-1565 Upgrade Artemis version to latest.

* Fix compiler errors.

* Add to changelog

* Additional commentary on Proton-J version
2018-07-13 10:10:26 +01:00
Mike Hearn
493d4d5890 Minor: slightly improve an exception message with clarifying quotes 2018-07-12 18:42:19 +02:00
Stefano Franz
9503c9684e
CORDA-1747 - Client RPC classloader and Java Generics fixes (#3553)
* fix for spring boot rpc and  it work with deterministic serialization

* really really fix tests

* up log level

* reenable allWarningsAsErrors
2018-07-11 13:28:01 +01:00
Katelyn Baker
f4426ef172
CORDA-1747 - External serializes break for generic types (#3541)
* CORDA-1747 - External serializes break for generic types

* Review comments

* review comments
2018-07-10 17:48:06 +01:00
Shams Asari
244167d3e9
Enabled warnings as errors (#3514) 2018-07-04 17:17:27 +01:00
Chris Rankin
7839d78338
CORDA-1704: Suppress ProGuard's "note" output (#3499)
* Reduce ProGuard output for kotlin-metadata artifact.
* Configure ProGuard not to display "notes" about potential configuration issues. Keep notes for the "checkDeterminism" steps, though.
* Also resolve some of the issues that we would now be ignoring.
2018-07-04 09:15:54 +01:00
Chris Rankin
c50fd5e07e
ENT-1903: Remove fast-classpath-scanner from serialization-deterministic. (#3471) 2018-06-29 12:22:18 +01:00
Shams Asari
eee2563bfa
CORDA-1660: Wiring up the CordaRPCClient class loader to the p2p serialisation context. (#3454)
This is to allow the standalone shell to be able to receive WireTransactions containing Cash.State objects.
2018-06-27 17:02:35 +01:00
Katelyn Baker
06d27b57c1
CORDA-1662 - Corda Serialization Evolution breaksdown with Java classes (#3427)
Nullability logic was relying on annotations that Kotlin applies by
default but is left to the developer in Javaland. Change this around
so it works for both.

In Kotlin, the property must be nullable, in Java, it can't be a
primitive.
2018-06-26 09:31:35 +01:00
Michal Kit
e00c7706c3
CORDA-1661 Reverting DEV certificates (#3422)
* CORDA-1661 Reverting DEV certificates

* Addressing review comments

* Removed the intermediate certificate from the trust store and added some test cases for the revocation check
2018-06-25 16:40:51 +01:00
Shams Asari
b97af477b2
CORDA-1603: Class carpenter able to synthesis Cash.State objects (#3400)
This requires the class carpenter to be able to run in a "lenient" mode where it permits synthesised classes to implement interfaces with unimplemented methods.
2018-06-25 11:33:37 +01:00
Katelyn Baker
e12185139f
CORDA-1641 - Add Java example to proxy serializer documentation (#3390)
* CORDA-1641 - Add Java example to proxy serializer documentation

* Review comments
2018-06-18 16:09:31 +01:00
Anthony Keenan
a0c6de7758
CORDA-1498: serialization multiple transform bug (#3216)
* Fix issue when evolving enums with transformation chains

* Regenerate test data for deserializeWithRename test and unignore

* Further tweaks / remove debugging

* Formatting tweaks

* Address review comments

* Remove debug

* Add classname to serialization tranform exceptions

* Use direct node links instead of indexes to improve readability

* More readability tweaks

* More readability improvements

* rename require to requireThat to resolve conflict with kotlin libraries

* Add logging of error message

* Change requireThat helper to inline function

* remove unneeded toString

* Further tweaks

* Change NotSerializableException to more generic IOException

* Make exception context clearer
2018-06-18 13:34:35 +01:00