Commit Graph

175 Commits

Author SHA1 Message Date
Ross Nicoll
5ff28df1ff Modify cash issuance tests to ensure transaction does not need notary signature 2016-08-25 16:28:46 +01:00
Mike Hearn
c8323099bb Minor: cleanup the commercial paper contracts.
There's no need for the notary to be specified in commands. A few other tweaks and additions found whilst refreshing the docsite.
2016-08-25 11:30:25 +02:00
Ross Nicoll
59d3cbdece Add documentation around Commodity and CommodityContract 2016-08-23 17:40:45 +01:00
Mike Hearn
3e330a2d36 Merged in mike-fix-walletfiller (pull request )
Rewrite the test wallet filler code to not be buggy.
2016-08-23 17:59:19 +02:00
Ross Nicoll
e3ef4ce3b3 Merged in rnicoll-cash-destroy-own (pull request )
Restrict cash exit commands to working on cash held by the issuer
2016-08-23 14:15:54 +01:00
Ross Nicoll
03e120d04b Add default values for ifMatched/ifNotMatched/requiredCommands 2016-08-23 11:23:47 +01:00
Ross Nicoll
dc2f4055fc Restrict cash exit commands to working on cash held by the issuer
Remove the ability to exit cash not held by the cash issuer; this solves a number of problems:

* Ensuring owner of the cash is aware of the funds being destroyed
* Determining where to send any change resulting from partial exiting of funds
* Auditing the destruction of funds
2016-08-22 17:17:19 +01:00
Mike Hearn
097bb033c4 Rewrite the test wallet filler code to not be buggy. 2016-08-22 16:26:32 +02:00
Matthew Nesbit
413060aa6d Don't use single line style for verify 2016-08-19 12:05:32 +01:00
Matthew Nesbit
696b9741dd Remove ClashingThreads exception by tightening up unique id on LinearState to be a secure random value, with constraints that it cannot be duplicated. Also, rename to linearId rather than the confusing thread.
Try providing a helper interface to encourage enforcing LinearState rules

Fixup after rebase

Change to using Clauses for verifying LinearState standard properties

Fix whitespace change

Tidy up ClauseVerifier after PR comments

Change from SecureHash to a TradeIdentifier class

Change TradeIdentifier to UniqueIdentifier
2016-08-19 11:52:16 +01:00
Ross Nicoll
a3d37a4d00 Require notary to be explicitely stated on each transaction 2016-08-12 15:51:04 +01:00
Ross Nicoll
17ae349f4d Remove support for timestamp commands 2016-08-12 13:51:34 +01:00
Ross Nicoll
f0aa5a30d4 Deprecate existing timestamp infrastructure 2016-08-12 13:51:34 +01:00
Ross Nicoll
162d19deeb Change how clause verification is called
Change away from extending ClauseVerifier for contracts which support clauses, and explicitely call
clause verification code in the verify() function. This should make the flow of control easier to understand.
2016-08-11 15:39:11 +01:00
Clinton Alexander
ec693d37f6 Replaced remaining arrays with lists where possible. 2016-08-10 13:56:49 +01:00
Clinton Alexander
9fb8061ba4 Replaced array with list to fix comparisons. 2016-08-10 11:10:38 +01:00
Mike Hearn
87047c8996 Minor: fix various inspector warnings and delete some dead code. 2016-08-09 11:55:40 +02:00
Mike Hearn
da63ad57a4 Minor: run intellij "code cleanup" on all but javascript files. 2016-08-08 18:05:02 +02:00
Mike Hearn
25f65a60c7 Address review comments. 2016-08-05 14:04:07 +02:00
Mike Hearn
701fc853ad Refactor the core transaction types to improve clarity, simplify verification and prepare for sandboxing.
Changes include:
- LedgerTransaction is now much more central: it represents a fully resolved and looked-up tx, with the inputs available.
- TransactionGroup and TransactionForVerification are gone. There is a temporary TransactionForContract class for backwards
  compatibility but it will also be gone soon.
- ResolveTransactionsProtocol is simplified, and now commits a tx to the database as soon as it's determined to be valid.
- ServiceHub is now passed in more consistently to verification code, so we can use more services in future more easily e.g. a sandboxing service.
- A variety of APIs have been tweaked or documented better.
2016-08-04 13:05:50 +02:00
Mike Hearn
ba05b90b8f Testing: change fillWithTestCash to issue cash under the DUMMY_CASH_ISSUER identity and adjust code that uses it. Introduce some code that'll prove useful later in WalletWithCashTest.
This change reduces the  testing confusion that can occur when cash is issued by one of the parties in a transaction rather than e.g. a neutral third party like a central bank.
2016-08-04 12:52:01 +02:00
Ross Nicoll
8539a7c9d3 Clean up contracts
* Merge common code between Cash and CommodityContract into OnLedgerAsset
* Move spend/exit tx generation logic into the clauses
* Add generateExit() function for Obligation
2016-08-03 17:29:55 +01:00
Mike Hearn
0662798b0f Introduce some new cryptographic utility functions
1. Function for converting raw entropy into an EDDSA key pair. This is useful for unit tests when you don't want a random key but would rather be able to identify it from the logs by eyesight, and will be useful later also when implementing deterministic key derivation.
2. Function that can format any collection of public keys using the bitcoin-style base58 form.
3. A dummy NullSignature object, again, useful for tests when you don't want to provide a real signature.

