Skip to content

feat: Add guard configuration event scanner for multichain Lagoon deployments#785

Merged
miohtama merged 6 commits intomasterfrom
feat/guard-config-event-scanner
Mar 3, 2026
Merged

feat: Add guard configuration event scanner for multichain Lagoon deployments#785
miohtama merged 6 commits intomasterfrom
feat/guard-config-event-scanner

Conversation

@miohtama
Copy link
Contributor

@miohtama miohtama commented Mar 2, 2026

Summary

  • Adds config_event_scanner.py module that decodes the full cross-chain TradingStrategyModuleV0 guard configuration by scanning on-chain events emitted during deployment
  • Supports both Hypersync (production) and web3.eth.get_logs() (Anvil fork testing) backends
  • Follows CCTP destination chains automatically to build a multichain picture
  • Provides resolve_address_label() for generic contract name resolution — labels the Safe as <our multisig>, resolves vaults/tokens by name(), falls back to <unknown>
  • Adds read-guard-config.py diagnostic script and config readback step to deploy-lagoon-multichain.py
  • Updates Guard README and GuardV0Base.sol with cross-references to the scanner module

🤖 Generated with Claude Code

miohtama and others added 6 commits March 2, 2026 22:37
…loyments

Adds a new module `config_event_scanner.py` that decodes the full cross-chain
TradingStrategyModuleV0 guard configuration by scanning on-chain events.
Follows CCTP destination chains automatically to build a multichain picture.

Key features:
- `fetch_guard_config_events()` — raw decoded events per chain via Hypersync or web3
- `build_multichain_guard_config()` — structured dataclass output
- `resolve_address_label()` — generic contract name resolution with Safe labelling
- `format_guard_config_report()` — human-readable output with token/vault name resolution
- Diagnostic script `read-guard-config.py` for manual inspection
- Config readback step added to `deploy-lagoon-multichain.py`

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Fix root chain detection: chains with Lagoon vaults are always roots,
  CCTP destinations are nested under them
- Add rendered_chains tracking to prevent circular nesting in
  bidirectional CCTP setups
- Fix mixed-case vault address in flag.py that broke assertions
- Add tree report assertions to multichain guard config test

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
The `CCTP_DOMAIN_TO_CHAIN_ID.get(domain) or TESTNET_CCTP_DOMAIN_TO_CHAIN_ID.get(domain)`
pattern was broken — mainnet dict returns a truthy (but wrong) chain ID
for shared domain numbers (e.g. domain 6 → 8453 instead of 84532),
so the testnet dict was never consulted.

Now checks `TESTNET_CHAIN_IDS` to select the correct mapping, matching
the pattern already used in `_decode_cctp_destination_approved()`.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@miohtama miohtama merged commit eddaf76 into master Mar 3, 2026
1 check failed
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