Commit Graph

2578 Commits

Author SHA1 Message Date
c4943f3cb0 checked_sub_lamports (#16932) 2021-04-30 09:56:34 -05:00
63c56b57a9 checked_sub_lamports with unwrap (#16922)
* checked_sub_lamports with unwrap

* avoid unwrap
2021-04-29 15:04:28 -05:00
c9c94a7ef2 checked_sub_lamports (#16923) 2021-04-29 12:38:21 -05:00
ca7b36ad8f lamports -> lamports() (#16920) 2021-04-29 10:44:46 -05:00
23d67e4ac7 stretchy roots tracker (#16830)
* stretchy roots tracker

* rename hash to hash_set in tests

* update comment

* try 2 widths in test

* bool iter

* add assert

* helper function for bitfield insert/remove

* introduce RollingBitFieldTester

* another bool iter replacement

* map cleanup

* map to cloned
2021-04-29 09:11:28 -05:00
a7070a5ca7 set_lamports() (#16921) 2021-04-28 21:30:06 +00:00
21c75d9d29 lamports = -> set_lamports (#16919) 2021-04-28 15:39:54 -05:00
f533d3be77 Write account path impl ReadableAccount (#16779) 2021-04-28 15:29:22 -05:00
9070191b8b stats on clean for removing roots (#16849)
* stats on clean for removing roots

* rename

* accumulate and swap metrics
2021-04-28 13:24:01 -05:00
77f1ffd84b Collect uncleaned pubkeys from all slots (#16786)
While working on another issue (#16580), the list of uncleaned pubkeys
returned from `remove_uncleaned_slots_and_collect_pubkeys_up_to_slot()`
did not include unrooted slots.  This meant that during cleaning,
unrooted slots would not have their pubkeys cleaned up properly.

Now, return all uncleaned pubkeys, regardless if the slot is rooted or
not.  Additionally, update the tests to have unrooted slots to ensure
this behavior.

This is part two of PR #16879, and originally based on PR #15106.
2021-04-28 10:57:42 -05:00
a7a671b3aa AccountSharedData.set_executable() (#16881) 2021-04-28 14:07:43 +00:00
2021255f91 executable() (#16880) 2021-04-28 08:53:54 -05:00
da3342759b private AccountSharedData.rent_epoch (#16877) 2021-04-28 08:52:20 -05:00
6381ee38eb reclaims unref accounts from index (#16838) 2021-04-28 08:50:38 -05:00
1864bc2080 write Option<AccountSharedData> (#16874)
* write Option<&AccountSharedData>

* add comment
2021-04-28 08:47:26 -05:00
1eaff394da Refactor collect_uncleaned_pubkeys_to_slot() (#16879)
* Refactor `collect_uncleaned_pubkeys_to_slot()`

While working on another issue (#16580), I came across
`collect_unclean_pubkeys_to_slot()` and had difficulty understanding it.
Since the function does a few logically separate things, I split the
function up.  I also added documentation, removed an unused return value,
and renamed the functions to be more specific.

This commit is to split up an existing PR (#16786), where I had both this
aesthetic change _and_ a behavioral change.
2021-04-28 08:16:12 -05:00
1bd623cd15 private AccountSharedData.rent_epoch (#16844) 2021-04-27 13:51:13 -05:00
8f56c116d7 tests: lamports += to checked_add (#16842) 2021-04-27 10:23:07 -05:00
d533f77301 bank.withdraw uses checked_sub_lamports (#16848)
* bank.withdraw uses checked_sub_lamports

* retain previous codepath for error

* map_err from clippy
2021-04-27 09:58:41 -05:00
3887169db0 lamports += to checked_add (#16841) 2021-04-27 09:56:18 -05:00
47ca7063f2 rootstracker.remove returns previous state (#16831) 2021-04-27 09:15:44 -05:00
3fdbaefaa6 tests: lamports -= to checked_sub (#16843) 2021-04-27 09:12:48 -05:00
998cba74b5 AccountSharedData.executable() (#16835) 2021-04-27 09:12:17 -05:00
81402ee7f5 pass &Pubkey through account storage, slot clean code to reduce copies (#16778)
* &Pubkey

* use trait to pass &Hash or Hash

* use impl Borrow<Hash> instead of trait

* remove old code line commented out
2021-04-27 09:10:06 -05:00
603872685d private AccountSharedData.owner (#16760)
* private AccountSharedData.owner

* fix perf test
2021-04-26 14:59:17 -05:00
f2ab0384e4 owner -> owner() (#16783) 2021-04-26 17:06:40 +00:00
aeff911c93 owner -> owner() (#16784) 2021-04-26 10:40:11 -05:00
d9dcd28d82 Ignore racy test_load_account_and_purge_race_without_retry 2021-04-23 23:17:56 +00:00
ca14c18998 owner -> owner() (#16782) 2021-04-23 22:49:47 +00:00
1a4a7059af owner -> owner() (#16785) 2021-04-23 15:59:13 -05:00
48c07d32f0 WritableAccount.add/subtract_lamports (#16750)
* add/sub lamports

* make add/sub return Result

* sample replacements

* cleanup

* fix up a few tests as examples

* move enum, cleanup, impl from

* fmt

* cleanup

* add lamports.rs
2021-04-23 20:20:48 +00:00
be29568318 runtime: checked math for Bank::withdraw 2021-04-23 20:13:35 +00:00
dcf2d84b24 refactor complicated 'len' (#16777) 2021-04-23 18:36:49 +00:00
04e6aebf35 .owner = X -> .set_owner(X) (#16759) 2021-04-23 18:26:33 +00:00
fb0b76c1f3 account.owner = X -> account.set_owner(X) (#16754) 2021-04-23 12:34:22 -05:00
7602911f9a read_only_cache remove updates cache size (#16742) 2021-04-23 12:00:17 -05:00
1cc9a1c0eb log roots range metric (#16636)
* log roots range metric

* rename
2021-04-23 16:09:39 +00:00
96d21335e1 .owner -> .owner() (#16758) 2021-04-23 09:35:55 -05:00
5591cd6ef3 .owner -> .owner() (#16757)
* .owner -> .get_owner()

* use
2021-04-23 09:35:09 -05:00
6c5b7ecf90 account.owner = X -> account.set_owner(X) (#16756) 2021-04-23 09:34:28 -05:00
91be2903da Reduce account index lookups during clean (#16689)
* reduce account index lookups in clean

* rename

* rename enum

* hold locks during removal from zero pubkey list

* merge with zero lamport fix

* tests
2021-04-23 09:33:14 -05:00
fc12841d95 Readonlyaccounts (#16743)
* lamports -> lamports()

* format
2021-04-22 20:04:55 +00:00
739f0698ab clean read_only_cache in the bg (#16722)
* clean read_only_cache in the bg

* reset lru_index

* cleanup

* cleanup

* drop for read only cache

* join bg thread

* reuse existing lru vec

* simplify reserve logic
2021-04-22 13:59:58 -05:00
333998d008 .lamports = <number> -> .set_lamports(<number>) (#16746) 2021-04-22 18:56:47 +00:00
8a6b80095e Set lamports (#16747)
* lamports = -> set_lamports()

* .lamports = X -> .set_lamports(X)
2021-04-22 13:53:06 -05:00
8d9d6b62d9 use cheaper account get (#16682) 2021-04-22 12:54:08 -05:00
123e0bdba7 don't iterate slot_list if zero-lamport (#16678) 2021-04-21 20:38:48 -05:00
69cbad0869 some ReadableAccount changes (#16688)
* some ReadableAccount changes

* deref
2021-04-21 12:20:37 -05:00
189d2121e6 simplify do_shrink_slot_stores, delay/reduce account clone (#16691) 2021-04-21 11:17:38 -05:00
9852572eb9 increase rolling slot width to 4M (#16583) 2021-04-20 21:18:15 -05:00