Skip to content

Conversation

@hanabi1224
Copy link
Contributor

@hanabi1224 hanabi1224 commented Dec 9, 2025

Summary of changes

Changes introduced in this pull request:

Reference issue to close (if applicable)

Closes #6309

Other information and links

Change checklist

  • I have performed a self-review of my own code,
  • I have made corresponding changes to the documentation. All new code adheres to the team's documentation standards,
  • I have added tests that prove my fix is effective or that my feature works (if possible),
  • I have made sure the CHANGELOG is up-to-date. All user-facing changes should be reflected in this document.

Summary by CodeRabbit

  • New Features

    • Added an API method to convert Filecoin addresses into Ethereum addresses (available in API v1 and v2) and expanded description for existing address-conversion endpoint.
  • Tests

    • Added tests and snapshots for the new conversion method, including tipset-based resolution scenarios.
  • Chores

    • Improved test tooling to ignore inline comments in snapshot/test lists, refining test corpus generation.
  • Documentation

    • Updated changelog with the new API entry.

✏️ Tip: You can customize this high-level summary in your review settings.

@hanabi1224 hanabi1224 added the RPC requires calibnet RPC checks to run on CI label Dec 9, 2025
@coderabbitai
Copy link
Contributor

coderabbitai bot commented Dec 9, 2025

Walkthrough

Added a new RPC method Filecoin.FilecoinAddressToEthAddress (API v1/v2) that converts a Filecoin address to an EthAddress, performing direct conversion or tipset-based ID resolution when needed; registered the method, updated EthAddressToFilecoinAddress metadata, adjusted test harness parsing, and added tests and snapshots.

Changes

