Skip to content

Commit

Permalink
latest
Browse files Browse the repository at this point in the history
  • Loading branch information
SetarehGhorshi committed Jan 29, 2024
1 parent 7c22ad2 commit 6569bb7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 115 deletions.
Binary file added fairyringd
Binary file not shown.
92 changes: 1 addition & 91 deletions proto/fairyring/keyshare/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -2,103 +2,13 @@ syntax = "proto3";

package fairyring.keyshare;

import "fairyring/keyshare/general_key_share.proto";


// this line is used by starport scaffolding # proto/tx/import

option go_package = "fairyring/x/keyshare/types";

// Msg defines the Msg service.
service Msg {
rpc RegisterValidator (MsgRegisterValidator) returns (MsgRegisterValidatorResponse);
rpc SendKeyshare (MsgSendKeyshare ) returns (MsgSendKeyshareResponse );

// this line is used by starport scaffolding # proto/tx/rpc
rpc CreateLatestPubKey (MsgCreateLatestPubKey ) returns (MsgCreateLatestPubKeyResponse );
rpc CreateAuthorizedAddress (MsgCreateAuthorizedAddress) returns (MsgCreateAuthorizedAddressResponse);
rpc UpdateAuthorizedAddress (MsgUpdateAuthorizedAddress) returns (MsgUpdateAuthorizedAddressResponse);
rpc DeleteAuthorizedAddress (MsgDeleteAuthorizedAddress) returns (MsgDeleteAuthorizedAddressResponse);
rpc CreateGeneralKeyShare (MsgCreateGeneralKeyShare ) returns (MsgCreateGeneralKeyShareResponse );
rpc RequestAggrKeyshare (MsgRequestAggrKeyshare ) returns (MsgRequestAggrKeyshareResponse );
rpc GetAggrKeyshare (MsgGetAggrKeyshare ) returns (MsgGetAggrKeyshareResponse );
}

message MsgRegisterValidator {
string creator = 1;
}

message MsgRegisterValidatorResponse {
string creator = 1;
}

message MsgSendKeyshare {
string creator = 1;
string message = 2;
uint64 keyShareIndex = 3;
uint64 blockHeight = 4;
}

message MsgSendKeyshareResponse {
string creator = 1;
string keyshare = 2;
uint64 keyshareIndex = 3;
uint64 blockHeight = 4;
uint64 receivedBlockHeight = 5;
bool success = 6;
string errorMessage = 7;
}

// this line is used by starport scaffolding # proto/tx/message
message MsgCreateLatestPubKey {
string creator = 1;
string publicKey = 2;
repeated string commitments = 3;
}

message MsgCreateLatestPubKeyResponse {}

message MsgCreateAuthorizedAddress {
string target = 1;
string creator = 2;
}

message MsgCreateAuthorizedAddressResponse {}

message MsgUpdateAuthorizedAddress {
string target = 1;
bool isAuthorized = 2;
string creator = 3;
}

message MsgUpdateAuthorizedAddressResponse {}

message MsgDeleteAuthorizedAddress {
string target = 1;
string creator = 2;
}

message MsgDeleteAuthorizedAddressResponse {}

message MsgCreateGeneralKeyShare {
string creator = 1;
string idType = 2;
string idValue = 3;
string keyShare = 4;
uint64 keyShareIndex = 5;
uint64 receivedTimestamp = 6;
uint64 receivedBlockHeight = 7;
}

message MsgCreateGeneralKeyShareResponse {
string creator = 1;
string idType = 2;
string idValue = 3;
string keyShare = 4;
uint64 keyShareIndex = 5;
uint64 receivedBlockHeight = 6;
bool success = 7;
string errorMessage = 8;
}

message MsgRequestAggrKeyshare {
string reqId = 1;
Expand Down
24 changes: 1 addition & 23 deletions x/keyshare/keeper/msg_server_general_key_share.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ func (k msgServer) CreateGeneralKeyShare(goCtx context.Context, msg *types.MsgCr

// check if validator is registered
validatorInfo, found := k.GetValidatorSet(ctx, msg.Creator)

//logrus.Info("****************************************************************************************************************88", found)
if !found {
authorizedAddrInfo, found := k.GetAuthorizedAddress(ctx, msg.Creator)
if !found || !authorizedAddrInfo.IsAuthorized {
Expand All @@ -45,28 +45,6 @@ func (k msgServer) CreateGeneralKeyShare(goCtx context.Context, msg *types.MsgCr
return nil, types.ErrAuthorizedAnotherAddress
}

isSupportedIDType := false
for _, v := range SupportedIDTypes {
if v == msg.IdType {
isSupportedIDType = true
break
}
}

if !isSupportedIDType {
return nil, types.ErrUnsupportedIDType.Wrapf(", supported id types: %v", SupportedIDTypes)
}

switch msg.IdType {
case PrivateGovIdentity:
keyShareReq, found := k.GetKeyShareRequest(ctx, msg.IdValue)
if !found {
return nil, types.ErrKeyShareRequestNotFound.Wrapf(", got id value: %s", msg.IdValue)
}
if keyShareReq.AggrKeyshare != "" {
return nil, types.ErrAggKeyAlreadyExists.Wrapf(", identity: %s, Aggregated key: %s", msg.IdValue, keyShareReq.AggrKeyshare)
}
}

// Setup
suite := bls.NewBLS12381Suite()
Expand Down
3 changes: 2 additions & 1 deletion x/keyshare/keeper/msg_server_request_aggr_keyshare.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@ import (
"strconv"

sdk "github.com/cosmos/cosmos-sdk/types"
"github.com/sirupsen/logrus"
)

func (k msgServer) RequestAggrKeyshare(goCtx context.Context, msg *types.MsgRequestAggrKeyshare) (*types.MsgRequestAggrKeyshareResponse, error) {
ctx := sdk.UnwrapSDKContext(goCtx)

logrus.Info("------------------------------------------------------------**** ", msg.ReqId);
var rsp types.MsgRequestAggrKeyshareResponse

reqCountString := k.GetRequestCount(ctx)
Expand Down

0 comments on commit 6569bb7

Please sign in to comment.