From 0a21c674a1e0fd25f77f223aa60de8626b64bc77 Mon Sep 17 00:00:00 2001
From: Lucas B
Date: Thu, 25 Aug 2022 17:18:46 -0500
Subject: [PATCH] jito patch only reroute if relayer connected (#123) feat: add
client tls config (#121) remove extra val (#129) fix clippy (#130) copy all
binaries to docker-output (#131) Ledger tool halts at slot passed to
create-snapshot (#118) update program submodule (#133) quick fix for tips and
clearing old bundles (#135) update submodule to new program (#136) Improve
stake-meta-generator usability (#134) pinning submodule head (#140) Use
BundleAccountLocker when handling tip txs (#147) Add metrics for relayer +
block engine proxy (#149) Build claim-mev in docker (#141) Rework bundle
receiving and add metrics (#152) (#154) update submodule + dev files (#158)
Deterministically find tip amounts, add meta to stake info, and cleanup
pubkey/strings in MEV tips (#159) update jito-programs submodule (#160)
Separate MEV tip related workflow (#161) Add block builder fee protos (#162)
fix jito programs (#163) update submodule so autosnapshot exits out of ledger
tool early (#164) Pipe through block builder fee (#167) use current config
block builder backport 177 and update programs (#178) add accountsdb conn
submod (#170) (#179) new submodules (#180) (#182) Fixed broken links to
repositories (#184) (#185) Changed from ssh to https transfer for clone
Co-authored-by: Tomas Eminger
<86430113+Tomas-Eminger@users.noreply.github.com> Seg/v1.13 backport (#191)
rm dangling geyser references (#194) fix syntax err (#196) Seg/v1.13 backport
(#198)
---
.dockerignore | 1 +
.github/dependabot.yml | 41 -
.github/workflows/client-targets.yml | 6 +-
.gitignore | 5 +-
.gitmodules | 9 +
Cargo.lock | 569 ++++-
Cargo.toml | 5 +
README.md | 12 +-
anchor | 1 +
banking-bench/Cargo.toml | 2 +-
banking-bench/src/main.rs | 15 +-
banks-server/Cargo.toml | 4 +
banks-server/src/banks_server.rs | 5 +-
banks-server/src/rpc_banks_service.rs | 33 +-
bootstrap | 21 +
ci/buildkite-pipeline-in-disk.sh | 34 +-
ci/buildkite-pipeline.sh | 34 +-
ci/buildkite-solana-private.sh | 32 +-
ci/docker-rust/Dockerfile | 1 +
client/src/http_sender.rs | 202 +-
client/src/mock_sender.rs | 7 +
client/src/nonblocking/rpc_client.rs | 124 +-
client/src/rpc_client.rs | 30 +
client/src/rpc_config.rs | 45 +
client/src/rpc_request.rs | 3 +
client/src/rpc_response.rs | 50 +-
client/src/rpc_sender.rs | 4 +
core/Cargo.toml | 19 +-
core/benches/banking_stage.rs | 17 +-
core/benches/cluster_info.rs | 1 +
core/benches/proto_to_packet.rs | 56 +
core/benches/retransmit_stage.rs | 1 +
core/src/backoff.rs | 45 +
core/src/banking_stage.rs | 177 +-
core/src/broadcast_stage.rs | 62 +-
.../broadcast_duplicates_run.rs | 3 +-
.../broadcast_fake_shreds_run.rs | 2 +
core/src/broadcast_stage/broadcast_utils.rs | 37 +-
.../fail_entry_verification_broadcast_run.rs | 4 +-
.../broadcast_stage/standard_broadcast_run.rs | 18 +-
core/src/bundle_account_locker.rs | 334 +++
core/src/bundle_sanitizer.rs | 612 ++++++
core/src/bundle_stage.rs | 1943 +++++++++++++++++
core/src/bundle_stage_leader_stats.rs | 326 +++
core/src/consensus_cache_updater.rs | 52 +
core/src/lib.rs | 48 +
core/src/packet_bundle.rs | 7 +
core/src/proxy/auth.rs | 247 +++
core/src/proxy/block_engine_stage.rs | 383 ++++
core/src/proxy/fetch_stage_manager.rs | 161 ++
core/src/proxy/mod.rs | 55 +
core/src/proxy/relayer_stage.rs | 362 +++
core/src/qos_service.rs | 2 +-
core/src/retransmit_stage.rs | 12 +-
core/src/tip_manager.rs | 473 ++++
core/src/tpu.rs | 121 +-
core/src/tvu.rs | 7 +-
core/src/validator.rs | 23 +-
core/tests/snapshots.rs | 2 +
deploy_programs | 17 +
dev/Dockerfile | 41 +
dos/Cargo.toml | 2 +-
entry/src/entry.rs | 2 +-
entry/src/poh.rs | 29 +-
f | 25 +
frozen-abi/Cargo.toml | 2 +-
gossip/src/cluster_info.rs | 4 +
jito-programs | 1 +
jito-protos/Cargo.toml | 16 +
jito-protos/build.rs | 17 +
jito-protos/protos | 1 +
jito-protos/src/lib.rs | 25 +
ledger-tool/Cargo.toml | 2 +-
ledger-tool/src/main.rs | 6 +
ledger/src/bank_forks_utils.rs | 11 +-
ledger/src/blockstore_processor.rs | 5 +-
ledger/src/token_balances.rs | 58 +-
.../src/local_cluster_snapshot_utils.rs | 3 +-
local-cluster/src/validator_configs.rs | 4 +
local-cluster/tests/local_cluster.rs | 8 +-
logger/Cargo.toml | 2 +-
measure/src/lib.rs | 1 +
measure/src/macros.rs | 143 ++
merkle-tree/src/merkle_tree.rs | 46 +-
multinode-demo/bootstrap-validator.sh | 36 +
multinode-demo/validator.sh | 32 +
perf/src/sigverify.rs | 2 +-
poh/src/poh_recorder.rs | 117 +-
poh/src/poh_service.rs | 34 +-
programs/bpf/Cargo.lock | 699 ++++--
programs/bpf/tests/programs.rs | 4 +-
replica-node/src/replica_node.rs | 1 +
replica-node/src/replica_util.rs | 7 +-
replica-node/tests/local_replica.rs | 2 +-
rpc/src/rpc.rs | 438 +++-
rpc/src/rpc_service.rs | 11 +-
runtime/Cargo.toml | 6 +-
runtime/src/account_overrides.rs | 22 +-
runtime/src/accounts.rs | 96 +-
runtime/src/bank.rs | 1150 +++++++++-
runtime/src/builtins.rs | 2 +-
runtime/src/snapshot_utils.rs | 50 +-
runtime/src/stakes.rs | 4 +-
rustfmt.toml | 5 +
s | 15 +
scripts/increment-cargo-version.sh | 2 +
scripts/run.sh | 5 +
sdk/Cargo.toml | 3 +
sdk/src/bundle/error.rs | 51 +
sdk/src/bundle/mod.rs | 12 +
sdk/src/bundle/sanitized.rs | 8 +
sdk/src/bundle/utils.rs | 20 +
sdk/src/lib.rs | 1 +
sdk/src/transaction/error.rs | 8 +
send-transaction-service/Cargo.toml | 3 +-
.../src/send_transaction_service.rs | 39 +-
start | 9 +
start_multi | 29 +
storage-proto/proto/transaction_by_addr.proto | 2 +
storage-proto/src/convert.rs | 8 +
tip-distributor/Cargo.toml | 48 +
tip-distributor/README.md | 43 +
tip-distributor/src/bin/claim-mev-tips.rs | 52 +
.../src/bin/merkle-root-generator.rs | 29 +
.../src/bin/merkle-root-uploader.rs | 50 +
.../src/bin/stake-meta-generator.rs | 67 +
tip-distributor/src/claim_mev_workflow.rs | 143 ++
tip-distributor/src/lib.rs | 779 +++++++
.../src/merkle_root_generator_workflow.rs | 49 +
.../src/merkle_root_upload_workflow.rs | 126 ++
.../src/stake_meta_generator_workflow.rs | 841 +++++++
validator/Cargo.toml | 1 +
validator/src/bootstrap.rs | 3 +-
validator/src/dashboard.rs | 1 +
validator/src/main.rs | 257 ++-
135 files changed, 12096 insertions(+), 704 deletions(-)
create mode 100644 .dockerignore
delete mode 100644 .github/dependabot.yml
create mode 100644 .gitmodules
create mode 160000 anchor
create mode 100755 bootstrap
create mode 100644 core/benches/proto_to_packet.rs
create mode 100644 core/src/backoff.rs
create mode 100644 core/src/bundle_account_locker.rs
create mode 100644 core/src/bundle_sanitizer.rs
create mode 100644 core/src/bundle_stage.rs
create mode 100644 core/src/bundle_stage_leader_stats.rs
create mode 100644 core/src/consensus_cache_updater.rs
create mode 100644 core/src/packet_bundle.rs
create mode 100644 core/src/proxy/auth.rs
create mode 100644 core/src/proxy/block_engine_stage.rs
create mode 100644 core/src/proxy/fetch_stage_manager.rs
create mode 100644 core/src/proxy/mod.rs
create mode 100644 core/src/proxy/relayer_stage.rs
create mode 100644 core/src/tip_manager.rs
create mode 100755 deploy_programs
create mode 100644 dev/Dockerfile
create mode 100755 f
create mode 160000 jito-programs
create mode 100644 jito-protos/Cargo.toml
create mode 100644 jito-protos/build.rs
create mode 160000 jito-protos/protos
create mode 100644 jito-protos/src/lib.rs
create mode 100644 measure/src/macros.rs
create mode 100755 s
create mode 100644 sdk/src/bundle/error.rs
create mode 100644 sdk/src/bundle/mod.rs
create mode 100644 sdk/src/bundle/sanitized.rs
create mode 100644 sdk/src/bundle/utils.rs
create mode 100755 start
create mode 100755 start_multi
create mode 100644 tip-distributor/Cargo.toml
create mode 100644 tip-distributor/README.md
create mode 100644 tip-distributor/src/bin/claim-mev-tips.rs
create mode 100644 tip-distributor/src/bin/merkle-root-generator.rs
create mode 100644 tip-distributor/src/bin/merkle-root-uploader.rs
create mode 100644 tip-distributor/src/bin/stake-meta-generator.rs
create mode 100644 tip-distributor/src/claim_mev_workflow.rs
create mode 100644 tip-distributor/src/lib.rs
create mode 100644 tip-distributor/src/merkle_root_generator_workflow.rs
create mode 100644 tip-distributor/src/merkle_root_upload_workflow.rs
create mode 100644 tip-distributor/src/stake_meta_generator_workflow.rs
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000000..2f7896d1d1
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1 @@
+target/
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
deleted file mode 100644
index c2fc36a3e6..0000000000
--- a/.github/dependabot.yml
+++ /dev/null
@@ -1,41 +0,0 @@
-# To get started with Dependabot version updates, you'll need to specify which
-# package ecosystems to update and where the package manifests are located.
-# Please see the documentation for all configuration options:
-# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
-
-version: 2
-updates:
-- package-ecosystem: cargo
- directory: "/"
- schedule:
- interval: daily
- time: "01:00"
- timezone: America/Los_Angeles
- #labels:
- # - "automerge"
- open-pull-requests-limit: 3
-
-- package-ecosystem: npm
- directory: "/web3.js"
- schedule:
- interval: daily
- time: "01:00"
- timezone: America/Los_Angeles
- labels:
- - "automerge"
- commit-message:
- prefix: "chore:"
- open-pull-requests-limit: 3
-
-- package-ecosystem: npm
- directory: "/explorer"
- schedule:
- interval: daily
- time: "01:00"
- timezone: America/Los_Angeles
- labels:
- - "automerge"
- commit-message:
- prefix: "chore:"
- include: "scope"
- open-pull-requests-limit: 3
diff --git a/.github/workflows/client-targets.yml b/.github/workflows/client-targets.yml
index 88b160b448..dd0b67d17a 100644
--- a/.github/workflows/client-targets.yml
+++ b/.github/workflows/client-targets.yml
@@ -45,8 +45,10 @@ jobs:
platform: android
os: ubuntu-latest
steps:
- - name: Checkout code
- uses: actions/checkout@v2
+ - uses: actions/checkout@v3
+ with:
+ submodules: recursive
+ ssh-key: ${{ secrets.DEPLOYER_SSH_KEY }}
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
diff --git a/.gitignore b/.gitignore
index 124358b46f..92281a9a08 100644
--- a/.gitignore
+++ b/.gitignore
@@ -3,7 +3,7 @@
/solana-release.tar.bz2
/solana-metrics/
/solana-metrics.tar.bz2
-/target/
+**/target/
/test-ledger/
**/*.rs.bk
@@ -30,3 +30,6 @@ log-*/
.DS_Store
# scripts that may be generated by cargo *-bpf commands
**/cargo-*-bpf-child-script-*.sh
+
+.env
+docker-output/
diff --git a/.gitmodules b/.gitmodules
new file mode 100644
index 0000000000..e31fc7fccd
--- /dev/null
+++ b/.gitmodules
@@ -0,0 +1,9 @@
+[submodule "anchor"]
+ path = anchor
+ url = https://github.com/jito-foundation/anchor.git
+[submodule "jito-programs"]
+ path = jito-programs
+ url = https://github.com/jito-foundation/jito-programs.git
+[submodule "jito-protos/protos"]
+ path = jito-protos/protos
+ url = https://github.com/jito-labs/mev-protos.git
diff --git a/Cargo.lock b/Cargo.lock
index ee14f8cc60..9572de53c7 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -95,6 +95,145 @@ dependencies = [
"alloc-no-stdlib",
]
+[[package]]
+name = "anchor-attribute-access-control"
+version = "0.24.2"
+dependencies = [
+ "anchor-syn",
+ "anyhow",
+ "proc-macro2 1.0.32",
+ "quote 1.0.10",
+ "regex",
+ "syn 1.0.91",
+]
+
+[[package]]
+name = "anchor-attribute-account"
+version = "0.24.2"
+dependencies = [
+ "anchor-syn",
+ "anyhow",
+ "bs58 0.4.0",
+ "proc-macro2 1.0.32",
+ "quote 1.0.10",
+ "rustversion",
+ "syn 1.0.91",
+]
+
+[[package]]
+name = "anchor-attribute-constant"
+version = "0.24.2"
+dependencies = [
+ "anchor-syn",
+ "proc-macro2 1.0.32",
+ "syn 1.0.91",
+]
+
+[[package]]
+name = "anchor-attribute-error"
+version = "0.24.2"
+dependencies = [
+ "anchor-syn",
+ "proc-macro2 1.0.32",
+ "quote 1.0.10",
+ "syn 1.0.91",
+]
+
+[[package]]
+name = "anchor-attribute-event"
+version = "0.24.2"
+dependencies = [
+ "anchor-syn",
+ "anyhow",
+ "proc-macro2 1.0.32",
+ "quote 1.0.10",
+ "syn 1.0.91",
+]
+
+[[package]]
+name = "anchor-attribute-interface"
+version = "0.24.2"
+dependencies = [
+ "anchor-syn",
+ "anyhow",
+ "heck 0.3.3",
+ "proc-macro2 1.0.32",
+ "quote 1.0.10",
+ "syn 1.0.91",
+]
+
+[[package]]
+name = "anchor-attribute-program"
+version = "0.24.2"
+dependencies = [
+ "anchor-syn",
+ "anyhow",
+ "proc-macro2 1.0.32",
+ "quote 1.0.10",
+ "syn 1.0.91",
+]
+
+[[package]]
+name = "anchor-attribute-state"
+version = "0.24.2"
+dependencies = [
+ "anchor-syn",
+ "anyhow",
+ "proc-macro2 1.0.32",
+ "quote 1.0.10",
+ "syn 1.0.91",
+]
+
+[[package]]
+name = "anchor-derive-accounts"
+version = "0.24.2"
+dependencies = [
+ "anchor-syn",
+ "anyhow",
+ "proc-macro2 1.0.32",
+ "quote 1.0.10",
+ "syn 1.0.91",
+]
+
+[[package]]
+name = "anchor-lang"
+version = "0.24.2"
+dependencies = [
+ "anchor-attribute-access-control",
+ "anchor-attribute-account",
+ "anchor-attribute-constant",
+ "anchor-attribute-error",
+ "anchor-attribute-event",
+ "anchor-attribute-interface",
+ "anchor-attribute-program",
+ "anchor-attribute-state",
+ "anchor-derive-accounts",
+ "arrayref",
+ "base64 0.13.0",
+ "bincode",
+ "borsh",
+ "bytemuck",
+ "solana-program 1.13.7",
+ "thiserror",
+]
+
+[[package]]
+name = "anchor-syn"
+version = "0.24.2"
+dependencies = [
+ "anyhow",
+ "bs58 0.3.1",
+ "heck 0.3.3",
+ "proc-macro2 1.0.32",
+ "proc-macro2-diagnostics",
+ "quote 1.0.10",
+ "serde",
+ "serde_json",
+ "sha2 0.9.9",
+ "syn 1.0.91",
+ "thiserror",
+]
+
[[package]]
name = "ansi_term"
version = "0.11.0"
@@ -175,9 +314,9 @@ dependencies = [
[[package]]
name = "assert_cmd"
-version = "2.0.4"
+version = "2.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "93ae1ddd39efd67689deb1979d80bad3bf7f2b09c6e6117c8d1f2443b5e2f83e"
+checksum = "d5c2ca00549910ec251e3bd15f87aeeb206c9456b9a77b43ff6c97c54042a472"
dependencies = [
"bstr",
"doc-comment",
@@ -348,6 +487,17 @@ version = "1.3.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "874f8444adcb4952a8bc51305c8be95c8ec8237bb0d2e78d2e039f771f8828a0"
+[[package]]
+name = "bigdecimal"
+version = "0.3.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "6aaf33151a6429fe9211d1b276eafdf70cdff28b071e76c0b0e1503221ea3744"
+dependencies = [
+ "num-bigint 0.4.2",
+ "num-integer",
+ "num-traits",
+]
+
[[package]]
name = "bincode"
version = "1.3.3"
@@ -544,6 +694,12 @@ dependencies = [
"alloc-stdlib",
]
+[[package]]
+name = "bs58"
+version = "0.3.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "476e9cd489f9e121e02ffa6014a8ef220ecb15c05ed23fc34cca13925dc283fb"
+
[[package]]
name = "bs58"
version = "0.4.0"
@@ -809,26 +965,26 @@ dependencies = [
[[package]]
name = "clap"
-version = "3.1.6"
+version = "3.2.23"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d8c93436c21e4698bacadf42917db28b23017027a4deccb35dbe47a7e7840123"
+checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5"
dependencies = [
"atty",
"bitflags",
"clap_derive",
+ "clap_lex",
"indexmap",
- "lazy_static",
- "os_str_bytes",
+ "once_cell",
"strsim 0.10.0",
"termcolor",
- "textwrap 0.15.0",
+ "textwrap 0.16.0",
]
[[package]]
name = "clap_derive"
-version = "3.1.4"
+version = "3.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "da95d038ede1a964ce99f49cbe27a7fb538d1da595e4b4f70b8c8f338d17bf16"
+checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65"
dependencies = [
"heck 0.4.0",
"proc-macro-error",
@@ -837,6 +993,15 @@ dependencies = [
"syn 1.0.91",
]
+[[package]]
+name = "clap_lex"
+version = "0.2.4"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5"
+dependencies = [
+ "os_str_bytes",
+]
+
[[package]]
name = "cmake"
version = "0.1.46"
@@ -1168,17 +1333,6 @@ version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6e5c37193a1db1d8ed868c03ec7b152175f26160a5b740e5e484143877e0adf0"
-[[package]]
-name = "derivative"
-version = "2.2.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b"
-dependencies = [
- "proc-macro2 1.0.32",
- "quote 1.0.10",
- "syn 1.0.91",
-]
-
[[package]]
name = "derive_more"
version = "0.99.16"
@@ -1546,6 +1700,12 @@ dependencies = [
"winapi 0.3.9",
]
+[[package]]
+name = "fixedbitset"
+version = "0.2.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d"
+
[[package]]
name = "fixedbitset"
version = "0.4.0"
@@ -2234,6 +2394,19 @@ version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1aab8fc367588b89dcee83ab0fd66b72b50b72fa1904d7095045ace2b0c81c35"
+[[package]]
+name = "jito-protos"
+version = "1.13.7"
+dependencies = [
+ "bytes",
+ "crossbeam-epoch",
+ "lock_api",
+ "prost 0.8.0",
+ "prost-types 0.8.0",
+ "tonic 0.5.2",
+ "tonic-build 0.5.2",
+]
+
[[package]]
name = "jobserver"
version = "0.1.24"
@@ -2529,9 +2702,9 @@ dependencies = [
[[package]]
name = "log"
-version = "0.4.14"
+version = "0.4.17"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "51b9bbe6c47d51fc3e1a9b945965946b4c44142ab8792c50835a980d362c2710"
+checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e"
dependencies = [
"cfg-if 1.0.0",
]
@@ -2862,9 +3035,9 @@ dependencies = [
[[package]]
name = "num-traits"
-version = "0.2.14"
+version = "0.2.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "9a64b1ec5cda2586e284722486d802acf1f7dbdc623e2bfc57e65ca1cd099290"
+checksum = "578ede34cf02f8924ab9447f50c28075b4d3e5b269972345e7e0372b38c6cdcd"
dependencies = [
"autocfg",
]
@@ -2881,19 +3054,18 @@ dependencies = [
[[package]]
name = "num_enum"
-version = "0.5.4"
+version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "3f9bd055fb730c4f8f4f57d45d35cd6b3f0980535b056dc7ff119cee6a66ed6f"
+checksum = "cf5395665662ef45796a4ff5486c5d41d29e0c09640af4c5f17fd94ee2c119c9"
dependencies = [
- "derivative",
"num_enum_derive",
]
[[package]]
name = "num_enum_derive"
-version = "0.5.4"
+version = "0.5.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "486ea01961c4a818096de679a8b740b26d9033146ac5291b1c98557658f8cdd9"
+checksum = "3b0498641e53dd6ac1a4f22547548caa6864cc4933784319cd1775271c5a46ce"
dependencies = [
"proc-macro-crate 1.1.0",
"proc-macro2 1.0.32",
@@ -2927,9 +3099,9 @@ dependencies = [
[[package]]
name = "once_cell"
-version = "1.8.0"
+version = "1.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "692fcb63b64b1758029e0a96ee63e049ce8c5948587f2f7208df04625e5f6b56"
+checksum = "86f0b0d4bf799edbc74508c1e8bf170ff5f41238e5f8225603ca7caaae2b7860"
[[package]]
name = "opaque-debug"
@@ -3020,9 +3192,6 @@ name = "os_str_bytes"
version = "6.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8e22443d1643a904602595ba1cd8f7d896afe56d26712531c5ff73a15b2fbf64"
-dependencies = [
- "memchr",
-]
[[package]]
name = "ouroboros"
@@ -3207,13 +3376,23 @@ dependencies = [
"sha-1 0.8.2",
]
+[[package]]
+name = "petgraph"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7"
+dependencies = [
+ "fixedbitset 0.2.0",
+ "indexmap",
+]
+
[[package]]
name = "petgraph"
version = "0.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4a13a2fa9d0b63e5f22328828741e523766fff0ee9e779316902290dff3f824f"
dependencies = [
- "fixedbitset",
+ "fixedbitset 0.4.0",
"indexmap",
]
@@ -3413,6 +3592,19 @@ dependencies = [
"unicode-xid 0.2.2",
]
+[[package]]
+name = "proc-macro2-diagnostics"
+version = "0.9.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "4bf29726d67464d49fa6224a1d07936a8c08bb3fba727c7493f6cf1616fdaada"
+dependencies = [
+ "proc-macro2 1.0.32",
+ "quote 1.0.10",
+ "syn 1.0.91",
+ "version_check",
+ "yansi",
+]
+
[[package]]
name = "proptest"
version = "1.0.0"
@@ -3433,6 +3625,16 @@ dependencies = [
"tempfile",
]
+[[package]]
+name = "prost"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020"
+dependencies = [
+ "bytes",
+ "prost-derive 0.8.0",
+]
+
[[package]]
name = "prost"
version = "0.9.0"
@@ -3453,6 +3655,24 @@ dependencies = [
"prost-derive 0.10.0",
]
+[[package]]
+name = "prost-build"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603"
+dependencies = [
+ "bytes",
+ "heck 0.3.3",
+ "itertools",
+ "log",
+ "multimap",
+ "petgraph 0.5.1",
+ "prost 0.8.0",
+ "prost-types 0.8.0",
+ "tempfile",
+ "which",
+]
+
[[package]]
name = "prost-build"
version = "0.9.0"
@@ -3465,7 +3685,7 @@ dependencies = [
"lazy_static",
"log",
"multimap",
- "petgraph",
+ "petgraph 0.6.0",
"prost 0.9.0",
"prost-types 0.9.0",
"regex",
@@ -3487,7 +3707,7 @@ dependencies = [
"lazy_static",
"log",
"multimap",
- "petgraph",
+ "petgraph 0.6.0",
"prost 0.10.0",
"prost-types 0.10.0",
"regex",
@@ -3495,6 +3715,19 @@ dependencies = [
"which",
]
+[[package]]
+name = "prost-derive"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba"
+dependencies = [
+ "anyhow",
+ "itertools",
+ "proc-macro2 1.0.32",
+ "quote 1.0.10",
+ "syn 1.0.91",
+]
+
[[package]]
name = "prost-derive"
version = "0.9.0"
@@ -3521,6 +3754,16 @@ dependencies = [
"syn 1.0.91",
]
+[[package]]
+name = "prost-types"
+version = "0.8.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b"
+dependencies = [
+ "bytes",
+ "prost 0.8.0",
+]
+
[[package]]
name = "prost-types"
version = "0.9.0"
@@ -3592,7 +3835,7 @@ dependencies = [
"rand 0.8.4",
"ring",
"rustls 0.20.4",
- "rustls-native-certs",
+ "rustls-native-certs 0.6.1",
"rustls-pemfile 0.2.1",
"slab",
"thiserror",
@@ -3785,11 +4028,10 @@ checksum = "5cb37e7b5c272e9d7d75d3ab9d4f3a028edfbb4e99a2f35ec887057ea51656ad"
[[package]]
name = "rayon"
-version = "1.5.1"
+version = "1.6.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "c06aca804d41dbc8ba42dfd964f0d01334eceb64314b9ecf7c5fad5188a06d90"
+checksum = "1e060280438193c554f654141c9ea9417886713b7acd75974c85b18a69a88e0b"
dependencies = [
- "autocfg",
"crossbeam-deque",
"either",
"rayon-core",
@@ -3797,14 +4039,13 @@ dependencies = [
[[package]]
name = "rayon-core"
-version = "1.9.1"
+version = "1.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "d78120e2c850279833f1dd3582f730c4ab53ed95aeaaaa862a2a5c71b1656d8e"
+checksum = "7ebf1bc4b691de61bd5a8ba170bfd6a1d363ff3cb595a51798d107aab25d2466"
dependencies = [
"crossbeam-channel",
"crossbeam-deque",
"crossbeam-utils",
- "lazy_static",
"num_cpus",
]
@@ -3812,7 +4053,7 @@ dependencies = [
name = "rbpf-cli"
version = "1.13.7"
dependencies = [
- "clap 3.1.6",
+ "clap 3.2.23",
"serde",
"serde_json",
"solana-bpf-loader-program",
@@ -3947,7 +4188,7 @@ dependencies = [
"wasm-bindgen",
"wasm-bindgen-futures",
"web-sys",
- "webpki-roots",
+ "webpki-roots 0.22.1",
"winreg",
]
@@ -4081,6 +4322,18 @@ dependencies = [
"webpki 0.22.0",
]
+[[package]]
+name = "rustls-native-certs"
+version = "0.5.0"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "5a07b7c1885bd8ed3831c289b7870b13ef46fe0e856d288c30d9cc17d75a2092"
+dependencies = [
+ "openssl-probe",
+ "rustls 0.19.1",
+ "schannel",
+ "security-framework",
+]
+
[[package]]
name = "rustls-native-certs"
version = "0.6.1"
@@ -4267,9 +4520,9 @@ dependencies = [
[[package]]
name = "serde"
-version = "1.0.136"
+version = "1.0.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "ce31e24b01e1e524df96f1c2fdd054405f8d7376249a5110886fb4b658484789"
+checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965"
dependencies = [
"serde_derive",
]
@@ -4295,9 +4548,9 @@ dependencies = [
[[package]]
name = "serde_derive"
-version = "1.0.136"
+version = "1.0.147"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "08597e7152fcd306f41838ed3e37be9eaeed2b61c42e2117266a554fab4662f9"
+checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852"
dependencies = [
"proc-macro2 1.0.32",
"quote 1.0.10",
@@ -4306,9 +4559,9 @@ dependencies = [
[[package]]
name = "serde_json"
-version = "1.0.79"
+version = "1.0.88"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "8e8d9fa5c3b304765ce1fd9c4c8a3de2c8db365a5b91be52f186efc675681d95"
+checksum = "8e8b3801309262e8184d9687fb697586833e939767aea0dda89f5a8e650e8bd7"
dependencies = [
"itoa 1.0.1",
"ryu",
@@ -4567,7 +4820,7 @@ dependencies = [
"Inflector",
"base64 0.13.0",
"bincode",
- "bs58",
+ "bs58 0.4.0",
"bv",
"lazy_static",
"serde",
@@ -4657,7 +4910,7 @@ dependencies = [
name = "solana-banking-bench"
version = "1.13.7"
dependencies = [
- "clap 3.1.6",
+ "clap 3.2.23",
"crossbeam-channel",
"log",
"rand 0.7.3",
@@ -4711,9 +4964,11 @@ dependencies = [
"futures 0.3.21",
"solana-banks-interface",
"solana-client",
+ "solana-gossip",
"solana-runtime",
"solana-sdk 1.13.7",
"solana-send-transaction-service",
+ "solana-streamer",
"tarpc",
"tokio",
"tokio-serde",
@@ -4821,7 +5076,7 @@ version = "1.13.7"
dependencies = [
"bzip2",
"cargo_metadata",
- "clap 3.1.6",
+ "clap 3.2.23",
"regex",
"serial_test",
"solana-download-utils",
@@ -4834,7 +5089,7 @@ name = "solana-cargo-test-bpf"
version = "1.13.7"
dependencies = [
"cargo_metadata",
- "clap 3.1.6",
+ "clap 3.2.23",
]
[[package]]
@@ -4859,7 +5114,7 @@ name = "solana-cli"
version = "1.13.7"
dependencies = [
"bincode",
- "bs58",
+ "bs58 0.4.0",
"clap 2.33.3",
"console",
"const_format",
@@ -4948,7 +5203,7 @@ dependencies = [
"async-trait",
"base64 0.13.0",
"bincode",
- "bs58",
+ "bs58 0.4.0",
"bytes",
"clap 2.33.3",
"crossbeam-channel",
@@ -5048,20 +5303,31 @@ name = "solana-core"
version = "1.13.7"
dependencies = [
"ahash",
+ "anchor-lang",
"base64 0.13.0",
"bincode",
- "bs58",
+ "bs58 0.4.0",
+ "bytes",
"chrono",
+ "clap 3.2.23",
"crossbeam-channel",
"dashmap",
"etcd-client",
"fs_extra",
+ "futures 0.3.21",
+ "futures-util",
"histogram",
+ "indexmap",
"itertools",
+ "jito-protos",
+ "lazy_static",
"log",
"lru",
"matches",
"min-max-heap",
+ "num_enum",
+ "prost 0.8.0",
+ "prost-types 0.8.0",
"rand 0.7.3",
"rand_chacha 0.2.2",
"raptorq",
@@ -5106,8 +5372,14 @@ dependencies = [
"systemstat",
"tempfile",
"thiserror",
+ "tip-distribution",
+ "tip-payment",
"tokio",
+ "tokio-stream",
+ "tonic 0.5.2",
+ "tonic-build 0.5.2",
"trees",
+ "uuid",
]
[[package]]
@@ -5115,7 +5387,7 @@ name = "solana-dos"
version = "1.13.7"
dependencies = [
"bincode",
- "clap 3.1.6",
+ "clap 3.2.23",
"log",
"rand 0.7.3",
"serde",
@@ -5204,7 +5476,7 @@ version = "1.10.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "49a5d3280421bb53fc12bdba1eaa505153fb4f99a06b5609dae22192652ead3b"
dependencies = [
- "bs58",
+ "bs58 0.4.0",
"bv",
"generic-array 0.14.5",
"im",
@@ -5224,7 +5496,7 @@ dependencies = [
name = "solana-frozen-abi"
version = "1.13.7"
dependencies = [
- "bs58",
+ "bs58 0.4.0",
"bv",
"generic-array 0.14.5",
"im",
@@ -5308,7 +5580,7 @@ dependencies = [
name = "solana-geyser-plugin-manager"
version = "1.13.7"
dependencies = [
- "bs58",
+ "bs58 0.4.0",
"crossbeam-channel",
"json5",
"libloading",
@@ -5406,7 +5678,7 @@ dependencies = [
name = "solana-keygen"
version = "1.13.7"
dependencies = [
- "bs58",
+ "bs58 0.4.0",
"clap 2.33.3",
"dirs-next",
"num_cpus",
@@ -5735,7 +6007,7 @@ dependencies = [
"blake3",
"borsh",
"borsh-derive",
- "bs58",
+ "bs58 0.4.0",
"bv",
"bytemuck",
"console_error_panic_hook",
@@ -5777,7 +6049,7 @@ dependencies = [
"blake3",
"borsh",
"borsh-derive",
- "bs58",
+ "bs58 0.4.0",
"bv",
"bytemuck",
"console_error_panic_hook",
@@ -5934,7 +6206,7 @@ version = "1.13.7"
dependencies = [
"base64 0.13.0",
"bincode",
- "bs58",
+ "bs58 0.4.0",
"crossbeam-channel",
"dashmap",
"itertools",
@@ -5988,7 +6260,7 @@ name = "solana-rpc-test"
version = "1.13.7"
dependencies = [
"bincode",
- "bs58",
+ "bs58 0.4.0",
"crossbeam-channel",
"futures-util",
"log",
@@ -6079,7 +6351,7 @@ dependencies = [
"bincode",
"bitflags",
"borsh",
- "bs58",
+ "bs58 0.4.0",
"bytemuck",
"byteorder",
"chrono",
@@ -6123,13 +6395,14 @@ dependencies = [
name = "solana-sdk"
version = "1.13.7"
dependencies = [
+ "anchor-lang",
"anyhow",
"assert_matches",
"base64 0.13.0",
"bincode",
"bitflags",
"borsh",
- "bs58",
+ "bs58 0.4.0",
"bytemuck",
"byteorder",
"chrono",
@@ -6168,6 +6441,7 @@ dependencies = [
"thiserror",
"tiny-bip39",
"uriparse",
+ "uuid",
"wasm-bindgen",
]
@@ -6177,7 +6451,7 @@ version = "1.10.33"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b8bcac4394644f21dc013e932a7df9f536fcecef3e5df43fe362b4ec532ce30"
dependencies = [
- "bs58",
+ "bs58 0.4.0",
"proc-macro2 1.0.32",
"quote 1.0.10",
"rustversion",
@@ -6188,7 +6462,7 @@ dependencies = [
name = "solana-sdk-macro"
version = "1.13.7"
dependencies = [
- "bs58",
+ "bs58 0.4.0",
"proc-macro2 1.0.32",
"quote 1.0.10",
"rustversion",
@@ -6202,11 +6476,13 @@ dependencies = [
"crossbeam-channel",
"log",
"solana-client",
+ "solana-gossip",
"solana-logger 1.13.7",
"solana-measure",
"solana-metrics",
"solana-runtime",
"solana-sdk 1.13.7",
+ "solana-streamer",
]
[[package]]
@@ -6283,7 +6559,7 @@ name = "solana-storage-proto"
version = "1.13.7"
dependencies = [
"bincode",
- "bs58",
+ "bs58 0.4.0",
"enum-iterator",
"prost 0.10.0",
"serde",
@@ -6370,6 +6646,36 @@ dependencies = [
"tokio",
]
+[[package]]
+name = "solana-tip-distributor"
+version = "1.13.7"
+dependencies = [
+ "anchor-lang",
+ "bigdecimal",
+ "clap 3.2.23",
+ "env_logger",
+ "futures 0.3.21",
+ "im",
+ "itertools",
+ "log",
+ "num-traits",
+ "serde",
+ "serde_json",
+ "solana-client",
+ "solana-genesis-utils",
+ "solana-ledger",
+ "solana-merkle-tree",
+ "solana-program 1.13.7",
+ "solana-rpc",
+ "solana-runtime",
+ "solana-sdk 1.13.7",
+ "solana-stake-program",
+ "thiserror",
+ "tip-distribution",
+ "tip-payment",
+ "tokio",
+]
+
[[package]]
name = "solana-tokens"
version = "1.13.7"
@@ -6435,7 +6741,7 @@ dependencies = [
"base64 0.13.0",
"bincode",
"borsh",
- "bs58",
+ "bs58 0.4.0",
"lazy_static",
"log",
"serde",
@@ -6511,6 +6817,7 @@ dependencies = [
"solana-vote-program",
"symlink",
"tikv-jemallocator",
+ "tonic 0.5.2",
]
[[package]]
@@ -7041,24 +7348,24 @@ dependencies = [
[[package]]
name = "textwrap"
-version = "0.15.0"
+version = "0.16.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "b1141d4d61095b28419e22cb0bbf02755f5e54e0526f97f1e3d1d160e60885fb"
+checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d"
[[package]]
name = "thiserror"
-version = "1.0.30"
+version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "854babe52e4df1653706b98fcfc05843010039b406875930a70e4d9644e5c417"
+checksum = "10deb33631e3c9018b9baf9dcbbc4f737320d2b576bac10f6aefa048fa407e3e"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
-version = "1.0.30"
+version = "1.0.37"
source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "aa32fd3f627f367fe16f893e2597ae3c05020f8bba2666a4e6ea73d377e5714b"
+checksum = "982d17546b47146b28f7c22e3d08465f6b8903d0ea13c1660d9d84a6e7adcdbb"
dependencies = [
"proc-macro2 1.0.32",
"quote 1.0.10",
@@ -7201,6 +7508,22 @@ version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c"
+[[package]]
+name = "tip-distribution"
+version = "0.1.0"
+dependencies = [
+ "anchor-lang",
+ "solana-program 1.13.7",
+ "vote-state",
+]
+
+[[package]]
+name = "tip-payment"
+version = "0.1.0"
+dependencies = [
+ "anchor-lang",
+]
+
[[package]]
name = "tokio"
version = "1.14.1"
@@ -7314,7 +7637,7 @@ dependencies = [
"tokio-rustls 0.23.2",
"tungstenite",
"webpki 0.22.0",
- "webpki-roots",
+ "webpki-roots 0.22.1",
]
[[package]]
@@ -7356,6 +7679,40 @@ dependencies = [
"serde",
]
+[[package]]
+name = "tonic"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "796c5e1cd49905e65dd8e700d4cb1dffcbfdb4fc9d017de08c1a537afd83627c"
+dependencies = [
+ "async-stream",
+ "async-trait",
+ "base64 0.13.0",
+ "bytes",
+ "futures-core",
+ "futures-util",
+ "h2",
+ "http",
+ "http-body",
+ "hyper",
+ "hyper-timeout",
+ "percent-encoding 2.1.0",
+ "pin-project",
+ "prost 0.8.0",
+ "prost-derive 0.8.0",
+ "rustls-native-certs 0.5.0",
+ "tokio",
+ "tokio-rustls 0.22.0",
+ "tokio-stream",
+ "tokio-util 0.6.9",
+ "tower",
+ "tower-layer",
+ "tower-service",
+ "tracing",
+ "tracing-futures",
+ "webpki-roots 0.21.1",
+]
+
[[package]]
name = "tonic"
version = "0.6.2"
@@ -7422,6 +7779,18 @@ dependencies = [
"tracing-futures",
]
+[[package]]
+name = "tonic-build"
+version = "0.5.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "12b52d07035516c2b74337d2ac7746075e7dcae7643816c1b12c5ff8a7484c08"
+dependencies = [
+ "proc-macro2 1.0.32",
+ "prost-build 0.8.0",
+ "quote 1.0.10",
+ "syn 1.0.91",
+]
+
[[package]]
name = "tonic-build"
version = "0.6.2"
@@ -7595,7 +7964,7 @@ dependencies = [
"url 2.2.2",
"utf-8",
"webpki 0.22.0",
- "webpki-roots",
+ "webpki-roots 0.22.1",
]
[[package]]
@@ -7747,6 +8116,16 @@ version = "0.1.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7cf7d77f457ef8dfa11e4cd5933c5ddb5dc52a94664071951219a97710f0a32b"
+[[package]]
+name = "uuid"
+version = "1.2.2"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "422ee0de9031b5b948b97a8fc04e3aa35230001a722ddd27943e0be31564ce4c"
+dependencies = [
+ "getrandom 0.2.3",
+ "rand 0.8.4",
+]
+
[[package]]
name = "vcpkg"
version = "0.2.15"
@@ -7771,6 +8150,17 @@ version = "1.0.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "6a02e4885ed3bc0f2de90ea6dd45ebcbb66dacffe03547fadbb0eeae2770887d"
+[[package]]
+name = "vote-state"
+version = "0.1.0"
+dependencies = [
+ "anchor-lang",
+ "bincode",
+ "serde",
+ "serde_derive",
+ "solana-program 1.13.7",
+]
+
[[package]]
name = "wait-timeout"
version = "0.2.0"
@@ -7909,6 +8299,15 @@ dependencies = [
"untrusted",
]
+[[package]]
+name = "webpki-roots"
+version = "0.21.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "aabe153544e473b775453675851ecc86863d2a81d786d741f6b76778f2a48940"
+dependencies = [
+ "webpki 0.21.4",
+]
+
[[package]]
name = "webpki-roots"
version = "0.22.1"
@@ -8109,6 +8508,12 @@ dependencies = [
"linked-hash-map",
]
+[[package]]
+name = "yansi"
+version = "0.5.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec"
+
[[package]]
name = "yasna"
version = "0.5.0"
diff --git a/Cargo.toml b/Cargo.toml
index 2f6e9f66f5..a285a21bdc 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -29,6 +29,7 @@ members = [
"geyser-plugin-manager",
"gossip",
"install",
+ "jito-protos",
"keygen",
"ledger",
"ledger-tool",
@@ -75,6 +76,7 @@ members = [
"streamer",
"sys-tuner",
"test-validator",
+ "tip-distributor",
"tokens",
"transaction-dos",
"transaction-status",
@@ -86,7 +88,10 @@ members = [
]
exclude = [
+ "anchor",
+ "jito-programs",
"programs/bpf",
+ "programs/sbf",
]
# This prevents a Travis CI error when building for Windows.
diff --git a/README.md b/README.md
index 496f7dedb2..a01c4c8c88 100644
--- a/README.md
+++ b/README.md
@@ -4,10 +4,14 @@
-[![Solana crate](https://img.shields.io/crates/v/solana-core.svg)](https://crates.io/crates/solana-core)
-[![Solana documentation](https://docs.rs/solana-core/badge.svg)](https://docs.rs/solana-core)
-[![Build status](https://badge.buildkite.com/8cc350de251d61483db98bdfc895b9ea0ac8ffa4a32ee850ed.svg?branch=master)](https://buildkite.com/solana-labs/solana/builds?branch=master)
-[![codecov](https://codecov.io/gh/solana-labs/solana/branch/master/graph/badge.svg)](https://codecov.io/gh/solana-labs/solana)
+[![Build status](https://badge.buildkite.com/a6981eb34c6e0c7c09e3a3cb4bda09579f0ff2dcb1bd74b2ad.svg?branch=master)](https://buildkite.com/jito-labs/jito-solana)
+
+[//]: # ([![Solana crate](https://img.shields.io/crates/v/solana-core.svg)](https://crates.io/crates/solana-core))
+[//]: # ([![Solana documentation](https://docs.rs/solana-core/badge.svg)](https://docs.rs/solana-core))
+[//]: # ([![codecov](https://codecov.io/gh/solana-labs/solana/branch/master/graph/badge.svg)](https://codecov.io/gh/solana-labs/solana))
+
+# About
+This repository contains Jito Foundations's fork of the Solana validator.
# Building
diff --git a/anchor b/anchor
new file mode 160000
index 0000000000..7532647bb8
--- /dev/null
+++ b/anchor
@@ -0,0 +1 @@
+Subproject commit 7532647bb86d26fd7497d9cbc7ac99e2b3941e86
diff --git a/banking-bench/Cargo.toml b/banking-bench/Cargo.toml
index 9cac259c44..0b3cea03c5 100644
--- a/banking-bench/Cargo.toml
+++ b/banking-bench/Cargo.toml
@@ -9,7 +9,7 @@ homepage = "https://solana.com/"
publish = false
[dependencies]
-clap = {version = "3.1.5", features = ["derive", "cargo"]}
+clap = { version = "3.1.5", features = ["derive", "cargo"] }
crossbeam-channel = "0.5"
log = "0.4.14"
rand = "0.7.0"
diff --git a/banking-bench/src/main.rs b/banking-bench/src/main.rs
index e23e881827..20de455b02 100644
--- a/banking-bench/src/main.rs
+++ b/banking-bench/src/main.rs
@@ -6,7 +6,7 @@ use {
rand::{thread_rng, Rng},
rayon::prelude::*,
solana_client::connection_cache::{ConnectionCache, DEFAULT_TPU_CONNECTION_POOL_SIZE},
- solana_core::banking_stage::BankingStage,
+ solana_core::{banking_stage::BankingStage, bundle_account_locker::BundleAccountLocker},
solana_gossip::cluster_info::{ClusterInfo, Node},
solana_ledger::{
blockstore::Blockstore,
@@ -30,6 +30,7 @@ use {
},
solana_streamer::socket::SocketAddrSpace,
std::{
+ collections::HashSet,
sync::{atomic::Ordering, Arc, Mutex, RwLock},
thread::sleep,
time::{Duration, Instant},
@@ -45,9 +46,15 @@ fn check_txs(
let now = Instant::now();
let mut no_bank = false;
loop {
- if let Ok((_bank, (entry, _tick_height))) = receiver.recv_timeout(Duration::from_millis(10))
+ if let Ok(WorkingBankEntry {
+ bank: _,
+ entries_ticks,
+ }) = receiver.recv_timeout(Duration::from_millis(10))
{
- total += entry.transactions.len();
+ total += entries_ticks
+ .iter()
+ .map(|e| e.0.transactions.len())
+ .sum::();
}
if total >= ref_tx_count {
break;
@@ -358,6 +365,8 @@ fn main() {
Arc::new(RwLock::new(CostModel::default())),
Arc::new(connection_cache),
bank_forks.clone(),
+ HashSet::default(),
+ BundleAccountLocker::default(),
);
poh_recorder.lock().unwrap().set_bank(&bank);
diff --git a/banks-server/Cargo.toml b/banks-server/Cargo.toml
index dbfff01c43..21a2d117b3 100644
--- a/banks-server/Cargo.toml
+++ b/banks-server/Cargo.toml
@@ -15,6 +15,7 @@ crossbeam-channel = "0.5"
futures = "0.3"
solana-banks-interface = { path = "../banks-interface", version = "=1.13.7" }
solana-client = { path = "../client", version = "=1.13.7" }
+solana-gossip = { path = "../gossip", version = "=1.13.7" }
solana-runtime = { path = "../runtime", version = "=1.13.7" }
solana-sdk = { path = "../sdk", version = "=1.13.7" }
solana-send-transaction-service = { path = "../send-transaction-service", version = "=1.13.7" }
@@ -23,6 +24,9 @@ tokio = { version = "1", features = ["full"] }
tokio-serde = { version = "0.8", features = ["bincode"] }
tokio-stream = "0.1"
+[dev-dependencies]
+solana-streamer = { path = "../streamer", version = "=1.13.7" }
+
[lib]
crate-type = ["lib"]
name = "solana_banks_server"
diff --git a/banks-server/src/banks_server.rs b/banks-server/src/banks_server.rs
index 606cb50352..124f6f38f3 100644
--- a/banks-server/src/banks_server.rs
+++ b/banks-server/src/banks_server.rs
@@ -7,6 +7,7 @@ use {
TransactionConfirmationStatus, TransactionSimulationDetails, TransactionStatus,
},
solana_client::connection_cache::ConnectionCache,
+ solana_gossip::cluster_info::ClusterInfo,
solana_runtime::{
bank::{Bank, TransactionSimulationResult},
bank_forks::BankForks,
@@ -373,7 +374,7 @@ pub async fn start_local_server(
pub async fn start_tcp_server(
listen_addr: SocketAddr,
- tpu_addr: SocketAddr,
+ cluster_info: Arc,
bank_forks: Arc>,
block_commitment_cache: Arc>,
connection_cache: Arc,
@@ -397,7 +398,7 @@ pub async fn start_tcp_server(
let (sender, receiver) = unbounded();
SendTransactionService::new::(
- tpu_addr,
+ cluster_info.clone(),
&bank_forks,
None,
receiver,
diff --git a/banks-server/src/rpc_banks_service.rs b/banks-server/src/rpc_banks_service.rs
index 822798dd1f..8e0bfbeaaf 100644
--- a/banks-server/src/rpc_banks_service.rs
+++ b/banks-server/src/rpc_banks_service.rs
@@ -4,6 +4,7 @@ use {
crate::banks_server::start_tcp_server,
futures::{future::FutureExt, pin_mut, prelude::stream::StreamExt, select},
solana_client::connection_cache::ConnectionCache,
+ solana_gossip::cluster_info::ClusterInfo,
solana_runtime::{bank_forks::BankForks, commitment::BlockCommitmentCache},
std::{
net::SocketAddr,
@@ -27,7 +28,7 @@ pub struct RpcBanksService {
/// Run the TCP service until `exit` is set to true
async fn start_abortable_tcp_server(
listen_addr: SocketAddr,
- tpu_addr: SocketAddr,
+ cluster_info: Arc,
bank_forks: Arc>,
block_commitment_cache: Arc>,
connection_cache: Arc,
@@ -35,7 +36,7 @@ async fn start_abortable_tcp_server(
) {
let server = start_tcp_server(
listen_addr,
- tpu_addr,
+ cluster_info,
bank_forks.clone(),
block_commitment_cache.clone(),
connection_cache,
@@ -58,7 +59,7 @@ async fn start_abortable_tcp_server(
impl RpcBanksService {
fn run(
listen_addr: SocketAddr,
- tpu_addr: SocketAddr,
+ cluster_info: Arc,
bank_forks: Arc>,
block_commitment_cache: Arc>,
connection_cache: Arc,
@@ -66,7 +67,7 @@ impl RpcBanksService {
) {
let server = start_abortable_tcp_server(
listen_addr,
- tpu_addr,
+ cluster_info,
bank_forks,
block_commitment_cache,
connection_cache,
@@ -77,7 +78,7 @@ impl RpcBanksService {
pub fn new(
listen_addr: SocketAddr,
- tpu_addr: SocketAddr,
+ cluster_info: Arc,
bank_forks: &Arc>,
block_commitment_cache: &Arc>,
connection_cache: &Arc,
@@ -92,7 +93,7 @@ impl RpcBanksService {
.spawn(move || {
Self::run(
listen_addr,
- tpu_addr,
+ cluster_info,
bank_forks,
block_commitment_cache,
connection_cache,
@@ -111,7 +112,14 @@ impl RpcBanksService {
#[cfg(test)]
mod tests {
- use {super::*, solana_runtime::bank::Bank};
+ use {
+ super::*,
+ solana_gossip::contact_info::ContactInfo,
+ solana_runtime::bank::Bank,
+ solana_sdk::signature::Keypair,
+ solana_streamer::socket::SocketAddrSpace,
+ std::net::{IpAddr, Ipv4Addr},
+ };
#[test]
fn test_rpc_banks_server_exit() {
@@ -120,9 +128,18 @@ mod tests {
let connection_cache = Arc::new(ConnectionCache::default());
let exit = Arc::new(AtomicBool::new(false));
let addr = "127.0.0.1:0".parse().unwrap();
+ let contact_info = ContactInfo {
+ tpu: SocketAddr::new(IpAddr::V4(Ipv4Addr::new(127, 0, 0, 1)), 8080),
+ ..ContactInfo::default()
+ };
+ let cluster_info: Arc = Arc::new(ClusterInfo::new(
+ contact_info,
+ Arc::new(Keypair::new()),
+ SocketAddrSpace::new(false),
+ ));
let service = RpcBanksService::new(
addr,
- addr,
+ cluster_info,
&bank_forks,
&block_commitment_cache,
&connection_cache,
diff --git a/bootstrap b/bootstrap
new file mode 100755
index 0000000000..b01bc6734f
--- /dev/null
+++ b/bootstrap
@@ -0,0 +1,21 @@
+#!/usr/bin/env sh
+bank_hash=$(./target/release/solana-ledger-tool -l config/bootstrap-validator bank-hash)
+
+# NOTE: make sure tip-payment and tip-distribution program are deployed using the correct pubkeys
+RUST_LOG=INFO,solana_core::bundle_stage=DEBUG \
+ NDEBUG=1 ./multinode-demo/bootstrap-validator.sh \
+ --wait-for-supermajority 0 \
+ --expected-bank-hash $bank_hash \
+ --block-engine-address http://127.0.0.1:1003 \
+ --block-engine-auth-service-address http://127.0.0.1:1005 \
+ --relayer-auth-service-address http://127.0.0.1:11226 \
+ --relayer-address http://127.0.0.1:11226 \
+ --rpc-pubsub-enable-block-subscription \
+ --enable-rpc-transaction-history \
+ --tip-payment-program-pubkey 6veFRUKJBNGMR58LEcKn5Bc6MR17WZF4rsgD4Lqq7fsU \
+ --tip-distribution-program-pubkey 3PX9z1qPj37eNZqH7e5fyaVDyG7ARqkjkYEe1a4xsBkA \
+ --commission-bps 0 \
+ --shred-receiver-address 127.0.0.1:1002 \
+ --allow-private-addr \
+ --trust-relayer-packets \
+ --trust-block-engine-packets
diff --git a/ci/buildkite-pipeline-in-disk.sh b/ci/buildkite-pipeline-in-disk.sh
index 4d0832ef24..a4a3d99dad 100644
--- a/ci/buildkite-pipeline-in-disk.sh
+++ b/ci/buildkite-pipeline-in-disk.sh
@@ -185,7 +185,7 @@ all_test_steps() {
- "queue=default"
EOF
else
- annotate --style info \
+ annotate --style info --context test-stable-bpf \
"Stable-BPF skipped as no relevant files were modified"
fi
@@ -203,16 +203,18 @@ EOF
^programs/ \
^sdk/ \
; then
- cat >> "$output_file" <<"EOF"
- - command: "ci/test-stable-perf.sh"
- name: "stable-perf"
- timeout_in_minutes: 20
- artifact_paths: "log-*.txt"
- agents:
- - "queue=cuda"
-EOF
+ annotate --style warning --context test-stable-perf \
+ "test-stable-perf is currently disabled because it requires GPUs (LB)"
+#cat >> "$output_file" <<"EOF"
+# - command: "ci/test-stable-perf.sh"
+# name: "stable-perf"
+# timeout_in_minutes: 20
+# artifact_paths: "log-*.txt"
+# agents:
+# queue: "cuda"
+#EOF
else
- annotate --style info \
+ annotate --style info --context test-stable-perf \
"Stable-perf skipped as no relevant files were modified"
fi
@@ -237,7 +239,7 @@ EOF
timeout_in_minutes: 30
EOF
else
- annotate --style info \
+ annotate --style info --context test-downstream-projects \
"downstream-projects skipped as no relevant files were modified"
fi
@@ -247,9 +249,11 @@ EOF
^ci/test-stable.sh \
^sdk/ \
; then
- command_step wasm ". ci/rust-version.sh; ci/docker-run.sh \$\$rust_stable_docker_image ci/test-wasm.sh" 20
+ annotate --style warning --context test-wasm \
+ "test-wasm is currently disabled because it times out (LB)"
+# command_step wasm ". ci/rust-version.sh; ci/docker-run.sh \$\$rust_stable_docker_image ci/test-wasm.sh" 20
else
- annotate --style info \
+ annotate --style info --context test-wasm \
"wasm skipped as no relevant files were modified"
fi
@@ -308,7 +312,7 @@ if [[ -n $BUILDKITE_TAG ]]; then
"https://github.com/solana-labs/solana/releases/$BUILDKITE_TAG"
# Jump directly to the secondary build to publish release artifacts quickly
- trigger_secondary_step
+# trigger_secondary_step
exit 0
fi
@@ -336,5 +340,5 @@ fi
start_pipeline "Push pipeline for ${BUILDKITE_BRANCH:-?unknown branch?}"
pull_or_push_steps
wait_step
-trigger_secondary_step
+#trigger_secondary_step
exit 0
diff --git a/ci/buildkite-pipeline.sh b/ci/buildkite-pipeline.sh
index cfc24d2528..7f59a691a6 100755
--- a/ci/buildkite-pipeline.sh
+++ b/ci/buildkite-pipeline.sh
@@ -190,7 +190,7 @@ all_test_steps() {
- "queue=solana"
EOF
else
- annotate --style info \
+ annotate --style info --context test-stable-bpf \
"Stable-BPF skipped as no relevant files were modified"
fi
@@ -208,17 +208,19 @@ EOF
^programs/ \
^sdk/ \
; then
- cat >> "$output_file" <<"EOF"
- - command: "ci/test-stable-perf.sh"
- name: "stable-perf"
- timeout_in_minutes: 20
- artifact_paths: "log-*.txt"
- agents:
- - "queue=cuda"
-EOF
+ annotate --style warning --context test-stable-perf \
+ "Stable perf skipped because CI doesn't have GPUs (LB)"
+# cat >> "$output_file" <<"EOF"
+# - command: "ci/test-stable-perf.sh"
+# name: "stable-perf"
+# timeout_in_minutes: 20
+# artifact_paths: "log-*.txt"
+# agents:
+# - "queue=cuda"
+#EOF
else
- annotate --style info \
- "Stable-perf skipped as no relevant files were modified"
+ annotate --style info --context test-stable-perf \
+ "Stable perf skipped as no relevant files were modified"
fi
# Wasm support
@@ -227,9 +229,11 @@ EOF
^ci/test-stable.sh \
^sdk/ \
; then
- command_step wasm ". ci/rust-version.sh; ci/docker-run.sh \$\$rust_stable_docker_image ci/test-wasm.sh" 20
+ annotate --style warning --context test-wasm \
+ "test-wasm is currently disabled because it times out (LB)"
+# command_step wasm ". ci/rust-version.sh; ci/docker-run.sh \$\$rust_stable_docker_image ci/test-wasm.sh" 20
else
- annotate --style info \
+ annotate --style info --context test-wasm \
"wasm skipped as no relevant files were modified"
fi
@@ -292,7 +296,7 @@ if [[ -n $BUILDKITE_TAG ]]; then
"https://github.com/solana-labs/solana/releases/$BUILDKITE_TAG"
# Jump directly to the secondary build to publish release artifacts quickly
- trigger_secondary_step
+# trigger_secondary_step
exit 0
fi
@@ -320,5 +324,5 @@ fi
start_pipeline "Push pipeline for ${BUILDKITE_BRANCH:-?unknown branch?}"
pull_or_push_steps
wait_step
-trigger_secondary_step
+#trigger_secondary_step
exit 0
diff --git a/ci/buildkite-solana-private.sh b/ci/buildkite-solana-private.sh
index 797f40ac0b..7d4110ed6a 100644
--- a/ci/buildkite-solana-private.sh
+++ b/ci/buildkite-solana-private.sh
@@ -185,8 +185,8 @@ all_test_steps() {
- "queue=sol-private"
EOF
else
- annotate --style info \
- "Stable-BPF skipped as no relevant files were modified"
+ annotate --style info --context test-stable-bpf \
+ "Stable-SBF skipped as no relevant files were modified"
fi
# Perf test suite
@@ -203,16 +203,18 @@ EOF
^programs/ \
^sdk/ \
; then
- cat >> "$output_file" <<"EOF"
- - command: "ci/test-stable-perf.sh"
- name: "stable-perf"
- timeout_in_minutes: 35
- artifact_paths: "log-*.txt"
- agents:
- - "queue=sol-private"
-EOF
+ annotate --style warning --context test-stable-perf \
+ "test-stable-perf is currently disabled because it requires GPUs (LB)"
+# cat >> "$output_file" <<"EOF"
+# - command: "ci/test-stable-perf.sh"
+# name: "stable-perf"
+# timeout_in_minutes: 35
+# artifact_paths: "log-*.txt"
+# agents:
+# - "queue=sol-private"
+#EOF
else
- annotate --style info \
+ annotate --style info --context test-stable-perf \
"Stable-perf skipped as no relevant files were modified"
fi
@@ -239,7 +241,7 @@ EOF
- "queue=sol-private"
EOF
else
- annotate --style info \
+ annotate --style info --context test-downstream-projects \
"downstream-projects skipped as no relevant files were modified"
fi
@@ -249,9 +251,11 @@ EOF
^ci/test-stable.sh \
^sdk/ \
; then
- command_step wasm ". ci/rust-version.sh; ci/docker-run.sh \$\$rust_stable_docker_image ci/test-wasm.sh" 20
+ annotate --style warning --context test-wasm \
+ "test-wasm is currently disabled because it times out (LB)"
+# command_step wasm ". ci/rust-version.sh; ci/docker-run.sh \$\$rust_stable_docker_image ci/test-wasm.sh" 20
else
- annotate --style info \
+ annotate --style info --context test-wasm \
"wasm skipped as no relevant files were modified"
fi
diff --git a/ci/docker-rust/Dockerfile b/ci/docker-rust/Dockerfile
index 7238a1615a..6ab67b8d79 100644
--- a/ci/docker-rust/Dockerfile
+++ b/ci/docker-rust/Dockerfile
@@ -39,6 +39,7 @@ RUN set -x \
&& cargo install mdbook-linkcheck \
&& cargo install svgbob_cli \
&& cargo install wasm-pack \
+ && cargo install sccache \
&& rustc --version \
&& cargo --version \
&& curl -OL https://github.com/google/protobuf/releases/download/v$PROTOC_VERSION/$PROTOC_ZIP \
diff --git a/client/src/http_sender.rs b/client/src/http_sender.rs
index 84e1418d7a..d0b4f86424 100644
--- a/client/src/http_sender.rs
+++ b/client/src/http_sender.rs
@@ -70,6 +70,102 @@ impl HttpSender {
stats: RwLock::new(RpcTransportStats::default()),
}
}
+
+ fn check_response(response: &serde_json::Value) -> Result<()> {
+ if response["error"].is_object() {
+ return match serde_json::from_value::(response["error"].clone()) {
+ Ok(rpc_error_object) => {
+ let data = match rpc_error_object.code {
+ rpc_custom_error::JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE => {
+ match serde_json::from_value::(response["error"]["data"].clone()) {
+ Ok(data) => RpcResponseErrorData::SendTransactionPreflightFailure(data),
+ Err(err) => {
+ debug!("Failed to deserialize RpcSimulateTransactionResult: {:?}", err);
+ RpcResponseErrorData::Empty
+ }
+ }
+ },
+ rpc_custom_error::JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY => {
+ match serde_json::from_value::(response["error"]["data"].clone()) {
+ Ok(rpc_custom_error::NodeUnhealthyErrorData {num_slots_behind}) => RpcResponseErrorData::NodeUnhealthy {num_slots_behind},
+ Err(_err) => {
+ RpcResponseErrorData::Empty
+ }
+ }
+ },
+ _ => RpcResponseErrorData::Empty
+ };
+ Err(RpcError::RpcResponseError {
+ request_id: response["id"].as_u64().unwrap(),
+ code: rpc_error_object.code,
+ message: rpc_error_object.message,
+ data,
+ }
+ .into())
+ }
+ Err(err) => Err(RpcError::RpcRequestError(format!(
+ "Failed to deserialize RPC error response: {} [{}]",
+ serde_json::to_string(&response["error"]).unwrap(),
+ err
+ ))
+ .into()),
+ };
+ }
+
+ Ok(())
+ }
+
+ async fn do_send_with_retry(
+ &self,
+ request: serde_json::Value,
+ ) -> reqwest::Result {
+ let mut stats_updater = StatsUpdater::new(&self.stats);
+ let mut too_many_requests_retries = 5;
+ loop {
+ let response = {
+ let client = self.client.clone();
+ let request = request.to_string();
+ client
+ .post(&self.url)
+ .header(CONTENT_TYPE, "application/json")
+ .body(request)
+ .send()
+ .await
+ }?;
+
+ if !response.status().is_success() {
+ if response.status() == StatusCode::TOO_MANY_REQUESTS
+ && too_many_requests_retries > 0
+ {
+ let mut duration = Duration::from_millis(500);
+ if let Some(retry_after) = response.headers().get(RETRY_AFTER) {
+ if let Ok(retry_after) = retry_after.to_str() {
+ if let Ok(retry_after) = retry_after.parse::() {
+ if retry_after < 120 {
+ duration = Duration::from_secs(retry_after);
+ }
+ }
+ }
+ }
+
+ too_many_requests_retries -= 1;
+ debug!(
+ "Too many requests: server responded with {:?}, {} retries left, pausing for {:?}",
+ response, too_many_requests_retries, duration
+ );
+
+ sleep(duration).await;
+ stats_updater.add_rate_limited_time(duration);
+
+ continue;
+ }
+
+ return Err(response.error_for_status().unwrap_err());
+ }
+
+ return response.json::().await;
+ }
+ }
}
#[derive(Deserialize, Debug)]
@@ -109,103 +205,37 @@ impl<'a> Drop for StatsUpdater<'a> {
#[async_trait]
impl RpcSender for HttpSender {
- fn get_transport_stats(&self) -> RpcTransportStats {
- self.stats.read().unwrap().clone()
- }
-
async fn send(
&self,
request: RpcRequest,
params: serde_json::Value,
) -> Result {
- let mut stats_updater = StatsUpdater::new(&self.stats);
-
let request_id = self.request_id.fetch_add(1, Ordering::Relaxed);
- let request_json = request.build_request_json(request_id, params).to_string();
+ let request = request.build_request_json(request_id, params);
+ let mut resp = self.do_send_with_retry(request).await?;
+ Self::check_response(&resp)?;
- let mut too_many_requests_retries = 5;
- loop {
- let response = {
- let client = self.client.clone();
- let request_json = request_json.clone();
- client
- .post(&self.url)
- .header(CONTENT_TYPE, "application/json")
- .body(request_json)
- .send()
- .await
- }?;
+ Ok(resp["result"].take())
+ }
- if !response.status().is_success() {
- if response.status() == StatusCode::TOO_MANY_REQUESTS
- && too_many_requests_retries > 0
- {
- let mut duration = Duration::from_millis(500);
- if let Some(retry_after) = response.headers().get(RETRY_AFTER) {
- if let Ok(retry_after) = retry_after.to_str() {
- if let Ok(retry_after) = retry_after.parse::() {
- if retry_after < 120 {
- duration = Duration::from_secs(retry_after);
- }
- }
- }
- }
+ async fn send_batch(
+ &self,
+ requests_and_params: Vec<(RpcRequest, serde_json::Value)>,
+ ) -> Result {
+ let mut batch_request = vec![];
+ for (request_id, req) in requests_and_params.into_iter().enumerate() {
+ batch_request.push(req.0.build_request_json(request_id as u64, req.1));
+ }
- too_many_requests_retries -= 1;
- debug!(
- "Too many requests: server responded with {:?}, {} retries left, pausing for {:?}",
- response, too_many_requests_retries, duration
- );
+ let resp = self
+ .do_send_with_retry(serde_json::Value::Array(batch_request))
+ .await?;
- sleep(duration).await;
- stats_updater.add_rate_limited_time(duration);
- continue;
- }
- return Err(response.error_for_status().unwrap_err().into());
- }
+ Ok(resp)
+ }
- let mut json = response.json::().await?;
- if json["error"].is_object() {
- return match serde_json::from_value::(json["error"].clone()) {
- Ok(rpc_error_object) => {
- let data = match rpc_error_object.code {
- rpc_custom_error::JSON_RPC_SERVER_ERROR_SEND_TRANSACTION_PREFLIGHT_FAILURE => {
- match serde_json::from_value::(json["error"]["data"].clone()) {
- Ok(data) => RpcResponseErrorData::SendTransactionPreflightFailure(data),
- Err(err) => {
- debug!("Failed to deserialize RpcSimulateTransactionResult: {:?}", err);
- RpcResponseErrorData::Empty
- }
- }
- },
- rpc_custom_error::JSON_RPC_SERVER_ERROR_NODE_UNHEALTHY => {
- match serde_json::from_value::(json["error"]["data"].clone()) {
- Ok(rpc_custom_error::NodeUnhealthyErrorData {num_slots_behind}) => RpcResponseErrorData::NodeUnhealthy {num_slots_behind},
- Err(_err) => {
- RpcResponseErrorData::Empty
- }
- }
- },
- _ => RpcResponseErrorData::Empty
- };
-
- Err(RpcError::RpcResponseError {
- code: rpc_error_object.code,
- message: rpc_error_object.message,
- data,
- }
- .into())
- }
- Err(err) => Err(RpcError::RpcRequestError(format!(
- "Failed to deserialize RPC error response: {} [{}]",
- serde_json::to_string(&json["error"]).unwrap(),
- err
- ))
- .into()),
- };
- }
- return Ok(json["result"].take());
- }
+ fn get_transport_stats(&self) -> RpcTransportStats {
+ self.stats.read().unwrap().clone()
}
fn url(&self) -> String {
diff --git a/client/src/mock_sender.rs b/client/src/mock_sender.rs
index a43ea736cd..3485fb3738 100644
--- a/client/src/mock_sender.rs
+++ b/client/src/mock_sender.rs
@@ -473,4 +473,11 @@ impl RpcSender for MockSender {
fn url(&self) -> String {
format!("MockSender: {}", self.url)
}
+
+ async fn send_batch(
+ &self,
+ _requests_and_params: Vec<(RpcRequest, serde_json::Value)>,
+ ) -> Result {
+ todo!()
+ }
}
diff --git a/client/src/nonblocking/rpc_client.rs b/client/src/nonblocking/rpc_client.rs
index 2d300be0b7..1eca9669ac 100644
--- a/client/src/nonblocking/rpc_client.rs
+++ b/client/src/nonblocking/rpc_client.rs
@@ -33,6 +33,7 @@ use {
},
solana_sdk::{
account::Account,
+ bundle::VersionedBundle,
clock::{Epoch, Slot, UnixTimestamp, DEFAULT_MS_PER_SLOT, MAX_HASH_AGE_IN_SECONDS},
commitment_config::{CommitmentConfig, CommitmentLevel},
epoch_info::EpochInfo,
@@ -42,7 +43,7 @@ use {
message::Message,
pubkey::Pubkey,
signature::Signature,
- transaction::{self, uses_durable_nonce, Transaction},
+ transaction::{self, uses_durable_nonce, Transaction, VersionedTransaction},
},
solana_transaction_status::{
EncodedConfirmedBlock, EncodedConfirmedTransactionWithStatusMeta, TransactionStatus,
@@ -943,6 +944,7 @@ impl RpcClient {
code,
message,
data,
+ ..
}) = &err.kind
{
debug!("{} {}", code, message);
@@ -1388,6 +1390,111 @@ impl RpcClient {
.await
}
+ pub async fn batch_simulate_bundle(
+ &self,
+ bundles: Vec,
+ ) -> BatchRpcResult {
+ let configs = bundles
+ .iter()
+ .map(|b| RpcSimulateBundleConfig {
+ simulation_bank: Some(SimulationSlotConfig::Commitment(self.commitment())),
+ pre_execution_accounts_configs: vec![None; b.transactions.len()],
+ post_execution_accounts_configs: vec![None; b.transactions.len()],
+ ..RpcSimulateBundleConfig::default()
+ })
+ .collect::>();
+
+ self.batch_simulate_bundle_with_config(bundles.into_iter().zip(configs).collect())
+ .await
+ }
+
+ pub async fn batch_simulate_bundle_with_config(
+ &self,
+ bundles_and_configs: Vec<(VersionedBundle, RpcSimulateBundleConfig)>,
+ ) -> BatchRpcResult {
+ let mut params = vec![];
+ for (bundle, config) in bundles_and_configs {
+ let transaction_encoding = if let Some(encoding) = config.transaction_encoding {
+ encoding
+ } else {
+ self.default_cluster_transaction_encoding().await?
+ };
+
+ let simulation_bank = config.simulation_bank.unwrap_or_default();
+
+ let config = RpcSimulateBundleConfig {
+ transaction_encoding: Some(transaction_encoding),
+ simulation_bank: Some(simulation_bank),
+ ..config
+ };
+
+ let encoded_transactions = bundle
+ .transactions
+ .iter()
+ .map(|tx| serialize_and_encode::(tx, transaction_encoding))
+ .collect::, ClientError>>()?;
+ let rpc_bundle_request = RpcBundleRequest {
+ encoded_transactions,
+ };
+
+ params.push(json!([rpc_bundle_request, config]));
+ }
+
+ let requests_and_params = vec![RpcRequest::SimulateBundle; params.len()]
+ .into_iter()
+ .zip(params)
+ .collect();
+ self.send_batch(requests_and_params).await
+ }
+
+ pub async fn simulate_bundle(
+ &self,
+ bundle: &VersionedBundle,
+ ) -> RpcResult {
+ self.simulate_bundle_with_config(
+ bundle,
+ RpcSimulateBundleConfig {
+ simulation_bank: Some(SimulationSlotConfig::Commitment(self.commitment())),
+ ..RpcSimulateBundleConfig::default()
+ },
+ )
+ .await
+ }
+
+ pub async fn simulate_bundle_with_config(
+ &self,
+ bundle: &VersionedBundle,
+ config: RpcSimulateBundleConfig,
+ ) -> RpcResult {
+ let transaction_encoding = if let Some(enc) = config.transaction_encoding {
+ enc
+ } else {
+ self.default_cluster_transaction_encoding().await?
+ };
+ let simulation_bank = Some(config.simulation_bank.unwrap_or_default());
+
+ let encoded_transactions = bundle
+ .transactions
+ .iter()
+ .map(|tx| serialize_and_encode::(tx, transaction_encoding))
+ .collect::>>()?;
+ let rpc_bundle_request = RpcBundleRequest {
+ encoded_transactions,
+ };
+
+ let config = RpcSimulateBundleConfig {
+ transaction_encoding: Some(transaction_encoding),
+ simulation_bank,
+ ..config
+ };
+
+ self.send(
+ RpcRequest::SimulateBundle,
+ json!([rpc_bundle_request, config]),
+ )
+ .await
+ }
+
/// Returns the highest slot information that the node has snapshots for.
///
/// This will find the highest full snapshot slot, and the highest incremental snapshot slot
@@ -5340,6 +5447,21 @@ impl RpcClient {
.map_err(|err| ClientError::new_with_request(err.into(), request))
}
+ pub async fn send_batch(
+ &self,
+ requests_and_params: Vec<(RpcRequest, Value)>,
+ ) -> ClientResult
+ where
+ T: serde::de::DeserializeOwned,
+ {
+ let response = self.sender.send_batch(requests_and_params).await?;
+
+ serde_json::from_value(response).map_err(|err| ClientError {
+ request: None,
+ kind: err.into(),
+ })
+ }
+
pub fn get_transport_stats(&self) -> RpcTransportStats {
self.sender.get_transport_stats()
}
diff --git a/client/src/rpc_client.rs b/client/src/rpc_client.rs
index 564494aa80..510cf3e95d 100644
--- a/client/src/rpc_client.rs
+++ b/client/src/rpc_client.rs
@@ -27,6 +27,7 @@ use {
},
solana_sdk::{
account::Account,
+ bundle::VersionedBundle,
clock::{Epoch, Slot, UnixTimestamp},
commitment_config::CommitmentConfig,
epoch_info::EpochInfo,
@@ -1111,6 +1112,35 @@ impl RpcClient {
)
}
+ pub fn batch_simulate_bundle(
+ &self,
+ bundles: Vec,
+ ) -> BatchRpcResult {
+ self.invoke(self.rpc_client.batch_simulate_bundle(bundles))
+ }
+
+ pub fn batch_simulate_bundle_with_config(
+ &self,
+ bundles_and_configs: Vec<(VersionedBundle, RpcSimulateBundleConfig)>,
+ ) -> BatchRpcResult {
+ self.invoke(
+ self.rpc_client
+ .batch_simulate_bundle_with_config(bundles_and_configs),
+ )
+ }
+
+ pub fn simulate_bundle(&self, bundle: &VersionedBundle) -> RpcResult {
+ self.invoke(self.rpc_client.simulate_bundle(bundle))
+ }
+
+ pub fn simulate_bundle_with_config(
+ &self,
+ bundle: &VersionedBundle,
+ config: RpcSimulateBundleConfig,
+ ) -> RpcResult {
+ self.invoke(self.rpc_client.simulate_bundle_with_config(bundle, config))
+ }
+
/// Returns the highest slot information that the node has snapshots for.
///
/// This will find the highest full snapshot slot, and the highest incremental snapshot slot
diff --git a/client/src/rpc_config.rs b/client/src/rpc_config.rs
index 4c21b8284e..5daf68fdb8 100644
--- a/client/src/rpc_config.rs
+++ b/client/src/rpc_config.rs
@@ -46,6 +46,51 @@ pub struct RpcSimulateTransactionConfig {
pub min_context_slot: Option,
}
+#[derive(Serialize, Deserialize, Clone, Copy, Debug, Eq, PartialEq)]
+#[serde(rename_all = "camelCase")]
+pub enum SimulationSlotConfig {
+ Commitment(CommitmentConfig),
+ Slot(Slot),
+}
+
+impl Default for SimulationSlotConfig {
+ fn default() -> Self {
+ Self::Commitment(CommitmentConfig {
+ commitment: CommitmentLevel::Confirmed,
+ })
+ }
+}
+
+#[derive(Debug, PartialEq, Default, Eq, Clone, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RpcBundleRequest {
+ pub encoded_transactions: Vec,
+}
+
+#[derive(Debug, Default, Clone, PartialEq, Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
+pub struct RpcSimulateBundleConfig {
+ /// Gives the state of accounts pre/post transaction execution.
+ /// The length of each of these must be equal to the number transactions.
+ pub pre_execution_accounts_configs: Vec