Repository navigation
feat(subscriber): named event streams with a Morpho governance stream - #452
Merged
Merged
Conversation
Generalize the continuous timelock subscriber so one process follows several Envio entities (#447, part of #437): - Move the subscriber to utils/subscriber/. An EventStream names the entity, its address field, field selection, SQLite file and table prefix; the inbox, reconcile, worker, notices and report take it from the inbox instead of hardcoding TimelockEvent. - Timelock keeps timelock_subscriber.db and its timelock_sub_* tables. Schema v2 renames timelock_address to contract_address in place. - Add the morpho stream (MorphoGovernanceEvent from yearn-envio#71) for every configured V1/V2 vault, in morpho_subscriber.db. Observation only: no alerts, daily governance jobs stay the alerting path. - run_workers runs every stream in one process: one READY, a watchdog ping only while every stream is alive, one HTTP session per thread, and one chain_metadata read per cycle shared by all streams. - EVENT_SUBSCRIBER_STREAMS (default timelock) selects streams; run, reconcile-once, report and health cover each. Per-stream notice labels ([timelock-subscriber], [morpho-subscriber]). - Reorg overlap and block span for HyperEVM (999) and Robinhood (4663). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
5 of 7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #447. Part of #437.
What
The continuous subscriber from #442 can now follow more than one Envio entity. A new
morphostream observesMorphoGovernanceEvent(indexed by yearn/yearn-envio#71) for every V1 and V2 vault inprotocols/morpho/config.py. It runs in the same process as the timelock pilot and uses the same WebSocket + HTTP reconciliation.It is observation only, and sends no alerts. The daily
governance.py/governance_v2.pyjobs stay the alerting path. Lifecycle rules and grouped delivery are #448.timelock(default)TimelockEventtimelock_subscriber.db,timelock_sub_*(unchanged)morphoMorphoGovernanceEventmorpho_subscriber.db,morpho_sub_*How
protocols/timelock/subscriber/toutils/subscriber/. AnEventStreamnames the entity, its address field, the field selection, the SQLite file, and the table prefix. The inbox is bound to its stream, and reconcile, the worker, notices and the report read the stream from it. Nothing hardcodesTimelockEventanymore.run_workersruns every selected stream in one process.READY, and aWATCHDOGping only while every stream is alive, so a wedged stream restarts the unit instead of hiding behind a healthy one.requests.Sessionper thread (request_with_retrygained an optionalsession).SharedChainHeads: onechain_metadataread per cycle for all streams.run_with_alertreports it.EVENT_SUBSCRIBER_STREAMS(or--streamsbefore the subcommand) picks the streams. The default istimelock, so the running deployment's behavior is unchanged. Therun,reconcile-once,reportandhealthsubcommands cover every selected stream.[timelock-subscriber],[morpho-subscriber]). Morpho notices show the vault name and generation, the sender, and the ABI-namedargsJson. Timelock notice text is unchanged.timelock_addressis renamed tocontract_addressin place. The existing pilot DB keeps its rows and checkpoints, and a test covers the deployed v1 shape.protocols/timelock/event_subscriber.pykeep their names, so nothing changes for ops until the Morpho stream is enabled.Rollout
The configured Envio deployment doesn't serve
MorphoGovernanceEventyet. HyperEVM and Robinhood also have nochain_metadatarows there. Enable the stream once yearn-envio#71 is deployed and has backfilled all five chains; the runbook has the steps:Its first reconcile starts at each chain's indexed head, so historical events are never announced.
Testing
ruffandtypass. Full suite: 2032 passed, 5 failed. The failures also happen on main and come from the local setup: 4TestSafeApiQuotatests fail with a realSAFE_API_KEYin.env, andtest_sd_notify_sends_datagramfails withAF_UNIX path too longon macOS temp paths.tests/test_event_subscriber_streams.py(16 tests):SharedChainHeads.run_workersfollowing both streams over the fake WebSocket. It sends one READY and one STOPPING; the watchdog ping is withheld while one stream is dead, and a crashed stream is surfaced.CACHE_DIR):--streams timelock,morpho reconcile-onceand a 15srun, stopped with SIGTERM.field 'MorphoGovernanceEvent' not foundorno chain_metadata row, and the WebSocket retried with backoff. Timelock was not affected.🤖 Generated with Claude Code