From c6fff40c5aa7a485ed64cbeeb0cdacc4ab394658 Mon Sep 17 00:00:00 2001 From: Terry Tata Date: Sat, 5 Sep 2026 12:01:48 -0700 Subject: [PATCH 1/2] fix(indexer): unsigned selector and sequence number in client response models --- indexer/overlay.yaml | 20 ++++++++++++ indexer/pkg/client/internal/client.go | 44 +++++++++++++-------------- 2 files changed, 42 insertions(+), 22 deletions(-) diff --git a/indexer/overlay.yaml b/indexer/overlay.yaml index 5b078e0c1..0a0bf6644 100644 --- a/indexer/overlay.yaml +++ b/indexer/overlay.yaml @@ -44,3 +44,23 @@ actions: - target: "$.paths['/v1/verifierresults'].get.parameters[?(@.name=='offset')].schema" update: x-go-type: uint64 + + # Response models. Selectors are uint64 and a third of the values in chain-selectors exceed + # maxInt64, so the generated int64 cannot represent them at all; sequence numbers are + # non-negative (minimum: 0), which int64 does not carry. The parameter actions above only + # cover the query string; these cover the components.schemas the responses are built from. + - target: "$.components.schemas.Message.properties.source_chain_selector" + update: + x-go-type: protocol.ChainSelector + x-go-type-import: + path: github.com/smartcontractkit/chainlink-ccv/protocol + + - target: "$.components.schemas.Message.properties.dest_chain_selector" + update: + x-go-type: protocol.ChainSelector + x-go-type-import: + path: github.com/smartcontractkit/chainlink-ccv/protocol + + - target: "$.components.schemas.Message.properties.sequence_number" + update: + x-go-type: uint64 diff --git a/indexer/pkg/client/internal/client.go b/indexer/pkg/client/internal/client.go index d2d77aedf..cb549667e 100644 --- a/indexer/pkg/client/internal/client.go +++ b/indexer/pkg/client/internal/client.go @@ -31,28 +31,28 @@ type ErrorResponse struct { // Message defines model for Message. type Message struct { - CcipReceiveGasLimit int32 `json:"ccip_receive_gas_limit"` - CcvAndExecutorHash string `json:"ccv_and_executor_hash"` - Data string `json:"data"` - DataLength int32 `json:"data_length"` - DestBlob string `json:"dest_blob"` - DestBlobLength int32 `json:"dest_blob_length"` - DestChainSelector int64 `json:"dest_chain_selector"` - ExecutionGasLimit int32 `json:"execution_gas_limit"` - Finality int32 `json:"finality"` - OffRampAddress string `json:"off_ramp_address"` - OffRampAddressLength int32 `json:"off_ramp_address_length"` - OnRampAddress string `json:"on_ramp_address"` - OnRampAddressLength int32 `json:"on_ramp_address_length"` - Receiver string `json:"receiver"` - ReceiverLength int32 `json:"receiver_length"` - Sender string `json:"sender"` - SenderLength int32 `json:"sender_length"` - SequenceNumber int64 `json:"sequence_number"` - SourceChainSelector int64 `json:"source_chain_selector"` - TokenTransfer TokenTransfer `json:"token_transfer"` - TokenTransferLength int32 `json:"token_transfer_length"` - Version int32 `json:"version"` + CcipReceiveGasLimit int32 `json:"ccip_receive_gas_limit"` + CcvAndExecutorHash string `json:"ccv_and_executor_hash"` + Data string `json:"data"` + DataLength int32 `json:"data_length"` + DestBlob string `json:"dest_blob"` + DestBlobLength int32 `json:"dest_blob_length"` + DestChainSelector protocol.ChainSelector `json:"dest_chain_selector"` + ExecutionGasLimit int32 `json:"execution_gas_limit"` + Finality int32 `json:"finality"` + OffRampAddress string `json:"off_ramp_address"` + OffRampAddressLength int32 `json:"off_ramp_address_length"` + OnRampAddress string `json:"on_ramp_address"` + OnRampAddressLength int32 `json:"on_ramp_address_length"` + Receiver string `json:"receiver"` + ReceiverLength int32 `json:"receiver_length"` + Sender string `json:"sender"` + SenderLength int32 `json:"sender_length"` + SequenceNumber uint64 `json:"sequence_number"` + SourceChainSelector protocol.ChainSelector `json:"source_chain_selector"` + TokenTransfer TokenTransfer `json:"token_transfer"` + TokenTransferLength int32 `json:"token_transfer_length"` + Version int32 `json:"version"` } // MessageMetadata defines model for MessageMetadata. From 6939112a476a5cdce998decdd210d1ae0f5a65c8 Mon Sep 17 00:00:00 2001 From: Terry Tata Date: Fri, 11 Sep 2026 03:49:53 -0700 Subject: [PATCH 2/2] comments --- indexer/overlay.yaml | 15 ++++++--- indexer/pkg/client/internal/client.go | 44 +++++++++++++-------------- 2 files changed, 32 insertions(+), 27 deletions(-) diff --git a/indexer/overlay.yaml b/indexer/overlay.yaml index 0a0bf6644..c16826e89 100644 --- a/indexer/overlay.yaml +++ b/indexer/overlay.yaml @@ -45,10 +45,13 @@ actions: update: x-go-type: uint64 - # Response models. Selectors are uint64 and a third of the values in chain-selectors exceed - # maxInt64, so the generated int64 cannot represent them at all; sequence numbers are - # non-negative (minimum: 0), which int64 does not carry. The parameter actions above only - # cover the query string; these cover the components.schemas the responses are built from. + # Response models. Both of these fields are uint64 in protocol, and int64 is the wrong Go type + # for them in different ways: 134 of the 400 registered chain selectors are above maxInt64, so + # a selector is a value int64 cannot represent at all, while a sequence number fits but is + # declared minimum: 0 and int64 admits negatives the schema forbids. + # + # The parameter actions above only cover the query string; these cover the + # components.schemas the responses are built from. - target: "$.components.schemas.Message.properties.source_chain_selector" update: x-go-type: protocol.ChainSelector @@ -63,4 +66,6 @@ actions: - target: "$.components.schemas.Message.properties.sequence_number" update: - x-go-type: uint64 + x-go-type: protocol.SequenceNumber + x-go-type-import: + path: github.com/smartcontractkit/chainlink-ccv/protocol diff --git a/indexer/pkg/client/internal/client.go b/indexer/pkg/client/internal/client.go index cb549667e..33bdeeb65 100644 --- a/indexer/pkg/client/internal/client.go +++ b/indexer/pkg/client/internal/client.go @@ -31,28 +31,28 @@ type ErrorResponse struct { // Message defines model for Message. type Message struct { - CcipReceiveGasLimit int32 `json:"ccip_receive_gas_limit"` - CcvAndExecutorHash string `json:"ccv_and_executor_hash"` - Data string `json:"data"` - DataLength int32 `json:"data_length"` - DestBlob string `json:"dest_blob"` - DestBlobLength int32 `json:"dest_blob_length"` - DestChainSelector protocol.ChainSelector `json:"dest_chain_selector"` - ExecutionGasLimit int32 `json:"execution_gas_limit"` - Finality int32 `json:"finality"` - OffRampAddress string `json:"off_ramp_address"` - OffRampAddressLength int32 `json:"off_ramp_address_length"` - OnRampAddress string `json:"on_ramp_address"` - OnRampAddressLength int32 `json:"on_ramp_address_length"` - Receiver string `json:"receiver"` - ReceiverLength int32 `json:"receiver_length"` - Sender string `json:"sender"` - SenderLength int32 `json:"sender_length"` - SequenceNumber uint64 `json:"sequence_number"` - SourceChainSelector protocol.ChainSelector `json:"source_chain_selector"` - TokenTransfer TokenTransfer `json:"token_transfer"` - TokenTransferLength int32 `json:"token_transfer_length"` - Version int32 `json:"version"` + CcipReceiveGasLimit int32 `json:"ccip_receive_gas_limit"` + CcvAndExecutorHash string `json:"ccv_and_executor_hash"` + Data string `json:"data"` + DataLength int32 `json:"data_length"` + DestBlob string `json:"dest_blob"` + DestBlobLength int32 `json:"dest_blob_length"` + DestChainSelector protocol.ChainSelector `json:"dest_chain_selector"` + ExecutionGasLimit int32 `json:"execution_gas_limit"` + Finality int32 `json:"finality"` + OffRampAddress string `json:"off_ramp_address"` + OffRampAddressLength int32 `json:"off_ramp_address_length"` + OnRampAddress string `json:"on_ramp_address"` + OnRampAddressLength int32 `json:"on_ramp_address_length"` + Receiver string `json:"receiver"` + ReceiverLength int32 `json:"receiver_length"` + Sender string `json:"sender"` + SenderLength int32 `json:"sender_length"` + SequenceNumber protocol.SequenceNumber `json:"sequence_number"` + SourceChainSelector protocol.ChainSelector `json:"source_chain_selector"` + TokenTransfer TokenTransfer `json:"token_transfer"` + TokenTransferLength int32 `json:"token_transfer_length"` + Version int32 `json:"version"` } // MessageMetadata defines model for MessageMetadata.