mirror of
https://github.com/tendermint/tendermint.git
synced 2026-04-21 00:00:31 +00:00
Merge from master and fix conflicts
Signed-off-by: Thane Thomson <connect@thanethomson.com>
This commit is contained in:
@@ -175,7 +175,7 @@ func (app *Application) FinalizeBlock(req types.RequestFinalizeBlock) types.Resp
|
||||
|
||||
// Punish validators who committed equivocation.
|
||||
for _, ev := range req.ByzantineValidators {
|
||||
if ev.Type == types.EvidenceType_DUPLICATE_VOTE {
|
||||
if ev.Type == types.MisbehaviorType_DUPLICATE_VOTE {
|
||||
addr := string(ev.Validator.Address)
|
||||
if pubKey, ok := app.valAddrToPubKeyMap[addr]; ok {
|
||||
app.updateValidator(types.ValidatorUpdate{
|
||||
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
"github.com/tendermint/tendermint/abci/example/code"
|
||||
abciserver "github.com/tendermint/tendermint/abci/server"
|
||||
"github.com/tendermint/tendermint/abci/types"
|
||||
tmproto "github.com/tendermint/tendermint/proto/tendermint/types"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -104,10 +103,7 @@ func TestPersistentKVStoreInfo(t *testing.T) {
|
||||
// make and apply block
|
||||
height = int64(1)
|
||||
hash := []byte("foo")
|
||||
header := tmproto.Header{
|
||||
Height: height,
|
||||
}
|
||||
kvstore.FinalizeBlock(types.RequestFinalizeBlock{Hash: hash, Header: header})
|
||||
kvstore.FinalizeBlock(types.RequestFinalizeBlock{Hash: hash, Height: height})
|
||||
kvstore.Commit()
|
||||
|
||||
resInfo = kvstore.Info(types.RequestInfo{})
|
||||
@@ -189,13 +185,9 @@ func makeApplyBlock(
|
||||
// make and apply block
|
||||
height := int64(heightInt)
|
||||
hash := []byte("foo")
|
||||
header := tmproto.Header{
|
||||
Height: height,
|
||||
}
|
||||
|
||||
resFinalizeBlock := kvstore.FinalizeBlock(types.RequestFinalizeBlock{
|
||||
Hash: hash,
|
||||
Header: header,
|
||||
Height: height,
|
||||
Txs: txs,
|
||||
})
|
||||
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
2
go.mod
2
go.mod
@@ -73,7 +73,7 @@ require (
|
||||
github.com/charithe/durationcheck v0.0.9 // indirect
|
||||
github.com/chavacava/garif v0.0.0-20210405164556-e8a0a408d6af // indirect
|
||||
github.com/containerd/continuity v0.2.1 // indirect
|
||||
github.com/creachadair/tomledit v0.0.13
|
||||
github.com/creachadair/tomledit v0.0.15
|
||||
github.com/daixiang0/gci v0.3.3 // indirect
|
||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||
github.com/denis-tingaikin/go-header v0.4.3 // indirect
|
||||
|
||||
4
go.sum
4
go.sum
@@ -225,8 +225,8 @@ github.com/creachadair/atomicfile v0.2.4 h1:GRjpQLmz/78I4+nBQpGMFrRa9yrL157AUTrA
|
||||
github.com/creachadair/atomicfile v0.2.4/go.mod h1:BRq8Une6ckFneYXZQ+kO7p1ZZP3I2fzVzf28JxrIkBc=
|
||||
github.com/creachadair/taskgroup v0.3.2 h1:zlfutDS+5XG40AOxcHDSThxKzns8Tnr9jnr6VqkYlkM=
|
||||
github.com/creachadair/taskgroup v0.3.2/go.mod h1:wieWwecHVzsidg2CsUnFinW1faVN4+kq+TDlRJQ0Wbk=
|
||||
github.com/creachadair/tomledit v0.0.13 h1:UKsFVZbCKH/8vIh50cDEtRu2KuBync5v1WXMYb+HSJ0=
|
||||
github.com/creachadair/tomledit v0.0.13/go.mod h1:gvtfnSZLa+YNQD28vaPq0Nk12bRxEhmUdBzAWn+EGF4=
|
||||
github.com/creachadair/tomledit v0.0.15 h1:g/qlpwSFIXEngyz8gcTEGZtvdGBLHODwV+Z0BFILVxw=
|
||||
github.com/creachadair/tomledit v0.0.15/go.mod h1:gvtfnSZLa+YNQD28vaPq0Nk12bRxEhmUdBzAWn+EGF4=
|
||||
github.com/creack/pty v1.1.7/go.mod h1:lj5s0c3V2DBrqTV7llrYr5NG6My20zk30Fl46Y7DoTY=
|
||||
github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E=
|
||||
github.com/cyphar/filepath-securejoin v0.2.2/go.mod h1:FpkQEhXnPnOthhzymB7CGsFk2G9VLXONKD9G7QGMM+4=
|
||||
|
||||
@@ -107,12 +107,14 @@ func (blockExec *BlockExecutor) CreateProposalBlock(
|
||||
rpp, err := blockExec.appClient.PrepareProposal(
|
||||
ctx,
|
||||
abci.RequestPrepareProposal{
|
||||
Hash: block.Hash(),
|
||||
Header: *block.Header.ToProto(),
|
||||
MaxTxBytes: maxDataBytes,
|
||||
Txs: block.Txs.ToSliceOfBytes(),
|
||||
LocalLastCommit: extendedCommitInfo(localLastCommit, votes),
|
||||
ByzantineValidators: block.Evidence.ToABCI(),
|
||||
MaxTxBytes: maxDataBytes,
|
||||
Height: block.Height,
|
||||
Time: block.Time,
|
||||
NextValidatorsHash: block.NextValidatorsHash,
|
||||
ProposerAddress: block.ProposerAddress,
|
||||
},
|
||||
)
|
||||
if err != nil {
|
||||
@@ -148,10 +150,13 @@ func (blockExec *BlockExecutor) ProcessProposal(
|
||||
) (bool, error) {
|
||||
req := abci.RequestProcessProposal{
|
||||
Hash: block.Header.Hash(),
|
||||
Header: *block.Header.ToProto(),
|
||||
Height: block.Header.Height,
|
||||
Time: block.Header.Time,
|
||||
Txs: block.Data.Txs.ToSliceOfBytes(),
|
||||
ProposedLastCommit: buildLastCommitInfo(block, blockExec.store, state.InitialHeight),
|
||||
ByzantineValidators: block.Evidence.ToABCI(),
|
||||
ProposerAddress: block.ProposerAddress,
|
||||
NextValidatorsHash: block.NextValidatorsHash,
|
||||
}
|
||||
|
||||
resp, err := blockExec.appClient.ProcessProposal(ctx, req)
|
||||
@@ -204,15 +209,17 @@ func (blockExec *BlockExecutor) ApplyBlock(
|
||||
return state, ErrInvalidBlock(err)
|
||||
}
|
||||
startTime := time.Now().UnixNano()
|
||||
pbh := block.Header.ToProto()
|
||||
finalizeBlockResponse, err := blockExec.appClient.FinalizeBlock(
|
||||
ctx,
|
||||
abci.RequestFinalizeBlock{
|
||||
Hash: block.Hash(),
|
||||
Header: *pbh,
|
||||
Height: block.Header.Height,
|
||||
Time: block.Header.Time,
|
||||
Txs: block.Txs.ToSliceOfBytes(),
|
||||
DecidedLastCommit: buildLastCommitInfo(block, blockExec.store, state.InitialHeight),
|
||||
ByzantineValidators: block.Evidence.ToABCI(),
|
||||
ProposerAddress: block.ProposerAddress,
|
||||
NextValidatorsHash: block.NextValidatorsHash,
|
||||
},
|
||||
)
|
||||
endTime := time.Now().UnixNano()
|
||||
@@ -628,12 +635,12 @@ func ExecCommitBlock(
|
||||
initialHeight int64,
|
||||
s State,
|
||||
) ([]byte, error) {
|
||||
pbh := block.Header.ToProto()
|
||||
finalizeBlockResponse, err := appConn.FinalizeBlock(
|
||||
ctx,
|
||||
abci.RequestFinalizeBlock{
|
||||
Hash: block.Hash(),
|
||||
Header: *pbh,
|
||||
Height: block.Height,
|
||||
Time: block.Time,
|
||||
Txs: block.Txs.ToSliceOfBytes(),
|
||||
DecidedLastCommit: buildLastCommitInfo(block, store, initialHeight),
|
||||
ByzantineValidators: block.Evidence.ToABCI(),
|
||||
|
||||
@@ -216,16 +216,16 @@ func TestFinalizeBlockByzantineValidators(t *testing.T) {
|
||||
|
||||
ev := []types.Evidence{dve, lcae}
|
||||
|
||||
abciEv := []abci.Evidence{
|
||||
abciMb := []abci.Misbehavior{
|
||||
{
|
||||
Type: abci.EvidenceType_DUPLICATE_VOTE,
|
||||
Type: abci.MisbehaviorType_DUPLICATE_VOTE,
|
||||
Height: 3,
|
||||
Time: defaultEvidenceTime,
|
||||
Validator: types.TM2PB.Validator(state.Validators.Validators[0]),
|
||||
TotalVotingPower: 10,
|
||||
},
|
||||
{
|
||||
Type: abci.EvidenceType_LIGHT_CLIENT_ATTACK,
|
||||
Type: abci.MisbehaviorType_LIGHT_CLIENT_ATTACK,
|
||||
Height: 8,
|
||||
Time: defaultEvidenceTime,
|
||||
Validator: types.TM2PB.Validator(state.Validators.Validators[0]),
|
||||
@@ -268,7 +268,7 @@ func TestFinalizeBlockByzantineValidators(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
// TODO check state and mempool
|
||||
assert.Equal(t, abciEv, app.ByzantineValidators)
|
||||
assert.Equal(t, abciMb, app.ByzantineValidators)
|
||||
}
|
||||
|
||||
func TestProcessProposal(t *testing.T) {
|
||||
@@ -330,14 +330,17 @@ func TestProcessProposal(t *testing.T) {
|
||||
block1.Txs = txs
|
||||
|
||||
expectedRpp := abci.RequestProcessProposal{
|
||||
Hash: block1.Hash(),
|
||||
Header: *block1.Header.ToProto(),
|
||||
Txs: block1.Txs.ToSliceOfBytes(),
|
||||
Hash: block1.Hash(),
|
||||
Height: block1.Header.Height,
|
||||
Time: block1.Header.Time,
|
||||
ByzantineValidators: block1.Evidence.ToABCI(),
|
||||
ProposedLastCommit: abci.CommitInfo{
|
||||
Round: 0,
|
||||
Votes: voteInfos,
|
||||
},
|
||||
NextValidatorsHash: block1.NextValidatorsHash,
|
||||
ProposerAddress: block1.ProposerAddress,
|
||||
}
|
||||
|
||||
app.On("ProcessProposal", mock.Anything).Return(abci.ResponseProcessProposal{Status: abci.ResponseProcessProposal_ACCEPT})
|
||||
|
||||
@@ -272,7 +272,7 @@ type testApp struct {
|
||||
abci.BaseApplication
|
||||
|
||||
CommitVotes []abci.VoteInfo
|
||||
ByzantineValidators []abci.Evidence
|
||||
ByzantineValidators []abci.Misbehavior
|
||||
ValidatorUpdates []abci.ValidatorUpdate
|
||||
}
|
||||
|
||||
|
||||
@@ -292,7 +292,7 @@ func TestValidateBlockEvidence(t *testing.T) {
|
||||
evpool.On("CheckEvidence", ctx, mock.AnythingOfType("types.EvidenceList")).Return(nil)
|
||||
evpool.On("Update", ctx, mock.AnythingOfType("state.State"), mock.AnythingOfType("types.EvidenceList")).Return()
|
||||
evpool.On("ABCIEvidence", mock.AnythingOfType("int64"), mock.AnythingOfType("[]types.Evidence")).Return(
|
||||
[]abci.Evidence{})
|
||||
[]abci.Misbehavior{})
|
||||
|
||||
eventBus := eventbus.NewDefault(logger)
|
||||
require.NoError(t, eventBus.Start(ctx))
|
||||
|
||||
@@ -76,7 +76,7 @@ message RequestBeginBlock {
|
||||
bytes hash = 1;
|
||||
tendermint.types.Header header = 2 [(gogoproto.nullable) = false];
|
||||
CommitInfo last_commit_info = 3 [(gogoproto.nullable) = false];
|
||||
repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false];
|
||||
repeated Misbehavior byzantine_validators = 4 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
enum CheckTxType {
|
||||
@@ -123,23 +123,31 @@ message RequestApplySnapshotChunk {
|
||||
}
|
||||
|
||||
message RequestPrepareProposal {
|
||||
bytes hash = 1;
|
||||
tendermint.types.Header header = 2 [(gogoproto.nullable) = false];
|
||||
// the modified transactions cannot exceed this size.
|
||||
int64 max_tx_bytes = 1;
|
||||
// txs is an array of transactions that will be included in a block,
|
||||
// sent to the app for possible modifications.
|
||||
repeated bytes txs = 3;
|
||||
ExtendedCommitInfo local_last_commit = 4 [(gogoproto.nullable) = false];
|
||||
repeated Evidence byzantine_validators = 5 [(gogoproto.nullable) = false];
|
||||
// the modified transactions cannot exceed this size.
|
||||
int64 max_tx_bytes = 6;
|
||||
repeated bytes txs = 2;
|
||||
ExtendedCommitInfo local_last_commit = 3 [(gogoproto.nullable) = false];
|
||||
repeated Misbehavior byzantine_validators = 4 [(gogoproto.nullable) = false];
|
||||
int64 height = 5;
|
||||
google.protobuf.Timestamp time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
|
||||
bytes next_validators_hash = 7;
|
||||
// address of the public key of the validator proposing the block.
|
||||
bytes proposer_address = 8;
|
||||
}
|
||||
|
||||
message RequestProcessProposal {
|
||||
bytes hash = 1;
|
||||
tendermint.types.Header header = 2 [(gogoproto.nullable) = false];
|
||||
repeated bytes txs = 3;
|
||||
CommitInfo proposed_last_commit = 4 [(gogoproto.nullable) = false];
|
||||
repeated Evidence byzantine_validators = 5 [(gogoproto.nullable) = false];
|
||||
repeated bytes txs = 1;
|
||||
CommitInfo proposed_last_commit = 2 [(gogoproto.nullable) = false];
|
||||
repeated Misbehavior byzantine_validators = 3 [(gogoproto.nullable) = false];
|
||||
// hash is the merkle root hash of the fields of the proposed block.
|
||||
bytes hash = 4;
|
||||
int64 height = 5;
|
||||
google.protobuf.Timestamp time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
|
||||
bytes next_validators_hash = 7;
|
||||
// address of the public key of the original proposer of the block.
|
||||
bytes proposer_address = 8;
|
||||
}
|
||||
|
||||
// Extends a vote with application-side injection
|
||||
@@ -157,11 +165,16 @@ message RequestVerifyVoteExtension {
|
||||
}
|
||||
|
||||
message RequestFinalizeBlock {
|
||||
bytes hash = 1;
|
||||
tendermint.types.Header header = 2 [(gogoproto.nullable) = false];
|
||||
repeated bytes txs = 3;
|
||||
CommitInfo decided_last_commit = 4 [(gogoproto.nullable) = false];
|
||||
repeated Evidence byzantine_validators = 5 [(gogoproto.nullable) = false];
|
||||
repeated bytes txs = 1;
|
||||
CommitInfo decided_last_commit = 2 [(gogoproto.nullable) = false];
|
||||
repeated Misbehavior byzantine_validators = 3 [(gogoproto.nullable) = false];
|
||||
// hash is the merkle root hash of the fields of the proposed block.
|
||||
bytes hash = 4;
|
||||
int64 height = 5;
|
||||
google.protobuf.Timestamp time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
|
||||
bytes next_validators_hash = 7;
|
||||
// proposer_address is the address of the public key of the original proposer of the block.
|
||||
bytes proposer_address = 8;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
@@ -341,6 +354,7 @@ message ResponseExtendVote {
|
||||
bytes vote_extension = 1;
|
||||
}
|
||||
|
||||
|
||||
message ResponseVerifyVoteExtension {
|
||||
VerifyStatus status = 1;
|
||||
|
||||
@@ -462,14 +476,15 @@ message ExtendedVoteInfo {
|
||||
bytes vote_extension = 3;
|
||||
}
|
||||
|
||||
enum EvidenceType {
|
||||
|
||||
enum MisbehaviorType {
|
||||
UNKNOWN = 0;
|
||||
DUPLICATE_VOTE = 1;
|
||||
LIGHT_CLIENT_ATTACK = 2;
|
||||
}
|
||||
|
||||
message Evidence {
|
||||
EvidenceType type = 1;
|
||||
message Misbehavior {
|
||||
MisbehaviorType type = 1;
|
||||
// The offending validator
|
||||
Validator validator = 2 [(gogoproto.nullable) = false];
|
||||
// The height when the offense occurred
|
||||
|
||||
@@ -77,7 +77,7 @@ message RequestBeginBlock {
|
||||
bytes hash = 1;
|
||||
tendermint.types.Header header = 2 [(gogoproto.nullable) = false];
|
||||
CommitInfo last_commit_info = 3 [(gogoproto.nullable) = false];
|
||||
repeated Evidence byzantine_validators = 4 [(gogoproto.nullable) = false];
|
||||
repeated Misbehavior byzantine_validators = 4 [(gogoproto.nullable) = false];
|
||||
}
|
||||
|
||||
enum CheckTxType {
|
||||
@@ -124,23 +124,31 @@ message RequestApplySnapshotChunk {
|
||||
}
|
||||
|
||||
message RequestPrepareProposal {
|
||||
bytes hash = 1;
|
||||
tendermint.types.Header header = 2 [(gogoproto.nullable) = false];
|
||||
// the modified transactions cannot exceed this size.
|
||||
int64 max_tx_bytes = 1;
|
||||
// txs is an array of transactions that will be included in a block,
|
||||
// sent to the app for possible modifications.
|
||||
repeated bytes txs = 3;
|
||||
ExtendedCommitInfo local_last_commit = 4 [(gogoproto.nullable) = false];
|
||||
repeated Evidence byzantine_validators = 5 [(gogoproto.nullable) = false];
|
||||
// the modified transactions cannot exceed this size.
|
||||
int64 max_tx_bytes = 6;
|
||||
repeated bytes txs = 2;
|
||||
ExtendedCommitInfo local_last_commit = 3 [(gogoproto.nullable) = false];
|
||||
repeated Misbehavior byzantine_validators = 4 [(gogoproto.nullable) = false];
|
||||
int64 height = 5;
|
||||
google.protobuf.Timestamp time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
|
||||
bytes next_validators_hash = 7;
|
||||
// address of the public key of the validator proposing the block.
|
||||
bytes proposer_address = 8;
|
||||
}
|
||||
|
||||
message RequestProcessProposal {
|
||||
bytes hash = 1;
|
||||
tendermint.types.Header header = 2 [(gogoproto.nullable) = false];
|
||||
repeated bytes txs = 3;
|
||||
CommitInfo proposed_last_commit = 4 [(gogoproto.nullable) = false];
|
||||
repeated Evidence byzantine_validators = 5 [(gogoproto.nullable) = false];
|
||||
repeated bytes txs = 1;
|
||||
CommitInfo proposed_last_commit = 2 [(gogoproto.nullable) = false];
|
||||
repeated Misbehavior byzantine_validators = 3 [(gogoproto.nullable) = false];
|
||||
// hash is the merkle root hash of the fields of the proposed block.
|
||||
bytes hash = 4;
|
||||
int64 height = 5;
|
||||
google.protobuf.Timestamp time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
|
||||
bytes next_validators_hash = 7;
|
||||
// address of the public key of the original proposer of the block.
|
||||
bytes proposer_address = 8;
|
||||
}
|
||||
|
||||
// Extends a vote with application-side injection
|
||||
@@ -158,11 +166,16 @@ message RequestVerifyVoteExtension {
|
||||
}
|
||||
|
||||
message RequestFinalizeBlock {
|
||||
bytes hash = 1;
|
||||
tendermint.types.Header header = 2 [(gogoproto.nullable) = false];
|
||||
repeated bytes txs = 3;
|
||||
CommitInfo decided_last_commit = 4 [(gogoproto.nullable) = false];
|
||||
repeated Evidence byzantine_validators = 5 [(gogoproto.nullable) = false];
|
||||
repeated bytes txs = 1;
|
||||
CommitInfo decided_last_commit = 2 [(gogoproto.nullable) = false];
|
||||
repeated Misbehavior byzantine_validators = 3 [(gogoproto.nullable) = false];
|
||||
// hash is the merkle root hash of the fields of the proposed block.
|
||||
bytes hash = 4;
|
||||
int64 height = 5;
|
||||
google.protobuf.Timestamp time = 6 [(gogoproto.nullable) = false, (gogoproto.stdtime) = true];
|
||||
bytes next_validators_hash = 7;
|
||||
// proposer_address is the address of the public key of the original proposer of the block.
|
||||
bytes proposer_address = 8;
|
||||
}
|
||||
|
||||
//----------------------------------------
|
||||
@@ -468,14 +481,14 @@ message ExtendedVoteInfo {
|
||||
bytes vote_extension = 3;
|
||||
}
|
||||
|
||||
enum EvidenceType {
|
||||
enum MisbehaviorType {
|
||||
UNKNOWN = 0;
|
||||
DUPLICATE_VOTE = 1;
|
||||
LIGHT_CLIENT_ATTACK = 2;
|
||||
}
|
||||
|
||||
message Evidence {
|
||||
EvidenceType type = 1;
|
||||
message Misbehavior {
|
||||
MisbehaviorType type = 1;
|
||||
// The offending validator
|
||||
Validator validator = 2 [(gogoproto.nullable) = false];
|
||||
// The height when the offense occurred
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
syntax = "proto3";
|
||||
package tendermint.privval;
|
||||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/privval";
|
||||
option go_package = "github.com/tendermint/tendermint/proto/tendermint/privval";
|
||||
|
||||
import "tendermint/privval/types.proto";
|
||||
|
||||
|
||||
152
scripts/confix/condiff/condiff.go
Normal file
152
scripts/confix/condiff/condiff.go
Normal file
@@ -0,0 +1,152 @@
|
||||
// Program condiff performs a keyspace diff on two TOML documents.
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"flag"
|
||||
"fmt"
|
||||
"io"
|
||||
"log"
|
||||
"os"
|
||||
"path/filepath"
|
||||
"sort"
|
||||
"strings"
|
||||
|
||||
"github.com/creachadair/tomledit"
|
||||
"github.com/creachadair/tomledit/parser"
|
||||
"github.com/creachadair/tomledit/transform"
|
||||
)
|
||||
|
||||
var (
|
||||
doDesnake = flag.Bool("desnake", false, "Convert snake_case to kebab-case before comparing")
|
||||
)
|
||||
|
||||
func init() {
|
||||
flag.Usage = func() {
|
||||
fmt.Fprintf(os.Stderr, `Usage: %[1]s [options] f1 f2
|
||||
|
||||
Diff the keyspaces of the TOML documents in files f1 and f2.
|
||||
The output prints one line per key that differs:
|
||||
|
||||
-S name -- section exists in f1 but not f2
|
||||
+S name -- section exists in f2 but not f1
|
||||
-M name -- mapping exists in f1 but not f2
|
||||
+M name -- mapping exists in f2 but not f1
|
||||
|
||||
Comments, order, and values are ignored for comparison purposes.
|
||||
|
||||
Options:
|
||||
`, filepath.Base(os.Args[0]))
|
||||
flag.PrintDefaults()
|
||||
}
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.Parse()
|
||||
|
||||
if flag.NArg() != 2 {
|
||||
log.Fatalf("Usage: %[1]s <lhs> <rhs>", filepath.Base(os.Args[0]))
|
||||
}
|
||||
lhs := mustParse(flag.Arg(0))
|
||||
rhs := mustParse(flag.Arg(1))
|
||||
if *doDesnake {
|
||||
log.Printf("Converting all names from snake_case to kebab-case")
|
||||
fix := transform.SnakeToKebab()
|
||||
_ = fix(context.Background(), lhs)
|
||||
_ = fix(context.Background(), rhs)
|
||||
}
|
||||
diffDocs(os.Stdout, lhs, rhs)
|
||||
}
|
||||
|
||||
func mustParse(path string) *tomledit.Document {
|
||||
f, err := os.Open(path)
|
||||
if err != nil {
|
||||
log.Fatalf("Opening TOML input: %v", err)
|
||||
}
|
||||
defer f.Close()
|
||||
doc, err := tomledit.Parse(f)
|
||||
if err != nil {
|
||||
log.Fatalf("Parsing %q: %v", path, err)
|
||||
}
|
||||
return doc
|
||||
}
|
||||
|
||||
func allKeys(s *tomledit.Section) []string {
|
||||
var keys []string
|
||||
s.Scan(func(key parser.Key, _ *tomledit.Entry) bool {
|
||||
keys = append(keys, key.String())
|
||||
return true
|
||||
})
|
||||
return keys
|
||||
}
|
||||
|
||||
const (
|
||||
delSection = "-S"
|
||||
delMapping = "-M"
|
||||
addSection = "+S"
|
||||
addMapping = "+M"
|
||||
|
||||
delMapSep = "\n" + delMapping + " "
|
||||
addMapSep = "\n" + addMapping + " "
|
||||
)
|
||||
|
||||
func diffDocs(w io.Writer, lhs, rhs *tomledit.Document) {
|
||||
diffSections(w, lhs.Global, rhs.Global)
|
||||
lsec, rsec := lhs.Sections, rhs.Sections
|
||||
transform.SortSectionsByName(lsec)
|
||||
transform.SortSectionsByName(rsec)
|
||||
|
||||
i, j := 0, 0
|
||||
for i < len(lsec) && j < len(rsec) {
|
||||
if lsec[i].Name.Before(rsec[j].Name) {
|
||||
fmt.Fprintln(w, delSection, lsec[i].Name)
|
||||
fmt.Fprintln(w, delMapping, strings.Join(allKeys(lsec[i]), delMapSep))
|
||||
i++
|
||||
} else if rsec[j].Name.Before(lsec[i].Name) {
|
||||
fmt.Fprintln(w, addSection, rsec[j].Name)
|
||||
fmt.Fprintln(w, addMapping, strings.Join(allKeys(rsec[j]), addMapSep))
|
||||
j++
|
||||
} else {
|
||||
diffSections(w, lsec[i], rsec[j])
|
||||
i++
|
||||
j++
|
||||
}
|
||||
}
|
||||
for ; i < len(lsec); i++ {
|
||||
fmt.Fprintln(w, delSection, lsec[i].Name)
|
||||
fmt.Fprintln(w, delMapping, strings.Join(allKeys(lsec[i]), delMapSep))
|
||||
}
|
||||
for ; j < len(rsec); j++ {
|
||||
fmt.Fprintln(w, addSection, rsec[j].Name)
|
||||
fmt.Fprintln(w, addMapping, strings.Join(allKeys(rsec[j]), addMapSep))
|
||||
}
|
||||
}
|
||||
|
||||
func diffSections(w io.Writer, lhs, rhs *tomledit.Section) {
|
||||
diffKeys(w, allKeys(lhs), allKeys(rhs))
|
||||
}
|
||||
|
||||
func diffKeys(w io.Writer, lhs, rhs []string) {
|
||||
sort.Strings(lhs)
|
||||
sort.Strings(rhs)
|
||||
|
||||
i, j := 0, 0
|
||||
for i < len(lhs) && j < len(rhs) {
|
||||
if lhs[i] < rhs[j] {
|
||||
fmt.Fprintln(w, delMapping, lhs[i])
|
||||
i++
|
||||
} else if lhs[i] > rhs[j] {
|
||||
fmt.Fprintln(w, addMapping, rhs[j])
|
||||
j++
|
||||
} else {
|
||||
i++
|
||||
j++
|
||||
}
|
||||
}
|
||||
for ; i < len(lhs); i++ {
|
||||
fmt.Fprintln(w, delMapping, lhs[i])
|
||||
}
|
||||
for ; j < len(rhs); j++ {
|
||||
fmt.Fprintln(w, addMapping, rhs[j])
|
||||
}
|
||||
}
|
||||
@@ -85,21 +85,138 @@ var plan = transform.Plan{
|
||||
T: transform.SnakeToKebab(),
|
||||
},
|
||||
{
|
||||
// Since https://github.com/tendermint/tendermint/pull/6896.
|
||||
Desc: "Rename [fastsync] to [blocksync]",
|
||||
T: transform.Rename(parser.Key{"fastsync"}, parser.Key{"blocksync"}),
|
||||
// [fastsync] renamed in https://github.com/tendermint/tendermint/pull/6896.
|
||||
// [blocksync] removed in https://github.com/tendermint/tendermint/pull/7159.
|
||||
Desc: "Remove [fastsync] and [blocksync] sections",
|
||||
T: transform.Func(func(_ context.Context, doc *tomledit.Document) error {
|
||||
doc.First("fast-sync").Remove()
|
||||
transform.FindTable(doc, "fastsync").Remove()
|
||||
transform.FindTable(doc, "blocksync").Remove()
|
||||
return nil
|
||||
}),
|
||||
ErrorOK: true,
|
||||
},
|
||||
{
|
||||
// Since https://github.com/tendermint/tendermint/pull/7159.
|
||||
Desc: "Move top-level fast_sync key to blocksync.enable",
|
||||
T: transform.MoveKey(
|
||||
parser.Key{"fast-sync"},
|
||||
parser.Key{"blocksync"},
|
||||
parser.Key{"enable"},
|
||||
// Since https://github.com/tendermint/tendermint/pull/6241.
|
||||
//
|
||||
// TODO(creachadair): backport into v0.35.x.
|
||||
Desc: `Add top-level mode setting (default "full")`,
|
||||
T: transform.EnsureKey(nil, &parser.KeyValue{
|
||||
Block: parser.Comments{"Mode of Node: full | validator | seed"},
|
||||
Name: parser.Key{"mode"},
|
||||
Value: parser.MustValue(`"full"`),
|
||||
}),
|
||||
ErrorOK: true,
|
||||
},
|
||||
{
|
||||
// Since https://github.com/tendermint/tendermint/pull/7121.
|
||||
Desc: "Remove gRPC settings from the [rpc] section",
|
||||
T: transform.Func(func(_ context.Context, doc *tomledit.Document) error {
|
||||
doc.First("rpc", "grpc-laddr").Remove()
|
||||
doc.First("rpc", "grpc-max-open-connections").Remove()
|
||||
return nil
|
||||
}),
|
||||
},
|
||||
{
|
||||
// Since https://github.com/tendermint/tendermint/pull/8217.
|
||||
Desc: "Remove per-node consensus timeouts (converted to consensus parameters)",
|
||||
T: transform.Remove(
|
||||
parser.Key{"consensus", "skip-timeout-commit"},
|
||||
parser.Key{"consensus", "timeout-commit"},
|
||||
parser.Key{"consensus", "timeout-precommit"},
|
||||
parser.Key{"consensus", "timeout-precommit-delta"},
|
||||
parser.Key{"consensus", "timeout-prevote"},
|
||||
parser.Key{"consensus", "timeout-prevote-delta"},
|
||||
parser.Key{"consensus", "timeout-propose"},
|
||||
parser.Key{"consensus", "timeout-propose-delta"},
|
||||
),
|
||||
ErrorOK: true,
|
||||
},
|
||||
{
|
||||
// Since https://github.com/tendermint/tendermint/pull/6396.
|
||||
//
|
||||
// TODO(creachadair): backport into v0.35.x.
|
||||
Desc: "Remove vestigial mempool.wal-dir setting",
|
||||
T: transform.Remove(parser.Key{"mempool", "wal-dir"}),
|
||||
ErrorOK: true,
|
||||
},
|
||||
{
|
||||
// Since https://github.com/tendermint/tendermint/pull/6323.
|
||||
//
|
||||
// TODO(creachadair): backport into v0.35.x.
|
||||
Desc: "Add new [p2p] queue-type setting",
|
||||
T: transform.EnsureKey(parser.Key{"p2p"}, &parser.KeyValue{
|
||||
Block: parser.Comments{"Select the p2p internal queue"},
|
||||
Name: parser.Key{"queue-type"},
|
||||
Value: parser.MustValue(`"priority"`),
|
||||
}),
|
||||
ErrorOK: true,
|
||||
},
|
||||
{
|
||||
// Since https://github.com/tendermint/tendermint/pull/6353.
|
||||
//
|
||||
// TODO(creachadair): backport into v0.35.x.
|
||||
Desc: "Add [p2p] connection count and rate limit settings",
|
||||
T: transform.Func(func(_ context.Context, doc *tomledit.Document) error {
|
||||
tab := transform.FindTable(doc, "p2p")
|
||||
if tab == nil {
|
||||
return errors.New("p2p table not found")
|
||||
}
|
||||
transform.InsertMapping(tab.Section, &parser.KeyValue{
|
||||
Block: parser.Comments{"Maximum number of connections (inbound and outbound)."},
|
||||
Name: parser.Key{"max-connections"},
|
||||
Value: parser.MustValue("64"),
|
||||
}, false)
|
||||
transform.InsertMapping(tab.Section, &parser.KeyValue{
|
||||
Block: parser.Comments{
|
||||
"Rate limits the number of incoming connection attempts per IP address.",
|
||||
},
|
||||
Name: parser.Key{"max-incoming-connection-attempts"},
|
||||
Value: parser.MustValue("100"),
|
||||
}, false)
|
||||
return nil
|
||||
}),
|
||||
},
|
||||
{
|
||||
// Added "chunk-fetchers" https://github.com/tendermint/tendermint/pull/6566.
|
||||
// This value was backported into v0.34.11 (modulo casing).
|
||||
// Renamed to "fetchers" https://github.com/tendermint/tendermint/pull/6587.
|
||||
//
|
||||
// TODO(creachadair): backport into v0.35.x.
|
||||
Desc: "Rename statesync.chunk-fetchers to statesync.fetchers",
|
||||
T: transform.Func(func(ctx context.Context, doc *tomledit.Document) error {
|
||||
// If the key already exists, rename it preserving its value.
|
||||
if found := doc.First("statesync", "chunk-fetchers"); found != nil {
|
||||
found.KeyValue.Name = parser.Key{"fetchers"}
|
||||
return nil
|
||||
}
|
||||
|
||||
// Otherwise, add it.
|
||||
return transform.EnsureKey(parser.Key{"statesync"}, &parser.KeyValue{
|
||||
Block: parser.Comments{
|
||||
"The number of concurrent chunk and block fetchers to run (default: 4).",
|
||||
},
|
||||
Name: parser.Key{"fetchers"},
|
||||
Value: parser.MustValue("4"),
|
||||
})(ctx, doc)
|
||||
}),
|
||||
},
|
||||
{
|
||||
// Since https://github.com/tendermint/tendermint/pull/6807.
|
||||
// Backported into v0.34.13 (modulo casing).
|
||||
//
|
||||
// TODO(creachadair): backport into v0.35.x.
|
||||
Desc: "Add statesync.use-p2p setting",
|
||||
T: transform.EnsureKey(parser.Key{"statesync"}, &parser.KeyValue{
|
||||
Block: parser.Comments{
|
||||
"# State sync uses light client verification to verify state. This can be done either through the",
|
||||
"# P2P layer or RPC layer. Set this to true to use the P2P layer. If false (default), RPC layer",
|
||||
"# will be used.",
|
||||
},
|
||||
Name: parser.Key{"use-p2p"},
|
||||
Value: parser.MustValue("false"),
|
||||
}),
|
||||
},
|
||||
{
|
||||
// Since https://github.com/tendermint/tendermint/pull/6462.
|
||||
Desc: "Move priv-validator settings under [priv-validator]",
|
||||
@@ -147,22 +264,6 @@ var plan = transform.Plan{
|
||||
return nil
|
||||
}),
|
||||
},
|
||||
{
|
||||
// v1 removed: https://github.com/tendermint/tendermint/pull/5728
|
||||
// v2 deprecated: https://github.com/tendermint/tendermint/pull/6730
|
||||
Desc: `Set blocksync.version to "v0"`,
|
||||
T: transform.Func(func(_ context.Context, doc *tomledit.Document) error {
|
||||
v := doc.First("blocksync", "version")
|
||||
if v == nil {
|
||||
return nil // nothing to do
|
||||
} else if !v.IsMapping() {
|
||||
// This shouldn't happen, but is easier to debug than a panic.
|
||||
return fmt.Errorf("blocksync.version is weird: %v", v)
|
||||
}
|
||||
v.Value.X = parser.MustValue(`"v0"`).X
|
||||
return nil
|
||||
}),
|
||||
},
|
||||
}
|
||||
|
||||
// ApplyFixes transforms doc and reports whether it succeeded.
|
||||
@@ -248,8 +349,5 @@ func CheckValid(data []byte) error {
|
||||
return fmt.Errorf("decoding config: %w", err)
|
||||
}
|
||||
|
||||
// Stub in required value not stored in the config file, so that validation
|
||||
// will not fail spuriously.
|
||||
cfg.Mode = config.ModeValidator
|
||||
return cfg.ValidateBasic()
|
||||
}
|
||||
|
||||
5
scripts/confix/testdata/diff-31-32.txt
vendored
Normal file
5
scripts/confix/testdata/diff-31-32.txt
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
+S fastsync
|
||||
+M fastsync.version
|
||||
+M mempool.max-tx-bytes
|
||||
+M rpc.max-body-bytes
|
||||
+M rpc.max-header-bytes
|
||||
6
scripts/confix/testdata/diff-32-33.txt
vendored
Normal file
6
scripts/confix/testdata/diff-32-33.txt
vendored
Normal file
@@ -0,0 +1,6 @@
|
||||
+M p2p.persistent-peers-max-dial-period
|
||||
+M p2p.unconditional-peer-ids
|
||||
+M tx-index.index-all-keys
|
||||
-M tx-index.index-all-tags
|
||||
+M tx-index.index-keys
|
||||
-M tx-index.index-tags
|
||||
20
scripts/confix/testdata/diff-33-34.txt
vendored
Normal file
20
scripts/confix/testdata/diff-33-34.txt
vendored
Normal file
@@ -0,0 +1,20 @@
|
||||
-M prof-laddr
|
||||
+M consensus.double-sign-check-height
|
||||
+M mempool.keep-invalid-txs-in-cache
|
||||
+M mempool.max-batch-bytes
|
||||
+M rpc.experimental-close-on-slow-client
|
||||
+M rpc.experimental-subscription-buffer-size
|
||||
+M rpc.experimental-websocket-write-buffer-size
|
||||
+M rpc.pprof-laddr
|
||||
+S statesync
|
||||
+M statesync.enable
|
||||
+M statesync.rpc-servers
|
||||
+M statesync.trust-height
|
||||
+M statesync.trust-hash
|
||||
+M statesync.trust-period
|
||||
+M statesync.discovery-time
|
||||
+M statesync.temp-dir
|
||||
+M statesync.chunk-request-timeout
|
||||
+M statesync.chunk-fetchers
|
||||
-M tx-index.index-all-keys
|
||||
-M tx-index.index-keys
|
||||
31
scripts/confix/testdata/diff-34-35.txt
vendored
Normal file
31
scripts/confix/testdata/diff-34-35.txt
vendored
Normal file
@@ -0,0 +1,31 @@
|
||||
-M fast-sync
|
||||
+M mode
|
||||
-M priv-validator-key-file
|
||||
-M priv-validator-laddr
|
||||
-M priv-validator-state-file
|
||||
+S blocksync
|
||||
+M blocksync.enable
|
||||
+M blocksync.version
|
||||
-S fastsync
|
||||
-M fastsync.version
|
||||
+M mempool.ttl-duration
|
||||
+M mempool.ttl-num-blocks
|
||||
+M mempool.version
|
||||
-M mempool.wal-dir
|
||||
+M p2p.bootstrap-peers
|
||||
+M p2p.max-connections
|
||||
+M p2p.max-incoming-connection-attempts
|
||||
+M p2p.queue-type
|
||||
-M p2p.seed-mode
|
||||
+M p2p.use-legacy
|
||||
+S priv-validator
|
||||
+M priv-validator.key-file
|
||||
+M priv-validator.state-file
|
||||
+M priv-validator.laddr
|
||||
+M priv-validator.client-certificate-file
|
||||
+M priv-validator.client-key-file
|
||||
+M priv-validator.root-ca-file
|
||||
-M statesync.chunk-fetchers
|
||||
+M statesync.fetchers
|
||||
+M statesync.use-p2p
|
||||
+M tx-index.psql-conn
|
||||
27
scripts/confix/testdata/diff-35-36.txt
vendored
Normal file
27
scripts/confix/testdata/diff-35-36.txt
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
-S blocksync
|
||||
-M blocksync.enable
|
||||
-M blocksync.version
|
||||
-M consensus.skip-timeout-commit
|
||||
-M consensus.timeout-commit
|
||||
-M consensus.timeout-precommit
|
||||
-M consensus.timeout-precommit-delta
|
||||
-M consensus.timeout-prevote
|
||||
-M consensus.timeout-prevote-delta
|
||||
-M consensus.timeout-propose
|
||||
-M consensus.timeout-propose-delta
|
||||
-M mempool.version
|
||||
-M p2p.addr-book-file
|
||||
-M p2p.addr-book-strict
|
||||
-M p2p.max-num-inbound-peers
|
||||
-M p2p.max-num-outbound-peers
|
||||
-M p2p.persistent-peers-max-dial-period
|
||||
-M p2p.unconditional-peer-ids
|
||||
-M p2p.use-legacy
|
||||
+M rpc.event-log-max-items
|
||||
+M rpc.event-log-window-size
|
||||
-M rpc.experimental-close-on-slow-client
|
||||
+M rpc.experimental-disable-websocket
|
||||
-M rpc.experimental-subscription-buffer-size
|
||||
-M rpc.experimental-websocket-write-buffer-size
|
||||
-M rpc.grpc-laddr
|
||||
-M rpc.grpc-max-open-connections
|
||||
@@ -287,12 +287,14 @@ title: Methods
|
||||
|
||||
| Name | Type | Description | Field Number |
|
||||
|-------------------------|---------------------------------------------|------------------------------------------------------------------------------------------------------------------|--------------|
|
||||
| hash | bytes | The block header's hash of the block to propose. Present for convenience (can be derived from the block header). | 1 |
|
||||
| header | [Header](../core/data_structures.md#header) | The header of the block to propose. | 2 |
|
||||
| txs | repeated bytes | Preliminary list of transactions that have been picked as part of the block to propose. | 3 |
|
||||
| local_last_commit | [ExtendedCommitInfo](#extendedcommitinfo) | Info about the last commit, obtained locally from Tendermint's data structures. | 4 |
|
||||
| byzantine_validators | repeated [Evidence](#evidence) | List of evidence of validators that acted maliciously. | 5 |
|
||||
| max_tx_bytes | int64 | Currently configured maximum size in bytes taken by the modified transactions. | 6 |
|
||||
| max_tx_bytes | int64 | Currently configured maximum size in bytes taken by the modified transactions. | 1 |
|
||||
| txs | repeated bytes | Preliminary list of transactions that have been picked as part of the block to propose. | 2 |
|
||||
| local_last_commit | [ExtendedCommitInfo](#extendedcommitinfo) | Info about the last commit, obtained locally from Tendermint's data structures. | 3 |
|
||||
| byzantine_validators | repeated [Misbehavior](#misbehavior) | List of information about validators that acted incorrectly. | 4 |
|
||||
| height | int64 | The height of the block that will be proposed. | 5 |
|
||||
| time | [google.protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp) | Timestamp of the block that that will be proposed. | 6 |
|
||||
| next_validators_hash | bytes | Merkle root of the next validator set. | 7 |
|
||||
| proposer_address | bytes | [Address](../core/data_structures.md#address) of the validator that is creating the proposal. | 8 |
|
||||
|
||||
* **Response**:
|
||||
|
||||
@@ -305,10 +307,9 @@ title: Methods
|
||||
| consensus_param_updates | [ConsensusParams](#consensusparams) | Changes to consensus-critical gas, size, and other parameters. | 6 |
|
||||
|
||||
* **Usage**:
|
||||
* The first five parameters of `RequestPrepareProposal` are the same as `RequestProcessProposal`
|
||||
* The first six parameters of `RequestPrepareProposal` are the same as `RequestProcessProposal`
|
||||
and `RequestFinalizeBlock`.
|
||||
* The header contains the height, timestamp, and more - it exactly matches the
|
||||
Tendermint block header.
|
||||
* The height and time values match the values from the header of the proposed block.
|
||||
* `RequestPrepareProposal` contains a preliminary set of transactions `txs` that Tendermint considers to be a good block proposal, called _raw proposal_. The Application can modify this set via `ResponsePrepareProposal.tx_records` (see [TxRecord](#txrecord)).
|
||||
* The Application _can_ reorder, remove or add transactions to the raw proposal. Let `tx` be a transaction in `txs`:
|
||||
* If the Application considers that `tx` should not be proposed in this block, e.g., there are other transactions with higher priority, then it should not include it in `tx_records`. In this case, Tendermint won't remove `tx` from the mempool. The Application should be extra-careful, as abusing this feature may cause transactions to stay forever in the mempool.
|
||||
@@ -369,7 +370,7 @@ and _p_'s _validValue_ is `nil`:
|
||||
* _p_'s Tendermint creates a block header.
|
||||
2. _p_'s Tendermint calls `RequestPrepareProposal` with the newly generated block.
|
||||
The call is synchronous: Tendermint's execution will block until the Application returns from the call.
|
||||
3. The Application checks the block (header, transactions, commit info, evidences). Besides,
|
||||
3. The Application checks the block (hashes, transactions, commit info, misbehavior). Besides,
|
||||
* in same-block execution mode, the Application can (and should) provide `ResponsePrepareProposal.app_hash`,
|
||||
`ResponsePrepareProposal.validator_updates`, or
|
||||
`ResponsePrepareProposal.consensus_param_updates`.
|
||||
@@ -398,11 +399,14 @@ Note that, if _p_ has a non-`nil` _validValue_, Tendermint will use it as propos
|
||||
|
||||
| Name | Type | Description | Field Number |
|
||||
|----------------------|---------------------------------------------|----------------------------------------------------------------------------------------------------------------|--------------|
|
||||
| hash | bytes | The block header's hash of the proposed block. Present for convenience (can be derived from the block header). | 1 |
|
||||
| header | [Header](../core/data_structures.md#header) | The proposed block's header. | 2 |
|
||||
| txs | repeated bytes | List of transactions that have been picked as part of the proposed block. | 3 |
|
||||
| proposed_last_commit | [CommitInfo](#commitinfo) | Info about the last commit, obtained from the information in the proposed block. | 4 |
|
||||
| byzantine_validators | repeated [Evidence](#evidence) | List of evidence of validators that acted maliciously. | 5 |
|
||||
| txs | repeated bytes | List of transactions that have been picked as part of the proposed block. | 1 |
|
||||
| proposed_last_commit | [CommitInfo](#commitinfo) | Info about the last commit, obtained from the information in the proposed block. | 2 |
|
||||
| byzantine_validators | repeated [Misbehavior](#misbehavior) | List of information about validators that acted incorrectly. | 3 |
|
||||
| hash | bytes | The block header's hash of the proposed block. | 4 |
|
||||
| height | int64 | The height of the proposed block. | 5 |
|
||||
| time | [google.protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp) | Timestamp included in the proposed block. | 6 |
|
||||
| next_validators_hash | bytes | Merkle root of the next validator set. | 7 |
|
||||
| proposer_address | bytes | [Address](../core/data_structures.md#address) of the validator that created the proposal. | 8 |
|
||||
|
||||
* **Response**:
|
||||
|
||||
@@ -415,20 +419,11 @@ Note that, if _p_ has a non-`nil` _validValue_, Tendermint will use it as propos
|
||||
| consensus_param_updates | [ConsensusParams](#consensusparams) | Changes to consensus-critical gas, size, and other parameters. | 5 |
|
||||
|
||||
* **Usage**:
|
||||
* Contains a full proposed block.
|
||||
* The parameters and types of `RequestProcessProposal` are the same as `RequestPrepareProposal`
|
||||
and `RequestFinalizeBlock`.
|
||||
* Contains fields from the proposed block.
|
||||
* The Application may fully execute the block as though it was handling `RequestFinalizeBlock`.
|
||||
However, any resulting state changes must be kept as _candidate state_,
|
||||
and the Application should be ready to backtrack/discard it in case the decided block is different.
|
||||
* The header exactly matches the Tendermint header of the proposed block.
|
||||
* In next-block execution mode, the header hashes _AppHash_, _LastResultHash_, _ValidatorHash_,
|
||||
and _ConsensusHash_ refer to the **last committed block** (data was provided by the last call to
|
||||
`ResponseFinalizeBlock`).
|
||||
* In same-block execution mode, the header hashes _AppHash_, _LastResultHash_, _ValidatorHash_,
|
||||
and _ConsensusHash_ refer to the **same** block being passed in the `Request*` call to this
|
||||
method (data was provided by the call to `ResponsePrepareProposal` at the current height that
|
||||
resulted in the block being passed in the `Request*` call to this method)
|
||||
* The height and timestamp values match the values from the header of the proposed block.
|
||||
* If `ResponseProcessProposal.status` is `REJECT`, Tendermint assumes the proposal received
|
||||
is not valid.
|
||||
* In same-block execution mode, the Application is required to fully execute the block and provide values
|
||||
@@ -573,17 +568,20 @@ from this condition, but not sure), and _p_ receives a Precommit message for rou
|
||||
|
||||
| Name | Type | Description | Field Number |
|
||||
|----------------------|---------------------------------------------|------------------------------------------------------------------------------------------|--------------|
|
||||
| hash | bytes | The block header's hash. Present for convenience (can be derived from the block header). | 1 |
|
||||
| header | [Header](../core/data_structures.md#header) | The block header. | 2 |
|
||||
| txs | repeated bytes | List of transactions committed as part of the block. | 3 |
|
||||
| decided_last_commit | [CommitInfo](#commitinfo) | Info about the last commit, obtained from the block that was just decided. | 4 |
|
||||
| byzantine_validators | repeated [Evidence](#evidence) | List of evidence of validators that acted maliciously. | 5 |
|
||||
| txs | repeated bytes | List of transactions committed as part of the block. | 1 |
|
||||
| decided_last_commit | [CommitInfo](#commitinfo) | Info about the last commit, obtained from the block that was just decided. | 2 |
|
||||
| byzantine_validators | repeated [Misbehavior](#misbehavior) | List of information about validators that acted incorrectly. | 3 |
|
||||
| hash | bytes | The block header's hash. Present for convenience (can be derived from the block header). | 4 |
|
||||
| height | int64 | The height of the finalized block. | 5 |
|
||||
| time | [google.protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp) | Timestamp included in the finalized block. | 6 |
|
||||
| next_validators_hash | bytes | Merkle root of the next validator set. | 7 |
|
||||
| proposer_address | bytes | [Address](../core/data_structures.md#address) of the validator that created the proposal.| 8 |
|
||||
|
||||
* **Response**:
|
||||
|
||||
| Name | Type | Description | Field Number |
|
||||
|-------------------------|-------------------------------------------------------------|----------------------------------------------------------------------------------|--------------|
|
||||
| events | repeated [Event](abci++_basic_concepts_002_draft.md#events) | Type & Key-Value events for indexing | 1 |
|
||||
| events | repeated [Event](abci++_basic_concepts_002_draft.md#events) | Type & Key-Value events for indexing | 1 |
|
||||
| tx_results | repeated [ExecTxResult](#txresult) | List of structures containing the data resulting from executing the transactions | 2 |
|
||||
| validator_updates | repeated [ValidatorUpdate](#validatorupdate) | Changes to validator set (set voting power to 0 to remove). | 3 |
|
||||
| consensus_param_updates | [ConsensusParams](#consensusparams) | Changes to consensus-critical gas, size, and other parameters. | 4 |
|
||||
@@ -591,10 +589,10 @@ from this condition, but not sure), and _p_ receives a Precommit message for rou
|
||||
| retain_height | int64 | Blocks below this height may be removed. Defaults to `0` (retain all). | 6 |
|
||||
|
||||
* **Usage**:
|
||||
* Contains a newly decided block.
|
||||
* Contains the fields of the newly decided block.
|
||||
* This method is equivalent to the call sequence `BeginBlock`, [`DeliverTx`],
|
||||
`EndBlock`, `Commit` in the previous version of ABCI.
|
||||
* The header exactly matches the Tendermint header of the proposed block.
|
||||
* The height and timestamp values match the values from the header of the proposed block.
|
||||
* The Application can use `RequestFinalizeBlock.decided_last_commit` and `RequestFinalizeBlock.byzantine_validators`
|
||||
to determine rewards and punishments for the validators.
|
||||
* The application must execute the transactions in full, in the order they appear in `RequestFinalizeBlock.txs`,
|
||||
@@ -696,23 +694,23 @@ Most of the data structures used in ABCI are shared [common data structures](../
|
||||
* Validator identified by PubKey
|
||||
* Used to tell Tendermint to update the validator set
|
||||
|
||||
### Evidence
|
||||
### Misbehavior
|
||||
|
||||
* **Fields**:
|
||||
|
||||
| Name | Type | Description | Field Number |
|
||||
|--------------------|--------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------|--------------|
|
||||
| type | [EvidenceType](#evidencetype) | Type of the evidence. An enum of possible evidence's. | 1 |
|
||||
| type | [MisbehaviorType](#misbehaviortype) | Type of the misbehavior. An enum of possible misbehaviors. | 1 |
|
||||
| validator | [Validator](#validator) | The offending validator | 2 |
|
||||
| height | int64 | Height when the offense occurred | 3 |
|
||||
| time | [google.protobuf.Timestamp](https://developers.google.com/protocol-buffers/docs/reference/google.protobuf#google.protobuf.Timestamp) | Time of the block that was committed at the height that the offense occurred | 4 |
|
||||
| total_voting_power | int64 | Total voting power of the validator set at height `Height` | 5 |
|
||||
|
||||
#### EvidenceType
|
||||
#### MisbehaviorType
|
||||
|
||||
* **Fields**
|
||||
|
||||
EvidenceType is an enum with the listed fields:
|
||||
MisbehaviorType is an enum with the listed fields:
|
||||
|
||||
| Name | Field Number |
|
||||
|---------------------|--------------|
|
||||
|
||||
@@ -184,7 +184,7 @@ func (app *Application) FinalizeBlock(req abci.RequestFinalizeBlock) abci.Respon
|
||||
txs[i] = &abci.ExecTxResult{Code: code.CodeTypeOK}
|
||||
}
|
||||
|
||||
valUpdates, err := app.validatorUpdates(uint64(req.Header.Height))
|
||||
valUpdates, err := app.validatorUpdates(uint64(req.Height))
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@@ -202,7 +202,7 @@ func (app *Application) FinalizeBlock(req abci.RequestFinalizeBlock) abci.Respon
|
||||
},
|
||||
{
|
||||
Key: "height",
|
||||
Value: strconv.Itoa(int(req.Header.Height)),
|
||||
Value: strconv.Itoa(int(req.Height)),
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -23,13 +23,13 @@ import (
|
||||
// Evidence represents any provable malicious activity by a validator.
|
||||
// Verification logic for each evidence is part of the evidence module.
|
||||
type Evidence interface {
|
||||
ABCI() []abci.Evidence // forms individual evidence to be sent to the application
|
||||
Bytes() []byte // bytes which comprise the evidence
|
||||
Hash() []byte // hash of the evidence
|
||||
Height() int64 // height of the infraction
|
||||
String() string // string format of the evidence
|
||||
Time() time.Time // time of the infraction
|
||||
ValidateBasic() error // basic consistency check
|
||||
ABCI() []abci.Misbehavior // forms individual evidence to be sent to the application
|
||||
Bytes() []byte // bytes which comprise the evidence
|
||||
Hash() []byte // hash of the evidence
|
||||
Height() int64 // height of the infraction
|
||||
String() string // string format of the evidence
|
||||
Time() time.Time // time of the infraction
|
||||
ValidateBasic() error // basic consistency check
|
||||
|
||||
// Implementations must support tagged encoding in JSON.
|
||||
jsontypes.Tagged
|
||||
@@ -87,9 +87,9 @@ func NewDuplicateVoteEvidence(vote1, vote2 *Vote, blockTime time.Time, valSet *V
|
||||
}
|
||||
|
||||
// ABCI returns the application relevant representation of the evidence
|
||||
func (dve *DuplicateVoteEvidence) ABCI() []abci.Evidence {
|
||||
return []abci.Evidence{{
|
||||
Type: abci.EvidenceType_DUPLICATE_VOTE,
|
||||
func (dve *DuplicateVoteEvidence) ABCI() []abci.Misbehavior {
|
||||
return []abci.Misbehavior{{
|
||||
Type: abci.MisbehaviorType_DUPLICATE_VOTE,
|
||||
Validator: abci.Validator{
|
||||
Address: dve.VoteA.ValidatorAddress,
|
||||
Power: dve.ValidatorPower,
|
||||
@@ -257,12 +257,12 @@ func (*LightClientAttackEvidence) TypeTag() string { return "tendermint/LightCli
|
||||
|
||||
var _ Evidence = &LightClientAttackEvidence{}
|
||||
|
||||
// ABCI forms an array of abci evidence for each byzantine validator
|
||||
func (l *LightClientAttackEvidence) ABCI() []abci.Evidence {
|
||||
abciEv := make([]abci.Evidence, len(l.ByzantineValidators))
|
||||
// ABCI forms an array of abci.Misbehavior for each byzantine validator
|
||||
func (l *LightClientAttackEvidence) ABCI() []abci.Misbehavior {
|
||||
abciEv := make([]abci.Misbehavior, len(l.ByzantineValidators))
|
||||
for idx, val := range l.ByzantineValidators {
|
||||
abciEv[idx] = abci.Evidence{
|
||||
Type: abci.EvidenceType_LIGHT_CLIENT_ATTACK,
|
||||
abciEv[idx] = abci.Misbehavior{
|
||||
Type: abci.MisbehaviorType_LIGHT_CLIENT_ATTACK,
|
||||
Validator: TM2PB.Validator(val),
|
||||
Height: l.Height(),
|
||||
Time: l.Timestamp,
|
||||
@@ -683,8 +683,8 @@ func (evl EvidenceList) Has(evidence Evidence) bool {
|
||||
|
||||
// ToABCI converts the evidence list to a slice of the ABCI protobuf messages
|
||||
// for use when communicating the evidence to an application.
|
||||
func (evl EvidenceList) ToABCI() []abci.Evidence {
|
||||
var el []abci.Evidence
|
||||
func (evl EvidenceList) ToABCI() []abci.Misbehavior {
|
||||
var el []abci.Misbehavior
|
||||
for _, e := range evl {
|
||||
el = append(el, e.ABCI()...)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user