From 6028299d8178a3df692fee24cc75ce03f4ce4d77 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Tue, 20 Oct 2026 11:08:29 -0400 Subject: [PATCH 1/5] gasmeter: log workflowID on the usage emission line; fault injection test (CRE-6809) The "Emitted capability usage meter record" line gains workflowID so the emit reconciler can build the billing event id without a sibling line. Bumps chainlink-common and adds a test showing usage fault injection reaches the gas meter through the metering config. Co-Authored-By: Claude Fable 5.1 --- .../common/gasmeter/gasmeter.go | 3 +- .../common/gasmeter/gasmeter_fault_test.go | 37 +++++++++++++++++++ .../common/gasmeter/gasmeter_test.go | 1 + chain_capabilities/common/go.mod | 4 +- chain_capabilities/common/go.sum | 8 ++-- chain_capabilities/evm/go.mod | 4 +- chain_capabilities/evm/go.sum | 8 ++-- chain_capabilities/solana/go.mod | 4 +- chain_capabilities/solana/go.sum | 8 ++-- 9 files changed, 58 insertions(+), 19 deletions(-) create mode 100644 chain_capabilities/common/gasmeter/gasmeter_fault_test.go diff --git a/chain_capabilities/common/gasmeter/gasmeter.go b/chain_capabilities/common/gasmeter/gasmeter.go index ce5953461..dc139bd36 100644 --- a/chain_capabilities/common/gasmeter/gasmeter.go +++ b/chain_capabilities/common/gasmeter/gasmeter.go @@ -73,7 +73,7 @@ func (m *Meter) Close() error { // txHash (or tx signature) is the capability event id: one record per // on-chain write, identical on every node of the DON that observes it. The // log line is a contract consumed by the billing reconciler (fields: -// executionID, eventID, resourceType, value, orgID, txHash) and must stay +// workflowID, executionID, eventID, resourceType, value, orgID, txHash) and must stay // stable. Fail-open: never affects the reply. func (m *Meter) Emit(ctx context.Context, metadata capabilities.RequestMetadata, txHash string, fee *big.Int) { if m == nil || fee == nil { @@ -90,6 +90,7 @@ func (m *Meter) Emit(ctx context.Context, metadata capabilities.RequestMetadata, OrgID: metadata.OrgID, }) m.lggr.Infow("Emitted capability usage meter record", + "workflowID", metadata.WorkflowID, "executionID", metadata.WorkflowExecutionID, "eventID", txHash, "resourceType", m.resourceType, diff --git a/chain_capabilities/common/gasmeter/gasmeter_fault_test.go b/chain_capabilities/common/gasmeter/gasmeter_fault_test.go new file mode 100644 index 000000000..7c4b18d41 --- /dev/null +++ b/chain_capabilities/common/gasmeter/gasmeter_fault_test.go @@ -0,0 +1,37 @@ +package gasmeter + +import ( + "math/big" + "testing" + + "github.com/stretchr/testify/require" + + "github.com/smartcontractkit/chainlink-common/pkg/capabilities" + "github.com/smartcontractkit/chainlink-common/pkg/logger" + "github.com/smartcontractkit/chainlink-common/pkg/resourcemanager" +) + +// Fault injection is configured on the shared ResourceManagerConfig, so it +// reaches the gas meter with no code here. +func TestEmit_FaultInjection(t *testing.T) { + metadata := capabilities.RequestMetadata{WorkflowID: "wf-1", WorkflowExecutionID: "exec-1", OrgID: "org-1"} + + t.Run("perturb adds delta to the emitted fee", func(t *testing.T) { + emitter := &recordingEmitter{} + cfg := enabledCfg(emitter) + cfg.FaultInjection = resourcemanager.UsageFaultInjection{Mode: resourcemanager.FaultModePerturb, Rate: 1, Delta: 7} + m := New(logger.Test(t), cfg, 1, 7) + m.Emit(t.Context(), metadata, "0xabc", big.NewInt(100)) + require.Len(t, emitter.records, 1) + require.Equal(t, "107", emitter.records[0].GetUtilizations()[0].GetValue()) + }) + + t.Run("drop emits nothing", func(t *testing.T) { + emitter := &recordingEmitter{} + cfg := enabledCfg(emitter) + cfg.FaultInjection = resourcemanager.UsageFaultInjection{Mode: resourcemanager.FaultModeDrop, Rate: 1} + m := New(logger.Test(t), cfg, 1, 7) + m.Emit(t.Context(), metadata, "0xabc", big.NewInt(100)) + require.Empty(t, emitter.records) + }) +} diff --git a/chain_capabilities/common/gasmeter/gasmeter_test.go b/chain_capabilities/common/gasmeter/gasmeter_test.go index 832f5ea0f..51fd6c5a7 100644 --- a/chain_capabilities/common/gasmeter/gasmeter_test.go +++ b/chain_capabilities/common/gasmeter/gasmeter_test.go @@ -84,6 +84,7 @@ func TestEmit(t *testing.T) { logs := obs.FilterMessage("Emitted capability usage meter record").All() require.Len(t, logs, 1) fields := logs[0].ContextMap() + require.Equal(t, "wf-1", fields["workflowID"]) require.Equal(t, "exec-1", fields["executionID"]) require.Equal(t, "0xabc", fields["eventID"]) require.Equal(t, "cre:workflow:gas:421614", fields["resourceType"]) diff --git a/chain_capabilities/common/go.mod b/chain_capabilities/common/go.mod index f7fea57a2..59eaf2759 100644 --- a/chain_capabilities/common/go.mod +++ b/chain_capabilities/common/go.mod @@ -5,7 +5,7 @@ go 1.27.1 require ( github.com/jpillora/backoff v1.0.0 github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261006175240-29594528f464 + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 github.com/smartcontractkit/chainlink-protos/metering/go v0.0.0-20260710151514-27b5a126dabe github.com/smartcontractkit/libocr v0.0.0-20260810200708-618b5bf7f342 github.com/stretchr/testify v1.12.1 @@ -53,7 +53,7 @@ require ( github.com/shopspring/decimal v1.4.0 // indirect github.com/smartcontractkit/chain-selectors v1.0.104 // indirect github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 // indirect - github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260804191526-b7a850ae7648 // indirect + github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b // indirect github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b // indirect github.com/stretchr/objx v0.5.3 // indirect github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect diff --git a/chain_capabilities/common/go.sum b/chain_capabilities/common/go.sum index 2d6a64241..c4be25704 100644 --- a/chain_capabilities/common/go.sum +++ b/chain_capabilities/common/go.sum @@ -94,12 +94,12 @@ github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64 github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64/go.mod h1:DZkOtlIRV6ecpCskdXMF+k2es3uJQqTT1m5TRB9etjQ= github.com/smartcontractkit/chain-selectors v1.0.104 h1:/n9pPGM5W/+r1eHoWZv4VwX9LNS1af4+ICyhM8zKRNM= github.com/smartcontractkit/chain-selectors v1.0.104/go.mod h1:qy7whtgG5g+7z0jt0nRyii9bLND9m15NZTzuQPkMZ5w= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261006175240-29594528f464 h1:DVXwyIGekGqLaFAcSWa3K3S209gAY0WDFwliYdLp1dk= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261006175240-29594528f464/go.mod h1:37Mu0pbAnGmHPgOZ8bQvgP4hzXw/Wu7smKX4cN46UOs= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 h1:OSh6Ls1cxt+0hY6TY3nGyxZyExs/VV1HABoPuMJ5Vtw= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549/go.mod h1:Scyk7O80fde5rJF3Ty3fEE3xiS6j84eWbu8/2gl3pIY= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260804191526-b7a850ae7648 h1:WEUMkKQPAgcNMRgES6CBWrRUiII+HKEWQjulKQBSuMA= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260804191526-b7a850ae7648/go.mod h1:/i8hjTPFdVWHiY+QjeSiVS2Z3GB3WAZznGgXHstC02E= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b h1:tlxPkVQ6ZpJIElqUWc4lU5VH4BB6OzhckG/gHwpaaa0= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b/go.mod h1:/i8hjTPFdVWHiY+QjeSiVS2Z3GB3WAZznGgXHstC02E= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b h1:QuI6SmQFK/zyUlVWEf0GMkiUYBPY4lssn26nKSd/bOM= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b/go.mod h1:qSTSwX3cBP3FKQwQacdjArqv0g6QnukjV4XuzO6UyoY= github.com/smartcontractkit/chainlink-protos/metering/go v0.0.0-20260710151514-27b5a126dabe h1:MDnY5wQbWTpFdDnMRicEnoMfSP5nM/KncARr4skP1ug= diff --git a/chain_capabilities/evm/go.mod b/chain_capabilities/evm/go.mod index 6b1cb9d9e..d498ea2a1 100644 --- a/chain_capabilities/evm/go.mod +++ b/chain_capabilities/evm/go.mod @@ -8,11 +8,11 @@ require ( github.com/smartcontractkit/capabilities/chain_capabilities/common v0.0.0-20261009182120-372f846f528c github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/chain-selectors v1.0.112 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261006175240-29594528f464 + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 github.com/smartcontractkit/chainlink-evm v0.3.4-0.20260917132551-2a2b38e8b744 github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260512150409-b4068bf735e6 github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 - github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260821155228-fa1d775e2138 + github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b github.com/smartcontractkit/libocr v0.0.0-20260810200708-618b5bf7f342 github.com/stretchr/testify v1.12.1 go.opentelemetry.io/otel v1.46.0 diff --git a/chain_capabilities/evm/go.sum b/chain_capabilities/evm/go.sum index 66d66b550..86881bb79 100644 --- a/chain_capabilities/evm/go.sum +++ b/chain_capabilities/evm/go.sum @@ -458,8 +458,8 @@ github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961/go.mod h1:h4kazMLsDM6CsKl2OnT9AtCHhhRsFptA/OTM7Hkj2GE= github.com/smartcontractkit/chain-selectors v1.0.112 h1:3VO+ttHsqGzPviMmb1AsIT5+rXVgz/Xx6wmvTpamrzE= github.com/smartcontractkit/chain-selectors v1.0.112/go.mod h1:qy7whtgG5g+7z0jt0nRyii9bLND9m15NZTzuQPkMZ5w= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261006175240-29594528f464 h1:DVXwyIGekGqLaFAcSWa3K3S209gAY0WDFwliYdLp1dk= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261006175240-29594528f464/go.mod h1:37Mu0pbAnGmHPgOZ8bQvgP4hzXw/Wu7smKX4cN46UOs= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 h1:OSh6Ls1cxt+0hY6TY3nGyxZyExs/VV1HABoPuMJ5Vtw= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= github.com/smartcontractkit/chainlink-common/keystore v1.3.1-0.20260917115705-1d3a14a9b049 h1:nQ2bw8QQLT+AuCE6JUVIRT1RAo08wQHR9jWh+MgT2GA= github.com/smartcontractkit/chainlink-common/keystore v1.3.1-0.20260917115705-1d3a14a9b049/go.mod h1:FO9igruzwHPXstyb9J9z83sJ19iLSNSIg+0H/n0wlJU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= @@ -474,8 +474,8 @@ github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260723212800-b2 github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260723212800-b2f21d31b1d2/go.mod h1:HG/aei0MgBOpsyRLexdKGtOUO8yjSJO3iUu0Uu8KBm4= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 h1:71PGTkjdFZ0JrloEC2Fs8eHl1b1gmUuH+bq7q23usKk= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243/go.mod h1:7ketk4ischPQW/JQgmyHz6zdzLUJv1VC29SiSgosydQ= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260821155228-fa1d775e2138 h1:Vk0CZJakAUS/djfBhIJENH4WvM4xl6bY8dYD8cIY/sk= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260821155228-fa1d775e2138/go.mod h1:/i8hjTPFdVWHiY+QjeSiVS2Z3GB3WAZznGgXHstC02E= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b h1:tlxPkVQ6ZpJIElqUWc4lU5VH4BB6OzhckG/gHwpaaa0= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b/go.mod h1:/i8hjTPFdVWHiY+QjeSiVS2Z3GB3WAZznGgXHstC02E= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20260512230622-65f10f4cd305 h1:NJdGFhzT6zMaTod4QkBqVD2sg0I25iw1boOYtTpEwRo= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20260512230622-65f10f4cd305/go.mod h1:qSTSwX3cBP3FKQwQacdjArqv0g6QnukjV4XuzO6UyoY= github.com/smartcontractkit/chainlink-protos/metering/go v0.0.0-20260710151514-27b5a126dabe h1:MDnY5wQbWTpFdDnMRicEnoMfSP5nM/KncARr4skP1ug= diff --git a/chain_capabilities/solana/go.mod b/chain_capabilities/solana/go.mod index 6670b8f4b..795743583 100644 --- a/chain_capabilities/solana/go.mod +++ b/chain_capabilities/solana/go.mod @@ -9,9 +9,9 @@ require ( github.com/smartcontractkit/capabilities/chain_capabilities/common v0.0.0-20261009182120-372f846f528c github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/chain-selectors v1.0.104 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261006175240-29594528f464 + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 - github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260821155228-fa1d775e2138 + github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b github.com/smartcontractkit/chainlink-solana v1.3.1-0.20260917175559-f7d4a86019d4 github.com/smartcontractkit/chainlink-solana/contracts v0.0.0-20260803170030-90043607d911 github.com/smartcontractkit/libocr v0.0.0-20260810200708-618b5bf7f342 diff --git a/chain_capabilities/solana/go.sum b/chain_capabilities/solana/go.sum index 611a9f60b..b4f5a27f2 100644 --- a/chain_capabilities/solana/go.sum +++ b/chain_capabilities/solana/go.sum @@ -634,8 +634,8 @@ github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260310183131-8 github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260310183131-8d0f0e383288/go.mod h1:jPHlo/IN2YAArI001JJixmm6ZHQwgnAVJXY8VBFiFTc= github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260310183131-8d0f0e383288 h1:eEjTgIQn4RW0ZPRepUDYTdgGwaRCMawMwgXkHItUc9U= github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260310183131-8d0f0e383288/go.mod h1:67YbnoglYD61Pz/jTVCgav9wFq7S35OU8UyQSvPllRw= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261006175240-29594528f464 h1:DVXwyIGekGqLaFAcSWa3K3S209gAY0WDFwliYdLp1dk= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261006175240-29594528f464/go.mod h1:37Mu0pbAnGmHPgOZ8bQvgP4hzXw/Wu7smKX4cN46UOs= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 h1:OSh6Ls1cxt+0hY6TY3nGyxZyExs/VV1HABoPuMJ5Vtw= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549/go.mod h1:Scyk7O80fde5rJF3Ty3fEE3xiS6j84eWbu8/2gl3pIY= github.com/smartcontractkit/chainlink-common/pkg/monitoring v0.0.0-20251215152504-b1e41f508340 h1:PsjEI+5jZIz9AS4eOsLS5VpSWJINf38clXV3wryPyMk= @@ -644,8 +644,8 @@ github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260521164805-26 github.com/smartcontractkit/chainlink-framework/metrics v0.0.0-20260521164805-26d78d5e1243/go.mod h1:HG/aei0MgBOpsyRLexdKGtOUO8yjSJO3iUu0Uu8KBm4= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 h1:71PGTkjdFZ0JrloEC2Fs8eHl1b1gmUuH+bq7q23usKk= github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243/go.mod h1:7ketk4ischPQW/JQgmyHz6zdzLUJv1VC29SiSgosydQ= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260821155228-fa1d775e2138 h1:Vk0CZJakAUS/djfBhIJENH4WvM4xl6bY8dYD8cIY/sk= -github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20260821155228-fa1d775e2138/go.mod h1:/i8hjTPFdVWHiY+QjeSiVS2Z3GB3WAZznGgXHstC02E= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b h1:tlxPkVQ6ZpJIElqUWc4lU5VH4BB6OzhckG/gHwpaaa0= +github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b/go.mod h1:/i8hjTPFdVWHiY+QjeSiVS2Z3GB3WAZznGgXHstC02E= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b h1:QuI6SmQFK/zyUlVWEf0GMkiUYBPY4lssn26nKSd/bOM= github.com/smartcontractkit/chainlink-protos/linking-service/go v0.0.0-20251002192024-d2ad9222409b/go.mod h1:qSTSwX3cBP3FKQwQacdjArqv0g6QnukjV4XuzO6UyoY= github.com/smartcontractkit/chainlink-protos/metering/go v0.0.0-20260710151514-27b5a126dabe h1:MDnY5wQbWTpFdDnMRicEnoMfSP5nM/KncARr4skP1ug= From d681ebc7ce0d4cfbe12f1a24a8c6fd72b2badba3 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Tue, 20 Oct 2026 13:13:25 -0400 Subject: [PATCH 2/5] chain_capabilities: bump chainlink-common to the fault injection branch head Picks up the usage fault injector so the gas meter test that exercises it compiles. Co-Authored-By: Claude Fable 5.1 --- chain_capabilities/common/go.mod | 2 +- chain_capabilities/common/go.sum | 4 ++-- chain_capabilities/evm/go.mod | 2 +- chain_capabilities/evm/go.sum | 4 ++-- chain_capabilities/solana/go.mod | 2 +- chain_capabilities/solana/go.sum | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/chain_capabilities/common/go.mod b/chain_capabilities/common/go.mod index 59eaf2759..8f791c9fb 100644 --- a/chain_capabilities/common/go.mod +++ b/chain_capabilities/common/go.mod @@ -5,7 +5,7 @@ go 1.27.1 require ( github.com/jpillora/backoff v1.0.0 github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f github.com/smartcontractkit/chainlink-protos/metering/go v0.0.0-20260710151514-27b5a126dabe github.com/smartcontractkit/libocr v0.0.0-20260810200708-618b5bf7f342 github.com/stretchr/testify v1.12.1 diff --git a/chain_capabilities/common/go.sum b/chain_capabilities/common/go.sum index c4be25704..2e1d5b654 100644 --- a/chain_capabilities/common/go.sum +++ b/chain_capabilities/common/go.sum @@ -94,8 +94,8 @@ github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64 github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64/go.mod h1:DZkOtlIRV6ecpCskdXMF+k2es3uJQqTT1m5TRB9etjQ= github.com/smartcontractkit/chain-selectors v1.0.104 h1:/n9pPGM5W/+r1eHoWZv4VwX9LNS1af4+ICyhM8zKRNM= github.com/smartcontractkit/chain-selectors v1.0.104/go.mod h1:qy7whtgG5g+7z0jt0nRyii9bLND9m15NZTzuQPkMZ5w= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 h1:OSh6Ls1cxt+0hY6TY3nGyxZyExs/VV1HABoPuMJ5Vtw= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f h1:nDqI06Sbov5uok418x1WYcr5nUhYvFSFEdpqG0kFsdg= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549/go.mod h1:Scyk7O80fde5rJF3Ty3fEE3xiS6j84eWbu8/2gl3pIY= github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b h1:tlxPkVQ6ZpJIElqUWc4lU5VH4BB6OzhckG/gHwpaaa0= diff --git a/chain_capabilities/evm/go.mod b/chain_capabilities/evm/go.mod index d498ea2a1..dbafbe926 100644 --- a/chain_capabilities/evm/go.mod +++ b/chain_capabilities/evm/go.mod @@ -8,7 +8,7 @@ require ( github.com/smartcontractkit/capabilities/chain_capabilities/common v0.0.0-20261009182120-372f846f528c github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/chain-selectors v1.0.112 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f github.com/smartcontractkit/chainlink-evm v0.3.4-0.20260917132551-2a2b38e8b744 github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260512150409-b4068bf735e6 github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 diff --git a/chain_capabilities/evm/go.sum b/chain_capabilities/evm/go.sum index 86881bb79..cf18504e8 100644 --- a/chain_capabilities/evm/go.sum +++ b/chain_capabilities/evm/go.sum @@ -458,8 +458,8 @@ github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961/go.mod h1:h4kazMLsDM6CsKl2OnT9AtCHhhRsFptA/OTM7Hkj2GE= github.com/smartcontractkit/chain-selectors v1.0.112 h1:3VO+ttHsqGzPviMmb1AsIT5+rXVgz/Xx6wmvTpamrzE= github.com/smartcontractkit/chain-selectors v1.0.112/go.mod h1:qy7whtgG5g+7z0jt0nRyii9bLND9m15NZTzuQPkMZ5w= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 h1:OSh6Ls1cxt+0hY6TY3nGyxZyExs/VV1HABoPuMJ5Vtw= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f h1:nDqI06Sbov5uok418x1WYcr5nUhYvFSFEdpqG0kFsdg= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= github.com/smartcontractkit/chainlink-common/keystore v1.3.1-0.20260917115705-1d3a14a9b049 h1:nQ2bw8QQLT+AuCE6JUVIRT1RAo08wQHR9jWh+MgT2GA= github.com/smartcontractkit/chainlink-common/keystore v1.3.1-0.20260917115705-1d3a14a9b049/go.mod h1:FO9igruzwHPXstyb9J9z83sJ19iLSNSIg+0H/n0wlJU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= diff --git a/chain_capabilities/solana/go.mod b/chain_capabilities/solana/go.mod index 795743583..39e55e00e 100644 --- a/chain_capabilities/solana/go.mod +++ b/chain_capabilities/solana/go.mod @@ -9,7 +9,7 @@ require ( github.com/smartcontractkit/capabilities/chain_capabilities/common v0.0.0-20261009182120-372f846f528c github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/chain-selectors v1.0.104 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b github.com/smartcontractkit/chainlink-solana v1.3.1-0.20260917175559-f7d4a86019d4 diff --git a/chain_capabilities/solana/go.sum b/chain_capabilities/solana/go.sum index b4f5a27f2..d0eff3f82 100644 --- a/chain_capabilities/solana/go.sum +++ b/chain_capabilities/solana/go.sum @@ -634,8 +634,8 @@ github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260310183131-8 github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260310183131-8d0f0e383288/go.mod h1:jPHlo/IN2YAArI001JJixmm6ZHQwgnAVJXY8VBFiFTc= github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260310183131-8d0f0e383288 h1:eEjTgIQn4RW0ZPRepUDYTdgGwaRCMawMwgXkHItUc9U= github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260310183131-8d0f0e383288/go.mod h1:67YbnoglYD61Pz/jTVCgav9wFq7S35OU8UyQSvPllRw= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0 h1:OSh6Ls1cxt+0hY6TY3nGyxZyExs/VV1HABoPuMJ5Vtw= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020150550-9da3322e3af0/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f h1:nDqI06Sbov5uok418x1WYcr5nUhYvFSFEdpqG0kFsdg= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549/go.mod h1:Scyk7O80fde5rJF3Ty3fEE3xiS6j84eWbu8/2gl3pIY= github.com/smartcontractkit/chainlink-common/pkg/monitoring v0.0.0-20251215152504-b1e41f508340 h1:PsjEI+5jZIz9AS4eOsLS5VpSWJINf38clXV3wryPyMk= From b4d23160ac52eb8e65c64db60221d321c94763e5 Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Tue, 27 Oct 2026 12:40:33 -0400 Subject: [PATCH 3/5] gasmeter: cover the org allowlist and both fault samples; bump chainlink-common Co-Authored-By: Claude Fable 5.1 --- .../common/gasmeter/gasmeter_fault_test.go | 19 +++++++++++++++---- chain_capabilities/common/go.mod | 2 +- chain_capabilities/common/go.sum | 4 ++-- chain_capabilities/evm/go.mod | 2 +- chain_capabilities/evm/go.sum | 4 ++-- chain_capabilities/solana/go.mod | 2 +- chain_capabilities/solana/go.sum | 4 ++-- 7 files changed, 24 insertions(+), 13 deletions(-) diff --git a/chain_capabilities/common/gasmeter/gasmeter_fault_test.go b/chain_capabilities/common/gasmeter/gasmeter_fault_test.go index 7c4b18d41..db87397e5 100644 --- a/chain_capabilities/common/gasmeter/gasmeter_fault_test.go +++ b/chain_capabilities/common/gasmeter/gasmeter_fault_test.go @@ -15,23 +15,34 @@ import ( // reaches the gas meter with no code here. func TestEmit_FaultInjection(t *testing.T) { metadata := capabilities.RequestMetadata{WorkflowID: "wf-1", WorkflowExecutionID: "exec-1", OrgID: "org-1"} + orgs := []string{"org-1"} - t.Run("perturb adds delta to the emitted fee", func(t *testing.T) { + t.Run("perturb subtracts delta from the emitted fee", func(t *testing.T) { emitter := &recordingEmitter{} cfg := enabledCfg(emitter) - cfg.FaultInjection = resourcemanager.UsageFaultInjection{Mode: resourcemanager.FaultModePerturb, Rate: 1, Delta: 7} + cfg.FaultInjection = resourcemanager.UsageFaultInjection{Orgs: orgs, PerturbRate: 1, Delta: -7} m := New(logger.Test(t), cfg, 1, 7) m.Emit(t.Context(), metadata, "0xabc", big.NewInt(100)) require.Len(t, emitter.records, 1) - require.Equal(t, "107", emitter.records[0].GetUtilizations()[0].GetValue()) + require.Equal(t, "93", emitter.records[0].GetUtilizations()[0].GetValue()) }) t.Run("drop emits nothing", func(t *testing.T) { emitter := &recordingEmitter{} cfg := enabledCfg(emitter) - cfg.FaultInjection = resourcemanager.UsageFaultInjection{Mode: resourcemanager.FaultModeDrop, Rate: 1} + cfg.FaultInjection = resourcemanager.UsageFaultInjection{Orgs: orgs, DropRate: 1} m := New(logger.Test(t), cfg, 1, 7) m.Emit(t.Context(), metadata, "0xabc", big.NewInt(100)) require.Empty(t, emitter.records) }) + + t.Run("other org is untouched", func(t *testing.T) { + emitter := &recordingEmitter{} + cfg := enabledCfg(emitter) + cfg.FaultInjection = resourcemanager.UsageFaultInjection{Orgs: []string{"org-canary"}, DropRate: 1} + m := New(logger.Test(t), cfg, 1, 7) + m.Emit(t.Context(), metadata, "0xabc", big.NewInt(100)) + require.Len(t, emitter.records, 1) + require.Equal(t, "100", emitter.records[0].GetUtilizations()[0].GetValue()) + }) } diff --git a/chain_capabilities/common/go.mod b/chain_capabilities/common/go.mod index 5a80a0b31..06d92d61d 100644 --- a/chain_capabilities/common/go.mod +++ b/chain_capabilities/common/go.mod @@ -5,7 +5,7 @@ go 1.27.3 require ( github.com/jpillora/backoff v1.0.0 github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 github.com/smartcontractkit/chainlink-protos/metering/go v0.0.0-20260710151514-27b5a126dabe github.com/smartcontractkit/libocr v0.0.0-20260810200708-618b5bf7f342 github.com/stretchr/testify v1.12.1 diff --git a/chain_capabilities/common/go.sum b/chain_capabilities/common/go.sum index 2e1d5b654..2fb4c6180 100644 --- a/chain_capabilities/common/go.sum +++ b/chain_capabilities/common/go.sum @@ -94,8 +94,8 @@ github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64 github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64/go.mod h1:DZkOtlIRV6ecpCskdXMF+k2es3uJQqTT1m5TRB9etjQ= github.com/smartcontractkit/chain-selectors v1.0.104 h1:/n9pPGM5W/+r1eHoWZv4VwX9LNS1af4+ICyhM8zKRNM= github.com/smartcontractkit/chain-selectors v1.0.104/go.mod h1:qy7whtgG5g+7z0jt0nRyii9bLND9m15NZTzuQPkMZ5w= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f h1:nDqI06Sbov5uok418x1WYcr5nUhYvFSFEdpqG0kFsdg= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 h1:ElZmfdfQgrYHQBA/nMyQq/zQQEJWTVuEzLtoj0ZKHwI= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3/go.mod h1:yhZCSkRjMDM+02HfmENL0HcaeT/WXmIxUh99TwL5awU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549/go.mod h1:Scyk7O80fde5rJF3Ty3fEE3xiS6j84eWbu8/2gl3pIY= github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b h1:tlxPkVQ6ZpJIElqUWc4lU5VH4BB6OzhckG/gHwpaaa0= diff --git a/chain_capabilities/evm/go.mod b/chain_capabilities/evm/go.mod index 25afecc11..8ef1c59a7 100644 --- a/chain_capabilities/evm/go.mod +++ b/chain_capabilities/evm/go.mod @@ -8,7 +8,7 @@ require ( github.com/smartcontractkit/capabilities/chain_capabilities/common v0.0.0-20261009182120-372f846f528c github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/chain-selectors v1.0.112 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 github.com/smartcontractkit/chainlink-evm v0.3.4-0.20260917132551-2a2b38e8b744 github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260512150409-b4068bf735e6 github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 diff --git a/chain_capabilities/evm/go.sum b/chain_capabilities/evm/go.sum index 052a47a99..a8415e8d4 100644 --- a/chain_capabilities/evm/go.sum +++ b/chain_capabilities/evm/go.sum @@ -458,8 +458,8 @@ github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961/go.mod h1:h4kazMLsDM6CsKl2OnT9AtCHhhRsFptA/OTM7Hkj2GE= github.com/smartcontractkit/chain-selectors v1.0.112 h1:3VO+ttHsqGzPviMmb1AsIT5+rXVgz/Xx6wmvTpamrzE= github.com/smartcontractkit/chain-selectors v1.0.112/go.mod h1:qy7whtgG5g+7z0jt0nRyii9bLND9m15NZTzuQPkMZ5w= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f h1:nDqI06Sbov5uok418x1WYcr5nUhYvFSFEdpqG0kFsdg= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 h1:ElZmfdfQgrYHQBA/nMyQq/zQQEJWTVuEzLtoj0ZKHwI= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3/go.mod h1:yhZCSkRjMDM+02HfmENL0HcaeT/WXmIxUh99TwL5awU= github.com/smartcontractkit/chainlink-common/keystore v1.3.1-0.20260917115705-1d3a14a9b049 h1:nQ2bw8QQLT+AuCE6JUVIRT1RAo08wQHR9jWh+MgT2GA= github.com/smartcontractkit/chainlink-common/keystore v1.3.1-0.20260917115705-1d3a14a9b049/go.mod h1:FO9igruzwHPXstyb9J9z83sJ19iLSNSIg+0H/n0wlJU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= diff --git a/chain_capabilities/solana/go.mod b/chain_capabilities/solana/go.mod index c1d339b2f..e68d73ea8 100644 --- a/chain_capabilities/solana/go.mod +++ b/chain_capabilities/solana/go.mod @@ -9,7 +9,7 @@ require ( github.com/smartcontractkit/capabilities/chain_capabilities/common v0.0.0-20261009182120-372f846f528c github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/chain-selectors v1.0.104 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b github.com/smartcontractkit/chainlink-solana v1.3.1-0.20260917175559-f7d4a86019d4 diff --git a/chain_capabilities/solana/go.sum b/chain_capabilities/solana/go.sum index 2a89eec6c..6193d86c3 100644 --- a/chain_capabilities/solana/go.sum +++ b/chain_capabilities/solana/go.sum @@ -634,8 +634,8 @@ github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260310183131-8 github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260310183131-8d0f0e383288/go.mod h1:jPHlo/IN2YAArI001JJixmm6ZHQwgnAVJXY8VBFiFTc= github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260310183131-8d0f0e383288 h1:eEjTgIQn4RW0ZPRepUDYTdgGwaRCMawMwgXkHItUc9U= github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260310183131-8d0f0e383288/go.mod h1:67YbnoglYD61Pz/jTVCgav9wFq7S35OU8UyQSvPllRw= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f h1:nDqI06Sbov5uok418x1WYcr5nUhYvFSFEdpqG0kFsdg= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261020170659-b02a548d039f/go.mod h1:QeHe1mlcVzzg+awYAkRfl/8mDLRAhsl18IIOg4MVZec= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 h1:ElZmfdfQgrYHQBA/nMyQq/zQQEJWTVuEzLtoj0ZKHwI= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3/go.mod h1:yhZCSkRjMDM+02HfmENL0HcaeT/WXmIxUh99TwL5awU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549/go.mod h1:Scyk7O80fde5rJF3Ty3fEE3xiS6j84eWbu8/2gl3pIY= github.com/smartcontractkit/chainlink-common/pkg/monitoring v0.0.0-20251215152504-b1e41f508340 h1:PsjEI+5jZIz9AS4eOsLS5VpSWJINf38clXV3wryPyMk= From f248fc650e759f3f24b08c6971ecb646f22ef10e Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Wed, 28 Oct 2026 15:00:00 -0400 Subject: [PATCH 4/5] gasmeter: cover settings-driven fault injection; bump chainlink-common Co-Authored-By: Claude Fable 5.1 --- .../common/gasmeter/gasmeter_fault_test.go | 26 ++++++++++++++----- chain_capabilities/common/go.mod | 2 +- chain_capabilities/common/go.sum | 4 +-- chain_capabilities/evm/go.mod | 2 +- chain_capabilities/evm/go.sum | 4 +-- chain_capabilities/solana/go.mod | 2 +- chain_capabilities/solana/go.sum | 4 +-- 7 files changed, 28 insertions(+), 16 deletions(-) diff --git a/chain_capabilities/common/gasmeter/gasmeter_fault_test.go b/chain_capabilities/common/gasmeter/gasmeter_fault_test.go index db87397e5..14cdb3a46 100644 --- a/chain_capabilities/common/gasmeter/gasmeter_fault_test.go +++ b/chain_capabilities/common/gasmeter/gasmeter_fault_test.go @@ -1,6 +1,7 @@ package gasmeter import ( + "fmt" "math/big" "testing" @@ -8,19 +9,30 @@ import ( "github.com/smartcontractkit/chainlink-common/pkg/capabilities" "github.com/smartcontractkit/chainlink-common/pkg/logger" - "github.com/smartcontractkit/chainlink-common/pkg/resourcemanager" + "github.com/smartcontractkit/chainlink-common/pkg/settings" ) -// Fault injection is configured on the shared ResourceManagerConfig, so it -// reaches the gas meter with no code here. +// faultSettings builds a getter with PerOrg.BillingFault* overrides for org. +func faultSettings(t *testing.T, org string, kv map[string]string) settings.Getter { + t.Helper() + cfg := fmt.Sprintf("[org.%s.PerOrg]\n", org) + for k, v := range kv { + cfg += fmt.Sprintf("%s = %q\n", k, v) + } + g, err := settings.NewTOMLGetter([]byte(cfg)) + require.NoError(t, err) + return g +} + +// Fault injection is read from CRE settings by the shared ResourceManager, so +// it reaches the gas meter with no code here. func TestEmit_FaultInjection(t *testing.T) { metadata := capabilities.RequestMetadata{WorkflowID: "wf-1", WorkflowExecutionID: "exec-1", OrgID: "org-1"} - orgs := []string{"org-1"} t.Run("perturb subtracts delta from the emitted fee", func(t *testing.T) { emitter := &recordingEmitter{} cfg := enabledCfg(emitter) - cfg.FaultInjection = resourcemanager.UsageFaultInjection{Orgs: orgs, PerturbRate: 1, Delta: -7} + cfg.Settings = faultSettings(t, "org-1", map[string]string{"BillingFaultPerturbRate": "1", "BillingFaultPerturbDelta": "-7"}) m := New(logger.Test(t), cfg, 1, 7) m.Emit(t.Context(), metadata, "0xabc", big.NewInt(100)) require.Len(t, emitter.records, 1) @@ -30,7 +42,7 @@ func TestEmit_FaultInjection(t *testing.T) { t.Run("drop emits nothing", func(t *testing.T) { emitter := &recordingEmitter{} cfg := enabledCfg(emitter) - cfg.FaultInjection = resourcemanager.UsageFaultInjection{Orgs: orgs, DropRate: 1} + cfg.Settings = faultSettings(t, "org-1", map[string]string{"BillingFaultDropRate": "1"}) m := New(logger.Test(t), cfg, 1, 7) m.Emit(t.Context(), metadata, "0xabc", big.NewInt(100)) require.Empty(t, emitter.records) @@ -39,7 +51,7 @@ func TestEmit_FaultInjection(t *testing.T) { t.Run("other org is untouched", func(t *testing.T) { emitter := &recordingEmitter{} cfg := enabledCfg(emitter) - cfg.FaultInjection = resourcemanager.UsageFaultInjection{Orgs: []string{"org-canary"}, DropRate: 1} + cfg.Settings = faultSettings(t, "org-canary", map[string]string{"BillingFaultDropRate": "1"}) m := New(logger.Test(t), cfg, 1, 7) m.Emit(t.Context(), metadata, "0xabc", big.NewInt(100)) require.Len(t, emitter.records, 1) diff --git a/chain_capabilities/common/go.mod b/chain_capabilities/common/go.mod index 06d92d61d..0fd879dcc 100644 --- a/chain_capabilities/common/go.mod +++ b/chain_capabilities/common/go.mod @@ -5,7 +5,7 @@ go 1.27.3 require ( github.com/jpillora/backoff v1.0.0 github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261028185759-68a28f8f3732 github.com/smartcontractkit/chainlink-protos/metering/go v0.0.0-20260710151514-27b5a126dabe github.com/smartcontractkit/libocr v0.0.0-20260810200708-618b5bf7f342 github.com/stretchr/testify v1.12.1 diff --git a/chain_capabilities/common/go.sum b/chain_capabilities/common/go.sum index 2fb4c6180..0b2c68c6b 100644 --- a/chain_capabilities/common/go.sum +++ b/chain_capabilities/common/go.sum @@ -94,8 +94,8 @@ github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64 github.com/smartcontractkit/capabilities/libs v0.0.0-20260714133332-db2a5f11cd64/go.mod h1:DZkOtlIRV6ecpCskdXMF+k2es3uJQqTT1m5TRB9etjQ= github.com/smartcontractkit/chain-selectors v1.0.104 h1:/n9pPGM5W/+r1eHoWZv4VwX9LNS1af4+ICyhM8zKRNM= github.com/smartcontractkit/chain-selectors v1.0.104/go.mod h1:qy7whtgG5g+7z0jt0nRyii9bLND9m15NZTzuQPkMZ5w= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 h1:ElZmfdfQgrYHQBA/nMyQq/zQQEJWTVuEzLtoj0ZKHwI= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3/go.mod h1:yhZCSkRjMDM+02HfmENL0HcaeT/WXmIxUh99TwL5awU= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261028185759-68a28f8f3732 h1:yHsWQnX18N8m24dqELkEb39GKY37TX5m5Sz/ZnqMfVs= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261028185759-68a28f8f3732/go.mod h1:yhZCSkRjMDM+02HfmENL0HcaeT/WXmIxUh99TwL5awU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549/go.mod h1:Scyk7O80fde5rJF3Ty3fEE3xiS6j84eWbu8/2gl3pIY= github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b h1:tlxPkVQ6ZpJIElqUWc4lU5VH4BB6OzhckG/gHwpaaa0= diff --git a/chain_capabilities/evm/go.mod b/chain_capabilities/evm/go.mod index 8ef1c59a7..b289d777f 100644 --- a/chain_capabilities/evm/go.mod +++ b/chain_capabilities/evm/go.mod @@ -8,7 +8,7 @@ require ( github.com/smartcontractkit/capabilities/chain_capabilities/common v0.0.0-20261009182120-372f846f528c github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/chain-selectors v1.0.112 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261028185759-68a28f8f3732 github.com/smartcontractkit/chainlink-evm v0.3.4-0.20260917132551-2a2b38e8b744 github.com/smartcontractkit/chainlink-evm/gethwrappers v0.0.0-20260512150409-b4068bf735e6 github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 diff --git a/chain_capabilities/evm/go.sum b/chain_capabilities/evm/go.sum index a8415e8d4..29dfaf2ee 100644 --- a/chain_capabilities/evm/go.sum +++ b/chain_capabilities/evm/go.sum @@ -458,8 +458,8 @@ github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961/go.mod h1:h4kazMLsDM6CsKl2OnT9AtCHhhRsFptA/OTM7Hkj2GE= github.com/smartcontractkit/chain-selectors v1.0.112 h1:3VO+ttHsqGzPviMmb1AsIT5+rXVgz/Xx6wmvTpamrzE= github.com/smartcontractkit/chain-selectors v1.0.112/go.mod h1:qy7whtgG5g+7z0jt0nRyii9bLND9m15NZTzuQPkMZ5w= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 h1:ElZmfdfQgrYHQBA/nMyQq/zQQEJWTVuEzLtoj0ZKHwI= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3/go.mod h1:yhZCSkRjMDM+02HfmENL0HcaeT/WXmIxUh99TwL5awU= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261028185759-68a28f8f3732 h1:yHsWQnX18N8m24dqELkEb39GKY37TX5m5Sz/ZnqMfVs= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261028185759-68a28f8f3732/go.mod h1:yhZCSkRjMDM+02HfmENL0HcaeT/WXmIxUh99TwL5awU= github.com/smartcontractkit/chainlink-common/keystore v1.3.1-0.20260917115705-1d3a14a9b049 h1:nQ2bw8QQLT+AuCE6JUVIRT1RAo08wQHR9jWh+MgT2GA= github.com/smartcontractkit/chainlink-common/keystore v1.3.1-0.20260917115705-1d3a14a9b049/go.mod h1:FO9igruzwHPXstyb9J9z83sJ19iLSNSIg+0H/n0wlJU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= diff --git a/chain_capabilities/solana/go.mod b/chain_capabilities/solana/go.mod index e68d73ea8..c6b1f6af6 100644 --- a/chain_capabilities/solana/go.mod +++ b/chain_capabilities/solana/go.mod @@ -9,7 +9,7 @@ require ( github.com/smartcontractkit/capabilities/chain_capabilities/common v0.0.0-20261009182120-372f846f528c github.com/smartcontractkit/capabilities/libs v0.0.0-20261001142216-b1dea8dbb961 github.com/smartcontractkit/chain-selectors v1.0.104 - github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 + github.com/smartcontractkit/chainlink-common v0.11.2-0.20261028185759-68a28f8f3732 github.com/smartcontractkit/chainlink-framework/multinode v0.0.0-20260521164805-26d78d5e1243 github.com/smartcontractkit/chainlink-protos/cre/go v0.0.0-20261013212015-e622e8b83b6b github.com/smartcontractkit/chainlink-solana v1.3.1-0.20260917175559-f7d4a86019d4 diff --git a/chain_capabilities/solana/go.sum b/chain_capabilities/solana/go.sum index 6193d86c3..4734a51e3 100644 --- a/chain_capabilities/solana/go.sum +++ b/chain_capabilities/solana/go.sum @@ -634,8 +634,8 @@ github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260310183131-8 github.com/smartcontractkit/chainlink-ccip/chains/solana v0.0.0-20260310183131-8d0f0e383288/go.mod h1:jPHlo/IN2YAArI001JJixmm6ZHQwgnAVJXY8VBFiFTc= github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260310183131-8d0f0e383288 h1:eEjTgIQn4RW0ZPRepUDYTdgGwaRCMawMwgXkHItUc9U= github.com/smartcontractkit/chainlink-ccip/chains/solana/gobindings v0.0.0-20260310183131-8d0f0e383288/go.mod h1:67YbnoglYD61Pz/jTVCgav9wFq7S35OU8UyQSvPllRw= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3 h1:ElZmfdfQgrYHQBA/nMyQq/zQQEJWTVuEzLtoj0ZKHwI= -github.com/smartcontractkit/chainlink-common v0.11.2-0.20261027163245-5d5d0c0d5ac3/go.mod h1:yhZCSkRjMDM+02HfmENL0HcaeT/WXmIxUh99TwL5awU= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261028185759-68a28f8f3732 h1:yHsWQnX18N8m24dqELkEb39GKY37TX5m5Sz/ZnqMfVs= +github.com/smartcontractkit/chainlink-common v0.11.2-0.20261028185759-68a28f8f3732/go.mod h1:yhZCSkRjMDM+02HfmENL0HcaeT/WXmIxUh99TwL5awU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549 h1:J4vYRJxkBO8Yf//17wScKjYWmS45VZaFWx0zt+4ETEU= github.com/smartcontractkit/chainlink-common/pkg/chipingress v0.0.11-0.20261005132539-b7d63d5fd549/go.mod h1:Scyk7O80fde5rJF3Ty3fEE3xiS6j84eWbu8/2gl3pIY= github.com/smartcontractkit/chainlink-common/pkg/monitoring v0.0.0-20251215152504-b1e41f508340 h1:PsjEI+5jZIz9AS4eOsLS5VpSWJINf38clXV3wryPyMk= From 6755d285aceb072720d995803767a7737aef3e6f Mon Sep 17 00:00:00 2001 From: Dylan Tinianov Date: Thu, 29 Oct 2026 13:30:25 -0400 Subject: [PATCH 5/5] gasmeter: perturb delta is a magnitude with a per-event sign Co-Authored-By: Claude Fable 5.1 --- chain_capabilities/common/gasmeter/gasmeter_fault_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/chain_capabilities/common/gasmeter/gasmeter_fault_test.go b/chain_capabilities/common/gasmeter/gasmeter_fault_test.go index 14cdb3a46..d49c60698 100644 --- a/chain_capabilities/common/gasmeter/gasmeter_fault_test.go +++ b/chain_capabilities/common/gasmeter/gasmeter_fault_test.go @@ -29,14 +29,14 @@ func faultSettings(t *testing.T, org string, kv map[string]string) settings.Gett func TestEmit_FaultInjection(t *testing.T) { metadata := capabilities.RequestMetadata{WorkflowID: "wf-1", WorkflowExecutionID: "exec-1", OrgID: "org-1"} - t.Run("perturb subtracts delta from the emitted fee", func(t *testing.T) { + t.Run("perturb applies delta to the emitted fee", func(t *testing.T) { emitter := &recordingEmitter{} cfg := enabledCfg(emitter) - cfg.Settings = faultSettings(t, "org-1", map[string]string{"BillingFaultPerturbRate": "1", "BillingFaultPerturbDelta": "-7"}) + cfg.Settings = faultSettings(t, "org-1", map[string]string{"BillingFaultPerturbRate": "1", "BillingFaultPerturbDelta": "7"}) m := New(logger.Test(t), cfg, 1, 7) m.Emit(t.Context(), metadata, "0xabc", big.NewInt(100)) require.Len(t, emitter.records, 1) - require.Equal(t, "93", emitter.records[0].GetUtilizations()[0].GetValue()) + require.Equal(t, "107", emitter.records[0].GetUtilizations()[0].GetValue(), "sign sample for 0xabc adds") }) t.Run("drop emits nothing", func(t *testing.T) {