Cohort / File(s) Summary
RPC method implementation
src/rpc/methods/eth.rs
Added public FilecoinAddressToEthAddress RpcMethod<2> with params (FilecoinAddress, Option<BlockNumberOrPredefined>) returning EthAddress. Implements direct conversion or tipset-based resolution with ID lookup. Added DESCRIPTION to EthAddressToFilecoinAddress metadata.
RPC registration
src/rpc/mod.rs
Registered FilecoinAddressToEthAddress in the ETH method dispatch macro so the method is exposed on API v1 and v2.
Tests & snapshots
src/tool/subcommands/api_cmd/api_compare_tests.rs, src/tool/subcommands/api_cmd/test_snapshots.txt, src/tool/subcommands/api_cmd/test_snapshot.rs
Added test invocations for FilecoinAddressToEthAddress (including Latest/tipset cases), added two snapshot entries, and updated test parsing to strip inline comments before processing.
Test generation & build
build.rs
Test snapshot collection pipeline updated to strip inline comments (split at # and trim) before filtering, changing which snapshots are discovered/processed.
Changelog
CHANGELOG.md
Added unreleased changelog entry noting the new Filecoin.FilecoinAddressToEthAddress API method.

Sequence Diagram(s)

mermaid
sequenceDiagram
participant Client
participant RPC_Server
participant ChainStore
participant AddressResolver
Note over Client,RPC_Server: Client calls Filecoin.FilecoinAddressToEthAddress
Client->>RPC_Server: request(FilecoinAddress, Optional)
RPC_Server->>AddressResolver: try_direct_convert(FilecoinAddress)
alt direct conversion succeeds
AddressResolver-->>RPC_Server: EthAddress
else requires resolution
RPC_Server->>ChainStore: resolve_tipset(BlockParam)
ChainStore-->>RPC_Server: Tipset
RPC_Server->>AddressResolver: lookup_id_and_convert(FilecoinAddress, Tipset)
AddressResolver-->>RPC_Server: EthAddress
end
RPC_Server-->>Client: EthAddress | error

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

  • Focus areas:
    • src/rpc/methods/eth.rs: tipset resolution correctness, ID lookup semantics, error propagation, and async handling.
    • build.rs and src/tool/subcommands/api_cmd/test_snapshot.rs: ensure inline-comment stripping doesn't drop valid entries and matches test generation expectations.
    • Tests/snapshots: verify new snapshots align with implemented behavior.

Possibly related PRs

Suggested reviewers

  • akaladarshi
  • LesnyRumcajs

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 16.67% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: adding a v1 RPC method FilecoinAddressToEthAddress.
Linked Issues check ✅ Passed The PR implements the FilecoinAddressToEthAddress RPC method as required by issue #6309, though v1 rather than v2 as labeled.
Out of Scope Changes check ✅ Passed Changes are focused on the new RPC method implementation; build.rs and test infrastructure updates support this primary objective.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch hm/v1-filecoin-address-to-eth-address

Comment @coderabbitai help to get the list of available commands and usage tips.

@hanabi1224 hanabi1224 marked this pull request as ready for review December 9, 2025 14:59
@hanabi1224 hanabi1224 requested a review from a team as a code owner December 9, 2025 14:59
@hanabi1224 hanabi1224 requested review from LesnyRumcajs and akaladarshi and removed request for a team December 9, 2025 14:59
Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 (2)
src/tool/subcommands/api_cmd/api_compare_tests.rs (1)

1459-1472: New ETH<->Filecoin address tests are wired correctly; consider an extra state‑resolved case

The switch to "…".parse().unwrap() for EthAddressToFilecoinAddress keeps behavior identical and is idiomatic with type inference, and adding FilecoinAddressToEthAddress here ensures the new RPC is covered by the Lotus/Forest comparison harness. If you want broader coverage, you might optionally add a second case using a non‑delegated (e.g., secp/BLS) Filecoin address that requires ID lookup at a specific block height to exercise the state‑dependent path of the new method.

src/rpc/methods/eth.rs (1)

2765-2795: FilecoinAddressToEthAddress two‑stage resolution looks correct and consistent

The new RPC cleanly separates:

  • A fast, purely structural path for addresses already encodable as EthAddress (Protocol::ID and valid EAM Delegated), and
  • A stateful path for other Filecoin addresses, resolving the ID at a tipset chosen by blockParam (defaulting to ExtPredefined::Finalized) and then converting that ID via EthAddress::from_filecoin_address.

This aligns with existing helpers (tipset_by_ext_block_number_or_hash, lookup_required_id, EthAddress::from_filecoin_address) and gives callers a way to pin resolution to a specific block while keeping a safe default. I don’t see correctness issues here; the behavior on non-resolvable or invalid addresses will naturally surface as errors from the underlying helpers.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f4008dd and d1dc6cc.

📒 Files selected for processing (5)
  • CHANGELOG.md (1 hunks)
  • src/rpc/methods/eth.rs (2 hunks)
  • src/rpc/mod.rs (1 hunks)
  • src/tool/subcommands/api_cmd/api_compare_tests.rs (1 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (1 hunks)
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.350Z
Learning: For miner actor ChangeOwnerAddress and ChangeOwnerAddressExported methods: versions 8-10 use bare Address as parameter type, while versions 11+ use ChangeOwnerAddressParams. This reflects the evolution of the Filecoin miner actor parameter structures across versions.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6057
File: src/cli/subcommands/f3_cmd.rs:0-0
Timestamp: 2025-09-09T10:37:17.947Z
Learning: hanabi1224 prefers having default timeouts (like 10m for --no-progress-timeout) to prevent commands from hanging indefinitely, even when the timeout flag isn't explicitly provided by users. This fail-fast approach is preferred over requiring explicit flag usage.
📚 Learning: 2025-09-02T14:23:53.808Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/tool/subcommands/api_cmd/test_snapshots.txt:206-252
Timestamp: 2025-09-02T14:23:53.808Z
Learning: In the Forest project, .rpcsnap.json.zst snapshot files listed in src/tool/subcommands/api_cmd/test_snapshots.txt are not stored in the repository itself but are downloaded from a DigitalOcean (DO) bucket when needed. The manifest file serves as an index/catalog of available snapshots.

Applied to files:

  • src/tool/subcommands/api_cmd/test_snapshots.txt
📚 Learning: 2025-09-02T10:05:34.350Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.350Z
Learning: For miner actor ChangeOwnerAddress and ChangeOwnerAddressExported methods: versions 8-10 use bare Address as parameter type, while versions 11+ use ChangeOwnerAddressParams. This reflects the evolution of the Filecoin miner actor parameter structures across versions.

Applied to files:

  • src/tool/subcommands/api_cmd/api_compare_tests.rs
  • CHANGELOG.md
  • src/rpc/mod.rs
  • src/rpc/methods/eth.rs
🧬 Code graph analysis (1)
src/rpc/methods/eth.rs (2)
src/rpc/reflect/mod.rs (1)
  • all_with_v2 (156-158)
src/rpc/methods/eth/types.rs (1)
  • from_filecoin_address (156-182)
⏰ 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). (7)
  • GitHub Check: tests
  • GitHub Check: tests-release
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build Ubuntu
  • GitHub Check: Build MacOS
  • GitHub Check: All lint checks
🔇 Additional comments (4)
src/tool/subcommands/api_cmd/test_snapshots.txt (1)

95-95: LGTM! Test snapshot entry properly added.

The new snapshot file entry follows the existing naming convention and is correctly positioned alphabetically in the list.

src/rpc/mod.rs (1)

101-101: LGTM! RPC method registration is correct.

The new FilecoinAddressToEthAddress method is properly registered in the eth vertical section, following the established pattern and logically grouped with the related address conversion method.

CHANGELOG.md (1)

38-39: LGTM! Changelog entry is properly formatted.

The changelog entry correctly documents the new RPC method with proper formatting, categorization, and references both API v1 and v2 support as expected.

src/rpc/methods/eth.rs (1)

2747-2755: EthAddressToFilecoinAddress DESCRIPTION matches behavior

Adding the DESCRIPTION clarifies that this method specifically returns f410-style Filecoin addresses for Ethereum accounts, without changing behavior or API surface.

Comment on lines 1465 to 1470
FilecoinAddressToEthAddress::request((
"t410f744ma4xsq3r3eczzktfj7goal67myzfkusna2hy"
.parse()
.unwrap(),
None,
))
Copy link
Member

@LesnyRumcajs LesnyRumcajs Dec 9, 2025

Choose a reason for hiding this comment

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

Let's add all supported categories of addresses to tests, f0-f4.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Covered in c5e17b0

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1dc6cc and c5e17b0.

📒 Files selected for processing (2)
  • src/tool/subcommands/api_cmd/api_compare_tests.rs (2 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tool/subcommands/api_cmd/test_snapshots.txt
🧰 Additional context used
🧠 Learnings (2)
📓 Common learnings
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.350Z
Learning: For miner actor ChangeOwnerAddress and ChangeOwnerAddressExported methods: versions 8-10 use bare Address as parameter type, while versions 11+ use ChangeOwnerAddressParams. This reflects the evolution of the Filecoin miner actor parameter structures across versions.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6057
File: src/cli/subcommands/f3_cmd.rs:0-0
Timestamp: 2025-09-09T10:37:17.947Z
Learning: hanabi1224 prefers having default timeouts (like 10m for --no-progress-timeout) to prevent commands from hanging indefinitely, even when the timeout flag isn't explicitly provided by users. This fail-fast approach is preferred over requiring explicit flag usage.
📚 Learning: 2025-09-02T10:05:34.350Z
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.350Z
Learning: For miner actor ChangeOwnerAddress and ChangeOwnerAddressExported methods: versions 8-10 use bare Address as parameter type, while versions 11+ use ChangeOwnerAddressParams. This reflects the evolution of the Filecoin miner actor parameter structures across versions.

Applied to files:

  • src/tool/subcommands/api_cmd/api_compare_tests.rs
⏰ 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). (7)
  • GitHub Check: tests
  • GitHub Check: tests-release
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build MacOS
  • GitHub Check: Build Ubuntu
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: All lint checks
🔇 Additional comments (3)
src/tool/subcommands/api_cmd/api_compare_tests.rs (3)

1459-1463: LGTM: Cleaner parsing syntax.

Using .parse() is more idiomatic than explicitly calling from_str(), and the behavior is identical.


1947-1955: LGTM: Good addition of miner address conversion test.

Testing the address conversion with real miner addresses from blocks provides good coverage of ID addresses (f0) in actual chain scenarios.


1959-1967: LGTM: Good addition of message sender address conversion tests.

Testing address conversion with actual message senders from the chain provides coverage of various address types used in real transactions.

Comment on lines 1465 to 1472
FilecoinAddressToEthAddress::request((
"t410f744ma4xsq3r3eczzktfj7goal67myzfkusna2hy"
.parse()
.unwrap(),
None,
))
.unwrap(),
));
Copy link
Contributor

