Skip to content

[CRE-491] Move PlainHex and Null.Int64 to common#2065

Merged
pavel-raykov merged 3 commits into
mainfrom
move-types2
May 18, 2026
Merged

[CRE-491] Move PlainHex and Null.Int64 to common#2065
pavel-raykov merged 3 commits into
mainfrom
move-types2

Conversation

@pavel-raykov
Copy link
Copy Markdown
Contributor

@pavel-raykov pavel-raykov commented May 18, 2026

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 18, 2026

✅ API Diff Results - github.com/smartcontractkit/chainlink-common

✅ Compatible Changes (4)

pkg/utils/hex (1)
  • PlainHexBytes — ➕ Added
pkg/utils/null (3)
  • Int64 — ➕ Added

  • Int64From — ➕ Added

  • NewInt64 — ➕ Added


📄 View full apidiff report

@pavel-raykov pavel-raykov marked this pull request as ready for review May 18, 2026 10:00
@pavel-raykov pavel-raykov requested a review from a team as a code owner May 18, 2026 10:00
Copilot AI review requested due to automatic review settings May 18, 2026 10:00
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.go providing PlainHexBytes, a hex byte slice that marshals/unmarshals without a 0x prefix.
  • Adds pkg/utils/null/int64.go providing a nullable Int64 with 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 thread pkg/utils/hex/plainhex.go
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 thread pkg/utils/null/int64.go
Comment on lines +77 to +80
func parse64(str string) (int64, error) {
v, err := strconv.ParseInt(str, 10, 64)
return v, err
}
@pavel-raykov pavel-raykov added this pull request to the merge queue May 18, 2026
Merged via the queue into main with commit 9564f35 May 18, 2026
36 of 37 checks passed
@pavel-raykov pavel-raykov deleted the move-types2 branch May 18, 2026 10:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants