Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(node): more logs when carry out payment verification #2590

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions ant-node/src/put_validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -640,7 +640,7 @@ impl Node {
) -> Result<()> {
let key = address.to_record_key();
let pretty_key = PrettyPrintRecordKey::from(&key).into_owned();
debug!("Validating record payment for {pretty_key}");
info!("Validating record payment for {pretty_key}");

// check if the quote is valid
let self_peer_id = self.network().peer_id();
Expand All @@ -665,6 +665,7 @@ impl Node {
let mut payees = payment.payees();
payees.retain(|peer_id| !closest_k_peers.contains(peer_id));
if !payees.is_empty() {
info!("Payment quote has out-of-range payees {payees:?}");
return Err(Error::InvalidRequest(format!(
"Payment quote has out-of-range payees {payees:?}"
)));
Expand All @@ -678,10 +679,12 @@ impl Node {
// check if payment is valid on chain
let payments_to_verify = payment.digest();
debug!("Verifying payment for record {pretty_key}");
let reward_amount =
let verify_data_payment_result =
verify_data_payment(self.evm_network(), owned_payment_quotes, payments_to_verify)
.await
.map_err(|e| Error::EvmNetwork(format!("Failed to verify chunk payment: {e}")))?;
.map_err(|e| Error::EvmNetwork(format!("Failed to verify chunk payment: {e}")));
info!("Data payemnt of record {pretty_key} verification result is {verify_data_payment_result:?}.");
let reward_amount = verify_data_payment_result?;
debug!("Payment of {reward_amount:?} is valid for record {pretty_key}");

// Notify `record_store` that the node received a payment.
Expand Down
2 changes: 2 additions & 0 deletions evmlib/src/contract/payment_vault/handler.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ where
let metrics: Vec<_> = metrics.into_iter().map(|v| v.into()).collect();
let mut amounts = self.contract.getQuote(metrics.clone()).call().await?.prices;

info!("Fetched amounts are {amounts:?}, for the quiting_metris of {metrics:?}");

// FIXME: temporary logic until the smart contract gets updated
if amounts.len() == 1 {
let value = amounts[0];
Expand Down
Loading