From d6cb2fed902937dd49be9476c61a3a721566fb55 Mon Sep 17 00:00:00 2001 From: yashnevatia Date: Tue, 24 Nov 2026 14:49:39 +0000 Subject: [PATCH] Add forwarderGasOverheadMargin to evm spec --- deployment/cre/jobs/propose_evm_cap.go | 5 ++++- deployment/cre/jobs/propose_evm_cap_test.go | 11 +++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/deployment/cre/jobs/propose_evm_cap.go b/deployment/cre/jobs/propose_evm_cap.go index 266e804db6b..0caba0bb2c6 100644 --- a/deployment/cre/jobs/propose_evm_cap.go +++ b/deployment/cre/jobs/propose_evm_cap.go @@ -37,7 +37,10 @@ type OverrideDefaultCfg struct { DeltaStage time.Duration `json:"deltaStage" yaml:"deltaStage,omitempty"` // ReceiverGasMinimum is the minimum amount of gas that the receiver contract must get to process the forwarder report. // This is the default value used when the user doesn't specify a gas limit when invoking WriteReport. - ReceiverGasMinimum uint64 `json:"receiverGasMinimum,omitempty" yaml:"receiverGasMinimum,omitempty"` + ReceiverGasMinimum uint64 `json:"receiverGasMinimum,omitempty" yaml:"receiverGasMinimum,omitempty"` + // ForwarderGasOverheadMargin is the safety margin, on top of the forwarder's internal gas reservation, + // used to estimate the receiver gas budget from the transmission gas limit. 0 uses the capability default. + ForwarderGasOverheadMargin uint64 `json:"forwarderGasOverheadMargin,omitempty" yaml:"forwarderGasOverheadMargin,omitempty"` NodeAddress string `json:"nodeAddress,omitempty" yaml:"nodeAddress,omitempty"` ObservationPollerWorkersCount uint `json:"observationPollerWorkersCount,omitempty" yaml:"observationPollerWorkersCount,omitempty"` ObservationPollPeriod time.Duration `json:"observationPollPeriod,omitempty" yaml:"observationPollPeriod,omitempty"` diff --git a/deployment/cre/jobs/propose_evm_cap_test.go b/deployment/cre/jobs/propose_evm_cap_test.go index fab95917f0f..29842d8008d 100644 --- a/deployment/cre/jobs/propose_evm_cap_test.go +++ b/deployment/cre/jobs/propose_evm_cap_test.go @@ -1,6 +1,7 @@ package jobs_test import ( + "encoding/json" "fmt" "strconv" "strings" @@ -535,3 +536,13 @@ func TestProposeStandardCapabilityJob_ReusesUUIDWithLegacyNameFormat(t *testing. } assert.True(t, hasLegacyFormat, "should find job with legacy name format (evm-capabilities-v2) when UUIDs are reused") } + +func TestOverrideDefaultCfg_ForwarderGasOverheadMargin_JSON(t *testing.T) { + enc, err := json.Marshal(jobs.OverrideDefaultCfg{ForwarderGasOverheadMargin: 150_000}) + require.NoError(t, err) + assert.Contains(t, string(enc), `"forwarderGasOverheadMargin":150000`) + + enc, err = json.Marshal(jobs.OverrideDefaultCfg{}) + require.NoError(t, err) + assert.NotContains(t, string(enc), "forwarderGasOverheadMargin", "zero must be omitted so the capability default applies") +}