Skip to content

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

@coderabbitai

Description

@coderabbitai

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:

Reported by: @LesnyRumcajs
Context provided by: @akaladarshi

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

Status

Ready

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions