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

exploratory: dropping hex.String #2045

Closed
wants to merge 32 commits into from
Closed

exploratory: dropping hex.String #2045

wants to merge 32 commits into from

Conversation

abi87
Copy link
Contributor

@abi87 abi87 commented Oct 5, 2024

WIP, working on defining the wanted end state, will break this into smaller PR as soon as I have done.

@abi87 abi87 self-assigned this Oct 5, 2024
Copy link
Contributor

coderabbitai bot commented Oct 5, 2024

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

codecov bot commented Oct 5, 2024

Codecov Report

Attention: Patch coverage is 75.96899% with 31 lines in your changes missing coverage. Please review.

Project coverage is 21.79%. Comparing base (8de0789) to head (caca212).
Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
mod/primitives/pkg/encoding/hex/big_int.go 63.88% 9 Missing and 4 partials ⚠️
mod/primitives/pkg/encoding/hex/validation.go 60.00% 7 Missing and 5 partials ⚠️
mod/primitives/pkg/common/execution.go 0.00% 3 Missing ⚠️
mod/primitives/pkg/bytes/b256.go 0.00% 1 Missing ⚠️
mod/primitives/pkg/common/consensus.go 0.00% 1 Missing ⚠️
mod/primitives/pkg/encoding/hex/bytes.go 83.33% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #2045      +/-   ##
==========================================
- Coverage   22.10%   21.79%   -0.31%     
==========================================
  Files         357      357              
  Lines       15972    15891      -81     
  Branches       12       12              
==========================================
- Hits         3530     3463      -67     
+ Misses      12295    12279      -16     
- Partials      147      149       +2     
Files with missing lines Coverage Δ
mod/primitives/pkg/bytes/b.go 100.00% <100.00%> (ø)
mod/primitives/pkg/bytes/b20.go 100.00% <100.00%> (ø)
mod/primitives/pkg/bytes/b32.go 100.00% <100.00%> (ø)
mod/primitives/pkg/bytes/b4.go 71.42% <100.00%> (ø)
mod/primitives/pkg/bytes/b48.go 100.00% <100.00%> (ø)
mod/primitives/pkg/bytes/b8.go 100.00% <100.00%> (ø)
mod/primitives/pkg/bytes/b96.go 100.00% <100.00%> (ø)
mod/primitives/pkg/encoding/hex/fixed-length.go 100.00% <100.00%> (ø)
mod/primitives/pkg/encoding/hex/u64.go 86.36% <100.00%> (-2.53%) ⬇️
mod/primitives/pkg/math/u64.go 100.00% <100.00%> (ø)
... and 8 more

Base automatically changed from hex-string-cleanup to main October 5, 2024 14:43
@abi87 abi87 changed the title chore(primitives): hex.String some more cleanup chore(primitives): dropping hex.String Oct 6, 2024
}

func UnmarshalByteText(input []byte) ([]byte, error) {
Copy link
Contributor Author

@abi87 abi87 Oct 6, 2024

Choose a reason for hiding this comment

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

replaced by ToBytes since:

  1. formatAndValidateText is equivalent to IsValidHex for every current call:
  • inputs are never zero-lenght
  • The check on lenght being even is implicitly done by DecodeString
  1. hex.Decode behaviour with dec := make([]byte, len(raw)/encDecRatio) matches hex.DecodeString(

Comment on lines +80 to +81
if len(input)%2 != 0 {
return nil, ErrOddLength
Copy link
Contributor Author

Choose a reason for hiding this comment

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

q: shouldn't this be part of ValidateBasicHex but some UTs currently fail

@abi87 abi87 changed the title chore(primitives): dropping hex.String exploratory: dropping hex.String Oct 7, 2024
@abi87
Copy link
Contributor Author

abi87 commented Oct 7, 2024

Replaced by #2048

@abi87 abi87 closed this Oct 7, 2024
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.

1 participant