Browse Source

revert gogo

pull/1667/head
Ethan Buchman 6 years ago
parent
commit
485b4a0c6f
2 changed files with 16 additions and 16 deletions
  1. +3
    -3
      state/execution.go
  2. +13
    -13
      types/protobuf.go

+ 3
- 3
state/execution.go View File

@ -191,9 +191,9 @@ func execBlockOnProxyApp(logger log.Logger, proxyAppConn proxy.AppConnConsensus,
}
}
byzantineVals := make([]*abci.Evidence, len(block.Evidence.Evidence))
byzantineVals := make([]abci.Evidence, len(block.Evidence.Evidence))
for i, ev := range block.Evidence.Evidence {
byzantineVals[i] = &abci.Evidence{
byzantineVals[i] = abci.Evidence{
// TODO: fill this in
Height: ev.Height(),
}
@ -239,7 +239,7 @@ func execBlockOnProxyApp(logger log.Logger, proxyAppConn proxy.AppConnConsensus,
// If more or equal than 1/3 of total voting power changed in one block, then
// a light client could never prove the transition externally. See
// ./lite/doc.go for details on how a light client tracks validators.
func updateValidators(currentSet *types.ValidatorSet, updates []*abci.Validator) error {
func updateValidators(currentSet *types.ValidatorSet, updates []abci.Validator) error {
for _, v := range updates {
pubkey, err := types.PB2TM.PubKey(v.PubKey)
if err != nil {


+ 13
- 13
types/protobuf.go View File

@ -14,9 +14,9 @@ var TM2PB = tm2pb{}
type tm2pb struct{}
func (tm2pb) Header(header *Header) *types.Header {
return &types.Header{
ChainId: header.ChainID,
func (tm2pb) Header(header *Header) types.Header {
return types.Header{
ChainID: header.ChainID,
Height: header.Height,
Time: header.Time.Unix(),
NumTxs: int32(header.NumTxs), // XXX: overflow
@ -25,22 +25,22 @@ func (tm2pb) Header(header *Header) *types.Header {
}
}
func (tm2pb) Validator(val *Validator) *types.Validator {
return &types.Validator{
func (tm2pb) Validator(val *Validator) types.Validator {
return types.Validator{
PubKey: TM2PB.PubKey(val.PubKey),
Power: val.VotingPower,
}
}
func (tm2pb) PubKey(pubKey crypto.PubKey) *types.PubKey {
func (tm2pb) PubKey(pubKey crypto.PubKey) types.PubKey {
switch pk := pubKey.(type) {
case crypto.PubKeyEd25519:
return &types.PubKey{
return types.PubKey{
Type: "ed25519",
Data: pk[:],
}
case crypto.PubKeySecp256k1:
return &types.PubKey{
return types.PubKey{
Type: "secp256k1",
Data: pk[:],
}
@ -49,16 +49,16 @@ func (tm2pb) PubKey(pubKey crypto.PubKey) *types.PubKey {
}
}
func (tm2pb) Validators(vals *ValidatorSet) []*types.Validator {
validators := make([]*types.Validator, len(vals.Validators))
func (tm2pb) Validators(vals *ValidatorSet) []types.Validator {
validators := make([]types.Validator, len(vals.Validators))
for i, val := range vals.Validators {
validators[i] = TM2PB.Validator(val)
}
return validators
}
func (tm2pb) ConsensusParams(params *ConsensusParams) *types.ConsensusParams {
return &types.ConsensusParams{
func (tm2pb) ConsensusParams(params *ConsensusParams) types.ConsensusParams {
return types.ConsensusParams{
BlockSize: &types.BlockSize{
MaxBytes: int32(params.BlockSize.MaxBytes),
@ -84,7 +84,7 @@ var PB2TM = pb2tm{}
type pb2tm struct{}
// TODO: validate key lengths ...
func (pb2tm) PubKey(pubKey *types.PubKey) (crypto.PubKey, error) {
func (pb2tm) PubKey(pubKey types.PubKey) (crypto.PubKey, error) {
switch pubKey.Type {
case "ed25519":
var pk crypto.PubKeyEd25519


Loading…
Cancel
Save