Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[IBC] Add Event Logging system (#893)
## Description <!-- reviewpad:summarize:start --> ### Summary generated by Reviewpad on 13 Jul 23 12:29 UTC This pull request introduces several changes across multiple files. Here is a summary of the diff: 1. In the file `benchmark_state_test.go`, a slice of `uint8` is modified to generate a random value using the `rand.Intn` function, preventing duplicate keys. 2. In the file `persistence_module.go`, new methods `SetIBCEvent` and `GetIBCEvents` are added to enhance the persistence module's functionality for handling IBC events. 3. In a different file related to IBC functionality, imports are added, and new methods `SetIBCEvent` and `GetIBCEvents` are added for storing and retrieving IBC events at a specific height and topic. 4. In the file `persistence/types/ibc.go`, multiple changes include adding constants, new functions for generating queries, renaming a function, and modifying existing functions for handling IBC events and entries. 5. In the file `bus.go`, a new function `GetEventLogger` is added to the `bus` struct, returning a value of type `modules.EventLogger`. 6. Another file diff involves adding imports, initializing variables related to the IBC submodule, and updating the `Create()` function in the `ibc/host` package. 7. In `ibc_test.go`, there are modifications to test functions, adding new test functions, and adding an `attribute` struct. 8. A new file `ibc_event_module.go` is added, defining a package, imports, constants, types, and methods related to an event logging system. 9. Changes in `bus_module.go` show the addition of a new method `GetEventLogger` to the `Bus` interface. 10. In `persistence/debug.go`, functions `ClearAllIBCQuery`, `ClearAllIBCStoreQuery`, and `ClearAllIBCEventsQuery` are added/removed, and a modification is made to the `HandleDebugMessage` function signature. 11. A new file `event_manager.go` is added, containing the definition of the `EventManager` struct and implementing the `EventLogger` interface. 12. A change is made to add a new table creation statement for the IBCEventLog table in an unspecified file. 13. Changes in the file `ics24.md` introduce a new section for an event logging system in the IBC module, with an overview of its implementation and usage of a persistence layer. 14. A new file `ibc_events.proto` is added, defining message types for attributes and IBC events in the shared/core/types/proto directory. These changes aim to introduce and enhance functionality related to IBC events, event logging, and persistence in the project. <!-- reviewpad:summarize:end --> ## Issue Fixes #824 ## Type of change Please mark the relevant option(s): - [x] New feature, functionality or library - [ ] Bug fix - [ ] Code health or cleanup - [ ] Major breaking change - [ ] Documentation - [ ] Other <!-- add details here if it a different type of change --> ## List of changes - Adds the `EventLogger` interface and submodule - Adds methods to add events to the persistence DB - Adds methods to query the persistence DB for events by height and topic - Adds `IBCEvent` protobuf type - Registers `EventLogger` to the bus for retrieval ## Testing - [x] `make develop_test`; if any code changes were made - [x] `make test_e2e` on [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any code changes were made - [x] `e2e-devnet-test` passes tests on [DevNet](https://pocketnetwork.notion.site/How-to-DevNet-ff1598f27efe44c09f34e2aa0051f0dd); if any code was changed - [x] [Docker Compose LocalNet](https://github.com/pokt-network/pocket/blob/main/docs/development/README.md); if any major functionality was changed or introduced - [x] [k8s LocalNet](https://github.com/pokt-network/pocket/blob/main/build/localnet/README.md); if any infrastructure or configuration changes were made ## Required Checklist - [x] I have performed a self-review of my own code - [x] I have commented my code, particularly in hard-to-understand areas - [x] I have added, or updated, [`godoc` format comments](https://go.dev/blog/godoc) on touched members (see: [tip.golang.org/doc/comment](https://tip.golang.org/doc/comment)) - [x] I have tested my changes using the available tooling - [ ] I have updated the corresponding CHANGELOG ### If Applicable Checklist - [x] I have updated the corresponding README(s); local and/or global - [x] I have added tests that prove my fix is effective or that my feature works - [ ] I have added, or updated, [mermaid.js](https://mermaid-js.github.io) diagrams in the corresponding README(s) - [ ] I have added, or updated, documentation and [mermaid.js](https://mermaid-js.github.io) diagrams in `shared/docs/*` if I updated `shared/*`README(s)
- Loading branch information