diff --git a/abci/example/kvstore/kvstore.go b/abci/example/kvstore/kvstore.go index 02e287e7a..91c5b23ce 100644 --- a/abci/example/kvstore/kvstore.go +++ b/abci/example/kvstore/kvstore.go @@ -302,11 +302,7 @@ func (app *Application) InitChain(_ context.Context, req *abci.RequestInitChain) } consensusParams, ok := app.consensusParamsUpdates[app.initialHeight] if !ok { - consensusParams = types1.ConsensusParams{ - Version: &types1.VersionParams{ - AppVersion: uint64(app.LastCommittedState.GetHeight()) + 1, - }, - } + consensusParams = types1.ConsensusParams{} } vsu := app.getValidatorSetUpdate(app.initialHeight, 0) if vsu == nil { diff --git a/abci/example/kvstore/kvstore_test.go b/abci/example/kvstore/kvstore_test.go index e109c851d..13503a743 100644 --- a/abci/example/kvstore/kvstore_test.go +++ b/abci/example/kvstore/kvstore_test.go @@ -215,7 +215,7 @@ func TestConsensusParamsUpdate(t *testing.T) { genesisHeight + 4: { ConsParamUpdates: &tmproto.ConsensusParams{ Version: &tmproto.VersionParams{ - AppVersion: 123, + ConsensusVersion: tmproto.VersionParams_CONSENSUS_VERSION_1, }, }, }, diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 73467302f..6bc904396 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -2831,7 +2831,8 @@ type ResponsePrepareProposal struct { CoreChainLockUpdate *types1.CoreChainLock `protobuf:"bytes,5,opt,name=core_chain_lock_update,json=coreChainLockUpdate,proto3" json:"core_chain_lock_update,omitempty"` // Changes to validator set that will be applied at next height. ValidatorSetUpdate *ValidatorSetUpdate `protobuf:"bytes,6,opt,name=validator_set_update,json=validatorSetUpdate,proto3" json:"validator_set_update,omitempty"` - // Application version that was used to create the current proposal. + // Application protocol version used to create this proposal; MUST be non-zero. + // It becomes Header.Version.App. Validators' applications verify it in ProcessProposal. AppVersion uint64 `protobuf:"varint,7,opt,name=app_version,json=appVersion,proto3" json:"app_version,omitempty"` } diff --git a/book/SUMMARY.md b/book/SUMMARY.md index ee85dc841..a70c5713f 100644 --- a/book/SUMMARY.md +++ b/book/SUMMARY.md @@ -80,6 +80,7 @@ - [Commit handling](spec/consensus/consensus-commit.md) - [Recovery and synchronisation](spec/consensus/consensus-recovery.md) - [Known issues and discrepancies](spec/consensus/consensus-known-issues.md) + - [Full consensus parameter commitment (draft)](spec/consensus/consensus-params-commitment.md) # ABCI diff --git a/internal/consensus/replay_test.go b/internal/consensus/replay_test.go index b75d8923a..e2f8f0da0 100644 --- a/internal/consensus/replay_test.go +++ b/internal/consensus/replay_test.go @@ -1398,6 +1398,52 @@ func TestHandshakeInitialCoreLockHeight(t *testing.T) { assert.Equal(t, InitialCoreHeight, state.LastCoreChainLockedBlockHeight) } +// The application version recorded at height 0 comes from ResponseInfo. InitChain +// carries none, so processing its response must not reset it, even when the +// application returns a version parameter group. +func TestHandshakeInitChainKeepsInfoAppVersion(t *testing.T) { + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + + const infoAppVersion uint64 = 7 + logger := log.NewNopLogger() + conf, err := ResetConfig(t, "handshake_test_init_chain_app_version") + require.NoError(t, err) + + privVal, err := privval.LoadFilePV(conf.PrivValidator.KeyFile(), conf.PrivValidator.StateFile()) + require.NoError(t, err) + + eventBus := eventbus.NewDefault(logger) + require.NoError(t, eventBus.Start(ctx)) + + app := &initChainApp{ + infoAppVersion: infoAppVersion, + consensusParams: &tmproto.ConsensusParams{ + Version: &tmproto.VersionParams{ConsensusVersion: tmproto.VersionParams_CONSENSUS_VERSION_1}, + }, + } + client := abciclient.NewLocalClient(logger, app) + + proTxHash, err := privVal.GetProTxHash(ctx) + require.NoError(t, err) + stateDB, state, store := stateAndStore(t, conf, 0x0) + stateStore := sm.NewStore(stateDB) + proxyApp := proxy.New(client, logger, proxy.NopMetrics()) + require.NoError(t, proxyApp.Start(ctx), "Error starting proxy app connections") + + genDoc, _ := sm.MakeGenesisDocFromFile(conf.GenesisFile()) + replayer := newBlockReplayer(stateStore, store, genDoc, eventBus, proxyApp, proTxHash) + handshaker := NewHandshaker(replayer, logger, state) + + _, err = handshaker.Handshake(ctx, proxyApp) + require.NoError(t, err, "error on abci handshake") + + state, err = stateStore.Load() + require.NoError(t, err) + assert.Equal(t, infoAppVersion, state.Version.Consensus.App) + assert.EqualValues(t, tmproto.VersionParams_CONSENSUS_VERSION_1, state.ConsensusParams.Version.ConsensusVersion) +} + // walRoundsSkipperProposeTimeout replaces the test genesis' 30ms propose // timeout on the node that generates the WAL for testWALRoundsSkipper. That // node is the only validator, so it proposes every round and its propose @@ -1546,11 +1592,18 @@ type initChainApp struct { abci.BaseApplication vals *abci.ValidatorSetUpdate initialCoreHeight uint32 + infoAppVersion uint64 + consensusParams *tmproto.ConsensusParams +} + +func (ica *initChainApp) Info(_ context.Context, _req *abci.RequestInfo) (*abci.ResponseInfo, error) { + return &abci.ResponseInfo{AppVersion: ica.infoAppVersion}, nil } func (ica *initChainApp) InitChain(_ context.Context, _req *abci.RequestInitChain) (*abci.ResponseInitChain, error) { resp := abci.ResponseInitChain{ InitialCoreHeight: ica.initialCoreHeight, + ConsensusParams: ica.consensusParams, } if ica.vals != nil { resp.ValidatorSetUpdate = *ica.vals diff --git a/internal/rpc/core/blocks_test.go b/internal/rpc/core/blocks_test.go index cd722b81a..4a970cd25 100644 --- a/internal/rpc/core/blocks_test.go +++ b/internal/rpc/core/blocks_test.go @@ -81,7 +81,7 @@ func TestBlockResults(t *testing.T) { }, ConsensusParamUpdates: &types.ConsensusParams{ Version: &types.VersionParams{ - AppVersion: 1, + ConsensusVersion: types.VersionParams_CONSENSUS_VERSION_1, }, }, }, @@ -111,7 +111,7 @@ func TestBlockResults(t *testing.T) { FinalizeBlockEvents: results.ProcessProposal.Events, ValidatorSetUpdate: results.ProcessProposal.ValidatorSetUpdate, ConsensusParamUpdates: &tmtypes.ConsensusParams{ - Version: tmtypes.VersionParams{AppVersion: 1}, + Version: tmtypes.VersionParams{ConsensusVersion: 1}, }, }}, } diff --git a/internal/state/current_round_state.go b/internal/state/current_round_state.go index a733d1e01..bc4ad76ff 100644 --- a/internal/state/current_round_state.go +++ b/internal/state/current_round_state.go @@ -97,7 +97,6 @@ func (candidate *CurrentRoundState) UpdateState(target *State) error { target.LastResultsHash = candidate.ResultsHash target.ConsensusParams = candidate.NextConsensusParams target.LastHeightConsensusParamsChanged = candidate.LastHeightConsensusParamsChanged - target.Version.Consensus.App = candidate.NextConsensusParams.Version.AppVersion target.Validators = candidate.NextValidators target.LastHeightValidatorsChanged = candidate.LastHeightValidatorsChanged if candidate.CoreChainLock != nil { diff --git a/internal/state/execution.go b/internal/state/execution.go index c196489fe..1dd1fc550 100644 --- a/internal/state/execution.go +++ b/internal/state/execution.go @@ -791,6 +791,8 @@ func (state State) Update( ) (State, error) { nextVersion := state.Version + // The proposer's PrepareProposal response sets the committed header's app version. + nextVersion.Consensus.App = header.Version.App // NOTE: LastBlockRound, LastStateIDHash, AppHash and VoteExtension has not been populated. // It will be filled on state.Save. diff --git a/internal/state/helpers_test.go b/internal/state/helpers_test.go index e883011b3..b89528408 100644 --- a/internal/state/helpers_test.go +++ b/internal/state/helpers_test.go @@ -273,9 +273,7 @@ func (app *testApp) PrepareProposal(_ context.Context, req *abci.RequestPrepareP AppHash: make([]byte, crypto.DefaultAppHashSize), ValidatorSetUpdate: app.ValidatorSetUpdate, ConsensusParamUpdates: &tmproto.ConsensusParams{ - Version: &tmproto.VersionParams{ - AppVersion: 1, - }, + Version: &tmproto.VersionParams{}, }, AppVersion: 1, TxResults: resTxs, @@ -291,9 +289,7 @@ func (app *testApp) ProcessProposal(_ context.Context, req *abci.RequestProcessP AppHash: make([]byte, crypto.DefaultAppHashSize), ValidatorSetUpdate: app.ValidatorSetUpdate, ConsensusParamUpdates: &tmproto.ConsensusParams{ - Version: &tmproto.VersionParams{ - AppVersion: 1, - }, + Version: &tmproto.VersionParams{}, }, TxResults: resTxs, Status: abci.ResponseProcessProposal_ACCEPT, diff --git a/internal/state/rollback.go b/internal/state/rollback.go index 569077862..b92fbe833 100644 --- a/internal/state/rollback.go +++ b/internal/state/rollback.go @@ -75,7 +75,7 @@ func Rollback(bs BlockStore, ss Store) (int64, []byte, error) { Version: Version{ Consensus: version.Consensus{ Block: version.BlockProtocol, - App: previousParams.Version.AppVersion, + App: rollbackBlock.Header.Version.App, }, Software: version.TMCoreSemVer, }, diff --git a/internal/state/rollback_test.go b/internal/state/rollback_test.go index 1681a6002..eb0572489 100644 --- a/internal/state/rollback_test.go +++ b/internal/state/rollback_test.go @@ -27,7 +27,6 @@ func TestRollback(t *testing.T) { // perform the rollback over a version bump newParams := types.DefaultConsensusParams() - newParams.Version.AppVersion = 11 newParams.Block.MaxBytes = 1000 nextState := initialState.Copy() nextState.LastBlockHeight = nextHeight @@ -45,6 +44,8 @@ func TestRollback(t *testing.T) { block := &types.BlockMeta{ BlockID: initialState.LastBlockID, Header: types.Header{ + // The rolled-back state's app version comes from this header. + Version: version.Consensus{Block: version.BlockProtocol, App: initialState.Version.Consensus.App}, Height: initialState.LastBlockHeight, AppHash: factory.RandomHash(), LastBlockID: factory.MakeBlockID(), @@ -57,6 +58,7 @@ func TestRollback(t *testing.T) { nextBlock := &types.BlockMeta{ BlockID: initialState.LastBlockID, Header: types.Header{ + Version: version.Consensus{Block: version.BlockProtocol, App: 11}, Height: nextState.LastBlockHeight, AppHash: initialState.LastAppHash, LastBlockID: block.BlockID, @@ -123,7 +125,6 @@ func setupStateStore(t *testing.T, height int64) state.Store { valSet, _ := types.RandValidatorSet(5) params := types.DefaultConsensusParams() - params.Version.AppVersion = 10 initialState := state.State{ Version: state.Version{ diff --git a/internal/state/state_test.go b/internal/state/state_test.go index e57adf375..2d14658ff 100644 --- a/internal/state/state_test.go +++ b/internal/state/state_test.go @@ -26,6 +26,7 @@ import ( statefactory "github.com/dashpay/tenderdash/internal/state/test/factory" tmstate "github.com/dashpay/tenderdash/proto/tendermint/state" "github.com/dashpay/tenderdash/types" + "github.com/dashpay/tenderdash/version" ) // setupTestCase does setup common to all test cases. @@ -769,3 +770,24 @@ func assertLLMQDataWithValidatorSet(t *testing.T, ld *llmq.Data, valSet *types.V } require.Equal(t, ld.ThresholdPubKey, valSet.ThresholdPublicKey) } + +// The application version recorded in state follows the committed block header, +// which the proposer's PrepareProposal response sets; consensus parameters carry +// no application version. +func TestStateUpdateTakesAppVersionFromCommittedHeader(t *testing.T) { + tearDown, _, state := setupTestCase(t) + defer tearDown(t) + + state.Version.Consensus.App = 1 + ctx := dash.ContextWithProTxHash(context.Background(), state.Validators.GetByIndex(0).ProTxHash) + changes, err := state.NewStateChangeset(ctx, sm.RoundParams{}) + require.NoError(t, err) + + header := types.Header{ + Version: version.Consensus{Block: version.BlockProtocol, App: 7}, + Height: state.LastBlockHeight + 1, + } + newState, err := state.Update(types.BlockID{}, &header, &changes) + require.NoError(t, err) + assert.EqualValues(t, 7, newState.Version.Consensus.App) +} diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index 4099f1966..234d9a88a 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -527,7 +527,8 @@ message ResponsePrepareProposal { tendermint.types.CoreChainLock core_chain_lock_update = 5; // Changes to validator set that will be applied at next height. ValidatorSetUpdate validator_set_update = 6 [(gogoproto.nullable) = true]; - // Application version that was used to create the current proposal. + // Application protocol version used to create this proposal; MUST be non-zero. + // It becomes Header.Version.App. Validators' applications verify it in ProcessProposal. uint64 app_version = 7; } diff --git a/proto/tendermint/types/canonical.pb.go b/proto/tendermint/types/canonical.pb.go index 83b3784d1..f673209e6 100644 --- a/proto/tendermint/types/canonical.pb.go +++ b/proto/tendermint/types/canonical.pb.go @@ -218,7 +218,8 @@ type CanonicalVote struct { Type SignedMsgType `protobuf:"varint,1,opt,name=type,proto3,enum=tendermint.types.SignedMsgType" json:"type,omitempty"` Height int64 `protobuf:"fixed64,2,opt,name=height,proto3" json:"height,omitempty"` Round int64 `protobuf:"fixed64,3,opt,name=round,proto3" json:"round,omitempty"` - // block_id is a checksum (sha256) of CanonicalBlockID for the block being voted on + // block_id is a checksum (sha256) of CanonicalBlockID for the block being voted on. + // Its header hash binds current and next consensus parameter commitments. BlockID []byte `protobuf:"bytes,4,opt,name=block_id,json=blockId,proto3" json:"block_id,omitempty"` // state_id is a checksum (sha256) of StateID message for the block being voted on StateID []byte `protobuf:"bytes,5,opt,name=state_id,json=stateId,proto3" json:"state_id,omitempty"` diff --git a/proto/tendermint/types/canonical.proto b/proto/tendermint/types/canonical.proto index c88923b7a..63f4d567b 100644 --- a/proto/tendermint/types/canonical.proto +++ b/proto/tendermint/types/canonical.proto @@ -35,7 +35,8 @@ message CanonicalVote { SignedMsgType type = 1; // type alias for byte sfixed64 height = 2; // canonicalization requires fixed size encoding here sfixed64 round = 3; // canonicalization requires fixed size encoding here - // block_id is a checksum (sha256) of CanonicalBlockID for the block being voted on + // block_id is a checksum (sha256) of CanonicalBlockID for the block being voted on. + // Its header hash binds current and next consensus parameter commitments. bytes block_id = 4 [(gogoproto.customname) = "BlockID"]; // state_id is a checksum (sha256) of StateID message for the block being voted on bytes state_id = 5 [(gogoproto.customname) = "StateID"]; diff --git a/proto/tendermint/types/params.pb.go b/proto/tendermint/types/params.pb.go index 30e77c538..94e080c4c 100644 --- a/proto/tendermint/types/params.pb.go +++ b/proto/tendermint/types/params.pb.go @@ -34,16 +34,21 @@ const ( VersionParams_CONSENSUS_VERSION_0 VersionParams_ConsensusVersion = 0 // CONSENSUS_VERSION_1 changes proposer selection algorithm to not double-propose when previous proposer is offline. VersionParams_CONSENSUS_VERSION_1 VersionParams_ConsensusVersion = 1 + // CONSENSUS_VERSION_2 keeps version 1 proposer selection and commits HashedParamsV2 (draft). + // See spec/consensus/consensus-params-commitment.md; runtime support is deferred. + VersionParams_CONSENSUS_VERSION_2 VersionParams_ConsensusVersion = 2 ) var VersionParams_ConsensusVersion_name = map[int32]string{ 0: "CONSENSUS_VERSION_0", 1: "CONSENSUS_VERSION_1", + 2: "CONSENSUS_VERSION_2", } var VersionParams_ConsensusVersion_value = map[string]int32{ "CONSENSUS_VERSION_0": 0, "CONSENSUS_VERSION_1": 1, + "CONSENSUS_VERSION_2": 2, } func (x VersionParams_ConsensusVersion) String() string { @@ -60,8 +65,7 @@ type ConsensusParams struct { Block *BlockParams `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` Evidence *EvidenceParams `protobuf:"bytes,2,opt,name=evidence,proto3" json:"evidence,omitempty"` Validator *ValidatorParams `protobuf:"bytes,3,opt,name=validator,proto3" json:"validator,omitempty"` - // DEPRECATED. This will be removed in a future release. - // Replaced by ResponsePrepareProposal.app_version + // Consensus protocol version. Version *VersionParams `protobuf:"bytes,4,opt,name=version,proto3" json:"version,omitempty"` Synchrony *SynchronyParams `protobuf:"bytes,5,opt,name=synchrony,proto3" json:"synchrony,omitempty"` Timeout *TimeoutParams `protobuf:"bytes,6,opt,name=timeout,proto3" json:"timeout,omitempty"` @@ -363,9 +367,8 @@ func (*ValidatorParams) XXX_OneofWrappers() []interface{} { } } -// VersionParams contains the ABCI application version. +// VersionParams contains the consensus protocol version. type VersionParams struct { - AppVersion uint64 `protobuf:"varint,1,opt,name=app_version,json=appVersion,proto3" json:"app_version,omitempty"` // Version of consensus protocol, used to upgrade consensus without hard forks ConsensusVersion VersionParams_ConsensusVersion `protobuf:"varint,2,opt,name=consensus_version,json=consensusVersion,proto3,enum=tendermint.types.VersionParams_ConsensusVersion" json:"consensus_version,omitempty"` } @@ -403,13 +406,6 @@ func (m *VersionParams) XXX_DiscardUnknown() { var xxx_messageInfo_VersionParams proto.InternalMessageInfo -func (m *VersionParams) GetAppVersion() uint64 { - if m != nil { - return m.AppVersion - } - return 0 -} - func (m *VersionParams) GetConsensusVersion() VersionParams_ConsensusVersion { if m != nil { return m.ConsensusVersion @@ -417,9 +413,8 @@ func (m *VersionParams) GetConsensusVersion() VersionParams_ConsensusVersion { return VersionParams_CONSENSUS_VERSION_0 } -// HashedParams is a subset of ConsensusParams. -// -// It is hashed into the Header.ConsensusHash. +// HashedParams is the legacy subset committed by Header.ConsensusHash. +// Preserve its schema and encoding for historical block verification. type HashedParams struct { BlockMaxBytes int64 `protobuf:"varint,1,opt,name=block_max_bytes,json=blockMaxBytes,proto3" json:"block_max_bytes,omitempty"` BlockMaxGas int64 `protobuf:"varint,2,opt,name=block_max_gas,json=blockMaxGas,proto3" json:"block_max_gas,omitempty"` @@ -480,6 +475,191 @@ func (m *HashedParams) GetConsensusVersion() int32 { return 0 } +// HashedParamsV2 is the draft complete effective-parameter snapshot for consensus version >= 2. +// Freeze this mapping and its encoding before activation; do not hash ABCI patches. +// See spec/consensus/consensus-params-commitment.md for canonical bytes and domain separation. +type HashedParamsV2 struct { + ConsensusVersion int32 `protobuf:"varint,1,opt,name=consensus_version,json=consensusVersion,proto3" json:"consensus_version,omitempty"` + BlockMaxBytes int64 `protobuf:"varint,2,opt,name=block_max_bytes,json=blockMaxBytes,proto3" json:"block_max_bytes,omitempty"` + BlockMaxGas int64 `protobuf:"varint,3,opt,name=block_max_gas,json=blockMaxGas,proto3" json:"block_max_gas,omitempty"` + EvidenceMaxAgeNumBlocks int64 `protobuf:"varint,4,opt,name=evidence_max_age_num_blocks,json=evidenceMaxAgeNumBlocks,proto3" json:"evidence_max_age_num_blocks,omitempty"` + EvidenceMaxAgeDurationNs int64 `protobuf:"varint,5,opt,name=evidence_max_age_duration_ns,json=evidenceMaxAgeDurationNs,proto3" json:"evidence_max_age_duration_ns,omitempty"` + EvidenceMaxBytes int64 `protobuf:"varint,6,opt,name=evidence_max_bytes,json=evidenceMaxBytes,proto3" json:"evidence_max_bytes,omitempty"` + ValidatorPubKeyTypes []string `protobuf:"bytes,7,rep,name=validator_pub_key_types,json=validatorPubKeyTypes,proto3" json:"validator_pub_key_types,omitempty"` + // Types that are valid to be assigned to XValidatorVotingPowerThreshold: + // *HashedParamsV2_ValidatorVotingPowerThreshold + XValidatorVotingPowerThreshold isHashedParamsV2_XValidatorVotingPowerThreshold `protobuf_oneof:"_validator_voting_power_threshold"` + SynchronyMessageDelayNs int64 `protobuf:"varint,9,opt,name=synchrony_message_delay_ns,json=synchronyMessageDelayNs,proto3" json:"synchrony_message_delay_ns,omitempty"` + SynchronyPrecisionNs int64 `protobuf:"varint,10,opt,name=synchrony_precision_ns,json=synchronyPrecisionNs,proto3" json:"synchrony_precision_ns,omitempty"` + TimeoutProposeNs int64 `protobuf:"varint,11,opt,name=timeout_propose_ns,json=timeoutProposeNs,proto3" json:"timeout_propose_ns,omitempty"` + TimeoutProposeDeltaNs int64 `protobuf:"varint,12,opt,name=timeout_propose_delta_ns,json=timeoutProposeDeltaNs,proto3" json:"timeout_propose_delta_ns,omitempty"` + TimeoutVoteNs int64 `protobuf:"varint,13,opt,name=timeout_vote_ns,json=timeoutVoteNs,proto3" json:"timeout_vote_ns,omitempty"` + TimeoutVoteDeltaNs int64 `protobuf:"varint,14,opt,name=timeout_vote_delta_ns,json=timeoutVoteDeltaNs,proto3" json:"timeout_vote_delta_ns,omitempty"` + AbciRecheckTx bool `protobuf:"varint,15,opt,name=abci_recheck_tx,json=abciRecheckTx,proto3" json:"abci_recheck_tx,omitempty"` +} + +func (m *HashedParamsV2) Reset() { *m = HashedParamsV2{} } +func (m *HashedParamsV2) String() string { return proto.CompactTextString(m) } +func (*HashedParamsV2) ProtoMessage() {} +func (*HashedParamsV2) Descriptor() ([]byte, []int) { + return fileDescriptor_e12598271a686f57, []int{6} +} +func (m *HashedParamsV2) XXX_Unmarshal(b []byte) error { + return m.Unmarshal(b) +} +func (m *HashedParamsV2) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { + b = b[:cap(b)] + n, err := m.MarshalToSizedBuffer(b) + if err != nil { + return nil, err + } + return b[:n], nil +} +func (m *HashedParamsV2) XXX_Merge(src proto.Message) { + xxx_messageInfo_HashedParamsV2.Merge(m, src) +} +func (m *HashedParamsV2) XXX_Size() int { + return m.Size() +} +func (m *HashedParamsV2) XXX_DiscardUnknown() { + xxx_messageInfo_HashedParamsV2.DiscardUnknown(m) +} + +var xxx_messageInfo_HashedParamsV2 proto.InternalMessageInfo + +type isHashedParamsV2_XValidatorVotingPowerThreshold interface { + isHashedParamsV2_XValidatorVotingPowerThreshold() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type HashedParamsV2_ValidatorVotingPowerThreshold struct { + ValidatorVotingPowerThreshold uint64 `protobuf:"varint,8,opt,name=validator_voting_power_threshold,json=validatorVotingPowerThreshold,proto3,oneof" json:"validator_voting_power_threshold,omitempty"` +} + +func (*HashedParamsV2_ValidatorVotingPowerThreshold) isHashedParamsV2_XValidatorVotingPowerThreshold() { +} + +func (m *HashedParamsV2) GetXValidatorVotingPowerThreshold() isHashedParamsV2_XValidatorVotingPowerThreshold { + if m != nil { + return m.XValidatorVotingPowerThreshold + } + return nil +} + +func (m *HashedParamsV2) GetConsensusVersion() int32 { + if m != nil { + return m.ConsensusVersion + } + return 0 +} + +func (m *HashedParamsV2) GetBlockMaxBytes() int64 { + if m != nil { + return m.BlockMaxBytes + } + return 0 +} + +func (m *HashedParamsV2) GetBlockMaxGas() int64 { + if m != nil { + return m.BlockMaxGas + } + return 0 +} + +func (m *HashedParamsV2) GetEvidenceMaxAgeNumBlocks() int64 { + if m != nil { + return m.EvidenceMaxAgeNumBlocks + } + return 0 +} + +func (m *HashedParamsV2) GetEvidenceMaxAgeDurationNs() int64 { + if m != nil { + return m.EvidenceMaxAgeDurationNs + } + return 0 +} + +func (m *HashedParamsV2) GetEvidenceMaxBytes() int64 { + if m != nil { + return m.EvidenceMaxBytes + } + return 0 +} + +func (m *HashedParamsV2) GetValidatorPubKeyTypes() []string { + if m != nil { + return m.ValidatorPubKeyTypes + } + return nil +} + +func (m *HashedParamsV2) GetValidatorVotingPowerThreshold() uint64 { + if x, ok := m.GetXValidatorVotingPowerThreshold().(*HashedParamsV2_ValidatorVotingPowerThreshold); ok { + return x.ValidatorVotingPowerThreshold + } + return 0 +} + +func (m *HashedParamsV2) GetSynchronyMessageDelayNs() int64 { + if m != nil { + return m.SynchronyMessageDelayNs + } + return 0 +} + +func (m *HashedParamsV2) GetSynchronyPrecisionNs() int64 { + if m != nil { + return m.SynchronyPrecisionNs + } + return 0 +} + +func (m *HashedParamsV2) GetTimeoutProposeNs() int64 { + if m != nil { + return m.TimeoutProposeNs + } + return 0 +} + +func (m *HashedParamsV2) GetTimeoutProposeDeltaNs() int64 { + if m != nil { + return m.TimeoutProposeDeltaNs + } + return 0 +} + +func (m *HashedParamsV2) GetTimeoutVoteNs() int64 { + if m != nil { + return m.TimeoutVoteNs + } + return 0 +} + +func (m *HashedParamsV2) GetTimeoutVoteDeltaNs() int64 { + if m != nil { + return m.TimeoutVoteDeltaNs + } + return 0 +} + +func (m *HashedParamsV2) GetAbciRecheckTx() bool { + if m != nil { + return m.AbciRecheckTx + } + return false +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*HashedParamsV2) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*HashedParamsV2_ValidatorVotingPowerThreshold)(nil), + } +} + // SynchronyParams configure the bounds under which a proposed block's timestamp is considered valid. // These parameters are part of the proposer-based timestamps algorithm. For more information, // see the specification of proposer-based timestamps: @@ -497,7 +677,7 @@ func (m *SynchronyParams) Reset() { *m = SynchronyParams{} } func (m *SynchronyParams) String() string { return proto.CompactTextString(m) } func (*SynchronyParams) ProtoMessage() {} func (*SynchronyParams) Descriptor() ([]byte, []int) { - return fileDescriptor_e12598271a686f57, []int{6} + return fileDescriptor_e12598271a686f57, []int{7} } func (m *SynchronyParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -576,7 +756,7 @@ func (m *TimeoutParams) Reset() { *m = TimeoutParams{} } func (m *TimeoutParams) String() string { return proto.CompactTextString(m) } func (*TimeoutParams) ProtoMessage() {} func (*TimeoutParams) Descriptor() ([]byte, []int) { - return fileDescriptor_e12598271a686f57, []int{7} + return fileDescriptor_e12598271a686f57, []int{8} } func (m *TimeoutParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -644,7 +824,7 @@ func (m *ABCIParams) Reset() { *m = ABCIParams{} } func (m *ABCIParams) String() string { return proto.CompactTextString(m) } func (*ABCIParams) ProtoMessage() {} func (*ABCIParams) Descriptor() ([]byte, []int) { - return fileDescriptor_e12598271a686f57, []int{8} + return fileDescriptor_e12598271a686f57, []int{9} } func (m *ABCIParams) XXX_Unmarshal(b []byte) error { return m.Unmarshal(b) @@ -688,6 +868,7 @@ func init() { proto.RegisterType((*ValidatorParams)(nil), "tendermint.types.ValidatorParams") proto.RegisterType((*VersionParams)(nil), "tendermint.types.VersionParams") proto.RegisterType((*HashedParams)(nil), "tendermint.types.HashedParams") + proto.RegisterType((*HashedParamsV2)(nil), "tendermint.types.HashedParamsV2") proto.RegisterType((*SynchronyParams)(nil), "tendermint.types.SynchronyParams") proto.RegisterType((*TimeoutParams)(nil), "tendermint.types.TimeoutParams") proto.RegisterType((*ABCIParams)(nil), "tendermint.types.ABCIParams") @@ -696,60 +877,75 @@ func init() { func init() { proto.RegisterFile("tendermint/types/params.proto", fileDescriptor_e12598271a686f57) } var fileDescriptor_e12598271a686f57 = []byte{ - // 844 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0xcd, 0x6e, 0xdb, 0x46, - 0x10, 0xc7, 0xb5, 0x11, 0x2d, 0x4b, 0x23, 0xcb, 0x52, 0xb7, 0x69, 0xcd, 0xa4, 0xb5, 0xec, 0xf2, - 0x50, 0x04, 0x08, 0x40, 0xb9, 0x71, 0x2f, 0x01, 0xfa, 0x81, 0xc8, 0x32, 0xf2, 0x51, 0xc4, 0x09, - 0x28, 0x37, 0x87, 0x02, 0x05, 0xb1, 0xa4, 0xb6, 0x14, 0x61, 0x91, 0x4b, 0x70, 0x49, 0x55, 0x7c, - 0x82, 0x16, 0xe8, 0xa5, 0xa7, 0xa2, 0x8f, 0xd0, 0x5e, 0x8a, 0x3e, 0x46, 0x8e, 0xb9, 0x14, 0xe8, - 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 0xc6, 0xb9, 0x67, 0xfb, 0x2c, 0xea, 0x8d, 0x08, 0x1f, 0x27, - 0xa4, 0xe8, 0x95, 0xc3, 0x23, 0x56, 0xe5, 0xf7, 0xad, 0xb7, 0xfa, 0xcd, 0xf4, 0x6a, 0x72, 0xff, - 0xf8, 0xff, 0x01, 0x00, 0xb2, 0xb1, 0x36, 0x07, 0x4e, 0x07, 0x00, 0x00, + // 1086 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x96, 0x41, 0x6f, 0x1b, 0x45, + 0x14, 0xc7, 0x3d, 0xb6, 0xe3, 0xd8, 0xcf, 0x71, 0x6c, 0x86, 0xb4, 0xd9, 0xa6, 0x8d, 0x93, 0x2e, + 0x12, 0x8a, 0x54, 0x64, 0xa7, 0x49, 0x11, 0x2a, 0x94, 0xa2, 0x3a, 0x89, 0xda, 0x06, 0xe2, 0x46, + 0x9b, 0x90, 0x03, 0x52, 0x35, 0x5a, 0xdb, 0x83, 0xbd, 0x8a, 0x77, 0x67, 0xb5, 0xb3, 0x36, 0xf6, + 0x27, 0x00, 0x89, 0x0b, 0x27, 0xd4, 0x2b, 0x37, 0xb8, 0x20, 0x3e, 0x03, 0xa7, 0x1e, 0x7b, 0xe4, + 0x04, 0x55, 0xf2, 0x45, 0xd0, 0xcc, 0xee, 0xac, 0xbd, 0xce, 0x46, 0xf1, 0xcd, 0x3b, 0xff, 0xff, + 0x6f, 0xdf, 0xbc, 0x79, 0xef, 0xcd, 0x1a, 0xd6, 0x7d, 0xea, 0x74, 0xa8, 0x67, 0x5b, 0x8e, 0x5f, + 0xf7, 0xc7, 0x2e, 0xe5, 0x75, 0xd7, 0xf4, 0x4c, 0x9b, 0xd7, 0x5c, 0x8f, 0xf9, 0x0c, 0x57, 0x26, + 0x72, 0x4d, 0xca, 0x6b, 0x2b, 0x5d, 0xd6, 0x65, 0x52, 0xac, 0x8b, 0x5f, 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 0xc9, 0x7b, + 0xae, 0x39, 0xae, 0x07, 0x5f, 0x2b, 0xf1, 0x14, 0xfc, 0x5f, 0xac, 0xcf, 0xfe, 0x07, 0x6d, 0xe5, + 0xe4, 0xfa, 0xee, 0xff, 0x03, 0x00, 0xb4, 0x8c, 0xf5, 0x9b, 0x9e, 0x0a, 0x00, 0x00, } func (this *ConsensusParams) Equal(that interface{}) bool { @@ -932,9 +1128,6 @@ func (this *VersionParams) Equal(that interface{}) bool { } else if this == nil { return false } - if this.AppVersion != that1.AppVersion { - return false - } if this.ConsensusVersion != that1.ConsensusVersion { return false } @@ -970,6 +1163,107 @@ func (this *HashedParams) Equal(that interface{}) bool { } return true } +func (this *HashedParamsV2) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HashedParamsV2) + if !ok { + that2, ok := that.(HashedParamsV2) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ConsensusVersion != that1.ConsensusVersion { + return false + } + if this.BlockMaxBytes != that1.BlockMaxBytes { + return false + } + if this.BlockMaxGas != that1.BlockMaxGas { + return false + } + if this.EvidenceMaxAgeNumBlocks != that1.EvidenceMaxAgeNumBlocks { + return false + } + if this.EvidenceMaxAgeDurationNs != that1.EvidenceMaxAgeDurationNs { + return false + } + if this.EvidenceMaxBytes != that1.EvidenceMaxBytes { + return false + } + if len(this.ValidatorPubKeyTypes) != len(that1.ValidatorPubKeyTypes) { + return false + } + for i := range this.ValidatorPubKeyTypes { + if this.ValidatorPubKeyTypes[i] != that1.ValidatorPubKeyTypes[i] { + return false + } + } + if that1.XValidatorVotingPowerThreshold == nil { + if this.XValidatorVotingPowerThreshold != nil { + return false + } + } else if this.XValidatorVotingPowerThreshold == nil { + return false + } else if !this.XValidatorVotingPowerThreshold.Equal(that1.XValidatorVotingPowerThreshold) { + return false + } + if this.SynchronyMessageDelayNs != that1.SynchronyMessageDelayNs { + return false + } + if this.SynchronyPrecisionNs != that1.SynchronyPrecisionNs { + return false + } + if this.TimeoutProposeNs != that1.TimeoutProposeNs { + return false + } + if this.TimeoutProposeDeltaNs != that1.TimeoutProposeDeltaNs { + return false + } + if this.TimeoutVoteNs != that1.TimeoutVoteNs { + return false + } + if this.TimeoutVoteDeltaNs != that1.TimeoutVoteDeltaNs { + return false + } + if this.AbciRecheckTx != that1.AbciRecheckTx { + return false + } + return true +} +func (this *HashedParamsV2_ValidatorVotingPowerThreshold) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*HashedParamsV2_ValidatorVotingPowerThreshold) + if !ok { + that2, ok := that.(HashedParamsV2_ValidatorVotingPowerThreshold) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.ValidatorVotingPowerThreshold != that1.ValidatorVotingPowerThreshold { + return false + } + return true +} func (this *SynchronyParams) Equal(that interface{}) bool { if that == nil { return this == nil @@ -1367,11 +1661,6 @@ func (m *VersionParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - if m.AppVersion != 0 { - i = encodeVarintParams(dAtA, i, uint64(m.AppVersion)) - i-- - dAtA[i] = 0x8 - } return len(dAtA) - i, nil } @@ -1416,7 +1705,7 @@ func (m *HashedParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } -func (m *SynchronyParams) Marshal() (dAtA []byte, err error) { +func (m *HashedParamsV2) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) n, err := m.MarshalToSizedBuffer(dAtA[:size]) @@ -1426,12 +1715,12 @@ func (m *SynchronyParams) Marshal() (dAtA []byte, err error) { return dAtA[:n], nil } -func (m *SynchronyParams) MarshalTo(dAtA []byte) (int, error) { +func (m *HashedParamsV2) MarshalTo(dAtA []byte) (int, error) { size := m.Size() return m.MarshalToSizedBuffer(dAtA[:size]) } -func (m *SynchronyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { +func (m *HashedParamsV2) MarshalToSizedBuffer(dAtA []byte) (int, error) { if m == nil { return 0, nil } @@ -1439,58 +1728,187 @@ func (m *SynchronyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - if m.Precision != nil { - n9, err9 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.Precision, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.Precision):]) - if err9 != nil { - return 0, err9 + if m.AbciRecheckTx { + i-- + if m.AbciRecheckTx { + dAtA[i] = 1 + } else { + dAtA[i] = 0 } - i -= n9 - i = encodeVarintParams(dAtA, i, uint64(n9)) i-- - dAtA[i] = 0x12 + dAtA[i] = 0x78 } - if m.MessageDelay != nil { - n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MessageDelay, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MessageDelay):]) - if err10 != nil { - return 0, err10 - } - i -= n10 - i = encodeVarintParams(dAtA, i, uint64(n10)) + if m.TimeoutVoteDeltaNs != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.TimeoutVoteDeltaNs)) i-- - dAtA[i] = 0xa + dAtA[i] = 0x70 } - return len(dAtA) - i, nil -} - -func (m *TimeoutParams) Marshal() (dAtA []byte, err error) { - size := m.Size() - dAtA = make([]byte, size) - n, err := m.MarshalToSizedBuffer(dAtA[:size]) - if err != nil { - return nil, err + if m.TimeoutVoteNs != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.TimeoutVoteNs)) + i-- + dAtA[i] = 0x68 } - return dAtA[:n], nil -} - -func (m *TimeoutParams) MarshalTo(dAtA []byte) (int, error) { - size := m.Size() - return m.MarshalToSizedBuffer(dAtA[:size]) -} - -func (m *TimeoutParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { - if m == nil { - return 0, nil + if m.TimeoutProposeDeltaNs != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.TimeoutProposeDeltaNs)) + i-- + dAtA[i] = 0x60 } - i := len(dAtA) - _ = i - var l int - _ = l - if m.VoteDelta != nil { - n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VoteDelta, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VoteDelta):]) - if err11 != nil { - return 0, err11 - } - i -= n11 + if m.TimeoutProposeNs != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.TimeoutProposeNs)) + i-- + dAtA[i] = 0x58 + } + if m.SynchronyPrecisionNs != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.SynchronyPrecisionNs)) + i-- + dAtA[i] = 0x50 + } + if m.SynchronyMessageDelayNs != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.SynchronyMessageDelayNs)) + i-- + dAtA[i] = 0x48 + } + if m.XValidatorVotingPowerThreshold != nil { + { + size := m.XValidatorVotingPowerThreshold.Size() + i -= size + if _, err := m.XValidatorVotingPowerThreshold.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } + if len(m.ValidatorPubKeyTypes) > 0 { + for iNdEx := len(m.ValidatorPubKeyTypes) - 1; iNdEx >= 0; iNdEx-- { + i -= len(m.ValidatorPubKeyTypes[iNdEx]) + copy(dAtA[i:], m.ValidatorPubKeyTypes[iNdEx]) + i = encodeVarintParams(dAtA, i, uint64(len(m.ValidatorPubKeyTypes[iNdEx]))) + i-- + dAtA[i] = 0x3a + } + } + if m.EvidenceMaxBytes != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.EvidenceMaxBytes)) + i-- + dAtA[i] = 0x30 + } + if m.EvidenceMaxAgeDurationNs != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.EvidenceMaxAgeDurationNs)) + i-- + dAtA[i] = 0x28 + } + if m.EvidenceMaxAgeNumBlocks != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.EvidenceMaxAgeNumBlocks)) + i-- + dAtA[i] = 0x20 + } + if m.BlockMaxGas != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.BlockMaxGas)) + i-- + dAtA[i] = 0x18 + } + if m.BlockMaxBytes != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.BlockMaxBytes)) + i-- + dAtA[i] = 0x10 + } + if m.ConsensusVersion != 0 { + i = encodeVarintParams(dAtA, i, uint64(m.ConsensusVersion)) + i-- + dAtA[i] = 0x8 + } + return len(dAtA) - i, nil +} + +func (m *HashedParamsV2_ValidatorVotingPowerThreshold) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *HashedParamsV2_ValidatorVotingPowerThreshold) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + i = encodeVarintParams(dAtA, i, uint64(m.ValidatorVotingPowerThreshold)) + i-- + dAtA[i] = 0x40 + return len(dAtA) - i, nil +} +func (m *SynchronyParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *SynchronyParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *SynchronyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.Precision != nil { + n9, err9 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.Precision, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.Precision):]) + if err9 != nil { + return 0, err9 + } + i -= n9 + i = encodeVarintParams(dAtA, i, uint64(n9)) + i-- + dAtA[i] = 0x12 + } + if m.MessageDelay != nil { + n10, err10 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.MessageDelay, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MessageDelay):]) + if err10 != nil { + return 0, err10 + } + i -= n10 + i = encodeVarintParams(dAtA, i, uint64(n10)) + i-- + dAtA[i] = 0xa + } + return len(dAtA) - i, nil +} + +func (m *TimeoutParams) Marshal() (dAtA []byte, err error) { + size := m.Size() + dAtA = make([]byte, size) + n, err := m.MarshalToSizedBuffer(dAtA[:size]) + if err != nil { + return nil, err + } + return dAtA[:n], nil +} + +func (m *TimeoutParams) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *TimeoutParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } + i := len(dAtA) + _ = i + var l int + _ = l + if m.VoteDelta != nil { + n11, err11 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.VoteDelta, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VoteDelta):]) + if err11 != nil { + return 0, err11 + } + i -= n11 i = encodeVarintParams(dAtA, i, uint64(n11)) i-- dAtA[i] = 0x22 @@ -1677,9 +2095,6 @@ func (m *VersionParams) Size() (n int) { } var l int _ = l - if m.AppVersion != 0 { - n += 1 + sovParams(uint64(m.AppVersion)) - } if m.ConsensusVersion != 0 { n += 1 + sovParams(uint64(m.ConsensusVersion)) } @@ -1704,6 +2119,72 @@ func (m *HashedParams) Size() (n int) { return n } +func (m *HashedParamsV2) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + if m.ConsensusVersion != 0 { + n += 1 + sovParams(uint64(m.ConsensusVersion)) + } + if m.BlockMaxBytes != 0 { + n += 1 + sovParams(uint64(m.BlockMaxBytes)) + } + if m.BlockMaxGas != 0 { + n += 1 + sovParams(uint64(m.BlockMaxGas)) + } + if m.EvidenceMaxAgeNumBlocks != 0 { + n += 1 + sovParams(uint64(m.EvidenceMaxAgeNumBlocks)) + } + if m.EvidenceMaxAgeDurationNs != 0 { + n += 1 + sovParams(uint64(m.EvidenceMaxAgeDurationNs)) + } + if m.EvidenceMaxBytes != 0 { + n += 1 + sovParams(uint64(m.EvidenceMaxBytes)) + } + if len(m.ValidatorPubKeyTypes) > 0 { + for _, s := range m.ValidatorPubKeyTypes { + l = len(s) + n += 1 + l + sovParams(uint64(l)) + } + } + if m.XValidatorVotingPowerThreshold != nil { + n += m.XValidatorVotingPowerThreshold.Size() + } + if m.SynchronyMessageDelayNs != 0 { + n += 1 + sovParams(uint64(m.SynchronyMessageDelayNs)) + } + if m.SynchronyPrecisionNs != 0 { + n += 1 + sovParams(uint64(m.SynchronyPrecisionNs)) + } + if m.TimeoutProposeNs != 0 { + n += 1 + sovParams(uint64(m.TimeoutProposeNs)) + } + if m.TimeoutProposeDeltaNs != 0 { + n += 1 + sovParams(uint64(m.TimeoutProposeDeltaNs)) + } + if m.TimeoutVoteNs != 0 { + n += 1 + sovParams(uint64(m.TimeoutVoteNs)) + } + if m.TimeoutVoteDeltaNs != 0 { + n += 1 + sovParams(uint64(m.TimeoutVoteDeltaNs)) + } + if m.AbciRecheckTx { + n += 2 + } + return n +} + +func (m *HashedParamsV2_ValidatorVotingPowerThreshold) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovParams(uint64(m.ValidatorVotingPowerThreshold)) + return n +} func (m *SynchronyParams) Size() (n int) { if m == nil { return 0 @@ -2406,11 +2887,80 @@ func (m *VersionParams) Unmarshal(dAtA []byte) error { return fmt.Errorf("proto: VersionParams: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusVersion", wireType) + } + m.ConsensusVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ConsensusVersion |= VersionParams_ConsensusVersion(b&0x7F) << shift + if b < 0x80 { + break + } + } + default: + iNdEx = preIndex + skippy, err := skipParams(dAtA[iNdEx:]) + if err != nil { + return err + } + if (skippy < 0) || (iNdEx+skippy) < 0 { + return ErrInvalidLengthParams + } + if (iNdEx + skippy) > l { + return io.ErrUnexpectedEOF + } + iNdEx += skippy + } + } + + if iNdEx > l { + return io.ErrUnexpectedEOF + } + return nil +} +func (m *HashedParams) Unmarshal(dAtA []byte) error { + l := len(dAtA) + iNdEx := 0 + for iNdEx < l { + preIndex := iNdEx + var wire uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + wire |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + fieldNum := int32(wire >> 3) + wireType := int(wire & 0x7) + if wireType == 4 { + return fmt.Errorf("proto: HashedParams: wiretype end group for non-group") + } + if fieldNum <= 0 { + return fmt.Errorf("proto: HashedParams: illegal tag %d (wire type %d)", fieldNum, wire) + } + switch fieldNum { case 1: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field AppVersion", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field BlockMaxBytes", wireType) } - m.AppVersion = 0 + m.BlockMaxBytes = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -2420,12 +2970,31 @@ func (m *VersionParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.AppVersion |= uint64(b&0x7F) << shift + m.BlockMaxBytes |= int64(b&0x7F) << shift if b < 0x80 { break } } case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field BlockMaxGas", wireType) + } + m.BlockMaxGas = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.BlockMaxGas |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field ConsensusVersion", wireType) } @@ -2439,7 +3008,7 @@ func (m *VersionParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ConsensusVersion |= VersionParams_ConsensusVersion(b&0x7F) << shift + m.ConsensusVersion |= int32(b&0x7F) << shift if b < 0x80 { break } @@ -2465,7 +3034,7 @@ func (m *VersionParams) Unmarshal(dAtA []byte) error { } return nil } -func (m *HashedParams) Unmarshal(dAtA []byte) error { +func (m *HashedParamsV2) Unmarshal(dAtA []byte) error { l := len(dAtA) iNdEx := 0 for iNdEx < l { @@ -2488,13 +3057,32 @@ func (m *HashedParams) Unmarshal(dAtA []byte) error { fieldNum := int32(wire >> 3) wireType := int(wire & 0x7) if wireType == 4 { - return fmt.Errorf("proto: HashedParams: wiretype end group for non-group") + return fmt.Errorf("proto: HashedParamsV2: wiretype end group for non-group") } if fieldNum <= 0 { - return fmt.Errorf("proto: HashedParams: illegal tag %d (wire type %d)", fieldNum, wire) + return fmt.Errorf("proto: HashedParamsV2: illegal tag %d (wire type %d)", fieldNum, wire) } switch fieldNum { case 1: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ConsensusVersion", wireType) + } + m.ConsensusVersion = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.ConsensusVersion |= int32(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 2: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field BlockMaxBytes", wireType) } @@ -2513,7 +3101,7 @@ func (m *HashedParams) Unmarshal(dAtA []byte) error { break } } - case 2: + case 3: if wireType != 0 { return fmt.Errorf("proto: wrong wireType = %d for field BlockMaxGas", wireType) } @@ -2532,11 +3120,11 @@ func (m *HashedParams) Unmarshal(dAtA []byte) error { break } } - case 3: + case 4: if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusVersion", wireType) + return fmt.Errorf("proto: wrong wireType = %d for field EvidenceMaxAgeNumBlocks", wireType) } - m.ConsensusVersion = 0 + m.EvidenceMaxAgeNumBlocks = 0 for shift := uint(0); ; shift += 7 { if shift >= 64 { return ErrIntOverflowParams @@ -2546,11 +3134,235 @@ func (m *HashedParams) Unmarshal(dAtA []byte) error { } b := dAtA[iNdEx] iNdEx++ - m.ConsensusVersion |= int32(b&0x7F) << shift + m.EvidenceMaxAgeNumBlocks |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 5: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EvidenceMaxAgeDurationNs", wireType) + } + m.EvidenceMaxAgeDurationNs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EvidenceMaxAgeDurationNs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 6: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field EvidenceMaxBytes", wireType) + } + m.EvidenceMaxBytes = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.EvidenceMaxBytes |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 7: + if wireType != 2 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorPubKeyTypes", wireType) + } + var stringLen uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + stringLen |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + intStringLen := int(stringLen) + if intStringLen < 0 { + return ErrInvalidLengthParams + } + postIndex := iNdEx + intStringLen + if postIndex < 0 { + return ErrInvalidLengthParams + } + if postIndex > l { + return io.ErrUnexpectedEOF + } + m.ValidatorPubKeyTypes = append(m.ValidatorPubKeyTypes, string(dAtA[iNdEx:postIndex])) + iNdEx = postIndex + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field ValidatorVotingPowerThreshold", wireType) + } + var v uint64 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } + m.XValidatorVotingPowerThreshold = &HashedParamsV2_ValidatorVotingPowerThreshold{v} + case 9: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SynchronyMessageDelayNs", wireType) + } + m.SynchronyMessageDelayNs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SynchronyMessageDelayNs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 10: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field SynchronyPrecisionNs", wireType) + } + m.SynchronyPrecisionNs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.SynchronyPrecisionNs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 11: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutProposeNs", wireType) + } + m.TimeoutProposeNs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutProposeNs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 12: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutProposeDeltaNs", wireType) + } + m.TimeoutProposeDeltaNs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutProposeDeltaNs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 13: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutVoteNs", wireType) + } + m.TimeoutVoteNs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutVoteNs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 14: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field TimeoutVoteDeltaNs", wireType) + } + m.TimeoutVoteDeltaNs = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.TimeoutVoteDeltaNs |= int64(b&0x7F) << shift + if b < 0x80 { + break + } + } + case 15: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field AbciRecheckTx", wireType) + } + var v int + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowParams + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + v |= int(b&0x7F) << shift if b < 0x80 { break } } + m.AbciRecheckTx = bool(v != 0) default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/proto/tendermint/types/params.proto b/proto/tendermint/types/params.proto index ebfc8bf8a..823038a6b 100644 --- a/proto/tendermint/types/params.proto +++ b/proto/tendermint/types/params.proto @@ -14,8 +14,7 @@ message ConsensusParams { BlockParams block = 1; EvidenceParams evidence = 2; ValidatorParams validator = 3; - // DEPRECATED. This will be removed in a future release. - // Replaced by ResponsePrepareProposal.app_version + // Consensus protocol version. VersionParams version = 4; SynchronyParams synchrony = 5; TimeoutParams timeout = 6; @@ -81,9 +80,11 @@ message ValidatorParams { optional uint64 voting_power_threshold = 2; //[(gogoproto.nullable) = true] } -// VersionParams contains the ABCI application version. +// VersionParams contains the consensus protocol version. message VersionParams { - uint64 app_version = 1; + // ResponsePrepareProposal.app_version sets Header.Version.App instead. + reserved 1; + reserved "app_version"; // Version of consensus protocol, used to upgrade consensus without hard forks ConsensusVersion consensus_version = 2; @@ -92,18 +93,43 @@ message VersionParams { CONSENSUS_VERSION_0 = 0; // CONSENSUS_VERSION_1 changes proposer selection algorithm to not double-propose when previous proposer is offline. CONSENSUS_VERSION_1 = 1; + // CONSENSUS_VERSION_2 keeps version 1 proposer selection and commits HashedParamsV2 (draft). + // See spec/consensus/consensus-params-commitment.md; runtime support is deferred. + CONSENSUS_VERSION_2 = 2; } } -// HashedParams is a subset of ConsensusParams. -// -// It is hashed into the Header.ConsensusHash. +// HashedParams is the legacy subset committed by Header.ConsensusHash. +// Preserve its schema and encoding for historical block verification. message HashedParams { int64 block_max_bytes = 1; int64 block_max_gas = 2; int32 consensus_version = 3; } +// HashedParamsV2 is the draft complete effective-parameter snapshot for consensus version >= 2. +// Freeze this mapping and its encoding before activation; do not hash ABCI patches. +// See spec/consensus/consensus-params-commitment.md for canonical bytes and domain separation. +message HashedParamsV2 { + option (gogoproto.stable_marshaler) = true; + + int32 consensus_version = 1; // Always >= CONSENSUS_VERSION_2. + int64 block_max_bytes = 2; + int64 block_max_gas = 3; + int64 evidence_max_age_num_blocks = 4; + int64 evidence_max_age_duration_ns = 5; + int64 evidence_max_bytes = 6; + repeated string validator_pub_key_types = 7; + optional uint64 validator_voting_power_threshold = 8; + int64 synchrony_message_delay_ns = 9; + int64 synchrony_precision_ns = 10; + int64 timeout_propose_ns = 11; + int64 timeout_propose_delta_ns = 12; + int64 timeout_vote_ns = 13; + int64 timeout_vote_delta_ns = 14; + bool abci_recheck_tx = 15; +} + // SynchronyParams configure the bounds under which a proposed block's timestamp is considered valid. // These parameters are part of the proposer-based timestamps algorithm. For more information, // see the specification of proposer-based timestamps: diff --git a/proto/tendermint/types/types.pb.go b/proto/tendermint/types/types.pb.go index 6c695234d..152425fc0 100644 --- a/proto/tendermint/types/types.pb.go +++ b/proto/tendermint/types/types.pb.go @@ -366,10 +366,12 @@ type Header struct { // hashes from the app output from the prev block ValidatorsHash []byte `protobuf:"bytes,8,opt,name=validators_hash,json=validatorsHash,proto3" json:"validators_hash,omitempty"` NextValidatorsHash []byte `protobuf:"bytes,9,opt,name=next_validators_hash,json=nextValidatorsHash,proto3" json:"next_validators_hash,omitempty"` - ConsensusHash []byte `protobuf:"bytes,10,opt,name=consensus_hash,json=consensusHash,proto3" json:"consensus_hash,omitempty"` - NextConsensusHash []byte `protobuf:"bytes,11,opt,name=next_consensus_hash,json=nextConsensusHash,proto3" json:"next_consensus_hash,omitempty"` - AppHash []byte `protobuf:"bytes,12,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` - ResultsHash []byte `protobuf:"bytes,13,opt,name=results_hash,json=resultsHash,proto3" json:"results_hash,omitempty"` + // Current and next parameter commitments enter Header.Hash and the signed BlockID. + // Draft full-commitment rules: spec/consensus/consensus-params-commitment.md. + ConsensusHash []byte `protobuf:"bytes,10,opt,name=consensus_hash,json=consensusHash,proto3" json:"consensus_hash,omitempty"` + NextConsensusHash []byte `protobuf:"bytes,11,opt,name=next_consensus_hash,json=nextConsensusHash,proto3" json:"next_consensus_hash,omitempty"` + AppHash []byte `protobuf:"bytes,12,opt,name=app_hash,json=appHash,proto3" json:"app_hash,omitempty"` + ResultsHash []byte `protobuf:"bytes,13,opt,name=results_hash,json=resultsHash,proto3" json:"results_hash,omitempty"` // consensus info EvidenceHash []byte `protobuf:"bytes,14,opt,name=evidence_hash,json=evidenceHash,proto3" json:"evidence_hash,omitempty"` ProposedAppVersion uint64 `protobuf:"varint,15,opt,name=proposed_app_version,json=proposedAppVersion,proto3" json:"proposed_app_version,omitempty"` diff --git a/proto/tendermint/types/types.proto b/proto/tendermint/types/types.proto index ea64fa29d..bc2a86862 100644 --- a/proto/tendermint/types/types.proto +++ b/proto/tendermint/types/types.proto @@ -104,6 +104,8 @@ message Header { // hashes from the app output from the prev block bytes validators_hash = 8; // validators for the current block bytes next_validators_hash = 9; // validators for the next block + // Current and next parameter commitments enter Header.Hash and the signed BlockID. + // Draft full-commitment rules: spec/consensus/consensus-params-commitment.md. bytes consensus_hash = 10; // consensus params for current block bytes next_consensus_hash = 11; // consensus params for next block bytes app_hash = 12; // state after txs from the previous block diff --git a/spec/README.md b/spec/README.md index 1ba164f19..a2c5250a1 100644 --- a/spec/README.md +++ b/spec/README.md @@ -20,6 +20,7 @@ It shall be used to describe protocol semantics, namely the BFT consensus engine - [Core Data Structures](./core/data_structures.md) - [State](./core/state.md) - [Consensus Protocol](./consensus/consensus.md) (source-derived; see the [consensus index](./consensus/readme.md)) +- [Full Consensus Parameter Commitment (draft)](./consensus/consensus-params-commitment.md) - [Proposer Selection](./consensus/proposer-selection.md) - [Time](./consensus/consensus-alternative-flows.md#proposal-timestamps-and-time-rules) (historical design: [Proposer-Based Timestamps](./consensus/proposer-based-timestamp/README.md)) - [Light Client](./consensus/light-client/README.md) diff --git a/spec/abci/api.md b/spec/abci/api.md index 13eb3f0c6..e12ba8ef8 100644 --- a/spec/abci/api.md +++ b/spec/abci/api.md @@ -908,7 +908,7 @@ nondeterministic | consensus_param_updates | [tendermint.types.ConsensusParams](#tendermint-types-ConsensusParams) | | Changes to consensus-critical gas, size, and other parameters that will be applied at next height. | | core_chain_lock_update | [tendermint.types.CoreChainLock](#tendermint-types-CoreChainLock) | | Core chain lock that will be used for next block. | | validator_set_update | [ValidatorSetUpdate](#tendermint-abci-ValidatorSetUpdate) | | Changes to validator set that will be applied at next height. | -| app_version | [uint64](#uint64) | | Application version that was used to create the current proposal. | +| app_version | [uint64](#uint64) | | Application protocol version used to create this proposal; MUST be non-zero. It becomes Header.Version.App. Validators' applications verify it in ProcessProposal. | diff --git a/spec/abci/methods.md b/spec/abci/methods.md index c79983316..d456de2ca 100644 --- a/spec/abci/methods.md +++ b/spec/abci/methods.md @@ -92,6 +92,9 @@ that happens on startup. * **Usage**: * Called once upon genesis. +* `consensus_params` carries no application version. The application determines + its initial protocol version itself, for example per network or from its own + configuration. * If `ResponseInitChain.validator_set_update.validator_updates` is empty, genesis validator membership is retained; quorum-key and quorum-hash updates can still be supplied in `validator_set_update`. diff --git a/spec/consensus/consensus-params-commitment.md b/spec/consensus/consensus-params-commitment.md new file mode 100644 index 000000000..3b2941256 --- /dev/null +++ b/spec/consensus/consensus-params-commitment.md @@ -0,0 +1,452 @@ +# Full Consensus Parameter Commitment + +**DRAFT.** This is a normative design and source schema proposal, +not implemented consensus behavior. The schema has generated bindings; runtime +support and activation are deliberately deferred. Only the application-version +removal is partly implemented; see +[application version](#application-version-is-not-a-consensus-parameter). +MUST, MUST NOT and SHOULD describe the target implementation. + +In this document FULL means effective `Version.ConsensusVersion >= 2`, and +LEGACY means a lower consensus version. + +## Acceptance scenarios + +| Scenario | Required result | +| --- | --- | +| Change any effective parameter, including evidence limits, timeout or threshold presence | The full commitment changes; a substituted snapshot fails authentication. | +| Equivalent complete state reached through different partial updates | Identical canonical bytes and hash; raw ABCI patches are never hashed. | +| Omit the version group in a partial update | Retain the current consensus version. Any update lowering it is rejected. | +| Raise the consensus version to 2 at height H | H-1 signs the full next-parameter hash; H uses the full current-parameter hash. | +| Attempt activation with incomplete groups or duration fields | Reject before accepting a candidate; unauthenticated legacy values cannot fill gaps. | +| Bootstrap from FULL history with a changed threshold | Authenticate each required height's parameters and validator context; do not pin a legitimate mutable threshold to genesis. | +| Replay or restart across activation | Hash each height's parameters by their own consensus version; produce the original block IDs and verify the original signatures. | +| Receive unknown consensus versions, unsupported parameter fields or noncanonical snapshot bytes | Fail closed; never silently downgrade or omit a new parameter. | + +## Existing commitment and threat boundary + +At this proposal's base, `types/params.go:HashConsensusParams` hashes only +`Block.MaxBytes`, `Block.MaxGas` and `Version.ConsensusVersion` through the existing +`HashedParams` message. Evidence limits, validator key types and voting threshold, +synchrony bounds, timeouts and ABCI rechecking are outside that digest. The +application version leaves consensus parameters entirely; see +[application version](#application-version-is-not-a-consensus-parameter). +Actual evidence proofs already contribute to `EvidenceHash`; this proposal adds +their configurable limits, not a second commitment to the proofs. + +`Header.Hash` already includes `ConsensusHash` and `NextConsensusHash`. Its result +enters `BlockID.Hash`, the canonical block-ID digest, `CanonicalVote` and the +quorum-bound BLS signing digest. `Vote.SignBytes` in +[`proto/tendermint/types/types.go`](../../proto/tendermint/types/types.go) uses +[`libs/bytes/marshal.go`](../../libs/bytes/marshal.go)'s fixed-size field encoding, +not ordinary Protobuf wire encoding of the vote. Authenticating both parameter +hashes therefore needs no new signature field and no new `StateID` field. Preserve +that existing vote layout, fixed-width height/round encoding and signing domains. See +[signing](signing.md), [block headers](../core/data_structures.md#header), +[`types/block.go`](../../types/block.go), +[`types/canonical.go`](../../types/canonical.go) and +[`types/quorum_sign_data.go`](../../types/quorum_sign_data.go). + +A threshold BLS signature proves recovery under the quorum key. It does not prove +that a raised application voting-power threshold was met by enough distinct +signers. Adding signer-count attestation for that separate issue is out of scope. + +## Impact of forged parameters today + +A node bootstrapped by state sync takes `ConsensusParams` from its state +provider: the configured primary RPC server +([`internal/statesync/stateprovider.go:207`](../../internal/statesync/stateprovider.go)) +or, with P2P state sync, its peers (`stateprovider.go:355`). +`verifyConsensusParams` (`stateprovider.go:509`) checks only `Block.MaxBytes`, +`Block.MaxGas` and `Version.ConsensusVersion` against the signed `ConsensusHash`, +and pins `Validator.VotingPowerThreshold` to the locally trusted genesis/InitChain +value (`stateprovider.go:522`, +[`internal/statesync/reactor.go:280`](../../internal/statesync/reactor.go)). +Every other value is taken on trust. + +| Parameter | Forged lower or narrower | Forged higher or wider | +| --- | --- | --- | +| `evidence.max_age_*` (both) | Rejects valid evidence ([`internal/evidence/verify.go:53`](../../internal/evidence/verify.go)); halts on a committed block containing it. | Accepts expired evidence; its own proposals carrying it are rejected. | +| `evidence.max_bytes` | Rejects blocks with more evidence ([`internal/state/validation.go:129`](../../internal/state/validation.go)); halts on such a committed block. | Its proposals with more evidence are rejected. | +| `validator.pub_key_types` | Rejects valid validator updates (`validation.go:245`); halts at the next rotation. | Accepts key types honest nodes reject; it cannot commit alone, so this matters only if validators share the forged view. | +| `validator.voting_power_threshold` | Not forgeable at bootstrap: a mismatch with the pinned value fails state sync. If it were, the node would unlock on minority polkas (below). | Not forgeable at bootstrap; if it were, it would refuse valid polkas and commits (`vote_set.go:427`) and halt. | +| `synchrony.*` | Treats timely proposals as too early or late and prevotes nil ([`internal/consensus/state_data.go:361`](../../internal/consensus/state_data.go)). | Accepts untimely proposals. | +| `timeout.*` | Leaves rounds early and casts more nil votes (`state_data.go:636`, `:651`); local unsafe overrides take precedence. | Slower rounds; affects its own liveness. | +| `abci.recheck_tx` | Invalid transactions linger in the mempool and in its proposals ([`internal/state/execution.go:766`](../../internal/state/execution.go)). | Needless `CheckTx` load. | + +A lowered voting-power threshold cannot finalize a commit on its own: precommit +finalization recovers a BLS threshold signature, which needs the DKG threshold +`QuorumTypeThresholdVotingPower` +([`types/vote_set.go:418`](../../types/vote_set.go), `:437`; +[`types/validator_set.go:608`](../../types/validator_set.go)). Prevote +2/3, the +polka behind POL, uses the configurable `QuorumVotingThresholdPower` +(`vote_set.go:411`, `validator_set.go:585`) with no signature recovery. A low +threshold therefore lets a small minority create polkas that unlock honest +validators across rounds +([`internal/consensus/state_prevoter.go:147`](../../internal/consensus/state_prevoter.go)), +so the classic cross-round fork no longer needs at least 1/3 Byzantine power. +This applies to any threshold below the strict 2/3+1 floor, which the override +from [#1052](https://github.com/dashpay/tenderdash/pull/1052) permits through +genesis or `consensus_param_updates`. It is a configuration risk, not a +bootstrap-forgery one: state sync pins the threshold to the trusted local value. +Dropping that pin without the full commitment would let a forged low threshold +make a state-synced validator unlock on minority polkas. + +Halting is the common outcome and survives restarts: the forged values are +stored, and later partial updates replace only the groups they carry +([`types/params.go:408`](../../types/params.go)). Recovery requires wiping the +node and re-syncing from a trusted source. Divergence is the worse case: a node +serving clients answers from a different parameter view. A validator with forged +parameters reduces liveness in proportion to its voting power. Nothing detects +the forgery today, because the full-node `ConsensusHash` check +([`internal/state/validation.go:66`](../../internal/state/validation.go)) also +covers only three fields. A network-wide safety impact requires many nodes or validators +to sync from the same malicious source, such as a widely used public RPC +endpoint. With the full commitment, state sync rejects forged parameters at +bootstrap. + +## Consensus version selects the hash rule + +`VersionParams.consensus_version` selects the hash rule of the parameter set that +contains it: + +| Effective `consensus_version` | Hash rule for `ConsensusHash` and `NextConsensusHash` | +| --- | --- | +| `CONSENSUS_VERSION_0`, `CONSENSUS_VERSION_1` | Legacy `HashedParams` hash, unchanged | +| `CONSENSUS_VERSION_2` | `FullHash` of the complete `HashedParamsV2` snapshot below | +| Any other value | Rejected | + +`CONSENSUS_VERSION_2` keeps the version 1 proposer selection +(`NewHeightRoundProposerSelector`) and adds the full commitment. +`NewProposerSelector` +([`internal/consensus/versioned/selectproposer/proposer_selector.go:59`](../../internal/consensus/versioned/selectproposer/proposer_selector.go)) +MUST map version 2 accordingly; today it rejects every value above 1. + +The rule is self-describing: each parameter set is hashed by its own version. At +H-1, `NextConsensusHash` is computed from the next parameters, which already carry +version 2, so it uses the full rule while `ConsensusHash` stays legacy. The domain +prefix starts with byte `0x74`, which no legacy `HashedParams` encoding (tags 1–3) +can start with, so legacy and full preimages never coincide. + +Validation MUST add two checks that do not exist today: + +1. **Known versions only.** `ValidateConsensusParams` + ([`types/params.go:289`](../../types/params.go)) does not range-check + `Version.ConsensusVersion`. It MUST reject values outside the defined enum, + including negative values, for genesis, InitChain, updates and state sync. +2. **Never decrease.** Where an ABCI update is merged and validated + ([`internal/state/current_round_state.go:171`](../../internal/state/current_round_state.go)), + reject any candidate whose consensus version is lower than the current one. + `ValidateConsensusParams` sees only the candidate, so this check compares the + current and candidate parameters. This changes today's behavior, which + accepts any decrease, including 1 to 0. + +Activation uses the existing mechanism: the application returns +`consensus_param_updates` with `version.consensus_version = 2`, as e2e testnets do +with `consensus_version_updates` +([`test/e2e/pkg/manifest.go:63`](../../test/e2e/pkg/manifest.go)). A genesis +document without a version group resolves to version 0 +([`types/params.go:143`](../../types/params.go)) and therefore LEGACY. + +Activation MUST NOT bump `version.BlockProtocol`; `CONSENSUS_VERSION_2` is the +only switch. `Header.ValidateBasic` requires every header's `Version.Block` to +equal the binary constant +([`types/block.go:477`](../../types/block.go)), state takes that constant at +genesis and rollback +([`internal/state/state.go:37`](../../internal/state/state.go), +[`internal/state/rollback.go:77`](../../internal/state/rollback.go)) and +otherwise copies it from trusted headers in state sync, and peers must match it +([`types/node_info.go:148`](../../types/node_info.go)). A bump would make the new +binary reject every historical block in block sync, replay and state sync, and +would split the network while nodes upgrade instead of switching at height H. + +`UpdateConsensusParams` replaces the whole version group +([`types/params.go:420`](../../types/params.go)). Before `app_version` was +removed, a group sent only to set it also overwrote `consensus_version`, +typically with 0. The group now carries only `consensus_version`, so that pitfall +is gone. Protobuf cannot distinguish an omitted enum inside a present group from +an explicit 0, so a present version group with a lower value, including 0, is a +decrease and is rejected; omitting the group retains the version. + +The `V2` in `HashedParamsV2` and the hash domain names the snapshot schema, not a +release. A later consensus version may keep this schema or define a new one. + +## Complete snapshot and frozen mapping + +Start with a validated, fully resolved effective `ConsensusParams` value. Apply +the normal ABCI candidate update and completion rules before constructing this +snapshot. Do not hash a response patch, pointer addresses, JSON, local timeout +overrides or opaque encoded `ConsensusParams` bytes. Nodes MUST use the same +effective parameter values for validation and commitment. + +The source of truth is +[`proto/tendermint/types/params.proto`](../../proto/tendermint/types/params.proto). +`HashedParamsV2` is a flat message; the following mapping is exhaustive for the +seven parameter groups in this base. Durations are signed 64-bit nanosecond counts. +`Version.AppVersion` is deprecated and excluded rather than committed (see +[application version](#application-version-is-not-a-consensus-parameter)). +Tags are contiguous; the schema is not frozen yet. + +| Tag | Snapshot field | Protobuf type | Effective source | +| --- | --- | --- | --- | +| 1 | `consensus_version` | `int32` | `Version.ConsensusVersion`; always 2 or higher, so always encoded | +| 2 | `block_max_bytes` | `int64` | `Block.MaxBytes` | +| 3 | `block_max_gas` | `int64` | `Block.MaxGas` | +| 4 | `evidence_max_age_num_blocks` | `int64` | `Evidence.MaxAgeNumBlocks` | +| 5 | `evidence_max_age_duration_ns` | `int64` | `Evidence.MaxAgeDuration` | +| 6 | `evidence_max_bytes` | `int64` | `Evidence.MaxBytes` | +| 7 | `validator_pub_key_types` | repeated `string` | `Validator.PubKeyTypes`, preserving order | +| 8 | `validator_voting_power_threshold` | optional `uint64` | `Validator.VotingPowerThreshold`, preserving absence versus explicit zero | +| 9 | `synchrony_message_delay_ns` | `int64` | `Synchrony.MessageDelay` | +| 10 | `synchrony_precision_ns` | `int64` | `Synchrony.Precision` | +| 11 | `timeout_propose_ns` | `int64` | `Timeout.Propose` | +| 12 | `timeout_propose_delta_ns` | `int64` | `Timeout.ProposeDelta` | +| 13 | `timeout_vote_ns` | `int64` | `Timeout.Vote` | +| 14 | `timeout_vote_delta_ns` | `int64` | `Timeout.VoteDelta` | +| 15 | `abci_recheck_tx` | `bool` | `ABCI.RecheckTx` | + +Do not sort or deduplicate public-key types during hashing. Their order is part of +the committed value even if current validation treats the list as a membership +set. Null and zero voting thresholds remain distinct snapshots; resolving a +threshold to a quorum default MUST NOT erase this distinction. Duration conversion +MUST be exact and within int64 range; reject overflow and invalid effective values. + +The `HashedParamsV2` field meanings, tags, wire types and canonical encoding MUST +be frozen before activation. A future parameter or changed interpretation requires +a new consensus version with a reviewed hash rule, not silent omission or mutation +of this snapshot. The existing `HashedParams` schema and historical bytes remain +unchanged. + +## Canonical bytes and domain + +For validated effective parameters `P`, define: + +```text +FullHash(P) = SHA256(ASCII("tenderdash/consensus-params/v2") || 0x00 || EncodeV2(P)) +``` + +`EncodeV2` is Protobuf wire encoding with these additional normative constraints: + +1. Encode fields in ascending tag order. Encode each singular field at most once; + repeated strings appear consecutively in their original order. +2. Use minimal unsigned varints for tags, lengths, unsigned integers and positive + signed integers. Negative `int64` values use their two's-complement 64-bit + value as a ten-byte varint; `block_max_gas = -1` is valid. Do not use zigzag + encoding. Supported consensus-version values must pass protocol validation. +3. Omit zero non-presence scalar fields, false booleans and absent optional fields. + Encode a present optional threshold even when its value is zero. A nonempty + repeated list retains each entry, including an empty string if validation ever + permits it; current parameter validation still applies. +4. Strings MUST be valid UTF-8 and are encoded as their exact UTF-8 bytes without + Unicode normalization. No maps, nested messages or `Duration` wire encodings + occur in this snapshot. +5. Reject unknown snapshot tags, duplicate singular fields, wrong wire types, + nonminimal varints, malformed lengths, invalid UTF-8 and any byte sequence + differing from the canonical re-encoding. Reject unsupported effective + parameter fields before constructing the snapshot rather than dropping them. + +Stable-marshaler options in the source schema support the implementation but are +not the cross-language definition. Generic “deterministic protobuf” serialization +alone is not a sufficient contract; see the official +[serialization is not canonical](https://protobuf.dev/programming-guides/serialization-not-canonical/) +guidance. Implementations MUST satisfy these rules and the shared conformance +vectors. The domain prefix is included only for FULL; +never apply it retroactively to a legacy hash. + +## Activation and ordinary updates + +Let H be the first height whose current parameters have consensus version 2 or +higher. The software and application upgrade MUST be deployed before height H-1, +whose candidate already needs to construct and validate a full next-parameter +commitment. + +| Block height | Current version and `ConsensusHash` | Next version and `NextConsensusHash` | +| --- | --- | --- | +| H-2 | Below 2 / historical hash | Below 2 / historical hash | +| H-1 | Below 2 / historical hash | 2 / `FullHash(P_H)` | +| H and later | 2 or higher / `FullHash(P_h)` | 2 or higher / `FullHash(P_(h+1))` | + +The parameter update returned for H-1 that raises the consensus version to 2 MUST +explicitly supply all seven parameter-group messages: block, evidence, validator, +version, synchrony, timeout and ABCI. Every duration field MUST be supplied. Each supplied group is +the complete intended replacement under the normal update semantics; zero scalar +values are intentional values where valid. Within the complete validator group, +an absent threshold explicitly means no configured override, not inheritance. +Recompute the candidate validator set's live voting threshold from these complete +parameters even when membership does not change: absence MUST clear a copied +override to the quorum-default representation (`VotingPowerThreshold = 0`). +Explicit zero also selects that default at runtime, while remaining distinct in +the snapshot. A signed parameter hash MUST NOT coexist with a stale inherited +validator-set override. + +Reject activation patches that omit a group or duration, require inherited +uncommitted values, or fail normal validation. Validate completeness before any +completion routine can fill omissions. This prevents an earlier unauthenticated +state-sync parameter from seeding the first full snapshot. Validate the complete +candidate after normal ABCI processing and require the proposer and validator to +derive identical next commitments before acceptance. A chain starting at +consensus version 2 MUST likewise supply a complete validated genesis/InitChain parameter snapshot. + +After activation, ordinary partial updates are allowed: merge into the last +authenticated full state, retain the consensus version when the version group is +omitted, reject any decrease, validate the result and hash the complete +effective value. Unchanged updates produce unchanged hashes. +Persist the selected current and next states atomically with their normal block +application state; restart and replay MUST recover the original transition. + +## State sync, light verification and history + +Both RPC and P2P state providers MUST select the hash rule from the candidate's +consensus version, verify the result against the signed header hash, and reject +mismatches or unknown versions before installing state. A peer's claimed version +is authenticated only by reproducing the signed hash under the rule it selects. Authenticate the snapshot at the +height whose `ConsensusHash` is used; if using a prior header's `NextConsensusHash`, +bind it to the successor height. Do not infer authenticity from structural +validation, a claimed response height or a claimed version of 2 or higher. + +For FULL, allow legitimate threshold updates only after complete-hash verification; +do not keep the legacy genesis pin as a substitute for that authentication. +Bootstrap may require different parameter snapshots for `LastValidators` and +`Validators`: bind each validator set to its own height's signed parameters rather +than applying one current threshold to both. Preserve Dash Core quorum membership, +key and quorum-hash verification; `ValidatorSet.Hash` alone does not commit every +member or a voting-power override. Never trust remote quorum/threshold data merely +because it accompanies an application snapshot. + +For LEGACY history, retain existing genesis-threshold and quorum-binding defenses; +FULL is not a reason to weaken verification of old blocks. Keep each historical +hash variant applicable to its original protocol and height. Old clients that +do not know version 2 cannot safely follow activation: interoperability is an +upgrade requirement, not a fallback to legacy verification. + +## Application version is not a consensus parameter + +`ConsensusParams.Version.AppVersion` (`VersionParams.app_version`, field 1) is +removed. The legacy `HashedParams` never included it, so no historical or LEGACY +hash changes, and the removal needs no activation height. + +This change implements the following: + +1. **Schema.** Field 1 and the name `app_version` are reserved in `VersionParams`; + `types.VersionParams.AppVersion` and its conversions are removed. +2. **Block header.** `ResponsePrepareProposal.app_version` is the only source of + `Header.Version.App` and MUST be non-zero. `ResponsePrepareProposal.Validate` + already rejects zero ([`abci/types/types.go:275`](../../abci/types/types.go), + called at [`internal/state/execution.go:301`](../../internal/state/execution.go)), + so the proposer cannot produce a proposal without it. The value enters + `StateID.AppVersion` ([`types/block.go:553`](../../types/block.go)) and is signed. + Tenderdash does not check `Version.App` on non-proposers + ([`internal/state/validation.go:33`](../../internal/state/validation.go)); the + application MUST verify it in ProcessProposal. +3. **Committed state.** `State.Update` sets `State.Version.Consensus.App` from the + committed header's `Version.App` + ([`internal/state/execution.go:795`](../../internal/state/execution.go)), not + from parameters. InitChain keeps the value that the handshake took from + `ResponseInfo` at height 0 + ([`internal/consensus/replay.go:273`](../../internal/consensus/replay.go)). + Rollback takes it from the header of the block rolled back to + ([`internal/state/rollback.go:78`](../../internal/state/rollback.go)). +4. **Example applications.** The kvstore example and the e2e application do not + send the field in parameter updates. +5. **InitChain.** `RequestInitChain.consensus_params` carries no application + version, and Tenderdash provides no replacement channel. The application MUST + determine its initial protocol version itself, for example per network or from + its own configuration. +6. **Compatibility.** Protobuf decoding ignores field 1 sent by older applications + in `InitChain`, `PrepareProposal` or `FinalizeBlock` parameter updates, and in + stored parameters. Genesis JSON containing + `consensus_params.version.app_version` still loads, because + [`types/genesis.go`](../../types/genesis.go) decodes with lenient + `json.Unmarshal`, but the value is ignored and not passed to InitChain or + written back. Generated ABCI clients drop the field, which requires a + coordinated application release. + +**Breaking for Dash Platform.** Platform selects its starting `PlatformVersion` +from `RequestInitChain.consensus_params.version.app_version`, the genesis value +`1` on mainnet and testnet, and falls back to its desired version when the value +is 0 +([`rs-drive-abci` `init_chain`](https://github.com/dashpay/platform/blob/de80f86d80ffcfa0a91ae59ce43cfeb161e27bc5/packages/rs-drive-abci/src/execution/engine/initialization/init_chain/mod.rs#L27-L52)). +Platform MUST determine its initial protocol version itself before it upgrades to +a Tenderdash without this field. Otherwise a node syncing from genesis starts at +the wrong protocol version and halts on an app-hash mismatch. + +The following remain for the implementation: + +1. **Node state.** Remove `State.Version.Consensus.App`, its height-0 write from + `ResponseInfo` and its use in `State.MakeBlock` + ([`internal/state/state.go:291`](../../internal/state/state.go)). Then + `RequestPrepareProposal.version` carries only the block version and that field's + comment changes. The `ver > 0` guard at `execution.go:324` becomes an + unconditional assignment. The shared `tendermint.version.Consensus` message + keeps `app` because `Header.Version` uses it. +2. **Node info.** Take `NodeInfo.ProtocolVersion.App` from + `ResponseInfo.app_version`, which the handshake already returns + ([`internal/consensus/replay.go:287`](../../internal/consensus/replay.go), + [`node/node.go:514`](../../node/node.go)), instead of from state + ([`node/node.go:533`](../../node/node.go), + [`node/setup.go:447`](../../node/setup.go) for seeds, which have no application + and report 0). Peer compatibility checks only the block version + ([`types/node_info.go:148`](../../types/node_info.go)). +3. **State sync.** `verifyApp` + ([`internal/statesync/syncer.go:697`](../../internal/statesync/syncer.go)) MUST + require `ResponseInfo.app_version >= Header.Version.App` of the trusted snapshot + header instead of equality; the header value is reached through the state + provider's `State.Version` + ([`internal/statesync/stateprovider.go:177`](../../internal/statesync/stateprovider.go)). + Applications may report their latest supported protocol version in Info, as + Dash Platform does. + +## Integration and implementation sequence + +1. Resolve the integration blocker before freezing this snapshot. This document + allocates `CONSENSUS_VERSION_2`. Open + [#1572](https://github.com/dashpay/tenderdash/pull/1572) also assigns + `ConsensusVersion = 2` to heartbeat behavior and adds two timeouts to its legacy + hash; [#1583](https://github.com/dashpay/tenderdash/pull/1583) also uses version 2 + for randomness. Reconcile these number assignments before any of them merges. + Any heartbeat parameters merged before activation MUST be added to the full + mapping/schema and vectors before freezing it. Preserve any merged legacy hash + variant for replay. The 15-field draft above MUST NOT activate while that + coverage is stale. +2. Implement the version range check, the never-decrease check, conversions, + defaults and equality in `types/params.go` and ABCI/state messages, and map + version 2 in `NewProposerSelector`. `Equals` currently omits voting-threshold + presence/value; include it to avoid incorrect empty/no-op shortcuts. +3. Implement the canonical snapshot encoder and dispatch `HashConsensusParams` by + consensus version; retain the existing legacy encoder. Wire current/next hashes + through `internal/state/current_round_state.go`, `internal/state/validation.go` and + proposal/block validation. Enforce the complete transition in genesis/InitChain + and proposal processing. Recompute derived validator thresholds, including + clearing a prior positive override when the complete new snapshot has none; + do not depend on a membership update to perform this reset. +4. Update persisted-state conversions, replay and startup handling. Update both + `internal/statesync/stateprovider.go` providers, `verifyConsensusParams`, + `applyVotingPowerThreshold` and P2P parameter-response conversion. Audit RPC, + light-client and SDK consumers for consensus-version transport and height binding. +5. Publish cross-language vectors and run the tests below. Coordinate an explicit + H, deploy before H-1, exercise mixed-version rejection on a test network, and + permit activation only after all blockers and acceptance tests pass. + +## Required verification before runtime release + +| Area | Required tests | +| --- | --- | +| Coverage | Mutate every mapped scalar and each list element/order; test nil, present zero and positive threshold separately. Every effective change changes the full hash. | +| Updates | Different patches reaching the same state hash equally; omitted groups/durations retain values only after activation; invalid values, unknown consensus versions, unsupported fields and any consensus-version decrease, including a present version group with 0, fail closed. | +| Transition | Complete H-1 proposal accepted, incomplete transition rejected; current/next hashes at H-2/H-1/H agree across proposer, validators, stored state and RPC. Old positive live threshold to FULL with no override clears the derived threshold even with unchanged members. Complete genesis at consensus version 2 works. | +| Encoding | Cross-language bytes and hashes for valid complete snapshots, zero-value omission, threshold presence, `max_gas = -1`, list order, UTF-8 and duration boundaries; reject duplicate/unknown fields and nonminimal encodings. | +| Authentication | Substitute each previously unhashed field in RPC/P2P responses; correlate response height and signed header; require per-height thresholds when validator sets cross an update. | +| Application version | Proposal with zero `app_version` rejected; committed and rolled-back state follow the header app version; legacy hashes unchanged; field 1 from an old application and in genesis JSON ignored; state sync accepts Info above the header version and rejects below. | +| Recovery | Replay and restart before/at/after H; historical signature/block-ID vectors unchanged; persisted consensus version and optional threshold survive round trips. | +| Quorum and policy | Retain Core-backed membership/key binding and all legacy trust defenses; authenticate FULL mutable thresholds without genesis pinning; do not claim raised-threshold signer-count attestation. | + +## Tracking + +No dedicated GitHub issue was found for the complete commitment at drafting. +This committed plan is the implementation tracker. Related work: +[#1442](https://github.com/dashpay/tenderdash/pull/1442) (legacy state-sync trust), +[#1476](https://github.com/dashpay/tenderdash/issues/1476) (peer/height correlation), +[#1546](https://github.com/dashpay/tenderdash/issues/1546) (deferred evidence) and +[#1547](https://github.com/dashpay/tenderdash/pull/1547) (evidence mode). + +🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent diff --git a/spec/consensus/consensus.md b/spec/consensus/consensus.md index dd50d52b9..a8bee1126 100644 --- a/spec/consensus/consensus.md +++ b/spec/consensus/consensus.md @@ -4,6 +4,10 @@ order: 2 # Tenderdash Consensus Protocol +For the proposed parameter authentication change, see the +[Full Consensus Parameter Commitment draft](consensus-params-commitment.md). +It defines a future schema and activation plan; current runtime behavior is unchanged. + This document and its companions specify the Tenderdash consensus protocol **as implemented** in `internal/consensus` and the packages it depends on. Every non-trivial rule cites the function that implements it. Where the diff --git a/spec/core/data_structures.md b/spec/core/data_structures.md index 3a996016d..c788e218a 100644 --- a/spec/core/data_structures.md +++ b/spec/core/data_structures.md @@ -389,9 +389,12 @@ parameter is absent from a particular header-hash subset. | Name | Type | Description | Field Number | |-------------|--------|-------------------------------|--------------| -| app_version | uint64 | The ABCI application version. | 1 | | consensus_version | `ConsensusVersion` | Version of the consensus protocol, selecting the [proposer strategy](../consensus/proposer-selection.md). | 2 | +Field 1 (`app_version`) is reserved. The application version is not a consensus +parameter; see +[application version](../consensus/consensus-params-commitment.md#application-version-is-not-a-consensus-parameter). + ### SynchronyParams | Name | Type | Description | Field Number | diff --git a/spec/core/genesis.md b/spec/core/genesis.md index 250f608d8..1136679b9 100644 --- a/spec/core/genesis.md +++ b/spec/core/genesis.md @@ -18,7 +18,7 @@ The genesis file is the starting point of a chain. An application will populate - `validator` - `pub_key_types`: Lists the validator consensus key types allowed by the chain. Recognized values are `ed25519`, `secp256k1`, and `bls12381`; the default allows only `bls12381` (BLS12-381). - `version` - - `app_version`: The version of the application. This is set by the application and is used to identify which version of the app a user should be using in order to operate a node. + - `consensus`: The consensus protocol version (`VersionParams.consensus_version`). Consensus parameters carry no application version; a legacy `app_version` key still loads but is ignored. - `synchrony` - `message_delay`: A bound on how long a proposal message may take to reach all validators on a network and still be considered valid. - `precision`: A bound on how skewed the proposer's clock may be from any validator on the network while still producing valid proposals. diff --git a/test/e2e/app/app.go b/test/e2e/app/app.go index 25d03f704..c05719f5e 100644 --- a/test/e2e/app/app.go +++ b/test/e2e/app/app.go @@ -72,7 +72,6 @@ func NewApplication(cfg kvstore.Config, opts ...kvstore.OptFunc) (*Application, params := types1.ConsensusParams{ Version: &types1.VersionParams{ ConsensusVersion: types1.VersionParams_ConsensusVersion(ver), - AppVersion: kvstore.ProtocolVersion, }, } app.AddConsensusParamsUpdate(params, int64(height)) diff --git a/types/genesis_test.go b/types/genesis_test.go index ff690af64..b55fc55a2 100644 --- a/types/genesis_test.go +++ b/types/genesis_test.go @@ -336,6 +336,30 @@ func TestGenesisDocFromJSON_OnlyRemovedTimeoutKeys(t *testing.T) { assert.EqualValues(t, 100, genDoc.ConsensusParams.Block.MaxBytes) } +// A genesis written while consensus parameters carried an application version +// must still load. The key is ignored on decoding and not written back. +func TestGenesisDocFromJSON_IgnoresRemovedAppVersion(t *testing.T) { + genDocBytes := []byte(`{ + "chain_id": "test-chain-removed-app-version", + "validator_quorum_type": 100, + "consensus_params": { + "version": {"app_version": "5", "consensus": "1"}, + "synchrony": {"precision": "1", "message_delay": "10"}, + "validator": {"pub_key_types":["ed25519"]}, + "block": {"max_bytes": "100"}, + "evidence": {"max_age_num_blocks": "100", "max_age_duration": "10"} + } + }`) + + genDoc, err := GenesisDocFromJSON(genDocBytes) + require.NoError(t, err) + assert.EqualValues(t, 1, genDoc.ConsensusParams.Version.ConsensusVersion) + + encoded, err := json.Marshal(genDoc.ConsensusParams) + require.NoError(t, err) + assert.NotContains(t, string(encoded), "app_version") +} + func TestGenesisSaveAs(t *testing.T) { tmpfile, err := os.CreateTemp(t.TempDir(), "genesis") require.NoError(t, err) diff --git a/types/params.go b/types/params.go index 4b411be6a..118623b43 100644 --- a/types/params.go +++ b/types/params.go @@ -73,8 +73,7 @@ type ValidatorParams struct { } type VersionParams struct { - AppVersion uint64 `json:"app_version,string"` - ConsensusVersion int32 `json:"consensus,string"` + ConsensusVersion int32 `json:"consensus,string"` } // SynchronyParams influence the validity of block timestamps. @@ -143,7 +142,6 @@ func DefaultValidatorParams() ValidatorParams { func DefaultVersionParams() VersionParams { return VersionParams{ - AppVersion: 0, ConsensusVersion: 0, } } @@ -420,7 +418,6 @@ func (params ConsensusParams) UpdateConsensusParams(params2 *tmproto.ConsensusPa res.Validator = ValidatorParamsFromProto(params2.Validator) } if params2.Version != nil { - res.Version.AppVersion = params2.Version.AppVersion res.Version.ConsensusVersion = int32(params2.Version.ConsensusVersion) } if params2.Synchrony != nil { @@ -464,7 +461,6 @@ func (params *ConsensusParams) ToProto() tmproto.ConsensusParams { }, Validator: params.Validator.ToProto(), Version: &tmproto.VersionParams{ - AppVersion: params.Version.AppVersion, ConsensusVersion: tmproto.VersionParams_ConsensusVersion(params.Version.ConsensusVersion), }, Synchrony: &tmproto.SynchronyParams{ @@ -515,7 +511,6 @@ func ConsensusParamsFromProto(pbParams tmproto.ConsensusParams) ConsensusParams if pbParams.Version != nil { c.Version = VersionParams{ - AppVersion: pbParams.Version.AppVersion, ConsensusVersion: int32(pbParams.Version.ConsensusVersion), } } diff --git a/types/params_test.go b/types/params_test.go index 781e9d7c6..c86674018 100644 --- a/types/params_test.go +++ b/types/params_test.go @@ -7,6 +7,7 @@ import ( "time" "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" tmproto "github.com/dashpay/tenderdash/proto/tendermint/types" ) @@ -238,7 +239,6 @@ func makeParams(args makeParamsArgs) ConsensusParams { if args.consensusVersion != 0 { cp.Version = VersionParams{ - AppVersion: 1, ConsensusVersion: args.consensusVersion, } } @@ -369,7 +369,6 @@ func TestConsensusParamsUpdate(t *testing.T) { initialParams: makeParams(makeParamsArgs{blockBytes: 100, blockGas: 200, evidenceAge: 300}), updates: &tmproto.ConsensusParams{ Version: &tmproto.VersionParams{ - AppVersion: 1, ConsensusVersion: 1, }, }, @@ -387,15 +386,33 @@ func TestConsensusParamsUpdate(t *testing.T) { } } +// Consensus parameters encoded while VersionParams carried app_version (field 1), +// in stored state or ABCI messages, must still decode; the field is dropped. +func TestConsensusParamsDecodeIgnoresRemovedAppVersion(t *testing.T) { + // ConsensusParams{version (4): VersionParams{app_version (1): 5, consensus_version (2): 1}} + legacy := []byte{0x22, 0x04, 0x08, 0x05, 0x10, 0x01} + + var pb tmproto.ConsensusParams + require.NoError(t, pb.Unmarshal(legacy)) + require.NotNil(t, pb.Version) + assert.Equal(t, tmproto.VersionParams_CONSENSUS_VERSION_1, pb.Version.ConsensusVersion) + + reencoded, err := pb.Marshal() + require.NoError(t, err) + assert.Equal(t, []byte{0x22, 0x02, 0x10, 0x01}, reencoded, "field 1 must not survive re-encoding") + + params := ConsensusParamsFromProto(pb) + assert.EqualValues(t, 1, params.Version.ConsensusVersion) +} + func TestConsensusParamsUpdate_Version(t *testing.T) { params := makeParams(makeParamsArgs{blockBytes: 1, blockGas: 2, evidenceAge: 3}) - assert.EqualValues(t, 0, params.Version.AppVersion) + assert.EqualValues(t, 0, params.Version.ConsensusVersion) updated := params.UpdateConsensusParams( - &tmproto.ConsensusParams{Version: &tmproto.VersionParams{AppVersion: 1, ConsensusVersion: 1}}) + &tmproto.ConsensusParams{Version: &tmproto.VersionParams{ConsensusVersion: 1}}) - assert.EqualValues(t, 1, updated.Version.AppVersion) assert.EqualValues(t, 1, updated.Version.ConsensusVersion) }