conflicts

This commit is contained in:
Federico Kunze
2021-04-17 12:00:07 +02:00
parent 20f9a72908
commit 5a3d514ba0
173 changed files with 19392 additions and 13626 deletions
-47
View File
@@ -1,47 +0,0 @@
package utils
import "math/big"
// MarshalBigInt marshalls big int into text string for consistent encoding
func MarshalBigInt(i *big.Int) (string, error) {
bz, err := i.MarshalText()
if err != nil {
return "", err
}
return string(bz), nil
}
// MustMarshalBigInt marshalls big int into text string for consistent encoding.
// It panics if an error is encountered.
func MustMarshalBigInt(i *big.Int) string {
str, err := MarshalBigInt(i)
if err != nil {
panic(err)
}
return str
}
// UnmarshalBigInt unmarshalls string from *big.Int
func UnmarshalBigInt(s string) (*big.Int, error) {
ret := new(big.Int)
err := ret.UnmarshalText([]byte(s))
if err != nil {
return nil, err
}
return ret, nil
}
// MustUnmarshalBigInt unmarshalls string from *big.Int.
// It panics if an error is encountered.
func MustUnmarshalBigInt(s string) *big.Int {
ret, err := UnmarshalBigInt(s)
if err != nil {
panic(err)
}
return ret
}
-18
View File
@@ -1,18 +0,0 @@
package utils
import (
"math/big"
"testing"
"github.com/stretchr/testify/require"
)
func TestMarshalAndUnmarshalInt(t *testing.T) {
i := big.NewInt(3)
m, err := MarshalBigInt(i)
require.NoError(t, err)
i2, err := UnmarshalBigInt(m)
require.NoError(t, err)
require.Equal(t, i, i2)
}