|
|
@ -1,9 +1,6 @@ |
|
|
|
package genesis |
|
|
|
package genesis |
|
|
|
|
|
|
|
|
|
|
|
import ( |
|
|
|
import ( |
|
|
|
"bufio" |
|
|
|
|
|
|
|
"fmt" |
|
|
|
|
|
|
|
"os" |
|
|
|
|
|
|
|
"strconv" |
|
|
|
"strconv" |
|
|
|
"strings" |
|
|
|
"strings" |
|
|
|
"testing" |
|
|
|
"testing" |
|
|
@ -11,7 +8,6 @@ import ( |
|
|
|
"github.com/btcsuite/btcutil/bech32" |
|
|
|
"github.com/btcsuite/btcutil/bech32" |
|
|
|
ethCommon "github.com/ethereum/go-ethereum/common" |
|
|
|
ethCommon "github.com/ethereum/go-ethereum/common" |
|
|
|
"github.com/harmony-one/bls/ffi/go/bls" |
|
|
|
"github.com/harmony-one/bls/ffi/go/bls" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/harmony-one/harmony/internal/common" |
|
|
|
"github.com/harmony-one/harmony/internal/common" |
|
|
|
) |
|
|
|
) |
|
|
|
|
|
|
|
|
|
|
@ -19,39 +15,6 @@ func TestString(t *testing.T) { |
|
|
|
_ = BeaconAccountPriKey() |
|
|
|
_ = BeaconAccountPriKey() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func fileToLines(filePath string) (lines []string, err error) { |
|
|
|
|
|
|
|
f, err := os.Open(filePath) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
defer f.Close() |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
scanner := bufio.NewScanner(f) |
|
|
|
|
|
|
|
for scanner.Scan() { |
|
|
|
|
|
|
|
lines = append(lines, scanner.Text()) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
err = scanner.Err() |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func testGenesisccounts(t *testing.T) { |
|
|
|
|
|
|
|
ones, err := fileToLines("one-acc.txt") |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
t.Fatal("ReadFile failed", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
bls, err := fileToLines("bls-pub.txt") |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
|
|
|
|
t.Fatal("ReadFile failed", err) |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
index := 404 |
|
|
|
|
|
|
|
for i, one := range ones { |
|
|
|
|
|
|
|
fmt.Printf(" {Index: \" %v \", Address: \"%v\", BLSPublicKey: \"%v\"},\n", index, one, bls[i]) |
|
|
|
|
|
|
|
index++ |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func TestCommitteeAccounts(test *testing.T) { |
|
|
|
func TestCommitteeAccounts(test *testing.T) { |
|
|
|
testAccounts(test, FoundationalNodeAccounts) |
|
|
|
testAccounts(test, FoundationalNodeAccounts) |
|
|
|
testAccounts(test, FoundationalNodeAccountsV1) |
|
|
|
testAccounts(test, FoundationalNodeAccountsV1) |
|
|
|