Fill out missing RPC request received debug logging

This commit is contained in:
Trent Nelson 2020-07-28 18:28:51 -06:00 committed by mergify[bot]
parent 3e4f49f9c9
commit 678f94903b
1 changed files with 38 additions and 0 deletions

View File

@ -1251,6 +1251,7 @@ impl RpcSol for RpcSolImpl {
} }
fn get_cluster_nodes(&self, meta: Self::Metadata) -> Result<Vec<RpcContactInfo>> { fn get_cluster_nodes(&self, meta: Self::Metadata) -> Result<Vec<RpcContactInfo>> {
debug!("get_cluster_nodes rpc request received");
let cluster_info = &meta.cluster_info; let cluster_info = &meta.cluster_info;
fn valid_address_or_none(addr: &SocketAddr) -> Option<SocketAddr> { fn valid_address_or_none(addr: &SocketAddr) -> Option<SocketAddr> {
if ContactInfo::is_valid_address(addr) { if ContactInfo::is_valid_address(addr) {
@ -1288,6 +1289,7 @@ impl RpcSol for RpcSolImpl {
meta: Self::Metadata, meta: Self::Metadata,
commitment: Option<CommitmentConfig>, commitment: Option<CommitmentConfig>,
) -> Result<EpochInfo> { ) -> Result<EpochInfo> {
debug!("get_epoch_info rpc request received");
let bank = meta.bank(commitment); let bank = meta.bank(commitment);
Ok(bank.get_epoch_info()) Ok(bank.get_epoch_info())
} }
@ -1297,6 +1299,7 @@ impl RpcSol for RpcSolImpl {
meta: Self::Metadata, meta: Self::Metadata,
block: Slot, block: Slot,
) -> Result<RpcBlockCommitment<BlockCommitmentArray>> { ) -> Result<RpcBlockCommitment<BlockCommitmentArray>> {
debug!("get_block_commitment rpc request received");
Ok(meta.get_block_commitment(block)) Ok(meta.get_block_commitment(block))
} }
@ -1315,6 +1318,8 @@ impl RpcSol for RpcSolImpl {
let slot = slot.unwrap_or_else(|| bank.slot()); let slot = slot.unwrap_or_else(|| bank.slot());
let epoch = bank.epoch_schedule().get_epoch(slot); let epoch = bank.epoch_schedule().get_epoch(slot);
debug!("get_leader_schedule rpc request received: {:?}", slot);
Ok( Ok(
solana_ledger::leader_schedule_utils::leader_schedule(epoch, &bank).map( solana_ledger::leader_schedule_utils::leader_schedule(epoch, &bank).map(
|leader_schedule| { |leader_schedule| {
@ -1390,6 +1395,10 @@ impl RpcSol for RpcSolImpl {
signature_str: String, signature_str: String,
commitment: Option<CommitmentConfig>, commitment: Option<CommitmentConfig>,
) -> Result<Option<transaction::Result<()>>> { ) -> Result<Option<transaction::Result<()>>> {
debug!(
"get_signature_status rpc request received: {:?}",
signature_str
);
let signature = verify_signature(&signature_str)?; let signature = verify_signature(&signature_str)?;
Ok(meta.get_signature_status(signature, commitment)) Ok(meta.get_signature_status(signature, commitment))
} }
@ -1400,6 +1409,10 @@ impl RpcSol for RpcSolImpl {
signature_strs: Vec<String>, signature_strs: Vec<String>,
config: Option<RpcSignatureStatusConfig>, config: Option<RpcSignatureStatusConfig>,
) -> Result<RpcResponse<Vec<Option<TransactionStatus>>>> { ) -> Result<RpcResponse<Vec<Option<TransactionStatus>>>> {
debug!(
"get_signature_statuses rpc request received: {:?}",
signature_strs.len()
);
if signature_strs.len() > MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS { if signature_strs.len() > MAX_GET_SIGNATURE_STATUSES_QUERY_ITEMS {
return Err(Error::invalid_params(format!( return Err(Error::invalid_params(format!(
"Too many inputs provided; max {}", "Too many inputs provided; max {}",
@ -1414,6 +1427,7 @@ impl RpcSol for RpcSolImpl {
} }
fn get_slot(&self, meta: Self::Metadata, commitment: Option<CommitmentConfig>) -> Result<u64> { fn get_slot(&self, meta: Self::Metadata, commitment: Option<CommitmentConfig>) -> Result<u64> {
debug!("get_slot rpc request received");
Ok(meta.get_slot(commitment)) Ok(meta.get_slot(commitment))
} }
@ -1460,6 +1474,7 @@ impl RpcSol for RpcSolImpl {
lamports: u64, lamports: u64,
commitment: Option<CommitmentConfig>, commitment: Option<CommitmentConfig>,
) -> Result<String> { ) -> Result<String> {
debug!("request_airdrop rpc request received");
trace!( trace!(
"request_airdrop id={} lamports={} commitment: {:?}", "request_airdrop id={} lamports={} commitment: {:?}",
pubkey_str, pubkey_str,
@ -1508,6 +1523,7 @@ impl RpcSol for RpcSolImpl {
data: String, data: String,
config: Option<RpcSendTransactionConfig>, config: Option<RpcSendTransactionConfig>,
) -> Result<String> { ) -> Result<String> {
debug!("send_transaction rpc request received");
let config = config.unwrap_or_default(); let config = config.unwrap_or_default();
let (wire_transaction, transaction) = deserialize_bs58_transaction(data)?; let (wire_transaction, transaction) = deserialize_bs58_transaction(data)?;
let signature = transaction.signatures[0]; let signature = transaction.signatures[0];
@ -1559,6 +1575,7 @@ impl RpcSol for RpcSolImpl {
data: String, data: String,
config: Option<RpcSimulateTransactionConfig>, config: Option<RpcSimulateTransactionConfig>,
) -> Result<RpcResponse<RpcSimulateTransactionResult>> { ) -> Result<RpcResponse<RpcSimulateTransactionResult>> {
debug!("simulate_transaction rpc request received");
let (_, transaction) = deserialize_bs58_transaction(data)?; let (_, transaction) = deserialize_bs58_transaction(data)?;
let config = config.unwrap_or_default(); let config = config.unwrap_or_default();
@ -1591,10 +1608,12 @@ impl RpcSol for RpcSolImpl {
meta: Self::Metadata, meta: Self::Metadata,
commitment: Option<CommitmentConfig>, commitment: Option<CommitmentConfig>,
) -> Result<String> { ) -> Result<String> {
debug!("get_slot_leader rpc request received");
Ok(meta.get_slot_leader(commitment)) Ok(meta.get_slot_leader(commitment))
} }
fn minimum_ledger_slot(&self, meta: Self::Metadata) -> Result<Slot> { fn minimum_ledger_slot(&self, meta: Self::Metadata) -> Result<Slot> {
debug!("minimum_ledger_slot rpc request received");
meta.minimum_ledger_slot() meta.minimum_ledger_slot()
} }
@ -1603,26 +1622,31 @@ impl RpcSol for RpcSolImpl {
meta: Self::Metadata, meta: Self::Metadata,
commitment: Option<CommitmentConfig>, commitment: Option<CommitmentConfig>,
) -> Result<RpcVoteAccountStatus> { ) -> Result<RpcVoteAccountStatus> {
debug!("get_vote_accounts rpc request received");
meta.get_vote_accounts(commitment) meta.get_vote_accounts(commitment)
} }
fn validator_exit(&self, meta: Self::Metadata) -> Result<bool> { fn validator_exit(&self, meta: Self::Metadata) -> Result<bool> {
debug!("validator_exit rpc request received");
Ok(meta.validator_exit()) Ok(meta.validator_exit())
} }
fn get_identity(&self, meta: Self::Metadata) -> Result<RpcIdentity> { fn get_identity(&self, meta: Self::Metadata) -> Result<RpcIdentity> {
debug!("get_identity rpc request received");
Ok(RpcIdentity { Ok(RpcIdentity {
identity: meta.config.identity_pubkey.to_string(), identity: meta.config.identity_pubkey.to_string(),
}) })
} }
fn get_version(&self, _: Self::Metadata) -> Result<RpcVersionInfo> { fn get_version(&self, _: Self::Metadata) -> Result<RpcVersionInfo> {
debug!("get_version rpc request received");
Ok(RpcVersionInfo { Ok(RpcVersionInfo {
solana_core: solana_version::Version::default().to_string(), solana_core: solana_version::Version::default().to_string(),
}) })
} }
fn set_log_filter(&self, meta: Self::Metadata, filter: String) -> Result<()> { fn set_log_filter(&self, meta: Self::Metadata, filter: String) -> Result<()> {
debug!("set_log_filter rpc request received");
meta.set_log_filter(filter); meta.set_log_filter(filter);
Ok(()) Ok(())
} }
@ -1633,6 +1657,7 @@ impl RpcSol for RpcSolImpl {
slot: Slot, slot: Slot,
encoding: Option<UiTransactionEncoding>, encoding: Option<UiTransactionEncoding>,
) -> Result<Option<ConfirmedBlock>> { ) -> Result<Option<ConfirmedBlock>> {
debug!("get_confirmed_block rpc request received: {:?}", slot);
meta.get_confirmed_block(slot, encoding) meta.get_confirmed_block(slot, encoding)
} }
@ -1642,6 +1667,10 @@ impl RpcSol for RpcSolImpl {
start_slot: Slot, start_slot: Slot,
end_slot: Option<Slot>, end_slot: Option<Slot>,
) -> Result<Vec<Slot>> { ) -> Result<Vec<Slot>> {
debug!(
"get_confirmed_blocks rpc request received: {:?}-{:?}",
start_slot, end_slot
);
meta.get_confirmed_blocks(start_slot, end_slot) meta.get_confirmed_blocks(start_slot, end_slot)
} }
@ -1655,6 +1684,10 @@ impl RpcSol for RpcSolImpl {
signature_str: String, signature_str: String,
encoding: Option<UiTransactionEncoding>, encoding: Option<UiTransactionEncoding>,
) -> Result<Option<ConfirmedTransaction>> { ) -> Result<Option<ConfirmedTransaction>> {
debug!(
"get_confirmed_transaction rpc request received: {:?}",
signature_str
);
let signature = verify_signature(&signature_str)?; let signature = verify_signature(&signature_str)?;
Ok(meta.get_confirmed_transaction(signature, encoding)) Ok(meta.get_confirmed_transaction(signature, encoding))
} }
@ -1666,6 +1699,10 @@ impl RpcSol for RpcSolImpl {
start_slot: Slot, start_slot: Slot,
end_slot: Slot, end_slot: Slot,
) -> Result<Vec<String>> { ) -> Result<Vec<String>> {
debug!(
"get_confirmed_signatures_for_address rpc request received: {:?} {:?}-{:?}",
pubkey_str, start_slot, end_slot
);
let pubkey = verify_pubkey(pubkey_str)?; let pubkey = verify_pubkey(pubkey_str)?;
if end_slot < start_slot { if end_slot < start_slot {
return Err(Error::invalid_params(format!( return Err(Error::invalid_params(format!(
@ -1687,6 +1724,7 @@ impl RpcSol for RpcSolImpl {
} }
fn get_first_available_block(&self, meta: Self::Metadata) -> Result<Slot> { fn get_first_available_block(&self, meta: Self::Metadata) -> Result<Slot> {
debug!("get_first_available_block rpc request received");
Ok(meta.get_first_available_block()) Ok(meta.get_first_available_block())
} }