types: uncomment some tests
This commit is contained in:
parent
c394eef7b8
commit
ff8c648c23
|
@ -28,14 +28,10 @@ func TestGenesis(t *testing.T) {
|
|||
assert.Error(t, err, "expected error for empty genDoc json")
|
||||
}
|
||||
|
||||
/* TODO WIRE enable json ...
|
||||
// test a good one by raw json
|
||||
genDocBytes := []byte(`{"genesis_time":"0001-01-01T00:00:00Z","chain_id":"test-chain-QDKdJr","consensus_params":null,"validators":[{"pub_key":{"type":"ed25519","data":"961EAB8752E51A03618502F55C2B6E09C38C65635C64CCF3173ED452CF86C957"},"power":10,"name":""}],"app_hash":"","app_state":{"account_owner": "Bob"}}`)
|
||||
_, err := GenesisDocFromJSON(genDocBytes)
|
||||
assert.NoError(t, err, "expected no error for good genDoc json")
|
||||
*/
|
||||
var genDocBytes []byte
|
||||
var err error
|
||||
|
||||
// create a base gendoc from struct
|
||||
baseGenDoc := &GenesisDoc{
|
||||
|
|
|
@ -32,7 +32,6 @@ func TestHeartbeatString(t *testing.T) {
|
|||
require.Equal(t, hb.String(), "Heartbeat{1:000000000000 11/02 (0) {/FF41E371B9BF.../}}")
|
||||
}
|
||||
|
||||
/* TODO WIRE make json work
|
||||
func TestHeartbeatWriteSignBytes(t *testing.T) {
|
||||
|
||||
hb := &Heartbeat{ValidatorIndex: 1, Height: 10, Round: 1}
|
||||
|
@ -49,4 +48,3 @@ func TestHeartbeatWriteSignBytes(t *testing.T) {
|
|||
require.Equal(t, string(bz), "null")
|
||||
})
|
||||
}
|
||||
*/
|
||||
|
|
|
@ -1,15 +1,19 @@
|
|||
package types
|
||||
|
||||
import (
|
||||
"encoding/hex"
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
)
|
||||
|
||||
/* TODO WIRE make json work ...
|
||||
func TestGenLoadValidator(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
||||
|
@ -73,7 +77,7 @@ func TestUnmarshalValidator(t *testing.T) {
|
|||
}`, addrStr, pubStr, privStr)
|
||||
|
||||
val := PrivValidatorFS{}
|
||||
err = wire.UnmarshalJSON([]byte(serialized), &val)
|
||||
err = json.Unmarshal([]byte(serialized), &val)
|
||||
require.Nil(err, "%+v", err)
|
||||
|
||||
// make sure the values match
|
||||
|
@ -82,11 +86,10 @@ func TestUnmarshalValidator(t *testing.T) {
|
|||
assert.EqualValues(privKey, val.PrivKey)
|
||||
|
||||
// export it and make sure it is the same
|
||||
out, err := wire.MarshalJSON(val)
|
||||
out, err := json.Marshal(val)
|
||||
require.Nil(err, "%+v", err)
|
||||
assert.JSONEq(serialized, string(out))
|
||||
}
|
||||
*/
|
||||
|
||||
func TestSignVote(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
|
|
|
@ -252,7 +252,6 @@ func (valSet *ValidatorSet) VerifyCommit(chainID string, blockID BlockID, height
|
|||
return fmt.Errorf("Invalid commit -- not precommit @ index %v", idx)
|
||||
}
|
||||
_, val := valSet.GetByIndex(idx)
|
||||
fmt.Println("IDX", idx, val)
|
||||
// Validate signature
|
||||
precommitSignBytes := precommit.SignBytes(chainID)
|
||||
if !val.PubKey.VerifyBytes(precommitSignBytes, precommit.Signature) {
|
||||
|
|
Loading…
Reference in New Issue