Commit Graph

206 Commits

Author SHA1 Message Date
Vibhu Mohindra
11d14001cd Unified the various StorageService implementations. Made getMap() private. Made the nested tables into instance variables. Moved StorageServiceImpl out into its own file to avoid merge conflicts in the future. 2016-03-15 17:08:28 +00:00
Mike Hearn
77fd6071a1 Merged in jmx-mbeans (pull request #32)
Export various ledger stats via JMX
2016-03-11 18:27:12 +01:00
Mike Hearn
3533e87953 Take out the fake signing delay in the trader demo. 2016-03-11 18:12:18 +01:00
Mike Hearn
07eee0233f Export wallet balances via JMX. 2016-03-11 17:55:03 +01:00
Mike Hearn
28869ad85d Export attachment count via JMX 2016-03-11 17:26:17 +01:00
Mike Hearn
730b7949ea Export stats to JMX from the state machine manager. 2016-03-11 17:26:17 +01:00
Mike Hearn
139bf1e450 Minor: fix trader demo 2016-03-11 17:02:35 +01:00
Mike Hearn
87e8562675 Make Jolokia return data as application/json 2016-03-11 11:57:38 +01:00
Mike Hearn
c436841461 Restrict Jolokia JMX access 2016-03-11 11:49:50 +01:00
Mike Hearn
fce799726f Minor: rename NetworkMap -> NetworkMapService for consistency 2016-03-11 11:49:50 +01:00
rick.parker
429ac589df Clean integration of Jersey & Jackson for JAX-RS support, with Config for setting up custom marshalling. No API classes configured by default
Enable Jersey monitoring JMX MBean

Updates based on Mike's feedback
2016-03-11 08:37:53 +00:00
Mike Hearn
a03352e6cd Export JMX statistics via JSON REST endpoints using Jolokia. 2016-03-09 15:53:32 +01:00
Mike Hearn
b2f9aa64d5 RatesFixProtocol: add progress tracking 2016-03-09 14:38:03 +01:00
Mike Hearn
4e15755883 RatesFixProtocol: add an empty, overridable beforeSigning method that lets you customise the logic of the protocol. 2016-03-09 14:08:37 +01:00
Mike Hearn
0f208d8b4d Check in a demo of how to get an interest rate fix from an oracle. 2016-03-08 17:31:35 +01:00
Mike Hearn
d63a3a8923 Minor: add a toString for the UnknownFix exception 2016-03-08 17:31:35 +01:00
Mike Hearn
6ac05c2edb Minor: don't check the file name in an upload if there isn't one 2016-03-08 17:31:35 +01:00
Mike Hearn
29e58ce3db Allow upload of interest rate fixes to the oracle over HTTP. 2016-03-08 17:31:35 +01:00
Mike Hearn
2b4a1eedc3 Generalise support for file uploads over HTTP to allow reuse of the upload servlet. 2016-03-08 17:29:56 +01:00
Mike Hearn
a7fec047ed Add an interest rates oracle.
Currently lacking the following useful things:
- Progress reporting
- Ability to upload new rates
- Demo app[s]
2016-03-08 17:29:56 +01:00
Mike Hearn
8d3c9643e9 Minor: Move TraderDemo to demos package 2016-03-08 17:29:23 +01:00
Mike Hearn
92a7363c83 Minor: add a couple more utilities for converting strings into the type safe endpoint address objects 2016-03-08 17:29:08 +01:00
Mike Hearn
5aaa6bd204 Minor: rename NodeAttachmentStorage -> NodeAttachmentService 2016-03-08 17:29:08 +01:00
Mike Hearn
ffcc0507c4 Return the hashes of newly uploaded attachments to the uploader. 2016-03-08 15:41:44 +01:00
Mike Hearn
5eda0e066e Minor: add a TODO about a little rpc framework to StateMachineManager 2016-03-08 15:19:44 +01:00
Mike Hearn
dc6ef73b6b Minor: more code motion ... TimestampingProtocol now split to top level class and moved to same location as the other protocols. Few other timestamping related classes reorganised. 2016-03-08 12:17:07 +01:00
Mike Hearn
2c4475b0d9 Minor: TimestamperNodeService -> NodeTimestamperService for consistency 2016-03-08 12:01:49 +01:00
Mike Hearn
8d041a6b1a Minor: yet another small move 2016-03-08 11:12:45 +01:00
Mike Hearn
bf3aed11e7 Minor: another small move 2016-03-08 11:10:31 +01:00
Mike Hearn
e9fddbc709 Reorganise the file hierarchy a bit. 2016-03-08 11:06:16 +01:00
Mike Hearn
d26b06c35c Allow download of attachments, and files within attachments, over HTTP. 2016-03-04 15:56:25 +01:00
Mike Hearn
6cb86ab840 Plumb attachments through to the contract verify functions (no contract uses them yet).
The right way to do this is probably to put the contracts onto the classpath before execution of the contract. However, this interacts closely with the sandboxing work, which isn't yet started, so for now this will do.
2016-03-02 15:35:46 +01:00
Mike Hearn
1123c28f02 Make the trader demo attach a PDF to the commercial paper self-issuance and then scan for it on the buyer side, print out the path on the filesystem where the PDF can be found. 2016-03-02 15:08:55 +01:00
Mike Hearn
8d906c703d Support auto-expansion of attachment jars on disk. 2016-03-02 14:51:42 +01:00
Mike Hearn
f0fa9e3097 Resolve and insert attachments to the local store when resolving transactions. Attachments aren't yet exposed to contract code. 2016-03-02 14:51:42 +01:00
Mike Hearn
7f5eb5bf2f Minor: make TwoPartyTradeProtocolTests use the new MockNode infrastructure 2016-03-02 14:51:42 +01:00
Mike Hearn
dc0925840a Make AbstractNode more customisable and upgrade the MockNode implementation. 2016-03-02 14:51:42 +01:00
Mike Hearn
1bd63c030c Minor: delete dead test-related code from Services.kt 2016-03-01 15:20:03 +01:00
Mike Hearn
3f19842632 Minor: logging, two more utility methods. 2016-03-01 15:13:43 +01:00
Mike Hearn
1330f33aba First pass trivial wallet: basic tracking of relevant states. 2016-02-29 22:14:25 +01:00
Mike Hearn
e2deea598e Minor: tweak the mock key management service a bit. 2016-02-29 22:06:18 +01:00
Mike Hearn
49b20df6cd Minor: add a couple of utilities to BriefLogFormatter to help cut down on unit test log spew. 2016-02-29 22:06:18 +01:00
Mike Hearn
48b2e561b7 Minor: make NodeAttachmentStorage open streams lazily to avoid resource leaks and to make checking for attachment existence fast. 2016-02-29 19:05:06 +01:00
Mike Hearn
a6835c4c04 Add unit tests for attachment fetch. 2016-02-29 19:05:06 +01:00
Mike Hearn
5bd8a3408b Minor: rename InMemoryNetwork/Node to talk more about messaging, to deconflict with the new mock node (which ties together all the various node services). 2016-02-29 19:05:06 +01:00
Mike Hearn
6bdfbb2a4f Refactor Node into AbstractNode+Node, to make it easier to introduce a MockNode for unit testing purposes. 2016-02-29 19:05:06 +01:00
Mike Hearn
37f1de8a4d Refactor FetchTransactionsProtocol into FetchDataProtocol and add support for fetching attachments. 2016-02-29 19:05:05 +01:00
Mike Hearn
0224bca1a9 Add a simple file backed attachment store, with tests. 2016-02-29 19:04:41 +01:00
Mike Hearn
c3f86f6557 Integrate a simple progress tracking system into the protocol framework.
The progress tracker API lets you model a tree of steps, along the same structure as protocols and subprotocols. Each step has an (optionally changing) label, and thus progress trackers can be arranged in a tree. Updates to the progress at each level flow up the tree via an RxJava observable (I guess we will use this more in future).

A simple console renderer is provided that uses ANSI escapes and Emoji to show animated progress through a protocol.

The trader demo is enhanced to use this framework, when run outside of Gradle.
2016-02-24 12:58:37 +01:00
Mike Hearn
c35d7794d8 Minor: make BriefLogFormatter.initVerbose take a set of flags saying what logging to activate vs silence. 2016-02-23 18:28:06 +01:00
Mike Hearn
9de104df7b Refactor the protocol framework out into separate files. 2016-02-23 18:28:06 +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
adda2bbe6b Minor: move ExcessivelyLargeTransactionGraph exception into the right place 2016-02-18 17:29:44 +01:00
Mike Hearn
1243ca2066 Trading: in the two party trade protocol, check that the proposed transaction is contract-valid, and that the missing signatures are what is expected. 2016-02-17 18:38:24 +01: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
bdadaffbc0 Minor: Logging of how many transactions were validated in TransactionGroup.verify() 2016-02-17 17:19:37 +01:00
Mike Hearn
b2b51183b8 Minor: logging - allow multiple package specs to be passed to BriefLogFormatter.initVerbose() 2016-02-17 17:19:36 +01:00
Mike Hearn
299e1af15e Protocol frameworks: separate the fiber object from the logic object to make it easier to compose subprotocols together. 2016-02-17 17:19:36 +01:00
Mike Hearn
dc520392b8 Protocol framework: tweak error handling a bit and add unit test for it. 2016-02-17 17:19:36 +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
Mike Hearn
de4427c240 Minor: add a few utilities for working with listenable futures 2016-02-16 17:39:02 +01:00
Mike Hearn
8c72f68736 Minor: fix a minor merge issue that broke pretty output in the trader demo 2016-02-16 17:17:15 +01:00
Sofus Mortensen
994abb3edb Added new project core.
Project Contracts depends only on core.
2016-02-16 17:14:17 +01:00
Mike Hearn
b7fd0ce0ed Minor: move InMemoryNetwork to tests directory 2016-02-12 16:47:45 +01:00
Mike Hearn
9f4897f7c4 Simplifies two-party trade protocol to return SignedTransaction instead of a pair of other forms. 2016-02-12 15:49:18 +01:00
Mike Hearn
6deef5b598 Minor: rename SignedWireTransaction to just SignedTransaction 2016-02-12 15:47:23 +01:00
Mike Hearn
a42d7e64ef Minor: add a TODO to Kryo.kt about lazy properties. 2016-02-12 15:41:36 +01:00
Mike Hearn
ea18e239d9 Testing: rework TransactionGroupDSL to work with WireTransactions instead of LedgerTransactions and simplify original hash/serialised bits tracking. 2016-02-12 15:41:22 +01:00
Mike Hearn
fc000ec03c Testing: more utilities on Transaction and TransactionGroupForTest to help with testing signed transactions. 2016-02-12 14:55:11 +01:00
Mike Hearn
5b473be79c Minor: fix test breakage under Gradle due to some horrible stuff Gradle does with injecting things into our environment. 2016-02-10 17:59:28 +01:00
Mike Hearn
ae6309a113 Minor: make SecureHash c'tor private so it's not possible to instantiate directly. 2016-02-10 17:59:28 +01:00
Mike Hearn
31964f8695 Introduce ContractFactory to replace Map<SecureHash, Contract>. It allows for lazy loading of contracts. 2016-02-10 17:59:28 +01:00
Mike Hearn
2ccbd5db3e Minor: code cleanup on ArtemisMessagingService.
- Use fixes in Kotlin 1.0 RC to clean up property access a bit (fewer set* calls)
- Note that we currently won't notice if Artemis throws an exception during startup, as it happens async. There is a fix to Artemis pending.
2016-02-10 17:59:28 +01:00
Mike Hearn
d98a3871da Refactor the 2-party trading protocol
- Fix a security bug/TODO by having seller send back the signatures rather than a full blown transaction (which would allow a malicious seller to try and confuse the buyer by sending back a completely different TX to the one he proposed)
- Introduce an UntrustworthyData<T> wrapper as an (inefficient) form of taint tracking, to make it harder to forget that data has come from an untrustworthy source and may be malicious.
- Split the giant {Buyer, Seller}.call() methods into a set of smaller methods that make it easier to unit test various kinds of failure/skip bits in tests that aren't needed.
2016-02-10 17:59:28 +01:00
Mike Hearn
52172c5f95 Minor: in TraderDemo comments point to docsite instead of duplicating 2016-02-10 16:30:21 +01:00
Mike Hearn
e426e784b4 Minor: Use exitProcess rather than System.exit, as the former interacts better with flow typing. 2016-02-10 16:30:21 +01:00
Mike Hearn
55646104b4 Minor: tweak StateMachineManager to work around a cosmetic issue in Quasar, where it prints exception details to stderr twice. We'd rather log it ourselves. 2016-02-10 16:30:21 +01:00
Mike Hearn
0665492645 Minor: introduce a generateKeyPair() function that wraps the Java API, so we can switch algorithm more easily later. 2016-02-10 16:30:21 +01:00
Mike Hearn
8d1b318370 Minor: some more renamings for concision and consistency 2016-02-10 16:30:21 +01:00
Mike Hearn
6f3b07a600 Minor: move and api doc the Node.DEFAULT_PORT field 2016-02-10 16:30:20 +01:00
Mike Hearn
5d0d926568 Node: if the node is started twice, abort and tell the sysadmin the PID of the other instance. 2016-02-10 16:30:20 +01:00
Mike Hearn
7a70cdd4de Minor: rename InMemoryNetwork.Node to InMemoryNetwork.InMemoryNode
Makes IDE class navigation easier by avoiding having two classes with the same name.
2016-02-10 16:30:20 +01:00
Mike Hearn
262124385d Move Crypto.kt into core/crypto/CryptoUtilities.kt 2016-02-10 16:30:20 +01:00
Mike Hearn
1bc57085c8 Rename ContractStateRef -> StateRef. Rename craft* methods to generate* 2016-02-10 16:29:44 +01:00
Mike Hearn
5e30e1b94b Fix build. 2016-02-10 16:28:22 +01:00
Richard Green
ea2b18eb41 Merged in rg_work_in_progress (pull request #16)
Updated as comments per previous pull request, now generic tests run both Kotlin and Java CommercialPaper class tests.
2016-02-10 15:04:13 +00:00
Richard Green
201803ff36 Now runs Java CommercialPaper unit tests
Acted upon comments from last pull request.
Added an interface to enable the usage of the same tests for both the Kotlin and Java example CommercialPaper class - did appropriate refactoring to enable.
Added javadoc, removed public modifier from interfaces.
Various fixes from code review comments.
2016-02-10 14:56:11 +00:00
Mike Hearn
88e02440d4 Kotlin 1.0 RC
Hopefully this is the last time they break backwards compatibility.
2016-02-08 19:35:30 +01:00
Mike Hearn
b57f30ff3e Use DL as the address prefix instead of R3. 2016-02-05 15:49:26 +01:00
Mike Hearn
f705eee312 Use buyer/seller instead of alpha/beta and allow nodes to both be named localhost. Update docs. 2016-02-05 15:48:58 +01:00
Richard 'ragmondo' Green
75a542f79d Change network config to listen to adapter publicly 2016-02-05 11:59:50 +00:00
Mike Hearn
a06d4d23bd Add toString() methods to a few data structures and use them to make the output of the trader demo a bit nicer.
Import Base58 code from bitcoinj and use it for rendering pubkeys (note: not calculated in the same way as Bitcoin).
2016-02-05 11:13:49 +01:00
Mike Hearn
1e8ea8eb2c Implement the beginnings of a serving node.
It uses Artemis (an embeddable MQ broker) and can run in either a 'serving' mode, in which case it will sit around waiting to sell fake commercial paper assets, or a 'buying' mode in which case it will connect to a specified serving node and run the two party trade protocol.

Most services are either mocked out or too trivial to be useful at this point. They will be fleshed out in the future.
2016-02-03 16:57:01 +01:00
Mike Hearn
f683f50eb5 Logging: mention if a log message is a warning or error. 2016-02-03 15:35:55 +01:00
Mike Hearn
af116f6990 Minor: bugfix for the Java requireSingleCommand API. 2016-02-03 15:35:08 +01:00
Mike Hearn
606926a692 Logging: don't include inner class names in log output (i.e. trim anything after the $ sign in the class name) 2016-02-03 12:49:36 +01:00
Mike Hearn
fbd4b60834 Minor: allow double constants to be used to create Amounts, you can now write 35.99.DOLLARS to mean $35.99 2016-02-03 12:49:36 +01:00
Mike Hearn
0417e24fae Minor: fix an incorrect use (process specific) of reflection hashCodes in the Kryo wrapper. 2016-02-03 12:49:36 +01:00
Mike Hearn
f51aa73687 Minor: fix bug in BriefLogFormatter 2016-02-03 12:49:36 +01:00
Mike Hearn
a355ad14be Minor: javadoc fixes 2016-02-03 12:49:35 +01:00