@coderabbitai coderabbitai bot Dec 10, 2025

Choose a reason for hiding this comment

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

🛠️ Refactor suggestion | 🟠 Major

Add tests for all address types (f0-f3) as requested in the previous review.

The test currently only covers f4 (delegated) addresses. Per the previous review feedback, please add explicit test cases for all supported Filecoin address types:

  • f0/t0: ID address (e.g., t01234 or use Address::new_id(...))
  • f1/t1: secp256k1 address (e.g., t1w2zb5a723izlm4q3khclsjcnapfzxcfhvqyfoly - already available in prefunded_wallets)
  • f2/t2: Actor address (e.g., t2nfplhzpyeck5dcc4fokj5ar6nbs3mhbdmq6xu3q - already available in prefunded_wallets)
  • f3/t3: BLS address (e.g., t3wmbvnabsj6x2uki33phgtqqemmunnttowpx3chklrchy76pv52g5ajnaqdypxoomq5ubfk65twl5ofvkhshq - already available in prefunded_wallets)

Based on past review comment.

🤖 Prompt for AI Agents
In src/tool/subcommands/api_cmd/api_compare_tests.rs around lines 1465-1472 the
test only covers an f4 (delegated) Filecoin address; add explicit test cases for
the remaining address types f0/t0 (ID), f1/t1 (secp256k1), f2/t2 (actor), and
f3/t3 (BLS). For f0 use Address::new_id(...) or a literal like "t01234". For f1,
f2 and f3 use the existing prefunded_wallets examples (e.g., t1w2zb5...,
t2nfplh..., t3wmbvna...), calling FilecoinAddressToEthAddress::request(...) for
each and asserting the expected results (matching the pattern used for f4),
handling unwraps/errors consistently with the test style.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

