Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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 bots/bot-sniper-1-geyser.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ compute_units:
# Note: Savings don't show in "consumed CU" but improve tx priority/cost.
# Note (Nov 23, 2025): with data size set to 512KB, transactions fail - increasing to 12.5MB resolves the issue.
# Reference: https://www.anza.xyz/blog/cu-optimization-with-setloadedaccountsdatasizelimit
account_data_size: 12_500_000
# account_data_size: 12_500_000 # Disabled: causes MaxLoadedAccountsDataSizeExceeded with Token-2022

# Filters for token selection
filters:
Expand Down
2 changes: 1 addition & 1 deletion bots/bot-sniper-2-logs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ compute_units:
# Note: Savings don't show in "consumed CU" but improve tx priority/cost.
# Note (Nov 23, 2025): with data size set to 512KB, transactions fail - increasing to 12.5MB resolves the issue.
# Reference: https://www.anza.xyz/blog/cu-optimization-with-setloadedaccountsdatasizelimit
account_data_size: 12_500_000
# account_data_size: 12_500_000 # Disabled: causes MaxLoadedAccountsDataSizeExceeded with Token-2022

# Filters for token selection
filters:
Expand Down
2 changes: 1 addition & 1 deletion bots/bot-sniper-3-blocks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ compute_units:
# Note: Savings don't show in "consumed CU" but improve tx priority/cost.
# Note (Nov 23, 2025): with data size set to 512KB, transactions fail - increasing to 12.5MB resolves the issue.
# Reference: https://www.anza.xyz/blog/cu-optimization-with-setloadedaccountsdatasizelimit
account_data_size: 12_500_000
# account_data_size: 12_500_000 # Disabled: causes MaxLoadedAccountsDataSizeExceeded with Token-2022

# Filters for token selection
filters:
Expand Down
2 changes: 1 addition & 1 deletion bots/bot-sniper-4-pp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ compute_units:
# Note: Savings don't show in "consumed CU" but improve tx priority/cost.
# Note (Nov 23, 2025): with data size set to 512KB, transactions fail - increasing to 12.5MB resolves the issue.
# Reference: https://www.anza.xyz/blog/cu-optimization-with-setloadedaccountsdatasizelimit
account_data_size: 12_500_000
# account_data_size: 12_500_000 # Disabled: causes MaxLoadedAccountsDataSizeExceeded with Token-2022

# Filters for token selection
filters:
Expand Down
30 changes: 27 additions & 3 deletions src/core/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,26 +280,41 @@ async def build_and_send_transaction(
async def confirm_transaction(
self, signature: str, commitment: str = "confirmed"
) -> bool:
"""Wait for transaction confirmation.
"""Wait for transaction confirmation and verify execution success.

Confirms the transaction landed on-chain, then checks meta.err to
ensure the inner program instructions actually succeeded. A transaction
can be "confirmed" (included in a block) but still fail execution.

Args:
signature: Transaction signature
commitment: Confirmation commitment level

Returns:
Whether transaction was confirmed
Whether transaction was confirmed AND executed successfully
"""
await self._rate_limiter.acquire()
client = await self.get_client()
try:
await client.confirm_transaction(
signature, commitment=commitment, sleep_seconds=1
)
return True
except Exception:
logger.exception(f"Failed to confirm transaction {signature}")
return False

# Verify the transaction actually succeeded (no program errors)
result = await self._get_transaction_result(str(signature))
if result:
tx_err = result.get("meta", {}).get("err")
if tx_err:
logger.error(
f"Transaction {str(signature)[:16]}... confirmed but failed: {tx_err}"
)
return False

return True

async def get_transaction_token_balance(
self, signature: str, user_pubkey: Pubkey, mint: Pubkey
) -> int | None:
Expand Down Expand Up @@ -354,6 +369,15 @@ async def get_buy_transaction_details(
return None, None

meta = result.get("meta", {})

# Check for transaction execution errors (e.g., MaxLoadedAccountsDataSizeExceeded)
tx_err = meta.get("err")
if tx_err:
logger.error(
f"Transaction {signature[:16]}... failed with error: {tx_err}"
)
return None, None

mint_str = str(mint)

# Get tokens received from pre/post token balance diff
Expand Down
3 changes: 2 additions & 1 deletion src/trading/platform_aware.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ async def execute(self, token_info: TokenInfo) -> TradeResult:
else:
raise ValueError(
f"Failed to parse transaction details: tokens={tokens_raw}, "
f"sol_spent={sol_spent}"
f"sol_spent={sol_spent} (tx: {tx_signature}). "
f"The transaction may have failed on-chain — check explorer."
)

return TradeResult(
Expand Down