Commit Graph

22253 Commits

Author SHA1 Message Date
Greg Fitzgerald ff82fbf112 Make num_hashes mean the num_hashes since the last ID
Before this change, num_hashes meant the number of hashes since
the last ID, minus any hashing done on the event data. It made
no difference for Tick events, but logged Transaction events with
one less hash than actually occurred.
2018-03-04 09:52:36 -07:00
Greg Fitzgerald 8503a0a58f Refactor 2018-03-04 09:21:45 -07:00
Greg Fitzgerald b1e9512f44 Rename end_hash to id 2018-03-04 07:50:26 -07:00
Greg Fitzgerald 608def9c78 Consolidate imports 2018-03-04 07:28:51 -07:00
Greg Fitzgerald bcb21bc1d8 Delete dead code 2018-03-04 07:20:17 -07:00
Greg Fitzgerald f63096620a
Merge pull request #41 from garious/genesis
Add command-line tool for generating a genesis block
2018-03-04 01:27:59 -07:00
Greg Fitzgerald 9b26892bae Add a demo app to generate the genesis file 2018-03-04 01:21:40 -07:00
Greg Fitzgerald 572475ce14 Load the genesis block 2018-03-04 00:15:17 -07:00
Greg Fitzgerald 876d7995e1 Refactor to support loading an existing ledger 2018-03-03 22:25:40 -07:00
Greg Fitzgerald b8655e30d4 Make client-demo standalone
And remove deposit() methods from the API. Those should only be
used on the server to bootstrap.
2018-03-03 21:15:51 -07:00
Greg Fitzgerald 7cf0d55546 Remove optional 'from' field 2018-03-03 20:41:07 -07:00
Greg Fitzgerald ce60b960c0 Special case sending money to self
In the genesis block, let matching 'from' and 'to' keys be used
to mint new coin.
2018-03-03 20:27:12 -07:00
Greg Fitzgerald cebcb5b92d Start genesis with a Tick, so that its hash can be used to bootstrap verification 2018-03-03 19:57:22 -07:00
Greg Fitzgerald 11a0f96f5e Add command-line tool for generating a genesis block 2018-03-03 17:35:05 -07:00
Greg Fitzgerald 74ebaf1744
Merge pull request #40 from garious/add-logger
Add logger
2018-03-03 14:37:15 -07:00
Greg Fitzgerald f7496ea6d1 Make create_logger a static method
Allows us to share the super long type signature in impl.
2018-03-03 14:26:59 -07:00
Greg Fitzgerald bebba7dc1f Give logger its own crate 2018-03-03 14:24:32 -07:00
Greg Fitzgerald afb2bf442c Use Instant instead of SystemTime for more precise ticking
And convert log_event from function to method
2018-03-03 14:08:53 -07:00
Greg Fitzgerald c7de48c982 Convert log_events from function to method 2018-03-03 14:00:37 -07:00
Greg Fitzgerald f906112c03 Move logging thread's state into a struct 2018-03-03 13:52:57 -07:00
Greg Fitzgerald 8ef864fb39
Merge pull request #37 from garious/split-benchmark
Split benchmark
2018-03-03 12:13:54 -07:00
Greg Fitzgerald 1c9b5ab53c Report performance of signature verification too 2018-03-03 11:59:34 -07:00
Greg Fitzgerald c10faae3b5 More readable metrics 2018-03-03 11:52:50 -07:00
Greg Fitzgerald 2104dd5a0a Fix benchmark
Was measuring the creation of the iterator, not running it.
2018-03-03 11:45:23 -07:00
Greg Fitzgerald fbe64037db
Merge pull request #35 from garious/split-benchmark
Move key generation and signing from transaction benchmark
2018-03-03 11:25:58 -07:00
Greg Fitzgerald d8c50b150c Move key generation and signing from transaction benchmark
Key generation, signing and verification are not the performance
bottleneck. Something is probably wrong here.
2018-03-03 11:11:46 -07:00
Greg Fitzgerald 8871bb2d8e
Merge pull request #30 from garious/simplify
Unify Claim and Transaction handling
2018-03-02 12:24:44 -07:00
Greg Fitzgerald a148454376 Update readme 2018-03-02 12:07:05 -07:00
Greg Fitzgerald be518b569b Remove cyclic dependency between event and log 2018-03-02 12:03:59 -07:00
Greg Fitzgerald c998fbe2ae Sign the owner's public key
Without this, the accountant will reject transfers from different
entities if they are for the same amount and to the same entity.
2018-03-02 11:56:42 -07:00
Greg Fitzgerald 9f12cd0c09 Purge the Claim event type
It's now represented as a Transaction from an unknown party.
2018-03-02 11:48:58 -07:00
Greg Fitzgerald 0d0fee1ca1 Sign Claim's 'to' field
Otherwise, the accountant will treat deposits of the same amount as
duplicates.
2018-03-02 11:46:22 -07:00
Greg Fitzgerald a0410c4677 Pipe all Claim constructors through a function 2018-03-02 10:58:43 -07:00
Greg Fitzgerald 8fe464cfa3 Rename Claim's key field to match same field in Transaction 2018-03-02 10:47:21 -07:00
Greg Fitzgerald 3e2d6d9e8b Generalize Transaction to express a Claim
If a Transaction doesn't have an existing address, it's being used
to create new funds.
2018-03-02 10:41:15 -07:00
Greg Fitzgerald 32d677787b Reduce transactions sent by demo
We don't do retries yet, so keep tx count to something that won't
trigger any packet loss.
2018-03-02 10:35:38 -07:00
Greg Fitzgerald dfd1c4eab3 Don't process transaction if channel.send() fails.
Do all input validation first, then log (which can fail). If all
goes swimmingly, process the transaction.
2018-03-02 10:17:52 -07:00
Greg Fitzgerald 36bb1f989d More defense against a double-spend attack
Before this change, a client could spend funds before the accountant
processed a previous spend. With this change in place, the accountant
updates balances immediately, but that comes at an architectural cost.
The accountant now verifies signatures on behalf of the historian, so
that it can ensure logging will not fail.
2018-03-02 09:55:44 -07:00
Greg Fitzgerald 684f4c59e0 Delete commented out code
accountant crate shouldn't verify the log. Instead, it should
only add valid entries and leave verification to network nodes.
2018-03-02 08:51:29 -07:00
Greg Fitzgerald 1b77e8a69a Move Event into its own crate
The log crate was starting to be the catch-all for all things
related to entries, events, signatures, and hashes. This split
shows us that:

