Skip to content

Commit

Permalink
Some logging imporvements
Browse files Browse the repository at this point in the history
  • Loading branch information
lxfind committed Jul 18, 2024
1 parent 6117eb8 commit bc19b3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ rpc-port: 9527
metrics-port: 9184
gas-pool-config:
redis:
redis_url: "redis:://127.0.0.1"
redis_url: "redis://127.0.0.1"
fullnode-url: "http://localhost:9000"
coin-init-config:
target-init-balance: 100000000
Expand Down
15 changes: 11 additions & 4 deletions src/gas_pool/gas_pool_core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -112,17 +112,21 @@ impl GasPool {
// We first query the total balance prior to transaction execution, then execute the
// transaction, and finally derive the new gas coin balance using the gas usage from effects.
let total_gas_coin_balance = self.get_total_gas_coin_balance(payment.clone()).await;
let response = self.execute_transaction_impl(tx_data, user_sig).await;
debug!(
?reservation_id,
"Total gas coin balance prior to execution: {}", total_gas_coin_balance,
);
let response = self
.execute_transaction_impl(reservation_id, tx_data, user_sig)
.await;
let updated_coins = match &response {
Ok(effects) => {
let new_gas_coin = effects.gas_object().reference.to_object_ref();
let new_balance =
total_gas_coin_balance as i64 - effects.gas_cost_summary().net_gas_usage();
debug!(
?reservation_id,
"Total gas coin balance prior to execution: {}, new balance: {}",
total_gas_coin_balance,
new_balance
"New gas coin balance after execution: {}", new_balance,
);
#[cfg(test)]
{
Expand Down Expand Up @@ -171,6 +175,7 @@ impl GasPool {

async fn execute_transaction_impl(
&self,
reservation_id: ReservationID,
tx_data: TransactionData,
user_sig: GenericSignature,
) -> anyhow::Result<SuiTransactionBlockEffects> {
Expand All @@ -184,9 +189,11 @@ impl GasPool {
},
3
)?;
debug!(?reservation_id, "Transaction signed by sponsor");
let tx = Transaction::from_generic_sig_data(tx_data, vec![sponsor_sig, user_sig]);
let cur_time = std::time::Instant::now();
let effects = self.sui_client.execute_transaction(tx, 3).await?;
debug!(?reservation_id, "Transaction executed");
let elapsed = cur_time.elapsed().as_millis();
self.metrics
.transaction_execution_latency_ms
Expand Down

0 comments on commit bc19b3a

Please sign in to comment.