Skip to content

Commit

Permalink
TestValidator (#71)
Browse files Browse the repository at this point in the history
* Add test with horcrux only. Refactor test framework

* Further test simplification

* Test with sentinel chain

* Fix test NPE

* Disable sentinel chain, leave as example. Add pubkey and consvalpub to address output.

* Use codec for pubkey marshal

* Merge PR #64: Sign votes with nil BlockID. Needed for some chains

* handle feedback

* Add TestLogger interface for logging and getting test name within non-direct test methods
  • Loading branch information
agouin authored Apr 12, 2022
1 parent 808b1ed commit 0f7cbf5
Show file tree
Hide file tree
Showing 13 changed files with 1,171 additions and 910 deletions.
35 changes: 13 additions & 22 deletions cmd/horcrux/cmd/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,19 @@ func initCmd() *cobra.Command {
home, _ = homedir.Dir()
home = path.Join(home, ".horcrux")
}
if _, err := os.Stat(homeDir); !os.IsNotExist(err) {
return fmt.Errorf("%s is not empty, check for existing configuration and clear path before trying again", homeDir)

configYamlPath := path.Join(home, "config.yaml")

cmdFlags := cmd.Flags()
overwrite, _ := cmdFlags.GetBool("overwrite")

if _, err := os.Stat(configYamlPath); !os.IsNotExist(err) && !overwrite {
return fmt.Errorf("%s already exists. Provide the -o flag to overwrite the existing config",
configYamlPath)
}

var cfg *Config

cmdFlags := cmd.Flags()
cs, _ := cmdFlags.GetBool("cosigner")
keyFile, _ := cmdFlags.GetString("keyfile")
if cs {
Expand Down Expand Up @@ -136,7 +142,7 @@ func initCmd() *cobra.Command {
return err
}
// create the config file
if err = writeConfigFile(path.Join(home, "config.yaml"), cfg); err != nil {
if err = writeConfigFile(configYamlPath, cfg); err != nil {
return err
}

Expand All @@ -153,6 +159,8 @@ func initCmd() *cobra.Command {
return err
}
}

fmt.Printf("Successfully initialized configuration: %s\n", configYamlPath)
return nil
},
}
Expand All @@ -165,6 +173,7 @@ func initCmd() *cobra.Command {
"priv val key file path (full key for single signer, or key share for cosigner)")
cmd.Flags().String("timeout", "1500ms", "configure cosigner rpc server timeout value, \n"+
"accepts valid duration strings for Go's time.ParseDuration() e.g. 1s, 1000ms, 1.5m")
cmd.Flags().BoolP("overwrite", "o", false, "set to overwrite an existing config.yaml")
return cmd
}

Expand Down Expand Up @@ -235,9 +244,6 @@ func addNodesCmd() *cobra.Command {
home, _ = homedir.Dir()
home = path.Join(home, ".horcrux")
}
if _, err := os.Stat(homeDir); !os.IsNotExist(err) {
return fmt.Errorf("%s is not empty, check for existing configuration and clear path before trying again", homeDir)
}