* Event depends only on signatures, not on hashes [directly]
* All event testing was done via log testing (shame on me)
* Accounting depends only on events
2018-03-02 08:43:57 -07:00
Greg Fitzgerald 662e10c3e0
Merge pull request #29 from garious/simplify
Remove Discovery event
2018-03-01 18:53:25 -07:00
Greg Fitzgerald c935fdb12f Move signature duplicate detection into the historian 2018-03-01 17:44:10 -07:00
Greg Fitzgerald 9e16937914 Delete the Discovery event
Not useful to the accountant.
2018-03-01 17:02:41 -07:00
Greg Fitzgerald f705202381 No need to hash data that's already hashed to create the signature 2018-03-01 16:39:09 -07:00
Greg Fitzgerald f5532ad9f7
Merge pull request #28 from garious/go-udp
Switch to UDP
2018-03-01 14:25:20 -07:00
Greg Fitzgerald 570e71f050 Check for duplicate signatures
TODO: have client add recent hash to each message
2018-03-01 14:07:39 -07:00
Greg Fitzgerald c9cc4b4369 Switch to UDP from TCP
And remove all the sleep()'ing around.
2018-03-01 13:47:53 -07:00
Greg Fitzgerald 7111aa3b18
Copy disclaimer from the loom repository
Per @aeyakovenko, added Loom's disclaimer.
2018-03-01 09:16:39 -07:00
Greg Fitzgerald 12eba4bcc7
Merge pull request #26 from garious/add-accountant
Add testnode and client-demo
2018-02-28 19:48:05 -07:00
Greg Fitzgerald 4610de8fdd Switch to sync_channel to preserve order 2018-02-28 19:33:28 -07:00