Compare commits

...

18 Commits

Author SHA1 Message Date
mergify[bot]
65a1884c7b Enable stricter check on rent-exempt accounts on testnet (#12224) (#12226)
(cherry picked from commit 241e6f1ecf)

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2020-09-15 08:07:23 +00:00
mergify[bot]
c1a9c826f3 Enable retirement of rent collect in Bank::deposit() on testnet (#12223) (#12227)
(cherry picked from commit 629572831b)

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2020-09-15 07:53:36 +00:00
mergify[bot]
d9d8ec480a Enable eager-rent-collect-across-gapped-epochs bugfix (#12219) (#12222)
(cherry picked from commit 7d48339b7c)

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2020-09-15 06:14:35 +00:00
mergify[bot]
b5c7ad3a9b Add new validator options for running in more restrictive environments (bp #12191) (#12218)
* Add --restricted-repair-only-mode flag

(cherry picked from commit 63a67f415e)

* Add --gossip-validator argument

(cherry picked from commit daae638781)

* Documenet how to reduce validator port exposure

(cherry picked from commit c8f03c7f6d)

Co-authored-by: Michael Vines <mvines@gmail.com>
2020-09-15 04:26:23 +00:00
mergify[bot]
771ff65fb4 Faucet: Improve error handling (#12215)
(cherry picked from commit af2262cbba)

Co-authored-by: Trent Nelson <trent@solana.com>
2020-09-15 01:31:02 +00:00
mergify[bot]
a5bf59b92a patches default impl for crds filter (#12199) (#12200)
In CrdsFilter.mask all bits after mask_bits are set to 1:
https://github.com/solana-labs/solana/blob/555252f4/core/src/crds_gossip_pull.rs#L65
However the default implementation, sets both mask and mask_bits to zero
which is inconsistent with CrdsFilter::compute_mask for a mask_bits of
zero.

This commit changes the default implementation by setting mask to
`!0u64` (i.e all bits set to one). As a result, for the default crds
filter, `test_mask` will always return true, whereas previously it was
always returning false.
https://github.com/solana-labs/solana/blob/555252f4/core/src/crds_gossip_pull.rs#L85

This is only used in tests and benchmarks, but causes some benchmarks to
be misleading by short circuiting in this line:
https://github.com/solana-labs/solana/blob/555252f4/core/src/crds_gossip_pull.rs#L429

(cherry picked from commit d6ec03f13c)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2020-09-13 14:10:42 +00:00
mergify[bot]
8dc019ae98 Gate pointer alignment enforcement (bp #12176) (#12188)
* Gate pointer alignment enforcement (#12176)

(cherry picked from commit ae7b15f062)

# Conflicts:
#	programs/bpf/tests/programs.rs

* Fix conflicts

Co-authored-by: Jack May <jack@solana.com>
2020-09-12 00:06:39 +00:00
mergify[bot]
61dcab8c07 Update commitment options (#12173) (#12189)
(cherry picked from commit 3c69cd6d61)

Co-authored-by: carllin <wumu727@gmail.com>
2020-09-11 19:24:16 +00:00
mergify[bot]
640bf7015f Check bank capitalization (bp #11927) (#12184)
* 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>
(cherry picked from commit de4a613610)

# Conflicts:
#	Cargo.lock
#	accounts-bench/Cargo.toml

* Fix conflict 1/2

* Fix conflict 2/2

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2020-09-11 18:04:10 +00:00
mergify[bot]
db1f57162a Fix propagation on startup from snapshot (#12177) (#12182)
(cherry picked from commit 9c490e06b0)

Co-authored-by: carllin <wumu727@gmail.com>
2020-09-11 10:04:55 +00:00
mergify[bot]
bbddffa805 solana-validator --rpc-bind-address argument now works as expected (bp #12168) (#12174)
* `solana-validator --rpc-bind-address` argument now works as expected

(cherry picked from commit 6f325d4594)

* Update bootstrap-validator.sh

Co-authored-by: Michael Vines <mvines@gmail.com>
2020-09-10 22:02:50 +00:00
mergify[bot]
61cf432477 Update commitment options (#12171) (#12172)
(cherry picked from commit 361e5322e4)

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2020-09-10 13:55:48 -06:00
mergify[bot]
9396618c12 Calc size ahead of time to alloc once (#12154) (#12169)
(cherry picked from commit fd47d38e59)

Co-authored-by: Jack May <jack@solana.com>
2020-09-10 19:17:20 +00:00
mergify[bot]
398f12dcc5 Program subscriptions now properly check results len and token program id (#12139) (#12141)
(cherry picked from commit 4431080066)

Co-authored-by: Tyera Eulberg <teulberg@gmail.com>
2020-09-09 22:23:11 +00:00
mergify[bot]
796624adf9 uses rust intrinsics to convert hashes to u64 (#12097) (#12133)
(cherry picked from commit 28f2fa3fd5)

Co-authored-by: behzad nouri <behzadnouri@gmail.com>
2020-09-09 16:33:15 +00:00
mergify[bot]
f6e266eff0 Activate new bpf loader on devnet (#12124)
(cherry picked from commit f54941fa15)

Co-authored-by: Michael Vines <mvines@gmail.com>
2020-09-09 05:48:18 +00:00
mergify[bot]
ed237af4d8 Prevent unbound memory growth by blockstore_processor (#12110) (#12122)
* Prevent unbound memory growth by blockstore_processor

* Promote log to info! considering infrequency

* Exclude the time of freeing from interval...

* Skip not-shrinkable slots even if forced

* Add comment

(cherry picked from commit c274e26eb8)

Co-authored-by: Ryo Onodera <ryoqun@gmail.com>
2020-09-09 04:09:27 +00:00
Michael Vines
415c80c204 Bump version to v1.3.10 2020-09-09 01:29:39 +00:00
124 changed files with 2111 additions and 1097 deletions

327
Cargo.lock generated

File diff suppressed because it is too large Load Diff

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-account-decoder"
version = "1.3.9"
version = "1.3.10"
description = "Solana account decoder"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -18,10 +18,10 @@ lazy_static = "1.4.0"
serde = "1.0.112"
serde_derive = "1.0.103"
serde_json = "1.0.56"
solana-config-program = { path = "../programs/config", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-stake-program = { path = "../programs/stake", version = "1.3.9" }
solana-vote-program = { path = "../programs/vote", version = "1.3.9" }
solana-config-program = { path = "../programs/config", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-stake-program = { path = "../programs/stake", version = "1.3.10" }
solana-vote-program = { path = "../programs/vote", version = "1.3.10" }
spl-token-v2-0 = { package = "spl-token", version = "2.0.3", features = ["skip-no-mangle"] }
thiserror = "1.0"

View File

@@ -2,7 +2,7 @@
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-accounts-bench"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -10,10 +10,11 @@ homepage = "https://solana.com/"
[dependencies]
log = "0.4.6"
rayon = "1.4.0"
solana-logger = { path = "../logger", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-measure = { path = "../measure", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-measure = { path = "../measure", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
rand = "0.7.0"
clap = "2.33.1"
crossbeam-channel = "0.4"

View File

@@ -1,4 +1,4 @@
use clap::{value_t, App, Arg};
use clap::{crate_description, crate_name, value_t, App, Arg};
use rayon::prelude::*;
use solana_measure::measure::Measure;
use solana_runtime::{
@@ -6,15 +6,16 @@ use solana_runtime::{
accounts_index::Ancestors,
};
use solana_sdk::{genesis_config::ClusterType, pubkey::Pubkey};
use std::env;
use std::fs;
use std::path::PathBuf;
fn main() {
solana_logger::setup();
let matches = App::new("crate")
.about("about")
.version("version")
let matches = App::new(crate_name!())
.about(crate_description!())
.version(solana_version::version!())
.arg(
Arg::with_name("num_slots")
.long("num_slots")
@@ -50,7 +51,8 @@ fn main() {
let clean = matches.is_present("clean");
println!("clean: {:?}", clean);
let path = PathBuf::from("farf/accounts-bench");
let path = PathBuf::from(env::var("FARF_DIR").unwrap_or_else(|_| "farf".to_owned()))
.join("accounts-bench");
if fs::remove_dir_all(path.clone()).is_err() {
println!("Warning: Couldn't remove {:?}", path);
}
@@ -96,7 +98,7 @@ fn main() {
} else {
let mut pubkeys: Vec<Pubkey> = vec![];
let mut time = Measure::start("hash");
let hash = accounts.accounts_db.update_accounts_hash(0, &ancestors);
let hash = accounts.accounts_db.update_accounts_hash(0, &ancestors).0;
time.stop();
println!("hash: {} {}", hash, time);
create_test_accounts(&accounts, &mut pubkeys, 1, 0);

View File

@@ -2,7 +2,7 @@
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-banking-bench"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -13,16 +13,16 @@ crossbeam-channel = "0.4"
log = "0.4.6"
rand = "0.7.0"
rayon = "1.4.0"
solana-core = { path = "../core", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-streamer = { path = "../streamer", version = "1.3.9" }
solana-perf = { path = "../perf", version = "1.3.9" }
solana-ledger = { path = "../ledger", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-measure = { path = "../measure", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-core = { path = "../core", version = "1.3.10" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-streamer = { path = "../streamer", version = "1.3.10" }
solana-perf = { path = "../perf", version = "1.3.10" }
solana-ledger = { path = "../ledger", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-measure = { path = "../measure", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-banks-client"
version = "1.3.9"
version = "1.3.10"
description = "Solana banks client"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,15 +12,15 @@ edition = "2018"
async-trait = "0.1.36"
bincode = "1.3.1"
futures = "0.3"
solana-banks-interface = { path = "../banks-interface", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-banks-interface = { path = "../banks-interface", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
tarpc = { version = "0.21.0", features = ["full"] }
tokio = "0.2"
tokio-serde = { version = "0.6", features = ["bincode"] }
[dev-dependencies]
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-banks-server = { path = "../banks-server", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-banks-server = { path = "../banks-server", version = "1.3.10" }
[lib]
crate-type = ["lib"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-banks-interface"
version = "1.3.9"
version = "1.3.10"
description = "Solana banks RPC interface"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -10,7 +10,7 @@ edition = "2018"
[dependencies]
serde = { version = "1.0.112", features = ["derive"] }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
tarpc = { version = "0.21.0", features = ["full"] }
[lib]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-banks-server"
version = "1.3.9"
version = "1.3.10"
description = "Solana banks server"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,10 +12,10 @@ edition = "2018"
bincode = "1.3.1"
futures = "0.3"
log = "0.4.8"
solana-banks-interface = { path = "../banks-interface", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-metrics = { path = "../metrics", version = "1.3.9" }
solana-banks-interface = { path = "../banks-interface", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-metrics = { path = "../metrics", version = "1.3.10" }
tarpc = { version = "0.21.0", features = ["full"] }
tokio = "0.2"
tokio-serde = { version = "0.6", features = ["bincode"] }

View File

@@ -2,7 +2,7 @@
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-bench-exchange"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -18,21 +18,21 @@ rand = "0.7.0"
rayon = "1.4.0"
serde_json = "1.0.56"
serde_yaml = "0.8.13"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-core = { path = "../core", version = "1.3.9" }
solana-genesis = { path = "../genesis", version = "1.3.9" }
solana-client = { path = "../client", version = "1.3.9" }
solana-faucet = { path = "../faucet", version = "1.3.9" }
solana-exchange-program = { path = "../programs/exchange", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-metrics = { path = "../metrics", version = "1.3.9" }
solana-net-utils = { path = "../net-utils", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-core = { path = "../core", version = "1.3.10" }
solana-genesis = { path = "../genesis", version = "1.3.10" }
solana-client = { path = "../client", version = "1.3.10" }
solana-faucet = { path = "../faucet", version = "1.3.10" }
solana-exchange-program = { path = "../programs/exchange", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-metrics = { path = "../metrics", version = "1.3.10" }
solana-net-utils = { path = "../net-utils", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
[dev-dependencies]
solana-local-cluster = { path = "../local-cluster", version = "1.3.9" }
solana-local-cluster = { path = "../local-cluster", version = "1.3.10" }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

View File

@@ -2,18 +2,18 @@
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-bench-streamer"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
[dependencies]
clap = "2.33.1"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-streamer = { path = "../streamer", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-net-utils = { path = "../net-utils", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-streamer = { path = "../streamer", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-net-utils = { path = "../net-utils", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

View File

@@ -2,7 +2,7 @@
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-bench-tps"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -14,23 +14,23 @@ log = "0.4.8"
rayon = "1.4.0"
serde_json = "1.0.56"
serde_yaml = "0.8.13"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-core = { path = "../core", version = "1.3.9" }
solana-genesis = { path = "../genesis", version = "1.3.9" }
solana-client = { path = "../client", version = "1.3.9" }
solana-faucet = { path = "../faucet", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-metrics = { path = "../metrics", version = "1.3.9" }
solana-measure = { path = "../measure", version = "1.3.9" }
solana-net-utils = { path = "../net-utils", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-core = { path = "../core", version = "1.3.10" }
solana-genesis = { path = "../genesis", version = "1.3.10" }
solana-client = { path = "../client", version = "1.3.10" }
solana-faucet = { path = "../faucet", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-metrics = { path = "../metrics", version = "1.3.10" }
solana-measure = { path = "../measure", version = "1.3.10" }
solana-net-utils = { path = "../net-utils", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
[dev-dependencies]
serial_test = "0.4.0"
serial_test_derive = "0.4.0"
solana-local-cluster = { path = "../local-cluster", version = "1.3.9" }
solana-local-cluster = { path = "../local-cluster", version = "1.3.10" }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-clap-utils"
version = "1.3.9"
version = "1.3.10"
description = "Solana utilities for the clap"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -11,8 +11,8 @@ edition = "2018"
[dependencies]
clap = "2.33.0"
rpassword = "4.0"
solana-remote-wallet = { path = "../remote-wallet", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-remote-wallet = { path = "../remote-wallet", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
thiserror = "1.0.20"
tiny-bip39 = "0.7.0"
url = "2.1.0"

View File

@@ -3,7 +3,7 @@ authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-cli-config"
description = "Blockchain, Rebuilt for Scale"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"

View File

@@ -3,7 +3,7 @@ authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-cli"
description = "Blockchain, Rebuilt for Scale"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -27,29 +27,29 @@ reqwest = { version = "0.10.6", default-features = false, features = ["blocking"
serde = "1.0.112"
serde_derive = "1.0.103"
serde_json = "1.0.56"
solana-account-decoder = { path = "../account-decoder", version = "1.3.9" }
solana-budget-program = { path = "../programs/budget", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-cli-config = { path = "../cli-config", version = "1.3.9" }
solana-client = { path = "../client", version = "1.3.9" }
solana-config-program = { path = "../programs/config", version = "1.3.9" }
solana-faucet = { path = "../faucet", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-net-utils = { path = "../net-utils", version = "1.3.9" }
solana-remote-wallet = { path = "../remote-wallet", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-stake-program = { path = "../programs/stake", version = "1.3.9" }
solana-transaction-status = { path = "../transaction-status", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-vote-program = { path = "../programs/vote", version = "1.3.9" }
solana-vote-signer = { path = "../vote-signer", version = "1.3.9" }
solana-account-decoder = { path = "../account-decoder", version = "1.3.10" }
solana-budget-program = { path = "../programs/budget", version = "1.3.10" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-cli-config = { path = "../cli-config", version = "1.3.10" }
solana-client = { path = "../client", version = "1.3.10" }
solana-config-program = { path = "../programs/config", version = "1.3.10" }
solana-faucet = { path = "../faucet", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-net-utils = { path = "../net-utils", version = "1.3.10" }
solana-remote-wallet = { path = "../remote-wallet", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-stake-program = { path = "../programs/stake", version = "1.3.10" }
solana-transaction-status = { path = "../transaction-status", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
solana-vote-program = { path = "../programs/vote", version = "1.3.10" }
solana-vote-signer = { path = "../vote-signer", version = "1.3.10" }
thiserror = "1.0.20"
url = "2.1.1"
[dev-dependencies]
solana-core = { path = "../core", version = "1.3.9" }
solana-budget-program = { path = "../programs/budget", version = "1.3.9" }
solana-core = { path = "../core", version = "1.3.10" }
solana-budget-program = { path = "../programs/budget", version = "1.3.10" }
tempfile = "3.1.0"
[[bin]]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-client"
version = "1.3.9"
version = "1.3.10"
description = "Solana Client"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -19,11 +19,11 @@ reqwest = { version = "0.10.6", default-features = false, features = ["blocking"
serde = "1.0.112"
serde_derive = "1.0.103"
serde_json = "1.0.56"
solana-account-decoder = { path = "../account-decoder", version = "1.3.9" }
solana-net-utils = { path = "../net-utils", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-transaction-status = { path = "../transaction-status", version = "1.3.9" }
solana-vote-program = { path = "../programs/vote", version = "1.3.9" }
solana-account-decoder = { path = "../account-decoder", version = "1.3.10" }
solana-net-utils = { path = "../net-utils", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-transaction-status = { path = "../transaction-status", version = "1.3.10" }
solana-vote-program = { path = "../programs/vote", version = "1.3.10" }
thiserror = "1.0"
tungstenite = "0.10.1"
url = "2.1.1"
@@ -32,7 +32,7 @@ url = "2.1.1"
assert_matches = "1.3.0"
jsonrpc-core = "14.2.0"
jsonrpc-http-server = "14.2.0"
solana-logger = { path = "../logger", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.10" }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

View File

@@ -1,7 +1,7 @@
[package]
name = "solana-core"
description = "Blockchain, Rebuilt for Scale"
version = "1.3.9"
version = "1.3.10"
documentation = "https://docs.rs/solana"
homepage = "https://solana.com/"
readme = "../README.md"
@@ -43,39 +43,39 @@ regex = "1.3.9"
serde = "1.0.112"
serde_derive = "1.0.103"
serde_json = "1.0.56"
solana-account-decoder = { path = "../account-decoder", version = "1.3.9" }
solana-banks-server = { path = "../banks-server", version = "1.3.9" }
solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "1.3.9" }
solana-budget-program = { path = "../programs/budget", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-client = { path = "../client", version = "1.3.9" }
solana-faucet = { path = "../faucet", version = "1.3.9" }
solana-genesis-programs = { path = "../genesis-programs", version = "1.3.9" }
solana-ledger = { path = "../ledger", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-merkle-tree = { path = "../merkle-tree", version = "1.3.9" }
solana-metrics = { path = "../metrics", version = "1.3.9" }
solana-measure = { path = "../measure", version = "1.3.9" }
solana-net-utils = { path = "../net-utils", version = "1.3.9" }
solana-perf = { path = "../perf", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-sdk-macro-frozen-abi = { path = "../sdk/macro-frozen-abi", version = "1.3.9" }
solana-stake-program = { path = "../programs/stake", version = "1.3.9" }
solana-storage-bigtable = { path = "../storage-bigtable", version = "1.3.9" }
solana-streamer = { path = "../streamer", version = "1.3.9" }
solana-sys-tuner = { path = "../sys-tuner", version = "1.3.9" }
solana-transaction-status = { path = "../transaction-status", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-vote-program = { path = "../programs/vote", version = "1.3.9" }
solana-vote-signer = { path = "../vote-signer", version = "1.3.9" }
solana-account-decoder = { path = "../account-decoder", version = "1.3.10" }
solana-banks-server = { path = "../banks-server", version = "1.3.10" }
solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "1.3.10" }
solana-budget-program = { path = "../programs/budget", version = "1.3.10" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-client = { path = "../client", version = "1.3.10" }
solana-faucet = { path = "../faucet", version = "1.3.10" }
solana-genesis-programs = { path = "../genesis-programs", version = "1.3.10" }
solana-ledger = { path = "../ledger", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-merkle-tree = { path = "../merkle-tree", version = "1.3.10" }
solana-metrics = { path = "../metrics", version = "1.3.10" }
solana-measure = { path = "../measure", version = "1.3.10" }
solana-net-utils = { path = "../net-utils", version = "1.3.10" }
solana-perf = { path = "../perf", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-sdk-macro-frozen-abi = { path = "../sdk/macro-frozen-abi", version = "1.3.10" }
solana-stake-program = { path = "../programs/stake", version = "1.3.10" }
solana-storage-bigtable = { path = "../storage-bigtable", version = "1.3.10" }
solana-streamer = { path = "../streamer", version = "1.3.10" }
solana-sys-tuner = { path = "../sys-tuner", version = "1.3.10" }
solana-transaction-status = { path = "../transaction-status", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
solana-vote-program = { path = "../programs/vote", version = "1.3.10" }
solana-vote-signer = { path = "../vote-signer", version = "1.3.10" }
spl-token-v2-0 = { package = "spl-token", version = "2.0.3", features = ["skip-no-mangle"] }
tempfile = "3.1.0"
thiserror = "1.0"
tokio_01 = { version = "0.1", package = "tokio" }
tokio_fs_01 = { version = "0.1", package = "tokio-fs" }
tokio_io_01 = { version = "0.1", package = "tokio-io" }
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.3.9" }
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.3.10" }
tokio = { version = "0.2.22", features = ["full"] }
trees = "0.2.1"
@@ -96,6 +96,9 @@ name = "banking_stage"
[[bench]]
name = "blockstore"
[[bench]]
name = "crds_gossip_pull"
[[bench]]
name = "gen_keys"

View File

@@ -0,0 +1,26 @@
#![feature(test)]
extern crate test;
use rand::{thread_rng, Rng};
use solana_core::crds_gossip_pull::CrdsFilter;
use solana_sdk::hash::{Hash, HASH_BYTES};
use test::Bencher;
#[bench]
fn bench_hash_as_u64(bencher: &mut Bencher) {
let mut rng = thread_rng();
let hashes: Vec<_> = (0..1000)
.map(|_| {
let mut buf = [0u8; HASH_BYTES];
rng.fill(&mut buf);
Hash::new(&buf)
})
.collect();
bencher.iter(|| {
hashes
.iter()
.map(CrdsFilter::hash_as_u64)
.collect::<Vec<_>>()
});
}

View File

@@ -421,7 +421,7 @@ impl ClusterInfo {
gossip.set_shred_version(me.my_shred_version());
}
me.insert_self();
me.push_self(&HashMap::new());
me.push_self(&HashMap::new(), None);
me
}
@@ -453,13 +453,17 @@ impl ClusterInfo {
self.insert_self()
}
fn push_self(&self, stakes: &HashMap<Pubkey, u64>) {
fn push_self(
&self,
stakes: &HashMap<Pubkey, u64>,
gossip_validators: Option<&HashSet<Pubkey>>,
) {
let now = timestamp();
self.my_contact_info.write().unwrap().wallclock = now;
let entry =
CrdsValue::new_signed(CrdsData::ContactInfo(self.my_contact_info()), &self.keypair);
let mut w_gossip = self.gossip.write().unwrap();
w_gossip.refresh_push_active_set(stakes);
w_gossip.refresh_push_active_set(stakes, gossip_validators);
w_gossip.process_push_message(&self.id(), vec![entry], now);
}
@@ -1363,13 +1367,17 @@ impl ClusterInfo {
messages
}
fn new_pull_requests(&self, stakes: &HashMap<Pubkey, u64>) -> Vec<(SocketAddr, Protocol)> {
fn new_pull_requests(
&self,
gossip_validators: Option<&HashSet<Pubkey>>,
stakes: &HashMap<Pubkey, u64>,
) -> Vec<(SocketAddr, Protocol)> {
let now = timestamp();
let mut pulls: Vec<_> = {
let r_gossip =
self.time_gossip_read_lock("new_pull_reqs", &self.stats.new_pull_requests);
r_gossip
.new_pull_request(now, stakes, MAX_BLOOM_SIZE)
.new_pull_request(now, gossip_validators, stakes, MAX_BLOOM_SIZE)
.ok()
.into_iter()
.filter_map(|(peer, filters, me)| {
@@ -1430,27 +1438,32 @@ impl ClusterInfo {
// Generate new push and pull requests
fn generate_new_gossip_requests(
&self,
gossip_validators: Option<&HashSet<Pubkey>>,
stakes: &HashMap<Pubkey, u64>,
generate_pull_requests: bool,
) -> Vec<(SocketAddr, Protocol)> {
let pulls: Vec<_> = if generate_pull_requests {
self.new_pull_requests(stakes)
let mut pulls: Vec<_> = if generate_pull_requests {
self.new_pull_requests(gossip_validators, stakes)
} else {
vec![]
};
let pushes: Vec<_> = self.new_push_requests();
vec![pulls, pushes].into_iter().flatten().collect()
let mut pushes: Vec<_> = self.new_push_requests();
pulls.append(&mut pushes);
pulls
}
/// At random pick a node and try to get updated changes from them
fn run_gossip(
&self,
gossip_validators: Option<&HashSet<Pubkey>>,
recycler: &PacketsRecycler,
stakes: &HashMap<Pubkey, u64>,
sender: &PacketSender,
generate_pull_requests: bool,
) -> Result<()> {
let reqs = self.generate_new_gossip_requests(&stakes, generate_pull_requests);
let reqs =
self.generate_new_gossip_requests(gossip_validators, &stakes, generate_pull_requests);
if !reqs.is_empty() {
let packets = to_packets_with_destination(recycler.clone(), &reqs);
sender.send(packets)?;
@@ -1519,6 +1532,7 @@ impl ClusterInfo {
self: Arc<Self>,
bank_forks: Option<Arc<RwLock<BankForks>>>,
sender: PacketSender,
gossip_validators: Option<HashSet<Pubkey>>,
exit: &Arc<AtomicBool>,
) -> JoinHandle<()> {
let exit = exit.clone();
@@ -1549,7 +1563,13 @@ impl ClusterInfo {
None => HashMap::new(),
};
let _ = self.run_gossip(&recycler, &stakes, &sender, generate_pull_requests);
let _ = self.run_gossip(
gossip_validators.as_ref(),
&recycler,
&stakes,
&sender,
generate_pull_requests,
);
if exit.load(Ordering::Relaxed) {
return;
}
@@ -1561,7 +1581,7 @@ impl ClusterInfo {
//TODO: possibly tune this parameter
//we saw a deadlock passing an self.read().unwrap().timeout into sleep
if start - last_push > CRDS_GOSSIP_PULL_CRDS_TIMEOUT_MS / 2 {
self.push_self(&stakes);
self.push_self(&stakes, gossip_validators.as_ref());
last_push = timestamp();
}
let elapsed = timestamp() - start;
@@ -2703,8 +2723,8 @@ mod tests {
.gossip
.write()
.unwrap()
.refresh_push_active_set(&HashMap::new());
let reqs = cluster_info.generate_new_gossip_requests(&HashMap::new(), true);
.refresh_push_active_set(&HashMap::new(), None);
let reqs = cluster_info.generate_new_gossip_requests(None, &HashMap::new(), true);
//assert none of the addrs are invalid.
reqs.iter().all(|(addr, _)| {
let res = ContactInfo::is_valid_address(addr);
@@ -2842,7 +2862,7 @@ mod tests {
.gossip
.write()
.unwrap()
.refresh_push_active_set(&HashMap::new());
.refresh_push_active_set(&HashMap::new(), None);
//check that all types of gossip messages are signed correctly
let (_, push_messages) = cluster_info
.gossip
@@ -2859,7 +2879,7 @@ mod tests {
.gossip
.write()
.unwrap()
.new_pull_request(timestamp(), &HashMap::new(), MAX_BLOOM_SIZE)
.new_pull_request(timestamp(), None, &HashMap::new(), MAX_BLOOM_SIZE)
.ok()
.unwrap();
assert!(val.verify());
@@ -3078,7 +3098,7 @@ mod tests {
let entrypoint_pubkey = Pubkey::new_rand();
let entrypoint = ContactInfo::new_localhost(&entrypoint_pubkey, timestamp());
cluster_info.set_entrypoint(entrypoint.clone());
let pulls = cluster_info.new_pull_requests(&HashMap::new());
let pulls = cluster_info.new_pull_requests(None, &HashMap::new());
assert_eq!(1, pulls.len() as u64);
match pulls.get(0) {
Some((addr, msg)) => {
@@ -3105,7 +3125,7 @@ mod tests {
vec![entrypoint_crdsvalue],
&timeouts,
);
let pulls = cluster_info.new_pull_requests(&HashMap::new());
let pulls = cluster_info.new_pull_requests(None, &HashMap::new());
assert_eq!(1, pulls.len() as u64);
assert_eq!(*cluster_info.entrypoint.read().unwrap(), Some(entrypoint));
}
@@ -3248,7 +3268,7 @@ mod tests {
// Pull request 1: `other_node` is present but `entrypoint` was just added (so it has a
// fresh timestamp). There should only be one pull request to `other_node`
let pulls = cluster_info.new_pull_requests(&stakes);
let pulls = cluster_info.new_pull_requests(None, &stakes);
assert_eq!(1, pulls.len() as u64);
assert_eq!(pulls.get(0).unwrap().0, other_node.gossip);
@@ -3261,14 +3281,14 @@ mod tests {
.as_mut()
.unwrap()
.wallclock = 0;
let pulls = cluster_info.new_pull_requests(&stakes);
let pulls = cluster_info.new_pull_requests(None, &stakes);
assert_eq!(2, pulls.len() as u64);
assert_eq!(pulls.get(0).unwrap().0, other_node.gossip);
assert_eq!(pulls.get(1).unwrap().0, entrypoint.gossip);
// Pull request 3: `other_node` is present and `entrypoint` was just pulled from. There should
// only be one pull request to `other_node`
let pulls = cluster_info.new_pull_requests(&stakes);
let pulls = cluster_info.new_pull_requests(None, &stakes);
assert_eq!(1, pulls.len() as u64);
assert_eq!(pulls.get(0).unwrap().0, other_node.gossip);
}

View File

@@ -115,10 +115,15 @@ impl CrdsGossip {
/// refresh the push active set
/// * ratio - number of actives to rotate
pub fn refresh_push_active_set(&mut self, stakes: &HashMap<Pubkey, u64>) {
pub fn refresh_push_active_set(
&mut self,
stakes: &HashMap<Pubkey, u64>,
gossip_validators: Option<&HashSet<Pubkey>>,
) {
self.push.refresh_push_active_set(
&self.crds,
stakes,
gossip_validators,
&self.id,
self.shred_version,
self.pull.pull_request_time.len(),
@@ -130,6 +135,7 @@ impl CrdsGossip {
pub fn new_pull_request(
&self,
now: u64,
gossip_validators: Option<&HashSet<Pubkey>>,
stakes: &HashMap<Pubkey, u64>,
bloom_size: usize,
) -> Result<(Pubkey, Vec<CrdsFilter>, CrdsValue), CrdsGossipError> {
@@ -138,6 +144,7 @@ impl CrdsGossip {
&self.id,
self.shred_version,
now,
gossip_validators,
stakes,
bloom_size,
)
@@ -271,7 +278,7 @@ mod test {
0,
)
.unwrap();
crds_gossip.refresh_push_active_set(&HashMap::new());
crds_gossip.refresh_push_active_set(&HashMap::new(), None);
let now = timestamp();
//incorrect dest
let mut res = crds_gossip.process_prune_msg(

View File

@@ -22,6 +22,7 @@ use solana_sdk::pubkey::Pubkey;
use std::cmp;
use std::collections::VecDeque;
use std::collections::{HashMap, HashSet};
use std::convert::TryInto;
pub const CRDS_GOSSIP_PULL_CRDS_TIMEOUT_MS: u64 = 15000;
// The maximum age of a value received over pull responses
@@ -29,13 +30,23 @@ pub const CRDS_GOSSIP_PULL_MSG_TIMEOUT_MS: u64 = 60000;
pub const FALSE_RATE: f64 = 0.1f64;
pub const KEYS: f64 = 8f64;
#[derive(Serialize, Deserialize, Default, Clone, Debug, PartialEq, AbiExample)]
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, AbiExample)]
pub struct CrdsFilter {
pub filter: Bloom<Hash>,
mask: u64,
mask_bits: u32,
}
impl Default for CrdsFilter {
fn default() -> Self {
CrdsFilter {
filter: Bloom::default(),
mask: !0u64,
mask_bits: 0u32,
}
}
}
impl solana_sdk::sanitize::Sanitize for CrdsFilter {
fn sanitize(&self) -> std::result::Result<(), solana_sdk::sanitize::SanitizeError> {
self.filter.sanitize()?;
@@ -74,12 +85,8 @@ impl CrdsFilter {
((num_items / max_items).log2().ceil()).max(0.0) as u32
}
pub fn hash_as_u64(item: &Hash) -> u64 {
let arr = item.as_ref();
let mut accum = 0;
for (i, val) in arr.iter().enumerate().take(8) {
accum |= (u64::from(*val)) << (i * 8) as u64;
}
accum
let buf = item.as_ref()[..8].try_into().unwrap();
u64::from_le_bytes(buf)
}
pub fn test_mask_u64(&self, item: u64, ones: u64) -> bool {
let bits = item | ones;
@@ -178,10 +185,18 @@ impl CrdsGossipPull {
self_id: &Pubkey,
self_shred_version: u16,
now: u64,
gossip_validators: Option<&HashSet<Pubkey>>,
stakes: &HashMap<Pubkey, u64>,
bloom_size: usize,
) -> Result<(Pubkey, Vec<CrdsFilter>, CrdsValue), CrdsGossipError> {
let options = self.pull_options(crds, &self_id, self_shred_version, now, stakes);
let options = self.pull_options(
crds,
&self_id,
self_shred_version,
now,
gossip_validators,
stakes,
);
if options.is_empty() {
return Err(CrdsGossipError::NoPeers);
}
@@ -200,6 +215,7 @@ impl CrdsGossipPull {
self_id: &Pubkey,
self_shred_version: u16,
now: u64,
gossip_validators: Option<&HashSet<Pubkey>>,
stakes: &HashMap<Pubkey, u64>,
) -> Vec<(f32, &'a ContactInfo)> {
crds.table
@@ -209,6 +225,8 @@ impl CrdsGossipPull {
v.id != *self_id
&& ContactInfo::is_valid_address(&v.gossip)
&& (self_shred_version == 0 || self_shred_version == v.shred_version)
&& gossip_validators
.map_or(true, |gossip_validators| gossip_validators.contains(&v.id))
})
.map(|item| {
let max_weight = f32::from(u16::max_value()) - 1.0;
@@ -543,6 +561,45 @@ mod test {
use solana_sdk::hash::{hash, HASH_BYTES};
use solana_sdk::packet::PACKET_DATA_SIZE;
#[test]
fn test_hash_as_u64() {
let arr: Vec<u8> = (0..HASH_BYTES).map(|i| i as u8 + 1).collect();
let hash = Hash::new(&arr);
assert_eq!(CrdsFilter::hash_as_u64(&hash), 0x807060504030201);
}
#[test]
fn test_hash_as_u64_random() {
fn hash_as_u64_bitops(hash: &Hash) -> u64 {
let mut out = 0;
for (i, val) in hash.as_ref().iter().enumerate().take(8) {
out |= (u64::from(*val)) << (i * 8) as u64;
}
out
}
let mut rng = thread_rng();
for _ in 0..100 {
let mut buf = [0u8; HASH_BYTES];
rng.fill(&mut buf);
let hash = Hash::new(&buf);
assert_eq!(CrdsFilter::hash_as_u64(&hash), hash_as_u64_bitops(&hash));
}
}
#[test]
fn test_crds_filter_default() {
let filter = CrdsFilter::default();
let mask = CrdsFilter::compute_mask(0, filter.mask_bits);
assert_eq!(filter.mask, mask);
let mut rng = thread_rng();
for _ in 0..10 {
let mut buf = [0u8; HASH_BYTES];
rng.fill(&mut buf);
let hash = Hash::new(&buf);
assert!(filter.test_mask(&hash));
}
}
#[test]
fn test_new_pull_with_stakes() {
let mut crds = Crds::default();
@@ -563,7 +620,7 @@ mod test {
stakes.insert(id, i * 100);
}
let now = 1024;
let mut options = node.pull_options(&crds, &me.label().pubkey(), 0, now, &stakes);
let mut options = node.pull_options(&crds, &me.label().pubkey(), 0, now, None, &stakes);
assert!(!options.is_empty());
options.sort_by(|(weight_l, _), (weight_r, _)| weight_r.partial_cmp(weight_l).unwrap());
// check that the highest stake holder is also the heaviest weighted.
@@ -613,7 +670,7 @@ mod test {
// shred version 123 should ignore nodes with versions 0 and 456
let options = node
.pull_options(&crds, &me.label().pubkey(), 123, 0, &stakes)
.pull_options(&crds, &me.label().pubkey(), 123, 0, None, &stakes)
.iter()
.map(|(_, c)| c.id)
.collect::<Vec<_>>();
@@ -623,7 +680,7 @@ mod test {
// spy nodes will see all
let options = node
.pull_options(&crds, &spy.label().pubkey(), 0, 0, &stakes)
.pull_options(&crds, &spy.label().pubkey(), 0, 0, None, &stakes)
.iter()
.map(|(_, c)| c.id)
.collect::<Vec<_>>();
@@ -633,6 +690,65 @@ mod test {
assert!(options.contains(&node_456.pubkey()));
}
#[test]
fn test_pulls_only_from_allowed() {
let mut crds = Crds::default();
let stakes = HashMap::new();
let node = CrdsGossipPull::default();
let gossip = socketaddr!("127.0.0.1:1234");
let me = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo {
id: Pubkey::new_rand(),
gossip,
..ContactInfo::default()
}));
let node_123 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo {
id: Pubkey::new_rand(),
gossip,
..ContactInfo::default()
}));
crds.insert(me.clone(), 0).unwrap();
crds.insert(node_123.clone(), 0).unwrap();
// Empty gossip_validators -- will pull from nobody
let mut gossip_validators = HashSet::new();
let options = node.pull_options(
&crds,
&me.label().pubkey(),
0,
0,
Some(&gossip_validators),
&stakes,
);
assert!(options.is_empty());
// Unknown pubkey in gossip_validators -- will pull from nobody
gossip_validators.insert(Pubkey::new_rand());
let options = node.pull_options(
&crds,
&me.label().pubkey(),
0,
0,
Some(&gossip_validators),
&stakes,
);
assert!(options.is_empty());
// node_123 pubkey in gossip_validators -- will pull from it
gossip_validators.insert(node_123.pubkey());
let options = node.pull_options(
&crds,
&me.label().pubkey(),
0,
0,
Some(&gossip_validators),
&stakes,
);
assert_eq!(options.len(), 1);
assert_eq!(options[0].1.id, node_123.pubkey());
}
#[test]
fn test_crds_filter_set_get() {
let mut crds_filter_set =
@@ -687,13 +803,13 @@ mod test {
let id = entry.label().pubkey();
let node = CrdsGossipPull::default();
assert_eq!(
node.new_pull_request(&crds, &id, 0, 0, &HashMap::new(), PACKET_DATA_SIZE),
node.new_pull_request(&crds, &id, 0, 0, None, &HashMap::new(), PACKET_DATA_SIZE),
Err(CrdsGossipError::NoPeers)
);
crds.insert(entry.clone(), 0).unwrap();
assert_eq!(
node.new_pull_request(&crds, &id, 0, 0, &HashMap::new(), PACKET_DATA_SIZE),
node.new_pull_request(&crds, &id, 0, 0, None, &HashMap::new(), PACKET_DATA_SIZE),
Err(CrdsGossipError::NoPeers)
);
@@ -702,7 +818,7 @@ mod test {
0,
)));
crds.insert(new.clone(), 0).unwrap();
let req = node.new_pull_request(&crds, &id, 0, 0, &HashMap::new(), PACKET_DATA_SIZE);
let req = node.new_pull_request(&crds, &id, 0, 0, None, &HashMap::new(), PACKET_DATA_SIZE);
let (to, _, self_info) = req.unwrap();
assert_eq!(to, new.label().pubkey());
assert_eq!(self_info, entry);
@@ -739,6 +855,7 @@ mod test {
&node_pubkey,
0,
u64::max_value(),
None,
&HashMap::new(),
PACKET_DATA_SIZE,
);
@@ -768,6 +885,7 @@ mod test {
&node_pubkey,
0,
0,
None,
&HashMap::new(),
PACKET_DATA_SIZE,
);
@@ -828,6 +946,7 @@ mod test {
&node_pubkey,
0,
0,
None,
&HashMap::new(),
PACKET_DATA_SIZE,
);
@@ -902,6 +1021,7 @@ mod test {
&node_pubkey,
0,
0,
None,
&HashMap::new(),
PACKET_DATA_SIZE,
);

View File

@@ -280,6 +280,7 @@ impl CrdsGossipPush {
&mut self,
crds: &Crds,
stakes: &HashMap<Pubkey, u64>,
gossip_validators: Option<&HashSet<Pubkey>>,
self_id: &Pubkey,
self_shred_version: u16,
network_size: usize,
@@ -288,7 +289,13 @@ impl CrdsGossipPush {
let need = Self::compute_need(self.num_active, self.active_set.len(), ratio);
let mut new_items = HashMap::new();
let options: Vec<_> = self.push_options(crds, &self_id, self_shred_version, stakes);
let options: Vec<_> = self.push_options(
crds,
&self_id,
self_shred_version,
stakes,
gossip_validators,
);
if options.is_empty() {
return;
}
@@ -336,6 +343,7 @@ impl CrdsGossipPush {
self_id: &Pubkey,
self_shred_version: u16,
stakes: &HashMap<Pubkey, u64>,
gossip_validators: Option<&HashSet<Pubkey>>,
) -> Vec<(f32, &'a ContactInfo)> {
crds.table
.values()
@@ -345,6 +353,9 @@ impl CrdsGossipPush {
info.id != *self_id
&& ContactInfo::is_valid_address(&info.gossip)
&& self_shred_version == info.shred_version
&& gossip_validators.map_or(true, |gossip_validators| {
gossip_validators.contains(&info.id)
})
})
.map(|(info, value)| {
let max_weight = f32::from(u16::max_value()) - 1.0;
@@ -552,7 +563,7 @@ mod test {
)));
assert_eq!(crds.insert(value1.clone(), 0), Ok(None));
push.refresh_push_active_set(&crds, &HashMap::new(), &Pubkey::default(), 0, 1, 1);
push.refresh_push_active_set(&crds, &HashMap::new(), None, &Pubkey::default(), 0, 1, 1);
assert!(push.active_set.get(&value1.label().pubkey()).is_some());
let value2 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
@@ -562,7 +573,7 @@ mod test {
assert!(push.active_set.get(&value2.label().pubkey()).is_none());
assert_eq!(crds.insert(value2.clone(), 0), Ok(None));
for _ in 0..30 {
push.refresh_push_active_set(&crds, &HashMap::new(), &Pubkey::default(), 0, 1, 1);
push.refresh_push_active_set(&crds, &HashMap::new(), None, &Pubkey::default(), 0, 1, 1);
if push.active_set.get(&value2.label().pubkey()).is_some() {
break;
}
@@ -575,7 +586,7 @@ mod test {
));
assert_eq!(crds.insert(value2.clone(), 0), Ok(None));
}
push.refresh_push_active_set(&crds, &HashMap::new(), &Pubkey::default(), 0, 1, 1);
push.refresh_push_active_set(&crds, &HashMap::new(), None, &Pubkey::default(), 0, 1, 1);
assert_eq!(push.active_set.len(), push.num_active);
}
#[test]
@@ -593,7 +604,7 @@ mod test {
crds.insert(peer.clone(), time).unwrap();
stakes.insert(id, i * 100);
}
let mut options = push.push_options(&crds, &Pubkey::default(), 0, &stakes);
let mut options = push.push_options(&crds, &Pubkey::default(), 0, &stakes, None);
assert!(!options.is_empty());
options.sort_by(|(weight_l, _), (weight_r, _)| weight_r.partial_cmp(weight_l).unwrap());
// check that the highest stake holder is also the heaviest weighted.
@@ -643,7 +654,7 @@ mod test {
// shred version 123 should ignore nodes with versions 0 and 456
let options = node
.push_options(&crds, &me.label().pubkey(), 123, &stakes)
.push_options(&crds, &me.label().pubkey(), 123, &stakes, None)
.iter()
.map(|(_, c)| c.id)
.collect::<Vec<_>>();
@@ -653,12 +664,71 @@ mod test {
// spy nodes should not push to people on different shred versions
let options = node
.push_options(&crds, &spy.label().pubkey(), 0, &stakes)
.push_options(&crds, &spy.label().pubkey(), 0, &stakes, None)
.iter()
.map(|(_, c)| c.id)
.collect::<Vec<_>>();
assert!(options.is_empty());
}
#[test]
fn test_pushes_only_to_allowed() {
let mut crds = Crds::default();
let stakes = HashMap::new();
let node = CrdsGossipPush::default();
let gossip = socketaddr!("127.0.0.1:1234");
let me = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo {
id: Pubkey::new_rand(),
gossip,
..ContactInfo::default()
}));
let node_123 = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo {
id: Pubkey::new_rand(),
gossip,
..ContactInfo::default()
}));
crds.insert(me.clone(), 0).unwrap();
crds.insert(node_123.clone(), 0).unwrap();
// Unknown pubkey in gossip_validators -- will push to nobody
let mut gossip_validators = HashSet::new();
let options = node.push_options(
&crds,
&me.label().pubkey(),
0,
&stakes,
Some(&gossip_validators),
);
assert!(options.is_empty());
// Unknown pubkey in gossip_validators -- will push to nobody
gossip_validators.insert(Pubkey::new_rand());
let options = node.push_options(
&crds,
&me.label().pubkey(),
0,
&stakes,
Some(&gossip_validators),
);
assert!(options.is_empty());
// node_123 pubkey in gossip_validators -- will push to it
gossip_validators.insert(node_123.pubkey());
let options = node.push_options(
&crds,
&me.label().pubkey(),
0,
&stakes,
Some(&gossip_validators),
);
assert_eq!(options.len(), 1);
assert_eq!(options[0].1.id, node_123.pubkey());
}
#[test]
fn test_new_push_messages() {
let mut crds = Crds::default();
@@ -668,7 +738,7 @@ mod test {
0,
)));
assert_eq!(crds.insert(peer.clone(), 0), Ok(None));
push.refresh_push_active_set(&crds, &HashMap::new(), &Pubkey::default(), 0, 1, 1);
push.refresh_push_active_set(&crds, &HashMap::new(), None, &Pubkey::default(), 0, 1, 1);
let new_msg = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
@@ -705,7 +775,7 @@ mod test {
push.process_push_message(&mut crds, &Pubkey::default(), peer_3.clone(), 0),
Ok(None)
);
push.refresh_push_active_set(&crds, &HashMap::new(), &Pubkey::default(), 0, 1, 1);
push.refresh_push_active_set(&crds, &HashMap::new(), None, &Pubkey::default(), 0, 1, 1);
// push 3's contact info to 1 and 2 and 3
let new_msg = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
@@ -728,7 +798,7 @@ mod test {
0,
)));
assert_eq!(crds.insert(peer.clone(), 0), Ok(None));
push.refresh_push_active_set(&crds, &HashMap::new(), &Pubkey::default(), 0, 1, 1);
push.refresh_push_active_set(&crds, &HashMap::new(), None, &Pubkey::default(), 0, 1, 1);
let new_msg = CrdsValue::new_unsigned(CrdsData::ContactInfo(ContactInfo::new_localhost(
&Pubkey::new_rand(),
@@ -755,7 +825,7 @@ mod test {
0,
)));
assert_eq!(crds.insert(peer, 0), Ok(None));
push.refresh_push_active_set(&crds, &HashMap::new(), &Pubkey::default(), 0, 1, 1);
push.refresh_push_active_set(&crds, &HashMap::new(), None, &Pubkey::default(), 0, 1, 1);
let mut ci = ContactInfo::new_localhost(&Pubkey::new_rand(), 0);
ci.wallclock = 1;

View File

@@ -6,15 +6,22 @@ use rand::{thread_rng, Rng};
use solana_client::thin_client::{create_client, ThinClient};
use solana_perf::recycler::Recycler;
use solana_runtime::bank_forks::BankForks;
use solana_sdk::pubkey::Pubkey;
use solana_sdk::signature::{Keypair, Signer};
use solana_sdk::{
pubkey::Pubkey,
signature::{Keypair, Signer},
};
use solana_streamer::streamer;
use std::net::{IpAddr, Ipv4Addr, SocketAddr, TcpListener, UdpSocket};
use std::sync::atomic::{AtomicBool, Ordering};
use std::sync::mpsc::channel;
use std::sync::{Arc, RwLock};
use std::thread::{self, sleep, JoinHandle};
use std::time::{Duration, Instant};
use std::{
collections::HashSet,
net::{IpAddr, Ipv4Addr, SocketAddr, TcpListener, UdpSocket},
sync::{
atomic::{AtomicBool, Ordering},
mpsc::channel,
{Arc, RwLock},
},
thread::{self, sleep, JoinHandle},
time::{Duration, Instant},
};
pub struct GossipService {
thread_hdls: Vec<JoinHandle<()>>,
@@ -25,6 +32,7 @@ impl GossipService {
cluster_info: &Arc<ClusterInfo>,
bank_forks: Option<Arc<RwLock<BankForks>>>,
gossip_socket: UdpSocket,
gossip_validators: Option<HashSet<Pubkey>>,
exit: &Arc<AtomicBool>,
) -> Self {
let (request_sender, request_receiver) = channel();
@@ -50,7 +58,13 @@ impl GossipService {
response_sender.clone(),
exit,
);
let t_gossip = ClusterInfo::gossip(cluster_info.clone(), bank_forks, response_sender, exit);
let t_gossip = ClusterInfo::gossip(
cluster_info.clone(),
bank_forks,
response_sender,
gossip_validators,
exit,
);
let thread_hdls = vec![t_receiver, t_responder, t_listen, t_gossip];
Self { thread_hdls }
}
@@ -265,7 +279,7 @@ fn make_gossip_node(
cluster_info.set_entrypoint(ContactInfo::new_gossip_entry_point(entrypoint));
}
let cluster_info = Arc::new(cluster_info);
let gossip_service = GossipService::new(&cluster_info, None, gossip_socket, &exit);
let gossip_service = GossipService::new(&cluster_info, None, gossip_socket, None, &exit);
(gossip_service, ip_echo, cluster_info)
}
@@ -284,7 +298,7 @@ mod tests {
let tn = Node::new_localhost();
let cluster_info = ClusterInfo::new_with_invalid_keypair(tn.info.clone());
let c = Arc::new(cluster_info);
let d = GossipService::new(&c, None, tn.sockets.gossip, &exit);
let d = GossipService::new(&c, None, tn.sockets.gossip, None, &exit);
exit.store(true, Ordering::Relaxed);
d.join().unwrap();
}

View File

@@ -18,7 +18,7 @@ pub fn calculate_non_circulating_supply(bank: &Arc<Bank>) -> NonCirculatingSuppl
let withdraw_authority_list = withdraw_authority();
let clock = bank.clock();
let stake_accounts = bank.get_program_accounts(Some(&solana_stake_program::id()));
let stake_accounts = bank.get_program_accounts(&solana_stake_program::id());
for (pubkey, account) in stake_accounts.iter() {
let stake_account = StakeState::from(&account).unwrap_or_default();
match stake_account {

View File

@@ -168,7 +168,7 @@ impl ForkProgress {
num_dropped_blocks_on_fork: u64,
) -> Self {
let validator_fork_info = {
if bank.collector_id() == my_pubkey && bank.slot() > 0 {
if bank.collector_id() == my_pubkey {
let stake = bank.epoch_vote_account_stake(voting_pubkey);
Some(ValidatorStakeInfo::new(
*voting_pubkey,

View File

@@ -1583,13 +1583,13 @@ impl ReplayStage {
loop {
// These cases mean confirmation of propagation on any earlier
// leader blocks must have been reached
if current_leader_slot == None || current_leader_slot.unwrap() <= root {
if current_leader_slot == None || current_leader_slot.unwrap() < root {
break;
}
let leader_propagated_stats = progress
.get_propagated_stats_mut(current_leader_slot.unwrap())
.expect("current_leader_slot > root, so must exist in the progress map");
.expect("current_leader_slot >= root, so must exist in the progress map");
// If a descendant has reached propagation threshold, then
// all its ancestor banks have also reached propagation
@@ -3278,6 +3278,10 @@ pub(crate) mod tests {
let stake_per_validator = 10_000;
let (mut bank_forks, mut progress_map, _) =
initialize_state(&keypairs, stake_per_validator);
progress_map
.get_propagated_stats_mut(0)
.unwrap()
.is_leader_slot = true;
bank_forks.set_root(0, &None, None);
let total_epoch_stake = bank_forks.root_bank().total_epoch_stake();
@@ -3355,6 +3359,10 @@ pub(crate) mod tests {
let stake_per_validator = 10_000;
let (mut bank_forks, mut progress_map, _) =
initialize_state(&keypairs, stake_per_validator);
progress_map
.get_propagated_stats_mut(0)
.unwrap()
.is_leader_slot = true;
bank_forks.set_root(0, &None, None);
let total_epoch_stake = num_validators as u64 * stake_per_validator;
@@ -3687,6 +3695,70 @@ pub(crate) mod tests {
}
}
#[test]
fn test_leader_snapshot_restart_propagation() {
let ReplayBlockstoreComponents {
validator_voting_keys,
mut progress,
bank_forks,
leader_schedule_cache,
..
} = replay_blockstore_components();
let root_bank = bank_forks.read().unwrap().root_bank().clone();
let my_pubkey = leader_schedule_cache
.slot_leader_at(root_bank.slot(), Some(&root_bank))
.unwrap();
// Check that we are the leader of the root bank
assert!(
progress
.get_propagated_stats(root_bank.slot())
.unwrap()
.is_leader_slot
);
let ancestors = bank_forks.read().unwrap().ancestors();
// Freeze bank so it shows up in frozen banks
root_bank.freeze();
let mut frozen_banks: Vec<_> = bank_forks
.read()
.unwrap()
.frozen_banks()
.values()
.cloned()
.collect();
// Compute bank stats, make sure vote is propagated back to starting root bank
let vote_tracker = VoteTracker::default();
// Add votes
for vote_key in validator_voting_keys.values() {
vote_tracker.insert_vote(root_bank.slot(), Arc::new(*vote_key));
}
assert!(!progress.is_propagated(root_bank.slot()));
// Update propagation status
let tower = Tower::new_for_tests(0, 0.67);
ReplayStage::compute_bank_stats(
&my_pubkey,
&ancestors,
&mut frozen_banks,
&tower,
&mut progress,
&vote_tracker,
&ClusterSlots::default(),
&bank_forks,
&mut PubkeyReferences::default(),
&mut HeaviestSubtreeForkChoice::new_from_bank_forks(&bank_forks.read().unwrap()),
&mut BankWeightForkChoice::default(),
);
// Check status is true
assert!(progress.is_propagated(root_bank.slot()));
}
fn setup_forks() -> (RwLock<BankForks>, ProgressMap) {
/*
Build fork structure:

View File

@@ -1308,7 +1308,7 @@ fn get_filtered_program_accounts(
program_id: &Pubkey,
filters: Vec<RpcFilterType>,
) -> impl Iterator<Item = (Pubkey, Account)> {
bank.get_program_accounts(Some(&program_id))
bank.get_program_accounts(&program_id)
.into_iter()
.filter(move |(_, account)| {
filters.iter().all(|filter_type| match filter_type {

View File

@@ -293,7 +293,7 @@ fn filter_signature_result(
fn filter_program_results(
accounts: Vec<(Pubkey, Account)>,
_program_id: &Pubkey,
program_id: &Pubkey,
last_notified_slot: Slot,
config: Option<ProgramConfig>,
bank: Option<Arc<Bank>>,
@@ -301,24 +301,27 @@ fn filter_program_results(
let config = config.unwrap_or_default();
let encoding = config.encoding.unwrap_or(UiAccountEncoding::Binary);
let filters = config.filters;
let accounts_is_empty = accounts.is_empty();
let keyed_accounts = accounts.into_iter().filter(move |(_, account)| {
filters.iter().all(|filter_type| match filter_type {
RpcFilterType::DataSize(size) => account.data.len() as u64 == *size,
RpcFilterType::Memcmp(compare) => compare.bytes_match(&account.data),
})
});
let accounts: Box<dyn Iterator<Item = RpcKeyedAccount>> =
if encoding == UiAccountEncoding::JsonParsed {
let bank = bank.unwrap(); // If !accounts.is_empty(), bank must be Some
Box::new(get_parsed_token_accounts(bank, keyed_accounts))
} else {
Box::new(
keyed_accounts.map(move |(pubkey, account)| RpcKeyedAccount {
pubkey: pubkey.to_string(),
account: UiAccount::encode(&pubkey, account, encoding.clone(), None, None),
}),
)
};
let accounts: Box<dyn Iterator<Item = RpcKeyedAccount>> = if program_id == &spl_token_id_v2_0()
&& encoding == UiAccountEncoding::JsonParsed
&& !accounts_is_empty
{
let bank = bank.unwrap(); // If !accounts_is_empty, bank must be Some
Box::new(get_parsed_token_accounts(bank, keyed_accounts))
} else {
Box::new(
keyed_accounts.map(move |(pubkey, account)| RpcKeyedAccount {
pubkey: pubkey.to_string(),
account: UiAccount::encode(&pubkey, account, encoding.clone(), None, None),
}),
)
};
(accounts, last_notified_slot)
}

View File

@@ -55,7 +55,7 @@ use solana_sdk::{
use solana_vote_program::vote_state::VoteState;
use std::{
collections::HashSet,
net::{IpAddr, Ipv4Addr, SocketAddr},
net::SocketAddr,
path::{Path, PathBuf},
process,
sync::atomic::{AtomicBool, Ordering},
@@ -76,7 +76,7 @@ pub struct ValidatorConfig {
pub voting_disabled: bool,
pub account_paths: Vec<PathBuf>,
pub rpc_config: JsonRpcConfig,
pub rpc_ports: Option<(u16, u16, u16)>, // (JsonRpc, JsonRpcPubSub, Banks)
pub rpc_addrs: Option<(SocketAddr, SocketAddr, SocketAddr)>, // (JsonRpc, JsonRpcPubSub, Banks)
pub snapshot_config: Option<SnapshotConfig>,
pub max_ledger_shreds: Option<u64>,
pub broadcast_stage_type: BroadcastStageType,
@@ -86,6 +86,7 @@ pub struct ValidatorConfig {
pub new_hard_forks: Option<Vec<Slot>>,
pub trusted_validators: Option<HashSet<Pubkey>>, // None = trust all
pub repair_validators: Option<HashSet<Pubkey>>, // None = repair from all
pub gossip_validators: Option<HashSet<Pubkey>>, // None = gossip with all
pub halt_on_trusted_validators_accounts_hash_mismatch: bool,
pub accounts_hash_fault_injection_slots: u64, // 0 = no fault injection
pub frozen_accounts: Vec<Pubkey>,
@@ -106,7 +107,7 @@ impl Default for ValidatorConfig {
max_ledger_shreds: None,
account_paths: Vec::new(),
rpc_config: JsonRpcConfig::default(),
rpc_ports: None,
rpc_addrs: None,
snapshot_config: None,
broadcast_stage_type: BroadcastStageType::Standard,
enable_partition: None,
@@ -115,6 +116,7 @@ impl Default for ValidatorConfig {
new_hard_forks: None,
trusted_validators: None,
repair_validators: None,
gossip_validators: None,
halt_on_trusted_validators_accounts_hash_mismatch: false,
accounts_hash_fault_injection_slots: 0,
frozen_accounts: vec![],
@@ -345,20 +347,20 @@ impl Validator {
let rpc_override_health_check = Arc::new(AtomicBool::new(false));
let rpc_service = config
.rpc_ports
.map(|(rpc_port, rpc_pubsub_port, rpc_banks_port)| {
.rpc_addrs
.map(|(rpc_addr, rpc_pubsub_addr, rpc_banks_addr)| {
if ContactInfo::is_valid_address(&node.info.rpc) {
assert!(ContactInfo::is_valid_address(&node.info.rpc_pubsub));
assert_eq!(rpc_port, node.info.rpc.port());
assert_eq!(rpc_pubsub_port, node.info.rpc_pubsub.port());
assert_eq!(rpc_banks_port, node.info.rpc_banks.port());
assert_eq!(rpc_addr.port(), node.info.rpc.port());
assert_eq!(rpc_pubsub_addr.port(), node.info.rpc_pubsub.port());
assert_eq!(rpc_banks_addr.port(), node.info.rpc_banks.port());
} else {
assert!(!ContactInfo::is_valid_address(&node.info.rpc_pubsub));
}
let tpu_address = cluster_info.my_contact_info().tpu;
(
JsonRpcService::new(
SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), rpc_port),
rpc_addr,
config.rpc_config.clone(),
config.snapshot_config.clone(),
bank_forks.clone(),
@@ -372,13 +374,9 @@ impl Validator {
config.trusted_validators.clone(),
rpc_override_health_check.clone(),
),
PubSubService::new(
&subscriptions,
SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), rpc_pubsub_port),
&exit,
),
PubSubService::new(&subscriptions, rpc_pubsub_addr, &exit),
RpcBanksService::new(
SocketAddr::new(IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), rpc_banks_port),
rpc_banks_addr,
tpu_address,
&bank_forks,
&block_commitment_cache,
@@ -393,6 +391,7 @@ impl Validator {
&cluster_info,
Some(bank_forks.clone()),
node.sockets.gossip,
config.gossip_validators.clone(),
&exit,
);
@@ -658,7 +657,7 @@ fn new_banks_from_ledger(
let blockstore = Arc::new(blockstore);
let transaction_history_services =
if config.rpc_ports.is_some() && config.rpc_config.enable_rpc_transaction_history {
if config.rpc_addrs.is_some() && config.rpc_config.enable_rpc_transaction_history {
initialize_rpc_transaction_history_services(blockstore.clone(), exit)
} else {
TransactionHistoryServices::default()
@@ -902,11 +901,7 @@ impl TestValidator {
let (ledger_path, blockhash) = create_new_tmp_ledger!(&genesis_config);
let config = ValidatorConfig {
rpc_ports: Some((
node.info.rpc.port(),
node.info.rpc_pubsub.port(),
node.info.rpc_banks.port(),
)),
rpc_addrs: Some((node.info.rpc, node.info.rpc_pubsub, node.info.rpc_banks)),
..ValidatorConfig::default()
};
let vote_pubkey = voting_keypair.pubkey();
@@ -1072,10 +1067,10 @@ mod tests {
let voting_keypair = Arc::new(Keypair::new());
let config = ValidatorConfig {
rpc_ports: Some((
validator_node.info.rpc.port(),
validator_node.info.rpc_pubsub.port(),
validator_node.info.rpc_banks.port(),
rpc_addrs: Some((
validator_node.info.rpc,
validator_node.info.rpc_pubsub,
validator_node.info.rpc_banks,
)),
..ValidatorConfig::default()
};
@@ -1147,10 +1142,10 @@ mod tests {
ledger_paths.push(validator_ledger_path.clone());
let vote_account_keypair = Keypair::new();
let config = ValidatorConfig {
rpc_ports: Some((
validator_node.info.rpc.port(),
validator_node.info.rpc_pubsub.port(),
validator_node.info.rpc_banks.port(),
rpc_addrs: Some((
validator_node.info.rpc,
validator_node.info.rpc_pubsub,
validator_node.info.rpc_banks,
)),
..ValidatorConfig::default()
};

View File

@@ -222,7 +222,7 @@ fn network_simulator(network: &mut Network, max_convergance: f64) {
network_values.par_iter().for_each(|node| {
node.lock()
.unwrap()
.refresh_push_active_set(&HashMap::new());
.refresh_push_active_set(&HashMap::new(), None);
});
let mut total_bytes = bytes_tx;
for second in 1..num {
@@ -361,7 +361,7 @@ fn network_run_push(network: &mut Network, start: usize, end: usize) -> (usize,
network_values.par_iter().for_each(|node| {
node.lock()
.unwrap()
.refresh_push_active_set(&HashMap::new());
.refresh_push_active_set(&HashMap::new(), None);
});
}
total = network_values
@@ -408,7 +408,7 @@ fn network_run_pull(
.filter_map(|from| {
from.lock()
.unwrap()
.new_pull_request(now, &HashMap::new(), cluster_info::MAX_BLOOM_SIZE)
.new_pull_request(now, None, &HashMap::new(), cluster_info::MAX_BLOOM_SIZE)
.ok()
})
.collect()
@@ -581,7 +581,7 @@ fn test_prune_errors() {
0,
)
.unwrap();
crds_gossip.refresh_push_active_set(&HashMap::new());
crds_gossip.refresh_push_active_set(&HashMap::new(), None);
let now = timestamp();
//incorrect dest
let mut res = crds_gossip.process_prune_msg(

View File

@@ -19,7 +19,8 @@ fn test_node(exit: &Arc<AtomicBool>) -> (Arc<ClusterInfo>, GossipService, UdpSoc
let keypair = Arc::new(Keypair::new());
let mut test_node = Node::new_localhost_with_pubkey(&keypair.pubkey());
let cluster_info = Arc::new(ClusterInfo::new(test_node.info.clone(), keypair));
let gossip_service = GossipService::new(&cluster_info, None, test_node.sockets.gossip, exit);
let gossip_service =
GossipService::new(&cluster_info, None, test_node.sockets.gossip, None, exit);
let _ = cluster_info.my_contact_info();
(
cluster_info,
@@ -39,6 +40,7 @@ fn test_node_with_bank(
&cluster_info,
Some(bank_forks),
test_node.sockets.gossip,
None,
exit,
);
let _ = cluster_info.my_contact_info();

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-crate-features"
version = "1.3.9"
version = "1.3.10"
description = "Solana Crate Features"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"

View File

@@ -111,10 +111,15 @@ Requests can be sent in batches by sending an array of JSON-RPC request objects
Solana nodes choose which bank state to query based on a commitment requirement
set by the client. Clients may specify either:
- `"max"` - the node will query the most recent bank confirmed by the cluster as having reached `MAX_LOCKOUT_HISTORY` confirmations
- `"root"` - the node will query the most recent bank having reached `MAX_LOCKOUT_HISTORY` confirmations on this node
- `"single"` - the node will query the most recent bank having reached 1 confirmation
- `"recent"` - the node will query its most recent bank
- `"max"` - the node will query the most recent block confirmed by supermajority of the cluster as having reached
maximum lockout.
- `"root"` - the node will query the most recent block having reached maximum lockout on this node.
- `"singleGossip"` - the node will query the most recent block that has been voted on by supermajority of the cluster.
- It incorporates votes from gossip and replay.
- It does not count votes on descendants of a block, only direct votes on that block.
- This confirmation level also upholds "optimistic confirmation" guarantees in
release 1.3 and onwards.
- `"recent"` - the node will query its most recent block.
The commitment parameter should be included as the last element in the `params` array:
@@ -1301,7 +1306,7 @@ The result field will be a JSON object with the following fields:
// Request
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getVersion"}' http://localhost:8899
// Result
{"jsonrpc":"2.0","result":{"solana-core": "1.3.9"},"id":1}
{"jsonrpc":"2.0","result":{"solana-core": "1.3.10"},"id":1}
```
### getVoteAccounts

View File

@@ -14,7 +14,7 @@ much data is retained, and ensure you do not miss any data if one node fails.
To run an api node:
1. [Install the Solana command-line tool suite](../cli/install-solana-cli-tools.md)
2. Boot the node with at least the following parameters:
2. Start the validator with at least the following parameters:
```bash
solana-validator \
@@ -25,7 +25,7 @@ solana-validator \
--rpc-port 8899 \
--no-voting \
--enable-rpc-transaction-history \
--limit-ledger-size <SHRED_COUNT> \
--limit-ledger-size \
--trusted-validator <VALIDATOR_ADDRESS> \
--no-untrusted-rpc
```
@@ -35,7 +35,7 @@ Customize `--ledger` to your desired ledger storage location, and `--rpc-port` t
The `--entrypoint`, `--expected-genesis-hash`, and `--expected-shred-version` parameters are all specific to the cluster you are joining. The shred version will change on any hard forks in the cluster, so including `--expected-shred-version` ensures you are receiving current data from the cluster you expect.
[Current parameters for Mainnet Beta](../clusters.md#example-solana-validator-command-line-2)
The `--limit-ledger-size` parameter allows you to specify how many ledger [shreds](../terminology.md#shred) your node retains on disk. If you do not include this parameter, the ledger will keep the entire ledger until it runs out of disk space. A larger value like `--limit-ledger-size 250000000000` is good for a couple days
The `--limit-ledger-size` parameter allows you to specify how many ledger [shreds](../terminology.md#shred) your node retains on disk. If you do not include this parameter, the validator will keep the entire ledger until it runs out of disk space. The default value is good for at least a couple days but larger values may be used by adding an argument to `--limit-ledger-size` if desired. Check `solana-validator --help` for the default limit value used by `--limit-ledger-size`
Specifying one or more `--trusted-validator` parameters can protect you from booting from a malicious snapshot. [More on the value of booting with trusted validators](../running-validator/validator-start.md#trusted-validators)
@@ -60,15 +60,46 @@ order to prevent this issue, add the `--no-snapshot-fetch` parameter to your
`solana-validator` command to receive historical ledger data instead of a
snapshot.
If you pass the `--no-snapshot-fetch` parameter on your initial boot, it will
take your node a very long time to catch up. We recommend booting from a
snapshot first, and then using the `--no-snapshot-fetch` parameter for reboots.
Do not pass the `--no-snapshot-fetch` parameter on your initial boot as it's not
possible to boot the node all the way from the genesis block. Instead boot from
a snapshot first and then add the `--no-snapshot-fetch` parameter for reboots.
It is important to note that the amount of historical ledger available to your
nodes is limited to what your trusted validators retain. You will need to ensure
your nodes do not experience downtimes longer than this span, if ledger
continuity is crucial for you.
### Minimizing Validator Port Exposure
The validator requires that various UDP and TCP ports be open for inbound
traffic from all other Solana validators. While this is the most efficient mode of
operation, and is strongly recommended, it is possible to restrict the
validator to only require inbound traffic from one other Solana validator.
First add the `--restricted-repair-only-mode` argument. This will cause the
validator to operate in a restricted mode where it will not receive pushes from
the rest of the validators, and instead will need to continually poll other
validators for blocks. The validator will only transmit UDP packets to other
validators using the *Gossip* and *ServeR* ("serve repair") ports, and only
receive UDP packets on its *Gossip* and *Repair* ports.
The *Gossip* port is bi-directional and allows your validator to remain in
contact with the rest of the cluster. Your validator transmits on the *ServeR*
to make repair requests to obtaining new blocks from the rest of the network,
since Turbine is now disabled. Your validator will then receive repair
responses on the *Repair* port from other validators.
To further restrict the validator to only requesting blocks from one or more
validators, first determine the identity pubkey for that validator and add the
`--gossip-pull-validator PUBKEY --repair-validator PUBKEY` arguments for each
PUBKEY. This will cause your validator to be a resource drain on each validator
that you add, so please do this sparingly and only after consulting with the
target validator.
Your validator should now only be communicating with the explicitly listed
validators and only on the *Gossip*, *Repair* and *ServeR* ports.
## Setting up Deposit Accounts
Solana accounts do not require any on-chain initialization; once they contain

View File

@@ -2,7 +2,7 @@
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-dos"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -13,14 +13,14 @@ clap = "2.33.1"
log = "0.4.8"
rand = "0.7.0"
rayon = "1.4.0"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-core = { path = "../core", version = "1.3.9" }
solana-ledger = { path = "../ledger", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-net-utils = { path = "../net-utils", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-core = { path = "../core", version = "1.3.10" }
solana-ledger = { path = "../ledger", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-net-utils = { path = "../net-utils", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-download-utils"
version = "1.3.9"
version = "1.3.10"
description = "Solana Download Utils"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -14,8 +14,8 @@ console = "0.11.3"
indicatif = "0.15.0"
log = "0.4.8"
reqwest = { version = "0.10.6", default-features = false, features = ["blocking", "rustls-tls", "json"] }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
tar = "0.4.28"
[lib]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-sdk-wasm"
version = "1.3.9"
version = "1.3.10"
description = "Solana SDK Wasm"
authors = ["Solana Maintainers <maintainers@solana.com>"]
repository = "https://github.com/solana-labs/solana"

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-faucet"
version = "1.3.9"
version = "1.3.10"
description = "Solana Faucet"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -16,11 +16,11 @@ clap = "2.33"
log = "0.4.8"
serde = "1.0.112"
serde_derive = "1.0.103"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-metrics = { path = "../metrics", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-metrics = { path = "../metrics", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
tokio = "0.1"
tokio-codec = "0.1"

View File

@@ -211,7 +211,7 @@ pub fn request_airdrop_transaction(
// Read length of transaction
let mut buffer = [0; 2];
stream.read_exact(&mut buffer).map(|err| {
stream.read_exact(&mut buffer).map_err(|err| {
info!(
"request_airdrop_transaction: buffer length read_exact error: {:?}",
err
@@ -219,7 +219,7 @@ pub fn request_airdrop_transaction(
Error::new(ErrorKind::Other, "Airdrop failed")
})?;
let transaction_length = LittleEndian::read_u16(&buffer) as usize;
if transaction_length >= PACKET_DATA_SIZE {
if transaction_length >= PACKET_DATA_SIZE || transaction_length == 0 {
return Err(Error::new(
ErrorKind::Other,
format!(
@@ -293,7 +293,7 @@ pub fn run_faucet(
}
Err(e) => {
info!("Error in request: {:?}", e);
Ok(Bytes::from(&b""[..]))
Ok(Bytes::from(0u16.to_le_bytes().to_vec()))
}
}
});

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-genesis-programs"
version = "1.3.9"
version = "1.3.10"
description = "Solana genesis programs"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -10,12 +10,12 @@ edition = "2018"
[dependencies]
log = { version = "0.4.8" }
solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "1.3.9" }
solana-budget-program = { path = "../programs/budget", version = "1.3.9" }
solana-exchange-program = { path = "../programs/exchange", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-vest-program = { path = "../programs/vest", version = "1.3.9" }
solana-bpf-loader-program = { path = "../programs/bpf_loader", version = "1.3.10" }
solana-budget-program = { path = "../programs/budget", version = "1.3.10" }
solana-exchange-program = { path = "../programs/exchange", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-vest-program = { path = "../programs/vest", version = "1.3.10" }
[lib]
crate-type = ["lib"]

View File

@@ -88,16 +88,17 @@ fn get_programs(cluster_type: ClusterType) -> Vec<(Program, Epoch)> {
.into_iter()
.map(|program| (program, GENESIS_EPOCH))
.collect::<Vec<_>>(),
ClusterType::Devnet => vec![
// Programs used for testing
Program::BuiltinLoader(solana_bpf_loader_deprecated_program!()),
Program::Native(solana_vest_program!()),
Program::Native(solana_budget_program!()),
Program::Native(solana_exchange_program!()),
]
.into_iter()
.map(|program| (program, GENESIS_EPOCH))
.collect::<Vec<_>>(),
(
Program::BuiltinLoader(solana_bpf_loader_deprecated_program!()),
GENESIS_EPOCH,
),
(Program::Native(solana_vest_program!()), GENESIS_EPOCH),
(Program::Native(solana_budget_program!()), GENESIS_EPOCH),
(Program::Native(solana_exchange_program!()), GENESIS_EPOCH),
(Program::BuiltinLoader(solana_bpf_loader_program!()), 400),
],
ClusterType::Testnet => vec![
(

View File

@@ -3,7 +3,7 @@ authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-genesis"
description = "Blockchain, Rebuilt for Scale"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -15,15 +15,15 @@ chrono = "0.4"
serde = "1.0.112"
serde_json = "1.0.56"
serde_yaml = "0.8.13"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-genesis-programs = { path = "../genesis-programs", version = "1.3.9" }
solana-ledger = { path = "../ledger", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-stake-program = { path = "../programs/stake", version = "1.3.9" }
solana-vote-program = { path = "../programs/vote", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-genesis-programs = { path = "../genesis-programs", version = "1.3.10" }
solana-ledger = { path = "../ledger", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-stake-program = { path = "../programs/stake", version = "1.3.10" }
solana-vote-program = { path = "../programs/vote", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
tempfile = "3.1.0"
[[bin]]

View File

@@ -3,20 +3,20 @@ authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-gossip"
description = "Blockchain, Rebuilt for Scale"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
[dependencies]
clap = "2.33.1"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-core = { path = "../core", version = "1.3.9" }
solana-client = { path = "../client", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-net-utils = { path = "../net-utils", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-core = { path = "../core", version = "1.3.10" }
solana-client = { path = "../client", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-net-utils = { path = "../net-utils", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

View File

@@ -3,7 +3,7 @@ authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-install"
description = "The solana cluster software installer"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -24,12 +24,12 @@ reqwest = { version = "0.10.6", default-features = false, features = ["blocking"
serde = "1.0.112"
serde_derive = "1.0.103"
serde_yaml = "0.8.13"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-client = { path = "../client", version = "1.3.9" }
solana-config-program = { path = "../programs/config", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-client = { path = "../client", version = "1.3.10" }
solana-config-program = { path = "../programs/config", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
semver = "0.9.0"
tar = "0.4.28"
tempdir = "0.3.7"

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-keygen"
version = "1.3.9"
version = "1.3.10"
description = "Solana key generation utility"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -13,11 +13,11 @@ bs58 = "0.3.1"
clap = "2.33"
dirs = "2.0.2"
num_cpus = "1.13.0"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-cli-config = { path = "../cli-config", version = "1.3.9" }
solana-remote-wallet = { path = "../remote-wallet", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-cli-config = { path = "../cli-config", version = "1.3.10" }
solana-remote-wallet = { path = "../remote-wallet", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
tiny-bip39 = "0.7.0"
[[bin]]

View File

@@ -3,7 +3,7 @@ authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-ledger-tool"
description = "Blockchain, Rebuilt for Scale"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -19,18 +19,18 @@ log = { version = "0.4.8" }
regex = "1"
serde_json = "1.0.56"
serde_yaml = "0.8.13"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-cli = { path = "../cli", version = "1.3.9" }
solana-ledger = { path = "../ledger", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-measure = { path = "../measure", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-stake-program = { path = "../programs/stake", version = "1.3.9" }
solana-storage-bigtable = { path = "../storage-bigtable", version = "1.3.9" }
solana-transaction-status = { path = "../transaction-status", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-vote-program = { path = "../programs/vote", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-cli = { path = "../cli", version = "1.3.10" }
solana-ledger = { path = "../ledger", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-measure = { path = "../measure", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-stake-program = { path = "../programs/stake", version = "1.3.10" }
solana-storage-bigtable = { path = "../storage-bigtable", version = "1.3.10" }
solana-transaction-status = { path = "../transaction-status", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
solana-vote-program = { path = "../programs/vote", version = "1.3.10" }
tempfile = "3.1.0"
tokio = { version = "0.2.22", features = ["full"] }

View File

@@ -44,7 +44,7 @@ use solana_vote_program::{
};
use std::{
collections::{BTreeMap, BTreeSet, HashMap, HashSet},
convert::{TryFrom, TryInto},
convert::TryInto,
ffi::OsStr,
fs::{self, File},
io::{self, stdout, BufRead, BufReader, Write},
@@ -708,16 +708,7 @@ fn open_genesis_config_by(ledger_path: &Path, matches: &ArgMatches<'_>) -> Genes
}
fn assert_capitalization(bank: &Bank) {
let calculated_capitalization = bank.calculate_capitalization();
assert_eq!(
bank.capitalization(),
calculated_capitalization,
"Capitalization mismatch!?: +/-{}",
Sol(u64::try_from(
(i128::from(calculated_capitalization) - i128::from(bank.capitalization())).abs()
)
.unwrap()),
);
assert!(bank.calculate_and_verify_capitalization());
}
#[allow(clippy::cognitive_complexity)]
@@ -1695,7 +1686,7 @@ fn main() {
if remove_stake_accounts {
for (address, mut account) in bank
.get_program_accounts(Some(&solana_stake_program::id()))
.get_program_accounts(&solana_stake_program::id())
.into_iter()
{
account.lamports = 0;
@@ -1723,7 +1714,7 @@ fn main() {
// Delete existing vote accounts
for (address, mut account) in bank
.get_program_accounts(Some(&solana_vote_program::id()))
.get_program_accounts(&solana_vote_program::id())
.into_iter()
{
account.lamports = 0;

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-ledger"
version = "1.3.9"
version = "1.3.10"
description = "Solana ledger"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -31,19 +31,19 @@ reed-solomon-erasure = { version = "4.0.2", features = ["simd-accel"] }
serde = "1.0.112"
serde_bytes = "0.11.4"
sha2 = "0.8.2"
solana-transaction-status = { path = "../transaction-status", version = "1.3.9" }
solana-genesis-programs = { path = "../genesis-programs", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-measure = { path = "../measure", version = "1.3.9" }
solana-merkle-tree = { path = "../merkle-tree", version = "1.3.9" }
solana-metrics = { path = "../metrics", version = "1.3.9" }
solana-perf = { path = "../perf", version = "1.3.9" }
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-stake-program = { path = "../programs/stake", version = "1.3.9" }
solana-storage-bigtable = { path = "../storage-bigtable", version = "1.3.9" }
solana-vote-program = { path = "../programs/vote", version = "1.3.9" }
solana-transaction-status = { path = "../transaction-status", version = "1.3.10" }
solana-genesis-programs = { path = "../genesis-programs", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-measure = { path = "../measure", version = "1.3.10" }
solana-merkle-tree = { path = "../merkle-tree", version = "1.3.10" }
solana-metrics = { path = "../metrics", version = "1.3.10" }
solana-perf = { path = "../perf", version = "1.3.10" }
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-stake-program = { path = "../programs/stake", version = "1.3.10" }
solana-storage-bigtable = { path = "../storage-bigtable", version = "1.3.10" }
solana-vote-program = { path = "../programs/vote", version = "1.3.10" }
tempfile = "3.1.0"
thiserror = "1.0"
tokio = { version = "0.2.22", features = ["full"] }
@@ -59,7 +59,7 @@ features = ["lz4"]
[dev-dependencies]
assert_matches = "1.3.0"
matches = "0.1.6"
solana-budget-program = { path = "../programs/budget", version = "1.3.9" }
solana-budget-program = { path = "../programs/budget", version = "1.3.10" }
[lib]
crate-type = ["lib"]

View File

@@ -293,6 +293,9 @@ pub enum BlockstoreProcessorError {
#[error("invalid hard fork")]
InvalidHardFork(Slot),
#[error("root bank with mismatched capitalization at {0}")]
RootBankWithMismatchedCapitalization(Slot),
}
/// Callback for accessing bank state while processing the blockstore
@@ -481,6 +484,13 @@ fn do_process_blockstore_from_root(
);
assert!(bank_forks.active_banks().is_empty());
// We might be promptly restarted after bad capitalization was detected while creating newer snapshot.
// In that case, we're most likely restored from the last good snapshot and replayed up to this root.
// So again check here for the bad capitalization to avoid to continue until the next snapshot creation.
if !bank_forks.root_bank().calculate_and_verify_capitalization() {
return Err(BlockstoreProcessorError::RootBankWithMismatchedCapitalization(root));
}
Ok((bank_forks, leader_schedule_cache))
}
@@ -799,6 +809,7 @@ fn load_frozen_forks(
let mut initial_forks = HashMap::new();
let mut all_banks = HashMap::new();
let mut last_status_report = Instant::now();
let mut last_free = Instant::now();
let mut pending_slots = vec![];
let mut last_root_slot = root_bank.slot();
let mut slots_elapsed = 0;
@@ -824,6 +835,7 @@ fn load_frozen_forks(
let slot = bank.slot();
if last_status_report.elapsed() > Duration::from_secs(2) {
let secs = last_status_report.elapsed().as_secs() as f32;
last_status_report = Instant::now();
info!(
"processing ledger: slot={}, last root slot={} slots={} slots/s={:?} txs/s={}",
slot,
@@ -832,7 +844,6 @@ fn load_frozen_forks(
slots_elapsed as f32 / secs,
txs as f32 / secs,
);
last_status_report = Instant::now();
slots_elapsed = 0;
txs = 0;
}
@@ -895,9 +906,16 @@ fn load_frozen_forks(
leader_schedule_cache.set_root(&new_root_bank);
new_root_bank.squash();
if last_free.elapsed() > Duration::from_secs(30) {
// This could take few secs; so update last_free later
new_root_bank.exhaustively_free_unused_resource();
last_free = Instant::now();
}
// Filter out all non descendants of the new root
pending_slots.retain(|(_, pending_bank, _)| pending_bank.ancestors.contains_key(root));
initial_forks.retain(|_, fork_tip_bank| fork_tip_bank.ancestors.contains_key(root));
all_banks.retain(|_, bank| bank.ancestors.contains_key(root));
}
slots_elapsed += 1;

View File

@@ -3,7 +3,7 @@ authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-local-cluster"
description = "Blockchain, Rebuilt for Scale"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -13,22 +13,22 @@ itertools = "0.9.0"
gag = "0.1.10"
log = "0.4.8"
rand = "0.7.0"
solana-config-program = { path = "../programs/config", version = "1.3.9" }
solana-core = { path = "../core", version = "1.3.9" }
solana-client = { path = "../client", version = "1.3.9" }
solana-download-utils = { path = "../download-utils", version = "1.3.9" }
solana-faucet = { path = "../faucet", version = "1.3.9" }
solana-exchange-program = { path = "../programs/exchange", version = "1.3.9" }
solana-genesis-programs = { path = "../genesis-programs", version = "1.3.9" }
solana-ledger = { path = "../ledger", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-runtime = { path = "../runtime", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-stake-program = { path = "../programs/stake", version = "1.3.9" }
solana-vest-program = { path = "../programs/vest", version = "1.3.9" }
solana-vote-program = { path = "../programs/vote", version = "1.3.9" }
solana-config-program = { path = "../programs/config", version = "1.3.10" }
solana-core = { path = "../core", version = "1.3.10" }
solana-client = { path = "../client", version = "1.3.10" }
solana-download-utils = { path = "../download-utils", version = "1.3.10" }
solana-faucet = { path = "../faucet", version = "1.3.10" }
solana-exchange-program = { path = "../programs/exchange", version = "1.3.10" }
solana-genesis-programs = { path = "../genesis-programs", version = "1.3.10" }
solana-ledger = { path = "../ledger", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-runtime = { path = "../runtime", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-stake-program = { path = "../programs/stake", version = "1.3.10" }
solana-vest-program = { path = "../programs/vest", version = "1.3.10" }
solana-vote-program = { path = "../programs/vote", version = "1.3.10" }
tempfile = "3.1.0"
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.3.9" }
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.3.10" }
[dev-dependencies]
assert_matches = "1.3.0"

View File

@@ -201,10 +201,10 @@ impl LocalCluster {
let (leader_ledger_path, _blockhash) = create_new_tmp_ledger!(&genesis_config);
let leader_contact_info = leader_node.info.clone();
let mut leader_config = config.validator_configs[0].clone();
leader_config.rpc_ports = Some((
leader_node.info.rpc.port(),
leader_node.info.rpc_pubsub.port(),
leader_node.info.rpc_banks.port(),
leader_config.rpc_addrs = Some((
leader_node.info.rpc,
leader_node.info.rpc_pubsub,
leader_node.info.rpc_banks,
));
leader_config.account_paths = vec![leader_ledger_path.join("accounts")];
let leader_keypair = Arc::new(Keypair::from_bytes(&leader_keypair.to_bytes()).unwrap());
@@ -351,10 +351,10 @@ impl LocalCluster {
}
let mut config = validator_config.clone();
config.rpc_ports = Some((
validator_node.info.rpc.port(),
validator_node.info.rpc_pubsub.port(),
validator_node.info.rpc_banks.port(),
config.rpc_addrs = Some((
validator_node.info.rpc,
validator_node.info.rpc_pubsub,
validator_node.info.rpc_banks,
));
config.account_paths = vec![ledger_path.join("accounts")];
let voting_keypair = voting_keypair.unwrap();
@@ -625,11 +625,8 @@ impl Cluster for LocalCluster {
// Update the stored ContactInfo for this node
let node = Node::new_localhost_with_pubkey(&pubkey);
cluster_validator_info.info.contact_info = node.info.clone();
cluster_validator_info.config.rpc_ports = Some((
node.info.rpc.port(),
node.info.rpc_pubsub.port(),
node.info.rpc_banks.port(),
));
cluster_validator_info.config.rpc_addrs =
Some((node.info.rpc, node.info.rpc_pubsub, node.info.rpc_banks));
let entry_point_info = {
if *pubkey == self.entry_point_info.id {

View File

@@ -3,7 +3,7 @@ authors = ["Solana Maintainers <maintainers@solana.com>"]
edition = "2018"
name = "solana-log-analyzer"
description = "The solana cluster network analysis tool"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -14,9 +14,9 @@ byte-unit = "4.0.8"
clap = "2.33.1"
serde = "1.0.112"
serde_json = "1.0.56"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
[[bin]]
name = "solana-log-analyzer"

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-logger"
version = "1.3.9"
version = "1.3.10"
description = "Solana Logger"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"

View File

@@ -1,7 +1,7 @@
[package]
name = "solana-measure"
description = "Blockchain, Rebuilt for Scale"
version = "1.3.9"
version = "1.3.10"
documentation = "https://docs.rs/solana"
homepage = "https://solana.com/"
readme = "../README.md"
@@ -12,8 +12,8 @@ edition = "2018"
[dependencies]
log = "0.4.8"
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-metrics = { path = "../metrics", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-metrics = { path = "../metrics", version = "1.3.10" }
[target."cfg(unix)".dependencies]
jemallocator = "0.3.2"

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-merkle-tree"
version = "1.3.9"
version = "1.3.10"
description = "Solana Merkle Tree"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -9,7 +9,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
fast-math = "0.1"
[dev-dependencies]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-metrics"
version = "1.3.9"
version = "1.3.10"
description = "Solana Metrics"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -14,7 +14,7 @@ gethostname = "0.2.1"
lazy_static = "1.4.0"
log = "0.4.8"
reqwest = { version = "0.10.6", default-features = false, features = ["blocking", "rustls-tls", "json"] }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
[dev-dependencies]
rand = "0.7.0"

View File

@@ -3,7 +3,7 @@ authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-net-shaper"
description = "The solana cluster network shaping tool"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -13,8 +13,8 @@ publish = false
clap = "2.33.1"
serde = "1.0.112"
serde_json = "1.0.56"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
rand = "0.7.0"
[[bin]]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-net-utils"
version = "1.3.9"
version = "1.3.10"
description = "Solana Network Utilities"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -18,9 +18,9 @@ rand = "0.7.0"
serde = "1.0.112"
serde_derive = "1.0.103"
socket2 = "0.3.12"
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
tokio = "0.1"
tokio-codec = "0.1"
url = "2.1.1"

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-notifier"
version = "1.3.9"
version = "1.3.10"
description = "Solana Notifier"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-perf"
version = "1.3.9"
version = "1.3.10"
description = "Solana Performance APIs"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -17,11 +17,11 @@ serde = "1.0.112"
dlopen_derive = "0.1.4"
lazy_static = "1.4.0"
log = "0.4.8"
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.3.9" }
solana-budget-program = { path = "../programs/budget", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-metrics = { path = "../metrics", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.3.10" }
solana-budget-program = { path = "../programs/budget", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-metrics = { path = "../metrics", version = "1.3.10" }
curve25519-dalek = { version = "2" }
[lib]

View File

@@ -2,7 +2,7 @@
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-poh-bench"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -12,13 +12,13 @@ clap = "2.33.1"
log = "0.4.6"
rand = "0.7.0"
rayon = "1.4.0"
solana-logger = { path = "../logger", version = "1.3.9" }
solana-ledger = { path = "../ledger", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.9" }
solana-measure = { path = "../measure", version = "1.3.9" }
solana-version = { path = "../version", version = "1.3.9" }
solana-perf = { path = "../perf", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-ledger = { path = "../ledger", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-clap-utils = { path = "../clap-utils", version = "1.3.10" }
solana-measure = { path = "../measure", version = "1.3.10" }
solana-version = { path = "../version", version = "1.3.10" }
solana-perf = { path = "../perf", version = "1.3.10" }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

View File

@@ -1664,7 +1664,7 @@ checksum = "c7cb5678e1615754284ec264d9bb5b4c27d2018577fd90ac0ceb578591ed5ee4"
[[package]]
name = "solana-bpf-loader-program"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"bincode",
"byteorder 1.3.4",
@@ -1678,7 +1678,7 @@ dependencies = [
[[package]]
name = "solana-bpf-programs"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"bincode",
"byteorder 1.3.4",
@@ -1693,7 +1693,7 @@ dependencies = [
[[package]]
name = "solana-bpf-rust-128bit"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-bpf-rust-128bit-dep",
"solana-sdk",
@@ -1701,21 +1701,21 @@ dependencies = [
[[package]]
name = "solana-bpf-rust-128bit-dep"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-alloc"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-dep-crate"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"byteorder 1.3.4",
"solana-sdk",
@@ -1723,21 +1723,21 @@ dependencies = [
[[package]]
name = "solana-bpf-rust-deprecated_loader"
version = "1.4.0"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-dup-accounts"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-error-handling"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"num-derive 0.2.5",
"num-traits",
@@ -1747,14 +1747,14 @@ dependencies = [
[[package]]
name = "solana-bpf-rust-external-spend"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-invoke"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-bpf-rust-invoked",
"solana-sdk",
@@ -1762,21 +1762,21 @@ dependencies = [
[[package]]
name = "solana-bpf-rust-invoked"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-iter"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-many-args"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-bpf-rust-many-args-dep",
"solana-sdk",
@@ -1784,28 +1784,28 @@ dependencies = [
[[package]]
name = "solana-bpf-rust-many-args-dep"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-noop"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-panic"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-param-passing"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-bpf-rust-param-passing-dep",
"solana-sdk",
@@ -1813,21 +1813,21 @@ dependencies = [
[[package]]
name = "solana-bpf-rust-param-passing-dep"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-bpf-rust-sysval"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"solana-sdk",
]
[[package]]
name = "solana-config-program"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"bincode",
"chrono",
@@ -1839,7 +1839,7 @@ dependencies = [
[[package]]
name = "solana-crate-features"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"backtrace",
"bytes 0.4.12",
@@ -1862,7 +1862,7 @@ dependencies = [
[[package]]
name = "solana-logger"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"env_logger",
"lazy_static",
@@ -1871,7 +1871,7 @@ dependencies = [
[[package]]
name = "solana-measure"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"jemalloc-ctl",
"jemallocator",
@@ -1882,7 +1882,7 @@ dependencies = [
[[package]]
name = "solana-metrics"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"env_logger",
"gethostname",
@@ -1894,7 +1894,7 @@ dependencies = [
[[package]]
name = "solana-rayon-threadlimit"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"lazy_static",
"num_cpus",
@@ -1902,7 +1902,7 @@ dependencies = [
[[package]]
name = "solana-runtime"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"bincode",
"blake3",
@@ -1947,7 +1947,7 @@ dependencies = [
[[package]]
name = "solana-sdk"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"assert_matches",
"bincode",
@@ -1984,7 +1984,7 @@ dependencies = [
[[package]]
name = "solana-sdk-macro"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"bs58",
"proc-macro2 1.0.19",
@@ -1995,7 +1995,7 @@ dependencies = [
[[package]]
name = "solana-sdk-macro-frozen-abi"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"lazy_static",
"proc-macro2 1.0.19",
@@ -2006,7 +2006,7 @@ dependencies = [
[[package]]
name = "solana-stake-program"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"bincode",
"log",
@@ -2025,7 +2025,7 @@ dependencies = [
[[package]]
name = "solana-vote-program"
version = "1.3.9"
version = "1.3.10"
dependencies = [
"bincode",
"log",

View File

@@ -1,7 +1,7 @@
[package]
name = "solana-bpf-programs"
description = "Blockchain, Rebuilt for Scale"
version = "1.3.9"
version = "1.3.10"
documentation = "https://docs.rs/solana"
homepage = "https://solana.com/"
readme = "README.md"
@@ -22,10 +22,10 @@ walkdir = "2"
bincode = "1.1.4"
byteorder = "1.3.2"
elf = "0.0.10"
solana-bpf-loader-program = { path = "../bpf_loader", version = "1.3.9" }
solana-logger = { path = "../../logger", version = "1.3.9" }
solana-runtime = { path = "../../runtime", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-bpf-loader-program = { path = "../bpf_loader", version = "1.3.10" }
solana-logger = { path = "../../logger", version = "1.3.10" }
solana-runtime = { path = "../../runtime", version = "1.3.10" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
solana_rbpf = "=0.1.30"
[[bench]]

View File

@@ -1,19 +1,31 @@
#![feature(test)]
#![cfg(feature = "bpf_c")]
extern crate test;
#[macro_use]
extern crate solana_bpf_loader_program;
use byteorder::{ByteOrder, LittleEndian, WriteBytesExt};
use solana_bpf_loader_program::serialization::{deserialize_parameters, serialize_parameters};
use solana_rbpf::EbpfVm;
use solana_runtime::{
bank::Bank,
bank_client::BankClient,
genesis_utils::{create_genesis_config, GenesisConfigInfo},
loader_utils::load_program,
};
use solana_sdk::{
account::Account,
bpf_loader,
account::{create_keyed_readonly_accounts, Account},
bpf_loader, bpf_loader_deprecated,
client::SyncClient,
entrypoint::SUCCESS,
entrypoint_native::{ComputeBudget, ComputeMeter, InvokeContext, Logger, ProcessInstruction},
instruction::{CompiledInstruction, InstructionError},
instruction::{AccountMeta, CompiledInstruction, Instruction, InstructionError},
message::Message,
pubkey::Pubkey,
signature::{Keypair, Signer},
};
use std::{cell::RefCell, rc::Rc};
use std::{env, fs::File, io::Read, mem, path::PathBuf};
use std::{cell::RefCell, env, fs::File, io::Read, mem, path::PathBuf, rc::Rc, sync::Arc};
use test::Bencher;
/// BPF program file extension
@@ -34,31 +46,33 @@ fn empty_check(_prog: &[u8]) -> Result<(), solana_bpf_loader_program::BPFError>
Ok(())
}
fn load_elf() -> Result<Vec<u8>, std::io::Error> {
let path = create_bpf_path("bench_alu");
fn load_elf(name: &str) -> Result<Vec<u8>, std::io::Error> {
let path = create_bpf_path(name);
let mut file = File::open(&path).expect(&format!("Unable to open {:?}", path));
let mut elf = Vec::new();
file.read_to_end(&mut elf).unwrap();
Ok(elf)
}
fn load_bpf_program(
bank_client: &BankClient,
loader_id: &Pubkey,
payer_keypair: &Keypair,
name: &str,
) -> Pubkey {
let path = create_bpf_path(name);
let mut file = File::open(path).unwrap();
let mut elf = Vec::new();
file.read_to_end(&mut elf).unwrap();
load_program(bank_client, payer_keypair, loader_id, elf)
}
const ARMSTRONG_LIMIT: u64 = 500;
const ARMSTRONG_EXPECTED: u64 = 5;
#[bench]
fn bench_program_load_elf(bencher: &mut Bencher) {
let elf = load_elf().unwrap();
let mut vm = EbpfVm::<solana_bpf_loader_program::BPFError>::new(None).unwrap();
vm.set_verifier(empty_check).unwrap();
bencher.iter(|| {
vm.set_elf(&elf).unwrap();
});
}
#[bench]
fn bench_program_verify(bencher: &mut Bencher) {
let elf = load_elf().unwrap();
let elf = load_elf("bench_alu").unwrap();
let mut vm = EbpfVm::<solana_bpf_loader_program::BPFError>::new(None).unwrap();
vm.set_verifier(empty_check).unwrap();
vm.set_elf(&elf).unwrap();
@@ -78,16 +92,16 @@ fn bench_program_alu(bencher: &mut Bencher) {
.write_u64::<LittleEndian>(ARMSTRONG_LIMIT)
.unwrap();
inner_iter.write_u64::<LittleEndian>(0).unwrap();
let loader_id = bpf_loader::id();
let mut invoke_context = MockInvokeContext::default();
let elf = load_elf().unwrap();
let elf = load_elf("bench_alu").unwrap();
let (mut vm, _) =
solana_bpf_loader_program::create_vm(&bpf_loader::id(), &elf, &[], &mut invoke_context)
.unwrap();
solana_bpf_loader_program::create_vm(&loader_id, &elf, &[], &mut invoke_context).unwrap();
println!("Interpreted:");
assert_eq!(
0, /*success*/
SUCCESS,
vm.execute_program(&mut inner_iter, &[], &[]).unwrap()
);
assert_eq!(ARMSTRONG_LIMIT, LittleEndian::read_u64(&inner_iter));
@@ -135,6 +149,99 @@ fn bench_program_alu(bencher: &mut Bencher) {
// println!("{{ \"type\": \"bench\", \"name\": \"bench_program_alu_jit_to_native_mips\", \"median\": {:?}, \"deviation\": 0 }}", mips);
}
#[bench]
fn bench_program_execute_noop(bencher: &mut Bencher) {
// solana_logger::setup(); // TODO remove
let GenesisConfigInfo {
genesis_config,
mint_keypair,
..
} = create_genesis_config(50);
let mut bank = Bank::new(&genesis_config);
let (name, id, entrypoint) = solana_bpf_loader_program!();
bank.add_builtin_loader(&name, id, entrypoint);
let bank = Arc::new(bank);
let bank_client = BankClient::new_shared(&bank);
let invoke_program_id =
load_bpf_program(&bank_client, &bpf_loader::id(), &mint_keypair, "noop");
let mint_pubkey = mint_keypair.pubkey();
let account_metas = vec![AccountMeta::new(mint_pubkey, true)];
let instruction = Instruction::new(invoke_program_id, &[u8::MAX, 0, 0, 0], account_metas);
let message = Message::new(&[instruction], Some(&mint_pubkey));
bank_client
.send_and_confirm_message(&[&mint_keypair], message.clone())
.unwrap();
println!("start bench");
bencher.iter(|| {
bank.clear_signatures();
bank_client
.send_and_confirm_message(&[&mint_keypair], message.clone())
.unwrap();
});
}
fn create_serialization_create_params() -> (Vec<u8>, Vec<(Pubkey, RefCell<Account>)>) {
let accounts = vec![
(
Pubkey::new_rand(),
RefCell::new(Account::new(0, 100, &Pubkey::new_rand())),
),
(
Pubkey::new_rand(),
RefCell::new(Account::new(0, 100, &Pubkey::new_rand())),
),
(
Pubkey::new_rand(),
RefCell::new(Account::new(0, 250, &Pubkey::new_rand())),
),
(
Pubkey::new_rand(),
RefCell::new(Account::new(0, 1000, &Pubkey::new_rand())),
),
];
(vec![0xee; 100], accounts)
}
#[bench]
fn bench_serialization_aligned(bencher: &mut Bencher) {
let (data, accounts) = create_serialization_create_params();
let keyed_accounts = create_keyed_readonly_accounts(&accounts);
bencher.iter(|| {
let buffer = serialize_parameters(
&bpf_loader_deprecated::id(),
&Pubkey::new_rand(),
&keyed_accounts,
&data,
)
.unwrap();
deserialize_parameters(&bpf_loader_deprecated::id(), &keyed_accounts, &buffer).unwrap();
});
}
#[bench]
fn bench_serialization_unaligned(bencher: &mut Bencher) {
let (data, accounts) = create_serialization_create_params();
let keyed_accounts = create_keyed_readonly_accounts(&accounts);
bencher.iter(|| {
let buffer = serialize_parameters(
&bpf_loader_deprecated::id(),
&Pubkey::new_rand(),
&keyed_accounts,
&data,
)
.unwrap();
deserialize_parameters(&bpf_loader_deprecated::id(), &keyed_accounts, &buffer).unwrap();
});
}
#[derive(Debug, Default)]
pub struct MockInvokeContext {
key: Pubkey,

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-128bit"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,8 +12,8 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-bpf-rust-128bit-dep = { path = "../128bit_dep", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
solana-bpf-rust-128bit-dep = { path = "../128bit_dep", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-128bit-dep"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-alloc"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-dep-crate"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -13,7 +13,7 @@ edition = "2018"
[dependencies]
byteorder = { version = "1", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-deprecated_loader"
version = "1.4.0"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-dup-accounts"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-error-handling"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -14,7 +14,7 @@ edition = "2018"
[dependencies]
num-derive = "0.2"
num-traits = "0.2"
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
thiserror = "1.0"
[features]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-external-spend"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-invoke"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -13,7 +13,7 @@ edition = "2018"
[dependencies]
solana-bpf-rust-invoked = { path = "../invoked", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-invoked"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-iter"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-many-args"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,8 +12,8 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-bpf-rust-many-args-dep = { path = "../many_args_dep", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
solana-bpf-rust-many-args-dep = { path = "../many_args_dep", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-many-args-dep"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-noop"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-panic"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-param-passing"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,8 +12,8 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-bpf-rust-param-passing-dep = { path = "../param_passing_dep", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
solana-bpf-rust-param-passing-dep = { path = "../param_passing_dep", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-param-passing-dep"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -3,7 +3,7 @@
[package]
name = "solana-bpf-rust-sysval"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF test program written in Rust"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -12,7 +12,7 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../../../sdk/", version = "1.3.9", default-features = false }
solana-sdk = { path = "../../../../sdk/", version = "1.3.10", default-features = false }
[features]
program = ["solana-sdk/program"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-bpf-loader-program"
version = "1.3.9"
version = "1.3.10"
description = "Solana BPF loader"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -13,8 +13,8 @@ bincode = "1.3.1"
byteorder = "1.3.4"
num-derive = { version = "0.3" }
num-traits = { version = "0.2" }
solana-runtime = { path = "../../runtime", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-runtime = { path = "../../runtime", version = "1.3.10" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
solana_rbpf = "=0.1.30"
thiserror = "1.0"

View File

@@ -60,7 +60,7 @@ pub enum BPFError {
impl UserDefinedError for BPFError {}
pub fn create_vm<'a>(
loader_id: &Pubkey,
loader_id: &'a Pubkey,
prog: &'a [u8],
parameter_accounts: &'a [KeyedAccount<'a>],
invoke_context: &'a mut dyn InvokeContext,

View File

@@ -50,7 +50,28 @@ pub fn serialize_parameters_unaligned(
) -> Result<Vec<u8>, InstructionError> {
assert_eq!(32, size_of::<Pubkey>());
let mut v: Vec<u8> = Vec::new();
// Calculate size in order to alloc once
let mut size = size_of::<u64>();
for (i, keyed_account) in keyed_accounts.iter().enumerate() {
let (is_dup, _) = is_dup(&keyed_accounts[..i], keyed_account);
size += 1; // dup, signer, writable, executable
if !is_dup {
let data_len = keyed_account.data_len()?;
size += size_of::<Pubkey>() // key
+ size_of::<Pubkey>() // owner
+ size_of::<u64>() // lamports
+ size_of::<u64>() // data len
+ data_len
+ MAX_PERMITTED_DATA_INCREASE
+ (data_len as *const u8).align_offset(align_of::<u128>())
+ size_of::<u64>(); // rent epoch;
}
}
size += size_of::<u64>() // data len
+ instruction_data.len()
+ size_of::<Pubkey>(); // program id;
let mut v: Vec<u8> = Vec::with_capacity(size);
v.write_u64::<LittleEndian>(keyed_accounts.len() as u64)
.unwrap();
for (i, keyed_account) in keyed_accounts.iter().enumerate() {
@@ -120,10 +141,31 @@ pub fn serialize_parameters_aligned(
) -> Result<Vec<u8>, InstructionError> {
assert_eq!(32, size_of::<Pubkey>());
let mut v: Vec<u8> = Vec::new();
// Calculate size in order to alloc once
let mut size = size_of::<u64>();
for (i, keyed_account) in keyed_accounts.iter().enumerate() {
let (is_dup, _) = is_dup(&keyed_accounts[..i], keyed_account);
size += 8; // dup, signer, writable, executable
if !is_dup {
let data_len = keyed_account.data_len()?;
size += size_of::<Pubkey>() // key
+ size_of::<Pubkey>() // owner
+ size_of::<u64>() // lamports
+ size_of::<u64>() // data len
+ data_len
+ MAX_PERMITTED_DATA_INCREASE
+ (data_len as *const u8).align_offset(align_of::<u128>())
+ size_of::<u64>(); // rent epoch;
}
}
size += size_of::<u64>() // data len
+ instruction_data.len()
+ size_of::<Pubkey>(); // program id;
let mut v: Vec<u8> = Vec::with_capacity(size);
// Serialize into the buffer
v.write_u64::<LittleEndian>(keyed_accounts.len() as u64)
.unwrap();
if v.as_ptr().align_offset(align_of::<u128>()) != 0 {
panic!();
}
@@ -178,10 +220,10 @@ pub fn deserialize_parameters_aligned(
} else {
let mut account = keyed_account.try_account_ref_mut()?;
start += size_of::<u8>() // is_signer
+ size_of::<u8>() // is_writable
+ size_of::<u8>() // executable
+ 4 // padding to 128-bit aligned
+ size_of::<Pubkey>(); // key
+ size_of::<u8>() // is_writable
+ size_of::<u8>() // executable
+ 4 // padding to 128-bit aligned
+ size_of::<Pubkey>(); // key
account.owner = Pubkey::new(&buffer[start..start + size_of::<Pubkey>()]);
start += size_of::<Pubkey>(); // owner
account.lamports = LittleEndian::read_u64(&buffer[start..]);

View File

@@ -85,7 +85,7 @@ use crate::allocator_bump::BPFAllocator;
const DEFAULT_HEAP_SIZE: usize = 32 * 1024;
pub fn register_syscalls<'a>(
loader_id: &Pubkey,
loader_id: &'a Pubkey,
vm: &mut EbpfVm<'a, BPFError>,
callers_keyed_accounts: &'a [KeyedAccount<'a>],
invoke_context: &'a mut dyn InvokeContext,
@@ -94,13 +94,14 @@ pub fn register_syscalls<'a>(
// Syscall functions common across languages
vm.register_syscall_ex("abort", syscall_abort)?;
vm.register_syscall_ex("sol_panic_", syscall_sol_panic)?;
vm.register_syscall_with_context_ex("sol_panic_", Box::new(SyscallPanic { loader_id }))?;
vm.register_syscall_with_context_ex(
"sol_log_",
Box::new(SyscallLog {
cost: compute_budget.log_units,
compute_meter: invoke_context.get_compute_meter(),
logger: invoke_context.get_logger(),
loader_id,
}),
)?;
vm.register_syscall_with_context_ex(
@@ -117,6 +118,7 @@ pub fn register_syscalls<'a>(
Box::new(SyscallCreateProgramAddress {
cost: compute_budget.create_program_address_units,
compute_meter: invoke_context.get_compute_meter(),
loader_id,
}),
)?;
@@ -128,6 +130,7 @@ pub fn register_syscalls<'a>(
Box::new(SyscallProcessSolInstructionC {
callers_keyed_accounts,
invoke_context: invoke_context.clone(),
loader_id,
}),
)?;
vm.register_syscall_with_context_ex(
@@ -135,6 +138,7 @@ pub fn register_syscalls<'a>(
Box::new(SyscallProcessInstructionRust {
callers_keyed_accounts,
invoke_context: invoke_context.clone(),
loader_id,
}),
)?;
}
@@ -155,7 +159,7 @@ pub fn register_syscalls<'a>(
#[macro_export]
macro_rules! translate {
($vm_addr:expr, $len:expr, $regions:expr) => {
($vm_addr:expr, $len:expr, $regions:expr, $loader_id: expr) => {
translate_addr::<BPFError>(
$vm_addr as u64,
$len as usize,
@@ -168,8 +172,10 @@ macro_rules! translate {
#[macro_export]
macro_rules! translate_type_mut {
($t:ty, $vm_addr:expr, $regions:expr) => {{
if ($vm_addr as u64 as *mut $t).align_offset(align_of::<$t>()) != 0 {
($t:ty, $vm_addr:expr, $regions:expr, $loader_id: expr) => {{
if $loader_id != &bpf_loader_deprecated::id()
&& ($vm_addr as u64 as *mut $t).align_offset(align_of::<$t>()) != 0
{
Err(SyscallError::UnalignedPointer.into())
} else {
unsafe {
@@ -189,8 +195,8 @@ macro_rules! translate_type_mut {
}
#[macro_export]
macro_rules! translate_type {
($t:ty, $vm_addr:expr, $regions:expr) => {
match translate_type_mut!($t, $vm_addr, $regions) {
($t:ty, $vm_addr:expr, $regions:expr, $loader_id: expr) => {
match translate_type_mut!($t, $vm_addr, $regions, $loader_id) {
Ok(value) => Ok(&*value),
Err(e) => Err(e),
}
@@ -199,8 +205,10 @@ macro_rules! translate_type {
#[macro_export]
macro_rules! translate_slice_mut {
($t:ty, $vm_addr:expr, $len: expr, $regions:expr) => {{
if ($vm_addr as u64 as *mut $t).align_offset(align_of::<$t>()) != 0 {
($t:ty, $vm_addr:expr, $len: expr, $regions:expr, $loader_id: expr) => {{
if $loader_id != &bpf_loader_deprecated::id()
&& ($vm_addr as u64 as *mut $t).align_offset(align_of::<$t>()) != 0
{
Err(SyscallError::UnalignedPointer.into())
} else {
match translate_addr::<BPFError>(
@@ -218,8 +226,8 @@ macro_rules! translate_slice_mut {
}
#[macro_export]
macro_rules! translate_slice {
($t:ty, $vm_addr:expr, $len: expr, $regions:expr) => {
match translate_slice_mut!($t, $vm_addr, $len, $regions) {
($t:ty, $vm_addr:expr, $len: expr, $regions:expr, $loader_id: expr) => {
match translate_slice_mut!($t, $vm_addr, $len, $regions, $loader_id) {
Ok(value) => Ok(&*value),
Err(e) => Err(e),
}
@@ -232,9 +240,10 @@ fn translate_string_and_do(
addr: u64,
len: u64,
regions: &[MemoryRegion],
loader_id: &Pubkey,
work: &mut dyn FnMut(&str) -> Result<u64, EbpfError<BPFError>>,
) -> Result<u64, EbpfError<BPFError>> {
let buf = translate_slice!(u8, addr, len, regions)?;
let buf = translate_slice!(u8, addr, len, regions, loader_id)?;
let i = match buf.iter().position(|byte| *byte == 0) {
Some(i) => i,
None => len as usize,
@@ -263,27 +272,39 @@ pub fn syscall_abort(
/// Panic syscall function, called when the BPF program calls 'sol_panic_()`
/// Causes the BPF program to be halted immediately
pub fn syscall_sol_panic(
file: u64,
len: u64,
line: u64,
column: u64,
_arg5: u64,
ro_regions: &[MemoryRegion],
_rw_regions: &[MemoryRegion],
) -> Result<u64, EbpfError<BPFError>> {
translate_string_and_do(file, len, ro_regions, &mut |string: &str| {
Err(SyscallError::Panic(string.to_string(), line, column).into())
})
/// Log a user's info message
pub struct SyscallPanic<'a> {
loader_id: &'a Pubkey,
}
impl<'a> SyscallObject<BPFError> for SyscallPanic<'a> {
fn call(
&mut self,
file: u64,
len: u64,
line: u64,
column: u64,
_arg5: u64,
ro_regions: &[MemoryRegion],
_rw_regions: &[MemoryRegion],
) -> Result<u64, EbpfError<BPFError>> {
translate_string_and_do(
file,
len,
ro_regions,
&self.loader_id,
&mut |string: &str| Err(SyscallError::Panic(string.to_string(), line, column).into()),
)
}
}
/// Log a user's info message
pub struct SyscallLog {
pub struct SyscallLog<'a> {
cost: u64,
compute_meter: Rc<RefCell<dyn ComputeMeter>>,
logger: Rc<RefCell<dyn Logger>>,
loader_id: &'a Pubkey,
}
impl SyscallObject<BPFError> for SyscallLog {
impl<'a> SyscallObject<BPFError> for SyscallLog<'a> {
fn call(
&mut self,
addr: u64,
@@ -300,10 +321,16 @@ impl SyscallObject<BPFError> for SyscallLog {
.try_borrow_mut()
.map_err(|_| SyscallError::InvokeContextBorrowFailed)?;
if logger.log_enabled() {
translate_string_and_do(addr, len, ro_regions, &mut |string: &str| {
logger.log(&format!("Program log: {}", string));
Ok(0)
})?;
translate_string_and_do(
addr,
len,
ro_regions,
&self.loader_id,
&mut |string: &str| {
logger.log(&format!("Program log: {}", string));
Ok(0)
},
)?;
}
Ok(0)
}
@@ -384,11 +411,12 @@ impl SyscallObject<BPFError> for SyscallSolAllocFree {
}
/// Create a program address
pub struct SyscallCreateProgramAddress {
struct SyscallCreateProgramAddress<'a> {
cost: u64,
compute_meter: Rc<RefCell<dyn ComputeMeter>>,
loader_id: &'a Pubkey,
}
impl SyscallObject<BPFError> for SyscallCreateProgramAddress {
impl<'a> SyscallObject<BPFError> for SyscallCreateProgramAddress<'a> {
fn call(
&mut self,
seeds_addr: u64,
@@ -400,8 +428,9 @@ impl SyscallObject<BPFError> for SyscallCreateProgramAddress {
rw_regions: &[MemoryRegion],
) -> Result<u64, EbpfError<BPFError>> {
self.compute_meter.consume(self.cost)?;
let untranslated_seeds = translate_slice!(&[&u8], seeds_addr, seeds_len, ro_regions)?;
// TODO need ref?
let untranslated_seeds =
translate_slice!(&[&u8], seeds_addr, seeds_len, ro_regions, self.loader_id)?;
let seeds = untranslated_seeds
.iter()
.map(|untranslated_seed| {
@@ -409,11 +438,12 @@ impl SyscallObject<BPFError> for SyscallCreateProgramAddress {
u8,
untranslated_seed.as_ptr(),
untranslated_seed.len(),
ro_regions
ro_regions,
self.loader_id
)
})
.collect::<Result<Vec<_>, EbpfError<BPFError>>>()?;
let program_id = translate_type!(Pubkey, program_id_addr, ro_regions)?;
let program_id = translate_type!(Pubkey, program_id_addr, ro_regions, self.loader_id)?;
let new_address = match Pubkey::create_program_address(&seeds, program_id)
.map_err(SyscallError::BadSeeds)
@@ -421,7 +451,7 @@ impl SyscallObject<BPFError> for SyscallCreateProgramAddress {
Ok(address) => address,
Err(_) => return Ok(1),
};
let address = translate_slice_mut!(u8, address_addr, 32, rw_regions)?;
let address = translate_slice_mut!(u8, address_addr, 32, rw_regions, self.loader_id)?;
address.copy_from_slice(new_address.as_ref());
Ok(0)
}
@@ -468,6 +498,7 @@ trait SyscallProcessInstruction<'a> {
pub struct SyscallProcessInstructionRust<'a> {
callers_keyed_accounts: &'a [KeyedAccount<'a>],
invoke_context: Rc<RefCell<&'a mut dyn InvokeContext>>,
loader_id: &'a Pubkey,
}
impl<'a> SyscallProcessInstruction<'a> for SyscallProcessInstructionRust<'a> {
fn get_context_mut(&self) -> Result<RefMut<&'a mut dyn InvokeContext>, EbpfError<BPFError>> {
@@ -483,15 +514,23 @@ impl<'a> SyscallProcessInstruction<'a> for SyscallProcessInstructionRust<'a> {
addr: u64,
ro_regions: &[MemoryRegion],
) -> Result<Instruction, EbpfError<BPFError>> {
let ix = translate_type!(Instruction, addr, ro_regions)?;
let ix = translate_type!(Instruction, addr, ro_regions, self.loader_id)?;
let accounts = translate_slice!(
AccountMeta,
ix.accounts.as_ptr(),
ix.accounts.len(),
ro_regions
ro_regions,
self.loader_id
)?
.to_vec();
let data = translate_slice!(
u8,
ix.data.as_ptr(),
ix.data.len(),
ro_regions,
self.loader_id
)?
.to_vec();
let data = translate_slice!(u8, ix.data.as_ptr(), ix.data.len(), ro_regions)?.to_vec();
Ok(Instruction {
program_id: ix.program_id,
accounts,
@@ -512,7 +551,8 @@ impl<'a> SyscallProcessInstruction<'a> for SyscallProcessInstructionRust<'a> {
AccountInfo,
account_infos_addr,
account_infos_len,
ro_regions
ro_regions,
self.loader_id
)?
} else {
&[]
@@ -522,26 +562,56 @@ impl<'a> SyscallProcessInstruction<'a> for SyscallProcessInstructionRust<'a> {
let mut refs = Vec::with_capacity(message.account_keys.len());
'root: for account_key in message.account_keys.iter() {
for account_info in account_infos.iter() {
let key = translate_type!(Pubkey, account_info.key as *const _, ro_regions)?;
let key = translate_type!(
Pubkey,
account_info.key as *const _,
ro_regions,
self.loader_id
)?;
if account_key == key {
let lamports = {
// Double translate lamports out of RefCell
let ptr = translate_type!(u64, account_info.lamports.as_ptr(), ro_regions)?;
translate_type_mut!(u64, *ptr, rw_regions)?
let ptr = translate_type!(
u64,
account_info.lamports.as_ptr(),
ro_regions,
self.loader_id
)?;
translate_type_mut!(u64, *ptr, rw_regions, self.loader_id)?
};
let owner =
translate_type_mut!(Pubkey, account_info.owner as *const _, ro_regions)?;
let owner = translate_type_mut!(
Pubkey,
account_info.owner as *const _,
ro_regions,
self.loader_id
)?;
let (data, ref_to_len_in_vm, serialized_len_ptr) = {
// Double translate data out of RefCell
let data = *translate_type!(&[u8], account_info.data.as_ptr(), ro_regions)?;
let data = *translate_type!(
&[u8],
account_info.data.as_ptr(),
ro_regions,
self.loader_id
)?;
let translated =
translate!(account_info.data.as_ptr(), 8, ro_regions)? as *mut u64;
translate!(account_info.data.as_ptr(), 8, ro_regions, self.loader_id)?
as *mut u64;
let ref_to_len_in_vm = unsafe { &mut *translated.offset(1) };
let ref_of_len_in_input_buffer = unsafe { data.as_ptr().offset(-8) };
let serialized_len_ptr =
translate_type_mut!(u64, ref_of_len_in_input_buffer, rw_regions)?;
let serialized_len_ptr = translate_type_mut!(
u64,
ref_of_len_in_input_buffer,
rw_regions,
self.loader_id
)?;
(
translate_slice_mut!(u8, data.as_ptr(), data.len(), rw_regions)?,
translate_slice_mut!(
u8,
data.as_ptr(),
data.len(),
rw_regions,
self.loader_id
)?,
ref_to_len_in_vm,
serialized_len_ptr,
)
@@ -579,11 +649,21 @@ impl<'a> SyscallProcessInstruction<'a> for SyscallProcessInstructionRust<'a> {
) -> Result<Vec<Pubkey>, EbpfError<BPFError>> {
let mut signers = Vec::new();
if signers_seeds_len > 0 {
let signers_seeds =
translate_slice!(&[&str], signers_seeds_addr, signers_seeds_len, ro_regions)?;
let signers_seeds = translate_slice!(
&[&str],
signers_seeds_addr,
signers_seeds_len,
ro_regions,
self.loader_id
)?;
for signer_seeds in signers_seeds.iter() {
let untranslated_seeds =
translate_slice!(&str, signer_seeds.as_ptr(), signer_seeds.len(), ro_regions)?;
let untranslated_seeds = translate_slice!(
&str,
signer_seeds.as_ptr(),
signer_seeds.len(),
ro_regions,
self.loader_id
)?;
let seeds = untranslated_seeds
.iter()
.map(|untranslated_seed| {
@@ -591,7 +671,8 @@ impl<'a> SyscallProcessInstruction<'a> for SyscallProcessInstructionRust<'a> {
u8,
untranslated_seed.as_ptr(),
untranslated_seed.len(),
ro_regions
ro_regions,
self.loader_id
)
})
.collect::<Result<Vec<_>, EbpfError<BPFError>>>()?;
@@ -679,6 +760,7 @@ struct SolSignerSeedsC {
pub struct SyscallProcessSolInstructionC<'a> {
callers_keyed_accounts: &'a [KeyedAccount<'a>],
invoke_context: Rc<RefCell<&'a mut dyn InvokeContext>>,
loader_id: &'a Pubkey,
}
impl<'a> SyscallProcessInstruction<'a> for SyscallProcessSolInstructionC<'a> {
fn get_context_mut(&self) -> Result<RefMut<&'a mut dyn InvokeContext>, EbpfError<BPFError>> {
@@ -694,19 +776,28 @@ impl<'a> SyscallProcessInstruction<'a> for SyscallProcessSolInstructionC<'a> {
addr: u64,
ro_regions: &[MemoryRegion],
) -> Result<Instruction, EbpfError<BPFError>> {
let ix_c = translate_type!(SolInstruction, addr, ro_regions)?;
let program_id = translate_type!(Pubkey, ix_c.program_id_addr, ro_regions)?;
let ix_c = translate_type!(SolInstruction, addr, ro_regions, self.loader_id)?;
let program_id = translate_type!(Pubkey, ix_c.program_id_addr, ro_regions, self.loader_id)?;
let meta_cs = translate_slice!(
SolAccountMeta,
ix_c.accounts_addr,
ix_c.accounts_len,
ro_regions
ro_regions,
self.loader_id
)?;
let data = translate_slice!(u8, ix_c.data_addr, ix_c.data_len, ro_regions)?.to_vec();
let data = translate_slice!(
u8,
ix_c.data_addr,
ix_c.data_len,
ro_regions,
self.loader_id
)?
.to_vec();
let accounts = meta_cs
.iter()
.map(|meta_c| {
let pubkey = translate_type!(Pubkey, meta_c.pubkey_addr, ro_regions)?;
let pubkey =
translate_type!(Pubkey, meta_c.pubkey_addr, ro_regions, self.loader_id)?;
Ok(AccountMeta {
pubkey: *pubkey,
is_signer: meta_c.is_signer,
@@ -734,29 +825,45 @@ impl<'a> SyscallProcessInstruction<'a> for SyscallProcessSolInstructionC<'a> {
SolAccountInfo,
account_infos_addr,
account_infos_len,
ro_regions
ro_regions,
self.loader_id
)?;
let mut accounts = Vec::with_capacity(message.account_keys.len());
let mut refs = Vec::with_capacity(message.account_keys.len());
'root: for account_key in message.account_keys.iter() {
for account_info in account_infos.iter() {
let key = translate_type!(Pubkey, account_info.key_addr, ro_regions)?;
let key =
translate_type!(Pubkey, account_info.key_addr, ro_regions, self.loader_id)?;
if account_key == key {
let lamports =
translate_type_mut!(u64, account_info.lamports_addr, rw_regions)?;
let owner = translate_type_mut!(Pubkey, account_info.owner_addr, ro_regions)?;
let lamports = translate_type_mut!(
u64,
account_info.lamports_addr,
rw_regions,
self.loader_id
)?;
let owner = translate_type_mut!(
Pubkey,
account_info.owner_addr,
ro_regions,
self.loader_id
)?;
let data = translate_slice_mut!(
u8,
account_info.data_addr,
account_info.data_len,
rw_regions
rw_regions,
self.loader_id
)?;
let ref_to_len_in_vm =
unsafe { &mut *(&account_info.data_len as *const u64 as u64 as *mut u64) };
let ref_of_len_in_input_buffer =
unsafe { (account_info.data_addr as *mut u8).offset(-8) };
let serialized_len_ptr =
translate_type_mut!(u64, ref_of_len_in_input_buffer, rw_regions)?;
let serialized_len_ptr = translate_type_mut!(
u64,
ref_of_len_in_input_buffer,
rw_regions,
self.loader_id
)?;
accounts.push(Rc::new(RefCell::new(Account {
lamports: *lamports,
@@ -793,7 +900,8 @@ impl<'a> SyscallProcessInstruction<'a> for SyscallProcessSolInstructionC<'a> {
SolSignerSeedC,
signers_seeds_addr,
signers_seeds_len,
ro_regions
ro_regions,
self.loader_id
)?;
Ok(signers_seeds
.iter()
@@ -802,11 +910,14 @@ impl<'a> SyscallProcessInstruction<'a> for SyscallProcessSolInstructionC<'a> {
SolSignerSeedC,
signer_seeds.addr,
signer_seeds.len,
ro_regions
ro_regions,
self.loader_id
)?;
let seeds_bytes = seeds
.iter()
.map(|seed| translate_slice!(u8, seed.addr, seed.len, ro_regions))
.map(|seed| {
translate_slice!(u8, seed.addr, seed.len, ro_regions, self.loader_id)
})
.collect::<Result<Vec<_>, EbpfError<BPFError>>>()?;
Pubkey::create_program_address(&seeds_bytes, program_id)
.map_err(|err| SyscallError::BadSeeds(err).into())
@@ -1008,9 +1119,12 @@ mod tests {
];
for (ok, start, length, value) in cases {
if ok {
assert_eq!(translate!(start, length, &regions).unwrap(), value)
assert_eq!(
translate!(start, length, &regions, &bpf_loader::id()).unwrap(),
value
)
} else {
assert!(translate!(start, length, &regions).is_err())
assert!(translate!(start, length, &regions, &bpf_loader::id()).is_err())
}
}
}
@@ -1025,7 +1139,7 @@ mod tests {
addr_vm: 100,
len: std::mem::size_of::<Pubkey>() as u64,
}];
let translated_pubkey = translate_type!(Pubkey, 100, &regions).unwrap();
let translated_pubkey = translate_type!(Pubkey, 100, &regions, &bpf_loader::id()).unwrap();
assert_eq!(pubkey, *translated_pubkey);
// Instruction
@@ -1040,12 +1154,11 @@ mod tests {
addr_vm: 96,
len: std::mem::size_of::<Instruction>() as u64,
}];
let translated_instruction = translate_type!(Instruction, 96, &regions).unwrap();
let translated_instruction =
translate_type!(Instruction, 96, &regions, &bpf_loader::id()).unwrap();
assert_eq!(instruction, *translated_instruction);
regions[0].len = 1;
assert!(translate_type!(Instruction, 100, &regions).is_err());
regions[0].len = std::mem::size_of::<Instruction>() as u64 * 2;
assert!(translate_type!(Instruction, 100, &regions).is_err());
assert!(translate_type!(Instruction, 100, &regions, &bpf_loader::id()).is_err());
}
#[test]
@@ -1058,7 +1171,8 @@ mod tests {
addr_vm: 100,
len: data.len() as u64,
}];
let translated_data = translate_slice!(u8, 100, data.len(), &regions).unwrap();
let translated_data =
translate_slice!(u8, 100, data.len(), &regions, &bpf_loader::id()).unwrap();
assert_eq!(data, translated_data);
data[0] = 10;
assert_eq!(data, translated_data);
@@ -1071,7 +1185,8 @@ mod tests {
addr_vm: 100,
len: (data.len() * std::mem::size_of::<Pubkey>()) as u64,
}];
let translated_data = translate_slice!(Pubkey, 100, data.len(), &regions).unwrap();
let translated_data =
translate_slice!(Pubkey, 100, data.len(), &regions, &bpf_loader::id()).unwrap();
assert_eq!(data, translated_data);
data[0] = Pubkey::new_rand(); // Both should point to same place
assert_eq!(data, translated_data);
@@ -1088,10 +1203,16 @@ mod tests {
}];
assert_eq!(
42,
translate_string_and_do(100, string.len() as u64, &regions, &mut |string: &str| {
assert_eq!(string, "Gaggablaghblagh!");
Ok(42)
})
translate_string_and_do(
100,
string.len() as u64,
&regions,
&bpf_loader::id(),
&mut |string: &str| {
assert_eq!(string, "Gaggablaghblagh!");
Ok(42)
}
)
.unwrap()
);
}
@@ -1115,16 +1236,20 @@ mod tests {
len: string.len() as u64,
};
let rw_region = MemoryRegion::default();
syscall_sol_panic(
100,
string.len() as u64,
42,
84,
0,
&[ro_region],
&[rw_region],
)
.unwrap();
let mut syscall_panic = SyscallPanic {
loader_id: &bpf_loader::id(),
};
syscall_panic
.call(
100,
string.len() as u64,
42,
84,
0,
&[ro_region],
&[rw_region],
)
.unwrap();
}
#[test]
@@ -1141,6 +1266,7 @@ mod tests {
cost: 1,
compute_meter,
logger,
loader_id: &bpf_loader::id(),
};
let ro_regions = &[MemoryRegion {
addr_host: addr,
@@ -1156,7 +1282,7 @@ mod tests {
assert_eq!(
Err(EbpfError::AccessViolation(
"programs/bpf_loader/src/syscalls.rs".to_string(),
238,
247,
100,
32,
" regions: \n0x64-0x73".to_string()

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-budget-program"
version = "1.3.9"
version = "1.3.10"
description = "Solana Budget program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -16,11 +16,11 @@ num-derive = "0.3"
num-traits = "0.2"
serde = "1.0.112"
serde_derive = "1.0.103"
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
thiserror = "1.0"
[dev-dependencies]
solana-runtime = { path = "../../runtime", version = "1.3.9" }
solana-runtime = { path = "../../runtime", version = "1.3.10" }
[lib]
crate-type = ["lib", "cdylib"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-config-program"
version = "1.3.9"
version = "1.3.10"
description = "Solana Config program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -14,10 +14,10 @@ chrono = { version = "0.4.11", features = ["serde"] }
log = "0.4.8"
serde = "1.0.112"
serde_derive = "1.0.103"
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
[dev-dependencies]
solana-logger = { path = "../../logger", version = "1.3.9" }
solana-logger = { path = "../../logger", version = "1.3.10" }
[lib]
crate-type = ["lib"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-exchange-program"
version = "1.3.9"
version = "1.3.10"
description = "Solana Exchange program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -15,13 +15,13 @@ num-derive = { version = "0.3" }
num-traits = { version = "0.2" }
serde = "1.0.112"
serde_derive = "1.0.103"
solana-logger = { path = "../../logger", version = "1.3.9" }
solana-metrics = { path = "../../metrics", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-logger = { path = "../../logger", version = "1.3.10" }
solana-metrics = { path = "../../metrics", version = "1.3.10" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
thiserror = "1.0"
[dev-dependencies]
solana-runtime = { path = "../../runtime", version = "1.3.9" }
solana-runtime = { path = "../../runtime", version = "1.3.10" }
[lib]
crate-type = ["lib", "cdylib"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-failure-program"
version = "1.3.9"
version = "1.3.10"
description = "Solana failure program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -9,10 +9,10 @@ homepage = "https://solana.com/"
edition = "2018"
[dependencies]
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
[dev-dependencies]
solana-runtime = { path = "../../runtime", version = "1.3.9" }
solana-runtime = { path = "../../runtime", version = "1.3.10" }
[lib]
crate-type = ["lib", "cdylib"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-noop-program"
version = "1.3.9"
version = "1.3.10"
description = "Solana Noop program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -10,8 +10,8 @@ edition = "2018"
[dependencies]
log = "0.4.8"
solana-logger = { path = "../../logger", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-logger = { path = "../../logger", version = "1.3.10" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
[lib]
crate-type = ["lib", "cdylib"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-ownable"
version = "1.3.9"
version = "1.3.10"
description = "ownable program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -10,13 +10,13 @@ edition = "2018"
[dependencies]
bincode = "1.3.1"
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
num-derive = "0.3"
num-traits = "0.2"
thiserror = "1.0"
[dev-dependencies]
solana-runtime = { path = "../../runtime", version = "1.3.9" }
solana-runtime = { path = "../../runtime", version = "1.3.10" }
[lib]
crate-type = ["lib", "cdylib"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-stake-program"
version = "1.3.9"
version = "1.3.10"
description = "Solana Stake program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -15,15 +15,15 @@ num-derive = "0.3"
num-traits = "0.2"
serde = "1.0.112"
serde_derive = "1.0.103"
solana-metrics = { path = "../../metrics", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-vote-program = { path = "../vote", version = "1.3.9" }
solana-config-program = { path = "../config", version = "1.3.9" }
solana-sdk-macro-frozen-abi = { path = "../../sdk/macro-frozen-abi", version = "1.3.9" }
solana-metrics = { path = "../../metrics", version = "1.3.10" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
solana-vote-program = { path = "../vote", version = "1.3.10" }
solana-config-program = { path = "../config", version = "1.3.10" }
solana-sdk-macro-frozen-abi = { path = "../../sdk/macro-frozen-abi", version = "1.3.10" }
thiserror = "1.0"
[dev-dependencies]
solana-logger = { path = "../../logger", version = "1.3.9" }
solana-logger = { path = "../../logger", version = "1.3.10" }
[build-dependencies]
rustc_version = "0.2"

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-vest-program"
version = "1.3.9"
version = "1.3.10"
description = "Solana Vest program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -15,12 +15,12 @@ num-derive = "0.2"
num-traits = "0.2"
serde = "1.0.112"
serde_derive = "1.0.103"
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-config-program = { path = "../config", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
solana-config-program = { path = "../config", version = "1.3.10" }
thiserror = "1.0"
[dev-dependencies]
solana-runtime = { path = "../../runtime", version = "1.3.9" }
solana-runtime = { path = "../../runtime", version = "1.3.10" }
[lib]
crate-type = ["lib"]

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-vote-program"
version = "1.3.9"
version = "1.3.10"
description = "Solana Vote program"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -15,10 +15,10 @@ num-derive = "0.3"
num-traits = "0.2"
serde = "1.0.112"
serde_derive = "1.0.103"
solana-logger = { path = "../../logger", version = "1.3.9" }
solana-metrics = { path = "../../metrics", version = "1.3.9" }
solana-sdk = { path = "../../sdk", version = "1.3.9" }
solana-sdk-macro-frozen-abi = { path = "../../sdk/macro-frozen-abi", version = "1.3.9" }
solana-logger = { path = "../../logger", version = "1.3.10" }
solana-metrics = { path = "../../metrics", version = "1.3.10" }
solana-sdk = { path = "../../sdk", version = "1.3.10" }
solana-sdk-macro-frozen-abi = { path = "../../sdk/macro-frozen-abi", version = "1.3.10" }
thiserror = "1.0"
[build-dependencies]

View File

@@ -3,7 +3,7 @@ authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-ramp-tps"
description = "Solana Tour de SOL - TPS ramp up"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/tour-de-sol"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -16,12 +16,12 @@ reqwest = { version = "0.10.6", default-features = false }
serde = "1.0.112"
serde_json = "1.0.56"
serde_yaml = "0.8.13"
solana-core = { path = "../core", version = "1.3.9" }
solana-client = { path = "../client", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-metrics = { path = "../metrics", version = "1.3.9" }
solana-net-utils = { path = "../net-utils", version = "1.3.9" }
solana-notifier = { path = "../notifier", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-stake-program = { path = "../programs/stake", version = "1.3.9" }
solana-core = { path = "../core", version = "1.3.10" }
solana-client = { path = "../client", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-metrics = { path = "../metrics", version = "1.3.10" }
solana-net-utils = { path = "../net-utils", version = "1.3.10" }
solana-notifier = { path = "../notifier", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-stake-program = { path = "../programs/stake", version = "1.3.10" }
tar = "0.4.28"

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-rayon-threadlimit"
version = "1.3.9"
version = "1.3.10"
description = "solana-rayon-threadlimit"
homepage = "https://solana.com/"
readme = "../README.md"

View File

@@ -3,7 +3,7 @@ authors = ["Solana Maintainers <maintainers@solana.foundation>"]
edition = "2018"
name = "solana-remote-wallet"
description = "Blockchain, Rebuilt for Scale"
version = "1.3.9"
version = "1.3.10"
repository = "https://github.com/solana-labs/solana"
license = "Apache-2.0"
homepage = "https://solana.com/"
@@ -18,7 +18,7 @@ num-derive = { version = "0.3" }
num-traits = { version = "0.2" }
parking_lot = "0.10"
semver = "0.9"
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
thiserror = "1.0"
url = "2.1.1"

View File

@@ -1,6 +1,6 @@
[package]
name = "solana-runtime"
version = "1.3.9"
version = "1.3.10"
description = "Solana runtime"
authors = ["Solana Maintainers <maintainers@solana.foundation>"]
repository = "https://github.com/solana-labs/solana"
@@ -33,15 +33,15 @@ rayon = "1.4.0"
regex = "1.3.9"
serde = { version = "1.0.112", features = ["rc"] }
serde_derive = "1.0.103"
solana-config-program = { path = "../programs/config", version = "1.3.9" }
solana-logger = { path = "../logger", version = "1.3.9" }
solana-measure = { path = "../measure", version = "1.3.9" }
solana-metrics = { path = "../metrics", version = "1.3.9" }
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.3.9" }
solana-sdk = { path = "../sdk", version = "1.3.9" }
solana-sdk-macro-frozen-abi = { path = "../sdk/macro-frozen-abi", version = "1.3.9" }
solana-stake-program = { path = "../programs/stake", version = "1.3.9" }
solana-vote-program = { path = "../programs/vote", version = "1.3.9" }
solana-config-program = { path = "../programs/config", version = "1.3.10" }
solana-logger = { path = "../logger", version = "1.3.10" }
solana-measure = { path = "../measure", version = "1.3.10" }
solana-metrics = { path = "../metrics", version = "1.3.10" }
solana-rayon-threadlimit = { path = "../rayon-threadlimit", version = "1.3.10" }
solana-sdk = { path = "../sdk", version = "1.3.10" }
solana-sdk-macro-frozen-abi = { path = "../sdk/macro-frozen-abi", version = "1.3.10" }
solana-stake-program = { path = "../programs/stake", version = "1.3.10" }
solana-vote-program = { path = "../programs/vote", version = "1.3.10" }
symlink = "0.1.0"
tar = "0.4.28"
tempfile = "3.1.0"
@@ -54,7 +54,7 @@ name = "solana_runtime"
[dev-dependencies]
assert_matches = "1.3.0"
solana-noop-program = { path = "../programs/noop", version = "1.3.9" }
solana-noop-program = { path = "../programs/noop", version = "1.3.10" }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]

View File

@@ -74,10 +74,12 @@ fn test_accounts_hash_bank_hash(bencher: &mut Bencher) {
&ClusterType::Development,
);
let mut pubkeys: Vec<Pubkey> = vec![];
create_test_accounts(&accounts, &mut pubkeys, 60000, 0);
let num_accounts = 60_000;
let slot = 0;
create_test_accounts(&accounts, &mut pubkeys, num_accounts, slot);
let ancestors = vec![(0, 0)].into_iter().collect();
accounts.accounts_db.update_accounts_hash(0, &ancestors);
bencher.iter(|| assert!(accounts.verify_bank_hash(0, &ancestors)));
let (_, total_lamports) = accounts.accounts_db.update_accounts_hash(0, &ancestors);
bencher.iter(|| assert!(accounts.verify_bank_hash_and_lamports(0, &ancestors, total_lamports)));
}
#[bench]

View File

@@ -428,9 +428,32 @@ impl Accounts {
accounts_balances
}
pub fn calculate_capitalization(&self, ancestors: &Ancestors) -> u64 {
let balances = self
.load_all(ancestors)
.into_iter()
.map(|(_pubkey, account, _slot)| {
AccountsDB::account_balance_for_capitalization(
account.lamports,
&account.owner,
account.executable,
)
});
AccountsDB::checked_sum_for_capitalization(balances)
}
#[must_use]
pub fn verify_bank_hash(&self, slot: Slot, ancestors: &Ancestors) -> bool {
if let Err(err) = self.accounts_db.verify_bank_hash(slot, ancestors) {
pub fn verify_bank_hash_and_lamports(
&self,
slot: Slot,
ancestors: &Ancestors,
total_lamports: u64,
) -> bool {
if let Err(err) =
self.accounts_db
.verify_bank_hash_and_lamports(slot, ancestors, total_lamports)
{
warn!("verify_bank_hash failed: {:?}", err);
false
} else {
@@ -460,13 +483,13 @@ impl Accounts {
pub fn load_by_program(
&self,
ancestors: &Ancestors,
program_id: Option<&Pubkey>,
program_id: &Pubkey,
) -> Vec<(Pubkey, Account)> {
self.accounts_db.scan_accounts(
ancestors,
|collector: &mut Vec<(Pubkey, Account)>, some_account_tuple| {
Self::load_while_filtering(collector, some_account_tuple, |account| {
program_id.is_none() || Some(&account.owner) == program_id
account.owner == *program_id
})
},
)

Some files were not shown because too many files have changed in this diff Show More