Skip to content

feat: add ChainSimulatorSetStateStep for chain simulator state patching - #182

Merged
EtienneWallet merged 6 commits into
developfrom
feat/set_state
Mar 10, 2026
Merged

feat: add ChainSimulatorSetStateStep for chain simulator state patching#182
EtienneWallet merged 6 commits into
developfrom
feat/set_state

Conversation

@EtienneWallet

Copy link
Copy Markdown
Contributor

Summary

Add ChainSimulatorSetStateStep to set specific hex-encoded storage key-value pairs for an address on the chain simulator. This enables users to patch storage values after cloning contracts from mainnet when values like round numbers or epoch indices are incompatible with the simulator's timeline.

Changes

  • Provider method: Added set_address_state() to MyProxyNetworkProvider to POST hex-encoded key-value pairs to simulator/address/{address}/set-state
  • Step implementation: New ChainSimulatorSetStateStep class with:
    • Hex validation for all keys and values
    • Empty dict rejection
    • Network restriction to CHAIN_SIMULATOR
    • Debug logging of simulator response
  • Tests: 5 comprehensive test cases covering wrong network, successful execution, empty keys, and invalid hex input
  • Documentation: User guide section with YAML schema and example
  • Changelog: Updated with feature entry

Testing

  • ✅ All 268 unit tests pass
  • ✅ Ruff formatting and linting clean
  • ✅ Pylint score 9.86/10 (requirement: ≥9.5)
  • ✅ Dedicated chain_simulator_scenario fixture for reliable test isolation
  • ✅ Edge case coverage: empty keys, invalid hex key/value

EtienneWallet and others added 6 commits March 10, 2026 13:41
Add set_address_state() to MyProxyNetworkProvider for posting hex-encoded key-value pairs to the chain simulator's address-specific set-state endpoint.
Add new step to set specific storage key-value pairs for an address on the chain simulator. Includes hex validation and proper error handling for invalid input.
…Step

Add 5 test cases covering: wrong network validation, successful execution, empty keys rejection, and invalid hex key/value rejection. Includes dedicated chain_simulator_scenario fixture and YAML example.
Add user-facing documentation with description, YAML schema, and usage example for setting storage state on the chain simulator.
@EtienneWallet
EtienneWallet merged commit 725685d into develop Mar 10, 2026
@EtienneWallet
EtienneWallet deleted the feat/set_state branch March 10, 2026 12:49
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