Skip to content

feat(cow): source the registry address from module [config] - #666

Open
mfw78 wants to merge 1 commit into
mainfrom
cow/651-registry-config
Open

feat(cow): source the registry address from module [config]#666
mfw78 wants to merge 1 commit into
mainfrom
cow/651-registry-config

Conversation

@mfw78

@mfw78 mfw78 commented Aug 3, 2026

Copy link
Copy Markdown
Contributor

What

Sources the ComposableCoW registry address from the twap-monitor manifest [config] and deletes the compiled cowprotocol::COMPOSABLE_COW constant from the module, with no fallback of any kind.

modules/twap-monitor/src/keeper.rs gains KeeperConfig { registry: Address } with parse mirroring cow-venue's AdapterConfig::parse (unknown keys ignored, malformed value or missing key is a hard Fault::InvalidInput), the same RwLock store/accessor shapes, and a registry field threaded through TwapSource into poll_one's eth_call_params. modules/twap-monitor/src/lib.rs parses and stores in init (a parse failure is the init error); on_block before init is a typed Fault::Unavailable refusal. modules/twap-monitor/module.toml gains [config] with registry = "0xfdaFc9d1902f4e0b84f65F49f244b32b31013b74", the current Sepolia registry, so behaviour is unchanged.

Why

Closes #651: the converged ccow-monitor knows exactly one contract, the registry, and hard-coding the constant coupled the module to a single network and put a cow-rs rev on the critical path. This is the first car of the convergence train and changes the mechanism only; the address cutover to the mainnet fork is #652's atomic swap. A new parity test pins [config].registry to the chain-log subscription address pins and the test fixture constant so the #652 swap must move all three together.

Testing

Gates (all via nix develop -c, from the worktree, package-scoped per the train's light-CI rule):

  • cargo fmt --check -p twap-monitor: clean.
  • cargo clippy -p twap-monitor --all-targets: clean.
  • cargo nextest run -p twap-monitor: 34 passed (25 before, 9 added: config parse valid/missing/malformed/unknown-keys, init-level wiring for the same three cases, a typed-refusal test for on_block without config, a manifest parity test, and a poll-path test that stores a distinct registry and asserts the eth_call to carries it, failing if the constant is reintroduced).
  • cargo test -p twap-monitor --lib: 34 passed (the refusal test serialises config access behind a test guard, so the suite is runner-independent).

AI Assistance: Claude Fable used for the implementation via a structured workflow; Claude Opus used for the red-team review (9 findings, 7 fixed, 1 duplicate-merged, 1 rejected as out-of-scope checksum policy).

@mfw78
mfw78 marked this pull request as ready for review August 3, 2026 23:52
The keeper learns the ComposableCoW registry from its manifest
[config] instead of the compiled cowprotocol::COMPOSABLE_COW
constant. A missing or malformed registry key is a hard init error;
there is no fallback of any kind. A manifest parity test pins
[config].registry to the chain-log subscription address pins (and the
test fixture constant) until the #652 cutover moves them together.

Closes #651
@mfw78
mfw78 force-pushed the cow/651-registry-config branch from 1aa7891 to acf0e06 Compare August 3, 2026 23:56
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.

cow: source the registry address from module [config]

1 participant