Merge branch 'master' into abci++

This commit is contained in:
marbar3778
2021-08-12 16:21:36 +02:00
173 changed files with 3461 additions and 1356 deletions

View File

@@ -153,8 +153,8 @@ func (b *EventBus) PublishEventValidBlock(data EventDataRoundState) error {
return b.Publish(EventValidBlockValue, data)
}
func (b *EventBus) PublishEventFastSyncStatus(data EventDataFastSyncStatus) error {
return b.Publish(EventFastSyncStatusValue, data)
func (b *EventBus) PublishEventBlockSyncStatus(data EventDataBlockSyncStatus) error {
return b.Publish(EventBlockSyncStatusValue, data)
}
func (b *EventBus) PublishEventStateSyncStatus(data EventDataStateSyncStatus) error {
@@ -317,7 +317,7 @@ func (NopEventBus) PublishEventValidatorSetUpdates(data EventDataValidatorSetUpd
return nil
}
func (NopEventBus) PublishEventFastSyncStatus(data EventDataFastSyncStatus) error {
func (NopEventBus) PublishEventBlockSyncStatus(data EventDataBlockSyncStatus) error {
return nil
}

View File

@@ -370,7 +370,7 @@ func TestEventBusPublish(t *testing.T) {
require.NoError(t, err)
err = eventBus.PublishEventValidatorSetUpdates(EventDataValidatorSetUpdates{})
require.NoError(t, err)
err = eventBus.PublishEventFastSyncStatus(EventDataFastSyncStatus{})
err = eventBus.PublishEventBlockSyncStatus(EventDataBlockSyncStatus{})
require.NoError(t, err)
err = eventBus.PublishEventStateSyncStatus(EventDataStateSyncStatus{})
require.NoError(t, err)
@@ -480,7 +480,7 @@ var events = []string{
EventRelockValue,
EventTimeoutWaitValue,
EventVoteValue,
EventFastSyncStatusValue,
EventBlockSyncStatusValue,
EventStateSyncStatusValue,
}
@@ -502,7 +502,9 @@ var queries = []tmpubsub.Query{
EventQueryRelock,
EventQueryTimeoutWait,
EventQueryVote,
EventQueryFastSyncStatus}
EventQueryBlockSyncStatus,
EventQueryStateSyncStatus,
}
func randQuery() tmpubsub.Query {
return queries[mrand.Intn(len(queries))]

View File

@@ -27,9 +27,9 @@ const (
// These are used for testing the consensus state machine.
// They can also be used to build real-time consensus visualizers.
EventCompleteProposalValue = "CompleteProposal"
// The FastSyncStatus event will be emitted when the node switching
// state sync mechanism between the consensus reactor and the fastsync reactor.
EventFastSyncStatusValue = "FastSyncStatus"
// The BlockSyncStatus event will be emitted when the node switching
// state sync mechanism between the consensus reactor and the blocksync reactor.
EventBlockSyncStatusValue = "BlockSyncStatus"
EventLockValue = "Lock"
EventNewRoundValue = "NewRound"
EventNewRoundStepValue = "NewRoundStep"
@@ -104,7 +104,7 @@ func init() {
tmjson.RegisterType(EventDataVote{}, "tendermint/event/Vote")
tmjson.RegisterType(EventDataValidatorSetUpdates{}, "tendermint/event/ValidatorSetUpdates")
tmjson.RegisterType(EventDataString(""), "tendermint/event/ProposalString")
tmjson.RegisterType(EventDataFastSyncStatus{}, "tendermint/event/FastSyncStatus")
tmjson.RegisterType(EventDataBlockSyncStatus{}, "tendermint/event/FastSyncStatus")
tmjson.RegisterType(EventDataStateSyncStatus{}, "tendermint/event/StateSyncStatus")
}
@@ -176,9 +176,9 @@ type EventDataValidatorSetUpdates struct {
ValidatorUpdates []*Validator `json:"validator_updates"`
}
// EventDataFastSyncStatus shows the fastsync status and the
// EventDataBlockSyncStatus shows the fastsync status and the
// height when the node state sync mechanism changes.
type EventDataFastSyncStatus struct {
type EventDataBlockSyncStatus struct {
Complete bool `json:"complete"`
Height int64 `json:"height"`
}
@@ -227,7 +227,7 @@ var (
EventQueryValidatorSetUpdates = QueryForEvent(EventValidatorSetUpdatesValue)
EventQueryValidBlock = QueryForEvent(EventValidBlockValue)
EventQueryVote = QueryForEvent(EventVoteValue)
EventQueryFastSyncStatus = QueryForEvent(EventFastSyncStatusValue)
EventQueryBlockSyncStatus = QueryForEvent(EventBlockSyncStatusValue)
EventQueryStateSyncStatus = QueryForEvent(EventStateSyncStatusValue)
)

View File

@@ -33,11 +33,7 @@ func (nodeKey NodeKey) SaveAs(filePath string) error {
if err != nil {
return err
}
err = ioutil.WriteFile(filePath, jsonBytes, 0600)
if err != nil {
return err
}
return nil
return ioutil.WriteFile(filePath, jsonBytes, 0600)
}
// LoadOrGenNodeKey attempts to load the NodeKey from the given filePath. If