diff --git a/cmd/horcrux/cmd/address.go b/cmd/horcrux/cmd/address.go
index a5551c47..98420f3b 100644
--- a/cmd/horcrux/cmd/address.go
+++ b/cmd/horcrux/cmd/address.go
@@ -7,6 +7,7 @@ import (
"strings"
"github.com/strangelove-ventures/horcrux/pkg/pcosigner"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
"github.com/cometbft/cometbft/crypto"
cometprivval "github.com/cometbft/cometbft/privval"
@@ -46,7 +47,7 @@ func addressCmd() *cobra.Command {
return err
}
- key, err := pcosigner.LoadCosignerEd25519Key(keyFile)
+ key, err := cipher.LoadCosignerEd25519Key(keyFile)
if err != nil {
return fmt.Errorf("error reading cosigner key: %w, check that key is present for chain ID: %s", err, chainID)
}
diff --git a/cmd/horcrux/cmd/leader_election.go b/cmd/horcrux/cmd/leader_election.go
index 8ec1d92e..3801d04c 100644
--- a/cmd/horcrux/cmd/leader_election.go
+++ b/cmd/horcrux/cmd/leader_election.go
@@ -6,12 +6,12 @@ import (
"time"
"github.com/strangelove-ventures/horcrux/pkg/pcosigner"
+ "github.com/strangelove-ventures/horcrux/pkg/proto"
grpcretry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
"github.com/spf13/cobra"
"github.com/strangelove-ventures/horcrux/client"
"github.com/strangelove-ventures/horcrux/pkg/multiresolver"
- "github.com/strangelove-ventures/horcrux/pkg/proto"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
@@ -70,16 +70,16 @@ horcrux elect 2 # elect specific leader`,
ctx, cancelFunc := context.WithTimeout(context.Background(), 30*time.Second)
defer cancelFunc()
- grpcClient := proto.NewICosignerGRPCServerClient(conn)
+ grpcClient := proto.NewIRaftGRPCClient(conn)
_, err = grpcClient.TransferLeadership(
ctx,
- &proto.CosignerGRPCTransferLeadershipRequest{LeaderID: leaderID},
+ &proto.RaftGRPCTransferLeadershipRequest{LeaderID: leaderID},
)
if err != nil {
return err
}
- res, err := grpcClient.GetLeader(ctx, &proto.CosignerGRPCGetLeaderRequest{})
+ res, err := grpcClient.GetLeader(ctx, &proto.RaftGRPCGetLeaderRequest{})
if err != nil {
return err
}
@@ -167,9 +167,9 @@ func getLeaderCmd() *cobra.Command {
ctx, cancelFunc := context.WithTimeout(context.Background(), 30*time.Second)
defer cancelFunc()
- grpcClient := proto.NewICosignerGRPCServerClient(conn)
+ grpcClient := proto.NewIRaftGRPCClient(conn)
- res, err := grpcClient.GetLeader(ctx, &proto.CosignerGRPCGetLeaderRequest{})
+ res, err := grpcClient.GetLeader(ctx, &proto.RaftGRPCGetLeaderRequest{})
if err != nil {
return err
}
diff --git a/cmd/horcrux/cmd/migrate.go b/cmd/horcrux/cmd/migrate.go
index 76ae29b4..43492082 100644
--- a/cmd/horcrux/cmd/migrate.go
+++ b/cmd/horcrux/cmd/migrate.go
@@ -9,6 +9,7 @@ import (
"path/filepath"
"github.com/strangelove-ventures/horcrux/pkg/pcosigner"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
cometcrypto "github.com/cometbft/cometbft/crypto"
cometcryptoed25519 "github.com/cometbft/cometbft/crypto/ed25519"
@@ -219,7 +220,7 @@ func migrateCmd() *cobra.Command {
return err
}
- newEd25519Key := pcosigner.CosignerEd25519Key{
+ newEd25519Key := cipher.CosignerEd25519Key{
PubKey: legacyCosignerKey.PubKey,
PrivateShard: legacyCosignerKey.ShareKey,
ID: legacyCosignerKey.ID,
diff --git a/cmd/horcrux/cmd/shards.go b/cmd/horcrux/cmd/shards.go
index 6ed066c4..e8b28e1a 100644
--- a/cmd/horcrux/cmd/shards.go
+++ b/cmd/horcrux/cmd/shards.go
@@ -20,6 +20,8 @@ import (
"os"
"path/filepath"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
+
"github.com/strangelove-ventures/horcrux/pkg/pcosigner"
"github.com/spf13/cobra"
@@ -113,7 +115,7 @@ func createCosignerEd25519ShardsCmd() *cobra.Command {
return nil
}
- csKeys, err := pcosigner.CreateCosignerEd25519ShardsFromFile(keyFile, threshold, shards)
+ csKeys, err := cipher.CreateCosignerEd25519ShardsFromFile(keyFile, threshold, shards)
if err != nil {
return err
}
@@ -134,7 +136,7 @@ func createCosignerEd25519ShardsCmd() *cobra.Command {
return err
}
filename := filepath.Join(dir, fmt.Sprintf("%s_shard.json", chainID))
- if err = pcosigner.WriteCosignerEd25519ShardFile(c, filename); err != nil {
+ if err = cipher.WriteCosignerEd25519ShardFile(c, filename); err != nil {
return err
}
fmt.Fprintf(cmd.OutOrStdout(), "Created Ed25519 Shard %s\n", filename)
diff --git a/cmd/horcrux/cmd/threshold.go b/cmd/horcrux/cmd/threshold.go
index bc973fbe..23a377f3 100644
--- a/cmd/horcrux/cmd/threshold.go
+++ b/cmd/horcrux/cmd/threshold.go
@@ -25,10 +25,11 @@ func NewThresholdValidator(
thresholdCfg := config.Config.ThresholdModeConfig
// NOTE: Shouldnt this be a list of concrete type instead of interface type?
- remoteCosigners := make([]node.ICosigner, 0, len(thresholdCfg.Cosigners)-1)
+ remoteCosigners := make([]pcosigner.IRemoteCosigner, 0, len(thresholdCfg.Cosigners)-1) // list of remote cosigners
+ // peers := make([]pcosigner.ICosigner, 0, len(thresholdCfg.Cosigners)-1)
var p2pListen string
-
+ var cosign pcosigner.Cosigner
var security pcosigner.ICosignerSecurity
var eciesErr error
security, eciesErr = config.CosignerSecurityECIES()
@@ -42,16 +43,17 @@ func NewThresholdValidator(
for _, c := range thresholdCfg.Cosigners {
if c.ShardID != security.GetID() {
- remoteCosigners = append(
- remoteCosigners,
- pcosigner.NewRemoteCosigner(c.ShardID, c.P2PAddr),
- )
+ remoteCosigners = append(remoteCosigners, pcosigner.NewRemoteCosigner(security.GetID(), c.P2PAddr))
+ logger.Info("Added remote cosigner", "id", c.ShardID, "address", c.P2PAddr)
} else {
p2pListen = c.P2PAddr
+ cosign = pcosigner.NewCosign(c.ShardID, c.P2PAddr)
+ logger.Info("Created a new cosigner", "id", c.ShardID, "address", c.P2PAddr)
+
}
}
- if p2pListen == "" {
+ if cosign.GetAddress() == "" {
return nil, nil, fmt.Errorf("cosigner config does not exist for our shard ID %d", security.GetID())
}
@@ -59,7 +61,7 @@ func NewThresholdValidator(
logger,
&config,
security,
- p2pListen,
+ cosign,
)
// Validated prior in ValidateThresholdModeConfig
@@ -74,7 +76,6 @@ func NewThresholdValidator(
// RAFT node ID is the cosigner ID
nodeID := fmt.Sprint(security.GetID())
- // Start RAFT store listener
raftStore := node.NewRaftStore(nodeID,
raftDir, p2pListen, raftTimeout, logger)
if err := raftStore.Start(); err != nil {
@@ -88,9 +89,9 @@ func NewThresholdValidator(
thresholdCfg.Threshold,
grpcTimeout,
maxWaitForSameBlockAttempts,
- localCosigner,
- remoteCosigners,
- raftStore, // raftStore implements the ILeader interface
+ localCosigner, // our "server"
+ remoteCosigners, // remote Cosigners are the peers we are requesting remotely (client to server)
+ raftStore, // raftStore implements the ILeader interface
)
raftStore.SetThresholdValidator(val)
diff --git a/docs/misc.md b/docs/misc.md
deleted file mode 100644
index e9fcc963..00000000
--- a/docs/misc.md
+++ /dev/null
@@ -1,37 +0,0 @@
-# Misc
-
-| | Num. Rounds | Robust | Num. Signers | Parallel Secure |
-|--------------------|:--------------------:|:------:|:------------:|:---------------:|
-| **Stinson Strobl [^1]** | 4 | Yes | t | Yes |
-| **Gennaro et al. [^2]** | 1 with preprocessing | No | n | No |
-| **FROST** [^3] | 1 with preprocessing | No | t | Yes |
-| **ROAST** [^TBD] | TBD | TBD | TBD | TBD |
-**Stinson Strobl** threshold signature scheme is the **only** implemented Threshold Scheme in Horcrux so far. However, its important to note that the key generation in Horcrux is not fully the same as proposed in the paper. Instead of using Pedersen´s Verifiable Secret Sharing (PVSS) Horxruc uses "classic" shamir secret sharing with a fully trusted dealer.
-
-
-### Overview
-
-#### Stinson and Strobl
-**Stinson and Strobl**[^1] is a threshold signature scheme producing Schnorr signatures. It uses a modification of Pedersen’s DKG presented by Gennaro et al.[^4] to generate both the *secret key s* during key generation as well as the *random nonce k* for each signing operation.
-
-This construction requires at minimum four rounds for each signing operation (assuming no participant misbehaves):
-- three rounds to perform the DKG to obtain k (the random nonce),
-- and one round to distribute signature shares and compute the group signature.
-
-Each round requires participants to send values to every other participant.
-
-
-[^1]: Stinson, D.R., Strobl, R. (2001). Provably Secure Distributed Schnorr Signatures and a (t, n) Threshold Scheme for Implicit Certificates. In: Varadharajan, V., Mu, Y. (eds) Information Security and Privacy. ACISP 2001. Lecture Notes in Computer Science, vol 2119. Springer, Berlin, Heidelberg. [](https://doi.org/10.1007/3-540-47719-5_33)https://doi.org/10.1007/3-540-47719-5_33
-[^2]: Gennaro, R., Goldfeder, S. (2020). One Round Threshold ECDSA with Identifiable Abort. In: Cryptology ePrint Archive, Paper 2020/540. [](https://eprint.iacr.org/2020/540)https://eprint.iacr.org/2020/540
-[^3]: Komlo, C., Goldberg, I. (2021). FROST: Flexible Round-Optimized Schnorr Threshold Signatures. In: Dunkelman, O., Jacobson, Jr., M.J., O'Flynn, C. (eds) Selected Areas in Cryptography. SAC 2020. Lecture Notes in Computer Science(), vol 12804. Springer, Cham. [](https://eprint.iacr.org/2020/852.pdf)https://eprint.iacr.org/2020/852.pdf
-[^4]: Rosario Gennaro, Stanislaw Jarecki, Hugo Krawczyk, and Tal Rabin. Secure Distributed Key Generation for Discrete-Log Based Cryptosystems. Journal of Cryptology, 20:51–83, 2007.
-
-### Glossary - WORK IN PROGRESS
-
-- In cryptography, a **nonce** (number once) is an arbitrary number that can be used just once in a cryptographic communication.
-
-- A cryptographic key is called **ephemeral** if it is generated for each execution of a key establishment process.
-
-- **Threshold signatures** allow for splitting a private key into n secret shares. To sign a message, at least some threshold of the shareholders need to coordinate and provide their individual signatures using their share. These individual signatures combine to form a single valid signature.
-
-- **Robust schemes** ensure that so long as t participants correctly follow the protocol, the protocol is guaranteed to complete successfully, even if a subset of participants (at most n − t) contribute malformed shares.
diff --git a/go.sum b/go.sum
index 1079fe5f..37aaa321 100644
--- a/go.sum
+++ b/go.sum
@@ -40,8 +40,12 @@ cosmossdk.io/core v0.5.1 h1:vQVtFrIYOQJDV3f7rw4pjjVqc1id4+mE0L9hHP66pyI=
cosmossdk.io/depinject v1.0.0-alpha.3 h1:6evFIgj//Y3w09bqOUOzEpFj5tsxBqdc5CfkO7z+zfw=
cosmossdk.io/errors v1.0.0-beta.7 h1:gypHW76pTQGVnHKo6QBkb4yFOJjC+sUGRc5Al3Odj1w=
cosmossdk.io/errors v1.0.0-beta.7/go.mod h1:mz6FQMJRku4bY7aqS/Gwfcmr/ue91roMEKAmDUDpBfE=
+cosmossdk.io/errors v1.0.0 h1:nxF07lmlBbB8NKQhtJ+sJm6ef5uV1XkvPXG2bUntb04=
+cosmossdk.io/errors v1.0.0/go.mod h1:+hJZLuhdDE0pYN8HkOrVNwrIOYvUGnn6+4fjnJs/oV0=
cosmossdk.io/math v1.0.1 h1:Qx3ifyOPaMLNH/89WeZFH268yCvU4xEcnPLu3sJqPPg=
cosmossdk.io/math v1.0.1/go.mod h1:Ygz4wBHrgc7g0N+8+MrnTfS9LLn9aaTGa9hKopuym5k=
+cosmossdk.io/math v1.1.2 h1:ORZetZCTyWkI5GlZ6CZS28fMHi83ZYf+A2vVnHNzZBM=
+cosmossdk.io/math v1.1.2/go.mod h1:l2Gnda87F0su8a/7FEKJfFdJrM0JZRXQaohlgJeyQh0=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
filippo.io/edwards25519 v1.0.0 h1:0wAIcmJUqRdI8IJ/3eGi5/HwXZWPujYXXlkrQogz0Ek=
filippo.io/edwards25519 v1.0.0/go.mod h1:N1IkdkCkiLB6tki+MYJoSx2JTY9NUlxZE7eHn5EwJns=
@@ -51,6 +55,8 @@ github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802/go.mod h1:IVnqGOEym/WlBOVXweHU+Q+/VP0lqqI8lqeDx9IjBqo=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d h1:nalkkPQcITbvhmL4+C4cKA87NW0tfm3Kl9VXRoPywFg=
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d/go.mod h1:URdX5+vg25ts3aCh8H5IFZybJYKWhJHYMTnf+ULtoC4=
+github.com/ChainSafe/go-schnorrkel v1.0.0 h1:3aDA67lAykLaG1y3AOjs88dMxC88PgUuHRrLeDnvGIM=
+github.com/ChainSafe/go-schnorrkel v1.0.0/go.mod h1:dpzHYVxLZcp8pjlV+O+UR8K0Hp/z7vcchBSbMBEhCw4=
github.com/DataDog/datadog-go v2.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/DataDog/datadog-go v3.2.0+incompatible/go.mod h1:LButxg5PwREeZtORoXG3tL4fMGNddJ+vMq1mwgfaqoQ=
github.com/Jille/raft-grpc-leader-rpc v1.1.0 h1:u36rmA4tjp+4FSdZ17jg/1sfSCYNQIe5bzzwvW0iVTM=
@@ -59,6 +65,8 @@ github.com/Jille/raft-grpc-transport v1.4.0 h1:Kwk+IceQD8MpLKOulBu2ignX+aZAEjOhf
github.com/Jille/raft-grpc-transport v1.4.0/go.mod h1:afVUd8LQKUUo3V/ToLBH3mbSyvivRlMYCDK0eJRGTfQ=
github.com/Jille/raftadmin v1.2.0 h1:hMLFUK7iKpeXP+CoIhNMWj+F53XOLSjMDSia0C60cps=
github.com/Jille/raftadmin v1.2.0/go.mod h1:vtVEpToPGTUPVwwunypWDpi69JpdnHMhWRUlc/65U+Y=
+github.com/Jille/raftadmin v1.2.1 h1:P35JYYJmyHnsJ7sEjdXVRRvaqXUQUuNjIqPFf5n3CEM=
+github.com/Jille/raftadmin v1.2.1/go.mod h1:CocBqmOFhfk8oIgbzZKYACdm5PizUXfzupqTQV17Pgk=
github.com/OneOfOne/xxhash v1.2.2 h1:KMrpdQIwFcEqXDklaen+P1axHaj9BSKzvpUUfnHldSE=
github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAElWljhcU=
github.com/VividCortex/gohistogram v1.0.0 h1:6+hBz+qvs0JOrrNhhmR7lFxo5sINxBCGXrdtl/UvroE=
@@ -72,6 +80,7 @@ github.com/armon/go-metrics v0.0.0-20190430140413-ec5e00d3c878/go.mod h1:3AMJUQh
github.com/armon/go-metrics v0.3.9/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
github.com/armon/go-metrics v0.4.1 h1:hR91U9KYmb6bLBYLQjyM+3j+rcd/UhE+G78SFnF8gJA=
github.com/armon/go-metrics v0.4.1/go.mod h1:E6amYzXo6aW1tqzoZGT755KkbgrJsSdpwZ+3JqfkOG4=
+github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q=
github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8=
github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM=
@@ -101,8 +110,12 @@ github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnht
github.com/cncf/xds/go v0.0.0-20210312221358-fbca930ec8ed/go.mod h1:eXthEFrGJvWHgFFCl3hGmgk+/aYT6PnTQLykKQRLhEs=
github.com/cometbft/cometbft v0.37.2 h1:XB0yyHGT0lwmJlFmM4+rsRnczPlHoAKFX6K8Zgc2/Jc=
github.com/cometbft/cometbft v0.37.2/go.mod h1:Y2MMMN//O5K4YKd8ze4r9jmk4Y7h0ajqILXbH5JQFVs=
+github.com/cometbft/cometbft v0.38.0 h1:ogKnpiPX7gxCvqTEF4ly25/wAxUqf181t30P3vqdpdc=
+github.com/cometbft/cometbft v0.38.0/go.mod h1:5Jz0Z8YsHSf0ZaAqGvi/ifioSdVFPtEGrm8Y9T/993k=
github.com/cometbft/cometbft-db v0.7.0 h1:uBjbrBx4QzU0zOEnU8KxoDl18dMNgDh+zZRUE0ucsbo=
github.com/cometbft/cometbft-db v0.7.0/go.mod h1:yiKJIm2WKrt6x8Cyxtq9YTEcIMPcEe4XPxhgX59Fzf0=
+github.com/cometbft/cometbft-db v0.8.0 h1:vUMDaH3ApkX8m0KZvOFFy9b5DZHBAjsnEuo9AKVZpjo=
+github.com/cometbft/cometbft-db v0.8.0/go.mod h1:6ASCP4pfhmrCBpfk01/9E1SI29nD3HfVHrY4PG8x5c0=
github.com/confio/ics23/go v0.9.0 h1:cWs+wdbS2KRPZezoaaj+qBleXgUk5WOQFMP3CQFGTr4=
github.com/confio/ics23/go v0.9.0/go.mod h1:4LPZ2NYqnYIVRklaozjNR1FScgDJ2s5Xrp+e/mYVRak=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
@@ -112,14 +125,20 @@ github.com/cosmos/btcutil v1.0.5 h1:t+ZFcX77LpKtDBhjucvnOH8C2l2ioGsBNEQ3jef8xFk=
github.com/cosmos/btcutil v1.0.5/go.mod h1:IyB7iuqZMJlthe2tkIFL33xPyzbFYP0XVdS8P5lUPis=
github.com/cosmos/cosmos-proto v1.0.0-beta.2 h1:X3OKvWgK9Gsejo0F1qs5l8Qn6xJV/AzgIWR2wZ8Nua8=
github.com/cosmos/cosmos-proto v1.0.0-beta.2/go.mod h1:+XRCLJ14pr5HFEHIUcn51IKXD1Fy3rkEQqt4WqmN4V0=
+github.com/cosmos/cosmos-proto v1.0.0-beta.3 h1:VitvZ1lPORTVxkmF2fAp3IiA61xVwArQYKXTdEcpW6o=
+github.com/cosmos/cosmos-proto v1.0.0-beta.3/go.mod h1:t8IASdLaAq+bbHbjq4p960BvcTqtwuAxid3b/2rOD6I=
github.com/cosmos/cosmos-sdk v0.47.3 h1:r0hGmZoAzP2D+MaPaFGHwAaTdFQq3pNpHaUp1BsffbM=
github.com/cosmos/cosmos-sdk v0.47.3/go.mod h1:c4OfLdAykA9zsj1CqrxBRqXzVz48I++JSvIMPSPcEmk=
+github.com/cosmos/cosmos-sdk v0.47.5 h1:n1+WjP/VM/gAEOx3TqU2/Ny734rj/MX1kpUnn7zVJP8=
+github.com/cosmos/cosmos-sdk v0.47.5/go.mod h1:EHwCeN9IXonsjKcjpS12MqeStdZvIdxt3VYXhus3G3c=
github.com/cosmos/go-bip39 v0.0.0-20180819234021-555e2067c45d/go.mod h1:tSxLoYXyBmiFeKpvmq4dzayMdCjCnu8uqmCysIGBT2Y=
github.com/cosmos/go-bip39 v1.0.0 h1:pcomnQdrdH22njcAatO0yWojsUnCO3y2tNoV1cb6hHY=
github.com/cosmos/go-bip39 v1.0.0/go.mod h1:RNJv0H/pOIVgxw6KS7QeX2a0Uo0aKUlfhZ4xuwvCdJw=
github.com/cosmos/gogogateway v1.2.0 h1:Ae/OivNhp8DqBi/sh2A8a1D0y638GpL3tkmLQAiKxTE=
github.com/cosmos/gogoproto v1.4.10 h1:QH/yT8X+c0F4ZDacDv3z+xE3WU1P1Z3wQoLMBRJoKuI=
github.com/cosmos/gogoproto v1.4.10/go.mod h1:3aAZzeRWpAwr+SS/LLkICX2/kDFyaYVzckBDzygIxek=
+github.com/cosmos/gogoproto v1.4.11 h1:LZcMHrx4FjUgrqQSWeaGC1v/TeuVFqSLa43CC6aWR2g=
+github.com/cosmos/gogoproto v1.4.11/go.mod h1:/g39Mh8m17X8Q/GDEs5zYTSNaNnInBSohtaxzQnYq1Y=
github.com/cosmos/iavl v0.20.0 h1:fTVznVlepH0KK8NyKq8w+U7c2L6jofa27aFX6YGlm38=
github.com/cosmos/ledger-cosmos-go v0.12.2 h1:/XYaBlE2BJxtvpkHiBm97gFGSGmYGKunKyF3nNqAXZA=
github.com/cosmos/ledger-cosmos-go v0.12.2/go.mod h1:ZcqYgnfNJ6lAXe4HPtWgarNEY+B74i+2/8MhZw4ziiI=
@@ -153,6 +172,8 @@ github.com/envoyproxy/go-control-plane v0.9.9-0.20210512163311-63b5d3c536b0/go.m
github.com/envoyproxy/protoc-gen-validate v0.1.0/go.mod h1:iSmxcyjqTsJpI2R4NaDN7+kN2VEUnK/pcBlmesArF7c=
github.com/ethereum/go-ethereum v1.12.0 h1:bdnhLPtqETd4m3mS8BGMNvBTf36bO5bx/hxE2zljOa0=
github.com/ethereum/go-ethereum v1.12.0/go.mod h1:/oo2X/dZLJjf2mJ6YT9wcWxa4nNJDBKDBU6sFIpx1Gs=
+github.com/ethereum/go-ethereum v1.13.1 h1:UF2FaUKPIy5jeZk3X06ait3y2Q4wI+vJ1l7+UARp+60=
+github.com/ethereum/go-ethereum v1.13.1/go.mod h1:xHQKzwkHSl0gnSjZK1mWa06XEdm9685AHqhRknOzqGQ=
github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c h1:8ISkoahWXwZR41ois5lSJBSVw4D0OV19Ht/JSTzvSv0=
github.com/facebookgo/stack v0.0.0-20160209184415-751773369052 h1:JWuenKqqX8nojtoVVWjGfOF9635RETekkoH6Cc9SX0A=
github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4 h1:7HZCaLC5+BZpmbhCOZJ293Lz68O7PYrF2EzeiFMwCLk=
@@ -160,6 +181,8 @@ github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5Kwzbycv
github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM=
github.com/fatih/color v1.13.0 h1:8LOYc1KYPPmyKMuN8QV2DNRWNbLo6LZ0iLs8+mlH53w=
github.com/fatih/color v1.13.0/go.mod h1:kLAiJbzzSOZDVNGyDpeOxJ47H46qBXwg5ILebYFFOfk=
+github.com/fatih/color v1.15.0 h1:kOqh6YHBtK8aywxGerMG2Eq3H6Qgoqeo13Bk2Mv/nBs=
+github.com/fatih/color v1.15.0/go.mod h1:0h5ZqXfHYED7Bhv2ZJamyIOUej9KtShiJESRwBDUSsw=
github.com/felixge/httpsnoop v1.0.2 h1:+nS9g82KMXccJ/wp0zyRW9ZBHFETmMGtkk+2CTTrW4o=
github.com/fortytw2/leaktest v1.3.0 h1:u8491cBMTQ8ft8aeV+adlcytMZylmA5nnwwkRZjI8vw=
github.com/frankban/quicktest v1.14.3 h1:FJKSZTDHjyhriyC81FLQ0LY93eSai0ZyR/ZIkd3ZUKE=
@@ -176,12 +199,18 @@ github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.12.0 h1:e4o3o3IsBfAKQh5Qbbiqyfu97Ku7jrO/JbohvztANh4=
github.com/go-kit/kit v0.12.0/go.mod h1:lHd+EkCZPIwYItmGDDRdhinkzX2A1sj+M9biaEaizzs=
+github.com/go-kit/kit v0.13.0 h1:OoneCcHKHQ03LfBpoQCUfCluwd2Vt3ohz+kvbJneZAU=
+github.com/go-kit/kit v0.13.0/go.mod h1:phqEHMMUbyrCFCTgH48JueqrM3md2HcAZ8N3XE4FKDg=
+github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
github.com/go-kit/log v0.2.1 h1:MRVx0/zhvdseW+Gza6N9rVzU/IVzaeE1SFI4raAhmBU=
github.com/go-kit/log v0.2.1/go.mod h1:NwTd00d/i8cPZ3xOwwiv2PO5MOcx78fFErGNcVmBjv0=
github.com/go-logfmt/logfmt v0.3.0/go.mod h1:Qt1PoO58o5twSAckw1HlFXLmHsOX5/0LbT9GBnD5lWE=
github.com/go-logfmt/logfmt v0.4.0/go.mod h1:3RMwSq7FuexP4Kalkev3ejPJsZTpXXBr9+V4qmtdjCk=
+github.com/go-logfmt/logfmt v0.5.0/go.mod h1:wCYkCAKZfumFQihp8CzCvQ3paCTfi41vtzG1KdI/P7A=
github.com/go-logfmt/logfmt v0.5.1 h1:otpy5pqBCBZ1ng9RQ0dPu4PN7ba75Y/aA+UpowDyNVA=
github.com/go-logfmt/logfmt v0.5.1/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
+github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4=
+github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs=
github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY=
github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE=
github.com/godbus/dbus v0.0.0-20190726142602-4481cbc300e2 h1:ZpnhV/YsD2/4cESfV5+Hoeu/iUR3ruzNvZ+yQfO03a0=
@@ -192,6 +221,8 @@ github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.1.0 h1:/d3pCKDPWNnvIWe0vVUpNP32qc8U3PDVxySP/y360qE=
github.com/golang/glog v1.1.0/go.mod h1:pfYeQZ3JWZoXTV5sFc986z3HTpwQs9At6P4ImfuP3NQ=
+github.com/golang/glog v1.1.2 h1:DVjP2PbBOzHyzA+dn3WhHIq4NdVu3Q+pvivFICf/7fo=
+github.com/golang/glog v1.1.2/go.mod h1:zR+okUeTbrL6EL3xHUDxZuEtGv04p5shwip1+mL/rLQ=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
@@ -270,6 +301,8 @@ github.com/gorilla/mux v1.8.0 h1:i40aqfkR1h2SlN9hojwV5ZA91wcXFOvkdNIeFDP5koI=
github.com/gorilla/websocket v1.5.0 h1:PPwGk2jz7EePpoHN/+ClbZu8SPxiqlu12wZP/3sWmnc=
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 h1:+9834+KizmvFV7pXQGSXQTsaWhq2GjuNUt0aUU0YBYw=
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0/go.mod h1:z0ButlSOZa5vEBq9m2m2hlwIgKw+rp3sdCBRoJY+30Y=
+github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 h1:UH//fgunKIs4JdUbpDl1VZCDaL56wXCB/5+wF6uHfaI=
+github.com/grpc-ecosystem/go-grpc-middleware v1.4.0/go.mod h1:g5qyo/la0ALbONm6Vbp88Yd8NsDy6rZz+RcrMPxvld8=
github.com/grpc-ecosystem/grpc-gateway v1.16.0 h1:gmcG1KaJ57LophUzW0Hy8NmPhnMZb4M0+kPpLofRdBo=
github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFbcEtjT1g+wF4CSlocrBnw=
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c h1:6rhixN/i8ZofjG1Y75iExal34USq5p+wiN1tpie8IrU=
@@ -303,6 +336,8 @@ github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs=
github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
+github.com/hashicorp/golang-lru v1.0.2 h1:dV3g9Z/unq5DpblPpw+Oqcv4dU/1omnb4Ok8iPY6p1c=
+github.com/hashicorp/golang-lru v1.0.2/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
github.com/hashicorp/hcl v1.0.0 h1:0Anlzjpi4vEasTeNFn2mLJgTSwt0+6sfsiTG8qcWGx4=
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
github.com/hashicorp/raft v1.1.0/go.mod h1:4Ak7FSPnuvmb0GV6vgIAJ4vYT4bek9bb6Q+7HVbyzqM=
@@ -319,6 +354,8 @@ github.com/hdevalence/ed25519consensus v0.1.0 h1:jtBwzzcHuTmFrQN6xQZn6CQEO/V9f7H
github.com/hdevalence/ed25519consensus v0.1.0/go.mod h1:w3BHWjwJbFU29IRHL1Iqkw3sus+7FctEyM4RqDxYNzo=
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c h1:DZfsyhDK1hnSS5lH8l+JggqzEleHteTYfutAiVlSUM8=
github.com/holiman/uint256 v1.2.2-0.20230321075855-87b91420868c/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw=
+github.com/holiman/uint256 v1.2.3 h1:K8UWO1HUJpRMXBxbmaY1Y8IAMZC/RsKB+ArEnnK4l5o=
+github.com/holiman/uint256 v1.2.3/go.mod h1:SC8Ryt4n+UBbPbIBKaG9zbbDlp4jOru9xFZmPzLUTxw=
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
github.com/huandu/skiplist v1.2.0 h1:gox56QD77HzSC0w+Ws3MH3iie755GBJU1OER3h5VsYw=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
@@ -326,18 +363,25 @@ github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:
github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANytuPF1OarO4DADm73n8=
github.com/inconshreveable/mousetrap v1.0.1 h1:U3uMjPSQEBMNp1lFxmllqCPM6P5u/Xq7Pgzkat/bFNc=
github.com/inconshreveable/mousetrap v1.0.1/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
+github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8=
+github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
github.com/jmhodges/levigo v1.0.0 h1:q5EC36kV79HWeTBWsod3mG11EgStG3qArTKcvlksN1U=
github.com/jmhodges/levigo v1.0.0/go.mod h1:Q6Qx+uH3RAqyK4rFQroq9RL7mdkABMcfhEI+nNuzMJQ=
+github.com/jpillora/backoff v1.0.0/go.mod h1:J/6gKK9jxlEcS3zixgDgUAsiuZ7yrSoa/FX5e0EB2j4=
github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU=
github.com/json-iterator/go v1.1.9/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4=
+github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo=
github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1:6v2b51hI/fHJwM22ozAgKL4VKDeJcHhJFhtBdhmNjmU=
github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/XSXhF0NWZEnDohbsk=
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
+github.com/julienschmidt/httprouter v1.3.0/go.mod h1:JR6WtHb+2LUe8TCKY3cZOxFyyO8IZAc4RVcycCCAKdM=
github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8=
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
github.com/klauspost/compress v1.12.3/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=
github.com/klauspost/compress v1.16.3 h1:XuJt9zzcnaz6a16/OU53ZjWp/v7/42WcR5t2a0PcNQY=
github.com/klauspost/compress v1.16.3/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
+github.com/klauspost/compress v1.17.0 h1:Rnbp4K9EjcDuVuHtd0dgA4qNuv9yKDYKK1ulpJwgrqM=
+github.com/klauspost/compress v1.17.0/go.mod h1:ntbaceVETuRiXiv4DpjP66DpAtAGkEQskQzEyD//IeE=
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg=
github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc=
@@ -350,9 +394,13 @@ github.com/kraken-hpc/go-fork v0.1.1 h1:O3X/ynoNy/eS7UIcZYef8ndFq2RXEIOue9kZqyzF
github.com/kraken-hpc/go-fork v0.1.1/go.mod h1:uu0e5h+V4ONH5Qk/xuVlyNXJXy/swhqGIEMK7w+9dNc=
github.com/libp2p/go-buffer-pool v0.1.0 h1:oK4mSFcQz7cTQIfqbe4MIj9gLW+mnanjyFtc6cdF0Y8=
github.com/libp2p/go-buffer-pool v0.1.0/go.mod h1:N+vh8gMqimBzdKkSMVuydVDq+UV5QTWy5HSiZacSbPg=
+github.com/linxGnu/grocksdb v1.8.4 h1:ZMsBpPpJNtRLHiKKp0mI7gW+NT4s7UgfD5xHxx1jVRo=
+github.com/linxGnu/grocksdb v1.8.4/go.mod h1:xZCIb5Muw+nhbDK4Y5UJuOrin5MceOuiXkVUR7vp4WY=
github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=
github.com/magiconair/properties v1.8.6 h1:5ibWZ6iY0NctNGWo87LalDlEZ6R41TqbbDamhfG/Qzo=
github.com/magiconair/properties v1.8.6/go.mod h1:y3VJvCyxH9uVvJTWEGAELF3aiYNyPKd5NZ3oSwXrF60=
+github.com/magiconair/properties v1.8.7 h1:IeQXZAiQcpL9mgcAe1Nu6cX9LLw6ExEHKjN0VQdvPDY=
+github.com/magiconair/properties v1.8.7/go.mod h1:Dhd985XPs7jluiymwWYZ0G4Z61jb3vdS329zhj2hYo0=
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
github.com/mattn/go-colorable v0.1.8/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
github.com/mattn/go-colorable v0.1.9/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc=
@@ -366,12 +414,16 @@ github.com/mattn/go-isatty v0.0.14/go.mod h1:7GGIvUiUoEMVVmxf/4nioHXj79iQHKdU27k
github.com/mattn/go-isatty v0.0.16/go.mod h1:kYGgaQfpe5nmfYZH+SKPsOc2e4SrIfOl2e/yFXSvRLM=
github.com/mattn/go-isatty v0.0.18 h1:DOKFKCQ7FNG2L1rbrmstDN4QVRdS89Nkh85u68Uwp98=
github.com/mattn/go-isatty v0.0.18/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
+github.com/mattn/go-isatty v0.0.19 h1:JITubQf0MOLdlGRuRq+jtsDlekdYPia9ZFsB8h/APPA=
+github.com/mattn/go-isatty v0.0.19/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
github.com/matttproud/golang_protobuf_extensions v1.0.1/go.mod h1:D8He9yQNgCq6Z5Ld7szi9bcBfOoFv/3dc6xSMkL2PC0=
github.com/matttproud/golang_protobuf_extensions v1.0.4 h1:mmDVorXM7PCGKw94cs5zkfA9PSy5pEvNWRP0ET0TIVo=
github.com/matttproud/golang_protobuf_extensions v1.0.4/go.mod h1:BSXmuO+STAnVfrANrmjBb36TMTDstsz7MSK+HVaYKv4=
github.com/mimoo/StrobeGo v0.0.0-20181016162300-f8f6d4d2b643/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM=
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0 h1:QRUSJEgZn2Snx0EmT/QLXibWjSUDjKWvXIT19NBVp94=
github.com/mimoo/StrobeGo v0.0.0-20210601165009-122bf33a46e0/go.mod h1:43+3pMjjKimDBf5Kr4ZFNGbLql1zKkbImw+fZbw3geM=
+github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b h1:QrHweqAtyJ9EwCaGHBu1fghwxIPiopAHV06JlXrMHjk=
+github.com/mimoo/StrobeGo v0.0.0-20220103164710-9a04d6ca976b/go.mod h1:xxLb2ip6sSUts3g1irPVHyk/DGslwQsNOo9I7smJfNU=
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y=
@@ -381,11 +433,15 @@ github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJ
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q=
github.com/modern-go/reflect2 v0.0.0-20180701023420-4b7aa43c6742/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
github.com/modern-go/reflect2 v1.0.1/go.mod h1:bx2lNnkwVCuqBIxFjflWJWanXIb3RllmbCylyMrvgv0=
+github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk=
github.com/mtibben/percent v0.2.1 h1:5gssi8Nqo8QU/r2pynCm+hBQHpkB/uNK7BJCFogWdzs=
github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
+github.com/mwitkow/go-conntrack v0.0.0-20190716064945-2f068394615f/go.mod h1:qRWi+5nqEBWmkhHvq77mSJWrCKwh8bxhgT7d/eI7P4U=
github.com/nxadm/tail v1.4.4/go.mod h1:kenIhsEOeOJmVchQTgglprH7qJGnHDVpk1VPCcaMI8A=
github.com/nxadm/tail v1.4.8 h1:nPr65rt6Y5JFSKQO7qToXr7pePgD6Gwiw05lkbyAQTE=
github.com/nxadm/tail v1.4.8/go.mod h1:+ncqLTQzXmGhMZNUePPaPqPvBxHAIsmXswZKocGu+AU=
+github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a h1:dlRvE5fWabOchtH7znfiFCcOvmIYgOeAS5ifBXBlh9Q=
+github.com/oasisprotocol/curve25519-voi v0.0.0-20230904125328-1f23a7beb09a/go.mod h1:hVoHR2EVESiICEMbg137etN/Lx+lSrHPTD39Z/uE+2s=
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
github.com/onsi/ginkgo v1.12.1/go.mod h1:zj2OWP4+oCPe1qIXoGWkgMRwljMUYCdkwsT2108oapk=
github.com/onsi/ginkgo v1.16.4/go.mod h1:dX+/inL/fNMqNlz0e9LfyB9TswhZpCVdJM/Z6Vvnwo0=
@@ -405,9 +461,13 @@ github.com/pelletier/go-toml v1.9.5 h1:4yBQzkHv+7BHq2PQUZF3Mx0IYxG7LsP222s7Agd3v
github.com/pelletier/go-toml v1.9.5/go.mod h1:u1nR/EPcESfeI/szUZKdtJ0xRNbUoANCkoOuaOx1Y+c=
github.com/pelletier/go-toml/v2 v2.0.7 h1:muncTPStnKRos5dpVKULv2FVd4bMOhNePj9CjgDb8Us=
github.com/pelletier/go-toml/v2 v2.0.7/go.mod h1:eumQOmlWiOPt5WriQQqoM5y18pDHwha2N+QD+EUNTek=
+github.com/pelletier/go-toml/v2 v2.1.0 h1:FnwAJ4oYMvbT/34k9zzHuZNrhlz48GB3/s6at6/MHO4=
+github.com/pelletier/go-toml/v2 v2.1.0/go.mod h1:tJU2Z3ZkXwnxa4DPO899bsyIoywizdUvyaeZurnPPDc=
github.com/petermattis/goid v0.0.0-20180202154549-b0b1615b78e5/go.mod h1:jvVRKCrJTQWu0XVbaOlby/2lO20uSCHEMzzplHXte1o=
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08 h1:hDSdbBuw3Lefr6R18ax0tZ2BJeNB3NehB3trOwYBsdU=
github.com/petermattis/goid v0.0.0-20230317030725-371a4b8eda08/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
+github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc h1:8bQZVK1X6BJR/6nYUPxQEP+ReTsceJTKizeuwjWOPUA=
+github.com/petermattis/goid v0.0.0-20230904192822-1876fd5063bc/go.mod h1:pxMtw7cyUw6B2bRH0ZBANSPg+AoSud1I1iyJHI69jH4=
github.com/pkg/errors v0.8.0/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
@@ -421,23 +481,31 @@ github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5Fsn
github.com/prometheus/client_golang v1.4.0/go.mod h1:e9GMxYsXl05ICDXkRhurwBS4Q3OK1iX/F2sw+iXX5zU=
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
+github.com/prometheus/client_golang v1.16.0 h1:yk/hx9hDbrGHovbci4BY+pRMfSuuat626eFsHb7tmT8=
+github.com/prometheus/client_golang v1.16.0/go.mod h1:Zsulrv/L9oM40tJ7T815tM89lFEugiJ9HzIqaAx4LKc=
github.com/prometheus/client_model v0.0.0-20180712105110-5c3871d89910/go.mod h1:MbSGuTsp3dbXC40dX6PRTWyKYBIrTGTE9sqQNg2J8bo=
github.com/prometheus/client_model v0.0.0-20190129233127-fd36f4220a90/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/client_model v0.3.0 h1:UBgGFHqYdG/TPFD1B1ogZywDqEkwp3fBMvqdiQ7Xew4=
github.com/prometheus/client_model v0.3.0/go.mod h1:LDGWKZIo7rky3hgvBe+caln+Dr3dPggB5dvjtD7w9+w=
+github.com/prometheus/client_model v0.4.0 h1:5lQXD3cAg1OXBf4Wq03gTrXHeaV0TQvGfUooCfx1yqY=
+github.com/prometheus/client_model v0.4.0/go.mod h1:oMQmHW1/JoDwqLtg57MGgP/Fb1CJEYF2imWWhWtMkYU=
github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.9.1/go.mod h1:yhUN8i9wzaXS3w1O07YhxHEBxD+W35wd8bs7vj7HSQ4=
github.com/prometheus/common v0.42.0 h1:EKsfXEYo4JpWMHH5cg+KOUWeuJSov1Id8zGR8eeI1YM=
github.com/prometheus/common v0.42.0/go.mod h1:xBwqVerjNdUDjgODMpudtOMwlOwf2SaTr1yjz4b7Zbc=
+github.com/prometheus/common v0.44.0 h1:+5BrQJwiBB9xsMygAB3TNvpQKOwlkc25LbISbrdOOfY=
+github.com/prometheus/common v0.44.0/go.mod h1:ofAIvZbQ1e/nugmZGz4/qCb9Ap1VoSTIO7x0VV9VvuY=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A=
github.com/prometheus/procfs v0.9.0 h1:wzCHvIvM5SxWqYvwgVL7yJY8Lz3PKn49KQtpgMYJfhI=
github.com/prometheus/procfs v0.9.0/go.mod h1:+pB4zwohETzFnmlpe6yd2lSc+0/46IYZRB/chUwxUZY=
+github.com/prometheus/procfs v0.11.1 h1:xRC8Iq1yyca5ypa9n1EZnWZkt7dwcoRPQwX/5gwaUuI=
+github.com/prometheus/procfs v0.11.1/go.mod h1:eesXgaPo1q7lBpVMoMy0ZOFTth9hBn4W/y0/p/ScXhY=
github.com/rcrowley/go-metrics v0.0.0-20201227073835-cf1acfcdf475 h1:N/ElC8H3+5XpJzTSTfLsJV/mx9Q9g7kxmchpfZyxgzM=
github.com/rogpeppe/fastuuid v1.2.0/go.mod h1:jVj6XXZzXRy/MSR5jhDC/2q6DgLz+nrA6LYCDYWNEvQ=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
@@ -454,12 +522,18 @@ github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2
github.com/spf13/afero v1.1.2/go.mod h1:j4pytiNVoe2o6bmDsKpLACNPDBIoEAkihy7loJ1B0CQ=
github.com/spf13/afero v1.9.2 h1:j49Hj62F0n+DaZ1dDCvhABaPNSGNkt32oRFxI33IEMw=
github.com/spf13/afero v1.9.2/go.mod h1:iUV7ddyEEZPO5gA3zD4fJt6iStLlL+Lg4m2cihcDf8Y=
+github.com/spf13/afero v1.9.5 h1:stMpOSZFs//0Lv29HduCmli3GUfpFoF3Y1Q/aXj/wVM=
+github.com/spf13/afero v1.9.5/go.mod h1:UBogFpq8E9Hx+xc5CNTTEpTnuHVmXDwZcZcE1eb/UhQ=
github.com/spf13/cast v1.3.0/go.mod h1:Qx5cxh0v+4UWYiBimWS+eyWzqEqokIECu5etghLkUJE=
github.com/spf13/cast v1.5.0 h1:rj3WzYc11XZaIZMPKmwP96zkFEnnAmV8s6XbB2aY32w=
github.com/spf13/cast v1.5.0/go.mod h1:SpXXQ5YoyJw6s3/6cMTQuxvgRl3PCJiyaX9p6b155UU=
+github.com/spf13/cast v1.5.1 h1:R+kOtfhWQE6TVQzY+4D7wJLBgkdVasCEFxSUBYBYIlA=
+github.com/spf13/cast v1.5.1/go.mod h1:b9PdjNptOpzXr7Rq1q9gJML/2cdGQAo69NKzQ10KN48=
github.com/spf13/cobra v0.0.5/go.mod h1:3K3wKZymM7VvHMDS9+Akkh4K60UwM26emMESw8tLCHU=
github.com/spf13/cobra v1.6.1 h1:o94oiPyS4KD1mPy2fmcYYHHfCxLqYjJOhGsCHFZtEzA=
github.com/spf13/cobra v1.6.1/go.mod h1:IOw/AERYS7UzyrGinqmz6HLUo219MORXGxhbaJUqzrY=
+github.com/spf13/cobra v1.7.0 h1:hyqWnYt1ZQShIddO5kBpj3vu05/++x6tJ6dg8EC572I=
+github.com/spf13/cobra v1.7.0/go.mod h1:uLxZILRyS/50WlhOIKD7W6V5bgeIt+4sICxh6uRMrb0=
github.com/spf13/jwalterweatherman v1.0.0/go.mod h1:cQK4TGJAtQXfYWX+Ddv3mKDzgVb68N+wFjFa4jdeBTo=
github.com/spf13/jwalterweatherman v1.1.0 h1:ue6voC5bR5F8YxI5S67j9i582FU4Qvo2bmqnqMYADFk=
github.com/spf13/jwalterweatherman v1.1.0/go.mod h1:aNWZUN0dPAAO/Ljvb5BEdw96iTZ0EXowPYD95IqWIGo=
@@ -469,6 +543,8 @@ github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An
github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s=
github.com/spf13/viper v1.14.0 h1:Rg7d3Lo706X9tHsJMUjdiwMpHB7W8WnSVOssIY+JElU=
github.com/spf13/viper v1.14.0/go.mod h1:WT//axPky3FdvXHzGw33dNdXXXfFQqmEalje+egj8As=
+github.com/spf13/viper v1.16.0 h1:rGGH0XDZhdUOryiDWjmIvUSWpbNqisK8Wk0Vyefw8hc=
+github.com/spf13/viper v1.16.0/go.mod h1:yg78JgCJcbrQOvV9YLXgkLaZqUidkY9K+Dd1FofRzQg=
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
@@ -485,8 +561,12 @@ github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/stretchr/testify v1.8.2 h1:+h33VjcLVPDHtOdpUCuF+7gSuG3yGIftsP1YvFihtJ8=
github.com/stretchr/testify v1.8.2/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
+github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
+github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
github.com/subosito/gotenv v1.4.1 h1:jyEFiXpy21Wm81FBN71l9VoMMV8H8jG+qIK3GCpY6Qs=
github.com/subosito/gotenv v1.4.1/go.mod h1:ayKnFf/c6rvx/2iiLrJUk1e6plDbT3edrFNGqEflhK0=
+github.com/subosito/gotenv v1.6.0 h1:9NlTDc1FTs4qu0DDq7AEtTPNw6SVm7uBMsUCUjABIf8=
+github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSWPKKo0FU=
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d h1:vfofYNRScrDdvS342BElfbETmL1Aiz3i2t0zfRj16Hs=
github.com/syndtr/goleveldb v1.0.1-0.20220721030215-126854af5e6d/go.mod h1:RRCYJbIwD5jmqPI9XoAFR0OcDxqUctll6zUj/+B4S48=
github.com/tecbot/gorocksdb v0.0.0-20191217155057-f0fad39f321c h1:g+WoO5jjkqGAzHWCjJB1zZfXPIAaDpzXIEJ0eS6B5Ok=
@@ -508,6 +588,8 @@ gitlab.com/unit410/edwards25519 v0.0.0-20220725154547-61980033348e h1:/QfokHt2yG
gitlab.com/unit410/edwards25519 v0.0.0-20220725154547-61980033348e/go.mod h1:lTSPILLBMt6qQOJgsiarbW85JhpkhoOfW2EBkxkcuSI=
gitlab.com/unit410/threshold-ed25519 v0.0.0-20220725172740-6ee731f539ac h1:SUxQNWwBUVFdvRP72Wi1wZ8K2iD7+SXFfMUMJyMCJjc=
gitlab.com/unit410/threshold-ed25519 v0.0.0-20220725172740-6ee731f539ac/go.mod h1:2TURxKmaBFbTDxXQa+B2nGuKSRWD0Jlcc3LETTAnSS0=
+gitlab.com/unit410/threshold-ed25519 v0.0.0-20220812172601-56783212c4cc h1:ESmaQH1+uOLW0wOIPT4EVLh+gwKdmKovr+eZg4jWUNs=
+gitlab.com/unit410/threshold-ed25519 v0.0.0-20220812172601-56783212c4cc/go.mod h1:1CIpwbV+rSyzoBVr6Ok9vvEP7UHrW/d0zEB+jU6+E3o=
go.etcd.io/bbolt v1.3.5/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ=
go.etcd.io/bbolt v1.3.7 h1:j+zJOnnEjF/kyHlDDgGnVL/AIqIJPq8UoB2GSNfkUfQ=
go.etcd.io/bbolt v1.3.7/go.mod h1:N9Mkw9X8x5fupy0IKsmuqVtoGDyxsaDlbk4Rd05IAQw=
@@ -519,10 +601,14 @@ go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
+go.uber.org/atomic v1.7.0/go.mod h1:fEN4uk6kAWBTFdckzkM89CLk9XfWZrxpCo0nPH17wJc=
+go.uber.org/goleak v1.1.10/go.mod h1:8a7PlsEVH3e/a/GLqe5IIrQx6GzcnRmZEufDUTk4A7A=
go.uber.org/goleak v1.1.12 h1:gZAh5/EyT/HQwlpkCy6wTpqfH9H8Lz8zbm3dZh+OyzA=
go.uber.org/goleak v1.1.12/go.mod h1:cwTWslyiVhfpKIDGSZEM2HlOvcqm+tG4zioyIeLoqMQ=
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
+go.uber.org/multierr v1.6.0/go.mod h1:cdWPpRnG4AhwMwsgIHip0KRBQjJy5kYEpYjJxpXp9iU=
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
+go.uber.org/zap v1.18.1/go.mod h1:xg/QME4nWcxGxrpdeYfq7UvYrLh66cuVKdrbD1XF/NI=
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20181203042331-505ab145d0a9/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
@@ -534,8 +620,11 @@ golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPh
golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20211108221036-ceb1ce70b4fa/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20220722155217-630584e8d5aa/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.8.0 h1:pd9TJtTueMTVQXzk8E2XESSMQDj/U7OUu0PqJqPXQjQ=
golang.org/x/crypto v0.8.0/go.mod h1:mRqEX+O9/h5TFCrQhkgjo2yKi0yYA+9ecGkdQoHrywE=
+golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
+golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -548,6 +637,8 @@ golang.org/x/exp v0.0.0-20200207192155-f17229e696bd/go.mod h1:J/WKrq2StrnmMY6+EH
golang.org/x/exp v0.0.0-20200224162631-6cc2880d07d6/go.mod h1:3jZMyOhIsHpP37uCMkUooju7aAi5cS1Q23tOzKc+0MU=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc h1:mCRnTeVUjcrhlRmO0VK8a6k6Rrf6TF9htwo2pJVSjIU=
golang.org/x/exp v0.0.0-20230515195305-f3d0a9c9a5cc/go.mod h1:V1LtkGg67GoY2N1AnLN78QLrzxkLyJw7RJb1gzOOz9w=
+golang.org/x/exp v0.0.0-20230905200255-921286631fa9 h1:GoHiUyI/Tp2nVkLI2mCxVkOjsbSXD66ic0XW0js0R9g=
+golang.org/x/exp v0.0.0-20230905200255-921286631fa9/go.mod h1:S2oDrQGGwySpoQPVqRShND87VCbxmc6bL1Yd2oYrm6k=
golang.org/x/image v0.0.0-20190227222117-0694c2d4d067/go.mod h1:kZ7UVZpmo3dzQBMxlp+ypCbDeSB+sBbTgSJuh5dn5js=
golang.org/x/image v0.0.0-20190802002840-cff245a6509b/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -612,10 +703,13 @@ golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v
golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96bSt6lcn1PtDYWL6XObtHCRCNQM=
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20210907225631-ff17edfbf26d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.9.0 h1:aWJ/m6xSmxWBx+V0XRHTlrYrPG56jKsLdTFmsSsCzOM=
golang.org/x/net v0.9.0/go.mod h1:d48xBJpPfHeWQsugry2m+kC02ZBRGRgulfHnEXEuWns=
+golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
+golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -638,6 +732,8 @@ golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
+golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
+golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
@@ -692,6 +788,7 @@ golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220503163025-988cb79eb6c6/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
@@ -702,6 +799,8 @@ golang.org/x/sys v0.0.0-20221010170243-090e33056c14/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.7.0 h1:3jlCCIQZPdOYu1h8BkNvLz8Kgwtae2cagcG/VamtZRU=
golang.org/x/sys v0.7.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
+golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
golang.org/x/term v0.7.0 h1:BEvjmm5fURWqcfbSKTdpkDXYBrUS1c0m8agp14W48vQ=
@@ -716,6 +815,8 @@ golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/text v0.9.0 h1:2sjJmO8cDvYveuX97RDLsxlyUxLl+GHoLxBiRdHllBE=
golang.org/x/text v0.9.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8=
+golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
+golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -735,6 +836,7 @@ golang.org/x/tools v0.0.0-20190628153133-6cdbf07be9d0/go.mod h1:/rFqwRUd4F7ZHNgw
golang.org/x/tools v0.0.0-20190816200558-6889da9d5479/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20190911174233-4f2ddba30aff/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191012152004-8de300cfc20a/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
+golang.org/x/tools v0.0.0-20191108193012-7d206e10da11/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191113191852-77e3bb0ad9e7/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191115202509-3a792d9c32b2/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
@@ -844,6 +946,10 @@ google.golang.org/genproto v0.0.0-20210226172003-ab064af71705/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4 h1:DdoeryqhaXp1LtT/emMP1BRJPHHKFi5akj/nbx/zNTA=
google.golang.org/genproto v0.0.0-20230306155012-7f2fa6fef1f4/go.mod h1:NWraEVixdDnqcqQ30jipen1STv2r/n24Wb7twVTGR4s=
+google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb h1:XFBgcDwm7irdHTbz4Zk2h7Mh+eis4nfJEFQFYzJzuIA=
+google.golang.org/genproto v0.0.0-20230913181813-007df8e322eb/go.mod h1:yZTlhN0tQnXo3h00fuXNCxJdLdIdnVFVBaRJ5LWBbw4=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13 h1:N3bU/SQDCDyD6R528GJ/PwW9KjYcJA3dgyH+MovAkIM=
+google.golang.org/genproto/googleapis/rpc v0.0.0-20230920204549-e6e6cdab5c13/go.mod h1:KSqppvjFjtoCI+KGd4PELB0qLNxdJHRGqRI09mB6pQA=
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
google.golang.org/grpc v1.21.1/go.mod h1:oYelfM1adQP15Ek0mdvEgi9Df8B9CZIaU1084ijfRaM=
@@ -865,6 +971,8 @@ google.golang.org/grpc v1.36.0/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.55.0 h1:3Oj82/tFSCeUrRTg/5E/7d/W5A1tj6Ky1ABAuZuv5ag=
google.golang.org/grpc v1.55.0/go.mod h1:iYEXKGkEBhg1PjZQvoYEVPTDkHo1/bjTnfwTeGONTY8=
+google.golang.org/grpc v1.58.2 h1:SXUpjxeVF3FKrTYQI4f4KvbGD5u2xccdYdurwowix5I=
+google.golang.org/grpc v1.58.2/go.mod h1:tgX3ZQDlNJGU96V6yHh1T/JeoBQ2TXdr43YbYSsCJk0=
google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8=
google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0=
google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM=
@@ -880,6 +988,8 @@ google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQ
google.golang.org/protobuf v1.27.1/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.30.0 h1:kPPoIgf3TsEvrm0PFe15JQ+570QVxYzEvvHqChK+cng=
google.golang.org/protobuf v1.30.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
+google.golang.org/protobuf v1.31.0 h1:g0LDEJHgrBl9N9r17Ru3sqWhkIx2NB67okBHPwC7hs8=
+google.golang.org/protobuf v1.31.0/go.mod h1:HV8QOd/L58Z+nl8r43ehVNZIU/HEI6OcFqwMG9pJV4I=
gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
@@ -896,10 +1006,12 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.3/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
+gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/pkg/multiresolver/multi_test.go b/pkg/multiresolver/multi_test.go
index 888237fe..46d91512 100644
--- a/pkg/multiresolver/multi_test.go
+++ b/pkg/multiresolver/multi_test.go
@@ -9,11 +9,14 @@ import (
"testing"
"time"
+ "github.com/cometbft/cometbft/libs/log"
+
"github.com/strangelove-ventures/horcrux/pkg/node"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner"
+ proto "github.com/strangelove-ventures/horcrux/pkg/proto"
grpcretry "github.com/grpc-ecosystem/go-grpc-middleware/retry"
"github.com/strangelove-ventures/horcrux/pkg/multiresolver"
- "github.com/strangelove-ventures/horcrux/pkg/proto"
"github.com/stretchr/testify/require"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
@@ -27,26 +30,44 @@ func createListener(nodeID string, homedir string) (string, func(), error) {
port := strconv.Itoa(sock.Addr().(*net.TCPAddr).Port)
+ // Initiliaze the localcosign as an ILocalCosigner.
+ cosign := pcosigner.Cosigner{}
+ vlocalcosign := pcosigner.NewLocalCosigner(
+ log.NewNopLogger(), nil, nil, cosign)
+
+ var localcosign pcosigner.ILocalCosigner
+ localcosign = vlocalcosign
+ var remoteCosigners []pcosigner.IRemoteCosigner
+ remoteCosigners = append(remoteCosigners, vlocalcosign)
+
+ var peers []pcosigner.ICosigner
+ peers = append(peers, vlocalcosign)
+
+ timeDuration := 500 * time.Millisecond
+
s := node.NewRaftStore(
nodeID,
homedir,
"127.0.0.1:"+port,
500*time.Millisecond,
- nil)
+ log.NewNopLogger())
// Need to set pointers to avoid nil pointers.
- var cosigners []node.ICosigner
- var timeDuration time.Duration
- thresholdvalidator := node.NewThresholdValidator(nil, nil, 0, timeDuration, 0, nil, cosigners, nil)
+ thresholdvalidator := node.NewThresholdValidator(log.NewNopLogger(), nil, 0, timeDuration, 0, localcosign, remoteCosigners, s)
s.SetThresholdValidator(thresholdvalidator)
transportManager, err := s.Open()
if err != nil {
+ fmt.Printf("Error opening transport manager: %v\n", err)
return "", nil, err
}
grpcServer := grpc.NewServer()
- proto.RegisterICosignerGRPCServerServer(grpcServer, node.NewGRPCServer(nil, nil, s))
+
+ server := node.NewGRPCServer(s)
+ proto.RegisterIRaftGRPCServer(grpcServer, server.RaftGRPCServer)
+ proto.RegisterICosignerGRPCServer(grpcServer, server.CosignGRPCServer)
+
transportManager.Register(grpcServer)
go func() {
@@ -97,8 +118,8 @@ func TestMultiResolver(t *testing.T) {
ctx, cancelFunc := context.WithTimeout(context.Background(), 30*time.Second)
defer cancelFunc()
- grpcClient := proto.NewICosignerGRPCServerClient(connDNS)
- _, err = grpcClient.GetLeader(ctx, &proto.CosignerGRPCGetLeaderRequest{})
+ grpcClient := proto.NewIRaftGRPCClient(connDNS)
+ _, err = grpcClient.GetLeader(ctx, &proto.RaftGRPCGetLeaderRequest{})
require.NoError(t, err)
connIP, err := grpc.Dial(targetIP,
@@ -110,7 +131,7 @@ func TestMultiResolver(t *testing.T) {
require.NoError(t, err)
defer connIP.Close()
- grpcClient = proto.NewICosignerGRPCServerClient(connIP)
- _, err = grpcClient.GetLeader(ctx, &proto.CosignerGRPCGetLeaderRequest{})
+ grpcClient = proto.NewIRaftGRPCClient(connIP)
+ _, err = grpcClient.GetLeader(ctx, &proto.RaftGRPCGetLeaderRequest{})
require.NoError(t, err)
}
diff --git a/pkg/node/grpc_server.go b/pkg/node/grpc_server.go
index 13db2a01..ed02859b 100644
--- a/pkg/node/grpc_server.go
+++ b/pkg/node/grpc_server.go
@@ -1,3 +1,4 @@
+// This is responsible for the RAFT & Cosigners Connections.
package node
import (
@@ -5,43 +6,76 @@ import (
"fmt"
"time"
+ "github.com/cometbft/cometbft/libs/log"
"github.com/strangelove-ventures/horcrux/pkg/pcosigner"
"github.com/strangelove-ventures/horcrux/pkg/types"
"github.com/hashicorp/raft"
+
"github.com/strangelove-ventures/horcrux/pkg/proto"
)
// Enures that GRPCServer implements the proto.CosignerGRPCServer interface.
-var _ proto.ICosignerGRPCServerServer = &GRPCServer{}
+var _ proto.ICosignerGRPCServer = &GRPCServer{}
+var _ proto.IRaftGRPCServer = &GRPCServer{}
+
+// TODO Implement as
+
+type CosignGRPCServer struct {
+ cosigner pcosigner.ILocalCosigner
+
+ logger log.Logger
+ proto.UnimplementedICosignerGRPCServer
+ // Promoted Fields is embedded to have forward compatiblitity
+}
+
+type RaftGRPCServer struct {
+ // logger log.Logger
+ //peers []pcosigner.ICosigner
+ // The "node's" ThresholdValidator
+ // thresholdValidator *ThresholdValidator
+
+ // The "node's" RaftStore
+ raftStore *RaftStore
-type GRPCServer struct {
- cosigner *pcosigner.LocalCosigner // The "node's" LocalCosigner
- thresholdValidator *ThresholdValidator // The "node's" ThresholdValidator
- raftStore *RaftStore // The "node's" RaftStore
// Promoted Fields is embedded to have forward compatiblitity
- proto.UnimplementedICosignerGRPCServerServer
+ proto.UnimplementedIRaftGRPCServer
+}
+type GRPCServer struct {
+ *CosignGRPCServer
+ // The "node's" LocalCosigner
+ *RaftGRPCServer
}
// NewGRPCServer returns a new GRPCServer.
func NewGRPCServer(
- cosigner *pcosigner.LocalCosigner,
- thresholdValidator *ThresholdValidator,
+ //cosigner pcosigner.ILocalCosigner,
+ // thresholdValidator *ThresholdValidator,
raftStore *RaftStore,
) *GRPCServer {
return &GRPCServer{
- // TODO: This is a hack to get around the fact that the cosigner is not a?
- cosigner: cosigner,
- thresholdValidator: thresholdValidator,
- raftStore: raftStore,
+ CosignGRPCServer: &CosignGRPCServer{cosigner: raftStore.thresholdValidator.thresholdalgorithm.GetLocalCosign()}, // The nodes local cosigner
+ RaftGRPCServer: &RaftGRPCServer{raftStore: raftStore},
+ // peers: pcosigner.FromIRemoteToICosigner(raftStore.thresholdValidator.thresholdalgorithm.GetPeers())}, // The nodes raftStore
+ }
+}
+
+func NewRaftGRPCServer(
+ //cosigner pcosigner.ILocalCosigner,
+ // thresholdValidator *ThresholdValidator,
+ raftStore *RaftStore,
+) *RaftGRPCServer {
+ return &RaftGRPCServer{
+ raftStore: raftStore,
+ // peers: pcosigner.FromIRemoteToICosigner(raftStore.thresholdValidator.thresholdalgorithm.GetPeers()),
}
}
// SignBlock "pseudo-implements" the ICosignerGRPCServer interface in pkg/proto/cosigner_grpc_server_grpc.pb.go
-func (rpc *GRPCServer) SignBlock(
+func (rpc *RaftGRPCServer) SignBlock(
_ context.Context,
- req *proto.CosignerGRPCSignBlockRequest,
-) (*proto.CosignerGRPCSignBlockResponse, error) {
+ req *proto.RaftGRPCSignBlockRequest,
+) (*proto.RaftGRPCSignBlockResponse, error) {
block := &Block{
Height: req.Block.GetHeight(),
Round: req.Block.GetRound(),
@@ -50,16 +84,54 @@ func (rpc *GRPCServer) SignBlock(
Timestamp: time.Unix(0, req.Block.GetTimestamp()),
}
// this
- res, _, err := rpc.thresholdValidator.SignBlock(req.ChainID, block)
+ res, _, err := rpc.raftStore.thresholdValidator.SignBlock(req.ChainID, block)
if err != nil {
return nil, err
}
- return &proto.CosignerGRPCSignBlockResponse{
+ return &proto.RaftGRPCSignBlockResponse{
Signature: res,
}, nil
}
-func (rpc *GRPCServer) SetNoncesAndSign(
+// TransferLeadership pseudo-implements the ICosignerGRPCServer interface in pkg/proto/cosigner_grpc_server_grpc.pb.go
+func (rpc *RaftGRPCServer) TransferLeadership(
+ _ context.Context,
+ req *proto.RaftGRPCTransferLeadershipRequest,
+) (*proto.RaftGRPCTransferLeadershipResponse, error) {
+ if rpc.raftStore.raft.State() != raft.Leader {
+ return &proto.RaftGRPCTransferLeadershipResponse{}, nil
+ }
+ leaderID := req.GetLeaderID()
+ if leaderID != "" {
+ // TODO: Not an elegant fix. Se other notes.
+ for _, c := range rpc.raftStore.thresholdValidator.thresholdalgorithm.GetPeers() {
+ shardID := fmt.Sprint(c.GetID())
+ if shardID == leaderID {
+ raftAddress := p2pURLToRaftAddress(c.GetAddress())
+ fmt.Printf("Transferring leadership to ID: %s - Address: %s\n", shardID, raftAddress)
+ rpc.raftStore.raft.LeadershipTransferToServer(raft.ServerID(shardID), raft.ServerAddress(raftAddress))
+ return &proto.RaftGRPCTransferLeadershipResponse{LeaderID: shardID, LeaderAddress: raftAddress}, nil
+ }
+ }
+ }
+ fmt.Printf("Transferring leadership to next candidate\n")
+ rpc.raftStore.raft.LeadershipTransfer()
+ return &proto.RaftGRPCTransferLeadershipResponse{}, nil
+}
+
+// GetLeader pseudo-implements the ICosignerGRPCServer interface in pkg/proto/cosigner_grpc_server_grpc.pb.go
+// GetLeader gets the current raft cluster leader and send it as respons.
+func (rpc *RaftGRPCServer) GetLeader(
+ context.Context,
+ *proto.RaftGRPCGetLeaderRequest,
+) (*proto.RaftGRPCGetLeaderResponse, error) {
+ leader := rpc.raftStore.GetLeader()
+ return &proto.RaftGRPCGetLeaderResponse{Leader: string(leader)}, nil
+}
+
+// SetNoncesAndSign implements the ICosignerGRPCServer interface.
+// The CosignGRPCServer resonse to the request from the client.
+func (rpc *CosignGRPCServer) SetNoncesAndSign(
_ context.Context,
req *proto.CosignerGRPCSetNoncesAndSignRequest,
) (*proto.CosignerGRPCSetNoncesAndSignResponse, error) {
@@ -71,7 +143,7 @@ func (rpc *GRPCServer) SetNoncesAndSign(
SignBytes: req.GetSignBytes(),
})
if err != nil {
- rpc.raftStore.logger.Error(
+ rpc.logger.Error(
"Failed to sign with shard",
"chain_id", req.ChainID,
"height", req.Hrst.Height,
@@ -81,7 +153,7 @@ func (rpc *GRPCServer) SetNoncesAndSign(
)
return nil, err
}
- rpc.raftStore.logger.Info(
+ rpc.logger.Info(
"Signed with shard",
"chain_id", req.ChainID,
"height", req.Hrst.Height,
@@ -96,7 +168,7 @@ func (rpc *GRPCServer) SetNoncesAndSign(
}
// GetNonces implements the ICosignerGRPCServer interface.
-func (rpc *GRPCServer) GetNonces(
+func (rpc *CosignGRPCServer) GetNonces(
_ context.Context,
req *proto.CosignerGRPCGetNoncesRequest,
) (*proto.CosignerGRPCGetNoncesResponse, error) {
@@ -111,38 +183,3 @@ func (rpc *GRPCServer) GetNonces(
Nonces: pcosigner.CosignerNonces(res.Nonces).ToProto(),
}, nil
}
-
-// TransferLeadership pseudo-implements the ICosignerGRPCServer interface in pkg/proto/cosigner_grpc_server_grpc.pb.go
-func (rpc *GRPCServer) TransferLeadership(
- _ context.Context,
- req *proto.CosignerGRPCTransferLeadershipRequest,
-) (*proto.CosignerGRPCTransferLeadershipResponse, error) {
- if rpc.raftStore.raft.State() != raft.Leader {
- return &proto.CosignerGRPCTransferLeadershipResponse{}, nil
- }
- leaderID := req.GetLeaderID()
- if leaderID != "" {
- for _, c := range rpc.raftStore.thresholdValidator.peerCosigners {
- shardID := fmt.Sprint(c.GetID())
- if shardID == leaderID {
- raftAddress := p2pURLToRaftAddress(c.GetAddress())
- fmt.Printf("Transferring leadership to ID: %s - Address: %s\n", shardID, raftAddress)
- rpc.raftStore.raft.LeadershipTransferToServer(raft.ServerID(shardID), raft.ServerAddress(raftAddress))
- return &proto.CosignerGRPCTransferLeadershipResponse{LeaderID: shardID, LeaderAddress: raftAddress}, nil
- }
- }
- }
- fmt.Printf("Transferring leadership to next candidate\n")
- rpc.raftStore.raft.LeadershipTransfer()
- return &proto.CosignerGRPCTransferLeadershipResponse{}, nil
-}
-
-// GetLeader pseudo-implements the ICosignerGRPCServer interface in pkg/proto/cosigner_grpc_server_grpc.pb.go
-// GetLeader gets the current raft cluster leader and send it as respons.
-func (rpc *GRPCServer) GetLeader(
- context.Context,
- *proto.CosignerGRPCGetLeaderRequest,
-) (*proto.CosignerGRPCGetLeaderResponse, error) {
- leader := rpc.raftStore.GetLeader()
- return &proto.CosignerGRPCGetLeaderResponse{Leader: string(leader)}, nil
-}
diff --git a/pkg/node/icosigner.go b/pkg/node/icosigner.go
deleted file mode 100644
index 105cfec5..00000000
--- a/pkg/node/icosigner.go
+++ /dev/null
@@ -1,30 +0,0 @@
-package node
-
-import (
- cometcrypto "github.com/cometbft/cometbft/crypto"
- "github.com/strangelove-ventures/horcrux/pkg/pcosigner"
- "github.com/strangelove-ventures/horcrux/pkg/types"
-)
-
-// ICosigner interface is a set of methods for an m-of-n threshold signature.
-// This interface abstracts the underlying key storage and management
-type ICosigner interface {
- // GetID should return the id number of the cosigner
- // The ID is the shamir index: 1, 2, etc...
- GetID() int
-
- // GetAddress gets the P2P URL (GRPC and Raft)
- GetAddress() string
-
- // GetPubKey gets the combined public key (permament)
- // Not used by Remote Cosigner
- GetPubKey(chainID string) (cometcrypto.PubKey, error)
-
- VerifySignature(chainID string, payload, signature []byte) bool
-
- // GetNonces requests nonce frpm the peer cosigners
- GetNonces(chainID string, hrst types.HRSTKey) (*pcosigner.CosignerNoncesResponse, error)
-
- // Sign the requested bytes
- SetNoncesAndSign(req pcosigner.CosignerSetNoncesAndSignRequest) (*pcosigner.CosignerSignResponse, error)
-}
diff --git a/pkg/node/leader_mock.go b/pkg/node/leader_mock.go
index 40863e1e..78034d77 100644
--- a/pkg/node/leader_mock.go
+++ b/pkg/node/leader_mock.go
@@ -6,22 +6,23 @@ import (
"sync"
"time"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner"
"github.com/strangelove-ventures/horcrux/pkg/types"
)
var _ ILeader = (*MockLeader)(nil)
type MockLeader struct {
- id int
-
- mu sync.Mutex
- leader *ThresholdValidator
+ id int
+ cosigner pcosigner.ICosigner
+ mu sync.Mutex
+ leader *ThresholdValidator
}
func (m *MockLeader) IsLeader() bool {
m.mu.Lock()
defer m.mu.Unlock()
- return m.leader != nil && m.leader.myCosigner.GetID() == m.id
+ return m.leader != nil && m.cosigner.GetID() == m.id
}
func (m *MockLeader) SetLeader(tv *ThresholdValidator) {
diff --git a/pkg/node/raft_events.go b/pkg/node/raft_events.go
index 43230d6c..e9bffd31 100644
--- a/pkg/node/raft_events.go
+++ b/pkg/node/raft_events.go
@@ -1,15 +1,15 @@
package node
import (
+ "context"
"encoding/json"
"errors"
"time"
- "github.com/strangelove-ventures/horcrux/pkg/pcosigner"
- "github.com/strangelove-ventures/horcrux/pkg/types"
-
"github.com/strangelove-ventures/horcrux/pkg/metrics"
"github.com/strangelove-ventures/horcrux/pkg/proto"
+ "github.com/strangelove-ventures/horcrux/pkg/types"
+
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
)
@@ -18,6 +18,14 @@ const (
raftEventLSS = "LSS"
)
+const (
+ rpcTimeout = 4 * time.Second
+)
+
+func GetContext() (context.Context, context.CancelFunc) {
+ return context.WithTimeout(context.Background(), rpcTimeout)
+}
+
func (f *fsm) getEventHandler(key string) func(string) {
return map[string]func(string){
raftEventLSS: f.handleLSSEvent,
@@ -48,10 +56,18 @@ func (f *fsm) handleLSSEvent(value string) {
return
}
_ = f.thresholdValidator.SaveLastSignedState(lss.ChainID, lss.SignStateConsensus)
- _ = f.thresholdValidator.myCosigner.SaveLastSignedState(lss.ChainID, lss.SignStateConsensus)
+ if err != nil {
+ f.logger.Error("[error] - thresholdValidator.SaveLastSignedState %v", err)
+ // Our ephemeral secret parts are required, cannot proceed
+ }
+ _ = f.thresholdValidator.thresholdalgorithm.SaveLastSignedState(lss.ChainID, lss.SignStateConsensus)
+ if err != nil {
+ f.logger.Error("[error] - thresholdalgorithm.SaveLastSignedState %v", err)
+ // Our ephemeral secret parts are required, cannot proceed
+ }
}
-func (s *RaftStore) getLeaderGRPCClient() (proto.ICosignerGRPCServerClient, *grpc.ClientConn, error) {
+func (s *RaftStore) getLeaderGRPCClient() (proto.IRaftGRPCClient, *grpc.ClientConn, error) {
var leader string
for i := 0; i < 30; i++ {
leader = string(s.GetLeader())
@@ -68,18 +84,20 @@ func (s *RaftStore) getLeaderGRPCClient() (proto.ICosignerGRPCServerClient, *grp
if err != nil {
return nil, nil, err
}
- return proto.NewICosignerGRPCServerClient(conn), conn, nil
+
+ return proto.NewIRaftGRPCClient(conn), conn, nil
}
+// SignBlock implements the ILeader interface
func (s *RaftStore) SignBlock(req ValidatorSignBlockRequest) (*ValidatorSignBlockResponse, error) {
client, conn, err := s.getLeaderGRPCClient()
if err != nil {
return nil, err
}
defer conn.Close()
- context, cancelFunc := pcosigner.GetContext()
+ context, cancelFunc := GetContext()
defer cancelFunc()
- res, err := client.SignBlock(context, &proto.CosignerGRPCSignBlockRequest{
+ res, err := client.SignBlock(context, &proto.RaftGRPCSignBlockRequest{
ChainID: req.ChainID,
Block: req.Block.toProto(),
})
diff --git a/pkg/node/raft_store.go b/pkg/node/raft_store.go
index 527ec0c2..e066f7ef 100644
--- a/pkg/node/raft_store.go
+++ b/pkg/node/raft_store.go
@@ -18,6 +18,7 @@ import (
"sync"
"time"
+ "github.com/strangelove-ventures/horcrux/pkg/proto"
"github.com/strangelove-ventures/horcrux/pkg/types"
"github.com/Jille/raft-grpc-leader-rpc/leaderhealth"
@@ -27,7 +28,7 @@ import (
"github.com/cometbft/cometbft/libs/service"
"github.com/hashicorp/raft"
boltdb "github.com/hashicorp/raft-boltdb/v2"
- "github.com/strangelove-ventures/horcrux/pkg/proto"
+
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
"google.golang.org/grpc/reflection"
@@ -67,7 +68,7 @@ type RaftStore struct {
// NewRaftStore returns a new RaftStore.
func NewRaftStore(
nodeID string, directory string, bindAddress string, timeout time.Duration,
- logger log.Logger) *RaftStore {
+ logger log.Logger) /*, localCosigner pcosigner.ILocalCosigner, peers []pcosigner.ICosigner) */ *RaftStore {
cosignerRaftStore := &RaftStore{
NodeID: nodeID,
RaftDir: directory,
@@ -77,6 +78,11 @@ func NewRaftStore(
logger: logger,
}
+ // err := cosignerRaftStore.OnStart()
+ // if err != nil {
+ // fmt.Printf("cosignerRaftStore.onStart: %v", err)
+ // panic(err)
+ // }
cosignerRaftStore.BaseService = *service.NewBaseService(logger, "CosignerRaftStore", cosignerRaftStore)
return cosignerRaftStore
}
@@ -98,12 +104,15 @@ func (s *RaftStore) init() error {
}
transportManager, err := s.Open()
if err != nil {
+ fmt.Printf("s.Open: %v", err)
return err
}
// Create a new gRPC server which is used by both the Raft, the threshold validator and the cosigner
grpcServer := grpc.NewServer()
- proto.RegisterICosignerGRPCServerServer(grpcServer,
- NewGRPCServer(s.thresholdValidator.myCosigner, s.thresholdValidator, s))
+
+ server := NewGRPCServer(s)
+ proto.RegisterIRaftGRPCServer(grpcServer, server.RaftGRPCServer)
+ proto.RegisterICosignerGRPCServer(grpcServer, server.CosignGRPCServer)
transportManager.Register(grpcServer)
leaderhealth.Setup(s.raft, grpcServer, []string{"Leader"})
raftadmin.Register(grpcServer, s.raft)
@@ -116,11 +125,9 @@ func (s *RaftStore) OnStart() error {
go func() {
err := s.init()
if err != nil {
- fmt.Println("RAFTSTORE")
panic(err)
}
}()
-
return nil
}
@@ -139,7 +146,8 @@ func (s *RaftStore) Open() (*raftgrpctransport.Manager, error) {
// Setup Raft configuration.
config := raft.DefaultConfig()
config.LocalID = raft.ServerID(s.NodeID)
- config.LogLevel = "ERROR"
+ //fmt.Printf("Node ID %s\n", s.NodeID)
+ config.LogLevel = "DEBUG"
// Create the snapshot store. This allows the Raft to truncate the log.
snapshots, err := raft.NewFileSnapshotStore(s.RaftDir, retainSnapshotCount, os.Stderr)
@@ -161,6 +169,8 @@ func (s *RaftStore) Open() (*raftgrpctransport.Manager, error) {
}
raftAddress := raft.ServerAddress(p2pURLToRaftAddress(s.RaftBind))
+ fmt.Printf("Node Bind %s\n", s.RaftBind)
+ fmt.Printf("raftaddress %s\n", raftAddress)
// Setup Raft communication.
transportManager := raftgrpctransport.New(raftAddress, []grpc.DialOption{
@@ -182,15 +192,18 @@ func (s *RaftStore) Open() (*raftgrpctransport.Manager, error) {
},
},
}
-
- for _, c := range s.thresholdValidator.peerCosigners {
+ // This is also a not so nice fix.
+ for _, c := range s.thresholdValidator.thresholdalgorithm.GetPeers() {
+ fmt.Printf("Adding peer to raft cluster \n\tid: %v, \n\taddress: %s\n", c.GetID(), c.GetAddress())
configuration.Servers = append(configuration.Servers, raft.Server{
ID: raft.ServerID(fmt.Sprint(c.GetID())),
Address: raft.ServerAddress(p2pURLToRaftAddress(c.GetAddress())),
})
}
+ fmt.Printf("Configuration: %v\n", configuration)
s.raft.BootstrapCluster(configuration)
+ // fmt.Printf("Leader: %s \n", s.GetLeader())
return transportManager, nil
}
@@ -212,7 +225,7 @@ func (s *RaftStore) Emit(key string, value interface{}) error {
// Set sets the value for the given key.
func (s *RaftStore) Set(key, value string) error {
if !s.IsLeader() {
- return fmt.Errorf("not leader")
+ return fmt.Errorf("not leader, %v is leader", s.GetLeader())
}
c := &command{
@@ -292,9 +305,12 @@ func (s *RaftStore) IsLeader() bool {
func (s *RaftStore) GetLeader() raft.ServerAddress {
if s == nil || s.raft == nil {
+ fmt.Printf("s is nil %v, or s.raft is nil %v", s, s.raft)
return ""
}
- return s.raft.Leader()
+ add, id := s.raft.LeaderWithID()
+ fmt.Printf("\naddress is: \n\t%s\nid is:\n\t%s\n", add, id)
+ return add
}
func (s *RaftStore) ShareSigned(lss types.ChainSignStateConsensus) error {
diff --git a/pkg/node/raft_store_test.go b/pkg/node/raft_store_test.go
index 912dde3d..39a82d60 100644
--- a/pkg/node/raft_store_test.go
+++ b/pkg/node/raft_store_test.go
@@ -1,12 +1,15 @@
-package node
+package node_test
import (
"crypto/rand"
+ "fmt"
"os"
"testing"
"time"
+ "github.com/strangelove-ventures/horcrux/pkg/node"
"github.com/strangelove-ventures/horcrux/pkg/pcosigner"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
cometcryptoed25519 "github.com/cometbft/cometbft/crypto/ed25519"
"github.com/cometbft/cometbft/libs/log"
@@ -26,7 +29,7 @@ func Test_StoreInMemOpenSingleNode(t *testing.T) {
eciesKey, err := ecies.GenerateKey(rand.Reader, secp256k1.S256(), nil)
require.NoError(t, err)
- key := pcosigner.CosignerEd25519Key{
+ key := cipher.CosignerEd25519Key{
PubKey: dummyPub,
PrivateShard: []byte{},
ID: 1,
@@ -41,25 +44,31 @@ func Test_StoreInMemOpenSingleNode(t *testing.T) {
ECIESKey: eciesKey,
ECIESPubs: []*ecies.PublicKey{&eciesKey.PublicKey},
}),
- "",
+ pcosigner.NewCosign(0, "127.0.0.1:0"),
)
- validator := &ThresholdValidator{
- myCosigner: cosigner}
- s := &RaftStore{
- NodeID: "1",
- RaftDir: tmpDir,
- RaftBind: "127.0.0.1:0",
- RaftTimeout: 1 * time.Second,
- m: make(map[string]string),
- logger: nil,
- thresholdValidator: validator,
- }
+ remoteCosigns := make([]pcosigner.IRemoteCosigner, 0)
+ //remoteCosigns = append(remoteCosigns, cosigner)
+ //remoteCosigns = append(remoteCosigns, pcosigner.NewRemoteCosigner(2, "temp"))
+
+ //shadowRemoteCosign := pcosigner.FromIRemoteToICosigner(remoteCosigns)
+ // spew.Dump(&remoteCosigns)
+ // spew.Dump(&shadowRemoteCosign)
+
+ //fmt.Printf("remotecosign: %s \n", spew.Dump(&remoteCosigns))
+ //fmt.Printf("shadowRemoteCosign: %v \n", spew.Dump(&shadowRemoteCosign))
+
+ s := node.NewRaftStore("1", tmpDir, "127.0.0.1:0", 1*time.Second, log.NewNopLogger())
+
+ validator := node.NewThresholdValidator(log.NewNopLogger(), &pcosigner.RuntimeConfig{}, 0, 1*time.Second, 1, cosigner, remoteCosigns, s)
+ s.SetThresholdValidator(validator)
if _, err := s.Open(); err != nil {
t.Fatalf("failed to open store: %s", err)
}
+ fmt.Printf("Leader: %s \n", s.GetLeader())
+
// Simple way to ensure there is a leader.
time.Sleep(3 * time.Second)
diff --git a/pkg/node/threshold_validator.go b/pkg/node/threshold_validator.go
index cb9054e2..55bb15e5 100644
--- a/pkg/node/threshold_validator.go
+++ b/pkg/node/threshold_validator.go
@@ -8,7 +8,11 @@ import (
"sync"
"time"
+ "github.com/strangelove-ventures/horcrux/pkg/proto"
+
"github.com/strangelove-ventures/horcrux/pkg/pcosigner"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/signer"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/signer/shamircosign"
"github.com/strangelove-ventures/horcrux/pkg/types"
"github.com/cometbft/cometbft/crypto"
@@ -17,9 +21,9 @@ import (
cometrpcjsontypes "github.com/cometbft/cometbft/rpc/jsonrpc/types"
comet "github.com/cometbft/cometbft/types"
"github.com/strangelove-ventures/horcrux/pkg/metrics"
- "github.com/strangelove-ventures/horcrux/pkg/proto"
)
+// Makes sure ThresholdValitator implements IPrivValidator, a wrapper around
var _ IPrivValidator = &ThresholdValidator{}
type ValidatorSignBlockRequest struct {
@@ -37,15 +41,10 @@ type ThresholdValidator struct {
grpcTimeout time.Duration
- chainState sync.Map
+ chainState sync.Map // A chainState to keep track fo the last sign state
+ thresholdalgorithm signer.ISigner // This is our threshold implementation. It should be injected
- // our own cosigner
- myCosigner *pcosigner.LocalCosigner
-
- // peer cosigners
- peerCosigners []ICosigner
-
- leader ILeader
+ leader ILeader // The Raft leader
logger log.Logger
@@ -72,19 +71,22 @@ func NewThresholdValidator(
threshold int,
grpcTimeout time.Duration,
maxWaitForSameBlockAttempts int,
- myCosigner *pcosigner.LocalCosigner,
- peerCosigners []ICosigner,
+ myCosigner pcosigner.ILocalCosigner,
+ peerCosigners []pcosigner.IRemoteCosigner,
leader ILeader,
) *ThresholdValidator {
+
return &ThresholdValidator{
logger: logger,
config: config,
threshold: threshold,
grpcTimeout: grpcTimeout,
maxWaitForSameBlockAttempts: maxWaitForSameBlockAttempts,
- myCosigner: myCosigner,
- peerCosigners: peerCosigners,
- leader: leader,
+ thresholdalgorithm: shamircosign.NewShamirCosign(
+ logger,
+ myCosigner,
+ peerCosigners),
+ leader: leader,
}
}
@@ -228,28 +230,21 @@ func (pv *ThresholdValidator) notifyBlockSignError(chainID string, hrs types.HRS
css.lastSignState.CondBroadcast()
}
-// waitForSignStatesToFlushToDisk waits for any sign states to finish writing to disk.
-func (pv *ThresholdValidator) waitForSignStatesToFlushToDisk() {
- pv.pendingDiskWG.Wait()
-
- pv.myCosigner.WaitForSignStatesToFlushToDisk()
-}
-
// Stop safely shuts down the ThresholdValidator.
// Stop implements IPrivValidator from threshold_remote_signer.go
func (pv *ThresholdValidator) Stop() {
- pv.waitForSignStatesToFlushToDisk()
+ pv.thresholdalgorithm.WaitForSignStatesToFlushToDisk()
}
// GetPubKey returns the public key of the validator.
// Implements IPrivValidator fromt threshold_remote_signer.go
func (pv *ThresholdValidator) GetPubKey(chainID string) (crypto.PubKey, error) {
- return pv.myCosigner.GetPubKey(chainID)
+ return pv.thresholdalgorithm.GetPubKey(chainID)
}
// SignVote signs a canonical representation of the vote, along with the
// chainID.
-// SignVote implements IPrivValidator fromt threshold_remote_signer.go
+// SignVote implements IPrivValidator from threshold_remote_signer.go
func (pv *ThresholdValidator) SignVote(chainID string, vote *cometproto.Vote) error {
block := &Block{
Height: vote.Height,
@@ -367,117 +362,6 @@ func newSameBlockError(chainID string, hrs types.HRSKey) *SameBlockError {
}
}
-func (pv *ThresholdValidator) waitForPeerNonces(
- chainID string,
- peer ICosigner,
- hrst types.HRSTKey,
- wg *sync.WaitGroup,
- nonces map[ICosigner][]pcosigner.CosignerNonce,
- thresholdPeersMutex *sync.Mutex,
-) {
- peerStartTime := time.Now()
- peerNonces, err := peer.GetNonces(chainID, hrst)
- if err != nil {
- // Significant missing shares may lead to signature failure
- metrics.MissedNonces.WithLabelValues(peer.GetAddress()).Add(float64(1))
- metrics.TotalMissedNonces.WithLabelValues(peer.GetAddress()).Inc()
- pv.logger.Error("Error getting nonces", "cosigner", peer.GetID(), "err", err)
- return
- }
- // Significant missing shares may lead to signature failure
- metrics.MissedNonces.WithLabelValues(peer.GetAddress()).Set(0)
- metrics.TimedCosignerNonceLag.WithLabelValues(peer.GetAddress()).Observe(time.Since(peerStartTime).Seconds())
-
- // Check so that wg.Done is not called more than (threshold - 1) times which causes hardlock
- thresholdPeersMutex.Lock()
- if len(nonces) < pv.threshold-1 {
- nonces[peer] = peerNonces.Nonces
- defer wg.Done()
- }
- thresholdPeersMutex.Unlock()
-}
-func (pv *ThresholdValidator) waitForPeerSetNoncesAndSign(
- chainID string,
- peer ICosigner,
- hrst types.HRSTKey,
- noncesMap map[ICosigner][]pcosigner.CosignerNonce,
- signBytes []byte,
- shareSignatures *[][]byte,
- shareSignaturesMutex *sync.Mutex,
- wg *sync.WaitGroup,
-) {
- peerStartTime := time.Now()
- defer wg.Done()
- peerNonces := make([]pcosigner.CosignerNonce, 0, pv.threshold-1)
-
- peerID := peer.GetID()
-
- for _, nonces := range noncesMap {
- for _, nonce := range nonces {
- // if share is intended for peer, check to make sure source peer is included in threshold
- if nonce.DestinationID != peerID {
- continue
- }
- for thresholdPeer := range noncesMap {
- if thresholdPeer.GetID() != nonce.SourceID {
- continue
- }
- // source peer is included in threshold signature, include in sharing
- peerNonces = append(peerNonces, nonce)
- break
- }
- break
- }
- }
-
- sigRes, err := peer.SetNoncesAndSign(pcosigner.CosignerSetNoncesAndSignRequest{
- ChainID: chainID,
- Nonces: peerNonces,
- HRST: hrst,
- SignBytes: signBytes,
- })
-
- if err != nil {
- pv.logger.Error(
- "Cosigner failed to set nonces and sign",
- "id", peerID,
- "err", err.Error(),
- )
- return
- }
-
- metrics.TimedCosignerSignLag.WithLabelValues(peer.GetAddress()).Observe(time.Since(peerStartTime).Seconds())
- pv.logger.Debug(
- "Received signature part",
- "cosigner", peerID,
- "chain_id", chainID,
- "height", hrst.Height,
- "round", hrst.Round,
- "step", hrst.Step,
- )
-
- shareSignaturesMutex.Lock()
- defer shareSignaturesMutex.Unlock()
-
- peerIdx := peerID - 1
- (*shareSignatures)[peerIdx] = make([]byte, len(sigRes.Signature))
- copy((*shareSignatures)[peerIdx], sigRes.Signature)
-}
-
-func waitUntilCompleteOrTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {
- c := make(chan struct{})
- go func() {
- defer close(c)
- wg.Wait()
- }()
- select {
- case <-c:
- return false // completed normally
- case <-time.After(timeout):
- return true // timed out
- }
-}
-
func (pv *ThresholdValidator) LoadSignStateIfNecessary(chainID string) error {
if _, ok := pv.chainState.Load(chainID); ok {
return nil
@@ -499,7 +383,7 @@ func (pv *ThresholdValidator) LoadSignStateIfNecessary(chainID string) error {
lastSignStateInitiatedMutex: &sync.Mutex{},
})
- return pv.myCosigner.LoadSignStateIfNecessary(chainID)
+ return pv.LoadSignStateIfNecessary(chainID)
}
// getExistingBlockSignature returns the existing block signature and no error if the signature is valid for the block.
@@ -578,7 +462,9 @@ func (pv *ThresholdValidator) compareBlockSignatureAgainstHRS(
// SignBlock is the arranger of the whole signature/signing process.
func (pv *ThresholdValidator) SignBlock(chainID string, block *Block) ([]byte, time.Time, error) {
+ // Placeholders
height, round, step, stamp, signBytes := block.Height, block.Round, block.Step, block.Timestamp, block.SignBytes
+ threshold := pv.threshold
if err := pv.LoadSignStateIfNecessary(chainID); err != nil {
return nil, stamp, err
@@ -633,121 +519,19 @@ func (pv *ThresholdValidator) SignBlock(chainID string, block *Block) ([]byte, t
// Keep track of the last block that we began the signing process for. Only allow one attempt per block
existingSignature, existingTimestamp, err := pv.SaveLastSignedStateInitiated(chainID, block)
if err != nil {
+ pv.logger.Error("Error SaveLastSignedStateInitiated", "chainID", chainID, "block", block, "err", err)
return nil, stamp, err
}
if existingSignature != nil {
pv.logger.Debug("Returning existing signature", "signature", fmt.Sprintf("%x", existingSignature))
return existingSignature, existingTimestamp, nil
}
+ // TODO Change thresholdalgorithm to scheme.
+ signature, verified, err := pv.thresholdalgorithm.SignAndVerify(
+ chainID, threshold, hrst, pv.grpcTimeout, stamp, timeStartSignBlock, signBytes)
- numPeers := len(pv.peerCosigners)
- total := uint8(numPeers + 1)
- getEphemeralWaitGroup := sync.WaitGroup{}
-
- // Only wait until we have enough threshold signatures
- getEphemeralWaitGroup.Add(pv.threshold - 1)
- // Used to track how close we are to threshold
-
- // Here the actual signing process starts from a cryptological perspective
- // TODO: This process should be factored out. It is not the responsibility of the validator to know
- // how to arrange signature of a block. It should be a separate component that is injected into the validator.
- nonces := make(map[ICosigner][]pcosigner.CosignerNonce)
- thresholdPeersMutex := sync.Mutex{}
-
- // From each cosigner peer we are requesting the nonce.
- // This is done asynchronously.
- // pv.waitForPeersNonces uses GRPC to get the nonce from the peer.
- for _, c := range pv.peerCosigners {
- go pv.waitForPeerNonces(chainID, c, hrst, &getEphemeralWaitGroup,
- nonces, &thresholdPeersMutex)
- }
-
- // Requesting a nonce from our own cosigner (a.k.a. the local cosigner)
- myNonces, err := pv.myCosigner.GetNonces(chainID, hrst)
if err != nil {
- pv.notifyBlockSignError(chainID, block.HRSKey())
- // Our ephemeral secret parts are required, cannot proceed
- return nil, stamp, err
- }
-
- // Wait for cosigners to be complete
- // A Cosigner will either respond in time, or be cancelled with timeout
- if waitUntilCompleteOrTimeout(&getEphemeralWaitGroup, pv.grpcTimeout) {
- pv.notifyBlockSignError(chainID, block.HRSKey())
- return nil, stamp, errors.New("timed out waiting for ephemeral shares")
- }
-
- thresholdPeersMutex.Lock()
- nonces[pv.myCosigner] = myNonces.Nonces
- thresholdPeersMutex.Unlock()
-
- metrics.TimedSignBlockThresholdLag.Observe(time.Since(timeStartSignBlock).Seconds())
- pv.logger.Debug(
- "Have threshold peers",
- "chain_id", chainID,
- "height", hrst.Height,
- "round", hrst.Round,
- "step", hrst.Step,
- )
-
- setEphemeralAndSignWaitGroup := sync.WaitGroup{}
-
- // Only wait until we have threshold sigs
- setEphemeralAndSignWaitGroup.Add(pv.threshold)
-
- // destination for share signatures
- shareSignatures := make([][]byte, total)
-
- // share sigs is updated by goroutines
- shareSignaturesMutex := sync.Mutex{}
-
- for cosigner := range nonces {
- // set peerNonces and sign in single rpc call.
- go pv.waitForPeerSetNoncesAndSign(chainID, cosigner, hrst, nonces,
- signBytes, &shareSignatures, &shareSignaturesMutex, &setEphemeralAndSignWaitGroup)
- }
-
- // Wait for threshold cosigners to be complete
- // A Cosigner will either respond in time, or be cancelled with timeout
- if waitUntilCompleteOrTimeout(&setEphemeralAndSignWaitGroup, 4*time.Second) {
- pv.notifyBlockSignError(chainID, block.HRSKey())
- return nil, stamp, errors.New("timed out waiting for peers to sign")
- }
-
- metrics.TimedSignBlockCosignerLag.Observe(time.Since(timeStartSignBlock).Seconds())
- pv.logger.Debug(
- "Done waiting for cosigners, assembling signatures",
- "chain_id", chainID,
- "height", hrst.Height,
- "round", hrst.Round,
- "step", hrst.Step,
- )
-
- // collect all valid responses into array of partial signatures
- shareSigs := make([]pcosigner.PartialSignature, 0, pv.threshold)
- for idx, shareSig := range shareSignatures {
- if len(shareSig) == 0 {
- continue
- }
-
- // we are ok to use the share signatures - complete boolean
- // prevents future concurrent access
- shareSigs = append(shareSigs, pcosigner.PartialSignature{
- ID: idx + 1,
- Signature: shareSig,
- })
- }
-
- if len(shareSigs) < pv.threshold {
- metrics.TotalInsufficientCosigners.Inc()
- pv.notifyBlockSignError(chainID, block.HRSKey())
- return nil, stamp, errors.New("not enough co-signers")
- }
-
- // assemble the partial signatures into a valid signature
- signature, err := pv.myCosigner.CombineSignatures(chainID, shareSigs)
- if err != nil {
- pv.notifyBlockSignError(chainID, block.HRSKey())
+ pv.logger.Error("Error pv.thresholdalgorithm.SignAndVerify", "chainID", chainID, "err", err)
return nil, stamp, err
}
@@ -760,7 +544,8 @@ func (pv *ThresholdValidator) SignBlock(chainID string, block *Block) ([]byte, t
)
// verify the combined signature before saving to watermark
- if !pv.myCosigner.VerifySignature(chainID, signBytes, signature) {
+ // if !pv.myCosigner.VerifySignature(chainID, signBytes, signature)
+ if !verified {
metrics.TotalInvalidSignature.Inc()
pv.notifyBlockSignError(chainID, block.HRSKey())
return nil, stamp, errors.New("combined signature is not valid")
diff --git a/pkg/node/threshold_validator_test.go b/pkg/node/threshold_validator_test.go
index 8032b71b..22487398 100644
--- a/pkg/node/threshold_validator_test.go
+++ b/pkg/node/threshold_validator_test.go
@@ -10,6 +10,7 @@ import (
"time"
"github.com/strangelove-ventures/horcrux/pkg/pcosigner"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
"os"
"testing"
@@ -56,7 +57,7 @@ func loadKeyForLocalCosigner(
chainID string,
privateShard []byte,
) error {
- key := pcosigner.CosignerEd25519Key{
+ key := cipher.CosignerEd25519Key{
PubKey: pubKey,
PrivateShard: privateShard,
ID: cosigner.GetID(),
@@ -73,7 +74,7 @@ func loadKeyForLocalCosigner(
func testThresholdValidator(t *testing.T, threshold, total uint8) {
cosigners, pubKey := getTestLocalCosigners(t, threshold, total)
- thresholdCosigners := make([]ICosigner, 0, threshold-1)
+ thresholdCosigners := make([]pcosigner.IRemoteCosigner, 0, threshold-1)
for i, cosigner := range cosigners {
require.Equal(t, i+1, cosigner.GetID())
@@ -83,7 +84,7 @@ func testThresholdValidator(t *testing.T, threshold, total uint8) {
}
}
- leader := &MockLeader{id: 1}
+ leader := &MockLeader{id: 1, cosigner: cosigners[0]}
validator := NewThresholdValidator(
cometlog.NewTMLogger(cometlog.NewSyncWriter(os.Stdout)).With("module", "validator"),
@@ -100,6 +101,9 @@ func testThresholdValidator(t *testing.T, threshold, total uint8) {
leader.leader = validator
err := validator.LoadSignStateIfNecessary(testChainID)
+ if err != nil {
+ t.Logf("[error] %v", err)
+ }
require.NoError(t, err)
proposal := cometproto.Proposal{
@@ -111,8 +115,10 @@ func testThresholdValidator(t *testing.T, threshold, total uint8) {
signBytes := comet.ProposalSignBytes(testChainID, &proposal)
err = validator.SignProposal(testChainID, &proposal)
+ if err != nil {
+ t.Logf("SignProposal [error] %v", err)
+ }
require.NoError(t, err)
-
require.True(t, pubKey.VerifySignature(signBytes, proposal.Signature))
firstSignature := proposal.Signature
@@ -269,9 +275,9 @@ func getTestLocalCosigners(t *testing.T, threshold, total uint8) ([]*pcosigner.L
cosigners := make([]*pcosigner.LocalCosigner, total)
for i := uint8(0); i < total; i++ {
+ fmt.Printf("Generating key for cosigner %d\n", i)
eciesKey, err := ecies.GenerateKey(rand.Reader, secp256k1.S256(), nil)
require.NoError(t, err)
-
eciesKeys[i] = eciesKey
pubKeys[i] = &eciesKey.PublicKey
@@ -308,6 +314,8 @@ func getTestLocalCosigners(t *testing.T, threshold, total uint8) ([]*pcosigner.L
},
}
+ cosign := pcosigner.NewCosign(int(i+1), "")
+ fmt.Printf("Cosign %d: %v\n", i, cosign)
cosigner := pcosigner.NewLocalCosigner(
cometlog.NewNopLogger(),
cosignerConfig,
@@ -318,12 +326,13 @@ func getTestLocalCosigners(t *testing.T, threshold, total uint8) ([]*pcosigner.L
ECIESPubs: pubKeys,
},
),
- "",
+ cosign,
)
+
require.NoError(t, err)
+ fmt.Printf("Cosigner %d: %v\n", i, cosigner.GetID())
cosigners[i] = cosigner
-
err = loadKeyForLocalCosigner(cosigner, privateKey.PubKey(), testChainID, privShards[i])
require.NoError(t, err)
@@ -341,13 +350,14 @@ func testThresholdValidatorLeaderElection(t *testing.T, threshold, total uint8)
var leader *ThresholdValidator
leaders := make([]*MockLeader, total)
for i, cosigner := range cosigners {
- peers := make([]ICosigner, 0, len(cosigners)-1)
+ fmt.Printf("Cosigner %d: %v\n", i, cosigner.GetID())
+ peers := make([]pcosigner.IRemoteCosigner, 0, len(cosigners)-1)
for j, otherCosigner := range cosigners {
if i != j {
peers = append(peers, otherCosigner)
}
}
- leaders[i] = &MockLeader{id: cosigner.GetID(), leader: leader}
+ leaders[i] = &MockLeader{id: cosigner.GetID(), leader: leader, cosigner: cosigner}
tv := NewThresholdValidator(
cometlog.NewTMLogger(cometlog.NewSyncWriter(os.Stdout)).With("module", "validator"),
cosigner.Config,
@@ -375,18 +385,17 @@ func testThresholdValidatorLeaderElection(t *testing.T, threshold, total uint8)
for _, l := range leaders {
l.SetLeader(nil)
}
- t.Log("No leader")
+ t.Log("No leader, will set a leader")
rnd, err := rand.Int(rand.Reader, big.NewInt(50))
require.NoError(t, err)
// time without a leader
time.Sleep(time.Duration(int(rnd.Int64())+100) * time.Millisecond)
-
newLeader := thresholdValidators[i%len(thresholdValidators)]
for _, l := range leaders {
l.SetLeader(newLeader)
+ t.Logf("New leader: %d", l.cosigner.GetID())
}
- t.Logf("New leader: %d", newLeader.myCosigner.GetID())
// time with new leader
rnd, err = rand.Int(rand.Reader, big.NewInt(50))
diff --git a/pkg/pcosigner/cosigner_key.go b/pkg/pcosigner/cipher/cosigner_key.go
similarity index 99%
rename from pkg/pcosigner/cosigner_key.go
rename to pkg/pcosigner/cipher/cosigner_key.go
index b64f4fb3..c34dafe6 100644
--- a/pkg/pcosigner/cosigner_key.go
+++ b/pkg/pcosigner/cipher/cosigner_key.go
@@ -1,4 +1,4 @@
-package pcosigner
+package cipher
import (
"encoding/json"
diff --git a/pkg/pcosigner/cipher/cosigner_signer.go b/pkg/pcosigner/cipher/cosigner_signer.go
new file mode 100644
index 00000000..5b4d094a
--- /dev/null
+++ b/pkg/pcosigner/cipher/cosigner_signer.go
@@ -0,0 +1,98 @@
+package cipher
+
+import (
+ "encoding/json"
+ "os"
+
+ cometjson "github.com/cometbft/cometbft/libs/json"
+ "github.com/cometbft/cometbft/privval"
+ tsed25519 "gitlab.com/unit410/threshold-ed25519/pkg"
+)
+
+// IThresholdSigner is interface for the cosigner_signer whether it's a soft sign or HSM
+// Mainly for FUTURE use if and when we want to support HSM
+type IThresholdSigner interface {
+ // GetPubKey returns the persistent public key
+ GetPubKey() []byte
+
+ // GenerateNonces deals nonces for all cosigners.
+ GenerateNonces() (Nonces, error)
+
+ // Sign signs a byte payload using the a list of nonces.
+ // Sign returns the partial signature and an error if any.
+ Sign(nonces []Nonce, payload []byte) ([]byte, error)
+
+ // CombineSignatures combines multiple partial signatures to a full signature.
+ // FIX: not necessary this need to be in a Thresholdsigner?
+ CombineSignatures([]PartialSignature) ([]byte, error)
+}
+
+// Nonces contains the ephemeral information generated by one cosigner for all other cosigners.
+type Nonces struct {
+ // PubKey is the public key for the generated nounces by cosigner
+ PubKey []byte
+
+ // Shares is the list nonces of size n generated by the cosigner.
+ // Shares[i] is the nonce for cosigner i.
+ Shares [][]byte
+}
+
+// Nonce is the ephemeral information from another cosigner destined for this cosigner.
+type Nonce struct {
+ ID int
+ Share []byte
+ PubKey []byte
+}
+
+// PartialSignature contains the partial signature and identifier (shamir id) of the signer.
+type PartialSignature struct {
+ ID int
+ Signature []byte
+}
+
+// CreateCosignerEd25519ShardsFromFile creates CosignerEd25519Key objects from a priv_validator_key.json file
+func CreateCosignerEd25519ShardsFromFile(priv string, threshold, shards uint8) ([]CosignerEd25519Key, error) {
+ pv, err := ReadPrivValidatorFile(priv)
+ if err != nil {
+ return nil, err
+ }
+ return CreateCosignerEd25519Shards(pv, threshold, shards), nil
+}
+
+// CreateCosignerEd25519Shards creates CosignerEd25519Key objects from a privval.FilePVKey
+// by splitting the secret using Shamir secret sharing.
+func CreateCosignerEd25519Shards(pv privval.FilePVKey, threshold, shards uint8) []CosignerEd25519Key {
+ // tsed25519.DealShares splits the secret using Shamir Secret Sharing (Note its: no verifiable secret sharing)
+ // privshards is shamir shares
+ privShards := tsed25519.DealShares(tsed25519.ExpandSecret(pv.PrivKey.Bytes()[:32]), threshold, shards)
+ out := make([]CosignerEd25519Key, shards)
+ for i, shard := range privShards {
+ out[i] = CosignerEd25519Key{
+ PubKey: pv.PubKey,
+ PrivateShard: shard,
+ ID: i + 1,
+ }
+ }
+ return out
+}
+
+// ReadPrivValidatorFile reads in a privval.FilePVKey from a given file.
+func ReadPrivValidatorFile(priv string) (out privval.FilePVKey, err error) {
+ var bz []byte
+ if bz, err = os.ReadFile(priv); err != nil {
+ return
+ }
+ if err = cometjson.Unmarshal(bz, &out); err != nil {
+ return
+ }
+ return
+}
+
+// WriteCosignerEd25519ShardFile writes a cosigner Ed25519 key to a given file name.
+func WriteCosignerEd25519ShardFile(cosigner CosignerEd25519Key, file string) error {
+ jsonBytes, err := json.Marshal(&cosigner)
+ if err != nil {
+ return err
+ }
+ return os.WriteFile(file, jsonBytes, 0600)
+}
diff --git a/pkg/pcosigner/cosigner_signer_soft.go b/pkg/pcosigner/cipher/ted25519_cosigner_signer_soft.go
similarity index 81%
rename from pkg/pcosigner/cosigner_signer_soft.go
rename to pkg/pcosigner/cipher/ted25519_cosigner_signer_soft.go
index f2bef489..0078d222 100644
--- a/pkg/pcosigner/cosigner_signer_soft.go
+++ b/pkg/pcosigner/cipher/ted25519_cosigner_signer_soft.go
@@ -1,4 +1,4 @@
-package pcosigner
+package cipher
import (
"bytes"
@@ -21,29 +21,15 @@ type ThresholdSignerSoft struct {
}
-func NewThresholdSignerSoft(config *RuntimeConfig, id int, chainID string) (*ThresholdSignerSoft, error) {
- keyFile, err := config.KeyFileExistsCosigner(chainID)
- if err != nil {
- return nil, err
- }
-
- key, err := LoadCosignerEd25519Key(keyFile)
- if err != nil {
- return nil, fmt.Errorf("error reading cosigner key: %s", err)
- }
-
- if key.ID != id {
- return nil, fmt.Errorf("key shard ID (%d) in (%s) does not match cosigner ID (%d)", key.ID, keyFile, id)
- }
-
+func NewThresholdSignerSoft(privateKeyShard []byte, pubKey []byte, threshold, total uint8) (ThresholdSignerSoft, error) {
s := ThresholdSignerSoft{
- privateKeyShard: key.PrivateShard,
- pubKey: key.PubKey.Bytes(),
- threshold: uint8(config.Config.ThresholdModeConfig.Threshold),
- total: uint8(len(config.Config.ThresholdModeConfig.Cosigners)),
+ privateKeyShard: privateKeyShard,
+ pubKey: pubKey,
+ threshold: threshold,
+ total: total,
}
- return &s, nil
+ return s, nil
}
// GetPubkey implements the IThresholdSigner interface
diff --git a/pkg/pcosigner/cipher/ted25519_cosigner_signer_soft_test.go b/pkg/pcosigner/cipher/ted25519_cosigner_signer_soft_test.go
new file mode 100644
index 00000000..a5553263
--- /dev/null
+++ b/pkg/pcosigner/cipher/ted25519_cosigner_signer_soft_test.go
@@ -0,0 +1,255 @@
+package cipher_test
+
+import (
+ "crypto/ed25519"
+ "crypto/rand"
+ "encoding/hex"
+ "fmt"
+ "reflect"
+ "testing"
+ "time"
+
+ "math/big"
+
+ cometproto "github.com/cometbft/cometbft/proto/tendermint/types"
+ comet "github.com/cometbft/cometbft/types"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
+ "github.com/stretchr/testify/require"
+ tsed25519 "gitlab.com/unit410/threshold-ed25519/pkg"
+)
+
+func TestThresholdSignerSoft_GenerateNonces(t *testing.T) {
+ type fields struct {
+ privateKeyShard []byte
+ pubKey []byte
+ threshold uint8
+ total uint8
+ }
+ tests := []struct {
+ name string
+ fields fields
+ want cipher.Nonces
+ wantErr bool
+ }{
+ // TODO: Add test cases.
+ }
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ s, err := cipher.NewThresholdSignerSoft(
+ tt.fields.privateKeyShard, tt.fields.pubKey, tt.fields.threshold, tt.fields.total)
+
+ if (err != nil) != tt.wantErr {
+ t.Errorf("ThresholdSignerSoft.NewThresholdSignerSoft() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ got, err := s.GenerateNonces()
+ if (err != nil) != tt.wantErr {
+ t.Errorf("ThresholdSignerSoft.GenerateNonces() error = %v, wantErr %v", err, tt.wantErr)
+ return
+ }
+ if !reflect.DeepEqual(got, tt.want) {
+ t.Errorf("ThresholdSignerSoft.GenerateNonces() = %v, want %v", got, tt.want)
+ }
+ })
+ }
+}
+
+func Reverse(src []byte) []byte {
+ dst := make([]byte, len(src))
+ copy(dst, src)
+ for i := len(dst)/2 - 1; i >= 0; i-- {
+ opp := len(dst) - 1 - i
+ dst[i], dst[opp] = dst[opp], dst[i]
+ }
+
+ return dst
+}
+func TestSignthreshold25519(test *testing.T) {
+ // pack a vote into sign bytes
+ var vote cometproto.Vote
+ vote.Height = 1
+ vote.Round = 0
+ vote.Type = cometproto.PrevoteType
+ vote.Timestamp = time.Now()
+
+ message := comet.VoteSignBytes("chain-id", &vote)
+
+ publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader)
+ require.NoError(test, err)
+
+ // persistentshares is the privateKey split into 3 shamir parts
+ persistentshares := tsed25519.DealShares(tsed25519.ExpandSecret(privateKey.Seed()), 2, 3)
+
+ // Double check Pubkey
+ //persistentSharesPub1 := tsed25519.ScalarMultiplyBase(persistentshares[0])
+ //persistentSharesPub2 := tsed25519.ScalarMultiplyBase(persistentshares[1])
+ //persistentSharesPub3 := tsed25519.ScalarMultiplyBase(persistentshares[2])
+
+ /////////////// Deal Ephermal Shares: /////////////////////////
+ // each player generates secret Ri
+ r1 := make([]byte, 32)
+ _, err = rand.Read(r1)
+ require.NoError(test, err)
+
+ r2 := make([]byte, 32)
+ _, err = rand.Read(r2)
+ require.NoError(test, err)
+
+ r3 := make([]byte, 32)
+ _, err = rand.Read(r3)
+ require.NoError(test, err)
+
+ // R1, R2, R3
+ pub1 := tsed25519.ScalarMultiplyBase(r1) // noncePub1
+ pub2 := tsed25519.ScalarMultiplyBase(r2) // noncePub2
+ pub3 := tsed25519.ScalarMultiplyBase(r3) // noncePub3
+
+ // R=R1+R2+...Rn
+ ephPublicKey := tsed25519.AddElements([]tsed25519.Element{pub1, pub2, pub3}) // R
+
+ // each player split their ephermal secret per t,n, Rij by Shamir secret sharing
+ dealer1 := tsed25519.DealShares(r1, 2, 3)
+ dealer2 := tsed25519.DealShares(r2, 2, 3)
+ dealer3 := tsed25519.DealShares(r3, 2, 3)
+
+ // A=A1+A2+...An = A=s1⋅B+s2⋅B+...sn⋅B
+ //publicKey2 := tsed25519.AddElements(
+ // []tsed25519.Element{persistentSharesPub1, persistentSharesPub2, persistentSharesPub3})
+ // require.Equal(test, publicKey, publicKey_2)
+
+ // each player sends s(i)_{j} to corresponding other player j (i.e. s(1)_{2} to player 2)
+ // each player sums all s(i)_{j}, i=1 ... n, j= self id to form their working secret
+ ephShare1 := tsed25519.AddScalars([]tsed25519.Scalar{dealer1[0], dealer2[0], dealer3[0]}) // nonceShare1
+ ephShare2 := tsed25519.AddScalars([]tsed25519.Scalar{dealer1[1], dealer2[1], dealer3[1]}) // nonceShare2
+ ephShare3 := tsed25519.AddScalars([]tsed25519.Scalar{dealer1[2], dealer2[2], dealer3[2]}) // nonceShare3
+ /*
+ // ephShare1Pub := tsed25519.ScalarMultiplyBase(ephShare1)
+ // ephShare2Pub := tsed25519.ScalarMultiplyBase(ephShare2)
+ // ephShare3Pub := tsed25519.ScalarMultiplyBase(ephShare3)
+ // ephSharePublicKey := tsed25519.AddElements([]tsed25519.Element{ephShare1Pub, ephShare2Pub, ephShare3Pub})
+
+
+ _, _ = fmt.Printf("ephShare1Pub keys: %x\n", ephShare1Pub)
+ _, _ = fmt.Printf("ephShare2Pub keys: %x\n", ephShare2Pub)
+ _, _ = fmt.Printf("ephShare3Pub keys: %x\n", ephShare3Pub)
+ _, _ = fmt.Printf("ephSharePublicKey keys: %x\n", ephSharePublicKey)
+ */
+ _, _ = fmt.Printf("public keys: %x\n", publicKey)
+ // _, _ = fmt.Printf("public keys: %x\n", publicKey2)
+ _, err = fmt.Printf("eph public keys: %x\n", ephPublicKey)
+ if err != nil {
+ panic(err)
+ }
+ // End of Dealshares.
+
+ var x, y, z big.Int
+ x.SetBytes(persistentshares[0])
+ y.SetBytes(ephShare1)
+ z.Mul(&x, &y)
+ testar := tsed25519.ScalarMultiplyBase(Reverse(z.Bytes()))
+ _, err = fmt.Printf("testing keys: %x\n", testar)
+ require.NoError(test, err)
+
+ // fmt.Printf("eph secret: %x\n", ephemeralPublic)
+ // k=H(R_i||pub||M) (mod l)
+ // S_i = r_i + k* l_i * s_i (mod l)
+ // k=H(ephPublicKey||publicKey||M) (mod l)
+ //
+
+ shareSig1 := tsed25519.SignWithShare(message, persistentshares[0], ephShare1, publicKey, ephPublicKey)
+ shareSig2 := tsed25519.SignWithShare(message, persistentshares[1], ephShare2, publicKey, ephPublicKey)
+ shareSig3 := tsed25519.SignWithShare(message, persistentshares[2], ephShare3, publicKey, ephPublicKey)
+
+ {
+ // signature[:32] == R
+ combinedSig := tsed25519.CombineShares(3, []int{1, 2, 3}, [][]byte{shareSig1, shareSig2, shareSig3})
+ var signature []byte
+ signature = append(signature, ephPublicKey...)
+ signature = append(signature, combinedSig...)
+ _, _ = fmt.Printf("Signature: %x\n", signature)
+ _, _ = fmt.Printf("Signature in String: %x\n", hex.EncodeToString(signature))
+ _, _ = fmt.Printf("Signature: %t\n", ed25519.Verify(publicKey, message, signature))
+
+ if !ed25519.Verify(publicKey, message, signature) {
+ test.Error("Invalid Signature for signer [1,2,3]")
+ }
+ }
+ {
+ combinedSig := tsed25519.CombineShares(3, []int{1, 2}, [][]byte{shareSig1, shareSig2})
+ var signature []byte
+ signature = append(signature, ephPublicKey...)
+ signature = append(signature, combinedSig...)
+ if !ed25519.Verify(publicKey, message, signature) {
+ test.Error("Invalid Signature for signer [1,2]")
+ }
+ }
+ {
+ combinedSig := tsed25519.CombineShares(3, []int{1}, [][]byte{shareSig1})
+ var signature []byte
+ signature = append(signature, ephPublicKey...)
+ signature = append(signature, combinedSig...)
+ if ed25519.Verify(publicKey, message, signature) {
+ test.Error("Valid signature for signer [1]")
+ }
+ }
+}
+
+type keyPairWithShares struct {
+ publicKey ed25519.PublicKey
+ privateKey ed25519.PrivateKey
+ shares []tsed25519.Scalar
+}
+
+func generateKeyPairWithShares(t *testing.T) keyPairWithShares {
+ publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader)
+ require.NoError(t, err)
+
+ return keyPairWithShares{
+ publicKey: publicKey,
+ privateKey: privateKey,
+ shares: tsed25519.DealShares(tsed25519.ExpandSecret(privateKey.Seed()), 2, 3),
+ }
+}
+
+func TestThreshold25519(t *testing.T) {
+ // big.NewInt(0).MulRange(1, 3)
+ delta := new(big.Int).MulRange(1, 3)
+ orderL := new(big.Int).SetBits([]big.Word{0x5812631a5cf5d3ed, 0x14def9dea2f79cd6, 0, 0x1000000000000000})
+ secret := big.NewInt(int64(29))
+
+ _, _ = fmt.Printf("orderL : %s\n", orderL.String())
+ _, _ = fmt.Printf("Secret : %s\n", secret.String())
+ _, _ = fmt.Printf("delta : %s\n", delta.String())
+ // delta * X (mod OrderL) = 1
+ // X * secret (mod OrderL)
+ delta.ModInverse(delta, orderL) // delta * X (mod OrderL) = 1
+ _, _ = fmt.Printf("X : %s\n", delta.String())
+ secret.Mul(secret, delta) //
+ _, _ = fmt.Printf("Secret*Delta : %s\n", secret.String())
+ secret.Mod(secret, orderL)
+ _, _ = fmt.Printf("Secret mod orderL : %s\n", secret.String())
+
+}
+
+// pack a vote into sign bytes
+/*
+ var vote cometproto.Vote
+ vote.Height = 1
+ vote.Round = 0
+ vote.Type = cometproto.PrevoteType
+ vote.Timestamp = time.Now()
+
+ message := comet.VoteSignBytes("chain-id", &vote)
+
+ publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader)
+ require.NoError(t, err)
+
+ keyPair := generateKeyPairWithShares(t)
+ ephKeyPair := generateKeyPairWithShares(t)
+
+ shareSig1 := SignWithShare(message, keyPair.shares[0], ephKeyPair.shares[0], keyPair.publicKey, ephKeyPair.publicKey)
+ shareSig2 := SignWithShare(message, keyPair.shares[1], ephKeyPair.shares[1], keyPair.publicKey, ephKeyPair.publicKey)
+ shareSig3 := SignWithShare(message, keyPair.shares[2], ephKeyPair.shares[2], keyPair.publicKey, ephKeyPair.publicKey)
+
+}
+*/
diff --git a/pkg/pcosigner/cosigner.go b/pkg/pcosigner/cosigner.go
index 997c3363..366d5941 100644
--- a/pkg/pcosigner/cosigner.go
+++ b/pkg/pcosigner/cosigner.go
@@ -1,13 +1,66 @@
package pcosigner
import (
+ "fmt"
"time"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
"github.com/strangelove-ventures/horcrux/pkg/types"
"github.com/strangelove-ventures/horcrux/pkg/proto"
)
+func NewThresholdSignerSoft(config *RuntimeConfig, id int, chainID string) (*cipher.ThresholdSignerSoft, error) {
+ keyFile, err := config.KeyFileExistsCosigner(chainID)
+ if err != nil {
+ return nil, err
+ }
+
+ key, err := cipher.LoadCosignerEd25519Key(keyFile)
+ if err != nil {
+ return nil, fmt.Errorf("error reading cosigner key: %s", err)
+ }
+
+ if key.ID != id {
+ return nil, fmt.Errorf("key shard ID (%d) in (%s) does not match cosigner ID (%d)", key.ID, keyFile, id)
+ }
+ privateKeyShard := key.PrivateShard
+ pubKey := key.PubKey.Bytes()
+ threshold := uint8(config.Config.ThresholdModeConfig.Threshold)
+ total := uint8(len(config.Config.ThresholdModeConfig.Cosigners))
+
+ s, err := cipher.NewThresholdSignerSoft(
+ privateKeyShard,
+ pubKey,
+ threshold,
+ total)
+ if err != nil {
+ return nil, fmt.Errorf("cipher.NewThresholdSignerSoft error: (%s)", err)
+ }
+ return &s, nil
+}
+
+type Cosigner struct {
+ id int
+ address string
+}
+
+func NewCosign(id int, address string) Cosigner {
+ return Cosigner{
+ id: id,
+ address: address,
+ }
+}
+func (cosign *Cosigner) GetAddress() string {
+ return cosign.address
+}
+
+// GetID returns the ID of the remote cosigner
+// Implements the cosigner interface
+func (cosign *Cosigner) GetID() int {
+ return cosign.id
+}
+
type CosignerSignBlockResponse struct {
Signature []byte
}
@@ -25,7 +78,7 @@ type CosignerSignResponse struct {
Signature []byte
}
-type CosignerNonce struct {
+type CosignNonce struct {
SourceID int
DestinationID int
PubKey []byte
@@ -33,7 +86,7 @@ type CosignerNonce struct {
Signature []byte
}
-func (secretPart *CosignerNonce) toProto() *proto.Nonce {
+func (secretPart *CosignNonce) toProto() *proto.Nonce {
return &proto.Nonce{
SourceID: int32(secretPart.SourceID),
DestinationID: int32(secretPart.DestinationID),
@@ -44,7 +97,7 @@ func (secretPart *CosignerNonce) toProto() *proto.Nonce {
}
// CosignerNonces is a list of CosignerNonce
-type CosignerNonces []CosignerNonce
+type CosignerNonces []CosignNonce
func (secretParts CosignerNonces) ToProto() (out []*proto.Nonce) {
for _, secretPart := range secretParts {
@@ -53,8 +106,8 @@ func (secretParts CosignerNonces) ToProto() (out []*proto.Nonce) {
return
}
-func CosignerNonceFromProto(secretPart *proto.Nonce) CosignerNonce {
- return CosignerNonce{
+func CosignerNonceFromProto(secretPart *proto.Nonce) CosignNonce {
+ return CosignNonce{
SourceID: int(secretPart.SourceID),
DestinationID: int(secretPart.DestinationID),
PubKey: secretPart.PubKey,
@@ -63,8 +116,8 @@ func CosignerNonceFromProto(secretPart *proto.Nonce) CosignerNonce {
}
}
-func CosignerNoncesFromProto(secretParts []*proto.Nonce) []CosignerNonce {
- out := make([]CosignerNonce, len(secretParts))
+func CosignerNoncesFromProto(secretParts []*proto.Nonce) []CosignNonce {
+ out := make([]CosignNonce, len(secretParts))
for i, secretPart := range secretParts {
out[i] = CosignerNonceFromProto(secretPart)
}
@@ -83,13 +136,14 @@ type CosignerSetNonceRequest struct {
Timestamp time.Time
}
-type CosignerNoncesResponse struct {
- Nonces []CosignerNonce
+type CosignNoncesResponse struct {
+ Nonces []CosignNonce
}
+// TODO: Change name to PostNoncesAndSign
type CosignerSetNoncesAndSignRequest struct {
ChainID string
- Nonces []CosignerNonce
+ Nonces []CosignNonce
HRST types.HRSTKey
SignBytes []byte
}
diff --git a/pkg/pcosigner/cosigner_security.go b/pkg/pcosigner/cosigner_security.go
index 3786833d..519443db 100644
--- a/pkg/pcosigner/cosigner_security.go
+++ b/pkg/pcosigner/cosigner_security.go
@@ -10,7 +10,7 @@ type ICosignerSecurity interface {
id int,
noncePub []byte,
nonceShare []byte,
- ) (CosignerNonce, error)
+ ) (CosignNonce, error)
// DecryptAndVerify decrypts the nonce and verifies the signature to authenticate the source cosigner.
DecryptAndVerify(
diff --git a/pkg/pcosigner/cosigner_security_ecies.go b/pkg/pcosigner/cosigner_security_ecies.go
index 2fc50d39..67784c22 100644
--- a/pkg/pcosigner/cosigner_security_ecies.go
+++ b/pkg/pcosigner/cosigner_security_ecies.go
@@ -136,8 +136,8 @@ func (c *CosignerSecurityECIES) GetID() int {
}
// EncryptAndSign encrypts the nonce and signs it for authentication.
-func (c *CosignerSecurityECIES) EncryptAndSign(id int, noncePub []byte, nonceShare []byte) (CosignerNonce, error) {
- nonce := CosignerNonce{
+func (c *CosignerSecurityECIES) EncryptAndSign(id int, noncePub []byte, nonceShare []byte) (CosignNonce, error) {
+ nonce := CosignNonce{
SourceID: c.key.ID,
}
@@ -206,7 +206,7 @@ func (c *CosignerSecurityECIES) DecryptAndVerify(
return nil, nil, fmt.Errorf("unknown cosigner: %d", id)
}
- digestMsg := CosignerNonce{
+ digestMsg := CosignNonce{
SourceID: id,
PubKey: encryptedNoncePub,
Share: encryptedNonceShare,
diff --git a/pkg/pcosigner/cosigner_key_shares.go b/pkg/pcosigner/cosigner_security_key_shares.go
similarity index 58%
rename from pkg/pcosigner/cosigner_key_shares.go
rename to pkg/pcosigner/cosigner_security_key_shares.go
index 92bedc4e..40da1152 100644
--- a/pkg/pcosigner/cosigner_key_shares.go
+++ b/pkg/pcosigner/cosigner_security_key_shares.go
@@ -6,40 +6,11 @@ import (
"encoding/json"
"os"
- cometjson "github.com/cometbft/cometbft/libs/json"
- "github.com/cometbft/cometbft/privval"
"github.com/ethereum/go-ethereum/crypto/ecies"
"github.com/ethereum/go-ethereum/crypto/secp256k1"
- tsed25519 "gitlab.com/unit410/threshold-ed25519/pkg"
"golang.org/x/sync/errgroup"
)
-// CreateCosignerEd25519ShardsFromFile creates CosignerEd25519Key objects from a priv_validator_key.json file
-func CreateCosignerEd25519ShardsFromFile(priv string, threshold, shards uint8) ([]CosignerEd25519Key, error) {
- pv, err := ReadPrivValidatorFile(priv)
- if err != nil {
- return nil, err
- }
- return CreateCosignerEd25519Shards(pv, threshold, shards), nil
-}
-
-// CreateCosignerEd25519Shards creates CosignerEd25519Key objects from a privval.FilePVKey
-// by splitting the secret using Shamir secret sharing.
-func CreateCosignerEd25519Shards(pv privval.FilePVKey, threshold, shards uint8) []CosignerEd25519Key {
- // tsed25519.DealShares splits the secret using Shamir Secret Sharing (Note its: no verifiable secret sharing)
- // privshards is shamir shares
- privShards := tsed25519.DealShares(tsed25519.ExpandSecret(pv.PrivKey.Bytes()[:32]), threshold, shards)
- out := make([]CosignerEd25519Key, shards)
- for i, shard := range privShards {
- out[i] = CosignerEd25519Key{
- PubKey: pv.PubKey,
- PrivateShard: shard,
- ID: i + 1,
- }
- }
- return out
-}
-
// CreateCosignerRSAShards generate CosignerRSAKey objects.
func CreateCosignerRSAShards(shards int) ([]CosignerRSAKey, error) {
rsaKeys, pubKeys, err := makeRSAKeys(shards)
@@ -57,27 +28,6 @@ func CreateCosignerRSAShards(shards int) ([]CosignerRSAKey, error) {
return out, nil
}
-// ReadPrivValidatorFile reads in a privval.FilePVKey from a given file.
-func ReadPrivValidatorFile(priv string) (out privval.FilePVKey, err error) {
- var bz []byte
- if bz, err = os.ReadFile(priv); err != nil {
- return
- }
- if err = cometjson.Unmarshal(bz, &out); err != nil {
- return
- }
- return
-}
-
-// WriteCosignerEd25519ShardFile writes a cosigner Ed25519 key to a given file name.
-func WriteCosignerEd25519ShardFile(cosigner CosignerEd25519Key, file string) error {
- jsonBytes, err := json.Marshal(&cosigner)
- if err != nil {
- return err
- }
- return os.WriteFile(file, jsonBytes, 0600)
-}
-
// WriteCosignerRSAShardFile writes a cosigner RSA key to a given file name.
func WriteCosignerRSAShardFile(cosigner CosignerRSAKey, file string) error {
jsonBytes, err := json.Marshal(&cosigner)
diff --git a/pkg/pcosigner/cosigner_security_rsa.go b/pkg/pcosigner/cosigner_security_rsa.go
index 72449864..f2f1d7a7 100644
--- a/pkg/pcosigner/cosigner_security_rsa.go
+++ b/pkg/pcosigner/cosigner_security_rsa.go
@@ -128,8 +128,8 @@ func (c *CosignerSecurityRSA) GetID() int {
}
// EncryptAndSign encrypts the nonce and signs it for authentication.
-func (c *CosignerSecurityRSA) EncryptAndSign(id int, noncePub []byte, nonceShare []byte) (CosignerNonce, error) {
- nonce := CosignerNonce{
+func (c *CosignerSecurityRSA) EncryptAndSign(id int, noncePub []byte, nonceShare []byte) (CosignNonce, error) {
+ nonce := CosignNonce{
SourceID: c.key.ID,
}
@@ -194,7 +194,7 @@ func (c *CosignerSecurityRSA) DecryptAndVerify(
return nil, nil, fmt.Errorf("unknown cosigner: %d", id)
}
- digestMsg := CosignerNonce{
+ digestMsg := CosignNonce{
SourceID: id,
PubKey: encryptedNoncePub,
Share: encryptedNonceShare,
diff --git a/pkg/pcosigner/cosigner_signer.go b/pkg/pcosigner/cosigner_signer.go
deleted file mode 100644
index b4730833..00000000
--- a/pkg/pcosigner/cosigner_signer.go
+++ /dev/null
@@ -1,40 +0,0 @@
-package pcosigner
-
-// IThresholdSigner is interface for the cosigner_signer whether it's a soft sign or HSM
-type IThresholdSigner interface {
- // GetPubKey returns the persistent public key
- GetPubKey() []byte
-
- // GenerateNonces deals nonces for all cosigners.
- GenerateNonces() (Nonces, error)
-
- // Sign signs a byte payload using the a list of nonces.
- // Sign returns the partial signature and an error if any.
- Sign(nonces []Nonce, payload []byte) ([]byte, error)
-
- // CombineSignatures combines multiple partial signatures to a full signature.
- CombineSignatures([]PartialSignature) ([]byte, error)
-}
-
-// Nonces contains the ephemeral information generated by one cosigner for all other cosigners.
-type Nonces struct {
- // PubKey is the public key for the generated nounces by cosigner
- PubKey []byte
-
- // Shares is the list nonces of size n generated by the cosigner.
- // Shares[i] is the nonce for cosigner i.
- Shares [][]byte
-}
-
-// Nonce is the ephemeral information from another cosigner destined for this cosigner.
-type Nonce struct {
- ID int
- Share []byte
- PubKey []byte
-}
-
-// PartialSignature contains the partial signature and identifier (shamir id) of the signer.
-type PartialSignature struct {
- ID int
- Signature []byte
-}
diff --git a/pkg/pcosigner/cosigner_signer_soft_test.go b/pkg/pcosigner/cosigner_signer_soft_test.go
deleted file mode 100644
index 3f0b781b..00000000
--- a/pkg/pcosigner/cosigner_signer_soft_test.go
+++ /dev/null
@@ -1,143 +0,0 @@
-package pcosigner
-
-import (
- "crypto/ed25519"
- "crypto/rand"
- "encoding/hex"
- "fmt"
- "reflect"
- "testing"
- "time"
-
- cometproto "github.com/cometbft/cometbft/proto/tendermint/types"
- comet "github.com/cometbft/cometbft/types"
- "github.com/stretchr/testify/require"
- tsed25519 "gitlab.com/unit410/threshold-ed25519/pkg"
-)
-
-func TestThresholdSignerSoft_GenerateNonces(t *testing.T) {
- type fields struct {
- privateKeyShard []byte
- pubKey []byte
- threshold uint8
- total uint8
- }
- tests := []struct {
- name string
- fields fields
- want Nonces
- wantErr bool
- }{
- // TODO: Add test cases.
- }
- for _, tt := range tests {
- t.Run(tt.name, func(t *testing.T) {
- s := &ThresholdSignerSoft{
- privateKeyShard: tt.fields.privateKeyShard,
- pubKey: tt.fields.pubKey,
- threshold: tt.fields.threshold,
- total: tt.fields.total,
- }
- got, err := s.GenerateNonces()
- if (err != nil) != tt.wantErr {
- t.Errorf("ThresholdSignerSoft.GenerateNonces() error = %v, wantErr %v", err, tt.wantErr)
- return
- }
- if !reflect.DeepEqual(got, tt.want) {
- t.Errorf("ThresholdSignerSoft.GenerateNonces() = %v, want %v", got, tt.want)
- }
- })
- }
-}
-
-func TestSignthreshold25519(test *testing.T) {
- // pack a vote into sign bytes
- var vote cometproto.Vote
- vote.Height = 1
- vote.Round = 0
- vote.Type = cometproto.PrevoteType
- vote.Timestamp = time.Now()
-
- message := comet.VoteSignBytes("chain-id", &vote)
-
- publicKey, privateKey, err := ed25519.GenerateKey(rand.Reader)
- require.NoError(test, err)
-
- // persistentshares is the privateKey split into 3 shamir parts
- persistentshares := tsed25519.DealShares(tsed25519.ExpandSecret(privateKey.Seed()), 2, 3)
-
- // each player generates secret Ri
- r1 := make([]byte, 32)
- _, err = rand.Read(r1)
- require.NoError(test, err)
-
- r2 := make([]byte, 32)
- _, err = rand.Read(r2)
- require.NoError(test, err)
-
- r3 := make([]byte, 32)
- _, err = rand.Read(r3)
- require.NoError(test, err)
-
- // each player split secret per t,n, Rij by Shamir secret sharing
- shares1 := tsed25519.DealShares(r1, 2, 3)
- shares2 := tsed25519.DealShares(r2, 2, 3)
- shares3 := tsed25519.DealShares(r3, 2, 3)
-
- pub1 := tsed25519.ScalarMultiplyBase(r1)
- pub2 := tsed25519.ScalarMultiplyBase(r2)
- pub3 := tsed25519.ScalarMultiplyBase(r3)
-
- // B=B1+B2+...Bn
- ephPublicKey := tsed25519.AddElements([]tsed25519.Element{pub1, pub2, pub3})
-
- // Double check Pubkey
- persistentSharesPub1 := tsed25519.ScalarMultiplyBase(persistentshares[0])
- persistentSharesPub2 := tsed25519.ScalarMultiplyBase(persistentshares[1])
- persistentSharesPub3 := tsed25519.ScalarMultiplyBase(persistentshares[2])
-
- // A=A1+A2+...An = A=s1⋅B+s2⋅B+...sn⋅B
- publicKey2 := tsed25519.AddElements(
- []tsed25519.Element{persistentSharesPub1, persistentSharesPub2, persistentSharesPub3})
- // require.Equal(test, publicKey, publicKey_2)
-
- // each player sends s(i)_{j} to corresponding other player j (i.e. s(1)_{2} to player 2)
- // each player sums all s(i)_{j}, i=1 ... n, j= self id to form their working secret
- s1 := tsed25519.AddScalars([]tsed25519.Scalar{shares1[0], shares2[0], shares3[0]})
- s2 := tsed25519.AddScalars([]tsed25519.Scalar{shares1[1], shares2[1], shares3[1]})
- s3 := tsed25519.AddScalars([]tsed25519.Scalar{shares1[2], shares2[2], shares3[2]})
-
- _, _ = fmt.Printf("public keys: %x\n", publicKey)
- _, _ = fmt.Printf("public keys: %x\n", publicKey2)
- _, err = fmt.Printf("eph pub: %x\n", ephPublicKey)
- if err != nil {
- panic(err)
- }
- // fmt.Printf("eph secret: %x\n", ephemeralPublic)
-
- shareSig1 := tsed25519.SignWithShare(message, persistentshares[0], s1, publicKey, ephPublicKey)
- shareSig2 := tsed25519.SignWithShare(message, persistentshares[1], s2, publicKey, ephPublicKey)
- shareSig3 := tsed25519.SignWithShare(message, persistentshares[2], s3, publicKey, ephPublicKey)
-
- {
- combinedSig := tsed25519.CombineShares(3, []int{1, 2, 3}, [][]byte{shareSig1, shareSig2, shareSig3})
- var signature []byte
- signature = append(signature, ephPublicKey...)
- signature = append(signature, combinedSig...)
- fmt.Println(hex.EncodeToString(signature))
- fmt.Println(ed25519.Verify(publicKey, message, signature))
-
- if !ed25519.Verify(publicKey, message, signature) {
- test.Error("Invalid Signature for signer [1,2,3]")
- }
- }
- {
- combinedSig := tsed25519.CombineShares(3, []int{1, 2}, [][]byte{shareSig1, shareSig2})
- var signature []byte
- signature = append(signature, ephPublicKey...)
- signature = append(signature, combinedSig...)
- if !ed25519.Verify(publicKey, message, signature) {
- test.Error("Invalid Signature for signer [1,2]")
- }
- }
-}
diff --git a/pkg/pcosigner/icosigner.go b/pkg/pcosigner/icosigner.go
new file mode 100644
index 00000000..19637302
--- /dev/null
+++ b/pkg/pcosigner/icosigner.go
@@ -0,0 +1,53 @@
+package pcosigner
+
+// TODO: Move back to Cosigner Package
+import (
+ cometcrypto "github.com/cometbft/cometbft/crypto"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
+ "github.com/strangelove-ventures/horcrux/pkg/types"
+)
+
+// An interface for a Cosigners, both local and remote
+type ICosigner interface {
+ // GetID should return the id number of the cosigner
+ // The ID is the shamir index: 1, 2, etc...
+ GetID() int
+ // GetAddress gets the P2P URL (GRPC and Raft)
+ GetAddress() string
+}
+
+type IRemoteCosigner interface {
+ ICosigner
+ // Sign the requested bytes
+ // TODO: Change name to PostNoncesAndSign
+ SetNoncesAndSign(req CosignerSetNoncesAndSignRequest) (*CosignerSignResponse, error)
+ // GetNonces requests nonce frpm the peer cosigners
+ GetNonces(chainID string, hrst types.HRSTKey) (*CosignNoncesResponse, error)
+}
+
+// ILocalCosigner interface is a set of methods for an m-of-n threshold signature.
+// This interface abstracts the underlying key storage and management
+type ILocalCosigner interface {
+ IRemoteCosigner
+ VerifySignature(chainID string, payload, signature []byte) bool
+ // GetPubKey gets the combined public key (permament)
+ // Not used by Remote Cosigner and should it be really used by the local cosigner?
+ GetPubKey(chainID string) (cometcrypto.PubKey, error)
+ WaitForSignStatesToFlushToDisk()
+ LoadSignStateIfNecessary(id string) error
+ SaveLastSignedState(id string, consensus types.SignStateConsensus) error
+ CombineSignatures(id string, sigs []cipher.PartialSignature) ([]byte, error)
+}
+
+func FromILocalToICosigner(iface ILocalCosigner) []ICosigner {
+ icosign := make([]ICosigner, 0)
+ icosign = append(icosign, ICosigner(iface))
+ return icosign
+}
+func FromIRemoteToICosigner(iface []IRemoteCosigner) []ICosigner {
+ icosign := make([]ICosigner, 0)
+ for _, cosigner := range iface {
+ icosign = append(icosign, ICosigner(cosigner))
+ }
+ return icosign
+}
diff --git a/pkg/pcosigner/local_cosigner.go b/pkg/pcosigner/local_cosigner.go
index fa88f466..e8b010a3 100644
--- a/pkg/pcosigner/local_cosigner.go
+++ b/pkg/pcosigner/local_cosigner.go
@@ -4,6 +4,8 @@ import (
"errors"
"fmt"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
+
"github.com/strangelove-ventures/horcrux/pkg/types"
"sync"
@@ -22,11 +24,11 @@ import (
// - Signing is thread safe.
// - LocalCosigner implements the ICosigner interface
type LocalCosigner struct {
+ Cosigner // embedding the Cosigner struct
logger cometlog.Logger
Config *RuntimeConfig
security ICosignerSecurity
chainStateMap sync.Map // chainstate is a used for map[ChainID] -> *ChainState
- address string // TODO: What address are you referring to?
pendingDiskWG sync.WaitGroup
}
@@ -34,13 +36,13 @@ func NewLocalCosigner(
logger cometlog.Logger,
config *RuntimeConfig,
security ICosignerSecurity,
- address string,
+ cosigner Cosigner,
) *LocalCosigner {
return &LocalCosigner{
+ Cosigner: cosigner,
logger: logger,
Config: config,
security: security,
- address: address,
}
}
@@ -53,13 +55,13 @@ type ChainState struct {
// Signing is thread safe - mutex is used for putting locks so only one goroutine can r/w to the ChainState
mu sync.RWMutex
// signer generates nonces, combines nonces, signs, and verifies signatures.
- signer IThresholdSigner
+ signer cipher.IThresholdSigner
// Height, Round, Step -> metadata
- nonces map[types.HRSTKey][]Nonces
+ nonces map[types.HRSTKey][]cipher.Nonces
}
-func (ccs *ChainState) combinedNonces(myID int, threshold uint8, hrst types.HRSTKey) ([]Nonce, error) {
+func (ccs *ChainState) combinedNonces(myID int, threshold uint8, hrst types.HRSTKey) ([]cipher.Nonce, error) {
ccs.mu.RLock()
defer ccs.mu.RUnlock()
@@ -68,7 +70,7 @@ func (ccs *ChainState) combinedNonces(myID int, threshold uint8, hrst types.HRST
return nil, errors.New("no metadata at HRS")
}
- combinedNonces := make([]Nonce, 0, threshold)
+ combinedNonces := make([]cipher.Nonce, 0, threshold)
// calculate secret and public keys
for _, c := range nonces {
@@ -76,7 +78,7 @@ func (ccs *ChainState) combinedNonces(myID int, threshold uint8, hrst types.HRST
continue
}
- combinedNonces = append(combinedNonces, Nonce{
+ combinedNonces = append(combinedNonces, cipher.Nonce{
Share: c.Shares[myID-1],
PubKey: c.PubKey,
})
@@ -124,7 +126,7 @@ func (cosigner *LocalCosigner) WaitForSignStatesToFlushToDisk() {
// GetID returns the id of the cosigner
// Implements Cosigner interface
func (cosigner *LocalCosigner) GetID() int {
- return cosigner.security.GetID()
+ return cosigner.id
}
// GetAddress returns the RPC URL of the cosigner
@@ -163,7 +165,7 @@ func (cosigner *LocalCosigner) GetPubKey(chainID string) (cometcrypto.PubKey, er
}
// CombineSignatures combines partial signatures into a full signature.
-func (cosigner *LocalCosigner) CombineSignatures(chainID string, signatures []PartialSignature) ([]byte, error) {
+func (cosigner *LocalCosigner) CombineSignatures(chainID string, signatures []cipher.PartialSignature) ([]byte, error) {
ccs, err := cosigner.getChainState(chainID)
if err != nil {
return nil, err
@@ -259,7 +261,7 @@ func (cosigner *LocalCosigner) sign(req CosignerSignRequest) (CosignerSignRespon
return res, nil
}
-func (cosigner *LocalCosigner) dealShares(req CosignerGetNonceRequest) ([]Nonces, error) {
+func (cosigner *LocalCosigner) dealShares(req CosignerGetNonceRequest) ([]cipher.Nonces, error) {
chainID := req.ChainID
ccs, err := cosigner.getChainState(chainID)
@@ -267,7 +269,7 @@ func (cosigner *LocalCosigner) dealShares(req CosignerGetNonceRequest) ([]Nonces
return nil, err
}
- meta := make([]Nonces, len(cosigner.Config.Config.ThresholdModeConfig.Cosigners))
+ meta := make([]cipher.Nonces, len(cosigner.Config.Config.ThresholdModeConfig.Cosigners))
nonces, err := ccs.signer.GenerateNonces()
if err != nil {
@@ -293,7 +295,7 @@ func (cosigner *LocalCosigner) LoadSignStateIfNecessary(chainID string) error {
return err
}
- var signer IThresholdSigner
+ var signer cipher.IThresholdSigner
signer, err = NewThresholdSignerSoft(cosigner.Config, cosigner.GetID(), chainID)
if err != nil {
@@ -302,7 +304,7 @@ func (cosigner *LocalCosigner) LoadSignStateIfNecessary(chainID string) error {
cosigner.chainStateMap.Store(chainID, &ChainState{
lastSignState: signState,
- nonces: make(map[types.HRSTKey][]Nonces),
+ nonces: make(map[types.HRSTKey][]cipher.Nonces),
signer: signer,
})
@@ -315,7 +317,7 @@ func (cosigner *LocalCosigner) LoadSignStateIfNecessary(chainID string) error {
func (cosigner *LocalCosigner) GetNonces(
chainID string,
hrst types.HRSTKey,
-) (*CosignerNoncesResponse, error) {
+) (*CosignNoncesResponse, error) {
metrics.MetricsTimeKeeper.SetPreviousLocalNonce(time.Now())
if err := cosigner.LoadSignStateIfNecessary(chainID); err != nil {
@@ -324,8 +326,8 @@ func (cosigner *LocalCosigner) GetNonces(
total := len(cosigner.Config.Config.ThresholdModeConfig.Cosigners)
- res := &CosignerNoncesResponse{
- Nonces: make([]CosignerNonce, total-1), // an empty list of nonces for each cosigner except for ourselves
+ res := &CosignNoncesResponse{
+ Nonces: make([]CosignNonce, total-1), // an empty list of nonces for each cosigner except for ourselves
}
id := cosigner.GetID()
@@ -377,7 +379,7 @@ func (cosigner *LocalCosigner) GetNonces(
return res, nil
}
-func (cosigner *LocalCosigner) dealSharesIfNecessary(chainID string, hrst types.HRSTKey) ([]Nonces, error) {
+func (cosigner *LocalCosigner) dealSharesIfNecessary(chainID string, hrst types.HRSTKey) ([]cipher.Nonces, error) {
ccs, err := cosigner.getChainState(chainID)
if err != nil {
return nil, err
@@ -412,10 +414,10 @@ func (cosigner *LocalCosigner) dealSharesIfNecessary(chainID string, hrst types.
// The ephemeral secret part is encrypted for the receiver
func (cosigner *LocalCosigner) getNonce(
req CosignerGetNonceRequest,
-) (CosignerNonce, error) {
+) (CosignNonce, error) {
chainID := req.ChainID
- zero := CosignerNonce{}
+ zero := CosignNonce{}
hrst := types.HRSTKey{
Height: req.Height,
Round: req.Round,
diff --git a/pkg/pcosigner/local_cosigner_test.go b/pkg/pcosigner/local_cosigner_test.go
index 83bc8c87..2f586aa6 100644
--- a/pkg/pcosigner/local_cosigner_test.go
+++ b/pkg/pcosigner/local_cosigner_test.go
@@ -9,6 +9,8 @@ import (
"testing"
"time"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
+
"github.com/strangelove-ventures/horcrux/pkg/types"
cometcryptoed25519 "github.com/cometbft/cometbft/crypto/ed25519"
@@ -117,7 +119,7 @@ func testLocalCosignerSign(t *testing.T, threshold, total uint8, security []ICos
tmpDir := t.TempDir()
thresholdCosigners := make([]*LocalCosigner, threshold)
- nonces := make([][]CosignerNonce, threshold)
+ nonces := make([][]CosignNonce, threshold)
now := time.Now()
@@ -131,12 +133,14 @@ func testLocalCosignerSign(t *testing.T, threshold, total uint8, security []ICos
for i := 0; i < int(total); i++ {
id := i + 1
- key := CosignerEd25519Key{
+ key := cipher.CosignerEd25519Key{
PubKey: pubKey,
PrivateShard: privShards[i],
ID: id,
}
+ cosign := NewCosign(id, "")
+
cfg.ThresholdModeConfig.Cosigners[i] = CosignerConfig{
ShardID: id,
}
@@ -153,8 +157,7 @@ func testLocalCosignerSign(t *testing.T, threshold, total uint8, security []ICos
Config: cfg,
},
security[i],
- "",
- )
+ cosign)
keyBz, err := key.MarshalJSON()
require.NoError(t, err)
@@ -167,6 +170,7 @@ func testLocalCosignerSign(t *testing.T, threshold, total uint8, security []ICos
require.NoError(t, err)
require.Equal(t, cosigner.GetID(), id)
+ require.Equal(t, cosigner.security.GetID(), cosigner.GetID())
if i < int(threshold) {
thresholdCosigners[i] = cosigner
@@ -187,10 +191,10 @@ func testLocalCosignerSign(t *testing.T, threshold, total uint8, security []ICos
signBytes := comet.VoteSignBytes("chain-id", &vote)
- sigs := make([]PartialSignature, threshold)
+ sigs := make([]cipher.PartialSignature, threshold)
for i, cosigner := range thresholdCosigners {
- cosignerNonces := make([]CosignerNonce, 0, threshold-1)
+ cosignerNonces := make([]CosignNonce, 0, threshold-1)
for j, nonce := range nonces {
if i == j {
@@ -212,7 +216,7 @@ func testLocalCosignerSign(t *testing.T, threshold, total uint8, security []ICos
})
require.NoError(t, err)
- sigs[i] = PartialSignature{
+ sigs[i] = cipher.PartialSignature{
ID: cosigner.GetID(),
Signature: sigRes.Signature,
}
diff --git a/pkg/pcosigner/remote_cosigner.go b/pkg/pcosigner/remote_cosigner.go
index 41b31159..911e4fdb 100644
--- a/pkg/pcosigner/remote_cosigner.go
+++ b/pkg/pcosigner/remote_cosigner.go
@@ -1,6 +1,13 @@
package pcosigner
-// RemoteCosigner is a Cosigner implementation that uses gRPC make to request from other Cosigners
+// RemoteCosigner implements ICosigner and uses gRPC make to request to other LocalCosigners
+// Another way to think about this is that RemoteCosigner is a client that makes a requests to a remote LocalCosigner which is the server
+// Step by step:
+// 1. Request: Remote --> gRPC --> Local
+// 2. Response: Remote <-- gRPC <-- Local
+// In GRPC: Onthe client side, the client has a stub (referred to as just a client in some languages)
+// that provides the same methods(!) as the server.
+
import (
"context"
"fmt"
@@ -9,7 +16,6 @@ import (
"github.com/strangelove-ventures/horcrux/pkg/types"
- cometcrypto "github.com/cometbft/cometbft/crypto"
"github.com/strangelove-ventures/horcrux/pkg/proto"
"google.golang.org/grpc"
"google.golang.org/grpc/credentials/insecure"
@@ -22,16 +28,16 @@ import (
// - RemoteCosigner --> gRPC --> LocalCosigner
// - RemoteCosigner implements the Cosigner interface
type RemoteCosigner struct {
- id int
- address string
+ Cosigner
}
// NewRemoteCosigner returns a newly initialized RemoteCosigner
func NewRemoteCosigner(id int, address string) *RemoteCosigner {
- cosigner := &RemoteCosigner{
+ cosigner := &RemoteCosigner{Cosigner{
id: id,
address: address,
+ },
}
return cosigner
}
@@ -40,24 +46,16 @@ const (
rpcTimeout = 4 * time.Second
)
-func GetContext() (context.Context, context.CancelFunc) {
+func getContext() (context.Context, context.CancelFunc) {
return context.WithTimeout(context.Background(), rpcTimeout)
}
-// GetID returns the ID of the remote cosigner
-// Implements the cosigner interface
-func (cosigner *RemoteCosigner) GetID() int {
- return cosigner.id
-}
-
// GetAddress returns the P2P URL of the remote cosigner
// Implements the ICosigner interface
-func (cosigner *RemoteCosigner) GetAddress() string {
- return cosigner.address
-}
// GetPubKey returns public key of the validator.
// Implements Cosigner interface
+/*
func (cosigner *RemoteCosigner) GetPubKey(_ string) (cometcrypto.PubKey, error) {
return nil, fmt.Errorf("unexpected call to RemoteCosigner.GetPubKey")
}
@@ -67,35 +65,39 @@ func (cosigner *RemoteCosigner) GetPubKey(_ string) (cometcrypto.PubKey, error)
func (cosigner *RemoteCosigner) VerifySignature(_ string, _, _ []byte) bool {
return false
}
-
-func (cosigner *RemoteCosigner) getGRPCClient() (proto.ICosignerGRPCServerClient, *grpc.ClientConn, error) {
+*/
+// getGRPCClient returns a gRPC client and a connection.
+func (rc *RemoteCosigner) getGRPCClient() (proto.ICosignerGRPCClient, *grpc.ClientConn, error) {
var grpcAddress string
- url, err := url.Parse(cosigner.address)
+ url, err := url.Parse(rc.address)
if err != nil {
- grpcAddress = cosigner.address
+ grpcAddress = rc.address
} else {
grpcAddress = url.Host
}
conn, err := grpc.Dial(grpcAddress, grpc.WithTransportCredentials(insecure.NewCredentials()))
if err != nil {
+ fmt.Printf("Error grpc.Dial: %v, with grpcAddress = %s\n", err, grpcAddress)
return nil, nil, err
}
- return proto.NewICosignerGRPCServerClient(conn), conn, nil
+ return proto.NewICosignerGRPCClient(conn), conn, nil
}
// GetNonces implements the Cosigner interface
-// It uses the gRPC client to request the nonces from the other
-func (cosigner *RemoteCosigner) GetNonces(
+// It uses the gRPC client to request the nonces from the specific peer cosigner
+// This is the client side (Stub) of the gRPC
+// TODO: Change name to DealNonces or RequestNonces
+func (rc *RemoteCosigner) GetNonces(
chainID string,
req types.HRSTKey,
-) (*CosignerNoncesResponse, error) {
+) (*CosignNoncesResponse, error) {
- client, conn, err := cosigner.getGRPCClient()
+ client, conn, err := rc.getGRPCClient()
if err != nil {
return nil, err
}
defer conn.Close()
- context, cancelFunc := GetContext()
+ context, cancelFunc := getContext()
defer cancelFunc()
res, err := client.GetNonces(
context,
@@ -107,13 +109,14 @@ func (cosigner *RemoteCosigner) GetNonces(
if err != nil {
return nil, err
}
- return &CosignerNoncesResponse{
+ // Returns nonce from a cosigner
+ return &CosignNoncesResponse{
Nonces: CosignerNoncesFromProto(res.GetNonces()),
}, nil
}
// SetNoncesAndSign implements the Cosigner interface
-// It acts as a client(!) and requests via gRPC the other
+// It acts as a client(!) and requests via gRPC to the server (LocalCosigner) other
// "node's" LocalCosigner to set the nonces and sign the payload.
func (cosigner *RemoteCosigner) SetNoncesAndSign(
req CosignerSetNoncesAndSignRequest) (*CosignerSignResponse, error) {
@@ -122,8 +125,9 @@ func (cosigner *RemoteCosigner) SetNoncesAndSign(
return nil, err
}
defer conn.Close()
- context, cancelFunc := GetContext()
+ context, cancelFunc := getContext()
defer cancelFunc()
+ // Requests the server to Set the Nonces and Sign the payload
res, err := client.SetNoncesAndSign(context,
&proto.CosignerGRPCSetNoncesAndSignRequest{
ChainID: req.ChainID,
diff --git a/pkg/pcosigner/signer/iSigner.go b/pkg/pcosigner/signer/iSigner.go
new file mode 100644
index 00000000..35f57d64
--- /dev/null
+++ b/pkg/pcosigner/signer/iSigner.go
@@ -0,0 +1,41 @@
+package signer
+
+import (
+ "time"
+
+ "github.com/cometbft/cometbft/crypto"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner"
+ "github.com/strangelove-ventures/horcrux/pkg/types"
+)
+
+// ISigner is responsible for signing the block and verifying the signature
+// This abstracts the threshold signature verification, so we can implements multiple "cosigners"
+// Ususally this is implemented by a Cosigner node that embedds a local cosigner, []remote cosigners those are responsible for communicatating with the other nodes on the network.
+type ISigner interface {
+ // SignAndVerify is responsible for signing the block and verifying the signature
+ // It absracts the threshold signature verification
+ SignAndVerify(chainID string, threshold int, hrst types.HRSTKey, grpcTimeout time.Duration, stamp time.Time, timeStartSignBlock time.Time, signBytes []byte) ([]byte, bool, error)
+
+ GetPubKey(chainID string) (crypto.PubKey, error)
+
+ WaitForSignStatesToFlushToDisk()
+
+ // SaveLastSignedState saves the last sign state in the "high watermark" file at the cosigner lever.
+ SaveLastSignedState(chainID string, signStateConsensus types.SignStateConsensus) error
+
+ GetLocalCosign() pcosigner.ILocalCosigner
+ GetPeers() []pcosigner.IRemoteCosigner
+ // TODO: Potentially add generate?
+ /*
+
+ // TODO: This should be the job of ThresholdValidator
+ LoadSignStateIfNecessary(chainID string) error
+
+ // FIX: Below should not be the responsibility of the ISigner
+ // Its a temporary hack to get the peers and localCosign
+ GetPeers() []pcosigner.ICosigner // Returns the remote peers (for use in GRPC)
+ GetLocalCosign() pcosigner.ILocalCosigner //
+ */
+ // sign(chainID string, threshold int, hrst types.HRSTKey, grpcTimeout time.Duration, stamp time.Time, timeStartSignBlock time.Time, signBytes []byte) ([]byte, time.Time, error)
+ // verify(chainID string, signBytes []byte, signature []byte) (bool, error)
+}
diff --git a/pkg/pcosigner/signer/shamirCosign/shamirCosign.go b/pkg/pcosigner/signer/shamirCosign/shamirCosign.go
new file mode 100644
index 00000000..dc7135a3
--- /dev/null
+++ b/pkg/pcosigner/signer/shamirCosign/shamirCosign.go
@@ -0,0 +1,312 @@
+package shamircosign
+
+import (
+ "errors"
+ logg "log"
+ "runtime"
+ "sync"
+ "time"
+
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
+
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner"
+
+ "github.com/strangelove-ventures/horcrux/pkg/types"
+
+ "github.com/cometbft/cometbft/crypto"
+ "github.com/cometbft/cometbft/libs/log"
+ "github.com/strangelove-ventures/horcrux/pkg/metrics"
+)
+
+func waitUntilCompleteOrTimeout(wg *sync.WaitGroup, timeout time.Duration) bool {
+ c := make(chan struct{})
+ go func() {
+ defer close(c)
+ wg.Wait()
+ }()
+ select {
+ case <-c:
+ return false // completed normally
+ case <-time.After(timeout):
+ return true // timed out
+ }
+}
+
+type ShamirCosign struct {
+ LocalCosign pcosigner.ILocalCosigner // Server: The "Cosigner's" LocalCosigner
+ PeerCosigners []pcosigner.IRemoteCosigner // Client: The "Cosigner's" RemoteCosigners
+ logger log.Logger
+ pendingDiskWG sync.WaitGroup
+}
+
+func NewShamirCosign(
+ logger log.Logger, myCosigner pcosigner.ILocalCosigner, peerCosigners []pcosigner.IRemoteCosigner) *ShamirCosign {
+ return &ShamirCosign{
+ logger: logger,
+ LocalCosign: myCosigner,
+ PeerCosigners: peerCosigners,
+ }
+}
+
+func (s *ShamirCosign) GetID() *pcosigner.ILocalCosigner {
+ return &s.LocalCosign
+}
+
+// waitForSignStatesToFlushToDisk waits for any sign states to finish writing to disk.
+func (s *ShamirCosign) WaitForSignStatesToFlushToDisk() {
+ s.pendingDiskWG.Wait()
+
+ s.LocalCosign.WaitForSignStatesToFlushToDisk()
+}
+
+func (s *ShamirCosign) waitForPeerSetNoncesAndSign(
+ chainID string,
+ peer pcosigner.IRemoteCosigner,
+ hrst types.HRSTKey,
+ noncesMap map[pcosigner.IRemoteCosigner][]pcosigner.CosignNonce,
+ signBytes []byte,
+ shareSignatures *[][]byte,
+ shareSignaturesMutex *sync.Mutex,
+ wg *sync.WaitGroup,
+ threshold int,
+) {
+ peerStartTime := time.Now()
+ defer wg.Done()
+ peerNonces := make([]pcosigner.CosignNonce, 0, threshold-1)
+
+ peerID := peer.GetID()
+
+ for _, nonces := range noncesMap {
+ for _, nonce := range nonces {
+ // if share is intended for peer, check to make sure source peer is included in threshold
+ if nonce.DestinationID != peerID {
+ continue
+ }
+ for thresholdPeer := range noncesMap {
+ if thresholdPeer.GetID() != nonce.SourceID {
+ continue
+ }
+ // source peer is included in threshold signature, include in sharing
+ peerNonces = append(peerNonces, nonce)
+ break
+ }
+ break
+ }
+ }
+
+ sigRes, err := peer.SetNoncesAndSign(pcosigner.CosignerSetNoncesAndSignRequest{
+ ChainID: chainID,
+ Nonces: peerNonces,
+ HRST: hrst,
+ SignBytes: signBytes,
+ })
+
+ if err != nil {
+ s.logger.Error(
+ "Cosigner failed to set nonces and sign",
+ "id", peerID,
+ "err", err.Error(),
+ )
+ return
+ }
+
+ metrics.TimedCosignerSignLag.WithLabelValues(peer.GetAddress()).Observe(time.Since(peerStartTime).Seconds())
+ s.logger.Debug(
+ "ShamirCosign received signature part",
+ "cosigner", peerID,
+ "chain_id", chainID,
+ "height", hrst.Height,
+ "round", hrst.Round,
+ "step", hrst.Step,
+ )
+ shareSignaturesMutex.Lock()
+ defer shareSignaturesMutex.Unlock()
+
+ peerIdx := peerID - 1
+ (*shareSignatures)[peerIdx] = make([]byte, len(sigRes.Signature))
+ copy((*shareSignatures)[peerIdx], sigRes.Signature)
+}
+func (s *ShamirCosign) GetLocalCosign() pcosigner.ILocalCosigner {
+ return s.LocalCosign
+}
+func (s *ShamirCosign) GetPeers() []pcosigner.IRemoteCosigner {
+ return s.PeerCosigners
+}
+func (s *ShamirCosign) LoadSignStateIfNecessary(chainID string) error {
+ return s.LocalCosign.LoadSignStateIfNecessary(chainID)
+}
+func (s *ShamirCosign) SaveLastSignedState(chainID string, signStateConsensus types.SignStateConsensus) error {
+ return s.LocalCosign.SaveLastSignedState(chainID, signStateConsensus)
+}
+func (s *ShamirCosign) SignAndVerify(
+ chainID string, threshold int, hrst types.HRSTKey, grpcTimeout time.Duration, stamp time.Time, timeStartSignBlock time.Time, signBytes []byte) ([]byte, bool, error) {
+ signature, _, err := s.sign(chainID, threshold, hrst, grpcTimeout, stamp, timeStartSignBlock, signBytes)
+ if err != nil {
+ // TODO Delete
+ _, filename, line, _ := runtime.Caller(1)
+ logg.Printf("sign [error] %s:%d %v", filename, line, err)
+ return nil, false, err
+ }
+ verified, err := s.verify(chainID, signBytes, signature)
+ if err != nil {
+ return signature, false, err
+ }
+ return signature, verified, err
+}
+
+func (s *ShamirCosign) sign(
+ chainID string, threshold int, hrst types.HRSTKey, grpcTimeout time.Duration,
+ stamp time.Time, timeStartSignBlock time.Time, signBytes []byte) ([]byte, time.Time, error) {
+ numPeers := len(s.PeerCosigners)
+ total := uint8(numPeers + 1)
+ getEphemeralWaitGroup := sync.WaitGroup{}
+
+ // Only wait until we have enough threshold signatures
+ getEphemeralWaitGroup.Add(threshold - 1)
+ // Used to track how close we are to threshold
+
+ // Here the actual signing process starts from a cryptological perspective
+ // TODO: This process should be factored out. It is not the responsibility of the validator to know
+ // how to arrange signature of a block. It should be a separate component that is injected into the validator.
+ nonces := make(map[pcosigner.IRemoteCosigner][]pcosigner.CosignNonce)
+ thresholdPeersMutex := sync.Mutex{}
+
+ // From each cosigner peer we are requesting the nonce.
+ // This is done asynchronously.
+ // pv.waitForPeersNonces uses GRPC to get the nonce from the peer.
+
+ for _, c := range s.PeerCosigners {
+ // spew.Dump(c)
+ go s.waitForPeerNonces(chainID, c, hrst, &getEphemeralWaitGroup,
+ nonces, &thresholdPeersMutex, threshold)
+ }
+
+ // Requesting a nonce from our own cosigner (a.k.a. the local cosigner)
+ myNonces, err := s.LocalCosign.GetNonces(chainID, hrst)
+ if err != nil {
+ s.logger.Error("Error getting nonces", "chainID", chainID, "err", err)
+ // TODO: pv.notifyBlockSignError(chainID, block.HRSKey())
+ // Our ephemeral secret parts are required, cannot proceed
+ return nil, stamp, err
+ }
+
+ // Wait for cosigners to be complete
+ // A Cosigner will either respond in time, or be cancelled with timeout
+
+ if waitUntilCompleteOrTimeout(&getEphemeralWaitGroup, grpcTimeout) {
+ s.logger.Error("Error waitUntilCompleteOrTimeout", "chainID", chainID, "err", err)
+ // TODO: pv.notifyBlockSignError(chainID, block.HRSKey())
+ return nil, stamp, errors.New("timed out waiting for ephemeral shares")
+ }
+
+ thresholdPeersMutex.Lock()
+ nonces[s.LocalCosign] = myNonces.Nonces
+ thresholdPeersMutex.Unlock()
+
+ metrics.TimedSignBlockThresholdLag.Observe(time.Since(timeStartSignBlock).Seconds())
+ s.logger.Debug(
+ "Have threshold peers",
+ "chain_id", chainID,
+ "height", hrst.Height,
+ "round", hrst.Round,
+ "step", hrst.Step,
+ )
+ setEphemeralAndSignWaitGroup := sync.WaitGroup{}
+
+ // Only wait until we have threshold sigs
+ setEphemeralAndSignWaitGroup.Add(threshold)
+
+ // destination for share signatures
+ shareSignatures := make([][]byte, total)
+
+ // share sigs is updated by goroutines
+ shareSignaturesMutex := sync.Mutex{}
+
+ for cosigner := range nonces {
+ // set peerNonces and sign in single rpc call in parallel using goroutines
+ // go
+ s.waitForPeerSetNoncesAndSign(chainID, cosigner, hrst, nonces,
+ signBytes, &shareSignatures, &shareSignaturesMutex, &setEphemeralAndSignWaitGroup, threshold)
+ }
+
+ // Wait for threshold cosigners to be complete
+ // A Cosigner will either respond in time, or be cancelled with timeout
+ if waitUntilCompleteOrTimeout(&setEphemeralAndSignWaitGroup, 4*time.Second) {
+ // pv.notifyBlockSignError(chainID, block.HRSKey())
+ return nil, stamp, errors.New("timed out waiting for peers to sign")
+ }
+
+ metrics.TimedSignBlockCosignerLag.Observe(time.Since(timeStartSignBlock).Seconds())
+ s.logger.Debug(
+ "Done waiting for cosigners, assembling signatures",
+ "chain_id", chainID,
+ "height", hrst.Height,
+ "round", hrst.Round,
+ "step", hrst.Step,
+ )
+ // collect all valid responses into array of partial signatures
+ shareSigs := make([]cipher.PartialSignature, 0, threshold)
+ for idx, shareSig := range shareSignatures {
+ if len(shareSig) == 0 {
+ continue
+ }
+
+ // we are ok to use the share signatures - complete boolean
+ // prevents future concurrent access
+ shareSigs = append(shareSigs, cipher.PartialSignature{
+ ID: idx + 1,
+ Signature: shareSig,
+ })
+ }
+ if len(shareSigs) < threshold {
+ metrics.TotalInsufficientCosigners.Inc()
+ // pv.notifyBlockSignError(chainID, block.HRSKey())
+ return nil, stamp, errors.New("not enough co-signers")
+ }
+ // assemble the partial signatures into a valid signature
+ signature, err := s.LocalCosign.CombineSignatures(chainID, shareSigs)
+ if err != nil {
+ // pv.notifyBlockSignError(chainID, block.HRSKey())
+ return nil, stamp, err
+ }
+ return signature, stamp, nil
+}
+func (s *ShamirCosign) verify(chainID string, signBytes []byte, signature []byte) (bool, error) {
+ verified := s.LocalCosign.VerifySignature(chainID, signBytes, signature)
+ return verified, nil
+}
+
+func (s *ShamirCosign) GetPubKey(chainID string) (crypto.PubKey, error) {
+ return s.LocalCosign.GetPubKey(chainID)
+}
+
+func (s *ShamirCosign) waitForPeerNonces(
+ chainID string,
+ peer pcosigner.IRemoteCosigner,
+ hrst types.HRSTKey,
+ wg *sync.WaitGroup,
+ nonces map[pcosigner.IRemoteCosigner][]pcosigner.CosignNonce,
+ thresholdPeersMutex *sync.Mutex,
+ threshold int,
+) {
+ peerStartTime := time.Now()
+ peerNonces, err := peer.GetNonces(chainID, hrst)
+ if err != nil {
+ // Significant missing shares may lead to signature failure
+ metrics.MissedNonces.WithLabelValues(peer.GetAddress()).Add(float64(1))
+ metrics.TotalMissedNonces.WithLabelValues(peer.GetAddress()).Inc()
+ s.logger.Error("Error getting nonces", "cosigner", peer.GetID(), "err", err)
+ return
+ }
+ // Significant missing shares may lead to signature failure
+ metrics.MissedNonces.WithLabelValues(peer.GetAddress()).Set(0)
+ metrics.TimedCosignerNonceLag.WithLabelValues(peer.GetAddress()).Observe(time.Since(peerStartTime).Seconds())
+
+ // Check so that wg.Done is not called more than (threshold - 1) times which causes hardlock
+ thresholdPeersMutex.Lock()
+ if len(nonces) < threshold-1 {
+ nonces[peer] = peerNonces.Nonces
+ defer wg.Done()
+ }
+ thresholdPeersMutex.Unlock()
+}
diff --git a/pkg/proto/cosigner_grpc_server.pb.go b/pkg/proto/cosigner_grpc_server.pb.go
deleted file mode 100644
index b481b631..00000000
--- a/pkg/proto/cosigner_grpc_server.pb.go
+++ /dev/null
@@ -1,1133 +0,0 @@
-// Code generated by protoc-gen-go. DO NOT EDIT.
-// versions:
-// protoc-gen-go v1.29.0
-// protoc v3.13.0
-// source: cosigner_grpc_server.proto
-
-package proto
-
-import (
- protoreflect "google.golang.org/protobuf/reflect/protoreflect"
- protoimpl "google.golang.org/protobuf/runtime/protoimpl"
- reflect "reflect"
- sync "sync"
-)
-
-const (
- // Verify that this generated code is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
- // Verify that runtime/protoimpl is sufficiently up-to-date.
- _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
-)
-
-type Block struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
- Round int64 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"`
- Step int32 `protobuf:"varint,3,opt,name=step,proto3" json:"step,omitempty"`
- SignBytes []byte `protobuf:"bytes,4,opt,name=signBytes,proto3" json:"signBytes,omitempty"`
- Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
-}
-
-func (x *Block) Reset() {
- *x = Block{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[0]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Block) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Block) ProtoMessage() {}
-
-func (x *Block) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[0]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Block.ProtoReflect.Descriptor instead.
-func (*Block) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{0}
-}
-
-func (x *Block) GetHeight() int64 {
- if x != nil {
- return x.Height
- }
- return 0
-}
-
-func (x *Block) GetRound() int64 {
- if x != nil {
- return x.Round
- }
- return 0
-}
-
-func (x *Block) GetStep() int32 {
- if x != nil {
- return x.Step
- }
- return 0
-}
-
-func (x *Block) GetSignBytes() []byte {
- if x != nil {
- return x.SignBytes
- }
- return nil
-}
-
-func (x *Block) GetTimestamp() int64 {
- if x != nil {
- return x.Timestamp
- }
- return 0
-}
-
-type CosignerGRPCSignBlockRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- ChainID string `protobuf:"bytes,1,opt,name=chainID,proto3" json:"chainID,omitempty"`
- Block *Block `protobuf:"bytes,2,opt,name=block,proto3" json:"block,omitempty"`
-}
-
-func (x *CosignerGRPCSignBlockRequest) Reset() {
- *x = CosignerGRPCSignBlockRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[1]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CosignerGRPCSignBlockRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CosignerGRPCSignBlockRequest) ProtoMessage() {}
-
-func (x *CosignerGRPCSignBlockRequest) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[1]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CosignerGRPCSignBlockRequest.ProtoReflect.Descriptor instead.
-func (*CosignerGRPCSignBlockRequest) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{1}
-}
-
-func (x *CosignerGRPCSignBlockRequest) GetChainID() string {
- if x != nil {
- return x.ChainID
- }
- return ""
-}
-
-func (x *CosignerGRPCSignBlockRequest) GetBlock() *Block {
- if x != nil {
- return x.Block
- }
- return nil
-}
-
-type CosignerGRPCSignBlockResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
-}
-
-func (x *CosignerGRPCSignBlockResponse) Reset() {
- *x = CosignerGRPCSignBlockResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[2]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CosignerGRPCSignBlockResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CosignerGRPCSignBlockResponse) ProtoMessage() {}
-
-func (x *CosignerGRPCSignBlockResponse) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[2]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CosignerGRPCSignBlockResponse.ProtoReflect.Descriptor instead.
-func (*CosignerGRPCSignBlockResponse) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{2}
-}
-
-func (x *CosignerGRPCSignBlockResponse) GetSignature() []byte {
- if x != nil {
- return x.Signature
- }
- return nil
-}
-
-type Nonce struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- SourceID int32 `protobuf:"varint,1,opt,name=sourceID,proto3" json:"sourceID,omitempty"`
- DestinationID int32 `protobuf:"varint,2,opt,name=destinationID,proto3" json:"destinationID,omitempty"`
- PubKey []byte `protobuf:"bytes,3,opt,name=pubKey,proto3" json:"pubKey,omitempty"`
- Share []byte `protobuf:"bytes,4,opt,name=share,proto3" json:"share,omitempty"`
- Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"`
-}
-
-func (x *Nonce) Reset() {
- *x = Nonce{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[3]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *Nonce) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*Nonce) ProtoMessage() {}
-
-func (x *Nonce) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[3]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use Nonce.ProtoReflect.Descriptor instead.
-func (*Nonce) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{3}
-}
-
-func (x *Nonce) GetSourceID() int32 {
- if x != nil {
- return x.SourceID
- }
- return 0
-}
-
-func (x *Nonce) GetDestinationID() int32 {
- if x != nil {
- return x.DestinationID
- }
- return 0
-}
-
-func (x *Nonce) GetPubKey() []byte {
- if x != nil {
- return x.PubKey
- }
- return nil
-}
-
-func (x *Nonce) GetShare() []byte {
- if x != nil {
- return x.Share
- }
- return nil
-}
-
-func (x *Nonce) GetSignature() []byte {
- if x != nil {
- return x.Signature
- }
- return nil
-}
-
-type HRST struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
- Round int64 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"`
- Step int32 `protobuf:"varint,3,opt,name=step,proto3" json:"step,omitempty"`
- Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
-}
-
-func (x *HRST) Reset() {
- *x = HRST{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[4]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *HRST) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*HRST) ProtoMessage() {}
-
-func (x *HRST) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[4]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use HRST.ProtoReflect.Descriptor instead.
-func (*HRST) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{4}
-}
-
-func (x *HRST) GetHeight() int64 {
- if x != nil {
- return x.Height
- }
- return 0
-}
-
-func (x *HRST) GetRound() int64 {
- if x != nil {
- return x.Round
- }
- return 0
-}
-
-func (x *HRST) GetStep() int32 {
- if x != nil {
- return x.Step
- }
- return 0
-}
-
-func (x *HRST) GetTimestamp() int64 {
- if x != nil {
- return x.Timestamp
- }
- return 0
-}
-
-type CosignerGRPCSetNoncesAndSignRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Nonces []*Nonce `protobuf:"bytes,1,rep,name=nonces,proto3" json:"nonces,omitempty"`
- Hrst *HRST `protobuf:"bytes,2,opt,name=hrst,proto3" json:"hrst,omitempty"`
- SignBytes []byte `protobuf:"bytes,3,opt,name=signBytes,proto3" json:"signBytes,omitempty"`
- ChainID string `protobuf:"bytes,4,opt,name=chainID,proto3" json:"chainID,omitempty"`
-}
-
-func (x *CosignerGRPCSetNoncesAndSignRequest) Reset() {
- *x = CosignerGRPCSetNoncesAndSignRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[5]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CosignerGRPCSetNoncesAndSignRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CosignerGRPCSetNoncesAndSignRequest) ProtoMessage() {}
-
-func (x *CosignerGRPCSetNoncesAndSignRequest) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[5]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CosignerGRPCSetNoncesAndSignRequest.ProtoReflect.Descriptor instead.
-func (*CosignerGRPCSetNoncesAndSignRequest) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{5}
-}
-
-func (x *CosignerGRPCSetNoncesAndSignRequest) GetNonces() []*Nonce {
- if x != nil {
- return x.Nonces
- }
- return nil
-}
-
-func (x *CosignerGRPCSetNoncesAndSignRequest) GetHrst() *HRST {
- if x != nil {
- return x.Hrst
- }
- return nil
-}
-
-func (x *CosignerGRPCSetNoncesAndSignRequest) GetSignBytes() []byte {
- if x != nil {
- return x.SignBytes
- }
- return nil
-}
-
-func (x *CosignerGRPCSetNoncesAndSignRequest) GetChainID() string {
- if x != nil {
- return x.ChainID
- }
- return ""
-}
-
-type CosignerGRPCSetNoncesAndSignResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- NoncePublic []byte `protobuf:"bytes,1,opt,name=noncePublic,proto3" json:"noncePublic,omitempty"`
- Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
- Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
-}
-
-func (x *CosignerGRPCSetNoncesAndSignResponse) Reset() {
- *x = CosignerGRPCSetNoncesAndSignResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[6]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CosignerGRPCSetNoncesAndSignResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CosignerGRPCSetNoncesAndSignResponse) ProtoMessage() {}
-
-func (x *CosignerGRPCSetNoncesAndSignResponse) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[6]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CosignerGRPCSetNoncesAndSignResponse.ProtoReflect.Descriptor instead.
-func (*CosignerGRPCSetNoncesAndSignResponse) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{6}
-}
-
-func (x *CosignerGRPCSetNoncesAndSignResponse) GetNoncePublic() []byte {
- if x != nil {
- return x.NoncePublic
- }
- return nil
-}
-
-func (x *CosignerGRPCSetNoncesAndSignResponse) GetTimestamp() int64 {
- if x != nil {
- return x.Timestamp
- }
- return 0
-}
-
-func (x *CosignerGRPCSetNoncesAndSignResponse) GetSignature() []byte {
- if x != nil {
- return x.Signature
- }
- return nil
-}
-
-type CosignerGRPCGetNoncesRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Hrst *HRST `protobuf:"bytes,1,opt,name=hrst,proto3" json:"hrst,omitempty"`
- ChainID string `protobuf:"bytes,2,opt,name=chainID,proto3" json:"chainID,omitempty"`
-}
-
-func (x *CosignerGRPCGetNoncesRequest) Reset() {
- *x = CosignerGRPCGetNoncesRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[7]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CosignerGRPCGetNoncesRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CosignerGRPCGetNoncesRequest) ProtoMessage() {}
-
-func (x *CosignerGRPCGetNoncesRequest) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[7]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CosignerGRPCGetNoncesRequest.ProtoReflect.Descriptor instead.
-func (*CosignerGRPCGetNoncesRequest) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{7}
-}
-
-func (x *CosignerGRPCGetNoncesRequest) GetHrst() *HRST {
- if x != nil {
- return x.Hrst
- }
- return nil
-}
-
-func (x *CosignerGRPCGetNoncesRequest) GetChainID() string {
- if x != nil {
- return x.ChainID
- }
- return ""
-}
-
-type CosignerGRPCGetNoncesResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Nonces []*Nonce `protobuf:"bytes,1,rep,name=nonces,proto3" json:"nonces,omitempty"`
-}
-
-func (x *CosignerGRPCGetNoncesResponse) Reset() {
- *x = CosignerGRPCGetNoncesResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[8]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CosignerGRPCGetNoncesResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CosignerGRPCGetNoncesResponse) ProtoMessage() {}
-
-func (x *CosignerGRPCGetNoncesResponse) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[8]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CosignerGRPCGetNoncesResponse.ProtoReflect.Descriptor instead.
-func (*CosignerGRPCGetNoncesResponse) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{8}
-}
-
-func (x *CosignerGRPCGetNoncesResponse) GetNonces() []*Nonce {
- if x != nil {
- return x.Nonces
- }
- return nil
-}
-
-type CosignerGRPCTransferLeadershipRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- LeaderID string `protobuf:"bytes,1,opt,name=leaderID,proto3" json:"leaderID,omitempty"`
-}
-
-func (x *CosignerGRPCTransferLeadershipRequest) Reset() {
- *x = CosignerGRPCTransferLeadershipRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[9]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CosignerGRPCTransferLeadershipRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CosignerGRPCTransferLeadershipRequest) ProtoMessage() {}
-
-func (x *CosignerGRPCTransferLeadershipRequest) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[9]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CosignerGRPCTransferLeadershipRequest.ProtoReflect.Descriptor instead.
-func (*CosignerGRPCTransferLeadershipRequest) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{9}
-}
-
-func (x *CosignerGRPCTransferLeadershipRequest) GetLeaderID() string {
- if x != nil {
- return x.LeaderID
- }
- return ""
-}
-
-type CosignerGRPCTransferLeadershipResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- LeaderID string `protobuf:"bytes,1,opt,name=leaderID,proto3" json:"leaderID,omitempty"`
- LeaderAddress string `protobuf:"bytes,2,opt,name=leaderAddress,proto3" json:"leaderAddress,omitempty"`
-}
-
-func (x *CosignerGRPCTransferLeadershipResponse) Reset() {
- *x = CosignerGRPCTransferLeadershipResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[10]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CosignerGRPCTransferLeadershipResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CosignerGRPCTransferLeadershipResponse) ProtoMessage() {}
-
-func (x *CosignerGRPCTransferLeadershipResponse) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[10]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CosignerGRPCTransferLeadershipResponse.ProtoReflect.Descriptor instead.
-func (*CosignerGRPCTransferLeadershipResponse) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{10}
-}
-
-func (x *CosignerGRPCTransferLeadershipResponse) GetLeaderID() string {
- if x != nil {
- return x.LeaderID
- }
- return ""
-}
-
-func (x *CosignerGRPCTransferLeadershipResponse) GetLeaderAddress() string {
- if x != nil {
- return x.LeaderAddress
- }
- return ""
-}
-
-type CosignerGRPCGetLeaderRequest struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-}
-
-func (x *CosignerGRPCGetLeaderRequest) Reset() {
- *x = CosignerGRPCGetLeaderRequest{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[11]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CosignerGRPCGetLeaderRequest) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CosignerGRPCGetLeaderRequest) ProtoMessage() {}
-
-func (x *CosignerGRPCGetLeaderRequest) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[11]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CosignerGRPCGetLeaderRequest.ProtoReflect.Descriptor instead.
-func (*CosignerGRPCGetLeaderRequest) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{11}
-}
-
-type CosignerGRPCGetLeaderResponse struct {
- state protoimpl.MessageState
- sizeCache protoimpl.SizeCache
- unknownFields protoimpl.UnknownFields
-
- Leader string `protobuf:"bytes,1,opt,name=leader,proto3" json:"leader,omitempty"`
-}
-
-func (x *CosignerGRPCGetLeaderResponse) Reset() {
- *x = CosignerGRPCGetLeaderResponse{}
- if protoimpl.UnsafeEnabled {
- mi := &file_cosigner_grpc_server_proto_msgTypes[12]
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- ms.StoreMessageInfo(mi)
- }
-}
-
-func (x *CosignerGRPCGetLeaderResponse) String() string {
- return protoimpl.X.MessageStringOf(x)
-}
-
-func (*CosignerGRPCGetLeaderResponse) ProtoMessage() {}
-
-func (x *CosignerGRPCGetLeaderResponse) ProtoReflect() protoreflect.Message {
- mi := &file_cosigner_grpc_server_proto_msgTypes[12]
- if protoimpl.UnsafeEnabled && x != nil {
- ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
- if ms.LoadMessageInfo() == nil {
- ms.StoreMessageInfo(mi)
- }
- return ms
- }
- return mi.MessageOf(x)
-}
-
-// Deprecated: Use CosignerGRPCGetLeaderResponse.ProtoReflect.Descriptor instead.
-func (*CosignerGRPCGetLeaderResponse) Descriptor() ([]byte, []int) {
- return file_cosigner_grpc_server_proto_rawDescGZIP(), []int{12}
-}
-
-func (x *CosignerGRPCGetLeaderResponse) GetLeader() string {
- if x != nil {
- return x.Leader
- }
- return ""
-}
-
-var File_cosigner_grpc_server_proto protoreflect.FileDescriptor
-
-var file_cosigner_grpc_server_proto_rawDesc = []byte{
- 0x0a, 0x1a, 0x63, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x5f, 0x67, 0x72, 0x70, 0x63, 0x5f,
- 0x73, 0x65, 0x72, 0x76, 0x65, 0x72, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72,
- 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x01, 0x0a, 0x05, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x16, 0x0a,
- 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68,
- 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73,
- 0x74, 0x65, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x12,
- 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01,
- 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a,
- 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03,
- 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0x5c, 0x0a, 0x1c, 0x43,
- 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x53, 0x69, 0x67, 0x6e, 0x42,
- 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63,
- 0x68, 0x61, 0x69, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68,
- 0x61, 0x69, 0x6e, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x42, 0x6c, 0x6f,
- 0x63, 0x6b, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x3d, 0x0a, 0x1d, 0x43, 0x6f, 0x73,
- 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x53, 0x69, 0x67, 0x6e, 0x42, 0x6c, 0x6f,
- 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69,
- 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73,
- 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x95, 0x01, 0x0a, 0x05, 0x4e, 0x6f, 0x6e,
- 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x44, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x49, 0x44, 0x12, 0x24,
- 0x0a, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x18,
- 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69,
- 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x18, 0x03,
- 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79, 0x12, 0x14, 0x0a, 0x05,
- 0x73, 0x68, 0x61, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x05, 0x73, 0x68, 0x61,
- 0x72, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18,
- 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65,
- 0x22, 0x66, 0x0a, 0x04, 0x48, 0x52, 0x53, 0x54, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67,
- 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74,
- 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52,
- 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x03,
- 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69,
- 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74,
- 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xa4, 0x01, 0x0a, 0x23, 0x43, 0x6f, 0x73,
- 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63,
- 0x65, 0x73, 0x41, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74,
- 0x12, 0x24, 0x0a, 0x06, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b,
- 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x52, 0x06,
- 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x04, 0x68, 0x72, 0x73, 0x74, 0x18, 0x02,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x52, 0x53,
- 0x54, 0x52, 0x04, 0x68, 0x72, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x42,
- 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e,
- 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x44,
- 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x44, 0x22,
- 0x84, 0x01, 0x0a, 0x24, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43,
- 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x41, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e,
- 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b, 0x6e, 0x6f, 0x6e, 0x63,
- 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x0b, 0x6e,
- 0x6f, 0x6e, 0x63, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69,
- 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74,
- 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e,
- 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67,
- 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x59, 0x0a, 0x1c, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e,
- 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x52,
- 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x68, 0x72, 0x73, 0x74, 0x18, 0x01,
- 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x48, 0x52, 0x53,
- 0x54, 0x52, 0x04, 0x68, 0x72, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e,
- 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49,
- 0x44, 0x22, 0x45, 0x0a, 0x1d, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50,
- 0x43, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x12, 0x24, 0x0a, 0x06, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01, 0x20, 0x03,
- 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x6e, 0x63, 0x65,
- 0x52, 0x06, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x22, 0x43, 0x0a, 0x25, 0x43, 0x6f, 0x73, 0x69,
- 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72,
- 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20,
- 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x49, 0x44, 0x22, 0x6a, 0x0a,
- 0x26, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x54, 0x72, 0x61,
- 0x6e, 0x73, 0x66, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52,
- 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x65, 0x61, 0x64, 0x65,
- 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x65, 0x61, 0x64, 0x65,
- 0x72, 0x49, 0x44, 0x12, 0x24, 0x0a, 0x0d, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x41, 0x64, 0x64,
- 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0d, 0x6c, 0x65, 0x61, 0x64,
- 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x22, 0x1e, 0x0a, 0x1c, 0x43, 0x6f, 0x73,
- 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x64,
- 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x37, 0x0a, 0x1d, 0x43, 0x6f, 0x73,
- 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x64,
- 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65,
- 0x61, 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x65, 0x61, 0x64,
- 0x65, 0x72, 0x32, 0x87, 0x04, 0x0a, 0x13, 0x49, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72,
- 0x47, 0x52, 0x50, 0x43, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72, 0x12, 0x58, 0x0a, 0x09, 0x53, 0x69,
- 0x67, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
- 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x53, 0x69, 0x67, 0x6e,
- 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x70,
- 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50,
- 0x43, 0x53, 0x69, 0x67, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e,
- 0x73, 0x65, 0x22, 0x00, 0x12, 0x6d, 0x0a, 0x10, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65,
- 0x73, 0x41, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x12, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
- 0x2e, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x53, 0x65, 0x74,
- 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x41, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73,
- 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63,
- 0x65, 0x73, 0x41, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73,
- 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73,
- 0x12, 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65,
- 0x72, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65,
- 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f,
- 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x6e,
- 0x63, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x73, 0x0a,
- 0x12, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73,
- 0x68, 0x69, 0x70, 0x12, 0x2c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73, 0x69,
- 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72,
- 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
- 0x74, 0x1a, 0x2d, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e,
- 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x4c, 0x65,
- 0x61, 0x64, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65,
- 0x22, 0x00, 0x12, 0x58, 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12,
- 0x23, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72,
- 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71,
- 0x75, 0x65, 0x73, 0x74, 0x1a, 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73,
- 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x64,
- 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x33, 0x5a, 0x31,
- 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x61, 0x6e,
- 0x67, 0x65, 0x6c, 0x6f, 0x76, 0x65, 0x2d, 0x76, 0x65, 0x6e, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2f,
- 0x68, 0x6f, 0x72, 0x63, 0x72, 0x75, 0x78, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74,
- 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
-}
-
-var (
- file_cosigner_grpc_server_proto_rawDescOnce sync.Once
- file_cosigner_grpc_server_proto_rawDescData = file_cosigner_grpc_server_proto_rawDesc
-)
-
-func file_cosigner_grpc_server_proto_rawDescGZIP() []byte {
- file_cosigner_grpc_server_proto_rawDescOnce.Do(func() {
- file_cosigner_grpc_server_proto_rawDescData = protoimpl.X.CompressGZIP(file_cosigner_grpc_server_proto_rawDescData)
- })
- return file_cosigner_grpc_server_proto_rawDescData
-}
-
-var file_cosigner_grpc_server_proto_msgTypes = make([]protoimpl.MessageInfo, 13)
-var file_cosigner_grpc_server_proto_goTypes = []interface{}{
- (*Block)(nil), // 0: proto.Block
- (*CosignerGRPCSignBlockRequest)(nil), // 1: proto.CosignerGRPCSignBlockRequest
- (*CosignerGRPCSignBlockResponse)(nil), // 2: proto.CosignerGRPCSignBlockResponse
- (*Nonce)(nil), // 3: proto.Nonce
- (*HRST)(nil), // 4: proto.HRST
- (*CosignerGRPCSetNoncesAndSignRequest)(nil), // 5: proto.CosignerGRPCSetNoncesAndSignRequest
- (*CosignerGRPCSetNoncesAndSignResponse)(nil), // 6: proto.CosignerGRPCSetNoncesAndSignResponse
- (*CosignerGRPCGetNoncesRequest)(nil), // 7: proto.CosignerGRPCGetNoncesRequest
- (*CosignerGRPCGetNoncesResponse)(nil), // 8: proto.CosignerGRPCGetNoncesResponse
- (*CosignerGRPCTransferLeadershipRequest)(nil), // 9: proto.CosignerGRPCTransferLeadershipRequest
- (*CosignerGRPCTransferLeadershipResponse)(nil), // 10: proto.CosignerGRPCTransferLeadershipResponse
- (*CosignerGRPCGetLeaderRequest)(nil), // 11: proto.CosignerGRPCGetLeaderRequest
- (*CosignerGRPCGetLeaderResponse)(nil), // 12: proto.CosignerGRPCGetLeaderResponse
-}
-var file_cosigner_grpc_server_proto_depIdxs = []int32{
- 0, // 0: proto.CosignerGRPCSignBlockRequest.block:type_name -> proto.Block
- 3, // 1: proto.CosignerGRPCSetNoncesAndSignRequest.nonces:type_name -> proto.Nonce
- 4, // 2: proto.CosignerGRPCSetNoncesAndSignRequest.hrst:type_name -> proto.HRST
- 4, // 3: proto.CosignerGRPCGetNoncesRequest.hrst:type_name -> proto.HRST
- 3, // 4: proto.CosignerGRPCGetNoncesResponse.nonces:type_name -> proto.Nonce
- 1, // 5: proto.ICosignerGRPCServer.SignBlock:input_type -> proto.CosignerGRPCSignBlockRequest
- 5, // 6: proto.ICosignerGRPCServer.SetNoncesAndSign:input_type -> proto.CosignerGRPCSetNoncesAndSignRequest
- 7, // 7: proto.ICosignerGRPCServer.GetNonces:input_type -> proto.CosignerGRPCGetNoncesRequest
- 9, // 8: proto.ICosignerGRPCServer.TransferLeadership:input_type -> proto.CosignerGRPCTransferLeadershipRequest
- 11, // 9: proto.ICosignerGRPCServer.GetLeader:input_type -> proto.CosignerGRPCGetLeaderRequest
- 2, // 10: proto.ICosignerGRPCServer.SignBlock:output_type -> proto.CosignerGRPCSignBlockResponse
- 6, // 11: proto.ICosignerGRPCServer.SetNoncesAndSign:output_type -> proto.CosignerGRPCSetNoncesAndSignResponse
- 8, // 12: proto.ICosignerGRPCServer.GetNonces:output_type -> proto.CosignerGRPCGetNoncesResponse
- 10, // 13: proto.ICosignerGRPCServer.TransferLeadership:output_type -> proto.CosignerGRPCTransferLeadershipResponse
- 12, // 14: proto.ICosignerGRPCServer.GetLeader:output_type -> proto.CosignerGRPCGetLeaderResponse
- 10, // [10:15] is the sub-list for method output_type
- 5, // [5:10] is the sub-list for method input_type
- 5, // [5:5] is the sub-list for extension type_name
- 5, // [5:5] is the sub-list for extension extendee
- 0, // [0:5] is the sub-list for field type_name
-}
-
-func init() { file_cosigner_grpc_server_proto_init() }
-func file_cosigner_grpc_server_proto_init() {
- if File_cosigner_grpc_server_proto != nil {
- return
- }
- if !protoimpl.UnsafeEnabled {
- file_cosigner_grpc_server_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Block); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CosignerGRPCSignBlockRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CosignerGRPCSignBlockResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*Nonce); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*HRST); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CosignerGRPCSetNoncesAndSignRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CosignerGRPCSetNoncesAndSignResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CosignerGRPCGetNoncesRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CosignerGRPCGetNoncesResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CosignerGRPCTransferLeadershipRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CosignerGRPCTransferLeadershipResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CosignerGRPCGetLeaderRequest); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- file_cosigner_grpc_server_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} {
- switch v := v.(*CosignerGRPCGetLeaderResponse); i {
- case 0:
- return &v.state
- case 1:
- return &v.sizeCache
- case 2:
- return &v.unknownFields
- default:
- return nil
- }
- }
- }
- type x struct{}
- out := protoimpl.TypeBuilder{
- File: protoimpl.DescBuilder{
- GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
- RawDescriptor: file_cosigner_grpc_server_proto_rawDesc,
- NumEnums: 0,
- NumMessages: 13,
- NumExtensions: 0,
- NumServices: 1,
- },
- GoTypes: file_cosigner_grpc_server_proto_goTypes,
- DependencyIndexes: file_cosigner_grpc_server_proto_depIdxs,
- MessageInfos: file_cosigner_grpc_server_proto_msgTypes,
- }.Build()
- File_cosigner_grpc_server_proto = out.File
- file_cosigner_grpc_server_proto_rawDesc = nil
- file_cosigner_grpc_server_proto_goTypes = nil
- file_cosigner_grpc_server_proto_depIdxs = nil
-}
diff --git a/pkg/proto/cosigner_grpc_server.proto b/pkg/proto/cosigner_grpc_server.proto
deleted file mode 100644
index 1fcfc588..00000000
--- a/pkg/proto/cosigner_grpc_server.proto
+++ /dev/null
@@ -1,83 +0,0 @@
-syntax = "proto3";
-
-option go_package = "github.com/strangelove-ventures/horcrux/pkg/proto";
-
-package proto;
-// TODO: Rename it as GPRCserver. It makes more sense since we are using it for all connections.
-// CosignerGRPC handles all the services (the server)
-service ICosignerGRPCServer {
- rpc SignBlock (CosignerGRPCSignBlockRequest) returns (CosignerGRPCSignBlockResponse) {}
- rpc SetNoncesAndSign (CosignerGRPCSetNoncesAndSignRequest) returns (CosignerGRPCSetNoncesAndSignResponse) {}
- rpc GetNonces (CosignerGRPCGetNoncesRequest) returns (CosignerGRPCGetNoncesResponse) {}
- rpc TransferLeadership (CosignerGRPCTransferLeadershipRequest) returns (CosignerGRPCTransferLeadershipResponse) {}
- rpc GetLeader (CosignerGRPCGetLeaderRequest) returns (CosignerGRPCGetLeaderResponse) {}
-}
-
-message Block {
- int64 height = 1;
- int64 round = 2;
- int32 step = 3;
- bytes signBytes = 4;
- int64 timestamp = 5;
-}
-
-message CosignerGRPCSignBlockRequest {
- string chainID = 1;
- Block block = 2;
-}
-
-message CosignerGRPCSignBlockResponse {
- bytes signature = 1;
-}
-
-message Nonce {
- int32 sourceID = 1;
- int32 destinationID = 2;
- bytes pubKey = 3;
- bytes share = 4;
- bytes signature = 5;
-}
-
-message HRST {
- int64 height = 1;
- int64 round = 2;
- int32 step = 3;
- int64 timestamp = 4;
-}
-
-message CosignerGRPCSetNoncesAndSignRequest {
- repeated Nonce nonces = 1;
- HRST hrst = 2;
- bytes signBytes = 3;
- string chainID = 4;
-}
-
-message CosignerGRPCSetNoncesAndSignResponse {
- bytes noncePublic = 1;
- int64 timestamp = 2;
- bytes signature = 3;
-}
-
-message CosignerGRPCGetNoncesRequest {
- HRST hrst = 1;
- string chainID = 2;
-}
-
-message CosignerGRPCGetNoncesResponse {
- repeated Nonce nonces = 1;
-}
-
-message CosignerGRPCTransferLeadershipRequest {
- string leaderID = 1;
-}
-
-message CosignerGRPCTransferLeadershipResponse {
- string leaderID = 1;
- string leaderAddress = 2;
-}
-
-message CosignerGRPCGetLeaderRequest {}
-
-message CosignerGRPCGetLeaderResponse {
- string leader = 1;
-}
diff --git a/pkg/proto/cosigner_grpc_server_grpc.pb.go b/pkg/proto/cosigner_grpc_server_grpc.pb.go
deleted file mode 100644
index f7c0b5df..00000000
--- a/pkg/proto/cosigner_grpc_server_grpc.pb.go
+++ /dev/null
@@ -1,257 +0,0 @@
-// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
-// versions:
-// - protoc-gen-go-grpc v1.3.0
-// - protoc v3.13.0
-// source: cosigner_grpc_server.proto
-
-package proto
-
-import (
- context "context"
- grpc "google.golang.org/grpc"
- codes "google.golang.org/grpc/codes"
- status "google.golang.org/grpc/status"
-)
-
-// This is a compile-time assertion to ensure that this generated file
-// is compatible with the grpc package it is being compiled against.
-// Requires gRPC-Go v1.32.0 or later.
-const _ = grpc.SupportPackageIsVersion7
-
-const (
- ICosignerGRPCServer_SignBlock_FullMethodName = "/proto.ICosignerGRPCServer/SignBlock"
- ICosignerGRPCServer_SetNoncesAndSign_FullMethodName = "/proto.ICosignerGRPCServer/SetNoncesAndSign"
- ICosignerGRPCServer_GetNonces_FullMethodName = "/proto.ICosignerGRPCServer/GetNonces"
- ICosignerGRPCServer_TransferLeadership_FullMethodName = "/proto.ICosignerGRPCServer/TransferLeadership"
- ICosignerGRPCServer_GetLeader_FullMethodName = "/proto.ICosignerGRPCServer/GetLeader"
-)
-
-// ICosignerGRPCServerClient is the client API for ICosignerGRPCServer service.
-//
-// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
-type ICosignerGRPCServerClient interface {
- SignBlock(ctx context.Context, in *CosignerGRPCSignBlockRequest, opts ...grpc.CallOption) (*CosignerGRPCSignBlockResponse, error)
- SetNoncesAndSign(ctx context.Context, in *CosignerGRPCSetNoncesAndSignRequest, opts ...grpc.CallOption) (*CosignerGRPCSetNoncesAndSignResponse, error)
- GetNonces(ctx context.Context, in *CosignerGRPCGetNoncesRequest, opts ...grpc.CallOption) (*CosignerGRPCGetNoncesResponse, error)
- TransferLeadership(ctx context.Context, in *CosignerGRPCTransferLeadershipRequest, opts ...grpc.CallOption) (*CosignerGRPCTransferLeadershipResponse, error)
- GetLeader(ctx context.Context, in *CosignerGRPCGetLeaderRequest, opts ...grpc.CallOption) (*CosignerGRPCGetLeaderResponse, error)
-}
-
-type iCosignerGRPCServerClient struct {
- cc grpc.ClientConnInterface
-}
-
-func NewICosignerGRPCServerClient(cc grpc.ClientConnInterface) ICosignerGRPCServerClient {
- return &iCosignerGRPCServerClient{cc}
-}
-
-func (c *iCosignerGRPCServerClient) SignBlock(ctx context.Context, in *CosignerGRPCSignBlockRequest, opts ...grpc.CallOption) (*CosignerGRPCSignBlockResponse, error) {
- out := new(CosignerGRPCSignBlockResponse)
- err := c.cc.Invoke(ctx, ICosignerGRPCServer_SignBlock_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *iCosignerGRPCServerClient) SetNoncesAndSign(ctx context.Context, in *CosignerGRPCSetNoncesAndSignRequest, opts ...grpc.CallOption) (*CosignerGRPCSetNoncesAndSignResponse, error) {
- out := new(CosignerGRPCSetNoncesAndSignResponse)
- err := c.cc.Invoke(ctx, ICosignerGRPCServer_SetNoncesAndSign_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *iCosignerGRPCServerClient) GetNonces(ctx context.Context, in *CosignerGRPCGetNoncesRequest, opts ...grpc.CallOption) (*CosignerGRPCGetNoncesResponse, error) {
- out := new(CosignerGRPCGetNoncesResponse)
- err := c.cc.Invoke(ctx, ICosignerGRPCServer_GetNonces_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *iCosignerGRPCServerClient) TransferLeadership(ctx context.Context, in *CosignerGRPCTransferLeadershipRequest, opts ...grpc.CallOption) (*CosignerGRPCTransferLeadershipResponse, error) {
- out := new(CosignerGRPCTransferLeadershipResponse)
- err := c.cc.Invoke(ctx, ICosignerGRPCServer_TransferLeadership_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-func (c *iCosignerGRPCServerClient) GetLeader(ctx context.Context, in *CosignerGRPCGetLeaderRequest, opts ...grpc.CallOption) (*CosignerGRPCGetLeaderResponse, error) {
- out := new(CosignerGRPCGetLeaderResponse)
- err := c.cc.Invoke(ctx, ICosignerGRPCServer_GetLeader_FullMethodName, in, out, opts...)
- if err != nil {
- return nil, err
- }
- return out, nil
-}
-
-// ICosignerGRPCServerServer is the server API for ICosignerGRPCServer service.
-// All implementations must embed UnimplementedICosignerGRPCServerServer
-// for forward compatibility
-type ICosignerGRPCServerServer interface {
- SignBlock(context.Context, *CosignerGRPCSignBlockRequest) (*CosignerGRPCSignBlockResponse, error)
- SetNoncesAndSign(context.Context, *CosignerGRPCSetNoncesAndSignRequest) (*CosignerGRPCSetNoncesAndSignResponse, error)
- GetNonces(context.Context, *CosignerGRPCGetNoncesRequest) (*CosignerGRPCGetNoncesResponse, error)
- TransferLeadership(context.Context, *CosignerGRPCTransferLeadershipRequest) (*CosignerGRPCTransferLeadershipResponse, error)
- GetLeader(context.Context, *CosignerGRPCGetLeaderRequest) (*CosignerGRPCGetLeaderResponse, error)
- mustEmbedUnimplementedICosignerGRPCServerServer()
-}
-
-// UnimplementedICosignerGRPCServerServer must be embedded to have forward compatible implementations.
-type UnimplementedICosignerGRPCServerServer struct {
-}
-
-func (UnimplementedICosignerGRPCServerServer) SignBlock(context.Context, *CosignerGRPCSignBlockRequest) (*CosignerGRPCSignBlockResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method SignBlock not implemented")
-}
-func (UnimplementedICosignerGRPCServerServer) SetNoncesAndSign(context.Context, *CosignerGRPCSetNoncesAndSignRequest) (*CosignerGRPCSetNoncesAndSignResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method SetNoncesAndSign not implemented")
-}
-func (UnimplementedICosignerGRPCServerServer) GetNonces(context.Context, *CosignerGRPCGetNoncesRequest) (*CosignerGRPCGetNoncesResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetNonces not implemented")
-}
-func (UnimplementedICosignerGRPCServerServer) TransferLeadership(context.Context, *CosignerGRPCTransferLeadershipRequest) (*CosignerGRPCTransferLeadershipResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method TransferLeadership not implemented")
-}
-func (UnimplementedICosignerGRPCServerServer) GetLeader(context.Context, *CosignerGRPCGetLeaderRequest) (*CosignerGRPCGetLeaderResponse, error) {
- return nil, status.Errorf(codes.Unimplemented, "method GetLeader not implemented")
-}
-func (UnimplementedICosignerGRPCServerServer) mustEmbedUnimplementedICosignerGRPCServerServer() {}
-
-// UnsafeICosignerGRPCServerServer may be embedded to opt out of forward compatibility for this service.
-// Use of this interface is not recommended, as added methods to ICosignerGRPCServerServer will
-// result in compilation errors.
-type UnsafeICosignerGRPCServerServer interface {
- mustEmbedUnimplementedICosignerGRPCServerServer()
-}
-
-func RegisterICosignerGRPCServerServer(s grpc.ServiceRegistrar, srv ICosignerGRPCServerServer) {
- s.RegisterService(&ICosignerGRPCServer_ServiceDesc, srv)
-}
-
-func _ICosignerGRPCServer_SignBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CosignerGRPCSignBlockRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(ICosignerGRPCServerServer).SignBlock(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: ICosignerGRPCServer_SignBlock_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(ICosignerGRPCServerServer).SignBlock(ctx, req.(*CosignerGRPCSignBlockRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _ICosignerGRPCServer_SetNoncesAndSign_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CosignerGRPCSetNoncesAndSignRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(ICosignerGRPCServerServer).SetNoncesAndSign(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: ICosignerGRPCServer_SetNoncesAndSign_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(ICosignerGRPCServerServer).SetNoncesAndSign(ctx, req.(*CosignerGRPCSetNoncesAndSignRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _ICosignerGRPCServer_GetNonces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CosignerGRPCGetNoncesRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(ICosignerGRPCServerServer).GetNonces(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: ICosignerGRPCServer_GetNonces_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(ICosignerGRPCServerServer).GetNonces(ctx, req.(*CosignerGRPCGetNoncesRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _ICosignerGRPCServer_TransferLeadership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CosignerGRPCTransferLeadershipRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(ICosignerGRPCServerServer).TransferLeadership(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: ICosignerGRPCServer_TransferLeadership_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(ICosignerGRPCServerServer).TransferLeadership(ctx, req.(*CosignerGRPCTransferLeadershipRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-func _ICosignerGRPCServer_GetLeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
- in := new(CosignerGRPCGetLeaderRequest)
- if err := dec(in); err != nil {
- return nil, err
- }
- if interceptor == nil {
- return srv.(ICosignerGRPCServerServer).GetLeader(ctx, in)
- }
- info := &grpc.UnaryServerInfo{
- Server: srv,
- FullMethod: ICosignerGRPCServer_GetLeader_FullMethodName,
- }
- handler := func(ctx context.Context, req interface{}) (interface{}, error) {
- return srv.(ICosignerGRPCServerServer).GetLeader(ctx, req.(*CosignerGRPCGetLeaderRequest))
- }
- return interceptor(ctx, in, info, handler)
-}
-
-// ICosignerGRPCServer_ServiceDesc is the grpc.ServiceDesc for ICosignerGRPCServer service.
-// It's only intended for direct use with grpc.RegisterService,
-// and not to be introspected or modified (even as a copy)
-var ICosignerGRPCServer_ServiceDesc = grpc.ServiceDesc{
- ServiceName: "proto.ICosignerGRPCServer",
- HandlerType: (*ICosignerGRPCServerServer)(nil),
- Methods: []grpc.MethodDesc{
- {
- MethodName: "SignBlock",
- Handler: _ICosignerGRPCServer_SignBlock_Handler,
- },
- {
- MethodName: "SetNoncesAndSign",
- Handler: _ICosignerGRPCServer_SetNoncesAndSign_Handler,
- },
- {
- MethodName: "GetNonces",
- Handler: _ICosignerGRPCServer_GetNonces_Handler,
- },
- {
- MethodName: "TransferLeadership",
- Handler: _ICosignerGRPCServer_TransferLeadership_Handler,
- },
- {
- MethodName: "GetLeader",
- Handler: _ICosignerGRPCServer_GetLeader_Handler,
- },
- },
- Streams: []grpc.StreamDesc{},
- Metadata: "cosigner_grpc_server.proto",
-}
diff --git a/pkg/proto/proto.sh b/pkg/proto/proto.sh
new file mode 100644
index 00000000..4bcd64c5
--- /dev/null
+++ b/pkg/proto/proto.sh
@@ -0,0 +1,2 @@
+protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative shamirservice.proto
+protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative raftservice.proto
\ No newline at end of file
diff --git a/pkg/proto/raftservice.pb.go b/pkg/proto/raftservice.pb.go
new file mode 100644
index 00000000..7f5771a0
--- /dev/null
+++ b/pkg/proto/raftservice.pb.go
@@ -0,0 +1,599 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.28.1
+// protoc v3.13.0
+// source: raftservice.proto
+
+package proto
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type Block struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
+ Round int64 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"`
+ Step int32 `protobuf:"varint,3,opt,name=step,proto3" json:"step,omitempty"`
+ SignBytes []byte `protobuf:"bytes,4,opt,name=signBytes,proto3" json:"signBytes,omitempty"`
+ Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
+}
+
+func (x *Block) Reset() {
+ *x = Block{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_raftservice_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Block) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Block) ProtoMessage() {}
+
+func (x *Block) ProtoReflect() protoreflect.Message {
+ mi := &file_raftservice_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Block.ProtoReflect.Descriptor instead.
+func (*Block) Descriptor() ([]byte, []int) {
+ return file_raftservice_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Block) GetHeight() int64 {
+ if x != nil {
+ return x.Height
+ }
+ return 0
+}
+
+func (x *Block) GetRound() int64 {
+ if x != nil {
+ return x.Round
+ }
+ return 0
+}
+
+func (x *Block) GetStep() int32 {
+ if x != nil {
+ return x.Step
+ }
+ return 0
+}
+
+func (x *Block) GetSignBytes() []byte {
+ if x != nil {
+ return x.SignBytes
+ }
+ return nil
+}
+
+func (x *Block) GetTimestamp() int64 {
+ if x != nil {
+ return x.Timestamp
+ }
+ return 0
+}
+
+type RaftGRPCSignBlockRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ ChainID string `protobuf:"bytes,1,opt,name=chainID,proto3" json:"chainID,omitempty"`
+ Block *Block `protobuf:"bytes,2,opt,name=block,proto3" json:"block,omitempty"`
+}
+
+func (x *RaftGRPCSignBlockRequest) Reset() {
+ *x = RaftGRPCSignBlockRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_raftservice_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RaftGRPCSignBlockRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RaftGRPCSignBlockRequest) ProtoMessage() {}
+
+func (x *RaftGRPCSignBlockRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_raftservice_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RaftGRPCSignBlockRequest.ProtoReflect.Descriptor instead.
+func (*RaftGRPCSignBlockRequest) Descriptor() ([]byte, []int) {
+ return file_raftservice_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *RaftGRPCSignBlockRequest) GetChainID() string {
+ if x != nil {
+ return x.ChainID
+ }
+ return ""
+}
+
+func (x *RaftGRPCSignBlockRequest) GetBlock() *Block {
+ if x != nil {
+ return x.Block
+ }
+ return nil
+}
+
+type RaftGRPCSignBlockResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Signature []byte `protobuf:"bytes,1,opt,name=signature,proto3" json:"signature,omitempty"`
+}
+
+func (x *RaftGRPCSignBlockResponse) Reset() {
+ *x = RaftGRPCSignBlockResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_raftservice_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RaftGRPCSignBlockResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RaftGRPCSignBlockResponse) ProtoMessage() {}
+
+func (x *RaftGRPCSignBlockResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_raftservice_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RaftGRPCSignBlockResponse.ProtoReflect.Descriptor instead.
+func (*RaftGRPCSignBlockResponse) Descriptor() ([]byte, []int) {
+ return file_raftservice_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *RaftGRPCSignBlockResponse) GetSignature() []byte {
+ if x != nil {
+ return x.Signature
+ }
+ return nil
+}
+
+type RaftGRPCTransferLeadershipRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ LeaderID string `protobuf:"bytes,1,opt,name=leaderID,proto3" json:"leaderID,omitempty"`
+}
+
+func (x *RaftGRPCTransferLeadershipRequest) Reset() {
+ *x = RaftGRPCTransferLeadershipRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_raftservice_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RaftGRPCTransferLeadershipRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RaftGRPCTransferLeadershipRequest) ProtoMessage() {}
+
+func (x *RaftGRPCTransferLeadershipRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_raftservice_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RaftGRPCTransferLeadershipRequest.ProtoReflect.Descriptor instead.
+func (*RaftGRPCTransferLeadershipRequest) Descriptor() ([]byte, []int) {
+ return file_raftservice_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *RaftGRPCTransferLeadershipRequest) GetLeaderID() string {
+ if x != nil {
+ return x.LeaderID
+ }
+ return ""
+}
+
+type RaftGRPCTransferLeadershipResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ LeaderID string `protobuf:"bytes,1,opt,name=leaderID,proto3" json:"leaderID,omitempty"`
+ LeaderAddress string `protobuf:"bytes,2,opt,name=leaderAddress,proto3" json:"leaderAddress,omitempty"`
+}
+
+func (x *RaftGRPCTransferLeadershipResponse) Reset() {
+ *x = RaftGRPCTransferLeadershipResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_raftservice_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RaftGRPCTransferLeadershipResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RaftGRPCTransferLeadershipResponse) ProtoMessage() {}
+
+func (x *RaftGRPCTransferLeadershipResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_raftservice_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RaftGRPCTransferLeadershipResponse.ProtoReflect.Descriptor instead.
+func (*RaftGRPCTransferLeadershipResponse) Descriptor() ([]byte, []int) {
+ return file_raftservice_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *RaftGRPCTransferLeadershipResponse) GetLeaderID() string {
+ if x != nil {
+ return x.LeaderID
+ }
+ return ""
+}
+
+func (x *RaftGRPCTransferLeadershipResponse) GetLeaderAddress() string {
+ if x != nil {
+ return x.LeaderAddress
+ }
+ return ""
+}
+
+type RaftGRPCGetLeaderRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+}
+
+func (x *RaftGRPCGetLeaderRequest) Reset() {
+ *x = RaftGRPCGetLeaderRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_raftservice_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RaftGRPCGetLeaderRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RaftGRPCGetLeaderRequest) ProtoMessage() {}
+
+func (x *RaftGRPCGetLeaderRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_raftservice_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RaftGRPCGetLeaderRequest.ProtoReflect.Descriptor instead.
+func (*RaftGRPCGetLeaderRequest) Descriptor() ([]byte, []int) {
+ return file_raftservice_proto_rawDescGZIP(), []int{5}
+}
+
+type RaftGRPCGetLeaderResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Leader string `protobuf:"bytes,1,opt,name=leader,proto3" json:"leader,omitempty"`
+}
+
+func (x *RaftGRPCGetLeaderResponse) Reset() {
+ *x = RaftGRPCGetLeaderResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_raftservice_proto_msgTypes[6]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *RaftGRPCGetLeaderResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*RaftGRPCGetLeaderResponse) ProtoMessage() {}
+
+func (x *RaftGRPCGetLeaderResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_raftservice_proto_msgTypes[6]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use RaftGRPCGetLeaderResponse.ProtoReflect.Descriptor instead.
+func (*RaftGRPCGetLeaderResponse) Descriptor() ([]byte, []int) {
+ return file_raftservice_proto_rawDescGZIP(), []int{6}
+}
+
+func (x *RaftGRPCGetLeaderResponse) GetLeader() string {
+ if x != nil {
+ return x.Leader
+ }
+ return ""
+}
+
+var File_raftservice_proto protoreflect.FileDescriptor
+
+var file_raftservice_proto_rawDesc = []byte{
+ 0x0a, 0x11, 0x72, 0x61, 0x66, 0x74, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x85, 0x01, 0x0a, 0x05, 0x42,
+ 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x16, 0x0a, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01,
+ 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05,
+ 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x02, 0x20, 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x6f, 0x75,
+ 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74, 0x65, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05,
+ 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x42, 0x79,
+ 0x74, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x42,
+ 0x79, 0x74, 0x65, 0x73, 0x12, 0x1c, 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d,
+ 0x70, 0x18, 0x05, 0x20, 0x01, 0x28, 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61,
+ 0x6d, 0x70, 0x22, 0x58, 0x0a, 0x18, 0x52, 0x61, 0x66, 0x74, 0x47, 0x52, 0x50, 0x43, 0x53, 0x69,
+ 0x67, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18,
+ 0x0a, 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52,
+ 0x07, 0x63, 0x68, 0x61, 0x69, 0x6e, 0x49, 0x44, 0x12, 0x22, 0x0a, 0x05, 0x62, 0x6c, 0x6f, 0x63,
+ 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
+ 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x05, 0x62, 0x6c, 0x6f, 0x63, 0x6b, 0x22, 0x39, 0x0a, 0x19,
+ 0x52, 0x61, 0x66, 0x74, 0x47, 0x52, 0x50, 0x43, 0x53, 0x69, 0x67, 0x6e, 0x42, 0x6c, 0x6f, 0x63,
+ 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67,
+ 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69,
+ 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x3f, 0x0a, 0x21, 0x52, 0x61, 0x66, 0x74, 0x47,
+ 0x52, 0x50, 0x43, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x64, 0x65,
+ 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08,
+ 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08,
+ 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x49, 0x44, 0x22, 0x66, 0x0a, 0x22, 0x52, 0x61, 0x66, 0x74,
+ 0x47, 0x52, 0x50, 0x43, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x64,
+ 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1a,
+ 0x0a, 0x08, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09,
+ 0x52, 0x08, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x49, 0x44, 0x12, 0x24, 0x0a, 0x0d, 0x6c, 0x65,
+ 0x61, 0x64, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x09, 0x52, 0x0d, 0x6c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x41, 0x64, 0x64, 0x72, 0x65, 0x73, 0x73,
+ 0x22, 0x1a, 0x0a, 0x18, 0x52, 0x61, 0x66, 0x74, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4c,
+ 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x22, 0x33, 0x0a, 0x19,
+ 0x52, 0x61, 0x66, 0x74, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65,
+ 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x16, 0x0a, 0x06, 0x6c, 0x65, 0x61,
+ 0x64, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x6c, 0x65, 0x61, 0x64, 0x65,
+ 0x72, 0x32, 0x9c, 0x02, 0x0a, 0x09, 0x49, 0x52, 0x61, 0x66, 0x74, 0x47, 0x52, 0x50, 0x43, 0x12,
+ 0x50, 0x0a, 0x09, 0x53, 0x69, 0x67, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x12, 0x1f, 0x2e, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x61, 0x66, 0x74, 0x47, 0x52, 0x50, 0x43, 0x53, 0x69, 0x67,
+ 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x61, 0x66, 0x74, 0x47, 0x52, 0x50, 0x43, 0x53, 0x69,
+ 0x67, 0x6e, 0x42, 0x6c, 0x6f, 0x63, 0x6b, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22,
+ 0x00, 0x12, 0x6b, 0x0a, 0x12, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x4c, 0x65, 0x61,
+ 0x64, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x12, 0x28, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e,
+ 0x52, 0x61, 0x66, 0x74, 0x47, 0x52, 0x50, 0x43, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72,
+ 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73,
+ 0x74, 0x1a, 0x29, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x61, 0x66, 0x74, 0x47, 0x52,
+ 0x50, 0x43, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x66, 0x65, 0x72, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72,
+ 0x73, 0x68, 0x69, 0x70, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x50,
+ 0x0a, 0x09, 0x47, 0x65, 0x74, 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x12, 0x1f, 0x2e, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x61, 0x66, 0x74, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4c,
+ 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x20, 0x2e, 0x70,
+ 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x52, 0x61, 0x66, 0x74, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74,
+ 0x4c, 0x65, 0x61, 0x64, 0x65, 0x72, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00,
+ 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75, 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73,
+ 0x74, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f, 0x76, 0x65, 0x2d, 0x76, 0x65, 0x6e, 0x74, 0x75,
+ 0x72, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x72, 0x63, 0x72, 0x75, 0x78, 0x2f, 0x70, 0x6b, 0x67, 0x2f,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_raftservice_proto_rawDescOnce sync.Once
+ file_raftservice_proto_rawDescData = file_raftservice_proto_rawDesc
+)
+
+func file_raftservice_proto_rawDescGZIP() []byte {
+ file_raftservice_proto_rawDescOnce.Do(func() {
+ file_raftservice_proto_rawDescData = protoimpl.X.CompressGZIP(file_raftservice_proto_rawDescData)
+ })
+ return file_raftservice_proto_rawDescData
+}
+
+var file_raftservice_proto_msgTypes = make([]protoimpl.MessageInfo, 7)
+var file_raftservice_proto_goTypes = []interface{}{
+ (*Block)(nil), // 0: proto.Block
+ (*RaftGRPCSignBlockRequest)(nil), // 1: proto.RaftGRPCSignBlockRequest
+ (*RaftGRPCSignBlockResponse)(nil), // 2: proto.RaftGRPCSignBlockResponse
+ (*RaftGRPCTransferLeadershipRequest)(nil), // 3: proto.RaftGRPCTransferLeadershipRequest
+ (*RaftGRPCTransferLeadershipResponse)(nil), // 4: proto.RaftGRPCTransferLeadershipResponse
+ (*RaftGRPCGetLeaderRequest)(nil), // 5: proto.RaftGRPCGetLeaderRequest
+ (*RaftGRPCGetLeaderResponse)(nil), // 6: proto.RaftGRPCGetLeaderResponse
+}
+var file_raftservice_proto_depIdxs = []int32{
+ 0, // 0: proto.RaftGRPCSignBlockRequest.block:type_name -> proto.Block
+ 1, // 1: proto.IRaftGRPC.SignBlock:input_type -> proto.RaftGRPCSignBlockRequest
+ 3, // 2: proto.IRaftGRPC.TransferLeadership:input_type -> proto.RaftGRPCTransferLeadershipRequest
+ 5, // 3: proto.IRaftGRPC.GetLeader:input_type -> proto.RaftGRPCGetLeaderRequest
+ 2, // 4: proto.IRaftGRPC.SignBlock:output_type -> proto.RaftGRPCSignBlockResponse
+ 4, // 5: proto.IRaftGRPC.TransferLeadership:output_type -> proto.RaftGRPCTransferLeadershipResponse
+ 6, // 6: proto.IRaftGRPC.GetLeader:output_type -> proto.RaftGRPCGetLeaderResponse
+ 4, // [4:7] is the sub-list for method output_type
+ 1, // [1:4] is the sub-list for method input_type
+ 1, // [1:1] is the sub-list for extension type_name
+ 1, // [1:1] is the sub-list for extension extendee
+ 0, // [0:1] is the sub-list for field type_name
+}
+
+func init() { file_raftservice_proto_init() }
+func file_raftservice_proto_init() {
+ if File_raftservice_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_raftservice_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Block); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_raftservice_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RaftGRPCSignBlockRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_raftservice_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RaftGRPCSignBlockResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_raftservice_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RaftGRPCTransferLeadershipRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_raftservice_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RaftGRPCTransferLeadershipResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_raftservice_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RaftGRPCGetLeaderRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_raftservice_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*RaftGRPCGetLeaderResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_raftservice_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 7,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_raftservice_proto_goTypes,
+ DependencyIndexes: file_raftservice_proto_depIdxs,
+ MessageInfos: file_raftservice_proto_msgTypes,
+ }.Build()
+ File_raftservice_proto = out.File
+ file_raftservice_proto_rawDesc = nil
+ file_raftservice_proto_goTypes = nil
+ file_raftservice_proto_depIdxs = nil
+}
diff --git a/pkg/proto/raftservice.proto b/pkg/proto/raftservice.proto
new file mode 100644
index 00000000..12d790a6
--- /dev/null
+++ b/pkg/proto/raftservice.proto
@@ -0,0 +1,48 @@
+syntax = "proto3";
+
+option go_package = "github.com/strangelove-ventures/horcrux/pkg/proto";
+
+package proto;
+
+// IRaftGRPC handles all the cosigner level "services"
+// All RPCs in ICosignerGRPCServer are Unary. This means the client sends a single request to the
+// server and gets a single response back, just like a normal function call
+
+service IRaftGRPC{
+ rpc SignBlock (RaftGRPCSignBlockRequest) returns (RaftGRPCSignBlockResponse) {}
+ rpc TransferLeadership (RaftGRPCTransferLeadershipRequest) returns (RaftGRPCTransferLeadershipResponse) {}
+ rpc GetLeader (RaftGRPCGetLeaderRequest) returns (RaftGRPCGetLeaderResponse) {}
+}
+
+
+message Block {
+ int64 height = 1;
+ int64 round = 2;
+ int32 step = 3;
+ bytes signBytes = 4;
+ int64 timestamp = 5;
+}
+
+message RaftGRPCSignBlockRequest {
+ string chainID = 1;
+ Block block = 2;
+}
+
+message RaftGRPCSignBlockResponse {
+ bytes signature = 1;
+}
+
+message RaftGRPCTransferLeadershipRequest {
+ string leaderID = 1;
+}
+
+message RaftGRPCTransferLeadershipResponse {
+ string leaderID = 1;
+ string leaderAddress = 2;
+}
+
+message RaftGRPCGetLeaderRequest {}
+
+message RaftGRPCGetLeaderResponse {
+ string leader = 1;
+}
diff --git a/pkg/proto/raftservice_grpc.pb.go b/pkg/proto/raftservice_grpc.pb.go
new file mode 100644
index 00000000..cb553695
--- /dev/null
+++ b/pkg/proto/raftservice_grpc.pb.go
@@ -0,0 +1,177 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.2.0
+// - protoc v3.13.0
+// source: raftservice.proto
+
+package proto
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+// IRaftGRPCClient is the client API for IRaftGRPC service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type IRaftGRPCClient interface {
+ SignBlock(ctx context.Context, in *RaftGRPCSignBlockRequest, opts ...grpc.CallOption) (*RaftGRPCSignBlockResponse, error)
+ TransferLeadership(ctx context.Context, in *RaftGRPCTransferLeadershipRequest, opts ...grpc.CallOption) (*RaftGRPCTransferLeadershipResponse, error)
+ GetLeader(ctx context.Context, in *RaftGRPCGetLeaderRequest, opts ...grpc.CallOption) (*RaftGRPCGetLeaderResponse, error)
+}
+
+type iRaftGRPCClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewIRaftGRPCClient(cc grpc.ClientConnInterface) IRaftGRPCClient {
+ return &iRaftGRPCClient{cc}
+}
+
+func (c *iRaftGRPCClient) SignBlock(ctx context.Context, in *RaftGRPCSignBlockRequest, opts ...grpc.CallOption) (*RaftGRPCSignBlockResponse, error) {
+ out := new(RaftGRPCSignBlockResponse)
+ err := c.cc.Invoke(ctx, "/proto.IRaftGRPC/SignBlock", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *iRaftGRPCClient) TransferLeadership(ctx context.Context, in *RaftGRPCTransferLeadershipRequest, opts ...grpc.CallOption) (*RaftGRPCTransferLeadershipResponse, error) {
+ out := new(RaftGRPCTransferLeadershipResponse)
+ err := c.cc.Invoke(ctx, "/proto.IRaftGRPC/TransferLeadership", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *iRaftGRPCClient) GetLeader(ctx context.Context, in *RaftGRPCGetLeaderRequest, opts ...grpc.CallOption) (*RaftGRPCGetLeaderResponse, error) {
+ out := new(RaftGRPCGetLeaderResponse)
+ err := c.cc.Invoke(ctx, "/proto.IRaftGRPC/GetLeader", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// IRaftGRPCServer is the server API for IRaftGRPC service.
+// All implementations must embed UnimplementedIRaftGRPCServer
+// for forward compatibility
+type IRaftGRPCServer interface {
+ SignBlock(context.Context, *RaftGRPCSignBlockRequest) (*RaftGRPCSignBlockResponse, error)
+ TransferLeadership(context.Context, *RaftGRPCTransferLeadershipRequest) (*RaftGRPCTransferLeadershipResponse, error)
+ GetLeader(context.Context, *RaftGRPCGetLeaderRequest) (*RaftGRPCGetLeaderResponse, error)
+ mustEmbedUnimplementedIRaftGRPCServer()
+}
+
+// UnimplementedIRaftGRPCServer must be embedded to have forward compatible implementations.
+type UnimplementedIRaftGRPCServer struct {
+}
+
+func (UnimplementedIRaftGRPCServer) SignBlock(context.Context, *RaftGRPCSignBlockRequest) (*RaftGRPCSignBlockResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SignBlock not implemented")
+}
+func (UnimplementedIRaftGRPCServer) TransferLeadership(context.Context, *RaftGRPCTransferLeadershipRequest) (*RaftGRPCTransferLeadershipResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method TransferLeadership not implemented")
+}
+func (UnimplementedIRaftGRPCServer) GetLeader(context.Context, *RaftGRPCGetLeaderRequest) (*RaftGRPCGetLeaderResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetLeader not implemented")
+}
+func (UnimplementedIRaftGRPCServer) mustEmbedUnimplementedIRaftGRPCServer() {}
+
+// UnsafeIRaftGRPCServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to IRaftGRPCServer will
+// result in compilation errors.
+type UnsafeIRaftGRPCServer interface {
+ mustEmbedUnimplementedIRaftGRPCServer()
+}
+
+func RegisterIRaftGRPCServer(s grpc.ServiceRegistrar, srv IRaftGRPCServer) {
+ s.RegisterService(&IRaftGRPC_ServiceDesc, srv)
+}
+
+func _IRaftGRPC_SignBlock_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(RaftGRPCSignBlockRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(IRaftGRPCServer).SignBlock(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/proto.IRaftGRPC/SignBlock",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(IRaftGRPCServer).SignBlock(ctx, req.(*RaftGRPCSignBlockRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _IRaftGRPC_TransferLeadership_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(RaftGRPCTransferLeadershipRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(IRaftGRPCServer).TransferLeadership(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/proto.IRaftGRPC/TransferLeadership",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(IRaftGRPCServer).TransferLeadership(ctx, req.(*RaftGRPCTransferLeadershipRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _IRaftGRPC_GetLeader_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(RaftGRPCGetLeaderRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(IRaftGRPCServer).GetLeader(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/proto.IRaftGRPC/GetLeader",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(IRaftGRPCServer).GetLeader(ctx, req.(*RaftGRPCGetLeaderRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// IRaftGRPC_ServiceDesc is the grpc.ServiceDesc for IRaftGRPC service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var IRaftGRPC_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "proto.IRaftGRPC",
+ HandlerType: (*IRaftGRPCServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "SignBlock",
+ Handler: _IRaftGRPC_SignBlock_Handler,
+ },
+ {
+ MethodName: "TransferLeadership",
+ Handler: _IRaftGRPC_TransferLeadership_Handler,
+ },
+ {
+ MethodName: "GetLeader",
+ Handler: _IRaftGRPC_GetLeader_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "raftservice.proto",
+}
diff --git a/pkg/proto/shamirservice.pb.go b/pkg/proto/shamirservice.pb.go
new file mode 100644
index 00000000..d1b6ad13
--- /dev/null
+++ b/pkg/proto/shamirservice.pb.go
@@ -0,0 +1,613 @@
+// Code generated by protoc-gen-go. DO NOT EDIT.
+// versions:
+// protoc-gen-go v1.28.1
+// protoc v3.13.0
+// source: shamirservice.proto
+
+package proto
+
+import (
+ protoreflect "google.golang.org/protobuf/reflect/protoreflect"
+ protoimpl "google.golang.org/protobuf/runtime/protoimpl"
+ reflect "reflect"
+ sync "sync"
+)
+
+const (
+ // Verify that this generated code is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion)
+ // Verify that runtime/protoimpl is sufficiently up-to-date.
+ _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20)
+)
+
+type Nonce struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ SourceID int32 `protobuf:"varint,1,opt,name=sourceID,proto3" json:"sourceID,omitempty"`
+ DestinationID int32 `protobuf:"varint,2,opt,name=destinationID,proto3" json:"destinationID,omitempty"`
+ PubKey []byte `protobuf:"bytes,3,opt,name=pubKey,proto3" json:"pubKey,omitempty"`
+ Share []byte `protobuf:"bytes,4,opt,name=share,proto3" json:"share,omitempty"`
+ Signature []byte `protobuf:"bytes,5,opt,name=signature,proto3" json:"signature,omitempty"`
+}
+
+func (x *Nonce) Reset() {
+ *x = Nonce{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_shamirservice_proto_msgTypes[0]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *Nonce) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*Nonce) ProtoMessage() {}
+
+func (x *Nonce) ProtoReflect() protoreflect.Message {
+ mi := &file_shamirservice_proto_msgTypes[0]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use Nonce.ProtoReflect.Descriptor instead.
+func (*Nonce) Descriptor() ([]byte, []int) {
+ return file_shamirservice_proto_rawDescGZIP(), []int{0}
+}
+
+func (x *Nonce) GetSourceID() int32 {
+ if x != nil {
+ return x.SourceID
+ }
+ return 0
+}
+
+func (x *Nonce) GetDestinationID() int32 {
+ if x != nil {
+ return x.DestinationID
+ }
+ return 0
+}
+
+func (x *Nonce) GetPubKey() []byte {
+ if x != nil {
+ return x.PubKey
+ }
+ return nil
+}
+
+func (x *Nonce) GetShare() []byte {
+ if x != nil {
+ return x.Share
+ }
+ return nil
+}
+
+func (x *Nonce) GetSignature() []byte {
+ if x != nil {
+ return x.Signature
+ }
+ return nil
+}
+
+type HRST struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Height int64 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"`
+ Round int64 `protobuf:"varint,2,opt,name=round,proto3" json:"round,omitempty"`
+ Step int32 `protobuf:"varint,3,opt,name=step,proto3" json:"step,omitempty"`
+ Timestamp int64 `protobuf:"varint,4,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
+}
+
+func (x *HRST) Reset() {
+ *x = HRST{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_shamirservice_proto_msgTypes[1]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *HRST) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*HRST) ProtoMessage() {}
+
+func (x *HRST) ProtoReflect() protoreflect.Message {
+ mi := &file_shamirservice_proto_msgTypes[1]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use HRST.ProtoReflect.Descriptor instead.
+func (*HRST) Descriptor() ([]byte, []int) {
+ return file_shamirservice_proto_rawDescGZIP(), []int{1}
+}
+
+func (x *HRST) GetHeight() int64 {
+ if x != nil {
+ return x.Height
+ }
+ return 0
+}
+
+func (x *HRST) GetRound() int64 {
+ if x != nil {
+ return x.Round
+ }
+ return 0
+}
+
+func (x *HRST) GetStep() int32 {
+ if x != nil {
+ return x.Step
+ }
+ return 0
+}
+
+func (x *HRST) GetTimestamp() int64 {
+ if x != nil {
+ return x.Timestamp
+ }
+ return 0
+}
+
+type CosignerGRPCSetNoncesAndSignRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Nonces []*Nonce `protobuf:"bytes,1,rep,name=nonces,proto3" json:"nonces,omitempty"`
+ Hrst *HRST `protobuf:"bytes,2,opt,name=hrst,proto3" json:"hrst,omitempty"`
+ SignBytes []byte `protobuf:"bytes,3,opt,name=signBytes,proto3" json:"signBytes,omitempty"`
+ ChainID string `protobuf:"bytes,4,opt,name=chainID,proto3" json:"chainID,omitempty"`
+}
+
+func (x *CosignerGRPCSetNoncesAndSignRequest) Reset() {
+ *x = CosignerGRPCSetNoncesAndSignRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_shamirservice_proto_msgTypes[2]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CosignerGRPCSetNoncesAndSignRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CosignerGRPCSetNoncesAndSignRequest) ProtoMessage() {}
+
+func (x *CosignerGRPCSetNoncesAndSignRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_shamirservice_proto_msgTypes[2]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CosignerGRPCSetNoncesAndSignRequest.ProtoReflect.Descriptor instead.
+func (*CosignerGRPCSetNoncesAndSignRequest) Descriptor() ([]byte, []int) {
+ return file_shamirservice_proto_rawDescGZIP(), []int{2}
+}
+
+func (x *CosignerGRPCSetNoncesAndSignRequest) GetNonces() []*Nonce {
+ if x != nil {
+ return x.Nonces
+ }
+ return nil
+}
+
+func (x *CosignerGRPCSetNoncesAndSignRequest) GetHrst() *HRST {
+ if x != nil {
+ return x.Hrst
+ }
+ return nil
+}
+
+func (x *CosignerGRPCSetNoncesAndSignRequest) GetSignBytes() []byte {
+ if x != nil {
+ return x.SignBytes
+ }
+ return nil
+}
+
+func (x *CosignerGRPCSetNoncesAndSignRequest) GetChainID() string {
+ if x != nil {
+ return x.ChainID
+ }
+ return ""
+}
+
+type CosignerGRPCSetNoncesAndSignResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ NoncePublic []byte `protobuf:"bytes,1,opt,name=noncePublic,proto3" json:"noncePublic,omitempty"`
+ Timestamp int64 `protobuf:"varint,2,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
+ Signature []byte `protobuf:"bytes,3,opt,name=signature,proto3" json:"signature,omitempty"`
+}
+
+func (x *CosignerGRPCSetNoncesAndSignResponse) Reset() {
+ *x = CosignerGRPCSetNoncesAndSignResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_shamirservice_proto_msgTypes[3]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CosignerGRPCSetNoncesAndSignResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CosignerGRPCSetNoncesAndSignResponse) ProtoMessage() {}
+
+func (x *CosignerGRPCSetNoncesAndSignResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_shamirservice_proto_msgTypes[3]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CosignerGRPCSetNoncesAndSignResponse.ProtoReflect.Descriptor instead.
+func (*CosignerGRPCSetNoncesAndSignResponse) Descriptor() ([]byte, []int) {
+ return file_shamirservice_proto_rawDescGZIP(), []int{3}
+}
+
+func (x *CosignerGRPCSetNoncesAndSignResponse) GetNoncePublic() []byte {
+ if x != nil {
+ return x.NoncePublic
+ }
+ return nil
+}
+
+func (x *CosignerGRPCSetNoncesAndSignResponse) GetTimestamp() int64 {
+ if x != nil {
+ return x.Timestamp
+ }
+ return 0
+}
+
+func (x *CosignerGRPCSetNoncesAndSignResponse) GetSignature() []byte {
+ if x != nil {
+ return x.Signature
+ }
+ return nil
+}
+
+type CosignerGRPCGetNoncesRequest struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Hrst *HRST `protobuf:"bytes,1,opt,name=hrst,proto3" json:"hrst,omitempty"`
+ ChainID string `protobuf:"bytes,2,opt,name=chainID,proto3" json:"chainID,omitempty"`
+}
+
+func (x *CosignerGRPCGetNoncesRequest) Reset() {
+ *x = CosignerGRPCGetNoncesRequest{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_shamirservice_proto_msgTypes[4]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CosignerGRPCGetNoncesRequest) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CosignerGRPCGetNoncesRequest) ProtoMessage() {}
+
+func (x *CosignerGRPCGetNoncesRequest) ProtoReflect() protoreflect.Message {
+ mi := &file_shamirservice_proto_msgTypes[4]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CosignerGRPCGetNoncesRequest.ProtoReflect.Descriptor instead.
+func (*CosignerGRPCGetNoncesRequest) Descriptor() ([]byte, []int) {
+ return file_shamirservice_proto_rawDescGZIP(), []int{4}
+}
+
+func (x *CosignerGRPCGetNoncesRequest) GetHrst() *HRST {
+ if x != nil {
+ return x.Hrst
+ }
+ return nil
+}
+
+func (x *CosignerGRPCGetNoncesRequest) GetChainID() string {
+ if x != nil {
+ return x.ChainID
+ }
+ return ""
+}
+
+type CosignerGRPCGetNoncesResponse struct {
+ state protoimpl.MessageState
+ sizeCache protoimpl.SizeCache
+ unknownFields protoimpl.UnknownFields
+
+ Nonces []*Nonce `protobuf:"bytes,1,rep,name=nonces,proto3" json:"nonces,omitempty"`
+}
+
+func (x *CosignerGRPCGetNoncesResponse) Reset() {
+ *x = CosignerGRPCGetNoncesResponse{}
+ if protoimpl.UnsafeEnabled {
+ mi := &file_shamirservice_proto_msgTypes[5]
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ ms.StoreMessageInfo(mi)
+ }
+}
+
+func (x *CosignerGRPCGetNoncesResponse) String() string {
+ return protoimpl.X.MessageStringOf(x)
+}
+
+func (*CosignerGRPCGetNoncesResponse) ProtoMessage() {}
+
+func (x *CosignerGRPCGetNoncesResponse) ProtoReflect() protoreflect.Message {
+ mi := &file_shamirservice_proto_msgTypes[5]
+ if protoimpl.UnsafeEnabled && x != nil {
+ ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x))
+ if ms.LoadMessageInfo() == nil {
+ ms.StoreMessageInfo(mi)
+ }
+ return ms
+ }
+ return mi.MessageOf(x)
+}
+
+// Deprecated: Use CosignerGRPCGetNoncesResponse.ProtoReflect.Descriptor instead.
+func (*CosignerGRPCGetNoncesResponse) Descriptor() ([]byte, []int) {
+ return file_shamirservice_proto_rawDescGZIP(), []int{5}
+}
+
+func (x *CosignerGRPCGetNoncesResponse) GetNonces() []*Nonce {
+ if x != nil {
+ return x.Nonces
+ }
+ return nil
+}
+
+var File_shamirservice_proto protoreflect.FileDescriptor
+
+var file_shamirservice_proto_rawDesc = []byte{
+ 0x0a, 0x13, 0x73, 0x68, 0x61, 0x6d, 0x69, 0x72, 0x73, 0x65, 0x72, 0x76, 0x69, 0x63, 0x65, 0x2e,
+ 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x22, 0x95, 0x01, 0x0a,
+ 0x05, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x12, 0x1a, 0x0a, 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
+ 0x49, 0x44, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65,
+ 0x49, 0x44, 0x12, 0x24, 0x0a, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x61, 0x74, 0x69, 0x6f,
+ 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0d, 0x64, 0x65, 0x73, 0x74, 0x69,
+ 0x6e, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x49, 0x44, 0x12, 0x16, 0x0a, 0x06, 0x70, 0x75, 0x62, 0x4b,
+ 0x65, 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x06, 0x70, 0x75, 0x62, 0x4b, 0x65, 0x79,
+ 0x12, 0x14, 0x0a, 0x05, 0x73, 0x68, 0x61, 0x72, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x0c, 0x52,
+ 0x05, 0x73, 0x68, 0x61, 0x72, 0x65, 0x12, 0x1c, 0x0a, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74,
+ 0x75, 0x72, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61,
+ 0x74, 0x75, 0x72, 0x65, 0x22, 0x66, 0x0a, 0x04, 0x48, 0x52, 0x53, 0x54, 0x12, 0x16, 0x0a, 0x06,
+ 0x68, 0x65, 0x69, 0x67, 0x68, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x03, 0x52, 0x06, 0x68, 0x65,
+ 0x69, 0x67, 0x68, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x18, 0x02, 0x20,
+ 0x01, 0x28, 0x03, 0x52, 0x05, 0x72, 0x6f, 0x75, 0x6e, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x73, 0x74,
+ 0x65, 0x70, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x73, 0x74, 0x65, 0x70, 0x12, 0x1c,
+ 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x04, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x22, 0xa4, 0x01, 0x0a,
+ 0x23, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x53, 0x65, 0x74,
+ 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x41, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71,
+ 0x75, 0x65, 0x73, 0x74, 0x12, 0x24, 0x0a, 0x06, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x18, 0x01,
+ 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e, 0x6f, 0x6e,
+ 0x63, 0x65, 0x52, 0x06, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x1f, 0x0a, 0x04, 0x68, 0x72,
+ 0x73, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x2e, 0x48, 0x52, 0x53, 0x54, 0x52, 0x04, 0x68, 0x72, 0x73, 0x74, 0x12, 0x1c, 0x0a, 0x09, 0x73,
+ 0x69, 0x67, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52, 0x09,
+ 0x73, 0x69, 0x67, 0x6e, 0x42, 0x79, 0x74, 0x65, 0x73, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61,
+ 0x69, 0x6e, 0x49, 0x44, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68, 0x61, 0x69,
+ 0x6e, 0x49, 0x44, 0x22, 0x84, 0x01, 0x0a, 0x24, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72,
+ 0x47, 0x52, 0x50, 0x43, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x41, 0x6e, 0x64,
+ 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x20, 0x0a, 0x0b,
+ 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x18, 0x01, 0x20, 0x01, 0x28,
+ 0x0c, 0x52, 0x0b, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x50, 0x75, 0x62, 0x6c, 0x69, 0x63, 0x12, 0x1c,
+ 0x0a, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x18, 0x02, 0x20, 0x01, 0x28,
+ 0x03, 0x52, 0x09, 0x74, 0x69, 0x6d, 0x65, 0x73, 0x74, 0x61, 0x6d, 0x70, 0x12, 0x1c, 0x0a, 0x09,
+ 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x0c, 0x52,
+ 0x09, 0x73, 0x69, 0x67, 0x6e, 0x61, 0x74, 0x75, 0x72, 0x65, 0x22, 0x59, 0x0a, 0x1c, 0x43, 0x6f,
+ 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x6e,
+ 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1f, 0x0a, 0x04, 0x68, 0x72,
+ 0x73, 0x74, 0x18, 0x01, 0x20, 0x01, 0x28, 0x0b, 0x32, 0x0b, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f,
+ 0x2e, 0x48, 0x52, 0x53, 0x54, 0x52, 0x04, 0x68, 0x72, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63,
+ 0x68, 0x61, 0x69, 0x6e, 0x49, 0x44, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x63, 0x68,
+ 0x61, 0x69, 0x6e, 0x49, 0x44, 0x22, 0x45, 0x0a, 0x1d, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65,
+ 0x72, 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65,
+ 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x24, 0x0a, 0x06, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x73,
+ 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x4e,
+ 0x6f, 0x6e, 0x63, 0x65, 0x52, 0x06, 0x6e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x32, 0xd8, 0x01, 0x0a,
+ 0x0d, 0x49, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x12, 0x6d,
+ 0x0a, 0x10, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x41, 0x6e, 0x64, 0x53, 0x69,
+ 0x67, 0x6e, 0x12, 0x2a, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73, 0x69, 0x67,
+ 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73,
+ 0x41, 0x6e, 0x64, 0x53, 0x69, 0x67, 0x6e, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x2b,
+ 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47,
+ 0x52, 0x50, 0x43, 0x53, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x41, 0x6e, 0x64, 0x53,
+ 0x69, 0x67, 0x6e, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x58, 0x0a,
+ 0x09, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x12, 0x23, 0x2e, 0x70, 0x72, 0x6f,
+ 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72, 0x47, 0x52, 0x50, 0x43, 0x47,
+ 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a,
+ 0x24, 0x2e, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2e, 0x43, 0x6f, 0x73, 0x69, 0x67, 0x6e, 0x65, 0x72,
+ 0x47, 0x52, 0x50, 0x43, 0x47, 0x65, 0x74, 0x4e, 0x6f, 0x6e, 0x63, 0x65, 0x73, 0x52, 0x65, 0x73,
+ 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x33, 0x5a, 0x31, 0x67, 0x69, 0x74, 0x68, 0x75,
+ 0x62, 0x2e, 0x63, 0x6f, 0x6d, 0x2f, 0x73, 0x74, 0x72, 0x61, 0x6e, 0x67, 0x65, 0x6c, 0x6f, 0x76,
+ 0x65, 0x2d, 0x76, 0x65, 0x6e, 0x74, 0x75, 0x72, 0x65, 0x73, 0x2f, 0x68, 0x6f, 0x72, 0x63, 0x72,
+ 0x75, 0x78, 0x2f, 0x70, 0x6b, 0x67, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x62, 0x06, 0x70, 0x72,
+ 0x6f, 0x74, 0x6f, 0x33,
+}
+
+var (
+ file_shamirservice_proto_rawDescOnce sync.Once
+ file_shamirservice_proto_rawDescData = file_shamirservice_proto_rawDesc
+)
+
+func file_shamirservice_proto_rawDescGZIP() []byte {
+ file_shamirservice_proto_rawDescOnce.Do(func() {
+ file_shamirservice_proto_rawDescData = protoimpl.X.CompressGZIP(file_shamirservice_proto_rawDescData)
+ })
+ return file_shamirservice_proto_rawDescData
+}
+
+var file_shamirservice_proto_msgTypes = make([]protoimpl.MessageInfo, 6)
+var file_shamirservice_proto_goTypes = []interface{}{
+ (*Nonce)(nil), // 0: proto.Nonce
+ (*HRST)(nil), // 1: proto.HRST
+ (*CosignerGRPCSetNoncesAndSignRequest)(nil), // 2: proto.CosignerGRPCSetNoncesAndSignRequest
+ (*CosignerGRPCSetNoncesAndSignResponse)(nil), // 3: proto.CosignerGRPCSetNoncesAndSignResponse
+ (*CosignerGRPCGetNoncesRequest)(nil), // 4: proto.CosignerGRPCGetNoncesRequest
+ (*CosignerGRPCGetNoncesResponse)(nil), // 5: proto.CosignerGRPCGetNoncesResponse
+}
+var file_shamirservice_proto_depIdxs = []int32{
+ 0, // 0: proto.CosignerGRPCSetNoncesAndSignRequest.nonces:type_name -> proto.Nonce
+ 1, // 1: proto.CosignerGRPCSetNoncesAndSignRequest.hrst:type_name -> proto.HRST
+ 1, // 2: proto.CosignerGRPCGetNoncesRequest.hrst:type_name -> proto.HRST
+ 0, // 3: proto.CosignerGRPCGetNoncesResponse.nonces:type_name -> proto.Nonce
+ 2, // 4: proto.ICosignerGRPC.SetNoncesAndSign:input_type -> proto.CosignerGRPCSetNoncesAndSignRequest
+ 4, // 5: proto.ICosignerGRPC.GetNonces:input_type -> proto.CosignerGRPCGetNoncesRequest
+ 3, // 6: proto.ICosignerGRPC.SetNoncesAndSign:output_type -> proto.CosignerGRPCSetNoncesAndSignResponse
+ 5, // 7: proto.ICosignerGRPC.GetNonces:output_type -> proto.CosignerGRPCGetNoncesResponse
+ 6, // [6:8] is the sub-list for method output_type
+ 4, // [4:6] is the sub-list for method input_type
+ 4, // [4:4] is the sub-list for extension type_name
+ 4, // [4:4] is the sub-list for extension extendee
+ 0, // [0:4] is the sub-list for field type_name
+}
+
+func init() { file_shamirservice_proto_init() }
+func file_shamirservice_proto_init() {
+ if File_shamirservice_proto != nil {
+ return
+ }
+ if !protoimpl.UnsafeEnabled {
+ file_shamirservice_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*Nonce); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_shamirservice_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*HRST); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_shamirservice_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CosignerGRPCSetNoncesAndSignRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_shamirservice_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CosignerGRPCSetNoncesAndSignResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_shamirservice_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CosignerGRPCGetNoncesRequest); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ file_shamirservice_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} {
+ switch v := v.(*CosignerGRPCGetNoncesResponse); i {
+ case 0:
+ return &v.state
+ case 1:
+ return &v.sizeCache
+ case 2:
+ return &v.unknownFields
+ default:
+ return nil
+ }
+ }
+ }
+ type x struct{}
+ out := protoimpl.TypeBuilder{
+ File: protoimpl.DescBuilder{
+ GoPackagePath: reflect.TypeOf(x{}).PkgPath(),
+ RawDescriptor: file_shamirservice_proto_rawDesc,
+ NumEnums: 0,
+ NumMessages: 6,
+ NumExtensions: 0,
+ NumServices: 1,
+ },
+ GoTypes: file_shamirservice_proto_goTypes,
+ DependencyIndexes: file_shamirservice_proto_depIdxs,
+ MessageInfos: file_shamirservice_proto_msgTypes,
+ }.Build()
+ File_shamirservice_proto = out.File
+ file_shamirservice_proto_rawDesc = nil
+ file_shamirservice_proto_goTypes = nil
+ file_shamirservice_proto_depIdxs = nil
+}
diff --git a/pkg/proto/shamirservice.proto b/pkg/proto/shamirservice.proto
new file mode 100644
index 00000000..58cf0b0f
--- /dev/null
+++ b/pkg/proto/shamirservice.proto
@@ -0,0 +1,52 @@
+syntax = "proto3";
+
+option go_package = "github.com/strangelove-ventures/horcrux/pkg/proto";
+
+package proto;
+
+// TODO: Change name to CosignerService?
+// CosignerGRPC handles all the cosigner level "services"
+// All RPCs in ICosignerGRPCS are Unary. This means the client sends a single request to the
+// server and gets a single response back, just like a normal function call.
+service ICosignerGRPC {
+ rpc SetNoncesAndSign (CosignerGRPCSetNoncesAndSignRequest) returns (CosignerGRPCSetNoncesAndSignResponse) {}
+ rpc GetNonces (CosignerGRPCGetNoncesRequest) returns (CosignerGRPCGetNoncesResponse) {}
+
+}
+
+message Nonce {
+ int32 sourceID = 1;
+ int32 destinationID = 2;
+ bytes pubKey = 3;
+ bytes share = 4;
+ bytes signature = 5;
+}
+
+message HRST {
+ int64 height = 1;
+ int64 round = 2;
+ int32 step = 3;
+ int64 timestamp = 4;
+}
+
+message CosignerGRPCSetNoncesAndSignRequest {
+ repeated Nonce nonces = 1;
+ HRST hrst = 2;
+ bytes signBytes = 3;
+ string chainID = 4;
+}
+
+message CosignerGRPCSetNoncesAndSignResponse {
+ bytes noncePublic = 1;
+ int64 timestamp = 2;
+ bytes signature = 3;
+}
+
+message CosignerGRPCGetNoncesRequest {
+ HRST hrst = 1;
+ string chainID = 2;
+}
+
+message CosignerGRPCGetNoncesResponse {
+ repeated Nonce nonces = 1;
+}
diff --git a/pkg/proto/shamirservice_grpc.pb.go b/pkg/proto/shamirservice_grpc.pb.go
new file mode 100644
index 00000000..d31222ec
--- /dev/null
+++ b/pkg/proto/shamirservice_grpc.pb.go
@@ -0,0 +1,141 @@
+// Code generated by protoc-gen-go-grpc. DO NOT EDIT.
+// versions:
+// - protoc-gen-go-grpc v1.2.0
+// - protoc v3.13.0
+// source: shamirservice.proto
+
+package proto
+
+import (
+ context "context"
+ grpc "google.golang.org/grpc"
+ codes "google.golang.org/grpc/codes"
+ status "google.golang.org/grpc/status"
+)
+
+// This is a compile-time assertion to ensure that this generated file
+// is compatible with the grpc package it is being compiled against.
+// Requires gRPC-Go v1.32.0 or later.
+const _ = grpc.SupportPackageIsVersion7
+
+// ICosignerGRPCClient is the client API for ICosignerGRPC service.
+//
+// For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.
+type ICosignerGRPCClient interface {
+ SetNoncesAndSign(ctx context.Context, in *CosignerGRPCSetNoncesAndSignRequest, opts ...grpc.CallOption) (*CosignerGRPCSetNoncesAndSignResponse, error)
+ GetNonces(ctx context.Context, in *CosignerGRPCGetNoncesRequest, opts ...grpc.CallOption) (*CosignerGRPCGetNoncesResponse, error)
+}
+
+type iCosignerGRPCClient struct {
+ cc grpc.ClientConnInterface
+}
+
+func NewICosignerGRPCClient(cc grpc.ClientConnInterface) ICosignerGRPCClient {
+ return &iCosignerGRPCClient{cc}
+}
+
+func (c *iCosignerGRPCClient) SetNoncesAndSign(ctx context.Context, in *CosignerGRPCSetNoncesAndSignRequest, opts ...grpc.CallOption) (*CosignerGRPCSetNoncesAndSignResponse, error) {
+ out := new(CosignerGRPCSetNoncesAndSignResponse)
+ err := c.cc.Invoke(ctx, "/proto.ICosignerGRPC/SetNoncesAndSign", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+func (c *iCosignerGRPCClient) GetNonces(ctx context.Context, in *CosignerGRPCGetNoncesRequest, opts ...grpc.CallOption) (*CosignerGRPCGetNoncesResponse, error) {
+ out := new(CosignerGRPCGetNoncesResponse)
+ err := c.cc.Invoke(ctx, "/proto.ICosignerGRPC/GetNonces", in, out, opts...)
+ if err != nil {
+ return nil, err
+ }
+ return out, nil
+}
+
+// ICosignerGRPCServer is the server API for ICosignerGRPC service.
+// All implementations must embed UnimplementedICosignerGRPCServer
+// for forward compatibility
+type ICosignerGRPCServer interface {
+ SetNoncesAndSign(context.Context, *CosignerGRPCSetNoncesAndSignRequest) (*CosignerGRPCSetNoncesAndSignResponse, error)
+ GetNonces(context.Context, *CosignerGRPCGetNoncesRequest) (*CosignerGRPCGetNoncesResponse, error)
+ mustEmbedUnimplementedICosignerGRPCServer()
+}
+
+// UnimplementedICosignerGRPCServer must be embedded to have forward compatible implementations.
+type UnimplementedICosignerGRPCServer struct {
+}
+
+func (UnimplementedICosignerGRPCServer) SetNoncesAndSign(context.Context, *CosignerGRPCSetNoncesAndSignRequest) (*CosignerGRPCSetNoncesAndSignResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method SetNoncesAndSign not implemented")
+}
+func (UnimplementedICosignerGRPCServer) GetNonces(context.Context, *CosignerGRPCGetNoncesRequest) (*CosignerGRPCGetNoncesResponse, error) {
+ return nil, status.Errorf(codes.Unimplemented, "method GetNonces not implemented")
+}
+func (UnimplementedICosignerGRPCServer) mustEmbedUnimplementedICosignerGRPCServer() {}
+
+// UnsafeICosignerGRPCServer may be embedded to opt out of forward compatibility for this service.
+// Use of this interface is not recommended, as added methods to ICosignerGRPCServer will
+// result in compilation errors.
+type UnsafeICosignerGRPCServer interface {
+ mustEmbedUnimplementedICosignerGRPCServer()
+}
+
+func RegisterICosignerGRPCServer(s grpc.ServiceRegistrar, srv ICosignerGRPCServer) {
+ s.RegisterService(&ICosignerGRPC_ServiceDesc, srv)
+}
+
+func _ICosignerGRPC_SetNoncesAndSign_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CosignerGRPCSetNoncesAndSignRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ICosignerGRPCServer).SetNoncesAndSign(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/proto.ICosignerGRPC/SetNoncesAndSign",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ICosignerGRPCServer).SetNoncesAndSign(ctx, req.(*CosignerGRPCSetNoncesAndSignRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+func _ICosignerGRPC_GetNonces_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error, interceptor grpc.UnaryServerInterceptor) (interface{}, error) {
+ in := new(CosignerGRPCGetNoncesRequest)
+ if err := dec(in); err != nil {
+ return nil, err
+ }
+ if interceptor == nil {
+ return srv.(ICosignerGRPCServer).GetNonces(ctx, in)
+ }
+ info := &grpc.UnaryServerInfo{
+ Server: srv,
+ FullMethod: "/proto.ICosignerGRPC/GetNonces",
+ }
+ handler := func(ctx context.Context, req interface{}) (interface{}, error) {
+ return srv.(ICosignerGRPCServer).GetNonces(ctx, req.(*CosignerGRPCGetNoncesRequest))
+ }
+ return interceptor(ctx, in, info, handler)
+}
+
+// ICosignerGRPC_ServiceDesc is the grpc.ServiceDesc for ICosignerGRPC service.
+// It's only intended for direct use with grpc.RegisterService,
+// and not to be introspected or modified (even as a copy)
+var ICosignerGRPC_ServiceDesc = grpc.ServiceDesc{
+ ServiceName: "proto.ICosignerGRPC",
+ HandlerType: (*ICosignerGRPCServer)(nil),
+ Methods: []grpc.MethodDesc{
+ {
+ MethodName: "SetNoncesAndSign",
+ Handler: _ICosignerGRPC_SetNoncesAndSign_Handler,
+ },
+ {
+ MethodName: "GetNonces",
+ Handler: _ICosignerGRPC_GetNonces_Handler,
+ },
+ },
+ Streams: []grpc.StreamDesc{},
+ Metadata: "shamirservice.proto",
+}
diff --git a/pkg/types/sign_state.go b/pkg/types/sign_state.go
index 66e4c88a..c1f05aef 100644
--- a/pkg/types/sign_state.go
+++ b/pkg/types/sign_state.go
@@ -409,8 +409,8 @@ func LoadOrCreateSignState(filepath string) (*SignState, error) {
return nil, fmt.Errorf("unexpected error checking file existence (%s): %w", filepath, err)
}
- fmt.Printf("\n\tNo filepath for Signstate exist for:\n\t\t%s.", filepath)
- fmt.Printf("\n\tThis means NO(!) Signstate exists so we will create a new Signstate.\n")
+ // fmt.Printf("\n\tNo filepath for Signstate exist for:\n\t\t%s.", filepath)
+ //fmt.Printf("\n\tThis means NO(!) Signstate exists so we will create a new Signstate.\n")
// the only scenario where we want to create a new sign state file is when the file does not exist.
// Make an empty sign state and save it.
diff --git a/test/horcrux_test.go b/test/horcrux_test.go
index cb795a13..bfd2b692 100644
--- a/test/horcrux_test.go
+++ b/test/horcrux_test.go
@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/strangelove-ventures/horcrux/pkg/pcosigner"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
"sync"
"testing"
@@ -27,7 +28,7 @@ const (
// Test2Of3SignerOneSentry will spin up a chain with one single-node validator and one horcrux validator
// the horcrux validator will have three pcosigners nodes with a threshold of two, and one sentry node
func Test2Of3SignerOneSentry(t *testing.T) {
- testChainSingleNodeAndHorcruxThreshold(t, 2, 3, 2, 1, 1)
+ testChainSingleNodeAndHorcruxThreshold(t, 4, 3, 2, 1, 1)
}
// Test2Of3SignerTwoSentries will spin up a chain with one single-node validator and one horcrux validator
@@ -354,7 +355,7 @@ func TestMultipleChainHorcrux(t *testing.T) {
for i := 0; i < totalChains; i++ {
chainConfigs[i] = &cosignerChainConfig{
sentries: make([]cosmos.ChainNodes, sentriesPerSigner),
- shards: make([]pcosigner.CosignerEd25519Key, totalSigners),
+ shards: make([]cipher.CosignerEd25519Key, totalSigners),
}
}
@@ -446,7 +447,7 @@ func TestMultipleChainHorcrux(t *testing.T) {
type cosignerChainConfig struct {
chainID string
- shards []pcosigner.CosignerEd25519Key
+ shards []cipher.CosignerEd25519Key
sentries []cosmos.ChainNodes
}
diff --git a/test/validator.go b/test/validator.go
index 3d293e7c..481fec59 100644
--- a/test/validator.go
+++ b/test/validator.go
@@ -14,7 +14,7 @@ import (
"github.com/cosmos/cosmos-sdk/types/bech32"
slashingtypes "github.com/cosmos/cosmos-sdk/x/slashing/types"
"github.com/docker/docker/client"
- "github.com/strangelove-ventures/horcrux/pkg/proto"
+ proto "github.com/strangelove-ventures/horcrux/pkg/proto"
interchaintest "github.com/strangelove-ventures/interchaintest/v7"
"github.com/strangelove-ventures/interchaintest/v7/chain/cosmos"
"github.com/strangelove-ventures/interchaintest/v7/ibc"
@@ -268,9 +268,9 @@ func getLeader(ctx context.Context, cosigner *cosmos.SidecarProcess) (string, er
ctx, cancelFunc := context.WithTimeout(ctx, 10*time.Second)
defer cancelFunc()
- grpcClient := proto.NewICosignerGRPCServerClient(conn)
+ grpcClient := proto.NewIRaftGRPCClient(conn)
- res, err := grpcClient.GetLeader(ctx, &proto.CosignerGRPCGetLeaderRequest{})
+ res, err := grpcClient.GetLeader(ctx, &proto.RaftGRPCGetLeaderRequest{})
if err != nil {
return "", err
}
diff --git a/test/validator_threshold.go b/test/validator_threshold.go
index 07b8edbf..579c6af2 100644
--- a/test/validator_threshold.go
+++ b/test/validator_threshold.go
@@ -8,6 +8,8 @@ import (
"testing"
"time"
+ "github.com/strangelove-ventures/horcrux/pkg/pcosigner/cipher"
+
pcosigner "github.com/strangelove-ventures/horcrux/pkg/pcosigner"
"github.com/cometbft/cometbft/crypto"
@@ -251,13 +253,13 @@ func convertValidatorToHorcrux(
}
// getPrivvalKey gets the privval key from the validator and creates threshold shards from it.
-func getShardedPrivvalKey(ctx context.Context, node *cosmos.ChainNode, threshold uint8, shards uint8) ([]pcosigner.CosignerEd25519Key, crypto.PubKey, error) {
+func getShardedPrivvalKey(ctx context.Context, node *cosmos.ChainNode, threshold uint8, shards uint8) ([]cipher.CosignerEd25519Key, crypto.PubKey, error) {
pvKey, err := getPrivvalKey(ctx, node)
if err != nil {
return nil, nil, err
}
- ed25519Shards := pcosigner.CreateCosignerEd25519Shards(pvKey, threshold, shards)
+ ed25519Shards := cipher.CreateCosignerEd25519Shards(pvKey, threshold, shards)
return ed25519Shards, pvKey.PubKey, nil
}
@@ -265,7 +267,7 @@ func getShardedPrivvalKey(ctx context.Context, node *cosmos.ChainNode, threshold
// chainEd25519Shard is a wrapper for a chain ID and a shard of an ed25519 consensus key.
type chainEd25519Shard struct {
chainID string
- key pcosigner.CosignerEd25519Key
+ key cipher.CosignerEd25519Key
}
// writeConfigAndKeysThreshold writes the config and keys for a horcrux cosigner to the sidecar's docker volume.