Skip to content

Feat/apply message for simulation#567

Open
nijoe1 wants to merge 2 commits intofilecoin-project:masterfrom
nijoe1:feat/apply-message-for-simulation
Open

Feat/apply message for simulation#567
nijoe1 wants to merge 2 commits intofilecoin-project:masterfrom
nijoe1:feat/apply-message-for-simulation

Conversation

@nijoe1
Copy link
Copy Markdown
Member

@nijoe1 nijoe1 commented Mar 9, 2026

part of #13470

cc: @rvagg

Copilot AI review requested due to automatic review settings March 9, 2026 09:36
@github-project-automation github-project-automation Bot moved this to 📌 Triage in FilOz Mar 9, 2026
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds an FFI entrypoint to apply Filecoin messages in a “simulation” mode intended to support EVM JSON-RPC workflows (e.g., eth_call / eth_estimateGas) as part of #13470.

Changes:

  • Introduces (*FVM).ApplyMessageForSimulation that executes a message with applyImplicit semantics while still taking a chainLen input.
  • Documents the intended behavior for simulation (skipping sender type validation).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread fvm.go
Comment on lines +156 to +166
// ApplyMessageForSimulation applies a message for simulation purposes (eth_call/eth_estimateGas).
// This mode skips sender type validation, allowing calls from any actor type (including EVM contracts),
// but still validates nonce and balance.
func (f *FVM) ApplyMessageForSimulation(msgBytes []byte, chainLen uint) (*ApplyRet, error) {
defer runtime.KeepAlive(f)
resp, err := cgo.FvmMachineExecuteMessage(
f.executor,
cgo.AsSliceRefUint8(msgBytes),
uint64(chainLen),
applyImplicit,
)
Copy link

Copilot AI Mar 9, 2026

Choose a reason for hiding this comment

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

ApplyMessageForSimulation is added to the CGO-backed FVM implementation, but the //go:build nofvm stub (fvm_stub.go) does not provide a matching method. This makes the exported ffi.FVM API differ across build tags and will break compilation for -tags nofvm consumers as soon as they start calling this new method. Add a corresponding stub method in fvm_stub.go that returns the same "FVM support not built in this binary" error to keep the API consistent.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 📌 Triage

Development

Successfully merging this pull request may close these issues.

2 participants