Commit Graph

75 Commits

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