Commit bc765931 authored by refcell's avatar refcell

revert to explicit bigint construction

parent d5ebf81a
...@@ -133,11 +133,11 @@ func (p Position) ToGIndex() *big.Int { ...@@ -133,11 +133,11 @@ func (p Position) ToGIndex() *big.Int {
// bigMSB returns the index of the most significant bit // bigMSB returns the index of the most significant bit
func bigMSB(x *big.Int) int { func bigMSB(x *big.Int) int {
if x.Cmp(new(big.Int)) == 0 { if x.Cmp(big.NewInt(0)) == 0 {
return 0 return 0
} }
out := 0 out := 0
for ; x.Cmp(new(big.Int)) != 0; out++ { for ; x.Cmp(big.NewInt(0)) != 0; out++ {
x = new(big.Int).Rsh(x, 1) x = new(big.Int).Rsh(x, 1)
} }
return out - 1 return out - 1
......
...@@ -4,7 +4,6 @@ import ( ...@@ -4,7 +4,6 @@ import (
"math/big" "math/big"
"testing" "testing"
"github.com/ethereum/go-ethereum/common"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
) )
...@@ -34,7 +33,7 @@ func TestIsRootPosition(t *testing.T) { ...@@ -34,7 +33,7 @@ func TestIsRootPosition(t *testing.T) {
}{ }{
{ {
name: "ZeroRoot", name: "ZeroRoot",
position: NewPositionFromGIndex(common.Big0), position: NewPositionFromGIndex(big.NewInt(0)),
expected: true, expected: true,
}, },
{ {
......
...@@ -38,7 +38,7 @@ const alphabetGameDepth = 4 ...@@ -38,7 +38,7 @@ const alphabetGameDepth = 4
var lastAlphabetTraceIndex = big.NewInt(1<<alphabetGameDepth - 1) var lastAlphabetTraceIndex = big.NewInt(1<<alphabetGameDepth - 1)
// rootPosition is the position of the root claim. // rootPosition is the position of the root claim.
var rootPosition = faultTypes.NewPositionFromGIndex(common.Big1) var rootPosition = faultTypes.NewPositionFromGIndex(big.NewInt(1))
type Status uint8 type Status uint8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment