mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 06:31:57 +00:00
use legacy events field names
This commit is contained in:
@@ -312,7 +312,7 @@ func (app *testApp) FinalizeBlock(req abci.RequestFinalizeBlock) abci.ResponseFi
|
||||
AppVersion: 1,
|
||||
},
|
||||
},
|
||||
BlockEvents: []abci.Event{},
|
||||
Events: []abci.Event{},
|
||||
TxResults: resTxs,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ func (idx *BlockerIndexer) Index(bh types.EventDataNewBlockHeader) error {
|
||||
}
|
||||
|
||||
// 2. index FinalizeBlock events
|
||||
if err := idx.indexEvents(batch, bh.ResultFinalizeBlock.BlockEvents, types.EventTypeFinalizeBlock, height); err != nil {
|
||||
if err := idx.indexEvents(batch, bh.ResultFinalizeBlock.Events, types.EventTypeFinalizeBlock, height); err != nil {
|
||||
return fmt.Errorf("failed to index FinalizeBlock events: %w", err)
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ func TestBlockIndexer(t *testing.T) {
|
||||
require.NoError(t, indexer.Index(types.EventDataNewBlockHeader{
|
||||
Header: types.Header{Height: 1},
|
||||
ResultFinalizeBlock: abci.ResponseFinalizeBlock{
|
||||
BlockEvents: []abci.Event{
|
||||
Events: []abci.Event{
|
||||
{
|
||||
Type: "finalize_event1",
|
||||
Attributes: []abci.EventAttribute{
|
||||
@@ -54,7 +54,7 @@ func TestBlockIndexer(t *testing.T) {
|
||||
require.NoError(t, indexer.Index(types.EventDataNewBlockHeader{
|
||||
Header: types.Header{Height: int64(i)},
|
||||
ResultFinalizeBlock: abci.ResponseFinalizeBlock{
|
||||
BlockEvents: []abci.Event{
|
||||
Events: []abci.Event{
|
||||
{
|
||||
Type: "finalize_event1",
|
||||
Attributes: []abci.EventAttribute{
|
||||
|
||||
@@ -35,7 +35,7 @@ func TestBlockFuncs(t *testing.T) {
|
||||
require.NoError(t, indexer.IndexBlockEvents(types.EventDataNewBlockHeader{
|
||||
Header: types.Header{Height: 1},
|
||||
ResultFinalizeBlock: abci.ResponseFinalizeBlock{
|
||||
BlockEvents: []abci.Event{
|
||||
Events: []abci.Event{
|
||||
{
|
||||
Type: "finalize_eventA",
|
||||
Attributes: []abci.EventAttribute{
|
||||
@@ -73,7 +73,7 @@ func TestBlockFuncs(t *testing.T) {
|
||||
require.NoError(t, indexer.IndexBlockEvents(types.EventDataNewBlockHeader{
|
||||
Header: types.Header{Height: int64(i)},
|
||||
ResultFinalizeBlock: abci.ResponseFinalizeBlock{
|
||||
BlockEvents: []abci.Event{
|
||||
Events: []abci.Event{
|
||||
{
|
||||
Type: "finalize_eventA",
|
||||
Attributes: []abci.EventAttribute{
|
||||
@@ -342,7 +342,7 @@ func txResultWithEvents(events []abci.Event) *abci.TxResult {
|
||||
Data: []byte{0},
|
||||
Code: abci.CodeTypeOK,
|
||||
Log: "",
|
||||
TxEvents: events,
|
||||
Events: events,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -170,7 +170,7 @@ INSERT INTO `+tableBlocks+` (height, chain_id, created_at)
|
||||
return fmt.Errorf("block meta-events: %w", err)
|
||||
}
|
||||
// Insert all the block events. Order is important here,
|
||||
if err := insertEvents(dbtx, blockID, 0, h.ResultFinalizeBlock.BlockEvents); err != nil {
|
||||
if err := insertEvents(dbtx, blockID, 0, h.ResultFinalizeBlock.Events); err != nil {
|
||||
return fmt.Errorf("finalize-block events: %w", err)
|
||||
}
|
||||
return nil
|
||||
@@ -221,7 +221,7 @@ INSERT INTO `+tableTxResults+` (block_id, index, created_at, tx_hash, tx_result)
|
||||
return fmt.Errorf("indexing transaction meta-events: %w", err)
|
||||
}
|
||||
// Index any events packaged with the transaction.
|
||||
if err := insertEvents(dbtx, blockID, txID, txr.Result.TxEvents); err != nil {
|
||||
if err := insertEvents(dbtx, blockID, txID, txr.Result.Events); err != nil {
|
||||
return fmt.Errorf("indexing transaction events: %w", err)
|
||||
}
|
||||
return nil
|
||||
|
||||
@@ -221,7 +221,7 @@ func newTestBlockHeader() types.EventDataNewBlockHeader {
|
||||
return types.EventDataNewBlockHeader{
|
||||
Header: types.Header{Height: 1},
|
||||
ResultFinalizeBlock: abci.ResponseFinalizeBlock{
|
||||
BlockEvents: []abci.Event{
|
||||
Events: []abci.Event{
|
||||
makeIndexedEvent("finalize_event.proposer", "FCAA001"),
|
||||
makeIndexedEvent("thingy.whatzit", "O.O"),
|
||||
makeIndexedEvent("my_event.foo", "100"),
|
||||
@@ -269,7 +269,7 @@ func txResultWithEvents(events []abci.Event) *abci.TxResult {
|
||||
Data: []byte{0},
|
||||
Code: abci.CodeTypeOK,
|
||||
Log: "",
|
||||
TxEvents: events,
|
||||
Events: events,
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
@@ -97,7 +97,7 @@ func (txi *TxIndex) Index(results []*abci.TxResult) error {
|
||||
}
|
||||
|
||||
func (txi *TxIndex) indexEvents(result *abci.TxResult, hash []byte, store dbm.Batch) error {
|
||||
for _, event := range result.Result.TxEvents {
|
||||
for _, event := range result.Result.Events {
|
||||
// only index events with a non-empty type
|
||||
if len(event.Type) == 0 {
|
||||
continue
|
||||
|
||||
@@ -47,7 +47,7 @@ func BenchmarkTxSearch(b *testing.B) {
|
||||
Data: []byte{0},
|
||||
Code: abci.CodeTypeOK,
|
||||
Log: "",
|
||||
TxEvents: events,
|
||||
Events: events,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ func TestTxIndex(t *testing.T) {
|
||||
Tx: tx,
|
||||
Result: abci.ExecTxResult{
|
||||
Data: []byte{0},
|
||||
Code: abci.CodeTypeOK, Log: "", TxEvents: nil,
|
||||
Code: abci.CodeTypeOK, Log: "", Events: nil,
|
||||
},
|
||||
}
|
||||
hash := tx.Hash()
|
||||
@@ -50,7 +50,7 @@ func TestTxIndex(t *testing.T) {
|
||||
Tx: tx2,
|
||||
Result: abci.ExecTxResult{
|
||||
Data: []byte{0},
|
||||
Code: abci.CodeTypeOK, Log: "", TxEvents: nil,
|
||||
Code: abci.CodeTypeOK, Log: "", Events: nil,
|
||||
},
|
||||
}
|
||||
hash2 := tx2.Hash()
|
||||
@@ -326,7 +326,7 @@ func txResultWithEvents(events []abci.Event) *abci.TxResult {
|
||||
Data: []byte{0},
|
||||
Code: abci.CodeTypeOK,
|
||||
Log: "",
|
||||
TxEvents: events,
|
||||
Events: events,
|
||||
},
|
||||
}
|
||||
}
|
||||
@@ -350,7 +350,7 @@ func benchmarkTxIndex(txsCount int64, b *testing.B) {
|
||||
Data: []byte{0},
|
||||
Code: abci.CodeTypeOK,
|
||||
Log: "",
|
||||
TxEvents: []abci.Event{},
|
||||
Events: []abci.Event{},
|
||||
},
|
||||
}
|
||||
if err := batch.Add(txResult); err != nil {
|
||||
|
||||
@@ -111,8 +111,8 @@ func TestABCIResponsesSaveLoad1(t *testing.T) {
|
||||
abciResponses.FinalizeBlock = new(abci.ResponseFinalizeBlock)
|
||||
abciResponses.FinalizeBlock.TxResults = dtxs
|
||||
|
||||
abciResponses.FinalizeBlock.TxResults[0] = &abci.ExecTxResult{Data: []byte("foo"), TxEvents: nil}
|
||||
abciResponses.FinalizeBlock.TxResults[1] = &abci.ExecTxResult{Data: []byte("bar"), Log: "ok", TxEvents: nil}
|
||||
abciResponses.FinalizeBlock.TxResults[0] = &abci.ExecTxResult{Data: []byte("foo"), Events: nil}
|
||||
abciResponses.FinalizeBlock.TxResults[1] = &abci.ExecTxResult{Data: []byte("bar"), Log: "ok", Events: nil}
|
||||
pbpk, err := encoding.PubKeyToProto(ed25519.GenPrivKey().PubKey())
|
||||
require.NoError(t, err)
|
||||
abciResponses.FinalizeBlock.ValidatorUpdates = []abci.ValidatorUpdate{{PubKey: pbpk, Power: 10}}
|
||||
@@ -156,7 +156,7 @@ func TestABCIResponsesSaveLoad2(t *testing.T) {
|
||||
{Code: 383},
|
||||
{
|
||||
Data: []byte("Gotcha!"),
|
||||
TxEvents: []abci.Event{
|
||||
Events: []abci.Event{
|
||||
{Type: "type1", Attributes: []abci.EventAttribute{{Key: "a", Value: "1"}}},
|
||||
{Type: "type2", Attributes: []abci.EventAttribute{{Key: "build", Value: "stuff"}}},
|
||||
},
|
||||
@@ -164,7 +164,7 @@ func TestABCIResponsesSaveLoad2(t *testing.T) {
|
||||
},
|
||||
[]*abci.ExecTxResult{
|
||||
{Code: 383, Data: nil},
|
||||
{Code: 0, Data: []byte("Gotcha!"), TxEvents: []abci.Event{
|
||||
{Code: 0, Data: []byte("Gotcha!"), Events: []abci.Event{
|
||||
{Type: "type1", Attributes: []abci.EventAttribute{{Key: "a", Value: "1"}}},
|
||||
{Type: "type2", Attributes: []abci.EventAttribute{{Key: "build", Value: "stuff"}}},
|
||||
}},
|
||||
|
||||
Reference in New Issue
Block a user