backport: implement the ADR 075 /events method (#7965) (#9497)

* rpc: implement the ADR 075 /events method (#7965)

This method implements the eventlog extension interface to expose ABCI metadata
to the log for query processing. Only the types that have ABCI events need to
implement this.

- Add an event log to the environment
- Add a sketch of the handler method
- Add an /events RPCFunc to the route map
- Implement query logic
- Subscribe to pubsub if confingured, handle termination

* add MatchesEvents test

* add TODO due to backport sequence

Co-authored-by: M. J. Fromberger <fromberger@interchain.io>
This commit is contained in:
mmsqe
2022-10-04 22:52:27 +02:00
committed by GitHub
co-authored by M. J. Fromberger
parent 069e402aa1
commit d47b675cda
10 changed files with 315 additions and 1 deletions
+12
View File
@@ -12,6 +12,7 @@ import (
abci "github.com/tendermint/tendermint/abci/types"
"github.com/tendermint/tendermint/crypto/merkle"
"github.com/tendermint/tendermint/internal/eventlog/cursor"
tmbytes "github.com/tendermint/tendermint/libs/bytes"
tmmath "github.com/tendermint/tendermint/libs/math"
service "github.com/tendermint/tendermint/libs/service"
@@ -599,6 +600,17 @@ func (c *Client) RegisterOpDecoder(typ string, dec merkle.OpDecoder) {
c.prt.RegisterOpDecoder(typ, dec)
}
// TODO(creachadair): Remove this once the RPC clients support the new method.
// This is just a placeholder to let things build during development.
func (c *Client) Events(ctx *rpctypes.Context,
filter *ctypes.EventFilter,
maxItems int,
before, after cursor.Cursor,
waitTime time.Duration,
) (*ctypes.ResultEvents, error) {
return nil, errors.New("the /events method is not implemented")
}
// SubscribeWS subscribes for events using the given query and remote address as
// a subscriber, but does not verify responses (UNSAFE)!
// TODO: verify data