F0 is covered in c5e17b0

Copy link
Contributor

Choose a reason for hiding this comment

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

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Check the commit referenced by the user
git show c5e17b0e3249514937b9cfb2aca1453c3b15082f --stat

Length of output: 312


🏁 Script executed:

#!/bin/bash
# Show the actual changes in that commit
git show c5e17b0e3249514937b9cfb2aca1453c3b15082f

Length of output: 2438


🏁 Script executed:

#!/bin/bash
# Search for all FilecoinAddressToEthAddress test usages in the test file
rg -n "FilecoinAddressToEthAddress::request" src/tool/subcommands/api_cmd/api_compare_tests.rs -A 3 -B 1

Length of output: 773


@hanabi1224, Thanks for pointing out the commit! I can see that you've added coverage for f0 addresses through block.miner_address in eth_tests_with_tipset(), and additional coverage through msg.from() which would exercise various address types based on the snapshot data.

However, the original review comment was requesting explicit test cases for each address type (similar to the explicit f4 test in eth_tests()), rather than data-driven tests that depend on snapshot content. The rationale for explicit tests is:

  1. Deterministic coverage - Ensures all address types are tested regardless of snapshot content
  2. Clear documentation - Makes it obvious which address types are supported
  3. Easier debugging - When a specific address type fails, it's immediately clear which one

The eth_tests_with_tipset() tests you added provide good real-world coverage, but they're dependent on what addresses happen to be in the snapshot. For complete explicit coverage, you could add tests like:

// In eth_tests() function
for addr in [
    Address::new_id(1234),  // f0
    Address::from_str("t1w2zb5a723izlm4q3khclsjcnapfzxcfhvqyfoly").unwrap(),  // f1
    Address::from_str("t2nfplhzpyeck5dcc4fokj5ar6nbs3mhbdmq6xu3q").unwrap(),  // f2
    Address::from_str("t3wmbvnabsj6x2uki33phgtqqemmunnttowpx3chklrchy76pv52g5ajnaqdypxoomq5ubfk65twl5ofvkhshq").unwrap(),  // f3
] {
    tests.push(RpcTest::identity(
        FilecoinAddressToEthAddress::request((addr, None)).unwrap()
    ));
}

Would you like to add these explicit tests, or do you feel the data-driven coverage is sufficient for your needs?


🧬 Code Graph Analysis Results

[src/tool/subcommands/api_cmd/api_compare_tests.rs] - Potentially relevant snippets

  1. RpcTest struct and its run method
  • Description: Defines the test to perform against Forest/Lotus RPC endpoints, including request, how to validate syntax/semantics, and the execution flow that records results.
  • Purpose: Central to understanding how tests are constructed, executed in parallel, and how results are captured for reporting in the API compare workflow.
  • Key aspects included:
    • Fields: request, check_syntax, check_semantics, ignore, policy_on_rejected, sort_policy
    • Methods: basic_raw, basic, identity, validate, validate_raw, run
    • Execution flow: measures duration, performs forest and lotus calls, applies syntax/semantics checks, optionally sorts JSON, builds TestResult with optional TestDump

