diff --git a/common/math/big.go b/common/math/big.go index 78e3c8255d..203642565c 100644 --- a/common/math/big.go +++ b/common/math/big.go @@ -71,7 +71,7 @@ func (i *HexOrDecimal256) MarshalText() ([]byte, error) { if i == nil { return []byte("0x0"), nil } - return []byte(fmt.Sprintf("%#x", (*big.Int)(i))), nil + return fmt.Appendf(nil, "%#x", (*big.Int)(i)), nil } // ParseBig256 parses s as a 256 bit integer in decimal or hexadecimal syntax. diff --git a/common/math/integer.go b/common/math/integer.go index 25ced87053..dfcb0aecc4 100644 --- a/common/math/integer.go +++ b/common/math/integer.go @@ -48,7 +48,7 @@ func (i *HexOrDecimal64) UnmarshalText(input []byte) error { // MarshalText implements encoding.TextMarshaler. func (i HexOrDecimal64) MarshalText() ([]byte, error) { - return []byte(fmt.Sprintf("%#x", uint64(i))), nil + return fmt.Appendf(nil, "%#x", uint64(i)), nil } // ParseUint64 parses s as an integer in decimal or hexadecimal syntax. diff --git a/contracts/utils.go b/contracts/utils.go index 2d65fe2217..75c37e59e5 100644 --- a/contracts/utils.go +++ b/contracts/utils.go @@ -279,7 +279,7 @@ func BuildValidatorFromM2(listM2 []int64) []byte { var validatorBytes []byte for _, numberM2 := range listM2 { // Convert number to byte. - m2Byte := common.LeftPadBytes([]byte(fmt.Sprintf("%d", numberM2)), utils.M2ByteLength) + m2Byte := common.LeftPadBytes(fmt.Appendf(nil, "%d", numberM2), utils.M2ByteLength) validatorBytes = append(validatorBytes, m2Byte...) }