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

Some logging improvements #43

Merged
merged 1 commit into from
Jul 18, 2024
Merged
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
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