ChainSafe / ChainSafe/forest

Optimize shims to use latest versions of data types to avoid unnecessary conversions

Open
#6,094 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
697
Forks
200
Avg merge
1d 5h
Merged PRs (30d)
65

Description

## Problem

Currently, many shims in the Forest codebase are using older versions of data types (like `Address`) which require conversions when interfacing with the latest actor versions. Since the latest actors are called most frequently in production, this creates unnecessary performance overhead.

## Examples

- In `src/shim/actors/builtin/account/mod.rs`, the `pubkey_address()` method returns `fvm_shared2::address::Address` but has to convert from `fvm_shared4::address::Address` for newer actor versions (V10-V17)
- Some types like `FilterEstimate` don't have shims for the latest version at all

## Proposed Solution

Refactor shims to:
1. Return the latest versions of data types by default
2. Make older actor versions handle the conversions instead of newer ones
3. Ensure all relevant types have shims for the latest versions

This would improve performance for the most common use cases (latest actor versions) while maintaining compatibility.

## Context

This issue was identified during the discussion in PR #6087 where we're refactoring actor state handling for version upgrades.

**References:**
- PR: https://github.com/ChainSafe/forest/pull/6087
- Discussion: https://github.com/ChainSafe/forest/pull/6087#discussion_r2354898135

**Reported by:** @LesnyRumcajs
**Context provided by:** @akaladarshi

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.