argNodes, err := chainNodesFromArg(args[0])
if err != nil {
Expand Down Expand Up @@ -278,9 +284,6 @@ func removeNodesCmd() *cobra.Command {
home, _ = homedir.Dir()
home = path.Join(home, ".horcrux")
}
if _, err := os.Stat(homeDir); !os.IsNotExist(err) {
return fmt.Errorf("%s is not empty, check for existing configuration and clear path before trying again", homeDir)
}

argNodes, err := chainNodesFromArg(args[0])
if err != nil {
Expand Down Expand Up @@ -344,9 +347,6 @@ func addPeersCmd() *cobra.Command {
home, _ = homedir.Dir()
home = path.Join(home, ".horcrux")
}
if _, err := os.Stat(homeDir); !os.IsNotExist(err) {
return fmt.Errorf("%s is not empty, check for existing configuration and clear path before trying again", homeDir)
}

argPeers, err := peersFromFlag(args[0])
if err != nil {
Expand Down Expand Up @@ -387,9 +387,6 @@ func removePeersCmd() *cobra.Command {
home, _ = homedir.Dir()
home = path.Join(home, ".horcrux")
}
if _, err := os.Stat(homeDir); !os.IsNotExist(err) {
return fmt.Errorf("%s is not empty, check for existing configuration and clear path before trying again", homeDir)
}

var argPeers []CosignerPeer
for _, peer := range config.CosignerConfig.Peers {
Expand Down Expand Up @@ -440,9 +437,6 @@ func setSharesCmd() *cobra.Command {
home, _ = homedir.Dir()
home = path.Join(home, ".horcrux")
}
if _, err := os.Stat(homeDir); !os.IsNotExist(err) {
return fmt.Errorf("%s is not empty, check for existing configuration and clear path before trying again", homeDir)
}

numShares, err := strconv.Atoi(args[0])
if err != nil {
Expand Down Expand Up @@ -500,9 +494,6 @@ func setChainIDCmd() *cobra.Command {
home, _ = homedir.Dir()
home = path.Join(home, ".horcrux")
}
if _, err = os.Stat(homeDir); !os.IsNotExist(err) {
return fmt.Errorf("%s is not empty, check for existing configuration and clear path before trying again", homeDir)
}

stateDir := path.Join(home, "state")
pvOldPath := path.Join(stateDir, config.ChainID+"_priv_validator_state.json")
Expand Down
28 changes: 23 additions & 5 deletions cmd/horcrux/cmd/cosigner.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,10 @@ var cosignerCmd = &cobra.Command{
}

type AddressCmdOutput struct {
HexAddress string
ValConsAddress string
HexAddress string
PubKey string
ValConsAddress string
ValConsPubAddress string
}

func AddressCmd() *cobra.Command {
Expand All @@ -57,18 +59,34 @@ func AddressCmd() *cobra.Command {
return fmt.Errorf("error reading cosigner key: %s", err)
}

pubKey := key.PubKey.Address()
pubKey := key.PubKey
pubKeyAddress := pubKey.Address()

pubKeyJSON, err := signer.PubKey("", pubKey)
if err != nil {
return err
}

output := AddressCmdOutput{
HexAddress: strings.ToUpper(hex.EncodeToString(pubKey)),
HexAddress: strings.ToUpper(hex.EncodeToString(pubKeyAddress)),
PubKey: pubKeyJSON,
}

if len(args) == 1 {
bech32ValConsAddress, err := bech32.ConvertAndEncode(args[0], pubKey)
bech32ValConsAddress, err := bech32.ConvertAndEncode(args[0]+"valcons", pubKeyAddress)
if err != nil {
return err
}
output.ValConsAddress = bech32ValConsAddress
pubKeyBech32, err := signer.PubKey(args[0], pubKey)
if err != nil {
return err
}
output.ValConsPubAddress = pubKeyBech32
} else {
bech32Hint := "Pass bech32 base prefix as argument to generate (e.g. cosmos)"
output.ValConsAddress = bech32Hint
output.ValConsPubAddress = bech32Hint
}

jsonOut, err := json.Marshal(output)
Expand Down
16 changes: 8 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,16 @@ module github.com/strangelove-ventures/horcrux
go 1.17

require (
github.com/Jille/grpc-multi-resolver v1.1.0
github.com/Jille/raft-grpc-leader-rpc v1.1.0
github.com/Jille/raft-grpc-transport v1.2.0
github.com/Jille/raftadmin v1.2.0
github.com/avast/retry-go v3.0.0+incompatible
github.com/cosmos/cosmos-sdk v0.44.5
github.com/gogo/protobuf v1.3.3
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0
github.com/hashicorp/raft v1.3.3
github.com/hashicorp/raft-boltdb v0.0.0-20211202195631-7d34b9fb3f42
github.com/mitchellh/go-homedir v1.1.0
github.com/ory/dockertest v3.3.5+incompatible
github.com/spf13/cobra v1.2.1
Expand All @@ -17,6 +23,8 @@ require (
gitlab.com/polychainlabs/edwards25519 v0.0.0-20200206000358-2272e01758fb
gitlab.com/polychainlabs/threshold-ed25519 v0.0.0-20200221030822-1c35a36a51c1
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
google.golang.org/grpc v1.44.0
google.golang.org/protobuf v1.27.1
gopkg.in/yaml.v2 v2.4.0
)

Expand All @@ -26,10 +34,6 @@ require (
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
github.com/ChainSafe/go-schnorrkel v0.0.0-20200405005733-88cbf1b4c40d // indirect
github.com/DataDog/zstd v1.4.5 // indirect
github.com/Jille/grpc-multi-resolver v1.1.0 // indirect
github.com/Jille/raft-grpc-leader-rpc v1.1.0 // indirect
github.com/Jille/raft-grpc-transport v1.2.0 // indirect
github.com/Jille/raftadmin v1.2.0 // indirect
github.com/Microsoft/go-winio v0.5.0 // indirect
github.com/Nvveen/Gotty v0.0.0-20120604004816-cd527374f1e5 // indirect
github.com/armon/go-metrics v0.3.9 // indirect
Expand Down Expand Up @@ -69,7 +73,6 @@ require (
github.com/gorilla/handlers v1.5.1 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.3.0 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/gsterjov/go-libsecret v0.0.0-20161001094733-a6f4afe4910c // indirect
github.com/gtank/merlin v0.1.1 // indirect
Expand All @@ -79,7 +82,6 @@ require (
github.com/hashicorp/go-msgpack v1.1.5 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/hashicorp/hcl v1.0.0 // indirect
github.com/hashicorp/raft-boltdb v0.0.0-20211202195631-7d34b9fb3f42 // indirect
github.com/hdevalence/ed25519consensus v0.0.0-20210204194344-59a8610d2b87 // indirect
github.com/inconshreveable/mousetrap v1.0.0 // indirect
github.com/jmhodges/levigo v1.0.0 // indirect
Expand Down Expand Up @@ -126,8 +128,6 @@ require (
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 // indirect
golang.org/x/text v0.3.7 // indirect
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 // indirect
google.golang.org/grpc v1.44.0 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
)
Expand Down
9 changes: 0 additions & 9 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,6 @@ github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/gofuzz v0.0.0-20170612174753-24818f796faf/go.mod h1:HP5RmnzzSNb993RKQDq4+1A4ia9nllfqcQFTQJedwGI=
github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa h1:Q75Upo5UN4JbPFURXZ8nLKYUvF85dyFRop/vQ0Rv+64=
github.com/google/gofuzz v1.1.1-0.20200604201612-c04b05f3adfa/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0=
github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg=
Expand Down Expand Up @@ -452,16 +451,13 @@ github.com/hashicorp/consul/sdk v0.3.0/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyN
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
github.com/hashicorp/go-cleanhttp v0.5.0/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-cleanhttp v0.5.1/go.mod h1:JpRdi6/HCYpAwUzNwuwqhbovhLtngrth3wmdIIUrZ80=
github.com/hashicorp/go-hclog v0.9.1 h1:9PZfAcVEvez4yhLH2TBU64/h/z4xlFI80cWXRrxuKuM=
github.com/hashicorp/go-hclog v0.9.1/go.mod h1:5CU+agLiy3J7N7QjHK5d05KxGsuXiQLrjA0H7acj2lQ=
github.com/hashicorp/go-hclog v0.16.2 h1:K4ev2ib4LdQETX5cSZBG0DVLk1jwGqSPXBjdah3veNs=
github.com/hashicorp/go-hclog v0.16.2/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
github.com/hashicorp/go-immutable-radix v1.0.0 h1:AKDB1HM5PWEA7i4nhcpwOrO2byshxBjXVn/J/3+z5/0=
github.com/hashicorp/go-immutable-radix v1.0.0/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
github.com/hashicorp/go-msgpack v0.5.3/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-msgpack v0.5.5 h1:i9R9JSrqIz0QVLz3sz+i3YJdT7TTSLcfLLzJi9aZTuI=
github.com/hashicorp/go-msgpack v0.5.5/go.mod h1:ahLV/dePpqEmjfWmKiqvPkv/twdG7iPBM1vqhUKIvfM=
github.com/hashicorp/go-msgpack v1.1.5 h1:9byZdVjKTe5mce63pRVNP1L7UAmdHOTEMGehn6KvJWs=
github.com/hashicorp/go-msgpack v1.1.5/go.mod h1:gWVc3sv/wbDmR3rQsj1CAktEZzoz1YNK9NfGLXJ69/4=
Expand Down Expand Up @@ -1025,7 +1021,6 @@ golang.org/x/net v0.0.0-20210316092652-d523dce5a7f4/go.mod h1:RBQZq4jEuRlivfhVLd
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-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f h1:w6wWR0H+nyVpbSAQbzVEIACVyr/h8l/BEkY6Sokc7Eg=
golang.org/x/net v0.0.0-20210903162142-ad29c8ab022f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20210907225631-ff17edfbf26d h1:kuk8nKPQ25KCDODLCDXt99tnTVeOyOM8HGvtJ0NzAvw=
golang.org/x/net v0.0.0-20210907225631-ff17edfbf26d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
Expand Down Expand Up @@ -1134,7 +1129,6 @@ golang.org/x/sys v0.0.0-20210603081109-ebe580a85c40/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210616094352-59db8d763f22/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210903071746-97244b99971b h1:3Dq0eVHn0uaQJmPO+/aYPI/fRMqdrVDbu7MQcku54gg=
golang.org/x/sys v0.0.0-20210903071746-97244b99971b/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34 h1:GkvMjFtXUmahfDtashnc1mnrCtuBVcwse5QV2lUk/tI=
golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
Expand All @@ -1148,7 +1142,6 @@ golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.7 h1:olpwvP2KacW1ZWvsR7uQhoyTYvKAupfQrRGBFM352Gk=
golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
Expand Down Expand Up @@ -1301,7 +1294,6 @@ google.golang.org/genproto v0.0.0-20210310155132-4ce2db91004e/go.mod h1:FWY/as6D
google.golang.org/genproto v0.0.0-20210319143718-93e7006c17a6/go.mod h1:FWY/as6DDZQgahTzZj3fqbO1CbirC29ZNUFHwi0/+no=
google.golang.org/genproto v0.0.0-20210402141018-6c239bbf2bb1/go.mod h1:9lPAdzaEmUacj36I+k7YKbEc5CXzPIeORRgDAUOu28A=
google.golang.org/genproto v0.0.0-20210602131652-f16073e35f0c/go.mod h1:UODoCrxHCcBojKKwX1terBiRUaqAsFqJiF615XL43r0=
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71 h1:z+ErRPu0+KS02Td3fOAgdX+lnPDh/VyaABEJPD4JRQs=
google.golang.org/genproto v0.0.0-20210828152312-66f60bf46e71/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83 h1:3V2dxSZpz4zozWWUq36vUxXEKnSYitEH2LdsAx+RUmg=
google.golang.org/genproto v0.0.0-20210903162649-d08c68adba83/go.mod h1:eFjDcFEctNawg4eG61bRv87N7iHBWyVhJu7u1kqDUXY=
Expand Down Expand Up @@ -1334,7 +1326,6 @@ google.golang.org/grpc v1.36.1/go.mod h1:qjiiYl8FncCW8feJPdyg3v6XW24KsRHe+dy9BAG
google.golang.org/grpc v1.37.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM=
google.golang.org/grpc v1.40.0/go.mod h1:ogyxbiOoUXAkP+4+xa6PZSE9DZgIHtSpzjDTB9KAK34=
google.golang.org/grpc v1.42.0 h1:XT2/MFpuPFsEX2fWh3YQtHkZ+WYZFQRfaUgLZYj/p6A=
google.golang.org/grpc v1.42.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
google.golang.org/grpc v1.44.0 h1:weqSxi/TMs1SqFRMHCtBgXRs8k3X39QIDEZ0pRcttUg=
google.golang.org/grpc v1.44.0/go.mod h1:k+4IHHFw41K8+bbowsex27ge2rCb65oeWqe4jJ590SU=
Expand Down
39 changes: 39 additions & 0 deletions signer/Config.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@ package signer
import (
"fmt"
"os"

"github.com/cosmos/cosmos-sdk/codec"
"github.com/cosmos/cosmos-sdk/codec/legacy"
"github.com/cosmos/cosmos-sdk/codec/types"
cryptocodec "github.com/cosmos/cosmos-sdk/crypto/codec"
"github.com/cosmos/cosmos-sdk/crypto/keys/ed25519"
cryptotypes "github.com/cosmos/cosmos-sdk/crypto/types"
"github.com/cosmos/cosmos-sdk/types/bech32"
"github.com/tendermint/tendermint/crypto"
)

type NodeConfig struct {
Expand Down Expand Up @@ -31,3 +40,33 @@ func (cfg *Config) KeyFileExists() error {
}
return nil
}

func PubKey(bech32BasePrefix string, pubKey crypto.PubKey) (string, error) {
if bech32BasePrefix != "" {
pubkey, err := cryptocodec.FromTmPubKeyInterface(pubKey)
if err != nil {
return "", err
}
consPubPrefix := bech32BasePrefix + "valconspub"
pubKeyBech32, err := bech32.ConvertAndEncode(consPubPrefix, legacy.Cdc.Amino.MustMarshalBinaryBare(pubkey))
if err != nil {
return "", err
}
return pubKeyBech32, nil
}

registry := types.NewInterfaceRegistry()
marshaler := codec.NewProtoCodec(registry)
var pk *cryptotypes.PubKey
registry.RegisterInterface("cosmos.crypto.PubKey", pk)
registry.RegisterImplementations(pk, &ed25519.PubKey{})
sdkPK, err := cryptocodec.FromTmPubKeyInterface(pubKey)
if err != nil {
return "", err
}
pubKeyJSON, err := marshaler.MarshalInterfaceJSON(sdkPK)
if err != nil {
return "", err
}
return string(pubKeyJSON), nil
}
11 changes: 0 additions & 11 deletions signer/threshold_validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
proto "github.com/strangelove-ventures/horcrux/signer/proto"
"github.com/tendermint/tendermint/crypto"
"github.com/tendermint/tendermint/libs/log"
"github.com/tendermint/tendermint/libs/protoio"
tmProto "github.com/tendermint/tendermint/proto/tendermint/types"
rpcTypes "github.com/tendermint/tendermint/rpc/jsonrpc/types"
tm "github.com/tendermint/tendermint/types"
Expand Down Expand Up @@ -291,16 +290,6 @@ func (pv *ThresholdValidator) getExistingBlockSignature(block *Block) ([]byte, t
func (pv *ThresholdValidator) SignBlock(chainID string, block *Block) ([]byte, time.Time, error) {
height, round, step, stamp, signBytes := block.Height, block.Round, block.Step, block.Timestamp, block.SignBytes

if step == stepPrevote || step == stepPrecommit {
var vote tmProto.CanonicalVote
if err := protoio.UnmarshalDelimited(signBytes, &vote); err != nil {
return nil, stamp, fmt.Errorf("signBytes cannot be unmarshalled into vote: %v", err)
}
if vote.BlockID == nil {
return nil, stamp, fmt.Errorf("refusing to sign nil BlockID")
}
}

// Only the leader can execute this function. Followers can handle the requests,
// but they just need to proxy the request to the raft leader
if pv.raftStore.raft == nil {
Expand Down
2 changes: 0 additions & 2 deletions test/Untitled-1

This file was deleted.

Loading

0 comments on commit 0f7cbf5

Please sign in to comment.