Commit Graph

525 Commits

Author SHA1 Message Date
Trent Nelson 9754fc789e
Manage durable nonce stored value in runtime (#7684)
* Bank: Return nonce pubkey/account from `check_tx_durable_nonce`

* Forward account with HashAgeKind::DurableNonce

* Add durable nonce helper for HashAgeKind

* Add nonce util for advancing stored nonce in runtime

* Advance nonce in runtime

* Store rolled back nonce account on TX InstructionError

* nonce: Add test for replayed InstErr fee theft
2020-01-10 16:57:31 -07:00
Ryo Onodera 865c42465a
Cap file size for snapshot data files (#7182)
* save limit deserialize

* save

* Save

* Clean up

* rustfmt

* rustfmt

* Just comment out to please CI

* Fix ci...

* Move code

* Rustfmt

* Crean up control flow

* Add another comment

* Introduce predetermined constant limit on snapshot data files (deserialize side)

* Introduce predetermined constant limit on snapshot data files (serialize side)

* rustfmt

* Tweak message

* Revert dynamic memory limit

* Limit size of snapshot data file (de)serialization

* Fix test breakage

* Clean up

* Fix uses formatting

* Rename: deserialize_{for,from}_snapshot

* Simplify comment

* Use Slot

* Provide slot for status cache

* Align variable name with snapshot_status_cache_file_path

* Define serialize_snapshot_data_file_with_metrics

* Fix build.......

* De-marco serialize_snapshot_data_file_with_metrics

* Revert u64 => Slot
2020-01-10 09:49:36 +09:00
sakridge 73c93cc345
Print bank hash and hash inputs. (#7733) 2020-01-09 16:33:10 -08:00
Michael Vines e782c26908 Prune older epoch stakes 2020-01-04 09:34:27 -07:00
Trent Nelson 7e94cc2cc3 Move nonce into system program (#7645)
automerge
2020-01-03 16:34:58 -08:00
Rob Walker 63f185f9bf
Delete unused type (#7653) 2020-01-02 13:15:31 -08:00
Rob Walker e0564f628e
Use lamports in genesis (#7631)
* Use lamports in genesis

* readability
2019-12-28 12:49:10 -08:00
Rob Walker 120c8f244c
Add slot_history for slashing (#7589)
* Add slot_history for slashing

* fixup

* fixup
2019-12-23 12:23:45 -08:00
Ryo Onodera 3c361eb759
Check account hashes in snapshot (#7559)
* Check for incorrect hash value

* Finish up checking for incorrect hash value

* Fix comment a bit

Co-authored-by: sakridge <sakridge@gmail.com>
2019-12-20 09:39:30 +09:00
Tyera Eulberg 6aaf742dfe Extend getConfirmedBlock rpc to return account pre- and post-balances (#7543)
automerge
2019-12-18 09:56:29 -08:00
Trent Nelson 0ea2843ec9
Durable Nonce - Authorized Noncer (#7417)
* Durable Nonce: Add authorized noncer to initialize instruction

* CLI: Adapt to nonce authority

* Durable Nonce: Introduce Authorize instruction

* Specify who needs to sign  ix

* 'authorized-noncer' -> 'nonce-authority'

* Document signing authority for all instructions
2019-12-17 09:34:21 -05:00
Jack May 7c92bf15e2
Only return accounts that have changed since the bank's parent (#7520)
* Only return accounts that have changed since the bank's parent

* add test
2019-12-16 23:24:18 -08:00
Rob Walker f05860672c
Add create-address-with-seed to solana-cli (#7472)
* Add create account with seed to cli

* clippy

* fixup
2019-12-14 04:38:24 -08:00
Rob Walker 777ae3c215
Add time since genesis to sysvar::clock (#7289)
* genesis timestamp

* remove clock::create_account()

* ..

* add configure-able creation time

* dividing by 1T, should be dividing by 1B
2019-12-12 14:03:43 -08:00
Parth feeb1cb566
distribute leftover lamports (#7396)
* distribute leftover lamports

* add test scenario

* fix naming
2019-12-11 02:41:08 +05:30
Rob Walker 39cd6dff7d
turn on rent (#7368)
* turn on rent

* add rent exempt balances for bootstrap accounts

* use Rent::free() when not testing rent
2019-12-09 21:56:43 -08:00
Justin Starry 43e608af47
Expose stake delegations from bank for winner tool (#7354)
* Expose stake delegations from bank

* cargo fmt

* Add test
2019-12-08 20:52:01 -08:00
Trent Nelson 1ffd6b4b4d
Add program and runtime support for Durable Transaction Nonces (#6845)
* Rework transaction processing result forwarding

Durable nonce prereq

* Add Durable Nonce program API

* Add runtime changes for Durable Nonce program

* Register Durable Nonce program

* Concise comments and bad math

* Fix c/p error

* Add rent sysvar to withdraw ix

* Remove rent exempt required balance from Meta struct

* Use the helper
2019-12-07 12:54:10 -07:00
Justin Starry b7d4330dd4
Fail fast if account paths cannot be canonicalized (#7300)
* Canonicalize account paths to avoid symlink issues

* fixes
2019-12-05 21:41:29 -05:00
sakridge cfc21e1225
Only serialize rooted append vecs (#7281) 2019-12-05 14:27:46 -08:00
Parth 0d1fed78af Pay rent to validators (#7164)
automerge
2019-12-05 06:10:34 -08:00
Parth ba688cf629
enforce proper range for rent burn_percent (#7217)
* enforce proper range for burn_percent
2019-12-04 00:54:01 +05:30
Rob Walker d5c8b26a45
bank_leak_mac_os (#7209) 2019-12-03 00:09:05 -08:00
Rob Walker f9df17d8d0
track bank size (#7144)
* track bank size

* support non-linux a bit better
2019-12-02 13:47:20 -08:00
Sagar Dhawan 0e2e13f018 Update usages of u64 to Slot (#7191)
automerge
2019-12-02 11:57:40 -08:00
sakridge 887bff572a
More conservative purge_zero_lamport_accounts purge logic (#7157) 2019-12-02 09:51:05 -08:00
Tyera Eulberg 58c144ee55
Add getBlockTime rpc api (#7130)
* Add getBlockTime rpc api

* Add getBlockTime to docs

* Fix duration rounding for common tick/slot durations; add slot duration calculation

* Expose slots_per_year

* Use genesis values instead of clock defaults to calculate block offset

* Add get-block-time cli subcommand

* Fix test_rent: decrease magic number usage
2019-11-26 00:40:36 -07:00
Sagar Dhawan 76a68c26c9
Track a Bank's parent slot independently from parent bank (#7131) 2019-11-25 15:34:51 -08:00
Rob Walker ef64f00cbb
Revert "Revert "add genesis stake placeholders (#6969)" (#7109)" (#7124)
This reverts commit 702f7cc51d.
2019-11-25 15:11:55 -08:00
Rob Walker acbe89a159
shrink stakes (#7122) 2019-11-25 13:14:32 -08:00
anatoly yakovenko 702f7cc51d Revert "add genesis stake placeholders (#6969)" (#7109)
* Revert "add genesis stake placeholders (#6969)"

This reverts commit 8a879faac7.

* fixup! Revert "add genesis stake placeholders (#6969)"

* fixup! fixup! Revert "add genesis stake placeholders (#6969)"

* fixup! fixup! fixup! Revert "add genesis stake placeholders (#6969)"

* fixup! fixup! fixup! fixup! Revert "add genesis stake placeholders (#6969)"

* fmt
2019-11-23 23:15:21 -07:00
sakridge 6c89226ccf
Purge zero lamport accounts on snapshot ingestion (#7010)
Snapshots do not load the original index, so they must
purge zero lamport accounts again.
2019-11-22 18:22:28 -08:00
Ryo Onodera 8bb68c4e6a
Really remove mentions of 'genesis_block' (#7099) 2019-11-23 05:58:20 +09:00
Sagar Dhawan 4485b978c1
Clean up accounts hash internal state api (#7090) 2019-11-22 08:56:00 -08:00
Rob Walker 8a879faac7
add genesis stake placeholders (#6969)
* add investor stake placeholders

fixups

fixups

review comments, fixups

make more data-looky for easier management

rent may be zero

rework with more tables, derived keys

fixups

rebase-fix

fixups

fixups

* genesis is now too big to boot in 10 seconds
2019-11-21 12:05:31 -08:00
Sagar Dhawan 2c1b8fdd39 Add another test for bank state hashes (#7073)
automerge
2019-11-20 23:03:42 -08:00
Tyera Eulberg 97ca6858b7
Write transaction status and fee into persistent store (#7030)
* Pass blocktree into execute_batch, if persist_transaction_status

* Add validator arg to enable persistent transaction status store

* Pass blocktree into banking_stage, if persist_transaction_status

* Add validator params to bash scripts

* Expose actual transaction statuses outside Bank; add tests

* Fix benches

* Offload transaction status writes to a separate thread

* Enable persistent transaction status along with rpc service

* nudge

* Review comments
2019-11-20 16:43:10 -07:00
Parth 9f6a2e51b2
add credit-debit rent handling (#6947)
* add credit-debit rent handling

* add tests

* charge rent for validator account for fee credit

* rent is stored per tx instead of account
2019-11-21 01:57:02 +05:30
anatoly yakovenko b150da837a Use epoch as the gossip purge timeout for staked nodes. (#7005)
automerge
2019-11-20 11:25:18 -08:00
Jack May d184d3a732
Merge native programs parts into one unit (#7047) 2019-11-20 10:12:43 -08:00
Sagar Dhawan 42da1ce4e2
Fix bank hash not changing when no internal state has changed (#7052)
* Fix bank hash not changing when no internal state has changed

* Fix unnecessary call to hash_internal_state

* Add blockhash into the bank_hash

* Add blockhash into the bank_hash and update tests

* Refactor accounts_db slot_hashes

* More clarity in comments

* Add clippy suggestion

* Grammar

* Fix compile after clippy made me break it

* Schooled by clippy
2019-11-19 20:19:43 -08:00
Michael Vines cc96848b01 Remove unneeded prepare_batch() assert (#6941)
automerge
2019-11-13 17:08:21 -08:00
Michael Vines 9026339d35
Restore is_frozen() asserts (#6925) 2019-11-13 10:40:51 -07:00
Michael Vines fcc2874591
Remove/address some TODOs (#6923) 2019-11-13 09:43:15 -07:00
Justin Starry 9807f47d4e
Rename genesis block to genesis config (#6816) 2019-11-08 23:56:57 -05:00
carllin 91be35731c
Fix freeze and register_tick race (#6799)
* Fix freeze and register_tick race

* Add test
2019-11-08 17:21:17 -08:00
carllin 66a0f54097 Replay should respect order of register_ticks with respect to blockhashes (#6805) 2019-11-08 12:29:41 -07:00
Parth 5bd05fba09
require `to` account signature (#6658)
* require to signature

* fixing invocation to create_account

* fix create_account references

* address review comment

* whacking bugs in tests

* fixing stake program tests
2019-11-08 15:57:35 +05:30
Sagar Dhawan 80a89b5e6d Revert "Revert "Add inflation to epoch phases (#6787)" (#6802)" (#6806)
automerge
2019-11-07 18:33:14 -08:00
Sagar Dhawan d89271528e Revert "Add inflation to epoch phases (#6787)" (#6802)
automerge
2019-11-07 16:43:09 -08:00
Jack May a9c4cd6cbe
Add inflation to epoch phases (#6787) 2019-11-07 10:53:04 -08:00
Justin Starry e420800aeb
Update terminology for block height and genesis block (#6782) 2019-11-06 23:09:03 -05:00
carllin 24102a7435
Allow voting on empty banks (#6719)
* Allow votes on empty banks

* Remove making first bank is_delta true, no longer necessary for idling

* Remove votable from ledger tool
2019-11-06 01:02:26 -08:00
Tyera Eulberg c6931dcb07
Remove credit-only account handling (#6726)
* Renaming
- credit-only/credit-debit to read-only/read-write
- debitable to writable

* Remove credit handling, making credit-only accounts read-only

* Update programs to remove deprecated credit-only account designation

* Use readonly and writable instead of underscored types
2019-11-05 09:38:35 -07:00
anatoly yakovenko f54cfcdb8f
Store and persists full stack of tower votes in gossip (#6695)
* vote array

wip

wip

wip

update

gossip index should match tower index

tests build

clippy

test index after expired vote

test

bank specific last vote sync time

* verify

* we are likely to see many more warnings about old votes now
2019-11-04 16:19:54 -08:00
Rob Walker efe260f12e
sysvar trait (#6667)
* sysvar trait

* get the new guy in on it
2019-11-04 12:31:24 -08:00
Rob Walker b9b535c30f
move system_instruction::transfer() `to` credit-debit (#6677)
* transfer no credit only

* use a credit-only transfer in the credit-only test
2019-11-04 12:30:59 -08:00
Trent Nelson 5416c114cf
SDK: Add sysvar to expose recent block hashes to programs (#6663)
* SDK: Add sysvar to expose recent block hashes to programs

* Blockhashes is one word

* Missed one

* Avoid allocs on update

* unwrap_or_else

* Use iterators

* Add microbench

* Revert "unwrap_or_else"

This reverts commit a8f8c3bfbe0d88e2229e67a29e9d2b489b93ff62.

* Revert "Avoid allocs on update"

This reverts commit 486f01790c271cf09ac3dbffba0e40e526e81324.
2019-11-04 10:51:15 -07:00
Michael Vines 3938142535
keygen: add dedicated `solana-keygen grind` command (#6697)
* Remove dead code

* Speed up vanity key grinding
2019-11-03 19:41:26 -08:00
Michael Vines 50a17fc00b Use Slot and Epoch type aliases instead of raw u64 (#6693)
automerge
2019-11-02 00:38:30 -07:00
Justin Starry e8e5ddc55d
Verify number of hashes for each block of entries (#6262)
* Verify number of hashes for each block of entries

* Fix blocktree processor tick check

* Rebase once more
2019-10-31 16:38:50 -04:00
Rob Walker fa12a5f70b
kill rent calculator (#6625) 2019-10-30 16:25:12 -07:00
Rob Walker b4119c454a
credit_only credits forwarding (#6509)
* credit_only_credits_forwarding

* whack transfer_now()

* fixup

* bench should retry the airdrop TX

* fixup

* try to make bench-exchange a bit more robust, informative
2019-10-23 22:01:22 -07:00
sakridge f1172617cc
Purge accounts with lamports=0 on rooted forks (#6315) 2019-10-23 12:46:48 -07:00
Michael Vines 35cc74ef25
Add GenesisBlock::OperatingMode to control how cluster features are activated (#6430) 2019-10-23 11:50:10 -07:00
Michael Vines 3fb70b8d47
Ban XXX, TBD, FIXME comments (#6486) 2019-10-21 16:43:11 -07:00
Greg Fitzgerald 9232057e95
Rename replicator to archiver (#6464)
* Rename replicator to archiver

* cargo fmt

* Fix grammar
2019-10-21 11:29:37 -06:00
Justin Starry 09abbd93b1
Cleanup register_tick special handling (#6462) 2019-10-21 10:51:02 -04:00
Rob Walker e2c316d2d0
system_instruction_processor updates (#6448)
* zero lamport account creation

* whack create_user_account, take 2

* target->to

* ..

* ..

* update chacha golden

* update chacha golden

* ..

* ..
2019-10-19 18:23:27 -07:00
Sagar Dhawan 7ae5ff838b
Revert "collect rent from accounts (take:2) (#6360)" (#6400)
This reverts commit c1b401a04a.
2019-10-16 13:31:21 -07:00
Justin Starry 7e6e7e8406
Remove special handling of first ledger tick (#6263)
* Remove special handling of first ledger tick

* Fix subtraction overflow

* @garious feedback

* Back to height

* More tick_height name changes

* Fix off-by-one

* Fix leader tick error

* Fix merge conflict

* Fix recently added test
2019-10-16 15:53:11 -04:00
Ryo Onodera e267dfacdd Stabilize some banking stage tests (#6251)
* Stabilize some banking stage tests

Fixes #5660

* Fix CI...

* clean up

* Fix ci

* Address review nits

* Use bank.max_tick_height due to off-by-one for no PohRecord's clearing bank

* Fix CI...

* Use bank.max_tick_height() instead for clarity
2019-10-16 12:37:27 -07:00
Greg Fitzgerald ee099b0880 Delete ref annotations (#6394)
automerge
2019-10-16 09:27:49 -07:00
Justin Starry 996c8cf2eb
Don't add bogus native loader if loader account already exists (#6377)
* Don't add bogus native loader account if it already exists

* Add assert for native loader account owner
2019-10-16 00:33:15 -04:00
Parth c1b401a04a
collect rent from accounts (take:2) (#6360)
* collect rent from credit debit accounts

* collect rent from credit only account

* rent_collector now can deduct partial rent + no mem copy + improved design

* adding a test to test credit only rent

* add bank level test for rent deduction

* add test to check if hash value changes or not

* adding test scenario for lamport circulation
2019-10-16 07:45:47 +05:30
Rob Walker 9803f167bd Revert "collect rent from the accounts (#6181)" (#6356)
automerge
2019-10-14 16:16:44 -07:00
Parth e210e76bd5
collect rent from the accounts (#6181)
* collect rent from credit-debit account

* collect rent from credit only account

* improved design for rent collection

* only process if collected rent is non zero

* rent_collector now can deduct partial rent + no mem copy

* adding a test to test credit only rent

* add bank level test for rent deduction

* add test to check if hash value changes or not

* adding test scenario for lamport circulation

* combining rent debtors into credit only locks
2019-10-15 02:00:29 +05:30
Rob Walker 7cf90766a3
add epoch_schedule sysvar (#6256)
* add epoch_schedule sysvar

* book sheesh!
2019-10-08 22:34:26 -07:00
Michael Vines c34cc4918f Prevent repeated accounts in genesis to avoid breaking account hashing 2019-10-07 08:12:18 +09:00
Greg Fitzgerald fb39bd45d7
Revert "Rename solana-runtime to sealevel (#6239)" (#6247)
This reverts commit 2e921437cd.
2019-10-04 19:33:29 -06:00
Greg Fitzgerald 2e921437cd Rename solana-runtime to sealevel (#6239)
automerge
2019-10-04 15:02:44 -07:00
Ryo Onodera ffae4662bc Use AtomicU64 now that it's stabilized (#6222) 2019-10-03 20:02:28 -07:00
Parth 92ea11fca1
make executable, vote and stake account rent exempt (#6017)
* add missing convenience method

* require vote account to be exempt

* make stake account rent exempt

* making executable rent exempt

* rent will be initialized in genesis

* add test for update_rent
2019-10-04 02:52:48 +05:30
Justin Starry 8d0236e3f1
Rename bank height to block_height and expose method (#6199)
* Rename bank bank_height to block_height

* Expose block_height method
2019-10-01 14:55:39 -04:00
Justin Starry 2f92b92a8a
Expose current stake accounts of a bank for use in cli tooling (#6184) 2019-09-30 21:57:49 -04:00
Parth 67d07254c2
Add rent estimation rpc (#6109)
* server side new rpc endpoint

* client side rpc

* take data_len as usize

Co-Authored-By: Tyera Eulberg <teulberg@gmail.com>

* add test and documentation
2019-09-26 23:27:13 +05:30
Rob Walker 43795193c4
add authorized parameters to vote api (#6072)
* add authorized parameters to vote api

* code review
2019-09-25 13:53:49 -07:00
Sagar Dhawan e987d0094f
Move status cache serialization to the Snapshot Packager service (#6081)
* Move status cache serialization to the Snapshot Packager service

* Minor comment updates

* use ok_or_else instead of ok_or

* satus cache

* Remove assert when snapshot format is wrong

* Fix compile

* Remove slots_to_snapshot from bank forks

* Address review comment

* Remove unused imports
2019-09-25 13:42:19 -07:00
carllin 261ea00efb
Fix race between observing tick height being set to last tick and blockhash being observed on a bank (#6013) 2019-09-23 12:54:39 -07:00
carllin 8240d1fe0a
Confidence implementation (#5993)
* Change confidence parameters

* Add status_cache_ancestors to get all relevant ancestors of a bank including roots from status cache

* Fix and add tests

* Clippy
2019-09-20 19:38:56 -07:00
Michael Vines a60a3efc1a
Revert "require stake, vote and executable accounts to be rent exempt (#5928)" (#6005)
This reverts commit 11e6197a83.
2019-09-20 14:10:39 -07:00
sakridge 19ae556857
hash account state on store (#5573) 2019-09-20 13:21:12 -07:00
Parth 11e6197a83
require stake, vote and executable accounts to be rent exempt (#5928)
* require vote account to be exempt

* make stake account rent exempt

* add rent exempted system instruction

* use rent exemption instruction in vote and stake api

* use rent exempted account while creating executable account

* updating chacha golden hash as instruction data has changed

* rent will be initialized for genesis bank too
2019-09-20 16:52:17 +05:30
Rob Walker 5cbd1190b2
transaction batch (#5962)
* transaction batch

* fixup
2019-09-19 10:06:08 -07:00
Michael Vines e26f68fe62
Get transactions from LockedAccountsResults when possible (#5923) 2019-09-17 08:41:56 -07:00
Parth d63518a835
Rent tangential stuff (#5910)
* rename rent.rs to rent_calculator.rs

* add rent sysvar

* integrate rent_calculator with bank

* rent_calculator integration with genesis

* add test for rent sysvar
2019-09-17 17:12:55 +05:30
Michael Vines f10438d530
Respect randomized transaction order when unlocking accounts (#5918) 2019-09-16 21:45:16 -07:00
Jack May 1853771930
Add support for SDK sysvar types (#5876) 2019-09-10 18:53:02 -07:00
Jack May 61fe1aa9cf
SDK cleanup to reduce featurization (#5856) 2019-09-09 16:38:52 -07:00
Jack May a317e9513f
Add sysvar support (#5838) 2019-09-09 10:55:35 -07:00
sakridge b35c022629 More types (#5846)
automerge
2019-09-08 11:13:59 -07:00
Jack May e8d88f3237
Split SDK's timing.rs (#5823) 2019-09-06 14:30:56 -07:00
Parth 7dfb735db9
randomize tx ordering (#4978)
Summary of Changes:
This change adds functionality to randomize tx execution for every entry. It does this by implementing OrderedIterator that iterates tx slice as per the order specified. The order is generated randomly for every entry.
2019-08-28 21:08:32 +05:30
Sunny Gleason 34ab25a88b
feat: getInflation() endpoint (#5681) 2019-08-27 18:17:03 -04:00
Michael Vines 4e827af392
Remove unnecessary trailing semicolons (#5636) 2019-08-23 22:47:54 -07:00
Rob Walker 0ffe7a9c8f
plumb some rent (#5610)
* plumb some rent

* nits

* fixups

* fixups

* fixups
2019-08-23 14:04:53 -07:00
Rob Walker 814af378a7
stake cooldown (#5553)
* stake cooldown

* fixups

* sheesh
2019-08-17 18:12:30 -07:00
Michael Vines 8258532791
System program is now registered like all other native programs (#5526) 2019-08-15 21:07:00 -07:00
carllin d791c70d90
Snapshot optimizations (#5518)
* Limit slots_since_snapshot size, only package latest snapshot, refactor tests

* Add test checking status_cache.roots == bank_forks.slots_since_snapshot after bank_forks.set_root()
2019-08-13 22:39:29 -07:00
carllin cd14a940d8
Allow process_blocktree() to start processing from any root (#5484)
* Remove unnecessary entry_height from BankInfo

* Refactor process_blocktree to support process_blocktree_from_root

* Refactor to process blocktree after loading from snapshot

* On restart make sure bank_forks contains all the banks between the root and the tip of each fork, not just the head of each fork

* Account for 1 tick_per_slot in bank 0 so that blockhash of bank0 matches the tick
2019-08-13 17:20:14 -07:00
carllin 58d4e32c97
Remove serialization of future AppendVecs and serialize AccountStorage correctly (#5510) 2019-08-13 16:05:37 -07:00
Rob Walker 07d11be6ab
add global stake warmup (#5483)
* add global stake warmup

* integrate stake history into runtime

* fixup core tests

* fixup

* remove existing cooldown tests for now
2019-08-12 20:59:57 -07:00
Justin Starry 0fde19239b
Rate limit counter metrics points to one per second (#5496)
* Rate limit counter metrics points to one per second

* Remove old env var

* Test that metrics counter is incrementing

* Fix typo
2019-08-12 18:15:34 -04:00
Rob Walker ed093f86f9
harmonize percentage members (#5459)
* harmonize percentage members

* update tests

* update capitalization when burning fees

* verify capitalization in fee burn

* fixup
2019-08-09 13:58:46 -07:00
Justin Starry 4f86c0b74a
Rate limit transaction counters (#5447)
* Rate limit transaction counters

* @sakridge feedback

* Set default high metrics rate for multinode demo

* Fix tests

* Swap defaults and fix env var tests

* Only set metrics rate if not already set
2019-08-08 17:05:06 -04:00
Sagar Dhawan 9dcf3347f5 Refactor status cache and remove complex serialize/deserialize (#5335)
automerge
2019-08-06 18:47:30 -07:00
carllin 1dbb5c8647
Deserialize snapshots (#5417)
* Deserialize snapshots
2019-08-05 22:53:19 -07:00
sakridge 832dfd4ab0
Change bank to not create default (#5409) 2019-08-02 14:46:53 -07:00
Rob Walker f7d3f55566
fix epoch_stakes again (#5396) 2019-08-01 14:27:47 -07:00
carllin 6cb2040a1b
Snapshot Packaging Service (#5262)
* Snapshot serialization and packaging
2019-07-31 17:58:10 -07:00
Rob Walker 9278201198
fix epoch_stakes (#5355)
* fix epoch_stakes

* fix stake_state to use stakers_epoch

* don't allow withdrawal before deactivation
2019-07-31 15:13:26 -07:00
Justin Starry 84368697af
Fix metrics when leader does not report metrics (#5291) 2019-07-30 16:18:33 -04:00
Rob Walker 4a57cd3300
Update bank.rs 2019-07-30 11:33:06 -07:00
Rob Walker 8537da19bb
groom accounts_db (#5283) 2019-07-25 22:59:28 -07:00
Sagar Dhawan a233a1c822
Fix poh recorder not flushing virtual ticks immediately (#5277)
* Fix poh not flushing virtual ticks immediately

* Fix test_would_be_leader_soon
2019-07-25 11:08:44 -07:00
Rob Walker 8a12ed029c
make accounts_db own the directory paths (#5230)
* change paths to something accounts_db (the singleton) owns, fixes SIGILL

* fail deserialize if paths don't work
serialize paths, too

* test that paths are populated from a bank snapshot
2019-07-23 13:47:48 -07:00
sakridge b505a0df22
Throw more threads at hash_internal_state (#5023) 2019-07-16 16:58:30 -07:00
Rob Walker fe87c05423
fix transaction_count (#5110)
* fix transaction_count

* add sig count to bank hash
2019-07-15 13:42:59 -07:00
Rob Walker 16b6576839
use precalculated max_tick_height (#5084) 2019-07-12 22:25:48 -07:00
Rob Walker d2b6c2e0ce
syscall work, rename syscall to sysvar, rename current to clock (#5074)
* syscall work, rename syscall to sysvar, rename current to clock

* missed one

* nit
2019-07-12 16:38:15 -07:00
carllin 22315d88e7
Fix credit only commit_credits race (#5028)
* Fix credit only drain race

* Refactor commit credits for tests

* Fix tests to use commit_credits_unsafe
2019-07-11 18:46:49 -07:00
Tyera Eulberg b2c776eabc
Fix getProgramAccounts RPC (#5024)
* Use scan_accounts to load accounts by program_id

* Add bank test

* Use get_program_accounts in RPC
2019-07-11 12:58:28 -06:00
Sagar Dhawan b8e7736af2 Move SLOTS_PER_SEGMENT to genesis (#4992)
automerge
2019-07-09 16:48:40 -07:00
Rob Walker 49250f62aa
make commit_credits one trip through the rwlock (#4969) 2019-07-08 20:46:21 -07:00
Rob Walker eb4edd75e6
make bank commit_credits non public (#4944)
* make bank commit_credits non pub

* track down create() failure

* move bank_client to process_transaction(), which commits credits
2019-07-08 15:37:54 -07:00
TristanDebrunner 091999a17e
fix Instruction and CompiledInstruction field names (#4895)
* s/program_ids_index/program_id for Instruction

* s/program_ids_index/program_id_index for CompiledInstruction
2019-07-01 18:34:22 -06:00
carllin 0c8f187993
remove syscall tick height (#4891) 2019-07-01 16:21:51 -07:00
sakridge a89589a1d5
Add Measure abstraction over measuring time intervals (#4851)
Allows one to swap in different implementations. This provides
the normal Insant::now() -> .elapsed() path.
2019-06-29 15:34:49 +02:00
Tyera Eulberg 66552d7047
Credit-Only Accounts: Cache account balance for thread-safe load/store (#4691)
* Implement CreditOnlyLocks

* Update credit-only atomic on account load

* Update credit-only atomic after bank.freeze_lock; store credits if all credit-only lock references are dropped

* Commit credit-only credits on bank freeze

* Update core to CreditAccountLocks

* Impl credit-only in System Transfer

* Rework CreditAccountLocks, test, and fix bugs

* Review comments: Pass CreditAccountLocks by reference; Tighten up insert block

* Only store credits on completed slot

* Check balance in bench_exchange funding to ensure commit_credits has completed

* Add is_debitable info to KeyedAccount meta to pass into programs

* Reinstate CreditOnlyLocks check on lock_account

* Rework CreditAccountLocks to remove strong_count usage

* Add multi-threaded credit-only locks test

* Improve RwLocks usage

* Review comments: panic if bad things happen; tighter code

* Assert lock_accounts race does not happen

* Revert panic if bad things happen; not a bad thing
2019-06-27 17:25:10 -04:00
carllin 97c97db97e
Fix early exit clearing all buffered packets (#4810) 2019-06-26 22:39:50 -07:00
Sagar Dhawan 8cea650535
Handle NaN and inifinite point values (#4839) 2019-06-26 18:33:52 -07:00
Sagar Dhawan df1c473341
Add storage point tracking and tie in storage rewards to economics (#4824)
* Add storage point tracking and tie in storage rewards to epochs and economics

* Prevent validators from updating their validations for a segment

* Fix test

* Retain syscall scoping for readability

* Update Credits to own epoch tracking
2019-06-26 10:40:03 -07:00
Rob Walker 8a64e1ddc3
add fee burning (#4818) 2019-06-26 10:13:21 -07:00
Sathish 9e7f618cff Set proper count value for account stores (#4797)
* set count values for store accounts

* Use AppendVecId type
2019-06-25 07:21:45 -07:00
anatoly yakovenko 29611fb61d
tower consensus naming (#4598)
s/locktower/tower/g
2019-06-24 13:41:23 -07:00
Rob Walker a49f5378e2
rewrite vote credits redemption to eat from rewards_pools on an epoch-sensitive basis (#4775)
* move redemption to rewards pools

* rewrite redemption, touch a few other things

* re-establish test coverage
2019-06-21 20:43:24 -07:00
Rob Walker 1f0f947ed2
add validator rewards pools (#4742)
* add validator rewards pools

* populate rewards syscall
2019-06-20 12:22:29 -07:00
Rob Walker 7ea522e851
add rewards syscall, groom some others (#4740) 2019-06-19 19:46:47 -07:00
Rob Walker 41fbdc6e08
use stake (#4721) 2019-06-19 11:54:52 -07:00
Sathish Ambley 8b41a5d725 periodically save config in separate folders 2019-06-17 22:48:27 -07:00
Sathish Ambley 7fd879b417 Restart validator nodes from snapshots 2019-06-17 22:48:27 -07:00
Rob Walker d86358eedc
add Account::new_data (#4701)
* add account_new_data

* fixup

* fixup
2019-06-17 15:58:05 -07:00
Rob Walker 3fe5f886d7
change store to store_account (#4689) 2019-06-14 13:34:15 -07:00
Rob Walker 4c6a6d63bf
add MiningPools, fund validator MiningPools from inflation (#4676)
* add MiningPool fund validator MinigPools from inflation

* fixup

* finish rename of MINIMUM_SLOT_LENGTH to MINIMUM_SLOTS_PER_EPOCH

* deterministic miningpool location

* point_value, not credit_value... use f64
2019-06-14 11:38:37 -07:00
Greg Fitzgerald c6b4a3a706
Witness account data in Budget (#4650)
* Add support for contracts based on account data to Budget

* Add program_id to account constraints

* No longer require a signature for the account data witness

* Rename bank::store to store_account

* fmt

* Add a doc

* clippy
2019-06-13 18:20:28 -07:00
sakridge 9e3758983d
Find max root and purge roots below it. (#4645)
* Test for forking accounts

* Find max root and purge roots below it.
2019-06-13 17:35:16 -07:00
Tyera Eulberg 8abf22f34b
Temporarily revert: Convert System Transfer accounts to credit-only (#4670) 2019-06-13 11:01:09 -06:00
Rob Walker 767efab941
add inflation to genesis (#4652)
* add inflation to genesis

* avoid having to write new()
2019-06-11 21:42:31 -07:00
Rob Walker 575a897ffc
track market cap (#4643)
* track market cap

* fixup, rebase

* prettier
2019-06-11 17:04:13 -07:00
Rob Walker 3217a1d70c
use highest staked node as bootstrap leader, remove bootstrap_leader from genesis_block (#4635)
* use highest staked node as bootstrap leader, remove bootstrap_leader from genesis_block

* clippy

* fixup

* fixup
2019-06-11 11:44:58 -07:00
Rob Walker e56430c9fb
make runtime depend on bpf_loader (#4601)
* make runtime depend on bpf_loader

* remove vote redundancy, move bpf_loader to genesis, export program\! from bpf_loader crate

* move bpf_loader specification into genesis

* bpf tests to use genesis with bpf

* need to avoid depending on programs, except for macros
2019-06-11 10:27:22 -07:00
Michael Vines e4d8ea11ac
Make lamports_per_signature dynamic based on cluster load (#4562)
* Make lamports_per_signature dynamic based on cluster load

* Move transaction-fees.md to implemented
2019-06-10 22:18:32 -07:00
carllin a4035a3c65
Remove record locks and parent locks from accounts (#4633)
* Revert "Fix parent record locks usage in child banks (#4159)"

This reverts commit 69eeb7cf08.

* Revert "Fix DuplicateSignatures caused by races on frozen banks (#3819)"

This reverts commit 083090817a.

* Remove unused imports
2019-06-10 22:05:46 -07:00
Tyera Eulberg 807c69d97c
Slimmer implementation of credit-only accounts (#4592)
* Add credit-only debit/data check to verify_instruction

* Store credits and pass to accounts_db

* Add InstructionErrors and tests

* Relax account locks for credit-only accounts

* Collect credit-only account credits before passing to accounts_db to store properly

* Convert System Transfer  accounts to credit-only, and fixup test

* Functionalize collect_accounts to unit test

* Review comments

* Rebase
2019-06-10 20:50:02 -06:00
Rob Walker 37c2fa1d8d
add current to bank syscalls (#4581) 2019-06-07 11:41:34 -07:00
carllin c9d63204eb
Replace unneeded seqcst with relaxed on atomic operations (#4587) 2019-06-06 23:53:21 -07:00
Sagar Dhawan 688f8a669a
Add a storage accounts cache to Bank (#4578) 2019-06-06 17:40:01 -07:00
Michael Vines ff77789718
Collect fees at the end of a slot (#4525) 2019-06-03 18:40:20 -07:00
Rob Walker 482ef51502
register_tick() on the correct bank (#4506)
* skip syscall_id in hash and delta

* add more tests, skip syscalls
2019-06-03 09:04:26 -07:00
Tyera Eulberg 64e8a21d73
Add tick height syscall (#4497)
* Remove tick_height from entrypoint signature

* Impl tick_height syscall and use in storage program

* Properly remove tick height from bpf handling
2019-05-31 16:29:21 -06:00
Rob Walker 1c1d83bd56
skip syscall_id in hash and delta (#4500)
* skip syscall_id in hash and delta

* add more tests, skip syscalls
2019-05-31 12:26:45 -07:00
Sathish 182096dc1a
Create bank snapshots (#4244)
* Revert "Revert "Create bank snapshots (#3671)" (#4243)"

This reverts commit 81fa69d347.

* keep saved and unsaved copies of status cache

* fix format check

* bench for status cache serialize

* misc cleanup

* remove appendvec storage on purge

* fix accounts restore

* cleanup

* Pass snapshot path as args

* Fix clippy
2019-05-30 21:31:35 -07:00
Michael Vines 1de805e7cd
Add fees syscall to expose cluster fees into programs (#4472) 2019-05-30 15:18:48 -07:00
Rob Walker 441fed7a5b
check freeze before updating slot_hashes (#4448)
* check freeze before updating slot_hashes

* fixup
2019-05-28 12:25:55 -07:00
Tyera Eulberg 0e26ee854b
Add test indicating need for credit-only account handling (#4441)
* Add test indicating need for credit-only account handling

* Add commented correct future test lines
2019-05-28 11:57:22 -04:00
Michael Vines 9843c3a5cb Restrict transaction fee payers to system accounts (#4198)
automerge
2019-05-24 13:06:55 -07:00
Michael Vines cfe5afd34c
_id => _pubkey variable renaming (#4419)
* wallet: rename *_account_id to *_account_pubkey

* s/from_id/from_pubkey/g

* s/node_id/node_pubkey/g

* s/stake_id/stake_pubkey/g

* s/voter_id/voter_pubkey/g

* s/vote_id/vote_pubkey/g

* s/delegate_id/delegate_pubkey/g

* s/account_id/account_pubkey/g

* s/to_id/to_pubkey/g

* s/my_id/my_pubkey/g

* cargo fmt

* s/staker_id/staker_pubkey/g

* s/mining_pool_id/mining_pool_pubkey/g

* s/leader_id/leader_pubkey/g

* cargo fmt

* s/funding_id/funding_pubkey/g
2019-05-23 23:20:04 -07:00
Rob Walker 35e8f966e3
add freeze_lock() and fix par_process_entries() failure to detect self conflict (#4415)
* add freeze_lock and fix par_process_entries failure to detect self conflict

* fixup

* fixup
2019-05-23 17:35:15 -07:00
Michael Vines 2ed77b040a
create_genesis_block() now returns a struct (#4403) 2019-05-22 20:39:00 -07:00
Rob Walker 7ada8510c4
add slot_hashes to bank, remove phony slot_hashes_from_vote_instruction (#4401) 2019-05-22 19:07:56 -07:00
Michael Vines f079a78c5e Remove fee arg from system_transaction::* (#4346)
automerge
2019-05-20 10:03:19 -07:00
Pankaj Garg 9476fe5ce3
Use log levels for datapoint metrics (#4335)
* Use log levels for datapoint metrics

* address review comments

* fix cyclomatic complexity
2019-05-17 17:34:05 -07:00
Pankaj Garg b2ce5dc9f5
Adjust log level for counter metrics (#4323) 2019-05-17 07:00:06 -07:00
Rob Walker 87414de3e2
switch over to passive stakes (#4295)
* add failing test

* switch over to passive stakes

* test multiple stakers
2019-05-16 08:23:31 -07:00
Pankaj Garg 778bcbce50 Reduce log level for frequent log message and frequency for metrics datapoint (#4300)
automerge
2019-05-15 16:01:17 -07:00
Rob Walker 0c1191c3ee
rework staking_utils (#4283) 2019-05-14 16:15:51 -07:00
Rob Walker 216e9a61a0
expose stake directly from bank (#4281) 2019-05-14 13:35:14 -07:00
Rob Walker e8ad822111
get program names from programs (#4273)
* get program names from programs

* fixup
2019-05-14 10:44:16 -07:00
carllin 3bd921264a
Move EpochSchedule into own module (#4272) 2019-05-13 16:24:32 -07:00
Rob Walker 0d2574f8f0
get DLL names from programs that made the DLL (#4269)
* get program names from programs

* fixup
2019-05-13 14:17:44 -07:00
Rob Walker 23c696706b
add stake_accounts to banks' caches (#4267) 2019-05-13 12:33:23 -07:00
Jack May f567877d1d
Cleanup metrics (#4230) 2019-05-10 08:33:58 -07:00
Rob Walker 81fa69d347
Revert "Create bank snapshots (#3671)" (#4243)
This reverts commit abf2b300da.
2019-05-09 19:27:27 -07:00
Sathish abf2b300da Create bank snapshots (#3671)
* Be able to create bank snapshots

* fix clippy

* load snapshot on start

* regenerate account index from the storage

* Remove rc feature dependency

* cleanup

* save snapshot for slot 0
2019-05-09 19:27:06 -07:00
carllin ab3c988146 API for getting first and last slots in epoch (#4241)
automerge
2019-05-09 16:06:57 -07:00
Pankaj Garg 1a2b131ceb
Don't forward transactions that are expired or failed signature check (#4199) 2019-05-08 10:32:25 -07:00
Rob Walker b49f8c0984
reduce replicode, introduce passive staking support (#4207) 2019-05-07 22:22:43 -07:00
Michael Vines 7609a007c6
Add FeeCalculator to the genesis block (#4196) 2019-05-07 20:28:41 -07:00
carllin 69eeb7cf08
Fix parent record locks usage in child banks (#4159)
* Introduce record locks on txs that will be recorded

* Add tests for LockedAccountsResults

* Fix broken bench

* Exit process_entries on detecting conflicting locks within same entry
2019-05-07 15:51:35 -07:00
Rob Walker 8e400fc4bd
rework genesis (passive staking groundwork) (#4187)
* rework genesis

* fixup
2019-05-07 11:16:22 -07:00