-
Notifications
You must be signed in to change notification settings - Fork 182
fix eth_newPendingTransactionFilter test #6361
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
Conversation
WalkthroughThe Calibnet API stateful test infrastructure is updated to use a new wallet environment variable and test script that validates arguments and writes a private key file. The Rust test module introduces a contract invocation helper function and refactors message handling logic to fetch the current tipset epoch. Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes
Possibly related PRs
Suggested labels
Suggested reviewers
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (3)
scripts/tests/calibnet_api_test_stateful_check.sh (2)
19-21: Private key file is not cleaned up after use.The private key is written to
calibnet_t4_wallet.keybut never removed, leaving sensitive data on disk. Consider cleaning up the file after import.Additionally, passing
"$@"toforest_initwill forward the private key argument, but based on theharness.shsnippet,forest_initexpects optional--backfill-dbarguments, not a private key. This may cause unexpected behavior.🔎 Suggested fix
echo "$1" > calibnet_t4_wallet.key +shift # Remove private key from positional args before passing to forest_init forest_init "$@" $FOREST_WALLET_PATH --remote-wallet import calibnet_t4_wallet.key +rm -f calibnet_t4_wallet.key
33-36: Clarify the comment about the Ethereum address.The comment on line 35 states this is "the Ethereum address corresponding to the contract f4 address," but the address
0xbf89d559af87e0e3d9848d36aa0dea60a2641476appears to be the mint recipient (derived fromFROM_ADDRESS), not the contract address. Consider updating the comment for clarity.🔎 Suggested fix
# cast calldata "mint(address,uint256)" 0xbf89d559af87e0e3d9848d36aa0dea60a2641476 1000000000000000000 # -# Note that 0xbf89d559af87e0e3d9848d36aa0dea60a2641476 is the Ethereum address corresponding to the contract f4 address. +# Note that 0xbf89d559af87e0e3d9848d36aa0dea60a2641476 is the Ethereum address corresponding to FROM_ADDRESS (the mint recipient).src/tool/subcommands/api_cmd/stateful_tests.rs (1)
571-587: Consider usinginvoke_contracthere for consistency.The
eth_get_filter_logstest has similar inline message construction that could potentially use the newinvoke_contracthelper for consistency. However, since this test is currently ignored (issue #5917), this refactor can be deferred until that issue is addressed.
📜 Review details
Configuration used: Repository UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.github/workflows/forest.yml(1 hunks)scripts/tests/calibnet_api_test_stateful_check.sh(1 hunks)src/tool/subcommands/api_cmd/stateful_tests.rs(6 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: elmattic
Repo: ChainSafe/forest PR: 5836
File: src/tool/subcommands/api_cmd/api_run_tests.rs:186-190
Timestamp: 2025-08-11T12:42:42.848Z
Learning: In the Forest project's test infrastructure (specifically in `src/tool/subcommands/api_cmd/api_run_tests.rs`), the team prefers to use only `ws` (non-secure WebSocket) connections for simplicity in their stateful API test scenarios, as security is not a concern in their testing context.
📚 Learning: 2025-08-07T09:37:03.079Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5886
File: scripts/tests/calibnet_eth_mapping_check.sh:49-49
Timestamp: 2025-08-07T09:37:03.079Z
Learning: In Forest project scripts, `forest_wait_api` (called within `forest_init`) ensures basic RPC service readiness, while `forest_wait_for_healthcheck_ready` performs additional comprehensive checks including DB backfill completion. When using `--backfill-db` flag, basic RPC operations can proceed after `forest_init`, but operations requiring complete DB backfill should wait for `forest_wait_for_healthcheck_ready`.
Applied to files:
.github/workflows/forest.yml
📚 Learning: 2025-08-11T12:42:42.848Z
Learnt from: elmattic
Repo: ChainSafe/forest PR: 5836
File: src/tool/subcommands/api_cmd/api_run_tests.rs:186-190
Timestamp: 2025-08-11T12:42:42.848Z
Learning: In the Forest project's test infrastructure (specifically in `src/tool/subcommands/api_cmd/api_run_tests.rs`), the team prefers to use only `ws` (non-secure WebSocket) connections for simplicity in their stateful API test scenarios, as security is not a concern in their testing context.
Applied to files:
.github/workflows/forest.yml
🧬 Code graph analysis (2)
scripts/tests/calibnet_api_test_stateful_check.sh (2)
scripts/tests/harness.sh (1)
forest_init(107-131)src/key_management/wallet.rs (1)
import(107-112)
src/tool/subcommands/api_cmd/stateful_tests.rs (1)
src/message/signed_message.rs (1)
new_unchecked(35-37)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
- GitHub Check: Coverage
- GitHub Check: Build forest binaries on Linux AMD64
- GitHub Check: tests-release
🔇 Additional comments (6)
.github/workflows/forest.yml (1)
434-438: LGTM! Verify the new secret is configured.The workflow correctly switches to
CALIBNET_T4_WALLETfor the stateful API tests, which aligns with the T4/f4 address wallet needed for EVM contract interactions. Ensure theCALIBNET_T4_WALLETsecret is configured in the repository settings.src/tool/subcommands/api_cmd/stateful_tests.rs (5)
4-5: LGTM!The new imports for
SignedMessageandETH_CHAIN_IDare correctly added to support the newinvoke_contracthelper function.
298-320: LGTM!Fetching the current tipset via
ChainHeadand using its epoch forStateWaitMsgis the correct fix. This ensures the wait operation uses an up-to-date chain height, addressing potential timing issues where a stale epoch could cause the message lookup to fail.
322-360: LGTM! The manual EIP-1559 signing is the key fix.The
invoke_contracthelper correctly implements manual signing for f4 (Ethereum-style) addresses:
- Builds the message and estimates gas
- Constructs an EIP-1559 transaction for Ethereum-compatible signing
- Signs via
WalletSignusing the imported T4 wallet key- Pushes the pre-signed message via
MpoolPushThis differs from
eth_get_filter_logswhich usesMpoolPushMessage(node signs). The manual signing approach is required for f4 addresses where the wallet holds the private key.
514-536: LGTM!The test correctly uses the new
invoke_contracthelper and properly tracks the returned CID for verification. The flow is now cleaner and addresses the original issue whereEthGetFilterChangeswas returning no results.
675-681: LGTM! Test is now enabled.Removing the
.ignore()annotation enables theeth_newPendingTransactionFiltertest, which was previously skipped due to issue #5916. Theinvoke_contractfix using proper EIP-1559 signing for f4 addresses should resolve the underlying issue.
Summary of changes
Changes introduced in this pull request:
Reference issue to close (if applicable)
Closes #5916
Other information and links
Change checklist
Summary by CodeRabbit
Tests
Chores
✏️ Tip: You can customize this high-level summary in your review settings.