|
|
@ -6,11 +6,13 @@ import ( |
|
|
|
"math/big" |
|
|
|
"math/big" |
|
|
|
"time" |
|
|
|
"time" |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
"github.com/harmony-one/harmony/crypto/bls" |
|
|
|
|
|
|
|
|
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
"github.com/ethereum/go-ethereum/common" |
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil" |
|
|
|
"github.com/ethereum/go-ethereum/common/hexutil" |
|
|
|
"github.com/ethereum/go-ethereum/common/math" |
|
|
|
"github.com/ethereum/go-ethereum/common/math" |
|
|
|
"github.com/ethereum/go-ethereum/rpc" |
|
|
|
"github.com/ethereum/go-ethereum/rpc" |
|
|
|
"github.com/harmony-one/bls/ffi/go/bls" |
|
|
|
bls_core "github.com/harmony-one/bls/ffi/go/bls" |
|
|
|
"github.com/harmony-one/harmony/block" |
|
|
|
"github.com/harmony-one/harmony/block" |
|
|
|
"github.com/harmony-one/harmony/common/denominations" |
|
|
|
"github.com/harmony-one/harmony/common/denominations" |
|
|
|
"github.com/harmony-one/harmony/consensus/quorum" |
|
|
|
"github.com/harmony-one/harmony/consensus/quorum" |
|
|
@ -224,8 +226,10 @@ func (s *PublicBlockChainAPI) GetBlockSigners(ctx context.Context, blockNr uint6 |
|
|
|
if err != nil { |
|
|
|
if err != nil { |
|
|
|
return nil, err |
|
|
|
return nil, err |
|
|
|
} |
|
|
|
} |
|
|
|
blsPublicKey := new(bls.PublicKey) |
|
|
|
blsPublicKey := new(bls_core.PublicKey) |
|
|
|
validator.BLSPublicKey.ToLibBLSPublicKey(blsPublicKey) |
|
|
|
if blsPublicKey, err = bls.BytesToBLSPublicKey(validator.BLSPublicKey[:]); err != nil { |
|
|
|
|
|
|
|
return nil, err |
|
|
|
|
|
|
|
} |
|
|
|
if ok, err := mask.KeyEnabled(blsPublicKey); err == nil && ok { |
|
|
|
if ok, err := mask.KeyEnabled(blsPublicKey); err == nil && ok { |
|
|
|
signers = append(signers, oneAddress) |
|
|
|
signers = append(signers, oneAddress) |
|
|
|
} |
|
|
|
} |
|
|
@ -247,8 +251,10 @@ func (s *PublicBlockChainAPI) GetBlockSignerKeys(ctx context.Context, blockNr ui |
|
|
|
} |
|
|
|
} |
|
|
|
signers := []string{} |
|
|
|
signers := []string{} |
|
|
|
for _, validator := range slots { |
|
|
|
for _, validator := range slots { |
|
|
|
blsPublicKey := new(bls.PublicKey) |
|
|
|
blsPublicKey := new(bls_core.PublicKey) |
|
|
|
validator.BLSPublicKey.ToLibBLSPublicKey(blsPublicKey) |
|
|
|
if blsPublicKey, err = bls.BytesToBLSPublicKey(validator.BLSPublicKey[:]); err != nil { |
|
|
|
|
|
|
|
return nil, err |
|
|
|
|
|
|
|
} |
|
|
|
if ok, err := mask.KeyEnabled(blsPublicKey); err == nil && ok { |
|
|
|
if ok, err := mask.KeyEnabled(blsPublicKey); err == nil && ok { |
|
|
|
signers = append(signers, validator.BLSPublicKey.Hex()) |
|
|
|
signers = append(signers, validator.BLSPublicKey.Hex()) |
|
|
|
} |
|
|
|
} |
|
|
@ -276,8 +282,10 @@ func (s *PublicBlockChainAPI) IsBlockSigner(ctx context.Context, blockNr uint64, |
|
|
|
if oneAddress != address { |
|
|
|
if oneAddress != address { |
|
|
|
continue |
|
|
|
continue |
|
|
|
} |
|
|
|
} |
|
|
|
blsPublicKey := new(bls.PublicKey) |
|
|
|
blsPublicKey := new(bls_core.PublicKey) |
|
|
|
validator.BLSPublicKey.ToLibBLSPublicKey(blsPublicKey) |
|
|
|
if blsPublicKey, err = bls.BytesToBLSPublicKey(validator.BLSPublicKey[:]); err != nil { |
|
|
|
|
|
|
|
return false, err |
|
|
|
|
|
|
|
} |
|
|
|
if ok, err := mask.KeyEnabled(blsPublicKey); err == nil && ok { |
|
|
|
if ok, err := mask.KeyEnabled(blsPublicKey); err == nil && ok { |
|
|
|
return true, nil |
|
|
|
return true, nil |
|
|
|
} |
|
|
|
} |
|
|
|