Skip to content

fix(evm): resolve account/ethaccount InvokeEVM calls via the Send fallback#325

Merged
emmanuelm41 merged 2 commits into
masterfrom
fix/account-fallback-method
Jul 7, 2026
Merged

fix(evm): resolve account/ethaccount InvokeEVM calls via the Send fallback#325
emmanuelm41 merged 2 commits into
masterfrom
fix/account-fallback-method

Conversation

@emmanuelm41

@emmanuelm41 emmanuelm41 commented Jul 7, 2026

Copy link
Copy Markdown
Member

Problem

Messages using the exported EVM method InvokeEVM (method number 3844450837) sent to a plain account actor were parsed as operation type unknown instead of a meaningful method — even when value was transferred.

Reported example tx: bafy2bzacedyutaqjt2zw4kkldcjcj72l5qxll2dnwq3kjm5uzix3fdccetxco (to f03371596, an account actor, ~11.53 FIL).

Note: 3844450837 is a single method — FRC42("InvokeEVM") = go-state-types builtin.MethodsEVM.InvokeContract. The label depends on the recipient actor type, not the method number.

Root cause

The account/ethaccount fallback branch in GetMethodName (added in #292) was unreachable dead code: its guard required GetMethodByActorName(actorName) == actors.UnknownStr, but that function returns a struct for "account" and "ethaccount", so the guard was never satisfied. The method therefore fell through to <unknown>.

The value itself was never lost — block.go's default branch still emits debit/credit ops for value != 0 — so this was a labeling bug, not a balance-reconciliation bug.

Change

  • Extract a pure, testable resolveMethodName() / findMethodInActor() seam: look the method number up in the recipient actor's own method set first, then fall back to METHOD_FALLBACK for account/ethaccount exported methods (>= 1<<24).
  • METHOD_FALLBACK stays "Send" (unchanged), so these value transfers surface as ordinary Send operations — the behavior the dead branch originally intended.
  • Add TestResolveMethodName — the end-to-end GetMethodName-level coverage that was missing and let this bug hide (the prior test only exercised FindMethodNameInAllActors in isolation).

block.go and SupportedOperations are untouched: "Send" is already handled.

evm contract recipients still resolve to InvokeContractEVM_CALL, unchanged.

Behavior

Recipient actor method 3844450837 — before after
evm EVM_CALL EVM_CALL (unchanged)
account unknown Send
ethaccount unknown Send
placeholder unknown unknown (see below)

Verification

  • gofmt clean, go vet clean, golangci-lint (new-issues vs master) 0 issues
  • TestResolveMethodName (7 cases) passes; make test (./rosetta/services) passes

Notes / possible follow-ups

  • ethaccountSend here diverges from beryx, which labels ethaccount InvokeEVM as InvokeContract (it remaps ethaccount→EVM table). Grouped with account for now.
  • placeholder recipients still resolve to unknown (not covered by isAccountActorFallback); fil-parser resolves these to InvokeContract. Documented by a test case.

…lback

Messages using the exported EVM method InvokeEVM (method 3844450837,
= builtin.MethodsEVM.InvokeContract) sent to a plain account/ethaccount
actor were resolved to "<unknown>" instead of a meaningful method name,
even when value was transferred.

Root cause: the account/ethaccount fallback branch in GetMethodName was
unreachable. Its guard required GetMethodByActorName(actorName) to return
actors.UnknownStr, but that function returns a struct for "account" and
"ethaccount", so the branch never executed.

- Extract a pure resolveMethodName()/findMethodInActor() seam: look the
  method number up in the recipient actor's own method set first, then
  fall back to METHOD_FALLBACK ("Send") for account/ethaccount exported
  methods (>= 1<<24). These value transfers now surface as Send ops.
- Add TestResolveMethodName covering evm/account/ethaccount/placeholder.

EVM contract recipients (evm actor) still resolve to InvokeContract /
EVM_CALL, unchanged. block.go and SupportedOperations are untouched
because METHOD_FALLBACK is "Send", already handled by the op switch.
@emmanuelm41
emmanuelm41 force-pushed the fix/account-fallback-method branch from 89b2f1b to cb7e2fe Compare July 7, 2026 16:58
@emmanuelm41 emmanuelm41 changed the title fix(evm): label account/ethaccount InvokeEVM calls as Fallback instead of unknown fix(evm): resolve account/ethaccount InvokeEVM calls via the Send fallback Jul 7, 2026
Broaden TestResolveMethodName to lock in behavior around the fix:
- EVM InvokeContractDelegate (the other EVM_CALL feeder) and non-EVM
  known methods (multisig Propose, init Exec) still resolve by name.
- Exported-method threshold boundary for account (1<<24 -> Send,
  1<<24-1 -> unknown).
- Case-insensitive account fallback matching.

Add TestGetMethodNameShortcuts covering the exported GetMethodName
wrapper's infra-free branches (nil message -> error, method 0 -> Send,
method 1 -> Constructor).
@emmanuelm41
emmanuelm41 merged commit 2898713 into master Jul 7, 2026
5 checks passed
@emmanuelm41
emmanuelm41 deleted the fix/account-fallback-method branch July 7, 2026 18:10
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