Skip to content
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

refactor the hex to OperatorID #480

Merged
merged 3 commits into from
Apr 17, 2024
Merged

Conversation

jianoaix
Copy link
Contributor

Why are these changes needed?

Refactor to reduce duplication

Checks

  • I've made sure the lint is passing in this PR.
  • I've made sure the tests are passing. Note that there might be a few flaky tests, in that case, please comment that they are not relevant.
  • Testing Strategy
    • Unit tests
    • Integration tests
    • This PR is not tested :(

@jianoaix jianoaix requested a review from mooselumph April 13, 2024 00:05
Comment on lines 41 to 49
if len(s) != 64 && len(s) != 66 {
return OperatorID(opID), errors.New("operatorID hex string must be 64 or 66 bytes")
}
if len(s) == 66 {
if s[:2] != "0x" {
return OperatorID(opID), errors.New("operatorID hex string with 66 bytes must start with 0x")
}
s = s[2:]
}
Copy link
Contributor

Choose a reason for hiding this comment

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

nit:

s = strings.TrimPrefix(s, "0x")
s = strings.TrimPrefix(s, "0X")
if len(s) != 64 {
  return OperatorID(opID), errors.New(...)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

@jianoaix jianoaix merged commit bba4eec into Layr-Labs:master Apr 17, 2024
5 checks passed
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.

2 participants