-
Notifications
You must be signed in to change notification settings - Fork 28
Parse raw bytes instead of hex over capReg grpc wire for transmitter address #1983
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -245,7 +245,7 @@ func decodeOcr3Config(pbCfg *capabilitiespb.OCR3Config) ocrtypes.ContractConfig | |
| } | ||
| transmitters := make([]ocrtypes.Account, len(pbCfg.Transmitters)) | ||
| for i, t := range pbCfg.Transmitters { | ||
| transmitters[i] = ocrtypes.Account(hex.EncodeToString(t)) | ||
| transmitters[i] = ocrtypes.Account(t) | ||
| } | ||
| return ocrtypes.ContractConfig{ | ||
| ConfigCount: pbCfg.ConfigCount, | ||
|
|
@@ -512,9 +512,11 @@ func (c *capabilitiesRegistryServer) ConfigForCapability(ctx context.Context, re | |
| } | ||
| transmitters := make([][]byte, len(cfg.Transmitters)) | ||
| for i, t := range cfg.Transmitters { | ||
| transmitters[i], err = hex.DecodeString(string(t)) | ||
| if err != nil { | ||
| return nil, fmt.Errorf("failed to decode transmitter: %w", err) | ||
| decoded, hexErr := hex.DecodeString(string(t)) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. From the discussion that we had it sounds like |
||
| if hexErr == nil { | ||
| transmitters[i] = decoded | ||
| } else { | ||
| transmitters[i] = []byte(t) | ||
| } | ||
| } | ||
|
Comment on lines
513
to
521
|
||
| ccp.Ocr3Configs[key] = &capabilitiespb.OCR3Config{ | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This change switches the in-process representation of
ocrtypes.ContractConfig.Transmittersfrom a hex string (previously produced viahex.EncodeToString) to a raw-byte string (ocrtypes.Account(t)wheretis protobuf[]byte). Becauseocrtypes.Accountis a string type, this is a behavioral/API change for any downstream code that expects human-readable/hex transmitter addresses, and mixed-version plugin/core deployments (Hashicorp go-plugin handshake here doesn’t enforce a protocol version) could silently disagree on the encoding. Consider adding a transitional decode that accepts both formats (e.g., if the string is valid hex then decode, otherwise treat as raw bytes), or document/guard the change with an explicit versioned capability/handshake so incompatible components fail fast.