Skip to content

Commit

Permalink
go/consensus/tendermint: Properly update version now that we can
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Jul 4, 2020
1 parent 52454a4 commit a1de247
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
8 changes: 8 additions & 0 deletions go/consensus/tendermint/abci/mux.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (

"github.com/prometheus/client_golang/prometheus"
"github.com/tendermint/tendermint/abci/types"
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"

"github.com/oasisprotocol/oasis-core/go/common/cbor"
"github.com/oasisprotocol/oasis-core/go/common/crypto/hash"
Expand Down Expand Up @@ -851,6 +852,13 @@ func (mux *abciMux) EndBlock(req types.RequestEndBlock) types.ResponseEndBlock {
// Update tags.
resp.Events = ctx.GetEvents()

// Update version to what we are actually running.
resp.ConsensusParamUpdates = &types.ConsensusParams{
Version: &tmproto.VersionParams{
AppVersion: version.ConsensusProtocol.ToU64(),
},
}

// Clear block context.
mux.state.blockCtx = nil

Expand Down
3 changes: 3 additions & 0 deletions go/consensus/tendermint/tendermint.go
Original file line number Diff line number Diff line change
Expand Up @@ -1231,6 +1231,9 @@ func genesisToTendermint(d *genesisAPI.Document) (*tmtypes.GenesisDoc, error) {
Validator: tmproto.ValidatorParams{
PubKeyTypes: []string{tmtypes.ABCIPubKeyTypeEd25519},
},
Version: tmproto.VersionParams{
AppVersion: version.ConsensusProtocol.ToU64(),
},
},
AppState: b,
}
Expand Down
5 changes: 5 additions & 0 deletions go/consensus/tendermint/tests/genesis/genesis.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ import (
"math"
"time"

tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
tmtypes "github.com/tendermint/tendermint/types"

"github.com/oasisprotocol/oasis-core/go/common/identity"
"github.com/oasisprotocol/oasis-core/go/common/version"
consensus "github.com/oasisprotocol/oasis-core/go/consensus/genesis"
tendermint "github.com/oasisprotocol/oasis-core/go/consensus/tendermint/api"
"github.com/oasisprotocol/oasis-core/go/consensus/tendermint/crypto"
Expand Down Expand Up @@ -89,6 +91,9 @@ func NewTestNodeGenesisProvider(identity *identity.Identity) (genesis.Provider,
ConsensusParams: tmtypes.DefaultConsensusParams(),
AppState: b,
}
tmDoc.ConsensusParams.Version = tmproto.VersionParams{
AppVersion: version.ConsensusProtocol.ToU64(),
}

nodeID := identity.ConsensusSigner.Public()
pk := crypto.PublicKeyToTendermint(&nodeID)
Expand Down

0 comments on commit a1de247

Please sign in to comment.