From 029fe6d1ee9b62a7ec0df9c2811504d1ed27b947 Mon Sep 17 00:00:00 2001 From: beer-1 Date: Wed, 23 Oct 2024 15:49:52 +0900 Subject: [PATCH] remove unnecessary slices.Copy --- x/move/client/cli/utils.go | 8 ++++---- x/move/common_test.go | 4 ++-- x/move/keeper/dex_test.go | 4 ++-- x/mstaking/keeper/delegation_test.go | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/x/move/client/cli/utils.go b/x/move/client/cli/utils.go index 304e25f7..9716af3c 100644 --- a/x/move/client/cli/utils.go +++ b/x/move/client/cli/utils.go @@ -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) @@ -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) diff --git a/x/move/common_test.go b/x/move/common_test.go index 6de3d35a..9a0f9e42 100644 --- a/x/move/common_test.go +++ b/x/move/common_test.go @@ -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) diff --git a/x/move/keeper/dex_test.go b/x/move/keeper/dex_test.go index ee969067..caaa0da7 100644 --- a/x/move/keeper/dex_test.go +++ b/x/move/keeper/dex_test.go @@ -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) diff --git a/x/mstaking/keeper/delegation_test.go b/x/mstaking/keeper/delegation_test.go index 11729c2d..56cec4fd 100644 --- a/x/mstaking/keeper/delegation_test.go +++ b/x/mstaking/keeper/delegation_test.go @@ -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)