Skip to content

Commit

Permalink
remove unnecessary slices.Copy
Browse files Browse the repository at this point in the history
  • Loading branch information
beer-1 committed Oct 23, 2024
1 parent 0ba222a commit 029fe6d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions x/move/client/cli/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,8 @@ func bcsSerializeArg(argType string, arg string, s serde.Serializer, ac address.
return nil, fmt.Errorf("failed to parse %q as biguint", err)
}

// convert to little endian
bz := slices.Clone(n.BigInt().Bytes())
// convert to little endian (bytes are cloned)
bz := n.BigInt().Bytes()
slices.Reverse(bz)

err = s.SerializeBytes(bz)
Expand All @@ -216,8 +216,8 @@ func bcsSerializeArg(argType string, arg string, s serde.Serializer, ac address.
return nil, err
}

// convert to little endian
bz := slices.Clone(dec.BigInt().Bytes())
// convert to little endian (bytes are cloned)
bz := dec.BigInt().Bytes()
slices.Reverse(bz)

err = s.SerializeBytes(bz)
Expand Down
4 changes: 2 additions & 2 deletions x/move/common_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,8 @@ func executeMsgs(t *testing.T, app *initiaapp.InitiaApp, msgs []sdk.Msg, account
}

func decToVmArgument(t *testing.T, val math.LegacyDec) []byte {
// big-endian bytes
bz := slices.Clone(val.BigInt().Bytes())
// big-endian bytes (bytes are cloned)
bz := val.BigInt().Bytes()

// reverse bytes to little-endian
slices.Reverse(bz)
Expand Down
4 changes: 2 additions & 2 deletions x/move/keeper/dex_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ import (
)

func decToVmArgument(t *testing.T, val math.LegacyDec) []byte {
// big-endian bytes
bz := slices.Clone(val.BigInt().Bytes())
// big-endian bytes (bytes are cloned)
bz := val.BigInt().Bytes()

// reverse bytes to little-endian
slices.Reverse(bz)
Expand Down
4 changes: 2 additions & 2 deletions x/mstaking/keeper/delegation_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import (
)

func decToVmArgument(t *testing.T, val math.LegacyDec) []byte {
// big-endian bytes
bz := slices.Clone(val.BigInt().Bytes())
// big-endian bytes (bytes are cloned)
bz := val.BigInt().Bytes()

// reverse bytes to little-endian
slices.Reverse(bz)
Expand Down

0 comments on commit 029fe6d

Please sign in to comment.