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

chore(primitives): renaming nits and comments fixes #2030

Merged
merged 2 commits into from
Oct 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions mod/primitives/pkg/constraints/basic.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type EngineType[SelfT any] interface {
JSONMarshallable
}

// EmptyWithForkVersion is a constraint that requires a type to have an Empty
// EmptyWithVersion is a constraint that requires a type to have an Empty
// method.
type EmptyWithVersion[SelfT any] interface {
Empty(uint32) SelfT
Expand All @@ -47,7 +47,7 @@ type Empty[SelfT any] interface {
Empty() SelfT
}

// IsNil is a constraint that requires a type to have an IsNil method.
// Nillable is a constraint that requires a type to have an IsNil method.
type Nillable interface {
IsNil() bool
}
Expand Down
4 changes: 2 additions & 2 deletions mod/primitives/pkg/encoding/hex/bytes.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func DecodeFixedText(input, out []byte) error {
return nil
}

// MustFromHex returns the bytes represented by the given hex string.
// MustToBytes returns the bytes represented by the given hex string.
// It panics if the input is not a valid hex string.
func MustToBytes(input string) []byte {
bz, err := ToBytes(input)
Expand All @@ -92,7 +92,7 @@ func MustToBytes(input string) []byte {
return bz
}

// FromHex returns the bytes represented by the given hex string.
// ToBytes returns the bytes represented by the given hex string.
// An error is returned if the input is not a valid hex string.
func ToBytes(input string) ([]byte, error) {
s, err := NewStringStrict(input)
Expand Down
18 changes: 9 additions & 9 deletions mod/primitives/pkg/encoding/hex/const.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@
package hex

const (
prefix = "0x"
prefixLen = len(prefix)
badNibble = ^uint64(0)
hexBase = 16
initialCapacity = 10
encDecRatio = 2
bytesPer64Bits = 16 // 64/8
bytesPer256Bits = 64 // 256/8
nibbleShift = 4
prefix = "0x"
prefixLen = len(prefix)
badNibble = ^uint64(0)
hexBase = 16
initialCapacity = 10
encDecRatio = 2
nibblesPer64Bits = 16 // 64/4
nibblesPer256Bits = 64 // 256/4
nibbleShift = 4

// hexadecimal conversion constants.
hexBaseOffset = '0'
Expand Down
2 changes: 1 addition & 1 deletion mod/primitives/pkg/encoding/hex/string.go
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ func (s String) ToBigInt() (*big.Int, error) {
if err != nil {
return nil, err
}
if len(raw) > bytesPer256Bits {
if len(raw) > nibblesPer256Bits {
return nil, ErrBig256Range
}
bigWordNibbles, err := getBigWordNibbles()
Expand Down
2 changes: 1 addition & 1 deletion mod/primitives/pkg/encoding/hex/u64.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func UnmarshalUint64Text(input []byte) (uint64, error) {
if err != nil {
return 0, err
}
if len(raw) > bytesPer64Bits {
if len(raw) > nibblesPer64Bits {
return 0, ErrUint64Range
}
var dec uint64
Expand Down
Loading