forked from solana-labs/solana
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add DOS test that sends large transactions (solana-labs#20624)
Problem We need a test that stress-tests the network using large transactions, including sending multiple large transactions that reference independent sets of accounts, so they can be executed in parallel. Summary of Changes Adds such a test. Also adds a version of the tuner program that runs for a configurable number of iterations.
- Loading branch information
1 parent
1453fce
commit 4663b86
Showing
6 changed files
with
824 additions
and
0 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
37 changes: 37 additions & 0 deletions
37
programs/bpf/c/src/tuner-variable-iterations/tuner-variable-iterations.c
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* @brief Compute budget tuner program. Spins in a loop for the specified number of iterations | ||
* (or for UINT64_MAX iterations if 0 is specified for the number of iterations), in order to consume | ||
* a configurable amount of the budget. | ||
* | ||
* Care should be taken because the compiler might optimize out the mechanism | ||
* you are trying to tune. | ||
*/ | ||
|
||
#include <solana_sdk.h> | ||
|
||
#define NUM_KA 1 | ||
|
||
extern uint64_t entrypoint(const uint8_t *input) { | ||
SolAccountInfo ka[NUM_KA]; | ||
SolParameters params = (SolParameters){.ka = ka}; | ||
if (!sol_deserialize(input, ¶ms, SOL_ARRAY_SIZE(ka))) { | ||
return ERROR_INVALID_ARGUMENT; | ||
} | ||
|
||
size_t current = 1; | ||
|
||
uint64_t iterations = params.data[0] * 18; | ||
iterations = iterations == 0 ? UINT64_MAX : iterations; | ||
size_t rand = params.data[1]; | ||
size_t account_index = rand % params.ka_num; | ||
uint8_t *val = (uint8_t *)ka[account_index].data; | ||
uint64_t memory_size = ka[account_index].data_len; | ||
|
||
for (uint64_t i = 0; i < iterations; i++) { | ||
{ | ||
*val ^= val[current % memory_size]; | ||
current = current * 76510171 + 47123; | ||
} | ||
} | ||
return *val; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
/target/ | ||
/farf/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
[package] | ||
authors = ["Solana Maintainers <[email protected]>"] | ||
edition = "2018" | ||
name = "solana-transaction-dos" | ||
version = "1.9.0" | ||
repository = "https://github.com/solana-labs/solana" | ||
license = "Apache-2.0" | ||
homepage = "https://solana.com/" | ||
publish = false | ||
|
||
[dependencies] | ||
bincode = "1.3.3" | ||
clap = "2.33.1" | ||
log = "0.4.14" | ||
rand = "0.7.0" | ||
rayon = "1.5.1" | ||
solana-cli = { path = "../cli", version = "=1.9.0" } | ||
solana-clap-utils = { path = "../clap-utils", version = "=1.9.0" } | ||
solana-client = { path = "../client", version = "=1.9.0" } | ||
solana-core = { path = "../core", version = "=1.9.0" } | ||
solana-faucet = { path = "../faucet", version = "=1.9.0" } | ||
solana-gossip = { path = "../gossip", version = "=1.9.0" } | ||
solana-logger = { path = "../logger", version = "=1.9.0" } | ||
solana-measure = { path = "../measure", version = "=1.9.0" } | ||
solana-net-utils = { path = "../net-utils", version = "=1.9.0" } | ||
solana-runtime = { path = "../runtime", version = "=1.9.0" } | ||
solana-sdk = { path = "../sdk", version = "=1.9.0" } | ||
solana-streamer = { path = "../streamer", version = "=1.9.0" } | ||
solana-transaction-status = { path = "../transaction-status", version = "=1.9.0" } | ||
solana-version = { path = "../version", version = "=1.9.0" } | ||
|
||
[dev-dependencies] | ||
solana-local-cluster = { path = "../local-cluster", version = "=1.9.0" } | ||
|
||
[package.metadata.docs.rs] | ||
targets = ["x86_64-unknown-linux-gnu"] |
Oops, something went wrong.