Skip to content

Commit

Permalink
renaming nits and comments fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abi87 committed Oct 1, 2024
1 parent 320256c commit d342fe5
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 15 deletions.
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/8
nibblesPer256Bits = 64 // 256/8
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

0 comments on commit d342fe5

Please sign in to comment.