Greg Fitzgerald
94daf4cea4
Add Cancel and Timestamp events
...
Fixes #31 , #34 , #39
2018-03-08 08:17:34 -07:00
Greg Fitzgerald
2379792e0a
Add DateTime and Cancel conditions
...
Fixes #32 , #33
2018-03-08 08:17:08 -07:00
Greg Fitzgerald
5dd567deef
Rename Genesis to Mint
...
Genesis is a story of creation. We should only use that term to
for the event log that bootstraps the system.
2018-03-07 17:08:15 -07:00
Greg Fitzgerald
491ba9da84
Add accessors to keypairs and signatures
2018-03-07 15:32:22 -07:00
Greg Fitzgerald
9834c251d0
Boot genesis block helper
...
Before this change, if you wanted to use a new Transaction
feature in the genesis block, you'd need to extend its
Creator object and associated methods. With yesterday's
addtions to Transcation, it's now so easy to work with
Transactions directly that we can get rid of the middleman.
Also added a KeyPair type alias, so that ring could be easily swapped
out with a competing library, if needed.
2018-03-07 11:10:15 -07:00
Greg Fitzgerald
d1b6206858
Monomorphisize Entry and Event
...
Transaction turned out to be the only struct worth making generic.
2018-03-06 20:29:18 -07:00
Greg Fitzgerald
b725fdb093
Sha256Hash -> Hash
...
Because in Loom, there's just the one. Hopefully no worries that it
shares a name with std::Hash.
2018-03-06 17:40:01 -07:00
Greg Fitzgerald
1436bb1ff2
Move entry into its own module
...
Hmm, Logger doesn't depend on log.
2018-03-06 17:40:01 -07:00
Greg Fitzgerald
5a44c36b1f
Move hash into its own module
2018-03-06 17:40:01 -07:00
Greg Fitzgerald
f09952f3d7
DRY up transaction signing
...
Cleanup the big mess I copy-pasted myself into.
2018-03-06 16:34:25 -07:00
Greg Fitzgerald
4376032e3a
data -> asset
...
'data' is too vague.
2018-03-06 14:50:32 -07:00
Greg Fitzgerald
624c151ca2
Add signature module
...
Because things other than transactions can be signed.
2018-03-06 12:48:28 -07:00
Greg Fitzgerald
b019416518
Move verify into methods
...
A little overly-coupled to Serialize, but makes the code a lot tighter
2018-03-06 12:27:08 -07:00
Greg Fitzgerald
4fcd9e3bd6
Give Transaction its own module
2018-03-06 12:18:17 -07:00
Greg Fitzgerald
66bf889c39
Rename Transfer to Transaction
...
struct names should be nouns
2018-03-06 11:54:47 -07:00
Greg Fitzgerald
a2811842c8
More cleanup
...
Far fewer branches when we process transfers outside the context
of events.
2018-03-06 11:43:55 -07:00
Greg Fitzgerald
6543497c17
Move Transaction data into its own struct
...
This will allow us to add addition transfer types to the log.
2018-03-06 10:50:32 -07:00
Greg Fitzgerald
720c54a5bb
Allow balances to be negative
...
* Will allow owners to loan token to others.
* Will allow for parallel verification of balances without spilling
over 64 bits.
Fixes #43
2018-03-05 17:30:53 -07:00
Greg Fitzgerald
a4336a39d6
Initialize the testnode from a log
...
$ cargo run --bin silk-genesis-file-demo > demo-genesis.json
$ cat demo-genesis.json | cargo run --bin silk-genesis-block > demo-genesis.log
$ cat demo-genesis.log | cargo run --bin silk-testnode
2018-03-05 15:34:44 -07:00
Greg Fitzgerald
48c28c2267
Transactions now require a hash of the last entry they've seen
...
This ensures the transaction cannot be processed on a chain
that forked before that ID. It will also provide a basis for
expiration constraints. A client may want their transaction
to expire, and the generators may want to reject transactions
that have been floating in the ether for years.
2018-03-05 12:48:14 -07:00
Greg Fitzgerald
79fb9c00aa
Boot wait_on_signature() from accountant
...
Instead, there should be a way to query for a page of log data,
and checking whether it has a signature should be done client-side.
2018-03-05 10:45:18 -07:00
Greg Fitzgerald
c9e03f37ce
Logger now only speaks when spoken to
...
Before this change, the logger's send channel could quickly be
flooded with Tick events. Those events should only be passed to
a writer.
Also, the log_event() function no longer sends entries. That
functionality moved to the new process_events() function. This
will allow us to initialize the with the genesis block without
flooding the send channel with events the historian won't read.
2018-03-05 10:33:12 -07:00
Greg Fitzgerald
aa5f1699a7
Update the set of unique signatures when loading an existing log.
2018-03-04 22:31:12 -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
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
7cf0d55546
Remove optional 'from' field
2018-03-03 20:41:07 -07:00
Greg Fitzgerald
bebba7dc1f
Give logger its own crate
2018-03-03 14:24:32 -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
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
c935fdb12f
Move signature duplicate detection into the historian
2018-03-01 17:44:10 -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
4610de8fdd
Switch to sync_channel to preserve order
2018-02-28 19:33:28 -07:00
Greg Fitzgerald
3fcc2dd944
Add testnode
...
Fixes #20
2018-02-28 18:05:20 -07:00
Greg Fitzgerald
8299bae2d4
Add accountant stub
2018-02-28 16:01:12 -07:00
Greg Fitzgerald
604ccf7552
Add network interface for accountant
2018-02-28 14:00:04 -07:00
Greg Fitzgerald
fa4d9e8bcb
Add more tests
2018-02-27 11:28:10 -07:00
Greg Fitzgerald
34b77efc87
Sleep longer for TravisCI
2018-02-27 11:08:28 -07:00
Greg Fitzgerald
5ca0ccbcd2
Add accountant
2018-02-27 10:54:06 -07:00