Repository navigation
Billing: Shared gasmeter for cre:workflow:gas usage records - #813
Open
DylanTinianov wants to merge 1 commit into
Open
DylanTinianov wants to merge 1 commit into
DylanTinianov wants to merge 1 commit into
Conversation
…e emission One package for every chain-write capability: builds the usage ResourceManager and identity from the LOOP metering config (gated by MeterRecordsEnabled, snapshots off, DON id when known) and emits one METER_ACTION_USAGE record per chain write keyed by tx hash, logging the reconciler contract line. Replaces the copies in the EVM and Solana plugins (capabilities #804) and is what Stellar and Aptos will use. Bumps chainlink-common to main (29594528) for the workflow usage contract. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
DylanTinianov
added a commit
that referenced
this pull request
Oct 7, 2026
Replaces the duplicated ResourceManager wiring, emit function and tests in the EVM and Solana plugins with chain_capabilities/common/gasmeter (#813). Each plugin now builds one gasmeter.Meter from the LOOP metering config and calls Emit at its fee-resolved point. Pins the common module to the #813 branch until it merges. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
DylanTinianov
marked this pull request as ready for review
October 7, 2026 16:13
product-security-plaid-production
Bot
requested review from
cedric-cordenier,
dhaidashenko and
justinkaseman
October 7, 2026 16:13
DylanTinianov
enabled auto-merge
October 7, 2026 16:48
| resourcemanager.NewBaseIdentity(cfg.DeploymentIdentity, resourcemanager.EmittingServiceChainWrite, ""), | ||
| resourceType, | ||
| ) | ||
| if capabilityDonID != 0 { |
Contributor
There was a problem hiding this comment.
a donID of 0 could be valid, no? Or you want the contract for callers of New to be they set 0 if they don't know the capabilityDonID?
I think if its the latter, we'd benefit most from assuming callers do know the capabilityDonID, or by making capabilityDonID a pointer.
patrickhuie19
approved these changes
Oct 8, 2026
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.




Part of CRE-6781. Extracts the gas usage emission that #804 duplicated in the EVM and Solana plugins into
chain_capabilities/common/gasmeter, so every chain-write capability emits the same record and log line.What
gasmeter.New(lggr, meteringCfg, chainSelector, capabilityDonID)returns nil unlessMeterRecordsEnabled(the host's[Metering]gate, shared with durable resource metering). It builds theResourceManager(snapshots off) and the identity: servicechain-write, poolcre:workflow:gas, pool idcre:workflow:gas:<chain_selector>, DON id when known. Logs an error if the LOOP has no durable emitter.(*Meter).Emit(ctx, metadata, txHash, fee)emits oneMETER_ACTION_USAGErecord per chain write: resource typecre:workflow:gas:<chain_selector>, value in wei/lamports (EmitUsageValue),ResourceId<workflow_id>:<execution_id>,EventId= tx hash. LogsEmitted capability usage meter record(executionID, eventID, resourceType, value, orgID, txHash), the billing reconciler's contract line. A nil meter is a no-op;Start/Closedelegate to the ResourceManager.