Commit Graph

196 Commits

Author SHA1 Message Date
Andras Slemmer
cde315aca9 contracts, node: Port CommercialPaperTests, TwoPartyTradeProtocolTests and GroupToGraphConversion to use new dsl 2016-07-06 13:25:08 +01:00
Shams Asari
5c0e7fbbf2 Moved topic parameter from send/receive methods to a ProtocolLogic property 2016-07-05 15:12:25 +01:00
Ross Nicoll
2121824662 Rename com.r3cord.contracts.cash package to ...asset 2016-06-30 13:31:59 +01:00
Ross Nicoll
6dad7efa22 Replace references to cash, with (fungible) asset 2016-06-30 12:47:18 +01:00
Shams Asari
a02263937c send and sendAndReceive use Party for the destination 2016-06-30 12:04:39 +01:00
rick.parker
5271882dcd Event scheduling and docs for event scheduling 2016-06-30 08:51:52 +01:00
Ross Nicoll
c767638127 Move DummyContract.State into its own file
DummyContract.State isn't actually used by the DummyContract any more, so shouldn't
be part of that contract class.
2016-06-29 17:16:46 +01:00
Ross Nicoll
dc304199c8 Remove warnings from Obligation contract 2016-06-29 13:27:00 +01:00
Ross Nicoll
228513671d Move Obligation contract into contracts module 2016-06-27 17:54:04 +01:00
Ross Nicoll
9994d129f2 General cleanup based on first round of feedback
* Rename AggregateCommands to IssuanceCommands
 * Reorder comparisons to be consistent
 * Rename verifyDefaultCommand to verifySetLifecycleCommand
 * Rename currency to issued/product
 * Add note about needing to rethink timestamping
 * Rename issuer to obligor, and owner to beneficiary
 * Move lifecycle inversion code into SetLifecycle command
 * Correct comments regarding cash states
 * Rework description of contractHash parameter
 * Fixes 'netting equal balances due between parties', and add further netting tests
 * Separate calculations involving issued products and the underlying product
 * Use signed transactions in obligation tests
 * Add verification tests for changing lifecycle
2016-06-27 17:49:52 +01:00
Andras Slemmer
bc326660a3 contracts, core: Fix static init cycle issue of JavaTestHelpers 2016-06-24 16:37:43 +01:00
Andras Slemmer
341adafd3a contracts, core: Rename Java to JavaTestHelpers 2016-06-24 16:37:43 +01:00
Andras Slemmer
040e51ec12 contracts, core: Expose top-level DSL values/functions to Java by wrapping them in an object
core: Add overloads for convenient Java interop

