Skip to content

Commit 2398961

Browse files
areinclaude
andcommitted
fix: address PR review feedback
- Move sleep before receipt check to avoid unnecessary 2s delay on timeout - Add comment about signed int normalization scope (uint256 only) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 7714455 commit 2398961

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/auth.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,17 @@ pub async fn send_and_confirm_cwp_tx(
117117
.await
118118
.context("CWP send-transaction failed")?;
119119

120-
// Wait for on-chain confirmation (poll immediately, then every 2s, timeout at 2 min)
121-
for _ in 0..60 {
120+
// Wait for on-chain confirmation (poll every 2s, timeout at 2 min)
121+
for i in 0..60 {
122+
if i > 0 {
123+
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
124+
}
122125
if let Some(receipt) = provider.get_transaction_receipt(tx_hash).await? {
123126
if !receipt.status() {
124127
bail!("Transaction {tx_hash} reverted on-chain");
125128
}
126129
return Ok(tx_hash);
127130
}
128-
tokio::time::sleep(std::time::Duration::from_secs(2)).await;
129131
}
130132
bail!("Transaction {tx_hash} not confirmed after 2 minutes")
131133
}

src/cwp.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -420,7 +420,9 @@ fn normalize_value(
420420
type_map: &HashMap<String, HashMap<String, String>>,
421421
) {
422422
if sol_type.starts_with("uint") || sol_type.starts_with("int") {
423-
// Convert hex "0x..." to decimal string
423+
// Convert hex "0x..." to decimal string.
424+
// Note: uses U256 for both uint and int types. Polymarket only uses uint256;
425+
// proper signed int support would need I256 if int types are ever used.
424426
if let Some(s) = value.as_str() {
425427
if let Some(hex) = s.strip_prefix("0x").or_else(|| s.strip_prefix("0X")) {
426428
if let Ok(n) = U256::from_str_radix(hex, 16) {

0 commit comments

Comments
 (0)