Skip to content

Scheduled Transactions Not Working on MonotonicEmulator #8158

@jribbink

Description

@jribbink

🐞 Bug Report

Scheduled transactions fail when using MonotonicEmulator chain (e.g., with SimpleAddresses=true), causing the error:

"Could not find Execute Scheduled Transactions Capability in storage"

This primarily affects the Cadence test framework (see onflow/flow-cli#2181).

Root Cause

The FVM bootstrap only issues the scheduled transaction executor capability for transient chains:

flow-go/fvm/bootstrap.go

Lines 837 to 849 in 8b69d4c

// TODO: JanezP this could be controlled by a flag instead of a hidden check here
if b.ctx.Chain.ChainID().Transient() {
sc := systemcontracts.SystemContractsForChain(b.ctx.Chain.ChainID())
txBody, err = blueprints.IssueScheduledTransactionExecutorTransaction(b.ctx.Chain, sc.ScheduledTransactionExecutor.Address)
if err != nil {
panic(fmt.Sprintf("failed to create scheduled transaction executor transaction: %s", err))
}
txError, err = b.invokeMetaTransaction(
b.ctx,
Transaction(txBody, 0),
)
panicOnMetaInvokeErrf("failed to create scheduled transaction executor: %s", txError, err)
}

MonotonicEmulator is not in the Transient() list, even though it's only used for testing/emulator purposes like Emulator.

Solution

Add MonotonicEmulator to the Transient() function alongside Emulator.

Context

onflow/flow-cli#2181

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions