Commit Graph

92 Commits

Author SHA1 Message Date
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