Commit Graph

290 Commits

Author SHA1 Message Date
szymonsztuka
05327f3826 decouple Exposed (#1028)
Exposed library decoupled from transaction management and JDBC connection creation for Hibernate and ReQuery
2017-07-14 14:39:59 +01:00
Shams Asari
e93cdf29f8 Moved the core flows into net.corda.core.flows 2017-07-13 13:27:11 +01:00
Shams Asari
fa4577d236 Cleaned up NonEmptySet and expanded its usage in the codebase 2017-07-13 12:32:33 +01:00
Ross Nicoll
773aa28873 Clean up IssuerFlow
* Switch to using anonymous party as recipient
* Enable anonymisation for issuance as well as move in issuer flows.
* Pass notary into issuer flow rather than taking a notary at random from the network map.
* Enable anonymisation in Bank of Corda RPC test
* Parameterize issuer flow tests into anonymous and deanonymised versions
2017-07-13 11:23:56 +01:00
Shams Asari
7eed258bcb Fixed incorrect package declarations in CommonSchema and VaultSchema 2017-07-12 20:04:28 +01:00
Shams Asari
6e570b4d65 Moved dummy stuff from core into test-utils 2017-07-12 18:11:57 +01:00
Ross Nicoll
d6d5edc33b Check vault updates in IssuerFlowTest
Modify issuer flow test to verify the consumed/produced states, rather than just checking the transaction matches the value returned via the flow state machine. This is both a simpler and more relevant test.
2017-07-11 15:30:21 +01:00
Shams Asari
fb0a043485 Moved dummy contracts to test-utils 2017-07-07 15:16:29 +01:00
Shams Asari
7822118835 Moved random63BitValue() to CryptoUtils 2017-07-07 12:19:55 +01:00
Shams Asari
984fbd8995 Moved loggerFor and other useful Kotlin extensions into KotilnUtils.kt and moved LogHelper into test-utils 2017-07-07 00:14:20 +01:00
Shams Asari
8f1529b863 Moved ByteArrays.kt to core.utilities 2017-07-06 17:58:18 +01:00
Shams Asari
182c9cceb5 Cleaned up the QueryCriteria API to be more Java friendly 2017-07-06 11:08:54 +01:00
Shams Asari
2973755bc8 Moved TestConstants.kt from core into test-utils 2017-07-05 11:54:43 +01:00
Ross Nicoll
3176ecfecf Clean up transaction key flow
* Identities returned from TxKeyFlow were backwards, meaning keys were incorrectly assigned to the remote and local identities. Added unit test covering this case and corrected the flow logic.
* Rename TxKeyFlow to TransactionKeyFlow
* Correct registration of transaction key flows
* Move TransactionKeyFlow.Provider into CoreFlowHandlers
* Move TransactionKeyFlow.Request up to the top level class instead of being a class within an object.
* Remove AbstractIdentityFlow and move the validation logic into individual flows to make it clearer that it's registering the received identities.
* Cash flows now return the recipient identity instead of full identity lookup, as this is what
the caller actually needs and simplifies a lot of cases.
2017-07-05 11:39:08 +01:00
Joel Dudley
65f385953f Changes the name of the addTimeWindow method to setTimeWindow. 2017-07-05 10:57:18 +01:00
Matthew Nesbit
3ef5c39633 Put test classes into clear namespaces, so that they don't pollute the API. 2017-07-05 09:14:22 +01:00
Clinton
1707fb67c1 Merge pull request #932 from corda/clint-releasefixes
Misc fixes for the release process
2017-07-04 19:33:33 +01:00
Clinton Alexander
b4e7d7ca1b Can now publish to artifactory. 2017-07-03 18:12:56 +01:00
Shams Asari
46e23b7716 Clean up of ServiceHubInternal, including how it's created in AbstractNode 2017-07-03 17:05:36 +01:00
Joel Dudley
7df8c50167 Adds helper methods to grab a LedgerTx or verify a SignedTx. Deprecates builder signing methods. 2017-07-03 15:53:48 +01:00
Shams Asari
a08f701dc5 Removed the StorageService and puts its components directly into the service hub 2017-06-30 09:37:29 +01:00
Ross Nicoll
1a4965c294 Change CashIssueFlow to use anonymous identity
* Add functions for:
    * Retrieving nodes via their legal identity
    * Filtering a set of public keys down to those the node has corresponding private keys for
* Modify contract upgrade flows to handle identifying participants after an anomymisation step
* Correct terminology: "party who" -> "party which"
* Modify CashIssueFlow and CashPaymentFlow to optionally use an anonymous identity for the recipient.
2017-06-28 13:47:50 +01:00
Katarzyna Streich
58da76c052 Network map redesign: Change field types in NodeInfo, move away messaging data from NodeInfo (#921)
* First stage of changing fields in NodeInfo.

Part of work related to NetworkMapService upgrade. Create slots for
multiple IP addresses and legalIdentities per node.

* NodeInfo stores HostAndPort.

Move information specific to messaging layer away from NodeInfo.
Only HostAndPort addresses are stored. Add peer name - peer handle
mapping to MockNetwork to reflect that change.
2017-06-27 18:14:51 +01:00
josecoll
f8ad5c9d10 Vault Query Service JPA implementation (#840)
* Vault Query Service API implementation using JPA Hibernate

Added queryBy(QueryCriteria) Vault API and Junit tests.

Minor cosmetic API changes following rebase.

Fixes following rebase from master

Upgraded to requery 1.3.1

WIP - removed 'latestOnly' from LinearStateQueryCriteria

WIP - CommercialSchemas V2, V3, V4 testing

WIP - sort out generics handling.

WIP - most general queries completed.

WIP - join queries, contractStateType derivation

WIP - refactoring Requery

WIP - refactored VaultService to extract a VaultQueryService interface (and associated Requery implementation).

WIP - HibernateVaultQuery implementation

WIP - Re-structured all Schema definitions (requery/jpa) and make Hibernate Config reusable.

WIP - Multi-version schema testing, hibernate query testing.

WIP - Custom Criteria and Fungible Criteria impl & testing.

WIP - Kotlin Comparable Generics error

WIP - Party queries all working now

WIP - All VaultQueryTests now working (refactored for AND / OR composition)

WIP - added schema registration in CordaPluginRegistry to enable custom vault queries on arbitrary schemas.

WIP - added new default Sort NULL order to be NONE + added lots more tests for Logical Operator testing.

Mostly identity fixes following rebase from master.

Exception handling and public API cleanup in prep for PR.

Additional tests for Logical Operators; additional tests for NULLS sort ordering; additional logging;

Additional parser to handle Nullable attribute values; added Unary and Collection logical expression handlers

Lots of cleanup: participants; trackBy interfaces; additional fungible tests; parser cleanup and improved support for Java

Removed all traces of Requery implementation.

Further minor cleanup and Junit test fix.

Final identity and schema related identity clean-up.

Revert unrelated changes.

PR review updates: blank lines, isRelevant.

Fixed wiring of updatesPublisher for dynamic trackBy queries.

PR review changes: multi-versioned schema samples and associated dummy contracts moved to test packages.

Fixed problem with sorted queries (not specifying any filterable criteria).

PR review: minor updates to address RP comments.

Typesafe custom query criteria

Cleanup: remove redundant tests.

Further clean-up and make all Java test work successfully.

Remove debugging print statements.

Rebased from master - changes required due to DealState module change.

fixed broken assertion caused by DealState ordering change (different package)

Fixed transaction demarcation issue causing "java.lang.IllegalStateException: Was not expecting to find existing database transaction on current strand"

trackBy() now filters on ContractType and StateStatus (CONSUMED, UNCONSUMED, ALL)

Added tests to exercise RPCOps trackBy and queryBy (RPC smoke test and CordaRPCOps)

Added additional @CordaSerializable annotations.

Updated documentation and referenced sample code.

Added deprecation annotations.

Re-added missing deprecation annotation.

Hibernate debug logging is now configurable and disabled by default.

Introduced common Sort attributes based on the node schemas.

Completely removed NULL_HANDLING sort parameter as this is not supported in JPA.

Revisited and fixed usage of @CordaSerializable.

* Minor fix following rebase from master.

* Remove blank line as per RP PR feedback request.

* Minor Java documentation and example clean-up.

* Disable BFT Notary Service tests.
2017-06-22 10:35:49 +01:00
Ross Nicoll
19ff72a411 Correct ISO country code in names 2017-06-21 14:04:22 +01:00
Shams Asari
a4e4ecff8a Moved FlowStateMachine into an internal package 2017-06-21 12:19:09 +01:00
Matthew Nesbit
6933c8fda3 Move all advanced finance types into finance module.
Fixup after rebase

Also pull in the interpolator code, which is used for financial calculations.

Fix up rebase
2017-06-16 11:19:24 +01:00
Scott James
aab536646f Fixed various compiler warnings, mostly removing unused parameters and replacing calls to getDevX509Name with getX509Name with specific data, this should be a nullop. Remainign compiler warnings will require changing semantics of code 2017-06-16 09:59:52 +02:00
Ross Nicoll
a3fd54bdb0 Modify generateExit to return full set of signing keys
Modify generateExit to return full set of signing keys in preparation for anonymity work meaning
that owner and issuer keys are typically not the same.
2017-06-12 15:49:35 +01:00
josecoll
b5a1cb5109 Removed duplicate identity attribute (parties) from DealState. (#820)
All references to 'parties' now refer to the inherited 'participants' attribute from ContractState.

Samples: all duplicate references to `parties` now changed to `participants`.
2017-06-09 17:33:04 +01:00
Ross Nicoll
35b0ceac0b Clean up cash tests
Clean up cash tests ahead of anonymisation work. This simplifies some boiler plate setup/teardown
and ensures idenities and flows are correctly registered.
2017-06-06 17:09:32 +01:00
Clinton
08cbcac40c Corda publications and JARs now have cord or corda at the start. (#749)
Core corda publications and JARs now have cord or corda at the start (excluding gradle plugins). Removed an unnecessary dependency on test-utils in node-schemas to prevent an evaluation order bug in gradle.
2017-06-06 15:05:47 +01:00
Andrzej Cichocki
101e96d8d7 Rename net to network (#773)
* So net no longer interferes with IntelliJ auto-import of net.* packages
* Use mockNet for MockNetwork to avoid clashing with Node network
2017-06-05 14:00:14 +01:00
Joel Dudley
e5fba5d0af Docsite reorg ahead of beta launch. 2017-06-05 13:37:23 +01:00
Ross Nicoll
e2214c95b4 Change PartyAndCertificate to an aggregate class (#778)
Change PartyAndCertificate to an aggregate class instead of a subclass of Party. This reduces the changes compared to M11, as well as avoiding risk of accidental serialization of a PartyAndCertificate (which may be very large) where a Party is expected.

Cleaned up initial nodes known to the identity service, in particular mock nodes now know about themselves; previously full nodes registered themselves but mock nodes did not.
2017-06-01 18:54:44 +01:00
Joel Dudley
f646936ab8 Updates TwoPartyTradeFlow to use the CollectSignaturesFlow. 2017-06-01 11:08:39 +01:00
Ross Nicoll
34eb5a3b70 Store certificate and path with well known identity (#726)
* Construct standard flows using PartyAndCertificate, and add support for launching
flows that are constructed with PartyAndCertificate or just Party.
* Store PartyAndCertificate in network map service
* Expand identity service to store certificates along with all identities.
2017-05-31 14:45:58 +01:00
Shams Asari
329e5ff17b Introducing InitiatedBy annotation to be used on initiated flows to simplify flow registration.
This removes the need to do manual registration using the PluginServiceHub. As a result CordaPluginRegistry.servicePlugins is no longer needed. For oracles and services there is a CorDappService annotation.

I've also fixed the InitiatingFlow annotation such that client flows can be customised (sub-typed) without it breaking the flow sessions.
2017-05-31 10:50:16 +01:00
Ross Nicoll
a8d4dccea4 Infrastructure for confidential identities
* De-anonymise parties in AbstractStateReplacementFlow flows
* Convert transaction key negotiation to a subflow instead of utility functions
* Add serialization support for CertPath
* Restructure cash flows so that a counterparty flow can be added later
2017-05-26 10:00:57 +01:00
Konstantinos Chalkias
9f2b44f8f7 Rename Timestamp to TimeWindow (#706)
Rename Timestamp to TimeWindow + refactoring
2017-05-25 13:18:49 +01:00
Ross Nicoll
794ce03958 Remove mock identity service
Remove mock identity service and merge it with the in memory identity service. The two services
provide extremely similar functionality, and having two different version for production/test
risks subtle implementation differences. On that note, this patch includes changes to a number
of tests which worked only with mock identity service.
2017-05-19 11:22:47 +01:00
Matthew Nesbit
05a97b11f3 First cut at removing PrivateKey leakage from KeyManagementService
Fixup after rebase

Restore original key property names

Fixup after rebase

Undo extra import that IntelliJ keeps erroneously adding.

Add comments and fix docs for transaction signing.

Fixes after rebase

More fixes after rebase

Address PR requests

Address PR requests
2017-05-18 17:34:04 +01:00
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
Katarzyna Streich
e61a8a7b09 Add missing StartableByRPC annotation. 2017-05-15 13:37:38 +01:00
Roger Willis
6d1462f8eb CollectSignaturesFlow (#560)
* Initial commit for CollectSignaturesFlow, some tests and associated documentation via a new "Flow Library" section of the docsite.

* Refactored the TwoPartyDealFlow to use the CollectSignaturesFlow.

* Added the subclassed CollectsigsFlow to the trader demo, whitelisted it and added a flow initiator for the responder.

* Minor edits to progress tracker.

* Amended as per Rick's comments.

* Generalised this flow, so it now works if more than one signatures have been collected, initially.

* Minor edits to the IRS demo so it uses the CollectSignaturesFlow.

* For debugging purposes...

* Adding CollectsigsFlow support to SIMM Demo.

* Removing debug logging.

* Amended top level comment: transactions can only have one notary.

* Added TODOs as checkTransaction logic is absent.

* Addressed Mike's review comments.

* Minor edit to flow-library docs.

* Updated flow based on Mike's review comments.

* Added two usage examples and updated the tests.

* Made changes to accommodate new CollectSignaturesFlow approach.

* Made changes to SIMM demo to accommodate new CollectSignaturesFlow approach.

* Added abstract check proposal method to two party deal flow.

* Added missing TODOs.

* Addressed Sham's comments.

* Rebased to M11.
2017-05-11 14:37:53 -04: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
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
Katarzyna Streich
ccb8827107 Remove empty CashFlow.kt file. 2017-05-09 09:56:30 +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
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
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
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
josecoll
3d401d1dcb Apply @Suspendable on all flow methods that call vault generateSpend (#612) 2017-05-02 09:38:44 +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
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
39ca3c96f9 Change "size > 0" to isNotEmpty() 2017-04-24 13:29:52 +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
88b5e32ab2 Convert databaseTransaction to extension function on Database. (#537) 2017-04-12 17:15:29 +01: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
gary-rowe
108f171e03 Replace 'by' with 'using' to avoid overloading Kotlin keyword in contracts DSL. Deprecates 'by' with offered replacement. 2017-04-12 12:27:02 +02: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
4853e41a58 Minor: inspector fixes 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
3a7bcee15b Minor: auto-format of module: finance 2017-04-11 15:53:05 +02: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
faef877a8d Converted sealed data types to be data classes 2017-04-04 11:37:56 +01:00
josecoll
413e39903d Fixed bug whereby Cash Exit was not taking into account the issuer reference (#492)
* Fixed bug whereby Cash Exit was not taking into account the issuer reference.
Added additional JUnit tests for coin selection by issuer.
Added some trace logging in AbstractConserveAmount.

* PR review: added additional state with 3rd issuer reference in test.
2017-04-03 17:51:56 +01:00
Matthew Nesbit
51c7f6ca30 Merge pull request #453 from corda/mnesbit-amount-improvements
Modify the Amount concept to allow conversion to from displayable formats
2017-03-31 14:37:32 +01:00
josecoll
73c0fdc118 CashExitFlow now uses coin selection with soft locking. (#481) 2017-03-31 11:47:59 +01:00
Matthew Nesbit
cedfc4e1ad Add a concept of token size to Amount<T> so that conversion to/from indicative and displayable BigDecimal works sensibly
Add an AmountTransfer type to express the concept of asset flows.

Unify the currency amount creators and fix a few old style display conversions in teh explorer cash dialogs.

Modifications according to PR comments.

Change TransferAmount display string as it may not always be a payment.

Update docs
2017-03-30 16:16:11 +01:00
Patrick Kuo
78a0024e00 Fix various deprecated warnings
* Changed deprecated kotlin.reflect.primaryConstructor to kotlin.reflect.full.primaryConstructor
* Changed deprecated kotlin.reflect.memberProperties to kotlin.reflect.full.memberProperties
* Changed deprecated kotlin.reflect.declaredMemberProperties to kotlin.reflect.full.declaredMemberProperties
* Changed deprecated AllComposition to AllOf
* Changed deprecated AnyComposition to AnyOf
* Changed deprecated kotlin.reflect.KotlinReflectionInternalError to kotlin.reflect.jvm.internal.KotlinReflectionInternalError
* Changed deprecated HostAndPort.hostText to HostAndPort.host
* Removed duplicated method net.corda.core.node.recordTransactions
2017-03-30 10:00:46 +01:00
Matthew Nesbit
062dc67ab6 Add Any constraint to Amount token
Signed-off-by: Ross Nicoll <ross.nicoll@r3.com>
2017-03-29 17:11:30 +01:00
Matthew Nesbit
e0a2c76f39 Remove unnecessary parameters to copy()
Signed-off-by: Ross Nicoll <ross.nicoll@r3.com>
2017-03-29 17:11:30 +01:00
Patrick Kuo
9a7d0a0fb5 Replace unused variables with _ after kotlin 1.1.1 upgrade (#456)
* Replace unused variables with _ after kotlin 1.1.1 upgrade
2017-03-29 13:54:40 +01:00
Rick Parker
8ef1d767c9 Consolidate maven repositories (#445)
* Consolidate repositories into root build.gradle
2017-03-28 17:17:40 +01:00
josecoll
0280299104 Soft locking implementation using database coin selection
Fix broken IssuerFlowTest

Fix IssuerFlowTests after rebase.

Resolve conflicts after rebase.

Soft locking converted to use persistent store.
Added additional optional 'includeLockStates' parameter in VaultService states API call.
Added Vault softLocked states query API call.

Fixed commercial paper failing test.
Improved exception handling on soft locking UPDATE statement.

Using SELECT FOR UPDATE to ensure correct soft locking data visibility.
Db query operations moved out of mutex code (as locking managed by underlying DB)

Adjusted logging severity levels.

Adjusted logging severity levels.

GenerateSpending now performing fine grained query for unconsumed states by joining with contract_cash_states table.
Using H2 proprietary cummulative counting feature (using sessioni SET variables)
Refactored and simplified HibernateObserver constructor to enable usage in JUnit tests.

Event generator issues larger random amounts (10,000..1,000,000) to those than are spent (0..10,000)
Adjusted Issue (5:1) and Exit (10:1) generation frequency vs spending.

Minor fixes: added optional lockid into select for spending criteria, set notary, additional trace logging.

Generate Cash Schema by default upon node start-up (as part of NodeSchemaService initialisation).

Explicitly close JDBC statements in finally() blocks.

Tightened HibernateObserver constructor.

Fix CommercialPaper test (was missing auto-generation of CONTRACT_CASH table)

Revert default JVM size back to 200Mb.

Revert default number of iterations in Explorer Node Simulation mode (back to 10000 with .5 sec sleep interval).

Remove redundant setter function.

Added TODO messages indicating Requery / H2 restrictions & caveats.

Consumed states lock updates now performed in general consumed state Update.

Updated/added Soft Locking documentation.

Addressed initial PR comments: use THREAD_LOCAL_KRYO, use AbstractParty, extract helper method, improve readability, address some doc typos

Addressed PR comment: removed lockId from WireTransaction.

Fixed soft locking UPDATE statements.

Improvements to VaultSoftLockManager for auto-registration of soft locks for flows with spendable states (as notifications from vault).
Other optimisations (IssuerFlow no longer explicitly reserve/release issued state) and improvements (soft lock release management of soft locks, docs update)

Performance update: now using Requery for UPDATE in release soft locking (non-composite key statement)

Removed redundant TODO messages (TODO: revisit Kryo bug when using THREAD_LOCAL_KYRO)

Minor fixes following rebase

Fixed failing JUnit following rebase

Addressed MH PR review items (1st pass)

Fix broken JUnit

Significant changes to RDBMS operations within coin selection and soft locking as requested by PR review.
(Removed SELECT FOR UPDATE; added RETRY upon coin selection; reverting partial soft locks)

Addressed a number of PR review requests added by MH (comments/spelling, lockID instantiation, HibernateObserver instantiation, cash schema white-listing usage)

Addressed latest PR review comments from RP.

Minor fixes following rebase from master.

Fixed final failing JUnit (issuer flow concurrent).

Updated TraderDemo to trigger concurrent issuance of cash.

Fixed compiler warning on lockId null check.

Fixed subtle bug in coin selection intermittently surfaced in IntegrationTestTutorial.

Fixed small memory leak.

Removed stray } in logger trace message.

Slight rewording of description of Soft Locking in docs.

Renamed NoStatesAvailableException to StatesNotAvailableException.
generateSpend is now Suspendable (calls sleep method on flow upon coin selection retry).

Added companion function to enable a Strand to sleep but without locking transactional context.

Improved logging, changed to StateNotAvailableException, using Flow sleep upon retry, tweaked SELECT criteria in coin selection, fixed bug when insufficient states selectable, generateSpend is now @suspendable

Improved handling and logging of flow results in Simulation Mode.

Fixed minor error in sleep when not an active flow.

Retry coin selection when unavailable states (as these may become available as new states).
Additional debug logging to highlight and identify H2 coin selection sporadic bug.

Inlined sleep method due to intermittent Quasar error.

Re-introduce selection clause that prevents selection and temporary locking of already locked states (by other flows).
Improved trace logging for coin selection (SQL row level info).
Correctly calling FlowStateMachineImpl sleep (now inlined and working correctly)

Fixed rebase error.

Remove redundant TODO message.
2017-03-27 17:12:33 +01:00
Chris Rankin
19ee4f2d7b Create testArtifacts configuration for 'core' module. (#425) 2017-03-24 13:33:54 +00:00
Chris Rankin
eaf9dad7c9 Remove junit-quickcheck from Corda because it is only used for testing. (#416) 2017-03-23 17:32:14 +00:00
Mike Hearn
afbc8f9b5c De-issuerify the cash payment flow. This makes it easier to use the payment flow from the shell. 2017-03-20 15:14:28 +01:00
Shams Asari
f581844f3f Flow registration takes in a Class object rather than a KClass 2017-03-15 16:32:13 +00:00
Konstantinos Chalkias
afd5521b00 Lazy NodeVaultService.states (#349)
Convert NodeVaultService states to return Iterable (backed by Sequence) Vs the old way using a List. Worth noting this relieves memory pressure as the number of vault states grows.

* remove toList in ContractUpgradeFlowTest
2017-03-13 14:06:47 +00:00
Rick Parker
c4c4c51d7d Kryo serialisation whitelisting and misc enhancements. (#267)
Kryo serialisation whitelisting and misc enhancements
2017-02-28 08:12:18 +00:00
Mike Hearn
b8942a2cc9 Remove the SignedTransaction.id field, which took part in serialisation. Calculate it on demand instead. 2017-02-22 14:16:04 +01:00
Shams Asari
ade32b16cb Java code can now extend core FlowLogics which don't return anything (by using Void? instead of Unit) 2017-02-21 12:20:39 +00:00
Ross Nicoll
3b8d696379 Add missing @Suspendable
Add missing @Suspendable to CashIssueFlow, as well as adding sanity
check to result of starting CashIssueFlow from
IntegrationTestingTutorial.
2017-02-20 10:41:31 +00:00
Ross Nicoll
ed093cdb9d Enforce separation of Party and AnonymousParty 2017-02-16 11:50:33 +00:00
josecoll
fa33336d38 Initial implementation of Vault Persistence using Requery (#191)
* Initial prototyping with Requery as a persistence replacement for Exposed/Hibernate

Applied changes following PR review by RP

Updated timestamp naming (removed committedTimestamp) and StateStatus (removed AWAITING_CONSENSUS) after discussion with RP.

Removed FungibleState and LinearState schemas (and associated tests) - awaiting Requery uni-directional relationship fix.

Added Transaction propagation such that requery re-uses any existing transaction context.

Made requery default logging configurable (disabled by default)

Nullable fields are now truly nullable (in the Kotlin and DDL sense)

Fix for SimmValuation integration test.

Workarounds applied to resolve Requery issues when sharing Transactional context.

Addressed PR review comments from MH.

Further updates following re-review by RP/MH

Further updates following additional PR review comments by RP

Minor update following additional PR review comments by RP

Optimised makeUpdate state processing code.

Resolved conflicts after rebase.

Additional Unit tests and bug fix for correct spending of multiple contract state types within a single transaction.
Required interface change to states() API to take a setOf (ContractStateClassTypes)

Minor code clean-up.

Re-write NodeVaultService consumed state makeUpdate function using SQL.

* Resolve conflict after rebase from master
2017-02-16 11:02:36 +00:00
Ross Nicoll
71babc7019 Remove use of full parties from contract states 2017-02-15 11:43:13 +00:00
Ross Nicoll
98c30f6432 Remove CashFlow
Remove the CashFlow flow, replacing it with CashFlowCommand which can be used for the use-cases
with instructions passed around as an object.
2017-02-09 18:22:58 +00:00
Ross Nicoll
9055c9d9b0 Split CashFlow into three flows
Split CashFlow into independent CashIssueFlow, CashExitFlow and CashPaymentFlow,
so that users can be given access to one but not the other(s).

Signed-off-by: Ross Nicoll <ross.nicoll@r3.com>
2017-02-09 15:43:48 +00:00
Ross Nicoll
47d260625a Add AnonymousParty superclass of Party
Add AnonymousParty superclass of Party in preparation for anonymising parties stored in
contract states.

Signed-off-by: Ross Nicoll <ross.nicoll@r3.com>
2017-02-09 11:37:32 +00:00
Shams Asari
657cfa5d96 FlowException can be thrown from within UntrustworthyData.unwrap for better Java interop, and more checked exception annotations relating to flows 2017-02-06 16:00:52 +00:00
Ross Nicoll
f5c9e4ed59 Remove use of names from contracts
Remove dependency on name data that cash/obligation state objects will not have access to party details (such as name)
once privacy is correctly enforced.
2017-02-06 15:29:11 +00:00
Mike Hearn
cc20a10225 Improve the flow commit API.
Make FinalityFlow do more, and be used more consistently.

Add a new waitForLedgerCommit API that is intended to be used at the end of flows, or at any other point where a flow wants to wait for a transaction to finalise (but the finalisation flow is being done by someone else).

Update the docs a bit.
2017-02-06 12:29:34 +01:00
Ross Nicoll
2f9af7d7dc Revert Party.Full in preference for a less invasive change 2017-02-02 13:47:32 +00:00
Ross Nicoll
1b86ddfd6e Replace Party with Party.Full
Replace Party with Party.Full as an interim step to introducing the Party.Anonymised class.

Signed-off-by: Ross Nicoll <ross.nicoll@r3.com>
2017-02-01 15:18:12 +00:00
Shams Asari
646ce8afe0 FlowException thrown by a flow is propagated to all counterparties 2017-01-31 13:30:33 +00:00
Ross Nicoll
e383752995 Adapt Party comparison to use owningKey
Change Party instances to be uniquely identified by the owning key, without taking into account name.
This requires that mock node key generation is reworked so that keys for services and the node itself
are distinct, otherwise the network map service cannot differentiate them.

Signed-off-by: Ross Nicoll <ross.nicoll@r3.com>
2017-01-30 15:46:51 +00:00
Mike Hearn
4e65200a04 Docs: some improvements and code samples for progress tracking in flows 2017-01-19 15:51:27 +01:00
Ross Nicoll
2efd44d46b Clean up semantics of composite clauses
This deprecates the existing composition clauses and adds new better named versions,
as well as changing 'AnyOf' to require at least one matching subclase (better matching
the name of the clause).
2017-01-17 11:34:21 +00:00
Mike Hearn
ef6e9786a8 Cleanup: improve api docs on FlowLogic, make it clearer when stuff is considered internal, rename an obscurely named field. 2017-01-12 13:30:10 +01:00
Shams Asari
e589031d4b Some clean up of the flow code 2017-01-11 16:33:59 +00:00
Ross Nicoll
1fbad81773 Correct message when checking signing keys
The keys used to sign a command are tested for being a superset of the keys which own
the states, not for being an exact match (as the text previously suggested). This corrects
the message used if this requirement isn't met.

Signed-off-by: Ross Nicoll <ross.nicoll@r3.com>
2017-01-10 13:19:43 +00:00
Andrius Dagys
b9d5081af6 Update notary change flow to support encumbrances (#101)
* Update notary change flow to support encumbrances.

Move encumbrance pointer from ContractState to TransactionState.

* Refactor & add new encumbrance tests
2017-01-05 17:44:31 +00:00
Mike Hearn
875efbfa11 Merge pull request #106 from corda/mike-thread-affinity-for-smm
Additional thread affinity for the StateMachineManager.
2017-01-05 11:03:35 +01:00
Mike Hearn
1a53834a60 Additional thread affinity for the StateMachineManager.
Check that the SMM.add method is being called on the SMM thread and throw if not. Make ServiceHubInternal.startFlow() do a blocking call onto the server thread. Update unit tests.

This resolves an issue whereby the scheduler was starting flows outside of the server thread, which isn't intended.
2017-01-04 16:06:33 +01:00
Mike Hearn
119d00c384 Upgrade dependencies and centralise some more version numbers in the root gradle file 2017-01-04 15:44:56 +01:00
josecoll
eac2cb1cc6 Bank of Corda integration with Trader Demo and Explorer
Initial conversion of Explorer to use IssuerFlow (from BankOfCorda)

Initial conversion of TraderDemo to use IssuerFlow (from BankOfCorda)

Updated TraderDemo to use IssuerFlow (from BankOfCorda)

Fixed TraderDemo integration text (added new BankOfCorda node)

Updated Explorer with changes IssuerRequest params

Explorer now correctly displaying transaction id upon Issue.

Moved IssuerFlow into finance package so can be reused across multiple demos (TraderDemo) and applications (eg Explorer)

Refactored BankOfCorda demo to use Finance package and TestUtil constants

Updated TraderDemo to use IssuerFlow

Updated Explorer to use finance package IssuerFlow.

Advertised BankOfCorda as Issuer for usage by Explorer.

Explorer no longer depends on BankOfCorda demo since IssuerFlow promoted to Finance module

Added IssuerFlow to AbstractNode whitelist.
Explicit declarations of IssuerFlow no longer required.

Added plugin registration of IssuerFlow at bootstrap.

Revert whitelisting of IssuerFlow (plugin configured)

Refactored to use constant BOC definition.

Added gradle RPC security config.

Updated documentation

Fixed incorrect references.

Renamed Issuer banks.
Added new permission set (for Issuer nodes)
Added node nearestCity info
Added new Issuer Event Generator for Issuer nodes only

Associated currency with issuer using ServiceType naming structure.

Added argument flag (-S) to trigger event generator simulation node.

Fixed problem with issuers not resolving from network map.

Updated perms on Issuer rpc proxy nodes.

Fixed minor in cash generateExit identified by Explorer.

Changes applied in prep for AWG demo.

Added IntelliJ run-configurations for launching Explorer demo nodes (with and without simulation)

Updated documentation (and added additional gradle task to launch Explorer nodes in simulation mode).

Fix following rebase.

Addressed review items from PR.

Updated TraderDemo readme.

Updated TraderDemo gradle file to launch Bank of Corda node.

Updated JRE properties.

Updated IssuerModel to incorporate correct JFX Observable handling.
Fixed bug with Exit command not displaying any currency.

Added TODO's for revisiting correct Exception handling strategy.

Optimization for when issuing cash to self.

Minor updates following PR review.

Remove old refs to Royal Mint and Federal Reserve
2016-12-22 15:55:50 +00:00
Andras Slemmer
2f12f79f19 CashFlow progress tracking, remove unused clientToService stream 2016-12-20 10:20:37 +00:00
Clinton
b43d940297 Merge pull request #35 from corda/clint-M6publishing
Corda can be published to bintray and reduced publishing boilerplate in build.gradle.
2016-12-09 15:07:46 +00:00
Andras Slemmer
a601f0abf5 Local RPC, demos use RPC, NODE has special privileges 2016-12-08 11:58:31 +00:00
kasiastreich
036b1b4964 Fix double spending of inputs issue on ledger level in test dsl. (#15)
* Fix double spending of inputs issue on ledger level in test dsl.

* Address PR comments.
2016-12-08 10:15:33 +00:00
Matthew Nesbit
f63e6cd2a6 Add some hooks to StateMachineManager and NodeSchedulerService so that unit tests of flows with scheduled actions can safely test for completion of their test activities. Typically this is done using a while loop whilst there are active fibers, or schedules and then blocking on the ReusuableLatches until the status changes and can be re-evaluated.
Add unit tests of ScheduledFlow running on simulated network.

Just use existing DumyContract in test

DummyContract requires value equality so that assertEquals over states works as expected.

Remove blank line.

Add TODO on waitQuiescent.

Fix minor build error
2016-12-07 16:11:55 +00:00
Clinton Alexander
b24c628e34 Publications now publish JARs again. Install task now publishes again. 2016-12-06 16:06:16 +00:00
Clinton Alexander
bf49dda731 Corda now publishes with updated publish utils. 2016-12-06 16:06:16 +00:00
Clinton Alexander
6ecbe1f1fd Added finance publishing. 2016-12-06 16:06:16 +00:00
Mike Hearn
7b40be8361 Run the IntelliJ reformatter across the Kotlin code. Did not reformat JS/web code. 2016-11-30 14:40:34 +00:00
rick.parker
492005bcfe Fix up and improve some docs 2016-11-24 15:06:10 +00:00
rick.parker
f68529d1fd Rename protocol to flow. 2016-11-22 17:17:14 +00:00
Andrius Dagys
93505d5e2e Merged in andrius-rename-bits (pull request #508) 2016-11-22 08:26:37 +00:00
Andrius Dagys
64299591c3 Rename PublicKeyTree -> CompositeKey and unify terminology across documentation. 2016-11-21 14:47:19 +00:00
Andrius Dagys
635ee8df79 Rename bits -> bytes, as it normally indicates a byte array 2016-11-21 13:02:27 +00:00
Clinton Alexander
063dbec505 Merged in clint-bintray (pull request #496)
Removed duplicate gradle plugins and added bintray publishing tasks
2016-11-21 11:20:13 +00:00
RogerWillis
c0be0db762 Clean up. 2016-11-18 17:43:10 +00:00
RogerWillis
bd75d92e13 Removed random JavaFx import. 2016-11-18 17:41:09 +00:00
RogerWillis
b1dbd2a07c Suppressed unused variable compiler warnings. 2016-11-18 17:35:53 +00:00
Clinton Alexander
bf70091172 Now depending on the plugins in jcenter and not buildsrc. 2016-11-18 14:41:06 +00:00
Clinton Alexander
14ca7847d0 Publishing to jcenter possible via bintrayUpload (with the correct credentials) and corda now has a dependency on the published gradle plugin to allow the split. 2016-11-18 13:02:04 +00:00
Andras Slemmer
dcd7a8a08a Address PR 465 comments 2016-11-15 16:51:07 +00:00
Andras Slemmer
7f0dd1ab5b Generic startProtocol and typesafe wrappers, per-protocol permissions, CashProtocol, remove executeCommand, move almost all Cash-related things to :finance 2016-11-15 16:46:37 +00:00
Andrius Dagys
d00163e29d Stop using "legally-Identifiable" signatures for the notary protocol, as notary nodes will use their service identity to sign (and not the legal one). It also doesn't make sense to attach an identity on the signature if it's a group identity and the signer holds only 1 out of many keys. 2016-11-14 16:02:20 +00:00
Andrius Dagys
c33c55eb20 Replace PublicKey with PublicKeyTree in Party. A single entity can now be identified by more than one key. 2016-11-14 14:57:16 +00:00
Mike Hearn
ce99f354cb Rename com.r3corda -> net.corda 2016-11-10 17:14:24 +01:00
Katarzyna Streich
103817ec57 Add signing of transaction merkle root hash. 2016-11-08 17:41:32 +00:00
Clinton Alexander
7e198e7cf3 Renamed contracts project to finance to better reflect the purpose of the project. 2016-11-04 13:35:25 +00:00