Note: This block is substantial; the essential behavior is captured by this snippet, which governs how each RPC test is defined and executed in the compare pipeline.

  1. Test evaluation and result helpers
  • Summary of evaluate_test_success

    • Parameters: test_result (TestResult), test (RpcTest), test_criteria_overrides
    • Returns: bool indicating whether the test is considered successful given forest/lotus results and policy
    • Behavior:
      • If both sides are Valid => true
      • If both time out => matches overrides (ValidAndTimeout, TimeoutAndTimeout)
      • If both are Rejected => policy_on_rejected (Pass, PassWithIdenticalError, PassWithIdenticalErrorCaseInsensitive, PassWithQuasiIdenticalError)
      • Otherwise => false
  • Summary of dump_test_data

    • Parameters: dump_dir (Path), success (bool), test_dump (TestDump)
    • Returns: Ok(())
    • Behavior: Writes per-test JSON dump into a subdir named "valid" or "invalid" under dump_dir, with a filename derived from the test method and timestamp
  1. run_tests orchestration (high level)
  • Summary:
    • Spawns test executions with a concurrency limit (semaphore)
    • Applies test filtering based on a FilterList and optional API path/version filters
    • Collects results, tracks per-test outcome via ReportBuilder
    • Optionally dumps test data, respects fail-fast on first failure
    • Produces a final summary/report and can save to a directory if configured
  1. Related context helpers (conceptual)
  • TestSummary enum and conversion from errors

    • Purpose: Normalize various RPC failure modes into a compact summary (MissingMethod, Rejected, NotJsonRPC, InfraError, BadJson, CustomCheckFailed, Timeout, Valid)
    • from_err mapping covers several ClientError variants to these categories
  • TestDump and TestResult

    • Purpose: Carry per-test diagnostic data (requests/responses, duration, and optional dumps) to support debugging when tests fail or are inspected post-run
  1. Note on how these pieces connect to the user comment
  • The user comment mentions a specific F0 coverage in a Forest PR commit. The RpcTest framework here is the mechanism by which API compatibility tests are defined and executed between Forest and Lotus within api_compare_tests.rs. The above snippets capture the core testing primitives (RpcTest, result handling, and test execution flow) that would be involved in evaluating or reproducing how F0-like cases are exercised in the compare tests.

If you want exact excerpts, I can paste the complete blocks for:

  • RpcTest struct and impl (run method)
  • evaluate_test_success
  • dump_test_data
  • run_tests (core loop and orchestration)

Would you like me to include those full blocks with file path and approximate line references?


🧠 Learnings used
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5944
File: src/chain/store/index.rs:0-0
Timestamp: 2025-08-18T03:09:47.932Z
Learning: In Forest's tipset_by_height caching implementation, hanabi1224 prefers performance-conscious solutions that leverage finality guarantees rather than expensive chain walking for fork detection. The approach of constraining cache lookups to finalized epochs (using CHECKPOINT_INTERVAL >= CHAIN_FINALITY) provides fork safety without the performance cost of ancestry verification.

Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.350Z
Learning: For miner actor ChangeOwnerAddress and ChangeOwnerAddressExported methods: versions 8-10 use bare Address as parameter type, while versions 11+ use ChangeOwnerAddressParams. This reflects the evolution of the Filecoin miner actor parameter structures across versions.

Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.

Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6057
File: src/cli/subcommands/f3_cmd.rs:0-0
Timestamp: 2025-09-09T10:37:17.947Z
Learning: hanabi1224 prefers having default timeouts (like 10m for --no-progress-timeout) to prevent commands from hanging indefinitely, even when the timeout flag isn't explicitly provided by users. This fail-fast approach is preferred over requiring explicit flag usage.

Copy link
Member

Choose a reason for hiding this comment

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

@hanabi1224 I think the AI has a good point here. I'd rather we have explicit test cases.

Copy link
Contributor

Choose a reason for hiding this comment

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

Seems like the humans are having a chat. I'll hop back into my burrow for now. If you need me again, just tag @coderabbitai in a new comment, and I'll come hopping out!

Copy link
Contributor Author

@hanabi1224 hanabi1224 Dec 10, 2025

Choose a reason for hiding this comment

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

@LesnyRumcajs The snapshot test is deterministic.

filecoin_filecoinaddresstoethaddress_1765291874419799.rpcsnap.json.zst

{
  "request": {
    "method_name": "Filecoin.FilecoinAddressToEthAddress",
    "params": [
      "f410f744ma4xsq3r3eczzktfj7goal67myzfkusna2hy"
    ]
  },
  ...
}

filecoin_filecoinaddresstoethaddress_1765357908887069.rpcsnap.json.zst

{
  "request": {
    "method_name": "Filecoin.FilecoinAddressToEthAddress",
    "params": [
      "t04040",
      "latest"
    ]
  },
  ...
}

