refactor: rename block handlers to semantic namespaced names (COW-1000)#83
refactor: rename block handlers to semantic namespaced names (COW-1000)#83lgahdl wants to merge 12 commits into
Conversation
Renames all five Ponder block-handler entries from opaque C1–C5 shorthand to self-documenting composableCow.* names that match their responsibility. Updates ponder.config.ts keys, ponder.on() call names, section headers, log prefixes, and all in-file cross-references. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ot-namespace conflict)
Ponder 0.16.x treats dots in block interval names as namespace separators,
causing ponder.on('composableCow.OrderDiscoveryPoller:block') to fail validation.
Block intervals must use simple names without dots.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
The handler rename is consistent throughout
These should be updated to |
|
Code review — block handler rename (COW-1000) Ponder app fingerprint / schema drop risk Ponder 0.16.x tracks block sources by name in its internal Name consistency
Leftover old names
Overall: PR is operationally safe. No schema changes, no logic changes, no orphaned |
Documentation / CI review
Lines 33–35 of
This PR renames those handlers to
Breaking change / schema drop notice missing from PR body.
|
…-1000) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
This PR applies the suggestions but didn't answer other questions of Anxo with my take bellow them:
- The flashloan orders flow aren't well documented. Shouldn't we have different handlers for composable cow and aave flash loan orders?
Flash loan orders are not handle by block handlers, we monitor directly events for it. However, we need to improve the documentation about it. The blockhandlers that have specific composable cow logic should mention it to make sure we separate what is generic (e.g. order status change that is valid for any kind of order)
- We have around 11% unknown types. Are they really unknown?
Doing a quick search, no they are not unknown and we could identify (at least the main ones), example: (1, 2, 3)
- Why is
orderbook_cacheretained vs dropped?
I think that is only to not check order API twice between deployments for orders that are already on its final state. Would double check if we're documenting this properly.
- TWAP
nPartsupper bound.
Nice catch. He mention that UI only accept TWAPs with 365 parts. On contracts side they are validated to be lower than
uint32.max, what is a really giant number of rows to insert into the DB. In addition, this validation happens after the conditional order is emitted, on the query / execution path. This means that thenPartsupper bound on the contract perspective is actuallyuint256.max. Looking at the code I don't find any kind of guard against it. This means that someone could use it of a DDoS attack.
WRT this PR I would only address points 1 and 3 here. The others are big enough to be executed alone.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…nfig.ts All five keys are valid identifiers and don't need quoting. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Keep new semantic block handler names (OrderDiscoveryPoller, CandidateConfirmer, OrderStatusTracker, OwnerBackfill, CancellationWatcher) with develop's dynamic ACTIVE_CHAINS.map() chain config pattern. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ath and order_uid_cache (COW-1000) - Update all C1-C5 / ContractPoller / StatusUpdater / HistoricalBootstrap / DeterministicCancellationSweeper references to the new semantic names (OrderDiscoveryPoller, OrderStatusTracker, OwnerBackfill, CancellationWatcher) - Clarify in overview and data-flow diagram that block handlers are generic (apply to all generators regardless of type); Aave flash loan detection is event-driven via settlement.ts, not a block handler - Add cow_cache.order_uid_cache section explaining why it's retained across Ponder deployments and what is/isn't cached Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
Addressed points 1 and 3 in latest commit: Point 1 — Flash loan docs: Updated Point 3 — Also updated all remaining C1–C5 / old handler name references in Points 2 (unknown types classification) and 4 (nParts DDoS guard) tracked as separate issues. |
…Handler.ts architecture.md: keep new handler names (HEAD) + add develop's preflight /by_uids sentence to the CandidateConfirmer cancellation limitation note. blockHandler.ts: use new semantic name prefix + include preflightKnown field. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| | C5 (DeterministicCancellationSweeper) — periodic singleOrders() mapping read for | ||
| | deterministic generators (allCandidatesKnown=true); flips | ||
| | to Cancelled when remove() has been called on-chain | ||
| blockHandler.ts (five live-only block handlers — generic, apply to all generators) |
There was a problem hiding this comment.
are these all generic? Some of them seem to be really attached to composable cow. The only that is
… (COW-1000) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ing with semantic handler names Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…der.config.ts
ponder.config.ts renamed the five block handlers to semantic names but
blockHandler.ts still had the old ponder.on("ContractPoller:block", ...)
registrations — causing Ponder to fail at startup or silently skip the
mismatched handlers.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
| - `effective_cache_size`: 512MB (~50% RAM) | ||
| - `maintenance_work_mem`: 51MB | ||
|
|
||
| Adjust these proportionally if you change the host's available memory. |
There was a problem hiding this comment.
I think we can remove this
There was a problem hiding this comment.
all "PostgreSQL Memory Flags"
|
|
||
| To tear down: `npx tsx deployment/manage.ts down --env-file deployment/.env` | ||
|
|
||
| ### Production architecture |
|
|
||
| `isSynced: true` means the backfill is complete and the indexer is processing new blocks in realtime. While `isSynced` is false the GraphQL/SQL data is partial — queries will succeed but results are incomplete. | ||
|
|
||
| ## What's Not Implemented |
There was a problem hiding this comment.
I think we can remove this section.
|
|
||
| /** | ||
| * COW-908: Hard per-block ceiling on how many generators the C1 ContractPoller | ||
| * COW-908: Hard per-block ceiling on how many generators the OrderDiscoveryPoller |
There was a problem hiding this comment.
We could track all internal references to remove, like this one to internal linear tasks.
Grant Review Finding
[F7] Rename C1–C5 block handlers to semantic names with contract namespace — NIT (DX/readability) (COW-1000)
Summary
composableCow.*names that match their responsibility (OrderDiscoveryPoller,CandidateConfirmer,OrderStatusTracker,OwnerBackfill,CancellationWatcher)ponder.config.tsblock keys andponder.on()call names inblockHandler.ts[COW:C1]→[COW:OrderDiscoveryPoller]), and all in-file cross-references to old namesTest plan
pnpm typecheck— passespnpm test— 19/19 passingponder.on()names exactly🤖 Generated with Claude Code