Commit Graph

2163 Commits

Author SHA1 Message Date
Tyera Eulberg 9a89689ad3
Use optimistic confirmation in getSignatureStatuses, and various downstream client methods (#14430)
* Add optimistically_confirmed field to TransactionStatus

* Update docs

* Convert new field to confirmation_status

* Update docs to confirmationStatus

* Update variants

* Update docs

* Just Confirmed
2021-01-15 16:05:05 +00:00
dependabot[bot] 4ecc0f4fa6
chore: bump rayon from 1.4.1 to 1.5.0 (#14177)
* chore: bump rayon from 1.4.1 to 1.5.0

Bumps [rayon](https://github.com/rayon-rs/rayon) from 1.4.1 to 1.5.0.
- [Release notes](https://github.com/rayon-rs/rayon/releases)
- [Changelog](https://github.com/rayon-rs/rayon/blob/master/RELEASES.md)
- [Commits](https://github.com/rayon-rs/rayon/compare/rayon-core-v1.4.1...rayon-core-v1.5.0)

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

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2021-01-15 18:07:35 +09:00
Michael Vines 1c2ae15b1d Improve solana-test-validator output 2021-01-14 23:07:24 -08:00
sakridge 907f518f6d
Add load/execute/store timings (#14561) 2021-01-14 14:14:16 -08:00
behzad nouri cfcca1cd3c
patches bug in turbine's neighbors computation (#14565)
Removing local node's index early from the set here:
https://github.com/solana-labs/solana/blob/e1b59ded4/core/src/retransmit_stage.rs#L346
distorts the order of nodes depending on which node is computing the
turbine fan-out tree, and results in incorrect neighbors computation.
2021-01-13 22:25:29 +00:00
Michael Vines 11daaadc93 Add --rpc-threads argument 2021-01-13 13:34:46 -08:00
Tyera Eulberg e1b59ded4b
Use leader_forward_count for tx retries too (#14547) 2021-01-13 11:14:22 -07:00
Jeff Washington (jwash) 935dfdf0f6
fill in timing gaps in replay_stage (#14550)
* fill in timing gaps in replay_stage

* add replay_stage bank_count metric

* formatting

* handle another gap

* cleanup wait_receive_time to be more straightforward
2021-01-13 10:08:53 -06:00
carllin 6dfad0652f
Cache account stores, flush from AccountsBackgroundService (#13140) 2021-01-11 17:00:23 -08:00
Tyera Eulberg b0e6e29527
Update timestamp max allowable drift to 50% of PoH (#14531)
* Repurpose warp-timestamp feature for general bump

* Change max_allowable_drift to 50%

* Fill in PR#

* Fix rpc test setup
2021-01-11 23:27:30 +00:00
Michael Vines a95675a7ce
Avoid tmp snapshot backlog in SnapshotPackagerService under high load (#14516) 2021-01-11 10:21:15 -08:00
Michael Vines 7be6770808 Rename CompressionType to ArchiveFormat 2021-01-09 09:07:49 -08:00
Michael Vines 141e6706e6 Rename AccountsPackage::root to AccountsPackage::slot 2021-01-09 09:07:49 -08:00
behzad nouri 766195dded
limits number of crds values associated with a pubkey (#14467) 2021-01-08 18:54:40 +00:00
Jeff Washington (jwash) 773b21b34e
consolidate DEFAULT_HASHES_PER_TICK (#14463) 2021-01-07 09:49:42 -06:00
sakridge c282586753
Add fixed tick rate adjustment (#14447) 2021-01-05 19:25:44 -08:00
Tyera Eulberg ce1766d798
Enable program-id account index for supply calculations (#14444)
* Enable program-id account index for supply calculations

* Fixup comments
2021-01-06 02:42:33 +00:00
carllin 5affd8aa72
Add secondary indexes (#14212) 2020-12-31 18:06:03 -08:00
Michael Vines 4a3d217839 Only initialize BigTable upload service when requested 2020-12-31 17:40:51 -08:00
Michael Vines 0b23abd479 Bind RPC and faucet to 0.0.0.0 2020-12-31 07:55:26 +00:00
Michael Vines 3d077fb656 Revert "Upgrade in-tree tokio 0.2 usage to tokio 0.3"
This reverts commit 444ed768dc.
2020-12-31 06:26:53 +00:00
Michael Vines fb6c660cfd Port ip-echo-server to tokio 0.3 2020-12-30 09:29:16 -08:00
Trent Nelson fe667db910 validator: Add experimental flag to select PoH pinned core 2020-12-29 19:15:44 -07:00
Trent Nelson 82f61c0c4a core: Update stale error message 2020-12-29 19:15:44 -07:00
sakridge f8a4afc7c1
Fix flaky broadcast test (#14329) 2020-12-29 12:35:04 -08:00
sakridge 2074e407cd
Add poh speed check and tick speed calibration (#14292) 2020-12-29 09:35:57 -08:00
Michael Vines 444ed768dc Upgrade in-tree tokio 0.2 usage to tokio 0.3 2020-12-29 09:23:23 -08:00
Tyera Eulberg 3f10fb993b
Retry durable-nonce transactions (#14308)
* Retry durable-nonce transactions

* Add metric to track durable-nonce txs in queue

* Populate send-tx-service initial addresses with tpu_address if empty (primarily for testing)

* Reinstate last_valid_slot check for durable-nonce txs; use arbitrary future slot
2020-12-29 09:48:43 -07:00
Michael Vines 9ddd6f08e8 Persist gossip contact info 2020-12-27 20:46:54 -08:00
sakridge c693ffaa08
Fix subtraction overflow in metrics (#14290) 2020-12-27 16:26:22 -08:00
behzad nouri 2fd38d9912
indexes votes in crds table (#14272) 2020-12-27 13:31:05 +00:00
behzad nouri 49019c6613
obtains staked-nodes from the root-bank (#14257)
... as opposed to the working bank
2020-12-27 13:28:05 +00:00
Trent Nelson 5b903318b2 vote: Add helper for creating current-versioned states 2020-12-22 19:37:26 -07:00
Michael Vines ace360ade2 Multiple entrypoint support 2020-12-22 18:35:31 -08:00
Michael Vines 3373082ffa Update entrypoint contact info even when shred version adoption is not requested 2020-12-22 18:35:31 -08:00
behzad nouri a14cfd660a
removes &Arc<Self> receivers (#14234) 2020-12-22 23:51:53 +00:00
sakridge baa9602411
Add shrink paths (#14238) 2020-12-21 21:33:37 -08:00
behzad nouri 7b08cb1f0d
improves performance in replay-stage (#14217)
bank::vote_accounts returns a hash-map which is slow to iterate, but all uses
only require an iterator:
https://github.com/solana-labs/solana/blob/b3dc98856/runtime/src/bank.rs#L4300-L4306
Similarly, calculate_stake_weighted_timestamp takes a hash-map whereas it only
requires an iterator:
https://github.com/solana-labs/solana/blob/b3dc98856/sdk/src/stake_weighted_timestamp.rs#L21-L28
2020-12-21 19:18:19 +00:00
Michael Vines 57b03c5bc1 Restore Content-Length header for streaming snapshot download 2020-12-20 23:22:26 -08:00
Michael Vines b3dc988564 Stream RPC snapshot downloads 2020-12-19 15:54:23 -08:00
Michael Vines 0090106f60 getBlockTime RPC method now falls back to BigTable in all cases 2020-12-18 20:51:49 +00:00
behzad nouri 691031fefd
limits number of crds values returned when responding to pull requests (#13739)
Crds values buffered when responding to pull-requests can be very large taking a lot of memory.
Added a limit for number of buffered crds values based on outbound data budget.
2020-12-18 18:45:12 +00:00
behzad nouri 6a3797e164
adds crds-value for broadcasting duplicate shreds through gossip (#14133)
In gossip, the header overhead we get from:
https://github.com/solana-labs/solana/blob/de9ac43eb/core/src/cluster_info.rs#L434-L435
https://github.com/solana-labs/solana/blob/de9ac43eb/core/src/crds_value.rs#L31-L36
https://github.com/solana-labs/solana/blob/de9ac43eb/core/src/crds_value.rs#L73
already exceeds SIZE_OF_NONCE in shreds. We also need aditional
meta-data (wallclock, source pubkey, ...). Which means that given the
SHRED_PAYLOAD_SIZE, we cannot fit all these in PACKET_DATA_SIZE:
https://github.com/solana-labs/solana/blob/de9ac43eb/ledger/src/shred.rs#L80

On top of that, we need 2 shred payloads as the proof of duplicate. So
each DuplicateShred crds value includes only a chunk of the payload,
along with the meta-data to reconstruct the full payload from the chunks
on the receiving end.
2020-12-18 14:32:43 +00:00
sakridge a5db6399ad
Fix test_max_hashes (#14189) 2020-12-17 15:12:18 -08:00
sakridge da7d1e2302
Improved Transaction Forwarding (#13944)
* Forwarding

* Dedupe leaders

* Use consistent commitment for last_valid_slot in rpc send_transaction

* Plumb rpc send_transaction options into solana-validator

* Extend num slots banking-stage holds forwarded txs

Co-authored-by: Tyera Eulberg <tyera@solana.com>
2020-12-17 15:37:22 -07:00
behzad nouri d6d76219b6
caches staked nodes computed from vote-accounts (#13929) 2020-12-17 21:22:50 +00:00
Michael Vines 0b92720fdb Don't require increased open file limit in solana-test-validator
Travis CI in particular does not allow the open file limit to be
increased.
2020-12-16 20:43:08 -08:00
Trent Nelson 6875113d82 Bump SPL crates 2020-12-17 01:54:22 +00:00
Tyera Eulberg ac0d32bc7e
Add blockstore skipped api (#14145)
* Add blockstore api to determine if a slot was skipped

* Return custom rpc error if slot is skipped
2020-12-16 13:40:36 -07:00
sakridge d4a174fb7c
Partial shred deserialize cleanup and shred type differentiation (#14094)
* Partial shred deserialize cleanup and shred type differentiation in retransmit

* consolidate packet hashing logic
2020-12-15 16:50:40 -08:00
carllin 75e9e321de
Fix race between setting tick height and calculating accounts hash (#14101)
Co-authored-by: Carl Lin <carl@solana.com>
2020-12-15 12:45:40 -08:00
Michael Vines 1e977ac025 Bump version to v1.6.0 2020-12-15 18:28:04 +00:00
behzad nouri c2b7115031
indexes crds values associated with a pubkey (#14088)
record_labels returns all the possible labels for a record identified by
a pubkey, used in updating timestamp of crds values:
https://github.com/solana-labs/solana/blob/1792100e2/core/src/crds_value.rs#L560-L577
https://github.com/solana-labs/solana/blob/1792100e2/core/src/crds.rs#L240-L251
The code relies on CrdsValueLabel to be limited to a small deterministic
set of possible values for a fixed pubkey. As we expand crds values to
include duplicate shreds, this limits what the duplicate proofs can be
keyed by in the table.
In addition the computation of these labels is inefficient and will
become more so as duplicate shreds and more types of crds values are
added. An alternative is to maintain an index of all crds values
associated with a pubkey.
2020-12-15 01:49:22 +00:00
sakridge 5294f70189
Remove some non-warnings (#14115) 2020-12-14 16:26:17 -08:00
Michael Vines 7143aaa89b Clippy 2020-12-14 08:03:29 -08:00
Michael Vines cdd3e7d856
Remove solana-vote-signer (#14099) 2020-12-13 19:12:20 -08:00
Michael Vines 9f2d154588 Rework TestValidator API to be more like ProgramTest 2020-12-13 07:45:55 +00:00
dependabot[bot] 88d950e5a8
chore: bump log from 0.4.8 to 0.4.11 (#13691)
* chore: bump log from 0.4.8 to 0.4.11

Bumps [log](https://github.com/rust-lang/log) from 0.4.8 to 0.4.11.
- [Release notes](https://github.com/rust-lang/log/releases)
- [Changelog](https://github.com/rust-lang/log/blob/master/CHANGELOG.md)
- [Commits](https://github.com/rust-lang/log/compare/0.4.8...0.4.11)

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

* [auto-commit] Update all Cargo lock files

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: dependabot-buildkite <dependabot-buildkite@noreply.solana.com>
2020-12-13 13:48:23 +09:00
carllin 55fc963595
Move slot cleanup to AccountsBackgroundService (#13911)
* Move bank drop to AccountsBackgroundService

* Send to ABS on drop instead, protects against other places banks are dropped

* Fix Abi

* test

Co-authored-by: Carl Lin <carl@solana.com>
2020-12-13 01:22:34 +00:00
Tyera Eulberg 8541ffa328
Add subscription cap (#14011)
* Add subscription cap

* Elide unwraps
2020-12-12 01:57:40 +00:00
Trent Nelson 546c6a4531 Override yanked miow crate to 0.2.2 2020-12-11 23:44:03 +00:00
Trent Nelson 277b6790c7 Override yanked net2 0.2.37 2020-12-11 23:44:03 +00:00
Ryo Onodera 09bd412b13
Wrong rpc inflation rate (#14063)
* Fix wrong inflation calculation in rpc

* Reorder

* Fix test
2020-12-11 07:42:39 +00:00
Michael Vines 4fba7e6865 Move validator_block_0_fee_workaround into TestValidator 2020-12-11 04:17:38 +00:00
Michael Vines bbad3fe501 TestValidator now implements Drop, no need to close() it 2020-12-11 04:17:38 +00:00
Michael Vines 0a9ff1dc9d Initial solana-test-validator command-line program 2020-12-11 04:17:38 +00:00
Josh 13db3eca9f
SPL token balance in transaction metadata (#13673)
* feat: store pre / post token balances

* move helper functions into separate include

* move token balance functionality to transaction-status crate

* fix blockstore processor test

* fix bigtable legacy test

* add caching to decimals
2020-12-10 19:25:07 -08:00
sakridge aa2751e614
Check shred type in is_duplicate (#14050) 2020-12-10 18:20:08 -08:00
behzad nouri 409fe3bca1
adds the instance token to crds-labels for node-instance crds-values (#14037)
If a node "a" receives instance-info from node "b1" it will override any
instance-info associated with "b1" pubkey in its crds table. This makes
it less likely that when "b1" receives crds values from "a" (either
through pull or push), it sees other instances of itself (because node
"a" discarded them when it received "b1" instance info).

In order for the crds table to contain all instance-info associated with
the same pubkey at the same time, we need to add the instance tokens to
the keys in the crds table (i.e. the CrdsValueLabel).
2020-12-10 17:01:55 +00:00
sakridge 5c95d8e963
Shred filter (#14030) 2020-12-10 07:54:15 -08:00
sakridge c5fe076432
Better dupe detection (#13992) 2020-12-09 23:14:31 -08:00
behzad nouri 1d267eae6b std::process::exit to kill all threads 2020-12-09 10:24:23 -08:00
behzad nouri 895d7d6a65 removes RwLock on ClusterInfo.instance 2020-12-09 10:24:23 -08:00
behzad nouri 542198180a pushes node-instance along with version early in gossip 2020-12-09 10:24:23 -08:00
behzad nouri 8cd5eb9863 checks for duplicate validator instances using gossip 2020-12-09 10:24:23 -08:00
sakridge f6600810d7
Use LRU cache and blake3 hash of shreds to filter duplicates (#13976) 2020-12-07 16:42:39 -08:00
Michael Vines 6e9dbb4f6e Add --rpc-max-multiple-accounts to override the getMultipleAccounts JSON RPC maximum 2020-12-07 16:31:01 -08:00
carllin 239a191612
Remove unneeded BankWeight fork choice (#13978)
Co-authored-by: Carl Lin <carl@solana.com>
2020-12-07 13:47:14 -08:00
Tyera Eulberg 6ae4d2e5cb
Fix logsSubscribe (#13996) 2020-12-07 19:00:52 +00:00
Ryo Onodera 3d9d7557c8
core/validator: Wrap std::process:exit(1) for easier testing (#13990) 2020-12-07 16:43:03 +00:00
Alexander Meißner a706706572
Validator CLI option to enable just-in-time compilation of BPF (#13789)
* Adds a CLI option to the validator to enable just-in-time compilation of BPF.

* Refactoring to use bpf_loader_program instead of feature_set to pass JIT flag from the validator CLI to the executor.
2020-12-07 09:49:55 +01:00
behzad nouri 6706f2b3bb
removes recursive read-locks on gossip (#13973)
ClusterInfo::tvu_peers acquires a read-lock on gossip:
https://github.com/solana-labs/solana/blob/f0e934145/core/src/cluster_info.rs#L1171-L1185
and so, ClusterInfo::repair_peers is recursively locking gossip for
read twice:
https://github.com/solana-labs/solana/blob/f0e934145/core/src/cluster_info.rs#L1202-L1223
But std::sync::RwLock is not re-entrant (recursive).
2020-12-06 15:14:49 +00:00
Tyera Eulberg ca35bb3ac8
Report highest_confirmed_root and _slot in commitment metric (#13964) 2020-12-05 00:50:00 +00:00
carllin 34b68288c8
Fix propagation skip check (#13933)
Co-authored-by: Carl Lin <carl@solana.com>
2020-12-03 12:31:38 -08:00
behzad nouri c3048b451d
samples repair peers using WeightedIndex (#13919)
To output one random sample, weighted_best generates n random numbers:
https://github.com/solana-labs/solana/blob/f751a5d4e/core/src/weighted_shuffle.rs#L38-L63
WeightedIndex does so with only one random number:
https://github.com/rust-random/rand/blob/eb02f0e46/src/distributions/weighted_index.rs#L223-L240
Additionally, if the index is already constructed, it only does a total
of O(log(n)) amount of work; which can be achieved if RepairCache,
caches the weighted index:
https://github.com/solana-labs/solana/blob/f751a5d4e/core/src/serve_repair.rs#L83

Also, the repair-peers code can be reorganized to have fewer redundant
unlock-then-lock code.
2020-12-03 14:26:07 +00:00
Trent Nelson 404fc1570d runtime: Replace `HashAgeKind` with `NonceRollbackInfo` 2020-12-02 20:10:08 +00:00
Tyera Eulberg 10c81a2448
Remove rpc_banks from validator (#13882)
* Remove rpc_banks from validator

* Bump abi-digest
2020-12-02 03:25:09 +00:00
Michael Vines 0a8bc347a1 Restore discover_cluster to avoid test panics 2020-12-01 17:58:28 -08:00
Michael Vines 3eece38ffa Add expects() to improve error logs on join failures 2020-12-01 17:58:28 -08:00
Michael Vines 73111b005f Reduce the number of snapshots 2020-12-01 11:13:37 -08:00
Tyera Eulberg 8fd1e55805
Add logging in check_blockstore_max_root (#13887) 2020-12-01 07:44:18 +00:00
Michael Vines 90d557d916 Strengthen EpochSlots sanitization 2020-11-30 14:40:25 -08:00
behzad nouri e1793e5a13
caches vote-state de-serialized from vote accounts (#13795)
Gossip and other places repeatedly de-serialize vote-state stored in
vote accounts. Ideally the first de-serialization should cache the
result.

This commit adds new VoteAccount type which lazily de-serializes
VoteState from Account data and caches the result internally.

Serialize and Deserialize traits are manually implemented to match
existing code. So, despite changes to frozen_abi, this commit should be
backward compatible.
2020-11-30 17:18:33 +00:00
Michael Vines 43b82b31e5 More TestValidator cleanup 2020-11-26 08:56:25 +00:00
Michael Vines b5f7e39be8 TestValidator public interface cleanup 2020-11-25 17:04:37 -08:00
Tyera Eulberg 4ff0f0949a
Separate blockstore checks for not (yet) rooted and cleaned up (#13814) 2020-11-25 22:59:38 +00:00
Michael Vines 4ef2da0ff0 Add `solana logs` command 2020-11-25 11:44:41 -08:00
sakridge b70abdc645
Nonce updates (#13799)
* runtime: Add `FeeCalculator` resolution method to `HashAgeKind`

* runtime: Plumb fee-collected accounts for failed nonce tx rollback

* runtime: Use fee-collected nonce/fee account for nonced TX error rollback

* runtime: Add test for failed nonced TX accounts rollback

* Fee payer test

* fixup: replace nonce account when it pays the fee

* fixup: nonce fee-payer collect test

* fixup: fixup: clippy/fmt for replace...

* runtime: Test for `HashAgeKind::fee_calculator()`

* Clippy

Co-authored-by: Trent Nelson <trent@solana.com>
2020-11-24 23:53:51 -08:00
Michael Vines 215ddecaa5 Add base64+zstd encoding for RPC account data 2020-11-25 02:03:23 +00:00
Michael Vines 61ab2072bd Clean up default commitment handling for subscriptions 2020-11-23 22:54:47 -08:00
Tyera Eulberg 7befad2f6d
Check SlotNotRooted if confirmed block not found in blockstore or bigtable (#13776) 2020-11-24 03:36:20 +00:00
behzad nouri 26bf2b7e45
processes pull-request callers only once per unique caller (#13750)
process_pull_requests acquires a write lock on crds table to update
records timestamp for each of the pull-request callers:
https://github.com/solana-labs/solana/blob/3087c9049/core/src/crds_gossip_pull.rs#L287-L300
However, pull-requests overlap a lot in callers and this function ends
up doing a lot of redundant duplicate work.

This commit obtains unique callers before acquiring an exclusive lock on
crds table.
2020-11-22 17:51:14 +00:00
sakridge c1eb350c47
Allow contact debug interval to be adjusted (#13737) 2020-11-20 14:47:37 -08:00
Ryo Onodera b74d7b5758
Fix fragile tests in prep of stake rewrite pr (#13654)
* Fix fragile tests in prep of stake rewrite pr

* Restore BOOTSTRAP_VALIDATOR_LAMPORTS where appropriate

* Further clean up

* Further clean up

* Aligh with other call site change

* Remove false warn!

* fix ci!
2020-11-20 17:21:03 +09:00
behzad nouri a8c29505f0
sanitizes bloom filters to avoid division by zero (#13714)
Pull requests received over the wire can cause a validator to panic
because of division by zero in bloom filters:
https://github.com/solana-labs/solana/blob/af08ba93e/runtime/src/bloom.rs#L86-L88
2020-11-19 23:35:22 +00:00
dependabot[bot] 856693ac1f chore: bump lru from 0.6.0 to 0.6.1
Bumps [lru](https://github.com/jeromefroe/lru-rs) from 0.6.0 to 0.6.1.
- [Release notes](https://github.com/jeromefroe/lru-rs/releases)
- [Changelog](https://github.com/jeromefroe/lru-rs/blob/master/CHANGELOG.md)
- [Commits](https://github.com/jeromefroe/lru-rs/compare/0.6.0...0.6.1)

Signed-off-by: dependabot[bot] <support@github.com>
2020-11-19 14:28:50 -08:00
behzad nouri b58f69297f
makes crds fields private (#13703)
Crds fields should maintain several invariants between themselves, so
exposing them as public fields can be bug prone. In addition these
invariants are asserted on every write:
https://github.com/solana-labs/solana/blob/9668dd85d/core/src/crds.rs#L138-L154
https://github.com/solana-labs/solana/blob/9668dd85d/core/src/crds.rs#L239-L262
which adds extra instructions and is not optimal. Should these fields be
private the asserts will be redundant.
2020-11-19 20:57:40 +00:00
behzad nouri 1ffab5de77
breaks prunes data into chunks to fit into packets (#13613)
Validator logs show that prune messages are dropped because they exceed
packet data size:
https://github.com/solana-labs/solana/blob/f25c969ad/perf/src/packet.rs#L90-L92
This can exacerbate gossip traffic by redundantly increasing push
messages across network. The workaround is to break prunes into smaller
chunks and send over in multiple messages.
2020-11-19 16:38:01 +00:00
Trent Nelson f2a1a0ac5c RPC: Demote missing block error to warning
It frightens the tourists
2020-11-19 04:54:49 +00:00
Tyera Eulberg 3e4acba72f
Quiet notification logs when no subscriptions (#13629) 2020-11-17 06:37:38 +00:00
Tyera Eulberg ef99689592
Improve TestValidator instantiation (#13627)
* Add TestValidator::new_with_fees constructor, and warning for low bootstrap_validator_lamports

* Add logging to solana-tokens integration test to help catch low bootstrap_validator_lamports in the future

* Reasonable TestValidator mint_lamports
2020-11-16 23:27:36 -07:00
behzad nouri 5e8490ab9d
packs more crds-values in a single gossip packet (#13500)
split_gossip_messages:
https://github.com/solana-labs/solana/blob/a97c04b40/core/src/cluster_info.rs#L1536-L1574
splits crds-values into chunks to fit into a gossip packet. However it is
using a global upper-bound for the header-size across all protocols:
https://github.com/solana-labs/solana/blob/a97c04b40/core/src/cluster_info.rs#L90-L93
This can be wasteful as the specific gossip protocol can have smaller
header than this upper-bound (e.g. Protocol::PushMessage is 170 bytes
smaller). Adding more crds-values in one gossip packet can avoid the
overheads of separate packets and reduce total number of bytes sent over
the wire.

This commit updates the splitting function to take a max-chunk-size
argument. At call-site, this value is set to the size of the protocol
which the values are sent over.
2020-11-15 18:23:59 +00:00
behzad nouri cbea9ebc34
indexes nodes' contact infos in crds table (#13553)
In several places in gossip code, the entire crds table is scanned only
to filter out nodes' contact infos. Currently on mainnet, crds table is
of size ~70k, while there are only ~470 nodes. So the full table scan is
inefficient. Instead we may maintain an index of only nodes' contact
infos.
2020-11-15 16:38:04 +00:00
Michael Vines 5d72e52ad0 Disable the PubSub vote subscription by default
The --rpc-pubsub-enable-vote-subscription flag may be used to enable it.
The current vote subscription is problematic because it emits a
notification for *every* vote, so hundreds a second in a real cluster.
Critically it's also missing information about *who* is voting,
rendering all those notifications practically useless.

Until these two issues can be resolved, the vote subscription is not
much more than a potential DoS vector.
2020-11-14 12:36:37 -08:00
Tyera Eulberg 88ae321d3f
Add counter metrics to rpc-subscriptions (#13596) 2020-11-14 12:40:24 -07:00
Michael Vines baa6b3a261 Add stable program logging for BPF and native programs 2020-11-14 08:26:01 -08:00
Tyera Eulberg 34bf80ba9c
Send pubsub metrics to metrics server (#13584) 2020-11-13 19:31:23 +00:00
sakridge c1f3f9d27b
Stop searching for incorrect shred version after a minute (#13512) 2020-11-12 14:01:13 -08:00
behzad nouri 4e4e12b384
filters out offline nodes from pull options (#13533)
Inactive nodes are still observing incoming gossip traffic:
https://discord.com/channels/428295358100013066/670512312339398668/776140351291260968
likely because of pull-requests.

Previous related issues and commits:
https://github.com/solana-labs/solana/issues/12409
https://github.com/solana-labs/solana/pull/12620
https://github.com/solana-labs/solana/pull/12674

This commit implements same logic as
https://github.com/solana-labs/solana/pull/12674
to exclude inactive nodes from pull options, with the same periodic
retry logic for offline staked nodes in order to mitigate eclipse
attack.
2020-11-12 16:09:37 +00:00
carllin 9821a7754c
Discard pre hard fork persisted tower if hard-forking (#13536)
* Discard pre hard fork persisted tower if hard-forking

* Relax config.require_tower

* Add cluster test

* nits

* Remove unnecessary check

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
Co-authored-by: Carl Lin <carl@solana.com>
2020-11-12 23:29:04 +09:00
Ryo Onodera 89b474e192
Fix slow/stuck unstaking due to toggling in epoch (#13501)
* Fix slow/stuck unstaking due to toggling in epoch

* nits

* nits

* Add stake_program_v2 feature status check to cli

Co-authored-by: Tyera Eulberg <tyera@solana.com>
2020-11-11 14:11:57 -07:00
Trent Nelson 38f15e41b5 Validator: Periodically log what we're waiting for during `--wait-for-supermajority` 2020-11-11 20:03:26 +00:00
sakridge 70c4626efe
Fix signature access (#13491) 2020-11-10 08:35:03 -08:00
Justin Starry a97c04b400
Send RPC notification when account is deleted (#13440)
* Send RPC notification when account is deleted

* Remove unwrap
2020-11-10 19:48:42 +08:00
sakridge b4cf968e14
Add back shredding broadcast stats (#13463) 2020-11-09 23:04:27 -08:00
sakridge c644b05c54
Fix avx check with newest nightly compiler (#13465) 2020-11-09 08:04:34 -08:00
behzad nouri 73ac104df2
propagates errors out of Packet::from_data (#13445)
Packet::from_data is ignoring serialization errors:
https://github.com/solana-labs/solana/blob/d08c3232e/sdk/src/packet.rs#L42-L48
This is likely never useful as the packet will be sent over the wire
taking bandwidth but at the receiving end will either fail to
deserialize or it will be invalid.
This commit will propagate the errors out of the function to the
call-site, allowing the call-site to handle the error.
2020-11-08 15:10:03 +00:00
behzad nouri 7f4debdad5
drops older gossip packets when load shedding (#13364)
Gossip drops incoming packets when overloaded:
https://github.com/solana-labs/solana/blob/f6a73098a/core/src/cluster_info.rs#L2462-L2475
However newer packets are dropped in favor of the older ones.
This is probably not ideal as newer packets are more likely to contain
more recent data, so dropping them will keep the validator state
lagging.
2020-11-05 17:14:28 +00:00
behzad nouri 8f0796436a
shares the lock on gossip when processing prune messages (#13339)
Processing prune messages acquires an exclusive lock on gossip:
https://github.com/solana-labs/solana/blob/55b0428ff/core/src/cluster_info.rs#L1824-L1825
This can be reduced to a shared lock if active-sets are changed to use
atomic bloom filters:
https://github.com/solana-labs/solana/blob/55b0428ff/core/src/crds_gossip_push.rs#L50
2020-11-05 15:42:00 +00:00
behzad nouri 118ce47b97
measures processing time of each kind of gossip packets (#13366) 2020-11-05 15:34:34 +00:00
Michael Vines 8838a55a1a Bump spl-token and spl-memo crate versions 2020-11-04 21:44:33 +00:00
behzad nouri 10fa4f45ab
uses thread-pool when handling push messages (#13338)
From runtime profiles, the majority time of solana-listen thread:
https://github.com/solana-labs/solana/blob/55b0428ff/core/src/cluster_info.rs#L2720
is spent handling push messages. The code here:
https://github.com/solana-labs/solana/blob/55b0428ff/core/src/cluster_info.rs#L2272-L2364
may utilize the idle gossip thread-pool.
2020-11-04 19:15:58 +00:00
sakridge 0d663158d0
Reduce repair_stats debug (#13393) 2020-11-04 10:32:48 -08:00
Tyera Eulberg eb2560e782 Prevent block times from ever going backward 2020-10-31 21:30:42 -07:00
Tyera Eulberg 90778615f6 Use bounded timestamp-correction when feature enabled 2020-10-31 21:30:42 -07:00
sakridge 8415c22b59
Reduce debug (#13319) 2020-10-30 16:18:44 -07:00
Ryo Onodera 1df15d85c3
Fix tower/blockstore unsync due to external causes (#12671)
* Fix tower/blockstore unsync due to external causes

* Add and clean up long comments

* Clean up test

* Comment about warped_slot_history

* Run test_future_tower with master-only/master-slave

* Update comments about false leader condition
2020-10-30 19:31:23 +09:00
Michael Vines df8dab9d2b Native/builtin programs now receive an InvokeContext 2020-10-29 21:45:24 -07:00
Greg Fitzgerald ca00197009
Upgrade tarpc and tokio (#13293) 2020-10-29 19:21:18 -06:00
behzad nouri 3738611f5c
adds more parallel processing to gossip packets handling (#12988) 2020-10-29 15:17:19 +00:00
behzad nouri be80f6d5c5
excludes origin from prune set (#13204)
On the receiving end, prune messages are ignored if the origin points to
the node itself:
https://github.com/solana-labs/solana/blob/631f029fe/core/src/crds_gossip_push.rs#L285-L295
So to avoid sending these over the wire, the requester can exclude
origin from the prune set.
2020-10-29 12:50:58 +00:00
Jack May c458d4b213
move Account to solana-sdk (#13198) 2020-10-28 22:01:07 -07:00
behzad nouri ae91270961
implements ping-pong packets between nodes (#12794)
https://hackerone.com/reports/991106

> It’s possible to use UDP gossip protocol to amplify DDoS attacks. An attacker
> can spoof IP address in UDP packet when sending PullRequest to the node.
> There's no any validation if provided source IP address is not spoofed and
> the node can send much larger PullResponse to victim's IP. As I checked,
> PullRequest is about 290 bytes, while PullResponse is about 10 kB. It means
> that amplification is about 34x. This way an attacker can easily perform DDoS
> attack both on Solana node and third-party server.
>
> To prevent it, need for example to implement ping-pong mechanism similar as
> in Ethereum: Before accepting requests from remote client needs to validate
> his IP. Local node sends Ping packet to the remote node and it needs to reply
> with Pong packet that contains hash of matching Ping packet. Content of Ping
> packet is unpredictable. If hash from Pong packet matches, local node can
> remember IP where Ping packet was sent as correct and allow further
> communication.
>
> More info:
> https://github.com/ethereum/devp2p/blob/master/discv4.md#endpoint-proof
> https://github.com/ethereum/devp2p/blob/master/discv4.md#wire-protocol

The commit adds a PingCache, which maintains records of remote nodes
which have returned a valid response to a ping message, and on-the-fly
ping messages pending a pong response from the remote node.

When handling pull-requests, those from addresses which have not passed
the ping-pong check are filtered out, and additionally ping packets are
added for addresses which need to be (re)verified.
2020-10-28 17:03:02 +00:00
carllin f96ab5a818
Fix log (#13207)
Co-authored-by: Carl Lin <carl@solana.com>
2020-10-27 18:56:57 -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
behzad nouri 4bfda3e766
marks pull request creation time only once per peer (#13113)
mark_pull_request_creation time requires an exclusive lock on gossip:
https://github.com/solana-labs/solana/blob/16944e218/core/src/cluster_info.rs#L1547-L1548
Current code is redundantly marking each peer once for each request.
There are at most only 2 unique peers, whereas there are hundreds of
requests per each. So the lock is acquired hundreds of time longer than
necessary.
2020-10-26 17:11:31 +00:00
Ryo Onodera 66c7a98009
Allow existence of vote on root in saved tower (#13135) 2020-10-26 11:08:20 +09:00
Michael Vines a4956844bd Update frozen_abi hashes
The movement of files in sdk/ caused ABI hashes to change
2020-10-24 08:37:55 -07:00
Josh 766406fd23
add precompile verification to simulate_transaction (#13080) 2020-10-23 20:47:51 -07:00
Ryo Onodera 0264147d42
Clean up opt conf verifier and vote state tracker (#13081)
* Clean up opt conf verifier and vote state tracker

* Update test to follow new message and some knob

* Rename
2020-10-24 10:19:12 +09:00