Commit Graph

2212 Commits

Author SHA1 Message Date
Michele Sollecito
30b138a847
[CORDA-2376]: Unable to make contract attachment trusted if it was received via network (fixed). (#4474)
* [CORDA-2376]: Unable to make contract attachment trusted if it was received via network (fixed).

* [CORDA-2376]: Wrote some tests.

* [CORDA-2376]: Wrote some tests.

* [CORDA-2376]: Code review changes.

* [CORDA-2376]: Code review changes.
2019-01-02 18:11:53 +00:00
Tudor Malene
ee9251bd25
CORDA-2327 add attachments for missing dependencies (#4456)
* CORDA-2327 first draft - add attachments for missing dependencies

* CORDA-2327 draft - fix unit tests

* CORDA-2327 draft - some cleanup.

* CORDA-2327 fix test

* CORDA-2327 fix test

* CORDA-2327 fix test

* CORDA-2327 Address code review comments

* CORDA-2327 fix api

* Address code review comments

* CORDA-2327 Address code review comments

* CORDA-2327 Address code review comments

* Fix merge

* Address code review comments
2019-01-02 16:16:53 +00:00
Shams Asari
9a484998bb No longer using deprecated MockNetwork c'tor (#4481) 2019-01-02 09:51:51 +00:00
Viktor Kolomeyko
5e16961fee
ENT-2847: Ent port: Make logging pluggable in NetworkRegistrationHelper. (#4477) 2019-01-01 20:42:43 +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
33670d62b1
Closing the app class loader on node shutdown (#4479) 2018-12-31 13:15:29 +00:00
Viktor Kolomeyko
cd842274ab
ENT-2913: Port from Ent: Add deprecated annotation for compatibilityZoneURL (#4475) 2018-12-28 17:51:26 +00:00
Shams Asari
c08f65a92c
CORDA-2128: Moved all the helper methods added to NetworkParameters.kt into internal (#4466) 2018-12-27 14:21:37 +00:00
Shams Asari
00672f97fa
CORDA-2128: Moved constraints and attachments stuff out of the public API that shouldn't be there (#4460) 2018-12-24 15:09:38 +00:00
Shams Asari
60d215aaa8
Fixed incorrect usages of assertFailsWith (#4458)
The overload that takes in a String does NOT check that the exception thrown has that message, which is what these tests are assuming. Rather it's the assertion message when the test fails.
2018-12-24 09:44:48 +00:00
josecoll
6f9f6fd870 CORDA-2366 - Adjust assertions to cater for any ordering of results. (#4455) 2018-12-23 16:53:01 +00:00
Andrius Dagys
6f0bc42098 ENT-2813: Fix uniqueness provider double insertion issue
Fix an issue where a transction id is committed twice if a
reference-only transaction gets re-notarised.

Added more tests.

add fix
2018-12-21 22:29:16 +00:00
Dimos Raptis
8ac32f52f6 CORDA-1839 - Remove race condition between trackBy and notifyAll (#4412)
* CORDA-1839 - Remove race condition between trackBy and notifyAll

* Fix null check

* Improve filtering

* Switch equality test to refs

* Refine filtering of seen updates

* Add entry in the changelog

* Address comments
2018-12-21 09:40:07 +00:00
JamesHR3
39e5dc5749
[CORDA-1828] Documentation update for observer nodes (#4443)
CORDA-1828 Documentation update for observer nodes

* Update observer node documentation

* Added test to catch original issue if seen again
2018-12-21 08:18:14 +00:00
Tudor Malene
3c13c07c09
CORDA-2344 Set contextClassloader on the flow threads. (#4437)
* CORDA-2344 Set contextClassloader on the flow threads.

* CORDA-2344 Set contextClassloader on the flow threads.
2018-12-20 15:04:16 +00:00
Rick Parker
3efbad34cc
ENT-2848 remove need for generated IDs on some frequently used tables (#4446)
* Working version

* api-current.txt change to remove diff due to inheritance hierarchy change.

* api-current.txt change to remove warnings of abstract methods in new interfaces.

* Fix indent
2018-12-20 13:06:21 +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
szymonsztuka
4aaefb4fe9 CORDA-2331 Split Workflow and contracts of Finance App into separate Cordapps (#4422)
* Split Workflow and contracts of Finance App into separate Cordapps, part 1 - content which is different between OS and ENT is still in contract Cordapp.

* Move CashSelection implementations to workflow module.

* Move CashSelection implmentations to workflow module.

* Move finance module to finance-flows, top level finance module is empty.

* Move finance module to finance-flows, top level finance module is empty.

* Updated build comment.

* Revert publication of combined (contracts and flows) corda-finance.jar (to maintain backwards compatibility with 3rd party cordapps dependent on finance)

* Added backwards compatibility clarification comment.

* Re-instate new cordapp metadata.

* Global rename of `finance-flows` to `finance-workflows` to follow adopted naming conventions.

* Addressed final review comments.

* Rename application to "Corda Finance Demo"

* Generation of original corda-finance jar from new sub-modules.

* Fixed and tested demobench with new split finance contract and workflow jars.

* Renamed finance sub-modules to contracts and workflows.

* Remove Michele!!!

* Minor fix to filtering logic.

* Align CorDapp configuration filename with workflows jar.

* Fix breaks caused by finance module naming changes.

* Final alignment between OS/ENT of finance contract code.
2018-12-19 18:02:51 +00:00
Rick Parker
a4037b374d
ENT-2848 More contract attachment caching to avoid database queries slowing the node down (#4433) 2018-12-19 17:53:48 +00:00
Christian Sailer
e8a467cab8
CORDA-2304 Never give up on notarisations (#4420)
* Make TimedFlows retry forever, and cap the growth of the time out interval.

* Only time flows for restart if that is sensible (i.e. notary flows that actually have an alternative node to talk to).

* Move check for multi node notary into getter so it the `canBeRestarted` attribute can't be set too late.

* Make restartable timed flow a concept on SubFlow metadata and the relevant events so we can handle it properly for subflows based on their metadata.

* Addressing review comments.

* Consistent naming

* Update documentation

* Addressing documentation comments.
2018-12-18 09:18:12 +00:00
Rick Parker
20e5bbf56f
ENT-2848 Add caching to contract attachment versions (#4410)
* Refactor into attachment service

Fix up mock service

First caching version, but with no invalidation currently

Set cache size

Fix up after rebase

Cache invalidation

Formatting tidy up

Sort out some nullability

Add kdocs.

Unit tests

More unit tests

Fix TODO

Unit test fixes

Unit test fixes

Fixed concurrent invalidating transaction support.

* Correct some transaction concurrency bug, including unit test.

* Added some unit tests for the method I added to persistence.

* Remove some blank lines

* Review feedback

* Fix imports
2018-12-17 15:14:14 +00:00
Thomas Schroeter
fe3182d22f
Remove safe cast at initial registration attempt (#4427) 2018-12-17 14:11:43 +00:00
Shams Asari
9d7be5cf21
Renamed CordappInfoResolver to CordappResolver (#4419) 2018-12-14 19:17:06 +00:00
Shams Asari
1a065ef13d
CORDA-1942: Moved minimumPlatformVersion and targetPlatformVersion to Cordapp (#4416)
Otherwise ContractAndWorkflow ends up having these two duplicated three times.
2018-12-14 15:48:01 +00:00
josecoll
9cdda3bd77
CORDA-2149 CorDapp Contract and Workflow version identifiers (#4363)
* Implementation of Contract and Workflow attribute identifiers.

* Fixes following rebase from master.

* Fix broken JUnit test.

* Fix broken JUnit test.

* Fix broken JUnit test.

* Added missing constants.

* Further clean-up.

* Updated documentation.

* Added changelog entry.

* Updated all samples (using new Gradle Plugin 4.0.37 functionality)

* Temporarily resolve gradle plugins from latest published snapshot.

* Temporarily resolve gradle plugins from latest published snapshot.

* Updates following feedback from PR review.

* Move constants into CordappInfo companion object.

* Contract and Workflow attribute `version` to `versionId` (as version is a reserved gradle variable)

* Clarified warning message on incorrect version identifier.

* Align version identifier processing logic with gradle cordapp plugin.

* Updated comment.

* Minor fixes following rebase from master.

* Fixed broken unit test.

* Improved exception reporting.

* Update to use 4.0.37 of Gradle Plugins.

* Added support for combined Contract and Workflow CorDapp info.

* Updated following discussions with Shams + cleanup.

* Updated following Shams PR review.

* Minor API improvements.

* Added missing cordapp info causing deployNodes to fail.
2018-12-14 09:39:23 +00:00
Matthew Nesbit
767e37a34e
Apply some protective measures to prevent the reconnection test failing when rogue RPC clients on the team city server connect. (#4413) 2018-12-14 09:28:26 +00:00
Christian Sailer
32041930f4
CORDA-2306 backoff on flow retries (#4383)
* Exponential back off for retries

* Log back-off

* Jitter back off timing

* Set the minimum back-off to 10s

* Refactor code to be only called when required.

* Spelling

* Make condition purely based on `Chronic` interface

* Make timer a daemon thread
2018-12-13 13:52:30 +00:00
Remo
eb4a33e438 Corda-3941: initialiseSchema property couples corda node and cordapp ddl handling (#4277)
New property database.initialiseAppSchema introduced that allows to turn-off Hibernate DDL generation while leaving Node-specific Liquibase handling enabled.
2018-12-13 14:34:58 +01:00
Rick Parker
b70740cf2e
ENT-2785 Create clearer separation between RPC and P2P classes to make it easier to adjust logging levels independently. (P2P remained as is, some internal node RPC classes moved to existing node RPC package from generic messaging package, which is now just for P2P). (#4401) 2018-12-12 17:36:44 +00:00
szymonsztuka
4b14c47319
CORDA-2134 - re-enabling ignored tests due to signature constrains non-downgrade rule (#4398)
1) TwoPartyTradeFlowTests - restructured - saving transaction just after creating a state, as it's needed for the next TransactionState to be verified (for non-downgrade rule), enable more tests which were set as @Ignored, left 3 TODOs as 2 tests were slightly modified, need further investigation
2) MockService method loadContractAttachment always returns a dummy Attachment which means it has a default Contract Class Version number 1 used for signature constraints non-downgrade rule.
3) TransactionSerializationTests - added a fake transaction which created fake stated used as input state and using real (not mocked one) implementation of loadContractAttachment
2018-12-12 15:10:08 +00:00
Michele Sollecito
ccaf9dfbfa
[CORDA-2323]: Make detectPublicIp disabled by default. (#4404) 2018-12-12 13:38:57 +00:00
Emanuel Russo
5045f8fb7f Modify toString of DBCheckPoint (#4338)
* Modify toString of DBCheckPoint

Fix toString of object DBCheckPoint  to remove printing of array in DEBUG log

* Update DBCheckpointStorage.kt

Fix for Code Style Guideline
2018-12-12 09:43:16 +00:00
szymonsztuka
6d16e2d146
CORDA-2262 Align ID -> pubKey mapping between BasicHSMKeyManagementService and PersistentKeyManagementService (#4400)
There was a parallel work done on PersistentKeyManagementService (new table added) while this service has been superseded by BasicHSMKeyManagementService.
Move new table change for the former class to the later one and did some minor cleanup.
2018-12-11 19:50:30 +00:00
szymonsztuka
4799df9b80
CORDA-2150 signature constraints non-downgrade rule (#4262)
Contract class version non-downgrade rule is check by LedgerTransaction.verify().
TransactionBuilder.toWireTransaction(services: ServicesForResolution) selects attachments for the transaction which obey non downgrade rule.
New ServiceHub method loadAttachmentConstraint(stateRef: StateRef, forContractClassName: ContractClassName? = null) retrieves the attachment contract related to transaction output states of given contract class name.
2018-12-11 10:23:07 +00:00
Michele Sollecito
58ef83a67e
[CORDA-2007]: Fixed problematic max page size. (#4392) 2018-12-10 13:57:43 +00:00
Viktor Kolomeyko
1f8582e99f
CORDA-2115: Straighten-up @Before invocation chain. (#4379)
Note: similar sort of changes already made in Ent codebase that fix execution against external DBs.
it will make sense to backport those change to OS to avoid merge conflicts in the future.
2018-12-07 11:24:44 +00:00
Michele Sollecito
e2ea97bae7
[CORDA-2265]: Nodes hangs when using AppServiceHub to start a flow in a blocking way (fix) (#4376) 2018-12-06 15:13:32 +00:00
Florian Friemel
c46fde1133 Backport [ENT-2817] (#4364) 2018-12-06 15:04:49 +00:00
Florian Friemel
af1202ba79
[CORDA-2296] Improve initialization of criteriaBuilder in NodeVaultService. (#4374) 2018-12-06 15:02:38 +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
Michele Sollecito
ad48301149
[CORDA-2247]: Fixed a bug causing Hibernate to produce cross joins. (#4366) 2018-12-06 10:50:47 +00:00
Rick Parker
bac693a6f3
CORDA-2293 fix append only map getIfCached when Missing (#4355) 2018-12-05 08:39:42 +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
Florian Friemel
382e3b651f
[ENT-2821] Make the default schemes for TLS and identity available from the CryptoService interface (#4354)
* Make the default schemes for TLS and identity available from the CryptoService interface.

* Change CryptoService.generateKeyPair to accept SignatureScheme instead of Int.
2018-12-04 17:06:12 +00:00
Andrius Dagys
838c99c6e4 CORDA-2115: Notary whitelist verification changes (#4293)
* CORDA-2115: Notary whitelist verification changes

- For regular and contract upgrade transactions: check that the notary is in the network parameter whitelist
- For notary change transactions: check the the new notary is in the network parameter whitelist. This enabled support for network merging: the old notary doesn't have to be in the current network's notary whitelist for re-pointing old states to another notary.

These checks are done during transaction construction/verification and also by the non-validating notary.

* Address comments

* Remove stale todo

* Use notary whitelist of current network parameters for platform versoin 3

* Cleanup test

* Move `getHistoricNotary` to `HistoricNetworkParameterStorage` in `core.internal`

* Require `newNotary` to be notary on the network map during notary change
2018-12-04 13:54:24 +00:00
Andrius Dagys
0925008f9e ENT-2666: Don't check for network parameter currentness for now (#4322)
* ENT-2666: Don't check for network parameter currentness for now

* Add check for parameters null when version >= 4

* Add check that parameters are known to the node/network

* Add test
2018-12-03 10:22:11 +00:00
Anthony Keenan
fab09c74d5
Node startup minor refactor (#4342)
* Slight refactor

* Move side effect out of method
2018-12-03 09:42:16 +00:00
Thomas Schroeter
27a80900bd
Shorten table name (#4331) 2018-11-30 14:36:27 +00:00
Michele Sollecito
a9ff8a0818
[CORDA-2278]: KillFlow RPC operation is not releasing soft locks. (#4332)
* [CORDA-2278]: Seems to be working. Leaving the test to ensure no future regressions.

* [CORDA-2278]: Seems to be working. Leaving the test to ensure no future regressions.

* [CORDA-2278]: Seems to be working. Leaving the test to ensure no future regressions.

* [CORDA-2278]: Seems to be working. Leaving the test to ensure no future regressions.
2018-11-30 13:10:19 +00:00
Patrick Kuo
4f41dff6cd Stop messaging services before node dies, to prevent port hogging when using in process node (#1620)
(cherry picked from commit 15c11d964f)
2018-11-30 10:33:31 +00:00