Commit Graph

159 Commits

Author SHA1 Message Date
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 #199)
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 #239)
Added Jacoco code coverage to gradle.
2016-07-29 13:29:47 +01:00
Mike Hearn
5167ed7df2 Merged in mike-fix-irs (pull request #244)
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 #208)
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 #224)
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
Andras Slemmer
d7cc34c9a5 all: Full stops in comments! 2016-07-11 17:58:53 +01:00
Mike Hearn
e28ecae8c0 Address review comments 2016-07-11 18:47:24 +02:00
Mike Hearn
41d092a169 Minor: optimize imports 2016-07-11 18:15:28 +02:00
Mike Hearn
6b7580c977 Minor: fix compiler warnings. 2016-07-11 18:15:28 +02:00
Mike Hearn
cc22810b09 Testing cleanup:
- Move code out of ambiguously named TestUtils files (there were three). Sometimes it's simpler to just put these things into the contract source files directly.
- Remove JavaTestHelpers objects (there were three), in favour of just giving the top level kotlin file class better names.
- Misc other small tweaks and cleanups.
2016-07-11 16:22:02 +02:00
Ross Nicoll
6b775ebd4d Replace named timestamping authority with notary
As the timestamping authority is now always the notary service, contracts should
no longer be using name-based lookup of the timestamping authority (as this will
generally be wrong). This introduces a new "timestamp" property on a transaction,
and updates most contracts to refer to it.

In some cases (IRS, CommercialPaper) there are transactions with no input states
to derive notary from, that use timestamps. In these cases a notary is specified
in the command.
2016-07-11 14:54:36 +01:00
Andras Slemmer
4324e33fea testdsl: Removed R type parameter, unify verifies() interface 2016-07-11 14:25:27 +01:00
Andras Slemmer
fb55ceeb79 contracts: Remove Tmp* files 2016-07-11 14:25:27 +01:00
Andras Slemmer
9bb8439dc3 testdsl: Add failsWith to Ledger 2016-07-11 14:25:27 +01:00
Andras Slemmer
cd0299f650 testdsl: Javadoc comments 2016-07-11 14:25:27 +01:00
Andras Slemmer
3d885eb928 testdsl: Clean up TestUtils.kt 2016-07-11 14:25:27 +01:00
Ross Nicoll
0404ef4f62 Standardise error messages regarding state issuance
This makes the error messages when verifying state issuance consistent between
Cash, CommercialPaper and Obligation contracts, in preparation for introducing
a common issue clause between the contracts.
2016-07-11 11:32:36 +01:00
Ross Nicoll
7655356ec2 Minor: Remove unneeded backquotes 2016-07-11 11:32:34 +01:00
Ross Nicoll
ae1d3e96b1 Extend obligation tests to cover input lifecycle checks 2016-07-11 11:30:36 +01:00
Andrius Dagys
b498928f75 Remove the "verify correct notary has signed" check. This is no longed necessary as the required notary key is added to the "signers" list during transaction construction. We have general validation rules that check the correct notary was included in the signers list, and that we have signatures for all "signers". 2016-07-07 13:22:30 +01:00
Mike Hearn
bbc5c2e981 Merged in mike-july-dependency-upgrades (pull request #200)
Upgrade dependencies, July edition.
2016-07-06 16:25:52 +01:00