Commit Graph

100 Commits

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