contracts, core: Uniform Java interop for tests, use camelCase
2016-06-24 16:37:43 +01:00
Andras Slemmer
28e85923a3 core: Add CashTestsJava.java, containing some of CashTests.kt in Java 2016-06-24 16:37:43 +01:00
Mike Hearn
2dfcff1f31 Testing: Fix the wallet filler code. 2016-06-24 17:13:27 +02:00
Andrius Dagys
aaeb99ac25 Validating notary: check for missing signatures. The notary can only sign if all other signatures are present
Please enter the commit message for your changes. Lines starting
2016-06-23 16:15:14 +01:00
Ross Nicoll
d24ec06b40 Add netting support structures
Add NetType enum for use in contracts which deal with netting
Add BilateralNettingState interface
Add support for more complex issued things
2016-06-22 14:30:06 +01:00
Mike Hearn
7ee6bd05ce Refactor the wallet code:
- Rename NodeWalletService to InMemoryWalletService and move into the core module where it's available for unit testing.
- Make a new NodeWalletService that just inherits from InMemoryWalletService and doesn't customise it at all, for now.
- Take the cash specific functionality out of Wallet and into an extension property in the Cash contract (this compiles as CashKt.getCashBalance(wallet) for java users).
- Return the generated states in the fillWalletWithTestCash function.
2016-06-22 14:49:52 +02:00
Mike Hearn
f3d4639059 Testing: make the WalletFiller code a file-level singleton and fillTestWithCash an extension method. For Java users not much changes, the class is still called WalletFiller and the signature remains the same. Re-order some arguments to make it easier to use when accepting the defaults. 2016-06-22 14:49:52 +02:00
Mike Hearn
cdb3e2f126 Minor: move WalletFiller from node.testing to contracts.testing 2016-06-22 14:49:52 +02:00
Mike Hearn
a16ae677ed Minor: fix some inspector warnings in IRSTests 2016-06-22 13:46:57 +02:00
Mike Hearn
749949669f Minor: Make a few class field names and constructor layouts more consistent. 2016-06-22 13:46:57 +02:00
Mike Hearn
5a3c9caffd Minor: Remove some unused parameters in a unit test utility method 2016-06-22 13:46:57 +02:00
Richard Green
6b80530ac6 Changed DateOffset to be an integer instead of enum. Usages and examples also changed. Also renamed to fixingPeriodOffset
Renamed fixingPeriod -> fixingPeriodOffset in the .json files
2016-06-21 18:17:39 +01:00
Ross Nicoll
723e610dfc Rename verifyMoveCommand()
Rename verifyMoveCommands() to verifyMoveCommand() to represent that move commands must
be singular within a transaction.
2016-06-20 16:08:16 +01:00
Ross Nicoll
af53a52b06 Add common Issue and Move commands
* Add common Issue command to encourage presence of a nonce value when issuing state objects.
* Add common Move command for contracts which support being moved in order to fulfil other contracts.
2016-06-20 16:08:16 +01:00
Andras Slemmer
a2e6e78b16 contracts: Remove warnings 2016-06-20 14:16:13 +01:00
Andras Slemmer
c9cb024bb5 Merged in use-urandom-2 (pull request #166)
Use urandom 3
2016-06-20 14:15:03 +01:00
Andras Slemmer
a7419b116d Add newSecureRandom() that uses a non-blocking SecureRandom provider on Linux 2016-06-20 14:11:03 +01:00
Andrius Dagys
30ca340b6e Refactored NotaryChangeProtocol and tests: moved the proposal verification step into the protocol.
Added another proposal verification step in the NotaryChangeProtocol.
Added the cause exception message to the 'notary change refused' error.
2016-06-17 15:05:35 +01:00
Andrius Dagys
0a5b7ace35 Made TransactionBuilder abstract. Every transaction type now needs to implement and provide its own Builder. This is required since for specific types we need to run different logic when adding new items to the transaction. For example, when adding a new input state to a transaction of type NotaryChange we need to add all of the states participants to the signers list. 2016-06-17 15:05:35 +01:00
Andrius Dagys
9958b5c603 Added 'signers' property to the transaction data models. Signers holds the list of all public keys that need to be signed for (command keys and additional ones such as notary).
Removed Notary & ChangeNotary commands, keys to be signed for are added to the signers list during transaction build phase.
2016-06-17 15:05:35 +01:00
Andrius Dagys
70495a021e Introduce TransactionState, which wraps ContractState and holds the notary pointer.
Remove notary from ContractState.
Introduce TransactionType, which specifies custom validation logic for a transaction.
2016-06-17 15:05:35 +01:00
Andrius Dagys
3b1e020082 Extended the data model so that every state has to define a set of 'participants' - parties that are able to consume that state in a valid transaction.
Added protocol for changing the notary for a state, which requires signatures from all participants
2016-06-17 15:05:35 +01:00
Andras Slemmer
0c325c31a2 Revert "Merged in use-urandom-2 (pull request #159)"
This reverts commit 1a1ed3b9e6, reversing
changes made to 09e2e49d44.
2016-06-17 14:12:19 +01:00
Andras Slemmer
1a1ed3b9e6 Merged in use-urandom-2 (pull request #159)
Use /dev/urandom try no.2
2016-06-17 13:36:23 +01:00
Andras Slemmer
9ec1ec786f contracts: remove TODO 2016-06-17 13:27:35 +01:00
Andras Slemmer
a72bab0fb7 contracts: make test compile 2016-06-17 13:27:35 +01:00
Andras Slemmer
906c100c29 contracts: use newSecureRandom() instead of SecureRandom.getInstanceStrong() 2016-06-17 13:07:25 +01:00
Ross Nicoll
ad72f3e48f Add issuer to cash amounts
Add issuer of a cash when referring to amounts of cash (except for the very few cases where
the issuer is not important, such as when referring to aggregated totals across a set of
issuers). Replaces CommonCashState with TokenDefinition, as a more accurate reflection of
what the class represents.
2016-06-16 15:05:49 +01:00
Ross Nicoll
eae3efdf02 Minor: Edit reference after copying amount
Edit reference after copying amount in cash tests, so that when the amount includes
a reference, the copying doesn't replace the changed reference.
2016-06-16 15:04:33 +01:00
Shams Asari
860353c4d4 Initial checkpoint when protocol is first added 2016-06-16 09:54:49 +01:00
Ross Nicoll
f831ffdf3d Add tests for TransactionGraphSearch 2016-06-15 16:21:53 +01:00
Clinton Alexander
7e15445ee9 Removed the CrowdFund contract since it is written in a style that is not typical of Corda contracts. 2016-06-15 12:32:36 +01:00
Richard Green
3ab3955213 . 2016-06-14 11:57:55 +01:00
Richard Green
2ce0dce0aa . 2016-06-14 11:28:58 +01:00
Richard Green
86203709c0 Payment dates now are calculated as an offset to the period end date 2016-06-13 19:00:27 +01:00
Richard Green
12f3e4802c Change to the comments that we have discussed the possibility of allowing code such as 0.1.percent 2016-06-13 16:24:49 +01:00
Andrius Dagys
21f53a7d3e Revert "Revert "Merged in validating-notary (pull request #123)""
This reverts commit e64145991e.
2016-06-07 13:53:00 +01:00
Ross Nicoll
f4f0e160d2 Genericise Cash contract to support non-Currency things
Split the verification and commands for the Cash contract into a new AbstractCashLike
class, and make Cash a concrete implementation of that class, specialised for dealing
with Currency as the underlying token.
2016-06-07 13:49:26 +01:00
Andrius Dagys
e64145991e Revert "Merged in validating-notary (pull request #123)"
This reverts commit d9f4e4da2e, reversing
changes made to 654dc3f60a.
2016-06-07 12:29:27 +01:00
Andrius Dagys
c45bc0df20 Split up Notary protocol into Client and Service parts. The Service protocol can be extended to provide additional transaction processing logic, e.g. validation.
Implemented a Simple and Validating Notary services.
2016-06-07 10:58:34 +01:00
Ross Nicoll
d7b367965f Genericise Amount class
Make the Amount class generic so it doesn't have to represent a quantity of a
currency, but can handle other things such as assets as well, or extended detail
(for example a currency-issuer tuple).
2016-06-01 11:58:13 +01:00
Ross Nicoll
fc62010da6 Move cash contract into its own package 2016-05-31 17:07:36 +01:00
Ross Nicoll
ee5088066c Add unit tests covering cash sum methods 2016-05-31 14:21:29 +01:00
Matthew Nesbit
63a5fd1b9e Add com.r3corda to all namespaces. 2016-05-23 14:53:56 +01:00
Matthew Nesbit
1d5f409c66 Remove unnecessary .Companion statements brought in during refactoring. 2016-05-20 16:43:03 +01:00
Matthew Nesbit
69cba98ddc Push unit tests that needed some contract functionality into core by embedding the minimal contract support needed. 2016-05-20 16:43:02 +01:00
Matthew Nesbit
f6f56797ce Refactor code into clear core, contracts and node namespaces. Move services into clear implementation and api sides. Push unit tests down to lowest level of dependency hierarchy possible. 2016-05-20 16:42:59 +01:00
Matthew Nesbit
a556dfb17d Push internal subsystems into node 2016-05-20 16:42:56 +01:00
Matthew Nesbit
058ac986bd Move contracts base files to namespace to make api aspect clearer in includes.
Move Party to core.crypto as Party is closely aligned with the signing and used in code areas unrelated to the contract code.
2016-05-14 13:47:07 +01:00
Andrius Dagys
fa3f7e7fa6 Added a basic Notary service with protocol for signing transactions 2016-05-13 16:17:50 +01:00
Rick Parker
539e23a0b1 Merged in plt-141-moves-only-part-3 (pull request #93)
File and interface moves to core module for scheduler
2016-05-13 15:17:32 +01:00
Ross Nicoll
25e2c4bc4d Add issuance definition for cash contract
Add issuance definition for cash contract, as well as common interfaces to support later
extensions. The issuance definition encapsulates the core values for state objects when
issued, and essentially acts as the Ricardian contract for Corda states.
2016-05-13 14:55:12 +01:00
rick.parker
1ce8a64938 File and interface moves to core module 2016-05-13 14:03:28 +01:00
Richard Green
62e7dc583e Expanded the verify() function for the IRS Contract 2016-05-10 15:32:08 +01:00
Ross Nicoll
c6fab1c642 Remove superfluous semicolon 2016-05-09 18:16:40 +01:00
Ross Nicoll
642b951bae Rename PartyReference to PartyAndReference 2016-05-09 17:55:37 +01:00
Ross Nicoll
252eb141a7 Require that a cash Issue command is the only command
Require that a cash Issue command is the only cash command in a transaction.
Although no problems are anticipated with other commands being present, they
could theoretically confuse other verification tools.
2016-05-09 16:55:44 +01:00
Ross Nicoll
a205475ef0 Move cash contract Issue instruction verification into its own function 2016-05-05 11:12:58 +01:00
Ross Nicoll
73f4803b72 Move common move command verification into a shared function 2016-05-05 11:12:25 +01:00
Mike Hearn
fcc36c472a Improve the contracts API and Cash contract a bit, and beef up the unit tests.
Better usage of generics in groupStates so the group exposes the grouping key that was used, this avoids constructs like `val issuer = outputs[0].deposit.party` which is a bit ugly.
2016-04-20 14:36:14 +02:00
Mike Hearn
7a9f74ca79 Merge branch 'master' into dynamic-loading 2016-04-13 19:03:04 +02:00
Mike Hearn
eb3632b393 Minor: timestamping service is now named just "Timestamping Service" instead of "European Timestamping Service" 2016-04-13 15:20:27 +02:00
Andrius Dagys
9a8b3bd1ef Added interpolation functionality for the rates oracle. The oracle can be set up with different interpolation mechanisms, currently supported are: linear and cubic spline 2016-04-13 12:32:04 +01:00
sofusmortensen
d05e6bb6a4 Merge branch 'master' into dynamic-loading 2016-04-09 01:01:36 +02:00
sofusmortensen
6fe8107d27 Merge branch 'master' into dynamic-loading 2016-04-08 22:40:18 +02:00
Mike Hearn
49d5fb33c4 Remove copyright headers from the files and put the text in the README instead, per feedback from Jacob and external counsel. 2016-04-08 11:46:07 +02:00
Mike Hearn
caf48b65c9 Run auto-formatter over the code. 2016-04-07 20:16:28 +02:00
Mike Hearn
f3863ac5ef Minor: eliminate compiler warnings 2016-04-07 20:00:29 +02:00
Mike Hearn
6a0d7d4a0d Minor: fix trader demo (names got out of sync) 2016-04-07 19:36:15 +02:00
Mike Hearn
0ad6a30fee Minor: optimise imports and auto-format in IRS.kt 2016-04-07 19:32:06 +02:00
Mike Hearn
e91872b78d Minor: support another dummy timestamping service in the IRS contract 2016-04-07 19:32:06 +02:00
rick.parker
55265e6115 IRS related protocols and scripts
Additional changes based on feedback

Additional changes based on feedback
2016-04-07 14:56:30 +01:00
sofusmortensen
88a7406ec9 Merge branch 'master' into dynamic-loading 2016-04-03 13:59:36 +02:00
rick.parker
e122a57bf2 First working commit
First working commit

Formatting clean up

Revert All_tests.xml

Remove extra space

Feedback from code review
2016-03-30 15:04:08 +01:00
sofusmortensen
e5dbf5d2a8 WireTransaction deserialization using AttachmentStorage 2016-03-24 12:06:41 +00:00
sofusmortensen
1344bfd6bb Replaced programRef in ContractState with a simple reference to contract 2016-03-23 17:51:14 +00:00
Richard Green
a78c5b11d1 IRS Contract example 2016-03-22 11:36:40 +00:00
Mike Hearn
e9fddbc709 Reorganise the file hierarchy a bit. 2016-03-08 11:06:16 +01:00
Mike Hearn
7f5eb5bf2f Minor: make TwoPartyTradeProtocolTests use the new MockNode infrastructure 2016-03-02 14:51:42 +01:00
Richard Green
bc8962b0dc Minor: Moved JavaCommercialPaper.java from src/main... to contracts/src/main 2016-02-23 14:14:01 +00:00
Mike Hearn
cd28733360 Major: Separate out the dep resolution protocol into a couple of sub protocols and use on both sides of the trade.
* Dependency resolution/checking is now working on both sides of the two party trading protocol.
* The commercial paper contract was changed to check timestamping authority identities by name instead of key.
* The trader demo has been rewritten to use the protocol framework, which simplifies the code.
2016-02-17 18:11:37 +01:00
Mike Hearn
df4d926bca First pass at implementing dependency resolution and checking in the two-party trade protocol.
This commit is incomplete: only the seller side currently checks. The code will be refactored out into subprotocols in further commits.

Note that timeouts are currently unhandled.
2016-02-17 17:19:36 +01:00
Sofus Mortensen
994abb3edb Added new project core.
Project Contracts depends only on core.
2016-02-16 17:14:17 +01:00
Sofus Mortensen
cbfcac994a New separate project for contracts. Canonicalization. 2016-02-16 17:14:17 +01:00