Skip to content

Add bounded live bot and tester scenarios#38

Merged
phroi merged 5 commits into
masterfrom
review/live-actors-bot-tester
May 20, 2026
Merged

Add bounded live bot and tester scenarios#38
phroi merged 5 commits into
masterfrom
review/live-actors-bot-tester

Conversation

@phroi
Copy link
Copy Markdown
Member

@phroi phroi commented May 20, 2026

Why

The live bot and tester need safer bounded execution on testnet so operator runs can fail visibly, preserve CKB reserves, and avoid leaking local secrets in runtime logs.

Changes

  • Add bot chain preflight, retry handling for tip races, reserve-aware order execution, and redacted lifecycle/error logs.
  • Add tester scenario selection, bounded fee overrides, SDK conversion and multi-order paths, reserve checks, and terminal error handling.
  • Document tester scenario and fee environment controls.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements a CKB reserve mechanism across the bot and tester applications to ensure accounts maintain a minimum balance after transactions. It introduces comprehensive secret redaction for sensitive data like private keys and RPC URLs in logs and error summaries. The tester is significantly enhanced with new transaction scenarios (such as SDK conversions and multi-order limit orders) and support for custom fee policies. Feedback suggests optimizing the tester by using local fee estimation instead of RPC calls to improve performance and maintain consistency with the bot's implementation.

Comment thread apps/tester/src/index.ts Outdated
@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 20, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a CKB reserve mechanism to prevent the bot and tester from exhausting plain CKB needed for transaction fees. It includes logic to estimate post-transaction balances and skip operations that violate the reserve. Additionally, it enhances observability by redacting sensitive data like private keys and RPC URLs from logs and error summaries. The tester application is updated with new scenarios and configurable fee policies. A critical issue was identified in the bot's reserve check: being unconditional, it could cause a deadlock by preventing withdrawals that would otherwise replenish the CKB balance. A conditional check was suggested to ensure the reserve only blocks CKB-consuming transactions.

Comment thread apps/bot/src/runtime.ts Outdated
@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 20, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request implements CKB reserve management for the bot and tester applications to ensure sufficient funds for operational costs. It introduces various new test scenarios for the tester, enhances security by redacting secrets in logs and error reports, and adds retry mechanisms for transient chain errors. Review feedback highlighted a need to refine the unspent capacity calculation in both applications to strictly count plain CKB cells, ensuring consistency with how output capacities are handled and improving the accuracy of reserve monitoring.

Comment thread apps/bot/src/runtime.ts
Comment thread apps/tester/src/index.ts
@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 20, 2026

/gemini review

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces significant updates to the bot and tester services, primarily focusing on robust CKB reserve management and enhanced observability. Key changes include the implementation of a post-transaction CKB balance check to ensure the bot maintains a defined reserve, the addition of secret redaction for sensitive runtime information in logs and error summaries, and the introduction of new test scenarios for the tester service. Additionally, the transaction building logic has been refactored to support multiple raw orders and SDK-based conversions, and pre-flight chain verification has been added to the startup process.

@phroi
Copy link
Copy Markdown
Member Author

phroi commented May 20, 2026

LGTM

Phroi %202

@phroi phroi merged commit 0da2a9a into master May 20, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant