Commit Graph

936 Commits

Author SHA1 Message Date
Ross Nicoll
c13a99a2f9 Replaces keys and parties in states with AbstractParty
Switch to using AbstractParty as the standard identifier for parties in
states, so that full parties can be used during construction of
transactions and anonymised parties when the transaction is being added
to the ledger.
2017-05-16 12:07:14 +01:00
Andrzej Cichocki
d3bb040355 Refactoring related to BFT notary demo (#680)
* Fix: Add missing @StartableByRPC to fix the Raft notary demo
* Make loadConfig take a Config object, for cordformation Node
* Unduplicate User.toMap
* Unduplicate WHITESPACE regex, choose possessive form
* Use slash to make a Path
* Remove Companion where redundant
* Remove unused code
2017-05-16 11:30:50 +01:00
Andras Slemmer
f445590cff Address #665, add more leak tests 2017-05-15 15:20:00 +01:00
Andras Slemmer
b192a86a30 Address comments #665 2017-05-15 13:18:45 +01:00
Andras Slemmer
7c3a566197 RPC: call close() on startup failure, add thread leak tests 2017-05-15 13:18:45 +01:00
Andrius Dagys
885f951dc3 Node IP auto-detection (#666)
* If the p2pAddress provided by the configuration is not public, the node tries to discover the public IP:
- First by checking the network interfaces
- If not found, sends a request to the network map service

* Enable initial connection retry

* Improve error handling

* Update docs
2017-05-12 14:09:02 +01:00
Andrzej Cichocki
e981632184 RAFT notary demo refactoring (#629)
Specifically, make the IDE/driver and gradle/NodeRunner methods of launching the demo behave more similarly, with a view to configuring them the same way.
* Add option to driver to nominate a node as network map, so that the driver-based demo doesn't run an additional node
* Change gradle ports to match those chosen by driver
2017-05-12 11:33:26 +01:00
Shams Asari
47c6b9c135 Making use of latest FastClasspathScanner version and cleanup of CollectSignaturesFlow.kt 2017-05-12 10:33:43 +01:00
Andrzej Cichocki
1df29ab06f Make webserver reconnect to rebooted node. (#662) 2017-05-12 10:27:27 +01:00
Shams Asari
8cb7c5eab1 Fix node crash when the plugins dir is empty 2017-05-11 21:34:31 +01:00
Ross Nicoll
edfc4dd7d9 Add certificate path storage to identity service
Add functionality for generating certificate paths from identity
certificates to transaction certificates, validating, storing and
retrieving those certificate paths.
2017-05-11 16:55:23 +01:00
Patrick Kuo
af7ba082a4 Store identity key to keystore with self sign cert (#645)
* Support signing and storing EdDSA key and certificate in java keystore.
2017-05-11 16:53:44 +01:00
Andras Slemmer
1ecce79913 Merge pull request #669 from corda/aslemmer-quasar-hook
Add quasar-hook agent for inspecting quasar instrumentation
2017-05-11 15:34:46 +01:00
Shams Asari
48f58b6dbc Introducing StartableByRPC and SchedulableFlow annotations, needed by flows started via RPC and schedulable flows respectively.
CordaPluginRegistry.requiredFlows is no longer needed as a result.
2017-05-11 14:55:40 +01:00
Ross Nicoll
e4a0bc6e11 Move party classes into identity package
Move AbstractParty, AnonymousParty and Party into a new net.corda.core.identity package,
as they're not really cryptography tools, and in preparation for further code coming in
for identity.

Optimize imports on many files to clean up the resulting refactor.
2017-05-11 11:25:59 +01:00
Andras Slemmer
4cd1f1677f Add quasar-hook agent for inspecting quasar instrumentation 2017-05-10 19:11:34 +01:00
Matthew Nesbit
8aa341dc7b Merge pull request #620 from corda/mnesbit-audit-interface
Create header files for discussion of possible flow audit api.
2017-05-10 16:42:49 +01:00
Matthew Nesbit
540fd746bb Create header files for discussion of possible flow audit api.
Fix compile error

Address PR comments

Change from a general interface to a restricted set of audit event types.

Fixup after rebase
2017-05-10 14:49:11 +01:00
Shams Asari
e75732af91 Making sure non-serialisable objects in FlowException do not interfere with the flow session (#651)
Also TransactionVerificationException no longer has reference to non-serialisable LedgerTransaction
2017-05-10 11:07:28 +01:00
Andras Slemmer
f4354d25dd Merge pull request #644 from corda/aslemmer-fix-issue-55
Fix issue #55
2017-05-10 10:53:11 +01:00
Chris Rankin
d3075928b2 Move FlowHandle implementations back into core so that RPC clients can use them. (#653) 2017-05-09 18:25:43 +01:00
Chris Rankin
bb0ac3253d Move FlowSessionException into core so that it can be serialised. (#654) 2017-05-09 18:09:34 +01:00
Shams Asari
60b1f9b0b2 Merge pull request #639 from corda/shams-initiating-flow-annotation
Introducing InitiatingFlow annotation which has to be annotated by in…
2017-05-09 12:24:33 +01:00
Mike Hearn
670f1256e9 Address review comments from Richard 2017-05-09 11:59:51 +02:00
Andras Slemmer
f153e9a347 #55, #644 Address comments 2017-05-09 10:38:50 +01:00
Ross Nicoll
546d96934a Expand X509Utilities
Mark several functions in X509Utilities as @JvmStatic so they're readily accessible from Java.

Add functions for modifying common name of an X.500 name, either direct replacement or adding a postfix.
2017-05-09 10:27:01 +01:00
Shams Asari
221bb81f84 Introducing InitiatingFlow annotation which has to be annotated by initiating flows.
This removes the need for the shareParentSessions parameter of FlowLogic.subFlow. It also has the flow's version number so FlowVersion is now no longer needed.
2017-05-08 20:19:45 +01:00
Patrick Kuo
1f4535bc2e Support signing and storing EdDSA key and certificate in java keystore. (#601) 2017-05-08 17:38:59 +01:00
Andras Slemmer
5db4e4723d Fix issue #55 2017-05-08 15:33:45 +01:00
Matthew Nesbit
c3557e0a68 Merge pull request #640 from corda/mnesbit-flowlogicfactory-internal
Move the implementation of the FlowLogicRefFactory internal
2017-05-08 15:24:41 +01:00
Mike Hearn
8016bc5fcd Detect broken macOS localhost resolution and tell the user how to fix it. 2017-05-08 14:16:20 +02:00
Matthew Nesbit
bfa7d50d37 Move the implementation of the FlowLogicRefFactory internal to the node as it is an implementation detail, not an API. 2017-05-08 11:32:32 +01:00
Andras Slemmer
489661a289 Merge pull request #592 from corda/aslemmer-rpc-manual-demux
RPC muxing, multithreading, RPC driver, performance tests
2017-05-08 11:18:21 +01:00
Chris Rankin
0ed009dfa0 Set java.io.tmpdir to Gradle's build directory for unit and integration tests. (#638) 2017-05-05 17:30:51 +01:00
Andras Slemmer
3a2afcdbb2 #592: Address more comments 2017-05-05 17:10:52 +01:00
Andras Slemmer
652cbb0d9f #592: RPCServer lifecycle 2017-05-05 17:10:52 +01:00
Andras Slemmer
de88ad4f40 RPC muxing, multithreading, RPC driver, performance tests 2017-05-05 17:10:52 +01:00
Ross Nicoll
25dbac0f07 Change party to hold an X.500 name
Change the legal name of parties to be an X500 name. This ensures that we aren't converting between
common names and X500 names in various places, eliminating substantial scope for error in the conversion
process. As a result, all node names must now be full X500 names, which has impact on most configurations.
2017-05-05 16:13:29 +01:00
Ross Nicoll
b64e7f51f6 Enforce X.500 distinguished names in configuration 2017-05-05 16:13:29 +01:00
josecoll
8c3b9ac589 Vault Query API design (#522)
* Added queryBy(QueryCriteria) Vault API and Junit tests.

* Minor fix following rebase.

* Spit out Vault Query tests into separate source file.

* WIP

* Enable composition of QueryCriteria specifications.
Additional JUnit test cases to validate API.

* Added Deprecating annotations.
Added QueryCriteria for set of contractStateTypes

* Minor tweaks and additional JUnit test cases (chain of linear id)

* Added Java Junit tests and QueryCriteria builder support.

* Added API documentation (including coding snippets and examples).

* Added @JvmOverloads to QueryCriteria classes for easy of use from Java.

* Refactored QueryCriteria API to use composition via sealed data classes.

* Enable infix notation.

* Fixed typo.

* Clarified future work to enforce DB level permissioning.

* Moved PageSpec and Order from QueryCriteria to become parameters of Query itself.

* Moved PageSpec and Order from QueryCriteria to become parameters of Query itself.

* TokenType now specified as set of <Class> (was non extensible enum).

* Exposed new Vault Query API functions via RPC.

* Fixed compiler error in java test.

* Addressed a couple of minor PR review scomments from MH.

* Major updates following PR discussion and recommendations.

* All pagination and sorting arguments are optional (and constructed with sensible defaults).
Added Java helper functions for queryBy and trackBy interfaces.
Added Java trackBy unit tests.
Miscellaneous cleanup.

* Added Generic Index schema mapping and query support.

* Query criteria referencing Party now references a String (until Identity framework built out).
Added participants attribute to general query criteria.

* Fleshed our IndexCriteria including PR recommendation to define column aliases for index mappings.

* Removed all directly exposed API dependencies on requery.

* Updated documentation.

* Provide sensible defaults for all Query arguments.
Add RPC Java helpers and increase range of Vault Service helpers.

* Further improvements (upgrading notes) and updates to documentation.

* RST documentation updates.

* Updates to address RP latest set of review comments.

* Updates to address MH latest set of review comments.

* Updated to highlight use of VaultIndexQueryCriteria to directly reference a JPA-annotated entity (versus the indirect, explicitly mapped attribute to GenericIndexSchema approach)

* Aesthetic updates requested by MH

* Reverted Indexing approach: removed all references to VaultIndexedQueryCriteria and GenericVaultIndexSchemaV1 scheme.

* Final clean-up and minor updates prior to merge.

* Fixed compiler warnings (except deprecation warnings)

* Reverted all changes to Vault Schemas (except simple illustrative VaultLinearState used in VaultQueryTests)

* Reverted all changes to Vault Schemas (except simple illustrative VaultLinearState used in VaultQueryTests)

* Commented out @Deprecated annotations (as a hedge against us releasing M12 with the work half-done)

* Renamed RPC JavaHelper functions as RPCDispatcher does not allow more than one method with same name.
2017-05-05 15:14:43 +01:00
Chris Rankin
0309426cb9 Include log4j2.xml into application jars only. This allows applications to use their own log4j2.xml files, if required. (#635) 2017-05-05 13:12:36 +01:00
Shams Asari
de83866ebe Removed createHandle from the FlowStateMachine interface as it doesn't need to be publicly exposed 2017-05-05 12:21:34 +01:00
Andrius Dagys
9a0653128c Add support for re-sending session messages. This is useful when talking to a distributed service, e.g. notary – if one of the nodes go down in the middle of a session, the session will be re-established with a different node (round-robin order). 2017-05-05 10:08:53 +01:00
Konstantinos Chalkias
d8fa75654f Support for multi-sig schemes. ECC (K1/R1) and EdDSA are fully supported. (#599)
Support for multi-sig scheme. ECC (K1/R1) and EdDSA are fully supported.
2017-05-04 18:19:00 +01:00
Matthew Nesbit
fe7d893de2 Merge pull request #627 from corda/mnesbit-servicehub-cleanup2
Remove scheduler service from ServiceHub
2017-05-04 14:34:41 +01:00
Matthew Nesbit
b3b4457b4e Remove scheduler service from ServiceHub 2017-05-04 10:00:49 +01:00
Shams Asari
eba753ddfe Moved the initiated-side of core flows in net.corda.flows to net.corda.node.services. They are not meant to be visible to end-users. 2017-05-03 17:42:51 +01:00
Chris Rankin
e22ad19fcd Use assert methods from test framework. Don't use Java assert. (#625) 2017-05-03 17:32:30 +01:00
Ross Nicoll
a1fd215863 Extract common name from legal name to determine path in Driver (#613)
Rewrote node name to extract common name to use as the node path for samples, to work around characters being incorrectly treated as separators.
2017-05-03 16:58:48 +01:00
Matthew Nesbit
7e8aa1d706 Remove Messaging service from service hub
Remove mention of MessagingService as being on ServiceHub.
2017-05-03 15:19:27 +01:00
Ross Nicoll
d65d63e4f6 Interim patch introducing X500Names
This is an intermediary step to introducing X500Names in all Party instances, which adds:

* Party constructor which accepts X500Name and then converts it to string.
* startNode() function which takes in X500Name instead of String
* Numerous legal name fixes to use full distinguished names
2017-05-03 10:46:03 +01:00
Shams Asari
cfe5786d2d Introducing versioning of flows using the FlowVersion annotation.
Core flows, which are baked into the platform, are also versioned using the platform version of the node. Several core flows, such as the data vending ones, which were provided via plugins are now instead baked into the node.
2017-05-02 15:12:07 +01:00
josecoll
3d401d1dcb Apply @Suspendable on all flow methods that call vault generateSpend (#612) 2017-05-02 09:38:44 +01:00
Chris Rankin
3208daf507 Customise the error message according to why Corda cannot boot. (#610)
* Customise the error message according to why Corda cannot boot.
* Reset system property programmatically for the sake of developers.
2017-04-28 16:01:19 +01:00
Andrzej Cichocki
f2d138cdab Replace code only used in 1 test with existing general mechanism. (#600) 2017-04-28 15:50:24 +01:00
Andrzej Cichocki
cb3522588f In checkpoints, serialize hash of attachment instead of its data (#543) 2017-04-28 13:50:47 +01:00
Chris Rankin
9f3fae1914 Set the "no deserialisation" property in the Capsule and Driver. (#603) 2017-04-28 10:14:15 +01:00
Andrzej Cichocki
b3894fa38a Fix race in IntegrationTestingTutorial. (#594) 2017-04-27 09:15:12 +01:00
Shams Asari
c5a9312e07 Merge pull request #582 from corda/shams-flow-counterpartymarker-cleanup
Deprecated FlowLogic.getCounterpartyMarker as it's complicated and probably not used
2017-04-26 09:40:48 +01:00
Matthew Nesbit
7e3b9a8934 Fix duplicate content root problems in IntelliJ 2017-04-26 10:37:16 +02:00
Shams Asari
913487cb32 Deprecated FlowLogic.getCounterpartyMarker as it's complicated and probably not used (replacement is to use sub-flows).
Also made flow registration require the client flow class rather than any old class.
2017-04-25 18:53:33 +01:00
Mike Hearn
922a760a09 Shell: more aggressive catch/rethrow of errors during command line parse. Avoids stack traces being dumped to the console when an unknown party name is provided. 2017-04-25 19:43:26 +02:00
Mike Hearn
aed9495b37 Shell: add 'start' as an alias for 'flow start'. 2017-04-25 19:43:26 +02:00
Andrius Dagys
4e86443cac Fix Raft notary demo post name refactoring 2017-04-25 17:11:21 +01:00
Ross Nicoll
c8af48ebd9 Clean up BFTNotaryServiceTests
BFTNotaryServiceTests generates a master node independently of the cluster nodes, so it can put it
at the end of the list of nodes. The calling function however treats the first node in the list as
the master, not the last node. This simplifies the code while maintaining the same behaviour.
2017-04-25 15:12:37 +01:00
Katarzyna Streich
f92949d3b5 Add information on why state machine was removed from StateMachineManager (#570)
* Add information on why state machine was removed from StateMachineManager.
There are two cases: normal end of flow or error.

Return flow result as part of state machine remove data.

Make Change a sealed class with Add and Remove.

fiber.actionOnEnd takes ErrorOr<R> parameter.

* Remove unnecessary fields from StateMachineManager.Change.
2017-04-25 14:34:45 +01:00
Katarzyna Streich
c1b7b1cb75 Add information on who started flow on a node. (#549)
* Add information on who started flow on a node with name where possible.
Add sealed class holding information on different ways of starting a flow: RPC, peer, shell, scheduled.

* Remove invokeFlowAsync from ServiceHub, move it to ServiceHubInternal.
We shouldn't be able to start new state machines from inside flows.
2017-04-24 17:05:51 +01:00
Shams Asari
b5e022f350 Introducing Platform Version and its use by the NMS for min version requirements for the network 2017-04-24 15:31:10 +01:00
Ross Nicoll
684d1089f0 Introduce full legal names for test parties
Use full names for test parties, ahead of complete X.500 name support.
2017-04-24 15:18:21 +01:00
Ross Nicoll
6c6ed3a758 Move transaction generation to OnLedgerAsset
Move functions for generating transactions into OnLedgerAsset from various locations in
the code (VaultService, AbstractConserveAmount, etc.) to unify the code paths and reduce
duplication.
2017-04-24 13:29:52 +01:00
Andrzej Cichocki
160d13b6f7 Prohibit Java deserialisation in the Corda process (#566) 2017-04-21 16:26:35 +01:00
josecoll
2b1a71955c Always remove any soft locks associated with a completed flow. (#561)
Fix issue whereby soft locks associated with a flow were not being released because they were not initially registered properly.
2017-04-21 13:38:03 +01:00
Andrius Dagys
a2de90a6da Test if address is reachable before choosing 2017-04-20 19:36:41 +02:00
Andrius Dagys
a01c466beb Ignore utunX interfaces when detecting public IP 2017-04-20 19:36:41 +02:00
Chris Rankin
d2d7cbc9ec CORDA-299: Remove progress Observable from FlowHandle, unless explicitly requested. (#513)
* Remove progress Observable from FlowHandle, unless explicitly requested.
* Refactor FlowHandle creation into FlowStateMachine.
* Prevent server-side queue subscription for dummy Observable.
* Refactor so that RPC client does not receive any unused progress Observables. This is the simplest way of ensuring we have no dangling "hot" Observables when the RPC client closes.
* Test flow has correct handle.
* Resolve some compiler warnings.
* Document how starting a flow does not involve progress tracking by default.
* Update changelog and release notes for RPC API.
* Rename new RPC API to startTrackedFlow().
* Remove optimisation because of its affect on the client-side.
* Update documentation.
2017-04-19 20:11:51 +01:00
Andras Slemmer
0d90082482 Merge pull request #555 from corda/aslemmer-fix-h2-and-copycat-server-leak
Shutdown copycat server and h2 database on Node shutdown
2017-04-19 14:15:33 +01:00
Andras Slemmer
201c558245 Shutdown copycat server and h2 database on Node shutdown 2017-04-19 12:24:38 +01:00
Shams Asari
37a94237c8 Moved tests in net.corda.node.services to correct packages 2017-04-19 12:11:59 +01:00
Shams Asari
8e0a0ba8fb Provide useful error message if db iterator is left on stack during checkpointing
AutoCloseables in general are also forbidden as restoring them across node restarts is not supported.
2017-04-19 09:39:41 +01:00
Ross Nicoll
6d48667d91 Add infrastructure for X.500 name support (#534)
This introduces new functions for fetching parties by their X.500 name, Kryo serialization support for X500Name objects, an X500Name generator and some X509 utility support in preparation for full X.500 name support.
2017-04-13 15:32:34 +01:00
Ross Nicoll
1a88ca4bee Add composite signature engine (#446)
Add CompositeSignature and CompositeSignatureWithKeys classes as part of preliminary work to make CompositeKey signature validation compatible with java.security classes, so that these keys and signatures can be used readily in X.509 certificates.
2017-04-13 13:25:12 +01:00
Andrzej Cichocki
88b5e32ab2 Convert databaseTransaction to extension function on Database. (#537) 2017-04-12 17:15:29 +01:00
Andrzej Cichocki
3e007c02f4 Fix potential file handle leak in Attachment (#539)
* Make mockito available everywhere (core in particular).
* Also set the not-found path as FNFE message.
2017-04-12 15:30:28 +01:00
Mike Hearn
ac337240a6 Minor: more cleanups 2017-04-12 14:42:30 +02:00
Mike Hearn
bea799c60d Minor: node: fix inspector warnings and delete dead code. 2017-04-12 14:42:30 +02:00
Mike Hearn
1a86ac481f Minor: core: fix static analysis warnings.
One actual bug was found this way, albeit a harmless one.
2017-04-12 14:42:29 +02:00
Ross Nicoll
d35bd74596 Standardise identities used in tests, demos, etc.
Standaridise the identity names of Alice, Bob and Charlie, notary, map service, etc. in order
to ensure consistency across the code base and reduce number of places that have to be changed
to introduce proper X.500 names.

Move Alice, Bob & Charlie identities into the utilities package so they can be used in demos
2017-04-12 11:40:48 +01:00
kasiastreich
36d5d0d7b2 Refactor of CompositeKeys to implement PublicKey interface. (#433)
* Make CompositeKey implement PublicKey

The initial implementation of composite keys as their own distinct class separate from PublicKey
means that the keys cannot be used on standard classes such as Certificate. This work is a beginning
to modifying CompositeKey to being a PublicKey implementation, although significant further work
is required to integrate this properly with the standard Java APIs, especially around verifying
signatures using the new key type.

* First stage of making CompositeKey implement PublicKey interface. Revert to using PublicKey everywhere we expect a key.

* Move algorithm and format into companion object (#432)

Move algorithm and format into companion object so that they can be referenced from other
classes (i.e. the upcoming signature class).

* Add simple invariants to construction of CompositeKey.
Builder emits CompositeKeys in simplified normalised form. Forbid keys with single child node, force ordering on children and forbid duplicates on the same level. It's not full semantical normalisation.

* Make constructor of CompositeKey private, move NodeWeight inside the class.
Add utility function for Kryo deserialization to read list with length constraints.
2017-04-12 11:13:20 +01:00
Mike Hearn
0c0c5521c0 Minor: address more formatting issues spotted by Shams 2017-04-11 15:53:05 +02:00
Mike Hearn
c097229935 Minor: run code cleanup inspections 2017-04-11 15:53:05 +02:00
Mike Hearn
d6af727751 Minor: auto-format of module: node 2017-04-11 15:53:05 +02:00
Clinton
35fa9d2e59 Version number parser can now handle patch versions. (#516) 2017-04-11 12:08:42 +01:00
Rick Parker
d31a6fae85 Fix up HibernateObserver to allow cascading persistence after bug report (#524) 2017-04-10 11:33:03 +01:00
Shams Asari
c17fe29a62 Converted FullNodeConfiguration into a data class and added ability to parse Configs into data classes 2017-04-07 17:54:03 +01:00
Konstantinos Chalkias
f7dd2733f2 Kryo register FileInputStream and addDefaultSerializer for InputStream (#471)
HashCheckingStream CordaSerializable and FileInputStream Kryo register
2017-04-06 11:25:49 +01:00
Ross Nicoll
48b121d145 Add Cash*Flow tests
Add tests for CashIssueFlow, CashPaymentFlow and CashExitFlow. While these were mostly covered by other tests
already, CashExistFlow was not, and any bugs would be harder to identify because they are mixed in with other
functionality (i.e. vault tests)
2017-04-04 13:44:10 +01:00
Shams Asari
848988bf1c Merge pull request #487 from corda/shams-sealed-data-classes
Converted sealed data types to be data classes
2017-04-04 13:04:38 +01:00
Clinton
09e7d89e4e Merge pull request #500 from corda/clint-driverdebugportfix
Readded the debug port to the driver
2017-04-04 11:57:27 +01:00
Shams Asari
faef877a8d Converted sealed data types to be data classes 2017-04-04 11:37:56 +01:00
Clinton Alexander
6768a83232 Readded the debug port to the driver and added a log entry for the debug port. 2017-04-04 10:28:18 +01:00