From e00cf58f6c2460bc4cd4a3a141eaedc2c03efa10 Mon Sep 17 00:00:00 2001 From: Matthew Pendrey Date: Wed, 4 Feb 2026 17:12:56 +0000 Subject: [PATCH] add registration timeout to remote trigger config --- pkg/capabilities/capabilities.go | 35 ++++---- pkg/capabilities/pb/registry.pb.go | 82 +++++++++++-------- pkg/capabilities/pb/registry.proto | 1 + .../capability/capabilities_registry.go | 27 +++--- 4 files changed, 83 insertions(+), 62 deletions(-) diff --git a/pkg/capabilities/capabilities.go b/pkg/capabilities/capabilities.go index 15e2bf135..9a2b28a40 100644 --- a/pkg/capabilities/capabilities.go +++ b/pkg/capabilities/capabilities.go @@ -9,10 +9,11 @@ import ( "strings" "time" - p2ptypes "github.com/smartcontractkit/libocr/ragep2p/types" "google.golang.org/protobuf/proto" "google.golang.org/protobuf/types/known/anypb" + p2ptypes "github.com/smartcontractkit/libocr/ragep2p/types" + "github.com/smartcontractkit/chainlink-protos/cre/go/values" ocrtypes "github.com/smartcontractkit/libocr/offchainreporting2plus/types" @@ -554,22 +555,24 @@ func MustNewRemoteCapabilityInfo( } const ( - DefaultRegistrationRefresh = 30 * time.Second - DefaultRegistrationExpiry = 2 * time.Minute - DefaultMessageExpiry = 2 * time.Minute - DefaultBatchSize = 100 - DefaultBatchCollectionPeriod = 100 * time.Millisecond - DefaultExecutableRequestTimeout = 8 * time.Minute - DefaultServerMaxParallelRequests = uint32(1000) + DefaultRegistrationRefresh = 30 * time.Second + DefaultRegistrationExpiry = 2 * time.Minute + DefaultMessageExpiry = 2 * time.Minute + DefaultBatchSize = 100 + DefaultBatchCollectionPeriod = 100 * time.Millisecond + DefaultExecutableRequestTimeout = 8 * time.Minute + DefaultServerMaxParallelRequests = uint32(1000) + DefaultRegistrationStatusUpdateTimeout = 0 ) type RemoteTriggerConfig struct { - RegistrationRefresh time.Duration - RegistrationExpiry time.Duration - MinResponsesToAggregate uint32 - MessageExpiry time.Duration - MaxBatchSize uint32 - BatchCollectionPeriod time.Duration + RegistrationRefresh time.Duration + RegistrationExpiry time.Duration + MinResponsesToAggregate uint32 + MessageExpiry time.Duration + MaxBatchSize uint32 + BatchCollectionPeriod time.Duration + RegistrationStatusUpdateTimeout time.Duration } type RemoteTargetConfig struct { // deprecated - v1 only @@ -608,6 +611,10 @@ func (c *RemoteTriggerConfig) ApplyDefaults() { if c.BatchCollectionPeriod == 0 { c.BatchCollectionPeriod = DefaultBatchCollectionPeriod } + + if c.RegistrationStatusUpdateTimeout == 0 { + c.RegistrationStatusUpdateTimeout = DefaultRegistrationStatusUpdateTimeout + } } func (c *RemoteExecutableConfig) ApplyDefaults() { diff --git a/pkg/capabilities/pb/registry.pb.go b/pkg/capabilities/pb/registry.pb.go index 2b395859d..44894789e 100644 --- a/pkg/capabilities/pb/registry.pb.go +++ b/pkg/capabilities/pb/registry.pb.go @@ -162,15 +162,16 @@ func (AggregatorType) EnumDescriptor() ([]byte, []int) { } type RemoteTriggerConfig struct { - state protoimpl.MessageState `protogen:"open.v1"` - RegistrationRefresh *durationpb.Duration `protobuf:"bytes,1,opt,name=registrationRefresh,proto3" json:"registrationRefresh,omitempty"` - RegistrationExpiry *durationpb.Duration `protobuf:"bytes,2,opt,name=registrationExpiry,proto3" json:"registrationExpiry,omitempty"` - MinResponsesToAggregate uint32 `protobuf:"varint,3,opt,name=minResponsesToAggregate,proto3" json:"minResponsesToAggregate,omitempty"` - MessageExpiry *durationpb.Duration `protobuf:"bytes,4,opt,name=messageExpiry,proto3" json:"messageExpiry,omitempty"` - MaxBatchSize uint32 `protobuf:"varint,5,opt,name=maxBatchSize,proto3" json:"maxBatchSize,omitempty"` - BatchCollectionPeriod *durationpb.Duration `protobuf:"bytes,6,opt,name=batchCollectionPeriod,proto3" json:"batchCollectionPeriod,omitempty"` - unknownFields protoimpl.UnknownFields - sizeCache protoimpl.SizeCache + state protoimpl.MessageState `protogen:"open.v1"` + RegistrationRefresh *durationpb.Duration `protobuf:"bytes,1,opt,name=registrationRefresh,proto3" json:"registrationRefresh,omitempty"` + RegistrationExpiry *durationpb.Duration `protobuf:"bytes,2,opt,name=registrationExpiry,proto3" json:"registrationExpiry,omitempty"` + MinResponsesToAggregate uint32 `protobuf:"varint,3,opt,name=minResponsesToAggregate,proto3" json:"minResponsesToAggregate,omitempty"` + MessageExpiry *durationpb.Duration `protobuf:"bytes,4,opt,name=messageExpiry,proto3" json:"messageExpiry,omitempty"` + MaxBatchSize uint32 `protobuf:"varint,5,opt,name=maxBatchSize,proto3" json:"maxBatchSize,omitempty"` + BatchCollectionPeriod *durationpb.Duration `protobuf:"bytes,6,opt,name=batchCollectionPeriod,proto3" json:"batchCollectionPeriod,omitempty"` + RegistrationStatusUpdateTimeout *durationpb.Duration `protobuf:"bytes,7,opt,name=registrationStatusUpdateTimeout,proto3" json:"registrationStatusUpdateTimeout,omitempty"` + unknownFields protoimpl.UnknownFields + sizeCache protoimpl.SizeCache } func (x *RemoteTriggerConfig) Reset() { @@ -245,6 +246,13 @@ func (x *RemoteTriggerConfig) GetBatchCollectionPeriod() *durationpb.Duration { return nil } +func (x *RemoteTriggerConfig) GetRegistrationStatusUpdateTimeout() *durationpb.Duration { + if x != nil { + return x.RegistrationStatusUpdateTimeout + } + return nil +} + // deprecated - v1 only type RemoteTargetConfig struct { state protoimpl.MessageState `protogen:"open.v1"` @@ -788,14 +796,15 @@ var File_registry_proto protoreflect.FileDescriptor const file_registry_proto_rawDesc = "" + "\n" + - "\x0eregistry.proto\x12\x04loop\x1a\x16values/v1/values.proto\x1a\x1egoogle/protobuf/duration.proto\"\x9d\x03\n" + + "\x0eregistry.proto\x12\x04loop\x1a\x16values/v1/values.proto\x1a\x1egoogle/protobuf/duration.proto\"\x82\x04\n" + "\x13RemoteTriggerConfig\x12K\n" + "\x13registrationRefresh\x18\x01 \x01(\v2\x19.google.protobuf.DurationR\x13registrationRefresh\x12I\n" + "\x12registrationExpiry\x18\x02 \x01(\v2\x19.google.protobuf.DurationR\x12registrationExpiry\x128\n" + "\x17minResponsesToAggregate\x18\x03 \x01(\rR\x17minResponsesToAggregate\x12?\n" + "\rmessageExpiry\x18\x04 \x01(\v2\x19.google.protobuf.DurationR\rmessageExpiry\x12\"\n" + "\fmaxBatchSize\x18\x05 \x01(\rR\fmaxBatchSize\x12O\n" + - "\x15batchCollectionPeriod\x18\x06 \x01(\v2\x19.google.protobuf.DurationR\x15batchCollectionPeriod\"Z\n" + + "\x15batchCollectionPeriod\x18\x06 \x01(\v2\x19.google.protobuf.DurationR\x15batchCollectionPeriod\x12c\n" + + "\x1fregistrationStatusUpdateTimeout\x18\a \x01(\v2\x19.google.protobuf.DurationR\x1fregistrationStatusUpdateTimeout\"Z\n" + "\x12RemoteTargetConfig\x12D\n" + "\x1drequestHashExcludedAttributes\x18\x01 \x03(\tR\x1drequestHashExcludedAttributes\"\xc5\x03\n" + "\x16RemoteExecutableConfig\x12D\n" + @@ -895,31 +904,32 @@ var file_registry_proto_depIdxs = []int32{ 13, // 1: loop.RemoteTriggerConfig.registrationExpiry:type_name -> google.protobuf.Duration 13, // 2: loop.RemoteTriggerConfig.messageExpiry:type_name -> google.protobuf.Duration 13, // 3: loop.RemoteTriggerConfig.batchCollectionPeriod:type_name -> google.protobuf.Duration - 0, // 4: loop.RemoteExecutableConfig.transmission_schedule:type_name -> loop.TransmissionSchedule - 13, // 5: loop.RemoteExecutableConfig.delta_stage:type_name -> google.protobuf.Duration - 13, // 6: loop.RemoteExecutableConfig.request_timeout:type_name -> google.protobuf.Duration - 1, // 7: loop.RemoteExecutableConfig.request_hasher_type:type_name -> loop.RequestHasherType - 2, // 8: loop.AggregatorConfig.aggregator_type:type_name -> loop.AggregatorType - 3, // 9: loop.CapabilityMethodConfig.remote_trigger_config:type_name -> loop.RemoteTriggerConfig - 5, // 10: loop.CapabilityMethodConfig.remote_executable_config:type_name -> loop.RemoteExecutableConfig - 6, // 11: loop.CapabilityMethodConfig.aggregator_config:type_name -> loop.AggregatorConfig - 14, // 12: loop.CapabilityConfig.default_config:type_name -> values.v1.Map - 3, // 13: loop.CapabilityConfig.remote_trigger_config:type_name -> loop.RemoteTriggerConfig - 4, // 14: loop.CapabilityConfig.remote_target_config:type_name -> loop.RemoteTargetConfig - 5, // 15: loop.CapabilityConfig.remote_executable_config:type_name -> loop.RemoteExecutableConfig - 14, // 16: loop.CapabilityConfig.restricted_config:type_name -> values.v1.Map - 10, // 17: loop.CapabilityConfig.method_configs:type_name -> loop.CapabilityConfig.MethodConfigsEntry - 11, // 18: loop.CapabilityConfig.ocr3_configs:type_name -> loop.CapabilityConfig.Ocr3ConfigsEntry - 12, // 19: loop.CapabilityConfig.oracle_factory_configs:type_name -> loop.CapabilityConfig.OracleFactoryConfigsEntry - 14, // 20: loop.CapabilityConfig.spec_config:type_name -> values.v1.Map - 7, // 21: loop.CapabilityConfig.MethodConfigsEntry.value:type_name -> loop.CapabilityMethodConfig - 8, // 22: loop.CapabilityConfig.Ocr3ConfigsEntry.value:type_name -> loop.OCR3Config - 14, // 23: loop.CapabilityConfig.OracleFactoryConfigsEntry.value:type_name -> values.v1.Map - 24, // [24:24] is the sub-list for method output_type - 24, // [24:24] is the sub-list for method input_type - 24, // [24:24] is the sub-list for extension type_name - 24, // [24:24] is the sub-list for extension extendee - 0, // [0:24] is the sub-list for field type_name + 13, // 4: loop.RemoteTriggerConfig.registrationStatusUpdateTimeout:type_name -> google.protobuf.Duration + 0, // 5: loop.RemoteExecutableConfig.transmission_schedule:type_name -> loop.TransmissionSchedule + 13, // 6: loop.RemoteExecutableConfig.delta_stage:type_name -> google.protobuf.Duration + 13, // 7: loop.RemoteExecutableConfig.request_timeout:type_name -> google.protobuf.Duration + 1, // 8: loop.RemoteExecutableConfig.request_hasher_type:type_name -> loop.RequestHasherType + 2, // 9: loop.AggregatorConfig.aggregator_type:type_name -> loop.AggregatorType + 3, // 10: loop.CapabilityMethodConfig.remote_trigger_config:type_name -> loop.RemoteTriggerConfig + 5, // 11: loop.CapabilityMethodConfig.remote_executable_config:type_name -> loop.RemoteExecutableConfig + 6, // 12: loop.CapabilityMethodConfig.aggregator_config:type_name -> loop.AggregatorConfig + 14, // 13: loop.CapabilityConfig.default_config:type_name -> values.v1.Map + 3, // 14: loop.CapabilityConfig.remote_trigger_config:type_name -> loop.RemoteTriggerConfig + 4, // 15: loop.CapabilityConfig.remote_target_config:type_name -> loop.RemoteTargetConfig + 5, // 16: loop.CapabilityConfig.remote_executable_config:type_name -> loop.RemoteExecutableConfig + 14, // 17: loop.CapabilityConfig.restricted_config:type_name -> values.v1.Map + 10, // 18: loop.CapabilityConfig.method_configs:type_name -> loop.CapabilityConfig.MethodConfigsEntry + 11, // 19: loop.CapabilityConfig.ocr3_configs:type_name -> loop.CapabilityConfig.Ocr3ConfigsEntry + 12, // 20: loop.CapabilityConfig.oracle_factory_configs:type_name -> loop.CapabilityConfig.OracleFactoryConfigsEntry + 14, // 21: loop.CapabilityConfig.spec_config:type_name -> values.v1.Map + 7, // 22: loop.CapabilityConfig.MethodConfigsEntry.value:type_name -> loop.CapabilityMethodConfig + 8, // 23: loop.CapabilityConfig.Ocr3ConfigsEntry.value:type_name -> loop.OCR3Config + 14, // 24: loop.CapabilityConfig.OracleFactoryConfigsEntry.value:type_name -> values.v1.Map + 25, // [25:25] is the sub-list for method output_type + 25, // [25:25] is the sub-list for method input_type + 25, // [25:25] is the sub-list for extension type_name + 25, // [25:25] is the sub-list for extension extendee + 0, // [0:25] is the sub-list for field type_name } func init() { file_registry_proto_init() } diff --git a/pkg/capabilities/pb/registry.proto b/pkg/capabilities/pb/registry.proto index fdd6d834b..b4d226886 100644 --- a/pkg/capabilities/pb/registry.proto +++ b/pkg/capabilities/pb/registry.proto @@ -14,6 +14,7 @@ message RemoteTriggerConfig { google.protobuf.Duration messageExpiry = 4; uint32 maxBatchSize = 5; google.protobuf.Duration batchCollectionPeriod = 6; + google.protobuf.Duration registrationStatusUpdateTimeout = 7; } // deprecated - v1 only diff --git a/pkg/loop/internal/core/services/capability/capabilities_registry.go b/pkg/loop/internal/core/services/capability/capabilities_registry.go index b398ea8c9..b7a6860e6 100644 --- a/pkg/loop/internal/core/services/capability/capabilities_registry.go +++ b/pkg/loop/internal/core/services/capability/capabilities_registry.go @@ -224,6 +224,7 @@ func decodeRemoteTriggerConfig(prtc *capabilitiespb.RemoteTriggerConfig) *capabi remoteTriggerConfig.MessageExpiry = prtc.MessageExpiry.AsDuration() remoteTriggerConfig.MaxBatchSize = prtc.MaxBatchSize remoteTriggerConfig.BatchCollectionPeriod = prtc.BatchCollectionPeriod.AsDuration() + remoteTriggerConfig.RegistrationStatusUpdateTimeout = prtc.RegistrationStatusUpdateTimeout.AsDuration() return remoteTriggerConfig } @@ -424,12 +425,13 @@ func (c *capabilitiesRegistryServer) ConfigForCapability(ctx context.Context, re if cc.RemoteTriggerConfig != nil { ccp.RemoteConfig = &capabilitiespb.CapabilityConfig_RemoteTriggerConfig{ RemoteTriggerConfig: &capabilitiespb.RemoteTriggerConfig{ - RegistrationRefresh: durationpb.New(cc.RemoteTriggerConfig.RegistrationRefresh), - RegistrationExpiry: durationpb.New(cc.RemoteTriggerConfig.RegistrationExpiry), - MinResponsesToAggregate: cc.RemoteTriggerConfig.MinResponsesToAggregate, - MessageExpiry: durationpb.New(cc.RemoteTriggerConfig.MessageExpiry), - MaxBatchSize: cc.RemoteTriggerConfig.MaxBatchSize, - BatchCollectionPeriod: durationpb.New(cc.RemoteTriggerConfig.BatchCollectionPeriod), + RegistrationRefresh: durationpb.New(cc.RemoteTriggerConfig.RegistrationRefresh), + RegistrationExpiry: durationpb.New(cc.RemoteTriggerConfig.RegistrationExpiry), + MinResponsesToAggregate: cc.RemoteTriggerConfig.MinResponsesToAggregate, + MessageExpiry: durationpb.New(cc.RemoteTriggerConfig.MessageExpiry), + MaxBatchSize: cc.RemoteTriggerConfig.MaxBatchSize, + BatchCollectionPeriod: durationpb.New(cc.RemoteTriggerConfig.BatchCollectionPeriod), + RegistrationStatusUpdateTimeout: durationpb.New(cc.RemoteTriggerConfig.RegistrationStatusUpdateTimeout), }, } } @@ -465,12 +467,13 @@ func (c *capabilitiesRegistryServer) ConfigForCapability(ctx context.Context, re if mConfig.RemoteTriggerConfig != nil { pbMethodConfig.RemoteConfig = &capabilitiespb.CapabilityMethodConfig_RemoteTriggerConfig{ RemoteTriggerConfig: &capabilitiespb.RemoteTriggerConfig{ - RegistrationRefresh: durationpb.New(mConfig.RemoteTriggerConfig.RegistrationRefresh), - RegistrationExpiry: durationpb.New(mConfig.RemoteTriggerConfig.RegistrationExpiry), - MinResponsesToAggregate: mConfig.RemoteTriggerConfig.MinResponsesToAggregate, - MessageExpiry: durationpb.New(mConfig.RemoteTriggerConfig.MessageExpiry), - MaxBatchSize: mConfig.RemoteTriggerConfig.MaxBatchSize, - BatchCollectionPeriod: durationpb.New(mConfig.RemoteTriggerConfig.BatchCollectionPeriod), + RegistrationRefresh: durationpb.New(mConfig.RemoteTriggerConfig.RegistrationRefresh), + RegistrationExpiry: durationpb.New(mConfig.RemoteTriggerConfig.RegistrationExpiry), + MinResponsesToAggregate: mConfig.RemoteTriggerConfig.MinResponsesToAggregate, + MessageExpiry: durationpb.New(mConfig.RemoteTriggerConfig.MessageExpiry), + MaxBatchSize: mConfig.RemoteTriggerConfig.MaxBatchSize, + BatchCollectionPeriod: durationpb.New(mConfig.RemoteTriggerConfig.BatchCollectionPeriod), + RegistrationStatusUpdateTimeout: durationpb.New(mConfig.RemoteTriggerConfig.RegistrationStatusUpdateTimeout), }, } }