WIP: adding resource managers for triggers#657
Draft
patrickhuie19 wants to merge 6 commits into
Draft
Conversation
patrickhuie19
force-pushed
the
feat/shared-2709
branch
from
July 7, 2026 19:08
4d212c4 to
0d489b3
Compare
cron already carried the SHARED-2709 local `replace` stack for chainlink-common and chainlink-protos/metering/go; its sibling modules (http_trigger, chain_capabilities/evm, integration_tests) pinned the same versions but lacked the replaces, so they resolved a different module state than cron. Add the same replace directives (depth-adjusted) to keep the local stack consistent across all four modules. No version pins bumped.
patrickhuie19
force-pushed
the
feat/shared-2709
branch
from
July 9, 2026 16:54
0d489b3 to
1de77a5
Compare
|
Phase 3 of the delta-based metering redesign. Replaces the RESERVE/RELEASE emitter model with signed-delta UPDATE records built on the new chainlink-common resourcemanager API. All three producers (cron, http_trigger, chain_capabilities/evm): - Emit only METER_ACTION_UPDATE via EmitDelta (register=+N, unregister=-N); RESERVE/RELEASE are never emitted. - Delete all process-lifecycle (graceful-close) emissions; the Meterable is deregistered from the ResourceManager first on shutdown, and billing releases a resource by its absence from the next snapshot. - Store the workflow OWNER (never a resolved org) in durable state; org is resolved at emit time via orgresolver.ResolveOrEmpty and in snapshots via a shared CachingOrgResolver whose Start/Close are wired into each service. - Adopt the Phase 2 helpers: ConfigFromEnv, NewBaseIdentity, WithWorkflowDonFallback, ResolveOrEmpty, NewCaching. event_id is stamped by the ResourceManager per emission (producers never set it). - Resolve the authoritative CapDONID once and feed the single value to both the metering identity and the events.KeyDonID labeler. EVM: shared physical filters are billed once via a derived 0<->1 refcount (+addressCount on activation, -addressCount on release), computed atomically under the store lock; snapshots dedup to one entry per physicalFilterID with "lowest triggerID's owner" attribution; the store write is synchronous before the delta emission and cleanUpStaleFilters gains a minimum-age guard. Cron: emitMeterRecord derives don_id/owner from stored trigger state and shares utilization construction with GetUtilization; the callback closes the resurrection window with an atomic WriteIfPresent. HTTP: upsertWorkflow atomically returns the evicted workflow, removing the RegisterWorkflow pre-read TOCTOU; same-ID re-register emits nothing, version update emits -1/+1; RM start failure now logs-and-continues (fail-open, uniform with EVM). Tests updated for delta semantics (signed values, no shutdown emissions, EVM 0<->1 dedup, unique event_ids, cll-meter domain, shared CapDONID). go.mod/go.sum pick up the forced transitive node-platform resolution required to build against the local chainlink-common replace.
… producers
The common EmitDelta/EmitUsage now require a producer-supplied event_id. Each
trigger producer derives it via resourcemanager.EventID from the DON-aggregated
request that drove the delta, so every capability-DON node emits the identical
value for the same logical (un)register. The remote trigger publisher invokes
RegisterTrigger/UnregisterTrigger with the mode-aggregated request (byte-identical
on every node), so the request fields are DON-consistent.
- cron: EventID("cron-register"/"cron-unregister", workflowID, triggerID).
- http: EventID("http-register"/"http-unregister", workflowID); version updates
change the workflowID so their +1/-1 pairs are distinct; unregister hashes
symmetrically with register.
- evm: EventID("evm-activate"/"evm-release", workflowID, triggerID) from the
RegisterLogTrigger/UnregisterLogTrigger request; physicalFilterID stays the
resource_id (not the event_id).
Also scrubs stale "UUID" wording from the event_id docs and aligns each module's
metering pin to the merged chainlink-common pin (local replace intact).
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.


smartcontractkit/chainlink-common#2158
https://github.com/smartcontractkit/chainlink-protos/pull/400/commits