[CRE-491] Move PlainHex and Null.Int64 to common#2065
Merged
Conversation
✅ API Diff Results -
|
george-dorin
approved these changes
May 18, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Moves the PlainHexBytes hex type and the null.Int64 type (with their tests) into chainlink-common so they can be shared, supporting smartcontractkit/chainlink#22510.
Changes:
- Adds
pkg/utils/hex/plainhex.goprovidingPlainHexBytes, a hex byte slice that marshals/unmarshals without a0xprefix. - Adds
pkg/utils/null/int64.goproviding a nullableInt64with JSON/text/SQL (de)serialization. - Adds corresponding unit tests for both types.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| pkg/utils/hex/plainhex.go | New PlainHexBytes type with JSON/text (un)marshalers and a String() method. |
| pkg/utils/hex/plainhex_test.go | Marshal/unmarshal tests covering valid and invalid hex inputs. |
| pkg/utils/null/int64.go | New nullable Int64 with JSON/text marshalers and SQL Scan/Value. |
| pkg/utils/null/int64_test.go | Tests for construction, (un)marshaling, SetValid, and Scan overflow behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+58
to
+66
| func checkText(input []byte, wantPrefix bool) ([]byte, error) { | ||
| if len(input) == 0 { | ||
| return nil, nil // empty strings are allowed | ||
| } | ||
| if len(input)%2 != 0 { | ||
| return nil, errors.New("odd length") | ||
| } | ||
| return input, nil | ||
| } |
Comment on lines
+77
to
+80
| func parse64(str string) (int64, error) { | ||
| v, err := strconv.ParseInt(str, 10, 64) | ||
| return v, err | ||
| } |
Atrax1
approved these changes
May 18, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Supports smartcontractkit/chainlink#22510