anatoly yakovenko
c34d911eaf
Migrate Budget DSL to use the Account state ( #979 )
...
* Migrate Budget DSL to use the Account state instead of global bank data structures.
* Serialize Instruction into Transaction::userdata.
* Store the pending set in the Account::userdata
* Enforce the token balance rules on contract execution. This becomes the entry point for generic contracts.
* This pr will have a performance impact on the bank. The next set of changes will fix this by locking each account during multi threaded execution of all the contracts.
* With this change a contract transaction needs to store its state under an address. That address could be the destination of the tokens, or any random address. For the latter, an extra step would be needed to claim the tokens which isn't implemented by budget_dsl at the moment.
* test tracking issue 1157
2018-09-07 20:18:36 -07:00
Greg Fitzgerald
c2bbe4344e
Rename KeyPair to Keypair
2018-08-09 13:41:37 -06:00
Rob Walker
ea7fa11b3e
use size_of() instead of serialized_size() and magic number 8
2018-07-30 16:48:58 -07:00
Rob Walker
f341b2ec10
fixups
2018-07-30 14:26:44 -07:00
Rob Walker
167b079e29
fixups
2018-07-30 14:26:44 -07:00
Rob Walker
7ded5a70be
fixups
2018-07-30 14:26:44 -07:00
Rob Walker
fc476ff979
implement iterator for parsing length + data ledger
2018-07-30 14:26:44 -07:00
Rob Walker
c3279c8a00
chugga
2018-07-30 14:26:44 -07:00
Rob Walker
e471ea41da
fixups
2018-07-30 14:26:44 -07:00
Rob Walker
552d4adff5
use a binary ledger: newline-separated, newline-escaped entries instead of json
2018-07-30 14:26:44 -07:00
Rob Walker
0696f9f497
flush writer, makes partial deserialization a bit less likely
2018-07-18 22:53:33 -07:00
Greg Fitzgerald
4b07772e22
Add helper functions for reading entries
...
```rust
let entries = entry_writer::read_entries_from_str(entries_str).unwrap();
let entries_len = entries.len();
assert_eq!(entries_len, 7);
let bank = Bank::default();
bank.process_ledger(entries).unwrap();
assert_eq!(bank.transaction_count(), entries_len - 2);
```
2018-07-03 19:32:01 -06:00
Greg Fitzgerald
88a6fb86bf
Clean up read_entries() and its usage
2018-07-03 16:33:36 -06:00
Greg Fitzgerald
4e3526394e
Use IntoInterator to simplify write_entries() usage
2018-07-02 09:51:39 -06:00
Greg Fitzgerald
ec7e50b37d
Consolidate ledger serialization code
...
The new read_entries() works, but is overly-contrained. Not
using that function yet, but adding it here in the hopes some
Rust guru will tell us how to get that lifetime constraint out
of there.
Fixes #517
2018-07-02 09:51:39 -06:00
Greg Fitzgerald
669164bada
Boot EntryWriter's Mutex
...
Finally!
2018-07-01 17:29:24 -06:00
Greg Fitzgerald
4f3a291391
Move the writer into EntryWriter
2018-07-01 17:29:24 -06:00
Greg Fitzgerald
09e9139855
Move channel code to write stage
2018-07-01 17:29:24 -06:00
Greg Fitzgerald
76fc5822c9
Send Vec<Entry> between stages instead of Entry
...
Might see a performance boost here.
2018-07-01 17:29:24 -06:00
Greg Fitzgerald
c767a854ed
Remove useless Arc
2018-07-01 11:35:32 -07:00
Greg Fitzgerald
b60802ddff
Refactor such that genesis can use entry_writer
2018-07-01 11:35:32 -07:00
Greg Fitzgerald
1c35d59f26
Receive entries first, then write
2018-07-01 11:35:32 -07:00
Greg Fitzgerald
adcaf715c6
Cleanup write_entries
2018-07-01 11:35:32 -07:00
Greg Fitzgerald
1f9494221b
Make space for a write_entry() that only writes entries
2018-07-01 11:35:32 -07:00
Greg Fitzgerald
466d6f76b9
Don't hide error in write_entry()
2018-07-01 11:35:32 -07:00
Greg Fitzgerald
63cfbb9497
Only register last entry after a split
2018-06-28 16:54:06 -06:00
Greg Fitzgerald
4aedd3f1b6
Cleanup type aliases and imports
2018-06-27 15:06:18 -06:00
Greg Fitzgerald
5aaa38bcaf
Better docs for write_stage
2018-06-07 09:25:36 -06:00
Greg Fitzgerald
9c9c63572b
cargo fmt
...
rustfmt was updated with 1.26.1
2018-05-29 20:33:45 -07:00
Greg Fitzgerald
2b1e90b0a5
More idiomatic Rust
2018-05-29 14:04:27 -06:00
Anatoly Yakovenko
83c11f0f9d
logs
2018-05-24 17:40:33 -06:00
Anatoly Yakovenko
2d635386af
rebased
2018-05-14 15:20:41 -07:00
Greg Fitzgerald
d2dd005a59
accountant -> bank
2018-05-14 15:33:11 -06:00
Greg Fitzgerald
cc447c0fda
Drop support for EntryInfo subscriptions
2018-05-14 09:53:57 -06:00
Greg Fitzgerald
aec05ef602
Move RequestProcessor into its own module
2018-05-12 17:50:55 -06:00
Greg Fitzgerald
b2e3299539
Only pass accountant write_service
2018-05-12 17:30:15 -06:00
Greg Fitzgerald
a3869dd4c1
Move entry_receiver to RequestStage
...
This can move to AccountingStage once RequestStage stops
calling process_events().
2018-05-12 15:14:37 -06:00
Greg Fitzgerald
a3d2831f8c
Free up the name 'accounting_stage'
2018-05-12 14:05:57 -06:00
Greg Fitzgerald
898f4971a2
Free up name 'thin_client_service'
2018-05-12 10:50:22 -06:00
Greg Fitzgerald
cd96843699
Free up name ThinClientService
2018-05-11 23:37:14 -06:00
Greg Fitzgerald
ca80bc33c6
Move the writer stage's utilities to its own module
2018-05-11 22:36:16 -06:00