Skip to content

refactor: make simulator chain-agnostic with pluggable chain family architecture#368

Draft
Fletch153 wants to merge 1 commit intomainfrom
plex-2751
Draft

refactor: make simulator chain-agnostic with pluggable chain family architecture#368
Fletch153 wants to merge 1 commit intomainfrom
plex-2751

Conversation

@Fletch153
Copy link
Copy Markdown

Summary

  • Extract EVM-specific simulation code into chain/evm/ package behind a ChainFamily interface with a registry
  • Simulate command iterates registered families instead of hardcoding EVM calls
  • Adding a new chain family (e.g., Aptos) requires creating one package + one import

Changes

  • New chain/ package: ChainFamily interface, typed registry with Register()/Get()/All()
  • New chain/evm/ package: EVMFamily implementing ChainFamily with init() self-registration
  • simulate.go: Inputs struct uses family-generic fields, orchestration loops over registered families
  • capabilities.go: Split cron/HTTP triggers (chain-agnostic) from EVM chain capabilities
  • Moved EVM code: supported chains, trigger parsing, health check, limited capabilities all in chain/evm/
  • Zero user-facing changes (CLI flags, config format, behavior all identical)

Test plan

  • go test ./cmd/workflow/simulate/... -count=1 — all tests pass across 3 packages
  • go build ./... — full project compiles clean
  • cre workflow simulate produces identical output to main

🤖 Generated with Claude Code

…rchitecture

Extract EVM-specific simulation code into a chain/evm/ package behind a
ChainFamily interface with a registry. The simulate command now iterates
registered families instead of hardcoding EVM calls.

New chain/ package:
- ChainFamily interface defining what a chain family plugin must implement
- Typed registry with Register(), Get(), All() for family discovery
- ChainClient, ChainConfig, CapabilityConfig, FamilyTriggers shared types

New chain/evm/ package:
- EVMFamily implementing ChainFamily with init() self-registration
- SupportedChains list (moved from simulator_utils.go)
- EVM chain capabilities, trigger parsing, health check, limited capabilities
- EVMChainLimits interface to avoid circular imports with SimulationLimits

Refactored simulate command:
- Inputs struct uses family-generic fields (FamilyClients, FamilyForwarders, FamilyKeys)
- ResolveInputs iterates chain.All() instead of hardcoded SupportedEVM
- simulatorInitialize registers capabilities per-family via registry
- Cron/HTTP triggers split into chain-agnostic CronAndHTTPTriggers
- Trigger routing uses family.ParseTriggerChainSelector() dispatch

Adding a new chain family (e.g., Aptos) requires:
1. Create chain/aptos/ package implementing ChainFamily
2. Add one import to simulate.go

Zero user-facing changes. All existing tests pass.
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