Skip to content

Commit

Permalink
Merge pull request #11 from Fairblock/fairyring-0.10.x
Browse files Browse the repository at this point in the history
Update fo be compatible with fairyring 0.10.x
  • Loading branch information
p0p3yee authored Oct 29, 2024
2 parents 36deff5 + 29c8d8a commit 8c15bee
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion cmd/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"github.com/spf13/cobra"
)

const ClientVersion = "v0.6.0"
const ClientVersion = "v0.7.0"

// configCmd represents the config command
var versionCmd = &cobra.Command{
Expand Down
6 changes: 3 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ go 1.22.4
require (
cosmossdk.io/math v1.3.0
github.com/FairBlock/DistributedIBE v0.0.0-20231211202607-d457df6869db
github.com/Fairblock/fairyring v0.9.0
github.com/Fairblock/fairyring v0.10.2
github.com/btcsuite/btcd v0.22.3
github.com/cometbft/cometbft v0.38.12
github.com/cosmos/cosmos-sdk v0.50.6
github.com/cosmos/cosmos-sdk v0.50.8
github.com/decred/dcrd/dcrec/secp256k1 v1.0.4
github.com/drand/kyber v1.2.0
github.com/drand/kyber-bls12381 v0.3.1
Expand Down Expand Up @@ -171,6 +171,6 @@ require (

replace github.com/gogo/protobuf => github.com/regen-network/protobuf v1.3.3-alpha.regen.1

replace github.com/cosmos/cosmos-sdk => github.com/Fairblock/cosmos-sdk v0.50.8-fairyring
replace github.com/cosmos/cosmos-sdk => github.com/Fairblock/cosmos-sdk v0.50.8-fairyring-2

replace github.com/CosmWasm/wasmd => github.com/Fairblock/wasmd v0.50.6-fairyring
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ github.com/DataDog/zstd v1.5.5 h1:oWf5W7GtOLgp6bciQYDmhHHjdhYkALu6S/5Ni9ZgSvQ=
github.com/DataDog/zstd v1.5.5/go.mod h1:g4AWEaM3yOg3HYfnJ3YIawPnVdXJh9QME85blwSAmyw=
github.com/FairBlock/DistributedIBE v0.0.0-20231211202607-d457df6869db h1:wmRvJRPDm8nXZzRjzgPzbhGHhEX5TbXUBiZkAieUNMA=
github.com/FairBlock/DistributedIBE v0.0.0-20231211202607-d457df6869db/go.mod h1:qXpLBzZiSdWoweJkE/lAIPedf6GOl7WsYM8rxrZCCDk=
github.com/Fairblock/cosmos-sdk v0.50.8-fairyring h1:b/nFqDT2lHXtam2KdN0s9RLVsYHDFlvnSXRukEV3LfI=
github.com/Fairblock/cosmos-sdk v0.50.8-fairyring/go.mod h1:ep1ZTLXL8h62Xi6l6lJdto/Xt8CYlP+GW9MudPCT05w=
github.com/Fairblock/fairyring v0.9.0 h1:1uS4T8XUqjttVWtal1pbQxwejMyneR/hJ5vk6ddD1PA=
github.com/Fairblock/fairyring v0.9.0/go.mod h1:f3EpfTuMdltDK20aaJh3UvvxYBf3015dgT0U5/sNMNI=
github.com/Fairblock/cosmos-sdk v0.50.8-fairyring-2 h1:a8ydCHdZgxA7rZUOTq1Mxy++MGcg4WXvOq5Sk1L8bUI=
github.com/Fairblock/cosmos-sdk v0.50.8-fairyring-2/go.mod h1:jmeO72xKJKgxmRtY/aQPLl1y7b9Wz9xIwi8T9K5rjwU=
github.com/Fairblock/fairyring v0.10.2 h1:X/ycHy6WULYv8AEYQyEG0iGuYNvwfcmvBnWL0qhCleA=
github.com/Fairblock/fairyring v0.10.2/go.mod h1:VlDG8BL4mtyIwhaYqFsMR5cRBpUJOUBbhKLzg/KbXSY=
github.com/Fairblock/wasmd v0.50.6-fairyring h1:P5bEeEQbyLew8dD/kXP1JSjBB6ersyhORcnuYQp3+nI=
github.com/Fairblock/wasmd v0.50.6-fairyring/go.mod h1:f0oj8Oy6bzleydH5ytWMqQD7DCp23b2VKkdsTVmiLrE=
github.com/Knetic/govaluate v3.0.1-0.20171022003610-9aa49832a739+incompatible/go.mod h1:r7JcOSlj0wfOMncg0iLm8Leh48TZaKVeNIfJntJ2wa0=
Expand Down
10 changes: 5 additions & 5 deletions internal/fairyringclient/fairyringclient.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ func StartFairyRingClient(cfg config.Config) {
validatorCosmosClient.CosmosClient.AddTxToQueue(&types.MsgSendKeyshare{
Creator: validatorCosmosClient.CosmosClient.GetAddress(),
Message: extractedKeyHex,
KeyShareIndex: keyShareIndex,
KeyshareIndex: keyShareIndex,
BlockHeight: processHeight,
}, true,
func(err error) {
Expand Down Expand Up @@ -367,7 +367,7 @@ func handleStartSubmitEncryptedKeyShareEvent(
validatorCosmosClient.CosmosClient.AddTxToQueue(&types.MsgSubmitEncryptedKeyshare{
Creator: validatorCosmosClient.CosmosClient.GetAddress(),
Identity: identity,
KeyShareIndex: index,
KeyshareIndex: index,
Requester: requester,
EncryptedKeyshare: encryptedMessage,
}, true,
Expand Down Expand Up @@ -415,10 +415,10 @@ func handleStartSubmitGeneralKeyShareEvent(identity string) {
}
log.Printf("Derived General Key Share: %s\n", derivedShare)

validatorCosmosClient.CosmosClient.AddTxToQueue(&types.MsgCreateGeneralKeyShare{
validatorCosmosClient.CosmosClient.AddTxToQueue(&types.MsgSubmitGeneralKeyshare{
Creator: validatorCosmosClient.CosmosClient.GetAddress(),
KeyShare: derivedShare,
KeyShareIndex: index,
Keyshare: derivedShare,
KeyshareIndex: index,
IdType: "private-gov-identity",
IdValue: identity,
}, true,
Expand Down
16 changes: 8 additions & 8 deletions pkg/cosmosClient/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ func (c *CosmosClient) updateAccSequence() error {
func (c *CosmosClient) IsAddrAuthorized(target string) bool {
resp, err := c.keyshareQueryClient.AuthorizedAddress(
context.Background(),
&keysharetypes.QueryGetAuthorizedAddressRequest{
&keysharetypes.QueryAuthorizedAddressRequest{
Target: target,
},
)
Expand All @@ -168,10 +168,10 @@ func (c *CosmosClient) GetCommitments() (*keysharetypes.QueryCommitmentsResponse
return resp, nil
}

func (c *CosmosClient) GetActivePubKey() (*keysharetypes.QueryPubKeyResponse, error) {
resp, err := c.keyshareQueryClient.PubKey(
func (c *CosmosClient) GetActivePubKey() (*keysharetypes.QueryPubkeyResponse, error) {
resp, err := c.keyshareQueryClient.Pubkey(
context.Background(),
&keysharetypes.QueryPubKeyRequest{},
&keysharetypes.QueryPubkeyRequest{},
)
if err != nil {
return nil, err
Expand All @@ -185,10 +185,10 @@ func (c *CosmosClient) GetKeyShare(getPendingShare bool) (*distIBE.Share, uint64
return nil, 0, 0, err
}

targetEncKeyShareList := pubKey.ActivePubKey.EncryptedKeyShares
targetEncKeyShareList := pubKey.ActivePubkey.EncryptedKeyshares

if getPendingShare {
targetEncKeyShareList = pubKey.QueuedPubKey.EncryptedKeyShares
targetEncKeyShareList = pubKey.QueuedPubkey.EncryptedKeyshares
}

if len(targetEncKeyShareList) == 0 {
Expand All @@ -207,10 +207,10 @@ func (c *CosmosClient) GetKeyShare(getPendingShare bool) (*distIBE.Share, uint64
return nil, 0, 0, err
}

expiryHeight := pubKey.ActivePubKey.Expiry
expiryHeight := pubKey.ActivePubkey.Expiry

if getPendingShare {
expiryHeight = pubKey.QueuedPubKey.Expiry
expiryHeight = pubKey.QueuedPubkey.Expiry
}

return parsedShare, uint64(keyShareIndex), expiryHeight, nil
Expand Down

0 comments on commit 8c15bee

Please sign in to comment.