Revert solana-tokens to RpcClient (#13623)
* Revert solana-tokens to RpcClient * Fixup check_payer_balances tests * Use RpcClient::new_with_commitment in other tests Co-authored-by: Tyera Eulberg <tyera@solana.com>
This commit is contained in:
5
Cargo.lock
generated
5
Cargo.lock
generated
@ -4958,8 +4958,6 @@ dependencies = [
|
|||||||
"indicatif",
|
"indicatif",
|
||||||
"pickledb",
|
"pickledb",
|
||||||
"serde",
|
"serde",
|
||||||
"solana-banks-client",
|
|
||||||
"solana-banks-server",
|
|
||||||
"solana-clap-utils",
|
"solana-clap-utils",
|
||||||
"solana-cli-config",
|
"solana-cli-config",
|
||||||
"solana-client",
|
"solana-client",
|
||||||
@ -4969,10 +4967,9 @@ dependencies = [
|
|||||||
"solana-runtime",
|
"solana-runtime",
|
||||||
"solana-sdk",
|
"solana-sdk",
|
||||||
"solana-stake-program",
|
"solana-stake-program",
|
||||||
|
"solana-transaction-status",
|
||||||
"tempfile",
|
"tempfile",
|
||||||
"thiserror",
|
"thiserror",
|
||||||
"tokio 0.3.2",
|
|
||||||
"url 2.1.1",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
@ -18,7 +18,6 @@ indexmap = "1.5.1"
|
|||||||
indicatif = "0.15.0"
|
indicatif = "0.15.0"
|
||||||
pickledb = "0.4.1"
|
pickledb = "0.4.1"
|
||||||
serde = { version = "1.0", features = ["derive"] }
|
serde = { version = "1.0", features = ["derive"] }
|
||||||
solana-banks-client = { path = "../banks-client", version = "1.5.0" }
|
|
||||||
solana-clap-utils = { path = "../clap-utils", version = "1.5.0" }
|
solana-clap-utils = { path = "../clap-utils", version = "1.5.0" }
|
||||||
solana-cli-config = { path = "../cli-config", version = "1.5.0" }
|
solana-cli-config = { path = "../cli-config", version = "1.5.0" }
|
||||||
solana-client = { path = "../client", version = "1.5.0" }
|
solana-client = { path = "../client", version = "1.5.0" }
|
||||||
@ -26,14 +25,11 @@ solana-remote-wallet = { path = "../remote-wallet", version = "1.5.0" }
|
|||||||
solana-runtime = { path = "../runtime", version = "1.5.0" }
|
solana-runtime = { path = "../runtime", version = "1.5.0" }
|
||||||
solana-sdk = { path = "../sdk", version = "1.5.0" }
|
solana-sdk = { path = "../sdk", version = "1.5.0" }
|
||||||
solana-stake-program = { path = "../programs/stake", version = "1.5.0" }
|
solana-stake-program = { path = "../programs/stake", version = "1.5.0" }
|
||||||
|
solana-transaction-status = { path = "../transaction-status", version = "1.5.0" }
|
||||||
tempfile = "3.1.0"
|
tempfile = "3.1.0"
|
||||||
thiserror = "1.0"
|
thiserror = "1.0"
|
||||||
tokio = { version = "0.3", features = ["full"] }
|
|
||||||
url = "2.1"
|
|
||||||
|
|
||||||
[dev-dependencies]
|
[dev-dependencies]
|
||||||
bincode = "1.3.1"
|
bincode = "1.3.1"
|
||||||
solana-banks-server = { path = "../banks-server", version = "1.5.0" }
|
|
||||||
solana-core = { path = "../core", version = "1.5.0" }
|
solana-core = { path = "../core", version = "1.5.0" }
|
||||||
solana-logger = { path = "../logger", version = "1.5.0" }
|
solana-logger = { path = "../logger", version = "1.5.0" }
|
||||||
solana-runtime = { path = "../runtime", version = "1.5.0" }
|
|
||||||
|
File diff suppressed because it is too large
Load Diff
@ -1,8 +1,8 @@
|
|||||||
use chrono::prelude::*;
|
use chrono::prelude::*;
|
||||||
use pickledb::{error::Error, PickleDb, PickleDbDumpPolicy};
|
use pickledb::{error::Error, PickleDb, PickleDbDumpPolicy};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use solana_banks_client::TransactionStatus;
|
|
||||||
use solana_sdk::{clock::Slot, pubkey::Pubkey, signature::Signature, transaction::Transaction};
|
use solana_sdk::{clock::Slot, pubkey::Pubkey, signature::Signature, transaction::Transaction};
|
||||||
|
use solana_transaction_status::TransactionStatus;
|
||||||
use std::{cmp::Ordering, fs, io, path::Path};
|
use std::{cmp::Ordering, fs, io, path::Path};
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
#[derive(Serialize, Deserialize, Debug, Clone, PartialEq)]
|
||||||
@ -306,6 +306,7 @@ mod tests {
|
|||||||
slot: 0,
|
slot: 0,
|
||||||
confirmations: Some(1),
|
confirmations: Some(1),
|
||||||
err: None,
|
err: None,
|
||||||
|
status: Ok(()),
|
||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
update_finalized_transaction(&mut db, &signature, Some(transaction_status), 0, 0)
|
update_finalized_transaction(&mut db, &signature, Some(transaction_status), 0, 0)
|
||||||
@ -332,6 +333,7 @@ mod tests {
|
|||||||
slot: 0,
|
slot: 0,
|
||||||
confirmations: None,
|
confirmations: None,
|
||||||
err: Some(TransactionError::AccountNotFound),
|
err: Some(TransactionError::AccountNotFound),
|
||||||
|
status: Ok(()),
|
||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
update_finalized_transaction(&mut db, &signature, Some(transaction_status), 0, 0)
|
update_finalized_transaction(&mut db, &signature, Some(transaction_status), 0, 0)
|
||||||
@ -355,6 +357,7 @@ mod tests {
|
|||||||
slot: 0,
|
slot: 0,
|
||||||
confirmations: None,
|
confirmations: None,
|
||||||
err: None,
|
err: None,
|
||||||
|
status: Ok(()),
|
||||||
};
|
};
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
update_finalized_transaction(&mut db, &signature, Some(transaction_status), 0, 0)
|
update_finalized_transaction(&mut db, &signature, Some(transaction_status), 0, 0)
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
use solana_banks_client::start_tcp_client;
|
|
||||||
use solana_cli_config::{Config, CONFIG_FILE};
|
use solana_cli_config::{Config, CONFIG_FILE};
|
||||||
|
use solana_client::rpc_client::RpcClient;
|
||||||
use solana_tokens::{arg_parser::parse_args, args::Command, commands};
|
use solana_tokens::{arg_parser::parse_args, args::Command, commands};
|
||||||
use std::{env, error::Error, path::Path, process};
|
use std::{env, error::Error, path::Path, process};
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
use url::Url;
|
|
||||||
|
|
||||||
fn main() -> Result<(), Box<dyn Error>> {
|
fn main() -> Result<(), Box<dyn Error>> {
|
||||||
let command_args = parse_args(env::args_os())?;
|
let command_args = parse_args(env::args_os())?;
|
||||||
@ -18,19 +16,14 @@ fn main() -> Result<(), Box<dyn Error>> {
|
|||||||
Config::default()
|
Config::default()
|
||||||
};
|
};
|
||||||
let json_rpc_url = command_args.url.unwrap_or(config.json_rpc_url);
|
let json_rpc_url = command_args.url.unwrap_or(config.json_rpc_url);
|
||||||
let rpc_banks_url = Config::compute_rpc_banks_url(&json_rpc_url);
|
let client = RpcClient::new(json_rpc_url);
|
||||||
let url = Url::parse(&rpc_banks_url)?;
|
|
||||||
let host_port = (url.host_str().unwrap(), url.port().unwrap());
|
|
||||||
|
|
||||||
let runtime = Runtime::new().unwrap();
|
|
||||||
let mut banks_client = runtime.block_on(start_tcp_client(&host_port))?;
|
|
||||||
|
|
||||||
match command_args.command {
|
match command_args.command {
|
||||||
Command::DistributeTokens(args) => {
|
Command::DistributeTokens(args) => {
|
||||||
runtime.block_on(commands::process_allocations(&mut banks_client, &args))?;
|
commands::process_allocations(&client, &args)?;
|
||||||
}
|
}
|
||||||
Command::Balances(args) => {
|
Command::Balances(args) => {
|
||||||
runtime.block_on(commands::process_balances(&mut banks_client, &args))?;
|
commands::process_balances(&client, &args)?;
|
||||||
}
|
}
|
||||||
Command::TransactionLog(args) => {
|
Command::TransactionLog(args) => {
|
||||||
commands::process_transaction_log(&args)?;
|
commands::process_transaction_log(&args)?;
|
||||||
|
@ -1,8 +1,7 @@
|
|||||||
use solana_banks_client::start_tcp_client;
|
use solana_client::rpc_client::RpcClient;
|
||||||
use solana_core::test_validator::TestValidator;
|
use solana_core::test_validator::TestValidator;
|
||||||
use solana_tokens::commands::test_process_distribute_tokens_with_client;
|
use solana_tokens::commands::test_process_distribute_tokens_with_client;
|
||||||
use std::fs::remove_dir_all;
|
use std::fs::remove_dir_all;
|
||||||
use tokio::runtime::Runtime;
|
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn test_process_distribute_with_rpc_client() {
|
fn test_process_distribute_with_rpc_client() {
|
||||||
@ -15,10 +14,8 @@ fn test_process_distribute_with_rpc_client() {
|
|||||||
..
|
..
|
||||||
} = TestValidator::run();
|
} = TestValidator::run();
|
||||||
|
|
||||||
Runtime::new().unwrap().block_on(async {
|
let client = RpcClient::new_socket(leader_data.rpc);
|
||||||
let mut banks_client = start_tcp_client(leader_data.rpc_banks).await.unwrap();
|
test_process_distribute_tokens_with_client(&client, alice, None);
|
||||||
test_process_distribute_tokens_with_client(&mut banks_client, alice, None).await
|
|
||||||
});
|
|
||||||
|
|
||||||
// Explicit cleanup, otherwise "pure virtual method called" crash in Docker
|
// Explicit cleanup, otherwise "pure virtual method called" crash in Docker
|
||||||
server.close().unwrap();
|
server.close().unwrap();
|
||||||
|
Reference in New Issue
Block a user