From 2323f1ac0e9a69a0da6b43693061036134193464 Mon Sep 17 00:00:00 2001 From: Marko Date: Wed, 14 Oct 2020 08:20:52 +0200 Subject: [PATCH] tendermint: update sdk to rc5 (#7527) * update sdk to rc5 * Update baseapp/params.go Co-authored-by: Aleksandr Bezobchuk --- Makefile | 2 +- baseapp/params.go | 4 ++-- baseapp/params_test.go | 4 ++-- go.mod | 2 +- go.sum | 2 ++ server/export.go | 2 +- simapp/test_helpers.go | 2 +- third_party/proto/confio/proofs.proto | 1 - third_party/proto/tendermint/abci/types.proto | 20 +++++++++---------- .../proto/tendermint/types/evidence.proto | 12 +++++------ .../proto/tendermint/types/params.proto | 9 ++++----- .../proto/tendermint/types/types.proto | 11 +++------- 12 files changed, 33 insertions(+), 38 deletions(-) diff --git a/Makefile b/Makefile index e077ed22ac61..28628f395ac3 100644 --- a/Makefile +++ b/Makefile @@ -387,7 +387,7 @@ proto-check-breaking-docker: @$(DOCKER_BUF) check breaking --against-input $(HTTPS_GIT)#branch=master .PHONY: proto-check-breaking-ci -TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/3359e0bf2f8414d9687f9eecda67b899d64a9cd1/proto/tendermint +TM_URL = https://raw.githubusercontent.com/tendermint/tendermint/v0.34.0-rc5/proto/tendermint GOGO_PROTO_URL = https://raw.githubusercontent.com/regen-network/protobuf/cosmos COSMOS_PROTO_URL = https://raw.githubusercontent.com/regen-network/cosmos-proto/master CONFIO_URL = https://raw.githubusercontent.com/confio/ics23/v0.6.2 diff --git a/baseapp/params.go b/baseapp/params.go index 7b3ec6ff7d23..9682afb31fc0 100644 --- a/baseapp/params.go +++ b/baseapp/params.go @@ -63,8 +63,8 @@ func ValidateEvidenceParams(i interface{}) error { return fmt.Errorf("evidence maximum age time duration must be positive: %v", v.MaxAgeDuration) } - if v.MaxNum <= 0 { - return fmt.Errorf("evidence maximum number of evidence must be positive: %v", v.MaxNum) + if v.MaxBytes < 0 { + return fmt.Errorf("maximum evidence bytes must be positive: %v", v.MaxBytes) } return nil diff --git a/baseapp/params_test.go b/baseapp/params_test.go index a78f132de46a..2d8f8c1addb0 100644 --- a/baseapp/params_test.go +++ b/baseapp/params_test.go @@ -36,8 +36,8 @@ func TestValidateEvidenceParams(t *testing.T) { {nil, true}, {&tmproto.EvidenceParams{}, true}, {tmproto.EvidenceParams{}, true}, - {tmproto.EvidenceParams{MaxAgeNumBlocks: -1, MaxAgeDuration: 18004000, MaxNum: 50}, true}, - {tmproto.EvidenceParams{MaxAgeNumBlocks: 360000, MaxAgeDuration: 18004000, MaxNum: 50}, false}, + {tmproto.EvidenceParams{MaxAgeNumBlocks: -1, MaxAgeDuration: 18004000, MaxBytes: 5000000}, true}, + {tmproto.EvidenceParams{MaxAgeNumBlocks: 360000, MaxAgeDuration: 18004000, MaxBytes: 5000000}, false}, } for _, tc := range testCases { diff --git a/go.mod b/go.mod index 140b1c0836d5..aa334636f111 100644 --- a/go.mod +++ b/go.mod @@ -45,7 +45,7 @@ require ( github.com/tendermint/btcd v0.1.1 github.com/tendermint/crypto v0.0.0-20191022145703-50d29ede1e15 github.com/tendermint/go-amino v0.16.0 - github.com/tendermint/tendermint v0.34.0-rc4.0.20201005135527-d7d0ffea13c6 + github.com/tendermint/tendermint v0.34.0-rc5 github.com/tendermint/tm-db v0.6.2 golang.org/x/crypto v0.0.0-20200820211705-5c72a883971a golang.org/x/net v0.0.0-20200930145003-4acb6c075d10 // indirect diff --git a/go.sum b/go.sum index aec446a89cf5..b5cfec932c37 100644 --- a/go.sum +++ b/go.sum @@ -593,6 +593,8 @@ github.com/tendermint/tendermint v0.34.0-rc3 h1:d7Fsd5rdbxq4GmJ0kRfx7l7LesQM7e70 github.com/tendermint/tendermint v0.34.0-rc3/go.mod h1:BoHcEpjfpBHc1Be7RQz3AHaXFNObcDG7SNHCev6Or4g= github.com/tendermint/tendermint v0.34.0-rc4.0.20201005135527-d7d0ffea13c6 h1:gqZ0WDpDYgMm/iaiMEXvI1nt/GoWCuwtBomVpUMiAIs= github.com/tendermint/tendermint v0.34.0-rc4.0.20201005135527-d7d0ffea13c6/go.mod h1:BSXqR6vWbOecet726v66qVwSkFDLfEeBrq+EhkKbij4= +github.com/tendermint/tendermint v0.34.0-rc5 h1:2bnQfWyOMfTCbol5pwB8CgM2nxi6/Kz6zqlS6Udm/Cg= +github.com/tendermint/tendermint v0.34.0-rc5/go.mod h1:yotsojf2C1QBOw4dZrTcxbyxmPUrT4hNuOQWX9XUwB4= github.com/tendermint/tm-db v0.6.1 h1:w3X87itMPXopcRPlFiqspEKhw4FXihPk2rnFFkP0zGk= github.com/tendermint/tm-db v0.6.1/go.mod h1:m3x9kRP4UFd7JODJL0yBAZqE7wTw+S37uAE90cTx7OA= github.com/tendermint/tm-db v0.6.2 h1:DOn8jwCdjJblrCFJbtonEIPD1IuJWpbRUUdR8GWE4RM= diff --git a/server/export.go b/server/export.go index b5fccaf050f9..3ed41a64940b 100644 --- a/server/export.go +++ b/server/export.go @@ -90,7 +90,7 @@ func ExportCmd(appExporter types.AppExporter, defaultNodeHome string) *cobra.Com Evidence: tmproto.EvidenceParams{ MaxAgeNumBlocks: exported.ConsensusParams.Evidence.MaxAgeNumBlocks, MaxAgeDuration: exported.ConsensusParams.Evidence.MaxAgeDuration, - MaxNum: exported.ConsensusParams.Evidence.MaxNum, + MaxBytes: exported.ConsensusParams.Evidence.MaxBytes, }, Validator: tmproto.ValidatorParams{ PubKeyTypes: exported.ConsensusParams.Validator.PubKeyTypes, diff --git a/simapp/test_helpers.go b/simapp/test_helpers.go index 8be599139b1d..6c9d146204bd 100644 --- a/simapp/test_helpers.go +++ b/simapp/test_helpers.go @@ -38,7 +38,7 @@ var DefaultConsensusParams = &abci.ConsensusParams{ Evidence: &tmproto.EvidenceParams{ MaxAgeNumBlocks: 302400, MaxAgeDuration: 504 * time.Hour, // 3 weeks is the max duration - MaxNum: 50, + MaxBytes: 10000, }, Validator: &tmproto.ValidatorParams{ PubKeyTypes: []string{ diff --git a/third_party/proto/confio/proofs.proto b/third_party/proto/confio/proofs.proto index da43503ecbd6..9dd39e614d70 100644 --- a/third_party/proto/confio/proofs.proto +++ b/third_party/proto/confio/proofs.proto @@ -1,7 +1,6 @@ syntax = "proto3"; package ics23; -option go_package = "github.com/confio/ics23/go"; enum HashOp { // NO_HASH is the default if no data passed. Note this is an illegal argument some places. diff --git a/third_party/proto/tendermint/abci/types.proto b/third_party/proto/tendermint/abci/types.proto index 09b96f1ddf7a..2cbcabb29b33 100644 --- a/third_party/proto/tendermint/abci/types.proto +++ b/third_party/proto/tendermint/abci/types.proto @@ -334,9 +334,9 @@ message TxResult { // Validator message Validator { - bytes address = 1; // The first 20 bytes of SHA256(public key) + bytes address = 1; // The first 20 bytes of SHA256(public key) // PubKey pub_key = 2 [(gogoproto.nullable)=false]; - int64 power = 3; // The voting power + int64 power = 3; // The voting power } // ValidatorUpdate @@ -352,19 +352,19 @@ message VoteInfo { } enum EvidenceType { - UNKNOWN = 0; - DUPLICATE_VOTE = 1; - LIGHT_CLIENT_ATTACK = 2; + UNKNOWN = 0; + DUPLICATE_VOTE = 1; + LIGHT_CLIENT_ATTACK = 2; } message Evidence { - EvidenceType type = 1; + EvidenceType type = 1; // The offending validator - Validator validator = 2 [(gogoproto.nullable) = false]; - // The height when the offense occurred - int64 height = 3; + Validator validator = 2 [(gogoproto.nullable) = false]; + // The height when the offense occurred + int64 height = 3; // The corresponding time where the offense occurred - google.protobuf.Timestamp time = 4 [ + google.protobuf.Timestamp time = 4 [ (gogoproto.nullable) = false, (gogoproto.stdtime) = true ]; diff --git a/third_party/proto/tendermint/types/evidence.proto b/third_party/proto/tendermint/types/evidence.proto index 3ff10c1b33e3..5f7d860bf4e4 100644 --- a/third_party/proto/tendermint/types/evidence.proto +++ b/third_party/proto/tendermint/types/evidence.proto @@ -4,28 +4,28 @@ package tendermint.types; option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; import "gogoproto/gogo.proto"; -import "google/protobuf/timestamp.proto"; import "tendermint/types/types.proto"; -import "tendermint/crypto/keys.proto"; // DuplicateVoteEvidence contains evidence a validator signed two conflicting // votes. message DuplicateVoteEvidence { Vote vote_a = 1; Vote vote_b = 2; +} - google.protobuf.Timestamp timestamp = 3 - [(gogoproto.nullable) = false, (gogoproto.stdtime) = true]; +message LightClientAttackEvidence { + LightBlock conflicting_block = 1; + int64 common_height = 2; } message Evidence { oneof sum { - DuplicateVoteEvidence duplicate_vote_evidence = 1; + DuplicateVoteEvidence duplicate_vote_evidence = 1; + LightClientAttackEvidence light_client_attack_evidence = 2; } } // EvidenceData contains any evidence of malicious wrong-doing by validators message EvidenceData { repeated Evidence evidence = 1 [(gogoproto.nullable) = false]; - bytes hash = 2; } diff --git a/third_party/proto/tendermint/types/params.proto b/third_party/proto/tendermint/types/params.proto index 897c07c17f6a..0de7d846fbd3 100644 --- a/third_party/proto/tendermint/types/params.proto +++ b/third_party/proto/tendermint/types/params.proto @@ -48,11 +48,10 @@ message EvidenceParams { google.protobuf.Duration max_age_duration = 2 [(gogoproto.nullable) = false, (gogoproto.stdduration) = true]; - // This sets the maximum number of evidence that can be committed in a single block. - // and should fall comfortably under the max block bytes when we consider the size of - // each evidence (See MaxEvidenceBytes). The maximum number is MaxEvidencePerBlock. - // Default is 50 - uint32 max_num = 3; + // This sets the maximum size of total evidence in bytes that can be committed in a single block. + // and should fall comfortably under the max block bytes. + // Default is 1048576 or 1MB + int64 max_bytes = 3; } // ValidatorParams restrict the public key types validators can use. diff --git a/third_party/proto/tendermint/types/types.proto b/third_party/proto/tendermint/types/types.proto index 2762f4a78568..7f7ea74cac21 100644 --- a/third_party/proto/tendermint/types/types.proto +++ b/third_party/proto/tendermint/types/types.proto @@ -5,7 +5,6 @@ option go_package = "github.com/tendermint/tendermint/proto/tendermint/types"; import "gogoproto/gogo.proto"; import "google/protobuf/timestamp.proto"; -import "tendermint/libs/bits/types.proto"; import "tendermint/crypto/proof.proto"; import "tendermint/version/types.proto"; import "tendermint/types/validator.proto"; @@ -26,13 +25,13 @@ enum SignedMsgType { option (gogoproto.goproto_enum_stringer) = true; option (gogoproto.goproto_enum_prefix) = false; - SIGNED_MSG_TYPE_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "UnknownType"]; + SIGNED_MSG_TYPE_UNKNOWN = 0 [(gogoproto.enumvalue_customname) = "UnknownType"]; // Votes SIGNED_MSG_TYPE_PREVOTE = 1 [(gogoproto.enumvalue_customname) = "PrevoteType"]; SIGNED_MSG_TYPE_PRECOMMIT = 2 [(gogoproto.enumvalue_customname) = "PrecommitType"]; // Proposals - SIGNED_MSG_TYPE_PROPOSAL = 32 [(gogoproto.enumvalue_customname) = "ProposalType"]; + SIGNED_MSG_TYPE_PROPOSAL = 32 [(gogoproto.enumvalue_customname) = "ProposalType"]; } // PartsetHeader @@ -88,8 +87,6 @@ message Data { // NOTE: not all txs here are valid. We're just agreeing on the order first. // This means that block.AppHash does not include these txs. repeated bytes txs = 1; - // Volatile - bytes hash = 2; } // Vote represents a prevote, precommit, or commit vote from validators for @@ -113,8 +110,6 @@ message Commit { int32 round = 2; BlockID block_id = 3 [(gogoproto.nullable) = false, (gogoproto.customname) = "BlockID"]; repeated CommitSig signatures = 4 [(gogoproto.nullable) = false]; - bytes hash = 5; - tendermint.libs.bits.BitArray bit_array = 6; } // CommitSig is a part of the Vote included in a Commit. @@ -144,7 +139,7 @@ message SignedHeader { message LightBlock { SignedHeader signed_header = 1; - tendermint.types.ValidatorSet validator_set = 2; + tendermint.types.ValidatorSet validator_set = 2; } message BlockMeta {