Copy link
Contributor

@coderabbitai coderabbitai bot left a 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 (1)
build.rs (1)

63-66: LGTM! Comment stripping aligns with test_snapshot.rs.

The preprocessing logic is correct and matches the implementation in test_snapshot.rs, enabling inline comments in test snapshot entries.

Optional: Line 67's !l.starts_with('#') check is now redundant.

After the split-and-trim operation on lines 63-66, any line starting with '#' becomes an empty string, so the !l.starts_with('#') condition on line 67 will never match. The !l.is_empty() check alone is sufficient. However, keeping it is harmless and serves as defensive coding.

If you prefer to simplify:

-    .filter(|l| !l.is_empty() && !l.starts_with('#'))
+    .filter(|l| !l.is_empty())
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c5e17b0 and 602376a.

📒 Files selected for processing (3)
  • build.rs (1 hunks)
  • src/tool/subcommands/api_cmd/test_snapshot.rs (1 hunks)
  • src/tool/subcommands/api_cmd/test_snapshots.txt (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/tool/subcommands/api_cmd/test_snapshots.txt
🧰 Additional context used
🧠 Learnings (3)
📓 Common learnings
Learnt from: akaladarshi
Repo: ChainSafe/forest PR: 5923
File: src/rpc/registry/actors/miner.rs:221-223
Timestamp: 2025-09-02T10:05:34.350Z
Learning: For miner actor ChangeOwnerAddress and ChangeOwnerAddressExported methods: versions 8-10 use bare Address as parameter type, while versions 11+ use ChangeOwnerAddressParams. This reflects the evolution of the Filecoin miner actor parameter structures across versions.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5930
File: build.rs:64-77
Timestamp: 2025-08-13T09:43:20.301Z
Learning: hanabi1224 prefers hard compile-time errors in build scripts rather than runtime safeguards or collision detection, believing it's better to fail fast and fix root causes of issues like malformed snapshot names.
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 6057
File: src/cli/subcommands/f3_cmd.rs:0-0
Timestamp: 2025-09-09T10:37:17.947Z
Learning: hanabi1224 prefers having default timeouts (like 10m for --no-progress-timeout) to prevent commands from hanging indefinitely, even when the timeout flag isn't explicitly provided by users. This fail-fast approach is preferred over requiring explicit flag usage.
📚 Learning: 2025-08-25T13:35:24.230Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5969
File: src/tool/subcommands/snapshot_cmd.rs:412-412
Timestamp: 2025-08-25T13:35:24.230Z
Learning: In src/tool/subcommands/snapshot_cmd.rs, the +1 in `last_epoch = ts.epoch() - epochs as i64 + 1` fixes an off-by-1 bug where specifying --check-stateroots=N would validate N+1 epochs instead of N epochs, causing out-of-bounds errors when the snapshot contains only N recent state roots.

Applied to files:

  • src/tool/subcommands/api_cmd/test_snapshot.rs
📚 Learning: 2025-08-07T13:39:15.107Z
Learnt from: hanabi1224
Repo: ChainSafe/forest PR: 5886
File: interop-tests/src/tests/go_app/gen.go:29-29
Timestamp: 2025-08-07T13:39:15.107Z
Learning: Auto-generated files like those created by rust2go (indicated by "Generated by rust2go. Please DO NOT edit this C part manually." comment) in the Forest project should be skipped during code review as they are not intended for manual editing.

Applied to files:

  • build.rs
⏰ 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). (7)
  • GitHub Check: tests-release
  • GitHub Check: tests
  • GitHub Check: All lint checks
  • GitHub Check: Build forest binaries on Linux AMD64
  • GitHub Check: cargo-publish-dry-run
  • GitHub Check: Build Ubuntu
  • GitHub Check: Build MacOS
🔇 Additional comments (1)
src/tool/subcommands/api_cmd/test_snapshot.rs (1)

263-264: LGTM! Inline comment support added correctly.

The preprocessing logic correctly strips inline comments from test snapshot entries before pattern matching. The split("#").next().unwrap() is safe since split always returns at least one element.

@hanabi1224 hanabi1224 added this pull request to the merge queue Dec 10, 2025
Merged via the queue into main with commit 7e9af82 Dec 10, 2025
50 of 51 checks passed
@hanabi1224 hanabi1224 deleted the hm/v1-filecoin-address-to-eth-address branch December 10, 2025 11:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

RPC requires calibnet RPC checks to run on CI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[RPC v2] Filecoin.FilecoinAddressToEthAddress

3 participants