From dbf7d953f2354f6d87103f566de06eacb1a30d35 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Tue, 11 Feb 2025 17:46:09 +0100 Subject: [PATCH 01/17] chore: add validator params to validatorSet --- internal/consensus/replay_test.go | 1 + internal/consensus/replayer.go | 14 +- .../selectproposer/height_proposer_test.go | 2 +- internal/evidence/pool_test.go | 4 +- internal/evidence/reactor_test.go | 5 +- internal/evidence/verify_test.go | 2 +- internal/state/current_round_state.go | 4 +- internal/state/state.go | 9 +- internal/state/state_test.go | 6 +- internal/test/factory/validator_set.go | 2 +- light/helpers_test.go | 1 + light/provider/http/http.go | 2 +- proto/tendermint/types/params.pb.go | 228 ++++++++++++++---- proto/tendermint/types/params.proto | 12 + rpc/client/evidence_test.go | 2 +- test/e2e/runner/evidence.go | 2 +- test/e2e/tests/validator_test.go | 4 +- types/evidence.go | 6 +- types/evidence_test.go | 3 +- types/generator.go | 2 +- types/params.go | 43 +++- types/params_test.go | 3 +- types/protobuf.go | 9 +- types/protobuf_test.go | 2 +- types/validation_test.go | 2 +- types/validator_set.go | 34 ++- types/validator_set_test.go | 18 +- types/vote_set_test.go | 2 +- 28 files changed, 331 insertions(+), 93 deletions(-) diff --git a/internal/consensus/replay_test.go b/internal/consensus/replay_test.go index 4f12f9d8ca..eba868d17e 100644 --- a/internal/consensus/replay_test.go +++ b/internal/consensus/replay_test.go @@ -1282,6 +1282,7 @@ func TestHandshakeUpdatesValidators(t *testing.T) { btcjson.LLMQType_5_60, randQuorumHash, true, + nil, ) abciValidatorSetUpdates := types.TM2PB.ValidatorUpdates(vals) app := &initChainApp{vals: &abciValidatorSetUpdates} diff --git a/internal/consensus/replayer.go b/internal/consensus/replayer.go index d950de4b2c..4fd5e86459 100644 --- a/internal/consensus/replayer.go +++ b/internal/consensus/replayer.go @@ -344,7 +344,12 @@ func (r *BlockReplayer) execInitChain(ctx context.Context, rs *replayState, stat if len(res.ValidatorSetUpdate.ValidatorUpdates) != 0 { // we replace existing validator with the one from InitChain instead of applying it as a diff - state.Validators = types.NewValidatorSet(nil, nil, quorumType, nil, false) + var valParams *types.ValidatorParams + if res.ConsensusParams != nil && res.ConsensusParams.Validator != nil { + params := types.ValidatorParamsFromProto(res.ConsensusParams.Validator) + valParams = ¶ms + } + state.Validators = types.NewValidatorSet(nil, nil, quorumType, nil, false, valParams) } // we only update state when we are in initial state @@ -401,11 +406,18 @@ func validatorSetUpdateFromGenesis(genDoc *types.GenesisDoc) (*abci.ValidatorSet return nil, fmt.Errorf("blockReplayer blocks error when validating validator: %s", err) } } + + var validatorParams types.ValidatorParams + if genDoc.ConsensusParams != nil { + validatorParams = genDoc.ConsensusParams.Validator + } + validatorSet := types.NewValidatorSetCheckPublicKeys( validators, genDoc.ThresholdPublicKey, genDoc.QuorumType, genDoc.QuorumHash, + &validatorParams, ) err := validatorSet.ValidateBasic() if err != nil { diff --git a/internal/consensus/versioned/selectproposer/height_proposer_test.go b/internal/consensus/versioned/selectproposer/height_proposer_test.go index 9e370078e4..248b651da2 100644 --- a/internal/consensus/versioned/selectproposer/height_proposer_test.go +++ b/internal/consensus/versioned/selectproposer/height_proposer_test.go @@ -28,7 +28,7 @@ func TestProposerSelection1(t *testing.T) { types.NewTestValidatorGeneratedFromProTxHash(fooProTxHash), types.NewTestValidatorGeneratedFromProTxHash(barProTxHash), types.NewTestValidatorGeneratedFromProTxHash(bazProTxHash), - }, bls12381.GenPrivKey().PubKey(), btcjson.LLMQType_5_60, crypto.RandQuorumHash(), true) + }, bls12381.GenPrivKey().PubKey(), btcjson.LLMQType_5_60, crypto.RandQuorumHash(), true, nil) var proposers []string vs, err := selectproposer.NewProposerSelector(types.ConsensusParams{}, vset, 0, 0, nil, log.NewTestingLogger(t)) diff --git a/internal/evidence/pool_test.go b/internal/evidence/pool_test.go index 34b7aed6df..92b08ade46 100644 --- a/internal/evidence/pool_test.go +++ b/internal/evidence/pool_test.go @@ -130,7 +130,7 @@ func TestAddExpiredEvidence(t *testing.T) { quorumHash = crypto.RandQuorumHash() privval = types.NewMockPVForQuorum(quorumHash) val = privval.ExtractIntoValidator(ctx, quorumHash) - valSet = types.NewValidatorSet([]*types.Validator{val}, val.PubKey, btcjson.LLMQType_5_60, quorumHash, true) + valSet = types.NewValidatorSet([]*types.Validator{val}, val.PubKey, btcjson.LLMQType_5_60, quorumHash, true, nil) height = int64(30) stateStore = initializeValidatorState(ctx, t, privval, height, btcjson.LLMQType_5_60, quorumHash) evidenceDB = dbm.NewMemDB() @@ -221,7 +221,7 @@ func TestReportConflictingVotes(t *testing.T) { state.LastBlockHeight++ state.LastBlockTime = ev.Time() state.LastValidators = types.NewValidatorSet([]*types.Validator{val}, val.PubKey, btcjson.LLMQType_5_60, - quorumHash, true) + quorumHash, true, nil) pool.Update(ctx, state, []types.Evidence{}) // should be able to retrieve evidence from pool diff --git a/internal/evidence/reactor_test.go b/internal/evidence/reactor_test.go index cec9c185ae..088232cec3 100644 --- a/internal/evidence/reactor_test.go +++ b/internal/evidence/reactor_test.go @@ -99,14 +99,14 @@ func setup(ctx context.Context, t *testing.T, stateStores []sm.Store) *reactorTe rts.network.Nodes[nodeID].PeerManager.Register(ctx, pu) rts.nodes = append(rts.nodes, rts.network.Nodes[nodeID]) - chCreator := func(ctx context.Context, chdesc *p2p.ChannelDescriptor) (p2p.Channel, error) { + chCreator := func(_ctx context.Context, chdesc *p2p.ChannelDescriptor) (p2p.Channel, error) { return rts.evidenceChannels[nodeID], nil } rts.reactors[nodeID] = evidence.NewReactor( logger, chCreator, - func(ctx context.Context, _ string) *p2p.PeerUpdates { return pu }, + func(_ctx context.Context, _ string) *p2p.PeerUpdates { return pu }, rts.pools[nodeID]) require.NoError(t, rts.reactors[nodeID].Start(ctx)) @@ -550,6 +550,7 @@ func TestEvidenceListSerialization(t *testing.T) { btcjson.LLMQType_5_60, crypto.RandQuorumHash(), true, + nil, ) dupl, err := types.NewDuplicateVoteEvidence( diff --git a/internal/evidence/verify_test.go b/internal/evidence/verify_test.go index fde060ad30..df06a8f957 100644 --- a/internal/evidence/verify_test.go +++ b/internal/evidence/verify_test.go @@ -39,7 +39,7 @@ func TestVerifyDuplicateVoteEvidence(t *testing.T) { val := types.NewMockPVForQuorum(quorumHash) val2 := types.NewMockPVForQuorum(quorumHash) validator1 := val.ExtractIntoValidator(context.Background(), quorumHash) - valSet := types.NewValidatorSet([]*types.Validator{validator1}, validator1.PubKey, quorumType, quorumHash, true) + valSet := types.NewValidatorSet([]*types.Validator{validator1}, validator1.PubKey, quorumType, quorumHash, true, nil) stateID := types.RandStateID() blockID := makeBlockID([]byte("blockhash"), 1000, []byte("partshash"), stateID) blockID2 := makeBlockID([]byte("blockhash2"), 1000, []byte("partshash"), stateID) diff --git a/internal/state/current_round_state.go b/internal/state/current_round_state.go index a6848ccea5..3842de27a2 100644 --- a/internal/state/current_round_state.go +++ b/internal/state/current_round_state.go @@ -329,7 +329,7 @@ func valsetUpdate( } else { // if we don't have proTxHash, NewValidatorSetWithLocalNodeProTxHash behaves like NewValidatorSet nValSet = types.NewValidatorSetCheckPublicKeys(validatorUpdates, thresholdPubKey, - currentVals.QuorumType, quorumHash) + currentVals.QuorumType, quorumHash, ¶ms) } } else { // validators not changed, but we might have a new quorum hash or threshold public key @@ -342,5 +342,5 @@ func valsetUpdate( } } - return nValSet, nil + return nValSet, nValSet.ValidateBasic() } diff --git a/internal/state/state.go b/internal/state/state.go index cbffe452e3..d18b02555f 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -382,8 +382,13 @@ func MakeGenesisState(genDoc *types.GenesisDoc) (State, error) { } var validatorSet *types.ValidatorSet + var valParams *types.ValidatorParams + if genDoc.ConsensusParams != nil { + valParams = &genDoc.ConsensusParams.Validator + } + if len(genDoc.Validators) == 0 { - validatorSet = types.NewValidatorSet(nil, nil, genDoc.QuorumType, nil, false) + validatorSet = types.NewValidatorSet(nil, nil, genDoc.QuorumType, nil, false, valParams) } else { validators := make([]*types.Validator, len(genDoc.Validators)) hasAllPublicKeys := true @@ -394,7 +399,7 @@ func MakeGenesisState(genDoc *types.GenesisDoc) (State, error) { } } validatorSet = types.NewValidatorSet( - validators, genDoc.ThresholdPublicKey, genDoc.QuorumType, genDoc.QuorumHash, hasAllPublicKeys, + validators, genDoc.ThresholdPublicKey, genDoc.QuorumType, genDoc.QuorumHash, hasAllPublicKeys, valParams, ) } diff --git a/internal/state/state_test.go b/internal/state/state_test.go index 6d297bec02..31d95ca935 100644 --- a/internal/state/state_test.go +++ b/internal/state/state_test.go @@ -354,12 +354,14 @@ func TestEmptyValidatorUpdates(t *testing.T) { tearDown, _, state := setupTestCase(t) defer tearDown(t) + originalValidatorSet, _ := types.RandValidatorSet(2) + state.Validators = originalValidatorSet + firstNode := state.Validators.GetByIndex(0) require.NotZero(t, firstNode.ProTxHash) ctx := dash.ContextWithProTxHash(context.Background(), firstNode.ProTxHash) - newPrivKey := bls12381.GenPrivKeyFromSecret([]byte("test")) - newPubKey := newPrivKey.PubKey() + newPubKey := originalValidatorSet.ThresholdPublicKey newQuorumHash := crypto.RandQuorumHash() expectValidators := types.ValidatorListString(state.Validators.Validators) diff --git a/internal/test/factory/validator_set.go b/internal/test/factory/validator_set.go index 45ccddcd63..624c2f5fc5 100644 --- a/internal/test/factory/validator_set.go +++ b/internal/test/factory/validator_set.go @@ -44,5 +44,5 @@ func MockValidatorSet() (*types.ValidatorSet, []types.PrivValidator) { false, ) } - return types.NewValidatorSet(valz, thPubKey, btcjson.LLMQType_5_60, quorumHash, true), privVals + return types.NewValidatorSet(valz, thPubKey, btcjson.LLMQType_5_60, quorumHash, true, nil), privVals } diff --git a/light/helpers_test.go b/light/helpers_test.go index 9ff02e0ca0..d9c0766fb3 100644 --- a/light/helpers_test.go +++ b/light/helpers_test.go @@ -51,6 +51,7 @@ func (pkz privKeys) ToValidators(thresholdPublicKey crypto.PubKey) *types.Valida btcjson.LLMQType_5_60, crypto.Checksum(thresholdPublicKey.Bytes()), true, + nil, ) } diff --git a/light/provider/http/http.go b/light/provider/http/http.go index 73451e6b44..2fdc7550b5 100644 --- a/light/provider/http/http.go +++ b/light/provider/http/http.go @@ -238,7 +238,7 @@ func (p *http) validatorSet(ctx context.Context, height *int64, proposer types.P break } } - valSet := types.NewValidatorSet(vals, thresholdPubKey, quorumType, quorumHash, false) + valSet := types.NewValidatorSet(vals, thresholdPubKey, quorumType, quorumHash, false, nil) if valSet == nil || valSet.IsNilOrEmpty() { return nil, provider.ErrBadLightBlock{Reason: fmt.Errorf("retrieved nil or empty validator set")} diff --git a/proto/tendermint/types/params.pb.go b/proto/tendermint/types/params.pb.go index 9f0460c1ac..65f6201450 100644 --- a/proto/tendermint/types/params.pb.go +++ b/proto/tendermint/types/params.pb.go @@ -284,6 +284,9 @@ func (m *EvidenceParams) GetMaxBytes() int64 { // NOTE: uses ABCI pubkey naming, not Amino names. type ValidatorParams struct { PubKeyTypes []string `protobuf:"bytes,1,rep,name=pub_key_types,json=pubKeyTypes,proto3" json:"pub_key_types,omitempty"` + // Types that are valid to be assigned to XVotingPowerThreshold: + // *ValidatorParams_VotingPowerThreshold + XVotingPowerThreshold isValidatorParams_XVotingPowerThreshold `protobuf_oneof:"_voting_power_threshold"` } func (m *ValidatorParams) Reset() { *m = ValidatorParams{} } @@ -319,6 +322,26 @@ func (m *ValidatorParams) XXX_DiscardUnknown() { var xxx_messageInfo_ValidatorParams proto.InternalMessageInfo +type isValidatorParams_XVotingPowerThreshold interface { + isValidatorParams_XVotingPowerThreshold() + Equal(interface{}) bool + MarshalTo([]byte) (int, error) + Size() int +} + +type ValidatorParams_VotingPowerThreshold struct { + VotingPowerThreshold uint64 `protobuf:"varint,2,opt,name=voting_power_threshold,json=votingPowerThreshold,proto3,oneof" json:"voting_power_threshold,omitempty"` +} + +func (*ValidatorParams_VotingPowerThreshold) isValidatorParams_XVotingPowerThreshold() {} + +func (m *ValidatorParams) GetXVotingPowerThreshold() isValidatorParams_XVotingPowerThreshold { + if m != nil { + return m.XVotingPowerThreshold + } + return nil +} + func (m *ValidatorParams) GetPubKeyTypes() []string { if m != nil { return m.PubKeyTypes @@ -326,6 +349,20 @@ func (m *ValidatorParams) GetPubKeyTypes() []string { return nil } +func (m *ValidatorParams) GetVotingPowerThreshold() uint64 { + if x, ok := m.GetXVotingPowerThreshold().(*ValidatorParams_VotingPowerThreshold); ok { + return x.VotingPowerThreshold + } + return 0 +} + +// XXX_OneofWrappers is for the internal use of the proto package. +func (*ValidatorParams) XXX_OneofWrappers() []interface{} { + return []interface{}{ + (*ValidatorParams_VotingPowerThreshold)(nil), + } +} + // VersionParams contains the ABCI application version. type VersionParams struct { AppVersion uint64 `protobuf:"varint,1,opt,name=app_version,json=appVersion,proto3" json:"app_version,omitempty"` @@ -659,57 +696,60 @@ func init() { func init() { proto.RegisterFile("tendermint/types/params.proto", fileDescriptor_e12598271a686f57) } var fileDescriptor_e12598271a686f57 = []byte{ - // 801 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x55, 0x4f, 0x8f, 0xdb, 0x44, - 0x14, 0x8f, 0x1b, 0x6f, 0x36, 0x79, 0xd9, 0x6c, 0xcc, 0x00, 0xaa, 0x29, 0xac, 0xb3, 0xf8, 0x80, - 0x2a, 0x55, 0xb2, 0x97, 0x2e, 0x1c, 0x90, 0xf8, 0xa3, 0x26, 0x59, 0x95, 0x16, 0x35, 0x45, 0xce, - 0xd2, 0x03, 0x12, 0xb2, 0xc6, 0xce, 0xe0, 0x58, 0x1b, 0x7b, 0x2c, 0x8f, 0x1d, 0xc5, 0x9f, 0x80, - 0x2b, 0x27, 0xc4, 0x47, 0x80, 0x0b, 0xe2, 0x63, 0xf4, 0xd8, 0x0b, 0x12, 0x27, 0x40, 0xd9, 0x2f, - 0x82, 0x66, 0x3c, 0x4e, 0x48, 0x36, 0x65, 0x73, 0xb2, 0xe7, 0xbd, 0xdf, 0x6f, 0x7e, 0x7e, 0xf3, - 0x7e, 0x6f, 0x0c, 0x27, 0x19, 0x89, 0x27, 0x24, 0x8d, 0xc2, 0x38, 0xb3, 0xb3, 0x22, 0x21, 0xcc, - 0x4e, 0x70, 0x8a, 0x23, 0x66, 0x25, 0x29, 0xcd, 0x28, 0xd2, 0xd6, 0x69, 0x4b, 0xa4, 0xef, 0xbd, - 0x15, 0xd0, 0x80, 0x8a, 0xa4, 0xcd, 0xdf, 0x4a, 0xdc, 0x3d, 0x23, 0xa0, 0x34, 0x98, 0x11, 0x5b, - 0xac, 0xbc, 0xfc, 0x7b, 0x7b, 0x92, 0xa7, 0x38, 0x0b, 0x69, 0x5c, 0xe6, 0xcd, 0xdf, 0xea, 0xd0, - 0x1d, 0xd0, 0x98, 0x91, 0x98, 0xe5, 0xec, 0x6b, 0xa1, 0x80, 0xce, 0xe1, 0xc0, 0x9b, 0x51, 0xff, - 0x4a, 0x57, 0x4e, 0x95, 0xfb, 0xed, 0x87, 0x27, 0xd6, 0xb6, 0x96, 0xd5, 0xe7, 0xe9, 0x12, 0xed, - 0x94, 0x58, 0xf4, 0x29, 0x34, 0xc9, 0x3c, 0x9c, 0x90, 0xd8, 0x27, 0xfa, 0x1d, 0xc1, 0x3b, 0xbd, - 0xc9, 0xbb, 0x90, 0x08, 0x49, 0x5d, 0x31, 0xd0, 0x17, 0xd0, 0x9a, 0xe3, 0x59, 0x38, 0xc1, 0x19, - 0x4d, 0xf5, 0xba, 0xa0, 0xbf, 0x7f, 0x93, 0xfe, 0xa2, 0x82, 0x48, 0xfe, 0x9a, 0x83, 0x3e, 0x81, - 0xc3, 0x39, 0x49, 0x59, 0x48, 0x63, 0x5d, 0x15, 0xf4, 0xde, 0x0e, 0x7a, 0x09, 0x90, 0xe4, 0x0a, - 0xcf, 0xb5, 0x59, 0x11, 0xfb, 0xd3, 0x94, 0xc6, 0x85, 0x7e, 0xf0, 0x3a, 0xed, 0x71, 0x05, 0xa9, - 0xb4, 0x57, 0x1c, 0xae, 0x9d, 0x85, 0x11, 0xa1, 0x79, 0xa6, 0x37, 0x5e, 0xa7, 0x7d, 0x59, 0x02, - 0x2a, 0x6d, 0x89, 0x47, 0x67, 0xa0, 0x62, 0xcf, 0x0f, 0xf5, 0x43, 0xc1, 0x7b, 0xef, 0x26, 0xef, - 0x51, 0x7f, 0xf0, 0x44, 0x92, 0x04, 0xd2, 0x1c, 0x40, 0xfb, 0x3f, 0xa7, 0x8f, 0xde, 0x85, 0x56, - 0x84, 0x17, 0xae, 0x57, 0x64, 0x84, 0x89, 0x7e, 0xd5, 0x9d, 0x66, 0x84, 0x17, 0x7d, 0xbe, 0x46, - 0x77, 0xe1, 0x90, 0x27, 0x03, 0xcc, 0x44, 0x4b, 0xea, 0x4e, 0x23, 0xc2, 0x8b, 0xc7, 0x98, 0x99, - 0xbf, 0x2a, 0x70, 0xbc, 0xd9, 0x0b, 0xf4, 0x00, 0x10, 0xc7, 0xe2, 0x80, 0xb8, 0x71, 0x1e, 0xb9, - 0xa2, 0xa9, 0xd5, 0x8e, 0xdd, 0x08, 0x2f, 0x1e, 0x05, 0x64, 0x94, 0x47, 0x42, 0x9a, 0xa1, 0x67, - 0xa0, 0x55, 0xe0, 0xca, 0x4f, 0xb2, 0xe9, 0xef, 0x58, 0xa5, 0xe1, 0xac, 0xca, 0x70, 0xd6, 0x50, - 0x02, 0xfa, 0xcd, 0x97, 0x7f, 0xf5, 0x6a, 0x3f, 0xff, 0xdd, 0x53, 0x9c, 0xe3, 0x72, 0xbf, 0x2a, - 0xb3, 0x59, 0x44, 0x7d, 0xb3, 0x08, 0xf3, 0x63, 0xe8, 0x6e, 0xf5, 0x1d, 0x99, 0xd0, 0x49, 0x72, - 0xcf, 0xbd, 0x22, 0x85, 0x2b, 0x4e, 0x49, 0x57, 0x4e, 0xeb, 0xf7, 0x5b, 0x4e, 0x3b, 0xc9, 0xbd, - 0xaf, 0x48, 0x71, 0xc9, 0x43, 0xe6, 0x1f, 0x0a, 0x74, 0x36, 0x1a, 0x8e, 0x7a, 0xd0, 0xc6, 0x49, - 0xe2, 0x56, 0x36, 0xe1, 0xa5, 0xa9, 0x0e, 0xe0, 0x24, 0x91, 0x30, 0xf4, 0x1d, 0xbc, 0xe1, 0x57, - 0xa3, 0xb0, 0x82, 0xf1, 0xb2, 0x8e, 0x1f, 0x9e, 0xdd, 0xe2, 0x26, 0x6b, 0x35, 0x43, 0x32, 0xec, - 0x68, 0xfe, 0x56, 0xc4, 0x1c, 0x82, 0xb6, 0x8d, 0x42, 0x77, 0xe1, 0xcd, 0xc1, 0xf3, 0xd1, 0xf8, - 0x62, 0x34, 0xfe, 0x66, 0xec, 0xbe, 0xb8, 0x70, 0xc6, 0x4f, 0x9e, 0x8f, 0xdc, 0x33, 0xad, 0xb6, - 0x3b, 0xf1, 0xa1, 0xa6, 0x98, 0x3f, 0x28, 0x70, 0xf4, 0x25, 0x66, 0x53, 0x32, 0x91, 0x65, 0x7d, - 0x00, 0x5d, 0xd1, 0x2c, 0x77, 0xdb, 0x07, 0x1d, 0x11, 0x7e, 0x56, 0x99, 0xc1, 0x84, 0xce, 0x1a, - 0xb7, 0xb6, 0x44, 0xbb, 0x42, 0x3d, 0xc6, 0xdc, 0x04, 0x3b, 0x4e, 0x80, 0x37, 0xe4, 0x60, 0x47, - 0x3d, 0x3f, 0x29, 0xd0, 0xdd, 0x9a, 0x0a, 0x34, 0x84, 0x4e, 0x44, 0x18, 0x13, 0xc6, 0x20, 0x33, - 0x5c, 0xc8, 0x2b, 0xe4, 0x7f, 0x5c, 0xa1, 0x0a, 0x47, 0x1c, 0x49, 0xd6, 0x90, 0x93, 0xd0, 0x67, - 0xd0, 0x4a, 0x52, 0xe2, 0x87, 0x6c, 0x2f, 0x5f, 0x95, 0x3b, 0xac, 0x19, 0xe6, 0xef, 0x77, 0xa0, - 0xb3, 0x31, 0x6f, 0x7c, 0x42, 0x93, 0x94, 0x26, 0x94, 0x91, 0x7d, 0x3f, 0xa8, 0xc2, 0xf3, 0x8a, - 0xe4, 0x2b, 0xaf, 0x28, 0xc3, 0xfb, 0x7e, 0xcf, 0x91, 0x64, 0x0d, 0x39, 0x09, 0x9d, 0x83, 0x3a, - 0xa7, 0x19, 0x91, 0x57, 0xdb, 0xad, 0x64, 0x01, 0x46, 0x9f, 0x03, 0xf0, 0xa7, 0xd4, 0x55, 0xf7, - 0x3c, 0x07, 0x4e, 0x11, 0xa2, 0x4f, 0xd5, 0xe6, 0x81, 0xd6, 0x78, 0xaa, 0x36, 0x1b, 0xda, 0xa1, - 0xd3, 0xf0, 0x69, 0x14, 0x85, 0x99, 0xf3, 0xb6, 0x57, 0x24, 0x98, 0x31, 0xb7, 0x5c, 0xba, 0xf2, - 0x1e, 0x32, 0x1f, 0x00, 0xac, 0x6f, 0x1a, 0x74, 0x02, 0x90, 0x12, 0x7f, 0x4a, 0xfc, 0x2b, 0x37, - 0x5b, 0x88, 0x13, 0x6b, 0x3a, 0x2d, 0x19, 0xb9, 0x5c, 0xf4, 0x9d, 0x5f, 0x96, 0x86, 0xf2, 0x72, - 0x69, 0x28, 0xaf, 0x96, 0x86, 0xf2, 0xcf, 0xd2, 0x50, 0x7e, 0xbc, 0x36, 0x6a, 0xaf, 0xae, 0x8d, - 0xda, 0x9f, 0xd7, 0x46, 0xed, 0xdb, 0x8f, 0x82, 0x30, 0x9b, 0xe6, 0x9e, 0xe5, 0xd3, 0xc8, 0x9e, - 0x60, 0x36, 0x4d, 0x70, 0x61, 0x97, 0xc3, 0xc3, 0x57, 0xe5, 0x8f, 0xc8, 0xde, 0xfe, 0xb9, 0x79, - 0x0d, 0x11, 0x3f, 0xff, 0x37, 0x00, 0x00, 0xff, 0xff, 0xe5, 0x7d, 0x36, 0x05, 0xf7, 0x06, 0x00, + // 849 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x8c, 0x95, 0x4d, 0x6f, 0x1b, 0x45, + 0x18, 0xc7, 0x3d, 0xf5, 0xc6, 0xb1, 0x1f, 0xc7, 0xb1, 0x19, 0x0a, 0x71, 0x0b, 0x71, 0xc2, 0x1e, + 0x50, 0xa5, 0x4a, 0xeb, 0xd0, 0x70, 0xa9, 0xc4, 0x8b, 0xea, 0x38, 0xea, 0x0b, 0x6a, 0x5a, 0xad, + 0x43, 0x0f, 0x48, 0x68, 0x35, 0xbb, 0x1e, 0xd6, 0xab, 0x78, 0x77, 0x56, 0x3b, 0xb3, 0xc6, 0xfb, + 0x09, 0x40, 0xe2, 0xc2, 0x09, 0xf1, 0x11, 0xe0, 0x82, 0xf8, 0x18, 0x3d, 0xf6, 0x82, 0xc4, 0x09, + 0x50, 0xf2, 0x45, 0xd0, 0xcc, 0xce, 0xc4, 0xd8, 0x71, 0x69, 0x4e, 0xf6, 0xcc, 0xf3, 0xff, 0xcd, + 0x33, 0x33, 0xcf, 0xff, 0x99, 0x85, 0x5d, 0x41, 0x93, 0x31, 0xcd, 0xe2, 0x28, 0x11, 0x7d, 0x51, + 0xa4, 0x94, 0xf7, 0x53, 0x92, 0x91, 0x98, 0x3b, 0x69, 0xc6, 0x04, 0xc3, 0x9d, 0x45, 0xd8, 0x51, + 0xe1, 0xdb, 0x37, 0x43, 0x16, 0x32, 0x15, 0xec, 0xcb, 0x7f, 0xa5, 0xee, 0x76, 0x2f, 0x64, 0x2c, + 0x9c, 0xd2, 0xbe, 0x1a, 0xf9, 0xf9, 0x37, 0xfd, 0x71, 0x9e, 0x11, 0x11, 0xb1, 0xa4, 0x8c, 0xdb, + 0xbf, 0x55, 0xa1, 0x7d, 0xc4, 0x12, 0x4e, 0x13, 0x9e, 0xf3, 0xe7, 0x2a, 0x03, 0x3e, 0x84, 0x0d, + 0x7f, 0xca, 0x82, 0xb3, 0x2e, 0xda, 0x47, 0x77, 0x9a, 0xf7, 0x76, 0x9d, 0xd5, 0x5c, 0xce, 0x40, + 0x86, 0x4b, 0xb5, 0x5b, 0x6a, 0xf1, 0x27, 0x50, 0xa7, 0xb3, 0x68, 0x4c, 0x93, 0x80, 0x76, 0x6f, + 0x28, 0x6e, 0xff, 0x2a, 0x77, 0xac, 0x15, 0x1a, 0xbd, 0x24, 0xf0, 0xe7, 0xd0, 0x98, 0x91, 0x69, + 0x34, 0x26, 0x82, 0x65, 0xdd, 0xaa, 0xc2, 0x3f, 0xb8, 0x8a, 0xbf, 0x30, 0x12, 0xcd, 0x2f, 0x18, + 0x7c, 0x1f, 0x36, 0x67, 0x34, 0xe3, 0x11, 0x4b, 0xba, 0x96, 0xc2, 0xf7, 0xd6, 0xe0, 0xa5, 0x40, + 0xc3, 0x46, 0x2f, 0x73, 0xf3, 0x22, 0x09, 0x26, 0x19, 0x4b, 0x8a, 0xee, 0xc6, 0xeb, 0x72, 0x8f, + 0x8c, 0xc4, 0xe4, 0xbe, 0x64, 0x64, 0x6e, 0x11, 0xc5, 0x94, 0xe5, 0xa2, 0x5b, 0x7b, 0x5d, 0xee, + 0xd3, 0x52, 0x60, 0x72, 0x6b, 0x3d, 0x3e, 0x00, 0x8b, 0xf8, 0x41, 0xd4, 0xdd, 0x54, 0xdc, 0xfb, + 0x57, 0xb9, 0x07, 0x83, 0xa3, 0xc7, 0x1a, 0x52, 0x4a, 0xfb, 0x08, 0x9a, 0xff, 0xb9, 0x7d, 0xfc, + 0x1e, 0x34, 0x62, 0x32, 0xf7, 0xfc, 0x42, 0x50, 0xae, 0xea, 0x55, 0x75, 0xeb, 0x31, 0x99, 0x0f, + 0xe4, 0x18, 0xef, 0xc0, 0xa6, 0x0c, 0x86, 0x84, 0xab, 0x92, 0x54, 0xdd, 0x5a, 0x4c, 0xe6, 0x0f, + 0x09, 0xb7, 0x7f, 0x45, 0xb0, 0xbd, 0x5c, 0x0b, 0x7c, 0x17, 0xb0, 0xd4, 0x92, 0x90, 0x7a, 0x49, + 0x1e, 0x7b, 0xaa, 0xa8, 0x66, 0xc5, 0x76, 0x4c, 0xe6, 0x0f, 0x42, 0x7a, 0x92, 0xc7, 0x2a, 0x35, + 0xc7, 0x4f, 0xa1, 0x63, 0xc4, 0xc6, 0x4f, 0xba, 0xe8, 0xb7, 0x9c, 0xd2, 0x70, 0x8e, 0x31, 0x9c, + 0x33, 0xd4, 0x82, 0x41, 0xfd, 0xe5, 0x5f, 0x7b, 0x95, 0x9f, 0xff, 0xde, 0x43, 0xee, 0x76, 0xb9, + 0x9e, 0x89, 0x2c, 0x1f, 0xa2, 0xba, 0x7c, 0x08, 0xfb, 0x07, 0x04, 0xed, 0x95, 0xc2, 0x63, 0x1b, + 0x5a, 0x69, 0xee, 0x7b, 0x67, 0xb4, 0xf0, 0xd4, 0x35, 0x75, 0xd1, 0x7e, 0xf5, 0x4e, 0xc3, 0x6d, + 0xa6, 0xb9, 0xff, 0x05, 0x2d, 0x4e, 0xe5, 0x14, 0xbe, 0x0f, 0xef, 0xce, 0x98, 0x88, 0x92, 0xd0, + 0x4b, 0xd9, 0xb7, 0x34, 0xf3, 0xc4, 0x24, 0xa3, 0x7c, 0xc2, 0xa6, 0x63, 0xb5, 0x53, 0xeb, 0x51, + 0xc5, 0xbd, 0x59, 0xc6, 0x9f, 0xcb, 0xf0, 0xa9, 0x89, 0x7e, 0x8f, 0xd0, 0xe0, 0x16, 0xec, 0x78, + 0xeb, 0x59, 0xfb, 0x0f, 0x04, 0xad, 0x25, 0x1f, 0xe1, 0x3d, 0x68, 0x92, 0x34, 0xf5, 0x8c, 0xfb, + 0xe4, 0x8d, 0x59, 0x2e, 0x90, 0x34, 0xd5, 0x32, 0xfc, 0x35, 0xbc, 0x15, 0x98, 0x0e, 0xbb, 0x94, + 0xc9, 0x3d, 0x6c, 0xdf, 0x3b, 0x78, 0x83, 0x49, 0x9d, 0xcb, 0xd6, 0xd4, 0xd3, 0x6e, 0x27, 0x58, + 0x99, 0xb1, 0x87, 0xd0, 0x59, 0x55, 0xe1, 0x1d, 0x78, 0xfb, 0xe8, 0xd9, 0xc9, 0xe8, 0xf8, 0x64, + 0xf4, 0xe5, 0xc8, 0x7b, 0x71, 0xec, 0x8e, 0x1e, 0x3f, 0x3b, 0xf1, 0x0e, 0x3a, 0x95, 0xf5, 0x81, + 0x8f, 0x3a, 0xc8, 0xfe, 0x0e, 0xc1, 0xd6, 0x23, 0xc2, 0x27, 0x74, 0xac, 0x8f, 0xf5, 0x21, 0xb4, + 0x95, 0x07, 0xbc, 0x55, 0x7b, 0xb5, 0xd4, 0xf4, 0x53, 0xe3, 0x31, 0x1b, 0x5a, 0x0b, 0xdd, 0xc2, + 0x69, 0x4d, 0xa3, 0x7a, 0x48, 0xa4, 0xb7, 0xd6, 0xdc, 0x80, 0xac, 0xf3, 0xc6, 0x9a, 0xf3, 0xfc, + 0x84, 0xa0, 0xbd, 0xd2, 0x6c, 0x78, 0x08, 0xad, 0x98, 0x72, 0xae, 0xfc, 0x46, 0xa7, 0xa4, 0xd0, + 0x2f, 0xd3, 0xff, 0x98, 0xcd, 0x52, 0x46, 0xdb, 0xd2, 0xd4, 0x50, 0x42, 0xf8, 0x53, 0x68, 0xa4, + 0x19, 0x0d, 0x22, 0x7e, 0x2d, 0xbb, 0x96, 0x2b, 0x2c, 0x08, 0xfb, 0xf7, 0x1b, 0xd0, 0x5a, 0x6a, + 0x63, 0xd9, 0xf8, 0x69, 0xc6, 0x52, 0xc6, 0xe9, 0x75, 0x37, 0x64, 0xf4, 0xf2, 0x44, 0xfa, 0xaf, + 0x3c, 0x91, 0x20, 0xd7, 0xdd, 0xcf, 0x96, 0xa6, 0x86, 0x12, 0xc2, 0x87, 0x60, 0xcd, 0x98, 0xa0, + 0xfa, 0xc5, 0x7c, 0x23, 0xac, 0xc4, 0xf8, 0x33, 0x00, 0xf9, 0xab, 0xf3, 0x5a, 0xd7, 0xbc, 0x07, + 0x89, 0xa8, 0xa4, 0x4f, 0xac, 0xfa, 0x46, 0xa7, 0xf6, 0xc4, 0xaa, 0xd7, 0x3a, 0x9b, 0x6e, 0x2d, + 0x60, 0x71, 0x1c, 0x09, 0xf7, 0x1d, 0xbf, 0x48, 0x09, 0xe7, 0x5e, 0x39, 0xf4, 0xf4, 0xf3, 0x66, + 0xdf, 0x05, 0x58, 0x3c, 0x60, 0x78, 0x17, 0x20, 0xa3, 0xc1, 0x84, 0x06, 0x67, 0x9e, 0x98, 0xab, + 0x1b, 0xab, 0xbb, 0x0d, 0x3d, 0x73, 0x3a, 0x1f, 0xb8, 0xbf, 0x9c, 0xf7, 0xd0, 0xcb, 0xf3, 0x1e, + 0x7a, 0x75, 0xde, 0x43, 0xff, 0x9c, 0xf7, 0xd0, 0x8f, 0x17, 0xbd, 0xca, 0xab, 0x8b, 0x5e, 0xe5, + 0xcf, 0x8b, 0x5e, 0xe5, 0xab, 0x8f, 0xc3, 0x48, 0x4c, 0x72, 0xdf, 0x09, 0x58, 0xdc, 0x1f, 0x13, + 0x3e, 0x49, 0x49, 0xd1, 0x2f, 0x9b, 0x47, 0x8e, 0xca, 0xef, 0x5b, 0x7f, 0xf5, 0x9b, 0xe9, 0xd7, + 0xd4, 0xfc, 0xe1, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, 0xb2, 0xb1, 0x36, 0x07, 0x4e, 0x07, 0x00, 0x00, } @@ -839,6 +879,39 @@ func (this *ValidatorParams) Equal(that interface{}) bool { return false } } + if that1.XVotingPowerThreshold == nil { + if this.XVotingPowerThreshold != nil { + return false + } + } else if this.XVotingPowerThreshold == nil { + return false + } else if !this.XVotingPowerThreshold.Equal(that1.XVotingPowerThreshold) { + return false + } + return true +} +func (this *ValidatorParams_VotingPowerThreshold) Equal(that interface{}) bool { + if that == nil { + return this == nil + } + + that1, ok := that.(*ValidatorParams_VotingPowerThreshold) + if !ok { + that2, ok := that.(ValidatorParams_VotingPowerThreshold) + if ok { + that1 = &that2 + } else { + return false + } + } + if that1 == nil { + return this == nil + } else if this == nil { + return false + } + if this.VotingPowerThreshold != that1.VotingPowerThreshold { + return false + } return true } func (this *VersionParams) Equal(that interface{}) bool { @@ -1219,6 +1292,15 @@ func (m *ValidatorParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.XVotingPowerThreshold != nil { + { + size := m.XVotingPowerThreshold.Size() + i -= size + if _, err := m.XVotingPowerThreshold.MarshalTo(dAtA[i:]); err != nil { + return 0, err + } + } + } if len(m.PubKeyTypes) > 0 { for iNdEx := len(m.PubKeyTypes) - 1; iNdEx >= 0; iNdEx-- { i -= len(m.PubKeyTypes[iNdEx]) @@ -1231,6 +1313,18 @@ func (m *ValidatorParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { return len(dAtA) - i, nil } +func (m *ValidatorParams_VotingPowerThreshold) MarshalTo(dAtA []byte) (int, error) { + size := m.Size() + return m.MarshalToSizedBuffer(dAtA[:size]) +} + +func (m *ValidatorParams_VotingPowerThreshold) MarshalToSizedBuffer(dAtA []byte) (int, error) { + i := len(dAtA) + i = encodeVarintParams(dAtA, i, uint64(m.VotingPowerThreshold)) + i-- + dAtA[i] = 0x10 + return len(dAtA) - i, nil +} func (m *VersionParams) Marshal() (dAtA []byte, err error) { size := m.Size() dAtA = make([]byte, size) @@ -1533,9 +1627,21 @@ func (m *ValidatorParams) Size() (n int) { n += 1 + l + sovParams(uint64(l)) } } + if m.XVotingPowerThreshold != nil { + n += m.XVotingPowerThreshold.Size() + } return n } +func (m *ValidatorParams_VotingPowerThreshold) Size() (n int) { + if m == nil { + return 0 + } + var l int + _ = l + n += 1 + sovParams(uint64(m.VotingPowerThreshold)) + return n +} func (m *VersionParams) Size() (n int) { if m == nil { return 0 @@ -2201,6 +2307,26 @@ func (m *ValidatorParams) Unmarshal(dAtA []byte) error { } m.PubKeyTypes = append(m.PubKeyTypes, string(dAtA[iNdEx:postIndex])) iNdEx = postIndex + case 2: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPowerThreshold", 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.XVotingPowerThreshold = &ValidatorParams_VotingPowerThreshold{v} default: iNdEx = preIndex skippy, err := skipParams(dAtA[iNdEx:]) diff --git a/proto/tendermint/types/params.proto b/proto/tendermint/types/params.proto index 3c4a7feec0..5cc6ab2e6b 100644 --- a/proto/tendermint/types/params.proto +++ b/proto/tendermint/types/params.proto @@ -58,6 +58,18 @@ message EvidenceParams { // NOTE: uses ABCI pubkey naming, not Amino names. message ValidatorParams { repeated string pub_key_types = 1; + // Threshold defines the minimum voting power of validators that must vote for a proposal + // to be considered signed and added to the block. + // + // For Dash Platform, the voting power can be calculated by multiply of the number of validators + // and const `DefaultDashVotingPower == 100`. + // + // For validator sets containing more than 3 validators, the threshold MUST be + // greater than 2/3 of the total voting power of all validators. + // + // If set to 0 or absent, default value is determined based on LLMQ quorum type defined for the network, + // with a fall back to 2/3 + 1 of the total voting power. + optional uint64 voting_power_threshold = 2; } // VersionParams contains the ABCI application version. diff --git a/rpc/client/evidence_test.go b/rpc/client/evidence_test.go index 5789e6a648..f15430df66 100644 --- a/rpc/client/evidence_test.go +++ b/rpc/client/evidence_test.go @@ -39,7 +39,7 @@ func newEvidence(t *testing.T, val *privval.FilePV, require.NoError(t, err) validator := types.NewValidator(privKey.PubKey(), types.DefaultDashVotingPower, val.Key.ProTxHash, "") - valSet := types.NewValidatorSet([]*types.Validator{validator}, validator.PubKey, quorumType, quorumHash, true) + valSet := types.NewValidatorSet([]*types.Validator{validator}, validator.PubKey, quorumType, quorumHash, true, nil) ev, err := types.NewDuplicateVoteEvidence(vote, vote2, timestamp, valSet) require.NoError(t, err) diff --git a/test/e2e/runner/evidence.go b/test/e2e/runner/evidence.go index 0901990194..80d98ba351 100644 --- a/test/e2e/runner/evidence.go +++ b/test/e2e/runner/evidence.go @@ -71,7 +71,7 @@ func InjectEvidence(ctx context.Context, logger log.Logger, r *rand.Rand, testne valSet := types.NewValidatorSet(valRes.Validators, *valRes.ThresholdPublicKey, valRes.QuorumType, *valRes.QuorumHash, - false) + false, nil) if valSet == nil { return fmt.Errorf("could not create validator set from response") } diff --git a/test/e2e/tests/validator_test.go b/test/e2e/tests/validator_test.go index 837980060e..db46577af7 100644 --- a/test/e2e/tests/validator_test.go +++ b/test/e2e/tests/validator_test.go @@ -186,7 +186,7 @@ func newValidatorSchedule(testnet e2e.Testnet) *validatorSchedule { } } - vs := types.NewValidatorSet(makeVals(valMap), thresholdPublicKey, quorumType, quorumHash, true) + vs := types.NewValidatorSet(makeVals(valMap), thresholdPublicKey, quorumType, quorumHash, true, nil) ps, err := selectproposer.NewProposerSelector(*types.DefaultConsensusParams(), vs, testnet.InitialHeight, 0, nil, nil) if err != nil { panic(err) @@ -257,7 +257,7 @@ func (s *validatorSchedule) Increment(heights int64) error { } } else { vs := types.NewValidatorSet(makeVals(update), thresholdPublicKeyUpdate, btcjson.LLMQType_5_60, - quorumHashUpdate, true) + quorumHashUpdate, true, &cp.Validator) ps, err := selectproposer.NewProposerSelector(cp, vs, s.height, 0, nil, nil) if err != nil { diff --git a/types/evidence.go b/types/evidence.go index 86e3f08631..42d058de2a 100644 --- a/types/evidence.go +++ b/types/evidence.go @@ -7,6 +7,7 @@ import ( "errors" "fmt" "strings" + "testing" "time" "github.com/dashpay/dashd-go/btcjson" @@ -490,6 +491,9 @@ func NewMockDuplicateVoteEvidenceWithValidator( quorumType btcjson.LLMQType, quorumHash crypto.QuorumHash, ) (*DuplicateVoteEvidence, error) { + if !testing.Testing() { + panic("NewMockDuplicateVoteEvidenceWithValidator should only be used in tests") + } pubKey, err := pv.GetPubKey(ctx, quorumHash) if err != nil { panic(err) @@ -510,7 +514,7 @@ func NewMockDuplicateVoteEvidenceWithValidator( voteA, voteB, time, - NewValidatorSet([]*Validator{val}, val.PubKey, quorumType, quorumHash, true), + NewValidatorSet([]*Validator{val}, val.PubKey, quorumType, quorumHash, true, nil), ) } diff --git a/types/evidence_test.go b/types/evidence_test.go index 19df99c4fe..e7ed069c9d 100644 --- a/types/evidence_test.go +++ b/types/evidence_test.go @@ -165,7 +165,8 @@ func TestDuplicateVoteEvidenceValidation(t *testing.T) { thresholdPublicKey, err := val.GetThresholdPublicKey(context.Background(), quorumHash) assert.NoError(t, err) valSet := NewValidatorSet( - []*Validator{val.ExtractIntoValidator(context.Background(), quorumHash)}, thresholdPublicKey, quorumType, quorumHash, true) + []*Validator{val.ExtractIntoValidator(context.Background(), quorumHash)}, + thresholdPublicKey, quorumType, quorumHash, true, nil) ev, err := NewDuplicateVoteEvidence(vote1, vote2, defaultVoteTime, valSet) require.NoError(t, err) tc.malleateEvidence(ev) diff --git a/types/generator.go b/types/generator.go index 75c8f034f4..115d1cac02 100644 --- a/types/generator.go +++ b/types/generator.go @@ -83,7 +83,7 @@ func GenerateValidatorSet(valParams []ValSetParam, opts ...ValSetOptionFunc) (*V valz = append(valz, NewValidator(qks.PubKey, opt.VotingPower, proTxHash, "")) } sort.Sort(PrivValidatorsByProTxHash(privValidators)) - return NewValidatorSet(valz, ld.ThresholdPubKey, crypto.SmallQuorumType(), quorumHash, true), privValidators + return NewValidatorSet(valz, ld.ThresholdPubKey, crypto.SmallQuorumType(), quorumHash, true, nil), privValidators } // MakeGenesisValsFromValidatorSet converts ValidatorSet data into a list of GenesisValidator diff --git a/types/params.go b/types/params.go index fa7243825f..ce2065eab7 100644 --- a/types/params.go +++ b/types/params.go @@ -69,7 +69,8 @@ type EvidenceParams struct { // ValidatorParams restrict the public key types validators can use. // NOTE: uses ABCI pubkey naming, not Amino names. type ValidatorParams struct { - PubKeyTypes []string `json:"pub_key_types"` + PubKeyTypes []string `json:"pub_key_types"` + VotingPowerThreshold uint64 `json:"threshold"` } type VersionParams struct { @@ -141,7 +142,8 @@ func DefaultEvidenceParams() EvidenceParams { // only bls12381 pubkeys. func DefaultValidatorParams() ValidatorParams { return ValidatorParams{ - PubKeyTypes: []string{ABCIPubKeyTypeBLS12381}, + PubKeyTypes: []string{ABCIPubKeyTypeBLS12381}, + VotingPowerThreshold: 0, } } @@ -239,6 +241,33 @@ func (val *ValidatorParams) IsValidPubkeyType(pubkeyType string) bool { return false } +func ValidatorParamsFromProto(pbValParams *tmproto.ValidatorParams) ValidatorParams { + if pbValParams != nil { + return ValidatorParams{ + // Copy Validator.PubkeyTypes, and set result's value to the copy. + // This avoids having to initialize the slice to 0 values, and then write to it again. + PubKeyTypes: append([]string{}, pbValParams.PubKeyTypes...), + VotingPowerThreshold: pbValParams.GetVotingPowerThreshold(), + } + } + + return ValidatorParams{ + PubKeyTypes: []string{}, + VotingPowerThreshold: 0, + } +} + +// GetVotingPowerThreshold returns the voting power threshold for the validator set. +// For nil ValidatorParams, it returns 0. +// +// Value of 0 means that the threshold is not set. +func (val *ValidatorParams) GetVotingPowerThreshold() uint64 { + if val != nil { + return val.VotingPowerThreshold + } + return 0 +} + func (params *ConsensusParams) Complete() { if params.Synchrony == (SynchronyParams{}) { params.Synchrony = DefaultSynchronyParams() @@ -392,9 +421,7 @@ func (params ConsensusParams) UpdateConsensusParams(params2 *tmproto.ConsensusPa res.Evidence.MaxBytes = params2.Evidence.MaxBytes } if params2.Validator != nil { - // Copy params2.Validator.PubkeyTypes, and set result's value to the copy. - // This avoids having to initialize the slice to 0 values, and then write to it again. - res.Validator.PubKeyTypes = append([]string{}, params2.Validator.PubKeyTypes...) + res.Validator = ValidatorParamsFromProto(params2.Validator) } if params2.Version != nil { res.Version.AppVersion = params2.Version.AppVersion @@ -441,6 +468,9 @@ func (params *ConsensusParams) ToProto() tmproto.ConsensusParams { }, Validator: &tmproto.ValidatorParams{ PubKeyTypes: params.Validator.PubKeyTypes, + XVotingPowerThreshold: &tmproto.ValidatorParams_VotingPowerThreshold{ + VotingPowerThreshold: params.Validator.VotingPowerThreshold, + }, }, Version: &tmproto.VersionParams{ AppVersion: params.Version.AppVersion, @@ -483,7 +513,8 @@ func ConsensusParamsFromProto(pbParams tmproto.ConsensusParams) ConsensusParams if pbParams.Validator != nil { c.Validator = ValidatorParams{ - PubKeyTypes: pbParams.Validator.PubKeyTypes, + PubKeyTypes: pbParams.Validator.PubKeyTypes, + VotingPowerThreshold: pbParams.Validator.GetVotingPowerThreshold(), } } diff --git a/types/params_test.go b/types/params_test.go index ccd18e8e71..241181233b 100644 --- a/types/params_test.go +++ b/types/params_test.go @@ -218,7 +218,8 @@ func makeParams(args makeParamsArgs) ConsensusParams { MaxBytes: args.maxEvidenceBytes, }, Validator: ValidatorParams{ - PubKeyTypes: args.pubkeyTypes, + PubKeyTypes: args.pubkeyTypes, + VotingPowerThreshold: 0, }, Synchrony: SynchronyParams{ Precision: args.precision, diff --git a/types/protobuf.go b/types/protobuf.go index 671e21321c..979ac2fe46 100644 --- a/types/protobuf.go +++ b/types/protobuf.go @@ -2,6 +2,7 @@ package types import ( "fmt" + "testing" "github.com/dashpay/dashd-go/btcjson" @@ -159,10 +160,16 @@ func (pb2tm) ValidatorUpdatesFromValidatorSet(valSetUpdate *abci.ValidatorSetUpd return tmVals, pub, valSetUpdate.QuorumHash, nil } +// ValidatorSetFromProtoUpdate creates validator set from validator update. +// +// Only use in tests. func (pb2tm) ValidatorSetFromProtoUpdate( quorumType btcjson.LLMQType, valSetUpdate *abci.ValidatorSetUpdate, ) (*ValidatorSet, error) { + if !testing.Testing() { + panic("ValidatorSetFromProtoUpdate should only be used in tests") + } hasPublicKeys := true for i, v := range valSetUpdate.ValidatorUpdates { if v.PubKey == nil { @@ -183,7 +190,7 @@ func (pb2tm) ValidatorSetFromProtoUpdate( if err != nil { return nil, err } - return NewValidatorSet(tmVals, pub, quorumType, quorumHash, hasPublicKeys), nil + return NewValidatorSet(tmVals, pub, quorumType, quorumHash, hasPublicKeys, nil), nil } func (pb2tm) ThresholdPublicKeyUpdate(thresholdPublicKey crypto2.PublicKey) (crypto.PubKey, error) { diff --git a/types/protobuf_test.go b/types/protobuf_test.go index d1530e134b..4774d40eb8 100644 --- a/types/protobuf_test.go +++ b/types/protobuf_test.go @@ -43,7 +43,7 @@ func TestABCIValidators(t *testing.T) { assert.NoError(t, err) assert.Equal(t, tmValExpected, tmVals[0]) - abciVals := TM2PB.ValidatorUpdates(NewValidatorSet(tmVals, tmVal.PubKey, btcjson.LLMQType_5_60, quorumHash, true)) + abciVals := TM2PB.ValidatorUpdates(NewValidatorSet(tmVals, tmVal.PubKey, btcjson.LLMQType_5_60, quorumHash, true, nil)) assert.Equal(t, abci.ValidatorSetUpdate{ ValidatorUpdates: []abci.ValidatorUpdate{abciVal}, ThresholdPublicKey: *abciVal.PubKey, diff --git a/types/validation_test.go b/types/validation_test.go index f518d1f7ed..59568dafb0 100644 --- a/types/validation_test.go +++ b/types/validation_test.go @@ -23,7 +23,7 @@ func TestValidatorSet_VerifyCommit_All(t *testing.T) { pubKey = privKey.PubKey() v1 = NewValidatorDefaultVotingPower(pubKey, proTxHash) quorumHash = crypto.RandQuorumHash() - vset = NewValidatorSet([]*Validator{v1}, v1.PubKey, btcjson.LLMQType_5_60, quorumHash, true) + vset = NewValidatorSet([]*Validator{v1}, v1.PubKey, btcjson.LLMQType_5_60, quorumHash, true, nil) chainID = "Lalande21185" ) diff --git a/types/validator_set.go b/types/validator_set.go index 37aff76e32..2cdc0052cb 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -64,6 +64,7 @@ type ValidatorSet struct { ThresholdPublicKey crypto.PubKey `json:"threshold_public_key"` QuorumHash crypto.QuorumHash `json:"quorum_hash"` QuorumType btcjson.LLMQType `json:"quorum_type"` + Params ValidatorParams `json:"validator_consensus_params"` HasPublicKeys bool `json:"has_public_keys"` } @@ -78,12 +79,15 @@ type ValidatorSet struct { // MaxVotesCount - commits by a validator set larger than this will fail // validation. func NewValidatorSet(valz []*Validator, newThresholdPublicKey crypto.PubKey, quorumType btcjson.LLMQType, - quorumHash crypto.QuorumHash, hasPublicKeys bool) *ValidatorSet { + quorumHash crypto.QuorumHash, hasPublicKeys bool, validatorParams *ValidatorParams) *ValidatorSet { vals := &ValidatorSet{ QuorumHash: quorumHash, QuorumType: quorumType, HasPublicKeys: hasPublicKeys, } + if validatorParams != nil { + vals.Params = *validatorParams + } err := vals.updateWithChangeSet(valz, false, newThresholdPublicKey, quorumHash) if err != nil { panic(fmt.Sprintf("Cannot create validator set: %v", err)) @@ -99,6 +103,7 @@ func NewValidatorSetCheckPublicKeys( newThresholdPublicKey crypto.PubKey, quorumType btcjson.LLMQType, quorumHash crypto.QuorumHash, + params *ValidatorParams, ) *ValidatorSet { hasPublicKeys := true for _, val := range valz { @@ -106,12 +111,12 @@ func NewValidatorSetCheckPublicKeys( hasPublicKeys = false } } - return NewValidatorSet(valz, newThresholdPublicKey, quorumType, quorumHash, hasPublicKeys) + return NewValidatorSet(valz, newThresholdPublicKey, quorumType, quorumHash, hasPublicKeys, params) } // NewEmptyValidatorSet initializes a ValidatorSet with no validators func NewEmptyValidatorSet() *ValidatorSet { - return NewValidatorSet(nil, nil, 0, nil, false) + return NewValidatorSet(nil, nil, 0, nil, false, nil) } func (vals *ValidatorSet) ValidateBasic() error { @@ -152,6 +157,29 @@ func (vals *ValidatorSet) ValidateBasic() error { return fmt.Errorf("proposer failed validate basic, error: %w", err) } + if len(vals.Params.PubKeyTypes) != 0 { + for _, validator := range vals.Validators { + if !vals.Params.IsValidPubkeyType(validator.PubKey.Type()) { + return fmt.Errorf( + "validator %s is using pubkey %s, which is unsupported for consensus - expected %v", + validator.String(), + validator.PubKey.Type(), + vals.Params.PubKeyTypes, + ) + } + } + } + + if vals.Params.VotingPowerThreshold > 0 && vals.QuorumTypeMemberCount() > 3 { + power := vals.QuorumVotingPower() + if power < 0 { + return fmt.Errorf("quorum voting power %d is negative", power) + } + if uint64(power) < vals.Params.VotingPowerThreshold*2/3+1 { + return fmt.Errorf("quorum voting power %d is less than threshold %d", power, vals.Params.VotingPowerThreshold) + } + } + return nil } diff --git a/types/validator_set_test.go b/types/validator_set_test.go index c423ff7710..ee0b38fc26 100644 --- a/types/validator_set_test.go +++ b/types/validator_set_test.go @@ -24,7 +24,7 @@ import ( func TestValidatorSetBasic(t *testing.T) { // empty or nil validator lists are allowed, - vset := NewValidatorSet([]*Validator{}, nil, btcjson.LLMQType_5_60, nil, true) + vset := NewValidatorSet([]*Validator{}, nil, btcjson.LLMQType_5_60, nil, true, nil) assert.EqualValues(t, vset, vset.Copy()) assert.False(t, vset.HasProTxHash([]byte("some val"))) @@ -233,7 +233,7 @@ func TestCopy(t *testing.T) { func BenchmarkValidatorSetCopy(b *testing.B) { b.StopTimer() - vset := NewValidatorSet([]*Validator{}, nil, btcjson.LLMQType_5_60, nil, true) + vset := NewValidatorSet([]*Validator{}, nil, btcjson.LLMQType_5_60, nil, true, nil) for i := 0; i < 1000; i++ { privKey := bls12381.GenPrivKey() pubKey := privKey.PubKey() @@ -279,7 +279,7 @@ func randValidatorInQuorum(ctx context.Context, t *testing.T, quorumHash crypto. func TestEmptySet(t *testing.T) { var valList []*Validator - valSet := NewValidatorSet(valList, bls12381.PubKey{}, btcjson.LLMQType_5_60, crypto.QuorumHash{}, true) + valSet := NewValidatorSet(valList, bls12381.PubKey{}, btcjson.LLMQType_5_60, crypto.QuorumHash{}, true, nil) // Add to empty set proTxHashes := []crypto.ProTxHash{crypto.Checksum([]byte("v1")), crypto.Checksum([]byte("v2"))} @@ -310,14 +310,18 @@ func TestUpdatesForNewValidatorSet(t *testing.T) { v112 := NewTestValidatorGeneratedFromProTxHash(crypto.Checksum([]byte("v1"))) v113 := NewTestValidatorGeneratedFromProTxHash(crypto.Checksum([]byte("v1"))) valList := []*Validator{v111, v112, v113} - assert.Panics(t, func() { NewValidatorSet(valList, bls12381.PubKey{}, btcjson.LLMQType_5_60, crypto.QuorumHash{}, true) }) + assert.Panics(t, func() { + NewValidatorSet(valList, bls12381.PubKey{}, btcjson.LLMQType_5_60, crypto.QuorumHash{}, true, nil) + }) // Verify set including validator with voting power 0 cannot be created v1 := NewTestRemoveValidatorGeneratedFromProTxHash(crypto.Checksum([]byte("v1"))) v2 := NewTestValidatorGeneratedFromProTxHash(crypto.Checksum([]byte("v2"))) v3 := NewTestValidatorGeneratedFromProTxHash(crypto.Checksum([]byte("v3"))) valList = []*Validator{v1, v2, v3} - assert.Panics(t, func() { NewValidatorSet(valList, bls12381.PubKey{}, btcjson.LLMQType_5_60, crypto.QuorumHash{}, true) }) + assert.Panics(t, func() { + NewValidatorSet(valList, bls12381.PubKey{}, btcjson.LLMQType_5_60, crypto.QuorumHash{}, true, nil) + }) // Verify set including validator with negative voting power cannot be created v1 = NewTestValidatorGeneratedFromProTxHash(crypto.Checksum([]byte("v1"))) @@ -327,7 +331,9 @@ func TestUpdatesForNewValidatorSet(t *testing.T) { } v3 = NewTestValidatorGeneratedFromProTxHash(crypto.Checksum([]byte("v3"))) valList = []*Validator{v1, v2, v3} - assert.Panics(t, func() { NewValidatorSet(valList, bls12381.PubKey{}, btcjson.LLMQType_5_60, crypto.QuorumHash{}, true) }) + assert.Panics(t, func() { + NewValidatorSet(valList, bls12381.PubKey{}, btcjson.LLMQType_5_60, crypto.QuorumHash{}, true, nil) + }) } diff --git a/types/vote_set_test.go b/types/vote_set_test.go index f3a47aaa54..2ce386e54d 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -640,7 +640,7 @@ func randVoteSetWithLLMQType( sort.Sort(PrivValidatorsByProTxHash(privValidators)) - valSet := NewValidatorSet(valz, ld.ThresholdPubKey, llmqType, quorumHash, true) + valSet := NewValidatorSet(valz, ld.ThresholdPubKey, llmqType, quorumHash, true, nil) voteSet := NewVoteSet("test_chain_id", height, round, signedMsgType, valSet) return voteSet, valSet, privValidators From 4ec14c413bd5ed52d0942b0105e76ac7868acdfe Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Wed, 12 Feb 2025 14:02:24 +0100 Subject: [PATCH 02/17] feat: use threshold from ValidatorParam to construct bls sigs --- types/params.go | 10 ++++- types/validator_set.go | 4 ++ types/vote_set_test.go | 89 +++++++++++++++++++++++++++++++++++++++++- 3 files changed, 100 insertions(+), 3 deletions(-) diff --git a/types/params.go b/types/params.go index ce2065eab7..0528b33fea 100644 --- a/types/params.go +++ b/types/params.go @@ -4,6 +4,7 @@ import ( "crypto/sha256" "errors" "fmt" + "math" "os" "time" @@ -261,9 +262,14 @@ func ValidatorParamsFromProto(pbValParams *tmproto.ValidatorParams) ValidatorPar // For nil ValidatorParams, it returns 0. // // Value of 0 means that the threshold is not set. -func (val *ValidatorParams) GetVotingPowerThreshold() uint64 { +func (val *ValidatorParams) GetVotingPowerThreshold() int64 { if val != nil { - return val.VotingPowerThreshold + //nolint:goosec + if val.VotingPowerThreshold > math.MaxInt64 || int64(val.VotingPowerThreshold) > MaxTotalVotingPower { + // this should never happen + panic(fmt.Sprintf("VotingPowerThreshold %d is too big", val.VotingPowerThreshold)) + } + return int64(val.VotingPowerThreshold) } return 0 } diff --git a/types/validator_set.go b/types/validator_set.go index 2cdc0052cb..c689f83da7 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -425,6 +425,10 @@ func (vals *ValidatorSet) QuorumVotingPower() int64 { // QuorumVotingThresholdPower returns the threshold power of the voting power of the quorum if all the members existed. // Voting is considered successful when voting power is at or above this threshold. func (vals *ValidatorSet) QuorumVotingThresholdPower() int64 { + if thresholdPower := vals.Params.GetVotingPowerThreshold(); thresholdPower > 0 { + return thresholdPower + } + return int64(vals.QuorumTypeThresholdCount()) * DefaultDashVotingPower } diff --git a/types/vote_set_test.go b/types/vote_set_test.go index 2ce386e54d..9890b74646 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -513,6 +513,7 @@ func TestVoteSet_LLMQType_50_60(t *testing.T) { tt.numValidators, tt.llmqType, tt.threshold, + nil, ) assert.EqualValues(t, tt.threshold, valSet.QuorumTypeThresholdCount()) assert.GreaterOrEqual(t, len(privValidators), tt.threshold+3, @@ -548,6 +549,91 @@ func TestVoteSet_LLMQType_50_60(t *testing.T) { } } +// Given a set of validators and a threshold defined in ValidatorParams, +// when votes are cast, +// then the threshold from ValidatorParams is respected. +// FIXME: threshold 1 causes "panic: At least 2 coefficients required" +// in bls-signatures C++ library. +func TestVoteSet_ValidatorParams_Threshold(t *testing.T) { + const ( + height = int64(1) + round = int32(0) + ) + testCases := []struct { + llmqType btcjson.LLMQType + numValidators int + threshold int + }{ + { // threshold allowing 1 vote + llmqType: btcjson.LLMQType_100_67, + numValidators: 100, + threshold: 1, + }, + { // single node network + llmqType: btcjson.LLMQType_100_67, + numValidators: 2, + threshold: 1, + }, + { // normal network + llmqType: btcjson.LLMQType_100_67, + numValidators: 100, + threshold: 67, + }, + { // network below threshold + llmqType: btcjson.LLMQType_100_67, + numValidators: 66, + threshold: 67, + }, + } + + for ti, tt := range testCases { + name := strconv.Itoa(ti) + t.Run(name, func(t *testing.T) { + params := ValidatorParams{ + VotingPowerThreshold: uint64(int64(tt.threshold) * DefaultDashVotingPower), + } + voteSet, _, privValidators := randVoteSetWithLLMQType( + height, + round, + tmproto.PrevoteType, + tt.numValidators, + tt.llmqType, + tt.threshold, + ¶ms, + ) + assert.GreaterOrEqual(t, len(privValidators), tt.threshold+3, + "need at least %d validators", tt.threshold+3) + + blockHash := crypto.CRandBytes(32) + stateID := RandStateID() + blockPartSetHeader := PartSetHeader{uint32(123), crypto.CRandBytes(32)} + votedBlock := BlockID{blockHash, blockPartSetHeader, stateID.Hash()} + + // below threshold + for i := 0; i < tt.threshold-1; i++ { + blockMaj, anyMaj := castVote(t, votedBlock, height, round, privValidators, int32(i), voteSet) + assert.False(t, blockMaj, "no block majority expected here: i=%d, threshold=%d", i, tt.threshold) + assert.False(t, anyMaj, "no 'any' majority expected here: i=%d, threshold=%d", i, tt.threshold) + } + + // we add null vote + blockMaj, anyMaj := castVote(t, BlockID{}, height, round, privValidators, int32(tt.threshold), voteSet) + assert.False(t, blockMaj, "no block majority expected after nil vote") + assert.True(t, anyMaj, "'any' majority expected after nil vote at threshold") + + // at threshold + blockMaj, anyMaj = castVote(t, votedBlock, height, round, privValidators, int32(tt.threshold+1), voteSet) + assert.True(t, blockMaj, "block majority expected") + assert.True(t, anyMaj, "'any' majority expected") + + // above threshold + blockMaj, anyMaj = castVote(t, votedBlock, height, round, privValidators, int32(tt.threshold+2), voteSet) + assert.True(t, blockMaj, "block majority expected") + assert.True(t, anyMaj, "'any' majority expected") + }) + } +} + func TestVoteSet_json_marshal_nil(t *testing.T) { var vset *VoteSet jsonBytes, err := json.Marshal(vset) @@ -619,6 +705,7 @@ func randVoteSetWithLLMQType( numValidators int, llmqType btcjson.LLMQType, threshold int, + params *ValidatorParams, ) (*VoteSet, *ValidatorSet, []PrivValidator) { valz := make([]*Validator, 0, numValidators) privValidators := make([]PrivValidator, 0, numValidators) @@ -640,7 +727,7 @@ func randVoteSetWithLLMQType( sort.Sort(PrivValidatorsByProTxHash(privValidators)) - valSet := NewValidatorSet(valz, ld.ThresholdPubKey, llmqType, quorumHash, true, nil) + valSet := NewValidatorSet(valz, ld.ThresholdPubKey, llmqType, quorumHash, true, params) voteSet := NewVoteSet("test_chain_id", height, round, signedMsgType, valSet) return voteSet, valSet, privValidators From 22e2da0e0d58542e5247f3b86228aaed52232ee4 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Thu, 13 Feb 2025 16:36:42 +0100 Subject: [PATCH 03/17] chore: add threshold to validator set --- proto/tendermint/types/params.proto | 9 +- proto/tendermint/types/validator.pb.go | 112 ++++++++++++++++--------- proto/tendermint/types/validator.proto | 15 ++-- types/params.go | 24 ++++-- types/validator_set.go | 50 ++++++----- types/vote_set_test.go | 41 ++++----- 6 files changed, 155 insertions(+), 96 deletions(-) diff --git a/proto/tendermint/types/params.proto b/proto/tendermint/types/params.proto index 5cc6ab2e6b..c549b2fcc2 100644 --- a/proto/tendermint/types/params.proto +++ b/proto/tendermint/types/params.proto @@ -64,8 +64,13 @@ message ValidatorParams { // For Dash Platform, the voting power can be calculated by multiply of the number of validators // and const `DefaultDashVotingPower == 100`. // - // For validator sets containing more than 3 validators, the threshold MUST be - // greater than 2/3 of the total voting power of all validators. + // The following validation rules MUST be enforced: + // + // 1. For validator sets containing 1 or 2 validators, the threshold MUST be equal to the total voting power + // of these validators. + // 2. For validator set with 3 validators, the threshold MUST be equal or greater than 2/3 of the total voting power. + // 3. For validator sets containing more than 3 validators, the threshold MUST be greater than 2/3 of the + // total voting power. // // If set to 0 or absent, default value is determined based on LLMQ quorum type defined for the network, // with a fall back to 2/3 + 1 of the total voting power. diff --git a/proto/tendermint/types/validator.pb.go b/proto/tendermint/types/validator.pb.go index a37aacd837..b3986ca886 100644 --- a/proto/tendermint/types/validator.pb.go +++ b/proto/tendermint/types/validator.pb.go @@ -25,13 +25,14 @@ var _ = math.Inf const _ = proto.GoGoProtoPackageIsVersion3 // please upgrade the proto package type ValidatorSet struct { - Validators []*Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` - Proposer *Validator `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"` - TotalVotingPower int64 `protobuf:"varint,3,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"` - ThresholdPublicKey crypto.PublicKey `protobuf:"bytes,4,opt,name=threshold_public_key,json=thresholdPublicKey,proto3" json:"threshold_public_key"` - QuorumType int32 `protobuf:"varint,5,opt,name=quorum_type,json=quorumType,proto3" json:"quorum_type,omitempty"` - QuorumHash []byte `protobuf:"bytes,6,opt,name=quorum_hash,json=quorumHash,proto3" json:"quorum_hash,omitempty"` - HasPublicKeys bool `protobuf:"varint,7,opt,name=has_public_keys,json=hasPublicKeys,proto3" json:"has_public_keys,omitempty"` + Validators []*Validator `protobuf:"bytes,1,rep,name=validators,proto3" json:"validators,omitempty"` + Proposer *Validator `protobuf:"bytes,2,opt,name=proposer,proto3" json:"proposer,omitempty"` + TotalVotingPower int64 `protobuf:"varint,3,opt,name=total_voting_power,json=totalVotingPower,proto3" json:"total_voting_power,omitempty"` + ThresholdPublicKey crypto.PublicKey `protobuf:"bytes,4,opt,name=threshold_public_key,json=thresholdPublicKey,proto3" json:"threshold_public_key"` + QuorumType int32 `protobuf:"varint,5,opt,name=quorum_type,json=quorumType,proto3" json:"quorum_type,omitempty"` + QuorumHash []byte `protobuf:"bytes,6,opt,name=quorum_hash,json=quorumHash,proto3" json:"quorum_hash,omitempty"` + HasPublicKeys bool `protobuf:"varint,7,opt,name=has_public_keys,json=hasPublicKeys,proto3" json:"has_public_keys,omitempty"` + VotingPowerThreshold uint64 `protobuf:"varint,8,opt,name=voting_power_threshold,json=votingPowerThreshold,proto3" json:"voting_power_threshold,omitempty"` } func (m *ValidatorSet) Reset() { *m = ValidatorSet{} } @@ -116,6 +117,13 @@ func (m *ValidatorSet) GetHasPublicKeys() bool { return false } +func (m *ValidatorSet) GetVotingPowerThreshold() uint64 { + if m != nil { + return m.VotingPowerThreshold + } + return 0 +} + type Validator struct { PubKey *crypto.PublicKey `protobuf:"bytes,1,opt,name=pub_key,json=pubKey,proto3" json:"pub_key,omitempty"` VotingPower int64 `protobuf:"varint,2,opt,name=voting_power,json=votingPower,proto3" json:"voting_power,omitempty"` @@ -253,37 +261,38 @@ func init() { func init() { proto.RegisterFile("tendermint/types/validator.proto", fileDescriptor_4e92274df03d3088) } var fileDescriptor_4e92274df03d3088 = []byte{ - // 475 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0xcd, 0x6a, 0xdb, 0x40, - 0x18, 0xf4, 0xda, 0x8e, 0x13, 0xaf, 0x5c, 0x92, 0x2e, 0x39, 0x88, 0x34, 0x28, 0x8a, 0x0f, 0x45, - 0xd0, 0x22, 0x41, 0x7f, 0xe8, 0x21, 0xa7, 0xe6, 0x54, 0x28, 0x14, 0xa3, 0x98, 0x1c, 0x7a, 0x11, - 0x2b, 0x6b, 0xf1, 0x0a, 0xcb, 0xfe, 0xb6, 0xbb, 0x2b, 0x37, 0x7a, 0x8b, 0x3e, 0x56, 0x8e, 0x39, - 0x16, 0x0a, 0xa5, 0xd8, 0x6f, 0xd0, 0x27, 0x28, 0x5a, 0x55, 0x8a, 0x9a, 0x4b, 0xe3, 0x9b, 0x34, - 0x33, 0xdf, 0xce, 0x37, 0x03, 0x1f, 0x76, 0x35, 0x5b, 0x25, 0x4c, 0x2e, 0xd3, 0x95, 0x0e, 0x74, - 0x21, 0x98, 0x0a, 0xd6, 0x34, 0x4b, 0x13, 0xaa, 0x41, 0xfa, 0x42, 0x82, 0x06, 0x72, 0x74, 0xaf, - 0xf0, 0x8d, 0xe2, 0xe4, 0x78, 0x0e, 0x73, 0x30, 0x64, 0x50, 0x7e, 0x55, 0xba, 0x93, 0xd3, 0xd6, - 0x4b, 0x33, 0x59, 0x08, 0x0d, 0xc1, 0x82, 0x15, 0xaa, 0x62, 0xc7, 0xbf, 0xbb, 0x78, 0x74, 0x5d, - 0xbf, 0x7c, 0xc5, 0x34, 0xb9, 0xc0, 0xb8, 0x71, 0x52, 0x36, 0x72, 0x7b, 0x9e, 0xf5, 0xea, 0x99, - 0xff, 0xd0, 0xcb, 0x6f, 0x66, 0xc2, 0x96, 0x9c, 0xbc, 0xc3, 0x07, 0x42, 0x82, 0x00, 0xc5, 0xa4, - 0xdd, 0x75, 0xd1, 0xff, 0x46, 0x1b, 0x31, 0x79, 0x89, 0x89, 0x06, 0x4d, 0xb3, 0x68, 0x0d, 0x3a, - 0x5d, 0xcd, 0x23, 0x01, 0x5f, 0x99, 0xb4, 0x7b, 0x2e, 0xf2, 0x7a, 0xe1, 0x91, 0x61, 0xae, 0x0d, - 0x31, 0x29, 0x71, 0x32, 0xc5, 0xc7, 0x9a, 0x4b, 0xa6, 0x38, 0x64, 0x49, 0x24, 0xf2, 0x38, 0x4b, - 0x67, 0xd1, 0x82, 0x15, 0x76, 0xdf, 0x58, 0x9e, 0xb6, 0x2d, 0xab, 0xc4, 0xfe, 0xc4, 0x88, 0x3e, - 0xb2, 0xe2, 0xb2, 0x7f, 0xfb, 0xf3, 0xac, 0x13, 0x92, 0x66, 0xbe, 0x61, 0xc8, 0x19, 0xb6, 0xbe, - 0xe4, 0x20, 0xf3, 0x65, 0x54, 0xee, 0x69, 0xef, 0xb9, 0xc8, 0xdb, 0x0b, 0x71, 0x05, 0x4d, 0x0b, - 0xc1, 0x5a, 0x02, 0x4e, 0x15, 0xb7, 0x07, 0x2e, 0xf2, 0x46, 0xb5, 0xe0, 0x03, 0x55, 0x9c, 0x3c, - 0xc7, 0x87, 0x9c, 0xaa, 0xd6, 0x46, 0xca, 0xde, 0x77, 0x91, 0x77, 0x10, 0x3e, 0xe1, 0x54, 0x35, - 0x46, 0x6a, 0xfc, 0x03, 0xe1, 0x61, 0xd3, 0x02, 0xb9, 0xc0, 0xfb, 0x22, 0x8f, 0x4d, 0x00, 0xf4, - 0xc8, 0x00, 0x28, 0x1c, 0x88, 0x3c, 0x2e, 0x97, 0x3e, 0xc7, 0xa3, 0x7f, 0x2a, 0xeb, 0x9a, 0xca, - 0xac, 0x75, 0xab, 0xad, 0x17, 0xf8, 0x69, 0xdd, 0x73, 0x24, 0x64, 0x0a, 0x32, 0xd5, 0x45, 0x5d, - 0x6d, 0x4d, 0x4c, 0xfe, 0xe2, 0xc4, 0xc1, 0x96, 0x90, 0x10, 0xe9, 0x9b, 0x2a, 0x63, 0xdf, 0x64, - 0x1c, 0x0a, 0x09, 0xd3, 0x1b, 0x13, 0xf1, 0x1c, 0x8f, 0x56, 0x90, 0xb0, 0x88, 0x26, 0x89, 0x64, - 0x4a, 0x99, 0x96, 0x86, 0xa1, 0x55, 0x62, 0xef, 0x2b, 0x68, 0xbc, 0xc0, 0x87, 0x57, 0xe9, 0x52, - 0x64, 0xec, 0x3e, 0xe2, 0xdb, 0x9d, 0x22, 0xee, 0x10, 0xee, 0xf2, 0xd3, 0xed, 0xc6, 0x41, 0x77, - 0x1b, 0x07, 0xfd, 0xda, 0x38, 0xe8, 0xdb, 0xd6, 0xe9, 0xdc, 0x6d, 0x9d, 0xce, 0xf7, 0xad, 0xd3, - 0xf9, 0xfc, 0x66, 0x9e, 0x6a, 0x9e, 0xc7, 0xfe, 0x0c, 0x96, 0x41, 0x42, 0x15, 0x17, 0xb4, 0x08, - 0x2a, 0xd3, 0xf2, 0x2f, 0xa8, 0xee, 0xe4, 0xe1, 0x95, 0xc5, 0x03, 0x83, 0xbf, 0xfe, 0x13, 0x00, - 0x00, 0xff, 0xff, 0x84, 0xb2, 0x3f, 0xb9, 0x80, 0x03, 0x00, 0x00, + // 495 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x94, 0x53, 0x41, 0x6b, 0xdb, 0x30, + 0x18, 0x8d, 0x9a, 0x34, 0x4d, 0x94, 0x8c, 0x76, 0x22, 0x0c, 0xd3, 0x15, 0xd7, 0xcd, 0x61, 0x18, + 0x36, 0x6c, 0xd8, 0x3a, 0x76, 0xe8, 0x69, 0x3d, 0x0d, 0x06, 0x23, 0xb8, 0xa1, 0x87, 0x5d, 0x8c, + 0x1c, 0x8b, 0xc8, 0xc4, 0xc9, 0xa7, 0x49, 0x72, 0x56, 0xff, 0x8b, 0xfd, 0x8c, 0xfd, 0x94, 0x1e, + 0x7b, 0x1c, 0x0c, 0xc6, 0x48, 0xfe, 0xc8, 0xb0, 0x3c, 0x3b, 0x5e, 0x2f, 0x6b, 0x6f, 0xf6, 0x7b, + 0xef, 0xd3, 0xfb, 0xde, 0x13, 0xc2, 0x8e, 0x66, 0xab, 0x98, 0xc9, 0x65, 0xb2, 0xd2, 0xbe, 0xce, + 0x05, 0x53, 0xfe, 0x9a, 0xa6, 0x49, 0x4c, 0x35, 0x48, 0x4f, 0x48, 0xd0, 0x40, 0x8e, 0x76, 0x0a, + 0xcf, 0x28, 0x8e, 0x47, 0x73, 0x98, 0x83, 0x21, 0xfd, 0xe2, 0xab, 0xd4, 0x1d, 0x9f, 0x34, 0x4e, + 0x9a, 0xc9, 0x5c, 0x68, 0xf0, 0x17, 0x2c, 0x57, 0x25, 0x3b, 0xfe, 0xde, 0xc6, 0xc3, 0xeb, 0xea, + 0xe4, 0x2b, 0xa6, 0xc9, 0x05, 0xc6, 0xb5, 0x93, 0xb2, 0x90, 0xd3, 0x76, 0x07, 0xaf, 0x9f, 0x7b, + 0xf7, 0xbd, 0xbc, 0x7a, 0x26, 0x68, 0xc8, 0xc9, 0x3b, 0xdc, 0x13, 0x12, 0x04, 0x28, 0x26, 0xad, + 0x3d, 0x07, 0xfd, 0x6f, 0xb4, 0x16, 0x93, 0x57, 0x98, 0x68, 0xd0, 0x34, 0x0d, 0xd7, 0xa0, 0x93, + 0xd5, 0x3c, 0x14, 0xf0, 0x95, 0x49, 0xab, 0xed, 0x20, 0xb7, 0x1d, 0x1c, 0x19, 0xe6, 0xda, 0x10, + 0x93, 0x02, 0x27, 0x53, 0x3c, 0xd2, 0x5c, 0x32, 0xc5, 0x21, 0x8d, 0x43, 0x91, 0x45, 0x69, 0x32, + 0x0b, 0x17, 0x2c, 0xb7, 0x3a, 0xc6, 0xf2, 0xa4, 0x69, 0x59, 0x26, 0xf6, 0x26, 0x46, 0xf4, 0x91, + 0xe5, 0x97, 0x9d, 0xdb, 0x5f, 0xa7, 0xad, 0x80, 0xd4, 0xf3, 0x35, 0x43, 0x4e, 0xf1, 0xe0, 0x4b, + 0x06, 0x32, 0x5b, 0x86, 0xc5, 0x9e, 0xd6, 0xbe, 0x83, 0xdc, 0xfd, 0x00, 0x97, 0xd0, 0x34, 0x17, + 0xac, 0x21, 0xe0, 0x54, 0x71, 0xab, 0xeb, 0x20, 0x77, 0x58, 0x09, 0x3e, 0x50, 0xc5, 0xc9, 0x0b, + 0x7c, 0xc8, 0xa9, 0x6a, 0x6c, 0xa4, 0xac, 0x03, 0x07, 0xb9, 0xbd, 0xe0, 0x09, 0xa7, 0xaa, 0x36, + 0x52, 0xe4, 0x1c, 0x3f, 0x6b, 0xe6, 0x0c, 0xeb, 0x65, 0xac, 0x9e, 0x83, 0xdc, 0x4e, 0x30, 0x5a, + 0xef, 0xc2, 0x4e, 0x2b, 0x6e, 0xfc, 0x13, 0xe1, 0x7e, 0xdd, 0x1d, 0xb9, 0xc0, 0x07, 0x22, 0x8b, + 0x4c, 0x6c, 0xf4, 0xc0, 0xd8, 0x28, 0xe8, 0x8a, 0x2c, 0x2a, 0xa2, 0x9e, 0xe1, 0xe1, 0x3f, 0x45, + 0xef, 0x99, 0xa2, 0x07, 0x0d, 0x5b, 0xf2, 0x12, 0x3f, 0xad, 0x6e, 0x27, 0x14, 0x32, 0x01, 0x99, + 0xe8, 0xbc, 0xba, 0x90, 0x8a, 0x98, 0xfc, 0xc5, 0x89, 0x8d, 0x07, 0x42, 0x42, 0xa8, 0x6f, 0xca, + 0x66, 0x3a, 0xa6, 0x99, 0xbe, 0x90, 0x30, 0xbd, 0x31, 0xc5, 0x9c, 0xe1, 0xe1, 0x0a, 0x62, 0x16, + 0xd2, 0x38, 0x96, 0x4c, 0x29, 0xd3, 0x6d, 0x3f, 0x18, 0x14, 0xd8, 0xfb, 0x12, 0x1a, 0x2f, 0xf0, + 0xe1, 0x55, 0xb2, 0x14, 0x29, 0xdb, 0x45, 0x7c, 0xfb, 0xa8, 0x88, 0x8f, 0x08, 0x77, 0xf9, 0xe9, + 0x76, 0x63, 0xa3, 0xbb, 0x8d, 0x8d, 0x7e, 0x6f, 0x6c, 0xf4, 0x6d, 0x6b, 0xb7, 0xee, 0xb6, 0x76, + 0xeb, 0xc7, 0xd6, 0x6e, 0x7d, 0x3e, 0x9f, 0x27, 0x9a, 0x67, 0x91, 0x37, 0x83, 0xa5, 0x1f, 0x53, + 0xc5, 0x05, 0xcd, 0xfd, 0xd2, 0xb4, 0xf8, 0xf3, 0xcb, 0xd7, 0x75, 0xff, 0x6d, 0x46, 0x5d, 0x83, + 0xbf, 0xf9, 0x13, 0x00, 0x00, 0xff, 0xff, 0x0f, 0xc1, 0xfd, 0x1a, 0xb6, 0x03, 0x00, 0x00, } func (m *ValidatorSet) Marshal() (dAtA []byte, err error) { @@ -306,6 +315,11 @@ func (m *ValidatorSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l + if m.VotingPowerThreshold != 0 { + i = encodeVarintValidator(dAtA, i, uint64(m.VotingPowerThreshold)) + i-- + dAtA[i] = 0x40 + } if m.HasPublicKeys { i-- if m.HasPublicKeys { @@ -513,6 +527,9 @@ func (m *ValidatorSet) Size() (n int) { if m.HasPublicKeys { n += 2 } + if m.VotingPowerThreshold != 0 { + n += 1 + sovValidator(uint64(m.VotingPowerThreshold)) + } return n } @@ -789,6 +806,25 @@ func (m *ValidatorSet) Unmarshal(dAtA []byte) error { } } m.HasPublicKeys = bool(v != 0) + case 8: + if wireType != 0 { + return fmt.Errorf("proto: wrong wireType = %d for field VotingPowerThreshold", wireType) + } + m.VotingPowerThreshold = 0 + for shift := uint(0); ; shift += 7 { + if shift >= 64 { + return ErrIntOverflowValidator + } + if iNdEx >= l { + return io.ErrUnexpectedEOF + } + b := dAtA[iNdEx] + iNdEx++ + m.VotingPowerThreshold |= uint64(b&0x7F) << shift + if b < 0x80 { + break + } + } default: iNdEx = preIndex skippy, err := skipValidator(dAtA[iNdEx:]) diff --git a/proto/tendermint/types/validator.proto b/proto/tendermint/types/validator.proto index 9c0fe6ab17..23fb02d654 100644 --- a/proto/tendermint/types/validator.proto +++ b/proto/tendermint/types/validator.proto @@ -7,13 +7,14 @@ import "gogoproto/gogo.proto"; import "tendermint/crypto/keys.proto"; message ValidatorSet { - repeated Validator validators = 1; - Validator proposer = 2; - int64 total_voting_power = 3; - tendermint.crypto.PublicKey threshold_public_key = 4 [(gogoproto.nullable) = false]; - int32 quorum_type = 5; - bytes quorum_hash = 6; - bool has_public_keys = 7; + repeated Validator validators = 1; + Validator proposer = 2; + int64 total_voting_power = 3; + tendermint.crypto.PublicKey threshold_public_key = 4 [(gogoproto.nullable) = false]; + int32 quorum_type = 5; + bytes quorum_hash = 6; + bool has_public_keys = 7; + uint64 voting_power_threshold = 8; // must equal ValidatorParams.voting_power_threshold } message Validator { diff --git a/types/params.go b/types/params.go index 0528b33fea..b6239f95c5 100644 --- a/types/params.go +++ b/types/params.go @@ -242,6 +242,21 @@ func (val *ValidatorParams) IsValidPubkeyType(pubkeyType string) bool { return false } +func (val *ValidatorParams) ToProto() *tmproto.ValidatorParams { + if val == nil { + return nil + } + + return &tmproto.ValidatorParams{ + PubKeyTypes: val.PubKeyTypes, + XVotingPowerThreshold: &tmproto.ValidatorParams_VotingPowerThreshold{ + VotingPowerThreshold: val.VotingPowerThreshold, + }, + } +} + +// ValidatorParamsFromProto returns a ValidatorParams from a protobuf representation. +// If pbValParams is nil, it returns a ValidatorParams with empty PubKeyTypes and 0 VotingPowerThreshold. func ValidatorParamsFromProto(pbValParams *tmproto.ValidatorParams) ValidatorParams { if pbValParams != nil { return ValidatorParams{ @@ -472,12 +487,7 @@ func (params *ConsensusParams) ToProto() tmproto.ConsensusParams { MaxAgeDuration: params.Evidence.MaxAgeDuration, MaxBytes: params.Evidence.MaxBytes, }, - Validator: &tmproto.ValidatorParams{ - PubKeyTypes: params.Validator.PubKeyTypes, - XVotingPowerThreshold: &tmproto.ValidatorParams_VotingPowerThreshold{ - VotingPowerThreshold: params.Validator.VotingPowerThreshold, - }, - }, + Validator: params.Validator.ToProto(), Version: &tmproto.VersionParams{ AppVersion: params.Version.AppVersion, ConsensusVersion: tmproto.VersionParams_ConsensusVersion(params.Version.ConsensusVersion), @@ -519,7 +529,7 @@ func ConsensusParamsFromProto(pbParams tmproto.ConsensusParams) ConsensusParams if pbParams.Validator != nil { c.Validator = ValidatorParams{ - PubKeyTypes: pbParams.Validator.PubKeyTypes, + PubKeyTypes: append([]string{}, pbParams.Validator.PubKeyTypes...), VotingPowerThreshold: pbParams.Validator.GetVotingPowerThreshold(), } } diff --git a/types/validator_set.go b/types/validator_set.go index c689f83da7..b81ededb65 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -64,8 +64,9 @@ type ValidatorSet struct { ThresholdPublicKey crypto.PubKey `json:"threshold_public_key"` QuorumHash crypto.QuorumHash `json:"quorum_hash"` QuorumType btcjson.LLMQType `json:"quorum_type"` - Params ValidatorParams `json:"validator_consensus_params"` HasPublicKeys bool `json:"has_public_keys"` + // Threshold power, must equal to ValidatorParams.voting_power_threshold + VotingPowerThreshold uint64 `json:"threshold_power"` } // NewValidatorSet initializes a ValidatorSet by copying over the values from @@ -86,7 +87,7 @@ func NewValidatorSet(valz []*Validator, newThresholdPublicKey crypto.PubKey, quo HasPublicKeys: hasPublicKeys, } if validatorParams != nil { - vals.Params = *validatorParams + vals.VotingPowerThreshold = validatorParams.VotingPowerThreshold } err := vals.updateWithChangeSet(valz, false, newThresholdPublicKey, quorumHash) if err != nil { @@ -156,27 +157,26 @@ func (vals *ValidatorSet) ValidateBasic() error { if err := vals.Proposer().ValidateBasic(); err != nil { return fmt.Errorf("proposer failed validate basic, error: %w", err) } - - if len(vals.Params.PubKeyTypes) != 0 { - for _, validator := range vals.Validators { - if !vals.Params.IsValidPubkeyType(validator.PubKey.Type()) { - return fmt.Errorf( - "validator %s is using pubkey %s, which is unsupported for consensus - expected %v", - validator.String(), - validator.PubKey.Type(), - vals.Params.PubKeyTypes, - ) - } + // TODO: Validate that vals.VotingPowerThreshold == ValidatorParams.voting_power_threshold + threshold := vals.QuorumVotingThresholdPower() + totalPower := vals.TotalVotingPower() + switch len(vals.Validators) { + case 1, 2: + // For validator sets containing 1 or 2 validators, the threshold MUST be equal to the total voting power. + if totalPower != threshold { + return fmt.Errorf("with 1 validator, quorum voting power %d must be equal to threshold %d", totalPower, threshold) } - } - - if vals.Params.VotingPowerThreshold > 0 && vals.QuorumTypeMemberCount() > 3 { - power := vals.QuorumVotingPower() - if power < 0 { - return fmt.Errorf("quorum voting power %d is negative", power) + case 3: + // For validator set with 3 validators, the threshold MUST be equal or greater than 2/3 of the total voting power. + if threshold < totalPower*2/3 { + return fmt.Errorf("%d-members quorum voting power %d is less than threshold %d", + len(vals.Validators), totalPower, vals.VotingPowerThreshold) } - if uint64(power) < vals.Params.VotingPowerThreshold*2/3+1 { - return fmt.Errorf("quorum voting power %d is less than threshold %d", power, vals.Params.VotingPowerThreshold) + default: + // For validator sets containing more than 3 validators, the threshold MUST be at least 2/3 + 1 of the total voting power. + if threshold < (totalPower*2/3)+1 { + return fmt.Errorf("quorum voting power %d is less than threshold %d", totalPower, threshold) + } } @@ -425,8 +425,8 @@ func (vals *ValidatorSet) QuorumVotingPower() int64 { // QuorumVotingThresholdPower returns the threshold power of the voting power of the quorum if all the members existed. // Voting is considered successful when voting power is at or above this threshold. func (vals *ValidatorSet) QuorumVotingThresholdPower() int64 { - if thresholdPower := vals.Params.GetVotingPowerThreshold(); thresholdPower > 0 { - return thresholdPower + if thresholdPower := vals.VotingPowerThreshold; thresholdPower > 0 { + return int64(thresholdPower) } return int64(vals.QuorumTypeThresholdCount()) * DefaultDashVotingPower @@ -934,6 +934,8 @@ func (vals *ValidatorSet) ToProto() (*tmproto.ValidatorSet, error) { // be consistent with cached data vp.TotalVotingPower = 0 + vp.VotingPowerThreshold = vals.VotingPowerThreshold + if vals.ThresholdPublicKey == nil { return nil, fmt.Errorf("thresholdPublicKey is not set") } @@ -988,6 +990,8 @@ func ValidatorSetFromProto(vp *tmproto.ValidatorSet) (*ValidatorSet, error) { } } + vals.VotingPowerThreshold = vp.GetVotingPowerThreshold() + // NOTE: We can't trust the total voting power given to us by other peers. If someone were to // inject a non-zeo value that wasn't the correct voting power we could assume a wrong total // power hence we need to recompute it. diff --git a/types/vote_set_test.go b/types/vote_set_test.go index 9890b74646..c01342eb16 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -564,15 +564,15 @@ func TestVoteSet_ValidatorParams_Threshold(t *testing.T) { numValidators int threshold int }{ - { // threshold allowing 1 vote + { // single node network llmqType: btcjson.LLMQType_100_67, - numValidators: 100, + numValidators: 1, threshold: 1, }, - { // single node network + { // two node network llmqType: btcjson.LLMQType_100_67, numValidators: 2, - threshold: 1, + threshold: 2, }, { // normal network llmqType: btcjson.LLMQType_100_67, @@ -581,7 +581,7 @@ func TestVoteSet_ValidatorParams_Threshold(t *testing.T) { }, { // network below threshold llmqType: btcjson.LLMQType_100_67, - numValidators: 66, + numValidators: 67, threshold: 67, }, } @@ -601,9 +601,6 @@ func TestVoteSet_ValidatorParams_Threshold(t *testing.T) { tt.threshold, ¶ms, ) - assert.GreaterOrEqual(t, len(privValidators), tt.threshold+3, - "need at least %d validators", tt.threshold+3) - blockHash := crypto.CRandBytes(32) stateID := RandStateID() blockPartSetHeader := PartSetHeader{uint32(123), crypto.CRandBytes(32)} @@ -617,19 +614,25 @@ func TestVoteSet_ValidatorParams_Threshold(t *testing.T) { } // we add null vote - blockMaj, anyMaj := castVote(t, BlockID{}, height, round, privValidators, int32(tt.threshold), voteSet) - assert.False(t, blockMaj, "no block majority expected after nil vote") - assert.True(t, anyMaj, "'any' majority expected after nil vote at threshold") - - // at threshold - blockMaj, anyMaj = castVote(t, votedBlock, height, round, privValidators, int32(tt.threshold+1), voteSet) - assert.True(t, blockMaj, "block majority expected") - assert.True(t, anyMaj, "'any' majority expected") + if tt.numValidators > tt.threshold { + // we add null vote + blockMaj, anyMaj := castVote(t, BlockID{}, height, round, privValidators, int32(tt.threshold), voteSet) + assert.False(t, blockMaj, "no block majority expected after nil vote") + assert.True(t, anyMaj, "'any' majority expected after nil vote at threshold") + } + if tt.numValidators > tt.threshold+1 { + // at threshold + blockMaj, anyMaj := castVote(t, votedBlock, height, round, privValidators, int32(tt.threshold+1), voteSet) + assert.True(t, blockMaj, "block majority expected") + assert.True(t, anyMaj, "'any' majority expected") + } // above threshold - blockMaj, anyMaj = castVote(t, votedBlock, height, round, privValidators, int32(tt.threshold+2), voteSet) - assert.True(t, blockMaj, "block majority expected") - assert.True(t, anyMaj, "'any' majority expected") + if tt.numValidators > tt.threshold+2 { + blockMaj, anyMaj := castVote(t, votedBlock, height, round, privValidators, int32(tt.threshold+2), voteSet) + assert.True(t, blockMaj, "block majority expected") + assert.True(t, anyMaj, "'any' majority expected") + } }) } } From 17b131c81617fa23fdf6b1e181a29a84fd648a0a Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 14 Feb 2025 11:22:32 +0100 Subject: [PATCH 04/17] chore: validator threshold optional handling - WIP, panics in gogoproto --- internal/consensus/replayer.go | 14 +++++--- internal/consensus/replayer_test.go | 3 ++ internal/state/current_round_state.go | 4 +++ internal/test/factory/validator_set.go | 9 ++++- proto/tendermint/types/params.proto | 6 ++-- types/params.go | 49 ++++++++++++-------------- types/params_test.go | 2 +- types/validator_set.go | 6 ++-- types/vote_set_test.go | 3 +- 9 files changed, 57 insertions(+), 39 deletions(-) diff --git a/internal/consensus/replayer.go b/internal/consensus/replayer.go index 4fd5e86459..45b39cbd4d 100644 --- a/internal/consensus/replayer.go +++ b/internal/consensus/replayer.go @@ -342,14 +342,18 @@ func (r *BlockReplayer) execInitChain(ctx context.Context, rs *replayState, stat quorumType = r.genDoc.QuorumType } + var valParams *types.ValidatorParams + if res.ConsensusParams != nil && res.ConsensusParams.Validator != nil { + params := types.ValidatorParamsFromProto(res.ConsensusParams.Validator) + valParams = ¶ms + } + if len(res.ValidatorSetUpdate.ValidatorUpdates) != 0 { // we replace existing validator with the one from InitChain instead of applying it as a diff - var valParams *types.ValidatorParams - if res.ConsensusParams != nil && res.ConsensusParams.Validator != nil { - params := types.ValidatorParamsFromProto(res.ConsensusParams.Validator) - valParams = ¶ms - } state.Validators = types.NewValidatorSet(nil, nil, quorumType, nil, false, valParams) + // } else if valParams != nil && valParams.VotingPowerThreshold != nil { + // // we update the existing validator set with the new voting threshold + // state.Validators.VotingPowerThreshold = *valParams.VotingPowerThreshold } // we only update state when we are in initial state diff --git a/internal/consensus/replayer_test.go b/internal/consensus/replayer_test.go index 14c952f41d..440c2719e4 100644 --- a/internal/consensus/replayer_test.go +++ b/internal/consensus/replayer_test.go @@ -198,6 +198,9 @@ func TestInitChainGenesisTime(t *testing.T) { QuorumHash: make([]byte, 32), GenesisTime: time.Date(1999, 1, 1, 0, 0, 0, 0, time.UTC), } + // We must synchronize genesis validator set voting threshold with the one from the validator set. + // In normal cicrumstances, the threshold is set in genesis or in ResponseInitChain. + genDoc.ConsensusParams.Validator.VotingPowerThreshold = &vset.VotingPowerThreshold err = genDoc.ValidateAndComplete() require.NoError(t, err) diff --git a/internal/state/current_round_state.go b/internal/state/current_round_state.go index 3842de27a2..6e328ebcc3 100644 --- a/internal/state/current_round_state.go +++ b/internal/state/current_round_state.go @@ -340,6 +340,10 @@ func valsetUpdate( if thresholdPubKey != nil { nValSet.ThresholdPublicKey = thresholdPubKey } + + if params.VotingPowerThreshold != nil { + nValSet.VotingPowerThreshold = *params.VotingPowerThreshold + } } return nValSet, nValSet.ValidateBasic() diff --git a/internal/test/factory/validator_set.go b/internal/test/factory/validator_set.go index 624c2f5fc5..de2d2e8f8a 100644 --- a/internal/test/factory/validator_set.go +++ b/internal/test/factory/validator_set.go @@ -44,5 +44,12 @@ func MockValidatorSet() (*types.ValidatorSet, []types.PrivValidator) { false, ) } - return types.NewValidatorSet(valz, thPubKey, btcjson.LLMQType_5_60, quorumHash, true, nil), privVals + votingPowerThreshold := uint64(len(valz)) * uint64(types.DefaultDashVotingPower) + return types.NewValidatorSet(valz, + thPubKey, + btcjson.LLMQType_5_60, + quorumHash, + true, + &types.ValidatorParams{VotingPowerThreshold: &votingPowerThreshold}, + ), privVals } diff --git a/proto/tendermint/types/params.proto b/proto/tendermint/types/params.proto index c549b2fcc2..7e063e3499 100644 --- a/proto/tendermint/types/params.proto +++ b/proto/tendermint/types/params.proto @@ -72,9 +72,11 @@ message ValidatorParams { // 3. For validator sets containing more than 3 validators, the threshold MUST be greater than 2/3 of the // total voting power. // - // If set to 0 or absent, default value is determined based on LLMQ quorum type defined for the network, + // If set to 0, default value is determined based on LLMQ quorum type defined for the network, // with a fall back to 2/3 + 1 of the total voting power. - optional uint64 voting_power_threshold = 2; + // + // If absent, + optional uint64 voting_power_threshold = 2; //[(gogoproto.nullable) = true] } // VersionParams contains the ABCI application version. diff --git a/types/params.go b/types/params.go index b6239f95c5..cd12ea9bbf 100644 --- a/types/params.go +++ b/types/params.go @@ -4,7 +4,6 @@ import ( "crypto/sha256" "errors" "fmt" - "math" "os" "time" @@ -71,7 +70,7 @@ type EvidenceParams struct { // NOTE: uses ABCI pubkey naming, not Amino names. type ValidatorParams struct { PubKeyTypes []string `json:"pub_key_types"` - VotingPowerThreshold uint64 `json:"threshold"` + VotingPowerThreshold *uint64 `json:"threshold,omitempty"` } type VersionParams struct { @@ -144,7 +143,7 @@ func DefaultEvidenceParams() EvidenceParams { func DefaultValidatorParams() ValidatorParams { return ValidatorParams{ PubKeyTypes: []string{ABCIPubKeyTypeBLS12381}, - VotingPowerThreshold: 0, + VotingPowerThreshold: nil, } } @@ -246,12 +245,16 @@ func (val *ValidatorParams) ToProto() *tmproto.ValidatorParams { if val == nil { return nil } + var threshold *tmproto.ValidatorParams_VotingPowerThreshold + if val.VotingPowerThreshold != nil { + threshold = &tmproto.ValidatorParams_VotingPowerThreshold{ + VotingPowerThreshold: uint64(*val.VotingPowerThreshold), + } + } return &tmproto.ValidatorParams{ - PubKeyTypes: val.PubKeyTypes, - XVotingPowerThreshold: &tmproto.ValidatorParams_VotingPowerThreshold{ - VotingPowerThreshold: val.VotingPowerThreshold, - }, + PubKeyTypes: val.PubKeyTypes, + XVotingPowerThreshold: threshold, } } @@ -259,36 +262,26 @@ func (val *ValidatorParams) ToProto() *tmproto.ValidatorParams { // If pbValParams is nil, it returns a ValidatorParams with empty PubKeyTypes and 0 VotingPowerThreshold. func ValidatorParamsFromProto(pbValParams *tmproto.ValidatorParams) ValidatorParams { if pbValParams != nil { + var threshold *uint64 + if pbValParams.XVotingPowerThreshold != nil { + val := pbValParams.GetVotingPowerThreshold() + threshold = &val + } + return ValidatorParams{ // Copy Validator.PubkeyTypes, and set result's value to the copy. // This avoids having to initialize the slice to 0 values, and then write to it again. PubKeyTypes: append([]string{}, pbValParams.PubKeyTypes...), - VotingPowerThreshold: pbValParams.GetVotingPowerThreshold(), + VotingPowerThreshold: threshold, } } return ValidatorParams{ PubKeyTypes: []string{}, - VotingPowerThreshold: 0, + VotingPowerThreshold: nil, } } -// GetVotingPowerThreshold returns the voting power threshold for the validator set. -// For nil ValidatorParams, it returns 0. -// -// Value of 0 means that the threshold is not set. -func (val *ValidatorParams) GetVotingPowerThreshold() int64 { - if val != nil { - //nolint:goosec - if val.VotingPowerThreshold > math.MaxInt64 || int64(val.VotingPowerThreshold) > MaxTotalVotingPower { - // this should never happen - panic(fmt.Sprintf("VotingPowerThreshold %d is too big", val.VotingPowerThreshold)) - } - return int64(val.VotingPowerThreshold) - } - return 0 -} - func (params *ConsensusParams) Complete() { if params.Synchrony == (SynchronyParams{}) { params.Synchrony = DefaultSynchronyParams() @@ -528,9 +521,13 @@ func ConsensusParamsFromProto(pbParams tmproto.ConsensusParams) ConsensusParams } if pbParams.Validator != nil { + var threshold *uint64 + if n, ok := pbParams.Validator.XVotingPowerThreshold.(*tmproto.ValidatorParams_VotingPowerThreshold); ok && n != nil { + threshold = &n.VotingPowerThreshold + } c.Validator = ValidatorParams{ PubKeyTypes: append([]string{}, pbParams.Validator.PubKeyTypes...), - VotingPowerThreshold: pbParams.Validator.GetVotingPowerThreshold(), + VotingPowerThreshold: threshold, } } diff --git a/types/params_test.go b/types/params_test.go index 241181233b..781e9d7c60 100644 --- a/types/params_test.go +++ b/types/params_test.go @@ -219,7 +219,7 @@ func makeParams(args makeParamsArgs) ConsensusParams { }, Validator: ValidatorParams{ PubKeyTypes: args.pubkeyTypes, - VotingPowerThreshold: 0, + VotingPowerThreshold: nil, }, Synchrony: SynchronyParams{ Precision: args.precision, diff --git a/types/validator_set.go b/types/validator_set.go index b81ededb65..569f87403e 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -86,8 +86,8 @@ func NewValidatorSet(valz []*Validator, newThresholdPublicKey crypto.PubKey, quo QuorumType: quorumType, HasPublicKeys: hasPublicKeys, } - if validatorParams != nil { - vals.VotingPowerThreshold = validatorParams.VotingPowerThreshold + if validatorParams != nil && validatorParams.VotingPowerThreshold != nil { + vals.VotingPowerThreshold = *validatorParams.VotingPowerThreshold } err := vals.updateWithChangeSet(valz, false, newThresholdPublicKey, quorumHash) if err != nil { @@ -164,7 +164,7 @@ func (vals *ValidatorSet) ValidateBasic() error { case 1, 2: // For validator sets containing 1 or 2 validators, the threshold MUST be equal to the total voting power. if totalPower != threshold { - return fmt.Errorf("with 1 validator, quorum voting power %d must be equal to threshold %d", totalPower, threshold) + return fmt.Errorf("with 1 or 2 validators, quorum voting power %d must be equal to threshold %d", totalPower, threshold) } case 3: // For validator set with 3 validators, the threshold MUST be equal or greater than 2/3 of the total voting power. diff --git a/types/vote_set_test.go b/types/vote_set_test.go index c01342eb16..8be26dad0a 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -589,8 +589,9 @@ func TestVoteSet_ValidatorParams_Threshold(t *testing.T) { for ti, tt := range testCases { name := strconv.Itoa(ti) t.Run(name, func(t *testing.T) { + threshold := uint64(int64(tt.threshold) * DefaultDashVotingPower) params := ValidatorParams{ - VotingPowerThreshold: uint64(int64(tt.threshold) * DefaultDashVotingPower), + VotingPowerThreshold: &threshold, } voteSet, _, privValidators := randVoteSetWithLLMQType( height, From e4d11d626fed23591572342423255d6690c6048a Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Fri, 14 Feb 2025 15:25:04 +0100 Subject: [PATCH 05/17] build(deps): replace gogo/protobuf with cosmos/gogoproto --- .github/workflows/check-generated.yml | 2 +- CONTRIBUTING.md | 14 +++--- Makefile | 4 +- abci/example/kvstore/config.go | 2 +- abci/example/kvstore/kvstore.go | 2 +- abci/types/messages.go | 2 +- abci/types/messages_test.go | 2 +- abci/types/types.go | 2 +- abci/types/types.pb.go | 46 +++++++++--------- buf.gen.yaml | 6 +-- buf.lock | 6 +++ buf.work.yaml | 3 -- buf.yaml | 20 ++++++++ cmd/abcidump/cmd/parse_test.go | 2 +- cmd/abcidump/parser/parser.go | 4 +- cmd/abcidump/parser/parser_test.go | 2 +- cmd/abcidump/parser/types.go | 2 +- go.mod | 3 +- go.sum | 2 + internal/blocksync/p2p_msg_handler.go | 2 +- internal/blocksync/p2p_msg_handler_test.go | 2 +- internal/consensus/gossip_msg_sender.go | 2 +- internal/consensus/gossip_msg_sender_test.go | 2 +- internal/consensus/gossiper.go | 2 +- internal/consensus/gossiper_test.go | 2 +- internal/consensus/msgs.go | 2 +- internal/consensus/msgs_test.go | 2 +- internal/consensus/reactor.go | 2 +- internal/consensus/replay_test.go | 2 +- internal/consensus/state_add_prop_block.go | 2 +- internal/consensus/wal.go | 2 +- internal/evidence/pool.go | 4 +- internal/libs/protoio/io.go | 4 +- internal/libs/protoio/io_test.go | 6 +-- internal/libs/protoio/reader.go | 4 +- internal/libs/protoio/writer.go | 4 +- internal/libs/protoio/writer_test.go | 2 +- internal/p2p/channel.go | 4 +- internal/p2p/channel_params.go | 2 +- internal/p2p/client/client.go | 2 +- internal/p2p/client/client_test.go | 2 +- internal/p2p/conn/connection.go | 2 +- internal/p2p/conn/connection_test.go | 2 +- .../p2p/conn/evil_secret_connection_test.go | 2 +- internal/p2p/conn/secret_connection.go | 2 +- internal/p2p/p2ptest/require.go | 2 +- internal/p2p/peermanager.go | 4 +- internal/p2p/pqueue.go | 2 +- internal/p2p/pqueue_test.go | 2 +- internal/p2p/router.go | 2 +- internal/p2p/router_test.go | 2 +- internal/p2p/rqueue.go | 2 +- internal/state/indexer/sink/kv/kv_test.go | 2 +- internal/state/indexer/sink/psql/psql.go | 2 +- internal/state/indexer/sink/psql/psql_test.go | 2 +- internal/state/indexer/tx/kv/kv.go | 2 +- internal/state/indexer/tx/kv/kv_test.go | 2 +- internal/state/state.go | 2 +- internal/state/store.go | 2 +- internal/store/store.go | 2 +- privval/msgs.go | 2 +- privval/msgs_test.go | 2 +- privval/secret_connection.go | 2 +- privval/signer_requestHandler.go | 2 +- proto/buf.lock | 7 --- proto/buf.yaml | 11 ----- proto/tendermint/abci/types.proto | 2 +- proto/tendermint/blocksync/types.pb.go | 2 +- proto/tendermint/consensus/message.go | 2 +- proto/tendermint/consensus/message_test.go | 2 +- proto/tendermint/consensus/types.pb.go | 4 +- proto/tendermint/consensus/wal.pb.go | 20 ++++---- proto/tendermint/crypto/keys.pb.go | 4 +- proto/tendermint/crypto/proof.pb.go | 4 +- proto/tendermint/libs/bits/types.pb.go | 2 +- proto/tendermint/mempool/types.pb.go | 2 +- proto/tendermint/p2p/conn.pb.go | 4 +- proto/tendermint/p2p/envelope.go | 2 +- proto/tendermint/p2p/pex.pb.go | 4 +- proto/tendermint/p2p/types.pb.go | 26 +++++----- proto/tendermint/privval/service.pb.go | 10 ++-- proto/tendermint/privval/types.pb.go | 4 +- proto/tendermint/state/types.pb.go | 14 +++--- proto/tendermint/statesync/types.pb.go | 4 +- proto/tendermint/types/block.pb.go | 4 +- proto/tendermint/types/canonical.pb.go | 14 +++--- proto/tendermint/types/dash.pb.go | 4 +- proto/tendermint/types/events.pb.go | 2 +- proto/tendermint/types/evidence.pb.go | 14 +++--- proto/tendermint/types/params.pb.go | 48 +++++++++---------- proto/tendermint/types/types.pb.go | 20 ++++---- proto/tendermint/types/validator.pb.go | 4 +- proto/tendermint/version/types.pb.go | 4 +- scripts/scmigrate/migrate.go | 2 +- scripts/scmigrate/migrate_test.go | 2 +- test/e2e/runner/setup.go | 2 +- types/block.go | 4 +- types/block_test.go | 2 +- types/encoding_helper.go | 2 +- types/proposal_test.go | 2 +- types/vote_test.go | 2 +- 101 files changed, 253 insertions(+), 241 deletions(-) create mode 100644 buf.lock delete mode 100644 buf.work.yaml create mode 100644 buf.yaml delete mode 100644 proto/buf.lock delete mode 100644 proto/buf.yaml diff --git a/.github/workflows/check-generated.yml b/.github/workflows/check-generated.yml index ef1ba49dfe..6399d97576 100644 --- a/.github/workflows/check-generated.yml +++ b/.github/workflows/check-generated.yml @@ -75,7 +75,7 @@ jobs: export GOBIN="${tools}/bin" go install github.com/bufbuild/buf/cmd/buf - go install github.com/gogo/protobuf/protoc-gen-gogofaster@latest + go install github.com/cosmos/gogoproto/protoc-gen-gogofaster@latest make proto-gen diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index bfa56bea64..4744088a58 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -106,7 +106,7 @@ specify exactly the dependency you want to update, eg. ## Protobuf We use [Protocol Buffers](https://developers.google.com/protocol-buffers) along -with [`gogoproto`](https://github.com/gogo/protobuf) to generate code for use +with [`gogoproto`](https://github.com/cosmos/gogoproto) to generate code for use across Tendermint Core. To generate proto stubs, lint, and check protos for breaking changes, you will @@ -283,8 +283,8 @@ cd test/e2e && \ ### Model-based tests (ADVANCED) -*NOTE: if you're just submitting your first PR, you won't need to touch these -most probably (99.9%)*. +_NOTE: if you're just submitting your first PR, you won't need to touch these +most probably (99.9%)_. For components, that have been [formally verified](https://en.wikipedia.org/wiki/Formal_verification) using @@ -304,8 +304,8 @@ Run: `cd light/mbt && go test` ### Fuzz tests (ADVANCED) -*NOTE: if you're just submitting your first PR, you won't need to touch these -most probably (99.9%)*. +_NOTE: if you're just submitting your first PR, you won't need to touch these +most probably (99.9%)_. [Fuzz tests](https://en.wikipedia.org/wiki/Fuzzing) can be found inside the `./test/fuzz` directory. See [README.md](./test/fuzz/README.md) for details. @@ -314,8 +314,8 @@ Run: `cd test/fuzz && make fuzz-{PACKAGE-COMPONENT}` ### Jepsen tests (ADVANCED) -*NOTE: if you're just submitting your first PR, you won't need to touch these -most probably (99.9%)*. +_NOTE: if you're just submitting your first PR, you won't need to touch these +most probably (99.9%)_. [Jepsen](http://jepsen.io/) tests are used to verify the [linearizability](https://jepsen.io/consistency/models/linearizable) property diff --git a/Makefile b/Makefile index bece30ccc5..10c3ab29e6 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ BUILD_IMAGE := ghcr.io/tendermint/docker-build-proto BASE_BRANCH ?= v0.8-dev DOCKER_PROTO := docker run -v $(shell pwd):/workspace --workdir /workspace $(BUILD_IMAGE) CGO_ENABLED ?= 1 -GOGOPROTO_PATH = $(shell go list -m -f '{{.Dir}}' github.com/gogo/protobuf) +GOGOPROTO_PATH = $(shell go list -m -f '{{.Dir}}' github.com/cosmos/gogoproto) MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CURR_DIR := $(dir $(MAKEFILE_PATH)) @@ -114,7 +114,7 @@ proto: proto-format proto-lint proto-doc proto-gen check-proto-deps: ifeq (,$(shell which protoc-gen-gogofaster)) - $(error "gogofaster plugin for protoc is required. Run 'go install github.com/gogo/protobuf/protoc-gen-gogofaster@latest' to install") + $(error "gogofaster plugin for protoc is required. Run 'go install github.com/cosmos/gogoproto/protoc-gen-gogofaster@latest' to install") endif .PHONY: check-proto-deps diff --git a/abci/example/kvstore/config.go b/abci/example/kvstore/config.go index e064954350..abb050679d 100644 --- a/abci/example/kvstore/config.go +++ b/abci/example/kvstore/config.go @@ -8,7 +8,7 @@ import ( "sort" "strconv" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" abci "github.com/dashpay/tenderdash/abci/types" "github.com/dashpay/tenderdash/crypto" diff --git a/abci/example/kvstore/kvstore.go b/abci/example/kvstore/kvstore.go index bf952d5ab4..6c322ade1f 100644 --- a/abci/example/kvstore/kvstore.go +++ b/abci/example/kvstore/kvstore.go @@ -13,8 +13,8 @@ import ( sync "github.com/sasha-s/go-deadlock" dbm "github.com/cometbft/cometbft-db" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/dashd-go/btcjson" - "github.com/gogo/protobuf/proto" "github.com/dashpay/tenderdash/abci/example/code" abci "github.com/dashpay/tenderdash/abci/types" diff --git a/abci/types/messages.go b/abci/types/messages.go index 4a749fc83a..fed82db198 100644 --- a/abci/types/messages.go +++ b/abci/types/messages.go @@ -3,7 +3,7 @@ package types import ( "io" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/internal/libs/protoio" ) diff --git a/abci/types/messages_test.go b/abci/types/messages_test.go index 7e79f1d353..1f5ca58eb9 100644 --- a/abci/types/messages_test.go +++ b/abci/types/messages_test.go @@ -6,7 +6,7 @@ import ( "strings" "testing" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/assert" tmproto "github.com/dashpay/tenderdash/proto/tendermint/types" diff --git a/abci/types/types.go b/abci/types/types.go index f9623c9709..1a5025e057 100644 --- a/abci/types/types.go +++ b/abci/types/types.go @@ -5,7 +5,7 @@ import ( "encoding/json" "fmt" - "github.com/gogo/protobuf/jsonpb" + "github.com/cosmos/gogoproto/jsonpb" "github.com/rs/zerolog" "github.com/dashpay/tenderdash/crypto" diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index f60329ec91..178d8b1c57 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -6,13 +6,14 @@ package types import ( context "context" fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/gogoproto/types" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" crypto "github.com/dashpay/tenderdash/proto/tendermint/crypto" types1 "github.com/dashpay/tenderdash/proto/tendermint/types" version "github.com/dashpay/tenderdash/proto/tendermint/version" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -4638,10 +4639,10 @@ type ABCIApplicationClient interface { } type aBCIApplicationClient struct { - cc *grpc.ClientConn + cc grpc1.ClientConn } -func NewABCIApplicationClient(cc *grpc.ClientConn) ABCIApplicationClient { +func NewABCIApplicationClient(cc grpc1.ClientConn) ABCIApplicationClient { return &aBCIApplicationClient{cc} } @@ -4850,7 +4851,7 @@ func (*UnimplementedABCIApplicationServer) FinalizeBlock(ctx context.Context, re return nil, status.Errorf(codes.Unimplemented, "method FinalizeBlock not implemented") } -func RegisterABCIApplicationServer(s *grpc.Server, srv ABCIApplicationServer) { +func RegisterABCIApplicationServer(s grpc1.Server, srv ABCIApplicationServer) { s.RegisterService(&_ABCIApplication_serviceDesc, srv) } @@ -5124,6 +5125,7 @@ func _ABCIApplication_FinalizeBlock_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } +var ABCIApplication_serviceDesc = _ABCIApplication_serviceDesc var _ABCIApplication_serviceDesc = grpc.ServiceDesc{ ServiceName: "tendermint.abci.ABCIApplication", HandlerType: (*ABCIApplicationServer)(nil), @@ -5716,7 +5718,7 @@ func (m *RequestInitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - n18, err18 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + n18, err18 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) if err18 != nil { return 0, err18 } @@ -6031,7 +6033,7 @@ func (m *RequestPrepareProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x3a } - n21, err21 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + n21, err21 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) if err21 != nil { return 0, err21 } @@ -6160,7 +6162,7 @@ func (m *RequestProcessProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) i-- dAtA[i] = 0x42 } - n25, err25 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + n25, err25 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) if err25 != nil { return 0, err25 } @@ -7003,7 +7005,7 @@ func (m *ResponseInitChain_GenesisTime) MarshalTo(dAtA []byte) (int, error) { func (m *ResponseInitChain_GenesisTime) MarshalToSizedBuffer(dAtA []byte) (int, error) { i := len(dAtA) if m.GenesisTime != nil { - n49, err49 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.GenesisTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.GenesisTime):]) + n49, err49 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.GenesisTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.GenesisTime):]) if err49 != nil { return 0, err49 } @@ -8285,7 +8287,7 @@ func (m *Misbehavior) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x28 } - n62, err62 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + n62, err62 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) if err62 != nil { return 0, err62 } @@ -8617,7 +8619,7 @@ func (m *RequestInitChain) Size() (n int) { } var l int _ = l - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Time) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time) n += 1 + l + sovTypes(uint64(l)) l = len(m.ChainId) if l > 0 { @@ -8775,7 +8777,7 @@ func (m *RequestPrepareProposal) Size() (n int) { if m.Height != 0 { n += 1 + sovTypes(uint64(m.Height)) } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Time) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time) n += 1 + l + sovTypes(uint64(l)) l = len(m.NextValidatorsHash) if l > 0 { @@ -8835,7 +8837,7 @@ func (m *RequestProcessProposal) Size() (n int) { if m.Round != 0 { n += 1 + sovTypes(uint64(m.Round)) } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Time) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time) n += 1 + l + sovTypes(uint64(l)) l = len(m.NextValidatorsHash) if l > 0 { @@ -9251,7 +9253,7 @@ func (m *ResponseInitChain_GenesisTime) Size() (n int) { var l int _ = l if m.GenesisTime != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.GenesisTime) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.GenesisTime) n += 1 + l + sovTypes(uint64(l)) } return n @@ -9818,7 +9820,7 @@ func (m *Misbehavior) Size() (n int) { if m.Height != 0 { n += 1 + sovTypes(uint64(m.Height)) } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Time) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time) n += 1 + l + sovTypes(uint64(l)) if m.TotalVotingPower != 0 { n += 1 + sovTypes(uint64(m.TotalVotingPower)) @@ -10772,7 +10774,7 @@ func (m *RequestInitChain) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -11868,7 +11870,7 @@ func (m *RequestPrepareProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -12317,7 +12319,7 @@ func (m *RequestProcessProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -14354,7 +14356,7 @@ func (m *ResponseInitChain) Unmarshal(dAtA []byte) error { return io.ErrUnexpectedEOF } v := new(time.Time) - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(v, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(v, dAtA[iNdEx:postIndex]); err != nil { return err } m.XGenesisTime = &ResponseInitChain_GenesisTime{v} @@ -18098,7 +18100,7 @@ func (m *Misbehavior) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/buf.gen.yaml b/buf.gen.yaml index d972360bbd..9b2523d8c6 100644 --- a/buf.gen.yaml +++ b/buf.gen.yaml @@ -1,9 +1,9 @@ -version: v1 +version: v2 plugins: - - name: gogofaster + - local: protoc-gen-gogofaster out: ./proto/ opt: - - Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types + - Mgoogle/protobuf/timestamp.proto=github.com/cosmos/gogoproto/types - Mgoogle/protobuf/duration.proto=github.com/golang/protobuf/ptypes/duration - plugins=grpc - paths=source_relative diff --git a/buf.lock b/buf.lock new file mode 100644 index 0000000000..dcd25a3205 --- /dev/null +++ b/buf.lock @@ -0,0 +1,6 @@ +# Generated by buf. DO NOT EDIT. +version: v2 +deps: + - name: buf.build/cosmos/gogo-proto + commit: 88ef6483f90f478fb938c37dde52ece3 + digest: b5:f0c69202c9bca9672dc72a9737ea9bc83744daaed2b3da77e3a95b0e53b86dee76b5a7405b993181d6c863fd64afaca0976a302f700d6c4912eb1692a1782c0a diff --git a/buf.work.yaml b/buf.work.yaml deleted file mode 100644 index 1878b341be..0000000000 --- a/buf.work.yaml +++ /dev/null @@ -1,3 +0,0 @@ -version: v1 -directories: - - proto diff --git a/buf.yaml b/buf.yaml new file mode 100644 index 0000000000..9d91c26fa6 --- /dev/null +++ b/buf.yaml @@ -0,0 +1,20 @@ +version: v2 +modules: + - path: proto +deps: + - buf.build/cosmos/gogo-proto +lint: + use: + - BASIC + - FILE_LOWER_SNAKE_CASE + - UNARY_RPC + except: + - FIELD_NOT_REQUIRED + - PACKAGE_NO_IMPORT_CYCLE + disallow_comment_ignores: true +breaking: + use: + - FILE + except: + - EXTENSION_NO_DELETE + - FIELD_SAME_DEFAULT diff --git a/cmd/abcidump/cmd/parse_test.go b/cmd/abcidump/cmd/parse_test.go index 9e5ee5e839..943805e6ad 100644 --- a/cmd/abcidump/cmd/parse_test.go +++ b/cmd/abcidump/cmd/parse_test.go @@ -7,7 +7,7 @@ import ( "fmt" "testing" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/cmd/abcidump/parser/parser.go b/cmd/abcidump/parser/parser.go index e29e8b15ed..7836e81730 100644 --- a/cmd/abcidump/parser/parser.go +++ b/cmd/abcidump/parser/parser.go @@ -4,8 +4,8 @@ import ( "bytes" "io" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/jsonpb" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/abci/types" ) diff --git a/cmd/abcidump/parser/parser_test.go b/cmd/abcidump/parser/parser_test.go index 871a63ecb7..3773f8ae70 100644 --- a/cmd/abcidump/parser/parser_test.go +++ b/cmd/abcidump/parser/parser_test.go @@ -5,7 +5,7 @@ import ( "strconv" "testing" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" "github.com/dashpay/tenderdash/abci/types" diff --git a/cmd/abcidump/parser/types.go b/cmd/abcidump/parser/types.go index 15fb4447ff..2e8f5f5bfa 100644 --- a/cmd/abcidump/parser/types.go +++ b/cmd/abcidump/parser/types.go @@ -5,7 +5,7 @@ import ( "io" "reflect" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" protoAbci "github.com/dashpay/tenderdash/abci/types" protoP2p "github.com/dashpay/tenderdash/proto/tendermint/p2p" diff --git a/go.mod b/go.mod index cdf75b062a..f1da512b8e 100644 --- a/go.mod +++ b/go.mod @@ -14,7 +14,7 @@ require ( github.com/fortytw2/leaktest v1.3.0 github.com/fxamacker/cbor/v2 v2.4.0 github.com/go-kit/kit v0.13.0 - github.com/gogo/protobuf v1.3.2 + github.com/gogo/protobuf v1.3.2 // indirect github.com/golang/protobuf v1.5.4 github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/golangci/golangci-lint v1.63.4 @@ -369,6 +369,7 @@ require ( require ( github.com/cometbft/cometbft-db v1.0.3 + github.com/cosmos/gogoproto v1.7.0 github.com/creachadair/tomledit v0.0.27 github.com/jonboulle/clockwork v0.5.0 github.com/oasisprotocol/oasis-core/go v0.2500.0 diff --git a/go.sum b/go.sum index 5fcb4645d0..97dbd6d660 100644 --- a/go.sum +++ b/go.sum @@ -201,6 +201,8 @@ github.com/containerd/ttrpc v1.2.7/go.mod h1:YCXHsb32f+Sq5/72xHubdiJRQY9inL4a4ZQ github.com/containerd/typeurl/v2 v2.2.3 h1:yNA/94zxWdvYACdYO8zofhrTVuQY73fFU1y++dYSw40= github.com/containerd/typeurl/v2 v2.2.3/go.mod h1:95ljDnPfD3bAbDJRugOiShd/DlAAsxGtUBhJxIn7SCk= github.com/coreos/go-systemd/v22 v22.3.3-0.20220203105225-a9a7ef127534/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= +github.com/cosmos/gogoproto v1.7.0 h1:79USr0oyXAbxg3rspGh/m4SWNyoz/GLaAh0QlCe2fro= +github.com/cosmos/gogoproto v1.7.0/go.mod h1:yWChEv5IUEYURQasfyBW5ffkMHR/90hiHgbNgrtp4j0= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= diff --git a/internal/blocksync/p2p_msg_handler.go b/internal/blocksync/p2p_msg_handler.go index babb5966de..9ef926e385 100644 --- a/internal/blocksync/p2p_msg_handler.go +++ b/internal/blocksync/p2p_msg_handler.go @@ -4,7 +4,7 @@ import ( "context" "fmt" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/internal/p2p" "github.com/dashpay/tenderdash/internal/p2p/client" diff --git a/internal/blocksync/p2p_msg_handler_test.go b/internal/blocksync/p2p_msg_handler_test.go index 2e85d1c1e0..3ff7f3fbd7 100644 --- a/internal/blocksync/p2p_msg_handler_test.go +++ b/internal/blocksync/p2p_msg_handler_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/google/uuid" "github.com/stretchr/testify/mock" "github.com/stretchr/testify/suite" diff --git a/internal/consensus/gossip_msg_sender.go b/internal/consensus/gossip_msg_sender.go index 21a544a92a..db08373bfb 100644 --- a/internal/consensus/gossip_msg_sender.go +++ b/internal/consensus/gossip_msg_sender.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/internal/p2p" "github.com/dashpay/tenderdash/libs/log" diff --git a/internal/consensus/gossip_msg_sender_test.go b/internal/consensus/gossip_msg_sender_test.go index 15684d9520..25e68cc439 100644 --- a/internal/consensus/gossip_msg_sender_test.go +++ b/internal/consensus/gossip_msg_sender_test.go @@ -5,7 +5,7 @@ import ( "fmt" "testing" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" "github.com/dashpay/tenderdash/internal/p2p" diff --git a/internal/consensus/gossiper.go b/internal/consensus/gossiper.go index fda600cced..e3269c1cd4 100644 --- a/internal/consensus/gossiper.go +++ b/internal/consensus/gossiper.go @@ -6,7 +6,7 @@ import ( "context" "fmt" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/hashicorp/go-multierror" cstypes "github.com/dashpay/tenderdash/internal/consensus/types" diff --git a/internal/consensus/gossiper_test.go b/internal/consensus/gossiper_test.go index fdfb30e440..3c2c4a7fd8 100644 --- a/internal/consensus/gossiper_test.go +++ b/internal/consensus/gossiper_test.go @@ -7,7 +7,7 @@ import ( "testing" "time" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/suite" "github.com/dashpay/tenderdash/crypto" diff --git a/internal/consensus/msgs.go b/internal/consensus/msgs.go index bde6a81353..929baed69e 100644 --- a/internal/consensus/msgs.go +++ b/internal/consensus/msgs.go @@ -4,7 +4,7 @@ import ( "errors" "fmt" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" cstypes "github.com/dashpay/tenderdash/internal/consensus/types" "github.com/dashpay/tenderdash/internal/jsontypes" diff --git a/internal/consensus/msgs_test.go b/internal/consensus/msgs_test.go index 2dea8c9bed..de48a7057d 100644 --- a/internal/consensus/msgs_test.go +++ b/internal/consensus/msgs_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/consensus/reactor.go b/internal/consensus/reactor.go index 3b6e165290..de4492485d 100644 --- a/internal/consensus/reactor.go +++ b/internal/consensus/reactor.go @@ -9,7 +9,7 @@ import ( sync "github.com/sasha-s/go-deadlock" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" cstypes "github.com/dashpay/tenderdash/internal/consensus/types" "github.com/dashpay/tenderdash/internal/eventbus" diff --git a/internal/consensus/replay_test.go b/internal/consensus/replay_test.go index 4f12f9d8ca..4b9e9ef875 100644 --- a/internal/consensus/replay_test.go +++ b/internal/consensus/replay_test.go @@ -13,9 +13,9 @@ import ( "time" dbm "github.com/cometbft/cometbft-db" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/dashd-go/btcjson" "github.com/fortytw2/leaktest" - "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/consensus/state_add_prop_block.go b/internal/consensus/state_add_prop_block.go index 31fbffce00..4a13c744c2 100644 --- a/internal/consensus/state_add_prop_block.go +++ b/internal/consensus/state_add_prop_block.go @@ -6,7 +6,7 @@ import ( "fmt" "io" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" cstypes "github.com/dashpay/tenderdash/internal/consensus/types" tmstrings "github.com/dashpay/tenderdash/internal/libs/strings" diff --git a/internal/consensus/wal.go b/internal/consensus/wal.go index 1c3c249801..444c2155f6 100644 --- a/internal/consensus/wal.go +++ b/internal/consensus/wal.go @@ -10,7 +10,7 @@ import ( "path/filepath" "time" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/internal/jsontypes" auto "github.com/dashpay/tenderdash/internal/libs/autofile" diff --git a/internal/evidence/pool.go b/internal/evidence/pool.go index 128fa85cbe..705a604d93 100644 --- a/internal/evidence/pool.go +++ b/internal/evidence/pool.go @@ -11,8 +11,8 @@ import ( sync "github.com/sasha-s/go-deadlock" dbm "github.com/cometbft/cometbft-db" - "github.com/gogo/protobuf/proto" - gogotypes "github.com/gogo/protobuf/types" + "github.com/cosmos/gogoproto/proto" + gogotypes "github.com/cosmos/gogoproto/types" "github.com/google/orderedcode" "github.com/dashpay/tenderdash/internal/eventbus" diff --git a/internal/libs/protoio/io.go b/internal/libs/protoio/io.go index b12a1d4822..cd5846b943 100644 --- a/internal/libs/protoio/io.go +++ b/internal/libs/protoio/io.go @@ -1,7 +1,7 @@ // Protocol Buffers for Go with Gadgets // // Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf +// http://github.com/cosmos/gogoproto // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -33,7 +33,7 @@ package protoio import ( "io" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" ) type Writer interface { diff --git a/internal/libs/protoio/io_test.go b/internal/libs/protoio/io_test.go index 4c57005e47..0183a53722 100644 --- a/internal/libs/protoio/io_test.go +++ b/internal/libs/protoio/io_test.go @@ -1,7 +1,7 @@ // Protocol Buffers for Go with Gadgets // // Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf +// http://github.com/cosmos/gogoproto // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -37,8 +37,8 @@ import ( "testing" "time" - "github.com/gogo/protobuf/proto" - "github.com/gogo/protobuf/test" + "github.com/cosmos/gogoproto/proto" + "github.com/cosmos/gogoproto/test" "github.com/stretchr/testify/require" "github.com/dashpay/tenderdash/internal/libs/protoio" diff --git a/internal/libs/protoio/reader.go b/internal/libs/protoio/reader.go index 66eed707cc..7a49f9e4d9 100644 --- a/internal/libs/protoio/reader.go +++ b/internal/libs/protoio/reader.go @@ -1,7 +1,7 @@ // Protocol Buffers for Go with Gadgets // // Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf +// http://github.com/cosmos/gogoproto // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -36,7 +36,7 @@ import ( "fmt" "io" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" ) // NewDelimitedReader reads varint-delimited Protobuf messages from a reader. diff --git a/internal/libs/protoio/writer.go b/internal/libs/protoio/writer.go index c2305fa2e6..929830744b 100644 --- a/internal/libs/protoio/writer.go +++ b/internal/libs/protoio/writer.go @@ -1,7 +1,7 @@ // Protocol Buffers for Go with Gadgets // // Copyright (c) 2013, The GoGo Authors. All rights reserved. -// http://github.com/gogo/protobuf +// http://github.com/cosmos/gogoproto // // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are @@ -37,7 +37,7 @@ import ( "sync" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" ) // NewDelimitedWriter writes a varint-delimited Protobuf message to a writer. It is diff --git a/internal/libs/protoio/writer_test.go b/internal/libs/protoio/writer_test.go index d1a3a8cee0..3a3300b646 100644 --- a/internal/libs/protoio/writer_test.go +++ b/internal/libs/protoio/writer_test.go @@ -3,7 +3,7 @@ package protoio_test import ( "testing" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" "github.com/dashpay/tenderdash/crypto" diff --git a/internal/p2p/channel.go b/internal/p2p/channel.go index c77b4f39f9..3185bb5a9b 100644 --- a/internal/p2p/channel.go +++ b/internal/p2p/channel.go @@ -8,8 +8,8 @@ import ( "fmt" "reflect" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/jsonpb" + "github.com/cosmos/gogoproto/proto" "github.com/rs/zerolog" sync "github.com/sasha-s/go-deadlock" "golang.org/x/time/rate" diff --git a/internal/p2p/channel_params.go b/internal/p2p/channel_params.go index d9580e2479..cf4cf48d84 100644 --- a/internal/p2p/channel_params.go +++ b/internal/p2p/channel_params.go @@ -3,7 +3,7 @@ package p2p import ( "fmt" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/config" "github.com/dashpay/tenderdash/proto/tendermint/blocksync" diff --git a/internal/p2p/client/client.go b/internal/p2p/client/client.go index ea6d4a08b8..82fabaa233 100644 --- a/internal/p2p/client/client.go +++ b/internal/p2p/client/client.go @@ -10,7 +10,7 @@ import ( "sync" "time" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/google/uuid" "github.com/hashicorp/go-multierror" "github.com/jonboulle/clockwork" diff --git a/internal/p2p/client/client_test.go b/internal/p2p/client/client_test.go index 5fa0150b4b..43c4438dc0 100644 --- a/internal/p2p/client/client_test.go +++ b/internal/p2p/client/client_test.go @@ -8,7 +8,7 @@ import ( "testing" "time" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/google/uuid" "github.com/jonboulle/clockwork" "github.com/stretchr/testify/mock" diff --git a/internal/p2p/conn/connection.go b/internal/p2p/conn/connection.go index 7ff317a1e9..ab0ca03b44 100644 --- a/internal/p2p/conn/connection.go +++ b/internal/p2p/conn/connection.go @@ -15,7 +15,7 @@ import ( sync "github.com/sasha-s/go-deadlock" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/internal/libs/flowrate" "github.com/dashpay/tenderdash/internal/libs/protoio" diff --git a/internal/p2p/conn/connection_test.go b/internal/p2p/conn/connection_test.go index 55c2460c65..c2e34046b6 100644 --- a/internal/p2p/conn/connection_test.go +++ b/internal/p2p/conn/connection_test.go @@ -10,8 +10,8 @@ import ( sync "github.com/sasha-s/go-deadlock" + "github.com/cosmos/gogoproto/proto" "github.com/fortytw2/leaktest" - "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/p2p/conn/evil_secret_connection_test.go b/internal/p2p/conn/evil_secret_connection_test.go index 08d426e9bd..967e84945e 100644 --- a/internal/p2p/conn/evil_secret_connection_test.go +++ b/internal/p2p/conn/evil_secret_connection_test.go @@ -6,7 +6,7 @@ import ( "io" "testing" - gogotypes "github.com/gogo/protobuf/types" + gogotypes "github.com/cosmos/gogoproto/types" "github.com/oasisprotocol/curve25519-voi/primitives/merlin" "github.com/stretchr/testify/assert" "golang.org/x/crypto/chacha20poly1305" diff --git a/internal/p2p/conn/secret_connection.go b/internal/p2p/conn/secret_connection.go index 222fc1b69a..d932ee6fc4 100644 --- a/internal/p2p/conn/secret_connection.go +++ b/internal/p2p/conn/secret_connection.go @@ -15,7 +15,7 @@ import ( sync "github.com/sasha-s/go-deadlock" - gogotypes "github.com/gogo/protobuf/types" + gogotypes "github.com/cosmos/gogoproto/types" pool "github.com/libp2p/go-buffer-pool" "github.com/oasisprotocol/curve25519-voi/primitives/merlin" "golang.org/x/crypto/chacha20poly1305" diff --git a/internal/p2p/p2ptest/require.go b/internal/p2p/p2ptest/require.go index 16804ae81a..323e2d36ea 100644 --- a/internal/p2p/p2ptest/require.go +++ b/internal/p2p/p2ptest/require.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/p2p/peermanager.go b/internal/p2p/peermanager.go index c692753bad..4ce0c3011d 100644 --- a/internal/p2p/peermanager.go +++ b/internal/p2p/peermanager.go @@ -11,8 +11,8 @@ import ( "time" dbm "github.com/cometbft/cometbft-db" - "github.com/gogo/protobuf/jsonpb" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/jsonpb" + "github.com/cosmos/gogoproto/proto" "github.com/google/orderedcode" "github.com/rs/zerolog" sync "github.com/sasha-s/go-deadlock" diff --git a/internal/p2p/pqueue.go b/internal/p2p/pqueue.go index eea4ea2142..0a05150e99 100644 --- a/internal/p2p/pqueue.go +++ b/internal/p2p/pqueue.go @@ -9,7 +9,7 @@ import ( sync "github.com/sasha-s/go-deadlock" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/libs/log" ) diff --git a/internal/p2p/pqueue_test.go b/internal/p2p/pqueue_test.go index 7058b7e4cc..33a4f5911a 100644 --- a/internal/p2p/pqueue_test.go +++ b/internal/p2p/pqueue_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - gogotypes "github.com/gogo/protobuf/types" + gogotypes "github.com/cosmos/gogoproto/types" "github.com/dashpay/tenderdash/libs/log" ) diff --git a/internal/p2p/router.go b/internal/p2p/router.go index 4ac248e1d6..d626001fbf 100644 --- a/internal/p2p/router.go +++ b/internal/p2p/router.go @@ -12,7 +12,7 @@ import ( sync "github.com/sasha-s/go-deadlock" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/crypto" tmstrings "github.com/dashpay/tenderdash/internal/libs/strings" diff --git a/internal/p2p/router_test.go b/internal/p2p/router_test.go index d3a81cd54d..da7db4a65a 100644 --- a/internal/p2p/router_test.go +++ b/internal/p2p/router_test.go @@ -12,8 +12,8 @@ import ( "time" dbm "github.com/cometbft/cometbft-db" + gogotypes "github.com/cosmos/gogoproto/types" "github.com/fortytw2/leaktest" - gogotypes "github.com/gogo/protobuf/types" sync "github.com/sasha-s/go-deadlock" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/mock" diff --git a/internal/p2p/rqueue.go b/internal/p2p/rqueue.go index a46eefe50f..e55a144e75 100644 --- a/internal/p2p/rqueue.go +++ b/internal/p2p/rqueue.go @@ -6,7 +6,7 @@ import ( "sort" "time" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" ) type simpleQueue struct { diff --git a/internal/state/indexer/sink/kv/kv_test.go b/internal/state/indexer/sink/kv/kv_test.go index bc85895021..ae1d598b48 100644 --- a/internal/state/indexer/sink/kv/kv_test.go +++ b/internal/state/indexer/sink/kv/kv_test.go @@ -7,7 +7,7 @@ import ( dbm "github.com/cometbft/cometbft-db" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/state/indexer/sink/psql/psql.go b/internal/state/indexer/sink/psql/psql.go index dd1c46a206..162c5b4cfa 100644 --- a/internal/state/indexer/sink/psql/psql.go +++ b/internal/state/indexer/sink/psql/psql.go @@ -9,7 +9,7 @@ import ( "strings" "time" - "github.com/gogo/protobuf/jsonpb" + "github.com/cosmos/gogoproto/jsonpb" abci "github.com/dashpay/tenderdash/abci/types" "github.com/dashpay/tenderdash/internal/pubsub/query" diff --git a/internal/state/indexer/sink/psql/psql_test.go b/internal/state/indexer/sink/psql/psql_test.go index 92549c2e77..001684c1f6 100644 --- a/internal/state/indexer/sink/psql/psql_test.go +++ b/internal/state/indexer/sink/psql/psql_test.go @@ -13,7 +13,7 @@ import ( "time" "github.com/adlio/schema" - "github.com/gogo/protobuf/jsonpb" + "github.com/cosmos/gogoproto/jsonpb" "github.com/ory/dockertest" "github.com/ory/dockertest/docker" "github.com/stretchr/testify/assert" diff --git a/internal/state/indexer/tx/kv/kv.go b/internal/state/indexer/tx/kv/kv.go index 411edf5dcc..0de45ade91 100644 --- a/internal/state/indexer/tx/kv/kv.go +++ b/internal/state/indexer/tx/kv/kv.go @@ -8,7 +8,7 @@ import ( "strings" dbm "github.com/cometbft/cometbft-db" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/google/orderedcode" abci "github.com/dashpay/tenderdash/abci/types" diff --git a/internal/state/indexer/tx/kv/kv_test.go b/internal/state/indexer/tx/kv/kv_test.go index 047f09e18d..b93e1fb54e 100644 --- a/internal/state/indexer/tx/kv/kv_test.go +++ b/internal/state/indexer/tx/kv/kv_test.go @@ -6,7 +6,7 @@ import ( "testing" dbm "github.com/cometbft/cometbft-db" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/internal/state/state.go b/internal/state/state.go index cbffe452e3..3b3605e393 100644 --- a/internal/state/state.go +++ b/internal/state/state.go @@ -9,7 +9,7 @@ import ( "testing" "time" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/dash" selectproposer "github.com/dashpay/tenderdash/internal/consensus/versioned/selectproposer" diff --git a/internal/state/store.go b/internal/state/store.go index bbfad95a1e..5a4c6c9a5a 100644 --- a/internal/state/store.go +++ b/internal/state/store.go @@ -6,7 +6,7 @@ import ( "fmt" dbm "github.com/cometbft/cometbft-db" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/google/orderedcode" abci "github.com/dashpay/tenderdash/abci/types" diff --git a/internal/store/store.go b/internal/store/store.go index e5d52e665a..64b5f856f0 100644 --- a/internal/store/store.go +++ b/internal/store/store.go @@ -7,7 +7,7 @@ import ( "strconv" dbm "github.com/cometbft/cometbft-db" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/google/orderedcode" tmproto "github.com/dashpay/tenderdash/proto/tendermint/types" diff --git a/privval/msgs.go b/privval/msgs.go index b0056ad4ba..1f2bcb0e07 100644 --- a/privval/msgs.go +++ b/privval/msgs.go @@ -3,7 +3,7 @@ package privval import ( "fmt" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" privvalproto "github.com/dashpay/tenderdash/proto/tendermint/privval" ) diff --git a/privval/msgs_test.go b/privval/msgs_test.go index 32ba1354e3..d49775f9e7 100644 --- a/privval/msgs_test.go +++ b/privval/msgs_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/privval/secret_connection.go b/privval/secret_connection.go index 3095125804..84f028b025 100644 --- a/privval/secret_connection.go +++ b/privval/secret_connection.go @@ -15,7 +15,7 @@ import ( sync "github.com/sasha-s/go-deadlock" - gogotypes "github.com/gogo/protobuf/types" + gogotypes "github.com/cosmos/gogoproto/types" pool "github.com/libp2p/go-buffer-pool" "github.com/oasisprotocol/curve25519-voi/primitives/merlin" "golang.org/x/crypto/chacha20poly1305" diff --git a/privval/signer_requestHandler.go b/privval/signer_requestHandler.go index 61c9dc06df..cc6230050d 100644 --- a/privval/signer_requestHandler.go +++ b/privval/signer_requestHandler.go @@ -6,7 +6,7 @@ import ( "github.com/dashpay/dashd-go/btcjson" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/crypto" cryptoenc "github.com/dashpay/tenderdash/crypto/encoding" diff --git a/proto/buf.lock b/proto/buf.lock deleted file mode 100644 index 8c415e1af0..0000000000 --- a/proto/buf.lock +++ /dev/null @@ -1,7 +0,0 @@ -# Generated by buf. DO NOT EDIT. -version: v1 -deps: - - remote: buf.build - owner: gogo - repository: protobuf - commit: 4df00b267f944190a229ce3695781e99 diff --git a/proto/buf.yaml b/proto/buf.yaml deleted file mode 100644 index 816db10f76..0000000000 --- a/proto/buf.yaml +++ /dev/null @@ -1,11 +0,0 @@ -version: v1 -deps: - - buf.build/gogo/protobuf -breaking: - use: - - FILE -lint: - use: - - BASIC - - FILE_LOWER_SNAKE_CASE - - UNARY_RPC diff --git a/proto/tendermint/abci/types.proto b/proto/tendermint/abci/types.proto index 3453c1ce4a..c9f6eeabc3 100644 --- a/proto/tendermint/abci/types.proto +++ b/proto/tendermint/abci/types.proto @@ -15,7 +15,7 @@ import "gogoproto/gogo.proto"; // NOTE: When using custom types, mind the warnings. // -// https://github.com/gogo/protobuf/blob/master/custom_types.md#warnings-and-issues +// https://github.com/cosmos/gogoproto/blob/master/custom_types.md#warnings-and-issues // //---------------------------------------- diff --git a/proto/tendermint/blocksync/types.pb.go b/proto/tendermint/blocksync/types.pb.go index b969b4abd4..ba8a002f3f 100644 --- a/proto/tendermint/blocksync/types.pb.go +++ b/proto/tendermint/blocksync/types.pb.go @@ -5,8 +5,8 @@ package blocksync import ( fmt "fmt" + proto "github.com/cosmos/gogoproto/proto" types "github.com/dashpay/tenderdash/proto/tendermint/types" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/consensus/message.go b/proto/tendermint/consensus/message.go index 7c3f4ef992..34d384abc2 100644 --- a/proto/tendermint/consensus/message.go +++ b/proto/tendermint/consensus/message.go @@ -3,7 +3,7 @@ package consensus import ( "fmt" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" ) // Wrap implements the p2p Wrapper interface and wraps a consensus proto message. diff --git a/proto/tendermint/consensus/message_test.go b/proto/tendermint/consensus/message_test.go index 8c1a2c9a97..23ea7a9c04 100644 --- a/proto/tendermint/consensus/message_test.go +++ b/proto/tendermint/consensus/message_test.go @@ -5,7 +5,7 @@ import ( "math" "testing" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/stretchr/testify/require" tmcons "github.com/dashpay/tenderdash/proto/tendermint/consensus" diff --git a/proto/tendermint/consensus/types.pb.go b/proto/tendermint/consensus/types.pb.go index 076ffe4a37..d8db55ed93 100644 --- a/proto/tendermint/consensus/types.pb.go +++ b/proto/tendermint/consensus/types.pb.go @@ -5,10 +5,10 @@ package consensus import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" bits "github.com/dashpay/tenderdash/proto/tendermint/libs/bits" types "github.com/dashpay/tenderdash/proto/tendermint/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/consensus/wal.pb.go b/proto/tendermint/consensus/wal.pb.go index c4722100f2..52dac8deaf 100644 --- a/proto/tendermint/consensus/wal.pb.go +++ b/proto/tendermint/consensus/wal.pb.go @@ -5,11 +5,11 @@ package consensus import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/gogoproto/types" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" types "github.com/dashpay/tenderdash/proto/tendermint/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" _ "github.com/golang/protobuf/ptypes/duration" io "io" math "math" @@ -485,7 +485,7 @@ func (m *TimeoutInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x10 } - n2, err2 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.Duration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.Duration):]) + n2, err2 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.Duration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.Duration):]) if err2 != nil { return 0, err2 } @@ -672,7 +672,7 @@ func (m *TimedWALMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x12 } - n8, err8 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + n8, err8 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) if err8 != nil { return 0, err8 } @@ -715,7 +715,7 @@ func (m *TimeoutInfo) Size() (n int) { } var l int _ = l - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.Duration) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.Duration) n += 1 + l + sovWal(uint64(l)) if m.Height != 0 { n += 1 + sovWal(uint64(m.Height)) @@ -807,7 +807,7 @@ func (m *TimedWALMessage) Size() (n int) { } var l int _ = l - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Time) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time) n += 1 + l + sovWal(uint64(l)) if m.Msg != nil { l = m.Msg.Size() @@ -995,7 +995,7 @@ func (m *TimeoutInfo) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.Duration, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.Duration, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -1394,7 +1394,7 @@ func (m *TimedWALMessage) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/proto/tendermint/crypto/keys.pb.go b/proto/tendermint/crypto/keys.pb.go index f1b862ea75..62b06df7ab 100644 --- a/proto/tendermint/crypto/keys.pb.go +++ b/proto/tendermint/crypto/keys.pb.go @@ -6,8 +6,8 @@ package crypto import ( bytes "bytes" fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/crypto/proof.pb.go b/proto/tendermint/crypto/proof.pb.go index 5ece1e5579..1831de7236 100644 --- a/proto/tendermint/crypto/proof.pb.go +++ b/proto/tendermint/crypto/proof.pb.go @@ -5,8 +5,8 @@ package crypto import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/libs/bits/types.pb.go b/proto/tendermint/libs/bits/types.pb.go index 29bb8e901d..97445df26e 100644 --- a/proto/tendermint/libs/bits/types.pb.go +++ b/proto/tendermint/libs/bits/types.pb.go @@ -5,7 +5,7 @@ package bits import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/mempool/types.pb.go b/proto/tendermint/mempool/types.pb.go index ab074c9c35..b38e602520 100644 --- a/proto/tendermint/mempool/types.pb.go +++ b/proto/tendermint/mempool/types.pb.go @@ -5,7 +5,7 @@ package mempool import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/p2p/conn.pb.go b/proto/tendermint/p2p/conn.pb.go index 3a2727cd08..1b57bf3cc5 100644 --- a/proto/tendermint/p2p/conn.pb.go +++ b/proto/tendermint/p2p/conn.pb.go @@ -5,9 +5,9 @@ package p2p import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" crypto "github.com/dashpay/tenderdash/proto/tendermint/crypto" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/p2p/envelope.go b/proto/tendermint/p2p/envelope.go index de9d60414f..310d0547f5 100644 --- a/proto/tendermint/p2p/envelope.go +++ b/proto/tendermint/p2p/envelope.go @@ -3,7 +3,7 @@ package p2p import ( "fmt" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/proto/tendermint/blocksync" "github.com/dashpay/tenderdash/proto/tendermint/consensus" diff --git a/proto/tendermint/p2p/pex.pb.go b/proto/tendermint/p2p/pex.pb.go index 750596fa0a..ff6f3fc496 100644 --- a/proto/tendermint/p2p/pex.pb.go +++ b/proto/tendermint/p2p/pex.pb.go @@ -5,8 +5,8 @@ package p2p import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/p2p/types.pb.go b/proto/tendermint/p2p/types.pb.go index 0f1e210ac6..de977db334 100644 --- a/proto/tendermint/p2p/types.pb.go +++ b/proto/tendermint/p2p/types.pb.go @@ -5,15 +5,15 @@ package p2p import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/gogoproto/types" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" blocksync "github.com/dashpay/tenderdash/proto/tendermint/blocksync" consensus "github.com/dashpay/tenderdash/proto/tendermint/consensus" mempool "github.com/dashpay/tenderdash/proto/tendermint/mempool" statesync "github.com/dashpay/tenderdash/proto/tendermint/statesync" types1 "github.com/dashpay/tenderdash/proto/tendermint/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" io "io" math "math" math_bits "math/bits" @@ -1208,7 +1208,7 @@ func (m *PeerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x20 } if m.LastConnected != nil { - n5, err5 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.LastConnected, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.LastConnected):]) + n5, err5 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.LastConnected, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.LastConnected):]) if err5 != nil { return 0, err5 } @@ -1267,7 +1267,7 @@ func (m *PeerAddressInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x20 } if m.LastDialFailure != nil { - n6, err6 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.LastDialFailure, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.LastDialFailure):]) + n6, err6 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.LastDialFailure, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.LastDialFailure):]) if err6 != nil { return 0, err6 } @@ -1277,7 +1277,7 @@ func (m *PeerAddressInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } if m.LastDialSuccess != nil { - n7, err7 := github_com_gogo_protobuf_types.StdTimeMarshalTo(*m.LastDialSuccess, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(*m.LastDialSuccess):]) + n7, err7 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.LastDialSuccess, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.LastDialSuccess):]) if err7 != nil { return 0, err7 } @@ -2123,7 +2123,7 @@ func (m *PeerInfo) Size() (n int) { } } if m.LastConnected != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.LastConnected) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.LastConnected) n += 1 + l + sovTypes(uint64(l)) } if m.Inactive { @@ -2147,11 +2147,11 @@ func (m *PeerAddressInfo) Size() (n int) { n += 1 + l + sovTypes(uint64(l)) } if m.LastDialSuccess != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.LastDialSuccess) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.LastDialSuccess) n += 1 + l + sovTypes(uint64(l)) } if m.LastDialFailure != nil { - l = github_com_gogo_protobuf_types.SizeOfStdTime(*m.LastDialFailure) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.LastDialFailure) n += 1 + l + sovTypes(uint64(l)) } if m.DialFailures != 0 { @@ -3282,7 +3282,7 @@ func (m *PeerInfo) Unmarshal(dAtA []byte) error { if m.LastConnected == nil { m.LastConnected = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.LastConnected, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.LastConnected, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3454,7 +3454,7 @@ func (m *PeerAddressInfo) Unmarshal(dAtA []byte) error { if m.LastDialSuccess == nil { m.LastDialSuccess = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.LastDialSuccess, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.LastDialSuccess, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -3490,7 +3490,7 @@ func (m *PeerAddressInfo) Unmarshal(dAtA []byte) error { if m.LastDialFailure == nil { m.LastDialFailure = new(time.Time) } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(m.LastDialFailure, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(m.LastDialFailure, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/proto/tendermint/privval/service.pb.go b/proto/tendermint/privval/service.pb.go index 7b0d696549..7099e6b8a0 100644 --- a/proto/tendermint/privval/service.pb.go +++ b/proto/tendermint/privval/service.pb.go @@ -6,7 +6,8 @@ package privval import ( context "context" fmt "fmt" - proto "github.com/gogo/protobuf/proto" + grpc1 "github.com/cosmos/gogoproto/grpc" + proto "github.com/cosmos/gogoproto/proto" grpc "google.golang.org/grpc" codes "google.golang.org/grpc/codes" status "google.golang.org/grpc/status" @@ -70,10 +71,10 @@ type PrivValidatorAPIClient interface { } type privValidatorAPIClient struct { - cc *grpc.ClientConn + cc grpc1.ClientConn } -func NewPrivValidatorAPIClient(cc *grpc.ClientConn) PrivValidatorAPIClient { +func NewPrivValidatorAPIClient(cc grpc1.ClientConn) PrivValidatorAPIClient { return &privValidatorAPIClient{cc} } @@ -151,7 +152,7 @@ func (*UnimplementedPrivValidatorAPIServer) SignProposal(ctx context.Context, re return nil, status.Errorf(codes.Unimplemented, "method SignProposal not implemented") } -func RegisterPrivValidatorAPIServer(s *grpc.Server, srv PrivValidatorAPIServer) { +func RegisterPrivValidatorAPIServer(s grpc1.Server, srv PrivValidatorAPIServer) { s.RegisterService(&_PrivValidatorAPI_serviceDesc, srv) } @@ -245,6 +246,7 @@ func _PrivValidatorAPI_SignProposal_Handler(srv interface{}, ctx context.Context return interceptor(ctx, in, info, handler) } +var PrivValidatorAPI_serviceDesc = _PrivValidatorAPI_serviceDesc var _PrivValidatorAPI_serviceDesc = grpc.ServiceDesc{ ServiceName: "tendermint.privval.PrivValidatorAPI", HandlerType: (*PrivValidatorAPIServer)(nil), diff --git a/proto/tendermint/privval/types.pb.go b/proto/tendermint/privval/types.pb.go index 7074783799..4a2697fee1 100644 --- a/proto/tendermint/privval/types.pb.go +++ b/proto/tendermint/privval/types.pb.go @@ -5,10 +5,10 @@ package privval import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" crypto "github.com/dashpay/tenderdash/proto/tendermint/crypto" types "github.com/dashpay/tenderdash/proto/tendermint/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/state/types.pb.go b/proto/tendermint/state/types.pb.go index dcd836a2a1..792516f9c9 100644 --- a/proto/tendermint/state/types.pb.go +++ b/proto/tendermint/state/types.pb.go @@ -5,13 +5,13 @@ package state import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/gogoproto/types" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" types "github.com/dashpay/tenderdash/abci/types" types1 "github.com/dashpay/tenderdash/proto/tendermint/types" version "github.com/dashpay/tenderdash/proto/tendermint/version" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" io "io" math "math" math_bits "math/bits" @@ -730,7 +730,7 @@ func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x3a } - n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime):]) + n9, err9 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.LastBlockTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastBlockTime):]) if err9 != nil { return 0, err9 } @@ -867,7 +867,7 @@ func (m *State) Size() (n int) { } l = m.LastBlockID.Size() n += 1 + l + sovTypes(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.LastBlockTime) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.LastBlockTime) n += 1 + l + sovTypes(uint64(l)) if m.Validators != nil { l = m.Validators.Size() @@ -1514,7 +1514,7 @@ func (m *State) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.LastBlockTime, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.LastBlockTime, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/proto/tendermint/statesync/types.pb.go b/proto/tendermint/statesync/types.pb.go index bac29edb94..64ab0bb378 100644 --- a/proto/tendermint/statesync/types.pb.go +++ b/proto/tendermint/statesync/types.pb.go @@ -5,9 +5,9 @@ package statesync import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" types "github.com/dashpay/tenderdash/proto/tendermint/types" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/types/block.pb.go b/proto/tendermint/types/block.pb.go index 915151f4da..1c37a498bc 100644 --- a/proto/tendermint/types/block.pb.go +++ b/proto/tendermint/types/block.pb.go @@ -5,8 +5,8 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/types/canonical.pb.go b/proto/tendermint/types/canonical.pb.go index 62114e67d9..db9b751d3a 100644 --- a/proto/tendermint/types/canonical.pb.go +++ b/proto/tendermint/types/canonical.pb.go @@ -6,10 +6,10 @@ package types import ( encoding_binary "encoding/binary" fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/gogoproto/types" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" io "io" math "math" math_bits "math/bits" @@ -523,7 +523,7 @@ func (m *CanonicalProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x3a } - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) if err2 != nil { return 0, err2 } @@ -749,7 +749,7 @@ func (m *CanonicalProposal) Size() (n int) { l = m.BlockID.Size() n += 1 + l + sovCanonical(uint64(l)) } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) n += 1 + l + sovCanonical(uint64(l)) l = len(m.ChainID) if l > 0 { @@ -1192,7 +1192,7 @@ func (m *CanonicalProposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/proto/tendermint/types/dash.pb.go b/proto/tendermint/types/dash.pb.go index ad693ce5ab..8e14ec95f0 100644 --- a/proto/tendermint/types/dash.pb.go +++ b/proto/tendermint/types/dash.pb.go @@ -6,8 +6,8 @@ package types import ( bytes "bytes" fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/types/events.pb.go b/proto/tendermint/types/events.pb.go index 0dc9c69941..ccd0cac04a 100644 --- a/proto/tendermint/types/events.pb.go +++ b/proto/tendermint/types/events.pb.go @@ -5,7 +5,7 @@ package types import ( fmt "fmt" - proto "github.com/gogo/protobuf/proto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/types/evidence.pb.go b/proto/tendermint/types/evidence.pb.go index 741a8bd40d..8fe8530e2f 100644 --- a/proto/tendermint/types/evidence.pb.go +++ b/proto/tendermint/types/evidence.pb.go @@ -5,10 +5,10 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/gogoproto/types" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" io "io" math "math" math_bits "math/bits" @@ -331,7 +331,7 @@ func (m *DuplicateVoteEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { _ = i var l int _ = l - n2, err2 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + n2, err2 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) if err2 != nil { return 0, err2 } @@ -468,7 +468,7 @@ func (m *DuplicateVoteEvidence) Size() (n int) { if m.ValidatorPower != 0 { n += 1 + sovEvidence(uint64(m.ValidatorPower)) } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) n += 1 + l + sovEvidence(uint64(l)) return n } @@ -747,7 +747,7 @@ func (m *DuplicateVoteEvidence) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/proto/tendermint/types/params.pb.go b/proto/tendermint/types/params.pb.go index 9f0460c1ac..910aecf9d0 100644 --- a/proto/tendermint/types/params.pb.go +++ b/proto/tendermint/types/params.pb.go @@ -5,9 +5,9 @@ package types import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" _ "github.com/golang/protobuf/ptypes/duration" io "io" math "math" @@ -1183,7 +1183,7 @@ func (m *EvidenceParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x18 } - n8, err8 := github_com_gogo_protobuf_types.StdDurationMarshalTo(m.MaxAgeDuration, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAgeDuration):]) + n8, err8 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(m.MaxAgeDuration, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MaxAgeDuration):]) if err8 != nil { return 0, err8 } @@ -1323,7 +1323,7 @@ func (m *SynchronyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.Precision != nil { - n9, err9 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Precision, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Precision):]) + 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 } @@ -1333,7 +1333,7 @@ func (m *SynchronyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } if m.MessageDelay != nil { - n10, err10 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.MessageDelay, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.MessageDelay):]) + 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 } @@ -1366,7 +1366,7 @@ func (m *TimeoutParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { var l int _ = l if m.VoteDelta != nil { - n11, err11 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.VoteDelta, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.VoteDelta):]) + 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 } @@ -1376,7 +1376,7 @@ func (m *TimeoutParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x22 } if m.Vote != nil { - n12, err12 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Vote, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Vote):]) + n12, err12 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.Vote, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.Vote):]) if err12 != nil { return 0, err12 } @@ -1386,7 +1386,7 @@ func (m *TimeoutParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x1a } if m.ProposeDelta != nil { - n13, err13 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.ProposeDelta, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.ProposeDelta):]) + n13, err13 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.ProposeDelta, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.ProposeDelta):]) if err13 != nil { return 0, err13 } @@ -1396,7 +1396,7 @@ func (m *TimeoutParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { dAtA[i] = 0x12 } if m.Propose != nil { - n14, err14 := github_com_gogo_protobuf_types.StdDurationMarshalTo(*m.Propose, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Propose):]) + n14, err14 := github_com_cosmos_gogoproto_types.StdDurationMarshalTo(*m.Propose, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.Propose):]) if err14 != nil { return 0, err14 } @@ -1513,7 +1513,7 @@ func (m *EvidenceParams) Size() (n int) { if m.MaxAgeNumBlocks != 0 { n += 1 + sovParams(uint64(m.MaxAgeNumBlocks)) } - l = github_com_gogo_protobuf_types.SizeOfStdDuration(m.MaxAgeDuration) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(m.MaxAgeDuration) n += 1 + l + sovParams(uint64(l)) if m.MaxBytes != 0 { n += 1 + sovParams(uint64(m.MaxBytes)) @@ -1576,11 +1576,11 @@ func (m *SynchronyParams) Size() (n int) { var l int _ = l if m.MessageDelay != nil { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.MessageDelay) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.MessageDelay) n += 1 + l + sovParams(uint64(l)) } if m.Precision != nil { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Precision) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.Precision) n += 1 + l + sovParams(uint64(l)) } return n @@ -1593,19 +1593,19 @@ func (m *TimeoutParams) Size() (n int) { var l int _ = l if m.Propose != nil { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Propose) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.Propose) n += 1 + l + sovParams(uint64(l)) } if m.ProposeDelta != nil { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.ProposeDelta) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.ProposeDelta) n += 1 + l + sovParams(uint64(l)) } if m.Vote != nil { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.Vote) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.Vote) n += 1 + l + sovParams(uint64(l)) } if m.VoteDelta != nil { - l = github_com_gogo_protobuf_types.SizeOfStdDuration(*m.VoteDelta) + l = github_com_cosmos_gogoproto_types.SizeOfStdDuration(*m.VoteDelta) n += 1 + l + sovParams(uint64(l)) } return n @@ -2096,7 +2096,7 @@ func (m *EvidenceParams) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(&m.MaxAgeDuration, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(&m.MaxAgeDuration, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2478,7 +2478,7 @@ func (m *SynchronyParams) Unmarshal(dAtA []byte) error { if m.MessageDelay == nil { m.MessageDelay = new(time.Duration) } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.MessageDelay, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.MessageDelay, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2514,7 +2514,7 @@ func (m *SynchronyParams) Unmarshal(dAtA []byte) error { if m.Precision == nil { m.Precision = new(time.Duration) } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Precision, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.Precision, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2600,7 +2600,7 @@ func (m *TimeoutParams) Unmarshal(dAtA []byte) error { if m.Propose == nil { m.Propose = new(time.Duration) } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Propose, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.Propose, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2636,7 +2636,7 @@ func (m *TimeoutParams) Unmarshal(dAtA []byte) error { if m.ProposeDelta == nil { m.ProposeDelta = new(time.Duration) } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.ProposeDelta, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.ProposeDelta, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2672,7 +2672,7 @@ func (m *TimeoutParams) Unmarshal(dAtA []byte) error { if m.Vote == nil { m.Vote = new(time.Duration) } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.Vote, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.Vote, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -2708,7 +2708,7 @@ func (m *TimeoutParams) Unmarshal(dAtA []byte) error { if m.VoteDelta == nil { m.VoteDelta = new(time.Duration) } - if err := github_com_gogo_protobuf_types.StdDurationUnmarshal(m.VoteDelta, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdDurationUnmarshal(m.VoteDelta, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/proto/tendermint/types/types.pb.go b/proto/tendermint/types/types.pb.go index 07ec7decc8..4897e23fca 100644 --- a/proto/tendermint/types/types.pb.go +++ b/proto/tendermint/types/types.pb.go @@ -6,12 +6,12 @@ package types import ( encoding_binary "encoding/binary" fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" + _ "github.com/cosmos/gogoproto/types" + github_com_cosmos_gogoproto_types "github.com/cosmos/gogoproto/types" crypto "github.com/dashpay/tenderdash/proto/tendermint/crypto" version "github.com/dashpay/tenderdash/proto/tendermint/version" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" - _ "github.com/gogo/protobuf/types" - github_com_gogo_protobuf_types "github.com/gogo/protobuf/types" io "io" math "math" math_bits "math/bits" @@ -1547,7 +1547,7 @@ func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { } i-- dAtA[i] = 0x2a - n4, err4 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Time):]) + n4, err4 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Time, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time):]) if err4 != nil { return 0, err4 } @@ -1808,7 +1808,7 @@ func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { i-- dAtA[i] = 0x3a } - n9, err9 := github_com_gogo_protobuf_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp):]) + n9, err9 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(m.Timestamp, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp):]) if err9 != nil { return 0, err9 } @@ -2164,7 +2164,7 @@ func (m *Header) Size() (n int) { if m.Height != 0 { n += 1 + sovTypes(uint64(m.Height)) } - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Time) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Time) n += 1 + l + sovTypes(uint64(l)) l = m.LastBlockId.Size() n += 1 + l + sovTypes(uint64(l)) @@ -2320,7 +2320,7 @@ func (m *Proposal) Size() (n int) { } l = m.BlockID.Size() n += 1 + l + sovTypes(uint64(l)) - l = github_com_gogo_protobuf_types.SizeOfStdTime(m.Timestamp) + l = github_com_cosmos_gogoproto_types.SizeOfStdTime(m.Timestamp) n += 1 + l + sovTypes(uint64(l)) l = len(m.Signature) if l > 0 { @@ -3078,7 +3078,7 @@ func (m *Header) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Time, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex @@ -4247,7 +4247,7 @@ func (m *Proposal) Unmarshal(dAtA []byte) error { if postIndex > l { return io.ErrUnexpectedEOF } - if err := github_com_gogo_protobuf_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { + if err := github_com_cosmos_gogoproto_types.StdTimeUnmarshal(&m.Timestamp, dAtA[iNdEx:postIndex]); err != nil { return err } iNdEx = postIndex diff --git a/proto/tendermint/types/validator.pb.go b/proto/tendermint/types/validator.pb.go index a37aacd837..ee9206fc34 100644 --- a/proto/tendermint/types/validator.pb.go +++ b/proto/tendermint/types/validator.pb.go @@ -5,9 +5,9 @@ package types import ( fmt "fmt" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" crypto "github.com/dashpay/tenderdash/proto/tendermint/crypto" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" io "io" math "math" math_bits "math/bits" diff --git a/proto/tendermint/version/types.pb.go b/proto/tendermint/version/types.pb.go index 2d0162356b..7ba940c46a 100644 --- a/proto/tendermint/version/types.pb.go +++ b/proto/tendermint/version/types.pb.go @@ -5,8 +5,8 @@ package version import ( fmt "fmt" - _ "github.com/gogo/protobuf/gogoproto" - proto "github.com/gogo/protobuf/proto" + _ "github.com/cosmos/gogoproto/gogoproto" + proto "github.com/cosmos/gogoproto/proto" io "io" math "math" math_bits "math/bits" diff --git a/scripts/scmigrate/migrate.go b/scripts/scmigrate/migrate.go index ac707dd4f9..c78172c734 100644 --- a/scripts/scmigrate/migrate.go +++ b/scripts/scmigrate/migrate.go @@ -14,7 +14,7 @@ import ( "sort" dbm "github.com/cometbft/cometbft-db" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/google/orderedcode" tmproto "github.com/dashpay/tenderdash/proto/tendermint/types" diff --git a/scripts/scmigrate/migrate_test.go b/scripts/scmigrate/migrate_test.go index 5f57c6173a..fded33727b 100644 --- a/scripts/scmigrate/migrate_test.go +++ b/scripts/scmigrate/migrate_test.go @@ -7,7 +7,7 @@ import ( "testing" dbm "github.com/cometbft/cometbft-db" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/types" ) diff --git a/test/e2e/runner/setup.go b/test/e2e/runner/setup.go index b15302408a..d149e042a1 100644 --- a/test/e2e/runner/setup.go +++ b/test/e2e/runner/setup.go @@ -16,7 +16,7 @@ import ( "time" "github.com/BurntSushi/toml" - "github.com/gogo/protobuf/proto" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/tenderdash/config" "github.com/dashpay/tenderdash/crypto" diff --git a/types/block.go b/types/block.go index 10901ca371..595a39aa44 100644 --- a/types/block.go +++ b/types/block.go @@ -13,8 +13,8 @@ import ( sync "github.com/sasha-s/go-deadlock" - "github.com/gogo/protobuf/proto" - gogotypes "github.com/gogo/protobuf/types" + "github.com/cosmos/gogoproto/proto" + gogotypes "github.com/cosmos/gogoproto/types" "github.com/rs/zerolog" "github.com/dashpay/tenderdash/abci/types" diff --git a/types/block_test.go b/types/block_test.go index 0b6139e585..bb5a84172d 100644 --- a/types/block_test.go +++ b/types/block_test.go @@ -13,8 +13,8 @@ import ( "testing" "time" + gogotypes "github.com/cosmos/gogoproto/types" "github.com/dashpay/dashd-go/btcjson" - gogotypes "github.com/gogo/protobuf/types" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/types/encoding_helper.go b/types/encoding_helper.go index 28a238793a..aa038f688e 100644 --- a/types/encoding_helper.go +++ b/types/encoding_helper.go @@ -1,7 +1,7 @@ package types import ( - gogotypes "github.com/gogo/protobuf/types" + gogotypes "github.com/cosmos/gogoproto/types" "github.com/dashpay/tenderdash/libs/bytes" ) diff --git a/types/proposal_test.go b/types/proposal_test.go index 49ea38cff2..2d1d4a0844 100644 --- a/types/proposal_test.go +++ b/types/proposal_test.go @@ -6,8 +6,8 @@ import ( "testing" "time" + "github.com/cosmos/gogoproto/proto" "github.com/dashpay/dashd-go/btcjson" - "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/types/vote_test.go b/types/vote_test.go index 044024b0d2..e800c2bedb 100644 --- a/types/vote_test.go +++ b/types/vote_test.go @@ -6,9 +6,9 @@ import ( "fmt" "testing" + "github.com/cosmos/gogoproto/proto" bls "github.com/dashpay/bls-signatures/go-bindings" "github.com/dashpay/dashd-go/btcjson" - "github.com/gogo/protobuf/proto" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" From 4b24c791241c60eaaa8ac5b3857ef780971c5ef3 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Mon, 17 Feb 2025 17:35:07 +0100 Subject: [PATCH 06/17] build: use forked gogoproto to fix panic --- .github/workflows/check-generated.yml | 4 +++- Makefile | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check-generated.yml b/.github/workflows/check-generated.yml index 6399d97576..fe49912ab3 100644 --- a/.github/workflows/check-generated.yml +++ b/.github/workflows/check-generated.yml @@ -75,7 +75,9 @@ jobs: export GOBIN="${tools}/bin" go install github.com/bufbuild/buf/cmd/buf - go install github.com/cosmos/gogoproto/protoc-gen-gogofaster@latest + # Forked version of gogoproto plugin with fix https://github.com/cosmos/gogoproto/pull/150 + # go install github.com/cosmos/gogoproto/protoc-gen-gogofaster@latest + go install github.com/lklimek/gogoproto/protoc-gen-gogofaster@564fd924f58c5d076b0ad8e3f1c6fb54d065cbbe make proto-gen diff --git a/Makefile b/Makefile index 10c3ab29e6..7347d7e0e7 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,9 @@ BUILD_IMAGE := ghcr.io/tendermint/docker-build-proto BASE_BRANCH ?= v0.8-dev DOCKER_PROTO := docker run -v $(shell pwd):/workspace --workdir /workspace $(BUILD_IMAGE) CGO_ENABLED ?= 1 -GOGOPROTO_PATH = $(shell go list -m -f '{{.Dir}}' github.com/cosmos/gogoproto) +# Fix for a gogoproto bug +# GOGOPROTO_PATH = $(shell go list -m -f '{{.Dir}}' github.com/cosmos/gogoproto) +GOGOPROTO_PATH = $(shell go list -m -f '{{.Dir}}' github.com/lklimek/gogoproto@564fd924f58c5d076b0ad8e3f1c6fb54d065cbbe) MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CURR_DIR := $(dir $(MAKEFILE_PATH)) @@ -114,7 +116,8 @@ proto: proto-format proto-lint proto-doc proto-gen check-proto-deps: ifeq (,$(shell which protoc-gen-gogofaster)) - $(error "gogofaster plugin for protoc is required. Run 'go install github.com/cosmos/gogoproto/protoc-gen-gogofaster@latest' to install") +# $(error "gogofaster plugin for protoc is required. Run 'go install github.com/cosmos/gogoproto/protoc-gen-gogofaster@latest' to install") + $(error "gogofaster plugin for protoc is required. Run 'go install github.com/lklimek/gogoproto/protoc-gen-gogofaster@564fd924f58c5d076b0ad8e3f1c6fb54d065cbbe' to install") endif .PHONY: check-proto-deps From f1e4b7de46b5c64e1a1863bba3a94cda425d7fda Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Mon, 17 Feb 2025 17:37:40 +0100 Subject: [PATCH 07/17] chore: update protobuf definitions --- abci/types/types.pb.go | 246 +++++++++++++++++++++++++ proto/tendermint/blocksync/types.pb.go | 15 ++ proto/tendermint/consensus/types.pb.go | 69 +++++++ proto/tendermint/consensus/wal.pb.go | 27 +++ proto/tendermint/crypto/keys.pb.go | 12 ++ proto/tendermint/crypto/proof.pb.go | 15 ++ proto/tendermint/libs/bits/types.pb.go | 3 + proto/tendermint/mempool/types.pb.go | 3 + proto/tendermint/p2p/conn.pb.go | 24 +++ proto/tendermint/p2p/pex.pb.go | 9 + proto/tendermint/p2p/types.pb.go | 108 +++++++++++ proto/tendermint/privval/types.pb.go | 81 ++++++++ proto/tendermint/state/types.pb.go | 15 ++ proto/tendermint/statesync/types.pb.go | 24 +++ proto/tendermint/types/block.pb.go | 3 + proto/tendermint/types/canonical.pb.go | 15 ++ proto/tendermint/types/dash.pb.go | 9 + proto/tendermint/types/events.pb.go | 3 + proto/tendermint/types/evidence.pb.go | 12 ++ proto/tendermint/types/params.pb.go | 30 +++ proto/tendermint/types/types.pb.go | 39 ++++ proto/tendermint/types/validator.pb.go | 9 + proto/tendermint/version/types.pb.go | 3 + 23 files changed, 774 insertions(+) diff --git a/abci/types/types.pb.go b/abci/types/types.pb.go index 178d8b1c57..31e385c2be 100644 --- a/abci/types/types.pb.go +++ b/abci/types/types.pb.go @@ -5211,6 +5211,9 @@ func (m *Request) MarshalTo(dAtA []byte) (int, error) { } func (m *Request) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5233,6 +5236,9 @@ func (m *Request_Echo) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_Echo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Echo != nil { { @@ -5254,6 +5260,9 @@ func (m *Request_Flush) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_Flush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Flush != nil { { @@ -5275,6 +5284,9 @@ func (m *Request_Info) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Info != nil { { @@ -5296,6 +5308,9 @@ func (m *Request_InitChain) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_InitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.InitChain != nil { { @@ -5317,6 +5332,9 @@ func (m *Request_Query) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_Query) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Query != nil { { @@ -5338,6 +5356,9 @@ func (m *Request_CheckTx) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_CheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.CheckTx != nil { { @@ -5359,6 +5380,9 @@ func (m *Request_ListSnapshots) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_ListSnapshots) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ListSnapshots != nil { { @@ -5380,6 +5404,9 @@ func (m *Request_OfferSnapshot) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_OfferSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.OfferSnapshot != nil { { @@ -5401,6 +5428,9 @@ func (m *Request_LoadSnapshotChunk) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_LoadSnapshotChunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.LoadSnapshotChunk != nil { { @@ -5422,6 +5452,9 @@ func (m *Request_ApplySnapshotChunk) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_ApplySnapshotChunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ApplySnapshotChunk != nil { { @@ -5443,6 +5476,9 @@ func (m *Request_PrepareProposal) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_PrepareProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PrepareProposal != nil { { @@ -5464,6 +5500,9 @@ func (m *Request_ProcessProposal) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_ProcessProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ProcessProposal != nil { { @@ -5487,6 +5526,9 @@ func (m *Request_ExtendVote) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_ExtendVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ExtendVote != nil { { @@ -5510,6 +5552,9 @@ func (m *Request_VerifyVoteExtension) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_VerifyVoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.VerifyVoteExtension != nil { { @@ -5533,6 +5578,9 @@ func (m *Request_FinalizeBlock) MarshalTo(dAtA []byte) (int, error) { } func (m *Request_FinalizeBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.FinalizeBlock != nil { { @@ -5566,6 +5614,9 @@ func (m *RequestEcho) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestEcho) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5596,6 +5647,9 @@ func (m *RequestFlush) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestFlush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5619,6 +5673,9 @@ func (m *RequestInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5666,6 +5723,9 @@ func (m *RequestInitChain) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestInitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5745,6 +5805,9 @@ func (m *RequestQuery) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5797,6 +5860,9 @@ func (m *RequestCheckTx) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestCheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5832,6 +5898,9 @@ func (m *RequestListSnapshots) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestListSnapshots) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5855,6 +5924,9 @@ func (m *RequestOfferSnapshot) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestOfferSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5897,6 +5969,9 @@ func (m *RequestLoadSnapshotChunk) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestLoadSnapshotChunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5937,6 +6012,9 @@ func (m *RequestApplySnapshotChunk) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestApplySnapshotChunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -5981,6 +6059,9 @@ func (m *RequestPrepareProposal) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestPrepareProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -6103,6 +6184,9 @@ func (m *RequestProcessProposal) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestProcessProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -6239,6 +6323,9 @@ func (m *RequestExtendVote) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestExtendVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -6279,6 +6366,9 @@ func (m *RequestVerifyVoteExtension) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestVerifyVoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -6340,6 +6430,9 @@ func (m *RequestFinalizeBlock) MarshalTo(dAtA []byte) (int, error) { } func (m *RequestFinalizeBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -6428,6 +6521,9 @@ func (m *Response) MarshalTo(dAtA []byte) (int, error) { } func (m *Response) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -6450,6 +6546,9 @@ func (m *Response_Exception) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_Exception) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Exception != nil { { @@ -6471,6 +6570,9 @@ func (m *Response_Echo) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_Echo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Echo != nil { { @@ -6492,6 +6594,9 @@ func (m *Response_Flush) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_Flush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Flush != nil { { @@ -6513,6 +6618,9 @@ func (m *Response_Info) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_Info) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Info != nil { { @@ -6534,6 +6642,9 @@ func (m *Response_InitChain) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_InitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.InitChain != nil { { @@ -6555,6 +6666,9 @@ func (m *Response_Query) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_Query) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Query != nil { { @@ -6576,6 +6690,9 @@ func (m *Response_CheckTx) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_CheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.CheckTx != nil { { @@ -6597,6 +6714,9 @@ func (m *Response_ListSnapshots) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_ListSnapshots) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ListSnapshots != nil { { @@ -6618,6 +6738,9 @@ func (m *Response_OfferSnapshot) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_OfferSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.OfferSnapshot != nil { { @@ -6639,6 +6762,9 @@ func (m *Response_LoadSnapshotChunk) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_LoadSnapshotChunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.LoadSnapshotChunk != nil { { @@ -6660,6 +6786,9 @@ func (m *Response_ApplySnapshotChunk) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_ApplySnapshotChunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ApplySnapshotChunk != nil { { @@ -6681,6 +6810,9 @@ func (m *Response_PrepareProposal) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_PrepareProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PrepareProposal != nil { { @@ -6702,6 +6834,9 @@ func (m *Response_ProcessProposal) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_ProcessProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ProcessProposal != nil { { @@ -6723,6 +6858,9 @@ func (m *Response_ExtendVote) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_ExtendVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ExtendVote != nil { { @@ -6744,6 +6882,9 @@ func (m *Response_VerifyVoteExtension) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_VerifyVoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.VerifyVoteExtension != nil { { @@ -6765,6 +6906,9 @@ func (m *Response_FinalizeBlock) MarshalTo(dAtA []byte) (int, error) { } func (m *Response_FinalizeBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.FinalizeBlock != nil { { @@ -6798,6 +6942,9 @@ func (m *ResponseException) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseException) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -6828,6 +6975,9 @@ func (m *ResponseEcho) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseEcho) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -6858,6 +7008,9 @@ func (m *ResponseFlush) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseFlush) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -6881,6 +7034,9 @@ func (m *ResponseInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -6935,6 +7091,9 @@ func (m *ResponseInitChain) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseInitChain) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7003,6 +7162,9 @@ func (m *ResponseInitChain_GenesisTime) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseInitChain_GenesisTime) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.GenesisTime != nil { n49, err49 := github_com_cosmos_gogoproto_types.StdTimeMarshalTo(*m.GenesisTime, dAtA[i-github_com_cosmos_gogoproto_types.SizeOfStdTime(*m.GenesisTime):]) @@ -7032,6 +7194,9 @@ func (m *ResponseQuery) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseQuery) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7117,6 +7282,9 @@ func (m *ResponseCheckTx) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseCheckTx) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7183,6 +7351,9 @@ func (m *ResponseListSnapshots) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseListSnapshots) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7220,6 +7391,9 @@ func (m *ResponseOfferSnapshot) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseOfferSnapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7248,6 +7422,9 @@ func (m *ResponseLoadSnapshotChunk) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseLoadSnapshotChunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7278,6 +7455,9 @@ func (m *ResponseApplySnapshotChunk) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseApplySnapshotChunk) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7333,6 +7513,9 @@ func (m *ResponsePrepareProposal) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponsePrepareProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7432,6 +7615,9 @@ func (m *ResponseProcessProposal) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseProcessProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7519,6 +7705,9 @@ func (m *ExtendVoteExtension) MarshalTo(dAtA []byte) (int, error) { } func (m *ExtendVoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7553,6 +7742,9 @@ func (m *ExtendVoteExtension_SignRequestId) MarshalTo(dAtA []byte) (int, error) } func (m *ExtendVoteExtension_SignRequestId) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.SignRequestId != nil { i -= len(m.SignRequestId) @@ -7579,6 +7771,9 @@ func (m *ResponseExtendVote) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseExtendVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7616,6 +7811,9 @@ func (m *ResponseVerifyVoteExtension) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseVerifyVoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7644,6 +7842,9 @@ func (m *ResponseFinalizeBlock) MarshalTo(dAtA []byte) (int, error) { } func (m *ResponseFinalizeBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7672,6 +7873,9 @@ func (m *CommitInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *CommitInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7728,6 +7932,9 @@ func (m *Event) MarshalTo(dAtA []byte) (int, error) { } func (m *Event) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7772,6 +7979,9 @@ func (m *EventAttribute) MarshalTo(dAtA []byte) (int, error) { } func (m *EventAttribute) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7819,6 +8029,9 @@ func (m *ExecTxResult) MarshalTo(dAtA []byte) (int, error) { } func (m *ExecTxResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7894,6 +8107,9 @@ func (m *TxResult) MarshalTo(dAtA []byte) (int, error) { } func (m *TxResult) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7944,6 +8160,9 @@ func (m *TxRecord) MarshalTo(dAtA []byte) (int, error) { } func (m *TxRecord) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -7979,6 +8198,9 @@ func (m *Validator) MarshalTo(dAtA []byte) (int, error) { } func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -8014,6 +8236,9 @@ func (m *ValidatorUpdate) MarshalTo(dAtA []byte) (int, error) { } func (m *ValidatorUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -8068,6 +8293,9 @@ func (m *ValidatorSetUpdate) MarshalTo(dAtA []byte) (int, error) { } func (m *ValidatorSetUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -8122,6 +8350,9 @@ func (m *ThresholdPublicKeyUpdate) MarshalTo(dAtA []byte) (int, error) { } func (m *ThresholdPublicKeyUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -8155,6 +8386,9 @@ func (m *QuorumHashUpdate) MarshalTo(dAtA []byte) (int, error) { } func (m *QuorumHashUpdate) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -8185,6 +8419,9 @@ func (m *VoteInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *VoteInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -8228,6 +8465,9 @@ func (m *ExtendedVoteInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *ExtendedVoteInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -8278,6 +8518,9 @@ func (m *Misbehavior) MarshalTo(dAtA []byte) (int, error) { } func (m *Misbehavior) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -8334,6 +8577,9 @@ func (m *Snapshot) MarshalTo(dAtA []byte) (int, error) { } func (m *Snapshot) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/blocksync/types.pb.go b/proto/tendermint/blocksync/types.pb.go index ba8a002f3f..6e44307087 100644 --- a/proto/tendermint/blocksync/types.pb.go +++ b/proto/tendermint/blocksync/types.pb.go @@ -305,6 +305,9 @@ func (m *BlockRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *BlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -333,6 +336,9 @@ func (m *NoBlockResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *NoBlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -361,6 +367,9 @@ func (m *BlockResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *BlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -408,6 +417,9 @@ func (m *StatusRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *StatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -431,6 +443,9 @@ func (m *StatusResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *StatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/consensus/types.pb.go b/proto/tendermint/consensus/types.pb.go index d8db55ed93..c1cfc32191 100644 --- a/proto/tendermint/consensus/types.pb.go +++ b/proto/tendermint/consensus/types.pb.go @@ -1007,6 +1007,9 @@ func (m *NewRoundStep) MarshalTo(dAtA []byte) (int, error) { } func (m *NewRoundStep) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1055,6 +1058,9 @@ func (m *NewValidBlock) MarshalTo(dAtA []byte) (int, error) { } func (m *NewValidBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1120,6 +1126,9 @@ func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { } func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1153,6 +1162,9 @@ func (m *ProposalPOL) MarshalTo(dAtA []byte) (int, error) { } func (m *ProposalPOL) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1196,6 +1208,9 @@ func (m *BlockPart) MarshalTo(dAtA []byte) (int, error) { } func (m *BlockPart) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1239,6 +1254,9 @@ func (m *Vote) MarshalTo(dAtA []byte) (int, error) { } func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1274,6 +1292,9 @@ func (m *HasVote) MarshalTo(dAtA []byte) (int, error) { } func (m *HasVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1317,6 +1338,9 @@ func (m *Commit) MarshalTo(dAtA []byte) (int, error) { } func (m *Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1352,6 +1376,9 @@ func (m *HasCommit) MarshalTo(dAtA []byte) (int, error) { } func (m *HasCommit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1385,6 +1412,9 @@ func (m *VoteSetMaj23) MarshalTo(dAtA []byte) (int, error) { } func (m *VoteSetMaj23) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1433,6 +1463,9 @@ func (m *VoteSetBits) MarshalTo(dAtA []byte) (int, error) { } func (m *VoteSetBits) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1491,6 +1524,9 @@ func (m *Message) MarshalTo(dAtA []byte) (int, error) { } func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1513,6 +1549,9 @@ func (m *Message_NewRoundStep) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_NewRoundStep) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.NewRoundStep != nil { { @@ -1534,6 +1573,9 @@ func (m *Message_NewValidBlock) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_NewValidBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.NewValidBlock != nil { { @@ -1555,6 +1597,9 @@ func (m *Message_Proposal) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Proposal != nil { { @@ -1576,6 +1621,9 @@ func (m *Message_ProposalPol) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_ProposalPol) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ProposalPol != nil { { @@ -1597,6 +1645,9 @@ func (m *Message_BlockPart) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_BlockPart) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.BlockPart != nil { { @@ -1618,6 +1669,9 @@ func (m *Message_Vote) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Vote != nil { { @@ -1639,6 +1693,9 @@ func (m *Message_HasVote) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_HasVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.HasVote != nil { { @@ -1660,6 +1717,9 @@ func (m *Message_VoteSetMaj23) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_VoteSetMaj23) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.VoteSetMaj23 != nil { { @@ -1681,6 +1741,9 @@ func (m *Message_VoteSetBits) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_VoteSetBits) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.VoteSetBits != nil { { @@ -1702,6 +1765,9 @@ func (m *Message_Commit) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Commit != nil { { @@ -1723,6 +1789,9 @@ func (m *Message_HasCommit) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_HasCommit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.HasCommit != nil { { diff --git a/proto/tendermint/consensus/wal.pb.go b/proto/tendermint/consensus/wal.pb.go index 52dac8deaf..eb86b9eae8 100644 --- a/proto/tendermint/consensus/wal.pb.go +++ b/proto/tendermint/consensus/wal.pb.go @@ -426,6 +426,9 @@ func (m *MsgInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *MsgInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -466,6 +469,9 @@ func (m *TimeoutInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *TimeoutInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -512,6 +518,9 @@ func (m *EndHeight) MarshalTo(dAtA []byte) (int, error) { } func (m *EndHeight) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -540,6 +549,9 @@ func (m *WALMessage) MarshalTo(dAtA []byte) (int, error) { } func (m *WALMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -562,6 +574,9 @@ func (m *WALMessage_EventDataRoundState) MarshalTo(dAtA []byte) (int, error) { } func (m *WALMessage_EventDataRoundState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.EventDataRoundState != nil { { @@ -583,6 +598,9 @@ func (m *WALMessage_MsgInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *WALMessage_MsgInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.MsgInfo != nil { { @@ -604,6 +622,9 @@ func (m *WALMessage_TimeoutInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *WALMessage_TimeoutInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.TimeoutInfo != nil { { @@ -625,6 +646,9 @@ func (m *WALMessage_EndHeight) MarshalTo(dAtA []byte) (int, error) { } func (m *WALMessage_EndHeight) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.EndHeight != nil { { @@ -656,6 +680,9 @@ func (m *TimedWALMessage) MarshalTo(dAtA []byte) (int, error) { } func (m *TimedWALMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/crypto/keys.pb.go b/proto/tendermint/crypto/keys.pb.go index 62b06df7ab..3341b70f99 100644 --- a/proto/tendermint/crypto/keys.pb.go +++ b/proto/tendermint/crypto/keys.pb.go @@ -425,6 +425,9 @@ func (m *PublicKey) MarshalTo(dAtA []byte) (int, error) { } func (m *PublicKey) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -447,6 +450,9 @@ func (m *PublicKey_Ed25519) MarshalTo(dAtA []byte) (int, error) { } func (m *PublicKey_Ed25519) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Ed25519 != nil { i -= len(m.Ed25519) @@ -463,6 +469,9 @@ func (m *PublicKey_Secp256K1) MarshalTo(dAtA []byte) (int, error) { } func (m *PublicKey_Secp256K1) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Secp256K1 != nil { i -= len(m.Secp256K1) @@ -479,6 +488,9 @@ func (m *PublicKey_Bls12381) MarshalTo(dAtA []byte) (int, error) { } func (m *PublicKey_Bls12381) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Bls12381 != nil { i -= len(m.Bls12381) diff --git a/proto/tendermint/crypto/proof.pb.go b/proto/tendermint/crypto/proof.pb.go index 1831de7236..0c8b39e5e5 100644 --- a/proto/tendermint/crypto/proof.pb.go +++ b/proto/tendermint/crypto/proof.pb.go @@ -366,6 +366,9 @@ func (m *Proof) MarshalTo(dAtA []byte) (int, error) { } func (m *Proof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -415,6 +418,9 @@ func (m *ValueOp) MarshalTo(dAtA []byte) (int, error) { } func (m *ValueOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -457,6 +463,9 @@ func (m *DominoOp) MarshalTo(dAtA []byte) (int, error) { } func (m *DominoOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -501,6 +510,9 @@ func (m *ProofOp) MarshalTo(dAtA []byte) (int, error) { } func (m *ProofOp) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -545,6 +557,9 @@ func (m *ProofOps) MarshalTo(dAtA []byte) (int, error) { } func (m *ProofOps) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/libs/bits/types.pb.go b/proto/tendermint/libs/bits/types.pb.go index 97445df26e..7803fdcd76 100644 --- a/proto/tendermint/libs/bits/types.pb.go +++ b/proto/tendermint/libs/bits/types.pb.go @@ -111,6 +111,9 @@ func (m *BitArray) MarshalTo(dAtA []byte) (int, error) { } func (m *BitArray) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/mempool/types.pb.go b/proto/tendermint/mempool/types.pb.go index b38e602520..e2bf10ded7 100644 --- a/proto/tendermint/mempool/types.pb.go +++ b/proto/tendermint/mempool/types.pb.go @@ -102,6 +102,9 @@ func (m *Txs) MarshalTo(dAtA []byte) (int, error) { } func (m *Txs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/p2p/conn.pb.go b/proto/tendermint/p2p/conn.pb.go index 1b57bf3cc5..7500b78ef5 100644 --- a/proto/tendermint/p2p/conn.pb.go +++ b/proto/tendermint/p2p/conn.pb.go @@ -362,6 +362,9 @@ func (m *PacketPing) MarshalTo(dAtA []byte) (int, error) { } func (m *PacketPing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -385,6 +388,9 @@ func (m *PacketPong) MarshalTo(dAtA []byte) (int, error) { } func (m *PacketPong) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -408,6 +414,9 @@ func (m *PacketMsg) MarshalTo(dAtA []byte) (int, error) { } func (m *PacketMsg) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -453,6 +462,9 @@ func (m *Packet) MarshalTo(dAtA []byte) (int, error) { } func (m *Packet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -475,6 +487,9 @@ func (m *Packet_PacketPing) MarshalTo(dAtA []byte) (int, error) { } func (m *Packet_PacketPing) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PacketPing != nil { { @@ -496,6 +511,9 @@ func (m *Packet_PacketPong) MarshalTo(dAtA []byte) (int, error) { } func (m *Packet_PacketPong) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PacketPong != nil { { @@ -517,6 +535,9 @@ func (m *Packet_PacketMsg) MarshalTo(dAtA []byte) (int, error) { } func (m *Packet_PacketMsg) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PacketMsg != nil { { @@ -548,6 +569,9 @@ func (m *AuthSigMessage) MarshalTo(dAtA []byte) (int, error) { } func (m *AuthSigMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/p2p/pex.pb.go b/proto/tendermint/p2p/pex.pb.go index ff6f3fc496..e9dcc7573b 100644 --- a/proto/tendermint/p2p/pex.pb.go +++ b/proto/tendermint/p2p/pex.pb.go @@ -190,6 +190,9 @@ func (m *PexAddress) MarshalTo(dAtA []byte) (int, error) { } func (m *PexAddress) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -220,6 +223,9 @@ func (m *PexRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *PexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -243,6 +249,9 @@ func (m *PexResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *PexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/p2p/types.pb.go b/proto/tendermint/p2p/types.pb.go index de977db334..782146c4d0 100644 --- a/proto/tendermint/p2p/types.pb.go +++ b/proto/tendermint/p2p/types.pb.go @@ -1008,6 +1008,9 @@ func (m *ProtocolVersion) MarshalTo(dAtA []byte) (int, error) { } func (m *ProtocolVersion) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1046,6 +1049,9 @@ func (m *NodeInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *NodeInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1149,6 +1155,9 @@ func (m *NodeInfoOther) MarshalTo(dAtA []byte) (int, error) { } func (m *NodeInfoOther) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1186,6 +1195,9 @@ func (m *PeerInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *PeerInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1257,6 +1269,9 @@ func (m *PeerAddressInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *PeerAddressInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1312,6 +1327,9 @@ func (m *Echo) MarshalTo(dAtA []byte) (int, error) { } func (m *Echo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1342,6 +1360,9 @@ func (m *Envelope) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1383,6 +1404,9 @@ func (m *Envelope_Echo) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_Echo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Echo != nil { { @@ -1404,6 +1428,9 @@ func (m *Envelope_PexRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_PexRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PexRequest != nil { { @@ -1425,6 +1452,9 @@ func (m *Envelope_PexResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_PexResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PexResponse != nil { { @@ -1446,6 +1476,9 @@ func (m *Envelope_Evidence) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_Evidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Evidence != nil { { @@ -1467,6 +1500,9 @@ func (m *Envelope_MempoolTxs) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_MempoolTxs) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.MempoolTxs != nil { { @@ -1488,6 +1524,9 @@ func (m *Envelope_BlockRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_BlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.BlockRequest != nil { { @@ -1509,6 +1548,9 @@ func (m *Envelope_NoBlockResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_NoBlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.NoBlockResponse != nil { { @@ -1530,6 +1572,9 @@ func (m *Envelope_BlockResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_BlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.BlockResponse != nil { { @@ -1551,6 +1596,9 @@ func (m *Envelope_StatusRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_StatusRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.StatusRequest != nil { { @@ -1572,6 +1620,9 @@ func (m *Envelope_StatusResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_StatusResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.StatusResponse != nil { { @@ -1593,6 +1644,9 @@ func (m *Envelope_SnapshotsRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_SnapshotsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.SnapshotsRequest != nil { { @@ -1614,6 +1668,9 @@ func (m *Envelope_SnapshotsResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_SnapshotsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.SnapshotsResponse != nil { { @@ -1635,6 +1692,9 @@ func (m *Envelope_ChunkRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_ChunkRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ChunkRequest != nil { { @@ -1656,6 +1716,9 @@ func (m *Envelope_ChunkResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_ChunkResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ChunkResponse != nil { { @@ -1677,6 +1740,9 @@ func (m *Envelope_LightBlockRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_LightBlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.LightBlockRequest != nil { { @@ -1700,6 +1766,9 @@ func (m *Envelope_LightBlockResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_LightBlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.LightBlockResponse != nil { { @@ -1723,6 +1792,9 @@ func (m *Envelope_ParamsRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ParamsRequest != nil { { @@ -1746,6 +1818,9 @@ func (m *Envelope_ParamsResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ParamsResponse != nil { { @@ -1769,6 +1844,9 @@ func (m *Envelope_NewRoundStep) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_NewRoundStep) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.NewRoundStep != nil { { @@ -1792,6 +1870,9 @@ func (m *Envelope_NewValidBlock) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_NewValidBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.NewValidBlock != nil { { @@ -1815,6 +1896,9 @@ func (m *Envelope_Proposal) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Proposal != nil { { @@ -1838,6 +1922,9 @@ func (m *Envelope_ProposalPol) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_ProposalPol) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ProposalPol != nil { { @@ -1861,6 +1948,9 @@ func (m *Envelope_BlockPart) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_BlockPart) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.BlockPart != nil { { @@ -1884,6 +1974,9 @@ func (m *Envelope_Vote) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Vote != nil { { @@ -1907,6 +2000,9 @@ func (m *Envelope_HasVote) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_HasVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.HasVote != nil { { @@ -1930,6 +2026,9 @@ func (m *Envelope_VoteSetMaj23) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_VoteSetMaj23) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.VoteSetMaj23 != nil { { @@ -1953,6 +2052,9 @@ func (m *Envelope_VoteSetBits) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_VoteSetBits) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.VoteSetBits != nil { { @@ -1976,6 +2078,9 @@ func (m *Envelope_Commit) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.Commit != nil { { @@ -1999,6 +2104,9 @@ func (m *Envelope_HasCommit) MarshalTo(dAtA []byte) (int, error) { } func (m *Envelope_HasCommit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.HasCommit != nil { { diff --git a/proto/tendermint/privval/types.pb.go b/proto/tendermint/privval/types.pb.go index 4a2697fee1..6958b2e696 100644 --- a/proto/tendermint/privval/types.pb.go +++ b/proto/tendermint/privval/types.pb.go @@ -1114,6 +1114,9 @@ func (m *RemoteSignerError) MarshalTo(dAtA []byte) (int, error) { } func (m *RemoteSignerError) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1149,6 +1152,9 @@ func (m *PubKeyRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *PubKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1186,6 +1192,9 @@ func (m *ThresholdPubKeyRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *ThresholdPubKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1223,6 +1232,9 @@ func (m *ProTxHashRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *ProTxHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1253,6 +1265,9 @@ func (m *PubKeyResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *PubKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1298,6 +1313,9 @@ func (m *ThresholdPubKeyResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *ThresholdPubKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1343,6 +1361,9 @@ func (m *ProTxHashResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *ProTxHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1385,6 +1406,9 @@ func (m *SignVoteRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *SignVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1439,6 +1463,9 @@ func (m *SignedVoteResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *SignedVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1484,6 +1511,9 @@ func (m *SignProposalRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *SignProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1538,6 +1568,9 @@ func (m *SignedProposalResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *SignedProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1583,6 +1616,9 @@ func (m *PingRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *PingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1606,6 +1642,9 @@ func (m *PingResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *PingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1629,6 +1668,9 @@ func (m *Message) MarshalTo(dAtA []byte) (int, error) { } func (m *Message) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1651,6 +1693,9 @@ func (m *Message_PubKeyRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_PubKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PubKeyRequest != nil { { @@ -1672,6 +1717,9 @@ func (m *Message_PubKeyResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_PubKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PubKeyResponse != nil { { @@ -1693,6 +1741,9 @@ func (m *Message_SignVoteRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_SignVoteRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.SignVoteRequest != nil { { @@ -1714,6 +1765,9 @@ func (m *Message_SignedVoteResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_SignedVoteResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.SignedVoteResponse != nil { { @@ -1735,6 +1789,9 @@ func (m *Message_SignProposalRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_SignProposalRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.SignProposalRequest != nil { { @@ -1756,6 +1813,9 @@ func (m *Message_SignedProposalResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_SignedProposalResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.SignedProposalResponse != nil { { @@ -1777,6 +1837,9 @@ func (m *Message_PingRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_PingRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PingRequest != nil { { @@ -1798,6 +1861,9 @@ func (m *Message_PingResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_PingResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.PingResponse != nil { { @@ -1819,6 +1885,9 @@ func (m *Message_ProTxHashRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_ProTxHashRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ProTxHashRequest != nil { { @@ -1840,6 +1909,9 @@ func (m *Message_ProTxHashResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_ProTxHashResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ProTxHashResponse != nil { { @@ -1861,6 +1933,9 @@ func (m *Message_ThresholdPubKeyRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_ThresholdPubKeyRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ThresholdPubKeyRequest != nil { { @@ -1882,6 +1957,9 @@ func (m *Message_ThresholdPubKeyResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *Message_ThresholdPubKeyResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.ThresholdPubKeyResponse != nil { { @@ -1913,6 +1991,9 @@ func (m *AuthSigMessage) MarshalTo(dAtA []byte) (int, error) { } func (m *AuthSigMessage) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/state/types.pb.go b/proto/tendermint/state/types.pb.go index 792516f9c9..a62a666ba4 100644 --- a/proto/tendermint/state/types.pb.go +++ b/proto/tendermint/state/types.pb.go @@ -491,6 +491,9 @@ func (m *ABCIResponses) MarshalTo(dAtA []byte) (int, error) { } func (m *ABCIResponses) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -526,6 +529,9 @@ func (m *ValidatorsInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *ValidatorsInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -566,6 +572,9 @@ func (m *ConsensusParamsInfo) MarshalTo(dAtA []byte) (int, error) { } func (m *ConsensusParamsInfo) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -604,6 +613,9 @@ func (m *Version) MarshalTo(dAtA []byte) (int, error) { } func (m *Version) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -644,6 +656,9 @@ func (m *State) MarshalTo(dAtA []byte) (int, error) { } func (m *State) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/statesync/types.pb.go b/proto/tendermint/statesync/types.pb.go index 64ab0bb378..c844952e14 100644 --- a/proto/tendermint/statesync/types.pb.go +++ b/proto/tendermint/statesync/types.pb.go @@ -508,6 +508,9 @@ func (m *SnapshotsRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *SnapshotsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -531,6 +534,9 @@ func (m *SnapshotsResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *SnapshotsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -578,6 +584,9 @@ func (m *ChunkRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *ChunkRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -618,6 +627,9 @@ func (m *ChunkResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *ChunkResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -675,6 +687,9 @@ func (m *LightBlockRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *LightBlockRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -703,6 +718,9 @@ func (m *LightBlockResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *LightBlockResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -738,6 +756,9 @@ func (m *ParamsRequest) MarshalTo(dAtA []byte) (int, error) { } func (m *ParamsRequest) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -766,6 +787,9 @@ func (m *ParamsResponse) MarshalTo(dAtA []byte) (int, error) { } func (m *ParamsResponse) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/types/block.pb.go b/proto/tendermint/types/block.pb.go index 1c37a498bc..a804a2bd45 100644 --- a/proto/tendermint/types/block.pb.go +++ b/proto/tendermint/types/block.pb.go @@ -145,6 +145,9 @@ func (m *Block) MarshalTo(dAtA []byte) (int, error) { } func (m *Block) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/types/canonical.pb.go b/proto/tendermint/types/canonical.pb.go index db9b751d3a..46e1060b2b 100644 --- a/proto/tendermint/types/canonical.pb.go +++ b/proto/tendermint/types/canonical.pb.go @@ -437,6 +437,9 @@ func (m *CanonicalBlockID) MarshalTo(dAtA []byte) (int, error) { } func (m *CanonicalBlockID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -477,6 +480,9 @@ func (m *CanonicalPartSetHeader) MarshalTo(dAtA []byte) (int, error) { } func (m *CanonicalPartSetHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -512,6 +518,9 @@ func (m *CanonicalProposal) MarshalTo(dAtA []byte) (int, error) { } func (m *CanonicalProposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -584,6 +593,9 @@ func (m *CanonicalVote) MarshalTo(dAtA []byte) (int, error) { } func (m *CanonicalVote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -647,6 +659,9 @@ func (m *CanonicalVoteExtension) MarshalTo(dAtA []byte) (int, error) { } func (m *CanonicalVoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/types/dash.pb.go b/proto/tendermint/types/dash.pb.go index 8e14ec95f0..b53ebbdc8c 100644 --- a/proto/tendermint/types/dash.pb.go +++ b/proto/tendermint/types/dash.pb.go @@ -306,6 +306,9 @@ func (m *CoreChainLock) MarshalTo(dAtA []byte) (int, error) { } func (m *CoreChainLock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -348,6 +351,9 @@ func (m *VoteExtension) MarshalTo(dAtA []byte) (int, error) { } func (m *VoteExtension) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -389,6 +395,9 @@ func (m *VoteExtension_SignRequestId) MarshalTo(dAtA []byte) (int, error) { } func (m *VoteExtension_SignRequestId) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.SignRequestId != nil { i -= len(m.SignRequestId) diff --git a/proto/tendermint/types/events.pb.go b/proto/tendermint/types/events.pb.go index ccd0cac04a..4ba7790ca4 100644 --- a/proto/tendermint/types/events.pb.go +++ b/proto/tendermint/types/events.pb.go @@ -121,6 +121,9 @@ func (m *EventDataRoundState) MarshalTo(dAtA []byte) (int, error) { } func (m *EventDataRoundState) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/types/evidence.pb.go b/proto/tendermint/types/evidence.pb.go index 8fe8530e2f..3fa4dd8f47 100644 --- a/proto/tendermint/types/evidence.pb.go +++ b/proto/tendermint/types/evidence.pb.go @@ -274,6 +274,9 @@ func (m *Evidence) MarshalTo(dAtA []byte) (int, error) { } func (m *Evidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -296,6 +299,9 @@ func (m *Evidence_DuplicateVoteEvidence) MarshalTo(dAtA []byte) (int, error) { } func (m *Evidence_DuplicateVoteEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) if m.DuplicateVoteEvidence != nil { { @@ -327,6 +333,9 @@ func (m *DuplicateVoteEvidence) MarshalTo(dAtA []byte) (int, error) { } func (m *DuplicateVoteEvidence) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -392,6 +401,9 @@ func (m *EvidenceList) MarshalTo(dAtA []byte) (int, error) { } func (m *EvidenceList) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/types/params.pb.go b/proto/tendermint/types/params.pb.go index c082dd0833..375ef243c3 100644 --- a/proto/tendermint/types/params.pb.go +++ b/proto/tendermint/types/params.pb.go @@ -1107,6 +1107,9 @@ func (m *ConsensusParams) MarshalTo(dAtA []byte) (int, error) { } func (m *ConsensusParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1214,6 +1217,9 @@ func (m *BlockParams) MarshalTo(dAtA []byte) (int, error) { } func (m *BlockParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1247,6 +1253,9 @@ func (m *EvidenceParams) MarshalTo(dAtA []byte) (int, error) { } func (m *EvidenceParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1288,6 +1297,9 @@ func (m *ValidatorParams) MarshalTo(dAtA []byte) (int, error) { } func (m *ValidatorParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1319,6 +1331,9 @@ func (m *ValidatorParams_VotingPowerThreshold) MarshalTo(dAtA []byte) (int, erro } func (m *ValidatorParams_VotingPowerThreshold) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) i = encodeVarintParams(dAtA, i, uint64(m.VotingPowerThreshold)) i-- @@ -1341,6 +1356,9 @@ func (m *VersionParams) MarshalTo(dAtA []byte) (int, error) { } func (m *VersionParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1374,6 +1392,9 @@ func (m *HashedParams) MarshalTo(dAtA []byte) (int, error) { } func (m *HashedParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1412,6 +1433,9 @@ func (m *SynchronyParams) MarshalTo(dAtA []byte) (int, error) { } func (m *SynchronyParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1455,6 +1479,9 @@ func (m *TimeoutParams) MarshalTo(dAtA []byte) (int, error) { } func (m *TimeoutParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1518,6 +1545,9 @@ func (m *ABCIParams) MarshalTo(dAtA []byte) (int, error) { } func (m *ABCIParams) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/types/types.pb.go b/proto/tendermint/types/types.pb.go index 4897e23fca..1dd9d243db 100644 --- a/proto/tendermint/types/types.pb.go +++ b/proto/tendermint/types/types.pb.go @@ -1268,6 +1268,9 @@ func (m *PartSetHeader) MarshalTo(dAtA []byte) (int, error) { } func (m *PartSetHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1303,6 +1306,9 @@ func (m *Part) MarshalTo(dAtA []byte) (int, error) { } func (m *Part) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1348,6 +1354,9 @@ func (m *BlockID) MarshalTo(dAtA []byte) (int, error) { } func (m *BlockID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1395,6 +1404,9 @@ func (m *StateID) MarshalTo(dAtA []byte) (int, error) { } func (m *StateID) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1449,6 +1461,9 @@ func (m *Header) MarshalTo(dAtA []byte) (int, error) { } func (m *Header) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1596,6 +1611,9 @@ func (m *Data) MarshalTo(dAtA []byte) (int, error) { } func (m *Data) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1628,6 +1646,9 @@ func (m *Vote) MarshalTo(dAtA []byte) (int, error) { } func (m *Vote) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1709,6 +1730,9 @@ func (m *Commit) MarshalTo(dAtA []byte) (int, error) { } func (m *Commit) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1780,6 +1804,9 @@ func (m *Proposal) MarshalTo(dAtA []byte) (int, error) { } func (m *Proposal) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1865,6 +1892,9 @@ func (m *SignedHeader) MarshalTo(dAtA []byte) (int, error) { } func (m *SignedHeader) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1912,6 +1942,9 @@ func (m *LightBlock) MarshalTo(dAtA []byte) (int, error) { } func (m *LightBlock) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -1959,6 +1992,9 @@ func (m *BlockMeta) MarshalTo(dAtA []byte) (int, error) { } func (m *BlockMeta) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -2027,6 +2063,9 @@ func (m *TxProof) MarshalTo(dAtA []byte) (int, error) { } func (m *TxProof) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/types/validator.pb.go b/proto/tendermint/types/validator.pb.go index 80d2459e0c..a2dcc14891 100644 --- a/proto/tendermint/types/validator.pb.go +++ b/proto/tendermint/types/validator.pb.go @@ -311,6 +311,9 @@ func (m *ValidatorSet) MarshalTo(dAtA []byte) (int, error) { } func (m *ValidatorSet) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -402,6 +405,9 @@ func (m *Validator) MarshalTo(dAtA []byte) (int, error) { } func (m *Validator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int @@ -461,6 +467,9 @@ func (m *SimpleValidator) MarshalTo(dAtA []byte) (int, error) { } func (m *SimpleValidator) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int diff --git a/proto/tendermint/version/types.pb.go b/proto/tendermint/version/types.pb.go index 7ba940c46a..66b9174c07 100644 --- a/proto/tendermint/version/types.pb.go +++ b/proto/tendermint/version/types.pb.go @@ -143,6 +143,9 @@ func (m *Consensus) MarshalTo(dAtA []byte) (int, error) { } func (m *Consensus) MarshalToSizedBuffer(dAtA []byte) (int, error) { + if m == nil { + return 0, nil + } i := len(dAtA) _ = i var l int From cb6cf44b4185e905f76b50f0824d4bffa6827c2e Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Tue, 18 Feb 2025 09:48:02 +0100 Subject: [PATCH 08/17] chore(github): fix forked gogoproto install --- .github/workflows/check-generated.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check-generated.yml b/.github/workflows/check-generated.yml index fe49912ab3..c86e94d284 100644 --- a/.github/workflows/check-generated.yml +++ b/.github/workflows/check-generated.yml @@ -77,7 +77,13 @@ jobs: go install github.com/bufbuild/buf/cmd/buf # Forked version of gogoproto plugin with fix https://github.com/cosmos/gogoproto/pull/150 # go install github.com/cosmos/gogoproto/protoc-gen-gogofaster@latest - go install github.com/lklimek/gogoproto/protoc-gen-gogofaster@564fd924f58c5d076b0ad8e3f1c6fb54d065cbbe + git clone --depth 1 --branch fix/panic-marshalto-nil-m \ + https://github.com/lklimek/gogoproto /tmp/gogoproto + pushd /tmp/gogoproto + go install ./protoc-gen-gogofaster + popd + rm -rf /tmp/gogoproto + # End of forked version installation make proto-gen From cdf0321f89f705f014a20f938559a94669c5bc61 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Tue, 18 Feb 2025 10:14:02 +0100 Subject: [PATCH 09/17] fix(types): nil validator threshold saved as 0 --- types/params.go | 37 +++++++++++++++++-------------------- 1 file changed, 17 insertions(+), 20 deletions(-) diff --git a/types/params.go b/types/params.go index cd12ea9bbf..acc4a1600a 100644 --- a/types/params.go +++ b/types/params.go @@ -245,41 +245,38 @@ func (val *ValidatorParams) ToProto() *tmproto.ValidatorParams { if val == nil { return nil } - var threshold *tmproto.ValidatorParams_VotingPowerThreshold + + params := tmproto.ValidatorParams{ + PubKeyTypes: val.PubKeyTypes, + } + if val.VotingPowerThreshold != nil { - threshold = &tmproto.ValidatorParams_VotingPowerThreshold{ - VotingPowerThreshold: uint64(*val.VotingPowerThreshold), + params.XVotingPowerThreshold = &tmproto.ValidatorParams_VotingPowerThreshold{ + VotingPowerThreshold: *val.VotingPowerThreshold, } } - return &tmproto.ValidatorParams{ - PubKeyTypes: val.PubKeyTypes, - XVotingPowerThreshold: threshold, - } + return ¶ms } // ValidatorParamsFromProto returns a ValidatorParams from a protobuf representation. // If pbValParams is nil, it returns a ValidatorParams with empty PubKeyTypes and 0 VotingPowerThreshold. func ValidatorParamsFromProto(pbValParams *tmproto.ValidatorParams) ValidatorParams { + var params = ValidatorParams{ + PubKeyTypes: []string{}, + } + if pbValParams != nil { - var threshold *uint64 if pbValParams.XVotingPowerThreshold != nil { val := pbValParams.GetVotingPowerThreshold() - threshold = &val - } - - return ValidatorParams{ - // Copy Validator.PubkeyTypes, and set result's value to the copy. - // This avoids having to initialize the slice to 0 values, and then write to it again. - PubKeyTypes: append([]string{}, pbValParams.PubKeyTypes...), - VotingPowerThreshold: threshold, + params.VotingPowerThreshold = &val } + // Copy Validator.PubkeyTypes, and set result's value to the copy. + // This avoids having to initialize the slice to 0 values, and then write to it again. + params.PubKeyTypes = append(params.PubKeyTypes, pbValParams.PubKeyTypes...) } - return ValidatorParams{ - PubKeyTypes: []string{}, - VotingPowerThreshold: nil, - } + return params } func (params *ConsensusParams) Complete() { From 2a07242aa5b2c70de91fc3b6f0b3d10663f61f51 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Tue, 18 Feb 2025 10:17:23 +0100 Subject: [PATCH 10/17] test: remove panic test after fixing gogoproto bug --- proto/tendermint/types/dash_test.go | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) diff --git a/proto/tendermint/types/dash_test.go b/proto/tendermint/types/dash_test.go index 0191df6952..a620071eb2 100644 --- a/proto/tendermint/types/dash_test.go +++ b/proto/tendermint/types/dash_test.go @@ -3,14 +3,14 @@ package types_test import ( "testing" - "github.com/dashpay/tenderdash/proto/tendermint/types" "github.com/stretchr/testify/assert" + + "github.com/dashpay/tenderdash/proto/tendermint/types" ) func TestMarshalVoteExtension(t *testing.T) { testCases := []struct { - extension types.VoteExtension - expectPanic bool + extension types.VoteExtension }{ { extension: types.VoteExtension{ @@ -31,10 +31,8 @@ func TestMarshalVoteExtension(t *testing.T) { Extension: []byte("threshold"), XSignRequestId: &types.VoteExtension_SignRequestId{nil}, }}, - // Test below panics because of nil pointer dereference bug in gogoproto - // FIXME: remove expectPanic when we replace gogoproto + { - expectPanic: true, extension: types.VoteExtension{ Type: types.VoteExtensionType_THRESHOLD_RECOVER_RAW, Extension: []byte("threshold"), @@ -58,17 +56,10 @@ func TestMarshalVoteExtension(t *testing.T) { Type: types.PrecommitType, VoteExtensions: []*types.VoteExtension{&tc.extension}, } - f := func() { - marshaled, err := v.Marshal() - assert.NoError(t, err) - assert.NotEmpty(t, marshaled) - } - if tc.expectPanic { - assert.Panics(t, f) - } else { - assert.NotPanics(t, f) - } + marshaled, err := v.Marshal() + assert.NoError(t, err) + assert.NotEmpty(t, marshaled) }) } From d096849c638d272a2d5f90d373ce95d9c72b7bef Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Tue, 18 Feb 2025 10:30:10 +0100 Subject: [PATCH 11/17] chore(version): bump ABCI version to 1.3.0 --- version/version.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/version/version.go b/version/version.go index e2db669794..df7d4822e8 100644 --- a/version/version.go +++ b/version/version.go @@ -11,7 +11,7 @@ const ( // when not using git describe. It is formatted with semantic versioning. TMVersionDefault = "1.4.0" // ABCISemVer is the semantic version of the ABCI library - ABCISemVer = "1.2.0" + ABCISemVer = "1.3.0" ABCIVersion = ABCISemVer ) From 01da3ccdd6e54a47dc4367dc89c0d69995fa9bac Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Tue, 18 Feb 2025 11:59:05 +0100 Subject: [PATCH 12/17] chore: minor fixes --- types/validator_set.go | 3 ++- types/vote_set_test.go | 12 ++++++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/types/validator_set.go b/types/validator_set.go index 569f87403e..e2198fdee9 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -175,7 +175,8 @@ func (vals *ValidatorSet) ValidateBasic() error { default: // For validator sets containing more than 3 validators, the threshold MUST be at least 2/3 + 1 of the total voting power. if threshold < (totalPower*2/3)+1 { - return fmt.Errorf("quorum voting power %d is less than threshold %d", totalPower, threshold) + return fmt.Errorf("voting threshold %d of quorum with power %d MUST be at least 2/3*%d+1 = %d", + threshold, totalPower, totalPower, (totalPower*2/3)+1) } } diff --git a/types/vote_set_test.go b/types/vote_set_test.go index 8be26dad0a..dd3f95f016 100644 --- a/types/vote_set_test.go +++ b/types/vote_set_test.go @@ -552,8 +552,6 @@ func TestVoteSet_LLMQType_50_60(t *testing.T) { // Given a set of validators and a threshold defined in ValidatorParams, // when votes are cast, // then the threshold from ValidatorParams is respected. -// FIXME: threshold 1 causes "panic: At least 2 coefficients required" -// in bls-signatures C++ library. func TestVoteSet_ValidatorParams_Threshold(t *testing.T) { const ( height = int64(1) @@ -574,6 +572,16 @@ func TestVoteSet_ValidatorParams_Threshold(t *testing.T) { numValidators: 2, threshold: 2, }, + { // full network but threshold 2 + llmqType: btcjson.LLMQType_100_67, + numValidators: 100, + threshold: 2, + }, + { // full network but threshold 3 + llmqType: btcjson.LLMQType_100_67, + numValidators: 100, + threshold: 3, + }, { // normal network llmqType: btcjson.LLMQType_100_67, numValidators: 100, From b30f1d37e7fce99c1e47071fb46ab226dcd83a0f Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Tue, 18 Feb 2025 12:02:24 +0100 Subject: [PATCH 13/17] test(e2e): support voting_power_threshold tests --- internal/state/state_test.go | 2 ++ test/e2e/networks/single.toml | 2 ++ test/e2e/pkg/manifest.go | 4 ++++ test/e2e/pkg/testnet.go | 2 ++ test/e2e/runner/setup.go | 4 ++++ 5 files changed, 14 insertions(+) diff --git a/internal/state/state_test.go b/internal/state/state_test.go index 31d95ca935..95cd2e0749 100644 --- a/internal/state/state_test.go +++ b/internal/state/state_test.go @@ -630,6 +630,7 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) { for i := 1; i < N+1; i++ { params[i] = *types.DefaultConsensusParams() params[i].Block.MaxBytes += int64(i) + params[i].Validator.PubKeyTypes = []string{"bls12381"} } cp := params[changeIndex] @@ -673,6 +674,7 @@ func TestConsensusParamsChangesSaveLoad(t *testing.T) { for _, testCase := range testCases { p, err := stateStore.LoadConsensusParams(testCase.height) + assert.EqualValues(t, []string{"bls12381"}, p.Validator.PubKeyTypes) assert.NoError(t, err, fmt.Sprintf("expected no err at height %d", testCase.height)) assert.EqualValues(t, testCase.params, p, fmt.Sprintf(`unexpected consensus params at height %d`, testCase.height)) diff --git a/test/e2e/networks/single.toml b/test/e2e/networks/single.toml index 54c40b19e4..2e0aef1a89 100644 --- a/test/e2e/networks/single.toml +++ b/test/e2e/networks/single.toml @@ -1 +1,3 @@ +voting_power_threshold = 100 + [node.validator] diff --git a/test/e2e/pkg/manifest.go b/test/e2e/pkg/manifest.go index e44b714f5e..bcb776d551 100644 --- a/test/e2e/pkg/manifest.go +++ b/test/e2e/pkg/manifest.go @@ -17,6 +17,10 @@ type Manifest struct { // QuorumType represents the initial quorum type QuorumType uint32 `toml:"quorum_type"` + // VotingPowerThreshold represents how much voting power is needed to approve a block; + // typically it's set to `(2/3 * num of validators + 1) * 100` where 100 is the default voting power. + VotingPowerThreshold uint64 `toml:"voting_power_threshold"` + // InitialHeight specifies the initial block height, set in genesis. Defaults to 1. InitialHeight int64 `toml:"initial_height"` diff --git a/test/e2e/pkg/testnet.go b/test/e2e/pkg/testnet.go index a92b7816bd..26ea2d393d 100644 --- a/test/e2e/pkg/testnet.go +++ b/test/e2e/pkg/testnet.go @@ -100,6 +100,7 @@ type Testnet struct { ThresholdPublicKey crypto.PubKey ThresholdPublicKeyUpdates map[int64]crypto.PubKey QuorumType btcjson.LLMQType + VotingPowerThreshold uint64 QuorumHash crypto.QuorumHash QuorumHashUpdates map[int64]crypto.QuorumHash // ConsensusVersionUpdates maps height to new consensus version (ConsensusParams.Version.ConsensusVersion) @@ -216,6 +217,7 @@ func LoadTestnet(file string) (*Testnet, error) { ThresholdPublicKey: ld.ThresholdPubKey, ThresholdPublicKeyUpdates: map[int64]crypto.PubKey{}, QuorumType: btcjson.LLMQType(quorumType), + VotingPowerThreshold: manifest.VotingPowerThreshold, QuorumHash: quorumHash, QuorumHashUpdates: map[int64]crypto.QuorumHash{}, ConsensusVersionUpdates: map[int64]int32{}, diff --git a/test/e2e/runner/setup.go b/test/e2e/runner/setup.go index d149e042a1..ad14e43064 100644 --- a/test/e2e/runner/setup.go +++ b/test/e2e/runner/setup.go @@ -179,6 +179,10 @@ func MakeGenesis(testnet *e2e.Testnet, genesisTime time.Time) (types.GenesisDoc, if testnet.MaxBlockSize > 0 { genesis.ConsensusParams.Block.MaxBytes = testnet.MaxBlockSize } + if testnet.VotingPowerThreshold > 0 { + threshold := testnet.VotingPowerThreshold + genesis.ConsensusParams.Validator.VotingPowerThreshold = &threshold + } for validator, validatorUpdate := range testnet.Validators { if validatorUpdate.PubKey == nil { From 5c757d472fe55cb6ae5e6e3d7df5981ec67d3c24 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Tue, 18 Feb 2025 12:05:55 +0100 Subject: [PATCH 14/17] chore: fix comment --- proto/tendermint/types/params.proto | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/proto/tendermint/types/params.proto b/proto/tendermint/types/params.proto index 7e063e3499..4ac45ab7b7 100644 --- a/proto/tendermint/types/params.proto +++ b/proto/tendermint/types/params.proto @@ -75,7 +75,7 @@ message ValidatorParams { // If set to 0, default value is determined based on LLMQ quorum type defined for the network, // with a fall back to 2/3 + 1 of the total voting power. // - // If absent, + // If absent, previous value is used. optional uint64 voting_power_threshold = 2; //[(gogoproto.nullable) = true] } From 6ae8fef075cdf280b64ce988254992c624892b05 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Tue, 18 Feb 2025 13:09:44 +0100 Subject: [PATCH 15/17] chore: fix some lint warnings --- internal/evidence/reactor_test.go | 2 +- types/validator_set.go | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/internal/evidence/reactor_test.go b/internal/evidence/reactor_test.go index 088232cec3..9446b8d55b 100644 --- a/internal/evidence/reactor_test.go +++ b/internal/evidence/reactor_test.go @@ -99,7 +99,7 @@ func setup(ctx context.Context, t *testing.T, stateStores []sm.Store) *reactorTe rts.network.Nodes[nodeID].PeerManager.Register(ctx, pu) rts.nodes = append(rts.nodes, rts.network.Nodes[nodeID]) - chCreator := func(_ctx context.Context, chdesc *p2p.ChannelDescriptor) (p2p.Channel, error) { + chCreator := func(_ctx context.Context, _chDesc *p2p.ChannelDescriptor) (p2p.Channel, error) { return rts.evidenceChannels[nodeID], nil } diff --git a/types/validator_set.go b/types/validator_set.go index e2198fdee9..19039c5e62 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -427,6 +427,10 @@ func (vals *ValidatorSet) QuorumVotingPower() int64 { // Voting is considered successful when voting power is at or above this threshold. func (vals *ValidatorSet) QuorumVotingThresholdPower() int64 { if thresholdPower := vals.VotingPowerThreshold; thresholdPower > 0 { + if thresholdPower > math.MaxInt64 { + // this should never happen + panic(fmt.Sprintf("threshold power %d is too large", thresholdPower)) + } return int64(thresholdPower) } From d58a7035170e875a8409b23a098f16cb14e94ed4 Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Wed, 5 Mar 2025 15:52:00 +0100 Subject: [PATCH 16/17] chore: apply rabbit feedback --- Makefile | 2 +- types/validator_set.go | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 7347d7e0e7..53e36ee2bf 100644 --- a/Makefile +++ b/Makefile @@ -19,7 +19,7 @@ DOCKER_PROTO := docker run -v $(shell pwd):/workspace --workdir /workspace $(BUI CGO_ENABLED ?= 1 # Fix for a gogoproto bug # GOGOPROTO_PATH = $(shell go list -m -f '{{.Dir}}' github.com/cosmos/gogoproto) -GOGOPROTO_PATH = $(shell go list -m -f '{{.Dir}}' github.com/lklimek/gogoproto@564fd924f58c5d076b0ad8e3f1c6fb54d065cbbe) +GOGOPROTO_PATH = $(shell go list -m -f '{{.Dir}}' github.com/lklimek/gogoproto@564fd924f58c5d076b0ad8e3f1c6fb54d065cbbe) MAKEFILE_PATH := $(abspath $(lastword $(MAKEFILE_LIST))) CURR_DIR := $(dir $(MAKEFILE_PATH)) diff --git a/types/validator_set.go b/types/validator_set.go index 19039c5e62..5d2d23c420 100644 --- a/types/validator_set.go +++ b/types/validator_set.go @@ -157,7 +157,11 @@ func (vals *ValidatorSet) ValidateBasic() error { if err := vals.Proposer().ValidateBasic(); err != nil { return fmt.Errorf("proposer failed validate basic, error: %w", err) } - // TODO: Validate that vals.VotingPowerThreshold == ValidatorParams.voting_power_threshold + + if vals.VotingPowerThreshold > math.MaxInt64 { + return fmt.Errorf("voting power threshold %d is too large", vals.VotingPowerThreshold) + } + threshold := vals.QuorumVotingThresholdPower() totalPower := vals.TotalVotingPower() switch len(vals.Validators) { From 079d909d5c7a4caebc643aa0d2351fc9bc536fdf Mon Sep 17 00:00:00 2001 From: Lukasz Klimek <842586+lklimek@users.noreply.github.com> Date: Mon, 7 Apr 2025 10:54:11 +0200 Subject: [PATCH 17/17] fix(consensus): validator threshold from genesis is not used --- internal/consensus/replayer.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/internal/consensus/replayer.go b/internal/consensus/replayer.go index 45b39cbd4d..d2a32c258c 100644 --- a/internal/consensus/replayer.go +++ b/internal/consensus/replayer.go @@ -346,6 +346,8 @@ func (r *BlockReplayer) execInitChain(ctx context.Context, rs *replayState, stat if res.ConsensusParams != nil && res.ConsensusParams.Validator != nil { params := types.ValidatorParamsFromProto(res.ConsensusParams.Validator) valParams = ¶ms + } else { + valParams = &r.genDoc.ConsensusParams.Validator } if len(res.ValidatorSetUpdate.ValidatorUpdates) != 0 {