Skip to content

feat(simulator): agent simulation with forked mainnet support#90

Merged
memplethee-lab merged 1 commit into
SourceXXL:mainfrom
DevSolex:feature/issue-69-forked-mainnet-simulation
Jun 24, 2026
Merged

feat(simulator): agent simulation with forked mainnet support#90
memplethee-lab merged 1 commit into
SourceXXL:mainfrom
DevSolex:feature/issue-69-forked-mainnet-simulation

Conversation

@DevSolex

Copy link
Copy Markdown
Contributor

Summary

Enhances the simulator module to fully satisfy issue #69.

Changes

  • Time-scaled simulationtimeScaleFactor field on CreateSimulationDto and entity; controls fast-forward speed for block processing
  • Transaction replayreplayTxHashes on RunSimulationDto; fetches real historical tx + receipt by hash and records them with a replayed flag
  • JSON export endpointGET /simulator/:id/export returns the full simulation data as a structured JSON report
  • Named ethers v6 imports — switched from import { ethers } namespace to named imports (JsonRpcProvider, formatEther, formatUnits)
  • Updated comparison report — distinguishes simulated vs replayed tx counts
  • 15 unit tests — all passing, covering new and existing behaviour

Acceptance criteria met

Criteria Status
Fork Ethereum mainnet from any block height ✅ existing + tested
Simulate 1000 blocks (max blocksToSimulate) ✅ existing
All agent actions recorded during simulation ✅ existing + tested
Gas costs accurately calculated ✅ existing + tested
Compare simulation vs historical real results ✅ existing + tested
Export simulation reports as JSON ✅ new — GET /simulator/:id/export
Time-scaled simulation (fast-forward blocks) ✅ new — timeScaleFactor
Transaction replay from historical data ✅ new — replayTxHashes
API endpoints to manage and execute simulations ✅ existing + export added

Closes #69

…XXL#69)

- Add timeScaleFactor to CreateSimulationDto and Simulation entity
  for time-scaled (fast-forward) block simulation
- Add replayTxHashes to RunSimulationDto and Simulation entity
  for historical transaction replay
- Implement replayTransactions() to fetch and record real on-chain
  tx data by hash with replayed flag
- Add GET /simulator/:id/export endpoint for full JSON report export
- Update comparison report to distinguish simulated vs replayed tx counts
- Switch to named ethers v6 imports (JsonRpcProvider, formatEther, formatUnits)
- Add 15 unit tests covering all new and existing behaviour
@memplethee-lab memplethee-lab merged commit e4ac30c into SourceXXL:main Jun 24, 2026
1 check passed
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.

Agent Simulation Environment with Forked Mainnet

2 participants