Then set a handful of dummy unit testing keys to predictable/fixed values.
2016-08-01 16:42:56 +02:00
Mike Hearn
b40fee1512 Allow for easier conversion from Amount<Issued<T>> to Amount<T> and de-issuerify a few places. 2016-08-01 16:42:56 +02:00
Ross Nicoll
a44d3edebf Correct obligationTestRoots to cashObligationTestRoots 2016-08-01 15:05:00 +01:00
Ross Nicoll
0ac29bec26 Merged in rnicoll-obligation-fungible (pull request )
Add commodities to provide worked example of a different thing under Obligation
2016-08-01 14:26:13 +01:00
Ross Nicoll
e1d1aed541 Add commodity contract and test obligations can be settled for it 2016-08-01 14:20:04 +01:00
Ross Nicoll
406196fb69 Add missing checks on settled amount
The obligation `Settle` command takes in an amount to be settled, but only uses the underlying token from it.
This enforces that the settled amount matches the value seen moving.
2016-08-01 14:19:07 +01:00
Clinton Alexander
7d39a101d4 Merged in COR-276 (pull request )
Added Jacoco code coverage to gradle.
2016-07-29 13:29:47 +01:00
Mike Hearn
5167ed7df2 Merged in mike-fix-irs (pull request )
Fix how the IRS contract uses fix commands
2016-07-28 10:19:16 +02:00
Clinton Alexander
188fc29436 Cleaned up build.gradle files. 2016-07-28 09:17:49 +01:00
Mike Hearn
1a9cdf992f Fix an issue in the IRS contract where it was expecting two different kinds of fix command simultaneously for apparently no good reason. The unit tests didn't spot that because the unit test wasn't actually verifying the constructed transactions: fix that too.
Uncovered during the tx types refactoring work.
2016-07-27 14:38:21 +02:00
Mike Hearn
62e91000e9 Minor: some minor tweaks to IRSUtils types 2016-07-27 14:37:32 +02:00
Mike Hearn
889b74ca9b Minor: apply some inspector and reformatting cleanups to IRS.kt 2016-07-27 11:17:00 +02:00
Andrius Dagys
2142bd1d8a Added Log4j bindings for SLF4J. Test log output is redirected to the console, and demo output is now additionally stored in a rolling log file. 2016-07-22 16:15:00 +01:00
Ross Nicoll
f25e19ed5e Add Cash.generateExit() function 2016-07-20 13:20:43 +01:00
Andrius Dagys
c442cd01a7 Merged in andrius-cleanup-tweaks (pull request )
Remove the "verify correct notary has signed" check from TwoParty protocols
2016-07-18 10:40:25 +01:00
Ross Nicoll
c32af56b41 Rebuild commercial paper contracts using clauses 2016-07-13 16:55:18 +01:00
Ross Nicoll
e03dd19979 Rebuild IRS contract using clauses 2016-07-13 16:15:01 +01:00
Ross Nicoll
49b58d8a43 Split IRS verification into individual functions 2016-07-13 13:19:51 +01:00
Ross Nicoll
cba3aab96e Rebuild asset contracts using clauses 2016-07-13 13:08:23 +01:00
Ross Nicoll
ea051d57be Move clauses into main 2016-07-13 11:48:51 +01:00
Mike Hearn
ead19c619a Merged in mike-cp-issuance-fix (pull request )
Disentangle the concept of CP issuer vs underlying redeemable asset issuer in the CP contract.
2016-07-13 11:13:23 +02:00
Ross Nicoll
15bc48b49b Minor: Add note about refactoring TwoPartyTradeProtocol 2016-07-12 18:42:36 +01:00
Mike Hearn
f6789c93dd Disentangle the concept of CP issuer vs underlying redeemable asset issuer in the CP contract.
This confusion was introduced by a previous refactoring.
2016-07-12 16:01:50 +02:00
Ross Nicoll
e09710e421 Update contract tutorial example to match JavaCommercialPaper 2016-07-12 14:48:50 +01:00
Ross Nicoll
52be94866a Use requireThat in JavaCommercialPaper
Replaces verification logic in JavaCommercialPaper, which previously manually
throw IllegalStateException, with calls to requireThat().
2016-07-12 14:24:50 +01:00
Ross Nicoll
79e3ce23f8 Tweak conditions on JavaCommercialPaper to match CommercialPaper 2016-07-12 14:24:50 +01:00
Ross Nicoll
0d78df33f8 Add standard clauses 2016-07-12 11:31:23 +01:00
Andras Slemmer
635da20fe2 contracts: Maybe we don't need a full stop there 2016-07-11 18:37:27 +01:00