Commit Graph

13848 Commits

Author SHA1 Message Date
a29344e681 Document ProgramTest::new and fix ProgramTest::add_program (#17754) (#17767)
* document ProgramTest::new

* simplify ProgramTest::new doc-string

* make ProgramTest::add_program noisier

`add_program` (and `new`, implicitly) now prints a warning when the user
supplies a bogus program name to a ProgramTest and invokes `test-bpf`.

Additionally, it is now impossible to ask for a regular `test` and for
the generated ProgramTest to load BPF code instead of native code.
Previously, this was caused by a precedence issue: BPF code would always
be preferred over native if the program name was valid, regardless of
user choice.

(cherry picked from commit 2aaf55795f)

Co-authored-by: xuoe <alex@psi.io>
2021-06-06 05:56:24 +00:00
1bce8a99a2 Add more CPI call depth tests (#17657) 2021-06-02 00:22:29 -07:00
3a3454d788 Bump version to v1.6.12 (#17651) 2021-06-01 21:40:36 -06:00
0e3131f2b4 Purge expired BlockHeight data from blockstore (backport #17634) (#17640)
* Purge expired BlockHeight data from blockstore (#17634)

* Purge expired BlockHeight data from blockstore

* Also call compact_storage and add comment....

(cherry picked from commit 96cdbfdcc0)

# Conflicts:
#	ledger/src/blockstore_db.rs

* Fix conflict

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
v1.6.11
2021-06-02 00:04:12 +00:00
27997653f1 Rework #17486 (backport #17566) (#17596)
* Revert "Improve missing default signer error messaging (#17486)"

This reverts commit 6d40d0d141.

(cherry picked from commit ca8c1c6c42)

* Improve missing default filepath signer error messaging

(cherry picked from commit 06a926f2f4)

* CI: temporarily skip spl downstream build

(cherry picked from commit d01b4f80f9)

Co-authored-by: Trent Nelson <trent@solana.com>
2021-05-31 17:27:12 +00:00
c3f66dcfa7 Make initialize public (#17605) (#17606)
(cherry picked from commit 2896fc3987)

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-05-31 07:45:34 -07:00
6a2377dd50 Disable read-only optimization features (#17583)
* Disable RO optimization features

* nudge
2021-05-28 21:55:37 +00:00
8b1a1d9c99 test-validator: add an arg to control faucet genesis balance (#17581)
(cherry picked from commit 974a96738a)

Co-authored-by: Trent Nelson <trent@solana.com>
2021-05-28 10:43:31 -07:00
01e2d5cd35 Add block height to ConfirmedBlock structs (backport #17523) (#17534)
* Add block height to ConfirmedBlock structs (#17523)

* Add BlockHeight CF to blockstore

* Rename CacheBlockTimeService to be more general

* Cache block-height using service

* Fixup previous proto mishandling

* Add block_height to block structs

* Add block-height to solana block

* Fallback to BankForks if block time or block height are not yet written to Blockstore

* Add docs

* Review comments

(cherry picked from commit ab581dafc2)

# Conflicts:
#	core/src/replay_stage.rs
#	core/src/tvu.rs
#	core/src/validator.rs

* Fix conflicts

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-05-26 22:42:46 -07:00
8b61ba4d8d Add missing fields from getClusterNodes documentation (backport #17501) (#17502)
* Add missing fields from getClusterNodes documentation

(cherry picked from commit 3d40ec3c88)

# Conflicts:
#	docs/src/developing/clients/jsonrpc-api.md

* rebase

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-05-26 21:38:27 -07:00
f364956d15 Plumb transaction-level rewards (aka "rent debits") into the getTransaction RPC method (backport #17528) (#17532)
* Plumb transaction-level rewards (aka "rent debits") into the `getTransaction` RPC method

(cherry picked from commit 9541411c15)

# Conflicts:
#	docs/src/developing/clients/jsonrpc-api.md

* rebase

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-05-26 21:33:30 -07:00
cedd00e82e Fix typo in docs (#17531)
(cherry picked from commit 7dfc1d9790)

Co-authored-by: Felipe Lima <felipe.lima@gmail.com>
2021-05-27 03:13:21 +00:00
3b22f5b833 simulateTransaction RPC method can now return accounts modified by the simulation (backport #17499) (#17526)
* simulateTransaction can now return accounts modified by the simulation

(cherry picked from commit cbce440af4)

# Conflicts:
#	rpc/src/parsed_token_accounts.rs

* rebase

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-05-27 00:06:05 +00:00
9c549a3ccf Add custom error for tx-history queries when node does not support (backport #17494) (#17522)
* Add custom error for tx-history queries when node does not support (#17494)

(cherry picked from commit 6abe089740)

# Conflicts:
#	core/src/rpc.rs

* Fix conflicts

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-05-26 21:37:26 +00:00
f4cf7d2c84 Add last valid block height to rpc Fees (backport #17506) (#17507)
* Add last valid block height to rpc Fees (#17506)

* Add last_valid_block_height to fees rpc

* Add getBlockHeight rpc

* Update docs

(cherry picked from commit e9bc1c6b07)

# Conflicts:
#	client/src/rpc_request.rs
#	docs/src/developing/clients/jsonrpc-api.md

* Fix conflicts and a-z docs

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-05-26 16:25:41 +00:00
b9834ed9eb docs: Add find_program_address and example (#17515) (#17517)
(cherry picked from commit bb72ab7f1b)

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
2021-05-26 15:49:53 +00:00
2781d69319 runtime: add rent debit charges to block metadata (backport #17504) (#17513)
* runtime: add rent debit charges to block metadata

(cherry picked from commit 97eab7edf9)

* add tests from `RentDebits`

(cherry picked from commit 2a6c5ed0ac)

Co-authored-by: Trent Nelson <trent@solana.com>
2021-05-26 15:39:38 +00:00
4d58a0e200 Add a hacky shell for fun code reading (#17503) (#17505)
(cherry picked from commit 7ce910f459)

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2021-05-26 06:39:26 +00:00
b37e5c8a36 Improve missing default signer error messaging (#17486) (#17500)
(cherry picked from commit 6d40d0d141)

Co-authored-by: Jack May <jack@solana.com>
2021-05-26 02:51:36 +00:00
b06bfeec8d Add a flag to simulateTransaction to use most recent blockhash (backport #17485) (#17497)
* Add a flag to simulateTransaction to use most recent blockhash

(cherry picked from commit 96cef5260c)

* rename flag

(cherry picked from commit e14f3eb529)

* sigVerify conflicts with replace, add tests

(cherry picked from commit 660d37aadf)

Co-authored-by: Justin Starry <justin@solana.com>
2021-05-26 01:49:52 +00:00
02c4170357 Update sysvar docs (#17493) (#17495)
(cherry picked from commit 4eb6deee2d)

Co-authored-by: Jack May <jack@solana.com>
2021-05-26 00:22:32 +00:00
24a21d0ba6 docs: Add RPC node HW recommendations (#17490)
(cherry picked from commit 64bfc14a75)

Co-authored-by: Trent Nelson <trent@solana.com>
2021-05-25 23:22:26 +00:00
ae1687bc0a Bump version to v1.6.11 (#17484) 2021-05-25 15:35:50 -06:00
5d4654d2f4 docs: Add inner instruction and cross-program invocation (#17476) (#17479)
(cherry picked from commit a03230338a)

Co-authored-by: Jon Cinque <jon.cinque@gmail.com>
v1.6.10
2021-05-25 17:09:11 +00:00
d69c1d6db6 docs: budget program is gone, link to SPL Token multisig (#17478)
(cherry picked from commit 2019558f03)

Co-authored-by: Trent Nelson <trent@solana.com>
2021-05-25 16:09:40 +00:00
fa65107460 Avoid ip_echo_server unwrap (#17445)
(cherry picked from commit 30b60a976b)

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-05-24 14:40:47 -06:00
dd2d119d2b v1.6: Ensure cluster-confirmed roots are set on boot (#17442)
* Add blockstore-root-scan for api nodes on boot

* Ensure cluster-confirmed root and parents are set as root in blockstore in load_frozen_forks()

* Plumb rpc-scan-and-fix-roots validator flag
2021-05-24 20:16:37 +00:00
b7dc7d859c removes Crds::lookup and lookup_versioned (backport #17438) (#17441)
* removes Crds::lookup and lookup_versioned (#17438)

(cherry picked from commit e867d7f3b8)

* patches push_epoch_slots for backport

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-24 20:10:44 +00:00
0db23fee53 encapsulates purged values bookkeeping into crds module (#17265) (#17436)
For all code paths (gossip push, pull, purge, etc) that remove or
override a crds value, it is necessary to record hash of values purged
from crds table, in order to exclude them from subsequent pull-requests;
otherwise the next pull request will likely return outdated values,
wasting bandwidth:
https://github.com/solana-labs/solana/blob/ed51cde37/core/src/crds_gossip_pull.rs#L486-L491

Currently this is done all over the place in multiple modules, and this
has caused bugs in the past where purged values were not recorded.

This commit encapsulated this bookkeeping into crds module, so that any
code path which removes or overrides a crds value, also records the hash
of purged value in-place.

(cherry picked from commit 9d112cf41f)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-24 15:04:24 +00:00
7e073e64a3 indexes crds votes by insert order (#17340) (#17435)
Crds::get_votes is scanning over all votes in the crds table only to
return those inserted since the given cursor:
https://github.com/solana-labs/solana/blob/2ae57c172/core/src/crds.rs#L250-L266

Having votes indexed by insert order avoids the table scan and will be
more efficient.

(cherry picked from commit 060332c704)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-24 14:55:09 +00:00
7d438e5c28 rolls back min number of bloom items for debug builds (#17420) (#17421)
coverage ci builds are have become flaky presumably because of the
overhead added in https://github.com/solana-labs/solana/pull/17236
for very small test clusters.

This commit uses a smaller min number of bloom items condition on that
if debug assertions are enabled or not.

Previous attempt at fixing the flakiness:
https://github.com/solana-labs/solana/pull/17408

(cherry picked from commit 5567305a5f)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-23 18:07:38 +00:00
83cc44953d increases timeout duration for gossip discover (backport #17408) (#17414)
* increases timeout duration for gossip discover

(cherry picked from commit d6496376ce)

* uses Duration type for gossip discover timeout

(cherry picked from commit cf1acfb021)

# Conflicts:
#	core/src/gossip_service.rs

* removes backport merge conflicts

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-22 20:53:56 +00:00
215928445c records hash of timed-out pull responses (#17410)
Gossip should record hash of pull responses which are timed out and
fail to insert:
https://github.com/solana-labs/solana/blob/ed51cde37/core/src/crds_gossip_pull.rs#L397-L400

so that they are excluded from the next pull request:
https://github.com/solana-labs/solana/blob/ed51cde37/core/src/crds_gossip_pull.rs#L486-L491

otherwise the next pull request will likely include the same timed out
values and waste bandwidth.

(cherry picked from commit a7870cda8d)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-22 18:35:16 +00:00
de6de7a367 rpc: add context toggle to getProgramAccounts (#17399) (#17403)
* fix(rpc): return context in get_program_accounts

* doc(rpc): document withContext flag

* fix(rpc): fix comment

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

* fix(rpc): fix doc

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

Co-authored-by: Michael Vines <mvines@gmail.com>
(cherry picked from commit d41266e4e9)

Co-authored-by: Nikita <bananaelecitrus@gmail.com>
2021-05-22 08:28:19 +00:00
e8c054b1f4 account-decoder: don't use strings to convert between Pubkey types (#17391) (#17398)
* account-decoder: don't use strings to convert between Pubkey types

* transaction-status: don't use strings to convert between Pubkey types

(cherry picked from commit 51178ccb33)

Co-authored-by: Alexander Polakov <polachok@users.noreply.github.com>
2021-05-22 01:24:02 +00:00
df08ba5dcd SetLockup now requires the authorized withdrawer when the lockup is not in force (#17394)
(cherry picked from commit 96cde36784)

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-05-21 21:17:06 +00:00
72d038ecd8 Remove const qualifier from syscall out-parameters (#17382) (#17395)
(cherry picked from commit 8758e9ed82)

Co-authored-by: Christian Machacek <39452430+machacekch@users.noreply.github.com>
2021-05-21 20:45:35 +00:00
b08c0caefe adds metric for turbine retransmit tree mismatch (backport #17351) (#17392)
* adds metric for turbine retransmit tree mismatch

In order to remove port-based forwarding logic in turbine, we need to
first track how often the turbine retransmit/broadcast trees mismatch
across nodes.
One consistency condition is that if the node is on the critical path
(i.e. the first node in each neighborhood), then we expect that the
packet arrives at tvu socket as opposed to tvu-forwards.

This commit adds a metric to track how often above condition is not met.

(cherry picked from commit 71de021177)

* removes the nested for loop from retransmit-stage

The code can be simplified by just flattening the vector of packets.

(cherry picked from commit ff0e623d30)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-21 20:08:12 +00:00
8fe5b41f5f Stake merge inactive lockup (backport #17376) (#17390)
* stake: plumb `can_merge_expired_lockups` feature flag

(cherry picked from commit 74ac6ab80f)

* stake: merge accounts with mismatched, but expired lockups

(cherry picked from commit 019bccab51)

Co-authored-by: Trent Nelson <trent@solana.com>
2021-05-21 20:00:59 +00:00
25333abd96 extends crds values timeouts if stakes are unknown (#17261) (#17389)
If stakes are unknown, then timeouts will be short, resulting in values
being purged from the crds table, and consequently higher pull-response
load when they are obtained again from gossip. In particular, this slows
down validator start where almost all values obtained from entrypoint
are immediately discarded.

(cherry picked from commit 2adce67260)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-21 17:29:37 +00:00
f09a100e60 retains one node-instance per pubkey (#17187) (#17386)
crds table retains up to 32 node-instance values per each pubkey. This
is so because if there are multiple running instances of the same node,
then we want gossip to propagate node-instance values associated with
both instances, therefore the corresponding label/key includes the
randomly generated token in addition to the pubkey:
https://github.com/solana-labs/solana/blob/9c42a89a4/core/src/crds_value.rs#L448
https://github.com/solana-labs/solana/pull/14037

As a result, the number of such values per pubkey are effectively
unbounded, requiring custom mitigations implemented in:
https://github.com/solana-labs/solana/pull/14467
but still taking redundant extra memory and bandwidth.

This commit instead retains only one node-instance per pubkey by
extending crds values override logic. If a crds value is of type
node-instance, it will always override an existing one with the same key
if it has more recent starting timestamp (not wallclock). As a result,
gossip will always propagate the node-instance with more recent
timestamp. Since the check_duplicate logic will stop the node with older
timestamp, this change should preserve existing functionality.

(cherry picked from commit 0aa7824884)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-21 17:20:36 +00:00
7cc96dc20f Update getrandom bpf dependency (#17388)
(cherry picked from commit 8c073b2c94)

Co-authored-by: Jack May <jack@solana.com>
2021-05-21 16:56:09 +00:00
40c95dde4f prioritizes more recent values in pull responses (#17238) (#17384)
On the receiving end, the outdated values are discarded, and they will
only waste bandwidth:
https://github.com/solana-labs/solana/blob/3f0480d06/core/src/crds_gossip_pull.rs#L385-L400

This is also exacerbating validator start, since the entrypoint is
returning old values in pull responses, and the validator immediately
discards those; resulting in huge delay until the validator obtains
contact-info of the entrypoint and is able to adopt shred-version and
fully start.

(cherry picked from commit 5e6b00fe98)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-21 16:03:04 +00:00
0d38f11998 bumps up min number of bloom items in gossip pull requests (#17236) (#17383)
When a validator starts, it has an (almost) empty crds table and it only
sends one pull-request to the entrypoint. The bloom filter in the
pull-request targets 10% false rate given the number of items. So, if
the `num_items` is very wrong, it makes a very small bloom filter with a
very high false rate:
https://github.com/solana-labs/solana/blob/2ae57c172/runtime/src/bloom.rs#L70-L80
https://github.com/solana-labs/solana/blob/2ae57c172/core/src/crds_gossip_pull.rs#L48

As a result, it is very unlikely that the validator obtains entrypoint's
contact-info in response. This exacerbates how long the validator will
loop on:
    > Waiting to adopt entrypoint shred version
https://github.com/solana-labs/solana/blob/ed51cde37/validator/src/main.rs#L390-L412

This commit increases the min number of bloom items when making gossip
pull requests. Effectively this will break the entrypoint crds table
into 64 shards, one pull-request for each, a larger bloom filter for
each shard, and increases the chances that the response will include
entrypoint's contact-info, which is needed for adopting shred version
and validator start.

(cherry picked from commit e8b35a4f7b)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2021-05-21 15:21:52 +00:00
3e89cb6b43 programs/stake: cancel deactivate (backport #17344) (#17375)
* programs/stake: cancel deactivate (#17344)

fix: remove stray println

add error for inconsistent input.

fix: lamports don't need to match when redelegating to same vote account

Improve comments

bump

Apply suggestions from code review

Add assert in test

Use stake_program_v4

Co-Authored-By: Trent Nelson <trent.a.b.nelson@gmail.com>

Co-authored-by: Trent Nelson <trent.a.b.nelson@gmail.com>
(cherry picked from commit 662c2aaeec)

# Conflicts:
#	programs/stake/src/stake_instruction.rs
#	programs/stake/src/stake_state.rs

* Fix conflicts

Co-authored-by: jon-chuang <9093549+jon-chuang@users.noreply.github.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-05-21 10:41:13 +00:00
5025c7c983 Prevent withrawing Initialized stake account to rent-exempt reserve (backport #17366) (#17370)
* Prevent withrawing Initialized stake account to zero stake (#17366)

(cherry picked from commit 91f2b6185e)

# Conflicts:
#	programs/stake/src/stake_instruction.rs

* Fix conflicts

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
Co-authored-by: Tyera Eulberg <tyera@solana.com>
2021-05-21 10:23:20 +00:00
c3fafda981 clap-utils: Fix signer resolution on Windows (#17371)
(cherry picked from commit e320af99a0)

# Conflicts:
#	clap-utils/src/keypair.rs

Co-authored-by: Trent Nelson <trent@solana.com>
2021-05-21 07:27:49 +00:00
3f6964d264 InvokeContext: Add get_sysvar() helper to sdk (backport #17360) (#17368)
* Add get_sysvar() helper to sdk

(cherry picked from commit 2c99b23ad7)

# Conflicts:
#	runtime/src/message_processor.rs
#	sdk/src/process_instruction.rs

* Resolve conflicts

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-05-21 03:42:20 +00:00
b1d294de75 Add stake_program_v4 feature (#17356)
(cherry picked from commit a1a0d6f84b)

Co-authored-by: Michael Vines <mvines@gmail.com>
2021-05-20 22:32:30 +00:00
2b34800870 docs: Update transaction expiration time (#17347) (#17349)
(cherry picked from commit ddfc15b9f2)

Co-authored-by: Justin Starry <justin@solana.com>
2021-05-20 15:29:44 +00:00