Commit Graph

359 Commits

Author SHA1 Message Date
Tyera Eulberg 90778615f6 Use bounded timestamp-correction when feature enabled 2020-10-31 21:30:42 -07:00
Jack May c458d4b213
move Account to solana-sdk (#13198) 2020-10-28 22:01:07 -07:00
Tyera Eulberg 39686ef098
Use bank timestamp to populate Blockstore::blocktime_cf when correction active (#13158) 2020-10-26 19:23:45 +00:00
Josh 766406fd23
add precompile verification to simulate_transaction (#13080) 2020-10-23 20:47:51 -07:00
Michael Vines 959880db60 Remove unused pubkey::Pubkey imports 2020-10-21 19:08:13 -07:00
Michael Vines 7bc073defe Run `codemod --extensions rs Pubkey::new_rand solana_sdk::pubkey::new_rand` 2020-10-21 19:08:13 -07:00
Trent Nelson c26512255d RPC: Add metrics for TX encoding 2020-10-14 12:24:11 -06:00
Michael Vines 247228ee61 Implementation-defined RPC server errors are now accessible to client/ users 2020-10-13 10:05:44 -07:00
Michael Vines 649fe6d3b6 get_vote_accounts: access HashMap directly instead of turning it into an iterator 2020-10-13 04:12:10 +00:00
Trent Nelson e35889542b RPC: Support base64 encoded transactions
Defaults to base58
2020-10-06 22:41:06 -06:00
Trent Nelson 7f67d36777 RPC: Check encoded transaction size before decoding 2020-10-06 22:41:06 -06:00
Michael Vines 75b621160e Add GetConfirmedBlocksWithLimit RPC method 2020-10-01 22:56:17 -07:00
Tyera Eulberg 96a7d4dbd8
Query BigTable for block time if does not exist in blockstore (#12560) 2020-09-29 21:39:36 +00:00
Tyera Eulberg 89621adca7
Rpc -> proper optimistic confirmation (#12514)
* Add service to track the most recent optimistically confirmed bank

* Plumb service into ClusterInfoVoteListener and ReplayStage

* Clean up test

* Use OptimisticallyConfirmedBank in RPC

* Remove superfluous notifications from RpcSubscriptions

* Use crossbeam to avoid mpsc recv_timeout panic

* Review comments

* Remove superfluous last_checked_slots, but pass in OptimisticallyConfirmedBank for complete correctness
2020-09-28 20:43:05 -06:00
sakridge 6583c8cffe
Add precompile verification to preflight (#12486) 2020-09-27 22:29:00 -07:00
Michael Vines 35f5f9fc7b Add feature set identifier to gossiped version information 2020-09-25 11:40:36 -07:00
Josh 1d04c1db94
introduce RpcPerfSample and modify getPerformanceSamples output (#12434)
* introduce RpcPerfSample and modify getPerformanceSamples output

* camelCase test results
2020-09-24 14:22:22 -07:00
Justin Starry 731a943239
Remove transaction encoding from storage layer (#12404) 2020-09-24 13:10:29 +08:00
Tyera Eulberg e1a212fb79
Bump spl-token (#12395) 2020-09-22 17:08:54 -06:00
Josh 65a6bfad09
Add blockstore column to store performance sampling data (#12251)
* Add blockstore column to store performance sampling data

* introduce timer and write performance metrics to blockstore

* introduce getRecentPerformanceSamples rpc

* only run on rpc nodes enabled with transaction history

* add unit tests for get_recent_performance_samples

* remove RpcResponse from rpc call

* refactor to use Instant::now and elapsed for timer

* switch to root bank and ensure not negative subraction

* Add PerfSamples to purge/compaction

* refactor to use Instant::now and elapsed for timer

* switch to root bank and ensure not negative subraction

* remove duplicate constants

Co-authored-by: Tyera Eulberg <tyera@solana.com>
2020-09-22 12:26:32 -07:00
Michael Vines c4913e3c9e SendTransactionServices now exit their thread on channel drop instead of by a flag 2020-09-18 17:29:10 +00:00
Trent Nelson 32dcce0ac1 RPC: Limit request payload size to 50kB 2020-09-16 20:21:59 +00:00
Justin Starry f6cda2579f Fix off-by-one max payload checks 2020-09-16 12:46:06 -07:00
Michael Vines c6eea94edc Remove stale comment 2020-09-16 08:42:26 -07:00
Michael Vines 749208fa32 RPC sendTransaction now returns transaction logs on simulation failure 2020-09-16 08:42:26 -07:00
sakridge 3930cb865a
Add keccak-secp256k1 instruction (#11839)
* Implement keccak-secp256k1 instruction

Verifies eth addreses with ecrecover function

* Move secp256k1 test
2020-09-15 18:23:21 -07:00
Ryo Onodera de4a613610
Check bank capitalization (#11927)
* Check bank capitalization

* Simplify and unify capitalization calculation

* Improve and add tests

* Avoid overflow and inhibit automatic restart

* Fix test

* Tweak checked sum for cap. and add tests

* Fix broken build after merge conflicts..

* Rename to ClusterType

* Rename confusing method

* Clarify comment

* Verify cap. in rent and inflation tests

Co-authored-by: Stephen Akridge <sakridge@gmail.com>
2020-09-12 01:48:06 +09:00
Michael Vines 10ce839ec0 Speed up `bigtable transaction-history` command 2020-09-10 05:22:10 +00:00
Tyera Eulberg 05db41fe9c
Cache block time in Blockstore (#11955)
* Add blockstore column to cache block times

* Add method to cache block time

* Add service to cache block time

* Update rpc getBlockTime to use new method, and refactor blockstore slightly

* Return block_time with confirmed block, if available

* Add measure and warning to cache-block-time
2020-09-09 09:33:14 -06:00
Michael Vines 9e96180ce4 getMinimumBalanceForRentExemption now only responds to valid account lengths 2020-09-08 17:48:09 +00:00
anatoly yakovenko c67f8bd821
Forward transactions to the expected leader instead of your own TPU port (#12004)
* Use PoHRecorder to send to the right leader

* cleanup

* fmt

* clippy

* Cleanup, fix bug

Co-authored-by: Carl <carl@solana.com>
2020-09-08 17:00:49 +08:00
Justin Starry 9940870c89
Fix RPC transaction method configs serialization (#12100) 2020-09-08 13:08:09 +08:00
Michael Vines d8e2038dda Add --enable-bigtable-ledger-upload flag 2020-09-04 16:01:49 -07:00
Tyera Eulberg 90fad36613
Use new_response for consistency 2020-09-03 12:02:26 -06:00
Tyera Eulberg b22de369b7
Rpc: add getMultipleAccounts endpoint (#12005)
* Add rpc endpoint to return the state of multiple accounts from the same bank

* Add docs

* Review comments: Dedupe account code, default to base64, add max const

* Add get_multiple_accounts to rpc-client
2020-09-03 11:35:06 -06:00
Michael Vines 7341e60043 Ensure that the spl-token 2 native mint account is owned by the spl-token 2 program.
Workaround for https://github.com/solana-labs/solana-program-library/issues/374 until spl-token 3 is shipped
2020-09-01 17:09:36 +00:00
Tyera Eulberg 60c7ac6f95
Fix get_parsed_token_accounts (#11907) 2020-08-29 12:38:27 -06:00
Tyera Eulberg 2eff9a19c3
Update to token pack/unpack changes (#11900) 2020-08-28 22:06:30 -06:00
Tyera Eulberg 76be36c9ce
Update spl-token to v2.0 (#11884)
* Update account-decoder to spl-token v2.0

* Update transaction-status to spl-token v2.0

* Update rpc to spl-token v2.0

* Update getTokenSupply to pull from Mint directly

* Fixup to spl-token v2.0.1
2020-08-28 15:54:57 -06:00
Tyera Eulberg 1988ee9cd6
Rpc: Filter accounts with invalid mints from get_parsed_token_accounts (#11844)
* Filter out accounts with invalid mints from get_parsed_token_accounts

* Explicit docs
2020-08-26 11:39:42 -06:00
Michael Vines b660704faa Allow the sendTransaction preflight commitment level to be configured 2020-08-22 08:19:50 -07:00
Tyera Eulberg 747f8d5877
Rpc: Return error if block does not exist (#11743)
* Return error if block does not exist

* Update docs
2020-08-20 15:05:30 -06:00
Tyera Eulberg 2fd2aceeb2
Bump spl-token to clean up magic number (#11726) 2020-08-20 09:51:12 -06:00
carllin b7ed06b17a
Cleanup test utilities (#11723)
* Add voting utility

* Add blockstore utility

Co-authored-by: Carl <carl@solana.com>
2020-08-20 05:04:38 +00:00
Michael Vines adc984a225 Rename Binary64 to Base64. Establish Base58 encoding 2020-08-17 17:26:29 -07:00
Michael Vines 757e147b3b Rework UiAccountData encode/decode such that it works from Rust 2020-08-17 17:26:29 -07:00
Tyera Eulberg 6c5b8f324a
Rpc: Add until parameter for getConfirmedSignaturesForAddress2 (#11644)
* Refactor bigtable apis to accept start and end keys

* Make helper fn to deserialize cell data

* Refactor get_confirmed_signatures_for_address to use get_row_data range

* Add until param to get_confirmed_signatures_for_address

* Add until param to blockstore api

* Plumb until through client/cli

* Simplify client params
2020-08-15 10:42:17 -06:00
Greg Fitzgerald 574c356863
Add CommitmentSlots::new_from_slot() (#11600) 2020-08-13 03:51:15 +00:00
Tyera Eulberg b1e452f876
Return blockstore signatures-for-address despite bigtable error (#11594) 2020-08-12 17:57:05 -06:00
Tyera Eulberg 88ca04dbdb
Add config param to specify offset/length for single and program account info (#11515)
* Add config param to specify dataSlice for account info and program accounts

* Use match instead of if
2020-08-10 22:35:29 +00:00
Tyera Eulberg da210ddd51
Fix parsing of spl-token Mint (#11512)
* Add failing test

* Fix jsonParsed mint
2020-08-10 20:35:36 +00:00
Tyera Eulberg a9f76862fb
Decode native-program and sysvar accounts (#11463)
* Pass pubkey in to account-decoder for sysvars

* Decode sysvar accounts

* Decode config accounts; move validator-info lower

* Decode stake accounts

* Review comments

* Stringify any account lamports and epochs that can be set to u64::MAX
2020-08-09 07:50:45 +00:00
sakridge 068d23f298
Add Binary64 option for account data (#11474)
* Add Binary64 option for account data

* Decode into binary64

* Reword docs
2020-08-08 22:40:13 -07:00
Tyera Eulberg b7c2681903
Token Accounts: return ui_amount, decimals with decoded account (#11407)
* Return ui_amount, decimals from token client methods

* Return ui_amount, decimals in RPC jsonParsed token accounts

* Fixup docs

* Return ui_amount, decimals in pubsub jsonParsed token accounts

* Remove unnecessary duplicate struct

* StringAmount rename
2020-08-07 11:37:39 -06:00
Michael Vines 4222932e08 Plug getConfirmedSignaturesForAddress2 into bigtable storage 2020-08-05 23:04:16 -07:00
Michael Vines 02c0981ecf Rename startAfter to before 2020-08-05 14:33:14 -07:00
Michael Vines 087fd32ce3 Reimplement transaction-history command with getConfirmedSignaturesForAddress2 2020-08-05 14:33:14 -07:00
Michael Vines 1b2276520b Add getConfirmedSignaturesForAddress2 RPC method 2020-08-05 14:33:14 -07:00
Michael Vines dfae9a9864 Plumb Bigtable ledger storage into the RPC subsystem 2020-08-05 14:27:12 -07:00
Michael Vines 0e02740565 Setup a tokio 0.2 runtime for RPC usage 2020-08-05 14:27:12 -07:00
Tyera Eulberg 86e3f96f16
Return token amounts as floats (#11370)
* Return token amounts as floats

* Floating-point equality

* Return float and raw token amounts

* Fix decimals and token rpcs for native-mint tokens

* Fixup docs and review comments
2020-08-05 06:48:09 +00:00
Trent Nelson 14339dec0a Harden RPC preflight test inputs 2020-08-05 06:06:57 +00:00
Trent Nelson e25846e1ad Add failing test for unsane tx in RPC preflight 2020-08-05 06:06:57 +00:00
Tyera Eulberg d0144ce382
Fix token rpc-client methods (#11361)
* Convert None to error in parse_keyed_accounts

* Allow encoding configuration in getTokenAccounts methods
2020-08-04 11:11:30 -06:00
Tyera Eulberg 0bc9bcc8b9
Fix bad rebase 2020-08-02 12:09:06 -06:00
Tyera Eulberg d1b2e6cdf2
Add getTokenLargestAccounts endpoint (#11322) 2020-08-02 10:23:44 -06:00
Michael Vines ffbd859c42 Update spl-token and spl-memo 2020-08-02 07:53:42 -07:00
Tyera Eulberg 9bcfc51df1
Add token rpc endpoints to rpc-client (#11315) 2020-07-31 20:53:49 +00:00
Michael Vines c78e12a262 Avoid spl-sdk dependency, which inhibits crate publishing 2020-07-30 23:47:26 +00:00
Greg Fitzgerald 1d2426ddbc
Move simulate_transaction from rpc to bank (#11294) 2020-07-30 19:15:45 +00:00
Trent Nelson a888f2f516 Reject TXs sent via RPC with no signatures 2020-07-30 00:07:33 -06:00
Trent Nelson a7079e4dde Dereplicode send_transaction and request_airdrop RPC handlers 2020-07-30 00:07:33 -06:00
Trent Nelson b962b2ce2d Add failing test for TX sent via RPC with no signatures 2020-07-30 00:07:33 -06:00
Tyera Eulberg b45ac5d4db
Add SPL Token-specific rpc endpoints (#11231)
* Simplify account-decoder program ids + spl_token helper

* Spl program namespace version

* Add getTokenAccountBalance endpoint

* Remove token program id from getTokenAccountBalance request

* Add getTokenSupply endpoint

* Remove token program id from getTokenSupply request

* Add getTokenAccountsByOwner/Delegate endpoints

* Remove token program id from getTokenAccountsByOwner/Delegate requests

* Named parameter
2020-07-28 23:00:48 -06:00
Trent Nelson 678f94903b Fill out missing RPC request received debug logging 2020-07-29 01:51:20 +00:00
carllin 6578ad7d08
Speed up local cluster partitioning tests (#11177)
* Fix long local cluster partition tests by skipping slot warmup

Co-authored-by: Carl <carl@solana.com>
2020-07-23 18:50:42 -07:00
Greg Fitzgerald 7484202282
Return root when bank not found (#11188)
* Return root when bank not found

* Apply suggestions from code review

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2020-07-24 00:57:15 +00:00
Greg Fitzgerald 23c2e55cbf
Use BlockCommitmentCache for RPC slots, take 2 (#11137)
* Use BlockCommitmentCache for RPC slots (#11103)

* Add BankForks::highest_descendant(slot)

* Update debug messages

* Update core/src/rpc.rs

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>

* cargo fmt

* Remove highest_descendant

* Fix test

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>

* Fix crossed-in-flight compilation error

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2020-07-20 23:03:40 +00:00
Michael Vines d19cd3a18a
Revert "Use BlockCommitmentCache for RPC slots (#11103)" (#11122)
This reverts commit 815b0f31b4.
2020-07-18 16:39:12 -07:00
Greg Fitzgerald 815b0f31b4
Use BlockCommitmentCache for RPC slots (#11103)
* Add BankForks::highest_descendant(slot)

* Update debug messages

* Update core/src/rpc.rs

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>

* cargo fmt

* Remove highest_descendant

* Fix test

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2020-07-17 16:22:27 -06:00
Tyera Eulberg a255b0fc86
Rename CacheSlotInfo to CommitmentSlots (#11111) 2020-07-17 17:54:49 +00:00
Tyera Eulberg fdff681bcc
Simplify BlockCommitmentCache slot info (#11106)
* Refactor BlockCommitmentCache, store a CacheSlotInfo

* Comma
2020-07-17 09:24:51 -06:00
Greg Fitzgerald 145906123a
Simplify use of SendTransactionService (#10999)
* Send transaction upon recv

This will allow us to move the channel to the public interface

* Use a channel, not a method, to communicate

* Pipeline the services

* Ignore unused return values

* Fix clippy warning
2020-07-11 01:14:41 +00:00
Michael Vines 25ca99cdcf largest -> highest 2020-07-10 12:57:32 -07:00
Michael Vines aef6bf272e getConfirmedBlocks now has an upper limit on slot range 2020-07-10 12:18:31 -07:00
Greg Fitzgerald 16eeea4f82
Move SendTransactionService to solana_runtime (#10972) 2020-07-09 18:28:26 +00:00
Greg Fitzgerald 17a8cc862b
Remove core dependencies from SendTransactionService (#10965)
* Remove core dependencies from SendTransactionService

* Fix clippy warnings
2020-07-08 19:13:42 -06:00
Greg Fitzgerald ebadbce920
Drop bank from BlockCommitmentCache (#10959)
* Remove bank reference from BlockCommitmentCache

* Don't use a Bank to create BlockCommitmentCache

* Rename recent_slot to slot
2020-07-09 00:50:13 +00:00
dependabot-preview[bot] 841ecfd927
chore(deps): bump bincode from 1.2.1 to 1.3.1 (#10867)
* chore(deps): bump bincode from 1.2.1 to 1.3.1

Bumps [bincode](https://github.com/servo/bincode) from 1.2.1 to 1.3.1.
- [Release notes](https://github.com/servo/bincode/releases)
- [Commits](https://github.com/servo/bincode/commits)

Signed-off-by: dependabot-preview[bot] <support@dependabot.com>

* [auto-commit] Update all Cargo lock files

* Switch from deprecated method

* Add options to maintain behavior with bincode::options()

Co-authored-by: dependabot-preview[bot] <27856297+dependabot-preview[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2020-07-09 00:08:05 +00:00
Tyera Eulberg 1a6bbd2867
Limited Deserialize isn't limiting anything (#10952)
* Add failing test

* Use deserialize_from to enable limit
2020-07-08 15:54:42 -06:00
Greg Fitzgerald 930162a079
Drop dependency on BlockCommitmentCache bank (#10946)
* Drop dependency on BlockCommitmentCache bank

* cargo fmt
2020-07-07 20:13:30 -06:00
Greg Fitzgerald 2fdbb97244
Rename largest_confirmed_root to highest_confirmed_root (#10947) 2020-07-07 23:59:46 +00:00
Tyera Eulberg 4de0713aa3
Rpc: Add getStakeActivation endpoint (#10902)
* Add getStakeActivation endpoint

* Add docs

* Update docs/src/apps/jsonrpc-api.md

Co-authored-by: Michael Vines <mvines@gmail.com>

* Rework return type

* Update docs

* Rebase

Co-authored-by: Michael Vines <mvines@gmail.com>
2020-07-06 13:28:40 -06:00
Greg Fitzgerald 2922494b4f
Cleanup rpc (#10910)
* Remove unreachable error case

* Inline Ok

* Hoist Ok
2020-07-03 17:39:14 -06:00
Tyera Eulberg 8d951776ab
Rpc: add filter to getProgramAccounts (#10888)
* Add RpcFilterType, and implement CompareBytes for getProgramAccounts

* Accept bytes in bs58

* Rename to memcmp

* Add Memcmp optional encoding field

* Add dataSize filter

* Update docs

* Clippy

* Simplify tests that don't need to test account contents; add multiple-filter tests
2020-07-03 07:46:29 +00:00
Michael Vines d53228e69d getInflationRate now only supports the current epoch 2020-07-02 02:11:31 +00:00
Tyera Eulberg 2669ccb864
Update struct prefixes to Ui (#10874)
* Update comments

* Use Ui prefix
2020-07-01 20:06:40 +00:00
Tyera Eulberg d97850f1d9
Add account-decoder utilities (#10846)
* Fix comment and make less pub

* Add account-decoder crate and use to decode vote and system (nonce) accounts

* Update docs

* Rename RpcAccount struct

* s/Rpc/Display

* Call it jsonParsed and update docs

* Revert "s/Rpc/Display"

This reverts commit 6e7149f503f560f1e9237981058ff05642bb7db5.

* s/Rpc/Ui

* Add tests

* Ui more things

* Comments
2020-07-01 04:55:11 +00:00
Greg Fitzgerald 50b3fa83a0
Move BankCommitmentCache to solana_runtime (#10816)
* Remove Blockstore member variable from BlockCommitmentCache

* Hoist is_confirmed_rooted() to its only caller

BlockCommitmentCache no longer depends on Blockstore

* Move BlockCommitmentCache to solana_runtime
2020-06-25 22:06:58 -06:00
Greg Fitzgerald 62b873b054
Clean up rpc module (#10812)
* Clean up rpc module

* Simplify getting bank
2020-06-25 17:08:55 -06:00