github.com/annchain/OG@v0.0.9/consensus/dkg/archive/config_test.go (about)

     1  //// Copyright © 2019 Annchain Authors <EMAIL ADDRESS>
     2  ////
     3  //// Licensed under the Apache License, Version 2.0 (the "License");
     4  //// you may not use this file except in compliance with the License.
     5  //// You may obtain a copy of the License at
     6  ////
     7  ////     http://www.apache.org/licenses/LICENSE-2.0
     8  ////
     9  //// Unless required by applicable law or agreed to in writing, software
    10  //// distributed under the License is distributed on an "AS IS" BASIS,
    11  //// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  //// See the License for the specific language governing permissions and
    13  //// limitations under the License.
    14  package archive
    15  //
    16  //import (
    17  //	"fmt"
    18  //	"github.com/annchain/kyber/v3"
    19  //	"github.com/annchain/kyber/v3/pairing/bn256"
    20  //	"github.com/annchain/kyber/v3/share"
    21  //	"reflect"
    22  //
    23  //	"github.com/annchain/kyber/v3/share/dkg/pedersen"
    24  //	"testing"
    25  //)
    26  //
    27  //func genScaler(p *bn256.Suite) kyber.Scalar {
    28  //	return p.Scalar().Pick(p.RandomStream())
    29  //
    30  //}
    31  //
    32  //func genPoint(p *bn256.Suite) kyber.Point {
    33  //	return p.Point().Mul(p.Scalar().Pick(p.RandomStream()), nil)
    34  //}
    35  //
    36  //func TestAnnSensus_SaveConsensusData(t *testing.T) {
    37  //	logInit()
    38  //	d := NewDkgPartner(true, 21, 15, nil, nil, nil, nil)
    39  //	d.ConfigFilePath = "test.json"
    40  //	d.GenerateDkg()
    41  //	suite := bn256.NewSuiteG2()
    42  //	fmt.Println(reflect.TypeOf(genScaler(suite)))
    43  //	var points []kyber.Point
    44  //	points = append(points, genPoint(suite), genPoint(suite))
    45  //	var scalars []kyber.Scalar
    46  //	scalars = append(scalars, genScaler(suite), genScaler(suite), genScaler(suite))
    47  //	d.context.KeyShare = &dkg.DistKeyShare{
    48  //		Commits: points,
    49  //		Share: &share.PriShare{
    50  //			I: 3,
    51  //			V: bn256.NewSuiteG2().Scalar(),
    52  //		},
    53  //		PrivatePoly: scalars,
    54  //	}
    55  //	d.context.JointPubKey = genPoint(suite)
    56  //	d.context.MyPartSec = genScaler(suite)
    57  //	fmt.Println(d.generateConfig())
    58  //	d.SaveConsensusData()
    59  //	config, _ := d.LoadConsensusData()
    60  //	fmt.Println(config)
    61  //}