Commit Graph

467 Commits

Author SHA1 Message Date
Jon C 5871a0e7ed CI: Add windows clippy job and fix clippy errors (#330)
* CI: Run clippy on windows

* Update cargo-clippy-before-script.sh for Windows

* Pacify clippy
2024-03-20 16:28:38 -05:00
Kirill Fomichev 219d7772b1 rpc: disable BigTable with header (#226)
* rpc: disable BigTable with header

* use is_some_and instead map+unwrap_or

Co-authored-by: Tyera <tyera@anza.xyz>

---------

Co-authored-by: Tyera <tyera@anza.xyz>
2024-03-15 22:25:14 -05:00
steviez be38278281 Move default value for --rpc-pubsub-notification-threads to CLI (#158)
The default value was previously being determined down where the thread
pool is being created. Providing a default value at the CLI level is
consistent with other args, and gives an operator better visibility into
what the default will actually be
2024-03-15 22:24:45 -05:00
Tyera 814181b07b Rpc: add support for minimum context slot to `getBlocks(WithLimit)` endpoints (#191)
* Support min_context_slot field in getBlocksWithLimit input

* Use min_context_slot in get_blocks_with_limit

* Support min_context_slot field in getBlocks input

* Use min_context_slot in get_blocks
2024-03-15 22:22:45 -05:00
Will Hickey df57657985 Revert "[anza migration] rename crates (#10)"
This reverts commit 3f9a7a52ea.
2024-03-05 10:18:50 -06:00
Tyera 5efc4eb7ab Rpc: deprecate `getStakeActivation` and make inactive_stake consistent (#69)
* Make inactive_stake consistent

* Add rpc_deprecated_v1_18 module

* Move get_stake_activation to deprecated list

* Fix typo
2024-03-05 09:43:25 -06:00
Yihau Chen 14cb9cff92 [anza migration] rename crates (#10)
* rename geyser-plugin-interface

* rename cargo registry

* rename watchtower

* rename ledger tool

* rename validator

* rename install

* rename geyser plugin interface when patch
2024-03-05 09:43:25 -06:00
Justin Starry 312f786abf
Rename `SanitizedMessage::try_from` to `try_from_legacy_message` (#35338)
* Simplify and refactor tx message creation in tests

* Rename SanitizedMessage::try_from to try_from_legacy_message
2024-02-29 08:25:22 +08:00
steviez 94698b8dd0
Name PubSubService tokio threads (#35331)
Also add logs for service starting/stopping
2024-02-27 14:59:07 -06:00
Kirill Fomichev 8ad125d0c0
rpc: optimize `getTokenLargestAccounts` (#35315)
* rpc: optimize `getTokenLargestAccounts`

* use tuple instead of struct

* untuple

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

---------

Co-authored-by: Tyera <teulberg@gmail.com>
2024-02-27 00:08:29 -07:00
Brooks 6d15487183
rpc: Parse largest token accounts after sorting & truncating (#35264) 2024-02-20 19:29:14 -05:00
Brooks f122e99c4e
rpc: Faster sorting for get_token_largest_accounts() (#35263) 2024-02-20 17:55:45 -05:00
Dmitri Makarov 0acee67891
SVM: move transaction_results from accounts-db to SVM (#35183)
SVM: Remove accounts-db deps in accounts_loader tests
2024-02-20 12:54:56 -08:00
Dmitri Makarov eeb0cf1ea8
SVM: Move nonce_info from accounts-db to Solana SDK (#35138) 2024-02-08 15:01:15 -05:00
Dmitri Makarov b9ee3b475b
SVM: Move RentDebits from accounts-db to Solana SDK (#35135) 2024-02-07 15:10:17 -08:00
Tyera Eulberg f01f361f13 Revert "Add rpc support for partitioned rewards (#34773)"
This reverts commit 22500c23db.
2024-02-05 19:54:19 -07:00
Tyera 22500c23db
Add rpc support for partitioned rewards (#34773)
* Check feature_set for enable_partitioned_epoch_reward

* Keep common variable outside if case

* Keep common early return out of if case, since the first_slot_in_epoch must exist for partiion PDA to exist

* Get and parse epoch partition data PDA

* Find partition index for all addresses

* Pull relevant blocks and get rewards

* Reuse ordering and reformatting

* Remove feature deactivation from TestValidator

* Restore rewards iteration in first block in epoch for feature case to catch Voting rewards

* Add fn get_reward_map helper to dedupe code

* No need to start 2nd get_block_with_limit call with first block again

* Replace filter_map to parameterize RewardType filter expression

* Weird thing to make clippy and compiler agree (https://github.com/rust-lang/rust-clippy/issues/8098)

* Use activated_slot to ensure the right approach for past rewards epochs
2024-01-25 13:39:06 -07:00
Dmitri Makarov ef233eaaa7
Refactor load_accounts to take a reference to a slice instead of vec (#34919)
This is in preparation for further refactoring of
Bank::load_and_execute_transactions in a separate commit.
2024-01-24 09:43:18 -05:00
Joe C 9caf9e8f17
rpc: add tests for simulate transaction inner instructions (#34495)
* rpc: add tests for simulate transaction inner instructions

* update encoding

* take out extra test case
2024-01-22 18:27:27 -06:00
Yihau Chen 7470c3d68b
rpc: parse token accounts in simulate_transaction (#34619)
* rpc: parse token accounts in simulate_transaction

* add overwrite_accounts into get_encoded_account and get_parsed_token_account

* revert get_mint_decimals scope changes

* move common.rs to rpc/account_resolver.rs

* rename get_account to get_account_from_overwrites_or_bank

* add a comment

* clippy

* add comment

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

---------

Co-authored-by: Tyera <teulberg@gmail.com>
2024-01-19 11:53:45 +08:00
Tyera 166be2995e
Bigtable: update google proto files and allow configuration of max_message_size (#34740)
* Update proto files with tonic-build v0.9.2

* Manually ignore invalid doc-tests

* Add new ReadRowsRequest fields

* Add LedgerStorageConfig::max_message_size and default value

* Add BigtableConnection::max_message_size and use on client creation

* Add max_message_size to RpcBigtableConfig and make const pub

* Add solana-validator cli arg
2024-01-10 21:20:15 -07:00
Brooks 1bb2f55235
clippy: rpc lints (#34632) 2024-01-02 21:50:52 -05:00
Justin Starry 88af74d1d0
refactor: optional `stake_history` arg is never `None` (#34556)
refactor: optional stake_history arg is never none
2023-12-22 10:44:28 +08:00
Joe C 171c58c5c0
RPC: Add inner instructions to simulate transaction response (#34313)
* rpc: add optional `innerInstructions: bool` arg to `simulateTransaction`

* bank: enable cpi recording in simulate

* sdk: move `InnerInstructions` into SDK from accounts DB

* bank: return inner instructions from simulate tx

* rpc: return inner instructions from simulate tx

* rpc: simulate tx: add `jsonParsed` support for inner instructions

* accounts db: add deprecated attribute to re-exported inner instructions

* rpc: de-dupe inner instruction mapping

* update deprecated comment

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

---------

Co-authored-by: Tyera <teulberg@gmail.com>
2023-12-16 12:49:22 +00:00
steviez ae6a4c0995
Only allow BankForks creation with single bank (#34449)
BankForks has two constructors; one that takes a single Bank (the root)
and one that can take an arbitrary number of Banks plus the root slot.
However, the constructor that accepts multiple banks is unnecessary; it
isn't used in production and is only used in several tests.

So, remove the multi-bank constructor and update unit tests.
2023-12-14 10:53:11 -06:00
Lucas Steuernagel 1877fdb273
Use BankForks on tests - Part 4 (#34271)
* Use BankForks on tests - Part 4

* Ensure the correct slot is set
2023-12-06 13:32:04 -03:00
Lucas Steuernagel b97b3dd4ab
Use BankForks on tests - Part 3 (#34248)
* Add BankForks to core tests

* Refactor functions under DCOU
2023-12-01 13:47:22 -03:00
Andrew Fitzgerald 2294801954
Do not derive Copy for EpochSchedule and Rent (#32767) 2023-12-01 07:57:25 -08:00
steviez 230779d459
Revert " Remove redundant bounds check from getBlock and getBlockTime… (#33996)
Revert " Remove redundant bounds check from getBlock and getBlockTime (#33901)"

This reverts commit 03a456e7bb.
2023-11-08 18:16:51 -06:00
steviez 03a456e7bb
Remove redundant bounds check from getBlock and getBlockTime (#33901)
JsonRpcRequestProcessor::check_blockstore_root() contained some logic
that performed duplicate sanity checking on a Blockstore fetch result.
The checking involved creating rocksdb iterators, which has non-trivial
overhead.

This PR removes the duplicate checking, and also adds comments to help
reason about how JsonRpcRequestProcessor interprets the Blockstore
result.
2023-11-08 12:09:10 -06:00
Lijun Wang eba1b2d3e3
Remove RwLock on TransactionNotifier (#33962)
* Remove RwLock on TransactionNotifier
2023-11-07 10:28:56 -08:00
steviez ee29647f67
Remove Option<_> from Blockstore::get_rooted_block_time() return type (#33955)
Instead of returning Result<Option<UnixTimestamp>>, return
Result<UnixTimestamp> and map None to an error. This makes the return
type similar to that of Blockstore::get_rooted_block().
2023-11-06 12:56:10 -06:00
Tyera 7048e72d81
Blockstore: only return block times for rooted slots (#33871)
* Add Blockstore::get_rooted_block_time method and use in RPC

* Un-pub get_block_time
2023-10-26 11:38:58 -06:00
Pankaj Garg 78c31aa6b8
Use program cache fork graph in extract() (#33806)
* Use program cache fork graph instead of WorkingSlot trait

* Fix deadlocked tests

* keep WorkingSlot trait for now
2023-10-25 06:04:38 -07:00
Pankaj Garg 9d42cd7efe
Initialize fork graph in program cache during bank_forks creation (#33810)
* Initialize fork graph in program cache during bank_forks creation

* rename BankForks::new to BankForks::new_rw_arc

* fix compilation

* no need to set fork_graph on insert()

* fix partition tests
2023-10-23 09:32:41 -07:00
steviez 56ccffdaa5
Replace get_tmp_ledger_path!() with self cleaning version (#33702)
This macro is used a lot for tests to create a ledger path in order to
open a Blockstore. Files will be left on disk unless the test remembers
to call Blockstore::destroy() on the directory. So, instead of requiring
this, use the get_tmp_ledger_path_auto_delete!() macro that creates a
TempDir (which automatically deletes itself when it goes out of scope).
2023-10-21 11:38:31 +02:00
Ryo Onodera 5a963529a8
Add BankWithScheduler for upcoming scheduler code (#33704)
* Add BankWithScheduler for upcoming scheduler code

* Remove too confusing insert_without_scheduler()

* Add doc comment as a bonus

* Simplify BankForks::banks()

* Add derive(Debug) on BankWithScheduler
2023-10-21 15:56:43 +09:00
steviez 8bd0e4cd95
Change getHealth to compare optimistically confirmed slots (#33651)
The current getHealth mechanism checks a local accounts hash slot vs.
those of other nodes as specified by --known-validator. This is a
very coarse comparison given that the default for this value is 100
slots. More so, any nodes using a value larger than the default
(ie --incremental-snapshot-interval 500) will likely see getHealth
return status behind at some point.

Change the underlying mechanism of how health is computed. Instead of
using the accounts hash slots published in gossip, use the latest
optimistically confirmed slot from the cluster. Even when a node is
behind, it is able to observe cluster optimistically confirmed by slots
by viewing votes published in gossip.

Thus, the latest cluster optimistically confirmed slot can be compared
against the latest optimistically confirmed bank from replay to
determine health. This new comparison is much more granular, and not
needing to depend on individual known validators is also a plus.
2023-10-16 11:21:33 -05:00
steviez 73a9a14731
Fold noisy metric into struct of metrics that is reported every 10s (#33635) 2023-10-10 16:35:16 -05:00
Tyera 509d6acd2b
Remove primary index from Blockstore special-column keys (#33419)
* Add helper trait for column key deprecation

* Add WriteBatch::delete_raw

* Add ProtobufColumn::get_raw_protobuf_or_bincode

* Add ColumnIndexDeprecation iterator methods

* Impl ColumnIndexDeprecation for TransactionStatus (doesn't build)

* Update TransactionStatus put

* Update TransactionStatus purge_exact

* Fix read_transaction_status

* Fix get_transaction_status_with_counter

* Fix test_all_empty_or_min (builds except tests)

* Fix test_get_rooted_block

* Fix test_persist_transaction_status

* Fix test_get_transaction_status

* Fix test_get_rooted_transaction

* Fix test_get_complete_transaction

* Fix test_lowest_cleanup_slot_and_special_cfs

* Fix test_map_transactions_to_statuses

* Fix test_transaction_status_protobuf_backward_compatability

* Fix test_special_columns_empty

* Delete test_transaction_status_index

* Delete test_purge_transaction_status

* Ignore some tests until both special columns are dealt with (all build)

* Impl ColumnIndexDeprecation for AddressSignatures (doesn't build)

* Add BlockstoreError variant

* Update AddressSignatures put

* Remove unneeded active_transaction_status_index column lock

* Update AddressSignatures purge_exact

* Fix find_address_signatures_for_slot methods

* Fix get_block_signatures methods

* Fix get_confirmed_signatures_for_address2

* Remove unused method

* Fix test_all_empty_or_min moar (builds except tests)

* Fix tests (all build)

* Fix test_get_confirmed_signatures_for_address

* Fix test_lowest_cleanup_slot_and_special_cfs moar

* Unignore tests (builds except tests)

* Fix test_purge_transaction_status_exact

* Fix test_purge_front_of_ledger

* Fix test_purge_special_columns_compaction_filter (all build)

* Move some test-harness stuff around

* Add test cases for purge_special_columns_with_old_data

* Add test_read_transaction_status_with_old_data

* Add test_get_transaction_status_with_old_data

* Review comments

* Move rev of block-signatures into helper

* Improve deprecated_key impls

* iter_filtered -> iter_current_index_filtered

* Add comment to explain why use the smallest (index, Signature) to seed the iterator

* Impl ColumnIndexDeprecation for TransactionMemos (doesn't build)

* Update TransactionMemos put

* Add LedgerColumn::get_raw

* Fix read_transaction_memos

* Add TransactionMemos to purge_special_columns_exact

* Add TransactionMemos to compaction filter

* Take find_address_signatures out of service

* Remove faulty delete_new_column_key logic

* Simplify comments
2023-10-10 10:40:36 -06:00
steviez 3eae980293
Minor cleanup on some snapshot related tests (#33485) 2023-10-02 20:25:30 +02:00
Andrew Fitzgerald 660e41a8e1
Remove entry shuffling (#33378) 2023-10-02 09:03:12 -07:00
Jon Cinque de38b05ad1
spl: Bump token-2022 and friends (#33453)
* token: Update to 4.0.0

* token-2022: Bump and support new account and instruction types

* Update token-2022 in fetch_spl / program-test

* Fixup downstream uses

* Mint and destination were flipped in 0.9.0

* Don't use `convert_pubkey`

* Bump spl dependencies to versions which avoid recompilations
2023-09-29 19:12:06 +02:00
Tyera 3e8ccbe196
Add comment to OptimisticallyConfirmedBankTracker (#33238)
Add comment
2023-09-21 09:59:51 -06:00
Pankaj Garg f50342a790
Split vote related code from runtime to its own crate (#32882)
* Move vote related code to its own crate

* Update imports in code and tests

* update programs/sbf/Cargo.lock

* fix check errors

* update abi_digest

* rebase fixes

* fixes after rebase
2023-09-19 10:46:37 -07:00
bji bdf7207eec
Implement timely vote credits feature. (#32957) 2023-09-12 10:40:04 -07:00
Alexander Meißner bbb57be0a5
Refactor - Move interfaces of address-lookup-table into the program SDK (#33165)
* Adds a module `address_lookup_table` to the SDK.

* Adds a module `address_lookup_table::instruction` to the SDK.

* Adds a module `address_lookup_table::error` to the SDK.

* Adds a module `address_lookup_table::state` to the SDK.

* Moves AddressLookupTable into SDK as well.

* Moves AddressLookupTableAccount into address_lookup_table.

* Adds deprecation messages.

* Disentangles dependencies across cargo files.
2023-09-11 21:10:40 +02:00
Tao Zhu 4f4ce69f5f
purge duplicated bank prioritization fee from cache (#33062)
* purge duplicated bank prioritization fee from cache

* add test for purge dup bank

* Added metrics counts to monitor anomalies

* fix a flaky test
2023-09-11 10:08:55 -05:00
Tao Zhu 904b2a7672
finalize prioritization_fee_cache after oc-ed bank is frozen (#33100) 2023-09-06 09:58:58 -05:00
Tyera 17b1b5646d
rpc: turn off getStakeActivation epoch parameter (#33156)
* Return error on past-epoch parameter

* Update docs
2023-09-05 16:52:49 -06:00