Commit Graph

525 Commits

Author SHA1 Message Date
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
Tyera Eulberg 71f9b44687
Add Confirmations parameter to RPC Subscriptions (#4154)
* Add optional depth parameter to pubsub, and store in subscriptions

* Pass bank_forks into rpc_subscription; add method to check depth before notify and impl for account subscriptions

* Impl check-depth for signature subscriptions

* Impl check-depth for program subscriptions

* Plumb fork id through accounts

* Use fork id and root to prevent repeated account notifications; also s/Depth/Confirmations

* Write tests in terms of bank_forks

* Fixup accounts tests

* Add pubsub-confirmations tests

* Update pubsub documentation
2019-05-06 08:31:50 -06:00
Rob Walker 7f75cc8906
update nightly to 2019-05-01 (#4111)
* update nightly to 2019-05-01

* cargo fmt

* cargo fmt

* increase bench timeout
2019-05-01 20:08:42 -07:00
carllin 73f250f03a
Make minimum warmup period 32 slots long (#4031)
* Make minimum warmup period 32 slots long

* PR fixes
2019-04-29 15:26:52 -07:00
anatoly yakovenko c2193a37ce
cleanup unused function (#4064) 2019-04-29 12:45:14 -07:00
anatoly yakovenko acba1d6f9e
Roots are added out of order to the accounts index (#4051)
* fix root race

* assert root order

* fixup! assert root order

* last root test

* update

* fix tests
2019-04-28 10:27:37 -07:00
anatoly yakovenko 3e14af5033
bast bank ancestor check (#4050) 2019-04-28 10:27:09 -07:00
sakridge aa0b67c93c
Use newer blockhash for recent_confirmed_blockhash api (#3995)
Oldest blockhash is sometimes too old and does not allow
for transactions to go through.
2019-04-25 16:57:25 -07:00
carllin ab11327e34
Fix mismatch between leader/validator bank votability (#3942)
* Fix mismatch between leader/validator bank votability
2019-04-23 15:32:19 -07:00
Greg Fitzgerald 29698fcd38
Cleanup stragglers from move-to-transfer rename (#3947) 2019-04-23 13:30:42 -06:00
Jack May afb00432d4
Add BankClient support to bench-exchange (#3902) 2019-04-19 13:18:20 -07:00
carllin 512bfc93cb
Add a cache for leader schedules (#3841)
* Add a cache for leader schedules
2019-04-19 02:39:44 -07:00
anatoly yakovenko 1e20d449ce
`bank_height / slot` is the block drop rate (#3816)
* bank_height/slot would give is the block drop rate

* use metrics
2019-04-16 19:35:38 -07:00
anatoly yakovenko f73d38739a
Split AccountsDB from Accounts (#3808)
Split AccountsDB from Accounts
2019-04-16 13:32:22 -07:00
anatoly yakovenko 68fc303b9b
Rework Accounts for fast squash, hashing state and checkpoint recovery. (#3613)
* accounts rewrite

* ignore grow tests

* skip duplicate roots

* allow for a root race

* logger

* accounts_index tests

* tests

* tests
2019-04-15 17:15:50 -07:00
Rob Walker de52747950
remove max_tick_height replicode (#3765) 2019-04-14 19:15:31 -07:00
Sagar Dhawan 1e8f83a74a Use a better name for new api 2019-04-12 14:58:22 -07:00
Sagar Dhawan 1db80d79fc Update get recent blockhashes to return confirmed blockhashes only 2019-04-12 14:58:22 -07:00
carllin 787dc5748a
Fixed DuplicateSigs (#3727)
* Fixed DuplicateSigs by not recording errors in signature cache of bank
2019-04-11 11:51:34 -07:00
Greg Fitzgerald 8ada4bfd1f Remove test now covered by Vote crate 2019-04-11 10:53:11 -07:00
Greg Fitzgerald 5d4624e75f Use Bank::add_instruction_processor to bypass manual build step 2019-04-11 10:53:11 -07:00
Rob Walker f1e7237c09
vote_api cleanup (#3710)
* vote_api cleanup

* fixups

* fixup

* remove unused code

* revert removal of serialize and deserialize

* ...

* increase coverage, bootstrap staking

* Sagar's STAKE to my VOTE
2019-04-10 17:52:47 -07:00
Sagar Dhawan c0808d01f8 Add tests 2019-04-10 15:51:00 -07:00
Sagar Dhawan 7fd5e51168 Make sure bank 0 is votable and correctly designate signer 2019-04-10 15:51:00 -07:00
Rob Walker d30049b8eb
test for debit of TX fees on full process_transaction() (#3643)
* fix double debit of TX fees

* add test that fails when removing that line

* put that line back in

* comments
2019-04-05 16:55:58 -07:00
Rob Walker a5b5248a09
move vote_accounts up (#3647) 2019-04-05 14:23:00 -07:00
Rob Walker 9f046a023e
move transaction_count up (#3618)
* move transaction_count up

* fixup
2019-04-05 10:42:25 -07:00
Greg Fitzgerald 46e6911ec1 Add get_signature_status() to SyncClient
And move bank::Result to transaction module.
2019-04-05 10:22:05 -07:00
Greg Fitzgerald 35298e01a8 Remove Instruction wrapper structs and name functions after enum fields 2019-04-03 13:34:27 -07:00
Greg Fitzgerald 867f6f107b Rename SystemInstruction::Move to SystemInstruction::Transfer 2019-04-03 08:35:57 -06:00
Greg Fitzgerald 43bb813cbe Rename 'new_account' to 'new_user_account'
And 'new_program_account' to 'new_account'
2019-04-02 21:24:42 -06:00
Greg Fitzgerald a0041cec97 Rename Runtime to MessageProcessor 2019-04-02 12:49:26 -06:00
Greg Fitzgerald fa1c1e3734 Rename native programs to native instruction processors 2019-04-02 10:36:19 -06:00
Greg Fitzgerald 0a9f063d3e Rename native_program.rs to instruction_processor_utils.rs
Prefer the term "instruction processor" over "program". Reserve
the term "native" for the loader and shared object it loads.
Compiling an instruction processor to BPF shouldn't imply changing
to a non-native entrypoint.
2019-04-02 10:36:19 -06:00
carllin d228b6467c
Implement finalizer so that all locked accounts are dropped (#3585)
* Implement finalizer so that all locked accounts are dropped when finalizer goes out of scope

* Add test for tx error with lock conflict

* Fix double unlock from destructor running after a call to unlock
2019-04-02 03:55:42 -07:00
Greg Fitzgerald fcef54d062 Add a constructor to generate random pubkeys 2019-03-31 16:23:18 -06:00
carllin 8660c3581e
Add squashing metrics (#3573) 2019-03-29 21:21:59 -07:00
Greg Fitzgerald 5646daa820 Delete lots of fee parameters
So many zeros!
2019-03-29 19:21:51 -06:00
Greg Fitzgerald 7896e8288d Replace Transaction::fee with a FeeCalculator 2019-03-29 19:21:51 -06:00
Greg Fitzgerald 3b516c0710 Fix build 2019-03-29 14:56:29 -06:00
Greg Fitzgerald 31f8b6d352 Integrate Message into Transaction 2019-03-29 13:03:29 -07:00
anatoly yakovenko 10239c3b3c
Replace recursive status cache with a single global fast status cache (#3541)
Fast Status Cache
2019-03-29 10:03:55 -07:00
Greg Fitzgerald cecdb7061e Remove blockhash parameter from Bank::transfer
That parameter is an artifact from the Loom days, when I thought
Bank should implement the same interace as ThinClient.
2019-03-27 08:51:10 -06:00
Greg Fitzgerald ca2ac1e5ea Remove a mostly unused Transaction constructor 2019-03-26 15:46:58 -07:00
Rob Walker 215b07c1a9
remove status_cache.freeze (#3506) 2019-03-26 11:56:25 -07:00
Greg Fitzgerald df333e8b6e Move new_move_many to SystemInstruction 2019-03-26 09:22:29 -07:00
Greg Fitzgerald acedf4ca5a Move Instruction into its own module 2019-03-23 20:31:55 -07:00
Rob Walker 31b8743052
delay freeze of status_cache until squash (#3453) 2019-03-22 22:14:56 -07:00
Sathish 06b0c98c75
Remove accounts when the fork is removed (#3384)
* Fix test

* Cleanup accounts when the fork is removed

* Update test to check for deleted accounts
2019-03-21 17:36:10 -07:00
anatoly yakovenko 148e08a8a5
Enable cluster tests (#3372)
* Cluster tests

* stable!

* fixup! stable!

* fixup! fixup! stable!

* fixup! fixup! fixup! stable!

* fixup! fixup! fixup! fixup! stable!

* fixed space

* add getNumBlocksSinceSignatureConfirmation entry for the json rpc docs

* Check in upcoming epochs for potential leadership slots in next_leader_slot()
2019-03-21 07:43:21 -07:00
Stephen Akridge bcb190a12a Remove erroneous comment 2019-03-20 16:15:25 -07:00
Rob Walker df9fd2bc0b
stop copying Blooms (#3379)
* stop copying Blooms

* fixup

* clippy
2019-03-20 11:06:39 -07:00
Michael Vines 0dc364c17a Relocate transaction reference verification to join the other validity checks 2019-03-20 07:46:01 -07:00
Carl 5e21268ca0 PR comments 2019-03-18 20:46:11 -07:00
Carl b38e3bef01 Modify bank_forks to support squashing/filtering new root and also don't remove parents from bank_forks when inserting, otherwise we lose potential fork points when querying blocktree for child slots 2019-03-18 20:46:11 -07:00
Greg Fitzgerald c09accb685 Rename StaticEntrypoint to ProcessInstruction 2019-03-18 08:22:54 -07:00
Greg Fitzgerald 55cdbedb52 Allow tests to add instruction processors
Make runtime a private module again.
2019-03-18 08:22:54 -07:00
Greg Fitzgerald ee39f31d81 Add Runtime object. Allow any number of static loaders. 2019-03-18 08:22:54 -07:00
Greg Fitzgerald 24d9138067 Abandon Builder pattern 2019-03-15 14:46:44 -06:00
Greg Fitzgerald e091aa87ea More precise constructor names 2019-03-15 14:46:44 -06:00
Greg Fitzgerald 968022a1b0 Instruction name swap
* Instruction -> GenericInstruction
* Instruction<u8, u8> -> CompiledInstruction
* Instruction<Pubkey, (Pubkey, bool)> -> Instruction
2019-03-15 14:46:44 -06:00
Greg Fitzgerald 7b4568b9bf Migrate to sign_checked() 2019-03-15 09:06:54 -06:00
Sagar Dhawan 3f2fc21bb3
Rename hash_queue and fix boundary condition (#3289) 2019-03-14 11:56:36 -07:00
Greg Fitzgerald c1eec0290e
Rename userdata to data (#3282)
* Rename userdata to data

Instead of saying "userdata", which is ambiguous and imprecise,
say "instruction data" or "account data".

Also, add `ProgramError::InvalidInstructionData`

Fixes #2761
2019-03-14 10:48:27 -06:00
Greg Fitzgerald e58220282a Move TransactionError into the SDK 2019-03-13 21:26:57 -06:00
Greg Fitzgerald 4ca4038d54 Rename BankError to TransactionError 2019-03-13 21:26:57 -06:00
Greg Fitzgerald 150cd31ec0 Blur the line between Bank and Runtime 2019-03-13 21:26:57 -06:00
Greg Fitzgerald 6fd0d4dcf5 Boot error piggybacking on BankError 2019-03-13 21:26:57 -06:00
Greg Fitzgerald 6a89c68a1d Add utility function to help get System error out of ProgramError 2019-03-13 21:26:57 -06:00
Greg Fitzgerald c14cce4c85 Add InstructionError for runtime instruction errors 2019-03-13 21:26:57 -06:00
carllin af03df38b9
Don't vote for empty leader transmissions (#3248)
* Don't vote for empty leader transmissions

* Add is_delta flag to bank to detect empty leader transmissions

* Plumb new is_votable flag through replay stage

* Fix PohRecorder tests

* Change is_delta to AtomicBool to avoid making Bank references mutable

* Reset start slot in poh_recorder when working bank is cleared, so that connsecutive TPU's will start from the correct place

* Use proper max tick height calculation

* Test for not voting on empty transmission

* tests for is_votable
2019-03-13 14:06:12 -07:00
Rob Walker 9f916f9d47 remove Option<> wrapper for accounts 2019-03-12 15:03:26 -07:00
Michael Vines 1ee43a7633 Remove non-essential programs from runtime/ 2019-03-12 15:11:59 -05:00
Sagar Dhawan 78bb96ee51
Reduce bootstrap leader stake (#3218) 2019-03-11 13:29:44 -07:00
Rob Walker 195a880576
pass Pubkeys as refs, copy only where values needed (#3213)
* pass Pubkeys as refs, copy only where values needed

* Pubkey is pervasive

* fixup
2019-03-09 19:28:43 -08:00
Tyera Eulberg b053bc2790 Load accounts by program owner for program subscriptions 2019-03-07 17:21:32 -07:00
Rob Walker 01fb76f4bd
add epoch warmup (#3166)
add epoch warmup
2019-03-06 16:32:23 -08:00
Rob Walker 63a4ed74a4
consolidate logic for epoch and slot_index into Bank (#3144) 2019-03-06 14:44:21 -08:00
Pankaj Garg 9163e5b004 Fix sorting order of stakes in confirmation time calculations 2019-03-06 13:11:04 -08:00
Michael Vines 53f09c44f3 Rename tokens to lamports in sdk/ 2019-03-05 17:28:06 -08:00
Rob Walker cb0560df92 remove dead code 2019-03-05 15:35:24 -08:00
Rob Walker b9e878ee80
slot_height considered harmful (#3135)
* slot_height considered harmful
* fix test_tick_slot_epoch_indexes
2019-03-05 14:18:29 -08:00
Sagar Dhawan 9349f90a59
Inherit transaction count from parent (#3134) 2019-03-05 12:34:21 -08:00
Greg Fitzgerald 885eeec3ed Boot storage program from the SDK 2019-03-05 07:16:33 -07:00
Greg Fitzgerald 5e9f802d7d Boot token_program from the SDK 2019-03-05 07:16:33 -07:00
Rob Walker 43bab23651
remove duplicate child creation (#3100)
* remove duplicate child creation
* resurrect test for partial slot
* simplify blocktree_processor some more (no tick_height, yay!)
* ensure frozen
2019-03-04 19:22:23 -08:00
Rob Walker 794e961328
use Bank's notion of leader_id where possible (#3119) 2019-03-04 18:40:47 -08:00
Sagar Dhawan dc42c12f2b
Revert to more consistent naming (#3114) 2019-03-04 17:50:19 -08:00
Stephen Akridge 97274030b9 Add test with transaction with no signatures
Add checks for no signature
2019-03-04 16:42:52 -08:00
carllin de1d7ce312
Cleanup staking utils to divide functionality between delegate and normal node utitliites. Also replaces vote_states() with more generalized vote_accounts() in Bank. (#3070) 2019-03-03 18:04:13 -08:00
Greg Fitzgerald 1edf6c361e
Move Vote program out of the SDK 2019-03-02 16:44:36 -08:00
Sagar Dhawan b99e3eafdd
Fix stakes not being setup correctly 2019-03-02 16:44:36 -08:00
Greg Fitzgerald e6486b2824
Move Budget out of the SDK 2019-03-02 16:44:36 -08:00
Sagar Dhawan d22a13257e
Refactor bank get vote accounts (#3052) 2019-03-02 16:44:36 -08:00
Michael Vines a94880574b block_hash => blockhash 2019-03-02 12:13:30 -07:00
Michael Vines 258cf21416 Purge remaining last_id (now called block_hash) 2019-03-02 12:13:30 -07:00
Michael Vines 2bfad87a5f Rename Bank.last_id() to Bank.last_block_hash() 2019-03-02 12:13:30 -07:00
Michael Vines 0743f54dfe Rename LastIdNotFound to BlockHashNotFound 2019-03-02 12:13:30 -07:00
Michael Vines 176d5e0d37 Rename Transaction last_id field to recent_block_hash 2019-03-02 12:13:30 -07:00
Stephen Akridge 16b71a6be0 Cleanup fork id generation
Accounts could end up with id collision depending on how
banks are created, this shouldn't happen.
2019-03-02 10:34:41 -08:00
Michael Vines d5de5bec4f Register a new last_id once per slot 2019-03-02 08:47:31 -08:00
Michael Vines 61beb42797 Decouple tick counting from hash queue 2019-03-02 08:47:31 -08:00
Michael Vines e5be3e1dca HashQueue no longer hard codes max_entries 2019-03-02 08:47:31 -08:00
Greg Fitzgerald 49b7e67585 Return program error from process_transaction()
Our unit-test helper `process_transaction()` wasn't returning
program errors, which made testing programs tedious and
counter-intuitive.
2019-03-02 07:50:32 -07:00
Rob Walker 54417acfba
changed vote_states to vote_accounts, more useable (#3047) 2019-03-01 17:22:49 -08:00
Rob Walker 29d12d9ff1
remove new_bank_from_parent_with_id() (#3039) 2019-03-01 16:39:23 -08:00
Rob Walker a7c18cc0b4 Fnbool_to_FnOptionT 2019-03-01 14:12:50 -08:00
Michael Vines e30e4cc603 Remove get_confirmation_timestamp() from HashQueue 2019-03-01 13:38:17 -08:00
Michael Vines fdc31e99df Clean up type casts 2019-03-01 13:38:17 -08:00
Michael Vines a72325dbc2 entry_id -> entry 2019-03-01 13:38:17 -08:00
Michael Vines 67b6be66c8 Rename MAX_ENTRY_IDS 2019-03-01 13:38:17 -08:00
Michael Vines 8ec13d557f Generalize tick_height to hash_height 2019-03-01 13:38:17 -08:00
Michael Vines 31f570a9f4 Remove unused functions 2019-03-01 13:38:17 -08:00
Rob Walker 38273427ad
have banks save vote_state by epoch to support stable leader schedules (#3019)
have banks save vote_state by epoch to support stable leader schedules
2019-03-01 11:54:28 -08:00
Michael Vines 46fb0b1b94 Rename last_id to last_hash within HashQueue 2019-03-01 11:48:09 -08:00
Michael Vines 224b705f8d Rename genesis_block.last_id() to genesis_block.hash() 2019-03-01 11:48:09 -08:00
Michael Vines a57fb00584 Rename last_id_queue.rs to hash_queue.rs 2019-03-01 09:50:51 -08:00
Michael Vines 360055ad70 Rename LastIdQueue to HashQueue 2019-03-01 09:50:51 -08:00
Greg Fitzgerald c53c351759 Rename erc20 to token-program
Everything it uses already had that name, just the crate was never
renamed.
2019-03-01 10:47:38 -07:00
Pankaj Garg b41286919d
Rename bank.id to bank.slot (#3018) 2019-02-28 18:02:45 -08:00
Sagar Dhawan 20e4edec61
Refactor Vote Program Account setup (#2992) 2019-02-28 17:08:45 -08:00
Stephen Akridge 1c44b738fe Fix vote_accounts test 2019-02-28 15:22:47 -08:00
carllin 217f30f9c3
Add get_supermajority_slot() function (#2976)
* Moved supermajority functions into new module, staking_utils

* Move staking functions out of bank, and into staking_utils, change get_supermajority_slot to only use state from epoch boundary

* Move bank slot height in staked_nodes_at_slot() to be bank id
2019-02-28 13:15:25 -08:00
Michael Vines dad1511484 test_bank_squash: validate transaction_count() before/after squashing 2019-02-27 23:21:49 -08:00
Rob Walker d23f8a3e99
increase accounts coverage (#2993) 2019-02-27 21:42:14 -08:00
Michael Vines 0dc5af62ff Standardize on 'use log::*' for easy access to all log level macros 2019-02-27 21:16:23 -08:00
Rob Walker 163874d4da
remove `purge` parameter to accounts (#2990) 2019-02-27 16:06:06 -08:00
Michael Vines b6ccb475f1
Clarify FIXME source 2019-02-27 10:37:48 -08:00
Sathish Ambley 4149f7fd1c Fix review comments 2019-02-27 08:22:52 -08:00
Sathish Ambley c46b2541fe - Fix lock/unlock of accounts
- Fix format check warnings
2019-02-27 08:22:52 -08:00
Stephen Akridge 2158ba5863 tx count per fork 2019-02-27 08:22:52 -08:00
Stephen Akridge 180d297df8 Rebase and panic with no accounts
Add Accounts::has_accounts function for hash_internal_state calculation.
2019-02-27 08:22:52 -08:00
Sathish Ambley c276375a0e Persistent account storage across directories 2019-02-27 08:22:52 -08:00
carllin 033a04129a Add lockouts to vote program (#2944)
* Add lockouts to vote program

* Rename MAX_VOTE_HISTORY TO MAX_LOCKOUT_HISTORY, change process_vote() to only pop votes after MAX_LOCKOUT_HISTORY + 1 votes have arrived

* Correctly calculate serialized size of an Option, rename root_block to root_slot
2019-02-26 22:19:31 -07:00
Stephen Akridge 72214b2b68 Squash test to test parent bank after squash 2019-02-26 15:15:34 -08:00
Rob Walker 87281f6ed5
ensure at Accounts level that tokens == 0 means None (#2960) 2019-02-26 13:51:39 -08:00
Greg Fitzgerald af206111e2 Hoist new leader scheduler up to protocol level
Attempt to feel similar to LeaderScheduler to easy migration.
2019-02-26 08:23:01 -08:00
Greg Fitzgerald 3897b66270 Let the bank creator decide where to send transaction fees 2019-02-26 08:06:08 -07:00
Greg Fitzgerald feefdca969 Minor cleanup to Bank and LastIdQueue 2019-02-26 06:46:38 -08:00
Rob Walker 25690ff078
merge_parents() => squash() (#2943) 2019-02-25 20:34:05 -08:00
Michael Vines 897279eddb Encapsulate log::Level so counter macro users don't need to use it 2019-02-25 20:01:30 -08:00
Rob Walker 67c9bbc6b2
* drop parents once merged (#2930)
* add bank.id() which can be used by BankForks, blocktree_processor
* add bank.hash(), make hash_internal_state() private
* add bank.freeze()/is_frozen(), also useful for blocktree_processor, eventual freeze()ing in replay
2019-02-25 14:05:02 -08:00
Greg Fitzgerald 2fbdec59cb Generalize access to staked nodes 2019-02-25 08:49:43 -08:00
Greg Fitzgerald 710f88edda Handle edge cases earlier
We have lots of tests that work off genesis block.  Also, one
might want to generate a future leader schedule under the assumption
the stakers stay the same.
2019-02-25 08:49:43 -08:00
Greg Fitzgerald db899a2813 Inline LeaderSchedule::new_from_bank()
Breaks circular dependency and offers more flexibility in bank's
usage.
2019-02-25 08:49:43 -08:00
Greg Fitzgerald 72b4834446 Add Bank::prev_slot_leader() and Bank::next_slot_leader() 2019-02-25 08:49:43 -08:00
Greg Fitzgerald ec48c58df1 Award tx fees to validators in new leader schedule
Also, generalize the leader_schedule functions a bit to allow for
prev_slot_leader and next_slot_leader, should they be needed.
2019-02-25 08:49:43 -08:00
Greg Fitzgerald 0947ec59c9 Expose the new leader schedule functionality from the bank. 2019-02-25 08:49:43 -08:00
Greg Fitzgerald ba7d121724 Switch to Bank::staked_nodes(); want node_id, not staker_id
Also, update LeaderScheduler's code to use node_id as well.
Unfortuntely, no unit tests for this, because there's currently
only one way to set staker_id/node_id, and they are both set
to the same value.
2019-02-24 07:52:44 -07:00
Greg Fitzgerald a1070e9572 Split ActiveStakers over Bank and LeaderScheduler 2019-02-24 07:52:44 -07:00
Stephen Akridge 66891d9d4e Don't use global storage account
Other accounts would not be able to modify the system accounts userdata.
2019-02-22 15:59:55 -08:00
Pankaj Garg c07b6c30a1 Remove special casing of ProgramError in blocktree processor
- Also refactor bank.rs and add unit tests
2019-02-22 12:13:05 -08:00
Greg Fitzgerald f0f55af35b Add scheduler config to genesis
Anything that affects how the ledger is interpreted needs to be
in the genesis block or someplace on the ledger before later
parts of the ledger are interpreted. We currently don't have an
on-chain program for cluster parameters, so that leaves only
the genesis block option.
2019-02-21 17:29:55 -08:00
Pankaj Garg 3e8d96a95b fix failing tests 2019-02-21 16:35:23 -08:00
Pankaj Garg 9713a3ac02 fix clippy warnings 2019-02-21 16:35:23 -08:00
Pankaj Garg 5c9777970d moved fee collection code to runtime 2019-02-21 16:35:23 -08:00
Pankaj Garg c142a82ae0 Charge transaction fee even in case of ProgramError 2019-02-21 16:35:23 -08:00
Greg Fitzgerald f76ac94d70 Remove leader_schedule_offset public method
Also,

* Rename the private variable to include units.
* Better doc
2019-02-21 12:28:11 -08:00
Greg Fitzgerald 32caa55d67 Offer a way to get the leader_schedule from any Bank instance 2019-02-21 12:28:11 -08:00
Rob Walker f6ff33db8e
* add merge_parents(), which means 'eat your parent' (#2851)
* add is_root(), which is false if the bank has a parent
* use is_root() for store_slow and store_accounts to decide whether to purge on zero balance
2019-02-21 12:08:50 -08:00
Greg Fitzgerald 40977fa99f More forward-looking test 2019-02-21 10:54:25 -07:00
Greg Fitzgerald f4df8ff5b3 Add slot_height() and epoch_height() methods to Bank 2019-02-21 10:54:25 -07:00
Sagar Dhawan 13d018e3e1
Fix stake selection for the Data Plane (#2863)
* Update data-plane to use stakes instead of a bank directly

* Rename get_stakes to staked_nodes
2019-02-20 21:38:16 -08:00
Sagar Dhawan 3c62e2332e
Cleanup stakes for gossip (#2860) 2019-02-20 20:02:47 -08:00
Greg Fitzgerald b8f6280fe5 Move hash_internal_state tests into runtime
This was intended as a Bank test, but only in blocktree_processor
because of its dependency on Entry, which solana_runtime doesn't
know about.
2019-02-20 16:13:26 -08:00
Greg Fitzgerald 822bebea46 Allow multiple forks without regenerating the hash 2019-02-20 16:13:26 -08:00
Greg Fitzgerald 582a7192ec Hold Bank's own parent hash instead of the parent's 2019-02-20 16:13:26 -08:00
Greg Fitzgerald 9848de6cda Remove special case in Bank::deposit()
And use it to process the genesis block.
2019-02-20 08:12:37 -07:00
Pankaj Garg a33921ed34 address review comments 2019-02-20 08:12:37 -07:00
Pankaj Garg 2e75ff27ac Fix test 2019-02-20 08:12:37 -07:00
Pankaj Garg a27cdf55e7 Credit transaction fees to the slot leader 2019-02-20 08:12:37 -07:00
Greg Fitzgerald dda0a1f39b Move storage tests out of Bank 2019-02-19 17:26:33 -07:00
Greg Fitzgerald 04f54655c2 Minor cleanup 2019-02-19 15:53:31 -08:00
Rob Walker dc5590f2bf
unuse std (#2833) 2019-02-19 15:27:07 -08:00
Greg Fitzgerald 36546b4c4c Expose a Bank API for adding native programs
Also use it to tighten up the code to add the builtin programs.
2019-02-19 10:20:27 -07:00
Greg Fitzgerald dde886f058 Move Bank to its own crate
Also:
* counters.rs to solana_metrics
* genesis_block.rs to solana_sdk
2019-02-19 07:17:04 -07:00